@opentui/core 0.1.56 → 0.1.57
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/3d.js +1 -1
- package/{index-rrt84m8j.js → index-crebvcxc.js} +42 -10
- package/{index-rrt84m8j.js.map → index-crebvcxc.js.map} +3 -3
- package/index.js +240 -89
- package/index.js.map +8 -8
- package/lib/keymapping.d.ts +4 -1
- package/package.json +7 -7
- package/renderables/Input.d.ts +10 -0
- package/renderables/Select.d.ts +10 -0
- package/renderables/TabSelect.d.ts +10 -0
- package/renderables/Textarea.d.ts +5 -1
- package/renderer.d.ts +11 -0
- package/testing.js +1 -1
package/lib/keymapping.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ export interface KeyBinding<Action extends string = string> {
|
|
|
6
6
|
super?: boolean;
|
|
7
7
|
action: Action;
|
|
8
8
|
}
|
|
9
|
+
export type KeyAliasMap = Record<string, string>;
|
|
10
|
+
export declare const defaultKeyAliases: KeyAliasMap;
|
|
11
|
+
export declare function mergeKeyAliases(defaults: KeyAliasMap, custom: KeyAliasMap): KeyAliasMap;
|
|
9
12
|
export declare function mergeKeyBindings<Action extends string>(defaults: KeyBinding<Action>[], custom: KeyBinding<Action>[]): KeyBinding<Action>[];
|
|
10
13
|
export declare function getKeyBindingKey<Action extends string>(binding: KeyBinding<Action>): string;
|
|
11
|
-
export declare function buildKeyBindingsMap<Action extends string>(bindings: KeyBinding<Action>[]): Map<string, Action>;
|
|
14
|
+
export declare function buildKeyBindingsMap<Action extends string>(bindings: KeyBinding<Action>[], aliasMap?: KeyAliasMap): Map<string, Action>;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.57",
|
|
8
8
|
"description": "OpenTUI is a TypeScript library for building terminal user interfaces (TUIs)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"bun-webgpu": "0.1.4",
|
|
57
57
|
"planck": "^1.4.2",
|
|
58
58
|
"three": "0.177.0",
|
|
59
|
-
"@opentui/core-darwin-x64": "0.1.
|
|
60
|
-
"@opentui/core-darwin-arm64": "0.1.
|
|
61
|
-
"@opentui/core-linux-x64": "0.1.
|
|
62
|
-
"@opentui/core-linux-arm64": "0.1.
|
|
63
|
-
"@opentui/core-win32-x64": "0.1.
|
|
64
|
-
"@opentui/core-win32-arm64": "0.1.
|
|
59
|
+
"@opentui/core-darwin-x64": "0.1.57",
|
|
60
|
+
"@opentui/core-darwin-arm64": "0.1.57",
|
|
61
|
+
"@opentui/core-linux-x64": "0.1.57",
|
|
62
|
+
"@opentui/core-linux-arm64": "0.1.57",
|
|
63
|
+
"@opentui/core-win32-x64": "0.1.57",
|
|
64
|
+
"@opentui/core-win32-arm64": "0.1.57"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/renderables/Input.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import type { KeyEvent } from "../lib/KeyHandler";
|
|
|
3
3
|
import { type ColorInput } from "../lib/RGBA";
|
|
4
4
|
import { Renderable, type RenderableOptions } from "../Renderable";
|
|
5
5
|
import type { RenderContext, CursorStyleOptions } from "../types";
|
|
6
|
+
import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "../lib/keymapping";
|
|
7
|
+
export type InputAction = "move-left" | "move-right" | "move-home" | "move-end" | "delete-backward" | "delete-forward" | "submit";
|
|
8
|
+
export type InputKeyBinding = BaseKeyBinding<InputAction>;
|
|
6
9
|
export interface InputRenderableOptions extends RenderableOptions<InputRenderable> {
|
|
7
10
|
backgroundColor?: ColorInput;
|
|
8
11
|
textColor?: ColorInput;
|
|
@@ -14,6 +17,8 @@ export interface InputRenderableOptions extends RenderableOptions<InputRenderabl
|
|
|
14
17
|
cursorStyle?: CursorStyleOptions;
|
|
15
18
|
maxLength?: number;
|
|
16
19
|
value?: string;
|
|
20
|
+
keyBindings?: InputKeyBinding[];
|
|
21
|
+
keyAliasMap?: KeyAliasMap;
|
|
17
22
|
}
|
|
18
23
|
export declare enum InputRenderableEvents {
|
|
19
24
|
INPUT = "input",
|
|
@@ -34,6 +39,9 @@ export declare class InputRenderable extends Renderable {
|
|
|
34
39
|
private _cursorStyle;
|
|
35
40
|
private _maxLength;
|
|
36
41
|
private _lastCommittedValue;
|
|
42
|
+
private _keyBindingsMap;
|
|
43
|
+
private _keyAliasMap;
|
|
44
|
+
private _keyBindings;
|
|
37
45
|
protected _defaultOptions: {
|
|
38
46
|
backgroundColor: string;
|
|
39
47
|
textColor: string;
|
|
@@ -75,4 +83,6 @@ export declare class InputRenderable extends Renderable {
|
|
|
75
83
|
updateFromLayout(): void;
|
|
76
84
|
protected onResize(width: number, height: number): void;
|
|
77
85
|
protected onRemove(): void;
|
|
86
|
+
set keyBindings(bindings: InputKeyBinding[]);
|
|
87
|
+
set keyAliasMap(aliases: KeyAliasMap);
|
|
78
88
|
}
|
package/renderables/Select.d.ts
CHANGED
|
@@ -4,11 +4,14 @@ import type { KeyEvent } from "../lib/KeyHandler";
|
|
|
4
4
|
import { type ColorInput } from "../lib/RGBA";
|
|
5
5
|
import { Renderable, type RenderableOptions } from "../Renderable";
|
|
6
6
|
import type { RenderContext } from "../types";
|
|
7
|
+
import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "../lib/keymapping";
|
|
7
8
|
export interface SelectOption {
|
|
8
9
|
name: string;
|
|
9
10
|
description: string;
|
|
10
11
|
value?: any;
|
|
11
12
|
}
|
|
13
|
+
export type SelectAction = "move-up" | "move-down" | "move-up-fast" | "move-down-fast" | "select-current";
|
|
14
|
+
export type SelectKeyBinding = BaseKeyBinding<SelectAction>;
|
|
12
15
|
export interface SelectRenderableOptions extends RenderableOptions<SelectRenderable> {
|
|
13
16
|
backgroundColor?: ColorInput;
|
|
14
17
|
textColor?: ColorInput;
|
|
@@ -26,6 +29,8 @@ export interface SelectRenderableOptions extends RenderableOptions<SelectRendera
|
|
|
26
29
|
font?: keyof typeof fonts;
|
|
27
30
|
itemSpacing?: number;
|
|
28
31
|
fastScrollStep?: number;
|
|
32
|
+
keyBindings?: SelectKeyBinding[];
|
|
33
|
+
keyAliasMap?: KeyAliasMap;
|
|
29
34
|
}
|
|
30
35
|
export declare enum SelectRenderableEvents {
|
|
31
36
|
SELECTION_CHANGED = "selectionChanged",
|
|
@@ -53,6 +58,9 @@ export declare class SelectRenderable extends Renderable {
|
|
|
53
58
|
private linesPerItem;
|
|
54
59
|
private fontHeight;
|
|
55
60
|
private _fastScrollStep;
|
|
61
|
+
private _keyBindingsMap;
|
|
62
|
+
private _keyAliasMap;
|
|
63
|
+
private _keyBindings;
|
|
56
64
|
protected _defaultOptions: {
|
|
57
65
|
backgroundColor: string;
|
|
58
66
|
textColor: string;
|
|
@@ -101,5 +109,7 @@ export declare class SelectRenderable extends Renderable {
|
|
|
101
109
|
set font(font: keyof typeof fonts);
|
|
102
110
|
set itemSpacing(spacing: number);
|
|
103
111
|
set fastScrollStep(step: number);
|
|
112
|
+
set keyBindings(bindings: SelectKeyBinding[]);
|
|
113
|
+
set keyAliasMap(aliases: KeyAliasMap);
|
|
104
114
|
set selectedIndex(value: number);
|
|
105
115
|
}
|
|
@@ -3,11 +3,14 @@ import { OptimizedBuffer } from "../buffer";
|
|
|
3
3
|
import { type ColorInput } from "../lib/RGBA";
|
|
4
4
|
import type { KeyEvent } from "../lib/KeyHandler";
|
|
5
5
|
import type { RenderContext } from "../types";
|
|
6
|
+
import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "../lib/keymapping";
|
|
6
7
|
export interface TabSelectOption {
|
|
7
8
|
name: string;
|
|
8
9
|
description: string;
|
|
9
10
|
value?: any;
|
|
10
11
|
}
|
|
12
|
+
export type TabSelectAction = "move-left" | "move-right" | "select-current";
|
|
13
|
+
export type TabSelectKeyBinding = BaseKeyBinding<TabSelectAction>;
|
|
11
14
|
export interface TabSelectRenderableOptions extends Omit<RenderableOptions<TabSelectRenderable>, "height"> {
|
|
12
15
|
height?: number;
|
|
13
16
|
options?: TabSelectOption[];
|
|
@@ -23,6 +26,8 @@ export interface TabSelectRenderableOptions extends Omit<RenderableOptions<TabSe
|
|
|
23
26
|
showDescription?: boolean;
|
|
24
27
|
showUnderline?: boolean;
|
|
25
28
|
wrapSelection?: boolean;
|
|
29
|
+
keyBindings?: TabSelectKeyBinding[];
|
|
30
|
+
keyAliasMap?: KeyAliasMap;
|
|
26
31
|
}
|
|
27
32
|
export declare enum TabSelectRenderableEvents {
|
|
28
33
|
SELECTION_CHANGED = "selectionChanged",
|
|
@@ -46,6 +51,9 @@ export declare class TabSelectRenderable extends Renderable {
|
|
|
46
51
|
private _showDescription;
|
|
47
52
|
private _showUnderline;
|
|
48
53
|
private _wrapSelection;
|
|
54
|
+
private _keyBindingsMap;
|
|
55
|
+
private _keyAliasMap;
|
|
56
|
+
private _keyBindings;
|
|
49
57
|
constructor(ctx: RenderContext, options: TabSelectRenderableOptions);
|
|
50
58
|
private calculateDynamicHeight;
|
|
51
59
|
protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
@@ -83,4 +91,6 @@ export declare class TabSelectRenderable extends Renderable {
|
|
|
83
91
|
set wrapSelection(wrap: boolean);
|
|
84
92
|
get tabWidth(): number;
|
|
85
93
|
set tabWidth(tabWidth: number);
|
|
94
|
+
set keyBindings(bindings: TabSelectKeyBinding[]);
|
|
95
|
+
set keyAliasMap(aliases: KeyAliasMap);
|
|
86
96
|
}
|
|
@@ -2,7 +2,7 @@ import { type RenderContext } from "../types";
|
|
|
2
2
|
import { EditBufferRenderable, type EditBufferOptions } from "./EditBufferRenderable";
|
|
3
3
|
import type { KeyEvent, PasteEvent } from "../lib/KeyHandler";
|
|
4
4
|
import { RGBA, type ColorInput } from "../lib/RGBA";
|
|
5
|
-
import { type KeyBinding as BaseKeyBinding } from "../lib/keymapping";
|
|
5
|
+
import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "../lib/keymapping";
|
|
6
6
|
import { type StyledText } from "../lib/styled-text";
|
|
7
7
|
import type { ExtmarksController } from "../lib/extmarks";
|
|
8
8
|
export type TextareaAction = "move-left" | "move-right" | "move-up" | "move-down" | "select-left" | "select-right" | "select-up" | "select-down" | "line-home" | "line-end" | "select-line-home" | "select-line-end" | "buffer-home" | "buffer-end" | "select-buffer-home" | "select-buffer-end" | "delete-line" | "delete-to-line-end" | "delete-to-line-start" | "backspace" | "delete" | "newline" | "undo" | "redo" | "word-forward" | "word-backward" | "select-word-forward" | "select-word-backward" | "delete-word-forward" | "delete-word-backward" | "submit";
|
|
@@ -17,6 +17,7 @@ export interface TextareaOptions extends EditBufferOptions {
|
|
|
17
17
|
focusedTextColor?: ColorInput;
|
|
18
18
|
placeholder?: StyledText | string | null;
|
|
19
19
|
keyBindings?: KeyBinding[];
|
|
20
|
+
keyAliasMap?: KeyAliasMap;
|
|
20
21
|
onSubmit?: (event: SubmitEvent) => void;
|
|
21
22
|
}
|
|
22
23
|
export declare class TextareaRenderable extends EditBufferRenderable {
|
|
@@ -26,6 +27,8 @@ export declare class TextareaRenderable extends EditBufferRenderable {
|
|
|
26
27
|
private _focusedBackgroundColor;
|
|
27
28
|
private _focusedTextColor;
|
|
28
29
|
private _keyBindingsMap;
|
|
30
|
+
private _keyAliasMap;
|
|
31
|
+
private _keyBindings;
|
|
29
32
|
private _actionHandlers;
|
|
30
33
|
private _initialValueSet;
|
|
31
34
|
private _submitListener;
|
|
@@ -95,5 +98,6 @@ export declare class TextareaRenderable extends EditBufferRenderable {
|
|
|
95
98
|
set onSubmit(handler: ((event: SubmitEvent) => void) | undefined);
|
|
96
99
|
get onSubmit(): ((event: SubmitEvent) => void) | undefined;
|
|
97
100
|
set keyBindings(bindings: KeyBinding[]);
|
|
101
|
+
set keyAliasMap(aliases: KeyAliasMap);
|
|
98
102
|
get extmarks(): ExtmarksController;
|
|
99
103
|
}
|
package/renderer.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface CliRendererConfig {
|
|
|
14
14
|
stdin?: NodeJS.ReadStream;
|
|
15
15
|
stdout?: NodeJS.WriteStream;
|
|
16
16
|
exitOnCtrlC?: boolean;
|
|
17
|
+
exitSignals?: NodeJS.Signals[];
|
|
17
18
|
debounceDelay?: number;
|
|
18
19
|
targetFps?: number;
|
|
19
20
|
maxFps?: number;
|
|
@@ -90,6 +91,8 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
90
91
|
stdin: NodeJS.ReadStream;
|
|
91
92
|
private stdout;
|
|
92
93
|
private exitOnCtrlC;
|
|
94
|
+
private exitSignals;
|
|
95
|
+
private _exitListenersAdded;
|
|
93
96
|
private _isDestroyed;
|
|
94
97
|
nextRenderBuffer: OptimizedBuffer;
|
|
95
98
|
currentRenderBuffer: OptimizedBuffer;
|
|
@@ -168,12 +171,16 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
168
171
|
private inputHandlers;
|
|
169
172
|
private prependedInputHandlers;
|
|
170
173
|
private idleResolvers;
|
|
174
|
+
private _debugInputs;
|
|
175
|
+
private _debugModeEnabled;
|
|
171
176
|
private handleError;
|
|
172
177
|
private dumpOutputCache;
|
|
173
178
|
private exitHandler;
|
|
174
179
|
private warningHandler;
|
|
175
180
|
get controlState(): RendererControlState;
|
|
176
181
|
constructor(lib: RenderLib, rendererPtr: Pointer, stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, width: number, height: number, config?: CliRendererConfig);
|
|
182
|
+
private addExitListeners;
|
|
183
|
+
private removeExitListeners;
|
|
177
184
|
get isDestroyed(): boolean;
|
|
178
185
|
registerLifecyclePass(renderable: Renderable): void;
|
|
179
186
|
unregisterLifecyclePass(renderable: Renderable): void;
|
|
@@ -204,6 +211,10 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
204
211
|
get liveRequestCount(): number;
|
|
205
212
|
get currentControlState(): string;
|
|
206
213
|
get capabilities(): any | null;
|
|
214
|
+
getDebugInputs(): Array<{
|
|
215
|
+
timestamp: string;
|
|
216
|
+
sequence: string;
|
|
217
|
+
}>;
|
|
207
218
|
get useKittyKeyboard(): boolean;
|
|
208
219
|
set useKittyKeyboard(use: boolean);
|
|
209
220
|
set experimental_splitHeight(splitHeight: number);
|