@agi-fans/dsh-tui 0.21.0 → 0.22.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/lib/CHANGELOG.md +158 -1
- package/lib/chrome/box.d.ts +47 -16
- package/lib/chrome/box.js +172 -130
- package/lib/chrome/box.js.map +1 -1
- package/lib/chrome/code-highlight.d.ts +15 -0
- package/lib/chrome/code-highlight.js +60 -4
- package/lib/chrome/code-highlight.js.map +1 -1
- package/lib/chrome/command-output.d.ts +29 -2
- package/lib/chrome/command-output.js +100 -4
- package/lib/chrome/command-output.js.map +1 -1
- package/lib/chrome/main-screen-renderer.d.ts +16 -0
- package/lib/chrome/main-screen-renderer.js +53 -5
- package/lib/chrome/main-screen-renderer.js.map +1 -1
- package/lib/chrome/markdown.js +30 -10
- package/lib/chrome/markdown.js.map +1 -1
- package/lib/chrome/relative-time.d.ts +17 -0
- package/lib/chrome/relative-time.js +36 -0
- package/lib/chrome/relative-time.js.map +1 -1
- package/lib/chrome/secret-mask.d.ts +35 -0
- package/lib/chrome/secret-mask.js +180 -0
- package/lib/chrome/secret-mask.js.map +1 -0
- package/lib/chrome/status-config.d.ts +161 -51
- package/lib/chrome/status-config.js +237 -126
- package/lib/chrome/status-config.js.map +1 -1
- package/lib/chrome/status-line.d.ts +3 -2
- package/lib/chrome/status-line.js +105 -63
- package/lib/chrome/status-line.js.map +1 -1
- package/lib/chrome/terminal-colors.d.ts +85 -0
- package/lib/chrome/terminal-colors.js +230 -0
- package/lib/chrome/terminal-colors.js.map +1 -0
- package/lib/chrome/terminal-images.d.ts +9 -1
- package/lib/chrome/terminal-images.js +27 -4
- package/lib/chrome/terminal-images.js.map +1 -1
- package/lib/chrome/theme.d.ts +32 -9
- package/lib/chrome/theme.js +595 -498
- package/lib/chrome/theme.js.map +1 -1
- package/lib/chrome/tool-renderers.js +69 -13
- package/lib/chrome/tool-renderers.js.map +1 -1
- package/lib/chrome/tools-list.d.ts +1 -4
- package/lib/chrome/tools-list.js +1 -41
- package/lib/chrome/tools-list.js.map +1 -1
- package/lib/chrome/welcome-tips.d.ts +20 -8
- package/lib/chrome/welcome-tips.js +22 -42
- package/lib/chrome/welcome-tips.js.map +1 -1
- package/lib/commands/auth-ids.d.ts +25 -0
- package/lib/commands/auth-ids.js +27 -0
- package/lib/commands/auth-ids.js.map +1 -0
- package/lib/commands/auth-input.d.ts +34 -0
- package/lib/commands/auth-input.js +96 -0
- package/lib/commands/auth-input.js.map +1 -0
- package/lib/commands/auth-providers.d.ts +39 -0
- package/lib/commands/auth-providers.js +125 -0
- package/lib/commands/auth-providers.js.map +1 -0
- package/lib/commands/auth.d.ts +12 -20
- package/lib/commands/auth.js +42 -229
- package/lib/commands/auth.js.map +1 -1
- package/lib/commands/btw.d.ts +13 -1
- package/lib/commands/btw.js +37 -104
- package/lib/commands/btw.js.map +1 -1
- package/lib/commands/diff.js +1 -96
- package/lib/commands/diff.js.map +1 -1
- package/lib/commands/export.d.ts +1 -1
- package/lib/commands/export.js +3 -27
- package/lib/commands/export.js.map +1 -1
- package/lib/commands/files.d.ts +17 -1
- package/lib/commands/files.js +67 -107
- package/lib/commands/files.js.map +1 -1
- package/lib/commands/jobs.d.ts +19 -4
- package/lib/commands/jobs.js +50 -7
- package/lib/commands/jobs.js.map +1 -1
- package/lib/commands/model.js +108 -76
- package/lib/commands/model.js.map +1 -1
- package/lib/commands/permission.js +15 -16
- package/lib/commands/permission.js.map +1 -1
- package/lib/commands/plugins.js +133 -16
- package/lib/commands/plugins.js.map +1 -1
- package/lib/commands/schedule.d.ts +10 -0
- package/lib/commands/schedule.js +45 -14
- package/lib/commands/schedule.js.map +1 -1
- package/lib/commands/session-configuration.js +2 -10
- package/lib/commands/session-configuration.js.map +1 -1
- package/lib/commands/session.js +14 -38
- package/lib/commands/session.js.map +1 -1
- package/lib/commands/terminal.d.ts +14 -8
- package/lib/commands/terminal.js +19 -178
- package/lib/commands/terminal.js.map +1 -1
- package/lib/commands/trajectory.js +4 -1
- package/lib/commands/trajectory.js.map +1 -1
- package/lib/definition.d.ts +122 -22
- package/lib/definition.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/input/actions.d.ts +51 -0
- package/lib/input/actions.js +120 -0
- package/lib/input/actions.js.map +1 -0
- package/lib/input/editor.d.ts +0 -10
- package/lib/input/editor.js +11 -9
- package/lib/input/editor.js.map +1 -1
- package/lib/input/image-paste.d.ts +19 -1
- package/lib/input/image-paste.js +82 -1
- package/lib/input/image-paste.js.map +1 -1
- package/lib/input/keybindings-config.d.ts +12 -5
- package/lib/input/keybindings-config.js +30 -57
- package/lib/input/keybindings-config.js.map +1 -1
- package/lib/input/keys.d.ts +16 -0
- package/lib/input/keys.js +38 -3
- package/lib/input/keys.js.map +1 -1
- package/lib/input/wheel-scroll.d.ts +46 -0
- package/lib/input/wheel-scroll.js +69 -0
- package/lib/input/wheel-scroll.js.map +1 -0
- package/lib/prompt-intents.d.ts +182 -0
- package/lib/prompt-intents.js +127 -0
- package/lib/prompt-intents.js.map +1 -0
- package/lib/runtime/cancellable.d.ts +75 -0
- package/lib/runtime/cancellable.js +76 -0
- package/lib/runtime/cancellable.js.map +1 -0
- package/lib/runtime/composer-images.js +5 -4
- package/lib/runtime/composer-images.js.map +1 -1
- package/lib/runtime/composer-shell.d.ts +17 -2
- package/lib/runtime/composer-shell.js +109 -43
- package/lib/runtime/composer-shell.js.map +1 -1
- package/lib/runtime/file-recovery-review.d.ts +0 -1
- package/lib/runtime/file-recovery-review.js +29 -30
- package/lib/runtime/file-recovery-review.js.map +1 -1
- package/lib/runtime/file-recovery-store.js +5 -1
- package/lib/runtime/file-recovery-store.js.map +1 -1
- package/lib/runtime/file-review.js +1 -1
- package/lib/runtime/file-review.js.map +1 -1
- package/lib/runtime/hook-settings.d.ts +2 -2
- package/lib/runtime/plain-tui.d.ts +2 -0
- package/lib/runtime/plain-tui.js +7 -1
- package/lib/runtime/plain-tui.js.map +1 -1
- package/lib/runtime/plugin-settings.d.ts +1 -1
- package/lib/runtime/plugin-settings.js +10 -8
- package/lib/runtime/plugin-settings.js.map +1 -1
- package/lib/runtime/provider-local.d.ts +57 -15
- package/lib/runtime/provider-local.js +1112 -471
- package/lib/runtime/provider-local.js.map +1 -1
- package/lib/runtime/runner.js +5 -11
- package/lib/runtime/runner.js.map +1 -1
- package/lib/runtime/settings-preferences.js +1 -1
- package/lib/runtime/settings-preferences.js.map +1 -1
- package/lib/runtime/startup-notices.js +2 -0
- package/lib/runtime/startup-notices.js.map +1 -1
- package/lib/runtime/terminal-modes.d.ts +47 -0
- package/lib/runtime/terminal-modes.js +86 -0
- package/lib/runtime/terminal-modes.js.map +1 -0
- package/lib/runtime/terminal-notifications.d.ts +3 -5
- package/lib/runtime/terminal-notifications.js +4 -8
- package/lib/runtime/terminal-notifications.js.map +1 -1
- package/lib/runtime/terminal-probe.d.ts +36 -0
- package/lib/runtime/terminal-probe.js +37 -0
- package/lib/runtime/terminal-probe.js.map +1 -0
- package/lib/runtime/terminal-session.d.ts +57 -0
- package/lib/runtime/terminal-session.js +164 -0
- package/lib/runtime/terminal-session.js.map +1 -0
- package/lib/session/interaction-adapter.js +7 -8
- package/lib/session/interaction-adapter.js.map +1 -1
- package/lib/session/message-queue.js +1 -1
- package/lib/session/message-queue.js.map +1 -1
- package/lib/session/package-metadata.d.ts +8 -0
- package/lib/session/package-metadata.js +8 -0
- package/lib/session/package-metadata.js.map +1 -1
- package/lib/session/session-controller.d.ts +10 -11
- package/lib/session/session-controller.js +95 -13
- package/lib/session/session-controller.js.map +1 -1
- package/lib/session/session-tree.d.ts +2 -0
- package/lib/session/session-tree.js +2 -0
- package/lib/session/session-tree.js.map +1 -1
- package/lib/session/tui-settings.d.ts +40 -11
- package/lib/session/tui-settings.js +73 -34
- package/lib/session/tui-settings.js.map +1 -1
- package/lib/views/autocomplete.d.ts +18 -2
- package/lib/views/autocomplete.js +51 -38
- package/lib/views/autocomplete.js.map +1 -1
- package/lib/views/copy-targets.d.ts +12 -13
- package/lib/views/copy-targets.js +16 -46
- package/lib/views/copy-targets.js.map +1 -1
- package/lib/views/document-reader.js +18 -5
- package/lib/views/document-reader.js.map +1 -1
- package/lib/views/event-views.js +42 -6
- package/lib/views/event-views.js.map +1 -1
- package/lib/views/history-search.js +15 -21
- package/lib/views/history-search.js.map +1 -1
- package/lib/views/hotkeys.d.ts +7 -1
- package/lib/views/hotkeys.js +49 -25
- package/lib/views/hotkeys.js.map +1 -1
- package/lib/views/list-navigation.d.ts +62 -0
- package/lib/views/list-navigation.js +73 -0
- package/lib/views/list-navigation.js.map +1 -0
- package/lib/views/list-view.d.ts +99 -0
- package/lib/views/list-view.js +165 -0
- package/lib/views/list-view.js.map +1 -0
- package/lib/views/prompt-selector.d.ts +31 -3
- package/lib/views/prompt-selector.js +249 -125
- package/lib/views/prompt-selector.js.map +1 -1
- package/lib/views/session-files.d.ts +1 -2
- package/lib/views/session-files.js +1 -11
- package/lib/views/session-files.js.map +1 -1
- package/lib/views/settings-list.d.ts +10 -8
- package/lib/views/settings-list.js +116 -283
- package/lib/views/settings-list.js.map +1 -1
- package/lib/views/trajectory-timeline.d.ts +72 -0
- package/lib/views/trajectory-timeline.js +133 -0
- package/lib/views/trajectory-timeline.js.map +1 -0
- package/lib/views/trajectory.d.ts +15 -4
- package/lib/views/trajectory.js +557 -123
- package/lib/views/trajectory.js.map +1 -1
- package/lib/views/transcript-render.d.ts +95 -25
- package/lib/views/transcript-render.js +501 -167
- package/lib/views/transcript-render.js.map +1 -1
- package/lib/views/transcript-search.d.ts +39 -6
- package/lib/views/transcript-search.js +46 -11
- package/lib/views/transcript-search.js.map +1 -1
- package/lib/views/transcript-types.d.ts +63 -5
- package/lib/views/transcript-types.js +23 -11
- package/lib/views/transcript-types.js.map +1 -1
- package/package.json +67 -86
- package/lib/commands/advisor.d.ts +0 -15
- package/lib/commands/advisor.js +0 -200
- package/lib/commands/advisor.js.map +0 -1
- package/lib/commands/loop.d.ts +0 -52
- package/lib/commands/loop.js +0 -307
- package/lib/commands/loop.js.map +0 -1
- package/lib/commands/rate.d.ts +0 -33
- package/lib/commands/rate.js +0 -212
- package/lib/commands/rate.js.map +0 -1
- package/lib/commands/steer.d.ts +0 -5
- package/lib/commands/steer.js +0 -24
- package/lib/commands/steer.js.map +0 -1
- package/lib/commands/worktree.d.ts +0 -5
- package/lib/commands/worktree.js +0 -103
- package/lib/commands/worktree.js.map +0 -1
- package/lib/runtime/terminal-reader.d.ts +0 -11
- package/lib/runtime/terminal-reader.js +0 -87
- package/lib/runtime/terminal-reader.js.map +0 -1
- package/lib/views/agent-hub.d.ts +0 -32
- package/lib/views/agent-hub.js +0 -209
- package/lib/views/agent-hub.js.map +0 -1
- package/lib/views/copy-selector.d.ts +0 -54
- package/lib/views/copy-selector.js +0 -170
- package/lib/views/copy-selector.js.map +0 -1
package/lib/views/hotkeys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hotkeys.js","sourceRoot":"","sources":["../../src/views/hotkeys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"hotkeys.js","sourceRoot":"","sources":["../../src/views/hotkeys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,eAAe,IAAI,kBAAkB,EAAkB,MAAM,gCAAgC,CAAA;AAItG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,O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5B,KAAK,OAAO,CAAC,KAAK,IAAI;QACtB,uBAAuB;QACvB,WAAW;QACX,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;KACxF,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One place that decides what a navigation key means.
|
|
3
|
+
*
|
|
4
|
+
* Eight overlays each carried their own `switch` over `up`, `down`, `tab`,
|
|
5
|
+
* `home`, `end`, `pageUp`, `pageDown`, `enter`, and `escape`. They agreed about
|
|
6
|
+
* the common keys and disagreed silently about the rest — `tab` moved a list in
|
|
7
|
+
* five of them and switched a panel in another, `pageUp` paged a list in four and
|
|
8
|
+
* scrolled a detail pane in one — and nothing in the code said which was
|
|
9
|
+
* intended. A reader learns one overlay's keys and is surprised by the next.
|
|
10
|
+
*
|
|
11
|
+
* This module reads the key and reports the intent. A surface still decides what
|
|
12
|
+
* the intent does, and a surface that means something else by a key handles it
|
|
13
|
+
* first: the sharing removes the duplication, not the deliberate difference.
|
|
14
|
+
*
|
|
15
|
+
* Pure: no state, no terminal.
|
|
16
|
+
* @module @agi-fans/dsh-tui
|
|
17
|
+
*/
|
|
18
|
+
import type { KeyEvent } from '../input/keys.ts';
|
|
19
|
+
/** What a navigation key asks for, independent of the surface that acts on it. */
|
|
20
|
+
export type ListNavigation = {
|
|
21
|
+
kind: 'move';
|
|
22
|
+
delta: -1 | 1;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'edge';
|
|
25
|
+
edge: 'first' | 'last';
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'page';
|
|
28
|
+
direction: -1 | 1;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'confirm';
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'close';
|
|
33
|
+
}
|
|
34
|
+
/** Not a navigation key; the surface decides whether it means anything. */
|
|
35
|
+
| {
|
|
36
|
+
kind: 'none';
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Read one event as navigation.
|
|
40
|
+
*
|
|
41
|
+
* `tab` and `shift+tab` are movement because that is what they do in every list
|
|
42
|
+
* that has no panels to switch — the tab-cycled panel is the exception, and it
|
|
43
|
+
* handles `tab` before asking here. `escape` and `ctrl+c` both close: a reader
|
|
44
|
+
* should not have to know which one this overlay prefers.
|
|
45
|
+
*/
|
|
46
|
+
export declare function listNavigation(event: KeyEvent): ListNavigation;
|
|
47
|
+
/**
|
|
48
|
+
* The next selection for one navigation intent, wrapping at both ends.
|
|
49
|
+
*
|
|
50
|
+
* Wrapping is the shared behaviour because that is what the plain lists do: a
|
|
51
|
+
* filtered list that stops dead at its last row reads as a lost selection. A
|
|
52
|
+
* surface that must clamp passes `{ wrap: false }` and keeps its own bounds.
|
|
53
|
+
*/
|
|
54
|
+
export declare function navigateIndex(navigation: Extract<ListNavigation, {
|
|
55
|
+
kind: 'move' | 'page';
|
|
56
|
+
}>, selected: number, count: number, pageSize: number, options?: {
|
|
57
|
+
wrap?: boolean;
|
|
58
|
+
}): number;
|
|
59
|
+
/** The first or last index for an edge intent. */
|
|
60
|
+
export declare function edgeIndex(navigation: Extract<ListNavigation, {
|
|
61
|
+
kind: 'edge';
|
|
62
|
+
}>, count: number): number;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One place that decides what a navigation key means.
|
|
3
|
+
*
|
|
4
|
+
* Eight overlays each carried their own `switch` over `up`, `down`, `tab`,
|
|
5
|
+
* `home`, `end`, `pageUp`, `pageDown`, `enter`, and `escape`. They agreed about
|
|
6
|
+
* the common keys and disagreed silently about the rest — `tab` moved a list in
|
|
7
|
+
* five of them and switched a panel in another, `pageUp` paged a list in four and
|
|
8
|
+
* scrolled a detail pane in one — and nothing in the code said which was
|
|
9
|
+
* intended. A reader learns one overlay's keys and is surprised by the next.
|
|
10
|
+
*
|
|
11
|
+
* This module reads the key and reports the intent. A surface still decides what
|
|
12
|
+
* the intent does, and a surface that means something else by a key handles it
|
|
13
|
+
* first: the sharing removes the duplication, not the deliberate difference.
|
|
14
|
+
*
|
|
15
|
+
* Pure: no state, no terminal.
|
|
16
|
+
* @module @agi-fans/dsh-tui
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Read one event as navigation.
|
|
20
|
+
*
|
|
21
|
+
* `tab` and `shift+tab` are movement because that is what they do in every list
|
|
22
|
+
* that has no panels to switch — the tab-cycled panel is the exception, and it
|
|
23
|
+
* handles `tab` before asking here. `escape` and `ctrl+c` both close: a reader
|
|
24
|
+
* should not have to know which one this overlay prefers.
|
|
25
|
+
*/
|
|
26
|
+
export function listNavigation(event) {
|
|
27
|
+
if (event.type !== 'key')
|
|
28
|
+
return { kind: 'none' };
|
|
29
|
+
switch (event.id) {
|
|
30
|
+
case 'up':
|
|
31
|
+
case 'shift+tab':
|
|
32
|
+
return { kind: 'move', delta: -1 };
|
|
33
|
+
case 'down':
|
|
34
|
+
case 'tab':
|
|
35
|
+
return { kind: 'move', delta: 1 };
|
|
36
|
+
case 'home':
|
|
37
|
+
return { kind: 'edge', edge: 'first' };
|
|
38
|
+
case 'end':
|
|
39
|
+
return { kind: 'edge', edge: 'last' };
|
|
40
|
+
case 'pageUp':
|
|
41
|
+
return { kind: 'page', direction: -1 };
|
|
42
|
+
case 'pageDown':
|
|
43
|
+
return { kind: 'page', direction: 1 };
|
|
44
|
+
case 'enter':
|
|
45
|
+
return { kind: 'confirm' };
|
|
46
|
+
case 'escape':
|
|
47
|
+
case 'ctrl+c':
|
|
48
|
+
return { kind: 'close' };
|
|
49
|
+
default:
|
|
50
|
+
return { kind: 'none' };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The next selection for one navigation intent, wrapping at both ends.
|
|
55
|
+
*
|
|
56
|
+
* Wrapping is the shared behaviour because that is what the plain lists do: a
|
|
57
|
+
* filtered list that stops dead at its last row reads as a lost selection. A
|
|
58
|
+
* surface that must clamp passes `{ wrap: false }` and keeps its own bounds.
|
|
59
|
+
*/
|
|
60
|
+
export function navigateIndex(navigation, selected, count, pageSize, options = {}) {
|
|
61
|
+
if (count <= 0)
|
|
62
|
+
return selected;
|
|
63
|
+
const step = navigation.kind === 'move' ? navigation.delta : navigation.direction * Math.max(1, pageSize);
|
|
64
|
+
const next = selected + step;
|
|
65
|
+
if (options.wrap === false)
|
|
66
|
+
return Math.max(0, Math.min(next, count - 1));
|
|
67
|
+
return (next % count + count) % count;
|
|
68
|
+
}
|
|
69
|
+
/** The first or last index for an edge intent. */
|
|
70
|
+
export function edgeIndex(navigation, count) {
|
|
71
|
+
return navigation.edge === 'first' ? 0 : Math.max(0, count - 1);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=list-navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-navigation.js","sourceRoot":"","sources":["../../src/views/list-navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IACjD,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;QACjB,KAAK,IAAI,CAAC;QACV,KAAK,WAAW;YACd,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAA;QACpC,KAAK,MAAM,CAAC;QACZ,KAAK,KAAK;YACR,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;QACnC,KAAK,MAAM;YACT,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OA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E,KAAa;IAC5F,OAAO,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;AACjE,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one shape every interactive list in omdsh draws.
|
|
3
|
+
*
|
|
4
|
+
* Each surface once grew its own list renderer — autocomplete, prompt selectors,
|
|
5
|
+
* settings, history search, the plugin browser — and each arrived at a
|
|
6
|
+
* slightly different cursor glyph, column layout, and scroll counter. A reader learns the list idiom once, so it should look the same
|
|
7
|
+
* everywhere: a single-cell selection prefix, an optional primary column held to
|
|
8
|
+
* one width so descriptions line up, a right-aligned value or counter, and the
|
|
9
|
+
* same `(n/total)` footnote when the list is windowed.
|
|
10
|
+
*
|
|
11
|
+
* Pure: no terminal, no state. Callers own selection and filtering.
|
|
12
|
+
* @module @agi-fans/dsh-tui
|
|
13
|
+
*/
|
|
14
|
+
import type { Theme } from '../chrome/theme.ts';
|
|
15
|
+
/** The two cells every row reserves so selection does not shift its text. */
|
|
16
|
+
export declare const LIST_CURSOR_CELLS = 2;
|
|
17
|
+
export interface ListRow {
|
|
18
|
+
/** Primary column: the name the reader is choosing. */
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly description?: string;
|
|
21
|
+
/** Right-aligned value, badge, or state; drawn after the description. */
|
|
22
|
+
readonly value?: string;
|
|
23
|
+
/** Painted dim and not selectable; the caller is expected to skip it. */
|
|
24
|
+
readonly heading?: boolean;
|
|
25
|
+
/** Reserve the cursor cell but draw no cursor, for a row that is disabled. */
|
|
26
|
+
readonly secondary?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Tone of the primary column when the row is not selected.
|
|
29
|
+
*
|
|
30
|
+
* A list that mixes kinds — slash commands among file paths — needs to say so
|
|
31
|
+
* without relying on the reader's eye catching a leading character.
|
|
32
|
+
*/
|
|
33
|
+
readonly tone?: 'accent' | 'muted';
|
|
34
|
+
}
|
|
35
|
+
export interface ListRowOptions {
|
|
36
|
+
readonly selected: boolean;
|
|
37
|
+
/** Glyph in the cursor cell; `❯` by default so every list agrees. */
|
|
38
|
+
readonly cursor?: string;
|
|
39
|
+
/** Tint the description column; off for lists that already carry one. */
|
|
40
|
+
readonly dimDescription?: boolean;
|
|
41
|
+
/** Draw a leading `↑`/`↓` scroll mark in the cursor cell of an edge row. */
|
|
42
|
+
readonly edge?: 'up' | 'down';
|
|
43
|
+
/** Selection was moved with a reorder gesture rather than a plain move. */
|
|
44
|
+
readonly moving?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ListOptions {
|
|
47
|
+
/** Rows to draw, already filtered and in display order. */
|
|
48
|
+
readonly rows: readonly ListRow[];
|
|
49
|
+
readonly selected: number;
|
|
50
|
+
readonly width: number;
|
|
51
|
+
/**
|
|
52
|
+
* How many rows the surface can show. When the list is longer, it is windowed
|
|
53
|
+
* around the selection and a `(n/total)` footnote is appended.
|
|
54
|
+
*/
|
|
55
|
+
readonly maxVisible?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Choose the rows a windowed list shows.
|
|
59
|
+
*
|
|
60
|
+
* Centred on the selection with both ends clamped, so the first and last rows
|
|
61
|
+
* are reachable without the list jumping; there is no wrap-around, because a
|
|
62
|
+
* filtered list that silently returns to its top reads as a lost selection.
|
|
63
|
+
*/
|
|
64
|
+
export declare function listVisibleRange(count: number, selected: number, maxVisible: number): {
|
|
65
|
+
start: number;
|
|
66
|
+
end: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Width of the primary column.
|
|
70
|
+
*
|
|
71
|
+
* Held to one value per list rather than per row: a description column that
|
|
72
|
+
* starts at a different place on every line is the single most common reason a
|
|
73
|
+
* hand-rolled list looks unfinished.
|
|
74
|
+
*/
|
|
75
|
+
export declare function listPrimaryColumnWidth(rows: readonly ListRow[], totalWidth: number): number;
|
|
76
|
+
/** Draw one row at exactly `width` display cells. */
|
|
77
|
+
export declare function renderListRow(row: ListRow, theme: Theme, width: number, options: ListRowOptions): string;
|
|
78
|
+
/** The `(n/total)` line a windowed list prints below itself. */
|
|
79
|
+
export declare function renderListCounter(theme: Theme, selected: number, count: number, width: number): string;
|
|
80
|
+
/**
|
|
81
|
+
* Draw a whole list: the visible window, the scroll marks, and the counter.
|
|
82
|
+
*
|
|
83
|
+
* Every list surface calls this instead of slicing its own window, which is what
|
|
84
|
+
* keeps the counter, the edge marks, and the cursor agreed about where the
|
|
85
|
+
* reader is.
|
|
86
|
+
*/
|
|
87
|
+
export declare function renderList(list: ListOptions, theme: Theme, rowOptions?: Omit<ListRowOptions, 'selected' | 'edge' | 'moving'>): string[];
|
|
88
|
+
/**
|
|
89
|
+
* Draw a row whose primary column is held to a fixed width for the whole list.
|
|
90
|
+
*
|
|
91
|
+
* Settings and status rows put a value hard against the right edge, which needs
|
|
92
|
+
* the full frame width rather than a trailing description column. The layout is
|
|
93
|
+
* additive and exact: cursor cells, the padded primary column, a two-cell gap,
|
|
94
|
+
* the description, then fill, then the right-aligned value — so the row lands on
|
|
95
|
+
* exactly `width` cells whatever the labels measure in.
|
|
96
|
+
*/
|
|
97
|
+
export declare function renderListRowWithValue(row: ListRow, theme: Theme, width: number, primaryWidth: number, options: ListRowOptions): string;
|
|
98
|
+
/** Pad a row to the full width so a background surface paints edge to edge. */
|
|
99
|
+
export declare function padListRow(text: string, width: number): string;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one shape every interactive list in omdsh draws.
|
|
3
|
+
*
|
|
4
|
+
* Each surface once grew its own list renderer — autocomplete, prompt selectors,
|
|
5
|
+
* settings, history search, the plugin browser — and each arrived at a
|
|
6
|
+
* slightly different cursor glyph, column layout, and scroll counter. A reader learns the list idiom once, so it should look the same
|
|
7
|
+
* everywhere: a single-cell selection prefix, an optional primary column held to
|
|
8
|
+
* one width so descriptions line up, a right-aligned value or counter, and the
|
|
9
|
+
* same `(n/total)` footnote when the list is windowed.
|
|
10
|
+
*
|
|
11
|
+
* Pure: no terminal, no state. Callers own selection and filtering.
|
|
12
|
+
* @module @agi-fans/dsh-tui
|
|
13
|
+
*/
|
|
14
|
+
import { padToWidth, truncateToWidth, visibleWidth } from "../chrome/width.js";
|
|
15
|
+
/** The two cells every row reserves so selection does not shift its text. */
|
|
16
|
+
export const LIST_CURSOR_CELLS = 2;
|
|
17
|
+
/** Minimum gap between a primary column and its description. */
|
|
18
|
+
const COLUMN_GAP = 2;
|
|
19
|
+
/** A description narrower than this says too little to be worth a column. */
|
|
20
|
+
const MIN_DESCRIPTION_WIDTH = 12;
|
|
21
|
+
/**
|
|
22
|
+
* Choose the rows a windowed list shows.
|
|
23
|
+
*
|
|
24
|
+
* Centred on the selection with both ends clamped, so the first and last rows
|
|
25
|
+
* are reachable without the list jumping; there is no wrap-around, because a
|
|
26
|
+
* filtered list that silently returns to its top reads as a lost selection.
|
|
27
|
+
*/
|
|
28
|
+
export function listVisibleRange(count, selected, maxVisible) {
|
|
29
|
+
const max = Math.max(1, Math.floor(maxVisible));
|
|
30
|
+
if (count <= max)
|
|
31
|
+
return { start: 0, end: count };
|
|
32
|
+
const index = Math.max(0, Math.min(selected, count - 1));
|
|
33
|
+
const start = Math.max(0, Math.min(index - Math.floor(max / 2), count - max));
|
|
34
|
+
return { start, end: start + max };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Width of the primary column.
|
|
38
|
+
*
|
|
39
|
+
* Held to one value per list rather than per row: a description column that
|
|
40
|
+
* starts at a different place on every line is the single most common reason a
|
|
41
|
+
* hand-rolled list looks unfinished.
|
|
42
|
+
*/
|
|
43
|
+
export function listPrimaryColumnWidth(rows, totalWidth) {
|
|
44
|
+
const widest = rows.reduce((widest, row) => Math.max(widest, visibleWidth(row.label)), 0);
|
|
45
|
+
const room = Math.max(0, totalWidth - LIST_CURSOR_CELLS - COLUMN_GAP);
|
|
46
|
+
// Leave at least a description-sized column before agreeing to align at all.
|
|
47
|
+
const ceiling = Math.max(0, room - MIN_DESCRIPTION_WIDTH);
|
|
48
|
+
return Math.max(0, Math.min(widest, ceiling));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The first cell of a row: an edge mark, the cursor, or blank.
|
|
52
|
+
*
|
|
53
|
+
* An edge mark outranks the cursor because it answers a question the cursor
|
|
54
|
+
* cannot — "is there more above me?" — and it is drawn on whichever row sits at
|
|
55
|
+
* the boundary, selected or not.
|
|
56
|
+
*/
|
|
57
|
+
function listCursorCell(theme, options) {
|
|
58
|
+
if (options.edge !== undefined)
|
|
59
|
+
return theme.fg('dim', (options.edge === 'up' ? '↑' : '↓') + ' ');
|
|
60
|
+
if (!options.selected)
|
|
61
|
+
return ' '.repeat(LIST_CURSOR_CELLS);
|
|
62
|
+
return theme.fg('accent', (options.moving === true ? '↕' : options.cursor ?? '❯') + ' ');
|
|
63
|
+
}
|
|
64
|
+
/** Draw one row at exactly `width` display cells. */
|
|
65
|
+
export function renderListRow(row, theme, width, options) {
|
|
66
|
+
const room = Math.max(1, width);
|
|
67
|
+
if (row.heading === true) {
|
|
68
|
+
return truncateToWidth(' '.repeat(LIST_CURSOR_CELLS) + theme.fg('dim', row.label), room);
|
|
69
|
+
}
|
|
70
|
+
const cursor = listCursorCell(theme, options);
|
|
71
|
+
const label = options.selected
|
|
72
|
+
? theme.bold(theme.fg('accent', row.label))
|
|
73
|
+
: row.tone === 'accent' ? theme.fg('accent', row.label)
|
|
74
|
+
: row.secondary === true ? theme.fg('dim', row.label) : row.label;
|
|
75
|
+
const value = row.value === undefined || row.value === ''
|
|
76
|
+
? ''
|
|
77
|
+
: theme.fg(options.selected ? 'accent' : 'muted', row.value);
|
|
78
|
+
const fixed = LIST_CURSOR_CELLS + visibleWidth(row.value ?? '') + (value === '' ? 0 : 0);
|
|
79
|
+
const descriptionRoom = room - fixed - (row.value === undefined || row.value === '' ? 0 : visibleWidth(row.value));
|
|
80
|
+
const description = row.description === undefined || row.description === '' || descriptionRoom <= MIN_DESCRIPTION_WIDTH
|
|
81
|
+
? ''
|
|
82
|
+
: ' ' + (options.dimDescription === false ? row.description : theme.fg('muted', row.description));
|
|
83
|
+
if (value === '') {
|
|
84
|
+
const body = cursor + label + truncateToWidth(description, Math.max(0, room - fixed - visibleWidth(row.label)));
|
|
85
|
+
return truncateToWidth(row.description === undefined ? body.replace(/\s+$/u, '') : body, room);
|
|
86
|
+
}
|
|
87
|
+
const gap = Math.max(2, descriptionRoom - visibleWidth(description) - visibleWidth(row.label));
|
|
88
|
+
return truncateToWidth(cursor + label + truncateToWidth(description, Math.max(0, descriptionRoom - visibleWidth(row.label))) + ' '.repeat(gap) + value, room);
|
|
89
|
+
}
|
|
90
|
+
/** The `(n/total)` line a windowed list prints below itself. */
|
|
91
|
+
export function renderListCounter(theme, selected, count, width) {
|
|
92
|
+
return truncateToWidth(' '.repeat(LIST_CURSOR_CELLS) + theme.fg('dim', `(${Math.max(0, selected) + 1}/${count})`), Math.max(1, width));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Draw a whole list: the visible window, the scroll marks, and the counter.
|
|
96
|
+
*
|
|
97
|
+
* Every list surface calls this instead of slicing its own window, which is what
|
|
98
|
+
* keeps the counter, the edge marks, and the cursor agreed about where the
|
|
99
|
+
* reader is.
|
|
100
|
+
*/
|
|
101
|
+
export function renderList(list, theme, rowOptions = {}) {
|
|
102
|
+
const { rows, selected, width } = list;
|
|
103
|
+
if (rows.length === 0)
|
|
104
|
+
return [];
|
|
105
|
+
const index = Math.max(0, Math.min(selected, rows.length - 1));
|
|
106
|
+
const maxVisible = list.maxVisible ?? rows.length;
|
|
107
|
+
const { start, end } = listVisibleRange(rows.length, index, maxVisible);
|
|
108
|
+
const lines = [];
|
|
109
|
+
for (let at = start; at < end; at += 1) {
|
|
110
|
+
const row = rows[at];
|
|
111
|
+
if (row === undefined)
|
|
112
|
+
continue;
|
|
113
|
+
const edge = at === start && start > 0 ? 'up' : at === end - 1 && end < rows.length ? 'down' : undefined;
|
|
114
|
+
lines.push(renderListRow(row, theme, width, { ...rowOptions, selected: at === index, ...(edge === undefined ? {} : { edge }) }));
|
|
115
|
+
}
|
|
116
|
+
if (end - start < rows.length)
|
|
117
|
+
lines.push(renderListCounter(theme, index, rows.length, width));
|
|
118
|
+
return lines;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Draw a row whose primary column is held to a fixed width for the whole list.
|
|
122
|
+
*
|
|
123
|
+
* Settings and status rows put a value hard against the right edge, which needs
|
|
124
|
+
* the full frame width rather than a trailing description column. The layout is
|
|
125
|
+
* additive and exact: cursor cells, the padded primary column, a two-cell gap,
|
|
126
|
+
* the description, then fill, then the right-aligned value — so the row lands on
|
|
127
|
+
* exactly `width` cells whatever the labels measure in.
|
|
128
|
+
*/
|
|
129
|
+
export function renderListRowWithValue(row, theme, width, primaryWidth, options) {
|
|
130
|
+
const room = Math.max(1, width);
|
|
131
|
+
const cursor = listCursorCell(theme, options);
|
|
132
|
+
const label = options.selected
|
|
133
|
+
? theme.bold(theme.fg('accent', row.label))
|
|
134
|
+
: row.tone === 'accent' ? theme.fg('accent', row.label)
|
|
135
|
+
: row.secondary === true ? theme.fg('dim', row.label) : row.label;
|
|
136
|
+
const value = row.value === undefined || row.value === '' ? '' : theme.fg(options.selected ? 'accent' : 'muted', row.value);
|
|
137
|
+
const primaryCells = Math.max(primaryWidth, visibleWidth(row.label));
|
|
138
|
+
const primary = label + ' '.repeat(Math.max(0, primaryCells - visibleWidth(row.label)));
|
|
139
|
+
const valueCells = visibleWidth(row.value ?? '');
|
|
140
|
+
const descriptionRoom = room - LIST_CURSOR_CELLS - primaryCells - COLUMN_GAP - valueCells;
|
|
141
|
+
const descriptionText = row.description === undefined || row.description === '' || descriptionRoom <= MIN_DESCRIPTION_WIDTH
|
|
142
|
+
? ''
|
|
143
|
+
: truncateToWidth(row.description, descriptionRoom);
|
|
144
|
+
const description = descriptionText === '' ? '' : COLUMN_GAP_SPACE + (options.dimDescription === false ? descriptionText : theme.fg('muted', descriptionText));
|
|
145
|
+
const body = cursor + primary + description;
|
|
146
|
+
// Only a right-aligned value earns trailing padding. A row that ends in its
|
|
147
|
+
// description stops there, so the line's last cell still belongs to something
|
|
148
|
+
// the reader can see — and two adjacent rows never differ by invisible spaces.
|
|
149
|
+
if (value === '')
|
|
150
|
+
return truncateToWidth(body.trimEnd() === '' ? body : body, room);
|
|
151
|
+
const fill = Math.max(1, room - LIST_CURSOR_CELLS - primaryCells - visibleWidth(description) - valueCells);
|
|
152
|
+
return truncateToWidth(body + ' '.repeat(fill) + value, room);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The two-cell gap between a primary column and its description.
|
|
156
|
+
*
|
|
157
|
+
* One cell reads as a typo and three push the description too far from the name
|
|
158
|
+
* it belongs to, so it is a named constant rather than a scatter of literals.
|
|
159
|
+
*/
|
|
160
|
+
const COLUMN_GAP_SPACE = ' '.repeat(COLUMN_GAP);
|
|
161
|
+
/** Pad a row to the full width so a background surface paints edge to edge. */
|
|
162
|
+
export function padListRow(text, width) {
|
|
163
|
+
return padToWidth(text, Math.max(0, width));
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=list-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-view.js","sourceRoot":"","sources":["../../src/views/list-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE9E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAClC,gEAAgE;AAChE,MAAM,UAAU,GAAG,CAAC,CAAA;AACpB,6EAA6E;AAC7E,MAAM,qBAAqB,GAAG,EAAE,CAAA;AA6ChC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,QAAg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AAC,CAAA;IAC1G,OAAO,eAAe,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAA;AAC/D,CAAC;AAED;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;AAE/C,+EAA+E;AAC/E,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,KAAa;IACpD,OAAO,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;AAC7C,CAAC"}
|
|
@@ -62,13 +62,41 @@ export declare function renderPromptTreePage(state: PromptSelectorState, theme:
|
|
|
62
62
|
export declare function movePromptTree(state: PromptSelectorState, direction: 'left' | 'right', query: string): PromptSelectorState;
|
|
63
63
|
/** Start on a matching node instead of a context-only ancestor. */
|
|
64
64
|
export declare function searchPromptSelection(state: PromptSelectorState, query: string): PromptSelectorState;
|
|
65
|
-
/** Visible option window centered around the selected row. */
|
|
66
65
|
export declare function promptSelectorVisibleRange(count: number, selected: number, maxVisible?: number): {
|
|
67
66
|
start: number;
|
|
68
67
|
end: number;
|
|
69
68
|
};
|
|
70
|
-
/**
|
|
71
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Case-insensitive find over rows the reader can already see.
|
|
71
|
+
*
|
|
72
|
+
* A rendered page has no source model to search, so the rows are the document.
|
|
73
|
+
* Offsets are display cells, not string indexes, so CJK and emoji highlights land
|
|
74
|
+
* on the glyphs the reader pointed at rather than shearing them.
|
|
75
|
+
*/
|
|
76
|
+
export declare function findInRows(rows: readonly string[], query: string): TextMatch[];
|
|
77
|
+
/** One occurrence of a find query in a rendered document row. */
|
|
78
|
+
export interface TextMatch {
|
|
79
|
+
row: number;
|
|
80
|
+
/** First cell of the hit, and how many cells it covers. */
|
|
81
|
+
start: number;
|
|
82
|
+
width: number;
|
|
83
|
+
}
|
|
84
|
+
/** Invert the matched cells of one styled row. */
|
|
85
|
+
export declare function highlightMatches(line: string, spans: readonly {
|
|
86
|
+
start: number;
|
|
87
|
+
width: number;
|
|
88
|
+
}[], theme: Theme): string;
|
|
89
|
+
/** The rows a rendered document shows, shared with the find that searches them. */
|
|
90
|
+
export declare function documentRows(request: TuiPrompt, theme: Theme, width: number): string[];
|
|
91
|
+
/**
|
|
92
|
+
* Does this prompt need the whole screen?
|
|
93
|
+
*
|
|
94
|
+
* Only a tree does. Length is not the question — a long list is still a list, and
|
|
95
|
+
* the card windows its rows, filters by typing, and draws the selected row's
|
|
96
|
+
* preview — so counting rows was the wrong variable. Choosing is a different act
|
|
97
|
+
* from reading, and a choice belongs beside the conversation it interrupted.
|
|
98
|
+
*/
|
|
99
|
+
export declare function promptNeedsPage(request: TuiPrompt): boolean;
|
|
72
100
|
/** Reserve a bordered, padded rectangle; graphics never become display-row content. */
|
|
73
101
|
export declare function renderImagePreviewPage(state: PromptSelectorState, theme: Theme, width: number, height: number, appName: string, protocol?: ImageProtocol, cell?: {
|
|
74
102
|
width: number;
|