@amplitude/rrweb-player 2.1.3 → 2.1.5
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 +64 -3
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +64 -3
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +64 -3
- package/dist/rrweb-player.umd.cjs.map +2 -2
- package/dist/rrweb-player.umd.min.cjs +24 -24
- package/dist/rrweb-player.umd.min.cjs.map +3 -3
- package/package.json +6 -6
package/dist/rrweb-player.cjs
CHANGED
|
@@ -5673,6 +5673,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
5673
5673
|
preserveWhiteSpace,
|
|
5674
5674
|
onSerialize,
|
|
5675
5675
|
onAdoptedStyleSheet,
|
|
5676
|
+
_emittedStyleIds: emittedStyleIds,
|
|
5676
5677
|
onIframeLoad,
|
|
5677
5678
|
iframeLoadTimeout,
|
|
5678
5679
|
onStylesheetLoad,
|
|
@@ -5753,6 +5754,7 @@ function snapshot(n2, options) {
|
|
|
5753
5754
|
preserveWhiteSpace,
|
|
5754
5755
|
onSerialize,
|
|
5755
5756
|
onAdoptedStyleSheet,
|
|
5757
|
+
_emittedStyleIds,
|
|
5756
5758
|
onIframeLoad,
|
|
5757
5759
|
iframeLoadTimeout,
|
|
5758
5760
|
onStylesheetLoad,
|
|
@@ -5816,6 +5818,7 @@ function snapshot(n2, options) {
|
|
|
5816
5818
|
preserveWhiteSpace,
|
|
5817
5819
|
onSerialize,
|
|
5818
5820
|
onAdoptedStyleSheet,
|
|
5821
|
+
_emittedStyleIds,
|
|
5819
5822
|
onIframeLoad,
|
|
5820
5823
|
iframeLoadTimeout,
|
|
5821
5824
|
onStylesheetLoad,
|
|
@@ -17362,9 +17365,7 @@ class Replayer {
|
|
|
17362
17365
|
this.adoptedStyleSheets = [];
|
|
17363
17366
|
this.snapshotAdoptedStyleSheetQueue.forEach(
|
|
17364
17367
|
({ id, adoptedStyleSheets }) => {
|
|
17365
|
-
|
|
17366
|
-
if (node2)
|
|
17367
|
-
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
17368
|
+
this.applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets);
|
|
17368
17369
|
}
|
|
17369
17370
|
);
|
|
17370
17371
|
this.snapshotAdoptedStyleSheetQueue = [];
|
|
@@ -18416,8 +18417,22 @@ class Replayer {
|
|
|
18416
18417
|
return;
|
|
18417
18418
|
}
|
|
18418
18419
|
const afterAppend = (node2, id) => {
|
|
18420
|
+
const inlineAdoptedStyleSheets = this.inlineAdoptedStyleSheetsFromMutationNode(mutation.node, node2);
|
|
18421
|
+
if (inlineAdoptedStyleSheets && this.usingVirtualDom) {
|
|
18422
|
+
this.snapshotAdoptedStyleSheetQueue.push({
|
|
18423
|
+
id,
|
|
18424
|
+
adoptedStyleSheets: inlineAdoptedStyleSheets
|
|
18425
|
+
});
|
|
18426
|
+
}
|
|
18419
18427
|
if (this.usingVirtualDom) return;
|
|
18420
18428
|
applyDialogToTopLevel(node2);
|
|
18429
|
+
if (inlineAdoptedStyleSheets) {
|
|
18430
|
+
this.ensureShadowHostForInlineAdoptedStyles(mutation.node, node2);
|
|
18431
|
+
this.applySnapshotAdoptedStyleSheets(
|
|
18432
|
+
node2,
|
|
18433
|
+
inlineAdoptedStyleSheets
|
|
18434
|
+
);
|
|
18435
|
+
}
|
|
18421
18436
|
for (const plugin of this.config.plugins || []) {
|
|
18422
18437
|
if (plugin.onBuild) plugin.onBuild(node2, { id, replayer: this });
|
|
18423
18438
|
}
|
|
@@ -18511,6 +18526,7 @@ class Replayer {
|
|
|
18511
18526
|
});
|
|
18512
18527
|
const startTime = Date.now();
|
|
18513
18528
|
while (queue.length) {
|
|
18529
|
+
const pendingCount = queue.length;
|
|
18514
18530
|
const resolveTrees = queueToResolveTrees(queue);
|
|
18515
18531
|
queue.length = 0;
|
|
18516
18532
|
if (Date.now() - startTime > 500) {
|
|
@@ -18533,6 +18549,18 @@ class Replayer {
|
|
|
18533
18549
|
});
|
|
18534
18550
|
}
|
|
18535
18551
|
}
|
|
18552
|
+
if (queue.length === pendingCount) {
|
|
18553
|
+
this.warn(
|
|
18554
|
+
"Dropping the resolve queue since none of the remaining nodes can be resolved",
|
|
18555
|
+
resolveTrees.map((tree) => ({
|
|
18556
|
+
id: tree.value.node.id,
|
|
18557
|
+
parentId: tree.value.parentId,
|
|
18558
|
+
nextId: tree.value.nextId,
|
|
18559
|
+
children: tree.children.length
|
|
18560
|
+
}))
|
|
18561
|
+
);
|
|
18562
|
+
break;
|
|
18563
|
+
}
|
|
18536
18564
|
}
|
|
18537
18565
|
if (Object.keys(legacy_missingNodeMap).length) {
|
|
18538
18566
|
Object.assign(this.legacy_missingNodeRetryMap, legacy_missingNodeMap);
|
|
@@ -18792,6 +18820,39 @@ class Replayer {
|
|
|
18792
18820
|
rule2.style.removeProperty(data.remove.property);
|
|
18793
18821
|
}
|
|
18794
18822
|
}
|
|
18823
|
+
applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets) {
|
|
18824
|
+
const node2 = this.mirror.getNode(id);
|
|
18825
|
+
if (!node2) return;
|
|
18826
|
+
const meta = this.mirror.getMeta(node2);
|
|
18827
|
+
if ((meta == null ? void 0 : meta.type) === NodeType.Element && meta.isShadowHost && node2.nodeType === Node.ELEMENT_NODE && !hasShadowRoot(node2)) {
|
|
18828
|
+
node2.attachShadow({ mode: "open" });
|
|
18829
|
+
}
|
|
18830
|
+
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
18831
|
+
}
|
|
18832
|
+
inlineAdoptedStyleSheetsFromMutationNode(mutationNode, builtNode) {
|
|
18833
|
+
var _a22;
|
|
18834
|
+
if (!("adoptedStyleSheets" in mutationNode) || !((_a22 = mutationNode.adoptedStyleSheets) == null ? void 0 : _a22.length)) {
|
|
18835
|
+
return null;
|
|
18836
|
+
}
|
|
18837
|
+
if (mutationNode.type === NodeType.Document) {
|
|
18838
|
+
return mutationNode.adoptedStyleSheets;
|
|
18839
|
+
}
|
|
18840
|
+
if (mutationNode.type === NodeType.Element && mutationNode.isShadowHost) {
|
|
18841
|
+
return mutationNode.adoptedStyleSheets;
|
|
18842
|
+
}
|
|
18843
|
+
if (hasShadowRoot(builtNode)) {
|
|
18844
|
+
return mutationNode.adoptedStyleSheets;
|
|
18845
|
+
}
|
|
18846
|
+
return null;
|
|
18847
|
+
}
|
|
18848
|
+
ensureShadowHostForInlineAdoptedStyles(mutationNode, builtNode) {
|
|
18849
|
+
if (mutationNode.type !== NodeType.Element || !mutationNode.isShadowHost) {
|
|
18850
|
+
return;
|
|
18851
|
+
}
|
|
18852
|
+
const el = builtNode;
|
|
18853
|
+
if (el.nodeType !== Node.ELEMENT_NODE || hasShadowRoot(el)) return;
|
|
18854
|
+
el.attachShadow({ mode: "open" });
|
|
18855
|
+
}
|
|
18795
18856
|
applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets) {
|
|
18796
18857
|
var _a22;
|
|
18797
18858
|
let hostWindow = null;
|