@floegence/floe-webapp-core 0.81.0 → 0.81.1

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,190 +1,198 @@
1
- import { insert as a, createComponent as c, effect as z, setAttribute as g, spread as X, mergeProps as D, memo as G, className as J, setStyleProperty as _, template as w, use as Q, delegateEvents as Y } from "solid-js/web";
2
- import { createUniqueId as Z, createSignal as E, createMemo as ee, createEffect as I, untrack as te, Show as k, For as re, onCleanup as ne } from "solid-js";
3
- import { AlertTriangle as oe, Info as ie, X as se } from "../icons/index.js";
4
- import { useOverlayMask as ae } from "../../hooks/useOverlayMask.js";
5
- import { cn as le } from "../../utils/cn.js";
6
- import { SurfaceFloatingLayer as ce } from "./SurfaceFloatingLayer.js";
7
- import { calculateMenuPosition as de } from "./menuUtils.js";
8
- import { WORKBENCH_TEXT_SELECTION_SURFACE_ATTR as ue, CANVAS_WHEEL_INTERACTIVE_ATTR as fe } from "./localInteractionSurface.js";
9
- import { resolveSurfacePortalHost as me, resolveSurfacePortalBoundaryRect as ve, resolveSurfacePortalScale as be } from "./dialogSurfaceScope.js";
10
- var he = /* @__PURE__ */ w('<div class="flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2"><span class="min-w-0 truncate text-xs font-medium"></span><button type=button class="flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md hover:bg-accent">'), ge = /* @__PURE__ */ w("<div data-floe-status-details>"), we = /* @__PURE__ */ w('<span data-floe-status-indicator><button type=button class="inline-flex h-full w-full cursor-pointer items-center justify-center rounded-md hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"aria-haspopup=dialog></button><span class=sr-only role=alert aria-atomic=true></span><span class=sr-only role=status aria-atomic=true>'), ye = /* @__PURE__ */ w("<div>"), xe = /* @__PURE__ */ w('<div class="flex flex-wrap items-center gap-2">'), Ee = /* @__PURE__ */ w('<section class="space-y-2 border-b border-border pb-3 mb-3 last:border-0 last:pb-0 last:mb-0"><p class=font-medium>');
11
- function Ae(n) {
12
- const T = Z(), [f, F] = E(!1), [p, N] = E(), [H, q] = E({
1
+ import { insert as c, createComponent as u, effect as I, setAttribute as g, setStyleProperty as w, spread as D, mergeProps as G, memo as J, className as Y, template as y, use as Z, delegateEvents as ee } from "solid-js/web";
2
+ import { createUniqueId as te, createSignal as p, createMemo as re, createEffect as N, untrack as ne, Show as $, For as oe, onCleanup as ie } from "solid-js";
3
+ import { AlertTriangle as se, Info as ae, X as le } from "../icons/index.js";
4
+ import { useOverlayMask as ce } from "../../hooks/useOverlayMask.js";
5
+ import { useMediaQuery as de } from "../../hooks/useMediaQuery.js";
6
+ import { cn as ue } from "../../utils/cn.js";
7
+ import { SurfaceFloatingLayer as fe } from "./SurfaceFloatingLayer.js";
8
+ import { calculateMenuPosition as me } from "./menuUtils.js";
9
+ import { WORKBENCH_TEXT_SELECTION_SURFACE_ATTR as ve, CANVAS_WHEEL_INTERACTIVE_ATTR as he } from "./localInteractionSurface.js";
10
+ import { resolveSurfacePortalHost as be, resolveSurfacePortalBoundaryRect as ge, resolveSurfacePortalScale as we } from "./dialogSurfaceScope.js";
11
+ var ye = /* @__PURE__ */ y('<div class="flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2"><span class="min-w-0 truncate text-xs font-medium"></span><button type=button class="flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md hover:bg-accent">'), xe = /* @__PURE__ */ y("<div data-floe-status-details>"), Ee = /* @__PURE__ */ y('<span data-floe-status-indicator><button type=button class="inline-flex h-full w-full cursor-pointer items-center justify-center rounded-md hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"aria-haspopup=dialog></button><span class=sr-only role=alert aria-atomic=true></span><span class=sr-only role=status aria-atomic=true>'), pe = /* @__PURE__ */ y("<div>"), Se = /* @__PURE__ */ y('<div class="flex flex-wrap items-center gap-2">'), Ce = /* @__PURE__ */ y('<section class="space-y-2 border-b border-border pb-3 mb-3 last:border-0 last:pb-0 last:mb-0"><p class=font-medium>');
12
+ function Be(i) {
13
+ const A = te(), H = de("(pointer: coarse)"), S = () => H() ? "2.75rem" : i.size === "md" ? "2rem" : "1.75rem", [m, T] = p(!1), [C, q] = p(), [K, U] = p({
13
14
  x: 0,
14
15
  y: 0
15
- }), [A, K] = E({
16
+ }), [M, V] = p({
16
17
  width: 360,
17
18
  height: 384
18
- }), [U, P] = E(!1);
19
- let m, v = !1;
20
- const d = () => n.entries.length > 0, L = ee(() => n.entries.some((t) => t.severity === "error") ? "error" : n.entries.some((t) => t.severity === "warning") ? "warning" : "info"), R = (t) => n.entries.filter((r) => r.severity === "error" === t).map((r) => r.summary).join(". "), V = () => (d() ? m : n.restoreFocus())?.focus({
19
+ }), [W, P] = p(!1);
20
+ let v, h = !1;
21
+ const f = () => i.entries.length > 0, _ = re(() => i.entries.some((t) => t.severity === "error") ? "error" : i.entries.some((t) => t.severity === "warning") ? "warning" : "info"), R = (t) => i.entries.filter((r) => r.severity === "error" === t).map((r) => r.summary).join(". "), X = () => (f() ? v : i.restoreFocus())?.focus({
21
22
  preventScroll: !0
22
- }), S = (t) => {
23
- F(!1), v = !1, t && V();
24
- }, y = (t) => t instanceof Node && !!(m?.contains(t) || p()?.contains(t));
25
- return ae({
26
- open: f,
27
- root: p,
28
- containsTarget: y,
29
- onClose: () => S(!0),
23
+ }), k = (t) => {
24
+ T(!1), h = !1, t && X();
25
+ }, x = (t) => t instanceof Node && !!(v?.contains(t) || C()?.contains(t));
26
+ return ce({
27
+ open: m,
28
+ root: C,
29
+ containsTarget: x,
30
+ onClose: () => k(!0),
30
31
  lockBodyScroll: !1,
31
32
  trapFocus: !1,
32
33
  autoFocus: !1,
33
34
  restoreFocus: !1,
34
35
  closeOnEscape: "inside",
35
- escapeKeyPhase: "bubble",
36
+ escapeKeyPhase: "capture",
36
37
  blockHotkeys: !1
37
- }), I(() => {
38
- if (d()) {
39
- f() && queueMicrotask(() => te(() => {
40
- f() && v && document.activeElement === document.body && p()?.focus({
38
+ }), N(() => {
39
+ if (f()) {
40
+ m() && queueMicrotask(() => ne(() => {
41
+ m() && h && document.activeElement === document.body && C()?.focus({
41
42
  preventScroll: !0
42
43
  });
43
44
  }));
44
45
  return;
45
46
  }
46
- const t = v || typeof document < "u" && y(document.activeElement);
47
- F(!1), v = !1, t && n.restoreFocus()?.focus({
47
+ const t = h || typeof document < "u" && x(document.activeElement);
48
+ T(!1), h = !1, t && i.restoreFocus()?.focus({
48
49
  preventScroll: !0
49
50
  });
50
- }), I(() => {
51
- const t = p();
52
- if (!f() || !t || !m) return;
53
- const r = m;
54
- let b = 0, $ = !0;
55
- const C = () => {
51
+ }), N(() => {
52
+ const t = C();
53
+ if (!m() || !t || !v) return;
54
+ const r = v;
55
+ let b = 0, F = !0;
56
+ const L = () => {
56
57
  if (b = 0, !r.isConnected) {
57
- S(!1);
58
+ k(!1);
58
59
  return;
59
60
  }
60
- const s = me({
61
+ const n = be({
61
62
  owner: r
62
- }), u = ve(s), x = be(s);
63
- K({
64
- width: Math.max(0, Math.min(360, u.right - u.left - 16)) / x.x,
65
- height: Math.max(0, Math.min(384, u.bottom - u.top - 16)) / x.y
66
- }), q(de(r.getBoundingClientRect(), t.getBoundingClientRect(), "end", u)), P(!0), $ && ($ = !1, t.focus({
63
+ }), d = ge(n), E = we(n);
64
+ V({
65
+ width: Math.max(0, Math.min(360, d.right - d.left - 16)) / E.x,
66
+ height: Math.max(0, Math.min(384, d.bottom - d.top - 16)) / E.y
67
+ }), U(me(r.getBoundingClientRect(), t.getBoundingClientRect(), "end", d)), P(!0), F && (F = !1, t.focus({
67
68
  preventScroll: !0
68
69
  }));
69
70
  }, e = () => {
70
- cancelAnimationFrame(b), b = requestAnimationFrame(C);
71
- }, o = new ResizeObserver(e);
72
- o.observe(r), o.observe(t);
73
- const i = new MutationObserver(e);
74
- for (let s = r.parentElement; s; s = s.parentElement) i.observe(s, {
71
+ cancelAnimationFrame(b), b = requestAnimationFrame(L);
72
+ }, s = new ResizeObserver(e);
73
+ s.observe(r), s.observe(t);
74
+ const o = new MutationObserver(e);
75
+ for (let n = r.parentElement; n; n = n.parentElement) o.observe(n, {
75
76
  attributes: !0,
76
77
  attributeFilter: ["style", "class"]
77
78
  });
78
- const h = (s) => {
79
- v = y(s.target);
79
+ const a = (n) => {
80
+ h = x(n.target);
80
81
  };
81
- document.addEventListener("focusin", h);
82
- const l = (s) => {
83
- y(s.target) || S(!1);
82
+ document.addEventListener("focusin", a);
83
+ const l = (n) => {
84
+ x(n.target) || k(!1);
84
85
  };
85
- window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), document.addEventListener("pointerdown", l, !0), e(), ne(() => {
86
- cancelAnimationFrame(b), document.removeEventListener("focusin", h), o.disconnect(), i.disconnect(), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0), document.removeEventListener("pointerdown", l, !0);
86
+ window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), document.addEventListener("pointerdown", l, !0), e(), ie(() => {
87
+ cancelAnimationFrame(b), document.removeEventListener("focusin", a), s.disconnect(), o.disconnect(), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0), document.removeEventListener("pointerdown", l, !0);
87
88
  });
88
89
  }), (() => {
89
- var t = we(), r = t.firstChild, b = r.nextSibling, $ = b.nextSibling;
90
+ var t = Ee(), r = t.firstChild, b = r.nextSibling, F = b.nextSibling;
90
91
  r.$$click = () => {
91
- d() && (P(!1), F((e) => !e));
92
+ f() && (P(!1), T((e) => !e));
92
93
  }, r.addEventListener("blur", (e) => {
93
- e.relatedTarget && (v = y(e.relatedTarget));
94
+ e.relatedTarget && (h = x(e.relatedTarget));
94
95
  }), r.addEventListener("focus", () => {
95
- v = !0;
96
+ h = !0;
96
97
  });
97
- var C = m;
98
- return typeof C == "function" ? Q(C, r) : m = r, a(r, c(k, {
98
+ var L = v;
99
+ return typeof L == "function" ? Z(L, r) : v = r, c(r, u($, {
99
100
  get when() {
100
- return L() !== "info";
101
+ return _() !== "info";
101
102
  },
102
103
  get fallback() {
103
- return c(ie, {
104
+ return u(ae, {
104
105
  class: "h-4 w-4",
105
106
  "aria-hidden": "true"
106
107
  });
107
108
  },
108
109
  get children() {
109
- return c(oe, {
110
+ return u(se, {
110
111
  class: "h-4 w-4",
111
112
  "aria-hidden": "true"
112
113
  });
113
114
  }
114
- })), a(b, () => R(!0)), a($, () => R(!1)), a(t, c(k, {
115
+ })), c(b, () => R(!0)), c(F, () => R(!1)), c(t, u($, {
115
116
  get when() {
116
- return G(() => !!f())() && d();
117
+ return J(() => !!m())() && f();
117
118
  },
118
119
  get children() {
119
- return c(ce, {
120
- owner: m,
120
+ return u(fe, {
121
+ owner: v,
121
122
  get position() {
122
- return H();
123
+ return K();
123
124
  },
124
- layerRef: N,
125
- id: T,
125
+ layerRef: q,
126
+ id: A,
126
127
  role: "dialog",
127
128
  get "aria-label"() {
128
- return n.label;
129
+ return i.label;
129
130
  },
130
131
  tabindex: -1,
131
132
  "data-floe-surface": "floating",
132
133
  class: "flex flex-col overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg",
133
134
  get style() {
134
135
  return {
135
- width: `${A().width}px`,
136
- "max-height": `${A().height}px`,
137
- visibility: U() ? "visible" : "hidden"
136
+ width: `${M().width}px`,
137
+ "max-height": `${M().height}px`,
138
+ visibility: W() ? "visible" : "hidden"
138
139
  };
139
140
  },
140
141
  get children() {
141
142
  return [(() => {
142
- var e = he(), o = e.firstChild, i = o.nextSibling;
143
- return a(o, () => n.label), i.$$click = () => S(!0), a(i, c(se, {
143
+ var e = ye(), s = e.firstChild, o = s.nextSibling;
144
+ return c(s, () => i.label), o.$$click = () => k(!0), c(o, u(le, {
144
145
  class: "h-4 w-4"
145
- })), z(() => g(i, "aria-label", n.closeLabel)), e;
146
+ })), I((a) => {
147
+ var l = i.closeLabel, n = S(), d = S();
148
+ return l !== a.e && g(o, "aria-label", a.e = l), n !== a.t && w(o, "width", a.t = n), d !== a.a && w(o, "height", a.a = d), a;
149
+ }, {
150
+ e: void 0,
151
+ t: void 0,
152
+ a: void 0
153
+ }), e;
146
154
  })(), (() => {
147
- var e = ge();
148
- return X(e, D({
149
- [fe]: "true",
150
- [ue]: "true"
155
+ var e = xe();
156
+ return D(e, G({
157
+ [he]: "true",
158
+ [ve]: "true"
151
159
  }, {
152
160
  class: "min-h-0 overflow-auto overscroll-contain p-3 text-xs",
153
161
  style: {
154
162
  "overflow-wrap": "anywhere"
155
163
  }
156
- }), !1, !0), a(e, c(re, {
164
+ }), !1, !0), c(e, u(oe, {
157
165
  get each() {
158
- return n.entries;
166
+ return i.entries;
159
167
  },
160
- children: (o) => (() => {
161
- var i = Ee(), h = i.firstChild;
162
- return a(h, () => o.summary), a(i, c(k, {
168
+ children: (s) => (() => {
169
+ var o = Ce(), a = o.firstChild;
170
+ return c(a, () => s.summary), c(o, u($, {
163
171
  get when() {
164
- return o.detail;
172
+ return s.detail;
165
173
  },
166
174
  get children() {
167
- var l = ye();
168
- return a(l, () => o.detail), l;
175
+ var l = pe();
176
+ return c(l, () => s.detail), l;
169
177
  }
170
- }), null), a(i, c(k, {
178
+ }), null), c(o, u($, {
171
179
  get when() {
172
- return o.actions;
180
+ return s.actions;
173
181
  },
174
182
  get children() {
175
- var l = xe();
176
- return a(l, () => o.actions), l;
183
+ var l = Se();
184
+ return c(l, () => s.actions), l;
177
185
  }
178
- }), null), i;
186
+ }), null), o;
179
187
  })()
180
188
  })), e;
181
189
  })()];
182
190
  }
183
191
  });
184
192
  }
185
- }), null), z((e) => {
186
- var o = le("inline-flex shrink-0 items-center justify-center align-middle", n.class), i = n.size === "md" ? "2rem" : "1.75rem", h = n.size === "md" ? "2rem" : "1.75rem", l = d() ? "visible" : "hidden", s = L() === "error" ? "var(--error)" : L() === "warning" ? "var(--warning)" : "var(--muted-foreground)", u = d() ? 0 : -1, x = !d() || void 0, M = `${n.label}${d() ? `: ${n.entries.map((W) => W.summary).join("; ")}` : ""}`, B = n.label, O = f(), j = f() ? T : void 0;
187
- return o !== e.e && J(t, e.e = o), i !== e.t && _(t, "width", e.t = i), h !== e.a && _(t, "height", e.a = h), l !== e.o && _(r, "visibility", e.o = l), s !== e.i && _(r, "color", e.i = s), u !== e.n && g(r, "tabindex", e.n = u), x !== e.s && g(r, "aria-hidden", e.s = x), M !== e.h && g(r, "aria-label", e.h = M), B !== e.r && g(r, "title", e.r = B), O !== e.d && g(r, "aria-expanded", e.d = O), j !== e.l && g(r, "aria-controls", e.l = j), e;
193
+ }), null), I((e) => {
194
+ var s = ue("inline-flex shrink-0 items-center justify-center align-middle", i.class), o = S(), a = S(), l = f() ? "visible" : "hidden", n = _() === "error" ? "var(--error)" : _() === "warning" ? "var(--warning)" : "var(--muted-foreground)", d = f() ? 0 : -1, E = !f() || void 0, B = `${i.label}${f() ? `: ${i.entries.map((Q) => Q.summary).join("; ")}` : ""}`, O = i.label, j = m(), z = m() ? A : void 0;
195
+ return s !== e.e && Y(t, e.e = s), o !== e.t && w(t, "width", e.t = o), a !== e.a && w(t, "height", e.a = a), l !== e.o && w(r, "visibility", e.o = l), n !== e.i && w(r, "color", e.i = n), d !== e.n && g(r, "tabindex", e.n = d), E !== e.s && g(r, "aria-hidden", e.s = E), B !== e.h && g(r, "aria-label", e.h = B), O !== e.r && g(r, "title", e.r = O), j !== e.d && g(r, "aria-expanded", e.d = j), z !== e.l && g(r, "aria-controls", e.l = z), e;
188
196
  }, {
189
197
  e: void 0,
190
198
  t: void 0,
@@ -200,7 +208,7 @@ function Ae(n) {
200
208
  }), t;
201
209
  })();
202
210
  }
203
- Y(["click"]);
211
+ ee(["click"]);
204
212
  export {
205
- Ae as FeedbackIndicator
213
+ Be as FeedbackIndicator
206
214
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.81.0",
3
+ "version": "0.81.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",