@qilin-agent/client-ui-sidebar 0.0.0-stage → 3.1.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/LICENSE +21 -0
- package/README.i18n.yaml +55 -0
- package/README.md +115 -2
- package/README.zh.md +116 -0
- package/lib/client.js +660 -0
- package/lib/index.js +6 -0
- package/lib/types/client/HeaderLeadingControls.d.ts +17 -0
- package/lib/types/client/SidebarRoot.d.ts +8 -0
- package/lib/types/client/contract/slots.d.ts +200 -0
- package/lib/types/client/index.d.ts +18 -0
- package/lib/types/client/locales.d.ts +22 -0
- package/lib/types/index.d.ts +4 -0
- package/package.json +74 -3
package/lib/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@qilin-agent/client-ui-slots';
|
|
2
|
+
import type { SidebarRootInjected } from './contract/slots.ts';
|
|
3
|
+
/** Full props of the conversation-header leading occupant. */
|
|
4
|
+
export type HeaderLeadingControlsProps = PropsRuntime<'conversation.header.leading'> & InjectFace<SidebarRootInjected> & PropsLocale<'sidebar'>;
|
|
5
|
+
/**
|
|
6
|
+
* Sidebar-open and New Session controls in the conversation header's
|
|
7
|
+
* root-scoped leading seat, which the resident header renders with or without
|
|
8
|
+
* a selected Session. On macOS desktop a collapsed sidebar hides entirely (no
|
|
9
|
+
* rail), taking both controls off screen; this occupant puts them back beside
|
|
10
|
+
* the traffic lights. Mounted whenever the platform matches; visibility rides the
|
|
11
|
+
* AppFrame-published `data-sidebar-collapsed` attribute in CSS, so no
|
|
12
|
+
* collapse-state pipe is added here.
|
|
13
|
+
* @param props - Injected sidebar actions plus the sidebar locale seat.
|
|
14
|
+
* @returns the two header controls, or null off macOS desktop.
|
|
15
|
+
*/
|
|
16
|
+
export declare function HeaderLeadingControls({ toggleSidebar, startSession, useShortcuts, t }: HeaderLeadingControlsProps): import("react").JSX.Element | null;
|
|
17
|
+
//# sourceMappingURL=HeaderLeadingControls.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SidebarRootComponentProps } from './contract/slots.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Render the sidebar column shell.
|
|
4
|
+
* @param props - composed slot props (runtime share + injected callbacks, contract/slots.ts).
|
|
5
|
+
* @returns the sidebar element tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SidebarRoot({ collapsed, width, startSession, toggleSidebar, selectPanel, usePanels, useShortcuts, usePanelInfo, t, renderSlot, }: SidebarRootComponentProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=SidebarRoot.d.ts.map
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar slot contract: the registrant-side props composition for the
|
|
3
|
+
* layout-owned `sidebar` slot, plus the holes this shell declares. The shell
|
|
4
|
+
* owns column geometry, the brand row, New Session,
|
|
5
|
+
* and global panel rows; everything between the workspace section header and
|
|
6
|
+
* the list bottom is the `sidebar.workspaces` registrant's (ui-workspace), and
|
|
7
|
+
* the foot is the `sidebar.settings` registrant's (ui-settings), followed by
|
|
8
|
+
* optional footer actions in `sidebar.footer.action`.
|
|
9
|
+
*/
|
|
10
|
+
import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime } from '@qilin-agent/client-ui-slots';
|
|
11
|
+
import type { ObservableSnapshot } from '@qilin-agent/client-store';
|
|
12
|
+
import type { WorkspaceId } from '@qilin-agent/api-workspace-controller/client';
|
|
13
|
+
import type { MainPanelId } from '@qilin-agent/client-ui-layout/client';
|
|
14
|
+
import type { ShortcutCatalogEntry } from '@qilin-agent/client-shortcuts/client';
|
|
15
|
+
declare module '@qilin-agent/client-ui-slots' {
|
|
16
|
+
interface SlotMap {
|
|
17
|
+
/** Non-interactive notification inside the collapsed sidebar expand button. */
|
|
18
|
+
'sidebar.toggle.badge': {
|
|
19
|
+
kind: 'single';
|
|
20
|
+
scope: 'root';
|
|
21
|
+
owner: Record<never, never>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Brand mark rendered in the expanded brand row and collapsed rail.
|
|
25
|
+
* Declared by this package's `sidebar` entry; deployments may replace
|
|
26
|
+
* the shell's fish fallback without replacing the surrounding controls.
|
|
27
|
+
*/
|
|
28
|
+
'sidebar.brand.mark': {
|
|
29
|
+
kind: 'single';
|
|
30
|
+
scope: 'root';
|
|
31
|
+
owner: SidebarBrandMarkOwnerProps;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Brand name rendered beside the expanded mark. Declared by this
|
|
35
|
+
* package's `sidebar` entry; the shell supplies a generic text fallback.
|
|
36
|
+
*/
|
|
37
|
+
'sidebar.brand.name': {
|
|
38
|
+
kind: 'single';
|
|
39
|
+
scope: 'root';
|
|
40
|
+
owner: SidebarBrandNameOwnerProps;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Global panel icons. Each list id addresses the matching main panel;
|
|
44
|
+
* the sidebar owns the button and resolves its label from list metadata.
|
|
45
|
+
*/
|
|
46
|
+
'sidebar.panellist': {
|
|
47
|
+
kind: 'list';
|
|
48
|
+
scope: 'root';
|
|
49
|
+
owner: SidebarPanelIconOwnerProps;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Deployment-side section assignment for panel rows. Each occupant's
|
|
53
|
+
* inject face contributes a row-id → section-label map applied over the
|
|
54
|
+
* panel list before grouping, so a deployment can join rows it does not
|
|
55
|
+
* register itself (engine panels) into sections of its naming. An
|
|
56
|
+
* assignment wins over the row's own `section`. Declared by this
|
|
57
|
+
* package's `sidebar` entry.
|
|
58
|
+
*/
|
|
59
|
+
'sidebar.section.assignments': {
|
|
60
|
+
kind: 'list';
|
|
61
|
+
scope: 'root';
|
|
62
|
+
owner: SidebarSectionAssignmentsOwnerProps;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The workspace/session browsing region: section header, search, the
|
|
66
|
+
* grouped/flat session list, and every workspace dialog. Declared by this
|
|
67
|
+
* package's 'sidebar' entry (declaring is claiming); ui-workspace
|
|
68
|
+
* registers the browser.
|
|
69
|
+
*/
|
|
70
|
+
'sidebar.workspaces': {
|
|
71
|
+
kind: 'single';
|
|
72
|
+
scope: 'root';
|
|
73
|
+
owner: SidebarSectionOwnerProps;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The settings seat at the sidebar foot. Declared by this package's
|
|
77
|
+
* 'sidebar' entry; ui-settings registers its panel and the connection
|
|
78
|
+
* recovery row it reports while closed. The sidebar passes only its
|
|
79
|
+
* column state — it holds no settings state, and the account menu owns
|
|
80
|
+
* the visible Settings entry point.
|
|
81
|
+
*/
|
|
82
|
+
'sidebar.settings': {
|
|
83
|
+
kind: 'single';
|
|
84
|
+
scope: 'root';
|
|
85
|
+
owner: SidebarSettingsOwnerProps;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* The sidebar foot's account row, declared by this package's 'sidebar'
|
|
89
|
+
* entry and occupied by the account menu. It stacks below the footer
|
|
90
|
+
* actions and receives only the column state.
|
|
91
|
+
*/
|
|
92
|
+
'sidebar.account': {
|
|
93
|
+
kind: 'single';
|
|
94
|
+
scope: 'root';
|
|
95
|
+
owner: SidebarFooterActionOwnerProps;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Optional additive actions at the sidebar foot, stacked above the account
|
|
99
|
+
* row. Declared by this package's 'sidebar' entry; each action receives
|
|
100
|
+
* only the column state.
|
|
101
|
+
*/
|
|
102
|
+
'sidebar.footer.action': {
|
|
103
|
+
kind: 'list';
|
|
104
|
+
scope: 'root';
|
|
105
|
+
owner: SidebarFooterActionOwnerProps;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Geometry supplied to the sidebar brand-mark occupant. */
|
|
110
|
+
export interface SidebarBrandMarkOwnerProps {
|
|
111
|
+
/** Requested square edge in pixels. */
|
|
112
|
+
size: number;
|
|
113
|
+
}
|
|
114
|
+
/** Empty owner share for the sidebar brand-name occupant. */
|
|
115
|
+
export interface SidebarBrandNameOwnerProps {
|
|
116
|
+
/** Marker field: the occupant owns its own content and width. */
|
|
117
|
+
children?: never;
|
|
118
|
+
}
|
|
119
|
+
/** Icon presentation supplied by the global panel row. */
|
|
120
|
+
export interface SidebarPanelIconOwnerProps {
|
|
121
|
+
/** Requested square edge in pixels. */
|
|
122
|
+
size: number;
|
|
123
|
+
/** Whether this panel is selected in the main column. */
|
|
124
|
+
active: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** Owner share of a section-assignments seat: row-id → section label. */
|
|
127
|
+
export interface SidebarSectionAssignmentsOwnerProps {
|
|
128
|
+
/** Applied over every panel row; an assignment wins over the row's own section. */
|
|
129
|
+
assignments: Readonly<Record<string, string>>;
|
|
130
|
+
}
|
|
131
|
+
/** Serializable metadata for one active global panel list registration. */
|
|
132
|
+
export interface SidebarPanelMetadata {
|
|
133
|
+
/** List id and matching main panel key. */
|
|
134
|
+
id: MainPanelId;
|
|
135
|
+
/** Ascending row order; ties retain registration order. */
|
|
136
|
+
order: number;
|
|
137
|
+
/** Row title and accessible name: resolved label, or the id when omitted. */
|
|
138
|
+
label: string;
|
|
139
|
+
/**
|
|
140
|
+
* Optional grouping label. Consecutive rows sharing a section render under
|
|
141
|
+
* one header; `undefined` rows render header-less. The sidebar owns the
|
|
142
|
+
* header because it owns the list.
|
|
143
|
+
*
|
|
144
|
+
* Spelled `| undefined` on purpose: this value is copied out of the
|
|
145
|
+
* type-erased registration options (which admit undefined under
|
|
146
|
+
* exactOptionalPropertyTypes), so the projection must accept it.
|
|
147
|
+
*/
|
|
148
|
+
section?: string | undefined;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Owner share of the browser hole — the only facts crossing the shell/region
|
|
152
|
+
* boundary. Business data and actions arrive through the region's own inject.
|
|
153
|
+
*/
|
|
154
|
+
export interface SidebarSectionOwnerProps {
|
|
155
|
+
/** Shell fold-state output: wide renders the full browser, rail the icon column. */
|
|
156
|
+
wide: boolean;
|
|
157
|
+
/** Rail icons request expansion; the browser rides the wide flip for focus. */
|
|
158
|
+
expandSidebar: () => void;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Owner share of the sidebar settings seat: the column display state the
|
|
162
|
+
* occupant renders against (wide row vs 56px rail).
|
|
163
|
+
*/
|
|
164
|
+
export interface SidebarSettingsOwnerProps {
|
|
165
|
+
/** Whether the sidebar renders wide content (false = 56px rail). */
|
|
166
|
+
wide: boolean;
|
|
167
|
+
}
|
|
168
|
+
/** Owner share of an action rendered at the sidebar foot. */
|
|
169
|
+
export interface SidebarFooterActionOwnerProps {
|
|
170
|
+
/** Whether the sidebar renders wide content (false = 56px rail). */
|
|
171
|
+
wide: boolean;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Registrant-private injected share (arrives via the register inject
|
|
175
|
+
* factory). The renderer binds the panel metadata source to usePanels.
|
|
176
|
+
*/
|
|
177
|
+
export type SidebarRootInjected = {
|
|
178
|
+
/**
|
|
179
|
+
* Start a New Session: with a workspace, reuse-or-create its blank session
|
|
180
|
+
* and open it; without one, inherit the current Session Workspace, then the
|
|
181
|
+
* recent Workspace, or clear into the New Session pure view when none exist.
|
|
182
|
+
*/
|
|
183
|
+
startSession: (workspaceId?: WorkspaceId) => void;
|
|
184
|
+
/** Toggle the sidebar column through the layout service. */
|
|
185
|
+
toggleSidebar: () => void;
|
|
186
|
+
/** Select the global panel addressed by a sidebar row. */
|
|
187
|
+
selectPanel: (id: MainPanelId) => void;
|
|
188
|
+
/** Private reactive sources bound to framework selector hooks. */
|
|
189
|
+
hooks: {
|
|
190
|
+
panels: ObservableSnapshot<readonly SidebarPanelMetadata[]>;
|
|
191
|
+
shortcuts: ObservableSnapshot<readonly ShortcutCatalogEntry[]>;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Full component props: layout owner state/actions plus the declared holes'
|
|
196
|
+
* render shares, this package's injected callbacks, and the standard locale
|
|
197
|
+
* seat. Panel metadata arrives through an injected observable.
|
|
198
|
+
*/
|
|
199
|
+
export type SidebarRootComponentProps = PropsRuntime<'sidebar'> & PropsRenderSlots<'sidebar.brand.mark' | 'sidebar.brand.name' | 'sidebar.toggle.badge' | 'sidebar.panellist' | 'sidebar.workspaces' | 'sidebar.settings' | 'sidebar.account' | 'sidebar.footer.action'> & InjectFace<SidebarRootInjected> & PropsLocale<'sidebar'>;
|
|
200
|
+
//# sourceMappingURL=slots.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Registers the sidebar shell and global panel navigation. */
|
|
2
|
+
import type { Context as ClientContext } from '@qilin-agent/kylin';
|
|
3
|
+
import { type SidebarKey } from './locales.ts';
|
|
4
|
+
export type { SidebarBrandMarkOwnerProps, SidebarBrandNameOwnerProps, SidebarFooterActionOwnerProps, SidebarPanelIconOwnerProps, SidebarPanelMetadata, SidebarRootComponentProps, SidebarRootInjected, SidebarSectionAssignmentsOwnerProps, SidebarSectionOwnerProps, SidebarSettingsOwnerProps, } from './contract/slots.ts';
|
|
5
|
+
export type { SidebarKey } from './locales.ts';
|
|
6
|
+
declare module '@qilin-agent/client-ui-slots' {
|
|
7
|
+
interface LocaleNamespaceMap {
|
|
8
|
+
/** Sidebar controls and global panel copy. */
|
|
9
|
+
sidebar: SidebarKey;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Services required by the sidebar plugin. */
|
|
13
|
+
export declare const inject: string[];
|
|
14
|
+
/** Registers the sidebar shell and its service callbacks.
|
|
15
|
+
* @param ctx - Client root context.
|
|
16
|
+
*/
|
|
17
|
+
export declare function apply(ctx: ClientContext): void;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** `sidebar` namespace dictionaries for shell controls and global panels. */
|
|
2
|
+
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
3
|
+
export declare const zh: {
|
|
4
|
+
'shortcut.hint': string;
|
|
5
|
+
'session.new': string;
|
|
6
|
+
'session.new.label': string;
|
|
7
|
+
'toggle.open': string;
|
|
8
|
+
'toggle.collapse': string;
|
|
9
|
+
'panels.label': string;
|
|
10
|
+
};
|
|
11
|
+
/** The sidebar namespace key union. */
|
|
12
|
+
export type SidebarKey = keyof typeof zh;
|
|
13
|
+
/** English dictionary, checked complete against the zh key set. */
|
|
14
|
+
export declare const en: {
|
|
15
|
+
'shortcut.hint': string;
|
|
16
|
+
'session.new': string;
|
|
17
|
+
'session.new.label': string;
|
|
18
|
+
'toggle.open': string;
|
|
19
|
+
'toggle.collapse': string;
|
|
20
|
+
'panels.label': string;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=locales.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/client-ui-sidebar",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Sidebar plugin: session multi-level tree, search, grouping, state dots",
|
|
4
|
+
"version": "3.1.4",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/kkutysllb/QiLin.git",
|
|
11
|
+
"directory": "packages/client/ui-sidebar"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"types": "lib/types/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./lib/types/index.d.ts",
|
|
22
|
+
"default": "./lib/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./client": {
|
|
25
|
+
"types": "./lib/types/client/index.d.ts",
|
|
26
|
+
"default": "./lib/client.js"
|
|
27
|
+
},
|
|
28
|
+
"./src/*": "./src/*",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"qilin": {
|
|
32
|
+
"client": {
|
|
33
|
+
"inject": [
|
|
34
|
+
"@qilin-agent/api-workspace-controller",
|
|
35
|
+
"@qilin-agent/client-locale",
|
|
36
|
+
"@qilin-agent/client-shortcuts",
|
|
37
|
+
"@qilin-agent/client-ui-conversation",
|
|
38
|
+
"@qilin-agent/client-ui-layout",
|
|
39
|
+
"@qilin-agent/client-ui-renderer",
|
|
40
|
+
"@qilin-agent/client-ui-session",
|
|
41
|
+
"@qilin-agent/client-ui-workspace"
|
|
42
|
+
],
|
|
43
|
+
"platform": "web"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@qilin-agent/kylin": "~4.0.3"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/react": "~18.3.1",
|
|
52
|
+
"clsx": "^2.0.0",
|
|
53
|
+
"react": "^18.2.0",
|
|
54
|
+
"@qilin-agent/api-workspace-controller": "3.1.4",
|
|
55
|
+
"@qilin-agent/client-locale": "3.1.4",
|
|
56
|
+
"@qilin-agent/client-shortcuts": "3.1.4",
|
|
57
|
+
"@qilin-agent/client-ui-conversation": "3.1.4",
|
|
58
|
+
"@qilin-agent/client-test-runtime": "3.1.4",
|
|
59
|
+
"@qilin-agent/client-store": "3.1.4",
|
|
60
|
+
"@qilin-agent/client-ui-layout": "3.1.4",
|
|
61
|
+
"@qilin-agent/client-ui-primitives": "3.1.4",
|
|
62
|
+
"@qilin-agent/client-ui-renderer": "3.1.4",
|
|
63
|
+
"@qilin-agent/client-ui-session": "3.1.4",
|
|
64
|
+
"@qilin-agent/client-ui-slots": "3.1.4",
|
|
65
|
+
"@qilin-agent/client-ui-workspace": "3.1.4",
|
|
66
|
+
"@qilin-agent/kylin": "~4.0.3"
|
|
67
|
+
},
|
|
68
|
+
"files": [
|
|
69
|
+
"lib/index.js",
|
|
70
|
+
"lib/client.js",
|
|
71
|
+
"lib/types/**/*.d.ts"
|
|
72
|
+
],
|
|
73
|
+
"scripts": {
|
|
74
|
+
"bundle": "tsdown",
|
|
75
|
+
"watch": "tsdown --watch"
|
|
76
|
+
}
|
|
6
77
|
}
|