@floegence/floe-webapp-core 0.86.65 → 0.86.68

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,42 +1,43 @@
1
- import { insert as s, createComponent as l, use as H, setAttribute as v, effect as P, className as ce, memo as C, spread as te, mergeProps as re, template as f, delegateEvents as de } from "solid-js/web";
2
- import { createSignal as E, createEffect as T, on as ae, untrack as ue, createMemo as V, createUniqueId as ve, Show as h, For as N } from "solid-js";
3
- import { cn as L } from "../../../utils/cn.js";
4
- import { FileItemIcon as ge } from "../../file-browser/FileIcons.js";
5
- import { FolderOpen as le, ChevronRight as q } from "../../icons/index.js";
6
- import { Button as z } from "../Button.js";
7
- import { Input as U } from "../Input.js";
8
- import { PickerDirectoryRow as ie, DirectoryFavoriteButton as fe } from "./DirectoryFavorites.js";
9
- import { resolveTabNavigationTargetId as he } from "../Tabs.js";
10
- import { createFilesystemPickerDataSource as be, parsePickerPath as j, defaultPickerCopy as me, PickerNavigationError as we } from "./PickerNavigation.js";
11
- import { pickerParentPath as Xe } from "./PickerNavigation.js";
12
- var xe = /* @__PURE__ */ f('<div role=tablist class="mb-1 flex min-w-0 items-center gap-4 border-b border-[var(--floe-line)]">'), ye = /* @__PURE__ */ f('<div class="flex min-w-0 items-start gap-1.5"><div class="min-w-0 flex-1">'), ke = /* @__PURE__ */ f('<div role=alert class="flex items-center gap-2 text-xs text-error"><span class="min-w-0 flex-1 break-words">'), $e = /* @__PURE__ */ f('<div class="flex items-start gap-2 rounded-xs border border-error/30 bg-error/5 px-2 py-1.5 text-xs"role=alert><span class="min-w-0 flex-1 break-words">'), O = /* @__PURE__ */ f("<div>"), pe = /* @__PURE__ */ f('<div class="flex min-w-0 flex-col gap-2"data-filesystem-picker><div class="flex min-w-0 flex-col gap-2">'), Pe = /* @__PURE__ */ f('<div class="flex flex-wrap items-center gap-1">'), _e = /* @__PURE__ */ f("<button type=button role=tab>"), Fe = /* @__PURE__ */ f('<nav class="flex min-w-0 flex-wrap items-center gap-0.5 text-xs">'), Ce = /* @__PURE__ */ f("<span role=status>"), Ie = /* @__PURE__ */ f('<div class="flex flex-wrap items-center justify-between gap-2 text-xs text-[var(--floe-ink-soft)]"><label class="flex cursor-pointer items-center gap-1.5"><input type=checkbox class=cursor-pointer>'), Ee = /* @__PURE__ */ f('<button type=button class="max-w-full cursor-pointer truncate rounded-xs px-1 py-0.5 hover:bg-[var(--floe-state-hover)] focus-visible:ring-1 focus-visible:ring-ring">'), ne = /* @__PURE__ */ f('<p class="px-3 py-6 text-center text-xs text-[var(--floe-ink-soft)]"role=status>'), ze = /* @__PURE__ */ f('<p class="px-3 py-6 text-center text-xs text-[var(--floe-ink-soft)]">'), Ae = /* @__PURE__ */ f('<button type=button class="flex min-h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-[var(--floe-state-selected)] focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="min-w-0 flex-1 truncate">'), Ve = /* @__PURE__ */ f('<button type=button class="flex min-h-14 min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-sm px-2 py-2.5 text-left hover:bg-[var(--floe-state-selected)] focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="truncate text-xs font-medium"></span><span class="truncate text-caption text-[var(--floe-ink-soft)]">'), De = /* @__PURE__ */ f('<div class="flex items-center gap-1.5">'), Re = /* @__PURE__ */ f('<p role=alert class="text-xs text-error">');
13
- function W(e) {
1
+ import { insert as s, createComponent as l, use as J, setAttribute as u, effect as p, className as fe, memo as z, spread as re, mergeProps as ie, template as m, delegateEvents as ge } from "solid-js/web";
2
+ import { createSignal as N, createEffect as R, on as W, untrack as ce, createMemo as j, createUniqueId as de, Show as w, For as U, onCleanup as ne } from "solid-js";
3
+ import { cn as Q } from "../../../utils/cn.js";
4
+ import { FileItemIcon as ve } from "../../file-browser/FileIcons.js";
5
+ import { FolderOpen as he, ChevronRight as X, FolderPlus as ae } from "../../icons/index.js";
6
+ import { Button as V } from "../Button.js";
7
+ import { Input as Y } from "../Input.js";
8
+ import { Popover as me } from "../Popover.js";
9
+ import { PickerDirectoryRow as le, DirectoryFavoriteButton as be } from "./DirectoryFavorites.js";
10
+ import { resolveTabNavigationTargetId as xe } from "../Tabs.js";
11
+ import { createFilesystemPickerDataSource as we, parsePickerPath as Z, defaultPickerCopy as ye, PickerNavigationError as ke } from "./PickerNavigation.js";
12
+ import { pickerParentPath as et } from "./PickerNavigation.js";
13
+ var $e = /* @__PURE__ */ m('<div role=tablist class="mb-1 flex min-w-0 items-center gap-4 border-b border-[var(--floe-line)]">'), pe = /* @__PURE__ */ m('<div class="flex min-w-0 items-start gap-1.5"><div class="min-w-0 flex-1">'), Pe = /* @__PURE__ */ m('<div role=alert class="flex items-center gap-2 text-xs text-error"><span class="min-w-0 flex-1 break-words">'), _e = /* @__PURE__ */ m('<div class="flex items-start gap-2 rounded-xs border border-error/30 bg-error/5 px-2 py-1.5 text-xs"role=alert><span class="min-w-0 flex-1 break-words">'), se = /* @__PURE__ */ m("<div>"), Fe = /* @__PURE__ */ m('<div class="flex min-w-0 flex-col gap-2"data-filesystem-picker><div class="flex min-w-0 flex-col gap-2">'), Ce = /* @__PURE__ */ m('<div class="flex flex-wrap items-center gap-1">'), Ie = /* @__PURE__ */ m("<button type=button role=tab>"), Ee = /* @__PURE__ */ m('<div class="flex min-w-0 flex-wrap items-center justify-between gap-2"><nav class="flex min-w-0 flex-wrap items-center gap-0.5 text-xs">'), Ae = /* @__PURE__ */ m("<span role=status>"), Me = /* @__PURE__ */ m('<div class="flex flex-wrap items-center justify-between gap-2 text-xs text-[var(--floe-ink-soft)]"><label class="flex cursor-pointer items-center gap-1.5"><input type=checkbox class=cursor-pointer>'), ze = /* @__PURE__ */ m('<button type=button class="max-w-full cursor-pointer truncate rounded-xs px-1 py-0.5 hover:bg-[var(--floe-state-hover)] focus-visible:ring-1 focus-visible:ring-ring">'), oe = /* @__PURE__ */ m('<p class="px-3 py-6 text-center text-xs text-[var(--floe-ink-soft)]"role=status>'), De = /* @__PURE__ */ m('<p class="px-3 py-6 text-center text-xs text-[var(--floe-ink-soft)]">'), Se = /* @__PURE__ */ m('<button type=button class="flex min-h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-[var(--floe-state-selected)] focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="min-w-0 flex-1 truncate">'), Ne = /* @__PURE__ */ m('<button type=button class="flex min-h-14 min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-sm px-2 py-2.5 text-left hover:bg-[var(--floe-state-selected)] focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="truncate text-xs font-medium"></span><span class="truncate text-caption text-[var(--floe-ink-soft)]">'), Ve = /* @__PURE__ */ m('<form data-picker-create-folder class="flex min-w-0 flex-col gap-4 p-4"><div class="flex min-w-0 items-start gap-2.5"><div class="min-w-0 flex-1"><h3 class="text-sm font-medium"></h3><p class="mt-1 truncate text-xs text-[var(--floe-ink-soft)]"></p></div></div><div class="flex min-w-0 flex-col gap-1.5"><label class="text-xs font-medium"></label></div><div class="flex flex-wrap items-center justify-end gap-2">');
14
+ function ee(e) {
14
15
  return {
15
- ...me,
16
+ ...ye,
16
17
  ...e.copy
17
18
  };
18
19
  }
19
- function se(e, o) {
20
- const n = W(e);
21
- return o instanceof we ? n[o.kind] : e.formatError?.(o) || (o instanceof Error ? o.message : "") || n.loadFailed;
20
+ function ue(e, o) {
21
+ const i = ee(e);
22
+ return o instanceof ke ? i[o.kind] : e.formatError?.(o) || (o instanceof Error ? o.message : "") || i.loadFailed;
22
23
  }
23
- function Oe(e, o, n, y, _ = () => "browse") {
24
- const [m, F] = E("browse"), k = be(() => e, n);
25
- return T(ae(() => [o(), e.scopeKey], ([I]) => {
26
- k.close(), I && (F(_()), e.directoryFavorites?.onRefresh?.(), y?.(), k.open(e.initialPath));
27
- })), T(() => e.onValidityChange?.(k.valid() && m() === "browse")), {
28
- ...k,
29
- view: m,
30
- setView: F
24
+ function Je(e, o, i, k, P = () => "browse") {
25
+ const [b, _] = N("browse"), F = we(() => e, i);
26
+ return R(W(() => [o(), e.scopeKey], ([I]) => {
27
+ F.close(), I && (_(P()), e.directoryFavorites?.onRefresh?.(), k?.(), F.open(e.initialPath));
28
+ })), R(() => e.onValidityChange?.(F.valid() && b() === "browse")), {
29
+ ...F,
30
+ view: b,
31
+ setView: _
31
32
  };
32
33
  }
33
- function We(e) {
34
- const o = () => W(e), n = ue(() => e.source), y = V(() => n.entries().filter((c) => c.type === "folder")), _ = V(() => n.context()?.roots.filter((c) => !c.hidden) ?? []), m = ve(), [F, k] = E(""), [I, $] = E(""), A = () => n.view() !== "browse", w = () => !!(e.suggestions?.paths.length || e.directoryFavorites), x = V(() => [...new Set((e.directoryFavorites?.paths ?? []).map((c) => j(c)).filter(Boolean))]), D = V(() => n.view() === "suggestions" ? e.suggestions?.paths ?? [] : x().filter((c) => c.toLocaleLowerCase().includes(F().trim().toLocaleLowerCase())));
35
- T(ae(() => e.scopeKey, () => {
36
- k(""), $("");
34
+ function Qe(e) {
35
+ const o = () => ee(e), i = ce(() => e.source), k = j(() => i.entries().filter((c) => c.type === "folder")), P = j(() => i.context()?.roots.filter((c) => !c.hidden) ?? []), b = de(), [_, F] = N(""), [I, y] = N(""), $ = () => i.view() !== "browse", D = () => !!(e.suggestions?.paths.length || e.directoryFavorites), q = j(() => [...new Set((e.directoryFavorites?.paths ?? []).map((c) => Z(c)).filter(Boolean))]), B = j(() => i.view() === "suggestions" ? e.suggestions?.paths ?? [] : q().filter((c) => c.toLocaleLowerCase().includes(_().trim().toLocaleLowerCase())));
36
+ R(W(() => e.scopeKey, () => {
37
+ F(""), y("");
37
38
  }));
38
39
  let K;
39
- const G = V(() => [...e.suggestions?.paths.length ? [{
40
+ const L = j(() => [...e.suggestions?.paths.length ? [{
40
41
  id: "suggestions",
41
42
  label: e.suggestions.label,
42
43
  disabled: e.disabled
@@ -44,85 +45,85 @@ function We(e) {
44
45
  id: "favorites",
45
46
  label: o().favorites,
46
47
  disabled: e.disabled
47
- }] : [], ..._().map((c) => ({
48
+ }] : [], ...P().map((c) => ({
48
49
  id: `root:${c.id}`,
49
50
  label: c.label,
50
51
  path: c.pathAbs,
51
52
  disabled: e.disabled || c.permissions?.read === !1
52
- }))]), B = () => {
53
- if (A()) return n.view();
54
- const c = j(n.pathInput(), n.context()?.homePathAbs);
55
- return `root:${_().filter((i) => c === i.pathAbs || c.startsWith(i.pathAbs.replace(/\/$/, "") + "/")).sort((i, t) => t.pathAbs.length - i.pathAbs.length)[0]?.id ?? n.context()?.defaultRootId ?? _()[0]?.id}`;
56
- }, J = /* @__PURE__ */ new Map(), Q = [], X = (c, b, i, t) => {
53
+ }))]), S = () => {
54
+ if ($()) return i.view();
55
+ const c = Z(i.pathInput(), i.context()?.homePathAbs);
56
+ return `root:${P().filter((t) => c === t.pathAbs || c.startsWith(t.pathAbs.replace(/\/$/, "") + "/")).sort((t, r) => r.pathAbs.length - t.pathAbs.length)[0]?.id ?? i.context()?.defaultRootId ?? P()[0]?.id}`;
57
+ }, G = /* @__PURE__ */ new Map(), h = [], x = (c, g, t, r) => {
57
58
  let a;
58
- c.key === "ArrowDown" && (a = Math.min(b + 1, t - 1)), c.key === "ArrowUp" && (a = Math.max(0, b - 1)), c.key === "Home" && (a = 0), c.key === "End" && (a = t - 1), a !== void 0 && (c.preventDefault(), c.stopPropagation(), i[a]?.focus(), i[a]?.scrollIntoView?.({
59
+ c.key === "ArrowDown" && (a = Math.min(g + 1, r - 1)), c.key === "ArrowUp" && (a = Math.max(0, g - 1)), c.key === "Home" && (a = 0), c.key === "End" && (a = r - 1), a !== void 0 && (c.preventDefault(), c.stopPropagation(), t[a]?.focus(), t[a]?.scrollIntoView?.({
59
60
  block: "nearest"
60
61
  }));
61
- }, oe = V(() => {
62
- const c = n.currentPath();
62
+ }, T = j(() => {
63
+ const c = i.currentPath();
63
64
  if (!c) return [];
64
- let b = "";
65
+ let g = "";
65
66
  return [{
66
67
  path: "/",
67
68
  name: o().root
68
- }, ...c.split("/").filter(Boolean).map((i) => (b += `/${i}`, {
69
- path: b,
70
- name: i
69
+ }, ...c.split("/").filter(Boolean).map((t) => (g += `/${t}`, {
70
+ path: g,
71
+ name: t
71
72
  }))];
72
- }), Y = [], S = (c) => {
73
- n.setView("browse"), n.navigate(c), K?.focus();
74
- }, Z = () => S(n.pathInput());
73
+ }), E = [], A = (c) => {
74
+ i.setView("browse"), i.navigate(c), K?.focus();
75
+ }, H = () => A(i.pathInput());
75
76
  return (() => {
76
- var c = pe(), b = c.firstChild;
77
- return s(c, l(h, {
77
+ var c = Fe(), g = c.firstChild;
78
+ return s(c, l(w, {
78
79
  get when() {
79
- return w();
80
+ return D();
80
81
  },
81
82
  get fallback() {
82
83
  return (() => {
83
- var i = Pe();
84
- return s(i, l(N, {
84
+ var t = Ce();
85
+ return s(t, l(U, {
85
86
  get each() {
86
- return _();
87
+ return P();
87
88
  },
88
- children: (t) => l(z, {
89
+ children: (r) => l(V, {
89
90
  type: "button",
90
91
  size: "sm",
91
92
  get variant() {
92
- return n.currentPath() === t.pathAbs ? "secondary" : "ghost";
93
+ return i.currentPath() === r.pathAbs ? "secondary" : "ghost";
93
94
  },
94
95
  get disabled() {
95
- return e.disabled || t.permissions?.read === !1;
96
+ return e.disabled || r.permissions?.read === !1;
96
97
  },
97
98
  get title() {
98
- return t.pathAbs;
99
+ return r.pathAbs;
99
100
  },
100
101
  onClick: () => {
101
- n.navigate(t.pathAbs);
102
+ i.navigate(r.pathAbs);
102
103
  },
103
104
  get children() {
104
- return t.label;
105
+ return r.label;
105
106
  }
106
107
  })
107
- })), P(() => v(i, "aria-label", o().roots)), i;
108
+ })), p(() => u(t, "aria-label", o().roots)), t;
108
109
  })();
109
110
  },
110
111
  get children() {
111
- var i = xe();
112
- return s(i, l(N, {
112
+ var t = $e();
113
+ return s(t, l(U, {
113
114
  get each() {
114
- return G();
115
+ return L();
115
116
  },
116
- children: (t) => (() => {
117
- var a = _e();
118
- return a.$$keydown = (r) => {
119
- const u = he(G(), t.id, r.key);
120
- u && (r.preventDefault(), r.stopPropagation(), J.get(u)?.focus());
117
+ children: (r) => (() => {
118
+ var a = Ie();
119
+ return a.$$keydown = (n) => {
120
+ const v = xe(L(), r.id, n.key);
121
+ v && (n.preventDefault(), n.stopPropagation(), G.get(v)?.focus());
121
122
  }, a.$$click = () => {
122
- "path" in t ? S(t.path) : (n.setView(t.id), t.id === "favorites" && e.directoryFavorites?.onRefresh?.());
123
- }, H((r) => J.set(t.id, r), a), v(a, "aria-controls", m), s(a, () => t.label), P((r) => {
124
- var u = `${m}-${t.id}`, g = B() === t.id, p = B() === t.id ? 0 : -1, d = t.disabled, R = "path" in t ? t.path : t.label, M = L("min-w-0 cursor-pointer truncate border-b-2 px-0.5 py-2 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", B() === t.id ? "border-primary text-[var(--floe-accent-ink)]" : "border-transparent text-[var(--floe-ink-soft)] hover:text-foreground");
125
- return u !== r.e && v(a, "id", r.e = u), g !== r.t && v(a, "aria-selected", r.t = g), p !== r.a && v(a, "tabindex", r.a = p), d !== r.o && (a.disabled = r.o = d), R !== r.i && v(a, "title", r.i = R), M !== r.n && ce(a, r.n = M), r;
123
+ "path" in r ? A(r.path) : (i.setView(r.id), r.id === "favorites" && e.directoryFavorites?.onRefresh?.());
124
+ }, J((n) => G.set(r.id, n), a), u(a, "aria-controls", b), s(a, () => r.label), p((n) => {
125
+ var v = `${b}-${r.id}`, d = S() === r.id, C = S() === r.id ? 0 : -1, f = r.disabled, M = "path" in r ? r.path : r.label, O = Q("min-w-0 cursor-pointer truncate border-b-2 px-0.5 py-2 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", S() === r.id ? "border-primary text-[var(--floe-accent-ink)]" : "border-transparent text-[var(--floe-ink-soft)] hover:text-foreground");
126
+ return v !== n.e && u(a, "id", n.e = v), d !== n.t && u(a, "aria-selected", n.t = d), C !== n.a && u(a, "tabindex", n.a = C), f !== n.o && (a.disabled = n.o = f), M !== n.i && u(a, "title", n.i = M), O !== n.n && fe(a, n.n = O), n;
126
127
  }, {
127
128
  e: void 0,
128
129
  t: void 0,
@@ -132,18 +133,18 @@ function We(e) {
132
133
  n: void 0
133
134
  }), a;
134
135
  })()
135
- })), P(() => v(i, "aria-label", o().roots)), i;
136
+ })), p(() => u(t, "aria-label", o().roots)), t;
136
137
  }
137
- }), b), v(b, "id", m), s(b, l(h, {
138
+ }), g), u(g, "id", b), s(g, l(w, {
138
139
  get when() {
139
- return !A();
140
+ return !$();
140
141
  },
141
142
  get children() {
142
- var i = ye(), t = i.firstChild;
143
- return s(t, l(U, {
143
+ var t = pe(), r = t.firstChild;
144
+ return s(r, l(Y, {
144
145
  ref(a) {
145
- var r = K;
146
- typeof r == "function" ? r(a) : K = a;
146
+ var n = K;
147
+ typeof n == "function" ? n(a) : K = a;
147
148
  },
148
149
  size: "sm",
149
150
  get "aria-label"() {
@@ -151,108 +152,108 @@ function We(e) {
151
152
  },
152
153
  placeholder: "/",
153
154
  get value() {
154
- return n.pathInput();
155
+ return i.pathInput();
155
156
  },
156
157
  get disabled() {
157
- return e.disabled || !n.context();
158
+ return e.disabled || !i.context();
158
159
  },
159
- onInput: (a) => n.setPathInput(a.currentTarget.value),
160
+ onInput: (a) => i.setPathInput(a.currentTarget.value),
160
161
  onKeyDown: (a) => {
161
- a.key === "Enter" && (a.preventDefault(), a.stopPropagation(), Z());
162
+ a.key === "Enter" && (a.preventDefault(), a.stopPropagation(), H());
162
163
  }
163
- })), s(i, l(z, {
164
+ })), s(t, l(V, {
164
165
  size: "sm",
165
166
  variant: "outline",
166
- onClick: Z,
167
+ onClick: H,
167
168
  get disabled() {
168
- return e.disabled || !n.context() || !n.pathInput();
169
+ return e.disabled || !i.context() || !i.pathInput();
169
170
  },
170
171
  get children() {
171
172
  return o().go;
172
173
  }
173
- }), null), i;
174
+ }), null), t;
174
175
  }
175
- }), null), s(b, l(h, {
176
+ }), null), s(g, l(w, {
176
177
  get when() {
177
178
  return I() || e.directoryFavorites?.error;
178
179
  },
179
180
  get children() {
180
- var i = ke(), t = i.firstChild;
181
- return s(t, () => I() || e.directoryFavorites?.error), s(i, l(z, {
181
+ var t = Pe(), r = t.firstChild;
182
+ return s(r, () => I() || e.directoryFavorites?.error), s(t, l(V, {
182
183
  size: "sm",
183
184
  variant: "ghost",
184
185
  get disabled() {
185
186
  return e.directoryFavorites?.loading;
186
187
  },
187
188
  onClick: () => {
188
- $(""), e.directoryFavorites?.onRefresh?.();
189
+ y(""), e.directoryFavorites?.onRefresh?.();
189
190
  },
190
191
  get children() {
191
192
  return o().retry;
192
193
  }
193
- }), null), i;
194
+ }), null), t;
194
195
  }
195
- }), null), s(b, l(h, {
196
+ }), null), s(g, l(w, {
196
197
  get when() {
197
- return C(() => !!n.error())() && !A();
198
+ return z(() => !!i.error())() && !$();
198
199
  },
199
200
  get children() {
200
- var i = $e(), t = i.firstChild;
201
- return s(t, () => se(e, n.error())), s(i, l(z, {
201
+ var t = _e(), r = t.firstChild;
202
+ return s(r, () => ue(e, i.error())), s(t, l(V, {
202
203
  size: "sm",
203
204
  variant: "ghost",
204
205
  onClick: () => {
205
- n.retry();
206
+ i.retry();
206
207
  },
207
208
  get disabled() {
208
- return e.disabled || n.pending();
209
+ return e.disabled || i.pending();
209
210
  },
210
211
  get children() {
211
212
  return o().retry;
212
213
  }
213
- }), null), i;
214
+ }), null), t;
214
215
  }
215
- }), null), s(b, l(h, {
216
+ }), null), s(g, l(w, {
216
217
  get when() {
217
- return A();
218
+ return $();
218
219
  },
219
220
  get fallback() {
220
221
  return [(() => {
221
- var i = Fe();
222
- return s(i, l(N, {
222
+ var t = Ee(), r = t.firstChild;
223
+ return s(r, l(U, {
223
224
  get each() {
224
- return oe();
225
+ return T();
225
226
  },
226
- children: (t, a) => [l(h, {
227
+ children: (a, n) => [l(w, {
227
228
  get when() {
228
- return a() > 0;
229
+ return n() > 0;
229
230
  },
230
231
  get children() {
231
- return l(q, {
232
+ return l(X, {
232
233
  class: "h-3 w-3 shrink-0 text-[var(--floe-ink-soft)]"
233
234
  });
234
235
  }
235
236
  }), (() => {
236
- var r = Ee();
237
- return r.$$click = () => {
238
- n.navigate(t.path);
239
- }, s(r, () => t.name), P((u) => {
240
- var g = t.path, p = e.disabled, d = t.path === n.currentPath() ? "location" : void 0;
241
- return g !== u.e && v(r, "title", u.e = g), p !== u.t && (r.disabled = u.t = p), d !== u.a && v(r, "aria-current", u.a = d), u;
237
+ var v = ze();
238
+ return v.$$click = () => {
239
+ i.navigate(a.path);
240
+ }, s(v, () => a.name), p((d) => {
241
+ var C = a.path, f = e.disabled, M = a.path === i.currentPath() ? "location" : void 0;
242
+ return C !== d.e && u(v, "title", d.e = C), f !== d.t && (v.disabled = d.t = f), M !== d.a && u(v, "aria-current", d.a = M), d;
242
243
  }, {
243
244
  e: void 0,
244
245
  t: void 0,
245
246
  a: void 0
246
- }), r;
247
+ }), v;
247
248
  })()]
248
- }), null), s(i, l(h, {
249
+ }), null), s(r, l(w, {
249
250
  get when() {
250
251
  return e.directoryFavorites;
251
252
  },
252
253
  get children() {
253
- return l(fe, {
254
+ return l(be, {
254
255
  get path() {
255
- return n.currentPath();
256
+ return i.currentPath();
256
257
  },
257
258
  get favorites() {
258
259
  return e.directoryFavorites;
@@ -261,57 +262,64 @@ function We(e) {
261
262
  return o();
262
263
  },
263
264
  get disabled() {
264
- return e.disabled || !n.valid();
265
+ return e.disabled || !i.valid();
265
266
  },
266
- onError: $
267
+ onError: y
267
268
  });
268
269
  }
269
- }), null), P(() => v(i, "aria-label", o().currentDirectory)), i;
270
+ }), null), s(t, l(w, {
271
+ get when() {
272
+ return e.onCreateFolder;
273
+ },
274
+ get children() {
275
+ return l(Re, e);
276
+ }
277
+ }), null), p(() => u(r, "aria-label", o().currentDirectory)), t;
270
278
  })(), (() => {
271
- var i = O();
272
- return te(i, re(() => e.scrollViewportProps, {
279
+ var t = se();
280
+ return re(t, ie(() => e.scrollViewportProps, {
273
281
  get class() {
274
- return L("min-h-[120px] overflow-y-auto rounded-xs border border-[var(--floe-line)]", e.scrollViewportProps?.class);
282
+ return Q("min-h-[120px] overflow-y-auto rounded-xs border border-[var(--floe-line)]", e.scrollViewportProps?.class);
275
283
  },
276
284
  get style() {
277
285
  return {
278
286
  "max-height": e.treeMaxHeight ?? "240px"
279
287
  };
280
288
  }
281
- }), !1, !0), s(i, l(h, {
289
+ }), !1, !0), s(t, l(w, {
282
290
  get when() {
283
- return !n.pending() || n.currentPath();
291
+ return !i.pending() || i.currentPath();
284
292
  },
285
293
  get fallback() {
286
294
  return (() => {
287
- var t = ne();
288
- return s(t, () => o().loading), t;
295
+ var r = oe();
296
+ return s(r, () => o().loading), r;
289
297
  })();
290
298
  },
291
299
  get children() {
292
- return l(h, {
300
+ return l(w, {
293
301
  get when() {
294
- return y().length;
302
+ return k().length;
295
303
  },
296
304
  get fallback() {
297
- return l(h, {
305
+ return l(w, {
298
306
  get when() {
299
- return n.currentPath();
307
+ return i.currentPath();
300
308
  },
301
309
  get children() {
302
- var t = ze();
303
- return s(t, () => o().empty), t;
310
+ var r = De();
311
+ return s(r, () => o().empty), r;
304
312
  }
305
313
  });
306
314
  },
307
315
  get children() {
308
- return l(N, {
316
+ return l(U, {
309
317
  get each() {
310
- return y();
318
+ return k();
311
319
  },
312
- children: (t, a) => l(ie, {
320
+ children: (r, a) => l(le, {
313
321
  get path() {
314
- return t.path;
322
+ return r.path;
315
323
  },
316
324
  get favorites() {
317
325
  return e.directoryFavorites;
@@ -323,66 +331,59 @@ function We(e) {
323
331
  return e.scopeKey;
324
332
  },
325
333
  get disabled() {
326
- return e.disabled || e.filter?.(t) === !1;
334
+ return e.disabled || e.filter?.(r) === !1;
327
335
  },
328
- onError: $,
336
+ onError: y,
329
337
  get children() {
330
- var r = Ae(), u = r.firstChild;
331
- return r.$$keydown = (g) => X(g, a(), Y, y().length), r.$$click = () => {
332
- n.navigate(t.path);
333
- }, H((g) => {
334
- T(() => {
335
- Y[a()] = g;
338
+ var n = Se(), v = n.firstChild;
339
+ return n.$$keydown = (d) => x(d, a(), E, k().length), n.$$click = () => {
340
+ i.navigate(r.path);
341
+ }, J((d) => {
342
+ R(() => {
343
+ E[a()] = d;
336
344
  });
337
- }, r), s(r, l(ge, {
338
- item: t,
345
+ }, n), s(n, l(ve, {
346
+ item: r,
339
347
  size: 16,
340
348
  class: "h-4 w-4 shrink-0"
341
- }), u), s(u, () => t.name), s(r, l(q, {
349
+ }), v), s(v, () => r.name), s(n, l(X, {
342
350
  class: "h-3 w-3 shrink-0 text-[var(--floe-ink-soft)]"
343
- }), null), P((g) => {
344
- var p = t.path, d = e.disabled || e.filter?.(t) === !1;
345
- return p !== g.e && v(r, "data-picker-row-path", g.e = p), d !== g.t && (r.disabled = g.t = d), g;
351
+ }), null), p((d) => {
352
+ var C = r.path, f = e.disabled || e.filter?.(r) === !1;
353
+ return C !== d.e && u(n, "data-picker-row-path", d.e = C), f !== d.t && (n.disabled = d.t = f), d;
346
354
  }, {
347
355
  e: void 0,
348
356
  t: void 0
349
- }), r;
357
+ }), n;
350
358
  }
351
359
  })
352
360
  });
353
361
  }
354
362
  });
355
363
  }
356
- })), i;
364
+ })), t;
357
365
  })(), (() => {
358
- var i = Ie(), t = i.firstChild, a = t.firstChild;
359
- return a.addEventListener("change", (r) => {
360
- n.setShowHidden(r.currentTarget.checked);
361
- }), s(t, () => o().showHidden, null), s(i, l(h, {
366
+ var t = Me(), r = t.firstChild, a = r.firstChild;
367
+ return a.addEventListener("change", (n) => {
368
+ i.setShowHidden(n.currentTarget.checked);
369
+ }), s(r, () => o().showHidden, null), s(t, l(w, {
362
370
  get when() {
363
- return C(() => !!n.pending())() && n.currentPath();
371
+ return z(() => !!i.pending())() && i.currentPath();
364
372
  },
365
373
  get children() {
366
- var r = Ce();
367
- return s(r, () => o().loading), r;
374
+ var n = Ae();
375
+ return s(n, () => o().loading), n;
368
376
  }
369
- }), null), P(() => a.disabled = e.disabled || !n.context()), P(() => a.checked = n.showHidden()), i;
370
- })(), l(h, {
371
- get when() {
372
- return e.onCreateFolder;
373
- },
374
- get children() {
375
- return l(Me, e);
376
- }
377
- })];
377
+ }), null), p(() => a.disabled = e.disabled || !i.context()), p(() => a.checked = i.showHidden()), t;
378
+ })()];
378
379
  },
379
380
  get children() {
380
- return [l(h, {
381
+ return [l(w, {
381
382
  get when() {
382
- return n.view() === "favorites";
383
+ return i.view() === "favorites";
383
384
  },
384
385
  get children() {
385
- return l(U, {
386
+ return l(Y, {
386
387
  size: "sm",
387
388
  get "aria-label"() {
388
389
  return o().favoritesFilter;
@@ -391,54 +392,54 @@ function We(e) {
391
392
  return o().favoritesFilter;
392
393
  },
393
394
  get value() {
394
- return F();
395
+ return _();
395
396
  },
396
- onInput: (i) => k(i.currentTarget.value)
397
+ onInput: (t) => F(t.currentTarget.value)
397
398
  });
398
399
  }
399
400
  }), (() => {
400
- var i = O();
401
- return te(i, re(() => e.scrollViewportProps, {
401
+ var t = se();
402
+ return re(t, ie(() => e.scrollViewportProps, {
402
403
  get "data-picker-suggestions"() {
403
- return n.view() === "suggestions" ? "" : void 0;
404
+ return i.view() === "suggestions" ? "" : void 0;
404
405
  },
405
406
  get "data-picker-favorites"() {
406
- return n.view() === "favorites" ? "" : void 0;
407
+ return i.view() === "favorites" ? "" : void 0;
407
408
  },
408
409
  get "aria-label"() {
409
- return C(() => n.view() === "favorites")() ? o().favorites : e.suggestions?.label;
410
+ return z(() => i.view() === "favorites")() ? o().favorites : e.suggestions?.label;
410
411
  },
411
412
  get "aria-busy"() {
412
- return C(() => n.view() === "favorites")() && e.directoryFavorites?.loading;
413
+ return z(() => i.view() === "favorites")() && e.directoryFavorites?.loading;
413
414
  },
414
415
  get class() {
415
- return L("min-h-[180px] min-w-0 overflow-y-auto", e.scrollViewportProps?.class);
416
+ return Q("min-h-[180px] min-w-0 overflow-y-auto", e.scrollViewportProps?.class);
416
417
  },
417
418
  get style() {
418
419
  return {
419
420
  "max-height": e.treeMaxHeight ?? "240px"
420
421
  };
421
422
  }
422
- }), !1, !0), s(i, l(h, {
423
+ }), !1, !0), s(t, l(w, {
423
424
  get when() {
424
- return D().length;
425
+ return B().length;
425
426
  },
426
427
  get fallback() {
427
428
  return (() => {
428
- var t = ne();
429
- return s(t, (() => {
430
- var a = C(() => !!e.directoryFavorites?.loading);
431
- return () => a() ? o().loading : C(() => !!e.directoryFavorites?.error)() ? o().favoritesLoadFailed : C(() => !!F().trim())() ? o().favoritesNoMatches : o().favoritesEmpty;
432
- })()), t;
429
+ var r = oe();
430
+ return s(r, (() => {
431
+ var a = z(() => !!e.directoryFavorites?.loading);
432
+ return () => a() ? o().loading : z(() => !!e.directoryFavorites?.error)() ? o().favoritesLoadFailed : z(() => !!_().trim())() ? o().favoritesNoMatches : o().favoritesEmpty;
433
+ })()), r;
433
434
  })();
434
435
  },
435
436
  get children() {
436
- return l(N, {
437
+ return l(U, {
437
438
  get each() {
438
- return D();
439
+ return B();
439
440
  },
440
- children: (t, a) => l(ie, {
441
- path: t,
441
+ children: (r, a) => l(le, {
442
+ path: r,
442
443
  get favorites() {
443
444
  return e.directoryFavorites;
444
445
  },
@@ -451,37 +452,37 @@ function We(e) {
451
452
  get disabled() {
452
453
  return e.disabled;
453
454
  },
454
- onError: $,
455
+ onError: y,
455
456
  get children() {
456
- var r = Ve(), u = r.firstChild, g = u.firstChild, p = g.nextSibling;
457
- return r.$$keydown = (d) => X(d, a(), Q, D().length), r.$$click = () => {
458
- S(t);
459
- }, H((d) => {
460
- T(() => {
461
- Q[a()] = d;
457
+ var n = Ne(), v = n.firstChild, d = v.firstChild, C = d.nextSibling;
458
+ return n.$$keydown = (f) => x(f, a(), h, B().length), n.$$click = () => {
459
+ A(r);
460
+ }, J((f) => {
461
+ R(() => {
462
+ h[a()] = f;
462
463
  });
463
- }, r), v(r, "title", t), v(r, "aria-label", t), s(r, l(le, {
464
+ }, n), u(n, "title", r), u(n, "aria-label", r), s(n, l(he, {
464
465
  class: "h-4 w-4 shrink-0 text-[var(--floe-ink-soft)]"
465
- }), u), s(g, () => t.split("/").filter(Boolean).at(-1) ?? o().root), s(p, t), s(r, l(q, {
466
+ }), v), s(d, () => r.split("/").filter(Boolean).at(-1) ?? o().root), s(C, r), s(n, l(X, {
466
467
  class: "h-3 w-3 shrink-0 text-[var(--floe-ink-quiet)]"
467
- }), null), P((d) => {
468
- var R = n.view() === "suggestions" ? t : void 0, M = n.view() === "favorites" ? t : void 0, ee = e.disabled || !n.context();
469
- return R !== d.e && v(r, "data-picker-suggested-path", d.e = R), M !== d.t && v(r, "data-picker-favorite-path", d.t = M), ee !== d.a && (r.disabled = d.a = ee), d;
468
+ }), null), p((f) => {
469
+ var M = i.view() === "suggestions" ? r : void 0, O = i.view() === "favorites" ? r : void 0, te = e.disabled || !i.context();
470
+ return M !== f.e && u(n, "data-picker-suggested-path", f.e = M), O !== f.t && u(n, "data-picker-favorite-path", f.t = O), te !== f.a && (n.disabled = f.a = te), f;
470
471
  }, {
471
472
  e: void 0,
472
473
  t: void 0,
473
474
  a: void 0
474
- }), r;
475
+ }), n;
475
476
  }
476
477
  })
477
478
  });
478
479
  }
479
- })), i;
480
+ })), t;
480
481
  })()];
481
482
  }
482
- }), null), P((i) => {
483
- var t = n.pending(), a = w() ? "tabpanel" : void 0, r = w() ? `${m}-${B()}` : void 0;
484
- return t !== i.e && v(c, "aria-busy", i.e = t), a !== i.t && v(b, "role", i.t = a), r !== i.a && v(b, "aria-labelledby", i.a = r), i;
483
+ }), null), p((t) => {
484
+ var r = i.pending(), a = D() ? "tabpanel" : void 0, n = D() ? `${b}-${S()}` : void 0;
485
+ return r !== t.e && u(c, "aria-busy", t.e = r), a !== t.t && u(g, "role", t.t = a), n !== t.a && u(g, "aria-labelledby", t.a = n), t;
485
486
  }, {
486
487
  e: void 0,
487
488
  t: void 0,
@@ -489,95 +490,132 @@ function We(e) {
489
490
  }), c;
490
491
  })();
491
492
  }
492
- function Me(e) {
493
- const [o, n] = E(!1), [y, _] = E(""), [m, F] = E(!1), [k, I] = E(null), $ = () => W(e), A = async () => {
494
- if (!y().trim() || !e.source.valid() || !e.onCreateFolder || m()) return;
495
- const w = e.source.currentPath();
496
- F(!0), I(null);
493
+ function Re(e) {
494
+ const [o, i] = N(!1), [k, P] = N(""), [b, _] = N(!1), [F, I] = N(null), y = () => ee(e);
495
+ let $ = 0, D, q;
496
+ const B = de(), K = () => !!k().trim() && ![".", ".."].includes(k().trim()) && !k().includes("/") && !k().includes("\0"), L = () => {
497
+ $++, i(!1), P(""), _(!1), I(null);
498
+ };
499
+ R(W(() => [e.scopeKey, e.source.context(), e.source.active(), e.source.pathInput()], L)), ne(() => {
500
+ $++;
501
+ }), R(W(o, (h) => {
502
+ if (!h) return;
503
+ const x = requestAnimationFrame(() => D?.focus());
504
+ ne(() => cancelAnimationFrame(x));
505
+ }));
506
+ const S = () => {
507
+ L(), queueMicrotask(() => q?.focus());
508
+ }, G = async () => {
509
+ if (e.disabled || !K() || !e.source.valid() || !e.onCreateFolder || b()) return;
510
+ const h = e.source.currentPath(), x = $, T = e.source.captureIntent(), E = () => $ === x && T();
511
+ _(!0), I(null);
497
512
  try {
498
- await e.onCreateFolder(w, y().trim()), _(""), n(!1), e.source.active() && w === e.source.currentPath() && await e.source.navigate(w);
499
- } catch (x) {
500
- I(x);
513
+ if (await e.onCreateFolder(h, k().trim()), !E()) return;
514
+ P(""), i(!1), await e.source.navigate(h), $ === x && e.source.active() && queueMicrotask(() => q?.focus());
515
+ } catch (A) {
516
+ E() && (I(A), queueMicrotask(() => D?.focus()));
501
517
  } finally {
502
- F(!1);
518
+ $ === x && _(!1);
503
519
  }
504
520
  };
505
- return (() => {
506
- var w = O();
507
- return s(w, l(h, {
508
- get when() {
509
- return o();
510
- },
511
- get fallback() {
512
- return l(z, {
513
- size: "sm",
514
- variant: "ghost",
515
- get disabled() {
516
- return e.disabled || !e.source.valid();
517
- },
518
- onClick: () => n(!0),
519
- get children() {
520
- return [l(le, {
521
- class: "mr-1 h-3.5 w-3.5"
522
- }), C(() => $().newFolder)];
523
- }
524
- });
525
- },
526
- get children() {
527
- var x = De();
528
- return s(x, l(U, {
529
- size: "sm",
530
- get "aria-label"() {
531
- return $().folderName;
532
- },
533
- get value() {
534
- return y();
535
- },
536
- onInput: (D) => _(D.currentTarget.value),
537
- get disabled() {
538
- return e.disabled || m();
539
- }
540
- }), null), s(x, l(z, {
541
- size: "sm",
542
- get disabled() {
543
- return e.disabled || m() || !y().trim() || !e.source.valid();
544
- },
545
- onClick: () => {
546
- A();
547
- },
548
- get children() {
549
- return $().create;
550
- }
551
- }), null), s(x, l(z, {
552
- size: "sm",
553
- variant: "ghost-destructive",
554
- get disabled() {
555
- return e.disabled || m();
556
- },
557
- onClick: () => n(!1),
558
- get children() {
559
- return $().cancel;
560
- }
561
- }), null), x;
562
- }
563
- }), null), s(w, l(h, {
564
- get when() {
565
- return k();
566
- },
567
- get children() {
568
- var x = Re();
569
- return s(x, () => se(e, k())), x;
570
- }
571
- }), null), w;
572
- })();
521
+ return l(me, {
522
+ get open() {
523
+ return o();
524
+ },
525
+ placement: "bottom-end",
526
+ get ariaLabel() {
527
+ return y().newFolder;
528
+ },
529
+ class: "w-80 overflow-hidden",
530
+ onOpenChange: (h) => {
531
+ b() || (h ? !e.disabled && e.source.valid() && i(!0) : L());
532
+ },
533
+ get trigger() {
534
+ return l(V, {
535
+ ref(h) {
536
+ var x = q;
537
+ typeof x == "function" ? x(h) : q = h;
538
+ },
539
+ size: "sm",
540
+ variant: "ghost",
541
+ icon: ae,
542
+ "aria-haspopup": "dialog",
543
+ get "aria-expanded"() {
544
+ return o();
545
+ },
546
+ get disabled() {
547
+ return e.disabled || !e.source.valid();
548
+ },
549
+ get children() {
550
+ return y().newFolder;
551
+ }
552
+ });
553
+ },
554
+ get children() {
555
+ var h = Ve(), x = h.firstChild, T = x.firstChild, E = T.firstChild, A = E.nextSibling, H = x.nextSibling, c = H.firstChild, g = H.nextSibling;
556
+ return h.$$keydown = (t) => {
557
+ t.isComposing || t.key === "Escape" && (t.preventDefault(), t.stopPropagation(), b() || S());
558
+ }, h.addEventListener("submit", (t) => {
559
+ t.preventDefault(), G();
560
+ }), s(x, l(ae, {
561
+ class: "mt-0.5 h-4 w-4 shrink-0 text-[var(--floe-ink-soft)]"
562
+ }), T), s(E, () => y().newFolder), s(A, () => e.source.currentPath()), u(c, "for", B), s(c, () => y().folderName), s(H, l(Y, {
563
+ id: B,
564
+ get "aria-label"() {
565
+ return y().folderName;
566
+ },
567
+ ref: (t) => {
568
+ D = t, queueMicrotask(() => {
569
+ ce(o) && t.focus();
570
+ });
571
+ },
572
+ get value() {
573
+ return k();
574
+ },
575
+ get error() {
576
+ return z(() => !!F())() ? ue(e, F()) : void 0;
577
+ },
578
+ onInput: (t) => {
579
+ P(t.currentTarget.value), I(null);
580
+ },
581
+ get disabled() {
582
+ return e.disabled || b();
583
+ }
584
+ }), null), s(g, l(V, {
585
+ type: "button",
586
+ size: "sm",
587
+ variant: "ghost-destructive",
588
+ get disabled() {
589
+ return b();
590
+ },
591
+ onClick: S,
592
+ get children() {
593
+ return y().cancel;
594
+ }
595
+ }), null), s(g, l(V, {
596
+ type: "submit",
597
+ size: "sm",
598
+ variant: "primary",
599
+ get loading() {
600
+ return b();
601
+ },
602
+ get disabled() {
603
+ return e.disabled || b() || !K() || !e.source.valid();
604
+ },
605
+ get children() {
606
+ return y().create;
607
+ }
608
+ }), null), p(() => u(A, "title", e.source.currentPath())), h;
609
+ }
610
+ });
573
611
  }
574
- const Ge = j;
575
- de(["click", "keydown"]);
612
+ const Xe = Z;
613
+ ge(["click", "keydown"]);
576
614
  export {
577
- We as PickerPanel,
578
- Xe as getParentPath,
579
- Ge as normalizePath,
580
- W as pickerCopy,
581
- se as pickerErrorMessage,
582
- Oe as usePickerNavigation
615
+ Qe as PickerPanel,
616
+ et as getParentPath,
617
+ Xe as normalizePath,
618
+ ee as pickerCopy,
619
+ ue as pickerErrorMessage,
620
+ Je as usePickerNavigation
583
621
  };