@goblin-systems/goblin-design-system 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -0
- package/dist/headless/dom.d.ts +12 -0
- package/dist/headless/modal.d.ts +57 -0
- package/dist/headless/navigation.d.ts +33 -0
- package/dist/headless/range.d.ts +28 -0
- package/dist/headless/search.d.ts +31 -0
- package/dist/headless/split-pane.d.ts +17 -0
- package/dist/headless/tabs.d.ts +13 -0
- package/dist/headless/toast.d.ts +9 -0
- package/dist/icons/index.d.ts +20 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +716 -0
- package/dist/platform/tauri-window.d.ts +7 -0
- package/dist/style.css +1 -0
- package/dist/waveform/waveform.d.ts +21 -0
- package/package.json +46 -0
- package/skills/SKILL.md +372 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
import * as V from "lucide";
|
|
2
|
+
import { createIcons as F } from "lucide";
|
|
3
|
+
import { getCurrentWindow as G } from "@tauri-apps/api/window";
|
|
4
|
+
const H = Object.fromEntries(
|
|
5
|
+
Object.entries(V).filter(([, e]) => Array.isArray(e))
|
|
6
|
+
);
|
|
7
|
+
function ne() {
|
|
8
|
+
F({ icons: H });
|
|
9
|
+
}
|
|
10
|
+
function oe(e) {
|
|
11
|
+
const t = e.split("-").map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(""), o = H[t];
|
|
12
|
+
if (!o) return null;
|
|
13
|
+
const l = "http://www.w3.org/2000/svg", n = document.createElementNS(l, "svg");
|
|
14
|
+
n.setAttribute("xmlns", l), n.setAttribute("width", "24"), n.setAttribute("height", "24"), n.setAttribute("viewBox", "0 0 24 24"), n.setAttribute("fill", "none"), n.setAttribute("stroke", "currentColor"), n.setAttribute("stroke-width", "2"), n.setAttribute("stroke-linecap", "round"), n.setAttribute("stroke-linejoin", "round");
|
|
15
|
+
for (const [p, d] of o) {
|
|
16
|
+
const g = document.createElementNS(l, p);
|
|
17
|
+
for (const [s, i] of Object.entries(d))
|
|
18
|
+
g.setAttribute(s, String(i));
|
|
19
|
+
n.appendChild(g);
|
|
20
|
+
}
|
|
21
|
+
return n;
|
|
22
|
+
}
|
|
23
|
+
function re(e, t = document) {
|
|
24
|
+
const o = t.getElementById(e);
|
|
25
|
+
if (!o) throw new Error(`Missing required element: #${e}`);
|
|
26
|
+
return o;
|
|
27
|
+
}
|
|
28
|
+
function ae(e, t = document) {
|
|
29
|
+
return t.getElementById(e) ?? null;
|
|
30
|
+
}
|
|
31
|
+
function se(e, t = document) {
|
|
32
|
+
const o = t.querySelector(e);
|
|
33
|
+
if (!o) throw new Error(`Missing required element: ${e}`);
|
|
34
|
+
return o;
|
|
35
|
+
}
|
|
36
|
+
function ie(e, t = document) {
|
|
37
|
+
return t.querySelectorAll(e);
|
|
38
|
+
}
|
|
39
|
+
function le(e, t, o) {
|
|
40
|
+
if (e.innerHTML = "", t.length === 0) {
|
|
41
|
+
const l = document.createElement("option");
|
|
42
|
+
l.value = "", l.textContent = "No options available", e.appendChild(l), e.value = "", e.disabled = !0;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
for (const l of t) {
|
|
46
|
+
const n = document.createElement("option");
|
|
47
|
+
n.value = l, n.textContent = l, e.appendChild(n);
|
|
48
|
+
}
|
|
49
|
+
e.disabled = !1, e.value = t.includes(o) ? o : t[0];
|
|
50
|
+
}
|
|
51
|
+
function ce(e, t) {
|
|
52
|
+
e.classList.toggle("is-disabled", t), e.querySelectorAll(
|
|
53
|
+
"input, select, button"
|
|
54
|
+
).forEach((o) => {
|
|
55
|
+
o.disabled = t;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function de(e = {}) {
|
|
59
|
+
const { root: t = document, onSelect: o } = e, l = Array.from(t.querySelectorAll(".nav-item"));
|
|
60
|
+
let n = null;
|
|
61
|
+
function p(s) {
|
|
62
|
+
n && n !== s && d(n);
|
|
63
|
+
const i = s.querySelector(".nav-trigger"), r = s.querySelector(".nav-dropdown");
|
|
64
|
+
!i || !r || (i.classList.add("is-open"), r.classList.add("is-open"), n = s);
|
|
65
|
+
}
|
|
66
|
+
function d(s) {
|
|
67
|
+
var r;
|
|
68
|
+
(r = s.querySelector(".nav-trigger")) == null || r.classList.remove("is-open");
|
|
69
|
+
const i = s.querySelector(".nav-dropdown");
|
|
70
|
+
i == null || i.classList.remove("is-open"), i == null || i.querySelectorAll(".nav-option--has-sub.is-sub-open").forEach((a) => a.classList.remove("is-sub-open")), n === s && (n = null);
|
|
71
|
+
}
|
|
72
|
+
function g() {
|
|
73
|
+
l.forEach(d);
|
|
74
|
+
}
|
|
75
|
+
return l.forEach((s) => {
|
|
76
|
+
const i = s.querySelector(".nav-trigger"), r = s.querySelector(".nav-dropdown");
|
|
77
|
+
i == null || i.addEventListener("click", (a) => {
|
|
78
|
+
a.stopPropagation(), n === s ? d(s) : p(s);
|
|
79
|
+
}), i == null || i.addEventListener("mouseenter", () => {
|
|
80
|
+
n && n !== s && p(s);
|
|
81
|
+
}), r == null || r.querySelectorAll(".nav-option--has-sub").forEach((a) => {
|
|
82
|
+
a.addEventListener("mouseenter", () => {
|
|
83
|
+
r.querySelectorAll(".nav-option--has-sub.is-sub-open").forEach((f) => {
|
|
84
|
+
f !== a && f.classList.remove("is-sub-open");
|
|
85
|
+
}), a.classList.add("is-sub-open");
|
|
86
|
+
});
|
|
87
|
+
const u = a.querySelector(".nav-submenu");
|
|
88
|
+
u == null || u.addEventListener("mouseleave", (f) => {
|
|
89
|
+
const c = f.relatedTarget;
|
|
90
|
+
a.contains(c) || a.classList.remove("is-sub-open");
|
|
91
|
+
});
|
|
92
|
+
}), r == null || r.querySelectorAll(".nav-option:not(.nav-option--has-sub)").forEach((a) => {
|
|
93
|
+
a.addEventListener("click", (u) => {
|
|
94
|
+
if (u.stopPropagation(), a.classList.contains("nav-option--disabled")) return;
|
|
95
|
+
const f = a.dataset.navId ?? "";
|
|
96
|
+
o == null || o(f), g();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}), document.addEventListener("click", g), document.addEventListener("keydown", (s) => {
|
|
100
|
+
s.key === "Escape" && n && (s.preventDefault(), g());
|
|
101
|
+
}), { openItem: p, closeItem: d, closeAll: g };
|
|
102
|
+
}
|
|
103
|
+
let C = null;
|
|
104
|
+
function X(e, t) {
|
|
105
|
+
const { message: o, variant: l = "success", durationMs: n = 3e3 } = t;
|
|
106
|
+
C && (clearTimeout(C), C = null), e.textContent = o, e.className = `app-toast ${l}`, e.offsetHeight, e.classList.add("visible"), C = setTimeout(() => {
|
|
107
|
+
e.classList.remove("visible"), C = null;
|
|
108
|
+
}, n);
|
|
109
|
+
}
|
|
110
|
+
function ue(e, t = "success", o = 3e3, l = "app-toast") {
|
|
111
|
+
const n = document.getElementById(l);
|
|
112
|
+
n && X(n, { message: e, variant: t, durationMs: o });
|
|
113
|
+
}
|
|
114
|
+
function me(e) {
|
|
115
|
+
var h;
|
|
116
|
+
const {
|
|
117
|
+
input: t,
|
|
118
|
+
onSearch: o,
|
|
119
|
+
onSelect: l,
|
|
120
|
+
debounce: n = 200,
|
|
121
|
+
minChars: p = 0
|
|
122
|
+
} = e;
|
|
123
|
+
let d = null, g = -1, s = [];
|
|
124
|
+
const i = ((h = t.closest(".search-field")) == null ? void 0 : h.querySelector(".search-suggestions")) ?? null;
|
|
125
|
+
function r(b) {
|
|
126
|
+
if (s = b, g = -1, !i) return;
|
|
127
|
+
if (i.innerHTML = "", b.length === 0) {
|
|
128
|
+
i.classList.remove("is-open");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const S = document.createDocumentFragment();
|
|
132
|
+
for (const M of b) {
|
|
133
|
+
const y = document.createElement("button");
|
|
134
|
+
y.type = "button", y.className = "search-suggestion", y.textContent = M, y.addEventListener("mousedown", (L) => {
|
|
135
|
+
L.preventDefault(), a(M);
|
|
136
|
+
}), S.appendChild(y);
|
|
137
|
+
}
|
|
138
|
+
i.appendChild(S), i.classList.add("is-open");
|
|
139
|
+
}
|
|
140
|
+
function a(b) {
|
|
141
|
+
t.value = b, i == null || i.classList.remove("is-open"), s = [], g = -1, l == null || l(b);
|
|
142
|
+
}
|
|
143
|
+
function u(b) {
|
|
144
|
+
var M;
|
|
145
|
+
if (!i) return;
|
|
146
|
+
const S = i.querySelectorAll(".search-suggestion");
|
|
147
|
+
S.forEach((y, L) => y.classList.toggle("is-active", L === b)), g = b, (M = S[b]) == null || M.scrollIntoView({ block: "nearest" });
|
|
148
|
+
}
|
|
149
|
+
function f() {
|
|
150
|
+
d && clearTimeout(d);
|
|
151
|
+
const b = t.value;
|
|
152
|
+
if (b.length < p) {
|
|
153
|
+
r([]);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
d = setTimeout(() => o == null ? void 0 : o(b), n);
|
|
157
|
+
}
|
|
158
|
+
function c(b) {
|
|
159
|
+
if (i != null && i.classList.contains("is-open"))
|
|
160
|
+
switch (b.key) {
|
|
161
|
+
case "ArrowDown":
|
|
162
|
+
b.preventDefault(), u(Math.min(g + 1, s.length - 1));
|
|
163
|
+
break;
|
|
164
|
+
case "ArrowUp":
|
|
165
|
+
b.preventDefault(), u(Math.max(g - 1, 0));
|
|
166
|
+
break;
|
|
167
|
+
case "Enter":
|
|
168
|
+
g >= 0 && (b.preventDefault(), a(s[g]));
|
|
169
|
+
break;
|
|
170
|
+
case "Escape":
|
|
171
|
+
r([]);
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function m() {
|
|
176
|
+
setTimeout(() => i == null ? void 0 : i.classList.remove("is-open"), 150);
|
|
177
|
+
}
|
|
178
|
+
return t.addEventListener("input", f), t.addEventListener("keydown", c), t.addEventListener("blur", m), {
|
|
179
|
+
setSuggestions: r,
|
|
180
|
+
clearSuggestions: () => r([]),
|
|
181
|
+
destroy() {
|
|
182
|
+
d && clearTimeout(d), t.removeEventListener("input", f), t.removeEventListener("keydown", c), t.removeEventListener("blur", m);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function fe(e) {
|
|
187
|
+
var W, O;
|
|
188
|
+
const {
|
|
189
|
+
el: t,
|
|
190
|
+
min: o = 0,
|
|
191
|
+
max: l = 100,
|
|
192
|
+
step: n = 1,
|
|
193
|
+
inverted: p = !1,
|
|
194
|
+
onChange: d
|
|
195
|
+
} = e, g = t.querySelector(".range-track"), s = t.querySelector(".range-fill"), i = t.querySelector(".range-fill-end") ?? null, r = t.querySelector('[data-thumb="lo"]'), a = t.querySelector('[data-thumb="hi"]'), u = t.querySelector(".range-label-lo") ?? null, f = t.querySelector(".range-label-hi") ?? null;
|
|
196
|
+
let c = ((W = e.value) == null ? void 0 : W[0]) ?? o, m = ((O = e.value) == null ? void 0 : O[1]) ?? l;
|
|
197
|
+
function h(v) {
|
|
198
|
+
return Math.round((v - o) / n) * n + o;
|
|
199
|
+
}
|
|
200
|
+
function b(v, E, w) {
|
|
201
|
+
return Math.max(E, Math.min(w, v));
|
|
202
|
+
}
|
|
203
|
+
function S(v) {
|
|
204
|
+
return (v - o) / (l - o) * 100;
|
|
205
|
+
}
|
|
206
|
+
function M() {
|
|
207
|
+
const v = S(c), E = S(m);
|
|
208
|
+
r.style.left = `${v}%`, a.style.left = `${E}%`, p ? (s.style.left = "0%", s.style.width = `${v}%`, i && (i.style.left = `${E}%`, i.style.width = `${100 - E}%`)) : (s.style.left = `${v}%`, s.style.width = `${E - v}%`), r.setAttribute("aria-valuenow", String(c)), a.setAttribute("aria-valuenow", String(m)), r.setAttribute("aria-valuetext", String(c)), a.setAttribute("aria-valuetext", String(m)), u && (u.textContent = String(c)), f && (f.textContent = String(m));
|
|
209
|
+
}
|
|
210
|
+
function y(v) {
|
|
211
|
+
const E = g.getBoundingClientRect(), w = b((v - E.left) / E.width, 0, 1);
|
|
212
|
+
return h(o + w * (l - o));
|
|
213
|
+
}
|
|
214
|
+
function L(v, E) {
|
|
215
|
+
E.preventDefault();
|
|
216
|
+
const w = v === "lo" ? r : a;
|
|
217
|
+
w.classList.add("is-dragging"), w.setPointerCapture(E.pointerId);
|
|
218
|
+
function B(I) {
|
|
219
|
+
const $ = y(I.clientX);
|
|
220
|
+
v === "lo" ? c = b($, o, m) : m = b($, c, l), M(), d == null || d(c, m);
|
|
221
|
+
}
|
|
222
|
+
function R(I) {
|
|
223
|
+
w.classList.remove("is-dragging"), w.releasePointerCapture(I.pointerId), w.removeEventListener("pointermove", B), w.removeEventListener("pointerup", R);
|
|
224
|
+
}
|
|
225
|
+
w.addEventListener("pointermove", B), w.addEventListener("pointerup", R);
|
|
226
|
+
}
|
|
227
|
+
function D(v) {
|
|
228
|
+
if (v.target.closest(".range-thumb")) return;
|
|
229
|
+
const E = y(v.clientX), w = Math.abs(E - c), B = Math.abs(E - m);
|
|
230
|
+
w <= B ? c = b(E, o, m) : m = b(E, c, l), M(), d == null || d(c, m);
|
|
231
|
+
}
|
|
232
|
+
function T(v) {
|
|
233
|
+
const E = v.currentTarget.dataset.thumb;
|
|
234
|
+
let w = 0;
|
|
235
|
+
switch (v.key) {
|
|
236
|
+
case "ArrowRight":
|
|
237
|
+
case "ArrowUp":
|
|
238
|
+
w = +n;
|
|
239
|
+
break;
|
|
240
|
+
case "ArrowLeft":
|
|
241
|
+
case "ArrowDown":
|
|
242
|
+
w = -n;
|
|
243
|
+
break;
|
|
244
|
+
case "PageUp":
|
|
245
|
+
w = +n * 10;
|
|
246
|
+
break;
|
|
247
|
+
case "PageDown":
|
|
248
|
+
w = -n * 10;
|
|
249
|
+
break;
|
|
250
|
+
case "Home":
|
|
251
|
+
E === "lo" && (c = o, M(), d == null || d(c, m));
|
|
252
|
+
return;
|
|
253
|
+
case "End":
|
|
254
|
+
E === "hi" && (m = l, M(), d == null || d(c, m));
|
|
255
|
+
return;
|
|
256
|
+
default:
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
v.preventDefault(), E === "lo" ? c = b(h(c + w), o, m) : m = b(h(m + w), c, l), M(), d == null || d(c, m);
|
|
260
|
+
}
|
|
261
|
+
return r.setAttribute("role", "slider"), r.setAttribute("tabindex", "0"), r.setAttribute("aria-label", "Minimum"), r.setAttribute("aria-valuemin", String(o)), r.setAttribute("aria-valuemax", String(l)), a.setAttribute("role", "slider"), a.setAttribute("tabindex", "0"), a.setAttribute("aria-label", "Maximum"), a.setAttribute("aria-valuemin", String(o)), a.setAttribute("aria-valuemax", String(l)), r.addEventListener("pointerdown", (v) => L("lo", v)), a.addEventListener("pointerdown", (v) => L("hi", v)), r.addEventListener("keydown", T), a.addEventListener("keydown", T), g.addEventListener("click", D), M(), {
|
|
262
|
+
setValue(v, E) {
|
|
263
|
+
c = b(h(v), o, l), m = b(h(E), o, l), c > m && ([c, m] = [m, c]), M();
|
|
264
|
+
},
|
|
265
|
+
getValue() {
|
|
266
|
+
return [c, m];
|
|
267
|
+
},
|
|
268
|
+
destroy() {
|
|
269
|
+
r.removeEventListener("pointerdown", (v) => L("lo", v)), a.removeEventListener("pointerdown", (v) => L("hi", v)), r.removeEventListener("keydown", T), a.removeEventListener("keydown", T), g.removeEventListener("click", D);
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function _(e) {
|
|
274
|
+
const {
|
|
275
|
+
backdrop: t,
|
|
276
|
+
closeOnBackdrop: o = !0,
|
|
277
|
+
closeOnEscape: l = !0,
|
|
278
|
+
onClose: n,
|
|
279
|
+
onAccept: p,
|
|
280
|
+
onReject: d,
|
|
281
|
+
acceptBtnSelector: g = ".modal-btn-accept",
|
|
282
|
+
rejectBtnSelector: s = ".modal-btn-reject"
|
|
283
|
+
} = e;
|
|
284
|
+
t.removeAttribute("hidden"), document.body.classList.add("modal-open");
|
|
285
|
+
const i = () => {
|
|
286
|
+
j({ backdrop: t, onClose: n }), p == null || p();
|
|
287
|
+
}, r = () => {
|
|
288
|
+
j({ backdrop: t, onClose: n }), d == null || d();
|
|
289
|
+
};
|
|
290
|
+
if (t.querySelectorAll(g).forEach((a) => a.addEventListener("click", i, { once: !0 })), t.querySelectorAll(s).forEach((a) => a.addEventListener("click", r, { once: !0 })), o && t.addEventListener(
|
|
291
|
+
"click",
|
|
292
|
+
(a) => {
|
|
293
|
+
a.target === t && r();
|
|
294
|
+
},
|
|
295
|
+
{ once: !0 }
|
|
296
|
+
), l) {
|
|
297
|
+
const a = (u) => {
|
|
298
|
+
u.key === "Escape" && (r(), document.removeEventListener("keydown", a));
|
|
299
|
+
};
|
|
300
|
+
document.addEventListener("keydown", a);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function j(e) {
|
|
304
|
+
const { backdrop: t, onClose: o } = e;
|
|
305
|
+
t.setAttribute("hidden", ""), document.body.classList.remove("modal-open"), o == null || o();
|
|
306
|
+
}
|
|
307
|
+
function ge(e, t, o = {}) {
|
|
308
|
+
const l = document.getElementById(e), n = document.getElementById(t);
|
|
309
|
+
n && (l == null || l.addEventListener("click", () => _({ backdrop: n, ...o })));
|
|
310
|
+
}
|
|
311
|
+
const Y = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"
|
|
312
|
+
fill="none" stroke="currentColor" stroke-width="2"
|
|
313
|
+
stroke-linecap="round" stroke-linejoin="round">
|
|
314
|
+
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
|
315
|
+
</svg>`;
|
|
316
|
+
function pe(e) {
|
|
317
|
+
const {
|
|
318
|
+
title: t,
|
|
319
|
+
message: o,
|
|
320
|
+
acceptLabel: l = "Confirm",
|
|
321
|
+
rejectLabel: n = "Cancel",
|
|
322
|
+
variant: p = "default",
|
|
323
|
+
closeOnBackdrop: d = !0,
|
|
324
|
+
closeOnEscape: g = !0
|
|
325
|
+
} = e;
|
|
326
|
+
return new Promise((s) => {
|
|
327
|
+
const i = document.createElement("div");
|
|
328
|
+
i.className = "modal-backdrop";
|
|
329
|
+
const r = document.createElement("div");
|
|
330
|
+
r.className = "modal-card", r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "true");
|
|
331
|
+
const a = document.createElement("div");
|
|
332
|
+
a.className = "modal-header";
|
|
333
|
+
const u = document.createElement("h3");
|
|
334
|
+
u.textContent = t;
|
|
335
|
+
const f = document.createElement("button");
|
|
336
|
+
if (f.className = "icon-btn modal-close-btn modal-btn-reject", f.setAttribute("aria-label", "Close"), f.innerHTML = Y, a.append(u, f), r.appendChild(a), o) {
|
|
337
|
+
const y = document.createElement("p");
|
|
338
|
+
y.className = "modal-body-text", y.textContent = o, r.appendChild(y);
|
|
339
|
+
}
|
|
340
|
+
const c = document.createElement("div");
|
|
341
|
+
c.className = "modal-footer";
|
|
342
|
+
const m = document.createElement("button");
|
|
343
|
+
m.className = "secondary-btn modal-btn-reject", m.textContent = n;
|
|
344
|
+
const h = document.createElement("button");
|
|
345
|
+
h.className = `modal-btn-accept${p === "danger" ? " danger" : ""}`, h.textContent = l, c.append(m, h), r.appendChild(c), i.appendChild(r), document.body.appendChild(i), document.body.classList.add("modal-open"), requestAnimationFrame(() => m.focus());
|
|
346
|
+
const b = () => {
|
|
347
|
+
i.remove(), document.body.classList.remove("modal-open");
|
|
348
|
+
}, S = () => {
|
|
349
|
+
b(), s(!0);
|
|
350
|
+
}, M = () => {
|
|
351
|
+
b(), s(!1);
|
|
352
|
+
};
|
|
353
|
+
if (h.addEventListener("click", S, { once: !0 }), i.querySelectorAll(".modal-btn-reject").forEach((y) => y.addEventListener("click", M, { once: !0 })), d && i.addEventListener(
|
|
354
|
+
"click",
|
|
355
|
+
(y) => {
|
|
356
|
+
y.target === i && M();
|
|
357
|
+
},
|
|
358
|
+
{ once: !0 }
|
|
359
|
+
), g) {
|
|
360
|
+
const y = (L) => {
|
|
361
|
+
L.key === "Escape" && (M(), document.removeEventListener("keydown", y));
|
|
362
|
+
};
|
|
363
|
+
document.addEventListener("keydown", y);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
function be(e = {}) {
|
|
368
|
+
var i, r;
|
|
369
|
+
const {
|
|
370
|
+
triggerSelector: t = "[data-tab-trigger]",
|
|
371
|
+
panelSelector: o = "[data-tab-panel]",
|
|
372
|
+
root: l = document,
|
|
373
|
+
onChange: n
|
|
374
|
+
} = e, p = Array.from(l.querySelectorAll(t)), d = Array.from(l.querySelectorAll(o));
|
|
375
|
+
function g(a) {
|
|
376
|
+
p.forEach((u) => {
|
|
377
|
+
u.classList.toggle("is-active", u.dataset.tabTrigger === a);
|
|
378
|
+
}), d.forEach((u) => {
|
|
379
|
+
u.classList.toggle("is-active", u.dataset.tabPanel === a);
|
|
380
|
+
}), n == null || n(a);
|
|
381
|
+
}
|
|
382
|
+
p.forEach((a) => {
|
|
383
|
+
a.addEventListener("click", () => {
|
|
384
|
+
const u = a.dataset.tabTrigger;
|
|
385
|
+
u && g(u);
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
const s = ((i = p.find((a) => a.classList.contains("is-active"))) == null ? void 0 : i.dataset.tabTrigger) ?? ((r = p[0]) == null ? void 0 : r.dataset.tabTrigger);
|
|
389
|
+
return s && g(s), { activate: g };
|
|
390
|
+
}
|
|
391
|
+
function ve(e) {
|
|
392
|
+
const {
|
|
393
|
+
workspace: t,
|
|
394
|
+
leftResizer: o,
|
|
395
|
+
rightResizer: l,
|
|
396
|
+
leftVar: n = "--left-panel-width",
|
|
397
|
+
rightVar: p = "--right-panel-width",
|
|
398
|
+
minLeft: d = 160,
|
|
399
|
+
maxLeft: g = 480,
|
|
400
|
+
minRight: s = 160,
|
|
401
|
+
maxRight: i = 520
|
|
402
|
+
} = e;
|
|
403
|
+
let r = null, a = 0, u = 0;
|
|
404
|
+
function f() {
|
|
405
|
+
return parseInt(getComputedStyle(t).getPropertyValue(n) || "220", 10);
|
|
406
|
+
}
|
|
407
|
+
function c() {
|
|
408
|
+
return parseInt(getComputedStyle(t).getPropertyValue(p) || "260", 10);
|
|
409
|
+
}
|
|
410
|
+
o.addEventListener("mousedown", (m) => {
|
|
411
|
+
r = "left", a = m.clientX, u = f(), m.preventDefault();
|
|
412
|
+
}), l.addEventListener("mousedown", (m) => {
|
|
413
|
+
r = "right", a = m.clientX, u = c(), m.preventDefault();
|
|
414
|
+
}), document.addEventListener("mousemove", (m) => {
|
|
415
|
+
if (r)
|
|
416
|
+
if (r === "left") {
|
|
417
|
+
const h = m.clientX - a, b = Math.min(g, Math.max(d, u + h));
|
|
418
|
+
t.style.setProperty(n, `${b}px`);
|
|
419
|
+
} else {
|
|
420
|
+
const h = a - m.clientX, b = Math.min(i, Math.max(s, u + h));
|
|
421
|
+
t.style.setProperty(p, `${b}px`);
|
|
422
|
+
}
|
|
423
|
+
}), document.addEventListener("mouseup", () => {
|
|
424
|
+
r = null;
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function he(e = {}) {
|
|
428
|
+
const {
|
|
429
|
+
minimizeBtnId: t = "window-minimize-btn",
|
|
430
|
+
maximizeBtnId: o = "window-maximize-btn",
|
|
431
|
+
closeBtnId: l = "window-close-btn"
|
|
432
|
+
} = e, n = G(), p = document.getElementById(t), d = document.getElementById(o), g = document.getElementById(l);
|
|
433
|
+
p == null || p.addEventListener("click", async () => {
|
|
434
|
+
try {
|
|
435
|
+
await n.minimize();
|
|
436
|
+
} catch (s) {
|
|
437
|
+
console.error("Failed to minimize window:", s);
|
|
438
|
+
}
|
|
439
|
+
}), d && (d.addEventListener("click", async () => {
|
|
440
|
+
try {
|
|
441
|
+
const s = await n.isMaximized();
|
|
442
|
+
s ? await n.unmaximize() : await n.maximize(), x(d, !s);
|
|
443
|
+
} catch (s) {
|
|
444
|
+
console.error("Failed to toggle maximize:", s);
|
|
445
|
+
}
|
|
446
|
+
}), n.isMaximized().then((s) => x(d, s)).catch(() => {
|
|
447
|
+
}), n.onResized(async () => {
|
|
448
|
+
try {
|
|
449
|
+
const s = await n.isMaximized();
|
|
450
|
+
x(d, s);
|
|
451
|
+
} catch {
|
|
452
|
+
}
|
|
453
|
+
})), g == null || g.addEventListener("click", async () => {
|
|
454
|
+
try {
|
|
455
|
+
await n.close();
|
|
456
|
+
} catch (s) {
|
|
457
|
+
console.error("Failed to close window:", s);
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
function x(e, t) {
|
|
462
|
+
e.dataset.maximized = String(t);
|
|
463
|
+
const o = e.querySelector("svg");
|
|
464
|
+
if (!o) return;
|
|
465
|
+
const l = t ? [
|
|
466
|
+
// minimize-2: two arrows pointing inward
|
|
467
|
+
["polyline", "points", "4 14 10 14 10 20"],
|
|
468
|
+
["polyline", "points", "20 10 14 10 14 4"],
|
|
469
|
+
["line", "x1,y1,x2,y2", "10,20,3,13"],
|
|
470
|
+
["line", "x1,y1,x2,y2", "21,3,14,10"]
|
|
471
|
+
] : [
|
|
472
|
+
// maximize-2: two arrows pointing outward
|
|
473
|
+
["polyline", "points", "15 3 21 3 21 9"],
|
|
474
|
+
["polyline", "points", "9 21 3 21 3 15"],
|
|
475
|
+
["line", "x1,y1,x2,y2", "21,3,14,10"],
|
|
476
|
+
["line", "x1,y1,x2,y2", "3,21,10,14"]
|
|
477
|
+
];
|
|
478
|
+
o.innerHTML = "";
|
|
479
|
+
const n = "http://www.w3.org/2000/svg";
|
|
480
|
+
for (const [p, d, g] of l) {
|
|
481
|
+
const s = document.createElementNS(n, p), i = d.split(","), r = g.split(",");
|
|
482
|
+
i.forEach((a, u) => s.setAttribute(a, r[u] ?? "")), o.appendChild(s);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function ye() {
|
|
486
|
+
window.addEventListener("contextmenu", (e) => {
|
|
487
|
+
e.preventDefault();
|
|
488
|
+
}), window.addEventListener("keydown", (e) => {
|
|
489
|
+
(e.key === "ContextMenu" || e.shiftKey && e.key === "F10") && e.preventDefault();
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
const z = ["classic", "bars", "pulse", "bloom", "fan"], P = [
|
|
493
|
+
"aurora",
|
|
494
|
+
"ember",
|
|
495
|
+
"glacier",
|
|
496
|
+
"sunset",
|
|
497
|
+
"monochrome"
|
|
498
|
+
], A = {
|
|
499
|
+
aurora: {
|
|
500
|
+
horizontalStart: "rgba(108, 99, 255, 0.3)",
|
|
501
|
+
horizontalMid: "rgba(74, 222, 128, 0.95)",
|
|
502
|
+
horizontalEnd: "rgba(108, 99, 255, 0.3)",
|
|
503
|
+
verticalTop: "rgba(167, 139, 250, 0.7)",
|
|
504
|
+
verticalMid: "rgba(74, 222, 128, 0.95)",
|
|
505
|
+
verticalBottom: "rgba(34, 211, 238, 0.62)",
|
|
506
|
+
glow: "rgba(74, 222, 128, 0.45)",
|
|
507
|
+
progressStart: "rgba(251, 191, 36, 0.95)",
|
|
508
|
+
progressEnd: "rgba(248, 113, 113, 0.9)",
|
|
509
|
+
label: "Aurora"
|
|
510
|
+
},
|
|
511
|
+
ember: {
|
|
512
|
+
horizontalStart: "rgba(251, 146, 60, 0.34)",
|
|
513
|
+
horizontalMid: "rgba(248, 113, 113, 0.98)",
|
|
514
|
+
horizontalEnd: "rgba(245, 158, 11, 0.34)",
|
|
515
|
+
verticalTop: "rgba(253, 186, 116, 0.78)",
|
|
516
|
+
verticalMid: "rgba(248, 113, 113, 0.94)",
|
|
517
|
+
verticalBottom: "rgba(239, 68, 68, 0.66)",
|
|
518
|
+
glow: "rgba(248, 113, 113, 0.42)",
|
|
519
|
+
progressStart: "rgba(253, 224, 71, 0.96)",
|
|
520
|
+
progressEnd: "rgba(239, 68, 68, 0.9)",
|
|
521
|
+
label: "Ember"
|
|
522
|
+
},
|
|
523
|
+
glacier: {
|
|
524
|
+
horizontalStart: "rgba(96, 165, 250, 0.3)",
|
|
525
|
+
horizontalMid: "rgba(125, 211, 252, 0.95)",
|
|
526
|
+
horizontalEnd: "rgba(45, 212, 191, 0.3)",
|
|
527
|
+
verticalTop: "rgba(191, 219, 254, 0.76)",
|
|
528
|
+
verticalMid: "rgba(125, 211, 252, 0.92)",
|
|
529
|
+
verticalBottom: "rgba(45, 212, 191, 0.62)",
|
|
530
|
+
glow: "rgba(96, 165, 250, 0.38)",
|
|
531
|
+
progressStart: "rgba(165, 243, 252, 0.95)",
|
|
532
|
+
progressEnd: "rgba(96, 165, 250, 0.88)",
|
|
533
|
+
label: "Glacier"
|
|
534
|
+
},
|
|
535
|
+
sunset: {
|
|
536
|
+
horizontalStart: "rgba(244, 114, 182, 0.32)",
|
|
537
|
+
horizontalMid: "rgba(251, 191, 36, 0.96)",
|
|
538
|
+
horizontalEnd: "rgba(249, 115, 22, 0.34)",
|
|
539
|
+
verticalTop: "rgba(251, 207, 232, 0.76)",
|
|
540
|
+
verticalMid: "rgba(251, 191, 36, 0.93)",
|
|
541
|
+
verticalBottom: "rgba(249, 115, 22, 0.66)",
|
|
542
|
+
glow: "rgba(251, 191, 36, 0.4)",
|
|
543
|
+
progressStart: "rgba(253, 224, 71, 0.96)",
|
|
544
|
+
progressEnd: "rgba(236, 72, 153, 0.9)",
|
|
545
|
+
label: "Sunset"
|
|
546
|
+
},
|
|
547
|
+
monochrome: {
|
|
548
|
+
horizontalStart: "rgba(148, 163, 184, 0.25)",
|
|
549
|
+
horizontalMid: "rgba(241, 245, 249, 0.95)",
|
|
550
|
+
horizontalEnd: "rgba(148, 163, 184, 0.25)",
|
|
551
|
+
verticalTop: "rgba(226, 232, 240, 0.68)",
|
|
552
|
+
verticalMid: "rgba(241, 245, 249, 0.92)",
|
|
553
|
+
verticalBottom: "rgba(148, 163, 184, 0.55)",
|
|
554
|
+
glow: "rgba(226, 232, 240, 0.26)",
|
|
555
|
+
progressStart: "rgba(248, 250, 252, 0.92)",
|
|
556
|
+
progressEnd: "rgba(148, 163, 184, 0.82)",
|
|
557
|
+
label: "Monochrome"
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
function Ee(e) {
|
|
561
|
+
return typeof e == "string" && z.includes(e);
|
|
562
|
+
}
|
|
563
|
+
function we(e) {
|
|
564
|
+
return typeof e == "string" && P.includes(e);
|
|
565
|
+
}
|
|
566
|
+
function Me(e) {
|
|
567
|
+
const t = z.indexOf(e);
|
|
568
|
+
return z[(t + 1) % z.length];
|
|
569
|
+
}
|
|
570
|
+
function Se(e) {
|
|
571
|
+
const t = P.indexOf(e);
|
|
572
|
+
return P[(t + 1) % P.length];
|
|
573
|
+
}
|
|
574
|
+
function Le(e) {
|
|
575
|
+
return {
|
|
576
|
+
classic: "Classic",
|
|
577
|
+
bars: "Bars",
|
|
578
|
+
pulse: "Pulse",
|
|
579
|
+
bloom: "Bloom",
|
|
580
|
+
fan: "Fan"
|
|
581
|
+
}[e];
|
|
582
|
+
}
|
|
583
|
+
function ke(e) {
|
|
584
|
+
return A[e].label;
|
|
585
|
+
}
|
|
586
|
+
function k(e, t) {
|
|
587
|
+
const o = e.match(/^rgba\((.+?),\s*([0-9.]+)\)$/);
|
|
588
|
+
return o ? `rgba(${o[1]}, ${Number(o[2]) * t})` : e;
|
|
589
|
+
}
|
|
590
|
+
function q(e, t, o, l = 1) {
|
|
591
|
+
const n = e.createLinearGradient(0, 0, t, 0);
|
|
592
|
+
return n.addColorStop(0, k(o.horizontalStart, l)), n.addColorStop(0.5, k(o.horizontalMid, l)), n.addColorStop(1, k(o.horizontalEnd, l)), n;
|
|
593
|
+
}
|
|
594
|
+
function N(e, t, o, l = 1) {
|
|
595
|
+
const n = e.createLinearGradient(0, 0, 0, t);
|
|
596
|
+
return n.addColorStop(0, k(o.verticalTop, l)), n.addColorStop(0.45, k(o.verticalMid, l)), n.addColorStop(1, k(o.verticalBottom, l)), n;
|
|
597
|
+
}
|
|
598
|
+
function K({ ctx: e, width: t, height: o, amplitude: l, phase: n, colorScheme: p }) {
|
|
599
|
+
const d = A[p], g = o / 2;
|
|
600
|
+
e.lineWidth = 2, e.strokeStyle = q(e, t, d), e.shadowColor = d.glow, e.shadowBlur = 12, e.beginPath();
|
|
601
|
+
for (let s = 0; s <= t; s += 2) {
|
|
602
|
+
const i = s / Math.max(t, 1), r = Math.sin(i * Math.PI), a = g + Math.sin(i * 10 + n) * l * r + Math.sin(i * 22 + n * 1.8) * l * 0.16;
|
|
603
|
+
s === 0 ? e.moveTo(s, a) : e.lineTo(s, a);
|
|
604
|
+
}
|
|
605
|
+
e.stroke(), e.shadowBlur = 0;
|
|
606
|
+
}
|
|
607
|
+
function U({ ctx: e, width: t, height: o, amplitude: l, phase: n, active: p, colorScheme: d }) {
|
|
608
|
+
const g = A[d], s = o / 2, i = 6, r = 3, a = Math.max(2, o * 0.08), u = Math.max(a + 2, Math.min(o * 0.92, a + l * 2.4));
|
|
609
|
+
e.fillStyle = N(e, o, g, p ? 1 : 0.72), e.shadowColor = k(g.glow, 0.84), e.shadowBlur = p ? 10 : 0;
|
|
610
|
+
for (let f = 0; f <= t; f += i) {
|
|
611
|
+
const c = f / Math.max(t, 1), m = Math.sin(c * 18 - n * 1.9), h = Math.sin(c * 8 + n * 1.15), b = Math.max(0, m * 0.72 + h * 0.28), S = p ? 0.2 + b * 0.8 : 0, M = a + (u - a) * S, y = s - M / 2;
|
|
612
|
+
e.fillRect(f, y, r, M);
|
|
613
|
+
}
|
|
614
|
+
e.shadowBlur = 0;
|
|
615
|
+
}
|
|
616
|
+
function J({ ctx: e, width: t, height: o, amplitude: l, phase: n, active: p, colorScheme: d }) {
|
|
617
|
+
const g = A[d], s = o / 2, i = p ? Math.max(3, l * 1.25) : 0;
|
|
618
|
+
e.fillStyle = N(e, o, g, 0.28), e.beginPath();
|
|
619
|
+
for (let r = 0; r <= t; r += 4) {
|
|
620
|
+
const a = r / Math.max(t, 1), u = 0.32 + Math.sin(a * Math.PI) * 0.68, f = Math.sin(a * 8 + n * 0.95) + Math.sin(a * 17 - n * 1.6) * 0.35, c = s - i * u * f * 0.7;
|
|
621
|
+
r === 0 ? e.moveTo(r, c) : e.lineTo(r, c);
|
|
622
|
+
}
|
|
623
|
+
for (let r = t; r >= 0; r -= 4) {
|
|
624
|
+
const a = r / Math.max(t, 1), u = 0.32 + Math.sin(a * Math.PI) * 0.68, f = Math.sin(a * 8 + n * 0.95) + Math.sin(a * 17 - n * 1.6) * 0.35, c = s + i * u * f * 0.7;
|
|
625
|
+
e.lineTo(r, c);
|
|
626
|
+
}
|
|
627
|
+
e.closePath(), e.fill(), e.lineWidth = 1.5, e.strokeStyle = q(e, t, g), e.shadowColor = k(g.glow, 0.88), e.shadowBlur = p ? 10 : 0, e.beginPath();
|
|
628
|
+
for (let r = 0; r <= t; r += 3) {
|
|
629
|
+
const a = r / Math.max(t, 1), u = 0.32 + Math.sin(a * Math.PI) * 0.68, f = Math.sin(a * 8 + n * 0.95) + Math.sin(a * 17 - n * 1.6) * 0.35, c = s + i * u * f * 0.45;
|
|
630
|
+
r === 0 ? e.moveTo(r, c) : e.lineTo(r, c);
|
|
631
|
+
}
|
|
632
|
+
e.stroke(), e.shadowBlur = 0;
|
|
633
|
+
}
|
|
634
|
+
function Q({ ctx: e, width: t, height: o, amplitude: l, phase: n, active: p, colorScheme: d }) {
|
|
635
|
+
const g = A[d], s = t / 2, i = o / 2, r = t / 2, a = 24, u = p ? Math.max(4, l * 1.4) : 0;
|
|
636
|
+
e.lineWidth = 1.8, e.strokeStyle = q(e, t, g), e.shadowColor = k(g.glow, 0.9), e.shadowBlur = p ? 12 : 0;
|
|
637
|
+
for (let f = 0; f < a; f += 1) {
|
|
638
|
+
const c = (f + 1) / a, m = c * r, h = Math.pow(1 - c, 0.45), b = Math.sin(n * 1.15 - c * 12) * 0.7 + Math.sin(n * 0.65 - c * 6.5) * 0.3, S = 1 + u * h * Math.max(0.15, b + 0.45);
|
|
639
|
+
e.beginPath(), e.moveTo(s - m, i - S), e.lineTo(s - m, i + S), e.moveTo(s + m, i - S), e.lineTo(s + m, i + S), e.stroke();
|
|
640
|
+
}
|
|
641
|
+
e.shadowBlur = 0;
|
|
642
|
+
}
|
|
643
|
+
function Z({ ctx: e, width: t, height: o, amplitude: l, phase: n, active: p, colorScheme: d }) {
|
|
644
|
+
const g = A[d], s = t / 2, i = o / 2, r = t / 2, a = p ? Math.max(4, l * 1.15) : 0;
|
|
645
|
+
e.fillStyle = N(e, o, g, 0.22), e.strokeStyle = q(e, t, g), e.lineWidth = 1.6, e.shadowColor = k(g.glow, 0.85), e.shadowBlur = p ? 10 : 0, e.beginPath(), e.moveTo(s, i);
|
|
646
|
+
for (let u = 0; u <= r; u += 3) {
|
|
647
|
+
const f = u / Math.max(r, 1), c = Math.sin(f * Math.PI * 0.95), m = Math.sin(n * 1.25 + f * 10) + Math.sin(n * 0.82 + f * 18) * 0.24, h = i - a * c * m * 0.58;
|
|
648
|
+
e.lineTo(s + u, h);
|
|
649
|
+
}
|
|
650
|
+
for (let u = r; u >= 0; u -= 3) {
|
|
651
|
+
const f = u / Math.max(r, 1), c = Math.sin(f * Math.PI * 0.95), m = Math.sin(n * 1.25 + f * 10) + Math.sin(n * 0.82 + f * 18) * 0.24, h = i + a * c * m * 0.58;
|
|
652
|
+
e.lineTo(s + u, h);
|
|
653
|
+
}
|
|
654
|
+
e.closePath(), e.fill();
|
|
655
|
+
for (const u of [1, -1]) {
|
|
656
|
+
e.beginPath(), e.moveTo(s, i);
|
|
657
|
+
for (let f = 0; f <= r; f += 3) {
|
|
658
|
+
const c = f / Math.max(r, 1), m = Math.sin(c * Math.PI * 0.95), h = Math.sin(n * 1.25 + c * 10) + Math.sin(n * 0.82 + c * 18) * 0.24, b = i - a * m * h * 0.58;
|
|
659
|
+
e.lineTo(s + u * f, b);
|
|
660
|
+
}
|
|
661
|
+
e.stroke(), e.beginPath(), e.moveTo(s, i);
|
|
662
|
+
for (let f = 0; f <= r; f += 3) {
|
|
663
|
+
const c = f / Math.max(r, 1), m = Math.sin(c * Math.PI * 0.95), h = Math.sin(n * 1.25 + c * 10) + Math.sin(n * 0.82 + c * 18) * 0.24, b = i + a * m * h * 0.58;
|
|
664
|
+
e.lineTo(s + u * f, b);
|
|
665
|
+
}
|
|
666
|
+
e.stroke();
|
|
667
|
+
}
|
|
668
|
+
e.shadowBlur = 0;
|
|
669
|
+
}
|
|
670
|
+
function Ae(e, t) {
|
|
671
|
+
({
|
|
672
|
+
classic: K,
|
|
673
|
+
bars: U,
|
|
674
|
+
pulse: J,
|
|
675
|
+
bloom: Q,
|
|
676
|
+
fan: Z
|
|
677
|
+
})[e](t);
|
|
678
|
+
}
|
|
679
|
+
function Ce(e, t, o) {
|
|
680
|
+
const l = A[o], n = e.createLinearGradient(0, 0, 0, t);
|
|
681
|
+
return n.addColorStop(0, l.progressStart), n.addColorStop(1, l.progressEnd), n;
|
|
682
|
+
}
|
|
683
|
+
export {
|
|
684
|
+
H as ICON_SET,
|
|
685
|
+
P as WAVEFORM_COLOR_SCHEMES,
|
|
686
|
+
z as WAVEFORM_STYLES,
|
|
687
|
+
ne as applyIcons,
|
|
688
|
+
ge as bindModal,
|
|
689
|
+
de as bindNavigation,
|
|
690
|
+
fe as bindRange,
|
|
691
|
+
me as bindSearch,
|
|
692
|
+
ve as bindSplitPaneResize,
|
|
693
|
+
be as bindTabs,
|
|
694
|
+
re as byId,
|
|
695
|
+
ae as byIdOptional,
|
|
696
|
+
j as closeModal,
|
|
697
|
+
pe as confirmModal,
|
|
698
|
+
oe as createIcon,
|
|
699
|
+
Ce as createWaveProgressGradient,
|
|
700
|
+
Se as cycleWaveformColorScheme,
|
|
701
|
+
Me as cycleWaveformStyle,
|
|
702
|
+
Ae as drawWaveform,
|
|
703
|
+
ke as getWaveformColorSchemeLabel,
|
|
704
|
+
Le as getWaveformStyleLabel,
|
|
705
|
+
we as isWaveformColorScheme,
|
|
706
|
+
Ee as isWaveformStyle,
|
|
707
|
+
X as mountToast,
|
|
708
|
+
_ as openModal,
|
|
709
|
+
le as populateSelectOptions,
|
|
710
|
+
se as qs,
|
|
711
|
+
ie as qsAll,
|
|
712
|
+
ce as setGroupDisabled,
|
|
713
|
+
ye as setupContextMenuGuard,
|
|
714
|
+
he as setupWindowControls,
|
|
715
|
+
ue as showToast
|
|
716
|
+
};
|