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