@sentry/rrweb-player 2.45.0 → 2.46.2
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/events.js +1 -1
- package/dist/global.css +3 -2
- package/dist/rrweb-player.cjs +68 -49
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.d.cts +11 -11
- package/dist/rrweb-player.d.ts +11 -11
- package/dist/rrweb-player.js +68 -49
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +68 -49
- package/dist/rrweb-player.umd.cjs.map +3 -3
- package/dist/rrweb-player.umd.min.cjs +9 -9
- package/dist/rrweb-player.umd.min.cjs.map +4 -4
- package/dist/style.css +14 -6
- package/dist/style.min.css.map +2 -2
- package/package.json +7 -10
|
@@ -4592,9 +4592,7 @@ var Mirror = class {
|
|
|
4592
4592
|
const id = this.getId(n2);
|
|
4593
4593
|
this.idNodeMap.delete(id);
|
|
4594
4594
|
if (n2.childNodes) {
|
|
4595
|
-
n2.childNodes.forEach(
|
|
4596
|
-
(childNode) => this.removeNodeFromMap(childNode)
|
|
4597
|
-
);
|
|
4595
|
+
n2.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode));
|
|
4598
4596
|
}
|
|
4599
4597
|
if (isElement$1(n2) && n2.shadowRoot) {
|
|
4600
4598
|
this.removeNodeFromMap(n2.shadowRoot);
|
|
@@ -5404,6 +5402,9 @@ function buildNodeWithSN(n2, options) {
|
|
|
5404
5402
|
if (n2.type === NodeType$2.Document) {
|
|
5405
5403
|
doc.close();
|
|
5406
5404
|
doc.open();
|
|
5405
|
+
while (doc.firstChild) {
|
|
5406
|
+
doc.removeChild(doc.firstChild);
|
|
5407
|
+
}
|
|
5407
5408
|
if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$2.DocumentType) {
|
|
5408
5409
|
if (n2.childNodes[0].type === NodeType$2.Element && "xmlns" in n2.childNodes[0].attributes && n2.childNodes[0].attributes.xmlns === "http://www.w3.org/1999/xhtml") {
|
|
5409
5410
|
doc.write(
|
|
@@ -5889,9 +5890,7 @@ var Mirror$1 = class Mirror2 {
|
|
|
5889
5890
|
const id = this.getId(n2);
|
|
5890
5891
|
this.idNodeMap.delete(id);
|
|
5891
5892
|
if (n2.childNodes) {
|
|
5892
|
-
n2.childNodes.forEach(
|
|
5893
|
-
(childNode) => this.removeNodeFromMap(childNode)
|
|
5894
|
-
);
|
|
5893
|
+
n2.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode));
|
|
5895
5894
|
}
|
|
5896
5895
|
if (isElement(n2) && n2.shadowRoot) {
|
|
5897
5896
|
this.removeNodeFromMap(n2.shadowRoot);
|
|
@@ -6176,12 +6175,9 @@ var BaseRRElement = class extends BaseRRNode {
|
|
|
6176
6175
|
this.appendChild(this.ownerDocument.createTextNode(textContent));
|
|
6177
6176
|
}
|
|
6178
6177
|
get classList() {
|
|
6179
|
-
return new ClassList(
|
|
6180
|
-
this.attributes.class
|
|
6181
|
-
|
|
6182
|
-
this.attributes.class = newClassName;
|
|
6183
|
-
}
|
|
6184
|
-
);
|
|
6178
|
+
return new ClassList(this.attributes.class, (newClassName) => {
|
|
6179
|
+
this.attributes.class = newClassName;
|
|
6180
|
+
});
|
|
6185
6181
|
}
|
|
6186
6182
|
get id() {
|
|
6187
6183
|
return this.attributes.id || "";
|
|
@@ -8131,6 +8127,7 @@ var Replayer = class {
|
|
|
8131
8127
|
this.canvasEventMap = /* @__PURE__ */ new Map();
|
|
8132
8128
|
this.mirror = createMirror$2();
|
|
8133
8129
|
this.styleMirror = new StyleSheetMirror();
|
|
8130
|
+
this.pendingAdoptedStyles = /* @__PURE__ */ new Map();
|
|
8134
8131
|
this.firstFullSnapshot = null;
|
|
8135
8132
|
this.newDocumentQueue = [];
|
|
8136
8133
|
this.pointers = {};
|
|
@@ -8198,6 +8195,7 @@ var Replayer = class {
|
|
|
8198
8195
|
this.rebuildFullSnapshot(event, isSync);
|
|
8199
8196
|
this.iframe.contentWindow?.scrollTo(event.data.initialOffset);
|
|
8200
8197
|
this.styleMirror.reset();
|
|
8198
|
+
this.pendingAdoptedStyles.clear();
|
|
8201
8199
|
};
|
|
8202
8200
|
break;
|
|
8203
8201
|
case EventType$1.IncrementalSnapshot:
|
|
@@ -8307,10 +8305,10 @@ var Replayer = class {
|
|
|
8307
8305
|
if (this.usingVirtualDom) {
|
|
8308
8306
|
const replayerHandler = {
|
|
8309
8307
|
mirror: this.mirror,
|
|
8310
|
-
applyCanvas: (canvasEvent,
|
|
8308
|
+
applyCanvas: (canvasEvent, canvasMutationData, target) => {
|
|
8311
8309
|
void canvasMutation({
|
|
8312
8310
|
event: canvasEvent,
|
|
8313
|
-
mutation:
|
|
8311
|
+
mutation: canvasMutationData,
|
|
8314
8312
|
target,
|
|
8315
8313
|
imageMap: this.imageMap,
|
|
8316
8314
|
canvasEventMap: this.canvasEventMap,
|
|
@@ -8366,14 +8364,14 @@ var Replayer = class {
|
|
|
8366
8364
|
}
|
|
8367
8365
|
}
|
|
8368
8366
|
}
|
|
8369
|
-
this.constructedStyleMutations.forEach((data) => {
|
|
8370
|
-
this.applyStyleSheetMutation(data);
|
|
8371
|
-
});
|
|
8372
|
-
this.constructedStyleMutations = [];
|
|
8373
8367
|
this.adoptedStyleSheets.forEach((data) => {
|
|
8374
8368
|
this.applyAdoptedStyleSheet(data);
|
|
8375
8369
|
});
|
|
8376
8370
|
this.adoptedStyleSheets = [];
|
|
8371
|
+
this.constructedStyleMutations.forEach((data) => {
|
|
8372
|
+
this.applyStyleSheetMutation(data);
|
|
8373
|
+
});
|
|
8374
|
+
this.constructedStyleMutations = [];
|
|
8377
8375
|
}
|
|
8378
8376
|
for (const [
|
|
8379
8377
|
pointerId,
|
|
@@ -8413,6 +8411,7 @@ var Replayer = class {
|
|
|
8413
8411
|
this.firstFullSnapshot = null;
|
|
8414
8412
|
this.mirror.reset();
|
|
8415
8413
|
this.styleMirror.reset();
|
|
8414
|
+
this.pendingAdoptedStyles.clear();
|
|
8416
8415
|
});
|
|
8417
8416
|
const timer = new Timer([], {
|
|
8418
8417
|
speed: this.config.speed
|
|
@@ -8473,9 +8472,7 @@ var Replayer = class {
|
|
|
8473
8472
|
return;
|
|
8474
8473
|
}
|
|
8475
8474
|
this.firstFullSnapshot = firstFullsnapshot;
|
|
8476
|
-
this.rebuildFullSnapshot(
|
|
8477
|
-
firstFullsnapshot
|
|
8478
|
-
);
|
|
8475
|
+
this.rebuildFullSnapshot(firstFullsnapshot);
|
|
8479
8476
|
this.iframe.contentWindow?.scrollTo(
|
|
8480
8477
|
firstFullsnapshot.data.initialOffset
|
|
8481
8478
|
);
|
|
@@ -8692,12 +8689,12 @@ var Replayer = class {
|
|
|
8692
8689
|
this.wrapper.classList.add("replayer-wrapper");
|
|
8693
8690
|
this.config.root.appendChild(this.wrapper);
|
|
8694
8691
|
this.iframe = document.createElement("iframe");
|
|
8695
|
-
const
|
|
8692
|
+
const attributes = ["allow-same-origin"];
|
|
8696
8693
|
if (this.config.UNSAFE_replayCanvas) {
|
|
8697
|
-
|
|
8694
|
+
attributes.push("allow-scripts");
|
|
8698
8695
|
}
|
|
8699
8696
|
this.iframe.style.display = "none";
|
|
8700
|
-
this.iframe.setAttribute("sandbox",
|
|
8697
|
+
this.iframe.setAttribute("sandbox", attributes.join(" "));
|
|
8701
8698
|
this.disableInteract();
|
|
8702
8699
|
this.wrapper.appendChild(this.iframe);
|
|
8703
8700
|
const iframeDoc = getIFrameContentDocument(this.iframe);
|
|
@@ -8807,10 +8804,7 @@ var Replayer = class {
|
|
|
8807
8804
|
const sn = mirror2.getMeta(builtNode);
|
|
8808
8805
|
if (sn?.type === NodeType$2.Element && sn?.tagName.toUpperCase() === "HTML" && iframeContentDoc) {
|
|
8809
8806
|
const { documentElement, head } = iframeContentDoc;
|
|
8810
|
-
this.insertStyleRules(
|
|
8811
|
-
documentElement,
|
|
8812
|
-
head
|
|
8813
|
-
);
|
|
8807
|
+
this.insertStyleRules(documentElement, head);
|
|
8814
8808
|
}
|
|
8815
8809
|
if (this.usingVirtualDom) return;
|
|
8816
8810
|
for (const plugin of this.config.plugins || []) {
|
|
@@ -9641,7 +9635,11 @@ var Replayer = class {
|
|
|
9641
9635
|
if (data.styleId) styleSheet = this.styleMirror.getStyle(data.styleId);
|
|
9642
9636
|
else if (data.id)
|
|
9643
9637
|
styleSheet = this.mirror.getNode(data.id)?.sheet || null;
|
|
9644
|
-
if (!styleSheet)
|
|
9638
|
+
if (!styleSheet) {
|
|
9639
|
+
if (data.styleId)
|
|
9640
|
+
this.pendingAdoptedStyles.get(data.styleId)?.mutations.push(data);
|
|
9641
|
+
return;
|
|
9642
|
+
}
|
|
9645
9643
|
if (data.source === IncrementalSource$1.StyleSheetRule)
|
|
9646
9644
|
this.applyStyleSheetRule(data, styleSheet);
|
|
9647
9645
|
else if (data.source === IncrementalSource$1.StyleDeclaration)
|
|
@@ -9704,30 +9702,50 @@ var Replayer = class {
|
|
|
9704
9702
|
rule && rule.style && rule.style.removeProperty(data.remove.property);
|
|
9705
9703
|
}
|
|
9706
9704
|
}
|
|
9705
|
+
createAdoptedStyleSheet(hostWindow, styleId, rules2) {
|
|
9706
|
+
try {
|
|
9707
|
+
const newStyleSheet = new hostWindow.CSSStyleSheet();
|
|
9708
|
+
this.styleMirror.add(newStyleSheet, styleId);
|
|
9709
|
+
this.applyStyleSheetRule(
|
|
9710
|
+
{
|
|
9711
|
+
source: IncrementalSource$1.StyleSheetRule,
|
|
9712
|
+
adds: rules2
|
|
9713
|
+
},
|
|
9714
|
+
newStyleSheet
|
|
9715
|
+
);
|
|
9716
|
+
} catch (e2) {
|
|
9717
|
+
}
|
|
9718
|
+
}
|
|
9707
9719
|
applyAdoptedStyleSheet(data) {
|
|
9708
9720
|
const targetHost = this.mirror.getNode(data.id);
|
|
9709
|
-
if (!targetHost)
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9721
|
+
if (!targetHost) {
|
|
9722
|
+
data.styles?.forEach(
|
|
9723
|
+
(style) => this.pendingAdoptedStyles.set(style.styleId, {
|
|
9724
|
+
rules: style.rules,
|
|
9725
|
+
mutations: []
|
|
9726
|
+
})
|
|
9727
|
+
);
|
|
9728
|
+
return;
|
|
9729
|
+
}
|
|
9730
|
+
let hostWindow = null;
|
|
9731
|
+
if (hasShadowRoot(targetHost))
|
|
9732
|
+
hostWindow = targetHost.ownerDocument?.defaultView || null;
|
|
9733
|
+
else if (targetHost.nodeName === "#document")
|
|
9734
|
+
hostWindow = targetHost.defaultView;
|
|
9735
|
+
if (hostWindow) {
|
|
9736
|
+
for (const style of data.styles || [])
|
|
9737
|
+
this.createAdoptedStyleSheet(hostWindow, style.styleId, style.rules);
|
|
9738
|
+
for (const styleId of data.styleIds) {
|
|
9739
|
+
const pending = this.pendingAdoptedStyles.get(styleId);
|
|
9740
|
+
if (!pending) continue;
|
|
9741
|
+
this.pendingAdoptedStyles.delete(styleId);
|
|
9742
|
+
if (!this.styleMirror.getStyle(styleId))
|
|
9743
|
+
this.createAdoptedStyleSheet(hostWindow, styleId, pending.rules);
|
|
9744
|
+
pending.mutations.forEach(
|
|
9745
|
+
(mutation) => this.applyStyleSheetMutation(mutation)
|
|
9727
9746
|
);
|
|
9728
|
-
} catch (e2) {
|
|
9729
9747
|
}
|
|
9730
|
-
}
|
|
9748
|
+
}
|
|
9731
9749
|
const MAX_RETRY_TIME = 10;
|
|
9732
9750
|
let count = 0;
|
|
9733
9751
|
const adoptStyleSheets = (targetHost2, styleIds) => {
|
|
@@ -10887,6 +10905,7 @@ function Player$1($$anchor, $$props) {
|
|
|
10887
10905
|
uiEventListeners[event] = [];
|
|
10888
10906
|
}
|
|
10889
10907
|
uiEventListeners[event].push(handler);
|
|
10908
|
+
break;
|
|
10890
10909
|
}
|
|
10891
10910
|
};
|
|
10892
10911
|
function handleUiEvent(event, detail) {
|