@floegence/floe-webapp-core 0.35.32 → 0.35.34
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/file-browser/DirectoryTree.js +84 -86
- package/dist/components/file-browser/FileContextMenu.d.ts +2 -2
- package/dist/components/file-browser/FileContextMenu.js +300 -142
- package/dist/components/file-browser/FileGridView.js +50 -45
- package/dist/components/file-browser/FileIcons.d.ts +10 -2
- package/dist/components/file-browser/FileIcons.js +289 -181
- package/dist/components/file-browser/FileListView.js +99 -94
- package/dist/components/file-browser/contextMenuEvent.d.ts +10 -0
- package/dist/components/file-browser/contextMenuEvent.js +19 -0
- package/dist/components/file-browser/index.d.ts +2 -2
- package/dist/components/file-browser/longPressContextMenu.d.ts +1 -0
- package/dist/components/file-browser/longPressContextMenu.js +45 -32
- package/dist/components/file-browser/types.d.ts +23 -1
- package/dist/components/layout/Shell.d.ts +8 -0
- package/dist/components/layout/Shell.js +157 -138
- package/dist/components/layout/Sidebar.d.ts +2 -0
- package/dist/components/layout/Sidebar.js +39 -38
- package/dist/components/layout/sidebarVisibilityMotion.d.ts +22 -0
- package/dist/components/layout/sidebarVisibilityMotion.js +16 -0
- package/dist/components/ui/Dropdown.d.ts +0 -1
- package/dist/components/ui/Dropdown.js +150 -204
- package/dist/components/ui/menuUtils.d.ts +15 -0
- package/dist/components/ui/menuUtils.js +60 -0
- package/dist/components/ui/picker/PickerBase.js +90 -96
- package/dist/context/LayoutContext.d.ts +5 -0
- package/dist/context/LayoutContext.js +58 -46
- package/dist/file-browser.js +35 -31
- package/dist/full.js +411 -407
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { insert as d, createComponent as
|
|
2
|
-
import { createSignal as _, createMemo as L, createEffect as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { deferAfterPaint as
|
|
5
|
-
import { Button as
|
|
1
|
+
import { insert as d, createComponent as s, effect as F, className as I, style as Y, memo as H, template as $, setAttribute as Z, setStyleProperty as ee, delegateEvents as te } from "solid-js/web";
|
|
2
|
+
import { createSignal as _, createMemo as L, createEffect as A, on as K, For as B, Show as T } from "solid-js";
|
|
3
|
+
import { cn as p } from "../../../utils/cn.js";
|
|
4
|
+
import { deferAfterPaint as ne } from "../../../utils/defer.js";
|
|
5
|
+
import { Button as z } from "../Button.js";
|
|
6
6
|
import { Input as W } from "../Input.js";
|
|
7
|
-
import { ChevronRight as j, Check as
|
|
8
|
-
import { FolderOpenIcon as
|
|
9
|
-
var
|
|
7
|
+
import { ChevronRight as j, Check as re, X as oe, Plus as le } from "../../icons/index.js";
|
|
8
|
+
import { FolderOpenIcon as ie, FileItemIcon as ae } from "../../file-browser/FileIcons.js";
|
|
9
|
+
var M = /* @__PURE__ */ $('<div class="flex items-center gap-1.5"><div class=flex-1>'), ce = /* @__PURE__ */ $('<p class="text-[11px] text-muted-foreground -mt-1">Creating in: '), se = /* @__PURE__ */ $("<button type=button><span>New Folder"), ue = /* @__PURE__ */ $('<nav class="flex items-center gap-0.5 min-w-0 overflow-x-auto py-0.5"aria-label="Selected path">'), O = /* @__PURE__ */ $("<button type=button>"), de = /* @__PURE__ */ $('<div class="flex items-center justify-center py-6 text-xs text-muted-foreground">'), he = /* @__PURE__ */ $("<div><button type=button><span>"), fe = /* @__PURE__ */ $("<div class=overflow-hidden>"), ge = /* @__PURE__ */ $('<div class="flex flex-col"><div><button type=button><span class="flex-shrink-0 w-4 h-4"></span><span class=truncate>'), me = /* @__PURE__ */ $('<span class="flex-shrink-0 w-4 h-4">');
|
|
10
10
|
function y(e) {
|
|
11
11
|
const l = (e ?? "").trim();
|
|
12
12
|
if (l === "" || l === "/") return "/";
|
|
13
13
|
const n = l.replace(/\/+$/, "");
|
|
14
14
|
return n.startsWith("/") ? n : "/" + n;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function G(e) {
|
|
17
17
|
const l = e.split("/").filter(Boolean), n = [];
|
|
18
18
|
let r = "";
|
|
19
19
|
for (let i = 0; i < l.length - 1; i++)
|
|
@@ -33,7 +33,7 @@ function xe(e, l) {
|
|
|
33
33
|
const n = y(e ?? "/"), r = l ? y(l) : void 0;
|
|
34
34
|
return !r || r === "/" ? n : n === r ? "/" : n.startsWith(r + "/") ? y(n.slice(r.length)) : n;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function Ie(e) {
|
|
37
37
|
const l = () => (typeof e.homeLabel == "function" ? e.homeLabel() : e.homeLabel) ?? "Root", n = () => {
|
|
38
38
|
const t = typeof e.homePath == "function" ? e.homePath() : e.homePath;
|
|
39
39
|
return t ? y(t) : void 0;
|
|
@@ -50,34 +50,34 @@ function pe(e) {
|
|
|
50
50
|
if (!a) return y(t);
|
|
51
51
|
const h = y(t);
|
|
52
52
|
return h === a ? "/" : a !== "/" && h.startsWith(a + "/") ? h.slice(a.length) || "/" : y(t);
|
|
53
|
-
}, [b, v] = _(r()), [P, f] = _(/* @__PURE__ */ new Set(["/"])), [k, o] = _(i(r())), [x, w] = _(""),
|
|
54
|
-
K(
|
|
53
|
+
}, [b, v] = _(r()), [P, f] = _(/* @__PURE__ */ new Set(["/"])), [k, o] = _(i(r())), [x, w] = _(""), c = ve(e.files), g = L(() => e.files().filter((t) => t.type === "folder"));
|
|
54
|
+
A(K(e.open, (t) => {
|
|
55
55
|
if (t) {
|
|
56
56
|
const a = r();
|
|
57
57
|
v(a), o(i(a)), w("");
|
|
58
|
-
const h =
|
|
58
|
+
const h = G(a);
|
|
59
59
|
f(/* @__PURE__ */ new Set(["/", ...h])), e.onReset?.(a);
|
|
60
60
|
}
|
|
61
|
-
})), K(
|
|
61
|
+
})), A(K(b, (t) => {
|
|
62
62
|
o(i(t)), w("");
|
|
63
63
|
}));
|
|
64
64
|
const S = (t) => {
|
|
65
65
|
const a = y(t);
|
|
66
|
-
return a === "/" ||
|
|
66
|
+
return a === "/" || c().has(a);
|
|
67
67
|
}, C = (t) => e.filter ? e.filter(t) : !0, E = (t) => {
|
|
68
|
-
const a =
|
|
68
|
+
const a = G(t);
|
|
69
69
|
f((h) => {
|
|
70
70
|
const m = new Set(h);
|
|
71
71
|
for (const D of a) m.add(D);
|
|
72
72
|
return m.add(t), m;
|
|
73
73
|
});
|
|
74
|
-
},
|
|
74
|
+
}, X = (t) => {
|
|
75
75
|
const a = P().has(t);
|
|
76
76
|
f((h) => {
|
|
77
77
|
const m = new Set(h);
|
|
78
78
|
return m.has(t) ? m.delete(t) : m.add(t), m;
|
|
79
79
|
}), a || e.onExpand?.(t);
|
|
80
|
-
},
|
|
80
|
+
}, q = (t) => {
|
|
81
81
|
if (!C(t)) return;
|
|
82
82
|
v(t.path);
|
|
83
83
|
const a = P().has(t.path);
|
|
@@ -85,14 +85,14 @@ function pe(e) {
|
|
|
85
85
|
const m = new Set(h);
|
|
86
86
|
return m.add(t.path), m;
|
|
87
87
|
}), a || e.onExpand?.(t.path);
|
|
88
|
-
},
|
|
88
|
+
}, J = () => {
|
|
89
89
|
v("/");
|
|
90
|
-
},
|
|
90
|
+
}, N = () => {
|
|
91
91
|
const t = u(k().trim());
|
|
92
92
|
S(t) ? (v(t), w(""), E(t)) : w("Path not found");
|
|
93
|
-
},
|
|
94
|
-
t.key === "Enter" && (t.preventDefault(),
|
|
95
|
-
},
|
|
93
|
+
}, Q = (t) => {
|
|
94
|
+
t.key === "Enter" && (t.preventDefault(), N());
|
|
95
|
+
}, U = L(() => {
|
|
96
96
|
const t = b(), a = l();
|
|
97
97
|
if (t === "/" || t === "") return [{
|
|
98
98
|
name: a,
|
|
@@ -103,9 +103,9 @@ function pe(e) {
|
|
|
103
103
|
path: "/"
|
|
104
104
|
}];
|
|
105
105
|
let D = "";
|
|
106
|
-
for (const
|
|
107
|
-
D += "/" +
|
|
108
|
-
name:
|
|
106
|
+
for (const R of h)
|
|
107
|
+
D += "/" + R, m.push({
|
|
108
|
+
name: R,
|
|
109
109
|
path: D
|
|
110
110
|
});
|
|
111
111
|
return m;
|
|
@@ -114,21 +114,21 @@ function pe(e) {
|
|
|
114
114
|
selectedPath: b,
|
|
115
115
|
setSelectedPath: v,
|
|
116
116
|
expandedPaths: P,
|
|
117
|
-
toggleExpand:
|
|
117
|
+
toggleExpand: X,
|
|
118
118
|
pathInput: k,
|
|
119
119
|
setPathInput: o,
|
|
120
120
|
pathInputError: x,
|
|
121
121
|
setPathInputError: w,
|
|
122
|
-
folderIndex:
|
|
122
|
+
folderIndex: c,
|
|
123
123
|
rootFolders: g,
|
|
124
124
|
isValidPath: S,
|
|
125
125
|
isSelectable: C,
|
|
126
|
-
handleSelectFolder:
|
|
127
|
-
handleSelectRoot:
|
|
128
|
-
handlePathInputGo:
|
|
129
|
-
handlePathInputKeyDown:
|
|
126
|
+
handleSelectFolder: q,
|
|
127
|
+
handleSelectRoot: J,
|
|
128
|
+
handlePathInputGo: N,
|
|
129
|
+
handlePathInputKeyDown: Q,
|
|
130
130
|
expandToPath: E,
|
|
131
|
-
breadcrumbSegments:
|
|
131
|
+
breadcrumbSegments: U,
|
|
132
132
|
handleBreadcrumbClick: (t) => {
|
|
133
133
|
v(t), E(t);
|
|
134
134
|
},
|
|
@@ -136,7 +136,7 @@ function pe(e) {
|
|
|
136
136
|
toDisplayPath: i
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function pe(e) {
|
|
140
140
|
const [l, n] = _(!1), [r, i] = _(""), [u, b] = _(!1), v = () => {
|
|
141
141
|
n(!0), i("");
|
|
142
142
|
}, P = () => {
|
|
@@ -145,9 +145,9 @@ function Ie(e) {
|
|
|
145
145
|
const o = r().trim();
|
|
146
146
|
if (!o || u()) return;
|
|
147
147
|
b(!0);
|
|
148
|
-
const x = e.parentPath(), w = o,
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
const x = e.parentPath(), w = o, c = e.onCreateFolder;
|
|
149
|
+
ne(() => {
|
|
150
|
+
c(x, w).then(() => {
|
|
151
151
|
n(!1), i("");
|
|
152
152
|
}).catch((g) => {
|
|
153
153
|
console.error("Failed to create folder:", g);
|
|
@@ -158,22 +158,22 @@ function Ie(e) {
|
|
|
158
158
|
}, k = (o) => {
|
|
159
159
|
o.key === "Enter" ? (o.preventDefault(), f()) : o.key === "Escape" && (o.preventDefault(), P());
|
|
160
160
|
};
|
|
161
|
-
return
|
|
161
|
+
return s(T, {
|
|
162
162
|
get when() {
|
|
163
163
|
return l();
|
|
164
164
|
},
|
|
165
165
|
get fallback() {
|
|
166
166
|
return (() => {
|
|
167
167
|
var o = se(), x = o.firstChild;
|
|
168
|
-
return o.$$click = v, d(o,
|
|
168
|
+
return o.$$click = v, d(o, s(le, {
|
|
169
169
|
class: "w-3.5 h-3.5"
|
|
170
|
-
}), x),
|
|
170
|
+
}), x), F(() => I(o, p("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"))), o;
|
|
171
171
|
})();
|
|
172
172
|
},
|
|
173
173
|
get children() {
|
|
174
174
|
return [(() => {
|
|
175
|
-
var o =
|
|
176
|
-
return d(x,
|
|
175
|
+
var o = M(), x = o.firstChild;
|
|
176
|
+
return d(x, s(W, {
|
|
177
177
|
size: "sm",
|
|
178
178
|
get value() {
|
|
179
179
|
return r();
|
|
@@ -185,7 +185,7 @@ function Ie(e) {
|
|
|
185
185
|
return u();
|
|
186
186
|
},
|
|
187
187
|
autofocus: !0
|
|
188
|
-
})), d(o,
|
|
188
|
+
})), d(o, s(z, {
|
|
189
189
|
variant: "primary",
|
|
190
190
|
size: "sm",
|
|
191
191
|
onClick: f,
|
|
@@ -196,11 +196,11 @@ function Ie(e) {
|
|
|
196
196
|
return !r().trim();
|
|
197
197
|
},
|
|
198
198
|
get children() {
|
|
199
|
-
return
|
|
199
|
+
return s(re, {
|
|
200
200
|
class: "w-3.5 h-3.5"
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
-
}), null), d(o,
|
|
203
|
+
}), null), d(o, s(z, {
|
|
204
204
|
variant: "ghost-destructive",
|
|
205
205
|
size: "sm",
|
|
206
206
|
onClick: P,
|
|
@@ -208,7 +208,7 @@ function Ie(e) {
|
|
|
208
208
|
return u();
|
|
209
209
|
},
|
|
210
210
|
get children() {
|
|
211
|
-
return
|
|
211
|
+
return s(oe, {
|
|
212
212
|
class: "w-3.5 h-3.5"
|
|
213
213
|
});
|
|
214
214
|
}
|
|
@@ -216,7 +216,7 @@ function Ie(e) {
|
|
|
216
216
|
})(), (() => {
|
|
217
217
|
var o = ce();
|
|
218
218
|
return o.firstChild, d(o, (() => {
|
|
219
|
-
var x =
|
|
219
|
+
var x = H(() => !!e.toDisplayPath);
|
|
220
220
|
return () => x() ? e.toDisplayPath(e.parentPath()) : e.parentPath();
|
|
221
221
|
})(), null), o;
|
|
222
222
|
})()];
|
|
@@ -225,8 +225,8 @@ function Ie(e) {
|
|
|
225
225
|
}
|
|
226
226
|
function Ee(e) {
|
|
227
227
|
return (() => {
|
|
228
|
-
var l =
|
|
229
|
-
return d(n,
|
|
228
|
+
var l = M(), n = l.firstChild;
|
|
229
|
+
return d(n, s(W, {
|
|
230
230
|
size: "sm",
|
|
231
231
|
get value() {
|
|
232
232
|
return e.value();
|
|
@@ -241,7 +241,7 @@ function Ee(e) {
|
|
|
241
241
|
get error() {
|
|
242
242
|
return e.error();
|
|
243
243
|
}
|
|
244
|
-
})), d(l,
|
|
244
|
+
})), d(l, s(z, {
|
|
245
245
|
variant: "outline",
|
|
246
246
|
size: "sm",
|
|
247
247
|
get onClick() {
|
|
@@ -254,22 +254,22 @@ function Ee(e) {
|
|
|
254
254
|
function Fe(e) {
|
|
255
255
|
return (() => {
|
|
256
256
|
var l = ue();
|
|
257
|
-
return d(l,
|
|
257
|
+
return d(l, s(B, {
|
|
258
258
|
get each() {
|
|
259
259
|
return e.segments();
|
|
260
260
|
},
|
|
261
|
-
children: (n, r) => [
|
|
261
|
+
children: (n, r) => [s(T, {
|
|
262
262
|
get when() {
|
|
263
263
|
return r() > 0;
|
|
264
264
|
},
|
|
265
265
|
get children() {
|
|
266
|
-
return
|
|
266
|
+
return s(j, {
|
|
267
267
|
class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
}), (() => {
|
|
271
|
-
var i =
|
|
272
|
-
return i.$$click = () => e.onClick(n.path), d(i, () => n.name),
|
|
271
|
+
var i = O();
|
|
272
|
+
return i.$$click = () => e.onClick(n.path), d(i, () => n.name), F(() => I(i, p("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", r() === e.segments().length - 1 ? "font-medium text-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"))), i;
|
|
273
273
|
})()]
|
|
274
274
|
})), l;
|
|
275
275
|
})();
|
|
@@ -278,13 +278,13 @@ function Te(e) {
|
|
|
278
278
|
const l = () => (typeof e.homeLabel == "function" ? e.homeLabel() : e.homeLabel) ?? "Root";
|
|
279
279
|
return (() => {
|
|
280
280
|
var n = he(), r = n.firstChild, i = r.firstChild;
|
|
281
|
-
return r.$$click = () => e.onSelectRoot(), d(r,
|
|
281
|
+
return r.$$click = () => e.onSelectRoot(), d(r, s(ie, {
|
|
282
282
|
class: "w-4 h-4 flex-shrink-0"
|
|
283
|
-
}), i), d(i, l), d(n,
|
|
283
|
+
}), i), d(i, l), d(n, s(B, {
|
|
284
284
|
get each() {
|
|
285
285
|
return e.rootFolders();
|
|
286
286
|
},
|
|
287
|
-
children: (u) =>
|
|
287
|
+
children: (u) => s(V, {
|
|
288
288
|
item: u,
|
|
289
289
|
depth: 1,
|
|
290
290
|
get selectedPath() {
|
|
@@ -303,7 +303,7 @@ function Te(e) {
|
|
|
303
303
|
return e.isSelectable;
|
|
304
304
|
}
|
|
305
305
|
})
|
|
306
|
-
}), null), d(n,
|
|
306
|
+
}), null), d(n, s(T, {
|
|
307
307
|
get when() {
|
|
308
308
|
return e.rootFolders().length === 0;
|
|
309
309
|
},
|
|
@@ -311,9 +311,9 @@ function Te(e) {
|
|
|
311
311
|
var u = de();
|
|
312
312
|
return d(u, () => e.emptyText ?? "No directories available"), u;
|
|
313
313
|
}
|
|
314
|
-
}), null),
|
|
315
|
-
var b =
|
|
316
|
-
return b !== u.e &&
|
|
314
|
+
}), null), F((u) => {
|
|
315
|
+
var b = p("border border-border rounded overflow-y-auto", e.class), v = e.style, P = 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", e.selectedPath() === "/" && "bg-accent text-accent-foreground font-medium");
|
|
316
|
+
return b !== u.e && I(n, u.e = b), u.t = Y(n, v, u.t), P !== u.a && I(r, u.a = P), u;
|
|
317
317
|
}, {
|
|
318
318
|
e: void 0,
|
|
319
319
|
t: void 0,
|
|
@@ -321,7 +321,7 @@ function Te(e) {
|
|
|
321
321
|
}), n;
|
|
322
322
|
})();
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function V(e) {
|
|
325
325
|
const l = () => e.expandedPaths().has(e.item.path), n = () => e.selectedPath() === e.item.path, r = () => e.isSelectable(e.item), i = L(() => e.item.children?.filter((f) => f.type === "folder") ?? []), u = () => i().length > 0, b = () => e.item.type === "folder", v = (f) => {
|
|
326
326
|
f.stopPropagation(), e.onToggle(e.item.path);
|
|
327
327
|
}, P = () => {
|
|
@@ -329,7 +329,7 @@ function X(e) {
|
|
|
329
329
|
};
|
|
330
330
|
return (() => {
|
|
331
331
|
var f = ge(), k = f.firstChild, o = k.firstChild, x = o.firstChild, w = x.nextSibling;
|
|
332
|
-
return d(k,
|
|
332
|
+
return d(k, s(T, {
|
|
333
333
|
get when() {
|
|
334
334
|
return b();
|
|
335
335
|
},
|
|
@@ -337,42 +337,36 @@ function X(e) {
|
|
|
337
337
|
return me();
|
|
338
338
|
},
|
|
339
339
|
get children() {
|
|
340
|
-
var
|
|
341
|
-
return
|
|
340
|
+
var c = O();
|
|
341
|
+
return c.$$click = v, d(c, s(j, {
|
|
342
342
|
class: "w-3 h-3 opacity-60"
|
|
343
|
-
})),
|
|
344
|
-
var S =
|
|
345
|
-
return S !== g.e &&
|
|
343
|
+
})), F((g) => {
|
|
344
|
+
var S = p("flex-shrink-0 w-4 h-4 flex items-center justify-center cursor-pointer", "transition-transform duration-150", l() && "rotate-90", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring"), C = l() ? "Collapse folder" : "Expand folder";
|
|
345
|
+
return S !== g.e && I(c, g.e = S), C !== g.t && Z(c, "aria-label", g.t = C), g;
|
|
346
346
|
}, {
|
|
347
347
|
e: void 0,
|
|
348
348
|
t: void 0
|
|
349
|
-
}),
|
|
349
|
+
}), c;
|
|
350
350
|
}
|
|
351
|
-
}), o), o.$$click = P, d(x,
|
|
352
|
-
get
|
|
353
|
-
return
|
|
351
|
+
}), o), o.$$click = P, d(x, s(ae, {
|
|
352
|
+
get item() {
|
|
353
|
+
return e.item;
|
|
354
354
|
},
|
|
355
|
-
get
|
|
356
|
-
return
|
|
357
|
-
class: "w-4 h-4"
|
|
358
|
-
});
|
|
355
|
+
get open() {
|
|
356
|
+
return l();
|
|
359
357
|
},
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
class: "w-4 h-4"
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
})), d(w, () => e.item.name), d(f, c(F, {
|
|
358
|
+
class: "w-4 h-4"
|
|
359
|
+
})), d(w, () => e.item.name), d(f, s(T, {
|
|
366
360
|
get when() {
|
|
367
|
-
return
|
|
361
|
+
return H(() => !!l())() && u();
|
|
368
362
|
},
|
|
369
363
|
get children() {
|
|
370
|
-
var
|
|
371
|
-
return d(
|
|
364
|
+
var c = fe();
|
|
365
|
+
return d(c, s(B, {
|
|
372
366
|
get each() {
|
|
373
367
|
return i();
|
|
374
368
|
},
|
|
375
|
-
children: (g) =>
|
|
369
|
+
children: (g) => s(V, {
|
|
376
370
|
item: g,
|
|
377
371
|
get depth() {
|
|
378
372
|
return e.depth + 1;
|
|
@@ -393,11 +387,11 @@ function X(e) {
|
|
|
393
387
|
return e.isSelectable;
|
|
394
388
|
}
|
|
395
389
|
})
|
|
396
|
-
})),
|
|
390
|
+
})), c;
|
|
397
391
|
}
|
|
398
|
-
}), null),
|
|
399
|
-
var g =
|
|
400
|
-
return g !==
|
|
392
|
+
}), null), F((c) => {
|
|
393
|
+
var g = p("group flex items-center w-full text-xs", "transition-colors duration-100", r() ? "hover:bg-accent/60" : "opacity-50", n() && r() && "bg-accent text-accent-foreground font-medium"), S = `${4 + e.depth * 14}px`, C = !r(), E = p("flex items-center gap-1 flex-1 min-w-0 text-left py-1.5 pl-0.5 pr-2", r() ? "cursor-pointer" : "cursor-not-allowed", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring");
|
|
394
|
+
return g !== c.e && I(k, c.e = g), S !== c.t && ee(k, "padding-left", c.t = S), C !== c.a && (o.disabled = c.a = C), E !== c.o && I(o, c.o = E), c;
|
|
401
395
|
}, {
|
|
402
396
|
e: void 0,
|
|
403
397
|
t: void 0,
|
|
@@ -406,16 +400,16 @@ function X(e) {
|
|
|
406
400
|
}), f;
|
|
407
401
|
})();
|
|
408
402
|
}
|
|
409
|
-
|
|
403
|
+
te(["click"]);
|
|
410
404
|
export {
|
|
411
|
-
|
|
405
|
+
pe as NewFolderSection,
|
|
412
406
|
Ee as PathInputBar,
|
|
413
407
|
Fe as PickerBreadcrumb,
|
|
414
408
|
Te as PickerFolderTree,
|
|
415
|
-
|
|
416
|
-
|
|
409
|
+
V as PickerTreeNode,
|
|
410
|
+
G as getAncestorPaths,
|
|
417
411
|
y as normalizePath,
|
|
418
412
|
xe as resolvePickerInitialPath,
|
|
419
413
|
ve as useFolderIndex,
|
|
420
|
-
|
|
414
|
+
Ie as usePickerTree
|
|
421
415
|
};
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { type Accessor } from 'solid-js';
|
|
2
|
+
export type SidebarVisibilityMotion = 'animated' | 'instant';
|
|
2
3
|
export interface LayoutContextValue {
|
|
3
4
|
sidebarWidth: Accessor<number>;
|
|
4
5
|
sidebarActiveTab: Accessor<string>;
|
|
5
6
|
sidebarCollapsed: Accessor<boolean>;
|
|
7
|
+
sidebarVisibilityMotion: Accessor<SidebarVisibilityMotion>;
|
|
8
|
+
sidebarVisibilityMotionRevision: Accessor<number>;
|
|
6
9
|
clampSidebarWidth: (width: number) => number;
|
|
7
10
|
setSidebarWidth: (width: number) => void;
|
|
8
11
|
setSidebarActiveTab: (tab: string, opts?: {
|
|
9
12
|
openSidebar?: boolean;
|
|
13
|
+
visibilityMotion?: SidebarVisibilityMotion;
|
|
10
14
|
}) => void;
|
|
11
15
|
setSidebarCollapsed: (collapsed: boolean) => void;
|
|
12
16
|
toggleSidebarCollapse: () => void;
|
|
17
|
+
clearSidebarVisibilityMotion: (revision: number) => void;
|
|
13
18
|
terminalOpened: Accessor<boolean>;
|
|
14
19
|
terminalHeight: Accessor<number>;
|
|
15
20
|
toggleTerminal: () => void;
|
|
@@ -1,76 +1,88 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { createStore as
|
|
3
|
-
import { createSimpleContext as
|
|
4
|
-
import { useResolvedFloeConfig as
|
|
1
|
+
import { createEffect as f } from "solid-js";
|
|
2
|
+
import { createStore as c, produce as r } from "solid-js/store";
|
|
3
|
+
import { createSimpleContext as u } from "./createSimpleContext.js";
|
|
4
|
+
import { useResolvedFloeConfig as v } from "./FloeConfigContext.js";
|
|
5
5
|
const {
|
|
6
|
-
Provider:
|
|
7
|
-
use:
|
|
8
|
-
} =
|
|
6
|
+
Provider: x,
|
|
7
|
+
use: C
|
|
8
|
+
} = u({
|
|
9
9
|
name: "Layout",
|
|
10
|
-
init:
|
|
10
|
+
init: g
|
|
11
11
|
});
|
|
12
|
-
function
|
|
13
|
-
const
|
|
12
|
+
function g() {
|
|
13
|
+
const n = v(), i = () => n.config.layout, p = () => typeof window > "u" ? !1 : window.matchMedia(i().mobileQuery).matches, s = n.persist.load(i().storageKey, {}), h = {
|
|
14
14
|
sidebar: {
|
|
15
|
-
width:
|
|
16
|
-
activeTab:
|
|
17
|
-
collapsed:
|
|
15
|
+
width: s.sidebar?.width ?? i().sidebar.defaultWidth,
|
|
16
|
+
activeTab: s.sidebar?.activeTab ?? i().sidebar.defaultActiveTab,
|
|
17
|
+
collapsed: s.sidebar?.collapsed ?? i().sidebar.defaultCollapsed
|
|
18
18
|
},
|
|
19
19
|
terminal: {
|
|
20
|
-
opened:
|
|
21
|
-
height:
|
|
20
|
+
opened: s.terminal?.opened ?? i().terminal.defaultOpened,
|
|
21
|
+
height: s.terminal?.height ?? i().terminal.defaultHeight
|
|
22
22
|
},
|
|
23
|
-
isMobile:
|
|
24
|
-
}, [
|
|
25
|
-
|
|
23
|
+
isMobile: p()
|
|
24
|
+
}, [t, o] = c(h), [l, b] = c({
|
|
25
|
+
motion: "animated",
|
|
26
|
+
revision: 0
|
|
27
|
+
}), m = (e) => Math.max(i().sidebar.clamp.min, Math.min(i().sidebar.clamp.max, e));
|
|
28
|
+
return f(() => {
|
|
26
29
|
const e = {
|
|
27
30
|
sidebar: {
|
|
28
|
-
width:
|
|
29
|
-
activeTab:
|
|
30
|
-
collapsed:
|
|
31
|
+
width: t.sidebar.width,
|
|
32
|
+
activeTab: t.sidebar.activeTab,
|
|
33
|
+
collapsed: t.sidebar.collapsed
|
|
31
34
|
},
|
|
32
35
|
terminal: {
|
|
33
|
-
opened:
|
|
34
|
-
height:
|
|
36
|
+
opened: t.terminal.opened,
|
|
37
|
+
height: t.terminal.height
|
|
35
38
|
}
|
|
36
39
|
};
|
|
37
|
-
|
|
40
|
+
n.persist.debouncedSave(i().storageKey, e);
|
|
38
41
|
}), {
|
|
39
42
|
// Sidebar accessors
|
|
40
|
-
sidebarWidth: () =>
|
|
41
|
-
sidebarActiveTab: () =>
|
|
42
|
-
sidebarCollapsed: () =>
|
|
43
|
-
|
|
43
|
+
sidebarWidth: () => t.sidebar.width,
|
|
44
|
+
sidebarActiveTab: () => t.sidebar.activeTab,
|
|
45
|
+
sidebarCollapsed: () => t.sidebar.collapsed,
|
|
46
|
+
sidebarVisibilityMotion: () => l.motion,
|
|
47
|
+
sidebarVisibilityMotionRevision: () => l.revision,
|
|
48
|
+
clampSidebarWidth: m,
|
|
44
49
|
// Sidebar actions
|
|
45
|
-
setSidebarWidth: (e) =>
|
|
46
|
-
|
|
50
|
+
setSidebarWidth: (e) => o(r((a) => {
|
|
51
|
+
a.sidebar.width = m(e);
|
|
47
52
|
})),
|
|
48
|
-
setSidebarActiveTab: (e,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
setSidebarActiveTab: (e, a) => {
|
|
54
|
+
o(r((d) => {
|
|
55
|
+
d.sidebar.activeTab = e, a?.openSidebar !== !1 && (d.sidebar.collapsed = !1);
|
|
56
|
+
})), a?.visibilityMotion === "instant" && b(r((d) => {
|
|
57
|
+
d.motion = "instant", d.revision += 1;
|
|
58
|
+
}));
|
|
59
|
+
},
|
|
60
|
+
setSidebarCollapsed: (e) => o(r((a) => {
|
|
61
|
+
a.sidebar.collapsed = e;
|
|
53
62
|
})),
|
|
54
|
-
toggleSidebarCollapse: () =>
|
|
63
|
+
toggleSidebarCollapse: () => o(r((e) => {
|
|
55
64
|
e.sidebar.collapsed = !e.sidebar.collapsed;
|
|
56
65
|
})),
|
|
66
|
+
clearSidebarVisibilityMotion: (e) => {
|
|
67
|
+
l.revision === e && b("motion", "animated");
|
|
68
|
+
},
|
|
57
69
|
// Terminal accessors
|
|
58
|
-
terminalOpened: () =>
|
|
59
|
-
terminalHeight: () =>
|
|
70
|
+
terminalOpened: () => t.terminal.opened,
|
|
71
|
+
terminalHeight: () => t.terminal.height,
|
|
60
72
|
// Terminal actions
|
|
61
|
-
toggleTerminal: () =>
|
|
73
|
+
toggleTerminal: () => o(r((e) => {
|
|
62
74
|
e.terminal.opened = !e.terminal.opened;
|
|
63
75
|
})),
|
|
64
|
-
setTerminalHeight: (e) =>
|
|
65
|
-
|
|
76
|
+
setTerminalHeight: (e) => o(r((a) => {
|
|
77
|
+
a.terminal.height = Math.max(i().terminal.clamp.min, Math.min(i().terminal.clamp.max, e));
|
|
66
78
|
})),
|
|
67
79
|
// Mobile
|
|
68
|
-
isMobile: () =>
|
|
69
|
-
setIsMobile: (e) =>
|
|
80
|
+
isMobile: () => t.isMobile,
|
|
81
|
+
setIsMobile: (e) => o("isMobile", e)
|
|
70
82
|
};
|
|
71
83
|
}
|
|
72
84
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
x as LayoutProvider,
|
|
86
|
+
g as createLayoutService,
|
|
87
|
+
C as useLayout
|
|
76
88
|
};
|