@appsurify-testmap/rrweb-record 2.0.0-alpha.23 → 2.0.0-alpha.24
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/rrweb-record.cjs +262 -101
- package/dist/rrweb-record.cjs.map +1 -1
- package/dist/rrweb-record.js +262 -101
- package/dist/rrweb-record.js.map +1 -1
- package/dist/rrweb-record.umd.cjs +261 -101
- package/dist/rrweb-record.umd.cjs.map +2 -2
- package/dist/rrweb-record.umd.min.cjs +24 -24
- package/dist/rrweb-record.umd.min.cjs.map +3 -3
- package/package.json +3 -3
package/dist/rrweb-record.js
CHANGED
|
@@ -5,6 +5,46 @@ var _a;
|
|
|
5
5
|
var __defProp$1 = Object.defineProperty;
|
|
6
6
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
7
|
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
+
var InteractiveEvent = /* @__PURE__ */ ((InteractiveEvent2) => {
|
|
9
|
+
InteractiveEvent2[InteractiveEvent2["Change"] = 0] = "Change";
|
|
10
|
+
InteractiveEvent2[InteractiveEvent2["Submit"] = 1] = "Submit";
|
|
11
|
+
InteractiveEvent2[InteractiveEvent2["DragStart"] = 2] = "DragStart";
|
|
12
|
+
InteractiveEvent2[InteractiveEvent2["Drop"] = 3] = "Drop";
|
|
13
|
+
InteractiveEvent2[InteractiveEvent2["PointerDown"] = 4] = "PointerDown";
|
|
14
|
+
InteractiveEvent2[InteractiveEvent2["PointerUp"] = 5] = "PointerUp";
|
|
15
|
+
InteractiveEvent2[InteractiveEvent2["Input"] = 6] = "Input";
|
|
16
|
+
InteractiveEvent2[InteractiveEvent2["KeyDown"] = 7] = "KeyDown";
|
|
17
|
+
InteractiveEvent2[InteractiveEvent2["KeyUp"] = 8] = "KeyUp";
|
|
18
|
+
InteractiveEvent2[InteractiveEvent2["KeyPress"] = 9] = "KeyPress";
|
|
19
|
+
InteractiveEvent2[InteractiveEvent2["MouseEnter"] = 10] = "MouseEnter";
|
|
20
|
+
InteractiveEvent2[InteractiveEvent2["MouseLeave"] = 11] = "MouseLeave";
|
|
21
|
+
InteractiveEvent2[InteractiveEvent2["MouseUp"] = 12] = "MouseUp";
|
|
22
|
+
InteractiveEvent2[InteractiveEvent2["MouseDown"] = 13] = "MouseDown";
|
|
23
|
+
InteractiveEvent2[InteractiveEvent2["Click"] = 14] = "Click";
|
|
24
|
+
InteractiveEvent2[InteractiveEvent2["ContextMenu"] = 15] = "ContextMenu";
|
|
25
|
+
InteractiveEvent2[InteractiveEvent2["DblClick"] = 16] = "DblClick";
|
|
26
|
+
InteractiveEvent2[InteractiveEvent2["Focus"] = 17] = "Focus";
|
|
27
|
+
InteractiveEvent2[InteractiveEvent2["Blur"] = 18] = "Blur";
|
|
28
|
+
InteractiveEvent2[InteractiveEvent2["TouchStart"] = 19] = "TouchStart";
|
|
29
|
+
InteractiveEvent2[InteractiveEvent2["TouchMove"] = 20] = "TouchMove";
|
|
30
|
+
InteractiveEvent2[InteractiveEvent2["TouchEnd"] = 21] = "TouchEnd";
|
|
31
|
+
InteractiveEvent2[InteractiveEvent2["TouchCancel"] = 22] = "TouchCancel";
|
|
32
|
+
return InteractiveEvent2;
|
|
33
|
+
})(InteractiveEvent || {});
|
|
34
|
+
var interactiveTag = /* @__PURE__ */ ((interactiveTag2) => {
|
|
35
|
+
interactiveTag2[interactiveTag2["Input"] = 0] = "Input";
|
|
36
|
+
interactiveTag2[interactiveTag2["Button"] = 1] = "Button";
|
|
37
|
+
interactiveTag2[interactiveTag2["A"] = 2] = "A";
|
|
38
|
+
interactiveTag2[interactiveTag2["Select"] = 3] = "Select";
|
|
39
|
+
interactiveTag2[interactiveTag2["Textarea"] = 4] = "Textarea";
|
|
40
|
+
interactiveTag2[interactiveTag2["Label"] = 5] = "Label";
|
|
41
|
+
interactiveTag2[interactiveTag2["Details"] = 6] = "Details";
|
|
42
|
+
interactiveTag2[interactiveTag2["Summary"] = 7] = "Summary";
|
|
43
|
+
interactiveTag2[interactiveTag2["Dialog"] = 8] = "Dialog";
|
|
44
|
+
interactiveTag2[interactiveTag2["Video"] = 9] = "Video";
|
|
45
|
+
interactiveTag2[interactiveTag2["Audio"] = 10] = "Audio";
|
|
46
|
+
return interactiveTag2;
|
|
47
|
+
})(interactiveTag || {});
|
|
8
48
|
var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
|
|
9
49
|
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
10
50
|
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
@@ -156,99 +196,6 @@ const index$1 = {
|
|
|
156
196
|
querySelectorAll: querySelectorAll$1,
|
|
157
197
|
mutationObserver: mutationObserverCtor$1
|
|
158
198
|
};
|
|
159
|
-
function getXPath(node2) {
|
|
160
|
-
if (node2.nodeType === Node.DOCUMENT_NODE) {
|
|
161
|
-
return "/";
|
|
162
|
-
}
|
|
163
|
-
if (node2.nodeType === Node.DOCUMENT_TYPE_NODE) {
|
|
164
|
-
return "/html/doctype";
|
|
165
|
-
}
|
|
166
|
-
if (node2.nodeType === Node.ELEMENT_NODE) {
|
|
167
|
-
const element = node2;
|
|
168
|
-
if (element.id) {
|
|
169
|
-
return `//*[@id="${element.id}"]`;
|
|
170
|
-
}
|
|
171
|
-
if (element.tagName && element.tagName.toLowerCase() === "html") {
|
|
172
|
-
return "/html";
|
|
173
|
-
}
|
|
174
|
-
if (element === document.head) {
|
|
175
|
-
return "/html/head";
|
|
176
|
-
}
|
|
177
|
-
if (element === document.body) {
|
|
178
|
-
return "/html/body";
|
|
179
|
-
}
|
|
180
|
-
const parentNode2 = element.parentNode;
|
|
181
|
-
if (!parentNode2 || !(parentNode2 instanceof Element)) {
|
|
182
|
-
return "";
|
|
183
|
-
}
|
|
184
|
-
const siblings = Array.from(parentNode2.children).filter(
|
|
185
|
-
(sibling) => sibling.tagName === element.tagName
|
|
186
|
-
);
|
|
187
|
-
const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
|
|
188
|
-
return `${getXPath(parentNode2)}/${element.tagName.toLowerCase()}${index2}`;
|
|
189
|
-
}
|
|
190
|
-
if (node2.nodeType === Node.TEXT_NODE) {
|
|
191
|
-
const parent = node2.parentNode;
|
|
192
|
-
if (!parent) {
|
|
193
|
-
return "";
|
|
194
|
-
}
|
|
195
|
-
const textSiblings = Array.from(parent.childNodes).filter(
|
|
196
|
-
(sibling) => sibling.nodeType === Node.TEXT_NODE
|
|
197
|
-
);
|
|
198
|
-
const index2 = textSiblings.length > 1 ? `[${textSiblings.indexOf(node2) + 1}]` : "";
|
|
199
|
-
return `${getXPath(parent)}/text()${index2}`;
|
|
200
|
-
}
|
|
201
|
-
if (node2.nodeType === Node.CDATA_SECTION_NODE) {
|
|
202
|
-
const parent = node2.parentNode;
|
|
203
|
-
if (!parent) {
|
|
204
|
-
return "";
|
|
205
|
-
}
|
|
206
|
-
const cdataSiblings = Array.from(parent.childNodes).filter(
|
|
207
|
-
(sibling) => sibling.nodeType === Node.CDATA_SECTION_NODE
|
|
208
|
-
);
|
|
209
|
-
const index2 = cdataSiblings.length > 1 ? `[${cdataSiblings.indexOf(node2) + 1}]` : "";
|
|
210
|
-
return `${getXPath(parent)}/text()${index2}`;
|
|
211
|
-
}
|
|
212
|
-
if (node2.nodeType === Node.COMMENT_NODE) {
|
|
213
|
-
const parent = node2.parentNode;
|
|
214
|
-
if (!parent) {
|
|
215
|
-
return "";
|
|
216
|
-
}
|
|
217
|
-
const commentSiblings = Array.from(parent.childNodes).filter(
|
|
218
|
-
(sibling) => sibling.nodeType === Node.COMMENT_NODE
|
|
219
|
-
);
|
|
220
|
-
const index2 = commentSiblings.length > 1 ? `[${commentSiblings.indexOf(node2) + 1}]` : "";
|
|
221
|
-
return `${getXPath(parent)}/comment()${index2}`;
|
|
222
|
-
}
|
|
223
|
-
return "";
|
|
224
|
-
}
|
|
225
|
-
function isElement(n2) {
|
|
226
|
-
return n2.nodeType === n2.ELEMENT_NODE;
|
|
227
|
-
}
|
|
228
|
-
function isTextVisible(n2) {
|
|
229
|
-
var _a2;
|
|
230
|
-
const parent = index$1.parentNode(n2);
|
|
231
|
-
const parentElement2 = parent && parent;
|
|
232
|
-
if (!parentElement2) {
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
const isParentVisible = isElementVisible(parentElement2);
|
|
236
|
-
if (!isParentVisible) {
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
|
-
const textContent2 = (_a2 = n2.textContent) == null ? void 0 : _a2.trim();
|
|
240
|
-
return textContent2 !== "";
|
|
241
|
-
}
|
|
242
|
-
function isElementVisible(n2) {
|
|
243
|
-
return isStyleVisible(n2) && isRectVisible(n2.getBoundingClientRect());
|
|
244
|
-
}
|
|
245
|
-
function isStyleVisible(n2) {
|
|
246
|
-
const style = window.getComputedStyle(n2);
|
|
247
|
-
return style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
|
|
248
|
-
}
|
|
249
|
-
function isRectVisible(rect) {
|
|
250
|
-
return rect.width > 0 && rect.height > 0 && rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
251
|
-
}
|
|
252
199
|
function isShadowRoot(n2) {
|
|
253
200
|
const hostEl = (
|
|
254
201
|
// anchor and textarea elements also have a `host` property
|
|
@@ -584,6 +531,140 @@ function splitCssText(cssText, style) {
|
|
|
584
531
|
function markCssSplits(cssText, style) {
|
|
585
532
|
return splitCssText(cssText, style).join("/* rr_split */");
|
|
586
533
|
}
|
|
534
|
+
function getXPath(node2) {
|
|
535
|
+
if (node2.nodeType === Node.DOCUMENT_NODE) {
|
|
536
|
+
return "/";
|
|
537
|
+
}
|
|
538
|
+
if (node2.nodeType === Node.DOCUMENT_TYPE_NODE) {
|
|
539
|
+
return "/html/doctype";
|
|
540
|
+
}
|
|
541
|
+
if (node2.nodeType === Node.ELEMENT_NODE) {
|
|
542
|
+
const element = node2;
|
|
543
|
+
if (element.id) {
|
|
544
|
+
return `//*[@id="${element.id}"]`;
|
|
545
|
+
}
|
|
546
|
+
if (element.tagName && element.tagName.toLowerCase() === "html") {
|
|
547
|
+
return "/html";
|
|
548
|
+
}
|
|
549
|
+
if (element === document.head) {
|
|
550
|
+
return "/html/head";
|
|
551
|
+
}
|
|
552
|
+
if (element === document.body) {
|
|
553
|
+
return "/html/body";
|
|
554
|
+
}
|
|
555
|
+
const parentNode2 = element.parentNode;
|
|
556
|
+
if (!parentNode2 || !(parentNode2 instanceof Element)) {
|
|
557
|
+
return "";
|
|
558
|
+
}
|
|
559
|
+
const siblings = Array.from(parentNode2.children).filter(
|
|
560
|
+
(sibling) => sibling.tagName === element.tagName
|
|
561
|
+
);
|
|
562
|
+
const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
|
|
563
|
+
return `${getXPath(parentNode2)}/${element.tagName.toLowerCase()}${index2}`;
|
|
564
|
+
}
|
|
565
|
+
if (node2.nodeType === Node.TEXT_NODE) {
|
|
566
|
+
const parent = node2.parentNode;
|
|
567
|
+
if (!parent) {
|
|
568
|
+
return "";
|
|
569
|
+
}
|
|
570
|
+
const textSiblings = Array.from(parent.childNodes).filter(
|
|
571
|
+
(sibling) => sibling.nodeType === Node.TEXT_NODE
|
|
572
|
+
);
|
|
573
|
+
const index2 = textSiblings.length > 1 ? `[${textSiblings.indexOf(node2) + 1}]` : "";
|
|
574
|
+
return `${getXPath(parent)}/text()${index2}`;
|
|
575
|
+
}
|
|
576
|
+
if (node2.nodeType === Node.CDATA_SECTION_NODE) {
|
|
577
|
+
const parent = node2.parentNode;
|
|
578
|
+
if (!parent) {
|
|
579
|
+
return "";
|
|
580
|
+
}
|
|
581
|
+
const cdataSiblings = Array.from(parent.childNodes).filter(
|
|
582
|
+
(sibling) => sibling.nodeType === Node.CDATA_SECTION_NODE
|
|
583
|
+
);
|
|
584
|
+
const index2 = cdataSiblings.length > 1 ? `[${cdataSiblings.indexOf(node2) + 1}]` : "";
|
|
585
|
+
return `${getXPath(parent)}/text()${index2}`;
|
|
586
|
+
}
|
|
587
|
+
if (node2.nodeType === Node.COMMENT_NODE) {
|
|
588
|
+
const parent = node2.parentNode;
|
|
589
|
+
if (!parent) {
|
|
590
|
+
return "";
|
|
591
|
+
}
|
|
592
|
+
const commentSiblings = Array.from(parent.childNodes).filter(
|
|
593
|
+
(sibling) => sibling.nodeType === Node.COMMENT_NODE
|
|
594
|
+
);
|
|
595
|
+
const index2 = commentSiblings.length > 1 ? `[${commentSiblings.indexOf(node2) + 1}]` : "";
|
|
596
|
+
return `${getXPath(parent)}/comment()${index2}`;
|
|
597
|
+
}
|
|
598
|
+
return "";
|
|
599
|
+
}
|
|
600
|
+
function isElement(n2) {
|
|
601
|
+
return n2.nodeType === n2.ELEMENT_NODE;
|
|
602
|
+
}
|
|
603
|
+
function isTextVisible(n2) {
|
|
604
|
+
var _a2;
|
|
605
|
+
const parent = index$1.parentNode(n2);
|
|
606
|
+
const parentElement2 = parent && parent;
|
|
607
|
+
if (!parentElement2) {
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
const isParentVisible = isElementVisible(parentElement2);
|
|
611
|
+
if (!isParentVisible) {
|
|
612
|
+
return false;
|
|
613
|
+
}
|
|
614
|
+
const textContent2 = (_a2 = n2.textContent) == null ? void 0 : _a2.trim();
|
|
615
|
+
return textContent2 !== "";
|
|
616
|
+
}
|
|
617
|
+
function isElementVisible(n2) {
|
|
618
|
+
return isStyleVisible(n2) && isRectVisible(n2.getBoundingClientRect());
|
|
619
|
+
}
|
|
620
|
+
function isStyleVisible(n2) {
|
|
621
|
+
const style = window.getComputedStyle(n2);
|
|
622
|
+
return style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
|
|
623
|
+
}
|
|
624
|
+
function isRectVisible(rect) {
|
|
625
|
+
return rect.width > 0 && rect.height > 0 && rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
626
|
+
}
|
|
627
|
+
function getInteractiveEvents() {
|
|
628
|
+
return Object.keys(InteractiveEvent).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
|
|
629
|
+
}
|
|
630
|
+
function getInteractiveTags() {
|
|
631
|
+
return Object.keys(interactiveTag).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
|
|
632
|
+
}
|
|
633
|
+
function hasEventListeners(n2) {
|
|
634
|
+
return getInteractiveEvents().some((eventType) => {
|
|
635
|
+
let hasListener = false;
|
|
636
|
+
const testListener = () => {
|
|
637
|
+
hasListener = true;
|
|
638
|
+
};
|
|
639
|
+
n2.addEventListener(eventType, testListener);
|
|
640
|
+
n2.dispatchEvent(new Event(eventType));
|
|
641
|
+
n2.removeEventListener(eventType, testListener);
|
|
642
|
+
return hasListener;
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
function isElementInteractive(n2) {
|
|
646
|
+
var _a2;
|
|
647
|
+
const allowedTags = getInteractiveTags();
|
|
648
|
+
if (n2.nodeType === Node.ELEMENT_NODE) {
|
|
649
|
+
const element = n2;
|
|
650
|
+
const tagName = element.tagName.toLowerCase();
|
|
651
|
+
if (!allowedTags.includes(tagName)) {
|
|
652
|
+
return false;
|
|
653
|
+
}
|
|
654
|
+
const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
|
|
655
|
+
const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
|
|
656
|
+
element.getAttribute("role") || ""
|
|
657
|
+
);
|
|
658
|
+
const result2 = hasEventListeners(element) || hasTabIndex || hasRoleInteractive || element instanceof HTMLAnchorElement && element.hasAttribute("href") || element instanceof HTMLButtonElement && !element.disabled;
|
|
659
|
+
return result2;
|
|
660
|
+
}
|
|
661
|
+
if (n2.nodeType === Node.TEXT_NODE) {
|
|
662
|
+
const textNode = n2;
|
|
663
|
+
const parentElement2 = textNode.parentElement;
|
|
664
|
+
return parentElement2 !== null && allowedTags.includes(parentElement2.tagName.toLowerCase()) && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
|
|
665
|
+
}
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
587
668
|
let _id = 1;
|
|
588
669
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
589
670
|
const IGNORED_NODE = -2;
|
|
@@ -939,11 +1020,13 @@ function serializeTextNode(n2, options) {
|
|
|
939
1020
|
textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
|
|
940
1021
|
}
|
|
941
1022
|
const isVisible = isTextVisible(n2);
|
|
1023
|
+
const isInteractive = isElementInteractive(n2);
|
|
942
1024
|
return {
|
|
943
1025
|
type: NodeType$3.Text,
|
|
944
1026
|
textContent: textContent2 || "",
|
|
945
1027
|
rootId,
|
|
946
1028
|
isVisible,
|
|
1029
|
+
isInteractive,
|
|
947
1030
|
xPath
|
|
948
1031
|
};
|
|
949
1032
|
}
|
|
@@ -1129,6 +1212,7 @@ function serializeElementNode(n2, options) {
|
|
|
1129
1212
|
} catch (e2) {
|
|
1130
1213
|
}
|
|
1131
1214
|
const isVisible = isElementVisible(n2);
|
|
1215
|
+
const isInteractive = isElementInteractive(n2);
|
|
1132
1216
|
return {
|
|
1133
1217
|
type: NodeType$3.Element,
|
|
1134
1218
|
tagName,
|
|
@@ -1139,6 +1223,7 @@ function serializeElementNode(n2, options) {
|
|
|
1139
1223
|
rootId,
|
|
1140
1224
|
isCustom: isCustomElement,
|
|
1141
1225
|
isVisible,
|
|
1226
|
+
isInteractive,
|
|
1142
1227
|
xPath
|
|
1143
1228
|
};
|
|
1144
1229
|
}
|
|
@@ -9087,20 +9172,20 @@ var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
|
|
|
9087
9172
|
IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
|
|
9088
9173
|
IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
9089
9174
|
IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
|
|
9175
|
+
IncrementalSource2[IncrementalSource2["VisibilityChange"] = 17] = "VisibilityChange";
|
|
9090
9176
|
return IncrementalSource2;
|
|
9091
9177
|
})(IncrementalSource || {});
|
|
9092
9178
|
var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
|
|
9093
9179
|
MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
|
|
9094
9180
|
MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
|
|
9095
9181
|
MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
|
|
9096
|
-
MouseInteractions2[MouseInteractions2["
|
|
9097
|
-
MouseInteractions2[MouseInteractions2["
|
|
9098
|
-
MouseInteractions2[MouseInteractions2["
|
|
9099
|
-
MouseInteractions2[MouseInteractions2["
|
|
9100
|
-
MouseInteractions2[MouseInteractions2["
|
|
9101
|
-
MouseInteractions2[MouseInteractions2["
|
|
9102
|
-
MouseInteractions2[MouseInteractions2["
|
|
9103
|
-
MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
|
|
9182
|
+
MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
|
|
9183
|
+
MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
|
|
9184
|
+
MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
|
|
9185
|
+
MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
|
|
9186
|
+
MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
|
|
9187
|
+
MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
|
|
9188
|
+
MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
|
|
9104
9189
|
return MouseInteractions2;
|
|
9105
9190
|
})(MouseInteractions || {});
|
|
9106
9191
|
var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
|
|
@@ -9780,6 +9865,54 @@ function initMutationObserver(options, rootEl) {
|
|
|
9780
9865
|
});
|
|
9781
9866
|
return observer;
|
|
9782
9867
|
}
|
|
9868
|
+
function initVisibilityObserver({
|
|
9869
|
+
visibilityChangeCb,
|
|
9870
|
+
doc,
|
|
9871
|
+
mirror: mirror2
|
|
9872
|
+
}) {
|
|
9873
|
+
if (!visibilityChangeCb) {
|
|
9874
|
+
return () => {
|
|
9875
|
+
};
|
|
9876
|
+
}
|
|
9877
|
+
const observedElements = /* @__PURE__ */ new WeakMap();
|
|
9878
|
+
const observer = new IntersectionObserver(
|
|
9879
|
+
(entries) => {
|
|
9880
|
+
entries.forEach((entry) => {
|
|
9881
|
+
const target = entry.target;
|
|
9882
|
+
const id = mirror2.getId(target);
|
|
9883
|
+
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
|
|
9884
|
+
if (id !== -1) {
|
|
9885
|
+
if (observedElements.has(target)) {
|
|
9886
|
+
visibilityChangeCb({
|
|
9887
|
+
id,
|
|
9888
|
+
isVisible,
|
|
9889
|
+
visibilityRatio: entry.intersectionRatio,
|
|
9890
|
+
boundingRect: entry.boundingClientRect
|
|
9891
|
+
});
|
|
9892
|
+
} else {
|
|
9893
|
+
observedElements.set(target, true);
|
|
9894
|
+
}
|
|
9895
|
+
}
|
|
9896
|
+
});
|
|
9897
|
+
},
|
|
9898
|
+
{ root: null, threshold: [0.1, 0.9] }
|
|
9899
|
+
);
|
|
9900
|
+
doc.querySelectorAll("*").forEach((el) => observer.observe(el));
|
|
9901
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
9902
|
+
mutations.forEach((mutation) => {
|
|
9903
|
+
mutation.addedNodes.forEach((node2) => {
|
|
9904
|
+
if (node2 instanceof Element) {
|
|
9905
|
+
observer.observe(node2);
|
|
9906
|
+
}
|
|
9907
|
+
});
|
|
9908
|
+
});
|
|
9909
|
+
});
|
|
9910
|
+
mutationObserver.observe(doc, { childList: true, subtree: true });
|
|
9911
|
+
return () => {
|
|
9912
|
+
observer.disconnect();
|
|
9913
|
+
mutationObserver.disconnect();
|
|
9914
|
+
};
|
|
9915
|
+
}
|
|
9783
9916
|
function initMoveObserver({
|
|
9784
9917
|
mousemoveCb,
|
|
9785
9918
|
sampling,
|
|
@@ -10595,6 +10728,7 @@ function initCustomElementObserver({
|
|
|
10595
10728
|
function mergeHooks(o2, hooks) {
|
|
10596
10729
|
const {
|
|
10597
10730
|
mutationCb,
|
|
10731
|
+
visibilityChangeCb,
|
|
10598
10732
|
mousemoveCb,
|
|
10599
10733
|
mouseInteractionCb,
|
|
10600
10734
|
scrollCb,
|
|
@@ -10614,6 +10748,12 @@ function mergeHooks(o2, hooks) {
|
|
|
10614
10748
|
}
|
|
10615
10749
|
mutationCb(...p);
|
|
10616
10750
|
};
|
|
10751
|
+
o2.visibilityChangeCb = (...p) => {
|
|
10752
|
+
if (hooks.visibilityChange) {
|
|
10753
|
+
hooks.visibilityChange(...p);
|
|
10754
|
+
}
|
|
10755
|
+
visibilityChangeCb(...p);
|
|
10756
|
+
};
|
|
10617
10757
|
o2.mousemoveCb = (...p) => {
|
|
10618
10758
|
if (hooks.mousemove) {
|
|
10619
10759
|
hooks.mousemove(...p);
|
|
@@ -10688,6 +10828,7 @@ function mergeHooks(o2, hooks) {
|
|
|
10688
10828
|
};
|
|
10689
10829
|
}
|
|
10690
10830
|
function initObservers(o2, hooks = {}) {
|
|
10831
|
+
console.info("initObservers", o2);
|
|
10691
10832
|
const currentWindow = o2.doc.defaultView;
|
|
10692
10833
|
if (!currentWindow) {
|
|
10693
10834
|
return () => {
|
|
@@ -10706,6 +10847,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
10706
10847
|
});
|
|
10707
10848
|
const inputHandler = initInputObserver(o2);
|
|
10708
10849
|
const mediaInteractionHandler = initMediaInteractionObserver(o2);
|
|
10850
|
+
const visibleHandler = initVisibilityObserver(o2);
|
|
10709
10851
|
let styleSheetObserver = () => {
|
|
10710
10852
|
};
|
|
10711
10853
|
let adoptedStyleSheetObserver = () => {
|
|
@@ -10735,6 +10877,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
10735
10877
|
return callbackWrapper(() => {
|
|
10736
10878
|
mutationBuffers.forEach((b) => b.reset());
|
|
10737
10879
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
10880
|
+
visibleHandler();
|
|
10738
10881
|
mousemoveHandler();
|
|
10739
10882
|
mouseInteractionHandler();
|
|
10740
10883
|
scrollHandler();
|
|
@@ -11801,6 +11944,7 @@ function record(options = {}) {
|
|
|
11801
11944
|
emit,
|
|
11802
11945
|
checkoutEveryNms,
|
|
11803
11946
|
checkoutEveryNth,
|
|
11947
|
+
checkoutEveryEvc,
|
|
11804
11948
|
blockClass = "rr-block",
|
|
11805
11949
|
blockSelector = null,
|
|
11806
11950
|
ignoreClass = "rr-ignore",
|
|
@@ -12091,6 +12235,11 @@ function record(options = {}) {
|
|
|
12091
12235
|
mirror.getId(document)
|
|
12092
12236
|
);
|
|
12093
12237
|
};
|
|
12238
|
+
const debouncedFullSnapshot = throttle(() => {
|
|
12239
|
+
if (checkoutEveryEvc) {
|
|
12240
|
+
takeFullSnapshot$1(true);
|
|
12241
|
+
}
|
|
12242
|
+
}, 100, { leading: false, trailing: true });
|
|
12094
12243
|
try {
|
|
12095
12244
|
const handlers = [];
|
|
12096
12245
|
const observe = (doc) => {
|
|
@@ -12098,6 +12247,18 @@ function record(options = {}) {
|
|
|
12098
12247
|
return callbackWrapper(initObservers)(
|
|
12099
12248
|
{
|
|
12100
12249
|
mutationCb: wrappedMutationEmit,
|
|
12250
|
+
visibilityChangeCb: (v2) => {
|
|
12251
|
+
debouncedFullSnapshot();
|
|
12252
|
+
if (sampling.visibility) {
|
|
12253
|
+
return wrappedEmit({
|
|
12254
|
+
type: EventType.IncrementalSnapshot,
|
|
12255
|
+
data: {
|
|
12256
|
+
source: IncrementalSource.VisibilityChange,
|
|
12257
|
+
...v2
|
|
12258
|
+
}
|
|
12259
|
+
});
|
|
12260
|
+
}
|
|
12261
|
+
},
|
|
12101
12262
|
mousemoveCb: (positions, source) => wrappedEmit({
|
|
12102
12263
|
type: EventType.IncrementalSnapshot,
|
|
12103
12264
|
data: {
|