@floegence/floe-webapp-core 0.101.29 → 0.101.33

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,22 +1,23 @@
1
- import { createComponent as r, use as q, setAttribute as c, style as ne, Portal as ae, spread as E, mergeProps as M, memo as x, insert as s, effect as P, className as K, template as m } from "solid-js/web";
2
- import { createSignal as T, onMount as le, onCleanup as B, createUniqueId as ie, createEffect as j, createMemo as U, Show as u, untrack as V } from "solid-js";
1
+ import { createComponent as r, use as K, setAttribute as f, style as ne, Portal as ae, spread as M, mergeProps as j, memo as x, insert as s, effect as D, className as N, template as m } from "solid-js/web";
2
+ import { createSignal as P, onMount as le, onCleanup as T, createUniqueId as ie, createEffect as E, createMemo as U, Show as u, untrack as V } from "solid-js";
3
3
  import { cn as g } from "../../utils/cn.js";
4
+ import { composedClosest as de } from "../../utils/domScope.js";
4
5
  import { Button as H } from "./Button.js";
5
- import { X as de } from "../icons/index.js";
6
- import { useResolvedFloeConfig as se } from "../../context/FloeConfigContext.js";
6
+ import { X as se } from "../icons/index.js";
7
+ import { useResolvedFloeConfig as ce } from "../../context/FloeConfigContext.js";
7
8
  import { useOverlayMask as fe } from "../../hooks/useOverlayMask.js";
8
- import { resolveSurfacePortalHost as ce, DIALOG_SURFACE_BOUNDARY_ATTR as S, SURFACE_PORTAL_LAYER_ATTR as ue, DIALOG_SURFACE_HOST_ATTR as ge, isSurfacePortalMode as z, projectSurfacePortalRect as me, resolveSurfacePortalBoundaryRect as he, resolveSurfacePortalMount as ve } from "./dialogSurfaceScope.js";
9
- import { LOCAL_INTERACTION_SURFACE_ATTR as be } from "./localInteractionSurface.js";
9
+ import { resolveSurfacePortalHost as ue, DIALOG_SURFACE_BOUNDARY_ATTR as F, SURFACE_PORTAL_LAYER_ATTR as ge, DIALOG_SURFACE_HOST_ATTR as me, isSurfacePortalMode as z, projectSurfacePortalRect as he, resolveSurfacePortalBoundaryRect as ve, resolveSurfacePortalMount as be } from "./dialogSurfaceScope.js";
10
+ import { LOCAL_INTERACTION_SURFACE_ATTR as we } from "./localInteractionSurface.js";
10
11
  import { createFloatingPresence as ye } from "./floatingPresence.js";
11
- import { observeDialogHeight as we } from "./dialogHeightMotion.js";
12
- import { useDialogPlacement as pe } from "./DialogPlacementContext.js";
13
- import { observeViewport as xe, viewportStyle as $e } from "../../viewport.js";
12
+ import { observeDialogHeight as pe } from "./dialogHeightMotion.js";
13
+ import { useDialogPlacement as xe } from "./DialogPlacementContext.js";
14
+ import { observeViewport as $e, viewportStyle as Ce } from "../../viewport.js";
14
15
  import { resolveFloatingBoundary as Ae } from "./surfaceFloatingBoundary.js";
