@appsurify-testmap/rrweb-replay 3.11.0-alpha.1 → 3.15.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.
@@ -9665,16 +9665,30 @@ function describeNode(el) {
9665
9665
  const classes = el.classList.length ? "." + Array.from(el.classList).join(".") : "";
9666
9666
  return `${tag}${id}${classes}`;
9667
9667
  }
9668
+ function isAncestorOpacityVisible$1(el, win) {
9669
+ var _a2;
9670
+ let node2 = el.parentElement;
9671
+ while (node2) {
9672
+ const s2 = (_a2 = win.getComputedStyle) == null ? void 0 : _a2.call(win, node2);
9673
+ if (s2 && (parseFloat(s2.opacity) || 0) <= 0) {
9674
+ return false;
9675
+ }
9676
+ node2 = node2.parentElement;
9677
+ }
9678
+ return true;
9679
+ }
9668
9680
  function getElementVisibility(el) {
9669
9681
  var _a2, _b;
9670
9682
  const win = ((_a2 = el.ownerDocument) == null ? void 0 : _a2.defaultView) ?? window;
9671
9683
  const rect = el.getBoundingClientRect();
9672
9684
  const viewportWidth = win.innerWidth || win.document.documentElement.clientWidth || 0;
9673
9685
  const viewportHeight = win.innerHeight || win.document.documentElement.clientHeight || 0;
9674
- const isRectVisible = rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;
9686
+ const elHasSize = rect.width > 0 && rect.height > 0;
9687
+ const isViewportVisible = elHasSize && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;
9675
9688
  const style = (_b = win.getComputedStyle) == null ? void 0 : _b.call(win, el);
9676
- const isStyleVisible2 = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;
9677
- const isVisible = isStyleVisible2 && isRectVisible;
9689
+ const isOwnStyleVisible2 = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;
9690
+ const isCSSVisible = isOwnStyleVisible2 && isAncestorOpacityVisible$1(el, win);
9691
+ const isVisible = isCSSVisible && isViewportVisible;
9678
9692
  let ratio = 0;
9679
9693
  if (isVisible) {
9680
9694
  const xOverlap = Math.max(
@@ -9691,6 +9705,9 @@ function getElementVisibility(el) {
9691
9705
  }
9692
9706
  return {
9693
9707
  isVisible,
9708
+ isCSSVisible,
9709
+ isViewportVisible,
9710
+ hasSize: elHasSize,
9694
9711
  ratio
9695
9712
  };
9696
9713
  }