@floegence/floe-webapp-core 0.4.0 → 0.6.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.
Files changed (87) hide show
  1. package/dist/components/ui/Dialog.d.ts +3 -0
  2. package/dist/components/ui/DirectoryPicker.d.ts +31 -0
  3. package/dist/components/ui/index.d.ts +1 -0
  4. package/dist/index.js +193 -191
  5. package/dist/index10.js +2 -2
  6. package/dist/index11.js +4 -4
  7. package/dist/index12.js +5 -5
  8. package/dist/index13.js +3 -3
  9. package/dist/index14.js +4 -4
  10. package/dist/index15.js +5 -5
  11. package/dist/index16.js +5 -5
  12. package/dist/index17.js +4 -4
  13. package/dist/index18.js +6 -6
  14. package/dist/index19.js +2 -2
  15. package/dist/index2.js +6 -6
  16. package/dist/index20.js +2 -2
  17. package/dist/index21.js +1 -1
  18. package/dist/index22.js +8 -5
  19. package/dist/index23.js +3 -3
  20. package/dist/index24.js +3 -3
  21. package/dist/index25.js +1 -1
  22. package/dist/index26.js +5 -5
  23. package/dist/index27.js +1 -1
  24. package/dist/index28.js +3 -3
  25. package/dist/index29.js +362 -81
  26. package/dist/index3.js +2 -2
  27. package/dist/index30.js +87 -37
  28. package/dist/index31.js +37 -66
  29. package/dist/index32.js +69 -278
  30. package/dist/index33.js +278 -152
  31. package/dist/index34.js +147 -24
  32. package/dist/index35.js +26 -45
  33. package/dist/index36.js +45 -10
  34. package/dist/index37.js +10 -27
  35. package/dist/index38.js +27 -159
  36. package/dist/index39.js +156 -228
  37. package/dist/index4.js +1 -1
  38. package/dist/index40.js +228 -125
  39. package/dist/index41.js +110 -176
  40. package/dist/index42.js +149 -122
  41. package/dist/index43.js +161 -183
  42. package/dist/index44.js +185 -145
  43. package/dist/index45.js +143 -114
  44. package/dist/index46.js +119 -47
  45. package/dist/index47.js +50 -48
  46. package/dist/index48.js +40 -30
  47. package/dist/index49.js +33 -44
  48. package/dist/index5.js +4 -4
  49. package/dist/index50.js +49 -25
  50. package/dist/index51.js +21 -169
  51. package/dist/index52.js +169 -36
  52. package/dist/index53.js +38 -64
  53. package/dist/index54.js +63 -93
  54. package/dist/index55.js +86 -111
  55. package/dist/index56.js +114 -131
  56. package/dist/index57.js +131 -32
  57. package/dist/index58.js +29 -425
  58. package/dist/index59.js +433 -36
  59. package/dist/index6.js +2 -2
  60. package/dist/index60.js +31 -12
  61. package/dist/index61.js +19 -13
  62. package/dist/index62.js +13 -10
  63. package/dist/index63.js +10 -16
  64. package/dist/index64.js +16 -10
  65. package/dist/index65.js +10 -8
  66. package/dist/index66.js +8 -61
  67. package/dist/index67.js +61 -5
  68. package/dist/index68.js +5 -11
  69. package/dist/index69.js +10 -25
  70. package/dist/index7.js +2 -2
  71. package/dist/index70.js +24 -30
  72. package/dist/index71.js +31 -90
  73. package/dist/index72.js +90 -26
  74. package/dist/index73.js +24 -43
  75. package/dist/index74.js +45 -13
  76. package/dist/index75.js +14 -35
  77. package/dist/index76.js +33 -62
  78. package/dist/index77.js +61 -81
  79. package/dist/index78.js +84 -14
  80. package/dist/index79.js +12 -2261
  81. package/dist/index8.js +2 -2
  82. package/dist/index80.js +2262 -6
  83. package/dist/index81.js +7 -39
  84. package/dist/index82.js +42 -0
  85. package/dist/index9.js +1 -1
  86. package/dist/styles.css +1 -1
  87. package/package.json +1 -1
