@appsurify-testmap/rrweb-all 2.1.0-alpha.3 → 2.1.0-alpha.6
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 +112 -142
- package/dist/rrweb-all.cjs.map +1 -1
- package/dist/rrweb-all.js +112 -142
- package/dist/rrweb-all.js.map +1 -1
- package/dist/rrweb-all.umd.cjs +112 -140
- 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
|
@@ -892,32 +892,14 @@ function transformAttribute(doc, tagName, name, value) {
|
|
|
892
892
|
}
|
|
893
893
|
return value;
|
|
894
894
|
}
|
|
895
|
-
function
|
|
895
|
+
function ignoreAttribute(tagName, name, _value) {
|
|
896
896
|
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
897
897
|
}
|
|
898
|
-
function
|
|
899
|
-
|
|
900
|
-
const attributes = {};
|
|
901
|
-
const len = element.attributes.length;
|
|
902
|
-
for (let i2 = 0; i2 < len; i2++) {
|
|
903
|
-
const attr = element.attributes[i2];
|
|
904
|
-
const name = attr.name;
|
|
905
|
-
const value = attr.value;
|
|
906
|
-
const shouldIgnoreByName = typeof ignoreAttribute === "string" ? name === ignoreAttribute : ignoreAttribute.test(name);
|
|
907
|
-
if (!shouldIgnoreByName && !isIgnoreAttribute(tagName, name)) {
|
|
908
|
-
attributes[name] = transformAttribute(
|
|
909
|
-
doc,
|
|
910
|
-
tagName,
|
|
911
|
-
toLowerCase(name),
|
|
912
|
-
value
|
|
913
|
-
);
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
return attributes;
|
|
898
|
+
function isIncludeAttribute(name, include) {
|
|
899
|
+
return typeof include === "string" ? name.includes(include) : include.test(name);
|
|
917
900
|
}
|
|
918
|
-
function
|
|
919
|
-
|
|
920
|
-
return typeof ignore === "string" ? name === ignore : ignore.test(name);
|
|
901
|
+
function isExcludeAttribute(name, exclude) {
|
|
902
|
+
return typeof exclude === "string" ? name.includes(exclude) : exclude.test(name);
|
|
921
903
|
}
|
|
922
904
|
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
923
905
|
try {
|
|
@@ -1048,7 +1030,8 @@ function serializeNode(n2, options) {
|
|
|
1048
1030
|
mirror: mirror2,
|
|
1049
1031
|
blockClass,
|
|
1050
1032
|
blockSelector,
|
|
1051
|
-
|
|
1033
|
+
excludeAttribute,
|
|
1034
|
+
includeAttribute,
|
|
1052
1035
|
needsMask,
|
|
1053
1036
|
inlineStylesheet,
|
|
1054
1037
|
maskInputOptions = {},
|
|
@@ -1094,7 +1077,8 @@ function serializeNode(n2, options) {
|
|
|
1094
1077
|
doc,
|
|
1095
1078
|
blockClass,
|
|
1096
1079
|
blockSelector,
|
|
1097
|
-
|
|
1080
|
+
excludeAttribute,
|
|
1081
|
+
includeAttribute,
|
|
1098
1082
|
inlineStylesheet,
|
|
1099
1083
|
maskInputOptions,
|
|
1100
1084
|
maskInputFn,
|
|
@@ -1172,7 +1156,8 @@ function serializeElementNode(n2, options) {
|
|
|
1172
1156
|
doc,
|
|
1173
1157
|
blockClass,
|
|
1174
1158
|
blockSelector,
|
|
1175
|
-
|
|
1159
|
+
excludeAttribute,
|
|
1160
|
+
includeAttribute,
|
|
1176
1161
|
inlineStylesheet,
|
|
1177
1162
|
maskInputOptions = {},
|
|
1178
1163
|
maskInputFn,
|
|
@@ -1186,7 +1171,22 @@ function serializeElementNode(n2, options) {
|
|
|
1186
1171
|
} = options;
|
|
1187
1172
|
const needBlock = _isBlockedElement(n2, blockClass, blockSelector);
|
|
1188
1173
|
const tagName = getValidTagName$1(n2);
|
|
1189
|
-
let attributes =
|
|
1174
|
+
let attributes = {};
|
|
1175
|
+
const len = n2.attributes.length;
|
|
1176
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
1177
|
+
const attr = n2.attributes[i2];
|
|
1178
|
+
if (isExcludeAttribute(attr.name, excludeAttribute) && !isIncludeAttribute(attr.name, includeAttribute)) {
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
if (!ignoreAttribute(tagName, attr.name, attr.value)) {
|
|
1182
|
+
attributes[attr.name] = transformAttribute(
|
|
1183
|
+
doc,
|
|
1184
|
+
tagName,
|
|
1185
|
+
toLowerCase(attr.name),
|
|
1186
|
+
attr.value
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
1190
|
if (tagName === "link" && inlineStylesheet) {
|
|
1191
1191
|
const stylesheet = Array.from(doc.styleSheets).find((s2) => {
|
|
1192
1192
|
return s2.href === n2.href;
|
|
@@ -1400,7 +1400,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1400
1400
|
blockSelector,
|
|
1401
1401
|
maskTextClass,
|
|
1402
1402
|
maskTextSelector,
|
|
1403
|
-
|
|
1403
|
+
excludeAttribute,
|
|
1404
|
+
includeAttribute,
|
|
1404
1405
|
skipChild = false,
|
|
1405
1406
|
inlineStylesheet = true,
|
|
1406
1407
|
maskInputOptions = {},
|
|
@@ -1435,7 +1436,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1435
1436
|
mirror: mirror2,
|
|
1436
1437
|
blockClass,
|
|
1437
1438
|
blockSelector,
|
|
1438
|
-
|
|
1439
|
+
excludeAttribute,
|
|
1440
|
+
includeAttribute,
|
|
1439
1441
|
needsMask,
|
|
1440
1442
|
inlineStylesheet,
|
|
1441
1443
|
maskInputOptions,
|
|
@@ -1488,7 +1490,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1488
1490
|
needsMask,
|
|
1489
1491
|
maskTextClass,
|
|
1490
1492
|
maskTextSelector,
|
|
1491
|
-
|
|
1493
|
+
excludeAttribute,
|
|
1494
|
+
includeAttribute,
|
|
1492
1495
|
skipChild,
|
|
1493
1496
|
inlineStylesheet,
|
|
1494
1497
|
maskInputOptions,
|
|
@@ -1548,7 +1551,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1548
1551
|
needsMask,
|
|
1549
1552
|
maskTextClass,
|
|
1550
1553
|
maskTextSelector,
|
|
1551
|
-
|
|
1554
|
+
excludeAttribute,
|
|
1555
|
+
includeAttribute,
|
|
1552
1556
|
skipChild: false,
|
|
1553
1557
|
inlineStylesheet,
|
|
1554
1558
|
maskInputOptions,
|
|
@@ -1590,7 +1594,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1590
1594
|
needsMask,
|
|
1591
1595
|
maskTextClass,
|
|
1592
1596
|
maskTextSelector,
|
|
1593
|
-
|
|
1597
|
+
excludeAttribute,
|
|
1598
|
+
includeAttribute,
|
|
1594
1599
|
skipChild: false,
|
|
1595
1600
|
inlineStylesheet,
|
|
1596
1601
|
maskInputOptions,
|
|
@@ -1628,7 +1633,8 @@ function snapshot(n2, options) {
|
|
|
1628
1633
|
blockSelector = null,
|
|
1629
1634
|
maskTextClass = "rr-mask",
|
|
1630
1635
|
maskTextSelector = null,
|
|
1631
|
-
|
|
1636
|
+
excludeAttribute = /^$a/,
|
|
1637
|
+
includeAttribute = /.+/i,
|
|
1632
1638
|
inlineStylesheet = true,
|
|
1633
1639
|
inlineImages = false,
|
|
1634
1640
|
recordCanvas = false,
|
|
@@ -1688,7 +1694,8 @@ function snapshot(n2, options) {
|
|
|
1688
1694
|
blockSelector,
|
|
1689
1695
|
maskTextClass,
|
|
1690
1696
|
maskTextSelector,
|
|
1691
|
-
|
|
1697
|
+
excludeAttribute,
|
|
1698
|
+
includeAttribute,
|
|
1692
1699
|
skipChild: false,
|
|
1693
1700
|
inlineStylesheet,
|
|
1694
1701
|
maskInputOptions,
|
|
@@ -10924,7 +10931,7 @@ function hookSetter(target, key, d, isRevoked, win = window) {
|
|
|
10924
10931
|
return () => hookSetter(target, key, original || {}, true);
|
|
10925
10932
|
}
|
|
10926
10933
|
function nowTimestamp() {
|
|
10927
|
-
return performance.timeOrigin + performance.now();
|
|
10934
|
+
return Math.round(performance.timeOrigin + performance.now());
|
|
10928
10935
|
}
|
|
10929
10936
|
function getWindowScroll(win = window) {
|
|
10930
10937
|
var _a2, _b2, _c, _d;
|
|
@@ -11241,7 +11248,6 @@ var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
|
|
|
11241
11248
|
IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
|
|
11242
11249
|
IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
11243
11250
|
IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
|
|
11244
|
-
IncrementalSource2[IncrementalSource2["VisibilityChange"] = 17] = "VisibilityChange";
|
|
11245
11251
|
return IncrementalSource2;
|
|
11246
11252
|
})(IncrementalSource || {});
|
|
11247
11253
|
var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
|
|
@@ -11407,7 +11413,8 @@ class MutationBuffer {
|
|
|
11407
11413
|
__publicField(this, "blockSelector");
|
|
11408
11414
|
__publicField(this, "maskTextClass");
|
|
11409
11415
|
__publicField(this, "maskTextSelector");
|
|
11410
|
-
__publicField(this, "
|
|
11416
|
+
__publicField(this, "excludeAttribute");
|
|
11417
|
+
__publicField(this, "includeAttribute");
|
|
11411
11418
|
__publicField(this, "inlineStylesheet");
|
|
11412
11419
|
__publicField(this, "maskInputOptions");
|
|
11413
11420
|
__publicField(this, "maskTextFn");
|
|
@@ -11471,7 +11478,8 @@ class MutationBuffer {
|
|
|
11471
11478
|
blockSelector: this.blockSelector,
|
|
11472
11479
|
maskTextClass: this.maskTextClass,
|
|
11473
11480
|
maskTextSelector: this.maskTextSelector,
|
|
11474
|
-
|
|
11481
|
+
excludeAttribute: this.excludeAttribute,
|
|
11482
|
+
includeAttribute: this.includeAttribute,
|
|
11475
11483
|
skipChild: true,
|
|
11476
11484
|
newlyAddedElement: true,
|
|
11477
11485
|
inlineStylesheet: this.inlineStylesheet,
|
|
@@ -11591,21 +11599,6 @@ class MutationBuffer {
|
|
|
11591
11599
|
};
|
|
11592
11600
|
}).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),
|
|
11593
11601
|
attributes: this.attributes.map((attribute) => {
|
|
11594
|
-
const element = attribute.node;
|
|
11595
|
-
const filtered = {};
|
|
11596
|
-
for (const [name, value] of Object.entries(attribute.attributes)) {
|
|
11597
|
-
const isIgnored2 = shouldIgnoreAttribute(this.ignoreAttribute, name);
|
|
11598
|
-
const existedBefore = element.hasAttribute(name);
|
|
11599
|
-
const keep = value !== null && !isIgnored2 || value === null && (!isIgnored2 || attribute.attributes[name] !== null || existedBefore);
|
|
11600
|
-
if (keep) {
|
|
11601
|
-
filtered[name] = value;
|
|
11602
|
-
}
|
|
11603
|
-
}
|
|
11604
|
-
return {
|
|
11605
|
-
...attribute,
|
|
11606
|
-
attributes: filtered
|
|
11607
|
-
};
|
|
11608
|
-
}).filter((attribute) => Object.keys(attribute.attributes).length > 0).map((attribute) => {
|
|
11609
11602
|
const { attributes } = attribute;
|
|
11610
11603
|
if (typeof attributes.style === "string") {
|
|
11611
11604
|
const diffAsStr = JSON.stringify(attribute.styleDiff);
|
|
@@ -11687,8 +11680,13 @@ class MutationBuffer {
|
|
|
11687
11680
|
case "attributes": {
|
|
11688
11681
|
const target = m.target;
|
|
11689
11682
|
let attributeName = m.attributeName;
|
|
11690
|
-
let value = target.getAttribute(attributeName);
|
|
11691
|
-
|
|
11683
|
+
let value = m.target.getAttribute(attributeName);
|
|
11684
|
+
const propValue = target[attributeName];
|
|
11685
|
+
const isPhantomAttributeMutation = value === null && !target.hasAttribute(attributeName) && m.oldValue !== null && (propValue === "" || propValue === null || typeof propValue === "undefined");
|
|
11686
|
+
if (isPhantomAttributeMutation && !isIncludeAttribute(attributeName, this.includeAttribute)) {
|
|
11687
|
+
return;
|
|
11688
|
+
}
|
|
11689
|
+
if (isExcludeAttribute(attributeName, this.excludeAttribute)) {
|
|
11692
11690
|
return;
|
|
11693
11691
|
}
|
|
11694
11692
|
if (attributeName === "value") {
|
|
@@ -11726,14 +11724,21 @@ class MutationBuffer {
|
|
|
11726
11724
|
if (attributeName === "type" && target.tagName === "INPUT" && (m.oldValue || "").toLowerCase() === "password") {
|
|
11727
11725
|
target.setAttribute("data-rr-is-password", "true");
|
|
11728
11726
|
}
|
|
11729
|
-
if (!
|
|
11730
|
-
!shouldIgnoreAttribute(this.ignoreAttribute, attributeName)) {
|
|
11727
|
+
if (!ignoreAttribute(target.tagName, attributeName)) {
|
|
11731
11728
|
item.attributes[attributeName] = transformAttribute(
|
|
11732
11729
|
this.doc,
|
|
11733
11730
|
toLowerCase(target.tagName),
|
|
11734
11731
|
toLowerCase(attributeName),
|
|
11735
11732
|
value
|
|
11736
11733
|
);
|
|
11734
|
+
if (value === item.attributes[attributeName] && !isIncludeAttribute(attributeName, this.includeAttribute)) {
|
|
11735
|
+
delete item.attributes[attributeName];
|
|
11736
|
+
if (Object.keys(item.attributes).length === 0) {
|
|
11737
|
+
this.attributes = this.attributes.filter((a2) => a2 !== item);
|
|
11738
|
+
this.attributeMap.delete(m.target);
|
|
11739
|
+
}
|
|
11740
|
+
return;
|
|
11741
|
+
}
|
|
11737
11742
|
if (attributeName === "style") {
|
|
11738
11743
|
if (!this.unattachedDoc) {
|
|
11739
11744
|
try {
|
|
@@ -11846,7 +11851,8 @@ class MutationBuffer {
|
|
|
11846
11851
|
"blockSelector",
|
|
11847
11852
|
"maskTextClass",
|
|
11848
11853
|
"maskTextSelector",
|
|
11849
|
-
"
|
|
11854
|
+
"excludeAttribute",
|
|
11855
|
+
"includeAttribute",
|
|
11850
11856
|
"inlineStylesheet",
|
|
11851
11857
|
"maskInputOptions",
|
|
11852
11858
|
"maskTextFn",
|
|
@@ -11985,60 +11991,6 @@ function initMutationObserver(options, rootEl) {
|
|
|
11985
11991
|
});
|
|
11986
11992
|
return observer;
|
|
11987
11993
|
}
|
|
11988
|
-
function initVisibilityObserver({
|
|
11989
|
-
visibilityChangeCb,
|
|
11990
|
-
doc,
|
|
11991
|
-
mirror: mirror2,
|
|
11992
|
-
sampling
|
|
11993
|
-
}) {
|
|
11994
|
-
if (!visibilityChangeCb) {
|
|
11995
|
-
return () => {
|
|
11996
|
-
};
|
|
11997
|
-
}
|
|
11998
|
-
const observedElements = /* @__PURE__ */ new WeakMap();
|
|
11999
|
-
const debounceThreshold = typeof sampling.visibility === "number" ? sampling.visibility : 50;
|
|
12000
|
-
const throttledCb = throttle(
|
|
12001
|
-
callbackWrapper((entry) => {
|
|
12002
|
-
const target = entry.target;
|
|
12003
|
-
const id = mirror2.getId(target);
|
|
12004
|
-
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
|
|
12005
|
-
if (id !== -1) {
|
|
12006
|
-
visibilityChangeCb({
|
|
12007
|
-
id,
|
|
12008
|
-
isVisible,
|
|
12009
|
-
visibilityRatio: entry.intersectionRatio
|
|
12010
|
-
});
|
|
12011
|
-
}
|
|
12012
|
-
}),
|
|
12013
|
-
debounceThreshold,
|
|
12014
|
-
{ leading: sampling.visibility !== false, trailing: true }
|
|
12015
|
-
);
|
|
12016
|
-
const observer = new IntersectionObserver((entries) => {
|
|
12017
|
-
entries.forEach((entry) => {
|
|
12018
|
-
const target = entry.target;
|
|
12019
|
-
if (observedElements.has(target)) {
|
|
12020
|
-
throttledCb(entry);
|
|
12021
|
-
} else {
|
|
12022
|
-
observedElements.set(target, true);
|
|
12023
|
-
}
|
|
12024
|
-
});
|
|
12025
|
-
}, { root: null, threshold: [0.1, 0.9] });
|
|
12026
|
-
doc.querySelectorAll("*").forEach((el) => observer.observe(el));
|
|
12027
|
-
const mutationObserver = new MutationObserver((mutations) => {
|
|
12028
|
-
mutations.forEach((mutation) => {
|
|
12029
|
-
mutation.addedNodes.forEach((node2) => {
|
|
12030
|
-
if (node2 instanceof Element) {
|
|
12031
|
-
observer.observe(node2);
|
|
12032
|
-
}
|
|
12033
|
-
});
|
|
12034
|
-
});
|
|
12035
|
-
});
|
|
12036
|
-
mutationObserver.observe(doc, { childList: true, subtree: true });
|
|
12037
|
-
return () => {
|
|
12038
|
-
observer.disconnect();
|
|
12039
|
-
mutationObserver.disconnect();
|
|
12040
|
-
};
|
|
12041
|
-
}
|
|
12042
11994
|
function initMoveObserver({
|
|
12043
11995
|
mousemoveCb,
|
|
12044
11996
|
sampling,
|
|
@@ -12318,6 +12270,20 @@ function initInputObserver({
|
|
|
12318
12270
|
}
|
|
12319
12271
|
function cbWithDedup(target, v2) {
|
|
12320
12272
|
const lastInputValue = lastInputValueMap.get(target);
|
|
12273
|
+
const el = target;
|
|
12274
|
+
const hasPlaceholder = el.hasAttribute("placeholder");
|
|
12275
|
+
const isEmpty = el.value === "";
|
|
12276
|
+
const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
|
|
12277
|
+
const isNonUser = !v2.userTriggered;
|
|
12278
|
+
const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
|
|
12279
|
+
const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
|
|
12280
|
+
const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
|
|
12281
|
+
const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
|
|
12282
|
+
const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
|
|
12283
|
+
const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
|
|
12284
|
+
if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
|
|
12285
|
+
return;
|
|
12286
|
+
}
|
|
12321
12287
|
if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
|
|
12322
12288
|
lastInputValueMap.set(target, v2);
|
|
12323
12289
|
const id = mirror2.getId(target);
|
|
@@ -12855,7 +12821,6 @@ function initCustomElementObserver({
|
|
|
12855
12821
|
function mergeHooks(o2, hooks) {
|
|
12856
12822
|
const {
|
|
12857
12823
|
mutationCb,
|
|
12858
|
-
visibilityChangeCb,
|
|
12859
12824
|
mousemoveCb,
|
|
12860
12825
|
mouseInteractionCb,
|
|
12861
12826
|
scrollCb,
|
|
@@ -12875,12 +12840,6 @@ function mergeHooks(o2, hooks) {
|
|
|
12875
12840
|
}
|
|
12876
12841
|
mutationCb(...p);
|
|
12877
12842
|
};
|
|
12878
|
-
o2.visibilityChangeCb = (...p) => {
|
|
12879
|
-
if (hooks.visibilityChange) {
|
|
12880
|
-
hooks.visibilityChange(...p);
|
|
12881
|
-
}
|
|
12882
|
-
visibilityChangeCb(...p);
|
|
12883
|
-
};
|
|
12884
12843
|
o2.mousemoveCb = (...p) => {
|
|
12885
12844
|
if (hooks.mousemove) {
|
|
12886
12845
|
hooks.mousemove(...p);
|
|
@@ -12973,7 +12932,6 @@ function initObservers(o2, hooks = {}) {
|
|
|
12973
12932
|
});
|
|
12974
12933
|
const inputHandler = initInputObserver(o2);
|
|
12975
12934
|
const mediaInteractionHandler = initMediaInteractionObserver(o2);
|
|
12976
|
-
const visibleHandler = initVisibilityObserver(o2);
|
|
12977
12935
|
let styleSheetObserver = () => {
|
|
12978
12936
|
};
|
|
12979
12937
|
let adoptedStyleSheetObserver = () => {
|
|
@@ -13003,7 +12961,6 @@ function initObservers(o2, hooks = {}) {
|
|
|
13003
12961
|
return callbackWrapper(() => {
|
|
13004
12962
|
mutationBuffers.forEach((b) => b.reset());
|
|
13005
12963
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
13006
|
-
visibleHandler();
|
|
13007
12964
|
mousemoveHandler();
|
|
13008
12965
|
mouseInteractionHandler();
|
|
13009
12966
|
scrollHandler();
|
|
@@ -14074,6 +14031,7 @@ let wrappedEmit;
|
|
|
14074
14031
|
let takeFullSnapshot$1;
|
|
14075
14032
|
let canvasManager;
|
|
14076
14033
|
let recording = false;
|
|
14034
|
+
const preRecordingCustomEvents = [];
|
|
14077
14035
|
try {
|
|
14078
14036
|
if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
|
|
14079
14037
|
const cleanFrame = document.createElement("iframe");
|
|
@@ -14090,12 +14048,12 @@ function record(options = {}) {
|
|
|
14090
14048
|
emit,
|
|
14091
14049
|
checkoutEveryNms,
|
|
14092
14050
|
checkoutEveryNth,
|
|
14093
|
-
checkoutEveryEvc,
|
|
14094
14051
|
blockClass = "rr-block",
|
|
14095
14052
|
blockSelector = null,
|
|
14096
14053
|
ignoreClass = "rr-ignore",
|
|
14097
14054
|
ignoreSelector = null,
|
|
14098
|
-
|
|
14055
|
+
excludeAttribute: _excludeAttribute,
|
|
14056
|
+
includeAttribute: _includeAttribute,
|
|
14099
14057
|
maskTextClass = "rr-mask",
|
|
14100
14058
|
maskTextSelector = null,
|
|
14101
14059
|
inlineStylesheet = true,
|
|
@@ -14113,6 +14071,7 @@ function record(options = {}) {
|
|
|
14113
14071
|
recordCanvas = false,
|
|
14114
14072
|
recordCrossOriginIframes = false,
|
|
14115
14073
|
recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
|
|
14074
|
+
flushCustomQueue = options.flushCustomQueue !== void 0 ? options.flushCustomQueue : "after",
|
|
14116
14075
|
userTriggeredOnInput = false,
|
|
14117
14076
|
collectFonts = false,
|
|
14118
14077
|
inlineImages = false,
|
|
@@ -14144,6 +14103,8 @@ function record(options = {}) {
|
|
|
14144
14103
|
sampling.mousemove = mousemoveWait;
|
|
14145
14104
|
}
|
|
14146
14105
|
mirror.reset();
|
|
14106
|
+
const excludeAttribute = _excludeAttribute === void 0 ? /^$a/ : _excludeAttribute;
|
|
14107
|
+
const includeAttribute = _includeAttribute === void 0 ? /.+/i : _includeAttribute;
|
|
14147
14108
|
const maskInputOptions = maskAllInputs === true ? {
|
|
14148
14109
|
color: true,
|
|
14149
14110
|
date: true,
|
|
@@ -14220,8 +14181,7 @@ function record(options = {}) {
|
|
|
14220
14181
|
incrementalSnapshotCount++;
|
|
14221
14182
|
const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
14222
14183
|
const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
14223
|
-
|
|
14224
|
-
if (exceedCount || exceedTime || isVisibilityChanged) {
|
|
14184
|
+
if (exceedCount || exceedTime) {
|
|
14225
14185
|
takeFullSnapshot$1(true);
|
|
14226
14186
|
}
|
|
14227
14187
|
}
|
|
@@ -14294,7 +14254,8 @@ function record(options = {}) {
|
|
|
14294
14254
|
blockSelector,
|
|
14295
14255
|
maskTextClass,
|
|
14296
14256
|
maskTextSelector,
|
|
14297
|
-
|
|
14257
|
+
excludeAttribute,
|
|
14258
|
+
includeAttribute,
|
|
14298
14259
|
inlineStylesheet,
|
|
14299
14260
|
maskInputOptions,
|
|
14300
14261
|
dataURLOptions,
|
|
@@ -14336,7 +14297,8 @@ function record(options = {}) {
|
|
|
14336
14297
|
blockSelector,
|
|
14337
14298
|
maskTextClass,
|
|
14338
14299
|
maskTextSelector,
|
|
14339
|
-
|
|
14300
|
+
excludeAttribute,
|
|
14301
|
+
includeAttribute,
|
|
14340
14302
|
inlineStylesheet,
|
|
14341
14303
|
maskAllInputs: maskInputOptions,
|
|
14342
14304
|
maskTextFn,
|
|
@@ -14392,15 +14354,6 @@ function record(options = {}) {
|
|
|
14392
14354
|
return callbackWrapper(initObservers)(
|
|
14393
14355
|
{
|
|
14394
14356
|
mutationCb: wrappedMutationEmit,
|
|
14395
|
-
visibilityChangeCb: (v2) => {
|
|
14396
|
-
wrappedEmit({
|
|
14397
|
-
type: EventType.IncrementalSnapshot,
|
|
14398
|
-
data: {
|
|
14399
|
-
source: IncrementalSource.VisibilityChange,
|
|
14400
|
-
...v2
|
|
14401
|
-
}
|
|
14402
|
-
});
|
|
14403
|
-
},
|
|
14404
14357
|
mousemoveCb: (positions, source) => wrappedEmit({
|
|
14405
14358
|
type: EventType.IncrementalSnapshot,
|
|
14406
14359
|
data: {
|
|
@@ -14482,7 +14435,8 @@ function record(options = {}) {
|
|
|
14482
14435
|
ignoreSelector,
|
|
14483
14436
|
maskTextClass,
|
|
14484
14437
|
maskTextSelector,
|
|
14485
|
-
|
|
14438
|
+
excludeAttribute,
|
|
14439
|
+
includeAttribute,
|
|
14486
14440
|
maskInputOptions,
|
|
14487
14441
|
inlineStylesheet,
|
|
14488
14442
|
sampling,
|
|
@@ -14528,9 +14482,15 @@ function record(options = {}) {
|
|
|
14528
14482
|
}
|
|
14529
14483
|
});
|
|
14530
14484
|
const init = () => {
|
|
14485
|
+
if (flushCustomQueue === "before") {
|
|
14486
|
+
flushPreRecordingEvents();
|
|
14487
|
+
}
|
|
14531
14488
|
takeFullSnapshot$1();
|
|
14532
14489
|
handlers.push(observe(document));
|
|
14533
14490
|
recording = true;
|
|
14491
|
+
if (flushCustomQueue === "after") {
|
|
14492
|
+
flushPreRecordingEvents();
|
|
14493
|
+
}
|
|
14534
14494
|
};
|
|
14535
14495
|
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
14536
14496
|
init();
|
|
@@ -14559,6 +14519,7 @@ function record(options = {}) {
|
|
|
14559
14519
|
);
|
|
14560
14520
|
}
|
|
14561
14521
|
return () => {
|
|
14522
|
+
flushPreRecordingEvents();
|
|
14562
14523
|
handlers.forEach((h) => h());
|
|
14563
14524
|
processedNodeManager.destroy();
|
|
14564
14525
|
recording = false;
|
|
@@ -14568,17 +14529,26 @@ function record(options = {}) {
|
|
|
14568
14529
|
console.warn(error);
|
|
14569
14530
|
}
|
|
14570
14531
|
}
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14532
|
+
function flushPreRecordingEvents() {
|
|
14533
|
+
for (const e2 of preRecordingCustomEvents) {
|
|
14534
|
+
wrappedEmit(e2);
|
|
14574
14535
|
}
|
|
14575
|
-
|
|
14536
|
+
preRecordingCustomEvents.length = 0;
|
|
14537
|
+
}
|
|
14538
|
+
record.addCustomEvent = (tag, payload) => {
|
|
14539
|
+
const customEvent = {
|
|
14576
14540
|
type: EventType.Custom,
|
|
14577
14541
|
data: {
|
|
14578
14542
|
tag,
|
|
14579
14543
|
payload
|
|
14580
14544
|
}
|
|
14581
|
-
}
|
|
14545
|
+
};
|
|
14546
|
+
if (!recording) {
|
|
14547
|
+
console.warn(`[rrweb] CustomEvent buffered before recording start: ${tag}`);
|
|
14548
|
+
preRecordingCustomEvents.push(customEvent);
|
|
14549
|
+
return;
|
|
14550
|
+
}
|
|
14551
|
+
wrappedEmit(customEvent);
|
|
14582
14552
|
};
|
|
14583
14553
|
record.freezePage = () => {
|
|
14584
14554
|
mutationBuffers.forEach((buf) => buf.freeze());
|