@serendie/ui 3.5.1-dev.202606091509 → 3.5.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.
Files changed (39) hide show
  1. package/dist/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  2. package/dist/components/DataTable/DataTableComponent.d.ts +1 -1
  3. package/dist/components/DataTable/table/BodyCheckbox.d.ts +1 -1
  4. package/dist/components/Divider/Divider.d.ts +1 -1
  5. package/dist/components/List/List.d.ts +1 -1
  6. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +1 -1
  7. package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.d.ts +1 -1
  8. package/dist/components/Tabs/TabItem.d.ts +1 -1
  9. package/dist/components/Tabs/Tabs.d.ts +1 -1
  10. package/dist/i18n/provider.d.ts +1 -1
  11. package/dist/node_modules/@zag-js/accordion/dist/accordion.connect.js +50 -49
  12. package/dist/node_modules/@zag-js/combobox/dist/combobox.connect.js +68 -70
  13. package/dist/node_modules/@zag-js/combobox/dist/combobox.machine.js +1 -1
  14. package/dist/node_modules/@zag-js/date-picker/dist/date-picker.connect.js +308 -322
  15. package/dist/node_modules/@zag-js/date-picker/dist/date-picker.machine.js +79 -93
  16. package/dist/node_modules/@zag-js/date-picker/dist/date-picker.utils.js +43 -35
  17. package/dist/node_modules/@zag-js/dialog/dist/dialog.dom.js +35 -36
  18. package/dist/node_modules/@zag-js/dialog/dist/dialog.machine.js +37 -27
  19. package/dist/node_modules/@zag-js/dismissable/dist/dismissable-layer.js +41 -56
  20. package/dist/node_modules/@zag-js/dismissable/dist/layer-stack.js +31 -51
  21. package/dist/node_modules/@zag-js/dismissable/dist/pointer-event-outside.js +25 -46
  22. package/dist/node_modules/@zag-js/dom-query/dist/controller.js +5 -5
  23. package/dist/node_modules/@zag-js/dom-query/dist/overflow.js +21 -13
  24. package/dist/node_modules/@zag-js/live-region/dist/index.js +19 -29
  25. package/dist/node_modules/@zag-js/menu/dist/menu.connect.js +135 -138
  26. package/dist/node_modules/@zag-js/menu/dist/menu.dom.js +24 -24
  27. package/dist/node_modules/@zag-js/menu/dist/menu.machine.js +1 -1
  28. package/dist/node_modules/@zag-js/popper/dist/get-placement.js +71 -82
  29. package/dist/node_modules/@zag-js/react/dist/machine.js +96 -105
  30. package/dist/node_modules/@zag-js/remove-scroll/dist/index.js +26 -34
  31. package/dist/node_modules/@zag-js/select/dist/select.connect.js +101 -104
  32. package/dist/node_modules/@zag-js/select/dist/select.machine.js +1 -1
  33. package/dist/node_modules/@zag-js/tabs/dist/tabs.machine.js +60 -63
  34. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.connect.js +25 -27
  35. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.dom.js +14 -15
  36. package/dist/theme/initColorScheme.d.ts +1 -1
  37. package/package.json +8 -8
  38. package/dist/node_modules/@zag-js/date-utils/dist/locale.js +0 -12
  39. package/dist/node_modules/@zag-js/dom-query/dist/scroll.js +0 -11