package/dist/index29.js CHANGED
@@ -1,92 +1,373 @@
1
- import { template as h, insert as $, createComponent as z, effect as m, className as d, style as I } from "solid-js/web";
2
- import { createSignal as P, onMount as S, onCleanup as B, For as L } from "solid-js";
3
- import { cn as g } from "./index67.js";
4
- var M = /* @__PURE__ */ h(`<div role=status aria-label=Loading><style>
5
- @keyframes snakeBreathing {
6
- 0%, 100% {
7
- opacity: 0.5;
8
- transform: scale(0.85);
1
+ import { delegateEvents as ue, createComponent as r, template as v, insert as o, effect as I, className as E, setAttribute as J, memo as W, setStyleProperty as de } from "solid-js/web";
2
+ import { createSignal as $, createEffect as X, on as q, createMemo as B, For as A, Show as y } from "solid-js";
3
+ import { cn as S } from "./index68.js";
4
+ import { Dialog as fe } from "./index22.js";
5
+ import { Button as T } from "./index20.js";
6
+ import { Input as H } from "./index21.js";
7
+ import { ChevronRight as Q, Check as he, X as ge, Plus as me } from "./index33.js";
8
+ import { FolderOpenIcon as U, FolderIcon as ve } from "./index47.js";
9
+ import { deferNonBlocking as xe } from "./index69.js";
10
+ var be = /* @__PURE__ */ v('<div class="flex items-center justify-center py-6 text-xs text-muted-foreground">No directories available'), pe = /* @__PURE__ */ v('<div class="flex items-center gap-1.5"><div class=flex-1>'), we = /* @__PURE__ */ v('<p class="text-[11px] text-muted-foreground -mt-1">Creating in: '), Ce = /* @__PURE__ */ v('<div class="flex flex-col gap-2 -mt-1"><div class="flex items-center gap-1.5"><div class=flex-1></div></div><nav class="flex items-center gap-0.5 min-w-0 overflow-x-auto py-0.5"aria-label="Selected path"></nav><div class="border border-border rounded overflow-y-auto"style=max-height:280px;min-height:160px><button type=button><span>Root'), $e = /* @__PURE__ */ v('<div class="flex items-center w-full gap-2"><span class="flex-1 text-[11px] text-muted-foreground truncate">'), Y = /* @__PURE__ */ v("<button type=button>"), ye = /* @__PURE__ */ v("<button type=button><span>New Folder"), Se = /* @__PURE__ */ v("<div class=overflow-hidden>"), ke = /* @__PURE__ */ v('<div class="flex flex-col"><div><button type=button><span class="flex-shrink-0 w-4 h-4"></span><span class=truncate>'), Pe = /* @__PURE__ */ v('<span class="flex-shrink-0 w-4 h-4">');
11
+ function Oe(t) {
12
+ const [i, d] = $(t.initialPath ?? "/"), [x, g] = $(/* @__PURE__ */ new Set(["/"])), [k, D] = $(t.initialPath ?? "/"), [O, f] = $(""), [b, m] = $(!1), [P, w] = $(""), [l, h] = $(!1);
13
+ X(q(() => t.open, (e) => {
14
+ if (e) {
15
+ const n = t.initialPath ?? "/";
16
+ d(n), D(n), f(""), m(!1), w(""), h(!1);
17
+ const s = K(n);
18
+ g(/* @__PURE__ */ new Set(["/", ...s]));
19
+ }
20
+ })), X(q(i, (e) => {
21
+ D(e), f("");
22
+ }));
23
+ const C = B(() => {
24
+ const e = /* @__PURE__ */ new Map(), n = (s) => {
25
+ var c;
26
+ for (const u of s)
27
+ u.type === "folder" && (e.set(R(u.path), u), (c = u.children) != null && c.length && n(u.children));
28
+ };
29
+ return n(t.files), e;
30
+ }), p = B(() => t.files.filter((e) => e.type === "folder")), z = (e) => {
31
+ const n = R(e);
32
+ return n === "/" || C().has(n);
33
+ }, j = (e) => t.filter ? t.filter(e) : !0, ee = (e) => {
34
+ g((n) => {
35
+ const s = new Set(n);
36
+ return s.has(e) ? s.delete(e) : s.add(e), s;
37
+ });
38
+ }, te = (e) => {
39
+ j(e) && (d(e.path), g((n) => {
40
+ const s = new Set(n);
41
+ return s.add(e.path), s;
42
+ }));
43
+ }, ne = () => {
44
+ d("/");
45
+ }, G = () => {
46
+ const e = R(k().trim());
47
+ if (z(e)) {
48
+ d(e), f("");
49
+ const n = K(e);
50
+ g((s) => {
51
+ const c = new Set(s);
52
+ for (const u of n) c.add(u);
53
+ return c.add(e), c;
54
+ });
55
+ } else
56
+ f("Path not found");
57
+ }, re = (e) => {
58
+ e.key === "Enter" && (e.preventDefault(), G());
59
+ }, le = () => {
60
+ m(!0), w("");
61
+ }, L = () => {
62
+ m(!1), w("");
63
+ }, M = async () => {
64
+ const e = P().trim();
65
+ if (!(!e || !t.onCreateFolder)) {
66
+ h(!0);
67
+ try {
68
+ await t.onCreateFolder(i(), e), m(!1), w("");
69
+ } finally {
70
+ h(!1);
71
+ }
72
+ }
73
+ }, oe = (e) => {
74
+ e.key === "Enter" ? (e.preventDefault(), M()) : e.key === "Escape" && (e.preventDefault(), L());
75
+ }, ie = () => {
76
+ const e = i(), n = t.onSelect;
77
+ t.onOpenChange(!1), xe(() => n(e));
78
+ }, ae = () => {
79
+ t.onOpenChange(!1);
80
+ }, V = B(() => {
81
+ const e = i();
82
+ if (e === "/" || e === "") return [{
83
+ name: "Root",
84
+ path: "/"
85
+ }];
86
+ const n = e.split("/").filter(Boolean), s = [{
87
+ name: "Root",
88
+ path: "/"
89
+ }];
90
+ let c = "";
91
+ for (const u of n)
92
+ c += "/" + u, s.push({
93
+ name: u,
94
+ path: c
95
+ });
96
+ return s;
97
+ }), se = (e) => {
98
+ d(e);
99
+ const n = K(e);
100
+ g((s) => {
101
+ const c = new Set(s);
102
+ for (const u of n) c.add(u);
103
+ return c.add(e), c;
104
+ });
105
+ };
106
+ return r(fe, {
107
+ get open() {
108
+ return t.open;
109
+ },
110
+ get onOpenChange() {
111
+ return t.onOpenChange;
112
+ },
113
+ get title() {
114
+ return t.title ?? "Select Directory";
115
+ },
116
+ get class() {
117
+ return S("max-w-lg", t.class);
118
+ },
119
+ get footer() {
120
+ return (() => {
121
+ var e = $e(), n = e.firstChild;
122
+ return o(n, i), o(e, r(T, {
123
+ variant: "ghost",
124
+ size: "sm",
125
+ onClick: ae,
126
+ get children() {
127
+ return t.cancelText ?? "Cancel";
9
128
  }
10
- 50% {
11
- opacity: 1;
12
- transform: scale(1);
129
+ }), null), o(e, r(T, {
130
+ variant: "primary",
131
+ size: "sm",
132
+ onClick: ie,
133
+ get children() {
134
+ return t.confirmText ?? "Select";
13
135
  }
136
+ }), null), I(() => J(n, "title", i())), e;
137
+ })();
138
+ },
139
+ get children() {
140
+ var e = Ce(), n = e.firstChild, s = n.firstChild, c = n.nextSibling, u = c.nextSibling, N = u.firstChild, ce = N.firstChild;
141
+ return o(s, r(H, {
142
+ size: "sm",
143
+ get value() {
144
+ return k();
145
+ },
146
+ onInput: (a) => {
147
+ D(a.currentTarget.value), f("");
148
+ },
149
+ onKeyDown: re,
150
+ placeholder: "/path/to/directory",
151
+ get error() {
152
+ return O();
153
+ }
154
+ })), o(n, r(T, {
155
+ variant: "outline",
156
+ size: "sm",
157
+ onClick: G,
158
+ children: "Go"
159
+ }), null), o(c, r(A, {
160
+ get each() {
161
+ return V();
162
+ },
163
+ children: (a, _) => [r(y, {
164
+ get when() {
165
+ return _() > 0;
166
+ },
167
+ get children() {
168
+ return r(Q, {
169
+ class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
170
+ });
171
+ }
172
+ }), (() => {
173
+ var F = Y();
174
+ return F.$$click = () => se(a.path), o(F, () => a.name), I(() => E(F, S("text-xs px-1 py-0.5 rounded cursor-pointer flex-shrink-0", "transition-colors duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", _() === V().length - 1 ? "font-medium text-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"))), F;
175
+ })()]
176
+ })), N.$$click = ne, o(N, r(U, {
177
+ class: "w-4 h-4 flex-shrink-0"
178
+ }), ce), o(u, r(A, {
179
+ get each() {
180
+ return p();
181
+ },
182
+ children: (a) => r(Z, {
183
+ item: a,
184
+ depth: 1,
185
+ selectedPath: i,
186
+ expandedPaths: x,
187
+ onToggle: ee,
188
+ onSelect: te,
189
+ isSelectable: j
190
+ })
191
+ }), null), o(u, r(y, {
192
+ get when() {
193
+ return p().length === 0;
194
+ },
195
+ get children() {
196
+ return be();
197
+ }
198
+ }), null), o(e, r(y, {
199
+ get when() {
200
+ return t.onCreateFolder;
201
+ },
202
+ get children() {
203
+ return r(y, {
204
+ get when() {
205
+ return b();
206
+ },
207
+ get fallback() {
208
+ return (() => {
209
+ var a = ye(), _ = a.firstChild;
210
+ return a.$$click = le, o(a, r(me, {
211
+ class: "w-3.5 h-3.5"
212
+ }), _), I(() => E(a, S("flex items-center gap-1 text-xs text-muted-foreground cursor-pointer", "hover:text-foreground transition-colors duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded px-1 py-0.5"))), a;
213
+ })();
214
+ },
215
+ get children() {
216
+ return [(() => {
217
+ var a = pe(), _ = a.firstChild;
218
+ return o(_, r(H, {
219
+ size: "sm",
220
+ get value() {
221
+ return P();
222
+ },
223
+ onInput: (F) => w(F.currentTarget.value),
224
+ onKeyDown: oe,
225
+ placeholder: "Folder name",
226
+ get disabled() {
227
+ return l();
228
+ },
229
+ autofocus: !0
230
+ })), o(a, r(T, {
231
+ variant: "primary",
232
+ size: "sm",
233
+ onClick: M,
234
+ get loading() {
235
+ return l();
236
+ },
237
+ get disabled() {
238
+ return !P().trim();
239
+ },
240
+ get children() {
241
+ return r(he, {
242
+ class: "w-3.5 h-3.5"
243
+ });
244
+ }
245
+ }), null), o(a, r(T, {
246
+ variant: "ghost",
247
+ size: "sm",
248
+ onClick: L,
249
+ get disabled() {
250
+ return l();
251
+ },
252
+ get children() {
253
+ return r(ge, {
254
+ class: "w-3.5 h-3.5"
255
+ });
256
+ }
257
+ }), null), a;
258
+ })(), (() => {
259
+ var a = we();
260
+ return a.firstChild, o(a, i, null), a;
261
+ })()];
262
+ }
263
+ });
14
264
  }
15
- `), j = /* @__PURE__ */ h("<div>"), F = /* @__PURE__ */ h('<div style="animation:snakeBreathing 1.5s ease-in-out infinite">');
16
- const u = {
17
- sm: {
18
- grid: "w-6 h-6",
19
- cell: "w-1.5 h-1.5",
20
- center: "w-1 h-1"
21
- },
22
- md: {
23
- grid: "w-9 h-9",
24
- cell: "w-2.5 h-2.5",
25
- center: "w-2 h-2"
26
- },
27
- lg: {
28
- grid: "w-12 h-12",
29
- cell: "w-3 h-3",
30
- center: "w-2.5 h-2.5"
31
- }
32
- }, b = {
33
- slow: 200,
34
- normal: 120,
35
- fast: 80
36
- }, f = [
37
- [100, 1.1],
38
- // head: full opacity, slightly larger
39
- [85, 1.05],
40
- // trail 1: smooth transition
41
- [65, 1],
42
- // trail 2
43
- [40, 0.95]
44
- // trail 3: fading out
45
- ];
46
- function q(l) {
47
- const c = () => l.size ?? "md", v = () => l.speed ?? "normal", i = [0, 1, 2, 5, 8, 7, 6, 3], [k, C] = P(0);
48
- S(() => {
49
- const t = setInterval(() => {
50
- C((n) => (n + 1) % i.length);
51
- }, b[v()]);
52
- B(() => clearInterval(t));
265
+ }), null), I(() => E(N, S("flex items-center gap-1.5 w-full text-left text-xs py-1.5 px-2 cursor-pointer", "transition-colors duration-100", "hover:bg-accent/60", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring", i() === "/" && "bg-accent text-accent-foreground font-medium"))), e;
266
+ }
53
267
  });
