@amplitude/rrweb-player 2.1.4 → 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 +51 -3
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +51 -3
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +51 -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.js
CHANGED
|
@@ -5671,6 +5671,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
5671
5671
|
preserveWhiteSpace,
|
|
5672
5672
|
onSerialize,
|
|
5673
5673
|
onAdoptedStyleSheet,
|
|
5674
|
+
_emittedStyleIds: emittedStyleIds,
|
|
5674
5675
|
onIframeLoad,
|
|
5675
5676
|
iframeLoadTimeout,
|
|
5676
5677
|
onStylesheetLoad,
|
|
@@ -5751,6 +5752,7 @@ function snapshot(n2, options) {
|
|
|
5751
5752
|
preserveWhiteSpace,
|
|
5752
5753
|
onSerialize,
|
|
5753
5754
|
onAdoptedStyleSheet,
|
|
5755
|
+
_emittedStyleIds,
|
|
5754
5756
|
onIframeLoad,
|
|
5755
5757
|
iframeLoadTimeout,
|
|
5756
5758
|
onStylesheetLoad,
|
|
@@ -5814,6 +5816,7 @@ function snapshot(n2, options) {
|
|
|
5814
5816
|
preserveWhiteSpace,
|
|
5815
5817
|
onSerialize,
|
|
5816
5818
|
onAdoptedStyleSheet,
|
|
5819
|
+
_emittedStyleIds,
|
|
5817
5820
|
onIframeLoad,
|
|
5818
5821
|
iframeLoadTimeout,
|
|
5819
5822
|
onStylesheetLoad,
|
|
@@ -17360,9 +17363,7 @@ class Replayer {
|
|
|
17360
17363
|
this.adoptedStyleSheets = [];
|
|
17361
17364
|
this.snapshotAdoptedStyleSheetQueue.forEach(
|
|
17362
17365
|
({ id, adoptedStyleSheets }) => {
|
|
17363
|
-
|
|
17364
|
-
if (node2)
|
|
17365
|
-
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
17366
|
+
this.applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets);
|
|
17366
17367
|
}
|
|
17367
17368
|
);
|
|
17368
17369
|
this.snapshotAdoptedStyleSheetQueue = [];
|
|
@@ -18414,8 +18415,22 @@ class Replayer {
|
|
|
18414
18415
|
return;
|
|
18415
18416
|
}
|
|
18416
18417
|
const afterAppend = (node2, id) => {
|
|
18418
|
+
const inlineAdoptedStyleSheets = this.inlineAdoptedStyleSheetsFromMutationNode(mutation.node, node2);
|
|
18419
|
+
if (inlineAdoptedStyleSheets && this.usingVirtualDom) {
|
|
18420
|
+
this.snapshotAdoptedStyleSheetQueue.push({
|
|
18421
|
+
id,
|
|
18422
|
+
adoptedStyleSheets: inlineAdoptedStyleSheets
|
|
18423
|
+
});
|
|
18424
|
+
}
|
|
18417
18425
|
if (this.usingVirtualDom) return;
|
|
18418
18426
|
applyDialogToTopLevel(node2);
|
|
18427
|
+
if (inlineAdoptedStyleSheets) {
|
|
18428
|
+
this.ensureShadowHostForInlineAdoptedStyles(mutation.node, node2);
|
|
18429
|
+
this.applySnapshotAdoptedStyleSheets(
|
|
18430
|
+
node2,
|
|
18431
|
+
inlineAdoptedStyleSheets
|
|
18432
|
+
);
|
|
18433
|
+
}
|
|
18419
18434
|
for (const plugin of this.config.plugins || []) {
|
|
18420
18435
|
if (plugin.onBuild) plugin.onBuild(node2, { id, replayer: this });
|
|
18421
18436
|
}
|
|
@@ -18803,6 +18818,39 @@ class Replayer {
|
|
|
18803
18818
|
rule2.style.removeProperty(data.remove.property);
|
|
18804
18819
|
}
|
|
18805
18820
|
}
|
|
18821
|
+
applyQueuedSnapshotAdoptedStyleSheets(id, adoptedStyleSheets) {
|
|
18822
|
+
const node2 = this.mirror.getNode(id);
|
|
18823
|
+
if (!node2) return;
|
|
18824
|
+
const meta = this.mirror.getMeta(node2);
|
|
18825
|
+
if ((meta == null ? void 0 : meta.type) === NodeType.Element && meta.isShadowHost && node2.nodeType === Node.ELEMENT_NODE && !hasShadowRoot(node2)) {
|
|
18826
|
+
node2.attachShadow({ mode: "open" });
|
|
18827
|
+
}
|
|
18828
|
+
this.applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets);
|
|
18829
|
+
}
|
|
18830
|
+
inlineAdoptedStyleSheetsFromMutationNode(mutationNode, builtNode) {
|
|
18831
|
+
var _a22;
|
|
18832
|
+
if (!("adoptedStyleSheets" in mutationNode) || !((_a22 = mutationNode.adoptedStyleSheets) == null ? void 0 : _a22.length)) {
|
|
18833
|
+
return null;
|
|
18834
|
+
}
|
|
18835
|
+
if (mutationNode.type === NodeType.Document) {
|
|
18836
|
+
return mutationNode.adoptedStyleSheets;
|
|
18837
|
+
}
|
|
18838
|
+
if (mutationNode.type === NodeType.Element && mutationNode.isShadowHost) {
|
|
18839
|
+
return mutationNode.adoptedStyleSheets;
|
|
18840
|
+
}
|
|
18841
|
+
if (hasShadowRoot(builtNode)) {
|
|
18842
|
+
return mutationNode.adoptedStyleSheets;
|
|
18843
|
+
}
|
|
18844
|
+
return null;
|
|
18845
|
+
}
|
|
18846
|
+
ensureShadowHostForInlineAdoptedStyles(mutationNode, builtNode) {
|
|
18847
|
+
if (mutationNode.type !== NodeType.Element || !mutationNode.isShadowHost) {
|
|
18848
|
+
return;
|
|
18849
|
+
}
|
|
18850
|
+
const el = builtNode;
|
|
18851
|
+
if (el.nodeType !== Node.ELEMENT_NODE || hasShadowRoot(el)) return;
|
|
18852
|
+
el.attachShadow({ mode: "open" });
|
|
18853
|
+
}
|
|
18806
18854
|
applySnapshotAdoptedStyleSheets(node2, adoptedStyleSheets) {
|
|
18807
18855
|
var _a22;
|
|
18808
18856
|
let hostWindow = null;
|