@floegence/floe-webapp-core 0.36.72 → 0.36.73
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 +1 -1
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { use as ee, insert as f, createComponent as m, effect as
|
|
2
|
-
import { createMemo as te, createEffect as
|
|
1
|
+
import { use as ee, insert as f, createComponent as m, effect as k, className as W, setStyleProperty as p, addEventListener as ie, style as be, template as _, spread as De, mergeProps as Ie, memo as ce, delegateEvents as Me } from "solid-js/web";
|
|
2
|
+
import { createMemo as te, createEffect as $e, onCleanup as de, createSignal as ue, Show as P, For as me, untrack as ze } from "solid-js";
|
|
3
3
|
import { cn as E } from "../../utils/cn.js";
|
|
4
4
|
import { useMediaQuery as re } from "../../hooks/useMediaQuery.js";
|
|
5
5
|
import { useResizeObserver as _e } from "../../hooks/useResizeObserver.js";
|
|
6
|
-
import { useVirtualWindow as
|
|
6
|
+
import { useVirtualWindow as ye } from "../../hooks/useVirtualWindow.js";
|
|
7
7
|
import { useFileBrowser as fe } from "./FileBrowserContext.js";
|
|
8
|
-
import { useFileBrowserDrag as
|
|
9
|
-
import { FileItemIcon as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { useFileBrowserDrag as Pe } from "../../context/FileBrowserDragContext.js";
|
|
9
|
+
import { FileItemIcon as Re } from "./FileIcons.js";
|
|
10
|
+
import { FileItemDecorationBadge as Fe, fileItemDecorationNameClass as Te } from "./FileItemDecorations.js";
|
|
11
|
+
import { ChevronDown as ke } from "../icons/index.js";
|
|
12
|
+
import { createLongPressContextMenuHandlers as Ae } from "./longPressContextMenu.js";
|
|
12
13
|
import { ResizeHandle as oe } from "../layout/ResizeHandle.js";
|
|
13
|
-
import { fileBrowserTouchTargetAttrs as
|
|
14
|
-
import { createItemContextMenuEvent as
|
|
15
|
-
import { createFileBrowserMarqueeSelection as
|
|
14
|
+
import { fileBrowserTouchTargetAttrs as Ee } from "./touchInteractionGuard.js";
|
|
15
|
+
import { createItemContextMenuEvent as Le } from "./contextMenuEvent.js";
|
|
16
|
+
import { createFileBrowserMarqueeSelection as We, FILE_BROWSER_MARQUEE_OVERLAY_CLASS as pe } from "./useFileBrowserMarqueeSelection.js";
|
|
16
17
|
import { isPrimaryModKeyPressed as ae } from "../../utils/keybind.js";
|
|
17
|
-
var
|
|
18
|
-
function
|
|
18
|
+
var ge = /* @__PURE__ */ _("<span>"), Be = /* @__PURE__ */ _('<mark class="bg-warning/40 text-inherit rounded-sm">'), He = /* @__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'), Ne = /* @__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'), le = /* @__PURE__ */ _("<div>"), qe = /* @__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="relative flex-1 min-h-0 overflow-auto">'), Oe = /* @__PURE__ */ _('<span>No files matching "<!>"'), Xe = /* @__PURE__ */ _('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), Ye = /* @__PURE__ */ _('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), Ge = /* @__PURE__ */ _("<span>This folder is empty"), se = /* @__PURE__ */ _('<div class="shrink-0 px-3 py-1.5 text-left text-muted-foreground truncate">'), Ve = /* @__PURE__ */ _('<button type=button><div class="flex items-center gap-2 flex-1 min-w-0 px-3 py-1.5"><span class="relative flex-shrink-0 w-4 h-4">');
|
|
19
|
+
function Ue(e) {
|
|
19
20
|
const o = te(() => {
|
|
20
|
-
if (!
|
|
21
|
+
if (!e.match || e.match.matchedIndices.length === 0)
|
|
21
22
|
return [{
|
|
22
|
-
text:
|
|
23
|
+
text: e.name,
|
|
23
24
|
highlight: !1
|
|
24
25
|
}];
|
|
25
|
-
const
|
|
26
|
-
let
|
|
27
|
-
for (let g = 0; g <
|
|
26
|
+
const I = [], R = new Set(e.match.matchedIndices);
|
|
27
|
+
let M = "", C = !1;
|
|
28
|
+
for (let g = 0; g < e.name.length; g++) {
|
|
28
29
|
const $ = R.has(g);
|
|
29
|
-
g === 0 ? (C = $,
|
|
30
|
-
text:
|
|
30
|
+
g === 0 ? (C = $, M = e.name[g]) : $ === C ? M += e.name[g] : (I.push({
|
|
31
|
+
text: M,
|
|
31
32
|
highlight: C
|
|
32
|
-
}),
|
|
33
|
+
}), M = e.name[g], C = $);
|
|
33
34
|
}
|
|
34
|
-
return
|
|
35
|
-
text:
|
|
35
|
+
return M && I.push({
|
|
36
|
+
text: M,
|
|
36
37
|
highlight: C
|
|
37
|
-
}),
|
|
38
|
+
}), I;
|
|
38
39
|
});
|
|
39
40
|
return (() => {
|
|
40
|
-
var
|
|
41
|
-
return f(
|
|
41
|
+
var I = ge();
|
|
42
|
+
return f(I, m(me, {
|
|
42
43
|
get each() {
|
|
43
44
|
return o();
|
|
44
45
|
},
|
|
@@ -50,15 +51,15 @@ function Ve(t) {
|
|
|
50
51
|
return ce(() => R.text);
|
|
51
52
|
},
|
|
52
53
|
get children() {
|
|
53
|
-
var
|
|
54
|
-
return f(
|
|
54
|
+
var M = Be();
|
|
55
|
+
return f(M, () => R.text), M;
|
|
55
56
|
}
|
|
56
57
|
})
|
|
57
|
-
})),
|
|
58
|
+
})), k(() => W(I, E("truncate", e.class))), I;
|
|
58
59
|
})();
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
-
const o = fe(),
|
|
61
|
+
function ft(e) {
|
|
62
|
+
const o = fe(), I = Pe(), R = () => (e.enableDragDrop ?? !0) && !!I, M = () => e.instanceId ?? "default", C = 32, g = ye({
|
|
62
63
|
count: () => o.currentFiles().length,
|
|
63
64
|
itemSize: () => C,
|
|
64
65
|
overscan: 12
|
|
@@ -68,35 +69,35 @@ function ut(t) {
|
|
|
68
69
|
end: i
|
|
69
70
|
} = g.range();
|
|
70
71
|
return o.currentFiles().slice(n, i);
|
|
71
|
-
}),
|
|
72
|
-
let
|
|
72
|
+
}), F = /* @__PURE__ */ new Map();
|
|
73
|
+
let z = null, x = 0;
|
|
73
74
|
const U = (n, i) => {
|
|
74
75
|
if (i) {
|
|
75
|
-
|
|
76
|
+
F.set(n, i);
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
+
F.delete(n);
|
|
79
80
|
}, Q = (n) => {
|
|
80
|
-
if (!
|
|
81
|
-
const i = n * C, l = i + C, c =
|
|
81
|
+
if (!z) return;
|
|
82
|
+
const i = n * C, l = i + C, c = z.scrollTop, h = c + z.clientHeight;
|
|
82
83
|
if (i < c) {
|
|
83
|
-
|
|
84
|
+
z.scrollTop = i, g.onScroll();
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
l > h && (
|
|
87
|
+
l > h && (z.scrollTop = Math.max(0, l - z.clientHeight), g.onScroll());
|
|
87
88
|
};
|
|
88
|
-
|
|
89
|
+
$e(() => {
|
|
89
90
|
const n = o.revealRequest(), i = o.currentFiles();
|
|
90
91
|
if ($(), !n) return;
|
|
91
92
|
const l = i.findIndex((v) => v.id === n.targetId);
|
|
92
93
|
if (l < 0) return;
|
|
93
|
-
if (!
|
|
94
|
+
if (!F.get(n.targetId)) {
|
|
94
95
|
Q(l);
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
98
|
typeof cancelAnimationFrame == "function" && x && (cancelAnimationFrame(x), x = 0);
|
|
98
99
|
const h = () => {
|
|
99
|
-
o.revealRequest()?.requestId === n.requestId && (
|
|
100
|
+
o.revealRequest()?.requestId === n.requestId && (F.get(n.targetId)?.scrollIntoView({
|
|
100
101
|
block: "nearest",
|
|
101
102
|
inline: "nearest"
|
|
102
103
|
}), o.selectItem(n.targetId, !1), o.consumeRevealRequest(n.requestId));
|
|
@@ -111,7 +112,7 @@ function ut(t) {
|
|
|
111
112
|
}), de(() => {
|
|
112
113
|
typeof cancelAnimationFrame == "function" && x && cancelAnimationFrame(x);
|
|
113
114
|
});
|
|
114
|
-
const
|
|
115
|
+
const A = (n) => {
|
|
115
116
|
const i = o.sortConfig();
|
|
116
117
|
o.setSortConfig({
|
|
117
118
|
field: n,
|
|
@@ -121,26 +122,26 @@ function ut(t) {
|
|
|
121
122
|
month: "short",
|
|
122
123
|
day: "numeric",
|
|
123
124
|
year: "numeric"
|
|
124
|
-
}) : "-", y =
|
|
125
|
-
getContainer: () =>
|
|
126
|
-
getOverlayHost: () =>
|
|
125
|
+
}) : "-", y = We({
|
|
126
|
+
getContainer: () => z,
|
|
127
|
+
getOverlayHost: () => z,
|
|
127
128
|
getVisibleItemIdsInOrder: () => o.currentFiles().map((n) => n.id),
|
|
128
|
-
getElementForId: (n) =>
|
|
129
|
+
getElementForId: (n) => F.get(n) ?? null,
|
|
129
130
|
getSelectedIds: () => [...o.selectedItems()],
|
|
130
131
|
replaceSelection: (n, i) => o.replaceSelection(n, i),
|
|
131
132
|
clearSelection: o.clearSelection
|
|
132
|
-
}),
|
|
133
|
+
}), B = (n) => {
|
|
133
134
|
const i = () => o.sortConfig(), l = () => i().field === n.field;
|
|
134
135
|
return (() => {
|
|
135
|
-
var c =
|
|
136
|
-
return f(c, m(
|
|
136
|
+
var c = ge();
|
|
137
|
+
return f(c, m(ke, {
|
|
137
138
|
get class() {
|
|
138
139
|
return E("w-3 h-3 transition-transform duration-150", l() && i().direction === "asc" && "rotate-180");
|
|
139
140
|
}
|
|
140
|
-
})),
|
|
141
|
+
})), k(() => W(c, E("ml-1 transition-all duration-150", l() ? "opacity-100" : "opacity-0 group-hover:opacity-40"))), c;
|
|
141
142
|
})();
|
|
142
|
-
}, H = re("(min-width: 640px)"), X = re("(min-width: 768px)"), [K, Y] = ue(null), J = _e(K),
|
|
143
|
-
const n = J()?.width ?? 0, i = H(), l = X(), c = o.listColumnRatios(), h = 160, v = 120, b = 80,
|
|
143
|
+
}, H = re("(min-width: 640px)"), X = re("(min-width: 768px)"), [K, Y] = ue(null), J = _e(K), L = (n, i, l) => Math.max(i, Math.min(l, n)), S = te(() => {
|
|
144
|
+
const n = J()?.width ?? 0, i = H(), l = X(), c = o.listColumnRatios(), h = 160, v = 120, b = 80, D = 128, a = 96;
|
|
144
145
|
if (!i || n <= 0)
|
|
145
146
|
return {
|
|
146
147
|
width: n,
|
|
@@ -149,13 +150,13 @@ function ut(t) {
|
|
|
149
150
|
minName: h,
|
|
150
151
|
minModified: v,
|
|
151
152
|
minSize: b,
|
|
152
|
-
modifiedWidth:
|
|
153
|
+
modifiedWidth: D,
|
|
153
154
|
sizeWidth: a
|
|
154
155
|
};
|
|
155
156
|
if (!l) {
|
|
156
157
|
const u = c.size, d = Math.max(0, 1 - u);
|
|
157
158
|
let w = (d > 0 ? c.modifiedAt / d : c.modifiedAt) * n;
|
|
158
|
-
return w =
|
|
159
|
+
return w = L(w, v, Math.max(v, n - h)), {
|
|
159
160
|
width: n,
|
|
160
161
|
showModified: i,
|
|
161
162
|
showSize: l,
|
|
@@ -166,13 +167,13 @@ function ut(t) {
|
|
|
166
167
|
sizeWidth: 0
|
|
167
168
|
};
|
|
168
169
|
}
|
|
169
|
-
let r = Math.max(v, c.modifiedAt * n),
|
|
170
|
+
let r = Math.max(v, c.modifiedAt * n), t = Math.max(b, c.size * n);
|
|
170
171
|
const s = Math.max(0, n - h);
|
|
171
|
-
if (r +
|
|
172
|
-
const u = r +
|
|
173
|
-
|
|
172
|
+
if (r + t > s) {
|
|
173
|
+
const u = r + t - s, d = Math.max(0, r - v), w = Math.max(0, t - b), T = d + w;
|
|
174
|
+
T > 0 && (r -= u * (d / T), t -= u * (w / T));
|
|
174
175
|
}
|
|
175
|
-
return r = Math.max(v, r),
|
|
176
|
+
return r = Math.max(v, r), t = Math.max(b, t), {
|
|
176
177
|
width: n,
|
|
177
178
|
showModified: i,
|
|
178
179
|
showSize: l,
|
|
@@ -180,40 +181,40 @@ function ut(t) {
|
|
|
180
181
|
minModified: v,
|
|
181
182
|
minSize: b,
|
|
182
183
|
modifiedWidth: r,
|
|
183
|
-
sizeWidth:
|
|
184
|
+
sizeWidth: t
|
|
184
185
|
};
|
|
185
|
-
}),
|
|
186
|
+
}), N = () => S().modifiedWidth, q = () => S().sizeWidth, G = (n) => {
|
|
186
187
|
const i = S();
|
|
187
188
|
if (!i.showModified || i.width <= 0) return;
|
|
188
189
|
if (!i.showSize) {
|
|
189
190
|
const u = o.listColumnRatios().size, d = Math.max(0, 1 - u);
|
|
190
191
|
if (d <= 0) return;
|
|
191
|
-
const w = i.width,
|
|
192
|
+
const w = i.width, T = i.modifiedWidth, ne = Math.max(0, w - T), he = i.minName - ne, xe = T - i.minModified, Z = L(n, he, xe);
|
|
192
193
|
if (Z === 0) return;
|
|
193
|
-
const
|
|
194
|
+
const ve = ne + Z, we = T - Z, Se = ve / w * d, Ce = we / w * d;
|
|
194
195
|
o.setListColumnRatios({
|
|
195
|
-
name:
|
|
196
|
-
modifiedAt:
|
|
196
|
+
name: Se,
|
|
197
|
+
modifiedAt: Ce,
|
|
197
198
|
size: u
|
|
198
199
|
});
|
|
199
200
|
return;
|
|
200
201
|
}
|
|
201
|
-
const l = i.width, c = i.modifiedWidth, h = i.sizeWidth, v = Math.max(0, l - c - h), b = i.minName - v,
|
|
202
|
+
const l = i.width, c = i.modifiedWidth, h = i.sizeWidth, v = Math.max(0, l - c - h), b = i.minName - v, D = c - i.minModified, a = L(n, b, D);
|
|
202
203
|
if (a === 0) return;
|
|
203
|
-
const r = v + a,
|
|
204
|
+
const r = v + a, t = c - a;
|
|
204
205
|
o.setListColumnRatios({
|
|
205
206
|
name: r / l,
|
|
206
|
-
modifiedAt:
|
|
207
|
+
modifiedAt: t / l,
|
|
207
208
|
size: h / l
|
|
208
209
|
});
|
|
209
210
|
}, V = (n) => {
|
|
210
211
|
const i = S();
|
|
211
212
|
if (!i.showSize || i.width <= 0) return;
|
|
212
|
-
const l = i.width, c = i.modifiedWidth, h = i.sizeWidth, v = i.minModified - c, b = h - i.minSize,
|
|
213
|
-
if (
|
|
214
|
-
const a = c +
|
|
213
|
+
const l = i.width, c = i.modifiedWidth, h = i.sizeWidth, v = i.minModified - c, b = h - i.minSize, D = L(n, v, b);
|
|
214
|
+
if (D === 0) return;
|
|
215
|
+
const a = c + D, r = h - D, t = Math.max(0, l - a - r);
|
|
215
216
|
o.setListColumnRatios({
|
|
216
|
-
name:
|
|
217
|
+
name: t / l,
|
|
217
218
|
modifiedAt: a / l,
|
|
218
219
|
size: r / l
|
|
219
220
|
});
|
|
@@ -221,8 +222,8 @@ function ut(t) {
|
|
|
221
222
|
return (() => {
|
|
222
223
|
var n = qe(), i = n.firstChild, l = i.firstChild, c = l.firstChild, h = c.firstChild, v = h.firstChild, b = v.nextSibling;
|
|
223
224
|
b.firstChild;
|
|
224
|
-
var
|
|
225
|
-
return ee(Y, i), c.$$click = () =>
|
|
225
|
+
var D = i.nextSibling;
|
|
226
|
+
return ee(Y, i), c.$$click = () => A("name"), f(b, m(B, {
|
|
226
227
|
field: "name"
|
|
227
228
|
}), null), f(l, m(P, {
|
|
228
229
|
get when() {
|
|
@@ -240,7 +241,7 @@ function ut(t) {
|
|
|
240
241
|
},
|
|
241
242
|
get children() {
|
|
242
243
|
var a = He(), r = a.firstChild;
|
|
243
|
-
return r.firstChild, r.$$click = () =>
|
|
244
|
+
return r.firstChild, r.$$click = () => A("modifiedAt"), f(r, m(B, {
|
|
244
245
|
field: "modifiedAt"
|
|
245
246
|
}), null), f(a, m(P, {
|
|
246
247
|
get when() {
|
|
@@ -252,9 +253,9 @@ function ut(t) {
|
|
|
252
253
|
onResize: V
|
|
253
254
|
});
|
|
254
255
|
}
|
|
255
|
-
}), null),
|
|
256
|
-
var s = E("relative shrink-0", S().showSize && "border-r border-border"), u = `${
|
|
257
|
-
return s !==
|
|
256
|
+
}), null), k((t) => {
|
|
257
|
+
var s = E("relative shrink-0", S().showSize && "border-r border-border"), u = `${N()}px`;
|
|
258
|
+
return s !== t.e && W(a, t.e = s), u !== t.t && p(a, "width", t.t = u), t;
|
|
258
259
|
}, {
|
|
259
260
|
e: void 0,
|
|
260
261
|
t: void 0
|
|
@@ -265,33 +266,33 @@ function ut(t) {
|
|
|
265
266
|
return S().showSize;
|
|
266
267
|
},
|
|
267
268
|
get children() {
|
|
268
|
-
var a =
|
|
269
|
-
return r.firstChild, r.$$click = () =>
|
|
269
|
+
var a = Ne(), r = a.firstChild;
|
|
270
|
+
return r.firstChild, r.$$click = () => A("size"), f(r, m(B, {
|
|
270
271
|
field: "size"
|
|
271
|
-
}), null),
|
|
272
|
+
}), null), k((t) => p(a, "width", `${q()}px`)), a;
|
|
272
273
|
}
|
|
273
|
-
}), null), ie(
|
|
274
|
-
|
|
275
|
-
},
|
|
274
|
+
}), null), ie(D, "pointerdown", y.onPointerDown, !0), ie(D, "scroll", g.onScroll), ee((a) => {
|
|
275
|
+
z = a, g.scrollRef(a), o.setScrollContainer(a);
|
|
276
|
+
}, D), f(D, m(P, {
|
|
276
277
|
get when() {
|
|
277
278
|
return o.currentFiles().length > 0;
|
|
278
279
|
},
|
|
279
280
|
get fallback() {
|
|
280
281
|
return (() => {
|
|
281
|
-
var a =
|
|
282
|
+
var a = Ye();
|
|
282
283
|
return f(a, m(P, {
|
|
283
284
|
get when() {
|
|
284
285
|
return o.filterQueryApplied().trim();
|
|
285
286
|
},
|
|
286
287
|
get fallback() {
|
|
287
|
-
return
|
|
288
|
+
return Ge();
|
|
288
289
|
},
|
|
289
290
|
get children() {
|
|
290
291
|
return [(() => {
|
|
291
|
-
var r =
|
|
292
|
+
var r = Oe(), t = r.firstChild, s = t.nextSibling;
|
|
292
293
|
return s.nextSibling, f(r, () => o.filterQueryApplied(), s), r;
|
|
293
294
|
})(), (() => {
|
|
294
|
-
var r =
|
|
295
|
+
var r = Xe();
|
|
295
296
|
return r.$$click = () => o.setFilterQuery(""), r;
|
|
296
297
|
})()];
|
|
297
298
|
}
|
|
@@ -304,7 +305,7 @@ function ut(t) {
|
|
|
304
305
|
get each() {
|
|
305
306
|
return $();
|
|
306
307
|
},
|
|
307
|
-
children: (r) => m(
|
|
308
|
+
children: (r) => m(Qe, {
|
|
308
309
|
item: r,
|
|
309
310
|
formatSize: j,
|
|
310
311
|
formatDate: O,
|
|
@@ -315,78 +316,78 @@ function ut(t) {
|
|
|
315
316
|
return S().showSize;
|
|
316
317
|
},
|
|
317
318
|
get modifiedWidthPx() {
|
|
318
|
-
return
|
|
319
|
+
return N();
|
|
319
320
|
},
|
|
320
321
|
get sizeWidthPx() {
|
|
321
322
|
return q();
|
|
322
323
|
},
|
|
323
324
|
get instanceId() {
|
|
324
|
-
return
|
|
325
|
+
return M();
|
|
325
326
|
},
|
|
326
327
|
get enableDragDrop() {
|
|
327
328
|
return R();
|
|
328
329
|
},
|
|
329
|
-
dragContext:
|
|
330
|
+
dragContext: I,
|
|
330
331
|
registerRow: U
|
|
331
332
|
})
|
|
332
|
-
})),
|
|
333
|
-
var
|
|
334
|
-
return
|
|
333
|
+
})), k((r) => {
|
|
334
|
+
var t = `${g.paddingTop()}px`, s = `${g.paddingBottom()}px`;
|
|
335
|
+
return t !== r.e && p(a, "padding-top", r.e = t), s !== r.t && p(a, "padding-bottom", r.t = s), r;
|
|
335
336
|
}, {
|
|
336
337
|
e: void 0,
|
|
337
338
|
t: void 0
|
|
338
339
|
}), a;
|
|
339
340
|
}
|
|
340
|
-
}), null), f(
|
|
341
|
+
}), null), f(D, m(P, {
|
|
341
342
|
get when() {
|
|
342
343
|
return y.overlayStyle();
|
|
343
344
|
},
|
|
344
345
|
children: (a) => (() => {
|
|
345
346
|
var r = le();
|
|
346
|
-
return
|
|
347
|
+
return W(r, pe), k((t) => be(r, a(), t)), r;
|
|
347
348
|
})()
|
|
348
|
-
}), null),
|
|
349
|
-
var r = E("flex flex-col h-full min-h-0",
|
|
350
|
-
return r !== a.e &&
|
|
349
|
+
}), null), k((a) => {
|
|
350
|
+
var r = E("flex flex-col h-full min-h-0", e.class), t = E("relative flex-1 min-w-0", S().showModified && "border-r border-border");
|
|
351
|
+
return r !== a.e && W(n, a.e = r), t !== a.t && W(l, a.t = t), a;
|
|
351
352
|
}, {
|
|
352
353
|
e: void 0,
|
|
353
354
|
t: void 0
|
|
354
355
|
}), n;
|
|
355
356
|
})();
|
|
356
357
|
}
|
|
357
|
-
function
|
|
358
|
-
const o = fe(),
|
|
358
|
+
function Qe(e) {
|
|
359
|
+
const o = fe(), I = () => o.isSelected(e.item.id), R = () => o.getFilterMatchForId(e.item.id), M = ze(() => e.item), C = Ae(o, M, {
|
|
359
360
|
source: "list"
|
|
360
361
|
});
|
|
361
|
-
let g, $ = null,
|
|
362
|
+
let g, $ = null, F = 0, z = 0, x = !1;
|
|
362
363
|
const U = 5, Q = 500;
|
|
363
|
-
let
|
|
364
|
-
const [j, O] = ue(!1), y = () => g === "touch" || g === "pen",
|
|
365
|
-
if (!H() || !
|
|
366
|
-
const
|
|
367
|
-
return
|
|
364
|
+
let A = null;
|
|
365
|
+
const [j, O] = ue(!1), y = () => g === "touch" || g === "pen", B = () => e.item.type === "folder", H = () => B() && e.enableDragDrop && e.dragContext, X = () => {
|
|
366
|
+
if (!H() || !e.dragContext) return !1;
|
|
367
|
+
const t = e.dragContext.dragState();
|
|
368
|
+
return t.isDragging ? e.dragContext.canDropOn(t.draggedItems, e.item.path, e.item, e.instanceId) : !1;
|
|
368
369
|
}, K = () => {
|
|
369
|
-
if (!
|
|
370
|
-
const
|
|
371
|
-
return
|
|
370
|
+
if (!e.dragContext) return !1;
|
|
371
|
+
const t = e.dragContext.dragState();
|
|
372
|
+
return t.isDragging ? t.draggedItems.some((s) => s.item.id === e.item.id) : !1;
|
|
372
373
|
}, Y = () => {
|
|
373
|
-
|
|
374
|
+
A !== null && (clearTimeout(A), A = null);
|
|
374
375
|
}, J = () => {
|
|
375
376
|
typeof document > "u" || (document.removeEventListener("pointermove", q, !0), document.removeEventListener("pointerup", G, !0), document.removeEventListener("pointercancel", V, !0));
|
|
376
|
-
},
|
|
377
|
+
}, L = () => {
|
|
377
378
|
typeof document > "u" || (document.addEventListener("pointermove", q, !0), document.addEventListener("pointerup", G, !0), document.addEventListener("pointercancel", V, !0));
|
|
378
|
-
}, S = (
|
|
379
|
-
Y(), J(), x &&
|
|
379
|
+
}, S = (t) => {
|
|
380
|
+
Y(), J(), x && e.dragContext && e.dragContext.endDrag(t), $ = null, x = !1;
|
|
380
381
|
};
|
|
381
382
|
de(() => {
|
|
382
|
-
|
|
383
|
+
e.registerRow(e.item.id, null), S(!1);
|
|
383
384
|
});
|
|
384
|
-
const
|
|
385
|
-
if (!
|
|
386
|
-
x = !0,
|
|
387
|
-
const u = o.getSelectedItemsList(), w = (u.length > 0 &&
|
|
388
|
-
item:
|
|
389
|
-
sourceInstanceId:
|
|
385
|
+
const N = (t, s) => {
|
|
386
|
+
if (!e.enableDragDrop || !e.dragContext || x) return;
|
|
387
|
+
x = !0, I() || o.selectItem(e.item.id, !1);
|
|
388
|
+
const u = o.getSelectedItemsList(), w = (u.length > 0 && I() ? u : [e.item]).map((T) => ({
|
|
389
|
+
item: T,
|
|
390
|
+
sourceInstanceId: e.instanceId,
|
|
390
391
|
sourcePath: o.currentPath()
|
|
391
392
|
}));
|
|
392
393
|
if (y() && "vibrate" in navigator)
|
|
@@ -394,83 +395,83 @@ function Ue(t) {
|
|
|
394
395
|
navigator.vibrate(50);
|
|
395
396
|
} catch {
|
|
396
397
|
}
|
|
397
|
-
|
|
398
|
-
}, q = (
|
|
399
|
-
if ($ !==
|
|
400
|
-
const s =
|
|
398
|
+
e.dragContext.startDrag(w, t, s);
|
|
399
|
+
}, q = (t) => {
|
|
400
|
+
if ($ !== t.pointerId) return;
|
|
401
|
+
const s = t.clientX - F, u = t.clientY - z, d = Math.sqrt(s * s + u * u);
|
|
401
402
|
if (y() && !x && d > 10) {
|
|
402
403
|
S(!1);
|
|
403
404
|
return;
|
|
404
405
|
}
|
|
405
|
-
!y() && !x && d > U &&
|
|
406
|
-
}, G = (
|
|
407
|
-
$ ===
|
|
408
|
-
}, V = (
|
|
409
|
-
$ ===
|
|
410
|
-
}, n = (
|
|
411
|
-
g =
|
|
412
|
-
$ !== null && !x &&
|
|
406
|
+
!y() && !x && d > U && N(t.clientX, t.clientY), x && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
|
|
407
|
+
}, G = (t) => {
|
|
408
|
+
$ === t.pointerId && (C.onPointerUp(), S(!0));
|
|
409
|
+
}, V = (t) => {
|
|
410
|
+
$ === t.pointerId && (C.onPointerCancel(), S(!1));
|
|
411
|
+
}, n = (t) => {
|
|
412
|
+
g = t.pointerType, C.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || ($ = t.pointerId, F = t.clientX, z = t.clientY, x = !1, L(), y() && (Y(), A = setTimeout(() => {
|
|
413
|
+
$ !== null && !x && N(F, z);
|
|
413
414
|
}, Q))));
|
|
414
|
-
}, i = (
|
|
415
|
-
g =
|
|
416
|
-
}, l = (
|
|
417
|
-
if (!H() || !
|
|
418
|
-
const s =
|
|
415
|
+
}, i = (t) => {
|
|
416
|
+
g = t.pointerType, C.onPointerMove(t);
|
|
417
|
+
}, l = (t) => {
|
|
418
|
+
if (!H() || !e.dragContext) return;
|
|
419
|
+
const s = e.dragContext.dragState();
|
|
419
420
|
if (!s.isDragging) return;
|
|
420
421
|
O(!0);
|
|
421
|
-
const u =
|
|
422
|
-
|
|
423
|
-
instanceId:
|
|
424
|
-
targetPath:
|
|
425
|
-
targetItem:
|
|
422
|
+
const u = e.dragContext.canDropOn(s.draggedItems, e.item.path, e.item, e.instanceId), w = t.currentTarget?.getBoundingClientRect() ?? null;
|
|
423
|
+
e.dragContext.setDropTarget({
|
|
424
|
+
instanceId: e.instanceId,
|
|
425
|
+
targetPath: e.item.path,
|
|
426
|
+
targetItem: e.item
|
|
426
427
|
}, u, w);
|
|
427
|
-
}, c = (
|
|
428
|
-
if (!
|
|
428
|
+
}, c = (t) => {
|
|
429
|
+
if (!e.dragContext) return;
|
|
429
430
|
O(!1);
|
|
430
|
-
const s =
|
|
431
|
-
s.isDragging && s.dropTarget?.targetPath ===
|
|
432
|
-
}, h = (
|
|
431
|
+
const s = e.dragContext.dragState();
|
|
432
|
+
s.isDragging && s.dropTarget?.targetPath === e.item.path && e.dragContext.setDropTarget(null, !1);
|
|
433
|
+
}, h = (t) => {
|
|
433
434
|
if (x) {
|
|
434
435
|
x = !1;
|
|
435
436
|
return;
|
|
436
437
|
}
|
|
437
|
-
if (!C.consumeClickSuppression(
|
|
438
|
+
if (!C.consumeClickSuppression(t)) {
|
|
438
439
|
if (y()) {
|
|
439
|
-
o.openItem(
|
|
440
|
+
o.openItem(e.item);
|
|
440
441
|
return;
|
|
441
442
|
}
|
|
442
|
-
if (
|
|
443
|
-
o.selectRangeTo(
|
|
443
|
+
if (t.shiftKey) {
|
|
444
|
+
o.selectRangeTo(e.item.id, ae(t));
|
|
444
445
|
return;
|
|
445
446
|
}
|
|
446
|
-
o.selectItem(
|
|
447
|
+
o.selectItem(e.item.id, ae(t));
|
|
447
448
|
}
|
|
448
449
|
}, v = () => {
|
|
449
|
-
y() || o.openItem(
|
|
450
|
-
}, b = (
|
|
451
|
-
if (
|
|
452
|
-
o.ensureContextMenuSelection(
|
|
453
|
-
const s = o.getSelectedItemsList(), u = s.length > 0 ? s : [
|
|
454
|
-
o.showContextMenu(
|
|
455
|
-
x:
|
|
456
|
-
y:
|
|
457
|
-
triggerItem:
|
|
450
|
+
y() || o.openItem(e.item);
|
|
451
|
+
}, b = (t) => {
|
|
452
|
+
if (t.preventDefault(), t.stopPropagation(), y()) return;
|
|
453
|
+
o.ensureContextMenuSelection(e.item.id);
|
|
454
|
+
const s = o.getSelectedItemsList(), u = s.length > 0 ? s : [e.item];
|
|
455
|
+
o.showContextMenu(Le({
|
|
456
|
+
x: t.clientX,
|
|
457
|
+
y: t.clientY,
|
|
458
|
+
triggerItem: e.item,
|
|
458
459
|
items: u,
|
|
459
460
|
source: "list"
|
|
460
461
|
}));
|
|
461
|
-
},
|
|
462
|
+
}, D = () => e.dragContext?.dragState(), a = () => D()?.isDragging ?? !1, r = () => j() && a() && H();
|
|
462
463
|
return (() => {
|
|
463
|
-
var
|
|
464
|
+
var t = Ve(), s = t.firstChild, u = s.firstChild;
|
|
464
465
|
return ee((d) => {
|
|
465
|
-
|
|
466
|
-
},
|
|
466
|
+
e.registerRow(e.item.id, d);
|
|
467
|
+
}, t), De(t, Ie({
|
|
467
468
|
get "data-file-browser-item-id"() {
|
|
468
|
-
return
|
|
469
|
+
return e.item.id;
|
|
469
470
|
},
|
|
470
471
|
get "data-file-browser-item-path"() {
|
|
471
|
-
return
|
|
472
|
+
return e.item.path;
|
|
472
473
|
}
|
|
473
|
-
},
|
|
474
|
+
}, Ee, {
|
|
474
475
|
onClick: h,
|
|
475
476
|
onDblClick: v,
|
|
476
477
|
onContextMenu: b,
|
|
@@ -484,7 +485,7 @@ function Ue(t) {
|
|
|
484
485
|
"transition-all duration-150 ease-out",
|
|
485
486
|
"hover:bg-accent/50",
|
|
486
487
|
"focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring",
|
|
487
|
-
|
|
488
|
+
I() && "bg-accent text-accent-foreground",
|
|
488
489
|
// Drag state styling - being dragged items become translucent
|
|
489
490
|
K() && "opacity-40 scale-[0.98]",
|
|
490
491
|
// Drop target styling - enhanced visual feedback
|
|
@@ -492,41 +493,49 @@ function Ue(t) {
|
|
|
492
493
|
r() && !X() && ["bg-destructive/10 outline outline-2 outline-dashed outline-destructive/50"]
|
|
493
494
|
);
|
|
494
495
|
}
|
|
495
|
-
}), !1, !0), f(u, m(
|
|
496
|
+
}), !1, !0), f(u, m(Re, {
|
|
496
497
|
get item() {
|
|
497
|
-
return
|
|
498
|
+
return e.item;
|
|
498
499
|
},
|
|
499
500
|
class: "w-4 h-4"
|
|
500
|
-
})), f(
|
|
501
|
+
}), null), f(u, m(Fe, {
|
|
502
|
+
get item() {
|
|
503
|
+
return e.item;
|
|
504
|
+
},
|
|
505
|
+
size: "xs"
|
|
506
|
+
}), null), f(s, m(Ue, {
|
|
501
507
|
get name() {
|
|
502
|
-
return
|
|
508
|
+
return e.item.name;
|
|
503
509
|
},
|
|
504
510
|
get match() {
|
|
505
511
|
return R();
|
|
512
|
+
},
|
|
513
|
+
get class() {
|
|
514
|
+
return Te(e.item);
|
|
506
515
|
}
|
|
507
|
-
}), null), f(
|
|
516
|
+
}), null), f(t, m(P, {
|
|
508
517
|
get when() {
|
|
509
|
-
return
|
|
518
|
+
return e.showModified;
|
|
510
519
|
},
|
|
511
520
|
get children() {
|
|
512
521
|
var d = se();
|
|
513
|
-
return f(d, () =>
|
|
522
|
+
return f(d, () => e.formatDate(e.item.modifiedAt)), k((w) => p(d, "width", `${e.modifiedWidthPx}px`)), d;
|
|
514
523
|
}
|
|
515
|
-
}), null), f(
|
|
524
|
+
}), null), f(t, m(P, {
|
|
516
525
|
get when() {
|
|
517
|
-
return
|
|
526
|
+
return e.showSize;
|
|
518
527
|
},
|
|
519
528
|
get children() {
|
|
520
529
|
var d = se();
|
|
521
530
|
return f(d, (() => {
|
|
522
|
-
var w = ce(() =>
|
|
523
|
-
return () => w() ? "-" :
|
|
524
|
-
})()),
|
|
531
|
+
var w = ce(() => e.item.type === "folder");
|
|
532
|
+
return () => w() ? "-" : e.formatSize(e.item.size);
|
|
533
|
+
})()), k((w) => p(d, "width", `${e.sizeWidthPx}px`)), d;
|
|
525
534
|
}
|
|
526
|
-
}), null),
|
|
535
|
+
}), null), t;
|
|
527
536
|
})();
|
|
528
537
|
}
|
|
529
|
-
|
|
538
|
+
Me(["click", "pointerdown"]);
|
|
530
539
|
export {
|
|
531
|
-
|
|
540
|
+
ft as FileListView
|
|
532
541
|
};
|