@serendie/ui 3.5.1-dev.202605201240 → 3.5.1-dev.202606091509

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 +49 -50
  12. package/dist/node_modules/@zag-js/combobox/dist/combobox.connect.js +70 -68
  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 +322 -308
  15. package/dist/node_modules/@zag-js/date-picker/dist/date-picker.machine.js +93 -79
  16. package/dist/node_modules/@zag-js/date-picker/dist/date-picker.utils.js +35 -43
  17. package/dist/node_modules/@zag-js/date-utils/dist/locale.js +12 -0
  18. package/dist/node_modules/@zag-js/dialog/dist/dialog.dom.js +36 -35
  19. package/dist/node_modules/@zag-js/dialog/dist/dialog.machine.js +27 -37
  20. package/dist/node_modules/@zag-js/dismissable/dist/dismissable-layer.js +56 -41
  21. package/dist/node_modules/@zag-js/dismissable/dist/layer-stack.js +51 -31
  22. package/dist/node_modules/@zag-js/dismissable/dist/pointer-event-outside.js +46 -25
  23. package/dist/node_modules/@zag-js/dom-query/dist/controller.js +5 -5
  24. package/dist/node_modules/@zag-js/dom-query/dist/overflow.js +13 -21
  25. package/dist/node_modules/@zag-js/dom-query/dist/scroll.js +11 -0
  26. package/dist/node_modules/@zag-js/live-region/dist/index.js +29 -19
  27. package/dist/node_modules/@zag-js/menu/dist/menu.connect.js +138 -135
  28. package/dist/node_modules/@zag-js/menu/dist/menu.dom.js +24 -24
  29. package/dist/node_modules/@zag-js/menu/dist/menu.machine.js +1 -1
  30. package/dist/node_modules/@zag-js/popper/dist/get-placement.js +82 -71
  31. package/dist/node_modules/@zag-js/react/dist/machine.js +105 -96
  32. package/dist/node_modules/@zag-js/remove-scroll/dist/index.js +34 -26
  33. package/dist/node_modules/@zag-js/select/dist/select.connect.js +104 -101
  34. package/dist/node_modules/@zag-js/select/dist/select.machine.js +1 -1
  35. package/dist/node_modules/@zag-js/tabs/dist/tabs.machine.js +63 -60
  36. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.connect.js +27 -25
  37. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.dom.js +15 -14
  38. package/dist/theme/initColorScheme.d.ts +1 -1
  39. package/package.json +8 -8
@@ -1,42 +1,43 @@
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) => {
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) => {
13
13
  var g;
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));
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));
26
26
  export {
27
27
  C as getActiveTriggerEl,
28
- T as getBackdropEl,
29
- a as getBackdropId,
28
+ u as getBackdropEl,
29
+ l as getBackdropId,
30
30
  k as getCloseTriggerEl,
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,
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,
38
38
  m as getTitleEl,
39
39
  s as getTitleId,
40
- v as getTriggerEls,
41
- n as getTriggerId
40
+ v as getTriggerEl,
41
+ y as getTriggerEls,
42
+ d as getTriggerId
42
43
  };
