webmarker-js 0.0.4 → 0.0.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.
- package/README.md +2 -2
- package/dist/{types.d.ts → index.d.ts} +8 -8
- package/dist/main.js +1021 -274
- package/dist/module.js +1015 -282
- package/esbuild.config.js +28 -0
- package/package.json +10 -10
- package/src/index.ts +3 -3
- package/test-results/.last-run.json +4 -0
- package/dist/main.js.map +0 -1
- package/dist/module.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
package/dist/module.js
CHANGED
@@ -1,301 +1,1034 @@
|
|
1
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defProps = Object.defineProperties;
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
+
var __spreadValues = (a, b) => {
|
9
|
+
for (var prop in b || (b = {}))
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
12
|
+
if (__getOwnPropSymbols)
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
+
if (__propIsEnum.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
}
|
17
|
+
return a;
|
18
|
+
};
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
21
|
+
return new Promise((resolve, reject) => {
|
22
|
+
var fulfilled = (value) => {
|
23
|
+
try {
|
24
|
+
step(generator.next(value));
|
25
|
+
} catch (e) {
|
26
|
+
reject(e);
|
27
|
+
}
|
28
|
+
};
|
29
|
+
var rejected = (value) => {
|
30
|
+
try {
|
31
|
+
step(generator.throw(value));
|
32
|
+
} catch (e) {
|
33
|
+
reject(e);
|
34
|
+
}
|
35
|
+
};
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
38
|
+
});
|
39
|
+
};
|
2
40
|
|
41
|
+
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
42
|
+
var min = Math.min;
|
43
|
+
var max = Math.max;
|
44
|
+
var round = Math.round;
|
45
|
+
var floor = Math.floor;
|
46
|
+
var createCoords = (v) => ({
|
47
|
+
x: v,
|
48
|
+
y: v
|
49
|
+
});
|
50
|
+
function getSide(placement) {
|
51
|
+
return placement.split("-")[0];
|
52
|
+
}
|
53
|
+
function getAlignment(placement) {
|
54
|
+
return placement.split("-")[1];
|
55
|
+
}
|
56
|
+
function getOppositeAxis(axis) {
|
57
|
+
return axis === "x" ? "y" : "x";
|
58
|
+
}
|
59
|
+
function getAxisLength(axis) {
|
60
|
+
return axis === "y" ? "height" : "width";
|
61
|
+
}
|
62
|
+
function getSideAxis(placement) {
|
63
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
64
|
+
}
|
65
|
+
function getAlignmentAxis(placement) {
|
66
|
+
return getOppositeAxis(getSideAxis(placement));
|
67
|
+
}
|
68
|
+
function rectToClientRect(rect) {
|
69
|
+
const {
|
70
|
+
x,
|
71
|
+
y,
|
72
|
+
width,
|
73
|
+
height
|
74
|
+
} = rect;
|
75
|
+
return {
|
76
|
+
width,
|
77
|
+
height,
|
78
|
+
top: y,
|
79
|
+
left: x,
|
80
|
+
right: x + width,
|
81
|
+
bottom: y + height,
|
82
|
+
x,
|
83
|
+
y
|
84
|
+
};
|
85
|
+
}
|
3
86
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
87
|
+
// node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
88
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
89
|
+
let {
|
90
|
+
reference,
|
91
|
+
floating
|
92
|
+
} = _ref;
|
93
|
+
const sideAxis = getSideAxis(placement);
|
94
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
95
|
+
const alignLength = getAxisLength(alignmentAxis);
|
96
|
+
const side = getSide(placement);
|
97
|
+
const isVertical = sideAxis === "y";
|
98
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
99
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
100
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
101
|
+
let coords;
|
102
|
+
switch (side) {
|
103
|
+
case "top":
|
104
|
+
coords = {
|
105
|
+
x: commonX,
|
106
|
+
y: reference.y - floating.height
|
107
|
+
};
|
108
|
+
break;
|
109
|
+
case "bottom":
|
110
|
+
coords = {
|
111
|
+
x: commonX,
|
112
|
+
y: reference.y + reference.height
|
113
|
+
};
|
114
|
+
break;
|
115
|
+
case "right":
|
116
|
+
coords = {
|
117
|
+
x: reference.x + reference.width,
|
118
|
+
y: commonY
|
119
|
+
};
|
120
|
+
break;
|
121
|
+
case "left":
|
122
|
+
coords = {
|
123
|
+
x: reference.x - floating.width,
|
124
|
+
y: commonY
|
125
|
+
};
|
126
|
+
break;
|
127
|
+
default:
|
128
|
+
coords = {
|
129
|
+
x: reference.x,
|
130
|
+
y: reference.y
|
131
|
+
};
|
132
|
+
}
|
133
|
+
switch (getAlignment(placement)) {
|
134
|
+
case "start":
|
135
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
136
|
+
break;
|
137
|
+
case "end":
|
138
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
139
|
+
break;
|
140
|
+
}
|
141
|
+
return coords;
|
142
|
+
}
|
143
|
+
var computePosition = (reference, floating, config) => __async(void 0, null, function* () {
|
144
|
+
const {
|
145
|
+
placement = "bottom",
|
146
|
+
strategy = "absolute",
|
147
|
+
middleware = [],
|
148
|
+
platform: platform2
|
149
|
+
} = config;
|
150
|
+
const validMiddleware = middleware.filter(Boolean);
|
151
|
+
const rtl = yield platform2.isRTL == null ? void 0 : platform2.isRTL(floating);
|
152
|
+
let rects = yield platform2.getElementRects({
|
153
|
+
reference,
|
154
|
+
floating,
|
155
|
+
strategy
|
156
|
+
});
|
157
|
+
let {
|
158
|
+
x,
|
159
|
+
y
|
160
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
161
|
+
let statefulPlacement = placement;
|
162
|
+
let middlewareData = {};
|
163
|
+
let resetCount = 0;
|
164
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
165
|
+
const {
|
166
|
+
name,
|
167
|
+
fn
|
168
|
+
} = validMiddleware[i];
|
169
|
+
const {
|
170
|
+
x: nextX,
|
171
|
+
y: nextY,
|
172
|
+
data,
|
173
|
+
reset
|
174
|
+
} = yield fn({
|
175
|
+
x,
|
176
|
+
y,
|
177
|
+
initialPlacement: placement,
|
178
|
+
placement: statefulPlacement,
|
179
|
+
strategy,
|
180
|
+
middlewareData,
|
181
|
+
rects,
|
182
|
+
platform: platform2,
|
183
|
+
elements: {
|
184
|
+
reference,
|
185
|
+
floating
|
186
|
+
}
|
187
|
+
});
|
188
|
+
x = nextX != null ? nextX : x;
|
189
|
+
y = nextY != null ? nextY : y;
|
190
|
+
middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
|
191
|
+
[name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
|
192
|
+
});
|
193
|
+
if (reset && resetCount <= 50) {
|
194
|
+
resetCount++;
|
195
|
+
if (typeof reset === "object") {
|
196
|
+
if (reset.placement) {
|
197
|
+
statefulPlacement = reset.placement;
|
24
198
|
}
|
25
|
-
|
26
|
-
|
199
|
+
if (reset.rects) {
|
200
|
+
rects = reset.rects === true ? yield platform2.getElementRects({
|
201
|
+
reference,
|
202
|
+
floating,
|
203
|
+
strategy
|
204
|
+
}) : reset.rects;
|
27
205
|
}
|
28
|
-
|
206
|
+
({
|
207
|
+
x,
|
208
|
+
y
|
209
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
210
|
+
}
|
211
|
+
i = -1;
|
212
|
+
}
|
213
|
+
}
|
214
|
+
return {
|
215
|
+
x,
|
216
|
+
y,
|
217
|
+
placement: statefulPlacement,
|
218
|
+
strategy,
|
219
|
+
middlewareData
|
220
|
+
};
|
221
|
+
});
|
222
|
+
|
223
|
+
// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
224
|
+
function getNodeName(node) {
|
225
|
+
if (isNode(node)) {
|
226
|
+
return (node.nodeName || "").toLowerCase();
|
227
|
+
}
|
228
|
+
return "#document";
|
229
|
+
}
|
230
|
+
function getWindow(node) {
|
231
|
+
var _node$ownerDocument;
|
232
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
233
|
+
}
|
234
|
+
function getDocumentElement(node) {
|
235
|
+
var _ref;
|
236
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
237
|
+
}
|
238
|
+
function isNode(value) {
|
239
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
240
|
+
}
|
241
|
+
function isElement(value) {
|
242
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
243
|
+
}
|
244
|
+
function isHTMLElement(value) {
|
245
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
246
|
+
}
|
247
|
+
function isShadowRoot(value) {
|
248
|
+
if (typeof ShadowRoot === "undefined") {
|
249
|
+
return false;
|
250
|
+
}
|
251
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
252
|
+
}
|
253
|
+
function isOverflowElement(element) {
|
254
|
+
const {
|
255
|
+
overflow,
|
256
|
+
overflowX,
|
257
|
+
overflowY,
|
258
|
+
display
|
259
|
+
} = getComputedStyle(element);
|
260
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
261
|
+
}
|
262
|
+
function isTableElement(element) {
|
263
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
264
|
+
}
|
265
|
+
function isContainingBlock(element) {
|
266
|
+
const webkit = isWebKit();
|
267
|
+
const css = getComputedStyle(element);
|
268
|
+
return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
269
|
+
}
|
270
|
+
function getContainingBlock(element) {
|
271
|
+
let currentNode = getParentNode(element);
|
272
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
273
|
+
if (isContainingBlock(currentNode)) {
|
274
|
+
return currentNode;
|
275
|
+
}
|
276
|
+
currentNode = getParentNode(currentNode);
|
277
|
+
}
|
278
|
+
return null;
|
279
|
+
}
|
280
|
+
function isWebKit() {
|
281
|
+
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
282
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
283
|
+
}
|
284
|
+
function isLastTraversableNode(node) {
|
285
|
+
return ["html", "body", "#document"].includes(getNodeName(node));
|
286
|
+
}
|
287
|
+
function getComputedStyle(element) {
|
288
|
+
return getWindow(element).getComputedStyle(element);
|
289
|
+
}
|
290
|
+
function getNodeScroll(element) {
|
291
|
+
if (isElement(element)) {
|
292
|
+
return {
|
293
|
+
scrollLeft: element.scrollLeft,
|
294
|
+
scrollTop: element.scrollTop
|
295
|
+
};
|
296
|
+
}
|
297
|
+
return {
|
298
|
+
scrollLeft: element.pageXOffset,
|
299
|
+
scrollTop: element.pageYOffset
|
300
|
+
};
|
301
|
+
}
|
302
|
+
function getParentNode(node) {
|
303
|
+
if (getNodeName(node) === "html") {
|
304
|
+
return node;
|
305
|
+
}
|
306
|
+
const result = (
|
307
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
308
|
+
node.assignedSlot || // DOM Element detected.
|
309
|
+
node.parentNode || // ShadowRoot detected.
|
310
|
+
isShadowRoot(node) && node.host || // Fallback.
|
311
|
+
getDocumentElement(node)
|
312
|
+
);
|
313
|
+
return isShadowRoot(result) ? result.host : result;
|
314
|
+
}
|
315
|
+
function getNearestOverflowAncestor(node) {
|
316
|
+
const parentNode = getParentNode(node);
|
317
|
+
if (isLastTraversableNode(parentNode)) {
|
318
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
319
|
+
}
|
320
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
321
|
+
return parentNode;
|
322
|
+
}
|
323
|
+
return getNearestOverflowAncestor(parentNode);
|
324
|
+
}
|
325
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
326
|
+
var _node$ownerDocument2;
|
327
|
+
if (list === void 0) {
|
328
|
+
list = [];
|
329
|
+
}
|
330
|
+
if (traverseIframes === void 0) {
|
331
|
+
traverseIframes = true;
|
332
|
+
}
|
333
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
334
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
335
|
+
const win = getWindow(scrollableAncestor);
|
336
|
+
if (isBody) {
|
337
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
338
|
+
}
|
339
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
340
|
+
}
|
341
|
+
|
342
|
+
// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
343
|
+
function getCssDimensions(element) {
|
344
|
+
const css = getComputedStyle(element);
|
345
|
+
let width = parseFloat(css.width) || 0;
|
346
|
+
let height = parseFloat(css.height) || 0;
|
347
|
+
const hasOffset = isHTMLElement(element);
|
348
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
349
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
350
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
351
|
+
if (shouldFallback) {
|
352
|
+
width = offsetWidth;
|
353
|
+
height = offsetHeight;
|
354
|
+
}
|
355
|
+
return {
|
356
|
+
width,
|
357
|
+
height,
|
358
|
+
$: shouldFallback
|
359
|
+
};
|
360
|
+
}
|
361
|
+
function unwrapElement(element) {
|
362
|
+
return !isElement(element) ? element.contextElement : element;
|
363
|
+
}
|
364
|
+
function getScale(element) {
|
365
|
+
const domElement = unwrapElement(element);
|
366
|
+
if (!isHTMLElement(domElement)) {
|
367
|
+
return createCoords(1);
|
368
|
+
}
|
369
|
+
const rect = domElement.getBoundingClientRect();
|
370
|
+
const {
|
371
|
+
width,
|
372
|
+
height,
|
373
|
+
$
|
374
|
+
} = getCssDimensions(domElement);
|
375
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
376
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
377
|
+
if (!x || !Number.isFinite(x)) {
|
378
|
+
x = 1;
|
379
|
+
}
|
380
|
+
if (!y || !Number.isFinite(y)) {
|
381
|
+
y = 1;
|
382
|
+
}
|
383
|
+
return {
|
384
|
+
x,
|
385
|
+
y
|
386
|
+
};
|
387
|
+
}
|
388
|
+
var noOffsets = /* @__PURE__ */ createCoords(0);
|
389
|
+
function getVisualOffsets(element) {
|
390
|
+
const win = getWindow(element);
|
391
|
+
if (!isWebKit() || !win.visualViewport) {
|
392
|
+
return noOffsets;
|
393
|
+
}
|
394
|
+
return {
|
395
|
+
x: win.visualViewport.offsetLeft,
|
396
|
+
y: win.visualViewport.offsetTop
|
397
|
+
};
|
398
|
+
}
|
399
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
400
|
+
if (isFixed === void 0) {
|
401
|
+
isFixed = false;
|
402
|
+
}
|
403
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
404
|
+
return false;
|
405
|
+
}
|
406
|
+
return isFixed;
|
407
|
+
}
|
408
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
409
|
+
if (includeScale === void 0) {
|
410
|
+
includeScale = false;
|
411
|
+
}
|
412
|
+
if (isFixedStrategy === void 0) {
|
413
|
+
isFixedStrategy = false;
|
414
|
+
}
|
415
|
+
const clientRect = element.getBoundingClientRect();
|
416
|
+
const domElement = unwrapElement(element);
|
417
|
+
let scale = createCoords(1);
|
418
|
+
if (includeScale) {
|
419
|
+
if (offsetParent) {
|
420
|
+
if (isElement(offsetParent)) {
|
421
|
+
scale = getScale(offsetParent);
|
422
|
+
}
|
423
|
+
} else {
|
424
|
+
scale = getScale(element);
|
425
|
+
}
|
426
|
+
}
|
427
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
428
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
429
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
430
|
+
let width = clientRect.width / scale.x;
|
431
|
+
let height = clientRect.height / scale.y;
|
432
|
+
if (domElement) {
|
433
|
+
const win = getWindow(domElement);
|
434
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
435
|
+
let currentWin = win;
|
436
|
+
let currentIFrame = currentWin.frameElement;
|
437
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
438
|
+
const iframeScale = getScale(currentIFrame);
|
439
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
440
|
+
const css = getComputedStyle(currentIFrame);
|
441
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
442
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
443
|
+
x *= iframeScale.x;
|
444
|
+
y *= iframeScale.y;
|
445
|
+
width *= iframeScale.x;
|
446
|
+
height *= iframeScale.y;
|
447
|
+
x += left;
|
448
|
+
y += top;
|
449
|
+
currentWin = getWindow(currentIFrame);
|
450
|
+
currentIFrame = currentWin.frameElement;
|
451
|
+
}
|
452
|
+
}
|
453
|
+
return rectToClientRect({
|
454
|
+
width,
|
455
|
+
height,
|
456
|
+
x,
|
457
|
+
y
|
458
|
+
});
|
459
|
+
}
|
460
|
+
var topLayerSelectors = [":popover-open", ":modal"];
|
461
|
+
function isTopLayer(element) {
|
462
|
+
return topLayerSelectors.some((selector) => {
|
463
|
+
try {
|
464
|
+
return element.matches(selector);
|
465
|
+
} catch (e) {
|
466
|
+
return false;
|
467
|
+
}
|
468
|
+
});
|
469
|
+
}
|
470
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
471
|
+
let {
|
472
|
+
elements,
|
473
|
+
rect,
|
474
|
+
offsetParent,
|
475
|
+
strategy
|
476
|
+
} = _ref;
|
477
|
+
const isFixed = strategy === "fixed";
|
478
|
+
const documentElement = getDocumentElement(offsetParent);
|
479
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
480
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
481
|
+
return rect;
|
482
|
+
}
|
483
|
+
let scroll = {
|
484
|
+
scrollLeft: 0,
|
485
|
+
scrollTop: 0
|
486
|
+
};
|
487
|
+
let scale = createCoords(1);
|
488
|
+
const offsets = createCoords(0);
|
489
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
490
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
491
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
492
|
+
scroll = getNodeScroll(offsetParent);
|
493
|
+
}
|
494
|
+
if (isHTMLElement(offsetParent)) {
|
495
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
496
|
+
scale = getScale(offsetParent);
|
497
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
498
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
499
|
+
}
|
500
|
+
}
|
501
|
+
return {
|
502
|
+
width: rect.width * scale.x,
|
503
|
+
height: rect.height * scale.y,
|
504
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
505
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
506
|
+
};
|
507
|
+
}
|
508
|
+
function getClientRects(element) {
|
509
|
+
return Array.from(element.getClientRects());
|
510
|
+
}
|
511
|
+
function getWindowScrollBarX(element) {
|
512
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
513
|
+
}
|
514
|
+
function getDocumentRect(element) {
|
515
|
+
const html = getDocumentElement(element);
|
516
|
+
const scroll = getNodeScroll(element);
|
517
|
+
const body = element.ownerDocument.body;
|
518
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
519
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
520
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
521
|
+
const y = -scroll.scrollTop;
|
522
|
+
if (getComputedStyle(body).direction === "rtl") {
|
523
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
524
|
+
}
|
525
|
+
return {
|
526
|
+
width,
|
527
|
+
height,
|
528
|
+
x,
|
529
|
+
y
|
530
|
+
};
|
531
|
+
}
|
532
|
+
function getViewportRect(element, strategy) {
|
533
|
+
const win = getWindow(element);
|
534
|
+
const html = getDocumentElement(element);
|
535
|
+
const visualViewport = win.visualViewport;
|
536
|
+
let width = html.clientWidth;
|
537
|
+
let height = html.clientHeight;
|
538
|
+
let x = 0;
|
539
|
+
let y = 0;
|
540
|
+
if (visualViewport) {
|
541
|
+
width = visualViewport.width;
|
542
|
+
height = visualViewport.height;
|
543
|
+
const visualViewportBased = isWebKit();
|
544
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
545
|
+
x = visualViewport.offsetLeft;
|
546
|
+
y = visualViewport.offsetTop;
|
547
|
+
}
|
548
|
+
}
|
549
|
+
return {
|
550
|
+
width,
|
551
|
+
height,
|
552
|
+
x,
|
553
|
+
y
|
554
|
+
};
|
555
|
+
}
|
556
|
+
function getInnerBoundingClientRect(element, strategy) {
|
557
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
558
|
+
const top = clientRect.top + element.clientTop;
|
559
|
+
const left = clientRect.left + element.clientLeft;
|
560
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
561
|
+
const width = element.clientWidth * scale.x;
|
562
|
+
const height = element.clientHeight * scale.y;
|
563
|
+
const x = left * scale.x;
|
564
|
+
const y = top * scale.y;
|
565
|
+
return {
|
566
|
+
width,
|
567
|
+
height,
|
568
|
+
x,
|
569
|
+
y
|
570
|
+
};
|
571
|
+
}
|
572
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
573
|
+
let rect;
|
574
|
+
if (clippingAncestor === "viewport") {
|
575
|
+
rect = getViewportRect(element, strategy);
|
576
|
+
} else if (clippingAncestor === "document") {
|
577
|
+
rect = getDocumentRect(getDocumentElement(element));
|
578
|
+
} else if (isElement(clippingAncestor)) {
|
579
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
580
|
+
} else {
|
581
|
+
const visualOffsets = getVisualOffsets(element);
|
582
|
+
rect = __spreadProps(__spreadValues({}, clippingAncestor), {
|
583
|
+
x: clippingAncestor.x - visualOffsets.x,
|
584
|
+
y: clippingAncestor.y - visualOffsets.y
|
29
585
|
});
|
586
|
+
}
|
587
|
+
return rectToClientRect(rect);
|
588
|
+
}
|
589
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
590
|
+
const parentNode = getParentNode(element);
|
591
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
592
|
+
return false;
|
593
|
+
}
|
594
|
+
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
595
|
+
}
|
596
|
+
function getClippingElementAncestors(element, cache) {
|
597
|
+
const cachedResult = cache.get(element);
|
598
|
+
if (cachedResult) {
|
599
|
+
return cachedResult;
|
600
|
+
}
|
601
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
602
|
+
let currentContainingBlockComputedStyle = null;
|
603
|
+
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
604
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
605
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
606
|
+
const computedStyle = getComputedStyle(currentNode);
|
607
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
608
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
609
|
+
currentContainingBlockComputedStyle = null;
|
610
|
+
}
|
611
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
612
|
+
if (shouldDropCurrentNode) {
|
613
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
614
|
+
} else {
|
615
|
+
currentContainingBlockComputedStyle = computedStyle;
|
616
|
+
}
|
617
|
+
currentNode = getParentNode(currentNode);
|
618
|
+
}
|
619
|
+
cache.set(element, result);
|
620
|
+
return result;
|
621
|
+
}
|
622
|
+
function getClippingRect(_ref) {
|
623
|
+
let {
|
624
|
+
element,
|
625
|
+
boundary,
|
626
|
+
rootBoundary,
|
627
|
+
strategy
|
628
|
+
} = _ref;
|
629
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
630
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
631
|
+
const firstClippingAncestor = clippingAncestors[0];
|
632
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
633
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
634
|
+
accRect.top = max(rect.top, accRect.top);
|
635
|
+
accRect.right = min(rect.right, accRect.right);
|
636
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
637
|
+
accRect.left = max(rect.left, accRect.left);
|
638
|
+
return accRect;
|
639
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
640
|
+
return {
|
641
|
+
width: clippingRect.right - clippingRect.left,
|
642
|
+
height: clippingRect.bottom - clippingRect.top,
|
643
|
+
x: clippingRect.left,
|
644
|
+
y: clippingRect.top
|
645
|
+
};
|
646
|
+
}
|
647
|
+
function getDimensions(element) {
|
648
|
+
const {
|
649
|
+
width,
|
650
|
+
height
|
651
|
+
} = getCssDimensions(element);
|
652
|
+
return {
|
653
|
+
width,
|
654
|
+
height
|
655
|
+
};
|
656
|
+
}
|
657
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
658
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
659
|
+
const documentElement = getDocumentElement(offsetParent);
|
660
|
+
const isFixed = strategy === "fixed";
|
661
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
662
|
+
let scroll = {
|
663
|
+
scrollLeft: 0,
|
664
|
+
scrollTop: 0
|
665
|
+
};
|
666
|
+
const offsets = createCoords(0);
|
667
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
668
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
669
|
+
scroll = getNodeScroll(offsetParent);
|
670
|
+
}
|
671
|
+
if (isOffsetParentAnElement) {
|
672
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
673
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
674
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
675
|
+
} else if (documentElement) {
|
676
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
677
|
+
}
|
678
|
+
}
|
679
|
+
const x = rect.left + scroll.scrollLeft - offsets.x;
|
680
|
+
const y = rect.top + scroll.scrollTop - offsets.y;
|
681
|
+
return {
|
682
|
+
x,
|
683
|
+
y,
|
684
|
+
width: rect.width,
|
685
|
+
height: rect.height
|
686
|
+
};
|
687
|
+
}
|
688
|
+
function isStaticPositioned(element) {
|
689
|
+
return getComputedStyle(element).position === "static";
|
690
|
+
}
|
691
|
+
function getTrueOffsetParent(element, polyfill) {
|
692
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
693
|
+
return null;
|
694
|
+
}
|
695
|
+
if (polyfill) {
|
696
|
+
return polyfill(element);
|
697
|
+
}
|
698
|
+
return element.offsetParent;
|
699
|
+
}
|
700
|
+
function getOffsetParent(element, polyfill) {
|
701
|
+
const win = getWindow(element);
|
702
|
+
if (isTopLayer(element)) {
|
703
|
+
return win;
|
704
|
+
}
|
705
|
+
if (!isHTMLElement(element)) {
|
706
|
+
let svgOffsetParent = getParentNode(element);
|
707
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
708
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
709
|
+
return svgOffsetParent;
|
710
|
+
}
|
711
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
712
|
+
}
|
713
|
+
return win;
|
714
|
+
}
|
715
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
716
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
717
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
718
|
+
}
|
719
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
720
|
+
return win;
|
721
|
+
}
|
722
|
+
return offsetParent || getContainingBlock(element) || win;
|
723
|
+
}
|
724
|
+
var getElementRects = function(data) {
|
725
|
+
return __async(this, null, function* () {
|
726
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
727
|
+
const getDimensionsFn = this.getDimensions;
|
728
|
+
const floatingDimensions = yield getDimensionsFn(data.floating);
|
729
|
+
return {
|
730
|
+
reference: getRectRelativeToOffsetParent(data.reference, yield getOffsetParentFn(data.floating), data.strategy),
|
731
|
+
floating: {
|
732
|
+
x: 0,
|
733
|
+
y: 0,
|
734
|
+
width: floatingDimensions.width,
|
735
|
+
height: floatingDimensions.height
|
736
|
+
}
|
737
|
+
};
|
738
|
+
});
|
739
|
+
};
|
740
|
+
function isRTL(element) {
|
741
|
+
return getComputedStyle(element).direction === "rtl";
|
742
|
+
}
|
743
|
+
var platform = {
|
744
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
745
|
+
getDocumentElement,
|
746
|
+
getClippingRect,
|
747
|
+
getOffsetParent,
|
748
|
+
getElementRects,
|
749
|
+
getClientRects,
|
750
|
+
getDimensions,
|
751
|
+
getScale,
|
752
|
+
isElement,
|
753
|
+
isRTL
|
30
754
|
};
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
755
|
+
function observeMove(element, onMove) {
|
756
|
+
let io = null;
|
757
|
+
let timeoutId;
|
758
|
+
const root = getDocumentElement(element);
|
759
|
+
function cleanup() {
|
760
|
+
var _io;
|
761
|
+
clearTimeout(timeoutId);
|
762
|
+
(_io = io) == null || _io.disconnect();
|
763
|
+
io = null;
|
764
|
+
}
|
765
|
+
function refresh(skip, threshold) {
|
766
|
+
if (skip === void 0) {
|
767
|
+
skip = false;
|
768
|
+
}
|
769
|
+
if (threshold === void 0) {
|
770
|
+
threshold = 1;
|
771
|
+
}
|
772
|
+
cleanup();
|
773
|
+
const {
|
774
|
+
left,
|
775
|
+
top,
|
776
|
+
width,
|
777
|
+
height
|
778
|
+
} = element.getBoundingClientRect();
|
779
|
+
if (!skip) {
|
780
|
+
onMove();
|
781
|
+
}
|
782
|
+
if (!width || !height) {
|
783
|
+
return;
|
55
784
|
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
return {
|
72
|
-
value: op[1],
|
73
|
-
done: false
|
74
|
-
};
|
75
|
-
case 5:
|
76
|
-
_.label++;
|
77
|
-
y = op[1];
|
78
|
-
op = [
|
79
|
-
0
|
80
|
-
];
|
81
|
-
continue;
|
82
|
-
case 7:
|
83
|
-
op = _.ops.pop();
|
84
|
-
_.trys.pop();
|
85
|
-
continue;
|
86
|
-
default:
|
87
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
88
|
-
_ = 0;
|
89
|
-
continue;
|
90
|
-
}
|
91
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
92
|
-
_.label = op[1];
|
93
|
-
break;
|
94
|
-
}
|
95
|
-
if (op[0] === 6 && _.label < t[1]) {
|
96
|
-
_.label = t[1];
|
97
|
-
t = op;
|
98
|
-
break;
|
99
|
-
}
|
100
|
-
if (t && _.label < t[2]) {
|
101
|
-
_.label = t[2];
|
102
|
-
_.ops.push(op);
|
103
|
-
break;
|
104
|
-
}
|
105
|
-
if (t[2]) _.ops.pop();
|
106
|
-
_.trys.pop();
|
107
|
-
continue;
|
108
|
-
}
|
109
|
-
op = body.call(thisArg, _);
|
110
|
-
} catch (e) {
|
111
|
-
op = [
|
112
|
-
6,
|
113
|
-
e
|
114
|
-
];
|
115
|
-
y = 0;
|
116
|
-
} finally{
|
117
|
-
f = t = 0;
|
785
|
+
const insetTop = floor(top);
|
786
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
787
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
788
|
+
const insetLeft = floor(left);
|
789
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
790
|
+
const options = {
|
791
|
+
rootMargin,
|
792
|
+
threshold: max(0, min(1, threshold)) || 1
|
793
|
+
};
|
794
|
+
let isFirstUpdate = true;
|
795
|
+
function handleObserve(entries) {
|
796
|
+
const ratio = entries[0].intersectionRatio;
|
797
|
+
if (ratio !== threshold) {
|
798
|
+
if (!isFirstUpdate) {
|
799
|
+
return refresh();
|
118
800
|
}
|
119
|
-
if (
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
}
|
801
|
+
if (!ratio) {
|
802
|
+
timeoutId = setTimeout(() => {
|
803
|
+
refresh(false, 1e-7);
|
804
|
+
}, 1e3);
|
805
|
+
} else {
|
806
|
+
refresh(false, ratio);
|
807
|
+
}
|
808
|
+
}
|
809
|
+
isFirstUpdate = false;
|
124
810
|
}
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
});
|
170
|
-
});
|
171
|
-
}))
|
172
|
-
];
|
173
|
-
case 1:
|
174
|
-
_j.sent();
|
175
|
-
document.documentElement.dataset.webmarkered = "true";
|
176
|
-
return [
|
177
|
-
2 /*return*/ ,
|
178
|
-
markedElements
|
179
|
-
];
|
180
|
-
}
|
811
|
+
try {
|
812
|
+
io = new IntersectionObserver(handleObserve, __spreadProps(__spreadValues({}, options), {
|
813
|
+
// Handle <iframe>s
|
814
|
+
root: root.ownerDocument
|
815
|
+
}));
|
816
|
+
} catch (e) {
|
817
|
+
io = new IntersectionObserver(handleObserve, options);
|
818
|
+
}
|
819
|
+
io.observe(element);
|
820
|
+
}
|
821
|
+
refresh(true);
|
822
|
+
return cleanup;
|
823
|
+
}
|
824
|
+
function autoUpdate(reference, floating, update, options) {
|
825
|
+
if (options === void 0) {
|
826
|
+
options = {};
|
827
|
+
}
|
828
|
+
const {
|
829
|
+
ancestorScroll = true,
|
830
|
+
ancestorResize = true,
|
831
|
+
elementResize = typeof ResizeObserver === "function",
|
832
|
+
layoutShift = typeof IntersectionObserver === "function",
|
833
|
+
animationFrame = false
|
834
|
+
} = options;
|
835
|
+
const referenceEl = unwrapElement(reference);
|
836
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
837
|
+
ancestors.forEach((ancestor) => {
|
838
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
839
|
+
passive: true
|
840
|
+
});
|
841
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
842
|
+
});
|
843
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
844
|
+
let reobserveFrame = -1;
|
845
|
+
let resizeObserver = null;
|
846
|
+
if (elementResize) {
|
847
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
848
|
+
let [firstEntry] = _ref;
|
849
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
850
|
+
resizeObserver.unobserve(floating);
|
851
|
+
cancelAnimationFrame(reobserveFrame);
|
852
|
+
reobserveFrame = requestAnimationFrame(() => {
|
853
|
+
var _resizeObserver;
|
854
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
181
855
|
});
|
856
|
+
}
|
857
|
+
update();
|
182
858
|
});
|
859
|
+
if (referenceEl && !animationFrame) {
|
860
|
+
resizeObserver.observe(referenceEl);
|
861
|
+
}
|
862
|
+
resizeObserver.observe(floating);
|
863
|
+
}
|
864
|
+
let frameId;
|
865
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
866
|
+
if (animationFrame) {
|
867
|
+
frameLoop();
|
868
|
+
}
|
869
|
+
function frameLoop() {
|
870
|
+
const nextRefRect = getBoundingClientRect(reference);
|
871
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
872
|
+
update();
|
873
|
+
}
|
874
|
+
prevRefRect = nextRefRect;
|
875
|
+
frameId = requestAnimationFrame(frameLoop);
|
876
|
+
}
|
877
|
+
update();
|
878
|
+
return () => {
|
879
|
+
var _resizeObserver2;
|
880
|
+
ancestors.forEach((ancestor) => {
|
881
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
882
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
883
|
+
});
|
884
|
+
cleanupIo == null || cleanupIo();
|
885
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
886
|
+
resizeObserver = null;
|
887
|
+
if (animationFrame) {
|
888
|
+
cancelAnimationFrame(frameId);
|
889
|
+
}
|
890
|
+
};
|
891
|
+
}
|
892
|
+
var computePosition2 = (reference, floating, options) => {
|
893
|
+
const cache = /* @__PURE__ */ new Map();
|
894
|
+
const mergedOptions = __spreadValues({
|
895
|
+
platform
|
896
|
+
}, options);
|
897
|
+
const platformWithCache = __spreadProps(__spreadValues({}, mergedOptions.platform), {
|
898
|
+
_c: cache
|
899
|
+
});
|
900
|
+
return computePosition(reference, floating, __spreadProps(__spreadValues({}, mergedOptions), {
|
901
|
+
platform: platformWithCache
|
902
|
+
}));
|
903
|
+
};
|
904
|
+
|
905
|
+
// src/index.ts
|
906
|
+
var cleanupFns = [];
|
907
|
+
function mark() {
|
908
|
+
return __async(this, arguments, function* (options = {}) {
|
909
|
+
const {
|
910
|
+
selector = "button, input, a, select, textarea",
|
911
|
+
markStyle = {
|
912
|
+
backgroundColor: "red",
|
913
|
+
color: "white",
|
914
|
+
padding: "2px 4px",
|
915
|
+
fontSize: "12px",
|
916
|
+
fontWeight: "bold"
|
917
|
+
},
|
918
|
+
markPlacement = "top-start",
|
919
|
+
maskStyle = {
|
920
|
+
outline: "2px dashed red",
|
921
|
+
backgroundColor: "transparent"
|
922
|
+
},
|
923
|
+
showMasks = true,
|
924
|
+
labelGenerator = (_, index) => index.toString(),
|
925
|
+
containerElement = document.body,
|
926
|
+
viewPortOnly = false
|
927
|
+
} = options;
|
928
|
+
const elements = Array.from(
|
929
|
+
containerElement.querySelectorAll(selector)
|
930
|
+
).filter(
|
931
|
+
(el) => !viewPortOnly || el.getBoundingClientRect().top < window.innerHeight
|
932
|
+
);
|
933
|
+
const markedElements = {};
|
934
|
+
yield Promise.all(
|
935
|
+
elements.map((element, index) => __async(this, null, function* () {
|
936
|
+
const label = labelGenerator(element, index);
|
937
|
+
const markElement = createMark(element, markStyle, label, markPlacement);
|
938
|
+
const maskElement = showMasks ? createMask(element, maskStyle, label) : void 0;
|
939
|
+
markedElements[label] = { element, markElement, maskElement };
|
940
|
+
element.setAttribute("data-webmarkeredby", `webmarker-${label}`);
|
941
|
+
}))
|
942
|
+
);
|
943
|
+
document.documentElement.dataset.webmarkered = "true";
|
944
|
+
return markedElements;
|
945
|
+
});
|
946
|
+
}
|
947
|
+
function createMark(element, style, label, markPlacement = "top-start") {
|
948
|
+
const markElement = document.createElement("div");
|
949
|
+
markElement.className = "webmarker";
|
950
|
+
markElement.id = `webmarker-${label}`;
|
951
|
+
markElement.textContent = label;
|
952
|
+
document.body.appendChild(markElement);
|
953
|
+
positionMark(markElement, element, markPlacement);
|
954
|
+
applyStyle(
|
955
|
+
markElement,
|
956
|
+
{
|
957
|
+
zIndex: "999999999",
|
958
|
+
position: "absolute",
|
959
|
+
pointerEvents: "none"
|
960
|
+
},
|
961
|
+
typeof style === "function" ? style(element) : style
|
962
|
+
);
|
963
|
+
return markElement;
|
183
964
|
}
|
184
|
-
function
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
},
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
}
|
212
|
-
|
965
|
+
function createMask(element, style, label) {
|
966
|
+
const maskElement = document.createElement("div");
|
967
|
+
maskElement.className = "webmarkermask";
|
968
|
+
maskElement.id = `webmarkermask-${label}`;
|
969
|
+
document.body.appendChild(maskElement);
|
970
|
+
positionMask(maskElement, element);
|
971
|
+
applyStyle(
|
972
|
+
maskElement,
|
973
|
+
{
|
974
|
+
zIndex: "999999999",
|
975
|
+
position: "absolute",
|
976
|
+
pointerEvents: "none"
|
977
|
+
},
|
978
|
+
typeof style === "function" ? style(element) : style
|
979
|
+
);
|
980
|
+
return maskElement;
|
981
|
+
}
|
982
|
+
function positionMark(markElement, element, markPlacement) {
|
983
|
+
function updatePosition() {
|
984
|
+
return __async(this, null, function* () {
|
985
|
+
const { x, y } = yield computePosition2(element, markElement, {
|
986
|
+
placement: markPlacement
|
987
|
+
});
|
988
|
+
Object.assign(markElement.style, {
|
989
|
+
left: `${x}px`,
|
990
|
+
top: `${y}px`
|
991
|
+
});
|
992
|
+
});
|
993
|
+
}
|
994
|
+
cleanupFns.push(autoUpdate(element, markElement, updatePosition));
|
995
|
+
}
|
996
|
+
function positionMask(mask, element) {
|
997
|
+
return __async(this, null, function* () {
|
998
|
+
const { width, height } = element.getBoundingClientRect();
|
213
999
|
function updatePosition() {
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
switch(_b.label){
|
218
|
-
case 0:
|
219
|
-
return [
|
220
|
-
4 /*yield*/ ,
|
221
|
-
(0, $hgUW1$computePosition)(element, markElement, {
|
222
|
-
placement: markPlacement
|
223
|
-
})
|
224
|
-
];
|
225
|
-
case 1:
|
226
|
-
_a = _b.sent(), x = _a.x, y = _a.y;
|
227
|
-
Object.assign(markElement.style, {
|
228
|
-
left: "".concat(x, "px"),
|
229
|
-
top: "".concat(y, "px")
|
230
|
-
});
|
231
|
-
return [
|
232
|
-
2 /*return*/
|
233
|
-
];
|
234
|
-
}
|
235
|
-
});
|
1000
|
+
return __async(this, null, function* () {
|
1001
|
+
const { x: maskX, y: maskY } = yield computePosition2(element, mask, {
|
1002
|
+
placement: "top-start"
|
236
1003
|
});
|
237
|
-
|
238
|
-
|
239
|
-
}
|
240
|
-
|
241
|
-
|
242
|
-
function updatePosition() {
|
243
|
-
return $2df9d79b6788b58e$var$__awaiter(this, void 0, void 0, function() {
|
244
|
-
var _a, maskX, maskY;
|
245
|
-
return $2df9d79b6788b58e$var$__generator(this, function(_b) {
|
246
|
-
switch(_b.label){
|
247
|
-
case 0:
|
248
|
-
return [
|
249
|
-
4 /*yield*/ ,
|
250
|
-
(0, $hgUW1$computePosition)(element, mask, {
|
251
|
-
placement: "top-start"
|
252
|
-
})
|
253
|
-
];
|
254
|
-
case 1:
|
255
|
-
_a = _b.sent(), maskX = _a.x, maskY = _a.y;
|
256
|
-
Object.assign(mask.style, {
|
257
|
-
left: "".concat(maskX, "px"),
|
258
|
-
top: "".concat(maskY + height, "px"),
|
259
|
-
width: "".concat(width, "px"),
|
260
|
-
height: "".concat(height, "px")
|
261
|
-
});
|
262
|
-
return [
|
263
|
-
2 /*return*/
|
264
|
-
];
|
265
|
-
}
|
266
|
-
});
|
267
|
-
});
|
268
|
-
}
|
269
|
-
var _a, width, height;
|
270
|
-
return $2df9d79b6788b58e$var$__generator(this, function(_b) {
|
271
|
-
_a = element.getBoundingClientRect(), width = _a.width, height = _a.height;
|
272
|
-
$2df9d79b6788b58e$var$cleanupFns.push((0, $hgUW1$autoUpdate)(element, mask, updatePosition));
|
273
|
-
return [
|
274
|
-
2 /*return*/
|
275
|
-
];
|
1004
|
+
Object.assign(mask.style, {
|
1005
|
+
left: `${maskX}px`,
|
1006
|
+
top: `${maskY + height}px`,
|
1007
|
+
width: `${width}px`,
|
1008
|
+
height: `${height}px`
|
276
1009
|
});
|
277
|
-
|
1010
|
+
});
|
1011
|
+
}
|
1012
|
+
cleanupFns.push(autoUpdate(element, mask, updatePosition));
|
1013
|
+
});
|
278
1014
|
}
|
279
|
-
function
|
280
|
-
|
1015
|
+
function applyStyle(element, defaultStyle, customStyle) {
|
1016
|
+
Object.assign(element.style, defaultStyle, customStyle);
|
281
1017
|
}
|
282
|
-
function
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
$2df9d79b6788b58e$var$cleanupFns.forEach(function(fn) {
|
288
|
-
return fn();
|
289
|
-
});
|
290
|
-
$2df9d79b6788b58e$var$cleanupFns = [];
|
1018
|
+
function unmark() {
|
1019
|
+
document.querySelectorAll(".webmarker, .webmarkermask").forEach((el) => el.remove());
|
1020
|
+
document.documentElement.removeAttribute("data-webmarkered");
|
1021
|
+
cleanupFns.forEach((fn) => fn());
|
1022
|
+
cleanupFns = [];
|
291
1023
|
}
|
292
|
-
function
|
293
|
-
|
1024
|
+
function isMarked() {
|
1025
|
+
return document.documentElement.hasAttribute("data-webmarkered");
|
294
1026
|
}
|
295
|
-
window["mark"] =
|
296
|
-
window["unmark"] =
|
297
|
-
window["isMarked"] =
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
1027
|
+
window["mark"] = mark;
|
1028
|
+
window["unmark"] = unmark;
|
1029
|
+
window["isMarked"] = isMarked;
|
1030
|
+
export {
|
1031
|
+
isMarked,
|
1032
|
+
mark,
|
1033
|
+
unmark
|
1034
|
+
};
|