@floegence/floe-webapp-core 0.86.49 → 0.86.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat/markdown/incremental.js +51 -55
- package/dist/components/ui/DirectoryPicker.js +25 -29
- package/dist/components/ui/FileOpenPicker.js +106 -98
- package/dist/components/ui/FileSavePicker.js +74 -66
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/picker/DirectoryFavorites.d.ts +29 -0
- package/dist/components/ui/picker/DirectoryFavorites.js +163 -0
- package/dist/components/ui/picker/PickerBase.d.ts +16 -5
- package/dist/components/ui/picker/PickerBase.js +366 -225
- package/dist/components/ui/picker/PickerNavigation.d.ts +7 -0
- package/dist/components/ui/picker/PickerNavigation.js +73 -66
- package/dist/full.js +465 -463
- package/dist/styles.css +1 -1
- package/dist/ui.js +128 -126
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
function X(k) {
|
|
2
|
-
let L = 0, b = [], C = 0, I = !1
|
|
2
|
+
let L = 0, b = [], C = 0, I = !1;
|
|
3
|
+
const a = [];
|
|
4
|
+
let d = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), R = 1, o = 0, g, O, S = !1, M = 0, W = 0;
|
|
3
5
|
const m = /* @__PURE__ */ new Map();
|
|
4
6
|
function U(e) {
|
|
5
7
|
let t = 0, n = b.length;
|
|
@@ -8,7 +10,7 @@ function X(k) {
|
|
|
8
10
|
b[s].start <= e ? t = s + 1 : n = s;
|
|
9
11
|
}
|
|
10
12
|
const i = Math.max(0, t - 1);
|
|
11
|
-
return b.slice(i).map((s,
|
|
13
|
+
return b.slice(i).map((s, l) => l === 0 ? s.text.slice(e - s.start) : s.text).join("");
|
|
12
14
|
}
|
|
13
15
|
function F(e, t) {
|
|
14
16
|
W += e.length;
|
|
@@ -16,7 +18,7 @@ function X(k) {
|
|
|
16
18
|
return n.tokens.links = { ...t }, n.lex(e);
|
|
17
19
|
}
|
|
18
20
|
function w(e) {
|
|
19
|
-
return { changes: e, links:
|
|
21
|
+
return { changes: e, links: d, sourceLength: C };
|
|
20
22
|
}
|
|
21
23
|
function $(e) {
|
|
22
24
|
return { id: e.id, start: e.start, token: structuredClone(e.token) };
|
|
@@ -51,8 +53,8 @@ function X(k) {
|
|
|
51
53
|
if (n.length < t.inline.length) return !0;
|
|
52
54
|
const i = new k.Lexer({ ...k.defaults });
|
|
53
55
|
return n.some((s) => {
|
|
54
|
-
const
|
|
55
|
-
return typeof
|
|
56
|
+
const l = s.call({ lexer: i }, e);
|
|
57
|
+
return typeof l == "number" && l >= 0;
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
function _(e, t = 0) {
|
|
@@ -67,11 +69,11 @@ function X(k) {
|
|
|
67
69
|
}
|
|
68
70
|
let s = i >= 0 ? i : Math.max(t, n.length - 1);
|
|
69
71
|
s > t && n[s]?.type === "text" && !/\s/u.test(n[s].raw) && n[s - 1]?.type === "link" && s--;
|
|
70
|
-
const
|
|
71
|
-
if (i < 0 &&
|
|
72
|
-
const f =
|
|
72
|
+
const l = n[s];
|
|
73
|
+
if (i < 0 && l?.type === "text" && l.raw === l.text) {
|
|
74
|
+
const f = l.raw.lastIndexOf(" ");
|
|
73
75
|
if (f > 0) {
|
|
74
|
-
const u =
|
|
76
|
+
const u = l;
|
|
75
77
|
n.splice(
|
|
76
78
|
s,
|
|
77
79
|
1,
|
|
@@ -80,24 +82,24 @@ function X(k) {
|
|
|
80
82
|
), s++;
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
const
|
|
85
|
+
const p = n.slice(s).map((f) => f.raw).join("");
|
|
84
86
|
O = {
|
|
85
87
|
from: s,
|
|
86
|
-
source:
|
|
88
|
+
source: p,
|
|
87
89
|
unresolved: i >= 0,
|
|
88
|
-
extensionPending: z(
|
|
89
|
-
lastChar:
|
|
90
|
+
extensionPending: z(p),
|
|
91
|
+
lastChar: p.slice(-1)
|
|
90
92
|
};
|
|
91
93
|
}
|
|
92
94
|
function G() {
|
|
93
95
|
g = void 0, O = void 0, S = !1;
|
|
94
|
-
const e =
|
|
96
|
+
const e = a.at(-1)?.token;
|
|
95
97
|
if (e?.type === "paragraph") {
|
|
96
98
|
_(e);
|
|
97
|
-
const
|
|
98
|
-
`) + 1,
|
|
99
|
+
const l = e.raw.lastIndexOf(`
|
|
100
|
+
`) + 1, p = e.raw.slice(l, l + 32);
|
|
99
101
|
S = !e.raw.endsWith(`
|
|
100
|
-
`) && !/^(?: {0,3}(?:[-+*_]+|[0-9]{1,9}[.)]?)[ \t]*$| {0,3}[[<\x60~#|=])/u.test(
|
|
102
|
+
`) && !/^(?: {0,3}(?:[-+*_]+|[0-9]{1,9}[.)]?)[ \t]*$| {0,3}[[<\x60~#|=])/u.test(p);
|
|
101
103
|
}
|
|
102
104
|
if (e?.type !== "code") return;
|
|
103
105
|
const t = /^(\x60{3,}|~{3,})[^\n]*\n/.exec(e.raw);
|
|
@@ -114,48 +116,48 @@ function X(k) {
|
|
|
114
116
|
E(i, s) || (g = s);
|
|
115
117
|
}
|
|
116
118
|
function N(e = !1) {
|
|
117
|
-
const t =
|
|
119
|
+
const t = a[o]?.start ?? 0, n = a.splice(o);
|
|
118
120
|
for (const r of n) B(r);
|
|
119
|
-
const i = F(U(t), v), s =
|
|
120
|
-
|
|
121
|
+
const i = F(U(t), v), s = d;
|
|
122
|
+
d = Object.freeze(
|
|
121
123
|
Object.fromEntries(
|
|
122
124
|
Object.entries(i.links).map(([r, c]) => [r, Object.freeze({ ...c })])
|
|
123
125
|
)
|
|
124
126
|
);
|
|
125
|
-
const
|
|
126
|
-
let
|
|
127
|
+
const l = [];
|
|
128
|
+
let p = t;
|
|
127
129
|
for (let r = 0; r < i.length; r++) {
|
|
128
130
|
const c = i[r], h = n[r], x = {
|
|
129
|
-
id: h?.start ===
|
|
130
|
-
start:
|
|
131
|
+
id: h?.start === p ? h.id : R++,
|
|
132
|
+
start: p,
|
|
131
133
|
token: c,
|
|
132
134
|
references: /* @__PURE__ */ new Set()
|
|
133
135
|
};
|
|
134
|
-
|
|
136
|
+
a.push(x), q(x), r === i.length - 1 && c.type === "paragraph" && _(c), (!e || !h || JSON.stringify(h.token) !== JSON.stringify(c)) && l.push({ kind: "replace", block: $(x) }), p += c.raw.length;
|
|
135
137
|
}
|
|
136
|
-
const f = new Set(
|
|
138
|
+
const f = new Set(a.slice(o).map((r) => r.id));
|
|
137
139
|
for (const r of n)
|
|
138
|
-
f.has(r.id) ||
|
|
140
|
+
f.has(r.id) || l.push({ kind: "remove", id: r.id });
|
|
139
141
|
const u = /* @__PURE__ */ new Set();
|
|
140
|
-
for (const r of /* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(
|
|
141
|
-
if (!(s[r]?.href ===
|
|
142
|
+
for (const r of /* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(d)]))
|
|
143
|
+
if (!(s[r]?.href === d[r]?.href && s[r]?.title === d[r]?.title))
|
|
142
144
|
for (const c of m.get(r) ?? [])
|
|
143
145
|
c.start < t && u.add(c);
|
|
144
146
|
for (const r of u) {
|
|
145
|
-
const c = F(r.token.raw,
|
|
146
|
-
c.length === 1 && (r.token = c[0],
|
|
147
|
+
const c = F(r.token.raw, d);
|
|
148
|
+
c.length === 1 && (r.token = c[0], l.push({ kind: "replace", block: $(r) }));
|
|
147
149
|
}
|
|
148
150
|
const P = o;
|
|
149
|
-
o = Math.max(0,
|
|
151
|
+
o = Math.max(0, a.length - 1), a[o]?.token.type === "space" ? o = Math.max(0, o - 1) : o > 0 && !a[o - 1].token.raw.endsWith(`
|
|
150
152
|
|
|
151
|
-
`) && (
|
|
152
|
-
const y =
|
|
153
|
-
o > 1 &&
|
|
153
|
+
`) && (a[o - 1]?.token.type !== "space" ? o-- : /\n[ \t]*\n/u.test(a[o - 1].token.raw) || (o = Math.max(0, o - 2)));
|
|
154
|
+
const y = a.at(-1)?.token;
|
|
155
|
+
o > 1 && a[o - 1]?.token.type === "space" && a[o - 2]?.token.type === "list" && (y?.type === "list" || y?.type === "paragraph" && /^ {0,3}(?:[0-9]{1,9}[.)]?|[-+*])[ \t]*$/u.test(y.raw)) && (o -= 2);
|
|
154
156
|
for (let r = P; r < o; r++) {
|
|
155
|
-
const c =
|
|
157
|
+
const c = a[r].token;
|
|
156
158
|
c.type === "def" && !v[c.tag] && (v[c.tag] = { href: c.href, title: c.title });
|
|
157
159
|
}
|
|
158
|
-
return G(), w(
|
|
160
|
+
return G(), w(l);
|
|
159
161
|
}
|
|
160
162
|
function J(e) {
|
|
161
163
|
const t = I && e.startsWith(`
|
|
@@ -167,8 +169,8 @@ function X(k) {
|
|
|
167
169
|
if (!e) return w([]);
|
|
168
170
|
if (C += e.length, e = J(e), !e) return w([]);
|
|
169
171
|
b.push({ start: L, text: e }), L += e.length;
|
|
170
|
-
const t =
|
|
171
|
-
if (t && o ===
|
|
172
|
+
const t = a.at(-1), n = t?.token;
|
|
173
|
+
if (t && o === a.length - 1 && n?.type === "code" && g && !e.includes("\r") && !E(e, g)) {
|
|
172
174
|
const s = (g.pendingNewline ? `
|
|
173
175
|
` : "") + (e.endsWith(`
|
|
174
176
|
`) ? e.slice(0, -1) : e);
|
|
@@ -176,10 +178,10 @@ function X(k) {
|
|
|
176
178
|
`), n.raw += e, n.text += s, w(s ? [{ kind: "append_text", id: t.id, text: s, code: !0 }] : []);
|
|
177
179
|
}
|
|
178
180
|
const i = n?.type === "paragraph" ? n : void 0;
|
|
179
|
-
if (t && o ===
|
|
180
|
-
const s = O,
|
|
181
|
-
if (i.raw += e, i.text += e,
|
|
182
|
-
const c =
|
|
181
|
+
if (t && o === a.length - 1 && i && O && S && !/[\n\r]/u.test(e)) {
|
|
182
|
+
const s = O, l = i.tokens.at(-1), p = l?.type === "text" && s.from === i.tokens.length - 1 && !z(e) && !s.extensionPending && !/[\\\x60*_[\]<>~&:/.@;|="'()-]/u.test(e) && !/[\\\x60*_[\]<>~&:/.@;|="'()-]$/u.test(s.lastChar);
|
|
183
|
+
if (i.raw += e, i.text += e, p) {
|
|
184
|
+
const c = l, h = s.unresolved ? -1 : e.lastIndexOf(" "), x = h > 0 ? e.slice(0, h) : h === 0 ? "" : e, T = [], A = i.tokens.length - 1;
|
|
183
185
|
if (x && (c.raw += x, c.text += x, T.push({
|
|
184
186
|
kind: "append_text",
|
|
185
187
|
id: t.id,
|
|
@@ -206,7 +208,7 @@ function X(k) {
|
|
|
206
208
|
return w(T);
|
|
207
209
|
}
|
|
208
210
|
const f = new k.Lexer({ ...k.defaults });
|
|
209
|
-
f.tokens.links =
|
|
211
|
+
f.tokens.links = d;
|
|
210
212
|
const u = s.source + e;
|
|
211
213
|
W += u.length;
|
|
212
214
|
const P = f.inlineTokens(u), y = i.tokens.length - s.from;
|
|
@@ -225,19 +227,13 @@ function X(k) {
|
|
|
225
227
|
return N();
|
|
226
228
|
}
|
|
227
229
|
function K(e = "") {
|
|
228
|
-
const t = l.map((s) => ({
|
|
229
|
-
kind: "remove",
|
|
230
|
-
id: s.id
|
|
231
|
-
}));
|
|
232
230
|
C = e.length, I = !1;
|
|
233
|
-
const
|
|
234
|
-
L =
|
|
235
|
-
const i = N();
|
|
236
|
-
return { ...i, changes: [...t, ...i.changes] };
|
|
231
|
+
const t = J(e);
|
|
232
|
+
return L = t.length, b = t ? [{ start: 0, text: t }] : [], d = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), m.clear(), o = 0, g = void 0, M++, N(!0);
|
|
237
233
|
}
|
|
238
234
|
function Q() {
|
|
239
|
-
const e =
|
|
240
|
-
return e.links = { ...
|
|
235
|
+
const e = a.map((t) => structuredClone(t.token));
|
|
236
|
+
return e.links = { ...d }, e;
|
|
241
237
|
}
|
|
242
238
|
function V() {
|
|
243
239
|
return M++, o = 0, v = /* @__PURE__ */ Object.create(null), N(!0);
|
|
@@ -250,7 +246,7 @@ function X(k) {
|
|
|
250
246
|
get sourceLength() {
|
|
251
247
|
return C;
|
|
252
248
|
},
|
|
253
|
-
diagnostics: () => ({ fullParses: M, parsedCharacters: W, blocks:
|
|
249
|
+
diagnostics: () => ({ fullParses: M, parsedCharacters: W, blocks: a.length })
|
|
254
250
|
};
|
|
255
251
|
}
|
|
256
252
|
export {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { createComponent as n, mergeProps as s, insert as i, effect as g, setAttribute as u, template as m } from "solid-js/web";
|
|
2
|
+
import { createMemo as d } from "solid-js";
|
|
3
|
+
import { cn as f } from "../../utils/cn.js";
|
|
4
4
|
import { Button as o } from "./Button.js";
|
|
5
|
-
import { Dialog as
|
|
6
|
-
import { usePickerNavigation as
|
|
5
|
+
import { Dialog as h } from "./Dialog.js";
|
|
6
|
+
import { usePickerNavigation as P, PickerPanel as v, pickerCopy as b } from "./picker/PickerBase.js";
|
|
7
7
|
import { parsePickerPath as w } from "./picker/PickerNavigation.js";
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
if (e.disabled ||
|
|
12
|
-
const
|
|
13
|
-
e.onSelect(
|
|
8
|
+
var x = /* @__PURE__ */ m('<div class="flex w-full items-center gap-2"><span class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">');
|
|
9
|
+
function $(e) {
|
|
10
|
+
const a = d(() => [...new Set((e.suggestedPaths ?? []).map((r) => w(r)).filter(Boolean))]), t = P(e, () => e.open, void 0, void 0, () => a().length ? "suggestions" : "browse"), c = () => {
|
|
11
|
+
if (e.disabled || t.view() !== "browse" || !t.valid()) return;
|
|
12
|
+
const r = t.currentPath();
|
|
13
|
+
e.onSelect(r), e.onOpenChange(!1);
|
|
14
14
|
};
|
|
15
|
-
return
|
|
15
|
+
return n(h, {
|
|
16
16
|
get open() {
|
|
17
17
|
return e.open;
|
|
18
18
|
},
|
|
@@ -23,50 +23,46 @@ function T(e) {
|
|
|
23
23
|
return e.title ?? "Select Directory";
|
|
24
24
|
},
|
|
25
25
|
get class() {
|
|
26
|
-
return
|
|
26
|
+
return f("max-w-lg", e.class);
|
|
27
27
|
},
|
|
28
28
|
get footer() {
|
|
29
29
|
return (() => {
|
|
30
|
-
var
|
|
31
|
-
return
|
|
30
|
+
var r = x(), l = r.firstChild;
|
|
31
|
+
return i(l, () => t.currentPath()), i(r, n(o, {
|
|
32
32
|
variant: "ghost",
|
|
33
33
|
size: "sm",
|
|
34
34
|
onClick: () => e.onOpenChange(!1),
|
|
35
35
|
get children() {
|
|
36
|
-
return e.cancelText ??
|
|
36
|
+
return e.cancelText ?? b(e).cancel;
|
|
37
37
|
}
|
|
38
|
-
}), null),
|
|
38
|
+
}), null), i(r, n(o, {
|
|
39
39
|
variant: "primary",
|
|
40
40
|
size: "sm",
|
|
41
|
-
onClick:
|
|
41
|
+
onClick: c,
|
|
42
42
|
get disabled() {
|
|
43
|
-
return e.disabled ||
|
|
43
|
+
return e.disabled || t.view() !== "browse" || !t.valid();
|
|
44
44
|
},
|
|
45
45
|
get children() {
|
|
46
46
|
return e.confirmText ?? "Select";
|
|
47
47
|
}
|
|
48
|
-
}), null),
|
|
48
|
+
}), null), g(() => u(l, "title", t.currentPath())), r;
|
|
49
49
|
})();
|
|
50
50
|
},
|
|
51
51
|
get children() {
|
|
52
|
-
return
|
|
53
|
-
source:
|
|
52
|
+
return n(v, s(e, {
|
|
53
|
+
source: t,
|
|
54
54
|
suggestions: {
|
|
55
55
|
get paths() {
|
|
56
|
-
return
|
|
56
|
+
return a();
|
|
57
57
|
},
|
|
58
58
|
get label() {
|
|
59
59
|
return e.suggestedPathsLabel ?? "Suggested directories";
|
|
60
|
-
}
|
|
61
|
-
get visible() {
|
|
62
|
-
return i();
|
|
63
|
-
},
|
|
64
|
-
onVisibilityChange: s
|
|
60
|
+
}
|
|
65
61
|
}
|
|
66
62
|
}));
|
|
67
63
|
}
|
|
68
64
|
});
|
|
69
65
|
}
|
|
70
66
|
export {
|
|
71
|
-
|
|
67
|
+
$ as DirectoryPicker
|
|
72
68
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent as
|
|
1
|
+
import { createComponent as a, insert as c, mergeProps as z, spread as K, use as L, effect as j, setAttribute as M, className as V, memo as H, template as x, delegateEvents as R } from "solid-js/web";
|
|
2
2
|
import { createSignal as U, mergeProps as Y, createMemo as q, Show as w, For as G } from "solid-js";
|
|
3
3
|
import { cn as N } from "../../utils/cn.js";
|
|
4
4
|
import { deferNonBlocking as J } from "../../utils/defer.js";
|
|
@@ -6,53 +6,53 @@ import { Check as Q } from "../icons/index.js";
|
|
|
6
6
|
import { FileItemIcon as W } from "../file-browser/FileIcons.js";
|
|
7
7
|
import { Button as D } from "./Button.js";
|
|
8
8
|
import { Dialog as X } from "./Dialog.js";
|
|
9
|
-
import { usePickerNavigation as Z, PickerPanel as ee, normalizePath as k, pickerCopy as
|
|
9
|
+
import { usePickerNavigation as Z, PickerPanel as ee, normalizePath as k, pickerCopy as b } from "./picker/PickerBase.js";
|
|
10
10
|
import { pickerParentPath as te } from "./picker/PickerNavigation.js";
|
|
11
|
-
var ne = /* @__PURE__ */
|
|
12
|
-
function
|
|
13
|
-
const
|
|
11
|
+
var ne = /* @__PURE__ */ x('<div class="flex min-h-[140px] overflow-hidden rounded border border-border"><div>'), ie = /* @__PURE__ */ x('<div class="flex flex-col gap-2 -mt-1">'), le = /* @__PURE__ */ x('<div class="flex items-center w-full gap-2"><span class="flex-1 text-[11px] text-muted-foreground truncate">'), re = /* @__PURE__ */ x('<div class="flex h-full items-center justify-center px-4 text-center text-xs text-muted-foreground">'), oe = /* @__PURE__ */ x('<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">'), ae = /* @__PURE__ */ x("<button type=button role=option><span class=truncate>");
|
|
12
|
+
function ce(e, s) {
|
|
13
|
+
const u = y(s), f = /* @__PURE__ */ new Set(), d = [];
|
|
14
14
|
for (const g of e ?? []) {
|
|
15
|
-
const
|
|
16
|
-
if (!(
|
|
15
|
+
const i = k(g);
|
|
16
|
+
if (!(i === "/" || f.has(i)) && (f.add(i), d.push(i), d.length >= u))
|
|
17
17
|
break;
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return d;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
if (
|
|
25
|
-
const g = e.indexOf(
|
|
26
|
-
return g >= 0 ? e.filter((
|
|
21
|
+
function se(e, s, u, f) {
|
|
22
|
+
const d = k(s);
|
|
23
|
+
if (d === "/") return [...e];
|
|
24
|
+
if (u === "single") return [d];
|
|
25
|
+
const g = e.indexOf(d);
|
|
26
|
+
return g >= 0 ? e.filter((i, h) => h !== g) : e.length >= y(f) ? [...e] : [...e, d];
|
|
27
27
|
}
|
|
28
28
|
function y(e) {
|
|
29
29
|
return e == null || !Number.isFinite(e) ? Number.POSITIVE_INFINITY : Math.max(1, Math.floor(e));
|
|
30
30
|
}
|
|
31
31
|
function ke(e) {
|
|
32
|
-
const
|
|
32
|
+
const s = () => e.selectionMode ?? "single", [u, f] = U([]), d = () => {
|
|
33
33
|
if (e.initialPath) return e.initialPath;
|
|
34
34
|
const t = e.initialSelectedPaths?.[0];
|
|
35
35
|
return t ? te(t) : void 0;
|
|
36
36
|
}, g = Y(e, {
|
|
37
37
|
get initialPath() {
|
|
38
|
-
return
|
|
38
|
+
return d();
|
|
39
39
|
},
|
|
40
40
|
get scopeKey() {
|
|
41
41
|
return e.scopeKey;
|
|
42
42
|
}
|
|
43
|
-
}),
|
|
44
|
-
f(
|
|
45
|
-
}), h = q(() =>
|
|
46
|
-
f((
|
|
47
|
-
}, P = (t =
|
|
48
|
-
if (t.length === 0 || !
|
|
49
|
-
const
|
|
50
|
-
e.onOpenChange(!1), J(() =>
|
|
51
|
-
}, E = (t,
|
|
52
|
-
let
|
|
53
|
-
t.key === "ArrowDown" && (
|
|
54
|
-
},
|
|
55
|
-
return
|
|
43
|
+
}), i = Z(g, () => e.open, void 0, () => {
|
|
44
|
+
f(ce(e.initialSelectedPaths, s() === "single" ? 1 : e.maxSelections));
|
|
45
|
+
}), h = q(() => i.entries().filter((t) => t.type === "file" && (!e.fileFilter || e.fileFilter(t)))), T = (t) => u().indexOf(k(t)), A = () => s() === "multiple" && u().length >= y(e.maxSelections), B = (t) => {
|
|
46
|
+
f((o) => se(o, t.path, s(), e.maxSelections));
|
|
47
|
+
}, P = (t = u()) => {
|
|
48
|
+
if (e.disabled || t.length === 0 || i.view() !== "browse" || !i.valid()) return;
|
|
49
|
+
const o = e.onSelect;
|
|
50
|
+
e.onOpenChange(!1), J(() => o([...t]));
|
|
51
|
+
}, E = (t, o) => {
|
|
52
|
+
let l;
|
|
53
|
+
t.key === "ArrowDown" && (l = Math.min(o + 1, h().length - 1)), t.key === "ArrowUp" && (l = Math.max(o - 1, 0)), t.key === "Home" && (l = 0), t.key === "End" && (l = h().length - 1), !(l == null || l < 0) && (t.preventDefault(), $[l]?.focus());
|
|
54
|
+
}, $ = [];
|
|
55
|
+
return a(X, {
|
|
56
56
|
get open() {
|
|
57
57
|
return e.open;
|
|
58
58
|
},
|
|
@@ -67,23 +67,23 @@ function ke(e) {
|
|
|
67
67
|
},
|
|
68
68
|
get footer() {
|
|
69
69
|
return (() => {
|
|
70
|
-
var t =
|
|
71
|
-
return
|
|
72
|
-
var
|
|
73
|
-
return () =>
|
|
74
|
-
})()),
|
|
70
|
+
var t = le(), o = t.firstChild;
|
|
71
|
+
return c(o, (() => {
|
|
72
|
+
var l = H(() => u().length === 0);
|
|
73
|
+
return () => l() ? b(e).noFilesSelected : b(e).selectedCount(u().length);
|
|
74
|
+
})()), c(t, a(D, {
|
|
75
75
|
variant: "ghost",
|
|
76
76
|
size: "sm",
|
|
77
77
|
onClick: () => e.onOpenChange(!1),
|
|
78
78
|
get children() {
|
|
79
|
-
return e.cancelText ??
|
|
79
|
+
return e.cancelText ?? b(e).cancel;
|
|
80
80
|
}
|
|
81
|
-
}), null),
|
|
81
|
+
}), null), c(t, a(D, {
|
|
82
82
|
variant: "primary",
|
|
83
83
|
size: "sm",
|
|
84
84
|
onClick: () => P(),
|
|
85
85
|
get disabled() {
|
|
86
|
-
return
|
|
86
|
+
return u().length === 0 || i.view() !== "browse" || !i.valid();
|
|
87
87
|
},
|
|
88
88
|
get children() {
|
|
89
89
|
return e.confirmText ?? "Select";
|
|
@@ -92,82 +92,90 @@ function ke(e) {
|
|
|
92
92
|
})();
|
|
93
93
|
},
|
|
94
94
|
get children() {
|
|
95
|
-
var t =
|
|
96
|
-
return
|
|
97
|
-
source:
|
|
98
|
-
})),
|
|
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;
|
|
103
|
-
}
|
|
104
|
-
}), !1, !0), m(i, u(w, {
|
|
95
|
+
var t = ie();
|
|
96
|
+
return c(t, a(ee, z(e, {
|
|
97
|
+
source: i
|
|
98
|
+
})), null), c(t, a(w, {
|
|
105
99
|
get when() {
|
|
106
|
-
return
|
|
107
|
-
},
|
|
108
|
-
get fallback() {
|
|
109
|
-
return (() => {
|
|
110
|
-
var d = le();
|
|
111
|
-
return m(d, () => e.emptyText ?? v(e).emptyFiles), d;
|
|
112
|
-
})();
|
|
100
|
+
return i.view() === "browse";
|
|
113
101
|
},
|
|
114
102
|
get children() {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
var o = ne(), l = o.firstChild;
|
|
104
|
+
return K(l, z(() => e.scrollViewportProps, {
|
|
105
|
+
class: "max-h-[200px] min-h-[140px] min-w-0 flex-1 overflow-y-auto",
|
|
106
|
+
role: "listbox",
|
|
107
|
+
get "aria-multiselectable"() {
|
|
108
|
+
return s() === "multiple" ? "true" : void 0;
|
|
109
|
+
}
|
|
110
|
+
}), !1, !0), c(l, a(w, {
|
|
111
|
+
get when() {
|
|
112
|
+
return h().length > 0;
|
|
118
113
|
},
|
|
119
|
-
|
|
120
|
-
const x = () => T(d.path), F = () => A() && x() < 0;
|
|
114
|
+
get fallback() {
|
|
121
115
|
return (() => {
|
|
122
|
-
var
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
116
|
+
var m = re();
|
|
117
|
+
return c(m, () => e.emptyText ?? b(e).emptyFiles), m;
|
|
118
|
+
})();
|
|
119
|
+
},
|
|
120
|
+
get children() {
|
|
121
|
+
return a(G, {
|
|
122
|
+
get each() {
|
|
123
|
+
return h();
|
|
124
|
+
},
|
|
125
|
+
children: (m, S) => {
|
|
126
|
+
const v = () => T(m.path), F = () => A() && v() < 0;
|
|
127
|
+
return (() => {
|
|
128
|
+
var r = ae(), _ = r.firstChild;
|
|
129
|
+
return r.$$keydown = (n) => E(n, S()), r.$$dblclick = () => {
|
|
130
|
+
s() === "single" && P([k(m.path)]);
|
|
131
|
+
}, r.$$click = () => B(m), L((n) => {
|
|
132
|
+
$[S()] = n;
|
|
133
|
+
}, r), c(r, a(W, {
|
|
134
|
+
item: m,
|
|
135
|
+
size: 16,
|
|
136
|
+
class: "w-4 h-4 flex-shrink-0"
|
|
137
|
+
}), _), c(_, () => m.name), c(r, a(w, {
|
|
138
138
|
get when() {
|
|
139
|
-
return
|
|
140
|
-
},
|
|
141
|
-
get fallback() {
|
|
142
|
-
return u(Q, {
|
|
143
|
-
class: "h-3 w-3"
|
|
144
|
-
});
|
|
139
|
+
return v() >= 0;
|
|
145
140
|
},
|
|
146
141
|
get children() {
|
|
147
|
-
|
|
142
|
+
var n = oe();
|
|
143
|
+
return c(n, a(w, {
|
|
144
|
+
get when() {
|
|
145
|
+
return s() === "multiple";
|
|
146
|
+
},
|
|
147
|
+
get fallback() {
|
|
148
|
+
return a(Q, {
|
|
149
|
+
class: "h-3 w-3"
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
get children() {
|
|
153
|
+
return v() + 1;
|
|
154
|
+
}
|
|
155
|
+
})), n;
|
|
148
156
|
}
|
|
149
|
-
})), n
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
})
|
|
157
|
+
}), null), j((n) => {
|
|
158
|
+
var C = v() >= 0, I = F(), O = F() ? b(e).selectionLimit : m.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", v() >= 0 && "bg-accent text-accent-foreground font-medium");
|
|
159
|
+
return C !== n.e && M(r, "aria-selected", n.e = C), I !== n.t && (r.disabled = n.t = I), O !== n.a && M(r, "title", n.a = O), p !== n.o && V(r, n.o = p), n;
|
|
160
|
+
}, {
|
|
161
|
+
e: void 0,
|
|
162
|
+
t: void 0,
|
|
163
|
+
a: void 0,
|
|
164
|
+
o: void 0
|
|
165
|
+
}), r;
|
|
166
|
+
})();
|
|
167
|
+
}
|
|
168
|
+
});
|
|
161
169
|
}
|
|
162
|
-
});
|
|
170
|
+
})), o;
|
|
163
171
|
}
|
|
164
|
-
})), t;
|
|
172
|
+
}), null), t;
|
|
165
173
|
}
|
|
166
174
|
});
|
|
167
175
|
}
|
|
168
176
|
R(["click", "dblclick", "keydown"]);
|
|
169
177
|
export {
|
|
170
178
|
ke as FileOpenPicker,
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
ce as normalizeFileOpenSelection,
|
|
180
|
+
se as updateFileOpenSelection
|
|
173
181
|
};
|