@soomo/react-text-annotator 3.0.0-staging.37 → 3.0.0-staging.39
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.
- package/dist/{TextAnnotatorPopup.d.ts → TextAnnotatorPopup/TextAnnotatorPopup.d.ts} +3 -2
- package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts.map +1 -0
- package/dist/TextAnnotatorPopup/index.d.ts +2 -0
- package/dist/TextAnnotatorPopup/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useAnnouncePopupNavigation.d.ts +8 -0
- package/dist/hooks/useAnnouncePopupNavigation.d.ts.map +1 -0
- package/dist/hooks/useRestoreSelectionCaret.d.ts +13 -0
- package/dist/hooks/useRestoreSelectionCaret.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/react-text-annotator.css +31 -1
- package/dist/react-text-annotator.es.js +8 -4
- package/dist/react-text-annotator.es.js.map +1 -1
- package/dist/react-text-annotator.es11.js +445 -527
- package/dist/react-text-annotator.es11.js.map +1 -1
- package/dist/react-text-annotator.es12.js +60 -483
- package/dist/react-text-annotator.es12.js.map +1 -1
- package/dist/react-text-annotator.es13.js +45 -2
- package/dist/react-text-annotator.es13.js.map +1 -1
- package/dist/react-text-annotator.es14.js +1450 -30
- package/dist/react-text-annotator.es14.js.map +1 -1
- package/dist/react-text-annotator.es16.js +227 -37
- package/dist/react-text-annotator.es16.js.map +1 -1
- package/dist/react-text-annotator.es17.js +537 -115
- package/dist/react-text-annotator.es17.js.map +1 -1
- package/dist/react-text-annotator.es18.js +2 -2
- package/dist/react-text-annotator.es19.js +31 -2
- package/dist/react-text-annotator.es19.js.map +1 -1
- package/dist/react-text-annotator.es2.js +2 -2
- package/dist/react-text-annotator.es20.js +893 -109
- package/dist/react-text-annotator.es20.js.map +1 -1
- package/dist/react-text-annotator.es21.js +2 -309
- package/dist/react-text-annotator.es21.js.map +1 -1
- package/dist/react-text-annotator.es22.js +2 -58
- package/dist/react-text-annotator.es22.js.map +1 -1
- package/dist/react-text-annotator.es23.js +113 -19
- package/dist/react-text-annotator.es23.js.map +1 -1
- package/dist/react-text-annotator.es24.js +290 -130
- package/dist/react-text-annotator.es24.js.map +1 -1
- package/dist/react-text-annotator.es25.js +43 -545
- package/dist/react-text-annotator.es25.js.map +1 -1
- package/dist/react-text-annotator.es26.js +23 -0
- package/dist/react-text-annotator.es26.js.map +1 -0
- package/dist/react-text-annotator.es27.js +130 -0
- package/dist/react-text-annotator.es27.js.map +1 -0
- package/dist/react-text-annotator.es28.js +155 -0
- package/dist/react-text-annotator.es28.js.map +1 -0
- package/dist/react-text-annotator.es29.js +314 -0
- package/dist/react-text-annotator.es29.js.map +1 -0
- package/dist/react-text-annotator.es3.js +2 -2
- package/dist/react-text-annotator.es30.js +152 -0
- package/dist/react-text-annotator.es30.js.map +1 -0
- package/dist/react-text-annotator.es31.js +563 -0
- package/dist/react-text-annotator.es31.js.map +1 -0
- package/dist/react-text-annotator.es4.js +30 -23
- package/dist/react-text-annotator.es4.js.map +1 -1
- package/dist/react-text-annotator.es5.js +36 -78
- package/dist/react-text-annotator.es5.js.map +1 -1
- package/dist/react-text-annotator.es6.js +24 -178
- package/dist/react-text-annotator.es6.js.map +1 -1
- package/dist/react-text-annotator.es7.js +126 -10
- package/dist/react-text-annotator.es7.js.map +1 -1
- package/dist/react-text-annotator.es8.js +182 -0
- package/dist/react-text-annotator.es8.js.map +1 -0
- package/dist/react-text-annotator.es9.js +10 -670
- package/dist/react-text-annotator.es9.js.map +1 -1
- package/package.json +5 -3
- package/dist/TextAnnotatorPopup.d.ts.map +0 -1
- package/dist/react-text-annotator.es10.js +0 -244
- package/dist/react-text-annotator.es10.js.map +0 -1
- package/dist/react-text-annotator.es15.js +0 -901
- package/dist/react-text-annotator.es15.js.map +0 -1
|
@@ -1,54 +1,244 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
10
|
+
}
|
|
11
|
+
if (typeof a !== typeof b) {
|
|
4
12
|
return false;
|
|
5
13
|
}
|
|
6
|
-
|
|
7
|
-
if (parent.contains(child)) {
|
|
14
|
+
if (typeof a === "function" && a.toString() === b.toString()) {
|
|
8
15
|
return true;
|
|
9
16
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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;
|
|
15
48
|
}
|
|
16
|
-
next = next.parentNode || next.host;
|
|
17
49
|
}
|
|
50
|
+
return true;
|
|
18
51
|
}
|
|
19
|
-
return
|
|
52
|
+
return a !== a && b !== b;
|
|
20
53
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
54
|
+
function getDPR(element) {
|
|
55
|
+
if (typeof window === "undefined") {
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
58
|
+
const win = element.ownerDocument.defaultView || window;
|
|
59
|
+
return win.devicePixelRatio || 1;
|
|
23
60
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
61
|
+
function roundByDPR(element, value) {
|
|
62
|
+
const dpr = getDPR(element);
|
|
63
|
+
return Math.round(value * dpr) / dpr;
|
|
26
64
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
65
|
+
function useLatestRef(value) {
|
|
66
|
+
const ref = React.useRef(value);
|
|
67
|
+
index(() => {
|
|
68
|
+
ref.current = value;
|
|
69
|
+
});
|
|
70
|
+
return ref;
|
|
29
71
|
}
|
|
30
|
-
function
|
|
31
|
-
if (
|
|
32
|
-
|
|
72
|
+
function useFloating(options) {
|
|
73
|
+
if (options === void 0) {
|
|
74
|
+
options = {};
|
|
33
75
|
}
|
|
34
|
-
|
|
35
|
-
|
|
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);
|
|
36
100
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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 update = React.useCallback(() => {
|
|
124
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const config = {
|
|
128
|
+
placement,
|
|
129
|
+
strategy,
|
|
130
|
+
middleware: latestMiddleware
|
|
131
|
+
};
|
|
132
|
+
if (platformRef.current) {
|
|
133
|
+
config.platform = platformRef.current;
|
|
134
|
+
}
|
|
135
|
+
computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
|
|
136
|
+
const fullData = {
|
|
137
|
+
...data2,
|
|
138
|
+
isPositioned: true
|
|
139
|
+
};
|
|
140
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
141
|
+
dataRef.current = fullData;
|
|
142
|
+
ReactDOM.flushSync(() => {
|
|
143
|
+
setData(fullData);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}, [latestMiddleware, placement, strategy, platformRef]);
|
|
148
|
+
index(() => {
|
|
149
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
150
|
+
dataRef.current.isPositioned = false;
|
|
151
|
+
setData((data2) => ({
|
|
152
|
+
...data2,
|
|
153
|
+
isPositioned: false
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
}, [open]);
|
|
157
|
+
const isMountedRef = React.useRef(false);
|
|
158
|
+
index(() => {
|
|
159
|
+
isMountedRef.current = true;
|
|
160
|
+
return () => {
|
|
161
|
+
isMountedRef.current = false;
|
|
162
|
+
};
|
|
163
|
+
}, []);
|
|
164
|
+
index(() => {
|
|
165
|
+
if (referenceEl) referenceRef.current = referenceEl;
|
|
166
|
+
if (floatingEl) floatingRef.current = floatingEl;
|
|
167
|
+
if (referenceEl && floatingEl) {
|
|
168
|
+
if (whileElementsMountedRef.current) {
|
|
169
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
170
|
+
}
|
|
171
|
+
update();
|
|
172
|
+
}
|
|
173
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
174
|
+
const refs = React.useMemo(() => ({
|
|
175
|
+
reference: referenceRef,
|
|
176
|
+
floating: floatingRef,
|
|
177
|
+
setReference,
|
|
178
|
+
setFloating
|
|
179
|
+
}), [setReference, setFloating]);
|
|
180
|
+
const elements = React.useMemo(() => ({
|
|
181
|
+
reference: referenceEl,
|
|
182
|
+
floating: floatingEl
|
|
183
|
+
}), [referenceEl, floatingEl]);
|
|
184
|
+
const floatingStyles = React.useMemo(() => {
|
|
185
|
+
const initialStyles = {
|
|
186
|
+
position: strategy,
|
|
187
|
+
left: 0,
|
|
188
|
+
top: 0
|
|
189
|
+
};
|
|
190
|
+
if (!elements.floating) {
|
|
191
|
+
return initialStyles;
|
|
192
|
+
}
|
|
193
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
194
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
195
|
+
if (transform) {
|
|
196
|
+
return {
|
|
197
|
+
...initialStyles,
|
|
198
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
199
|
+
...getDPR(elements.floating) >= 1.5 && {
|
|
200
|
+
willChange: "transform"
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
position: strategy,
|
|
206
|
+
left: x,
|
|
207
|
+
top: y
|
|
208
|
+
};
|
|
209
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
210
|
+
return React.useMemo(() => ({
|
|
211
|
+
...data,
|
|
212
|
+
update,
|
|
213
|
+
refs,
|
|
214
|
+
elements,
|
|
215
|
+
floatingStyles
|
|
216
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
45
217
|
}
|
|
218
|
+
const offset = (options, deps) => ({
|
|
219
|
+
...offset$1(options),
|
|
220
|
+
options: [options, deps]
|
|
221
|
+
});
|
|
222
|
+
const shift = (options, deps) => ({
|
|
223
|
+
...shift$1(options),
|
|
224
|
+
options: [options, deps]
|
|
225
|
+
});
|
|
226
|
+
const flip = (options, deps) => ({
|
|
227
|
+
...flip$1(options),
|
|
228
|
+
options: [options, deps]
|
|
229
|
+
});
|
|
230
|
+
const inline = (options, deps) => ({
|
|
231
|
+
...inline$1(options),
|
|
232
|
+
options: [options, deps]
|
|
233
|
+
});
|
|
46
234
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
235
|
+
autoUpdate,
|
|
236
|
+
computePosition,
|
|
237
|
+
flip,
|
|
238
|
+
inline,
|
|
239
|
+
offset,
|
|
240
|
+
platform,
|
|
241
|
+
shift,
|
|
242
|
+
useFloating
|
|
53
243
|
};
|
|
54
244
|
//# sourceMappingURL=react-text-annotator.es16.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es16.js","sources":["../../../node_modules/@floating-ui/react/dist/floating-ui.react.utils.mjs"],"sourcesContent":["import { isShadowRoot, isHTMLElement } from '@floating-ui/utils/dom';\n\nfunction activeElement(doc) {\n let activeElement = doc.activeElement;\n while (((_activeElement = activeElement) == null || (_activeElement = _activeElement.shadowRoot) == null ? void 0 : _activeElement.activeElement) != null) {\n var _activeElement;\n activeElement = activeElement.shadowRoot.activeElement;\n }\n return activeElement;\n}\nfunction contains(parent, child) {\n if (!parent || !child) {\n return false;\n }\n const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();\n\n // First, attempt with faster native method\n if (parent.contains(child)) {\n return true;\n }\n\n // then fallback to custom implementation with Shadow DOM support\n if (rootNode && isShadowRoot(rootNode)) {\n let next = child;\n while (next) {\n if (parent === next) {\n return true;\n }\n // @ts-ignore\n next = next.parentNode || next.host;\n }\n }\n\n // Give up, the result is false\n return false;\n}\n// Avoid Chrome DevTools blue warning.\nfunction getPlatform() {\n const uaData = navigator.userAgentData;\n if (uaData != null && uaData.platform) {\n return uaData.platform;\n }\n return navigator.platform;\n}\nfunction getUserAgent() {\n const uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return uaData.brands.map(_ref => {\n let {\n brand,\n version\n } = _ref;\n return brand + \"/\" + version;\n }).join(' ');\n }\n return navigator.userAgent;\n}\n\n// License: https://github.com/adobe/react-spectrum/blob/b35d5c02fe900badccd0cf1a8f23bb593419f238/packages/@react-aria/utils/src/isVirtualEvent.ts\nfunction isVirtualClick(event) {\n // FIXME: Firefox is now emitting a deprecation warning for `mozInputSource`.\n // Try to find a workaround for this. `react-aria` source still has the check.\n if (event.mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n if (isAndroid() && event.pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nfunction isVirtualPointerEvent(event) {\n if (isJSDOM()) return false;\n return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||\n // iOS VoiceOver returns 0.333• for width/height.\n event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';\n}\nfunction isSafari() {\n // Chrome DevTools does not complain about navigator.vendor\n return /apple/i.test(navigator.vendor);\n}\nfunction isAndroid() {\n const re = /android/i;\n return re.test(getPlatform()) || re.test(getUserAgent());\n}\nfunction isMac() {\n return getPlatform().toLowerCase().startsWith('mac') && !navigator.maxTouchPoints;\n}\nfunction isJSDOM() {\n return getUserAgent().includes('jsdom/');\n}\nfunction isMouseLikePointerType(pointerType, strict) {\n // On some Linux machines with Chromium, mouse inputs return a `pointerType`\n // of \"pen\": https://github.com/floating-ui/floating-ui/issues/2015\n const values = ['mouse', 'pen'];\n if (!strict) {\n values.push('', undefined);\n }\n return values.includes(pointerType);\n}\nfunction isReactEvent(event) {\n return 'nativeEvent' in event;\n}\nfunction isRootElement(element) {\n return element.matches('html,body');\n}\nfunction getDocument(node) {\n return (node == null ? void 0 : node.ownerDocument) || document;\n}\nfunction isEventTargetWithin(event, node) {\n if (node == null) {\n return false;\n }\n if ('composedPath' in event) {\n return event.composedPath().includes(node);\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't\n const e = event;\n return e.target != null && node.contains(e.target);\n}\nfunction getTarget(event) {\n if ('composedPath' in event) {\n return event.composedPath()[0];\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support\n // `composedPath()`, but browsers without shadow DOM don't.\n return event.target;\n}\nconst TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),\" + \"[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nfunction isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nfunction stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nfunction isTypeableCombobox(element) {\n if (!element) return false;\n return element.getAttribute('role') === 'combobox' && isTypeableElement(element);\n}\n\nexport { TYPEABLE_SELECTOR, activeElement, contains, getDocument, getPlatform, getTarget, getUserAgent, isAndroid, isEventTargetWithin, isJSDOM, isMac, isMouseLikePointerType, isReactEvent, isRootElement, isSafari, isTypeableCombobox, isTypeableElement, isVirtualClick, isVirtualPointerEvent, stopEvent };\n"],"names":[],"mappings":";AAUA,SAAS,SAAS,QAAQ,OAAO;AAC/B,MAAI,CAAC,UAAU,CAAC,OAAO;AACrB,WAAO;AAAA,EACR;AACD,QAAM,WAAW,MAAM,eAAe,OAAO,SAAS,MAAM;AAG5D,MAAI,OAAO,SAAS,KAAK,GAAG;AAC1B,WAAO;AAAA,EACR;AAGD,MAAI,YAAY,aAAa,QAAQ,GAAG;AACtC,QAAI,OAAO;AACX,WAAO,MAAM;AACX,UAAI,WAAW,MAAM;AACnB,eAAO;AAAA,MACR;AAED,aAAO,KAAK,cAAc,KAAK;AAAA,IAChC;AAAA,EACF;AAGD,SAAO;AACT;AAgEA,SAAS,aAAa,OAAO;AAC3B,SAAO,iBAAiB;AAC1B;AACA,SAAS,cAAc,SAAS;AAC9B,SAAO,QAAQ,QAAQ,WAAW;AACpC;AACA,SAAS,YAAY,MAAM;AACzB,UAAQ,QAAQ,OAAO,SAAS,KAAK,kBAAkB;AACzD;AACA,SAAS,oBAAoB,OAAO,MAAM;AACxC,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACR;AACD,MAAI,kBAAkB,OAAO;AAC3B,WAAO,MAAM,aAAY,EAAG,SAAS,IAAI;AAAA,EAC1C;AAGD,QAAM,IAAI;AACV,SAAO,EAAE,UAAU,QAAQ,KAAK,SAAS,EAAE,MAAM;AACnD;AACA,SAAS,UAAU,OAAO;AACxB,MAAI,kBAAkB,OAAO;AAC3B,WAAO,MAAM,eAAe,CAAC;AAAA,EAC9B;AAID,SAAO,MAAM;AACf;","x_google_ignoreList":[0]}
|
|
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 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 isPositioned: true\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]);\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,QAAQ;AACpC,aAAO;AAAA,IACR;AACD,SAAK,IAAI,QAAQ,QAAQ,KAAI;AAC3B,UAAI,CAAC,CAAE,EAAC,eAAe,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG;AACvC,eAAO;AAAA,MACR;AAAA,IACF;AACD,SAAK,IAAI,QAAQ,QAAQ,KAAI;AAC3B,YAAM,MAAM,KAAK,CAAC;AAClB,UAAI,Q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