@floegence/floe-webapp-core 0.8.1 → 0.8.3
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/FileBrowserContext.d.ts +2 -0
- package/dist/components/file-browser/types.d.ts +1 -0
- package/dist/index41.js +121 -119
- package/dist/index42.js +17 -17
- package/dist/index46.js +63 -63
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ export interface FileBrowserProviderProps {
|
|
|
5
5
|
files: FileItem[];
|
|
6
6
|
initialPath?: string;
|
|
7
7
|
initialViewMode?: ViewMode;
|
|
8
|
+
/** Label for the root/home directory in breadcrumb (default: 'Root') */
|
|
9
|
+
homeLabel?: string;
|
|
8
10
|
onNavigate?: (path: string) => void;
|
|
9
11
|
onSelect?: (items: FileItem[]) => void;
|
|
10
12
|
onOpen?: (item: FileItem) => void;
|
|
@@ -133,6 +133,7 @@ export interface FileBrowserContextValue {
|
|
|
133
133
|
setCurrentPath: (path: string) => void;
|
|
134
134
|
navigateUp: () => void;
|
|
135
135
|
navigateTo: (item: FileItem) => void;
|
|
136
|
+
homeLabel: Accessor<string>;
|
|
136
137
|
selectedItems: Accessor<Set<string>>;
|
|
137
138
|
selectItem: (id: string, multi?: boolean) => void;
|
|
138
139
|
clearSelection: () => void;
|
package/dist/index41.js
CHANGED
|
@@ -1,168 +1,169 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { deferNonBlocking as
|
|
4
|
-
const
|
|
5
|
-
function Q(r,
|
|
6
|
-
if (!
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
for (const
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
|
|
1
|
+
import { createComponent as me } from "solid-js/web";
|
|
2
|
+
import { createContext as we, createSignal as a, createMemo as N, useContext as Pe } from "solid-js";
|
|
3
|
+
import { deferNonBlocking as F } from "./index70.js";
|
|
4
|
+
const R = we();
|
|
5
|
+
function Q(r, i) {
|
|
6
|
+
if (!i) return [];
|
|
7
|
+
const h = r.toLowerCase(), g = i.toLowerCase(), p = [];
|
|
8
|
+
let m = 0;
|
|
9
|
+
for (const x of g) {
|
|
10
|
+
const w = h.indexOf(x, m);
|
|
11
|
+
if (w === -1) return null;
|
|
12
|
+
p.push(w), m = w + 1;
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return p;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
16
|
+
function ye(r) {
|
|
17
|
+
const i = (e) => {
|
|
18
|
+
const t = (e ?? "").trim();
|
|
19
|
+
return t === "" ? "/" : t;
|
|
20
|
+
}, [h, g] = a(i(r.initialPath ?? "/")), [p, m] = a(/* @__PURE__ */ new Set()), [x, w] = a(r.initialViewMode ?? "list"), [I, V] = a({
|
|
18
21
|
field: "name",
|
|
19
22
|
direction: "asc"
|
|
20
|
-
}), [M,
|
|
21
|
-
let u = null,
|
|
23
|
+
}), [M, b] = a(/* @__PURE__ */ new Set(["/"])), [j, D] = a(!1), [G, O] = a(null), [S, k] = a(""), [H, B] = a(!1), J = () => r.homeLabel ?? "Root", [z, P] = a([]);
|
|
24
|
+
let u = null, v = {
|
|
22
25
|
top: 0,
|
|
23
26
|
left: 0
|
|
24
27
|
};
|
|
25
|
-
const A = () => r.files,
|
|
26
|
-
const t = (e
|
|
27
|
-
return t === "" ? "/" : t;
|
|
28
|
-
}, T = (e) => {
|
|
29
|
-
const t = c(e);
|
|
28
|
+
const A = () => r.files, L = (e) => {
|
|
29
|
+
const t = i(e);
|
|
30
30
|
if (t === "/") return "/";
|
|
31
31
|
const n = t.split("/").filter(Boolean);
|
|
32
32
|
return n.pop(), n.length ? "/" + n.join("/") : "/";
|
|
33
|
-
},
|
|
33
|
+
}, K = (e, t) => {
|
|
34
34
|
const n = z();
|
|
35
35
|
if (n.length === 0) return e;
|
|
36
36
|
let s = [...e];
|
|
37
|
-
const d =
|
|
37
|
+
const d = i(t);
|
|
38
38
|
for (const o of n)
|
|
39
39
|
switch (o.type) {
|
|
40
40
|
case "remove": {
|
|
41
|
-
const l = new Set(o.paths.map(
|
|
42
|
-
s = s.filter((
|
|
41
|
+
const l = new Set(o.paths.map(i));
|
|
42
|
+
s = s.filter((c) => !l.has(i(c.path)));
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
45
|
case "update": {
|
|
46
|
-
const l =
|
|
47
|
-
if (
|
|
48
|
-
const f = o.updates.path ?? s[
|
|
49
|
-
|
|
50
|
-
...s[
|
|
46
|
+
const l = i(o.oldPath), c = s.findIndex((f) => i(f.path) === l);
|
|
47
|
+
if (c !== -1) {
|
|
48
|
+
const f = o.updates.path ?? s[c].path;
|
|
49
|
+
L(f) === d ? s[c] = {
|
|
50
|
+
...s[c],
|
|
51
51
|
...o.updates
|
|
52
|
-
} : s.splice(
|
|
52
|
+
} : s.splice(c, 1);
|
|
53
53
|
} else {
|
|
54
54
|
const f = o.updates.path;
|
|
55
|
-
f &&
|
|
55
|
+
f && L(f);
|
|
56
56
|
}
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
59
59
|
case "insert": {
|
|
60
|
-
|
|
60
|
+
i(o.parentPath) === d && (s.some((c) => i(c.path) === i(o.item.path)) || s.push(o.item));
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
return s;
|
|
65
|
-
},
|
|
65
|
+
}, W = N(() => {
|
|
66
66
|
const e = /* @__PURE__ */ new Map(), t = (s) => {
|
|
67
67
|
var d;
|
|
68
68
|
for (const o of s)
|
|
69
|
-
o.type === "folder" && (e.set(
|
|
69
|
+
o.type === "folder" && (e.set(i(o.path), o.children ?? []), (d = o.children) != null && d.length && t(o.children));
|
|
70
70
|
}, n = A();
|
|
71
71
|
return e.set("/", n), t(n), e;
|
|
72
|
-
}),
|
|
73
|
-
const e =
|
|
74
|
-
let t =
|
|
75
|
-
t =
|
|
76
|
-
const n =
|
|
72
|
+
}), T = N(() => {
|
|
73
|
+
const e = i(h());
|
|
74
|
+
let t = W().get(e) ?? [];
|
|
75
|
+
t = K(t, e);
|
|
76
|
+
const n = S().trim();
|
|
77
77
|
n && (t = t.filter((o) => Q(o.name, n) !== null));
|
|
78
|
-
const s =
|
|
78
|
+
const s = I();
|
|
79
79
|
return [...t].sort((o, l) => {
|
|
80
|
-
var f,
|
|
80
|
+
var f, y;
|
|
81
81
|
if (o.type !== l.type)
|
|
82
82
|
return o.type === "folder" ? -1 : 1;
|
|
83
|
-
let
|
|
83
|
+
let c = 0;
|
|
84
84
|
switch (s.field) {
|
|
85
85
|
case "name":
|
|
86
|
-
|
|
86
|
+
c = o.name.localeCompare(l.name);
|
|
87
87
|
break;
|
|
88
88
|
case "size":
|
|
89
|
-
|
|
89
|
+
c = (o.size ?? 0) - (l.size ?? 0);
|
|
90
90
|
break;
|
|
91
91
|
case "modifiedAt":
|
|
92
|
-
|
|
92
|
+
c = (((f = o.modifiedAt) == null ? void 0 : f.getTime()) ?? 0) - (((y = l.modifiedAt) == null ? void 0 : y.getTime()) ?? 0);
|
|
93
93
|
break;
|
|
94
94
|
case "type":
|
|
95
|
-
|
|
95
|
+
c = (o.extension ?? "").localeCompare(l.extension ?? "");
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
|
-
return s.direction === "asc" ?
|
|
98
|
+
return s.direction === "asc" ? c : -c;
|
|
99
99
|
});
|
|
100
|
-
}),
|
|
100
|
+
}), C = (e) => {
|
|
101
101
|
var s;
|
|
102
|
-
const t =
|
|
103
|
-
|
|
102
|
+
const t = i(e);
|
|
103
|
+
if (t === h()) return;
|
|
104
|
+
g(t), m(/* @__PURE__ */ new Set()), k(""), B(!1);
|
|
104
105
|
const n = r.onSelect;
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
const e =
|
|
106
|
+
F(() => n == null ? void 0 : n([])), (s = r.onNavigate) == null || s.call(r, t);
|
|
107
|
+
}, X = () => {
|
|
108
|
+
const e = h();
|
|
108
109
|
if (e === "/" || e === "") return;
|
|
109
110
|
const t = e.split("/").filter(Boolean);
|
|
110
|
-
t.pop(),
|
|
111
|
-
},
|
|
112
|
-
e.type === "folder" && (
|
|
111
|
+
t.pop(), C(t.length ? "/" + t.join("/") : "/");
|
|
112
|
+
}, U = (e) => {
|
|
113
|
+
e.type === "folder" && (C(e.path), b((t) => {
|
|
113
114
|
const n = new Set(t);
|
|
114
115
|
return n.add(e.path), n;
|
|
115
116
|
}));
|
|
116
|
-
},
|
|
117
|
-
const n =
|
|
118
|
-
t ? s.has(e) ? s.delete(e) : s.add(e) : (s.clear(), s.add(e)),
|
|
119
|
-
const d =
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
|
|
117
|
+
}, Y = (e, t = !1) => {
|
|
118
|
+
const n = p(), s = t ? new Set(n) : /* @__PURE__ */ new Set();
|
|
119
|
+
t ? s.has(e) ? s.delete(e) : s.add(e) : (s.clear(), s.add(e)), m(s);
|
|
120
|
+
const d = T().filter((l) => s.has(l.id)), o = r.onSelect;
|
|
121
|
+
F(() => o == null ? void 0 : o(d));
|
|
122
|
+
}, Z = () => {
|
|
123
|
+
m(/* @__PURE__ */ new Set());
|
|
123
124
|
const e = r.onSelect;
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
|
|
125
|
+
F(() => e == null ? void 0 : e([]));
|
|
126
|
+
}, _ = (e) => p().has(e), $ = (e) => {
|
|
127
|
+
b((t) => {
|
|
127
128
|
const n = new Set(t);
|
|
128
129
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
129
130
|
});
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
const t =
|
|
131
|
+
}, ee = (e) => M().has(e), te = () => D((e) => !e), ne = (e) => O(e), oe = () => O(null), se = (e) => {
|
|
132
|
+
k(e);
|
|
133
|
+
}, re = (e) => {
|
|
134
|
+
const t = S().trim();
|
|
134
135
|
if (!t) return null;
|
|
135
136
|
const n = Q(e, t);
|
|
136
137
|
return n ? {
|
|
137
138
|
matchedIndices: n
|
|
138
139
|
} : null;
|
|
139
|
-
}, re = (e) => {
|
|
140
|
-
var t;
|
|
141
|
-
e.type === "folder" ? E(e) : (t = r.onOpen) == null || t.call(r, e);
|
|
142
140
|
}, ie = (e) => {
|
|
141
|
+
var t;
|
|
142
|
+
e.type === "folder" ? U(e) : (t = r.onOpen) == null || t.call(r, e);
|
|
143
|
+
}, ce = (e) => {
|
|
143
144
|
e.length !== 0 && P((t) => [...t, {
|
|
144
145
|
type: "remove",
|
|
145
146
|
paths: e
|
|
146
147
|
}]);
|
|
147
|
-
},
|
|
148
|
+
}, le = (e, t) => {
|
|
148
149
|
P((n) => [...n, {
|
|
149
150
|
type: "update",
|
|
150
151
|
oldPath: e,
|
|
151
152
|
updates: t
|
|
152
153
|
}]);
|
|
153
|
-
},
|
|
154
|
+
}, ae = (e, t) => {
|
|
154
155
|
P((n) => [...n, {
|
|
155
156
|
type: "insert",
|
|
156
157
|
parentPath: e,
|
|
157
158
|
item: t
|
|
158
159
|
}]);
|
|
159
|
-
}, ae = () => {
|
|
160
|
-
P([]);
|
|
161
160
|
}, de = () => {
|
|
162
161
|
P([]);
|
|
163
|
-
}, fe = () =>
|
|
162
|
+
}, fe = () => {
|
|
163
|
+
P([]);
|
|
164
|
+
}, ue = () => z().length > 0, he = (e) => {
|
|
164
165
|
u = e;
|
|
165
|
-
},
|
|
166
|
+
}, E = () => u ? {
|
|
166
167
|
top: u.scrollTop,
|
|
167
168
|
left: u.scrollLeft
|
|
168
169
|
} : {
|
|
@@ -171,66 +172,67 @@ function Ce(r) {
|
|
|
171
172
|
}, q = (e) => {
|
|
172
173
|
u && (u.scrollTop = e.top, u.scrollLeft = e.left);
|
|
173
174
|
}, pe = {
|
|
174
|
-
currentPath:
|
|
175
|
-
setCurrentPath:
|
|
176
|
-
navigateUp:
|
|
177
|
-
navigateTo:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
175
|
+
currentPath: h,
|
|
176
|
+
setCurrentPath: C,
|
|
177
|
+
navigateUp: X,
|
|
178
|
+
navigateTo: U,
|
|
179
|
+
homeLabel: J,
|
|
180
|
+
selectedItems: () => p(),
|
|
181
|
+
selectItem: Y,
|
|
182
|
+
clearSelection: Z,
|
|
183
|
+
isSelected: _,
|
|
184
|
+
viewMode: x,
|
|
185
|
+
setViewMode: w,
|
|
186
|
+
sortConfig: I,
|
|
187
|
+
setSortConfig: V,
|
|
186
188
|
expandedFolders: M,
|
|
187
|
-
toggleFolder:
|
|
188
|
-
isExpanded:
|
|
189
|
+
toggleFolder: $,
|
|
190
|
+
isExpanded: ee,
|
|
189
191
|
files: A,
|
|
190
|
-
currentFiles:
|
|
191
|
-
filterQuery:
|
|
192
|
-
setFilterQuery:
|
|
192
|
+
currentFiles: T,
|
|
193
|
+
filterQuery: S,
|
|
194
|
+
setFilterQuery: se,
|
|
193
195
|
isFilterActive: H,
|
|
194
196
|
setFilterActive: B,
|
|
195
|
-
getFilterMatch:
|
|
196
|
-
sidebarCollapsed:
|
|
197
|
-
toggleSidebar:
|
|
197
|
+
getFilterMatch: re,
|
|
198
|
+
sidebarCollapsed: j,
|
|
199
|
+
toggleSidebar: te,
|
|
198
200
|
contextMenu: G,
|
|
199
|
-
showContextMenu:
|
|
200
|
-
hideContextMenu:
|
|
201
|
-
openItem:
|
|
201
|
+
showContextMenu: ne,
|
|
202
|
+
hideContextMenu: oe,
|
|
203
|
+
openItem: ie,
|
|
202
204
|
// Optimistic updates
|
|
203
|
-
optimisticRemove:
|
|
204
|
-
optimisticUpdate:
|
|
205
|
-
optimisticInsert:
|
|
206
|
-
clearOptimisticUpdates:
|
|
207
|
-
rollbackOptimisticUpdates:
|
|
208
|
-
hasOptimisticUpdates:
|
|
205
|
+
optimisticRemove: ce,
|
|
206
|
+
optimisticUpdate: le,
|
|
207
|
+
optimisticInsert: ae,
|
|
208
|
+
clearOptimisticUpdates: de,
|
|
209
|
+
rollbackOptimisticUpdates: fe,
|
|
210
|
+
hasOptimisticUpdates: ue,
|
|
209
211
|
// Scroll position management
|
|
210
|
-
setScrollContainer:
|
|
211
|
-
getScrollPosition:
|
|
212
|
+
setScrollContainer: he,
|
|
213
|
+
getScrollPosition: E,
|
|
212
214
|
setScrollPosition: q,
|
|
213
|
-
saveScrollPosition: () => (
|
|
215
|
+
saveScrollPosition: () => (v = E(), v),
|
|
214
216
|
restoreScrollPosition: () => {
|
|
215
217
|
requestAnimationFrame(() => {
|
|
216
|
-
q(
|
|
218
|
+
q(v);
|
|
217
219
|
});
|
|
218
220
|
}
|
|
219
221
|
};
|
|
220
|
-
return
|
|
222
|
+
return me(R.Provider, {
|
|
221
223
|
value: pe,
|
|
222
224
|
get children() {
|
|
223
225
|
return r.children;
|
|
224
226
|
}
|
|
225
227
|
});
|
|
226
228
|
}
|
|
227
|
-
function
|
|
228
|
-
const r =
|
|
229
|
+
function Fe() {
|
|
230
|
+
const r = Pe(R);
|
|
229
231
|
if (!r)
|
|
230
232
|
throw new Error("useFileBrowser must be used within a FileBrowserProvider");
|
|
231
233
|
return r;
|
|
232
234
|
}
|
|
233
235
|
export {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
ye as FileBrowserProvider,
|
|
237
|
+
Fe as useFileBrowser
|
|
236
238
|
};
|
package/dist/index42.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { delegateEvents as U, template as x, insert as s, createComponent as o, effect as
|
|
2
|
-
import { createMemo as w, For as H, untrack as R, Show as
|
|
1
|
+
import { delegateEvents as U, template as x, insert as s, createComponent as o, effect as y, className as g, setAttribute as j, memo as k, setStyleProperty as B } from "solid-js/web";
|
|
2
|
+
import { createMemo as w, For as H, untrack as R, Show as $ } from "solid-js";
|
|
3
3
|
import { cn as v } from "./index69.js";
|
|
4
4
|
import { useFileBrowser as T } from "./index41.js";
|
|
5
5
|
import { FolderOpenIcon as X, FolderIcon as Y } from "./index48.js";
|
|
@@ -10,12 +10,12 @@ function ie(n) {
|
|
|
10
10
|
const i = T(), r = w(() => i.files().filter((c) => c.type === "folder"));
|
|
11
11
|
return (() => {
|
|
12
12
|
var c = _();
|
|
13
|
-
return c.$$contextmenu = (
|
|
13
|
+
return c.$$contextmenu = (b) => b.preventDefault(), s(c, o(F, {
|
|
14
14
|
get items() {
|
|
15
15
|
return r();
|
|
16
16
|
},
|
|
17
17
|
depth: 0
|
|
18
|
-
})),
|
|
18
|
+
})), y(() => g(c, v("flex flex-col", n.class))), c;
|
|
19
19
|
})();
|
|
20
20
|
}
|
|
21
21
|
function F(n) {
|
|
@@ -33,7 +33,7 @@ function F(n) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
function V(n) {
|
|
36
|
-
const i = T(), r = () => i.isExpanded(n.item.path), c = () => i.currentPath() === n.item.path,
|
|
36
|
+
const i = T(), r = () => i.isExpanded(n.item.path), c = () => i.currentPath() === n.item.path, b = R(() => n.item), f = z(i, b, {
|
|
37
37
|
selectOnOpen: !1
|
|
38
38
|
});
|
|
39
39
|
let u;
|
|
@@ -49,7 +49,7 @@ function V(n) {
|
|
|
49
49
|
}, I = (e) => {
|
|
50
50
|
u = e.pointerType, f.onPointerCancel();
|
|
51
51
|
}, L = (e) => {
|
|
52
|
-
f.consumeClickSuppression(e) || i.
|
|
52
|
+
f.consumeClickSuppression(e) || i.navigateTo(b);
|
|
53
53
|
}, N = (e) => {
|
|
54
54
|
e.preventDefault(), e.stopPropagation(), !M() && i.showContextMenu({
|
|
55
55
|
x: e.clientX,
|
|
@@ -61,7 +61,7 @@ function V(n) {
|
|
|
61
61
|
};
|
|
62
62
|
return (() => {
|
|
63
63
|
var e = K(), d = e.firstChild, l = d.firstChild, C = l.firstChild, A = C.nextSibling;
|
|
64
|
-
return s(d, o(
|
|
64
|
+
return s(d, o($, {
|
|
65
65
|
get when() {
|
|
66
66
|
return m();
|
|
67
67
|
},
|
|
@@ -72,15 +72,15 @@ function V(n) {
|
|
|
72
72
|
var t = G();
|
|
73
73
|
return t.$$click = O, s(t, o(q, {
|
|
74
74
|
class: "w-3 h-3 opacity-50"
|
|
75
|
-
})),
|
|
76
|
-
var
|
|
77
|
-
return
|
|
75
|
+
})), y((a) => {
|
|
76
|
+
var p = v("flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center cursor-pointer", "transition-transform duration-150", r() && "rotate-90", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring"), h = r() ? "Collapse folder" : "Expand folder";
|
|
77
|
+
return p !== a.e && g(t, a.e = p), h !== a.t && j(t, "aria-label", a.t = h), a;
|
|
78
78
|
}, {
|
|
79
79
|
e: void 0,
|
|
80
80
|
t: void 0
|
|
81
81
|
}), t;
|
|
82
82
|
}
|
|
83
|
-
}), l), l.addEventListener("pointercancel", I), l.$$pointerup = S, l.$$pointermove = E, l.$$pointerdown = D, l.$$contextmenu = N, l.$$click = L, s(C, o(
|
|
83
|
+
}), l), l.addEventListener("pointercancel", I), l.$$pointerup = S, l.$$pointermove = E, l.$$pointerdown = D, l.$$contextmenu = N, l.$$click = L, s(C, o($, {
|
|
84
84
|
get when() {
|
|
85
85
|
return k(() => !!m())() && r();
|
|
86
86
|
},
|
|
@@ -94,7 +94,7 @@ function V(n) {
|
|
|
94
94
|
class: "w-4 h-4"
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
})), s(A, () => n.item.name), s(l, o(
|
|
97
|
+
})), s(A, () => n.item.name), s(l, o($, {
|
|
98
98
|
get when() {
|
|
99
99
|
return m();
|
|
100
100
|
},
|
|
@@ -102,7 +102,7 @@ function V(n) {
|
|
|
102
102
|
var t = J();
|
|
103
103
|
return s(t, P), t;
|
|
104
104
|
}
|
|
105
|
-
}), null), s(e, o(
|
|
105
|
+
}), null), s(e, o($, {
|
|
106
106
|
get when() {
|
|
107
107
|
return k(() => !!r())() && m();
|
|
108
108
|
},
|
|
@@ -115,11 +115,11 @@ function V(n) {
|
|
|
115
115
|
get depth() {
|
|
116
116
|
return n.depth + 1;
|
|
117
117
|
}
|
|
118
|
-
})),
|
|
118
|
+
})), y(() => g(t, v("overflow-hidden transition-all duration-200", r() ? "opacity-100" : "opacity-0"))), t;
|
|
119
119
|
}
|
|
120
|
-
}), null),
|
|
121
|
-
var a = v("group flex items-center w-full py-1 text-xs", "transition-all duration-100", "hover:bg-sidebar-accent/60", c() && "bg-sidebar-accent text-sidebar-accent-foreground font-medium"),
|
|
122
|
-
return a !== t.e && g(d, t.e = a),
|
|
120
|
+
}), null), y((t) => {
|
|
121
|
+
var a = v("group flex items-center w-full py-1 text-xs", "transition-all duration-100", "hover:bg-sidebar-accent/60", c() && "bg-sidebar-accent text-sidebar-accent-foreground font-medium"), p = `${8 + n.depth * 12}px`, h = v("flex items-center gap-1 flex-1 min-w-0 text-left cursor-pointer pl-1", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring");
|
|
122
|
+
return a !== t.e && g(d, t.e = a), p !== t.t && B(d, "padding-left", t.t = p), h !== t.a && g(l, t.a = h), t;
|
|
123
123
|
}, {
|
|
124
124
|
e: void 0,
|
|
125
125
|
t: void 0,
|
package/dist/index46.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { delegateEvents as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { delegateEvents as A, template as b, insert as R, createComponent as a, memo as H, effect as x, className as W, use as P } from "solid-js/web";
|
|
2
|
+
import { createSignal as y, onMount as B, createMemo as M, For as O, Show as T, onCleanup as F } from "solid-js";
|
|
3
|
+
import { cn as C } from "./index69.js";
|
|
4
4
|
import { useFileBrowser as G } from "./index41.js";
|
|
5
|
-
import { ChevronRight as
|
|
5
|
+
import { ChevronRight as E } from "./index34.js";
|
|
6
6
|
import { Dropdown as z } from "./index24.js";
|
|
7
|
-
var X = /* @__PURE__ */
|
|
8
|
-
const
|
|
9
|
-
function V(
|
|
10
|
-
const
|
|
11
|
-
return Math.min(
|
|
7
|
+
var X = /* @__PURE__ */ b("<nav aria-label=Breadcrumb>"), j = /* @__PURE__ */ b('<button type=button title="Show hidden path segments">…'), q = /* @__PURE__ */ b('<button type=button><span class="truncate max-w-[120px] block">');
|
|
8
|
+
const p = 16, J = 28, D = 12, K = 7, Q = 120, U = 100;
|
|
9
|
+
function V(r) {
|
|
10
|
+
const n = r.length * K;
|
|
11
|
+
return Math.min(n + D, Q + D);
|
|
12
12
|
}
|
|
13
|
-
function ce(
|
|
14
|
-
const
|
|
13
|
+
function ce(r) {
|
|
14
|
+
const n = G();
|
|
15
15
|
let s;
|
|
16
|
-
const [t, c] =
|
|
17
|
-
|
|
16
|
+
const [t, c] = y(0);
|
|
17
|
+
B(() => {
|
|
18
18
|
if (!s) return;
|
|
19
19
|
const e = () => {
|
|
20
20
|
s && c(s.offsetWidth);
|
|
@@ -23,25 +23,25 @@ function ce(n) {
|
|
|
23
23
|
const o = new ResizeObserver(e);
|
|
24
24
|
o.observe(s), F(() => o.disconnect());
|
|
25
25
|
});
|
|
26
|
-
const d =
|
|
27
|
-
const e =
|
|
26
|
+
const d = M(() => {
|
|
27
|
+
const e = n.currentPath(), o = n.homeLabel();
|
|
28
28
|
if (e === "/" || e === "")
|
|
29
29
|
return [{
|
|
30
|
-
name:
|
|
30
|
+
name: o,
|
|
31
31
|
path: "/"
|
|
32
32
|
}];
|
|
33
|
-
const
|
|
34
|
-
name:
|
|
33
|
+
const l = e.split("/").filter(Boolean), i = [{
|
|
34
|
+
name: o,
|
|
35
35
|
path: "/"
|
|
36
36
|
}];
|
|
37
|
-
let
|
|
38
|
-
for (const
|
|
39
|
-
|
|
40
|
-
name:
|
|
41
|
-
path:
|
|
37
|
+
let f = "";
|
|
38
|
+
for (const g of l)
|
|
39
|
+
f += "/" + g, i.push({
|
|
40
|
+
name: g,
|
|
41
|
+
path: f
|
|
42
42
|
});
|
|
43
43
|
return i;
|
|
44
|
-
}), m =
|
|
44
|
+
}), m = M(() => {
|
|
45
45
|
const e = d(), o = t();
|
|
46
46
|
if (o < U || e.length <= 2)
|
|
47
47
|
return {
|
|
@@ -49,73 +49,73 @@ function ce(n) {
|
|
|
49
49
|
visible: e,
|
|
50
50
|
shouldCollapse: !1
|
|
51
51
|
};
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
52
|
+
const l = e.map((u) => V(u.name)), i = l[0], f = l[e.length - 1], g = p, $ = e.length > 1 ? p : 0, _ = i + f + g + $;
|
|
53
|
+
if (_ > o && e.length > 2)
|
|
54
54
|
return {
|
|
55
55
|
collapsed: e.slice(1, -1),
|
|
56
56
|
visible: [e[0], e[e.length - 1]],
|
|
57
57
|
shouldCollapse: !0
|
|
58
58
|
};
|
|
59
|
-
const h = e.slice(1, -1),
|
|
60
|
-
let
|
|
61
|
-
const
|
|
59
|
+
const h = e.slice(1, -1), v = [];
|
|
60
|
+
let w = o - _;
|
|
61
|
+
const L = h.length > 0 ? J + p : 0;
|
|
62
62
|
for (let u = h.length - 1; u >= 0; u--) {
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
|
|
63
|
+
const k = l[u + 1] + p, N = u > 0 ? L : 0;
|
|
64
|
+
if (w - N >= k)
|
|
65
|
+
v.unshift(h[u]), w -= k;
|
|
66
66
|
else
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const I = h.slice(0, h.length - v.length);
|
|
70
70
|
return {
|
|
71
|
-
collapsed:
|
|
72
|
-
visible: [e[0], ...
|
|
73
|
-
shouldCollapse:
|
|
71
|
+
collapsed: I,
|
|
72
|
+
visible: [e[0], ...v, e[e.length - 1]],
|
|
73
|
+
shouldCollapse: I.length > 0
|
|
74
74
|
};
|
|
75
|
-
}),
|
|
76
|
-
|
|
75
|
+
}), S = (e) => {
|
|
76
|
+
n.setCurrentPath(e.path);
|
|
77
77
|
};
|
|
78
78
|
return (() => {
|
|
79
79
|
var e = X(), o = s;
|
|
80
|
-
return typeof o == "function" ?
|
|
80
|
+
return typeof o == "function" ? P(o, e) : s = e, R(e, a(O, {
|
|
81
81
|
get each() {
|
|
82
82
|
return m().visible;
|
|
83
83
|
},
|
|
84
|
-
children: (
|
|
84
|
+
children: (l, i) => [a(T, {
|
|
85
85
|
get when() {
|
|
86
|
-
return
|
|
86
|
+
return i() > 0;
|
|
87
87
|
},
|
|
88
88
|
get children() {
|
|
89
|
-
return a(
|
|
89
|
+
return a(E, {
|
|
90
90
|
class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
}), a(
|
|
93
|
+
}), a(T, {
|
|
94
94
|
get when() {
|
|
95
|
-
return
|
|
95
|
+
return H(() => !!m().shouldCollapse)() && i() === 1;
|
|
96
96
|
},
|
|
97
97
|
get children() {
|
|
98
98
|
return [a(Y, {
|
|
99
99
|
get segments() {
|
|
100
100
|
return m().collapsed;
|
|
101
101
|
},
|
|
102
|
-
onSelect:
|
|
103
|
-
}), a(
|
|
102
|
+
onSelect: S
|
|
103
|
+
}), a(E, {
|
|
104
104
|
class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
|
|
105
105
|
})];
|
|
106
106
|
}
|
|
107
107
|
}), a(Z, {
|
|
108
|
-
segment:
|
|
108
|
+
segment: l,
|
|
109
109
|
get isLast() {
|
|
110
|
-
return
|
|
110
|
+
return i() === m().visible.length - 1;
|
|
111
111
|
},
|
|
112
|
-
onClick: () =>
|
|
112
|
+
onClick: () => S(l)
|
|
113
113
|
})]
|
|
114
|
-
})),
|
|
114
|
+
})), x(() => W(e, C("flex items-center gap-1 min-w-0 overflow-hidden", r.class))), e;
|
|
115
115
|
})();
|
|
116
116
|
}
|
|
117
|
-
function Y(
|
|
118
|
-
const
|
|
117
|
+
function Y(r) {
|
|
118
|
+
const n = () => r.segments.map((t) => ({
|
|
119
119
|
id: t.path,
|
|
120
120
|
label: t.name
|
|
121
121
|
}));
|
|
@@ -123,32 +123,32 @@ function Y(n) {
|
|
|
123
123
|
get trigger() {
|
|
124
124
|
return (() => {
|
|
125
125
|
var t = j();
|
|
126
|
-
return
|
|
126
|
+
return x(() => W(t, C("text-xs px-1.5 py-0.5 rounded cursor-pointer flex-shrink-0", "transition-all duration-100", "text-muted-foreground hover:text-foreground hover:bg-muted/50", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"))), t;
|
|
127
127
|
})();
|
|
128
128
|
},
|
|
129
129
|
get items() {
|
|
130
|
-
return
|
|
130
|
+
return n();
|
|
131
131
|
},
|
|
132
132
|
onSelect: (t) => {
|
|
133
|
-
const c =
|
|
134
|
-
c &&
|
|
133
|
+
const c = r.segments.find((d) => d.path === t);
|
|
134
|
+
c && r.onSelect(c);
|
|
135
135
|
},
|
|
136
136
|
align: "start"
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
function Z(
|
|
139
|
+
function Z(r) {
|
|
140
140
|
return (() => {
|
|
141
|
-
var
|
|
142
|
-
return
|
|
143
|
-
var c =
|
|
144
|
-
return c !== t.e && (
|
|
141
|
+
var n = q(), s = n.firstChild;
|
|
142
|
+
return n.$$click = () => r.onClick(), R(s, () => r.segment.name), x((t) => {
|
|
143
|
+
var c = r.isLast, d = C("text-xs px-1.5 py-0.5 rounded cursor-pointer flex-shrink-0", "transition-all duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", r.isLast ? "font-medium text-foreground cursor-default" : "text-muted-foreground hover:text-foreground hover:bg-muted/50");
|
|
144
|
+
return c !== t.e && (n.disabled = t.e = c), d !== t.t && W(n, t.t = d), t;
|
|
145
145
|
}, {
|
|
146
146
|
e: void 0,
|
|
147
147
|
t: void 0
|
|
148
|
-
}),
|
|
148
|
+
}), n;
|
|
149
149
|
})();
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
A(["click"]);
|
|
152
152
|
export {
|
|
153
153
|
ce as Breadcrumb
|
|
154
154
|
};
|