@floegence/floe-webapp-core 0.101.1 → 0.101.4
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.
- package/dist/components/layout/BottomBarCompanion.js +125 -125
- package/dist/components/ui/Settings.d.ts +2 -0
- package/dist/components/ui/Settings.js +151 -104
- package/dist/components/ui/ThemePicker.d.ts +21 -0
- package/dist/components/ui/ThemePicker.js +114 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/full.js +218 -216
- package/dist/styles.css +1 -1
- package/dist/ui.css +40 -4
- package/dist/ui.js +67 -65
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
14
|
-
return Number.isFinite(
|
|
13
|
+
const u = Number(e);
|
|
14
|
+
return Number.isFinite(u) && u > 0 ? u : r;
|
|
15
15
|
}
|
|
16
16
|
function De(e, r) {
|
|
17
|
-
const
|
|
18
|
-
return Number.isFinite(
|
|
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
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
34
|
-
return Number.isFinite(
|
|
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,
|
|
45
|
-
const
|
|
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:
|
|
48
|
-
top:
|
|
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
|
|
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 +
|
|
64
|
-
top: `${e.top +
|
|
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,
|
|
71
|
-
let
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
const n = e.mount,
|
|
76
|
-
t &&
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
mount:
|
|
83
|
-
ready:
|
|
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
|
|
86
|
+
return N(!1), A(!1), {
|
|
87
87
|
mount: null,
|
|
88
88
|
ready: !1
|
|
89
89
|
};
|
|
90
|
-
}, Y = (
|
|
90
|
+
}, Y = (i) => {
|
|
91
91
|
const n = se(e.anchor);
|
|
92
|
-
n &&
|
|
92
|
+
n && O(n);
|
|
93
93
|
const {
|
|
94
|
-
mount:
|
|
94
|
+
mount: o,
|
|
95
95
|
ready: t
|
|
96
|
-
} = Q(n),
|
|
97
|
-
return !
|
|
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 &&
|
|
100
|
-
}, $ = (
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
103
|
-
const t = m(),
|
|
104
|
-
if (!n && ae(t,
|
|
105
|
-
if (!n || z() || ae(t,
|
|
106
|
-
|
|
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((
|
|
110
|
-
const
|
|
111
|
-
if (!
|
|
112
|
-
|
|
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 =
|
|
116
|
-
v = 0, w = null,
|
|
117
|
-
}), w =
|
|
118
|
-
}, p = (
|
|
119
|
-
if (!
|
|
120
|
-
const
|
|
121
|
-
if (!
|
|
122
|
-
$(n,
|
|
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 &&
|
|
126
|
-
h = 0,
|
|
127
|
-
}),
|
|
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
|
|
131
|
-
if (e.anchor, e.mount, e.expandedWidth, e.maxWidth, e.maxHeight, e.viewportPadding, !
|
|
132
|
-
Z(),
|
|
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 &&
|
|
137
|
-
|
|
136
|
+
if (t && O(t), Q(t), !n) {
|
|
137
|
+
M = !1, V = o;
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
const
|
|
141
|
-
|
|
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
|
|
145
|
-
for (const
|
|
146
|
-
if (!
|
|
147
|
-
t.add(
|
|
148
|
-
const
|
|
149
|
-
|
|
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 (
|
|
152
|
-
const
|
|
153
|
-
for (const
|
|
154
|
-
const
|
|
155
|
-
if (!
|
|
156
|
-
const
|
|
157
|
-
|
|
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
|
|
159
|
+
let g = i?.isConnected ?? !1, I = n?.isConnected ?? !1, T = o?.isConnected ?? !1;
|
|
160
160
|
const W = [];
|
|
161
|
-
for (const
|
|
162
|
-
const
|
|
163
|
-
if (!
|
|
164
|
-
const
|
|
165
|
-
const B =
|
|
166
|
-
|
|
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
|
-
|
|
168
|
+
E.observe(s.documentElement, {
|
|
169
169
|
childList: !0,
|
|
170
170
|
subtree: !0
|
|
171
|
-
}), W.push(
|
|
171
|
+
}), W.push(E);
|
|
172
172
|
}
|
|
173
|
-
const G = [...
|
|
174
|
-
let
|
|
175
|
-
return ge(
|
|
176
|
-
const B = JSON.stringify(
|
|
177
|
-
B !==
|
|
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
|
|
180
|
+
for (const s of t) s.addEventListener("scroll", l, !0);
|
|
181
181
|
K(() => {
|
|
182
|
-
for (const
|
|
183
|
-
for (const
|
|
184
|
-
for (const
|
|
185
|
-
for (const
|
|
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 || !
|
|
189
|
-
const n = r()?.ownerDocument;
|
|
190
|
-
if (!n) return;
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
return
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
},
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
199
|
-
!
|
|
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",
|
|
202
|
-
n.removeEventListener("pointerdown",
|
|
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 = (
|
|
208
|
-
|
|
209
|
-
}, le = (
|
|
210
|
-
e.contentHostRef?.(
|
|
211
|
-
}, ue = (
|
|
212
|
-
if (
|
|
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
|
-
|
|
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: (
|
|
220
|
+
children: (i) => ne(de, {
|
|
221
221
|
get mount() {
|
|
222
|
-
return
|
|
222
|
+
return i();
|
|
223
223
|
},
|
|
224
224
|
get children() {
|
|
225
|
-
var n = Ce(),
|
|
226
|
-
return n.addEventListener("transitionend", ue), oe((t) => ce(t), n), oe((t) => le(t),
|
|
227
|
-
var
|
|
228
|
-
return
|
|
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;
|