@appsurify-testmap/rrweb-snapshot 3.11.0-alpha.1 → 3.12.0-alpha.1
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/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/rrweb-snapshot.cjs +29 -9
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.js +29 -9
- package/dist/rrweb-snapshot.js.map +1 -1
- package/dist/rrweb-snapshot.umd.cjs +29 -9
- package/dist/rrweb-snapshot.umd.cjs.map +3 -3
- package/dist/rrweb-snapshot.umd.min.cjs +16 -16
- package/dist/rrweb-snapshot.umd.min.cjs.map +3 -3
- package/package.json +3 -3
|
@@ -210,6 +210,18 @@ function describeNode(el) {
|
|
|
210
210
|
const classes = el.classList.length ? "." + Array.from(el.classList).join(".") : "";
|
|
211
211
|
return `${tag}${id}${classes}`;
|
|
212
212
|
}
|
|
213
|
+
function isAncestorOpacityVisible(el, win) {
|
|
214
|
+
var _a;
|
|
215
|
+
let node2 = el.parentElement;
|
|
216
|
+
while (node2) {
|
|
217
|
+
const s = (_a = win.getComputedStyle) == null ? void 0 : _a.call(win, node2);
|
|
218
|
+
if (s && (parseFloat(s.opacity) || 0) <= 0) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
node2 = node2.parentElement;
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
213
225
|
function getElementVisibility(el) {
|
|
214
226
|
var _a2;
|
|
215
227
|
var _a, _b;
|
|
@@ -217,10 +229,12 @@ function getElementVisibility(el) {
|
|
|
217
229
|
const rect = el.getBoundingClientRect();
|
|
218
230
|
const viewportWidth = win.innerWidth || win.document.documentElement.clientWidth || 0;
|
|
219
231
|
const viewportHeight = win.innerHeight || win.document.documentElement.clientHeight || 0;
|
|
220
|
-
const
|
|
232
|
+
const elHasSize = rect.width > 0 && rect.height > 0;
|
|
233
|
+
const isViewportVisible = elHasSize && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;
|
|
221
234
|
const style = (_b = win.getComputedStyle) == null ? void 0 : _b.call(win, el);
|
|
222
|
-
const
|
|
223
|
-
const
|
|
235
|
+
const isOwnStyleVisible = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;
|
|
236
|
+
const isCSSVisible = isOwnStyleVisible && isAncestorOpacityVisible(el, win);
|
|
237
|
+
const isVisible = isCSSVisible && isViewportVisible;
|
|
224
238
|
let ratio = 0;
|
|
225
239
|
if (isVisible) {
|
|
226
240
|
const xOverlap = Math.max(
|
|
@@ -237,6 +251,9 @@ function getElementVisibility(el) {
|
|
|
237
251
|
}
|
|
238
252
|
return {
|
|
239
253
|
isVisible,
|
|
254
|
+
isCSSVisible,
|
|
255
|
+
isViewportVisible,
|
|
256
|
+
hasSize: elHasSize,
|
|
240
257
|
ratio
|
|
241
258
|
};
|
|
242
259
|
}
|
|
@@ -696,19 +713,18 @@ function isTextVisible(n) {
|
|
|
696
713
|
var _a;
|
|
697
714
|
const parent = index.parentNode(n);
|
|
698
715
|
const parentElement2 = parent && parent;
|
|
699
|
-
if (!parentElement2) {
|
|
716
|
+
if (!parentElement2 || parentElement2.nodeType !== Node.ELEMENT_NODE) {
|
|
700
717
|
return false;
|
|
701
718
|
}
|
|
702
|
-
const
|
|
703
|
-
if (!
|
|
719
|
+
const parentVis = isElementVisible(parentElement2);
|
|
720
|
+
if (!parentVis.isVisible) {
|
|
704
721
|
return false;
|
|
705
722
|
}
|
|
706
723
|
const textContent2 = (_a = n.textContent) == null ? void 0 : _a.trim();
|
|
707
724
|
return textContent2 !== "";
|
|
708
725
|
}
|
|
709
726
|
function isElementVisible(el) {
|
|
710
|
-
|
|
711
|
-
return visibility.isVisible;
|
|
727
|
+
return index.getElementVisibility(el);
|
|
712
728
|
}
|
|
713
729
|
const interactiveEvents = [
|
|
714
730
|
"change",
|
|
@@ -3209,7 +3225,11 @@ function serializeNodeWithId(n, options) {
|
|
|
3209
3225
|
serializedNode.isVisible = isTextVisible(n);
|
|
3210
3226
|
}
|
|
3211
3227
|
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
3212
|
-
|
|
3228
|
+
const vis = isElementVisible(n);
|
|
3229
|
+
serializedNode.isVisible = vis.isVisible;
|
|
3230
|
+
serializedNode.isCSSVisible = vis.isCSSVisible;
|
|
3231
|
+
serializedNode.isViewportVisible = vis.isViewportVisible;
|
|
3232
|
+
serializedNode.hasSize = vis.hasSize;
|
|
3213
3233
|
serializedNode.isInteractive = isElementInteractive(n);
|
|
3214
3234
|
}
|
|
3215
3235
|
}
|