@floegence/floe-webapp-core 0.36.1 → 0.36.2

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.
@@ -6,9 +6,9 @@ import { useWidgetRegistry as R } from "../../context/WidgetRegistry.js";
6
6
  import { WidgetStateProvider as k } from "../../context/WidgetStateContext.js";
7
7
  import { positionToGridArea as $ } from "../../utils/gridLayout.js";
8
8
  import { WidgetFrame as M } from "./WidgetFrame.js";
9
- var _ = /* @__PURE__ */ l("<div>"), A = /* @__PURE__ */ l('<div class="h-full flex items-center justify-center text-muted-foreground text-xs"><span>Widget: ');
9
+ var _ = /* @__PURE__ */ l("<div data-floe-dialog-surface-host=true>"), A = /* @__PURE__ */ l('<div class="h-full flex items-center justify-center text-muted-foreground text-xs"><span>Widget: ');
10
10
  function q(e) {
11
- const i = z(), g = R(), m = () => i.editMode(), o = () => e.widget.type, a = d(() => g.getWidget(o())), f = d(() => $(e.position)), w = () => i.getWidgetState(e.widget.id), h = (t, r) => {
11
+ const i = z(), g = R(), f = () => i.editMode(), o = () => e.widget.type, a = d(() => g.getWidget(o())), m = d(() => $(e.position)), w = () => i.getWidgetState(e.widget.id), h = (t, r) => {
12
12
  i.updateWidgetState(e.widget.id, t, r);
13
13
  }, s = () => a()?.component, v = d(() => {
14
14
  if (!e.isDragging || !e.pixelOffset) return {};
@@ -66,7 +66,7 @@ function q(e) {
66
66
  return e.widget.config;
67
67
  },
68
68
  get isEditMode() {
69
- return m();
69
+ return f();
70
70
  }
71
71
  });
72
72
  }
@@ -86,7 +86,7 @@ function q(e) {
86
86
  "select-none",
87
87
  e.isDragging && "cursor-grabbing"
88
88
  ), y = {
89
- "grid-area": f(),
89
+ "grid-area": m(),
90
90
  ...v()
91
91
  };
92
92
  return c !== r.e && W(t, r.e = c), r.t = S(t, y, r.t), r;
@@ -1,98 +1,127 @@
1
- import { createComponent as n, Portal as C, insert as l, effect as g, setAttribute as u, className as $, template as o, use as k, delegateEvents as w } from "solid-js/web";
2
- import { createUniqueId as _, Show as c } from "solid-js";
3
- import { cn as y } from "../../utils/cn.js";
4
- import { Button as f } from "./Button.js";
5
- import { X as O } from "../icons/index.js";
6
- import { useResolvedFloeConfig as z } from "../../context/FloeConfigContext.js";
7
- import { useOverlayMask as D } from "../../hooks/useOverlayMask.js";
8
- var I = /* @__PURE__ */ o('<div class="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm animate-in fade-in cursor-pointer">'), F = /* @__PURE__ */ o('<h2 class="text-sm font-semibold">'), T = /* @__PURE__ */ o('<p class="mt-0.5 text-xs text-muted-foreground">'), j = /* @__PURE__ */ o('<div class="flex items-start justify-between p-3 border-b border-border"><div>'), B = /* @__PURE__ */ o('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), E = /* @__PURE__ */ o('<div role=dialog aria-modal=true tabindex=-1><div class="flex-1 overflow-auto overscroll-contain p-3">'), M = /* @__PURE__ */ o("<div>");
9
- function R(e) {
10
- const a = _(), m = () => `dialog-${a}-title`, v = () => `dialog-${a}-description`;
11
- let s;
12
- return D({
1
+ import { createComponent as n, Portal as z, setAttribute as c, spread as O, mergeProps as B, memo as D, insert as a, effect as x, className as A, template as s, use as E } from "solid-js/web";
2
+ import { createUniqueId as M, createMemo as R, Show as f } from "solid-js";
3
+ import { cn as C } from "../../utils/cn.js";
4
+ import { Button as $ } from "./Button.js";
5
+ import { X as F } from "../icons/index.js";
6
+ import { useResolvedFloeConfig as N } from "../../context/FloeConfigContext.js";
7
+ import { useOverlayMask as j } from "../../hooks/useOverlayMask.js";
8
+ import { resolveDialogSurfaceHost as H, DIALOG_SURFACE_BOUNDARY_ATTR as m } from "./dialogSurfaceScope.js";
9
+ var U = /* @__PURE__ */ s('<h2 class="text-sm font-semibold">'), P = /* @__PURE__ */ s('<p class="mt-0.5 text-xs text-muted-foreground">'), W = /* @__PURE__ */ s('<div class="flex items-start justify-between p-3 border-b border-border"><div>'), q = /* @__PURE__ */ s('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), G = /* @__PURE__ */ s('<div><div></div><div class="relative z-[1] flex h-full w-full items-center justify-center"><div><div class="flex-1 overflow-auto overscroll-contain p-3">'), L = /* @__PURE__ */ s("<div>");
10
+ function X(e) {
11
+ const i = M(), _ = () => `dialog-${i}-title`, w = () => `dialog-${i}-description`;
12
+ let h;
13
+ const v = R(() => e.open ? H() : {
14
+ host: null,
15
+ mode: "global"
16
+ }), g = () => `dialog-boundary-${i}`, o = () => v().mode === "surface" && !!v().host?.isConnected, I = () => v().host ?? void 0, S = (t) => typeof Element < "u" && t instanceof Element ? !!t.closest(`[${m}="${g()}"]`) : typeof Node < "u" && t instanceof Node ? !!t.parentElement?.closest(`[${m}="${g()}"]`) : !1;
17
+ return j({
13
18
  open: () => e.open,
14
- root: () => s,
19
+ root: () => h,
20
+ containsTarget: (t) => o() && S(t),
15
21
  onClose: () => e.onOpenChange(!1),
16
- lockBodyScroll: !0,
22
+ lockBodyScroll: () => !o(),
17
23
  trapFocus: !0,
18
- closeOnEscape: !0,
24
+ closeOnEscape: () => o() ? "inside" : !0,
19
25
  blockHotkeys: !0,
20
26
  // Block scroll bleed outside the dialog while keeping the dialog content scrollable.
21
- blockWheel: "outside",
22
- blockTouchMove: "outside",
27
+ blockWheel: () => o() ? "none" : "outside",
28
+ blockTouchMove: () => o() ? "none" : "outside",
23
29
  restoreFocus: !0
24
- }), n(c, {
30
+ }), n(f, {
25
31
  get when() {
26
32
  return e.open;
27
33
  },
28
34
  get children() {
29
- return n(C, {
35
+ return n(z, {
36
+ get mount() {
37
+ return I();
38
+ },
30
39
  get children() {
31
- return [(() => {
32
- var r = I();
33
- return r.$$click = () => e.onOpenChange(!1), r;
34
- })(), (() => {
35
- var r = E(), h = r.firstChild, b = s;
36
- return typeof b == "function" ? k(b, r) : s = r, l(r, n(c, {
37
- get when() {
38
- return e.title || e.description;
39
- },
40
- get children() {
41
- var t = j(), d = t.firstChild;
42
- return l(d, n(c, {
43
- get when() {
44
- return e.title;
45
- },
46
- get children() {
47
- var i = F();
48
- return l(i, () => e.title), g(() => u(i, "id", m())), i;
49
- }
50
- }), null), l(d, n(c, {
51
- get when() {
52
- return e.description;
53
- },
54
- get children() {
55
- var i = T();
56
- return l(i, () => e.description), g(() => u(i, "id", v())), i;
57
- }
58
- }), null), l(t, n(f, {
59
- variant: "ghost-destructive",
60
- size: "icon",
61
- class: "h-6 w-6 -mr-1",
62
- onClick: () => e.onOpenChange(!1),
63
- "aria-label": "Close",
64
- get children() {
65
- return n(O, {
66
- class: "w-3.5 h-3.5"
67
- });
68
- }
69
- }), null), t;
70
- }
71
- }), h), l(h, () => e.children), l(r, n(c, {
72
- get when() {
73
- return e.footer;
74
- },
75
- get children() {
76
- var t = B();
77
- return l(t, () => e.footer), t;
78
- }
79
- }), null), g((t) => {
80
- var d = y("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2", "w-full max-w-md max-h-[85vh]", "bg-card text-card-foreground rounded-md shadow-lg", "border border-border", "animate-in fade-in zoom-in-95", "flex flex-col", e.class), i = e.title ? m() : void 0, x = e.description ? v() : void 0;
81
- return d !== t.e && $(r, t.e = d), i !== t.t && u(r, "aria-labelledby", t.t = i), x !== t.a && u(r, "aria-describedby", t.a = x), t;
82
- }, {
83
- e: void 0,
84
- t: void 0,
85
- a: void 0
86
- }), r;
87
- })()];
40
+ var t = G(), b = t.firstChild, T = b.nextSibling, d = T.firstChild, y = d.firstChild;
41
+ c(t, "data-floe-dialog-overlay-root", i), c(b, "data-floe-dialog-backdrop", i), O(b, B(() => ({
42
+ [m]: g()
43
+ }), {
44
+ get class() {
45
+ return C("absolute inset-0 cursor-pointer animate-in fade-in", o() ? "bg-background/72 backdrop-blur-[2px]" : "bg-background/80 backdrop-blur-sm");
46
+ },
47
+ onClick: () => e.onOpenChange(!1)
48
+ }), !1, !1);
49
+ var k = h;
50
+ return typeof k == "function" ? E(k, d) : h = d, c(d, "data-floe-dialog-panel", i), O(d, B(() => ({
51
+ [m]: g()
52
+ }), {
53
+ get class() {
54
+ return C(o() ? "flex max-h-[calc(100%-1rem)] w-[min(32rem,calc(100%-1rem))] max-w-[calc(100%-1rem)] flex-col" : "w-full max-w-md max-h-[85vh]", "bg-card text-card-foreground rounded-md shadow-lg", "border border-border", "animate-in fade-in zoom-in-95", "flex flex-col", e.class);
55
+ },
56
+ role: "dialog",
57
+ get "aria-modal"() {
58
+ return o() ? void 0 : "true";
59
+ },
60
+ get "aria-labelledby"() {
61
+ return D(() => !!e.title)() ? _() : void 0;
62
+ },
63
+ get "aria-describedby"() {
64
+ return D(() => !!e.description)() ? w() : void 0;
65
+ },
66
+ tabIndex: -1
67
+ }), !1, !0), a(d, n(f, {
68
+ get when() {
69
+ return e.title || e.description;
70
+ },
71
+ get children() {
72
+ var r = W(), u = r.firstChild;
73
+ return a(u, n(f, {
74
+ get when() {
75
+ return e.title;
76
+ },
77
+ get children() {
78
+ var l = U();
79
+ return a(l, () => e.title), x(() => c(l, "id", _())), l;
80
+ }
81
+ }), null), a(u, n(f, {
82
+ get when() {
83
+ return e.description;
84
+ },
85
+ get children() {
86
+ var l = P();
87
+ return a(l, () => e.description), x(() => c(l, "id", w())), l;
88
+ }
89
+ }), null), a(r, n($, {
90
+ variant: "ghost-destructive",
91
+ size: "icon",
92
+ class: "h-6 w-6 -mr-1",
93
+ onClick: () => e.onOpenChange(!1),
94
+ "aria-label": "Close",
95
+ get children() {
96
+ return n(F, {
97
+ class: "w-3.5 h-3.5"
98
+ });
99
+ }
100
+ }), null), r;
101
+ }
102
+ }), y), a(y, () => e.children), a(d, n(f, {
103
+ get when() {
104
+ return e.footer;
105
+ },
106
+ get children() {
107
+ var r = q();
108
+ return a(r, () => e.footer), r;
109
+ }
110
+ }), null), x((r) => {
111
+ var u = o() ? "surface" : "global", l = C(o() ? "absolute inset-0 z-20 p-3" : "fixed inset-0 z-50 p-4");
112
+ return u !== r.e && c(t, "data-floe-dialog-mode", r.e = u), l !== r.t && A(t, r.t = l), r;
113
+ }, {
114
+ e: void 0,
115
+ t: void 0
116
+ }), t;
88
117
  }
89
118
  });
90
119
  }
91
120
  });
92
121
  }
93
- function W(e) {
94
- const a = z();
95
- return n(R, {
122
+ function te(e) {
123
+ const i = N();
124
+ return n(X, {
96
125
  get open() {
97
126
  return e.open;
98
127
  },
@@ -106,16 +135,16 @@ function W(e) {
106
135
  return e.description;
107
136
  },
108
137
  get footer() {
109
- return [n(f, {
138
+ return [n($, {
110
139
  variant: "ghost",
111
140
  onClick: () => e.onOpenChange(!1),
112
141
  get disabled() {
113
142
  return e.loading;
114
143
  },
115
144
  get children() {
116
- return e.cancelText ?? a.config.strings.confirmDialog.cancel;
145
+ return e.cancelText ?? i.config.strings.confirmDialog.cancel;
117
146
  }
118
- }), n(f, {
147
+ }), n($, {
119
148
  get variant() {
120
149
  return e.variant === "destructive" ? "destructive" : "primary";
121
150
  },
@@ -126,17 +155,16 @@ function W(e) {
126
155
  return e.loading;
127
156
  },
128
157
  get children() {
129
- return e.confirmText ?? a.config.strings.confirmDialog.confirm;
158
+ return e.confirmText ?? i.config.strings.confirmDialog.confirm;
130
159
  }
131
160
  })];
132
161
  },
133
162
  get children() {
134
- return e.children ?? M();
163
+ return e.children ?? L();
135
164
  }
136
165
  });
137
166
  }
138
- w(["click"]);
139
167
  export {
140
- W as ConfirmDialog,
141
- R as Dialog
168
+ te as ConfirmDialog,
169
+ X as Dialog
142
170
  };