@easbot/tui 0.2.1 → 0.2.3
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/dist/index.cjs +37 -42
- package/dist/index.d.cts +290 -39
- package/dist/index.d.ts +290 -39
- package/dist/index.mjs +37 -42
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -5,38 +5,45 @@ interface AutocompleteItem {
|
|
|
5
5
|
label: string;
|
|
6
6
|
description?: string;
|
|
7
7
|
}
|
|
8
|
+
type Awaitable<T> = T | Promise<T>;
|
|
8
9
|
interface SlashCommand {
|
|
9
10
|
name: string;
|
|
10
11
|
description?: string;
|
|
11
|
-
|
|
12
|
+
argumentHint?: string;
|
|
13
|
+
getArgumentCompletions?(argumentPrefix: string): Awaitable<AutocompleteItem[] | null>;
|
|
14
|
+
}
|
|
15
|
+
interface AutocompleteSuggestions {
|
|
16
|
+
items: AutocompleteItem[];
|
|
17
|
+
prefix: string;
|
|
12
18
|
}
|
|
13
19
|
interface AutocompleteProvider {
|
|
14
|
-
getSuggestions(lines: string[], cursorLine: number, cursorCol: number
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} | null
|
|
20
|
+
getSuggestions(lines: string[], cursorLine: number, cursorCol: number, options: {
|
|
21
|
+
signal: AbortSignal;
|
|
22
|
+
force?: boolean;
|
|
23
|
+
}): Promise<AutocompleteSuggestions | null>;
|
|
18
24
|
applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
|
|
19
25
|
lines: string[];
|
|
20
26
|
cursorLine: number;
|
|
21
27
|
cursorCol: number;
|
|
22
28
|
};
|
|
23
|
-
|
|
29
|
+
shouldTriggerFileCompletion?(lines: string[], cursorLine: number, cursorCol: number): boolean;
|
|
24
30
|
}
|
|
25
31
|
declare class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|
26
32
|
private commands;
|
|
27
33
|
private basePath;
|
|
28
34
|
private fdPath;
|
|
29
|
-
constructor(commands
|
|
30
|
-
getSuggestions(lines: string[], cursorLine: number, cursorCol: number
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} | null
|
|
35
|
+
constructor(commands: (SlashCommand | AutocompleteItem)[] | undefined, basePath: string, fdPath?: string | null);
|
|
36
|
+
getSuggestions(lines: string[], cursorLine: number, cursorCol: number, options: {
|
|
37
|
+
signal: AbortSignal;
|
|
38
|
+
force?: boolean;
|
|
39
|
+
}): Promise<AutocompleteSuggestions | null>;
|
|
34
40
|
applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
|
|
35
41
|
lines: string[];
|
|
36
42
|
cursorLine: number;
|
|
37
43
|
cursorCol: number;
|
|
38
44
|
};
|
|
39
45
|
private extractAtPrefix;
|
|
46
|
+
private extractHashPrefix;
|
|
40
47
|
private extractPathPrefix;
|
|
41
48
|
private expandHomePath;
|
|
42
49
|
private resolveScopedFuzzyQuery;
|
|
@@ -44,10 +51,6 @@ declare class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|
|
44
51
|
private getFileSuggestions;
|
|
45
52
|
private scoreEntry;
|
|
46
53
|
private getFuzzyFileSuggestions;
|
|
47
|
-
getForceFileSuggestions(lines: string[], cursorLine: number, cursorCol: number): {
|
|
48
|
-
items: AutocompleteItem[];
|
|
49
|
-
prefix: string;
|
|
50
|
-
} | null;
|
|
51
54
|
shouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean;
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -66,14 +69,17 @@ interface Terminal {
|
|
|
66
69
|
clearFromCursor(): void;
|
|
67
70
|
clearScreen(): void;
|
|
68
71
|
setTitle(title: string): void;
|
|
72
|
+
setProgress(active: boolean): void;
|
|
69
73
|
}
|
|
70
74
|
declare class ProcessTerminal implements Terminal {
|
|
71
75
|
private wasRaw;
|
|
72
76
|
private inputHandler?;
|
|
73
77
|
private resizeHandler?;
|
|
74
78
|
private _kittyProtocolActive;
|
|
79
|
+
private _modifyOtherKeysActive;
|
|
75
80
|
private stdinBuffer?;
|
|
76
81
|
private stdinDataHandler?;
|
|
82
|
+
private progressInterval?;
|
|
77
83
|
private writeLogPath;
|
|
78
84
|
get kittyProtocolActive(): boolean;
|
|
79
85
|
start(onInput: (data: string) => void, onResize: () => void): void;
|
|
@@ -92,12 +98,13 @@ declare class ProcessTerminal implements Terminal {
|
|
|
92
98
|
clearFromCursor(): void;
|
|
93
99
|
clearScreen(): void;
|
|
94
100
|
setTitle(title: string): void;
|
|
101
|
+
setProgress(active: boolean): void;
|
|
102
|
+
private clearProgressInterval;
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
declare function visibleWidth(str: string): number;
|
|
98
106
|
declare function wrapTextWithAnsi(text: string, width: number): string[];
|
|
99
107
|
declare function truncateToWidth(text: string, maxWidth: number, ellipsis?: string, pad?: boolean): string;
|
|
100
|
-
declare function sliceByColumn(line: string, startCol: number, length: number, strict?: boolean): string;
|
|
101
108
|
|
|
102
109
|
interface Component {
|
|
103
110
|
render(width: number): string[];
|
|
@@ -135,11 +142,15 @@ interface OverlayOptions {
|
|
|
135
142
|
col?: SizeValue;
|
|
136
143
|
margin?: OverlayMargin | number;
|
|
137
144
|
visible?: (termWidth: number, termHeight: number) => boolean;
|
|
145
|
+
nonCapturing?: boolean;
|
|
138
146
|
}
|
|
139
147
|
interface OverlayHandle {
|
|
140
148
|
hide(): void;
|
|
141
149
|
setHidden(hidden: boolean): void;
|
|
142
150
|
isHidden(): boolean;
|
|
151
|
+
focus(): void;
|
|
152
|
+
unfocus(): void;
|
|
153
|
+
isFocused(): boolean;
|
|
143
154
|
}
|
|
144
155
|
declare class Container implements Component {
|
|
145
156
|
children: Component[];
|
|
@@ -153,20 +164,23 @@ declare class TUI extends Container {
|
|
|
153
164
|
terminal: Terminal;
|
|
154
165
|
private previousLines;
|
|
155
166
|
private previousWidth;
|
|
167
|
+
private previousHeight;
|
|
156
168
|
private focusedComponent;
|
|
157
169
|
private inputListeners;
|
|
158
170
|
onDebug?: () => void;
|
|
159
171
|
private renderRequested;
|
|
172
|
+
private renderTimer;
|
|
173
|
+
private lastRenderAt;
|
|
174
|
+
private static readonly MIN_RENDER_INTERVAL_MS;
|
|
160
175
|
private cursorRow;
|
|
161
176
|
private hardwareCursorRow;
|
|
162
|
-
private inputBuffer;
|
|
163
|
-
private cellSizeQueryPending;
|
|
164
177
|
private showHardwareCursor;
|
|
165
178
|
private clearOnShrink;
|
|
166
179
|
private maxLinesRendered;
|
|
167
180
|
private previousViewportTop;
|
|
168
181
|
private fullRedrawCount;
|
|
169
182
|
private stopped;
|
|
183
|
+
private focusOrderCounter;
|
|
170
184
|
private overlayStack;
|
|
171
185
|
constructor(terminal: Terminal, showHardwareCursor?: boolean);
|
|
172
186
|
get fullRedraws(): number;
|
|
@@ -187,8 +201,9 @@ declare class TUI extends Container {
|
|
|
187
201
|
private queryCellSize;
|
|
188
202
|
stop(): void;
|
|
189
203
|
requestRender(force?: boolean): void;
|
|
204
|
+
private scheduleRender;
|
|
190
205
|
private handleInput;
|
|
191
|
-
private
|
|
206
|
+
private consumeCellSizeResponse;
|
|
192
207
|
private resolveOverlayLayout;
|
|
193
208
|
private resolveAnchorRow;
|
|
194
209
|
private resolveAnchorCol;
|
|
@@ -234,19 +249,27 @@ declare class Text implements Component {
|
|
|
234
249
|
render(width: number): string[];
|
|
235
250
|
}
|
|
236
251
|
|
|
252
|
+
interface LoaderIndicatorOptions {
|
|
253
|
+
frames?: string[];
|
|
254
|
+
intervalMs?: number;
|
|
255
|
+
}
|
|
237
256
|
declare class Loader extends Text {
|
|
238
257
|
private spinnerColorFn;
|
|
239
258
|
private messageColorFn;
|
|
240
259
|
private message;
|
|
241
260
|
private frames;
|
|
261
|
+
private intervalMs;
|
|
242
262
|
private currentFrame;
|
|
243
263
|
private intervalId;
|
|
244
264
|
private ui;
|
|
245
|
-
|
|
265
|
+
private renderIndicatorVerbatim;
|
|
266
|
+
constructor(ui: TUI, spinnerColorFn: (str: string) => string, messageColorFn: (str: string) => string, message?: string, indicator?: LoaderIndicatorOptions);
|
|
246
267
|
render(width: number): string[];
|
|
247
268
|
start(): void;
|
|
248
269
|
stop(): void;
|
|
249
270
|
setMessage(message: string): void;
|
|
271
|
+
setIndicator(indicator?: LoaderIndicatorOptions): void;
|
|
272
|
+
private restartAnimation;
|
|
250
273
|
private updateDisplay;
|
|
251
274
|
}
|
|
252
275
|
|
|
@@ -271,21 +294,39 @@ interface SelectListTheme {
|
|
|
271
294
|
scrollInfo: (text: string) => string;
|
|
272
295
|
noMatch: (text: string) => string;
|
|
273
296
|
}
|
|
297
|
+
interface SelectListTruncatePrimaryContext {
|
|
298
|
+
text: string;
|
|
299
|
+
maxWidth: number;
|
|
300
|
+
columnWidth: number;
|
|
301
|
+
item: SelectItem;
|
|
302
|
+
isSelected: boolean;
|
|
303
|
+
}
|
|
304
|
+
interface SelectListLayoutOptions {
|
|
305
|
+
minPrimaryColumnWidth?: number;
|
|
306
|
+
maxPrimaryColumnWidth?: number;
|
|
307
|
+
truncatePrimary?: (context: SelectListTruncatePrimaryContext) => string;
|
|
308
|
+
}
|
|
274
309
|
declare class SelectList implements Component {
|
|
275
310
|
private items;
|
|
276
311
|
private filteredItems;
|
|
277
312
|
private selectedIndex;
|
|
278
313
|
private maxVisible;
|
|
279
314
|
private theme;
|
|
315
|
+
private layout;
|
|
280
316
|
onSelect?: (item: SelectItem) => void;
|
|
281
317
|
onCancel?: () => void;
|
|
282
318
|
onSelectionChange?: (item: SelectItem) => void;
|
|
283
|
-
constructor(items: SelectItem[], maxVisible: number, theme: SelectListTheme);
|
|
319
|
+
constructor(items: SelectItem[], maxVisible: number, theme: SelectListTheme, layout?: SelectListLayoutOptions);
|
|
284
320
|
setFilter(filter: string): void;
|
|
285
321
|
setSelectedIndex(index: number): void;
|
|
286
322
|
invalidate(): void;
|
|
287
323
|
render(width: number): string[];
|
|
288
324
|
handleInput(keyData: string): void;
|
|
325
|
+
private renderItem;
|
|
326
|
+
private getPrimaryColumnWidth;
|
|
327
|
+
private getPrimaryColumnBounds;
|
|
328
|
+
private truncatePrimary;
|
|
329
|
+
private getDisplayValue;
|
|
289
330
|
private notifySelectionChange;
|
|
290
331
|
getSelectedItem(): SelectItem | null;
|
|
291
332
|
}
|
|
@@ -312,6 +353,11 @@ declare class Editor implements Component, Focusable {
|
|
|
312
353
|
private autocompleteState;
|
|
313
354
|
private autocompletePrefix;
|
|
314
355
|
private autocompleteMaxVisible;
|
|
356
|
+
private autocompleteAbort?;
|
|
357
|
+
private autocompleteDebounceTimer?;
|
|
358
|
+
private autocompleteRequestTask;
|
|
359
|
+
private autocompleteStartToken;
|
|
360
|
+
private autocompleteRequestId;
|
|
315
361
|
private pastes;
|
|
316
362
|
private pasteCounter;
|
|
317
363
|
private pasteBuffer;
|
|
@@ -322,11 +368,14 @@ declare class Editor implements Component, Focusable {
|
|
|
322
368
|
private lastAction;
|
|
323
369
|
private jumpMode;
|
|
324
370
|
private preferredVisualCol;
|
|
371
|
+
private snappedFromCursorCol;
|
|
325
372
|
private undoStack;
|
|
326
373
|
onSubmit?: (text: string) => void;
|
|
327
374
|
onChange?: (text: string) => void;
|
|
328
375
|
disableSubmit: boolean;
|
|
329
376
|
constructor(tui: TUI, theme: EditorTheme, options?: EditorOptions);
|
|
377
|
+
private validPasteIds;
|
|
378
|
+
private segment;
|
|
330
379
|
getPaddingX(): number;
|
|
331
380
|
setPaddingX(padding: number): void;
|
|
332
381
|
getAutocompleteMaxVisible(): number;
|
|
@@ -343,6 +392,7 @@ declare class Editor implements Component, Focusable {
|
|
|
343
392
|
handleInput(data: string): void;
|
|
344
393
|
private layoutText;
|
|
345
394
|
getText(): string;
|
|
395
|
+
private expandPasteMarkers;
|
|
346
396
|
getExpandedText(): string;
|
|
347
397
|
getLines(): string[];
|
|
348
398
|
getCursor(): {
|
|
@@ -351,6 +401,7 @@ declare class Editor implements Component, Focusable {
|
|
|
351
401
|
};
|
|
352
402
|
setText(text: string): void;
|
|
353
403
|
insertTextAtCursor(text: string): void;
|
|
404
|
+
private normalizeText;
|
|
354
405
|
private insertTextAtCursorInternal;
|
|
355
406
|
private insertCharacter;
|
|
356
407
|
private handlePaste;
|
|
@@ -369,6 +420,7 @@ declare class Editor implements Component, Focusable {
|
|
|
369
420
|
private deleteWordForward;
|
|
370
421
|
private handleForwardDelete;
|
|
371
422
|
private buildVisualLineMap;
|
|
423
|
+
private findVisualLineAt;
|
|
372
424
|
private findCurrentVisualLine;
|
|
373
425
|
private moveCursor;
|
|
374
426
|
private pageScroll;
|
|
@@ -384,10 +436,20 @@ declare class Editor implements Component, Focusable {
|
|
|
384
436
|
private isSlashMenuAllowed;
|
|
385
437
|
private isAtStartOfMessage;
|
|
386
438
|
private isInSlashCommandContext;
|
|
439
|
+
private getBestAutocompleteMatchIndex;
|
|
440
|
+
private createAutocompleteList;
|
|
387
441
|
private tryTriggerAutocomplete;
|
|
388
442
|
private handleTabCompletion;
|
|
389
443
|
private handleSlashCommandCompletion;
|
|
390
444
|
private forceFileAutocomplete;
|
|
445
|
+
private requestAutocomplete;
|
|
446
|
+
private startAutocompleteRequest;
|
|
447
|
+
private getAutocompleteDebounceMs;
|
|
448
|
+
private runAutocompleteRequest;
|
|
449
|
+
private isAutocompleteRequestCurrent;
|
|
450
|
+
private applyAutocompleteSuggestions;
|
|
451
|
+
private cancelAutocompleteRequest;
|
|
452
|
+
private clearAutocompleteUi;
|
|
391
453
|
private cancelAutocomplete;
|
|
392
454
|
isShowingAutocomplete(): boolean;
|
|
393
455
|
private updateAutocomplete;
|
|
@@ -418,6 +480,7 @@ declare function setCellDimensions(dims: CellDimensions): void;
|
|
|
418
480
|
declare function detectCapabilities(): TerminalCapabilities;
|
|
419
481
|
declare function getCapabilities(): TerminalCapabilities;
|
|
420
482
|
declare function resetCapabilitiesCache(): void;
|
|
483
|
+
declare function setCapabilities(caps: TerminalCapabilities): void;
|
|
421
484
|
declare function allocateImageId(): number;
|
|
422
485
|
declare function encodeKitty(base64Data: string, options?: {
|
|
423
486
|
columns?: number;
|
|
@@ -444,6 +507,7 @@ declare function renderImage(base64Data: string, imageDimensions: ImageDimension
|
|
|
444
507
|
rows: number;
|
|
445
508
|
imageId?: number;
|
|
446
509
|
} | null;
|
|
510
|
+
declare function hyperlink(text: string, url: string): string;
|
|
447
511
|
declare function imageFallback(mimeType: string, dimensions?: ImageDimensions, filename?: string): string;
|
|
448
512
|
|
|
449
513
|
interface ImageTheme {
|
|
@@ -639,10 +703,15 @@ declare function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) =>
|
|
|
639
703
|
declare function setKittyProtocolActive(active: boolean): void;
|
|
640
704
|
declare function isKittyProtocolActive(): boolean;
|
|
641
705
|
type Letter = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
|
|
706
|
+
type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
642
707
|
type SymbolKey = '`' | '-' | '=' | '[' | ']' | '\\' | ';' | "'" | ',' | '.' | '/' | '!' | '@' | '#' | '$' | '%' | '^' | '&' | '*' | '(' | ')' | '_' | '+' | '|' | '~' | '{' | '}' | ':' | '<' | '>' | '?';
|
|
643
708
|
type SpecialKey = 'escape' | 'esc' | 'enter' | 'return' | 'tab' | 'space' | 'backspace' | 'delete' | 'insert' | 'clear' | 'home' | 'end' | 'pageUp' | 'pageDown' | 'up' | 'down' | 'left' | 'right' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12';
|
|
644
|
-
type BaseKey = Letter | SymbolKey | SpecialKey;
|
|
645
|
-
type
|
|
709
|
+
type BaseKey = Letter | Digit | SymbolKey | SpecialKey;
|
|
710
|
+
type ModifierName = 'ctrl' | 'shift' | 'alt' | 'super';
|
|
711
|
+
type ModifiedKeyId<Key extends string, RemainingModifiers extends ModifierName = ModifierName> = {
|
|
712
|
+
[M in RemainingModifiers]: `${M}+${Key}` | `${M}+${ModifiedKeyId<Key, Exclude<RemainingModifiers, M>>}`;
|
|
713
|
+
}[RemainingModifiers];
|
|
714
|
+
type KeyId = BaseKey | ModifiedKeyId<BaseKey>;
|
|
646
715
|
declare const Key: {
|
|
647
716
|
readonly escape: "escape";
|
|
648
717
|
readonly esc: "esc";
|
|
@@ -708,36 +777,216 @@ declare const Key: {
|
|
|
708
777
|
readonly ctrl: <K extends BaseKey>(key: K) => `ctrl+${K}`;
|
|
709
778
|
readonly shift: <K extends BaseKey>(key: K) => `shift+${K}`;
|
|
710
779
|
readonly alt: <K extends BaseKey>(key: K) => `alt+${K}`;
|
|
780
|
+
readonly super: <K extends BaseKey>(key: K) => `super+${K}`;
|
|
711
781
|
readonly ctrlShift: <K extends BaseKey>(key: K) => `ctrl+shift+${K}`;
|
|
712
782
|
readonly shiftCtrl: <K extends BaseKey>(key: K) => `shift+ctrl+${K}`;
|
|
713
783
|
readonly ctrlAlt: <K extends BaseKey>(key: K) => `ctrl+alt+${K}`;
|
|
714
784
|
readonly altCtrl: <K extends BaseKey>(key: K) => `alt+ctrl+${K}`;
|
|
715
785
|
readonly shiftAlt: <K extends BaseKey>(key: K) => `shift+alt+${K}`;
|
|
716
786
|
readonly altShift: <K extends BaseKey>(key: K) => `alt+shift+${K}`;
|
|
787
|
+
readonly ctrlSuper: <K extends BaseKey>(key: K) => `ctrl+super+${K}`;
|
|
788
|
+
readonly superCtrl: <K extends BaseKey>(key: K) => `super+ctrl+${K}`;
|
|
789
|
+
readonly shiftSuper: <K extends BaseKey>(key: K) => `shift+super+${K}`;
|
|
790
|
+
readonly superShift: <K extends BaseKey>(key: K) => `super+shift+${K}`;
|
|
791
|
+
readonly altSuper: <K extends BaseKey>(key: K) => `alt+super+${K}`;
|
|
792
|
+
readonly superAlt: <K extends BaseKey>(key: K) => `super+alt+${K}`;
|
|
717
793
|
readonly ctrlShiftAlt: <K extends BaseKey>(key: K) => `ctrl+shift+alt+${K}`;
|
|
794
|
+
readonly ctrlShiftSuper: <K extends BaseKey>(key: K) => `ctrl+shift+super+${K}`;
|
|
718
795
|
};
|
|
719
796
|
type KeyEventType = 'press' | 'repeat' | 'release';
|
|
720
797
|
declare function isKeyRelease(data: string): boolean;
|
|
721
798
|
declare function isKeyRepeat(data: string): boolean;
|
|
722
799
|
declare function matchesKey(data: string, keyId: KeyId): boolean;
|
|
723
800
|
declare function parseKey(data: string): string | undefined;
|
|
801
|
+
declare function decodeKittyPrintable(data: string): string | undefined;
|
|
724
802
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
803
|
+
interface Keybindings {
|
|
804
|
+
'tui.editor.cursorUp': true;
|
|
805
|
+
'tui.editor.cursorDown': true;
|
|
806
|
+
'tui.editor.cursorLeft': true;
|
|
807
|
+
'tui.editor.cursorRight': true;
|
|
808
|
+
'tui.editor.cursorWordLeft': true;
|
|
809
|
+
'tui.editor.cursorWordRight': true;
|
|
810
|
+
'tui.editor.cursorLineStart': true;
|
|
811
|
+
'tui.editor.cursorLineEnd': true;
|
|
812
|
+
'tui.editor.jumpForward': true;
|
|
813
|
+
'tui.editor.jumpBackward': true;
|
|
814
|
+
'tui.editor.pageUp': true;
|
|
815
|
+
'tui.editor.pageDown': true;
|
|
816
|
+
'tui.editor.deleteCharBackward': true;
|
|
817
|
+
'tui.editor.deleteCharForward': true;
|
|
818
|
+
'tui.editor.deleteWordBackward': true;
|
|
819
|
+
'tui.editor.deleteWordForward': true;
|
|
820
|
+
'tui.editor.deleteToLineStart': true;
|
|
821
|
+
'tui.editor.deleteToLineEnd': true;
|
|
822
|
+
'tui.editor.yank': true;
|
|
823
|
+
'tui.editor.yankPop': true;
|
|
824
|
+
'tui.editor.undo': true;
|
|
825
|
+
'tui.input.newLine': true;
|
|
826
|
+
'tui.input.submit': true;
|
|
827
|
+
'tui.input.tab': true;
|
|
828
|
+
'tui.input.copy': true;
|
|
829
|
+
'tui.select.up': true;
|
|
830
|
+
'tui.select.down': true;
|
|
831
|
+
'tui.select.pageUp': true;
|
|
832
|
+
'tui.select.pageDown': true;
|
|
833
|
+
'tui.select.confirm': true;
|
|
834
|
+
'tui.select.cancel': true;
|
|
835
|
+
}
|
|
836
|
+
type Keybinding = keyof Keybindings;
|
|
837
|
+
interface KeybindingDefinition {
|
|
838
|
+
defaultKeys: KeyId | KeyId[];
|
|
839
|
+
description?: string;
|
|
840
|
+
}
|
|
841
|
+
type KeybindingDefinitions = Record<string, KeybindingDefinition>;
|
|
842
|
+
type KeybindingsConfig = Record<string, KeyId | KeyId[] | undefined>;
|
|
843
|
+
declare const TUI_KEYBINDINGS: {
|
|
844
|
+
readonly 'tui.editor.cursorUp': {
|
|
845
|
+
readonly defaultKeys: "up";
|
|
846
|
+
readonly description: "Move cursor up";
|
|
847
|
+
};
|
|
848
|
+
readonly 'tui.editor.cursorDown': {
|
|
849
|
+
readonly defaultKeys: "down";
|
|
850
|
+
readonly description: "Move cursor down";
|
|
851
|
+
};
|
|
852
|
+
readonly 'tui.editor.cursorLeft': {
|
|
853
|
+
readonly defaultKeys: ["left", "ctrl+b"];
|
|
854
|
+
readonly description: "Move cursor left";
|
|
855
|
+
};
|
|
856
|
+
readonly 'tui.editor.cursorRight': {
|
|
857
|
+
readonly defaultKeys: ["right", "ctrl+f"];
|
|
858
|
+
readonly description: "Move cursor right";
|
|
859
|
+
};
|
|
860
|
+
readonly 'tui.editor.cursorWordLeft': {
|
|
861
|
+
readonly defaultKeys: ["alt+left", "ctrl+left", "alt+b"];
|
|
862
|
+
readonly description: "Move cursor word left";
|
|
863
|
+
};
|
|
864
|
+
readonly 'tui.editor.cursorWordRight': {
|
|
865
|
+
readonly defaultKeys: ["alt+right", "ctrl+right", "alt+f"];
|
|
866
|
+
readonly description: "Move cursor word right";
|
|
867
|
+
};
|
|
868
|
+
readonly 'tui.editor.cursorLineStart': {
|
|
869
|
+
readonly defaultKeys: ["home", "ctrl+a"];
|
|
870
|
+
readonly description: "Move to line start";
|
|
871
|
+
};
|
|
872
|
+
readonly 'tui.editor.cursorLineEnd': {
|
|
873
|
+
readonly defaultKeys: ["end", "ctrl+e"];
|
|
874
|
+
readonly description: "Move to line end";
|
|
875
|
+
};
|
|
876
|
+
readonly 'tui.editor.jumpForward': {
|
|
877
|
+
readonly defaultKeys: "ctrl+]";
|
|
878
|
+
readonly description: "Jump forward to character";
|
|
879
|
+
};
|
|
880
|
+
readonly 'tui.editor.jumpBackward': {
|
|
881
|
+
readonly defaultKeys: "ctrl+alt+]";
|
|
882
|
+
readonly description: "Jump backward to character";
|
|
883
|
+
};
|
|
884
|
+
readonly 'tui.editor.pageUp': {
|
|
885
|
+
readonly defaultKeys: "pageUp";
|
|
886
|
+
readonly description: "Page up";
|
|
887
|
+
};
|
|
888
|
+
readonly 'tui.editor.pageDown': {
|
|
889
|
+
readonly defaultKeys: "pageDown";
|
|
890
|
+
readonly description: "Page down";
|
|
891
|
+
};
|
|
892
|
+
readonly 'tui.editor.deleteCharBackward': {
|
|
893
|
+
readonly defaultKeys: "backspace";
|
|
894
|
+
readonly description: "Delete character backward";
|
|
895
|
+
};
|
|
896
|
+
readonly 'tui.editor.deleteCharForward': {
|
|
897
|
+
readonly defaultKeys: ["delete", "ctrl+d"];
|
|
898
|
+
readonly description: "Delete character forward";
|
|
899
|
+
};
|
|
900
|
+
readonly 'tui.editor.deleteWordBackward': {
|
|
901
|
+
readonly defaultKeys: ["ctrl+w", "alt+backspace"];
|
|
902
|
+
readonly description: "Delete word backward";
|
|
903
|
+
};
|
|
904
|
+
readonly 'tui.editor.deleteWordForward': {
|
|
905
|
+
readonly defaultKeys: ["alt+d", "alt+delete"];
|
|
906
|
+
readonly description: "Delete word forward";
|
|
907
|
+
};
|
|
908
|
+
readonly 'tui.editor.deleteToLineStart': {
|
|
909
|
+
readonly defaultKeys: "ctrl+u";
|
|
910
|
+
readonly description: "Delete to line start";
|
|
911
|
+
};
|
|
912
|
+
readonly 'tui.editor.deleteToLineEnd': {
|
|
913
|
+
readonly defaultKeys: "ctrl+k";
|
|
914
|
+
readonly description: "Delete to line end";
|
|
915
|
+
};
|
|
916
|
+
readonly 'tui.editor.yank': {
|
|
917
|
+
readonly defaultKeys: "ctrl+y";
|
|
918
|
+
readonly description: "Yank";
|
|
919
|
+
};
|
|
920
|
+
readonly 'tui.editor.yankPop': {
|
|
921
|
+
readonly defaultKeys: "alt+y";
|
|
922
|
+
readonly description: "Yank pop";
|
|
923
|
+
};
|
|
924
|
+
readonly 'tui.editor.undo': {
|
|
925
|
+
readonly defaultKeys: "ctrl+-";
|
|
926
|
+
readonly description: "Undo";
|
|
927
|
+
};
|
|
928
|
+
readonly 'tui.input.newLine': {
|
|
929
|
+
readonly defaultKeys: "shift+enter";
|
|
930
|
+
readonly description: "Insert newline";
|
|
931
|
+
};
|
|
932
|
+
readonly 'tui.input.submit': {
|
|
933
|
+
readonly defaultKeys: "enter";
|
|
934
|
+
readonly description: "Submit input";
|
|
935
|
+
};
|
|
936
|
+
readonly 'tui.input.tab': {
|
|
937
|
+
readonly defaultKeys: "tab";
|
|
938
|
+
readonly description: "Tab / autocomplete";
|
|
939
|
+
};
|
|
940
|
+
readonly 'tui.input.copy': {
|
|
941
|
+
readonly defaultKeys: "ctrl+c";
|
|
942
|
+
readonly description: "Copy selection";
|
|
943
|
+
};
|
|
944
|
+
readonly 'tui.select.up': {
|
|
945
|
+
readonly defaultKeys: "up";
|
|
946
|
+
readonly description: "Move selection up";
|
|
947
|
+
};
|
|
948
|
+
readonly 'tui.select.down': {
|
|
949
|
+
readonly defaultKeys: "down";
|
|
950
|
+
readonly description: "Move selection down";
|
|
951
|
+
};
|
|
952
|
+
readonly 'tui.select.pageUp': {
|
|
953
|
+
readonly defaultKeys: "pageUp";
|
|
954
|
+
readonly description: "Selection page up";
|
|
955
|
+
};
|
|
956
|
+
readonly 'tui.select.pageDown': {
|
|
957
|
+
readonly defaultKeys: "pageDown";
|
|
958
|
+
readonly description: "Selection page down";
|
|
959
|
+
};
|
|
960
|
+
readonly 'tui.select.confirm': {
|
|
961
|
+
readonly defaultKeys: "enter";
|
|
962
|
+
readonly description: "Confirm selection";
|
|
963
|
+
};
|
|
964
|
+
readonly 'tui.select.cancel': {
|
|
965
|
+
readonly defaultKeys: ["escape", "ctrl+c"];
|
|
966
|
+
readonly description: "Cancel selection";
|
|
967
|
+
};
|
|
729
968
|
};
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
969
|
+
interface KeybindingConflict {
|
|
970
|
+
key: KeyId;
|
|
971
|
+
keybindings: string[];
|
|
972
|
+
}
|
|
973
|
+
declare class KeybindingsManager {
|
|
974
|
+
private definitions;
|
|
975
|
+
private userBindings;
|
|
976
|
+
private keysById;
|
|
977
|
+
private conflicts;
|
|
978
|
+
constructor(definitions: KeybindingDefinitions, userBindings?: KeybindingsConfig);
|
|
979
|
+
private rebuild;
|
|
980
|
+
matches(data: string, keybinding: Keybinding): boolean;
|
|
981
|
+
getKeys(keybinding: Keybinding): KeyId[];
|
|
982
|
+
getDefinition(keybinding: Keybinding): KeybindingDefinition | undefined;
|
|
983
|
+
getConflicts(): KeybindingConflict[];
|
|
984
|
+
setUserBindings(userBindings: KeybindingsConfig): void;
|
|
985
|
+
getUserBindings(): KeybindingsConfig;
|
|
986
|
+
getResolvedBindings(): KeybindingsConfig;
|
|
987
|
+
}
|
|
988
|
+
declare function setKeybindings(keybindings: KeybindingsManager): void;
|
|
989
|
+
declare function getKeybindings(): KeybindingsManager;
|
|
741
990
|
|
|
742
991
|
type StdinBufferOptions = {
|
|
743
992
|
timeout?: number;
|
|
@@ -752,12 +1001,14 @@ declare class StdinBuffer extends EventEmitter<StdinBufferEventMap> {
|
|
|
752
1001
|
private readonly timeoutMs;
|
|
753
1002
|
private pasteMode;
|
|
754
1003
|
private pasteBuffer;
|
|
1004
|
+
private pendingKittyPrintableCodepoint;
|
|
755
1005
|
constructor(options?: StdinBufferOptions);
|
|
756
1006
|
process(data: string | Buffer): void;
|
|
1007
|
+
private emitDataSequence;
|
|
757
1008
|
flush(): string[];
|
|
758
1009
|
clear(): void;
|
|
759
1010
|
getBuffer(): string;
|
|
760
1011
|
destroy(): void;
|
|
761
1012
|
}
|
|
762
1013
|
|
|
763
|
-
export { type AutocompleteItem, type AutocompleteProvider, Box, CURSOR_MARKER, CancellableLoader, type CellDimensions, CombinedAutocompleteProvider, type Component, Container,
|
|
1014
|
+
export { type AutocompleteItem, type AutocompleteProvider, type AutocompleteSuggestions, Box, CURSOR_MARKER, CancellableLoader, type CellDimensions, CombinedAutocompleteProvider, type Component, Container, type DefaultTextStyle, Editor, type EditorComponent, type EditorOptions, type EditorTheme, type Focusable, type FuzzyMatch, Image, type ImageDimensions, type ImageOptions, type ImageProtocol, type ImageRenderOptions, type ImageTheme, Input, Key, type KeyEventType, type KeyId, type Keybinding, type KeybindingConflict, type KeybindingDefinition, type KeybindingDefinitions, type Keybindings, type KeybindingsConfig, KeybindingsManager, Loader, type LoaderIndicatorOptions, Markdown, type MarkdownTheme, type OverlayAnchor, type OverlayHandle, type OverlayMargin, type OverlayOptions, ProcessTerminal, type SelectItem, SelectList, type SelectListLayoutOptions, type SelectListTheme, type SelectListTruncatePrimaryContext, type SettingItem, SettingsList, type SettingsListTheme, type SizeValue, type SlashCommand, Spacer, StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions, TUI, TUI_KEYBINDINGS, type Terminal, type TerminalCapabilities, Text, TruncatedText, allocateImageId, calculateImageRows, decodeKittyPrintable, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, fuzzyFilter, fuzzyMatch, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getKeybindings, getPngDimensions, getWebpDimensions, hyperlink, imageFallback, isFocusable, isKeyRelease, isKeyRepeat, isKittyProtocolActive, matchesKey, parseKey, renderImage, resetCapabilitiesCache, setCapabilities, setCellDimensions, setKeybindings, setKittyProtocolActive, truncateToWidth, visibleWidth, wrapTextWithAnsi };
|