@glimt/record 0.0.26 → 0.0.27
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/record.cjs +18 -17
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +18 -17
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +18 -17
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +21 -21
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.cjs
CHANGED
|
@@ -367,8 +367,6 @@ const COPY_CANVAS_ON_VOLUME_GREATER_THAN = 25e4;
|
|
|
367
367
|
function getReadableCanvasContext(canvas, cachedContext) {
|
|
368
368
|
if (canvas.width * canvas.height < COPY_CANVAS_ON_VOLUME_GREATER_THAN)
|
|
369
369
|
return cachedContext ?? canvas.getContext("2d");
|
|
370
|
-
console.log("cloning canvas for is2DCanvasBlank");
|
|
371
|
-
const start = performance.now();
|
|
372
370
|
const offscreen = document.createElement("canvas");
|
|
373
371
|
offscreen.width = canvas.width;
|
|
374
372
|
offscreen.height = canvas.height;
|
|
@@ -376,11 +374,6 @@ function getReadableCanvasContext(canvas, cachedContext) {
|
|
|
376
374
|
if (ctx) {
|
|
377
375
|
ctx.drawImage(canvas, 0, 0);
|
|
378
376
|
}
|
|
379
|
-
console.log(
|
|
380
|
-
"cloned canvas for is2DCanvasBlank took",
|
|
381
|
-
performance.now() - start,
|
|
382
|
-
"ms"
|
|
383
|
-
);
|
|
384
377
|
return offscreen.getContext("2d", { willReadFrequently: true });
|
|
385
378
|
}
|
|
386
379
|
function is2DCanvasBlank(canvas, cachedContext) {
|
|
@@ -905,6 +898,13 @@ function getRootId(doc, mirror2) {
|
|
|
905
898
|
const docId = mirror2.getId(doc);
|
|
906
899
|
return docId === 1 ? void 0 : docId;
|
|
907
900
|
}
|
|
901
|
+
const runIdleCallback = (cb) => {
|
|
902
|
+
if ("requestIdleCallback" in window) {
|
|
903
|
+
window.requestIdleCallback(cb);
|
|
904
|
+
} else {
|
|
905
|
+
setTimeout(cb, 100);
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
908
|
function serializeTextNode(n2, options) {
|
|
909
909
|
const { needsMask, maskTextFn, rootId, cssCaptured } = options;
|
|
910
910
|
const parent = index$1.parentNode(n2);
|
|
@@ -1026,7 +1026,7 @@ function serializeElementNode(n2, options) {
|
|
|
1026
1026
|
dataURLOptions.quality
|
|
1027
1027
|
);
|
|
1028
1028
|
attributes.rr_dataURL = canvasDataURL;
|
|
1029
|
-
|
|
1029
|
+
runIdleCallback(() => {
|
|
1030
1030
|
try {
|
|
1031
1031
|
const blankCanvas = doc.createElement("canvas");
|
|
1032
1032
|
blankCanvas.width = n2.width;
|
|
@@ -1036,13 +1036,9 @@ function serializeElementNode(n2, options) {
|
|
|
1036
1036
|
dataURLOptions.quality
|
|
1037
1037
|
);
|
|
1038
1038
|
if (canvasDataURL === blankCanvasDataURL) {
|
|
1039
|
-
console.log(
|
|
1040
|
-
"deleting dataURL because it's the same as blank canvas"
|
|
1041
|
-
);
|
|
1042
1039
|
delete attributes.rr_dataURL;
|
|
1043
1040
|
}
|
|
1044
1041
|
} catch (e2) {
|
|
1045
|
-
console.log("did get context canvas error", e2);
|
|
1046
1042
|
}
|
|
1047
1043
|
});
|
|
1048
1044
|
}
|
|
@@ -9851,25 +9847,30 @@ class MutationBuffer {
|
|
|
9851
9847
|
for (let i2 = 0; i2 < m.addedNodes.length; i2++) {
|
|
9852
9848
|
this.genAdds(m.addedNodes[i2], m.target);
|
|
9853
9849
|
}
|
|
9850
|
+
const parentId = isShadowRoot(m.target) ? this.mirror.getId(index.host(m.target)) : this.mirror.getId(m.target);
|
|
9851
|
+
if (isBlocked(m.target, this.blockClass, this.blockSelector, false))
|
|
9852
|
+
return;
|
|
9853
|
+
const addedSetHas = this.addedSet.has(m.target);
|
|
9854
|
+
const ancestorRemoved = isAncestorRemoved(m.target, this.mirror);
|
|
9855
|
+
const isShadow = isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0;
|
|
9854
9856
|
for (let i2 = 0; i2 < m.removedNodes.length; i2++) {
|
|
9855
9857
|
const n2 = m.removedNodes[i2];
|
|
9856
9858
|
const nodeId = this.mirror.getId(n2);
|
|
9857
|
-
|
|
9858
|
-
if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || isIgnored(n2, this.mirror, this.slimDOMOptions) || !isSerialized(n2, this.mirror)) {
|
|
9859
|
+
if (isIgnored(n2, this.mirror, this.slimDOMOptions) || !isSerialized(n2, this.mirror)) {
|
|
9859
9860
|
return;
|
|
9860
9861
|
}
|
|
9861
9862
|
if (this.addedSet.has(n2)) {
|
|
9862
9863
|
deepDelete(this.addedSet, n2);
|
|
9863
9864
|
this.droppedSet.add(n2);
|
|
9864
|
-
} else if (
|
|
9865
|
-
else if (
|
|
9865
|
+
} else if (addedSetHas && nodeId === -1) ;
|
|
9866
|
+
else if (ancestorRemoved) ;
|
|
9866
9867
|
else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) {
|
|
9867
9868
|
deepDelete(this.movedSet, n2);
|
|
9868
9869
|
} else {
|
|
9869
9870
|
this.removes.push({
|
|
9870
9871
|
parentId,
|
|
9871
9872
|
id: nodeId,
|
|
9872
|
-
isShadow
|
|
9873
|
+
isShadow
|
|
9873
9874
|
});
|
|
9874
9875
|
processRemoves(n2, this.removesSubTreeCache);
|
|
9875
9876
|
}
|