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