54
- const _ = (t) => {
55
- const n = k();
56
- for (let r = 0; r < f.length; r++)
57
- if (i[(n + i.length - r) % i.length] === t) return r;
58
- return -1;
268
+ }
269
+ function Z(t) {
270
+ const i = () => t.expandedPaths().has(t.item.path), d = () => t.selectedPath() === t.item.path, x = () => t.isSelectable(t.item), g = B(() => {
271
+ var f;
272
+ return ((f = t.item.children) == null ? void 0 : f.filter((b) => b.type === "folder")) ?? [];
273
+ }), k = () => g().length > 0, D = (f) => {
274
+ f.stopPropagation(), t.onToggle(t.item.path);
275
+ }, O = () => {
276
+ t.onSelect(t.item);
59
277
  };
60
278
  return (() => {
61
- var t = M(), n = t.firstChild;
62
- return $(t, z(L, {
63
- each: [0, 1, 2, 3, 4, 5, 6, 7, 8],
64
- children: (r) => {
65
- const o = r === 4, a = () => o ? -1 : _(r);
66
- return (() => {
67
- var s = j();
68
- return $(s, o && (() => {
69
- var e = F();
70
- return m(() => d(e, g("rounded-sm bg-primary", u[c()].center))), e;
71
- })()), m((e) => {
72
- var y, w;
73
- var p = g("flex items-center justify-center rounded-sm", u[c()].cell, o && "bg-transparent"), x = o ? {} : {
74
- "background-color": a() >= 0 ? `color-mix(in srgb, var(--primary) ${((y = f[a()]) == null ? void 0 : y[0]) ?? 0}%, transparent)` : "var(--muted)",
75
- transform: `scale(${a() >= 0 ? ((w = f[a()]) == null ? void 0 : w[1]) ?? 1 : 1})`,
76
- "transition-property": "background-color, transform",
77
- "transition-duration": `${b[v()] * 0.9}ms`,
78
- "transition-timing-function": "ease-out"
79
- };
80
- return p !== e.e && d(s, e.e = p), e.t = I(s, x, e.t), e;
81
- }, {
82
- e: void 0,
83
- t: void 0
84
- }), s;
85
- })();
279
+ var f = ke(), b = f.firstChild, m = b.firstChild, P = m.firstChild, w = P.nextSibling;
280
+ return o(b, r(y, {
281
+ get when() {
282
+ return k();
283
+ },
284
+ get fallback() {
285
+ return Pe();
286
+ },
287
+ get children() {
288
+ var l = Y();
289
+ return l.$$click = D, o(l, r(Q, {
290
+ class: "w-3 h-3 opacity-60"
291
+ })), I((h) => {
292
+ var C = S("flex-shrink-0 w-4 h-4 flex items-center justify-center cursor-pointer", "transition-transform duration-150", i() && "rotate-90", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring"), p = i() ? "Collapse folder" : "Expand folder";
293
+ return C !== h.e && E(l, h.e = C), p !== h.t && J(l, "aria-label", h.t = p), h;
294
+ }, {
295
+ e: void 0,
296
+ t: void 0
297
+ }), l;
298
+ }
299
+ }), m), m.$$click = O, o(P, r(y, {
300
+ get when() {
301
+ return W(() => !!k())() && i();
302
+ },
303
+ get fallback() {
304
+ return r(ve, {
305
+ class: "w-4 h-4"
306
+ });
307
+ },
308
+ get children() {
309
+ return r(U, {
310
+ class: "w-4 h-4"
311
+ });
312
+ }
313
+ })), o(w, () => t.item.name), o(f, r(y, {
314
+ get when() {
315
+ return W(() => !!i())() && k();
316
+ },
317
+ get children() {
318
+ var l = Se();
319
+ return o(l, r(A, {
320
+ get each() {
321
+ return g();
322
+ },
323
+ children: (h) => r(Z, {
324
+ item: h,
325
+ get depth() {
326
+ return t.depth + 1;
327
+ },
328
+ get selectedPath() {
329
+ return t.selectedPath;
330
+ },
331
+ get expandedPaths() {
332
+ return t.expandedPaths;
333
+ },
334
+ get onToggle() {
335
+ return t.onToggle;
336
+ },
337
+ get onSelect() {
338
+ return t.onSelect;
339
+ },
340
+ get isSelectable() {
341
+ return t.isSelectable;
342
+ }
343
+ })
344
+ })), l;
86
345
  }
87
- }), n), m(() => d(t, g("grid grid-cols-3 gap-1", u[c()].grid, l.class))), t;
346
+ }), null), I((l) => {
347
+ var h = S("group flex items-center w-full text-xs", "transition-colors duration-100", x() ? "hover:bg-accent/60" : "opacity-50", d() && x() && "bg-accent text-accent-foreground font-medium"), C = `${4 + t.depth * 14}px`, p = !x(), z = S("flex items-center gap-1 flex-1 min-w-0 text-left py-1.5 pl-0.5 pr-2", x() ? "cursor-pointer" : "cursor-not-allowed", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring");
348
+ return h !== l.e && E(b, l.e = h), C !== l.t && de(b, "padding-left", l.t = C), p !== l.a && (m.disabled = l.a = p), z !== l.o && E(m, l.o = z), l;
349
+ }, {
350
+ e: void 0,
351
+ t: void 0,
352
+ a: void 0,
353
+ o: void 0
354
+ }), f;
88
355
  })();
89
356
  }
357
+ function R(t) {
358
+ const i = (t ?? "").trim();
359
+ if (i === "" || i === "/") return "/";
360
+ const d = i.replace(/\/+$/, "");
361
+ return d.startsWith("/") ? d : "/" + d;
362
+ }
363
+ function K(t) {
364
+ const i = t.split("/").filter(Boolean), d = [];
365
+ let x = "";
366
+ for (let g = 0; g < i.length - 1; g++)
367
+ x += "/" + i[g], d.push(x);
368
+ return d;
369
+ }
370
+ ue(["click"]);
90
371
  export {
91
- q as SnakeLoader
372
+ Oe as DirectoryPicker
92
373
  };
package/dist/index3.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { delegateEvents as h, template as u, insert as c, createComponent as r, effect as d, className as f, Dynamic as y, memo as x, setAttribute as m } from "solid-js/web";
2
2
  import { For as b, Show as v } from "solid-js";
3
- import { cn as g } from "./index67.js";
4
- import { deferNonBlocking as C } from "./index68.js";
3
+ import { cn as g } from "./index68.js";
4
+ import { deferNonBlocking as C } from "./index69.js";
5
5
  import { Tooltip as w } from "./index25.js";
6
6
  var k = /* @__PURE__ */ u('<div class="flex flex-col">'), A = /* @__PURE__ */ u('<div><div class="flex flex-col">'), $ = /* @__PURE__ */ u('<div class="absolute left-0 top-0 w-1 h-full bg-primary rounded-r">'), _ = /* @__PURE__ */ u("<span>"), I = /* @__PURE__ */ u("<button type=button>");
7
7
  function E(e) {
package/dist/index30.js CHANGED
@@ -1,42 +1,92 @@
1
- import { template as c, insert as n, createComponent as t, effect as m, className as o, Portal as u } from "solid-js/web";
2
- import { Show as l } from "solid-js";
3
- import { cn as s } from "./index67.js";
4
- import { SnakeLoader as f } from "./index29.js";
5
- var g = /* @__PURE__ */ c('<p class="text-sm text-muted-foreground">'), d = /* @__PURE__ */ c("<div>");
6
- function k(e) {
7
- const a = (() => {
8
- var r = d();
9
- return n(r, t(f, {
10
- size: "lg"
11
- }), null), n(r, t(l, {
12
- get when() {
13
- return e.message;
14
- },
15
- get children() {
16
- var i = g();
17
- return n(i, () => e.message), i;
18
- }
19
- }), null), m(() => o(r, s("flex flex-col items-center justify-center gap-4", "bg-background/80 backdrop-blur-sm", e.fullscreen ? "fixed inset-0 z-50" : "absolute inset-0", "animate-in fade-in", e.class))), r;
20
- })();
21
- return t(l, {
22
- get when() {
23
- return e.visible;
24
- },
25
- get children() {
26
- return t(l, {
27
- get when() {
28
- return e.fullscreen;
29
- },
30
- fallback: a,
31
- get children() {
32
- return t(u, {
33
- children: a
34
- });
1
+ import { template as h, insert as $, createComponent as z, effect as m, className as d, style as I } from "solid-js/web";
2
+ import { createSignal as P, onMount as S, onCleanup as B, For as L } from "solid-js";
3
+ import { cn as g } from "./index68.js";
4
+ var M = /* @__PURE__ */ h(`<div role=status aria-label=Loading><style>
5
+ @keyframes snakeBreathing {
6
+ 0%, 100% {
7
+ opacity: 0.5;
8
+ transform: scale(0.85);
9
+ }
10
+ 50% {
11
+ opacity: 1;
12
+ transform: scale(1);
13
+ }
35
14
  }
36
- });
37
- }
15
+ `), j = /* @__PURE__ */ h("<div>"), F = /* @__PURE__ */ h('<div style="animation:snakeBreathing 1.5s ease-in-out infinite">');
16
+ const u = {
17
+ sm: {
18
+ grid: "w-6 h-6",
19
+ cell: "w-1.5 h-1.5",
20
+ center: "w-1 h-1"
21
+ },
22
+ md: {
23
+ grid: "w-9 h-9",
24
+ cell: "w-2.5 h-2.5",
25
+ center: "w-2 h-2"
26
+ },
27
+ lg: {
28
+ grid: "w-12 h-12",
29
+ cell: "w-3 h-3",
30
+ center: "w-2.5 h-2.5"
31
+ }
32
+ }, b = {
33
+ slow: 200,
34
+ normal: 120,
35
+ fast: 80
36
+ }, f = [
37
+ [100, 1.1],
38
+ // head: full opacity, slightly larger
39
+ [85, 1.05],
40
+ // trail 1: smooth transition
41
+ [65, 1],
42
+ // trail 2
43
+ [40, 0.95]
44
+ // trail 3: fading out
45
+ ];
46
+ function q(l) {
47
+ const c = () => l.size ?? "md", v = () => l.speed ?? "normal", i = [0, 1, 2, 5, 8, 7, 6, 3], [k, C] = P(0);
48
+ S(() => {
49
+ const t = setInterval(() => {
50
+ C((n) => (n + 1) % i.length);
51
+ }, b[v()]);
52
+ B(() => clearInterval(t));
38
53
  });
54
+ const _ = (t) => {
55
+ const n = k();
56
+ for (let r = 0; r < f.length; r++)
57
+ if (i[(n + i.length - r) % i.length] === t) return r;
58
+ return -1;
59
+ };
60
+ return (() => {
61
+ var t = M(), n = t.firstChild;
62
+ return $(t, z(L, {
63
+ each: [0, 1, 2, 3, 4, 5, 6, 7, 8],
64
+ children: (r) => {
65
+ const o = r === 4, a = () => o ? -1 : _(r);
66
+ return (() => {
67
+ var s = j();
68
+ return $(s, o && (() => {
69
+ var e = F();
70
+ return m(() => d(e, g("rounded-sm bg-primary", u[c()].center))), e;
71
+ })()), m((e) => {
72
+ var y, w;
73
+ var p = g("flex items-center justify-center rounded-sm", u[c()].cell, o && "bg-transparent"), x = o ? {} : {
74
+ "background-color": a() >= 0 ? `color-mix(in srgb, var(--primary) ${((y = f[a()]) == null ? void 0 : y[0]) ?? 0}%, transparent)` : "var(--muted)",
75
+ transform: `scale(${a() >= 0 ? ((w = f[a()]) == null ? void 0 : w[1]) ?? 1 : 1})`,
76
+ "transition-property": "background-color, transform",
77
+ "transition-duration": `${b[v()] * 0.9}ms`,
78
+ "transition-timing-function": "ease-out"
79
+ };
80
+ return p !== e.e && d(s, e.e = p), e.t = I(s, x, e.t), e;
81
+ }, {
82
+ e: void 0,
83
+ t: void 0
84
+ }), s;
85
+ })();
86
+ }
87
+ }), n), m(() => d(t, g("grid grid-cols-3 gap-1", u[c()].grid, l.class))), t;
88
+ })();
39
89
  }
40
90
  export {
41
- k as LoadingOverlay
91
+ q as SnakeLoader
42
92
  };