@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.
- package/dist/components/BottomNavigation/BottomNavigation.d.ts +1 -1
- package/dist/components/DataTable/DataTableComponent.d.ts +1 -1
- package/dist/components/DataTable/table/BodyCheckbox.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.d.ts +1 -1
- package/dist/components/Tabs/TabItem.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/i18n/provider.d.ts +1 -1
- package/dist/node_modules/@zag-js/accordion/dist/accordion.connect.js +50 -49
- package/dist/node_modules/@zag-js/combobox/dist/combobox.connect.js +68 -70
- package/dist/node_modules/@zag-js/combobox/dist/combobox.machine.js +1 -1
- package/dist/node_modules/@zag-js/date-picker/dist/date-picker.connect.js +308 -322
- package/dist/node_modules/@zag-js/date-picker/dist/date-picker.machine.js +79 -93
- package/dist/node_modules/@zag-js/date-picker/dist/date-picker.utils.js +43 -35
- package/dist/node_modules/@zag-js/dialog/dist/dialog.dom.js +35 -36
- package/dist/node_modules/@zag-js/dialog/dist/dialog.machine.js +37 -27
- package/dist/node_modules/@zag-js/dismissable/dist/dismissable-layer.js +41 -56
- package/dist/node_modules/@zag-js/dismissable/dist/layer-stack.js +31 -51
- package/dist/node_modules/@zag-js/dismissable/dist/pointer-event-outside.js +25 -46
- package/dist/node_modules/@zag-js/dom-query/dist/controller.js +5 -5
- package/dist/node_modules/@zag-js/dom-query/dist/overflow.js +21 -13
- package/dist/node_modules/@zag-js/live-region/dist/index.js +19 -29
- package/dist/node_modules/@zag-js/menu/dist/menu.connect.js +135 -138
- package/dist/node_modules/@zag-js/menu/dist/menu.dom.js +24 -24
- package/dist/node_modules/@zag-js/menu/dist/menu.machine.js +1 -1
- package/dist/node_modules/@zag-js/popper/dist/get-placement.js +71 -82
- package/dist/node_modules/@zag-js/react/dist/machine.js +96 -105
- package/dist/node_modules/@zag-js/remove-scroll/dist/index.js +26 -34
- package/dist/node_modules/@zag-js/select/dist/select.connect.js +101 -104
- package/dist/node_modules/@zag-js/select/dist/select.machine.js +1 -1
- package/dist/node_modules/@zag-js/tabs/dist/tabs.machine.js +60 -63
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.connect.js +25 -27
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.dom.js +14 -15
- package/dist/theme/initColorScheme.d.ts +1 -1
- package/package.json +8 -8
- package/dist/node_modules/@zag-js/date-utils/dist/locale.js +0 -12
- package/dist/node_modules/@zag-js/dom-query/dist/scroll.js +0 -11
|
@@ -1,43 +1,42 @@
|
|
|
1
|
-
import { queryAll as
|
|
2
|
-
import { isFunction as
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
return ((
|
|
6
|
-
},
|
|
7
|
-
var
|
|
8
|
-
return ((
|
|
9
|
-
},
|
|
10
|
-
var
|
|
11
|
-
return ((
|
|
12
|
-
},
|
|
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
|
|
15
|
-
return
|
|
16
|
-
}, s = (
|
|
17
|
-
var
|
|
18
|
-
return ((
|
|
19
|
-
},
|
|
20
|
-
var
|
|
21
|
-
return ((
|
|
22
|
-
},
|
|
23
|
-
var
|
|
24
|
-
return ((
|
|
25
|
-
},
|
|
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
|
-
|
|
29
|
-
|
|
28
|
+
T as getBackdropEl,
|
|
29
|
+
a as getBackdropId,
|
|
30
30
|
k as getCloseTriggerEl,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
41
|
-
|
|
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
|
|
3
|
-
import { preventBodyScroll as
|
|
4
|
-
import {
|
|
5
|
-
import { createMachine as
|
|
6
|
-
import { raf as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
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 ? () =>
|
|
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 =
|
|
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
|
|
120
|
+
return k(() => l(e), {
|
|
120
121
|
type: "dialog",
|
|
121
122
|
defer: !0,
|
|
122
123
|
pointerBlocking: n("modal"),
|
|
123
|
-
|
|
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
|
|
144
|
+
return f(e.getDoc());
|
|
145
145
|
},
|
|
146
146
|
trapFocus({ scope: e, prop: t, context: n }) {
|
|
147
|
-
return t("trapFocus") ?
|
|
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
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
155
|
+
const a = n.get("triggerValue");
|
|
156
|
+
if (a) {
|
|
157
|
+
const g = E(e, a);
|
|
158
|
+
if (g) return g;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
return
|
|
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") ||
|
|
173
|
-
const n =
|
|
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
|
-
|
|
181
|
+
s(() => {
|
|
182
182
|
e.set("rendered", {
|
|
183
183
|
title: !!T(t),
|
|
184
|
-
description: !!
|
|
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
|
-
|
|
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
|
|
4
|
-
import { assignPointerEventToLayers as g, disablePointerEventsOutside as
|
|
5
|
-
import { raf as
|
|
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
|
|
9
|
-
import { isHTMLElement as
|
|
10
|
-
function
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
38
|
-
|
|
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
|
|
42
|
-
|
|
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
|
|
53
|
-
return l && u.push(...l), u.some((m) =>
|
|
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
|
-
|
|
57
|
-
L(t,
|
|
58
|
-
x(t, { exclude:
|
|
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
|
-
|
|
46
|
+
s.remove(t), g(), K(t), v.forEach((r) => r == null ? void 0 : r());
|
|
62
47
|
};
|
|
63
48
|
}
|
|
64
|
-
function
|
|
65
|
-
const { defer: f } = e,
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
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
|
-
|
|
57
|
+
c.forEach((i) => i == null ? void 0 : i());
|
|
73
58
|
};
|
|
74
59
|
}
|
|
75
|
-
function
|
|
76
|
-
const { defer: f } = e,
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
if (!
|
|
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
|
-
|
|
85
|
-
|
|
69
|
+
s.addBranch(i), c.push(() => {
|
|
70
|
+
s.removeBranch(i);
|
|
86
71
|
});
|
|
87
72
|
})
|
|
88
73
|
), () => {
|
|
89
|
-
|
|
74
|
+
c.forEach((i) => i == null ? void 0 : i());
|
|
90
75
|
};
|
|
91
76
|
}
|
|
92
77
|
export {
|
|
93
|
-
|
|
94
|
-
|
|
78
|
+
G as trackDismissableBranch,
|
|
79
|
+
F as trackDismissableElement
|
|
95
80
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
|
22
|
-
const t = this.indexOf(e),
|
|
23
|
-
return t <
|
|
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
|
|
37
|
-
return
|
|
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
|
|
41
|
-
if (!(
|
|
42
|
-
return this.layers.slice(0,
|
|
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((
|
|
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) =>
|
|
50
|
+
return Array.from(this.branches).some((t) => o(t, e));
|
|
52
51
|
},
|
|
53
52
|
add(e) {
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
|
|
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 =
|
|
95
|
-
}),
|
|
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:
|
|
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
|
|
107
|
-
s.
|
|
108
|
-
|
|
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
|
|
112
|
-
e.
|
|
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
|
-
|
|
102
|
+
c as layerStack
|
|
123
103
|
};
|
|
@@ -1,58 +1,37 @@
|
|
|
1
|
-
import { layerStack as
|
|
2
|
-
import { getDocument as
|
|
3
|
-
import { waitForElement as
|
|
4
|
-
import { setStyle as
|
|
5
|
-
var
|
|
6
|
-
function E(
|
|
7
|
-
|
|
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
|
|
28
|
-
|
|
29
|
-
r && (r.disconnect(), o.delete(t)), t.style.pointerEvents = "";
|
|
11
|
+
function h(o) {
|
|
12
|
+
o.style.pointerEvents = "";
|
|
30
13
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
40
|
-
return
|
|
21
|
+
const e = a();
|
|
22
|
+
return l(e) ? e : null;
|
|
41
23
|
},
|
|
42
24
|
{ timeout: 1e3 }
|
|
43
25
|
);
|
|
44
|
-
|
|
26
|
+
u.then((e) => i.push(b(e, { pointerEvents: "auto" }))), i.push(y);
|
|
45
27
|
}), () => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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"
|
|
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 &&
|
|
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
|
|
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
|
|
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
|
-
|
|
69
|
+
p as findControlledElements,
|
|
70
70
|
x as getControlledElements,
|
|
71
71
|
v as hasControllerElements,
|
|
72
72
|
y as isControlledByExpandedController,
|