@floegence/floe-webapp-core 0.36.74 → 0.36.75

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.
@@ -19,5 +19,7 @@ export interface ActivityAppsMainProps<TProtocol = unknown> {
19
19
  lazyMount?: KeepAliveStackProps['lazyMount'];
20
20
  /** Forwarded to KeepAliveStack (default: true). */
21
21
  keepMounted?: KeepAliveStackProps['keepMounted'];
22
+ /** Forwarded to KeepAliveStack (default: sync). */
23
+ activationMode?: KeepAliveStackProps['activationMode'];
22
24
  }
23
25
  export declare function ActivityAppsMain<TProtocol = unknown>(props: ActivityAppsMainProps<TProtocol>): import("solid-js").JSX.Element;
@@ -1,30 +1,30 @@
1
- import { createComponent as i, Dynamic as u } from "solid-js/web";
1
+ import { createComponent as r, Dynamic as s } from "solid-js/web";
2
2
  import { untrack as d, createMemo as m } from "solid-js";
3
3
  import { useLayout as l } from "../context/LayoutContext.js";
4
4
  import { useOptionalComponentRegistry as v } from "../context/ComponentRegistry.js";
5
5
  import { KeepAliveStack as f } from "../components/layout/KeepAliveStack.js";
6
- function w(e) {
6
+ function g(e) {
7
7
  return e.sidebar?.fullScreen === !0 || e.sidebar?.renderIn === "main";
8
8
  }
9
9
  function b(e) {
10
- const n = l(), r = v();
11
- if (!d(() => !!e.views) && !r)
10
+ const n = l(), i = v();
11
+ if (!d(() => !!e.views) && !i)
12
12
  throw new Error("ActivityAppsMain requires ComponentRegistryProvider when `views` is not provided.");
13
- const o = () => e.activeId ? e.activeId() : n.sidebarActiveTab(), s = m(() => {
14
- if (!r) return [];
15
- const c = e.include ?? w;
16
- return r.sidebarItems().filter((t) => c(t)).map((t) => ({
13
+ const o = () => e.activeId ? e.activeId() : n.sidebarActiveTab(), a = m(() => {
14
+ if (!i) return [];
15
+ const u = e.include ?? g;
16
+ return i.sidebarItems().filter((t) => u(t)).map((t) => ({
17
17
  id: t.id,
18
- render: () => i(u, {
18
+ render: () => r(s, {
19
19
  get component() {
20
20
  return t.component;
21
21
  }
22
22
  })
23
23
  }));
24
- }), a = () => e.views ?? s();
25
- return i(f, {
24
+ }), c = () => e.views ?? a();
25
+ return r(f, {
26
26
  get views() {
27
- return a();
27
+ return c();
28
28
  },
29
29
  get activeId() {
30
30
  return o();
@@ -35,6 +35,9 @@ function b(e) {
35
35
  get keepMounted() {
36
36
  return e.keepMounted;
37
37
  },
38
+ get activationMode() {
39
+ return e.activationMode;
40
+ },
38
41
  get class() {
39
42
  return e.class;
40
43
  }
@@ -94,7 +94,7 @@ function A(e) {
94
94
  })()), f(() => g(t, y("absolute top-0.5 right-0.5 min-w-3.5 h-3.5 px-1", "flex items-center justify-center", "text-[9px] font-medium rounded-full", "bg-activity-bar-badge text-activity-bar-badge-foreground"))), t;
95
95
  }
96
96
  }), null), f((t) => {
97
- var d = y("relative w-full aspect-square flex items-center justify-center cursor-pointer", "transition-[color,background-color] duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset", e.isActive ? "text-activity-bar-foreground-active bg-accent/80" : "text-activity-bar-foreground hover:text-activity-bar-foreground-active hover:bg-accent/40"), v = e.item.label, i = e.isActive;
97
+ var d = y("relative w-full aspect-square flex items-center justify-center cursor-pointer", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset", e.isActive ? "text-activity-bar-foreground-active bg-accent/80" : "text-activity-bar-foreground transition-[color,background-color] duration-100 hover:text-activity-bar-foreground-active hover:bg-accent/40"), v = e.item.label, i = e.isActive;
98
98
  return d !== t.e && g(n, t.e = d), v !== t.t && m(n, "aria-label", t.t = v), i !== t.a && m(n, "aria-pressed", t.a = i), t;
99
99
  }, {
100
100
  e: void 0,
@@ -12,5 +12,7 @@ export interface KeepAliveStackProps {
12
12
  lazyMount?: boolean;
13
13
  /** When true, mounted views stay mounted after deactivation (default: true). */
14
14
  keepMounted?: boolean;
15
+ /** Publish activation effects synchronously or after the visible view has painted. */
16
+ activationMode?: 'sync' | 'after-paint';
15
17
  }
16
18
  export declare function KeepAliveStack(props: KeepAliveStackProps): JSX.Element;
@@ -1,141 +1,154 @@
1
- import { insert as x, createComponent as I, effect as z, className as V, setStyleProperty as q, template as E } from "solid-js/web";
2
- import { createMemo as w, createSignal as b, untrack as B, createEffect as S, For as F } from "solid-js";
3
- import { ViewActivationProvider as N } from "../../context/ViewActivationContext.js";
4
- import { cn as A } from "../../utils/cn.js";
5
- var C = /* @__PURE__ */ E("<div>");
6
- function y(n) {
7
- return String(n ?? "").trim();
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>");
7
+ function M(e) {
8
+ return String(e ?? "").trim();
8
9
  }
9
- function k(n) {
10
- const u = [], a = /* @__PURE__ */ new Set();
11
- for (const d of n) {
12
- const s = y(d?.id);
13
- s && (a.has(s) || (a.add(s), u.push(s)));
10
+ function z(e) {
11
+ const u = [], d = /* @__PURE__ */ new Set();
12
+ for (const f of e) {
13
+ const o = M(f?.id);
14
+ o && (d.has(o) || (d.add(o), u.push(o)));
14
15
  }
15
16
  return u;
16
17
  }
17
- function j(n, u) {
18
- const a = new Set(n), d = /* @__PURE__ */ new Map();
19
- for (const s of u) {
20
- const i = y(s?.id);
21
- i && a.has(i) && (d.has(i) || d.set(i, s));
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));
22
23
  }
23
- return d;
24
+ return f;
24
25
  }
25
- function D(n) {
26
- const [u, a] = b(0);
27
- let d = !1;
28
- S(() => {
29
- const i = n.active();
30
- i && !d && a((o) => o + 1), d = i;
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);
35
+ return;
36
+ }
37
+ const v = () => {
38
+ w !== a || !e.active() || k(f) || (o(!0), d((S) => S + 1));
39
+ };
40
+ r === "after-paint" ? G(v) : v();
41
+ }), j(() => {
42
+ a += 1;
31
43
  });
32
- const s = B(() => ({
33
- id: n.id,
34
- active: n.active,
44
+ const A = k(() => ({
45
+ id: e.id,
46
+ active: f,
35
47
  activationSeq: u
36
48
  }));
37
- return I(N, {
38
- value: s,
49
+ return g(D, {
50
+ value: A,
39
51
  get children() {
40
- var i = C();
41
- return x(i, () => n.children), z((o) => {
42
- var f = n.class, h = n.active() ? "block" : "none";
43
- return f !== o.e && V(i, o.e = f), h !== o.t && q(i, "display", o.t = h), o;
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;
44
56
  }, {
45
57
  e: void 0,
46
58
  t: void 0
47
- }), i;
59
+ }), s;
48
60
  }
49
61
  });
50
62
  }
51
- function Q(n) {
52
- const u = () => n.lazyMount !== !1, a = () => n.keepMounted !== !1, d = w(() => k(n.views)), [s, i] = b(B(() => j(k(n.views), n.views))), o = w(() => y(n.activeId));
53
- S(() => {
54
- const e = d(), t = n.views;
55
- i((r) => {
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) => {
56
68
  let c = !1;
57
- const l = new Map(r), M = new Set(e);
58
- for (const v of l.keys())
59
- M.has(v) || (l.delete(v), c = !0);
60
- for (const v of t) {
61
- const m = y(v?.id);
62
- m && M.has(m) && (l.has(m) || (l.set(m, v), c = !0));
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));
63
75
  }
64
- return c ? l : r;
76
+ return c ? l : i;
65
77
  });
66
78
  });
67
- const f = w(() => ({
68
- order: d(),
69
- byId: s()
70
- })), h = () => {
71
- if (!a()) return /* @__PURE__ */ new Set();
72
- if (!u()) return new Set(f().order);
73
- const e = o();
74
- return e ? f().byId.has(e) ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set();
75
- }, [K, g] = b(h());
76
- S(() => {
77
- if (!a()) return;
78
- const e = new Set(f().order);
79
- g((t) => {
80
- let r = !1;
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;
81
93
  const c = /* @__PURE__ */ new Set();
82
- for (const l of t) {
83
- if (!e.has(l)) {
84
- r = !0;
94
+ for (const l of n) {
95
+ if (!t.has(l)) {
96
+ i = !0;
85
97
  continue;
86
98
  }
87
99
  c.add(l);
88
100
  }
89
- return r ? c : t;
101
+ return i ? c : n;
90
102
  });
91
- }), S(() => {
92
- if (!a() || !u()) return;
93
- const e = o();
94
- e && f().byId.has(e) && g((t) => {
95
- if (t.has(e)) return t;
96
- const r = new Set(t);
97
- return r.add(e), r;
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;
98
110
  });
99
111
  });
100
- const O = w(() => {
101
- const e = f().order, t = o();
102
- if (!a())
103
- return t ? f().byId.has(t) ? [t] : [] : [];
104
- if (!u()) return e;
105
- const r = K();
106
- return e.filter((c) => r.has(c) || c === t);
107
- }), P = w(() => {
108
- const e = o();
109
- return e ? f().byId.has(e) : !1;
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;
110
122
  });
111
123
  return (() => {
112
- var e = C();
113
- return x(e, I(F, {
124
+ var t = E();
125
+ return V(t, g(F, {
114
126
  get each() {
115
- return O();
127
+ return K();
116
128
  },
117
- children: (t) => {
118
- const r = () => s().get(t);
119
- return I(D, {
120
- id: t,
121
- active: () => o() === t,
129
+ children: (n) => {
130
+ const i = () => a().get(n);
131
+ return g(J, {
132
+ id: n,
133
+ active: () => s() === n,
134
+ activationMode: f,
122
135
  get class() {
123
- return A("absolute inset-0", r()?.class);
136
+ return q("absolute inset-0", i()?.class);
124
137
  },
125
138
  get children() {
126
- return r()?.render();
139
+ return i()?.render();
127
140
  }
128
141
  });
129
142
  }
130
- })), z((t) => {
131
- var r = A("relative h-full min-h-0 w-full", n.class), c = P() ? "block" : "none";
132
- return r !== t.e && V(e, t.e = r), c !== t.t && q(e, "display", t.t = c), t;
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;
133
146
  }, {
134
147
  e: void 0,
135
148
  t: void 0
136
- }), e;
149
+ }), t;
137
150
  })();
138
151
  }
139
152
  export {
140
- Q as KeepAliveStack
153
+ X as KeepAliveStack
141
154
  };
@@ -34,6 +34,8 @@ export interface ShellProps {
34
34
  topBarActions?: JSX.Element;
35
35
  bottomBarItems?: JSX.Element;
36
36
  sidebarContent?: (activeTab: string) => JSX.Element;
37
+ /** Defer user-requested Activity content commits until the selected control has painted. */
38
+ activitySelectionMode?: 'sync' | 'ui-first';
37
39
  resolveSidebarVisibilityMotion?: (args: {
38
40
  currentActiveId: string;
39
41
  nextActiveId: string;