@@ -1,43 +1,42 @@
1
- import { queryAll as t } from "../../dom-query/dist/query.js";
2
- import { isFunction as o } from "../../utils/dist/guard.js";
3
- var a = (r) => {
4
- var e;
5
- return ((e = r.ids) == null ? void 0 : e.positioner) ?? `dialog:${r.id}:positioner`;
6
- }, l = (r) => {
7
- var e;
8
- return ((e = r.ids) == null ? void 0 : e.backdrop) ?? `dialog:${r.id}:backdrop`;
9
- }, n = (r) => {
10
- var e;
11
- return ((e = r.ids) == null ? void 0 : e.content) ?? `dialog:${r.id}:content`;
12
- }, d = (r, e) => {
1
+ import { queryAll as d } from "../../dom-query/dist/query.js";
2
+ import { isFunction as t } from "../../utils/dist/guard.js";
3
+ var o = (i) => {
4
+ var r;
5
+ return ((r = i.ids) == null ? void 0 : r.positioner) ?? `dialog:${i.id}:positioner`;
6
+ }, a = (i) => {
7
+ var r;
8
+ return ((r = i.ids) == null ? void 0 : r.backdrop) ?? `dialog:${i.id}:backdrop`;
9
+ }, l = (i) => {
10
+ var r;
11
+ return ((r = i.ids) == null ? void 0 : r.content) ?? `dialog:${i.id}:content`;
12
+ }, n = (i, r) => {
13
13
  var g;
14
- const i = (g = r.ids) == null ? void 0 : g.trigger;
15
- return i != null ? o(i) ? i(e) : i : e ? `dialog:${r.id}:trigger:${e}` : `dialog:${r.id}:trigger`;
16
- }, s = (r) => {
17
- var e;
18
- return ((e = r.ids) == null ? void 0 : e.title) ?? `dialog:${r.id}:title`;
19
- }, I = (r) => {
20
- var e;
21
- return ((e = r.ids) == null ? void 0 : e.description) ?? `dialog:${r.id}:description`;
22
- }, p = (r) => {
23
- var e;
24
- return ((e = r.ids) == null ? void 0 : e.closeTrigger) ?? `dialog:${r.id}:close`;
25
- }, E = (r) => r.getById(n(r)), T = (r) => r.getById(a(r)), u = (r) => r.getById(l(r)), v = (r) => r.getById(d(r)), m = (r) => r.getById(s(r)), f = (r) => r.getById(I(r)), k = (r) => r.getById(p(r)), y = (r) => t(r.getRootNode(), `[data-scope="dialog"][data-part="trigger"][data-ownedby="${r.id}"]`), C = (r, e) => e == null ? v(r) ?? y(r)[0] : r.getById(d(r, e));
14
+ const e = (g = i.ids) == null ? void 0 : g.trigger;
15
+ return e != null ? t(e) ? e(r) : e : r ? `dialog:${i.id}:trigger:${r}` : `dialog:${i.id}:trigger`;
16
+ }, s = (i) => {
17
+ var r;
18
+ return ((r = i.ids) == null ? void 0 : r.title) ?? `dialog:${i.id}:title`;
19
+ }, p = (i) => {
20
+ var r;
21
+ return ((r = i.ids) == null ? void 0 : r.description) ?? `dialog:${i.id}:description`;
22
+ }, I = (i) => {
23
+ var r;
24
+ return ((r = i.ids) == null ? void 0 : r.closeTrigger) ?? `dialog:${i.id}:close`;
25
+ }, B = (i) => i.getById(l(i)), E = (i) => i.getById(o(i)), T = (i) => i.getById(a(i)), m = (i) => i.getById(s(i)), u = (i) => i.getById(p(i)), k = (i) => i.getById(I(i)), v = (i) => d(i.getDoc(), `[data-scope="dialog"][data-part="trigger"][data-ownedby="${i.id}"]`), C = (i, r) => r == null ? v(i)[0] : i.getById(n(i, r));
26
26
  export {
27
27
  C as getActiveTriggerEl,
28
- u as getBackdropEl,
29
- l as getBackdropId,
28
+ T as getBackdropEl,
29
+ a as getBackdropId,
30
30
  k as getCloseTriggerEl,
31
- p as getCloseTriggerId,
32
- E as getContentEl,
33
- n as getContentId,
34
- f as getDescriptionEl,
35
- I as getDescriptionId,
36
- T as getPositionerEl,
37
- a as getPositionerId,
31
+ I as getCloseTriggerId,
32
+ B as getContentEl,
33
+ l as getContentId,
34
+ u as getDescriptionEl,
35
+ p as getDescriptionId,
36
+ E as getPositionerEl,
37
+ o as getPositionerId,
38
38
  m as getTitleEl,
39
39
  s as getTitleId,
40
- v as getTriggerEl,
41
- y as getTriggerEls,
42
- d as getTriggerId
40
+ v as getTriggerEls,
41
+ n as getTriggerId
43
42
  };
@@ -1,14 +1,15 @@
1
1
  import { ariaHidden as O } from "../../aria-hidden/dist/index.js";
