@floegence/floe-webapp-core 0.35.49 → 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 +64 -63
- package/dist/components/file-browser/FileListView.js +27 -26
- package/dist/components/file-browser/useFileBrowserMarqueeSelection.d.ts +23 -1
- package/dist/components/file-browser/useFileBrowserMarqueeSelection.js +79 -55
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ export type BuiltinContextMenuAction = Exclude<ContextMenuActionType, 'custom'>;
|
|
|
9
9
|
* - Dynamic function: decide which action types to hide based on the target items.
|
|
10
10
|
*/
|
|
11
11
|
export type HideItemsValue = BuiltinContextMenuAction[] | ((targetItems: FileItem[]) => BuiltinContextMenuAction[]);
|
|
12
|
+
type ContextMenuDismissWindow = Pick<Window, 'addEventListener' | 'removeEventListener'>;
|
|
12
13
|
export interface FileContextMenuProps {
|
|
13
14
|
/** Custom menu items to add (will be merged with defaults) */
|
|
14
15
|
customItems?: ContextMenuItem[];
|
|
@@ -30,7 +31,13 @@ export interface FileContextMenuProps {
|
|
|
30
31
|
}
|
|
31
32
|
export declare function createDefaultContextMenuItems(callbacks?: ContextMenuCallbacks): ContextMenuItem[];
|
|
32
33
|
export declare function dispatchContextMenuAction(item: ContextMenuItem, items: FileItem[], callbacks?: ContextMenuCallbacks, event?: ContextMenuEvent): void;
|
|
34
|
+
export declare function installContextMenuDismissListeners(options: {
|
|
35
|
+
ownerWindow: ContextMenuDismissWindow;
|
|
36
|
+
contextMenuId: string;
|
|
37
|
+
onDismiss: () => void;
|
|
38
|
+
}): () => void;
|
|
33
39
|
/**
|
|
34
40
|
* Context menu for file browser items
|
|
35
41
|
*/
|
|
36
42
|
export declare function FileContextMenu(props: FileContextMenuProps): import("solid-js").JSX.Element;
|
|
43
|
+
export {};
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { createComponent as c, Portal as
|
|
2
|
-
import { createSignal as B, createEffect as
|
|
1
|
+
import { createComponent as c, Portal as W, setAttribute as x, insert as C, effect as b, className as R, setStyleProperty as P, template as p, Dynamic as J, memo as V, use as L, delegateEvents as Q } from "solid-js/web";
|
|
2
|
+
import { createSignal as B, createEffect as z, onCleanup as Z, Show as $, For as O } from "solid-js";
|
|
3
3
|
import { cn as T } from "../../utils/cn.js";
|
|
4
4
|
import { deferAfterPaint as X } from "../../utils/defer.js";
|
|
5
5
|
import { ChevronRight as Y } from "../icons/index.js";
|
|
6
|
-
import { focusMenuItem as
|
|
6
|
+
import { focusMenuItem as _, moveMenuFocus as q, calculateSubmenuPosition as ee } from "../ui/menuUtils.js";
|
|
7
7
|
import { useFileBrowser as te } from "./FileBrowserContext.js";
|
|
8
|
-
var ne = /* @__PURE__ */
|
|
8
|
+
var ne = /* @__PURE__ */ p('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect width=14 height=14 x=8 y=8 rx=2 ry=2></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2">'), re = /* @__PURE__ */ p('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect width=14 height=16 x=5 y=4 rx=2></rect><path d="M9 4.5h6a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v.5a1 1 0 0 0 1 1Z">'), oe = /* @__PURE__ */ p('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3Z">'), ie = /* @__PURE__ */ p('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"></path><path d="M8 10v4"></path><path d="M12 10v2"></path><path d="M16 10v6">'), se = /* @__PURE__ */ p('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 3v18"></path><path d="m8 7-4 4 4 4"></path><path d="m16 7 4 4-4 4">'), ae = /* @__PURE__ */ p('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2">'), ue = /* @__PURE__ */ p('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"></path><path d="m15 5 4 4">'), le = /* @__PURE__ */ p('<span class="text-[10px] text-muted-foreground opacity-60">'), ce = /* @__PURE__ */ p("<div role=menu>"), de = /* @__PURE__ */ p('<div class=relative><button type=button role=menuitem><span class="flex-1 text-left">'), K = /* @__PURE__ */ p('<div class="my-1 h-px bg-border"role=separator>'), me = /* @__PURE__ */ p("<div role=menu aria-orientation=vertical>");
|
|
9
9
|
const he = (e) => (() => {
|
|
10
10
|
var t = ne();
|
|
11
|
-
return
|
|
11
|
+
return b(() => x(t, "class", e.class)), t;
|
|
12
12
|
})(), fe = (e) => (() => {
|
|
13
|
-
var t = oe();
|
|
14
|
-
return w(() => g(t, "class", e.class)), t;
|
|
15
|
-
})(), ve = (e) => (() => {
|
|
16
13
|
var t = re();
|
|
17
|
-
return
|
|
14
|
+
return b(() => x(t, "class", e.class)), t;
|
|
15
|
+
})(), ve = (e) => (() => {
|
|
16
|
+
var t = oe();
|
|
17
|
+
return b(() => x(t, "class", e.class)), t;
|
|
18
18
|
})(), ge = (e) => (() => {
|
|
19
19
|
var t = ie();
|
|
20
|
-
return
|
|
21
|
-
})(), we = (e) => (() => {
|
|
22
|
-
var t = ae();
|
|
23
|
-
return w(() => g(t, "class", e.class)), t;
|
|
20
|
+
return b(() => x(t, "class", e.class)), t;
|
|
24
21
|
})(), pe = (e) => (() => {
|
|
25
22
|
var t = se();
|
|
26
|
-
return
|
|
23
|
+
return b(() => x(t, "class", e.class)), t;
|
|
24
|
+
})(), we = (e) => (() => {
|
|
25
|
+
var t = ae();
|
|
26
|
+
return b(() => x(t, "class", e.class)), t;
|
|
27
27
|
})(), xe = (e) => (() => {
|
|
28
28
|
var t = ue();
|
|
29
|
-
return
|
|
29
|
+
return b(() => x(t, "class", e.class)), t;
|
|
30
30
|
})();
|
|
31
31
|
let ye = 0;
|
|
32
32
|
function be(e) {
|
|
33
|
-
const t = !!e?.onAskAgent,
|
|
33
|
+
const t = !!e?.onAskAgent, o = !!e?.onCopyName;
|
|
34
34
|
return [{
|
|
35
35
|
id: "duplicate",
|
|
36
36
|
label: "Duplicate",
|
|
37
37
|
type: "duplicate",
|
|
38
38
|
icon: he,
|
|
39
39
|
shortcut: "Cmd+D",
|
|
40
|
-
separator: !
|
|
41
|
-
}, ...
|
|
40
|
+
separator: !o && !t
|
|
41
|
+
}, ...o ? [{
|
|
42
42
|
id: "copy-name",
|
|
43
43
|
label: "Copy Name",
|
|
44
44
|
type: "copy-name",
|
|
@@ -59,7 +59,7 @@ function be(e) {
|
|
|
59
59
|
id: "move-to",
|
|
60
60
|
label: "Move to...",
|
|
61
61
|
type: "move-to",
|
|
62
|
-
icon:
|
|
62
|
+
icon: pe,
|
|
63
63
|
separator: !0
|
|
64
64
|
}, {
|
|
65
65
|
id: "rename",
|
|
@@ -71,52 +71,52 @@ function be(e) {
|
|
|
71
71
|
id: "delete",
|
|
72
72
|
label: "Delete",
|
|
73
73
|
type: "delete",
|
|
74
|
-
icon:
|
|
74
|
+
icon: we,
|
|
75
75
|
shortcut: "Del"
|
|
76
76
|
}];
|
|
77
77
|
}
|
|
78
|
-
function ke(e, t,
|
|
78
|
+
function ke(e, t, o, a) {
|
|
79
79
|
switch (e.type) {
|
|
80
80
|
case "duplicate":
|
|
81
|
-
|
|
81
|
+
o?.onDuplicate?.(t);
|
|
82
82
|
break;
|
|
83
83
|
case "copy-name":
|
|
84
|
-
|
|
84
|
+
o?.onCopyName?.(t);
|
|
85
85
|
break;
|
|
86
86
|
case "ask-agent":
|
|
87
|
-
|
|
87
|
+
o?.onAskAgent?.(t);
|
|
88
88
|
break;
|
|
89
89
|
case "copy-to":
|
|
90
|
-
|
|
90
|
+
o?.onCopyTo?.(t);
|
|
91
91
|
break;
|
|
92
92
|
case "move-to":
|
|
93
|
-
|
|
93
|
+
o?.onMoveTo?.(t);
|
|
94
94
|
break;
|
|
95
95
|
case "delete":
|
|
96
|
-
|
|
96
|
+
o?.onDelete?.(t);
|
|
97
97
|
break;
|
|
98
98
|
case "rename":
|
|
99
|
-
t.length === 1 &&
|
|
99
|
+
t.length === 1 && o?.onRename?.(t[0]);
|
|
100
100
|
break;
|
|
101
101
|
case "custom":
|
|
102
|
-
e.onAction?.(t,
|
|
102
|
+
e.onAction?.(t, a);
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
function U(e, t) {
|
|
107
|
-
const
|
|
107
|
+
const o = e.target, a = o?.closest('[role="menu"]'), m = o?.closest('[role="menuitem"]');
|
|
108
108
|
switch (e.key) {
|
|
109
109
|
case "ArrowDown":
|
|
110
|
-
e.preventDefault(),
|
|
110
|
+
e.preventDefault(), q(a, m, 1);
|
|
111
111
|
return;
|
|
112
112
|
case "ArrowUp":
|
|
113
|
-
e.preventDefault(),
|
|
113
|
+
e.preventDefault(), q(a, m, -1);
|
|
114
114
|
return;
|
|
115
115
|
case "Home":
|
|
116
|
-
e.preventDefault(),
|
|
116
|
+
e.preventDefault(), _(a, "first");
|
|
117
117
|
return;
|
|
118
118
|
case "End":
|
|
119
|
-
e.preventDefault(),
|
|
119
|
+
e.preventDefault(), _(a, "last");
|
|
120
120
|
return;
|
|
121
121
|
case "ArrowLeft":
|
|
122
122
|
if (!t.onCloseSubmenu) return;
|
|
@@ -136,92 +136,120 @@ function U(e, t) {
|
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
function Ce(e, t) {
|
|
140
|
+
return !e || typeof e != "object" ? !1 : ("dataset" in e ? e.dataset : void 0)?.floeContextMenu === t;
|
|
141
|
+
}
|
|
142
|
+
function Me(e, t) {
|
|
143
|
+
if (typeof e.composedPath == "function") {
|
|
144
|
+
const a = e.composedPath();
|
|
145
|
+
for (const m of a)
|
|
146
|
+
if (Ce(m, t)) return !0;
|
|
147
|
+
}
|
|
148
|
+
const o = e.target;
|
|
149
|
+
return typeof Element < "u" && o instanceof Element ? !!o.closest(`[data-floe-context-menu="${t}"]`) : !1;
|
|
150
|
+
}
|
|
151
|
+
function $e(e) {
|
|
152
|
+
const {
|
|
153
|
+
ownerWindow: t,
|
|
154
|
+
contextMenuId: o,
|
|
155
|
+
onDismiss: a
|
|
156
|
+
} = e, m = (w) => {
|
|
157
|
+
Me(w, o) || a();
|
|
158
|
+
}, y = (w) => {
|
|
159
|
+
w.key === "Escape" && a();
|
|
160
|
+
}, v = () => {
|
|
161
|
+
a();
|
|
162
|
+
};
|
|
163
|
+
return t.addEventListener("pointerdown", m, !0), t.addEventListener("keydown", y, !0), t.addEventListener("resize", v), t.addEventListener("scroll", v, !0), () => {
|
|
164
|
+
t.removeEventListener("pointerdown", m, !0), t.removeEventListener("keydown", y, !0), t.removeEventListener("resize", v), t.removeEventListener("scroll", v, !0);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
139
167
|
function G(e) {
|
|
140
|
-
const [t,
|
|
168
|
+
const [t, o] = B(!1), [a, m] = B({
|
|
141
169
|
x: -9999,
|
|
142
170
|
y: -9999
|
|
143
171
|
});
|
|
144
|
-
let
|
|
145
|
-
const
|
|
146
|
-
if (!
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
},
|
|
172
|
+
let y, v, w, M;
|
|
173
|
+
const h = () => (e.item.children?.length ?? 0) > 0, S = () => {
|
|
174
|
+
if (!y || !w) return;
|
|
175
|
+
const u = y.getBoundingClientRect(), d = w.getBoundingClientRect(), A = ee(u, d);
|
|
176
|
+
m(A);
|
|
177
|
+
}, i = () => {
|
|
150
178
|
M && (clearTimeout(M), M = void 0);
|
|
151
|
-
},
|
|
152
|
-
!
|
|
153
|
-
|
|
179
|
+
}, n = (u = "first") => {
|
|
180
|
+
!h() || e.item.disabled || (i(), o(!0), requestAnimationFrame(() => {
|
|
181
|
+
S(), _(w, u);
|
|
154
182
|
}));
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
!
|
|
159
|
-
|
|
183
|
+
}, f = () => {
|
|
184
|
+
i(), o(!1), requestAnimationFrame(() => v?.focus());
|
|
185
|
+
}, s = () => {
|
|
186
|
+
!h() || e.item.disabled || (i(), M = setTimeout(() => {
|
|
187
|
+
n("first");
|
|
160
188
|
}, 100));
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
|
|
189
|
+
}, g = () => {
|
|
190
|
+
h() && (i(), M = setTimeout(() => {
|
|
191
|
+
o(!1);
|
|
164
192
|
}, 150));
|
|
165
|
-
},
|
|
193
|
+
}, k = (u) => {
|
|
166
194
|
if (!e.item.disabled) {
|
|
167
|
-
if (
|
|
168
|
-
|
|
195
|
+
if (h()) {
|
|
196
|
+
u.preventDefault(), u.stopPropagation(), t() ? f() : n("first");
|
|
169
197
|
return;
|
|
170
198
|
}
|
|
171
199
|
e.onSelect(e.item, e.menu);
|
|
172
200
|
}
|
|
173
201
|
};
|
|
174
|
-
return
|
|
175
|
-
|
|
202
|
+
return Z(() => {
|
|
203
|
+
i();
|
|
176
204
|
}), (() => {
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
var j =
|
|
180
|
-
typeof j == "function" ?
|
|
181
|
-
e.item.disabled || !
|
|
182
|
-
},
|
|
183
|
-
var F =
|
|
184
|
-
return typeof F == "function" ?
|
|
205
|
+
var u = de(), d = u.firstChild, A = d.firstChild;
|
|
206
|
+
u.addEventListener("mouseleave", g), u.addEventListener("mouseenter", s);
|
|
207
|
+
var j = y;
|
|
208
|
+
typeof j == "function" ? L(j, u) : y = u, d.$$keydown = (r) => {
|
|
209
|
+
e.item.disabled || !h() || (r.key === "ArrowRight" || r.key === "Enter" || r.key === " ") && (r.preventDefault(), n("first"));
|
|
210
|
+
}, d.$$click = k;
|
|
211
|
+
var F = v;
|
|
212
|
+
return typeof F == "function" ? L(F, d) : v = d, C(d, c($, {
|
|
185
213
|
get when() {
|
|
186
214
|
return e.item.icon;
|
|
187
215
|
},
|
|
188
|
-
children: (
|
|
216
|
+
children: (r) => c(J, {
|
|
189
217
|
get component() {
|
|
190
|
-
return
|
|
218
|
+
return r();
|
|
191
219
|
},
|
|
192
220
|
class: "w-3.5 h-3.5 opacity-60"
|
|
193
221
|
})
|
|
194
|
-
}), A),
|
|
222
|
+
}), A), C(A, () => e.item.label), C(d, c($, {
|
|
195
223
|
get when() {
|
|
196
|
-
return V(() => !!e.item.shortcut)() && !
|
|
224
|
+
return V(() => !!e.item.shortcut)() && !h();
|
|
197
225
|
},
|
|
198
226
|
get children() {
|
|
199
|
-
var
|
|
200
|
-
return
|
|
227
|
+
var r = le();
|
|
228
|
+
return C(r, () => e.item.shortcut), r;
|
|
201
229
|
}
|
|
202
|
-
}), null),
|
|
230
|
+
}), null), C(d, c($, {
|
|
203
231
|
get when() {
|
|
204
|
-
return
|
|
232
|
+
return h();
|
|
205
233
|
},
|
|
206
234
|
get children() {
|
|
207
235
|
return c(Y, {
|
|
208
236
|
class: "w-3 h-3 text-muted-foreground"
|
|
209
237
|
});
|
|
210
238
|
}
|
|
211
|
-
}), null),
|
|
239
|
+
}), null), C(u, c($, {
|
|
212
240
|
get when() {
|
|
213
|
-
return V(() => !!t())() &&
|
|
241
|
+
return V(() => !!t())() && h();
|
|
214
242
|
},
|
|
215
243
|
get children() {
|
|
216
|
-
return c(
|
|
244
|
+
return c(W, {
|
|
217
245
|
get children() {
|
|
218
|
-
var
|
|
219
|
-
|
|
246
|
+
var r = ce();
|
|
247
|
+
r.$$keydown = (l) => U(l, {
|
|
220
248
|
onDismiss: e.onDismiss,
|
|
221
|
-
onCloseSubmenu:
|
|
222
|
-
}),
|
|
223
|
-
var D =
|
|
224
|
-
return typeof D == "function" ?
|
|
249
|
+
onCloseSubmenu: f
|
|
250
|
+
}), r.addEventListener("mouseleave", g), r.addEventListener("mouseenter", i);
|
|
251
|
+
var D = w;
|
|
252
|
+
return typeof D == "function" ? L(D, r) : w = r, C(r, c(O, {
|
|
225
253
|
get each() {
|
|
226
254
|
return e.item.children;
|
|
227
255
|
},
|
|
@@ -247,131 +275,130 @@ function G(e) {
|
|
|
247
275
|
return K();
|
|
248
276
|
}
|
|
249
277
|
})]
|
|
250
|
-
})),
|
|
251
|
-
var I = T("fixed z-50 min-w-[180px] py-1", "bg-popover border border-border rounded-lg shadow-lg", "animate-in fade-in slide-in-from-left-1"),
|
|
252
|
-
return I !== l.e && R(
|
|
278
|
+
})), b((l) => {
|
|
279
|
+
var I = T("fixed z-50 min-w-[180px] py-1", "bg-popover border border-border rounded-lg shadow-lg", "animate-in fade-in slide-in-from-left-1"), E = e.contextMenuId, H = `${a().x}px`, N = `${a().y}px`;
|
|
280
|
+
return I !== l.e && R(r, l.e = I), E !== l.t && x(r, "data-floe-context-menu", l.t = E), H !== l.a && P(r, "left", l.a = H), N !== l.o && P(r, "top", l.o = N), l;
|
|
253
281
|
}, {
|
|
254
282
|
e: void 0,
|
|
255
283
|
t: void 0,
|
|
256
284
|
a: void 0,
|
|
257
285
|
o: void 0
|
|
258
|
-
}),
|
|
286
|
+
}), r;
|
|
259
287
|
}
|
|
260
288
|
});
|
|
261
289
|
}
|
|
262
|
-
}), null),
|
|
263
|
-
var D = e.item.disabled || !
|
|
264
|
-
return D !==
|
|
290
|
+
}), null), b((r) => {
|
|
291
|
+
var D = e.item.disabled || !h() && e.item.type === "rename" && e.menu.items.length > 1, l = T("w-full flex items-center gap-2 px-3 py-1.5 text-xs cursor-pointer", "transition-colors duration-75", "hover:bg-accent hover:text-accent-foreground", "focus:outline-none focus-visible:bg-accent focus-visible:text-accent-foreground", "disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent", e.item.type === "delete" && "text-error hover:bg-error/10 hover:text-error"), I = h() ? "menu" : void 0, E = h() ? t() : void 0;
|
|
292
|
+
return D !== r.e && (d.disabled = r.e = D), l !== r.t && R(d, r.t = l), I !== r.a && x(d, "aria-haspopup", r.a = I), E !== r.o && x(d, "aria-expanded", r.o = E), r;
|
|
265
293
|
}, {
|
|
266
294
|
e: void 0,
|
|
267
295
|
t: void 0,
|
|
268
296
|
a: void 0,
|
|
269
297
|
o: void 0
|
|
270
|
-
}),
|
|
298
|
+
}), u;
|
|
271
299
|
})();
|
|
272
300
|
}
|
|
273
|
-
function
|
|
301
|
+
function _e(e) {
|
|
274
302
|
const t = te();
|
|
275
|
-
let
|
|
276
|
-
const
|
|
303
|
+
let o;
|
|
304
|
+
const a = typeof window > "u" || typeof document > "u", m = `floe-context-menu-${ye += 1}`, [y, v] = B({
|
|
277
305
|
x: -9999,
|
|
278
306
|
y: -9999
|
|
279
|
-
}),
|
|
307
|
+
}), w = () => {
|
|
280
308
|
if (e.overrideItems)
|
|
281
309
|
return e.overrideItems;
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
if (!
|
|
285
|
-
if (typeof
|
|
286
|
-
const
|
|
287
|
-
return
|
|
310
|
+
const i = () => {
|
|
311
|
+
const s = e.hideItems;
|
|
312
|
+
if (!s) return [];
|
|
313
|
+
if (typeof s == "function") {
|
|
314
|
+
const g = t.contextMenu()?.items ?? [];
|
|
315
|
+
return s(g);
|
|
288
316
|
}
|
|
289
|
-
return
|
|
317
|
+
return s;
|
|
290
318
|
};
|
|
291
319
|
let n = be(e.callbacks);
|
|
292
|
-
const
|
|
293
|
-
return
|
|
294
|
-
}, M = (
|
|
320
|
+
const f = i();
|
|
321
|
+
return f.length > 0 && (n = n.filter((s) => !f.includes(s.type))), e.customItems?.length && (n = [...n, ...e.customItems]), n;
|
|
322
|
+
}, M = (i, n) => {
|
|
295
323
|
t.hideContextMenu();
|
|
296
|
-
const
|
|
324
|
+
const f = [...n.items], s = e.callbacks;
|
|
297
325
|
X(() => {
|
|
298
|
-
ke(
|
|
326
|
+
ke(i, f, s, n);
|
|
299
327
|
});
|
|
300
|
-
},
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (!r || !a) return {
|
|
306
|
-
x: r?.x ?? 0,
|
|
307
|
-
y: r?.y ?? 0
|
|
328
|
+
}, h = () => {
|
|
329
|
+
const i = t.contextMenu();
|
|
330
|
+
if (!i || !o) return {
|
|
331
|
+
x: i?.x ?? 0,
|
|
332
|
+
y: i?.y ?? 0
|
|
308
333
|
};
|
|
309
|
-
const n =
|
|
310
|
-
let
|
|
334
|
+
const n = o.getBoundingClientRect(), f = window.innerWidth, s = window.innerHeight;
|
|
335
|
+
let g = i.x, k = i.y;
|
|
311
336
|
return n.width === 0 || n.height === 0 ? {
|
|
312
|
-
x:
|
|
313
|
-
y:
|
|
314
|
-
} : (
|
|
315
|
-
x: Math.max(8,
|
|
316
|
-
y: Math.max(8,
|
|
337
|
+
x: g,
|
|
338
|
+
y: k
|
|
339
|
+
} : (g + n.width > f && (g = f - n.width - 8), k + n.height > s && (k = s - n.height - 8), {
|
|
340
|
+
x: Math.max(8, g),
|
|
341
|
+
y: Math.max(8, k)
|
|
317
342
|
});
|
|
318
343
|
};
|
|
319
|
-
|
|
320
|
-
if (!t.contextMenu()) return;
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
344
|
+
z(() => {
|
|
345
|
+
if (a || !t.contextMenu()) return;
|
|
346
|
+
const i = $e({
|
|
347
|
+
ownerWindow: window,
|
|
348
|
+
contextMenuId: m,
|
|
349
|
+
onDismiss: t.hideContextMenu
|
|
350
|
+
});
|
|
351
|
+
Z(() => {
|
|
352
|
+
i();
|
|
326
353
|
});
|
|
327
|
-
}),
|
|
328
|
-
const
|
|
329
|
-
if (!
|
|
330
|
-
|
|
354
|
+
}), z(() => {
|
|
355
|
+
const i = t.contextMenu();
|
|
356
|
+
if (!i) {
|
|
357
|
+
v({
|
|
331
358
|
x: -9999,
|
|
332
359
|
y: -9999
|
|
333
360
|
});
|
|
334
361
|
return;
|
|
335
362
|
}
|
|
336
|
-
|
|
337
|
-
x:
|
|
338
|
-
y:
|
|
363
|
+
v({
|
|
364
|
+
x: i.x,
|
|
365
|
+
y: i.y
|
|
339
366
|
}), requestAnimationFrame(() => {
|
|
340
|
-
const n =
|
|
341
|
-
|
|
367
|
+
const n = h();
|
|
368
|
+
v(n), _(o, "first");
|
|
342
369
|
});
|
|
343
370
|
});
|
|
344
|
-
const
|
|
371
|
+
const S = (i) => (() => {
|
|
345
372
|
var n = me();
|
|
346
|
-
n.$$keydown = (
|
|
373
|
+
n.$$keydown = (s) => U(s, {
|
|
347
374
|
onDismiss: t.hideContextMenu
|
|
348
375
|
});
|
|
349
|
-
var
|
|
350
|
-
return typeof
|
|
376
|
+
var f = o;
|
|
377
|
+
return typeof f == "function" ? L(f, n) : o = n, x(n, "data-floe-context-menu", m), C(n, c(O, {
|
|
351
378
|
get each() {
|
|
352
|
-
return
|
|
379
|
+
return w();
|
|
353
380
|
},
|
|
354
|
-
children: (
|
|
355
|
-
item:
|
|
381
|
+
children: (s) => [c(G, {
|
|
382
|
+
item: s,
|
|
356
383
|
get menu() {
|
|
357
|
-
return
|
|
384
|
+
return i.menu();
|
|
358
385
|
},
|
|
359
|
-
contextMenuId:
|
|
386
|
+
contextMenuId: m,
|
|
360
387
|
onSelect: M,
|
|
361
388
|
get onDismiss() {
|
|
362
389
|
return t.hideContextMenu;
|
|
363
390
|
}
|
|
364
391
|
}), c($, {
|
|
365
392
|
get when() {
|
|
366
|
-
return
|
|
393
|
+
return s.separator;
|
|
367
394
|
},
|
|
368
395
|
get children() {
|
|
369
396
|
return K();
|
|
370
397
|
}
|
|
371
398
|
})]
|
|
372
|
-
})),
|
|
373
|
-
var
|
|
374
|
-
return
|
|
399
|
+
})), b((s) => {
|
|
400
|
+
var g = T("fixed z-50 min-w-[180px] py-1", "bg-popover border border-border rounded-lg shadow-lg", "animate-in fade-in zoom-in-95 duration-100"), k = `${y().x}px`, u = `${y().y}px`;
|
|
401
|
+
return g !== s.e && R(n, s.e = g), k !== s.t && P(n, "left", s.t = k), u !== s.a && P(n, "top", s.a = u), s;
|
|
375
402
|
}, {
|
|
376
403
|
e: void 0,
|
|
377
404
|
t: void 0,
|
|
@@ -382,12 +409,12 @@ function Ee(e) {
|
|
|
382
409
|
get when() {
|
|
383
410
|
return t.contextMenu();
|
|
384
411
|
},
|
|
385
|
-
children: (
|
|
386
|
-
menu:
|
|
387
|
-
}) : c(
|
|
412
|
+
children: (i) => a ? c(S, {
|
|
413
|
+
menu: i
|
|
414
|
+
}) : c(W, {
|
|
388
415
|
get children() {
|
|
389
|
-
return c(
|
|
390
|
-
menu:
|
|
416
|
+
return c(S, {
|
|
417
|
+
menu: i
|
|
391
418
|
});
|
|
392
419
|
}
|
|
393
420
|
})
|
|
@@ -395,7 +422,8 @@ function Ee(e) {
|
|
|
395
422
|
}
|
|
396
423
|
Q(["click", "keydown"]);
|
|
397
424
|
export {
|
|
398
|
-
|
|
425
|
+
_e as FileContextMenu,
|
|
399
426
|
be as createDefaultContextMenuItems,
|
|
400
|
-
ke as dispatchContextMenuAction
|
|
427
|
+
ke as dispatchContextMenuAction,
|
|
428
|
+
$e as installContextMenuDismissListeners
|
|
401
429
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { addEventListener as te, use as z, insert as
|
|
1
|
+
import { addEventListener as te, use as z, insert as S, createComponent as D, effect as N, setStyleProperty as Y, className as p, style as ue, template as y, spread as ge, mergeProps as me, memo as fe, delegateEvents as he } from "solid-js/web";
|
|
2
2
|
import { createSignal as ie, createMemo as W, createEffect as ne, onCleanup as oe, Show as q, For as ae, untrack as ve } from "solid-js";
|
|
3
|
-
import { cn as
|
|
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";
|
|
@@ -8,11 +8,11 @@ import { useFileBrowserDrag as we } from "../../context/FileBrowserDragContext.j
|
|
|
8
8
|
import { FileItemIcon as be } from "./FileIcons.js";
|
|
9
9
|
import { createLongPressContextMenuHandlers as Ce } from "./longPressContextMenu.js";
|
|
10
10
|
import { fileBrowserTouchTargetAttrs as De } from "./touchInteractionGuard.js";
|
|
11
|
-
import { createItemContextMenuEvent as
|
|
12
|
-
import { createFileBrowserMarqueeSelection as
|
|
11
|
+
import { createItemContextMenuEvent as ye } from "./contextMenuEvent.js";
|
|
12
|
+
import { createFileBrowserMarqueeSelection as Se, FILE_BROWSER_MARQUEE_OVERLAY_CLASS as Me } from "./useFileBrowserMarqueeSelection.js";
|
|
13
13
|
import { isPrimaryModKeyPressed as re } from "../../utils/keybind.js";
|
|
14
|
-
var Te = /* @__PURE__ */
|
|
15
|
-
function
|
|
14
|
+
var Te = /* @__PURE__ */ y('<mark class="bg-warning/40 text-inherit rounded-sm">'), Pe = /* @__PURE__ */ y('<div class="grid gap-2">'), _e = /* @__PURE__ */ y('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), Ee = /* @__PURE__ */ y('<span>No files matching "<!>"'), Fe = /* @__PURE__ */ y('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), Le = /* @__PURE__ */ y('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), Re = /* @__PURE__ */ y("<span>This folder is empty"), $e = /* @__PURE__ */ y("<div>"), ke = /* @__PURE__ */ y('<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">'), Ae = /* @__PURE__ */ y("<button type=button><div></div><span></span><div>");
|
|
15
|
+
function He(e) {
|
|
16
16
|
const r = W(() => {
|
|
17
17
|
if (!e.match || e.match.matchedIndices.length === 0)
|
|
18
18
|
return [{
|
|
@@ -20,17 +20,17 @@ function pe(e) {
|
|
|
20
20
|
highlight: !1
|
|
21
21
|
}];
|
|
22
22
|
const s = [], M = new Set(e.match.matchedIndices);
|
|
23
|
-
let C = "",
|
|
23
|
+
let C = "", m = !1;
|
|
24
24
|
for (let d = 0; d < e.name.length; d++) {
|
|
25
25
|
const v = M.has(d);
|
|
26
|
-
d === 0 ? (
|
|
26
|
+
d === 0 ? (m = v, C = e.name[d]) : v === m ? C += e.name[d] : (s.push({
|
|
27
27
|
text: C,
|
|
28
|
-
highlight:
|
|
29
|
-
}), C = e.name[d],
|
|
28
|
+
highlight: m
|
|
29
|
+
}), C = e.name[d], m = v);
|
|
30
30
|
}
|
|
31
31
|
return C && s.push({
|
|
32
32
|
text: C,
|
|
33
|
-
highlight:
|
|
33
|
+
highlight: m
|
|
34
34
|
}), s;
|
|
35
35
|
});
|
|
36
36
|
return D(ae, {
|
|
@@ -46,47 +46,47 @@ function pe(e) {
|
|
|
46
46
|
},
|
|
47
47
|
get children() {
|
|
48
48
|
var M = Te();
|
|
49
|
-
return
|
|
49
|
+
return S(M, () => s.text), M;
|
|
50
50
|
}
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
function Ke(e) {
|
|
55
|
-
const r = le(), s = we(), M = () => (e.enableDragDrop ?? !0) && !!s, C = () => e.instanceId ?? "default",
|
|
55
|
+
const r = le(), s = we(), M = () => (e.enableDragDrop ?? !0) && !!s, C = () => e.instanceId ?? "default", m = 112, d = 8, v = 180, T = 2, R = 6, [f, V] = ie(null), U = xe(f), x = W(() => {
|
|
56
56
|
const n = U()?.width ?? 0;
|
|
57
57
|
if (n <= 0) return T;
|
|
58
58
|
const l = Math.floor((n + d) / (v + d));
|
|
59
59
|
return Math.max(T, Math.min(R, l));
|
|
60
|
-
}), F = () =>
|
|
60
|
+
}), F = () => m + d, c = Ie({
|
|
61
61
|
count: () => Math.ceil(r.currentFiles().length / Math.max(1, x())),
|
|
62
62
|
itemSize: F,
|
|
63
63
|
overscan: 2
|
|
64
|
-
}), Q = () => c.range().start * x(), $ = () => Math.min(r.currentFiles().length, c.range().end * x()), k = W(() => r.currentFiles().slice(Q(), $())), P = /* @__PURE__ */ new Map(),
|
|
64
|
+
}), Q = () => c.range().start * x(), $ = () => Math.min(r.currentFiles().length, c.range().end * x()), k = W(() => r.currentFiles().slice(Q(), $())), P = /* @__PURE__ */ new Map(), O = (n, l) => {
|
|
65
65
|
if (l) {
|
|
66
66
|
P.set(n, l);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
P.delete(n);
|
|
70
70
|
};
|
|
71
|
-
let
|
|
71
|
+
let g = null, L = T, I = 0;
|
|
72
72
|
ne(() => {
|
|
73
73
|
const n = x();
|
|
74
|
-
if (!
|
|
74
|
+
if (!g) {
|
|
75
75
|
L = n;
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
if (n === L) return;
|
|
79
|
-
const l = F(), o = Math.floor(
|
|
80
|
-
|
|
79
|
+
const l = F(), o = Math.floor(g.scrollTop / Math.max(1, l)) * Math.max(1, L), i = Math.floor(o / Math.max(1, n));
|
|
80
|
+
g.scrollTop = i * l, c.onScroll(), L = n;
|
|
81
81
|
});
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
const b = Math.floor(n / Math.max(1, x())) * F(), o = b + F(), i =
|
|
82
|
+
const B = (n) => {
|
|
83
|
+
if (!g) return;
|
|
84
|
+
const b = Math.floor(n / Math.max(1, x())) * F(), o = b + F(), i = g.scrollTop, w = i + g.clientHeight;
|
|
85
85
|
if (b < i) {
|
|
86
|
-
|
|
86
|
+
g.scrollTop = b, c.onScroll();
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
o > w && (
|
|
89
|
+
o > w && (g.scrollTop = Math.max(0, o - g.clientHeight), c.onScroll());
|
|
90
90
|
};
|
|
91
91
|
ne(() => {
|
|
92
92
|
const n = r.revealRequest(), l = r.currentFiles();
|
|
@@ -94,7 +94,7 @@ function Ke(e) {
|
|
|
94
94
|
const b = l.findIndex((w) => w.id === n.targetId);
|
|
95
95
|
if (b < 0) return;
|
|
96
96
|
if (!P.get(n.targetId)) {
|
|
97
|
-
|
|
97
|
+
B(b);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
typeof cancelAnimationFrame == "function" && I && (cancelAnimationFrame(I), I = 0);
|
|
@@ -114,8 +114,9 @@ function Ke(e) {
|
|
|
114
114
|
}), oe(() => {
|
|
115
115
|
typeof cancelAnimationFrame == "function" && I && cancelAnimationFrame(I);
|
|
116
116
|
});
|
|
117
|
-
const A =
|
|
118
|
-
getContainer: () =>
|
|
117
|
+
const A = Se({
|
|
118
|
+
getContainer: () => g,
|
|
119
|
+
getOverlayHost: () => g,
|
|
119
120
|
getVisibleItemIdsInOrder: () => r.currentFiles().map((n) => n.id),
|
|
120
121
|
getElementForId: (n) => P.get(n) ?? null,
|
|
121
122
|
getSelectedIds: () => [...r.selectedItems()],
|
|
@@ -125,15 +126,15 @@ function Ke(e) {
|
|
|
125
126
|
return (() => {
|
|
126
127
|
var n = _e(), l = n.firstChild, b = l.firstChild;
|
|
127
128
|
return te(n, "pointerdown", A.onPointerDown, !0), te(n, "scroll", c.onScroll), z((o) => {
|
|
128
|
-
|
|
129
|
-
}, n), z((o) => V(o), b),
|
|
129
|
+
g = o, c.scrollRef(o), r.setScrollContainer(o);
|
|
130
|
+
}, n), z((o) => V(o), b), S(l, D(q, {
|
|
130
131
|
get when() {
|
|
131
132
|
return r.currentFiles().length > 0;
|
|
132
133
|
},
|
|
133
134
|
get fallback() {
|
|
134
135
|
return (() => {
|
|
135
136
|
var o = Le();
|
|
136
|
-
return
|
|
137
|
+
return S(o, D(q, {
|
|
137
138
|
get when() {
|
|
138
139
|
return r.filterQueryApplied().trim();
|
|
139
140
|
},
|
|
@@ -143,7 +144,7 @@ function Ke(e) {
|
|
|
143
144
|
get children() {
|
|
144
145
|
return [(() => {
|
|
145
146
|
var i = Ee(), w = i.firstChild, _ = w.nextSibling;
|
|
146
|
-
return _.nextSibling,
|
|
147
|
+
return _.nextSibling, S(i, () => r.filterQueryApplied(), _), i;
|
|
147
148
|
})(), (() => {
|
|
148
149
|
var i = Fe();
|
|
149
150
|
return i.$$click = () => r.setFilterQuery(""), i;
|
|
@@ -154,11 +155,11 @@ function Ke(e) {
|
|
|
154
155
|
},
|
|
155
156
|
get children() {
|
|
156
157
|
var o = Pe();
|
|
157
|
-
return
|
|
158
|
+
return S(o, D(ae, {
|
|
158
159
|
get each() {
|
|
159
160
|
return k();
|
|
160
161
|
},
|
|
161
|
-
children: (i) => D(
|
|
162
|
+
children: (i) => D(pe, {
|
|
162
163
|
item: i,
|
|
163
164
|
get instanceId() {
|
|
164
165
|
return C();
|
|
@@ -167,7 +168,7 @@ function Ke(e) {
|
|
|
167
168
|
return M();
|
|
168
169
|
},
|
|
169
170
|
dragContext: s,
|
|
170
|
-
registerTile:
|
|
171
|
+
registerTile: O
|
|
171
172
|
})
|
|
172
173
|
})), N((i) => {
|
|
173
174
|
var w = `repeat(${x()}, minmax(0, 1fr))`, _ = `${c.paddingTop()}px`, X = `${c.paddingBottom()}px`;
|
|
@@ -178,22 +179,22 @@ function Ke(e) {
|
|
|
178
179
|
a: void 0
|
|
179
180
|
}), o;
|
|
180
181
|
}
|
|
181
|
-
}), null),
|
|
182
|
+
}), null), S(l, D(q, {
|
|
182
183
|
get when() {
|
|
183
184
|
return A.overlayStyle();
|
|
184
185
|
},
|
|
185
186
|
children: (o) => (() => {
|
|
186
187
|
var i = $e();
|
|
187
|
-
return
|
|
188
|
+
return p(i, Me), N((w) => ue(i, o(), w)), i;
|
|
188
189
|
})()
|
|
189
|
-
}), null), N(() =>
|
|
190
|
+
}), null), N(() => p(n, H("relative h-full min-h-0 overflow-auto", e.class))), n;
|
|
190
191
|
})();
|
|
191
192
|
}
|
|
192
|
-
function
|
|
193
|
-
const r = le(), s = () => r.isSelected(e.item.id), M = () => r.getFilterMatchForId(e.item.id), C = ve(() => e.item),
|
|
193
|
+
function pe(e) {
|
|
194
|
+
const r = le(), s = () => r.isSelected(e.item.id), M = () => r.getFilterMatchForId(e.item.id), C = ve(() => e.item), m = Ce(r, C, {
|
|
194
195
|
source: "grid"
|
|
195
196
|
});
|
|
196
|
-
let d, v = null, T = 0, R = 0,
|
|
197
|
+
let d, v = null, T = 0, R = 0, f = !1;
|
|
197
198
|
const V = 5, U = 500;
|
|
198
199
|
let x = null;
|
|
199
200
|
const [F, j] = ie(!1), c = () => d === "touch" || d === "pen", Q = () => e.item.type === "folder", $ = () => Q() && e.enableDragDrop && e.dragContext, k = () => {
|
|
@@ -204,21 +205,21 @@ function He(e) {
|
|
|
204
205
|
if (!e.dragContext) return !1;
|
|
205
206
|
const t = e.dragContext.dragState();
|
|
206
207
|
return t.isDragging ? t.draggedItems.some((a) => a.item.id === e.item.id) : !1;
|
|
207
|
-
},
|
|
208
|
+
}, O = () => {
|
|
208
209
|
x !== null && (clearTimeout(x), x = null);
|
|
209
|
-
},
|
|
210
|
+
}, g = () => {
|
|
210
211
|
typeof document > "u" || (document.removeEventListener("pointermove", A, !0), document.removeEventListener("pointerup", n, !0), document.removeEventListener("pointercancel", l, !0));
|
|
211
212
|
}, L = () => {
|
|
212
213
|
typeof document > "u" || (document.addEventListener("pointermove", A, !0), document.addEventListener("pointerup", n, !0), document.addEventListener("pointercancel", l, !0));
|
|
213
214
|
}, I = (t) => {
|
|
214
|
-
|
|
215
|
+
O(), g(), f && e.dragContext && e.dragContext.endDrag(t), v = null, f = !1;
|
|
215
216
|
};
|
|
216
217
|
oe(() => {
|
|
217
218
|
e.registerTile(e.item.id, null), I(!1);
|
|
218
219
|
});
|
|
219
|
-
const
|
|
220
|
-
if (!e.enableDragDrop || !e.dragContext ||
|
|
221
|
-
|
|
220
|
+
const B = (t, a) => {
|
|
221
|
+
if (!e.enableDragDrop || !e.dragContext || f) return;
|
|
222
|
+
f = !0, s() || r.selectItem(e.item.id, !1);
|
|
222
223
|
const h = r.getSelectedItemsList(), u = (h.length > 0 && s() ? h : [e.item]).map((G) => ({
|
|
223
224
|
item: G,
|
|
224
225
|
sourceInstanceId: e.instanceId,
|
|
@@ -233,21 +234,21 @@ function He(e) {
|
|
|
233
234
|
}, A = (t) => {
|
|
234
235
|
if (v !== t.pointerId) return;
|
|
235
236
|
const a = t.clientX - T, h = t.clientY - R, E = Math.sqrt(a * a + h * h);
|
|
236
|
-
if (c() && !
|
|
237
|
+
if (c() && !f && E > 10) {
|
|
237
238
|
I(!1);
|
|
238
239
|
return;
|
|
239
240
|
}
|
|
240
|
-
!c() && !
|
|
241
|
+
!c() && !f && E > V && B(t.clientX, t.clientY), f && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
|
|
241
242
|
}, n = (t) => {
|
|
242
|
-
v === t.pointerId && (
|
|
243
|
+
v === t.pointerId && (m.onPointerUp(), I(!0));
|
|
243
244
|
}, l = (t) => {
|
|
244
|
-
v === t.pointerId && (
|
|
245
|
+
v === t.pointerId && (m.onPointerCancel(), I(!1));
|
|
245
246
|
}, b = (t) => {
|
|
246
|
-
d = t.pointerType,
|
|
247
|
-
v !== null && !
|
|
247
|
+
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 && B(T, R);
|
|
248
249
|
}, U))));
|
|
249
250
|
}, o = (t) => {
|
|
250
|
-
d = t.pointerType,
|
|
251
|
+
d = t.pointerType, m.onPointerMove(t);
|
|
251
252
|
}, i = (t) => {
|
|
252
253
|
if (!$() || !e.dragContext) return;
|
|
253
254
|
const a = e.dragContext.dragState();
|
|
@@ -265,11 +266,11 @@ function He(e) {
|
|
|
265
266
|
const a = e.dragContext.dragState();
|
|
266
267
|
a.isDragging && a.dropTarget?.targetPath === e.item.path && e.dragContext.setDropTarget(null, !1);
|
|
267
268
|
}, _ = (t) => {
|
|
268
|
-
if (
|
|
269
|
-
|
|
269
|
+
if (f) {
|
|
270
|
+
f = !1;
|
|
270
271
|
return;
|
|
271
272
|
}
|
|
272
|
-
if (!
|
|
273
|
+
if (!m.consumeClickSuppression(t)) {
|
|
273
274
|
if (c()) {
|
|
274
275
|
r.openItem(e.item);
|
|
275
276
|
return;
|
|
@@ -286,7 +287,7 @@ function He(e) {
|
|
|
286
287
|
if (t.preventDefault(), t.stopPropagation(), c()) return;
|
|
287
288
|
r.ensureContextMenuSelection(e.item.id);
|
|
288
289
|
const a = r.getSelectedItemsList(), h = a.length > 0 ? a : [e.item];
|
|
289
|
-
r.showContextMenu(
|
|
290
|
+
r.showContextMenu(ye({
|
|
290
291
|
x: t.clientX,
|
|
291
292
|
y: t.clientY,
|
|
292
293
|
triggerItem: e.item,
|
|
@@ -317,7 +318,7 @@ function He(e) {
|
|
|
317
318
|
onPointerEnter: i,
|
|
318
319
|
onPointerLeave: w,
|
|
319
320
|
get class() {
|
|
320
|
-
return
|
|
321
|
+
return H(
|
|
321
322
|
"group relative flex flex-col items-center gap-2 p-3 rounded-lg cursor-pointer h-28",
|
|
322
323
|
"transition-all duration-150 ease-out",
|
|
323
324
|
"hover:bg-accent/50 hover:scale-[1.02]",
|
|
@@ -331,19 +332,19 @@ function He(e) {
|
|
|
331
332
|
K() && !k() && ["bg-destructive/10 ring-2 ring-dashed ring-destructive/50"]
|
|
332
333
|
);
|
|
333
334
|
}
|
|
334
|
-
}), !1, !0),
|
|
335
|
+
}), !1, !0), S(t, D(q, {
|
|
335
336
|
get when() {
|
|
336
337
|
return s();
|
|
337
338
|
},
|
|
338
339
|
get children() {
|
|
339
340
|
return ke();
|
|
340
341
|
}
|
|
341
|
-
}), a),
|
|
342
|
+
}), a), S(a, D(be, {
|
|
342
343
|
get item() {
|
|
343
344
|
return e.item;
|
|
344
345
|
},
|
|
345
346
|
class: "w-8 h-8"
|
|
346
|
-
})),
|
|
347
|
+
})), S(h, D(He, {
|
|
347
348
|
get name() {
|
|
348
349
|
return e.item.name;
|
|
349
350
|
},
|
|
@@ -351,8 +352,8 @@ function He(e) {
|
|
|
351
352
|
return M();
|
|
352
353
|
}
|
|
353
354
|
})), N((u) => {
|
|
354
|
-
var G =
|
|
355
|
-
return G !== u.e &&
|
|
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 && p(a, u.e = G), J !== u.t && p(h, u.t = J), Z !== u.a && p(E, u.a = Z), ee !== u.o && Y(E, "background", u.o = ee), u;
|
|
356
357
|
}, {
|
|
357
358
|
e: void 0,
|
|
358
359
|
t: void 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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
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
3
|
import { cn as E } from "../../utils/cn.js";
|
|
4
4
|
import { useMediaQuery as re } from "../../hooks/useMediaQuery.js";
|
|
@@ -14,7 +14,7 @@ import { fileBrowserTouchTargetAttrs as Fe } from "./touchInteractionGuard.js";
|
|
|
14
14
|
import { createItemContextMenuEvent as ke } from "./contextMenuEvent.js";
|
|
15
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 Ee = /* @__PURE__ */
|
|
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)
|
|
@@ -69,7 +69,7 @@ function ut(t) {
|
|
|
69
69
|
} = g.range();
|
|
70
70
|
return o.currentFiles().slice(n, i);
|
|
71
71
|
}), T = /* @__PURE__ */ new Map();
|
|
72
|
-
let
|
|
72
|
+
let _ = null, x = 0;
|
|
73
73
|
const U = (n, i) => {
|
|
74
74
|
if (i) {
|
|
75
75
|
T.set(n, i);
|
|
@@ -77,13 +77,13 @@ function ut(t) {
|
|
|
77
77
|
}
|
|
78
78
|
T.delete(n);
|
|
79
79
|
}, Q = (n) => {
|
|
80
|
-
if (!
|
|
81
|
-
const i = n * C, l = i + C, c =
|
|
80
|
+
if (!_) return;
|
|
81
|
+
const i = n * C, l = i + C, c = _.scrollTop, h = c + _.clientHeight;
|
|
82
82
|
if (i < c) {
|
|
83
|
-
|
|
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();
|
|
@@ -122,7 +122,8 @@ function ut(t) {
|
|
|
122
122
|
day: "numeric",
|
|
123
123
|
year: "numeric"
|
|
124
124
|
}) : "-", y = pe({
|
|
125
|
-
getContainer: () =>
|
|
125
|
+
getContainer: () => _,
|
|
126
|
+
getOverlayHost: () => _,
|
|
126
127
|
getVisibleItemIdsInOrder: () => o.currentFiles().map((n) => n.id),
|
|
127
128
|
getElementForId: (n) => T.get(n) ?? null,
|
|
128
129
|
getSelectedIds: () => [...o.selectedItems()],
|
|
@@ -138,8 +139,8 @@ function ut(t) {
|
|
|
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
|
-
},
|
|
142
|
-
const n = J()?.width ?? 0, i =
|
|
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,
|
|
@@ -181,7 +182,7 @@ function ut(t) {
|
|
|
181
182
|
modifiedWidth: r,
|
|
182
183
|
sizeWidth: e
|
|
183
184
|
};
|
|
184
|
-
}),
|
|
185
|
+
}), B = () => S().modifiedWidth, q = () => S().sizeWidth, G = (n) => {
|
|
185
186
|
const i = S();
|
|
186
187
|
if (!i.showModified || i.width <= 0) return;
|
|
187
188
|
if (!i.showSize) {
|
|
@@ -238,7 +239,7 @@ function ut(t) {
|
|
|
238
239
|
return S().showModified;
|
|
239
240
|
},
|
|
240
241
|
get children() {
|
|
241
|
-
var a =
|
|
242
|
+
var a = He(), r = a.firstChild;
|
|
242
243
|
return r.firstChild, r.$$click = () => k("modifiedAt"), f(r, m(W, {
|
|
243
244
|
field: "modifiedAt"
|
|
244
245
|
}), null), f(a, m(P, {
|
|
@@ -252,7 +253,7 @@ function ut(t) {
|
|
|
252
253
|
});
|
|
253
254
|
}
|
|
254
255
|
}), null), p((e) => {
|
|
255
|
-
var s = E("relative shrink-0", S().showSize && "border-r border-border"), u = `${
|
|
256
|
+
var s = E("relative shrink-0", S().showSize && "border-r border-border"), u = `${B()}px`;
|
|
256
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,
|
|
@@ -264,13 +265,13 @@ function ut(t) {
|
|
|
264
265
|
return S().showSize;
|
|
265
266
|
},
|
|
266
267
|
get children() {
|
|
267
|
-
var a =
|
|
268
|
+
var a = Be(), r = a.firstChild;
|
|
268
269
|
return r.firstChild, r.$$click = () => k("size"), f(r, m(W, {
|
|
269
270
|
field: "size"
|
|
270
271
|
}), null), p((e) => L(a, "width", `${q()}px`)), a;
|
|
271
272
|
}
|
|
272
273
|
}), null), ie(M, "pointerdown", y.onPointerDown, !0), ie(M, "scroll", g.onScroll), ee((a) => {
|
|
273
|
-
|
|
274
|
+
_ = a, g.scrollRef(a), o.setScrollContainer(a);
|
|
274
275
|
}, M), f(M, m(P, {
|
|
275
276
|
get when() {
|
|
276
277
|
return o.currentFiles().length > 0;
|
|
@@ -314,7 +315,7 @@ function ut(t) {
|
|
|
314
315
|
return S().showSize;
|
|
315
316
|
},
|
|
316
317
|
get modifiedWidthPx() {
|
|
317
|
-
return
|
|
318
|
+
return B();
|
|
318
319
|
},
|
|
319
320
|
get sizeWidthPx() {
|
|
320
321
|
return q();
|
|
@@ -357,11 +358,11 @@ function Ue(t) {
|
|
|
357
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, $ = null, T = 0,
|
|
361
|
+
let g, $ = null, T = 0, _ = 0, x = !1;
|
|
361
362
|
const U = 5, Q = 500;
|
|
362
363
|
let k = null;
|
|
363
|
-
const [j, O] = ue(!1), y = () => g === "touch" || g === "pen", W = () => t.item.type === "folder",
|
|
364
|
-
if (!
|
|
364
|
+
const [j, O] = ue(!1), y = () => g === "touch" || g === "pen", W = () => t.item.type === "folder", H = () => W() && t.enableDragDrop && t.dragContext, X = () => {
|
|
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;
|
|
367
368
|
}, K = () => {
|
|
@@ -380,7 +381,7 @@ function Ue(t) {
|
|
|
380
381
|
de(() => {
|
|
381
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
386
|
x = !0, D() || o.selectItem(t.item.id, !1);
|
|
386
387
|
const u = o.getSelectedItemsList(), w = (u.length > 0 && D() ? u : [t.item]).map((F) => ({
|
|
@@ -396,24 +397,24 @@ function Ue(t) {
|
|
|
396
397
|
t.dragContext.startDrag(w, e, s);
|
|
397
398
|
}, q = (e) => {
|
|
398
399
|
if ($ !== e.pointerId) return;
|
|
399
|
-
const s = e.clientX - T, u = e.clientY -
|
|
400
|
+
const s = e.clientX - T, u = e.clientY - _, d = Math.sqrt(s * s + u * u);
|
|
400
401
|
if (y() && !x && d > 10) {
|
|
401
402
|
S(!1);
|
|
402
403
|
return;
|
|
403
404
|
}
|
|
404
|
-
!y() && !x && d > U &&
|
|
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
|
$ === e.pointerId && (C.onPointerUp(), S(!0));
|
|
407
408
|
}, V = (e) => {
|
|
408
409
|
$ === e.pointerId && (C.onPointerCancel(), S(!1));
|
|
409
410
|
}, n = (e) => {
|
|
410
|
-
g = e.pointerType, C.onPointerDown(e), !(e.pointerType === "mouse" && e.button !== 0) && (!t.enableDragDrop || !t.dragContext || ($ = e.pointerId, T = e.clientX,
|
|
411
|
-
$ !== null && !x &&
|
|
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
415
|
g = e.pointerType, C.onPointerMove(e);
|
|
415
416
|
}, l = (e) => {
|
|
416
|
-
if (!
|
|
417
|
+
if (!H() || !t.dragContext) return;
|
|
417
418
|
const s = t.dragContext.dragState();
|
|
418
419
|
if (!s.isDragging) return;
|
|
419
420
|
O(!0);
|
|
@@ -457,7 +458,7 @@ function Ue(t) {
|
|
|
457
458
|
items: u,
|
|
458
459
|
source: "list"
|
|
459
460
|
}));
|
|
460
|
-
}, M = () => t.dragContext?.dragState(), a = () => M()?.isDragging ?? !1, r = () => j() && a() &&
|
|
461
|
+
}, M = () => t.dragContext?.dragState(), a = () => M()?.isDragging ?? !1, r = () => j() && a() && H();
|
|
461
462
|
return (() => {
|
|
462
463
|
var e = Ge(), s = e.firstChild, u = s.firstChild;
|
|
463
464
|
return ee((d) => {
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { type Accessor } from 'solid-js';
|
|
2
2
|
import type { ReplaceSelectionOptions } from './types';
|
|
3
|
+
export type ViewportRect = {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
export type LocalOverlayRect = {
|
|
10
|
+
left: number;
|
|
11
|
+
top: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
export interface OverlayHostGeometry {
|
|
16
|
+
left: number;
|
|
17
|
+
top: number;
|
|
18
|
+
scrollLeft: number;
|
|
19
|
+
scrollTop: number;
|
|
20
|
+
clientLeft: number;
|
|
21
|
+
clientTop: number;
|
|
22
|
+
}
|
|
3
23
|
export interface FileBrowserMarqueeSelectionOptions {
|
|
4
24
|
getContainer: () => HTMLElement | null;
|
|
25
|
+
getOverlayHost?: () => HTMLElement | null;
|
|
5
26
|
getVisibleItemIdsInOrder: () => string[];
|
|
6
27
|
getElementForId: (id: string) => HTMLElement | null | undefined;
|
|
7
28
|
getSelectedIds: () => string[];
|
|
@@ -12,5 +33,6 @@ export interface FileBrowserMarqueeSelectionResult {
|
|
|
12
33
|
overlayStyle: Accessor<Record<string, string> | null>;
|
|
13
34
|
onPointerDown: (event: PointerEvent) => void;
|
|
14
35
|
}
|
|
15
|
-
export declare const FILE_BROWSER_MARQUEE_OVERLAY_CLASS = "pointer-events-none
|
|
36
|
+
export declare const FILE_BROWSER_MARQUEE_OVERLAY_CLASS = "pointer-events-none absolute z-40 rounded-md floe-file-browser-marquee-overlay";
|
|
37
|
+
export declare function projectViewportRectToOverlayHost(rect: ViewportRect, geometry: OverlayHostGeometry): LocalOverlayRect;
|
|
16
38
|
export declare function createFileBrowserMarqueeSelection(options: FileBrowserMarqueeSelectionOptions): FileBrowserMarqueeSelectionResult;
|
|
@@ -1,69 +1,93 @@
|
|
|
1
|
-
import { createSignal as
|
|
2
|
-
import { isPrimaryModKeyPressed as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const
|
|
1
|
+
import { createSignal as S, createMemo as b, onCleanup as w } from "solid-js";
|
|
2
|
+
import { isPrimaryModKeyPressed as M } from "../../utils/keybind.js";
|
|
3
|
+
const y = 4, A = "pointer-events-none absolute z-40 rounded-md floe-file-browser-marquee-overlay";
|
|
4
|
+
function T(e, n, c, o) {
|
|
5
|
+
const l = Math.min(e, c), u = Math.min(n, o);
|
|
6
6
|
return {
|
|
7
|
-
left:
|
|
8
|
-
top:
|
|
9
|
-
width: Math.abs(
|
|
7
|
+
left: l,
|
|
8
|
+
top: u,
|
|
9
|
+
width: Math.abs(c - e),
|
|
10
10
|
height: Math.abs(o - n)
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return !(
|
|
13
|
+
function O(e, n) {
|
|
14
|
+
return !(e.left + e.width < n.left || n.right < e.left || e.top + e.height < n.top || n.bottom < e.top);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return !(!(
|
|
16
|
+
function P(e) {
|
|
17
|
+
return !(!(e instanceof Element) || e.closest("[data-file-browser-item-id]") || e.closest('button, input, textarea, select, a, [role="button"], [role="menuitem"]'));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
function x(e) {
|
|
20
|
+
const n = e.getBoundingClientRect();
|
|
21
|
+
return {
|
|
22
|
+
left: n.left,
|
|
23
|
+
top: n.top,
|
|
24
|
+
scrollLeft: e.scrollLeft,
|
|
25
|
+
scrollTop: e.scrollTop,
|
|
26
|
+
clientLeft: e.clientLeft,
|
|
27
|
+
clientTop: e.clientTop
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function C(e, n) {
|
|
31
|
+
return {
|
|
32
|
+
left: e.left - n.left + n.scrollLeft - n.clientLeft,
|
|
33
|
+
top: e.top - n.top + n.scrollTop - n.clientTop,
|
|
34
|
+
width: e.width,
|
|
35
|
+
height: e.height
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function D(e) {
|
|
39
|
+
const [n, c] = S(null);
|
|
40
|
+
let o = null, l = !1, u = [], a = 0, f = 0, s = !1;
|
|
41
|
+
const I = () => {
|
|
42
|
+
typeof document > "u" || (document.removeEventListener("pointermove", p, !0), document.removeEventListener("pointerup", m, !0), document.removeEventListener("pointercancel", h, !0));
|
|
43
|
+
}, d = () => {
|
|
44
|
+
I(), o = null, l = !1, u = [], a = 0, f = 0, s = !1, c(null);
|
|
45
|
+
}, L = (t) => {
|
|
46
|
+
const i = e.getVisibleItemIdsInOrder().filter((R) => {
|
|
47
|
+
const g = e.getElementForId(R);
|
|
48
|
+
return g ? O(t, g.getBoundingClientRect()) : !1;
|
|
49
|
+
}), r = l ? [...u, ...i] : i;
|
|
50
|
+
e.replaceSelection(r, {
|
|
51
|
+
anchorId: l ? void 0 : r[0] ?? null,
|
|
52
|
+
lastInteractedId: r[r.length - 1] ?? null,
|
|
53
|
+
preserveAnchor: l
|
|
35
54
|
});
|
|
36
|
-
},
|
|
37
|
-
if (o !==
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
55
|
+
}, p = (t) => {
|
|
56
|
+
if (o !== t.pointerId) return;
|
|
57
|
+
const i = Math.hypot(t.clientX - a, t.clientY - f);
|
|
58
|
+
if (!s && i < y)
|
|
40
59
|
return;
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
o ===
|
|
46
|
-
}, h = (
|
|
47
|
-
o ===
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
t.preventDefault(), s = !0;
|
|
61
|
+
const r = T(a, f, t.clientX, t.clientY);
|
|
62
|
+
c(r), L(r);
|
|
63
|
+
}, m = (t) => {
|
|
64
|
+
o === t.pointerId && (!s && !l && e.clearSelection(), d());
|
|
65
|
+
}, h = (t) => {
|
|
66
|
+
o === t.pointerId && d();
|
|
67
|
+
}, v = (t) => {
|
|
68
|
+
t.pointerType !== "mouse" || t.button !== 0 || P(t.target) && e.getContainer() && (o = t.pointerId, l = M(t), u = l ? e.getSelectedIds() : [], a = t.clientX, f = t.clientY, s = !1, typeof document < "u" && (document.addEventListener("pointermove", p, !0), document.addEventListener("pointerup", m, !0), document.addEventListener("pointercancel", h, !0)), t.preventDefault());
|
|
69
|
+
}, E = b(() => {
|
|
70
|
+
const t = n();
|
|
71
|
+
if (!t) return null;
|
|
72
|
+
const i = e.getOverlayHost?.() ?? e.getContainer();
|
|
73
|
+
if (!i) return null;
|
|
74
|
+
const r = C(t, x(i));
|
|
75
|
+
return {
|
|
76
|
+
left: `${r.left}px`,
|
|
77
|
+
top: `${r.top}px`,
|
|
78
|
+
width: `${r.width}px`,
|
|
79
|
+
height: `${r.height}px`
|
|
80
|
+
};
|
|
58
81
|
});
|
|
59
|
-
return
|
|
60
|
-
|
|
82
|
+
return w(() => {
|
|
83
|
+
d();
|
|
61
84
|
}), {
|
|
62
|
-
overlayStyle:
|
|
63
|
-
onPointerDown:
|
|
85
|
+
overlayStyle: E,
|
|
86
|
+
onPointerDown: v
|
|
64
87
|
};
|
|
65
88
|
}
|
|
66
89
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
90
|
+
A as FILE_BROWSER_MARQUEE_OVERLAY_CLASS,
|
|
91
|
+
D as createFileBrowserMarqueeSelection,
|
|
92
|
+
C as projectViewportRectToOverlayHost
|
|
69
93
|
};
|