@elderbyte/ngx-starter 20.0.0-beta.6 → 20.0.0

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.
@@ -9826,15 +9826,21 @@ class DomUtil {
9826
9826
  if (!element) {
9827
9827
  return false;
9828
9828
  }
9829
- if (!DomUtil.isElementVisibleInDOM(element)) {
9829
+ if (!DomUtil.isVisibleInDOM(element)) {
9830
9830
  return false;
9831
9831
  }
9832
- if (!DomUtil.isElementInViewport(element)) {
9832
+ if (DomUtil.isObscuredByOpenDrawer(element)) {
9833
+ return false;
9834
+ }
9835
+ if (!DomUtil.isInViewport(element)) {
9833
9836
  return false;
9834
9837
  }
9835
9838
  return true;
9836
9839
  }
9837
- static isElementVisibleInDOM(element) {
9840
+ /**
9841
+ * Determines if the element or a parent is not hidden by css
9842
+ */
9843
+ static isVisibleInDOM(element) {
9838
9844
  let currentElement = element;
9839
9845
  while (currentElement) {
9840
9846
  const style = window.getComputedStyle(currentElement);
@@ -9851,12 +9857,27 @@ class DomUtil {
9851
9857
  }
9852
9858
  return true;
9853
9859
  }
9854
- static isElementInViewport(element) {
9860
+ /**
9861
+ * Determines if the element is in the viewport.
9862
+ */
9863
+ static isInViewport(element) {
9855
9864
  const rect = element.getBoundingClientRect();
9856
9865
  const windowHeight = window.innerHeight || document.documentElement.clientHeight;
9857
9866
  const windowWidth = window.innerWidth || document.documentElement.clientWidth;
9858
9867
  return rect.bottom > 0 && rect.right > 0 && rect.top < windowHeight && rect.left < windowWidth;
9859
9868
  }
9869
+ /**
9870
+ * Determines if the element is obscured by an open drawer (i.e., there's an open drawer and the element is not within it).
9871
+ */
9872
+ static isObscuredByOpenDrawer(element) {
9873
+ const openDrawerClass = 'mat-drawer-opened';
9874
+ const isOpenDrawerElementChildOfDocument = document.querySelector(`.${openDrawerClass}`);
9875
+ if (!isOpenDrawerElementChildOfDocument) {
9876
+ return false;
9877
+ }
9878
+ const isElementInOpenDrawer = isOpenDrawerElementChildOfDocument.contains(element);
9879
+ return !isElementInOpenDrawer;
9880
+ }
9860
9881
  }
9861
9882
 
9862
9883
  class MemoryStorage {