@floegence/floe-webapp-core 0.94.1 → 0.95.0

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,19 +1,17 @@
1
- import { createComponent as d, Portal as ce, spread as de, mergeProps as me, insert as M, effect as R, setStyleProperty as fe, template as C, Dynamic as Me, memo as ae, className as Ce, setAttribute as E, use as W, delegateEvents as ke } from "solid-js/web";
2
- import { createSignal as z, createMemo as le, createEffect as H, onCleanup as Q, untrack as J, on as Se, Show as F, For as he } from "solid-js";
1
+ import { createComponent as d, Portal as ce, spread as de, mergeProps as me, insert as x, effect as R, setStyleProperty as fe, template as M, Dynamic as Ce, memo as ae, className as Me, setAttribute as E, use as Q, delegateEvents as ke } from "solid-js/web";
2
+ import { ContextMenuActionItems as Se } from "../ui/ContextMenuActions.js";
3
+ import { createSignal as z, createMemo as le, createEffect as H, onCleanup as G, untrack as X, on as Ee, Show as I, For as he } from "solid-js";
3
4
  import { cn as ee } from "../../utils/cn.js";
4
- import { deferAfterPaint as Ee } from "../../utils/defer.js";
5
- import { ChevronLeft as Le, ChevronRight as Pe } from "../icons/index.js";
6
- import { focusMenuItem as X, moveMenuFocus as ue, calculateSubmenuPosition as Re, clampMenuPosition as $e } from "../ui/menuUtils.js";
5
+ import { deferAfterPaint as Le } from "../../utils/defer.js";
6
+ import { ChevronLeft as Pe, ChevronRight as Ie } from "../icons/index.js";
7
+ import { focusMenuItem as Y, moveMenuFocus as ue, calculateSubmenuPosition as Re, clampMenuPosition as $e } from "../ui/menuUtils.js";
7
8
  import { LOCAL_INTERACTION_SURFACE_ATTR as ve, CANVAS_WHEEL_INTERACTIVE_ATTR as ge } from "../ui/localInteractionSurface.js";
