@floegence/floe-webapp-core 0.60.1 → 0.61.0

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,154 +1,171 @@
1
- import { insert as V, createComponent as g, effect as C, className as P, setStyleProperty as B, template as R } from "solid-js/web";
2
- import { createMemo as m, createSignal as I, untrack as k, createEffect as b, For as F, createRenderEffect as N, onCleanup as j } from "solid-js";
3
- import { ViewActivationProvider as D } from "../../context/ViewActivationContext.js";
4
- import { cn as q } from "../../utils/cn.js";
5
- import { deferAfterPaint as G } from "../../utils/defer.js";
6
- var E = /* @__PURE__ */ R("<div>");
1
+ import { insert as P, createComponent as g, effect as B, className as E, setStyleProperty as K, template as R, memo as N, setAttribute as z } from "solid-js/web";
2
+ import { createMemo as S, createSignal as k, untrack as F, createEffect as x, For as j, createRenderEffect as D, onCleanup as G, Suspense as H } from "solid-js";
3
+ import { ViewActivationProvider as J } from "../../context/ViewActivationContext.js";
4
+ import { cn as V } from "../../utils/cn.js";
5
+ import { deferAfterPaint as L } from "../../utils/defer.js";
6
+ var O = /* @__PURE__ */ R("<div>");
7
7
  function M(e) {
8
8
  return String(e ?? "").trim();
9
9
  }
