nexus-shell 0.1.23 → 0.2.1
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/README.md +191 -106
- package/dist/components/layout/ShellLayout.d.ts +90 -12
- package/dist/components/widgets/ActivityBar.d.ts +48 -1
- package/dist/components/widgets/AppTitle.d.ts +30 -0
- package/dist/components/widgets/ChatPane.d.ts +63 -1
- package/dist/components/widgets/CommandPalette.d.ts +55 -7
- package/dist/components/widgets/ContextMenu.d.ts +34 -3
- package/dist/components/widgets/DataGrid.d.ts +44 -0
- package/dist/components/widgets/MenuBar.d.ts +55 -5
- package/dist/components/widgets/Modal.d.ts +58 -0
- package/dist/components/widgets/QuickSearch.d.ts +66 -0
- package/dist/components/widgets/SearchWidget.d.ts +36 -0
- package/dist/components/widgets/SettingsPanel.d.ts +33 -0
- package/dist/components/widgets/SidebarPane.d.ts +37 -1
- package/dist/components/widgets/StatusBar.d.ts +51 -1
- package/dist/components/widgets/TerminalPane.d.ts +43 -1
- package/dist/components/widgets/ThemeSwitcher.d.ts +35 -5
- package/dist/components/widgets/TreeWidget.d.ts +94 -5
- package/dist/components/widgets/UserProfile.d.ts +75 -6
- package/dist/connected/ConnectedActivityBar.d.ts +10 -0
- package/dist/connected/ConnectedChatPane.d.ts +18 -0
- package/dist/connected/ConnectedCommandPalette.d.ts +18 -0
- package/dist/connected/ConnectedMenuBar.d.ts +12 -0
- package/dist/connected/ConnectedModal.d.ts +15 -0
- package/dist/connected/ConnectedSidebarPane.d.ts +12 -0
- package/dist/connected/ConnectedStatusBar.d.ts +15 -0
- package/dist/connected/ConnectedTerminalPane.d.ts +18 -0
- package/dist/connected/ConnectedThemeSwitcher.d.ts +11 -0
- package/dist/connected/ConnectedUserProfile.d.ts +14 -0
- package/dist/connected/index.d.ts +21 -0
- package/dist/core/Boot.d.ts +64 -2
- package/dist/core/registry/MenuRegistry.d.ts +22 -9
- package/dist/core/services/ChatService.d.ts +23 -7
- package/dist/core/services/StatusBarService.d.ts +17 -14
- package/dist/index.d.ts +53 -33
- package/dist/lib/cn.d.ts +12 -0
- package/dist/nexus-shell.es.js +2427 -40
- package/dist/nexus-shell.umd.js +1 -3707
- package/dist/style.css +1 -1
- package/package.json +43 -15
- package/dist/App.d.ts +0 -2
- package/dist/components/layout/NexusWorkspaceShell.d.ts +0 -9
- package/dist/components/widgets/AgentManager.d.ts +0 -18
- package/dist/components/widgets/ArgumentInspectorWidget.d.ts +0 -5
- package/dist/components/widgets/DialogueMapperInspector.d.ts +0 -5
- package/dist/components/widgets/DialogueMapperLibrary.d.ts +0 -11
- package/dist/components/widgets/DialogueMapperLibraryWidget.d.ts +0 -3
- package/dist/components/widgets/DialogueMappingWidget.d.ts +0 -10
- package/dist/components/widgets/FilesSidebar.d.ts +0 -1
- package/dist/components/widgets/FlowControlToolbar.d.ts +0 -18
- package/dist/components/widgets/GlobalModal.d.ts +0 -3
- package/dist/components/widgets/MenuBarSearch.d.ts +0 -11
- package/dist/components/widgets/MockupReviewWidget.d.ts +0 -3
- package/dist/components/widgets/NexusWorkspaceTitle.d.ts +0 -10
- package/dist/components/widgets/ProjectPropertiesWidget.d.ts +0 -8
- package/dist/components/widgets/WargameMap.d.ts +0 -31
- package/dist/components/widgets/WelcomeTab.d.ts +0 -8
- package/dist/components/widgets/dialogue-mapper/IbisNode.d.ts +0 -5
- package/dist/components/widgets/mockup-reviewer/ExecutionOverlay.d.ts +0 -10
- package/dist/components/widgets/mockup-reviewer/HtmlShadowRenderer.d.ts +0 -9
- package/dist/components/widgets/mockup-reviewer/ImplementationPlanWorkspace.d.ts +0 -8
- package/dist/components/widgets/mockup-reviewer/MockupReviewWorkspace.d.ts +0 -10
- package/dist/components/widgets/mockup-reviewer/ReviewSidebar.d.ts +0 -3
- package/dist/components/widgets/mockup-reviewer/ReviewToolbar.d.ts +0 -12
- package/dist/components/widgets/mockup-reviewer/WorkflowMapper.d.ts +0 -7
- package/dist/components/widgets/wiki/AiCoWriterWorkspace.d.ts +0 -3
- package/dist/components/widgets/wiki/SemanticLinkMapper.d.ts +0 -3
- package/dist/components/widgets/wiki/WikiChatWidget.d.ts +0 -3
- package/dist/components/widgets/wiki/WikiEditor.d.ts +0 -3
- package/dist/components/widgets/wiki/WikiHistorySidebar.d.ts +0 -3
- package/dist/components/widgets/wiki/WikiNavigator.d.ts +0 -3
- package/dist/core/services/DialogueMappingService.d.ts +0 -59
- package/dist/core/services/FileStoreService.d.ts +0 -11
- package/dist/core/services/MockupReviewService.d.ts +0 -58
- package/dist/core/services/dialogue-mapper/DialogueLayoutEngine.d.ts +0 -9
- package/dist/core/services/dialogue-mapper/DialogueMapRepository.d.ts +0 -15
- package/dist/core/services/mockup-reviewer/MockupFixtures.d.ts +0 -11
- package/dist/core/services/useWikiStore.d.ts +0 -33
- package/dist/index-4EyxMz0x.js +0 -78516
- package/dist/main.d.ts +0 -1
- package/dist/maplibre-gl-DJOCpYhv.js +0 -24588
- package/dist/plugins/WikiPlugin.d.ts +0 -3
- package/dist/stories/ActivityBar.stories.d.ts +0 -9
- package/dist/stories/AgentManager.stories.d.ts +0 -25
- package/dist/stories/ChatPane.stories.d.ts +0 -10
- package/dist/stories/CommandPalette.stories.d.ts +0 -9
- package/dist/stories/DataGrid.stories.d.ts +0 -12
- package/dist/stories/DialogueMapperLibrary.stories.d.ts +0 -10
- package/dist/stories/DialogueMappingWidget.stories.d.ts +0 -9
- package/dist/stories/FlowControlToolbar.stories.d.ts +0 -14
- package/dist/stories/GlobalModal.stories.d.ts +0 -7
- package/dist/stories/IbisNode.stories.d.ts +0 -10
- package/dist/stories/MenuBar.stories.d.ts +0 -10
- package/dist/stories/MenuBarSearch.stories.d.ts +0 -7
- package/dist/stories/MockupReviewWidget.stories.d.ts +0 -9
- package/dist/stories/MockupReviewerLayout.stories.d.ts +0 -8
- package/dist/stories/NexusWorkspaceShell.stories.d.ts +0 -9
- package/dist/stories/NexusWorkspaceTitle.stories.d.ts +0 -11
- package/dist/stories/SearchWidget.stories.d.ts +0 -9
- package/dist/stories/ShellLayout.stories.d.ts +0 -13
- package/dist/stories/SidebarPane.stories.d.ts +0 -8
- package/dist/stories/StatusBar.stories.d.ts +0 -10
- package/dist/stories/TerminalPane.stories.d.ts +0 -9
- package/dist/stories/ThemeSwitcher.stories.d.ts +0 -10
- package/dist/stories/TreeWidget.stories.d.ts +0 -8
- package/dist/stories/UserProfile.stories.d.ts +0 -11
- package/dist/stories/WargameMap.stories.d.ts +0 -14
- package/dist/stories/wiki/WikiComposition.stories.d.ts +0 -6
- package/dist/stories/wiki/WikiWidgets.stories.d.ts +0 -11
|
@@ -1,21 +1,110 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
+
/** A node in the {@link TreeWidget} hierarchy. */
|
|
3
4
|
export interface ITreeNode {
|
|
5
|
+
/** Stable identifier, unique across the whole tree. */
|
|
4
6
|
id: string;
|
|
7
|
+
/** Text shown for the node. */
|
|
5
8
|
label: string;
|
|
9
|
+
/** `folder` nodes expand on click; `file` nodes do not. */
|
|
6
10
|
type: 'file' | 'folder';
|
|
11
|
+
/** Child nodes. Only rendered while `isOpen` is `true`. */
|
|
7
12
|
children?: ITreeNode[];
|
|
13
|
+
/** Whether a folder is expanded. Controlled by you — see `onToggle`. */
|
|
8
14
|
isOpen?: boolean;
|
|
9
|
-
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Where a context-menu action applies.
|
|
18
|
+
*
|
|
19
|
+
* `nodeId` is `null` when the menu was opened on empty background, which is how
|
|
20
|
+
* you distinguish "new file here" from "new file at the root".
|
|
21
|
+
*/
|
|
22
|
+
export interface ITreeContext {
|
|
23
|
+
/** The right-clicked node's id, or `null` for the background. */
|
|
24
|
+
nodeId: string | null;
|
|
25
|
+
/** The right-clicked node, or `null` for the background. */
|
|
26
|
+
node: ITreeNode | null;
|
|
27
|
+
}
|
|
28
|
+
/** A custom entry in the tree's right-click menu. */
|
|
29
|
+
export interface ITreeAction {
|
|
30
|
+
/** Stable identifier. Used as the React key. */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Label shown in the menu. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** Optional icon element, rendered before the label. */
|
|
35
|
+
icon?: React.ReactNode;
|
|
36
|
+
/** Runs with the right-clicked target. */
|
|
37
|
+
onSelect: (context: ITreeContext) => void;
|
|
38
|
+
/** Draw a separator above this entry. */
|
|
39
|
+
divider?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Restrict where the entry appears. Defaults to everywhere. Use this for
|
|
42
|
+
* actions that only make sense on a folder, or only on the background.
|
|
43
|
+
*/
|
|
44
|
+
showFor?: ('file' | 'folder' | 'background')[];
|
|
10
45
|
}
|
|
11
46
|
export interface TreeWidgetProps {
|
|
47
|
+
/** Root nodes. Expansion state lives on the nodes themselves via `isOpen`. */
|
|
12
48
|
data: ITreeNode[];
|
|
13
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Called when a folder is clicked. Flip that node's `isOpen` in your own
|
|
51
|
+
* state — the tree renders expansion but does not own it.
|
|
52
|
+
*/
|
|
53
|
+
onToggle?: (node: ITreeNode) => void;
|
|
54
|
+
/** Called when a node is double-clicked. Typically opens the item. */
|
|
55
|
+
onActivate?: (node: ITreeNode) => void;
|
|
56
|
+
/** Called after a node is dragged onto a folder. */
|
|
57
|
+
onMoveNode?: (draggedId: string, targetFolderId: string) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Entries for the right-click menu. Defaults to New File, New Folder, Rename
|
|
60
|
+
* and Delete, which map to the `onNew*` / `onRename` / `onDelete` props.
|
|
61
|
+
*
|
|
62
|
+
* Pass your own array to replace that set entirely — this is the extension
|
|
63
|
+
* point for app-specific commands, so the tree itself stays generic.
|
|
64
|
+
*/
|
|
65
|
+
actions?: ITreeAction[];
|
|
66
|
+
/** Handler for the built-in "New File" action. */
|
|
14
67
|
onNewFile?: (parentId: string | null) => void;
|
|
68
|
+
/** Handler for the built-in "New Folder" action. */
|
|
15
69
|
onNewFolder?: (parentId: string | null) => void;
|
|
16
|
-
|
|
70
|
+
/** Handler for the built-in "Rename" action. */
|
|
17
71
|
onRename?: (nodeId: string) => void;
|
|
72
|
+
/** Handler for the built-in "Delete" action. */
|
|
18
73
|
onDelete?: (nodeId: string) => void;
|
|
19
|
-
|
|
74
|
+
/** Indentation added per depth level, in px. Defaults to `12`. */
|
|
75
|
+
indent?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Virtualise rows with `react-virtuoso`. Leave on for large trees; turn it
|
|
78
|
+
* off when every row must be present in the DOM — printing, full-text browser
|
|
79
|
+
* search, or a test environment that can't measure layout. Defaults to `true`.
|
|
80
|
+
*/
|
|
81
|
+
virtualized?: boolean;
|
|
82
|
+
/** Extra classes merged onto the root element. */
|
|
83
|
+
className?: string;
|
|
20
84
|
}
|
|
21
|
-
|
|
85
|
+
/**
|
|
86
|
+
* A virtualised file-explorer tree with drag-to-move and a right-click menu.
|
|
87
|
+
*
|
|
88
|
+
* Rows are virtualised via `react-virtuoso`, so very large trees stay
|
|
89
|
+
* responsive. The component is controlled: expansion lives on your nodes as
|
|
90
|
+
* `isOpen` and changes are reported through `onToggle`, so the tree never holds
|
|
91
|
+
* a second copy of your data.
|
|
92
|
+
*
|
|
93
|
+
* The context menu is data-driven. The defaults cover the usual file
|
|
94
|
+
* operations; pass `actions` to replace them with your own commands rather than
|
|
95
|
+
* adding one-off props.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <TreeWidget
|
|
100
|
+
* data={nodes}
|
|
101
|
+
* onToggle={(n) => setNodes(toggle(nodes, n.id))}
|
|
102
|
+
* onActivate={(n) => open(n.id)}
|
|
103
|
+
* actions={[
|
|
104
|
+
* { id: 'new-map', label: 'New Map', icon: <Map size={14} />,
|
|
105
|
+
* showFor: ['folder', 'background'], onSelect: (ctx) => createMap(ctx.nodeId) },
|
|
106
|
+
* ]}
|
|
107
|
+
* />
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare const TreeWidget: ({ data, onToggle, onActivate, onMoveNode, actions, onNewFile, onNewFolder, onRename, onDelete, indent, virtualized, className, }: TreeWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,81 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/** The identity rendered by {@link UserProfile}. */
|
|
4
|
+
export interface IUserProfile {
|
|
5
|
+
/** Display name. Shown on the trigger and in the dropdown header. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Secondary line, e.g. job title. Omit to hide it. */
|
|
6
8
|
role?: string;
|
|
9
|
+
/** Shown in the dropdown header only. */
|
|
7
10
|
email?: string;
|
|
11
|
+
/** Image URL or data URL. Falls back to a generic user icon. */
|
|
12
|
+
avatarUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
/** An action in the profile dropdown. */
|
|
15
|
+
export interface IUserProfileAction {
|
|
16
|
+
/** Stable identifier. Used as the React key. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Label shown for the action. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** `lucide-react` icon rendered at 12px. */
|
|
21
|
+
icon?: LucideIcon;
|
|
22
|
+
/** Runs on click. The dropdown closes afterwards. */
|
|
23
|
+
onSelect: () => void;
|
|
24
|
+
/** Render in the destructive colour, for sign-out and similar. */
|
|
25
|
+
destructive?: boolean;
|
|
26
|
+
/** Draw a separator above this action. */
|
|
27
|
+
divider?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface UserProfileProps {
|
|
30
|
+
/** The identity to display. */
|
|
31
|
+
profile: IUserProfile;
|
|
32
|
+
/**
|
|
33
|
+
* Actions listed in the dropdown. Empty by default — the component prescribes
|
|
34
|
+
* no menu, since "Sign Out" and "Account Settings" mean different things in
|
|
35
|
+
* every app.
|
|
36
|
+
*/
|
|
37
|
+
actions?: IUserProfileAction[];
|
|
38
|
+
/**
|
|
39
|
+
* Called with the new name and role when the inline editor is saved.
|
|
40
|
+
* Omit it to hide the edit affordance entirely.
|
|
41
|
+
*/
|
|
42
|
+
onProfileChange?: (profile: Pick<IUserProfile, 'name' | 'role'>) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Called with a file the user picked for their avatar. Read it and update
|
|
45
|
+
* `profile.avatarUrl` yourself — the component neither reads files nor holds
|
|
46
|
+
* the result. Omit it to hide the upload affordance.
|
|
47
|
+
*/
|
|
48
|
+
onAvatarChange?: (file: File) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Bypass the dropdown entirely and just report the click. Useful when the
|
|
51
|
+
* profile should open a full settings tab instead of a menu.
|
|
52
|
+
*/
|
|
8
53
|
onClick?: () => void;
|
|
9
|
-
|
|
54
|
+
/** Show the name and role beside the avatar. Defaults to `true`. */
|
|
10
55
|
showName?: boolean;
|
|
56
|
+
/** Extra classes merged onto the trigger button. */
|
|
57
|
+
className?: string;
|
|
11
58
|
}
|
|
12
|
-
|
|
59
|
+
/**
|
|
60
|
+
* An avatar and identity widget with a dropdown menu, sized for a menu bar's
|
|
61
|
+
* right slot.
|
|
62
|
+
*
|
|
63
|
+
* Fully controlled — it owns only its open/editing UI state. The identity comes
|
|
64
|
+
* in as `profile`, edits go out through `onProfileChange`, and the menu is
|
|
65
|
+
* whatever you pass as `actions`. It reads no store and prescribes no menu
|
|
66
|
+
* items, so it works the same against a session hook, an auth provider, or
|
|
67
|
+
* static props.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <UserProfile
|
|
72
|
+
* profile={{ name: 'Ada Lovelace', role: 'Engineer', email: 'ada@example.com' }}
|
|
73
|
+
* onProfileChange={(next) => save(next)}
|
|
74
|
+
* actions={[
|
|
75
|
+
* { id: 'settings', label: 'Account Settings', icon: Settings, onSelect: openSettings },
|
|
76
|
+
* { id: 'out', label: 'Sign Out', icon: LogOut, onSelect: signOut, destructive: true, divider: true },
|
|
77
|
+
* ]}
|
|
78
|
+
* />
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare const UserProfile: ({ profile, actions, onProfileChange, onAvatarChange, onClick, showName, className, }: UserProfileProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActivityBarProps } from '../components/widgets/ActivityBar';
|
|
2
|
+
|
|
3
|
+
export type ConnectedActivityBarProps = Omit<ActivityBarProps, 'items' | 'activeId' | 'onSelect'>;
|
|
4
|
+
/**
|
|
5
|
+
* {@link ActivityBar} bound to `useSidebarStore`.
|
|
6
|
+
*
|
|
7
|
+
* Derives its items from the registered sidebar panels and toggles the active
|
|
8
|
+
* panel on click — clicking the already-active item closes the sidebar.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ConnectedActivityBar: (props: ConnectedActivityBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChatPaneProps } from '../components/widgets/ChatPane';
|
|
2
|
+
|
|
3
|
+
export type ConnectedChatPaneProps = Omit<ChatPaneProps, 'messages' | 'slashCommands' | 'onSend' | 'onClose'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Handle a plain (non-slash) message. Append any reply with
|
|
6
|
+
* `useChatStore.getState().addMessage(...)`. Without this, user messages are
|
|
7
|
+
* recorded but nothing responds.
|
|
8
|
+
*/
|
|
9
|
+
onSend?: (text: string) => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* {@link ChatPane} bound to `useChatStore` and `useRightSidebarStore`.
|
|
13
|
+
*
|
|
14
|
+
* Renders nothing while the right sidebar reports chat closed. Appends each
|
|
15
|
+
* submission to the transcript, then either dispatches a registered slash
|
|
16
|
+
* command's `execute` or hands the text to `onSend`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ConnectedChatPane: ({ onSend, ...props }: ConnectedChatPaneProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommandPaletteProps } from '../components/widgets/CommandPalette';
|
|
2
|
+
import { ICommand } from '../core/registry/CommandRegistry';
|
|
3
|
+
|
|
4
|
+
export type ConnectedCommandPaletteProps = Omit<CommandPaletteProps<ICommand>, 'open' | 'commands' | 'onSelect' | 'onClose'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Key that opens the palette when held with Cmd/Ctrl+Shift. Defaults to
|
|
7
|
+
* `"p"`, matching VS Code's `Cmd+Shift+P`. Pass `null` to bind nothing.
|
|
8
|
+
*/
|
|
9
|
+
shortcutKey?: string | null;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* {@link CommandPalette} bound to the {@link commandRegistry}.
|
|
13
|
+
*
|
|
14
|
+
* Owns its own visibility and binds a global `Cmd/Ctrl+Shift+P` listener to
|
|
15
|
+
* toggle it. Selecting a command runs the registry entry's `execute` and closes
|
|
16
|
+
* the palette.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ConnectedCommandPalette: ({ shortcutKey, ...props }: ConnectedCommandPaletteProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MenuBarProps } from '../components/widgets/MenuBar';
|
|
2
|
+
|
|
3
|
+
export type ConnectedMenuBarProps = Omit<MenuBarProps, 'menus' | 'onSelect'>;
|
|
4
|
+
/**
|
|
5
|
+
* {@link MenuBar} bound to the {@link menuRegistry} and {@link commandRegistry}.
|
|
6
|
+
*
|
|
7
|
+
* Reads the menu structure from the registry, backfills keybinding hints from
|
|
8
|
+
* each item's registered command, and dispatches the item's `commandId` on
|
|
9
|
+
* select. Use this inside a shell; use the plain {@link MenuBar} when you want
|
|
10
|
+
* to pass menus as data.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ConnectedMenuBar: (props: ConnectedMenuBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModalProps } from '../components/widgets/Modal';
|
|
2
|
+
|
|
3
|
+
export type ConnectedModalProps = Omit<ModalProps, 'open' | 'type' | 'title' | 'message' | 'defaultValue' | 'onConfirm' | 'onCancel'>;
|
|
4
|
+
/**
|
|
5
|
+
* {@link Modal} bound to `useModalStore`.
|
|
6
|
+
*
|
|
7
|
+
* Mount this once near the root of your app. It renders whichever dialog the
|
|
8
|
+
* store has open and resolves the store's pending promise on dismissal, which
|
|
9
|
+
* is what lets any code `await useModalStore.getState().openConfirm(...)`
|
|
10
|
+
* without holding a component reference.
|
|
11
|
+
*
|
|
12
|
+
* Resolution values follow the store's contract: `prompt` resolves to the text
|
|
13
|
+
* or `null`, `confirm` to a boolean, `alert` to `undefined`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ConnectedModal: (props: ConnectedModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SidebarPaneProps } from '../components/widgets/SidebarPane';
|
|
2
|
+
|
|
3
|
+
export type ConnectedSidebarPaneProps = Omit<SidebarPaneProps, 'title' | 'children' | 'onClose'>;
|
|
4
|
+
/**
|
|
5
|
+
* {@link SidebarPane} bound to `useSidebarStore`.
|
|
6
|
+
*
|
|
7
|
+
* Renders whichever panel is active, or nothing when the sidebar is closed. The
|
|
8
|
+
* reserved `"settings"` panel id renders the built-in {@link SettingsPanel}
|
|
9
|
+
* wired to `useThemeStore`; every other id resolves against the panels
|
|
10
|
+
* registered in the store.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ConnectedSidebarPane: (props: ConnectedSidebarPaneProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StatusBarProps } from '../components/widgets/StatusBar';
|
|
2
|
+
|
|
3
|
+
export type ConnectedStatusBarProps = Omit<StatusBarProps, 'widgets'>;
|
|
4
|
+
/**
|
|
5
|
+
* {@link StatusBar} bound to `useStatusBarStore`.
|
|
6
|
+
*
|
|
7
|
+
* Reads items from the shell store and resolves each item's `commandId`
|
|
8
|
+
* against the {@link commandRegistry}, so store-registered items can trigger
|
|
9
|
+
* commands without holding a function reference. An explicit `onClick` on the
|
|
10
|
+
* item takes precedence over its `commandId`.
|
|
11
|
+
*
|
|
12
|
+
* Use this inside a shell; use the plain {@link StatusBar} when you want to
|
|
13
|
+
* supply items yourself.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ConnectedStatusBar: (props: ConnectedStatusBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TerminalPaneProps } from '../components/widgets/TerminalPane';
|
|
2
|
+
|
|
3
|
+
export type ConnectedTerminalPaneProps = Omit<TerminalPaneProps, 'history' | 'onCommand' | 'onClose'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Handle a command the built-ins don't cover. Return `true` if you handled
|
|
6
|
+
* it; return `false` or omit the handler to fall through to
|
|
7
|
+
* "command not found".
|
|
8
|
+
*/
|
|
9
|
+
onCommand?: (command: string) => boolean | void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* {@link TerminalPane} bound to `useTerminalStore`.
|
|
13
|
+
*
|
|
14
|
+
* Renders nothing while the store reports the terminal closed. Echoes each
|
|
15
|
+
* command into history and handles `help` and `clear` internally; anything else
|
|
16
|
+
* is offered to `onCommand` before falling back to a not-found message.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ConnectedTerminalPane: ({ onCommand, ...props }: ConnectedTerminalPaneProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ThemeSwitcherProps } from '../components/widgets/ThemeSwitcher';
|
|
2
|
+
import { ThemeType } from '../core/services/ThemeService';
|
|
3
|
+
|
|
4
|
+
export type ConnectedThemeSwitcherProps = Omit<ThemeSwitcherProps<ThemeType>, 'value' | 'onChange'>;
|
|
5
|
+
/**
|
|
6
|
+
* {@link ThemeSwitcher} bound to `useThemeStore`.
|
|
7
|
+
*
|
|
8
|
+
* Selecting a theme writes it to the store, which applies the matching
|
|
9
|
+
* `theme-*` class to `<html>` and persists the choice to `localStorage`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ConnectedThemeSwitcher: (props: ConnectedThemeSwitcherProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UserProfileProps } from '../components/widgets/UserProfile';
|
|
2
|
+
|
|
3
|
+
export type ConnectedUserProfileProps = Omit<UserProfileProps, 'profile' | 'onProfileChange' | 'onAvatarChange'>;
|
|
4
|
+
/**
|
|
5
|
+
* {@link UserProfile} bound to `useUserProfileStore`.
|
|
6
|
+
*
|
|
7
|
+
* Reads the identity from the store, writes inline edits back to it, and reads
|
|
8
|
+
* a picked avatar file as a data URL before storing it.
|
|
9
|
+
*
|
|
10
|
+
* The dropdown's `actions` are deliberately still yours to pass — sign-out and
|
|
11
|
+
* account settings mean different things in every app, so the library declines
|
|
12
|
+
* to guess.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ConnectedUserProfile: (props: ConnectedUserProfileProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store-connected component variants.
|
|
3
|
+
*
|
|
4
|
+
* Every component in `components/` is pure and prop-driven. The wrappers here
|
|
5
|
+
* bind those components to the shell's zustand stores and registries, so
|
|
6
|
+
* `ShellLayout` — and any app that opts into the batteries-included shell — can
|
|
7
|
+
* compose them without prop-drilling.
|
|
8
|
+
*
|
|
9
|
+
* Reach for these when you want the shell's behavior. Reach for the plain
|
|
10
|
+
* components when you want control.
|
|
11
|
+
*/
|
|
12
|
+
export { ConnectedActivityBar, type ConnectedActivityBarProps } from './ConnectedActivityBar';
|
|
13
|
+
export { ConnectedChatPane, type ConnectedChatPaneProps } from './ConnectedChatPane';
|
|
14
|
+
export { ConnectedCommandPalette, type ConnectedCommandPaletteProps } from './ConnectedCommandPalette';
|
|
15
|
+
export { ConnectedMenuBar, type ConnectedMenuBarProps } from './ConnectedMenuBar';
|
|
16
|
+
export { ConnectedModal, type ConnectedModalProps } from './ConnectedModal';
|
|
17
|
+
export { ConnectedSidebarPane, type ConnectedSidebarPaneProps } from './ConnectedSidebarPane';
|
|
18
|
+
export { ConnectedStatusBar, type ConnectedStatusBarProps } from './ConnectedStatusBar';
|
|
19
|
+
export { ConnectedTerminalPane, type ConnectedTerminalPaneProps } from './ConnectedTerminalPane';
|
|
20
|
+
export { ConnectedThemeSwitcher, type ConnectedThemeSwitcherProps } from './ConnectedThemeSwitcher';
|
|
21
|
+
export { ConnectedUserProfile, type ConnectedUserProfileProps } from './ConnectedUserProfile';
|
package/dist/core/Boot.d.ts
CHANGED
|
@@ -1,4 +1,66 @@
|
|
|
1
|
+
import { ICommand } from './registry/CommandRegistry';
|
|
2
|
+
import { IMenuItemConfig } from './registry/MenuRegistry';
|
|
3
|
+
import { ISlashCommandConfig } from './services/ChatService';
|
|
4
|
+
import { ISidebarPanel } from './services/SidebarService';
|
|
5
|
+
import { IStatusBarWidgetConfig } from './services/StatusBarService';
|
|
6
|
+
|
|
7
|
+
export interface InitializeShellOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Sidebar panels to register. Each becomes an icon in the activity bar and
|
|
10
|
+
* renders its `component` in the sidebar when selected.
|
|
11
|
+
*/
|
|
12
|
+
panels?: ISidebarPanel[];
|
|
13
|
+
/** Menus keyed by top-level name. Items dispatch through their `commandId`. */
|
|
14
|
+
menus?: Record<string, IMenuItemConfig[]>;
|
|
15
|
+
/** Commands available to the palette, menus and keybindings. */
|
|
16
|
+
commands?: ICommand[];
|
|
17
|
+
/** Items for the status bar, grouped by their `alignment`. */
|
|
18
|
+
statusBar?: IStatusBarWidgetConfig[];
|
|
19
|
+
/** Slash commands offered in the chat pane. */
|
|
20
|
+
slashCommands?: ISlashCommandConfig[];
|
|
21
|
+
/**
|
|
22
|
+
* Register the built-in view and theme commands listed in
|
|
23
|
+
* {@link DEFAULT_COMMAND_IDS}. Defaults to `true`. Turn it off if your app
|
|
24
|
+
* wants to own every command id.
|
|
25
|
+
*/
|
|
26
|
+
defaultCommands?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Register a default **View** menu exposing the built-in commands. Defaults
|
|
29
|
+
* to `true`, and is ignored when `defaultCommands` is `false`.
|
|
30
|
+
*/
|
|
31
|
+
defaultMenus?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** The command ids `initializeShell` registers unless told not to. */
|
|
34
|
+
export declare const DEFAULT_COMMAND_IDS: readonly ["view.toggleTerminal", "view.toggleChat", "view.toggleSidebar", "theme.light", "theme.dark", "theme.gt"];
|
|
1
35
|
/**
|
|
2
|
-
*
|
|
36
|
+
* Boot the shell: register commands, menus, panels and status bar items into
|
|
37
|
+
* the shell registries and stores.
|
|
38
|
+
*
|
|
39
|
+
* This is the usual first call in a Nexus Shell application. `ShellLayout` can
|
|
40
|
+
* take the same configuration as props, but doing it here has two advantages:
|
|
41
|
+
* it runs once rather than on every render, and it happens outside React, so
|
|
42
|
+
* plugins and other non-component code can contribute in exactly the same way.
|
|
43
|
+
*
|
|
44
|
+
* Call it once, before rendering. It is safe to call again — the registries
|
|
45
|
+
* warn on duplicate ids rather than throwing — but it is not a reset: nothing
|
|
46
|
+
* previously registered is removed.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* // main.tsx
|
|
51
|
+
* import { initializeShell, componentRegistry } from 'nexus-shell';
|
|
52
|
+
* import 'nexus-shell/style.css';
|
|
53
|
+
*
|
|
54
|
+
* componentRegistry.register('editor', Editor);
|
|
55
|
+
*
|
|
56
|
+
* initializeShell({
|
|
57
|
+
* panels: [{ id: 'files', label: 'Explorer', icon: Files, component: FileTree }],
|
|
58
|
+
* commands: [{ id: 'file.save', label: 'File: Save', keybinding: 'Control+s', execute: save }],
|
|
59
|
+
* menus: { File: [{ id: 'save', label: 'Save', commandId: 'file.save' }] },
|
|
60
|
+
* statusBar: [{ id: 'branch', label: 'main', alignment: 'left' }],
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* createRoot(el).render(<ShellLayout title={<AppTitle title="Acme" />} />);
|
|
64
|
+
* ```
|
|
3
65
|
*/
|
|
4
|
-
export declare const initializeShell: () =>
|
|
66
|
+
export declare const initializeShell: (options?: InitializeShellOptions) => void;
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IMenuItem } from '../../components/widgets/MenuBar';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A menu entry as held in the registry. Extends the presentational
|
|
5
|
+
* {@link IMenuItem} with `commandId`, which `ConnectedMenuBar` resolves against
|
|
6
|
+
* the {@link commandRegistry} when the item is chosen.
|
|
7
|
+
*/
|
|
8
|
+
export interface IMenuItemConfig extends IMenuItem {
|
|
9
|
+
/** Command to execute when the item is selected. */
|
|
4
10
|
commandId?: string;
|
|
5
|
-
|
|
6
|
-
submenu?:
|
|
11
|
+
/** Nested entries, which may themselves carry a `commandId`. */
|
|
12
|
+
submenu?: IMenuItemConfig[];
|
|
7
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Holds the application's menu structure, keyed by top-level menu name.
|
|
16
|
+
*
|
|
17
|
+
* This is a shell-level convenience so plugins can contribute menu entries
|
|
18
|
+
* without prop-drilling. The presentational `MenuBar` does not read it.
|
|
19
|
+
*/
|
|
8
20
|
export declare class MenuRegistry {
|
|
9
21
|
private menus;
|
|
10
|
-
registerMenu(menuId: string, item:
|
|
11
|
-
setMenus(menuConfig: Record<string,
|
|
12
|
-
getMenu(menuId: string):
|
|
13
|
-
getAllMenus(): Record<string,
|
|
22
|
+
registerMenu(menuId: string, item: IMenuItemConfig): void;
|
|
23
|
+
setMenus(menuConfig: Record<string, IMenuItemConfig[]>): void;
|
|
24
|
+
getMenu(menuId: string): IMenuItemConfig[];
|
|
25
|
+
getAllMenus(): Record<string, IMenuItemConfig[]>;
|
|
14
26
|
}
|
|
15
27
|
export declare const menuRegistry: MenuRegistry;
|
|
28
|
+
export type { IMenuItem };
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IChatMessage, ISlashCommand } from '../../components/widgets/ChatPane';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A slash command as held in the shell store. Extends the presentational
|
|
5
|
+
* {@link ISlashCommand} with the handler that runs when it is invoked.
|
|
6
|
+
*/
|
|
7
|
+
export interface ISlashCommandConfig extends ISlashCommand {
|
|
8
|
+
/** Runs when the command is submitted. Receives the whitespace-split args. */
|
|
4
9
|
execute: (args: string[]) => void;
|
|
5
10
|
}
|
|
6
11
|
interface ChatState {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
messages: IChatMessage[];
|
|
13
|
+
slashCommands: ISlashCommandConfig[];
|
|
14
|
+
setMessages: (messages: IChatMessage[]) => void;
|
|
15
|
+
addMessage: (message: Omit<IChatMessage, 'id'> & {
|
|
16
|
+
id?: string;
|
|
17
|
+
}) => void;
|
|
18
|
+
clearMessages: () => void;
|
|
19
|
+
setSlashCommands: (commands: ISlashCommandConfig[]) => void;
|
|
20
|
+
registerSlashCommand: (command: ISlashCommandConfig) => void;
|
|
10
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Shell-level store for the chat pane's transcript and slash commands.
|
|
24
|
+
* Consumed by `ConnectedChatPane`; the presentational `ChatPane` does not read
|
|
25
|
+
* it.
|
|
26
|
+
*/
|
|
11
27
|
export declare const useChatStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ChatState>>;
|
|
12
|
-
export {};
|
|
28
|
+
export type { IChatMessage, ISlashCommand };
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStatusBarWidget } from '../../components/widgets/StatusBar';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A status bar item as held in the shell store. Extends the presentational
|
|
5
|
+
* {@link IStatusBarWidget} with `commandId`, which the connected wrapper
|
|
6
|
+
* resolves against the {@link commandRegistry} at click time.
|
|
7
|
+
*/
|
|
8
|
+
export interface IStatusBarWidgetConfig extends IStatusBarWidget {
|
|
9
|
+
/** Command to execute on click. Ignored if `onClick` is also provided. */
|
|
8
10
|
commandId?: string;
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
className?: string;
|
|
11
|
-
priority?: number;
|
|
12
11
|
}
|
|
13
12
|
interface StatusBarState {
|
|
14
|
-
widgets:
|
|
15
|
-
setWidgets: (widgets:
|
|
16
|
-
addWidget: (widget:
|
|
13
|
+
widgets: IStatusBarWidgetConfig[];
|
|
14
|
+
setWidgets: (widgets: IStatusBarWidgetConfig[]) => void;
|
|
15
|
+
addWidget: (widget: IStatusBarWidgetConfig) => void;
|
|
17
16
|
removeWidget: (id: string) => void;
|
|
18
|
-
updateWidget: (id: string, updates: Partial<
|
|
17
|
+
updateWidget: (id: string, updates: Partial<IStatusBarWidgetConfig>) => void;
|
|
19
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Shell-level store holding the status bar's items. Consumed by
|
|
21
|
+
* `ConnectedStatusBar`; the presentational `StatusBar` does not read it.
|
|
22
|
+
*/
|
|
20
23
|
export declare const useStatusBarStore: import('zustand').UseBoundStore<import('zustand').StoreApi<StatusBarState>>;
|
|
21
|
-
export {};
|
|
24
|
+
export type { IStatusBarWidget };
|