@xp266/dshtui 0.1.0
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/bin/dshtui.js +65 -0
- package/cordis.patch.yml +81 -0
- package/lib/contract/index.d.mts +2 -0
- package/lib/contract/index.mjs +5 -0
- package/lib/dialog.d.mts +156 -0
- package/lib/dialog.mjs +3 -0
- package/lib/index-DqnaSXqP.d.mts +823 -0
- package/lib/index.d.mts +17 -0
- package/lib/index.mjs +11404 -0
- package/lib/prod-react-Dzof4qJx.mjs +4 -0
- package/lib/surface-DdxzIgIY.mjs +3126 -0
- package/lib/vendor.d.mts +3 -0
- package/lib/vendor.mjs +4 -0
- package/package.json +128 -0
- package/src/apply-theme.ts +8 -0
- package/src/boot-log.ts +35 -0
- package/src/chat/blocks.ts +41 -0
- package/src/chat/bridge.ts +1076 -0
- package/src/chat/builtin-tool-views.ts +53 -0
- package/src/chat/chat-face.ts +16 -0
- package/src/chat/chat-nodes.ts +53 -0
- package/src/chat/efforts.ts +4 -0
- package/src/chat/interactions.ts +329 -0
- package/src/chat/models.ts +263 -0
- package/src/chat/partial-json.ts +125 -0
- package/src/chat/presets.ts +26 -0
- package/src/chat/question-view.ts +106 -0
- package/src/chat/retry-status.ts +33 -0
- package/src/chat/session-groups.ts +34 -0
- package/src/chat/session-list.ts +311 -0
- package/src/chat/store.ts +636 -0
- package/src/chat/todo-view.ts +66 -0
- package/src/chat/tool-view.ts +311 -0
- package/src/chat/tool-views.ts +114 -0
- package/src/contract/index.ts +704 -0
- package/src/contract/upstream.ts +165 -0
- package/src/core/caret-nonce.ts +19 -0
- package/src/core/composer-layout.ts +65 -0
- package/src/core/edit.ts +152 -0
- package/src/core/field-view.ts +52 -0
- package/src/core/fields.ts +185 -0
- package/src/core/metrics.ts +26 -0
- package/src/core/paste.ts +149 -0
- package/src/core/segments.ts +112 -0
- package/src/core/text.ts +290 -0
- package/src/dialog.ts +11 -0
- package/src/env.ts +38 -0
- package/src/harness-home.ts +22 -0
- package/src/hot-theme.ts +56 -0
- package/src/index.tsx +185 -0
- package/src/kernel/registry.ts +102 -0
- package/src/kernel/surface.ts +33 -0
- package/src/log.ts +249 -0
- package/src/model/message.ts +89 -0
- package/src/model/selection.ts +63 -0
- package/src/performance-guard.ts +28 -0
- package/src/runtime/prod-react.ts +10 -0
- package/src/terminal/background.ts +66 -0
- package/src/terminal/capabilities.ts +54 -0
- package/src/terminal/clipboard-backends.ts +69 -0
- package/src/terminal/clipboard.ts +161 -0
- package/src/terminal/cursor-shape.ts +13 -0
- package/src/terminal/glyphs.ts +44 -0
- package/src/terminal/mouse.ts +154 -0
- package/src/terminal/probe.ts +61 -0
- package/src/terminal/screen.ts +349 -0
- package/src/theme-settings.ts +31 -0
- package/src/theme.ts +319 -0
- package/src/ui/app.tsx +454 -0
- package/src/ui/chrome/caps.tsx +9 -0
- package/src/ui/chrome/hint-service.ts +87 -0
- package/src/ui/chrome/input-status.ts +27 -0
- package/src/ui/chrome/key-gate.tsx +29 -0
- package/src/ui/chrome/status-bar.tsx +147 -0
- package/src/ui/contributions.ts +47 -0
- package/src/ui/dialog/defaults-dialog.tsx +152 -0
- package/src/ui/dialog/dialog-item.tsx +38 -0
- package/src/ui/dialog/dialog.tsx +386 -0
- package/src/ui/dialog/effort-dialog.tsx +45 -0
- package/src/ui/dialog/geometry.ts +131 -0
- package/src/ui/dialog/items.ts +124 -0
- package/src/ui/dialog/list-dialog.tsx +63 -0
- package/src/ui/dialog/models-dialog.tsx +203 -0
- package/src/ui/dialog/presets-dialog.tsx +46 -0
- package/src/ui/dialog/providers-dialog.tsx +313 -0
- package/src/ui/dialog/sessions-dialog.tsx +163 -0
- package/src/ui/dialog/sizes.ts +7 -0
- package/src/ui/dialog/status-lines.ts +11 -0
- package/src/ui/dialog/todo-dialog.tsx +29 -0
- package/src/ui/dialog/use-dialog-input.ts +186 -0
- package/src/ui/extension-point.ts +188 -0
- package/src/ui/home-logo.ts +132 -0
- package/src/ui/hooks/use-async-action.ts +25 -0
- package/src/ui/hooks/use-async-list.ts +71 -0
- package/src/ui/hooks/use-caret.ts +24 -0
- package/src/ui/hooks/use-chat-events.ts +153 -0
- package/src/ui/hooks/use-mouse-selection.ts +352 -0
- package/src/ui/hooks/use-scroll.ts +49 -0
- package/src/ui/hooks/use-terminal-size.ts +20 -0
- package/src/ui/input/commands.ts +118 -0
- package/src/ui/input/composer-bus.ts +14 -0
- package/src/ui/input/composer-fields.ts +111 -0
- package/src/ui/input/composer-keys.ts +21 -0
- package/src/ui/input/composer-paste.ts +20 -0
- package/src/ui/input/input-bar.tsx +279 -0
- package/src/ui/input/use-composer.ts +495 -0
- package/src/ui/key-arbiter.ts +37 -0
- package/src/ui/keymap.ts +15 -0
- package/src/ui/layout-service.ts +77 -0
- package/src/ui/message/layout.ts +763 -0
- package/src/ui/message/md/block.ts +247 -0
- package/src/ui/message/md/engine.ts +430 -0
- package/src/ui/message/md/extensions.ts +58 -0
- package/src/ui/message/md/highlight.ts +626 -0
- package/src/ui/message/md/index.ts +14 -0
- package/src/ui/message/md/inline.ts +97 -0
- package/src/ui/message/md/palette.ts +87 -0
- package/src/ui/message/message-list.tsx +69 -0
- package/src/ui/message/message-row.tsx +137 -0
- package/src/ui/message/message-views.ts +16 -0
- package/src/ui/message/renderers.ts +39 -0
- package/src/ui/message/tool-diff.ts +188 -0
- package/src/ui/message/warmup.ts +41 -0
- package/src/ui/message/wave.ts +98 -0
- package/src/ui/overlay.ts +22 -0
- package/src/ui/panels/approval-panel.tsx +193 -0
- package/src/ui/panels/exports.ts +3 -0
- package/src/ui/panels/question-model.ts +424 -0
- package/src/ui/panels/question-panel.tsx +154 -0
- package/src/ui/panels/surface.tsx +106 -0
- package/src/ui/panels-builtin.tsx +86 -0
- package/src/ui/pointer/builtins.ts +281 -0
- package/src/ui/pointer/registry.ts +25 -0
- package/src/ui/region.tsx +31 -0
- package/src/ui/selection/service.ts +92 -0
- package/src/ui/selection-registry.ts +88 -0
- package/src/ui/selection.tsx +148 -0
- package/src/ui/spinner-tick.tsx +24 -0
- package/src/ui/use-available-windows.ts +31 -0
- package/src/ui/widgets/actions.tsx +84 -0
- package/src/ui/widgets/button.tsx +57 -0
- package/src/ui/widgets/checkbox.tsx +58 -0
- package/src/ui/widgets/header.tsx +36 -0
- package/src/ui/widgets/index.ts +8 -0
- package/src/ui/widgets/input.tsx +76 -0
- package/src/ui/widgets/registry.ts +32 -0
- package/src/ui/widgets/search.tsx +59 -0
- package/src/ui/widgets/select.tsx +97 -0
- package/src/ui/widgets/static.tsx +37 -0
- package/src/ui/widgets/types.ts +1 -0
- package/src/ui/window-services-bridge.ts +71 -0
- package/src/ui/window-services.ts +20 -0
- package/src/ui/windows/models-window.tsx +15 -0
- package/src/ui/windows/providers-window.tsx +14 -0
- package/src/ui/windows/service-window.tsx +18 -0
- package/src/ui/windows/sessions-window.tsx +25 -0
- package/src/ui/windows-builtin.tsx +94 -0
- package/src/ui/windows.ts +18 -0
- package/src/vendor.ts +12 -0
package/bin/dshtui.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* dshtui — standalone launcher. Boots the DeepSeek Harness profile that
|
|
4
|
+
* carries this TUI, equivalent to `dsh --profile <profile> [args...]`.
|
|
5
|
+
*
|
|
6
|
+
* The dsh CLI's subcommands are hardcoded upstream, so the command lives in
|
|
7
|
+
* this package's bin instead. The profile defaults to `dshtui` and can be
|
|
8
|
+
* overridden with DSH_TUI_PROFILE. On first run (profile directory absent)
|
|
9
|
+
* the profile is bootstrapped from the published package version, which is
|
|
10
|
+
* also the version the profile later upgrades through `dsh plugin add`.
|
|
11
|
+
*
|
|
12
|
+
* This file must stay free of lib/ imports so it works from a global
|
|
13
|
+
* install, a profile copy, and a dev checkout alike.
|
|
14
|
+
*/
|
|
15
|
+
import { spawn, spawnSync } from 'node:child_process'
|
|
16
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
17
|
+
import { homedir } from 'node:os'
|
|
18
|
+
import { dirname, join } from 'node:path'
|
|
19
|
+
import { fileURLToPath } from 'node:url'
|
|
20
|
+
|
|
21
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
22
|
+
const manifest = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'))
|
|
23
|
+
const profile = process.env.DSH_TUI_PROFILE ?? 'dshtui'
|
|
24
|
+
const dshHome = process.env.DSH_HOME ?? join(homedir(), '.dsh')
|
|
25
|
+
const profileDir = join(dshHome, 'profiles', profile)
|
|
26
|
+
|
|
27
|
+
function fail(message) {
|
|
28
|
+
console.error(`dshtui: ${message}`)
|
|
29
|
+
process.exit(1)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const dshProbe = spawnSync('dsh', ['--version'], { stdio: 'ignore', shell: process.platform === 'win32' })
|
|
33
|
+
if (dshProbe.error !== undefined) {
|
|
34
|
+
fail('the dsh CLI was not found on PATH; install it with: npm install -g @deepseek-ai/dsh')
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!existsSync(profileDir)) {
|
|
38
|
+
console.error(`dshtui: profile "${profile}" not found under ${join(dshHome, 'profiles')}; installing ${manifest.name}@${manifest.version} into it`)
|
|
39
|
+
const bootstrap = spawnSync(
|
|
40
|
+
'dsh',
|
|
41
|
+
['plugin', '--profile', profile, 'add', `${manifest.name}@${manifest.version}`],
|
|
42
|
+
{ stdio: 'inherit', shell: process.platform === 'win32' },
|
|
43
|
+
)
|
|
44
|
+
if (bootstrap.status !== 0) {
|
|
45
|
+
fail(`bootstrapping the profile failed; create it manually with: dsh plugin --profile ${profile} add ${manifest.name}`)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const argv = process.argv.slice(2)
|
|
50
|
+
const child = spawn('dsh', ['--profile', profile, ...argv], {
|
|
51
|
+
stdio: 'inherit',
|
|
52
|
+
...(process.platform === 'win32'
|
|
53
|
+
? { shell: true, windowsVerbatimArguments: true }
|
|
54
|
+
: {}),
|
|
55
|
+
})
|
|
56
|
+
child.on('error', () => {
|
|
57
|
+
fail('the dsh CLI was not found on PATH; install it with: npm install -g @deepseek-ai/dsh')
|
|
58
|
+
})
|
|
59
|
+
child.on('close', (status, signal) => {
|
|
60
|
+
if (signal !== null) {
|
|
61
|
+
process.kill(process.pid, signal)
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
process.exit(status ?? 1)
|
|
65
|
+
})
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
- insert:
|
|
2
|
+
- id: storage
|
|
3
|
+
name: '@deepseek-ai/dsh-storage'
|
|
4
|
+
- id: storage-json
|
|
5
|
+
name: '@deepseek-ai/dsh-storage-json'
|
|
6
|
+
config:
|
|
7
|
+
root: !!js dshHomePath('storages')
|
|
8
|
+
- id: storage-domain
|
|
9
|
+
name: '@deepseek-ai/dsh-storage-domain'
|
|
10
|
+
config:
|
|
11
|
+
backend: json
|
|
12
|
+
# Persisted title/blank hints so the session picker lists cold sessions
|
|
13
|
+
# without reading their logs.
|
|
14
|
+
- id: session-projection-cache
|
|
15
|
+
name: '@deepseek-ai/dsh-session-projection-cache'
|
|
16
|
+
config:
|
|
17
|
+
writeEveryEvents: 200
|
|
18
|
+
writeIntervalMs: 5000
|
|
19
|
+
- id: workspace
|
|
20
|
+
name: '@deepseek-ai/dsh-workspace'
|
|
21
|
+
- id: agent-presets
|
|
22
|
+
name: '@deepseek-ai/dsh-agent-presets'
|
|
23
|
+
config:
|
|
24
|
+
default: standard
|
|
25
|
+
- id: cordis-host-runner
|
|
26
|
+
name: '@deepseek-ai/dsh-cordis-host-runner'
|
|
27
|
+
# Durable image storage comes from the dsh base bundle's attachment-local
|
|
28
|
+
# row; the TUI resolves ctx.attachments at send time and degrades to a
|
|
29
|
+
# plain text message when the service is absent.
|
|
30
|
+
- id: tui
|
|
31
|
+
name: '@xp266/dshtui'
|
|
32
|
+
|
|
33
|
+
# The per-agent rows move behind agent presets: each preset owns its own tool
|
|
34
|
+
# and prompt composition, so the process-level rows must not also register
|
|
35
|
+
# (the agent would see every tool twice).
|
|
36
|
+
- id: tool-bash
|
|
37
|
+
disabled: true
|
|
38
|
+
- id: tool-pwsh
|
|
39
|
+
disabled: true
|
|
40
|
+
- id: tool-jobs
|
|
41
|
+
disabled: true
|
|
42
|
+
- id: tool-fs
|
|
43
|
+
disabled: true
|
|
44
|
+
- id: tool-fs-search
|
|
45
|
+
disabled: true
|
|
46
|
+
- id: tool-str-replace-editor
|
|
47
|
+
disabled: true
|
|
48
|
+
- id: skill-filesystem
|
|
49
|
+
disabled: true
|
|
50
|
+
- id: tool-skill
|
|
51
|
+
disabled: true
|
|
52
|
+
- id: tool-goal
|
|
53
|
+
disabled: true
|
|
54
|
+
- id: plan-mode
|
|
55
|
+
disabled: true
|
|
56
|
+
- id: compaction-basic
|
|
57
|
+
disabled: true
|
|
58
|
+
- id: command-compact
|
|
59
|
+
disabled: true
|
|
60
|
+
- id: tool-result-pruner
|
|
61
|
+
disabled: true
|
|
62
|
+
- id: tool-subagent-control
|
|
63
|
+
disabled: true
|
|
64
|
+
- id: tool-subagent-list-agents
|
|
65
|
+
disabled: true
|
|
66
|
+
- id: tool-subagent
|
|
67
|
+
disabled: true
|
|
68
|
+
- id: tool-subagent-fork
|
|
69
|
+
disabled: true
|
|
70
|
+
- id: workflow-worker-thread
|
|
71
|
+
disabled: true
|
|
72
|
+
- id: tool-workflow
|
|
73
|
+
disabled: true
|
|
74
|
+
- id: tool-ralph
|
|
75
|
+
disabled: true
|
|
76
|
+
- id: agent-instructions
|
|
77
|
+
disabled: true
|
|
78
|
+
- id: tool-todo
|
|
79
|
+
disabled: true
|
|
80
|
+
- id: tool-web
|
|
81
|
+
disabled: true
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { $ as ToolCallPresentation, A as MessageViewContribution, At as TuiToolsFace, B as PointerSession, Bt as MouseEventData, C as MarkdownBlockContext, Ct as TuiPaletteFace, D as MessageRendererContribution, Dt as TuiSessionSummary, E as MarkdownInlineContribution, Et as TuiServicesFace, F as PasteContext, Ft as WindowCommandSpec, G as SelectionExtractContext, H as PrismGrammarContribution, Ht as MessageKind, I as PasteHandlerContribution, It as WindowContribution, J as SpecialFieldCreateInput, K as SelectionTransformerContribution, L as PasteResult, Lt as WindowHandle, M as OverlayContribution, Mt as TuiWindowsFace, N as POINTER_PLUGIN_ORDER, Nt as WidgetDef, O as MessageRendererResult, Ot as TuiStartupFace, P as PaintArgs, Pt as WidgetKeyApi, Q as ThemePaletteContribution, R as PointerEventFrame, Rt as WindowProps, S as KeyBindingContribution, St as TuiMarkdownFace, T as MarkdownInlineContext, Tt as TuiSelectionFace, U as SelectionClipboardContribution, Ut as LineSelection, V as PointerUiContext, Vt as MouseEventType, W as SelectionDomainContribution, Wt as PendingImage, X as SpecialFieldStyle, Y as SpecialFieldFactory, Z as StatusLineContribution, _ as InputStatusContext, _t as TuiHomeLogoFace, a as CommandDef, at as ToolViewContribution, b as InteractionPanelComponentProps, bt as TuiKey, c as CustomMessageSeed, ct as TuiChatFace, d as DiffLine, dt as TuiCommandsFace, et as ToolReadLine, f as DiffLineKind, ft as TuiComposerFace, g as HomeLogoContribution, gt as TuiHintFace, h as HintMatcherContribution, ht as TuiFieldsFace, i as ClipboardBackendContribution, it as ToolViewCallContext, j as MessageViewRender, jt as TuiWidgetsFace, k as MessageViewContext, kt as TuiStartupSink, l as DialogItemKinds, lt as TuiChromeFace, m as HintEntry, mt as TuiExtensionPoint, n as ClickActions, nt as ToolResultPresentation, o as ComposerInsertSpec, ot as ToolViewDiff, p as HintArgsContribution, pt as TuiContentFace, q as SpecialFieldContribution, r as ClickHit, rt as ToolResultView, s as CustomMessage, st as ToolViewResultContext, t as ChatNodeDefinition, tt as ToolReadView, u as DiffHunk, ut as TuiClipboardFace, v as InputStatusContribution, vt as TuiInteractionPanelsFace, w as MarkdownBlockContribution, wt as TuiPointerFace, x as InteractionPanelContribution, xt as TuiKeymapFace, y as InputStatusPart, yt as TuiInteractionsFace, z as PointerHandlerContribution, zt as ScrollSnapshot } from "../index-DqnaSXqP.mjs";
|
|
2
|
+
export { ChatNodeDefinition, ClickActions, ClickHit, ClipboardBackendContribution, CommandDef, ComposerInsertSpec, CustomMessage, CustomMessageSeed, DialogItemKinds, DiffHunk, DiffLine, DiffLineKind, HintArgsContribution, HintEntry, HintMatcherContribution, HomeLogoContribution, InputStatusContext, InputStatusContribution, InputStatusPart, InteractionPanelComponentProps, InteractionPanelContribution, KeyBindingContribution, type LineSelection, MarkdownBlockContext, MarkdownBlockContribution, MarkdownInlineContext, MarkdownInlineContribution, type MessageKind, MessageRendererContribution, MessageRendererResult, MessageViewContext, MessageViewContribution, MessageViewRender, type MouseEventData, type MouseEventType, OverlayContribution, POINTER_PLUGIN_ORDER, PaintArgs, PasteContext, PasteHandlerContribution, PasteResult, type PendingImage, PointerEventFrame, PointerHandlerContribution, PointerSession, PointerUiContext, PrismGrammarContribution, type ScrollSnapshot, SelectionClipboardContribution, SelectionDomainContribution, SelectionExtractContext, SelectionTransformerContribution, SpecialFieldContribution, SpecialFieldCreateInput, SpecialFieldFactory, SpecialFieldStyle, StatusLineContribution, ThemePaletteContribution, ToolCallPresentation, ToolReadLine, ToolReadView, ToolResultPresentation, ToolResultView, ToolViewCallContext, ToolViewContribution, ToolViewDiff, ToolViewResultContext, TuiChatFace, TuiChromeFace, TuiClipboardFace, TuiCommandsFace, TuiComposerFace, TuiContentFace, TuiExtensionPoint, TuiFieldsFace, TuiHintFace, TuiHomeLogoFace, TuiInteractionPanelsFace, TuiInteractionsFace, TuiKey, TuiKeymapFace, TuiMarkdownFace, TuiPaletteFace, TuiPointerFace, TuiSelectionFace, TuiServicesFace, TuiSessionSummary, TuiStartupFace, TuiStartupSink, TuiToolsFace, TuiWidgetsFace, TuiWindowsFace, WidgetDef, WidgetKeyApi, WindowCommandSpec, WindowContribution, WindowHandle, WindowProps };
|
package/lib/dialog.d.mts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Gt as Segment, Lt as WindowHandle, Nt as WidgetDef, l as DialogItemKinds } from "./index-DqnaSXqP.mjs";
|
|
2
|
+
import { ReactNode, Ref } from "react";
|
|
3
|
+
//#region src/ui/dialog/items.d.ts
|
|
4
|
+
interface DialogRow {
|
|
5
|
+
items: DialogItem[];
|
|
6
|
+
}
|
|
7
|
+
type PluginDialogItem = DialogItemKinds[keyof DialogItemKinds];
|
|
8
|
+
type DialogItem = {
|
|
9
|
+
type: 'input';
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
onChange: (value: string) => void;
|
|
13
|
+
onEnter?: () => void;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'select';
|
|
16
|
+
label: string;
|
|
17
|
+
value: string;
|
|
18
|
+
options: string[];
|
|
19
|
+
onChange: (value: string) => void;
|
|
20
|
+
onEnter?: () => void;
|
|
21
|
+
spaced?: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'search';
|
|
24
|
+
value: string;
|
|
25
|
+
onChange: (value: string) => void;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'button';
|
|
28
|
+
label: string;
|
|
29
|
+
right?: string;
|
|
30
|
+
rightColor?: string;
|
|
31
|
+
onPress: () => void;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'checkbox';
|
|
34
|
+
label: string;
|
|
35
|
+
checked: boolean;
|
|
36
|
+
onToggle: () => void;
|
|
37
|
+
onConfirm: () => void;
|
|
38
|
+
} | {
|
|
39
|
+
type: 'header';
|
|
40
|
+
label: string;
|
|
41
|
+
leadingBlank?: boolean;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'static';
|
|
44
|
+
label: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'actions';
|
|
47
|
+
confirmLabel: string;
|
|
48
|
+
cancelLabel: string;
|
|
49
|
+
onConfirm: () => void;
|
|
50
|
+
onCancel: () => void;
|
|
51
|
+
} | {
|
|
52
|
+
type: string;
|
|
53
|
+
data?: unknown;
|
|
54
|
+
} | PluginDialogItem;
|
|
55
|
+
interface DialogFocus {
|
|
56
|
+
row: number;
|
|
57
|
+
col: number;
|
|
58
|
+
}
|
|
59
|
+
type TextItem = Extract<DialogItem, {
|
|
60
|
+
type: 'input';
|
|
61
|
+
}> | Extract<DialogItem, {
|
|
62
|
+
type: 'search';
|
|
63
|
+
}>;
|
|
64
|
+
declare function asTextItem(item: DialogItem): TextItem | null;
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/ui/dialog/geometry.d.ts
|
|
67
|
+
interface DialogFooterLine {
|
|
68
|
+
text: string;
|
|
69
|
+
color?: string;
|
|
70
|
+
}
|
|
71
|
+
interface FooterRenderLine {
|
|
72
|
+
text: string;
|
|
73
|
+
color?: string;
|
|
74
|
+
}
|
|
75
|
+
declare function wrapStatusLines(lines: DialogFooterLine[] | undefined, width: number): FooterRenderLine[];
|
|
76
|
+
declare function rowHeight(row: DialogRow, width: number): number;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/ui/dialog/dialog.d.ts
|
|
79
|
+
interface DialogProps {
|
|
80
|
+
width: number;
|
|
81
|
+
maxHeight: number;
|
|
82
|
+
title?: string;
|
|
83
|
+
rows: DialogRow[];
|
|
84
|
+
footer?: DialogFooterLine[];
|
|
85
|
+
errors?: DialogFooterLine[];
|
|
86
|
+
onClose: () => void;
|
|
87
|
+
search?: boolean;
|
|
88
|
+
searchRight?: boolean;
|
|
89
|
+
centerScroll?: boolean;
|
|
90
|
+
onCtrlA?(focused: DialogItem | undefined): boolean;
|
|
91
|
+
onCtrlD?(focused: DialogItem | undefined): boolean;
|
|
92
|
+
onCtrlE?(focused: DialogItem | undefined): boolean;
|
|
93
|
+
onActivity?(): void;
|
|
94
|
+
ref?: Ref<DialogHandle>;
|
|
95
|
+
}
|
|
96
|
+
type DialogHandle = WindowHandle;
|
|
97
|
+
declare const CloseGuardContext: import("react").Context<boolean>;
|
|
98
|
+
declare function Dialog({ width, maxHeight, title, rows, footer, errors, onClose, search, searchRight, centerScroll, onCtrlA, onCtrlD, onCtrlE, onActivity, ref }: DialogProps): import("react").JSX.Element;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/ui/widgets/registry.d.ts
|
|
101
|
+
declare function registerWidget<I extends {
|
|
102
|
+
type: string;
|
|
103
|
+
}>(type: I['type'], def: WidgetDef<I>, options?: {
|
|
104
|
+
order?: number;
|
|
105
|
+
}): () => void;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/ui/panels/surface.d.ts
|
|
108
|
+
interface PanelPointerHandle {
|
|
109
|
+
clickAt(y: number, x: number): void;
|
|
110
|
+
wheel(dir: -1 | 1): boolean;
|
|
111
|
+
}
|
|
112
|
+
interface PanelRow {
|
|
113
|
+
segments: Segment[];
|
|
114
|
+
/** Replaces the text row with an interactive node (e.g. a button row). */
|
|
115
|
+
content?: ReactNode;
|
|
116
|
+
}
|
|
117
|
+
interface PanelHint {
|
|
118
|
+
/** Key token, rendered with the key color (e.g. "enter", an arrow glyph). */
|
|
119
|
+
key: string;
|
|
120
|
+
/** Action word, rendered with the description color. */
|
|
121
|
+
description: string;
|
|
122
|
+
}
|
|
123
|
+
interface PanelLegendOptions {
|
|
124
|
+
/** Leading counter text (e.g. "1/2"), rendered with the description color. */
|
|
125
|
+
prefix?: string;
|
|
126
|
+
keyColor?: string;
|
|
127
|
+
descriptionColor?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Build a key-hint row: keys in the panel key color, action words in the
|
|
131
|
+
* muted description color ("enter select esc close").
|
|
132
|
+
*/
|
|
133
|
+
declare function panelLegend(hints: readonly PanelHint[], options?: PanelLegendOptions): Segment[];
|
|
134
|
+
/**
|
|
135
|
+
* Shared panel chrome: a floating block anchored above the status line with
|
|
136
|
+
* half-block caps, the panel background, and per-row text or interactive
|
|
137
|
+
* content. Builtin panels and plugin panels built through dshtui/dialog
|
|
138
|
+
* share this shell so every interaction panel looks the same.
|
|
139
|
+
*
|
|
140
|
+
* Selection pieces span the row text only, never the pill padding, so
|
|
141
|
+
* dragging over blank panel area selects nothing (same rule as messages).
|
|
142
|
+
*/
|
|
143
|
+
declare function PanelSurface({ columns, rows, body, bodyStart, background, blockWidth }: {
|
|
144
|
+
columns: number;
|
|
145
|
+
rows: number;
|
|
146
|
+
body: PanelRow[];
|
|
147
|
+
bodyStart: number;
|
|
148
|
+
background: string;
|
|
149
|
+
blockWidth: number;
|
|
150
|
+
}): import("react").JSX.Element;
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/ui/layout-service.d.ts
|
|
153
|
+
/** Anchor row where a panel of `bodyRows` lines must start to sit above the status line. */
|
|
154
|
+
declare function panelAnchorRow(rows: number, bodyRows: number): number;
|
|
155
|
+
//#endregion
|
|
156
|
+
export { CloseGuardContext, Dialog, type DialogFocus, type DialogFooterLine, type DialogHandle, type DialogItem, type DialogProps, type DialogRow, type PanelHint, type PanelLegendOptions, type PanelPointerHandle, type PanelRow, PanelSurface, type TextItem, asTextItem, panelAnchorRow, panelLegend, registerWidget, rowHeight, wrapStatusLines };
|
package/lib/dialog.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./prod-react-Dzof4qJx.mjs";
|
|
2
|
+
import { I as panelAnchorRow, c as asTextItem, i as Dialog, l as registerWidget, n as panelLegend, o as rowHeight, r as CloseGuardContext, s as wrapStatusLines, t as PanelSurface } from "./surface-DdxzIgIY.mjs";
|
|
3
|
+
export { CloseGuardContext, Dialog, PanelSurface, asTextItem, panelAnchorRow, panelLegend, registerWidget, rowHeight, wrapStatusLines };
|