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