claude-mux 0.7.0 → 0.7.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/README.md +4 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/web/client/_app/immutable/chunks/{DU91Ml7U.js → BGcEgn7w.js} +1 -1
- package/{web/.svelte-kit/output/client/_app/immutable/chunks/DmdO6ygw.js → dist/web/client/_app/immutable/chunks/By6CYjmE.js} +1 -1
- package/dist/web/client/_app/immutable/chunks/{HKNo9LID.js → CR5jMWGV.js} +1 -1
- package/{web/.svelte-kit/output/client/_app/immutable/entry/app.CGIBnoln.js → dist/web/client/_app/immutable/entry/app.DmtnygN7.js} +2 -2
- package/dist/web/client/_app/immutable/entry/start.fYmelGlC.js +1 -0
- package/dist/web/client/_app/immutable/nodes/{0.CqlJ9a31.js → 0.DGDAdwT5.js} +1 -1
- package/dist/web/client/_app/immutable/nodes/{1.BQUZh2-w.js → 1.Cg8dWgUN.js} +1 -1
- package/dist/web/client/_app/immutable/nodes/{2.CCV1YdgF.js → 2.DItUEo3e.js} +1 -1
- package/dist/web/client/_app/immutable/nodes/{3.D9tDCdq8.js → 3.dHui0twF.js} +1 -1
- package/dist/web/client/_app/immutable/nodes/{4.BqPyNkFA.js → 4.CiEHP0cr.js} +1 -1
- package/dist/web/client/_app/version.json +1 -1
- package/dist/web/server/chunks/{0-BHWsmCJv.js → 0-BmRg-l2z.js} +5 -5
- package/dist/web/server/chunks/{0-BHWsmCJv.js.map → 0-BmRg-l2z.js.map} +1 -1
- package/dist/web/server/chunks/{1-YRx6A8Tm.js → 1-CPgO8U7d.js} +3 -3
- package/dist/web/server/chunks/{1-YRx6A8Tm.js.map → 1-CPgO8U7d.js.map} +1 -1
- package/dist/web/server/chunks/{2-eC6JuGAo.js → 2--ZO5fZp_.js} +5 -5
- package/dist/web/server/chunks/{2-eC6JuGAo.js.map → 2--ZO5fZp_.js.map} +1 -1
- package/dist/web/server/chunks/{3-Bk-wV20p.js → 3-7HqSep9c.js} +3 -3
- package/dist/web/server/chunks/{3-Bk-wV20p.js.map → 3-7HqSep9c.js.map} +1 -1
- package/dist/web/server/chunks/{4-nteBgDrW.js → 4-C1PCdmY0.js} +4 -4
- package/dist/web/server/chunks/{4-nteBgDrW.js.map → 4-C1PCdmY0.js.map} +1 -1
- package/dist/web/server/index.js +1 -1
- package/dist/web/server/index.js.map +1 -1
- package/dist/web/server/manifest.js +10 -10
- package/dist/web/server/manifest.js.map +1 -1
- package/docs/release-checklist.md +8 -34
- package/docs/removing-hooks.md +14 -14
- package/package.json +1 -1
- package/src/cli.ts +1 -1
- package/src/utils/version.ts +1 -1
- package/web/.svelte-kit/adapter-bun/chunks/internal.js +1 -1
- package/web/.svelte-kit/adapter-bun/manifest-full.js +1 -1
- package/web/.svelte-kit/adapter-bun/manifest.js +1 -1
- package/web/.svelte-kit/adapter-bun/nodes/0.js +1 -1
- package/web/.svelte-kit/adapter-bun/nodes/1.js +1 -1
- package/web/.svelte-kit/adapter-bun/nodes/2.js +1 -1
- package/web/.svelte-kit/adapter-bun/nodes/3.js +1 -1
- package/web/.svelte-kit/adapter-bun/nodes/4.js +1 -1
- package/web/.svelte-kit/adapter-node/.vite/manifest.json +200 -15
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.DldLgTc-.css +1 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
- package/web/.svelte-kit/adapter-node/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
- package/web/.svelte-kit/adapter-node/chunks/alert-dialog-description.js +2670 -0
- package/web/.svelte-kit/adapter-node/chunks/auth.js +59 -0
- package/web/.svelte-kit/adapter-node/chunks/button.js +82 -0
- package/web/.svelte-kit/adapter-node/chunks/client.js +29 -0
- package/web/.svelte-kit/adapter-node/chunks/context.js +28 -16
- package/web/.svelte-kit/adapter-node/chunks/events.js +121 -0
- package/web/.svelte-kit/adapter-node/chunks/index.js +1 -1
- package/web/.svelte-kit/adapter-node/chunks/index2.js +186 -68
- package/web/.svelte-kit/adapter-node/chunks/internal.js +5 -90
- package/web/.svelte-kit/adapter-node/chunks/pane.js +82 -0
- package/web/.svelte-kit/adapter-node/chunks/sessions-json.js +16 -1
- package/web/.svelte-kit/adapter-node/chunks/sessions.svelte.js +174 -12
- package/web/.svelte-kit/adapter-node/chunks/ws-handlers.js +782 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/auth/login/_server.ts.js +22 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/beads/_server.ts.js +22 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/chrome/_server.ts.js +30 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/files/image/_server.ts.js +53 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +12 -6
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/send/_server.ts.js +11 -4
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_server.ts.js +1 -78
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_target_/output/_server.ts.js +2 -2
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
- package/web/.svelte-kit/adapter-node/entries/fallbacks/error.svelte.js +1 -18
- package/web/.svelte-kit/adapter-node/entries/hooks.server.js +105 -0
- package/web/.svelte-kit/adapter-node/entries/pages/_layout.svelte.js +493 -6
- package/web/.svelte-kit/adapter-node/entries/pages/_page.svelte.js +3024 -54
- package/web/.svelte-kit/adapter-node/entries/pages/login/_page.server.ts.js +15 -0
- package/web/.svelte-kit/adapter-node/entries/pages/login/_page.svelte.js +37 -0
- package/web/.svelte-kit/adapter-node/entries/pages/session/_target_/_page.svelte.js +623 -46
- package/web/.svelte-kit/adapter-node/manifest-full.js +67 -3
- package/web/.svelte-kit/adapter-node/manifest.js +67 -3
- package/web/.svelte-kit/adapter-node/nodes/0.js +2 -2
- package/web/.svelte-kit/adapter-node/nodes/1.js +1 -1
- package/web/.svelte-kit/adapter-node/nodes/2.js +2 -2
- package/web/.svelte-kit/adapter-node/nodes/3.js +6 -4
- package/web/.svelte-kit/adapter-node/nodes/4.js +8 -0
- package/web/.svelte-kit/ambient.d.ts +28 -2
- package/web/.svelte-kit/generated/server/internal.js +1 -1
- package/web/.svelte-kit/output/client/.vite/manifest.json +44 -44
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{DU91Ml7U.js → BGcEgn7w.js} +1 -1
- package/{dist/web/client/_app/immutable/chunks/DmdO6ygw.js → web/.svelte-kit/output/client/_app/immutable/chunks/By6CYjmE.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{HKNo9LID.js → CR5jMWGV.js} +1 -1
- package/{dist/web/client/_app/immutable/entry/app.CGIBnoln.js → web/.svelte-kit/output/client/_app/immutable/entry/app.DmtnygN7.js} +2 -2
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.fYmelGlC.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{0.CqlJ9a31.js → 0.DGDAdwT5.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{1.BQUZh2-w.js → 1.Cg8dWgUN.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{2.CCV1YdgF.js → 2.DItUEo3e.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{3.D9tDCdq8.js → 3.dHui0twF.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{4.BqPyNkFA.js → 4.CiEHP0cr.js} +1 -1
- package/web/.svelte-kit/output/client/_app/version.json +1 -1
- package/web/.svelte-kit/output/server/chunks/internal.js +1 -1
- package/web/.svelte-kit/output/server/manifest-full.js +1 -1
- package/web/.svelte-kit/output/server/manifest.js +1 -1
- package/web/.svelte-kit/output/server/nodes/0.js +1 -1
- package/web/.svelte-kit/output/server/nodes/1.js +1 -1
- package/web/.svelte-kit/output/server/nodes/2.js +1 -1
- package/web/.svelte-kit/output/server/nodes/3.js +1 -1
- package/web/.svelte-kit/output/server/nodes/4.js +1 -1
- package/dist/web/client/_app/immutable/entry/start.CJk8zB1j.js +0 -1
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_layout.4NiX29PU.css +0 -1
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.BEMzYUGV.css +0 -1
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.DOJn7TG7.css +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.CJk8zB1j.js +0 -1
|
@@ -0,0 +1,2670 @@
|
|
|
1
|
+
import { ac as ATTACHMENT_KEY, a5 as derived, a7 as bind_props, a9 as props_id, a6 as attributes, a8 as spread_props, aa as clsx$1 } from "./index2.js";
|
|
2
|
+
import { c as cn, b as buttonVariants } from "./button.js";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { h as hasContext, g as getContext, s as setContext, r as run, c as getAllContexts } from "./context.js";
|
|
5
|
+
import { t as tick, m as mount, u as unmount } from "./sessions.svelte.js";
|
|
6
|
+
import { o as on } from "./events.js";
|
|
7
|
+
import { tabbable, focusable, isFocusable } from "tabbable";
|
|
8
|
+
import parse from "style-to-object";
|
|
9
|
+
function createAttachmentKey() {
|
|
10
|
+
return Symbol(ATTACHMENT_KEY);
|
|
11
|
+
}
|
|
12
|
+
function isObject(value) {
|
|
13
|
+
return value !== null && typeof value === "object";
|
|
14
|
+
}
|
|
15
|
+
const CLASS_VALUE_PRIMITIVE_TYPES = ["string", "number", "bigint", "boolean"];
|
|
16
|
+
function isClassValue(value) {
|
|
17
|
+
if (value === null || value === void 0)
|
|
18
|
+
return true;
|
|
19
|
+
if (CLASS_VALUE_PRIMITIVE_TYPES.includes(typeof value))
|
|
20
|
+
return true;
|
|
21
|
+
if (Array.isArray(value))
|
|
22
|
+
return value.every((item) => isClassValue(item));
|
|
23
|
+
if (typeof value === "object") {
|
|
24
|
+
if (Object.getPrototypeOf(value) !== Object.prototype)
|
|
25
|
+
return false;
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const BoxSymbol = /* @__PURE__ */ Symbol("box");
|
|
31
|
+
const isWritableSymbol = /* @__PURE__ */ Symbol("is-writable");
|
|
32
|
+
function boxWith(getter, setter) {
|
|
33
|
+
const derived2 = getter();
|
|
34
|
+
if (setter) {
|
|
35
|
+
return {
|
|
36
|
+
[BoxSymbol]: true,
|
|
37
|
+
[isWritableSymbol]: true,
|
|
38
|
+
get current() {
|
|
39
|
+
return derived2;
|
|
40
|
+
},
|
|
41
|
+
set current(v) {
|
|
42
|
+
setter(v);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
[BoxSymbol]: true,
|
|
48
|
+
get current() {
|
|
49
|
+
return getter();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function isBox(value) {
|
|
54
|
+
return isObject(value) && BoxSymbol in value;
|
|
55
|
+
}
|
|
56
|
+
function simpleBox(initialValue) {
|
|
57
|
+
let current = initialValue;
|
|
58
|
+
return {
|
|
59
|
+
[BoxSymbol]: true,
|
|
60
|
+
[isWritableSymbol]: true,
|
|
61
|
+
get current() {
|
|
62
|
+
return current;
|
|
63
|
+
},
|
|
64
|
+
set current(v) {
|
|
65
|
+
current = v;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function composeHandlers(...handlers) {
|
|
70
|
+
return function(e) {
|
|
71
|
+
for (const handler of handlers) {
|
|
72
|
+
if (!handler)
|
|
73
|
+
continue;
|
|
74
|
+
if (e.defaultPrevented)
|
|
75
|
+
return;
|
|
76
|
+
if (typeof handler === "function") {
|
|
77
|
+
handler.call(this, e);
|
|
78
|
+
} else {
|
|
79
|
+
handler.current?.call(this, e);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const NUMBER_CHAR_RE = /\d/;
|
|
85
|
+
const STR_SPLITTERS = ["-", "_", "/", "."];
|
|
86
|
+
function isUppercase(char = "") {
|
|
87
|
+
if (NUMBER_CHAR_RE.test(char))
|
|
88
|
+
return void 0;
|
|
89
|
+
return char !== char.toLowerCase();
|
|
90
|
+
}
|
|
91
|
+
function splitByCase(str) {
|
|
92
|
+
const parts = [];
|
|
93
|
+
let buff = "";
|
|
94
|
+
let previousUpper;
|
|
95
|
+
let previousSplitter;
|
|
96
|
+
for (const char of str) {
|
|
97
|
+
const isSplitter = STR_SPLITTERS.includes(char);
|
|
98
|
+
if (isSplitter === true) {
|
|
99
|
+
parts.push(buff);
|
|
100
|
+
buff = "";
|
|
101
|
+
previousUpper = void 0;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const isUpper = isUppercase(char);
|
|
105
|
+
if (previousSplitter === false) {
|
|
106
|
+
if (previousUpper === false && isUpper === true) {
|
|
107
|
+
parts.push(buff);
|
|
108
|
+
buff = char;
|
|
109
|
+
previousUpper = isUpper;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
|
113
|
+
const lastChar = buff.at(-1);
|
|
114
|
+
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
|
115
|
+
buff = lastChar + char;
|
|
116
|
+
previousUpper = isUpper;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
buff += char;
|
|
121
|
+
previousUpper = isUpper;
|
|
122
|
+
previousSplitter = isSplitter;
|
|
123
|
+
}
|
|
124
|
+
parts.push(buff);
|
|
125
|
+
return parts;
|
|
126
|
+
}
|
|
127
|
+
function pascalCase(str) {
|
|
128
|
+
if (!str)
|
|
129
|
+
return "";
|
|
130
|
+
return splitByCase(str).map((p) => upperFirst(p)).join("");
|
|
131
|
+
}
|
|
132
|
+
function camelCase(str) {
|
|
133
|
+
return lowerFirst(pascalCase(str || ""));
|
|
134
|
+
}
|
|
135
|
+
function upperFirst(str) {
|
|
136
|
+
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
|
137
|
+
}
|
|
138
|
+
function lowerFirst(str) {
|
|
139
|
+
return str ? str[0].toLowerCase() + str.slice(1) : "";
|
|
140
|
+
}
|
|
141
|
+
function cssToStyleObj(css) {
|
|
142
|
+
if (!css)
|
|
143
|
+
return {};
|
|
144
|
+
const styleObj = {};
|
|
145
|
+
function iterator(name, value) {
|
|
146
|
+
if (name.startsWith("-moz-") || name.startsWith("-webkit-") || name.startsWith("-ms-") || name.startsWith("-o-")) {
|
|
147
|
+
styleObj[pascalCase(name)] = value;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (name.startsWith("--")) {
|
|
151
|
+
styleObj[name] = value;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
styleObj[camelCase(name)] = value;
|
|
155
|
+
}
|
|
156
|
+
parse(css, iterator);
|
|
157
|
+
return styleObj;
|
|
158
|
+
}
|
|
159
|
+
function executeCallbacks(...callbacks) {
|
|
160
|
+
return (...args) => {
|
|
161
|
+
for (const callback of callbacks) {
|
|
162
|
+
if (typeof callback === "function") {
|
|
163
|
+
callback(...args);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function createParser(matcher, replacer) {
|
|
169
|
+
const regex = RegExp(matcher, "g");
|
|
170
|
+
return (str) => {
|
|
171
|
+
if (typeof str !== "string") {
|
|
172
|
+
throw new TypeError(`expected an argument of type string, but got ${typeof str}`);
|
|
173
|
+
}
|
|
174
|
+
if (!str.match(regex))
|
|
175
|
+
return str;
|
|
176
|
+
return str.replace(regex, replacer);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const camelToKebab = createParser(/[A-Z]/, (match) => `-${match.toLowerCase()}`);
|
|
180
|
+
function styleToCSS(styleObj) {
|
|
181
|
+
if (!styleObj || typeof styleObj !== "object" || Array.isArray(styleObj)) {
|
|
182
|
+
throw new TypeError(`expected an argument of type object, but got ${typeof styleObj}`);
|
|
183
|
+
}
|
|
184
|
+
return Object.keys(styleObj).map((property) => `${camelToKebab(property)}: ${styleObj[property]};`).join("\n");
|
|
185
|
+
}
|
|
186
|
+
function styleToString(style = {}) {
|
|
187
|
+
return styleToCSS(style).replace("\n", " ");
|
|
188
|
+
}
|
|
189
|
+
const EVENT_LIST = [
|
|
190
|
+
"onabort",
|
|
191
|
+
"onanimationcancel",
|
|
192
|
+
"onanimationend",
|
|
193
|
+
"onanimationiteration",
|
|
194
|
+
"onanimationstart",
|
|
195
|
+
"onauxclick",
|
|
196
|
+
"onbeforeinput",
|
|
197
|
+
"onbeforetoggle",
|
|
198
|
+
"onblur",
|
|
199
|
+
"oncancel",
|
|
200
|
+
"oncanplay",
|
|
201
|
+
"oncanplaythrough",
|
|
202
|
+
"onchange",
|
|
203
|
+
"onclick",
|
|
204
|
+
"onclose",
|
|
205
|
+
"oncompositionend",
|
|
206
|
+
"oncompositionstart",
|
|
207
|
+
"oncompositionupdate",
|
|
208
|
+
"oncontextlost",
|
|
209
|
+
"oncontextmenu",
|
|
210
|
+
"oncontextrestored",
|
|
211
|
+
"oncopy",
|
|
212
|
+
"oncuechange",
|
|
213
|
+
"oncut",
|
|
214
|
+
"ondblclick",
|
|
215
|
+
"ondrag",
|
|
216
|
+
"ondragend",
|
|
217
|
+
"ondragenter",
|
|
218
|
+
"ondragleave",
|
|
219
|
+
"ondragover",
|
|
220
|
+
"ondragstart",
|
|
221
|
+
"ondrop",
|
|
222
|
+
"ondurationchange",
|
|
223
|
+
"onemptied",
|
|
224
|
+
"onended",
|
|
225
|
+
"onerror",
|
|
226
|
+
"onfocus",
|
|
227
|
+
"onfocusin",
|
|
228
|
+
"onfocusout",
|
|
229
|
+
"onformdata",
|
|
230
|
+
"ongotpointercapture",
|
|
231
|
+
"oninput",
|
|
232
|
+
"oninvalid",
|
|
233
|
+
"onkeydown",
|
|
234
|
+
"onkeypress",
|
|
235
|
+
"onkeyup",
|
|
236
|
+
"onload",
|
|
237
|
+
"onloadeddata",
|
|
238
|
+
"onloadedmetadata",
|
|
239
|
+
"onloadstart",
|
|
240
|
+
"onlostpointercapture",
|
|
241
|
+
"onmousedown",
|
|
242
|
+
"onmouseenter",
|
|
243
|
+
"onmouseleave",
|
|
244
|
+
"onmousemove",
|
|
245
|
+
"onmouseout",
|
|
246
|
+
"onmouseover",
|
|
247
|
+
"onmouseup",
|
|
248
|
+
"onpaste",
|
|
249
|
+
"onpause",
|
|
250
|
+
"onplay",
|
|
251
|
+
"onplaying",
|
|
252
|
+
"onpointercancel",
|
|
253
|
+
"onpointerdown",
|
|
254
|
+
"onpointerenter",
|
|
255
|
+
"onpointerleave",
|
|
256
|
+
"onpointermove",
|
|
257
|
+
"onpointerout",
|
|
258
|
+
"onpointerover",
|
|
259
|
+
"onpointerup",
|
|
260
|
+
"onprogress",
|
|
261
|
+
"onratechange",
|
|
262
|
+
"onreset",
|
|
263
|
+
"onresize",
|
|
264
|
+
"onscroll",
|
|
265
|
+
"onscrollend",
|
|
266
|
+
"onsecuritypolicyviolation",
|
|
267
|
+
"onseeked",
|
|
268
|
+
"onseeking",
|
|
269
|
+
"onselect",
|
|
270
|
+
"onselectionchange",
|
|
271
|
+
"onselectstart",
|
|
272
|
+
"onslotchange",
|
|
273
|
+
"onstalled",
|
|
274
|
+
"onsubmit",
|
|
275
|
+
"onsuspend",
|
|
276
|
+
"ontimeupdate",
|
|
277
|
+
"ontoggle",
|
|
278
|
+
"ontouchcancel",
|
|
279
|
+
"ontouchend",
|
|
280
|
+
"ontouchmove",
|
|
281
|
+
"ontouchstart",
|
|
282
|
+
"ontransitioncancel",
|
|
283
|
+
"ontransitionend",
|
|
284
|
+
"ontransitionrun",
|
|
285
|
+
"ontransitionstart",
|
|
286
|
+
"onvolumechange",
|
|
287
|
+
"onwaiting",
|
|
288
|
+
"onwebkitanimationend",
|
|
289
|
+
"onwebkitanimationiteration",
|
|
290
|
+
"onwebkitanimationstart",
|
|
291
|
+
"onwebkittransitionend",
|
|
292
|
+
"onwheel"
|
|
293
|
+
];
|
|
294
|
+
const EVENT_LIST_SET = new Set(EVENT_LIST);
|
|
295
|
+
function isEventHandler(key) {
|
|
296
|
+
return EVENT_LIST_SET.has(key);
|
|
297
|
+
}
|
|
298
|
+
function mergeProps(...args) {
|
|
299
|
+
const result = { ...args[0] };
|
|
300
|
+
for (let i = 1; i < args.length; i++) {
|
|
301
|
+
const props = args[i];
|
|
302
|
+
if (!props)
|
|
303
|
+
continue;
|
|
304
|
+
for (const key of Object.keys(props)) {
|
|
305
|
+
const a = result[key];
|
|
306
|
+
const b = props[key];
|
|
307
|
+
const aIsFunction = typeof a === "function";
|
|
308
|
+
const bIsFunction = typeof b === "function";
|
|
309
|
+
if (aIsFunction && typeof bIsFunction && isEventHandler(key)) {
|
|
310
|
+
const aHandler = a;
|
|
311
|
+
const bHandler = b;
|
|
312
|
+
result[key] = composeHandlers(aHandler, bHandler);
|
|
313
|
+
} else if (aIsFunction && bIsFunction) {
|
|
314
|
+
result[key] = executeCallbacks(a, b);
|
|
315
|
+
} else if (key === "class") {
|
|
316
|
+
const aIsClassValue = isClassValue(a);
|
|
317
|
+
const bIsClassValue = isClassValue(b);
|
|
318
|
+
if (aIsClassValue && bIsClassValue) {
|
|
319
|
+
result[key] = clsx(a, b);
|
|
320
|
+
} else if (aIsClassValue) {
|
|
321
|
+
result[key] = clsx(a);
|
|
322
|
+
} else if (bIsClassValue) {
|
|
323
|
+
result[key] = clsx(b);
|
|
324
|
+
}
|
|
325
|
+
} else if (key === "style") {
|
|
326
|
+
const aIsObject = typeof a === "object";
|
|
327
|
+
const bIsObject = typeof b === "object";
|
|
328
|
+
const aIsString = typeof a === "string";
|
|
329
|
+
const bIsString = typeof b === "string";
|
|
330
|
+
if (aIsObject && bIsObject) {
|
|
331
|
+
result[key] = { ...a, ...b };
|
|
332
|
+
} else if (aIsObject && bIsString) {
|
|
333
|
+
const parsedStyle = cssToStyleObj(b);
|
|
334
|
+
result[key] = { ...a, ...parsedStyle };
|
|
335
|
+
} else if (aIsString && bIsObject) {
|
|
336
|
+
const parsedStyle = cssToStyleObj(a);
|
|
337
|
+
result[key] = { ...parsedStyle, ...b };
|
|
338
|
+
} else if (aIsString && bIsString) {
|
|
339
|
+
const parsedStyleA = cssToStyleObj(a);
|
|
340
|
+
const parsedStyleB = cssToStyleObj(b);
|
|
341
|
+
result[key] = { ...parsedStyleA, ...parsedStyleB };
|
|
342
|
+
} else if (aIsObject) {
|
|
343
|
+
result[key] = a;
|
|
344
|
+
} else if (bIsObject) {
|
|
345
|
+
result[key] = b;
|
|
346
|
+
} else if (aIsString) {
|
|
347
|
+
result[key] = a;
|
|
348
|
+
} else if (bIsString) {
|
|
349
|
+
result[key] = b;
|
|
350
|
+
}
|
|
351
|
+
} else {
|
|
352
|
+
result[key] = b !== void 0 ? b : a;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
for (const key of Object.getOwnPropertySymbols(props)) {
|
|
356
|
+
const a = result[key];
|
|
357
|
+
const b = props[key];
|
|
358
|
+
result[key] = b !== void 0 ? b : a;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (typeof result.style === "object") {
|
|
362
|
+
result.style = styleToString(result.style).replaceAll("\n", " ");
|
|
363
|
+
}
|
|
364
|
+
if (result.hidden === false) {
|
|
365
|
+
result.hidden = void 0;
|
|
366
|
+
delete result.hidden;
|
|
367
|
+
}
|
|
368
|
+
if (result.disabled === false) {
|
|
369
|
+
result.disabled = void 0;
|
|
370
|
+
delete result.disabled;
|
|
371
|
+
}
|
|
372
|
+
return result;
|
|
373
|
+
}
|
|
374
|
+
const defaultWindow = void 0;
|
|
375
|
+
function getActiveElement$1(document2) {
|
|
376
|
+
let activeElement = document2.activeElement;
|
|
377
|
+
while (activeElement?.shadowRoot) {
|
|
378
|
+
const node = activeElement.shadowRoot.activeElement;
|
|
379
|
+
if (node === activeElement)
|
|
380
|
+
break;
|
|
381
|
+
else
|
|
382
|
+
activeElement = node;
|
|
383
|
+
}
|
|
384
|
+
return activeElement;
|
|
385
|
+
}
|
|
386
|
+
const SvelteMap = globalThis.Map;
|
|
387
|
+
function createSubscriber(_) {
|
|
388
|
+
return () => {
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
class ActiveElement {
|
|
392
|
+
#document;
|
|
393
|
+
#subscribe;
|
|
394
|
+
constructor(options = {}) {
|
|
395
|
+
const { window: window2 = defaultWindow, document: document2 = window2?.document } = options;
|
|
396
|
+
if (window2 === void 0) return;
|
|
397
|
+
this.#document = document2;
|
|
398
|
+
this.#subscribe = createSubscriber();
|
|
399
|
+
}
|
|
400
|
+
get current() {
|
|
401
|
+
this.#subscribe?.();
|
|
402
|
+
if (!this.#document) return null;
|
|
403
|
+
return getActiveElement$1(this.#document);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
new ActiveElement();
|
|
407
|
+
class Context {
|
|
408
|
+
#name;
|
|
409
|
+
#key;
|
|
410
|
+
/**
|
|
411
|
+
* @param name The name of the context.
|
|
412
|
+
* This is used for generating the context key and error messages.
|
|
413
|
+
*/
|
|
414
|
+
constructor(name) {
|
|
415
|
+
this.#name = name;
|
|
416
|
+
this.#key = Symbol(name);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* The key used to get and set the context.
|
|
420
|
+
*
|
|
421
|
+
* It is not recommended to use this value directly.
|
|
422
|
+
* Instead, use the methods provided by this class.
|
|
423
|
+
*/
|
|
424
|
+
get key() {
|
|
425
|
+
return this.#key;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Checks whether this has been set in the context of a parent component.
|
|
429
|
+
*
|
|
430
|
+
* Must be called during component initialisation.
|
|
431
|
+
*/
|
|
432
|
+
exists() {
|
|
433
|
+
return hasContext(this.#key);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Retrieves the context that belongs to the closest parent component.
|
|
437
|
+
*
|
|
438
|
+
* Must be called during component initialisation.
|
|
439
|
+
*
|
|
440
|
+
* @throws An error if the context does not exist.
|
|
441
|
+
*/
|
|
442
|
+
get() {
|
|
443
|
+
const context = getContext(this.#key);
|
|
444
|
+
if (context === void 0) {
|
|
445
|
+
throw new Error(`Context "${this.#name}" not found`);
|
|
446
|
+
}
|
|
447
|
+
return context;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Retrieves the context that belongs to the closest parent component,
|
|
451
|
+
* or the given fallback value if the context does not exist.
|
|
452
|
+
*
|
|
453
|
+
* Must be called during component initialisation.
|
|
454
|
+
*/
|
|
455
|
+
getOr(fallback) {
|
|
456
|
+
const context = getContext(this.#key);
|
|
457
|
+
if (context === void 0) {
|
|
458
|
+
return fallback;
|
|
459
|
+
}
|
|
460
|
+
return context;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Associates the given value with the current component and returns it.
|
|
464
|
+
*
|
|
465
|
+
* Must be called during component initialisation.
|
|
466
|
+
*/
|
|
467
|
+
set(context) {
|
|
468
|
+
return setContext(this.#key, context);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function runWatcher(sources, flush, effect, options = {}) {
|
|
472
|
+
const { lazy = false } = options;
|
|
473
|
+
}
|
|
474
|
+
function watch(sources, effect, options) {
|
|
475
|
+
runWatcher(sources, "post", effect, options);
|
|
476
|
+
}
|
|
477
|
+
function watchPre(sources, effect, options) {
|
|
478
|
+
runWatcher(sources, "pre", effect, options);
|
|
479
|
+
}
|
|
480
|
+
watch.pre = watchPre;
|
|
481
|
+
function afterSleep(ms, cb) {
|
|
482
|
+
return setTimeout(cb, ms);
|
|
483
|
+
}
|
|
484
|
+
function afterTick(fn) {
|
|
485
|
+
tick().then(fn);
|
|
486
|
+
}
|
|
487
|
+
const ELEMENT_NODE = 1;
|
|
488
|
+
const DOCUMENT_NODE = 9;
|
|
489
|
+
const DOCUMENT_FRAGMENT_NODE = 11;
|
|
490
|
+
function isHTMLElement$1(node) {
|
|
491
|
+
return isObject(node) && node.nodeType === ELEMENT_NODE && typeof node.nodeName === "string";
|
|
492
|
+
}
|
|
493
|
+
function isDocument(node) {
|
|
494
|
+
return isObject(node) && node.nodeType === DOCUMENT_NODE;
|
|
495
|
+
}
|
|
496
|
+
function isWindow(node) {
|
|
497
|
+
return isObject(node) && node.constructor?.name === "VisualViewport";
|
|
498
|
+
}
|
|
499
|
+
function isNode(node) {
|
|
500
|
+
return isObject(node) && node.nodeType !== void 0;
|
|
501
|
+
}
|
|
502
|
+
function isShadowRoot(node) {
|
|
503
|
+
return isNode(node) && node.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in node;
|
|
504
|
+
}
|
|
505
|
+
function contains(parent, child) {
|
|
506
|
+
if (!parent || !child)
|
|
507
|
+
return false;
|
|
508
|
+
if (!isHTMLElement$1(parent) || !isHTMLElement$1(child))
|
|
509
|
+
return false;
|
|
510
|
+
const rootNode = child.getRootNode?.();
|
|
511
|
+
if (parent === child)
|
|
512
|
+
return true;
|
|
513
|
+
if (parent.contains(child))
|
|
514
|
+
return true;
|
|
515
|
+
if (rootNode && isShadowRoot(rootNode)) {
|
|
516
|
+
let next = child;
|
|
517
|
+
while (next) {
|
|
518
|
+
if (parent === next)
|
|
519
|
+
return true;
|
|
520
|
+
next = next.parentNode || next.host;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
function getDocument(node) {
|
|
526
|
+
if (isDocument(node))
|
|
527
|
+
return node;
|
|
528
|
+
if (isWindow(node))
|
|
529
|
+
return node.document;
|
|
530
|
+
return node?.ownerDocument ?? document;
|
|
531
|
+
}
|
|
532
|
+
function getActiveElement(rootNode) {
|
|
533
|
+
let activeElement = rootNode.activeElement;
|
|
534
|
+
while (activeElement?.shadowRoot) {
|
|
535
|
+
const el = activeElement.shadowRoot.activeElement;
|
|
536
|
+
if (el === activeElement)
|
|
537
|
+
break;
|
|
538
|
+
else
|
|
539
|
+
activeElement = el;
|
|
540
|
+
}
|
|
541
|
+
return activeElement;
|
|
542
|
+
}
|
|
543
|
+
class DOMContext {
|
|
544
|
+
element;
|
|
545
|
+
#root = derived(() => {
|
|
546
|
+
if (!this.element.current) return document;
|
|
547
|
+
const rootNode = this.element.current.getRootNode() ?? document;
|
|
548
|
+
return rootNode;
|
|
549
|
+
});
|
|
550
|
+
get root() {
|
|
551
|
+
return this.#root();
|
|
552
|
+
}
|
|
553
|
+
set root($$value) {
|
|
554
|
+
return this.#root($$value);
|
|
555
|
+
}
|
|
556
|
+
constructor(element) {
|
|
557
|
+
if (typeof element === "function") {
|
|
558
|
+
this.element = boxWith(element);
|
|
559
|
+
} else {
|
|
560
|
+
this.element = element;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
getDocument = () => {
|
|
564
|
+
return getDocument(this.root);
|
|
565
|
+
};
|
|
566
|
+
getWindow = () => {
|
|
567
|
+
return this.getDocument().defaultView ?? window;
|
|
568
|
+
};
|
|
569
|
+
getActiveElement = () => {
|
|
570
|
+
return getActiveElement(this.root);
|
|
571
|
+
};
|
|
572
|
+
isActiveElement = (node) => {
|
|
573
|
+
return node === this.getActiveElement();
|
|
574
|
+
};
|
|
575
|
+
getElementById(id) {
|
|
576
|
+
return this.root.getElementById(id);
|
|
577
|
+
}
|
|
578
|
+
querySelector = (selector) => {
|
|
579
|
+
if (!this.root) return null;
|
|
580
|
+
return this.root.querySelector(selector);
|
|
581
|
+
};
|
|
582
|
+
querySelectorAll = (selector) => {
|
|
583
|
+
if (!this.root) return [];
|
|
584
|
+
return this.root.querySelectorAll(selector);
|
|
585
|
+
};
|
|
586
|
+
setTimeout = (callback, delay) => {
|
|
587
|
+
return this.getWindow().setTimeout(callback, delay);
|
|
588
|
+
};
|
|
589
|
+
clearTimeout = (timeoutId) => {
|
|
590
|
+
return this.getWindow().clearTimeout(timeoutId);
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
function attachRef(ref, onChange) {
|
|
594
|
+
return {
|
|
595
|
+
[createAttachmentKey()]: (node) => {
|
|
596
|
+
if (isBox(ref)) {
|
|
597
|
+
ref.current = node;
|
|
598
|
+
run(() => onChange?.(node));
|
|
599
|
+
return () => {
|
|
600
|
+
if ("isConnected" in node && node.isConnected)
|
|
601
|
+
return;
|
|
602
|
+
ref.current = null;
|
|
603
|
+
onChange?.(null);
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
ref(node);
|
|
607
|
+
run(() => onChange?.(node));
|
|
608
|
+
return () => {
|
|
609
|
+
if ("isConnected" in node && node.isConnected)
|
|
610
|
+
return;
|
|
611
|
+
ref(null);
|
|
612
|
+
onChange?.(null);
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function boolToStr(condition) {
|
|
618
|
+
return condition ? "true" : "false";
|
|
619
|
+
}
|
|
620
|
+
function boolToEmptyStrOrUndef(condition) {
|
|
621
|
+
return condition ? "" : void 0;
|
|
622
|
+
}
|
|
623
|
+
function getDataOpenClosed(condition) {
|
|
624
|
+
return condition ? "open" : "closed";
|
|
625
|
+
}
|
|
626
|
+
function getAriaChecked(checked, indeterminate) {
|
|
627
|
+
if (indeterminate) {
|
|
628
|
+
return "mixed";
|
|
629
|
+
}
|
|
630
|
+
return checked ? "true" : "false";
|
|
631
|
+
}
|
|
632
|
+
class BitsAttrs {
|
|
633
|
+
#variant;
|
|
634
|
+
#prefix;
|
|
635
|
+
attrs;
|
|
636
|
+
constructor(config) {
|
|
637
|
+
this.#variant = config.getVariant ? config.getVariant() : null;
|
|
638
|
+
this.#prefix = this.#variant ? `data-${this.#variant}-` : `data-${config.component}-`;
|
|
639
|
+
this.getAttr = this.getAttr.bind(this);
|
|
640
|
+
this.selector = this.selector.bind(this);
|
|
641
|
+
this.attrs = Object.fromEntries(config.parts.map((part) => [part, this.getAttr(part)]));
|
|
642
|
+
}
|
|
643
|
+
getAttr(part, variantOverride) {
|
|
644
|
+
if (variantOverride)
|
|
645
|
+
return `data-${variantOverride}-${part}`;
|
|
646
|
+
return `${this.#prefix}${part}`;
|
|
647
|
+
}
|
|
648
|
+
selector(part, variantOverride) {
|
|
649
|
+
return `[${this.getAttr(part, variantOverride)}]`;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function createBitsAttrs(config) {
|
|
653
|
+
const bitsAttrs = new BitsAttrs(config);
|
|
654
|
+
return {
|
|
655
|
+
...bitsAttrs.attrs,
|
|
656
|
+
selector: bitsAttrs.selector,
|
|
657
|
+
getAttr: bitsAttrs.getAttr
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
const ENTER = "Enter";
|
|
661
|
+
const ESCAPE = "Escape";
|
|
662
|
+
const SPACE = " ";
|
|
663
|
+
const isBrowser = typeof document !== "undefined";
|
|
664
|
+
const isIOS = getIsIOS();
|
|
665
|
+
function getIsIOS() {
|
|
666
|
+
return isBrowser && window?.navigator?.userAgent && (/iP(ad|hone|od)/.test(window.navigator.userAgent) || // The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh.
|
|
667
|
+
window?.navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
|
|
668
|
+
}
|
|
669
|
+
function isHTMLElement(element) {
|
|
670
|
+
return element instanceof HTMLElement;
|
|
671
|
+
}
|
|
672
|
+
function isElementOrSVGElement(element) {
|
|
673
|
+
return element instanceof Element || element instanceof SVGElement;
|
|
674
|
+
}
|
|
675
|
+
class AnimationsComplete {
|
|
676
|
+
#opts;
|
|
677
|
+
#currentFrame = null;
|
|
678
|
+
constructor(opts) {
|
|
679
|
+
this.#opts = opts;
|
|
680
|
+
}
|
|
681
|
+
#cleanup() {
|
|
682
|
+
if (!this.#currentFrame)
|
|
683
|
+
return;
|
|
684
|
+
window.cancelAnimationFrame(this.#currentFrame);
|
|
685
|
+
this.#currentFrame = null;
|
|
686
|
+
}
|
|
687
|
+
run(fn) {
|
|
688
|
+
this.#cleanup();
|
|
689
|
+
const node = this.#opts.ref.current;
|
|
690
|
+
if (!node)
|
|
691
|
+
return;
|
|
692
|
+
if (typeof node.getAnimations !== "function") {
|
|
693
|
+
this.#executeCallback(fn);
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
this.#currentFrame = window.requestAnimationFrame(() => {
|
|
697
|
+
const animations = node.getAnimations();
|
|
698
|
+
if (animations.length === 0) {
|
|
699
|
+
this.#executeCallback(fn);
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {
|
|
703
|
+
this.#executeCallback(fn);
|
|
704
|
+
});
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
#executeCallback(fn) {
|
|
708
|
+
const execute = () => {
|
|
709
|
+
fn();
|
|
710
|
+
};
|
|
711
|
+
if (this.#opts.afterTick) {
|
|
712
|
+
afterTick(execute);
|
|
713
|
+
} else {
|
|
714
|
+
execute();
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
class PresenceManager {
|
|
719
|
+
#opts;
|
|
720
|
+
#enabled;
|
|
721
|
+
#afterAnimations;
|
|
722
|
+
#shouldRender = false;
|
|
723
|
+
constructor(opts) {
|
|
724
|
+
this.#opts = opts;
|
|
725
|
+
this.#shouldRender = opts.open.current;
|
|
726
|
+
this.#enabled = opts.enabled ?? true;
|
|
727
|
+
this.#afterAnimations = new AnimationsComplete({ ref: this.#opts.ref, afterTick: this.#opts.open });
|
|
728
|
+
watch(() => this.#opts.open.current, (isOpen) => {
|
|
729
|
+
if (isOpen) this.#shouldRender = true;
|
|
730
|
+
if (!this.#enabled) return;
|
|
731
|
+
this.#afterAnimations.run(() => {
|
|
732
|
+
if (isOpen === this.#opts.open.current) {
|
|
733
|
+
if (!this.#opts.open.current) {
|
|
734
|
+
this.#shouldRender = false;
|
|
735
|
+
}
|
|
736
|
+
this.#opts.onComplete?.();
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
get shouldRender() {
|
|
742
|
+
return this.#shouldRender;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
function noop() {
|
|
746
|
+
}
|
|
747
|
+
function createId(prefixOrUid, uid) {
|
|
748
|
+
return `bits-${prefixOrUid}`;
|
|
749
|
+
}
|
|
750
|
+
const dialogAttrs = createBitsAttrs({
|
|
751
|
+
component: "dialog",
|
|
752
|
+
parts: [
|
|
753
|
+
"content",
|
|
754
|
+
"trigger",
|
|
755
|
+
"overlay",
|
|
756
|
+
"title",
|
|
757
|
+
"description",
|
|
758
|
+
"close",
|
|
759
|
+
"cancel",
|
|
760
|
+
"action"
|
|
761
|
+
]
|
|
762
|
+
});
|
|
763
|
+
const DialogRootContext = new Context("Dialog.Root | AlertDialog.Root");
|
|
764
|
+
class DialogRootState {
|
|
765
|
+
static create(opts) {
|
|
766
|
+
const parent = DialogRootContext.getOr(null);
|
|
767
|
+
return DialogRootContext.set(new DialogRootState(opts, parent));
|
|
768
|
+
}
|
|
769
|
+
opts;
|
|
770
|
+
triggerNode = null;
|
|
771
|
+
contentNode = null;
|
|
772
|
+
overlayNode = null;
|
|
773
|
+
descriptionNode = null;
|
|
774
|
+
contentId = void 0;
|
|
775
|
+
titleId = void 0;
|
|
776
|
+
triggerId = void 0;
|
|
777
|
+
descriptionId = void 0;
|
|
778
|
+
cancelNode = null;
|
|
779
|
+
nestedOpenCount = 0;
|
|
780
|
+
depth;
|
|
781
|
+
parent;
|
|
782
|
+
contentPresence;
|
|
783
|
+
overlayPresence;
|
|
784
|
+
constructor(opts, parent) {
|
|
785
|
+
this.opts = opts;
|
|
786
|
+
this.parent = parent;
|
|
787
|
+
this.depth = parent ? parent.depth + 1 : 0;
|
|
788
|
+
this.handleOpen = this.handleOpen.bind(this);
|
|
789
|
+
this.handleClose = this.handleClose.bind(this);
|
|
790
|
+
this.contentPresence = new PresenceManager({
|
|
791
|
+
ref: boxWith(() => this.contentNode),
|
|
792
|
+
open: this.opts.open,
|
|
793
|
+
enabled: true,
|
|
794
|
+
onComplete: () => {
|
|
795
|
+
this.opts.onOpenChangeComplete.current(this.opts.open.current);
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
this.overlayPresence = new PresenceManager({
|
|
799
|
+
ref: boxWith(() => this.overlayNode),
|
|
800
|
+
open: this.opts.open,
|
|
801
|
+
enabled: true
|
|
802
|
+
});
|
|
803
|
+
watch(
|
|
804
|
+
() => this.opts.open.current,
|
|
805
|
+
(isOpen) => {
|
|
806
|
+
if (!this.parent) return;
|
|
807
|
+
if (isOpen) {
|
|
808
|
+
this.parent.incrementNested();
|
|
809
|
+
} else {
|
|
810
|
+
this.parent.decrementNested();
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
{ lazy: true }
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
handleOpen() {
|
|
817
|
+
if (this.opts.open.current) return;
|
|
818
|
+
this.opts.open.current = true;
|
|
819
|
+
}
|
|
820
|
+
handleClose() {
|
|
821
|
+
if (!this.opts.open.current) return;
|
|
822
|
+
this.opts.open.current = false;
|
|
823
|
+
}
|
|
824
|
+
getBitsAttr = (part) => {
|
|
825
|
+
return dialogAttrs.getAttr(part, this.opts.variant.current);
|
|
826
|
+
};
|
|
827
|
+
incrementNested() {
|
|
828
|
+
this.nestedOpenCount++;
|
|
829
|
+
this.parent?.incrementNested();
|
|
830
|
+
}
|
|
831
|
+
decrementNested() {
|
|
832
|
+
if (this.nestedOpenCount === 0) return;
|
|
833
|
+
this.nestedOpenCount--;
|
|
834
|
+
this.parent?.decrementNested();
|
|
835
|
+
}
|
|
836
|
+
#sharedProps = derived(() => ({ "data-state": getDataOpenClosed(this.opts.open.current) }));
|
|
837
|
+
get sharedProps() {
|
|
838
|
+
return this.#sharedProps();
|
|
839
|
+
}
|
|
840
|
+
set sharedProps($$value) {
|
|
841
|
+
return this.#sharedProps($$value);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
class DialogCloseState {
|
|
845
|
+
static create(opts) {
|
|
846
|
+
return new DialogCloseState(opts, DialogRootContext.get());
|
|
847
|
+
}
|
|
848
|
+
opts;
|
|
849
|
+
root;
|
|
850
|
+
attachment;
|
|
851
|
+
constructor(opts, root) {
|
|
852
|
+
this.opts = opts;
|
|
853
|
+
this.root = root;
|
|
854
|
+
this.attachment = attachRef(this.opts.ref);
|
|
855
|
+
this.onclick = this.onclick.bind(this);
|
|
856
|
+
this.onkeydown = this.onkeydown.bind(this);
|
|
857
|
+
}
|
|
858
|
+
onclick(e) {
|
|
859
|
+
if (this.opts.disabled.current) return;
|
|
860
|
+
if (e.button > 0) return;
|
|
861
|
+
this.root.handleClose();
|
|
862
|
+
}
|
|
863
|
+
onkeydown(e) {
|
|
864
|
+
if (this.opts.disabled.current) return;
|
|
865
|
+
if (e.key === SPACE || e.key === ENTER) {
|
|
866
|
+
e.preventDefault();
|
|
867
|
+
this.root.handleClose();
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
#props = derived(() => ({
|
|
871
|
+
id: this.opts.id.current,
|
|
872
|
+
[this.root.getBitsAttr(this.opts.variant.current)]: "",
|
|
873
|
+
onclick: this.onclick,
|
|
874
|
+
onkeydown: this.onkeydown,
|
|
875
|
+
disabled: this.opts.disabled.current ? true : void 0,
|
|
876
|
+
tabindex: 0,
|
|
877
|
+
...this.root.sharedProps,
|
|
878
|
+
...this.attachment
|
|
879
|
+
}));
|
|
880
|
+
get props() {
|
|
881
|
+
return this.#props();
|
|
882
|
+
}
|
|
883
|
+
set props($$value) {
|
|
884
|
+
return this.#props($$value);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
class DialogActionState {
|
|
888
|
+
static create(opts) {
|
|
889
|
+
return new DialogActionState(opts, DialogRootContext.get());
|
|
890
|
+
}
|
|
891
|
+
opts;
|
|
892
|
+
root;
|
|
893
|
+
attachment;
|
|
894
|
+
constructor(opts, root) {
|
|
895
|
+
this.opts = opts;
|
|
896
|
+
this.root = root;
|
|
897
|
+
this.attachment = attachRef(this.opts.ref);
|
|
898
|
+
}
|
|
899
|
+
#props = derived(() => ({
|
|
900
|
+
id: this.opts.id.current,
|
|
901
|
+
[this.root.getBitsAttr("action")]: "",
|
|
902
|
+
...this.root.sharedProps,
|
|
903
|
+
...this.attachment
|
|
904
|
+
}));
|
|
905
|
+
get props() {
|
|
906
|
+
return this.#props();
|
|
907
|
+
}
|
|
908
|
+
set props($$value) {
|
|
909
|
+
return this.#props($$value);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
class DialogTitleState {
|
|
913
|
+
static create(opts) {
|
|
914
|
+
return new DialogTitleState(opts, DialogRootContext.get());
|
|
915
|
+
}
|
|
916
|
+
opts;
|
|
917
|
+
root;
|
|
918
|
+
attachment;
|
|
919
|
+
constructor(opts, root) {
|
|
920
|
+
this.opts = opts;
|
|
921
|
+
this.root = root;
|
|
922
|
+
this.root.titleId = this.opts.id.current;
|
|
923
|
+
this.attachment = attachRef(this.opts.ref);
|
|
924
|
+
watch.pre(() => this.opts.id.current, (id) => {
|
|
925
|
+
this.root.titleId = id;
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
#props = derived(() => ({
|
|
929
|
+
id: this.opts.id.current,
|
|
930
|
+
role: "heading",
|
|
931
|
+
"aria-level": this.opts.level.current,
|
|
932
|
+
[this.root.getBitsAttr("title")]: "",
|
|
933
|
+
...this.root.sharedProps,
|
|
934
|
+
...this.attachment
|
|
935
|
+
}));
|
|
936
|
+
get props() {
|
|
937
|
+
return this.#props();
|
|
938
|
+
}
|
|
939
|
+
set props($$value) {
|
|
940
|
+
return this.#props($$value);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
class DialogDescriptionState {
|
|
944
|
+
static create(opts) {
|
|
945
|
+
return new DialogDescriptionState(opts, DialogRootContext.get());
|
|
946
|
+
}
|
|
947
|
+
opts;
|
|
948
|
+
root;
|
|
949
|
+
attachment;
|
|
950
|
+
constructor(opts, root) {
|
|
951
|
+
this.opts = opts;
|
|
952
|
+
this.root = root;
|
|
953
|
+
this.root.descriptionId = this.opts.id.current;
|
|
954
|
+
this.attachment = attachRef(this.opts.ref, (v) => {
|
|
955
|
+
this.root.descriptionNode = v;
|
|
956
|
+
});
|
|
957
|
+
watch.pre(() => this.opts.id.current, (id) => {
|
|
958
|
+
this.root.descriptionId = id;
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
#props = derived(() => ({
|
|
962
|
+
id: this.opts.id.current,
|
|
963
|
+
[this.root.getBitsAttr("description")]: "",
|
|
964
|
+
...this.root.sharedProps,
|
|
965
|
+
...this.attachment
|
|
966
|
+
}));
|
|
967
|
+
get props() {
|
|
968
|
+
return this.#props();
|
|
969
|
+
}
|
|
970
|
+
set props($$value) {
|
|
971
|
+
return this.#props($$value);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
class DialogContentState {
|
|
975
|
+
static create(opts) {
|
|
976
|
+
return new DialogContentState(opts, DialogRootContext.get());
|
|
977
|
+
}
|
|
978
|
+
opts;
|
|
979
|
+
root;
|
|
980
|
+
attachment;
|
|
981
|
+
constructor(opts, root) {
|
|
982
|
+
this.opts = opts;
|
|
983
|
+
this.root = root;
|
|
984
|
+
this.attachment = attachRef(this.opts.ref, (v) => {
|
|
985
|
+
this.root.contentNode = v;
|
|
986
|
+
this.root.contentId = v?.id;
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
#snippetProps = derived(() => ({ open: this.root.opts.open.current }));
|
|
990
|
+
get snippetProps() {
|
|
991
|
+
return this.#snippetProps();
|
|
992
|
+
}
|
|
993
|
+
set snippetProps($$value) {
|
|
994
|
+
return this.#snippetProps($$value);
|
|
995
|
+
}
|
|
996
|
+
#props = derived(() => ({
|
|
997
|
+
id: this.opts.id.current,
|
|
998
|
+
role: this.root.opts.variant.current === "alert-dialog" ? "alertdialog" : "dialog",
|
|
999
|
+
"aria-modal": "true",
|
|
1000
|
+
"aria-describedby": this.root.descriptionId,
|
|
1001
|
+
"aria-labelledby": this.root.titleId,
|
|
1002
|
+
[this.root.getBitsAttr("content")]: "",
|
|
1003
|
+
style: {
|
|
1004
|
+
pointerEvents: "auto",
|
|
1005
|
+
outline: this.root.opts.variant.current === "alert-dialog" ? "none" : void 0,
|
|
1006
|
+
"--bits-dialog-depth": this.root.depth,
|
|
1007
|
+
"--bits-dialog-nested-count": this.root.nestedOpenCount
|
|
1008
|
+
},
|
|
1009
|
+
tabindex: this.root.opts.variant.current === "alert-dialog" ? -1 : void 0,
|
|
1010
|
+
"data-nested-open": boolToEmptyStrOrUndef(this.root.nestedOpenCount > 0),
|
|
1011
|
+
"data-nested": boolToEmptyStrOrUndef(this.root.parent !== null),
|
|
1012
|
+
...this.root.sharedProps,
|
|
1013
|
+
...this.attachment
|
|
1014
|
+
}));
|
|
1015
|
+
get props() {
|
|
1016
|
+
return this.#props();
|
|
1017
|
+
}
|
|
1018
|
+
set props($$value) {
|
|
1019
|
+
return this.#props($$value);
|
|
1020
|
+
}
|
|
1021
|
+
get shouldRender() {
|
|
1022
|
+
return this.root.contentPresence.shouldRender;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
class DialogOverlayState {
|
|
1026
|
+
static create(opts) {
|
|
1027
|
+
return new DialogOverlayState(opts, DialogRootContext.get());
|
|
1028
|
+
}
|
|
1029
|
+
opts;
|
|
1030
|
+
root;
|
|
1031
|
+
attachment;
|
|
1032
|
+
constructor(opts, root) {
|
|
1033
|
+
this.opts = opts;
|
|
1034
|
+
this.root = root;
|
|
1035
|
+
this.attachment = attachRef(this.opts.ref, (v) => this.root.overlayNode = v);
|
|
1036
|
+
}
|
|
1037
|
+
#snippetProps = derived(() => ({ open: this.root.opts.open.current }));
|
|
1038
|
+
get snippetProps() {
|
|
1039
|
+
return this.#snippetProps();
|
|
1040
|
+
}
|
|
1041
|
+
set snippetProps($$value) {
|
|
1042
|
+
return this.#snippetProps($$value);
|
|
1043
|
+
}
|
|
1044
|
+
#props = derived(() => ({
|
|
1045
|
+
id: this.opts.id.current,
|
|
1046
|
+
[this.root.getBitsAttr("overlay")]: "",
|
|
1047
|
+
style: {
|
|
1048
|
+
pointerEvents: "auto",
|
|
1049
|
+
"--bits-dialog-depth": this.root.depth,
|
|
1050
|
+
"--bits-dialog-nested-count": this.root.nestedOpenCount
|
|
1051
|
+
},
|
|
1052
|
+
"data-nested-open": boolToEmptyStrOrUndef(this.root.nestedOpenCount > 0),
|
|
1053
|
+
"data-nested": boolToEmptyStrOrUndef(this.root.parent !== null),
|
|
1054
|
+
...this.root.sharedProps,
|
|
1055
|
+
...this.attachment
|
|
1056
|
+
}));
|
|
1057
|
+
get props() {
|
|
1058
|
+
return this.#props();
|
|
1059
|
+
}
|
|
1060
|
+
set props($$value) {
|
|
1061
|
+
return this.#props($$value);
|
|
1062
|
+
}
|
|
1063
|
+
get shouldRender() {
|
|
1064
|
+
return this.root.overlayPresence.shouldRender;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
class AlertDialogCancelState {
|
|
1068
|
+
static create(opts) {
|
|
1069
|
+
return new AlertDialogCancelState(opts, DialogRootContext.get());
|
|
1070
|
+
}
|
|
1071
|
+
opts;
|
|
1072
|
+
root;
|
|
1073
|
+
attachment;
|
|
1074
|
+
constructor(opts, root) {
|
|
1075
|
+
this.opts = opts;
|
|
1076
|
+
this.root = root;
|
|
1077
|
+
this.attachment = attachRef(this.opts.ref, (v) => this.root.cancelNode = v);
|
|
1078
|
+
this.onclick = this.onclick.bind(this);
|
|
1079
|
+
this.onkeydown = this.onkeydown.bind(this);
|
|
1080
|
+
}
|
|
1081
|
+
onclick(e) {
|
|
1082
|
+
if (this.opts.disabled.current) return;
|
|
1083
|
+
if (e.button > 0) return;
|
|
1084
|
+
this.root.handleClose();
|
|
1085
|
+
}
|
|
1086
|
+
onkeydown(e) {
|
|
1087
|
+
if (this.opts.disabled.current) return;
|
|
1088
|
+
if (e.key === SPACE || e.key === ENTER) {
|
|
1089
|
+
e.preventDefault();
|
|
1090
|
+
this.root.handleClose();
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
#props = derived(() => ({
|
|
1094
|
+
id: this.opts.id.current,
|
|
1095
|
+
[this.root.getBitsAttr("cancel")]: "",
|
|
1096
|
+
onclick: this.onclick,
|
|
1097
|
+
onkeydown: this.onkeydown,
|
|
1098
|
+
tabindex: 0,
|
|
1099
|
+
...this.root.sharedProps,
|
|
1100
|
+
...this.attachment
|
|
1101
|
+
}));
|
|
1102
|
+
get props() {
|
|
1103
|
+
return this.#props();
|
|
1104
|
+
}
|
|
1105
|
+
set props($$value) {
|
|
1106
|
+
return this.#props($$value);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
function Alert_dialog$1($$renderer, $$props) {
|
|
1110
|
+
$$renderer.component(($$renderer2) => {
|
|
1111
|
+
let {
|
|
1112
|
+
open = false,
|
|
1113
|
+
onOpenChange = noop,
|
|
1114
|
+
onOpenChangeComplete = noop,
|
|
1115
|
+
children
|
|
1116
|
+
} = $$props;
|
|
1117
|
+
DialogRootState.create({
|
|
1118
|
+
variant: boxWith(() => "alert-dialog"),
|
|
1119
|
+
open: boxWith(() => open, (v) => {
|
|
1120
|
+
open = v;
|
|
1121
|
+
onOpenChange(v);
|
|
1122
|
+
}),
|
|
1123
|
+
onOpenChangeComplete: boxWith(() => onOpenChangeComplete)
|
|
1124
|
+
});
|
|
1125
|
+
children?.($$renderer2);
|
|
1126
|
+
$$renderer2.push(`<!---->`);
|
|
1127
|
+
bind_props($$props, { open });
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
function Dialog_title($$renderer, $$props) {
|
|
1131
|
+
$$renderer.component(($$renderer2) => {
|
|
1132
|
+
const uid = props_id($$renderer2);
|
|
1133
|
+
let {
|
|
1134
|
+
id = createId(uid),
|
|
1135
|
+
ref = null,
|
|
1136
|
+
child,
|
|
1137
|
+
children,
|
|
1138
|
+
level = 2,
|
|
1139
|
+
$$slots,
|
|
1140
|
+
$$events,
|
|
1141
|
+
...restProps
|
|
1142
|
+
} = $$props;
|
|
1143
|
+
const titleState = DialogTitleState.create({
|
|
1144
|
+
id: boxWith(() => id),
|
|
1145
|
+
level: boxWith(() => level),
|
|
1146
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
1147
|
+
});
|
|
1148
|
+
const mergedProps = mergeProps(restProps, titleState.props);
|
|
1149
|
+
if (child) {
|
|
1150
|
+
$$renderer2.push("<!--[-->");
|
|
1151
|
+
child($$renderer2, { props: mergedProps });
|
|
1152
|
+
$$renderer2.push(`<!---->`);
|
|
1153
|
+
} else {
|
|
1154
|
+
$$renderer2.push("<!--[!-->");
|
|
1155
|
+
$$renderer2.push(`<div${attributes({ ...mergedProps })}>`);
|
|
1156
|
+
children?.($$renderer2);
|
|
1157
|
+
$$renderer2.push(`<!----></div>`);
|
|
1158
|
+
}
|
|
1159
|
+
$$renderer2.push(`<!--]-->`);
|
|
1160
|
+
bind_props($$props, { ref });
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
function Alert_dialog_action$1($$renderer, $$props) {
|
|
1164
|
+
$$renderer.component(($$renderer2) => {
|
|
1165
|
+
const uid = props_id($$renderer2);
|
|
1166
|
+
let {
|
|
1167
|
+
children,
|
|
1168
|
+
child,
|
|
1169
|
+
id = createId(uid),
|
|
1170
|
+
ref = null,
|
|
1171
|
+
$$slots,
|
|
1172
|
+
$$events,
|
|
1173
|
+
...restProps
|
|
1174
|
+
} = $$props;
|
|
1175
|
+
const actionState = DialogActionState.create({
|
|
1176
|
+
id: boxWith(() => id),
|
|
1177
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
1178
|
+
});
|
|
1179
|
+
const mergedProps = mergeProps(restProps, actionState.props);
|
|
1180
|
+
if (child) {
|
|
1181
|
+
$$renderer2.push("<!--[-->");
|
|
1182
|
+
child($$renderer2, { props: mergedProps });
|
|
1183
|
+
$$renderer2.push(`<!---->`);
|
|
1184
|
+
} else {
|
|
1185
|
+
$$renderer2.push("<!--[!-->");
|
|
1186
|
+
$$renderer2.push(`<button${attributes({ ...mergedProps })}>`);
|
|
1187
|
+
children?.($$renderer2);
|
|
1188
|
+
$$renderer2.push(`<!----></button>`);
|
|
1189
|
+
}
|
|
1190
|
+
$$renderer2.push(`<!--]-->`);
|
|
1191
|
+
bind_props($$props, { ref });
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
function Alert_dialog_cancel$1($$renderer, $$props) {
|
|
1195
|
+
$$renderer.component(($$renderer2) => {
|
|
1196
|
+
const uid = props_id($$renderer2);
|
|
1197
|
+
let {
|
|
1198
|
+
id = createId(uid),
|
|
1199
|
+
ref = null,
|
|
1200
|
+
children,
|
|
1201
|
+
child,
|
|
1202
|
+
disabled = false,
|
|
1203
|
+
$$slots,
|
|
1204
|
+
$$events,
|
|
1205
|
+
...restProps
|
|
1206
|
+
} = $$props;
|
|
1207
|
+
const cancelState = AlertDialogCancelState.create({
|
|
1208
|
+
id: boxWith(() => id),
|
|
1209
|
+
ref: boxWith(() => ref, (v) => ref = v),
|
|
1210
|
+
disabled: boxWith(() => Boolean(disabled))
|
|
1211
|
+
});
|
|
1212
|
+
const mergedProps = mergeProps(restProps, cancelState.props);
|
|
1213
|
+
if (child) {
|
|
1214
|
+
$$renderer2.push("<!--[-->");
|
|
1215
|
+
child($$renderer2, { props: mergedProps });
|
|
1216
|
+
$$renderer2.push(`<!---->`);
|
|
1217
|
+
} else {
|
|
1218
|
+
$$renderer2.push("<!--[!-->");
|
|
1219
|
+
$$renderer2.push(`<button${attributes({ ...mergedProps })}>`);
|
|
1220
|
+
children?.($$renderer2);
|
|
1221
|
+
$$renderer2.push(`<!----></button>`);
|
|
1222
|
+
}
|
|
1223
|
+
$$renderer2.push(`<!--]-->`);
|
|
1224
|
+
bind_props($$props, { ref });
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
const BitsConfigContext = new Context("BitsConfig");
|
|
1228
|
+
function getBitsConfig() {
|
|
1229
|
+
const fallback = new BitsConfigState(null, {});
|
|
1230
|
+
return BitsConfigContext.getOr(fallback).opts;
|
|
1231
|
+
}
|
|
1232
|
+
class BitsConfigState {
|
|
1233
|
+
opts;
|
|
1234
|
+
constructor(parent, opts) {
|
|
1235
|
+
const resolveConfigOption = createConfigResolver(parent, opts);
|
|
1236
|
+
this.opts = {
|
|
1237
|
+
defaultPortalTo: resolveConfigOption((config) => config.defaultPortalTo),
|
|
1238
|
+
defaultLocale: resolveConfigOption((config) => config.defaultLocale)
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
function createConfigResolver(parent, currentOpts) {
|
|
1243
|
+
return (getter) => {
|
|
1244
|
+
const configOption = boxWith(() => {
|
|
1245
|
+
const value = getter(currentOpts)?.current;
|
|
1246
|
+
if (value !== void 0)
|
|
1247
|
+
return value;
|
|
1248
|
+
if (parent === null)
|
|
1249
|
+
return void 0;
|
|
1250
|
+
return getter(parent.opts)?.current;
|
|
1251
|
+
});
|
|
1252
|
+
return configOption;
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function createPropResolver(configOption, fallback) {
|
|
1256
|
+
return (getProp) => {
|
|
1257
|
+
const config = getBitsConfig();
|
|
1258
|
+
return boxWith(() => {
|
|
1259
|
+
const propValue = getProp();
|
|
1260
|
+
if (propValue !== void 0)
|
|
1261
|
+
return propValue;
|
|
1262
|
+
const option = configOption(config).current;
|
|
1263
|
+
if (option !== void 0)
|
|
1264
|
+
return option;
|
|
1265
|
+
return fallback;
|
|
1266
|
+
});
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
const resolvePortalToProp = createPropResolver((config) => config.defaultPortalTo, "body");
|
|
1270
|
+
function Portal($$renderer, $$props) {
|
|
1271
|
+
$$renderer.component(($$renderer2) => {
|
|
1272
|
+
let { to: toProp, children, disabled } = $$props;
|
|
1273
|
+
const to = resolvePortalToProp(() => toProp);
|
|
1274
|
+
getAllContexts();
|
|
1275
|
+
let target = getTarget();
|
|
1276
|
+
function getTarget() {
|
|
1277
|
+
if (!isBrowser || disabled) return null;
|
|
1278
|
+
let localTarget = null;
|
|
1279
|
+
if (typeof to.current === "string") {
|
|
1280
|
+
const target2 = document.querySelector(to.current);
|
|
1281
|
+
localTarget = target2;
|
|
1282
|
+
} else {
|
|
1283
|
+
localTarget = to.current;
|
|
1284
|
+
}
|
|
1285
|
+
return localTarget;
|
|
1286
|
+
}
|
|
1287
|
+
let instance;
|
|
1288
|
+
function unmountInstance() {
|
|
1289
|
+
if (instance) {
|
|
1290
|
+
unmount();
|
|
1291
|
+
instance = null;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
watch([() => target, () => disabled], ([target2, disabled2]) => {
|
|
1295
|
+
if (!target2 || disabled2) {
|
|
1296
|
+
unmountInstance();
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
instance = mount();
|
|
1300
|
+
return () => {
|
|
1301
|
+
unmountInstance();
|
|
1302
|
+
};
|
|
1303
|
+
});
|
|
1304
|
+
if (disabled) {
|
|
1305
|
+
$$renderer2.push("<!--[-->");
|
|
1306
|
+
children?.($$renderer2);
|
|
1307
|
+
$$renderer2.push(`<!---->`);
|
|
1308
|
+
} else {
|
|
1309
|
+
$$renderer2.push("<!--[!-->");
|
|
1310
|
+
}
|
|
1311
|
+
$$renderer2.push(`<!--]-->`);
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
function debounce(fn, wait = 500) {
|
|
1315
|
+
let timeout = null;
|
|
1316
|
+
const debounced = (...args) => {
|
|
1317
|
+
if (timeout !== null) {
|
|
1318
|
+
clearTimeout(timeout);
|
|
1319
|
+
}
|
|
1320
|
+
timeout = setTimeout(() => {
|
|
1321
|
+
fn(...args);
|
|
1322
|
+
}, wait);
|
|
1323
|
+
};
|
|
1324
|
+
debounced.destroy = () => {
|
|
1325
|
+
if (timeout !== null) {
|
|
1326
|
+
clearTimeout(timeout);
|
|
1327
|
+
timeout = null;
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
return debounced;
|
|
1331
|
+
}
|
|
1332
|
+
function isOrContainsTarget(node, target) {
|
|
1333
|
+
return node === target || node.contains(target);
|
|
1334
|
+
}
|
|
1335
|
+
function getOwnerDocument(el) {
|
|
1336
|
+
return el?.ownerDocument ?? document;
|
|
1337
|
+
}
|
|
1338
|
+
function isClickTrulyOutside(event, contentNode) {
|
|
1339
|
+
const { clientX, clientY } = event;
|
|
1340
|
+
const rect = contentNode.getBoundingClientRect();
|
|
1341
|
+
return clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom;
|
|
1342
|
+
}
|
|
1343
|
+
const CONTEXT_MENU_TRIGGER_ATTR = "data-context-menu-trigger";
|
|
1344
|
+
const CONTEXT_MENU_CONTENT_ATTR = "data-context-menu-content";
|
|
1345
|
+
createBitsAttrs({
|
|
1346
|
+
component: "menu",
|
|
1347
|
+
parts: [
|
|
1348
|
+
"trigger",
|
|
1349
|
+
"content",
|
|
1350
|
+
"sub-trigger",
|
|
1351
|
+
"item",
|
|
1352
|
+
"group",
|
|
1353
|
+
"group-heading",
|
|
1354
|
+
"checkbox-group",
|
|
1355
|
+
"checkbox-item",
|
|
1356
|
+
"radio-group",
|
|
1357
|
+
"radio-item",
|
|
1358
|
+
"separator",
|
|
1359
|
+
"sub-content",
|
|
1360
|
+
"arrow"
|
|
1361
|
+
]
|
|
1362
|
+
});
|
|
1363
|
+
globalThis.bitsDismissableLayers ??= /* @__PURE__ */ new Map();
|
|
1364
|
+
class DismissibleLayerState {
|
|
1365
|
+
static create(opts) {
|
|
1366
|
+
return new DismissibleLayerState(opts);
|
|
1367
|
+
}
|
|
1368
|
+
opts;
|
|
1369
|
+
#interactOutsideProp;
|
|
1370
|
+
#behaviorType;
|
|
1371
|
+
#interceptedEvents = { pointerdown: false };
|
|
1372
|
+
#isResponsibleLayer = false;
|
|
1373
|
+
#isFocusInsideDOMTree = false;
|
|
1374
|
+
#documentObj = void 0;
|
|
1375
|
+
#onFocusOutside;
|
|
1376
|
+
#unsubClickListener = noop;
|
|
1377
|
+
constructor(opts) {
|
|
1378
|
+
this.opts = opts;
|
|
1379
|
+
this.#behaviorType = opts.interactOutsideBehavior;
|
|
1380
|
+
this.#interactOutsideProp = opts.onInteractOutside;
|
|
1381
|
+
this.#onFocusOutside = opts.onFocusOutside;
|
|
1382
|
+
let unsubEvents = noop;
|
|
1383
|
+
const cleanup = () => {
|
|
1384
|
+
this.#resetState();
|
|
1385
|
+
globalThis.bitsDismissableLayers.delete(this);
|
|
1386
|
+
this.#handleInteractOutside.destroy();
|
|
1387
|
+
unsubEvents();
|
|
1388
|
+
};
|
|
1389
|
+
watch([() => this.opts.enabled.current, () => this.opts.ref.current], () => {
|
|
1390
|
+
if (!this.opts.enabled.current || !this.opts.ref.current) return;
|
|
1391
|
+
afterSleep(1, () => {
|
|
1392
|
+
if (!this.opts.ref.current) return;
|
|
1393
|
+
globalThis.bitsDismissableLayers.set(this, this.#behaviorType);
|
|
1394
|
+
unsubEvents();
|
|
1395
|
+
unsubEvents = this.#addEventListeners();
|
|
1396
|
+
});
|
|
1397
|
+
return cleanup;
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
#handleFocus = (event) => {
|
|
1401
|
+
if (event.defaultPrevented) return;
|
|
1402
|
+
if (!this.opts.ref.current) return;
|
|
1403
|
+
afterTick(() => {
|
|
1404
|
+
if (!this.opts.ref.current || this.#isTargetWithinLayer(event.target)) return;
|
|
1405
|
+
if (event.target && !this.#isFocusInsideDOMTree) {
|
|
1406
|
+
this.#onFocusOutside.current?.(event);
|
|
1407
|
+
}
|
|
1408
|
+
});
|
|
1409
|
+
};
|
|
1410
|
+
#addEventListeners() {
|
|
1411
|
+
return executeCallbacks(
|
|
1412
|
+
/**
|
|
1413
|
+
* CAPTURE INTERACTION START
|
|
1414
|
+
* mark interaction-start event as intercepted.
|
|
1415
|
+
* mark responsible layer during interaction start
|
|
1416
|
+
* to avoid checking if is responsible layer during interaction end
|
|
1417
|
+
* when a new floating element may have been opened.
|
|
1418
|
+
*/
|
|
1419
|
+
on(this.#documentObj, "pointerdown", executeCallbacks(this.#markInterceptedEvent, this.#markResponsibleLayer), { capture: true }),
|
|
1420
|
+
/**
|
|
1421
|
+
* BUBBLE INTERACTION START
|
|
1422
|
+
* Mark interaction-start event as non-intercepted. Debounce `onInteractOutsideStart`
|
|
1423
|
+
* to avoid prematurely checking if other events were intercepted.
|
|
1424
|
+
*/
|
|
1425
|
+
on(this.#documentObj, "pointerdown", executeCallbacks(this.#markNonInterceptedEvent, this.#handleInteractOutside)),
|
|
1426
|
+
/**
|
|
1427
|
+
* HANDLE FOCUS OUTSIDE
|
|
1428
|
+
*/
|
|
1429
|
+
on(this.#documentObj, "focusin", this.#handleFocus)
|
|
1430
|
+
);
|
|
1431
|
+
}
|
|
1432
|
+
#handleDismiss = (e) => {
|
|
1433
|
+
let event = e;
|
|
1434
|
+
if (event.defaultPrevented) {
|
|
1435
|
+
event = createWrappedEvent(e);
|
|
1436
|
+
}
|
|
1437
|
+
this.#interactOutsideProp.current(e);
|
|
1438
|
+
};
|
|
1439
|
+
#handleInteractOutside = debounce(
|
|
1440
|
+
(e) => {
|
|
1441
|
+
if (!this.opts.ref.current) {
|
|
1442
|
+
this.#unsubClickListener();
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
const isEventValid = this.opts.isValidEvent.current(e, this.opts.ref.current) || isValidEvent(e, this.opts.ref.current);
|
|
1446
|
+
if (!this.#isResponsibleLayer || this.#isAnyEventIntercepted() || !isEventValid) {
|
|
1447
|
+
this.#unsubClickListener();
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
let event = e;
|
|
1451
|
+
if (event.defaultPrevented) {
|
|
1452
|
+
event = createWrappedEvent(event);
|
|
1453
|
+
}
|
|
1454
|
+
if (this.#behaviorType.current !== "close" && this.#behaviorType.current !== "defer-otherwise-close") {
|
|
1455
|
+
this.#unsubClickListener();
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
if (e.pointerType === "touch") {
|
|
1459
|
+
this.#unsubClickListener();
|
|
1460
|
+
this.#unsubClickListener = on(this.#documentObj, "click", this.#handleDismiss, { once: true });
|
|
1461
|
+
} else {
|
|
1462
|
+
this.#interactOutsideProp.current(event);
|
|
1463
|
+
}
|
|
1464
|
+
},
|
|
1465
|
+
10
|
|
1466
|
+
);
|
|
1467
|
+
#markInterceptedEvent = (e) => {
|
|
1468
|
+
this.#interceptedEvents[e.type] = true;
|
|
1469
|
+
};
|
|
1470
|
+
#markNonInterceptedEvent = (e) => {
|
|
1471
|
+
this.#interceptedEvents[e.type] = false;
|
|
1472
|
+
};
|
|
1473
|
+
#markResponsibleLayer = () => {
|
|
1474
|
+
if (!this.opts.ref.current) return;
|
|
1475
|
+
this.#isResponsibleLayer = isResponsibleLayer(this.opts.ref.current);
|
|
1476
|
+
};
|
|
1477
|
+
#isTargetWithinLayer = (target) => {
|
|
1478
|
+
if (!this.opts.ref.current) return false;
|
|
1479
|
+
return isOrContainsTarget(this.opts.ref.current, target);
|
|
1480
|
+
};
|
|
1481
|
+
#resetState = debounce(
|
|
1482
|
+
() => {
|
|
1483
|
+
for (const eventType in this.#interceptedEvents) {
|
|
1484
|
+
this.#interceptedEvents[eventType] = false;
|
|
1485
|
+
}
|
|
1486
|
+
this.#isResponsibleLayer = false;
|
|
1487
|
+
},
|
|
1488
|
+
20
|
|
1489
|
+
);
|
|
1490
|
+
#isAnyEventIntercepted() {
|
|
1491
|
+
const i = Object.values(this.#interceptedEvents).some(Boolean);
|
|
1492
|
+
return i;
|
|
1493
|
+
}
|
|
1494
|
+
#onfocuscapture = () => {
|
|
1495
|
+
this.#isFocusInsideDOMTree = true;
|
|
1496
|
+
};
|
|
1497
|
+
#onblurcapture = () => {
|
|
1498
|
+
this.#isFocusInsideDOMTree = false;
|
|
1499
|
+
};
|
|
1500
|
+
props = {
|
|
1501
|
+
onfocuscapture: this.#onfocuscapture,
|
|
1502
|
+
onblurcapture: this.#onblurcapture
|
|
1503
|
+
};
|
|
1504
|
+
}
|
|
1505
|
+
function getTopMostDismissableLayer(layersArr = [...globalThis.bitsDismissableLayers]) {
|
|
1506
|
+
return layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
|
|
1507
|
+
}
|
|
1508
|
+
function isResponsibleLayer(node) {
|
|
1509
|
+
const layersArr = [...globalThis.bitsDismissableLayers];
|
|
1510
|
+
const topMostLayer = getTopMostDismissableLayer(layersArr);
|
|
1511
|
+
if (topMostLayer) return topMostLayer[0].opts.ref.current === node;
|
|
1512
|
+
const [firstLayerNode] = layersArr[0];
|
|
1513
|
+
return firstLayerNode.opts.ref.current === node;
|
|
1514
|
+
}
|
|
1515
|
+
function isValidEvent(e, node) {
|
|
1516
|
+
const target = e.target;
|
|
1517
|
+
if (!isElementOrSVGElement(target)) return false;
|
|
1518
|
+
const targetIsContextMenuTrigger = Boolean(target.closest(`[${CONTEXT_MENU_TRIGGER_ATTR}]`));
|
|
1519
|
+
if ("button" in e && e.button > 0 && !targetIsContextMenuTrigger) return false;
|
|
1520
|
+
if ("button" in e && e.button === 0 && targetIsContextMenuTrigger) return true;
|
|
1521
|
+
const nodeIsContextMenu = Boolean(node.closest(`[${CONTEXT_MENU_CONTENT_ATTR}]`));
|
|
1522
|
+
if (targetIsContextMenuTrigger && nodeIsContextMenu) return false;
|
|
1523
|
+
const ownerDocument = getOwnerDocument(target);
|
|
1524
|
+
const isValid = ownerDocument.documentElement.contains(target) && !isOrContainsTarget(node, target) && isClickTrulyOutside(e, node);
|
|
1525
|
+
return isValid;
|
|
1526
|
+
}
|
|
1527
|
+
function createWrappedEvent(e) {
|
|
1528
|
+
const capturedCurrentTarget = e.currentTarget;
|
|
1529
|
+
const capturedTarget = e.target;
|
|
1530
|
+
let newEvent;
|
|
1531
|
+
if (e instanceof PointerEvent) {
|
|
1532
|
+
newEvent = new PointerEvent(e.type, e);
|
|
1533
|
+
} else {
|
|
1534
|
+
newEvent = new PointerEvent("pointerdown", e);
|
|
1535
|
+
}
|
|
1536
|
+
let isPrevented = false;
|
|
1537
|
+
const wrappedEvent = new Proxy(newEvent, {
|
|
1538
|
+
get: (target, prop) => {
|
|
1539
|
+
if (prop === "currentTarget") {
|
|
1540
|
+
return capturedCurrentTarget;
|
|
1541
|
+
}
|
|
1542
|
+
if (prop === "target") {
|
|
1543
|
+
return capturedTarget;
|
|
1544
|
+
}
|
|
1545
|
+
if (prop === "preventDefault") {
|
|
1546
|
+
return () => {
|
|
1547
|
+
isPrevented = true;
|
|
1548
|
+
if (typeof target.preventDefault === "function") {
|
|
1549
|
+
target.preventDefault();
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
if (prop === "defaultPrevented") {
|
|
1554
|
+
return isPrevented;
|
|
1555
|
+
}
|
|
1556
|
+
if (prop in target) {
|
|
1557
|
+
return target[prop];
|
|
1558
|
+
}
|
|
1559
|
+
return e[prop];
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
return wrappedEvent;
|
|
1563
|
+
}
|
|
1564
|
+
function Dismissible_layer($$renderer, $$props) {
|
|
1565
|
+
$$renderer.component(($$renderer2) => {
|
|
1566
|
+
let {
|
|
1567
|
+
interactOutsideBehavior = "close",
|
|
1568
|
+
onInteractOutside = noop,
|
|
1569
|
+
onFocusOutside = noop,
|
|
1570
|
+
id,
|
|
1571
|
+
children,
|
|
1572
|
+
enabled,
|
|
1573
|
+
isValidEvent: isValidEvent2 = () => false,
|
|
1574
|
+
ref
|
|
1575
|
+
} = $$props;
|
|
1576
|
+
const dismissibleLayerState = DismissibleLayerState.create({
|
|
1577
|
+
id: boxWith(() => id),
|
|
1578
|
+
interactOutsideBehavior: boxWith(() => interactOutsideBehavior),
|
|
1579
|
+
onInteractOutside: boxWith(() => onInteractOutside),
|
|
1580
|
+
enabled: boxWith(() => enabled),
|
|
1581
|
+
onFocusOutside: boxWith(() => onFocusOutside),
|
|
1582
|
+
isValidEvent: boxWith(() => isValidEvent2),
|
|
1583
|
+
ref
|
|
1584
|
+
});
|
|
1585
|
+
children?.($$renderer2, { props: dismissibleLayerState.props });
|
|
1586
|
+
$$renderer2.push(`<!---->`);
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
globalThis.bitsEscapeLayers ??= /* @__PURE__ */ new Map();
|
|
1590
|
+
class EscapeLayerState {
|
|
1591
|
+
static create(opts) {
|
|
1592
|
+
return new EscapeLayerState(opts);
|
|
1593
|
+
}
|
|
1594
|
+
opts;
|
|
1595
|
+
domContext;
|
|
1596
|
+
constructor(opts) {
|
|
1597
|
+
this.opts = opts;
|
|
1598
|
+
this.domContext = new DOMContext(this.opts.ref);
|
|
1599
|
+
let unsubEvents = noop;
|
|
1600
|
+
watch(() => opts.enabled.current, (enabled) => {
|
|
1601
|
+
if (enabled) {
|
|
1602
|
+
globalThis.bitsEscapeLayers.set(this, opts.escapeKeydownBehavior);
|
|
1603
|
+
unsubEvents = this.#addEventListener();
|
|
1604
|
+
}
|
|
1605
|
+
return () => {
|
|
1606
|
+
unsubEvents();
|
|
1607
|
+
globalThis.bitsEscapeLayers.delete(this);
|
|
1608
|
+
};
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
#addEventListener = () => {
|
|
1612
|
+
return on(this.domContext.getDocument(), "keydown", this.#onkeydown, { passive: false });
|
|
1613
|
+
};
|
|
1614
|
+
#onkeydown = (e) => {
|
|
1615
|
+
if (e.key !== ESCAPE || !isResponsibleEscapeLayer(this)) return;
|
|
1616
|
+
const clonedEvent = new KeyboardEvent(e.type, e);
|
|
1617
|
+
e.preventDefault();
|
|
1618
|
+
const behaviorType = this.opts.escapeKeydownBehavior.current;
|
|
1619
|
+
if (behaviorType !== "close" && behaviorType !== "defer-otherwise-close") return;
|
|
1620
|
+
this.opts.onEscapeKeydown.current(clonedEvent);
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
function isResponsibleEscapeLayer(instance) {
|
|
1624
|
+
const layersArr = [...globalThis.bitsEscapeLayers];
|
|
1625
|
+
const topMostLayer = layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
|
|
1626
|
+
if (topMostLayer) return topMostLayer[0] === instance;
|
|
1627
|
+
const [firstLayerNode] = layersArr[0];
|
|
1628
|
+
return firstLayerNode === instance;
|
|
1629
|
+
}
|
|
1630
|
+
function Escape_layer($$renderer, $$props) {
|
|
1631
|
+
$$renderer.component(($$renderer2) => {
|
|
1632
|
+
let {
|
|
1633
|
+
escapeKeydownBehavior = "close",
|
|
1634
|
+
onEscapeKeydown = noop,
|
|
1635
|
+
children,
|
|
1636
|
+
enabled,
|
|
1637
|
+
ref
|
|
1638
|
+
} = $$props;
|
|
1639
|
+
EscapeLayerState.create({
|
|
1640
|
+
escapeKeydownBehavior: boxWith(() => escapeKeydownBehavior),
|
|
1641
|
+
onEscapeKeydown: boxWith(() => onEscapeKeydown),
|
|
1642
|
+
enabled: boxWith(() => enabled),
|
|
1643
|
+
ref
|
|
1644
|
+
});
|
|
1645
|
+
children?.($$renderer2);
|
|
1646
|
+
$$renderer2.push(`<!---->`);
|
|
1647
|
+
});
|
|
1648
|
+
}
|
|
1649
|
+
class FocusScopeManager {
|
|
1650
|
+
static instance;
|
|
1651
|
+
#scopeStack = simpleBox([]);
|
|
1652
|
+
#focusHistory = /* @__PURE__ */ new WeakMap();
|
|
1653
|
+
#preFocusHistory = /* @__PURE__ */ new WeakMap();
|
|
1654
|
+
static getInstance() {
|
|
1655
|
+
if (!this.instance) {
|
|
1656
|
+
this.instance = new FocusScopeManager();
|
|
1657
|
+
}
|
|
1658
|
+
return this.instance;
|
|
1659
|
+
}
|
|
1660
|
+
register(scope) {
|
|
1661
|
+
const current = this.getActive();
|
|
1662
|
+
if (current && current !== scope) {
|
|
1663
|
+
current.pause();
|
|
1664
|
+
}
|
|
1665
|
+
const activeElement = document.activeElement;
|
|
1666
|
+
if (activeElement && activeElement !== document.body) {
|
|
1667
|
+
this.#preFocusHistory.set(scope, activeElement);
|
|
1668
|
+
}
|
|
1669
|
+
this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope);
|
|
1670
|
+
this.#scopeStack.current.unshift(scope);
|
|
1671
|
+
}
|
|
1672
|
+
unregister(scope) {
|
|
1673
|
+
this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope);
|
|
1674
|
+
const next = this.getActive();
|
|
1675
|
+
if (next) {
|
|
1676
|
+
next.resume();
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
getActive() {
|
|
1680
|
+
return this.#scopeStack.current[0];
|
|
1681
|
+
}
|
|
1682
|
+
setFocusMemory(scope, element) {
|
|
1683
|
+
this.#focusHistory.set(scope, element);
|
|
1684
|
+
}
|
|
1685
|
+
getFocusMemory(scope) {
|
|
1686
|
+
return this.#focusHistory.get(scope);
|
|
1687
|
+
}
|
|
1688
|
+
isActiveScope(scope) {
|
|
1689
|
+
return this.getActive() === scope;
|
|
1690
|
+
}
|
|
1691
|
+
setPreFocusMemory(scope, element) {
|
|
1692
|
+
this.#preFocusHistory.set(scope, element);
|
|
1693
|
+
}
|
|
1694
|
+
getPreFocusMemory(scope) {
|
|
1695
|
+
return this.#preFocusHistory.get(scope);
|
|
1696
|
+
}
|
|
1697
|
+
clearPreFocusMemory(scope) {
|
|
1698
|
+
this.#preFocusHistory.delete(scope);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
class FocusScope {
|
|
1702
|
+
#paused = false;
|
|
1703
|
+
#container = null;
|
|
1704
|
+
#manager = FocusScopeManager.getInstance();
|
|
1705
|
+
#cleanupFns = [];
|
|
1706
|
+
#opts;
|
|
1707
|
+
constructor(opts) {
|
|
1708
|
+
this.#opts = opts;
|
|
1709
|
+
}
|
|
1710
|
+
get paused() {
|
|
1711
|
+
return this.#paused;
|
|
1712
|
+
}
|
|
1713
|
+
pause() {
|
|
1714
|
+
this.#paused = true;
|
|
1715
|
+
}
|
|
1716
|
+
resume() {
|
|
1717
|
+
this.#paused = false;
|
|
1718
|
+
}
|
|
1719
|
+
#cleanup() {
|
|
1720
|
+
for (const fn of this.#cleanupFns) {
|
|
1721
|
+
fn();
|
|
1722
|
+
}
|
|
1723
|
+
this.#cleanupFns = [];
|
|
1724
|
+
}
|
|
1725
|
+
mount(container) {
|
|
1726
|
+
if (this.#container) {
|
|
1727
|
+
this.unmount();
|
|
1728
|
+
}
|
|
1729
|
+
this.#container = container;
|
|
1730
|
+
this.#manager.register(this);
|
|
1731
|
+
this.#setupEventListeners();
|
|
1732
|
+
this.#handleOpenAutoFocus();
|
|
1733
|
+
}
|
|
1734
|
+
unmount() {
|
|
1735
|
+
if (!this.#container) return;
|
|
1736
|
+
this.#cleanup();
|
|
1737
|
+
this.#handleCloseAutoFocus();
|
|
1738
|
+
this.#manager.unregister(this);
|
|
1739
|
+
this.#manager.clearPreFocusMemory(this);
|
|
1740
|
+
this.#container = null;
|
|
1741
|
+
}
|
|
1742
|
+
#handleOpenAutoFocus() {
|
|
1743
|
+
if (!this.#container) return;
|
|
1744
|
+
const event = new CustomEvent("focusScope.onOpenAutoFocus", { bubbles: false, cancelable: true });
|
|
1745
|
+
this.#opts.onOpenAutoFocus.current(event);
|
|
1746
|
+
if (!event.defaultPrevented) {
|
|
1747
|
+
requestAnimationFrame(() => {
|
|
1748
|
+
if (!this.#container) return;
|
|
1749
|
+
const firstTabbable = this.#getFirstTabbable();
|
|
1750
|
+
if (firstTabbable) {
|
|
1751
|
+
firstTabbable.focus();
|
|
1752
|
+
this.#manager.setFocusMemory(this, firstTabbable);
|
|
1753
|
+
} else {
|
|
1754
|
+
this.#container.focus();
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
#handleCloseAutoFocus() {
|
|
1760
|
+
const event = new CustomEvent("focusScope.onCloseAutoFocus", { bubbles: false, cancelable: true });
|
|
1761
|
+
this.#opts.onCloseAutoFocus.current?.(event);
|
|
1762
|
+
if (!event.defaultPrevented) {
|
|
1763
|
+
const preFocusedElement = this.#manager.getPreFocusMemory(this);
|
|
1764
|
+
if (preFocusedElement && document.contains(preFocusedElement)) {
|
|
1765
|
+
try {
|
|
1766
|
+
preFocusedElement.focus();
|
|
1767
|
+
} catch {
|
|
1768
|
+
document.body.focus();
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
#setupEventListeners() {
|
|
1774
|
+
if (!this.#container || !this.#opts.trap.current) return;
|
|
1775
|
+
const container = this.#container;
|
|
1776
|
+
const doc = container.ownerDocument;
|
|
1777
|
+
const handleFocus = (e) => {
|
|
1778
|
+
if (this.#paused || !this.#manager.isActiveScope(this)) return;
|
|
1779
|
+
const target = e.target;
|
|
1780
|
+
if (!target) return;
|
|
1781
|
+
const isInside = container.contains(target);
|
|
1782
|
+
if (isInside) {
|
|
1783
|
+
this.#manager.setFocusMemory(this, target);
|
|
1784
|
+
} else {
|
|
1785
|
+
const lastFocused = this.#manager.getFocusMemory(this);
|
|
1786
|
+
if (lastFocused && container.contains(lastFocused) && isFocusable(lastFocused)) {
|
|
1787
|
+
e.preventDefault();
|
|
1788
|
+
lastFocused.focus();
|
|
1789
|
+
} else {
|
|
1790
|
+
const firstTabbable = this.#getFirstTabbable();
|
|
1791
|
+
const firstFocusable = this.#getAllFocusables()[0];
|
|
1792
|
+
(firstTabbable || firstFocusable || container).focus();
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
const handleKeydown = (e) => {
|
|
1797
|
+
if (!this.#opts.loop || this.#paused || e.key !== "Tab") return;
|
|
1798
|
+
if (!this.#manager.isActiveScope(this)) return;
|
|
1799
|
+
const tabbables = this.#getTabbables();
|
|
1800
|
+
if (tabbables.length < 2) return;
|
|
1801
|
+
const first = tabbables[0];
|
|
1802
|
+
const last = tabbables[tabbables.length - 1];
|
|
1803
|
+
if (!e.shiftKey && doc.activeElement === last) {
|
|
1804
|
+
e.preventDefault();
|
|
1805
|
+
first.focus();
|
|
1806
|
+
} else if (e.shiftKey && doc.activeElement === first) {
|
|
1807
|
+
e.preventDefault();
|
|
1808
|
+
last.focus();
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1811
|
+
this.#cleanupFns.push(on(doc, "focusin", handleFocus, { capture: true }), on(container, "keydown", handleKeydown));
|
|
1812
|
+
const observer = new MutationObserver(() => {
|
|
1813
|
+
const lastFocused = this.#manager.getFocusMemory(this);
|
|
1814
|
+
if (lastFocused && !container.contains(lastFocused)) {
|
|
1815
|
+
const firstTabbable = this.#getFirstTabbable();
|
|
1816
|
+
const firstFocusable = this.#getAllFocusables()[0];
|
|
1817
|
+
const elementToFocus = firstTabbable || firstFocusable;
|
|
1818
|
+
if (elementToFocus) {
|
|
1819
|
+
elementToFocus.focus();
|
|
1820
|
+
this.#manager.setFocusMemory(this, elementToFocus);
|
|
1821
|
+
} else {
|
|
1822
|
+
container.focus();
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
observer.observe(container, { childList: true, subtree: true });
|
|
1827
|
+
this.#cleanupFns.push(() => observer.disconnect());
|
|
1828
|
+
}
|
|
1829
|
+
#getTabbables() {
|
|
1830
|
+
if (!this.#container) return [];
|
|
1831
|
+
return tabbable(this.#container, { includeContainer: false, getShadowRoot: true });
|
|
1832
|
+
}
|
|
1833
|
+
#getFirstTabbable() {
|
|
1834
|
+
const tabbables = this.#getTabbables();
|
|
1835
|
+
return tabbables[0] || null;
|
|
1836
|
+
}
|
|
1837
|
+
#getAllFocusables() {
|
|
1838
|
+
if (!this.#container) return [];
|
|
1839
|
+
return focusable(this.#container, { includeContainer: false, getShadowRoot: true });
|
|
1840
|
+
}
|
|
1841
|
+
static use(opts) {
|
|
1842
|
+
let scope = null;
|
|
1843
|
+
watch([() => opts.ref.current, () => opts.enabled.current], ([ref, enabled]) => {
|
|
1844
|
+
if (ref && enabled) {
|
|
1845
|
+
if (!scope) {
|
|
1846
|
+
scope = new FocusScope(opts);
|
|
1847
|
+
}
|
|
1848
|
+
scope.mount(ref);
|
|
1849
|
+
} else if (scope) {
|
|
1850
|
+
scope.unmount();
|
|
1851
|
+
scope = null;
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1854
|
+
return {
|
|
1855
|
+
get props() {
|
|
1856
|
+
return { tabindex: -1 };
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
function Focus_scope($$renderer, $$props) {
|
|
1862
|
+
$$renderer.component(($$renderer2) => {
|
|
1863
|
+
let {
|
|
1864
|
+
enabled = false,
|
|
1865
|
+
trapFocus = false,
|
|
1866
|
+
loop = false,
|
|
1867
|
+
onCloseAutoFocus = noop,
|
|
1868
|
+
onOpenAutoFocus = noop,
|
|
1869
|
+
focusScope,
|
|
1870
|
+
ref
|
|
1871
|
+
} = $$props;
|
|
1872
|
+
const focusScopeState = FocusScope.use({
|
|
1873
|
+
enabled: boxWith(() => enabled),
|
|
1874
|
+
trap: boxWith(() => trapFocus),
|
|
1875
|
+
loop,
|
|
1876
|
+
onCloseAutoFocus: boxWith(() => onCloseAutoFocus),
|
|
1877
|
+
onOpenAutoFocus: boxWith(() => onOpenAutoFocus),
|
|
1878
|
+
ref
|
|
1879
|
+
});
|
|
1880
|
+
focusScope?.($$renderer2, { props: focusScopeState.props });
|
|
1881
|
+
$$renderer2.push(`<!---->`);
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
globalThis.bitsTextSelectionLayers ??= /* @__PURE__ */ new Map();
|
|
1885
|
+
class TextSelectionLayerState {
|
|
1886
|
+
static create(opts) {
|
|
1887
|
+
return new TextSelectionLayerState(opts);
|
|
1888
|
+
}
|
|
1889
|
+
opts;
|
|
1890
|
+
domContext;
|
|
1891
|
+
#unsubSelectionLock = noop;
|
|
1892
|
+
constructor(opts) {
|
|
1893
|
+
this.opts = opts;
|
|
1894
|
+
this.domContext = new DOMContext(opts.ref);
|
|
1895
|
+
let unsubEvents = noop;
|
|
1896
|
+
watch(() => this.opts.enabled.current, (isEnabled) => {
|
|
1897
|
+
if (isEnabled) {
|
|
1898
|
+
globalThis.bitsTextSelectionLayers.set(this, this.opts.enabled);
|
|
1899
|
+
unsubEvents();
|
|
1900
|
+
unsubEvents = this.#addEventListeners();
|
|
1901
|
+
}
|
|
1902
|
+
return () => {
|
|
1903
|
+
unsubEvents();
|
|
1904
|
+
this.#resetSelectionLock();
|
|
1905
|
+
globalThis.bitsTextSelectionLayers.delete(this);
|
|
1906
|
+
};
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
#addEventListeners() {
|
|
1910
|
+
return executeCallbacks(on(this.domContext.getDocument(), "pointerdown", this.#pointerdown), on(this.domContext.getDocument(), "pointerup", composeHandlers(this.#resetSelectionLock, this.opts.onPointerUp.current)));
|
|
1911
|
+
}
|
|
1912
|
+
#pointerdown = (e) => {
|
|
1913
|
+
const node = this.opts.ref.current;
|
|
1914
|
+
const target = e.target;
|
|
1915
|
+
if (!isHTMLElement(node) || !isHTMLElement(target) || !this.opts.enabled.current) return;
|
|
1916
|
+
if (!isHighestLayer(this) || !contains(node, target)) return;
|
|
1917
|
+
this.opts.onPointerDown.current(e);
|
|
1918
|
+
if (e.defaultPrevented) return;
|
|
1919
|
+
this.#unsubSelectionLock = preventTextSelectionOverflow(node, this.domContext.getDocument().body);
|
|
1920
|
+
};
|
|
1921
|
+
#resetSelectionLock = () => {
|
|
1922
|
+
this.#unsubSelectionLock();
|
|
1923
|
+
this.#unsubSelectionLock = noop;
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
const getUserSelect = (node) => node.style.userSelect || node.style.webkitUserSelect;
|
|
1927
|
+
function preventTextSelectionOverflow(node, body) {
|
|
1928
|
+
const originalBodyUserSelect = getUserSelect(body);
|
|
1929
|
+
const originalNodeUserSelect = getUserSelect(node);
|
|
1930
|
+
setUserSelect(body, "none");
|
|
1931
|
+
setUserSelect(node, "text");
|
|
1932
|
+
return () => {
|
|
1933
|
+
setUserSelect(body, originalBodyUserSelect);
|
|
1934
|
+
setUserSelect(node, originalNodeUserSelect);
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
function setUserSelect(node, value) {
|
|
1938
|
+
node.style.userSelect = value;
|
|
1939
|
+
node.style.webkitUserSelect = value;
|
|
1940
|
+
}
|
|
1941
|
+
function isHighestLayer(instance) {
|
|
1942
|
+
const layersArr = [...globalThis.bitsTextSelectionLayers];
|
|
1943
|
+
if (!layersArr.length) return false;
|
|
1944
|
+
const highestLayer = layersArr.at(-1);
|
|
1945
|
+
if (!highestLayer) return false;
|
|
1946
|
+
return highestLayer[0] === instance;
|
|
1947
|
+
}
|
|
1948
|
+
function Text_selection_layer($$renderer, $$props) {
|
|
1949
|
+
$$renderer.component(($$renderer2) => {
|
|
1950
|
+
let {
|
|
1951
|
+
preventOverflowTextSelection = true,
|
|
1952
|
+
onPointerDown = noop,
|
|
1953
|
+
onPointerUp = noop,
|
|
1954
|
+
id,
|
|
1955
|
+
children,
|
|
1956
|
+
enabled,
|
|
1957
|
+
ref
|
|
1958
|
+
} = $$props;
|
|
1959
|
+
TextSelectionLayerState.create({
|
|
1960
|
+
id: boxWith(() => id),
|
|
1961
|
+
onPointerDown: boxWith(() => onPointerDown),
|
|
1962
|
+
onPointerUp: boxWith(() => onPointerUp),
|
|
1963
|
+
enabled: boxWith(() => enabled && preventOverflowTextSelection),
|
|
1964
|
+
ref
|
|
1965
|
+
});
|
|
1966
|
+
children?.($$renderer2);
|
|
1967
|
+
$$renderer2.push(`<!---->`);
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
globalThis.bitsIdCounter ??= { current: 0 };
|
|
1971
|
+
function useId(prefix = "bits") {
|
|
1972
|
+
globalThis.bitsIdCounter.current++;
|
|
1973
|
+
return `${prefix}-${globalThis.bitsIdCounter.current}`;
|
|
1974
|
+
}
|
|
1975
|
+
class SharedState {
|
|
1976
|
+
#factory;
|
|
1977
|
+
#subscribers = 0;
|
|
1978
|
+
#state;
|
|
1979
|
+
#scope;
|
|
1980
|
+
constructor(factory) {
|
|
1981
|
+
this.#factory = factory;
|
|
1982
|
+
}
|
|
1983
|
+
#dispose() {
|
|
1984
|
+
this.#subscribers -= 1;
|
|
1985
|
+
if (this.#scope && this.#subscribers <= 0) {
|
|
1986
|
+
this.#scope();
|
|
1987
|
+
this.#state = void 0;
|
|
1988
|
+
this.#scope = void 0;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
get(...args) {
|
|
1992
|
+
this.#subscribers += 1;
|
|
1993
|
+
if (this.#state === void 0) {
|
|
1994
|
+
this.#scope = () => {
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1997
|
+
return this.#state;
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
const lockMap = new SvelteMap();
|
|
2001
|
+
let initialBodyStyle = null;
|
|
2002
|
+
let cleanupTimeoutId = null;
|
|
2003
|
+
let isInCleanupTransition = false;
|
|
2004
|
+
const anyLocked = boxWith(() => {
|
|
2005
|
+
for (const value of lockMap.values()) {
|
|
2006
|
+
if (value) return true;
|
|
2007
|
+
}
|
|
2008
|
+
return false;
|
|
2009
|
+
});
|
|
2010
|
+
let cleanupScheduledAt = null;
|
|
2011
|
+
const bodyLockStackCount = new SharedState(() => {
|
|
2012
|
+
function resetBodyStyle() {
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
function cancelPendingCleanup() {
|
|
2016
|
+
if (cleanupTimeoutId === null) return;
|
|
2017
|
+
window.clearTimeout(cleanupTimeoutId);
|
|
2018
|
+
cleanupTimeoutId = null;
|
|
2019
|
+
}
|
|
2020
|
+
function scheduleCleanupIfNoNewLocks(delay, callback) {
|
|
2021
|
+
cancelPendingCleanup();
|
|
2022
|
+
isInCleanupTransition = true;
|
|
2023
|
+
cleanupScheduledAt = Date.now();
|
|
2024
|
+
const currentCleanupId = cleanupScheduledAt;
|
|
2025
|
+
const cleanupFn = () => {
|
|
2026
|
+
cleanupTimeoutId = null;
|
|
2027
|
+
if (cleanupScheduledAt !== currentCleanupId) return;
|
|
2028
|
+
if (!isAnyLocked(lockMap)) {
|
|
2029
|
+
isInCleanupTransition = false;
|
|
2030
|
+
callback();
|
|
2031
|
+
} else {
|
|
2032
|
+
isInCleanupTransition = false;
|
|
2033
|
+
}
|
|
2034
|
+
};
|
|
2035
|
+
const actualDelay = delay === null ? 24 : delay;
|
|
2036
|
+
cleanupTimeoutId = window.setTimeout(cleanupFn, actualDelay);
|
|
2037
|
+
}
|
|
2038
|
+
function ensureInitialStyleCaptured() {
|
|
2039
|
+
if (initialBodyStyle === null && lockMap.size === 0 && !isInCleanupTransition) {
|
|
2040
|
+
initialBodyStyle = document.body.getAttribute("style");
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
watch(() => anyLocked.current, () => {
|
|
2044
|
+
if (!anyLocked.current) return;
|
|
2045
|
+
ensureInitialStyleCaptured();
|
|
2046
|
+
isInCleanupTransition = false;
|
|
2047
|
+
const htmlStyle = getComputedStyle(document.documentElement);
|
|
2048
|
+
const bodyStyle = getComputedStyle(document.body);
|
|
2049
|
+
const hasStableGutter = htmlStyle.scrollbarGutter?.includes("stable") || bodyStyle.scrollbarGutter?.includes("stable");
|
|
2050
|
+
const verticalScrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
2051
|
+
const paddingRight = Number.parseInt(bodyStyle.paddingRight ?? "0", 10);
|
|
2052
|
+
const config = {
|
|
2053
|
+
padding: paddingRight + verticalScrollbarWidth,
|
|
2054
|
+
margin: Number.parseInt(bodyStyle.marginRight ?? "0", 10)
|
|
2055
|
+
};
|
|
2056
|
+
if (verticalScrollbarWidth > 0 && !hasStableGutter) {
|
|
2057
|
+
document.body.style.paddingRight = `${config.padding}px`;
|
|
2058
|
+
document.body.style.marginRight = `${config.margin}px`;
|
|
2059
|
+
document.body.style.setProperty("--scrollbar-width", `${verticalScrollbarWidth}px`);
|
|
2060
|
+
}
|
|
2061
|
+
document.body.style.overflow = "hidden";
|
|
2062
|
+
if (isIOS) {
|
|
2063
|
+
on(
|
|
2064
|
+
document,
|
|
2065
|
+
"touchmove",
|
|
2066
|
+
(e) => {
|
|
2067
|
+
if (e.target !== document.documentElement) return;
|
|
2068
|
+
if (e.touches.length > 1) return;
|
|
2069
|
+
e.preventDefault();
|
|
2070
|
+
},
|
|
2071
|
+
{ passive: false }
|
|
2072
|
+
);
|
|
2073
|
+
}
|
|
2074
|
+
afterTick(() => {
|
|
2075
|
+
document.body.style.pointerEvents = "none";
|
|
2076
|
+
document.body.style.overflow = "hidden";
|
|
2077
|
+
});
|
|
2078
|
+
});
|
|
2079
|
+
return {
|
|
2080
|
+
get lockMap() {
|
|
2081
|
+
return lockMap;
|
|
2082
|
+
},
|
|
2083
|
+
resetBodyStyle,
|
|
2084
|
+
scheduleCleanupIfNoNewLocks,
|
|
2085
|
+
cancelPendingCleanup,
|
|
2086
|
+
ensureInitialStyleCaptured
|
|
2087
|
+
};
|
|
2088
|
+
});
|
|
2089
|
+
class BodyScrollLock {
|
|
2090
|
+
#id = useId();
|
|
2091
|
+
#initialState;
|
|
2092
|
+
#restoreScrollDelay = () => null;
|
|
2093
|
+
#countState;
|
|
2094
|
+
locked;
|
|
2095
|
+
constructor(initialState, restoreScrollDelay = () => null) {
|
|
2096
|
+
this.#initialState = initialState;
|
|
2097
|
+
this.#restoreScrollDelay = restoreScrollDelay;
|
|
2098
|
+
this.#countState = bodyLockStackCount.get();
|
|
2099
|
+
if (!this.#countState) return;
|
|
2100
|
+
this.#countState.cancelPendingCleanup();
|
|
2101
|
+
this.#countState.ensureInitialStyleCaptured();
|
|
2102
|
+
this.#countState.lockMap.set(this.#id, this.#initialState ?? false);
|
|
2103
|
+
this.locked = boxWith(() => this.#countState.lockMap.get(this.#id) ?? false, (v) => this.#countState.lockMap.set(this.#id, v));
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
function isAnyLocked(map) {
|
|
2107
|
+
for (const [_, value] of map) {
|
|
2108
|
+
if (value) return true;
|
|
2109
|
+
}
|
|
2110
|
+
return false;
|
|
2111
|
+
}
|
|
2112
|
+
function Scroll_lock($$renderer, $$props) {
|
|
2113
|
+
$$renderer.component(($$renderer2) => {
|
|
2114
|
+
let { preventScroll = true, restoreScrollDelay = null } = $$props;
|
|
2115
|
+
if (preventScroll) {
|
|
2116
|
+
new BodyScrollLock(preventScroll, () => restoreScrollDelay);
|
|
2117
|
+
}
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
function Alert_dialog_content$1($$renderer, $$props) {
|
|
2121
|
+
$$renderer.component(($$renderer2) => {
|
|
2122
|
+
const uid = props_id($$renderer2);
|
|
2123
|
+
let {
|
|
2124
|
+
id = createId(uid),
|
|
2125
|
+
children,
|
|
2126
|
+
child,
|
|
2127
|
+
ref = null,
|
|
2128
|
+
forceMount = false,
|
|
2129
|
+
interactOutsideBehavior = "ignore",
|
|
2130
|
+
onCloseAutoFocus = noop,
|
|
2131
|
+
onEscapeKeydown = noop,
|
|
2132
|
+
onOpenAutoFocus = noop,
|
|
2133
|
+
onInteractOutside = noop,
|
|
2134
|
+
preventScroll = true,
|
|
2135
|
+
trapFocus = true,
|
|
2136
|
+
restoreScrollDelay = null,
|
|
2137
|
+
$$slots,
|
|
2138
|
+
$$events,
|
|
2139
|
+
...restProps
|
|
2140
|
+
} = $$props;
|
|
2141
|
+
const contentState = DialogContentState.create({
|
|
2142
|
+
id: boxWith(() => id),
|
|
2143
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
2144
|
+
});
|
|
2145
|
+
const mergedProps = mergeProps(restProps, contentState.props);
|
|
2146
|
+
if (contentState.shouldRender || forceMount) {
|
|
2147
|
+
$$renderer2.push("<!--[-->");
|
|
2148
|
+
{
|
|
2149
|
+
let focusScope = function($$renderer3, { props: focusScopeProps }) {
|
|
2150
|
+
Escape_layer($$renderer3, spread_props([
|
|
2151
|
+
mergedProps,
|
|
2152
|
+
{
|
|
2153
|
+
enabled: contentState.root.opts.open.current,
|
|
2154
|
+
ref: contentState.opts.ref,
|
|
2155
|
+
onEscapeKeydown: (e) => {
|
|
2156
|
+
onEscapeKeydown(e);
|
|
2157
|
+
if (e.defaultPrevented) return;
|
|
2158
|
+
contentState.root.handleClose();
|
|
2159
|
+
},
|
|
2160
|
+
children: ($$renderer4) => {
|
|
2161
|
+
Dismissible_layer($$renderer4, spread_props([
|
|
2162
|
+
mergedProps,
|
|
2163
|
+
{
|
|
2164
|
+
ref: contentState.opts.ref,
|
|
2165
|
+
enabled: contentState.root.opts.open.current,
|
|
2166
|
+
interactOutsideBehavior,
|
|
2167
|
+
onInteractOutside: (e) => {
|
|
2168
|
+
onInteractOutside(e);
|
|
2169
|
+
if (e.defaultPrevented) return;
|
|
2170
|
+
contentState.root.handleClose();
|
|
2171
|
+
},
|
|
2172
|
+
children: ($$renderer5) => {
|
|
2173
|
+
Text_selection_layer($$renderer5, spread_props([
|
|
2174
|
+
mergedProps,
|
|
2175
|
+
{
|
|
2176
|
+
ref: contentState.opts.ref,
|
|
2177
|
+
enabled: contentState.root.opts.open.current,
|
|
2178
|
+
children: ($$renderer6) => {
|
|
2179
|
+
if (child) {
|
|
2180
|
+
$$renderer6.push("<!--[-->");
|
|
2181
|
+
if (contentState.root.opts.open.current) {
|
|
2182
|
+
$$renderer6.push("<!--[-->");
|
|
2183
|
+
Scroll_lock($$renderer6, { preventScroll, restoreScrollDelay });
|
|
2184
|
+
} else {
|
|
2185
|
+
$$renderer6.push("<!--[!-->");
|
|
2186
|
+
}
|
|
2187
|
+
$$renderer6.push(`<!--]--> `);
|
|
2188
|
+
child($$renderer6, {
|
|
2189
|
+
props: mergeProps(mergedProps, focusScopeProps),
|
|
2190
|
+
...contentState.snippetProps
|
|
2191
|
+
});
|
|
2192
|
+
$$renderer6.push(`<!---->`);
|
|
2193
|
+
} else {
|
|
2194
|
+
$$renderer6.push("<!--[!-->");
|
|
2195
|
+
Scroll_lock($$renderer6, { preventScroll });
|
|
2196
|
+
$$renderer6.push(`<!----> <div${attributes({ ...mergeProps(mergedProps, focusScopeProps) })}>`);
|
|
2197
|
+
children?.($$renderer6);
|
|
2198
|
+
$$renderer6.push(`<!----></div>`);
|
|
2199
|
+
}
|
|
2200
|
+
$$renderer6.push(`<!--]-->`);
|
|
2201
|
+
},
|
|
2202
|
+
$$slots: { default: true }
|
|
2203
|
+
}
|
|
2204
|
+
]));
|
|
2205
|
+
},
|
|
2206
|
+
$$slots: { default: true }
|
|
2207
|
+
}
|
|
2208
|
+
]));
|
|
2209
|
+
},
|
|
2210
|
+
$$slots: { default: true }
|
|
2211
|
+
}
|
|
2212
|
+
]));
|
|
2213
|
+
};
|
|
2214
|
+
Focus_scope($$renderer2, {
|
|
2215
|
+
ref: contentState.opts.ref,
|
|
2216
|
+
loop: true,
|
|
2217
|
+
trapFocus,
|
|
2218
|
+
enabled: contentState.root.opts.open.current,
|
|
2219
|
+
onCloseAutoFocus,
|
|
2220
|
+
onOpenAutoFocus: (e) => {
|
|
2221
|
+
onOpenAutoFocus(e);
|
|
2222
|
+
if (e.defaultPrevented) return;
|
|
2223
|
+
e.preventDefault();
|
|
2224
|
+
afterSleep(0, () => contentState.opts.ref.current?.focus());
|
|
2225
|
+
},
|
|
2226
|
+
focusScope
|
|
2227
|
+
});
|
|
2228
|
+
}
|
|
2229
|
+
} else {
|
|
2230
|
+
$$renderer2.push("<!--[!-->");
|
|
2231
|
+
}
|
|
2232
|
+
$$renderer2.push(`<!--]-->`);
|
|
2233
|
+
bind_props($$props, { ref });
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
function Dialog_overlay($$renderer, $$props) {
|
|
2237
|
+
$$renderer.component(($$renderer2) => {
|
|
2238
|
+
const uid = props_id($$renderer2);
|
|
2239
|
+
let {
|
|
2240
|
+
id = createId(uid),
|
|
2241
|
+
forceMount = false,
|
|
2242
|
+
child,
|
|
2243
|
+
children,
|
|
2244
|
+
ref = null,
|
|
2245
|
+
$$slots,
|
|
2246
|
+
$$events,
|
|
2247
|
+
...restProps
|
|
2248
|
+
} = $$props;
|
|
2249
|
+
const overlayState = DialogOverlayState.create({
|
|
2250
|
+
id: boxWith(() => id),
|
|
2251
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
2252
|
+
});
|
|
2253
|
+
const mergedProps = mergeProps(restProps, overlayState.props);
|
|
2254
|
+
if (overlayState.shouldRender || forceMount) {
|
|
2255
|
+
$$renderer2.push("<!--[-->");
|
|
2256
|
+
if (child) {
|
|
2257
|
+
$$renderer2.push("<!--[-->");
|
|
2258
|
+
child($$renderer2, { props: mergeProps(mergedProps), ...overlayState.snippetProps });
|
|
2259
|
+
$$renderer2.push(`<!---->`);
|
|
2260
|
+
} else {
|
|
2261
|
+
$$renderer2.push("<!--[!-->");
|
|
2262
|
+
$$renderer2.push(`<div${attributes({ ...mergeProps(mergedProps) })}>`);
|
|
2263
|
+
children?.($$renderer2, overlayState.snippetProps);
|
|
2264
|
+
$$renderer2.push(`<!----></div>`);
|
|
2265
|
+
}
|
|
2266
|
+
$$renderer2.push(`<!--]-->`);
|
|
2267
|
+
} else {
|
|
2268
|
+
$$renderer2.push("<!--[!-->");
|
|
2269
|
+
}
|
|
2270
|
+
$$renderer2.push(`<!--]-->`);
|
|
2271
|
+
bind_props($$props, { ref });
|
|
2272
|
+
});
|
|
2273
|
+
}
|
|
2274
|
+
function Dialog_description($$renderer, $$props) {
|
|
2275
|
+
$$renderer.component(($$renderer2) => {
|
|
2276
|
+
const uid = props_id($$renderer2);
|
|
2277
|
+
let {
|
|
2278
|
+
id = createId(uid),
|
|
2279
|
+
children,
|
|
2280
|
+
child,
|
|
2281
|
+
ref = null,
|
|
2282
|
+
$$slots,
|
|
2283
|
+
$$events,
|
|
2284
|
+
...restProps
|
|
2285
|
+
} = $$props;
|
|
2286
|
+
const descriptionState = DialogDescriptionState.create({
|
|
2287
|
+
id: boxWith(() => id),
|
|
2288
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
2289
|
+
});
|
|
2290
|
+
const mergedProps = mergeProps(restProps, descriptionState.props);
|
|
2291
|
+
if (child) {
|
|
2292
|
+
$$renderer2.push("<!--[-->");
|
|
2293
|
+
child($$renderer2, { props: mergedProps });
|
|
2294
|
+
$$renderer2.push(`<!---->`);
|
|
2295
|
+
} else {
|
|
2296
|
+
$$renderer2.push("<!--[!-->");
|
|
2297
|
+
$$renderer2.push(`<div${attributes({ ...mergedProps })}>`);
|
|
2298
|
+
children?.($$renderer2);
|
|
2299
|
+
$$renderer2.push(`<!----></div>`);
|
|
2300
|
+
}
|
|
2301
|
+
$$renderer2.push(`<!--]-->`);
|
|
2302
|
+
bind_props($$props, { ref });
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
function Alert_dialog($$renderer, $$props) {
|
|
2306
|
+
$$renderer.component(($$renderer2) => {
|
|
2307
|
+
let { open = false, $$slots, $$events, ...restProps } = $$props;
|
|
2308
|
+
let $$settled = true;
|
|
2309
|
+
let $$inner_renderer;
|
|
2310
|
+
function $$render_inner($$renderer3) {
|
|
2311
|
+
$$renderer3.push(`<!---->`);
|
|
2312
|
+
Alert_dialog$1?.($$renderer3, spread_props([
|
|
2313
|
+
restProps,
|
|
2314
|
+
{
|
|
2315
|
+
get open() {
|
|
2316
|
+
return open;
|
|
2317
|
+
},
|
|
2318
|
+
set open($$value) {
|
|
2319
|
+
open = $$value;
|
|
2320
|
+
$$settled = false;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
]));
|
|
2324
|
+
$$renderer3.push(`<!---->`);
|
|
2325
|
+
}
|
|
2326
|
+
do {
|
|
2327
|
+
$$settled = true;
|
|
2328
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2329
|
+
$$render_inner($$inner_renderer);
|
|
2330
|
+
} while (!$$settled);
|
|
2331
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2332
|
+
bind_props($$props, { open });
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
function Alert_dialog_portal($$renderer, $$props) {
|
|
2336
|
+
let { $$slots, $$events, ...restProps } = $$props;
|
|
2337
|
+
$$renderer.push(`<!---->`);
|
|
2338
|
+
Portal?.($$renderer, spread_props([restProps]));
|
|
2339
|
+
$$renderer.push(`<!---->`);
|
|
2340
|
+
}
|
|
2341
|
+
function Alert_dialog_title($$renderer, $$props) {
|
|
2342
|
+
$$renderer.component(($$renderer2) => {
|
|
2343
|
+
let {
|
|
2344
|
+
ref = null,
|
|
2345
|
+
class: className,
|
|
2346
|
+
$$slots,
|
|
2347
|
+
$$events,
|
|
2348
|
+
...restProps
|
|
2349
|
+
} = $$props;
|
|
2350
|
+
let $$settled = true;
|
|
2351
|
+
let $$inner_renderer;
|
|
2352
|
+
function $$render_inner($$renderer3) {
|
|
2353
|
+
$$renderer3.push(`<!---->`);
|
|
2354
|
+
Dialog_title?.($$renderer3, spread_props([
|
|
2355
|
+
{
|
|
2356
|
+
"data-slot": "alert-dialog-title",
|
|
2357
|
+
class: cn("text-lg font-semibold", className)
|
|
2358
|
+
},
|
|
2359
|
+
restProps,
|
|
2360
|
+
{
|
|
2361
|
+
get ref() {
|
|
2362
|
+
return ref;
|
|
2363
|
+
},
|
|
2364
|
+
set ref($$value) {
|
|
2365
|
+
ref = $$value;
|
|
2366
|
+
$$settled = false;
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
]));
|
|
2370
|
+
$$renderer3.push(`<!---->`);
|
|
2371
|
+
}
|
|
2372
|
+
do {
|
|
2373
|
+
$$settled = true;
|
|
2374
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2375
|
+
$$render_inner($$inner_renderer);
|
|
2376
|
+
} while (!$$settled);
|
|
2377
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2378
|
+
bind_props($$props, { ref });
|
|
2379
|
+
});
|
|
2380
|
+
}
|
|
2381
|
+
function Alert_dialog_action($$renderer, $$props) {
|
|
2382
|
+
$$renderer.component(($$renderer2) => {
|
|
2383
|
+
let {
|
|
2384
|
+
ref = null,
|
|
2385
|
+
class: className,
|
|
2386
|
+
$$slots,
|
|
2387
|
+
$$events,
|
|
2388
|
+
...restProps
|
|
2389
|
+
} = $$props;
|
|
2390
|
+
let $$settled = true;
|
|
2391
|
+
let $$inner_renderer;
|
|
2392
|
+
function $$render_inner($$renderer3) {
|
|
2393
|
+
$$renderer3.push(`<!---->`);
|
|
2394
|
+
Alert_dialog_action$1?.($$renderer3, spread_props([
|
|
2395
|
+
{
|
|
2396
|
+
"data-slot": "alert-dialog-action",
|
|
2397
|
+
class: cn(buttonVariants(), className)
|
|
2398
|
+
},
|
|
2399
|
+
restProps,
|
|
2400
|
+
{
|
|
2401
|
+
get ref() {
|
|
2402
|
+
return ref;
|
|
2403
|
+
},
|
|
2404
|
+
set ref($$value) {
|
|
2405
|
+
ref = $$value;
|
|
2406
|
+
$$settled = false;
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
]));
|
|
2410
|
+
$$renderer3.push(`<!---->`);
|
|
2411
|
+
}
|
|
2412
|
+
do {
|
|
2413
|
+
$$settled = true;
|
|
2414
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2415
|
+
$$render_inner($$inner_renderer);
|
|
2416
|
+
} while (!$$settled);
|
|
2417
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2418
|
+
bind_props($$props, { ref });
|
|
2419
|
+
});
|
|
2420
|
+
}
|
|
2421
|
+
function Alert_dialog_cancel($$renderer, $$props) {
|
|
2422
|
+
$$renderer.component(($$renderer2) => {
|
|
2423
|
+
let {
|
|
2424
|
+
ref = null,
|
|
2425
|
+
class: className,
|
|
2426
|
+
$$slots,
|
|
2427
|
+
$$events,
|
|
2428
|
+
...restProps
|
|
2429
|
+
} = $$props;
|
|
2430
|
+
let $$settled = true;
|
|
2431
|
+
let $$inner_renderer;
|
|
2432
|
+
function $$render_inner($$renderer3) {
|
|
2433
|
+
$$renderer3.push(`<!---->`);
|
|
2434
|
+
Alert_dialog_cancel$1?.($$renderer3, spread_props([
|
|
2435
|
+
{
|
|
2436
|
+
"data-slot": "alert-dialog-cancel",
|
|
2437
|
+
class: cn(buttonVariants({ variant: "outline" }), className)
|
|
2438
|
+
},
|
|
2439
|
+
restProps,
|
|
2440
|
+
{
|
|
2441
|
+
get ref() {
|
|
2442
|
+
return ref;
|
|
2443
|
+
},
|
|
2444
|
+
set ref($$value) {
|
|
2445
|
+
ref = $$value;
|
|
2446
|
+
$$settled = false;
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
]));
|
|
2450
|
+
$$renderer3.push(`<!---->`);
|
|
2451
|
+
}
|
|
2452
|
+
do {
|
|
2453
|
+
$$settled = true;
|
|
2454
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2455
|
+
$$render_inner($$inner_renderer);
|
|
2456
|
+
} while (!$$settled);
|
|
2457
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2458
|
+
bind_props($$props, { ref });
|
|
2459
|
+
});
|
|
2460
|
+
}
|
|
2461
|
+
function Alert_dialog_footer($$renderer, $$props) {
|
|
2462
|
+
$$renderer.component(($$renderer2) => {
|
|
2463
|
+
let {
|
|
2464
|
+
ref = null,
|
|
2465
|
+
class: className,
|
|
2466
|
+
children,
|
|
2467
|
+
$$slots,
|
|
2468
|
+
$$events,
|
|
2469
|
+
...restProps
|
|
2470
|
+
} = $$props;
|
|
2471
|
+
$$renderer2.push(`<div${attributes({
|
|
2472
|
+
"data-slot": "alert-dialog-footer",
|
|
2473
|
+
class: clsx$1(cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)),
|
|
2474
|
+
...restProps
|
|
2475
|
+
})}>`);
|
|
2476
|
+
children?.($$renderer2);
|
|
2477
|
+
$$renderer2.push(`<!----></div>`);
|
|
2478
|
+
bind_props($$props, { ref });
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
function Alert_dialog_header($$renderer, $$props) {
|
|
2482
|
+
$$renderer.component(($$renderer2) => {
|
|
2483
|
+
let {
|
|
2484
|
+
ref = null,
|
|
2485
|
+
class: className,
|
|
2486
|
+
children,
|
|
2487
|
+
$$slots,
|
|
2488
|
+
$$events,
|
|
2489
|
+
...restProps
|
|
2490
|
+
} = $$props;
|
|
2491
|
+
$$renderer2.push(`<div${attributes({
|
|
2492
|
+
"data-slot": "alert-dialog-header",
|
|
2493
|
+
class: clsx$1(cn("flex flex-col gap-2 text-center sm:text-start", className)),
|
|
2494
|
+
...restProps
|
|
2495
|
+
})}>`);
|
|
2496
|
+
children?.($$renderer2);
|
|
2497
|
+
$$renderer2.push(`<!----></div>`);
|
|
2498
|
+
bind_props($$props, { ref });
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
function Alert_dialog_overlay($$renderer, $$props) {
|
|
2502
|
+
$$renderer.component(($$renderer2) => {
|
|
2503
|
+
let {
|
|
2504
|
+
ref = null,
|
|
2505
|
+
class: className,
|
|
2506
|
+
$$slots,
|
|
2507
|
+
$$events,
|
|
2508
|
+
...restProps
|
|
2509
|
+
} = $$props;
|
|
2510
|
+
let $$settled = true;
|
|
2511
|
+
let $$inner_renderer;
|
|
2512
|
+
function $$render_inner($$renderer3) {
|
|
2513
|
+
$$renderer3.push(`<!---->`);
|
|
2514
|
+
Dialog_overlay?.($$renderer3, spread_props([
|
|
2515
|
+
{
|
|
2516
|
+
"data-slot": "alert-dialog-overlay",
|
|
2517
|
+
class: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className)
|
|
2518
|
+
},
|
|
2519
|
+
restProps,
|
|
2520
|
+
{
|
|
2521
|
+
get ref() {
|
|
2522
|
+
return ref;
|
|
2523
|
+
},
|
|
2524
|
+
set ref($$value) {
|
|
2525
|
+
ref = $$value;
|
|
2526
|
+
$$settled = false;
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
]));
|
|
2530
|
+
$$renderer3.push(`<!---->`);
|
|
2531
|
+
}
|
|
2532
|
+
do {
|
|
2533
|
+
$$settled = true;
|
|
2534
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2535
|
+
$$render_inner($$inner_renderer);
|
|
2536
|
+
} while (!$$settled);
|
|
2537
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2538
|
+
bind_props($$props, { ref });
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
function Alert_dialog_content($$renderer, $$props) {
|
|
2542
|
+
$$renderer.component(($$renderer2) => {
|
|
2543
|
+
let {
|
|
2544
|
+
ref = null,
|
|
2545
|
+
class: className,
|
|
2546
|
+
portalProps,
|
|
2547
|
+
$$slots,
|
|
2548
|
+
$$events,
|
|
2549
|
+
...restProps
|
|
2550
|
+
} = $$props;
|
|
2551
|
+
let $$settled = true;
|
|
2552
|
+
let $$inner_renderer;
|
|
2553
|
+
function $$render_inner($$renderer3) {
|
|
2554
|
+
Alert_dialog_portal($$renderer3, spread_props([
|
|
2555
|
+
portalProps,
|
|
2556
|
+
{
|
|
2557
|
+
children: ($$renderer4) => {
|
|
2558
|
+
Alert_dialog_overlay($$renderer4, {});
|
|
2559
|
+
$$renderer4.push(`<!----> <!---->`);
|
|
2560
|
+
Alert_dialog_content$1?.($$renderer4, spread_props([
|
|
2561
|
+
{
|
|
2562
|
+
"data-slot": "alert-dialog-content",
|
|
2563
|
+
class: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", className)
|
|
2564
|
+
},
|
|
2565
|
+
restProps,
|
|
2566
|
+
{
|
|
2567
|
+
get ref() {
|
|
2568
|
+
return ref;
|
|
2569
|
+
},
|
|
2570
|
+
set ref($$value) {
|
|
2571
|
+
ref = $$value;
|
|
2572
|
+
$$settled = false;
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
]));
|
|
2576
|
+
$$renderer4.push(`<!---->`);
|
|
2577
|
+
},
|
|
2578
|
+
$$slots: { default: true }
|
|
2579
|
+
}
|
|
2580
|
+
]));
|
|
2581
|
+
}
|
|
2582
|
+
do {
|
|
2583
|
+
$$settled = true;
|
|
2584
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2585
|
+
$$render_inner($$inner_renderer);
|
|
2586
|
+
} while (!$$settled);
|
|
2587
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2588
|
+
bind_props($$props, { ref });
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
function Alert_dialog_description($$renderer, $$props) {
|
|
2592
|
+
$$renderer.component(($$renderer2) => {
|
|
2593
|
+
let {
|
|
2594
|
+
ref = null,
|
|
2595
|
+
class: className,
|
|
2596
|
+
$$slots,
|
|
2597
|
+
$$events,
|
|
2598
|
+
...restProps
|
|
2599
|
+
} = $$props;
|
|
2600
|
+
let $$settled = true;
|
|
2601
|
+
let $$inner_renderer;
|
|
2602
|
+
function $$render_inner($$renderer3) {
|
|
2603
|
+
$$renderer3.push(`<!---->`);
|
|
2604
|
+
Dialog_description?.($$renderer3, spread_props([
|
|
2605
|
+
{
|
|
2606
|
+
"data-slot": "alert-dialog-description",
|
|
2607
|
+
class: cn("text-muted-foreground text-sm", className)
|
|
2608
|
+
},
|
|
2609
|
+
restProps,
|
|
2610
|
+
{
|
|
2611
|
+
get ref() {
|
|
2612
|
+
return ref;
|
|
2613
|
+
},
|
|
2614
|
+
set ref($$value) {
|
|
2615
|
+
ref = $$value;
|
|
2616
|
+
$$settled = false;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
]));
|
|
2620
|
+
$$renderer3.push(`<!---->`);
|
|
2621
|
+
}
|
|
2622
|
+
do {
|
|
2623
|
+
$$settled = true;
|
|
2624
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2625
|
+
$$render_inner($$inner_renderer);
|
|
2626
|
+
} while (!$$settled);
|
|
2627
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2628
|
+
bind_props($$props, { ref });
|
|
2629
|
+
});
|
|
2630
|
+
}
|
|
2631
|
+
export {
|
|
2632
|
+
Alert_dialog as A,
|
|
2633
|
+
Alert_dialog_description as B,
|
|
2634
|
+
Context as C,
|
|
2635
|
+
DialogRootState as D,
|
|
2636
|
+
ENTER as E,
|
|
2637
|
+
Focus_scope as F,
|
|
2638
|
+
Alert_dialog_footer as G,
|
|
2639
|
+
Alert_dialog_cancel as H,
|
|
2640
|
+
Alert_dialog_action as I,
|
|
2641
|
+
Portal as P,
|
|
2642
|
+
SPACE as S,
|
|
2643
|
+
Text_selection_layer as T,
|
|
2644
|
+
attachRef as a,
|
|
2645
|
+
boolToEmptyStrOrUndef as b,
|
|
2646
|
+
createBitsAttrs as c,
|
|
2647
|
+
boolToStr as d,
|
|
2648
|
+
createId as e,
|
|
2649
|
+
boxWith as f,
|
|
2650
|
+
getAriaChecked as g,
|
|
2651
|
+
DialogCloseState as h,
|
|
2652
|
+
isHTMLElement as i,
|
|
2653
|
+
DialogContentState as j,
|
|
2654
|
+
Escape_layer as k,
|
|
2655
|
+
Dismissible_layer as l,
|
|
2656
|
+
mergeProps as m,
|
|
2657
|
+
noop as n,
|
|
2658
|
+
Scroll_lock as o,
|
|
2659
|
+
simpleBox as p,
|
|
2660
|
+
executeCallbacks as q,
|
|
2661
|
+
DOMContext as r,
|
|
2662
|
+
styleToString as s,
|
|
2663
|
+
Dialog_title as t,
|
|
2664
|
+
useId as u,
|
|
2665
|
+
Dialog_overlay as v,
|
|
2666
|
+
watch as w,
|
|
2667
|
+
Alert_dialog_content as x,
|
|
2668
|
+
Alert_dialog_header as y,
|
|
2669
|
+
Alert_dialog_title as z
|
|
2670
|
+
};
|