@travisennis/acai 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -5
- package/dist/commands/history/types.d.ts +3 -2
- package/dist/commands/history/types.d.ts.map +1 -1
- package/dist/commands/init-project/utils.d.ts +0 -1
- package/dist/commands/init-project/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.js +1 -12
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +6 -19
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +4 -1
- package/dist/commands/session/index.d.ts.map +1 -1
- package/dist/commands/session/index.js +6 -0
- package/dist/commands/session/types.d.ts +1 -0
- package/dist/commands/session/types.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.js +54 -48
- package/dist/commands/tools/index.d.ts +3 -0
- package/dist/commands/tools/index.d.ts.map +1 -0
- package/dist/commands/tools/index.js +191 -0
- package/dist/commands/tools/templates.d.ts +6 -0
- package/dist/commands/tools/templates.d.ts.map +1 -0
- package/dist/commands/tools/templates.js +97 -0
- package/dist/config/index.d.ts +5 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +42 -6
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +98 -68
- package/dist/models/anthropic-provider.d.ts +1 -1
- package/dist/models/deepseek-provider.d.ts +3 -3
- package/dist/models/deepseek-provider.js +17 -17
- package/dist/models/google-provider.d.ts +2 -4
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +2 -17
- package/dist/models/groq-provider.d.ts +2 -4
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +3 -21
- package/dist/models/manager.d.ts +1 -10
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +2 -2
- package/dist/models/opencode-go-provider.d.ts +11 -1
- package/dist/models/opencode-go-provider.d.ts.map +1 -1
- package/dist/models/opencode-go-provider.js +130 -0
- package/dist/models/opencode-zen-provider.d.ts +3 -3
- package/dist/models/opencode-zen-provider.d.ts.map +1 -1
- package/dist/models/opencode-zen-provider.js +26 -32
- package/dist/models/openrouter-provider.d.ts +4 -15
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +26 -169
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/xai-provider.d.ts +1 -2
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -13
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +5 -1
- package/dist/prompts/system-prompt.d.ts +1 -2
- package/dist/prompts/system-prompt.d.ts.map +1 -1
- package/dist/prompts/system-prompt.js +26 -15
- package/dist/repl/index.d.ts +28 -13
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +242 -305
- package/dist/skills/activated-tracker.d.ts +11 -0
- package/dist/skills/activated-tracker.d.ts.map +1 -0
- package/dist/skills/activated-tracker.js +16 -0
- package/dist/skills/index.d.ts +12 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +127 -71
- package/dist/terminal/control.d.ts +1 -21
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +1 -32
- package/dist/terminal/formatting.d.ts +0 -33
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +0 -91
- package/dist/terminal/highlight/theme.d.ts +0 -37
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +1 -79
- package/dist/terminal/keys.d.ts +0 -97
- package/dist/terminal/keys.d.ts.map +1 -1
- package/dist/terminal/keys.js +0 -194
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +65 -51
- package/dist/terminal/style.d.ts +1 -1
- package/dist/terminal/style.d.ts.map +1 -1
- package/dist/terminal/supports-color.d.ts.map +1 -1
- package/dist/terminal/supports-color.js +38 -20
- package/dist/terminal/supports-hyperlinks.d.ts +3 -0
- package/dist/terminal/supports-hyperlinks.d.ts.map +1 -1
- package/dist/terminal/supports-hyperlinks.js +72 -31
- package/dist/terminal/table/layout-manager.d.ts +0 -20
- package/dist/terminal/table/layout-manager.d.ts.map +1 -1
- package/dist/terminal/table/layout-manager.js +68 -44
- package/dist/terminal/table/utils.d.ts +0 -1
- package/dist/terminal/table/utils.d.ts.map +1 -1
- package/dist/terminal/table/utils.js +2 -4
- package/dist/tools/apply-patch.d.ts +5 -3
- package/dist/tools/apply-patch.d.ts.map +1 -1
- package/dist/tools/apply-patch.js +154 -123
- package/dist/tools/bash.d.ts +4 -4
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +27 -13
- package/dist/tools/dynamic-tool-loader.d.ts +17 -3
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +360 -81
- package/dist/tools/edit-file.d.ts +2 -2
- package/dist/tools/index.d.ts +27 -151
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +16 -21
- package/dist/tools/read-file.d.ts +8 -8
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +32 -13
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/skill.d.ts +2 -1
- package/dist/tools/skill.d.ts.map +1 -1
- package/dist/tools/skill.js +64 -14
- package/dist/tools/types.d.ts +8 -2
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/web-fetch.d.ts +8 -12
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +86 -44
- package/dist/tools/web-search.d.ts +4 -8
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +41 -33
- package/dist/tui/autocomplete/utils.d.ts +0 -15
- package/dist/tui/autocomplete/utils.d.ts.map +1 -1
- package/dist/tui/autocomplete/utils.js +0 -85
- package/dist/tui/autocomplete.d.ts +1 -1
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +1 -1
- package/dist/tui/components/editor.d.ts +12 -0
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +181 -195
- package/dist/tui/components/footer.d.ts +0 -2
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +1 -17
- package/dist/tui/components/input.d.ts +4 -0
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +33 -31
- package/dist/tui/components/markdown.d.ts +30 -0
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +274 -242
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +11 -11
- package/dist/tui/components/select-list.d.ts +5 -0
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +69 -98
- package/dist/tui/components/table.d.ts +6 -0
- package/dist/tui/components/table.d.ts.map +1 -1
- package/dist/tui/components/table.js +61 -52
- package/dist/tui/index.d.ts +1 -8
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +0 -8
- package/dist/tui/tui.d.ts +9 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +78 -48
- package/dist/tui/utils.d.ts +7 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +117 -53
- package/dist/utils/bash.d.ts.map +1 -1
- package/dist/utils/bash.js +121 -104
- package/dist/utils/binary-output.d.ts +32 -0
- package/dist/utils/binary-output.d.ts.map +1 -0
- package/dist/utils/binary-output.js +127 -0
- package/dist/utils/command-protection.d.ts +3 -2
- package/dist/utils/command-protection.d.ts.map +1 -1
- package/dist/utils/command-protection.js +121 -29
- package/dist/utils/filesystem/operations.d.ts +0 -15
- package/dist/utils/filesystem/operations.d.ts.map +1 -1
- package/dist/utils/filesystem/operations.js +1 -38
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +22 -15
- package/dist/utils/filetype-detection.d.ts +0 -1
- package/dist/utils/filetype-detection.d.ts.map +1 -1
- package/dist/utils/filetype-detection.js +0 -12
- package/dist/utils/formatting.d.ts +0 -30
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +0 -44
- package/dist/utils/git.d.ts +4 -6
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +36 -46
- package/dist/utils/ignore.d.ts +1 -1
- package/dist/utils/ignore.d.ts.map +1 -1
- package/dist/utils/ignore.js +1 -1
- package/dist/utils/parsing.d.ts +1 -1
- package/dist/utils/parsing.d.ts.map +1 -1
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +77 -79
- package/dist/utils/yaml.d.ts +0 -1
- package/dist/utils/yaml.d.ts.map +1 -1
- package/dist/utils/yaml.js +80 -89
- package/dist/utils/zod.d.ts +0 -3
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +0 -7
- package/package.json +32 -29
- package/dist/agent/sub-agent.d.ts +0 -23
- package/dist/agent/sub-agent.d.ts.map +0 -1
- package/dist/agent/sub-agent.js +0 -109
- package/dist/commands/add-directory/index.d.ts +0 -3
- package/dist/commands/add-directory/index.d.ts.map +0 -1
- package/dist/commands/add-directory/index.js +0 -50
- package/dist/commands/add-directory/utils.d.ts +0 -3
- package/dist/commands/add-directory/utils.d.ts.map +0 -1
- package/dist/commands/add-directory/utils.js +0 -15
- package/dist/commands/clear/index.d.ts +0 -3
- package/dist/commands/clear/index.d.ts.map +0 -1
- package/dist/commands/clear/index.js +0 -13
- package/dist/commands/generate-rules/index.d.ts +0 -3
- package/dist/commands/generate-rules/index.d.ts.map +0 -1
- package/dist/commands/generate-rules/index.js +0 -206
- package/dist/commands/generate-rules/service.d.ts +0 -22
- package/dist/commands/generate-rules/service.d.ts.map +0 -1
- package/dist/commands/generate-rules/service.js +0 -103
- package/dist/commands/generate-rules/utils.d.ts +0 -5
- package/dist/commands/generate-rules/utils.d.ts.map +0 -1
- package/dist/commands/generate-rules/utils.js +0 -25
- package/dist/commands/handoff/index.d.ts +0 -3
- package/dist/commands/handoff/index.d.ts.map +0 -1
- package/dist/commands/handoff/index.js +0 -97
- package/dist/commands/handoff/utils.d.ts +0 -4
- package/dist/commands/handoff/utils.d.ts.map +0 -1
- package/dist/commands/handoff/utils.js +0 -123
- package/dist/commands/list-directories/index.d.ts +0 -3
- package/dist/commands/list-directories/index.d.ts.map +0 -1
- package/dist/commands/list-directories/index.js +0 -35
- package/dist/commands/pickup/index.d.ts +0 -3
- package/dist/commands/pickup/index.d.ts.map +0 -1
- package/dist/commands/pickup/index.js +0 -141
- package/dist/commands/pickup/types.d.ts +0 -6
- package/dist/commands/pickup/types.d.ts.map +0 -1
- package/dist/commands/pickup/types.js +0 -1
- package/dist/commands/pickup/utils.d.ts +0 -7
- package/dist/commands/pickup/utils.d.ts.map +0 -1
- package/dist/commands/pickup/utils.js +0 -56
- package/dist/commands/remove-directory/index.d.ts +0 -3
- package/dist/commands/remove-directory/index.d.ts.map +0 -1
- package/dist/commands/remove-directory/index.js +0 -55
- package/dist/commands/review/index.d.ts +0 -3
- package/dist/commands/review/index.d.ts.map +0 -1
- package/dist/commands/review/index.js +0 -12
- package/dist/commands/review/review-panel.d.ts +0 -3
- package/dist/commands/review/review-panel.d.ts.map +0 -1
- package/dist/commands/review/review-panel.js +0 -186
- package/dist/commands/review/utils.d.ts +0 -18
- package/dist/commands/review/utils.d.ts.map +0 -1
- package/dist/commands/review/utils.js +0 -146
- package/dist/commands/shell/index.d.ts +0 -3
- package/dist/commands/shell/index.d.ts.map +0 -1
- package/dist/commands/shell/index.js +0 -96
- package/dist/modes/manager.d.ts +0 -24
- package/dist/modes/manager.d.ts.map +0 -1
- package/dist/modes/manager.js +0 -77
- package/dist/modes/prompts.d.ts +0 -2
- package/dist/modes/prompts.d.ts.map +0 -1
- package/dist/modes/prompts.js +0 -142
- package/dist/subagents/index.d.ts +0 -16
- package/dist/subagents/index.d.ts.map +0 -1
- package/dist/subagents/index.js +0 -231
- package/dist/terminal/index.d.ts +0 -9
- package/dist/terminal/index.d.ts.map +0 -1
- package/dist/terminal/index.js +0 -8
- package/dist/tools/agent.d.ts +0 -27
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -81
- package/dist/tools/directory-tree.d.ts +0 -28
- package/dist/tools/directory-tree.d.ts.map +0 -1
- package/dist/tools/directory-tree.js +0 -152
- package/dist/tools/glob.d.ts +0 -35
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js +0 -159
- package/dist/tools/grep.d.ts +0 -100
- package/dist/tools/grep.d.ts.map +0 -1
- package/dist/tools/grep.js +0 -601
- package/dist/tools/ls.d.ts +0 -26
- package/dist/tools/ls.d.ts.map +0 -1
- package/dist/tools/ls.js +0 -82
- package/dist/tui/components/header.d.ts +0 -21
- package/dist/tui/components/header.d.ts.map +0 -1
- package/dist/tui/components/header.js +0 -63
- package/dist/utils/bash/parse.d.ts +0 -19
- package/dist/utils/bash/parse.d.ts.map +0 -1
- package/dist/utils/bash/parse.js +0 -223
- package/dist/utils/bash/quote.d.ts +0 -6
- package/dist/utils/bash/quote.d.ts.map +0 -1
- package/dist/utils/bash/quote.js +0 -23
- package/dist/utils/generators.d.ts +0 -3
- package/dist/utils/generators.d.ts.map +0 -1
- package/dist/utils/generators.js +0 -25
- package/dist/utils/glob.d.ts +0 -52
- package/dist/utils/glob.d.ts.map +0 -1
- package/dist/utils/glob.js +0 -376
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import style from "../style.js";
|
|
3
|
-
/**
|
|
4
|
-
* Converts a [[JsonTheme]] with string values to a [[Theme]] with formatter functions. Used by [[parse]].
|
|
5
|
-
*/
|
|
6
|
-
function fromJson(json) {
|
|
7
|
-
const theme = {};
|
|
8
|
-
for (const key of Object.keys(json)) {
|
|
9
|
-
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
|
10
|
-
const styleValue = json[key];
|
|
11
|
-
if (Array.isArray(styleValue)) {
|
|
12
|
-
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
|
13
|
-
theme[key] = styleValue.reduce((previous, current) =>
|
|
14
|
-
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
|
15
|
-
current === "plain" ? id : previous[current], style);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
|
19
|
-
theme[key] = style[styleValue];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return theme;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Converts a [[Theme]] with formatter functions to a [[JsonTheme]] with string values. Used by [[stringify]].
|
|
26
|
-
*/
|
|
27
|
-
function toJson(theme) {
|
|
28
|
-
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
|
29
|
-
const jsonTheme = {};
|
|
30
|
-
for (const key of Object.keys(theme)) {
|
|
31
|
-
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
|
32
|
-
const style = theme[key];
|
|
33
|
-
if (style?._styles) {
|
|
34
|
-
jsonTheme[key] = style._styles;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return jsonTheme;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Stringifies a [[Theme]] with formatter functions to a JSON string.
|
|
41
|
-
*
|
|
42
|
-
* ```ts
|
|
43
|
-
* import style from '../terminal/style.ts';
|
|
44
|
-
* import {stringify} from './highlight/theme.ts';
|
|
45
|
-
* import * as fs from 'node:fs';
|
|
46
|
-
*
|
|
47
|
-
* const myTheme: Theme = {
|
|
48
|
-
* keyword: style.red.bold,
|
|
49
|
-
* addition: style.green,
|
|
50
|
-
* deletion: style.red.strikethrough,
|
|
51
|
-
* number: plain
|
|
52
|
-
* }
|
|
53
|
-
* const json = stringify(myTheme);
|
|
54
|
-
* fs.writeFile('mytheme.json', json, (err: any) => {
|
|
55
|
-
* if (err) throw err;
|
|
56
|
-
* console.log('Theme saved');
|
|
57
|
-
* });
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export function stringify(theme) {
|
|
61
|
-
return JSON.stringify(toJson(theme));
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Parses a JSON string into a [[Theme]] with formatter functions.
|
|
65
|
-
*
|
|
66
|
-
* ```ts
|
|
67
|
-
* import * as fs from 'node:fs';
|
|
68
|
-
* import {parse, highlight} from './highlight/index.ts';
|
|
69
|
-
*
|
|
70
|
-
* fs.readFile('mytheme.json', 'utf-8', (err: any, json: string) => {
|
|
71
|
-
* if (err) throw err;
|
|
72
|
-
* const code = highlight('SELECT * FROM table', {theme: parse(json)});
|
|
73
|
-
* console.log(code);
|
|
74
|
-
* });
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export function parse(json) {
|
|
78
|
-
return fromJson(JSON.parse(json));
|
|
79
|
-
}
|
|
1
|
+
export {};
|
package/dist/terminal/keys.d.ts
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
/** biome-ignore-all lint/suspicious/noControlCharactersInRegex: handle terminal ansii codes */
|
|
2
2
|
/** biome-ignore-all lint/style/useNamingConvention: will fix later */
|
|
3
|
-
/**
|
|
4
|
-
* Check if input matches a Kitty protocol Ctrl+<key> sequence.
|
|
5
|
-
* Ignores lock key bits (Caps Lock, Num Lock).
|
|
6
|
-
* @param data - The input data to check
|
|
7
|
-
* @param key - Single lowercase letter (e.g., 'c' for Ctrl+C)
|
|
8
|
-
*/
|
|
9
|
-
export declare function isKittyCtrl(data: string, key: string): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Check if input matches a Kitty protocol key sequence with specific modifier.
|
|
12
|
-
* Ignores lock key bits (Caps Lock, Num Lock).
|
|
13
|
-
* @param data - The input data to check
|
|
14
|
-
* @param codepoint - ASCII codepoint of the key
|
|
15
|
-
* @param modifier - Modifier value (use MODIFIERS constants)
|
|
16
|
-
*/
|
|
17
|
-
export declare function isKittyKey(data: string, codepoint: number, modifier: number): boolean;
|
|
18
3
|
/**
|
|
19
4
|
* Check if input matches Ctrl+A (raw byte or Kitty protocol).
|
|
20
5
|
* Ignores lock key bits.
|
|
@@ -40,18 +25,6 @@ export declare function isCtrlE(data: string): boolean;
|
|
|
40
25
|
* Ignores lock key bits.
|
|
41
26
|
*/
|
|
42
27
|
export declare function isCtrlG(data: string): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Check if input matches Ctrl+K (raw byte or Kitty protocol).
|
|
45
|
-
* Ignores lock key bits.
|
|
46
|
-
* Also checks if first byte is 0x0b for compatibility with terminals
|
|
47
|
-
* that may send trailing bytes.
|
|
48
|
-
*/
|
|
49
|
-
export declare function isCtrlK(data: string): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Check if input matches Ctrl+L (raw byte or Kitty protocol).
|
|
52
|
-
* Ignores lock key bits.
|
|
53
|
-
*/
|
|
54
|
-
export declare function isCtrlL(data: string): boolean;
|
|
55
28
|
/**
|
|
56
29
|
* Check if input matches Ctrl+M (Kitty protocol only).
|
|
57
30
|
* The raw Ctrl+M byte (\x0d) is identical to Enter/Return,
|
|
@@ -69,56 +42,16 @@ export declare function isCtrlN(data: string): boolean;
|
|
|
69
42
|
* Ignores lock key bits.
|
|
70
43
|
*/
|
|
71
44
|
export declare function isCtrlO(data: string): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Check if input matches Shift+Ctrl+O (Kitty protocol only).
|
|
74
|
-
* Ignores lock key bits.
|
|
75
|
-
*/
|
|
76
|
-
export declare function isShiftCtrlO(data: string): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Check if input matches Ctrl+P (raw byte or Kitty protocol).
|
|
79
|
-
* Ignores lock key bits.
|
|
80
|
-
*/
|
|
81
|
-
export declare function isCtrlP(data: string): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Check if input matches Shift+Ctrl+P (Kitty protocol only).
|
|
84
|
-
* Ignores lock key bits.
|
|
85
|
-
*/
|
|
86
|
-
export declare function isShiftCtrlP(data: string): boolean;
|
|
87
45
|
/**
|
|
88
46
|
* Check if input matches Ctrl+R (raw byte or Kitty protocol).
|
|
89
47
|
* Ignores lock key bits.
|
|
90
48
|
*/
|
|
91
49
|
export declare function isCtrlR(data: string): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Check if input matches Shift+Ctrl+D (Kitty protocol only, for debug).
|
|
94
|
-
* Ignores lock key bits.
|
|
95
|
-
*/
|
|
96
|
-
export declare function isShiftCtrlD(data: string): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Check if input matches Ctrl+T (raw byte or Kitty protocol).
|
|
99
|
-
* Ignores lock key bits.
|
|
100
|
-
*/
|
|
101
|
-
export declare function isCtrlT(data: string): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Check if input matches Ctrl+U (raw byte or Kitty protocol).
|
|
104
|
-
* Ignores lock key bits.
|
|
105
|
-
*/
|
|
106
|
-
export declare function isCtrlU(data: string): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Check if input matches Ctrl+W (raw byte or Kitty protocol).
|
|
109
|
-
* Ignores lock key bits.
|
|
110
|
-
*/
|
|
111
|
-
export declare function isCtrlW(data: string): boolean;
|
|
112
50
|
/**
|
|
113
51
|
* Check if input matches Ctrl+Z (raw byte or Kitty protocol).
|
|
114
52
|
* Ignores lock key bits.
|
|
115
53
|
*/
|
|
116
54
|
export declare function isCtrlZ(data: string): boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Check if input matches Alt+Backspace (legacy or Kitty protocol).
|
|
119
|
-
* Ignores lock key bits.
|
|
120
|
-
*/
|
|
121
|
-
export declare function isAltBackspace(data: string): boolean;
|
|
122
55
|
/**
|
|
123
56
|
* Check if input matches Shift+Tab (legacy or Kitty protocol).
|
|
124
57
|
* Ignores lock key bits.
|
|
@@ -166,36 +99,6 @@ export declare function isEnter(data: string): boolean;
|
|
|
166
99
|
* Handles both legacy (\x7f, \x08) and Kitty protocol.
|
|
167
100
|
*/
|
|
168
101
|
export declare function isBackspace(data: string): boolean;
|
|
169
|
-
/**
|
|
170
|
-
* Check if input matches Shift+Enter.
|
|
171
|
-
* Ignores lock key bits.
|
|
172
|
-
*/
|
|
173
|
-
export declare function isShiftEnter(data: string): boolean;
|
|
174
|
-
/**
|
|
175
|
-
* Check if input matches Alt+Enter.
|
|
176
|
-
* Ignores lock key bits.
|
|
177
|
-
*/
|
|
178
|
-
export declare function isAltEnter(data: string): boolean;
|
|
179
|
-
/**
|
|
180
|
-
* Check if input matches Option/Alt+Left (word navigation).
|
|
181
|
-
* Handles multiple formats including Kitty protocol.
|
|
182
|
-
*/
|
|
183
|
-
export declare function isAltLeft(data: string): boolean;
|
|
184
|
-
/**
|
|
185
|
-
* Check if input matches Option/Alt+Right (word navigation).
|
|
186
|
-
* Handles multiple formats including Kitty protocol.
|
|
187
|
-
*/
|
|
188
|
-
export declare function isAltRight(data: string): boolean;
|
|
189
|
-
/**
|
|
190
|
-
* Check if input matches Ctrl+Left (word navigation).
|
|
191
|
-
* Handles multiple formats including Kitty protocol.
|
|
192
|
-
*/
|
|
193
|
-
export declare function isCtrlLeft(data: string): boolean;
|
|
194
|
-
/**
|
|
195
|
-
* Check if input matches Ctrl+Right (word navigation).
|
|
196
|
-
* Handles multiple formats including Kitty protocol.
|
|
197
|
-
*/
|
|
198
|
-
export declare function isCtrlRight(data: string): boolean;
|
|
199
102
|
/**
|
|
200
103
|
* Check if input matches Home key.
|
|
201
104
|
* Handles legacy formats and Kitty protocol with lock key modifiers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../source/terminal/keys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;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIlD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjD;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3C;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMjD;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO5C;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO3C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAK9C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAK9C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKhD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAOxD"}
|
package/dist/terminal/keys.js
CHANGED
|
@@ -30,16 +30,10 @@ const CODEPOINTS = {
|
|
|
30
30
|
d: 100,
|
|
31
31
|
e: 101,
|
|
32
32
|
g: 103,
|
|
33
|
-
k: 107,
|
|
34
|
-
l: 108,
|
|
35
33
|
m: 109,
|
|
36
34
|
n: 110,
|
|
37
35
|
o: 111,
|
|
38
|
-
p: 112,
|
|
39
36
|
r: 114,
|
|
40
|
-
t: 116,
|
|
41
|
-
u: 117,
|
|
42
|
-
w: 119,
|
|
43
37
|
z: 122,
|
|
44
38
|
// Special keys
|
|
45
39
|
escape: 27,
|
|
@@ -149,56 +143,14 @@ const Keys = {
|
|
|
149
143
|
CTRL_D: kittySequence(CODEPOINTS.d, MODIFIERS.ctrl),
|
|
150
144
|
CTRL_E: kittySequence(CODEPOINTS.e, MODIFIERS.ctrl),
|
|
151
145
|
CTRL_G: kittySequence(CODEPOINTS.g, MODIFIERS.ctrl),
|
|
152
|
-
CTRL_K: kittySequence(CODEPOINTS.k, MODIFIERS.ctrl),
|
|
153
|
-
CTRL_L: kittySequence(CODEPOINTS.l, MODIFIERS.ctrl),
|
|
154
146
|
CTRL_M: kittySequence(CODEPOINTS.m, MODIFIERS.ctrl),
|
|
155
147
|
CTRL_O: kittySequence(CODEPOINTS.o, MODIFIERS.ctrl),
|
|
156
148
|
CTRL_N: kittySequence(CODEPOINTS.n, MODIFIERS.ctrl),
|
|
157
|
-
CTRL_P: kittySequence(CODEPOINTS.p, MODIFIERS.ctrl),
|
|
158
149
|
CTRL_R: kittySequence(CODEPOINTS.r, MODIFIERS.ctrl),
|
|
159
|
-
CTRL_T: kittySequence(CODEPOINTS.t, MODIFIERS.ctrl),
|
|
160
|
-
CTRL_U: kittySequence(CODEPOINTS.u, MODIFIERS.ctrl),
|
|
161
|
-
CTRL_W: kittySequence(CODEPOINTS.w, MODIFIERS.ctrl),
|
|
162
150
|
CTRL_Z: kittySequence(CODEPOINTS.z, MODIFIERS.ctrl),
|
|
163
|
-
// Enter combinations
|
|
164
|
-
SHIFT_ENTER: kittySequence(CODEPOINTS.enter, MODIFIERS.shift),
|
|
165
|
-
ALT_ENTER: kittySequence(CODEPOINTS.enter, MODIFIERS.alt),
|
|
166
|
-
CTRL_ENTER: kittySequence(CODEPOINTS.enter, MODIFIERS.ctrl),
|
|
167
151
|
// Tab combinations
|
|
168
152
|
SHIFT_TAB: kittySequence(CODEPOINTS.tab, MODIFIERS.shift),
|
|
169
|
-
// Backspace combinations
|
|
170
|
-
ALT_BACKSPACE: kittySequence(CODEPOINTS.backspace, MODIFIERS.alt),
|
|
171
153
|
};
|
|
172
|
-
/**
|
|
173
|
-
* Check if input matches a Kitty protocol Ctrl+<key> sequence.
|
|
174
|
-
* Ignores lock key bits (Caps Lock, Num Lock).
|
|
175
|
-
* @param data - The input data to check
|
|
176
|
-
* @param key - Single lowercase letter (e.g., 'c' for Ctrl+C)
|
|
177
|
-
*/
|
|
178
|
-
export function isKittyCtrl(data, key) {
|
|
179
|
-
if (key.length !== 1)
|
|
180
|
-
return false;
|
|
181
|
-
const codepoint = key.charCodeAt(0);
|
|
182
|
-
// Check exact match first (fast path)
|
|
183
|
-
if (data === kittySequence(codepoint, MODIFIERS.ctrl))
|
|
184
|
-
return true;
|
|
185
|
-
// Check with lock bits masked out
|
|
186
|
-
return matchesKittySequence(data, codepoint, MODIFIERS.ctrl);
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Check if input matches a Kitty protocol key sequence with specific modifier.
|
|
190
|
-
* Ignores lock key bits (Caps Lock, Num Lock).
|
|
191
|
-
* @param data - The input data to check
|
|
192
|
-
* @param codepoint - ASCII codepoint of the key
|
|
193
|
-
* @param modifier - Modifier value (use MODIFIERS constants)
|
|
194
|
-
*/
|
|
195
|
-
export function isKittyKey(data, codepoint, modifier) {
|
|
196
|
-
// Check exact match first (fast path)
|
|
197
|
-
if (data === kittySequence(codepoint, modifier))
|
|
198
|
-
return true;
|
|
199
|
-
// Check with lock bits masked out
|
|
200
|
-
return matchesKittySequence(data, codepoint, modifier);
|
|
201
|
-
}
|
|
202
154
|
// Raw control character codes
|
|
203
155
|
const RAW = {
|
|
204
156
|
CTRL_A: "\x01",
|
|
@@ -206,18 +158,10 @@ const RAW = {
|
|
|
206
158
|
CTRL_D: "\x04",
|
|
207
159
|
CTRL_E: "\x05",
|
|
208
160
|
CTRL_G: "\x07",
|
|
209
|
-
CTRL_K: "\x0b",
|
|
210
|
-
CTRL_L: "\x0c",
|
|
211
|
-
CTRL_M: "\x0d",
|
|
212
161
|
CTRL_N: "\x0e",
|
|
213
162
|
CTRL_O: "\x0f",
|
|
214
|
-
CTRL_P: "\x10",
|
|
215
163
|
CTRL_R: "\x12",
|
|
216
|
-
CTRL_T: "\x14",
|
|
217
|
-
CTRL_U: "\x15",
|
|
218
|
-
CTRL_W: "\x17",
|
|
219
164
|
CTRL_Z: "\x1a",
|
|
220
|
-
ALT_BACKSPACE: "\x1b\x7f",
|
|
221
165
|
SHIFT_TAB: "\x1b[Z",
|
|
222
166
|
};
|
|
223
167
|
/**
|
|
@@ -265,27 +209,6 @@ export function isCtrlG(data) {
|
|
|
265
209
|
data === Keys.CTRL_G ||
|
|
266
210
|
matchesKittySequence(data, CODEPOINTS.g, MODIFIERS.ctrl));
|
|
267
211
|
}
|
|
268
|
-
/**
|
|
269
|
-
* Check if input matches Ctrl+K (raw byte or Kitty protocol).
|
|
270
|
-
* Ignores lock key bits.
|
|
271
|
-
* Also checks if first byte is 0x0b for compatibility with terminals
|
|
272
|
-
* that may send trailing bytes.
|
|
273
|
-
*/
|
|
274
|
-
export function isCtrlK(data) {
|
|
275
|
-
return (data === RAW.CTRL_K ||
|
|
276
|
-
(data.length > 0 && data.charCodeAt(0) === 0x0b) || // compatibility with terminals that may send trailing bytes
|
|
277
|
-
data === Keys.CTRL_K ||
|
|
278
|
-
matchesKittySequence(data, CODEPOINTS.k, MODIFIERS.ctrl));
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Check if input matches Ctrl+L (raw byte or Kitty protocol).
|
|
282
|
-
* Ignores lock key bits.
|
|
283
|
-
*/
|
|
284
|
-
export function isCtrlL(data) {
|
|
285
|
-
return (data === RAW.CTRL_L ||
|
|
286
|
-
data === Keys.CTRL_L ||
|
|
287
|
-
matchesKittySequence(data, CODEPOINTS.l, MODIFIERS.ctrl));
|
|
288
|
-
}
|
|
289
212
|
/**
|
|
290
213
|
* Check if input matches Ctrl+M (Kitty protocol only).
|
|
291
214
|
* The raw Ctrl+M byte (\x0d) is identical to Enter/Return,
|
|
@@ -314,29 +237,6 @@ export function isCtrlO(data) {
|
|
|
314
237
|
data === Keys.CTRL_O ||
|
|
315
238
|
matchesKittySequence(data, CODEPOINTS.o, MODIFIERS.ctrl));
|
|
316
239
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Check if input matches Shift+Ctrl+O (Kitty protocol only).
|
|
319
|
-
* Ignores lock key bits.
|
|
320
|
-
*/
|
|
321
|
-
export function isShiftCtrlO(data) {
|
|
322
|
-
return matchesKittySequence(data, CODEPOINTS.o, MODIFIERS.shift + MODIFIERS.ctrl);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Check if input matches Ctrl+P (raw byte or Kitty protocol).
|
|
326
|
-
* Ignores lock key bits.
|
|
327
|
-
*/
|
|
328
|
-
export function isCtrlP(data) {
|
|
329
|
-
return (data === RAW.CTRL_P ||
|
|
330
|
-
data === Keys.CTRL_P ||
|
|
331
|
-
matchesKittySequence(data, CODEPOINTS.p, MODIFIERS.ctrl));
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Check if input matches Shift+Ctrl+P (Kitty protocol only).
|
|
335
|
-
* Ignores lock key bits.
|
|
336
|
-
*/
|
|
337
|
-
export function isShiftCtrlP(data) {
|
|
338
|
-
return matchesKittySequence(data, CODEPOINTS.p, MODIFIERS.shift + MODIFIERS.ctrl);
|
|
339
|
-
}
|
|
340
240
|
/**
|
|
341
241
|
* Check if input matches Ctrl+R (raw byte or Kitty protocol).
|
|
342
242
|
* Ignores lock key bits.
|
|
@@ -346,40 +246,6 @@ export function isCtrlR(data) {
|
|
|
346
246
|
data === Keys.CTRL_R ||
|
|
347
247
|
matchesKittySequence(data, CODEPOINTS.r, MODIFIERS.ctrl));
|
|
348
248
|
}
|
|
349
|
-
/**
|
|
350
|
-
* Check if input matches Shift+Ctrl+D (Kitty protocol only, for debug).
|
|
351
|
-
* Ignores lock key bits.
|
|
352
|
-
*/
|
|
353
|
-
export function isShiftCtrlD(data) {
|
|
354
|
-
return matchesKittySequence(data, CODEPOINTS.d, MODIFIERS.shift + MODIFIERS.ctrl);
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Check if input matches Ctrl+T (raw byte or Kitty protocol).
|
|
358
|
-
* Ignores lock key bits.
|
|
359
|
-
*/
|
|
360
|
-
export function isCtrlT(data) {
|
|
361
|
-
return (data === RAW.CTRL_T ||
|
|
362
|
-
data === Keys.CTRL_T ||
|
|
363
|
-
matchesKittySequence(data, CODEPOINTS.t, MODIFIERS.ctrl));
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Check if input matches Ctrl+U (raw byte or Kitty protocol).
|
|
367
|
-
* Ignores lock key bits.
|
|
368
|
-
*/
|
|
369
|
-
export function isCtrlU(data) {
|
|
370
|
-
return (data === RAW.CTRL_U ||
|
|
371
|
-
data === Keys.CTRL_U ||
|
|
372
|
-
matchesKittySequence(data, CODEPOINTS.u, MODIFIERS.ctrl));
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Check if input matches Ctrl+W (raw byte or Kitty protocol).
|
|
376
|
-
* Ignores lock key bits.
|
|
377
|
-
*/
|
|
378
|
-
export function isCtrlW(data) {
|
|
379
|
-
return (data === RAW.CTRL_W ||
|
|
380
|
-
data === Keys.CTRL_W ||
|
|
381
|
-
matchesKittySequence(data, CODEPOINTS.w, MODIFIERS.ctrl));
|
|
382
|
-
}
|
|
383
249
|
/**
|
|
384
250
|
* Check if input matches Ctrl+Z (raw byte or Kitty protocol).
|
|
385
251
|
* Ignores lock key bits.
|
|
@@ -389,15 +255,6 @@ export function isCtrlZ(data) {
|
|
|
389
255
|
data === Keys.CTRL_Z ||
|
|
390
256
|
matchesKittySequence(data, CODEPOINTS.z, MODIFIERS.ctrl));
|
|
391
257
|
}
|
|
392
|
-
/**
|
|
393
|
-
* Check if input matches Alt+Backspace (legacy or Kitty protocol).
|
|
394
|
-
* Ignores lock key bits.
|
|
395
|
-
*/
|
|
396
|
-
export function isAltBackspace(data) {
|
|
397
|
-
return (data === RAW.ALT_BACKSPACE ||
|
|
398
|
-
data === Keys.ALT_BACKSPACE ||
|
|
399
|
-
matchesKittySequence(data, CODEPOINTS.backspace, MODIFIERS.alt));
|
|
400
|
-
}
|
|
401
258
|
/**
|
|
402
259
|
* Check if input matches Shift+Tab (legacy or Kitty protocol).
|
|
403
260
|
* Ignores lock key bits.
|
|
@@ -477,57 +334,6 @@ export function isBackspace(data) {
|
|
|
477
334
|
data === "\x08" ||
|
|
478
335
|
matchesKittySequence(data, CODEPOINTS.backspace, 0));
|
|
479
336
|
}
|
|
480
|
-
/**
|
|
481
|
-
* Check if input matches Shift+Enter.
|
|
482
|
-
* Ignores lock key bits.
|
|
483
|
-
*/
|
|
484
|
-
export function isShiftEnter(data) {
|
|
485
|
-
return (data === Keys.SHIFT_ENTER ||
|
|
486
|
-
matchesKittySequence(data, CODEPOINTS.enter, MODIFIERS.shift));
|
|
487
|
-
}
|
|
488
|
-
/**
|
|
489
|
-
* Check if input matches Alt+Enter.
|
|
490
|
-
* Ignores lock key bits.
|
|
491
|
-
*/
|
|
492
|
-
export function isAltEnter(data) {
|
|
493
|
-
return (data === Keys.ALT_ENTER ||
|
|
494
|
-
data === "\x1b\r" ||
|
|
495
|
-
matchesKittySequence(data, CODEPOINTS.enter, MODIFIERS.alt));
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* Check if input matches Option/Alt+Left (word navigation).
|
|
499
|
-
* Handles multiple formats including Kitty protocol.
|
|
500
|
-
*/
|
|
501
|
-
export function isAltLeft(data) {
|
|
502
|
-
return (data === "\x1b[1;3D" ||
|
|
503
|
-
data === "\x1bb" ||
|
|
504
|
-
matchesKittySequence(data, ARROW_CODEPOINTS.left, MODIFIERS.alt));
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Check if input matches Option/Alt+Right (word navigation).
|
|
508
|
-
* Handles multiple formats including Kitty protocol.
|
|
509
|
-
*/
|
|
510
|
-
export function isAltRight(data) {
|
|
511
|
-
return (data === "\x1b[1;3C" ||
|
|
512
|
-
data === "\x1bf" ||
|
|
513
|
-
matchesKittySequence(data, ARROW_CODEPOINTS.right, MODIFIERS.alt));
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* Check if input matches Ctrl+Left (word navigation).
|
|
517
|
-
* Handles multiple formats including Kitty protocol.
|
|
518
|
-
*/
|
|
519
|
-
export function isCtrlLeft(data) {
|
|
520
|
-
return (data === "\x1b[1;5D" ||
|
|
521
|
-
matchesKittySequence(data, ARROW_CODEPOINTS.left, MODIFIERS.ctrl));
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Check if input matches Ctrl+Right (word navigation).
|
|
525
|
-
* Handles multiple formats including Kitty protocol.
|
|
526
|
-
*/
|
|
527
|
-
export function isCtrlRight(data) {
|
|
528
|
-
return (data === "\x1b[1;5C" ||
|
|
529
|
-
matchesKittySequence(data, ARROW_CODEPOINTS.right, MODIFIERS.ctrl));
|
|
530
|
-
}
|
|
531
337
|
/**
|
|
532
338
|
* Check if input matches Home key.
|
|
533
339
|
* Handles legacy formats and Kitty protocol with lock key modifiers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/select-prompt.ts"],"names":[],"mappings":";AAEA;;;GAGG;AA2BH,UAAU,YAAY,CAAC,CAAC,GAAG,OAAO;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,KAAK,MAAM,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAQpD,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;CAC5B;AAED,UAAU,aAAa,CAAC,CAAC,GAAG,OAAO;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,CAAC,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a,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAkO/B"}
|
|
@@ -189,60 +189,74 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
189
189
|
signal.addEventListener("abort", abortHandler);
|
|
190
190
|
}
|
|
191
191
|
function onData(key) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
move(1)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
192
|
+
const handlers = [
|
|
193
|
+
{
|
|
194
|
+
test: isCtrlC,
|
|
195
|
+
run: () => {
|
|
196
|
+
cleanup();
|
|
197
|
+
stdout.write("\n");
|
|
198
|
+
const err = new Error("Cancelled");
|
|
199
|
+
err.isCanceled = true;
|
|
200
|
+
reject(err);
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
test: isEnter,
|
|
205
|
+
run: () => {
|
|
206
|
+
cleanup();
|
|
207
|
+
const chosen = filteredChoices[pointer];
|
|
208
|
+
stdout.write("\n");
|
|
209
|
+
resolve(chosen.value);
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
{ test: isArrowUp, run: () => move(-1) },
|
|
213
|
+
{ test: isArrowDown, run: () => move(1) },
|
|
214
|
+
{
|
|
215
|
+
test: isHome,
|
|
216
|
+
run: () => {
|
|
217
|
+
pointer = findFirstEnabledIndex(filteredChoices);
|
|
218
|
+
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
219
|
+
renderToScreen();
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
test: isEnd,
|
|
224
|
+
run: () => {
|
|
225
|
+
pointer = findLastEnabledIndex(filteredChoices);
|
|
226
|
+
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
227
|
+
renderToScreen();
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
test: isBackspace,
|
|
232
|
+
run: () => {
|
|
233
|
+
if (searchBuffer.length === 0)
|
|
234
|
+
return;
|
|
235
|
+
searchBuffer = searchBuffer.slice(0, -1);
|
|
236
|
+
if (searchBuffer.length === 0) {
|
|
237
|
+
clearSearchBuffer();
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
filterChoices(searchBuffer);
|
|
241
|
+
renderToScreen();
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
test: (k) => !!k && k >= " " && k <= "~",
|
|
247
|
+
run: () => {
|
|
248
|
+
searchBuffer += key;
|
|
249
|
+
resetSearchTimer();
|
|
234
250
|
filterChoices(searchBuffer);
|
|
235
251
|
renderToScreen();
|
|
236
|
-
}
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
];
|
|
255
|
+
for (const h of handlers) {
|
|
256
|
+
if (h.test(key)) {
|
|
257
|
+
h.run();
|
|
258
|
+
return;
|
|
237
259
|
}
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
if (key && key >= " " && key <= "~") {
|
|
241
|
-
searchBuffer += key;
|
|
242
|
-
resetSearchTimer();
|
|
243
|
-
filterChoices(searchBuffer);
|
|
244
|
-
renderToScreen();
|
|
245
|
-
return;
|
|
246
260
|
}
|
|
247
261
|
}
|
|
248
262
|
try {
|
package/dist/terminal/style.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../source/terminal/style.ts"],"names":[],"mappings":"AAoCA,UAAU,OAAO;IACf;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../source/terminal/style.ts"],"names":[],"mappings":"AAoCA,UAAU,OAAO;IACf;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,aAAa;IACrB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7B;;;;;;;;;;OAUG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;OAUG;IACH,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,aAAa,CAAC;IAEjE;;;;;;;;;;;;OAYG;IACH,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,CAAC;IAEtC;;;;;;;;;;OAUG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,CAAC;IAE1C;;;;;;;;;;OAUG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,aAAa,CAAC;IAEnE;;;;;;;;;;;;OAYG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,CAAC;IAExC;;;;;;;;;;OAUG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7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;CACjB;
|
|
1
|
+
{"version":3,"file":"supports-color.d.ts","sourceRoot":"","sources":["../../source/terminal/supports-color.ts"],"names":[],"mappings":"AAiCA,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB;AAyKD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3B,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,YAAY,GAAG,KAAK,CAOtB;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAC"}
|