@floegence/floe-webapp-core 0.35.32 → 0.35.34
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 +84 -86
- package/dist/components/file-browser/FileContextMenu.d.ts +2 -2
- package/dist/components/file-browser/FileContextMenu.js +300 -142
- package/dist/components/file-browser/FileGridView.js +50 -45
- package/dist/components/file-browser/FileIcons.d.ts +10 -2
- package/dist/components/file-browser/FileIcons.js +289 -181
- package/dist/components/file-browser/FileListView.js +99 -94
- package/dist/components/file-browser/contextMenuEvent.d.ts +10 -0
- package/dist/components/file-browser/contextMenuEvent.js +19 -0
- package/dist/components/file-browser/index.d.ts +2 -2
- package/dist/components/file-browser/longPressContextMenu.d.ts +1 -0
- package/dist/components/file-browser/longPressContextMenu.js +45 -32
- package/dist/components/file-browser/types.d.ts +23 -1
- package/dist/components/layout/Shell.d.ts +8 -0
- package/dist/components/layout/Shell.js +157 -138
- package/dist/components/layout/Sidebar.d.ts +2 -0
- package/dist/components/layout/Sidebar.js +39 -38
- package/dist/components/layout/sidebarVisibilityMotion.d.ts +22 -0
- package/dist/components/layout/sidebarVisibilityMotion.js +16 -0
- package/dist/components/ui/Dropdown.d.ts +0 -1
- package/dist/components/ui/Dropdown.js +150 -204
- package/dist/components/ui/menuUtils.d.ts +15 -0
- package/dist/components/ui/menuUtils.js +60 -0
- package/dist/components/ui/picker/PickerBase.js +90 -96
- package/dist/context/LayoutContext.d.ts +5 -0
- package/dist/context/LayoutContext.js +58 -46
- package/dist/file-browser.js +35 -31
- package/dist/full.js +411 -407
- package/package.json +1 -1
|
@@ -1,243 +1,401 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { deferAfterPaint as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { createComponent as c, Portal as z, setAttribute as g, insert as y, effect as w, className as R, setStyleProperty as _, template as h, Dynamic as J, memo as V, use as E, delegateEvents as Q } from "solid-js/web";
|
|
2
|
+
import { createSignal as B, createEffect as q, onCleanup as O, Show as $, For as W } from "solid-js";
|
|
3
|
+
import { cn as T } from "../../utils/cn.js";
|
|
4
|
+
import { deferAfterPaint as X } from "../../utils/defer.js";
|
|
5
|
+
import { ChevronRight as Y } from "../icons/index.js";
|
|
6
|
+
import { focusMenuItem as P, moveMenuFocus as Z, calculateSubmenuPosition as ee } from "../ui/menuUtils.js";
|
|
7
|
+
import { useFileBrowser as te } from "./FileBrowserContext.js";
|
|
8
|
+
var ne = /* @__PURE__ */ h('<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">'), oe = /* @__PURE__ */ h('<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">'), re = /* @__PURE__ */ h('<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__ */ h('<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">'), ae = /* @__PURE__ */ h('<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">'), se = /* @__PURE__ */ h('<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__ */ h('<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__ */ h('<span class="text-[10px] text-muted-foreground opacity-60">'), ce = /* @__PURE__ */ h("<div role=menu>"), de = /* @__PURE__ */ h('<div class=relative><button type=button role=menuitem><span class="flex-1 text-left">'), K = /* @__PURE__ */ h('<div class="my-1 h-px bg-border"role=separator>'), me = /* @__PURE__ */ h("<div role=menu aria-orientation=vertical>");
|
|
9
|
+
const he = (e) => (() => {
|
|
10
|
+
var t = ne();
|
|
11
|
+
return w(() => g(t, "class", e.class)), t;
|
|
12
|
+
})(), fe = (e) => (() => {
|
|
13
|
+
var t = oe();
|
|
14
|
+
return w(() => g(t, "class", e.class)), t;
|
|
15
|
+
})(), ve = (e) => (() => {
|
|
16
|
+
var t = re();
|
|
17
|
+
return w(() => g(t, "class", e.class)), t;
|
|
18
|
+
})(), ge = (e) => (() => {
|
|
19
|
+
var t = ie();
|
|
20
|
+
return w(() => g(t, "class", e.class)), t;
|
|
21
|
+
})(), we = (e) => (() => {
|
|
22
|
+
var t = ae();
|
|
23
|
+
return w(() => g(t, "class", e.class)), t;
|
|
24
|
+
})(), pe = (e) => (() => {
|
|
25
|
+
var t = se();
|
|
26
|
+
return w(() => g(t, "class", e.class)), t;
|
|
27
|
+
})(), xe = (e) => (() => {
|
|
28
|
+
var t = ue();
|
|
29
|
+
return w(() => g(t, "class", e.class)), t;
|
|
28
30
|
})();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
let ye = 0;
|
|
32
|
+
function be(e) {
|
|
33
|
+
const t = !!e?.onAskAgent, a = !!e?.onCopyName;
|
|
31
34
|
return [{
|
|
32
35
|
id: "duplicate",
|
|
33
36
|
label: "Duplicate",
|
|
34
37
|
type: "duplicate",
|
|
35
|
-
icon:
|
|
38
|
+
icon: he,
|
|
36
39
|
shortcut: "Cmd+D",
|
|
37
|
-
separator: !a && !
|
|
40
|
+
separator: !a && !t
|
|
38
41
|
}, ...a ? [{
|
|
39
42
|
id: "copy-name",
|
|
40
43
|
label: "Copy Name",
|
|
41
44
|
type: "copy-name",
|
|
42
|
-
icon:
|
|
43
|
-
separator: !
|
|
44
|
-
}] : [], ...
|
|
45
|
+
icon: fe,
|
|
46
|
+
separator: !t
|
|
47
|
+
}] : [], ...t ? [{
|
|
45
48
|
id: "ask-agent",
|
|
46
49
|
label: "Ask Agent",
|
|
47
50
|
type: "ask-agent",
|
|
48
|
-
icon:
|
|
51
|
+
icon: ve,
|
|
49
52
|
separator: !0
|
|
50
53
|
}] : [], {
|
|
51
54
|
id: "copy-to",
|
|
52
55
|
label: "Copy to...",
|
|
53
56
|
type: "copy-to",
|
|
54
|
-
icon:
|
|
57
|
+
icon: ge
|
|
55
58
|
}, {
|
|
56
59
|
id: "move-to",
|
|
57
60
|
label: "Move to...",
|
|
58
61
|
type: "move-to",
|
|
59
|
-
icon:
|
|
62
|
+
icon: we,
|
|
60
63
|
separator: !0
|
|
61
64
|
}, {
|
|
62
65
|
id: "rename",
|
|
63
66
|
label: "Rename",
|
|
64
67
|
type: "rename",
|
|
65
|
-
icon:
|
|
68
|
+
icon: xe,
|
|
66
69
|
shortcut: "Enter"
|
|
67
70
|
}, {
|
|
68
71
|
id: "delete",
|
|
69
72
|
label: "Delete",
|
|
70
73
|
type: "delete",
|
|
71
|
-
icon:
|
|
74
|
+
icon: pe,
|
|
72
75
|
shortcut: "Del"
|
|
73
76
|
}];
|
|
74
77
|
}
|
|
75
|
-
function
|
|
76
|
-
switch (
|
|
78
|
+
function ke(e, t, a, f) {
|
|
79
|
+
switch (e.type) {
|
|
77
80
|
case "duplicate":
|
|
78
|
-
a?.onDuplicate?.(
|
|
81
|
+
a?.onDuplicate?.(t);
|
|
79
82
|
break;
|
|
80
83
|
case "copy-name":
|
|
81
|
-
a?.onCopyName?.(
|
|
84
|
+
a?.onCopyName?.(t);
|
|
82
85
|
break;
|
|
83
86
|
case "ask-agent":
|
|
84
|
-
a?.onAskAgent?.(
|
|
87
|
+
a?.onAskAgent?.(t);
|
|
85
88
|
break;
|
|
86
89
|
case "copy-to":
|
|
87
|
-
a?.onCopyTo?.(
|
|
90
|
+
a?.onCopyTo?.(t);
|
|
88
91
|
break;
|
|
89
92
|
case "move-to":
|
|
90
|
-
a?.onMoveTo?.(
|
|
93
|
+
a?.onMoveTo?.(t);
|
|
91
94
|
break;
|
|
92
95
|
case "delete":
|
|
93
|
-
a?.onDelete?.(
|
|
96
|
+
a?.onDelete?.(t);
|
|
94
97
|
break;
|
|
95
98
|
case "rename":
|
|
96
|
-
|
|
99
|
+
t.length === 1 && a?.onRename?.(t[0]);
|
|
97
100
|
break;
|
|
98
101
|
case "custom":
|
|
99
|
-
|
|
102
|
+
e.onAction?.(t, f);
|
|
100
103
|
break;
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
|
-
function
|
|
104
|
-
const e =
|
|
106
|
+
function U(e, t) {
|
|
107
|
+
const a = e.target, f = a?.closest('[role="menu"]'), x = a?.closest('[role="menuitem"]');
|
|
108
|
+
switch (e.key) {
|
|
109
|
+
case "ArrowDown":
|
|
110
|
+
e.preventDefault(), Z(f, x, 1);
|
|
111
|
+
return;
|
|
112
|
+
case "ArrowUp":
|
|
113
|
+
e.preventDefault(), Z(f, x, -1);
|
|
114
|
+
return;
|
|
115
|
+
case "Home":
|
|
116
|
+
e.preventDefault(), P(f, "first");
|
|
117
|
+
return;
|
|
118
|
+
case "End":
|
|
119
|
+
e.preventDefault(), P(f, "last");
|
|
120
|
+
return;
|
|
121
|
+
case "ArrowLeft":
|
|
122
|
+
if (!t.onCloseSubmenu) return;
|
|
123
|
+
e.preventDefault(), e.stopPropagation(), t.onCloseSubmenu();
|
|
124
|
+
return;
|
|
125
|
+
case "Escape":
|
|
126
|
+
if (e.preventDefault(), e.stopPropagation(), t.onCloseSubmenu) {
|
|
127
|
+
t.onCloseSubmenu();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
t.onDismiss();
|
|
131
|
+
return;
|
|
132
|
+
case "Tab":
|
|
133
|
+
t.onDismiss();
|
|
134
|
+
return;
|
|
135
|
+
default:
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function G(e) {
|
|
140
|
+
const [t, a] = B(!1), [f, x] = B({
|
|
141
|
+
x: -9999,
|
|
142
|
+
y: -9999
|
|
143
|
+
});
|
|
144
|
+
let b, k, C, M;
|
|
145
|
+
const d = () => (e.item.children?.length ?? 0) > 0, L = () => {
|
|
146
|
+
if (!b || !C) return;
|
|
147
|
+
const s = b.getBoundingClientRect(), u = C.getBoundingClientRect(), A = ee(s, u);
|
|
148
|
+
x(A);
|
|
149
|
+
}, p = () => {
|
|
150
|
+
M && (clearTimeout(M), M = void 0);
|
|
151
|
+
}, r = (s = "first") => {
|
|
152
|
+
!d() || e.item.disabled || (p(), a(!0), requestAnimationFrame(() => {
|
|
153
|
+
L(), P(C, s);
|
|
154
|
+
}));
|
|
155
|
+
}, n = () => {
|
|
156
|
+
p(), a(!1), requestAnimationFrame(() => k?.focus());
|
|
157
|
+
}, m = () => {
|
|
158
|
+
!d() || e.item.disabled || (p(), M = setTimeout(() => {
|
|
159
|
+
r("first");
|
|
160
|
+
}, 100));
|
|
161
|
+
}, i = () => {
|
|
162
|
+
d() && (p(), M = setTimeout(() => {
|
|
163
|
+
a(!1);
|
|
164
|
+
}, 150));
|
|
165
|
+
}, v = (s) => {
|
|
166
|
+
if (!e.item.disabled) {
|
|
167
|
+
if (d()) {
|
|
168
|
+
s.preventDefault(), s.stopPropagation(), t() ? n() : r("first");
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
e.onSelect(e.item, e.menu);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
return O(() => {
|
|
175
|
+
p();
|
|
176
|
+
}), (() => {
|
|
177
|
+
var s = de(), u = s.firstChild, A = u.firstChild;
|
|
178
|
+
s.addEventListener("mouseleave", i), s.addEventListener("mouseenter", m);
|
|
179
|
+
var j = b;
|
|
180
|
+
typeof j == "function" ? E(j, s) : b = s, u.$$keydown = (o) => {
|
|
181
|
+
e.item.disabled || !d() || (o.key === "ArrowRight" || o.key === "Enter" || o.key === " ") && (o.preventDefault(), r("first"));
|
|
182
|
+
}, u.$$click = v;
|
|
183
|
+
var F = k;
|
|
184
|
+
return typeof F == "function" ? E(F, u) : k = u, y(u, c($, {
|
|
185
|
+
get when() {
|
|
186
|
+
return e.item.icon;
|
|
187
|
+
},
|
|
188
|
+
children: (o) => c(J, {
|
|
189
|
+
get component() {
|
|
190
|
+
return o();
|
|
191
|
+
},
|
|
192
|
+
class: "w-3.5 h-3.5 opacity-60"
|
|
193
|
+
})
|
|
194
|
+
}), A), y(A, () => e.item.label), y(u, c($, {
|
|
195
|
+
get when() {
|
|
196
|
+
return V(() => !!e.item.shortcut)() && !d();
|
|
197
|
+
},
|
|
198
|
+
get children() {
|
|
199
|
+
var o = le();
|
|
200
|
+
return y(o, () => e.item.shortcut), o;
|
|
201
|
+
}
|
|
202
|
+
}), null), y(u, c($, {
|
|
203
|
+
get when() {
|
|
204
|
+
return d();
|
|
205
|
+
},
|
|
206
|
+
get children() {
|
|
207
|
+
return c(Y, {
|
|
208
|
+
class: "w-3 h-3 text-muted-foreground"
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}), null), y(s, c($, {
|
|
212
|
+
get when() {
|
|
213
|
+
return V(() => !!t())() && d();
|
|
214
|
+
},
|
|
215
|
+
get children() {
|
|
216
|
+
return c(z, {
|
|
217
|
+
get children() {
|
|
218
|
+
var o = ce();
|
|
219
|
+
o.$$keydown = (l) => U(l, {
|
|
220
|
+
onDismiss: e.onDismiss,
|
|
221
|
+
onCloseSubmenu: n
|
|
222
|
+
}), o.addEventListener("mouseleave", i), o.addEventListener("mouseenter", p);
|
|
223
|
+
var D = C;
|
|
224
|
+
return typeof D == "function" ? E(D, o) : C = o, y(o, c(W, {
|
|
225
|
+
get each() {
|
|
226
|
+
return e.item.children;
|
|
227
|
+
},
|
|
228
|
+
children: (l) => [c(G, {
|
|
229
|
+
item: l,
|
|
230
|
+
get menu() {
|
|
231
|
+
return e.menu;
|
|
232
|
+
},
|
|
233
|
+
get contextMenuId() {
|
|
234
|
+
return e.contextMenuId;
|
|
235
|
+
},
|
|
236
|
+
get onSelect() {
|
|
237
|
+
return e.onSelect;
|
|
238
|
+
},
|
|
239
|
+
get onDismiss() {
|
|
240
|
+
return e.onDismiss;
|
|
241
|
+
}
|
|
242
|
+
}), c($, {
|
|
243
|
+
get when() {
|
|
244
|
+
return l.separator;
|
|
245
|
+
},
|
|
246
|
+
get children() {
|
|
247
|
+
return K();
|
|
248
|
+
}
|
|
249
|
+
})]
|
|
250
|
+
})), w((l) => {
|
|
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"), S = e.contextMenuId, H = `${f().x}px`, N = `${f().y}px`;
|
|
252
|
+
return I !== l.e && R(o, l.e = I), S !== l.t && g(o, "data-floe-context-menu", l.t = S), H !== l.a && _(o, "left", l.a = H), N !== l.o && _(o, "top", l.o = N), l;
|
|
253
|
+
}, {
|
|
254
|
+
e: void 0,
|
|
255
|
+
t: void 0,
|
|
256
|
+
a: void 0,
|
|
257
|
+
o: void 0
|
|
258
|
+
}), o;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}), null), w((o) => {
|
|
263
|
+
var D = e.item.disabled || !d() && 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 = d() ? "menu" : void 0, S = d() ? t() : void 0;
|
|
264
|
+
return D !== o.e && (u.disabled = o.e = D), l !== o.t && R(u, o.t = l), I !== o.a && g(u, "aria-haspopup", o.a = I), S !== o.o && g(u, "aria-expanded", o.o = S), o;
|
|
265
|
+
}, {
|
|
266
|
+
e: void 0,
|
|
267
|
+
t: void 0,
|
|
268
|
+
a: void 0,
|
|
269
|
+
o: void 0
|
|
270
|
+
}), s;
|
|
271
|
+
})();
|
|
272
|
+
}
|
|
273
|
+
function Ee(e) {
|
|
274
|
+
const t = te();
|
|
105
275
|
let a;
|
|
106
|
-
const
|
|
276
|
+
const f = typeof window > "u" || typeof document > "u", x = `floe-context-menu-${ye += 1}`, [b, k] = B({
|
|
107
277
|
x: -9999,
|
|
108
278
|
y: -9999
|
|
109
|
-
}),
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
279
|
+
}), C = () => {
|
|
280
|
+
if (e.overrideItems)
|
|
281
|
+
return e.overrideItems;
|
|
112
282
|
const r = () => {
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
115
|
-
if (typeof
|
|
116
|
-
const
|
|
117
|
-
return
|
|
283
|
+
const i = e.hideItems;
|
|
284
|
+
if (!i) return [];
|
|
285
|
+
if (typeof i == "function") {
|
|
286
|
+
const v = t.contextMenu()?.items ?? [];
|
|
287
|
+
return i(v);
|
|
118
288
|
}
|
|
119
|
-
return
|
|
289
|
+
return i;
|
|
120
290
|
};
|
|
121
|
-
let
|
|
122
|
-
const
|
|
123
|
-
return
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
291
|
+
let n = be(e.callbacks);
|
|
292
|
+
const m = r();
|
|
293
|
+
return m.length > 0 && (n = n.filter((i) => !m.includes(i.type))), e.customItems?.length && (n = [...n, ...e.customItems]), n;
|
|
294
|
+
}, M = (r, n) => {
|
|
295
|
+
t.hideContextMenu();
|
|
296
|
+
const m = [...n.items], i = e.callbacks;
|
|
297
|
+
X(() => {
|
|
298
|
+
ke(r, m, i, n);
|
|
129
299
|
});
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
$(() => {
|
|
136
|
-
e.contextMenu() && (document.addEventListener("click", f), document.addEventListener("keydown", x), F(() => {
|
|
137
|
-
document.removeEventListener("click", f), document.removeEventListener("keydown", x);
|
|
138
|
-
}));
|
|
139
|
-
});
|
|
140
|
-
const B = () => {
|
|
141
|
-
const r = e.contextMenu();
|
|
300
|
+
}, d = (r) => {
|
|
301
|
+
const n = r.target;
|
|
302
|
+
n && typeof n.closest == "function" && n.closest(`[data-floe-context-menu="${x}"]`) || t.hideContextMenu();
|
|
303
|
+
}, L = () => {
|
|
304
|
+
const r = t.contextMenu();
|
|
142
305
|
if (!r || !a) return {
|
|
143
306
|
x: r?.x ?? 0,
|
|
144
307
|
y: r?.y ?? 0
|
|
145
308
|
};
|
|
146
|
-
const
|
|
147
|
-
let
|
|
148
|
-
return
|
|
149
|
-
x:
|
|
150
|
-
y:
|
|
151
|
-
} : (
|
|
152
|
-
x: Math.max(8,
|
|
153
|
-
y: Math.max(8,
|
|
309
|
+
const n = a.getBoundingClientRect(), m = window.innerWidth, i = window.innerHeight;
|
|
310
|
+
let v = r.x, s = r.y;
|
|
311
|
+
return n.width === 0 || n.height === 0 ? {
|
|
312
|
+
x: v,
|
|
313
|
+
y: s
|
|
314
|
+
} : (v + n.width > m && (v = m - n.width - 8), s + n.height > i && (s = i - n.height - 8), {
|
|
315
|
+
x: Math.max(8, v),
|
|
316
|
+
y: Math.max(8, s)
|
|
154
317
|
});
|
|
155
318
|
};
|
|
156
|
-
|
|
157
|
-
|
|
319
|
+
q(() => {
|
|
320
|
+
if (!t.contextMenu()) return;
|
|
321
|
+
const r = (n) => {
|
|
322
|
+
n.key === "Escape" && t.hideContextMenu();
|
|
323
|
+
};
|
|
324
|
+
document.addEventListener("mousedown", d), document.addEventListener("keydown", r), O(() => {
|
|
325
|
+
document.removeEventListener("mousedown", d), document.removeEventListener("keydown", r);
|
|
326
|
+
});
|
|
327
|
+
}), q(() => {
|
|
328
|
+
const r = t.contextMenu();
|
|
158
329
|
if (!r) {
|
|
159
|
-
|
|
330
|
+
k({
|
|
160
331
|
x: -9999,
|
|
161
332
|
y: -9999
|
|
162
333
|
});
|
|
163
334
|
return;
|
|
164
335
|
}
|
|
165
|
-
|
|
336
|
+
k({
|
|
166
337
|
x: r.x,
|
|
167
338
|
y: r.y
|
|
168
339
|
}), requestAnimationFrame(() => {
|
|
169
|
-
const
|
|
170
|
-
|
|
340
|
+
const n = L();
|
|
341
|
+
k(n), P(a, "first");
|
|
171
342
|
});
|
|
172
343
|
});
|
|
173
|
-
const
|
|
174
|
-
var
|
|
175
|
-
|
|
344
|
+
const p = (r) => (() => {
|
|
345
|
+
var n = me();
|
|
346
|
+
n.$$keydown = (i) => U(i, {
|
|
347
|
+
onDismiss: t.hideContextMenu
|
|
348
|
+
});
|
|
349
|
+
var m = a;
|
|
350
|
+
return typeof m == "function" ? E(m, n) : a = n, g(n, "data-floe-context-menu", x), y(n, c(W, {
|
|
176
351
|
get each() {
|
|
177
|
-
return
|
|
352
|
+
return C();
|
|
178
353
|
},
|
|
179
|
-
children: (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
})
|
|
191
|
-
}), d), v(d, () => t.label), v(s, u(m, {
|
|
192
|
-
get when() {
|
|
193
|
-
return t.shortcut;
|
|
194
|
-
},
|
|
195
|
-
get children() {
|
|
196
|
-
var i = G();
|
|
197
|
-
return v(i, () => t.shortcut), i;
|
|
198
|
-
}
|
|
199
|
-
}), null), h((i) => {
|
|
200
|
-
var k = t.disabled || t.type === "rename" && r.menu().items.length > 1, b = I("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", t.type === "delete" && "text-error hover:bg-error/10 hover:text-error");
|
|
201
|
-
return k !== i.e && (s.disabled = i.e = k), b !== i.t && C(s, i.t = b), i;
|
|
202
|
-
}, {
|
|
203
|
-
e: void 0,
|
|
204
|
-
t: void 0
|
|
205
|
-
}), s;
|
|
206
|
-
})(), u(m, {
|
|
354
|
+
children: (i) => [c(G, {
|
|
355
|
+
item: i,
|
|
356
|
+
get menu() {
|
|
357
|
+
return r.menu();
|
|
358
|
+
},
|
|
359
|
+
contextMenuId: x,
|
|
360
|
+
onSelect: M,
|
|
361
|
+
get onDismiss() {
|
|
362
|
+
return t.hideContextMenu;
|
|
363
|
+
}
|
|
364
|
+
}), c($, {
|
|
207
365
|
get when() {
|
|
208
|
-
return
|
|
366
|
+
return i.separator;
|
|
209
367
|
},
|
|
210
368
|
get children() {
|
|
211
|
-
return
|
|
369
|
+
return K();
|
|
212
370
|
}
|
|
213
371
|
})]
|
|
214
|
-
})),
|
|
215
|
-
var
|
|
216
|
-
return
|
|
372
|
+
})), w((i) => {
|
|
373
|
+
var v = 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"), s = `${b().x}px`, u = `${b().y}px`;
|
|
374
|
+
return v !== i.e && R(n, i.e = v), s !== i.t && _(n, "left", i.t = s), u !== i.a && _(n, "top", i.a = u), i;
|
|
217
375
|
}, {
|
|
218
376
|
e: void 0,
|
|
219
377
|
t: void 0,
|
|
220
378
|
a: void 0
|
|
221
|
-
}),
|
|
379
|
+
}), n;
|
|
222
380
|
})();
|
|
223
|
-
return
|
|
381
|
+
return c($, {
|
|
224
382
|
get when() {
|
|
225
|
-
return
|
|
383
|
+
return t.contextMenu();
|
|
226
384
|
},
|
|
227
|
-
children: (r) =>
|
|
385
|
+
children: (r) => f ? c(p, {
|
|
228
386
|
menu: r
|
|
229
|
-
}) :
|
|
387
|
+
}) : c(z, {
|
|
230
388
|
get children() {
|
|
231
|
-
return
|
|
389
|
+
return c(p, {
|
|
232
390
|
menu: r
|
|
233
391
|
});
|
|
234
392
|
}
|
|
235
393
|
})
|
|
236
394
|
});
|
|
237
395
|
}
|
|
238
|
-
|
|
396
|
+
Q(["click", "keydown"]);
|
|
239
397
|
export {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
398
|
+
Ee as FileContextMenu,
|
|
399
|
+
be as createDefaultContextMenuItems,
|
|
400
|
+
ke as dispatchContextMenuAction
|
|
243
401
|
};
|