@floegence/floe-webapp-core 0.48.5 → 0.49.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.
@@ -1,66 +1,58 @@
1
- import { createComponent as o, insert as a, use as B, effect as D, setAttribute as w, className as L, memo as R, template as b, delegateEvents as A } from "solid-js/web";
2
- import { createSignal as K, createMemo as j, Show as P, For as G } from "solid-js";
3
- import { cn as O } from "../../utils/cn.js";
4
- import { deferNonBlocking as H } from "../../utils/defer.js";
5
- import { Check as U } from "../icons/index.js";
6
- import { FileItemIcon as V } from "../file-browser/FileIcons.js";
7
- import { Button as E } from "./Button.js";
8
- import { Dialog as Y } from "./Dialog.js";
9
- import { usePickerTree as q, normalizePath as x, PathInputBar as J, PickerBreadcrumb as Q, PickerFolderTree as W, NewFolderSection as X, getParentPath as Z } from "./picker/PickerBase.js";
10
- var ee = /* @__PURE__ */ b('<div class="flex flex-col gap-2 -mt-1"><div class="flex min-h-[260px] flex-col overflow-hidden rounded border border-border sm:h-[300px] sm:flex-row"><div class="min-h-[140px] min-w-0 flex-1 overflow-y-auto"role=listbox>'), te = /* @__PURE__ */ b('<div class="flex items-center w-full gap-2"><span class="flex-1 text-[11px] text-muted-foreground truncate">'), ne = /* @__PURE__ */ b('<div class="flex h-full items-center justify-center px-4 text-center text-xs text-muted-foreground">'), re = /* @__PURE__ */ b('<span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[10px] text-primary-foreground">'), le = /* @__PURE__ */ b("<button type=button role=option><span class=truncate>");
11
- function ie(e, u) {
12
- const d = S(u), f = /* @__PURE__ */ new Set(), m = [];
13
- for (const n of e ?? []) {
14
- const h = x(n);
15
- if (!(h === "/" || f.has(h)) && (f.add(h), m.push(h), m.length >= d))
1
+ import { createComponent as u, insert as m, mergeProps as z, spread as K, use as L, effect as j, setAttribute as M, className as V, memo as H, template as b, delegateEvents as R } from "solid-js/web";
2
+ import { createSignal as U, mergeProps as Y, createMemo as q, Show as w, For as G } from "solid-js";
3
+ import { cn as N } from "../../utils/cn.js";
4
+ import { deferNonBlocking as J } from "../../utils/defer.js";
5
+ import { Check as Q } from "../icons/index.js";
6
+ import { FileItemIcon as W } from "../file-browser/FileIcons.js";
7
+ import { Button as D } from "./Button.js";
8
+ import { Dialog as X } from "./Dialog.js";
9
+ import { usePickerNavigation as Z, PickerPanel as ee, normalizePath as k, pickerCopy as v } from "./picker/PickerBase.js";
10
+ import { pickerParentPath as te } from "./picker/PickerNavigation.js";
11
+ var ne = /* @__PURE__ */ b('<div class="flex flex-col gap-2 -mt-1"><div class="flex min-h-[140px] overflow-hidden rounded border border-border"><div>'), ie = /* @__PURE__ */ b('<div class="flex items-center w-full gap-2"><span class="flex-1 text-[11px] text-muted-foreground truncate">'), le = /* @__PURE__ */ b('<div class="flex h-full items-center justify-center px-4 text-center text-xs text-muted-foreground">'), re = /* @__PURE__ */ b('<span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[10px] text-primary-foreground">'), oe = /* @__PURE__ */ b("<button type=button role=option><span class=truncate>");
12
+ function ae(e, o) {
13
+ const a = y(o), f = /* @__PURE__ */ new Set(), c = [];
14
+ for (const g of e ?? []) {
15
+ const s = k(g);
16
+ if (!(s === "/" || f.has(s)) && (f.add(s), c.push(s), c.length >= a))
16
17
  break;
17
18
  }
18
- return m;
19
+ return c;
19
20
  }
20
- function oe(e, u, d, f) {
21
- const m = x(u);
22
- if (m === "/") return [...e];
23
- if (d === "single") return [m];
24
- const n = e.indexOf(m);
25
- return n >= 0 ? e.filter((h, v) => v !== n) : e.length >= S(f) ? [...e] : [...e, m];
21
+ function ce(e, o, a, f) {
22
+ const c = k(o);
23
+ if (c === "/") return [...e];
24
+ if (a === "single") return [c];
25
+ const g = e.indexOf(c);
26
+ return g >= 0 ? e.filter((s, h) => h !== g) : e.length >= y(f) ? [...e] : [...e, c];
26
27
  }
27
- function S(e) {
28
+ function y(e) {
28
29
  return e == null || !Number.isFinite(e) ? Number.POSITIVE_INFINITY : Math.max(1, Math.floor(e));
29
30
  }
30
- function xe(e) {
31
- const u = () => e.selectionMode ?? "single", [d, f] = K([]), n = q({
32
- initialPath: () => {
33
- if (e.initialPath) return e.initialPath;
34
- const t = e.initialSelectedPaths?.[0];
35
- return t ? Z(t) : "/";
31
+ function ke(e) {
32
+ const o = () => e.selectionMode ?? "single", [a, f] = U([]), c = () => {
33
+ if (e.initialPath) return e.initialPath;
34
+ const t = e.initialSelectedPaths?.[0];
35
+ return t ? te(t) : void 0;
36
+ }, g = Y(e, {
37
+ get initialPath() {
38
+ return c();
36
39
  },
37
- open: () => e.open,
38
- files: () => e.files,
39
- // eslint-disable-next-line solid/reactivity -- filter is a static callback
40
- filter: e.filter ? (t) => e.filter(t) : void 0,
41
- // eslint-disable-next-line solid/reactivity -- onExpand is a static callback
42
- onExpand: e.onExpand,
43
- // eslint-disable-next-line solid/reactivity -- ensurePath is a static callback
44
- ensurePath: e.ensurePath,
45
- homeLabel: () => e.homeLabel,
46
- homePath: () => e.homePath,
47
- onReset: () => {
48
- f(ie(e.initialSelectedPaths, u() === "single" ? 1 : e.maxSelections));
40
+ get scopeKey() {
41
+ return e.scopeKey;
49
42
  }
50
- }), h = j(() => {
51
- const t = x(n.selectedPath());
52
- return (t === "/" ? e.files : n.folderIndex().get(t)?.children ?? []).filter((r) => r.type === "file" && (!e.fileFilter || e.fileFilter(r)));
53
- }), v = (t) => d().indexOf(x(t)), T = () => u() === "multiple" && d().length >= S(e.maxSelections), z = (t) => {
54
- f((i) => oe(i, t.path, u(), e.maxSelections));
55
- }, y = (t = d()) => {
56
- if (t.length === 0 || n.pathPending()) return;
57
- const i = e.onSelect;
58
- e.onOpenChange(!1), H(() => i([...t]));
59
- }, M = (t, i) => {
60
- let r;
61
- t.key === "ArrowDown" && (r = Math.min(i + 1, h().length - 1)), t.key === "ArrowUp" && (r = Math.max(i - 1, 0)), t.key === "Home" && (r = 0), t.key === "End" && (r = h().length - 1), !(r == null || r < 0) && (t.preventDefault(), k[r]?.focus());
62
- }, k = [];
63
- return o(Y, {
43
+ }), s = Z(g, () => e.open, void 0, () => {
44
+ f(ae(e.initialSelectedPaths, o() === "single" ? 1 : e.maxSelections));
45
+ }), h = q(() => s.entries().filter((t) => t.type === "file" && (!e.fileFilter || e.fileFilter(t)))), T = (t) => a().indexOf(k(t)), A = () => o() === "multiple" && a().length >= y(e.maxSelections), B = (t) => {
46
+ f((r) => ce(r, t.path, o(), e.maxSelections));
47
+ }, P = (t = a()) => {
48
+ if (t.length === 0 || !s.valid()) return;
49
+ const r = e.onSelect;
50
+ e.onOpenChange(!1), J(() => r([...t]));
51
+ }, E = (t, r) => {
52
+ let i;
53
+ t.key === "ArrowDown" && (i = Math.min(r + 1, h().length - 1)), t.key === "ArrowUp" && (i = Math.max(r - 1, 0)), t.key === "Home" && (i = 0), t.key === "End" && (i = h().length - 1), !(i == null || i < 0) && (t.preventDefault(), S[i]?.focus());
54
+ }, S = [];
55
+ return u(X, {
64
56
  get open() {
65
57
  return e.open;
66
58
  },
@@ -71,27 +63,27 @@ function xe(e) {
71
63
  return e.title ?? "Select File";
72
64
  },
73
65
  get class() {
74
- return O("max-w-2xl", e.class);
66
+ return N("max-w-2xl", e.class);
75
67
  },
76
68
  get footer() {
77
69
  return (() => {
78
- var t = te(), i = t.firstChild;
79
- return a(i, (() => {
80
- var r = R(() => d().length === 0);
81
- return () => r() ? "No files selected" : `${d().length} selected`;
82
- })()), a(t, o(E, {
70
+ var t = ie(), r = t.firstChild;
71
+ return m(r, (() => {
72
+ var i = H(() => a().length === 0);
73
+ return () => i() ? v(e).noFilesSelected : v(e).selectedCount(a().length);
74
+ })()), m(t, u(D, {
83
75
  variant: "ghost",
84
76
  size: "sm",
85
77
  onClick: () => e.onOpenChange(!1),
86
78
  get children() {
87
- return e.cancelText ?? "Cancel";
79
+ return e.cancelText ?? v(e).cancel;
88
80
  }
89
- }), null), a(t, o(E, {
81
+ }), null), m(t, u(D, {
90
82
  variant: "primary",
91
83
  size: "sm",
92
- onClick: () => y(),
84
+ onClick: () => P(),
93
85
  get disabled() {
94
- return d().length === 0 || n.pathPending();
86
+ return a().length === 0 || !s.valid();
95
87
  },
96
88
  get children() {
97
89
  return e.confirmText ?? "Select";
@@ -100,145 +92,81 @@ function xe(e) {
100
92
  })();
101
93
  },
102
94
  get children() {
103
- var t = ee(), i = t.firstChild, r = i.firstChild;
104
- return a(t, o(J, {
105
- get value() {
106
- return n.pathInput;
107
- },
108
- onInput: (s) => {
109
- n.setPathInput(s), n.setPathInputError("");
110
- },
111
- get pending() {
112
- return n.pathPending;
113
- },
114
- get error() {
115
- return n.pathInputError;
116
- },
117
- get onGo() {
118
- return n.handlePathInputGo;
119
- },
120
- get onKeyDown() {
121
- return n.handlePathInputKeyDown;
122
- }
123
- }), i), a(t, o(Q, {
124
- get segments() {
125
- return n.breadcrumbSegments;
126
- },
127
- get onClick() {
128
- return n.handleBreadcrumbClick;
95
+ var t = ne(), r = t.firstChild, i = r.firstChild;
96
+ return m(t, u(ee, z(e, {
97
+ source: s
98
+ })), r), K(i, z(() => e.scrollViewportProps, {
99
+ class: "max-h-[200px] min-h-[140px] min-w-0 flex-1 overflow-y-auto",
100
+ role: "listbox",
101
+ get "aria-multiselectable"() {
102
+ return o() === "multiple" ? "true" : void 0;
129
103
  }
130
- }), i), a(i, o(W, {
131
- get rootFolders() {
132
- return n.rootFolders;
133
- },
134
- get selectedPath() {
135
- return n.selectedPath;
136
- },
137
- get expandedPaths() {
138
- return n.expandedPaths;
139
- },
140
- get revealNonce() {
141
- return n.revealNonce;
142
- },
143
- get onToggle() {
144
- return n.toggleExpand;
145
- },
146
- get onSelect() {
147
- return n.handleSelectFolder;
148
- },
149
- get onSelectRoot() {
150
- return n.handleSelectRoot;
151
- },
152
- get isSelectable() {
153
- return n.isSelectable;
154
- },
155
- get homeLabel() {
156
- return n.homeLabel;
157
- },
158
- class: "min-h-[120px] min-w-0 border-0 border-b border-border rounded-none sm:h-full sm:w-1/2 sm:border-b-0 sm:border-r"
159
- }), r), a(r, o(P, {
104
+ }), !1, !0), m(i, u(w, {
160
105
  get when() {
161
106
  return h().length > 0;
162
107
  },
163
108
  get fallback() {
164
109
  return (() => {
165
- var s = ne();
166
- return a(s, () => e.emptyText ?? "No matching files in this directory"), s;
110
+ var d = le();
111
+ return m(d, () => e.emptyText ?? v(e).emptyFiles), d;
167
112
  })();
168
113
  },
169
114
  get children() {
170
- return o(G, {
115
+ return u(G, {
171
116
  get each() {
172
117
  return h();
173
118
  },
174
- children: (s, F) => {
175
- const g = () => v(s.path), I = () => T() && g() < 0;
119
+ children: (d, $) => {
120
+ const x = () => T(d.path), F = () => A() && x() < 0;
176
121
  return (() => {
177
- var c = le(), C = c.firstChild;
178
- return c.$$keydown = (l) => M(l, F()), c.$$dblclick = () => {
179
- u() === "single" && y([x(s.path)]);
180
- }, c.$$click = () => z(s), B((l) => {
181
- k[F()] = l;
182
- }, c), a(c, o(V, {
183
- item: s,
122
+ var l = oe(), C = l.firstChild;
123
+ return l.$$keydown = (n) => E(n, $()), l.$$dblclick = () => {
124
+ o() === "single" && P([k(d.path)]);
125
+ }, l.$$click = () => B(d), L((n) => {
126
+ S[$()] = n;
127
+ }, l), m(l, u(W, {
128
+ item: d,
184
129
  class: "w-4 h-4 flex-shrink-0"
185
- }), C), a(C, () => s.name), a(c, o(P, {
130
+ }), C), m(C, () => d.name), m(l, u(w, {
186
131
  get when() {
187
- return g() >= 0;
132
+ return x() >= 0;
188
133
  },
189
134
  get children() {
190
- var l = re();
191
- return a(l, o(P, {
135
+ var n = re();
136
+ return m(n, u(w, {
192
137
  get when() {
193
- return u() === "multiple";
138
+ return o() === "multiple";
194
139
  },
195
140
  get fallback() {
196
- return o(U, {
141
+ return u(Q, {
197
142
  class: "h-3 w-3"
198
143
  });
199
144
  },
200
145
  get children() {
201
- return g() + 1;
146
+ return x() + 1;
202
147
  }
203
- })), l;
148
+ })), n;
204
149
  }
205
- }), null), D((l) => {
206
- var $ = g() >= 0, p = I(), _ = I() ? "Selection limit reached" : s.name, N = O("flex min-h-9 w-full items-center gap-2 px-2 py-1.5 text-left text-xs", "transition-colors duration-100 hover:bg-accent/60", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-45", g() >= 0 && "bg-accent text-accent-foreground font-medium");
207
- return $ !== l.e && w(c, "aria-selected", l.e = $), p !== l.t && (c.disabled = l.t = p), _ !== l.a && w(c, "title", l.a = _), N !== l.o && L(c, l.o = N), l;
150
+ }), null), j((n) => {
151
+ var _ = x() >= 0, I = F(), O = F() ? v(e).selectionLimit : d.name, p = N("flex min-h-9 w-full cursor-pointer items-center gap-2 px-2 py-1.5 text-left text-xs", "transition-colors duration-100 hover:bg-accent/60", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-45", x() >= 0 && "bg-accent text-accent-foreground font-medium");
152
+ return _ !== n.e && M(l, "aria-selected", n.e = _), I !== n.t && (l.disabled = n.t = I), O !== n.a && M(l, "title", n.a = O), p !== n.o && V(l, n.o = p), n;
208
153
  }, {
209
154
  e: void 0,
210
155
  t: void 0,
211
156
  a: void 0,
212
157
  o: void 0
213
- }), c;
158
+ }), l;
214
159
  })();
215
160
  }
216
161
  });
217
162
  }
218
- })), a(t, o(P, {
219
- get when() {
220
- return e.onCreateFolder;
221
- },
222
- get children() {
223
- return o(X, {
224
- get parentPath() {
225
- return n.selectedPath;
226
- },
227
- get onCreateFolder() {
228
- return e.onCreateFolder;
229
- },
230
- get toDisplayPath() {
231
- return n.toDisplayPath;
232
- }
233
- });
234
- }
235
- }), null), D(() => w(r, "aria-multiselectable", u() === "multiple" ? "true" : void 0)), t;
163
+ })), t;
236
164
  }
237
165
  });
238
166
  }
239
- A(["click", "dblclick", "keydown"]);
167
+ R(["click", "dblclick", "keydown"]);
240
168
  export {
241
- xe as FileOpenPicker,
242
- ie as normalizeFileOpenSelection,
243
- oe as updateFileOpenSelection
169
+ ke as FileOpenPicker,
170
+ ae as normalizeFileOpenSelection,
171
+ ce as updateFileOpenSelection
244
172
  };
@@ -1,65 +1,47 @@
1
- import { createComponent as i, insert as a, effect as b, className as N, setAttribute as y, template as h, delegateEvents as I } from "solid-js/web";
2
- import { createSignal as F, createMemo as $, createEffect as E, on as D, Show as g, For as B } from "solid-js";
3
- import { cn as p } from "../../utils/cn.js";
4
- import { Dialog as z } from "./Dialog.js";
5
- import { Button as C } from "./Button.js";
6
- import { Input as T } from "./Input.js";
7
- import { FileItemIcon as K } from "../file-browser/FileIcons.js";
8
- import { deferNonBlocking as L } from "../../utils/defer.js";
9
- import { usePickerTree as O, normalizePath as R, PathInputBar as G, PickerBreadcrumb as M, PickerFolderTree as j, NewFolderSection as q } from "./picker/PickerBase.js";
10
- var A = /* @__PURE__ */ h('<div class="flex flex-col gap-2 -mt-1"><div class="flex border border-border rounded overflow-hidden"style=height:260px><div class="w-1/2 min-w-0 overflow-y-auto">'), H = /* @__PURE__ */ h('<div class="flex flex-col w-full gap-2"><div class="flex items-center gap-1.5"><label class="text-xs text-muted-foreground flex-shrink-0">File name:</label><div class=flex-1></div></div><div class="flex items-center gap-2"><span class="flex-1 text-[11px] text-muted-foreground truncate">'), J = /* @__PURE__ */ h('<div class="flex items-center justify-center h-full text-xs text-muted-foreground">No files in this directory'), Q = /* @__PURE__ */ h('<span class="ml-auto text-[10px] text-muted-foreground/60 flex-shrink-0">'), U = /* @__PURE__ */ h("<button type=button><span class=truncate>");
11
- function ie(e) {
12
- const [u, f] = F(e.initialFileName ?? ""), [w, s] = F(""), t = O({
13
- initialPath: () => e.initialPath,
14
- open: () => e.open,
15
- files: () => e.files,
16
- // eslint-disable-next-line solid/reactivity -- filter is a static callback
17
- filter: e.filter ? (r) => e.filter(r) : void 0,
18
- // eslint-disable-next-line solid/reactivity -- onExpand is a static callback
19
- onExpand: e.onExpand,
20
- // eslint-disable-next-line solid/reactivity -- ensurePath is a static callback
21
- ensurePath: e.ensurePath,
22
- homeLabel: () => e.homeLabel,
23
- homePath: () => e.homePath,
24
- onReset: () => {
25
- f(e.initialFileName ?? ""), s("");
26
- }
27
- }), x = $(() => {
28
- const r = R(t.selectedPath());
29
- if (r === "/")
30
- return e.files.filter((o) => o.type === "file");
31
- const n = t.folderIndex().get(r);
32
- return n?.children ? n.children.filter((o) => o.type === "file") : [];
33
- });
34
- E(D(u, () => {
35
- s("");
1
+ import { createComponent as a, insert as n, mergeProps as _, spread as z, effect as F, className as B, setAttribute as E, template as m, delegateEvents as D } from "solid-js/web";
2
+ import { createSignal as C, createMemo as k, createEffect as I, on as O, Show as w, For as K } from "solid-js";
3
+ import { cn as N } from "../../utils/cn.js";
4
+ import { Dialog as T } from "./Dialog.js";
5
+ import { Button as b } from "./Button.js";
6
+ import { Input as M } from "./Input.js";
7
+ import { FileItemIcon as j } from "../file-browser/FileIcons.js";
8
+ import { deferNonBlocking as q } from "../../utils/defer.js";
9
+ import { usePickerNavigation as A, PickerPanel as R, pickerCopy as g } from "./picker/PickerBase.js";
10
+ var V = /* @__PURE__ */ m('<div class="flex flex-col gap-2 -mt-1"><div class="flex min-h-[100px] overflow-hidden rounded border border-border"><div>'), G = /* @__PURE__ */ m('<div class="flex flex-col w-full gap-2"><div class="flex items-center gap-1.5"><label class="text-xs text-muted-foreground flex-shrink-0"></label><div class=flex-1></div></div><div class="flex items-center gap-2"><span class="flex-1 text-[11px] text-muted-foreground truncate">'), H = /* @__PURE__ */ m('<div class="flex items-center justify-center h-full text-xs text-muted-foreground">'), J = /* @__PURE__ */ m('<span class="ml-auto text-[10px] text-muted-foreground/60 flex-shrink-0">'), L = /* @__PURE__ */ m("<button type=button><span class=truncate>");
11
+ function le(e) {
12
+ const [c, x] = C(e.initialFileName ?? ""), [p, u] = C(""), s = A(e, () => e.open, void 0, () => {
13
+ x(e.initialFileName ?? ""), u("");
14
+ }), h = k(() => s.entries().filter((t) => t.type === "file"));
15
+ I(O(c, () => {
16
+ u("");
36
17
  }));
37
- const S = (r) => {
38
- f(r.name), s("");
18
+ const S = (t) => {
19
+ x(t.name), u("");
39
20
  }, v = () => {
40
- const r = u().trim();
41
- if (!r) {
42
- s("Filename is required");
21
+ if (!s.valid()) return;
22
+ const t = c().trim();
23
+ if (!t) {
24
+ u(g(e).fileNameRequired);
43
25
  return;
44
26
  }
45
27
  if (e.validateFileName) {
46
- const l = e.validateFileName(r);
47
- if (l) {
48
- s(l);
28
+ const r = e.validateFileName(t);
29
+ if (r) {
30
+ u(r);
49
31
  return;
50
32
  }
51
33
  }
52
- const n = t.selectedPath(), o = e.onSave;
53
- e.onOpenChange(!1), L(() => o(n, r));
54
- }, k = () => {
34
+ const l = s.currentPath(), o = e.onSave;
35
+ e.onOpenChange(!1), q(() => o(l, t));
36
+ }, P = () => {
55
37
  e.onOpenChange(!1);
56
- }, _ = (r) => {
57
- r.key === "Enter" && (r.preventDefault(), v());
58
- }, P = $(() => {
59
- const r = t.toDisplayPath(t.selectedPath()), n = u().trim();
60
- return n ? r === "/" ? `/${n}` : `${r}/${n}` : r;
38
+ }, y = (t) => {
39
+ t.key === "Enter" && (t.preventDefault(), v());
40
+ }, $ = k(() => {
41
+ const t = s.currentPath(), l = c().trim();
42
+ return l ? t === "/" ? `/${l}` : `${t}/${l}` : t;
61
43
  });
62
- return i(z, {
44
+ return a(T, {
63
45
  get open() {
64
46
  return e.open;
65
47
  },
@@ -70,157 +52,88 @@ function ie(e) {
70
52
  return e.title ?? "Save File";
71
53
  },
72
54
  get class() {
73
- return p("max-w-2xl", e.class);
55
+ return N("max-w-2xl", e.class);
74
56
  },
75
57
  get footer() {
76
58
  return (() => {
77
- var r = H(), n = r.firstChild, o = n.firstChild, l = o.nextSibling, c = n.nextSibling, d = c.firstChild;
78
- return a(l, i(T, {
59
+ var t = G(), l = t.firstChild, o = l.firstChild, r = o.nextSibling, i = l.nextSibling, f = i.firstChild;
60
+ return n(o, () => g(e).fileName), n(r, a(M, {
79
61
  size: "sm",
80
62
  get value() {
81
- return u();
63
+ return c();
82
64
  },
83
- onInput: (m) => f(m.currentTarget.value),
84
- onKeyDown: _,
65
+ onInput: (d) => x(d.currentTarget.value),
66
+ onKeyDown: y,
85
67
  placeholder: "filename.ext",
86
68
  get error() {
87
- return w();
69
+ return p();
88
70
  }
89
- })), a(d, P), a(c, i(C, {
71
+ })), n(f, $), n(i, a(b, {
90
72
  variant: "ghost",
91
73
  size: "sm",
92
- onClick: k,
74
+ onClick: P,
93
75
  get children() {
94
- return e.cancelText ?? "Cancel";
76
+ return e.cancelText ?? g(e).cancel;
95
77
  }
96
- }), null), a(c, i(C, {
78
+ }), null), n(i, a(b, {
97
79
  variant: "primary",
98
80
  size: "sm",
99
81
  onClick: v,
100
82
  get disabled() {
101
- return !u().trim() || t.pathPending();
83
+ return !c().trim() || !s.valid();
102
84
  },
103
85
  get children() {
104
86
  return e.confirmText ?? "Save";
105
87
  }
106
- }), null), b(() => y(d, "title", P())), r;
88
+ }), null), F(() => E(f, "title", $())), t;
107
89
  })();
108
90
  },
109
91
  get children() {
110
- var r = A(), n = r.firstChild, o = n.firstChild;
111
- return a(r, i(G, {
112
- get value() {
113
- return t.pathInput;
114
- },
115
- onInput: (l) => {
116
- t.setPathInput(l), t.setPathInputError("");
117
- },
118
- get pending() {
119
- return t.pathPending;
120
- },
121
- get error() {
122
- return t.pathInputError;
123
- },
124
- get onGo() {
125
- return t.handlePathInputGo;
126
- },
127
- get onKeyDown() {
128
- return t.handlePathInputKeyDown;
129
- }
130
- }), n), a(r, i(M, {
131
- get segments() {
132
- return t.breadcrumbSegments;
133
- },
134
- get onClick() {
135
- return t.handleBreadcrumbClick;
136
- }
137
- }), n), a(n, i(j, {
138
- get rootFolders() {
139
- return t.rootFolders;
140
- },
141
- get selectedPath() {
142
- return t.selectedPath;
143
- },
144
- get expandedPaths() {
145
- return t.expandedPaths;
146
- },
147
- get revealNonce() {
148
- return t.revealNonce;
149
- },
150
- get onToggle() {
151
- return t.toggleExpand;
152
- },
153
- get onSelect() {
154
- return t.handleSelectFolder;
155
- },
156
- get onSelectRoot() {
157
- return t.handleSelectRoot;
158
- },
159
- get isSelectable() {
160
- return t.isSelectable;
161
- },
162
- get homeLabel() {
163
- return t.homeLabel;
164
- },
165
- class: "w-1/2 min-w-0 border-r border-border border-0 rounded-none",
166
- style: {
167
- "max-height": "none",
168
- "min-height": "0"
169
- }
170
- }), o), a(o, i(g, {
92
+ var t = V(), l = t.firstChild, o = l.firstChild;
93
+ return n(t, a(R, _(e, {
94
+ source: s
95
+ })), l), z(o, _(() => e.scrollViewportProps, {
96
+ class: "max-h-[160px] w-full min-w-0 overflow-y-auto"
97
+ }), !1, !0), n(o, a(w, {
171
98
  get when() {
172
- return x().length > 0;
99
+ return h().length > 0;
173
100
  },
174
101
  get fallback() {
175
- return J();
102
+ return (() => {
103
+ var r = H();
104
+ return n(r, () => g(e).emptyFiles), r;
105
+ })();
176
106
  },
177
107
  get children() {
178
- return i(B, {
108
+ return a(K, {
179
109
  get each() {
180
- return x();
110
+ return h();
181
111
  },
182
- children: (l) => (() => {
183
- var c = U(), d = c.firstChild;
184
- return c.$$click = () => S(l), a(c, i(K, {
185
- item: l,
112
+ children: (r) => (() => {
113
+ var i = L(), f = i.firstChild;
114
+ return i.$$click = () => S(r), n(i, a(j, {
115
+ item: r,
186
116
  class: "w-4 h-4 flex-shrink-0"
187
- }), d), a(d, () => l.name), a(c, i(g, {
117
+ }), f), n(f, () => r.name), n(i, a(w, {
188
118
  get when() {
189
- return l.size != null;
119
+ return r.size != null;
190
120
  },
191
121
  get children() {
192
- var m = Q();
193
- return a(m, () => V(l.size)), m;
122
+ var d = J();
123
+ return n(d, () => Q(r.size)), d;
194
124
  }
195
- }), null), b(() => N(c, p("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", u() === l.name && "bg-accent text-accent-foreground font-medium"))), c;
125
+ }), null), F(() => B(i, N("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", c() === r.name && "bg-accent text-accent-foreground font-medium"))), i;
196
126
  })()
197
127
  });
198
128
  }
199
- })), a(r, i(g, {
200
- get when() {
201
- return e.onCreateFolder;
202
- },
203
- get children() {
204
- return i(q, {
205
- get parentPath() {
206
- return t.selectedPath;
207
- },
208
- get onCreateFolder() {
209
- return e.onCreateFolder;
210
- },
211
- get toDisplayPath() {
212
- return t.toDisplayPath;
213
- }
214
- });
215
- }
216
- }), null), r;
129
+ })), t;
217
130
  }
218
131
  });
219
132
  }
220
- function V(e) {
133
+ function Q(e) {
221
134
  return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
222
135
  }
223
- I(["click"]);
136
+ D(["click"]);
224
137
  export {
225
- ie as FileSavePicker
138
+ le as FileSavePicker
226
139
  };