@floegence/floe-webapp-core 0.101.1 → 0.101.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.
@@ -1,5 +1,5 @@
1
1
  import { createComponent as ne, Portal as de, use as oe, insert as fe, effect as me, setAttribute as R, className as ie, style as he, memo as ve, template as we } from "solid-js/web";
2
- import { createSignal as V, createEffect as X, untrack as k, onCleanup as K, Show as be } from "solid-js";
2
+ import { createSignal as L, createEffect as X, untrack as k, onCleanup as K, Show as be } from "solid-js";
3
3
  import { readViewportSnapshot as J, observeViewport as ge } from "../../viewport.js";
4
4
  import { cn as re } from "../../utils/cn.js";
5
5
  var Ce = /* @__PURE__ */ we("<section role=region data-floe-bottom-bar-companion=true><div data-floe-bottom-bar-companion-content=true>");
@@ -10,12 +10,12 @@ const ye = 544, Fe = 544, Ae = 12, U = {
10
10
  left: "--floe-bottom-bar-companion-safe-area-left"
11
11
  };
12
12
  function j(e, r) {
13
- const l = Number(e);
14
- return Number.isFinite(l) && l > 0 ? l : r;
13
+ const u = Number(e);
14
+ return Number.isFinite(u) && u > 0 ? u : r;
15
15
  }
16
16
  function De(e, r) {
17
- const l = Number(e);
18
- return Number.isFinite(l) && l >= 0 ? l : r;
17
+ const u = Number(e);
18
+ return Number.isFinite(u) && u >= 0 ? u : r;
19
19
  }
20
20
  function se(e) {
21
21
  if (!e?.isConnected) return null;
@@ -28,10 +28,10 @@ function se(e) {
28
28
  };
29
29
  }
30
30
  function _(e, r) {
31
- const l = e.ownerDocument.defaultView;
32
- if (!l) return 0;
33
- const d = Number.parseFloat(l.getComputedStyle(e).getPropertyValue(r));
34
- return Number.isFinite(d) && d > 0 ? d : 0;
31
+ const u = e.ownerDocument.defaultView;
32
+ if (!u) return 0;
33
+ const f = Number.parseFloat(u.getComputedStyle(e).getPropertyValue(r));
34
+ return Number.isFinite(f) && f > 0 ? f : 0;
35
35
  }
