@appsurify-testmap/rrweb-all 2.0.0-alpha.23 → 2.0.0-alpha.25
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-all.cjs +261 -102
- package/dist/rrweb-all.cjs.map +1 -1
- package/dist/rrweb-all.js +261 -102
- package/dist/rrweb-all.js.map +1 -1
- package/dist/rrweb-all.umd.cjs +260 -102
- package/dist/rrweb-all.umd.cjs.map +2 -2
- package/dist/rrweb-all.umd.min.cjs +26 -26
- package/dist/rrweb-all.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-all.cjs
CHANGED
|
@@ -7,6 +7,46 @@ var _a$1;
|
|
|
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
|
|
@@ -598,6 +545,140 @@ function splitCssText(cssText, style) {
|
|
|
598
545
|
function markCssSplits(cssText, style) {
|
|
599
546
|
return splitCssText(cssText, style).join("/* rr_split */");
|
|
600
547
|
}
|
|
548
|
+
function getXPath(node2) {
|
|
549
|
+
if (node2.nodeType === Node.DOCUMENT_NODE) {
|
|
550
|
+
return "/";
|
|
551
|
+
}
|
|
552
|
+
if (node2.nodeType === Node.DOCUMENT_TYPE_NODE) {
|
|
553
|
+
return "/html/doctype";
|
|
554
|
+
}
|
|
555
|
+
if (node2.nodeType === Node.ELEMENT_NODE) {
|
|
556
|
+
const element = node2;
|
|
557
|
+
if (element.id) {
|
|
558
|
+
return `//*[@id="${element.id}"]`;
|
|
559
|
+
}
|
|
560
|
+
if (element.tagName && element.tagName.toLowerCase() === "html") {
|
|
561
|
+
return "/html";
|
|
562
|
+
}
|
|
563
|
+
if (element === document.head) {
|
|
564
|
+
return "/html/head";
|
|
565
|
+
}
|
|
566
|
+
if (element === document.body) {
|
|
567
|
+
return "/html/body";
|
|
568
|
+
}
|
|
569
|
+
const parentNode2 = element.parentNode;
|
|
570
|
+
if (!parentNode2 || !(parentNode2 instanceof Element)) {
|
|
571
|
+
return "";
|
|
572
|
+
}
|
|
573
|
+
const siblings = Array.from(parentNode2.children).filter(
|
|
574
|
+
(sibling) => sibling.tagName === element.tagName
|
|
575
|
+
);
|
|
576
|
+
const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
|
|
577
|
+
return `${getXPath(parentNode2)}/${element.tagName.toLowerCase()}${index2}`;
|
|
578
|
+
}
|
|
579
|
+
if (node2.nodeType === Node.TEXT_NODE) {
|
|
580
|
+
const parent = node2.parentNode;
|
|
581
|
+
if (!parent) {
|
|
582
|
+
return "";
|
|
583
|
+
}
|
|
584
|
+
const textSiblings = Array.from(parent.childNodes).filter(
|
|
585
|
+
(sibling) => sibling.nodeType === Node.TEXT_NODE
|
|
586
|
+
);
|
|
587
|
+
const index2 = textSiblings.length > 1 ? `[${textSiblings.indexOf(node2) + 1}]` : "";
|
|
588
|
+
return `${getXPath(parent)}/text()${index2}`;
|
|
589
|
+
}
|
|
590
|
+
if (node2.nodeType === Node.CDATA_SECTION_NODE) {
|
|
591
|
+
const parent = node2.parentNode;
|
|
592
|
+
if (!parent) {
|
|
593
|
+
return "";
|
|
594
|
+
}
|
|
595
|
+
const cdataSiblings = Array.from(parent.childNodes).filter(
|
|
596
|
+
(sibling) => sibling.nodeType === Node.CDATA_SECTION_NODE
|
|
597
|
+
);
|
|
598
|
+
const index2 = cdataSiblings.length > 1 ? `[${cdataSiblings.indexOf(node2) + 1}]` : "";
|
|
599
|
+
return `${getXPath(parent)}/text()${index2}`;
|
|
600
|
+
}
|
|
601
|
+
if (node2.nodeType === Node.COMMENT_NODE) {
|
|
602
|
+
const parent = node2.parentNode;
|
|
603
|
+
if (!parent) {
|
|
604
|
+
return "";
|
|
605
|
+
}
|
|
606
|
+
const commentSiblings = Array.from(parent.childNodes).filter(
|
|
607
|
+
(sibling) => sibling.nodeType === Node.COMMENT_NODE
|
|
608
|
+
);
|
|
609
|
+
const index2 = commentSiblings.length > 1 ? `[${commentSiblings.indexOf(node2) + 1}]` : "";
|
|
610
|
+
return `${getXPath(parent)}/comment()${index2}`;
|
|
611
|
+
}
|
|
612
|
+
return "";
|
|
613
|
+
}
|
|
614
|
+
function isElement(n2) {
|
|
615
|
+
return n2.nodeType === n2.ELEMENT_NODE;
|
|
616
|
+
}
|
|
617
|
+
function isTextVisible(n2) {
|
|
618
|
+
var _a2;
|
|
619
|
+
const parent = index$1.parentNode(n2);
|
|
620
|
+
const parentElement2 = parent && parent;
|
|
621
|
+
if (!parentElement2) {
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
624
|
+
const isParentVisible = isElementVisible(parentElement2);
|
|
625
|
+
if (!isParentVisible) {
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
628
|
+
const textContent2 = (_a2 = n2.textContent) == null ? void 0 : _a2.trim();
|
|
629
|
+
return textContent2 !== "";
|
|
630
|
+
}
|
|
631
|
+
function isElementVisible(n2) {
|
|
632
|
+
return isStyleVisible(n2) && isRectVisible(n2.getBoundingClientRect());
|
|
633
|
+
}
|
|
634
|
+
function isStyleVisible(n2) {
|
|
635
|
+
const style = window.getComputedStyle(n2);
|
|
636
|
+
return style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
|
|
637
|
+
}
|
|
638
|
+
function isRectVisible(rect) {
|
|
639
|
+
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);
|
|
640
|
+
}
|
|
641
|
+
function getInteractiveEvents() {
|
|
642
|
+
return Object.keys(InteractiveEvent).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
|
|
643
|
+
}
|
|
644
|
+
function getInteractiveTags() {
|
|
645
|
+
return Object.keys(interactiveTag).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
|
|
646
|
+
}
|
|
647
|
+
function hasEventListeners(n2) {
|
|
648
|
+
return getInteractiveEvents().some((eventType) => {
|
|
649
|
+
let hasListener = false;
|
|
650
|
+
const testListener = () => {
|
|
651
|
+
hasListener = true;
|
|
652
|
+
};
|
|
653
|
+
n2.addEventListener(eventType, testListener);
|
|
654
|
+
n2.dispatchEvent(new Event(eventType));
|
|
655
|
+
n2.removeEventListener(eventType, testListener);
|
|
656
|
+
return hasListener;
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
function isElementInteractive(n2) {
|
|
660
|
+
var _a2;
|
|
661
|
+
const allowedTags = getInteractiveTags();
|
|
662
|
+
if (n2.nodeType === Node.ELEMENT_NODE) {
|
|
663
|
+
const element = n2;
|
|
664
|
+
const tagName = element.tagName.toLowerCase();
|
|
665
|
+
if (!allowedTags.includes(tagName)) {
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
|
|
669
|
+
const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
|
|
670
|
+
element.getAttribute("role") || ""
|
|
671
|
+
);
|
|
672
|
+
const result2 = hasEventListeners(element) || hasTabIndex || hasRoleInteractive || element instanceof HTMLAnchorElement && element.hasAttribute("href") || element instanceof HTMLButtonElement && !element.disabled;
|
|
673
|
+
return result2;
|
|
674
|
+
}
|
|
675
|
+
if (n2.nodeType === Node.TEXT_NODE) {
|
|
676
|
+
const textNode = n2;
|
|
677
|
+
const parentElement2 = textNode.parentElement;
|
|
678
|
+
return parentElement2 !== null && allowedTags.includes(parentElement2.tagName.toLowerCase()) && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
|
|
679
|
+
}
|
|
680
|
+
return false;
|
|
681
|
+
}
|
|
601
682
|
let _id = 1;
|
|
602
683
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
603
684
|
const IGNORED_NODE = -2;
|
|
@@ -953,11 +1034,13 @@ function serializeTextNode(n2, options) {
|
|
|
953
1034
|
textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
|
|
954
1035
|
}
|
|
955
1036
|
const isVisible = isTextVisible(n2);
|
|
1037
|
+
const isInteractive = isElementInteractive(n2);
|
|
956
1038
|
return {
|
|
957
1039
|
type: NodeType$3.Text,
|
|
958
1040
|
textContent: textContent2 || "",
|
|
959
1041
|
rootId,
|
|
960
1042
|
isVisible,
|
|
1043
|
+
isInteractive,
|
|
961
1044
|
xPath
|
|
962
1045
|
};
|
|
963
1046
|
}
|
|
@@ -1143,6 +1226,7 @@ function serializeElementNode(n2, options) {
|
|
|
1143
1226
|
} catch (e2) {
|
|
1144
1227
|
}
|
|
1145
1228
|
const isVisible = isElementVisible(n2);
|
|
1229
|
+
const isInteractive = isElementInteractive(n2);
|
|
1146
1230
|
return {
|
|
1147
1231
|
type: NodeType$3.Element,
|
|
1148
1232
|
tagName,
|
|
@@ -1153,6 +1237,7 @@ function serializeElementNode(n2, options) {
|
|
|
1153
1237
|
rootId,
|
|
1154
1238
|
isCustom: isCustomElement,
|
|
1155
1239
|
isVisible,
|
|
1240
|
+
isInteractive,
|
|
1156
1241
|
xPath
|
|
1157
1242
|
};
|
|
1158
1243
|
}
|
|
@@ -10926,20 +11011,20 @@ var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
|
|
|
10926
11011
|
IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
|
|
10927
11012
|
IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
10928
11013
|
IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
|
|
11014
|
+
IncrementalSource2[IncrementalSource2["VisibilityChange"] = 17] = "VisibilityChange";
|
|
10929
11015
|
return IncrementalSource2;
|
|
10930
11016
|
})(IncrementalSource || {});
|
|
10931
11017
|
var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
|
|
10932
11018
|
MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
|
|
10933
11019
|
MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
|
|
10934
11020
|
MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
|
|
10935
|
-
MouseInteractions2[MouseInteractions2["
|
|
10936
|
-
MouseInteractions2[MouseInteractions2["
|
|
10937
|
-
MouseInteractions2[MouseInteractions2["
|
|
10938
|
-
MouseInteractions2[MouseInteractions2["
|
|
10939
|
-
MouseInteractions2[MouseInteractions2["
|
|
10940
|
-
MouseInteractions2[MouseInteractions2["
|
|
10941
|
-
MouseInteractions2[MouseInteractions2["
|
|
10942
|
-
MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
|
|
11021
|
+
MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
|
|
11022
|
+
MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
|
|
11023
|
+
MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
|
|
11024
|
+
MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
|
|
11025
|
+
MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
|
|
11026
|
+
MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
|
|
11027
|
+
MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
|
|
10943
11028
|
return MouseInteractions2;
|
|
10944
11029
|
})(MouseInteractions || {});
|
|
10945
11030
|
var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
|
|
@@ -11639,6 +11724,60 @@ function initMutationObserver(options, rootEl) {
|
|
|
11639
11724
|
});
|
|
11640
11725
|
return observer;
|
|
11641
11726
|
}
|
|
11727
|
+
function initVisibilityObserver({
|
|
11728
|
+
visibilityChangeCb,
|
|
11729
|
+
doc,
|
|
11730
|
+
mirror: mirror2,
|
|
11731
|
+
sampling
|
|
11732
|
+
}) {
|
|
11733
|
+
if (!visibilityChangeCb) {
|
|
11734
|
+
return () => {
|
|
11735
|
+
};
|
|
11736
|
+
}
|
|
11737
|
+
const observedElements = /* @__PURE__ */ new WeakMap();
|
|
11738
|
+
const debounceThreshold = typeof sampling.visibility === "number" ? sampling.visibility : 50;
|
|
11739
|
+
const throttledCb = throttle(
|
|
11740
|
+
callbackWrapper((entry) => {
|
|
11741
|
+
const target = entry.target;
|
|
11742
|
+
const id = mirror2.getId(target);
|
|
11743
|
+
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
|
|
11744
|
+
if (id !== -1) {
|
|
11745
|
+
visibilityChangeCb({
|
|
11746
|
+
id,
|
|
11747
|
+
isVisible,
|
|
11748
|
+
visibilityRatio: entry.intersectionRatio
|
|
11749
|
+
});
|
|
11750
|
+
}
|
|
11751
|
+
}),
|
|
11752
|
+
debounceThreshold,
|
|
11753
|
+
{ leading: sampling.visibility !== false, trailing: true }
|
|
11754
|
+
);
|
|
11755
|
+
const observer = new IntersectionObserver((entries) => {
|
|
11756
|
+
entries.forEach((entry) => {
|
|
11757
|
+
const target = entry.target;
|
|
11758
|
+
if (observedElements.has(target)) {
|
|
11759
|
+
throttledCb(entry);
|
|
11760
|
+
} else {
|
|
11761
|
+
observedElements.set(target, true);
|
|
11762
|
+
}
|
|
11763
|
+
});
|
|
11764
|
+
}, { root: null, threshold: [0.1, 0.9] });
|
|
11765
|
+
doc.querySelectorAll("*").forEach((el) => observer.observe(el));
|
|
11766
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
11767
|
+
mutations.forEach((mutation) => {
|
|
11768
|
+
mutation.addedNodes.forEach((node2) => {
|
|
11769
|
+
if (node2 instanceof Element) {
|
|
11770
|
+
observer.observe(node2);
|
|
11771
|
+
}
|
|
11772
|
+
});
|
|
11773
|
+
});
|
|
11774
|
+
});
|
|
11775
|
+
mutationObserver.observe(doc, { childList: true, subtree: true });
|
|
11776
|
+
return () => {
|
|
11777
|
+
observer.disconnect();
|
|
11778
|
+
mutationObserver.disconnect();
|
|
11779
|
+
};
|
|
11780
|
+
}
|
|
11642
11781
|
function initMoveObserver({
|
|
11643
11782
|
mousemoveCb,
|
|
11644
11783
|
sampling,
|
|
@@ -12454,6 +12593,7 @@ function initCustomElementObserver({
|
|
|
12454
12593
|
function mergeHooks(o2, hooks) {
|
|
12455
12594
|
const {
|
|
12456
12595
|
mutationCb,
|
|
12596
|
+
visibilityChangeCb,
|
|
12457
12597
|
mousemoveCb,
|
|
12458
12598
|
mouseInteractionCb,
|
|
12459
12599
|
scrollCb,
|
|
@@ -12473,6 +12613,12 @@ function mergeHooks(o2, hooks) {
|
|
|
12473
12613
|
}
|
|
12474
12614
|
mutationCb(...p);
|
|
12475
12615
|
};
|
|
12616
|
+
o2.visibilityChangeCb = (...p) => {
|
|
12617
|
+
if (hooks.visibilityChange) {
|
|
12618
|
+
hooks.visibilityChange(...p);
|
|
12619
|
+
}
|
|
12620
|
+
visibilityChangeCb(...p);
|
|
12621
|
+
};
|
|
12476
12622
|
o2.mousemoveCb = (...p) => {
|
|
12477
12623
|
if (hooks.mousemove) {
|
|
12478
12624
|
hooks.mousemove(...p);
|
|
@@ -12565,6 +12711,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
12565
12711
|
});
|
|
12566
12712
|
const inputHandler = initInputObserver(o2);
|
|
12567
12713
|
const mediaInteractionHandler = initMediaInteractionObserver(o2);
|
|
12714
|
+
const visibleHandler = initVisibilityObserver(o2);
|
|
12568
12715
|
let styleSheetObserver = () => {
|
|
12569
12716
|
};
|
|
12570
12717
|
let adoptedStyleSheetObserver = () => {
|
|
@@ -12594,6 +12741,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
12594
12741
|
return callbackWrapper(() => {
|
|
12595
12742
|
mutationBuffers.forEach((b) => b.reset());
|
|
12596
12743
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
12744
|
+
visibleHandler();
|
|
12597
12745
|
mousemoveHandler();
|
|
12598
12746
|
mouseInteractionHandler();
|
|
12599
12747
|
scrollHandler();
|
|
@@ -13680,6 +13828,7 @@ function record(options = {}) {
|
|
|
13680
13828
|
emit,
|
|
13681
13829
|
checkoutEveryNms,
|
|
13682
13830
|
checkoutEveryNth,
|
|
13831
|
+
checkoutEveryEvc,
|
|
13683
13832
|
blockClass = "rr-block",
|
|
13684
13833
|
blockSelector = null,
|
|
13685
13834
|
ignoreClass = "rr-ignore",
|
|
@@ -13808,7 +13957,8 @@ function record(options = {}) {
|
|
|
13808
13957
|
incrementalSnapshotCount++;
|
|
13809
13958
|
const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
13810
13959
|
const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
13811
|
-
|
|
13960
|
+
const isVisibilityChanged = checkoutEveryEvc && e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.VisibilityChange;
|
|
13961
|
+
if (exceedCount || exceedTime || isVisibilityChanged) {
|
|
13812
13962
|
takeFullSnapshot$1(true);
|
|
13813
13963
|
}
|
|
13814
13964
|
}
|
|
@@ -13977,6 +14127,15 @@ function record(options = {}) {
|
|
|
13977
14127
|
return callbackWrapper(initObservers)(
|
|
13978
14128
|
{
|
|
13979
14129
|
mutationCb: wrappedMutationEmit,
|
|
14130
|
+
visibilityChangeCb: (v2) => {
|
|
14131
|
+
wrappedEmit({
|
|
14132
|
+
type: EventType.IncrementalSnapshot,
|
|
14133
|
+
data: {
|
|
14134
|
+
source: IncrementalSource.VisibilityChange,
|
|
14135
|
+
...v2
|
|
14136
|
+
}
|
|
14137
|
+
});
|
|
14138
|
+
},
|
|
13980
14139
|
mousemoveCb: (positions, source) => wrappedEmit({
|
|
13981
14140
|
type: EventType.IncrementalSnapshot,
|
|
13982
14141
|
data: {
|