@simon_he/vue-tui 0.0.3 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,310 @@
1
- import ansiStyles from "ansi-styles";
2
- import * as vue1 from "vue";
3
- import * as vue2 from "vue";
4
- import { App, Component as Component$1, ComputedRef, Ref, VNode } from "vue";
1
+ import * as vue15 from "vue";
2
+ import * as vue16 from "vue";
3
+ import { App, Component as Component$1, ComputedRef, InjectionKey, Ref, VNode } from "vue";
5
4
 
5
+ //#region src/core/render-plane.d.ts
6
+ declare const TERMINAL_RENDER_PLANES: readonly ["default", "transcript", "chrome", "overlay"];
7
+ type TerminalRenderPlane = (typeof TERMINAL_RENDER_PLANES)[number];
8
+ type TerminalRenderPlanes = readonly TerminalRenderPlane[];
9
+
10
+ //#endregion
11
+ //#region src/core/types.d.ts
12
+ type AnsiColorName = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'blackBright' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright';
13
+ type Style = Readonly<{
14
+ fg?: AnsiColorName;
15
+ bg?: AnsiColorName;
16
+ bold?: boolean;
17
+ dim?: boolean;
18
+ italic?: boolean;
19
+ underline?: boolean;
20
+ inverse?: boolean;
21
+ /**
22
+ * Optional terminal hyperlink target (OSC 8).
23
+ * When set, renderers may emit a clickable hyperlink while keeping text width unchanged.
24
+ */
25
+ href?: string;
26
+ }>;
27
+ type Cell = Readonly<{
28
+ ch: string;
29
+ width: 1 | 2;
30
+ continuation?: true;
31
+ style: Style;
32
+ }>;
33
+ type BufferSnapshot = Readonly<{
34
+ cols: number;
35
+ rows: number;
36
+ lines: readonly string[];
37
+ }>;
38
+ type TerminalSize = Readonly<{
39
+ cols: number;
40
+ rows: number;
41
+ }>;
42
+ type TerminalScrollOperation = Readonly<{
43
+ startY: number;
44
+ endY: number;
45
+ delta: number;
46
+ }>;
47
+ type TerminalCommitEvent = Readonly<{
48
+ dirtyRows: readonly number[] | null;
49
+ planes: TerminalRenderPlanes | null;
50
+ sync?: boolean;
51
+ scrollOperations?: readonly TerminalScrollOperation[] | null;
52
+ }>;
53
+ type TerminalResizeEvent = Readonly<{
54
+ cols: number;
55
+ rows: number;
56
+ }>;
57
+ interface TerminalEventMap {
58
+ commit: TerminalCommitEvent;
59
+ resize: TerminalResizeEvent;
60
+ }
61
+ interface Terminal {
62
+ resize: (cols: number, rows: number) => void;
63
+ clear: (x?: number, y?: number, w?: number, h?: number) => void;
64
+ write: (text: string, opts?: {
65
+ x?: number;
66
+ y?: number;
67
+ style?: Style;
68
+ }) => void;
69
+ writeAnsi: (text: string, opts?: {
70
+ x?: number;
71
+ y?: number;
72
+ }) => void;
73
+ put: (x: number, y: number, ch: string, style?: Style) => void;
74
+ fill: (x: number, y: number, w: number, h: number, ch?: string, style?: Style) => void;
75
+ scroll: (lines: number) => void;
76
+ setCursor: (x: number, y: number, visible?: boolean) => void;
77
+ batch: <T>(fn: () => T) => T;
78
+ commit: (meta?: {
79
+ planes?: TerminalRenderPlanes | null;
80
+ sync?: boolean;
81
+ }) => readonly number[] | null;
82
+ on: <K extends keyof TerminalEventMap>(event: K, cb: (payload: TerminalEventMap[K]) => void) => () => void;
83
+ dispose: () => void;
84
+ size: () => TerminalSize;
85
+ snapshot: () => BufferSnapshot;
86
+ getCell: (x: number, y: number) => Cell;
87
+ getRow: (y: number) => readonly Cell[];
88
+ setScrollbackLimit: (limit: number) => void;
89
+ getScrollbackLines: (count?: number) => readonly string[];
90
+ /** Register fingerprint function for SoA pre-computation on the composite buffer. */
91
+ setFingerprintFn: (fn: (ch: string, style: Style) => number) => void;
92
+ /** Get pre-computed fingerprints for a composite buffer row (null if not enabled). */
93
+ getRowFingerprints: (y: number) => Uint32Array | null;
94
+ } //#endregion
95
+ //#region src/core/ansi/colors.d.ts
96
+ type TerminalColorMode = 'ansi8' | 'ansi16' | 'ansi256' | 'truecolor';
97
+ type TerminalColorLevel = 8 | 16 | 256;
98
+ type AnsiRgb = Readonly<{
99
+ r: number;
100
+ g: number;
101
+ b: number;
102
+ }>;
103
+ declare const SGR_RESET = "\u001B[0m";
104
+ declare function truecolorFgOpen(rgb: AnsiRgb): string;
105
+ declare function truecolorBgOpen(rgb: AnsiRgb): string;
106
+ declare function rgbToAnsi256(rgb: AnsiRgb): number;
107
+
108
+ //#endregion
109
+ //#region src/ansi-styles.d.ts
110
+ declare const ansiStyles: Readonly<{
111
+ reset: Readonly<{
112
+ open: string;
113
+ close: string;
114
+ }>;
115
+ bold: Readonly<{
116
+ open: string;
117
+ close: string;
118
+ }>;
119
+ dim: Readonly<{
120
+ open: string;
121
+ close: string;
122
+ }>;
123
+ italic: Readonly<{
124
+ open: string;
125
+ close: string;
126
+ }>;
127
+ underline: Readonly<{
128
+ open: string;
129
+ close: string;
130
+ }>;
131
+ inverse: Readonly<{
132
+ open: string;
133
+ close: string;
134
+ }>;
135
+ black: Readonly<{
136
+ open: string;
137
+ close: string;
138
+ }>;
139
+ red: Readonly<{
140
+ open: string;
141
+ close: string;
142
+ }>;
143
+ green: Readonly<{
144
+ open: string;
145
+ close: string;
146
+ }>;
147
+ yellow: Readonly<{
148
+ open: string;
149
+ close: string;
150
+ }>;
151
+ blue: Readonly<{
152
+ open: string;
153
+ close: string;
154
+ }>;
155
+ magenta: Readonly<{
156
+ open: string;
157
+ close: string;
158
+ }>;
159
+ cyan: Readonly<{
160
+ open: string;
161
+ close: string;
162
+ }>;
163
+ white: Readonly<{
164
+ open: string;
165
+ close: string;
166
+ }>;
167
+ blackBright: Readonly<{
168
+ open: string;
169
+ close: string;
170
+ }>;
171
+ redBright: Readonly<{
172
+ open: string;
173
+ close: string;
174
+ }>;
175
+ greenBright: Readonly<{
176
+ open: string;
177
+ close: string;
178
+ }>;
179
+ yellowBright: Readonly<{
180
+ open: string;
181
+ close: string;
182
+ }>;
183
+ blueBright: Readonly<{
184
+ open: string;
185
+ close: string;
186
+ }>;
187
+ magentaBright: Readonly<{
188
+ open: string;
189
+ close: string;
190
+ }>;
191
+ cyanBright: Readonly<{
192
+ open: string;
193
+ close: string;
194
+ }>;
195
+ whiteBright: Readonly<{
196
+ open: string;
197
+ close: string;
198
+ }>;
199
+ bgBlack: Readonly<{
200
+ open: string;
201
+ close: string;
202
+ }>;
203
+ bgRed: Readonly<{
204
+ open: string;
205
+ close: string;
206
+ }>;
207
+ bgGreen: Readonly<{
208
+ open: string;
209
+ close: string;
210
+ }>;
211
+ bgYellow: Readonly<{
212
+ open: string;
213
+ close: string;
214
+ }>;
215
+ bgBlue: Readonly<{
216
+ open: string;
217
+ close: string;
218
+ }>;
219
+ bgMagenta: Readonly<{
220
+ open: string;
221
+ close: string;
222
+ }>;
223
+ bgCyan: Readonly<{
224
+ open: string;
225
+ close: string;
226
+ }>;
227
+ bgWhite: Readonly<{
228
+ open: string;
229
+ close: string;
230
+ }>;
231
+ bgBlackBright: Readonly<{
232
+ open: string;
233
+ close: string;
234
+ }>;
235
+ bgRedBright: Readonly<{
236
+ open: string;
237
+ close: string;
238
+ }>;
239
+ bgGreenBright: Readonly<{
240
+ open: string;
241
+ close: string;
242
+ }>;
243
+ bgYellowBright: Readonly<{
244
+ open: string;
245
+ close: string;
246
+ }>;
247
+ bgBlueBright: Readonly<{
248
+ open: string;
249
+ close: string;
250
+ }>;
251
+ bgMagentaBright: Readonly<{
252
+ open: string;
253
+ close: string;
254
+ }>;
255
+ bgCyanBright: Readonly<{
256
+ open: string;
257
+ close: string;
258
+ }>;
259
+ bgWhiteBright: Readonly<{
260
+ open: string;
261
+ close: string;
262
+ }>;
263
+ color: Readonly<{
264
+ ansi256: (idx: number) => string;
265
+ ansi16m: (r: number, g: number, b: number) => string;
266
+ }>;
267
+ bgColor: Readonly<{
268
+ ansi256: (idx: number) => string;
269
+ ansi16m: (r: number, g: number, b: number) => string;
270
+ }>;
271
+ }>;
272
+ /**
273
+ * Cached palettes for convenience.
274
+ * Note: ANSI 0..15 are terminal-theme-dependent in many terminals; treat `rgb` as an approximation.
275
+ */
276
+ declare const ANSI8_COLORS: readonly Readonly<{
277
+ level: TerminalColorLevel;
278
+ index: number;
279
+ name?: AnsiColorName;
280
+ rgb: AnsiRgb;
281
+ fgOpen: string;
282
+ bgOpen: string;
283
+ }>[];
284
+ declare const ANSI16_COLORS: readonly Readonly<{
285
+ level: TerminalColorLevel;
286
+ index: number;
287
+ name?: AnsiColorName;
288
+ rgb: AnsiRgb;
289
+ fgOpen: string;
290
+ bgOpen: string;
291
+ }>[];
292
+ declare const ANSI256_COLORS: readonly Readonly<{
293
+ level: TerminalColorLevel;
294
+ index: number;
295
+ name?: AnsiColorName;
296
+ rgb: AnsiRgb;
297
+ fgOpen: string;
298
+ bgOpen: string;
299
+ }>[];
300
+ declare function ansiColors(level: 8 | 16 | 256): readonly Readonly<{
301
+ level: TerminalColorLevel;
302
+ index: number;
303
+ name?: AnsiColorName;
304
+ rgb: AnsiRgb;
305
+ fgOpen: string;
306
+ bgOpen: string;
307
+ }>[]; //#endregion
6
308
  //#region src/events/recording.d.ts
