@floegence/floe-webapp-core 0.36.72 → 0.36.74
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 +72 -65
- package/dist/components/file-browser/FileGridView.js +78 -72
- package/dist/components/file-browser/FileItemDecorations.d.ts +9 -0
- package/dist/components/file-browser/FileItemDecorations.js +59 -0
- package/dist/components/file-browser/FileListView.js +195 -186
- package/dist/components/file-browser/index.d.ts +1 -1
- package/dist/components/file-browser/types.d.ts +15 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -2
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { insert as l, createComponent as s, effect as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { insert as l, createComponent as s, effect as y, className as h, template as v, setAttribute as G, spread as X, mergeProps as Y, memo as q, setStyleProperty as J, delegateEvents as K } from "solid-js/web";
|
|
2
|
+
import { createMemo as T, For as Q, untrack as W, createSignal as Z, Show as w } from "solid-js";
|
|
3
|
+
import { cn as u } from "../../utils/cn.js";
|
|
4
4
|
import { useFileBrowser as _ } from "./FileBrowserContext.js";
|
|
5
5
|
import { useFileBrowserDrag as ee } from "../../context/FileBrowserDragContext.js";
|
|
6
6
|
import { FileItemIcon as te } from "./FileIcons.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { FileItemDecorationBadge as ne, fileItemDecorationNameClass as re } from "./FileItemDecorations.js";
|
|
8
|
+
import { ChevronRight as ie } from "../icons/index.js";
|
|
9
|
+
import { createLongPressContextMenuHandlers as ae } from "./longPressContextMenu.js";
|
|
10
|
+
import { fileBrowserTouchTargetAttrs as oe } from "./touchInteractionGuard.js";
|
|
11
|
+
import { createItemContextMenuEvent as le } from "./contextMenuEvent.js";
|
|
12
|
+
var M = /* @__PURE__ */ v("<div>"), se = /* @__PURE__ */ v("<button type=button>"), ce = /* @__PURE__ */ v('<span class="ml-auto mr-2 text-[10px] text-muted-foreground/60 opacity-0 group-hover:opacity-100 transition-opacity">'), ge = /* @__PURE__ */ v('<div class="flex flex-col"><div><button type=button><span class="relative flex-shrink-0 w-4 h-4"></span><span>'), de = /* @__PURE__ */ v('<span class="flex-shrink-0 w-3.5 h-3.5">');
|
|
13
|
+
function we(e) {
|
|
14
|
+
const o = _(), i = ee(), P = () => (e.enableDragDrop ?? !0) && !!i, x = () => e.instanceId ?? "default", g = T(() => o.files().filter((r) => r.type === "folder"));
|
|
14
15
|
return (() => {
|
|
15
|
-
var r =
|
|
16
|
-
return r.$$contextmenu = (
|
|
16
|
+
var r = M();
|
|
17
|
+
return r.$$contextmenu = (I) => I.preventDefault(), l(r, s(p, {
|
|
17
18
|
get items() {
|
|
18
19
|
return g();
|
|
19
20
|
},
|
|
20
21
|
depth: 0,
|
|
21
22
|
get instanceId() {
|
|
22
|
-
return
|
|
23
|
+
return x();
|
|
23
24
|
},
|
|
24
25
|
get enableDragDrop() {
|
|
25
|
-
return
|
|
26
|
+
return P();
|
|
26
27
|
},
|
|
27
28
|
dragContext: i
|
|
28
|
-
})),
|
|
29
|
+
})), y(() => h(r, u("flex flex-col", e.class))), r;
|
|
29
30
|
})();
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
const o =
|
|
32
|
+
function p(e) {
|
|
33
|
+
const o = T(() => e.items.filter((i) => i.type === "folder"));
|
|
33
34
|
return s(Q, {
|
|
34
35
|
get each() {
|
|
35
36
|
return o();
|
|
36
37
|
},
|
|
37
|
-
children: (i) => s(
|
|
38
|
+
children: (i) => s(ue, {
|
|
38
39
|
item: i,
|
|
39
40
|
get depth() {
|
|
40
41
|
return e.depth;
|
|
@@ -51,85 +52,85 @@ function M(e) {
|
|
|
51
52
|
})
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
const o = _(), i = () => o.isExpanded(e.item.path),
|
|
55
|
+
function ue(e) {
|
|
56
|
+
const o = _(), i = () => o.isExpanded(e.item.path), P = () => o.currentPath() === e.item.path, x = W(() => e.item), g = ae(o, x, {
|
|
56
57
|
selectOnOpen: !1,
|
|
57
58
|
source: "tree"
|
|
58
59
|
});
|
|
59
60
|
let r;
|
|
60
|
-
const [
|
|
61
|
+
const [I, $] = Z(!1), F = () => r === "touch" || r === "pen", E = T(() => e.item.children?.filter((t) => t.type === "folder").length ?? 0), D = () => E() > 0, S = () => {
|
|
61
62
|
if (!e.enableDragDrop || !e.dragContext) return !1;
|
|
62
63
|
const t = e.dragContext.dragState();
|
|
63
64
|
return t.isDragging ? e.dragContext.canDropOn(t.draggedItems, e.item.path, e.item, e.instanceId) : !1;
|
|
64
|
-
},
|
|
65
|
+
}, B = () => e.dragContext?.dragState(), L = () => B()?.isDragging ?? !1, k = () => I() && L() && e.enableDragDrop, A = (t) => {
|
|
65
66
|
r = t.pointerType, g.onPointerDown(t);
|
|
66
|
-
},
|
|
67
|
+
}, N = (t) => {
|
|
67
68
|
r = t.pointerType, g.onPointerMove(t);
|
|
68
|
-
},
|
|
69
|
+
}, O = (t) => {
|
|
69
70
|
r = t.pointerType, g.onPointerUp();
|
|
70
|
-
},
|
|
71
|
+
}, H = (t) => {
|
|
71
72
|
r = t.pointerType, g.onPointerCancel();
|
|
72
73
|
}, R = (t) => {
|
|
73
74
|
if (!e.enableDragDrop || !e.dragContext) return;
|
|
74
75
|
const a = e.dragContext.dragState();
|
|
75
76
|
if (!a.isDragging) return;
|
|
76
|
-
|
|
77
|
-
const d = e.dragContext.canDropOn(a.draggedItems, e.item.path, e.item, e.instanceId),
|
|
77
|
+
$(!0);
|
|
78
|
+
const d = e.dragContext.canDropOn(a.draggedItems, e.item.path, e.item, e.instanceId), C = t.currentTarget?.getBoundingClientRect() ?? null;
|
|
78
79
|
e.dragContext.setDropTarget({
|
|
79
80
|
instanceId: e.instanceId,
|
|
80
81
|
targetPath: e.item.path,
|
|
81
82
|
targetItem: e.item
|
|
82
|
-
}, d,
|
|
83
|
+
}, d, C);
|
|
83
84
|
}, U = (t) => {
|
|
84
85
|
if (!e.dragContext) return;
|
|
85
|
-
|
|
86
|
+
$(!1);
|
|
86
87
|
const a = e.dragContext.dragState();
|
|
87
88
|
a.isDragging && a.dropTarget?.targetPath === e.item.path && e.dragContext.setDropTarget(null, !1);
|
|
88
89
|
}, V = (t) => {
|
|
89
|
-
g.consumeClickSuppression(t) || o.navigateTo(
|
|
90
|
+
g.consumeClickSuppression(t) || o.navigateTo(x);
|
|
90
91
|
}, j = (t) => {
|
|
91
|
-
t.preventDefault(), t.stopPropagation(), !F() && o.showContextMenu(
|
|
92
|
+
t.preventDefault(), t.stopPropagation(), !F() && o.showContextMenu(le({
|
|
92
93
|
x: t.clientX,
|
|
93
94
|
y: t.clientY,
|
|
94
95
|
triggerItem: e.item,
|
|
95
96
|
items: [e.item],
|
|
96
97
|
source: "tree"
|
|
97
98
|
}));
|
|
98
|
-
},
|
|
99
|
-
|
|
99
|
+
}, z = () => {
|
|
100
|
+
D() && o.toggleFolder(e.item.path);
|
|
100
101
|
};
|
|
101
102
|
return (() => {
|
|
102
|
-
var t =
|
|
103
|
+
var t = ge(), a = t.firstChild, d = a.firstChild, b = d.firstChild, C = b.nextSibling;
|
|
103
104
|
return a.addEventListener("pointerleave", U), a.addEventListener("pointerenter", R), l(a, s(w, {
|
|
104
105
|
get when() {
|
|
105
|
-
return
|
|
106
|
+
return D();
|
|
106
107
|
},
|
|
107
108
|
get fallback() {
|
|
108
|
-
return
|
|
109
|
+
return de();
|
|
109
110
|
},
|
|
110
111
|
get children() {
|
|
111
|
-
var n =
|
|
112
|
-
return n.$$click =
|
|
112
|
+
var n = se();
|
|
113
|
+
return n.$$click = z, l(n, s(ie, {
|
|
113
114
|
class: "w-3 h-3 opacity-50"
|
|
114
|
-
})),
|
|
115
|
-
var
|
|
116
|
-
return
|
|
115
|
+
})), y((c) => {
|
|
116
|
+
var m = u("flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center cursor-pointer", "transition-transform duration-150", i() && "rotate-90", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring"), f = i() ? "Collapse folder" : "Expand folder";
|
|
117
|
+
return m !== c.e && h(n, c.e = m), f !== c.t && G(n, "aria-label", c.t = f), c;
|
|
117
118
|
}, {
|
|
118
119
|
e: void 0,
|
|
119
120
|
t: void 0
|
|
120
121
|
}), n;
|
|
121
122
|
}
|
|
122
|
-
}), d),
|
|
123
|
+
}), d), X(d, Y(oe, {
|
|
123
124
|
onClick: V,
|
|
124
125
|
onContextMenu: j,
|
|
125
|
-
onPointerDown:
|
|
126
|
-
onPointerMove:
|
|
127
|
-
onPointerUp:
|
|
128
|
-
onPointerCancel:
|
|
126
|
+
onPointerDown: A,
|
|
127
|
+
onPointerMove: N,
|
|
128
|
+
onPointerUp: O,
|
|
129
|
+
onPointerCancel: H,
|
|
129
130
|
get class() {
|
|
130
|
-
return
|
|
131
|
+
return u("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");
|
|
131
132
|
}
|
|
132
|
-
}), !1, !0), l(
|
|
133
|
+
}), !1, !0), l(b, s(te, {
|
|
133
134
|
get item() {
|
|
134
135
|
return e.item;
|
|
135
136
|
},
|
|
@@ -137,21 +138,26 @@ function ge(e) {
|
|
|
137
138
|
return i();
|
|
138
139
|
},
|
|
139
140
|
class: "w-4 h-4"
|
|
140
|
-
})
|
|
141
|
+
}), null), l(b, s(ne, {
|
|
142
|
+
get item() {
|
|
143
|
+
return e.item;
|
|
144
|
+
},
|
|
145
|
+
size: "xs"
|
|
146
|
+
}), null), l(C, () => e.item.name), l(d, s(w, {
|
|
141
147
|
get when() {
|
|
142
|
-
return
|
|
148
|
+
return D();
|
|
143
149
|
},
|
|
144
150
|
get children() {
|
|
145
|
-
var n =
|
|
146
|
-
return l(n,
|
|
151
|
+
var n = ce();
|
|
152
|
+
return l(n, E), n;
|
|
147
153
|
}
|
|
148
154
|
}), null), l(t, s(w, {
|
|
149
155
|
get when() {
|
|
150
|
-
return
|
|
156
|
+
return q(() => !!i())() && D();
|
|
151
157
|
},
|
|
152
158
|
get children() {
|
|
153
|
-
var n =
|
|
154
|
-
return l(n, s(
|
|
159
|
+
var n = M();
|
|
160
|
+
return l(n, s(p, {
|
|
155
161
|
get items() {
|
|
156
162
|
return e.item.children ?? [];
|
|
157
163
|
},
|
|
@@ -167,26 +173,27 @@ function ge(e) {
|
|
|
167
173
|
get dragContext() {
|
|
168
174
|
return e.dragContext;
|
|
169
175
|
}
|
|
170
|
-
})),
|
|
176
|
+
})), y(() => h(n, u("overflow-hidden transition-all duration-200", i() ? "opacity-100" : "opacity-0"))), n;
|
|
171
177
|
}
|
|
172
|
-
}), null),
|
|
173
|
-
var c =
|
|
178
|
+
}), null), y((n) => {
|
|
179
|
+
var c = u(
|
|
174
180
|
"group flex items-center w-full py-1 text-xs",
|
|
175
181
|
"transition-all duration-150 ease-out",
|
|
176
182
|
"hover:bg-sidebar-accent/60",
|
|
177
|
-
|
|
183
|
+
P() && "bg-sidebar-accent text-sidebar-accent-foreground font-medium",
|
|
178
184
|
// Drop target styling - enhanced visual feedback
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
),
|
|
182
|
-
return c !== n.e &&
|
|
185
|
+
k() && S() && ["bg-primary/15 outline outline-2 outline-primary/60", "shadow-sm shadow-primary/10"],
|
|
186
|
+
k() && !S() && ["bg-destructive/10 outline outline-2 outline-dashed outline-destructive/50"]
|
|
187
|
+
), m = `${8 + e.depth * 12}px`, f = u("truncate", re(e.item));
|
|
188
|
+
return c !== n.e && h(a, n.e = c), m !== n.t && J(a, "padding-left", n.t = m), f !== n.a && h(C, n.a = f), n;
|
|
183
189
|
}, {
|
|
184
190
|
e: void 0,
|
|
185
|
-
t: void 0
|
|
191
|
+
t: void 0,
|
|
192
|
+
a: void 0
|
|
186
193
|
}), t;
|
|
187
194
|
})();
|
|
188
195
|
}
|
|
189
196
|
K(["contextmenu", "click"]);
|
|
190
197
|
export {
|
|
191
|
-
|
|
198
|
+
we as DirectoryTree
|
|
192
199
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { addEventListener as te, use as
|
|
2
|
-
import { createSignal as ie, createMemo as W, createEffect as ne, onCleanup as oe, Show as
|
|
1
|
+
import { addEventListener as te, use as Q, insert as y, createComponent as b, effect as N, setStyleProperty as Y, className as q, style as ue, template as S, spread as ge, mergeProps as me, memo as fe, delegateEvents as he } from "solid-js/web";
|
|
2
|
+
import { createSignal as ie, createMemo as W, createEffect as ne, onCleanup as oe, Show as B, For as ae, untrack as ve } from "solid-js";
|
|
3
3
|
import { cn as H } from "../../utils/cn.js";
|
|
4
4
|
import { useResizeObserver as xe } from "../../hooks/useResizeObserver.js";
|
|
5
5
|
import { useVirtualWindow as Ie } from "../../hooks/useVirtualWindow.js";
|
|
6
6
|
import { useFileBrowser as le } from "./FileBrowserContext.js";
|
|
7
7
|
import { useFileBrowserDrag as we } from "../../context/FileBrowserDragContext.js";
|
|
8
|
-
import { FileItemIcon as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { FileItemIcon as Ce } from "./FileIcons.js";
|
|
9
|
+
import { FileItemDecorationBadge as be, fileItemDecorationNameClass as De } from "./FileItemDecorations.js";
|
|
10
|
+
import { createLongPressContextMenuHandlers as ye } from "./longPressContextMenu.js";
|
|
11
|
+
import { fileBrowserTouchTargetAttrs as Se } from "./touchInteractionGuard.js";
|
|
12
|
+
import { createItemContextMenuEvent as Me } from "./contextMenuEvent.js";
|
|
13
|
+
import { createFileBrowserMarqueeSelection as Te, FILE_BROWSER_MARQUEE_OVERLAY_CLASS as Pe } from "./useFileBrowserMarqueeSelection.js";
|
|
13
14
|
import { isPrimaryModKeyPressed as re } from "../../utils/keybind.js";
|
|
14
|
-
var
|
|
15
|
-
function
|
|
15
|
+
var _e = /* @__PURE__ */ S('<mark class="bg-warning/40 text-inherit rounded-sm">'), Fe = /* @__PURE__ */ S('<div class="grid gap-2">'), Ee = /* @__PURE__ */ S('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), Le = /* @__PURE__ */ S('<span>No files matching "<!>"'), Re = /* @__PURE__ */ S('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), $e = /* @__PURE__ */ S('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), ke = /* @__PURE__ */ S("<span>This folder is empty"), Ae = /* @__PURE__ */ S("<div>"), He = /* @__PURE__ */ S('<div class="absolute top-1.5 right-1.5 w-4 h-4 rounded-full bg-primary flex items-center justify-center"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=3 stroke-linecap=round stroke-linejoin=round class="w-2.5 h-2.5 text-primary-foreground"><polyline points="20 6 9 17 4 12">'), qe = /* @__PURE__ */ S("<button type=button><div></div><span></span><div>");
|
|
16
|
+
function Be(e) {
|
|
16
17
|
const r = W(() => {
|
|
17
18
|
if (!e.match || e.match.matchedIndices.length === 0)
|
|
18
19
|
return [{
|
|
@@ -20,24 +21,24 @@ function He(e) {
|
|
|
20
21
|
highlight: !1
|
|
21
22
|
}];
|
|
22
23
|
const s = [], M = new Set(e.match.matchedIndices);
|
|
23
|
-
let
|
|
24
|
+
let D = "", m = !1;
|
|
24
25
|
for (let d = 0; d < e.name.length; d++) {
|
|
25
26
|
const v = M.has(d);
|
|
26
|
-
d === 0 ? (m = v,
|
|
27
|
-
text:
|
|
27
|
+
d === 0 ? (m = v, D = e.name[d]) : v === m ? D += e.name[d] : (s.push({
|
|
28
|
+
text: D,
|
|
28
29
|
highlight: m
|
|
29
|
-
}),
|
|
30
|
+
}), D = e.name[d], m = v);
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
-
text:
|
|
32
|
+
return D && s.push({
|
|
33
|
+
text: D,
|
|
33
34
|
highlight: m
|
|
34
35
|
}), s;
|
|
35
36
|
});
|
|
36
|
-
return
|
|
37
|
+
return b(ae, {
|
|
37
38
|
get each() {
|
|
38
39
|
return r();
|
|
39
40
|
},
|
|
40
|
-
children: (s) =>
|
|
41
|
+
children: (s) => b(B, {
|
|
41
42
|
get when() {
|
|
42
43
|
return s.highlight;
|
|
43
44
|
},
|
|
@@ -45,23 +46,23 @@ function He(e) {
|
|
|
45
46
|
return fe(() => s.text);
|
|
46
47
|
},
|
|
47
48
|
get children() {
|
|
48
|
-
var M =
|
|
49
|
-
return
|
|
49
|
+
var M = _e();
|
|
50
|
+
return y(M, () => s.text), M;
|
|
50
51
|
}
|
|
51
52
|
})
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
const r = le(), s = we(), M = () => (e.enableDragDrop ?? !0) && !!s,
|
|
55
|
+
function et(e) {
|
|
56
|
+
const r = le(), s = we(), M = () => (e.enableDragDrop ?? !0) && !!s, D = () => e.instanceId ?? "default", m = 112, d = 8, v = 180, T = 2, R = 6, [f, V] = ie(null), U = xe(f), x = W(() => {
|
|
56
57
|
const n = U()?.width ?? 0;
|
|
57
58
|
if (n <= 0) return T;
|
|
58
59
|
const l = Math.floor((n + d) / (v + d));
|
|
59
60
|
return Math.max(T, Math.min(R, l));
|
|
60
|
-
}),
|
|
61
|
+
}), E = () => m + d, c = Ie({
|
|
61
62
|
count: () => Math.ceil(r.currentFiles().length / Math.max(1, x())),
|
|
62
|
-
itemSize:
|
|
63
|
+
itemSize: E,
|
|
63
64
|
overscan: 2
|
|
64
|
-
}),
|
|
65
|
+
}), z = () => c.range().start * x(), $ = () => Math.min(r.currentFiles().length, c.range().end * x()), k = W(() => r.currentFiles().slice(z(), $())), P = /* @__PURE__ */ new Map(), O = (n, l) => {
|
|
65
66
|
if (l) {
|
|
66
67
|
P.set(n, l);
|
|
67
68
|
return;
|
|
@@ -76,14 +77,14 @@ function Ke(e) {
|
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
if (n === L) return;
|
|
79
|
-
const l =
|
|
80
|
+
const l = E(), o = Math.floor(g.scrollTop / Math.max(1, l)) * Math.max(1, L), i = Math.floor(o / Math.max(1, n));
|
|
80
81
|
g.scrollTop = i * l, c.onScroll(), L = n;
|
|
81
82
|
});
|
|
82
|
-
const
|
|
83
|
+
const p = (n) => {
|
|
83
84
|
if (!g) return;
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
g.scrollTop =
|
|
85
|
+
const C = Math.floor(n / Math.max(1, x())) * E(), o = C + E(), i = g.scrollTop, w = i + g.clientHeight;
|
|
86
|
+
if (C < i) {
|
|
87
|
+
g.scrollTop = C, c.onScroll();
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
90
|
o > w && (g.scrollTop = Math.max(0, o - g.clientHeight), c.onScroll());
|
|
@@ -91,10 +92,10 @@ function Ke(e) {
|
|
|
91
92
|
ne(() => {
|
|
92
93
|
const n = r.revealRequest(), l = r.currentFiles();
|
|
93
94
|
if (x(), k(), !n) return;
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
95
|
+
const C = l.findIndex((w) => w.id === n.targetId);
|
|
96
|
+
if (C < 0) return;
|
|
96
97
|
if (!P.get(n.targetId)) {
|
|
97
|
-
|
|
98
|
+
p(C);
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
typeof cancelAnimationFrame == "function" && I && (cancelAnimationFrame(I), I = 0);
|
|
@@ -114,7 +115,7 @@ function Ke(e) {
|
|
|
114
115
|
}), oe(() => {
|
|
115
116
|
typeof cancelAnimationFrame == "function" && I && cancelAnimationFrame(I);
|
|
116
117
|
});
|
|
117
|
-
const A =
|
|
118
|
+
const A = Te({
|
|
118
119
|
getContainer: () => g,
|
|
119
120
|
getOverlayHost: () => g,
|
|
120
121
|
getVisibleItemIdsInOrder: () => r.currentFiles().map((n) => n.id),
|
|
@@ -124,29 +125,29 @@ function Ke(e) {
|
|
|
124
125
|
clearSelection: r.clearSelection
|
|
125
126
|
});
|
|
126
127
|
return (() => {
|
|
127
|
-
var n =
|
|
128
|
-
return te(n, "pointerdown", A.onPointerDown, !0), te(n, "scroll", c.onScroll),
|
|
128
|
+
var n = Ee(), l = n.firstChild, C = l.firstChild;
|
|
129
|
+
return te(n, "pointerdown", A.onPointerDown, !0), te(n, "scroll", c.onScroll), Q((o) => {
|
|
129
130
|
g = o, c.scrollRef(o), r.setScrollContainer(o);
|
|
130
|
-
}, n),
|
|
131
|
+
}, n), Q((o) => V(o), C), y(l, b(B, {
|
|
131
132
|
get when() {
|
|
132
133
|
return r.currentFiles().length > 0;
|
|
133
134
|
},
|
|
134
135
|
get fallback() {
|
|
135
136
|
return (() => {
|
|
136
|
-
var o =
|
|
137
|
-
return
|
|
137
|
+
var o = $e();
|
|
138
|
+
return y(o, b(B, {
|
|
138
139
|
get when() {
|
|
139
140
|
return r.filterQueryApplied().trim();
|
|
140
141
|
},
|
|
141
142
|
get fallback() {
|
|
142
|
-
return
|
|
143
|
+
return ke();
|
|
143
144
|
},
|
|
144
145
|
get children() {
|
|
145
146
|
return [(() => {
|
|
146
|
-
var i =
|
|
147
|
-
return _.nextSibling,
|
|
147
|
+
var i = Le(), w = i.firstChild, _ = w.nextSibling;
|
|
148
|
+
return _.nextSibling, y(i, () => r.filterQueryApplied(), _), i;
|
|
148
149
|
})(), (() => {
|
|
149
|
-
var i =
|
|
150
|
+
var i = Re();
|
|
150
151
|
return i.$$click = () => r.setFilterQuery(""), i;
|
|
151
152
|
})()];
|
|
152
153
|
}
|
|
@@ -154,15 +155,15 @@ function Ke(e) {
|
|
|
154
155
|
})();
|
|
155
156
|
},
|
|
156
157
|
get children() {
|
|
157
|
-
var o =
|
|
158
|
-
return
|
|
158
|
+
var o = Fe();
|
|
159
|
+
return y(o, b(ae, {
|
|
159
160
|
get each() {
|
|
160
161
|
return k();
|
|
161
162
|
},
|
|
162
|
-
children: (i) =>
|
|
163
|
+
children: (i) => b(Oe, {
|
|
163
164
|
item: i,
|
|
164
165
|
get instanceId() {
|
|
165
|
-
return
|
|
166
|
+
return D();
|
|
166
167
|
},
|
|
167
168
|
get enableDragDrop() {
|
|
168
169
|
return M();
|
|
@@ -179,25 +180,25 @@ function Ke(e) {
|
|
|
179
180
|
a: void 0
|
|
180
181
|
}), o;
|
|
181
182
|
}
|
|
182
|
-
}), null),
|
|
183
|
+
}), null), y(l, b(B, {
|
|
183
184
|
get when() {
|
|
184
185
|
return A.overlayStyle();
|
|
185
186
|
},
|
|
186
187
|
children: (o) => (() => {
|
|
187
|
-
var i =
|
|
188
|
-
return
|
|
188
|
+
var i = Ae();
|
|
189
|
+
return q(i, Pe), N((w) => ue(i, o(), w)), i;
|
|
189
190
|
})()
|
|
190
|
-
}), null), N(() =>
|
|
191
|
+
}), null), N(() => q(n, H("relative h-full min-h-0 overflow-auto", e.class))), n;
|
|
191
192
|
})();
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
-
const r = le(), s = () => r.isSelected(e.item.id), M = () => r.getFilterMatchForId(e.item.id),
|
|
194
|
+
function Oe(e) {
|
|
195
|
+
const r = le(), s = () => r.isSelected(e.item.id), M = () => r.getFilterMatchForId(e.item.id), D = ve(() => e.item), m = ye(r, D, {
|
|
195
196
|
source: "grid"
|
|
196
197
|
});
|
|
197
198
|
let d, v = null, T = 0, R = 0, f = !1;
|
|
198
199
|
const V = 5, U = 500;
|
|
199
200
|
let x = null;
|
|
200
|
-
const [
|
|
201
|
+
const [E, j] = ie(!1), c = () => d === "touch" || d === "pen", z = () => e.item.type === "folder", $ = () => z() && e.enableDragDrop && e.dragContext, k = () => {
|
|
201
202
|
if (!$() || !e.dragContext) return !1;
|
|
202
203
|
const t = e.dragContext.dragState();
|
|
203
204
|
return t.isDragging ? e.dragContext.canDropOn(t.draggedItems, e.item.path, e.item, e.instanceId) : !1;
|
|
@@ -217,7 +218,7 @@ function pe(e) {
|
|
|
217
218
|
oe(() => {
|
|
218
219
|
e.registerTile(e.item.id, null), I(!1);
|
|
219
220
|
});
|
|
220
|
-
const
|
|
221
|
+
const p = (t, a) => {
|
|
221
222
|
if (!e.enableDragDrop || !e.dragContext || f) return;
|
|
222
223
|
f = !0, s() || r.selectItem(e.item.id, !1);
|
|
223
224
|
const h = r.getSelectedItemsList(), u = (h.length > 0 && s() ? h : [e.item]).map((G) => ({
|
|
@@ -233,19 +234,19 @@ function pe(e) {
|
|
|
233
234
|
e.dragContext.startDrag(u, t, a);
|
|
234
235
|
}, A = (t) => {
|
|
235
236
|
if (v !== t.pointerId) return;
|
|
236
|
-
const a = t.clientX - T, h = t.clientY - R,
|
|
237
|
-
if (c() && !f &&
|
|
237
|
+
const a = t.clientX - T, h = t.clientY - R, F = Math.sqrt(a * a + h * h);
|
|
238
|
+
if (c() && !f && F > 10) {
|
|
238
239
|
I(!1);
|
|
239
240
|
return;
|
|
240
241
|
}
|
|
241
|
-
!c() && !f &&
|
|
242
|
+
!c() && !f && F > V && p(t.clientX, t.clientY), f && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
|
|
242
243
|
}, n = (t) => {
|
|
243
244
|
v === t.pointerId && (m.onPointerUp(), I(!0));
|
|
244
245
|
}, l = (t) => {
|
|
245
246
|
v === t.pointerId && (m.onPointerCancel(), I(!1));
|
|
246
|
-
},
|
|
247
|
+
}, C = (t) => {
|
|
247
248
|
d = t.pointerType, m.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || (v = t.pointerId, T = t.clientX, R = t.clientY, f = !1, L(), c() && (O(), x = setTimeout(() => {
|
|
248
|
-
v !== null && !f &&
|
|
249
|
+
v !== null && !f && p(T, R);
|
|
249
250
|
}, U))));
|
|
250
251
|
}, o = (t) => {
|
|
251
252
|
d = t.pointerType, m.onPointerMove(t);
|
|
@@ -287,17 +288,17 @@ function pe(e) {
|
|
|
287
288
|
if (t.preventDefault(), t.stopPropagation(), c()) return;
|
|
288
289
|
r.ensureContextMenuSelection(e.item.id);
|
|
289
290
|
const a = r.getSelectedItemsList(), h = a.length > 0 ? a : [e.item];
|
|
290
|
-
r.showContextMenu(
|
|
291
|
+
r.showContextMenu(Me({
|
|
291
292
|
x: t.clientX,
|
|
292
293
|
y: t.clientY,
|
|
293
294
|
triggerItem: e.item,
|
|
294
295
|
items: h,
|
|
295
296
|
source: "grid"
|
|
296
297
|
}));
|
|
297
|
-
}, se = () => e.dragContext?.dragState(), de = () => se()?.isDragging ?? !1, K = () =>
|
|
298
|
+
}, se = () => e.dragContext?.dragState(), de = () => se()?.isDragging ?? !1, K = () => E() && de() && $();
|
|
298
299
|
return (() => {
|
|
299
|
-
var t =
|
|
300
|
-
return
|
|
300
|
+
var t = qe(), a = t.firstChild, h = a.nextSibling, F = h.nextSibling;
|
|
301
|
+
return Q((u) => {
|
|
301
302
|
e.registerTile(e.item.id, u);
|
|
302
303
|
}, t), ge(t, me({
|
|
303
304
|
get "data-file-browser-item-id"() {
|
|
@@ -306,14 +307,14 @@ function pe(e) {
|
|
|
306
307
|
get "data-file-browser-item-path"() {
|
|
307
308
|
return e.item.path;
|
|
308
309
|
}
|
|
309
|
-
},
|
|
310
|
+
}, Se, {
|
|
310
311
|
get title() {
|
|
311
312
|
return e.item.name;
|
|
312
313
|
},
|
|
313
314
|
onClick: _,
|
|
314
315
|
onDblClick: X,
|
|
315
316
|
onContextMenu: ce,
|
|
316
|
-
onPointerDown:
|
|
317
|
+
onPointerDown: C,
|
|
317
318
|
onPointerMove: o,
|
|
318
319
|
onPointerEnter: i,
|
|
319
320
|
onPointerLeave: w,
|
|
@@ -332,19 +333,24 @@ function pe(e) {
|
|
|
332
333
|
K() && !k() && ["bg-destructive/10 ring-2 ring-dashed ring-destructive/50"]
|
|
333
334
|
);
|
|
334
335
|
}
|
|
335
|
-
}), !1, !0),
|
|
336
|
+
}), !1, !0), y(t, b(B, {
|
|
336
337
|
get when() {
|
|
337
338
|
return s();
|
|
338
339
|
},
|
|
339
340
|
get children() {
|
|
340
|
-
return
|
|
341
|
+
return He();
|
|
341
342
|
}
|
|
342
|
-
}), a),
|
|
343
|
+
}), a), y(a, b(Ce, {
|
|
343
344
|
get item() {
|
|
344
345
|
return e.item;
|
|
345
346
|
},
|
|
346
347
|
class: "w-8 h-8"
|
|
347
|
-
})),
|
|
348
|
+
}), null), y(a, b(be, {
|
|
349
|
+
get item() {
|
|
350
|
+
return e.item;
|
|
351
|
+
},
|
|
352
|
+
size: "md"
|
|
353
|
+
}), null), y(h, b(Be, {
|
|
348
354
|
get name() {
|
|
349
355
|
return e.item.name;
|
|
350
356
|
},
|
|
@@ -352,8 +358,8 @@ function pe(e) {
|
|
|
352
358
|
return M();
|
|
353
359
|
}
|
|
354
360
|
})), N((u) => {
|
|
355
|
-
var G = H("w-12 h-12 flex items-center justify-center rounded-lg", "transition-transform duration-200", "group-hover:scale-110", e.item.type === "folder" ? "bg-warning/10" : "bg-muted/50"), J = H("block w-full min-w-0 truncate px-1 text-xs text-center", "transition-colors duration-150", s() && "font-medium"), Z = H("absolute inset-0 rounded-lg opacity-0 transition-opacity duration-300", "group-hover:opacity-100", "pointer-events-none"), ee = e.item.type === "folder" ? "radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--warning) 8%, transparent), transparent 70%)" : "radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--primary) 5%, transparent), transparent 70%)";
|
|
356
|
-
return G !== u.e &&
|
|
361
|
+
var G = H("w-12 h-12 flex items-center justify-center rounded-lg", "relative", "transition-transform duration-200", "group-hover:scale-110", e.item.type === "folder" ? "bg-warning/10" : "bg-muted/50"), J = H("block w-full min-w-0 truncate px-1 text-xs text-center", "transition-colors duration-150", De(e.item), s() && "font-medium"), Z = H("absolute inset-0 rounded-lg opacity-0 transition-opacity duration-300", "group-hover:opacity-100", "pointer-events-none"), ee = e.item.type === "folder" ? "radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--warning) 8%, transparent), transparent 70%)" : "radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--primary) 5%, transparent), transparent 70%)";
|
|
362
|
+
return G !== u.e && q(a, u.e = G), J !== u.t && q(h, u.t = J), Z !== u.a && q(F, u.a = Z), ee !== u.o && Y(F, "background", u.o = ee), u;
|
|
357
363
|
}, {
|
|
358
364
|
e: void 0,
|
|
359
365
|
t: void 0,
|
|
@@ -364,5 +370,5 @@ function pe(e) {
|
|
|
364
370
|
}
|
|
365
371
|
he(["pointerdown", "click"]);
|
|
366
372
|
export {
|
|
367
|
-
|
|
373
|
+
et as FileGridView
|
|
368
374
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FileItem } from './types';
|
|
2
|
+
type FileItemDecorationBadgeSize = 'xs' | 'sm' | 'md';
|
|
3
|
+
export declare function fileItemDecorationNameClass(item: FileItem): string;
|
|
4
|
+
export declare function FileItemDecorationBadge(props: {
|
|
5
|
+
item: FileItem;
|
|
6
|
+
size?: FileItemDecorationBadgeSize;
|
|
7
|
+
class?: string;
|
|
8
|
+
}): import("solid-js").JSX.Element;
|
|
9
|
+
export {};
|