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