@floegence/floe-webapp-core 0.36.13 → 0.36.15

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,11 +1,11 @@
1
- import { setAttribute as v, insert as f, createComponent as u, Portal as z, use as R, spread as U, mergeProps as H, effect as I, className as E, template as $, memo as K, delegateEvents as V } from "solid-js/web";
1
+ import { setAttribute as v, insert as f, createComponent as a, Portal as N, use as R, spread as z, mergeProps as U, effect as I, className as E, template as $, memo as H, delegateEvents as V } from "solid-js/web";
2
2
  import { createSignal as O, createMemo as X, createEffect as Y, onCleanup as Z, Show as y, Index as W } from "solid-js";
3
3
  import { cn as S } from "../../utils/cn.js";
4
4
  import { deferNonBlocking as ee } from "../../utils/defer.js";
5
5
  import { ChevronDown as te, Check as ne, ChevronRight as re } from "../icons/index.js";
6
- import { focusMenuItem as P, MENU_ITEM_SELECTOR as oe, moveMenuFocus as N, calculateMenuPosition as ie, calculateSubmenuPosition as ae } from "./menuUtils.js";
6
+ import { focusMenuItem as P, MENU_ITEM_SELECTOR as oe, moveMenuFocus as K, calculateMenuPosition as ie, calculateSubmenuPosition as ue } from "./menuUtils.js";
7
7
  import { LOCAL_INTERACTION_SURFACE_ATTR as G } from "./localInteractionSurface.js";
8
- import { resolveSurfacePortalHost as ue, projectSurfacePortalPosition as le, resolveSurfacePortalBoundaryRect as de, isSurfacePortalMode as ce, resolveSurfacePortalMount as se } from "./dialogSurfaceScope.js";
8
+ import { resolveSurfacePortalHost as ae, projectSurfacePortalPosition as le, resolveSurfacePortalBoundaryRect as de, isSurfacePortalMode as ce, resolveSurfacePortalMount as se } from "./dialogSurfaceScope.js";
9
9
  var F = /* @__PURE__ */ $("<div>"), fe = /* @__PURE__ */ $("<div><div role=button aria-haspopup=menu data-floe-dropdown-trigger>"), J = /* @__PURE__ */ $('<div class="my-1 h-px bg-border"role=separator>'), me = /* @__PURE__ */ $('<button type=button role=menuitem><span class="w-3.5 h-3.5 flex items-center justify-center"></span><span class="flex-1 text-left">'), ge = /* @__PURE__ */ $("<div class=relative>"), ve = /* @__PURE__ */ $('<span class="w-3.5 h-3.5 flex items-center justify-center">'), be = /* @__PURE__ */ $("<span>");
10
10
  let he = 0, we = 0;
11
11
  function ye(e, d) {
@@ -38,17 +38,19 @@ function xe(e) {
38
38
  y: -9999
39
39
  });
40
40
  let b, h;
