@cueloop/client 0.1.0-alpha.0 → 0.1.0-alpha.100
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/native/build-pty.sh +51 -0
- package/native/build.sh +82 -0
- package/native/darwin-arm64/libcuelooppty.dylib +0 -0
- package/native/darwin-arm64/libcueloopvt.dylib +0 -0
- package/native/src/pty.zig +193 -0
- package/native/src/shim.zig +114 -0
- package/package.json +41 -27
- package/src/annotations/annotation-palette.ts +62 -0
- package/src/annotations/components/AnnotationCards.stories.tsx +86 -0
- package/src/annotations/components/AnnotationCards.test.tsx +42 -0
- package/src/annotations/components/AnnotationCards.tsx +364 -0
- package/src/annotations/components/DiscussionMarkerRail.stories.tsx +54 -0
- package/src/annotations/components/DiscussionMarkerRail.tsx +186 -0
- package/src/annotations/discussions.ts +77 -0
- package/src/annotations/thread-selection.test.ts +210 -0
- package/src/annotations/thread-selection.ts +242 -0
- package/src/annotations/use-annotation-surface.tsx +1238 -0
- package/src/app/App.appearance.test.tsx +53 -0
- package/src/app/App.autoclose.test.tsx +144 -0
- package/src/app/App.deleted-scroll.test.tsx +187 -0
- package/src/app/App.diff.test.tsx +313 -0
- package/src/app/App.export.test.tsx +105 -0
- package/src/app/App.focus.test.ts +89 -0
- package/src/app/App.identity.test.tsx +84 -0
- package/src/app/App.plan-render.test.tsx +209 -0
- package/src/app/App.plan-review.test.tsx +428 -0
- package/src/app/App.prototype-markdown.test.tsx +128 -0
- package/src/app/App.prototype.test.tsx +176 -0
- package/src/app/App.readonly.test.tsx +210 -0
- package/src/app/App.regression.test.tsx +99 -0
- package/src/app/App.rendering.test.tsx +134 -0
- package/src/app/App.share-dialog.test.tsx +177 -0
- package/src/app/App.submit-confirm.test.tsx +267 -0
- package/src/app/App.test.tsx +496 -0
- package/src/app/App.thread-agent.test.ts +12 -0
- package/src/app/App.toast.test.tsx +124 -0
- package/src/app/App.tsx +1650 -0
- package/src/app/App.visual.test.tsx +59 -0
- package/src/app/App.walk.test.tsx +299 -0
- package/src/app/App.workbench.test.tsx +1149 -0
- package/src/app/app-key-state.ts +61 -0
- package/src/app/app-screens.tsx +606 -0
- package/src/app/app-view-model.ts +168 -0
- package/src/app/components/AppHeader.stories.tsx +50 -0
- package/src/app/components/AppHeader.tsx +81 -0
- package/src/app/components/AppShell.brand.test.tsx +58 -0
- package/src/app/components/AppShell.extensions.test.tsx +191 -0
- package/src/app/components/AppShell.stories.tsx +89 -0
- package/src/app/components/AppShell.tsx +358 -0
- package/src/app/components/AppShell.zoom.test.tsx +149 -0
- package/src/app/components/Breadcrumb.stories.tsx +19 -0
- package/src/app/components/Breadcrumb.tsx +45 -0
- package/src/app/components/MenuBar.stories.tsx +28 -0
- package/src/app/components/MenuBar.tsx +44 -0
- package/src/app/components/PaneGrid.stories.tsx +84 -0
- package/src/app/components/PaneGrid.tsx +128 -0
- package/src/app/components/PanelColumn.stories.tsx +25 -0
- package/src/app/components/PanelColumn.tsx +93 -0
- package/src/app/components/ShellHeader.stories.tsx +50 -0
- package/src/app/components/ShellHeader.tsx +137 -0
- package/src/app/components/WorkspacePanels.stories.tsx +36 -0
- package/src/app/components/WorkspacePanels.tsx +120 -0
- package/src/app/components/pages/Workspace.stories.tsx +181 -0
- package/src/app/intent-dispatch.test.ts +728 -0
- package/src/app/intent-dispatch.ts +687 -0
- package/src/app/launch-layout.test.ts +78 -0
- package/src/app/launch-layout.ts +57 -0
- package/src/app/ready-signal.test.ts +85 -0
- package/src/app/ready-signal.ts +52 -0
- package/src/app/run.ts +109 -0
- package/src/{serve.test.ts → app/serve.test.ts} +24 -12
- package/src/app/serve.ts +111 -0
- package/src/app/version.ts +5 -0
- package/src/appearance/components/theme-context.stories.tsx +46 -0
- package/src/appearance/components/theme-context.tsx +37 -0
- package/src/appearance/theme-presets.test.ts +51 -0
- package/src/appearance/theme-presets.ts +219 -0
- package/src/appearance/theme.ts +112 -0
- package/src/appearance/visual/contrast.test.ts +35 -0
- package/src/appearance/visual/contrast.ts +33 -0
- package/src/diff/components/AnnotatableFileView.stories.tsx +42 -0
- package/src/diff/components/AnnotatableFileView.test.tsx +157 -0
- package/src/diff/components/AnnotatableFileView.tsx +141 -0
- package/src/diff/components/BareWorkbenchFileView.stories.tsx +27 -0
- package/src/diff/components/BareWorkbenchFileView.tsx +63 -0
- package/src/diff/components/DiffContentView.scroll.test.tsx +434 -0
- package/src/diff/components/DiffContentView.split.test.tsx +140 -0
- package/src/diff/components/DiffContentView.stories.tsx +80 -0
- package/src/diff/components/DiffContentView.syntax.test.tsx +82 -0
- package/src/diff/components/DiffContentView.tsx +1055 -0
- package/src/diff/components/WalkWizard.stories.tsx +100 -0
- package/src/diff/components/WalkWizard.tsx +146 -0
- package/src/diff/components/diff-content-view-layout.test.ts +198 -0
- package/src/diff/components/diff-content-view-layout.ts +84 -0
- package/src/diff/diff-fold.test.ts +78 -0
- package/src/diff/diff-fold.ts +126 -0
- package/src/diff/diff-hunk-curate.test.ts +315 -0
- package/src/diff/diff-hunk-curate.ts +152 -0
- package/src/diff/diff-intraline.test.ts +239 -0
- package/src/diff/diff-intraline.ts +238 -0
- package/src/diff/diff-syntax.test.ts +125 -0
- package/src/diff/diff-syntax.ts +186 -0
- package/src/diff/split-diff.test.ts +110 -0
- package/src/diff/split-diff.ts +144 -0
- package/src/diff/view-diff.test.ts +325 -0
- package/src/diff/view-diff.ts +522 -0
- package/src/diff/walk.test.ts +121 -0
- package/src/diff/walk.ts +73 -0
- package/src/index.ts +31 -2
- package/src/integrations/attribution.test.ts +31 -0
- package/src/integrations/attribution.ts +42 -0
- package/src/integrations/client-extension-registry.test.tsx +61 -0
- package/src/integrations/client-extension-registry.ts +159 -0
- package/src/integrations/clipboard.test.ts +23 -0
- package/src/integrations/clipboard.ts +33 -0
- package/src/integrations/components/ExtensionZone.stories.tsx +28 -0
- package/src/integrations/components/ExtensionZone.tsx +145 -0
- package/src/integrations/components/ShareDialog.stories.tsx +121 -0
- package/src/integrations/components/ShareDialog.tsx +550 -0
- package/src/integrations/components/share-dialog-store.ts +55 -0
- package/src/integrations/editor.test.ts +149 -0
- package/src/integrations/editor.ts +160 -0
- package/src/integrations/github-identity.test.ts +58 -0
- package/src/integrations/github-identity.ts +41 -0
- package/src/integrations/herdr.test.ts +43 -0
- package/src/integrations/herdr.ts +38 -0
- package/src/integrations/integrations.test.ts +41 -0
- package/src/integrations/integrations.ts +32 -0
- package/src/integrations/pasted-image.test.ts +67 -0
- package/src/integrations/pasted-image.ts +60 -0
- package/src/integrations/share.ts +238 -0
- package/src/keyboard/components/CompletionOverlay.stories.tsx +37 -0
- package/src/keyboard/components/CompletionOverlay.tsx +75 -0
- package/src/keyboard/components/HandleChipsInput.stories.tsx +24 -0
- package/src/keyboard/components/HandleChipsInput.test.tsx +35 -0
- package/src/keyboard/components/HandleChipsInput.tsx +143 -0
- package/src/keyboard/components/KeybindsDialog.stories.tsx +31 -0
- package/src/keyboard/components/KeybindsDialog.tsx +103 -0
- package/src/keyboard/components/NavModeHint.stories.tsx +40 -0
- package/src/keyboard/components/NavModeHint.tsx +31 -0
- package/src/keyboard/components/SlashComposer.stories.tsx +37 -0
- package/src/keyboard/components/SlashComposer.tsx +87 -0
- package/src/keyboard/key-bindings.test.ts +156 -0
- package/src/keyboard/key-bindings.ts +459 -0
- package/src/keyboard/keymap.test.ts +611 -0
- package/src/keyboard/keymap.ts +395 -0
- package/src/keyboard/skills.test.ts +74 -0
- package/src/keyboard/skills.ts +75 -0
- package/src/keyboard/slash-palette.test.ts +103 -0
- package/src/keyboard/slash-palette.ts +129 -0
- package/src/keyboard/thread-chords.test.ts +79 -0
- package/src/keyboard/thread-chords.ts +163 -0
- package/src/keyboard/use-shared-keyboard.ts +55 -0
- package/src/markdown/__snapshots__/view-plan.regression.test.ts.snap +100 -0
- package/src/markdown/components/MarkdownGridBlock.stories.tsx +33 -0
- package/src/markdown/components/MarkdownGridBlock.tsx +72 -0
- package/src/markdown/components/MarkdownThreadEditor.stories.tsx +15 -0
- package/src/markdown/components/MarkdownThreadEditor.test.tsx +98 -0
- package/src/markdown/components/MarkdownThreadEditor.tsx +160 -0
- package/src/markdown/components/ThreadView.selection.test.tsx +951 -0
- package/src/markdown/components/ThreadView.slash.test.tsx +146 -0
- package/src/markdown/components/ThreadView.stories.tsx +26 -0
- package/src/markdown/components/ThreadView.tsx +560 -0
- package/src/markdown/mark-runs.ts +121 -0
- package/src/markdown/markdown-editor-syntax-style.ts +50 -0
- package/src/markdown/markdown-grid.test.ts +101 -0
- package/src/markdown/markdown-grid.ts +203 -0
- package/src/markdown/markdown-highlight.test.ts +61 -0
- package/src/markdown/markdown-highlight.ts +124 -0
- package/src/markdown/thread-code-syntax.ts +45 -0
- package/src/markdown/use-thread-body-editing.tsx +54 -0
- package/src/markdown/view-plan.regression.test.ts +60 -0
- package/src/markdown/view-plan.test.ts +545 -0
- package/src/markdown/view-plan.ts +1009 -0
- package/src/performance/otlp-trace.test.ts +119 -0
- package/src/performance/otlp-trace.ts +134 -0
- package/src/performance/perf-report.ts +18 -0
- package/src/performance/perf-timings.test.ts +18 -0
- package/src/performance/perf-timings.ts +39 -0
- package/src/prototype/components/PrototypeContentView.stories.tsx +19 -0
- package/src/prototype/components/PrototypeContentView.tsx +442 -0
- package/src/prototype/prototype-browser.test.ts +81 -0
- package/src/prototype/prototype-browser.ts +321 -0
- package/src/prototype/prototype-pixels.tsx +35 -0
- package/src/settings/components/SettingsDialog.stories.tsx +117 -0
- package/src/settings/components/SettingsDialog.tsx +183 -0
- package/src/settings/components/SettingsRows.stories.tsx +18 -0
- package/src/settings/components/SettingsRows.tsx +112 -0
- package/src/settings/components/quick-actions-editor.stories.tsx +58 -0
- package/src/settings/components/quick-actions-editor.test.tsx +120 -0
- package/src/settings/components/quick-actions-editor.tsx +222 -0
- package/src/settings/config-identity.test.ts +78 -0
- package/src/settings/config.test.ts +676 -0
- package/src/settings/config.ts +628 -0
- package/src/settings/use-settings-dialog.tsx +351 -0
- package/src/stories/__snapshots__/stories.test.tsx.snap +2358 -0
- package/src/stories/stories-app.tsx +196 -0
- package/src/stories/stories.test.tsx +74 -0
- package/src/stories/story-fixtures.ts +102 -0
- package/src/stories/story-tree.test.ts +108 -0
- package/src/stories/story.ts +154 -0
- package/src/terminal/ansi-screen.test.ts +28 -0
- package/src/terminal/ansi-screen.ts +72 -0
- package/src/terminal/components/AnsiScreen.stories.tsx +12 -0
- package/src/terminal/components/AnsiScreen.tsx +28 -0
- package/src/terminal/components/terminal-pane.test.tsx +40 -0
- package/src/terminal/components/terminal-pane.ts +196 -0
- package/src/terminal/ghostty-terminal.test.ts +85 -0
- package/src/terminal/ghostty-terminal.ts +197 -0
- package/src/terminal/kitty-image.test.ts +66 -0
- package/src/terminal/kitty-image.ts +137 -0
- package/src/terminal/pty.test.ts +81 -0
- package/src/terminal/pty.ts +246 -0
- package/src/testing/test-support.test.ts +264 -0
- package/src/testing/test-support.ts +367 -0
- package/src/thread/agent-continuation.test.ts +32 -0
- package/src/thread/agent-continuation.ts +13 -0
- package/src/thread/agent-transcript.test.ts +161 -0
- package/src/thread/agent-transcript.ts +336 -0
- package/src/thread/components/AgentConfigControls.stories.tsx +39 -0
- package/src/thread/components/AgentConfigControls.test.tsx +112 -0
- package/src/thread/components/AgentConfigControls.tsx +114 -0
- package/src/thread/components/AgentThreadPane.stories.tsx +105 -0
- package/src/thread/components/AgentThreadPane.test.tsx +829 -0
- package/src/thread/components/AgentThreadPane.tsx +367 -0
- package/src/thread/components/ThreadFooter.stories.tsx +30 -0
- package/src/thread/components/ThreadFooter.test.tsx +49 -0
- package/src/thread/components/ThreadFooter.tsx +77 -0
- package/src/thread/components/ThreadTree.stories.tsx +46 -0
- package/src/thread/components/ThreadTree.test.tsx +41 -0
- package/src/thread/components/ThreadTree.tsx +267 -0
- package/src/thread/components/thread-tree.test.ts +137 -0
- package/src/thread/components/thread-tree.ts +112 -0
- package/src/thread/thread-controller.curate.test.ts +502 -0
- package/src/thread/thread-controller.derivation.test.ts +62 -0
- package/src/thread/thread-controller.live-diff.test.ts +357 -0
- package/src/thread/thread-controller.optimistic.test.ts +69 -0
- package/src/thread/thread-controller.share.test.ts +573 -0
- package/src/thread/thread-controller.switch-cache.test.ts +174 -0
- package/src/thread/thread-controller.tree.test.ts +263 -0
- package/src/thread/thread-controller.ts +2018 -0
- package/src/thread/tree-view.test.ts +128 -0
- package/src/thread/tree-view.ts +146 -0
- package/src/thread/use-thread-agent.test.tsx +208 -0
- package/src/thread/use-thread-agent.ts +111 -0
- package/src/ui/components/CodeBlock.stories.tsx +42 -0
- package/src/ui/components/CodeBlock.tsx +80 -0
- package/src/ui/components/ConfirmCard.stories.tsx +37 -0
- package/src/ui/components/ConfirmCard.tsx +151 -0
- package/src/ui/components/ConfirmDialog.stories.tsx +21 -0
- package/src/ui/components/ConfirmDialog.tsx +72 -0
- package/src/ui/components/OverlayScrollbar.stories.tsx +33 -0
- package/src/ui/components/OverlayScrollbar.test.tsx +139 -0
- package/src/ui/components/OverlayScrollbar.tsx +129 -0
- package/src/ui/components/PromptDialog.stories.tsx +36 -0
- package/src/ui/components/PromptDialog.test.tsx +65 -0
- package/src/ui/components/PromptDialog.tsx +99 -0
- package/src/ui/components/RootOverlay.stories.tsx +45 -0
- package/src/ui/components/RootOverlay.tsx +49 -0
- package/src/ui/components/ScrollArea.stories.tsx +20 -0
- package/src/ui/components/ScrollArea.tsx +61 -0
- package/src/ui/components/Toast.stories.tsx +19 -0
- package/src/ui/components/Toast.tsx +54 -0
- package/src/ui/components/Tooltip.stories.tsx +26 -0
- package/src/ui/components/Tooltip.tsx +72 -0
- package/src/ui/components/menu-control.stories.tsx +35 -0
- package/src/ui/components/menu-control.tsx +43 -0
- package/src/ui/components/primitives/Button.stories.tsx +32 -0
- package/src/ui/components/primitives/Button.tsx +57 -0
- package/src/ui/components/primitives/Card.stories.tsx +25 -0
- package/src/ui/components/primitives/Card.tsx +62 -0
- package/src/ui/components/primitives/Dialog.stories.tsx +24 -0
- package/src/ui/components/primitives/Dialog.test.tsx +38 -0
- package/src/ui/components/primitives/Dialog.tsx +69 -0
- package/src/ui/components/primitives/DialogActions.stories.tsx +20 -0
- package/src/ui/components/primitives/DialogActions.tsx +39 -0
- package/src/ui/components/primitives/IconButton.stories.tsx +36 -0
- package/src/ui/components/primitives/IconButton.tsx +58 -0
- package/src/ui/components/primitives/StatusBar.stories.tsx +11 -0
- package/src/ui/components/primitives/StatusBar.tsx +23 -0
- package/src/ui/components/primitives/Switch.stories.tsx +17 -0
- package/src/ui/components/primitives/Switch.tsx +32 -0
- package/src/ui/components/primitives/Tabs.stories.tsx +29 -0
- package/src/ui/components/primitives/Tabs.tsx +101 -0
- package/src/ui/components/primitives/Toolbar.stories.tsx +17 -0
- package/src/ui/components/primitives/Toolbar.tsx +14 -0
- package/src/ui/components/primitives/Tree.stories.tsx +124 -0
- package/src/ui/components/primitives/Tree.tsx +133 -0
- package/src/ui/components/primitives/frame.test.ts +12 -0
- package/src/ui/components/primitives/frame.ts +17 -0
- package/src/ui/components/primitives/icons.ts +61 -0
- package/src/ui/components/primitives/tree-model.test.ts +99 -0
- package/src/ui/components/primitives/tree-model.ts +137 -0
- package/src/ui/components/syntax-highlight.ts +133 -0
- package/src/ui/components/truncate-text.ts +7 -0
- package/src/ui/components/truncate-title.test.ts +31 -0
- package/src/ui/components/truncate-title.ts +15 -0
- package/src/ui/use-frame-measure.ts +74 -0
- package/src/ui/use-terminal-virtualizer.ts +259 -0
- package/src/workbench/components/ChangesColumn.stories.tsx +44 -0
- package/src/workbench/components/ChangesColumn.tsx +203 -0
- package/src/workbench/components/ChangesFileTree.test.tsx +181 -0
- package/src/workbench/components/EditorGrid.split.test.tsx +118 -0
- package/src/workbench/components/EditorGrid.stories.tsx +86 -0
- package/src/workbench/components/EditorGrid.tabs.test.tsx +118 -0
- package/src/workbench/components/EditorGrid.tsx +544 -0
- package/src/workbench/components/EditorGrid.zoom.test.tsx +132 -0
- package/src/workbench/components/FileContentsView.stories.tsx +16 -0
- package/src/workbench/components/FileContentsView.test.tsx +29 -0
- package/src/workbench/components/FileContentsView.tsx +100 -0
- package/src/workbench/components/GridTabContent.actions.test.tsx +151 -0
- package/src/workbench/components/GridTabContent.stories.tsx +59 -0
- package/src/workbench/components/GridTabContent.tsx +193 -0
- package/src/workbench/components/ProjectTreeView.stories.tsx +25 -0
- package/src/workbench/components/ProjectTreeView.test.tsx +236 -0
- package/src/workbench/components/ProjectTreeView.tsx +151 -0
- package/src/workbench/components/TreePane.stories.tsx +106 -0
- package/src/workbench/components/TreePane.tsx +155 -0
- package/src/workbench/components/WelcomePlayground.stories.tsx +12 -0
- package/src/workbench/components/WelcomePlayground.test.tsx +83 -0
- package/src/workbench/components/WelcomePlayground.tsx +138 -0
- package/src/workbench/components/editor-grid.test.ts +184 -0
- package/src/workbench/components/editor-grid.ts +281 -0
- package/src/workbench/components/file-tree.test.ts +60 -0
- package/src/workbench/components/file-tree.ts +112 -0
- package/src/workbench/use-changes-workbench.ts +205 -0
- package/src/workbench/use-remember-layout.ts +31 -0
- package/src/workbench/use-repo-changes.ts +91 -0
- package/src/workbench/workbench-snapshot.test.ts +99 -0
- package/src/workbench/workbench-snapshot.ts +59 -0
- package/src/App.diff.test.tsx +0 -99
- package/src/App.export.test.tsx +0 -80
- package/src/App.readonly.test.tsx +0 -148
- package/src/App.test.tsx +0 -217
- package/src/App.tsx +0 -0
- package/src/config.test.ts +0 -116
- package/src/config.ts +0 -113
- package/src/editor.ts +0 -34
- package/src/run.ts +0 -28
- package/src/serve.ts +0 -75
- package/src/theme.ts +0 -46
- package/src/view-diff.test.ts +0 -55
- package/src/view-diff.ts +0 -86
- package/src/view.test.ts +0 -157
- package/src/view.ts +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DARK } from "../../appearance/theme";
|
|
3
|
+
import type { Story, StoryMeta } from "../../stories/story";
|
|
4
|
+
import { PaneGrid } from "./PaneGrid";
|
|
5
|
+
|
|
6
|
+
export const meta: StoryMeta = { title: "Layout/PaneGrid" };
|
|
7
|
+
|
|
8
|
+
function Sidebar(): React.ReactNode {
|
|
9
|
+
return (
|
|
10
|
+
<box style={{ flexDirection: "column", paddingLeft: 1, paddingTop: 1 }}>
|
|
11
|
+
<text fg={DARK.textDim}>Projects</text>
|
|
12
|
+
<text fg={DARK.text}> cueloop</text>
|
|
13
|
+
<box style={{ backgroundColor: DARK.elevated }}>
|
|
14
|
+
<text fg={DARK.accent}> Read Cueloop Repository</text>
|
|
15
|
+
</box>
|
|
16
|
+
<text> </text>
|
|
17
|
+
<text fg={DARK.textDim}>Threads</text>
|
|
18
|
+
<text fg={DARK.textMuted}> Welcome to cueloop</text>
|
|
19
|
+
</box>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function Main(): React.ReactNode {
|
|
24
|
+
return (
|
|
25
|
+
<box style={{ flexDirection: "column", paddingLeft: 1, paddingTop: 1 }}>
|
|
26
|
+
<text fg={DARK.text}>read the repo</text>
|
|
27
|
+
<text> </text>
|
|
28
|
+
<text fg={DARK.textMuted}>Repository context loaded. main is clean.</text>
|
|
29
|
+
<text> </text>
|
|
30
|
+
<text fg={DARK.text}>Core architecture</text>
|
|
31
|
+
<text fg={DARK.textMuted}> - packages/schema is the dependency root</text>
|
|
32
|
+
<text fg={DARK.textMuted}> - packages/daemon owns session state</text>
|
|
33
|
+
</box>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function Inspector(): React.ReactNode {
|
|
38
|
+
return (
|
|
39
|
+
<box style={{ flexDirection: "column", paddingLeft: 1, paddingTop: 1 }}>
|
|
40
|
+
<text fg={DARK.text}>cueloop/main</text>
|
|
41
|
+
<text fg={DARK.textDim}> No changes</text>
|
|
42
|
+
</box>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function Header(): React.ReactNode {
|
|
47
|
+
return (
|
|
48
|
+
<box style={{ flexDirection: "row", paddingLeft: 1 }}>
|
|
49
|
+
<text fg={DARK.textMuted}>Read Cueloop Repository</text>
|
|
50
|
+
<box style={{ flexGrow: 1 }} />
|
|
51
|
+
<text fg={DARK.textDim}>markdown.test.ts</text>
|
|
52
|
+
</box>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Footer(): React.ReactNode {
|
|
57
|
+
return (
|
|
58
|
+
<box style={{ flexDirection: "row", paddingLeft: 1 }}>
|
|
59
|
+
<text fg={DARK.textDim}>cueloop / main</text>
|
|
60
|
+
<box style={{ flexGrow: 1 }} />
|
|
61
|
+
<text fg={DARK.textDim}>Fable 5</text>
|
|
62
|
+
</box>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const ThreePane: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<PaneGrid
|
|
69
|
+
sidebar={<Sidebar />}
|
|
70
|
+
main={<Main />}
|
|
71
|
+
mainHeader={<Header />}
|
|
72
|
+
inspector={<Inspector />}
|
|
73
|
+
footer={<Footer />}
|
|
74
|
+
/>
|
|
75
|
+
),
|
|
76
|
+
expectedColors: [DARK.border, DARK.accent],
|
|
77
|
+
size: { width: 120, height: 28 },
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const SidebarAndMain: Story = {
|
|
81
|
+
render: () => <PaneGrid sidebar={<Sidebar />} main={<Main />} />,
|
|
82
|
+
expectedColors: [DARK.border],
|
|
83
|
+
size: { width: 90, height: 20 },
|
|
84
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// A generic pane grid: a row of columns, each stacking a header cell over its body, with the
|
|
2
|
+
// vertical rules run full height and every header cell's bottom rule joined into one horizontal
|
|
3
|
+
// line. Rules only - no enclosing frames. This is the layout primitive for dev surfaces (the
|
|
4
|
+
// storybook runner); the product's four-pane workbench is AppShell.
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { DARK, type Theme } from "../../appearance/theme";
|
|
8
|
+
import type { BorderSides } from "@opentui/core";
|
|
9
|
+
|
|
10
|
+
export interface PaneGridProps {
|
|
11
|
+
headerHeight?: number;
|
|
12
|
+
sidebar?: React.ReactNode;
|
|
13
|
+
sidebarHeader?: React.ReactNode;
|
|
14
|
+
sidebarWidth?: number;
|
|
15
|
+
main: React.ReactNode;
|
|
16
|
+
mainHeader?: React.ReactNode;
|
|
17
|
+
inspector?: React.ReactNode;
|
|
18
|
+
inspectorHeader?: React.ReactNode;
|
|
19
|
+
inspectorWidth?: number;
|
|
20
|
+
footer?: React.ReactNode;
|
|
21
|
+
theme?: Theme;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface PaneColumnProps {
|
|
25
|
+
width?: number;
|
|
26
|
+
grow?: boolean;
|
|
27
|
+
side?: BorderSides;
|
|
28
|
+
header: React.ReactNode;
|
|
29
|
+
body: React.ReactNode;
|
|
30
|
+
headerHeight: number;
|
|
31
|
+
theme: Theme;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function PaneColumn({
|
|
35
|
+
width,
|
|
36
|
+
grow,
|
|
37
|
+
side,
|
|
38
|
+
header,
|
|
39
|
+
body,
|
|
40
|
+
headerHeight,
|
|
41
|
+
theme,
|
|
42
|
+
}: PaneColumnProps): React.ReactNode {
|
|
43
|
+
return (
|
|
44
|
+
<box
|
|
45
|
+
style={{
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
...(grow ? { flexGrow: 1 } : { width }),
|
|
48
|
+
borderStyle: "single",
|
|
49
|
+
border: side ? [side] : [],
|
|
50
|
+
borderColor: theme.border,
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<box
|
|
54
|
+
style={{
|
|
55
|
+
height: headerHeight,
|
|
56
|
+
borderStyle: "single",
|
|
57
|
+
border: ["bottom"],
|
|
58
|
+
borderColor: theme.border,
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
{header}
|
|
62
|
+
</box>
|
|
63
|
+
<box style={{ flexGrow: 1 }}>{body}</box>
|
|
64
|
+
</box>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function PaneGrid({
|
|
69
|
+
headerHeight = 3,
|
|
70
|
+
sidebar,
|
|
71
|
+
sidebarHeader,
|
|
72
|
+
sidebarWidth = 28,
|
|
73
|
+
main,
|
|
74
|
+
mainHeader,
|
|
75
|
+
inspector,
|
|
76
|
+
inspectorHeader,
|
|
77
|
+
inspectorWidth = 40,
|
|
78
|
+
footer,
|
|
79
|
+
theme,
|
|
80
|
+
}: PaneGridProps): React.ReactNode {
|
|
81
|
+
const tokens = theme ?? DARK;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<box
|
|
85
|
+
style={{
|
|
86
|
+
flexDirection: "column",
|
|
87
|
+
width: "100%",
|
|
88
|
+
height: "100%",
|
|
89
|
+
backgroundColor: tokens.background,
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<box style={{ flexDirection: "row", flexGrow: 1 }}>
|
|
93
|
+
{sidebar !== undefined ? (
|
|
94
|
+
<PaneColumn
|
|
95
|
+
width={sidebarWidth}
|
|
96
|
+
side="right"
|
|
97
|
+
header={sidebarHeader}
|
|
98
|
+
body={sidebar}
|
|
99
|
+
headerHeight={headerHeight}
|
|
100
|
+
theme={tokens}
|
|
101
|
+
/>
|
|
102
|
+
) : null}
|
|
103
|
+
<PaneColumn
|
|
104
|
+
grow
|
|
105
|
+
header={mainHeader}
|
|
106
|
+
body={main}
|
|
107
|
+
headerHeight={headerHeight}
|
|
108
|
+
theme={tokens}
|
|
109
|
+
/>
|
|
110
|
+
{inspector !== undefined ? (
|
|
111
|
+
<PaneColumn
|
|
112
|
+
width={inspectorWidth}
|
|
113
|
+
side="left"
|
|
114
|
+
header={inspectorHeader}
|
|
115
|
+
body={inspector}
|
|
116
|
+
headerHeight={headerHeight}
|
|
117
|
+
theme={tokens}
|
|
118
|
+
/>
|
|
119
|
+
) : null}
|
|
120
|
+
</box>
|
|
121
|
+
{footer !== undefined ? (
|
|
122
|
+
<box style={{ borderStyle: "single", border: ["top"], borderColor: tokens.border }}>
|
|
123
|
+
{footer}
|
|
124
|
+
</box>
|
|
125
|
+
) : null}
|
|
126
|
+
</box>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DARK } from "../../appearance/theme";
|
|
3
|
+
import type { Story, StoryMeta } from "../../stories/story";
|
|
4
|
+
import { PanelColumn, FileTab } from "./PanelColumn";
|
|
5
|
+
|
|
6
|
+
export const meta: StoryMeta = { title: "Surfaces/PanelColumn" };
|
|
7
|
+
|
|
8
|
+
export const WithFileTab: Story = {
|
|
9
|
+
render: () => (
|
|
10
|
+
<box style={{ width: "100%", height: "100%", flexDirection: "row" }}>
|
|
11
|
+
<PanelColumn
|
|
12
|
+
width={40}
|
|
13
|
+
border="left"
|
|
14
|
+
header={<FileTab label="Welcome" active onClose={() => {}} theme={DARK} />}
|
|
15
|
+
theme={DARK}
|
|
16
|
+
>
|
|
17
|
+
<box style={{ paddingLeft: 1, paddingTop: 1 }}>
|
|
18
|
+
<text fg={DARK.textDim}>panel body</text>
|
|
19
|
+
</box>
|
|
20
|
+
</PanelColumn>
|
|
21
|
+
</box>
|
|
22
|
+
),
|
|
23
|
+
expectedColors: [DARK.accent, DARK.border],
|
|
24
|
+
size: { width: 50, height: 8 },
|
|
25
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// A workbench panel: one full-height grid column with a file-tab header cell on
|
|
2
|
+
// top and a body below. The header row carries the tabs on the left and optional
|
|
3
|
+
// controls on the right, underlined by a thin rule in the same divider gray so the
|
|
4
|
+
// header bottoms join the side rules into one grid. The side border runs from the top.
|
|
5
|
+
|
|
6
|
+
import React, { useState } from "react";
|
|
7
|
+
import type { Theme } from "../../appearance/theme";
|
|
8
|
+
import { NERD, HEADER_UNDERLINE_CHARS } from "../../ui/components/primitives/icons";
|
|
9
|
+
|
|
10
|
+
export interface FileTabProps {
|
|
11
|
+
label: string;
|
|
12
|
+
active?: boolean;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
theme?: Theme;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** A file tab: the label in the accent when active, with a hover-revealed close. */
|
|
18
|
+
export function FileTab({ label, active, onClose, theme }: FileTabProps): React.ReactNode {
|
|
19
|
+
const [hovered, setHovered] = useState(false);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<box
|
|
23
|
+
style={{ flexDirection: "row", paddingRight: 1 }}
|
|
24
|
+
onMouseOver={() => setHovered(true)}
|
|
25
|
+
onMouseOut={() => setHovered(false)}
|
|
26
|
+
>
|
|
27
|
+
<text fg={active ? theme?.accent : theme?.textDim}>{label}</text>
|
|
28
|
+
{onClose ? (
|
|
29
|
+
<box onMouseUp={onClose} style={{ paddingLeft: 1 }}>
|
|
30
|
+
<text fg={theme?.textDim}>{hovered ? NERD.close : " "}</text>
|
|
31
|
+
</box>
|
|
32
|
+
) : null}
|
|
33
|
+
</box>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PanelColumnProps {
|
|
38
|
+
width?: number;
|
|
39
|
+
border?: "left" | "right";
|
|
40
|
+
header: React.ReactNode;
|
|
41
|
+
headerRight?: React.ReactNode;
|
|
42
|
+
onFocus?: () => void;
|
|
43
|
+
children: React.ReactNode;
|
|
44
|
+
theme?: Theme;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function PanelColumn({
|
|
48
|
+
width,
|
|
49
|
+
border,
|
|
50
|
+
header,
|
|
51
|
+
headerRight,
|
|
52
|
+
onFocus,
|
|
53
|
+
children,
|
|
54
|
+
theme,
|
|
55
|
+
}: PanelColumnProps): React.ReactNode {
|
|
56
|
+
return (
|
|
57
|
+
<box
|
|
58
|
+
onMouseDown={onFocus}
|
|
59
|
+
style={{
|
|
60
|
+
width,
|
|
61
|
+
// grow panes split evenly and clip wide content (a long diff line) rather than stretching
|
|
62
|
+
flexGrow: width === undefined ? 1 : undefined,
|
|
63
|
+
flexBasis: width === undefined ? 0 : undefined,
|
|
64
|
+
minWidth: 0,
|
|
65
|
+
flexDirection: "column",
|
|
66
|
+
borderStyle: "single",
|
|
67
|
+
border: border ? [border] : [],
|
|
68
|
+
borderColor: theme?.border,
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<box
|
|
72
|
+
customBorderChars={HEADER_UNDERLINE_CHARS}
|
|
73
|
+
style={{
|
|
74
|
+
flexDirection: "row",
|
|
75
|
+
height: 2,
|
|
76
|
+
paddingLeft: 1,
|
|
77
|
+
// right controls need the same breathing room as the left, or the rightmost icon renders
|
|
78
|
+
// squeezed against the terminal's last column
|
|
79
|
+
paddingRight: 1,
|
|
80
|
+
backgroundColor: theme?.panel,
|
|
81
|
+
borderStyle: "single",
|
|
82
|
+
border: ["bottom"],
|
|
83
|
+
borderColor: theme?.border,
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{header}
|
|
87
|
+
<box style={{ flexGrow: 1 }} />
|
|
88
|
+
{headerRight}
|
|
89
|
+
</box>
|
|
90
|
+
<box style={{ flexGrow: 1, flexDirection: "column" }}>{children}</box>
|
|
91
|
+
</box>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DARK } from "../../appearance/theme";
|
|
3
|
+
import type { Story, StoryMeta } from "../../stories/story";
|
|
4
|
+
import { ShellHeader } from "./ShellHeader";
|
|
5
|
+
import { NERD } from "../../ui/components/primitives/icons";
|
|
6
|
+
|
|
7
|
+
export const meta: StoryMeta = { title: "Layout/ShellHeader" };
|
|
8
|
+
|
|
9
|
+
function Frame({ children }: { children: React.ReactNode }): React.ReactNode {
|
|
10
|
+
return <box style={{ width: "100%", backgroundColor: DARK.panel }}>{children}</box>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ReviewSurface: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<Frame>
|
|
16
|
+
<ShellHeader
|
|
17
|
+
leftIcons={[{ glyph: NERD.settings }]}
|
|
18
|
+
leftLabel="Read Cueloop Repository"
|
|
19
|
+
tabs={[{ label: "Changes", active: true }]}
|
|
20
|
+
rightIcons={[
|
|
21
|
+
{ glyph: NERD.expand },
|
|
22
|
+
{ glyph: NERD.diff, active: true },
|
|
23
|
+
{ glyph: NERD.listTree },
|
|
24
|
+
]}
|
|
25
|
+
onToggleSidebar={() => {}}
|
|
26
|
+
onToggleInspector={() => {}}
|
|
27
|
+
/>
|
|
28
|
+
</Frame>
|
|
29
|
+
),
|
|
30
|
+
expectedColors: [DARK.accent, DARK.textMuted],
|
|
31
|
+
size: { width: 120, height: 3 },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const InspectorCollapsed: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<Frame>
|
|
37
|
+
<ShellHeader
|
|
38
|
+
leftIcons={[{ glyph: NERD.settings }]}
|
|
39
|
+
leftLabel="Read Cueloop Repository"
|
|
40
|
+
rightIcons={[{ glyph: NERD.search }, { glyph: NERD.expand }]}
|
|
41
|
+
onToggleSidebar={() => {}}
|
|
42
|
+
sidebarOpen={false}
|
|
43
|
+
onToggleInspector={() => {}}
|
|
44
|
+
inspectorOpen={false}
|
|
45
|
+
/>
|
|
46
|
+
</Frame>
|
|
47
|
+
),
|
|
48
|
+
expectedColors: [DARK.textMuted],
|
|
49
|
+
size: { width: 120, height: 3 },
|
|
50
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// The app shell's top bar: left panel toggle + icons + label, an optional title, right icons + panel toggle.
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { DARK, type Theme } from "../../appearance/theme";
|
|
5
|
+
import { NERD } from "../../ui/components/primitives/icons";
|
|
6
|
+
|
|
7
|
+
export interface ShellTab {
|
|
8
|
+
label: string;
|
|
9
|
+
active?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// A header icon; active paints it in the brand accent to mark the current view or mode.
|
|
13
|
+
export interface ShellIcon {
|
|
14
|
+
glyph: string;
|
|
15
|
+
active?: boolean;
|
|
16
|
+
onPress?: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ShellHeaderProps {
|
|
20
|
+
leftIcons?: readonly ShellIcon[];
|
|
21
|
+
leftLabel?: string;
|
|
22
|
+
titleIcon?: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
tabs?: readonly ShellTab[];
|
|
25
|
+
rightIcons?: readonly ShellIcon[];
|
|
26
|
+
sidebarOpen?: boolean;
|
|
27
|
+
onToggleSidebar?: () => void;
|
|
28
|
+
inspectorOpen?: boolean;
|
|
29
|
+
onToggleInspector?: () => void;
|
|
30
|
+
theme?: Theme;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function IconView({
|
|
34
|
+
icon,
|
|
35
|
+
tokens,
|
|
36
|
+
marginRight,
|
|
37
|
+
}: {
|
|
38
|
+
icon: ShellIcon;
|
|
39
|
+
tokens: Theme;
|
|
40
|
+
marginRight: number;
|
|
41
|
+
}): React.ReactNode {
|
|
42
|
+
const color = icon.active ? tokens.accent : tokens.textMuted;
|
|
43
|
+
|
|
44
|
+
// alignSelf center keeps the clickable box on the same row as sibling icons
|
|
45
|
+
return (
|
|
46
|
+
<box onMouseUp={icon.onPress} style={{ alignSelf: "center", marginRight }}>
|
|
47
|
+
<text fg={color}>{icon.glyph}</text>
|
|
48
|
+
</box>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function ShellHeader({
|
|
53
|
+
leftIcons = [],
|
|
54
|
+
leftLabel,
|
|
55
|
+
titleIcon,
|
|
56
|
+
title,
|
|
57
|
+
tabs = [],
|
|
58
|
+
rightIcons = [],
|
|
59
|
+
sidebarOpen = true,
|
|
60
|
+
onToggleSidebar,
|
|
61
|
+
inspectorOpen = true,
|
|
62
|
+
onToggleInspector,
|
|
63
|
+
theme,
|
|
64
|
+
}: ShellHeaderProps): React.ReactNode {
|
|
65
|
+
const tokens = theme ?? DARK;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<box
|
|
69
|
+
style={{
|
|
70
|
+
flexDirection: "row",
|
|
71
|
+
height: "100%",
|
|
72
|
+
alignItems: "center",
|
|
73
|
+
paddingLeft: 2,
|
|
74
|
+
paddingRight: 2,
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<box style={{ flexDirection: "row", alignItems: "center" }}>
|
|
78
|
+
{onToggleSidebar !== undefined ? (
|
|
79
|
+
<IconView
|
|
80
|
+
icon={{
|
|
81
|
+
glyph: sidebarOpen ? NERD.sidebarLeft : NERD.sidebarLeftOff,
|
|
82
|
+
onPress: onToggleSidebar,
|
|
83
|
+
}}
|
|
84
|
+
tokens={tokens}
|
|
85
|
+
marginRight={3}
|
|
86
|
+
/>
|
|
87
|
+
) : null}
|
|
88
|
+
{leftIcons.map((icon, index) => (
|
|
89
|
+
<IconView
|
|
90
|
+
key={`left-${index}-${icon.glyph}`}
|
|
91
|
+
icon={icon}
|
|
92
|
+
tokens={tokens}
|
|
93
|
+
marginRight={3}
|
|
94
|
+
/>
|
|
95
|
+
))}
|
|
96
|
+
{leftLabel !== undefined ? (
|
|
97
|
+
<text fg={tokens.textMuted}>
|
|
98
|
+
{leftLabel}
|
|
99
|
+
{" "}
|
|
100
|
+
</text>
|
|
101
|
+
) : null}
|
|
102
|
+
{titleIcon !== undefined ? <text fg={tokens.textDim}>{titleIcon} </text> : null}
|
|
103
|
+
{title !== undefined ? <text fg={tokens.text}>{title}</text> : null}
|
|
104
|
+
</box>
|
|
105
|
+
<box style={{ flexGrow: 1 }} />
|
|
106
|
+
<box style={{ flexDirection: "row", alignItems: "center" }}>
|
|
107
|
+
{tabs.map((tab, index) => (
|
|
108
|
+
<text
|
|
109
|
+
key={`tab-${index}-${tab.label}`}
|
|
110
|
+
fg={tab.active ? tokens.accent : tokens.textMuted}
|
|
111
|
+
>
|
|
112
|
+
{tab.label}
|
|
113
|
+
{" "}
|
|
114
|
+
</text>
|
|
115
|
+
))}
|
|
116
|
+
{rightIcons.map((icon, index) => (
|
|
117
|
+
<IconView
|
|
118
|
+
key={`right-${index}-${icon.glyph}`}
|
|
119
|
+
icon={icon}
|
|
120
|
+
tokens={tokens}
|
|
121
|
+
marginRight={3}
|
|
122
|
+
/>
|
|
123
|
+
))}
|
|
124
|
+
{onToggleInspector !== undefined ? (
|
|
125
|
+
<IconView
|
|
126
|
+
icon={{
|
|
127
|
+
glyph: inspectorOpen ? NERD.sidebarRight : NERD.sidebarRightOff,
|
|
128
|
+
onPress: onToggleInspector,
|
|
129
|
+
}}
|
|
130
|
+
tokens={tokens}
|
|
131
|
+
marginRight={0}
|
|
132
|
+
/>
|
|
133
|
+
) : null}
|
|
134
|
+
</box>
|
|
135
|
+
</box>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ClientExtensionRegistry } from "../../integrations/client-extension-registry";
|
|
3
|
+
import { DARK } from "../../appearance/theme";
|
|
4
|
+
import type { Story, StoryMeta } from "../../stories/story";
|
|
5
|
+
import { WorkspacePanels } from "./WorkspacePanels";
|
|
6
|
+
|
|
7
|
+
export const meta: StoryMeta = { title: "Extensions/WorkspacePanels" };
|
|
8
|
+
|
|
9
|
+
const registry = new ClientExtensionRegistry();
|
|
10
|
+
|
|
11
|
+
void registry.load("example", (api) => {
|
|
12
|
+
api.registerView({
|
|
13
|
+
id: "details",
|
|
14
|
+
zone: "workspace.panels",
|
|
15
|
+
title: "Details",
|
|
16
|
+
Component: () => <text>Extension details</text>,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const RegisteredView: Story = {
|
|
21
|
+
render: () => (
|
|
22
|
+
<WorkspacePanels
|
|
23
|
+
width={32}
|
|
24
|
+
projectMode="tree"
|
|
25
|
+
projectPanel={<text>Project files</text>}
|
|
26
|
+
onToggleChanges={() => {}}
|
|
27
|
+
onToggleProject={() => {}}
|
|
28
|
+
onToggleRight={() => {}}
|
|
29
|
+
onFocus={() => {}}
|
|
30
|
+
registry={registry}
|
|
31
|
+
context={{ workspace: "/repo", threadId: "thread-1" }}
|
|
32
|
+
theme={DARK}
|
|
33
|
+
/>
|
|
34
|
+
),
|
|
35
|
+
size: { width: 32, height: 10 },
|
|
36
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { useKeyboard } from "@opentui/react";
|
|
3
|
+
import type { ExtensionUIContext } from "@cueloop/extension-api/client";
|
|
4
|
+
import type { ClientExtensionRegistry } from "../../integrations/client-extension-registry";
|
|
5
|
+
import type { Theme } from "../../appearance/theme";
|
|
6
|
+
import type { ProjectPanelMode } from "./AppShell";
|
|
7
|
+
import {
|
|
8
|
+
ExtensionZone,
|
|
9
|
+
useClientExtensionSnapshot,
|
|
10
|
+
visibleContributions,
|
|
11
|
+
} from "../../integrations/components/ExtensionZone";
|
|
12
|
+
import { FileTab, PanelColumn } from "./PanelColumn";
|
|
13
|
+
import { IconButton } from "../../ui/components/primitives/IconButton";
|
|
14
|
+
import { NERD } from "../../ui/components/primitives/icons";
|
|
15
|
+
|
|
16
|
+
/** The existing right pane owns built-in modes and selectable extension views. */
|
|
17
|
+
export function WorkspacePanels(props: {
|
|
18
|
+
width: number;
|
|
19
|
+
projectMode: ProjectPanelMode;
|
|
20
|
+
projectPanel: React.ReactNode;
|
|
21
|
+
onToggleChanges: () => void;
|
|
22
|
+
onToggleProject: () => void;
|
|
23
|
+
onToggleRight: () => void;
|
|
24
|
+
onFocus: () => void;
|
|
25
|
+
focused?: boolean;
|
|
26
|
+
registry: ClientExtensionRegistry;
|
|
27
|
+
context: ExtensionUIContext;
|
|
28
|
+
theme: Theme;
|
|
29
|
+
onExtensionError?: (message: string) => void;
|
|
30
|
+
}): React.ReactNode {
|
|
31
|
+
const { registry, context, theme, onExtensionError } = props;
|
|
32
|
+
const snapshot = useClientExtensionSnapshot(registry);
|
|
33
|
+
const { workspace, threadId } = context;
|
|
34
|
+
const visibility = useMemo(
|
|
35
|
+
() => visibleContributions(snapshot.views, { workspace, threadId }),
|
|
36
|
+
[snapshot.views, workspace, threadId],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
for (const error of visibility.errors) onExtensionError?.(error);
|
|
41
|
+
}, [visibility, onExtensionError]);
|
|
42
|
+
|
|
43
|
+
const views = visibility.items;
|
|
44
|
+
const [selectedView, setSelectedView] = useState<(typeof views)[number] | null>(null);
|
|
45
|
+
const selected = views.find(
|
|
46
|
+
({ key, value }) => key === selectedView?.key && value === selectedView.value,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const showBuiltIn = (toggle: () => void): void => {
|
|
50
|
+
setSelectedView(null);
|
|
51
|
+
toggle();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
useKeyboard((key) => {
|
|
55
|
+
if (!props.focused || (key.name !== "[" && key.name !== "]")) return;
|
|
56
|
+
const choices = [null, ...views];
|
|
57
|
+
const current = selected ? views.indexOf(selected) + 1 : 0;
|
|
58
|
+
const step = key.name === "]" ? 1 : -1;
|
|
59
|
+
|
|
60
|
+
setSelectedView(choices[(current + step + choices.length) % choices.length] ?? null);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const toggles = (
|
|
64
|
+
<box style={{ flexDirection: "row", flexShrink: 0, alignItems: "center" }}>
|
|
65
|
+
<IconButton
|
|
66
|
+
glyph="changes"
|
|
67
|
+
active={!selected && props.projectMode === "changes"}
|
|
68
|
+
onPress={() => showBuiltIn(props.onToggleChanges)}
|
|
69
|
+
marginRight={2}
|
|
70
|
+
theme={theme}
|
|
71
|
+
/>
|
|
72
|
+
<IconButton
|
|
73
|
+
glyph="project"
|
|
74
|
+
active={!selected && props.projectMode === "tree"}
|
|
75
|
+
onPress={() => showBuiltIn(props.onToggleProject)}
|
|
76
|
+
marginRight={2}
|
|
77
|
+
theme={theme}
|
|
78
|
+
/>
|
|
79
|
+
<IconButton
|
|
80
|
+
glyph={NERD.sidebarRight}
|
|
81
|
+
onPress={props.onToggleRight}
|
|
82
|
+
tip="Toggle Sidebar"
|
|
83
|
+
theme={theme}
|
|
84
|
+
/>
|
|
85
|
+
</box>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<PanelColumn
|
|
90
|
+
width={props.width}
|
|
91
|
+
border="left"
|
|
92
|
+
header={
|
|
93
|
+
views.length > 0 ? (
|
|
94
|
+
<box style={{ flexDirection: "row", minWidth: 0 }}>
|
|
95
|
+
{views.map(({ key, value }) => (
|
|
96
|
+
<box key={key} onMouseUp={() => setSelectedView({ key, value })}>
|
|
97
|
+
<FileTab label={value.title} active={key === selected?.key} theme={theme} />
|
|
98
|
+
</box>
|
|
99
|
+
))}
|
|
100
|
+
</box>
|
|
101
|
+
) : null
|
|
102
|
+
}
|
|
103
|
+
headerRight={toggles}
|
|
104
|
+
onFocus={props.onFocus}
|
|
105
|
+
theme={theme}
|
|
106
|
+
>
|
|
107
|
+
{selected ? (
|
|
108
|
+
<ExtensionZone
|
|
109
|
+
zone="workspace.panels"
|
|
110
|
+
registry={registry}
|
|
111
|
+
context={context}
|
|
112
|
+
selectedViewId={selected.key}
|
|
113
|
+
onError={props.onExtensionError}
|
|
114
|
+
/>
|
|
115
|
+
) : (
|
|
116
|
+
props.projectPanel
|
|
117
|
+
)}
|
|
118
|
+
</PanelColumn>
|
|
119
|
+
);
|
|
120
|
+
}
|