@soomo/react-text-annotator 3.1.0-staging.4 → 3.1.0-staging.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,249 +1,85 @@
1
- import { computePosition, offset as offset$1, shift as shift$1, flip as flip$1, inline as inline$1 } from "./react-text-annotator.es17.js";
2
- import { autoUpdate, platform } from "./react-text-annotator.es17.js";
3
- import * as React from "react";
4
- import { useLayoutEffect, useEffect } from "react";
5
- import * as ReactDOM from "react-dom";
6
- var index = typeof document !== "undefined" ? useLayoutEffect : useEffect;
7
- function deepEqual(a, b) {
8
- if (a === b) {
9
- return true;
1
+ const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7e3;
2
+ let $319e236875307eab$var$liveAnnouncer = null;
3
+ function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
4
+ if (!$319e236875307eab$var$liveAnnouncer) {
5
+ $319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();
6
+ if (!(typeof IS_REACT_ACT_ENVIRONMENT === "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== "undefined")) setTimeout(() => {
7
+ if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached()) $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
8
+ }, 100);
9
+ else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
10
+ } else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
11
+ }
12
+ function $319e236875307eab$export$d8686216b8b81b2f() {
13
+ if ($319e236875307eab$var$liveAnnouncer) {
14
+ $319e236875307eab$var$liveAnnouncer.destroy();
15
+ $319e236875307eab$var$liveAnnouncer = null;
10
16
  }
11
- if (typeof a !== typeof b) {
12
- return false;
17
+ }
18
+ class $319e236875307eab$var$LiveAnnouncer {
19
+ isAttached() {
20
+ var _this_node;
21
+ return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;
13
22
  }
14
- if (typeof a === "function" && a.toString() === b.toString()) {
15
- return true;
23
+ createLog(ariaLive) {
24
+ let node = document.createElement("div");
25
+ node.setAttribute("role", "log");
26
+ node.setAttribute("aria-live", ariaLive);
27
+ node.setAttribute("aria-relevant", "additions");
28
+ return node;
16
29
  }
17
- let length;
18
- let i;
19
- let keys;
20
- if (a && b && typeof a === "object") {
21
- if (Array.isArray(a)) {
22
- length = a.length;
23
- if (length !== b.length) return false;
24
- for (i = length; i-- !== 0; ) {
25
- if (!deepEqual(a[i], b[i])) {
26
- return false;
27
- }
28
- }
29
- return true;
30
- }
31
- keys = Object.keys(a);
32
- length = keys.length;
33
- if (length !== Object.keys(b).length) {
34
- return false;
35
- }
36
- for (i = length; i-- !== 0; ) {
37
- if (!{}.hasOwnProperty.call(b, keys[i])) {
38
- return false;
39
- }
40
- }
41
- for (i = length; i-- !== 0; ) {
42
- const key = keys[i];
43
- if (key === "_owner" && a.$$typeof) {
44
- continue;
45
- }
46
- if (!deepEqual(a[key], b[key])) {
47
- return false;
48
- }
49
- }
50
- return true;
30
+ destroy() {
31
+ if (!this.node) return;
32
+ document.body.removeChild(this.node);
33
+ this.node = null;
51
34
  }
52
- return a !== a && b !== b;
53
- }
54
- function getDPR(element) {
55
- if (typeof window === "undefined") {
56
- return 1;
35
+ announce(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
36
+ var _this_assertiveLog, _this_politeLog;
37
+ if (!this.node) return;
38
+ let node = document.createElement("div");
39
+ if (typeof message === "object") {
40
+ node.setAttribute("role", "img");
41
+ node.setAttribute("aria-labelledby", message["aria-labelledby"]);
42
+ } else node.textContent = message;
43
+ if (assertiveness === "assertive") (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node);
44
+ else (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node);
45
+ if (message !== "") setTimeout(() => {
46
+ node.remove();
47
+ }, timeout);
57
48
  }
58
- const win = element.ownerDocument.defaultView || window;
59
- return win.devicePixelRatio || 1;
60
- }
61
- function roundByDPR(element, value) {
62
- const dpr = getDPR(element);
63
- return Math.round(value * dpr) / dpr;
64
- }
65
- function useLatestRef(value) {
66
- const ref = React.useRef(value);
67
- index(() => {
68
- ref.current = value;
69
- });
70
- return ref;
71
- }
72
- function useFloating(options) {
73
- if (options === void 0) {
74
- options = {};
49
+ clear(assertiveness) {
50
+ if (!this.node) return;
51
+ if ((!assertiveness || assertiveness === "assertive") && this.assertiveLog) this.assertiveLog.innerHTML = "";
52
+ if ((!assertiveness || assertiveness === "polite") && this.politeLog) this.politeLog.innerHTML = "";
75
53
  }
76
- const {
77
- placement = "bottom",
78
- strategy = "absolute",
79
- middleware = [],
80
- platform: platform2,
81
- elements: {
82
- reference: externalReference,
83
- floating: externalFloating
84
- } = {},
85
- transform = true,
86
- whileElementsMounted,
87
- open
88
- } = options;
89
- const [data, setData] = React.useState({
90
- x: 0,
91
- y: 0,
92
- strategy,
93
- placement,
94
- middlewareData: {},
95
- isPositioned: false
96
- });
97
- const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
98
- if (!deepEqual(latestMiddleware, middleware)) {
99
- setLatestMiddleware(middleware);
100
- }
101
- const [_reference, _setReference] = React.useState(null);
102
- const [_floating, _setFloating] = React.useState(null);
103
- const setReference = React.useCallback((node) => {
104
- if (node !== referenceRef.current) {
105
- referenceRef.current = node;
106
- _setReference(node);
107
- }
108
- }, []);
109
- const setFloating = React.useCallback((node) => {
110
- if (node !== floatingRef.current) {
111
- floatingRef.current = node;
112
- _setFloating(node);
113
- }
114
- }, []);
115
- const referenceEl = externalReference || _reference;
116
- const floatingEl = externalFloating || _floating;
117
- const referenceRef = React.useRef(null);
118
- const floatingRef = React.useRef(null);
119
- const dataRef = React.useRef(data);
120
- const hasWhileElementsMounted = whileElementsMounted != null;
121
- const whileElementsMountedRef = useLatestRef(whileElementsMounted);
122
- const platformRef = useLatestRef(platform2);
123
- const openRef = useLatestRef(open);
124
- const update = React.useCallback(() => {
125
- if (!referenceRef.current || !floatingRef.current) {
126
- return;
127
- }
128
- const config = {
129
- placement,
130
- strategy,
131
- middleware: latestMiddleware
132
- };
133
- if (platformRef.current) {
134
- config.platform = platformRef.current;
135
- }
136
- computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
137
- const fullData = {
138
- ...data2,
139
- // The floating element's position may be recomputed while it's closed
140
- // but still mounted (such as when transitioning out). To ensure
141
- // `isPositioned` will be `false` initially on the next open, avoid
142
- // setting it to `true` when `open === false` (must be specified).
143
- isPositioned: openRef.current !== false
144
- };
145
- if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
146
- dataRef.current = fullData;
147
- ReactDOM.flushSync(() => {
148
- setData(fullData);
149
- });
150
- }
151
- });
152
- }, [latestMiddleware, placement, strategy, platformRef, openRef]);
153
- index(() => {
154
- if (open === false && dataRef.current.isPositioned) {
155
- dataRef.current.isPositioned = false;
156
- setData((data2) => ({
157
- ...data2,
158
- isPositioned: false
159
- }));
54
+ constructor() {
55
+ this.node = null;
56
+ this.assertiveLog = null;
57
+ this.politeLog = null;
58
+ if (typeof document !== "undefined") {
59
+ this.node = document.createElement("div");
60
+ this.node.dataset.liveAnnouncer = "true";
61
+ Object.assign(this.node.style, {
62
+ border: 0,
63
+ clip: "rect(0 0 0 0)",
64
+ clipPath: "inset(50%)",
65
+ height: "1px",
66
+ margin: "-1px",
67
+ overflow: "hidden",
68
+ padding: 0,
69
+ position: "absolute",
70
+ width: "1px",
71
+ whiteSpace: "nowrap"
72
+ });
73
+ this.assertiveLog = this.createLog("assertive");
74
+ this.node.appendChild(this.assertiveLog);
75
+ this.politeLog = this.createLog("polite");
76
+ this.node.appendChild(this.politeLog);
77
+ document.body.prepend(this.node);
160
78
  }
161
- }, [open]);
162
- const isMountedRef = React.useRef(false);
163
- index(() => {
164
- isMountedRef.current = true;
165
- return () => {
166
- isMountedRef.current = false;
167
- };
168
- }, []);
169
- index(() => {
170
- if (referenceEl) referenceRef.current = referenceEl;
171
- if (floatingEl) floatingRef.current = floatingEl;
172
- if (referenceEl && floatingEl) {
173
- if (whileElementsMountedRef.current) {
174
- return whileElementsMountedRef.current(referenceEl, floatingEl, update);
175
- }
176
- update();
177
- }
178
- }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
179
- const refs = React.useMemo(() => ({
180
- reference: referenceRef,
181
- floating: floatingRef,
182
- setReference,
183
- setFloating
184
- }), [setReference, setFloating]);
185
- const elements = React.useMemo(() => ({
186
- reference: referenceEl,
187
- floating: floatingEl
188
- }), [referenceEl, floatingEl]);
189
- const floatingStyles = React.useMemo(() => {
190
- const initialStyles = {
191
- position: strategy,
192
- left: 0,
193
- top: 0
194
- };
195
- if (!elements.floating) {
196
- return initialStyles;
197
- }
198
- const x = roundByDPR(elements.floating, data.x);
199
- const y = roundByDPR(elements.floating, data.y);
200
- if (transform) {
201
- return {
202
- ...initialStyles,
203
- transform: "translate(" + x + "px, " + y + "px)",
204
- ...getDPR(elements.floating) >= 1.5 && {
205
- willChange: "transform"
206
- }
207
- };
208
- }
209
- return {
210
- position: strategy,
211
- left: x,
212
- top: y
213
- };
214
- }, [strategy, transform, elements.floating, data.x, data.y]);
215
- return React.useMemo(() => ({
216
- ...data,
217
- update,
218
- refs,
219
- elements,
220
- floatingStyles
221
- }), [data, update, refs, elements, floatingStyles]);
79
+ }
222
80
  }
223
- const offset = (options, deps) => ({
224
- ...offset$1(options),
225
- options: [options, deps]
226
- });
227
- const shift = (options, deps) => ({
228
- ...shift$1(options),
229
- options: [options, deps]
230
- });
231
- const flip = (options, deps) => ({
232
- ...flip$1(options),
233
- options: [options, deps]
234
- });
235
- const inline = (options, deps) => ({
236
- ...inline$1(options),
237
- options: [options, deps]
238
- });
239
81
  export {
240
- autoUpdate,
241
- computePosition,
242
- flip,
243
- inline,
244
- offset,
245
- platform,
246
- shift,
247
- useFloating
82
+ $319e236875307eab$export$a9b970dcc4ae71a9 as announce,
83
+ $319e236875307eab$export$d8686216b8b81b2f as destroyAnnouncer
248
84
  };
249
85
  //# sourceMappingURL=react-text-annotator.es16.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es16.js","sources":["../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs"],"sourcesContent":["import { computePosition, arrow as arrow$2, offset as offset$1, shift as shift$1, limitShift as limitShift$1, flip as flip$1, size as size$1, autoPlacement as autoPlacement$1, hide as hide$1, inline as inline$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect, useEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar index = typeof document !== 'undefined' ? useLayoutEffect : useEffect;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => ({\n ...offset$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => ({\n ...shift$1(options),\n options: [options, deps]\n});\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => ({\n ...limitShift$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => ({\n ...flip$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => ({\n ...size$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => ({\n ...autoPlacement$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => ({\n ...hide$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => ({\n ...inline$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => ({\n ...arrow$1(options),\n options: [options, deps]\n});\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n"],"names":["platform","data"],"mappings":";;;;;AAMA,IAAI,QAAQ,OAAO,aAAa,cAAc,kBAAkB;AAIhE,SAAS,UAAU,GAAG,GAAG;AACvB,MAAI,MAAM,GAAG;AACX,WAAO;AAAA,EACR;AACD,MAAI,OAAO,MAAM,OAAO,GAAG;AACzB,WAAO;AAAA,EACR;AACD,MAAI,OAAO,MAAM,cAAc,EAAE,eAAe,EAAE,YAAY;AAC5D,WAAO;AAAA,EACR;AACD,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI,KAAK,KAAK,OAAO,MAAM,UAAU;AACnC,QAAI,MAAM,QAAQ,CAAC,GAAG;AACpB,eAAS,EAAE;AACX,UAAI,WAAW,EAAE,OAAQ,QAAO;AAChC,WAAK,IAAI,QAAQ,QAAQ,KAAI;AAC3B,YAAI,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG;AAC1B,iBAAO;AAAA,QACR;AAAA,MACF;AACD,aAAO;AAAA,IACR;AACD,WAAO,OAAO,KAAK,CAAC;AACpB,aAAS,KAAK;AACd,QAAI,WAAW,OAAO,KAAK,CAAC,EAAE,QAA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/live-announcer/dist/LiveAnnouncer.mjs"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */ /* Inspired by https://github.com/AlmeroSteyn/react-aria-live */ const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7000;\nlet $319e236875307eab$var$liveAnnouncer = null;\nfunction $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = 'assertive', timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {\n if (!$319e236875307eab$var$liveAnnouncer) {\n $319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();\n // wait for the live announcer regions to be added to the dom, then announce\n // otherwise Safari won't announce the message if it's added too quickly\n // found most times less than 100ms were not consistent when announcing with Safari\n // IS_REACT_ACT_ENVIRONMENT is used by React 18. Previous versions checked for the `jest` global.\n // https://github.com/reactwg/react-18/discussions/102\n // if we're in a test environment, announce without waiting\n // @ts-ignore\n if (!(typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== 'undefined')) setTimeout(()=>{\n if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached()) $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n }, 100);\n else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n } else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n}\nfunction $319e236875307eab$export$d10ae4f68404609a(assertiveness) {\n if ($319e236875307eab$var$liveAnnouncer) $319e236875307eab$var$liveAnnouncer.clear(assertiveness);\n}\nfunction $319e236875307eab$export$d8686216b8b81b2f() {\n if ($319e236875307eab$var$liveAnnouncer) {\n $319e236875307eab$var$liveAnnouncer.destroy();\n $319e236875307eab$var$liveAnnouncer = null;\n }\n}\n// LiveAnnouncer is implemented using vanilla DOM, not React. That's because as of React 18\n// ReactDOM.render is deprecated, and the replacement, ReactDOM.createRoot is moved into a\n// subpath import `react-dom/client`. That makes it hard for us to support multiple React versions.\n// As a global API, we can't use portals without introducing a breaking API change. LiveAnnouncer\n// is simple enough to implement without React, so that's what we do here.\n// See this discussion for more details: https://github.com/reactwg/react-18/discussions/125#discussioncomment-2382638\nclass $319e236875307eab$var$LiveAnnouncer {\n isAttached() {\n var _this_node;\n return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;\n }\n createLog(ariaLive) {\n let node = document.createElement('div');\n node.setAttribute('role', 'log');\n node.setAttribute('aria-live', ariaLive);\n node.setAttribute('aria-relevant', 'additions');\n return node;\n }\n destroy() {\n if (!this.node) return;\n document.body.removeChild(this.node);\n this.node = null;\n }\n announce(message, assertiveness = 'assertive', timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {\n var _this_assertiveLog, _this_politeLog;\n if (!this.node) return;\n let node = document.createElement('div');\n if (typeof message === 'object') {\n // To read an aria-labelledby, the element must have an appropriate role, such as img.\n node.setAttribute('role', 'img');\n node.setAttribute('aria-labelledby', message['aria-labelledby']);\n } else node.textContent = message;\n if (assertiveness === 'assertive') (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node);\n else (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node);\n if (message !== '') setTimeout(()=>{\n node.remove();\n }, timeout);\n }\n clear(assertiveness) {\n if (!this.node) return;\n if ((!assertiveness || assertiveness === 'assertive') && this.assertiveLog) this.assertiveLog.innerHTML = '';\n if ((!assertiveness || assertiveness === 'polite') && this.politeLog) this.politeLog.innerHTML = '';\n }\n constructor(){\n this.node = null;\n this.assertiveLog = null;\n this.politeLog = null;\n if (typeof document !== 'undefined') {\n this.node = document.createElement('div');\n this.node.dataset.liveAnnouncer = 'true';\n // copied from VisuallyHidden\n Object.assign(this.node.style, {\n border: 0,\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: '1px',\n whiteSpace: 'nowrap'\n });\n this.assertiveLog = this.createLog('assertive');\n this.node.appendChild(this.assertiveLog);\n this.politeLog = this.createLog('polite');\n this.node.appendChild(this.politeLog);\n document.body.prepend(this.node);\n }\n }\n}\n\n\nexport {$319e236875307eab$export$a9b970dcc4ae71a9 as announce, $319e236875307eab$export$d10ae4f68404609a as clearAnnouncer, $319e236875307eab$export$d8686216b8b81b2f as destroyAnnouncer};\n//# sourceMappingURL=LiveAnnouncer.module.js.map\n"],"names":[],"mappings":"AAUqE,MAAM,iDAAiD;AAC5H,IAAI,sCAAsC;AAC1C,SAAS,0CAA0C,SAAS,gBAAgB,aAAa,UAAU,gDAAgD;AAC/I,MAAI,CAAC,qCAAqC;AACtC,0CAAsC,IAAI;AAQ1C,QAAI,EAAE,OAAO,6BAA6B,YAAY,2BAA2B,OAAO,SAAS,aAAc,YAAW,MAAI;AAC1H,UAAI,wCAAwC,QAAQ,wCAAwC,SAAS,SAAS,oCAAoC,WAAU,EAAI,yCAAwC,QAAQ,wCAAwC,SAAS,SAAS,oCAAoC,SAAS,SAAS,eAAe,OAAO;AAAA,IACzV,GAAE,GAAG;AAAA,QACD,qCAAoC,SAAS,SAAS,eAAe,OAAO;AAAA,EACpF,MAAM,qCAAoC,SAAS,SAAS,eAAe,OAAO;AACvF;AAIA,SAAS,4CAA4C;AACjD,MAAI,qCAAq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