41
- const m = `floe-dropdown-${he += 1}`, w = `${m}-menu`, k = X(() => d() ? ue() : {
41
+ const m = `floe-dropdown-${he += 1}`, w = `${m}-menu`, k = X(() => d() ? ae() : {
42
42
  host: null,
43
+ boundaryHost: null,
44
+ mountHost: null,
43
45
  mode: "global"
44
- }), a = {
46
+ }), u = {
45
47
  mount: () => se(k()),
46
48
  isSurfaceMode: () => ce(k()),
47
49
  boundaryRect: () => de(k()),
48
50
  projectPosition: (r) => le(r, k())
49
51
  }, M = () => {
50
52
  if (!b || !h) return;
51
- const r = b.getBoundingClientRect(), n = h.getBoundingClientRect(), i = ie(r, n, e.align ?? "start", a.boundaryRect());
53
+ const r = b.getBoundingClientRect(), n = h.getBoundingClientRect(), i = ie(r, n, e.align ?? "start", u.boundaryRect());
52
54
  A(i);
53
55
  };
54
56
  Y(() => {
@@ -65,10 +67,10 @@ function xe(e) {
65
67
  }, n = (i) => {
66
68
  i.key === "Escape" && (c(!1), requestAnimationFrame(() => b?.focus()));
67
69
  };
68
- document.addEventListener("mousedown", r), document.addEventListener("keydown", n), requestAnimationFrame(() => {
70
+ document.addEventListener("pointerdown", r, !0), document.addEventListener("keydown", n), requestAnimationFrame(() => {
69
71
  M(), P(h, e.value ? "selected" : "first");
70
72
  }), Z(() => {
71
- document.removeEventListener("mousedown", r), document.removeEventListener("keydown", n);
73
+ document.removeEventListener("pointerdown", r, !0), document.removeEventListener("keydown", n);
72
74
  });
73
75
  });
74
76
  const _ = (r) => {
@@ -95,10 +97,10 @@ function xe(e) {
95
97
  const n = r.target, i = n?.closest('[role="menu"]'), t = n?.closest(oe);
96
98
  switch (r.key) {
97
99
  case "ArrowDown":
98
- r.preventDefault(), N(i, t, 1);
100
+ r.preventDefault(), K(i, t, 1);
99
101
  return;
100
102
  case "ArrowUp":
101
- r.preventDefault(), N(i, t, -1);
103
+ r.preventDefault(), K(i, t, -1);
102
104
  return;
103
105
  case "Home":
104
106
  r.preventDefault(), P(i, "first");
@@ -125,38 +127,38 @@ function xe(e) {
125
127
  }
126
128
  };
127
129
  var i = b;
128
- return typeof i == "function" ? R(i, n) : b = n, v(n, "aria-controls", w), f(n, () => e.trigger), f(r, u(y, {
130
+ return typeof i == "function" ? R(i, n) : b = n, v(n, "aria-controls", w), f(n, () => e.trigger), f(r, a(y, {
129
131
  get when() {
130
132
  return d();
131
133
  },
132
134
  get children() {
133
- return u(z, {
135
+ return a(N, {
134
136
  get mount() {
135
- return a.mount();
137
+ return u.mount();
136
138
  },
137
139
  get children() {
138
140
  var t = F(), g = h;
139
- return typeof g == "function" ? R(g, t) : h = t, v(t, "data-floe-dropdown", m), U(t, H({
141
+ return typeof g == "function" ? R(g, t) : h = t, v(t, "data-floe-dropdown", m), z(t, U({
140
142
  get class() {
141
- return S(a.isSurfaceMode() ? "absolute z-20 min-w-36 py-0.5" : "fixed z-50 min-w-36 py-0.5", "bg-popover text-popover-foreground", "rounded border border-border shadow-md", "animate-in fade-in slide-in-from-top-2");
143
+ return S(u.isSurfaceMode() ? "absolute z-20 min-w-36 py-0.5" : "fixed z-50 min-w-36 py-0.5", "bg-popover text-popover-foreground", "rounded border border-border shadow-md", "animate-in fade-in slide-in-from-top-2");
142
144
  }
143
145
  }, () => ({
144
- [G]: a.isSurfaceMode() ? "true" : void 0
146
+ [G]: u.isSurfaceMode() ? "true" : void 0
145
147
  }), {
146
148
  get style() {
147
149
  return {
148
- left: `${a.projectPosition(s()).x}px`,
149
- top: `${a.projectPosition(s()).y}px`
150
+ left: `${u.projectPosition(s()).x}px`,
151
+ top: `${u.projectPosition(s()).y}px`
150
152
  };
151
153
  },
152
154
  role: "menu",
153
155
  id: w,
154
156
  onKeyDown: T
155
- }), !1, !0), f(t, u(W, {
157
+ }), !1, !0), f(t, a(W, {
156
158
  get each() {
157
159
  return e.items;
158
160
  },
159
- children: (l) => u(y, {
161
+ children: (l) => a(y, {
160
162
  get when() {
161
163
  return !l().separator;
162
164
  },
@@ -164,7 +166,7 @@ function xe(e) {
164
166
  return J();
165
167
  },
166
168
  get children() {
167
- return u(Q, {
169
+ return a(Q, {
168
170
  get item() {
169
171
  return l();
170
172
  },
@@ -174,7 +176,7 @@ function xe(e) {
174
176
  onSelect: _,
175
177
  onCloseMenu: () => c(!1),
176
178
  dropdownId: m,
177
- portalLayout: a
179
+ portalLayout: u
178
180
  });
179
181
  }
180
182
  })
@@ -201,16 +203,16 @@ function Q(e) {
201
203
  y: -9999
202
204
  });
203
205
  let b, h, m, w;
204
- const k = `floe-dropdown-item-${we += 1}`, a = () => e.item.children && e.item.children.length > 0, M = () => {
206
+ const k = `floe-dropdown-item-${we += 1}`, u = () => e.item.children && e.item.children.length > 0, M = () => {
205
207
  if (!b || !m) return;
206
- const n = b.getBoundingClientRect(), i = m.getBoundingClientRect(), t = ae(n, i, e.portalLayout.boundaryRect());
208
+ const n = b.getBoundingClientRect(), i = m.getBoundingClientRect(), t = ue(n, i, e.portalLayout.boundaryRect());
207
209
  A(t);
208
210
  }, _ = () => {
209
- a() && (clearTimeout(w), w = setTimeout(() => {
211
+ u() && (clearTimeout(w), w = setTimeout(() => {
210
212
  c(!0), requestAnimationFrame(M);
211
213
  }, 100));
212
214
  }, p = () => {
213
- a() && (clearTimeout(w), w = void 0, !e.item.keepOpen && (w = setTimeout(() => {
215
+ u() && (clearTimeout(w), w = void 0, !e.item.keepOpen && (w = setTimeout(() => {
214
216
  c(!1);
215
217
  }, 150)));
216
218
  }, D = (n) => {
@@ -219,10 +221,10 @@ function Q(e) {
219
221
  n.stopPropagation();
220
222
  return;
221
223
  }
222
- a() ? (c((i) => !i), requestAnimationFrame(M)) : e.item.content || e.onSelect(e.item);
224
+ u() ? (c((i) => !i), requestAnimationFrame(M)) : e.item.content || e.onSelect(e.item);
223
225
  }
224
226
  }, T = (n = "first") => {
225
- a() && (c(!0), requestAnimationFrame(() => {
227
+ u() && (c(!0), requestAnimationFrame(() => {
226
228
  M(), P(m, n);
227
229
  }));
228
230
  }, r = () => {
@@ -232,7 +234,7 @@ function Q(e) {
232
234
  var n = ge();
233
235
  n.addEventListener("mouseleave", p), n.addEventListener("mouseenter", _);
234
236
  var i = b;
235
- return typeof i == "function" ? R(i, n) : b = n, f(n, u(y, {
237
+ return typeof i == "function" ? R(i, n) : b = n, f(n, a(y, {
236
238
  get when() {
237
239
  return e.item.content;
238
240
  },
@@ -240,26 +242,26 @@ function Q(e) {
240
242
  var t = F();
241
243
  return t.$$click = D, f(t, e.item.content), I(() => E(t, S("w-full px-2 py-1.5", e.item.disabled && "opacity-50 pointer-events-none"))), t;
242
244
  }
243
- }), null), f(n, u(y, {
245
+ }), null), f(n, a(y, {
244
246
  get when() {
245
247
  return !e.item.content;
246
248
  },
247
249
  get children() {
248
250
  var t = me(), g = t.firstChild, l = g.nextSibling;
249
251
  t.$$keydown = (o) => {
250
- e.item.disabled || a() && ((o.key === "ArrowRight" || o.key === "Enter" || o.key === " ") && (o.preventDefault(), T("first")), o.key === "ArrowLeft" && (o.preventDefault(), r()));
252
+ e.item.disabled || u() && ((o.key === "ArrowRight" || o.key === "Enter" || o.key === " ") && (o.preventDefault(), T("first")), o.key === "ArrowLeft" && (o.preventDefault(), r()));
251
253
  }, t.$$click = D;
252
254
  var C = h;
253
- return typeof C == "function" ? R(C, t) : h = t, v(t, "id", k), f(g, u(y, {
255
+ return typeof C == "function" ? R(C, t) : h = t, v(t, "id", k), f(g, a(y, {
254
256
  get when() {
255
- return K(() => !!e.selected)() && !a();
257
+ return H(() => !!e.selected)() && !u();
256
258
  },
257
259
  get children() {
258
- return u(ne, {
260
+ return a(ne, {
259
261
  class: "w-3 h-3"
260
262
  });
261
263
  }
262
- })), f(t, u(y, {
264
+ })), f(t, a(y, {
263
265
  get when() {
264
266
  return e.item.icon;
265
267
  },
@@ -268,17 +270,17 @@ function Q(e) {
268
270
  var x = ve();
269
271
  return f(x, o), x;
270
272
  })()
271
- }), l), f(l, () => e.item.label), f(t, u(y, {
273
+ }), l), f(l, () => e.item.label), f(t, a(y, {
272
274
  get when() {
273
- return a();
275
+ return u();
274
276
  },
275
277
  get children() {
276
- return u(re, {
278
+ return a(re, {
277
279
  class: "w-3 h-3 text-muted-foreground"
278
280
  });
279
281
  }
280
282
  }), null), I((o) => {
281
- var x = S("w-full flex items-center gap-1.5 px-2 py-1 text-xs", "transition-colors duration-75", "focus:outline-none focus:bg-accent", e.item.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-accent cursor-pointer"), L = e.item.disabled, j = a() ? "menu" : void 0, q = a() ? d() : void 0, B = e.selected && !a() ? "true" : void 0;
283
+ var x = S("w-full flex items-center gap-1.5 px-2 py-1 text-xs", "transition-colors duration-75", "focus:outline-none focus:bg-accent", e.item.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-accent cursor-pointer"), L = e.item.disabled, j = u() ? "menu" : void 0, q = u() ? d() : void 0, B = e.selected && !u() ? "true" : void 0;
282
284
  return x !== o.e && E(t, o.e = x), L !== o.t && (t.disabled = o.t = L), j !== o.a && v(t, "aria-haspopup", o.a = j), q !== o.o && v(t, "aria-expanded", o.o = q), B !== o.i && v(t, "data-floe-selected", o.i = B), o;
283
285
  }, {
284
286
  e: void 0,
@@ -288,18 +290,18 @@ function Q(e) {
288
290
  i: void 0
289
291
  }), t;
290
292
  }
291
- }), null), f(n, u(y, {
293
+ }), null), f(n, a(y, {
292
294
  get when() {
293
- return K(() => !!d())() && a();
295
+ return H(() => !!d())() && u();
294
296
  },
295
297
  get children() {
296
- return u(z, {
298
+ return a(N, {
297
299
  get mount() {
298
300
  return e.portalLayout.mount();
299
301
  },
300
302
  get children() {
301
303
  var t = F(), g = m;
302
- return typeof g == "function" ? R(g, t) : m = t, U(t, H({
304
+ return typeof g == "function" ? R(g, t) : m = t, z(t, U({
303
305
  get class() {
304
306
  return S(e.portalLayout.isSurfaceMode() ? "absolute z-20 min-w-36 py-0.5" : "fixed z-50 min-w-36 py-0.5", "bg-popover text-popover-foreground", "rounded border border-border shadow-md", "animate-in fade-in slide-in-from-left-1");
305
307
  },
@@ -324,11 +326,11 @@ function Q(e) {
324
326
  onKeyDown: (l) => {
325
327
  l.key !== "ArrowLeft" && l.key !== "Escape" || (l.preventDefault(), l.stopPropagation(), r());
326
328
  }
327
- }), !1, !0), f(t, u(W, {
329
+ }), !1, !0), f(t, a(W, {
328
330
  get each() {
329
331
  return e.item.children;
330
332
  },
331
- children: (l) => u(y, {
333
+ children: (l) => a(y, {
332
334
  get when() {
333
335
  return !l().separator;
334
336
  },
@@ -336,7 +338,7 @@ function Q(e) {
336
338
  return J();
337
339
  },
338
340
  get children() {
339
- return u(Q, {
341
+ return a(Q, {
340
342
  get item() {
341
343
  return l();
342
344
  },
@@ -368,7 +370,7 @@ function Re(e) {
368
370
  id: s.value,
369
371
  label: s.label
370
372
  }));
371
- return u(xe, {
373
+ return a(xe, {
372
374
  get triggerClass() {
373
375
  return S("flex items-center justify-between gap-2 h-8 px-2.5 w-full", "rounded border border-input bg-background text-xs shadow-sm", "transition-colors duration-100", e.class);
374
376
  },
@@ -376,7 +378,7 @@ function Re(e) {
376
378
  return [(() => {
377
379
  var s = be();
378
380
  return f(s, () => d()?.label ?? e.placeholder ?? "Select..."), I(() => E(s, S("truncate", !d() && "text-muted-foreground"))), s;
379
- })(), u(te, {
381
+ })(), a(te, {
380
382
  class: "w-3.5 h-3.5 text-muted-foreground"
381
383
  })];
382
384
  },