@floegence/floe-webapp-core 0.36.1 → 0.36.3

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