8
- import { readSurfaceSafeArea as Ie, resolveFloatingBoundary as Ae } from "../ui/surfaceFloatingBoundary.js";
9
- import { resolveSurfacePortalHost as _e, readFreshInteractionSnapshot as De, projectSurfacePortalPosition as Fe, resolveSurfacePortalScale as Te, isSurfacePortalMode as Be, resolveSurfacePortalMount as je } from "../ui/dialogSurfaceScope.js";
10
- import { useResolvedFloeConfig as Ve } from "../../context/FloeConfigContext.js";
11
- import { useFileBrowser as He } from "./FileBrowserContext.js";
12
- var ze = /* @__PURE__ */ C('<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__ */ C('<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">'), Ne = /* @__PURE__ */ C('<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">'), qe = /* @__PURE__ */ C('<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">'), Ze = /* @__PURE__ */ C('<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">'), Ke = /* @__PURE__ */ C('<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__ */ C('<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">'), We = /* @__PURE__ */ C('<span class="shrink-0 text-caption text-[var(--floe-ink-soft)] opacity-60">'), we = /* @__PURE__ */ C("<div>"), Qe = /* @__PURE__ */ C('<div class=relative><button type=button role=menuitem><span class="min-w-0 flex-1 text-left [overflow-wrap:anywhere]">'), ye = /* @__PURE__ */ C('<div class="my-1 h-px bg-border"role=separator>'), Ge = /* @__PURE__ */ C('<button type=button role=menuitem class="flex w-full items-center gap-2 border-b px-3 py-1.5 text-xs cursor-pointer hover:bg-[var(--floe-state-selected)] focus-visible:bg-[var(--floe-state-selected)] focus:outline-none"><span></span><span class="min-w-0 flex-1 truncate text-right text-[var(--floe-ink-soft)]">');
13
- const Je = (e) => (() => {
14
- var t = ze();
15
- return R(() => E(t, "class", e.class)), t;
16
- })(), Xe = (e) => (() => {
9
+ import { readSurfaceSafeArea as Ae, resolveFloatingBoundary as _e } from "../ui/surfaceFloatingBoundary.js";
10
+ import { resolveSurfacePortalHost as De, readFreshInteractionSnapshot as Fe, projectSurfacePortalPosition as Te, resolveSurfacePortalScale as Be, isSurfacePortalMode as je, resolveSurfacePortalMount as Ve } from "../ui/dialogSurfaceScope.js";
11
+ import { useResolvedFloeConfig as He } from "../../context/FloeConfigContext.js";
12
+ import { useFileBrowser as ze } from "./FileBrowserContext.js";
13
+ var Oe = /* @__PURE__ */ M('<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">'), Ne = /* @__PURE__ */ M('<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">'), qe = /* @__PURE__ */ M('<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">'), Ze = /* @__PURE__ */ M('<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">'), Ke = /* @__PURE__ */ M('<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">'), Ue = /* @__PURE__ */ M('<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">'), We = /* @__PURE__ */ M('<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">'), Qe = /* @__PURE__ */ M('<span class="shrink-0 text-caption text-[var(--floe-ink-soft)] opacity-60">'), pe = /* @__PURE__ */ M("<div>"), Ge = /* @__PURE__ */ M('<div class=relative><button type=button role=menuitem><span class="min-w-0 flex-1 text-left [overflow-wrap:anywhere]">'), we = /* @__PURE__ */ M('<div class="my-1 h-px bg-border"role=separator>'), Je = /* @__PURE__ */ M('<button type=button role=menuitem class="flex w-full items-center gap-2 border-b px-3 py-1.5 text-xs cursor-pointer hover:bg-[var(--floe-state-selected)] focus-visible:bg-[var(--floe-state-selected)] focus:outline-none"><span></span><span class="min-w-0 flex-1 truncate text-right text-[var(--floe-ink-soft)]">');
14
+ const Xe = (e) => (() => {
17
15
  var t = Oe();
18
16
  return R(() => E(t, "class", e.class)), t;
19
17
  })(), Ye = (e) => (() => {
@@ -31,13 +29,16 @@ const Je = (e) => (() => {
31
29
  })(), ot = (e) => (() => {
32
30
  var t = Ue();
33
31
  return R(() => E(t, "class", e.class)), t;
32
+ })(), rt = (e) => (() => {
33
+ var t = We();
34
+ return R(() => E(t, "class", e.class)), t;
34
35
  })();
35
- let rt = 0;
36
- const pe = {
36
+ let it = 0;
37
+ const ye = {
37
38
  x: -9999,
38
39
  y: -9999
39
40
  };
40
- function T(e, t = 0, s = pe, a = s) {
41
+ function T(e, t = 0, s = ye, a = s) {
41
42
  return {
42
43
  phase: e,
43
44
  requestId: t,
@@ -58,53 +59,53 @@ function ne(e) {
58
59
  function oe(e) {
59
60
  e === void 0 || typeof cancelAnimationFrame != "function" || cancelAnimationFrame(e);
60
61
  }
61
- function it(e) {
62
+ function st(e) {
62
63
  const t = !!e?.onAskAgent, s = !!e?.onCopyName;
63
64
  return [{
64
65
  id: "duplicate",
65
66
  label: "Duplicate",
66
67
  type: "duplicate",
67
- icon: Je,
68
+ icon: Xe,
68
69
  shortcut: "Cmd+D",
69
70
  separator: !s && !t
70
71
  }, ...s ? [{
71
72
  id: "copy-name",
72
73
  label: "Copy Name",
73
74
  type: "copy-name",
74
- icon: Xe,
75
+ icon: Ye,
75
76
  separator: !t
76
77
  }] : [], ...t ? [{
77
78
  id: "ask-agent",
78
79
  label: "Ask Agent",
79
80
  type: "ask-agent",
80
- icon: Ye,
81
+ icon: et,
81
82
  separator: !0
82
83
  }] : [], {
83
84
  id: "copy-to",
84
85
  label: "Copy to...",
85
86
  type: "copy-to",
86
- icon: et
87
+ icon: tt
87
88
  }, {
88
89
  id: "move-to",
89
90
  label: "Move to...",
90
91
  type: "move-to",
91
- icon: tt,
92
+ icon: nt,
92
93
  separator: !0
93
94
  }, {
94
95
  id: "rename",
95
96
  label: "Rename",
96
97
  type: "rename",
97
- icon: ot,
98
+ icon: rt,
98
99
  shortcut: "Enter"
99
100
  }, {
100
101
  id: "delete",
101
102
  label: "Delete",
102
103
  type: "delete",
103
- icon: nt,
104
+ icon: ot,
104
105
  shortcut: "Del"
105
106
  }];
106
107
  }
107
- function st(e, t, s, a) {
108
+ function at(e, t, s, a) {
108
109
  switch (e.type) {
109
110
  case "duplicate":
110
111
  s?.onDuplicate?.(t);
@@ -142,10 +143,10 @@ function be(e, t) {
142
143
  e.preventDefault(), ue(a, g, -1);
143
144
  return;
144
145
  case "Home":
145
- e.preventDefault(), X(a, "first");
146
+ e.preventDefault(), Y(a, "first");
146
147
  return;
147
148
  case "End":
148
- e.preventDefault(), X(a, "last");
149
+ e.preventDefault(), Y(a, "last");
149
150
  return;
150
151
  case "ArrowLeft":
151
152
  if (!t.onCloseSubmenu) return;
@@ -165,58 +166,58 @@ function be(e, t) {
165
166
  return;
166
167
  }
167
168
  }
168
- function at(e, t) {
169
+ function lt(e, t) {
169
170
  return !e || typeof e != "object" ? !1 : ("dataset" in e ? e.dataset : void 0)?.floeContextMenu === t;
170
171
  }
171
- function G(e, t) {
172
+ function J(e, t) {
172
173
  if (typeof e.composedPath == "function") {
173
174
  const a = e.composedPath();
174
175
  for (const g of a)
175
- if (at(g, t)) return !0;
176
+ if (lt(g, t)) return !0;
176
177
  }
177
178
  const s = e.target;
178
179
  return typeof Element < "u" && s instanceof Element ? !!s.closest(`[data-floe-context-menu="${t}"]`) : !1;
179
180
  }
180
- function lt(e) {
181
+ function ut(e) {
181
182
  const {
182
183
  ownerWindow: t,
183
184
  contextMenuId: s,
184
185
  onDismiss: a
185
- } = e, g = (w) => {
186
- G(w, s) || a();
187
- }, f = (w) => {
188
- w.key !== "Escape" || G(w, s) || a("escape");
189
- }, v = (w) => {
190
- G(w, s) || a();
186
+ } = e, g = (p) => {
187
+ J(p, s) || a();
188
+ }, m = (p) => {
189
+ p.key !== "Escape" || J(p, s) || a("escape");
190
+ }, v = (p) => {
191
+ J(p, s) || a();
191
192
  };
192
- return t.addEventListener("pointerdown", g, !0), t.addEventListener("keydown", f, !0), t.addEventListener("resize", v), t.addEventListener("scroll", v, !0), () => {
193
- t.removeEventListener("pointerdown", g, !0), t.removeEventListener("keydown", f, !0), t.removeEventListener("resize", v), t.removeEventListener("scroll", v, !0);
193
+ return t.addEventListener("pointerdown", g, !0), t.addEventListener("keydown", m, !0), t.addEventListener("resize", v), t.addEventListener("scroll", v, !0), () => {
194
+ t.removeEventListener("pointerdown", g, !0), t.removeEventListener("keydown", m, !0), t.removeEventListener("resize", v), t.removeEventListener("scroll", v, !0);
194
195
  };
195
196
  }
196
197
  function xe(e) {
197
198
  const [t, s] = z(T("closed", 0));
198
- let a, g, f, v, w, O = 0, $;
199
- const [B, I] = z(0);
199
+ let a, g, m, v, p, O = 0, $;
200
+ const [B, A] = z(0);
200
201
  H(() => {
201
- e.scrollRevision, J(() => y({
202
+ e.scrollRevision, X(() => w({
202
203
  restoreFocus: !1
203
204
  }));
204
205
  });
205
- const h = () => (e.item.children?.length ?? 0) > 0, A = () => t().phase !== "closed", _ = () => te(t()), N = () => {
206
- if (!a) return pe;
206
+ const h = () => (e.item.children?.length ?? 0) > 0, _ = () => t().phase !== "closed", D = () => te(t()), N = () => {
207
+ if (!a) return ye;
207
208
  const u = a.getBoundingClientRect();
208
209
  return {
209
210
  x: u.right,
210
211
  y: u.top
211
212
  };
212
213
  }, V = (u, l) => {
213
- if (!a || !f) return u;
214
- const p = a.getBoundingClientRect(), L = f.getBoundingClientRect();
215
- return Re(p, L, l);
214
+ if (!a || !m) return u;
215
+ const b = a.getBoundingClientRect(), L = m.getBoundingClientRect();
216
+ return Re(b, L, l);
216
217
  }, k = () => {
217
218
  v && (clearTimeout(v), v = void 0);
218
219
  }, S = () => {
219
- oe(w), w = void 0;
220
+ oe(p), p = void 0;
220
221
  }, q = () => {
221
222
  oe($), $ = void 0;
222
223
  }, j = (u = "first") => {
@@ -225,84 +226,84 @@ function xe(e) {
225
226
  e.portalLayout.enterChild([...e.path, e.item], u);
226
227
  return;
227
228
  }
228
- const l = ++O, p = N(), L = e.portalLayout.boundaryRect;
229
- s(T("measuring", l, p)), w = ne(() => J(() => {
230
- if (w = void 0, O !== l) return;
231
- const P = L(), n = a?.getBoundingClientRect(), o = f?.getBoundingClientRect();
229
+ const l = ++O, b = N(), L = e.portalLayout.boundaryRect;
230
+ s(T("measuring", l, b)), p = ne(() => X(() => {
231
+ if (p = void 0, O !== l) return;
232
+ const P = L(), n = a?.getBoundingClientRect(), o = m?.getBoundingClientRect();
232
233
  if (n && o && o.width > 0 && Math.max(P.right - n.right - 8, n.left - P.left - 8) < o.width) {
233
- y({
234
+ w({
234
235
  restoreFocus: !1
235
236
  }), e.portalLayout.enterChild([...e.path, e.item], u);
236
237
  return;
237
238
  }
238
- const r = V(p, P);
239
- s(T("positioned", l, p, r)), X(f, u);
239
+ const i = V(b, P);
240
+ s(T("positioned", l, b, i)), Y(m, u);
240
241
  }));
241
- }, y = (u = {}) => {
242
+ }, w = (u = {}) => {
242
243
  k(), S(), s(T("closed", ++O)), (u.restoreFocus ?? !0) && (q(), $ = ne(() => {
243
244
  $ = void 0, g?.focus();
244
245
  }));
245
- }, Y = () => {
246
+ }, K = () => {
246
247
  !h() || e.item.disabled || e.portalLayout.touch() || (k(), v = setTimeout(() => {
247
248
  j("first");
248
249
  }, 100));
249
- }, b = () => {
250
+ }, y = () => {
250
251
  h() && (k(), v = setTimeout(() => {
251
- y({
252
+ w({
252
253
  restoreFocus: !1
253
254
  });
254
255
  }, 150));
255
- }, K = (u) => {
256
+ }, U = (u) => {
256
257
  if (!e.item.disabled) {
257
258
  if (h()) {
258
- u.preventDefault(), u.stopPropagation(), A() ? y() : j("first");
259
+ u.preventDefault(), u.stopPropagation(), _() ? w() : j("first");
259
260
  return;
260
261
  }
261
262
  e.onSelect(e.item, e.menu);
262
263
  }
263
264
  };
264
- Q(() => {
265
+ G(() => {
265
266
  k(), S(), q();
266
267
  });
267
- const U = () => e.portalLayout.projectPosition(t().position);
268
+ const W = () => e.portalLayout.projectPosition(t().position);
268
269
  return (() => {
269
- var u = Qe(), l = u.firstChild, p = l.firstChild;
270
- u.addEventListener("mouseleave", b), u.addEventListener("mouseenter", Y);
270
+ var u = Ge(), l = u.firstChild, b = l.firstChild;
271
+ u.addEventListener("mouseleave", y), u.addEventListener("mouseenter", K);
271
272
  var L = a;
272
- typeof L == "function" ? W(L, u) : a = u, l.$$keydown = (n) => {
273
+ typeof L == "function" ? Q(L, u) : a = u, l.$$keydown = (n) => {
273
274
  e.item.disabled || !h() || (n.key === "ArrowRight" || n.key === "Enter" || n.key === " ") && (n.preventDefault(), j("first"));
274
- }, l.$$click = K;
275
+ }, l.$$click = U;
275
276
  var P = g;
276
- return typeof P == "function" ? W(P, l) : g = l, M(l, d(F, {
277
+ return typeof P == "function" ? Q(P, l) : g = l, x(l, d(I, {
277
278
  get when() {
278
279
  return e.item.icon;
279
280
  },
280
- children: (n) => d(Me, {
281
+ children: (n) => d(Ce, {
281
282
  get component() {
282
283
  return n();
283
284
  },
284
285
  class: "w-3.5 h-3.5 shrink-0 opacity-60"
285
286
  })
286
- }), p), M(p, () => e.item.label), M(l, d(F, {
287
+ }), b), x(b, () => e.item.label), x(l, d(I, {
287
288
  get when() {
288
289
  return ae(() => !!e.item.shortcut)() && !h();
289
290
  },
290
291
  get children() {
291
- var n = We();
292
- return M(n, () => e.item.shortcut), n;
292
+ var n = Qe();
293
+ return x(n, () => e.item.shortcut), n;
293
294
  }
294
- }), null), M(l, d(F, {
295
+ }), null), x(l, d(I, {
295
296
  get when() {
296
297
  return h();
297
298
  },
298
299
  get children() {
299
- return d(Pe, {
300
+ return d(Ie, {
300
301
  class: "w-3 h-3 shrink-0 text-[var(--floe-ink-soft)]"
301
302
  });
302
303
  }
303
- }), null), M(u, d(F, {
304
+ }), null), x(u, d(I, {
304
305
  get when() {
305
- return ae(() => !!A())() && h();
306
+ return ae(() => !!_())() && h();
306
307
  },
307
308
  get children() {
308
309
  return d(ce, {
@@ -310,11 +311,11 @@ function xe(e) {
310
311
  return e.portalLayout.mount();
311
312
  },
312
313
  get children() {
313
- var n = we(), o = f;
314
- return typeof o == "function" ? W(o, n) : f = n, de(n, me(() => e.portalLayout.scrollViewportProps(), {
315
- onScroll: () => I((r) => r + 1),
314
+ var n = pe(), o = m;
315
+ return typeof o == "function" ? Q(o, n) : m = n, de(n, me(() => e.portalLayout.scrollViewportProps(), {
316
+ onScroll: () => A((i) => i + 1),
316
317
  get class() {
317
- return ee(e.portalLayout.isSurfaceMode() ? "absolute z-20 py-1" : "fixed z-50 py-1", "bg-popover border border-[var(--floe-line)] rounded-control shadow-[var(--floe-elevation-float)] overflow-y-auto overscroll-contain touch-pan-y motion-reduce:animate-none", _() && "animate-in fade-in slide-in-from-left-1");
318
+ return ee(e.portalLayout.isSurfaceMode() ? "absolute z-20 py-1" : "fixed z-50 py-1", "bg-popover border border-[var(--floe-line)] rounded-control shadow-[var(--floe-elevation-float)] overflow-y-auto overscroll-contain touch-pan-y motion-reduce:animate-none", D() && "animate-in fade-in slide-in-from-left-1");
318
319
  },
319
320
  get "data-floe-context-menu"() {
320
321
  return e.contextMenuId;
@@ -326,28 +327,28 @@ function xe(e) {
326
327
  get style() {
327
328
  return {
328
329
  ...e.portalLayout.sizeStyle(),
329
- left: `${U().x}px`,
330
- top: `${U().y}px`,
331
- visibility: _() ? "visible" : "hidden",
332
- "pointer-events": _() ? "auto" : "none"
330
+ left: `${W().x}px`,
331
+ top: `${W().y}px`,
332
+ visibility: D() ? "visible" : "hidden",
333
+ "pointer-events": D() ? "auto" : "none"
333
334
  };
334
335
  },
335
336
  role: "menu",
336
337
  get "aria-hidden"() {
337
- return _() ? void 0 : "true";
338
+ return D() ? void 0 : "true";
338
339
  },
339
340
  onMouseEnter: k,
340
- onMouseLeave: b,
341
- onKeyDown: (r) => be(r, {
341
+ onMouseLeave: y,
342
+ onKeyDown: (i) => be(i, {
342
343
  onDismiss: e.onDismiss,
343
- onCloseSubmenu: y
344
+ onCloseSubmenu: w
344
345
  })
345
- }), !1, !0), M(n, d(he, {
346
+ }), !1, !0), x(n, d(he, {
346
347
  get each() {
347
348
  return e.item.children;
348
349
  },
349
- children: (r) => [d(xe, {
350
- item: r,
350
+ children: (i) => [d(xe, {
351
+ item: i,
351
352
  get path() {
352
353
  return [...e.path, e.item];
353
354
  },
@@ -369,12 +370,12 @@ function xe(e) {
369
370
  get onDismiss() {
370
371
  return e.onDismiss;
371
372
  }
372
- }), d(F, {
373
+ }), d(I, {
373
374
  get when() {
374
- return r.separator;
375
+ return i.separator;
375
376
  },
376
377
  get children() {
377
- return ye();
378
+ return we();
378
379
  }
379
380
  })]
380
381
  })), n;
@@ -382,8 +383,8 @@ function xe(e) {
382
383
  });
383
384
  }
384
385
  }), null), R((n) => {
385
- var o = e.item.disabled || !h() && e.item.type === "rename" && e.menu.items.length > 1, r = ee("w-full flex items-center gap-2 px-3 py-1.5 text-xs cursor-pointer", "transition-colors duration-[var(--floe-duration-instant)]", "hover:bg-[var(--floe-state-selected)] hover:text-accent-foreground", "focus:outline-none focus-visible:bg-[var(--floe-state-selected)] 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 = e.item.id, m = e.portalLayout.touch() ? "44px" : void 0, x = h() ? "menu" : void 0, D = h() ? A() : void 0;
386
- return o !== n.e && (l.disabled = n.e = o), r !== n.t && Ce(l, n.t = r), i !== n.a && E(l, "data-file-menu-item", n.a = i), m !== n.o && fe(l, "min-height", n.o = m), x !== n.i && E(l, "aria-haspopup", n.i = x), D !== n.n && E(l, "aria-expanded", n.n = D), n;
386
+ var o = e.item.disabled || !h() && e.item.type === "rename" && e.menu.items.length > 1, i = ee("w-full flex items-center gap-2 px-3 py-1.5 text-xs cursor-pointer", "transition-colors duration-[var(--floe-duration-instant)]", "hover:bg-[var(--floe-state-selected)] hover:text-accent-foreground", "focus:outline-none focus-visible:bg-[var(--floe-state-selected)] 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"), r = e.item.id, f = e.portalLayout.touch() ? "44px" : void 0, C = h() ? "menu" : void 0, F = h() ? _() : void 0;
387
+ return o !== n.e && (l.disabled = n.e = o), i !== n.t && Me(l, n.t = i), r !== n.a && E(l, "data-file-menu-item", n.a = r), f !== n.o && fe(l, "min-height", n.o = f), C !== n.i && E(l, "aria-haspopup", n.i = C), F !== n.n && E(l, "aria-expanded", n.n = F), n;
387
388
  }, {
388
389
  e: void 0,
389
390
  t: void 0,
@@ -394,21 +395,21 @@ function xe(e) {
394
395
  }), u;
395
396
  })();
396
397
  }
397
- function bt(e) {
398
- const t = He(), s = Ve(), [a, g] = z(!1), [f, v] = z([]), [w, O] = z(0);
399
- let $ = null, B = "first", I;
400
- const h = typeof window > "u" || typeof document > "u", A = `floe-context-menu-${rt += 1}`, [_, N] = z(T("closed"));
398
+ function Ct(e) {
399
+ const t = ze(), s = He(), [a, g] = z(!1), [m, v] = z([]), [p, O] = z(0);
400
+ let $ = null, B = "first", A;
401
+ const h = typeof window > "u" || typeof document > "u", _ = `floe-context-menu-${it += 1}`, [D, N] = z(T("closed"));
401
402
  let V, k = 0;
402
- const S = le(() => t.contextMenu() ? _e({
403
+ const S = le(() => t.contextMenu() ? De({
403
404
  owner: e.owner
404
405
  }) : {
405
406
  host: null,
406
407
  boundaryHost: null,
407
408
  mountHost: null,
408
409
  mode: "global"
409
- }), q = le(() => (t.contextMenu(), Ie())), j = () => Ae(S(), e.boundary, q()), y = {
410
- mount: () => je(S()),
411
- isSurfaceMode: () => Be(S()),
410
+ }), q = le(() => (t.contextMenu(), Ae())), j = () => _e(S(), e.boundary, q()), w = {
411
+ mount: () => Ve(S()),
412
+ isSurfaceMode: () => je(S()),
412
413
  boundaryRect: () => j() ?? {
413
414
  left: 0,
414
415
  top: 0,
@@ -423,197 +424,209 @@ function bt(e) {
423
424
  B = o, v(n);
424
425
  },
425
426
  sizeStyle: () => {
426
- const n = j(), o = Te(S()), r = Math.max(0, (n?.width ?? 0) - 16) / o.x;
427
+ const n = j(), o = Be(S()), i = Math.max(0, (n?.width ?? 0) - 16) / o.x;
427
428
  return {
428
429
  width: "max-content",
429
430
  "transition-property": "none",
430
431
  "animation-duration": "100ms",
431
- "min-width": `${Math.min(180, r)}px`,
432
- "max-width": `${r}px`,
432
+ "min-width": `${Math.min(180, i)}px`,
433
+ "max-width": `${i}px`,
433
434
  "max-height": `${Math.max(0, (n?.height ?? 0) - 16) / o.y}px`
434
435
  };
435
436
  },
436
- projectPosition: (n) => Fe(n, S())
437
- }, Y = () => {
438
- const n = f().at(-1);
437
+ projectPosition: (n) => Te(n, S())
438
+ }, K = () => {
439
+ const n = m().at(-1);
439
440
  if (n) return n.children ?? [];
440
441
  if (e.overrideItems)
441
442
  return e.overrideItems;
442
443
  const o = () => {
443
- const m = e.hideItems;
444
- if (!m) return [];
445
- if (typeof m == "function") {
446
- const x = t.contextMenu()?.items ?? [];
447
- return m(x);
444
+ const f = e.hideItems;
445
+ if (!f) return [];
446
+ if (typeof f == "function") {
447
+ const C = t.contextMenu()?.items ?? [];
448
+ return f(C);
448
449
  }
449
- return m;
450
+ return f;
450
451
  };
451
- let r = it(e.callbacks);
452
- const i = o();
453
- return i.length > 0 && (r = r.filter((m) => !i.includes(m.type))), e.customItems?.length && (r = [...r, ...e.customItems]), r;
454
- }, b = (n = !1) => {
452
+ let i = st(e.callbacks);
453
+ const r = o();
454
+ return r.length > 0 && (i = i.filter((f) => !r.includes(f.type))), e.customItems?.length && (i = [...i, ...e.customItems]), i;
455
+ }, y = (n = !1) => {
455
456
  const o = $;
456
457
  t.hideContextMenu(), n && o?.isConnected && o.focus({
457
458
  preventScroll: !0
458
459
  });
459
- }, K = () => {
460
- B = f().at(-1)?.id ?? "first", v((n) => n.slice(0, -1));
461
- }, U = (n, o) => {
460
+ }, U = () => {
461
+ B = m().at(-1)?.id ?? "first", v((n) => n.slice(0, -1));
462
+ }, W = (n, o) => {
462
463
  t.hideContextMenu();
463
- const r = [...o.items], i = e.callbacks;
464
- Ee(() => {
465
- st(n, r, i, o);
464
+ const i = [...o.items], r = e.callbacks;
465
+ Le(() => {
466
+ at(n, i, r, o);
466
467
  });
467
468
  }, u = (n) => {
468
- if (!I) return n;
469
- const o = I.getBoundingClientRect();
470
- return $e(n, o, y.boundaryRect());
469
+ if (!A) return n;
470
+ const o = A.getBoundingClientRect();
471
+ return $e(n, o, w.boundaryRect());
471
472
  }, l = () => {
472
473
  oe(V), V = void 0;
473
474
  };
474
475
  H(() => {
475
476
  if (h || !t.contextMenu()) return;
476
- const n = lt({
477
+ const n = ut({
477
478
  ownerWindow: window,
478
- contextMenuId: A,
479
- onDismiss: (o) => b(o === "escape")
479
+ contextMenuId: _,
480
+ onDismiss: (o) => y(o === "escape")
480
481
  });
481
- Q(() => {
482
+ G(() => {
482
483
  n();
483
484
  });
484
485
  }), H(() => {
485
486
  const n = t.contextMenu();
486
- J(() => {
487
+ X(() => {
487
488
  v([]), B = "first";
488
- const o = De()?.target, r = o?.closest("button, [tabindex], a[href]") ?? o;
489
- $ = e.owner ?? (r instanceof HTMLElement ? r : !h && document.activeElement instanceof HTMLElement ? document.activeElement : null), g(typeof window < "u" && !!window.matchMedia?.(`${s.config.layout.mobileQuery}, (pointer: coarse)`).matches);
489
+ const o = Fe()?.target, i = o?.closest("button, [tabindex], a[href]") ?? o;
490
+ $ = e.owner ?? (i instanceof HTMLElement ? i : !h && document.activeElement instanceof HTMLElement ? document.activeElement : null), g(typeof window < "u" && !!window.matchMedia?.(`${s.config.layout.mobileQuery}, (pointer: coarse)`).matches);
490
491
  }), n || (l(), N(T("closed", ++k)));
491
492
  }), H(() => {
492
493
  const n = t.contextMenu();
493
- if (f(), e.boundary, !n) return;
494
+ if (m(), e.boundary, !n) return;
494
495
  l();
495
- const o = ++k, r = {
496
+ const o = ++k, i = {
496
497
  x: n.x,
497
498
  y: n.y
498
499
  };
499
- N(T("measuring", o, r)), V = ne(() => J(() => {
500
+ N(T("measuring", o, i)), V = ne(() => X(() => {
500
501
  if (V = void 0, k !== o) return;
501
- const i = j();
502
- if (!i || e.boundary !== void 0 && (i.width <= 16 || i.height <= 16)) {
503
- b();
502
+ const r = j();
503
+ if (!r || e.boundary !== void 0 && (r.width <= 16 || r.height <= 16)) {
504
+ y();
504
505
  return;
505
506
  }
506
- const m = u(r);
507
- N(T("positioned", o, r, m));
508
- const x = B, D = Array.from(I?.querySelectorAll("[data-file-menu-item]") ?? []).find((Z) => Z.dataset.fileMenuItem === x);
509
- D ? D.focus({
507
+ const f = u(i);
508
+ N(T("positioned", o, i, f));
509
+ const C = B, F = Array.from(A?.querySelectorAll("[data-file-menu-item]") ?? []).find((Z) => Z.dataset.fileMenuItem === C);
510
+ F ? F.focus({
510
511
  preventScroll: !0
511
- }) : X(I, x === "last" ? "last" : "first"), B = "first";
512
+ }) : Y(A, C === "last" ? "last" : "first"), B = "first";
512
513
  }));
513
- }), H(Se(() => e.boundary, () => {
514
- t.contextMenu() && b();
514
+ }), H(Ee(() => e.boundary, () => {
515
+ t.contextMenu() && y();
515
516
  }, {
516
517
  defer: !0
517
518
  })), H(() => {
518
519
  if (!t.contextMenu() || h) return;
519
- const n = () => b();
520
+ const n = () => y();
520
521
  window.visualViewport?.addEventListener("resize", n), window.visualViewport?.addEventListener("scroll", n), window.addEventListener("blur", n);
521
522
  const o = (c) => {
522
- te(_()) && !G(c, A) && b();
523
+ te(D()) && !J(c, _) && y();
523
524
  };
524
525
  document.addEventListener("focusin", o, !0);
525
- const r = e.boundary, i = [S().boundaryHost, r instanceof HTMLElement ? r : null].filter((c) => !!c), m = i.map((c) => c.getBoundingClientRect()), x = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
526
- i.some((c, ie) => {
526
+ const i = e.boundary, r = [S().boundaryHost, i instanceof HTMLElement ? i : null].filter((c) => !!c), f = r.map((c) => c.getBoundingClientRect()), C = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
527
+ r.some((c, ie) => {
527
528
  const se = c.getBoundingClientRect();
528
- return se.width !== m[ie].width || se.height !== m[ie].height;
529
- }) && b();
529
+ return se.width !== f[ie].width || se.height !== f[ie].height;
530
+ }) && y();
530
531
  });
531
- i.forEach((c) => x?.observe(c));
532
- const D = e.owner ?? $ ?? i[0], Z = [];
533
- for (let c = D; c; c = c.parentElement) Z.push(c);
532
+ r.forEach((c) => C?.observe(c));
533
+ const F = e.owner ?? $ ?? r[0], Z = [];
534
+ for (let c = F; c; c = c.parentElement) Z.push(c);
534
535
  const re = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
535
- Z.some((c) => !c.isConnected || c.inert || c.hidden || c.getAttribute("aria-hidden") === "true" || getComputedStyle(c).display === "none" || getComputedStyle(c).visibility === "hidden") && b();
536
+ Z.some((c) => !c.isConnected || c.inert || c.hidden || c.getAttribute("aria-hidden") === "true" || getComputedStyle(c).display === "none" || getComputedStyle(c).visibility === "hidden") && y();
536
537
  });
537
538
  Z.forEach((c) => re?.observe(c, {
538
539
  attributes: !0,
539
540
  attributeFilter: ["hidden", "inert", "aria-hidden", "style", "class"]
540
- })), Q(() => {
541
- x?.disconnect(), re?.disconnect(), document.removeEventListener("focusin", o, !0), window.visualViewport?.removeEventListener("resize", n), window.visualViewport?.removeEventListener("scroll", n), window.removeEventListener("blur", n);
541
+ })), G(() => {
542
+ C?.disconnect(), re?.disconnect(), document.removeEventListener("focusin", o, !0), window.visualViewport?.removeEventListener("resize", n), window.visualViewport?.removeEventListener("scroll", n), window.removeEventListener("blur", n);
542
543
  });
543
- }), Q(() => {
544
+ }), G(() => {
544
545
  l();
545
546
  });
546
- const p = () => te(_()), L = () => y.projectPosition(_().position), P = (n) => (() => {
547
- var o = we(), r = I;
548
- return typeof r == "function" ? W(r, o) : I = o, de(o, me(() => e.scrollViewportProps, {
549
- onScroll: () => O((i) => i + 1),
547
+ const b = () => te(D()), L = () => w.projectPosition(D().position), P = (n) => (() => {
548
+ var o = pe(), i = A;
549
+ return typeof i == "function" ? Q(i, o) : A = o, de(o, me(() => e.scrollViewportProps, {
550
+ onScroll: () => O((r) => r + 1),
550
551
  get class() {
551
- return ee(y.isSurfaceMode() ? "absolute z-20 py-1" : "fixed z-50 py-1", "bg-popover border border-[var(--floe-line)] rounded-control shadow-[var(--floe-elevation-float)] overflow-y-auto overscroll-contain touch-pan-y motion-reduce:animate-none", p() && (a() ? "animate-in fade-in" : "animate-in fade-in zoom-in-95"));
552
+ return ee(w.isSurfaceMode() ? "absolute z-20 py-1" : "fixed z-50 py-1", "bg-popover border border-[var(--floe-line)] rounded-control shadow-[var(--floe-elevation-float)] overflow-y-auto overscroll-contain touch-pan-y motion-reduce:animate-none", b() && (a() ? "animate-in fade-in" : "animate-in fade-in zoom-in-95"));
552
553
  },
553
- "data-floe-context-menu": A
554
+ "data-floe-context-menu": _
554
555
  }, () => ({
555
556
  [ge]: "true",
556
- [ve]: y.isSurfaceMode() ? "true" : void 0
557
+ [ve]: w.isSurfaceMode() ? "true" : void 0
557
558
  }), {
558
559
  get style() {
559
560
  return {
560
- ...y.sizeStyle(),
561
+ ...w.sizeStyle(),
561
562
  left: `${L().x}px`,
562
563
  top: `${L().y}px`,
563
- visibility: p() ? "visible" : "hidden",
564
- "pointer-events": p() ? "auto" : "none"
564
+ visibility: b() ? "visible" : "hidden",
565
+ "pointer-events": b() ? "auto" : "none"
565
566
  };
566
567
  },
567
568
  role: "menu",
568
569
  get "aria-hidden"() {
569
- return p() ? void 0 : "true";
570
+ return b() ? void 0 : "true";
570
571
  },
571
572
  "aria-orientation": "vertical",
572
- onKeyDown: (i) => be(i, {
573
- onDismiss: () => b(i.key === "Escape" || i.key === "Tab"),
574
- onCloseSubmenu: f().length ? K : void 0
573
+ onKeyDown: (r) => be(r, {
574
+ onDismiss: () => y(r.key === "Escape" || r.key === "Tab"),
575
+ onCloseSubmenu: m().length ? U : void 0
575
576
  }),
576
- onContextMenu: (i) => i.preventDefault()
577
- }), !1, !0), M(o, d(F, {
577
+ onContextMenu: (r) => r.preventDefault()
578
+ }), !1, !0), x(o, d(I, {
578
579
  get when() {
579
- return f().length > 0;
580
+ return m().length > 0;
580
581
  },
581
582
  get children() {
582
- var i = Ge(), m = i.firstChild, x = m.nextSibling;
583
- return i.$$click = K, M(i, d(Le, {
583
+ var r = Je(), f = r.firstChild, C = f.nextSibling;
584
+ return r.$$click = U, x(r, d(Pe, {
584
585
  class: "h-3.5 w-3.5 shrink-0"
585
- }), m), M(m, () => e.backLabel ?? "Back"), M(x, () => f().at(-1)?.label), R((D) => fe(i, "min-height", a() ? "44px" : void 0)), i;
586
+ }), f), x(f, () => e.backLabel ?? "Back"), x(C, () => m().at(-1)?.label), R((F) => fe(r, "min-height", a() ? "44px" : void 0)), r;
587
+ }
588
+ }), null), x(o, d(I, {
589
+ get when() {
590
+ return m().length === 0;
591
+ },
592
+ get children() {
593
+ return d(Se, {
594
+ onClose: () => y(!1),
595
+ get excludeIds() {
596
+ return K().map((r) => r.contextActionId ?? r.id);
597
+ }
598
+ });
586
599
  }
587
- }), null), M(o, d(he, {
600
+ }), null), x(o, d(he, {
588
601
  get each() {
589
- return Y();
602
+ return K();
590
603
  },
591
- children: (i) => [d(xe, {
592
- item: i,
604
+ children: (r) => [d(xe, {
605
+ item: r,
593
606
  get path() {
594
- return f();
607
+ return m();
595
608
  },
596
609
  get scrollRevision() {
597
- return w();
610
+ return p();
598
611
  },
599
612
  get menu() {
600
613
  return n.menu();
601
614
  },
602
- contextMenuId: A,
603
- portalLayout: y,
604
- onSelect: U,
605
- onDismiss: () => b(!0)
606
- }), d(F, {
615
+ contextMenuId: _,
616
+ portalLayout: w,
617
+ onSelect: W,
618
+ onDismiss: () => y(!0)
619
+ }), d(I, {
607
620
  get when() {
608
- return i.separator;
621
+ return r.separator;
609
622
  },
610
623
  get children() {
611
- return ye();
624
+ return we();
612
625
  }
613
626
  })]
614
627
  }), null), o;
615
628
  })();
616
- return d(F, {
629
+ return d(I, {
617
630
  get when() {
618
631
  return t.contextMenu();
619
632
  },
@@ -621,7 +634,7 @@ function bt(e) {
621
634
  menu: n
622
635
  }) : d(ce, {
623
636
  get mount() {
624
- return y.mount();
637
+ return w.mount();
625
638
  },
626
639
  get children() {
627
640
  return d(P, {
@@ -633,8 +646,8 @@ function bt(e) {
633
646
  }
634
647
  ke(["click", "keydown"]);
635
648
  export {
636
- bt as FileContextMenu,
637
- it as createDefaultContextMenuItems,
638
- st as dispatchContextMenuAction,
639
- lt as installContextMenuDismissListeners
649
+ Ct as FileContextMenu,
650
+ st as createDefaultContextMenuItems,
651
+ at as dispatchContextMenuAction,
652
+ ut as installContextMenuDismissListeners
640
653
  };