15
- var Ce = /* @__PURE__ */ m("<span aria-hidden=true>"), _e = /* @__PURE__ */ m('<h2 class="text-[length:var(--floe-type-heading-sm)] font-semibold leading-[var(--floe-line-heading)] tracking-[var(--floe-tracking-tight)] text-[var(--floe-ink)]">'), ke = /* @__PURE__ */ m('<div data-floe-dialog-header class="flex shrink-0 items-start justify-between gap-[var(--floe-gap-control)] px-[var(--floe-pad-group)] py-[var(--floe-pad-control)] border-b border-[var(--floe-line)]"><div>'), Se = /* @__PURE__ */ m('<p class="mb-3 shrink-0 text-[length:var(--floe-type-body)] leading-[var(--floe-line-body)] text-[var(--floe-ink-soft)] last:mb-0">'), Oe = /* @__PURE__ */ m('<div data-floe-dialog-footer class="flex shrink-0 items-center justify-end gap-[var(--floe-gap-control)] px-[var(--floe-pad-group)] py-[var(--floe-pad-control)] border-t border-[var(--floe-line)]">'), Re = /* @__PURE__ */ m("<div><div></div><div><div data-floe-surface=floating><div data-floe-dialog-body>"), De = /* @__PURE__ */ m("<h2 class=sr-only>");
16
- const Pe = {
16
+ var _e = /* @__PURE__ */ m("<span aria-hidden=true>"), ke = /* @__PURE__ */ m('<h2 class="text-[length:var(--floe-type-heading-sm)] font-semibold leading-[var(--floe-line-heading)] tracking-[var(--floe-tracking-tight)] text-[var(--floe-ink)]">'), Se = /* @__PURE__ */ m('<div data-floe-dialog-header class="flex shrink-0 items-start justify-between gap-[var(--floe-gap-control)] px-[var(--floe-pad-group)] py-[var(--floe-pad-control)] border-b border-[var(--floe-line)]"><div>'), Oe = /* @__PURE__ */ m('<p class="mb-3 shrink-0 text-[length:var(--floe-type-body)] leading-[var(--floe-line-body)] text-[var(--floe-ink-soft)] last:mb-0">'), Re = /* @__PURE__ */ m('<div data-floe-dialog-footer class="flex shrink-0 items-center justify-end gap-[var(--floe-gap-control)] px-[var(--floe-pad-group)] py-[var(--floe-pad-control)] border-t border-[var(--floe-line)]">'), De = /* @__PURE__ */ m("<div><div></div><div><div data-floe-surface=floating><div data-floe-dialog-body>"), Pe = /* @__PURE__ */ m("<h2 class=sr-only>");
17
+ const Te = {
17
18
  display: "none"
18
19
  };
19
- function Te(e) {
20
+ function Fe(e) {
20
21
  if (typeof queueMicrotask == "function") {
21
22
  queueMicrotask(e);
22
23
  return;
@@ -29,61 +30,61 @@ function Z(e) {
29
30
  function Be(e) {
30
31
  return typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(e) : window.setTimeout(() => e(Date.now()), 16);
31
32
  }
32
- function Fe(e) {
33
+ function Ie(e) {
33
34
  if (typeof window < "u" && typeof window.cancelAnimationFrame == "function") {
34
35
  window.cancelAnimationFrame(e);
35
36
  return;
36
37
  }
37
38
  window.clearTimeout(e);
38
39
  }
39
- function Ie(e) {
40
- const $ = pe(), [n, W] = T();
41
- le(() => B(xe(window, W)));
42
- const f = ie(), F = () => `dialog-${f}-title`, L = () => `dialog-${f}-description`;
43
- let A;
44
- const [O, Y] = T(null), [N, X] = T(0), [J, Q] = T(0), C = () => e.presentation === "side-drawer", h = () => e.presentation === "bottom-drawer", i = ye({
45
- open: () => e.open && !!O() && N() > 0,
46
- element: () => A
47
- }), v = () => i.mounted() && !!O() && N() > 0;
48
- j(() => {
49
- const t = A, l = i.state();
50
- !t || l !== "open" || !v() || B(we(t, {
40
+ function Me(e) {
41
+ const $ = xe(), [n, W] = P();
42
+ le(() => T($e(window, W)));
43
+ const c = ie(), B = () => `dialog-${c}-title`, L = () => `dialog-${c}-description`;
44
+ let C;
45
+ const [k, Y] = P(null), [G, X] = P(0), [J, Q] = P(0), A = () => e.presentation === "side-drawer", h = () => e.presentation === "bottom-drawer", i = ye({
46
+ open: () => e.open && !!k() && G() > 0,
47
+ element: () => C
48
+ }), v = () => i.mounted() && !!k() && G() > 0;
49
+ E(() => {
50
+ const t = C, l = i.state();
51
+ !t || l !== "open" || !v() || T(pe(t, {
51
52
  isSettled: () => i.state() === "open"
52
53
  }));
53
- }), j(() => e.onPresenceChange?.(v())), B(() => e.onPresenceChange?.(!1));
54
+ }), E(() => e.onPresenceChange?.(v())), T(() => e.onPresenceChange?.(!1));
54
55
  const ee = (t) => {
55
- Y(t), Te(() => {
56
- V(O) === t && X((l) => l + 1);
56
+ Y(t), Fe(() => {
57
+ V(k) === t && X((l) => l + 1);
57
58
  });
58
- }, R = U(() => v() ? ce({
59
- owner: O()
59
+ }, S = U(() => v() ? ue({
60
+ owner: k()
60
61
  }) : {
61
62
  host: null,
62
63
  boundaryHost: null,
63
64
  mountHost: null,
64
65
  mode: "global"
65
- }), _ = () => `dialog-boundary-${f}`, a = () => $.mode() === "auto" && z(R()), te = () => a() ? ve(R()) : void 0, G = () => e.globalZIndex ?? $.globalZIndex(), I = (t) => me(Ae(t, void 0, V(n)?.safeArea) ?? he(t), t), oe = () => I(R()), D = U(() => (J(), n(), oe())), re = (t) => typeof Element < "u" && t instanceof Element ? !!t.closest(`[${S}="${_()}"]`) : typeof Node < "u" && t instanceof Node ? !!t.parentElement?.closest(`[${S}="${_()}"]`) : !1;
66
- return j(() => {
67
- const t = R();
66
+ }), O = () => `dialog-boundary-${c}`, a = () => $.mode() === "auto" && z(S()), te = () => a() ? be(S()) : void 0, q = () => e.globalZIndex ?? $.globalZIndex(), I = (t) => he(Ae(t, void 0, V(n)?.safeArea) ?? ve(t), t), oe = () => I(S()), R = U(() => (J(), n(), oe())), re = (t) => !!de(t, `[${F}="${O()}"]`);
67
+ return E(() => {
68
+ const t = S();
68
69
  if (!v() || !a() || typeof window > "u")
69
70
  return;
70
71
  let l = !1, b = null, d = Z(I(t));
71
- const y = () => {
72
+ const w = () => {
72
73
  if (l || !z(t))
73
74
  return;
74
75
  const o = Z(I(t));
75
- o !== d && (d = o, Q((w) => w + 1));
76
- }, k = () => {
76
+ o !== d && (d = o, Q((y) => y + 1));
77
+ }, _ = () => {
77
78
  l || (b = Be(() => {
78
- y(), k();
79
+ w(), _();
79
80
  }));
80
81
  };
81
- k(), B(() => {
82
- l = !0, b !== null && Fe(b);
82
+ _(), T(() => {
83
+ l = !0, b !== null && Ie(b);
83
84
  });
84
85
  }), fe({
85
86
  open: v,
86
- root: () => A,
87
+ root: () => C,
87
88
  containsTarget: re,
88
89
  onClose: () => e.onOpenChange(!1),
89
90
  lockBodyScroll: () => !a(),
@@ -96,8 +97,8 @@ function Ie(e) {
96
97
  blockTouchMove: () => a() ? "none" : "outside",
97
98
  restoreFocus: !0
98
99
  }), [(() => {
99
- var t = Ce();
100
- return q(ee, t), c(t, "data-floe-dialog-owner-anchor", f), ne(t, Pe), t;
100
+ var t = _e();
101
+ return K(ee, t), f(t, "data-floe-dialog-owner-anchor", c), ne(t, Te), t;
101
102
  })(), r(u, {
102
103
  get when() {
103
104
  return v();
@@ -108,8 +109,8 @@ function Ie(e) {
108
109
  return te();
109
110
  },
110
111
  get children() {
111
- var t = Re(), l = t.firstChild, b = l.nextSibling, d = b.firstChild, y = d.firstChild;
112
- c(t, "data-floe-dialog-overlay-root", f), E(t, M({
112
+ var t = De(), l = t.firstChild, b = l.nextSibling, d = b.firstChild, w = d.firstChild;
113
+ f(t, "data-floe-dialog-overlay-root", c), M(t, j({
113
114
  get "data-floe-dialog-mode"() {
114
115
  return a() ? "surface" : "global";
115
116
  },
@@ -123,22 +124,22 @@ function Ie(e) {
123
124
  return i.exiting() ? "true" : void 0;
124
125
  }
125
126
  }, {
126
- [be]: "true"
127
+ [we]: "true"
127
128
  }, () => ({
128
- [ue]: "true",
129
- [S]: _()
129
+ [ge]: "true",
130
+ [F]: O()
130
131
  }), {
131
132
  get class() {
132
- return g(a() ? g("absolute z-20 box-border", !C() && "p-3") : g("fixed box-border p-4", G() === void 0 && "z-50"), h() && "floe-bottom-drawer-overlay", C() && "floe-side-drawer-overlay", i.exiting() && !h() && "pointer-events-none");
133
+ return g(a() ? g("absolute z-20 box-border", !A() && "p-3") : g("fixed box-border p-4", q() === void 0 && "z-50"), h() && "floe-bottom-drawer-overlay", A() && "floe-side-drawer-overlay", i.exiting() && !h() && "pointer-events-none");
133
134
  },
134
135
  get style() {
135
136
  return x(() => !!a())() ? {
136
- left: `${D().left}px`,
137
- top: `${D().top}px`,
138
- width: `${D().width}px`,
139
- height: `${D().height}px`
137
+ left: `${R().left}px`,
138
+ top: `${R().top}px`,
139
+ width: `${R().width}px`,
140
+ height: `${R().height}px`
140
141
  } : {
141
- ...n() ? $e(n()) : {
142
+ ...n() ? Ce(n()) : {
142
143
  inset: "0"
143
144
  },
144
145
  "--floe-dialog-safe-top": `${(n()?.safeArea.top ?? 0) / (n()?.fixedScale ?? 1)}px`,
@@ -149,11 +150,11 @@ function Ie(e) {
149
150
  "padding-right": "max(var(--floe-dialog-gap-x, 1rem), var(--floe-dialog-safe-right))",
150
151
  "padding-bottom": "max(var(--floe-dialog-gap-y, 1rem), var(--floe-dialog-safe-bottom))",
151
152
  "padding-left": "max(var(--floe-dialog-gap-x, 1rem), var(--floe-dialog-safe-left))",
152
- "z-index": G()
153
+ "z-index": q()
153
154
  };
154
155
  }
155
- }), !1, !0), c(l, "data-floe-dialog-backdrop", f), E(l, M(() => ({
156
- [S]: _()
156
+ }), !1, !0), f(l, "data-floe-dialog-backdrop", c), M(l, j(() => ({
157
+ [F]: O()
157
158
  }), {
158
159
  get "data-floating-presence"() {
159
160
  return i.state();
@@ -165,17 +166,17 @@ function Ie(e) {
165
166
  !i.exiting() && e.closeOnBackdropClick !== !1 && e.onOpenChange(!1);
166
167
  }
167
168
  }), !1, !1);
168
- var k = A;
169
- return typeof k == "function" ? q(k, d) : A = d, c(d, "data-floe-dialog-panel", f), E(d, M({
169
+ var _ = C;
170
+ return typeof _ == "function" ? K(_, d) : C = d, f(d, "data-floe-dialog-panel", c), M(d, j({
170
171
  get "data-floe-drawer-side"() {
171
- return x(() => !!C())() ? e.drawerSide ?? "right" : void 0;
172
+ return x(() => !!A())() ? e.drawerSide ?? "right" : void 0;
172
173
  }
173
174
  }, () => ({
174
- [S]: _(),
175
- [ge]: "true"
175
+ [F]: O(),
176
+ [me]: "true"
176
177
  }), {
177
178
  get class() {
178
- return g(a() ? "flex max-h-[calc(100%-1rem)] w-[min(32rem,calc(100%-1rem))] max-w-[calc(100%-1rem)] flex-col" : "w-full max-w-md", "bg-popover text-popover-foreground rounded-panel shadow-[var(--floe-elevation-float-strong)]", "border border-[var(--floe-line)]", "floe-floating-presence", h() ? "floe-bottom-drawer-panel" : C() ? "floe-side-drawer-panel" : "floe-floating-dialog-panel", "pointer-events-auto flex flex-col", e.class);
179
+ return g(a() ? "flex max-h-[calc(100%-1rem)] w-[min(32rem,calc(100%-1rem))] max-w-[calc(100%-1rem)] flex-col" : "w-full max-w-md", "bg-popover text-popover-foreground rounded-panel shadow-[var(--floe-elevation-float-strong)]", "border border-[var(--floe-line)]", "floe-floating-presence", h() ? "floe-bottom-drawer-panel" : A() ? "floe-side-drawer-panel" : "floe-floating-dialog-panel", "pointer-events-auto flex flex-col", e.class);
179
180
  },
180
181
  style: {
181
182
  "max-height": "100%",
@@ -193,7 +194,7 @@ function Ie(e) {
193
194
  return a() ? void 0 : "true";
194
195
  },
195
196
  get "aria-labelledby"() {
196
- return x(() => !!e.title)() ? F() : void 0;
197
+ return x(() => !!e.title)() ? B() : void 0;
197
198
  },
198
199
  get "aria-describedby"() {
199
200
  return x(() => !!e.bodyDescription)() ? L() : void 0;
@@ -210,8 +211,8 @@ function Ie(e) {
210
211
  return e.title;
211
212
  },
212
213
  get children() {
213
- var o = De();
214
- return s(o, () => e.title), P(() => c(o, "id", F())), o;
214
+ var o = Pe();
215
+ return s(o, () => e.title), D(() => f(o, "id", B())), o;
215
216
  }
216
217
  }), x(() => e.header)];
217
218
  },
@@ -221,14 +222,14 @@ function Ie(e) {
221
222
  return e.title;
222
223
  },
223
224
  get children() {
224
- var o = ke(), w = o.firstChild;
225
- return s(w, r(u, {
225
+ var o = Se(), y = o.firstChild;
226
+ return s(y, r(u, {
226
227
  get when() {
227
228
  return e.title;
228
229
  },
229
230
  get children() {
230
- var p = _e();
231
- return s(p, () => e.title), P(() => c(p, "id", F())), p;
231
+ var p = ke();
232
+ return s(p, () => e.title), D(() => f(p, "id", B())), p;
232
233
  }
233
234
  })), s(o, r(H, {
234
235
  variant: "ghost-destructive",
@@ -239,7 +240,7 @@ function Ie(e) {
239
240
  return e.closeLabel ?? "Close";
240
241
  },
241
242
  get children() {
242
- return r(de, {
243
+ return r(se, {
243
244
  class: "w-3.5 h-3.5"
244
245
  });
245
246
  }
@@ -247,25 +248,25 @@ function Ie(e) {
247
248
  }
248
249
  });
249
250
  }
250
- }), y), s(y, r(u, {
251
+ }), w), s(w, r(u, {
251
252
  get when() {
252
253
  return e.bodyDescription;
253
254
  },
254
255
  get children() {
255
- var o = Se();
256
- return s(o, () => e.bodyDescription), P(() => c(o, "id", L())), o;
256
+ var o = Oe();
257
+ return s(o, () => e.bodyDescription), D(() => f(o, "id", L())), o;
257
258
  }
258
- }), null), s(y, () => e.children, null), s(d, r(u, {
259
+ }), null), s(w, () => e.children, null), s(d, r(u, {
259
260
  get when() {
260
261
  return e.footer;
261
262
  },
262
263
  get children() {
263
- var o = Oe();
264
+ var o = Re();
264
265
  return s(o, () => e.footer), o;
265
266
  }
266
- }), null), P((o) => {
267
- var w = g("pointer-events-none relative z-[1] flex h-full w-full", C() ? e.drawerSide === "left" ? "items-stretch justify-start" : "items-stretch justify-end" : h() ? "items-end justify-center" : "items-center justify-center"), p = g("min-h-0 flex-1 overflow-auto overscroll-contain px-[var(--floe-pad-group)] py-[var(--floe-pad-group)] [&.overflow-auto]:[scrollbar-gutter:stable]", e.contentClass);
268
- return w !== o.e && K(b, o.e = w), p !== o.t && K(y, o.t = p), o;
267
+ }), null), D((o) => {
268
+ var y = g("pointer-events-none relative z-[1] flex h-full w-full", A() ? e.drawerSide === "left" ? "items-stretch justify-start" : "items-stretch justify-end" : h() ? "items-end justify-center" : "items-center justify-center"), p = g("min-h-0 flex-1 overflow-auto overscroll-contain px-[var(--floe-pad-group)] py-[var(--floe-pad-group)] [&.overflow-auto]:[scrollbar-gutter:stable]", e.contentClass);
269
+ return y !== o.e && N(b, o.e = y), p !== o.t && N(w, o.t = p), o;
269
270
  }, {
270
271
  e: void 0,
271
272
  t: void 0
@@ -275,9 +276,9 @@ function Ie(e) {
275
276
  }
276
277
  })];
277
278
  }
278
- function Xe(e) {
279
- const $ = se();
280
- return r(Ie, {
279
+ function Qe(e) {
280
+ const $ = ce();
281
+ return r(Me, {
281
282
  get open() {
282
283
  return e.open;
283
284
  },
@@ -324,6 +325,6 @@ function Xe(e) {
324
325
  });
325
326
  }
326
327
  export {
327
- Xe as ConfirmDialog,
328
- Ie as Dialog
328
+ Qe as ConfirmDialog,
329
+ Me as Dialog
329
330
  };