7
309
  type TerminalEventRecord = Readonly<{
8
310
  type: 'keydown' | 'keyup';
@@ -46,20 +348,44 @@ type TerminalEventRecord = Readonly<{
46
348
  isComposing?: boolean;
47
349
  text?: string;
48
350
  time?: number;
49
- }>; //#endregion
351
+ }>;
352
+
353
+ //#endregion
50
354
  //#region src/cli/input.d.ts
51
355
  type Stdin = NodeJS.ReadStream;
52
356
  type StdinDriver = Readonly<{
53
357
  dispose: () => void;
54
358
  }>;
55
359
  declare function createStdinDriver(options: Readonly<{
56
- dispatch: (event: TerminalEventRecord) => void;
360
+ dispatch: (event: TerminalEventRecord) => boolean | void;
57
361
  stdin?: Stdin;
58
362
  stdout?: NodeJS.WriteStream;
59
363
  enableMouse?: boolean;
364
+ /**
365
+ * Enable "any-motion" mouse tracking (xterm DECSET ?1003).
366
+ * This is required for hover interactions in the CLI, but can increase event volume.
367
+ */
368
+ enableMouseMotion?: boolean;
369
+ onTerminalFocusChange?: (focused: boolean) => void;
60
370
  onExit?: () => void;
61
371
  }>): StdinDriver;
