@soomo/react-text-annotator 3.0.0-staging.19 → 3.0.0-staging.20
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/react-text-annotator.es10.js +6 -1
- package/dist/react-text-annotator.es10.js.map +1 -1
- package/dist/react-text-annotator.es11.js +212 -547
- package/dist/react-text-annotator.es11.js.map +1 -1
- package/dist/react-text-annotator.es12.js +535 -444
- package/dist/react-text-annotator.es12.js.map +1 -1
- package/dist/react-text-annotator.es13.js +488 -2
- package/dist/react-text-annotator.es13.js.map +1 -1
- package/dist/react-text-annotator.es14.js +2 -35
- package/dist/react-text-annotator.es14.js.map +1 -1
- package/dist/react-text-annotator.es15.js +24 -888
- package/dist/react-text-annotator.es15.js.map +1 -1
- package/dist/react-text-annotator.es16.js +891 -220
- package/dist/react-text-annotator.es16.js.map +1 -1
- package/dist/react-text-annotator.es18.js +2 -114
- package/dist/react-text-annotator.es18.js.map +1 -1
- package/dist/react-text-annotator.es19.js +2 -309
- package/dist/react-text-annotator.es19.js.map +1 -1
- package/dist/react-text-annotator.es2.js +1 -1
- package/dist/react-text-annotator.es20.js +109 -53
- package/dist/react-text-annotator.es20.js.map +1 -1
- package/dist/react-text-annotator.es21.js +306 -17
- package/dist/react-text-annotator.es21.js.map +1 -1
- package/dist/react-text-annotator.es22.js +58 -2
- package/dist/react-text-annotator.es22.js.map +1 -1
- package/dist/react-text-annotator.es23.js +20 -2
- package/dist/react-text-annotator.es23.js.map +1 -1
- package/dist/react-text-annotator.es25.js +1 -1
- package/dist/react-text-annotator.es25.js.map +1 -1
- package/dist/react-text-annotator.es5.js +2 -1
- package/dist/react-text-annotator.es5.js.map +1 -1
- package/dist/react-text-annotator.es6.js +60 -60
- package/dist/react-text-annotator.es6.js.map +1 -1
- package/dist/react-text-annotator.es7.js +3 -3
- package/package.json +8 -8
|
@@ -1,491 +1,582 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import { offset as offset$1, autoPlacement as autoPlacement$1, shift as shift$1, inline as inline$1, computePosition as computePosition$1 } from "./react-text-annotator.es25.js";
|
|
2
|
+
import { createCoords, rectToClientRect, round, floor, max, min } from "./react-text-annotator.es24.js";
|
|
3
|
+
import { getOverflowAncestors, isElement, getWindow, getComputedStyle, getDocumentElement, isHTMLElement, isWebKit, getNodeName, isOverflowElement, getNodeScroll, getParentNode, isLastTraversableNode, isTableElement, isContainingBlock, getContainingBlock } from "./react-text-annotator.es17.js";
|
|
4
|
+
function getCssDimensions(element) {
|
|
5
|
+
const css = getComputedStyle(element);
|
|
6
|
+
let width = parseFloat(css.width) || 0;
|
|
7
|
+
let height = parseFloat(css.height) || 0;
|
|
8
|
+
const hasOffset = isHTMLElement(element);
|
|
9
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
10
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
11
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
12
|
+
if (shouldFallback) {
|
|
13
|
+
width = offsetWidth;
|
|
14
|
+
height = offsetHeight;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
$: shouldFallback
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function unwrapElement(element) {
|
|
23
|
+
return !isElement(element) ? element.contextElement : element;
|
|
24
|
+
}
|
|
25
|
+
function getScale(element) {
|
|
26
|
+
const domElement = unwrapElement(element);
|
|
27
|
+
if (!isHTMLElement(domElement)) {
|
|
28
|
+
return createCoords(1);
|
|
29
|
+
}
|
|
30
|
+
const rect = domElement.getBoundingClientRect();
|
|
31
|
+
const {
|
|
32
|
+
width,
|
|
33
|
+
height,
|
|
34
|
+
$
|
|
35
|
+
} = getCssDimensions(domElement);
|
|
36
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
37
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
38
|
+
if (!x || !Number.isFinite(x)) {
|
|
39
|
+
x = 1;
|
|
40
|
+
}
|
|
41
|
+
if (!y || !Number.isFinite(y)) {
|
|
42
|
+
y = 1;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
x,
|
|
46
|
+
y
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const noOffsets = /* @__PURE__ */ createCoords(0);
|
|
50
|
+
function getVisualOffsets(element) {
|
|
51
|
+
const win = getWindow(element);
|
|
52
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
53
|
+
return noOffsets;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
x: win.visualViewport.offsetLeft,
|
|
57
|
+
y: win.visualViewport.offsetTop
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
61
|
+
if (isFixed === void 0) {
|
|
62
|
+
isFixed = false;
|
|
63
|
+
}
|
|
64
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return isFixed;
|
|
68
|
+
}
|
|
69
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
70
|
+
if (includeScale === void 0) {
|
|
71
|
+
includeScale = false;
|
|
72
|
+
}
|
|
73
|
+
if (isFixedStrategy === void 0) {
|
|
74
|
+
isFixedStrategy = false;
|
|
75
|
+
}
|
|
76
|
+
const clientRect = element.getBoundingClientRect();
|
|
77
|
+
const domElement = unwrapElement(element);
|
|
78
|
+
let scale = createCoords(1);
|
|
79
|
+
if (includeScale) {
|
|
80
|
+
if (offsetParent) {
|
|
81
|
+
if (isElement(offsetParent)) {
|
|
82
|
+
scale = getScale(offsetParent);
|
|
26
83
|
}
|
|
27
|
-
}
|
|
28
|
-
this.els = [];
|
|
29
|
-
this.namespaces = /* @__PURE__ */ new Map();
|
|
30
|
-
this.behaviors = {};
|
|
31
|
-
this.hasStyle = false;
|
|
32
|
-
this.prefixDefs = [];
|
|
33
|
-
this.debug = this.options.debug === true ? true : false;
|
|
34
|
-
this.discardContent = this.options.discardContent === true ? true : false;
|
|
35
|
-
if (this.options.base) {
|
|
36
|
-
this.base = this.options.base;
|
|
37
84
|
} else {
|
|
38
|
-
|
|
39
|
-
if (window) {
|
|
40
|
-
this.base = window.location.href.replace(/\/[^\/]*$/, "/");
|
|
41
|
-
}
|
|
42
|
-
} catch (e) {
|
|
43
|
-
this.base = "";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!this.options.omitDefaultBehaviors) {
|
|
47
|
-
this.addBehaviors(defaultBehaviors);
|
|
48
|
-
}
|
|
49
|
-
if (this.options.ignoreFragmentId) {
|
|
50
|
-
if (window) {
|
|
51
|
-
window.removeEventListener("ceteiceanload", CETEI.restorePosition);
|
|
52
|
-
}
|
|
85
|
+
scale = getScale(element);
|
|
53
86
|
}
|
|
54
87
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
88
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
89
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
90
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
91
|
+
let width = clientRect.width / scale.x;
|
|
92
|
+
let height = clientRect.height / scale.y;
|
|
93
|
+
if (domElement) {
|
|
94
|
+
const win = getWindow(domElement);
|
|
95
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
96
|
+
let currentWin = win;
|
|
97
|
+
let currentIFrame = currentWin.frameElement;
|
|
98
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
99
|
+
const iframeScale = getScale(currentIFrame);
|
|
100
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
101
|
+
const css = getComputedStyle(currentIFrame);
|
|
102
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
103
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
104
|
+
x *= iframeScale.x;
|
|
105
|
+
y *= iframeScale.y;
|
|
106
|
+
width *= iframeScale.x;
|
|
107
|
+
height *= iframeScale.y;
|
|
108
|
+
x += left;
|
|
109
|
+
y += top;
|
|
110
|
+
currentWin = getWindow(currentIFrame);
|
|
111
|
+
currentIFrame = currentWin.frameElement;
|
|
63
112
|
}
|
|
113
|
+
}
|
|
114
|
+
return rectToClientRect({
|
|
115
|
+
width,
|
|
116
|
+
height,
|
|
117
|
+
x,
|
|
118
|
+
y
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const topLayerSelectors = [":popover-open", ":modal"];
|
|
122
|
+
function isTopLayer(element) {
|
|
123
|
+
return topLayerSelectors.some((selector) => {
|
|
64
124
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return this.makeHTML5(XML, callback, perElementFn);
|
|
69
|
-
} else {
|
|
70
|
-
console.log(`Could not get XML file ${XML_url}.
|
|
71
|
-
Server returned ${response.status}: ${response.statusText}`);
|
|
72
|
-
}
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.log(error);
|
|
125
|
+
return element.matches(selector);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
return false;
|
|
75
128
|
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
132
|
+
let {
|
|
133
|
+
elements,
|
|
134
|
+
rect,
|
|
135
|
+
offsetParent,
|
|
136
|
+
strategy
|
|
137
|
+
} = _ref;
|
|
138
|
+
const isFixed = strategy === "fixed";
|
|
139
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
140
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
141
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
142
|
+
return rect;
|
|
76
143
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
let convertEl = (el) => {
|
|
88
|
-
let newElement;
|
|
89
|
-
if (this.namespaces.has(el.namespaceURI ? el.namespaceURI : "")) {
|
|
90
|
-
let prefix = this.namespaces.get(el.namespaceURI ? el.namespaceURI : "");
|
|
91
|
-
newElement = this.document.createElement(`${prefix}-${el.localName.toLowerCase()}`);
|
|
92
|
-
} else {
|
|
93
|
-
newElement = this.document.importNode(el, false);
|
|
94
|
-
}
|
|
95
|
-
for (let att of Array.from(el.attributes)) {
|
|
96
|
-
if (att.name == "xmlns") {
|
|
97
|
-
newElement.setAttribute("data-xmlns", att.value);
|
|
98
|
-
} else {
|
|
99
|
-
newElement.setAttribute(att.name, att.value);
|
|
100
|
-
}
|
|
101
|
-
if (att.name == "xml:id") {
|
|
102
|
-
newElement.setAttribute("id", att.value);
|
|
103
|
-
}
|
|
104
|
-
if (att.name == "xml:lang") {
|
|
105
|
-
newElement.setAttribute("lang", att.value);
|
|
106
|
-
}
|
|
107
|
-
if (att.name == "rendition") {
|
|
108
|
-
newElement.setAttribute("class", att.value.replace(/#/g, ""));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
newElement.setAttribute("data-origname", el.localName);
|
|
112
|
-
if (el.hasAttributes()) {
|
|
113
|
-
newElement.setAttribute("data-origatts", el.getAttributeNames().join(" "));
|
|
114
|
-
}
|
|
115
|
-
if (el.childNodes.length == 0) {
|
|
116
|
-
newElement.setAttribute("data-empty", "");
|
|
117
|
-
}
|
|
118
|
-
if (el.localName == "head") {
|
|
119
|
-
let level = XML_dom.evaluate("count(ancestor::*[tei:head])", el, function(ns) {
|
|
120
|
-
if (ns == "tei")
|
|
121
|
-
return "http://www.tei-c.org/ns/1.0";
|
|
122
|
-
}, 1, null);
|
|
123
|
-
newElement.setAttribute("data-level", level.numberValue);
|
|
124
|
-
}
|
|
125
|
-
if (el.localName == "tagsDecl") {
|
|
126
|
-
let style = this.document.createElement("style");
|
|
127
|
-
for (let node of Array.from(el.childNodes)) {
|
|
128
|
-
if (node.nodeType == 1 && node.localName == "rendition" && node.getAttribute("scheme") == "css") {
|
|
129
|
-
let rule = "";
|
|
130
|
-
if (node.hasAttribute("selector")) {
|
|
131
|
-
rule += node.getAttribute("selector").replace(/([^#, >]+\w*)/g, "tei-$1").replace(/#tei-/g, "#") + "{\n";
|
|
132
|
-
rule += node.textContent;
|
|
133
|
-
} else {
|
|
134
|
-
rule += "." + node.getAttribute("xml:id") + "{\n";
|
|
135
|
-
rule += node.textContent;
|
|
136
|
-
}
|
|
137
|
-
rule += "\n}\n";
|
|
138
|
-
style.appendChild(this.document.createTextNode(rule));
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (style.childNodes.length > 0) {
|
|
142
|
-
newElement.appendChild(style);
|
|
143
|
-
this.hasStyle = true;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (el.localName == "prefixDef") {
|
|
147
|
-
this.prefixDefs.push(el.getAttribute("ident"));
|
|
148
|
-
this.prefixDefs[el.getAttribute("ident")] = {
|
|
149
|
-
"matchPattern": el.getAttribute("matchPattern"),
|
|
150
|
-
"replacementPattern": el.getAttribute("replacementPattern")
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
for (let node of Array.from(el.childNodes)) {
|
|
154
|
-
if (node.nodeType == 1) {
|
|
155
|
-
newElement.appendChild(convertEl(node));
|
|
156
|
-
} else {
|
|
157
|
-
newElement.appendChild(node.cloneNode());
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (perElementFn) {
|
|
161
|
-
perElementFn(newElement, el);
|
|
162
|
-
}
|
|
163
|
-
return newElement;
|
|
164
|
-
};
|
|
165
|
-
this.dom = this.document.createDocumentFragment();
|
|
166
|
-
for (let node of Array.from(XML_dom.childNodes)) {
|
|
167
|
-
if (node.nodeType == 1) {
|
|
168
|
-
this.dom.appendChild(convertEl(node));
|
|
169
|
-
}
|
|
170
|
-
if (node.nodeType == 7) {
|
|
171
|
-
this.dom.appendChild(this.document.importNode(node, true));
|
|
172
|
-
}
|
|
173
|
-
if (node.nodeType == 8) {
|
|
174
|
-
this.dom.appendChild(this.document.importNode(node, true));
|
|
175
|
-
}
|
|
144
|
+
let scroll = {
|
|
145
|
+
scrollLeft: 0,
|
|
146
|
+
scrollTop: 0
|
|
147
|
+
};
|
|
148
|
+
let scale = createCoords(1);
|
|
149
|
+
const offsets = createCoords(0);
|
|
150
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
151
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
152
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
153
|
+
scroll = getNodeScroll(offsetParent);
|
|
176
154
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
} else {
|
|
184
|
-
if (typeof window !== "undefined") {
|
|
185
|
-
window.dispatchEvent(ceteiceanLoad);
|
|
186
|
-
}
|
|
187
|
-
return this.dom;
|
|
155
|
+
if (isHTMLElement(offsetParent)) {
|
|
156
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
157
|
+
scale = getScale(offsetParent);
|
|
158
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
159
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
188
160
|
}
|
|
189
161
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
162
|
+
return {
|
|
163
|
+
width: rect.width * scale.x,
|
|
164
|
+
height: rect.height * scale.y,
|
|
165
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
166
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function getClientRects(element) {
|
|
170
|
+
return Array.from(element.getClientRects());
|
|
171
|
+
}
|
|
172
|
+
function getWindowScrollBarX(element) {
|
|
173
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
174
|
+
}
|
|
175
|
+
function getDocumentRect(element) {
|
|
176
|
+
const html = getDocumentElement(element);
|
|
177
|
+
const scroll = getNodeScroll(element);
|
|
178
|
+
const body = element.ownerDocument.body;
|
|
179
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
180
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
181
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
182
|
+
const y = -scroll.scrollTop;
|
|
183
|
+
if (getComputedStyle(body).direction === "rtl") {
|
|
184
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
209
185
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
186
|
+
return {
|
|
187
|
+
width,
|
|
188
|
+
height,
|
|
189
|
+
x,
|
|
190
|
+
y
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function getViewportRect(element, strategy) {
|
|
194
|
+
const win = getWindow(element);
|
|
195
|
+
const html = getDocumentElement(element);
|
|
196
|
+
const visualViewport = win.visualViewport;
|
|
197
|
+
let width = html.clientWidth;
|
|
198
|
+
let height = html.clientHeight;
|
|
199
|
+
let x = 0;
|
|
200
|
+
let y = 0;
|
|
201
|
+
if (visualViewport) {
|
|
202
|
+
width = visualViewport.width;
|
|
203
|
+
height = visualViewport.height;
|
|
204
|
+
const visualViewportBased = isWebKit();
|
|
205
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
206
|
+
x = visualViewport.offsetLeft;
|
|
207
|
+
y = visualViewport.offsetTop;
|
|
221
208
|
}
|
|
222
209
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
}
|
|
210
|
+
return {
|
|
211
|
+
width,
|
|
212
|
+
height,
|
|
213
|
+
x,
|
|
214
|
+
y
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
218
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
219
|
+
const top = clientRect.top + element.clientTop;
|
|
220
|
+
const left = clientRect.left + element.clientLeft;
|
|
221
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
222
|
+
const width = element.clientWidth * scale.x;
|
|
223
|
+
const height = element.clientHeight * scale.y;
|
|
224
|
+
const x = left * scale.x;
|
|
225
|
+
const y = top * scale.y;
|
|
226
|
+
return {
|
|
227
|
+
width,
|
|
228
|
+
height,
|
|
229
|
+
x,
|
|
230
|
+
y
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
234
|
+
let rect;
|
|
235
|
+
if (clippingAncestor === "viewport") {
|
|
236
|
+
rect = getViewportRect(element, strategy);
|
|
237
|
+
} else if (clippingAncestor === "document") {
|
|
238
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
239
|
+
} else if (isElement(clippingAncestor)) {
|
|
240
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
241
|
+
} else {
|
|
242
|
+
const visualOffsets = getVisualOffsets(element);
|
|
243
|
+
rect = {
|
|
244
|
+
...clippingAncestor,
|
|
245
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
246
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
247
|
+
};
|
|
264
248
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
249
|
+
return rectToClientRect(rect);
|
|
250
|
+
}
|
|
251
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
252
|
+
const parentNode = getParentNode(element);
|
|
253
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
257
|
+
}
|
|
258
|
+
function getClippingElementAncestors(element, cache) {
|
|
259
|
+
const cachedResult = cache.get(element);
|
|
260
|
+
if (cachedResult) {
|
|
261
|
+
return cachedResult;
|
|
262
|
+
}
|
|
263
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
264
|
+
let currentContainingBlockComputedStyle = null;
|
|
265
|
+
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
|
266
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
267
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
268
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
269
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
270
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
271
|
+
currentContainingBlockComputedStyle = null;
|
|
270
272
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
bName(e) {
|
|
275
|
-
return e.tagName.substring(0, e.tagName.indexOf("-")).toLowerCase() + ":" + e.getAttribute("data-origname");
|
|
276
|
-
}
|
|
277
|
-
/*
|
|
278
|
-
Private method called by append(). Takes a child element and a name, and recurses through the
|
|
279
|
-
child's siblings until an element with that name is found, returning true if it is and false if not.
|
|
280
|
-
*/
|
|
281
|
-
childExists(elt, name) {
|
|
282
|
-
if (elt && elt.nodeName == name) {
|
|
283
|
-
return true;
|
|
273
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
274
|
+
if (shouldDropCurrentNode) {
|
|
275
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
284
276
|
} else {
|
|
285
|
-
|
|
277
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
286
278
|
}
|
|
279
|
+
currentNode = getParentNode(currentNode);
|
|
287
280
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
281
|
+
cache.set(element, result);
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
284
|
+
function getClippingRect(_ref) {
|
|
285
|
+
let {
|
|
286
|
+
element,
|
|
287
|
+
boundary,
|
|
288
|
+
rootBoundary,
|
|
289
|
+
strategy
|
|
290
|
+
} = _ref;
|
|
291
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
292
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
293
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
294
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
295
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
296
|
+
accRect.top = max(rect.top, accRect.top);
|
|
297
|
+
accRect.right = min(rect.right, accRect.right);
|
|
298
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
299
|
+
accRect.left = max(rect.left, accRect.left);
|
|
300
|
+
return accRect;
|
|
301
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
302
|
+
return {
|
|
303
|
+
width: clippingRect.right - clippingRect.left,
|
|
304
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
305
|
+
x: clippingRect.left,
|
|
306
|
+
y: clippingRect.top
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function getDimensions(element) {
|
|
310
|
+
const {
|
|
311
|
+
width,
|
|
312
|
+
height
|
|
313
|
+
} = getCssDimensions(element);
|
|
314
|
+
return {
|
|
315
|
+
width,
|
|
316
|
+
height
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
320
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
321
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
322
|
+
const isFixed = strategy === "fixed";
|
|
323
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
324
|
+
let scroll = {
|
|
325
|
+
scrollLeft: 0,
|
|
326
|
+
scrollTop: 0
|
|
327
|
+
};
|
|
328
|
+
const offsets = createCoords(0);
|
|
329
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
330
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
331
|
+
scroll = getNodeScroll(offsetParent);
|
|
301
332
|
}
|
|
302
|
-
if (
|
|
303
|
-
|
|
333
|
+
if (isOffsetParentAnElement) {
|
|
334
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
335
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
336
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
337
|
+
} else if (documentElement) {
|
|
338
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
304
339
|
}
|
|
305
|
-
let self = this;
|
|
306
|
-
return function(elt) {
|
|
307
|
-
for (let rule of template) {
|
|
308
|
-
if (elt.matches(rule[0]) || rule[0] === "_") {
|
|
309
|
-
if (Array.isArray(rule[1])) {
|
|
310
|
-
return self.decorator(rule[1]).call(this, elt);
|
|
311
|
-
} else {
|
|
312
|
-
return rule[1].call(this, elt);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
340
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
341
|
+
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
342
|
+
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
343
|
+
return {
|
|
344
|
+
x,
|
|
345
|
+
y,
|
|
346
|
+
width: rect.width,
|
|
347
|
+
height: rect.height
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function isStaticPositioned(element) {
|
|
351
|
+
return getComputedStyle(element).position === "static";
|
|
352
|
+
}
|
|
353
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
354
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
|
355
|
+
return null;
|
|
327
356
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return this.decorator(behaviors[fn]);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
357
|
+
if (polyfill) {
|
|
358
|
+
return polyfill(element);
|
|
359
|
+
}
|
|
360
|
+
return element.offsetParent;
|
|
361
|
+
}
|
|
362
|
+
function getOffsetParent(element, polyfill) {
|
|
363
|
+
const win = getWindow(element);
|
|
364
|
+
if (isTopLayer(element)) {
|
|
365
|
+
return win;
|
|
340
366
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
if (behaviors[fn]) {
|
|
347
|
-
if (behaviors[fn] instanceof Function) {
|
|
348
|
-
return this.append(behaviors[fn]);
|
|
349
|
-
} else {
|
|
350
|
-
return this.append(this.decorator(behaviors[fn]));
|
|
367
|
+
if (!isHTMLElement(element)) {
|
|
368
|
+
let svgOffsetParent = getParentNode(element);
|
|
369
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
370
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
371
|
+
return svgOffsetParent;
|
|
351
372
|
}
|
|
373
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
352
374
|
}
|
|
375
|
+
return win;
|
|
353
376
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
377
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
378
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
379
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
380
|
+
}
|
|
381
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
382
|
+
return win;
|
|
383
|
+
}
|
|
384
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
385
|
+
}
|
|
386
|
+
const getElementRects = async function(data) {
|
|
387
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
388
|
+
const getDimensionsFn = this.getDimensions;
|
|
389
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
390
|
+
return {
|
|
391
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
392
|
+
floating: {
|
|
393
|
+
x: 0,
|
|
394
|
+
y: 0,
|
|
395
|
+
width: floatingDimensions.width,
|
|
396
|
+
height: floatingDimensions.height
|
|
360
397
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
function isRTL(element) {
|
|
401
|
+
return getComputedStyle(element).direction === "rtl";
|
|
402
|
+
}
|
|
403
|
+
const platform = {
|
|
404
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
405
|
+
getDocumentElement,
|
|
406
|
+
getClippingRect,
|
|
407
|
+
getOffsetParent,
|
|
408
|
+
getElementRects,
|
|
409
|
+
getClientRects,
|
|
410
|
+
getDimensions,
|
|
411
|
+
getScale,
|
|
412
|
+
isElement,
|
|
413
|
+
isRTL
|
|
414
|
+
};
|
|
415
|
+
function observeMove(element, onMove) {
|
|
416
|
+
let io = null;
|
|
417
|
+
let timeoutId;
|
|
418
|
+
const root = getDocumentElement(element);
|
|
419
|
+
function cleanup() {
|
|
420
|
+
var _io;
|
|
421
|
+
clearTimeout(timeoutId);
|
|
422
|
+
(_io = io) == null || _io.disconnect();
|
|
423
|
+
io = null;
|
|
424
|
+
}
|
|
425
|
+
function refresh(skip, threshold) {
|
|
426
|
+
if (skip === void 0) {
|
|
427
|
+
skip = false;
|
|
373
428
|
}
|
|
374
|
-
if (
|
|
375
|
-
|
|
376
|
-
} else {
|
|
377
|
-
return content;
|
|
429
|
+
if (threshold === void 0) {
|
|
430
|
+
threshold = 1;
|
|
378
431
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
432
|
+
cleanup();
|
|
433
|
+
const {
|
|
434
|
+
left,
|
|
435
|
+
top,
|
|
436
|
+
width,
|
|
437
|
+
height
|
|
438
|
+
} = element.getBoundingClientRect();
|
|
439
|
+
if (!skip) {
|
|
440
|
+
onMove();
|
|
388
441
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
this.processElement(node);
|
|
392
|
-
}
|
|
442
|
+
if (!width || !height) {
|
|
443
|
+
return;
|
|
393
444
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
445
|
+
const insetTop = floor(top);
|
|
446
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
447
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
448
|
+
const insetLeft = floor(left);
|
|
449
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
450
|
+
const options = {
|
|
451
|
+
rootMargin,
|
|
452
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
453
|
+
};
|
|
454
|
+
let isFirstUpdate = true;
|
|
455
|
+
function handleObserve(entries) {
|
|
456
|
+
const ratio = entries[0].intersectionRatio;
|
|
457
|
+
if (ratio !== threshold) {
|
|
458
|
+
if (!isFirstUpdate) {
|
|
459
|
+
return refresh();
|
|
460
|
+
}
|
|
461
|
+
if (!ratio) {
|
|
462
|
+
timeoutId = setTimeout(() => {
|
|
463
|
+
refresh(false, 1e-7);
|
|
464
|
+
}, 1e3);
|
|
407
465
|
} else {
|
|
408
|
-
|
|
466
|
+
refresh(false, ratio);
|
|
409
467
|
}
|
|
410
468
|
}
|
|
469
|
+
isFirstUpdate = false;
|
|
411
470
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
419
|
-
|
|
471
|
+
try {
|
|
472
|
+
io = new IntersectionObserver(handleObserve, {
|
|
473
|
+
...options,
|
|
474
|
+
// Handle <iframe>s
|
|
475
|
+
root: root.ownerDocument
|
|
476
|
+
});
|
|
477
|
+
} catch (e) {
|
|
478
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
420
479
|
}
|
|
480
|
+
io.observe(element);
|
|
421
481
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
for (let name of names) {
|
|
429
|
-
const fn = this.getHandler(this.behaviors, name);
|
|
430
|
-
defineCustomElement(name, fn, this.debug);
|
|
431
|
-
}
|
|
482
|
+
refresh(true);
|
|
483
|
+
return cleanup;
|
|
484
|
+
}
|
|
485
|
+
function autoUpdate(reference, floating, update, options) {
|
|
486
|
+
if (options === void 0) {
|
|
487
|
+
options = {};
|
|
432
488
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
489
|
+
const {
|
|
490
|
+
ancestorScroll = true,
|
|
491
|
+
ancestorResize = true,
|
|
492
|
+
elementResize = typeof ResizeObserver === "function",
|
|
493
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
494
|
+
animationFrame = false
|
|
495
|
+
} = options;
|
|
496
|
+
const referenceEl = unwrapElement(reference);
|
|
497
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
498
|
+
ancestors.forEach((ancestor) => {
|
|
499
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
500
|
+
passive: true
|
|
501
|
+
});
|
|
502
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
503
|
+
});
|
|
504
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
505
|
+
let reobserveFrame = -1;
|
|
506
|
+
let resizeObserver = null;
|
|
507
|
+
if (elementResize) {
|
|
508
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
509
|
+
let [firstEntry] = _ref;
|
|
510
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
511
|
+
resizeObserver.unobserve(floating);
|
|
512
|
+
cancelAnimationFrame(reobserveFrame);
|
|
513
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
514
|
+
var _resizeObserver;
|
|
515
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
update();
|
|
519
|
+
});
|
|
520
|
+
if (referenceEl && !animationFrame) {
|
|
521
|
+
resizeObserver.observe(referenceEl);
|
|
451
522
|
}
|
|
523
|
+
resizeObserver.observe(floating);
|
|
452
524
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
if (
|
|
461
|
-
|
|
462
|
-
if (scroll = window.sessionStorage.getItem(window.location + "-scroll")) {
|
|
463
|
-
window.sessionStorage.removeItem(window.location + "-scroll");
|
|
464
|
-
setTimeout(function() {
|
|
465
|
-
window.scrollTo(0, scroll);
|
|
466
|
-
}, 100);
|
|
467
|
-
}
|
|
468
|
-
} else {
|
|
469
|
-
setTimeout(function() {
|
|
470
|
-
let h = this.document.querySelector(window.decodeURI(window.location.hash));
|
|
471
|
-
if (h) {
|
|
472
|
-
h.scrollIntoView();
|
|
473
|
-
}
|
|
474
|
-
}, 100);
|
|
525
|
+
let frameId;
|
|
526
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
527
|
+
if (animationFrame) {
|
|
528
|
+
frameLoop();
|
|
529
|
+
}
|
|
530
|
+
function frameLoop() {
|
|
531
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
532
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
533
|
+
update();
|
|
475
534
|
}
|
|
535
|
+
prevRefRect = nextRefRect;
|
|
536
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
476
537
|
}
|
|
538
|
+
update();
|
|
539
|
+
return () => {
|
|
540
|
+
var _resizeObserver2;
|
|
541
|
+
ancestors.forEach((ancestor) => {
|
|
542
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
543
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
544
|
+
});
|
|
545
|
+
cleanupIo == null || cleanupIo();
|
|
546
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
547
|
+
resizeObserver = null;
|
|
548
|
+
if (animationFrame) {
|
|
549
|
+
cancelAnimationFrame(frameId);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
477
552
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
553
|
+
const offset = offset$1;
|
|
554
|
+
const autoPlacement = autoPlacement$1;
|
|
555
|
+
const shift = shift$1;
|
|
556
|
+
const inline = inline$1;
|
|
557
|
+
const computePosition = (reference, floating, options) => {
|
|
558
|
+
const cache = /* @__PURE__ */ new Map();
|
|
559
|
+
const mergedOptions = {
|
|
560
|
+
platform,
|
|
561
|
+
...options
|
|
562
|
+
};
|
|
563
|
+
const platformWithCache = {
|
|
564
|
+
...mergedOptions.platform,
|
|
565
|
+
_c: cache
|
|
566
|
+
};
|
|
567
|
+
return computePosition$1(reference, floating, {
|
|
568
|
+
...mergedOptions,
|
|
569
|
+
platform: platformWithCache
|
|
570
|
+
});
|
|
571
|
+
};
|
|
488
572
|
export {
|
|
489
|
-
|
|
573
|
+
autoPlacement,
|
|
574
|
+
autoUpdate,
|
|
575
|
+
computePosition,
|
|
576
|
+
getOverflowAncestors,
|
|
577
|
+
inline,
|
|
578
|
+
offset,
|
|
579
|
+
platform,
|
|
580
|
+
shift
|
|
490
581
|
};
|
|
491
582
|
//# sourceMappingURL=react-text-annotator.es12.js.map
|