36
36
  function xe(e) {
37
37
  return {
@@ -41,11 +41,11 @@ function xe(e) {
41
41
  left: _(e, U.left)
42
42
  };
43
43
  }
44
- function Ee(e, r, l, d, L, y) {
45
- const F = r.ownerDocument.defaultView, m = F ? J(F).visible : null, A = m?.left ?? 0, q = m?.top ?? 0, N = m?.width ?? e.left + e.width, O = m?.height ?? e.top + e.height, E = xe(r), g = A + E.left + y, h = A + N - E.right - y, v = q + E.top + y, C = q + O - (F && J(F).keyboardOpen ? 0 : E.bottom), w = Math.max(0, h - g), b = Math.min(l, d, w), P = e.left + (e.width - b) / 2, M = Math.max(g, Math.min(P, h - b)), D = Math.min(e.top + e.height, C), S = Math.max(e.height, D - v), z = Math.min(L, S);
44
+ function Ee(e, r, u, f, N, F) {
45
+ const A = r.ownerDocument.defaultView, m = A ? J(A).visible : null, D = m?.left ?? 0, q = m?.top ?? 0, O = m?.width ?? e.left + e.width, S = m?.height ?? e.top + e.height, P = xe(r), C = D + P.left + F, h = D + O - P.right - F, v = q + P.top + F, y = q + S - (A && J(A).keyboardOpen ? 0 : P.bottom), w = Math.max(0, h - C), b = Math.min(u, f, w), M = e.left + (e.width - b) / 2, V = Math.max(C, Math.min(M, h - b)), x = Math.min(e.top + e.height, y), H = Math.max(e.height, x - v), z = Math.min(N, H);
46
46
  return {
47
- left: M,
48
- top: D - z,
47
+ left: V,
48
+ top: x - z,
49
49
  width: b,
50
50
  height: z
51
51
  };
@@ -55,177 +55,177 @@ function ae(e, r) {
55
55
  }
56
56
  function Pe(e, r) {
57
57
  if (!e) return {};
58
- const l = r?.ownerDocument.defaultView, d = l ? J(l).fixedOffset : {
58
+ const u = r?.ownerDocument.defaultView, f = u ? J(u).fixedOffset : {
59
59
  left: 0,
60
60
  top: 0
61
61
  };
62
62
  return {
63
- left: `${e.left + d.left}px`,
64
- top: `${e.top + d.top}px`,
63
+ left: `${e.left + f.left}px`,
64
+ top: `${e.top + f.top}px`,
65
65
  width: `${e.width}px`,
66
66
  height: `${e.height}px`
67
67
  };
68
68
  }
69
69
  function Ne(e) {
70
- const [r, l] = V(null), [d, L] = V(!1), [y, F] = V(!1), [m, A] = V(null), [q, N] = V(null), [O, E] = V("collapsed");
71
- let g = null, h = 0, v = 0, C = null, w = null, b = null, P = !1, M = !1;
72
- const D = (o) => {
73
- O() !== o && (E(o), e.onPhaseChange?.(o));
74
- }, S = () => r()?.ownerDocument.defaultView ?? e.anchor?.ownerDocument.defaultView ?? null, z = () => S()?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, Q = (o) => {
75
- const n = e.mount, i = e.anchor, t = !!(n?.isConnected && o && i?.ownerDocument === n.ownerDocument);
76
- t && l(n);
77
- const c = r();
78
- if (c) {
79
- L(c.isConnected);
80
- const s = !!(t && c === n);
81
- return F(s), {
82
- mount: c,
83
- ready: s
70
+ const [r, u] = L(null), [f, N] = L(!1), [F, A] = L(!1), [m, D] = L(null), [q, O] = L(null), [S, P] = L("collapsed");
71
+ let C = null, h = 0, v = 0, y = null, w = null, b = null, M = !1, V = !1;
72
+ const x = (i) => {
73
+ S() !== i && (P(i), e.onPhaseChange?.(i));
74
+ }, H = () => r()?.ownerDocument.defaultView ?? e.anchor?.ownerDocument.defaultView ?? null, z = () => H()?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, Q = (i) => {
75
+ const n = e.mount, o = e.anchor, t = !!(n?.isConnected && i && o?.ownerDocument === n.ownerDocument);
76
+ t && u(n);
77
+ const a = r();
78
+ if (a) {
79
+ N(a.isConnected);
80
+ const l = !!(t && a === n);
81
+ return A(l), {
82
+ mount: a,
83
+ ready: l
84
84
  };
85
85
  }
86
- return L(!1), F(!1), {
86
+ return N(!1), A(!1), {
87
87
  mount: null,
88
88
  ready: !1
89
89
  };
90
- }, Y = (o) => {
90
+ }, Y = (i) => {
91
91
  const n = se(e.anchor);
92
- n && N(n);
92
+ n && O(n);
93
93
  const {
94
- mount: i,
94
+ mount: o,
95
95
  ready: t
96
- } = Q(n), c = n ?? q();
97
- return !c || !i || !t ? null : o ? Ee(c, i, j(e.expandedWidth, c.width), j(e.maxWidth, ye), j(e.maxHeight, Fe), De(e.viewportPadding, Ae)) : c;
96
+ } = Q(n), a = n ?? q();
97
+ return !a || !o || !t ? null : i ? Ee(a, o, j(e.expandedWidth, a.width), j(e.maxWidth, ye), j(e.maxHeight, Fe), De(e.viewportPadding, Ae)) : a;
98
98
  }, Z = () => {
99
- h && C && C.cancelAnimationFrame(h), v && w && w.cancelAnimationFrame(v), h = 0, v = 0, C = null, w = null, b = null;
100
- }, $ = (o, n) => {
101
- const i = Y(o);
102
- if (!i) return;
103
- const t = m(), c = o ? "expanded" : "collapsed";
104
- if (!n && ae(t, i) && b) return;
105
- if (!n || z() || ae(t, i)) {
106
- A(i), b = null, D(c);
99
+ h && y && y.cancelAnimationFrame(h), v && w && w.cancelAnimationFrame(v), h = 0, v = 0, y = null, w = null, b = null;
100
+ }, $ = (i, n) => {
101
+ const o = Y(i);
102
+ if (!o) return;
103
+ const t = m(), a = i ? "expanded" : "collapsed";
104
+ if (!n && ae(t, o) && b) return;
105
+ if (!n || z() || ae(t, o)) {
106
+ D(o), b = null, x(a);
107
107
  return;
108
108
  }
109
- b = ["height", "width", "top", "left"].find((f) => t?.[f] !== i[f]) ?? null, D(o ? "expanding" : "collapsing");
110
- const s = S();
111
- if (!s) {
112
- A(i), D(c);
109
+ b = ["height", "width", "top", "left"].find((c) => t?.[c] !== o[c]) ?? null, x(i ? "expanding" : "collapsing");
110
+ const l = H();
111
+ if (!l) {
112
+ D(o), x(a);
113
113
  return;
114
114
  }
115
- v = s.requestAnimationFrame(() => {
116
- v = 0, w = null, A(k(() => Y(o)) ?? i);
117
- }), w = s;
118
- }, p = (o, n) => {
119
- if (!o && (h || v)) return;
120
- const i = S();
121
- if (!i) {
122
- $(n, o);
115
+ v = l.requestAnimationFrame(() => {
116
+ v = 0, w = null, D(k(() => Y(i)) ?? o);
117
+ }), w = l;
118
+ }, p = (i, n) => {
119
+ if (!i && (h || v)) return;
120
+ const o = H();
121
+ if (!o) {
122
+ $(n, i);
123
123
  return;
124
124
  }
125
- h && C && C.cancelAnimationFrame(h), v && w && w.cancelAnimationFrame(v), v = 0, w = null, h = i.requestAnimationFrame(() => {
126
- h = 0, C = null, k(() => $(n, o));
127
- }), C = i;
125
+ h && y && y.cancelAnimationFrame(h), v && w && w.cancelAnimationFrame(v), v = 0, w = null, h = o.requestAnimationFrame(() => {
126
+ h = 0, y = null, k(() => $(n, i));
127
+ }), y = o;
128
128
  };
129
129
  X(() => {
130
- const o = e.retained, n = e.visible, i = e.open;
131
- if (e.anchor, e.mount, e.expandedWidth, e.maxWidth, e.maxHeight, e.viewportPadding, !o) {
132
- Z(), l(null), L(!1), F(!1), A(null), N(null), g = null, e.surfaceRef?.(null), e.contentHostRef?.(null), P = !1, M = i;
130
+ const i = e.retained, n = e.visible, o = e.open;
131
+ if (e.anchor, e.mount, e.expandedWidth, e.maxWidth, e.maxHeight, e.viewportPadding, !i) {
132
+ Z(), u(null), N(!1), A(!1), D(null), O(null), C = null, e.surfaceRef?.(null), e.contentHostRef?.(null), M = !1, V = o;
133
133
  return;
134
134
  }
135
135
  const t = se(e.anchor);
136
- if (t && N(t), Q(t), !n) {
137
- P = !1, M = i;
136
+ if (t && O(t), Q(t), !n) {
137
+ M = !1, V = o;
138
138
  return;
139
139
  }
140
- const c = !P, s = M !== i;
141
- P = !0, M = i, p(!c && s, i);
140
+ const a = !M, l = V !== o;
141
+ M = !0, V = o, p(!a && l, o);
142
142
  }), X(() => {
143
143
  if (!e.retained) return;
144
- const o = e.anchor, n = r(), i = e.mount, t = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
145
- for (const a of [o, n, i]) {
146
- if (!a) continue;
147
- t.add(a.ownerDocument);
148
- const u = a.ownerDocument.defaultView;
149
- u && c.add(u);
144
+ const i = e.anchor, n = r(), o = e.mount, t = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
145
+ for (const s of [i, n, o]) {
146
+ if (!s) continue;
147
+ t.add(s.ownerDocument);
148
+ const d = s.ownerDocument.defaultView;
149
+ d && a.add(d);
150
150
  }
151
- if (c.size === 0 || t.size === 0) return;
152
- const s = () => p(!1, k(() => e.open)), f = [];
153
- for (const a of /* @__PURE__ */ new Set([o, n, i])) {
154
- const u = a?.ownerDocument.defaultView;
155
- if (!a || !u || typeof u.ResizeObserver != "function") continue;
156
- const x = new u.ResizeObserver(s);
157
- x.observe(a), f.push(x);
151
+ if (a.size === 0 || t.size === 0) return;
152
+ const l = () => p(!1, k(() => e.open)), c = [];
153
+ for (const s of /* @__PURE__ */ new Set([i, n, o])) {
154
+ const d = s?.ownerDocument.defaultView;
155
+ if (!s || !d || typeof d.ResizeObserver != "function") continue;
156
+ const E = new d.ResizeObserver(l);
157
+ E.observe(s), c.push(E);
158
158
  }
159
- let H = o?.isConnected ?? !1, I = n?.isConnected ?? !1, T = i?.isConnected ?? !1;
159
+ let g = i?.isConnected ?? !1, I = n?.isConnected ?? !1, T = o?.isConnected ?? !1;
160
160
  const W = [];
161
- for (const a of t) {
162
- const u = a.defaultView;
163
- if (!u || typeof u.MutationObserver != "function" || !a.documentElement) continue;
164
- const x = new u.MutationObserver(() => {
165
- const B = o?.isConnected ?? !1, ee = n?.isConnected ?? !1, te = i?.isConnected ?? !1;
166
- H === B && I === ee && T === te || (H = B, I = ee, T = te, k(s));
161
+ for (const s of t) {
162
+ const d = s.defaultView;
163
+ if (!d || typeof d.MutationObserver != "function" || !s.documentElement) continue;
164
+ const E = new d.MutationObserver(() => {
165
+ const B = i?.isConnected ?? !1, ee = n?.isConnected ?? !1, te = o?.isConnected ?? !1;
166
+ g === B && I === ee && T === te || (g = B, I = ee, T = te, k(l));
167
167
  });
168
- x.observe(a.documentElement, {
168
+ E.observe(s.documentElement, {
169
169
  childList: !0,
170
170
  subtree: !0
171
- }), W.push(x);
171
+ }), W.push(E);
172
172
  }
173
- const G = [...c].map((a) => {
174
- let u = JSON.stringify(J(a));
175
- return ge(a, (x) => {
176
- const B = JSON.stringify(x);
177
- B !== u && (u = B, k(s));
173
+ const G = [...a].map((s) => {
174
+ let d = JSON.stringify(J(s));
175
+ return ge(s, (E) => {
176
+ const B = JSON.stringify(E);
177
+ B !== d && (d = B, k(l));
178
178
  });
179
179
  });
180
- for (const a of t) a.addEventListener("scroll", s, !0);
180
+ for (const s of t) s.addEventListener("scroll", l, !0);
181
181
  K(() => {
182
- for (const a of f) a.disconnect();
183
- for (const a of W) a.disconnect();
184
- for (const a of G) a();
185
- for (const a of t) a.removeEventListener("scroll", s, !0);
182
+ for (const s of c) s.disconnect();
183
+ for (const s of W) s.disconnect();
184
+ for (const s of G) s();
185
+ for (const s of t) s.removeEventListener("scroll", l, !0);
186
186
  });
187
187
  }), X(() => {
188
- if (!e.retained || !e.visible || !e.open || !d() || !y() || !m()) return;
189
- const n = r()?.ownerDocument;
190
- if (!n) return;
191
- const i = (s) => {
192
- const f = typeof s.composedPath == "function" ? s.composedPath() : [];
193
- return g && f.includes(g) || e.anchor && f.includes(e.anchor) ? !0 : e.isOwnedInteraction?.(s) ?? !1;
194
- }, t = (s) => {
195
- i(s) || e.onDismiss?.("outside-pointer");
196
- }, c = (s) => {
197
- if (s.key !== "Escape" || s.defaultPrevented || s.isComposing || s.keyCode === 229) return;
198
- const f = n.activeElement;
199
- !g?.contains(f) && !e.isOwnedInteraction?.(s) || (s.preventDefault(), e.onDismiss?.("escape"));
188
+ if (!e.retained || !e.visible || !e.open || !f() || !F() || !m()) return;
189
+ const n = r()?.ownerDocument, o = n?.defaultView;
190
+ if (!n || !o) return;
191
+ const t = (c) => {
192
+ const g = typeof c.composedPath == "function" ? c.composedPath() : [];
193
+ return C && g.includes(C) || e.anchor && g.includes(e.anchor) ? !0 : e.isOwnedInteraction?.(c) ?? !1;
194
+ }, a = (c) => {
195
+ t(c) || e.onDismiss?.("outside-pointer");
196
+ }, l = (c) => {
197
+ if (c.key !== "Escape" || c.defaultPrevented || c.isComposing || c.keyCode === 229) return;
198
+ const g = n.activeElement;
199
+ !C?.contains(g) && !e.isOwnedInteraction?.(c) || (c.preventDefault(), e.onDismiss?.("escape"));
200
200
  };
201
- n.addEventListener("pointerdown", t, !0), n.addEventListener("keydown", c), K(() => {
202
- n.removeEventListener("pointerdown", t, !0), n.removeEventListener("keydown", c);
201
+ n.addEventListener("pointerdown", a, !0), o.addEventListener("keydown", l), K(() => {
202
+ n.removeEventListener("pointerdown", a, !0), o.removeEventListener("keydown", l);
203
203
  });
204
204
  }), K(() => {
205
205
  Z(), e.surfaceRef?.(null), e.contentHostRef?.(null);
206
206
  });
207
- const ce = (o) => {
208
- g = o, e.surfaceRef?.(o);
209
- }, le = (o) => {
210
- e.contentHostRef?.(o);
211
- }, ue = (o) => {
212
- if (o.target !== g || o.propertyName !== b) return;
207
+ const ce = (i) => {
208
+ C = i, e.surfaceRef?.(i);
209
+ }, le = (i) => {
210
+ e.contentHostRef?.(i);
211
+ }, ue = (i) => {
212
+ if (i.target !== C || i.propertyName !== b) return;
213
213
  const n = e.open ? "expanding" : "collapsing";
214
- O() === n && (b = null, D(e.open ? "expanded" : "collapsed"));
214
+ S() === n && (b = null, x(e.open ? "expanded" : "collapsed"));
215
215
  };
216
216
  return ne(be, {
217
217
  get when() {
218
218
  return ve(() => !!e.retained)() && r();
219
219
  },
220
- children: (o) => ne(de, {
220
+ children: (i) => ne(de, {
221
221
  get mount() {
222
- return o();
222
+ return i();
223
223
  },
224
224
  get children() {
225
- var n = Ce(), i = n.firstChild;
226
- return n.addEventListener("transitionend", ue), oe((t) => ce(t), n), oe((t) => le(t), i), fe(i, () => e.children), me((t) => {
227
- var c = e.id, s = e.label, f = !e.visible || !d() || !y() || !m() ? "true" : void 0, H = !e.visible || !d() || !y() || !m(), I = re("floe-bottom-bar-companion", e.class), T = O(), W = e.visible && d() && y() ? "visible" : "hidden", G = m() ? "true" : "false", a = Pe(m(), r()), u = re("floe-bottom-bar-companion__content", e.contentClass);
228
- return c !== t.e && R(n, "id", t.e = c), s !== t.t && R(n, "aria-label", t.t = s), f !== t.a && R(n, "aria-hidden", t.a = f), H !== t.o && (n.inert = t.o = H), I !== t.i && ie(n, t.i = I), T !== t.n && R(n, "data-companion-phase", t.n = T), W !== t.s && R(n, "data-companion-visibility", t.s = W), G !== t.h && R(n, "data-companion-frame-ready", t.h = G), t.r = he(n, a, t.r), u !== t.d && ie(i, t.d = u), t;
225
+ var n = Ce(), o = n.firstChild;
226
+ return n.addEventListener("transitionend", ue), oe((t) => ce(t), n), oe((t) => le(t), o), fe(o, () => e.children), me((t) => {
227
+ var a = e.id, l = e.label, c = !e.visible || !f() || !F() || !m() ? "true" : void 0, g = !e.visible || !f() || !F() || !m(), I = re("floe-bottom-bar-companion", e.class), T = S(), W = e.visible && f() && F() ? "visible" : "hidden", G = m() ? "true" : "false", s = Pe(m(), r()), d = re("floe-bottom-bar-companion__content", e.contentClass);
228
+ return a !== t.e && R(n, "id", t.e = a), l !== t.t && R(n, "aria-label", t.t = l), c !== t.a && R(n, "aria-hidden", t.a = c), g !== t.o && (n.inert = t.o = g), I !== t.i && ie(n, t.i = I), T !== t.n && R(n, "data-companion-phase", t.n = T), W !== t.s && R(n, "data-companion-visibility", t.s = W), G !== t.h && R(n, "data-companion-frame-ready", t.h = G), t.r = he(n, s, t.r), d !== t.d && ie(o, t.d = d), t;
229
229
  }, {
230
230
  e: void 0,
231
231
  t: void 0,
@@ -35,6 +35,8 @@ export interface SettingsSectionProps extends Omit<JSX.HTMLAttributes<HTMLElemen
35
35
  actions?: JSX.Element;
36
36
  /** A page owns its primary heading; sections are subordinate groups. */
37
37
  variant?: 'page' | 'section';
38
+ /** Defaults to true. Hide when an enclosing dialog already owns this page identity. */
39
+ showHeading?: boolean;
38
40
  }
39
41
  export declare function SettingsSection(props: SettingsSectionProps): JSX.Element;
40
42
  export declare function SettingsList(props: JSX.HTMLAttributes<HTMLDivElement>): JSX.Element;