2
- import { trapFocus as f } from "../../focus-trap/dist/index.js";
3
- import { preventBodyScroll as m } from "../../remove-scroll/dist/index.js";
4
- import { getDescriptionEl as C, getTitleEl as T, getContentEl as l, getTriggerEl as v, getTriggerEls as g, getActiveTriggerEl as d, getCloseTriggerEl as p, getBackdropEl as F, getPositionerEl as V } from "./dialog.dom.js";
5
- import { createMachine as D } from "../../core/dist/create-machine.js";
6
- import { raf as E } from "../../dom-query/dist/raf.js";
7
- import { getInitialFocus as k } from "../../dom-query/dist/initial-focus.js";
8
- import { trackDismissableElement as L } from "../../dismissable/dist/dismissable-layer.js";
9
- var B = D({
2
+ import { trapFocus as m } from "../../focus-trap/dist/index.js";
3
+ import { preventBodyScroll as f } from "../../remove-scroll/dist/index.js";
4
+ import { getContentEl as l, getPositionerEl as p, getBackdropEl as C, getDescriptionEl as v, getTitleEl as T, getTriggerEls as d, getActiveTriggerEl as E, getCloseTriggerEl as V } from "./dialog.dom.js";
5
+ import { createMachine as y } from "../../core/dist/create-machine.js";
6
+ import { raf as s } from "../../dom-query/dist/raf.js";
7
+ import { getComputedStyle as F } from "../../dom-query/dist/computed-style.js";
8
+ import { getInitialFocus as D } from "../../dom-query/dist/initial-focus.js";
9
+ import { trackDismissableElement as k } from "../../dismissable/dist/dismissable-layer.js";
10
+ var N = y({
10
11
  props({ props: e, scope: t }) {
11
- const n = e.role === "alertdialog", i = n ? () => p(t) : void 0, r = typeof e.modal == "boolean" ? e.modal : !0;
12
+ const n = e.role === "alertdialog", i = n ? () => V(t) : void 0, r = typeof e.modal == "boolean" ? e.modal : !0;
12
13
  return {
13
14
  role: "dialog",
14
15
  modal: r,
@@ -35,7 +36,7 @@ var B = D({
35
36
  onChange(i) {
36
37
  const r = t("onTriggerValueChange");
37
38
  if (!r) return;
38
- const o = d(n, i);
39
+ const o = E(n, i);
39
40
  r({ value: i, triggerElement: o });
40
41
  }
41
42
  }))
@@ -48,7 +49,7 @@ var B = D({
48
49
  },
49
50
  states: {
50
51
  open: {
51
- entry: ["checkRenderedElements", "setInitialFocus"],
52
+ entry: ["checkRenderedElements", "syncZIndex", "setInitialFocus"],
52
53
  effects: ["trackDismissableElement", "trapFocus", "preventScroll", "hideContentBelow"],
53
54
  on: {
54
55
  "CONTROLLED.CLOSE": {
@@ -116,12 +117,11 @@ var B = D({
116
117
  },
117
118
  effects: {
118
119
  trackDismissableElement({ scope: e, send: t, prop: n }) {
119
- return L(() => l(e), {
120
+ return k(() => l(e), {
120
121
  type: "dialog",
121
122
  defer: !0,
122
123
  pointerBlocking: n("modal"),
123
- layerStyleTargets: [() => F(e), () => V(e)],
124
- exclude: [v(e), ...g(e)].filter(Boolean),
124
+ exclude: d(e),
125
125
  onInteractOutside(r) {
126
126
  var o;
127
127
  (o = n("onInteractOutside")) == null || o(r), n("closeOnInteractOutside") || r.preventDefault();
@@ -141,10 +141,10 @@ var B = D({
141
141
  },
142
142
  preventScroll({ scope: e, prop: t }) {
143
143
  if (t("preventScroll"))
144
- return m(e.getDoc());
144
+ return f(e.getDoc());
145
145
  },
146
146
  trapFocus({ scope: e, prop: t, context: n }) {
147
- return t("trapFocus") ? f(() => l(e), {
147
+ return t("trapFocus") ? m(() => l(e), {
148
148
  preventScroll: !0,
149
149
  returnFocusOnDeactivate: !!t("restoreFocus"),
150
150
  initialFocus: t("initialFocusEl"),
@@ -152,13 +152,13 @@ var B = D({
152
152
  var u;
153
153
  const o = (u = t("finalFocusEl")) == null ? void 0 : u();
154
154
  if (o) return o;
155
- const s = n.get("triggerValue");
156
- if (s) {
157
- const c = d(e, s);
158
- if (c) return c;
155
+ const a = n.get("triggerValue");
156
+ if (a) {
157
+ const g = E(e, a);
158
+ if (g) return g;
159
159
  }
160
- const a = g(e)[0];
161
- return a || r;
160
+ const c = d(e)[0];
161
+ return c || r;
162
162
  },
163
163
  getShadowRoot: !0
164
164
  }) : void 0;
@@ -169,8 +169,8 @@ var B = D({
169
169
  },
170
170
  actions: {
171
171
  setInitialFocus({ prop: e, scope: t }) {
172
- e("trapFocus") || E(() => {
173
- const n = k({
172
+ e("trapFocus") || s(() => {
173
+ const n = D({
174
174
  root: l(t),
175
175
  getInitialEl: e("initialFocusEl")
176
176
  });
@@ -178,10 +178,20 @@ var B = D({
178
178
  });
179
179
  },
180
180
  checkRenderedElements({ context: e, scope: t }) {
181
- E(() => {
181
+ s(() => {
182
182
  e.set("rendered", {
183
183
  title: !!T(t),
184
- description: !!C(t)
184
+ description: !!v(t)
185
+ });
186
+ });
187
+ },
188
+ syncZIndex({ scope: e }) {
189
+ s(() => {
190
+ const t = l(e);
191
+ if (!t) return;
192
+ const n = F(t);
193
+ [p(e), C(e)].forEach((r) => {
194
+ r == null || r.style.setProperty("--z-index", n.zIndex), r == null || r.style.setProperty("--layer-index", n.getPropertyValue("--layer-index"));
185
195
  });
186
196
  });
187
197
  },
@@ -206,5 +216,5 @@ var B = D({
206
216
  }
207
217
  });
208
218
  export {
209
- B as machine
219
+ N as machine
210
220
  };
@@ -1,13 +1,13 @@
1
1
  import { trackInteractOutside as x } from "../../interact-outside/dist/index.js";
2
2
  import { trackEscapeKeydown as L } from "./escape-keydown.js";
3
- import { layerStack as c } from "./layer-stack.js";
4
- import { assignPointerEventToLayers as g, disablePointerEventsOutside as K, clearPointerEvent as M } from "./pointer-event-outside.js";
5
- import { raf as h } from "../../dom-query/dist/raf.js";
3
+ import { layerStack as s } from "./layer-stack.js";
4
+ import { assignPointerEventToLayers as g, disablePointerEventsOutside as T, clearPointerEvent as K } from "./pointer-event-outside.js";
5
+ import { raf as y } from "../../dom-query/dist/raf.js";
6
6
  import { isFunction as P } from "../../utils/dist/guard.js";
7
7
  import { warn as w } from "../../utils/dist/warning.js";
8
- import { getEventTarget as y } from "../../dom-query/dist/event.js";
9
- import { isHTMLElement as j, contains as q } from "../../dom-query/dist/node.js";
10
- function z(t, e) {
8
+ import { getEventTarget as h } from "../../dom-query/dist/event.js";
9
+ import { isHTMLElement as M, contains as j } from "../../dom-query/dist/node.js";
10
+ function q(t, e) {
11
11
  const { warnOnMissingNode: f = !0 } = e;
12
12
  if (f && !t) {
13
13
  w("[@zag-js/dismissable] node is `null` or `undefined`");
@@ -15,81 +15,66 @@ function z(t, e) {
15
15
  }
16
16
  if (!t)
17
17
  return;
18
- const {
19
- onDismiss: i,
20
- onRequestDismiss: n,
21
- pointerBlocking: a,
22
- exclude: d,
23
- debug: o,
24
- type: b = "dialog",
25
- layerStyleTargets: k
26
- } = e, B = {
27
- dismiss: i,
28
- node: t,
29
- type: b,
30
- pointerBlocking: a,
31
- requestDismiss: n,
32
- styleTargets: k
33
- };
34
- c.add(B), g();
18
+ const { onDismiss: n, onRequestDismiss: c, pointerBlocking: i, exclude: d, debug: o, type: b = "dialog" } = e, k = { dismiss: n, node: t, type: b, pointerBlocking: i, requestDismiss: c };
19
+ s.add(k), g();
20
+ function B(r) {
21
+ var u, l;
22
+ const a = h(r.detail.originalEvent);
23
+ s.isBelowPointerBlockingLayer(t) || s.isInBranch(a) || ((u = e.onPointerDownOutside) == null || u.call(e, r), (l = e.onInteractOutside) == null || l.call(e, r), !r.defaultPrevented && (o && console.log("onPointerDownOutside:", r.detail.originalEvent), n == null || n()));
24
+ }
35
25
  function D(r) {
36
26
  var u, l;
37
- const s = y(r.detail.originalEvent);
38
- c.isBelowPointerBlockingLayer(t) || c.isInBranch(s) || ((u = e.onPointerDownOutside) == null || u.call(e, r), (l = e.onInteractOutside) == null || l.call(e, r), !r.defaultPrevented && (o && console.log("onPointerDownOutside:", r.detail.originalEvent), i == null || i()));
27
+ const a = h(r.detail.originalEvent);
28
+ s.isInBranch(a) || ((u = e.onFocusOutside) == null || u.call(e, r), (l = e.onInteractOutside) == null || l.call(e, r), !r.defaultPrevented && (o && console.log("onFocusOutside:", r.detail.originalEvent), n == null || n()));
39
29
  }
40
30
  function I(r) {
41
- var u, l;
42
- const s = y(r.detail.originalEvent);
43
- c.isInBranch(s) || ((u = e.onFocusOutside) == null || u.call(e, r), (l = e.onInteractOutside) == null || l.call(e, r), !r.defaultPrevented && (o && console.log("onFocusOutside:", r.detail.originalEvent), i == null || i()));
31
+ var a;
32
+ s.isTopMost(t) && ((a = e.onEscapeKeyDown) == null || a.call(e, r), !r.defaultPrevented && n && (r.preventDefault(), n()));
44
33
  }
45
34
  function O(r) {
46
- var s;
47
- c.isTopMost(t) && ((s = e.onEscapeKeyDown) == null || s.call(e, r), !r.defaultPrevented && i && (r.preventDefault(), i()));
48
- }
49
- function T(r) {
50
35
  var E;
51
36
  if (!t) return !1;
52
- const s = typeof d == "function" ? d() : d, u = Array.isArray(s) ? s : [s], l = (E = e.persistentElements) == null ? void 0 : E.map((m) => m()).filter(j);
53
- return l && u.push(...l), u.some((m) => q(m, r)) || c.isInNestedLayer(t, r);
37
+ const a = typeof d == "function" ? d() : d, u = Array.isArray(a) ? a : [a], l = (E = e.persistentElements) == null ? void 0 : E.map((m) => m()).filter(M);
38
+ return l && u.push(...l), u.some((m) => j(m, r)) || s.isInNestedLayer(t, r);
54
39
  }
55
40
  const v = [
56
- a ? K(t, e.persistentElements) : void 0,
57
- L(t, O),
58
- x(t, { exclude: T, onFocusOutside: I, onPointerDownOutside: D, defer: e.defer })
41
+ i ? T(t, e.persistentElements) : void 0,
42
+ L(t, I),
43
+ x(t, { exclude: O, onFocusOutside: D, onPointerDownOutside: B, defer: e.defer })
59
44
  ];
60
45
  return () => {
61
- c.remove(t), g(), M(t), v.forEach((r) => r == null ? void 0 : r());
46
+ s.remove(t), g(), K(t), v.forEach((r) => r == null ? void 0 : r());
62
47
  };
63
48
  }
64
- function G(t, e) {
65
- const { defer: f } = e, i = f ? h : (a) => a(), n = [];
66
- return n.push(
67
- i(() => {
68
- const a = P(t) ? t() : t;
69
- n.push(z(a, e));
49
+ function F(t, e) {
50
+ const { defer: f } = e, n = f ? y : (i) => i(), c = [];
51
+ return c.push(
52
+ n(() => {
53
+ const i = P(t) ? t() : t;
54
+ c.push(q(i, e));
70
55
  })
71
56
  ), () => {
72
- n.forEach((a) => a == null ? void 0 : a());
57
+ c.forEach((i) => i == null ? void 0 : i());
73
58
  };
74
59
  }
75
- function J(t, e = {}) {
76
- const { defer: f } = e, i = f ? h : (a) => a(), n = [];
77
- return n.push(
78
- i(() => {
79
- const a = P(t) ? t() : t;
80
- if (!a) {
60
+ function G(t, e = {}) {
61
+ const { defer: f } = e, n = f ? y : (i) => i(), c = [];
62
+ return c.push(
63
+ n(() => {
64
+ const i = P(t) ? t() : t;
65
+ if (!i) {
81
66
  w("[@zag-js/dismissable] branch node is `null` or `undefined`");
82
67
  return;
83
68
  }
84
- c.addBranch(a), n.push(() => {
85
- c.removeBranch(a);
69
+ s.addBranch(i), c.push(() => {
70
+ s.removeBranch(i);
86
71
  });
87
72
  })
88
73
  ), () => {
89
- n.forEach((a) => a == null ? void 0 : a());
74
+ c.forEach((i) => i == null ? void 0 : i());
90
75
  };
91
76
  }
92
77
  export {
93
- J as trackDismissableBranch,
94
- G as trackDismissableElement
78
+ G as trackDismissableBranch,
79
+ F as trackDismissableElement
95
80
  };
@@ -1,7 +1,6 @@
1
- import { getComputedStyle as c } from "../../dom-query/dist/computed-style.js";
2
- import { nextTick as h } from "../../dom-query/dist/raf.js";
3
- import { contains as a } from "../../dom-query/dist/node.js";
4
- var d = "layer:request-dismiss", o = {
1
+ import { nextTick as d } from "../../dom-query/dist/raf.js";
2
+ import { contains as o } from "../../dom-query/dist/node.js";
3
+ var a = "layer:request-dismiss", c = {
5
4
  layers: [],
6
5
  branches: [],
7
6
  recentlyRemoved: /* @__PURE__ */ new Set(),
@@ -18,9 +17,9 @@ var d = "layer:request-dismiss", o = {
18
17
  return this.pointerBlockingLayers().length > 0;
19
18
  },
20
19
  isBelowPointerBlockingLayer(e) {
21
- var r;
22
- const t = this.indexOf(e), s = this.topMostPointerBlockingLayer() ? this.indexOf((r = this.topMostPointerBlockingLayer()) == null ? void 0 : r.node) : -1;
23
- return t < s;
20
+ var s;
21
+ const t = this.indexOf(e), n = this.topMostPointerBlockingLayer() ? this.indexOf((s = this.topMostPointerBlockingLayer()) == null ? void 0 : s.node) : -1;
22
+ return t < n;
24
23
  },
25
24
  isTopMost(e) {
26
25
  const t = this.layers[this.count() - 1];
@@ -33,38 +32,32 @@ var d = "layer:request-dismiss", o = {
33
32
  return this.layers.filter((t) => t.type === e);
34
33
  },
35
34
  getNestedLayersByType(e, t) {
36
- const s = this.indexOf(e);
37
- return s === -1 ? [] : this.layers.slice(s + 1).filter((r) => r.type === t);
35
+ const n = this.indexOf(e);
36
+ return n === -1 ? [] : this.layers.slice(n + 1).filter((s) => s.type === t);
38
37
  },
39
38
  getParentLayerOfType(e, t) {
40
- const s = this.indexOf(e);
41
- if (!(s <= 0))
42
- return this.layers.slice(0, s).reverse().find((r) => r.type === t);
39
+ const n = this.indexOf(e);
40
+ if (!(n <= 0))
41
+ return this.layers.slice(0, n).reverse().find((s) => s.type === t);
43
42
  },
44
43
  countNestedLayersOfType(e, t) {
45
44
  return this.getNestedLayersByType(e, t).length;
46
45
  },
47
46
  isInNestedLayer(e, t) {
48
- return !!(this.getNestedLayers(e).some((r) => a(r.node, t)) || this.recentlyRemoved.size > 0);
47
+ return !!(this.getNestedLayers(e).some((s) => o(s.node, t)) || this.recentlyRemoved.size > 0);
49
48
  },
50
49
  isInBranch(e) {
51
- return Array.from(this.branches).some((t) => a(t, e));
50
+ return Array.from(this.branches).some((t) => o(t, e));
52
51
  },
53
52
  add(e) {
54
- const t = this.indexOf(e.node);
55
- t !== -1 && this.layers.splice(t, 1), this.layers.push(e), this.syncLayers();
53
+ this.layers.push(e), this.syncLayers();
56
54
  },
57
55
  addBranch(e) {
58
56
  this.branches.push(e);
59
57
  },
60
58
  remove(e) {
61
- var r;
62
59
  const t = this.indexOf(e);
63
- if (t < 0) return;
64
- (r = this.layers[t].styleTargets) == null || r.forEach((n) => {
65
- const i = n();
66
- i && u(i);
67
- }), this.recentlyRemoved.add(e), h(() => this.recentlyRemoved.delete(e)), t < this.count() - 1 && this.getNestedLayers(e).forEach((i) => o.dismiss(i.node, e)), this.layers.splice(t, 1), this.syncLayers();
60
+ t < 0 || (this.recentlyRemoved.add(e), d(() => this.recentlyRemoved.delete(e)), t < this.count() - 1 && this.getNestedLayers(e).forEach((s) => c.dismiss(s.node, e)), this.layers.splice(t, 1), this.syncLayers());
68
61
  },
69
62
  removeBranch(e) {
70
63
  const t = this.branches.indexOf(e);
@@ -72,30 +65,25 @@ var d = "layer:request-dismiss", o = {
72
65
  },
73
66
  syncLayers() {
74
67
  this.layers.forEach((e, t) => {
75
- var s;
76
- y(e, t, e.node), (s = e.styleTargets) == null || s.forEach((r) => {
77
- const n = r();
78
- if (!n || n === e.node) return;
79
- y(e, t, n);
80
- const { zIndex: i } = c(e.node);
81
- n.style.setProperty("--z-index", i);
82
- });
68
+ e.node.style.setProperty("--layer-index", `${t}`), e.node.removeAttribute("data-nested"), e.node.removeAttribute("data-has-nested"), this.getParentLayerOfType(e.node, e.type) && e.node.setAttribute("data-nested", e.type);
69
+ const s = this.countNestedLayersOfType(e.node, e.type);
70
+ s > 0 && e.node.setAttribute("data-has-nested", e.type), e.node.style.setProperty("--nested-layer-count", `${s}`);
83
71
  });
84
72
  },
85
73
  indexOf(e) {
86
74
  return this.layers.findIndex((t) => t.node === e);
87
75
  },
88
76
  dismiss(e, t) {
89
- const s = this.indexOf(e);
90
- if (s === -1) return;
91
- const r = this.layers[s];
92
- l(e, d, (n) => {
77
+ const n = this.indexOf(e);
78
+ if (n === -1) return;
79
+ const s = this.layers[n];
80
+ y(e, a, (r) => {
93
81
  var i;
94
- (i = r.requestDismiss) == null || i.call(r, n), n.defaultPrevented || r == null || r.dismiss();
95
- }), f(e, d, {
82
+ (i = s.requestDismiss) == null || i.call(s, r), r.defaultPrevented || s == null || s.dismiss();
83
+ }), h(e, a, {
96
84
  originalLayer: e,
97
85
  targetLayer: t,
98
- originalIndex: s,
86
+ originalIndex: n,
99
87
  targetIndex: t ? this.indexOf(t) : -1
100
88
  }), this.syncLayers();
101
89
  },
@@ -103,21 +91,13 @@ var d = "layer:request-dismiss", o = {
103
91
  this.remove(this.layers[0].node);
104
92
  }
105
93
  };
106
- function y(e, t, s) {
107
- s.style.setProperty("--layer-index", `${t}`), s.removeAttribute("data-nested"), s.removeAttribute("data-has-nested"), o.getParentLayerOfType(e.node, e.type) && s.setAttribute("data-nested", e.type);
108
- const n = o.countNestedLayersOfType(e.node, e.type);
109
- n > 0 && s.setAttribute("data-has-nested", e.type), s.style.setProperty("--nested-layer-count", `${n}`);
94
+ function h(e, t, n) {
95
+ const s = e.ownerDocument.defaultView || window, r = new s.CustomEvent(t, { cancelable: !0, bubbles: !0, detail: n });
96
+ return e.dispatchEvent(r);
110
97
  }
111
- function u(e) {
112
- e.style.removeProperty("--layer-index"), e.style.removeProperty("--nested-layer-count"), e.style.removeProperty("--z-index"), e.removeAttribute("data-nested"), e.removeAttribute("data-has-nested");
113
- }
114
- function f(e, t, s) {
115
- const r = e.ownerDocument.defaultView || window, n = new r.CustomEvent(t, { cancelable: !0, bubbles: !0, detail: s });
116
- return e.dispatchEvent(n);
117
- }
118
- function l(e, t, s) {
119
- e.addEventListener(t, s, { once: !0 });
98
+ function y(e, t, n) {
99
+ e.addEventListener(t, n, { once: !0 });
120
100
  }
121
101
  export {
122
- o as layerStack
102
+ c as layerStack
123
103
  };
@@ -1,58 +1,37 @@
1
- import { layerStack as a } from "./layer-stack.js";
2
- import { getDocument as f, getWindow as v, isHTMLElement as b } from "../../dom-query/dist/node.js";
3
- import { waitForElement as p } from "../../dom-query/dist/wait-for.js";
4
- import { setStyle as d } from "../../dom-query/dist/set.js";
5
- var c = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap();
6
- function E(t) {
7
- return a.isBelowPointerBlockingLayer(t) ? "none" : "auto";
8
- }
9
- function l(t) {
10
- const r = E(t);
11
- t.style.pointerEvents !== r && (t.style.pointerEvents = r);
12
- }
13
- function g(t) {
14
- if (o.has(t)) return;
15
- const r = v(t);
16
- if (typeof r.MutationObserver > "u") return;
17
- const n = new r.MutationObserver(() => {
18
- o.has(t) && l(t);
19
- });
20
- n.observe(t, { attributes: !0, attributeFilter: ["style"] }), o.set(t, n);
21
- }
22
- function w() {
23
- a.layers.forEach(({ node: t }) => {
24
- l(t), g(t);
1
+ import { layerStack as r } from "./layer-stack.js";
2
+ import { getDocument as c, isHTMLElement as l } from "../../dom-query/dist/node.js";
3
+ import { waitForElement as d } from "../../dom-query/dist/wait-for.js";
4
+ import { setStyle as b } from "../../dom-query/dist/set.js";
5
+ var s;
6
+ function E() {
7
+ r.layers.forEach(({ node: o }) => {
8
+ o.style.pointerEvents = r.isBelowPointerBlockingLayer(o) ? "none" : "auto";
25
9
  });
26
10
  }
27
- function M(t) {
28
- const r = o.get(t);
29
- r && (r.disconnect(), o.delete(t)), t.style.pointerEvents = "";
11
+ function h(o) {
12
+ o.style.pointerEvents = "";
30
13
  }
31
- function B(t, r) {
32
- const n = f(t), u = [];
33
- return a.hasPointerBlockingLayer() && !n.body.hasAttribute("data-inert") && (c.set(n.body, n.body.style.pointerEvents), queueMicrotask(() => {
34
- const e = n.body;
35
- e && (e.style.pointerEvents = "none", e.setAttribute("data-inert", ""));
36
- })), r == null || r.forEach((e) => {
37
- const [i, y] = p(
14
+ function g(o, n) {
15
+ const t = c(o), i = [];
16
+ return r.hasPointerBlockingLayer() && !t.body.hasAttribute("data-inert") && (s = document.body.style.pointerEvents, queueMicrotask(() => {
17
+ t.body.style.pointerEvents = "none", t.body.setAttribute("data-inert", "");
18
+ })), n == null || n.forEach((a) => {
19
+ const [u, y] = d(
38
20
  () => {
39
- const s = e();
40
- return b(s) ? s : null;
21
+ const e = a();
22
+ return l(e) ? e : null;
41
23
  },
42
24
  { timeout: 1e3 }
43
25
  );
44
- i.then((s) => u.push(d(s, { pointerEvents: "auto" }))), u.push(y);
26
+ u.then((e) => i.push(b(e, { pointerEvents: "auto" }))), i.push(y);
45
27
  }), () => {
46
- a.hasPointerBlockingLayer() || (queueMicrotask(() => {
47
- const e = n.body;
48
- if (!e) return;
49
- const i = c.get(e);
50
- i !== void 0 && (e.style.pointerEvents = i, c.delete(e)), e.removeAttribute("data-inert"), e.style.length === 0 && e.removeAttribute("style");
51
- }), u.forEach((e) => e()));
28
+ r.hasPointerBlockingLayer() || (queueMicrotask(() => {
29
+ t.body.style.pointerEvents = s, t.body.removeAttribute("data-inert"), t.body.style.length === 0 && t.body.removeAttribute("style");
30
+ }), i.forEach((a) => a()));
52
31
  };
53
32
  }
54
33
  export {
55
- w as assignPointerEventToLayers,
56
- M as clearPointerEvent,
57
- B as disablePointerEventsOutside
34
+ E as assignPointerEventToLayers,
35
+ h as clearPointerEvent,
36
+ g as disablePointerEventsOutside
58
37
  };
@@ -1,5 +1,5 @@
1
1
  import { getRootNode as g } from "./node.js";
2
- var E = /* @__PURE__ */ new Set(["menu", "listbox", "dialog", "grid", "tree", "region", "application"]), p = (t) => E.has(t), A = (t) => {
2
+ var E = /* @__PURE__ */ new Set(["menu", "listbox", "dialog", "grid", "tree", "region"]), C = (t) => E.has(t), A = (t) => {
3
3
  var o;
4
4
  return ((o = t.getAttribute("aria-controls")) == null ? void 0 : o.split(" ")) || [];
5
5
  };
@@ -15,7 +15,7 @@ function S(t, o) {
15
15
  const e = i.getElementById(n);
16
16
  if (e) {
17
17
  const s = e.getAttribute("role"), f = e.getAttribute("aria-modal") === "true";
18
- if (s && p(s) && !f && (e === o || e.contains(o) || l(e)))
18
+ if (s && C(s) && !f && (e === o || e.contains(o) || l(e)))
19
19
  return !0;
20
20
  }
21
21
  }
@@ -24,7 +24,7 @@ function S(t, o) {
24
24
  };
25
25
  return l(t);
26
26
  }
27
- function C(t, o) {
27
+ function p(t, o) {
28
28
  const r = g(t), i = /* @__PURE__ */ new Set(), l = (c) => {
29
29
  const d = c.querySelectorAll("[aria-controls]");
30
30
  for (const a of d) {
@@ -45,7 +45,7 @@ function C(t, o) {
45
45
  }
46
46
  function x(t) {
47
47
  const o = /* @__PURE__ */ new Set();
48
- return C(t, (r) => {
48
+ return p(t, (r) => {
49
49
  t.contains(r) || o.add(r);
50
50
  }), Array.from(o);
51
51
  }
@@ -66,7 +66,7 @@ function y(t) {
66
66
  return !!(o.querySelector(i) && I(t));
67
67
  }
68
68
  export {
69
- C as findControlledElements,
69
+ p as findControlledElements,
70
70
  x as getControlledElements,
71
71
  v as hasControllerElements,
72
72
  y as isControlledByExpandedController,