@appsurify-testmap/rrweb 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.cjs +262 -101
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.d.cts +1 -0
- package/dist/rrweb.d.ts +1 -0
- package/dist/rrweb.js +262 -101
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +261 -101
- package/dist/rrweb.umd.cjs.map +2 -2
- package/dist/rrweb.umd.min.cjs +26 -26
- package/dist/rrweb.umd.min.cjs.map +3 -3
- package/package.json +5 -5
package/dist/rrweb.cjs
CHANGED
|
@@ -7,6 +7,46 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
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) => {
|
|
@@ -11659,6 +11744,54 @@ function initMutationObserver(options, rootEl) {
|
|
|
11659
11744
|
});
|
|
11660
11745
|
return observer;
|
|
11661
11746
|
}
|
|
11747
|
+
function initVisibilityObserver({
|
|
11748
|
+
visibilityChangeCb,
|
|
11749
|
+
doc,
|
|
11750
|
+
mirror: mirror2
|
|
11751
|
+
}) {
|
|
11752
|
+
if (!visibilityChangeCb) {
|
|
11753
|
+
return () => {
|
|
11754
|
+
};
|
|
11755
|
+
}
|
|
11756
|
+
const observedElements = /* @__PURE__ */ new WeakMap();
|
|
11757
|
+
const observer = new IntersectionObserver(
|
|
11758
|
+
(entries) => {
|
|
11759
|
+
entries.forEach((entry) => {
|
|
11760
|
+
const target = entry.target;
|
|
11761
|
+
const id = mirror2.getId(target);
|
|
11762
|
+
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
|
|
11763
|
+
if (id !== -1) {
|
|
11764
|
+
if (observedElements.has(target)) {
|
|
11765
|
+
visibilityChangeCb({
|
|
11766
|
+
id,
|
|
11767
|
+
isVisible,
|
|
11768
|
+
visibilityRatio: entry.intersectionRatio,
|
|
11769
|
+
boundingRect: entry.boundingClientRect
|
|
11770
|
+
});
|
|
11771
|
+
} else {
|
|
11772
|
+
observedElements.set(target, true);
|
|
11773
|
+
}
|
|
11774
|
+
}
|
|
11775
|
+
});
|
|
11776
|
+
},
|
|
11777
|
+
{ root: null, threshold: [0.1, 0.9] }
|
|
11778
|
+
);
|
|
11779
|
+
doc.querySelectorAll("*").forEach((el) => observer.observe(el));
|
|
11780
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
11781
|
+
mutations.forEach((mutation) => {
|
|
11782
|
+
mutation.addedNodes.forEach((node2) => {
|
|
11783
|
+
if (node2 instanceof Element) {
|
|
11784
|
+
observer.observe(node2);
|
|
11785
|
+
}
|
|
11786
|
+
});
|
|
11787
|
+
});
|
|
11788
|
+
});
|
|
11789
|
+
mutationObserver.observe(doc, { childList: true, subtree: true });
|
|
11790
|
+
return () => {
|
|
11791
|
+
observer.disconnect();
|
|
11792
|
+
mutationObserver.disconnect();
|
|
11793
|
+
};
|
|
11794
|
+
}
|
|
11662
11795
|
function initMoveObserver({
|
|
11663
11796
|
mousemoveCb,
|
|
11664
11797
|
sampling,
|
|
@@ -12474,6 +12607,7 @@ function initCustomElementObserver({
|
|
|
12474
12607
|
function mergeHooks(o2, hooks) {
|
|
12475
12608
|
const {
|
|
12476
12609
|
mutationCb,
|
|
12610
|
+
visibilityChangeCb,
|
|
12477
12611
|
mousemoveCb,
|
|
12478
12612
|
mouseInteractionCb,
|
|
12479
12613
|
scrollCb,
|
|
@@ -12493,6 +12627,12 @@ function mergeHooks(o2, hooks) {
|
|
|
12493
12627
|
}
|
|
12494
12628
|
mutationCb(...p);
|
|
12495
12629
|
};
|
|
12630
|
+
o2.visibilityChangeCb = (...p) => {
|
|
12631
|
+
if (hooks.visibilityChange) {
|
|
12632
|
+
hooks.visibilityChange(...p);
|
|
12633
|
+
}
|
|
12634
|
+
visibilityChangeCb(...p);
|
|
12635
|
+
};
|
|
12496
12636
|
o2.mousemoveCb = (...p) => {
|
|
12497
12637
|
if (hooks.mousemove) {
|
|
12498
12638
|
hooks.mousemove(...p);
|
|
@@ -12567,6 +12707,7 @@ function mergeHooks(o2, hooks) {
|
|
|
12567
12707
|
};
|
|
12568
12708
|
}
|
|
12569
12709
|
function initObservers(o2, hooks = {}) {
|
|
12710
|
+
console.info("initObservers", o2);
|
|
12570
12711
|
const currentWindow = o2.doc.defaultView;
|
|
12571
12712
|
if (!currentWindow) {
|
|
12572
12713
|
return () => {
|
|
@@ -12585,6 +12726,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
12585
12726
|
});
|
|
12586
12727
|
const inputHandler = initInputObserver(o2);
|
|
12587
12728
|
const mediaInteractionHandler = initMediaInteractionObserver(o2);
|
|
12729
|
+
const visibleHandler = initVisibilityObserver(o2);
|
|
12588
12730
|
let styleSheetObserver = () => {
|
|
12589
12731
|
};
|
|
12590
12732
|
let adoptedStyleSheetObserver = () => {
|
|
@@ -12614,6 +12756,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
12614
12756
|
return callbackWrapper(() => {
|
|
12615
12757
|
mutationBuffers.forEach((b) => b.reset());
|
|
12616
12758
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
12759
|
+
visibleHandler();
|
|
12617
12760
|
mousemoveHandler();
|
|
12618
12761
|
mouseInteractionHandler();
|
|
12619
12762
|
scrollHandler();
|
|
@@ -13700,6 +13843,7 @@ function record(options = {}) {
|
|
|
13700
13843
|
emit,
|
|
13701
13844
|
checkoutEveryNms,
|
|
13702
13845
|
checkoutEveryNth,
|
|
13846
|
+
checkoutEveryEvc,
|
|
13703
13847
|
blockClass = "rr-block",
|
|
13704
13848
|
blockSelector = null,
|
|
13705
13849
|
ignoreClass = "rr-ignore",
|
|
@@ -13990,6 +14134,11 @@ function record(options = {}) {
|
|
|
13990
14134
|
mirror.getId(document)
|
|
13991
14135
|
);
|
|
13992
14136
|
};
|
|
14137
|
+
const debouncedFullSnapshot = throttle(() => {
|
|
14138
|
+
if (checkoutEveryEvc) {
|
|
14139
|
+
takeFullSnapshot$1(true);
|
|
14140
|
+
}
|
|
14141
|
+
}, 100, { leading: false, trailing: true });
|
|
13993
14142
|
try {
|
|
13994
14143
|
const handlers = [];
|
|
13995
14144
|
const observe = (doc) => {
|
|
@@ -13997,6 +14146,18 @@ function record(options = {}) {
|
|
|
13997
14146
|
return callbackWrapper(initObservers)(
|
|
13998
14147
|
{
|
|
13999
14148
|
mutationCb: wrappedMutationEmit,
|
|
14149
|
+
visibilityChangeCb: (v2) => {
|
|
14150
|
+
debouncedFullSnapshot();
|
|
14151
|
+
if (sampling.visibility) {
|
|
14152
|
+
return wrappedEmit({
|
|
14153
|
+
type: EventType.IncrementalSnapshot,
|
|
14154
|
+
data: {
|
|
14155
|
+
source: IncrementalSource.VisibilityChange,
|
|
14156
|
+
...v2
|
|
14157
|
+
}
|
|
14158
|
+
});
|
|
14159
|
+
}
|
|
14160
|
+
},
|
|
14000
14161
|
mousemoveCb: (positions, source) => wrappedEmit({
|
|
14001
14162
|
type: EventType.IncrementalSnapshot,
|
|
14002
14163
|
data: {
|