@@ -1,15 +1,14 @@
1
1
  import { ariaHidden as O } from "../../aria-hidden/dist/index.js";
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({
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({
11
10
  props({ props: e, scope: t }) {
12
- const n = e.role === "alertdialog", i = n ? () => V(t) : void 0, r = typeof e.modal == "boolean" ? e.modal : !0;
11
+ const n = e.role === "alertdialog", i = n ? () => p(t) : void 0, r = typeof e.modal == "boolean" ? e.modal : !0;
13
12
  return {
14
13
  role: "dialog",
15
14
  modal: r,
@@ -36,7 +35,7 @@ var N = y({
36
35
  onChange(i) {
37
36
  const r = t("onTriggerValueChange");
38
37
  if (!r) return;
39
- const o = E(n, i);
38
+ const o = d(n, i);
40
39
  r({ value: i, triggerElement: o });
41
40
  }
42
41
  }))
@@ -49,7 +48,7 @@ var N = y({
49
48
  },
50
49
  states: {
51
50
  open: {
52
- entry: ["checkRenderedElements", "syncZIndex", "setInitialFocus"],
51
+ entry: ["checkRenderedElements", "setInitialFocus"],
53
52
  effects: ["trackDismissableElement", "trapFocus", "preventScroll", "hideContentBelow"],
54
53
  on: {
55
54
  "CONTROLLED.CLOSE": {
@@ -117,11 +116,12 @@ var N = y({
117
116
  },
118
117
  effects: {
119
118
  trackDismissableElement({ scope: e, send: t, prop: n }) {
120
- return k(() => l(e), {
119
+ return L(() => l(e), {
121
120
  type: "dialog",
122
121
  defer: !0,
123
122
  pointerBlocking: n("modal"),
124
- exclude: d(e),
123
+ layerStyleTargets: [() => F(e), () => V(e)],
124
+ exclude: [v(e), ...g(e)].filter(Boolean),
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 N = y({
141
141
  },
142
142
  preventScroll({ scope: e, prop: t }) {
143
143
  if (t("preventScroll"))
144
- return f(e.getDoc());
144
+ return m(e.getDoc());
145
145
  },
146
146
  trapFocus({ scope: e, prop: t, context: n }) {
147
- return t("trapFocus") ? m(() => l(e), {
147
+ return t("trapFocus") ? f(() => l(e), {
148
148
  preventScroll: !0,
149
149
  returnFocusOnDeactivate: !!t("restoreFocus"),
150
150
  initialFocus: t("initialFocusEl"),
@@ -152,13 +152,13 @@ var N = y({
152
152
  var u;
153
153
  const o = (u = t("finalFocusEl")) == null ? void 0 : u();
154
154
  if (o) return o;
155
- const a = n.get("triggerValue");
156
- if (a) {
157
- const g = E(e, a);
158
- if (g) return g;
155
+ const s = n.get("triggerValue");
156
+ if (s) {
157
+ const c = d(e, s);
158
+ if (c) return c;
159
159
  }
160
- const c = d(e)[0];
161
- return c || r;
160
+ const a = g(e)[0];
161
+ return a || r;
162
162
  },
163
163
  getShadowRoot: !0
164
164
  }) : void 0;
@@ -169,8 +169,8 @@ var N = y({
169
169
  },
170
170
  actions: {
171
171
  setInitialFocus({ prop: e, scope: t }) {
172
- e("trapFocus") || s(() => {
173
- const n = D({
172
+ e("trapFocus") || E(() => {
173
+ const n = k({
174
174
  root: l(t),
175
175
  getInitialEl: e("initialFocusEl")
176
176
  });
@@ -178,20 +178,10 @@ var N = y({
178
178
  });
179
179
  },
180
180
  checkRenderedElements({ context: e, scope: t }) {
181
- s(() => {
181
+ E(() => {
182
182
  e.set("rendered", {
183
183
  title: !!T(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"));
184
+ description: !!C(t)
195
185
  });
196
186
  });
197
187
  },
@@ -216,5 +206,5 @@ var N = y({
216
206
  }
217
207
  });
218
208
  export {
219
- N as machine
209
+ B as machine
220
210
  };
@@ -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 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";
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";
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 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) {
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) {
11
11
  const { warnOnMissingNode: f = !0 } = e;
12
12
  if (f && !t) {
13
13
  w("[@zag-js/dismissable] node is `null` or `undefined`");
@@ -15,66 +15,81 @@ function q(t, e) {
15
15
  }
16
16
  if (!t)
17
17
  return;
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
- }
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();
25
35
  function D(r) {
26
36
  var u, l;
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()));
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()));
29
39
  }
30
40
  function I(r) {
31
- var a;
32
- s.isTopMost(t) && ((a = e.onEscapeKeyDown) == null || a.call(e, r), !r.defaultPrevented && n && (r.preventDefault(), n()));
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()));
33
44
  }
34
45
  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) {
35
50
  var E;
36
51
  if (!t) return !1;
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);
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);
39
54
  }
40
55
  const v = [
41
- i ? T(t, e.persistentElements) : void 0,
42
- L(t, I),
43
- x(t, { exclude: O, onFocusOutside: D, onPointerDownOutside: B, defer: e.defer })
56
+ a ? K(t, e.persistentElements) : void 0,
57
+ L(t, O),
58
+ x(t, { exclude: T, onFocusOutside: I, onPointerDownOutside: D, defer: e.defer })
44
59
  ];
45
60
  return () => {
46
- s.remove(t), g(), K(t), v.forEach((r) => r == null ? void 0 : r());
61
+ c.remove(t), g(), M(t), v.forEach((r) => r == null ? void 0 : r());
47
62
  };
48
63
  }
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));
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));
55
70
  })
56
71
  ), () => {
57
- c.forEach((i) => i == null ? void 0 : i());
72
+ n.forEach((a) => a == null ? void 0 : a());
58
73
  };
59
74
  }
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) {
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) {
66
81
  w("[@zag-js/dismissable] branch node is `null` or `undefined`");
67
82
  return;
68
83
  }
69
- s.addBranch(i), c.push(() => {
70
- s.removeBranch(i);
84
+ c.addBranch(a), n.push(() => {
85
+ c.removeBranch(a);
71
86
  });
72
87
  })
73
88
  ), () => {
74
- c.forEach((i) => i == null ? void 0 : i());
89
+ n.forEach((a) => a == null ? void 0 : a());
75
90
  };
76
91
  }
77
92
  export {
78
- G as trackDismissableBranch,
79
- F as trackDismissableElement
93
+ J as trackDismissableBranch,
94
+ G as trackDismissableElement
80
95
  };
@@ -1,6 +1,7 @@
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 = {
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 = {
4
5
  layers: [],
5
6
  branches: [],
6
7
  recentlyRemoved: /* @__PURE__ */ new Set(),
@@ -17,9 +18,9 @@ var a = "layer:request-dismiss", c = {
17
18
  return this.pointerBlockingLayers().length > 0;
18
19
  },
19
20
  isBelowPointerBlockingLayer(e) {
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;
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;
23
24
  },
24
25
  isTopMost(e) {
25
26
  const t = this.layers[this.count() - 1];
@@ -32,32 +33,38 @@ var a = "layer:request-dismiss", c = {
32
33
  return this.layers.filter((t) => t.type === e);
33
34
  },
34
35
  getNestedLayersByType(e, t) {
35
- const n = this.indexOf(e);
36
- return n === -1 ? [] : this.layers.slice(n + 1).filter((s) => s.type === t);
36
+ const s = this.indexOf(e);
37
+ return s === -1 ? [] : this.layers.slice(s + 1).filter((r) => r.type === t);
37
38
  },
38
39
  getParentLayerOfType(e, t) {
39
- const n = this.indexOf(e);
40
- if (!(n <= 0))
41
- return this.layers.slice(0, n).reverse().find((s) => s.type === t);
40
+ const s = this.indexOf(e);
41
+ if (!(s <= 0))
42
+ return this.layers.slice(0, s).reverse().find((r) => r.type === t);
42
43
  },
43
44
  countNestedLayersOfType(e, t) {
44
45
  return this.getNestedLayersByType(e, t).length;
45
46
  },
46
47
  isInNestedLayer(e, t) {
47
- return !!(this.getNestedLayers(e).some((s) => o(s.node, t)) || this.recentlyRemoved.size > 0);
48
+ return !!(this.getNestedLayers(e).some((r) => a(r.node, t)) || this.recentlyRemoved.size > 0);
48
49
  },
49
50
  isInBranch(e) {
50
- return Array.from(this.branches).some((t) => o(t, e));
51
+ return Array.from(this.branches).some((t) => a(t, e));
51
52
  },
52
53
  add(e) {
53
- this.layers.push(e), this.syncLayers();
54
+ const t = this.indexOf(e.node);
55
+ t !== -1 && this.layers.splice(t, 1), this.layers.push(e), this.syncLayers();
54
56
  },
55
57
  addBranch(e) {
56
58
  this.branches.push(e);
57
59
  },
58
60
  remove(e) {
61
+ var r;
59
62
  const t = this.indexOf(e);
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());
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();
61
68
  },
62
69
  removeBranch(e) {
63
70
  const t = this.branches.indexOf(e);
@@ -65,25 +72,30 @@ var a = "layer:request-dismiss", c = {
65
72
  },
66
73
  syncLayers() {
67
74
  this.layers.forEach((e, t) => {
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}`);
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
+ });
71
83
  });
72
84
  },
73
85
  indexOf(e) {
74
86
  return this.layers.findIndex((t) => t.node === e);
75
87
  },
76
88
  dismiss(e, t) {
77
- const n = this.indexOf(e);
78
- if (n === -1) return;
79
- const s = this.layers[n];
80
- y(e, a, (r) => {
89
+ const s = this.indexOf(e);
90
+ if (s === -1) return;
91
+ const r = this.layers[s];
92
+ l(e, d, (n) => {
81
93
  var i;
82
- (i = s.requestDismiss) == null || i.call(s, r), r.defaultPrevented || s == null || s.dismiss();
83
- }), h(e, a, {
94
+ (i = r.requestDismiss) == null || i.call(r, n), n.defaultPrevented || r == null || r.dismiss();
95
+ }), f(e, d, {
84
96
  originalLayer: e,
85
97
  targetLayer: t,
86
- originalIndex: n,
98
+ originalIndex: s,
87
99
  targetIndex: t ? this.indexOf(t) : -1
88
100
  }), this.syncLayers();
89
101
  },
@@ -91,13 +103,21 @@ var a = "layer:request-dismiss", c = {
91
103
  this.remove(this.layers[0].node);
92
104
  }
93
105
  };
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);
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}`);
97
110
  }
98
- function y(e, t, n) {
99
- e.addEventListener(t, n, { once: !0 });
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 });
100
120
  }
101
121
  export {
102
- c as layerStack
122
+ o as layerStack
103
123
  };
@@ -1,37 +1,58 @@
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";
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);
9
25
  });
10
26
  }
11
- function h(o) {
12
- o.style.pointerEvents = "";
27
+ function M(t) {
28
+ const r = o.get(t);
29
+ r && (r.disconnect(), o.delete(t)), t.style.pointerEvents = "";
13
30
  }
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(
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(
20
38
  () => {
21
- const e = a();
22
- return l(e) ? e : null;
39
+ const s = e();
40
+ return b(s) ? s : null;
23
41
  },
24
42
  { timeout: 1e3 }
25
43
  );
26
- u.then((e) => i.push(b(e, { pointerEvents: "auto" }))), i.push(y);
44
+ i.then((s) => u.push(d(s, { pointerEvents: "auto" }))), u.push(y);
27
45
  }), () => {
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()));
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()));
31
52
  };
32
53
  }
33
54
  export {
34
- E as assignPointerEventToLayers,
35
- h as clearPointerEvent,
36
- g as disablePointerEventsOutside
55
+ w as assignPointerEventToLayers,
56
+ M as clearPointerEvent,
57
+ B as disablePointerEventsOutside
37
58
  };
@@ -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"]), C = (t) => E.has(t), A = (t) => {
2
+ var E = /* @__PURE__ */ new Set(["menu", "listbox", "dialog", "grid", "tree", "region", "application"]), p = (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 && C(s) && !f && (e === o || e.contains(o) || l(e)))
18
+ if (s && p(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 p(t, o) {
27
+ function C(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 p(t, o) {
45
45
  }
46
46
  function x(t) {
47
47
  const o = /* @__PURE__ */ new Set();
48
- return p(t, (r) => {
48
+ return C(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
- p as findControlledElements,
69
+ C as findControlledElements,
70
70
  x as getControlledElements,
71
71
  v as hasControllerElements,
72
72
  y as isControlledByExpandedController,