@floegence/floe-webapp-core 0.33.1 → 0.33.2
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.
|
@@ -42,7 +42,7 @@ function Be(o) {
|
|
|
42
42
|
icon: e.icon,
|
|
43
43
|
label: e.name,
|
|
44
44
|
badge: e.sidebar?.badge,
|
|
45
|
-
collapseBehavior: e.sidebar?.fullScreen ? "preserve" : "toggle"
|
|
45
|
+
collapseBehavior: e.sidebar?.collapseBehavior ?? (e.sidebar?.fullScreen ? "preserve" : "toggle")
|
|
46
46
|
})) : []), z = f(() => u() ? [] : o.sidebarContent ? [] : a ? a.sidebarItems().filter((e) => !(d() && e.sidebar?.hiddenOnMobile)).filter((e) => e.sidebar?.fullScreen !== !0 && e.sidebar?.renderIn !== "main").map((e) => ({
|
|
47
47
|
id: e.id,
|
|
48
48
|
render: () => r(S, {
|
|
@@ -45,6 +45,7 @@ export interface StatusBarContribution {
|
|
|
45
45
|
order?: number;
|
|
46
46
|
component: Component;
|
|
47
47
|
}
|
|
48
|
+
export type SidebarCollapseBehavior = 'toggle' | 'preserve';
|
|
48
49
|
export interface FloeComponent<TProtocol = unknown> {
|
|
49
50
|
id: string;
|
|
50
51
|
name: string;
|
|
@@ -69,6 +70,17 @@ export interface FloeComponent<TProtocol = unknown> {
|
|
|
69
70
|
fullScreen?: boolean;
|
|
70
71
|
/** When true, this component is hidden in the activity bar on mobile */
|
|
71
72
|
hiddenOnMobile?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Optional activity-bar collapse behavior override.
|
|
75
|
+
*
|
|
76
|
+
* - `toggle`: click active tab to collapse, click again to reopen (VSCode-like).
|
|
77
|
+
* - `preserve`: tab switching does not mutate collapsed state.
|
|
78
|
+
*
|
|
79
|
+
* Default:
|
|
80
|
+
* - `fullScreen: true` -> `preserve`
|
|
81
|
+
* - otherwise -> `toggle`
|
|
82
|
+
*/
|
|
83
|
+
collapseBehavior?: SidebarCollapseBehavior;
|
|
72
84
|
};
|
|
73
85
|
commands?: CommandContribution<TProtocol>[];
|
|
74
86
|
statusBar?: StatusBarContribution[];
|
|
@@ -1,31 +1,38 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { createStore as
|
|
1
|
+
import { createEffect as c } from "solid-js";
|
|
2
|
+
import { createStore as m, produce as d } from "solid-js/store";
|
|
3
3
|
import { createSimpleContext as p } from "./createSimpleContext.js";
|
|
4
4
|
import { useResolvedFloeConfig as h } from "./FloeConfigContext.js";
|
|
5
5
|
const {
|
|
6
|
-
Provider:
|
|
7
|
-
use:
|
|
6
|
+
Provider: T,
|
|
7
|
+
use: w
|
|
8
8
|
} = p({
|
|
9
9
|
name: "Layout",
|
|
10
10
|
init: f
|
|
11
11
|
});
|
|
12
12
|
function f() {
|
|
13
|
-
const l = h(), a = () => l.config.layout, n = () => typeof window > "u" ? !1 : window.matchMedia(a().mobileQuery).matches,
|
|
13
|
+
const l = h(), a = () => l.config.layout, n = () => typeof window > "u" ? !1 : window.matchMedia(a().mobileQuery).matches, o = l.persist.load(a().storageKey, {}), b = {
|
|
14
14
|
sidebar: {
|
|
15
|
-
width:
|
|
16
|
-
activeTab:
|
|
17
|
-
collapsed:
|
|
15
|
+
width: o.sidebar?.width ?? a().sidebar.defaultWidth,
|
|
16
|
+
activeTab: o.sidebar?.activeTab ?? a().sidebar.defaultActiveTab,
|
|
17
|
+
collapsed: o.sidebar?.collapsed ?? a().sidebar.defaultCollapsed
|
|
18
18
|
},
|
|
19
19
|
terminal: {
|
|
20
|
-
opened:
|
|
21
|
-
height:
|
|
20
|
+
opened: o.terminal?.opened ?? a().terminal.defaultOpened,
|
|
21
|
+
height: o.terminal?.height ?? a().terminal.defaultHeight
|
|
22
22
|
},
|
|
23
23
|
isMobile: n()
|
|
24
|
-
}, [i, t] =
|
|
25
|
-
return
|
|
24
|
+
}, [i, t] = m(b);
|
|
25
|
+
return c(() => {
|
|
26
26
|
const e = {
|
|
27
|
-
sidebar:
|
|
28
|
-
|
|
27
|
+
sidebar: {
|
|
28
|
+
width: i.sidebar.width,
|
|
29
|
+
activeTab: i.sidebar.activeTab,
|
|
30
|
+
collapsed: i.sidebar.collapsed
|
|
31
|
+
},
|
|
32
|
+
terminal: {
|
|
33
|
+
opened: i.terminal.opened,
|
|
34
|
+
height: i.terminal.height
|
|
35
|
+
}
|
|
29
36
|
};
|
|
30
37
|
l.persist.debouncedSave(a().storageKey, e);
|
|
31
38
|
}), {
|
|
@@ -34,26 +41,26 @@ function f() {
|
|
|
34
41
|
sidebarActiveTab: () => i.sidebar.activeTab,
|
|
35
42
|
sidebarCollapsed: () => i.sidebar.collapsed,
|
|
36
43
|
// Sidebar actions
|
|
37
|
-
setSidebarWidth: (e) => t(
|
|
44
|
+
setSidebarWidth: (e) => t(d((r) => {
|
|
38
45
|
r.sidebar.width = Math.max(a().sidebar.clamp.min, Math.min(a().sidebar.clamp.max, e));
|
|
39
46
|
})),
|
|
40
|
-
setSidebarActiveTab: (e, r) => t(
|
|
47
|
+
setSidebarActiveTab: (e, r) => t(d((s) => {
|
|
41
48
|
s.sidebar.activeTab = e, r?.openSidebar !== !1 && (s.sidebar.collapsed = !1);
|
|
42
49
|
})),
|
|
43
|
-
setSidebarCollapsed: (e) => t(
|
|
50
|
+
setSidebarCollapsed: (e) => t(d((r) => {
|
|
44
51
|
r.sidebar.collapsed = e;
|
|
45
52
|
})),
|
|
46
|
-
toggleSidebarCollapse: () => t(
|
|
53
|
+
toggleSidebarCollapse: () => t(d((e) => {
|
|
47
54
|
e.sidebar.collapsed = !e.sidebar.collapsed;
|
|
48
55
|
})),
|
|
49
56
|
// Terminal accessors
|
|
50
57
|
terminalOpened: () => i.terminal.opened,
|
|
51
58
|
terminalHeight: () => i.terminal.height,
|
|
52
59
|
// Terminal actions
|
|
53
|
-
toggleTerminal: () => t(
|
|
60
|
+
toggleTerminal: () => t(d((e) => {
|
|
54
61
|
e.terminal.opened = !e.terminal.opened;
|
|
55
62
|
})),
|
|
56
|
-
setTerminalHeight: (e) => t(
|
|
63
|
+
setTerminalHeight: (e) => t(d((r) => {
|
|
57
64
|
r.terminal.height = Math.max(a().terminal.clamp.min, Math.min(a().terminal.clamp.max, e));
|
|
58
65
|
})),
|
|
59
66
|
// Mobile
|
|
@@ -62,7 +69,7 @@ function f() {
|
|
|
62
69
|
};
|
|
63
70
|
}
|
|
64
71
|
export {
|
|
65
|
-
|
|
72
|
+
T as LayoutProvider,
|
|
66
73
|
f as createLayoutService,
|
|
67
|
-
|
|
74
|
+
w as useLayout
|
|
68
75
|
};
|