@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
|
@@ -5667,6 +5667,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
5667
5667
|
preserveWhiteSpace,
|
|
5668
5668
|
onSerialize,
|
|
5669
5669
|
onAdoptedStyleSheet,
|
|
5670
|
+
_emittedStyleIds: emittedStyleIds,
|
|
5670
5671
|
onIframeLoad,
|
|
5671
5672
|
iframeLoadTimeout,
|
|
5672
5673
|
onStylesheetLoad,
|
|
@@ -5747,6 +5748,7 @@ function snapshot(n2, options) {
|
|
|
5747
5748
|
preserveWhiteSpace,
|
|
5748
5749
|
onSerialize,
|
|
5749
5750
|
onAdoptedStyleSheet,
|
|
5751
|
+
_emittedStyleIds,
|
|
5750
5752
|
onIframeLoad,
|
|
5751
5753
|
iframeLoadTimeout,
|
|
5752
5754
|
onStylesheetLoad,
|
|
@@ -5810,6 +5812,7 @@ function snapshot(n2, options) {
|
|
|
5810
5812
|
preserveWhiteSpace,
|
|
5811
5813
|
onSerialize,
|
|
5812
5814
|
onAdoptedStyleSheet,
|
|
5815
|
+
_emittedStyleIds,
|
|
5813
5816
|
onIframeLoad,
|
|
5814
5817
|
iframeLoadTimeout,
|
|
5815
5818
|
onStylesheetLoad,
|
|
@@ -17356,9 +17359,7 @@ class Replayer {
|
|
|
17356
17359
|
this.adoptedStyleSheets = [];
|
|
17357
17360
|
this.snapshotAdoptedStyleSheetQueue.forEach(
|
|
17358
17361
|
({ id, adoptedStyleSheets }) => {
|
|
17359
|
-
|
|
17360
|
-
if (node2)
|
|
17361
|
-
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
17362
|
+
this.applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets);
|
|
17362
17363
|
}
|
|
17363
17364
|
);
|
|
17364
17365
|
this.snapshotAdoptedStyleSheetQueue = [];
|
|
@@ -18410,8 +18411,22 @@ class Replayer {
|
|
|
18410
18411
|
return;
|
|
18411
18412
|
}
|
|
18412
18413
|
const afterAppend = (node2, id) => {
|
|
18414
|
+
const inlineAdoptedStyleSheets = this.inlineAdoptedStyleSheetsFromMutationNode(mutation.node, node2);
|
|
18415
|
+
if (inlineAdoptedStyleSheets && this.usingVirtualDom) {
|
|
18416
|
+
this.snapshotAdoptedStyleSheetQueue.push({
|
|
18417
|
+
id,
|
|
18418
|
+
adoptedStyleSheets: inlineAdoptedStyleSheets
|
|
18419
|
+
});
|
|
18420
|
+
}
|
|
18413
18421
|
if (this.usingVirtualDom) return;
|
|
18414
18422
|
applyDialogToTopLevel(node2);
|
|
18423
|
+
if (inlineAdoptedStyleSheets) {
|
|
18424
|
+
this.ensureShadowHostForInlineAdoptedStyles(mutation.node, node2);
|
|
18425
|
+
this.applySnapshotAdoptedStyleSheets(
|
|
18426
|
+
node2,
|
|
18427
|
+
inlineAdoptedStyleSheets
|
|
18428
|
+
);
|
|
18429
|
+
}
|
|
18415
18430
|
for (const plugin of this.config.plugins || []) {
|
|
18416
18431
|
if (plugin.onBuild) plugin.onBuild(node2, { id, replayer: this });
|
|
18417
18432
|
}
|
|
@@ -18505,6 +18520,7 @@ class Replayer {
|
|
|
18505
18520
|
});
|
|
18506
18521
|
const startTime = Date.now();
|
|
18507
18522
|
while (queue.length) {
|
|
18523
|
+
const pendingCount = queue.length;
|
|
18508
18524
|
const resolveTrees = queueToResolveTrees(queue);
|
|
18509
18525
|
queue.length = 0;
|
|
18510
18526
|
if (Date.now() - startTime > 500) {
|
|
@@ -18527,6 +18543,18 @@ class Replayer {
|
|
|
18527
18543
|
});
|
|
18528
18544
|
}
|
|
18529
18545
|
}
|
|
18546
|
+
if (queue.length === pendingCount) {
|
|
18547
|
+
this.warn(
|
|
18548
|
+
"Dropping the resolve queue since none of the remaining nodes can be resolved",
|
|
18549
|
+
resolveTrees.map((tree) => ({
|
|
18550
|
+
id: tree.value.node.id,
|
|
18551
|
+
parentId: tree.value.parentId,
|
|
18552
|
+
nextId: tree.value.nextId,
|
|
18553
|
+
children: tree.children.length
|
|
18554
|
+
}))
|
|
18555
|
+
);
|
|
18556
|
+
break;
|
|
18557
|
+
}
|
|
18530
18558
|
}
|
|
18531
18559
|
if (Object.keys(legacy_missingNodeMap).length) {
|
|
18532
18560
|
Object.assign(this.legacy_missingNodeRetryMap, legacy_missingNodeMap);
|
|
@@ -18786,6 +18814,39 @@ class Replayer {
|
|
|
18786
18814
|
rule2.style.removeProperty(data.remove.property);
|
|
18787
18815
|
}
|
|
18788
18816
|
}
|
|
18817
|
+
applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets) {
|
|
18818
|
+
const node2 = this.mirror.getNode(id);
|
|
18819
|
+
if (!node2) return;
|
|
18820
|
+
const meta = this.mirror.getMeta(node2);
|
|
18821
|
+
if ((meta == null ? void 0 : meta.type) === NodeType.Element && meta.isShadowHost && node2.nodeType === Node.ELEMENT_NODE && !hasShadowRoot(node2)) {
|
|
18822
|
+
node2.attachShadow({ mode: "open" });
|
|
18823
|
+
}
|
|
18824
|
+
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
18825
|
+
}
|
|
18826
|
+
inlineAdoptedStyleSheetsFromMutationNode(mutationNode, builtNode) {
|
|
18827
|
+
var _a22;
|
|
18828
|
+
if (!("adoptedStyleSheets" in mutationNode) || !((_a22 = mutationNode.adoptedStyleSheets) == null ? void 0 : _a22.length)) {
|
|
18829
|
+
return null;
|
|
18830
|
+
}
|
|
18831
|
+
if (mutationNode.type === NodeType.Document) {
|
|
18832
|
+
return mutationNode.adoptedStyleSheets;
|
|
18833
|
+
}
|
|
18834
|
+
if (mutationNode.type === NodeType.Element && mutationNode.isShadowHost) {
|
|
18835
|
+
return mutationNode.adoptedStyleSheets;
|
|
18836
|
+
}
|
|
18837
|
+
if (hasShadowRoot(builtNode)) {
|
|
18838
|
+
return mutationNode.adoptedStyleSheets;
|
|
18839
|
+
}
|
|
18840
|
+
return null;
|
|
18841
|
+
}
|
|
18842
|
+
ensureShadowHostForInlineAdoptedStyles(mutationNode, builtNode) {
|
|
18843
|
+
if (mutationNode.type !== NodeType.Element || !mutationNode.isShadowHost) {
|
|
18844
|
+
return;
|
|
18845
|
+
}
|
|
18846
|
+
const el = builtNode;
|
|
18847
|
+
if (el.nodeType !== Node.ELEMENT_NODE || hasShadowRoot(el)) return;
|
|
18848
|
+
el.attachShadow({ mode: "open" });
|
|
18849
|
+
}
|
|
18789
18850
|
applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets) {
|
|
18790
18851
|
var _a22;
|
|
18791
18852
|
let hostWindow = null;
|