@floegence/floe-webapp-core 0.35.19 → 0.35.21
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/DragPreview.js +42 -44
- package/dist/components/file-browser/FileGridView.js +99 -97
- package/dist/components/file-browser/FileIcons.d.ts +15 -4
- package/dist/components/file-browser/FileIcons.js +386 -50
- package/dist/components/file-browser/FileListView.js +151 -151
- package/dist/components/file-browser/index.d.ts +2 -2
- package/dist/components/file-browser/types.d.ts +5 -2
- package/dist/components/ui/FileSavePicker.js +56 -58
- package/dist/file-browser.js +25 -21
- package/dist/full.js +396 -392
- package/package.json +1 -1
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import { use as
|
|
2
|
-
import { createMemo as
|
|
1
|
+
import { use as tt, insert as u, createComponent as m, effect as F, className as V, setStyleProperty as B, addEventListener as ct, template as _, spread as mt, mergeProps as ut, memo as rt, delegateEvents as ft } from "solid-js/web";
|
|
2
|
+
import { createMemo as Z, createSignal as ot, Show as W, For as at, untrack as gt, onCleanup as ht } from "solid-js";
|
|
3
3
|
import { cn as H } from "../../utils/cn.js";
|
|
4
|
-
import { useMediaQuery as
|
|
5
|
-
import { useResizeObserver as
|
|
6
|
-
import { useVirtualWindow as
|
|
7
|
-
import { useFileBrowser as
|
|
8
|
-
import { useFileBrowserDrag as
|
|
9
|
-
import {
|
|
10
|
-
import { ChevronDown as
|
|
11
|
-
import { createLongPressContextMenuHandlers as
|
|
12
|
-
import { ResizeHandle as
|
|
13
|
-
import { fileBrowserTouchTargetAttrs as
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
const a =
|
|
4
|
+
import { useMediaQuery as et } from "../../hooks/useMediaQuery.js";
|
|
5
|
+
import { useResizeObserver as xt } from "../../hooks/useResizeObserver.js";
|
|
6
|
+
import { useVirtualWindow as vt } from "../../hooks/useVirtualWindow.js";
|
|
7
|
+
import { useFileBrowser as st } from "./FileBrowserContext.js";
|
|
8
|
+
import { useFileBrowserDrag as wt } from "../../context/FileBrowserDragContext.js";
|
|
9
|
+
import { FileItemIcon as Ct } from "./FileIcons.js";
|
|
10
|
+
import { ChevronDown as bt } from "../icons/index.js";
|
|
11
|
+
import { createLongPressContextMenuHandlers as Dt } from "./longPressContextMenu.js";
|
|
12
|
+
import { ResizeHandle as nt } from "../layout/ResizeHandle.js";
|
|
13
|
+
import { fileBrowserTouchTargetAttrs as St } from "./touchInteractionGuard.js";
|
|
14
|
+
var $t = /* @__PURE__ */ _("<span class=truncate>"), Mt = /* @__PURE__ */ _('<mark class="bg-warning/40 text-inherit rounded-sm">'), zt = /* @__PURE__ */ _("<span>"), _t = /* @__PURE__ */ _('<div><button type=button class="group w-full flex items-center justify-start text-left px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors">Modified'), yt = /* @__PURE__ */ _('<div class=shrink-0><button type=button class="group w-full flex items-center justify-start text-left px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors">Size'), It = /* @__PURE__ */ _("<div>"), Pt = /* @__PURE__ */ _('<div><div class="flex items-center border-b border-border text-[11px] text-muted-foreground font-medium"><div><button type=button class="group w-full flex items-center min-w-0 px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors"><span class="flex items-center gap-2 min-w-0"><span class="flex-shrink-0 w-4 h-4"aria-hidden=true></span><span class="flex items-center min-w-0"><span class=truncate>Name</span></span></span></button></div></div><div class="flex-1 min-h-0 overflow-auto">'), kt = /* @__PURE__ */ _('<span>No files matching "<!>"'), Tt = /* @__PURE__ */ _('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), Lt = /* @__PURE__ */ _('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), pt = /* @__PURE__ */ _("<span>This folder is empty"), it = /* @__PURE__ */ _('<div class="shrink-0 px-3 py-1.5 text-left text-muted-foreground truncate">'), Rt = /* @__PURE__ */ _('<button type=button><div class="flex items-center gap-2 flex-1 min-w-0 px-3 py-1.5"><span class="flex-shrink-0 w-4 h-4">');
|
|
15
|
+
function Wt(t) {
|
|
16
|
+
const a = Z(() => {
|
|
17
17
|
if (!t.match || t.match.matchedIndices.length === 0)
|
|
18
18
|
return [{
|
|
19
19
|
text: t.name,
|
|
20
20
|
highlight: !1
|
|
21
21
|
}];
|
|
22
|
-
const C = [],
|
|
23
|
-
let
|
|
22
|
+
const C = [], L = new Set(t.match.matchedIndices);
|
|
23
|
+
let D = "", S = !1;
|
|
24
24
|
for (let f = 0; f < t.name.length; f++) {
|
|
25
|
-
const y =
|
|
26
|
-
f === 0 ? (
|
|
27
|
-
text:
|
|
28
|
-
highlight:
|
|
29
|
-
}),
|
|
25
|
+
const y = L.has(f);
|
|
26
|
+
f === 0 ? (S = y, D = t.name[f]) : y === S ? D += t.name[f] : (C.push({
|
|
27
|
+
text: D,
|
|
28
|
+
highlight: S
|
|
29
|
+
}), D = t.name[f], S = y);
|
|
30
30
|
}
|
|
31
|
-
return
|
|
32
|
-
text:
|
|
33
|
-
highlight:
|
|
31
|
+
return D && C.push({
|
|
32
|
+
text: D,
|
|
33
|
+
highlight: S
|
|
34
34
|
}), C;
|
|
35
35
|
});
|
|
36
36
|
return (() => {
|
|
37
|
-
var C =
|
|
38
|
-
return u(C, m(
|
|
37
|
+
var C = $t();
|
|
38
|
+
return u(C, m(at, {
|
|
39
39
|
get each() {
|
|
40
40
|
return a();
|
|
41
41
|
},
|
|
42
|
-
children: (
|
|
42
|
+
children: (L) => m(W, {
|
|
43
43
|
get when() {
|
|
44
|
-
return
|
|
44
|
+
return L.highlight;
|
|
45
45
|
},
|
|
46
46
|
get fallback() {
|
|
47
|
-
return
|
|
47
|
+
return rt(() => L.text);
|
|
48
48
|
},
|
|
49
49
|
get children() {
|
|
50
|
-
var
|
|
51
|
-
return u(
|
|
50
|
+
var D = Mt();
|
|
51
|
+
return u(D, () => L.text), D;
|
|
52
52
|
}
|
|
53
53
|
})
|
|
54
54
|
})), C;
|
|
55
55
|
})();
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const a =
|
|
57
|
+
function Kt(t) {
|
|
58
|
+
const a = st(), C = wt(), L = () => (t.enableDragDrop ?? !0) && !!C, D = () => t.instanceId ?? "default", S = 32, f = vt({
|
|
59
59
|
count: () => a.currentFiles().length,
|
|
60
|
-
itemSize: () =>
|
|
60
|
+
itemSize: () => S,
|
|
61
61
|
overscan: 12
|
|
62
|
-
}), y =
|
|
62
|
+
}), y = Z(() => {
|
|
63
63
|
const {
|
|
64
64
|
start: r,
|
|
65
65
|
end: n
|
|
66
66
|
} = f.range();
|
|
67
67
|
return a.currentFiles().slice(r, n);
|
|
68
|
-
}),
|
|
68
|
+
}), E = (r) => {
|
|
69
69
|
const n = a.sortConfig();
|
|
70
70
|
a.setSortConfig({
|
|
71
71
|
field: r,
|
|
72
72
|
direction: n.field === r && n.direction === "asc" ? "desc" : "asc"
|
|
73
73
|
});
|
|
74
|
-
}, O = (r) => r === void 0 ? "-" : r < 1024 ? `${r} B` : r < 1024 * 1024 ? `${(r / 1024).toFixed(1)} KB` : `${(r / (1024 * 1024)).toFixed(1)} MB`,
|
|
74
|
+
}, O = (r) => r === void 0 ? "-" : r < 1024 ? `${r} B` : r < 1024 * 1024 ? `${(r / 1024).toFixed(1)} KB` : `${(r / (1024 * 1024)).toFixed(1)} MB`, $ = (r) => r ? r.toLocaleDateString("en-US", {
|
|
75
75
|
month: "short",
|
|
76
76
|
day: "numeric",
|
|
77
77
|
year: "numeric"
|
|
78
78
|
}) : "-", X = (r) => {
|
|
79
79
|
const n = () => a.sortConfig(), l = () => n().field === r.field;
|
|
80
80
|
return (() => {
|
|
81
|
-
var d =
|
|
82
|
-
return u(d, m(
|
|
81
|
+
var d = zt();
|
|
82
|
+
return u(d, m(bt, {
|
|
83
83
|
get class() {
|
|
84
84
|
return H("w-3 h-3 transition-transform duration-150", l() && n().direction === "asc" && "rotate-180");
|
|
85
85
|
}
|
|
86
|
-
})),
|
|
86
|
+
})), F(() => V(d, H("ml-1 transition-all duration-150", l() ? "opacity-100" : "opacity-0 group-hover:opacity-40"))), d;
|
|
87
87
|
})();
|
|
88
|
-
},
|
|
89
|
-
const r =
|
|
88
|
+
}, j = et("(min-width: 640px)"), A = et("(min-width: 768px)"), [K, Y] = ot(null), p = xt(K), N = (r, n, l) => Math.max(n, Math.min(l, r)), h = Z(() => {
|
|
89
|
+
const r = p()?.width ?? 0, n = j(), l = A(), d = a.listColumnRatios(), x = 160, g = 120, w = 80, M = 128, o = 96;
|
|
90
90
|
if (!n || r <= 0)
|
|
91
91
|
return {
|
|
92
92
|
width: r,
|
|
@@ -94,8 +94,8 @@ function Jt(t) {
|
|
|
94
94
|
showSize: l,
|
|
95
95
|
minName: x,
|
|
96
96
|
minModified: g,
|
|
97
|
-
minSize:
|
|
98
|
-
modifiedWidth:
|
|
97
|
+
minSize: w,
|
|
98
|
+
modifiedWidth: M,
|
|
99
99
|
sizeWidth: o
|
|
100
100
|
};
|
|
101
101
|
if (!l) {
|
|
@@ -107,44 +107,44 @@ function Jt(t) {
|
|
|
107
107
|
showSize: l,
|
|
108
108
|
minName: x,
|
|
109
109
|
minModified: g,
|
|
110
|
-
minSize:
|
|
110
|
+
minSize: w,
|
|
111
111
|
modifiedWidth: P,
|
|
112
112
|
sizeWidth: 0
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
let i = Math.max(g, d.modifiedAt * r), s = Math.max(
|
|
115
|
+
let i = Math.max(g, d.modifiedAt * r), s = Math.max(w, d.size * r);
|
|
116
116
|
const b = Math.max(0, r - x);
|
|
117
117
|
if (i + s > b) {
|
|
118
|
-
const I = i + s - b, k = Math.max(0, i - g), P = Math.max(0, s -
|
|
119
|
-
|
|
118
|
+
const I = i + s - b, k = Math.max(0, i - g), P = Math.max(0, s - w), T = k + P;
|
|
119
|
+
T > 0 && (i -= I * (k / T), s -= I * (P / T));
|
|
120
120
|
}
|
|
121
|
-
return i = Math.max(g, i), s = Math.max(
|
|
121
|
+
return i = Math.max(g, i), s = Math.max(w, s), {
|
|
122
122
|
width: r,
|
|
123
123
|
showModified: n,
|
|
124
124
|
showSize: l,
|
|
125
125
|
minName: x,
|
|
126
126
|
minModified: g,
|
|
127
|
-
minSize:
|
|
127
|
+
minSize: w,
|
|
128
128
|
modifiedWidth: i,
|
|
129
129
|
sizeWidth: s
|
|
130
130
|
};
|
|
131
|
-
}), G = () => h().modifiedWidth,
|
|
131
|
+
}), G = () => h().modifiedWidth, U = () => h().sizeWidth, Q = (r) => {
|
|
132
132
|
const n = h();
|
|
133
133
|
if (!n.showModified || n.width <= 0) return;
|
|
134
134
|
if (!n.showSize) {
|
|
135
135
|
const I = a.listColumnRatios().size, k = Math.max(0, 1 - I);
|
|
136
136
|
if (k <= 0) return;
|
|
137
|
-
const P = n.width,
|
|
138
|
-
if (
|
|
139
|
-
const
|
|
137
|
+
const P = n.width, T = n.modifiedWidth, e = Math.max(0, P - T), c = n.minName - e, z = T - n.minModified, v = N(r, c, z);
|
|
138
|
+
if (v === 0) return;
|
|
139
|
+
const R = e + v, J = T - v, lt = R / P * k, dt = J / P * k;
|
|
140
140
|
a.setListColumnRatios({
|
|
141
|
-
name:
|
|
141
|
+
name: lt,
|
|
142
142
|
modifiedAt: dt,
|
|
143
143
|
size: I
|
|
144
144
|
});
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
const l = n.width, d = n.modifiedWidth, x = n.sizeWidth, g = Math.max(0, l - d - x),
|
|
147
|
+
const l = n.width, d = n.modifiedWidth, x = n.sizeWidth, g = Math.max(0, l - d - x), w = n.minName - g, M = d - n.minModified, o = N(r, w, M);
|
|
148
148
|
if (o === 0) return;
|
|
149
149
|
const i = g + o, s = d - o;
|
|
150
150
|
a.setListColumnRatios({
|
|
@@ -152,12 +152,12 @@ function Jt(t) {
|
|
|
152
152
|
modifiedAt: s / l,
|
|
153
153
|
size: x / l
|
|
154
154
|
});
|
|
155
|
-
},
|
|
155
|
+
}, q = (r) => {
|
|
156
156
|
const n = h();
|
|
157
157
|
if (!n.showSize || n.width <= 0) return;
|
|
158
|
-
const l = n.width, d = n.modifiedWidth, x = n.sizeWidth, g = n.minModified - d,
|
|
159
|
-
if (
|
|
160
|
-
const o = d +
|
|
158
|
+
const l = n.width, d = n.modifiedWidth, x = n.sizeWidth, g = n.minModified - d, w = x - n.minSize, M = N(r, g, w);
|
|
159
|
+
if (M === 0) return;
|
|
160
|
+
const o = d + M, i = x - M, s = Math.max(0, l - o - i);
|
|
161
161
|
a.setListColumnRatios({
|
|
162
162
|
name: s / l,
|
|
163
163
|
modifiedAt: o / l,
|
|
@@ -165,19 +165,19 @@ function Jt(t) {
|
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
167
|
return (() => {
|
|
168
|
-
var r =
|
|
169
|
-
|
|
170
|
-
var
|
|
171
|
-
return
|
|
168
|
+
var r = Pt(), n = r.firstChild, l = n.firstChild, d = l.firstChild, x = d.firstChild, g = x.firstChild, w = g.nextSibling;
|
|
169
|
+
w.firstChild;
|
|
170
|
+
var M = n.nextSibling;
|
|
171
|
+
return tt(Y, n), d.$$click = () => E("name"), u(w, m(X, {
|
|
172
172
|
field: "name"
|
|
173
173
|
}), null), u(l, m(W, {
|
|
174
174
|
get when() {
|
|
175
175
|
return h().showModified;
|
|
176
176
|
},
|
|
177
177
|
get children() {
|
|
178
|
-
return m(
|
|
178
|
+
return m(nt, {
|
|
179
179
|
direction: "horizontal",
|
|
180
|
-
onResize:
|
|
180
|
+
onResize: Q
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
}), null), u(n, m(W, {
|
|
@@ -185,22 +185,22 @@ function Jt(t) {
|
|
|
185
185
|
return h().showModified;
|
|
186
186
|
},
|
|
187
187
|
get children() {
|
|
188
|
-
var o =
|
|
189
|
-
return i.firstChild, i.$$click = () =>
|
|
188
|
+
var o = _t(), i = o.firstChild;
|
|
189
|
+
return i.firstChild, i.$$click = () => E("modifiedAt"), u(i, m(X, {
|
|
190
190
|
field: "modifiedAt"
|
|
191
191
|
}), null), u(o, m(W, {
|
|
192
192
|
get when() {
|
|
193
193
|
return h().showSize;
|
|
194
194
|
},
|
|
195
195
|
get children() {
|
|
196
|
-
return m(
|
|
196
|
+
return m(nt, {
|
|
197
197
|
direction: "horizontal",
|
|
198
|
-
onResize:
|
|
198
|
+
onResize: q
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
}), null),
|
|
201
|
+
}), null), F((s) => {
|
|
202
202
|
var b = H("relative shrink-0", h().showSize && "border-r border-border"), I = `${G()}px`;
|
|
203
|
-
return b !== s.e &&
|
|
203
|
+
return b !== s.e && V(o, s.e = b), I !== s.t && B(o, "width", s.t = I), s;
|
|
204
204
|
}, {
|
|
205
205
|
e: void 0,
|
|
206
206
|
t: void 0
|
|
@@ -211,33 +211,33 @@ function Jt(t) {
|
|
|
211
211
|
return h().showSize;
|
|
212
212
|
},
|
|
213
213
|
get children() {
|
|
214
|
-
var o =
|
|
215
|
-
return i.firstChild, i.$$click = () =>
|
|
214
|
+
var o = yt(), i = o.firstChild;
|
|
215
|
+
return i.firstChild, i.$$click = () => E("size"), u(i, m(X, {
|
|
216
216
|
field: "size"
|
|
217
|
-
}), null),
|
|
217
|
+
}), null), F((s) => B(o, "width", `${U()}px`)), o;
|
|
218
218
|
}
|
|
219
|
-
}), null), ct(
|
|
219
|
+
}), null), ct(M, "scroll", f.onScroll), tt((o) => {
|
|
220
220
|
f.scrollRef(o), a.setScrollContainer(o);
|
|
221
|
-
},
|
|
221
|
+
}, M), u(M, m(W, {
|
|
222
222
|
get when() {
|
|
223
223
|
return a.currentFiles().length > 0;
|
|
224
224
|
},
|
|
225
225
|
get fallback() {
|
|
226
226
|
return (() => {
|
|
227
|
-
var o =
|
|
227
|
+
var o = Lt();
|
|
228
228
|
return u(o, m(W, {
|
|
229
229
|
get when() {
|
|
230
230
|
return a.filterQueryApplied().trim();
|
|
231
231
|
},
|
|
232
232
|
get fallback() {
|
|
233
|
-
return
|
|
233
|
+
return pt();
|
|
234
234
|
},
|
|
235
235
|
get children() {
|
|
236
236
|
return [(() => {
|
|
237
|
-
var i =
|
|
237
|
+
var i = kt(), s = i.firstChild, b = s.nextSibling;
|
|
238
238
|
return b.nextSibling, u(i, () => a.filterQueryApplied(), b), i;
|
|
239
239
|
})(), (() => {
|
|
240
|
-
var i =
|
|
240
|
+
var i = Tt();
|
|
241
241
|
return i.$$click = () => a.setFilterQuery(""), i;
|
|
242
242
|
})()];
|
|
243
243
|
}
|
|
@@ -245,15 +245,15 @@ function Jt(t) {
|
|
|
245
245
|
})();
|
|
246
246
|
},
|
|
247
247
|
get children() {
|
|
248
|
-
var o =
|
|
249
|
-
return u(o, m(
|
|
248
|
+
var o = It();
|
|
249
|
+
return u(o, m(at, {
|
|
250
250
|
get each() {
|
|
251
251
|
return y();
|
|
252
252
|
},
|
|
253
|
-
children: (i) => m(
|
|
253
|
+
children: (i) => m(Et, {
|
|
254
254
|
item: i,
|
|
255
255
|
formatSize: O,
|
|
256
|
-
formatDate:
|
|
256
|
+
formatDate: $,
|
|
257
257
|
get showModified() {
|
|
258
258
|
return h().showModified;
|
|
259
259
|
},
|
|
@@ -264,17 +264,17 @@ function Jt(t) {
|
|
|
264
264
|
return G();
|
|
265
265
|
},
|
|
266
266
|
get sizeWidthPx() {
|
|
267
|
-
return
|
|
267
|
+
return U();
|
|
268
268
|
},
|
|
269
269
|
get instanceId() {
|
|
270
|
-
return
|
|
270
|
+
return D();
|
|
271
271
|
},
|
|
272
272
|
get enableDragDrop() {
|
|
273
|
-
return
|
|
273
|
+
return L();
|
|
274
274
|
},
|
|
275
275
|
dragContext: C
|
|
276
276
|
})
|
|
277
|
-
})),
|
|
277
|
+
})), F((i) => {
|
|
278
278
|
var s = `${f.paddingTop()}px`, b = `${f.paddingBottom()}px`;
|
|
279
279
|
return s !== i.e && B(o, "padding-top", i.e = s), b !== i.t && B(o, "padding-bottom", i.t = b), i;
|
|
280
280
|
}, {
|
|
@@ -282,49 +282,49 @@ function Jt(t) {
|
|
|
282
282
|
t: void 0
|
|
283
283
|
}), o;
|
|
284
284
|
}
|
|
285
|
-
})),
|
|
285
|
+
})), F((o) => {
|
|
286
286
|
var i = H("flex flex-col h-full min-h-0", t.class), s = H("relative flex-1 min-w-0", h().showModified && "border-r border-border");
|
|
287
|
-
return i !== o.e &&
|
|
287
|
+
return i !== o.e && V(r, o.e = i), s !== o.t && V(l, o.t = s), o;
|
|
288
288
|
}, {
|
|
289
289
|
e: void 0,
|
|
290
290
|
t: void 0
|
|
291
291
|
}), r;
|
|
292
292
|
})();
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
const a =
|
|
296
|
-
let f, y = null,
|
|
297
|
-
const X = 5,
|
|
294
|
+
function Et(t) {
|
|
295
|
+
const a = st(), C = () => a.isSelected(t.item.id), L = () => a.getFilterMatchForId(t.item.id), D = gt(() => t.item), S = Dt(a, D);
|
|
296
|
+
let f, y = null, E = 0, O = 0, $ = !1;
|
|
297
|
+
const X = 5, j = 500;
|
|
298
298
|
let A = null;
|
|
299
|
-
const [
|
|
299
|
+
const [K, Y] = ot(!1), p = () => f === "touch" || f === "pen", N = () => t.item.type === "folder", h = () => N() && t.enableDragDrop && t.dragContext, G = () => {
|
|
300
300
|
if (!h() || !t.dragContext) return !1;
|
|
301
301
|
const e = t.dragContext.dragState();
|
|
302
302
|
return e.isDragging ? t.dragContext.canDropOn(e.draggedItems, t.item.path, t.item, t.instanceId) : !1;
|
|
303
|
-
},
|
|
303
|
+
}, U = () => {
|
|
304
304
|
if (!t.dragContext) return !1;
|
|
305
305
|
const e = t.dragContext.dragState();
|
|
306
306
|
return e.isDragging ? e.draggedItems.some((c) => c.item.id === t.item.id) : !1;
|
|
307
|
-
},
|
|
307
|
+
}, Q = () => {
|
|
308
308
|
A !== null && (clearTimeout(A), A = null);
|
|
309
|
-
},
|
|
309
|
+
}, q = () => {
|
|
310
310
|
typeof document > "u" || (document.removeEventListener("pointermove", d, !0), document.removeEventListener("pointerup", x, !0), document.removeEventListener("pointercancel", g, !0));
|
|
311
311
|
}, r = () => {
|
|
312
312
|
typeof document > "u" || (document.addEventListener("pointermove", d, !0), document.addEventListener("pointerup", x, !0), document.addEventListener("pointercancel", g, !0));
|
|
313
313
|
}, n = (e) => {
|
|
314
|
-
|
|
314
|
+
Q(), q(), $ && t.dragContext && t.dragContext.endDrag(e), y = null, $ = !1;
|
|
315
315
|
};
|
|
316
|
-
|
|
316
|
+
ht(() => {
|
|
317
317
|
n(!1);
|
|
318
318
|
});
|
|
319
319
|
const l = (e, c) => {
|
|
320
|
-
if (!t.enableDragDrop || !t.dragContext ||
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
item:
|
|
320
|
+
if (!t.enableDragDrop || !t.dragContext || $) return;
|
|
321
|
+
$ = !0, C() || a.selectItem(t.item.id, !1);
|
|
322
|
+
const z = a.getSelectedItemsList(), R = (z.length > 0 && C() ? z : [t.item]).map((J) => ({
|
|
323
|
+
item: J,
|
|
324
324
|
sourceInstanceId: t.instanceId,
|
|
325
325
|
sourcePath: a.currentPath()
|
|
326
326
|
}));
|
|
327
|
-
if (
|
|
327
|
+
if (p() && "vibrate" in navigator)
|
|
328
328
|
try {
|
|
329
329
|
navigator.vibrate(50);
|
|
330
330
|
} catch {
|
|
@@ -332,70 +332,70 @@ function At(t) {
|
|
|
332
332
|
t.dragContext.startDrag(R, e, c);
|
|
333
333
|
}, d = (e) => {
|
|
334
334
|
if (y !== e.pointerId) return;
|
|
335
|
-
const c = e.clientX -
|
|
336
|
-
if (
|
|
335
|
+
const c = e.clientX - E, z = e.clientY - O, v = Math.sqrt(c * c + z * z);
|
|
336
|
+
if (p() && !$ && v > 10) {
|
|
337
337
|
n(!1);
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
340
|
-
!
|
|
340
|
+
!p() && !$ && v > X && l(e.clientX, e.clientY), $ && t.dragContext && t.dragContext.updateDrag(e.clientX, e.clientY);
|
|
341
341
|
}, x = (e) => {
|
|
342
|
-
y === e.pointerId && (
|
|
342
|
+
y === e.pointerId && (S.onPointerUp(), n(!0));
|
|
343
343
|
}, g = (e) => {
|
|
344
|
-
y === e.pointerId && (
|
|
345
|
-
},
|
|
346
|
-
f = e.pointerType,
|
|
347
|
-
y !== null &&
|
|
348
|
-
},
|
|
349
|
-
},
|
|
350
|
-
f = e.pointerType,
|
|
344
|
+
y === e.pointerId && (S.onPointerCancel(), n(!1));
|
|
345
|
+
}, w = (e) => {
|
|
346
|
+
f = e.pointerType, S.onPointerDown(e), !(e.pointerType === "mouse" && e.button !== 0) && (!t.enableDragDrop || !t.dragContext || (y = e.pointerId, E = e.clientX, O = e.clientY, $ = !1, r(), p() && (Q(), A = setTimeout(() => {
|
|
347
|
+
y !== null && !$ && l(E, O);
|
|
348
|
+
}, j))));
|
|
349
|
+
}, M = (e) => {
|
|
350
|
+
f = e.pointerType, S.onPointerMove(e);
|
|
351
351
|
}, o = (e) => {
|
|
352
352
|
if (!h() || !t.dragContext) return;
|
|
353
353
|
const c = t.dragContext.dragState();
|
|
354
354
|
if (!c.isDragging) return;
|
|
355
|
-
|
|
356
|
-
const
|
|
355
|
+
Y(!0);
|
|
356
|
+
const z = t.dragContext.canDropOn(c.draggedItems, t.item.path, t.item, t.instanceId), R = e.currentTarget?.getBoundingClientRect() ?? null;
|
|
357
357
|
t.dragContext.setDropTarget({
|
|
358
358
|
instanceId: t.instanceId,
|
|
359
359
|
targetPath: t.item.path,
|
|
360
360
|
targetItem: t.item
|
|
361
|
-
},
|
|
361
|
+
}, z, R);
|
|
362
362
|
}, i = (e) => {
|
|
363
363
|
if (!t.dragContext) return;
|
|
364
|
-
|
|
364
|
+
Y(!1);
|
|
365
365
|
const c = t.dragContext.dragState();
|
|
366
366
|
c.isDragging && c.dropTarget?.targetPath === t.item.path && t.dragContext.setDropTarget(null, !1);
|
|
367
367
|
}, s = (e) => {
|
|
368
|
-
if (
|
|
369
|
-
|
|
368
|
+
if ($) {
|
|
369
|
+
$ = !1;
|
|
370
370
|
return;
|
|
371
371
|
}
|
|
372
|
-
if (
|
|
373
|
-
if (
|
|
372
|
+
if (!S.consumeClickSuppression(e)) {
|
|
373
|
+
if (p()) {
|
|
374
374
|
a.openItem(t.item);
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
377
377
|
a.selectItem(t.item.id, e.metaKey || e.ctrlKey);
|
|
378
378
|
}
|
|
379
379
|
}, b = () => {
|
|
380
|
-
|
|
380
|
+
p() || a.openItem(t.item);
|
|
381
381
|
}, I = (e) => {
|
|
382
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
382
|
+
if (e.preventDefault(), e.stopPropagation(), p()) return;
|
|
383
383
|
C() || a.selectItem(t.item.id, !1);
|
|
384
|
-
const c = a.getSelectedItemsList(),
|
|
384
|
+
const c = a.getSelectedItemsList(), z = c.length > 0 ? c : [t.item];
|
|
385
385
|
a.showContextMenu({
|
|
386
386
|
x: e.clientX,
|
|
387
387
|
y: e.clientY,
|
|
388
|
-
items:
|
|
388
|
+
items: z
|
|
389
389
|
});
|
|
390
|
-
}, k = () => t.
|
|
390
|
+
}, k = () => t.dragContext?.dragState(), P = () => k()?.isDragging ?? !1, T = () => K() && P() && h();
|
|
391
391
|
return (() => {
|
|
392
|
-
var e =
|
|
393
|
-
return mt(e, ut(
|
|
392
|
+
var e = Rt(), c = e.firstChild, z = c.firstChild;
|
|
393
|
+
return mt(e, ut(St, {
|
|
394
394
|
onClick: s,
|
|
395
395
|
onDblClick: b,
|
|
396
396
|
onContextMenu: I,
|
|
397
|
-
onPointerDown:
|
|
398
|
-
onPointerMove:
|
|
397
|
+
onPointerDown: w,
|
|
398
|
+
onPointerMove: M,
|
|
399
399
|
onPointerEnter: o,
|
|
400
400
|
onPointerLeave: i,
|
|
401
401
|
get class() {
|
|
@@ -406,47 +406,47 @@ function At(t) {
|
|
|
406
406
|
"focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring",
|
|
407
407
|
C() && "bg-accent text-accent-foreground",
|
|
408
408
|
// Drag state styling - being dragged items become translucent
|
|
409
|
-
|
|
409
|
+
U() && "opacity-40 scale-[0.98]",
|
|
410
410
|
// Drop target styling - enhanced visual feedback
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
T() && G() && ["bg-primary/15 outline outline-2 outline-primary/60", "scale-[1.01] shadow-sm shadow-primary/10"],
|
|
412
|
+
T() && !G() && ["bg-destructive/10 outline outline-2 outline-dashed outline-destructive/50"]
|
|
413
413
|
);
|
|
414
414
|
}
|
|
415
|
-
}), !1, !0), u(
|
|
416
|
-
get
|
|
417
|
-
return
|
|
415
|
+
}), !1, !0), u(z, m(Ct, {
|
|
416
|
+
get item() {
|
|
417
|
+
return t.item;
|
|
418
418
|
},
|
|
419
419
|
class: "w-4 h-4"
|
|
420
|
-
})), u(c, m(
|
|
420
|
+
})), u(c, m(Wt, {
|
|
421
421
|
get name() {
|
|
422
422
|
return t.item.name;
|
|
423
423
|
},
|
|
424
424
|
get match() {
|
|
425
|
-
return
|
|
425
|
+
return L();
|
|
426
426
|
}
|
|
427
427
|
}), null), u(e, m(W, {
|
|
428
428
|
get when() {
|
|
429
429
|
return t.showModified;
|
|
430
430
|
},
|
|
431
431
|
get children() {
|
|
432
|
-
var
|
|
433
|
-
return u(
|
|
432
|
+
var v = it();
|
|
433
|
+
return u(v, () => t.formatDate(t.item.modifiedAt)), F((R) => B(v, "width", `${t.modifiedWidthPx}px`)), v;
|
|
434
434
|
}
|
|
435
435
|
}), null), u(e, m(W, {
|
|
436
436
|
get when() {
|
|
437
437
|
return t.showSize;
|
|
438
438
|
},
|
|
439
439
|
get children() {
|
|
440
|
-
var
|
|
441
|
-
return u(
|
|
442
|
-
var R =
|
|
440
|
+
var v = it();
|
|
441
|
+
return u(v, (() => {
|
|
442
|
+
var R = rt(() => t.item.type === "folder");
|
|
443
443
|
return () => R() ? "-" : t.formatSize(t.item.size);
|
|
444
|
-
})()),
|
|
444
|
+
})()), F((R) => B(v, "width", `${t.sizeWidthPx}px`)), v;
|
|
445
445
|
}
|
|
446
446
|
}), null), e;
|
|
447
447
|
})();
|
|
448
448
|
}
|
|
449
|
-
|
|
449
|
+
ft(["click"]);
|
|
450
450
|
export {
|
|
451
|
-
|
|
451
|
+
Kt as FileListView
|
|
452
452
|
};
|
|
@@ -6,5 +6,5 @@ export { FileGridView, type FileGridViewProps } from './FileGridView';
|
|
|
6
6
|
export { FileContextMenu, type FileContextMenuProps, type BuiltinContextMenuAction, type HideItemsValue } from './FileContextMenu';
|
|
7
7
|
export { Breadcrumb, type BreadcrumbProps } from './Breadcrumb';
|
|
8
8
|
export { FileBrowserToolbar, type FileBrowserToolbarProps } from './FileBrowserToolbar';
|
|
9
|
-
export { FolderIcon, FolderOpenIcon, FileIcon, CodeFileIcon, ShellScriptFileIcon, ImageFileIcon, DocumentFileIcon, ConfigFileIcon, StyleFileIcon, getFileIcon, } from './FileIcons';
|
|
10
|
-
export type { FileItem, ViewMode, SortField, SortDirection, SortConfig, FileListColumnRatios, FileBrowserContextValue, ContextMenuActionType, ContextMenuItem, ContextMenuEvent, ContextMenuCallbacks, OptimisticUpdateType, OptimisticRemove, OptimisticUpdate, OptimisticInsert, OptimisticOperation, ScrollPosition, } from './types';
|
|
9
|
+
export { FolderIcon, FolderOpenIcon, FileIcon, CodeFileIcon, JavaScriptFileIcon, TypeScriptFileIcon, ShellScriptFileIcon, ImageFileIcon, DocumentFileIcon, ConfigFileIcon, StyleFileIcon, FileItemIcon, getFileIcon, resolveFileItemIcon, } from './FileIcons';
|
|
10
|
+
export type { FileItem, FileItemIconOverride, ViewMode, SortField, SortDirection, SortConfig, FileListColumnRatios, FileBrowserContextValue, ContextMenuActionType, ContextMenuItem, ContextMenuEvent, ContextMenuCallbacks, OptimisticUpdateType, OptimisticRemove, OptimisticUpdate, OptimisticInsert, OptimisticOperation, ScrollPosition, } from './types';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { JSX, Accessor } from 'solid-js';
|
|
1
|
+
import type { JSX, Accessor, Component } from 'solid-js';
|
|
2
|
+
export type FileItemIconOverride = Component<{
|
|
3
|
+
class?: string;
|
|
4
|
+
}> | JSX.Element;
|
|
2
5
|
/**
|
|
3
6
|
* Represents a file or folder item in the browser
|
|
4
7
|
*/
|
|
@@ -11,7 +14,7 @@ export interface FileItem {
|
|
|
11
14
|
modifiedAt?: Date;
|
|
12
15
|
extension?: string;
|
|
13
16
|
children?: FileItem[];
|
|
14
|
-
icon?:
|
|
17
|
+
icon?: FileItemIconOverride;
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* View mode for the file browser main content area
|