@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.
- package/dist/app/ActivityAppsMain.d.ts +2 -0
- package/dist/app/ActivityAppsMain.js +15 -12
- package/dist/components/layout/ActivityBar.js +1 -1
- package/dist/components/layout/KeepAliveStack.d.ts +2 -0
- package/dist/components/layout/KeepAliveStack.js +109 -96
- package/dist/components/layout/Shell.d.ts +2 -0
- package/dist/components/layout/Shell.js +167 -139
- package/dist/components/ui/Tabs.js +102 -103
- package/dist/full.js +59 -57
- package/dist/index.js +58 -56
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/uiFirstSelection.d.ts +29 -0
- package/dist/utils/uiFirstSelection.js +66 -0
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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(),
|
|
11
|
-
if (!d(() => !!e.views) && !
|
|
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(),
|
|
14
|
-
if (!
|
|
15
|
-
const
|
|
16
|
-
return
|
|
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: () =>
|
|
18
|
+
render: () => r(s, {
|
|
19
19
|
get component() {
|
|
20
20
|
return t.component;
|
|
21
21
|
}
|
|
22
22
|
})
|
|
23
23
|
}));
|
|
24
|
-
}),
|
|
25
|
-
return
|
|
24
|
+
}), c = () => e.views ?? a();
|
|
25
|
+
return r(f, {
|
|
26
26
|
get views() {
|
|
27
|
-
return
|
|
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", "
|
|
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
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { ViewActivationProvider as
|
|
4
|
-
import { cn as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
10
|
-
const u = [],
|
|
11
|
-
for (const
|
|
12
|
-
const
|
|
13
|
-
|
|
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
|
|
18
|
-
const
|
|
19
|
-
for (const
|
|
20
|
-
const
|
|
21
|
-
|
|
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
|
|
24
|
+
return f;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
-
const [u,
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
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
|
|
33
|
-
id:
|
|
34
|
-
active:
|
|
44
|
+
const A = k(() => ({
|
|
45
|
+
id: e.id,
|
|
46
|
+
active: f,
|
|
35
47
|
activationSeq: u
|
|
36
48
|
}));
|
|
37
|
-
return
|
|
38
|
-
value:
|
|
49
|
+
return g(D, {
|
|
50
|
+
value: A,
|
|
39
51
|
get children() {
|
|
40
|
-
var
|
|
41
|
-
return
|
|
42
|
-
var
|
|
43
|
-
return
|
|
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
|
-
}),
|
|
59
|
+
}), s;
|
|
48
60
|
}
|
|
49
61
|
});
|
|
50
62
|
}
|
|
51
|
-
function
|
|
52
|
-
const u = () =>
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
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(
|
|
58
|
-
for (const
|
|
59
|
-
|
|
60
|
-
for (const
|
|
61
|
-
const
|
|
62
|
-
|
|
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 :
|
|
76
|
+
return c ? l : i;
|
|
65
77
|
});
|
|
66
78
|
});
|
|
67
|
-
const
|
|
68
|
-
order:
|
|
69
|
-
byId:
|
|
70
|
-
})),
|
|
71
|
-
if (!
|
|
72
|
-
if (!u()) return new Set(
|
|
73
|
-
const
|
|
74
|
-
return
|
|
75
|
-
}, [
|
|
76
|
-
|
|
77
|
-
if (!
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
let
|
|
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
|
|
83
|
-
if (!
|
|
84
|
-
|
|
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
|
|
101
|
+
return i ? c : n;
|
|
90
102
|
});
|
|
91
|
-
}),
|
|
92
|
-
if (!
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
return
|
|
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
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
103
|
-
return
|
|
104
|
-
if (!u()) return
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
}),
|
|
108
|
-
const
|
|
109
|
-
return
|
|
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
|
|
113
|
-
return
|
|
124
|
+
var t = E();
|
|
125
|
+
return V(t, g(F, {
|
|
114
126
|
get each() {
|
|
115
|
-
return
|
|
127
|
+
return K();
|
|
116
128
|
},
|
|
117
|
-
children: (
|
|
118
|
-
const
|
|
119
|
-
return
|
|
120
|
-
id:
|
|
121
|
-
active: () =>
|
|
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
|
|
136
|
+
return q("absolute inset-0", i()?.class);
|
|
124
137
|
},
|
|
125
138
|
get children() {
|
|
126
|
-
return
|
|
139
|
+
return i()?.render();
|
|
127
140
|
}
|
|
128
141
|
});
|
|
129
142
|
}
|
|
130
|
-
})),
|
|
131
|
-
var
|
|
132
|
-
return
|
|
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
|
-
}),
|
|
149
|
+
}), t;
|
|
137
150
|
})();
|
|
138
151
|
}
|
|
139
152
|
export {
|
|
140
|
-
|
|
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;
|