@bettertui/core 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/LICENSE +21 -0
- package/README.md +57 -0
- package/bettertui_engine.node +0 -0
- package/index.d.mts +4541 -0
- package/index.d.ts +461 -0
- package/index.mjs +15737 -0
- package/index.mjs.map +1 -0
- package/package.json +51 -0
- package/rolldown-runtime-BmKbMBvF.mjs +36 -0
package/index.d.mts
ADDED
|
@@ -0,0 +1,4541 @@
|
|
|
1
|
+
import { AlignItems, AlignItems as AlignItems$1, AlignSelf, AlignSelf as AlignSelf$1, BorderStyle, ColorValue, ColorValue as ColorValue$1, FlexDirection, FlexDirection as FlexDirection$1, Gap, Gap as Gap$1, Inset, Inset as Inset$1, JustifyContent, JustifyContent as JustifyContent$1, KeyEvent as KeyEvent$1, KeyEventSource, KeyEventType, LayoutConstraints, LayoutConstraints as LayoutConstraints$1, Margin, Margin as Margin$1, MouseButton, MouseEvent, MouseEvent as MouseEvent$1, Overflow, Overflow as Overflow$1, Padding, Padding as Padding$1, Position, Position as Position$1, Sizing, Sizing as Sizing$1, Style, Style as Style$1, Theme, ThemeColors, ThemeSpacing, ValidationError, ValidationResult, generateId, isValidColor, validate, validateLayoutConstraints, validateStyle, warnIfInvalid } from "@bettertui/shared";
|
|
2
|
+
import { Buffer as Buffer$1 } from "node:buffer";
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
import { Readable, Writable } from "node:stream";
|
|
5
|
+
//#region src/geometry.types.d.ts
|
|
6
|
+
/** A 2D coordinate in the terminal grid. */
|
|
7
|
+
interface Point {
|
|
8
|
+
/** Column position (0-indexed from left) */
|
|
9
|
+
x: number;
|
|
10
|
+
/** Row position (0-indexed from top) */
|
|
11
|
+
y: number;
|
|
12
|
+
}
|
|
13
|
+
/** Width and height dimensions. */
|
|
14
|
+
interface Size {
|
|
15
|
+
/** Width in columns */
|
|
16
|
+
width: number;
|
|
17
|
+
/** Height in rows */
|
|
18
|
+
height: number;
|
|
19
|
+
}
|
|
20
|
+
/** A rectangular region defined by position and size. */
|
|
21
|
+
interface Rect {
|
|
22
|
+
/** Left column offset */
|
|
23
|
+
x: number;
|
|
24
|
+
/** Top row offset */
|
|
25
|
+
y: number;
|
|
26
|
+
/** Width in columns */
|
|
27
|
+
width: number;
|
|
28
|
+
/** Height in rows */
|
|
29
|
+
height: number;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/command/command.types.d.ts
|
|
33
|
+
type HostContext = Record<string, unknown>;
|
|
34
|
+
interface Instance {
|
|
35
|
+
id: string;
|
|
36
|
+
type: string;
|
|
37
|
+
props: Record<string, unknown>;
|
|
38
|
+
style: Style$1;
|
|
39
|
+
layout: LayoutConstraints$1;
|
|
40
|
+
children: Instance[];
|
|
41
|
+
parent: Instance | null;
|
|
42
|
+
}
|
|
43
|
+
interface TextInstance {
|
|
44
|
+
id: string;
|
|
45
|
+
type: "#text";
|
|
46
|
+
text: string;
|
|
47
|
+
parent: Instance | null;
|
|
48
|
+
}
|
|
49
|
+
type HostConfig = {
|
|
50
|
+
type: string;
|
|
51
|
+
props: Record<string, unknown>;
|
|
52
|
+
container: Instance;
|
|
53
|
+
instance: Instance;
|
|
54
|
+
textInstance: TextInstance;
|
|
55
|
+
suspenseInstance: Instance;
|
|
56
|
+
hydratableInstance: Instance;
|
|
57
|
+
publicInstance: Instance;
|
|
58
|
+
hostContext: HostContext;
|
|
59
|
+
updatePayload: Record<string, unknown>;
|
|
60
|
+
childSet: Instance[];
|
|
61
|
+
timeoutHandle: number;
|
|
62
|
+
cornerstoneTimeoutHandle: number;
|
|
63
|
+
};
|
|
64
|
+
type Command = {
|
|
65
|
+
type: "CreateNode";
|
|
66
|
+
id: string;
|
|
67
|
+
kind: string;
|
|
68
|
+
} | {
|
|
69
|
+
type: "RemoveNode";
|
|
70
|
+
id: string;
|
|
71
|
+
} | {
|
|
72
|
+
type: "AppendChild";
|
|
73
|
+
parent: string;
|
|
74
|
+
child: string;
|
|
75
|
+
} | {
|
|
76
|
+
type: "InsertBefore";
|
|
77
|
+
reference: string;
|
|
78
|
+
child: string;
|
|
79
|
+
} | {
|
|
80
|
+
type: "MoveNode";
|
|
81
|
+
node: string;
|
|
82
|
+
newParent: string;
|
|
83
|
+
} | {
|
|
84
|
+
type: "ReplaceNode";
|
|
85
|
+
old: string;
|
|
86
|
+
new: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: "DetachNode";
|
|
89
|
+
id: string;
|
|
90
|
+
} | {
|
|
91
|
+
type: "SetText";
|
|
92
|
+
id: string;
|
|
93
|
+
text: string;
|
|
94
|
+
} | {
|
|
95
|
+
type: "SetStyle";
|
|
96
|
+
id: string;
|
|
97
|
+
style: Style$1;
|
|
98
|
+
} | {
|
|
99
|
+
type: "SetLayout";
|
|
100
|
+
id: string;
|
|
101
|
+
layout: LayoutConstraints$1;
|
|
102
|
+
} | {
|
|
103
|
+
type: "SetAttribute";
|
|
104
|
+
id: string;
|
|
105
|
+
key: string;
|
|
106
|
+
value: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: "RemoveAttribute";
|
|
109
|
+
id: string;
|
|
110
|
+
key: string;
|
|
111
|
+
} | {
|
|
112
|
+
type: "BeginFrame";
|
|
113
|
+
frameId: number;
|
|
114
|
+
} | {
|
|
115
|
+
type: "CommitFrame";
|
|
116
|
+
frameId: number;
|
|
117
|
+
} | {
|
|
118
|
+
type: "Invalidate";
|
|
119
|
+
id: string;
|
|
120
|
+
} | {
|
|
121
|
+
type: "Shutdown";
|
|
122
|
+
} | {
|
|
123
|
+
type: "SetFlexDirection";
|
|
124
|
+
id: string;
|
|
125
|
+
direction: FlexDirection$1;
|
|
126
|
+
} | {
|
|
127
|
+
type: "SetJustifyContent";
|
|
128
|
+
id: string;
|
|
129
|
+
value: JustifyContent$1;
|
|
130
|
+
} | {
|
|
131
|
+
type: "SetAlignItems";
|
|
132
|
+
id: string;
|
|
133
|
+
value: AlignItems$1;
|
|
134
|
+
} | {
|
|
135
|
+
type: "SetAlignSelf";
|
|
136
|
+
id: string;
|
|
137
|
+
value: AlignSelf$1;
|
|
138
|
+
} | {
|
|
139
|
+
type: "SetFlexGrow";
|
|
140
|
+
id: string;
|
|
141
|
+
value: number;
|
|
142
|
+
} | {
|
|
143
|
+
type: "SetFlexShrink";
|
|
144
|
+
id: string;
|
|
145
|
+
value: number;
|
|
146
|
+
} | {
|
|
147
|
+
type: "SetFlexBasis";
|
|
148
|
+
id: string;
|
|
149
|
+
value: Sizing$1;
|
|
150
|
+
} | {
|
|
151
|
+
type: "SetPosition";
|
|
152
|
+
id: string;
|
|
153
|
+
value: Position$1;
|
|
154
|
+
} | {
|
|
155
|
+
type: "SetWidth";
|
|
156
|
+
id: string;
|
|
157
|
+
value: Sizing$1;
|
|
158
|
+
} | {
|
|
159
|
+
type: "SetHeight";
|
|
160
|
+
id: string;
|
|
161
|
+
value: Sizing$1;
|
|
162
|
+
} | {
|
|
163
|
+
type: "SetMinWidth";
|
|
164
|
+
id: string;
|
|
165
|
+
value: Sizing$1;
|
|
166
|
+
} | {
|
|
167
|
+
type: "SetMaxWidth";
|
|
168
|
+
id: string;
|
|
169
|
+
value: Sizing$1;
|
|
170
|
+
} | {
|
|
171
|
+
type: "SetMinHeight";
|
|
172
|
+
id: string;
|
|
173
|
+
value: Sizing$1;
|
|
174
|
+
} | {
|
|
175
|
+
type: "SetMaxHeight";
|
|
176
|
+
id: string;
|
|
177
|
+
value: Sizing$1;
|
|
178
|
+
} | {
|
|
179
|
+
type: "SetOverflow";
|
|
180
|
+
id: string;
|
|
181
|
+
value: Overflow$1;
|
|
182
|
+
} | {
|
|
183
|
+
type: "SetOpacity";
|
|
184
|
+
id: string;
|
|
185
|
+
value: number;
|
|
186
|
+
} | {
|
|
187
|
+
type: "SetZIndex";
|
|
188
|
+
id: string;
|
|
189
|
+
value: number;
|
|
190
|
+
} | {
|
|
191
|
+
type: "SetPadding";
|
|
192
|
+
id: string;
|
|
193
|
+
value: Padding$1;
|
|
194
|
+
} | {
|
|
195
|
+
type: "SetMargin";
|
|
196
|
+
id: string;
|
|
197
|
+
value: Margin$1;
|
|
198
|
+
} | {
|
|
199
|
+
type: "SetGap";
|
|
200
|
+
id: string;
|
|
201
|
+
value: Gap$1;
|
|
202
|
+
} | {
|
|
203
|
+
type: "SetInset";
|
|
204
|
+
id: string;
|
|
205
|
+
value: Inset$1;
|
|
206
|
+
} | {
|
|
207
|
+
type: "SetForeground";
|
|
208
|
+
id: string;
|
|
209
|
+
color: ColorValue$1;
|
|
210
|
+
} | {
|
|
211
|
+
type: "SetBackground";
|
|
212
|
+
id: string;
|
|
213
|
+
color: ColorValue$1;
|
|
214
|
+
} | {
|
|
215
|
+
type: "SetBold";
|
|
216
|
+
id: string;
|
|
217
|
+
value: boolean;
|
|
218
|
+
} | {
|
|
219
|
+
type: "SetItalic";
|
|
220
|
+
id: string;
|
|
221
|
+
value: boolean;
|
|
222
|
+
} | {
|
|
223
|
+
type: "SetUnderline";
|
|
224
|
+
id: string;
|
|
225
|
+
value: boolean;
|
|
226
|
+
} | {
|
|
227
|
+
type: "SetDim";
|
|
228
|
+
id: string;
|
|
229
|
+
value: boolean;
|
|
230
|
+
} | {
|
|
231
|
+
type: "SetStrikethrough";
|
|
232
|
+
id: string;
|
|
233
|
+
value: boolean;
|
|
234
|
+
} | {
|
|
235
|
+
type: "SetInverse";
|
|
236
|
+
id: string;
|
|
237
|
+
value: boolean;
|
|
238
|
+
} | {
|
|
239
|
+
type: "SetHidden";
|
|
240
|
+
id: string;
|
|
241
|
+
value: boolean;
|
|
242
|
+
} | {
|
|
243
|
+
type: "SetBlink";
|
|
244
|
+
id: string;
|
|
245
|
+
value: boolean;
|
|
246
|
+
} | {
|
|
247
|
+
type: "SetScreenMode";
|
|
248
|
+
mode: "alternate-screen" | "main-screen" | "split-footer";
|
|
249
|
+
footerHeight?: number;
|
|
250
|
+
};
|
|
251
|
+
interface CommandBufferConsumer {
|
|
252
|
+
push(command: Command): void;
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/command/buffer.d.ts
|
|
256
|
+
declare class CommandBuffer {
|
|
257
|
+
private commands;
|
|
258
|
+
push(command: Command): void;
|
|
259
|
+
drain(): Command[];
|
|
260
|
+
peek(): readonly Command[];
|
|
261
|
+
clear(): void;
|
|
262
|
+
get length(): number;
|
|
263
|
+
get isEmpty(): boolean;
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/command/tree.d.ts
|
|
267
|
+
declare function createInstance(type: string, props: Record<string, unknown>): Instance;
|
|
268
|
+
declare function createTextInstance(text: string): TextInstance;
|
|
269
|
+
declare function appendChild(parent: Instance, child: Instance | TextInstance): void;
|
|
270
|
+
declare function removeChild(parent: Instance, child: Instance | TextInstance): void;
|
|
271
|
+
declare function insertBefore(parent: Instance, child: Instance | TextInstance, reference: Instance | TextInstance): void;
|
|
272
|
+
declare function prepareUpdate(_instance: Instance, _type: string, _oldProps: Record<string, unknown>, newProps: Record<string, unknown>): Record<string, unknown> | null;
|
|
273
|
+
declare function commitUpdate(instance: Instance, updatePayload: Record<string, unknown>): void;
|
|
274
|
+
declare function commitTextUpdate(textInstance: TextInstance, text: string): void;
|
|
275
|
+
declare function finalizeInitialChildren(_instance: Instance): boolean;
|
|
276
|
+
declare function resetAfterCommit(): void;
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/reconciler.d.ts
|
|
279
|
+
declare function createReconciler(buffer: CommandBuffer): {
|
|
280
|
+
createInstance: (type: string, props: Record<string, unknown>) => Instance;
|
|
281
|
+
createTextInstance: (text: string) => TextInstance;
|
|
282
|
+
appendChild: (parent: Instance, child: Instance | TextInstance) => void;
|
|
283
|
+
removeChild: (parent: Instance, child: Instance | TextInstance) => void;
|
|
284
|
+
insertBefore: (parent: Instance, child: Instance | TextInstance, reference: Instance | TextInstance) => void;
|
|
285
|
+
prepareUpdate: (instance: Instance, type: string, oldProps: Record<string, unknown>, newProps: Record<string, unknown>) => Record<string, unknown> | null;
|
|
286
|
+
commitUpdate: (instance: Instance, updatePayload: Record<string, unknown>) => void;
|
|
287
|
+
commitTextUpdate: (textInstance: TextInstance, text: string) => void;
|
|
288
|
+
finalizeInitialChildren: (instance: Instance) => boolean;
|
|
289
|
+
resetAfterCommit: () => void;
|
|
290
|
+
};
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/lib/clock.d.ts
|
|
293
|
+
type TimerHandle = ReturnType<typeof globalThis.setTimeout>;
|
|
294
|
+
interface Clock {
|
|
295
|
+
now(): number;
|
|
296
|
+
setTimeout(fn: () => void, delayMs: number): TimerHandle;
|
|
297
|
+
clearTimeout(handle: TimerHandle): void;
|
|
298
|
+
setInterval(fn: () => void, delayMs: number): TimerHandle;
|
|
299
|
+
clearInterval(handle: TimerHandle): void;
|
|
300
|
+
}
|
|
301
|
+
declare class SystemClock implements Clock {
|
|
302
|
+
now(): number;
|
|
303
|
+
setTimeout(fn: () => void, delayMs: number): TimerHandle;
|
|
304
|
+
clearTimeout(handle: TimerHandle): void;
|
|
305
|
+
setInterval(fn: () => void, delayMs: number): TimerHandle;
|
|
306
|
+
clearInterval(handle: TimerHandle): void;
|
|
307
|
+
}
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/platform/platform.types.d.ts
|
|
310
|
+
type ScreenMode = "alternate-screen" | "main-screen" | "split-footer";
|
|
311
|
+
type ExternalOutputMode = "capture-stdout" | "passthrough";
|
|
312
|
+
interface BindingInfo$1 {
|
|
313
|
+
id: string;
|
|
314
|
+
keys: string;
|
|
315
|
+
command: string;
|
|
316
|
+
description: string | null;
|
|
317
|
+
enabled: boolean;
|
|
318
|
+
layer: string;
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/platform/binding.d.ts
|
|
322
|
+
interface TerminalCapabilities$1 {
|
|
323
|
+
brand: string;
|
|
324
|
+
true_color: boolean;
|
|
325
|
+
kitty_keyboard: boolean;
|
|
326
|
+
csi_u: boolean;
|
|
327
|
+
bracketed_paste: boolean;
|
|
328
|
+
focus_events: boolean;
|
|
329
|
+
mouse: boolean;
|
|
330
|
+
osc52: boolean;
|
|
331
|
+
osc52_support: boolean;
|
|
332
|
+
osc8: boolean;
|
|
333
|
+
sync: boolean;
|
|
334
|
+
sgr_pixel: boolean;
|
|
335
|
+
underline_color: boolean;
|
|
336
|
+
strikethrough: boolean;
|
|
337
|
+
cursor_style: boolean;
|
|
338
|
+
alternate_scroll: boolean;
|
|
339
|
+
inline_images: boolean;
|
|
340
|
+
sixel: boolean;
|
|
341
|
+
columns: number;
|
|
342
|
+
rows: number;
|
|
343
|
+
}
|
|
344
|
+
interface CommandResult {
|
|
345
|
+
success: number;
|
|
346
|
+
errors: string[];
|
|
347
|
+
id_mappings: Array<{
|
|
348
|
+
temp: number;
|
|
349
|
+
real: number;
|
|
350
|
+
}>;
|
|
351
|
+
}
|
|
352
|
+
interface RenderResult {
|
|
353
|
+
output_data: string;
|
|
354
|
+
width: number;
|
|
355
|
+
height: number;
|
|
356
|
+
dirty_region_count: number;
|
|
357
|
+
}
|
|
358
|
+
interface NapiEngine {
|
|
359
|
+
processCommands(commandsJson: string): CommandResult;
|
|
360
|
+
beginFrame(): void;
|
|
361
|
+
commitFrame(): void;
|
|
362
|
+
render(): RenderResult;
|
|
363
|
+
renderFull(): RenderResult;
|
|
364
|
+
resize(width: number, height: number): void;
|
|
365
|
+
setScreenMode(mode: string, footerHeight?: number | null): void;
|
|
366
|
+
setBackgroundColor?(color: string): void;
|
|
367
|
+
setStyle(id: number, styleJson: string): void;
|
|
368
|
+
setLayout(id: number, layoutJson: string): void;
|
|
369
|
+
getNode(id: number): string;
|
|
370
|
+
treeSummary(): string;
|
|
371
|
+
nodeCount(): number;
|
|
372
|
+
frameCount(): number;
|
|
373
|
+
createNode(kind: string): number;
|
|
374
|
+
appendChild(parent: number, child: number): boolean;
|
|
375
|
+
/** Fast path: insert `child` immediately before `before` in the tree. */
|
|
376
|
+
insertBefore(before: number, child: number): boolean;
|
|
377
|
+
removeNode(id: number): void;
|
|
378
|
+
setText(id: number, text: string): void;
|
|
379
|
+
setScrollOffset(id: number, scrollX: number, scrollY: number): void;
|
|
380
|
+
root(): number;
|
|
381
|
+
validate(): boolean;
|
|
382
|
+
printTree(): string;
|
|
383
|
+
shutdown(): void;
|
|
384
|
+
hitGridCheck(x: number, y: number): number;
|
|
385
|
+
hitGridIsDirty(): boolean;
|
|
386
|
+
hitGridClearCurrent(): void;
|
|
387
|
+
hitGridPushScissor(x: number, y: number, width: number, height: number): void;
|
|
388
|
+
hitGridPopScissor(): void;
|
|
389
|
+
hitGridAddCurrentClipped(x: number, y: number, width: number, height: number, id: number): void;
|
|
390
|
+
hitGridDump(): string;
|
|
391
|
+
}
|
|
392
|
+
interface NapiEventBus {
|
|
393
|
+
pushKey(key: string, ctrl: boolean, shift: boolean, alt: boolean): void;
|
|
394
|
+
pushMouse(button: string, x: number, y: number): void;
|
|
395
|
+
pushMouseMotion(x: number, y: number): void;
|
|
396
|
+
pushPaste(text: string): void;
|
|
397
|
+
pushResize(width: number, height: number, prevWidth: number, prevHeight: number): void;
|
|
398
|
+
drain(): string;
|
|
399
|
+
len(): number;
|
|
400
|
+
isEmpty(): boolean;
|
|
401
|
+
clear(): void;
|
|
402
|
+
}
|
|
403
|
+
interface NapiFocusManager {
|
|
404
|
+
focus(id: number): boolean;
|
|
405
|
+
blur(id: number): boolean;
|
|
406
|
+
blurCurrent(): boolean;
|
|
407
|
+
focused(): number;
|
|
408
|
+
isFocused(id: number): boolean;
|
|
409
|
+
traverse(direction: string): number;
|
|
410
|
+
focusOrder(): number[];
|
|
411
|
+
clear(): void;
|
|
412
|
+
}
|
|
413
|
+
interface NapiTextEngine {
|
|
414
|
+
insertChar(ch: string): void;
|
|
415
|
+
insertStr(text: string): void;
|
|
416
|
+
deleteChar(): void;
|
|
417
|
+
cursorLeft(): void;
|
|
418
|
+
cursorRight(): void;
|
|
419
|
+
getText(): string;
|
|
420
|
+
cursorPosition(): number;
|
|
421
|
+
setCursorPosition(pos: number): void;
|
|
422
|
+
length(): number;
|
|
423
|
+
lineCount(): number;
|
|
424
|
+
isEmpty(): boolean;
|
|
425
|
+
wordCount(): number;
|
|
426
|
+
canUndo(): boolean;
|
|
427
|
+
canRedo(): boolean;
|
|
428
|
+
undo(): boolean;
|
|
429
|
+
redo(): boolean;
|
|
430
|
+
clear(): void;
|
|
431
|
+
}
|
|
432
|
+
interface NapiScheduler {
|
|
433
|
+
requestFrame(): void;
|
|
434
|
+
beginFrame(): boolean;
|
|
435
|
+
endFrame(): void;
|
|
436
|
+
shouldRender(): boolean;
|
|
437
|
+
isIdle(): boolean;
|
|
438
|
+
frameCount(): number;
|
|
439
|
+
fps(): number;
|
|
440
|
+
requestRenderCoalesced(): void;
|
|
441
|
+
requestRenderImmediate(): void;
|
|
442
|
+
hasScheduledFrame(): boolean;
|
|
443
|
+
isRendering(): boolean;
|
|
444
|
+
beginRender(): void;
|
|
445
|
+
endRender(): boolean;
|
|
446
|
+
}
|
|
447
|
+
interface NapiKeymap {
|
|
448
|
+
addBinding(layer: string, id: string, keys: string, command: string, description: string | null, priority: number): boolean;
|
|
449
|
+
handleKey(key: string): string;
|
|
450
|
+
hasPending(): boolean;
|
|
451
|
+
clearPending(): void;
|
|
452
|
+
setMode(mode: string): void;
|
|
453
|
+
currentMode(): string;
|
|
454
|
+
clearMode(): void;
|
|
455
|
+
removeLayer(name: string): boolean;
|
|
456
|
+
setChordTimeout(ms: number): void;
|
|
457
|
+
chordTimeout(): number;
|
|
458
|
+
pendingKeys(): string[];
|
|
459
|
+
activeBindings(): BindingInfo$1[];
|
|
460
|
+
allBindings(): BindingInfo$1[];
|
|
461
|
+
commandHistory(): string[];
|
|
462
|
+
clearHistory(): void;
|
|
463
|
+
parseKey(keyStr: string): string;
|
|
464
|
+
parseSequence(keyStr: string): string[];
|
|
465
|
+
}
|
|
466
|
+
declare function createEngine(width?: number, height?: number): NapiEngine;
|
|
467
|
+
declare function createEventBus(): NapiEventBus;
|
|
468
|
+
declare function createFocusManager(): NapiFocusManager;
|
|
469
|
+
declare function createTextEngine(text?: string): NapiTextEngine;
|
|
470
|
+
declare function createScheduler(fps?: number): NapiScheduler;
|
|
471
|
+
declare function createKeymap(): NapiKeymap;
|
|
472
|
+
declare function detectCapabilities(): TerminalCapabilities$1;
|
|
473
|
+
declare function getVersion(): string;
|
|
474
|
+
declare function getNativePackageName(): string;
|
|
475
|
+
interface HighlightSegment {
|
|
476
|
+
text: string;
|
|
477
|
+
fg: string | null;
|
|
478
|
+
bg: string | null;
|
|
479
|
+
bold: boolean | null;
|
|
480
|
+
italic: boolean | null;
|
|
481
|
+
underline: boolean | null;
|
|
482
|
+
dim: boolean | null;
|
|
483
|
+
strikethrough: boolean | null;
|
|
484
|
+
}
|
|
485
|
+
interface HighlightedLine {
|
|
486
|
+
segments: HighlightSegment[];
|
|
487
|
+
}
|
|
488
|
+
declare function highlightCode(code: string, language: string): HighlightedLine[];
|
|
489
|
+
interface NapiWidgetHost {
|
|
490
|
+
widgetCount(): number;
|
|
491
|
+
}
|
|
492
|
+
declare function createWidgetHost(): NapiWidgetHost;
|
|
493
|
+
interface NativeSpanFeedOptions {
|
|
494
|
+
chunkSize?: number;
|
|
495
|
+
initialChunks?: number;
|
|
496
|
+
maxBytes?: number;
|
|
497
|
+
/** 0 = grow, 1 = block */
|
|
498
|
+
growthPolicy?: number;
|
|
499
|
+
autoCommitOnFull?: boolean;
|
|
500
|
+
spanQueueCapacity?: number;
|
|
501
|
+
}
|
|
502
|
+
interface NativeSpanFeed {
|
|
503
|
+
write(data: Buffer): number;
|
|
504
|
+
drainSpans(out: Buffer): number;
|
|
505
|
+
close(): void;
|
|
506
|
+
reset(): void;
|
|
507
|
+
pendingSpans(): number;
|
|
508
|
+
pendingBytes(): number;
|
|
509
|
+
isClosed(): boolean;
|
|
510
|
+
isBackpressured(): boolean;
|
|
511
|
+
stats(): NapiSpanFeedStats;
|
|
512
|
+
markConsumed(chunkIndex: number): void;
|
|
513
|
+
}
|
|
514
|
+
interface NativeHitGrid {
|
|
515
|
+
resize(width: number, height: number): void;
|
|
516
|
+
add(x: number, y: number, width: number, height: number, id: number): void;
|
|
517
|
+
check(x: number, y: number): number;
|
|
518
|
+
clearNext(): void;
|
|
519
|
+
clearCurrent(): void;
|
|
520
|
+
swap(): boolean;
|
|
521
|
+
isDirty(): boolean;
|
|
522
|
+
dimensions(): string;
|
|
523
|
+
pushScissor(x: number, y: number, width: number, height: number): void;
|
|
524
|
+
popScissor(): void;
|
|
525
|
+
clearScissors(): void;
|
|
526
|
+
}
|
|
527
|
+
interface NapiSpanFeedStats {
|
|
528
|
+
bytesWritten: number;
|
|
529
|
+
spansCommitted: number;
|
|
530
|
+
chunks: number;
|
|
531
|
+
pendingSpans: number;
|
|
532
|
+
}
|
|
533
|
+
declare class NapiSpanFeed {
|
|
534
|
+
private feed;
|
|
535
|
+
constructor(feed: NativeSpanFeed);
|
|
536
|
+
write(data: Buffer): number;
|
|
537
|
+
drainSpans(out: Buffer): number;
|
|
538
|
+
close(): void;
|
|
539
|
+
reset(): void;
|
|
540
|
+
get pendingSpans(): number;
|
|
541
|
+
get pendingBytes(): number;
|
|
542
|
+
get isClosed(): boolean;
|
|
543
|
+
get isBackpressured(): boolean;
|
|
544
|
+
stats(): NapiSpanFeedStats;
|
|
545
|
+
markConsumed(chunkIndex: number): void;
|
|
546
|
+
}
|
|
547
|
+
declare function createSpanFeed(options?: NativeSpanFeedOptions): NapiSpanFeed;
|
|
548
|
+
declare class NapiHitGrid {
|
|
549
|
+
private grid;
|
|
550
|
+
constructor(grid: NativeHitGrid);
|
|
551
|
+
resize(width: number, height: number): void;
|
|
552
|
+
add(x: number, y: number, width: number, height: number, id: number): void;
|
|
553
|
+
check(x: number, y: number): number;
|
|
554
|
+
clearNext(): void;
|
|
555
|
+
clearCurrent(): void;
|
|
556
|
+
swap(): boolean;
|
|
557
|
+
get isDirty(): boolean;
|
|
558
|
+
pushScissor(x: number, y: number, width: number, height: number): void;
|
|
559
|
+
popScissor(): void;
|
|
560
|
+
clearScissors(): void;
|
|
561
|
+
}
|
|
562
|
+
declare function createHitGrid(width: number, height: number): NapiHitGrid;
|
|
563
|
+
interface NapiThemeColors {
|
|
564
|
+
background: string;
|
|
565
|
+
surface: string;
|
|
566
|
+
surfaceHigh: string;
|
|
567
|
+
surfaceLow: string;
|
|
568
|
+
primary: string;
|
|
569
|
+
primaryForeground: string;
|
|
570
|
+
secondary: string;
|
|
571
|
+
secondaryForeground: string;
|
|
572
|
+
text: string;
|
|
573
|
+
textMuted: string;
|
|
574
|
+
textDim: string;
|
|
575
|
+
border: string;
|
|
576
|
+
borderFocused: string;
|
|
577
|
+
accent: string;
|
|
578
|
+
accentForeground: string;
|
|
579
|
+
error: string;
|
|
580
|
+
warning: string;
|
|
581
|
+
success: string;
|
|
582
|
+
info: string;
|
|
583
|
+
scrollbar: string;
|
|
584
|
+
scrollbarThumb: string;
|
|
585
|
+
}
|
|
586
|
+
interface NapiThemeSpacing {
|
|
587
|
+
none: number;
|
|
588
|
+
xxs: number;
|
|
589
|
+
xs: number;
|
|
590
|
+
sm: number;
|
|
591
|
+
md: number;
|
|
592
|
+
lg: number;
|
|
593
|
+
xl: number;
|
|
594
|
+
xxl: number;
|
|
595
|
+
}
|
|
596
|
+
interface NapiThemeBorders {
|
|
597
|
+
style: string;
|
|
598
|
+
fg: string;
|
|
599
|
+
}
|
|
600
|
+
interface NapiTheme {
|
|
601
|
+
name: string;
|
|
602
|
+
colors: NapiThemeColors;
|
|
603
|
+
spacing: NapiThemeSpacing;
|
|
604
|
+
borders: NapiThemeBorders;
|
|
605
|
+
}
|
|
606
|
+
declare function createDarkTheme(): NapiTheme;
|
|
607
|
+
declare function createLightTheme(): NapiTheme;
|
|
608
|
+
interface NapiLoggerConfig {
|
|
609
|
+
level?: string;
|
|
610
|
+
color?: boolean;
|
|
611
|
+
timestamp?: boolean;
|
|
612
|
+
module?: boolean;
|
|
613
|
+
thread?: boolean;
|
|
614
|
+
file?: string;
|
|
615
|
+
maxFileSize?: number;
|
|
616
|
+
maxFiles?: number;
|
|
617
|
+
dev?: boolean;
|
|
618
|
+
}
|
|
619
|
+
interface NapiDiagnosticSnapshot {
|
|
620
|
+
renderCalls: number;
|
|
621
|
+
renderBytes: number;
|
|
622
|
+
eventDispatches: number;
|
|
623
|
+
layoutComputations: number;
|
|
624
|
+
cacheHits: number;
|
|
625
|
+
cacheMisses: number;
|
|
626
|
+
allocations: number;
|
|
627
|
+
averageFrameTime: number;
|
|
628
|
+
fps: number;
|
|
629
|
+
}
|
|
630
|
+
declare function loggerInit(config?: NapiLoggerConfig): void;
|
|
631
|
+
declare function loggerSetLevel(level: string): void;
|
|
632
|
+
declare function loggerGetLevel(): string;
|
|
633
|
+
declare function loggerSetModuleFilter(include?: string[], exclude?: string[]): void;
|
|
634
|
+
declare function loggerGetDiagnostics(): NapiDiagnosticSnapshot;
|
|
635
|
+
declare function loggerFlush(): void;
|
|
636
|
+
interface NativePluginHost {
|
|
637
|
+
register(name: string, version: string, author: string, capabilities: string[]): string | null;
|
|
638
|
+
unregister(name: string): string | null;
|
|
639
|
+
initialize(name: string): string | null;
|
|
640
|
+
start(name: string): string | null;
|
|
641
|
+
stop(name: string): string | null;
|
|
642
|
+
markError(name: string): string | null;
|
|
643
|
+
state(name: string): string | null;
|
|
644
|
+
pluginNames(): string[];
|
|
645
|
+
ensureSlot(slot: string, mode: string): void;
|
|
646
|
+
slotRegister(slot: string, pluginId: string, priority: number, value: string): number;
|
|
647
|
+
slotRemove(slot: string, token: number): boolean;
|
|
648
|
+
slotResolve(slot: string): string[];
|
|
649
|
+
slotTakeDirty(slot: string): boolean;
|
|
650
|
+
}
|
|
651
|
+
/** Plugin lifecycle state names returned by {@link NapiPluginHost.state}. */
|
|
652
|
+
type PluginStateName = "registered" | "initialized" | "running" | "stopped" | "error";
|
|
653
|
+
/** Slot resolution mode. */
|
|
654
|
+
type SlotMode = "append" | "single-winner" | "replace";
|
|
655
|
+
/**
|
|
656
|
+
* TypeScript wrapper around the native plugin host + slot registry — the
|
|
657
|
+
* BetterTUI plugin API.
|
|
658
|
+
* methods return an error string when the transition is illegal, else `null`.
|
|
659
|
+
* Slot values are strings (typically a node id or serialized descriptor).
|
|
660
|
+
*/
|
|
661
|
+
declare class NapiPluginHost {
|
|
662
|
+
private host;
|
|
663
|
+
constructor(host: NativePluginHost);
|
|
664
|
+
register(name: string, version: string, author: string, capabilities?: string[]): string | null;
|
|
665
|
+
unregister(name: string): string | null;
|
|
666
|
+
initialize(name: string): string | null;
|
|
667
|
+
start(name: string): string | null;
|
|
668
|
+
stop(name: string): string | null;
|
|
669
|
+
markError(name: string): string | null;
|
|
670
|
+
state(name: string): PluginStateName | null;
|
|
671
|
+
pluginNames(): string[];
|
|
672
|
+
ensureSlot(slot: string, mode?: SlotMode): void;
|
|
673
|
+
slotRegister(slot: string, pluginId: string, priority: number, value: string): number;
|
|
674
|
+
slotRemove(slot: string, token: number): boolean;
|
|
675
|
+
slotResolve(slot: string): string[];
|
|
676
|
+
slotTakeDirty(slot: string): boolean;
|
|
677
|
+
}
|
|
678
|
+
declare function createPluginHost(): NapiPluginHost;
|
|
679
|
+
/**
|
|
680
|
+
* TypeScript wrapper around the native tween/spring animation timeline.
|
|
681
|
+
* Wraps `NativeTimeline` from the napi-rs binary.
|
|
682
|
+
*/
|
|
683
|
+
declare class NapiTimeline {
|
|
684
|
+
private _tl;
|
|
685
|
+
constructor(duration?: number, looping?: boolean);
|
|
686
|
+
/**
|
|
687
|
+
* Schedule a tween from `from` → `to` over `duration` seconds starting at
|
|
688
|
+
* `startTime`. Returns the animation index for {@link animationValue}.
|
|
689
|
+
*/
|
|
690
|
+
addTween(from: number, to: number, duration: number, startTime: number, easing?: string): number;
|
|
691
|
+
play(): void;
|
|
692
|
+
pause(): void;
|
|
693
|
+
restart(): void;
|
|
694
|
+
/** Advance by `dt` seconds (frame delta). Call once per frame. */
|
|
695
|
+
update(dt: number): void;
|
|
696
|
+
/** Current interpolated value of tween at `index`. */
|
|
697
|
+
animationValue(index: number): number | null;
|
|
698
|
+
currentTime(): number;
|
|
699
|
+
isComplete(): boolean;
|
|
700
|
+
isPlaying(): boolean;
|
|
701
|
+
setSpeed(speed: number): void;
|
|
702
|
+
/** Progress 0.0–1.0 if timeline has a fixed duration, else `null`. */
|
|
703
|
+
progress(): number | null;
|
|
704
|
+
}
|
|
705
|
+
declare function createTimeline(duration?: number, looping?: boolean): NapiTimeline;
|
|
706
|
+
type GraphicsFormat = "rgb" | "rgba" | "png";
|
|
707
|
+
/**
|
|
708
|
+
* Build a Kitty graphics-protocol sequence transmitting+displaying raw pixel
|
|
709
|
+
* or PNG data with the given numeric `id`.
|
|
710
|
+
*/
|
|
711
|
+
declare function graphicsKittyWrite(format: GraphicsFormat, width: number, height: number, data: Buffer, id: number): Buffer;
|
|
712
|
+
/** Build the Kitty sequence deleting image `id`. */
|
|
713
|
+
declare function graphicsKittyDelete(id: number): Buffer;
|
|
714
|
+
/** Build the Kitty sequence deleting all transmitted images. */
|
|
715
|
+
declare function graphicsKittyDeleteAll(): Buffer;
|
|
716
|
+
/**
|
|
717
|
+
* Build an iTerm2 inline-image sequence for `fileBytes` (e.g. PNG file data).
|
|
718
|
+
*/
|
|
719
|
+
declare function graphicsItermWrite(fileBytes: Buffer, name?: string, width?: number, height?: number): Buffer;
|
|
720
|
+
/** Build a Sixel sequence for a raw `rgb`/`rgba` image (empty for `png`). */
|
|
721
|
+
declare function graphicsSixelWrite(format: GraphicsFormat, width: number, height: number, data: Buffer): Buffer;
|
|
722
|
+
/**
|
|
723
|
+
* Build the probe sequence(s) that detect which graphics protocols the
|
|
724
|
+
* terminal supports (Kitty query + DA1 for Sixel). Write the returned bytes
|
|
725
|
+
* to stdout, then wait for the terminal's DA1 response.
|
|
726
|
+
*/
|
|
727
|
+
declare function graphicsQuery(): Buffer;
|
|
728
|
+
/**
|
|
729
|
+
* Build the OSC 52 sequence that sets the terminal clipboard to `text`.
|
|
730
|
+
* Write the returned bytes to stdout.
|
|
731
|
+
* `selection`: `"clipboard"` | `"primary"` | `"secondary"` | `"tertiary"`
|
|
732
|
+
*/
|
|
733
|
+
declare function clipboardSetSequence(selection: string, text: string): number[];
|
|
734
|
+
/**
|
|
735
|
+
* Build the OSC 52 query sequence asking the terminal to report clipboard
|
|
736
|
+
* contents. Write the returned bytes to stdout; the response arrives as an
|
|
737
|
+
* inbound OSC 52 which {@link clipboardDecode} can decode.
|
|
738
|
+
*/
|
|
739
|
+
declare function clipboardQuerySequence(selection: string): number[];
|
|
740
|
+
/**
|
|
741
|
+
* Decode a base64 OSC 52 clipboard payload into UTF-8 text.
|
|
742
|
+
* Returns `null` for the `?` query marker or invalid base64/UTF-8.
|
|
743
|
+
*/
|
|
744
|
+
declare function clipboardDecode(payload: string): string | null;
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region src/runtime.d.ts
|
|
747
|
+
interface CommandRuntimeOptions {
|
|
748
|
+
frameIntervalMs?: number;
|
|
749
|
+
autoStart?: boolean;
|
|
750
|
+
engine?: NapiEngine;
|
|
751
|
+
clock?: Clock;
|
|
752
|
+
}
|
|
753
|
+
declare class CommandRuntime {
|
|
754
|
+
private buffer;
|
|
755
|
+
private running;
|
|
756
|
+
private frameHandle;
|
|
757
|
+
private subscribers;
|
|
758
|
+
private frameCallbacks;
|
|
759
|
+
private lastFrameTime;
|
|
760
|
+
private frameIntervalMs;
|
|
761
|
+
private engine;
|
|
762
|
+
private width;
|
|
763
|
+
private height;
|
|
764
|
+
private clock;
|
|
765
|
+
constructor(bufferOrOptions?: CommandBuffer | CommandRuntimeOptions);
|
|
766
|
+
get commandBuffer(): CommandBuffer;
|
|
767
|
+
get isRunning(): boolean;
|
|
768
|
+
get terminalWidth(): number;
|
|
769
|
+
get terminalHeight(): number;
|
|
770
|
+
drain(): Command[];
|
|
771
|
+
flush(): void;
|
|
772
|
+
subscribe(fn: (commands: Command[]) => void): () => void;
|
|
773
|
+
onFrame(callback: (deltaMs: number) => void): () => void;
|
|
774
|
+
startFrameLoop(intervalMs?: number): void;
|
|
775
|
+
stopFrameLoop(): void;
|
|
776
|
+
requestFrame(): void;
|
|
777
|
+
resize(width: number, height: number): void;
|
|
778
|
+
render(): {
|
|
779
|
+
outputData: Buffer;
|
|
780
|
+
width: number;
|
|
781
|
+
height: number;
|
|
782
|
+
} | null;
|
|
783
|
+
dispose(): void;
|
|
784
|
+
}
|
|
785
|
+
//#endregion
|
|
786
|
+
//#region src/lib/rgba.d.ts
|
|
787
|
+
/**
|
|
788
|
+
* RGBA color class with static factory methods.
|
|
789
|
+
*/
|
|
790
|
+
/**
|
|
791
|
+
* RGBA color type with static factory methods.
|
|
792
|
+
* r, g, b, a are in 0-255 range.
|
|
793
|
+
*/
|
|
794
|
+
type RGBA = {
|
|
795
|
+
r: number;
|
|
796
|
+
g: number;
|
|
797
|
+
b: number;
|
|
798
|
+
a: number;
|
|
799
|
+
};
|
|
800
|
+
declare namespace RGBA {
|
|
801
|
+
/** Create RGBA from 0-255 integer components. */
|
|
802
|
+
function fromInts(r: number, g: number, b: number, a?: number): RGBA;
|
|
803
|
+
/** Create RGBA from 0.0–1.0 float components. */
|
|
804
|
+
function fromValues(r: number, g: number, b: number, a?: number): RGBA;
|
|
805
|
+
/** Parse a CSS hex color string (#rgb, #rrggbb, #rrggbbaa). */
|
|
806
|
+
function fromHex(hex: string): RGBA;
|
|
807
|
+
/** Transparent black. */
|
|
808
|
+
const transparent: RGBA;
|
|
809
|
+
/** Convert to a #rrggbb hex string (ignores alpha). */
|
|
810
|
+
function toHex(rgba: RGBA): string;
|
|
811
|
+
/** Convert to a #rrggbbaa hex string. */
|
|
812
|
+
function toHexAlpha(rgba: RGBA): string;
|
|
813
|
+
/** Convert to a CSS rgba() string. */
|
|
814
|
+
function toCSS(rgba: RGBA): string;
|
|
815
|
+
/** Get ANSI RGB components as "r;g;b" string. */
|
|
816
|
+
function toAnsiColor(rgba: RGBA): string;
|
|
817
|
+
/** Check if RGBA is transparent (a === 0). */
|
|
818
|
+
function isTransparent(rgba: RGBA): boolean;
|
|
819
|
+
/** Check equality. */
|
|
820
|
+
function equals(a: RGBA, b: RGBA): boolean;
|
|
821
|
+
/** Blend src over dst using normal alpha compositing. */
|
|
822
|
+
function blend(dst: RGBA, src: RGBA): RGBA;
|
|
823
|
+
}
|
|
824
|
+
/** A color input: hex string, named color string, or RGBA object. */
|
|
825
|
+
type ColorInput = string | RGBA | null | undefined;
|
|
826
|
+
/**
|
|
827
|
+
* Parse any color input to RGBA.
|
|
828
|
+
* Supports: hex strings (#rgb, #rrggbb, #rrggbbaa), named colors,
|
|
829
|
+
* rgb()/rgba() strings, and RGBA objects.
|
|
830
|
+
*/
|
|
831
|
+
declare function parseColor(input: ColorInput): RGBA;
|
|
832
|
+
/** Convert RGBA to a CSS color string suitable for the engine. */
|
|
833
|
+
declare function rgbaToEngineColor(rgba: RGBA): string;
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region src/renderables/Box.d.ts
|
|
836
|
+
type BorderSide = "top" | "right" | "bottom" | "left";
|
|
837
|
+
type BorderStyleKind = "single" | "double" | "round" | "thick" | "dashed" | "ascii" | "none";
|
|
838
|
+
interface BoxOptions {
|
|
839
|
+
id?: string;
|
|
840
|
+
options?: any;
|
|
841
|
+
width?: number | string;
|
|
842
|
+
height?: number | string;
|
|
843
|
+
minWidth?: number | string;
|
|
844
|
+
maxWidth?: number | string;
|
|
845
|
+
minHeight?: number | string;
|
|
846
|
+
maxHeight?: number | string;
|
|
847
|
+
position?: "relative" | "absolute";
|
|
848
|
+
top?: number | string;
|
|
849
|
+
right?: number | string;
|
|
850
|
+
bottom?: number | string;
|
|
851
|
+
left?: number | string;
|
|
852
|
+
zIndex?: number;
|
|
853
|
+
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse";
|
|
854
|
+
flexGrow?: number;
|
|
855
|
+
flexShrink?: number;
|
|
856
|
+
flexBasis?: number | string;
|
|
857
|
+
flexWrap?: "nowrap" | "wrap";
|
|
858
|
+
alignItems?: "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
|
|
859
|
+
alignSelf?: "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
|
|
860
|
+
justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
861
|
+
overflow?: "visible" | "hidden" | "scroll";
|
|
862
|
+
gap?: number;
|
|
863
|
+
rowGap?: number;
|
|
864
|
+
columnGap?: number;
|
|
865
|
+
padding?: number;
|
|
866
|
+
paddingX?: number;
|
|
867
|
+
paddingY?: number;
|
|
868
|
+
paddingTop?: number;
|
|
869
|
+
paddingRight?: number;
|
|
870
|
+
paddingBottom?: number;
|
|
871
|
+
paddingLeft?: number;
|
|
872
|
+
margin?: number;
|
|
873
|
+
marginX?: number;
|
|
874
|
+
marginY?: number;
|
|
875
|
+
marginTop?: number;
|
|
876
|
+
marginRight?: number;
|
|
877
|
+
marginBottom?: number;
|
|
878
|
+
marginLeft?: number;
|
|
879
|
+
backgroundColor?: ColorInput;
|
|
880
|
+
borderStyle?: BorderStyleKind;
|
|
881
|
+
border?: boolean | BorderSide[];
|
|
882
|
+
borderColor?: ColorInput;
|
|
883
|
+
focusedBorderColor?: ColorInput;
|
|
884
|
+
title?: string;
|
|
885
|
+
titleColor?: ColorInput;
|
|
886
|
+
titleAlignment?: "left" | "center" | "right";
|
|
887
|
+
bottomTitle?: string;
|
|
888
|
+
bottomTitleAlignment?: "left" | "center" | "right";
|
|
889
|
+
opacity?: number;
|
|
890
|
+
visible?: boolean;
|
|
891
|
+
buffered?: boolean;
|
|
892
|
+
focusable?: boolean;
|
|
893
|
+
onMouseDown?: (event: unknown) => void;
|
|
894
|
+
onMouseUp?: (event: unknown) => void;
|
|
895
|
+
onMouseMove?: (event: unknown) => void;
|
|
896
|
+
onMouseDrag?: (event: unknown) => void;
|
|
897
|
+
onMouseDragEnd?: (event: unknown) => void;
|
|
898
|
+
onMouseDrop?: (event: unknown) => void;
|
|
899
|
+
onMouseOver?: (event: unknown) => void;
|
|
900
|
+
onMouseOut?: (event: unknown) => void;
|
|
901
|
+
onMouseScroll?: (event: unknown) => void;
|
|
902
|
+
onMouse?: (event: unknown) => void;
|
|
903
|
+
onKeyDown?: (key: unknown) => void;
|
|
904
|
+
onClick?: (event: unknown) => void;
|
|
905
|
+
onSizeChange?: () => void;
|
|
906
|
+
/**
|
|
907
|
+
* Called after each render frame with a buffer handle.
|
|
908
|
+
* Bound to the Box instance (`this` = the renderable).
|
|
909
|
+
* Use this for custom per-frame drawing on top of the box.
|
|
910
|
+
*/
|
|
911
|
+
renderAfter?: (this: Box, buffer: unknown, deltaTime?: number) => void;
|
|
912
|
+
}
|
|
913
|
+
declare class Box extends EventEmitter {
|
|
914
|
+
protected readonly _renderer: CliRenderer;
|
|
915
|
+
protected _nodeId: number;
|
|
916
|
+
protected readonly _id: string;
|
|
917
|
+
protected _focused: boolean;
|
|
918
|
+
protected _visible: boolean;
|
|
919
|
+
protected _isDestroyed: boolean;
|
|
920
|
+
protected _opacity: number;
|
|
921
|
+
protected _backgroundColor: RGBA | null;
|
|
922
|
+
protected _borderStyle: BorderStyleKind;
|
|
923
|
+
protected _border: boolean | BorderSide[];
|
|
924
|
+
protected _borderColor: RGBA;
|
|
925
|
+
protected _focusedBorderColor: RGBA;
|
|
926
|
+
protected _focusable: boolean;
|
|
927
|
+
protected _title: string | undefined;
|
|
928
|
+
protected _titleColor: RGBA | undefined;
|
|
929
|
+
protected _titleAlignment: "left" | "center" | "right";
|
|
930
|
+
protected _children: Map<string, Box>;
|
|
931
|
+
protected _childList: Box[];
|
|
932
|
+
protected _parent: Box | null;
|
|
933
|
+
protected _options: BoxOptions;
|
|
934
|
+
private _renderAfterCallback;
|
|
935
|
+
constructor(renderer: CliRenderer, options?: BoxOptions, existingNodeId?: number);
|
|
936
|
+
get id(): string;
|
|
937
|
+
get nodeId(): number;
|
|
938
|
+
get focused(): boolean;
|
|
939
|
+
get visible(): boolean;
|
|
940
|
+
get isDestroyed(): boolean;
|
|
941
|
+
get opacity(): number;
|
|
942
|
+
get backgroundColor(): RGBA | null;
|
|
943
|
+
get borderStyle(): BorderStyleKind;
|
|
944
|
+
get border(): boolean | BorderSide[];
|
|
945
|
+
get renderer(): CliRenderer;
|
|
946
|
+
get boxOptions(): BoxOptions;
|
|
947
|
+
get parent(): Box | null;
|
|
948
|
+
getEstimatedHeight(): number;
|
|
949
|
+
/** Computed layout width (from options; not the engine-resolved value). */
|
|
950
|
+
get width(): number | string | undefined;
|
|
951
|
+
/** Computed layout height (from options; not the engine-resolved value). */
|
|
952
|
+
get height(): number | string | undefined;
|
|
953
|
+
/** Screen X position (approximate; engine is the source of truth). */
|
|
954
|
+
get x(): number;
|
|
955
|
+
/** Screen Y position (approximate; engine is the source of truth). */
|
|
956
|
+
get y(): number;
|
|
957
|
+
get screenX(): number;
|
|
958
|
+
get screenY(): number;
|
|
959
|
+
set visible(value: boolean);
|
|
960
|
+
set opacity(value: number);
|
|
961
|
+
set backgroundColor(color: ColorInput);
|
|
962
|
+
set borderColor(color: ColorInput);
|
|
963
|
+
set borderStyle(style: BorderStyleKind);
|
|
964
|
+
set border(value: boolean | BorderSide[]);
|
|
965
|
+
set title(value: string | undefined);
|
|
966
|
+
set focusedBorderColor(color: ColorInput);
|
|
967
|
+
set width(value: number | string);
|
|
968
|
+
set height(value: number | string);
|
|
969
|
+
set flexDirection(value: BoxOptions["flexDirection"]);
|
|
970
|
+
set flexGrow(value: number);
|
|
971
|
+
set flexBasis(value: number | string);
|
|
972
|
+
set marginBottom(value: number);
|
|
973
|
+
set marginTop(value: number);
|
|
974
|
+
set marginLeft(value: number);
|
|
975
|
+
set marginRight(value: number);
|
|
976
|
+
set zIndex(value: number);
|
|
977
|
+
add(child: Box, index?: number): void;
|
|
978
|
+
remove(child: Box): void;
|
|
979
|
+
getRenderable(id: string): Box | undefined;
|
|
980
|
+
getChildren(): Box[];
|
|
981
|
+
focus(): void;
|
|
982
|
+
blur(): void;
|
|
983
|
+
destroy(): void;
|
|
984
|
+
destroyRecursively(): void;
|
|
985
|
+
setLayout(layout: Partial<BoxOptions>): void;
|
|
986
|
+
setPosition(pos: {
|
|
987
|
+
top?: number | string;
|
|
988
|
+
left?: number | string;
|
|
989
|
+
right?: number | string;
|
|
990
|
+
bottom?: number | string;
|
|
991
|
+
}): void;
|
|
992
|
+
protected _applyLayout(options: Partial<BoxOptions>): void;
|
|
993
|
+
protected _applyStyle(): void;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Root — the scene root, wrapping the engine's root node.
|
|
997
|
+
* Created automatically by CliRenderer and exposed as `renderer.root`.
|
|
998
|
+
*/
|
|
999
|
+
declare class Root extends Box {
|
|
1000
|
+
constructor(renderer: CliRenderer);
|
|
1001
|
+
destroy(): void;
|
|
1002
|
+
}
|
|
1003
|
+
//#endregion
|
|
1004
|
+
//#region src/devtools/devtools.types.d.ts
|
|
1005
|
+
type LogLevel = "debug" | "info" | "warn" | "error" | "trace";
|
|
1006
|
+
interface LogEntry {
|
|
1007
|
+
id: number;
|
|
1008
|
+
timestamp: number;
|
|
1009
|
+
level: LogLevel;
|
|
1010
|
+
category: string;
|
|
1011
|
+
message: string;
|
|
1012
|
+
data?: unknown | undefined;
|
|
1013
|
+
}
|
|
1014
|
+
type CommandType = "CreateNode" | "RemoveNode" | "AppendChild" | "InsertBefore" | "MoveNode" | "ReplaceNode" | "DetachNode" | "SetText" | "SetStyle" | "SetLayout" | "SetAttribute" | "RemoveAttribute" | "BeginFrame" | "CommitFrame" | "Invalidate" | "Shutdown" | string;
|
|
1015
|
+
interface RecordedCommand {
|
|
1016
|
+
id: number;
|
|
1017
|
+
timestamp: number;
|
|
1018
|
+
type: CommandType;
|
|
1019
|
+
payload: Record<string, unknown>;
|
|
1020
|
+
duration?: number | undefined;
|
|
1021
|
+
}
|
|
1022
|
+
type EventCategory = "keyboard" | "mouse" | "focus" | "resize" | "lifecycle" | "clipboard" | "animation" | "scheduler";
|
|
1023
|
+
interface RecordedEvent {
|
|
1024
|
+
id: number;
|
|
1025
|
+
timestamp: number;
|
|
1026
|
+
category: EventCategory;
|
|
1027
|
+
type: string;
|
|
1028
|
+
target?: string | undefined;
|
|
1029
|
+
data?: unknown | undefined;
|
|
1030
|
+
propagation?: ("captured" | "target" | "bubbled") | undefined;
|
|
1031
|
+
}
|
|
1032
|
+
interface FrameMetrics {
|
|
1033
|
+
frameNumber: number;
|
|
1034
|
+
timestamp: number;
|
|
1035
|
+
duration: number;
|
|
1036
|
+
commandCount: number;
|
|
1037
|
+
dirtyRegionCount: number;
|
|
1038
|
+
renderDuration?: number | undefined;
|
|
1039
|
+
layoutDuration?: number | undefined;
|
|
1040
|
+
paintDuration?: number | undefined;
|
|
1041
|
+
ffiDuration?: number | undefined;
|
|
1042
|
+
}
|
|
1043
|
+
interface PerformanceSnapshot {
|
|
1044
|
+
fps: number;
|
|
1045
|
+
avgFrameTime: number;
|
|
1046
|
+
minFrameTime: number;
|
|
1047
|
+
maxFrameTime: number;
|
|
1048
|
+
totalFrames: number;
|
|
1049
|
+
droppedFrames: number;
|
|
1050
|
+
commandCount: number;
|
|
1051
|
+
dirtyNodeCount: number;
|
|
1052
|
+
memoryUsage?: {
|
|
1053
|
+
heapUsed: number;
|
|
1054
|
+
heapTotal: number;
|
|
1055
|
+
external: number;
|
|
1056
|
+
} | undefined;
|
|
1057
|
+
}
|
|
1058
|
+
interface DevToolsNode {
|
|
1059
|
+
id: string;
|
|
1060
|
+
type: string;
|
|
1061
|
+
props: Record<string, unknown>;
|
|
1062
|
+
style?: Record<string, unknown> | undefined;
|
|
1063
|
+
layout?: {
|
|
1064
|
+
x: number;
|
|
1065
|
+
y: number;
|
|
1066
|
+
width: number;
|
|
1067
|
+
height: number;
|
|
1068
|
+
} | undefined;
|
|
1069
|
+
children: DevToolsNode[];
|
|
1070
|
+
parent?: string | undefined;
|
|
1071
|
+
dirty?: boolean | undefined;
|
|
1072
|
+
visible?: boolean | undefined;
|
|
1073
|
+
zIndex?: number | undefined;
|
|
1074
|
+
}
|
|
1075
|
+
interface SchedulerSnapshot {
|
|
1076
|
+
isRunning: boolean;
|
|
1077
|
+
isRendering: boolean;
|
|
1078
|
+
hasScheduledRender: boolean;
|
|
1079
|
+
frameCount: number;
|
|
1080
|
+
droppedFrames: number;
|
|
1081
|
+
pendingFrames: number;
|
|
1082
|
+
highestPriority: string;
|
|
1083
|
+
idleCallbacksPending: number;
|
|
1084
|
+
animationFramesPending: number;
|
|
1085
|
+
frameBudgetMs: number;
|
|
1086
|
+
utilization: number;
|
|
1087
|
+
}
|
|
1088
|
+
interface FocusSnapshot {
|
|
1089
|
+
focusedNodeId: string | null;
|
|
1090
|
+
previousNodeId: string | null;
|
|
1091
|
+
focusableNodes: string[];
|
|
1092
|
+
tabOrder: string[];
|
|
1093
|
+
currentScope: string | null;
|
|
1094
|
+
}
|
|
1095
|
+
interface TerminalCapabilities {
|
|
1096
|
+
trueColor: boolean;
|
|
1097
|
+
kittyKeyboard: boolean;
|
|
1098
|
+
mouseSupport: boolean;
|
|
1099
|
+
osc52: boolean;
|
|
1100
|
+
osc8: boolean;
|
|
1101
|
+
pixelSupport: boolean;
|
|
1102
|
+
alternateScreen: boolean;
|
|
1103
|
+
terminalBrand: string;
|
|
1104
|
+
terminalSize: {
|
|
1105
|
+
columns: number;
|
|
1106
|
+
rows: number;
|
|
1107
|
+
};
|
|
1108
|
+
syncUpdate: boolean;
|
|
1109
|
+
bracketedPaste: boolean;
|
|
1110
|
+
focusEvents: boolean;
|
|
1111
|
+
strikethrough: boolean;
|
|
1112
|
+
underlineColor: boolean;
|
|
1113
|
+
cursorStyle: boolean;
|
|
1114
|
+
hyperlinks: boolean;
|
|
1115
|
+
inlineImages: boolean;
|
|
1116
|
+
sixel: boolean;
|
|
1117
|
+
}
|
|
1118
|
+
interface TimelineEntry {
|
|
1119
|
+
id: number;
|
|
1120
|
+
timestamp: number;
|
|
1121
|
+
category: EventCategory | "render" | "command" | "layout" | "paint";
|
|
1122
|
+
type: string;
|
|
1123
|
+
duration?: number | undefined;
|
|
1124
|
+
data?: unknown | undefined;
|
|
1125
|
+
}
|
|
1126
|
+
interface TreeSnapshot {
|
|
1127
|
+
id: number;
|
|
1128
|
+
timestamp: number;
|
|
1129
|
+
tree: DevToolsNode;
|
|
1130
|
+
nodeCount: number;
|
|
1131
|
+
}
|
|
1132
|
+
interface SnapshotDiff {
|
|
1133
|
+
added: string[];
|
|
1134
|
+
removed: string[];
|
|
1135
|
+
changed: Array<{
|
|
1136
|
+
id: string;
|
|
1137
|
+
field: string;
|
|
1138
|
+
old: unknown;
|
|
1139
|
+
new: unknown;
|
|
1140
|
+
}>;
|
|
1141
|
+
}
|
|
1142
|
+
interface DiagnosticExport {
|
|
1143
|
+
version: string;
|
|
1144
|
+
timestamp: number;
|
|
1145
|
+
duration: number;
|
|
1146
|
+
logs: readonly LogEntry[];
|
|
1147
|
+
commands: readonly RecordedCommand[];
|
|
1148
|
+
events: readonly RecordedEvent[];
|
|
1149
|
+
frames: readonly FrameMetrics[];
|
|
1150
|
+
performance: PerformanceSnapshot;
|
|
1151
|
+
tree?: DevToolsNode | undefined;
|
|
1152
|
+
scheduler?: SchedulerSnapshot | undefined;
|
|
1153
|
+
focus?: FocusSnapshot | undefined;
|
|
1154
|
+
capabilities?: TerminalCapabilities | undefined;
|
|
1155
|
+
timeline: readonly TimelineEntry[];
|
|
1156
|
+
snapshots: readonly TreeSnapshot[];
|
|
1157
|
+
}
|
|
1158
|
+
//#endregion
|
|
1159
|
+
//#region src/devtools/logger.d.ts
|
|
1160
|
+
interface LoggerOptions {
|
|
1161
|
+
maxEntries?: number;
|
|
1162
|
+
minLevel?: LogLevel | undefined;
|
|
1163
|
+
onEntry?: ((entry: LogEntry) => void) | undefined;
|
|
1164
|
+
}
|
|
1165
|
+
declare class Logger {
|
|
1166
|
+
private entries;
|
|
1167
|
+
private nextId;
|
|
1168
|
+
private minLevel;
|
|
1169
|
+
private maxEntries;
|
|
1170
|
+
private onEntry;
|
|
1171
|
+
constructor(options?: LoggerOptions);
|
|
1172
|
+
private shouldLog;
|
|
1173
|
+
private record;
|
|
1174
|
+
trace(category: string, message: string, data?: unknown): LogEntry;
|
|
1175
|
+
debug(category: string, message: string, data?: unknown): LogEntry;
|
|
1176
|
+
info(category: string, message: string, data?: unknown): LogEntry;
|
|
1177
|
+
warn(category: string, message: string, data?: unknown): LogEntry;
|
|
1178
|
+
error(category: string, message: string, data?: unknown): LogEntry;
|
|
1179
|
+
getEntries(): readonly LogEntry[];
|
|
1180
|
+
getEntriesByLevel(level: LogLevel): LogEntry[];
|
|
1181
|
+
getEntriesByCategory(category: string): LogEntry[];
|
|
1182
|
+
search(query: string): LogEntry[];
|
|
1183
|
+
clear(): void;
|
|
1184
|
+
get count(): number;
|
|
1185
|
+
}
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region src/devtools/commandInspector.d.ts
|
|
1188
|
+
interface CommandInspectorOptions {
|
|
1189
|
+
maxCommands?: number | undefined;
|
|
1190
|
+
onCommand?: ((command: RecordedCommand) => void) | undefined;
|
|
1191
|
+
}
|
|
1192
|
+
declare class CommandInspector {
|
|
1193
|
+
private commands;
|
|
1194
|
+
private nextId;
|
|
1195
|
+
private maxCommands;
|
|
1196
|
+
private onCommand;
|
|
1197
|
+
private commandCounts;
|
|
1198
|
+
constructor(options?: CommandInspectorOptions);
|
|
1199
|
+
record(type: CommandType, payload: Record<string, unknown>, duration?: number): RecordedCommand;
|
|
1200
|
+
getCommands(): readonly RecordedCommand[];
|
|
1201
|
+
getCommandsByType(type: string): RecordedCommand[];
|
|
1202
|
+
getCommandsInRange(start: number, end: number): RecordedCommand[];
|
|
1203
|
+
getCounts(): Map<string, number>;
|
|
1204
|
+
getTotalCount(): number;
|
|
1205
|
+
getRecent(count: number): RecordedCommand[];
|
|
1206
|
+
clear(): void;
|
|
1207
|
+
/** Get a summary of command activity */
|
|
1208
|
+
getSummary(frameCount?: number): {
|
|
1209
|
+
total: number;
|
|
1210
|
+
byType: Record<string, number>;
|
|
1211
|
+
lastTimestamp: number | null;
|
|
1212
|
+
avgCommandsPerFrame: number;
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region src/devtools/eventInspector.d.ts
|
|
1217
|
+
interface EventInspectorOptions {
|
|
1218
|
+
maxEvents?: number | undefined;
|
|
1219
|
+
onEvent?: ((event: RecordedEvent) => void) | undefined;
|
|
1220
|
+
}
|
|
1221
|
+
declare class EventInspector {
|
|
1222
|
+
private events;
|
|
1223
|
+
private nextId;
|
|
1224
|
+
private maxEvents;
|
|
1225
|
+
private onEvent;
|
|
1226
|
+
private categoryCounts;
|
|
1227
|
+
constructor(options?: EventInspectorOptions);
|
|
1228
|
+
record(category: EventCategory, type: string, target?: string, data?: unknown, propagation?: "captured" | "target" | "bubbled"): RecordedEvent;
|
|
1229
|
+
recordKeyboard(key: string, modifiers: {
|
|
1230
|
+
ctrl: boolean;
|
|
1231
|
+
shift: boolean;
|
|
1232
|
+
alt: boolean;
|
|
1233
|
+
meta: boolean;
|
|
1234
|
+
}, target?: string): RecordedEvent;
|
|
1235
|
+
recordMouse(type: string, x: number, y: number, button?: string, target?: string): RecordedEvent;
|
|
1236
|
+
recordFocus(type: "focus" | "blur", nodeId: string): RecordedEvent;
|
|
1237
|
+
recordResize(width: number, height: number, prevWidth?: number, prevHeight?: number): RecordedEvent;
|
|
1238
|
+
recordLifecycle(type: string, data?: unknown): RecordedEvent;
|
|
1239
|
+
getEvents(): readonly RecordedEvent[];
|
|
1240
|
+
getEventsByCategory(category: EventCategory): RecordedEvent[];
|
|
1241
|
+
getEventsByType(type: string): RecordedEvent[];
|
|
1242
|
+
getEventsInRange(start: number, end: number): RecordedEvent[];
|
|
1243
|
+
getCategoryCounts(): Map<string, number>;
|
|
1244
|
+
getRecent(count: number): RecordedEvent[];
|
|
1245
|
+
clear(): void;
|
|
1246
|
+
get count(): number;
|
|
1247
|
+
}
|
|
1248
|
+
//#endregion
|
|
1249
|
+
//#region src/devtools/performance.d.ts
|
|
1250
|
+
interface PerformanceTrackerOptions {
|
|
1251
|
+
maxFrames?: number | undefined;
|
|
1252
|
+
onFrame?: ((metrics: FrameMetrics) => void) | undefined;
|
|
1253
|
+
}
|
|
1254
|
+
declare class PerformanceTracker {
|
|
1255
|
+
private frames;
|
|
1256
|
+
private nextFrameNumber;
|
|
1257
|
+
private maxFrames;
|
|
1258
|
+
private onFrame;
|
|
1259
|
+
private frameStart;
|
|
1260
|
+
private commandCountAtStart;
|
|
1261
|
+
constructor(options?: PerformanceTrackerOptions);
|
|
1262
|
+
/** Call at the start of a frame */
|
|
1263
|
+
beginFrame(commandCount: number): void;
|
|
1264
|
+
/** Call at the end of a frame with metrics */
|
|
1265
|
+
endFrame(options: {
|
|
1266
|
+
dirtyRegionCount?: number;
|
|
1267
|
+
renderDuration?: number;
|
|
1268
|
+
layoutDuration?: number;
|
|
1269
|
+
paintDuration?: number;
|
|
1270
|
+
ffiDuration?: number;
|
|
1271
|
+
}): FrameMetrics;
|
|
1272
|
+
/** Record a frame with all metrics at once */
|
|
1273
|
+
recordFrame(metrics: Partial<FrameMetrics> & {
|
|
1274
|
+
duration: number;
|
|
1275
|
+
}): FrameMetrics;
|
|
1276
|
+
getFrames(): readonly FrameMetrics[];
|
|
1277
|
+
getRecentFrames(count: number): FrameMetrics[];
|
|
1278
|
+
/** Calculate current FPS based on recent frames */
|
|
1279
|
+
getFps(sampleSize?: number): number;
|
|
1280
|
+
/** Get a full performance snapshot */
|
|
1281
|
+
getSnapshot(): PerformanceSnapshot;
|
|
1282
|
+
clear(): void;
|
|
1283
|
+
get count(): number;
|
|
1284
|
+
}
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region src/devtools/treeInspector.d.ts
|
|
1287
|
+
interface TreeInspectorOptions {
|
|
1288
|
+
onTreeUpdate?: ((root: DevToolsNode | null) => void) | undefined;
|
|
1289
|
+
}
|
|
1290
|
+
declare class TreeInspector {
|
|
1291
|
+
private root;
|
|
1292
|
+
private nodeIndex;
|
|
1293
|
+
private dirtyNodes;
|
|
1294
|
+
private onTreeUpdate;
|
|
1295
|
+
constructor(options?: TreeInspectorOptions);
|
|
1296
|
+
/** Build a tree from a flat list of node descriptors */
|
|
1297
|
+
buildTree(nodes: Array<{
|
|
1298
|
+
id: string;
|
|
1299
|
+
type: string;
|
|
1300
|
+
parent?: string;
|
|
1301
|
+
props?: Record<string, unknown>;
|
|
1302
|
+
style?: Record<string, unknown>;
|
|
1303
|
+
layout?: {
|
|
1304
|
+
x: number;
|
|
1305
|
+
y: number;
|
|
1306
|
+
width: number;
|
|
1307
|
+
height: number;
|
|
1308
|
+
};
|
|
1309
|
+
dirty?: boolean;
|
|
1310
|
+
visible?: boolean;
|
|
1311
|
+
zIndex?: number;
|
|
1312
|
+
}>): DevToolsNode;
|
|
1313
|
+
/** Update a single node's properties */
|
|
1314
|
+
updateNode(id: string, updates: Partial<Omit<DevToolsNode, "id" | "children">>): void;
|
|
1315
|
+
/** Mark a node as dirty */
|
|
1316
|
+
markDirty(id: string): void;
|
|
1317
|
+
/** Clear dirty state for all nodes */
|
|
1318
|
+
clearDirty(): void;
|
|
1319
|
+
getNode(id: string): DevToolsNode | undefined;
|
|
1320
|
+
getRoot(): DevToolsNode | null;
|
|
1321
|
+
getDirtyNodes(): DevToolsNode[];
|
|
1322
|
+
/** Find nodes matching a predicate */
|
|
1323
|
+
findNodes(predicate: (node: DevToolsNode) => boolean): DevToolsNode[];
|
|
1324
|
+
/** Get the path from root to a given node */
|
|
1325
|
+
getPath(nodeId: string): DevToolsNode[];
|
|
1326
|
+
/** Count total nodes in the tree */
|
|
1327
|
+
countNodes(): number;
|
|
1328
|
+
/** Get all nodes as a flat array */
|
|
1329
|
+
getAllNodes(): DevToolsNode[];
|
|
1330
|
+
clear(): void;
|
|
1331
|
+
}
|
|
1332
|
+
//#endregion
|
|
1333
|
+
//#region src/devtools/schedulerInspector.d.ts
|
|
1334
|
+
interface SchedulerInspectorOptions {
|
|
1335
|
+
onFrameDrop?: ((droppedCount: number) => void) | undefined;
|
|
1336
|
+
}
|
|
1337
|
+
declare class SchedulerInspector {
|
|
1338
|
+
private frameCount;
|
|
1339
|
+
private droppedFrames;
|
|
1340
|
+
private pendingFrames;
|
|
1341
|
+
private isRunning;
|
|
1342
|
+
private isRendering;
|
|
1343
|
+
private hasScheduledRender;
|
|
1344
|
+
private highestPriority;
|
|
1345
|
+
private idleCallbacksPending;
|
|
1346
|
+
private animationFramesPending;
|
|
1347
|
+
private frameBudgetMs;
|
|
1348
|
+
private utilization;
|
|
1349
|
+
private onFrameDrop;
|
|
1350
|
+
constructor(options?: SchedulerInspectorOptions);
|
|
1351
|
+
updateState(state: Partial<SchedulerSnapshot>): void;
|
|
1352
|
+
recordFrameDrop(): void;
|
|
1353
|
+
incrementFrameCount(): void;
|
|
1354
|
+
getSnapshot(): SchedulerSnapshot;
|
|
1355
|
+
getDropRate(): number;
|
|
1356
|
+
clear(): void;
|
|
1357
|
+
}
|
|
1358
|
+
//#endregion
|
|
1359
|
+
//#region src/devtools/focusInspector.d.ts
|
|
1360
|
+
interface FocusInspectorOptions {
|
|
1361
|
+
onFocusChange?: ((snapshot: FocusSnapshot) => void) | undefined;
|
|
1362
|
+
}
|
|
1363
|
+
declare class FocusInspector {
|
|
1364
|
+
private focusedNodeId;
|
|
1365
|
+
private previousNodeId;
|
|
1366
|
+
private focusableNodes;
|
|
1367
|
+
private tabOrder;
|
|
1368
|
+
private currentScope;
|
|
1369
|
+
private focusHistory;
|
|
1370
|
+
private onFocusChange;
|
|
1371
|
+
constructor(options?: FocusInspectorOptions);
|
|
1372
|
+
recordFocus(nodeId: string): void;
|
|
1373
|
+
recordBlur(nodeId: string): void;
|
|
1374
|
+
setFocusableNodes(nodes: string[]): void;
|
|
1375
|
+
setTabOrder(order: string[]): void;
|
|
1376
|
+
setScope(scope: string | null): void;
|
|
1377
|
+
getSnapshot(): FocusSnapshot;
|
|
1378
|
+
getFocusHistory(): Array<{
|
|
1379
|
+
timestamp: number;
|
|
1380
|
+
nodeId: string | null;
|
|
1381
|
+
type: "focus" | "blur";
|
|
1382
|
+
}>;
|
|
1383
|
+
getRecentFocusChanges(count: number): Array<{
|
|
1384
|
+
timestamp: number;
|
|
1385
|
+
nodeId: string | null;
|
|
1386
|
+
type: "focus" | "blur";
|
|
1387
|
+
}>;
|
|
1388
|
+
isFocused(nodeId: string): boolean;
|
|
1389
|
+
clear(): void;
|
|
1390
|
+
}
|
|
1391
|
+
//#endregion
|
|
1392
|
+
//#region src/devtools/capabilityInspector.d.ts
|
|
1393
|
+
interface CapabilityInspectorOptions {
|
|
1394
|
+
onCapabilitiesDetected?: ((caps: TerminalCapabilities) => void) | undefined;
|
|
1395
|
+
}
|
|
1396
|
+
declare class CapabilityInspector {
|
|
1397
|
+
private capabilities;
|
|
1398
|
+
private onCapabilitiesDetected;
|
|
1399
|
+
constructor(options?: CapabilityInspectorOptions);
|
|
1400
|
+
update(capabilities: Partial<TerminalCapabilities>): void;
|
|
1401
|
+
updateFromNative(capabilitiesJson: string): void;
|
|
1402
|
+
get(): TerminalCapabilities;
|
|
1403
|
+
has(capability: keyof TerminalCapabilities): boolean;
|
|
1404
|
+
getSummary(): string[];
|
|
1405
|
+
clear(): void;
|
|
1406
|
+
}
|
|
1407
|
+
//#endregion
|
|
1408
|
+
//#region src/devtools/timeline.d.ts
|
|
1409
|
+
interface DevToolsTimelineOptions {
|
|
1410
|
+
maxEntries?: number | undefined;
|
|
1411
|
+
onEntry?: ((entry: TimelineEntry) => void) | undefined;
|
|
1412
|
+
}
|
|
1413
|
+
declare class DevToolsTimeline {
|
|
1414
|
+
private entries;
|
|
1415
|
+
private nextId;
|
|
1416
|
+
private maxEntries;
|
|
1417
|
+
private onEntry;
|
|
1418
|
+
constructor(options?: DevToolsTimelineOptions);
|
|
1419
|
+
record(category: TimelineEntry["category"], type: string, duration?: number, data?: unknown): TimelineEntry;
|
|
1420
|
+
recordRender(duration: number, data?: unknown): TimelineEntry;
|
|
1421
|
+
recordCommand(type: string, duration?: number): TimelineEntry;
|
|
1422
|
+
recordEvent(category: EventCategory, type: string, data?: unknown): TimelineEntry;
|
|
1423
|
+
getEntries(): readonly TimelineEntry[];
|
|
1424
|
+
getEntriesByCategory(category: TimelineEntry["category"]): TimelineEntry[];
|
|
1425
|
+
getEntriesInRange(start: number, end: number): TimelineEntry[];
|
|
1426
|
+
getRecent(count: number): TimelineEntry[];
|
|
1427
|
+
/** Get entries grouped by time windows */
|
|
1428
|
+
getGroupedByWindow(windowMs: number): Array<{
|
|
1429
|
+
start: number;
|
|
1430
|
+
end: number;
|
|
1431
|
+
entries: TimelineEntry[];
|
|
1432
|
+
}>;
|
|
1433
|
+
clear(): void;
|
|
1434
|
+
get count(): number;
|
|
1435
|
+
}
|
|
1436
|
+
//#endregion
|
|
1437
|
+
//#region src/devtools/snapshot.d.ts
|
|
1438
|
+
interface SnapshotOptions {
|
|
1439
|
+
maxSnapshots?: number | undefined;
|
|
1440
|
+
}
|
|
1441
|
+
declare class SnapshotManager {
|
|
1442
|
+
private snapshots;
|
|
1443
|
+
private nextId;
|
|
1444
|
+
private maxSnapshots;
|
|
1445
|
+
constructor(options?: SnapshotOptions);
|
|
1446
|
+
/** Capture a snapshot of the current tree */
|
|
1447
|
+
capture(tree: DevToolsNode): TreeSnapshot;
|
|
1448
|
+
/** Compare two snapshots and return the diff */
|
|
1449
|
+
diff(snapshotA: number, snapshotB: number): SnapshotDiff | null;
|
|
1450
|
+
/** Compare two trees */
|
|
1451
|
+
diffTrees(a: DevToolsNode, b: DevToolsNode): SnapshotDiff;
|
|
1452
|
+
getSnapshots(): readonly TreeSnapshot[];
|
|
1453
|
+
getSnapshot(id: number): TreeSnapshot | undefined;
|
|
1454
|
+
private flattenTree;
|
|
1455
|
+
private countNodes;
|
|
1456
|
+
clear(): void;
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1459
|
+
//#region src/devtools/export.d.ts
|
|
1460
|
+
interface ExportOptions {
|
|
1461
|
+
/** Include logs in the export */
|
|
1462
|
+
includeLogs?: boolean | undefined;
|
|
1463
|
+
/** Include commands in the export */
|
|
1464
|
+
includeCommands?: boolean | undefined;
|
|
1465
|
+
/** Include events in the export */
|
|
1466
|
+
includeEvents?: boolean | undefined;
|
|
1467
|
+
/** Include frame metrics in the export */
|
|
1468
|
+
includeFrames?: boolean | undefined;
|
|
1469
|
+
/** Include timeline in the export */
|
|
1470
|
+
includeTimeline?: boolean | undefined;
|
|
1471
|
+
/** Include snapshots in the export */
|
|
1472
|
+
includeSnapshots?: boolean | undefined;
|
|
1473
|
+
}
|
|
1474
|
+
interface ExportData {
|
|
1475
|
+
/** Logs to include */
|
|
1476
|
+
logs?: readonly LogEntry[] | undefined;
|
|
1477
|
+
/** Commands to include */
|
|
1478
|
+
commands?: readonly RecordedCommand[] | undefined;
|
|
1479
|
+
/** Events to include */
|
|
1480
|
+
events?: readonly RecordedEvent[] | undefined;
|
|
1481
|
+
/** Frame metrics to include */
|
|
1482
|
+
frames?: readonly FrameMetrics[] | undefined;
|
|
1483
|
+
/** Performance snapshot */
|
|
1484
|
+
performance?: PerformanceSnapshot | undefined;
|
|
1485
|
+
/** Render tree */
|
|
1486
|
+
tree?: DevToolsNode | undefined;
|
|
1487
|
+
/** Scheduler snapshot */
|
|
1488
|
+
scheduler?: SchedulerSnapshot | undefined;
|
|
1489
|
+
/** Focus snapshot */
|
|
1490
|
+
focus?: FocusSnapshot | undefined;
|
|
1491
|
+
/** Terminal capabilities */
|
|
1492
|
+
capabilities?: TerminalCapabilities | undefined;
|
|
1493
|
+
/** Timeline entries */
|
|
1494
|
+
timeline?: readonly TimelineEntry[] | undefined;
|
|
1495
|
+
/** Tree snapshots */
|
|
1496
|
+
snapshots?: readonly TreeSnapshot[] | undefined;
|
|
1497
|
+
}
|
|
1498
|
+
/** Create a diagnostic export from collected data */
|
|
1499
|
+
declare function createExport(data: ExportData, options?: ExportOptions): DiagnosticExport;
|
|
1500
|
+
/** Serialize a diagnostic export to JSON */
|
|
1501
|
+
declare function exportToJson(exportData: DiagnosticExport): string;
|
|
1502
|
+
/** Create a summary report from a diagnostic export */
|
|
1503
|
+
declare function createSummary(exportData: DiagnosticExport): string;
|
|
1504
|
+
//#endregion
|
|
1505
|
+
//#region src/lib/outputCapture.d.ts
|
|
1506
|
+
declare class Capture extends EventEmitter {
|
|
1507
|
+
private outputCache;
|
|
1508
|
+
get size(): number;
|
|
1509
|
+
write(stream: "stdout" | "stderr", data: string): void;
|
|
1510
|
+
claimOutput(): string;
|
|
1511
|
+
clear(): void;
|
|
1512
|
+
}
|
|
1513
|
+
//#endregion
|
|
1514
|
+
//#region src/devtools/consoleCapture.d.ts
|
|
1515
|
+
declare enum ConsoleLogLevel {
|
|
1516
|
+
LOG = "LOG",
|
|
1517
|
+
INFO = "INFO",
|
|
1518
|
+
WARN = "WARN",
|
|
1519
|
+
ERROR = "ERROR",
|
|
1520
|
+
DEBUG = "DEBUG"
|
|
1521
|
+
}
|
|
1522
|
+
interface CallerInfo {
|
|
1523
|
+
functionName: string;
|
|
1524
|
+
fullPath: string;
|
|
1525
|
+
fileName: string;
|
|
1526
|
+
lineNumber: number;
|
|
1527
|
+
columnNumber: number;
|
|
1528
|
+
}
|
|
1529
|
+
type ConsoleLogEntry = [Date, ConsoleLogLevel, unknown[], CallerInfo | null];
|
|
1530
|
+
declare const capture: Capture;
|
|
1531
|
+
declare class TerminalConsoleCache extends EventEmitter {
|
|
1532
|
+
private _cachedLogs;
|
|
1533
|
+
private readonly MAX_CACHE_SIZE;
|
|
1534
|
+
private _collectCallerInfo;
|
|
1535
|
+
private _cachingEnabled;
|
|
1536
|
+
private _originalConsole;
|
|
1537
|
+
private _active;
|
|
1538
|
+
get cachedLogs(): ConsoleLogEntry[];
|
|
1539
|
+
activate(): void;
|
|
1540
|
+
private setupConsoleCapture;
|
|
1541
|
+
private overrideConsoleMethods;
|
|
1542
|
+
setCollectCallerInfo(enabled: boolean): void;
|
|
1543
|
+
clearConsole(): void;
|
|
1544
|
+
setCachingEnabled(enabled: boolean): void;
|
|
1545
|
+
deactivate(): void;
|
|
1546
|
+
private restoreOriginalConsole;
|
|
1547
|
+
addLogEntry(level: ConsoleLogLevel, ...args: unknown[]): ConsoleLogEntry;
|
|
1548
|
+
private appendToConsole;
|
|
1549
|
+
destroy(): void;
|
|
1550
|
+
}
|
|
1551
|
+
declare const terminalConsoleCache: TerminalConsoleCache;
|
|
1552
|
+
//#endregion
|
|
1553
|
+
//#region src/platform/logger.d.ts
|
|
1554
|
+
type LogLevel$1 = "trace" | "debug" | "info" | "warn" | "error";
|
|
1555
|
+
interface LoggerConfig {
|
|
1556
|
+
level?: LogLevel$1;
|
|
1557
|
+
color?: boolean;
|
|
1558
|
+
timestamp?: boolean;
|
|
1559
|
+
module?: boolean;
|
|
1560
|
+
thread?: boolean;
|
|
1561
|
+
/**
|
|
1562
|
+
* Explicit log file path. When set, file logging is enabled in any mode and
|
|
1563
|
+
* writes to exactly this path. Overridden by the `BETTERTUI_LOG_DIR` env var.
|
|
1564
|
+
*/
|
|
1565
|
+
file?: string;
|
|
1566
|
+
maxFileSize?: number;
|
|
1567
|
+
maxFiles?: number;
|
|
1568
|
+
/**
|
|
1569
|
+
* Development mode. When `true` and no explicit `file` is given, logs are
|
|
1570
|
+
* written to a daily file under the repo-root `logs/` directory (and still
|
|
1571
|
+
* mirrored to the terminal). When `false` (production), file logging stays
|
|
1572
|
+
* OFF unless an explicit `file` path (or `BETTERTUI_LOG_DIR`) is provided.
|
|
1573
|
+
*
|
|
1574
|
+
* `CliRenderer` defaults this to `process.env.NODE_ENV !== "production"` when
|
|
1575
|
+
* the caller does not set it explicitly.
|
|
1576
|
+
*/
|
|
1577
|
+
dev?: boolean;
|
|
1578
|
+
}
|
|
1579
|
+
interface DiagnosticSnapshot {
|
|
1580
|
+
renderCalls: number;
|
|
1581
|
+
renderBytes: number;
|
|
1582
|
+
eventDispatches: number;
|
|
1583
|
+
layoutComputations: number;
|
|
1584
|
+
cacheHits: number;
|
|
1585
|
+
cacheMisses: number;
|
|
1586
|
+
allocations: number;
|
|
1587
|
+
averageFrameTime: number;
|
|
1588
|
+
fps: number;
|
|
1589
|
+
}
|
|
1590
|
+
interface Logger$1 {
|
|
1591
|
+
init(config: LoggerConfig): void;
|
|
1592
|
+
setLevel(level: LogLevel$1): void;
|
|
1593
|
+
getLevel(): LogLevel$1;
|
|
1594
|
+
setModuleFilter(include?: string[], exclude?: string[]): void;
|
|
1595
|
+
getDiagnostics(): DiagnosticSnapshot;
|
|
1596
|
+
flush(): void;
|
|
1597
|
+
}
|
|
1598
|
+
declare function cacheHitRatio(snapshot: DiagnosticSnapshot): number;
|
|
1599
|
+
//#endregion
|
|
1600
|
+
//#region src/devtools/overlay/overlayHost.d.ts
|
|
1601
|
+
/** Corner the overlay is anchored to. */
|
|
1602
|
+
type OverlayCorner = "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
|
1603
|
+
/** The minimal renderer surface the overlay reads from. */
|
|
1604
|
+
interface OverlayRenderer {
|
|
1605
|
+
readonly terminalWidth: number;
|
|
1606
|
+
readonly viewportHeight: number;
|
|
1607
|
+
getDiagnostics(): DiagnosticSnapshot;
|
|
1608
|
+
write(text: string): void;
|
|
1609
|
+
}
|
|
1610
|
+
interface OverlayHostOptions {
|
|
1611
|
+
/** Corner to anchor panels to. Defaults to top-right. */
|
|
1612
|
+
corner?: OverlayCorner;
|
|
1613
|
+
/** Inner width of each panel in columns. Defaults to 28. */
|
|
1614
|
+
panelWidth?: number;
|
|
1615
|
+
/** Max rows a scrolling panel (events/tree) may show. Defaults to 8. */
|
|
1616
|
+
panelBodyRows?: number;
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Owns per-frame ANSI compositing of the debug overlay.
|
|
1620
|
+
*
|
|
1621
|
+
* The overlay is written *over* the engine's incremental output and is not part
|
|
1622
|
+
* of the engine's dirty-diff, so the host tracks the rect it painted last frame
|
|
1623
|
+
* and clears any rows that are no longer covered — preventing trails when a
|
|
1624
|
+
* panel shrinks, moves, or is toggled off.
|
|
1625
|
+
*/
|
|
1626
|
+
declare class OverlayHost {
|
|
1627
|
+
private readonly renderer;
|
|
1628
|
+
private readonly devtools;
|
|
1629
|
+
private corner;
|
|
1630
|
+
private panelWidth;
|
|
1631
|
+
private panelBodyRows;
|
|
1632
|
+
/** Rows (1-based) painted on the previous frame, and their painted width. */
|
|
1633
|
+
private previousRows;
|
|
1634
|
+
private lastDirtyRegionCount;
|
|
1635
|
+
constructor(renderer: OverlayRenderer, devtools: DevTools, options?: OverlayHostOptions);
|
|
1636
|
+
/** Whether any panel is currently visible. */
|
|
1637
|
+
get visible(): boolean;
|
|
1638
|
+
configure(options: OverlayHostOptions): void;
|
|
1639
|
+
/** Record the engine's reported dirty-region count for the current frame. */
|
|
1640
|
+
setDirtyRegionCount(count: number): void;
|
|
1641
|
+
/**
|
|
1642
|
+
* Composite the visible panels over the current frame. Saves the cursor,
|
|
1643
|
+
* clears rows vacated since the last paint, draws each visible panel, then
|
|
1644
|
+
* restores the cursor. A no-op when nothing is visible (but still clears any
|
|
1645
|
+
* previously-painted rows exactly once).
|
|
1646
|
+
*/
|
|
1647
|
+
paint(): void;
|
|
1648
|
+
/**
|
|
1649
|
+
* Force-clear the whole overlay region (used on toggle-off before a full
|
|
1650
|
+
* redraw). Returns nothing; writes directly.
|
|
1651
|
+
*/
|
|
1652
|
+
clear(): void;
|
|
1653
|
+
private clearPreviousOnly;
|
|
1654
|
+
/** Build the framed lines for all visible panels, stacked vertically. */
|
|
1655
|
+
private buildFrame;
|
|
1656
|
+
private startColumn;
|
|
1657
|
+
private startRow;
|
|
1658
|
+
}
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region src/devtools/overlay/panel.types.d.ts
|
|
1661
|
+
/**
|
|
1662
|
+
* Identifiers for the built-in debug panels.
|
|
1663
|
+
*
|
|
1664
|
+
* Panels map to the six diagnostics surfaces from the design proposal (§6.2):
|
|
1665
|
+
* performance, tree, layout, events, dirty-regions, and render statistics.
|
|
1666
|
+
* Panels 1 and 6 (performance + render statistics) share a single rendered
|
|
1667
|
+
* panel; both live under {@link DebugPanel.Performance}.
|
|
1668
|
+
*/
|
|
1669
|
+
declare enum DebugPanel {
|
|
1670
|
+
/** Panel 1 + 6 — FPS, frame timing, render calls, bytes, cache, memory. */
|
|
1671
|
+
Performance = "performance",
|
|
1672
|
+
/** Panel 2 — node tree viewer (display-only in the all-TS pass). */
|
|
1673
|
+
Tree = "tree",
|
|
1674
|
+
/** Panel 3 — layout inspector (box model, flex, computed dims). */
|
|
1675
|
+
Layout = "layout",
|
|
1676
|
+
/** Panel 4 — event tracer (key/mouse/focus/resize log). */
|
|
1677
|
+
Events = "events",
|
|
1678
|
+
/** Panel 5 — dirty-region visualizer (stats-level in the all-TS pass). */
|
|
1679
|
+
DirtyRegions = "dirtyRegions"
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Context handed to a {@link Panel} each frame. Panels are pure renderers:
|
|
1683
|
+
* they read from the DevTools facade and diagnostics and return lines.
|
|
1684
|
+
*/
|
|
1685
|
+
interface PanelContext {
|
|
1686
|
+
/** The live DevTools facade (inspectors + queries). */
|
|
1687
|
+
readonly devtools: DevTools;
|
|
1688
|
+
/** Engine diagnostics snapshot for the current frame. */
|
|
1689
|
+
readonly diagnostics: {
|
|
1690
|
+
renderCalls: number;
|
|
1691
|
+
renderBytes: number;
|
|
1692
|
+
eventDispatches: number;
|
|
1693
|
+
layoutComputations: number;
|
|
1694
|
+
cacheHits: number;
|
|
1695
|
+
cacheMisses: number;
|
|
1696
|
+
allocations: number;
|
|
1697
|
+
averageFrameTime: number;
|
|
1698
|
+
fps: number;
|
|
1699
|
+
};
|
|
1700
|
+
/** Dirty-region count reported by the last engine frame. */
|
|
1701
|
+
readonly dirtyRegionCount: number;
|
|
1702
|
+
/** Maximum width a panel may occupy (columns). */
|
|
1703
|
+
readonly maxWidth: number;
|
|
1704
|
+
/** Maximum height a panel may occupy (rows). */
|
|
1705
|
+
readonly maxHeight: number;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* A debug panel: a pure function from state to lines. The {@link OverlayHost}
|
|
1709
|
+
* positions the returned lines; a panel never writes to stdout itself.
|
|
1710
|
+
*/
|
|
1711
|
+
interface Panel {
|
|
1712
|
+
/** Which panel this renders. */
|
|
1713
|
+
readonly id: DebugPanel;
|
|
1714
|
+
/** Title shown in the panel's header. */
|
|
1715
|
+
readonly title: string;
|
|
1716
|
+
/** Produce the panel body as an array of plain (unpositioned) lines. */
|
|
1717
|
+
render(ctx: PanelContext): string[];
|
|
1718
|
+
}
|
|
1719
|
+
declare namespace ansiUtils_d_exports {
|
|
1720
|
+
export { BoxChars, DrawBoxOptions, RESET$1 as RESET, RESTORE_CURSOR, ROUNDED_BOX, SAVE_CURSOR, SHARP_BOX, bar, bg$1 as bg, displayWidth, drawBox, fg$1 as fg, moveTo, padEnd, padStart, sgr, sparkline, stripAnsi, truncate };
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* ANSI helpers for the debug overlay.
|
|
1724
|
+
*
|
|
1725
|
+
* The overlay is composited by writing absolute-positioned ANSI to stdout
|
|
1726
|
+
* *after* the engine's frame output (the engine returns finished base64 ANSI
|
|
1727
|
+
* bytes; there is no TS-accessible cell buffer). These helpers build the escape
|
|
1728
|
+
* sequences and lay out box-drawn panels. All coordinates are 1-based to match
|
|
1729
|
+
* the terminal's `CSI row;col H` convention.
|
|
1730
|
+
*/
|
|
1731
|
+
/** Save the cursor position (DEC save). */
|
|
1732
|
+
declare const SAVE_CURSOR = "7";
|
|
1733
|
+
/** Restore the cursor position (DEC restore). */
|
|
1734
|
+
declare const RESTORE_CURSOR = "8";
|
|
1735
|
+
/** Reset all SGR attributes. */
|
|
1736
|
+
declare const RESET$1 = "[0m";
|
|
1737
|
+
/** Move the cursor to an absolute (row, col), both 1-based. */
|
|
1738
|
+
declare function moveTo(row: number, col: number): string;
|
|
1739
|
+
/** Wrap text in an SGR sequence and a reset. */
|
|
1740
|
+
declare function sgr(text: string, ...codes: number[]): string;
|
|
1741
|
+
/** 24-bit foreground color. */
|
|
1742
|
+
declare function fg$1(r: number, g: number, b: number): string;
|
|
1743
|
+
/** 24-bit background color. */
|
|
1744
|
+
declare function bg$1(r: number, g: number, b: number): string;
|
|
1745
|
+
/** Strip ANSI escape sequences from a string. */
|
|
1746
|
+
declare function stripAnsi(text: string): string;
|
|
1747
|
+
/** Visible width of a string (ANSI-aware, treats each code point as width 1). */
|
|
1748
|
+
declare function displayWidth(text: string): number;
|
|
1749
|
+
/**
|
|
1750
|
+
* Truncate a string to a visible width, appending an ellipsis when clipped.
|
|
1751
|
+
* ANSI-unaware truncation would corrupt escape sequences, so callers should
|
|
1752
|
+
* pass plain text; styling is applied by the panel afterwards.
|
|
1753
|
+
*/
|
|
1754
|
+
declare function truncate(text: string, width: number, ellipsis?: string): string;
|
|
1755
|
+
/** Right-pad plain text to a fixed visible width. */
|
|
1756
|
+
declare function padEnd(text: string, width: number, fill?: string): string;
|
|
1757
|
+
/** Left-pad plain text to a fixed visible width. */
|
|
1758
|
+
declare function padStart(text: string, width: number, fill?: string): string;
|
|
1759
|
+
interface BoxChars {
|
|
1760
|
+
topLeft: string;
|
|
1761
|
+
topRight: string;
|
|
1762
|
+
bottomLeft: string;
|
|
1763
|
+
bottomRight: string;
|
|
1764
|
+
horizontal: string;
|
|
1765
|
+
vertical: string;
|
|
1766
|
+
}
|
|
1767
|
+
declare const ROUNDED_BOX: BoxChars;
|
|
1768
|
+
declare const SHARP_BOX: BoxChars;
|
|
1769
|
+
interface DrawBoxOptions {
|
|
1770
|
+
title?: string | undefined;
|
|
1771
|
+
/** Inner content width (columns between the vertical borders). */
|
|
1772
|
+
width: number;
|
|
1773
|
+
chars?: BoxChars;
|
|
1774
|
+
/** Optional style codes applied to the border characters. */
|
|
1775
|
+
borderSgr?: number[];
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Draw a box around the given content lines. Content is truncated/padded to the
|
|
1779
|
+
* requested inner width. Returns the framed lines (borders included), each a
|
|
1780
|
+
* complete row of the panel. Lines do not include positioning; the host places
|
|
1781
|
+
* them with {@link moveTo}.
|
|
1782
|
+
*/
|
|
1783
|
+
declare function drawBox(lines: string[], options: DrawBoxOptions): string[];
|
|
1784
|
+
/** Render a numeric series as a unicode sparkline of the given width. */
|
|
1785
|
+
declare function sparkline(values: number[], width: number): string;
|
|
1786
|
+
/** Render a 0..1 ratio as a horizontal bar of the given width. */
|
|
1787
|
+
declare function bar(ratio: number, width: number, filledChar?: string, emptyChar?: string): string;
|
|
1788
|
+
//#endregion
|
|
1789
|
+
//#region src/devtools/index.d.ts
|
|
1790
|
+
/** Memory statistics captured from the Node.js process. */
|
|
1791
|
+
interface MemoryStats {
|
|
1792
|
+
heapUsed: number;
|
|
1793
|
+
heapTotal: number;
|
|
1794
|
+
external: number;
|
|
1795
|
+
rss: number;
|
|
1796
|
+
arrayBuffers: number;
|
|
1797
|
+
}
|
|
1798
|
+
/** A lightweight console surface backed by the DevTools logger. */
|
|
1799
|
+
interface DebugConsole {
|
|
1800
|
+
log(...args: unknown[]): void;
|
|
1801
|
+
info(...args: unknown[]): void;
|
|
1802
|
+
warn(...args: unknown[]): void;
|
|
1803
|
+
error(...args: unknown[]): void;
|
|
1804
|
+
debug(...args: unknown[]): void;
|
|
1805
|
+
/** Recent console entries, most-recent last. */
|
|
1806
|
+
entries(): readonly LogEntry[];
|
|
1807
|
+
clear(): void;
|
|
1808
|
+
}
|
|
1809
|
+
interface DevTools {
|
|
1810
|
+
/** Whether DevTools is enabled */
|
|
1811
|
+
readonly enabled: boolean;
|
|
1812
|
+
/** Structured logger */
|
|
1813
|
+
readonly logger: Logger;
|
|
1814
|
+
/** Command inspector — records every command emitted */
|
|
1815
|
+
readonly commands: CommandInspector;
|
|
1816
|
+
/** Event inspector — tracks keyboard, mouse, focus, resize events */
|
|
1817
|
+
readonly events: EventInspector;
|
|
1818
|
+
/** Performance tracker — frame timing, FPS, metrics */
|
|
1819
|
+
readonly performance: PerformanceTracker;
|
|
1820
|
+
/** Tree inspector — render tree, props, styles, layout */
|
|
1821
|
+
readonly tree: TreeInspector;
|
|
1822
|
+
/** Scheduler inspector — frame budget, drops, callbacks */
|
|
1823
|
+
readonly scheduler: SchedulerInspector;
|
|
1824
|
+
/** Focus inspector — focused node, tab order, scopes */
|
|
1825
|
+
readonly focus: FocusInspector;
|
|
1826
|
+
/** Terminal capability inspector */
|
|
1827
|
+
readonly capabilities: CapabilityInspector;
|
|
1828
|
+
/** Timeline — chronological event recording */
|
|
1829
|
+
readonly timeline: DevToolsTimeline;
|
|
1830
|
+
/** Snapshot manager — capture and compare tree states */
|
|
1831
|
+
readonly snapshots: SnapshotManager;
|
|
1832
|
+
/** Lightweight console surface backed by the logger */
|
|
1833
|
+
readonly console: DebugConsole;
|
|
1834
|
+
/** Panels the host overlay should currently render. */
|
|
1835
|
+
readonly visiblePanels: ReadonlySet<DebugPanel>;
|
|
1836
|
+
/** Show a debug panel. */
|
|
1837
|
+
show(panel: DebugPanel): void;
|
|
1838
|
+
/** Hide a debug panel. */
|
|
1839
|
+
hide(panel: DebugPanel): void;
|
|
1840
|
+
/** Toggle a debug panel's visibility. Returns the new visibility. */
|
|
1841
|
+
toggle(panel: DebugPanel): boolean;
|
|
1842
|
+
/** Whether a given panel is currently visible. */
|
|
1843
|
+
isVisible(panel: DebugPanel): boolean;
|
|
1844
|
+
/** Current performance snapshot. */
|
|
1845
|
+
getStats(): PerformanceSnapshot;
|
|
1846
|
+
/** Begin capturing a profiling window. */
|
|
1847
|
+
startProfiling(): void;
|
|
1848
|
+
/** Stop the current profiling window and return the frames captured. */
|
|
1849
|
+
stopProfiling(): readonly FrameMetrics[];
|
|
1850
|
+
/** Inspect a node by id; returns its recorded tree node if known. */
|
|
1851
|
+
inspect(nodeId: string): DevToolsNode | undefined;
|
|
1852
|
+
/** Highlight a node (records the highlight target for the overlay). */
|
|
1853
|
+
highlight(nodeId: string): void;
|
|
1854
|
+
/** Clear any active highlight. */
|
|
1855
|
+
clearHighlight(): void;
|
|
1856
|
+
/** The currently highlighted node id, if any. */
|
|
1857
|
+
readonly highlightedNodeId: string | null;
|
|
1858
|
+
/** Enable or disable live event tracing. */
|
|
1859
|
+
traceEvents(enabled: boolean): void;
|
|
1860
|
+
/** Recorded event log. */
|
|
1861
|
+
getEventLog(): readonly RecordedEvent[];
|
|
1862
|
+
/** Layout box for a node, if recorded. */
|
|
1863
|
+
inspectLayout(nodeId: string): DevToolsNode["layout"] | undefined;
|
|
1864
|
+
/** Show the dirty-region panel (stats-level). */
|
|
1865
|
+
showDirtyRegions(enabled: boolean): void;
|
|
1866
|
+
/** Current process memory usage. */
|
|
1867
|
+
getMemoryStats(): MemoryStats;
|
|
1868
|
+
/** Capture a heap snapshot summary (memory stats point-in-time). */
|
|
1869
|
+
takeHeapSnapshot(): MemoryStats;
|
|
1870
|
+
/** Record a command being emitted */
|
|
1871
|
+
recordCommand(type: string, payload: Record<string, unknown>, duration?: number | undefined): void;
|
|
1872
|
+
/** Record a render frame */
|
|
1873
|
+
recordFrame(options: {
|
|
1874
|
+
duration: number;
|
|
1875
|
+
commandCount?: number | undefined;
|
|
1876
|
+
dirtyRegionCount?: number | undefined;
|
|
1877
|
+
renderDuration?: number | undefined;
|
|
1878
|
+
layoutDuration?: number | undefined;
|
|
1879
|
+
paintDuration?: number | undefined;
|
|
1880
|
+
ffiDuration?: number | undefined;
|
|
1881
|
+
}): void;
|
|
1882
|
+
/** Record a keyboard event */
|
|
1883
|
+
recordKeyboard(key: string, modifiers: {
|
|
1884
|
+
ctrl: boolean;
|
|
1885
|
+
shift: boolean;
|
|
1886
|
+
alt: boolean;
|
|
1887
|
+
meta: boolean;
|
|
1888
|
+
}, target?: string | undefined): void;
|
|
1889
|
+
/** Record a mouse event */
|
|
1890
|
+
recordMouse(type: string, x: number, y: number, button?: string | undefined, target?: string | undefined): void;
|
|
1891
|
+
/** Record a focus change */
|
|
1892
|
+
recordFocus(type: "focus" | "blur", nodeId: string): void;
|
|
1893
|
+
/** Record a resize event */
|
|
1894
|
+
recordResize(width: number, height: number, prevWidth?: number | undefined, prevHeight?: number | undefined): void;
|
|
1895
|
+
/** Update terminal capabilities */
|
|
1896
|
+
updateCapabilities(capabilities: Partial<TerminalCapabilities>): void;
|
|
1897
|
+
/** Update scheduler state */
|
|
1898
|
+
updateScheduler(state: Partial<SchedulerSnapshot>): void;
|
|
1899
|
+
/** Capture a tree snapshot */
|
|
1900
|
+
captureSnapshot(tree: DevToolsNode): number;
|
|
1901
|
+
/** Get a full diagnostic export */
|
|
1902
|
+
exportData(options?: ExportOptions | undefined): DiagnosticExport;
|
|
1903
|
+
/** Get export as JSON string */
|
|
1904
|
+
exportJson(options?: ExportOptions | undefined): string;
|
|
1905
|
+
/** Get a summary report */
|
|
1906
|
+
getSummary(): string;
|
|
1907
|
+
/** Reset all inspectors */
|
|
1908
|
+
reset(): void;
|
|
1909
|
+
/** Dispose all resources */
|
|
1910
|
+
dispose(): void;
|
|
1911
|
+
}
|
|
1912
|
+
interface CreateDevToolsOptions {
|
|
1913
|
+
enabled?: boolean | undefined;
|
|
1914
|
+
maxEvents?: number | undefined;
|
|
1915
|
+
logging?: boolean | undefined;
|
|
1916
|
+
logLevel?: ("debug" | "info" | "warn" | "error" | "trace") | undefined;
|
|
1917
|
+
timeline?: boolean | undefined;
|
|
1918
|
+
performance?: boolean | undefined;
|
|
1919
|
+
snapshots?: boolean | undefined;
|
|
1920
|
+
}
|
|
1921
|
+
/** Options accepted by the `debug` field of `CliRendererOptions`. */
|
|
1922
|
+
type DevToolsOptions = CreateDevToolsOptions;
|
|
1923
|
+
/**
|
|
1924
|
+
* Create a DevTools instance.
|
|
1925
|
+
*
|
|
1926
|
+
* When `enabled` is false or omitted, returns a no-op implementation with
|
|
1927
|
+
* near-zero overhead. When `enabled: true`, returns a fully functional
|
|
1928
|
+
* DevTools instance that can record commands, events, performance metrics,
|
|
1929
|
+
* and more.
|
|
1930
|
+
*/
|
|
1931
|
+
declare function createDevTools(options?: CreateDevToolsOptions): DevTools;
|
|
1932
|
+
//#endregion
|
|
1933
|
+
//#region src/lib/parseKeypress.d.ts
|
|
1934
|
+
declare const nonAlphanumericKeys: string[];
|
|
1935
|
+
declare const terminalNamedSingleStrokeKeys: string[];
|
|
1936
|
+
type KeyEventType$1 = "press" | "repeat" | "release";
|
|
1937
|
+
interface ParsedKey {
|
|
1938
|
+
name: string;
|
|
1939
|
+
ctrl: boolean;
|
|
1940
|
+
meta: boolean;
|
|
1941
|
+
shift: boolean;
|
|
1942
|
+
option: boolean;
|
|
1943
|
+
sequence: string;
|
|
1944
|
+
number: boolean;
|
|
1945
|
+
raw: string;
|
|
1946
|
+
eventType: KeyEventType$1;
|
|
1947
|
+
source: "raw" | "kitty";
|
|
1948
|
+
code?: string;
|
|
1949
|
+
super?: boolean;
|
|
1950
|
+
hyper?: boolean;
|
|
1951
|
+
capsLock?: boolean;
|
|
1952
|
+
numLock?: boolean;
|
|
1953
|
+
baseCode?: number;
|
|
1954
|
+
repeated?: boolean;
|
|
1955
|
+
}
|
|
1956
|
+
type ParseKeypressOptions = {
|
|
1957
|
+
useKittyKeyboard?: boolean;
|
|
1958
|
+
};
|
|
1959
|
+
declare const parseKeypress: (input?: Buffer$1 | string, options?: ParseKeypressOptions) => ParsedKey | null;
|
|
1960
|
+
//#endregion
|
|
1961
|
+
//#region src/lib/keyHandler.d.ts
|
|
1962
|
+
declare class KeyEvent implements ParsedKey {
|
|
1963
|
+
name: string;
|
|
1964
|
+
ctrl: boolean;
|
|
1965
|
+
meta: boolean;
|
|
1966
|
+
shift: boolean;
|
|
1967
|
+
option: boolean;
|
|
1968
|
+
sequence: string;
|
|
1969
|
+
number: boolean;
|
|
1970
|
+
raw: string;
|
|
1971
|
+
eventType: KeyEventType$1;
|
|
1972
|
+
source: "raw" | "kitty";
|
|
1973
|
+
code?: string;
|
|
1974
|
+
super?: boolean;
|
|
1975
|
+
hyper?: boolean;
|
|
1976
|
+
capsLock?: boolean;
|
|
1977
|
+
numLock?: boolean;
|
|
1978
|
+
baseCode?: number;
|
|
1979
|
+
repeated?: boolean;
|
|
1980
|
+
private _defaultPrevented;
|
|
1981
|
+
private _propagationStopped;
|
|
1982
|
+
constructor(key: ParsedKey);
|
|
1983
|
+
/** Alias for `option` — backward-compatible with RawKeyEvent.alt. */
|
|
1984
|
+
get alt(): boolean;
|
|
1985
|
+
get defaultPrevented(): boolean;
|
|
1986
|
+
get propagationStopped(): boolean;
|
|
1987
|
+
preventDefault(): void;
|
|
1988
|
+
stopPropagation(): void;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Metadata attached to a {@link PasteEvent}. Used by consumers to decide
|
|
1992
|
+
* whether to insert, filter, or transform pasted content (e.g. skip binary
|
|
1993
|
+
* paste into a text field).
|
|
1994
|
+
*/
|
|
1995
|
+
interface PasteMetadata$1 {
|
|
1996
|
+
/** MIME type if the terminal reported one (e.g. `text/plain`). */
|
|
1997
|
+
mimeType?: string;
|
|
1998
|
+
/** Coarse kind of the pasted payload. */
|
|
1999
|
+
kind?: "text" | "binary" | "unknown";
|
|
2000
|
+
}
|
|
2001
|
+
declare class PasteEvent {
|
|
2002
|
+
type: "paste";
|
|
2003
|
+
bytes: Uint8Array;
|
|
2004
|
+
/** Optional metadata attached to the paste event (e.g. bracketed-paste info). */
|
|
2005
|
+
metadata?: PasteMetadata$1;
|
|
2006
|
+
private _defaultPrevented;
|
|
2007
|
+
private _propagationStopped;
|
|
2008
|
+
constructor(bytes: Uint8Array, metadata?: PasteMetadata$1);
|
|
2009
|
+
get defaultPrevented(): boolean;
|
|
2010
|
+
get propagationStopped(): boolean;
|
|
2011
|
+
preventDefault(): void;
|
|
2012
|
+
stopPropagation(): void;
|
|
2013
|
+
}
|
|
2014
|
+
type KeyHandlerEventMap = {
|
|
2015
|
+
keypress: [KeyEvent];
|
|
2016
|
+
keyrelease: [KeyEvent];
|
|
2017
|
+
paste: [PasteEvent];
|
|
2018
|
+
};
|
|
2019
|
+
declare class KeyHandler extends EventEmitter<KeyHandlerEventMap> {
|
|
2020
|
+
processParsedKey(parsedKey: ParsedKey): boolean;
|
|
2021
|
+
processPaste(bytes: Uint8Array, metadata?: PasteMetadata$1): void;
|
|
2022
|
+
}
|
|
2023
|
+
/**
|
|
2024
|
+
* This class is used internally by the renderer to ensure global handlers
|
|
2025
|
+
* can preventDefault before renderable handlers process events.
|
|
2026
|
+
*
|
|
2027
|
+
* NOTE: `emit` is overridden to route every emission through `emitWithPriority`,
|
|
2028
|
+
* so that global listeners always run before renderable listeners and can
|
|
2029
|
+
* `preventDefault()` / `stopPropagation()` to short-circuit them. Previously
|
|
2030
|
+
* this override was missing, which meant `processParsedKey`'s direct
|
|
2031
|
+
* `this.emit("keypress", …)` bypassed priority dispatch entirely.
|
|
2032
|
+
*/
|
|
2033
|
+
declare class InternalKeyHandler extends KeyHandler {
|
|
2034
|
+
private renderableHandlers;
|
|
2035
|
+
/**
|
|
2036
|
+
* Override `emit` so that all emissions for the three domain event types go
|
|
2037
|
+
* through `emitWithPriority` (global listeners first, then renderable
|
|
2038
|
+
* listeners, with propagation / defaultPrevented checks in between).
|
|
2039
|
+
* Unknown event names fall through to the base `EventEmitter.emit` so that
|
|
2040
|
+
* Node's internal events (e.g. `newListener`, `removeListener`) are not
|
|
2041
|
+
* broken.
|
|
2042
|
+
*/
|
|
2043
|
+
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
2044
|
+
emitWithPriority<K extends keyof KeyHandlerEventMap>(event: K, ...args: KeyHandlerEventMap[K]): boolean;
|
|
2045
|
+
onInternal<K extends keyof KeyHandlerEventMap>(event: K, handler: (...args: KeyHandlerEventMap[K]) => void): void;
|
|
2046
|
+
offInternal<K extends keyof KeyHandlerEventMap>(event: K, handler: (...args: KeyHandlerEventMap[K]) => void): void;
|
|
2047
|
+
}
|
|
2048
|
+
//#endregion
|
|
2049
|
+
//#region src/lib/parseMouse.d.ts
|
|
2050
|
+
/**
|
|
2051
|
+
* Mouse event parser for X10 and SGR mouse sequences.
|
|
2052
|
+
* Parses terminal mouse escape sequences into RawMouseEvent objects.
|
|
2053
|
+
*/
|
|
2054
|
+
type MouseEventType$1 = "down" | "up" | "move" | "drag" | "drag-end" | "drop" | "over" | "out" | "scroll";
|
|
2055
|
+
interface ScrollInfo {
|
|
2056
|
+
direction: "up" | "down" | "left" | "right";
|
|
2057
|
+
delta: number;
|
|
2058
|
+
}
|
|
2059
|
+
interface RawMouseEvent {
|
|
2060
|
+
type: MouseEventType$1;
|
|
2061
|
+
button: number;
|
|
2062
|
+
x: number;
|
|
2063
|
+
y: number;
|
|
2064
|
+
modifiers: {
|
|
2065
|
+
shift: boolean;
|
|
2066
|
+
alt: boolean;
|
|
2067
|
+
ctrl: boolean;
|
|
2068
|
+
};
|
|
2069
|
+
scroll?: ScrollInfo;
|
|
2070
|
+
}
|
|
2071
|
+
declare class MouseParser {
|
|
2072
|
+
private mouseButtonsPressed;
|
|
2073
|
+
private static readonly SCROLL_DIRECTIONS;
|
|
2074
|
+
reset(): void;
|
|
2075
|
+
private decodeInput;
|
|
2076
|
+
parseMouseEvent(data: Uint8Array): RawMouseEvent | null;
|
|
2077
|
+
parseAllMouseEvents(data: Uint8Array): RawMouseEvent[];
|
|
2078
|
+
private parseMouseSequenceAt;
|
|
2079
|
+
private parseSgrSequence;
|
|
2080
|
+
private parseBasicSequence;
|
|
2081
|
+
private decodeSgrEvent;
|
|
2082
|
+
private decodeBasicEvent;
|
|
2083
|
+
}
|
|
2084
|
+
//#endregion
|
|
2085
|
+
//#region src/lib/keyInput.d.ts
|
|
2086
|
+
/**
|
|
2087
|
+
* Events emitted by {@link KeyInput}. Mirrors the four kinds of `StdinEvent`
|
|
2088
|
+
* produced by the parser so that nothing read from stdin is silently dropped.
|
|
2089
|
+
*
|
|
2090
|
+
* Historical bug: `KeyInput.drain` previously handled only `type === "key"`
|
|
2091
|
+
* and discarded every `mouse` / `paste` / `response` event, which made mouse
|
|
2092
|
+
* input, bracketed paste, and terminal-capability replies unreachable from
|
|
2093
|
+
* the renderer.
|
|
2094
|
+
*/
|
|
2095
|
+
type KeyInputEvents = {
|
|
2096
|
+
keypress: [KeyEvent];
|
|
2097
|
+
keyrelease: [KeyEvent];
|
|
2098
|
+
mouse: [RawMouseEvent, string];
|
|
2099
|
+
paste: [PasteEvent];
|
|
2100
|
+
response: [string, string];
|
|
2101
|
+
};
|
|
2102
|
+
declare class KeyInput extends EventEmitter<KeyInputEvents> {
|
|
2103
|
+
private stdinParser;
|
|
2104
|
+
private rawMode;
|
|
2105
|
+
private readonly onDataBound;
|
|
2106
|
+
constructor();
|
|
2107
|
+
start(): void;
|
|
2108
|
+
stop(): void;
|
|
2109
|
+
private onData;
|
|
2110
|
+
private drain;
|
|
2111
|
+
}
|
|
2112
|
+
//#endregion
|
|
2113
|
+
//#region src/lib/renderableEvents.d.ts
|
|
2114
|
+
/**
|
|
2115
|
+
* Event enums for BetterTUI renderables and renderer.
|
|
2116
|
+
*/
|
|
2117
|
+
/** Events emitted by the CliRenderer. */
|
|
2118
|
+
declare enum CliRenderEvents {
|
|
2119
|
+
RESIZE = "resize",
|
|
2120
|
+
FRAME = "frame",
|
|
2121
|
+
FOCUS = "focus",
|
|
2122
|
+
BLUR = "blur",
|
|
2123
|
+
FOCUSED_RENDERABLE = "focused_renderable",
|
|
2124
|
+
FOCUSED_EDITOR = "focused_editor",
|
|
2125
|
+
THEME_MODE = "theme_mode",
|
|
2126
|
+
PALETTE = "palette",
|
|
2127
|
+
CAPABILITIES = "capabilities",
|
|
2128
|
+
SELECTION = "selection",
|
|
2129
|
+
DEBUG_OVERLAY_TOGGLE = "debugOverlay:toggle",
|
|
2130
|
+
DESTROY = "destroy",
|
|
2131
|
+
MEMORY_SNAPSHOT = "memory:snapshot"
|
|
2132
|
+
}
|
|
2133
|
+
/** Events emitted by all Renderable instances. */
|
|
2134
|
+
declare enum RenderableEvents {
|
|
2135
|
+
FOCUSED = "focused",
|
|
2136
|
+
BLURRED = "blurred",
|
|
2137
|
+
DESTROYED = "destroyed"
|
|
2138
|
+
}
|
|
2139
|
+
/** Events emitted by Input. */
|
|
2140
|
+
declare enum InputEvents {
|
|
2141
|
+
INPUT = "input",
|
|
2142
|
+
CHANGE = "change",
|
|
2143
|
+
ENTER = "enter"
|
|
2144
|
+
}
|
|
2145
|
+
/** Events emitted by Select. */
|
|
2146
|
+
declare enum SelectEvents {
|
|
2147
|
+
SELECTION_CHANGED = "selection_changed",
|
|
2148
|
+
ITEM_SELECTED = "item_selected"
|
|
2149
|
+
}
|
|
2150
|
+
/** Events emitted by TabSelect. */
|
|
2151
|
+
declare enum TabSelectEvents {
|
|
2152
|
+
SELECTION_CHANGED = "selection_changed",
|
|
2153
|
+
ITEM_SELECTED = "item_selected"
|
|
2154
|
+
}
|
|
2155
|
+
/** Events emitted by Slider. */
|
|
2156
|
+
declare enum SliderEvents {
|
|
2157
|
+
CHANGE = "change"
|
|
2158
|
+
}
|
|
2159
|
+
/** Layout-related events. */
|
|
2160
|
+
declare enum LayoutEvents {
|
|
2161
|
+
LAYOUT_CHANGED = "layout-changed",
|
|
2162
|
+
RESIZED = "resized"
|
|
2163
|
+
}
|
|
2164
|
+
//#endregion
|
|
2165
|
+
//#region src/platform/cliRenderer.d.ts
|
|
2166
|
+
interface RawKeyEvent {
|
|
2167
|
+
name: string;
|
|
2168
|
+
ctrl: boolean;
|
|
2169
|
+
shift: boolean;
|
|
2170
|
+
alt: boolean;
|
|
2171
|
+
meta: boolean;
|
|
2172
|
+
sequence: string;
|
|
2173
|
+
preventDefault(): void;
|
|
2174
|
+
}
|
|
2175
|
+
interface CliRendererOptions {
|
|
2176
|
+
width?: number;
|
|
2177
|
+
height?: number;
|
|
2178
|
+
autoStart?: boolean;
|
|
2179
|
+
exitOnCtrlC?: boolean;
|
|
2180
|
+
targetFps?: number;
|
|
2181
|
+
screenMode?: ScreenMode;
|
|
2182
|
+
footerHeight?: number;
|
|
2183
|
+
externalOutputMode?: ExternalOutputMode;
|
|
2184
|
+
logger?: LoggerConfig;
|
|
2185
|
+
debug?: boolean | DevToolsOptions;
|
|
2186
|
+
onDestroy?: () => void;
|
|
2187
|
+
enableMouseMovement?: boolean;
|
|
2188
|
+
useMouse?: boolean;
|
|
2189
|
+
autoFocus?: boolean;
|
|
2190
|
+
backgroundColor?: string;
|
|
2191
|
+
}
|
|
2192
|
+
/** Interactive terminal console overlay for capturing and inspecting console log output. */
|
|
2193
|
+
declare class TerminalConsole extends EventEmitter {
|
|
2194
|
+
private _visible;
|
|
2195
|
+
private _renderer;
|
|
2196
|
+
keyBindings: Record<string, unknown>;
|
|
2197
|
+
onCopySelection?: () => void;
|
|
2198
|
+
constructor(renderer?: CliRenderer);
|
|
2199
|
+
attachRenderer(renderer: CliRenderer): void;
|
|
2200
|
+
show(): void;
|
|
2201
|
+
hide(): void;
|
|
2202
|
+
toggle(): void;
|
|
2203
|
+
get visible(): boolean;
|
|
2204
|
+
clear(): void;
|
|
2205
|
+
entries(): readonly ConsoleLogEntry[];
|
|
2206
|
+
saveLogsToFile(filepath?: string): string | null;
|
|
2207
|
+
}
|
|
2208
|
+
type ThemeMode = "light" | "dark";
|
|
2209
|
+
type FrameCallback = (deltaTime: number) => void | Promise<void>;
|
|
2210
|
+
declare class CliRenderer extends EventEmitter {
|
|
2211
|
+
private engine;
|
|
2212
|
+
private keymap;
|
|
2213
|
+
private _keyInput;
|
|
2214
|
+
private _keyDispatch;
|
|
2215
|
+
private _capabilities;
|
|
2216
|
+
private width;
|
|
2217
|
+
private height;
|
|
2218
|
+
private renderOffset;
|
|
2219
|
+
private _screenMode;
|
|
2220
|
+
private _externalOutputMode;
|
|
2221
|
+
private externalOutputBuffer;
|
|
2222
|
+
private nodes;
|
|
2223
|
+
private running;
|
|
2224
|
+
private paused;
|
|
2225
|
+
private _devtools;
|
|
2226
|
+
private overlay;
|
|
2227
|
+
private lastFrameTime;
|
|
2228
|
+
private _frameId;
|
|
2229
|
+
private _frameInterval;
|
|
2230
|
+
private _frameCallbacks;
|
|
2231
|
+
private _lifecyclePasses;
|
|
2232
|
+
private _root;
|
|
2233
|
+
private _console;
|
|
2234
|
+
private _themeMode;
|
|
2235
|
+
private _targetFps;
|
|
2236
|
+
private _onDestroy;
|
|
2237
|
+
private _pendingRender;
|
|
2238
|
+
private _resizeHandler;
|
|
2239
|
+
private _liveCount;
|
|
2240
|
+
constructor(options?: CliRendererOptions);
|
|
2241
|
+
get frameId(): number;
|
|
2242
|
+
get terminalWidth(): number;
|
|
2243
|
+
get terminalHeight(): number;
|
|
2244
|
+
get viewportHeight(): number;
|
|
2245
|
+
get screenMode(): ScreenMode;
|
|
2246
|
+
get externalOutputMode(): ExternalOutputMode;
|
|
2247
|
+
get keyInput(): KeyInput;
|
|
2248
|
+
/**
|
|
2249
|
+
* Two-tier priority key dispatcher.
|
|
2250
|
+
*
|
|
2251
|
+
* - `.on("keypress", fn)` → tier-1 global handler (fires before any focused
|
|
2252
|
+
* widget). Can call `key.preventDefault()` / `key.stopPropagation()`.
|
|
2253
|
+
* - `.onInternal("keypress", fn)` → tier-2 renderable handler (used by
|
|
2254
|
+
* focusable widgets; only fires when no global handler stopped propagation).
|
|
2255
|
+
*
|
|
2256
|
+
* Example code that needs to intercept keys before the focused widget should
|
|
2257
|
+
* use `renderer.keyHandler.on(...)`. Widgets must use
|
|
2258
|
+
* `renderer.keyHandler.onInternal(...)` inside `focus()`.
|
|
2259
|
+
*/
|
|
2260
|
+
get keyHandler(): InternalKeyHandler;
|
|
2261
|
+
get version(): string;
|
|
2262
|
+
get isRunning(): boolean;
|
|
2263
|
+
/** The scene root renderable. All top-level renderables should be added here. */
|
|
2264
|
+
get root(): Root;
|
|
2265
|
+
/** The terminal console overlay. */
|
|
2266
|
+
get console(): TerminalConsole;
|
|
2267
|
+
/** Current terminal theme mode (light/dark). */
|
|
2268
|
+
get themeMode(): ThemeMode;
|
|
2269
|
+
/** Terminal capabilities detected at startup. */
|
|
2270
|
+
get capabilities(): TerminalCapabilities$1;
|
|
2271
|
+
getDiagnostics(): DiagnosticSnapshot;
|
|
2272
|
+
get devtools(): DevTools;
|
|
2273
|
+
get debugEnabled(): boolean;
|
|
2274
|
+
/** Start the render loop and keyboard input. */
|
|
2275
|
+
start(): void;
|
|
2276
|
+
/** Stop the render loop and exit alternate screen. */
|
|
2277
|
+
stop(): void;
|
|
2278
|
+
/**
|
|
2279
|
+
* Auto-start / toggle mode.
|
|
2280
|
+
* Starts if stopped, or pauses/resumes the loop if running.
|
|
2281
|
+
*/
|
|
2282
|
+
auto(): void;
|
|
2283
|
+
/** Pause the frame loop without stopping input. */
|
|
2284
|
+
pause(): void;
|
|
2285
|
+
/** Resume a paused frame loop. */
|
|
2286
|
+
resume(): void;
|
|
2287
|
+
/** Full suspend: stop input and frame loop. */
|
|
2288
|
+
suspend(): void;
|
|
2289
|
+
/** Full cleanup: stop everything and destroy engine. */
|
|
2290
|
+
destroy(): void;
|
|
2291
|
+
private _startFrameLoop;
|
|
2292
|
+
private _stopFrameLoop;
|
|
2293
|
+
/** Register a frame callback (called every frame before render). */
|
|
2294
|
+
setFrameCallback(cb: FrameCallback): void;
|
|
2295
|
+
/** Remove a previously registered frame callback. */
|
|
2296
|
+
removeFrameCallback(cb: FrameCallback): void;
|
|
2297
|
+
/** Clear all frame callbacks. */
|
|
2298
|
+
clearFrameCallbacks(): void;
|
|
2299
|
+
/** Register a function to be called once per frame before render (lifecycle pass). */
|
|
2300
|
+
registerLifecyclePass(fn: () => void): void;
|
|
2301
|
+
/** Unregister a previously registered lifecycle pass function. */
|
|
2302
|
+
unregisterLifecyclePass(fn: () => void): void;
|
|
2303
|
+
/** Request an immediate render (useful outside the frame loop). */
|
|
2304
|
+
requestRender(): void;
|
|
2305
|
+
/** Set the terminal window title via OSC 0 sequence. */
|
|
2306
|
+
setTerminalTitle(title: string): void;
|
|
2307
|
+
setBackgroundColor(color: string): void;
|
|
2308
|
+
dumpHitGrid(): void;
|
|
2309
|
+
copyToClipboardOSC52(text: string): void;
|
|
2310
|
+
clearClipboardOSC52(): void;
|
|
2311
|
+
/** Increment the live render counter; starts the renderer if not running. */
|
|
2312
|
+
requestLive(): void;
|
|
2313
|
+
/** Decrement the live render counter. */
|
|
2314
|
+
dropLive(): void;
|
|
2315
|
+
clearSelection(): void;
|
|
2316
|
+
getSelectionContainer(): null;
|
|
2317
|
+
get hasSelection(): boolean;
|
|
2318
|
+
setCursorPosition(_x: number, _y: number, _visible?: boolean): void;
|
|
2319
|
+
toggleDebugOverlay(panel?: DebugPanel): void;
|
|
2320
|
+
configureDebugOverlay(options: Parameters<OverlayHost["configure"]>[0]): void;
|
|
2321
|
+
get rootNodeId(): number;
|
|
2322
|
+
getChildrenOf(id: number): number[];
|
|
2323
|
+
setNodeStyle(id: number, style: Style$1): void;
|
|
2324
|
+
setNodeLayout(id: number, layout: LayoutConstraints$1): void;
|
|
2325
|
+
insertNodeBefore(parentId: number, childId: number, beforeId: number): void;
|
|
2326
|
+
createNode(kind: string): number;
|
|
2327
|
+
appendChild(parent: number, child: number): boolean;
|
|
2328
|
+
removeNode(id: number): void;
|
|
2329
|
+
setText(id: number, text: string): void;
|
|
2330
|
+
/** Set the scroll offset on a node so its children are shifted during rendering.
|
|
2331
|
+
* Use with `overflow: "hidden"` on the same node for clipped scrolling. */
|
|
2332
|
+
setScrollOffset(nodeId: number, scrollX: number, scrollY: number): void;
|
|
2333
|
+
clearTree(): void;
|
|
2334
|
+
setScreenMode(mode: ScreenMode, footerHeight?: number): void;
|
|
2335
|
+
render(): void;
|
|
2336
|
+
renderFull(): void;
|
|
2337
|
+
private writeFrame;
|
|
2338
|
+
clearScreen(): void;
|
|
2339
|
+
write(text: string): void;
|
|
2340
|
+
resize(width: number, height: number): void;
|
|
2341
|
+
handleKey(sequence: string): string | null;
|
|
2342
|
+
addKeyBinding(layer: string, id: string, keys: string, command: string, description?: string, priority?: number): boolean;
|
|
2343
|
+
private flushExternalOutput;
|
|
2344
|
+
interceptStdoutWrite: (chunk: string | Uint8Array) => boolean;
|
|
2345
|
+
private enterAlternateScreen;
|
|
2346
|
+
private exitAlternateScreen;
|
|
2347
|
+
}
|
|
2348
|
+
declare function createCliRenderer(options?: CliRendererOptions): Promise<CliRenderer>;
|
|
2349
|
+
//#endregion
|
|
2350
|
+
//#region src/renderable.d.ts
|
|
2351
|
+
interface WidgetContext {
|
|
2352
|
+
buffer: CommandBufferConsumer;
|
|
2353
|
+
onKey?: (handler: (key: KeyEvent$1) => boolean) => void;
|
|
2354
|
+
offKey?: (handler: (key: KeyEvent$1) => boolean) => void;
|
|
2355
|
+
}
|
|
2356
|
+
interface WidgetLifecycle {
|
|
2357
|
+
mount(ctx: WidgetContext): void;
|
|
2358
|
+
unmount(): void;
|
|
2359
|
+
}
|
|
2360
|
+
interface ImperativeContext {
|
|
2361
|
+
renderer: CliRenderer;
|
|
2362
|
+
parentId: number;
|
|
2363
|
+
}
|
|
2364
|
+
declare abstract class Renderable<TOptions = Record<string, unknown>> {
|
|
2365
|
+
readonly id: string;
|
|
2366
|
+
protected ctx: WidgetContext | null;
|
|
2367
|
+
protected opts: TOptions;
|
|
2368
|
+
protected children: Renderable[];
|
|
2369
|
+
protected _focused: boolean;
|
|
2370
|
+
protected _visible: boolean;
|
|
2371
|
+
protected _isDestroyed: boolean;
|
|
2372
|
+
protected _nodeId: number | null;
|
|
2373
|
+
constructor(options?: TOptions);
|
|
2374
|
+
get options(): Readonly<TOptions>;
|
|
2375
|
+
get visible(): boolean;
|
|
2376
|
+
get focused(): boolean;
|
|
2377
|
+
get isDestroyed(): boolean;
|
|
2378
|
+
get nodeId(): number | null;
|
|
2379
|
+
mount(ctx: WidgetContext): void;
|
|
2380
|
+
unmount(): void;
|
|
2381
|
+
update(options: Partial<TOptions>): void;
|
|
2382
|
+
abstract renderCommands(id: string): Command[];
|
|
2383
|
+
add(child: Renderable): void;
|
|
2384
|
+
remove(child: Renderable): void;
|
|
2385
|
+
handleKey?(key: KeyEvent$1): boolean;
|
|
2386
|
+
handleMouse?(event: MouseEvent$1): boolean;
|
|
2387
|
+
handleFocus?(): void;
|
|
2388
|
+
handleBlur?(): void;
|
|
2389
|
+
focus(): void;
|
|
2390
|
+
blur(): void;
|
|
2391
|
+
destroy(): void;
|
|
2392
|
+
protected emitCommands(cmds: Command[]): void;
|
|
2393
|
+
renderImperative(ctx: ImperativeContext): number;
|
|
2394
|
+
protected getNodeKind(): string;
|
|
2395
|
+
protected applyImperativeStyle(_renderer: CliRenderer, _nodeId: number): void;
|
|
2396
|
+
protected applyImperativeLayout(_renderer: CliRenderer, _nodeId: number): void;
|
|
2397
|
+
protected applyImperativeContent(_renderer: CliRenderer, _nodeId: number): void;
|
|
2398
|
+
protected layoutCommands(id: string, layout: Record<string, unknown>): Command[];
|
|
2399
|
+
protected styleCommands(id: string, style: Record<string, unknown>): Command[];
|
|
2400
|
+
}
|
|
2401
|
+
//#endregion
|
|
2402
|
+
//#region src/lib/keybinding.d.ts
|
|
2403
|
+
interface BindingInfo {
|
|
2404
|
+
id: string;
|
|
2405
|
+
keys: string;
|
|
2406
|
+
command: string;
|
|
2407
|
+
description: string | null;
|
|
2408
|
+
enabled: boolean;
|
|
2409
|
+
layer: string;
|
|
2410
|
+
}
|
|
2411
|
+
interface KeymapEvent {
|
|
2412
|
+
phase: "sequence-start" | "sequence-advance" | "sequence-clear" | "binding-execute" | "binding-reject";
|
|
2413
|
+
key: string;
|
|
2414
|
+
command: string | null;
|
|
2415
|
+
keys: string[];
|
|
2416
|
+
}
|
|
2417
|
+
type CommandHandler = (ctx: CommandContext) => boolean | undefined;
|
|
2418
|
+
interface CommandContext {
|
|
2419
|
+
keymap: Keymap;
|
|
2420
|
+
event: KeymapEvent;
|
|
2421
|
+
command: string;
|
|
2422
|
+
payload?: Record<string, unknown>;
|
|
2423
|
+
data: Record<string, unknown>;
|
|
2424
|
+
}
|
|
2425
|
+
interface CommandEntry {
|
|
2426
|
+
name: string;
|
|
2427
|
+
handler: CommandHandler;
|
|
2428
|
+
}
|
|
2429
|
+
type InterceptHandler = (ctx: InterceptContext) => boolean | undefined;
|
|
2430
|
+
interface InterceptContext {
|
|
2431
|
+
key: string;
|
|
2432
|
+
event: KeymapEvent;
|
|
2433
|
+
preventDefault(): void;
|
|
2434
|
+
stopPropagation(): void;
|
|
2435
|
+
defaultPrevented: boolean;
|
|
2436
|
+
propagationStopped: boolean;
|
|
2437
|
+
}
|
|
2438
|
+
type KeyListener = (event: KeymapEvent) => void;
|
|
2439
|
+
type KeymapOptions = {
|
|
2440
|
+
chordTimeoutMs?: number;
|
|
2441
|
+
mode?: string;
|
|
2442
|
+
};
|
|
2443
|
+
interface ActiveKeyInfo {
|
|
2444
|
+
keys: string;
|
|
2445
|
+
command: string;
|
|
2446
|
+
description: string | null;
|
|
2447
|
+
layer: string;
|
|
2448
|
+
id: string;
|
|
2449
|
+
}
|
|
2450
|
+
declare class Keymap {
|
|
2451
|
+
private native;
|
|
2452
|
+
private commands;
|
|
2453
|
+
private keyIntercepts;
|
|
2454
|
+
private keyAfterIntercepts;
|
|
2455
|
+
private listeners;
|
|
2456
|
+
private runtimeData;
|
|
2457
|
+
private bindings;
|
|
2458
|
+
private layers;
|
|
2459
|
+
private currentModeValue;
|
|
2460
|
+
private chordTimeoutMsValue;
|
|
2461
|
+
private pendingKeysValue;
|
|
2462
|
+
private commandHistoryValue;
|
|
2463
|
+
constructor(native?: NapiKeymap, options?: KeymapOptions);
|
|
2464
|
+
addBinding(layer: string, id: string, keys: string, command: string, description?: string, priority?: number): boolean;
|
|
2465
|
+
addSimpleBinding(keys: string, command: string, description?: string): boolean;
|
|
2466
|
+
removeLayer(name: string): boolean;
|
|
2467
|
+
setChordTimeout(ms: number): void;
|
|
2468
|
+
chordTimeout(): number;
|
|
2469
|
+
registerCommand(name: string, handler: CommandHandler): void;
|
|
2470
|
+
unregisterCommand(name: string): boolean;
|
|
2471
|
+
getCommand(name: string): CommandHandler | undefined;
|
|
2472
|
+
hasCommand(name: string): boolean;
|
|
2473
|
+
getCommands(): CommandEntry[];
|
|
2474
|
+
intercept(name: "key" | "key:after", handler: InterceptHandler, priority?: number): () => void;
|
|
2475
|
+
on(event: "state" | "pendingSequence" | "dispatch", listener: KeyListener): () => void;
|
|
2476
|
+
off(event: "state" | "pendingSequence" | "dispatch", listener: KeyListener): void;
|
|
2477
|
+
private emit;
|
|
2478
|
+
handleKey(keyStr: string): string | null;
|
|
2479
|
+
setMode(mode: string): void;
|
|
2480
|
+
currentMode(): string | null;
|
|
2481
|
+
clearMode(): void;
|
|
2482
|
+
hasPending(): boolean;
|
|
2483
|
+
clearPending(): void;
|
|
2484
|
+
pendingKeys(): string[];
|
|
2485
|
+
activeBindings(): BindingInfo[];
|
|
2486
|
+
allBindings(): BindingInfo[];
|
|
2487
|
+
commandHistory(): string[];
|
|
2488
|
+
clearHistory(): void;
|
|
2489
|
+
setData(key: string, value: unknown): void;
|
|
2490
|
+
getData(key: string): unknown;
|
|
2491
|
+
getCommandBindings(command: string): BindingInfo[];
|
|
2492
|
+
getBindingsForCommands(commands: string[]): Map<string, BindingInfo[]>;
|
|
2493
|
+
runCommand(command: string, payload?: Record<string, unknown>): boolean;
|
|
2494
|
+
parseKey(keyStr: string): string | null;
|
|
2495
|
+
parseSequence(keyStr: string): string[];
|
|
2496
|
+
formatKeySequence(keys: string[]): string;
|
|
2497
|
+
stringifyKeySequence(keys: string[], options?: {
|
|
2498
|
+
preferDisplay?: boolean;
|
|
2499
|
+
separator?: string;
|
|
2500
|
+
}): string;
|
|
2501
|
+
formatBinding(binding: BindingInfo): string;
|
|
2502
|
+
formatCommandBindings(entries: Array<{
|
|
2503
|
+
command: string;
|
|
2504
|
+
bindings: BindingInfo[];
|
|
2505
|
+
}>): string[];
|
|
2506
|
+
getNative(): NapiKeymap;
|
|
2507
|
+
}
|
|
2508
|
+
//#endregion
|
|
2509
|
+
//#region src/lib/parseKeypressKitty.d.ts
|
|
2510
|
+
declare const kittyNamedSingleStrokeKeys: string[];
|
|
2511
|
+
/**
|
|
2512
|
+
* Parse Kitty keyboard protocol sequence.
|
|
2513
|
+
*
|
|
2514
|
+
* Format: CSI unicode-key-code:alternate-key-codes ; modifiers:event-type ; text-as-codepoints u
|
|
2515
|
+
*
|
|
2516
|
+
* Examples:
|
|
2517
|
+
* ESC[99;1:1u = 'c' key press
|
|
2518
|
+
* ESC[99:99:99;2:1u = 'c' key press with base layout codepoint 99
|
|
2519
|
+
* ESC[1;1:1A = up arrow press (special key format)
|
|
2520
|
+
*/
|
|
2521
|
+
declare function parseKittyKeyboard(sequence: string): ParsedKey | null;
|
|
2522
|
+
//#endregion
|
|
2523
|
+
//#region src/lib/renderableKeyBindings.d.ts
|
|
2524
|
+
/**
|
|
2525
|
+
* Renderable-level keybinding utilities.
|
|
2526
|
+
*
|
|
2527
|
+
* Generic, framework-agnostic keybinding maps for renderables (Select,
|
|
2528
|
+
* TabSelect, etc.). The pattern is:
|
|
2529
|
+
*
|
|
2530
|
+
* 1. Define a set of default {@link KeyBinding}s mapping key presses to
|
|
2531
|
+
* renderable actions.
|
|
2532
|
+
* 2. Merge user-provided bindings over the defaults (user wins on key
|
|
2533
|
+
* collisions) with {@link mergeKeyBindings}.
|
|
2534
|
+
* 3. Build a lookup map with {@link buildKeyBindingsMap}, optionally
|
|
2535
|
+
* applying {@link KeyAliasMap} aliases (e.g. `enter` -> `return`).
|
|
2536
|
+
* 4. Resolve a parsed key event to an action with
|
|
2537
|
+
* {@link getKeyBindingAction}.
|
|
2538
|
+
*
|
|
2539
|
+
* `baseCode` (Kitty keyboard protocol) lets a binding match the physical
|
|
2540
|
+
* base-layout key even when the event arrives with an alternate-layout
|
|
2541
|
+
* character.
|
|
2542
|
+
*/
|
|
2543
|
+
interface KeyBindingLike {
|
|
2544
|
+
name: string;
|
|
2545
|
+
ctrl?: boolean;
|
|
2546
|
+
shift?: boolean;
|
|
2547
|
+
meta?: boolean;
|
|
2548
|
+
super?: boolean;
|
|
2549
|
+
}
|
|
2550
|
+
interface KeyBinding<Action extends string = string> extends KeyBindingLike {
|
|
2551
|
+
action: Action;
|
|
2552
|
+
}
|
|
2553
|
+
/** The subset of {@link KeyEvent} used to resolve a keybinding. */
|
|
2554
|
+
type KeyBindingLookup = {
|
|
2555
|
+
name: string;
|
|
2556
|
+
ctrl?: boolean;
|
|
2557
|
+
shift?: boolean;
|
|
2558
|
+
meta?: boolean;
|
|
2559
|
+
super?: boolean;
|
|
2560
|
+
/** Kitty base-layout codepoint (e.g. 99 == "c"). */
|
|
2561
|
+
baseCode?: number;
|
|
2562
|
+
};
|
|
2563
|
+
/** Maps a normalized key name to another (e.g. `enter` -> `return`). */
|
|
2564
|
+
type KeyAliasMap = Record<string, string>;
|
|
2565
|
+
declare const defaultKeyAliases: KeyAliasMap;
|
|
2566
|
+
declare function mergeKeyAliases(defaults: KeyAliasMap, custom: KeyAliasMap): KeyAliasMap;
|
|
2567
|
+
/**
|
|
2568
|
+
* Merge custom bindings over defaults. When a custom binding targets the same
|
|
2569
|
+
* key/modifier combination as a default, the custom binding wins.
|
|
2570
|
+
*/
|
|
2571
|
+
declare function mergeKeyBindings<Action extends string>(defaults: KeyBinding<Action>[], custom: KeyBinding<Action>[]): KeyBinding<Action>[];
|
|
2572
|
+
declare function getKeyBindingKey(binding: KeyBindingLike): string;
|
|
2573
|
+
/**
|
|
2574
|
+
* Return every lookup key that can represent this event. We try the parsed
|
|
2575
|
+
* name first, then the base-layout key when Kitty provides one. That keeps
|
|
2576
|
+
* direct character bindings precise and still lets physical-layout shortcuts
|
|
2577
|
+
* resolve.
|
|
2578
|
+
*/
|
|
2579
|
+
declare function getKeyBindingKeys(binding: KeyBindingLookup): string[];
|
|
2580
|
+
declare function getKeyBindingAction<Action extends string>(map: Map<string, Action>, binding: KeyBindingLookup): Action | undefined;
|
|
2581
|
+
declare function matchesKeyBinding(binding: KeyBindingLookup, match: KeyBindingLike): boolean;
|
|
2582
|
+
declare function buildKeyBindingsMap<Action extends string>(bindings: KeyBinding<Action>[], aliasMap?: KeyAliasMap): Map<string, Action>;
|
|
2583
|
+
/**
|
|
2584
|
+
* Converts a key binding to a human-readable string representation.
|
|
2585
|
+
* @example keyBindingToString({ name: "c", ctrl: true }) // "ctrl+c"
|
|
2586
|
+
*/
|
|
2587
|
+
declare function keyBindingToString<Action extends string>(binding: KeyBinding<Action>): string;
|
|
2588
|
+
//#endregion
|
|
2589
|
+
//#region src/lib/stdinParser.d.ts
|
|
2590
|
+
type StdinResponseProtocol = "csi" | "cpr" | "osc" | "dcs" | "apc" | "unknown";
|
|
2591
|
+
type PasteMetadata = Record<string, never>;
|
|
2592
|
+
type StdinEvent = {
|
|
2593
|
+
type: "key";
|
|
2594
|
+
raw: string;
|
|
2595
|
+
key: ParsedKey;
|
|
2596
|
+
} | {
|
|
2597
|
+
type: "mouse";
|
|
2598
|
+
raw: string;
|
|
2599
|
+
encoding: "sgr" | "x10";
|
|
2600
|
+
event: RawMouseEvent;
|
|
2601
|
+
} | {
|
|
2602
|
+
type: "paste";
|
|
2603
|
+
bytes: Uint8Array;
|
|
2604
|
+
metadata?: PasteMetadata;
|
|
2605
|
+
} | {
|
|
2606
|
+
type: "response";
|
|
2607
|
+
protocol: StdinResponseProtocol;
|
|
2608
|
+
sequence: string;
|
|
2609
|
+
};
|
|
2610
|
+
interface StdinParserProtocolContext {
|
|
2611
|
+
kittyKeyboardEnabled: boolean;
|
|
2612
|
+
privateCapabilityRepliesActive: boolean;
|
|
2613
|
+
pixelResolutionQueryActive: boolean;
|
|
2614
|
+
explicitWidthCprActive: boolean;
|
|
2615
|
+
startupCursorCprActive: boolean;
|
|
2616
|
+
}
|
|
2617
|
+
interface StdinParserOptions {
|
|
2618
|
+
timeoutMs?: number;
|
|
2619
|
+
maxPendingBytes?: number;
|
|
2620
|
+
armTimeouts?: boolean;
|
|
2621
|
+
onTimeoutFlush?: () => void;
|
|
2622
|
+
useKittyKeyboard?: boolean;
|
|
2623
|
+
protocolContext?: Partial<StdinParserProtocolContext>;
|
|
2624
|
+
clock?: Clock;
|
|
2625
|
+
}
|
|
2626
|
+
declare class StdinParser {
|
|
2627
|
+
private readonly pending;
|
|
2628
|
+
private readonly events;
|
|
2629
|
+
private readonly timeoutMs;
|
|
2630
|
+
private readonly maxPendingBytes;
|
|
2631
|
+
private readonly armTimeouts;
|
|
2632
|
+
private readonly onTimeoutFlush;
|
|
2633
|
+
private readonly useKittyKeyboard;
|
|
2634
|
+
private readonly mouseParser;
|
|
2635
|
+
private readonly clock;
|
|
2636
|
+
private protocolContext;
|
|
2637
|
+
private timeoutId;
|
|
2638
|
+
private destroyed;
|
|
2639
|
+
private pendingSinceMs;
|
|
2640
|
+
private forceFlush;
|
|
2641
|
+
private justFlushedEsc;
|
|
2642
|
+
private state;
|
|
2643
|
+
private cursor;
|
|
2644
|
+
private unitStart;
|
|
2645
|
+
private paste;
|
|
2646
|
+
constructor(options?: StdinParserOptions);
|
|
2647
|
+
get bufferCapacity(): number;
|
|
2648
|
+
updateProtocolContext(patch: Partial<StdinParserProtocolContext>): void;
|
|
2649
|
+
private getAbortableStartupCursorCprState;
|
|
2650
|
+
abortPendingStartupCursorCpr(): void;
|
|
2651
|
+
push(data: Uint8Array): void;
|
|
2652
|
+
read(): StdinEvent | null;
|
|
2653
|
+
drain(onEvent: (event: StdinEvent) => void): void;
|
|
2654
|
+
flushTimeout(nowMsValue?: number): void;
|
|
2655
|
+
private tryForceFlush;
|
|
2656
|
+
reset(): void;
|
|
2657
|
+
resetMouseState(): void;
|
|
2658
|
+
destroy(): void;
|
|
2659
|
+
private ensureAlive;
|
|
2660
|
+
private scanPending;
|
|
2661
|
+
private consumePasteBytes;
|
|
2662
|
+
private takePendingBytes;
|
|
2663
|
+
private flushPendingOverflow;
|
|
2664
|
+
private emitLegacyHighByte;
|
|
2665
|
+
private emitKeyOrResponse;
|
|
2666
|
+
private emitOpaqueResponse;
|
|
2667
|
+
private emitMouse;
|
|
2668
|
+
private consumePrefix;
|
|
2669
|
+
private markPending;
|
|
2670
|
+
private resetState;
|
|
2671
|
+
private reconcileDeferredStateWithProtocolContext;
|
|
2672
|
+
private reconcileTimeoutState;
|
|
2673
|
+
private clearTimeout;
|
|
2674
|
+
}
|
|
2675
|
+
//#endregion
|
|
2676
|
+
//#region src/lib/styledText.d.ts
|
|
2677
|
+
/** TextAttributes bitmask constants. */
|
|
2678
|
+
declare const TextAttributes: {
|
|
2679
|
+
readonly NONE: 0;
|
|
2680
|
+
readonly BOLD: 1;
|
|
2681
|
+
readonly DIM: 2;
|
|
2682
|
+
readonly ITALIC: 4;
|
|
2683
|
+
readonly UNDERLINE: 8;
|
|
2684
|
+
readonly BLINK: 16;
|
|
2685
|
+
readonly INVERSE: 32;
|
|
2686
|
+
readonly HIDDEN: 64;
|
|
2687
|
+
readonly STRIKETHROUGH: 128;
|
|
2688
|
+
};
|
|
2689
|
+
/** A single styled text chunk. */
|
|
2690
|
+
interface TextChunk {
|
|
2691
|
+
__isChunk: true;
|
|
2692
|
+
text: string;
|
|
2693
|
+
fg?: RGBA;
|
|
2694
|
+
bg?: RGBA;
|
|
2695
|
+
attributes?: number;
|
|
2696
|
+
link?: {
|
|
2697
|
+
url: string;
|
|
2698
|
+
};
|
|
2699
|
+
}
|
|
2700
|
+
declare const BrandedStyledText: unique symbol;
|
|
2701
|
+
/** A rich text object made of styled chunks. */
|
|
2702
|
+
declare class StyledText {
|
|
2703
|
+
[BrandedStyledText]: boolean;
|
|
2704
|
+
chunks: TextChunk[];
|
|
2705
|
+
constructor(chunks: TextChunk[]);
|
|
2706
|
+
}
|
|
2707
|
+
/** Type guard for StyledText. */
|
|
2708
|
+
declare function isStyledText(obj: unknown): obj is StyledText;
|
|
2709
|
+
/** Convert a plain string to a StyledText with one chunk. */
|
|
2710
|
+
declare function stringToStyledText(content: string): StyledText;
|
|
2711
|
+
/** A value that can be used in styled text. */
|
|
2712
|
+
type StylableInput = string | number | boolean | TextChunk;
|
|
2713
|
+
/**
|
|
2714
|
+
* Template literal tag for building styled text.
|
|
2715
|
+
*
|
|
2716
|
+
* @example
|
|
2717
|
+
* t`${bold(red("Error:"))} Connection failed`
|
|
2718
|
+
*/
|
|
2719
|
+
declare function t(strings: TemplateStringsArray, ...values: StylableInput[]): StyledText;
|
|
2720
|
+
declare const bold: (input: StylableInput) => TextChunk;
|
|
2721
|
+
declare const italic: (input: StylableInput) => TextChunk;
|
|
2722
|
+
declare const underline: (input: StylableInput) => TextChunk;
|
|
2723
|
+
declare const strikethrough: (input: StylableInput) => TextChunk;
|
|
2724
|
+
declare const dim: (input: StylableInput) => TextChunk;
|
|
2725
|
+
declare const reverse: (input: StylableInput) => TextChunk;
|
|
2726
|
+
declare const blink: (input: StylableInput) => TextChunk;
|
|
2727
|
+
declare const black: (input: StylableInput) => TextChunk;
|
|
2728
|
+
declare const red: (input: StylableInput) => TextChunk;
|
|
2729
|
+
declare const green: (input: StylableInput) => TextChunk;
|
|
2730
|
+
declare const yellow: (input: StylableInput) => TextChunk;
|
|
2731
|
+
declare const blue: (input: StylableInput) => TextChunk;
|
|
2732
|
+
declare const magenta: (input: StylableInput) => TextChunk;
|
|
2733
|
+
declare const cyan: (input: StylableInput) => TextChunk;
|
|
2734
|
+
declare const white: (input: StylableInput) => TextChunk;
|
|
2735
|
+
declare const brightBlack: (input: StylableInput) => TextChunk;
|
|
2736
|
+
declare const brightRed: (input: StylableInput) => TextChunk;
|
|
2737
|
+
declare const brightGreen: (input: StylableInput) => TextChunk;
|
|
2738
|
+
declare const brightYellow: (input: StylableInput) => TextChunk;
|
|
2739
|
+
declare const brightBlue: (input: StylableInput) => TextChunk;
|
|
2740
|
+
declare const brightMagenta: (input: StylableInput) => TextChunk;
|
|
2741
|
+
declare const brightCyan: (input: StylableInput) => TextChunk;
|
|
2742
|
+
declare const brightWhite: (input: StylableInput) => TextChunk;
|
|
2743
|
+
declare const bgBlack: (input: StylableInput) => TextChunk;
|
|
2744
|
+
declare const bgRed: (input: StylableInput) => TextChunk;
|
|
2745
|
+
declare const bgGreen: (input: StylableInput) => TextChunk;
|
|
2746
|
+
declare const bgYellow: (input: StylableInput) => TextChunk;
|
|
2747
|
+
declare const bgBlue: (input: StylableInput) => TextChunk;
|
|
2748
|
+
declare const bgMagenta: (input: StylableInput) => TextChunk;
|
|
2749
|
+
declare const bgCyan: (input: StylableInput) => TextChunk;
|
|
2750
|
+
declare const bgWhite: (input: StylableInput) => TextChunk;
|
|
2751
|
+
/** Set foreground color. `fg("#ff0000")("text")` */
|
|
2752
|
+
declare const fg: (color: ColorInput) => (input: StylableInput) => TextChunk;
|
|
2753
|
+
/** Set background color. `bg("#ff0000")("text")` */
|
|
2754
|
+
declare const bg: (color: ColorInput) => (input: StylableInput) => TextChunk;
|
|
2755
|
+
/** Create a hyperlink. `link("https://example.com")("click here")` */
|
|
2756
|
+
declare const link: (url: string) => (input: StylableInput) => TextChunk;
|
|
2757
|
+
/** Convert a StyledText or string to an ANSI escape-code string. */
|
|
2758
|
+
declare function styledTextToAnsi(styledText: StyledText | string): string;
|
|
2759
|
+
/** Get the visible (non-ANSI) character width of a string. */
|
|
2760
|
+
declare function visibleWidth(str: string): number;
|
|
2761
|
+
//#endregion
|
|
2762
|
+
//#region src/lib/singleton.d.ts
|
|
2763
|
+
/**
|
|
2764
|
+
* Ensures a value is initialized once per process,
|
|
2765
|
+
* persists across hot reloads, and is type-safe.
|
|
2766
|
+
*/
|
|
2767
|
+
declare function singleton<T>(key: string, factory: () => T): T;
|
|
2768
|
+
declare function getSingleton<T>(key: string): T | undefined;
|
|
2769
|
+
declare function destroySingleton(key: string): void;
|
|
2770
|
+
declare function hasSingleton(key: string): boolean;
|
|
2771
|
+
//#endregion
|
|
2772
|
+
//#region src/lib/env.d.ts
|
|
2773
|
+
/**
|
|
2774
|
+
* Environment variable configuration for BetterTUI.
|
|
2775
|
+
*/
|
|
2776
|
+
interface EnvVarConfig {
|
|
2777
|
+
name: string;
|
|
2778
|
+
description: string;
|
|
2779
|
+
default?: string | boolean | number;
|
|
2780
|
+
type?: "string" | "boolean" | "number";
|
|
2781
|
+
}
|
|
2782
|
+
/**
|
|
2783
|
+
* Register an environment variable with type coercion and documentation metadata.
|
|
2784
|
+
*/
|
|
2785
|
+
declare function registerEnvVar(config: EnvVarConfig): void;
|
|
2786
|
+
/** Get a registered env var config by name. */
|
|
2787
|
+
declare function getEnvVarConfig(name: string): EnvVarConfig | undefined;
|
|
2788
|
+
/** Get all registered env var configs. */
|
|
2789
|
+
declare function getAllEnvVarConfigs(): EnvVarConfig[];
|
|
2790
|
+
declare function clearEnvCache(): void;
|
|
2791
|
+
declare function generateEnvMarkdown(): string;
|
|
2792
|
+
declare function generateEnvColored(): string;
|
|
2793
|
+
declare const env: Record<string, any>;
|
|
2794
|
+
//#endregion
|
|
2795
|
+
//#region src/lib/timeline.d.ts
|
|
2796
|
+
/**
|
|
2797
|
+
* Timeline animation system.
|
|
2798
|
+
* Provides a GSAP-like API for building animation sequences.
|
|
2799
|
+
*/
|
|
2800
|
+
interface TweenConfig {
|
|
2801
|
+
[key: string]: unknown;
|
|
2802
|
+
}
|
|
2803
|
+
interface TimelineOptions {
|
|
2804
|
+
looping?: boolean;
|
|
2805
|
+
speed?: number;
|
|
2806
|
+
onComplete?: () => void;
|
|
2807
|
+
}
|
|
2808
|
+
/**
|
|
2809
|
+
* A simple animation timeline.
|
|
2810
|
+
* Tracks progress from 0 to 1 over a duration, with looping support.
|
|
2811
|
+
*/
|
|
2812
|
+
declare class Timeline {
|
|
2813
|
+
private readonly _duration;
|
|
2814
|
+
private readonly _looping;
|
|
2815
|
+
private _position;
|
|
2816
|
+
private _isPlaying;
|
|
2817
|
+
private _speed;
|
|
2818
|
+
private _onComplete;
|
|
2819
|
+
private _tweens;
|
|
2820
|
+
private _children;
|
|
2821
|
+
constructor(duration?: number, options?: TimelineOptions);
|
|
2822
|
+
get position(): number;
|
|
2823
|
+
set position(v: number);
|
|
2824
|
+
get isPlaying(): boolean;
|
|
2825
|
+
get duration(): number;
|
|
2826
|
+
get speed(): number;
|
|
2827
|
+
set speed(v: number);
|
|
2828
|
+
get looping(): boolean;
|
|
2829
|
+
/** Start or resume playback. */
|
|
2830
|
+
play(): void;
|
|
2831
|
+
/** Pause playback. */
|
|
2832
|
+
pause(): void;
|
|
2833
|
+
/** Reset to beginning and stop. */
|
|
2834
|
+
stop(): void;
|
|
2835
|
+
/** Reset to beginning and play. */
|
|
2836
|
+
restart(): void;
|
|
2837
|
+
/** Toggle play/pause. */
|
|
2838
|
+
toggle(): void;
|
|
2839
|
+
/**
|
|
2840
|
+
* Add a tween to the timeline (GSAP-like API).
|
|
2841
|
+
* @param targets - The target objects to animate
|
|
2842
|
+
* @param props - The properties to tween and their target values
|
|
2843
|
+
* @param offset - Time offset in seconds (or "+=N" for relative)
|
|
2844
|
+
*/
|
|
2845
|
+
add(targets: unknown, props: TweenConfig, offset?: number): this;
|
|
2846
|
+
/** Add a child timeline. */
|
|
2847
|
+
addChild(child: Timeline): this;
|
|
2848
|
+
/**
|
|
2849
|
+
* Update the timeline by deltaTime milliseconds.
|
|
2850
|
+
* Returns whether the timeline is still active.
|
|
2851
|
+
*/
|
|
2852
|
+
update(deltaTimeMs: number): boolean;
|
|
2853
|
+
/**
|
|
2854
|
+
* Get the current value of a property at the current position.
|
|
2855
|
+
* For simple linear interpolation between 0 and target value.
|
|
2856
|
+
*/
|
|
2857
|
+
getValue<T = number>(prop: string): T;
|
|
2858
|
+
/** Seek to a specific position (0-1). */
|
|
2859
|
+
seek(position: number): void;
|
|
2860
|
+
/** Get the time in seconds at the current position. */
|
|
2861
|
+
get currentTime(): number;
|
|
2862
|
+
}
|
|
2863
|
+
/** Create a new Timeline instance. */
|
|
2864
|
+
declare function createTimeline$1(duration?: number, options?: TimelineOptions): Timeline;
|
|
2865
|
+
//#endregion
|
|
2866
|
+
//#region src/renderables/Input.d.ts
|
|
2867
|
+
interface InputOptions extends BoxOptions {
|
|
2868
|
+
value?: string;
|
|
2869
|
+
placeholder?: string;
|
|
2870
|
+
placeholderColor?: ColorInput;
|
|
2871
|
+
textColor?: ColorInput;
|
|
2872
|
+
focusedTextColor?: ColorInput;
|
|
2873
|
+
cursorColor?: ColorInput;
|
|
2874
|
+
backgroundColor?: ColorInput;
|
|
2875
|
+
focusedBackgroundColor?: ColorInput;
|
|
2876
|
+
maxLength?: number;
|
|
2877
|
+
minLength?: number;
|
|
2878
|
+
showCursor?: boolean;
|
|
2879
|
+
password?: boolean;
|
|
2880
|
+
}
|
|
2881
|
+
type InputRenderableOptions = InputOptions;
|
|
2882
|
+
declare class Input extends Box {
|
|
2883
|
+
private _value;
|
|
2884
|
+
private _placeholder;
|
|
2885
|
+
private _placeholderColor;
|
|
2886
|
+
private _textColor;
|
|
2887
|
+
private _focusedTextColor;
|
|
2888
|
+
private _cursorColor;
|
|
2889
|
+
private _focusedBackgroundColor;
|
|
2890
|
+
private _maxLength;
|
|
2891
|
+
private _minLength;
|
|
2892
|
+
private _showCursor;
|
|
2893
|
+
private _password;
|
|
2894
|
+
private _cursorPos;
|
|
2895
|
+
private _lastCommittedValue;
|
|
2896
|
+
private _textNodeId;
|
|
2897
|
+
private readonly _keyHandler;
|
|
2898
|
+
constructor(renderer: CliRenderer, options?: InputOptions);
|
|
2899
|
+
get value(): string;
|
|
2900
|
+
set value(v: string);
|
|
2901
|
+
get plainText(): string;
|
|
2902
|
+
get cursorOffset(): number;
|
|
2903
|
+
set cursorOffset(pos: number);
|
|
2904
|
+
set textColor(color: ColorInput);
|
|
2905
|
+
set focusedTextColor(color: ColorInput);
|
|
2906
|
+
set placeholder(value: string);
|
|
2907
|
+
set placeholderColor(color: ColorInput);
|
|
2908
|
+
set cursorColor(color: ColorInput);
|
|
2909
|
+
set showCursor(value: boolean);
|
|
2910
|
+
focus(): void;
|
|
2911
|
+
blur(): void;
|
|
2912
|
+
private _handleKey;
|
|
2913
|
+
private _submit;
|
|
2914
|
+
private _render;
|
|
2915
|
+
destroy(): void;
|
|
2916
|
+
}
|
|
2917
|
+
//#endregion
|
|
2918
|
+
//#region src/renderables/Select.d.ts
|
|
2919
|
+
interface SelectOption {
|
|
2920
|
+
name: string;
|
|
2921
|
+
description: string;
|
|
2922
|
+
value?: unknown;
|
|
2923
|
+
}
|
|
2924
|
+
/** Selectable actions resolved from key events. */
|
|
2925
|
+
type SelectAction = "move-up" | "move-down" | "move-up-fast" | "move-down-fast" | "move-up-page" | "move-down-page" | "move-to-start" | "move-to-end" | "select-current";
|
|
2926
|
+
type SelectKeyBinding = KeyBinding<SelectAction>;
|
|
2927
|
+
interface SelectOptions extends BoxOptions {
|
|
2928
|
+
options?: SelectOption[];
|
|
2929
|
+
selectedIndex?: number;
|
|
2930
|
+
backgroundColor?: ColorInput;
|
|
2931
|
+
textColor?: ColorInput;
|
|
2932
|
+
focusedBackgroundColor?: ColorInput;
|
|
2933
|
+
focusedTextColor?: ColorInput;
|
|
2934
|
+
selectedBackgroundColor?: ColorInput;
|
|
2935
|
+
selectedTextColor?: ColorInput;
|
|
2936
|
+
descriptionColor?: ColorInput;
|
|
2937
|
+
selectedDescriptionColor?: ColorInput;
|
|
2938
|
+
showScrollIndicator?: boolean;
|
|
2939
|
+
showDescription?: boolean;
|
|
2940
|
+
showSelectionIndicator?: boolean;
|
|
2941
|
+
selectionIndicator?: string;
|
|
2942
|
+
unselectedIndicator?: string;
|
|
2943
|
+
wrapSelection?: boolean;
|
|
2944
|
+
fastScrollStep?: number;
|
|
2945
|
+
itemSpacing?: number;
|
|
2946
|
+
keyBindings?: SelectKeyBinding[];
|
|
2947
|
+
keyAliasMap?: KeyAliasMap;
|
|
2948
|
+
}
|
|
2949
|
+
type SelectRenderableOptions = SelectOptions;
|
|
2950
|
+
declare class Select extends Box {
|
|
2951
|
+
private _selectOptions;
|
|
2952
|
+
private _selectedIndex;
|
|
2953
|
+
private _scrollOffset;
|
|
2954
|
+
private _textColor;
|
|
2955
|
+
private _focusedTextColor;
|
|
2956
|
+
private _selectedBgColor;
|
|
2957
|
+
private _selectedTextColor;
|
|
2958
|
+
private _descriptionColor;
|
|
2959
|
+
private _selectedDescriptionColor;
|
|
2960
|
+
private _focusedBgColor;
|
|
2961
|
+
private _showScrollIndicator;
|
|
2962
|
+
private _showDescription;
|
|
2963
|
+
private _showSelectionIndicator;
|
|
2964
|
+
private _selectionIndicator;
|
|
2965
|
+
private _unselectedIndicator;
|
|
2966
|
+
private _wrapSelection;
|
|
2967
|
+
private _fastScrollStep;
|
|
2968
|
+
private _itemSpacing;
|
|
2969
|
+
private _keyBindings;
|
|
2970
|
+
private _keyAliasMap;
|
|
2971
|
+
private _keyBindingsMap;
|
|
2972
|
+
private _contentNodeId;
|
|
2973
|
+
private readonly _keyHandler;
|
|
2974
|
+
protected _defaultOptions: {
|
|
2975
|
+
textColor: string;
|
|
2976
|
+
focusedTextColor: string;
|
|
2977
|
+
selectedBackgroundColor: string;
|
|
2978
|
+
selectedTextColor: string;
|
|
2979
|
+
descriptionColor: string;
|
|
2980
|
+
selectedDescriptionColor: string;
|
|
2981
|
+
showScrollIndicator: false;
|
|
2982
|
+
showDescription: true;
|
|
2983
|
+
showSelectionIndicator: true;
|
|
2984
|
+
selectionIndicator: string;
|
|
2985
|
+
unselectedIndicator: string;
|
|
2986
|
+
wrapSelection: false;
|
|
2987
|
+
fastScrollStep: number;
|
|
2988
|
+
itemSpacing: number;
|
|
2989
|
+
};
|
|
2990
|
+
constructor(renderer: CliRenderer, options?: SelectOptions);
|
|
2991
|
+
get options(): SelectOption[];
|
|
2992
|
+
set options(opts: SelectOption[]);
|
|
2993
|
+
get selectedIndex(): number;
|
|
2994
|
+
set selectedIndex(idx: number);
|
|
2995
|
+
get showScrollIndicator(): boolean;
|
|
2996
|
+
set showScrollIndicator(v: boolean);
|
|
2997
|
+
get showDescription(): boolean;
|
|
2998
|
+
set showDescription(v: boolean);
|
|
2999
|
+
get wrapSelection(): boolean;
|
|
3000
|
+
set wrapSelection(v: boolean);
|
|
3001
|
+
get showSelectionIndicator(): boolean;
|
|
3002
|
+
set showSelectionIndicator(v: boolean);
|
|
3003
|
+
get selectionIndicator(): string;
|
|
3004
|
+
set selectionIndicator(v: string);
|
|
3005
|
+
get unselectedIndicator(): string;
|
|
3006
|
+
set unselectedIndicator(v: string);
|
|
3007
|
+
get fastScrollStep(): number;
|
|
3008
|
+
set fastScrollStep(v: number);
|
|
3009
|
+
get focusedBackgroundColor(): RGBA | null;
|
|
3010
|
+
set focusedBackgroundColor(color: ColorInput);
|
|
3011
|
+
set selectedBackgroundColor(color: ColorInput);
|
|
3012
|
+
set textColor(color: ColorInput);
|
|
3013
|
+
set selectedTextColor(color: ColorInput);
|
|
3014
|
+
set focusedTextColor(color: ColorInput);
|
|
3015
|
+
set descriptionColor(color: ColorInput);
|
|
3016
|
+
set selectedDescriptionColor(color: ColorInput);
|
|
3017
|
+
set keyBindings(bindings: SelectKeyBinding[]);
|
|
3018
|
+
set keyAliasMap(aliases: KeyAliasMap);
|
|
3019
|
+
getSelectedOption(): SelectOption | undefined;
|
|
3020
|
+
getSelectedIndex(): number;
|
|
3021
|
+
/** Programmatically move the selection; emits SELECTION_CHANGED on change. */
|
|
3022
|
+
setSelectedIndex(index: number): void;
|
|
3023
|
+
selectCurrent(): void;
|
|
3024
|
+
moveUp(steps?: number): void;
|
|
3025
|
+
moveDown(steps?: number): void;
|
|
3026
|
+
/**
|
|
3027
|
+
* Resolve a key event against the keybinding map and dispatch the action.
|
|
3028
|
+
* Returns `true` when the key was consumed.
|
|
3029
|
+
*/
|
|
3030
|
+
handleKeyPress(key: KeyEvent): boolean;
|
|
3031
|
+
focus(): void;
|
|
3032
|
+
blur(): void;
|
|
3033
|
+
private _resolveInitialIndex;
|
|
3034
|
+
private _clampIndex;
|
|
3035
|
+
private _wrapIndex;
|
|
3036
|
+
private _isNonSelectable;
|
|
3037
|
+
private _skipNonSelectable;
|
|
3038
|
+
/** Number of rendered rows a single option occupies. */
|
|
3039
|
+
private _linesPerItem;
|
|
3040
|
+
private _updateScroll;
|
|
3041
|
+
private _getViewHeight;
|
|
3042
|
+
private _render;
|
|
3043
|
+
private _ansi;
|
|
3044
|
+
private static displayWidth;
|
|
3045
|
+
destroy(): void;
|
|
3046
|
+
}
|
|
3047
|
+
//#endregion
|
|
3048
|
+
//#region src/renderables/TextNode.d.ts
|
|
3049
|
+
interface TextNodeOptions {
|
|
3050
|
+
id?: string;
|
|
3051
|
+
fg?: ColorInput;
|
|
3052
|
+
bg?: ColorInput;
|
|
3053
|
+
bold?: boolean;
|
|
3054
|
+
italic?: boolean;
|
|
3055
|
+
underline?: boolean;
|
|
3056
|
+
dim?: boolean;
|
|
3057
|
+
strikethrough?: boolean;
|
|
3058
|
+
blink?: boolean;
|
|
3059
|
+
}
|
|
3060
|
+
interface StyleAttrs {
|
|
3061
|
+
fg?: ColorInput;
|
|
3062
|
+
bg?: ColorInput;
|
|
3063
|
+
/** Pre-computed attribute bitmask (TextAttributes flags). */
|
|
3064
|
+
attributes?: number;
|
|
3065
|
+
}
|
|
3066
|
+
/** A child can be either a string (leaf text) or a nested node. */
|
|
3067
|
+
type TextNodeChild = string | TextNode;
|
|
3068
|
+
/**
|
|
3069
|
+
* TextNode — a lightweight styled-text composition node.
|
|
3070
|
+
* Can be used standalone or nested in Text.
|
|
3071
|
+
*/
|
|
3072
|
+
declare class TextNode {
|
|
3073
|
+
private static _counter;
|
|
3074
|
+
readonly id: string;
|
|
3075
|
+
_fg: RGBA | undefined;
|
|
3076
|
+
_bg: RGBA | undefined;
|
|
3077
|
+
_attributes: number;
|
|
3078
|
+
isDirty: boolean;
|
|
3079
|
+
parent: TextNode | null;
|
|
3080
|
+
/**
|
|
3081
|
+
* Children are heterogeneous: strings are leaf text, TextNodeRenderables are
|
|
3082
|
+
* nested nodes. Stored as a union array.
|
|
3083
|
+
*
|
|
3084
|
+
* NOTE: Do NOT store leaf text in a separate field — always use children.
|
|
3085
|
+
* This ensures `clear()` wipes everything and the `children` setter works.
|
|
3086
|
+
*/
|
|
3087
|
+
protected _children: TextNodeChild[];
|
|
3088
|
+
constructor(options?: TextNodeOptions);
|
|
3089
|
+
/**
|
|
3090
|
+
* Create a leaf node from a plain string with optional style.
|
|
3091
|
+
* Signature: `TextNode.fromString(text, options?)`.
|
|
3092
|
+
*/
|
|
3093
|
+
static fromString(text: string, style?: StyleAttrs): TextNode;
|
|
3094
|
+
/**
|
|
3095
|
+
* Create a container node from an array of child nodes with optional root style.
|
|
3096
|
+
* Signature: `fromNodes(nodes: TextNode[], options?)`.
|
|
3097
|
+
*
|
|
3098
|
+
* Previous implementation used variadic rest params and no options,
|
|
3099
|
+
* which broke call sites that pass `([a,b,c], { fg: "..." })`.
|
|
3100
|
+
*/
|
|
3101
|
+
static fromNodes(nodes: TextNode[], options?: StyleAttrs): TextNode;
|
|
3102
|
+
get fg(): RGBA | undefined;
|
|
3103
|
+
set fg(color: ColorInput);
|
|
3104
|
+
get bg(): RGBA | undefined;
|
|
3105
|
+
set bg(color: ColorInput);
|
|
3106
|
+
get attributes(): number;
|
|
3107
|
+
set attributes(v: number);
|
|
3108
|
+
/**
|
|
3109
|
+
* Read-only view of this node's children (strings + sub-nodes).
|
|
3110
|
+
* For mutation use the setter or `add`/`remove`/`clear`.
|
|
3111
|
+
*/
|
|
3112
|
+
get children(): readonly TextNodeChild[];
|
|
3113
|
+
/**
|
|
3114
|
+
* Replace all children with a new array of strings and/or nodes.
|
|
3115
|
+
* The `children` setter: detaches old node children, adopts
|
|
3116
|
+
* new ones, and marks the node dirty so the owner Text resyncs.
|
|
3117
|
+
*
|
|
3118
|
+
* Usage (dynamic update pattern):
|
|
3119
|
+
* ```ts
|
|
3120
|
+
* counterNode.children = [`\n\nCounter: ${n}`];
|
|
3121
|
+
* ```
|
|
3122
|
+
*/
|
|
3123
|
+
set children(newChildren: TextNodeChild[]);
|
|
3124
|
+
/**
|
|
3125
|
+
* Append a string, TextNode, or StyledText as a child.
|
|
3126
|
+
* Returns the index at which the child was inserted.
|
|
3127
|
+
*/
|
|
3128
|
+
add(child: TextNodeChild | StyledText, index?: number): number;
|
|
3129
|
+
remove(child: TextNode): void;
|
|
3130
|
+
/**
|
|
3131
|
+
* Insert `child` before `anchor`. Throws if `anchor` is provided but not
|
|
3132
|
+
* found — strict contract (helps catch anchor mismatches).
|
|
3133
|
+
*/
|
|
3134
|
+
insertBefore(child: TextNodeChild | StyledText, anchor?: TextNode): void;
|
|
3135
|
+
/**
|
|
3136
|
+
* Remove all children and mark the node dirty.
|
|
3137
|
+
* Unlike the old implementation there is NO separate `_text` field to miss.
|
|
3138
|
+
*/
|
|
3139
|
+
clear(): void;
|
|
3140
|
+
getChildren(): readonly TextNodeChild[];
|
|
3141
|
+
/**
|
|
3142
|
+
* Walk this node and all descendants, accumulating {@link TextChunk}s with
|
|
3143
|
+
* inherited style applied. Called by `Text.onLifecyclePass` to
|
|
3144
|
+
* build the flat chunk array that goes to the engine.
|
|
3145
|
+
*/
|
|
3146
|
+
gatherWithInheritedStyle(inherited: {
|
|
3147
|
+
fg?: RGBA;
|
|
3148
|
+
bg?: RGBA;
|
|
3149
|
+
attributes?: number;
|
|
3150
|
+
link?: {
|
|
3151
|
+
url: string;
|
|
3152
|
+
} | undefined;
|
|
3153
|
+
}): TextChunk[];
|
|
3154
|
+
/** Serialise this node tree to an ANSI-escaped string. */
|
|
3155
|
+
toString(): string;
|
|
3156
|
+
/** Walk up the parent chain and mark all ancestors dirty. */
|
|
3157
|
+
private _bubbleDirty;
|
|
3158
|
+
}
|
|
3159
|
+
/**
|
|
3160
|
+
* RootTextNode — the root text node for a Text.
|
|
3161
|
+
* When any descendant calls `_bubbleDirty()` and the dirty flag reaches this
|
|
3162
|
+
* root, the `onDirty` callback is invoked so the owning `Text` can
|
|
3163
|
+
* schedule a re-sync to the engine on the next lifecycle pass.
|
|
3164
|
+
*/
|
|
3165
|
+
declare class RootTextNode extends TextNode {
|
|
3166
|
+
private readonly _onDirty;
|
|
3167
|
+
constructor(options?: TextNodeOptions, onDirty?: () => void);
|
|
3168
|
+
/**
|
|
3169
|
+
* Overrides the private `_bubbleDirty` propagation: when this root is
|
|
3170
|
+
* reached, fire the `onDirty` callback instead of (or in addition to)
|
|
3171
|
+
* walking further up (there is no parent above the root).
|
|
3172
|
+
*/
|
|
3173
|
+
markDirtyFromChild(): void;
|
|
3174
|
+
}
|
|
3175
|
+
//#endregion
|
|
3176
|
+
//#region src/renderables/Text.d.ts
|
|
3177
|
+
interface TextOptions extends BoxOptions {
|
|
3178
|
+
content?: StyledText | string;
|
|
3179
|
+
/** Foreground (text) color. */
|
|
3180
|
+
fg?: ColorInput;
|
|
3181
|
+
/** Background color (alias for backgroundColor). */
|
|
3182
|
+
bg?: ColorInput;
|
|
3183
|
+
/** Text wrap mode. */
|
|
3184
|
+
wrapMode?: "none" | "char" | "word";
|
|
3185
|
+
/** Truncate long lines with ellipsis. */
|
|
3186
|
+
truncate?: boolean;
|
|
3187
|
+
/** Text alignment. */
|
|
3188
|
+
textAlign?: "left" | "center" | "right";
|
|
3189
|
+
margin?: number;
|
|
3190
|
+
/** Enable text selection. */
|
|
3191
|
+
selectable?: boolean;
|
|
3192
|
+
/** Selection background color. */
|
|
3193
|
+
selectionBg?: ColorInput;
|
|
3194
|
+
/** Selection foreground color. */
|
|
3195
|
+
selectionFg?: ColorInput;
|
|
3196
|
+
}
|
|
3197
|
+
declare class Text extends Box {
|
|
3198
|
+
private _fg;
|
|
3199
|
+
private _bg;
|
|
3200
|
+
private _textNodeId;
|
|
3201
|
+
private _wrapMode;
|
|
3202
|
+
private _truncate;
|
|
3203
|
+
/**
|
|
3204
|
+
* The root of the TextNode tree. All structured text attached via `add()`
|
|
3205
|
+
* lives here. The lifecycle pass reads `isDirty` and, when true, gathers
|
|
3206
|
+
* chunks from this tree and pushes them to the engine.
|
|
3207
|
+
*/
|
|
3208
|
+
readonly rootTextNode: RootTextNode;
|
|
3209
|
+
/**
|
|
3210
|
+
* Bound lifecycle pass function, registered with the renderer so it is
|
|
3211
|
+
* invoked once per frame. Kept as an arrow function so `unregister` works
|
|
3212
|
+
* correctly on cleanup.
|
|
3213
|
+
*/
|
|
3214
|
+
private readonly _lifecyclePassFn;
|
|
3215
|
+
constructor(renderer: CliRenderer, options?: TextOptions);
|
|
3216
|
+
/**
|
|
3217
|
+
* Attach a TextNode to the root text node.
|
|
3218
|
+
*
|
|
3219
|
+
* This is the canonical BetterTUI API (`demoText.add(containerNode)`).
|
|
3220
|
+
*
|
|
3221
|
+
* NOTE: Named `addNode` rather than `add` because `Text` extends
|
|
3222
|
+
* `Box` whose `add(Box)` has a different signature.
|
|
3223
|
+
*/
|
|
3224
|
+
addNode(node: TextNode, index?: number): void;
|
|
3225
|
+
/**
|
|
3226
|
+
* Convenience: remove a previously added TextNode from the root.
|
|
3227
|
+
*/
|
|
3228
|
+
removeNode(node: TextNode): void;
|
|
3229
|
+
/**
|
|
3230
|
+
* `content` setter — accepts a plain string or StyledText.
|
|
3231
|
+
* Replaces all children of the root text node with a single string child.
|
|
3232
|
+
* Kept for backward-compatibility with code that does `text.content = "..."`.
|
|
3233
|
+
*/
|
|
3234
|
+
get content(): string;
|
|
3235
|
+
set content(value: StyledText | string | string[]);
|
|
3236
|
+
/** Clear all text content (clears the root node tree). */
|
|
3237
|
+
clear(): void;
|
|
3238
|
+
get wrapMode(): "none" | "char" | "word";
|
|
3239
|
+
set wrapMode(value: "none" | "char" | "word");
|
|
3240
|
+
get truncate(): boolean;
|
|
3241
|
+
set truncate(value: boolean);
|
|
3242
|
+
get fg(): RGBA | null;
|
|
3243
|
+
set fg(color: ColorInput);
|
|
3244
|
+
set bg(color: ColorInput);
|
|
3245
|
+
set textColor(color: ColorInput);
|
|
3246
|
+
/**
|
|
3247
|
+
* Called once per frame by the CliRenderer lifecycle loop.
|
|
3248
|
+
* Checks whether the root text node is dirty; if so, re-gathers all chunks
|
|
3249
|
+
* from the node tree and pushes the new ANSI string to the engine.
|
|
3250
|
+
*
|
|
3251
|
+
* This is the mechanism behind BetterTUI's "mutate a node → auto-update"
|
|
3252
|
+
* pattern.
|
|
3253
|
+
*/
|
|
3254
|
+
onLifecyclePass(): void;
|
|
3255
|
+
destroy(): void;
|
|
3256
|
+
/** Push the current node-tree content to the engine as an ANSI string. */
|
|
3257
|
+
private _syncToEngine;
|
|
3258
|
+
private _applyTextStyle;
|
|
3259
|
+
}
|
|
3260
|
+
//#endregion
|
|
3261
|
+
//#region src/renderables/Stubs.d.ts
|
|
3262
|
+
type ASCIIFontKind = "tiny" | "block" | "shade" | "slick" | string;
|
|
3263
|
+
interface ASCIIFontOptions extends BoxOptions {
|
|
3264
|
+
text?: string;
|
|
3265
|
+
font?: ASCIIFontKind;
|
|
3266
|
+
color?: ColorInput | ColorInput[];
|
|
3267
|
+
backgroundColor?: ColorInput;
|
|
3268
|
+
selectionBg?: ColorInput;
|
|
3269
|
+
selectionFg?: ColorInput;
|
|
3270
|
+
}
|
|
3271
|
+
declare class ASCIIFont extends Box {
|
|
3272
|
+
private _text;
|
|
3273
|
+
private _font;
|
|
3274
|
+
private _color;
|
|
3275
|
+
private _contentNodeId;
|
|
3276
|
+
private static readonly TINY_CHARS;
|
|
3277
|
+
constructor(renderer: CliRenderer, options?: ASCIIFontOptions);
|
|
3278
|
+
get text(): string;
|
|
3279
|
+
set text(v: string);
|
|
3280
|
+
get font(): ASCIIFontKind;
|
|
3281
|
+
set font(v: ASCIIFontKind);
|
|
3282
|
+
get color(): RGBA[];
|
|
3283
|
+
set color(v: RGBA | RGBA[]);
|
|
3284
|
+
getEstimatedHeight(): number;
|
|
3285
|
+
private _render;
|
|
3286
|
+
destroy(): void;
|
|
3287
|
+
/** Returns whether this renderable has an active selection. */
|
|
3288
|
+
hasSelection(): boolean;
|
|
3289
|
+
}
|
|
3290
|
+
interface FrameBufferOptions extends BoxOptions {
|
|
3291
|
+
drawFn?: (buffer: FrameBufferLike, deltaTime: number, renderable: FrameBuffer) => void;
|
|
3292
|
+
}
|
|
3293
|
+
interface FrameBufferLike {
|
|
3294
|
+
width: number;
|
|
3295
|
+
height: number;
|
|
3296
|
+
setCell(x: number, y: number, char: string, fg?: RGBA, bg?: RGBA): void;
|
|
3297
|
+
drawText(text: string, x: number, y: number, fg?: RGBA, bg?: RGBA): void;
|
|
3298
|
+
fillRect(x: number, y: number, w: number, h: number, color: RGBA): void;
|
|
3299
|
+
clear(color?: RGBA): void;
|
|
3300
|
+
}
|
|
3301
|
+
declare class FrameBuffer extends Box {
|
|
3302
|
+
private _drawFn;
|
|
3303
|
+
private _buffer;
|
|
3304
|
+
private _contentNodeId;
|
|
3305
|
+
get frameBuffer(): FrameBufferLike;
|
|
3306
|
+
constructor(renderer: CliRenderer, options?: FrameBufferOptions);
|
|
3307
|
+
draw(deltaTime: number): void;
|
|
3308
|
+
private _flush;
|
|
3309
|
+
destroy(): void;
|
|
3310
|
+
}
|
|
3311
|
+
interface CodeOptions extends TextOptions {
|
|
3312
|
+
language?: string;
|
|
3313
|
+
filetype?: string;
|
|
3314
|
+
showLineNumbers?: boolean;
|
|
3315
|
+
code?: string;
|
|
3316
|
+
selectionBg?: ColorInput;
|
|
3317
|
+
selectionFg?: ColorInput;
|
|
3318
|
+
syntaxStyle?: unknown;
|
|
3319
|
+
}
|
|
3320
|
+
declare class Code extends Text {
|
|
3321
|
+
private _language;
|
|
3322
|
+
private _showLineNumbers;
|
|
3323
|
+
private _code;
|
|
3324
|
+
filetype: string;
|
|
3325
|
+
selectionBg: ColorInput;
|
|
3326
|
+
selectionFg: ColorInput;
|
|
3327
|
+
syntaxStyle: unknown;
|
|
3328
|
+
virtualLineCount: number;
|
|
3329
|
+
constructor(renderer: CliRenderer, options?: CodeOptions);
|
|
3330
|
+
get code(): string;
|
|
3331
|
+
set code(v: string);
|
|
3332
|
+
get showLineNumbers(): boolean;
|
|
3333
|
+
set showLineNumbers(v: boolean);
|
|
3334
|
+
set language(v: string);
|
|
3335
|
+
conceal(_ranges: unknown): void;
|
|
3336
|
+
private _renderCode;
|
|
3337
|
+
}
|
|
3338
|
+
interface DiffOptions extends TextOptions {
|
|
3339
|
+
oldText?: string;
|
|
3340
|
+
newText?: string;
|
|
3341
|
+
mode?: "unified" | "split";
|
|
3342
|
+
}
|
|
3343
|
+
declare class Diff extends Text {
|
|
3344
|
+
constructor(renderer: CliRenderer, options?: DiffOptions);
|
|
3345
|
+
setDiff(oldText: string, newText: string): void;
|
|
3346
|
+
private _setDiff;
|
|
3347
|
+
}
|
|
3348
|
+
interface MarkdownOptions extends TextOptions {
|
|
3349
|
+
content?: string | StyledText;
|
|
3350
|
+
}
|
|
3351
|
+
declare class Markdown extends Text {
|
|
3352
|
+
constructor(renderer: CliRenderer, options?: MarkdownOptions);
|
|
3353
|
+
set markdown(text: string);
|
|
3354
|
+
}
|
|
3355
|
+
interface TableColumn {
|
|
3356
|
+
header: string;
|
|
3357
|
+
key?: string;
|
|
3358
|
+
width?: number;
|
|
3359
|
+
align?: "left" | "center" | "right";
|
|
3360
|
+
}
|
|
3361
|
+
type TextTableColumnWidthMode = "content" | "full";
|
|
3362
|
+
type TextTableColumnFitter = "proportional" | "balanced";
|
|
3363
|
+
type TextTableContent = Array<Array<TextChunk[] | Array<TextChunk>>>;
|
|
3364
|
+
interface TextTableOptions extends BoxOptions {
|
|
3365
|
+
columns?: TableColumn[];
|
|
3366
|
+
rows?: Record<string, unknown>[][];
|
|
3367
|
+
data?: string[][];
|
|
3368
|
+
showBorder?: boolean;
|
|
3369
|
+
headerColor?: ColorInput;
|
|
3370
|
+
rowColor?: ColorInput;
|
|
3371
|
+
alternateRowColor?: ColorInput;
|
|
3372
|
+
wrapMode?: "none" | "word" | "char";
|
|
3373
|
+
columnWidthMode?: TextTableColumnWidthMode;
|
|
3374
|
+
columnFitter?: TextTableColumnFitter;
|
|
3375
|
+
cellPadding?: number;
|
|
3376
|
+
border?: boolean;
|
|
3377
|
+
outerBorder?: boolean;
|
|
3378
|
+
showBorders?: boolean;
|
|
3379
|
+
borderStyle?: BorderStyleKind;
|
|
3380
|
+
borderColor?: ColorInput;
|
|
3381
|
+
fg?: ColorInput;
|
|
3382
|
+
bg?: ColorInput;
|
|
3383
|
+
content?: TextTableContent;
|
|
3384
|
+
}
|
|
3385
|
+
declare class TextTable extends Box {
|
|
3386
|
+
private _columns;
|
|
3387
|
+
private _data;
|
|
3388
|
+
private _contentNodeId;
|
|
3389
|
+
private _headerColor;
|
|
3390
|
+
private _rowColor;
|
|
3391
|
+
private _wrapMode;
|
|
3392
|
+
private _columnWidthMode;
|
|
3393
|
+
private _columnFitter;
|
|
3394
|
+
private _cellPadding;
|
|
3395
|
+
private _outerBorder;
|
|
3396
|
+
private _showBorders;
|
|
3397
|
+
private _content;
|
|
3398
|
+
constructor(renderer: CliRenderer, options?: TextTableOptions);
|
|
3399
|
+
get wrapMode(): "none" | "word" | "char";
|
|
3400
|
+
set wrapMode(v: "none" | "word" | "char");
|
|
3401
|
+
get columnWidthMode(): TextTableColumnWidthMode;
|
|
3402
|
+
set columnWidthMode(v: TextTableColumnWidthMode);
|
|
3403
|
+
get columnFitter(): TextTableColumnFitter;
|
|
3404
|
+
set columnFitter(v: TextTableColumnFitter);
|
|
3405
|
+
get cellPadding(): number;
|
|
3406
|
+
set cellPadding(v: number);
|
|
3407
|
+
get outerBorder(): boolean;
|
|
3408
|
+
set outerBorder(v: boolean);
|
|
3409
|
+
get showBorders(): boolean;
|
|
3410
|
+
set showBorders(v: boolean);
|
|
3411
|
+
get content(): TextTableContent | null;
|
|
3412
|
+
set content(v: TextTableContent | null);
|
|
3413
|
+
setData(columns: TableColumn[], data: string[][]): void;
|
|
3414
|
+
addRow(row: string[]): void;
|
|
3415
|
+
private _render;
|
|
3416
|
+
destroy(): void;
|
|
3417
|
+
}
|
|
3418
|
+
interface LineNumberOptions extends BoxOptions {
|
|
3419
|
+
lineCount?: number;
|
|
3420
|
+
startLine?: number;
|
|
3421
|
+
color?: ColorInput;
|
|
3422
|
+
highlightColor?: ColorInput;
|
|
3423
|
+
highlightLine?: number;
|
|
3424
|
+
target?: unknown;
|
|
3425
|
+
}
|
|
3426
|
+
declare class LineNumber extends Box {
|
|
3427
|
+
private _lineCount;
|
|
3428
|
+
private _startLine;
|
|
3429
|
+
private _color;
|
|
3430
|
+
private _highlightColor;
|
|
3431
|
+
private _highlightLine;
|
|
3432
|
+
private _contentNodeId;
|
|
3433
|
+
fg: ColorInput;
|
|
3434
|
+
bg: ColorInput;
|
|
3435
|
+
constructor(renderer: CliRenderer, options?: LineNumberOptions);
|
|
3436
|
+
get lineCount(): number;
|
|
3437
|
+
set lineCount(v: number);
|
|
3438
|
+
get showLineNumbers(): boolean;
|
|
3439
|
+
set highlightLine(v: number);
|
|
3440
|
+
setLineColor(_line: number, _color: ColorInput): void;
|
|
3441
|
+
clearAllLineColors(): void;
|
|
3442
|
+
setLineSign(_line: number, _sign: string, _color?: ColorInput): void;
|
|
3443
|
+
clearLineSign(_line: number): void;
|
|
3444
|
+
getLineSigns(_line: number): string[];
|
|
3445
|
+
private _render;
|
|
3446
|
+
destroy(): void;
|
|
3447
|
+
}
|
|
3448
|
+
interface TimeToFirstDrawOptions extends TextOptions {
|
|
3449
|
+
fg?: ColorInput;
|
|
3450
|
+
color?: RGBA;
|
|
3451
|
+
}
|
|
3452
|
+
declare class TimeToFirstDraw extends Box {
|
|
3453
|
+
private _fg;
|
|
3454
|
+
private _color;
|
|
3455
|
+
private _contentNodeId;
|
|
3456
|
+
private _startTime;
|
|
3457
|
+
constructor(renderer: CliRenderer, options?: TimeToFirstDrawOptions);
|
|
3458
|
+
get fg(): RGBA;
|
|
3459
|
+
set fg(color: ColorInput);
|
|
3460
|
+
get color(): RGBA;
|
|
3461
|
+
set color(v: RGBA);
|
|
3462
|
+
private _render;
|
|
3463
|
+
destroy(): void;
|
|
3464
|
+
}
|
|
3465
|
+
//#endregion
|
|
3466
|
+
//#region src/renderables/TabSelect.d.ts
|
|
3467
|
+
interface TabOption {
|
|
3468
|
+
name: string;
|
|
3469
|
+
description?: string;
|
|
3470
|
+
value?: unknown;
|
|
3471
|
+
}
|
|
3472
|
+
interface TabSelectOptions extends BoxOptions {
|
|
3473
|
+
options?: TabOption[];
|
|
3474
|
+
selectedIndex?: number;
|
|
3475
|
+
/** Fixed width for each tab in characters. Set to 0 for auto-width based on content. */
|
|
3476
|
+
tabWidth?: number;
|
|
3477
|
+
/** Minimum width for auto-sized tabs. Ignored when tabWidth > 0. */
|
|
3478
|
+
minTabWidth?: number;
|
|
3479
|
+
/** Padding added to each side of tab text in auto mode. Default: 2. */
|
|
3480
|
+
tabPadding?: number;
|
|
3481
|
+
/** Gap between tabs in characters. Default: 1. */
|
|
3482
|
+
tabGap?: number;
|
|
3483
|
+
showDescription?: boolean;
|
|
3484
|
+
showUnderline?: boolean;
|
|
3485
|
+
showScrollArrows?: boolean;
|
|
3486
|
+
scrollArrowLeft?: string;
|
|
3487
|
+
scrollArrowRight?: string;
|
|
3488
|
+
wrapSelection?: boolean;
|
|
3489
|
+
backgroundColor?: ColorInput;
|
|
3490
|
+
textColor?: ColorInput;
|
|
3491
|
+
selectedTextColor?: ColorInput;
|
|
3492
|
+
selectedBackgroundColor?: ColorInput;
|
|
3493
|
+
activeUnderlineColor?: ColorInput;
|
|
3494
|
+
inactiveUnderlineColor?: ColorInput;
|
|
3495
|
+
descriptionColor?: ColorInput;
|
|
3496
|
+
}
|
|
3497
|
+
type TabSelectRenderableOptions = TabSelectOptions;
|
|
3498
|
+
declare class TabSelect extends Box {
|
|
3499
|
+
private _tabOptions;
|
|
3500
|
+
private _selectedIndex;
|
|
3501
|
+
private _tabWidth;
|
|
3502
|
+
private _minTabWidth;
|
|
3503
|
+
private _tabPadding;
|
|
3504
|
+
private _tabGap;
|
|
3505
|
+
private _showDescription;
|
|
3506
|
+
private _showUnderline;
|
|
3507
|
+
private _showScrollArrows;
|
|
3508
|
+
private _scrollArrowLeft;
|
|
3509
|
+
private _scrollArrowRight;
|
|
3510
|
+
private _wrapSelection;
|
|
3511
|
+
private _textColor;
|
|
3512
|
+
private _selectedTextColor;
|
|
3513
|
+
private _selectedBgColor;
|
|
3514
|
+
private _activeUnderlineColor;
|
|
3515
|
+
private _inactiveUnderlineColor;
|
|
3516
|
+
private _descriptionColor;
|
|
3517
|
+
private _contentNodeId;
|
|
3518
|
+
private readonly _keyHandler;
|
|
3519
|
+
constructor(renderer: CliRenderer, options?: TabSelectOptions);
|
|
3520
|
+
get options(): TabOption[];
|
|
3521
|
+
set options(opts: TabOption[]);
|
|
3522
|
+
get selectedIndex(): number;
|
|
3523
|
+
set selectedIndex(idx: number);
|
|
3524
|
+
get showDescription(): boolean;
|
|
3525
|
+
set showDescription(v: boolean);
|
|
3526
|
+
get showUnderline(): boolean;
|
|
3527
|
+
set showUnderline(v: boolean);
|
|
3528
|
+
get showScrollArrows(): boolean;
|
|
3529
|
+
set showScrollArrows(v: boolean);
|
|
3530
|
+
get scrollArrowLeft(): string;
|
|
3531
|
+
set scrollArrowLeft(v: string);
|
|
3532
|
+
get scrollArrowRight(): string;
|
|
3533
|
+
set scrollArrowRight(v: string);
|
|
3534
|
+
get wrapSelection(): boolean;
|
|
3535
|
+
set wrapSelection(v: boolean);
|
|
3536
|
+
getSelectedOption(): TabOption | undefined;
|
|
3537
|
+
getSelectedIndex(): number;
|
|
3538
|
+
selectCurrent(): void;
|
|
3539
|
+
moveLeft(steps?: number): void;
|
|
3540
|
+
moveRight(steps?: number): void;
|
|
3541
|
+
focus(): void;
|
|
3542
|
+
blur(): void;
|
|
3543
|
+
private _handleKey;
|
|
3544
|
+
private _render;
|
|
3545
|
+
destroy(): void;
|
|
3546
|
+
}
|
|
3547
|
+
//#endregion
|
|
3548
|
+
//#region src/lib/vnode.d.ts
|
|
3549
|
+
/** A VNode (virtual node) — a lazy description of a renderable. */
|
|
3550
|
+
interface VNode {
|
|
3551
|
+
_type: string | (new (renderer: CliRenderer, options: Record<string, unknown>) => Box);
|
|
3552
|
+
_props: Record<string, unknown>;
|
|
3553
|
+
_children: VNode[];
|
|
3554
|
+
}
|
|
3555
|
+
/**
|
|
3556
|
+
* Create a VNode.
|
|
3557
|
+
*/
|
|
3558
|
+
declare function h(type: string | (new (renderer: CliRenderer, options: Record<string, unknown>) => Box), props?: Record<string, unknown> | null, ...children: (VNode | string | null | undefined)[]): VNode;
|
|
3559
|
+
/**
|
|
3560
|
+
* Instantiate a VNode tree into real renderables.
|
|
3561
|
+
*/
|
|
3562
|
+
declare function instantiate(ctx: CliRenderer, vnode: VNode): Box;
|
|
3563
|
+
/**
|
|
3564
|
+
* Redirect add/remove/focus calls to a named child renderable.
|
|
3565
|
+
*/
|
|
3566
|
+
declare function delegate(targets: string | string[], vnode: VNode): VNode;
|
|
3567
|
+
/** Maybe create a renderable from a VNode or return existing renderable. */
|
|
3568
|
+
declare function maybeMakeRenderable(ctx: CliRenderer, input: VNode | Box): Box;
|
|
3569
|
+
declare function BoxVNode(props?: BoxOptions, ...children: VNode[]): VNode;
|
|
3570
|
+
declare function TextVNode(props?: TextOptions, ...children: (VNode | string)[]): VNode;
|
|
3571
|
+
declare function InputVNode(props?: InputOptions, ...children: VNode[]): VNode;
|
|
3572
|
+
declare function SelectVNode(props?: SelectOptions, ...children: VNode[]): VNode;
|
|
3573
|
+
declare function TabSelectVNode(props?: TabSelectOptions, ...children: VNode[]): VNode;
|
|
3574
|
+
declare function CodeVNode(props?: CodeOptions, ...children: VNode[]): VNode;
|
|
3575
|
+
declare function GenericVNode(props?: BoxOptions & {
|
|
3576
|
+
render?: (buffer: FrameBufferLike, dt: number, r: Box) => void;
|
|
3577
|
+
}, ...children: VNode[]): VNode;
|
|
3578
|
+
declare function ScrollBox$1(props?: BoxOptions, ...children: VNode[]): VNode;
|
|
3579
|
+
declare function ASCIIFont$1(props?: ASCIIFontOptions, ...children: VNode[]): VNode;
|
|
3580
|
+
declare const vstyles: {
|
|
3581
|
+
bold: (text: string) => VNode;
|
|
3582
|
+
italic: (text: string) => VNode;
|
|
3583
|
+
underline: (text: string) => VNode;
|
|
3584
|
+
dim: (text: string) => VNode;
|
|
3585
|
+
color: (color: string, ...children: (string | VNode)[]) => VNode;
|
|
3586
|
+
bgColor: (color: string, ...children: (string | VNode)[]) => VNode;
|
|
3587
|
+
fg: (color: string) => (text: string) => VNode;
|
|
3588
|
+
bg: (color: string) => (text: string) => VNode;
|
|
3589
|
+
styled: (attrs: Record<string, unknown>, text: string) => VNode;
|
|
3590
|
+
boldItalic: (text: string) => VNode;
|
|
3591
|
+
boldUnderline: (text: string) => VNode;
|
|
3592
|
+
};
|
|
3593
|
+
//#endregion
|
|
3594
|
+
//#region src/platform/layoutSerializer.d.ts
|
|
3595
|
+
declare function layoutToEngineJson(layout: LayoutConstraints$1): Record<string, unknown>;
|
|
3596
|
+
//#endregion
|
|
3597
|
+
//#region src/testing/mockKeys.d.ts
|
|
3598
|
+
declare const KeyCodes: {
|
|
3599
|
+
readonly RETURN: "\r";
|
|
3600
|
+
readonly LINEFEED: "\n";
|
|
3601
|
+
readonly TAB: "\t";
|
|
3602
|
+
readonly BACKSPACE: "";
|
|
3603
|
+
readonly DELETE: "[3~";
|
|
3604
|
+
readonly HOME: "[H";
|
|
3605
|
+
readonly END: "[F";
|
|
3606
|
+
readonly ESCAPE: "";
|
|
3607
|
+
readonly ARROW_UP: "[A";
|
|
3608
|
+
readonly ARROW_DOWN: "[B";
|
|
3609
|
+
readonly ARROW_RIGHT: "[C";
|
|
3610
|
+
readonly ARROW_LEFT: "[D";
|
|
3611
|
+
readonly F1: "OP";
|
|
3612
|
+
readonly F2: "OQ";
|
|
3613
|
+
readonly F3: "OR";
|
|
3614
|
+
readonly F4: "OS";
|
|
3615
|
+
readonly F5: "[15~";
|
|
3616
|
+
readonly F6: "[17~";
|
|
3617
|
+
readonly F7: "[18~";
|
|
3618
|
+
readonly F8: "[19~";
|
|
3619
|
+
readonly F9: "[20~";
|
|
3620
|
+
readonly F10: "[21~";
|
|
3621
|
+
readonly F11: "[23~";
|
|
3622
|
+
readonly F12: "[24~";
|
|
3623
|
+
readonly PAGE_UP: "[5~";
|
|
3624
|
+
readonly PAGE_DOWN: "[6~";
|
|
3625
|
+
};
|
|
3626
|
+
type TestKeyInput = string | keyof typeof KeyCodes;
|
|
3627
|
+
interface MockKeysOptions {
|
|
3628
|
+
kittyKeyboard?: boolean | undefined;
|
|
3629
|
+
}
|
|
3630
|
+
interface KeyModifiers {
|
|
3631
|
+
shift?: boolean;
|
|
3632
|
+
ctrl?: boolean;
|
|
3633
|
+
alt?: boolean;
|
|
3634
|
+
meta?: boolean;
|
|
3635
|
+
}
|
|
3636
|
+
declare function createMockKeys(_renderer: CliRenderer, _options?: MockKeysOptions): {
|
|
3637
|
+
pressKey: (key: TestKeyInput, modifiers?: KeyModifiers) => void;
|
|
3638
|
+
pressKeys: (keys: TestKeyInput[], delayMs?: number) => Promise<void>;
|
|
3639
|
+
typeText: (text: string, delayMs?: number) => Promise<void>;
|
|
3640
|
+
pressEnter: (modifiers?: KeyModifiers) => void;
|
|
3641
|
+
pressEscape: (modifiers?: KeyModifiers) => void;
|
|
3642
|
+
pressTab: (modifiers?: KeyModifiers) => void;
|
|
3643
|
+
pressBackspace: (modifiers?: KeyModifiers) => void;
|
|
3644
|
+
pressArrow: (direction: "up" | "down" | "left" | "right", modifiers?: KeyModifiers) => void;
|
|
3645
|
+
pressCtrlC: () => void;
|
|
3646
|
+
pressCtrlD: () => void;
|
|
3647
|
+
pressPageUp: (modifiers?: KeyModifiers) => void;
|
|
3648
|
+
pressPageDown: (modifiers?: KeyModifiers) => void;
|
|
3649
|
+
pressHome: (modifiers?: KeyModifiers) => void;
|
|
3650
|
+
pressEnd: (modifiers?: KeyModifiers) => void;
|
|
3651
|
+
pressDelete: (modifiers?: KeyModifiers) => void;
|
|
3652
|
+
getKeyHistory: () => string[];
|
|
3653
|
+
clearHistory: () => void;
|
|
3654
|
+
};
|
|
3655
|
+
//#endregion
|
|
3656
|
+
//#region src/testing/mockMouse.d.ts
|
|
3657
|
+
declare const MouseButtons: {
|
|
3658
|
+
readonly LEFT: 0;
|
|
3659
|
+
readonly MIDDLE: 1;
|
|
3660
|
+
readonly RIGHT: 2;
|
|
3661
|
+
readonly WHEEL_UP: 64;
|
|
3662
|
+
readonly WHEEL_DOWN: 65;
|
|
3663
|
+
readonly WHEEL_LEFT: 66;
|
|
3664
|
+
readonly WHEEL_RIGHT: 67;
|
|
3665
|
+
};
|
|
3666
|
+
type MouseButton$1 = (typeof MouseButtons)[keyof typeof MouseButtons];
|
|
3667
|
+
interface MousePosition {
|
|
3668
|
+
x: number;
|
|
3669
|
+
y: number;
|
|
3670
|
+
}
|
|
3671
|
+
interface MouseModifiers {
|
|
3672
|
+
shift?: boolean;
|
|
3673
|
+
alt?: boolean;
|
|
3674
|
+
ctrl?: boolean;
|
|
3675
|
+
}
|
|
3676
|
+
type MouseEventType = "down" | "up" | "move" | "drag" | "scroll";
|
|
3677
|
+
interface MouseEventOptions {
|
|
3678
|
+
button?: MouseButton$1;
|
|
3679
|
+
modifiers?: MouseModifiers;
|
|
3680
|
+
delayMs?: number;
|
|
3681
|
+
}
|
|
3682
|
+
declare function createMockMouse(): {
|
|
3683
|
+
moveTo: (x: number, y: number, options?: MouseEventOptions) => Promise<void>;
|
|
3684
|
+
click: (x: number, y: number, button?: MouseButton$1, options?: MouseEventOptions) => Promise<void>;
|
|
3685
|
+
doubleClick: (x: number, y: number, button?: MouseButton$1, options?: MouseEventOptions) => Promise<void>;
|
|
3686
|
+
pressDown: (x: number, y: number, button?: MouseButton$1, options?: MouseEventOptions) => Promise<void>;
|
|
3687
|
+
release: (x: number, y: number, button?: MouseButton$1, options?: MouseEventOptions) => Promise<void>;
|
|
3688
|
+
drag: (startX: number, startY: number, endX: number, endY: number, button?: MouseButton$1, options?: MouseEventOptions) => Promise<void>;
|
|
3689
|
+
scroll: (x: number, y: number, direction: "up" | "down" | "left" | "right", options?: MouseEventOptions) => Promise<void>;
|
|
3690
|
+
getCurrentPosition: () => MousePosition;
|
|
3691
|
+
getPressedButtons: () => MouseButton$1[];
|
|
3692
|
+
emitMouseEvent: (type: MouseEventType, x: number, y: number, button?: MouseButton$1, options?: Omit<MouseEventOptions, "button">) => Promise<void>;
|
|
3693
|
+
getEventHistory: () => string[];
|
|
3694
|
+
clearHistory: () => void;
|
|
3695
|
+
};
|
|
3696
|
+
//#endregion
|
|
3697
|
+
//#region src/testing/testStreams.d.ts
|
|
3698
|
+
declare class TestWriteStream extends Writable {
|
|
3699
|
+
readonly isTTY = true;
|
|
3700
|
+
columns: number;
|
|
3701
|
+
rows: number;
|
|
3702
|
+
buffer: Buffer;
|
|
3703
|
+
constructor(columns?: number, rows?: number);
|
|
3704
|
+
_write(chunk: Buffer, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
3705
|
+
getColorDepth(): number;
|
|
3706
|
+
getOutput(): string;
|
|
3707
|
+
clear(): void;
|
|
3708
|
+
}
|
|
3709
|
+
type TestStdout = TestWriteStream & NodeJS.WriteStream;
|
|
3710
|
+
declare class TestReadStream extends Readable {
|
|
3711
|
+
readonly isTTY = true;
|
|
3712
|
+
constructor();
|
|
3713
|
+
emitData(data: string | Buffer): void;
|
|
3714
|
+
}
|
|
3715
|
+
type TestStdin = TestReadStream & NodeJS.ReadStream;
|
|
3716
|
+
declare function createTestStdin(): TestStdin;
|
|
3717
|
+
declare function createTestStdout(columns?: number, rows?: number): TestStdout;
|
|
3718
|
+
//#endregion
|
|
3719
|
+
//#region src/testing/testRenderer.d.ts
|
|
3720
|
+
interface TestRendererOptions extends CliRendererOptions {
|
|
3721
|
+
width?: number;
|
|
3722
|
+
height?: number;
|
|
3723
|
+
kittyKeyboard?: boolean;
|
|
3724
|
+
}
|
|
3725
|
+
type TestRenderer = CliRenderer;
|
|
3726
|
+
type MockInput = ReturnType<typeof createMockKeys>;
|
|
3727
|
+
type MockMouse = ReturnType<typeof createMockMouse>;
|
|
3728
|
+
interface TestRendererSetup {
|
|
3729
|
+
renderer: TestRenderer;
|
|
3730
|
+
mockInput: MockInput;
|
|
3731
|
+
mockMouse: MockMouse;
|
|
3732
|
+
stdin: TestStdin;
|
|
3733
|
+
stdout: TestStdout;
|
|
3734
|
+
renderOnce: () => void;
|
|
3735
|
+
captureFrame: () => string;
|
|
3736
|
+
resize: (width: number, height: number) => void;
|
|
3737
|
+
cleanup: () => void;
|
|
3738
|
+
}
|
|
3739
|
+
declare function createTestRenderer(options?: TestRendererOptions): Promise<TestRendererSetup>;
|
|
3740
|
+
declare function createTestRendererSync(options?: TestRendererOptions): TestRendererSetup;
|
|
3741
|
+
//#endregion
|
|
3742
|
+
//#region src/testing/spy.d.ts
|
|
3743
|
+
interface Spy {
|
|
3744
|
+
(...args: unknown[]): void;
|
|
3745
|
+
calls: unknown[][];
|
|
3746
|
+
callCount: () => number;
|
|
3747
|
+
calledWith: (...expected: unknown[]) => boolean;
|
|
3748
|
+
lastCall: () => unknown[] | undefined;
|
|
3749
|
+
reset: () => void;
|
|
3750
|
+
}
|
|
3751
|
+
declare function createSpy(): Spy;
|
|
3752
|
+
//#endregion
|
|
3753
|
+
//#region src/testing/terminalCapabilities.d.ts
|
|
3754
|
+
interface TerminalCapabilitiesOptions {
|
|
3755
|
+
trueColor?: boolean;
|
|
3756
|
+
kittyKeyboard?: boolean;
|
|
3757
|
+
csiU?: boolean;
|
|
3758
|
+
bracketedPaste?: boolean;
|
|
3759
|
+
focusEvents?: boolean;
|
|
3760
|
+
mouse?: boolean;
|
|
3761
|
+
osc52?: boolean;
|
|
3762
|
+
osc8?: boolean;
|
|
3763
|
+
sync?: boolean;
|
|
3764
|
+
sgrPixel?: boolean;
|
|
3765
|
+
underlineColor?: boolean;
|
|
3766
|
+
strikethrough?: boolean;
|
|
3767
|
+
cursorStyle?: boolean;
|
|
3768
|
+
alternateScroll?: boolean;
|
|
3769
|
+
inlineImages?: boolean;
|
|
3770
|
+
sixel?: boolean;
|
|
3771
|
+
columns?: number;
|
|
3772
|
+
rows?: number;
|
|
3773
|
+
brand?: string;
|
|
3774
|
+
}
|
|
3775
|
+
declare function createTerminalCapabilities(options?: TerminalCapabilitiesOptions): TerminalCapabilities$1;
|
|
3776
|
+
declare function createMinimalTerminalCapabilities(): TerminalCapabilities$1;
|
|
3777
|
+
declare function createFullTerminalCapabilities(): TerminalCapabilities$1;
|
|
3778
|
+
declare function createKittyTerminalCapabilities(): TerminalCapabilities$1;
|
|
3779
|
+
declare function createITerm2TerminalCapabilities(): TerminalCapabilities$1;
|
|
3780
|
+
//#endregion
|
|
3781
|
+
//#region src/testing/testing.d.ts
|
|
3782
|
+
interface TestBinding {
|
|
3783
|
+
layer: string;
|
|
3784
|
+
id: string;
|
|
3785
|
+
keys: string;
|
|
3786
|
+
command: string;
|
|
3787
|
+
description: string | null;
|
|
3788
|
+
priority: number;
|
|
3789
|
+
enabled: boolean;
|
|
3790
|
+
}
|
|
3791
|
+
declare function createMockNativeKeymap(): NapiKeymap;
|
|
3792
|
+
declare function createTestKeymap(bindings?: Array<{
|
|
3793
|
+
layer?: string;
|
|
3794
|
+
id?: string;
|
|
3795
|
+
keys: string;
|
|
3796
|
+
command: string;
|
|
3797
|
+
description?: string;
|
|
3798
|
+
priority?: number;
|
|
3799
|
+
}>, options?: KeymapOptions): Keymap;
|
|
3800
|
+
//#endregion
|
|
3801
|
+
//#region src/animations.d.ts
|
|
3802
|
+
/**
|
|
3803
|
+
* Animation utilities: easing functions, Tween, Spring, and interpolation helpers.
|
|
3804
|
+
*
|
|
3805
|
+
* @example
|
|
3806
|
+
* ```ts
|
|
3807
|
+
* import { easing, Tween, Spring, lerp } from "@bettertui/core"
|
|
3808
|
+
*
|
|
3809
|
+
* const tw = new Tween({ from: 0, to: 100, duration: 1, onUpdate: v => setX(v) })
|
|
3810
|
+
* tw.play()
|
|
3811
|
+
* tw.tick(deltaSeconds)
|
|
3812
|
+
* ```
|
|
3813
|
+
*/
|
|
3814
|
+
/**
|
|
3815
|
+
* Standard easing functions operating on [0, 1].
|
|
3816
|
+
* Each function takes a normalised time `t` (0 = start, 1 = end) and returns
|
|
3817
|
+
* the eased value.
|
|
3818
|
+
*/
|
|
3819
|
+
declare const easing: {
|
|
3820
|
+
readonly linear: (t: number) => number;
|
|
3821
|
+
readonly easeInQuad: (t: number) => number;
|
|
3822
|
+
readonly easeOutQuad: (t: number) => number;
|
|
3823
|
+
readonly easeInOutQuad: (t: number) => number;
|
|
3824
|
+
readonly easeInCubic: (t: number) => number;
|
|
3825
|
+
readonly easeOutCubic: (t: number) => number;
|
|
3826
|
+
readonly easeInOutCubic: (t: number) => number;
|
|
3827
|
+
readonly easeInQuart: (t: number) => number;
|
|
3828
|
+
readonly easeOutQuart: (t: number) => number;
|
|
3829
|
+
readonly easeInOutQuart: (t: number) => number;
|
|
3830
|
+
readonly easeInSine: (t: number) => number;
|
|
3831
|
+
readonly easeOutSine: (t: number) => number;
|
|
3832
|
+
readonly easeInOutSine: (t: number) => number;
|
|
3833
|
+
readonly easeInExpo: (t: number) => number;
|
|
3834
|
+
readonly easeOutExpo: (t: number) => number;
|
|
3835
|
+
readonly easeInOutExpo: (t: number) => number;
|
|
3836
|
+
readonly easeInCirc: (t: number) => number;
|
|
3837
|
+
readonly easeOutCirc: (t: number) => number;
|
|
3838
|
+
readonly easeInOutCirc: (t: number) => number;
|
|
3839
|
+
readonly easeInBack: (t: number, s?: number) => number;
|
|
3840
|
+
readonly easeOutBack: (t: number, s?: number) => number;
|
|
3841
|
+
readonly easeInElastic: (t: number) => number;
|
|
3842
|
+
readonly easeOutElastic: (t: number) => number;
|
|
3843
|
+
readonly easeOutBounce: (t: number) => number;
|
|
3844
|
+
readonly easeInBounce: (t: number) => number;
|
|
3845
|
+
};
|
|
3846
|
+
type EasingName = keyof typeof easing;
|
|
3847
|
+
/** Linear interpolation between `a` and `b` by factor `t` (clamped to [0,1]). */
|
|
3848
|
+
declare function lerp(a: number, b: number, t: number): number;
|
|
3849
|
+
/** Inverse lerp: returns how far `value` is between `a` and `b` (0–1). */
|
|
3850
|
+
declare function inverseLerp(a: number, b: number, value: number): number;
|
|
3851
|
+
/** Smoothly interpolate between `a` and `b` using Hermite smoothstep. */
|
|
3852
|
+
declare function smoothstep(a: number, b: number, t: number): number;
|
|
3853
|
+
/** Clamp `value` to [min, max]. */
|
|
3854
|
+
declare function clamp(value: number, min: number, max: number): number;
|
|
3855
|
+
interface TweenOptions {
|
|
3856
|
+
from: number;
|
|
3857
|
+
to: number;
|
|
3858
|
+
duration: number;
|
|
3859
|
+
easing?: EasingName;
|
|
3860
|
+
onUpdate?: (value: number) => void;
|
|
3861
|
+
onComplete?: () => void;
|
|
3862
|
+
}
|
|
3863
|
+
/**
|
|
3864
|
+
* A simple imperative tween driven manually with `tick(dt)`.
|
|
3865
|
+
* Does NOT require a Timeline — useful for one-shot or procedural animations.
|
|
3866
|
+
*
|
|
3867
|
+
* @example
|
|
3868
|
+
* ```ts
|
|
3869
|
+
* const tw = new Tween({ from: 0, to: 255, duration: 1, onUpdate: v => setAlpha(v) })
|
|
3870
|
+
* tw.play()
|
|
3871
|
+
* tw.tick(deltaSeconds)
|
|
3872
|
+
* ```
|
|
3873
|
+
*/
|
|
3874
|
+
declare class Tween {
|
|
3875
|
+
private _time;
|
|
3876
|
+
private _playing;
|
|
3877
|
+
private readonly _options;
|
|
3878
|
+
constructor(options: TweenOptions);
|
|
3879
|
+
get value(): number;
|
|
3880
|
+
get progress(): number;
|
|
3881
|
+
get isComplete(): boolean;
|
|
3882
|
+
play(): this;
|
|
3883
|
+
pause(): this;
|
|
3884
|
+
reset(): this;
|
|
3885
|
+
tick(dt: number): void;
|
|
3886
|
+
}
|
|
3887
|
+
interface SpringOptions {
|
|
3888
|
+
/** Natural frequency (stiffness). Higher = faster. Default: 10. */
|
|
3889
|
+
frequency?: number;
|
|
3890
|
+
/** Damping ratio. 1.0 = critically damped. Default: 0.8. */
|
|
3891
|
+
damping?: number;
|
|
3892
|
+
/** Initial position. Default: 0. */
|
|
3893
|
+
initial?: number;
|
|
3894
|
+
/** Target position. */
|
|
3895
|
+
target: number;
|
|
3896
|
+
}
|
|
3897
|
+
/**
|
|
3898
|
+
* Simple critically-damped spring for smooth follow animations.
|
|
3899
|
+
*
|
|
3900
|
+
* @example
|
|
3901
|
+
* ```ts
|
|
3902
|
+
* const spring = new Spring({ target: 100, frequency: 8, damping: 0.75 })
|
|
3903
|
+
* spring.tick(dt)
|
|
3904
|
+
* const x = spring.position
|
|
3905
|
+
* ```
|
|
3906
|
+
*/
|
|
3907
|
+
declare class Spring {
|
|
3908
|
+
private _pos;
|
|
3909
|
+
private _vel;
|
|
3910
|
+
private _target;
|
|
3911
|
+
private readonly _frequency;
|
|
3912
|
+
private readonly _damping;
|
|
3913
|
+
constructor(options: SpringOptions);
|
|
3914
|
+
get position(): number;
|
|
3915
|
+
get velocity(): number;
|
|
3916
|
+
set target(t: number);
|
|
3917
|
+
/** Advance the spring simulation by `dt` seconds. */
|
|
3918
|
+
tick(dt: number): void;
|
|
3919
|
+
/** Instantly snap to the target. */
|
|
3920
|
+
snap(): void;
|
|
3921
|
+
/** Returns true when the spring has essentially settled. */
|
|
3922
|
+
isSettled(tolerance?: number): boolean;
|
|
3923
|
+
}
|
|
3924
|
+
//#endregion
|
|
3925
|
+
//#region src/graphics.d.ts
|
|
3926
|
+
/**
|
|
3927
|
+
* Terminal graphics utilities: pixel buffer, canvas, ANSI color helpers,
|
|
3928
|
+
* and gradient generation.
|
|
3929
|
+
*
|
|
3930
|
+
* @example
|
|
3931
|
+
* ```ts
|
|
3932
|
+
* import { Canvas, parseHex } from "@bettertui/core"
|
|
3933
|
+
*
|
|
3934
|
+
* const canvas = new Canvas(40, 20)
|
|
3935
|
+
* canvas.fill(parseHex("#1a1a2e"))
|
|
3936
|
+
* canvas.drawRect(5, 2, 10, 6, { r: 255, g: 64, b: 0 })
|
|
3937
|
+
* process.stdout.write(canvas.render())
|
|
3938
|
+
* ```
|
|
3939
|
+
*/
|
|
3940
|
+
interface RGB {
|
|
3941
|
+
r: number;
|
|
3942
|
+
g: number;
|
|
3943
|
+
b: number;
|
|
3944
|
+
}
|
|
3945
|
+
interface RGBA$1 extends RGB {
|
|
3946
|
+
a: number;
|
|
3947
|
+
}
|
|
3948
|
+
/** Parse a CSS hex color string (`#rgb`, `#rrggbb`, `#rrggbbaa`) to RGBA. */
|
|
3949
|
+
declare function parseHex(hex: string): RGBA$1;
|
|
3950
|
+
/** Convert RGB to a 24-bit ANSI truecolor foreground escape sequence. */
|
|
3951
|
+
declare function rgbFg(color: RGB): string;
|
|
3952
|
+
/** Convert RGB to a 24-bit ANSI truecolor background escape sequence. */
|
|
3953
|
+
declare function rgbBg(color: RGB): string;
|
|
3954
|
+
/** ANSI reset sequence. */
|
|
3955
|
+
declare const RESET = "[0m";
|
|
3956
|
+
/** A mutable RGBA pixel buffer. Each pixel is 4 bytes: R, G, B, A. */
|
|
3957
|
+
declare class PixelBuffer {
|
|
3958
|
+
readonly width: number;
|
|
3959
|
+
readonly height: number;
|
|
3960
|
+
readonly data: Uint8ClampedArray;
|
|
3961
|
+
constructor(width: number, height: number, fill?: RGBA$1);
|
|
3962
|
+
private _offset;
|
|
3963
|
+
getPixel(x: number, y: number): RGBA$1;
|
|
3964
|
+
setPixel(x: number, y: number, color: RGB | RGBA$1): void;
|
|
3965
|
+
fill(color: RGB | RGBA$1): void;
|
|
3966
|
+
/** Convert this pixel buffer to a Node.js Buffer containing raw RGB bytes. */
|
|
3967
|
+
toRgbBuffer(): Buffer;
|
|
3968
|
+
/** Convert this pixel buffer to a Node.js Buffer containing raw RGBA bytes. */
|
|
3969
|
+
toRgbaBuffer(): Buffer;
|
|
3970
|
+
}
|
|
3971
|
+
/**
|
|
3972
|
+
* A terminal "canvas" that renders RGBA pixels as Unicode half-block
|
|
3973
|
+
* characters (`▀`, `▄`), achieving 1×2 sub-cell pixel resolution.
|
|
3974
|
+
* Each character cell covers one column × 2 rows of pixels.
|
|
3975
|
+
*
|
|
3976
|
+
* @example
|
|
3977
|
+
* ```ts
|
|
3978
|
+
* const canvas = new Canvas(40, 20)
|
|
3979
|
+
* canvas.fill({ r: 0, g: 0, b: 0 })
|
|
3980
|
+
* canvas.setPixel(10, 5, { r: 255, g: 64, b: 0 })
|
|
3981
|
+
* process.stdout.write(canvas.render())
|
|
3982
|
+
* ```
|
|
3983
|
+
*/
|
|
3984
|
+
declare class Canvas {
|
|
3985
|
+
readonly pixelWidth: number;
|
|
3986
|
+
readonly pixelHeight: number;
|
|
3987
|
+
private _buffer;
|
|
3988
|
+
/**
|
|
3989
|
+
* @param pixelWidth Width in pixels (each char column = 1 pixel wide).
|
|
3990
|
+
* @param pixelHeight Height in pixels (each char row = 2 pixels tall).
|
|
3991
|
+
*/
|
|
3992
|
+
constructor(pixelWidth: number, pixelHeight: number);
|
|
3993
|
+
get buffer(): PixelBuffer;
|
|
3994
|
+
setPixel(x: number, y: number, color: RGB | RGBA$1): void;
|
|
3995
|
+
getPixel(x: number, y: number): RGBA$1;
|
|
3996
|
+
fill(color: RGB | RGBA$1): void;
|
|
3997
|
+
/**
|
|
3998
|
+
* Render the canvas to a string using upper-half block `▀` characters.
|
|
3999
|
+
* Each character encodes two pixel rows: foreground = top pixel, background = bottom pixel.
|
|
4000
|
+
*/
|
|
4001
|
+
render(): string;
|
|
4002
|
+
/** Draw a filled rectangle. */
|
|
4003
|
+
drawRect(x: number, y: number, w: number, h: number, color: RGB | RGBA$1): void;
|
|
4004
|
+
/** Draw a 1-pixel-wide rectangle outline. */
|
|
4005
|
+
drawRectOutline(x: number, y: number, w: number, h: number, color: RGB | RGBA$1): void;
|
|
4006
|
+
/** Draw a line using Bresenham's algorithm. */
|
|
4007
|
+
drawLine(x0: number, y0: number, x1: number, y1: number, color: RGB | RGBA$1): void;
|
|
4008
|
+
/** Draw a filled or outline circle using midpoint circle algorithm. */
|
|
4009
|
+
drawCircle(cx: number, cy: number, radius: number, color: RGB | RGBA$1, filled?: boolean): void;
|
|
4010
|
+
/** Build a PixelBuffer image suitable for passing to the Image widget. */
|
|
4011
|
+
toPixelBuffer(): PixelBuffer;
|
|
4012
|
+
}
|
|
4013
|
+
/** Generate a horizontal gradient between two RGB colors across `steps` stops. */
|
|
4014
|
+
declare function gradientH(from: RGB, to: RGB, steps: number): RGB[];
|
|
4015
|
+
//#endregion
|
|
4016
|
+
//#region src/audio.d.ts
|
|
4017
|
+
type AudioGroup = number;
|
|
4018
|
+
type AudioStreamAction = "connect" | "read" | "decode" | "play" | "reconnect" | "stop" | "dispose";
|
|
4019
|
+
interface AudioStreamErrorContext {
|
|
4020
|
+
action: AudioStreamAction;
|
|
4021
|
+
status?: number;
|
|
4022
|
+
errorCode?: number;
|
|
4023
|
+
attempt?: number;
|
|
4024
|
+
}
|
|
4025
|
+
declare class AudioStreamError extends Error {
|
|
4026
|
+
readonly context: AudioStreamErrorContext;
|
|
4027
|
+
constructor(message: string, context: AudioStreamErrorContext, cause?: unknown);
|
|
4028
|
+
}
|
|
4029
|
+
type AudioStreamState = "initializing" | "buffering" | "playing" | "reconnecting" | "ended" | "errored" | "disposed" | "idle";
|
|
4030
|
+
interface AudioStreamStats {
|
|
4031
|
+
state: AudioStreamState;
|
|
4032
|
+
sampleRate: number;
|
|
4033
|
+
channels: number;
|
|
4034
|
+
bufferedFrames: number;
|
|
4035
|
+
capacityFrames: number;
|
|
4036
|
+
bufferedDurationMs: number;
|
|
4037
|
+
bytesReceived: bigint;
|
|
4038
|
+
framesDecoded: bigint;
|
|
4039
|
+
framesPlayed: bigint;
|
|
4040
|
+
underruns: number;
|
|
4041
|
+
reconnectAttempts: number;
|
|
4042
|
+
}
|
|
4043
|
+
type AudioStreamMetadataFormat = "icy" | string;
|
|
4044
|
+
interface AudioStreamMetadata {
|
|
4045
|
+
readonly format: AudioStreamMetadataFormat;
|
|
4046
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
4047
|
+
readonly fields: Readonly<Record<string, string>>;
|
|
4048
|
+
}
|
|
4049
|
+
interface AudioStreamReconnectEvent {
|
|
4050
|
+
attempt: number;
|
|
4051
|
+
delayMs: number;
|
|
4052
|
+
error: AudioStreamError;
|
|
4053
|
+
}
|
|
4054
|
+
interface AudioStreamUrlOptions {
|
|
4055
|
+
format?: "mp3" | "flac" | string;
|
|
4056
|
+
signal?: AbortSignal;
|
|
4057
|
+
volume?: number;
|
|
4058
|
+
pan?: number;
|
|
4059
|
+
groupId?: number;
|
|
4060
|
+
buffer?: {
|
|
4061
|
+
capacityMs?: number;
|
|
4062
|
+
startupMs?: number;
|
|
4063
|
+
resumeMs?: number;
|
|
4064
|
+
};
|
|
4065
|
+
reconnect?: {
|
|
4066
|
+
maxRetries?: number;
|
|
4067
|
+
retryOnEnd?: boolean;
|
|
4068
|
+
initialDelayMs?: number;
|
|
4069
|
+
maxDelayMs?: number;
|
|
4070
|
+
backoffFactor?: number;
|
|
4071
|
+
};
|
|
4072
|
+
}
|
|
4073
|
+
declare class AudioStream<M = AudioStreamMetadata> extends EventEmitter {
|
|
4074
|
+
private _state;
|
|
4075
|
+
get state(): AudioStreamState;
|
|
4076
|
+
getStats(): AudioStreamStats;
|
|
4077
|
+
getMetadata(): M | null;
|
|
4078
|
+
setVolume(_volume: number): boolean;
|
|
4079
|
+
setPan(_pan: number): boolean;
|
|
4080
|
+
setGroup(_groupId: number): boolean;
|
|
4081
|
+
dispose(): void;
|
|
4082
|
+
}
|
|
4083
|
+
interface AudioPlaybackDevice {
|
|
4084
|
+
name: string;
|
|
4085
|
+
id: string;
|
|
4086
|
+
isDefault: boolean;
|
|
4087
|
+
}
|
|
4088
|
+
interface AudioSound {
|
|
4089
|
+
id: string;
|
|
4090
|
+
duration: number;
|
|
4091
|
+
}
|
|
4092
|
+
interface AudioVoice {
|
|
4093
|
+
id: string;
|
|
4094
|
+
sound: AudioSound;
|
|
4095
|
+
}
|
|
4096
|
+
interface AudioSetupOptions {
|
|
4097
|
+
autoStart?: boolean;
|
|
4098
|
+
sampleRate?: number;
|
|
4099
|
+
channels?: number;
|
|
4100
|
+
bufferSize?: number;
|
|
4101
|
+
}
|
|
4102
|
+
interface AudioStartOptions {
|
|
4103
|
+
deviceId?: string;
|
|
4104
|
+
}
|
|
4105
|
+
interface AudioPlayOptions {
|
|
4106
|
+
volume?: number;
|
|
4107
|
+
pan?: number;
|
|
4108
|
+
loop?: boolean;
|
|
4109
|
+
groupId?: number;
|
|
4110
|
+
}
|
|
4111
|
+
interface AudioStats {
|
|
4112
|
+
lastPeak: number;
|
|
4113
|
+
lastRms: number;
|
|
4114
|
+
framesProcessed: bigint;
|
|
4115
|
+
}
|
|
4116
|
+
interface AudioTapResult {
|
|
4117
|
+
framesRead: number;
|
|
4118
|
+
frames: Float32Array;
|
|
4119
|
+
}
|
|
4120
|
+
declare class Audio extends EventEmitter {
|
|
4121
|
+
readonly sampleRate: number;
|
|
4122
|
+
private _started;
|
|
4123
|
+
private _mixerStarted;
|
|
4124
|
+
private _disposed;
|
|
4125
|
+
private constructor();
|
|
4126
|
+
/** Factory — creates a new Audio instance. */
|
|
4127
|
+
static create(options?: AudioSetupOptions): Audio;
|
|
4128
|
+
start(_options?: AudioStartOptions): boolean;
|
|
4129
|
+
startMixer(): boolean;
|
|
4130
|
+
stop(): boolean;
|
|
4131
|
+
isStarted(): boolean;
|
|
4132
|
+
isMixerStarted(): boolean;
|
|
4133
|
+
/**
|
|
4134
|
+
* Create an audio group. Returns the group id (a small integer starting at 1).
|
|
4135
|
+
*/
|
|
4136
|
+
private _groupCounter;
|
|
4137
|
+
group(_name: string): AudioGroup;
|
|
4138
|
+
createGroup(_name: string): AudioGroup;
|
|
4139
|
+
setGroupVolume(_group: AudioGroup, _volume: number): boolean;
|
|
4140
|
+
setMasterVolume(_volume: number): boolean;
|
|
4141
|
+
enableTap(_bufferSize: number): void;
|
|
4142
|
+
disableTap(): void;
|
|
4143
|
+
readTapFrames(_frameCount: number, _channels: number): AudioTapResult | null;
|
|
4144
|
+
mixFrames(_frameCount: number, _channels: number): void;
|
|
4145
|
+
getStats(): AudioStats | null;
|
|
4146
|
+
loadSound(_data: Uint8Array | ArrayBuffer): AudioSound | null;
|
|
4147
|
+
loadSoundFile(_path: string): Promise<AudioSound | null>;
|
|
4148
|
+
unloadSound(_sound: AudioSound): boolean;
|
|
4149
|
+
play(_sound: AudioSound, _options?: AudioPlayOptions): AudioVoice | null;
|
|
4150
|
+
stopVoice(_voice: AudioVoice): boolean;
|
|
4151
|
+
setVoiceGroup(_voice: AudioVoice, _group: AudioGroup): boolean;
|
|
4152
|
+
playStreamUrl(_url: string | URL, _options?: AudioStreamUrlOptions): Promise<AudioStream>;
|
|
4153
|
+
dispose(): void;
|
|
4154
|
+
}
|
|
4155
|
+
//#endregion
|
|
4156
|
+
//#region src/renderables/ScrollBox.d.ts
|
|
4157
|
+
interface ScrollBarOptions extends BoxOptions {
|
|
4158
|
+
orientation?: "vertical" | "horizontal";
|
|
4159
|
+
showArrows?: boolean;
|
|
4160
|
+
thumbColor?: ColorInput;
|
|
4161
|
+
trackColor?: ColorInput;
|
|
4162
|
+
trackOptions?: {
|
|
4163
|
+
foregroundColor?: ColorInput;
|
|
4164
|
+
backgroundColor?: ColorInput;
|
|
4165
|
+
};
|
|
4166
|
+
}
|
|
4167
|
+
declare class ScrollBar extends Box {
|
|
4168
|
+
private _orientation;
|
|
4169
|
+
private _showArrows;
|
|
4170
|
+
private _scrollPosition;
|
|
4171
|
+
private _scrollSize;
|
|
4172
|
+
private _viewSize;
|
|
4173
|
+
private readonly _topSpacer;
|
|
4174
|
+
private readonly _thumb;
|
|
4175
|
+
private readonly _bottomSpacer;
|
|
4176
|
+
constructor(renderer: CliRenderer, options?: ScrollBarOptions);
|
|
4177
|
+
get showArrows(): boolean;
|
|
4178
|
+
set showArrows(v: boolean);
|
|
4179
|
+
get scrollPosition(): number;
|
|
4180
|
+
set scrollPosition(v: number);
|
|
4181
|
+
get scrollSize(): number;
|
|
4182
|
+
set scrollSize(v: number);
|
|
4183
|
+
get viewSize(): number;
|
|
4184
|
+
set viewSize(v: number);
|
|
4185
|
+
/**
|
|
4186
|
+
* Update thumb position and size using proportional flex-grow weights.
|
|
4187
|
+
*
|
|
4188
|
+
* Total flex weight always equals `totalLines`, so the thumb proportion
|
|
4189
|
+
* (viewLines / totalLines) is constant regardless of scroll position.
|
|
4190
|
+
*/
|
|
4191
|
+
updateScrollBar(scrollTop: number, totalLines: number, viewLines: number): void;
|
|
4192
|
+
}
|
|
4193
|
+
interface ScrollBoxOptions extends BoxOptions {
|
|
4194
|
+
rootOptions?: BoxOptions;
|
|
4195
|
+
wrapperOptions?: BoxOptions;
|
|
4196
|
+
viewportOptions?: BoxOptions;
|
|
4197
|
+
contentOptions?: BoxOptions;
|
|
4198
|
+
scrollbarOptions?: ScrollBarOptions;
|
|
4199
|
+
verticalScrollbarOptions?: ScrollBarOptions;
|
|
4200
|
+
horizontalScrollbarOptions?: ScrollBarOptions;
|
|
4201
|
+
stickyScroll?: boolean;
|
|
4202
|
+
stickyStart?: "bottom" | "top" | "left" | "right";
|
|
4203
|
+
scrollX?: boolean;
|
|
4204
|
+
scrollY?: boolean;
|
|
4205
|
+
viewportCulling?: boolean;
|
|
4206
|
+
}
|
|
4207
|
+
declare class ScrollBox extends Box {
|
|
4208
|
+
readonly content: Box;
|
|
4209
|
+
readonly viewport: Box;
|
|
4210
|
+
readonly verticalScrollBar: ScrollBar;
|
|
4211
|
+
readonly horizontalScrollBar: ScrollBar;
|
|
4212
|
+
private _scrollTop;
|
|
4213
|
+
private _scrollLeft;
|
|
4214
|
+
private _stickyScroll;
|
|
4215
|
+
private _contentLines;
|
|
4216
|
+
private _lastScrollTop;
|
|
4217
|
+
private _lastContentLines;
|
|
4218
|
+
private _lastViewLines;
|
|
4219
|
+
private readonly _keyHandler;
|
|
4220
|
+
private readonly _lifecyclePass;
|
|
4221
|
+
constructor(renderer: CliRenderer, options?: ScrollBoxOptions);
|
|
4222
|
+
get scrollTop(): number;
|
|
4223
|
+
set scrollTop(v: number);
|
|
4224
|
+
get scrollLeft(): number;
|
|
4225
|
+
set scrollLeft(v: number);
|
|
4226
|
+
get scrollHeight(): number;
|
|
4227
|
+
get scrollWidth(): number;
|
|
4228
|
+
get stickyScroll(): boolean;
|
|
4229
|
+
set stickyScroll(v: boolean);
|
|
4230
|
+
add(child: Box, index?: number): void;
|
|
4231
|
+
remove(child: Box): void;
|
|
4232
|
+
getRenderable(id: string): Box | undefined;
|
|
4233
|
+
focus(): void;
|
|
4234
|
+
blur(): void;
|
|
4235
|
+
scrollBy(delta: number, axis?: "x" | "y"): void;
|
|
4236
|
+
private _applyScroll;
|
|
4237
|
+
private _estimateViewLines;
|
|
4238
|
+
private _updateScrollbar;
|
|
4239
|
+
private _handleKey;
|
|
4240
|
+
destroy(): void;
|
|
4241
|
+
}
|
|
4242
|
+
//#endregion
|
|
4243
|
+
//#region src/renderables/Textarea.d.ts
|
|
4244
|
+
/** Minimal extmarks controller stub for type compatibility. */
|
|
4245
|
+
interface ExtmarksController {
|
|
4246
|
+
create(opts: {
|
|
4247
|
+
start: number;
|
|
4248
|
+
end: number;
|
|
4249
|
+
virtual?: boolean;
|
|
4250
|
+
styleId?: number;
|
|
4251
|
+
data?: unknown;
|
|
4252
|
+
}): number;
|
|
4253
|
+
getAtOffset(offset: number): Array<{
|
|
4254
|
+
start: number;
|
|
4255
|
+
end: number;
|
|
4256
|
+
styleId?: number;
|
|
4257
|
+
data?: unknown;
|
|
4258
|
+
}>;
|
|
4259
|
+
getVirtual(): Array<{
|
|
4260
|
+
start: number;
|
|
4261
|
+
end: number;
|
|
4262
|
+
styleId?: number;
|
|
4263
|
+
data?: unknown;
|
|
4264
|
+
}>;
|
|
4265
|
+
destroy(): void;
|
|
4266
|
+
}
|
|
4267
|
+
declare class ExtmarksControllerStub implements ExtmarksController {
|
|
4268
|
+
create(_opts: {
|
|
4269
|
+
start: number;
|
|
4270
|
+
end: number;
|
|
4271
|
+
virtual?: boolean;
|
|
4272
|
+
styleId?: number;
|
|
4273
|
+
data?: unknown;
|
|
4274
|
+
}): number;
|
|
4275
|
+
getAtOffset(_offset: number): Array<{
|
|
4276
|
+
start: number;
|
|
4277
|
+
end: number;
|
|
4278
|
+
styleId?: number;
|
|
4279
|
+
data?: unknown;
|
|
4280
|
+
}>;
|
|
4281
|
+
getVirtual(): Array<{
|
|
4282
|
+
start: number;
|
|
4283
|
+
end: number;
|
|
4284
|
+
styleId?: number;
|
|
4285
|
+
data?: unknown;
|
|
4286
|
+
}>;
|
|
4287
|
+
destroy(): void;
|
|
4288
|
+
}
|
|
4289
|
+
interface TextareaOptions extends BoxOptions {
|
|
4290
|
+
initialValue?: string;
|
|
4291
|
+
placeholder?: string;
|
|
4292
|
+
placeholderColor?: ColorInput;
|
|
4293
|
+
textColor?: ColorInput;
|
|
4294
|
+
focusedTextColor?: ColorInput;
|
|
4295
|
+
cursorColor?: ColorInput;
|
|
4296
|
+
backgroundColor?: ColorInput;
|
|
4297
|
+
focusedBackgroundColor?: ColorInput;
|
|
4298
|
+
wrapMode?: "none" | "char" | "word";
|
|
4299
|
+
showCursor?: boolean;
|
|
4300
|
+
readonly?: boolean;
|
|
4301
|
+
selectionBg?: ColorInput;
|
|
4302
|
+
selectionFg?: ColorInput;
|
|
4303
|
+
syntaxStyle?: unknown;
|
|
4304
|
+
}
|
|
4305
|
+
declare class Textarea extends Box {
|
|
4306
|
+
protected _text: string;
|
|
4307
|
+
protected _cursorLine: number;
|
|
4308
|
+
protected _cursorCol: number;
|
|
4309
|
+
private _placeholder;
|
|
4310
|
+
private _placeholderColor;
|
|
4311
|
+
private _textColor;
|
|
4312
|
+
private _focusedTextColor;
|
|
4313
|
+
private _cursorColor;
|
|
4314
|
+
private _focusedBgColor;
|
|
4315
|
+
private _wrapMode;
|
|
4316
|
+
private _showCursor;
|
|
4317
|
+
private _readonly;
|
|
4318
|
+
private _textNodeId;
|
|
4319
|
+
private _scrollOffset;
|
|
4320
|
+
private readonly _keyHandler;
|
|
4321
|
+
/** Extmarks controller stub — override or replace in subclasses for full functionality. */
|
|
4322
|
+
extmarks: ExtmarksControllerStub;
|
|
4323
|
+
/** Logical cursor position (line/col). */
|
|
4324
|
+
get logicalCursor(): {
|
|
4325
|
+
row: number;
|
|
4326
|
+
col: number;
|
|
4327
|
+
};
|
|
4328
|
+
constructor(renderer: CliRenderer, options?: TextareaOptions);
|
|
4329
|
+
get plainText(): string;
|
|
4330
|
+
set plainText(v: string);
|
|
4331
|
+
get cursorOffset(): number;
|
|
4332
|
+
setText(text: string): void;
|
|
4333
|
+
insertText(text: string): void;
|
|
4334
|
+
newLine(): boolean;
|
|
4335
|
+
submit(): boolean;
|
|
4336
|
+
focus(): void;
|
|
4337
|
+
blur(): void;
|
|
4338
|
+
protected _handleKey(key: KeyEvent): void;
|
|
4339
|
+
protected _render(): void;
|
|
4340
|
+
destroy(): void;
|
|
4341
|
+
}
|
|
4342
|
+
//#endregion
|
|
4343
|
+
//#region src/renderables/Slider.d.ts
|
|
4344
|
+
interface SliderOptions extends BoxOptions {
|
|
4345
|
+
orientation?: "horizontal" | "vertical";
|
|
4346
|
+
min?: number;
|
|
4347
|
+
max?: number;
|
|
4348
|
+
value?: number;
|
|
4349
|
+
step?: number;
|
|
4350
|
+
viewPortSize?: number;
|
|
4351
|
+
trackColor?: ColorInput;
|
|
4352
|
+
thumbColor?: ColorInput;
|
|
4353
|
+
activeTrackColor?: ColorInput;
|
|
4354
|
+
onChange?: (value: number) => void;
|
|
4355
|
+
}
|
|
4356
|
+
type SliderRenderableOptions = SliderOptions;
|
|
4357
|
+
declare class Slider extends Box {
|
|
4358
|
+
private _orientation;
|
|
4359
|
+
private _min;
|
|
4360
|
+
private _max;
|
|
4361
|
+
private _value;
|
|
4362
|
+
private _step;
|
|
4363
|
+
private _viewPortSize;
|
|
4364
|
+
private _trackColor;
|
|
4365
|
+
private _thumbColor;
|
|
4366
|
+
private _activeTrackColor;
|
|
4367
|
+
private _onChange;
|
|
4368
|
+
private _contentNodeId;
|
|
4369
|
+
private readonly _keyHandler;
|
|
4370
|
+
constructor(renderer: CliRenderer, options?: SliderOptions);
|
|
4371
|
+
get value(): number;
|
|
4372
|
+
set value(v: number);
|
|
4373
|
+
get min(): number;
|
|
4374
|
+
set min(v: number);
|
|
4375
|
+
get max(): number;
|
|
4376
|
+
set max(v: number);
|
|
4377
|
+
get step(): number;
|
|
4378
|
+
set step(v: number);
|
|
4379
|
+
get orientation(): "horizontal" | "vertical";
|
|
4380
|
+
focus(): void;
|
|
4381
|
+
blur(): void;
|
|
4382
|
+
private _handleKey;
|
|
4383
|
+
private _render;
|
|
4384
|
+
destroy(): void;
|
|
4385
|
+
}
|
|
4386
|
+
//#endregion
|
|
4387
|
+
//#region src/renderables/Canvas.d.ts
|
|
4388
|
+
interface CanvasHeaderOptions {
|
|
4389
|
+
id?: string;
|
|
4390
|
+
height?: number;
|
|
4391
|
+
backgroundColor?: ColorInput;
|
|
4392
|
+
border?: boolean | BorderSide[];
|
|
4393
|
+
borderStyle?: BorderStyleKind;
|
|
4394
|
+
borderColor?: ColorInput;
|
|
4395
|
+
title?: string;
|
|
4396
|
+
titleAlignment?: "left" | "center" | "right";
|
|
4397
|
+
alignItems?: BoxOptions["alignItems"];
|
|
4398
|
+
justifyContent?: BoxOptions["justifyContent"];
|
|
4399
|
+
padding?: number;
|
|
4400
|
+
paddingX?: number;
|
|
4401
|
+
paddingY?: number;
|
|
4402
|
+
paddingLeft?: number;
|
|
4403
|
+
paddingRight?: number;
|
|
4404
|
+
}
|
|
4405
|
+
type CanvasFooterOptions = CanvasHeaderOptions;
|
|
4406
|
+
interface CanvasBodyOptions {
|
|
4407
|
+
id?: string;
|
|
4408
|
+
backgroundColor?: ColorInput;
|
|
4409
|
+
flexDirection?: "row" | "column";
|
|
4410
|
+
alignItems?: BoxOptions["alignItems"];
|
|
4411
|
+
justifyContent?: BoxOptions["justifyContent"];
|
|
4412
|
+
overflow?: BoxOptions["overflow"];
|
|
4413
|
+
gap?: number;
|
|
4414
|
+
padding?: number;
|
|
4415
|
+
paddingX?: number;
|
|
4416
|
+
paddingY?: number;
|
|
4417
|
+
}
|
|
4418
|
+
interface CanvasOptions {
|
|
4419
|
+
id?: string;
|
|
4420
|
+
backgroundColor?: ColorInput;
|
|
4421
|
+
header?: CanvasHeaderOptions;
|
|
4422
|
+
body?: CanvasBodyOptions;
|
|
4423
|
+
footer?: CanvasFooterOptions;
|
|
4424
|
+
}
|
|
4425
|
+
interface ScreenResizeEvent {
|
|
4426
|
+
width: number;
|
|
4427
|
+
height: number;
|
|
4428
|
+
}
|
|
4429
|
+
declare const ScreenEvents: {
|
|
4430
|
+
readonly RESIZE: "resize";
|
|
4431
|
+
};
|
|
4432
|
+
declare class Screen extends EventEmitter {
|
|
4433
|
+
readonly container: Box;
|
|
4434
|
+
readonly header: Box | null;
|
|
4435
|
+
readonly body: Box;
|
|
4436
|
+
readonly footer: Box | null;
|
|
4437
|
+
private readonly _renderer;
|
|
4438
|
+
private readonly _resizeHandler;
|
|
4439
|
+
constructor(renderer: CliRenderer, options?: CanvasOptions);
|
|
4440
|
+
get terminalWidth(): number;
|
|
4441
|
+
get terminalHeight(): number;
|
|
4442
|
+
/** Re-apply body layout atomically. Always sets flexGrow: 1, flexShrink: 1. */
|
|
4443
|
+
setBodyLayout(opts: CanvasBodyOptions): void;
|
|
4444
|
+
/** Re-apply header visual options (background / border color) after a theme change. */
|
|
4445
|
+
applyHeaderOptions(opts: Pick<CanvasHeaderOptions, "backgroundColor" | "borderColor">): void;
|
|
4446
|
+
/** Re-apply footer visual options (background / border color) after a theme change. */
|
|
4447
|
+
applyFooterOptions(opts: Pick<CanvasFooterOptions, "backgroundColor" | "borderColor">): void;
|
|
4448
|
+
onResize(cb: (e: ScreenResizeEvent) => void): this;
|
|
4449
|
+
offResize(cb: (e: ScreenResizeEvent) => void): this;
|
|
4450
|
+
destroy(): void;
|
|
4451
|
+
}
|
|
4452
|
+
//#endregion
|
|
4453
|
+
//#region src/index.d.ts
|
|
4454
|
+
/** Measure the display width and height of text. */
|
|
4455
|
+
declare function measureText(opts: {
|
|
4456
|
+
text: string;
|
|
4457
|
+
font?: string;
|
|
4458
|
+
}): {
|
|
4459
|
+
width: number;
|
|
4460
|
+
height: number;
|
|
4461
|
+
};
|
|
4462
|
+
declare function decodePasteBytes(bytes: Uint8Array): string;
|
|
4463
|
+
declare function resolveRenderLib(): {
|
|
4464
|
+
getArenaAllocatedBytes: () => number;
|
|
4465
|
+
};
|
|
4466
|
+
/** Strip ANSI escape sequences from a string. */
|
|
4467
|
+
declare function stripAnsiSequences(str: string): string;
|
|
4468
|
+
type Selection = {
|
|
4469
|
+
start: {
|
|
4470
|
+
line: number;
|
|
4471
|
+
col: number;
|
|
4472
|
+
};
|
|
4473
|
+
end: {
|
|
4474
|
+
line: number;
|
|
4475
|
+
col: number;
|
|
4476
|
+
};
|
|
4477
|
+
text: string;
|
|
4478
|
+
getSelectedText(): string;
|
|
4479
|
+
isDragging: boolean;
|
|
4480
|
+
};
|
|
4481
|
+
/** HAST (Hypertext Abstract Syntax Tree) element type. */
|
|
4482
|
+
type HASTElement = {
|
|
4483
|
+
type: string;
|
|
4484
|
+
tagName?: string;
|
|
4485
|
+
value?: string;
|
|
4486
|
+
properties?: Record<string, unknown>;
|
|
4487
|
+
children?: HASTElement[];
|
|
4488
|
+
};
|
|
4489
|
+
declare class SyntaxStyle {
|
|
4490
|
+
fg?: string;
|
|
4491
|
+
bg?: string;
|
|
4492
|
+
bold?: boolean;
|
|
4493
|
+
italic?: boolean;
|
|
4494
|
+
private _styles;
|
|
4495
|
+
private _cache;
|
|
4496
|
+
constructor(opts?: {
|
|
4497
|
+
fg?: string;
|
|
4498
|
+
bg?: string;
|
|
4499
|
+
bold?: boolean;
|
|
4500
|
+
italic?: boolean;
|
|
4501
|
+
});
|
|
4502
|
+
/** Create a new SyntaxStyle instance. */
|
|
4503
|
+
static create(): SyntaxStyle;
|
|
4504
|
+
/** Create a SyntaxStyle from a record of style definitions. */
|
|
4505
|
+
static fromStyles(styles: Record<string, {
|
|
4506
|
+
fg?: unknown;
|
|
4507
|
+
bg?: unknown;
|
|
4508
|
+
bold?: boolean;
|
|
4509
|
+
italic?: boolean;
|
|
4510
|
+
}>): SyntaxStyle;
|
|
4511
|
+
/** Register a named style and return its numeric ID. */
|
|
4512
|
+
registerStyle(name: string, style: Record<string, unknown>): number;
|
|
4513
|
+
/** Get the number of cached entries. */
|
|
4514
|
+
getCacheSize(): number;
|
|
4515
|
+
/** Clear the style cache. */
|
|
4516
|
+
clearCache(): void;
|
|
4517
|
+
destroy(): void;
|
|
4518
|
+
}
|
|
4519
|
+
/** Convert a HAST tree to a StyledText string using the given SyntaxStyle. */
|
|
4520
|
+
declare function hastToStyledText(node: HASTElement, _style: SyntaxStyle): string;
|
|
4521
|
+
type RenderContext = {
|
|
4522
|
+
width: number;
|
|
4523
|
+
height: number;
|
|
4524
|
+
requestRender(): void;
|
|
4525
|
+
};
|
|
4526
|
+
type OptimizedBuffer = {
|
|
4527
|
+
width: number;
|
|
4528
|
+
height: number;
|
|
4529
|
+
buffers: {
|
|
4530
|
+
bg: Uint16Array;
|
|
4531
|
+
fg: Uint16Array;
|
|
4532
|
+
char: Uint32Array;
|
|
4533
|
+
attributes: Uint32Array;
|
|
4534
|
+
};
|
|
4535
|
+
setCell(x: number, y: number, char: string, fg?: unknown, bg?: unknown): void;
|
|
4536
|
+
drawText(text: string, x: number, y: number, fg?: unknown, bg?: unknown, attributes?: number): void;
|
|
4537
|
+
fillRect(x: number, y: number, w: number, h: number, color: unknown): void;
|
|
4538
|
+
};
|
|
4539
|
+
//#endregion
|
|
4540
|
+
export { ASCIIFont, type ASCIIFontKind, type ASCIIFontOptions, type ActiveKeyInfo, type AlignItems, type AlignSelf, Audio, type AudioGroup, type AudioPlayOptions, type AudioPlaybackDevice, type AudioSetupOptions, type AudioSound, type AudioStartOptions, type AudioStats, AudioStream, type AudioStreamAction, AudioStreamError, type AudioStreamErrorContext, type AudioStreamMetadata, type AudioStreamMetadataFormat, type AudioStreamReconnectEvent, type AudioStreamState, type AudioStreamStats, type AudioStreamUrlOptions, type AudioTapResult, type AudioVoice, type BindingInfo, type BorderSide, type BorderStyle, type BorderStyleKind, Box, type BoxOptions, type CallerInfo, Canvas, type CanvasBodyOptions, type CanvasFooterOptions, type CanvasHeaderOptions, type CanvasOptions, CapabilityInspector, type CapabilityInspectorOptions, CliRenderEvents, CliRenderer, type CliRendererOptions, type Clock, Code, type CodeOptions, type ColorInput, type ColorValue, type Command, CommandBuffer, type CommandBufferConsumer, type CommandContext, type CommandEntry, type CommandHandler, CommandInspector, type CommandInspectorOptions, type CommandResult, CommandRuntime, type CommandRuntimeOptions, type CommandType, type ConsoleLogEntry, ConsoleLogLevel, CreateDevToolsOptions, DebugConsole, DebugPanel, DevTools, type LogLevel as DevToolsLogLevel, Logger as DevToolsLogger, type DevToolsNode, DevToolsOptions, type TerminalCapabilities as DevToolsTerminalCapabilities, DevToolsTimeline, type DevToolsTimelineOptions, type DiagnosticExport, DiagnosticSnapshot, Diff, type DiffOptions, EasingName, type EnvVarConfig, type EventCategory, EventInspector, type EventInspectorOptions, type ExportData, type ExportOptions, type ExternalOutputMode, type ExtmarksController, ExtmarksControllerStub, type FlexDirection, FocusInspector, type FocusInspectorOptions, type FocusSnapshot, FrameBuffer, type FrameBufferLike, type FrameBufferOptions, type FrameMetrics, type Gap, GenericVNode as Generic, type GraphicsFormat, HASTElement, type HighlightSegment, type HighlightedLine, type HostConfig, type HostContext, type ImperativeContext, Input, InputEvents, type InputOptions, type InputRenderableOptions, type Inset, type Instance, type InterceptContext, type InterceptHandler, InternalKeyHandler, type JustifyContent, type KeyAliasMap, type KeyBinding, type KeyBindingLike, type KeyBindingLookup, KeyCodes, KeyEvent, KeyEvent as KeyboardEvent, type KeyEventSource, type KeyEventType, KeyHandler, type KeyHandlerEventMap, KeyInput, type KeyListener, type KeyModifiers, Keymap, type KeymapEvent, type KeymapOptions, type LayoutConstraints, LayoutEvents, LineNumber, type LineNumberOptions, type LogEntry, LogLevel$1 as LogLevel, Logger$1 as Logger, LoggerConfig, type LoggerOptions, type Margin, Markdown, type MarkdownOptions, MemoryStats, type MockInput, type MockKeysOptions, type MockMouse, type MouseButton, MouseButtons, type MouseEvent, type MouseEventOptions, type MouseEventType, type MouseModifiers, MouseParser, type MousePosition, type NapiDiagnosticSnapshot, type NapiEngine, type NapiEventBus, type NapiFocusManager, NapiHitGrid, type NapiKeymap, type NapiLoggerConfig, NapiPluginHost, type NapiScheduler, NapiSpanFeed, type NapiSpanFeedStats, type NapiTextEngine, type NapiTheme, type NapiThemeBorders, type NapiThemeColors, type NapiThemeSpacing, NapiTimeline, type NapiWidgetHost, type NativeSpanFeedOptions, OptimizedBuffer, type Overflow, type OverlayCorner, OverlayHost, type OverlayHostOptions, type Padding, type Panel, type PanelContext, type ParseKeypressOptions, type ParsedKey, PasteEvent, type PasteMetadata, type PerformanceSnapshot, PerformanceTracker, type PerformanceTrackerOptions, PixelBuffer, type PluginStateName, type Point, type Position, RESET, type RGB, RGBA, type RawKeyEvent, type RawMouseEvent, type RecordedCommand, type RecordedEvent, type Rect, RenderContext, type RenderResult, Renderable, RenderableEvents, Root, RootTextNode, SchedulerInspector, type SchedulerInspectorOptions, type SchedulerSnapshot, Screen, ScreenEvents, type ScreenMode, type ScreenResizeEvent, ScrollBar, type ScrollBarOptions, ScrollBox, type ScrollBoxOptions, type ScrollInfo, Select, SelectEvents, type SelectOption, type SelectOptions, type SelectRenderableOptions, Selection, type Size, type Sizing, Slider, SliderEvents, type SliderOptions, type SliderRenderableOptions, type SlotMode, type SnapshotDiff, SnapshotManager, type SnapshotOptions, Spring, SpringOptions, type Spy, type StdinEvent, StdinParser, type StdinParserOptions, type StdinParserProtocolContext, type StdinResponseProtocol, type StylableInput, type Style, StyledText, SyntaxStyle, SystemClock, type TabOption, TabSelect, TabSelectEvents, type TabSelectOptions, type TabSelectRenderableOptions, type TableColumn, type TerminalCapabilities$1 as TerminalCapabilities, type TerminalCapabilitiesOptions, TerminalConsole, TerminalConsoleCache, type TestBinding, type TestKeyInput, TestReadStream, type TestRenderer, type TestRendererOptions, type TestRendererSetup, type TestStdin, type TestStdout, TestWriteStream, Text, TextAttributes, type TextChunk, type TextInstance, TextNode, type TextNodeOptions, type TextOptions, TextTable, type TextTableColumnFitter, type TextTableColumnWidthMode, type TextTableContent, type TextTableOptions, Textarea, type TextareaOptions, type Theme, type ThemeColors, type ThemeMode, type ThemeSpacing, TimeToFirstDraw, type TimeToFirstDrawOptions, Timeline, type TimelineEntry, type TimelineOptions, type TimerHandle, TreeInspector, type TreeInspectorOptions, type TreeSnapshot, Tween, type TweenConfig, TweenOptions, type VNode, ASCIIFont$1 as VNodeASCIIFont, BoxVNode as VNodeBox, CodeVNode as VNodeCode, InputVNode as VNodeInput, ScrollBox$1 as VNodeScrollBox, SelectVNode as VNodeSelect, TabSelectVNode as VNodeTabSelect, TextVNode as VNodeText, type ValidationError, type ValidationResult, type WidgetContext, type WidgetLifecycle, ansiUtils_d_exports as ansi, appendChild, bg, bgBlack, bgBlue, bgCyan, bgGreen, bgMagenta, bgRed, bgWhite, bgYellow, black, blink, blue, bold, brightBlack, brightBlue, brightCyan, brightGreen, brightMagenta, brightRed, brightWhite, brightYellow, buildKeyBindingsMap, cacheHitRatio, capture, clamp, clearEnvCache, clipboardDecode, clipboardQuerySequence, clipboardSetSequence, commitTextUpdate, commitUpdate, createCliRenderer, createDarkTheme, createDevTools, createEngine, createEventBus, createExport, createFocusManager, createFullTerminalCapabilities, createHitGrid, createITerm2TerminalCapabilities, createInstance, createKeymap, createKittyTerminalCapabilities, createLightTheme, createMinimalTerminalCapabilities, createMockKeys, createMockMouse, createMockNativeKeymap, createTimeline as createNativeTimeline, createPluginHost, createReconciler, createScheduler, createSpanFeed, createSpy, createSummary, createTerminalCapabilities, createTestKeymap, createTestRenderer, createTestRendererSync, createTestStdin, createTestStdout, createTextEngine, createTextInstance, createTimeline$1 as createTimeline, createWidgetHost, cyan, decodePasteBytes, defaultKeyAliases, delegate, destroySingleton, detectCapabilities, dim, easing, env, exportToJson, fg, finalizeInitialChildren, generateEnvColored, generateEnvMarkdown, generateId, getAllEnvVarConfigs, getEnvVarConfig, getKeyBindingAction, getKeyBindingKey, getKeyBindingKeys, getNativePackageName, getSingleton, getVersion, gradientH, graphicsItermWrite, graphicsKittyDelete, graphicsKittyDeleteAll, graphicsKittyWrite, graphicsQuery, graphicsSixelWrite, green, h, hasSingleton, hastToStyledText, highlightCode, insertBefore, instantiate, inverseLerp, isStyledText, isValidColor, italic, keyBindingToString, kittyNamedSingleStrokeKeys, layoutToEngineJson, lerp, link, loggerFlush, loggerGetDiagnostics, loggerGetLevel, loggerInit, loggerSetLevel, loggerSetModuleFilter, magenta, matchesKeyBinding, maybeMakeRenderable, measureText, mergeKeyAliases, mergeKeyBindings, nonAlphanumericKeys, parseColor, parseHex, parseKeypress, parseKittyKeyboard, prepareUpdate, red, registerEnvVar, removeChild, resetAfterCommit, resolveRenderLib, reverse, rgbBg, rgbFg, rgbaToEngineColor, singleton, smoothstep, strikethrough, stringToStyledText, stripAnsiSequences, styledTextToAnsi, t, terminalConsoleCache, terminalNamedSingleStrokeKeys, underline, validate, validateLayoutConstraints, validateStyle, visibleWidth, vstyles, warnIfInvalid, white, yellow };
|
|
4541
|
+
//# sourceMappingURL=index.d.mts.map
|