@floegence/floe-webapp-core 0.36.54 → 0.36.56
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.
|
@@ -1,83 +1,108 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { deferAfterPaint as
|
|
5
|
-
import { ChevronRight as
|
|
6
|
-
import { focusMenuItem as
|
|
7
|
-
import { LOCAL_INTERACTION_SURFACE_ATTR as
|
|
8
|
-
import { useFileBrowser as
|
|
9
|
-
import { resolveSurfacePortalHost as
|
|
10
|
-
var
|
|
11
|
-
const
|
|
12
|
-
var t =
|
|
13
|
-
return
|
|
14
|
-
})(),
|
|
15
|
-
var t =
|
|
16
|
-
return
|
|
17
|
-
})(),
|
|
18
|
-
var t =
|
|
19
|
-
return
|
|
20
|
-
})(),
|
|
21
|
-
var t =
|
|
22
|
-
return
|
|
23
|
-
})(),
|
|
24
|
-
var t =
|
|
25
|
-
return
|
|
26
|
-
})(),
|
|
27
|
-
var t =
|
|
28
|
-
return
|
|
29
|
-
})(),
|
|
30
|
-
var t =
|
|
31
|
-
return
|
|
1
|
+
import { createComponent as d, Portal as J, setAttribute as w, spread as Q, mergeProps as X, insert as M, template as y, Dynamic as ue, memo as U, effect as C, className as ce, use as j, delegateEvents as le } from "solid-js/web";
|
|
2
|
+
import { createSignal as Y, createMemo as de, createEffect as W, onCleanup as H, Show as S, For as ee } from "solid-js";
|
|
3
|
+
import { cn as q } from "../../utils/cn.js";
|
|
4
|
+
import { deferAfterPaint as me } from "../../utils/defer.js";
|
|
5
|
+
import { ChevronRight as fe } from "../icons/index.js";
|
|
6
|
+
import { focusMenuItem as T, moveMenuFocus as G, calculateSubmenuPosition as he, clampMenuPosition as pe } from "../ui/menuUtils.js";
|
|
7
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as te } from "../ui/localInteractionSurface.js";
|
|
8
|
+
import { useFileBrowser as ve } from "./FileBrowserContext.js";
|
|
9
|
+
import { resolveSurfacePortalHost as ge, projectSurfacePortalPosition as ye, resolveSurfacePortalBoundaryRect as we, isSurfacePortalMode as xe, resolveSurfacePortalMount as be } from "../ui/dialogSurfaceScope.js";
|
|
10
|
+
var Me = /* @__PURE__ */ y('<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">'), ke = /* @__PURE__ */ y('<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">'), Ce = /* @__PURE__ */ y('<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">'), Pe = /* @__PURE__ */ y('<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">'), Ie = /* @__PURE__ */ y('<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__ */ y('<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">'), $e = /* @__PURE__ */ y('<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">'), De = /* @__PURE__ */ y('<span class="text-[10px] text-muted-foreground opacity-60">'), ne = /* @__PURE__ */ y("<div>"), Ee = /* @__PURE__ */ y('<div class=relative><button type=button role=menuitem><span class="flex-1 text-left">'), oe = /* @__PURE__ */ y('<div class="my-1 h-px bg-border"role=separator>');
|
|
11
|
+
const _e = (e) => (() => {
|
|
12
|
+
var t = Me();
|
|
13
|
+
return C(() => w(t, "class", e.class)), t;
|
|
14
|
+
})(), Ae = (e) => (() => {
|
|
15
|
+
var t = ke();
|
|
16
|
+
return C(() => w(t, "class", e.class)), t;
|
|
17
|
+
})(), Le = (e) => (() => {
|
|
18
|
+
var t = Ce();
|
|
19
|
+
return C(() => w(t, "class", e.class)), t;
|
|
20
|
+
})(), Re = (e) => (() => {
|
|
21
|
+
var t = Pe();
|
|
22
|
+
return C(() => w(t, "class", e.class)), t;
|
|
23
|
+
})(), Fe = (e) => (() => {
|
|
24
|
+
var t = Ie();
|
|
25
|
+
return C(() => w(t, "class", e.class)), t;
|
|
26
|
+
})(), je = (e) => (() => {
|
|
27
|
+
var t = Se();
|
|
28
|
+
return C(() => w(t, "class", e.class)), t;
|
|
29
|
+
})(), Te = (e) => (() => {
|
|
30
|
+
var t = $e();
|
|
31
|
+
return C(() => w(t, "class", e.class)), t;
|
|
32
32
|
})();
|
|
33
|
-
let
|
|
34
|
-
|
|
33
|
+
let Be = 0;
|
|
34
|
+
const re = {
|
|
35
|
+
x: -9999,
|
|
36
|
+
y: -9999
|
|
37
|
+
};
|
|
38
|
+
function k(e, t = 0, n = re, i = n) {
|
|
39
|
+
return {
|
|
40
|
+
phase: e,
|
|
41
|
+
requestId: t,
|
|
42
|
+
anchor: n,
|
|
43
|
+
position: i
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function ie(e) {
|
|
47
|
+
return e.phase === "positioned";
|
|
48
|
+
}
|
|
49
|
+
function z(e) {
|
|
50
|
+
if (typeof requestAnimationFrame != "function") {
|
|
51
|
+
e(0);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return requestAnimationFrame(e);
|
|
55
|
+
}
|
|
56
|
+
function O(e) {
|
|
57
|
+
e === void 0 || typeof cancelAnimationFrame != "function" || cancelAnimationFrame(e);
|
|
58
|
+
}
|
|
59
|
+
function Ne(e) {
|
|
35
60
|
const t = !!e?.onAskAgent, n = !!e?.onCopyName;
|
|
36
61
|
return [{
|
|
37
62
|
id: "duplicate",
|
|
38
63
|
label: "Duplicate",
|
|
39
64
|
type: "duplicate",
|
|
40
|
-
icon:
|
|
65
|
+
icon: _e,
|
|
41
66
|
shortcut: "Cmd+D",
|
|
42
67
|
separator: !n && !t
|
|
43
68
|
}, ...n ? [{
|
|
44
69
|
id: "copy-name",
|
|
45
70
|
label: "Copy Name",
|
|
46
71
|
type: "copy-name",
|
|
47
|
-
icon:
|
|
72
|
+
icon: Ae,
|
|
48
73
|
separator: !t
|
|
49
74
|
}] : [], ...t ? [{
|
|
50
75
|
id: "ask-agent",
|
|
51
76
|
label: "Ask Agent",
|
|
52
77
|
type: "ask-agent",
|
|
53
|
-
icon:
|
|
78
|
+
icon: Le,
|
|
54
79
|
separator: !0
|
|
55
80
|
}] : [], {
|
|
56
81
|
id: "copy-to",
|
|
57
82
|
label: "Copy to...",
|
|
58
83
|
type: "copy-to",
|
|
59
|
-
icon:
|
|
84
|
+
icon: Re
|
|
60
85
|
}, {
|
|
61
86
|
id: "move-to",
|
|
62
87
|
label: "Move to...",
|
|
63
88
|
type: "move-to",
|
|
64
|
-
icon:
|
|
89
|
+
icon: Fe,
|
|
65
90
|
separator: !0
|
|
66
91
|
}, {
|
|
67
92
|
id: "rename",
|
|
68
93
|
label: "Rename",
|
|
69
94
|
type: "rename",
|
|
70
|
-
icon:
|
|
95
|
+
icon: Te,
|
|
71
96
|
shortcut: "Enter"
|
|
72
97
|
}, {
|
|
73
98
|
id: "delete",
|
|
74
99
|
label: "Delete",
|
|
75
100
|
type: "delete",
|
|
76
|
-
icon:
|
|
101
|
+
icon: je,
|
|
77
102
|
shortcut: "Del"
|
|
78
103
|
}];
|
|
79
104
|
}
|
|
80
|
-
function
|
|
105
|
+
function He(e, t, n, i) {
|
|
81
106
|
switch (e.type) {
|
|
82
107
|
case "duplicate":
|
|
83
108
|
n?.onDuplicate?.(t);
|
|
@@ -105,20 +130,20 @@ function Ie(e, t, n, i) {
|
|
|
105
130
|
break;
|
|
106
131
|
}
|
|
107
132
|
}
|
|
108
|
-
function
|
|
133
|
+
function se(e, t) {
|
|
109
134
|
const n = e.target, i = n?.closest('[role="menu"]'), m = n?.closest('[role="menuitem"]');
|
|
110
135
|
switch (e.key) {
|
|
111
136
|
case "ArrowDown":
|
|
112
|
-
e.preventDefault(),
|
|
137
|
+
e.preventDefault(), G(i, m, 1);
|
|
113
138
|
return;
|
|
114
139
|
case "ArrowUp":
|
|
115
|
-
e.preventDefault(),
|
|
140
|
+
e.preventDefault(), G(i, m, -1);
|
|
116
141
|
return;
|
|
117
142
|
case "Home":
|
|
118
|
-
e.preventDefault(),
|
|
143
|
+
e.preventDefault(), T(i, "first");
|
|
119
144
|
return;
|
|
120
145
|
case "End":
|
|
121
|
-
e.preventDefault(),
|
|
146
|
+
e.preventDefault(), T(i, "last");
|
|
122
147
|
return;
|
|
123
148
|
case "ArrowLeft":
|
|
124
149
|
if (!t.onCloseSubmenu) return;
|
|
@@ -138,148 +163,170 @@ function G(e, t) {
|
|
|
138
163
|
return;
|
|
139
164
|
}
|
|
140
165
|
}
|
|
141
|
-
function
|
|
166
|
+
function qe(e, t) {
|
|
142
167
|
return !e || typeof e != "object" ? !1 : ("dataset" in e ? e.dataset : void 0)?.floeContextMenu === t;
|
|
143
168
|
}
|
|
144
|
-
function
|
|
169
|
+
function ze(e, t) {
|
|
145
170
|
if (typeof e.composedPath == "function") {
|
|
146
171
|
const i = e.composedPath();
|
|
147
172
|
for (const m of i)
|
|
148
|
-
if (
|
|
173
|
+
if (qe(m, t)) return !0;
|
|
149
174
|
}
|
|
150
175
|
const n = e.target;
|
|
151
176
|
return typeof Element < "u" && n instanceof Element ? !!n.closest(`[data-floe-context-menu="${t}"]`) : !1;
|
|
152
177
|
}
|
|
153
|
-
function
|
|
178
|
+
function Oe(e) {
|
|
154
179
|
const {
|
|
155
180
|
ownerWindow: t,
|
|
156
181
|
contextMenuId: n,
|
|
157
182
|
onDismiss: i
|
|
158
|
-
} = e, m = (
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
},
|
|
183
|
+
} = e, m = (h) => {
|
|
184
|
+
ze(h, n) || i();
|
|
185
|
+
}, v = (h) => {
|
|
186
|
+
h.key === "Escape" && i();
|
|
187
|
+
}, f = () => {
|
|
163
188
|
i();
|
|
164
189
|
};
|
|
165
|
-
return t.addEventListener("pointerdown", m, !0), t.addEventListener("keydown",
|
|
166
|
-
t.removeEventListener("pointerdown", m, !0), t.removeEventListener("keydown",
|
|
190
|
+
return t.addEventListener("pointerdown", m, !0), t.addEventListener("keydown", v, !0), t.addEventListener("resize", f), t.addEventListener("scroll", f, !0), () => {
|
|
191
|
+
t.removeEventListener("pointerdown", m, !0), t.removeEventListener("keydown", v, !0), t.removeEventListener("resize", f), t.removeEventListener("scroll", f, !0);
|
|
167
192
|
};
|
|
168
193
|
}
|
|
169
|
-
function
|
|
170
|
-
const [t, n] =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
194
|
+
function ae(e) {
|
|
195
|
+
const [t, n] = Y(k("closed", 0));
|
|
196
|
+
let i, m, v, f, h, P = 0, x;
|
|
197
|
+
const u = () => (e.item.children?.length ?? 0) > 0, A = () => t().phase !== "closed", $ = () => ie(t()), B = () => {
|
|
198
|
+
if (!i) return re;
|
|
199
|
+
const a = i.getBoundingClientRect();
|
|
200
|
+
return {
|
|
201
|
+
x: a.right,
|
|
202
|
+
y: a.top
|
|
203
|
+
};
|
|
204
|
+
}, L = (a, l) => {
|
|
205
|
+
if (!i || !v) return a;
|
|
206
|
+
const b = i.getBoundingClientRect(), _ = v.getBoundingClientRect();
|
|
207
|
+
return he(b, _, l);
|
|
208
|
+
}, g = () => {
|
|
209
|
+
f && (clearTimeout(f), f = void 0);
|
|
210
|
+
}, D = () => {
|
|
211
|
+
O(h), h = void 0;
|
|
212
|
+
}, E = () => {
|
|
213
|
+
O(x), x = void 0;
|
|
214
|
+
}, s = (a = "first") => {
|
|
215
|
+
if (!u() || e.item.disabled) return;
|
|
216
|
+
g(), D(), E();
|
|
217
|
+
const l = ++P, b = B(), _ = e.portalLayout.boundaryRect;
|
|
218
|
+
n(k("measuring", l, b)), h = z(() => {
|
|
219
|
+
if (h = void 0, P !== l) return;
|
|
220
|
+
const F = L(b, _());
|
|
221
|
+
n(k("positioned", l, b, F)), T(v, a);
|
|
222
|
+
});
|
|
223
|
+
}, o = (a = {}) => {
|
|
224
|
+
g(), D(), n(k("closed", ++P)), (a.restoreFocus ?? !0) && (E(), x = z(() => {
|
|
225
|
+
x = void 0, m?.focus();
|
|
184
226
|
}));
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
!f() || e.item.disabled || (x(), p = setTimeout(() => {
|
|
189
|
-
$("first");
|
|
227
|
+
}, p = () => {
|
|
228
|
+
!u() || e.item.disabled || (g(), f = setTimeout(() => {
|
|
229
|
+
s("first");
|
|
190
230
|
}, 100));
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
|
|
231
|
+
}, c = () => {
|
|
232
|
+
u() && (g(), f = setTimeout(() => {
|
|
233
|
+
o({
|
|
234
|
+
restoreFocus: !1
|
|
235
|
+
});
|
|
194
236
|
}, 150));
|
|
195
|
-
},
|
|
237
|
+
}, N = (a) => {
|
|
196
238
|
if (!e.item.disabled) {
|
|
197
|
-
if (
|
|
198
|
-
|
|
239
|
+
if (u()) {
|
|
240
|
+
a.preventDefault(), a.stopPropagation(), A() ? o() : s("first");
|
|
199
241
|
return;
|
|
200
242
|
}
|
|
201
243
|
e.onSelect(e.item, e.menu);
|
|
202
244
|
}
|
|
203
245
|
};
|
|
204
|
-
|
|
205
|
-
|
|
246
|
+
H(() => {
|
|
247
|
+
g(), D(), E();
|
|
206
248
|
});
|
|
207
|
-
const
|
|
249
|
+
const V = () => e.portalLayout.projectPosition(t().position);
|
|
208
250
|
return (() => {
|
|
209
|
-
var
|
|
210
|
-
|
|
211
|
-
var
|
|
212
|
-
typeof
|
|
213
|
-
e.item.disabled || !
|
|
214
|
-
},
|
|
215
|
-
var
|
|
216
|
-
return typeof
|
|
251
|
+
var a = Ee(), l = a.firstChild, b = l.firstChild;
|
|
252
|
+
a.addEventListener("mouseleave", c), a.addEventListener("mouseenter", p);
|
|
253
|
+
var _ = i;
|
|
254
|
+
typeof _ == "function" ? j(_, a) : i = a, l.$$keydown = (r) => {
|
|
255
|
+
e.item.disabled || !u() || (r.key === "ArrowRight" || r.key === "Enter" || r.key === " ") && (r.preventDefault(), s("first"));
|
|
256
|
+
}, l.$$click = N;
|
|
257
|
+
var F = m;
|
|
258
|
+
return typeof F == "function" ? j(F, l) : m = l, M(l, d(S, {
|
|
217
259
|
get when() {
|
|
218
260
|
return e.item.icon;
|
|
219
261
|
},
|
|
220
|
-
children: (r) =>
|
|
262
|
+
children: (r) => d(ue, {
|
|
221
263
|
get component() {
|
|
222
264
|
return r();
|
|
223
265
|
},
|
|
224
266
|
class: "w-3.5 h-3.5 opacity-60"
|
|
225
267
|
})
|
|
226
|
-
}),
|
|
268
|
+
}), b), M(b, () => e.item.label), M(l, d(S, {
|
|
227
269
|
get when() {
|
|
228
|
-
return
|
|
270
|
+
return U(() => !!e.item.shortcut)() && !u();
|
|
229
271
|
},
|
|
230
272
|
get children() {
|
|
231
|
-
var r =
|
|
232
|
-
return
|
|
273
|
+
var r = De();
|
|
274
|
+
return M(r, () => e.item.shortcut), r;
|
|
233
275
|
}
|
|
234
|
-
}), null),
|
|
276
|
+
}), null), M(l, d(S, {
|
|
235
277
|
get when() {
|
|
236
|
-
return
|
|
278
|
+
return u();
|
|
237
279
|
},
|
|
238
280
|
get children() {
|
|
239
|
-
return
|
|
281
|
+
return d(fe, {
|
|
240
282
|
class: "w-3 h-3 text-muted-foreground"
|
|
241
283
|
});
|
|
242
284
|
}
|
|
243
|
-
}), null),
|
|
285
|
+
}), null), M(a, d(S, {
|
|
244
286
|
get when() {
|
|
245
|
-
return
|
|
287
|
+
return U(() => !!A())() && u();
|
|
246
288
|
},
|
|
247
289
|
get children() {
|
|
248
|
-
return
|
|
290
|
+
return d(J, {
|
|
249
291
|
get mount() {
|
|
250
292
|
return e.portalLayout.mount();
|
|
251
293
|
},
|
|
252
294
|
get children() {
|
|
253
|
-
var r =
|
|
254
|
-
return typeof
|
|
295
|
+
var r = ne(), R = v;
|
|
296
|
+
return typeof R == "function" ? j(R, r) : v = r, Q(r, X({
|
|
255
297
|
get class() {
|
|
256
|
-
return
|
|
298
|
+
return q(e.portalLayout.isSurfaceMode() ? "absolute z-20 min-w-[180px] py-1" : "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");
|
|
257
299
|
},
|
|
258
300
|
get "data-floe-context-menu"() {
|
|
259
301
|
return e.contextMenuId;
|
|
260
302
|
}
|
|
261
303
|
}, () => ({
|
|
262
|
-
[
|
|
304
|
+
[te]: e.portalLayout.isSurfaceMode() ? "true" : void 0
|
|
263
305
|
}), {
|
|
264
306
|
get style() {
|
|
265
307
|
return {
|
|
266
|
-
left: `${
|
|
267
|
-
top: `${
|
|
308
|
+
left: `${V().x}px`,
|
|
309
|
+
top: `${V().y}px`,
|
|
310
|
+
visibility: $() ? "visible" : "hidden",
|
|
311
|
+
"pointer-events": $() ? "auto" : "none"
|
|
268
312
|
};
|
|
269
313
|
},
|
|
270
314
|
role: "menu",
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
315
|
+
get "aria-hidden"() {
|
|
316
|
+
return $() ? void 0 : "true";
|
|
317
|
+
},
|
|
318
|
+
onMouseEnter: g,
|
|
319
|
+
onMouseLeave: c,
|
|
320
|
+
onKeyDown: (I) => se(I, {
|
|
274
321
|
onDismiss: e.onDismiss,
|
|
275
|
-
onCloseSubmenu:
|
|
322
|
+
onCloseSubmenu: o
|
|
276
323
|
})
|
|
277
|
-
}), !1, !0),
|
|
324
|
+
}), !1, !0), M(r, d(ee, {
|
|
278
325
|
get each() {
|
|
279
326
|
return e.item.children;
|
|
280
327
|
},
|
|
281
|
-
children: (
|
|
282
|
-
item:
|
|
328
|
+
children: (I) => [d(ae, {
|
|
329
|
+
item: I,
|
|
283
330
|
get menu() {
|
|
284
331
|
return e.menu;
|
|
285
332
|
},
|
|
@@ -295,175 +342,173 @@ function J(e) {
|
|
|
295
342
|
get onDismiss() {
|
|
296
343
|
return e.onDismiss;
|
|
297
344
|
}
|
|
298
|
-
}),
|
|
345
|
+
}), d(S, {
|
|
299
346
|
get when() {
|
|
300
|
-
return
|
|
347
|
+
return I.separator;
|
|
301
348
|
},
|
|
302
349
|
get children() {
|
|
303
|
-
return
|
|
350
|
+
return oe();
|
|
304
351
|
}
|
|
305
352
|
})]
|
|
306
353
|
})), r;
|
|
307
354
|
}
|
|
308
355
|
});
|
|
309
356
|
}
|
|
310
|
-
}), null),
|
|
311
|
-
var
|
|
312
|
-
return
|
|
357
|
+
}), null), C((r) => {
|
|
358
|
+
var R = e.item.disabled || !u() && e.item.type === "rename" && e.menu.items.length > 1, I = q("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"), Z = u() ? "menu" : void 0, K = u() ? A() : void 0;
|
|
359
|
+
return R !== r.e && (l.disabled = r.e = R), I !== r.t && ce(l, r.t = I), Z !== r.a && w(l, "aria-haspopup", r.a = Z), K !== r.o && w(l, "aria-expanded", r.o = K), r;
|
|
313
360
|
}, {
|
|
314
361
|
e: void 0,
|
|
315
362
|
t: void 0,
|
|
316
363
|
a: void 0,
|
|
317
364
|
o: void 0
|
|
318
|
-
}),
|
|
365
|
+
}), a;
|
|
319
366
|
})();
|
|
320
367
|
}
|
|
321
|
-
function
|
|
322
|
-
const t =
|
|
368
|
+
function Ye(e) {
|
|
369
|
+
const t = ve();
|
|
323
370
|
let n;
|
|
324
|
-
const i = typeof window > "u" || typeof document > "u", m = `floe-context-menu-${
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}), c = ee(() => t.contextMenu() ? ie() : {
|
|
371
|
+
const i = typeof window > "u" || typeof document > "u", m = `floe-context-menu-${Be += 1}`, [v, f] = Y(k("closed"));
|
|
372
|
+
let h, P = 0;
|
|
373
|
+
const x = de(() => t.contextMenu() ? ge() : {
|
|
328
374
|
host: null,
|
|
329
375
|
boundaryHost: null,
|
|
330
376
|
mountHost: null,
|
|
331
377
|
mode: "global"
|
|
332
|
-
}),
|
|
333
|
-
mount: () =>
|
|
334
|
-
isSurfaceMode: () =>
|
|
335
|
-
boundaryRect: () =>
|
|
336
|
-
projectPosition: (
|
|
337
|
-
},
|
|
378
|
+
}), u = {
|
|
379
|
+
mount: () => be(x()),
|
|
380
|
+
isSurfaceMode: () => xe(x()),
|
|
381
|
+
boundaryRect: () => we(x()),
|
|
382
|
+
projectPosition: (s) => ye(s, x())
|
|
383
|
+
}, A = () => {
|
|
338
384
|
if (e.overrideItems)
|
|
339
385
|
return e.overrideItems;
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
if (!
|
|
343
|
-
if (typeof
|
|
344
|
-
const
|
|
345
|
-
return
|
|
386
|
+
const s = () => {
|
|
387
|
+
const c = e.hideItems;
|
|
388
|
+
if (!c) return [];
|
|
389
|
+
if (typeof c == "function") {
|
|
390
|
+
const N = t.contextMenu()?.items ?? [];
|
|
391
|
+
return c(N);
|
|
346
392
|
}
|
|
347
|
-
return
|
|
393
|
+
return c;
|
|
348
394
|
};
|
|
349
|
-
let
|
|
350
|
-
const
|
|
351
|
-
return
|
|
352
|
-
},
|
|
395
|
+
let o = Ne(e.callbacks);
|
|
396
|
+
const p = s();
|
|
397
|
+
return p.length > 0 && (o = o.filter((c) => !p.includes(c.type))), e.customItems?.length && (o = [...o, ...e.customItems]), o;
|
|
398
|
+
}, $ = (s, o) => {
|
|
353
399
|
t.hideContextMenu();
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
|
|
400
|
+
const p = [...o.items], c = e.callbacks;
|
|
401
|
+
me(() => {
|
|
402
|
+
He(s, p, c, o);
|
|
357
403
|
});
|
|
358
|
-
},
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const s = n.getBoundingClientRect();
|
|
365
|
-
return s.width === 0 || s.height === 0 ? {
|
|
366
|
-
x: o.x,
|
|
367
|
-
y: o.y
|
|
368
|
-
} : re({
|
|
369
|
-
x: o.x,
|
|
370
|
-
y: o.y
|
|
371
|
-
}, s, p.boundaryRect());
|
|
404
|
+
}, B = (s) => {
|
|
405
|
+
if (!n) return s;
|
|
406
|
+
const o = n.getBoundingClientRect();
|
|
407
|
+
return pe(s, o, u.boundaryRect());
|
|
408
|
+
}, L = () => {
|
|
409
|
+
O(h), h = void 0;
|
|
372
410
|
};
|
|
373
|
-
|
|
411
|
+
W(() => {
|
|
374
412
|
if (i || !t.contextMenu()) return;
|
|
375
|
-
const
|
|
413
|
+
const s = Oe({
|
|
376
414
|
ownerWindow: window,
|
|
377
415
|
contextMenuId: m,
|
|
378
416
|
onDismiss: t.hideContextMenu
|
|
379
417
|
});
|
|
380
|
-
|
|
381
|
-
|
|
418
|
+
H(() => {
|
|
419
|
+
s();
|
|
382
420
|
});
|
|
383
|
-
}),
|
|
384
|
-
const
|
|
385
|
-
if (!
|
|
386
|
-
|
|
387
|
-
x: -9999,
|
|
388
|
-
y: -9999
|
|
389
|
-
});
|
|
421
|
+
}), W(() => {
|
|
422
|
+
const s = t.contextMenu();
|
|
423
|
+
if (!s) {
|
|
424
|
+
L(), f(k("closed", ++P));
|
|
390
425
|
return;
|
|
391
426
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
427
|
+
L();
|
|
428
|
+
const o = ++P, p = {
|
|
429
|
+
x: s.x,
|
|
430
|
+
y: s.y
|
|
431
|
+
};
|
|
432
|
+
f(k("measuring", o, p)), h = z(() => {
|
|
433
|
+
if (h = void 0, P !== o) return;
|
|
434
|
+
const c = B(p);
|
|
435
|
+
f(k("positioned", o, p, c)), T(n, "first");
|
|
398
436
|
});
|
|
437
|
+
}), H(() => {
|
|
438
|
+
L();
|
|
399
439
|
});
|
|
400
|
-
const
|
|
401
|
-
var
|
|
402
|
-
return typeof
|
|
440
|
+
const g = () => ie(v()), D = () => u.projectPosition(v().position), E = (s) => (() => {
|
|
441
|
+
var o = ne(), p = n;
|
|
442
|
+
return typeof p == "function" ? j(p, o) : n = o, w(o, "data-floe-context-menu", m), Q(o, X({
|
|
403
443
|
get class() {
|
|
404
|
-
return
|
|
444
|
+
return q(u.isSurfaceMode() ? "absolute z-20 min-w-[180px] py-1" : "fixed z-50 min-w-[180px] py-1", "bg-popover border border-border rounded-lg shadow-lg", g() && "animate-in fade-in zoom-in-95 duration-100");
|
|
405
445
|
}
|
|
406
446
|
}, () => ({
|
|
407
|
-
[
|
|
447
|
+
[te]: u.isSurfaceMode() ? "true" : void 0
|
|
408
448
|
}), {
|
|
409
449
|
get style() {
|
|
410
450
|
return {
|
|
411
|
-
left: `${
|
|
412
|
-
top: `${
|
|
451
|
+
left: `${D().x}px`,
|
|
452
|
+
top: `${D().y}px`,
|
|
453
|
+
visibility: g() ? "visible" : "hidden",
|
|
454
|
+
"pointer-events": g() ? "auto" : "none"
|
|
413
455
|
};
|
|
414
456
|
},
|
|
415
457
|
role: "menu",
|
|
458
|
+
get "aria-hidden"() {
|
|
459
|
+
return g() ? void 0 : "true";
|
|
460
|
+
},
|
|
416
461
|
"aria-orientation": "vertical",
|
|
417
|
-
onKeyDown: (
|
|
462
|
+
onKeyDown: (c) => se(c, {
|
|
418
463
|
onDismiss: t.hideContextMenu
|
|
419
464
|
})
|
|
420
|
-
}), !1, !0),
|
|
465
|
+
}), !1, !0), M(o, d(ee, {
|
|
421
466
|
get each() {
|
|
422
|
-
return
|
|
467
|
+
return A();
|
|
423
468
|
},
|
|
424
|
-
children: (
|
|
425
|
-
item:
|
|
469
|
+
children: (c) => [d(ae, {
|
|
470
|
+
item: c,
|
|
426
471
|
get menu() {
|
|
427
|
-
return
|
|
472
|
+
return s.menu();
|
|
428
473
|
},
|
|
429
474
|
contextMenuId: m,
|
|
430
|
-
portalLayout:
|
|
431
|
-
onSelect:
|
|
475
|
+
portalLayout: u,
|
|
476
|
+
onSelect: $,
|
|
432
477
|
get onDismiss() {
|
|
433
478
|
return t.hideContextMenu;
|
|
434
479
|
}
|
|
435
|
-
}),
|
|
480
|
+
}), d(S, {
|
|
436
481
|
get when() {
|
|
437
|
-
return
|
|
482
|
+
return c.separator;
|
|
438
483
|
},
|
|
439
484
|
get children() {
|
|
440
|
-
return
|
|
485
|
+
return oe();
|
|
441
486
|
}
|
|
442
487
|
})]
|
|
443
|
-
})),
|
|
488
|
+
})), o;
|
|
444
489
|
})();
|
|
445
|
-
return
|
|
490
|
+
return d(S, {
|
|
446
491
|
get when() {
|
|
447
492
|
return t.contextMenu();
|
|
448
493
|
},
|
|
449
|
-
children: (
|
|
450
|
-
menu:
|
|
451
|
-
}) :
|
|
494
|
+
children: (s) => i ? d(E, {
|
|
495
|
+
menu: s
|
|
496
|
+
}) : d(J, {
|
|
452
497
|
get mount() {
|
|
453
|
-
return
|
|
498
|
+
return u.mount();
|
|
454
499
|
},
|
|
455
500
|
get children() {
|
|
456
|
-
return
|
|
457
|
-
menu:
|
|
501
|
+
return d(E, {
|
|
502
|
+
menu: s
|
|
458
503
|
});
|
|
459
504
|
}
|
|
460
505
|
})
|
|
461
506
|
});
|
|
462
507
|
}
|
|
463
|
-
|
|
508
|
+
le(["click", "keydown"]);
|
|
464
509
|
export {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
510
|
+
Ye as FileContextMenu,
|
|
511
|
+
Ne as createDefaultContextMenuItems,
|
|
512
|
+
He as dispatchContextMenuAction,
|
|
513
|
+
Oe as installContextMenuDismissListeners
|
|
469
514
|
};
|