@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.
@@ -10041,6 +10041,18 @@ function describeNode(el) {
10041
10041
  const classes = el.classList.length ? "." + Array.from(el.classList).join(".") : "";
10042
10042
  return `${tag}${id}${classes}`;
10043
10043
  }
10044
+ function isAncestorOpacityVisible$1(el, win) {
10045
+ var _a2;
10046
+ let node2 = el.parentElement;
10047
+ while (node2) {
10048
+ const s2 = (_a2 = win.getComputedStyle) == null ? void 0 : _a2.call(win, node2);
10049
+ if (s2 && (parseFloat(s2.opacity) || 0) <= 0) {
10050
+ return false;
10051
+ }
10052
+ node2 = node2.parentElement;
10053
+ }
10054
+ return true;
10055
+ }
10044
10056
  function getElementVisibility(el) {
10045
10057
  var _a3;
10046
10058
  var _a2, _b;
@@ -10048,10 +10060,12 @@ function getElementVisibility(el) {
10048
10060
  const rect = el.getBoundingClientRect();
10049
10061
  const viewportWidth = win.innerWidth || win.document.documentElement.clientWidth || 0;
10050
10062
  const viewportHeight = win.innerHeight || win.document.documentElement.clientHeight || 0;
10051
- const isRectVisible = rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;
10063
+ const elHasSize = rect.width > 0 && rect.height > 0;
10064
+ const isViewportVisible = elHasSize && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;
10052
10065
  const style = (_b = win.getComputedStyle) == null ? void 0 : _b.call(win, el);
10053
- const isStyleVisible2 = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;
10054
- const isVisible = isStyleVisible2 && isRectVisible;
10066
+ const isOwnStyleVisible2 = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;
10067
+ const isCSSVisible = isOwnStyleVisible2 && isAncestorOpacityVisible$1(el, win);
10068
+ const isVisible = isCSSVisible && isViewportVisible;
10055
10069
  let ratio = 0;
10056
10070
  if (isVisible) {
10057
10071
  const xOverlap = Math.max(
@@ -10068,6 +10082,9 @@ function getElementVisibility(el) {
10068
10082
  }
10069
10083
  return {
10070
10084
  isVisible,
10085
+ isCSSVisible,
10086
+ isViewportVisible,
10087
+ hasSize: elHasSize,
10071
10088
  ratio
10072
10089
  };
10073
10090
  }