@agent-ui-kit/web-components 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-ui.css +1 -0
- package/dist/chunks/agent-ciCayeod.js +1241 -0
- package/dist/chunks/agent-ciCayeod.js.map +1 -0
- package/dist/chunks/registry-BNb5ABBs.js +25 -0
- package/dist/chunks/registry-BNb5ABBs.js.map +1 -0
- package/dist/components/agent.js +13 -0
- package/dist/components/agent.js.map +1 -0
- package/dist/components/editor.js +200 -0
- package/dist/components/editor.js.map +1 -0
- package/dist/components/graph.js +352 -0
- package/dist/components/graph.js.map +1 -0
- package/dist/components.js +3137 -0
- package/dist/components.js.map +1 -0
- package/dist/element.js +10 -0
- package/dist/element.js.map +1 -0
- package/dist/icons.js +104 -0
- package/dist/icons.js.map +1 -0
- package/dist/reactivity.js +9 -0
- package/dist/reactivity.js.map +1 -0
- package/dist/register.js +1441 -0
- package/dist/register.js.map +1 -0
- package/dist/store.js +34 -0
- package/dist/store.js.map +1 -0
- package/dist/styles.js +2 -0
- package/dist/styles.js.map +1 -0
- package/dist/traits.js +2453 -0
- package/dist/traits.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,3137 @@
|
|
|
1
|
+
import { A as h, s as H, u as D } from "./chunks/agent-ciCayeod.js";
|
|
2
|
+
import { w as ee, j as ie, f as se, m as ne, h as ae, l as re, n as le, k as he, i as oe, g as de, R as ce, x as ue, y as be } from "./chunks/agent-ciCayeod.js";
|
|
3
|
+
import { o as N, g as U } from "./chunks/registry-BNb5ABBs.js";
|
|
4
|
+
import { a as pe, r as me } from "./chunks/registry-BNb5ABBs.js";
|
|
5
|
+
class Q extends h {
|
|
6
|
+
static attributes = {
|
|
7
|
+
disabled: { type: "boolean", default: !1 },
|
|
8
|
+
loading: { type: "boolean", default: !1 },
|
|
9
|
+
type: { type: "enum", values: ["button", "submit", "reset"], default: "button" },
|
|
10
|
+
label: { type: "string", default: "" },
|
|
11
|
+
icon: { type: "string", default: "" },
|
|
12
|
+
"icon-leading": { type: "string", default: "" },
|
|
13
|
+
"icon-trailing": { type: "string", default: "" },
|
|
14
|
+
"text-leading": { type: "string", default: "" },
|
|
15
|
+
"text-trailing": { type: "string", default: "" },
|
|
16
|
+
href: { type: "string", default: "" }
|
|
17
|
+
};
|
|
18
|
+
#t = null;
|
|
19
|
+
#e = null;
|
|
20
|
+
#i = null;
|
|
21
|
+
#s = null;
|
|
22
|
+
activate() {
|
|
23
|
+
this.addEventListener("click", this.#n), this.addEventListener("keydown", this.#a), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.setAttribute("role", "button"), Array.from(this.childNodes).some(
|
|
24
|
+
(e) => e.nodeType === 3 && e.textContent.trim()
|
|
25
|
+
) && this.setAttribute("data-has-text", ""), this.addEffect(() => {
|
|
26
|
+
this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0");
|
|
27
|
+
}), this.addEffect(() => {
|
|
28
|
+
this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label");
|
|
29
|
+
}), this.addEffect(() => {
|
|
30
|
+
const e = this["icon-leading"] || this.icon, i = this["text-leading"];
|
|
31
|
+
if (e && !this.#t && (this.#t = document.createElement("aui-icon"), this.#t.setAttribute("slot", "leading"), this.prepend(this.#t)), this.#t && (e ? this.#t.setAttribute("name", e) : (this.#t.remove(), this.#t = null)), i && !this.#e) {
|
|
32
|
+
this.#e = document.createElement("span"), this.#e.setAttribute("slot", "leading-text");
|
|
33
|
+
const s = this.#t;
|
|
34
|
+
s ? s.after(this.#e) : this.prepend(this.#e);
|
|
35
|
+
}
|
|
36
|
+
this.#e && (i ? this.#e.textContent = i : (this.#e.remove(), this.#e = null));
|
|
37
|
+
}), this.addEffect(() => {
|
|
38
|
+
const e = this["icon-trailing"], i = this["text-trailing"];
|
|
39
|
+
if (e && !this.#i && (this.#i = document.createElement("aui-icon"), this.#i.setAttribute("slot", "trailing"), this.append(this.#i)), this.#i && (e ? this.#i.setAttribute("name", e) : (this.#i.remove(), this.#i = null)), i && !this.#s) {
|
|
40
|
+
this.#s = document.createElement("span"), this.#s.setAttribute("slot", "trailing-text");
|
|
41
|
+
const s = this.#i;
|
|
42
|
+
s ? s.before(this.#s) : this.append(this.#s);
|
|
43
|
+
}
|
|
44
|
+
this.#s && (i ? this.#s.textContent = i : (this.#s.remove(), this.#s = null));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
dispose() {
|
|
48
|
+
this.removeEventListener("click", this.#n), this.removeEventListener("keydown", this.#a);
|
|
49
|
+
}
|
|
50
|
+
#n = (t) => {
|
|
51
|
+
if (this.disabled || this.loading) {
|
|
52
|
+
t.preventDefault(), t.stopPropagation();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const e = this.href;
|
|
56
|
+
if (e) {
|
|
57
|
+
window.location.href = e;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const i = this.type;
|
|
61
|
+
if (i === "submit" || i === "reset") {
|
|
62
|
+
const s = this.closest("form");
|
|
63
|
+
s && (i === "submit" ? s.requestSubmit() : s.reset());
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
#a = (t) => {
|
|
67
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
class Z extends h {
|
|
71
|
+
static formAssociated = !0;
|
|
72
|
+
static attributes = {
|
|
73
|
+
disabled: { type: "boolean", default: !1 },
|
|
74
|
+
readonly: { type: "boolean", default: !1 },
|
|
75
|
+
required: { type: "boolean", default: !1 },
|
|
76
|
+
clearable: { type: "boolean", default: !1 },
|
|
77
|
+
autofocus: { type: "boolean", default: !1 },
|
|
78
|
+
type: { type: "enum", values: ["text", "email", "password", "search", "url", "tel", "number"], default: "text" },
|
|
79
|
+
placeholder: { type: "string", default: "" },
|
|
80
|
+
value: { type: "string", default: "" },
|
|
81
|
+
name: { type: "string", default: "" },
|
|
82
|
+
pattern: { type: "string", default: "" },
|
|
83
|
+
maxlength: { type: "string", default: "" },
|
|
84
|
+
font: { type: "string", default: "sans" }
|
|
85
|
+
};
|
|
86
|
+
#t;
|
|
87
|
+
#e = null;
|
|
88
|
+
#i = null;
|
|
89
|
+
#s = !1;
|
|
90
|
+
constructor() {
|
|
91
|
+
super(), this.#t = this.attachInternals(), this.#t.role = "textbox";
|
|
92
|
+
}
|
|
93
|
+
activate() {
|
|
94
|
+
if (this.#e = this.querySelector("[data-surface]"), !this.#e) {
|
|
95
|
+
this.#e = document.createElement("span"), this.#e.setAttribute("data-surface", ""), this.#e.setAttribute("contenteditable", "plaintext-only"), this.#e.setAttribute("spellcheck", "false"), this.#e.setAttribute("tabindex", "0");
|
|
96
|
+
const t = this.querySelector('[slot="trailing"]');
|
|
97
|
+
t ? this.insertBefore(this.#e, t) : this.appendChild(this.#e);
|
|
98
|
+
}
|
|
99
|
+
if (this.clearable && !this.querySelector("[data-clear]")) {
|
|
100
|
+
this.#i = document.createElement("span"), this.#i.setAttribute("data-clear", ""), this.#i.setAttribute("role", "button"), this.#i.setAttribute("tabindex", "-1"), this.#i.setAttribute("aria-label", "Clear"), this.#i.textContent = "✕";
|
|
101
|
+
const t = this.querySelector('[slot="trailing"]');
|
|
102
|
+
t ? this.insertBefore(this.#i, t) : this.appendChild(this.#i);
|
|
103
|
+
} else
|
|
104
|
+
this.#i = this.querySelector("[data-clear]");
|
|
105
|
+
this.value && this.#e && (this.#e.textContent = this.value), this.addEffect(() => {
|
|
106
|
+
const t = this.disabled || this.readonly;
|
|
107
|
+
this.#e?.setAttribute("contenteditable", t ? "false" : "plaintext-only"), this.disabled ? this.#e?.setAttribute("tabindex", "-1") : this.#e?.setAttribute("tabindex", "0"), this.#e?.setAttribute("data-placeholder", this.placeholder || ""), this.#t.setFormValue(this.value || null), this.#n(), this.#a();
|
|
108
|
+
}), this.addEffect(() => {
|
|
109
|
+
const t = this.value;
|
|
110
|
+
!this.#s && this.#e && this.#e.textContent !== t && (this.#e.textContent = t, this.#n());
|
|
111
|
+
}), this.#e.addEventListener("input", this.#l), this.#e.addEventListener("keydown", this.#h), this.#e.addEventListener("focus", this.#d), this.#e.addEventListener("blur", this.#u), this.#e.addEventListener("paste", this.#c), this.addEventListener("click", this.#b), this.#i?.addEventListener("click", this.#p), this.autofocus && requestAnimationFrame(() => this.#e?.focus());
|
|
112
|
+
}
|
|
113
|
+
dispose() {
|
|
114
|
+
this.#e?.removeEventListener("input", this.#l), this.#e?.removeEventListener("keydown", this.#h), this.#e?.removeEventListener("focus", this.#d), this.#e?.removeEventListener("blur", this.#u), this.#e?.removeEventListener("paste", this.#c), this.removeEventListener("click", this.#b), this.#i?.removeEventListener("click", this.#p);
|
|
115
|
+
}
|
|
116
|
+
// ── Public API ──────────────────────────────────────────
|
|
117
|
+
focus(t) {
|
|
118
|
+
this.#e?.focus(t);
|
|
119
|
+
}
|
|
120
|
+
blur() {
|
|
121
|
+
this.#e?.blur();
|
|
122
|
+
}
|
|
123
|
+
select() {
|
|
124
|
+
if (!this.#e) return;
|
|
125
|
+
const t = document.createRange();
|
|
126
|
+
t.selectNodeContents(this.#e);
|
|
127
|
+
const e = window.getSelection();
|
|
128
|
+
e?.removeAllRanges(), e?.addRange(t);
|
|
129
|
+
}
|
|
130
|
+
// ── Form callbacks ────────────────────────────────────
|
|
131
|
+
formDisabledCallback(t) {
|
|
132
|
+
this.disabled = t;
|
|
133
|
+
}
|
|
134
|
+
formResetCallback() {
|
|
135
|
+
this.value = "", this.#e && (this.#e.textContent = ""), this.#n();
|
|
136
|
+
}
|
|
137
|
+
formStateRestoreCallback(t) {
|
|
138
|
+
this.value = t ?? "", this.#e && (this.#e.textContent = this.value);
|
|
139
|
+
}
|
|
140
|
+
// ── Internal ──────────────────────────────────────────
|
|
141
|
+
#n() {
|
|
142
|
+
const t = !this.#e?.textContent?.trim();
|
|
143
|
+
try {
|
|
144
|
+
t ? this.#t.states?.add("empty") : this.#t.states?.delete("empty");
|
|
145
|
+
} catch {
|
|
146
|
+
}
|
|
147
|
+
this.toggleAttribute("data-input-empty", t);
|
|
148
|
+
}
|
|
149
|
+
#a() {
|
|
150
|
+
if (this.required && !this.value?.trim())
|
|
151
|
+
this.#t.setValidity(
|
|
152
|
+
{ valueMissing: !0 },
|
|
153
|
+
"This field is required",
|
|
154
|
+
this.#e ?? void 0
|
|
155
|
+
);
|
|
156
|
+
else if (this.pattern && this.value) {
|
|
157
|
+
try {
|
|
158
|
+
if (!new RegExp(`^(?:${this.pattern})$`).test(this.value)) {
|
|
159
|
+
this.#t.setValidity(
|
|
160
|
+
{ patternMismatch: !0 },
|
|
161
|
+
"Please match the requested format",
|
|
162
|
+
this.#e ?? void 0
|
|
163
|
+
);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
} catch {
|
|
167
|
+
}
|
|
168
|
+
this.#t.setValidity({});
|
|
169
|
+
} else
|
|
170
|
+
this.#t.setValidity({});
|
|
171
|
+
}
|
|
172
|
+
#r() {
|
|
173
|
+
if (!this.#e || this.#e.textContent?.trim()) return;
|
|
174
|
+
const t = window.getSelection();
|
|
175
|
+
t && t.setPosition(this.#e, 0);
|
|
176
|
+
}
|
|
177
|
+
// ── Event handlers ────────────────────────────────────
|
|
178
|
+
#l = () => {
|
|
179
|
+
this.#s = !0, this.value = this.#e?.textContent ?? "", this.#t.setFormValue(this.value || null), this.#n(), this.#s = !1, this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 }));
|
|
180
|
+
};
|
|
181
|
+
#h = (t) => {
|
|
182
|
+
if (t.key === "Enter") {
|
|
183
|
+
t.preventDefault(), this.#t.form?.requestSubmit();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (this.maxlength) {
|
|
187
|
+
const e = parseInt(this.maxlength, 10);
|
|
188
|
+
(this.#e?.textContent?.length ?? 0) >= e && t.key.length === 1 && !t.ctrlKey && !t.metaKey && (window.getSelection()?.toString() || t.preventDefault());
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
#d = () => {
|
|
192
|
+
this.#r();
|
|
193
|
+
};
|
|
194
|
+
#u = () => {
|
|
195
|
+
this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
196
|
+
};
|
|
197
|
+
#c = (t) => {
|
|
198
|
+
t.preventDefault();
|
|
199
|
+
let e = t.clipboardData?.getData("text/plain") ?? "";
|
|
200
|
+
if (e = e.replace(/[\r\n]+/g, " "), this.maxlength) {
|
|
201
|
+
const i = parseInt(this.maxlength, 10), s = this.#e?.textContent?.length ?? 0, a = window.getSelection()?.toString().length ?? 0, r = i - s + a;
|
|
202
|
+
e = e.slice(0, Math.max(0, r));
|
|
203
|
+
}
|
|
204
|
+
document.execCommand("insertText", !1, e);
|
|
205
|
+
};
|
|
206
|
+
#b = (t) => {
|
|
207
|
+
const e = t.target;
|
|
208
|
+
e === this || e.getAttribute("slot") === "leading" ? (this.#e?.focus(), this.#r()) : e === this.#e && this.#r();
|
|
209
|
+
};
|
|
210
|
+
#p = (t) => {
|
|
211
|
+
t.stopPropagation(), this.#e && (this.#e.textContent = ""), this.value = "", this.#t.setFormValue(null), this.#n(), this.#e?.focus(), this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 })), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
class tt extends h {
|
|
215
|
+
static formAssociated = !0;
|
|
216
|
+
static attributes = {
|
|
217
|
+
length: { type: "string", default: "6" },
|
|
218
|
+
disabled: { type: "boolean", default: !1 },
|
|
219
|
+
value: { type: "string", default: "" },
|
|
220
|
+
name: { type: "string", default: "" }
|
|
221
|
+
};
|
|
222
|
+
#t;
|
|
223
|
+
#e = [];
|
|
224
|
+
constructor() {
|
|
225
|
+
super(), this.#t = this.attachInternals();
|
|
226
|
+
}
|
|
227
|
+
activate() {
|
|
228
|
+
const t = parseInt(this.length, 10) || 6;
|
|
229
|
+
this.setAttribute("role", "group"), this.setAttribute("aria-label", "One-time code");
|
|
230
|
+
for (let e = 0; e < t; e++) {
|
|
231
|
+
const i = document.createElement("span");
|
|
232
|
+
i.setAttribute("data-cell", String(e)), i.setAttribute("contenteditable", "plaintext-only"), i.setAttribute("inputmode", "numeric"), i.setAttribute("tabindex", "0"), i.setAttribute("aria-label", `Digit ${e + 1} of ${t}`), this.appendChild(i), this.#e.push(i);
|
|
233
|
+
}
|
|
234
|
+
this.addEffect(() => {
|
|
235
|
+
for (const e of this.#e)
|
|
236
|
+
e.setAttribute("contenteditable", this.disabled ? "false" : "plaintext-only"), e.setAttribute("tabindex", this.disabled ? "-1" : "0");
|
|
237
|
+
this.#t.setFormValue(this.value || null);
|
|
238
|
+
}), this.value && this.#i(this.value);
|
|
239
|
+
for (const e of this.#e)
|
|
240
|
+
e.addEventListener("input", this.#a), e.addEventListener("keydown", this.#r), e.addEventListener("paste", this.#l), e.addEventListener("focus", this.#h);
|
|
241
|
+
}
|
|
242
|
+
dispose() {
|
|
243
|
+
for (const t of this.#e)
|
|
244
|
+
t.removeEventListener("input", this.#a), t.removeEventListener("keydown", this.#r), t.removeEventListener("paste", this.#l), t.removeEventListener("focus", this.#h);
|
|
245
|
+
this.#e = [];
|
|
246
|
+
}
|
|
247
|
+
formDisabledCallback(t) {
|
|
248
|
+
this.disabled = t;
|
|
249
|
+
}
|
|
250
|
+
formResetCallback() {
|
|
251
|
+
this.clear();
|
|
252
|
+
}
|
|
253
|
+
focus(t) {
|
|
254
|
+
(this.#e.find((i) => !i.textContent) ?? this.#e[0])?.focus(t);
|
|
255
|
+
}
|
|
256
|
+
clear() {
|
|
257
|
+
for (const t of this.#e) t.textContent = "";
|
|
258
|
+
this.#s(), this.#e[0]?.focus();
|
|
259
|
+
}
|
|
260
|
+
#i(t) {
|
|
261
|
+
for (let e = 0; e < this.#e.length; e++)
|
|
262
|
+
this.#e[e].textContent = t[e] ?? "";
|
|
263
|
+
}
|
|
264
|
+
#s() {
|
|
265
|
+
const t = this.#e.map((e) => e.textContent ?? "").join("");
|
|
266
|
+
this.value = t, this.#t.setFormValue(t || null), t.length === this.#e.length && this.dispatchEvent(new CustomEvent("aui:complete", { bubbles: !0, detail: { value: t } }));
|
|
267
|
+
}
|
|
268
|
+
#n(t) {
|
|
269
|
+
return this.#e.indexOf(t);
|
|
270
|
+
}
|
|
271
|
+
#a = (t) => {
|
|
272
|
+
const e = t.target, i = this.#n(e), s = e.textContent ?? "";
|
|
273
|
+
s.length > 1 && (e.textContent = s.slice(-1)), this.#s(), e.textContent && i < this.#e.length - 1 && this.#e[i + 1].focus();
|
|
274
|
+
};
|
|
275
|
+
#r = (t) => {
|
|
276
|
+
const e = t.target, i = this.#n(e);
|
|
277
|
+
t.key === "Backspace" ? !e.textContent && i > 0 && (t.preventDefault(), this.#e[i - 1].textContent = "", this.#e[i - 1].focus(), this.#s()) : t.key === "ArrowLeft" && i > 0 ? (t.preventDefault(), this.#e[i - 1].focus()) : t.key === "ArrowRight" && i < this.#e.length - 1 ? (t.preventDefault(), this.#e[i + 1].focus()) : t.key === "Enter" && t.preventDefault();
|
|
278
|
+
};
|
|
279
|
+
#l = (t) => {
|
|
280
|
+
t.preventDefault();
|
|
281
|
+
const i = (t.clipboardData?.getData("text") ?? "").replace(/\D/g, "").slice(0, this.#e.length);
|
|
282
|
+
this.#i(i), this.#s();
|
|
283
|
+
const s = Math.min(i.length, this.#e.length - 1);
|
|
284
|
+
this.#e[s]?.focus();
|
|
285
|
+
};
|
|
286
|
+
#h = (t) => {
|
|
287
|
+
const e = t.target, i = document.createRange();
|
|
288
|
+
i.selectNodeContents(e);
|
|
289
|
+
const s = window.getSelection();
|
|
290
|
+
s?.removeAllRanges(), s?.addRange(i);
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
class et extends h {
|
|
294
|
+
static formAssociated = !0;
|
|
295
|
+
static attributes = {
|
|
296
|
+
disabled: { type: "boolean", default: !1 },
|
|
297
|
+
checked: { type: "boolean", default: !1 },
|
|
298
|
+
indeterminate: { type: "boolean", default: !1 },
|
|
299
|
+
required: { type: "boolean", default: !1 },
|
|
300
|
+
label: { type: "string", default: "" },
|
|
301
|
+
name: { type: "string", default: "" },
|
|
302
|
+
value: { type: "string", default: "on" }
|
|
303
|
+
};
|
|
304
|
+
#t;
|
|
305
|
+
constructor() {
|
|
306
|
+
super(), this.#t = this.attachInternals(), this.#t.role = "checkbox";
|
|
307
|
+
}
|
|
308
|
+
activate() {
|
|
309
|
+
if (!this.querySelector("[data-box]")) {
|
|
310
|
+
const t = document.createElement("span");
|
|
311
|
+
t.setAttribute("data-box", ""), this.prepend(t);
|
|
312
|
+
}
|
|
313
|
+
this.addEffect(() => {
|
|
314
|
+
this.setAttribute("aria-checked", this.indeterminate ? "mixed" : String(this.checked)), this.setAttribute("aria-disabled", String(this.disabled)), this.#t.setFormValue(this.checked ? this.value || "on" : null), this.required && !this.checked ? this.#t.setValidity({ valueMissing: !0 }, "Please check this box") : this.#t.setValidity({});
|
|
315
|
+
}), this.addEffect(() => {
|
|
316
|
+
this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label");
|
|
317
|
+
}), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#i), this.addEventListener("keydown", this.#s);
|
|
318
|
+
}
|
|
319
|
+
dispose() {
|
|
320
|
+
this.removeEventListener("click", this.#i), this.removeEventListener("keydown", this.#s);
|
|
321
|
+
}
|
|
322
|
+
formDisabledCallback(t) {
|
|
323
|
+
this.disabled = t;
|
|
324
|
+
}
|
|
325
|
+
formResetCallback() {
|
|
326
|
+
this.checked = !1, this.indeterminate = !1;
|
|
327
|
+
}
|
|
328
|
+
#e() {
|
|
329
|
+
this.disabled || (this.indeterminate = !1, this.checked = !this.checked, this.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
330
|
+
}
|
|
331
|
+
#i = (t) => {
|
|
332
|
+
t.preventDefault(), this.#e();
|
|
333
|
+
};
|
|
334
|
+
#s = (t) => {
|
|
335
|
+
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.#e());
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
class it extends h {
|
|
339
|
+
static formAssociated = !0;
|
|
340
|
+
static attributes = {
|
|
341
|
+
disabled: { type: "boolean", default: !1 },
|
|
342
|
+
checked: { type: "boolean", default: !1 },
|
|
343
|
+
label: { type: "string", default: "" },
|
|
344
|
+
name: { type: "string", default: "" },
|
|
345
|
+
value: { type: "string", default: "on" }
|
|
346
|
+
};
|
|
347
|
+
#t;
|
|
348
|
+
constructor() {
|
|
349
|
+
super(), this.#t = this.attachInternals(), this.#t.role = "switch";
|
|
350
|
+
}
|
|
351
|
+
activate() {
|
|
352
|
+
if (!this.querySelector("[data-track]")) {
|
|
353
|
+
const t = document.createElement("span");
|
|
354
|
+
t.setAttribute("data-track", ""), this.prepend(t);
|
|
355
|
+
}
|
|
356
|
+
this.addEffect(() => {
|
|
357
|
+
this.setAttribute("aria-checked", String(this.checked)), this.setAttribute("aria-disabled", String(this.disabled)), this.#t.setFormValue(this.checked ? this.value || "on" : null);
|
|
358
|
+
}), this.addEffect(() => {
|
|
359
|
+
this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label");
|
|
360
|
+
}), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#i), this.addEventListener("keydown", this.#s);
|
|
361
|
+
}
|
|
362
|
+
dispose() {
|
|
363
|
+
this.removeEventListener("click", this.#i), this.removeEventListener("keydown", this.#s);
|
|
364
|
+
}
|
|
365
|
+
formDisabledCallback(t) {
|
|
366
|
+
this.disabled = t;
|
|
367
|
+
}
|
|
368
|
+
formResetCallback() {
|
|
369
|
+
this.checked = !1;
|
|
370
|
+
}
|
|
371
|
+
#e() {
|
|
372
|
+
this.disabled || (this.checked = !this.checked, this.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
373
|
+
}
|
|
374
|
+
#i = (t) => {
|
|
375
|
+
t.preventDefault(), this.#e();
|
|
376
|
+
};
|
|
377
|
+
#s = (t) => {
|
|
378
|
+
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.#e());
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
class st extends h {
|
|
382
|
+
static formAssociated = !0;
|
|
383
|
+
static attributes = {
|
|
384
|
+
disabled: { type: "boolean", default: !1 },
|
|
385
|
+
checked: { type: "boolean", default: !1 },
|
|
386
|
+
required: { type: "boolean", default: !1 },
|
|
387
|
+
label: { type: "string", default: "" },
|
|
388
|
+
name: { type: "string", default: "" },
|
|
389
|
+
value: { type: "string", default: "" }
|
|
390
|
+
};
|
|
391
|
+
#t;
|
|
392
|
+
constructor() {
|
|
393
|
+
super(), this.#t = this.attachInternals(), this.#t.role = "radio";
|
|
394
|
+
}
|
|
395
|
+
activate() {
|
|
396
|
+
if (!this.querySelector("[data-circle]")) {
|
|
397
|
+
const t = document.createElement("span");
|
|
398
|
+
t.setAttribute("data-circle", ""), this.prepend(t);
|
|
399
|
+
}
|
|
400
|
+
this.addEffect(() => {
|
|
401
|
+
this.setAttribute("aria-checked", String(this.checked)), this.setAttribute("aria-disabled", String(this.disabled)), this.#t.setFormValue(this.checked ? this.value || "" : null);
|
|
402
|
+
}), this.addEffect(() => {
|
|
403
|
+
this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label");
|
|
404
|
+
}), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#i), this.addEventListener("keydown", this.#s);
|
|
405
|
+
}
|
|
406
|
+
dispose() {
|
|
407
|
+
this.removeEventListener("click", this.#i), this.removeEventListener("keydown", this.#s);
|
|
408
|
+
}
|
|
409
|
+
formDisabledCallback(t) {
|
|
410
|
+
this.disabled = t;
|
|
411
|
+
}
|
|
412
|
+
formResetCallback() {
|
|
413
|
+
this.checked = !1;
|
|
414
|
+
}
|
|
415
|
+
#e() {
|
|
416
|
+
this.disabled || this.checked || (this.checked = !0, this.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
417
|
+
}
|
|
418
|
+
#i = (t) => {
|
|
419
|
+
t.preventDefault(), this.#e();
|
|
420
|
+
};
|
|
421
|
+
#s = (t) => {
|
|
422
|
+
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.#e());
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
class nt extends h {
|
|
426
|
+
static attributes = {
|
|
427
|
+
disabled: { type: "boolean", default: !1 },
|
|
428
|
+
name: { type: "string", default: "" },
|
|
429
|
+
value: { type: "string", default: "" }
|
|
430
|
+
};
|
|
431
|
+
activate() {
|
|
432
|
+
this.setAttribute("role", "radiogroup"), this.addEffect(() => {
|
|
433
|
+
for (const t of this.#t())
|
|
434
|
+
this.name && t.setAttribute("name", this.name), this.disabled && t.setAttribute("disabled", "");
|
|
435
|
+
}), this.addEffect(() => {
|
|
436
|
+
if (this.value)
|
|
437
|
+
for (const t of this.#t()) {
|
|
438
|
+
const e = t.getAttribute("value") === this.value;
|
|
439
|
+
e && !t.hasAttribute("checked") ? t.setAttribute("checked", "") : !e && t.hasAttribute("checked") && t.removeAttribute("checked");
|
|
440
|
+
}
|
|
441
|
+
}), this.addEventListener("change", this.#e), this.addEventListener("keydown", this.#i);
|
|
442
|
+
}
|
|
443
|
+
dispose() {
|
|
444
|
+
this.removeEventListener("change", this.#e), this.removeEventListener("keydown", this.#i);
|
|
445
|
+
}
|
|
446
|
+
#t() {
|
|
447
|
+
return Array.from(this.querySelectorAll("aui-radio"));
|
|
448
|
+
}
|
|
449
|
+
#e = (t) => {
|
|
450
|
+
const e = t.target;
|
|
451
|
+
if (e.tagName !== "AUI-RADIO") return;
|
|
452
|
+
const i = e.getAttribute("value") || "";
|
|
453
|
+
this.value = i;
|
|
454
|
+
for (const s of this.#t())
|
|
455
|
+
s !== e && s.hasAttribute("checked") && s.removeAttribute("checked");
|
|
456
|
+
};
|
|
457
|
+
#i = (t) => {
|
|
458
|
+
const e = this.#t().filter((n) => !n.hasAttribute("disabled"));
|
|
459
|
+
if (e.length === 0) return;
|
|
460
|
+
const i = e.findIndex((n) => n.hasAttribute("checked"));
|
|
461
|
+
let s = -1;
|
|
462
|
+
switch (t.key) {
|
|
463
|
+
case "ArrowDown":
|
|
464
|
+
case "ArrowRight":
|
|
465
|
+
t.preventDefault(), s = i < e.length - 1 ? i + 1 : 0;
|
|
466
|
+
break;
|
|
467
|
+
case "ArrowUp":
|
|
468
|
+
case "ArrowLeft":
|
|
469
|
+
t.preventDefault(), s = i > 0 ? i - 1 : e.length - 1;
|
|
470
|
+
break;
|
|
471
|
+
default:
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
s >= 0 && (e[s].click(), e[s].focus());
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
class at extends h {
|
|
478
|
+
static formAssociated = !0;
|
|
479
|
+
static attributes = {
|
|
480
|
+
disabled: { type: "boolean", default: !1 },
|
|
481
|
+
readonly: { type: "boolean", default: !1 },
|
|
482
|
+
required: { type: "boolean", default: !1 },
|
|
483
|
+
autogrow: { type: "boolean", default: !1 },
|
|
484
|
+
autofocus: { type: "boolean", default: !1 },
|
|
485
|
+
placeholder: { type: "string", default: "" },
|
|
486
|
+
value: { type: "string", default: "" },
|
|
487
|
+
name: { type: "string", default: "" },
|
|
488
|
+
rows: { type: "string", default: "3" },
|
|
489
|
+
maxlength: { type: "string", default: "" }
|
|
490
|
+
};
|
|
491
|
+
#t;
|
|
492
|
+
#e = null;
|
|
493
|
+
#i = !1;
|
|
494
|
+
#s = null;
|
|
495
|
+
constructor() {
|
|
496
|
+
super(), this.#t = this.attachInternals(), this.#t.role = "textbox", this.#t.ariaMultiLine = "true";
|
|
497
|
+
}
|
|
498
|
+
activate() {
|
|
499
|
+
this.#e = this.querySelector("[data-surface]"), this.#e || (this.#e = document.createElement("div"), this.#e.setAttribute("data-surface", ""), this.#e.setAttribute("contenteditable", "plaintext-only"), this.#e.setAttribute("spellcheck", "false"), this.#e.setAttribute("tabindex", "0"), this.appendChild(this.#e)), this.value && this.#e && (this.#e.textContent = this.value), this.addEffect(() => {
|
|
500
|
+
const t = this.disabled || this.readonly;
|
|
501
|
+
this.#e?.setAttribute("contenteditable", t ? "false" : "plaintext-only"), this.#e?.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.#e?.setAttribute("data-placeholder", this.placeholder || "");
|
|
502
|
+
const e = parseInt(this.rows, 10) || 3;
|
|
503
|
+
this.style.setProperty("--_rows", String(e)), this.#t.setFormValue(this.value || null), this.#n();
|
|
504
|
+
}), this.addEffect(() => {
|
|
505
|
+
const t = this.value;
|
|
506
|
+
!this.#i && this.#e && this.#e.textContent !== t && (this.#e.textContent = t, this.#n(), this.autogrow && this.#a());
|
|
507
|
+
}), this.#e.addEventListener("input", this.#r), this.#e.addEventListener("blur", this.#l), this.addEventListener("click", this.#h), this.autofocus && requestAnimationFrame(() => this.#e?.focus());
|
|
508
|
+
}
|
|
509
|
+
dispose() {
|
|
510
|
+
this.#e?.removeEventListener("input", this.#r), this.#e?.removeEventListener("blur", this.#l), this.removeEventListener("click", this.#h), this.#s !== null && cancelAnimationFrame(this.#s);
|
|
511
|
+
}
|
|
512
|
+
focus(t) {
|
|
513
|
+
this.#e?.focus(t);
|
|
514
|
+
}
|
|
515
|
+
blur() {
|
|
516
|
+
this.#e?.blur();
|
|
517
|
+
}
|
|
518
|
+
formDisabledCallback(t) {
|
|
519
|
+
this.disabled = t;
|
|
520
|
+
}
|
|
521
|
+
formResetCallback() {
|
|
522
|
+
this.value = "", this.#e && (this.#e.textContent = ""), this.#n();
|
|
523
|
+
}
|
|
524
|
+
#n() {
|
|
525
|
+
const t = !this.#e?.textContent?.trim();
|
|
526
|
+
try {
|
|
527
|
+
t ? this.#t.states?.add("empty") : this.#t.states?.delete("empty");
|
|
528
|
+
} catch {
|
|
529
|
+
}
|
|
530
|
+
this.toggleAttribute("data-input-empty", t);
|
|
531
|
+
}
|
|
532
|
+
#a() {
|
|
533
|
+
this.#s !== null && cancelAnimationFrame(this.#s), this.#s = requestAnimationFrame(() => {
|
|
534
|
+
this.#e && (this.#e.style.height = "auto", this.#e.style.height = this.#e.scrollHeight + "px");
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
#r = () => {
|
|
538
|
+
this.#i = !0, this.value = this.#e?.textContent ?? "", this.#t.setFormValue(this.value || null), this.#n(), this.autogrow && this.#a(), this.#i = !1, this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 }));
|
|
539
|
+
};
|
|
540
|
+
#l = () => {
|
|
541
|
+
this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
542
|
+
};
|
|
543
|
+
#h = (t) => {
|
|
544
|
+
t.target === this && this.#e?.focus();
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
class rt extends h {
|
|
548
|
+
static attributes = {
|
|
549
|
+
bordered: { type: "boolean", default: !1 },
|
|
550
|
+
elevation: { type: "string", default: "" },
|
|
551
|
+
interactive: { type: "boolean", default: !1 },
|
|
552
|
+
href: { type: "string", default: "" }
|
|
553
|
+
};
|
|
554
|
+
activate() {
|
|
555
|
+
this.interactive && (this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.setAttribute("role", "button"), this.addEventListener("click", this.#t), this.addEventListener("keydown", this.#e));
|
|
556
|
+
}
|
|
557
|
+
dispose() {
|
|
558
|
+
this.removeEventListener("click", this.#t), this.removeEventListener("keydown", this.#e);
|
|
559
|
+
}
|
|
560
|
+
#t = () => {
|
|
561
|
+
this.href && (window.location.href = this.href);
|
|
562
|
+
};
|
|
563
|
+
#e = (t) => {
|
|
564
|
+
(t.key === "Enter" || t.key === " ") && this.href && (t.preventDefault(), window.location.href = this.href);
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function F(l) {
|
|
568
|
+
const t = getComputedStyle(l).getPropertyValue("--aui-duration").trim();
|
|
569
|
+
return parseFloat(t) || 200;
|
|
570
|
+
}
|
|
571
|
+
class lt extends h {
|
|
572
|
+
static attributes = {
|
|
573
|
+
open: { type: "boolean", default: !1 },
|
|
574
|
+
size: { type: "enum", values: ["sm", "lg", "xl", "full"], default: "" }
|
|
575
|
+
};
|
|
576
|
+
#t = null;
|
|
577
|
+
#e = null;
|
|
578
|
+
#i = !1;
|
|
579
|
+
get dialogElement() {
|
|
580
|
+
return this.#t;
|
|
581
|
+
}
|
|
582
|
+
#s() {
|
|
583
|
+
if (this.#t) return this.#t;
|
|
584
|
+
if (this.#t = this.querySelector("dialog"), this.#t)
|
|
585
|
+
this.#e = this.#t.querySelector("[data-dialog-content]");
|
|
586
|
+
else {
|
|
587
|
+
for (this.#t = document.createElement("dialog"), this.#e = document.createElement("div"), this.#e.setAttribute("data-dialog-content", ""); this.firstChild && this.firstChild !== this.#t; )
|
|
588
|
+
this.#e.appendChild(this.firstChild);
|
|
589
|
+
this.#t.appendChild(this.#e), this.appendChild(this.#t);
|
|
590
|
+
}
|
|
591
|
+
return this.#t.addEventListener("cancel", this.#n), this.#t.addEventListener("close", this.#a), this.#t.addEventListener("click", this.#r), this.#t;
|
|
592
|
+
}
|
|
593
|
+
activate() {
|
|
594
|
+
this.#s(), this.addEffect(() => {
|
|
595
|
+
this.open ? this.show() : this.hide();
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
dispose() {
|
|
599
|
+
this.#t?.removeEventListener("cancel", this.#n), this.#t?.removeEventListener("close", this.#a), this.#t?.removeEventListener("click", this.#r);
|
|
600
|
+
}
|
|
601
|
+
// ── Public API ──────────────────────────────────────────
|
|
602
|
+
show() {
|
|
603
|
+
const t = this.#s();
|
|
604
|
+
t.open || (t.showModal(), requestAnimationFrame(() => {
|
|
605
|
+
t.setAttribute("data-dialog-open", "");
|
|
606
|
+
}), this.hasAttribute("open") || this.setAttribute("open", ""));
|
|
607
|
+
}
|
|
608
|
+
hide() {
|
|
609
|
+
!this.#t || !this.#t.open || this.#i || (this.#i = !0, this.#t.removeAttribute("data-dialog-open"), this.#t.setAttribute("data-dialog-closing", ""), setTimeout(() => {
|
|
610
|
+
this.#i = !1, this.#t?.removeAttribute("data-dialog-closing"), this.#t?.close();
|
|
611
|
+
}, F(this)));
|
|
612
|
+
}
|
|
613
|
+
// ── Internal ────────────────────────────────────────────
|
|
614
|
+
#n = (t) => {
|
|
615
|
+
t.preventDefault(), this.hide();
|
|
616
|
+
};
|
|
617
|
+
#a = () => {
|
|
618
|
+
this.removeAttribute("open"), this.dispatchEvent(new Event("close", { bubbles: !0 }));
|
|
619
|
+
};
|
|
620
|
+
#r = (t) => {
|
|
621
|
+
t.target === this.#t && this.hide();
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
function V(l) {
|
|
625
|
+
const t = getComputedStyle(l).getPropertyValue("--aui-duration").trim();
|
|
626
|
+
return parseFloat(t) || 200;
|
|
627
|
+
}
|
|
628
|
+
class ht extends h {
|
|
629
|
+
static attributes = {
|
|
630
|
+
open: { type: "boolean", default: !1 },
|
|
631
|
+
side: { type: "enum", values: ["left", "right", "top", "bottom"], default: "right" },
|
|
632
|
+
"scroll-lock": { type: "boolean", default: !1 }
|
|
633
|
+
};
|
|
634
|
+
#t = null;
|
|
635
|
+
#e = null;
|
|
636
|
+
#i = !1;
|
|
637
|
+
get dialogElement() {
|
|
638
|
+
return this.#t;
|
|
639
|
+
}
|
|
640
|
+
#s() {
|
|
641
|
+
if (this.#t) return this.#t;
|
|
642
|
+
if (this.#t = this.querySelector("dialog"), this.#t)
|
|
643
|
+
this.#e = this.#t.querySelector("[data-drawer-content]");
|
|
644
|
+
else {
|
|
645
|
+
for (this.#t = document.createElement("dialog"), this.#e = document.createElement("div"), this.#e.setAttribute("data-drawer-content", ""); this.firstChild && this.firstChild !== this.#t; )
|
|
646
|
+
this.#e.appendChild(this.firstChild);
|
|
647
|
+
this.#t.appendChild(this.#e), this.appendChild(this.#t);
|
|
648
|
+
}
|
|
649
|
+
return this.#t.addEventListener("cancel", this.#n), this.#t.addEventListener("close", this.#a), this.#t.addEventListener("click", this.#r), this.#t;
|
|
650
|
+
}
|
|
651
|
+
activate() {
|
|
652
|
+
this.#s(), this.addEffect(() => {
|
|
653
|
+
this.open ? this.show() : this.hide();
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
dispose() {
|
|
657
|
+
this.#t && (this.#t.removeEventListener("cancel", this.#n), this.#t.removeEventListener("close", this.#a), this.#t.removeEventListener("click", this.#r));
|
|
658
|
+
}
|
|
659
|
+
show() {
|
|
660
|
+
const t = this.#s();
|
|
661
|
+
t.open || (this["scroll-lock"] && (document.documentElement.style.overflow = "hidden"), t.showModal(), requestAnimationFrame(() => {
|
|
662
|
+
t.setAttribute("data-drawer-open", "");
|
|
663
|
+
}), this.hasAttribute("open") || this.setAttribute("open", ""));
|
|
664
|
+
}
|
|
665
|
+
hide() {
|
|
666
|
+
!this.#t || !this.#t.open || this.#i || (this.#i = !0, this.#t.removeAttribute("data-drawer-open"), this.#t.setAttribute("data-drawer-closing", ""), setTimeout(() => {
|
|
667
|
+
this.#i = !1, this.#t?.removeAttribute("data-drawer-closing"), this.#t?.close(), this["scroll-lock"] && !document.querySelector("dialog[open]") && (document.documentElement.style.overflow = "");
|
|
668
|
+
}, V(this)));
|
|
669
|
+
}
|
|
670
|
+
#n = (t) => {
|
|
671
|
+
t.preventDefault(), this.hide();
|
|
672
|
+
};
|
|
673
|
+
#a = () => {
|
|
674
|
+
this["scroll-lock"] && !document.querySelector("dialog[open]") && (document.documentElement.style.overflow = ""), this.removeAttribute("open"), this.dispatchEvent(new Event("close", { bubbles: !0 }));
|
|
675
|
+
};
|
|
676
|
+
#r = (t) => {
|
|
677
|
+
t.target === this.#t && this.hide();
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
const T = /* @__PURE__ */ new Map();
|
|
681
|
+
class ot extends h {
|
|
682
|
+
static attributes = {
|
|
683
|
+
name: { type: "string", default: "" },
|
|
684
|
+
src: { type: "string", default: "" },
|
|
685
|
+
label: { type: "string", default: "" },
|
|
686
|
+
"text-leading": { type: "string", default: "" },
|
|
687
|
+
"text-trailing": { type: "string", default: "" }
|
|
688
|
+
};
|
|
689
|
+
#t = null;
|
|
690
|
+
#e = !1;
|
|
691
|
+
activate() {
|
|
692
|
+
this.#e = this.querySelector("svg") !== null, this.addEffect(() => {
|
|
693
|
+
const t = this.label || this["text-leading"] || this["text-trailing"];
|
|
694
|
+
t ? (this.setAttribute("role", "img"), this.setAttribute("aria-label", t)) : (this.setAttribute("role", "presentation"), this.setAttribute("aria-hidden", "true"), this.removeAttribute("aria-label"));
|
|
695
|
+
}), this.addEffect(() => {
|
|
696
|
+
if (this.#e) return;
|
|
697
|
+
const t = this.name;
|
|
698
|
+
t ? this.#i(t) : this.src && this.#s(this.src);
|
|
699
|
+
}), this.#t = N(() => {
|
|
700
|
+
if (this.#e) return;
|
|
701
|
+
const t = this.name;
|
|
702
|
+
t && !this.querySelector("svg") && this.#i(t);
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
dispose() {
|
|
706
|
+
this.#t?.(), this.#t = null;
|
|
707
|
+
}
|
|
708
|
+
#i(t) {
|
|
709
|
+
const e = U(t);
|
|
710
|
+
e && this.#n(e);
|
|
711
|
+
}
|
|
712
|
+
async #s(t) {
|
|
713
|
+
const e = T.get(t);
|
|
714
|
+
if (e) {
|
|
715
|
+
this.#n(e);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
try {
|
|
719
|
+
const i = await fetch(t);
|
|
720
|
+
if (!i.ok) return;
|
|
721
|
+
const s = await i.text();
|
|
722
|
+
if (!s.includes("<svg")) return;
|
|
723
|
+
T.set(t, s), this.src === t && this.#n(s);
|
|
724
|
+
} catch {
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
#n(t) {
|
|
728
|
+
const e = this.querySelector("svg");
|
|
729
|
+
e && e.remove();
|
|
730
|
+
const i = document.createElement("template");
|
|
731
|
+
i.innerHTML = t;
|
|
732
|
+
const s = i.content.firstElementChild;
|
|
733
|
+
s && this.prepend(s);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
class dt extends h {
|
|
737
|
+
static attributes = {
|
|
738
|
+
content: { type: "string", default: "" },
|
|
739
|
+
position: { type: "enum", values: ["top", "bottom", "left", "right"], default: "top" }
|
|
740
|
+
};
|
|
741
|
+
#t = null;
|
|
742
|
+
#e = null;
|
|
743
|
+
#i = "";
|
|
744
|
+
activate() {
|
|
745
|
+
this.#e = this.previousElementSibling ?? this.parentElement;
|
|
746
|
+
const t = `tooltip-${crypto.randomUUID().slice(0, 8)}`;
|
|
747
|
+
this.#i = `--${t}`, this.#t = document.createElement("div"), this.#t.setAttribute("popover", "manual"), this.#t.setAttribute("role", "tooltip"), this.#t.id = t, this.appendChild(this.#t), this.#e && (this.#e.style.anchorName = this.#i, this.#e.setAttribute("aria-describedby", t)), this.style.setProperty("--_anchor", this.#i), this.addEffect(() => {
|
|
748
|
+
this.#t && (this.#t.textContent = this.content);
|
|
749
|
+
}), this.#e && (this.#e.addEventListener("mouseenter", this.#s), this.#e.addEventListener("mouseleave", this.#n), this.#e.addEventListener("focusin", this.#s), this.#e.addEventListener("focusout", this.#n)), this.addEventListener("keydown", this.#a);
|
|
750
|
+
}
|
|
751
|
+
dispose() {
|
|
752
|
+
this.#e && (this.#e.removeEventListener("mouseenter", this.#s), this.#e.removeEventListener("mouseleave", this.#n), this.#e.removeEventListener("focusin", this.#s), this.#e.removeEventListener("focusout", this.#n), this.#e.removeAttribute("aria-describedby"), this.#e.style.anchorName = ""), this.#t?.hidePopover(), this.#t?.remove(), this.#t = null, this.#e = null;
|
|
753
|
+
}
|
|
754
|
+
#s = () => {
|
|
755
|
+
try {
|
|
756
|
+
this.#t?.showPopover();
|
|
757
|
+
} catch {
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
#n = () => {
|
|
761
|
+
try {
|
|
762
|
+
this.#t?.hidePopover();
|
|
763
|
+
} catch {
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
#a = (t) => {
|
|
767
|
+
t.key === "Escape" && this.#n();
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
class ct extends h {
|
|
771
|
+
static formAssociated = !0;
|
|
772
|
+
static attributes = {
|
|
773
|
+
disabled: { type: "boolean", default: !1 },
|
|
774
|
+
min: { type: "string", default: "0" },
|
|
775
|
+
max: { type: "string", default: "100" },
|
|
776
|
+
step: { type: "string", default: "1" },
|
|
777
|
+
value: { type: "string", default: "50" },
|
|
778
|
+
label: { type: "string", default: "" },
|
|
779
|
+
name: { type: "string", default: "" }
|
|
780
|
+
};
|
|
781
|
+
#t;
|
|
782
|
+
#e = null;
|
|
783
|
+
constructor() {
|
|
784
|
+
super(), this.#t = this.attachInternals(), this.#t.role = "slider";
|
|
785
|
+
}
|
|
786
|
+
activate() {
|
|
787
|
+
this.#e = this.querySelector("[data-thumb]"), this.#e || (this.#e = document.createElement("span"), this.#e.setAttribute("data-thumb", ""), this.appendChild(this.#e)), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(() => {
|
|
788
|
+
const t = parseFloat(this.min) || 0, e = parseFloat(this.max) || 100, i = parseFloat(this.value) || 0;
|
|
789
|
+
this.setAttribute("aria-valuemin", String(t)), this.setAttribute("aria-valuemax", String(e)), this.setAttribute("aria-valuenow", String(i)), this.setAttribute("aria-disabled", String(this.disabled)), this.label && this.setAttribute("aria-label", this.label);
|
|
790
|
+
const s = e - t > 0 ? (i - t) / (e - t) : 0;
|
|
791
|
+
this.style.setProperty("--_pct", String(Math.max(0, Math.min(1, s)))), this.#t.setFormValue(this.value || null);
|
|
792
|
+
}), this.addEventListener("pointerdown", this.#i), this.addEventListener("keydown", this.#r);
|
|
793
|
+
}
|
|
794
|
+
dispose() {
|
|
795
|
+
this.removeEventListener("pointerdown", this.#i), this.removeEventListener("keydown", this.#r);
|
|
796
|
+
}
|
|
797
|
+
formDisabledCallback(t) {
|
|
798
|
+
this.disabled = t;
|
|
799
|
+
}
|
|
800
|
+
formResetCallback() {
|
|
801
|
+
this.value = "50";
|
|
802
|
+
}
|
|
803
|
+
// ── Pointer interaction ───────────────────────────────
|
|
804
|
+
#i = (t) => {
|
|
805
|
+
this.disabled || (t.preventDefault(), this.setPointerCapture(t.pointerId), this.setAttribute("data-range-pressed", ""), this.#a(t), this.addEventListener("pointermove", this.#s), this.addEventListener("pointerup", this.#n));
|
|
806
|
+
};
|
|
807
|
+
#s = (t) => {
|
|
808
|
+
this.#a(t);
|
|
809
|
+
};
|
|
810
|
+
#n = (t) => {
|
|
811
|
+
this.removeAttribute("data-range-pressed"), this.removeEventListener("pointermove", this.#s), this.removeEventListener("pointerup", this.#n), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
812
|
+
};
|
|
813
|
+
#a(t) {
|
|
814
|
+
const e = this.getBoundingClientRect(), i = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width)), s = parseFloat(this.min) || 0, n = parseFloat(this.max) || 100, a = parseFloat(this.step) || 1, r = s + i * (n - s), o = Math.round(r / a) * a, d = Math.max(s, Math.min(n, o));
|
|
815
|
+
this.value = String(d), this.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
816
|
+
}
|
|
817
|
+
// ── Keyboard interaction ──────────────────────────────
|
|
818
|
+
#r = (t) => {
|
|
819
|
+
if (this.disabled) return;
|
|
820
|
+
const e = parseFloat(this.min) || 0, i = parseFloat(this.max) || 100, s = parseFloat(this.step) || 1, n = parseFloat(this.value) || 0, a = (i - e) / 10;
|
|
821
|
+
let r;
|
|
822
|
+
switch (t.key) {
|
|
823
|
+
case "ArrowRight":
|
|
824
|
+
case "ArrowUp":
|
|
825
|
+
r = Math.min(i, n + s);
|
|
826
|
+
break;
|
|
827
|
+
case "ArrowLeft":
|
|
828
|
+
case "ArrowDown":
|
|
829
|
+
r = Math.max(e, n - s);
|
|
830
|
+
break;
|
|
831
|
+
case "PageUp":
|
|
832
|
+
r = Math.min(i, n + a);
|
|
833
|
+
break;
|
|
834
|
+
case "PageDown":
|
|
835
|
+
r = Math.max(e, n - a);
|
|
836
|
+
break;
|
|
837
|
+
case "Home":
|
|
838
|
+
r = e;
|
|
839
|
+
break;
|
|
840
|
+
case "End":
|
|
841
|
+
r = i;
|
|
842
|
+
break;
|
|
843
|
+
default:
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
t.preventDefault(), this.value = String(r), this.dispatchEvent(new Event("input", { bubbles: !0 })), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
class ut extends h {
|
|
850
|
+
static attributes = {
|
|
851
|
+
orientation: { type: "enum", values: ["horizontal", "vertical"], default: "horizontal" },
|
|
852
|
+
disabled: { type: "boolean", default: !1 }
|
|
853
|
+
};
|
|
854
|
+
#t = 0;
|
|
855
|
+
#e = 0;
|
|
856
|
+
#i = !1;
|
|
857
|
+
activate() {
|
|
858
|
+
this.setAttribute("role", "separator"), this.addEffect(() => {
|
|
859
|
+
this.setAttribute("aria-orientation", this.orientation || "horizontal"), this.setAttribute("aria-disabled", String(this.disabled));
|
|
860
|
+
}), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEventListener("pointerdown", this.#s), this.addEventListener("keydown", this.#l);
|
|
861
|
+
}
|
|
862
|
+
dispose() {
|
|
863
|
+
this.removeEventListener("pointerdown", this.#s), this.removeEventListener("keydown", this.#l), this.#r();
|
|
864
|
+
}
|
|
865
|
+
#s = (t) => {
|
|
866
|
+
this.disabled || (t.preventDefault(), this.#t = t.clientX, this.#e = t.clientY, this.#i = !0, this.setPointerCapture(t.pointerId), this.setAttribute("data-gripper-dragging", ""), this.addEventListener("pointermove", this.#n), this.addEventListener("pointerup", this.#a), this.addEventListener("pointercancel", this.#a), this.dispatchEvent(new CustomEvent("aui:resize-start", { bubbles: !0 })));
|
|
867
|
+
};
|
|
868
|
+
#n = (t) => {
|
|
869
|
+
if (!this.#i) return;
|
|
870
|
+
const e = t.clientX - this.#t, i = t.clientY - this.#e;
|
|
871
|
+
this.#t = t.clientX, this.#e = t.clientY;
|
|
872
|
+
const s = this.orientation !== "vertical";
|
|
873
|
+
this.dispatchEvent(new CustomEvent("aui:resize-move", {
|
|
874
|
+
bubbles: !0,
|
|
875
|
+
detail: { dx: e, dy: i, delta: s ? e : i }
|
|
876
|
+
}));
|
|
877
|
+
};
|
|
878
|
+
#a = () => {
|
|
879
|
+
this.#i && (this.#r(), this.dispatchEvent(new CustomEvent("aui:resize-end", { bubbles: !0 })));
|
|
880
|
+
};
|
|
881
|
+
#r() {
|
|
882
|
+
this.#i = !1, this.removeAttribute("data-gripper-dragging"), this.removeEventListener("pointermove", this.#n), this.removeEventListener("pointerup", this.#a), this.removeEventListener("pointercancel", this.#a);
|
|
883
|
+
}
|
|
884
|
+
#l = (t) => {
|
|
885
|
+
if (this.disabled) return;
|
|
886
|
+
const e = this.orientation !== "vertical", i = t.shiftKey ? 10 : 1;
|
|
887
|
+
let s = 0;
|
|
888
|
+
if (e)
|
|
889
|
+
if (t.key === "ArrowLeft") s = -i;
|
|
890
|
+
else if (t.key === "ArrowRight") s = i;
|
|
891
|
+
else return;
|
|
892
|
+
else if (t.key === "ArrowUp") s = -i;
|
|
893
|
+
else if (t.key === "ArrowDown") s = i;
|
|
894
|
+
else return;
|
|
895
|
+
t.preventDefault(), this.dispatchEvent(new CustomEvent("aui:resize-move", {
|
|
896
|
+
bubbles: !0,
|
|
897
|
+
detail: { dx: e ? s : 0, dy: e ? 0 : s, delta: s }
|
|
898
|
+
}));
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
class bt extends h {
|
|
902
|
+
static attributes = {
|
|
903
|
+
value: { type: "string", default: "" },
|
|
904
|
+
disabled: { type: "boolean", default: !1 },
|
|
905
|
+
selected: { type: "boolean", default: !1 },
|
|
906
|
+
label: { type: "string", default: "" }
|
|
907
|
+
};
|
|
908
|
+
/** The display text for this option. */
|
|
909
|
+
get displayLabel() {
|
|
910
|
+
return this.label || this.textContent?.trim() || this.value;
|
|
911
|
+
}
|
|
912
|
+
activate() {
|
|
913
|
+
this.setAttribute("role", "option"), this.addEffect(() => {
|
|
914
|
+
this.setAttribute("aria-selected", String(this.selected)), this.setAttribute("aria-disabled", String(this.disabled));
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
class ft extends h {
|
|
919
|
+
static attributes = {
|
|
920
|
+
label: { type: "string", default: "" },
|
|
921
|
+
disabled: { type: "boolean", default: !1 },
|
|
922
|
+
divider: { type: "boolean", default: !1 }
|
|
923
|
+
};
|
|
924
|
+
#t = null;
|
|
925
|
+
activate() {
|
|
926
|
+
this.setAttribute("role", "group"), this.#t = this.querySelector("[data-group-label]"), !this.#t && this.label && (this.#t = document.createElement("div"), this.#t.setAttribute("data-group-label", ""), this.#t.setAttribute("role", "presentation"), this.#t.id = `optgroup-${crypto.randomUUID().slice(0, 8)}`, this.prepend(this.#t)), this.addEffect(() => {
|
|
927
|
+
this.#t && (this.#t.textContent = this.label, this.setAttribute("aria-labelledby", this.#t.id)), this.setAttribute("aria-disabled", String(this.disabled));
|
|
928
|
+
for (const t of this.querySelectorAll("aui-option"))
|
|
929
|
+
this.disabled && t.setAttribute("disabled", "");
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
const B = '<svg viewBox="0 0 256 256" fill="currentColor" width="100%" height="100%"><polyline points="48,80 128,160 208,80" fill="none" stroke="currentColor" stroke-width="24" stroke-linecap="round" stroke-linejoin="round"/></svg>', $ = '<svg viewBox="0 0 256 256" fill="currentColor" width="1em" height="1em"><circle cx="128" cy="128" r="16"/><circle cx="64" cy="128" r="16"/><circle cx="192" cy="128" r="16"/></svg>', P = { 0: 0, low: 0, 1: 1, normal: 1, 2: 2, high: 2, pin: 999 }, K = ":is(aui-option, aui-button, button, [tabindex]):not([disabled]):not([data-overflow-trigger])", _ = ":is(aui-option, aui-button, button, [tabindex]):not([disabled])";
|
|
934
|
+
function q(l) {
|
|
935
|
+
return l === "AUI-OPTION";
|
|
936
|
+
}
|
|
937
|
+
function G(l) {
|
|
938
|
+
return l === "AUI-OPTGROUP";
|
|
939
|
+
}
|
|
940
|
+
function M(l) {
|
|
941
|
+
return q(l.tagName) || G(l.tagName);
|
|
942
|
+
}
|
|
943
|
+
class pt extends h {
|
|
944
|
+
static formAssociated = !0;
|
|
945
|
+
static attributes = {
|
|
946
|
+
mode: { type: "enum", values: ["bar", "list", "combobox"], default: "" },
|
|
947
|
+
disabled: { type: "boolean", default: !1 },
|
|
948
|
+
required: { type: "boolean", default: !1 },
|
|
949
|
+
placeholder: { type: "string", default: "Select…" },
|
|
950
|
+
value: { type: "string", default: "" },
|
|
951
|
+
name: { type: "string", default: "" },
|
|
952
|
+
open: { type: "boolean", default: !1 },
|
|
953
|
+
multiple: { type: "boolean", default: !1 },
|
|
954
|
+
// Bar mode
|
|
955
|
+
orientation: { type: "enum", values: ["vertical"], default: "" },
|
|
956
|
+
transparent: { type: "boolean", default: !1 },
|
|
957
|
+
fill: { type: "boolean", default: !1 },
|
|
958
|
+
padding: { type: "string", default: "" }
|
|
959
|
+
};
|
|
960
|
+
#t;
|
|
961
|
+
// ── Shared state ─────────────────────────────────────────
|
|
962
|
+
#e = "";
|
|
963
|
+
// ── Dropdown mode state ──────────────────────────────────
|
|
964
|
+
#i = null;
|
|
965
|
+
#s = null;
|
|
966
|
+
#n = null;
|
|
967
|
+
#a = null;
|
|
968
|
+
#r = null;
|
|
969
|
+
// ── Bar mode state ───────────────────────────────────────
|
|
970
|
+
#l = null;
|
|
971
|
+
#h = null;
|
|
972
|
+
#d = null;
|
|
973
|
+
#u = null;
|
|
974
|
+
#c = null;
|
|
975
|
+
#b = null;
|
|
976
|
+
// ── List mode state ──────────────────────────────────────
|
|
977
|
+
#p = -1;
|
|
978
|
+
#E = "";
|
|
979
|
+
#g = null;
|
|
980
|
+
// ── Combobox mode state ──────────────────────────────────
|
|
981
|
+
#o = null;
|
|
982
|
+
#v = null;
|
|
983
|
+
#f = null;
|
|
984
|
+
#y = [];
|
|
985
|
+
constructor() {
|
|
986
|
+
super(), this.#t = this.attachInternals();
|
|
987
|
+
}
|
|
988
|
+
// ════════════════════════════════════════════════════════════
|
|
989
|
+
// Lifecycle
|
|
990
|
+
// ════════════════════════════════════════════════════════════
|
|
991
|
+
activate() {
|
|
992
|
+
switch (this.mode) {
|
|
993
|
+
case "bar":
|
|
994
|
+
this.#N();
|
|
995
|
+
break;
|
|
996
|
+
case "list":
|
|
997
|
+
this.#ht();
|
|
998
|
+
break;
|
|
999
|
+
case "combobox":
|
|
1000
|
+
this.#bt();
|
|
1001
|
+
break;
|
|
1002
|
+
default:
|
|
1003
|
+
this.#C();
|
|
1004
|
+
break;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
dispose() {
|
|
1008
|
+
switch (this.mode) {
|
|
1009
|
+
case "bar":
|
|
1010
|
+
this.#q();
|
|
1011
|
+
break;
|
|
1012
|
+
case "list":
|
|
1013
|
+
this.#ot();
|
|
1014
|
+
break;
|
|
1015
|
+
case "combobox":
|
|
1016
|
+
this.#ft();
|
|
1017
|
+
break;
|
|
1018
|
+
default:
|
|
1019
|
+
this.#L();
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
formDisabledCallback(t) {
|
|
1024
|
+
this.disabled = t;
|
|
1025
|
+
}
|
|
1026
|
+
formResetCallback() {
|
|
1027
|
+
this.value = "", this.#o && (this.#o.textContent = "");
|
|
1028
|
+
}
|
|
1029
|
+
// ════════════════════════════════════════════════════════════
|
|
1030
|
+
// Public API
|
|
1031
|
+
// ════════════════════════════════════════════════════════════
|
|
1032
|
+
/** Get all option elements (including inside groups). */
|
|
1033
|
+
get options() {
|
|
1034
|
+
return this.mode === "" || this.mode === void 0 ? Array.from(this.#r?.querySelectorAll("aui-option") ?? []) : this.mode === "combobox" ? Array.from(this.#f?.querySelectorAll("aui-option") ?? []) : Array.from(this.querySelectorAll("aui-option"));
|
|
1035
|
+
}
|
|
1036
|
+
/** Get enabled options. */
|
|
1037
|
+
get enabledOptions() {
|
|
1038
|
+
return this.options.filter((t) => !t.hasAttribute("disabled"));
|
|
1039
|
+
}
|
|
1040
|
+
/** Get the currently active (highlighted) option. */
|
|
1041
|
+
get activeOption() {
|
|
1042
|
+
return this.mode === "list" ? this.enabledOptions[this.#p] ?? null : (this.#r ?? this.#f)?.activeOption ?? null;
|
|
1043
|
+
}
|
|
1044
|
+
/** Internal listbox element (for dropdown mode). */
|
|
1045
|
+
get listboxElement() {
|
|
1046
|
+
return this.#r;
|
|
1047
|
+
}
|
|
1048
|
+
/** Programmatically select an option by value. */
|
|
1049
|
+
selectValue(t) {
|
|
1050
|
+
if (this.mode === "list") {
|
|
1051
|
+
const e = this.options.find(
|
|
1052
|
+
(i) => (i.getAttribute("value") ?? i.textContent?.trim()) === t
|
|
1053
|
+
);
|
|
1054
|
+
e && !e.hasAttribute("disabled") && this.#U(e);
|
|
1055
|
+
} else
|
|
1056
|
+
(this.#r ?? this.#f)?.selectValue?.(t);
|
|
1057
|
+
}
|
|
1058
|
+
/** Highlight a specific option by index (for external control). */
|
|
1059
|
+
highlightIndex(t) {
|
|
1060
|
+
this.mode === "list" ? this.#S(t) : (this.#r ?? this.#f)?.highlightIndex?.(t);
|
|
1061
|
+
}
|
|
1062
|
+
/** Reset the active highlight. */
|
|
1063
|
+
clearHighlight() {
|
|
1064
|
+
this.mode === "list" ? this.#W() : (this.#r ?? this.#f)?.clearHighlight?.();
|
|
1065
|
+
}
|
|
1066
|
+
// ════════════════════════════════════════════════════════════
|
|
1067
|
+
// Shared popover helpers (dropdown + combobox)
|
|
1068
|
+
// ════════════════════════════════════════════════════════════
|
|
1069
|
+
#x() {
|
|
1070
|
+
const t = this.#a ?? this.#v;
|
|
1071
|
+
if (!(!t || this.disabled)) {
|
|
1072
|
+
try {
|
|
1073
|
+
t.showPopover();
|
|
1074
|
+
} catch {
|
|
1075
|
+
}
|
|
1076
|
+
if (this.open = !0, this.mode !== "combobox") {
|
|
1077
|
+
const e = this.#r;
|
|
1078
|
+
if (e?.enabledOptions && e.value) {
|
|
1079
|
+
const i = e.enabledOptions.findIndex(
|
|
1080
|
+
(s) => (s.getAttribute("value") ?? s.textContent?.trim()) === e.value
|
|
1081
|
+
);
|
|
1082
|
+
i >= 0 && e.highlightIndex(i);
|
|
1083
|
+
}
|
|
1084
|
+
this.#r?.focus();
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
#m() {
|
|
1089
|
+
const t = this.#a ?? this.#v;
|
|
1090
|
+
if (!t) return;
|
|
1091
|
+
try {
|
|
1092
|
+
t.hidePopover();
|
|
1093
|
+
} catch {
|
|
1094
|
+
}
|
|
1095
|
+
this.open = !1, (this.#r ?? this.#f)?.clearHighlight?.();
|
|
1096
|
+
}
|
|
1097
|
+
// ════════════════════════════════════════════════════════════
|
|
1098
|
+
// MODE: Dropdown (default)
|
|
1099
|
+
// ════════════════════════════════════════════════════════════
|
|
1100
|
+
#C() {
|
|
1101
|
+
const t = `select-${crypto.randomUUID().slice(0, 8)}`;
|
|
1102
|
+
this.#e = `--${t}`, this.#i = document.createElement("span"), this.#i.setAttribute("data-trigger", ""), this.#i.setAttribute("role", "combobox"), this.#i.setAttribute("aria-haspopup", "listbox"), this.#i.setAttribute("tabindex", "0"), this.#i.id = t, this.#s = document.createElement("span"), this.#s.setAttribute("data-label", ""), this.#i.appendChild(this.#s), this.#n = document.createElement("span"), this.#n.setAttribute("data-chevron", ""), this.#n.innerHTML = B, this.#i.appendChild(this.#n), this.#a = document.createElement("div"), this.#a.setAttribute("popover", "manual"), this.#a.setAttribute("data-dropdown", ""), this.#r = document.createElement("aui-listbox"), this.#a.appendChild(this.#r);
|
|
1103
|
+
const e = Array.from(this.children);
|
|
1104
|
+
for (const i of e)
|
|
1105
|
+
M(i) && this.#r.appendChild(i);
|
|
1106
|
+
this.appendChild(this.#i), this.appendChild(this.#a), this.#i.style.anchorName = this.#e, this.style.setProperty("--_anchor", this.#e), this.addEffect(() => {
|
|
1107
|
+
this.disabled ? this.#i.setAttribute("tabindex", "-1") : this.#i.setAttribute("tabindex", "0"), this.#i.setAttribute("aria-expanded", String(this.open)), this.#i.setAttribute("aria-disabled", String(this.disabled)), this.#t.setFormValue(this.value || null), this.#A();
|
|
1108
|
+
}), this.#i.addEventListener("click", this.#k), this.#i.addEventListener("keydown", this.#T), this.#r.addEventListener("click", this.#w), this.#r.addEventListener("change", this.#P), this.#r.addEventListener("keydown", this.#M), document.addEventListener("click", this.#I), this.value && (this.#r.value = this.value);
|
|
1109
|
+
}
|
|
1110
|
+
#w = (t) => {
|
|
1111
|
+
const e = t.target.closest("aui-option");
|
|
1112
|
+
if (!(!e || e.hasAttribute("disabled"))) {
|
|
1113
|
+
for (const i of this.#r.querySelectorAll("aui-option"))
|
|
1114
|
+
i.selected = !1;
|
|
1115
|
+
e.selected = !0, this.value = e.value ?? e.getAttribute("value") ?? "", this.#r.dispatchEvent(new CustomEvent("change", {
|
|
1116
|
+
bubbles: !0,
|
|
1117
|
+
detail: { value: this.value, option: e }
|
|
1118
|
+
})), this.#m();
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
#L() {
|
|
1122
|
+
this.#i?.removeEventListener("click", this.#k), this.#i?.removeEventListener("keydown", this.#T), this.#r?.removeEventListener("click", this.#w), this.#r?.removeEventListener("change", this.#P), this.#r?.removeEventListener("keydown", this.#M), document.removeEventListener("click", this.#I), this.#m();
|
|
1123
|
+
}
|
|
1124
|
+
#A() {
|
|
1125
|
+
if (!this.#s) return;
|
|
1126
|
+
const t = this.#r?.querySelector("aui-option[selected]");
|
|
1127
|
+
t ? (this.#s.textContent = t.displayLabel ?? t.textContent?.trim() ?? "", this.#s.removeAttribute("data-placeholder")) : (this.#s.textContent = this.placeholder, this.#s.setAttribute("data-placeholder", ""));
|
|
1128
|
+
}
|
|
1129
|
+
#k = () => {
|
|
1130
|
+
this.disabled || (this.open ? this.#m() : this.#x());
|
|
1131
|
+
};
|
|
1132
|
+
#T = (t) => {
|
|
1133
|
+
t.key === "ArrowDown" || t.key === "ArrowUp" || t.key === "Enter" || t.key === " " ? (t.preventDefault(), this.open || this.#x()) : t.key === "Escape" && this.#m();
|
|
1134
|
+
};
|
|
1135
|
+
#P = (t) => {
|
|
1136
|
+
t.stopPropagation(), this.value = t.detail.value, this.#t.setFormValue(this.value || null), this.#A(), this.#m(), this.#i?.focus(), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: t.detail }));
|
|
1137
|
+
};
|
|
1138
|
+
#M = (t) => {
|
|
1139
|
+
t.key === "Escape" ? (t.preventDefault(), this.#m(), this.#i?.focus()) : t.key === "Tab" && this.#m();
|
|
1140
|
+
};
|
|
1141
|
+
#I = (t) => {
|
|
1142
|
+
this.open && !this.contains(t.target) && this.#m();
|
|
1143
|
+
};
|
|
1144
|
+
// ════════════════════════════════════════════════════════════
|
|
1145
|
+
// MODE: Bar (toolbar)
|
|
1146
|
+
// ════════════════════════════════════════════════════════════
|
|
1147
|
+
#N() {
|
|
1148
|
+
this.setAttribute("role", "toolbar"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Toolbar"), this.orientation && this.setAttribute("aria-orientation", this.orientation || "horizontal"), this.#l = document.createElement("span"), this.#l.setAttribute("data-overflow-trigger", ""), this.#l.setAttribute("role", "button"), this.#l.setAttribute("tabindex", "0"), this.#l.setAttribute("aria-label", "More actions"), this.#l.setAttribute("aria-haspopup", "true"), this.#l.innerHTML = $, this.appendChild(this.#l), this.#h = document.createElement("div"), this.#h.setAttribute("data-overflow-popover", ""), this.#h.setAttribute("popover", "auto"), this.#h.setAttribute("role", "menu"), this.appendChild(this.#h), this.#d = document.createElement("div"), this.#d.setAttribute("data-overflow-list", ""), this.#h.appendChild(this.#d), this.#l.addEventListener("click", this.#B), this.#l.addEventListener("keydown", this.#$), this.#d.addEventListener("click", this.#_), this.addEventListener("keydown", this.#G), this.#R(), this.#u = new ResizeObserver(() => this.#z()), this.#u.observe(this), this.#c = new MutationObserver((t) => {
|
|
1149
|
+
for (const e of t)
|
|
1150
|
+
if (!this.#h?.contains(e.target)) {
|
|
1151
|
+
this.#z();
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
}), this.#c.observe(this, { childList: !0, subtree: !0 }), this.#z();
|
|
1155
|
+
}
|
|
1156
|
+
#q() {
|
|
1157
|
+
this.#b !== null && cancelAnimationFrame(this.#b), this.#u?.disconnect(), this.#c?.disconnect(), this.removeEventListener("keydown", this.#G), this.#l?.removeEventListener("click", this.#B), this.#l?.removeEventListener("keydown", this.#$), this.#d?.removeEventListener("click", this.#_);
|
|
1158
|
+
}
|
|
1159
|
+
// ── Bar: Group dividers ───────────────────────────────
|
|
1160
|
+
#R() {
|
|
1161
|
+
const t = Array.from(this.children);
|
|
1162
|
+
let e = !1;
|
|
1163
|
+
for (const i of t) {
|
|
1164
|
+
if (!(i instanceof HTMLElement) || i.hasAttribute("data-overflow-trigger") || i.hasAttribute("data-overflow-popover")) continue;
|
|
1165
|
+
const s = i.tagName === "AUI-OPTGROUP";
|
|
1166
|
+
if (s && e) {
|
|
1167
|
+
const n = document.createElement("hr");
|
|
1168
|
+
n.setAttribute("data-group-divider", ""), this.insertBefore(n, i);
|
|
1169
|
+
}
|
|
1170
|
+
(s || q(i.tagName)) && (e = s);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
// ── Bar: Measurement ───────────────────────────────────
|
|
1174
|
+
#z() {
|
|
1175
|
+
this.#b === null && (this.#b = requestAnimationFrame(() => {
|
|
1176
|
+
this.#b = null, this.#it();
|
|
1177
|
+
}));
|
|
1178
|
+
}
|
|
1179
|
+
#O() {
|
|
1180
|
+
return Array.from(this.children).filter(
|
|
1181
|
+
(t) => t instanceof HTMLElement && !t.hasAttribute("data-overflow-trigger") && !t.hasAttribute("data-overflow-popover")
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
#it() {
|
|
1185
|
+
if (this.orientation === "vertical") {
|
|
1186
|
+
this.#nt();
|
|
1187
|
+
return;
|
|
1188
|
+
}
|
|
1189
|
+
this.#c?.disconnect(), this.#l && this.#l.nextElementSibling !== this.#h && this.appendChild(this.#l), this.#h && this.#h !== this.lastElementChild && this.appendChild(this.#h);
|
|
1190
|
+
const t = this.#O();
|
|
1191
|
+
if (t.length === 0) {
|
|
1192
|
+
this.#D();
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
for (const c of t)
|
|
1196
|
+
c.removeAttribute("data-select-overflow");
|
|
1197
|
+
this.removeAttribute("data-select-overflowing"), this.setAttribute("data-select-measuring", "");
|
|
1198
|
+
const e = getComputedStyle(this), i = parseFloat(e.gap) || 0, s = this.clientWidth - (parseFloat(e.paddingInlineStart) || 0) - (parseFloat(e.paddingInlineEnd) || 0);
|
|
1199
|
+
if (s <= 0) {
|
|
1200
|
+
this.removeAttribute("data-select-measuring"), this.#D();
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
const n = this.#st(t);
|
|
1204
|
+
let a = 0, r = 0;
|
|
1205
|
+
for (const c of n)
|
|
1206
|
+
for (const p of c.flexItems)
|
|
1207
|
+
r > 0 && (a += i), a += p.offsetWidth, r++;
|
|
1208
|
+
if (a <= s + 1) {
|
|
1209
|
+
this.removeAttribute("data-select-measuring"), this.#H(), this.#D();
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
this.setAttribute("data-select-overflowing", "");
|
|
1213
|
+
for (const c of n) {
|
|
1214
|
+
let p = 0;
|
|
1215
|
+
for (let v = 0; v < c.flexItems.length; v++)
|
|
1216
|
+
v > 0 && (p += i), p += c.flexItems[v].offsetWidth;
|
|
1217
|
+
c.width = p;
|
|
1218
|
+
}
|
|
1219
|
+
this.removeAttribute("data-select-measuring");
|
|
1220
|
+
const o = this.#l?.offsetWidth ?? 0, d = n.filter((c) => !c.pinned);
|
|
1221
|
+
if (d.length === 0) {
|
|
1222
|
+
this.#H(), this.#D();
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
d.sort((c, p) => {
|
|
1226
|
+
const v = P[c.priority] ?? 1, k = P[p.priority] ?? 1;
|
|
1227
|
+
return v !== k ? v - k : p.index - c.index;
|
|
1228
|
+
});
|
|
1229
|
+
const b = /* @__PURE__ */ new Set();
|
|
1230
|
+
let f = a;
|
|
1231
|
+
const m = s - o - i;
|
|
1232
|
+
for (const c of d) {
|
|
1233
|
+
if (f <= m) break;
|
|
1234
|
+
b.add(c.el), f -= c.width + i;
|
|
1235
|
+
}
|
|
1236
|
+
if (b.size === 0) {
|
|
1237
|
+
this.removeAttribute("data-select-overflowing"), this.#H(), this.#D();
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
for (const c of b) {
|
|
1241
|
+
c.setAttribute("data-select-overflow", "");
|
|
1242
|
+
const p = c.previousElementSibling;
|
|
1243
|
+
p?.hasAttribute("data-group-divider") && p.setAttribute("data-select-overflow", "");
|
|
1244
|
+
const v = c.nextElementSibling;
|
|
1245
|
+
v?.hasAttribute("data-group-divider") && v.setAttribute("data-select-overflow", "");
|
|
1246
|
+
}
|
|
1247
|
+
this.#at(), this.#D();
|
|
1248
|
+
}
|
|
1249
|
+
#st(t) {
|
|
1250
|
+
const e = [];
|
|
1251
|
+
for (let i = 0; i < t.length; i++) {
|
|
1252
|
+
const s = t[i];
|
|
1253
|
+
if (s.tagName === "HR" || s.tagName === "AUI-DIVIDER") continue;
|
|
1254
|
+
const n = s.getAttribute("data-priority") ?? s.getAttribute("overflow-priority") ?? "normal", a = n, r = n === "pin" || s.hasAttribute("overflow-pin");
|
|
1255
|
+
if (s.tagName === "AUI-OPTGROUP") {
|
|
1256
|
+
const o = [];
|
|
1257
|
+
for (const d of s.children)
|
|
1258
|
+
d instanceof HTMLElement && d.tagName !== "HR" && d.tagName !== "AUI-DIVIDER" && o.push(d);
|
|
1259
|
+
e.push({ el: s, flexItems: o, priority: a, pinned: r, index: i, width: 0 });
|
|
1260
|
+
} else
|
|
1261
|
+
e.push({ el: s, flexItems: [s], priority: a, pinned: r, index: i, width: 0 });
|
|
1262
|
+
}
|
|
1263
|
+
return e;
|
|
1264
|
+
}
|
|
1265
|
+
// ── Bar: Overflow menu ─────────────────────────────────
|
|
1266
|
+
#nt() {
|
|
1267
|
+
for (const t of this.#O())
|
|
1268
|
+
t.removeAttribute("data-select-overflow");
|
|
1269
|
+
this.removeAttribute("data-select-overflowing"), this.removeAttribute("data-select-measuring"), this.#H();
|
|
1270
|
+
}
|
|
1271
|
+
#H() {
|
|
1272
|
+
this.#d && (this.#d.innerHTML = "");
|
|
1273
|
+
}
|
|
1274
|
+
#at() {
|
|
1275
|
+
if (this.#H(), !this.#d) return;
|
|
1276
|
+
const t = this.#O();
|
|
1277
|
+
let e = 0;
|
|
1278
|
+
for (const i of t)
|
|
1279
|
+
if (i.hasAttribute("data-select-overflow")) {
|
|
1280
|
+
if (i.tagName === "AUI-OPTGROUP") {
|
|
1281
|
+
const s = document.createElement("aui-optgroup"), n = i.getAttribute("label");
|
|
1282
|
+
n && s.setAttribute("label", n), s.setAttribute("divider", "");
|
|
1283
|
+
for (const a of i.children) {
|
|
1284
|
+
if (!(a instanceof HTMLElement) || a.tagName === "HR" || a.tagName === "AUI-DIVIDER" || a.hasAttribute("data-group-label")) continue;
|
|
1285
|
+
const r = document.createElement("aui-option");
|
|
1286
|
+
r.textContent = this.#V(a), r.setAttribute("data-overflow-index", String(e)), s.appendChild(r), e++;
|
|
1287
|
+
}
|
|
1288
|
+
this.#d.appendChild(s);
|
|
1289
|
+
} else if (i.tagName !== "HR" && i.tagName !== "AUI-DIVIDER") {
|
|
1290
|
+
const s = document.createElement("aui-option");
|
|
1291
|
+
s.textContent = this.#V(i), s.setAttribute("data-overflow-index", String(e)), this.#d.appendChild(s), e++;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
/** Flat list of overflowed source elements, in DOM order (for click dispatch). */
|
|
1296
|
+
#rt() {
|
|
1297
|
+
const t = [];
|
|
1298
|
+
for (const e of this.#O())
|
|
1299
|
+
if (e.hasAttribute("data-select-overflow"))
|
|
1300
|
+
if (e.tagName === "AUI-OPTGROUP")
|
|
1301
|
+
for (const i of e.children)
|
|
1302
|
+
i instanceof HTMLElement && i.tagName !== "HR" && i.tagName !== "AUI-DIVIDER" && !i.hasAttribute("data-group-label") && t.push(i);
|
|
1303
|
+
else e.tagName !== "HR" && e.tagName !== "AUI-DIVIDER" && t.push(e);
|
|
1304
|
+
return t;
|
|
1305
|
+
}
|
|
1306
|
+
#V(t) {
|
|
1307
|
+
const e = t.getAttribute("aria-label");
|
|
1308
|
+
if (e) return e;
|
|
1309
|
+
const i = t.getAttribute("label");
|
|
1310
|
+
if (i) return i;
|
|
1311
|
+
const s = t.textContent?.trim();
|
|
1312
|
+
if (s) return s;
|
|
1313
|
+
const n = t.getAttribute("icon");
|
|
1314
|
+
return n ? n.charAt(0).toUpperCase() + n.slice(1).replace(/-/g, " ") : "Action";
|
|
1315
|
+
}
|
|
1316
|
+
#D() {
|
|
1317
|
+
this.#c?.observe(this, { childList: !0, subtree: !0 });
|
|
1318
|
+
}
|
|
1319
|
+
// ── Bar: Event handlers ────────────────────────────────
|
|
1320
|
+
#B = (t) => {
|
|
1321
|
+
t.stopPropagation(), this.#K(), this.#h?.togglePopover();
|
|
1322
|
+
};
|
|
1323
|
+
#$ = (t) => {
|
|
1324
|
+
const e = t;
|
|
1325
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.#K(), this.#h?.togglePopover());
|
|
1326
|
+
};
|
|
1327
|
+
#K() {
|
|
1328
|
+
if (!this.#l || !this.#h) return;
|
|
1329
|
+
const t = this.#l.getBoundingClientRect();
|
|
1330
|
+
this.#h.style.top = `${t.bottom + 2}px`, this.#h.style.right = `${window.innerWidth - t.right}px`;
|
|
1331
|
+
}
|
|
1332
|
+
#_ = (t) => {
|
|
1333
|
+
const e = t.target.closest("[data-overflow-index]");
|
|
1334
|
+
if (!e) return;
|
|
1335
|
+
const i = parseInt(e.getAttribute("data-overflow-index"), 10), s = this.#rt()[i];
|
|
1336
|
+
s && s.click(), this.#h?.hidePopover();
|
|
1337
|
+
};
|
|
1338
|
+
// ── Bar: Keyboard navigation ───────────────────────────
|
|
1339
|
+
#lt() {
|
|
1340
|
+
const t = [], e = this.hasAttribute("data-select-overflowing") ? _ : K;
|
|
1341
|
+
for (const i of this.#O())
|
|
1342
|
+
if (!i.hasAttribute("data-select-overflow"))
|
|
1343
|
+
if (i.tagName === "AUI-OPTGROUP")
|
|
1344
|
+
for (const s of i.children)
|
|
1345
|
+
s instanceof HTMLElement && s.matches(e) && t.push(s);
|
|
1346
|
+
else i.matches(e) && t.push(i);
|
|
1347
|
+
return this.#l && this.hasAttribute("data-select-overflowing") && t.push(this.#l), t;
|
|
1348
|
+
}
|
|
1349
|
+
#G = (t) => {
|
|
1350
|
+
const e = this.orientation === "vertical", i = e ? "ArrowDown" : "ArrowRight", s = e ? "ArrowUp" : "ArrowLeft";
|
|
1351
|
+
if (t.key !== i && t.key !== s && t.key !== "Home" && t.key !== "End") return;
|
|
1352
|
+
const n = this.#lt();
|
|
1353
|
+
if (n.length === 0) return;
|
|
1354
|
+
const a = n.indexOf(document.activeElement);
|
|
1355
|
+
let r;
|
|
1356
|
+
switch (t.key) {
|
|
1357
|
+
case i:
|
|
1358
|
+
r = a < n.length - 1 ? a + 1 : 0;
|
|
1359
|
+
break;
|
|
1360
|
+
case s:
|
|
1361
|
+
r = a > 0 ? a - 1 : n.length - 1;
|
|
1362
|
+
break;
|
|
1363
|
+
case "Home":
|
|
1364
|
+
r = 0;
|
|
1365
|
+
break;
|
|
1366
|
+
case "End":
|
|
1367
|
+
r = n.length - 1;
|
|
1368
|
+
break;
|
|
1369
|
+
}
|
|
1370
|
+
r !== void 0 && (t.preventDefault(), n[r].setAttribute("tabindex", "0"), n[r].focus(), a >= 0 && a !== r && n[a].setAttribute("tabindex", "-1"));
|
|
1371
|
+
};
|
|
1372
|
+
// ════════════════════════════════════════════════════════════
|
|
1373
|
+
// MODE: List (standalone listbox)
|
|
1374
|
+
// ════════════════════════════════════════════════════════════
|
|
1375
|
+
#ht() {
|
|
1376
|
+
this.setAttribute("role", "listbox"), this.addEffect(() => {
|
|
1377
|
+
this.multiple ? this.setAttribute("aria-multiselectable", "true") : this.removeAttribute("aria-multiselectable");
|
|
1378
|
+
}), this.value && this.#ct(), this.addEventListener("click", this.#X), this.addEventListener("keydown", this.#j), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0");
|
|
1379
|
+
}
|
|
1380
|
+
#ot() {
|
|
1381
|
+
this.removeEventListener("click", this.#X), this.removeEventListener("keydown", this.#j), this.#g && clearTimeout(this.#g);
|
|
1382
|
+
}
|
|
1383
|
+
// ── List: Selection ────────────────────────────────────
|
|
1384
|
+
#U(t) {
|
|
1385
|
+
if (!this.multiple)
|
|
1386
|
+
for (const i of this.options)
|
|
1387
|
+
i.removeAttribute("selected");
|
|
1388
|
+
const e = t.hasAttribute("selected");
|
|
1389
|
+
this.multiple && e ? t.removeAttribute("selected") : t.setAttribute("selected", ""), this.#dt(), this.dispatchEvent(new CustomEvent("change", {
|
|
1390
|
+
bubbles: !0,
|
|
1391
|
+
detail: {
|
|
1392
|
+
value: this.value,
|
|
1393
|
+
option: t,
|
|
1394
|
+
label: t.displayLabel ?? t.textContent?.trim() ?? ""
|
|
1395
|
+
}
|
|
1396
|
+
}));
|
|
1397
|
+
}
|
|
1398
|
+
#dt() {
|
|
1399
|
+
const t = this.options.filter((e) => e.hasAttribute("selected"));
|
|
1400
|
+
if (this.multiple)
|
|
1401
|
+
this.value = t.map((e) => e.getAttribute("value") ?? e.textContent?.trim() ?? "").join(",");
|
|
1402
|
+
else {
|
|
1403
|
+
const e = t[0];
|
|
1404
|
+
this.value = e?.getAttribute("value") ?? e?.textContent?.trim() ?? "";
|
|
1405
|
+
}
|
|
1406
|
+
this.#t.setFormValue(this.value || null);
|
|
1407
|
+
}
|
|
1408
|
+
#ct() {
|
|
1409
|
+
const t = this.value.split(",").map((e) => e.trim()).filter(Boolean);
|
|
1410
|
+
for (const e of this.options) {
|
|
1411
|
+
const i = e.getAttribute("value") ?? e.textContent?.trim() ?? "";
|
|
1412
|
+
t.includes(i) ? e.setAttribute("selected", "") : e.removeAttribute("selected");
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
// ── List: Active (keyboard highlight) ──────────────────
|
|
1416
|
+
#S(t) {
|
|
1417
|
+
const e = this.enabledOptions;
|
|
1418
|
+
if (e.length === 0) return;
|
|
1419
|
+
this.#W(), this.#p = Math.max(0, Math.min(t, e.length - 1));
|
|
1420
|
+
const i = e[this.#p];
|
|
1421
|
+
i.setAttribute("data-navigate-active", ""), i.scrollIntoView({ block: "nearest" }), i.id && this.setAttribute("aria-activedescendant", i.id);
|
|
1422
|
+
}
|
|
1423
|
+
#W() {
|
|
1424
|
+
for (const t of this.options)
|
|
1425
|
+
t.removeAttribute("data-navigate-active");
|
|
1426
|
+
this.removeAttribute("aria-activedescendant");
|
|
1427
|
+
}
|
|
1428
|
+
// ── List: Event handlers ───────────────────────────────
|
|
1429
|
+
#X = (t) => {
|
|
1430
|
+
const e = t.target.closest("aui-option");
|
|
1431
|
+
if (!e || e.hasAttribute("disabled")) return;
|
|
1432
|
+
this.#U(e);
|
|
1433
|
+
const i = this.enabledOptions.indexOf(e);
|
|
1434
|
+
i >= 0 && this.#S(i);
|
|
1435
|
+
};
|
|
1436
|
+
#j = (t) => {
|
|
1437
|
+
const e = this.enabledOptions;
|
|
1438
|
+
if (e.length !== 0)
|
|
1439
|
+
switch (t.key) {
|
|
1440
|
+
case "ArrowDown": {
|
|
1441
|
+
t.preventDefault();
|
|
1442
|
+
const i = this.#p < e.length - 1 ? this.#p + 1 : 0;
|
|
1443
|
+
this.#S(i);
|
|
1444
|
+
break;
|
|
1445
|
+
}
|
|
1446
|
+
case "ArrowUp": {
|
|
1447
|
+
t.preventDefault();
|
|
1448
|
+
const i = this.#p > 0 ? this.#p - 1 : e.length - 1;
|
|
1449
|
+
this.#S(i);
|
|
1450
|
+
break;
|
|
1451
|
+
}
|
|
1452
|
+
case "Home": {
|
|
1453
|
+
t.preventDefault(), this.#S(0);
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
case "End": {
|
|
1457
|
+
t.preventDefault(), this.#S(e.length - 1);
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
case "Enter":
|
|
1461
|
+
case " ": {
|
|
1462
|
+
t.preventDefault();
|
|
1463
|
+
const i = e[this.#p];
|
|
1464
|
+
i && this.#U(i);
|
|
1465
|
+
break;
|
|
1466
|
+
}
|
|
1467
|
+
default:
|
|
1468
|
+
t.key.length === 1 && !t.ctrlKey && !t.metaKey && this.#ut(t.key);
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
#ut(t) {
|
|
1472
|
+
this.#E += t.toLowerCase(), this.#g && clearTimeout(this.#g), this.#g = setTimeout(() => {
|
|
1473
|
+
this.#E = "";
|
|
1474
|
+
}, 500);
|
|
1475
|
+
const i = this.enabledOptions.findIndex((s) => (s.displayLabel?.toLowerCase() ?? s.textContent?.trim().toLowerCase() ?? "").startsWith(this.#E));
|
|
1476
|
+
i >= 0 && this.#S(i);
|
|
1477
|
+
}
|
|
1478
|
+
// ════════════════════════════════════════════════════════════
|
|
1479
|
+
// MODE: Combobox (searchable dropdown)
|
|
1480
|
+
// ════════════════════════════════════════════════════════════
|
|
1481
|
+
#bt() {
|
|
1482
|
+
const t = `combobox-${crypto.randomUUID().slice(0, 8)}`;
|
|
1483
|
+
this.#e = `--${t}`, this.#o = document.createElement("span"), this.#o.setAttribute("data-input", ""), this.#o.setAttribute("contenteditable", "plaintext-only"), this.#o.setAttribute("role", "combobox"), this.#o.setAttribute("aria-haspopup", "listbox"), this.#o.setAttribute("aria-autocomplete", "list"), this.#o.setAttribute("tabindex", "0"), this.#o.id = t, this.#v = document.createElement("div"), this.#v.setAttribute("popover", "manual"), this.#v.setAttribute("data-dropdown", ""), this.#f = document.createElement("aui-listbox"), this.#f.id = `${t}-listbox`, this.#o.setAttribute("aria-controls", this.#f.id), this.#v.appendChild(this.#f);
|
|
1484
|
+
const e = Array.from(this.children);
|
|
1485
|
+
for (const i of e)
|
|
1486
|
+
M(i) && this.#f.appendChild(i);
|
|
1487
|
+
if (this.#y = Array.from(this.#f.querySelectorAll("aui-option")), this.appendChild(this.#o), this.appendChild(this.#v), this.#o.style.anchorName = this.#e, this.style.setProperty("--_anchor", this.#e), this.addEffect(() => {
|
|
1488
|
+
const i = this.disabled;
|
|
1489
|
+
this.#o.setAttribute("contenteditable", i ? "false" : "plaintext-only"), this.#o.setAttribute("tabindex", i ? "-1" : "0"), this.#o.setAttribute("aria-expanded", String(this.open)), this.#o.setAttribute("data-placeholder", this.placeholder || ""), this.#t.setFormValue(this.value || null);
|
|
1490
|
+
const s = !this.#o.textContent?.trim();
|
|
1491
|
+
this.toggleAttribute("data-input-empty", s);
|
|
1492
|
+
}), this.value) {
|
|
1493
|
+
const i = this.#y.find(
|
|
1494
|
+
(s) => (s.getAttribute("value") ?? s.textContent?.trim()) === this.value
|
|
1495
|
+
);
|
|
1496
|
+
i && this.#o && (this.#o.textContent = i.displayLabel ?? i.textContent?.trim() ?? "");
|
|
1497
|
+
}
|
|
1498
|
+
this.#o.addEventListener("input", this.#Y), this.#o.addEventListener("focus", this.#J), this.#o.addEventListener("keydown", this.#Q), this.#f.addEventListener("change", this.#Z), this.#f.addEventListener("keydown", this.#tt), document.addEventListener("click", this.#et);
|
|
1499
|
+
}
|
|
1500
|
+
#ft() {
|
|
1501
|
+
this.#o?.removeEventListener("input", this.#Y), this.#o?.removeEventListener("focus", this.#J), this.#o?.removeEventListener("keydown", this.#Q), this.#f?.removeEventListener("change", this.#Z), this.#f?.removeEventListener("keydown", this.#tt), document.removeEventListener("click", this.#et), this.#m();
|
|
1502
|
+
}
|
|
1503
|
+
#F(t) {
|
|
1504
|
+
const e = t.toLowerCase();
|
|
1505
|
+
for (const s of this.#y) {
|
|
1506
|
+
const n = s.displayLabel?.toLowerCase() ?? s.textContent?.trim().toLowerCase() ?? "";
|
|
1507
|
+
s.style.display = !e || n.includes(e) ? "" : "none";
|
|
1508
|
+
}
|
|
1509
|
+
const i = this.#f?.querySelectorAll("aui-optgroup") ?? [];
|
|
1510
|
+
for (const s of i) {
|
|
1511
|
+
const n = s.querySelector('aui-option:not([style*="display: none"])');
|
|
1512
|
+
s.style.display = n ? "" : "none";
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
#Y = () => {
|
|
1516
|
+
this.open || this.#x(), this.#F(this.#o?.textContent ?? ""), this.toggleAttribute("data-input-empty", !this.#o?.textContent?.trim());
|
|
1517
|
+
};
|
|
1518
|
+
#J = () => {
|
|
1519
|
+
this.#x(), this.#F(this.#o?.textContent ?? "");
|
|
1520
|
+
};
|
|
1521
|
+
#Q = (t) => {
|
|
1522
|
+
if (t.key === "Enter") {
|
|
1523
|
+
t.preventDefault();
|
|
1524
|
+
const i = this.#f?.activeOption;
|
|
1525
|
+
i && this.open && i.click();
|
|
1526
|
+
} else t.key === "ArrowDown" ? (t.preventDefault(), this.open || this.#x(), this.#f?.focus()) : t.key === "Escape" && this.#m();
|
|
1527
|
+
};
|
|
1528
|
+
#Z = (t) => {
|
|
1529
|
+
t.stopPropagation(), this.value = t.detail.value, this.#t.setFormValue(this.value || null), this.#o && (this.#o.textContent = t.detail.label ?? ""), this.toggleAttribute("data-input-empty", !this.value), this.#m(), this.#o?.focus(), this.#F(""), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: t.detail }));
|
|
1530
|
+
};
|
|
1531
|
+
#tt = (t) => {
|
|
1532
|
+
t.key === "Escape" ? (t.preventDefault(), this.#m(), this.#o?.focus()) : t.key === "Tab" && this.#m();
|
|
1533
|
+
};
|
|
1534
|
+
#et = (t) => {
|
|
1535
|
+
this.open && !this.contains(t.target) && this.#m();
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
let A = null;
|
|
1539
|
+
function W() {
|
|
1540
|
+
return A && A.isConnected || (A = document.querySelector("aui-toast-container"), A || (A = document.createElement("aui-toast-container"), document.body.appendChild(A))), A;
|
|
1541
|
+
}
|
|
1542
|
+
class mt extends h {
|
|
1543
|
+
static attributes = {
|
|
1544
|
+
open: { type: "boolean", default: !1 },
|
|
1545
|
+
message: { type: "string", default: "" },
|
|
1546
|
+
duration: { type: "string", default: "4000" },
|
|
1547
|
+
closeable: { type: "boolean", default: !0 }
|
|
1548
|
+
};
|
|
1549
|
+
#t = null;
|
|
1550
|
+
#e = null;
|
|
1551
|
+
#i = null;
|
|
1552
|
+
static show(t) {
|
|
1553
|
+
const e = document.createElement("aui-toast");
|
|
1554
|
+
return e.setAttribute("message", t.message), t.intent && e.setAttribute(t.intent, ""), t.duration !== void 0 && e.setAttribute("duration", String(t.duration)), t.closeable === !1 ? e.removeAttribute("closeable") : e.setAttribute("closeable", ""), W().appendChild(e), requestAnimationFrame(() => e.setAttribute("open", "")), e;
|
|
1555
|
+
}
|
|
1556
|
+
activate() {
|
|
1557
|
+
this.setAttribute("role", "status"), this.setAttribute("aria-live", "polite"), this.#i = document.createElement("span"), this.#i.setAttribute("data-message", ""), this.appendChild(this.#i), this.#e = document.createElement("span"), this.#e.setAttribute("data-close", ""), this.#e.setAttribute("role", "button"), this.#e.setAttribute("tabindex", "0"), this.#e.setAttribute("aria-label", "Dismiss"), this.#e.textContent = "✕", this.appendChild(this.#e), this.addEffect(() => {
|
|
1558
|
+
this.#i && (this.#i.textContent = this.message);
|
|
1559
|
+
}), this.addEffect(() => {
|
|
1560
|
+
this.#e && (this.#e.style.display = this.closeable ? "" : "none");
|
|
1561
|
+
}), this.addEffect(() => {
|
|
1562
|
+
if (this.#t && clearTimeout(this.#t), this.open) {
|
|
1563
|
+
const t = parseInt(this.duration, 10) || 4e3;
|
|
1564
|
+
t > 0 && (this.#t = setTimeout(() => this.dismiss(), t));
|
|
1565
|
+
}
|
|
1566
|
+
}), this.#e.addEventListener("click", this.#s), this.#e.addEventListener("keydown", this.#n);
|
|
1567
|
+
}
|
|
1568
|
+
dispose() {
|
|
1569
|
+
this.#t && clearTimeout(this.#t), this.#e?.removeEventListener("click", this.#s), this.#e?.removeEventListener("keydown", this.#n);
|
|
1570
|
+
}
|
|
1571
|
+
dismiss() {
|
|
1572
|
+
this.open = !1, this.dispatchEvent(new Event("dismiss", { bubbles: !0 })), setTimeout(() => this.remove(), 200);
|
|
1573
|
+
}
|
|
1574
|
+
#s = (t) => {
|
|
1575
|
+
t.stopPropagation(), this.dismiss();
|
|
1576
|
+
};
|
|
1577
|
+
#n = (t) => {
|
|
1578
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.dismiss());
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
class vt extends h {
|
|
1582
|
+
static attributes = {
|
|
1583
|
+
value: { type: "string", default: "" },
|
|
1584
|
+
orientation: { type: "enum", values: ["vertical"], default: "" }
|
|
1585
|
+
};
|
|
1586
|
+
activate() {
|
|
1587
|
+
if (this.setAttribute("role", "tablist"), this.addEffect(() => {
|
|
1588
|
+
this.orientation ? this.setAttribute("aria-orientation", this.orientation) : this.removeAttribute("aria-orientation");
|
|
1589
|
+
}), this.#s(), this.style.setProperty("--_tab-count", String(this.#t.length)), this.addEffect(() => {
|
|
1590
|
+
this.#n();
|
|
1591
|
+
}), !this.value) {
|
|
1592
|
+
const t = this.querySelector("aui-tab:not([disabled])");
|
|
1593
|
+
t && (this.value = t.getAttribute("value") ?? "");
|
|
1594
|
+
}
|
|
1595
|
+
this.addEventListener("click", this.#r), this.addEventListener("keydown", this.#l);
|
|
1596
|
+
}
|
|
1597
|
+
dispose() {
|
|
1598
|
+
this.removeEventListener("click", this.#r), this.removeEventListener("keydown", this.#l);
|
|
1599
|
+
}
|
|
1600
|
+
// ── Internal ──────────────────────────────────────────
|
|
1601
|
+
get #t() {
|
|
1602
|
+
return Array.from(this.querySelectorAll("aui-tab"));
|
|
1603
|
+
}
|
|
1604
|
+
get #e() {
|
|
1605
|
+
return this.#t.filter((t) => !t.hasAttribute("disabled"));
|
|
1606
|
+
}
|
|
1607
|
+
get #i() {
|
|
1608
|
+
return Array.from(this.querySelectorAll("aui-tab-panel"));
|
|
1609
|
+
}
|
|
1610
|
+
#s() {
|
|
1611
|
+
const t = this.#t, e = this.#i;
|
|
1612
|
+
for (const i of t) {
|
|
1613
|
+
const s = i.getAttribute("value") ?? "";
|
|
1614
|
+
i.id || (i.id = `tab-${s}-${crypto.randomUUID().slice(0, 4)}`);
|
|
1615
|
+
const n = e.find((a) => a.getAttribute("value") === s);
|
|
1616
|
+
n && (n.id || (n.id = `panel-${s}-${crypto.randomUUID().slice(0, 4)}`), i.setAttribute("aria-controls", n.id), n.setAttribute("aria-labelledby", i.id));
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
#n() {
|
|
1620
|
+
const t = this.value, e = this.#t;
|
|
1621
|
+
let i = -1;
|
|
1622
|
+
for (let s = 0; s < e.length; s++)
|
|
1623
|
+
e[s].getAttribute("value") === t ? (e[s].setAttribute("selected", ""), i = s) : e[s].removeAttribute("selected");
|
|
1624
|
+
for (const s of this.#i)
|
|
1625
|
+
s.getAttribute("value") === t ? s.setAttribute("active", "") : s.removeAttribute("active");
|
|
1626
|
+
this.style.setProperty("--_tab-count", String(e.length)), i >= 0 ? (this.style.setProperty("--_indicator-index", String(i)), this.setAttribute("data-indicator-ready", "")) : this.removeAttribute("data-indicator-ready");
|
|
1627
|
+
}
|
|
1628
|
+
#a(t) {
|
|
1629
|
+
if (t.hasAttribute("disabled")) return;
|
|
1630
|
+
const e = t.getAttribute("value") ?? "";
|
|
1631
|
+
this.value = e, this.dispatchEvent(new CustomEvent("change", {
|
|
1632
|
+
bubbles: !0,
|
|
1633
|
+
detail: { value: e }
|
|
1634
|
+
}));
|
|
1635
|
+
}
|
|
1636
|
+
#r = (t) => {
|
|
1637
|
+
const e = t.target.closest("aui-tab");
|
|
1638
|
+
e && this.contains(e) && this.#a(e);
|
|
1639
|
+
};
|
|
1640
|
+
#l = (t) => {
|
|
1641
|
+
const e = t.target;
|
|
1642
|
+
if (e.tagName !== "AUI-TAB") return;
|
|
1643
|
+
const i = this.orientation === "vertical", s = i ? "ArrowDown" : "ArrowRight", n = i ? "ArrowUp" : "ArrowLeft", a = this.#e, r = a.indexOf(e);
|
|
1644
|
+
if (r < 0) return;
|
|
1645
|
+
let o;
|
|
1646
|
+
switch (t.key) {
|
|
1647
|
+
case s:
|
|
1648
|
+
o = r < a.length - 1 ? r + 1 : 0;
|
|
1649
|
+
break;
|
|
1650
|
+
case n:
|
|
1651
|
+
o = r > 0 ? r - 1 : a.length - 1;
|
|
1652
|
+
break;
|
|
1653
|
+
case "Home":
|
|
1654
|
+
o = 0;
|
|
1655
|
+
break;
|
|
1656
|
+
case "End":
|
|
1657
|
+
o = a.length - 1;
|
|
1658
|
+
break;
|
|
1659
|
+
default:
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
t.preventDefault();
|
|
1663
|
+
const d = a[o];
|
|
1664
|
+
d.focus(), this.#a(d);
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
class gt extends h {
|
|
1668
|
+
static attributes = {
|
|
1669
|
+
value: { type: "string", default: "" },
|
|
1670
|
+
disabled: { type: "boolean", default: !1 },
|
|
1671
|
+
selected: { type: "boolean", default: !1 }
|
|
1672
|
+
};
|
|
1673
|
+
activate() {
|
|
1674
|
+
this.setAttribute("role", "tab"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", this.selected ? "0" : "-1"), this.addEffect(() => {
|
|
1675
|
+
this.setAttribute("aria-selected", String(this.selected)), this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.selected ? "0" : "-1");
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
class At extends h {
|
|
1680
|
+
static attributes = {
|
|
1681
|
+
value: { type: "string", default: "" },
|
|
1682
|
+
active: { type: "boolean", default: !1 }
|
|
1683
|
+
};
|
|
1684
|
+
activate() {
|
|
1685
|
+
this.setAttribute("role", "tabpanel"), this.addEffect(() => {
|
|
1686
|
+
this.setAttribute("aria-hidden", String(!this.active)), this.active ? this.setAttribute("tabindex", "0") : this.setAttribute("tabindex", "-1");
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
class yt extends h {
|
|
1691
|
+
static attributes = {
|
|
1692
|
+
multiple: { type: "boolean", default: !1 },
|
|
1693
|
+
caret: { type: "enum", values: ["leading", "trailing"], default: "leading" }
|
|
1694
|
+
};
|
|
1695
|
+
activate() {
|
|
1696
|
+
this.addEventListener("toggle", this.#t);
|
|
1697
|
+
}
|
|
1698
|
+
dispose() {
|
|
1699
|
+
this.removeEventListener("toggle", this.#t);
|
|
1700
|
+
}
|
|
1701
|
+
#t = (t) => {
|
|
1702
|
+
if (this.multiple) return;
|
|
1703
|
+
const e = t.target;
|
|
1704
|
+
if (e.tagName !== "AUI-ACCORDION-ITEM" || !e.hasAttribute("open")) return;
|
|
1705
|
+
const i = this.querySelectorAll("aui-accordion-item[open]");
|
|
1706
|
+
for (const s of i)
|
|
1707
|
+
s !== e && s.removeAttribute("open");
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
class Et extends h {
|
|
1711
|
+
static attributes = {
|
|
1712
|
+
open: { type: "boolean", default: !1 },
|
|
1713
|
+
disabled: { type: "boolean", default: !1 }
|
|
1714
|
+
};
|
|
1715
|
+
#t = null;
|
|
1716
|
+
#e = null;
|
|
1717
|
+
activate() {
|
|
1718
|
+
if (this.#t = this.querySelector("[data-header]"), this.#t)
|
|
1719
|
+
this.#e = this.querySelector("[data-content]");
|
|
1720
|
+
else {
|
|
1721
|
+
this.#t = document.createElement("div"), this.#t.setAttribute("data-header", ""), this.#t.setAttribute("role", "button"), this.#t.setAttribute("tabindex", "0");
|
|
1722
|
+
const i = document.createElement("aui-icon");
|
|
1723
|
+
i.setAttribute("name", "caret-right"), i.setAttribute("data-chevron", ""), this.#t.appendChild(i);
|
|
1724
|
+
const s = this.querySelector("[data-trigger]");
|
|
1725
|
+
if (s)
|
|
1726
|
+
this.#t.appendChild(s);
|
|
1727
|
+
else {
|
|
1728
|
+
const n = Array.from(this.childNodes).find(
|
|
1729
|
+
(a) => a.nodeType === Node.ELEMENT_NODE
|
|
1730
|
+
);
|
|
1731
|
+
n && this.#t.appendChild(n);
|
|
1732
|
+
}
|
|
1733
|
+
for (this.#e = document.createElement("div"), this.#e.setAttribute("data-content", ""); this.firstChild && this.firstChild !== this.#t; )
|
|
1734
|
+
this.#e.appendChild(this.firstChild);
|
|
1735
|
+
this.appendChild(this.#t), this.appendChild(this.#e);
|
|
1736
|
+
}
|
|
1737
|
+
const t = `acc-h-${crypto.randomUUID().slice(0, 6)}`, e = `acc-c-${crypto.randomUUID().slice(0, 6)}`;
|
|
1738
|
+
this.#t.id = t, this.#e && (this.#e.id = e, this.#e.setAttribute("role", "region"), this.#e.setAttribute("aria-labelledby", t)), this.#t.setAttribute("aria-controls", e), this.addEffect(() => {
|
|
1739
|
+
this.#t.setAttribute("aria-expanded", String(this.open)), this.#t.setAttribute("aria-disabled", String(this.disabled));
|
|
1740
|
+
}), this.#t.addEventListener("click", this.#s), this.#t.addEventListener("keydown", this.#n);
|
|
1741
|
+
}
|
|
1742
|
+
dispose() {
|
|
1743
|
+
this.#t?.removeEventListener("click", this.#s), this.#t?.removeEventListener("keydown", this.#n);
|
|
1744
|
+
}
|
|
1745
|
+
#i() {
|
|
1746
|
+
this.disabled || (this.open = !this.open, this.dispatchEvent(new CustomEvent("toggle", { bubbles: !0, detail: { open: this.open } })));
|
|
1747
|
+
}
|
|
1748
|
+
#s = () => {
|
|
1749
|
+
this.#i();
|
|
1750
|
+
};
|
|
1751
|
+
#n = (t) => {
|
|
1752
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.#i());
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
class xt extends h {
|
|
1756
|
+
static attributes = {
|
|
1757
|
+
label: { type: "string", default: "Breadcrumb" },
|
|
1758
|
+
joiner: { type: "string", default: "/" }
|
|
1759
|
+
};
|
|
1760
|
+
activate() {
|
|
1761
|
+
this.setAttribute("role", "navigation"), this.addEffect(() => {
|
|
1762
|
+
this.setAttribute("aria-label", this.label || "Breadcrumb"), this.style.setProperty("--_joiner", `"${this.joiner || "/"}"`);
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
class wt extends h {
|
|
1767
|
+
static attributes = {
|
|
1768
|
+
href: { type: "string", default: "" },
|
|
1769
|
+
current: { type: "boolean", default: !1 }
|
|
1770
|
+
};
|
|
1771
|
+
#t = null;
|
|
1772
|
+
activate() {
|
|
1773
|
+
this.addEffect(() => {
|
|
1774
|
+
this.current ? this.setAttribute("aria-current", "page") : this.removeAttribute("aria-current");
|
|
1775
|
+
}), this.addEffect(() => {
|
|
1776
|
+
if (this.href && !this.current) {
|
|
1777
|
+
if (!this.#t) {
|
|
1778
|
+
for (this.#t = document.createElement("a"); this.firstChild && this.firstChild !== this.#t; )
|
|
1779
|
+
this.#t.appendChild(this.firstChild);
|
|
1780
|
+
this.appendChild(this.#t);
|
|
1781
|
+
}
|
|
1782
|
+
this.#t.href = this.href;
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
class kt extends h {
|
|
1788
|
+
static formAssociated = !0;
|
|
1789
|
+
static attributes = {
|
|
1790
|
+
value: { type: "string", default: "" },
|
|
1791
|
+
name: { type: "string", default: "" }
|
|
1792
|
+
};
|
|
1793
|
+
#t;
|
|
1794
|
+
#e = null;
|
|
1795
|
+
constructor() {
|
|
1796
|
+
super(), this.#t = this.attachInternals(), this.#t.role = "radiogroup";
|
|
1797
|
+
}
|
|
1798
|
+
activate() {
|
|
1799
|
+
if (this.addEffect(() => {
|
|
1800
|
+
this.#t.setFormValue(this.value || null), this.#n(), this.#a();
|
|
1801
|
+
}), !this.value) {
|
|
1802
|
+
const t = this.querySelector("aui-segment:not([disabled])");
|
|
1803
|
+
t && (this.value = t.getAttribute("value") ?? "");
|
|
1804
|
+
}
|
|
1805
|
+
this.addEventListener("click", this.#l), this.addEventListener("keydown", this.#h);
|
|
1806
|
+
}
|
|
1807
|
+
dispose() {
|
|
1808
|
+
this.removeEventListener("click", this.#l), this.removeEventListener("keydown", this.#h);
|
|
1809
|
+
}
|
|
1810
|
+
formDisabledCallback(t) {
|
|
1811
|
+
for (const e of this.#i) e.toggleAttribute("disabled", t);
|
|
1812
|
+
}
|
|
1813
|
+
formResetCallback() {
|
|
1814
|
+
const t = this.querySelector("aui-segment:not([disabled])");
|
|
1815
|
+
this.value = t?.getAttribute("value") ?? "";
|
|
1816
|
+
}
|
|
1817
|
+
get #i() {
|
|
1818
|
+
return Array.from(this.querySelectorAll("aui-segment"));
|
|
1819
|
+
}
|
|
1820
|
+
get #s() {
|
|
1821
|
+
return this.#i.filter((t) => !t.hasAttribute("disabled"));
|
|
1822
|
+
}
|
|
1823
|
+
#n() {
|
|
1824
|
+
for (const t of this.#i)
|
|
1825
|
+
t.getAttribute("value") === this.value ? t.setAttribute("selected", "") : t.removeAttribute("selected");
|
|
1826
|
+
}
|
|
1827
|
+
#a() {
|
|
1828
|
+
const t = this.#i, e = t.findIndex((i) => i.getAttribute("value") === this.value);
|
|
1829
|
+
if (e < 0) {
|
|
1830
|
+
this.removeAttribute("data-indicator-ready");
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
this.#e || (this.#e = document.createElement("div"), this.#e.setAttribute("data-indicator", ""), this.prepend(this.#e)), this.style.setProperty("--_segment-count", `${t.length}`), this.#e.style.transform = `translateX(${e * 100}%)`, this.setAttribute("data-indicator-ready", "");
|
|
1834
|
+
}
|
|
1835
|
+
#r(t) {
|
|
1836
|
+
t.hasAttribute("disabled") || (this.value = t.getAttribute("value") ?? "", this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { value: this.value } })));
|
|
1837
|
+
}
|
|
1838
|
+
#l = (t) => {
|
|
1839
|
+
const e = t.target.closest("aui-segment");
|
|
1840
|
+
e && this.contains(e) && this.#r(e);
|
|
1841
|
+
};
|
|
1842
|
+
#h = (t) => {
|
|
1843
|
+
const e = t.target;
|
|
1844
|
+
if (e.tagName !== "AUI-SEGMENT") return;
|
|
1845
|
+
const i = this.#s, s = i.indexOf(e);
|
|
1846
|
+
if (s < 0) return;
|
|
1847
|
+
let n;
|
|
1848
|
+
switch (t.key) {
|
|
1849
|
+
case "ArrowRight":
|
|
1850
|
+
case "ArrowDown":
|
|
1851
|
+
n = s < i.length - 1 ? s + 1 : 0;
|
|
1852
|
+
break;
|
|
1853
|
+
case "ArrowLeft":
|
|
1854
|
+
case "ArrowUp":
|
|
1855
|
+
n = s > 0 ? s - 1 : i.length - 1;
|
|
1856
|
+
break;
|
|
1857
|
+
case "Home":
|
|
1858
|
+
n = 0;
|
|
1859
|
+
break;
|
|
1860
|
+
case "End":
|
|
1861
|
+
n = i.length - 1;
|
|
1862
|
+
break;
|
|
1863
|
+
default:
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
t.preventDefault(), i[n].focus(), this.#r(i[n]);
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1869
|
+
class Ct extends h {
|
|
1870
|
+
static attributes = {
|
|
1871
|
+
value: { type: "string", default: "" },
|
|
1872
|
+
disabled: { type: "boolean", default: !1 },
|
|
1873
|
+
selected: { type: "boolean", default: !1 }
|
|
1874
|
+
};
|
|
1875
|
+
activate() {
|
|
1876
|
+
this.setAttribute("role", "radio"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", this.selected ? "0" : "-1"), this.addEffect(() => {
|
|
1877
|
+
this.setAttribute("aria-checked", String(this.selected)), this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.selected ? "0" : "-1");
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
class Lt extends h {
|
|
1882
|
+
static attributes = {
|
|
1883
|
+
page: { type: "string", default: "1" },
|
|
1884
|
+
total: { type: "string", default: "1" },
|
|
1885
|
+
siblings: { type: "string", default: "1" }
|
|
1886
|
+
};
|
|
1887
|
+
activate() {
|
|
1888
|
+
this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Pagination"), this.addEffect(() => {
|
|
1889
|
+
this.#t();
|
|
1890
|
+
}), this.addEventListener("click", this.#s), this.addEventListener("keydown", this.#n);
|
|
1891
|
+
}
|
|
1892
|
+
dispose() {
|
|
1893
|
+
this.removeEventListener("click", this.#s), this.removeEventListener("keydown", this.#n);
|
|
1894
|
+
}
|
|
1895
|
+
#t() {
|
|
1896
|
+
const t = parseInt(this.page, 10) || 1, e = parseInt(this.total, 10) || 1, i = parseInt(this.siblings, 10) || 1, s = this.#i(t, e, i);
|
|
1897
|
+
this.innerHTML = "";
|
|
1898
|
+
const n = this.#e("‹", t - 1, t <= 1);
|
|
1899
|
+
n.setAttribute("aria-label", "Previous page"), n.setAttribute("data-pagination-prev", ""), this.appendChild(n);
|
|
1900
|
+
for (const r of s)
|
|
1901
|
+
if (r === "…") {
|
|
1902
|
+
const o = document.createElement("span");
|
|
1903
|
+
o.setAttribute("data-pagination-ellipsis", ""), o.textContent = "…", this.appendChild(o);
|
|
1904
|
+
} else {
|
|
1905
|
+
const o = r, d = this.#e(String(o), o, !1);
|
|
1906
|
+
o === t && (d.setAttribute("aria-current", "page"), d.setAttribute("data-pagination-current", "")), this.appendChild(d);
|
|
1907
|
+
}
|
|
1908
|
+
const a = this.#e("›", t + 1, t >= e);
|
|
1909
|
+
a.setAttribute("aria-label", "Next page"), a.setAttribute("data-pagination-next", ""), this.appendChild(a);
|
|
1910
|
+
}
|
|
1911
|
+
#e(t, e, i) {
|
|
1912
|
+
const s = document.createElement("span");
|
|
1913
|
+
return s.setAttribute("role", "button"), s.setAttribute("tabindex", i ? "-1" : "0"), s.setAttribute("data-pagination-page", String(e)), s.textContent = t, i && s.setAttribute("aria-disabled", "true"), s;
|
|
1914
|
+
}
|
|
1915
|
+
#i(t, e, i) {
|
|
1916
|
+
if (e <= i * 2 + 5)
|
|
1917
|
+
return Array.from({ length: e }, (r, o) => o + 1);
|
|
1918
|
+
const s = [], n = Math.max(t - i, 2), a = Math.min(t + i, e - 1);
|
|
1919
|
+
if (s.push(1), n > 2) s.push("…");
|
|
1920
|
+
else for (let r = 2; r < n; r++) s.push(r);
|
|
1921
|
+
for (let r = n; r <= a; r++) s.push(r);
|
|
1922
|
+
if (a < e - 1) s.push("…");
|
|
1923
|
+
else for (let r = a + 1; r < e; r++) s.push(r);
|
|
1924
|
+
return s.push(e), s;
|
|
1925
|
+
}
|
|
1926
|
+
#s = (t) => {
|
|
1927
|
+
const e = t.target.closest("[data-pagination-page]");
|
|
1928
|
+
if (!e || e.getAttribute("aria-disabled") === "true") return;
|
|
1929
|
+
const i = parseInt(e.getAttribute("data-pagination-page") ?? "", 10);
|
|
1930
|
+
isNaN(i) || (this.page = String(i), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { page: i } })));
|
|
1931
|
+
};
|
|
1932
|
+
#n = (t) => {
|
|
1933
|
+
if (t.key === "Enter" || t.key === " ") {
|
|
1934
|
+
const e = t.target;
|
|
1935
|
+
e.hasAttribute("data-pagination-page") && (t.preventDefault(), e.click());
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
class St extends h {
|
|
1940
|
+
#t = -1;
|
|
1941
|
+
activate() {
|
|
1942
|
+
this.setAttribute("role", "search"), this.addEventListener("input", this.#d), this.addEventListener("keydown", this.#u), this.addEventListener("click", this.#c), requestAnimationFrame(() => {
|
|
1943
|
+
this.#l(0);
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
dispose() {
|
|
1947
|
+
this.removeEventListener("input", this.#d), this.removeEventListener("keydown", this.#u), this.removeEventListener("click", this.#c);
|
|
1948
|
+
}
|
|
1949
|
+
// ── Queries ───────────────────────────────────────────
|
|
1950
|
+
get #e() {
|
|
1951
|
+
return Array.from(this.querySelectorAll("aui-command-item"));
|
|
1952
|
+
}
|
|
1953
|
+
get #i() {
|
|
1954
|
+
return this.#e.filter((t) => !t.hasAttribute("hidden") && !t.hasAttribute("disabled"));
|
|
1955
|
+
}
|
|
1956
|
+
get #s() {
|
|
1957
|
+
return this.querySelector("aui-command-input");
|
|
1958
|
+
}
|
|
1959
|
+
get #n() {
|
|
1960
|
+
return this.querySelector("aui-command-empty");
|
|
1961
|
+
}
|
|
1962
|
+
get #a() {
|
|
1963
|
+
return this.querySelector("aui-command-list");
|
|
1964
|
+
}
|
|
1965
|
+
// ── Filtering ─────────────────────────────────────────
|
|
1966
|
+
#r(t) {
|
|
1967
|
+
const e = t.toLowerCase().trim();
|
|
1968
|
+
for (const s of this.#e) {
|
|
1969
|
+
const n = s.searchText ?? s.textContent?.toLowerCase() ?? "", a = !e || n.includes(e);
|
|
1970
|
+
s.toggleAttribute("hidden", !a);
|
|
1971
|
+
}
|
|
1972
|
+
const i = this.#i;
|
|
1973
|
+
this.#n && this.#n.toggleAttribute("hidden", i.length > 0), this.#l(0);
|
|
1974
|
+
}
|
|
1975
|
+
// ── Active item tracking ──────────────────────────────
|
|
1976
|
+
#l(t) {
|
|
1977
|
+
const e = this.#i;
|
|
1978
|
+
if (e.length === 0) {
|
|
1979
|
+
this.#t = -1, this.#h();
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
this.#h(), this.#t = Math.max(0, Math.min(t, e.length - 1));
|
|
1983
|
+
const i = e[this.#t];
|
|
1984
|
+
i.setAttribute("data-navigate-active", ""), i.scrollIntoView({ block: "nearest" }), i.id && this.#a && this.#a.setAttribute("aria-activedescendant", i.id);
|
|
1985
|
+
}
|
|
1986
|
+
#h() {
|
|
1987
|
+
for (const t of this.#e)
|
|
1988
|
+
t.removeAttribute("data-navigate-active");
|
|
1989
|
+
this.#a?.removeAttribute("aria-activedescendant");
|
|
1990
|
+
}
|
|
1991
|
+
// ── Event handlers ────────────────────────────────────
|
|
1992
|
+
#d = () => {
|
|
1993
|
+
const t = this.#s?.query ?? "";
|
|
1994
|
+
this.#r(t);
|
|
1995
|
+
};
|
|
1996
|
+
#u = (t) => {
|
|
1997
|
+
const e = this.#i;
|
|
1998
|
+
if (!(e.length === 0 && t.key !== "Escape"))
|
|
1999
|
+
switch (t.key) {
|
|
2000
|
+
case "ArrowDown": {
|
|
2001
|
+
t.preventDefault();
|
|
2002
|
+
const i = this.#t < e.length - 1 ? this.#t + 1 : 0;
|
|
2003
|
+
this.#l(i);
|
|
2004
|
+
break;
|
|
2005
|
+
}
|
|
2006
|
+
case "ArrowUp": {
|
|
2007
|
+
t.preventDefault();
|
|
2008
|
+
const i = this.#t > 0 ? this.#t - 1 : e.length - 1;
|
|
2009
|
+
this.#l(i);
|
|
2010
|
+
break;
|
|
2011
|
+
}
|
|
2012
|
+
case "Home": {
|
|
2013
|
+
t.preventDefault(), this.#l(0);
|
|
2014
|
+
break;
|
|
2015
|
+
}
|
|
2016
|
+
case "End": {
|
|
2017
|
+
t.preventDefault(), this.#l(e.length - 1);
|
|
2018
|
+
break;
|
|
2019
|
+
}
|
|
2020
|
+
case "Enter": {
|
|
2021
|
+
t.preventDefault();
|
|
2022
|
+
const i = e[this.#t];
|
|
2023
|
+
i && this.#b(i);
|
|
2024
|
+
break;
|
|
2025
|
+
}
|
|
2026
|
+
case "Escape": {
|
|
2027
|
+
this.dispatchEvent(new Event("dismiss", { bubbles: !0 }));
|
|
2028
|
+
break;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
};
|
|
2032
|
+
#c = (t) => {
|
|
2033
|
+
const e = t.target.closest("aui-command-item");
|
|
2034
|
+
!e || e.hasAttribute("disabled") || e.hasAttribute("hidden") || this.#b(e);
|
|
2035
|
+
};
|
|
2036
|
+
#b(t) {
|
|
2037
|
+
const e = t.getAttribute("value") ?? t.textContent?.trim() ?? "", i = t.textContent?.trim() ?? "";
|
|
2038
|
+
this.dispatchEvent(new CustomEvent("select", {
|
|
2039
|
+
bubbles: !0,
|
|
2040
|
+
detail: { value: e, label: i, item: t }
|
|
2041
|
+
}));
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
class It extends h {
|
|
2045
|
+
activate() {
|
|
2046
|
+
this.setAttribute("role", "status"), this.hasAttribute("hidden") || this.setAttribute("hidden", "");
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
class Dt extends h {
|
|
2050
|
+
static attributes = {
|
|
2051
|
+
label: { type: "string", default: "" }
|
|
2052
|
+
};
|
|
2053
|
+
activate() {
|
|
2054
|
+
this.setAttribute("role", "group");
|
|
2055
|
+
let t = this.querySelector("[data-heading]");
|
|
2056
|
+
!t && this.label && (t = document.createElement("span"), t.setAttribute("data-heading", ""), t.id = `cmdg-${crypto.randomUUID().slice(0, 6)}`, this.prepend(t)), this.addEffect(() => {
|
|
2057
|
+
const e = this.querySelector("[data-heading]");
|
|
2058
|
+
e && (e.textContent = this.label, this.setAttribute("aria-labelledby", e.id));
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
class Tt extends h {
|
|
2063
|
+
static attributes = {
|
|
2064
|
+
placeholder: { type: "string", default: "Search…" }
|
|
2065
|
+
};
|
|
2066
|
+
#t = null;
|
|
2067
|
+
get query() {
|
|
2068
|
+
return this.#t?.textContent?.trim() ?? "";
|
|
2069
|
+
}
|
|
2070
|
+
set query(t) {
|
|
2071
|
+
this.#t && (this.#t.textContent = t), this.#e();
|
|
2072
|
+
}
|
|
2073
|
+
activate() {
|
|
2074
|
+
this.#t = this.querySelector("[data-surface]"), this.#t || (this.#t = document.createElement("span"), this.#t.setAttribute("data-surface", ""), this.#t.setAttribute("contenteditable", "plaintext-only"), this.#t.setAttribute("tabindex", "0"), this.#t.setAttribute("role", "searchbox"), this.#t.setAttribute("aria-label", "Search commands"), this.appendChild(this.#t)), this.addEffect(() => {
|
|
2075
|
+
this.#t?.setAttribute("data-placeholder", this.placeholder || "Search…");
|
|
2076
|
+
}), this.#e(), this.#t.addEventListener("input", this.#i), this.#t.addEventListener("keydown", this.#s), this.#t.addEventListener("focus", this.#n);
|
|
2077
|
+
}
|
|
2078
|
+
dispose() {
|
|
2079
|
+
this.#t?.removeEventListener("input", this.#i), this.#t?.removeEventListener("keydown", this.#s), this.#t?.removeEventListener("focus", this.#n);
|
|
2080
|
+
}
|
|
2081
|
+
focus(t) {
|
|
2082
|
+
this.#t?.focus(t);
|
|
2083
|
+
}
|
|
2084
|
+
clear() {
|
|
2085
|
+
this.#t && (this.#t.textContent = ""), this.#e(), this.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
2086
|
+
}
|
|
2087
|
+
#e() {
|
|
2088
|
+
this.toggleAttribute("data-input-empty", !this.#t?.textContent?.trim());
|
|
2089
|
+
}
|
|
2090
|
+
#i = () => {
|
|
2091
|
+
this.#e(), this.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
2092
|
+
};
|
|
2093
|
+
#s = (t) => {
|
|
2094
|
+
t.key === "Enter" && t.preventDefault();
|
|
2095
|
+
};
|
|
2096
|
+
#n = () => {
|
|
2097
|
+
this.#t?.textContent?.trim() || window.getSelection()?.setPosition(this.#t, 0);
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
class Pt extends h {
|
|
2101
|
+
static attributes = {
|
|
2102
|
+
value: { type: "string", default: "" },
|
|
2103
|
+
disabled: { type: "boolean", default: !1 },
|
|
2104
|
+
keywords: { type: "string", default: "" }
|
|
2105
|
+
};
|
|
2106
|
+
/** Combined search text for filtering. */
|
|
2107
|
+
get searchText() {
|
|
2108
|
+
return `${this.textContent?.trim() ?? ""} ${this.value} ${this.keywords}`.toLowerCase();
|
|
2109
|
+
}
|
|
2110
|
+
activate() {
|
|
2111
|
+
this.setAttribute("role", "option"), this.addEffect(() => {
|
|
2112
|
+
this.setAttribute("aria-disabled", String(this.disabled));
|
|
2113
|
+
});
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
class Mt extends h {
|
|
2117
|
+
activate() {
|
|
2118
|
+
this.setAttribute("role", "listbox");
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
const y = { High: 0, Normal: 1, Low: 2 }, w = (l, t, e) => Math.min(e, Math.max(t, l));
|
|
2122
|
+
let L = null;
|
|
2123
|
+
function X(l) {
|
|
2124
|
+
if (L !== null) return L;
|
|
2125
|
+
const t = document.createElement("div");
|
|
2126
|
+
return t.style.cssText = "position:absolute;visibility:hidden;width:var(--aui-sidebar-width-collapsed,2.75rem)", l.appendChild(t), L = t.offsetWidth || 44, t.remove(), L;
|
|
2127
|
+
}
|
|
2128
|
+
class qt extends h {
|
|
2129
|
+
static attributes = {
|
|
2130
|
+
direction: { type: "enum", values: ["vertical"], default: "" }
|
|
2131
|
+
};
|
|
2132
|
+
static deferChildren = !0;
|
|
2133
|
+
#t = null;
|
|
2134
|
+
#e = null;
|
|
2135
|
+
// Hover state
|
|
2136
|
+
#i = null;
|
|
2137
|
+
// Resize state
|
|
2138
|
+
#s = -1;
|
|
2139
|
+
#n = [];
|
|
2140
|
+
#a = [];
|
|
2141
|
+
#r = 0;
|
|
2142
|
+
#l = 0;
|
|
2143
|
+
// Drag pointer ID (for releasing capture)
|
|
2144
|
+
#h = -1;
|
|
2145
|
+
// Pixel-based sizes — source of truth during/after resize
|
|
2146
|
+
#d = [];
|
|
2147
|
+
// Proportional layout
|
|
2148
|
+
#u = null;
|
|
2149
|
+
get isVertical() {
|
|
2150
|
+
return this.direction === "vertical";
|
|
2151
|
+
}
|
|
2152
|
+
activate() {
|
|
2153
|
+
this.addEventListener("pointermove", this.#L), this.addEventListener("pointerleave", this.#A), this.addEventListener("pointerdown", this.#T, !0), this.#g(), this.#t = new MutationObserver(this.#z), this.#t.observe(this, {
|
|
2154
|
+
childList: !0,
|
|
2155
|
+
attributes: !0,
|
|
2156
|
+
attributeFilter: ["hidden", "minimized", "priority"],
|
|
2157
|
+
subtree: !0
|
|
2158
|
+
}), this.#e = new ResizeObserver(this.#C), this.#e.observe(this), this.addEffect(() => {
|
|
2159
|
+
this.direction, this.#g();
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2162
|
+
dispose() {
|
|
2163
|
+
this.#k(), this.#q(), this.#t?.disconnect(), this.#t = null, this.#e?.disconnect(), this.#e = null, this.removeEventListener("pointermove", this.#L), this.removeEventListener("pointerleave", this.#A), this.removeEventListener("pointerdown", this.#T, !0);
|
|
2164
|
+
}
|
|
2165
|
+
// ── Pane queries ──
|
|
2166
|
+
#c() {
|
|
2167
|
+
return Array.from(this.children).filter(
|
|
2168
|
+
(t) => t instanceof HTMLElement && !t.hidden
|
|
2169
|
+
);
|
|
2170
|
+
}
|
|
2171
|
+
#b(t) {
|
|
2172
|
+
const e = t.getAttribute("size-min");
|
|
2173
|
+
return e ? Number(e) : X(t);
|
|
2174
|
+
}
|
|
2175
|
+
#p(t) {
|
|
2176
|
+
const e = t.getAttribute("size-max");
|
|
2177
|
+
return e ? Number(e) : 1 / 0;
|
|
2178
|
+
}
|
|
2179
|
+
#E(t) {
|
|
2180
|
+
const e = t.getAttribute("priority");
|
|
2181
|
+
return e === "high" ? y.High : e === "low" ? y.Low : y.Normal;
|
|
2182
|
+
}
|
|
2183
|
+
// ── Size management ──
|
|
2184
|
+
/** Read current pixel sizes from layout and establish initial state. */
|
|
2185
|
+
#g() {
|
|
2186
|
+
const t = this.#c(), e = this.isVertical;
|
|
2187
|
+
for (const s of t) {
|
|
2188
|
+
if (s.hasAttribute("minimized")) continue;
|
|
2189
|
+
const n = s.getAttribute("fixed-size"), a = s.getAttribute("basis");
|
|
2190
|
+
n && n !== "auto" ? s.style.flex = `0 1 ${n}` : a ? s.style.flex = `1 1 ${a}` : (s.style.removeProperty("flex"), s.style.removeProperty("flex-basis"));
|
|
2191
|
+
}
|
|
2192
|
+
const i = t.map((s) => {
|
|
2193
|
+
const n = s.getBoundingClientRect();
|
|
2194
|
+
return e ? n.height : n.width;
|
|
2195
|
+
});
|
|
2196
|
+
this.#d = i, this.#a = t, this.#v(), this.#o();
|
|
2197
|
+
}
|
|
2198
|
+
/** Apply pixel sizes as flex values. */
|
|
2199
|
+
#o() {
|
|
2200
|
+
const t = this.#c();
|
|
2201
|
+
if (!(this.#d.reduce((i, s) => i + s, 0) <= 0))
|
|
2202
|
+
for (let i = 0; i < t.length; i++) {
|
|
2203
|
+
if (t[i].hasAttribute("minimized")) continue;
|
|
2204
|
+
const s = this.#d[i] ?? 0;
|
|
2205
|
+
t[i].style.flex = `${s} 1 0px`;
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
/** Save current proportions for proportional container resize. */
|
|
2209
|
+
#v() {
|
|
2210
|
+
const t = this.#d.reduce((e, i) => e + i, 0);
|
|
2211
|
+
if (t <= 0) {
|
|
2212
|
+
this.#u = null;
|
|
2213
|
+
return;
|
|
2214
|
+
}
|
|
2215
|
+
this.#u = this.#d.map((e) => e / t);
|
|
2216
|
+
}
|
|
2217
|
+
// ── Cascade resize algorithm ──
|
|
2218
|
+
/**
|
|
2219
|
+
* Resize panes at the given sash index by delta pixels.
|
|
2220
|
+
* Delta cascades through "before" panes (index -> 0) and
|
|
2221
|
+
* "after" panes (index+1 -> end), respecting min/max constraints
|
|
2222
|
+
* and priority ordering.
|
|
2223
|
+
*/
|
|
2224
|
+
#f(t, e, i) {
|
|
2225
|
+
const s = this.#a, n = [...i], a = [];
|
|
2226
|
+
for (let u = t; u >= 0; u--) a.push(u);
|
|
2227
|
+
const r = [];
|
|
2228
|
+
for (let u = t + 1; u < s.length; u++) r.push(u);
|
|
2229
|
+
const o = (u) => {
|
|
2230
|
+
const g = [], E = [], S = [];
|
|
2231
|
+
for (const C of u) {
|
|
2232
|
+
const I = this.#E(s[C]);
|
|
2233
|
+
I === y.High ? g.push(C) : I === y.Low ? S.push(C) : E.push(C);
|
|
2234
|
+
}
|
|
2235
|
+
return [...g, ...E, ...S];
|
|
2236
|
+
}, d = o(a), b = o(r);
|
|
2237
|
+
let f = 0, m = 0;
|
|
2238
|
+
for (const u of d)
|
|
2239
|
+
f += this.#b(s[u]) - i[u], m += this.#p(s[u]) - i[u];
|
|
2240
|
+
let c = 0, p = 0;
|
|
2241
|
+
for (const u of b)
|
|
2242
|
+
c += i[u] - this.#p(s[u]), p += i[u] - this.#b(s[u]);
|
|
2243
|
+
const v = Math.max(f, c), k = Math.min(m, p);
|
|
2244
|
+
e = w(e, v, k);
|
|
2245
|
+
let x = e;
|
|
2246
|
+
for (const u of d) {
|
|
2247
|
+
const g = w(
|
|
2248
|
+
i[u] + x,
|
|
2249
|
+
this.#b(s[u]),
|
|
2250
|
+
this.#p(s[u])
|
|
2251
|
+
), E = g - i[u];
|
|
2252
|
+
x -= E, n[u] = g;
|
|
2253
|
+
}
|
|
2254
|
+
x = e;
|
|
2255
|
+
for (const u of b) {
|
|
2256
|
+
const g = w(
|
|
2257
|
+
i[u] - x,
|
|
2258
|
+
this.#b(s[u]),
|
|
2259
|
+
this.#p(s[u])
|
|
2260
|
+
), E = i[u] - g;
|
|
2261
|
+
x -= E, n[u] = g;
|
|
2262
|
+
}
|
|
2263
|
+
return n;
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* After any size change, distribute leftover space (positive or negative)
|
|
2267
|
+
* across all panes in priority order.
|
|
2268
|
+
*/
|
|
2269
|
+
#y(t) {
|
|
2270
|
+
const e = this.#a, i = [...t];
|
|
2271
|
+
let n = this.#x() - i.reduce((b, f) => b + f, 0);
|
|
2272
|
+
if (Math.abs(n) < 0.5) return i;
|
|
2273
|
+
const a = [], r = [], o = [];
|
|
2274
|
+
for (let b = 0; b < e.length; b++) {
|
|
2275
|
+
const f = this.#E(e[b]);
|
|
2276
|
+
f === y.High ? a.push(b) : f === y.Low ? o.push(b) : r.push(b);
|
|
2277
|
+
}
|
|
2278
|
+
const d = [...a, ...r, ...o];
|
|
2279
|
+
for (let b = 0; Math.abs(n) >= 0.5 && b < d.length; b++) {
|
|
2280
|
+
const f = d[b], m = e[f], c = w(
|
|
2281
|
+
i[f] + n,
|
|
2282
|
+
this.#b(m),
|
|
2283
|
+
this.#p(m)
|
|
2284
|
+
), p = c - i[f];
|
|
2285
|
+
n -= p, i[f] = c;
|
|
2286
|
+
}
|
|
2287
|
+
return i;
|
|
2288
|
+
}
|
|
2289
|
+
#x() {
|
|
2290
|
+
const t = this.getBoundingClientRect();
|
|
2291
|
+
return this.isVertical ? t.height : t.width;
|
|
2292
|
+
}
|
|
2293
|
+
// ── Proportional container resize ──
|
|
2294
|
+
#m = 0;
|
|
2295
|
+
#C = () => {
|
|
2296
|
+
if (this.#s >= 0) return;
|
|
2297
|
+
const t = this.#x();
|
|
2298
|
+
if (t <= 0) return;
|
|
2299
|
+
if (this.#m === 0) {
|
|
2300
|
+
this.#m = t;
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
if (Math.abs(t - this.#m) < 1) return;
|
|
2304
|
+
this.#m = t;
|
|
2305
|
+
const e = this.#c();
|
|
2306
|
+
if (e.length !== 0) {
|
|
2307
|
+
if (this.#a = e, this.#u && this.#u.length === e.length) {
|
|
2308
|
+
const i = this.#u.map(
|
|
2309
|
+
(s, n) => w(
|
|
2310
|
+
Math.round(s * t),
|
|
2311
|
+
this.#b(e[n]),
|
|
2312
|
+
this.#p(e[n])
|
|
2313
|
+
)
|
|
2314
|
+
);
|
|
2315
|
+
this.#d = this.#y(i);
|
|
2316
|
+
} else
|
|
2317
|
+
this.#d = this.#y(this.#d);
|
|
2318
|
+
this.#o();
|
|
2319
|
+
}
|
|
2320
|
+
};
|
|
2321
|
+
// ── Boundary hit-testing ──
|
|
2322
|
+
#w(t, e) {
|
|
2323
|
+
const i = this.#c();
|
|
2324
|
+
if (i.length < 2) return -1;
|
|
2325
|
+
const s = this.isVertical, n = 8;
|
|
2326
|
+
for (let a = 0; a < i.length - 1; a++) {
|
|
2327
|
+
const r = i[a].getBoundingClientRect(), o = s ? r.bottom : r.right;
|
|
2328
|
+
if (Math.abs((s ? e : t) - o) <= n) return a;
|
|
2329
|
+
}
|
|
2330
|
+
return -1;
|
|
2331
|
+
}
|
|
2332
|
+
// ── Hover ──
|
|
2333
|
+
#L = (t) => {
|
|
2334
|
+
if (this.#s >= 0) return;
|
|
2335
|
+
const e = this.#w(t.clientX, t.clientY), i = this.#c();
|
|
2336
|
+
if (e >= 0) {
|
|
2337
|
+
const s = i[e];
|
|
2338
|
+
if (this.#i !== s) {
|
|
2339
|
+
this.#k();
|
|
2340
|
+
const n = this.isVertical ? "bottom" : "right";
|
|
2341
|
+
s.setAttribute("data-panes-edge-near", n), this.#i = s;
|
|
2342
|
+
}
|
|
2343
|
+
} else
|
|
2344
|
+
this.#k();
|
|
2345
|
+
};
|
|
2346
|
+
#A = () => {
|
|
2347
|
+
this.#s >= 0 || this.#k();
|
|
2348
|
+
};
|
|
2349
|
+
#k() {
|
|
2350
|
+
this.#i && (this.#i.removeAttribute("data-panes-edge-near"), this.#i = null);
|
|
2351
|
+
}
|
|
2352
|
+
// ── Drag resize ──
|
|
2353
|
+
#T = (t) => {
|
|
2354
|
+
if (t.button !== 0) return;
|
|
2355
|
+
const e = this.#w(t.clientX, t.clientY);
|
|
2356
|
+
if (e < 0) return;
|
|
2357
|
+
t.preventDefault(), t.stopPropagation(), this.#k(), this.#s = e, this.#a = this.#c(), this.#r = t.clientX, this.#l = t.clientY;
|
|
2358
|
+
const i = this.isVertical;
|
|
2359
|
+
this.#n = this.#a.map((n) => {
|
|
2360
|
+
const a = n.getBoundingClientRect();
|
|
2361
|
+
return i ? a.height : a.width;
|
|
2362
|
+
}), this.#d = [...this.#n], this.setAttribute("data-panes-resizing", "");
|
|
2363
|
+
const s = i ? "bottom" : "right";
|
|
2364
|
+
this.#a[e].setAttribute("data-panes-edge-active", s), this.#h = t.pointerId, this.setPointerCapture(t.pointerId), document.addEventListener("pointermove", this.#P), document.addEventListener("pointerup", this.#M), document.addEventListener("pointercancel", this.#I), document.addEventListener("keydown", this.#N);
|
|
2365
|
+
};
|
|
2366
|
+
#P = (t) => {
|
|
2367
|
+
if (this.#s < 0) return;
|
|
2368
|
+
const e = this.isVertical ? t.clientY - this.#l : t.clientX - this.#r;
|
|
2369
|
+
this.#d = this.#f(this.#s, e, this.#n), this.#o();
|
|
2370
|
+
};
|
|
2371
|
+
#M = () => {
|
|
2372
|
+
if (this.#s < 0) return;
|
|
2373
|
+
const t = this.isVertical;
|
|
2374
|
+
this.#d = this.#a.map((e) => {
|
|
2375
|
+
const i = e.getBoundingClientRect();
|
|
2376
|
+
return t ? i.height : i.width;
|
|
2377
|
+
}), this.#v(), this.dispatchEvent(new CustomEvent("aui:panes-resize", {
|
|
2378
|
+
bubbles: !0,
|
|
2379
|
+
composed: !0,
|
|
2380
|
+
detail: {
|
|
2381
|
+
sizes: this.#d,
|
|
2382
|
+
index: this.#s
|
|
2383
|
+
}
|
|
2384
|
+
})), this.#q();
|
|
2385
|
+
};
|
|
2386
|
+
#I = () => {
|
|
2387
|
+
this.#s < 0 || (this.#d = [...this.#n], this.#o(), this.#q());
|
|
2388
|
+
};
|
|
2389
|
+
#N = (t) => {
|
|
2390
|
+
t.key === "Escape" && this.#s >= 0 && (t.preventDefault(), this.#I());
|
|
2391
|
+
};
|
|
2392
|
+
#q() {
|
|
2393
|
+
if (this.#s >= 0 && this.#a[this.#s]?.removeAttribute("data-panes-edge-active"), this.#h >= 0) {
|
|
2394
|
+
try {
|
|
2395
|
+
this.releasePointerCapture(this.#h);
|
|
2396
|
+
} catch {
|
|
2397
|
+
}
|
|
2398
|
+
this.#h = -1;
|
|
2399
|
+
}
|
|
2400
|
+
this.#s = -1, this.#n = [], this.removeAttribute("data-panes-resizing"), document.removeEventListener("pointermove", this.#P), document.removeEventListener("pointerup", this.#M), document.removeEventListener("pointercancel", this.#I), document.removeEventListener("keydown", this.#N);
|
|
2401
|
+
}
|
|
2402
|
+
// ── Child mutation observer (debounced) ──
|
|
2403
|
+
#R = 0;
|
|
2404
|
+
#z = (t) => {
|
|
2405
|
+
let e = !1;
|
|
2406
|
+
for (const i of t) {
|
|
2407
|
+
const s = i.target;
|
|
2408
|
+
if (i.type === "childList" && s === this) {
|
|
2409
|
+
e = !0;
|
|
2410
|
+
break;
|
|
2411
|
+
}
|
|
2412
|
+
if (i.type === "attributes" && s.parentElement === this) {
|
|
2413
|
+
e = !0;
|
|
2414
|
+
break;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
e && (this.#R || (this.#R = requestAnimationFrame(() => {
|
|
2418
|
+
this.#R = 0, this.#g();
|
|
2419
|
+
})));
|
|
2420
|
+
};
|
|
2421
|
+
}
|
|
2422
|
+
const R = document.createElement("template");
|
|
2423
|
+
R.innerHTML = `
|
|
2424
|
+
<aui-header data-pane-header>
|
|
2425
|
+
<aui-pane-label></aui-pane-label>
|
|
2426
|
+
</aui-header>
|
|
2427
|
+
`;
|
|
2428
|
+
const z = document.createElement("template");
|
|
2429
|
+
z.innerHTML = "<aui-button ghost></aui-button>";
|
|
2430
|
+
class Rt extends h {
|
|
2431
|
+
static attributes = {
|
|
2432
|
+
label: { type: "string", default: "" },
|
|
2433
|
+
icon: { type: "string", default: "" },
|
|
2434
|
+
closeable: { type: "boolean", default: !1 },
|
|
2435
|
+
minimizable: { type: "boolean", default: !1 },
|
|
2436
|
+
minimized: { type: "boolean", default: !1 },
|
|
2437
|
+
"fixed-size": { type: "string", default: "" },
|
|
2438
|
+
basis: { type: "string", default: "" },
|
|
2439
|
+
priority: { type: "enum", values: ["high", "normal", "low"], default: "normal" },
|
|
2440
|
+
tabs: { type: "boolean", default: !1 },
|
|
2441
|
+
collapse: { type: "string", default: "" }
|
|
2442
|
+
};
|
|
2443
|
+
// Stamped header references
|
|
2444
|
+
#t = null;
|
|
2445
|
+
#e = null;
|
|
2446
|
+
#i = null;
|
|
2447
|
+
#s = null;
|
|
2448
|
+
#n = null;
|
|
2449
|
+
// Tabs
|
|
2450
|
+
#a = null;
|
|
2451
|
+
// Collapse state (internal)
|
|
2452
|
+
#r = !1;
|
|
2453
|
+
activate() {
|
|
2454
|
+
this.#d(), this.#h(), this.#l(), this.addEffect(() => {
|
|
2455
|
+
const t = this.label;
|
|
2456
|
+
this.#e && (this.#e.textContent = t), t && !this.#t ? this.#d() : !t && this.#t && this.#u();
|
|
2457
|
+
}), this.addEffect(() => {
|
|
2458
|
+
const t = this.minimized;
|
|
2459
|
+
if (this.#s) {
|
|
2460
|
+
const e = this.#s.querySelector("aui-icon");
|
|
2461
|
+
e && e.setAttribute("icon", t ? "caret-up" : "minus");
|
|
2462
|
+
}
|
|
2463
|
+
}), this.addEffect(() => {
|
|
2464
|
+
this["fixed-size"], this.#l();
|
|
2465
|
+
}), this.addEffect(() => {
|
|
2466
|
+
const t = this.basis;
|
|
2467
|
+
t ? this.style.flexBasis = t : this.style.removeProperty("flex-basis");
|
|
2468
|
+
}), this.addEffect(() => {
|
|
2469
|
+
const t = this.icon;
|
|
2470
|
+
this.#b(t || null);
|
|
2471
|
+
}), this.addEffect(() => {
|
|
2472
|
+
this.#p(this.closeable);
|
|
2473
|
+
}), this.addEffect(() => {
|
|
2474
|
+
this.#E(this.minimizable);
|
|
2475
|
+
}), this.addEffect(() => {
|
|
2476
|
+
this.tabs && !this.#a ? this.#g() : !this.tabs && this.#a && this.#o();
|
|
2477
|
+
}), this.addEffect(() => {
|
|
2478
|
+
this.collapse;
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
// ── Public methods ──
|
|
2482
|
+
/** Collapse the pane to a thin strip. */
|
|
2483
|
+
collapsePane() {
|
|
2484
|
+
this.#r = !0, this.setAttribute("collapsed", ""), this.dispatchEvent(new CustomEvent("aui:pane-collapse", {
|
|
2485
|
+
bubbles: !0,
|
|
2486
|
+
composed: !0,
|
|
2487
|
+
detail: { pane: this }
|
|
2488
|
+
}));
|
|
2489
|
+
}
|
|
2490
|
+
/** Restore from collapsed state. */
|
|
2491
|
+
expand() {
|
|
2492
|
+
this.#r = !1, this.removeAttribute("collapsed"), this.dispatchEvent(new CustomEvent("aui:pane-expand", {
|
|
2493
|
+
bubbles: !0,
|
|
2494
|
+
composed: !0,
|
|
2495
|
+
detail: { pane: this }
|
|
2496
|
+
}));
|
|
2497
|
+
}
|
|
2498
|
+
/** Close the pane. Dispatches cancelable `aui:pane-close`. */
|
|
2499
|
+
close() {
|
|
2500
|
+
const t = new CustomEvent("aui:pane-close", {
|
|
2501
|
+
bubbles: !0,
|
|
2502
|
+
composed: !0,
|
|
2503
|
+
cancelable: !0,
|
|
2504
|
+
detail: { pane: this }
|
|
2505
|
+
});
|
|
2506
|
+
this.dispatchEvent(t) && (this.hidden = !0);
|
|
2507
|
+
}
|
|
2508
|
+
/** Minimize the pane to header-only. */
|
|
2509
|
+
minimize() {
|
|
2510
|
+
this.minimized = !0, this.dispatchEvent(new CustomEvent("aui:pane-minimize", {
|
|
2511
|
+
bubbles: !0,
|
|
2512
|
+
composed: !0,
|
|
2513
|
+
detail: { pane: this }
|
|
2514
|
+
}));
|
|
2515
|
+
}
|
|
2516
|
+
/** Restore from minimized state. */
|
|
2517
|
+
restore() {
|
|
2518
|
+
this.minimized = !1, this.dispatchEvent(new CustomEvent("aui:pane-restore", {
|
|
2519
|
+
bubbles: !0,
|
|
2520
|
+
composed: !0,
|
|
2521
|
+
detail: { pane: this }
|
|
2522
|
+
}));
|
|
2523
|
+
}
|
|
2524
|
+
// ── Size sync ──
|
|
2525
|
+
#l() {
|
|
2526
|
+
const t = this["fixed-size"];
|
|
2527
|
+
t && t !== "auto" ? this.style.flex = `0 1 ${t}` : this.style.removeProperty("flex");
|
|
2528
|
+
}
|
|
2529
|
+
// ── Content wrapping ──
|
|
2530
|
+
/** Wrap non-structural children in <aui-content>. */
|
|
2531
|
+
#h() {
|
|
2532
|
+
if (this.querySelector(":scope > aui-content")) return;
|
|
2533
|
+
const t = document.createElement("aui-content"), e = [];
|
|
2534
|
+
for (const i of Array.from(this.childNodes))
|
|
2535
|
+
i instanceof HTMLElement && (i.tagName === "AUI-HEADER" || i.hasAttribute("data-pane-header") || i.hasAttribute("slot") || i.tagName === "AUI-CANVAS") || e.push(i);
|
|
2536
|
+
if (e.length !== 0) {
|
|
2537
|
+
for (const i of e) t.appendChild(i);
|
|
2538
|
+
this.appendChild(t);
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
// ── Header stamping ──
|
|
2542
|
+
#d() {
|
|
2543
|
+
if (this.querySelector(":scope > aui-header")) return;
|
|
2544
|
+
const t = this.label;
|
|
2545
|
+
if (!t) return;
|
|
2546
|
+
const i = R.content.cloneNode(!0).firstElementChild, s = i.querySelector("aui-pane-label");
|
|
2547
|
+
s.textContent = t, this.#e = s;
|
|
2548
|
+
const n = this.icon;
|
|
2549
|
+
if (n) {
|
|
2550
|
+
const a = document.createElement("aui-icon");
|
|
2551
|
+
a.setAttribute("icon", n), i.insertBefore(a, s), this.#i = a;
|
|
2552
|
+
}
|
|
2553
|
+
this.minimizable && (this.#s = this.#c(
|
|
2554
|
+
this.minimized ? "caret-up" : "minus",
|
|
2555
|
+
() => {
|
|
2556
|
+
this.minimized ? this.restore() : this.minimize();
|
|
2557
|
+
}
|
|
2558
|
+
), i.appendChild(this.#s)), this.closeable && (this.#n = this.#c("x", () => this.close()), i.appendChild(this.#n)), this.prepend(i), this.#t = i;
|
|
2559
|
+
}
|
|
2560
|
+
#u() {
|
|
2561
|
+
this.#t && (this.#t.remove(), this.#t = null, this.#e = null, this.#i = null, this.#s = null, this.#n = null);
|
|
2562
|
+
}
|
|
2563
|
+
#c(t, e) {
|
|
2564
|
+
const i = z.content.firstElementChild.cloneNode(!0);
|
|
2565
|
+
return i.setAttribute("icon", t), i.setAttribute("slot", "trailing"), i.addEventListener("click", e), i;
|
|
2566
|
+
}
|
|
2567
|
+
#b(t) {
|
|
2568
|
+
if (this.#t)
|
|
2569
|
+
if (t && this.#i)
|
|
2570
|
+
this.#i.setAttribute("icon", t);
|
|
2571
|
+
else if (t && !this.#i) {
|
|
2572
|
+
const e = document.createElement("aui-icon");
|
|
2573
|
+
e.setAttribute("icon", t), this.#t.prepend(e), this.#i = e;
|
|
2574
|
+
} else !t && this.#i && (this.#i.remove(), this.#i = null);
|
|
2575
|
+
}
|
|
2576
|
+
#p(t) {
|
|
2577
|
+
this.#t && (t && !this.#n ? (this.#n = this.#c("x", () => this.close()), this.#t.appendChild(this.#n)) : !t && this.#n && (this.#n.remove(), this.#n = null));
|
|
2578
|
+
}
|
|
2579
|
+
#E(t) {
|
|
2580
|
+
this.#t && (t && !this.#s ? (this.#s = this.#c(
|
|
2581
|
+
this.minimized ? "caret-up" : "minus",
|
|
2582
|
+
() => {
|
|
2583
|
+
this.minimized ? this.restore() : this.minimize();
|
|
2584
|
+
}
|
|
2585
|
+
), this.#n ? this.#t.insertBefore(this.#s, this.#n) : this.#t.appendChild(this.#s)) : !t && this.#s && (this.#s.remove(), this.#s = null));
|
|
2586
|
+
}
|
|
2587
|
+
// ── Tabs ──
|
|
2588
|
+
#g() {
|
|
2589
|
+
if (this.#a) return;
|
|
2590
|
+
this.#a = document.createElement("aui-tabs");
|
|
2591
|
+
for (const e of this.children) {
|
|
2592
|
+
if (!(e instanceof HTMLElement)) continue;
|
|
2593
|
+
const i = e.getAttribute("data-tab-id"), s = e.getAttribute("data-tab-label");
|
|
2594
|
+
if (!i || !s) continue;
|
|
2595
|
+
const n = document.createElement("aui-tab");
|
|
2596
|
+
n.setAttribute("label", s), n.setAttribute("data-for", i), this.#a.appendChild(n);
|
|
2597
|
+
}
|
|
2598
|
+
this.#a.addEventListener("change", (e) => {
|
|
2599
|
+
const s = e.detail.tab?.getAttribute("data-for");
|
|
2600
|
+
s && this.#v(s);
|
|
2601
|
+
});
|
|
2602
|
+
const t = this.querySelector(":scope > aui-header, :scope > [data-pane-header]");
|
|
2603
|
+
t ? t.after(this.#a) : this.prepend(this.#a), queueMicrotask(() => {
|
|
2604
|
+
const i = this.#a?.querySelector("aui-tab")?.getAttribute("data-for");
|
|
2605
|
+
i && this.#v(i);
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
#o() {
|
|
2609
|
+
this.#a?.remove(), this.#a = null;
|
|
2610
|
+
for (const t of this.children)
|
|
2611
|
+
t instanceof HTMLElement && t.hasAttribute("data-tab-id") && t.removeAttribute("hidden");
|
|
2612
|
+
}
|
|
2613
|
+
#v(t) {
|
|
2614
|
+
for (const e of this.children) {
|
|
2615
|
+
if (!(e instanceof HTMLElement)) continue;
|
|
2616
|
+
const i = e.getAttribute("data-tab-id");
|
|
2617
|
+
i && (i === t ? e.removeAttribute("hidden") : e.setAttribute("hidden", ""));
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
dispose() {
|
|
2621
|
+
this.#u(), this.#o();
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
class zt extends h {
|
|
2625
|
+
static attributes = {
|
|
2626
|
+
cols: { type: "string", default: "" },
|
|
2627
|
+
src: { type: "string", default: "" },
|
|
2628
|
+
selectable: { type: "boolean", default: !1 },
|
|
2629
|
+
sortable: { type: "boolean", default: !1 },
|
|
2630
|
+
searchable: { type: "boolean", default: !1 },
|
|
2631
|
+
paginate: { type: "string", default: "0" }
|
|
2632
|
+
};
|
|
2633
|
+
#t = [];
|
|
2634
|
+
#e = [];
|
|
2635
|
+
#i = "";
|
|
2636
|
+
#s = "none";
|
|
2637
|
+
#n = "";
|
|
2638
|
+
#a = 1;
|
|
2639
|
+
#r = /* @__PURE__ */ new Set();
|
|
2640
|
+
#l = !1;
|
|
2641
|
+
// Stable DOM refs (created once, never destroyed)
|
|
2642
|
+
#h = null;
|
|
2643
|
+
#d = null;
|
|
2644
|
+
#u = null;
|
|
2645
|
+
#c = null;
|
|
2646
|
+
#b = null;
|
|
2647
|
+
get selectedIds() {
|
|
2648
|
+
return new Set(this.#r);
|
|
2649
|
+
}
|
|
2650
|
+
get dataMode() {
|
|
2651
|
+
return this.#l;
|
|
2652
|
+
}
|
|
2653
|
+
setData(t) {
|
|
2654
|
+
this.#e = [...t], this.#a = 1, this.#r.clear(), this.#A();
|
|
2655
|
+
}
|
|
2656
|
+
activate() {
|
|
2657
|
+
if (this.setAttribute("role", "table"), this.#t = this.#p(), this.#l = this.#t.length > 0, !this.#l) {
|
|
2658
|
+
this.addEffect(() => {
|
|
2659
|
+
this.cols && (this.style.gridTemplateColumns = this.cols);
|
|
2660
|
+
});
|
|
2661
|
+
return;
|
|
2662
|
+
}
|
|
2663
|
+
this.#E(), this.#o(), this.#A(), this.addEventListener("click", this.#v), this.addEffect(() => {
|
|
2664
|
+
this.src && this.#g(this.src);
|
|
2665
|
+
});
|
|
2666
|
+
}
|
|
2667
|
+
dispose() {
|
|
2668
|
+
this.removeEventListener("click", this.#v), this.#b && clearTimeout(this.#b);
|
|
2669
|
+
}
|
|
2670
|
+
// ── Column parsing ─────────────────────────────────────────
|
|
2671
|
+
#p() {
|
|
2672
|
+
return Array.from(this.querySelectorAll("aui-table-column")).map((t) => ({
|
|
2673
|
+
key: t.getAttribute("key") || "",
|
|
2674
|
+
label: t.getAttribute("label") || t.getAttribute("key") || "",
|
|
2675
|
+
sortable: t.hasAttribute("sortable"),
|
|
2676
|
+
filterable: t.hasAttribute("filterable"),
|
|
2677
|
+
width: t.getAttribute("width") || "1fr",
|
|
2678
|
+
type: t.getAttribute("type") || "string",
|
|
2679
|
+
align: t.getAttribute("align") || "start"
|
|
2680
|
+
})).filter((t) => t.key);
|
|
2681
|
+
}
|
|
2682
|
+
// ── Data loading ───────────────────────────────────────────
|
|
2683
|
+
#E() {
|
|
2684
|
+
const t = this.querySelector('script[type="application/json"]');
|
|
2685
|
+
if (t?.textContent) {
|
|
2686
|
+
try {
|
|
2687
|
+
const e = JSON.parse(t.textContent);
|
|
2688
|
+
Array.isArray(e) && (this.#e = e);
|
|
2689
|
+
} catch {
|
|
2690
|
+
}
|
|
2691
|
+
return;
|
|
2692
|
+
}
|
|
2693
|
+
this.src && this.#g(this.src);
|
|
2694
|
+
}
|
|
2695
|
+
async #g(t) {
|
|
2696
|
+
try {
|
|
2697
|
+
const e = await fetch(t);
|
|
2698
|
+
if (!e.ok) return;
|
|
2699
|
+
const i = await e.json();
|
|
2700
|
+
this.#e = Array.isArray(i) ? i : i?.data ?? [], this.#a = 1, this.#r.clear(), this.#A();
|
|
2701
|
+
} catch {
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
// ── Structure (built once) ─────────────────────────────────
|
|
2705
|
+
#o() {
|
|
2706
|
+
for (const e of [...this.children]) {
|
|
2707
|
+
const i = e.tagName?.toLowerCase();
|
|
2708
|
+
i !== "aui-table-column" && i !== "script" && e.remove();
|
|
2709
|
+
}
|
|
2710
|
+
const t = this.#t.map((e) => e.width);
|
|
2711
|
+
if (this.selectable && t.unshift("2.5rem"), this.style.gridTemplateColumns = t.join(" "), this.searchable) {
|
|
2712
|
+
const e = document.createElement("div");
|
|
2713
|
+
e.setAttribute("data-table-toolbar", "");
|
|
2714
|
+
const i = document.createElement("aui-input");
|
|
2715
|
+
i.setAttribute("placeholder", "Search..."), i.setAttribute("type", "search"), i.setAttribute("width", "full"), e.appendChild(i), this.#h = e, this.appendChild(e);
|
|
2716
|
+
const s = () => {
|
|
2717
|
+
this.#b && clearTimeout(this.#b), this.#b = setTimeout(() => {
|
|
2718
|
+
this.#n = (i.value || "").trim(), this.#a = 1, this.#A();
|
|
2719
|
+
}, 200);
|
|
2720
|
+
};
|
|
2721
|
+
i.addEventListener("input", s);
|
|
2722
|
+
}
|
|
2723
|
+
this.#d = document.createElement("aui-table-head"), this.appendChild(this.#d), this.#u = document.createElement("aui-table-body"), this.appendChild(this.#u), this.#C > 0 && (this.#c = document.createElement("div"), this.#c.setAttribute("data-table-footer", ""), this.appendChild(this.#c));
|
|
2724
|
+
}
|
|
2725
|
+
// ── Event delegation ───────────────────────────────────────
|
|
2726
|
+
#v = (t) => {
|
|
2727
|
+
const e = t.target, i = e.closest("aui-table-header[data-table-sortable]");
|
|
2728
|
+
if (i) {
|
|
2729
|
+
const a = i.dataset.key;
|
|
2730
|
+
if (a) {
|
|
2731
|
+
this.#f(a);
|
|
2732
|
+
return;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
const s = e.closest("aui-checkbox[data-table-check]");
|
|
2736
|
+
if (s) {
|
|
2737
|
+
const a = s.dataset.rowId;
|
|
2738
|
+
a === "__all__" ? this.#m() : a && this.#x(a);
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
const n = e.closest("[data-table-page]");
|
|
2742
|
+
if (n) {
|
|
2743
|
+
const a = parseInt(n.dataset.tablePage, 10);
|
|
2744
|
+
!isNaN(a) && a !== this.#a && (this.#a = a, this.dispatchEvent(new CustomEvent("aui:page-change", { bubbles: !0, detail: { page: a } })), this.#A());
|
|
2745
|
+
}
|
|
2746
|
+
};
|
|
2747
|
+
// ── Sort ───────────────────────────────────────────────────
|
|
2748
|
+
#f(t) {
|
|
2749
|
+
if (this.#i === t) {
|
|
2750
|
+
const e = ["asc", "desc", "none"];
|
|
2751
|
+
this.#s = e[(e.indexOf(this.#s) + 1) % 3], this.#s === "none" && (this.#i = "");
|
|
2752
|
+
} else
|
|
2753
|
+
this.#i = t, this.#s = "asc";
|
|
2754
|
+
this.#a = 1, this.dispatchEvent(new CustomEvent("aui:sort-change", { bubbles: !0, detail: { key: this.#i, dir: this.#s } })), this.#A();
|
|
2755
|
+
}
|
|
2756
|
+
// ── Selection ──────────────────────────────────────────────
|
|
2757
|
+
#y(t) {
|
|
2758
|
+
return t.id != null ? String(t.id) : JSON.stringify(t);
|
|
2759
|
+
}
|
|
2760
|
+
#x(t) {
|
|
2761
|
+
this.#r.has(t) ? this.#r.delete(t) : this.#r.add(t), this.dispatchEvent(new CustomEvent("aui:selection-change", { bubbles: !0, detail: { selectedIds: [...this.#r] } })), this.#A();
|
|
2762
|
+
}
|
|
2763
|
+
#m() {
|
|
2764
|
+
const t = this.#L(this.#w()), e = t.length > 0 && t.every((i) => this.#r.has(this.#y(i)));
|
|
2765
|
+
for (const i of t) {
|
|
2766
|
+
const s = this.#y(i);
|
|
2767
|
+
e ? this.#r.delete(s) : this.#r.add(s);
|
|
2768
|
+
}
|
|
2769
|
+
this.dispatchEvent(new CustomEvent("aui:selection-change", { bubbles: !0, detail: { selectedIds: [...this.#r] } })), this.#A();
|
|
2770
|
+
}
|
|
2771
|
+
// ── Derived data ───────────────────────────────────────────
|
|
2772
|
+
get #C() {
|
|
2773
|
+
return parseInt(this.paginate, 10) || 0;
|
|
2774
|
+
}
|
|
2775
|
+
#w() {
|
|
2776
|
+
let t = [...this.#e];
|
|
2777
|
+
if (this.#n) {
|
|
2778
|
+
const e = this.#n.toLowerCase(), i = this.#t.map((s) => s.key);
|
|
2779
|
+
t = t.filter((s) => i.some((n) => {
|
|
2780
|
+
const a = s[n];
|
|
2781
|
+
return a != null && String(a).toLowerCase().includes(e);
|
|
2782
|
+
}));
|
|
2783
|
+
}
|
|
2784
|
+
if (this.#i && this.#s !== "none") {
|
|
2785
|
+
const i = this.#t.find((a) => a.key === this.#i)?.type || "string", s = this.#s === "desc" ? -1 : 1, n = this.#i;
|
|
2786
|
+
t.sort((a, r) => {
|
|
2787
|
+
const o = a[n], d = r[n];
|
|
2788
|
+
return o == null && d == null ? 0 : o == null ? 1 : d == null ? -1 : i === "number" ? (Number(o) - Number(d)) * s : i === "date" ? (new Date(String(o)).getTime() - new Date(String(d)).getTime()) * s : String(o).localeCompare(String(d)) * s;
|
|
2789
|
+
});
|
|
2790
|
+
}
|
|
2791
|
+
return t;
|
|
2792
|
+
}
|
|
2793
|
+
#L(t) {
|
|
2794
|
+
const e = this.#C;
|
|
2795
|
+
if (e <= 0) return t;
|
|
2796
|
+
const i = (this.#a - 1) * e;
|
|
2797
|
+
return t.slice(i, i + e);
|
|
2798
|
+
}
|
|
2799
|
+
// ── Render (updates innerHTML of stable containers) ────────
|
|
2800
|
+
#A() {
|
|
2801
|
+
if (!this.#l || !this.#d || !this.#u) return;
|
|
2802
|
+
const t = this.#w(), e = this.#L(t);
|
|
2803
|
+
this.#d.innerHTML = "";
|
|
2804
|
+
const i = document.createElement("aui-table-row");
|
|
2805
|
+
if (this.selectable) {
|
|
2806
|
+
const s = document.createElement("aui-table-header"), n = e.length > 0 && e.every((r) => this.#r.has(this.#y(r))), a = document.createElement("aui-checkbox");
|
|
2807
|
+
a.setAttribute("data-table-check", ""), a.setAttribute("data-row-id", "__all__"), n && a.setAttribute("checked", ""), s.appendChild(a), i.appendChild(s);
|
|
2808
|
+
}
|
|
2809
|
+
for (const s of this.#t) {
|
|
2810
|
+
const n = document.createElement("aui-table-header"), a = s.sortable || this.sortable;
|
|
2811
|
+
n.textContent = s.label, s.align !== "start" && (n.style.justifyContent = s.align), a && (n.setAttribute("data-table-sortable", ""), n.dataset.key = s.key, n.style.cursor = "pointer", this.#i === s.key && this.#s !== "none" && n.setAttribute("data-table-sort", this.#s)), i.appendChild(n);
|
|
2812
|
+
}
|
|
2813
|
+
this.#d.appendChild(i), this.#u.innerHTML = "";
|
|
2814
|
+
for (const s of e) {
|
|
2815
|
+
const n = document.createElement("aui-table-row"), a = this.#y(s), r = this.#r.has(a);
|
|
2816
|
+
if (r && n.setAttribute("data-table-selected", ""), this.selectable) {
|
|
2817
|
+
const o = document.createElement("aui-table-cell"), d = document.createElement("aui-checkbox");
|
|
2818
|
+
d.setAttribute("data-table-check", ""), d.setAttribute("data-row-id", a), r && d.setAttribute("checked", ""), o.appendChild(d), n.appendChild(o);
|
|
2819
|
+
}
|
|
2820
|
+
for (const o of this.#t) {
|
|
2821
|
+
const d = document.createElement("aui-table-cell"), b = s[o.key];
|
|
2822
|
+
d.textContent = b != null ? String(b) : "", o.align !== "start" && (d.style.justifyContent = o.align), n.appendChild(d);
|
|
2823
|
+
}
|
|
2824
|
+
this.#u.appendChild(n);
|
|
2825
|
+
}
|
|
2826
|
+
if (this.#c) {
|
|
2827
|
+
this.#c.innerHTML = "";
|
|
2828
|
+
const s = this.#C, n = t.length, a = Math.max(1, Math.ceil(n / s));
|
|
2829
|
+
this.#a > a && (this.#a = a);
|
|
2830
|
+
const r = n === 0 ? 0 : (this.#a - 1) * s + 1, o = Math.min(this.#a * s, n), d = document.createElement("span");
|
|
2831
|
+
d.setAttribute("data-table-page-info", ""), d.textContent = `${r}–${o} of ${n}`, this.#c.appendChild(d);
|
|
2832
|
+
const b = document.createElement("span");
|
|
2833
|
+
b.setAttribute("data-table-page-controls", ""), b.style.cssText = "display:inline-flex;gap:0.25rem;align-items:center;";
|
|
2834
|
+
const f = document.createElement("button");
|
|
2835
|
+
f.setAttribute("data-table-page", String(this.#a - 1)), f.disabled = this.#a <= 1, f.textContent = "‹", f.style.cssText = "all:unset;cursor:pointer;padding:0.25rem 0.5rem;border-radius:var(--aui-radius);font-size:var(--aui-font-sm);color:var(--aui-ink-muted);", f.disabled && (f.style.opacity = "0.4"), b.appendChild(f);
|
|
2836
|
+
for (let c = 1; c <= a; c++) {
|
|
2837
|
+
const p = document.createElement("button");
|
|
2838
|
+
p.setAttribute("data-table-page", String(c)), p.textContent = String(c), p.style.cssText = `all:unset;cursor:pointer;padding:0.25rem 0.5rem;border-radius:var(--aui-radius);font-size:var(--aui-font-sm);${c === this.#a ? "background:var(--aui-accent);color:white;" : "color:var(--aui-ink-muted);"}`, b.appendChild(p);
|
|
2839
|
+
}
|
|
2840
|
+
const m = document.createElement("button");
|
|
2841
|
+
m.setAttribute("data-table-page", String(this.#a + 1)), m.disabled = this.#a >= a, m.textContent = "›", m.style.cssText = "all:unset;cursor:pointer;padding:0.25rem 0.5rem;border-radius:var(--aui-radius);font-size:var(--aui-font-sm);color:var(--aui-ink-muted);", m.disabled && (m.style.opacity = "0.4"), b.appendChild(m), this.#c.appendChild(b);
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
class Ot extends h {
|
|
2846
|
+
}
|
|
2847
|
+
class Ht extends h {
|
|
2848
|
+
}
|
|
2849
|
+
class Nt extends h {
|
|
2850
|
+
}
|
|
2851
|
+
class Ut extends h {
|
|
2852
|
+
}
|
|
2853
|
+
class Ft extends h {
|
|
2854
|
+
}
|
|
2855
|
+
class Vt extends h {
|
|
2856
|
+
activate() {
|
|
2857
|
+
this.setAttribute("role", "tree"), this.addEventListener("keydown", this.#e);
|
|
2858
|
+
}
|
|
2859
|
+
dispose() {
|
|
2860
|
+
this.removeEventListener("keydown", this.#e);
|
|
2861
|
+
}
|
|
2862
|
+
get #t() {
|
|
2863
|
+
const t = [];
|
|
2864
|
+
for (const e of this.querySelectorAll("[data-label]")) {
|
|
2865
|
+
const i = e.closest("aui-tree-item");
|
|
2866
|
+
if (!i) continue;
|
|
2867
|
+
const s = i.parentElement?.closest("aui-tree-item");
|
|
2868
|
+
s && !s.hasAttribute("expanded") && i.parentElement?.hasAttribute("data-children") || t.push(e);
|
|
2869
|
+
}
|
|
2870
|
+
return t;
|
|
2871
|
+
}
|
|
2872
|
+
#e = (t) => {
|
|
2873
|
+
if (t.key !== "ArrowDown" && t.key !== "ArrowUp") return;
|
|
2874
|
+
const e = this.#t, i = e.indexOf(document.activeElement);
|
|
2875
|
+
if (i < 0) return;
|
|
2876
|
+
t.preventDefault();
|
|
2877
|
+
let s;
|
|
2878
|
+
t.key === "ArrowDown" ? s = i < e.length - 1 ? i + 1 : 0 : s = i > 0 ? i - 1 : e.length - 1, e[s].focus();
|
|
2879
|
+
};
|
|
2880
|
+
}
|
|
2881
|
+
const j = '<aui-icon name="caret-right" size="sm"></aui-icon>';
|
|
2882
|
+
class Bt extends h {
|
|
2883
|
+
static attributes = {
|
|
2884
|
+
expanded: { type: "boolean", default: !1 },
|
|
2885
|
+
selected: { type: "boolean", default: !1 },
|
|
2886
|
+
disabled: { type: "boolean", default: !1 }
|
|
2887
|
+
};
|
|
2888
|
+
#t = null;
|
|
2889
|
+
#e = null;
|
|
2890
|
+
#i = null;
|
|
2891
|
+
get expandable() {
|
|
2892
|
+
return !!this.querySelector(":scope > [data-children] > aui-tree-item");
|
|
2893
|
+
}
|
|
2894
|
+
activate() {
|
|
2895
|
+
if (this.setAttribute("role", "treeitem"), this.#t = this.querySelector(":scope > [data-label]"), this.#t)
|
|
2896
|
+
this.#i = this.querySelector(":scope > [data-label] > [data-caret]"), this.#e = this.querySelector(":scope > [data-children]");
|
|
2897
|
+
else {
|
|
2898
|
+
this.#t = document.createElement("div"), this.#t.setAttribute("data-label", ""), this.#t.setAttribute("tabindex", "0"), this.#i = document.createElement("span"), this.#i.setAttribute("data-caret", ""), this.#i.innerHTML = j, this.#t.appendChild(this.#i);
|
|
2899
|
+
const i = this.querySelector(":scope > [data-trigger]");
|
|
2900
|
+
if (i)
|
|
2901
|
+
this.#t.appendChild(i);
|
|
2902
|
+
else {
|
|
2903
|
+
const n = [];
|
|
2904
|
+
for (const a of Array.from(this.childNodes))
|
|
2905
|
+
a instanceof HTMLElement && (a.tagName === "AUI-TREE-ITEM" || a.hasAttribute("data-children")) || n.push(a);
|
|
2906
|
+
for (const a of n) this.#t.appendChild(a);
|
|
2907
|
+
}
|
|
2908
|
+
const s = Array.from(this.querySelectorAll(":scope > aui-tree-item"));
|
|
2909
|
+
if (s.length > 0) {
|
|
2910
|
+
this.#e = document.createElement("div"), this.#e.setAttribute("data-children", ""), this.#e.setAttribute("role", "group");
|
|
2911
|
+
for (const n of s)
|
|
2912
|
+
this.#e.appendChild(n);
|
|
2913
|
+
this.prepend(this.#t), this.appendChild(this.#e);
|
|
2914
|
+
} else
|
|
2915
|
+
this.prepend(this.#t);
|
|
2916
|
+
}
|
|
2917
|
+
let t = 0, e = this.parentElement;
|
|
2918
|
+
for (; e && (e.tagName === "AUI-TREE-ITEM" && t++, e.tagName !== "AUI-TREE"); )
|
|
2919
|
+
e = e.parentElement;
|
|
2920
|
+
this.#t?.style.setProperty("--_depth", String(t)), this.addEffect(() => {
|
|
2921
|
+
this.setAttribute("aria-expanded", this.expandable ? String(this.expanded) : ""), this.setAttribute("aria-selected", String(this.selected)), this.setAttribute("aria-disabled", String(this.disabled)), this.#i && (this.#i.style.visibility = this.expandable ? "visible" : "hidden");
|
|
2922
|
+
}), this.#t?.addEventListener("click", this.#s), this.#t?.addEventListener("keydown", this.#n);
|
|
2923
|
+
}
|
|
2924
|
+
dispose() {
|
|
2925
|
+
this.#t?.removeEventListener("click", this.#s), this.#t?.removeEventListener("keydown", this.#n);
|
|
2926
|
+
}
|
|
2927
|
+
#s = () => {
|
|
2928
|
+
this.disabled || (this.expandable && (this.expanded = !this.expanded), this.selected = !0, this.dispatchEvent(new CustomEvent("select", { bubbles: !0, detail: { item: this } })));
|
|
2929
|
+
};
|
|
2930
|
+
#n = (t) => {
|
|
2931
|
+
this.disabled || (t.key === "Enter" || t.key === " " ? (t.preventDefault(), this.#s()) : t.key === "ArrowRight" && this.expandable && !this.expanded ? (t.preventDefault(), this.expanded = !0) : t.key === "ArrowLeft" && this.expanded && (t.preventDefault(), this.expanded = !1));
|
|
2932
|
+
};
|
|
2933
|
+
}
|
|
2934
|
+
class $t extends h {
|
|
2935
|
+
static attributes = {
|
|
2936
|
+
align: { type: "enum", values: ["end"], default: "" },
|
|
2937
|
+
scrollable: { type: "boolean", default: !1 },
|
|
2938
|
+
autoscroll: { type: "boolean", default: !1 }
|
|
2939
|
+
};
|
|
2940
|
+
#t = null;
|
|
2941
|
+
activate() {
|
|
2942
|
+
this.setAttribute("role", "feed"), this.autoscroll && (this.#t = new MutationObserver(() => {
|
|
2943
|
+
this.#e() && this.#i();
|
|
2944
|
+
}), this.#t.observe(this, { childList: !0, subtree: !0 }));
|
|
2945
|
+
}
|
|
2946
|
+
dispose() {
|
|
2947
|
+
this.#t?.disconnect();
|
|
2948
|
+
}
|
|
2949
|
+
#e() {
|
|
2950
|
+
return this.scrollHeight - this.scrollTop - this.clientHeight < 40;
|
|
2951
|
+
}
|
|
2952
|
+
#i() {
|
|
2953
|
+
requestAnimationFrame(() => {
|
|
2954
|
+
this.scrollTop = this.scrollHeight;
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2957
|
+
scrollToEnd() {
|
|
2958
|
+
this.#i();
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
class Kt extends h {
|
|
2962
|
+
activate() {
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
class _t extends h {
|
|
2966
|
+
activate() {
|
|
2967
|
+
this.setAttribute("role", "application");
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
class Gt extends h {
|
|
2971
|
+
activate() {
|
|
2972
|
+
this.setAttribute("role", "main");
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
class Wt extends h {
|
|
2976
|
+
}
|
|
2977
|
+
class Xt extends h {
|
|
2978
|
+
activate() {
|
|
2979
|
+
this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Breadcrumb");
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
const O = document.createElement("template");
|
|
2983
|
+
O.innerHTML = "<aui-sidebar-resize-handle></aui-sidebar-resize-handle>";
|
|
2984
|
+
class jt extends h {
|
|
2985
|
+
static attributes = {
|
|
2986
|
+
width: { type: "string", default: "240" },
|
|
2987
|
+
"min-width": { type: "string", default: "56" },
|
|
2988
|
+
"max-width": { type: "string", default: "480" },
|
|
2989
|
+
collapsed: { type: "boolean", default: !1 },
|
|
2990
|
+
collapsible: { type: "boolean", default: !1 },
|
|
2991
|
+
side: { type: "enum", values: ["left", "right"], default: "left" },
|
|
2992
|
+
disabled: { type: "boolean", default: !1 }
|
|
2993
|
+
};
|
|
2994
|
+
#t = H(240);
|
|
2995
|
+
#e = 56;
|
|
2996
|
+
#i = 480;
|
|
2997
|
+
// Resize state
|
|
2998
|
+
#s = null;
|
|
2999
|
+
#n = !1;
|
|
3000
|
+
#a = 0;
|
|
3001
|
+
#r = 0;
|
|
3002
|
+
#l = -1;
|
|
3003
|
+
activate() {
|
|
3004
|
+
this.setAttribute("role", "complementary");
|
|
3005
|
+
const t = parseInt(this.getAttribute("width") ?? "", 10);
|
|
3006
|
+
t > 0 && (this.#t.value = t), this.#e = parseInt(this.getAttribute("min-width") ?? "", 10) || 56, this.#i = parseInt(this.getAttribute("max-width") ?? "", 10) || 480;
|
|
3007
|
+
const e = O.content.cloneNode(!0);
|
|
3008
|
+
this.#s = e.querySelector("aui-sidebar-resize-handle"), this.appendChild(e), this.#s.addEventListener("pointerdown", this.#h), this.addEffect(() => {
|
|
3009
|
+
const i = this.#t.value;
|
|
3010
|
+
this.style.setProperty("--aui-sidebar-width", `${i}px`);
|
|
3011
|
+
});
|
|
3012
|
+
}
|
|
3013
|
+
// ── Public API ──
|
|
3014
|
+
collapse() {
|
|
3015
|
+
this.setAttribute("collapsed", ""), this.dispatchEvent(new CustomEvent("aui:sidebar-collapse", {
|
|
3016
|
+
bubbles: !0,
|
|
3017
|
+
detail: { collapsed: !0 }
|
|
3018
|
+
}));
|
|
3019
|
+
}
|
|
3020
|
+
expand() {
|
|
3021
|
+
this.removeAttribute("collapsed"), this.dispatchEvent(new CustomEvent("aui:sidebar-collapse", {
|
|
3022
|
+
bubbles: !0,
|
|
3023
|
+
detail: { collapsed: !1 }
|
|
3024
|
+
}));
|
|
3025
|
+
}
|
|
3026
|
+
toggle() {
|
|
3027
|
+
this.collapsed ? this.expand() : this.collapse();
|
|
3028
|
+
}
|
|
3029
|
+
// ── Resize ──
|
|
3030
|
+
#h = (t) => {
|
|
3031
|
+
this.disabled || this.collapsed || (t.preventDefault(), this.#n = !0, this.#a = t.clientX, this.#r = D(() => this.#t.value), this.#l = t.pointerId, this.setAttribute("data-sidebar-resizing", ""), this.#s.setPointerCapture(t.pointerId), document.documentElement.setAttribute("data-sidebar-resizing", ""), this.#s.addEventListener("pointermove", this.#d), this.#s.addEventListener("pointerup", this.#u), this.#s.addEventListener("pointercancel", this.#u));
|
|
3032
|
+
};
|
|
3033
|
+
#d = (t) => {
|
|
3034
|
+
if (!this.#n) return;
|
|
3035
|
+
const i = this.getAttribute("side") === "right" ? this.#a - t.clientX : t.clientX - this.#a, s = Math.round(Math.max(this.#e, Math.min(this.#i, this.#r + i)));
|
|
3036
|
+
this.#t.value = s;
|
|
3037
|
+
};
|
|
3038
|
+
#u = () => {
|
|
3039
|
+
this.#n && (this.#n = !1, this.removeAttribute("data-sidebar-resizing"), document.documentElement.removeAttribute("data-sidebar-resizing"), this.#l >= 0 && this.#s && this.#s.releasePointerCapture(this.#l), this.#l = -1, this.#s?.removeEventListener("pointermove", this.#d), this.#s?.removeEventListener("pointerup", this.#u), this.#s?.removeEventListener("pointercancel", this.#u), this.dispatchEvent(new CustomEvent("aui:sidebar-resize", {
|
|
3040
|
+
bubbles: !0,
|
|
3041
|
+
detail: { width: D(() => this.#t.value) }
|
|
3042
|
+
})));
|
|
3043
|
+
};
|
|
3044
|
+
// ── Cleanup ──
|
|
3045
|
+
dispose() {
|
|
3046
|
+
this.#s?.removeEventListener("pointerdown", this.#h), this.#s?.remove(), this.#s = null, document.documentElement.removeAttribute("data-sidebar-resizing");
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
class Yt extends h {
|
|
3050
|
+
activate() {
|
|
3051
|
+
this.setAttribute("role", "none");
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
class Jt extends h {
|
|
3055
|
+
activate() {
|
|
3056
|
+
this.setAttribute("role", "none");
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
class Qt extends h {
|
|
3060
|
+
activate() {
|
|
3061
|
+
this.setAttribute("role", "none");
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
export {
|
|
3065
|
+
ee as ACTION_REGISTRY,
|
|
3066
|
+
yt as AuiAccordion,
|
|
3067
|
+
Et as AuiAccordionItem,
|
|
3068
|
+
ie as AuiAgentActivity,
|
|
3069
|
+
se as AuiAgentFeed,
|
|
3070
|
+
ne as AuiAgentInput,
|
|
3071
|
+
ae as AuiAgentMessage,
|
|
3072
|
+
re as AuiAgentPanel,
|
|
3073
|
+
le as AuiAgentPrompt,
|
|
3074
|
+
he as AuiAgentSeeds,
|
|
3075
|
+
oe as AuiAgentText,
|
|
3076
|
+
de as AuiAgentThread,
|
|
3077
|
+
_t as AuiAppShell,
|
|
3078
|
+
xt as AuiBreadcrumb,
|
|
3079
|
+
wt as AuiBreadcrumbItem,
|
|
3080
|
+
Q as AuiButton,
|
|
3081
|
+
et as AuiCheckbox,
|
|
3082
|
+
St as AuiCommand,
|
|
3083
|
+
It as AuiCommandEmpty,
|
|
3084
|
+
Dt as AuiCommandGroup,
|
|
3085
|
+
Tt as AuiCommandInput,
|
|
3086
|
+
Pt as AuiCommandItem,
|
|
3087
|
+
Mt as AuiCommandList,
|
|
3088
|
+
rt as AuiContainer,
|
|
3089
|
+
lt as AuiDialog,
|
|
3090
|
+
ht as AuiDrawer,
|
|
3091
|
+
$t as AuiFeed,
|
|
3092
|
+
ut as AuiGripper,
|
|
3093
|
+
ot as AuiIcon,
|
|
3094
|
+
Z as AuiInput,
|
|
3095
|
+
tt as AuiInputOtp,
|
|
3096
|
+
ft as AuiOptgroup,
|
|
3097
|
+
bt as AuiOption,
|
|
3098
|
+
Gt as AuiPage,
|
|
3099
|
+
Xt as AuiPageContext,
|
|
3100
|
+
Wt as AuiPageMain,
|
|
3101
|
+
Lt as AuiPagination,
|
|
3102
|
+
Rt as AuiPane,
|
|
3103
|
+
qt as AuiPanes,
|
|
3104
|
+
st as AuiRadio,
|
|
3105
|
+
nt as AuiRadioGroup,
|
|
3106
|
+
ct as AuiRange,
|
|
3107
|
+
Kt as AuiRoot,
|
|
3108
|
+
Ct as AuiSegment,
|
|
3109
|
+
kt as AuiSegmentedControl,
|
|
3110
|
+
pt as AuiSelect,
|
|
3111
|
+
jt as AuiSidebar,
|
|
3112
|
+
Jt as AuiSidebarContent,
|
|
3113
|
+
Qt as AuiSidebarFooter,
|
|
3114
|
+
Yt as AuiSidebarHeader,
|
|
3115
|
+
it as AuiSwitch,
|
|
3116
|
+
gt as AuiTab,
|
|
3117
|
+
At as AuiTabPanel,
|
|
3118
|
+
zt as AuiTable,
|
|
3119
|
+
Ot as AuiTableBody,
|
|
3120
|
+
Ht as AuiTableCell,
|
|
3121
|
+
Nt as AuiTableHead,
|
|
3122
|
+
Ut as AuiTableHeader,
|
|
3123
|
+
Ft as AuiTableRow,
|
|
3124
|
+
vt as AuiTabs,
|
|
3125
|
+
at as AuiTextarea,
|
|
3126
|
+
mt as AuiToast,
|
|
3127
|
+
dt as AuiTooltip,
|
|
3128
|
+
Vt as AuiTree,
|
|
3129
|
+
Bt as AuiTreeItem,
|
|
3130
|
+
ce as ROLE_DEFAULTS,
|
|
3131
|
+
U as getIcon,
|
|
3132
|
+
pe as registerIcon,
|
|
3133
|
+
me as registerIcons,
|
|
3134
|
+
ue as renderMarkdown,
|
|
3135
|
+
be as sanitizeHtml
|
|
3136
|
+
};
|
|
3137
|
+
//# sourceMappingURL=components.js.map
|