@zag-js/dismissable 1.20.1 → 1.21.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.
package/dist/index.js CHANGED
@@ -96,12 +96,17 @@ function disablePointerEventsOutside(node, persistentElements) {
96
96
  doc.body.setAttribute("data-inert", "");
97
97
  });
98
98
  }
99
- if (persistentElements) {
100
- const persistedCleanup = domQuery.waitForElements(persistentElements, (el) => {
101
- cleanups.push(domQuery.setStyle(el, { pointerEvents: "auto" }));
102
- });
103
- cleanups.push(persistedCleanup);
104
- }
99
+ persistentElements?.forEach((el) => {
100
+ const [promise, abort] = domQuery.waitForElement(
101
+ () => {
102
+ const node2 = el();
103
+ return domQuery.isHTMLElement(node2) ? node2 : null;
104
+ },
105
+ { timeout: 1e3 }
106
+ );
107
+ promise.then((el2) => cleanups.push(domQuery.setStyle(el2, { pointerEvents: "auto" })));
108
+ cleanups.push(abort);
109
+ });
105
110
  return () => {
106
111
  if (layerStack.hasPointerBlockingLayer()) return;
107
112
  queueMicrotask(() => {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { raf, contains, getDocument, waitForElements, setStyle, addDomEvent, getEventTarget, isHTMLElement } from '@zag-js/dom-query';
1
+ import { raf, contains, getDocument, waitForElement, isHTMLElement, setStyle, addDomEvent, getEventTarget } from '@zag-js/dom-query';
2
2
  import { trackInteractOutside } from '@zag-js/interact-outside';
3
3
  import { isFunction, warn } from '@zag-js/utils';
4
4
 
@@ -94,12 +94,17 @@ function disablePointerEventsOutside(node, persistentElements) {
94
94
  doc.body.setAttribute("data-inert", "");
95
95
  });
96
96
  }
97
- if (persistentElements) {
98
- const persistedCleanup = waitForElements(persistentElements, (el) => {
99
- cleanups.push(setStyle(el, { pointerEvents: "auto" }));
100
- });
101
- cleanups.push(persistedCleanup);
102
- }
97
+ persistentElements?.forEach((el) => {
98
+ const [promise, abort] = waitForElement(
99
+ () => {
100
+ const node2 = el();
101
+ return isHTMLElement(node2) ? node2 : null;
102
+ },
103
+ { timeout: 1e3 }
104
+ );
105
+ promise.then((el2) => cleanups.push(setStyle(el2, { pointerEvents: "auto" })));
106
+ cleanups.push(abort);
107
+ });
103
108
  return () => {
104
109
  if (layerStack.hasPointerBlockingLayer()) return;
105
110
  queueMicrotask(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/dismissable",
3
- "version": "1.20.1",
3
+ "version": "1.21.0",
4
4
  "description": "Dismissable layer utilities for the DOM",
5
5
  "keywords": [
6
6
  "js",
@@ -23,9 +23,9 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@zag-js/interact-outside": "1.20.1",
27
- "@zag-js/dom-query": "1.20.1",
28
- "@zag-js/utils": "1.20.1"
26
+ "@zag-js/interact-outside": "1.21.0",
27
+ "@zag-js/dom-query": "1.21.0",
28
+ "@zag-js/utils": "1.21.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "clean-package": "2.2.0"