62
372
 
373
+ //#endregion
374
+ //#region src/cli/path-suggest-core.d.ts
375
+ type PathPickMode = 'directory' | 'file' | 'any';
376
+ type PathSuggestion = Readonly<{
377
+ kind: 'directory' | 'file';
378
+ display: string;
379
+ completion: string;
380
+ absPath: string;
381
+ }>;
382
+ type SuggestPathsResult = Readonly<{
383
+ baseDirAbs: string;
384
+ dirPrefix: string;
385
+ query: string;
386
+ suggestions: PathSuggestion[];
387
+ }>;
388
+
63
389
  //#endregion
64
390
  //#region src/cli/path-provider.d.ts
65
391
  type FsEntryKind = 'file' | 'directory' | 'other';
@@ -74,11 +400,31 @@ type FsStat = Readonly<{
74
400
  type PathPickerProvider = Readonly<{
75
401
  listDir: (absDir: string) => Promise<FsDirEntry[]>;
76
402
  stat: (absPath: string) => Promise<FsStat>;
403
+ suggest?: (info: Readonly<{
404
+ workspaceAbs: string;
405
+ input: string;
406
+ mode: PathPickMode;
407
+ max: number;
408
+ showHidden?: boolean;
409
+ maxDepth?: number;
410
+ gitignore?: 'blocking' | 'nonBlocking';
411
+ }>) => Promise<SuggestPathsResult>;
412
+ resolvePath?: (workspaceAbs: string, input: string) => string | Promise<string>;
77
413
  }>;
78
414
  declare function createNodePathPickerProvider(): PathPickerProvider;
79
415
 
80
416
  //#endregion
81
417
  //#region src/cli/path-suggest.d.ts
418
+ declare function suggestPaths(options: Readonly<{
419
+ workspaceAbs: string;
420
+ input: string;
421
+ mode: PathPickMode;
422
+ max: number;
423
+ showHidden?: boolean;
424
+ listDir: (absDir: string) => Promise<FsDirEntry[]>;
425
+ maxDepth?: number;
426
+ gitignore?: 'blocking' | 'nonBlocking';
427
+ }>): Promise<SuggestPathsResult>;
82
428
  declare function resolveUserPath(workspaceAbs: string, input: string): string;
83
429
 
84
430
  //#endregion
@@ -88,65 +434,26 @@ declare function writeSnapshot(path: string, lines: readonly string[]): Promise<
88
434
  declare function readEventLog(path: string): Promise<TerminalEventRecord[]>;
89
435
 
90
436
  //#endregion
91
- //#region src/core/types.d.ts
92
- type AnsiColorName = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'blackBright' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright';
93
- type Style = Readonly<{
94
- fg?: AnsiColorName;
95
- bg?: AnsiColorName;
96
- bold?: boolean;
97
- dim?: boolean;
98
- italic?: boolean;
99
- underline?: boolean;
100
- inverse?: boolean;
101
- }>;
102
- type Cell = Readonly<{
103
- ch: string;
104
- width: 1 | 2;
105
- continuation?: true;
106
- style: Style;
107
- }>;
108
- type BufferSnapshot = Readonly<{
109
- cols: number;
110
- rows: number;
111
- lines: readonly string[];
112
- }>;
113
- type TerminalCommitEvent = Readonly<{
114
- dirtyRows: readonly number[];
437
+ //#region src/core/ansi/capability.d.ts
438
+ type TerminalColorCapability = Readonly<{
439
+ mode: TerminalColorMode;
440
+ level: TerminalColorLevel;
115
441
  }>;
116
- type TerminalResizeEvent = Readonly<{
117
- cols: number;
118
- rows: number;
119
- }>;
120
- interface TerminalEventMap {
121
- commit: TerminalCommitEvent;
122
- resize: TerminalResizeEvent;
123
- }
124
- interface Terminal {
125
- resize: (cols: number, rows: number) => void;
126
- clear: (x?: number, y?: number, w?: number, h?: number) => void;
127
- write: (text: string, opts?: {
128
- x?: number;
129
- y?: number;
130
- style?: Style;
131
- }) => void;
132
- writeAnsi: (text: string, opts?: {
133
- x?: number;
134
- y?: number;
135
- }) => void;
136
- put: (x: number, y: number, ch: string, style?: Style) => void;
137
- fill: (x: number, y: number, w: number, h: number, ch?: string, style?: Style) => void;
138
- scroll: (lines: number) => void;
139
- setCursor: (x: number, y: number, visible?: boolean) => void;
140
- batch: <T>(fn: () => T) => T;
141
- commit: () => readonly number[];
142
- on: <K extends keyof TerminalEventMap>(event: K, cb: (payload: TerminalEventMap[K]) => void) => () => void;
143
- dispose: () => void;
144
- snapshot: () => BufferSnapshot;
145
- getCell: (x: number, y: number) => Cell;
146
- getRow: (y: number) => readonly Cell[];
147
- setScrollbackLimit: (limit: number) => void;
148
- getScrollbackLines: (count?: number) => readonly string[];
149
- }
442
+ /**
443
+ * Detect terminal output color capability.
444
+ *
445
+ * - `mode` is the best-effort actual output mode.
446
+ * - `level` is the CLI theme tier (256/16/8). `truecolor` folds into `256`.
447
+ * - Pass `platform` (e.g. `process.platform`) to improve Windows detection.
448
+ *
449
+ * Env overrides (prefer `DIMCODE_` but keep `VUE_TUI_*` for library consumers):
450
+ * - `DIMCODE_COLOR_MODE` / `VUE_TUI_COLOR_MODE`
451
+ */
452
+ declare function detectTerminalColorCapability(opts?: Readonly<{
453
+ env?: Record<string, unknown>;
454
+ isTTY?: boolean;
455
+ platform?: string;
456
+ }>): TerminalColorCapability;
150
457
 
151
458
  //#endregion
152
459
  //#region src/core/ansi/sgr.d.ts
@@ -189,7 +496,7 @@ type Rect = Readonly<{
189
496
  w: number;
190
497
  h: number;
191
498
  }>;
192
- type TerminalEventType = 'click' | 'dblclick' | 'contextmenu' | 'pointerdown' | 'pointerup' | 'pointermove' | 'wheel' | 'keydown' | 'keyup' | 'beforeinput' | 'input' | 'compositionstart' | 'compositionupdate' | 'compositionend' | 'paste' | 'focus' | 'blur';
499
+ type TerminalEventType = 'click' | 'dblclick' | 'contextmenu' | 'pointerdown' | 'pointerup' | 'pointermove' | 'pointerenter' | 'pointerleave' | 'wheel' | 'keydown' | 'keyup' | 'beforeinput' | 'input' | 'compositionstart' | 'compositionupdate' | 'compositionend' | 'paste' | 'focus' | 'blur';
193
500
  interface TerminalBaseEvent {
194
501
  type: TerminalEventType;
195
502
  target: TerminalNode | null;
@@ -246,6 +553,10 @@ type TerminalEventHandlerMap = Partial<{
246
553
  pointerup: (e: TerminalPointerEvent) => void;
247
554
  pointermoveCapture: (e: TerminalPointerEvent) => void;
248
555
  pointermove: (e: TerminalPointerEvent) => void;
556
+ pointerenterCapture: (e: TerminalPointerEvent) => void;
557
+ pointerenter: (e: TerminalPointerEvent) => void;
558
+ pointerleaveCapture: (e: TerminalPointerEvent) => void;
559
+ pointerleave: (e: TerminalPointerEvent) => void;
249
560
  wheelCapture: (e: TerminalPointerEvent) => void;
250
561
  wheel: (e: TerminalPointerEvent) => void;
251
562
  keydownCapture: (e: TerminalKeyboardEvent) => void;
@@ -297,7 +608,7 @@ interface CliEventManager {
297
608
  setMetrics: (next: CellMetrics) => void;
298
609
  focus: (id: string | null) => void;
299
610
  getFocused: () => string | null;
300
- dispatch: (event: TerminalEventRecord) => void;
611
+ dispatch: (event: TerminalEventRecord) => boolean;
301
612
  debugNodes: () => TerminalDebugNode[];
302
613
  dispose: () => void;
303
614
  }
@@ -341,7 +652,8 @@ type TraceRecord = Readonly<{
341
652
  }> | Readonly<{
342
653
  type: 'commit';
343
654
  at: number;
344
- dirtyRows: readonly number[];
655
+ dirtyRows: readonly number[] | null;
656
+ planes: TerminalRenderPlanes | null;
345
657
  focusedId: string | null;
346
658
  }>;
347
659
  type TraceStore = Readonly<{
@@ -369,8 +681,13 @@ type StdoutRenderer = Readonly<{
369
681
  setCursor: (x: number, y: number) => void;
370
682
  /** Show or hide the terminal cursor */
371
683
  showCursor: (visible: boolean) => void;
684
+ /** Update palette/default background without recreating the renderer. */
685
+ updateTheme?: (next: Readonly<{
686
+ defaultBg?: AnsiColorName;
687
+ palette?: Partial<Record<AnsiColorName, string>>;
688
+ }>) => void;
372
689
  }>;
373
- type StdoutColorMode = 'auto' | 'truecolor' | 'ansi16' | 'ansi256';
690
+ type StdoutColorMode = 'auto' | 'truecolor' | 'ansi256' | 'ansi16' | 'ansi8';
374
691
  declare function createStdoutRenderer(terminal: Terminal, options?: Readonly<{
375
692
  output?: CliOutput;
376
693
  clear?: boolean;
@@ -383,6 +700,13 @@ declare function createStdoutRenderer(terminal: Terminal, options?: Readonly<{
383
700
  trackResize?: boolean;
384
701
  /** Color mode for ANSI output (auto detects truecolor via env). */
385
702
  colorMode?: StdoutColorMode;
703
+ /** Optional function to get IME cursor position, included in render output for atomic write */
704
+ getImeAnchor?: () => {
705
+ cellX: number;
706
+ cellY: number;
707
+ } | null;
708
+ /** Use DEC 2026 synchronized output mode (default: false for compatibility) */
709
+ useSyncOutput?: boolean;
386
710
  }>): StdoutRenderer;
387
711
 
388
712
  //#endregion
@@ -402,28 +726,44 @@ type RenderStack = Readonly<{
402
726
  type RenderNode = Readonly<{
403
727
  id: string;
404
728
  stack: RenderStack;
729
+ plane: TerminalRenderPlane;
405
730
  zIndex: number;
406
731
  order: number;
407
732
  rect: RenderRect | null;
733
+ rectY0: number;
734
+ rectY1: number;
408
735
  paint: (dirtyRows?: readonly number[]) => void;
409
736
  }>;
410
737
  type RenderManager = Readonly<{
411
738
  rootStack: RenderStack;
412
739
  createStack: (parent: RenderStack, zIndex: number) => RenderStack;
740
+ invalidatePlane: (plane: TerminalRenderPlane) => void;
741
+ scrollPlane: (plane: TerminalRenderPlane, startY: number, endY: number, delta: number) => void;
413
742
  register: (node: {
414
743
  stack: RenderStack;
744
+ plane?: TerminalRenderPlane;
415
745
  zIndex?: number;
416
746
  rect?: RenderRect | null;
417
747
  paint: (dirtyRows?: readonly number[]) => void;
418
748
  }) => RenderNode;
419
749
  update: (id: string, next: Partial<{
420
750
  stack: RenderStack;
751
+ plane: TerminalRenderPlane;
421
752
  zIndex: number;
422
753
  rect: RenderRect | null;
754
+ dirtyRowsHint: readonly number[];
423
755
  paint: (dirtyRows?: readonly number[]) => void;
424
756
  }>) => void;
425
757
  unregister: (id: string) => void;
426
- render: () => void;
758
+ render: (options?: {
759
+ activePlanes?: TerminalRenderPlanes | null;
760
+ }) => RenderStats | null;
761
+ }>;
762
+ type RenderStats = Readonly<{
763
+ rows: number;
764
+ scannedNodes: number;
765
+ paintedNodes: number;
766
+ candidatePlanes: readonly TerminalRenderPlane[];
427
767
  }>;
428
768
 
429
769
  //#endregion
@@ -433,9 +773,15 @@ interface LayoutContext {
433
773
  originY: number;
434
774
  clipRect: Rect | null;
435
775
  }
776
+ type TerminalSchedulerPriority = 'high' | 'normal' | 'low';
777
+ type TerminalSchedulerInvalidateOptions = Readonly<{
778
+ priority?: TerminalSchedulerPriority;
779
+ plane?: TerminalRenderPlane;
780
+ }>;
436
781
  type TerminalScheduler = Readonly<{
437
- invalidate: () => void;
782
+ invalidate: (options?: TerminalSchedulerInvalidateOptions) => void;
438
783
  flush: () => void;
784
+ flushNow: () => void;
439
785
  }>;
440
786
  type TerminalRuntimeHandle = Readonly<{
441
787
  update: (props: Record<string, unknown>) => void;
@@ -443,11 +789,14 @@ type TerminalRuntimeHandle = Readonly<{
443
789
  unmount: () => void;
444
790
  }>;
445
791
  type TerminalRuntime = Readonly<{
446
- mount: (component: Component$1, props: Record<string, unknown>) => TerminalRuntimeHandle;
792
+ mount: (component: Component$1, props: Record<string, unknown>, options?: Readonly<{
793
+ plane?: TerminalRenderPlane;
794
+ }>) => TerminalRuntimeHandle;
447
795
  }>;
448
796
  type ImeAnchor = Readonly<{
449
797
  cellX: number;
450
798
  cellY: number;
799
+ ownerId?: string;
451
800
  }>;
452
801
  type TerminalContext = Readonly<{
453
802
  terminal: Terminal;
@@ -461,6 +810,106 @@ type TerminalContext = Readonly<{
461
810
  defaultStyle: Ref<Style>;
462
811
  render: RenderManager;
463
812
  }>;
813
+ declare const TInputPluginsContextKey: InjectionKey<Readonly<Ref<readonly TInputPlugin[]>>>;
814
+
815
+ //#endregion
816
+ //#region src/vue/components/input/host.d.ts
817
+ type ResolveTInputPathInfo = Readonly<{
818
+ workspace: string;
819
+ input: string;
820
+ preserveBackslash?: boolean;
821
+ homeDir?: string;
822
+ }>;
823
+ type TInputHostAdapter = Readonly<{
824
+ isTerminalLike?: boolean;
825
+ resolvePath?: (info: ResolveTInputPathInfo) => string;
826
+ pathToHref?: (pathLike: string) => string | undefined;
827
+ readClipboardText?: () => Promise<string>;
828
+ writeClipboardText?: (text: string) => Promise<boolean>;
829
+ showToast?: (message: string) => void;
830
+ }>;
831
+
832
+ //#endregion
833
+ //#region src/vue/components/input/plugins/types.d.ts
834
+ type PromptSuggestion = Readonly<{
835
+ value: string;
836
+ insert?: string;
837
+ label?: string;
838
+ detail?: string;
839
+ keywords?: readonly string[];
840
+ mentionValue?: string;
841
+ mentionBehavior?: 'collect' | 'inline';
842
+ onSelect?: (info: Readonly<{
843
+ value: string;
844
+ query: string;
845
+ }>) => void | boolean;
846
+ }>;
847
+ type TInputPluginContext = Readonly<{
848
+ getProps: () => Readonly<{
849
+ zIndex: number;
850
+ style?: Style;
851
+ promptSuggestions: readonly PromptSuggestion[];
852
+ promptTrigger: string;
853
+ promptTriggers?: readonly string[];
854
+ promptMaxItems: number;
855
+ promptAlign: 'input' | 'center';
856
+ promptSelectedStyle?: Style;
857
+ mentionTrigger: string;
858
+ mentionWorkspace: string;
859
+ mentionMode: PathPickMode;
860
+ mentionShowHidden: boolean;
861
+ mentionSuggestions: readonly PromptSuggestion[];
862
+ mentionMaxItems: number;
863
+ collectMentions: boolean;
864
+ mentions: readonly string[];
865
+ skillTrigger?: string;
866
+ skillSuggestions?: readonly PromptSuggestion[];
867
+ }>;
868
+ emit: (event: string, ...args: any[]) => void;
869
+ terminal: Terminal;
870
+ scheduler: TerminalScheduler;
871
+ defaultStyle: Ref<Style>;
872
+ render: Readonly<{
873
+ rootStack: any;
874
+ createStack: (parent: any, z: number) => any;
875
+ invalidatePlane: (plane: TerminalRenderPlane) => void;
876
+ }>;
877
+ visible: Ref<boolean>;
878
+ rawAbsRect: ComputedRef<Rect>;
879
+ eventZ: ComputedRef<number>;
880
+ focused: Ref<boolean>;
881
+ cursor: Ref<number>;
882
+ getValue: () => string;
883
+ insertText: (text: string) => void;
884
+ pushUndoSnapshot: (nextValue: string) => void;
885
+ applyEdit: (nextValue: string, nextCursor: number) => void;
886
+ registerKeydownInterceptor: (fn: (e: TerminalKeyboardEvent) => boolean) => void;
887
+ registerTextFilter: (fn: (info: Readonly<{
888
+ text: string;
889
+ value: string;
890
+ cursor: number;
891
+ selection: null | Readonly<{
892
+ start: number;
893
+ end: number;
894
+ }>;
895
+ }>) => string) => void;
896
+ registerChipStyleProvider: (provider: Readonly<{
897
+ getStyle: (baseStyle: Style, chip: Readonly<{
898
+ kind: 'multiline' | 'mention';
899
+ absPath?: string;
900
+ }>) => Style | null | undefined;
901
+ version: Ref<number>;
902
+ }> | null) => void;
903
+ registerHostAdapter: (adapter: TInputHostAdapter | null) => void;
904
+ resolvePath: (input: string, opts?: Readonly<{
905
+ preserveBackslash?: boolean;
906
+ }>) => string;
907
+ mentionToken: string;
908
+ }>;
909
+ type TInputPlugin = Readonly<{
910
+ name: string;
911
+ install: (ctx: TInputPluginContext) => void;
912
+ }>;
464
913
 
465
914
  //#endregion
466
915
  //#region src/create-terminal-app.d.ts
@@ -469,9 +918,11 @@ type TerminalApp = Readonly<{
469
918
  terminal: Terminal;
470
919
  events: CliEventManager;
471
920
  scheduler: {
472
- invalidate: () => void;
921
+ invalidate: (options?: TerminalSchedulerInvalidateOptions) => void;
473
922
  flush: () => void;
923
+ flushNow: () => void;
474
924
  };
925
+ defaultStyle: Ref<Style>;
475
926
  /** Returns the current IME anchor position (cursor position in cell coordinates), or null if no input is focused */
476
927
  getImeAnchor: () => ImeAnchor | null;
477
928
  mount: () => void;
@@ -483,9 +934,25 @@ type CreateTerminalAppOptions = Readonly<{
483
934
  component: Component$1;
484
935
  props?: Record<string, unknown>;
485
936
  defaultStyle?: Style;
937
+ inputPlugins?: readonly TInputPlugin[];
938
+ pathPickerProvider?: PathPickerProvider;
486
939
  }>;
487
940
  declare function createTerminalApp(options: CreateTerminalAppOptions): TerminalApp;
488
941
 
942
+ //#endregion
943
+ //#region src/renderer/cli/stdout-metrics.d.ts
944
+ type StdoutRendererWriteMode = 'stream' | 'sync' | 'chunked';
945
+ interface StdoutRendererMetrics {
946
+ lastFrameAt: number;
947
+ lastFrameBytes: number;
948
+ lastWriteMs: number;
949
+ writeEmaMs: number;
950
+ writeMode: StdoutRendererWriteMode;
951
+ fps: number;
952
+ bytesPerSec: number;
953
+ }
954
+ declare function getStdoutRendererMetrics(): StdoutRendererMetrics;
955
+
489
956
  //#endregion
490
957
  //#region src/runtime/index.d.ts
491
958
  type RuntimeEnv = 'browser' | 'terminal' | 'unknown';
@@ -526,6 +993,90 @@ declare function createRuntime(kind?: RuntimeEnv): Runtime;
526
993
  //#region src/utils/newlines.d.ts
527
994
  declare function normalizeNewlines(text: string): string;
528
995
 
996
+ //#endregion
997
+ //#region src/vue/components/input/plugins/hostPlugin.d.ts
998
+ declare function createTInputHostPlugin(adapterOrFactory: TInputHostAdapter | (() => TInputHostAdapter)): TInputPlugin;
999
+ declare function createDefaultTInputHostAdapter(): TInputHostAdapter;
1000
+ declare const defaultTInputHostPlugin: Readonly<{
1001
+ name: string;
1002
+ install: (ctx: TInputPluginContext) => void;
1003
+ }>;
1004
+
1005
+ //#endregion
1006
+ //#region src/vue/components/input/plugins/promptMentionState.d.ts
1007
+ type PromptSuggestion$1 = Readonly<{
1008
+ value: string;
1009
+ insert?: string;
1010
+ label?: string;
1011
+ detail?: string;
1012
+ keywords?: readonly string[];
1013
+ mentionValue?: string;
1014
+ mentionBehavior?: 'collect' | 'inline';
1015
+ onSelect?: (info: Readonly<{
1016
+ value: string;
1017
+ query: string;
1018
+ }>) => void | boolean;
1019
+ }>;
1020
+ type MentionSuggestionProvider = (info: Readonly<{
1021
+ query: string;
1022
+ tokenText: string;
1023
+ trigger: string;
1024
+ workspace: string;
1025
+ maxItems: number;
1026
+ }>) => readonly PromptSuggestion$1[] | Promise<readonly PromptSuggestion$1[]>;
1027
+ type MentionPathProvider = Readonly<{
1028
+ stat?: (absPath: string) => FsEntryKind | null | undefined | Promise<FsEntryKind | null | undefined>;
1029
+ suggest?: (info: Readonly<{
1030
+ workspaceAbs: string;
1031
+ input: string;
1032
+ mode: PathPickMode;
1033
+ max: number;
1034
+ showHidden: boolean;
1035
+ maxDepth: number;
1036
+ }>) => readonly PathSuggestion[] | Promise<readonly PathSuggestion[]>;
1037
+ }>;
1038
+
1039
+ //#endregion
1040
+ //#region src/vue/components/input/plugins/nodeMentionPathProvider.d.ts
1041
+ declare function createNodeMentionPathProvider(): MentionPathProvider;
1042
+
1043
+ //#endregion
1044
+ //#region src/vue/components/input/plugins/promptMentionPlugin.d.ts
1045
+ type PromptMentionPluginOptions = Readonly<{
1046
+ mentionSuggestionProviders?: readonly MentionSuggestionProvider[];
1047
+ mentionPathProvider?: MentionPathProvider;
1048
+ }>;
1049
+ declare function createPromptMentionPlugin(options?: PromptMentionPluginOptions): TInputPlugin;
1050
+
1051
+ //#endregion
1052
+ //#region src/vue/components/input/plugins/restrictText.d.ts
1053
+ type TextRestrictionRule = Readonly<{
1054
+ allowChars: RegExp;
1055
+ } | {
1056
+ denyChars: RegExp;
1057
+ } | {
1058
+ replace: Readonly<{
1059
+ from: RegExp;
1060
+ to: string;
1061
+ }>;
1062
+ } | {
1063
+ allow: RegExp;
1064
+ } | {
1065
+ filter: (info: Readonly<{
1066
+ text: string;
1067
+ value: string;
1068
+ cursor: number;
1069
+ selection: null | Readonly<{
1070
+ start: number;
1071
+ end: number;
1072
+ }>;
1073
+ }>) => string;
1074
+ }>;
1075
+ declare function createTextRestrictionPlugin(options: Readonly<{
1076
+ name?: string;
1077
+ rules: readonly TextRestrictionRule[];
1078
+ }>): TInputPlugin;
1079
+
529
1080
  //#endregion
530
1081
  //#region src/vue/components/TAnchor.d.ts
531
1082
  declare const TAnchor: any;
@@ -558,14 +1109,37 @@ declare const TInput: any;
558
1109
  //#region src/vue/components/TInputBox.d.ts
559
1110
  declare const TInputBox: any;
560
1111
 
1112
+ //#endregion
1113
+ //#region src/vue/components/TJsonEditor.d.ts
1114
+ type JsonLintStatus = Readonly<{
1115
+ state: 'idle' | 'success' | 'error';
1116
+ message?: string;
1117
+ line?: number;
1118
+ column?: number;
1119
+ }>;
1120
+ declare function lintJsonText(input: string): JsonLintStatus;
1121
+ declare const TJsonEditor: any;
1122
+
561
1123
  //#endregion
562
1124
  //#region src/vue/components/TList.d.ts
563
1125
  declare const TList: any;
564
1126
 
1127
+ //#endregion
1128
+ //#region src/vue/components/TMultilineModal.d.ts
1129
+ declare const TMultilineModal: any;
1130
+
565
1131
  //#endregion
566
1132
  //#region src/vue/components/TPathPicker.d.ts
567
1133
  declare const TPathPicker: any;
568
1134
 
1135
+ //#endregion
1136
+ //#region src/vue/components/TRenderLayer.d.ts
1137
+ declare const TRenderLayer: any;
1138
+
1139
+ //#endregion
1140
+ //#region src/vue/components/TRenderPlane.d.ts
1141
+ declare const TRenderPlane: any;
1142
+
569
1143
  //#endregion
570
1144
  //#region src/vue/components/TSelect.d.ts
571
1145
  declare const TSelect: any;
@@ -586,10 +1160,27 @@ declare const TView: any;
586
1160
  //#region src/vue/composables/use-layout.d.ts
587
1161
  declare function useLayout(): LayoutContext;
588
1162
 
1163
+ //#endregion
1164
+ //#region src/vue/composables/use-render-node.d.ts
1165
+ interface RenderNodeOptions {
1166
+ zIndex?: number;
1167
+ stack?: RenderStack;
1168
+ rect?: RenderRect | null;
1169
+ dirtyRowsHint?: readonly number[];
1170
+ priority?: TerminalSchedulerPriority;
1171
+ deps?: unknown;
1172
+ paint: (dirtyRows?: readonly number[]) => void;
1173
+ }
1174
+ declare function useRenderNode(getOptions: () => RenderNodeOptions): {
1175
+ id: Ref<string | null>;
1176
+ };
1177
+
589
1178
  //#endregion
590
1179
  //#region src/vue/composables/use-runtime.d.ts
591
1180
  declare function useTerminalRuntime(): Readonly<{
592
- mount: (component: Component, props: Record<string, unknown>) => TerminalRuntimeHandle;
1181
+ mount: (component: Component, props: Record<string, unknown>, options?: Readonly<{
1182
+ plane?: TerminalRenderPlane;
1183
+ }>) => TerminalRuntimeHandle;
593
1184
  }>;
594
1185
 
595
1186
  //#endregion
@@ -645,14 +1236,14 @@ type TerminalRouteLocationRaw = string | Readonly<{
645
1236
  type NavigationGuardReturn = void | boolean | TerminalRouteLocationRaw;
646
1237
  type NavigationGuard = (to: TerminalRoute, from: TerminalRoute | null) => NavigationGuardReturn | Promise<NavigationGuardReturn>;
647
1238
  type TerminalRouter = Readonly<{
648
- currentRoute: vue1.Ref<TerminalRoute>;
1239
+ currentRoute: vue15.Ref<TerminalRoute>;
649
1240
  push: (to: TerminalRouteLocationRaw) => Promise<void>;
650
1241
  replace: (to: TerminalRouteLocationRaw) => Promise<void>;
651
1242
  back: () => Promise<void>;
652
1243
  beforeEach: (guard: NavigationGuard) => () => void;
653
1244
  beforeResolve: (guard: NavigationGuard) => () => void;
654
1245
  afterEach: (guard: (to: TerminalRoute, from: TerminalRoute | null) => void) => () => void;
655
- install: (app: vue2.App) => void;
1246
+ install: (app: vue16.App) => void;
656
1247
  }>;
657
1248
 
658
1249
  //#endregion
@@ -676,9 +1267,30 @@ declare const TRouterView: any;
676
1267
  declare function sanitizeInlineText(text: string): string;
677
1268
  declare function sanitizeTextBlock(text: string): string;
678
1269
  declare function textCellWidth(text: string): number;
1270
+ declare function spaces(count: number): string;
679
1271
  declare function sliceByCells(text: string, maxCells: number): string;
1272
+ declare function sliceByCellsRange(text: string, startCells: number, endCells: number): string;
680
1273
  declare function padEndByCells(text: string, width: number): string;
681
- declare function wrapByCells(text: string, width: number): string[];
1274
+ declare function formatInlineCellLine(text: string, width: number): string;
1275
+ declare function clearTextCaches(): void;
1276
+ declare function wrapByCells(text: string, width: number): readonly string[];
1277
+
1278
+ //#endregion
1279
+ //#region src/vue/utils/wheel-scroll.d.ts
1280
+ interface WheelScrollState {
1281
+ accumulator: number;
1282
+ lastAt: number;
1283
+ lastEdgeDir: number;
1284
+ lastEdgeAt: number;
1285
+ }
1286
+ interface WheelScrollResult {
1287
+ nextTop: number;
1288
+ dir: -1 | 0 | 1;
1289
+ lines: number;
1290
+ }
1291
+ type WheelDeltaMode = 'auto' | 'line' | 'pixel';
1292
+ declare function createWheelScrollState(): WheelScrollState;
1293
+ declare function applyWheelScroll(state: WheelScrollState, deltaY: number, scrollTop: number, maxTop: number, now?: number, deltaMode?: WheelDeltaMode): WheelScrollResult;
682
1294
 
683
1295
  //#endregion
684
- export { AnsiColorName, BufferSnapshot, Cell, CellMetrics, CliEventManager, ClipboardApi, CreateTerminalAppOptions, DomRenderer, EventManager, FsDirEntry, FsEntryKind, FsStat, LayoutContext, PathPickerProvider, RafApi, Rect, Runtime, RuntimeEnv, StdinDriver, StdoutRenderer, Style, TAnchor, TBox, TDebugOverlay, TDialog, TFlow, TInput, TInputBox, TList, TPathPicker, TRouterView, TSelect, TText, TTransition, TView, Terminal, TerminalApp, TerminalBaseEvent, TerminalCommitEvent, TerminalContext, TerminalDebugNode, TerminalEventHandlerMap, TerminalEventMap, TerminalEventRecord, TerminalEventType, TerminalInputEvent, TerminalKeyboardEvent, TerminalNode, TerminalPointerEvent, TerminalProvider, TerminalResizeEvent, TerminalRoute, TerminalRouteLocationRaw, TerminalRouteRecord, TerminalRouter, TerminalRuntime, TerminalRuntimeHandle, TerminalScheduler, TimerApi, TraceRecord, TraceStore, ansiStyles, charCellWidth, createCliEventManager, createDomRenderer, createEventManager, createNodePathPickerProvider, createRuntime, createStdinDriver, createStdoutRenderer, createTerminal, createTerminalApp, createTerminalRouter, createTraceStore, normalizeNewlines, padEndByCells, parseAnsiSgr, readEventLog, resolveUserPath, sanitizeInlineText, sanitizeTextBlock, sliceByCells, textCellWidth, useLayout, useRoute, useRouter, useTerminal, useTerminalNode, useTerminalRuntime, useVisibility, wrapByCells, writeEventLog, writeSnapshot };
1296
+ export { ANSI16_COLORS, ANSI256_COLORS, ANSI8_COLORS, AnsiColorName, BufferSnapshot, Cell, CellMetrics, CliEventManager, ClipboardApi, CreateTerminalAppOptions, DomRenderer, EventManager, FsDirEntry, FsEntryKind, FsStat, LayoutContext, MentionPathProvider, MentionSuggestionProvider, PathPickMode, PathPickerProvider, PathSuggestion, PromptMentionPluginOptions, PromptSuggestion, RafApi, Rect, Runtime, RuntimeEnv, SGR_RESET, StdinDriver, StdoutRenderer, StdoutRendererMetrics, Style, SuggestPathsResult, TAnchor, TBox, TDebugOverlay, TDialog, TERMINAL_RENDER_PLANES, TFlow, TInput, TInputBox, TInputHostAdapter, TInputPlugin, TInputPluginContext, TInputPluginsContextKey, TJsonEditor, TList, TMultilineModal, TPathPicker, TRenderLayer, TRenderPlane, TRouterView, TSelect, TText, TTransition, TView, Terminal, TerminalApp, TerminalBaseEvent, TerminalColorCapability, TerminalColorLevel, TerminalColorMode, TerminalCommitEvent, TerminalContext, TerminalDebugNode, TerminalEventHandlerMap, TerminalEventMap, TerminalEventRecord, TerminalEventType, TerminalInputEvent, TerminalKeyboardEvent, TerminalNode, TerminalPointerEvent, TerminalProvider, TerminalRenderPlane, TerminalRenderPlanes, TerminalResizeEvent, TerminalRoute, TerminalRouteLocationRaw, TerminalRouteRecord, TerminalRouter, TerminalRuntime, TerminalRuntimeHandle, TerminalScheduler, TerminalSchedulerInvalidateOptions, TerminalScrollOperation, TimerApi, TraceRecord, TraceStore, ansiColors, ansiStyles, applyWheelScroll, charCellWidth, clearTextCaches, createCliEventManager, createDefaultTInputHostAdapter, createDomRenderer, createEventManager, createNodeMentionPathProvider, createNodePathPickerProvider, createPromptMentionPlugin, createRuntime, createStdinDriver, createStdoutRenderer, createTInputHostPlugin, createTerminal, createTerminalApp, createTerminalRouter, createTextRestrictionPlugin, createTraceStore, createWheelScrollState, defaultTInputHostPlugin, detectTerminalColorCapability, formatInlineCellLine, getStdoutRendererMetrics, lintJsonText, normalizeNewlines, padEndByCells, parseAnsiSgr, readEventLog, resolveUserPath, rgbToAnsi256, sanitizeInlineText, sanitizeTextBlock, sliceByCells, sliceByCellsRange, spaces, suggestPaths, textCellWidth, truecolorBgOpen, truecolorFgOpen, useLayout, useRenderNode, useRoute, useRouter, useTerminal, useTerminalNode, useTerminalRuntime, useVisibility, wrapByCells, writeEventLog, writeSnapshot };