@crowgentai/emo-tui 0.0.0-stage → 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/README.md +43 -2
- package/dist/autocomplete.d.ts +38 -0
- package/dist/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete.js +89 -0
- package/dist/autocomplete.js.map +1 -0
- package/dist/components/box.d.ts +20 -0
- package/dist/components/box.d.ts.map +1 -0
- package/dist/components/box.js +56 -0
- package/dist/components/box.js.map +1 -0
- package/dist/components/component.d.ts +10 -0
- package/dist/components/component.d.ts.map +1 -0
- package/dist/components/component.js +2 -0
- package/dist/components/component.js.map +1 -0
- package/dist/components/container.d.ts +15 -0
- package/dist/components/container.d.ts.map +1 -0
- package/dist/components/container.js +44 -0
- package/dist/components/container.js.map +1 -0
- package/dist/components/editor.d.ts +78 -0
- package/dist/components/editor.d.ts.map +1 -0
- package/dist/components/editor.js +436 -0
- package/dist/components/editor.js.map +1 -0
- package/dist/components/input.d.ts +23 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +110 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/loader.d.ts +12 -0
- package/dist/components/loader.d.ts.map +1 -0
- package/dist/components/loader.js +22 -0
- package/dist/components/loader.js.map +1 -0
- package/dist/components/markdown.d.ts +18 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +111 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/select-list.d.ts +32 -0
- package/dist/components/select-list.d.ts.map +1 -0
- package/dist/components/select-list.js +108 -0
- package/dist/components/select-list.js.map +1 -0
- package/dist/components/spacer.d.ts +10 -0
- package/dist/components/spacer.d.ts.map +1 -0
- package/dist/components/spacer.js +15 -0
- package/dist/components/spacer.js.map +1 -0
- package/dist/components/text.d.ts +17 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/text.js +42 -0
- package/dist/components/text.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +41 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +113 -0
- package/dist/keys.js.map +1 -0
- package/dist/renderer.d.ts +30 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +99 -0
- package/dist/renderer.js.map +1 -0
- package/dist/style.d.ts +42 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +304 -0
- package/dist/style.js.map +1 -0
- package/dist/terminal.d.ts +71 -0
- package/dist/terminal.d.ts.map +1 -0
- package/dist/terminal.js +154 -0
- package/dist/terminal.js.map +1 -0
- package/dist/theme.d.ts +23 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +23 -0
- package/dist/theme.js.map +1 -0
- package/dist/tui.d.ts +32 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +63 -0
- package/dist/tui.js.map +1 -0
- package/docs/api.md +114 -0
- package/package.json +47 -4
package/README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @crowgentai/emo-tui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The emo terminal UI library: a small component framework with differential
|
|
4
|
+
rendering. It has no agent, provider or session code and no `bin` entry — it
|
|
5
|
+
is a library. The runnable `emo` command lives in `@crowgentai/emo-cli`, which
|
|
6
|
+
builds its interactive screen out of these components.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @crowgentai/emo-tui
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { Container, Input, ProcessTerminal, Text, Tui } from "@crowgentai/emo-tui";
|
|
14
|
+
|
|
15
|
+
const input = new Input({ prompt: "❯ ", placeholder: "type a task, /exit to quit" });
|
|
16
|
+
const lines = new Text("emo — interactive agent");
|
|
17
|
+
const root = new Container([lines, input]);
|
|
18
|
+
const tui = new Tui({ terminal: new ProcessTerminal(), root, altScreen: true });
|
|
19
|
+
|
|
20
|
+
input.onSubmit = (value) => {
|
|
21
|
+
lines.setText(`${lines.getText()}\n> ${value}`);
|
|
22
|
+
input.setValue("");
|
|
23
|
+
tui.requestRender();
|
|
24
|
+
};
|
|
25
|
+
tui.start();
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## What is inside
|
|
29
|
+
|
|
30
|
+
- `tui.ts` — `Tui`, the owner of the terminal, renderer and root component.
|
|
31
|
+
`start()` / `stop()`, `requestRender()` / `renderNow()`, input forwarding.
|
|
32
|
+
- `terminal.ts` — `Terminal`, `ProcessTerminal` (stdin/stdout, raw mode,
|
|
33
|
+
bracketed paste) and `VirtualTerminal` (in-memory, for tests).
|
|
34
|
+
- `renderer.ts` — `Renderer`, differential rendering. Main-screen mode keeps
|
|
35
|
+
scrollback; alt-screen mode owns the viewport with synchronized output.
|
|
36
|
+
- `components/` — `Text`, `Box`, `Spacer`, `Container`, `Input`, `Editor`,
|
|
37
|
+
`Loader`, `SelectList`, `Markdown` (`renderMarkdown`).
|
|
38
|
+
- `keys.ts` — `Key`, `parseKeys`, `matchesKey`, `isPrintable`.
|
|
39
|
+
- `style.ts` — `styleText`, width math, ANSI-aware truncate/wrap.
|
|
40
|
+
- `theme.ts` — one place for every colour the UI uses.
|
|
41
|
+
- `autocomplete.ts` — `CombinedAutocompleteProvider`, slash commands on `/`
|
|
42
|
+
and file paths on Tab / `@`.
|
|
43
|
+
|
|
44
|
+
See [docs/api.md](docs/api.md) for the full surface.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface AutocompleteItem {
|
|
2
|
+
/** Replacement text inserted into the editor. */
|
|
3
|
+
value: string;
|
|
4
|
+
/** Row shown in the suggestion list. */
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AutocompleteResult {
|
|
9
|
+
/** Replacement text inserted into the editor. */
|
|
10
|
+
items: AutocompleteItem[];
|
|
11
|
+
/** Absolute offset in the editor value where the replacement starts. */
|
|
12
|
+
start: number;
|
|
13
|
+
}
|
|
14
|
+
export interface AutocompleteOptions {
|
|
15
|
+
/** Force completion (Tab) instead of only reacting to a trigger. */
|
|
16
|
+
complete?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface AutocompleteProvider {
|
|
19
|
+
getSuggestions(input: string, cursor: number, options?: AutocompleteOptions): Promise<AutocompleteResult | null>;
|
|
20
|
+
}
|
|
21
|
+
export interface SlashCommand {
|
|
22
|
+
name: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Slash commands while the line starts with `/`, and file paths on Tab (or
|
|
27
|
+
* after `@`). Paths in the suggestion are relative to the editor token, so
|
|
28
|
+
* accepting one never rewrites the rest of the line.
|
|
29
|
+
*/
|
|
30
|
+
export declare class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|
31
|
+
private commands;
|
|
32
|
+
private readonly basePath;
|
|
33
|
+
constructor(commands?: SlashCommand[], basePath?: string);
|
|
34
|
+
setCommands(commands: SlashCommand[]): void;
|
|
35
|
+
getSuggestions(input: string, cursor: number, options?: AutocompleteOptions): Promise<AutocompleteResult | null>;
|
|
36
|
+
private completePath;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=autocomplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../src/autocomplete.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CAClH;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAQD;;;;GAIG;AACH,qBAAa,4BAA6B,YAAW,oBAAoB;IAErE,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADjB,QAAQ,GAAE,YAAY,EAAO,EACpB,QAAQ,GAAE,MAAsB;IAGnD,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI;IAIrC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAyB5G,YAAY;CA6B3B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
function expandHome(target) {
|
|
5
|
+
if (target === "~")
|
|
6
|
+
return os.homedir();
|
|
7
|
+
if (target.startsWith("~/"))
|
|
8
|
+
return path.join(os.homedir(), target.slice(2));
|
|
9
|
+
return target;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Slash commands while the line starts with `/`, and file paths on Tab (or
|
|
13
|
+
* after `@`). Paths in the suggestion are relative to the editor token, so
|
|
14
|
+
* accepting one never rewrites the rest of the line.
|
|
15
|
+
*/
|
|
16
|
+
export class CombinedAutocompleteProvider {
|
|
17
|
+
commands;
|
|
18
|
+
basePath;
|
|
19
|
+
constructor(commands = [], basePath = process.cwd()) {
|
|
20
|
+
this.commands = commands;
|
|
21
|
+
this.basePath = basePath;
|
|
22
|
+
}
|
|
23
|
+
setCommands(commands) {
|
|
24
|
+
this.commands = commands;
|
|
25
|
+
}
|
|
26
|
+
async getSuggestions(input, cursor, options = {}) {
|
|
27
|
+
if (cursor < 0 || cursor > input.length)
|
|
28
|
+
return null;
|
|
29
|
+
if (options.complete === true)
|
|
30
|
+
return this.completePath(input, cursor);
|
|
31
|
+
const before = input.slice(0, cursor);
|
|
32
|
+
const slash = /(?:^|\n)\/([A-Za-z0-9_-]*)$/.exec(before);
|
|
33
|
+
if (slash) {
|
|
34
|
+
const query = slash[1].toLowerCase();
|
|
35
|
+
const start = before.lastIndexOf("/");
|
|
36
|
+
const items = this.commands
|
|
37
|
+
.filter((command) => command.name.toLowerCase().startsWith(query))
|
|
38
|
+
.sort((left, right) => left.name.localeCompare(right.name))
|
|
39
|
+
.map((command) => ({
|
|
40
|
+
value: `/${command.name}`,
|
|
41
|
+
label: `/${command.name}`,
|
|
42
|
+
description: command.description,
|
|
43
|
+
}));
|
|
44
|
+
return items.length > 0 ? { items, start } : null;
|
|
45
|
+
}
|
|
46
|
+
if (!options.complete) {
|
|
47
|
+
const task = /(?:^|\n)@([^\s]*)$/.exec(before);
|
|
48
|
+
if (task)
|
|
49
|
+
return this.completePath(input, cursor, before.lastIndexOf("@"));
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
async completePath(input, cursor, forcedStart) {
|
|
54
|
+
const before = input.slice(0, cursor);
|
|
55
|
+
let start = forcedStart ?? before.search(/[^\s]*$/);
|
|
56
|
+
if (start < 0)
|
|
57
|
+
start = cursor;
|
|
58
|
+
let token = before.slice(start);
|
|
59
|
+
if (forcedStart !== undefined)
|
|
60
|
+
token = token.replace(/^@/, "");
|
|
61
|
+
const slash = token.lastIndexOf("/");
|
|
62
|
+
const directoryPart = slash === -1 ? "" : token.slice(0, slash + 1);
|
|
63
|
+
const prefix = slash === -1 ? token : token.slice(slash + 1);
|
|
64
|
+
const directory = path.resolve(this.basePath, expandHome(directoryPart || "."));
|
|
65
|
+
let entries;
|
|
66
|
+
try {
|
|
67
|
+
entries = await fs.readdir(directory);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const items = [];
|
|
73
|
+
for (const entry of entries.sort()) {
|
|
74
|
+
if (entry.startsWith(".") && !prefix.startsWith("."))
|
|
75
|
+
continue;
|
|
76
|
+
if (!entry.toLowerCase().startsWith(prefix.toLowerCase()))
|
|
77
|
+
continue;
|
|
78
|
+
let suffix = "";
|
|
79
|
+
if (await fs.stat(path.join(directory, entry)).then((stat) => stat.isDirectory()).catch(() => false)) {
|
|
80
|
+
suffix = "/";
|
|
81
|
+
}
|
|
82
|
+
items.push({ value: `${directoryPart}${entry}${suffix}`, label: `${entry}${suffix}` });
|
|
83
|
+
if (items.length >= 50)
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
return items.length > 0 ? { items, start: start + (forcedStart !== undefined ? 1 : 0) } : null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=autocomplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../src/autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AA+B7B,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC;IACxC,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,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AG,KAAK,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;YACvF,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE;gBAAE,MAAM;QAChC,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACjG,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Component } from "./component.js";
|
|
2
|
+
export interface BoxOptions {
|
|
3
|
+
paddingX?: number;
|
|
4
|
+
paddingY?: number;
|
|
5
|
+
border?: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
borderColor?: (text: string) => string;
|
|
8
|
+
}
|
|
9
|
+
/** Pads a group of children and can draw a border around them. */
|
|
10
|
+
export declare class Box implements Component {
|
|
11
|
+
private readonly container;
|
|
12
|
+
private options;
|
|
13
|
+
constructor(options?: BoxOptions, children?: Component[]);
|
|
14
|
+
addChild(child: Component): void;
|
|
15
|
+
removeChild(child: Component): void;
|
|
16
|
+
setTitle(title: string): void;
|
|
17
|
+
render(width: number): string[];
|
|
18
|
+
invalidate(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/components/box.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;AAED,kEAAkE;AAClE,qBAAa,GAAI,YAAW,SAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,OAAO,CAAa;gBAEhB,OAAO,GAAE,UAAe,EAAE,QAAQ,GAAE,SAAS,EAAO;IAKhE,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAIhC,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAInC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IA6B/B,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { padToWidth, truncateToWidth } from "../style.js";
|
|
2
|
+
import { theme } from "../theme.js";
|
|
3
|
+
import { Container } from "./container.js";
|
|
4
|
+
/** Pads a group of children and can draw a border around them. */
|
|
5
|
+
export class Box {
|
|
6
|
+
container = new Container();
|
|
7
|
+
options;
|
|
8
|
+
constructor(options = {}, children = []) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
for (const child of children)
|
|
11
|
+
this.container.addChild(child);
|
|
12
|
+
}
|
|
13
|
+
addChild(child) {
|
|
14
|
+
this.container.addChild(child);
|
|
15
|
+
}
|
|
16
|
+
removeChild(child) {
|
|
17
|
+
this.container.removeChild(child);
|
|
18
|
+
}
|
|
19
|
+
setTitle(title) {
|
|
20
|
+
this.options = { ...this.options, title };
|
|
21
|
+
}
|
|
22
|
+
render(width) {
|
|
23
|
+
const paddingX = Math.max(0, this.options.paddingX ?? 1);
|
|
24
|
+
const paddingY = Math.max(0, this.options.paddingY ?? 0);
|
|
25
|
+
const border = this.options.border ?? false;
|
|
26
|
+
const borderColor = this.options.borderColor ?? theme.border;
|
|
27
|
+
const inset = (border ? 1 : 0) + paddingX;
|
|
28
|
+
const inner = Math.max(0, width - inset * 2);
|
|
29
|
+
const content = this.container.render(inner);
|
|
30
|
+
const body = [];
|
|
31
|
+
const pad = " ".repeat(paddingX);
|
|
32
|
+
for (let index = 0; index < paddingY; index += 1)
|
|
33
|
+
body.push("");
|
|
34
|
+
for (const line of content)
|
|
35
|
+
body.push(`${pad}${line}`);
|
|
36
|
+
for (let index = 0; index < paddingY; index += 1)
|
|
37
|
+
body.push("");
|
|
38
|
+
const padded = body.map((line) => padToWidth(line, inner));
|
|
39
|
+
if (!border)
|
|
40
|
+
return padded;
|
|
41
|
+
const edge = "─".repeat(Math.max(0, width - 2));
|
|
42
|
+
const title = this.options.title ?? "";
|
|
43
|
+
const heading = title
|
|
44
|
+
? `${borderColor("┌")}${borderColor("─")} ${theme.strong(title)} ${borderColor("─".repeat(Math.max(0, width - 3 - title.length - 2)))}${borderColor("┐")}`
|
|
45
|
+
: borderColor(`┌${edge}┐`);
|
|
46
|
+
const lines = [truncateToWidth(heading, width, "")];
|
|
47
|
+
for (const line of padded)
|
|
48
|
+
lines.push(`${borderColor("│")} ${padToWidth(line, inner)} ${borderColor("│")}`);
|
|
49
|
+
lines.push(borderColor(`└${edge}┘`));
|
|
50
|
+
return lines;
|
|
51
|
+
}
|
|
52
|
+
invalidate() {
|
|
53
|
+
this.container.invalidate();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box.js","sourceRoot":"","sources":["../../src/components/box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAU3C,kEAAkE;AAClE,MAAM,OAAO,GAAG;IACG,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;IACrC,OAAO,CAAa;IAE5B,YAAY,UAAsB,E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M,KAAK,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QACpD,KAAK,MAAM,IAAI,IAAI,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Every element of the UI implements this. */
|
|
2
|
+
export interface Component {
|
|
3
|
+
/** Render to lines, each no wider than `width` visible columns. */
|
|
4
|
+
render(width: number): string[];
|
|
5
|
+
/** Handle raw keyboard input while this component has focus. */
|
|
6
|
+
handleInput?(data: string): void;
|
|
7
|
+
/** Drop cached render state so the next render starts from scratch. */
|
|
8
|
+
invalidate(): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/components/component.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,WAAW,SAAS;IACxB,mEAAmE;IACnE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,gEAAgE;IAChE,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,uEAAuE;IACvE,UAAU,IAAI,IAAI,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/components/component.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Component } from "./component.js";
|
|
2
|
+
/** Groups children top to bottom. */
|
|
3
|
+
export declare class Container implements Component {
|
|
4
|
+
private children;
|
|
5
|
+
constructor(children?: Component[]);
|
|
6
|
+
addChild(child: Component): void;
|
|
7
|
+
removeChild(child: Component): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
getChildren(): readonly Component[];
|
|
10
|
+
render(width: number): string[];
|
|
11
|
+
handleInput(data: string): void;
|
|
12
|
+
handlesInput(data: string): boolean;
|
|
13
|
+
invalidate(): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/components/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,qCAAqC;AACrC,qBAAa,SAAU,YAAW,SAAS;IACzC,OAAO,CAAC,QAAQ,CAAmB;gBAEvB,QAAQ,GAAE,SAAS,EAAO;IAItC,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAIhC,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAKnC,KAAK,IAAI,IAAI;IAIb,WAAW,IAAI,SAAS,SAAS,EAAE;IAInC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAM/B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI/B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IASnC,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Groups children top to bottom. */
|
|
2
|
+
export class Container {
|
|
3
|
+
children = [];
|
|
4
|
+
constructor(children = []) {
|
|
5
|
+
this.children = [...children];
|
|
6
|
+
}
|
|
7
|
+
addChild(child) {
|
|
8
|
+
this.children.push(child);
|
|
9
|
+
}
|
|
10
|
+
removeChild(child) {
|
|
11
|
+
const index = this.children.indexOf(child);
|
|
12
|
+
if (index !== -1)
|
|
13
|
+
this.children.splice(index, 1);
|
|
14
|
+
}
|
|
15
|
+
clear() {
|
|
16
|
+
this.children = [];
|
|
17
|
+
}
|
|
18
|
+
getChildren() {
|
|
19
|
+
return this.children;
|
|
20
|
+
}
|
|
21
|
+
render(width) {
|
|
22
|
+
const lines = [];
|
|
23
|
+
for (const child of this.children)
|
|
24
|
+
lines.push(...child.render(width));
|
|
25
|
+
return lines;
|
|
26
|
+
}
|
|
27
|
+
handleInput(data) {
|
|
28
|
+
this.handlesInput(data);
|
|
29
|
+
}
|
|
30
|
+
handlesInput(data) {
|
|
31
|
+
for (const child of this.children) {
|
|
32
|
+
if (!child.handleInput)
|
|
33
|
+
continue;
|
|
34
|
+
child.handleInput(data);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
invalidate() {
|
|
40
|
+
for (const child of this.children)
|
|
41
|
+
child.invalidate();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../src/components/container.ts"],"names":[],"mappings":"AAEA,qCAAqC;AACrC,MAAM,OAAO,SAAS;IACZ,QAAQ,GAAgB,EAAE,CAAC;IAEnC,YAAY,WAAwB,EAAE;QACpC,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ,CAAC,KAAgB;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,WAAW,CAAC,KAAgB;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,WAAW,CAAC,IAAY;QACtB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,WAAW;gBAAE,SAAS;YACjC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;YAAE,KAAK,CAAC,UAAU,EAAE,CAAC;IACxD,CAAC;CACF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { AutocompleteItem, AutocompleteProvider } from "../autocomplete.js";
|
|
2
|
+
import { styleText } from "../style.js";
|
|
3
|
+
import type { Component } from "./component.js";
|
|
4
|
+
export interface EditorOptions {
|
|
5
|
+
/** Prefix on the first line. */
|
|
6
|
+
prompt?: string;
|
|
7
|
+
/** Prefix on every following line; padded to the prompt's width. */
|
|
8
|
+
continuation?: string;
|
|
9
|
+
paddingX?: number;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
maxSuggestions?: number;
|
|
12
|
+
history?: string[];
|
|
13
|
+
/** Draw a horizontal rule above and below the editor. */
|
|
14
|
+
border?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Multi-line editor. Enter submits, Alt+Enter (or Ctrl+J) inserts a newline,
|
|
18
|
+
* Tab completes paths, `/` opens slash-command completion and Up/Down walk
|
|
19
|
+
* the submitted history when no suggestion list is open.
|
|
20
|
+
*/
|
|
21
|
+
export declare class Editor implements Component {
|
|
22
|
+
private lines;
|
|
23
|
+
private row;
|
|
24
|
+
private column;
|
|
25
|
+
private suggestions;
|
|
26
|
+
private suggestionIndex;
|
|
27
|
+
private suggestionStart;
|
|
28
|
+
private provider;
|
|
29
|
+
private history;
|
|
30
|
+
private historyIndex;
|
|
31
|
+
private historyDraft;
|
|
32
|
+
private submitEnabled;
|
|
33
|
+
private readonly prompt;
|
|
34
|
+
private readonly continuation;
|
|
35
|
+
private readonly paddingX;
|
|
36
|
+
private readonly placeholder;
|
|
37
|
+
private readonly maxSuggestions;
|
|
38
|
+
private readonly bordered;
|
|
39
|
+
onSubmit?: (text: string) => void;
|
|
40
|
+
onChange?: (text: string) => void;
|
|
41
|
+
onEscape?: () => void;
|
|
42
|
+
constructor(options?: EditorOptions);
|
|
43
|
+
getValue(): string;
|
|
44
|
+
setValue(text: string): void;
|
|
45
|
+
clear(): void;
|
|
46
|
+
setAutocompleteProvider(provider: AutocompleteProvider | null): void;
|
|
47
|
+
setSubmitEnabled(enabled: boolean): void;
|
|
48
|
+
addHistory(text: string): void;
|
|
49
|
+
getHistory(): readonly string[];
|
|
50
|
+
/** The open suggestion list, for tests and for the app's footer. */
|
|
51
|
+
getSuggestions(): readonly AutocompleteItem[];
|
|
52
|
+
handleInput(data: string): void;
|
|
53
|
+
render(width: number): string[];
|
|
54
|
+
invalidate(): void;
|
|
55
|
+
private renderRow;
|
|
56
|
+
private handleSuggestionKey;
|
|
57
|
+
private acceptSuggestion;
|
|
58
|
+
private handleKey;
|
|
59
|
+
private submit;
|
|
60
|
+
private insert;
|
|
61
|
+
private moveLeft;
|
|
62
|
+
private moveRight;
|
|
63
|
+
private moveWordLeft;
|
|
64
|
+
private moveWordRight;
|
|
65
|
+
private moveUp;
|
|
66
|
+
private moveDown;
|
|
67
|
+
private backspace;
|
|
68
|
+
private deleteForward;
|
|
69
|
+
private deleteWordBackwards;
|
|
70
|
+
private lineStartOffset;
|
|
71
|
+
private getCursorOffset;
|
|
72
|
+
private emitChange;
|
|
73
|
+
private refreshSuggestions;
|
|
74
|
+
private clearSuggestions;
|
|
75
|
+
}
|
|
76
|
+
/** Re-exported for convenience in docs and tests. */
|
|
77
|
+
export { styleText };
|
|
78
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/components/editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAyB,SAAS,EAAiC,MAAM,aAAa,CAAC;AAE9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAAa,MAAO,YAAW,SAAS;IACtC,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,WAAW,CAA0B;IA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