@amplitude/rrweb-player 2.1.4 → 2.1.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-player.cjs +71 -5
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +71 -5
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +71 -5
- package/dist/rrweb-player.umd.cjs.map +2 -2
- package/dist/rrweb-player.umd.min.cjs +46 -46
- package/dist/rrweb-player.umd.min.cjs.map +3 -3
- package/package.json +6 -6
|
@@ -5554,8 +5554,10 @@ function serializeNodeWithId(n2, options) {
|
|
|
5554
5554
|
onSerialize(n2);
|
|
5555
5555
|
}
|
|
5556
5556
|
let recordChild = !skipChild;
|
|
5557
|
+
let isBlockedElement = false;
|
|
5557
5558
|
if (serializedNode.type === NodeType$3.Element) {
|
|
5558
|
-
|
|
5559
|
+
isBlockedElement = Boolean(serializedNode.needBlock);
|
|
5560
|
+
recordChild = recordChild && !isBlockedElement;
|
|
5559
5561
|
delete serializedNode.needBlock;
|
|
5560
5562
|
const shadowRootEl = index$1.shadowRoot(n2);
|
|
5561
5563
|
if (shadowRootEl && isNativeShadowDom(shadowRootEl)) {
|
|
@@ -5640,7 +5642,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
5640
5642
|
if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
|
|
5641
5643
|
serializedNode.isShadow = true;
|
|
5642
5644
|
}
|
|
5643
|
-
if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {
|
|
5645
|
+
if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe" && !isBlockedElement) {
|
|
5644
5646
|
onceIframeLoaded(
|
|
5645
5647
|
n2,
|
|
5646
5648
|
() => {
|
|
@@ -5667,6 +5669,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
5667
5669
|
preserveWhiteSpace,
|
|
5668
5670
|
onSerialize,
|
|
5669
5671
|
onAdoptedStyleSheet,
|
|
5672
|
+
_emittedStyleIds: emittedStyleIds,
|
|
5670
5673
|
onIframeLoad,
|
|
5671
5674
|
iframeLoadTimeout,
|
|
5672
5675
|
onStylesheetLoad,
|
|
@@ -5747,6 +5750,7 @@ function snapshot(n2, options) {
|
|
|
5747
5750
|
preserveWhiteSpace,
|
|
5748
5751
|
onSerialize,
|
|
5749
5752
|
onAdoptedStyleSheet,
|
|
5753
|
+
_emittedStyleIds,
|
|
5750
5754
|
onIframeLoad,
|
|
5751
5755
|
iframeLoadTimeout,
|
|
5752
5756
|
onStylesheetLoad,
|
|
@@ -5810,6 +5814,7 @@ function snapshot(n2, options) {
|
|
|
5810
5814
|
preserveWhiteSpace,
|
|
5811
5815
|
onSerialize,
|
|
5812
5816
|
onAdoptedStyleSheet,
|
|
5817
|
+
_emittedStyleIds,
|
|
5813
5818
|
onIframeLoad,
|
|
5814
5819
|
iframeLoadTimeout,
|
|
5815
5820
|
onStylesheetLoad,
|
|
@@ -17356,9 +17361,7 @@ class Replayer {
|
|
|
17356
17361
|
this.adoptedStyleSheets = [];
|
|
17357
17362
|
this.snapshotAdoptedStyleSheetQueue.forEach(
|
|
17358
17363
|
({ id, adoptedStyleSheets }) => {
|
|
17359
|
-
|
|
17360
|
-
if (node2)
|
|
17361
|
-
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
17364
|
+
this.applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets);
|
|
17362
17365
|
}
|
|
17363
17366
|
);
|
|
17364
17367
|
this.snapshotAdoptedStyleSheetQueue = [];
|
|
@@ -18410,8 +18413,22 @@ class Replayer {
|
|
|
18410
18413
|
return;
|
|
18411
18414
|
}
|
|
18412
18415
|
const afterAppend = (node2, id) => {
|
|
18416
|
+
const inlineAdoptedStyleSheets = this.inlineAdoptedStyleSheetsFromMutationNode(mutation.node, node2);
|
|
18417
|
+
if (inlineAdoptedStyleSheets && this.usingVirtualDom) {
|
|
18418
|
+
this.snapshotAdoptedStyleSheetQueue.push({
|
|
18419
|
+
id,
|
|
18420
|
+
adoptedStyleSheets: inlineAdoptedStyleSheets
|
|
18421
|
+
});
|
|
18422
|
+
}
|
|
18413
18423
|
if (this.usingVirtualDom) return;
|
|
18414
18424
|
applyDialogToTopLevel(node2);
|
|
18425
|
+
if (inlineAdoptedStyleSheets) {
|
|
18426
|
+
this.ensureShadowHostForInlineAdoptedStyles(mutation.node, node2);
|
|
18427
|
+
this.applySnapshotAdoptedStyleSheets(
|
|
18428
|
+
node2,
|
|
18429
|
+
inlineAdoptedStyleSheets
|
|
18430
|
+
);
|
|
18431
|
+
}
|
|
18415
18432
|
for (const plugin of this.config.plugins || []) {
|
|
18416
18433
|
if (plugin.onBuild) plugin.onBuild(node2, { id, replayer: this });
|
|
18417
18434
|
}
|
|
@@ -18529,6 +18546,22 @@ class Replayer {
|
|
|
18529
18546
|
}
|
|
18530
18547
|
}
|
|
18531
18548
|
if (queue.length === pendingCount) {
|
|
18549
|
+
const queuedIds = new Set(queue.map((m) => m.node.id));
|
|
18550
|
+
let salvaged = 0;
|
|
18551
|
+
for (let i2 = 0; i2 < queue.length; i2++) {
|
|
18552
|
+
const m = queue[i2];
|
|
18553
|
+
if (!mirror2.getNode(m.node.id) && mirror2.getNode(m.parentId) && m.nextId !== null && m.nextId !== void 0 && m.nextId !== -1 && !mirror2.getNode(m.nextId) && !queuedIds.has(m.nextId)) {
|
|
18554
|
+
queue[i2] = __spreadProps(__spreadValues({}, m), { nextId: null });
|
|
18555
|
+
salvaged++;
|
|
18556
|
+
}
|
|
18557
|
+
}
|
|
18558
|
+
if (salvaged) {
|
|
18559
|
+
this.warn(
|
|
18560
|
+
"Inserting nodes without their next sibling since it was never recorded",
|
|
18561
|
+
salvaged
|
|
18562
|
+
);
|
|
18563
|
+
continue;
|
|
18564
|
+
}
|
|
18532
18565
|
this.warn(
|
|
18533
18566
|
"Dropping the resolve queue since none of the remaining nodes can be resolved",
|
|
18534
18567
|
resolveTrees.map((tree) => ({
|
|
@@ -18799,6 +18832,39 @@ class Replayer {
|
|
|
18799
18832
|
rule2.style.removeProperty(data.remove.property);
|
|
18800
18833
|
}
|
|
18801
18834
|
}
|
|
18835
|
+
applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets) {
|
|
18836
|
+
const node2 = this.mirror.getNode(id);
|
|
18837
|
+
if (!node2) return;
|
|
18838
|
+
const meta = this.mirror.getMeta(node2);
|
|
18839
|
+
if ((meta == null ? void 0 : meta.type) === NodeType.Element && meta.isShadowHost && node2.nodeType === Node.ELEMENT_NODE && !hasShadowRoot(node2)) {
|
|
18840
|
+
node2.attachShadow({ mode: "open" });
|
|
18841
|
+
}
|
|
18842
|
+
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
18843
|
+
}
|
|
18844
|
+
inlineAdoptedStyleSheetsFromMutationNode(mutationNode, builtNode) {
|
|
18845
|
+
var _a22;
|
|
18846
|
+
if (!("adoptedStyleSheets" in mutationNode) || !((_a22 = mutationNode.adoptedStyleSheets) == null ? void 0 : _a22.length)) {
|
|
18847
|
+
return null;
|
|
18848
|
+
}
|
|
18849
|
+
if (mutationNode.type === NodeType.Document) {
|
|
18850
|
+
return mutationNode.adoptedStyleSheets;
|
|
18851
|
+
}
|
|
18852
|
+
if (mutationNode.type === NodeType.Element && mutationNode.isShadowHost) {
|
|
18853
|
+
return mutationNode.adoptedStyleSheets;
|
|
18854
|
+
}
|
|
18855
|
+
if (hasShadowRoot(builtNode)) {
|
|
18856
|
+
return mutationNode.adoptedStyleSheets;
|
|
18857
|
+
}
|
|
18858
|
+
return null;
|
|
18859
|
+
}
|
|
18860
|
+
ensureShadowHostForInlineAdoptedStyles(mutationNode, builtNode) {
|
|
18861
|
+
if (mutationNode.type !== NodeType.Element || !mutationNode.isShadowHost) {
|
|
18862
|
+
return;
|
|
18863
|
+
}
|
|
18864
|
+
const el = builtNode;
|
|
18865
|
+
if (el.nodeType !== Node.ELEMENT_NODE || hasShadowRoot(el)) return;
|
|
18866
|
+
el.attachShadow({ mode: "open" });
|
|
18867
|
+
}
|
|
18802
18868
|
applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets) {
|
|
18803
18869
|
var _a22;
|
|
18804
18870
|
let hostWindow = null;
|