10
- function z(e) {
11
- const u = [], d = /* @__PURE__ */ new Set();
10
+ function C(e) {
11
+ const u = [], s = /* @__PURE__ */ new Set();
12
12
  for (const f of e) {
13
- const o = M(f?.id);
14
- o && (d.has(o) || (d.add(o), u.push(o)));
13
+ const a = M(f?.id);
14
+ a && (s.has(a) || (s.add(a), u.push(a)));
15
15
  }
16
16
  return u;
17
17
  }
18
- function H(e, u) {
19
- const d = new Set(e), f = /* @__PURE__ */ new Map();
20
- for (const o of u) {
21
- const a = M(o?.id);
22
- a && d.has(a) && (f.has(a) || f.set(a, o));
18
+ function Q(e, u) {
19
+ const s = new Set(e), f = /* @__PURE__ */ new Map();
20
+ for (const a of u) {
21
+ const d = M(a?.id);
22
+ d && s.has(d) && (f.has(d) || f.set(d, a));
23
23
  }
24
24
  return f;
25
25
  }
26
- function J(e) {
27
- const [u, d] = I(0), [f, o] = I(!1);
28
- let a = 0;
29
- N(() => {
30
- const s = e.active(), r = e.activationMode();
31
- a += 1;
32
- const w = a;
33
- if (!s) {
34
- o(!1);
26
+ function T(e) {
27
+ const [u, s] = k(0), [f, a] = k(!1);
28
+ let d = 0;
29
+ D(() => {
30
+ const c = e.active(), t = e.activationMode();
31
+ d += 1;
32
+ const h = d;
33
+ if (!c) {
34
+ a(!1);
35
35
  return;
36
36
  }
37
37
  const v = () => {
38
- w !== a || !e.active() || k(f) || (o(!0), d((S) => S + 1));
38
+ h !== d || !e.active() || F(f) || (a(!0), s((w) => w + 1));
39
39
  };
40
- r === "after-paint" ? G(v) : v();
41
- }), j(() => {
42
- a += 1;
40
+ t === "after-paint" ? L(v) : v();
41
+ }), G(() => {
42
+ d += 1;
43
43
  });
44
- const A = k(() => ({
44
+ const A = F(() => ({
45
45
  id: e.id,
46
+ visible: e.active,
46
47
  active: f,
47
48
  activationSeq: u
48
49
  }));
49
- return g(D, {
50
+ return g(J, {
50
51
  value: A,
51
52
  get children() {
52
- var s = E();
53
- return V(s, () => e.children), C((r) => {
54
- var w = e.class, v = e.active() ? "block" : "none";
55
- return w !== r.e && P(s, r.e = w), v !== r.t && B(s, "display", r.t = v), r;
53
+ var c = O();
54
+ return P(c, (() => {
55
+ var t = N(() => !!e.renderFallback);
56
+ return () => t() ? g(H, {
57
+ get fallback() {
58
+ return e.renderFallback(e.id);
59
+ },
60
+ get children() {
61
+ return e.children;
62
+ }
63
+ }) : e.children;
64
+ })()), B((t) => {
65
+ var h = e.class, v = e.id, w = e.active() ? void 0 : "true", b = !e.active(), y = e.active() ? "block" : "none";
66
+ return h !== t.e && E(c, t.e = h), v !== t.t && z(c, "data-floe-keep-alive-view", t.t = v), w !== t.a && z(c, "aria-hidden", t.a = w), b !== t.o && (c.inert = t.o = b), y !== t.i && K(c, "display", t.i = y), t;
56
67
  }, {
57
68
  e: void 0,
58
- t: void 0
59
- }), s;
69
+ t: void 0,
70
+ a: void 0,
71
+ o: void 0,
72
+ i: void 0
73
+ }), c;
60
74
  }
61
75
  });
62
76
  }
63
- function X(e) {
64
- const u = () => e.lazyMount !== !1, d = () => e.keepMounted !== !1, f = () => e.activationMode ?? "sync", o = m(() => z(e.views)), [a, A] = I(k(() => H(z(e.views), e.views))), s = m(() => M(e.activeId));
65
- b(() => {
66
- const t = o(), n = e.views;
67
- A((i) => {
68
- let c = !1;
69
- const l = new Map(i), x = new Set(t);
70
- for (const h of l.keys())
71
- x.has(h) || (l.delete(h), c = !0);
72
- for (const h of n) {
73
- const y = M(h?.id);
74
- y && x.has(y) && (l.has(y) || (l.set(y, h), c = !0));
77
+ function _(e) {
78
+ const u = () => e.lazyMount !== !1, s = () => e.keepMounted !== !1, f = () => e.activationMode ?? "sync", a = S(() => C(e.views)), [d, A] = k(F(() => Q(C(e.views), e.views))), c = S(() => M(e.activeId));
79
+ x(() => {
80
+ const n = a(), i = e.views;
81
+ A((r) => {
82
+ let o = !1;
83
+ const l = new Map(r), q = new Set(n);
84
+ for (const m of l.keys())
85
+ q.has(m) || (l.delete(m), o = !0);
86
+ for (const m of i) {
87
+ const I = M(m?.id);
88
+ I && q.has(I) && (l.has(I) || (l.set(I, m), o = !0));
75
89
  }
76
- return c ? l : i;
90
+ return o ? l : r;
77
91
  });
78
92
  });
79
- const r = m(() => ({
80
- order: o(),
81
- byId: a()
82
- })), w = () => {
83
- if (!d()) return /* @__PURE__ */ new Set();
84
- if (!u()) return new Set(r().order);
85
- const t = s();
86
- return t ? r().byId.has(t) ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set();
87
- }, [v, S] = I(w());
88
- b(() => {
89
- if (!d()) return;
90
- const t = new Set(r().order);
91
- S((n) => {
92
- let i = !1;
93
- const c = /* @__PURE__ */ new Set();
94
- for (const l of n) {
95
- if (!t.has(l)) {
96
- i = !0;
93
+ const t = S(() => ({
94
+ order: a(),
95
+ byId: d()
96
+ })), h = () => {
97
+ if (!s()) return /* @__PURE__ */ new Set();
98
+ if (!u()) return new Set(t().order);
99
+ const n = c();
100
+ return n ? t().byId.has(n) ? /* @__PURE__ */ new Set([n]) : /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set();
101
+ }, [v, w] = k(h());
102
+ x(() => {
103
+ if (!s()) return;
104
+ const n = new Set(t().order);
105
+ w((i) => {
106
+ let r = !1;
107
+ const o = /* @__PURE__ */ new Set();
108
+ for (const l of i) {
109
+ if (!n.has(l)) {
110
+ r = !0;
97
111
  continue;
98
112
  }
99
- c.add(l);
113
+ o.add(l);
100
114
  }
101
- return i ? c : n;
115
+ return r ? o : i;
102
116
  });
103
- }), b(() => {
104
- if (!d() || !u()) return;
105
- const t = s();
106
- t && r().byId.has(t) && S((n) => {
107
- if (n.has(t)) return n;
108
- const i = new Set(n);
109
- return i.add(t), i;
117
+ }), x(() => {
118
+ if (!s() || !u()) return;
119
+ const n = c();
120
+ n && t().byId.has(n) && w((i) => {
121
+ if (i.has(n)) return i;
122
+ const r = new Set(i);
123
+ return r.add(n), r;
110
124
  });
111
125
  });
112
- const K = m(() => {
113
- const t = r().order, n = s();
114
- if (!d())
115
- return n ? r().byId.has(n) ? [n] : [] : [];
116
- if (!u()) return t;
117
- const i = v();
118
- return t.filter((c) => i.has(c) || c === n);
119
- }), O = m(() => {
120
- const t = s();
121
- return t ? r().byId.has(t) : !1;
126
+ const b = S(() => {
127
+ const n = t().order, i = c();
128
+ if (!s())
129
+ return i ? t().byId.has(i) ? [i] : [] : [];
130
+ if (!u()) return n;
131
+ const r = v();
132
+ return n.filter((o) => r.has(o) || o === i);
133
+ }), y = S(() => {
134
+ const n = c();
135
+ return n ? t().byId.has(n) : !1;
122
136
  });
123
137
  return (() => {
124
- var t = E();
125
- return V(t, g(F, {
138
+ var n = O();
139
+ return P(n, g(j, {
126
140
  get each() {
127
- return K();
141
+ return b();
128
142
  },
129
- children: (n) => {
130
- const i = () => a().get(n);
131
- return g(J, {
132
- id: n,
133
- active: () => s() === n,
143
+ children: (i) => {
144
+ const r = () => d().get(i);
145
+ return g(T, {
146
+ id: i,
147
+ active: () => c() === i,
134
148
  activationMode: f,
149
+ get renderFallback() {
150
+ return e.renderFallback;
151
+ },
135
152
  get class() {
136
- return q("absolute inset-0", i()?.class);
153
+ return V("absolute inset-0", r()?.class);
137
154
  },
138
155
  get children() {
139
- return i()?.render();
156
+ return r()?.render();
140
157
  }
141
158
  });
142
159
  }
143
- })), C((n) => {
144
- var i = q("relative h-full min-h-0 w-full", e.class), c = O() ? "block" : "none";
145
- return i !== n.e && P(t, n.e = i), c !== n.t && B(t, "display", n.t = c), n;
160
+ })), B((i) => {
161
+ var r = V("relative h-full min-h-0 w-full", e.class), o = y() ? "block" : "none";
162
+ return r !== i.e && E(n, i.e = r), o !== i.t && K(n, "display", i.t = o), i;
146
163
  }, {
147
164
  e: void 0,
148
165
  t: void 0
149
- }), t;
166
+ }), n;
150
167
  })();
151
168
  }
152
169
  export {
153
- X as KeepAliveStack
170
+ _ as KeepAliveStack
154
171
  };
@@ -0,0 +1,52 @@
1
+ import { type JSX } from 'solid-js';
2
+ /** Host-owned routing and state stay outside this responsive settings frame. */
3
+ export declare function SettingsLayout(props: {
4
+ sidebar: JSX.Element;
5
+ mobileNavigation?: JSX.Element;
6
+ children: JSX.Element;
7
+ class?: string;
8
+ }): JSX.Element;
9
+ export interface SettingsNavigationItem {
10
+ id: string;
11
+ label: string;
12
+ icon?: (props: {
13
+ class?: string;
14
+ }) => JSX.Element;
15
+ attributes?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
16
+ }
17
+ export interface SettingsNavigationGroup {
18
+ id: string;
19
+ label: string;
20
+ items: readonly SettingsNavigationItem[];
21
+ }
22
+ export interface SettingsNavigationProps {
23
+ label: string;
24
+ groups: readonly SettingsNavigationGroup[];
25
+ value: string;
26
+ onChange: (id: string) => void;
27
+ search?: JSX.Element;
28
+ empty?: JSX.Element;
29
+ }
30
+ export declare function SettingsNavigation(props: SettingsNavigationProps): JSX.Element;
31
+ export interface SettingsSectionProps extends Omit<JSX.HTMLAttributes<HTMLElement>, 'title'> {
32
+ title: string;
33
+ description?: string;
34
+ badge?: JSX.Element;
35
+ actions?: JSX.Element;
36
+ /** A page owns its primary heading; sections are subordinate groups. */
37
+ variant?: 'page' | 'section';
38
+ }
39
+ export declare function SettingsSection(props: SettingsSectionProps): JSX.Element;
40
+ export declare function SettingsList(props: JSX.HTMLAttributes<HTMLDivElement>): JSX.Element;
41
+ export interface SettingRowProps {
42
+ title: string;
43
+ description?: string;
44
+ icon?: (props: {
45
+ class?: string;
46
+ }) => JSX.Element;
47
+ control?: JSX.Element;
48
+ children?: JSX.Element;
49
+ tone?: 'default' | 'info' | 'success' | 'warning' | 'danger';
50
+ class?: string;
51
+ }
52
+ export declare function SettingRow(props: SettingRowProps): JSX.Element;
@@ -0,0 +1,183 @@
1
+ import { insert as n, createComponent as s, effect as v, className as b, setAttribute as h, spread as f, mergeProps as $, template as c } from "solid-js/web";
2
+ import { Show as d, splitProps as w, For as m } from "solid-js";
3
+ import { cn as u } from "../../utils/cn.js";
4
+ var x = /* @__PURE__ */ c("<div><aside class=floe-settings-layout__sidebar></aside><div class=floe-settings-layout__mobile></div><div class=floe-settings-layout__content>"), k = /* @__PURE__ */ c("<div class=floe-settings-navigation__search>"), N = /* @__PURE__ */ c("<nav class=floe-settings-navigation><div class=floe-settings-navigation__groups>"), L = /* @__PURE__ */ c("<div class=floe-settings-navigation__group><div class=floe-settings-navigation__label>"), P = /* @__PURE__ */ c("<button><span>"), A = /* @__PURE__ */ c("<h1>"), C = /* @__PURE__ */ c("<p>"), F = /* @__PURE__ */ c("<div class=floe-settings-section__actions>"), R = /* @__PURE__ */ c("<section><header class=floe-settings-section__header><div class=floe-settings-section__heading><div class=floe-settings-section__title></div></div></header><div class=floe-settings-section__body>"), j = /* @__PURE__ */ c("<h2>"), q = /* @__PURE__ */ c("<div>"), z = /* @__PURE__ */ c("<div class=floe-setting-row__control>"), B = /* @__PURE__ */ c("<div class=floe-setting-row__body>"), D = /* @__PURE__ */ c("<div><div class=floe-setting-row__main><div class=floe-setting-row__label><div><div class=floe-setting-row__title>");
5
+ function I(t) {
6
+ return (() => {
7
+ var e = x(), o = e.firstChild, i = o.nextSibling, a = i.nextSibling;
8
+ return n(o, () => t.sidebar), n(i, () => t.mobileNavigation), n(a, () => t.children), v(() => b(e, u("floe-settings-layout", t.class))), e;
9
+ })();
10
+ }
11
+ function J(t) {
12
+ return (() => {
13
+ var e = N(), o = e.firstChild;
14
+ return n(e, s(d, {
15
+ get when() {
16
+ return t.search;
17
+ },
18
+ get children() {
19
+ var i = k();
20
+ return n(i, () => t.search), i;
21
+ }
22
+ }), o), n(o, s(d, {
23
+ get when() {
24
+ return t.groups.some((i) => i.items.length);
25
+ },
26
+ get fallback() {
27
+ return t.empty;
28
+ },
29
+ get children() {
30
+ return s(m, {
31
+ get each() {
32
+ return t.groups;
33
+ },
34
+ children: (i) => s(d, {
35
+ get when() {
36
+ return i.items.length;
37
+ },
38
+ get children() {
39
+ var a = L(), _ = a.firstChild;
40
+ return n(_, () => i.label), n(a, s(m, {
41
+ get each() {
42
+ return i.items;
43
+ },
44
+ children: (l) => (() => {
45
+ var g = P(), r = g.firstChild;
46
+ return f(g, $(() => l.attributes, {
47
+ type: "button",
48
+ get class() {
49
+ return u("floe-settings-navigation__item", l.attributes?.class);
50
+ },
51
+ get "aria-current"() {
52
+ return t.value === l.id ? "page" : void 0;
53
+ },
54
+ onClick: () => t.onChange(l.id)
55
+ }), !1, !0), n(g, s(d, {
56
+ get when() {
57
+ return l.icon;
58
+ },
59
+ children: (S) => {
60
+ const y = S();
61
+ return s(y, {
62
+ class: "floe-settings-navigation__icon"
63
+ });
64
+ }
65
+ }), r), n(r, () => l.label), g;
66
+ })()
67
+ }), null), v(() => h(a, "data-settings-group", i.id)), a;
68
+ }
69
+ })
70
+ });
71
+ }
72
+ })), v(() => h(e, "aria-label", t.label)), e;
73
+ })();
74
+ }
75
+ function K(t) {
76
+ const [e, o] = w(t, ["title", "description", "badge", "actions", "variant", "class", "children"]);
77
+ return (() => {
78
+ var i = R(), a = i.firstChild, _ = a.firstChild, l = _.firstChild, g = a.nextSibling;
79
+ return f(i, $(o, {
80
+ get class() {
81
+ return u("floe-settings-section", e.class);
82
+ },
83
+ get "data-settings-variant"() {
84
+ return e.variant ?? "section";
85
+ }
86
+ }), !1, !0), n(l, s(d, {
87
+ get when() {
88
+ return e.variant === "page";
89
+ },
90
+ get fallback() {
91
+ return (() => {
92
+ var r = j();
93
+ return n(r, () => e.title), r;
94
+ })();
95
+ },
96
+ get children() {
97
+ var r = A();
98
+ return n(r, () => e.title), r;
99
+ }
100
+ }), null), n(l, () => e.badge, null), n(_, s(d, {
101
+ get when() {
102
+ return e.description;
103
+ },
104
+ get children() {
105
+ var r = C();
106
+ return n(r, () => e.description), r;
107
+ }
108
+ }), null), n(a, s(d, {
109
+ get when() {
110
+ return e.actions;
111
+ },
112
+ get children() {
113
+ var r = F();
114
+ return n(r, () => e.actions), r;
115
+ }
116
+ }), null), n(g, () => e.children), i;
117
+ })();
118
+ }
119
+ function M(t) {
120
+ const [e, o] = w(t, ["class", "children"]);
121
+ return (() => {
122
+ var i = q();
123
+ return f(i, $(o, {
124
+ get class() {
125
+ return u("floe-settings-list", e.class);
126
+ },
127
+ "data-floe-surface": "card"
128
+ }), !1, !0), n(i, () => e.children), i;
129
+ })();
130
+ }
131
+ function O(t) {
132
+ return (() => {
133
+ var e = D(), o = e.firstChild, i = o.firstChild, a = i.firstChild, _ = a.firstChild;
134
+ return n(i, s(d, {
135
+ get when() {
136
+ return t.icon;
137
+ },
138
+ children: (l) => {
139
+ const g = l();
140
+ return s(g, {
141
+ class: "floe-setting-row__icon"
142
+ });
143
+ }
144
+ }), a), n(_, () => t.title), n(a, s(d, {
145
+ get when() {
146
+ return t.description;
147
+ },
148
+ get children() {
149
+ var l = C();
150
+ return n(l, () => t.description), l;
151
+ }
152
+ }), null), n(o, s(d, {
153
+ get when() {
154
+ return t.control;
155
+ },
156
+ get children() {
157
+ var l = z();
158
+ return n(l, () => t.control), l;
159
+ }
160
+ }), null), n(e, s(d, {
161
+ get when() {
162
+ return t.children;
163
+ },
164
+ get children() {
165
+ var l = B();
166
+ return n(l, () => t.children), l;
167
+ }
168
+ }), null), v((l) => {
169
+ var g = u("floe-setting-row", t.class), r = t.tone ?? "default";
170
+ return g !== l.e && b(e, l.e = g), r !== l.t && h(e, "data-tone", l.t = r), l;
171
+ }, {
172
+ e: void 0,
173
+ t: void 0
174
+ }), e;
175
+ })();
176
+ }
177
+ export {
178
+ O as SettingRow,
179
+ I as SettingsLayout,
180
+ M as SettingsList,
181
+ J as SettingsNavigation,
182
+ K as SettingsSection
183
+ };
@@ -42,3 +42,4 @@ export { MobileKeyboard, type MobileKeyboardProps, type MobileKeyboardSuggestion
42
42
  export { LinearProgress, CircularProgress, SegmentedProgress, StepsProgress, type LinearProgressProps, type CircularProgressProps, type SegmentedProgressProps, type StepsProgressProps, type ProgressSize, type ProgressColor, } from './Progress';
43
43
  export { SurfaceAnchoredLayer, type SurfaceAnchoredLayerProps } from './SurfaceAnchoredLayer';
44
44
  export { PersistentHorizontalScrollbar, type PersistentHorizontalScrollbarProps } from './PersistentHorizontalScrollbar';
45
+ export { SettingsLayout, SettingsNavigation, SettingsSection, SettingsList, SettingRow, type SettingsNavigationItem, type SettingsNavigationGroup, type SettingsNavigationProps, type SettingsSectionProps, type SettingRowProps, } from './Settings';
@@ -1,6 +1,9 @@
1
1
  import { type Accessor, type JSX } from 'solid-js';
2
2
  export interface ViewActivationContextValue {
3
3
  id: string;
4
+ /** Immediate presentation visibility. Custom providers default to their active accessor. */
5
+ visible?: Accessor<boolean>;
6
+ /** Activation effects may wait until after the visible content paints. */
4
7
  active: Accessor<boolean>;
5
8
  activationSeq: Accessor<number>;
6
9
  }
@@ -9,4 +12,4 @@ export interface ViewActivationProviderProps {
9
12
  children: JSX.Element;
10
13
  }
11
14
  export declare function ViewActivationProvider(props: ViewActivationProviderProps): JSX.Element;
12
- export declare function useViewActivation(): ViewActivationContextValue;
15
+ export declare function useViewActivation(): Required<ViewActivationContextValue>;
@@ -1,22 +1,25 @@
1
- import { createComponent as i } from "solid-js/web";
2
- import { untrack as n, useContext as r, createContext as c } from "solid-js";
3
- const e = c();
4
- function v(t) {
5
- const o = n(() => t.value);
6
- return i(e.Provider, {
7
- value: o,
1
+ import { createComponent as a } from "solid-js/web";
2
+ import { useContext as o, untrack as v, createContext as u } from "solid-js";
3
+ const i = u();
4
+ function w(t) {
5
+ const n = o(i), e = v(() => t.value), r = e.visible ?? e.active, c = {
6
+ ...e,
7
+ visible: () => (n?.visible() ?? !0) && r()
8
+ };
9
+ return a(i.Provider, {
10
+ value: c,
8
11
  get children() {
9
12
  return t.children;
10
13
  }
11
14
  });
12
15
  }
13
- function w() {
14
- const t = r(e);
16
+ function d() {
17
+ const t = o(i);
15
18
  if (!t)
16
19
  throw new Error("ViewActivationContext not found. Wrap your view with <ViewActivationProvider />.");
17
20
  return t;
18
21
  }
19
22
  export {
20
- v as ViewActivationProvider,
21
- w as useViewActivation
23
+ w as ViewActivationProvider,
24
+ d as useViewActivation
22
25
  };