@floegence/floe-webapp-core 0.35.49 → 0.35.51
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/dist/components/notes/NotesBoardNote.js +66 -63
- package/dist/components/notes/useNotesOverlayModel.js +390 -339
- 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
|
};
|