@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
package/dist/rrweb-player.cjs
CHANGED
|
@@ -5560,8 +5560,10 @@ function serializeNodeWithId(n2, options) {
|
|
|
5560
5560
|
onSerialize(n2);
|
|
5561
5561
|
}
|
|
5562
5562
|
let recordChild = !skipChild;
|
|
5563
|
+
let isBlockedElement = false;
|
|
5563
5564
|
if (serializedNode.type === NodeType$3.Element) {
|
|
5564
|
-
|
|
5565
|
+
isBlockedElement = Boolean(serializedNode.needBlock);
|
|
5566
|
+
recordChild = recordChild && !isBlockedElement;
|
|
5565
5567
|
delete serializedNode.needBlock;
|
|
5566
5568
|
const shadowRootEl = index$1.shadowRoot(n2);
|
|
5567
5569
|
if (shadowRootEl && isNativeShadowDom(shadowRootEl)) {
|
|
@@ -5646,7 +5648,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
5646
5648
|
if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
|
|
5647
5649
|
serializedNode.isShadow = true;
|
|
5648
5650
|
}
|
|
5649
|
-
if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {
|
|
5651
|
+
if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe" && !isBlockedElement) {
|
|
5650
5652
|
onceIframeLoaded(
|
|
5651
5653
|
n2,
|
|
5652
5654
|
() => {
|
|
@@ -5673,6 +5675,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
5673
5675
|
preserveWhiteSpace,
|
|
5674
5676
|
onSerialize,
|
|
5675
5677
|
onAdoptedStyleSheet,
|
|
5678
|
+
_emittedStyleIds: emittedStyleIds,
|
|
5676
5679
|
onIframeLoad,
|
|
5677
5680
|
iframeLoadTimeout,
|
|
5678
5681
|
onStylesheetLoad,
|
|
@@ -5753,6 +5756,7 @@ function snapshot(n2, options) {
|
|
|
5753
5756
|
preserveWhiteSpace,
|
|
5754
5757
|
onSerialize,
|
|
5755
5758
|
onAdoptedStyleSheet,
|
|
5759
|
+
_emittedStyleIds,
|
|
5756
5760
|
onIframeLoad,
|
|
5757
5761
|
iframeLoadTimeout,
|
|
5758
5762
|
onStylesheetLoad,
|
|
@@ -5816,6 +5820,7 @@ function snapshot(n2, options) {
|
|
|
5816
5820
|
preserveWhiteSpace,
|
|
5817
5821
|
onSerialize,
|
|
5818
5822
|
onAdoptedStyleSheet,
|
|
5823
|
+
_emittedStyleIds,
|
|
5819
5824
|
onIframeLoad,
|
|
5820
5825
|
iframeLoadTimeout,
|
|
5821
5826
|
onStylesheetLoad,
|
|
@@ -17362,9 +17367,7 @@ class Replayer {
|
|
|
17362
17367
|
this.adoptedStyleSheets = [];
|
|
17363
17368
|
this.snapshotAdoptedStyleSheetQueue.forEach(
|
|
17364
17369
|
({ id, adoptedStyleSheets }) => {
|
|
17365
|
-
|
|
17366
|
-
if (node2)
|
|
17367
|
-
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
17370
|
+
this.applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets);
|
|
17368
17371
|
}
|
|
17369
17372
|
);
|
|
17370
17373
|
this.snapshotAdoptedStyleSheetQueue = [];
|
|
@@ -18416,8 +18419,22 @@ class Replayer {
|
|
|
18416
18419
|
return;
|
|
18417
18420
|
}
|
|
18418
18421
|
const afterAppend = (node2, id) => {
|
|
18422
|
+
const inlineAdoptedStyleSheets = this.inlineAdoptedStyleSheetsFromMutationNode(mutation.node, node2);
|
|
18423
|
+
if (inlineAdoptedStyleSheets && this.usingVirtualDom) {
|
|
18424
|
+
this.snapshotAdoptedStyleSheetQueue.push({
|
|
18425
|
+
id,
|
|
18426
|
+
adoptedStyleSheets: inlineAdoptedStyleSheets
|
|
18427
|
+
});
|
|
18428
|
+
}
|
|
18419
18429
|
if (this.usingVirtualDom) return;
|
|
18420
18430
|
applyDialogToTopLevel(node2);
|
|
18431
|
+
if (inlineAdoptedStyleSheets) {
|
|
18432
|
+
this.ensureShadowHostForInlineAdoptedStyles(mutation.node, node2);
|
|
18433
|
+
this.applySnapshotAdoptedStyleSheets(
|
|
18434
|
+
node2,
|
|
18435
|
+
inlineAdoptedStyleSheets
|
|
18436
|
+
);
|
|
18437
|
+
}
|
|
18421
18438
|
for (const plugin of this.config.plugins || []) {
|
|
18422
18439
|
if (plugin.onBuild) plugin.onBuild(node2, { id, replayer: this });
|
|
18423
18440
|
}
|
|
@@ -18535,6 +18552,22 @@ class Replayer {
|
|
|
18535
18552
|
}
|
|
18536
18553
|
}
|
|
18537
18554
|
if (queue.length === pendingCount) {
|
|
18555
|
+
const queuedIds = new Set(queue.map((m) => m.node.id));
|
|
18556
|
+
let salvaged = 0;
|
|
18557
|
+
for (let i2 = 0; i2 < queue.length; i2++) {
|
|
18558
|
+
const m = queue[i2];
|
|
18559
|
+
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)) {
|
|
18560
|
+
queue[i2] = { ...m, nextId: null };
|
|
18561
|
+
salvaged++;
|
|
18562
|
+
}
|
|
18563
|
+
}
|
|
18564
|
+
if (salvaged) {
|
|
18565
|
+
this.warn(
|
|
18566
|
+
"Inserting nodes without their next sibling since it was never recorded",
|
|
18567
|
+
salvaged
|
|
18568
|
+
);
|
|
18569
|
+
continue;
|
|
18570
|
+
}
|
|
18538
18571
|
this.warn(
|
|
18539
18572
|
"Dropping the resolve queue since none of the remaining nodes can be resolved",
|
|
18540
18573
|
resolveTrees.map((tree) => ({
|
|
@@ -18805,6 +18838,39 @@ class Replayer {
|
|
|
18805
18838
|
rule2.style.removeProperty(data.remove.property);
|
|
18806
18839
|
}
|
|
18807
18840
|
}
|
|
18841
|
+
applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets) {
|
|
18842
|
+
const node2 = this.mirror.getNode(id);
|
|
18843
|
+
if (!node2) return;
|
|
18844
|
+
const meta = this.mirror.getMeta(node2);
|
|
18845
|
+
if ((meta == null ? void 0 : meta.type) === NodeType.Element && meta.isShadowHost && node2.nodeType === Node.ELEMENT_NODE && !hasShadowRoot(node2)) {
|
|
18846
|
+
node2.attachShadow({ mode: "open" });
|
|
18847
|
+
}
|
|
18848
|
+
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
18849
|
+
}
|
|
18850
|
+
inlineAdoptedStyleSheetsFromMutationNode(mutationNode, builtNode) {
|
|
18851
|
+
var _a22;
|
|
18852
|
+
if (!("adoptedStyleSheets" in mutationNode) || !((_a22 = mutationNode.adoptedStyleSheets) == null ? void 0 : _a22.length)) {
|
|
18853
|
+
return null;
|
|
18854
|
+
}
|
|
18855
|
+
if (mutationNode.type === NodeType.Document) {
|
|
18856
|
+
return mutationNode.adoptedStyleSheets;
|
|
18857
|
+
}
|
|
18858
|
+
if (mutationNode.type === NodeType.Element && mutationNode.isShadowHost) {
|
|
18859
|
+
return mutationNode.adoptedStyleSheets;
|
|
18860
|
+
}
|
|
18861
|
+
if (hasShadowRoot(builtNode)) {
|
|
18862
|
+
return mutationNode.adoptedStyleSheets;
|
|
18863
|
+
}
|
|
18864
|
+
return null;
|
|
18865
|
+
}
|
|
18866
|
+
ensureShadowHostForInlineAdoptedStyles(mutationNode, builtNode) {
|
|
18867
|
+
if (mutationNode.type !== NodeType.Element || !mutationNode.isShadowHost) {
|
|
18868
|
+
return;
|
|
18869
|
+
}
|
|
18870
|
+
const el = builtNode;
|
|
18871
|
+
if (el.nodeType !== Node.ELEMENT_NODE || hasShadowRoot(el)) return;
|
|
18872
|
+
el.attachShadow({ mode: "open" });
|
|
18873
|
+
}
|
|
18808
18874
|
applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets) {
|
|
18809
18875
|
var _a22;
|
|
18810
18876
|
let hostWindow = null;
|