@alchemy.run/sigil 0.0.0-alpha.1 → 0.0.0-alpha.2

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.
Files changed (121) hide show
  1. package/README.md +299 -299
  2. package/dist/ansi.d.ts +223 -0
  3. package/dist/ansi.js +2 -0
  4. package/dist/{devtools-QpCMm9JH.mjs → devtools-BhYGjb7h.js} +1 -1
  5. package/dist/index-DDVME65c.d.ts +919 -0
  6. package/dist/index.d.ts +1657 -0
  7. package/dist/index.js +4643 -0
  8. package/dist/sgr-CMfEpjSk.d.ts +91 -0
  9. package/dist/truncate-CBiyyZzw.js +2156 -0
  10. package/dist/yoga-5jKhYCJC.js +3465 -0
  11. package/dist/yoga.d.ts +2 -0
  12. package/dist/yoga.js +2 -0
  13. package/package.json +37 -17
  14. package/src/ansi/chalk.ts +179 -0
  15. package/src/ansi/cursor.ts +48 -0
  16. package/src/ansi/east-asian-width.ts +215 -0
  17. package/src/ansi/escapes.ts +128 -0
  18. package/src/ansi/index.ts +27 -0
  19. package/src/ansi/sgr.ts +237 -0
  20. package/src/ansi/slice.ts +43 -0
  21. package/src/ansi/string-width.ts +236 -0
  22. package/src/ansi/strip.ts +33 -0
  23. package/src/ansi/supports-color.ts +213 -0
  24. package/src/ansi/tokenize.ts +453 -0
  25. package/src/ansi/truncate.ts +194 -0
  26. package/src/ansi/widest-line.ts +12 -0
  27. package/src/ansi/wrap.ts +766 -0
  28. package/src/ansi-tokenizer.ts +510 -0
  29. package/src/auto-bind.ts +41 -0
  30. package/src/boxes.ts +100 -0
  31. package/src/code-excerpt.ts +39 -0
  32. package/src/colorize.ts +60 -0
  33. package/src/components/AccessibilityContext.ts +5 -0
  34. package/src/components/AnimationContext.ts +24 -0
  35. package/src/components/App.tsx +781 -0
  36. package/src/components/AppContext.ts +111 -0
  37. package/src/components/BackgroundContext.ts +8 -0
  38. package/src/components/Box.tsx +116 -0
  39. package/src/components/CursorContext.ts +19 -0
  40. package/src/components/ErrorBoundary.tsx +38 -0
  41. package/src/components/ErrorOverview.tsx +133 -0
  42. package/src/components/FocusContext.ts +30 -0
  43. package/src/components/Newline.tsx +15 -0
  44. package/src/components/Spacer.tsx +10 -0
  45. package/src/components/Static.tsx +59 -0
  46. package/src/components/StderrContext.ts +26 -0
  47. package/src/components/StdinContext.ts +49 -0
  48. package/src/components/StdoutContext.ts +28 -0
  49. package/src/components/Text.tsx +144 -0
  50. package/src/components/Transform.tsx +37 -0
  51. package/src/cursor-position.ts +103 -0
  52. package/src/devtools-window-polyfill.ts +73 -0
  53. package/src/devtools.ts +43 -0
  54. package/src/dom.ts +292 -0
  55. package/src/get-max-width.ts +11 -0
  56. package/src/global.d.ts +36 -0
  57. package/src/hooks/use-animation.ts +142 -0
  58. package/src/hooks/use-app.ts +8 -0
  59. package/src/hooks/use-box-metrics.ts +134 -0
  60. package/src/hooks/use-cursor.ts +33 -0
  61. package/src/hooks/use-focus-manager.ts +62 -0
  62. package/src/hooks/use-focus.ts +83 -0
  63. package/src/hooks/use-input.ts +267 -0
  64. package/src/hooks/use-is-screen-reader-enabled.ts +12 -0
  65. package/src/hooks/use-paste.ts +78 -0
  66. package/src/hooks/use-stderr.ts +8 -0
  67. package/src/hooks/use-stdin.ts +10 -0
  68. package/src/hooks/use-stdout.ts +8 -0
  69. package/src/hooks/use-window-size.ts +41 -0
  70. package/src/indent-string.ts +16 -0
  71. package/src/index.ts +44 -0
  72. package/src/ink.tsx +1506 -0
  73. package/src/input-parser.ts +283 -0
  74. package/src/instances.ts +9 -0
  75. package/src/is-in-ci.ts +7 -0
  76. package/src/kitty-keyboard.ts +57 -0
  77. package/src/log-update.ts +370 -0
  78. package/src/measure-element.ts +62 -0
  79. package/src/measure-text.ts +31 -0
  80. package/src/output.ts +308 -0
  81. package/src/parse-keypress.ts +516 -0
  82. package/src/parse-stack-line.ts +139 -0
  83. package/src/patch-console.ts +62 -0
  84. package/src/quick-lru.ts +85 -0
  85. package/src/reconciler.ts +451 -0
  86. package/src/render-background.ts +38 -0
  87. package/src/render-border.ts +134 -0
  88. package/src/render-node-to-output.ts +191 -0
  89. package/src/render-to-string.ts +131 -0
  90. package/src/render.ts +276 -0
  91. package/src/renderer.ts +73 -0
  92. package/src/sanitize-ansi.ts +33 -0
  93. package/src/signal-exit.ts +107 -0
  94. package/src/squash-text-nodes.ts +40 -0
  95. package/src/stream.ts +30 -0
  96. package/src/styles.ts +748 -0
  97. package/src/terminal-size.ts +57 -0
  98. package/src/throttle.ts +73 -0
  99. package/src/types.ts +15 -0
  100. package/src/utils.ts +40 -0
  101. package/src/wrap-text.ts +50 -0
  102. package/src/write-synchronized.ts +9 -0
  103. package/src/yoga/config.ts +57 -0
  104. package/src/yoga/core/absoluteLayout.ts +626 -0
  105. package/src/yoga/core/baseline.ts +66 -0
  106. package/src/yoga/core/cache.ts +136 -0
  107. package/src/yoga/core/calculateLayout.ts +2920 -0
  108. package/src/yoga/core/config.ts +104 -0
  109. package/src/yoga/core/flexLine.ts +177 -0
  110. package/src/yoga/core/helpers.ts +293 -0
  111. package/src/yoga/core/layoutResults.ts +167 -0
  112. package/src/yoga/core/node.ts +611 -0
  113. package/src/yoga/core/numeric.ts +44 -0
  114. package/src/yoga/core/pixelGrid.ts +151 -0
  115. package/src/yoga/core/style.ts +887 -0
  116. package/src/yoga/core/types.ts +224 -0
  117. package/src/yoga/generated/YGEnums.ts +263 -0
  118. package/src/yoga/index.ts +19 -0
  119. package/src/yoga/node.ts +1140 -0
  120. package/dist/index.d.mts +0 -2379
  121. package/dist/index.mjs +0 -10072
@@ -0,0 +1,1657 @@
1
+ import { n as ForegroundColorName } from "./sgr-CMfEpjSk.js";
2
+ import { i as Node } from "./index-DDVME65c.js";
3
+ import { Writable } from "node:stream";
4
+ import { ReactNode, RefObject } from "react";
5
+ import { EventEmitter } from "node:events";
6
+ //#region src/components/AppContext.d.ts
7
+ /**
8
+ A handle returned by `suspendTerminal()` when called without a callback.
9
+
10
+ Call `resume()` to give terminal ownership back to Ink, or use `await using`
11
+ so the suspension is resumed automatically when it leaves scope.
12
+ */
13
+ type TerminalSuspension = {
14
+ readonly resume: () => Promise<void>;
15
+ readonly [Symbol.asyncDispose]: () => Promise<void>;
16
+ };
17
+ /**
18
+ Temporarily hand the terminal over to a child process (e.g. `$EDITOR`, `less`,
19
+ `fzf`), then restore Ink's terminal state and force a full redraw.
20
+ */
21
+ type SuspendTerminal = {
22
+ (callback: () => void | Promise<void>): Promise<void>;
23
+ (): Promise<TerminalSuspension>;
24
+ };
25
+ type Props = {
26
+ /**
27
+ Exit (unmount) the whole Ink app.
28
+
29
+ - `exit()` — resolves `waitUntilExit()` with `undefined`.
30
+ - `exit(new Error('…'))` — rejects `waitUntilExit()` with the error.
31
+ - `exit(value)` — resolves `waitUntilExit()` with `value`.
32
+ */
33
+ readonly exit: (errorOrResult?: unknown) => void;
34
+ /**
35
+ Returns a promise that settles after pending render output is flushed to stdout.
36
+
37
+ @example
38
+ ```jsx
39
+ import {useEffect} from 'react';
40
+ import {useApp} from 'ink';
41
+
42
+ const Example = () => {
43
+ const {waitUntilRenderFlush} = useApp();
44
+
45
+ useEffect(() => {
46
+ void (async () => {
47
+ await waitUntilRenderFlush();
48
+ runNextCommand();
49
+ })();
50
+ }, [waitUntilRenderFlush]);
51
+
52
+ return …;
53
+ };
54
+ ```
55
+ */
56
+ readonly waitUntilRenderFlush: () => Promise<void>;
57
+ /**
58
+ Temporarily release the terminal so a child process can take it over, then
59
+ restore Ink's terminal state and force a full redraw.
60
+
61
+ Use the callback form for the common case — Ink restores the terminal even
62
+ if the callback throws:
63
+
64
+ @example
65
+ ```jsx
66
+ import {useApp} from 'ink';
67
+
68
+ const {suspendTerminal} = useApp();
69
+
70
+ await suspendTerminal(async () => {
71
+ await runEditor();
72
+ });
73
+ ```
74
+
75
+ Or hold a suspension and resume it yourself:
76
+
77
+ @example
78
+ ```jsx
79
+ await using suspension = await suspendTerminal();
80
+ await runEditor();
81
+ ```
82
+ */
83
+ readonly suspendTerminal: SuspendTerminal;
84
+ };
85
+ //#endregion
86
+ //#region src/kitty-keyboard.d.ts
87
+ declare const kittyFlags: {
88
+ readonly disambiguateEscapeCodes: 1;
89
+ readonly reportEventTypes: 2;
90
+ readonly reportAlternateKeys: 4;
91
+ readonly reportAllKeysAsEscapeCodes: 8;
92
+ readonly reportAssociatedText: 16;
93
+ };
94
+ type KittyFlagName = keyof typeof kittyFlags;
95
+ declare const kittyModifiers: {
96
+ readonly shift: 1;
97
+ readonly alt: 2;
98
+ readonly ctrl: 4;
99
+ readonly super: 8;
100
+ readonly hyper: 16;
101
+ readonly meta: 32;
102
+ readonly capsLock: 64;
103
+ readonly numLock: 128;
104
+ };
105
+ type KittyKeyboardOptions = {
106
+ mode?: "auto" | "enabled" | "disabled";
107
+ flags?: KittyFlagName[];
108
+ };
109
+ //#endregion
110
+ //#region src/cursor-position.d.ts
111
+ type CursorPosition = {
112
+ x: number;
113
+ y: number;
114
+ };
115
+ //#endregion
116
+ //#region src/stream.d.ts
117
+ type OutputStream = NodeJS.WritableStream & {
118
+ isTTY?: boolean;
119
+ columns?: number;
120
+ rows?: number;
121
+ destroyed?: boolean;
122
+ writableEnded?: boolean;
123
+ };
124
+ //#endregion
125
+ //#region src/ink.d.ts
126
+ /**
127
+ The origin of a chunk captured by `patchConsole`: a patched `console.*`
128
+ method, or a direct `stdout.write` / `stderr.write` call.
129
+ */
130
+ type CapturedOutputSource = "console" | "stdio";
131
+ /**
132
+ Performance metrics for a render operation.
133
+ */
134
+ type RenderMetrics = {
135
+ /**
136
+ Time spent rendering in milliseconds.
137
+ */
138
+ renderTime: number;
139
+ };
140
+ type Options$3 = {
141
+ stdout: OutputStream;
142
+ stdin: NodeJS.ReadableStream;
143
+ stderr: OutputStream;
144
+ debug: boolean;
145
+ exitOnCtrlC: boolean;
146
+ /**
147
+ Patch console methods so `console.*` output doesn't mix with Ink's output.
148
+
149
+ Pass `"stdio"` to additionally intercept direct `stdout.write` /
150
+ `stderr.write` calls (from dependencies, native warnings, child tooling)
151
+ on the streams Ink renders to. Captured output is line-buffered and
152
+ spliced above the live frame, exactly like console output; Ink's own
153
+ frame writes bypass the capture.
154
+ */
155
+ patchConsole: boolean | "stdio";
156
+ /**
157
+ Observe output captured by `patchConsole` before Ink displays it.
158
+
159
+ Called with each captured chunk and its origin: `"console"` for patched
160
+ `console.*` calls, `"stdio"` for direct stream writes (only emitted with
161
+ `patchConsole: "stdio"`). Return `true` to take ownership of the chunk —
162
+ Ink will not display it, letting the app render it itself (for example
163
+ inside a `<Static>` transcript).
164
+ */
165
+ onCapturedOutput?: (stream: "stdout" | "stderr", data: string, source: CapturedOutputSource) => boolean | undefined | void;
166
+ onRender?: (metrics: RenderMetrics) => void;
167
+ isScreenReaderEnabled?: boolean;
168
+ waitUntilExit?: () => Promise<unknown>;
169
+ maxFps?: number;
170
+ incrementalRendering?: boolean;
171
+ /**
172
+ Enable React Concurrent Rendering mode.
173
+
174
+ When enabled:
175
+ - Suspense boundaries work correctly with async data
176
+ - `useTransition` and `useDeferredValue` are fully functional
177
+ - Updates can be interrupted for higher priority work
178
+
179
+ Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
180
+
181
+ @default false
182
+ @experimental
183
+ */
184
+ concurrent?: boolean;
185
+ kittyKeyboard?: KittyKeyboardOptions;
186
+ /**
187
+ Override automatic interactive mode detection.
188
+
189
+ By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
190
+
191
+ When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
192
+
193
+ Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
194
+
195
+ Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
196
+
197
+ @default true (false if in CI or `stdout.isTTY` is falsy)
198
+
199
+ @see {@link RenderOptions.interactive}
200
+ */
201
+ interactive?: boolean;
202
+ /**
203
+ Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
204
+
205
+ Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
206
+
207
+ Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
208
+
209
+ Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
210
+
211
+ Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
212
+
213
+ @default false
214
+
215
+ @see {@link RenderOptions.alternateScreen}
216
+ */
217
+ alternateScreen?: boolean;
218
+ };
219
+ declare class Ink {
220
+ /**
221
+ Whether this instance is using concurrent rendering mode.
222
+ */
223
+ readonly isConcurrent: boolean;
224
+ private readonly options;
225
+ private readonly log;
226
+ private cursorPosition;
227
+ private readonly throttledLog;
228
+ private readonly isScreenReaderEnabled;
229
+ private readonly interactive;
230
+ private readonly renderThrottleMs;
231
+ private alternateScreen;
232
+ private isUnmounted;
233
+ private isUnmounting;
234
+ private lastOutput;
235
+ private lastOutputToRender;
236
+ private lastOutputHeight;
237
+ private lastTerminalWidth;
238
+ private lastTerminalHeight;
239
+ private readonly container;
240
+ private readonly rootNode;
241
+ private fullStaticOutput;
242
+ private readonly exitPromise;
243
+ private exitResult;
244
+ private beforeExitHandler?;
245
+ private restoreConsole?;
246
+ private readonly captureTargets?;
247
+ private readonly capturedStdioTails;
248
+ private readonly unsubscribeResize?;
249
+ private readonly throttledOnRender?;
250
+ private hasPendingThrottledRender;
251
+ private kittyProtocolEnabled;
252
+ private kittyFlags;
253
+ private cancelKittyDetection?;
254
+ private nextRenderCommit?;
255
+ private isSuspended;
256
+ private pauseInput?;
257
+ private resumeInput?;
258
+ constructor(options: Options$3);
259
+ resized: () => void;
260
+ resolveExitPromise: (result?: unknown) => void;
261
+ rejectExitPromise: (reason?: Error) => void;
262
+ unsubscribeExit: () => void;
263
+ handleAppExit: (errorOrResult?: unknown) => void;
264
+ setCursorPosition: (position: CursorPosition | undefined) => void;
265
+ restoreLastOutput: () => void;
266
+ calculateLayout: () => void;
267
+ handleStaticChange: () => void;
268
+ onRender: () => void;
269
+ render(node: ReactNode): void;
270
+ writeToStdout(data: string): void;
271
+ writeToStderr(data: string): void;
272
+ unmount(error?: Error | number | null): void;
273
+ waitUntilExit(): Promise<unknown>;
274
+ waitUntilRenderFlush(): Promise<void>;
275
+ clear(): void;
276
+ patchConsole(): void;
277
+ private patchDirectStdio;
278
+ private handleCapturedStdio;
279
+ private flushCapturedStdio;
280
+ registerInputControl(pauseInput: () => void, resumeInput: () => void): void;
281
+ suspendTerminal(callback: () => void | Promise<void>): Promise<void>;
282
+ suspendTerminal(): Promise<TerminalSuspension>;
283
+ private setAlternateScreen;
284
+ private resolveInteractiveOption;
285
+ private resolveAlternateScreenOption;
286
+ private shouldSync;
287
+ private writeBestEffort;
288
+ private awaitExit;
289
+ private hasPendingConcurrentWork;
290
+ private awaitNextRender;
291
+ private renderInteractiveFrame;
292
+ private initKittyKeyboard;
293
+ private confirmKittySupport;
294
+ private enableKittyProtocol;
295
+ private beginSuspend;
296
+ private endSuspend;
297
+ }
298
+ //#endregion
299
+ //#region src/render.d.ts
300
+ type RenderOptions = {
301
+ /**
302
+ Output stream where the app will be rendered.
303
+
304
+ @default process.stdout
305
+ */
306
+ stdout?: NodeJS.WritableStream;
307
+ /**
308
+ Input stream where app will listen for input.
309
+
310
+ @default process.stdin
311
+ */
312
+ stdin?: NodeJS.ReadableStream;
313
+ /**
314
+ Error stream.
315
+ @default process.stderr
316
+ */
317
+ stderr?: NodeJS.WritableStream;
318
+ /**
319
+ If true, each update will be rendered as separate output, without replacing the previous one.
320
+
321
+ @default false
322
+ */
323
+ debug?: boolean;
324
+ /**
325
+ Configure whether Ink should listen for Ctrl+C keyboard input and exit the app. This is needed in case `process.stdin` is in raw mode, because then Ctrl+C is ignored by default and the process is expected to handle it manually.
326
+
327
+ @default true
328
+ */
329
+ exitOnCtrlC?: boolean;
330
+ /**
331
+ Patch console methods to ensure console output doesn't mix with Ink's output.
332
+
333
+ Pass `"stdio"` to additionally intercept direct `stdout.write` / `stderr.write` calls on the streams Ink renders to (output from dependencies, native warnings, child tooling). Captured chunks are line-buffered and spliced above the live frame like console output; partial lines are flushed at unmount. Use `onCapturedOutput` to observe captured chunks or take over their display.
334
+
335
+ Note: Once unmount starts, Ink restores the native console (and stream writes) before React cleanup runs. Teardown-time output then follows the normal behavior instead of being rerouted through Ink.
336
+
337
+ @default true
338
+ */
339
+ patchConsole?: boolean | "stdio";
340
+ /**
341
+ Observe output captured by `patchConsole` before Ink displays it.
342
+
343
+ Receives each captured chunk with its origin (`"console"` or `"stdio"`). Return `true` to take ownership of the chunk: Ink will not display it, so the app can render it itself — for example inside a `<Static>` transcript.
344
+ */
345
+ onCapturedOutput?: (stream: "stdout" | "stderr", data: string, source: "console" | "stdio") => boolean | undefined | void;
346
+ /**
347
+ Runs the given callback after each render and re-render with render metrics.
348
+
349
+ Note: this callback runs after Ink commits a frame, but it does not wait for `stdout`/`stderr` stream callbacks.
350
+ To run code after output is flushed, use `waitUntilRenderFlush()`.
351
+ */
352
+ onRender?: (metrics: RenderMetrics) => void;
353
+ /**
354
+ Enable screen reader support. See https://github.com/vadimdemedes/ink/blob/master/readme.md#screen-reader-support
355
+
356
+ @default process.env['SIGIL_SCREEN_READER'] === 'true'
357
+ */
358
+ isScreenReaderEnabled?: boolean;
359
+ /**
360
+ Maximum frames per second for render updates.
361
+ This controls how frequently the UI can update to prevent excessive re-rendering.
362
+ Higher values allow more frequent updates but may impact performance.
363
+
364
+ @default 30
365
+ */
366
+ maxFps?: number;
367
+ /**
368
+ Enable incremental rendering mode which only updates changed lines instead of redrawing the entire output.
369
+ This can reduce flickering and improve performance for frequently updating UIs.
370
+
371
+ @default false
372
+ */
373
+ incrementalRendering?: boolean;
374
+ /**
375
+ Enable React Concurrent Rendering mode.
376
+
377
+ When enabled:
378
+ - Suspense boundaries work correctly with async data
379
+ - `useTransition` and `useDeferredValue` are fully functional
380
+ - Updates can be interrupted for higher priority work
381
+
382
+ Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
383
+
384
+ @default false
385
+ */
386
+ concurrent?: boolean;
387
+ /**
388
+ Configure kitty keyboard protocol support for enhanced keyboard input.
389
+ Enables additional modifiers (super, hyper, capsLock, numLock) and
390
+ disambiguated key events in terminals that support the protocol.
391
+
392
+ @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
393
+ */
394
+ kittyKeyboard?: KittyKeyboardOptions;
395
+ /**
396
+ Override automatic interactive mode detection.
397
+
398
+ By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
399
+
400
+ When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
401
+
402
+ Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
403
+
404
+ Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
405
+
406
+ @default true (false if in CI or `stdout.isTTY` is falsy)
407
+ */
408
+ interactive?: boolean;
409
+ /**
410
+ Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
411
+
412
+ Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
413
+
414
+ Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
415
+
416
+ Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
417
+
418
+ Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
419
+
420
+ @default false
421
+ */
422
+ alternateScreen?: boolean;
423
+ };
424
+ type Instance = {
425
+ /**
426
+ Replace the previous root node with a new one or update props of the current root node.
427
+ */
428
+ rerender: Ink["render"];
429
+ /**
430
+ Manually unmount the whole Ink app.
431
+ */
432
+ unmount: Ink["unmount"];
433
+ /**
434
+ Returns a promise that settles when the app is unmounted.
435
+
436
+ It resolves with the value passed to `exit(value)` and rejects with the error passed to `exit(error)`.
437
+ When `unmount()` is called manually, it settles after unmount-related stdout writes complete.
438
+
439
+ @example
440
+ ```jsx
441
+ const {unmount, waitUntilExit} = render(<MyApp />);
442
+
443
+ setTimeout(unmount, 1000);
444
+
445
+ await waitUntilExit(); // resolves after `unmount()` is called
446
+ ```
447
+ */
448
+ waitUntilExit: Ink["waitUntilExit"];
449
+ /**
450
+ Returns a promise that settles after pending render output is flushed to stdout.
451
+
452
+ This can be used after `rerender()` when you need to run code only after the frame is written.
453
+
454
+ @example
455
+ ```jsx
456
+ const {rerender, waitUntilRenderFlush} = render(<MyApp step="loading" />);
457
+
458
+ rerender(<MyApp step="ready" />);
459
+ await waitUntilRenderFlush(); // output for "ready" is flushed
460
+
461
+ runNextCommand();
462
+ ```
463
+ */
464
+ waitUntilRenderFlush: Ink["waitUntilRenderFlush"];
465
+ /**
466
+ Unmount the current app and remove the internal Ink instance for this stdout.
467
+
468
+ This is mostly useful for advanced cases where you need `render()` to create a fresh instance for the same stream without leaving terminal state such as the alternate screen behind.
469
+ */
470
+ cleanup: () => void;
471
+ /**
472
+ Clear output.
473
+ */
474
+ clear: () => void;
475
+ };
476
+ /**
477
+ Mount a component and render the output.
478
+ */
479
+ declare const render: (node: ReactNode, options?: Writable | RenderOptions) => Instance;
480
+ //#endregion
481
+ //#region src/render-to-string.d.ts
482
+ type RenderToStringOptions = {
483
+ /**
484
+ Width of the virtual terminal in columns.
485
+
486
+ @default 80
487
+ */
488
+ columns?: number;
489
+ };
490
+ /**
491
+ Render a React element to a string synchronously. Unlike `render()`, this function does not write to stdout, does not set up any terminal event listeners, and returns the rendered output as a string.
492
+
493
+ Useful for generating documentation, writing output to files, testing, or any scenario where you need the rendered output as a string without starting a persistent terminal application.
494
+
495
+ **Notes:**
496
+
497
+ - Terminal-specific hooks (`useInput`, `useStdin`, `useStdout`, `useStderr`, `useApp`, `useFocus`, `useFocusManager`) return default no-op values since there is no terminal session. They will not throw, but they will not function as in a live terminal.
498
+ - `useEffect` callbacks will execute during rendering (due to synchronous rendering mode), but state updates they trigger will not affect the returned output, which reflects the initial render.
499
+ - `useLayoutEffect` callbacks fire synchronously during commit, so state updates they trigger **will** be reflected in the output.
500
+ - The `<Static>` component is supported — its output is prepended to the dynamic output.
501
+ - If a component throws during rendering, the error is propagated to the caller after cleanup.
502
+
503
+ @example
504
+ ```
505
+ import {renderToString, Text, Box} from 'ink';
506
+
507
+ const output = renderToString(
508
+ <Box padding={1}>
509
+ <Text color="green">Hello World</Text>
510
+ </Box>,
511
+ {columns: 40}
512
+ );
513
+
514
+ console.log(output);
515
+ ```
516
+ */
517
+ declare const renderToString: (node: ReactNode, options?: RenderToStringOptions) => string;
518
+ //#endregion
519
+ //#region src/render-node-to-output.d.ts
520
+ type OutputTransformer = (s: string, index: number) => string;
521
+ //#endregion
522
+ //#region src/boxes.d.ts
523
+ /**
524
+ Style of the box border.
525
+ */
526
+ type BoxStyle = {
527
+ readonly topLeft: string;
528
+ readonly top: string;
529
+ readonly topRight: string;
530
+ readonly right: string;
531
+ readonly bottomRight: string;
532
+ readonly bottom: string;
533
+ readonly bottomLeft: string;
534
+ readonly left: string;
535
+ };
536
+ declare const boxes: {
537
+ readonly single: {
538
+ readonly topLeft: "┌";
539
+ readonly top: "─";
540
+ readonly topRight: "┐";
541
+ readonly right: "│";
542
+ readonly bottomRight: "┘";
543
+ readonly bottom: "─";
544
+ readonly bottomLeft: "└";
545
+ readonly left: "│";
546
+ };
547
+ readonly double: {
548
+ readonly topLeft: "╔";
549
+ readonly top: "═";
550
+ readonly topRight: "╗";
551
+ readonly right: "║";
552
+ readonly bottomRight: "╝";
553
+ readonly bottom: "═";
554
+ readonly bottomLeft: "╚";
555
+ readonly left: "║";
556
+ };
557
+ readonly round: {
558
+ readonly topLeft: "╭";
559
+ readonly top: "─";
560
+ readonly topRight: "╮";
561
+ readonly right: "│";
562
+ readonly bottomRight: "╯";
563
+ readonly bottom: "─";
564
+ readonly bottomLeft: "╰";
565
+ readonly left: "│";
566
+ };
567
+ readonly bold: {
568
+ readonly topLeft: "┏";
569
+ readonly top: "━";
570
+ readonly topRight: "┓";
571
+ readonly right: "┃";
572
+ readonly bottomRight: "┛";
573
+ readonly bottom: "━";
574
+ readonly bottomLeft: "┗";
575
+ readonly left: "┃";
576
+ };
577
+ readonly singleDouble: {
578
+ readonly topLeft: "╓";
579
+ readonly top: "─";
580
+ readonly topRight: "╖";
581
+ readonly right: "║";
582
+ readonly bottomRight: "╜";
583
+ readonly bottom: "─";
584
+ readonly bottomLeft: "╙";
585
+ readonly left: "║";
586
+ };
587
+ readonly doubleSingle: {
588
+ readonly topLeft: "╒";
589
+ readonly top: "═";
590
+ readonly topRight: "╕";
591
+ readonly right: "│";
592
+ readonly bottomRight: "╛";
593
+ readonly bottom: "═";
594
+ readonly bottomLeft: "╘";
595
+ readonly left: "│";
596
+ };
597
+ readonly classic: {
598
+ readonly topLeft: "+";
599
+ readonly top: "-";
600
+ readonly topRight: "+";
601
+ readonly right: "|";
602
+ readonly bottomRight: "+";
603
+ readonly bottom: "-";
604
+ readonly bottomLeft: "+";
605
+ readonly left: "|";
606
+ };
607
+ readonly arrow: {
608
+ readonly topLeft: "↘";
609
+ readonly top: "↓";
610
+ readonly topRight: "↙";
611
+ readonly right: "←";
612
+ readonly bottomRight: "↖";
613
+ readonly bottom: "↑";
614
+ readonly bottomLeft: "↗";
615
+ readonly left: "→";
616
+ };
617
+ };
618
+ type Boxes = typeof boxes;
619
+ //#endregion
620
+ //#region src/types.d.ts
621
+ /**
622
+ Allows creating a union type by combining primitive types and literal types
623
+ without sacrificing auto-completion in IDEs for the literal type part of the
624
+ union.
625
+ */
626
+ type LiteralUnion<LiteralType, BaseType extends string | number> = LiteralType | (BaseType & Record<never, never>);
627
+ /**
628
+ Create a type from an object type without certain keys.
629
+ */
630
+ type Except<ObjectType, KeysType extends keyof ObjectType> = Omit<ObjectType, KeysType>;
631
+ //#endregion
632
+ //#region src/styles.d.ts
633
+ type Styles = {
634
+ readonly textWrap?: "wrap" | "hard" | "truncate-end" | "truncate" | "truncate-middle" | "truncate-start";
635
+ /**
636
+ Controls how the element is positioned.
637
+
638
+ When `position` is `static`, `top`, `right`, `bottom`, and `left` are ignored.
639
+ */
640
+ readonly position?: "absolute" | "relative" | "static";
641
+ /**
642
+ Top offset for positioned elements.
643
+ */
644
+ readonly top?: number | string;
645
+ /**
646
+ Right offset for positioned elements.
647
+ */
648
+ readonly right?: number | string;
649
+ /**
650
+ Bottom offset for positioned elements.
651
+ */
652
+ readonly bottom?: number | string;
653
+ /**
654
+ Left offset for positioned elements.
655
+ */
656
+ readonly left?: number | string;
657
+ /**
658
+ Size of the gap between an element's columns.
659
+ */
660
+ readonly columnGap?: number;
661
+ /**
662
+ Size of the gap between an element's rows.
663
+ */
664
+ readonly rowGap?: number;
665
+ /**
666
+ Size of the gap between an element's columns and rows. A shorthand for `columnGap` and `rowGap`.
667
+ */
668
+ readonly gap?: number;
669
+ /**
670
+ Margin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft`, and `marginRight`.
671
+ */
672
+ readonly margin?: number;
673
+ /**
674
+ Horizontal margin. Equivalent to setting `marginLeft` and `marginRight`.
675
+ */
676
+ readonly marginX?: number;
677
+ /**
678
+ Vertical margin. Equivalent to setting `marginTop` and `marginBottom`.
679
+ */
680
+ readonly marginY?: number;
681
+ /**
682
+ Top margin.
683
+ */
684
+ readonly marginTop?: number;
685
+ /**
686
+ Bottom margin.
687
+ */
688
+ readonly marginBottom?: number;
689
+ /**
690
+ Left margin.
691
+ */
692
+ readonly marginLeft?: number;
693
+ /**
694
+ Right margin.
695
+ */
696
+ readonly marginRight?: number;
697
+ /**
698
+ Padding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft`, and `paddingRight`.
699
+ */
700
+ readonly padding?: number;
701
+ /**
702
+ Horizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.
703
+ */
704
+ readonly paddingX?: number;
705
+ /**
706
+ Vertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.
707
+ */
708
+ readonly paddingY?: number;
709
+ /**
710
+ Top padding.
711
+ */
712
+ readonly paddingTop?: number;
713
+ /**
714
+ Bottom padding.
715
+ */
716
+ readonly paddingBottom?: number;
717
+ /**
718
+ Left padding.
719
+ */
720
+ readonly paddingLeft?: number;
721
+ /**
722
+ Right padding.
723
+ */
724
+ readonly paddingRight?: number;
725
+ /**
726
+ This property defines the ability for a flex item to grow if necessary.
727
+ See [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).
728
+ */
729
+ readonly flexGrow?: number;
730
+ /**
731
+ It specifies the “flex shrink factor”, which determines how much the flex item will shrink relative to the rest of the flex items in the flex container when there isn’t enough space on the row.
732
+ See [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).
733
+ */
734
+ readonly flexShrink?: number;
735
+ /**
736
+ It establishes the main-axis, thus defining the direction flex items are placed in the flex container.
737
+ See [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).
738
+ */
739
+ readonly flexDirection?: "row" | "column" | "row-reverse" | "column-reverse";
740
+ /**
741
+ It specifies the initial size of the flex item, before any available space is distributed according to the flex factors.
742
+ See [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).
743
+ */
744
+ readonly flexBasis?: number | string;
745
+ /**
746
+ It defines whether the flex items are forced in a single line or can be flowed into multiple lines. If set to multiple lines, it also defines the cross-axis which determines the direction new lines are stacked in.
747
+ See [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/).
748
+ */
749
+ readonly flexWrap?: "nowrap" | "wrap" | "wrap-reverse";
750
+ /**
751
+ The align-items property defines the default behavior for how items are laid out along the cross axis (perpendicular to the main axis).
752
+ See [align-items](https://css-tricks.com/almanac/properties/a/align-items/).
753
+ */
754
+ readonly alignItems?: "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
755
+ /**
756
+ It makes possible to override the align-items value for specific flex items.
757
+ See [align-self](https://css-tricks.com/almanac/properties/a/align-self/).
758
+ */
759
+ readonly alignSelf?: "flex-start" | "center" | "flex-end" | "auto" | "stretch" | "baseline";
760
+ /**
761
+ It defines the alignment along the cross axis when there are multiple lines of flex items (when using flex-wrap).
762
+ See [align-content](https://css-tricks.com/almanac/properties/a/align-content/).
763
+ */
764
+ readonly alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly";
765
+ /**
766
+ It defines the alignment along the main axis.
767
+ See [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).
768
+ */
769
+ readonly justifyContent?: "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "center";
770
+ /**
771
+ Width of the element in spaces. You can also set it as a percentage, which will calculate the width based on the width of the parent element.
772
+ */
773
+ readonly width?: number | string;
774
+ /**
775
+ Height of the element in lines (rows). You can also set it as a percentage, which will calculate the height based on the height of the parent element.
776
+ */
777
+ readonly height?: number | string;
778
+ /**
779
+ Sets a minimum width of the element.
780
+ Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
781
+ */
782
+ readonly minWidth?: number | string;
783
+ /**
784
+ Sets a minimum height of the element in lines (rows). You can also set it as a percentage, which will calculate the minimum height based on the height of the parent element.
785
+ */
786
+ readonly minHeight?: number | string;
787
+ /**
788
+ Sets a maximum width of the element.
789
+ Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
790
+ */
791
+ readonly maxWidth?: number | string;
792
+ /**
793
+ Sets a maximum height of the element in lines (rows). You can also set it as a percentage, which will calculate the maximum height based on the height of the parent element.
794
+ */
795
+ readonly maxHeight?: number | string;
796
+ /**
797
+ Defines the aspect ratio (width/height) for the element.
798
+
799
+ Use it with at least one size constraint (`width`, `height`, `minHeight`, or `maxHeight`) so Ink can derive the missing dimension.
800
+ */
801
+ readonly aspectRatio?: number;
802
+ /**
803
+ Set this property to `none` to hide the element.
804
+ */
805
+ readonly display?: "flex" | "none";
806
+ /**
807
+ Add a border with a specified style. If `borderStyle` is `undefined` (the default), no border will be added.
808
+ */
809
+ readonly borderStyle?: keyof Boxes | BoxStyle;
810
+ /**
811
+ Determines whether the top border is visible.
812
+
813
+ @default true
814
+ */
815
+ readonly borderTop?: boolean;
816
+ /**
817
+ Determines whether the bottom border is visible.
818
+
819
+ @default true
820
+ */
821
+ readonly borderBottom?: boolean;
822
+ /**
823
+ Determines whether the left border is visible.
824
+
825
+ @default true
826
+ */
827
+ readonly borderLeft?: boolean;
828
+ /**
829
+ Determines whether the right border is visible.
830
+
831
+ @default true
832
+ */
833
+ readonly borderRight?: boolean;
834
+ /**
835
+ Change border color. A shorthand for setting `borderTopColor`, `borderRightColor`, `borderBottomColor`, and `borderLeftColor`.
836
+ */
837
+ readonly borderColor?: LiteralUnion<ForegroundColorName, string>;
838
+ /**
839
+ Change the top border color. Accepts the same values as `color` in `Text` component.
840
+ */
841
+ readonly borderTopColor?: LiteralUnion<ForegroundColorName, string>;
842
+ /**
843
+ Change the bottom border color. Accepts the same values as `color` in `Text` component.
844
+ */
845
+ readonly borderBottomColor?: LiteralUnion<ForegroundColorName, string>;
846
+ /**
847
+ Change the left border color. Accepts the same values as `color` in `Text` component.
848
+ */
849
+ readonly borderLeftColor?: LiteralUnion<ForegroundColorName, string>;
850
+ /**
851
+ Change the right border color. Accepts the same values as `color` in `Text` component.
852
+ */
853
+ readonly borderRightColor?: LiteralUnion<ForegroundColorName, string>;
854
+ /**
855
+ Dim the border color. A shorthand for setting `borderTopDimColor`, `borderBottomDimColor`, `borderLeftDimColor`, and `borderRightDimColor`.
856
+
857
+ @default false
858
+ */
859
+ readonly borderDimColor?: boolean;
860
+ /**
861
+ Dim the top border color.
862
+
863
+ @default false
864
+ */
865
+ readonly borderTopDimColor?: boolean;
866
+ /**
867
+ Dim the bottom border color.
868
+
869
+ @default false
870
+ */
871
+ readonly borderBottomDimColor?: boolean;
872
+ /**
873
+ Dim the left border color.
874
+
875
+ @default false
876
+ */
877
+ readonly borderLeftDimColor?: boolean;
878
+ /**
879
+ Dim the right border color.
880
+
881
+ @default false
882
+ */
883
+ readonly borderRightDimColor?: boolean;
884
+ /**
885
+ Change border background color. A shorthand for setting `borderTopBackgroundColor`, `borderRightBackgroundColor`, `borderBottomBackgroundColor`, and `borderLeftBackgroundColor`.
886
+ */
887
+ readonly borderBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
888
+ /**
889
+ Change top border background color. Accepts the same values as `backgroundColor` in `Text` component.
890
+ */
891
+ readonly borderTopBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
892
+ /**
893
+ Change bottom border background color. Accepts the same values as `backgroundColor` in `Text` component.
894
+ */
895
+ readonly borderBottomBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
896
+ /**
897
+ Change left border background color. Accepts the same values as `backgroundColor` in `Text` component.
898
+ */
899
+ readonly borderLeftBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
900
+ /**
901
+ Change right border background color. Accepts the same values as `backgroundColor` in `Text` component.
902
+ */
903
+ readonly borderRightBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
904
+ /**
905
+ Behavior for an element's overflow in both directions.
906
+
907
+ @default 'visible'
908
+ */
909
+ readonly overflow?: "visible" | "hidden";
910
+ /**
911
+ Behavior for an element's overflow in the horizontal direction.
912
+
913
+ @default 'visible'
914
+ */
915
+ readonly overflowX?: "visible" | "hidden";
916
+ /**
917
+ Behavior for an element's overflow in the vertical direction.
918
+
919
+ @default 'visible'
920
+ */
921
+ readonly overflowY?: "visible" | "hidden";
922
+ /**
923
+ Background color for the element.
924
+
925
+ Accepts the same values as `color` in the `<Text>` component.
926
+ */
927
+ readonly backgroundColor?: LiteralUnion<ForegroundColorName, string>;
928
+ };
929
+ //#endregion
930
+ //#region src/dom.d.ts
931
+ type InkNode = {
932
+ parentNode: DOMElement | undefined;
933
+ yogaNode?: Node;
934
+ internal_static?: boolean;
935
+ style: Styles;
936
+ };
937
+ type LayoutListener = () => void;
938
+ type TextName = "#text";
939
+ type ElementNames = "ink-root" | "ink-box" | "ink-text" | "ink-virtual-text";
940
+ type NodeNames = ElementNames | TextName;
941
+ type DOMElement = {
942
+ nodeName: ElementNames;
943
+ attributes: Record<string, DOMNodeAttribute>;
944
+ childNodes: DOMNode[];
945
+ internal_transform?: OutputTransformer;
946
+ internal_accessibility?: {
947
+ role?: "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
948
+ state?: {
949
+ busy?: boolean;
950
+ checked?: boolean;
951
+ disabled?: boolean;
952
+ expanded?: boolean;
953
+ multiline?: boolean;
954
+ multiselectable?: boolean;
955
+ readonly?: boolean;
956
+ required?: boolean;
957
+ selected?: boolean;
958
+ };
959
+ };
960
+ isStaticDirty?: boolean;
961
+ staticNode?: DOMElement;
962
+ previousStaticNode?: DOMElement;
963
+ onComputeLayout?: () => void;
964
+ onRender?: () => void;
965
+ onImmediateRender?: () => void;
966
+ onStaticChange?: () => void;
967
+ internal_layoutListeners?: Set<LayoutListener>;
968
+ } & InkNode;
969
+ type TextNode = {
970
+ nodeName: TextName;
971
+ nodeValue: string;
972
+ } & InkNode;
973
+ type DOMNode<T = {
974
+ nodeName: NodeNames;
975
+ }> = T extends {
976
+ nodeName: infer U;
977
+ } ? U extends "#text" ? TextNode : DOMElement : never;
978
+ type DOMNodeAttribute = boolean | string | number;
979
+ //#endregion
980
+ //#region src/components/Box.d.ts
981
+ type Props$1 = Except<Styles, "textWrap"> & {
982
+ /**
983
+ A label for the element for screen readers.
984
+ */
985
+ readonly "aria-label"?: string;
986
+ /**
987
+ Hide the element from screen readers.
988
+ */
989
+ readonly "aria-hidden"?: boolean;
990
+ /**
991
+ The role of the element.
992
+ */
993
+ readonly "aria-role"?: "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
994
+ /**
995
+ The state of the element.
996
+ */
997
+ readonly "aria-state"?: {
998
+ readonly busy?: boolean;
999
+ readonly checked?: boolean;
1000
+ readonly disabled?: boolean;
1001
+ readonly expanded?: boolean;
1002
+ readonly multiline?: boolean;
1003
+ readonly multiselectable?: boolean;
1004
+ readonly readonly?: boolean;
1005
+ readonly required?: boolean;
1006
+ readonly selected?: boolean;
1007
+ };
1008
+ };
1009
+ /**
1010
+ `<Box>` is an essential Ink component to build your layout. It's like `<div style="display: flex">` in the browser.
1011
+ */
1012
+ declare const Box: import("react").ForwardRefExoticComponent<Except<Styles, "textWrap"> & {
1013
+ /**
1014
+ A label for the element for screen readers.
1015
+ */
1016
+ readonly "aria-label"?: string;
1017
+ /**
1018
+ Hide the element from screen readers.
1019
+ */
1020
+ readonly "aria-hidden"?: boolean;
1021
+ /**
1022
+ The role of the element.
1023
+ */
1024
+ readonly "aria-role"?: "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
1025
+ /**
1026
+ The state of the element.
1027
+ */
1028
+ readonly "aria-state"?: {
1029
+ readonly busy?: boolean;
1030
+ readonly checked?: boolean;
1031
+ readonly disabled?: boolean;
1032
+ readonly expanded?: boolean;
1033
+ readonly multiline?: boolean;
1034
+ readonly multiselectable?: boolean;
1035
+ readonly readonly?: boolean;
1036
+ readonly required?: boolean;
1037
+ readonly selected?: boolean;
1038
+ };
1039
+ } & {
1040
+ children?: import("react").ReactNode | undefined;
1041
+ } & import("react").RefAttributes<DOMElement>>;
1042
+ //#endregion
1043
+ //#region src/components/Text.d.ts
1044
+ type Props$6 = {
1045
+ /**
1046
+ A label for the element for screen readers.
1047
+ */
1048
+ readonly "aria-label"?: string;
1049
+ /**
1050
+ Hide the element from screen readers.
1051
+ */
1052
+ readonly "aria-hidden"?: boolean;
1053
+ /**
1054
+ Change text color. Ink uses Chalk under the hood, so all its functionality is supported.
1055
+ */
1056
+ readonly color?: LiteralUnion<ForegroundColorName, string>;
1057
+ /**
1058
+ Same as `color`, but for the background.
1059
+ */
1060
+ readonly backgroundColor?: LiteralUnion<ForegroundColorName, string>;
1061
+ /**
1062
+ Dim the color (make it less bright).
1063
+ */
1064
+ readonly dimColor?: boolean;
1065
+ /**
1066
+ Make the text bold.
1067
+ */
1068
+ readonly bold?: boolean;
1069
+ /**
1070
+ Make the text italic.
1071
+ */
1072
+ readonly italic?: boolean;
1073
+ /**
1074
+ Make the text underlined.
1075
+ */
1076
+ readonly underline?: boolean;
1077
+ /**
1078
+ Make the text crossed out with a line.
1079
+ */
1080
+ readonly strikethrough?: boolean;
1081
+ /**
1082
+ Inverse background and foreground colors.
1083
+ */
1084
+ readonly inverse?: boolean;
1085
+ /**
1086
+ This property tells Ink to wrap or truncate text if its width is larger than the container. If `wrap` is passed (the default), Ink will wrap text and split it into multiple lines. If `hard` is passed, Ink will fill each line to the full column width, breaking words as necessary. If `truncate-*` is passed, Ink will truncate text instead, resulting in one line of text with the rest cut off.
1087
+ */
1088
+ readonly wrap?: Styles["textWrap"];
1089
+ readonly children?: ReactNode;
1090
+ };
1091
+ /**
1092
+ This component can display text and change its style to make it bold, underlined, italic, or strikethrough.
1093
+ */
1094
+ declare function Text({ color, backgroundColor, dimColor, bold, italic, underline, strikethrough, inverse, wrap, children, "aria-label": ariaLabel, "aria-hidden": ariaHidden }: Props$6): import("react").JSX.Element | null;
1095
+ //#endregion
1096
+ //#region src/components/StdinContext.d.ts
1097
+ type PublicProps = {
1098
+ /**
1099
+ The stdin stream passed to `render()` in `options.stdin`, or `process.stdin` by default. Useful if your app needs to handle user input.
1100
+ */
1101
+ readonly stdin: NodeJS.ReadableStream;
1102
+ /**
1103
+ Ink exposes this function via own `<StdinContext>` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`. If the `stdin` stream passed to Ink does not support setRawMode, this function does nothing.
1104
+ */
1105
+ readonly setRawMode: (value: boolean) => void;
1106
+ /**
1107
+ A boolean flag determining if the current `stdin` supports `setRawMode`. A component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.
1108
+ */
1109
+ readonly isRawModeSupported: boolean;
1110
+ };
1111
+ //#endregion
1112
+ //#region src/components/StdoutContext.d.ts
1113
+ type Props$5 = {
1114
+ /**
1115
+ Stdout stream passed to `render()` in `options.stdout` or `process.stdout` by default.
1116
+ */
1117
+ readonly stdout: OutputStream;
1118
+ /**
1119
+ Write any string to stdout while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `<Static>`, except it can't accept components; it only works with strings.
1120
+ */
1121
+ readonly write: (data: string) => void;
1122
+ };
1123
+ //#endregion
1124
+ //#region src/components/StderrContext.d.ts
1125
+ type Props$4 = {
1126
+ /**
1127
+ Stderr stream passed to `render()` in `options.stderr` or `process.stderr` by default.
1128
+ */
1129
+ readonly stderr: NodeJS.WritableStream;
1130
+ /**
1131
+ Write any string to stderr while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `<Static>`, except it can't accept components; it only works with strings.
1132
+ */
1133
+ readonly write: (data: string) => void;
1134
+ };
1135
+ //#endregion
1136
+ //#region src/components/Static.d.ts
1137
+ type Props$3<T> = {
1138
+ /**
1139
+ Array of items of any type to render using the function you pass as a component child.
1140
+ */
1141
+ readonly items: T[];
1142
+ /**
1143
+ Styles to apply to a container of child elements. See <Box> for supported properties.
1144
+ */
1145
+ readonly style?: Styles;
1146
+ /**
1147
+ Function that is called to render every item in the `items` array. The first argument is the item itself, and the second argument is the index of that item in the `items` array. Note that a `key` must be assigned to the root component.
1148
+ */
1149
+ readonly children: (item: T, index: number) => ReactNode;
1150
+ };
1151
+ /**
1152
+ `<Static>` component permanently renders its output above everything else. It's useful for displaying activity like completed tasks or logs—things that don't change after they're rendered (hence the name "Static").
1153
+
1154
+ It's preferred to use `<Static>` for use cases like these when you can't know or control the number of items that need to be rendered.
1155
+
1156
+ For example, [Tap](https://github.com/tapjs/node-tap) uses `<Static>` to display a list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it to display a list of generated pages while still displaying a live progress bar.
1157
+ */
1158
+ declare function Static<T>(props: Props$3<T>): import("react").JSX.Element;
1159
+ //#endregion
1160
+ //#region src/components/Transform.d.ts
1161
+ type Props$7 = {
1162
+ /**
1163
+ Screen-reader-specific text to output. If this is set, all children will be ignored.
1164
+ */
1165
+ readonly accessibilityLabel?: string;
1166
+ /**
1167
+ Function that transforms children output. It accepts children and must return transformed children as well. Note that when children use `<Text>` styling props (e.g. `color`, `bold`), the string will contain ANSI escape codes.
1168
+ */
1169
+ readonly transform: (children: string, index: number) => string;
1170
+ readonly children?: ReactNode;
1171
+ };
1172
+ /**
1173
+ Transform a string representation of React components before they're written to output. For example, you might want to apply a gradient to text, add a clickable link, or create some text effects. These use cases can't accept React nodes as input; they expect a string. That's what the <Transform> component does: it gives you an output string of its child components and lets you transform it in any way.
1174
+ */
1175
+ declare function Transform({ children, transform, accessibilityLabel }: Props$7): import("react").JSX.Element | null;
1176
+ //#endregion
1177
+ //#region src/components/Newline.d.ts
1178
+ type Props$2 = {
1179
+ /**
1180
+ Number of newlines to insert.
1181
+
1182
+ @default 1
1183
+ */
1184
+ readonly count?: number;
1185
+ };
1186
+ /**
1187
+ Adds one or more newline (`\n`) characters. Must be used within `<Text>` components.
1188
+ */
1189
+ declare function Newline({ count }: Props$2): import("react").JSX.Element;
1190
+ //#endregion
1191
+ //#region src/components/Spacer.d.ts
1192
+ /**
1193
+ A flexible space that expands along the major axis of its containing layout.
1194
+
1195
+ It's useful as a shortcut for filling all the available space between elements.
1196
+ */
1197
+ declare function Spacer(): import("react").JSX.Element;
1198
+ //#endregion
1199
+ //#region src/hooks/use-input.d.ts
1200
+ /**
1201
+ Handy information about a key that was pressed.
1202
+ */
1203
+ type Key = {
1204
+ /**
1205
+ Up arrow key was pressed.
1206
+ */
1207
+ upArrow: boolean;
1208
+ /**
1209
+ Down arrow key was pressed.
1210
+ */
1211
+ downArrow: boolean;
1212
+ /**
1213
+ Left arrow key was pressed.
1214
+ */
1215
+ leftArrow: boolean;
1216
+ /**
1217
+ Right arrow key was pressed.
1218
+ */
1219
+ rightArrow: boolean;
1220
+ /**
1221
+ Page Down key was pressed.
1222
+ */
1223
+ pageDown: boolean;
1224
+ /**
1225
+ Page Up key was pressed.
1226
+ */
1227
+ pageUp: boolean;
1228
+ /**
1229
+ Home key was pressed.
1230
+ */
1231
+ home: boolean;
1232
+ /**
1233
+ End key was pressed.
1234
+ */
1235
+ end: boolean;
1236
+ /**
1237
+ Return (Enter) key was pressed.
1238
+ */
1239
+ return: boolean;
1240
+ /**
1241
+ Escape key was pressed.
1242
+ */
1243
+ escape: boolean;
1244
+ /**
1245
+ Ctrl key was pressed.
1246
+ */
1247
+ ctrl: boolean;
1248
+ /**
1249
+ Shift key was pressed.
1250
+ */
1251
+ shift: boolean;
1252
+ /**
1253
+ Tab key was pressed.
1254
+ */
1255
+ tab: boolean;
1256
+ /**
1257
+ Backspace key was pressed.
1258
+ */
1259
+ backspace: boolean;
1260
+ /**
1261
+ Delete key was pressed.
1262
+ */
1263
+ delete: boolean;
1264
+ /**
1265
+ [Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.
1266
+ */
1267
+ meta: boolean;
1268
+ /**
1269
+ Super key (Cmd on Mac, Win on Windows) was pressed.
1270
+
1271
+ Only available with kitty keyboard protocol.
1272
+ */
1273
+ super: boolean;
1274
+ /**
1275
+ Hyper key was pressed.
1276
+
1277
+ Only available with kitty keyboard protocol.
1278
+ */
1279
+ hyper: boolean;
1280
+ /**
1281
+ Caps Lock is active.
1282
+
1283
+ Only available with kitty keyboard protocol.
1284
+ */
1285
+ capsLock: boolean;
1286
+ /**
1287
+ Num Lock is active.
1288
+
1289
+ Only available with kitty keyboard protocol.
1290
+ */
1291
+ numLock: boolean;
1292
+ /**
1293
+ Event type for key events.
1294
+
1295
+ Only available with kitty keyboard protocol.
1296
+ */
1297
+ eventType?: "press" | "repeat" | "release";
1298
+ };
1299
+ type Handler = (input: string, key: Key) => void;
1300
+ type Options$2 = {
1301
+ /**
1302
+ Enable or disable capturing of user input. Useful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.
1303
+
1304
+ @default true
1305
+ */
1306
+ isActive?: boolean;
1307
+ };
1308
+ /**
1309
+ A React hook that returns `void` and handles user input.
1310
+ It's a more convenient alternative to using `StdinContext` and listening for `data` events. The callback you pass to `useInput` is called for each character when the user enters any input. However, if the user pastes text and it's more than one character, the callback will be called only once, and the whole string will be passed as `input`.
1311
+
1312
+ ```
1313
+ import {useInput} from 'ink';
1314
+
1315
+ const UserInput = () => {
1316
+ useInput((input, key) => {
1317
+ if (input === 'q') {
1318
+ // Exit program
1319
+ }
1320
+
1321
+ if (key.leftArrow) {
1322
+ // Left arrow key pressed
1323
+ }
1324
+ });
1325
+
1326
+ return …
1327
+ };
1328
+ ```
1329
+ */
1330
+ declare const useInput: (inputHandler: Handler, options?: Options$2) => void;
1331
+ //#endregion
1332
+ //#region src/hooks/use-paste.d.ts
1333
+ type Options$1 = {
1334
+ /**
1335
+ Enable or disable the paste handler. Useful when multiple components use `usePaste` and only one should be active at a time.
1336
+
1337
+ @default true
1338
+ */
1339
+ isActive?: boolean;
1340
+ };
1341
+ /**
1342
+ A React hook that calls `handler` whenever the user pastes text in the terminal. Bracketed paste mode (`\x1b[?2004h`) is automatically enabled while the hook is active, so pasted text arrives as a single string rather than being misinterpreted as individual key presses.
1343
+
1344
+ `usePaste` and `useInput` can be used together in the same component. They operate on separate event channels, so paste content is never forwarded to `useInput` handlers when `usePaste` is active.
1345
+
1346
+ ```
1347
+ import {useInput, usePaste} from 'ink';
1348
+
1349
+ const MyInput = () => {
1350
+ useInput((input, key) => {
1351
+ // Only receives typed characters and key events, not pasted text.
1352
+ if (key.return) {
1353
+ // Submit
1354
+ }
1355
+ });
1356
+
1357
+ usePaste((text) => {
1358
+ // Receives the full pasted string, including newlines.
1359
+ console.log('Pasted:', text);
1360
+ });
1361
+
1362
+ return …
1363
+ };
1364
+ ```
1365
+ */
1366
+ declare const usePaste: (handler: (text: string) => void, options?: Options$1) => void;
1367
+ //#endregion
1368
+ //#region src/hooks/use-app.d.ts
1369
+ /**
1370
+ A React hook that returns app lifecycle methods like `exit()` and `waitUntilRenderFlush()`.
1371
+ */
1372
+ declare const useApp: () => Props;
1373
+ //#endregion
1374
+ //#region src/hooks/use-stdin.d.ts
1375
+ /**
1376
+ A React hook that returns the stdin stream and stdin-related utilities.
1377
+ */
1378
+ declare const useStdin: () => PublicProps;
1379
+ //#endregion
1380
+ //#region src/hooks/use-stdout.d.ts
1381
+ /**
1382
+ A React hook that returns the stdout stream where Ink renders your app.
1383
+ */
1384
+ declare const useStdout: () => Props$5;
1385
+ //#endregion
1386
+ //#region src/hooks/use-stderr.d.ts
1387
+ /**
1388
+ A React hook that returns the stderr stream.
1389
+ */
1390
+ declare const useStderr: () => Props$4;
1391
+ //#endregion
1392
+ //#region src/hooks/use-focus.d.ts
1393
+ type Input = {
1394
+ /**
1395
+ Enable or disable this component's focus, while still maintaining its position in the list of focusable components.
1396
+ */
1397
+ isActive?: boolean;
1398
+ /**
1399
+ Auto-focus this component if there's no active (focused) component right now.
1400
+ */
1401
+ autoFocus?: boolean;
1402
+ /**
1403
+ Assign an ID to this component, so it can be programmatically focused with `focus(id)`.
1404
+ */
1405
+ id?: string;
1406
+ };
1407
+ type Output$2 = {
1408
+ /**
1409
+ Determines whether this component is focused.
1410
+ */
1411
+ isFocused: boolean;
1412
+ /**
1413
+ Allows focusing a specific element with the provided `id`.
1414
+ */
1415
+ focus: (id: string) => void;
1416
+ };
1417
+ /**
1418
+ A React hook that returns focus state and focus controls for the current component.
1419
+ A component that uses the `useFocus` hook becomes "focusable" to Ink, so when the user presses <kbd>Tab</kbd>, Ink will switch focus to this component. If there are multiple components that execute the `useFocus` hook, focus will be given to them in the order in which these components are rendered.
1420
+ */
1421
+ declare const useFocus: ({ isActive, autoFocus, id: customId }?: Input) => Output$2;
1422
+ //#endregion
1423
+ //#region src/components/FocusContext.d.ts
1424
+ type Props$8 = {
1425
+ readonly activeId?: string;
1426
+ readonly add: (id: string, options: {
1427
+ autoFocus: boolean;
1428
+ }) => void;
1429
+ readonly remove: (id: string) => void;
1430
+ readonly activate: (id: string) => void;
1431
+ readonly deactivate: (id: string) => void;
1432
+ readonly enableFocus: () => void;
1433
+ readonly disableFocus: () => void;
1434
+ readonly focusNext: () => void;
1435
+ readonly focusPrevious: () => void;
1436
+ readonly focus: (id: string) => void;
1437
+ };
1438
+ //#endregion
1439
+ //#region src/hooks/use-focus-manager.d.ts
1440
+ type Output$1 = {
1441
+ /**
1442
+ Enable focus management for all components.
1443
+ */
1444
+ enableFocus: Props$8["enableFocus"];
1445
+ /**
1446
+ Disable focus management for all components. The currently active component (if there's one) will lose its focus.
1447
+ */
1448
+ disableFocus: Props$8["disableFocus"];
1449
+ /**
1450
+ Switch focus to the next focusable component. If there's no active component right now, focus will be given to the first focusable component. If the active component is the last in the list of focusable components, focus will be switched to the first focusable component.
1451
+ */
1452
+ focusNext: Props$8["focusNext"];
1453
+ /**
1454
+ Switch focus to the previous focusable component. If there's no active component right now, focus will be given to the first focusable component. If the active component is the first in the list of focusable components, focus will be switched to the last focusable component.
1455
+ */
1456
+ focusPrevious: Props$8["focusPrevious"];
1457
+ /**
1458
+ Switch focus to the element with provided `id`. If there's no element with that `id`, focus is not changed.
1459
+ */
1460
+ focus: Props$8["focus"];
1461
+ /**
1462
+ The ID of the currently focused component, or `undefined` if no component is focused.
1463
+
1464
+ @example
1465
+ ```tsx
1466
+ import {Text, useFocusManager} from 'ink';
1467
+
1468
+ const Example = () => {
1469
+ const {activeId} = useFocusManager();
1470
+
1471
+ return <Text>Focused: {activeId ?? 'none'}</Text>;
1472
+ };
1473
+ ```
1474
+ */
1475
+ activeId: Props$8["activeId"];
1476
+ };
1477
+ /**
1478
+ A React hook that returns methods to enable or disable focus management for all components or manually switch focus to the next or previous components.
1479
+ */
1480
+ declare const useFocusManager: () => Output$1;
1481
+ //#endregion
1482
+ //#region src/hooks/use-is-screen-reader-enabled.d.ts
1483
+ /**
1484
+ A React hook that returns whether a screen reader is enabled.
1485
+ This is useful when you want to render different output for screen readers.
1486
+ */
1487
+ declare const useIsScreenReaderEnabled: () => boolean;
1488
+ //#endregion
1489
+ //#region src/hooks/use-cursor.d.ts
1490
+ /**
1491
+ A React hook that returns methods to control the terminal cursor position.
1492
+
1493
+ Setting a cursor position makes the cursor visible at the specified coordinates (relative to the Ink output origin). This is useful for IME (Input Method Editor) support, where the composing character is displayed at the cursor location.
1494
+
1495
+ Pass `undefined` to hide the cursor.
1496
+ */
1497
+ declare const useCursor: () => {
1498
+ setCursorPosition: (position: CursorPosition | undefined) => void;
1499
+ };
1500
+ //#endregion
1501
+ //#region src/hooks/use-animation.d.ts
1502
+ type Options = {
1503
+ /**
1504
+ Time between ticks in milliseconds.
1505
+
1506
+ @default 100
1507
+ */
1508
+ readonly interval?: number;
1509
+ /**
1510
+ Whether the animation is running. When set to `false`, the animation stops. When toggled back to `true`, all values reset to `0`.
1511
+
1512
+ @default true
1513
+ */
1514
+ readonly isActive?: boolean;
1515
+ };
1516
+ type AnimationResult = {
1517
+ /**
1518
+ Discrete counter that increments by 1 each interval. Useful for indexed sequences like spinner frames.
1519
+ */
1520
+ readonly frame: number;
1521
+ /**
1522
+ Total elapsed time in milliseconds since the animation started or was last reset. Useful for continuous math-based animations like sine waves: `Math.sin(time / 1000 * Math.PI * 2)`.
1523
+ */
1524
+ readonly time: number;
1525
+ /**
1526
+ Time in milliseconds since the previous rendered tick. Accounts for throttled renders. Useful for physics-based or velocity-driven motion: `position += speed * delta`.
1527
+ */
1528
+ readonly delta: number;
1529
+ /**
1530
+ Resets `frame`, `time`, and `delta` to `0` and restarts timing from the current moment. Useful for one-shot animations triggered by events.
1531
+ */
1532
+ readonly reset: () => void;
1533
+ };
1534
+ /**
1535
+ A React hook that drives animations. Returns a frame counter, elapsed time, frame delta, and a reset function. All animations share a single timer internally, so multiple animated components consolidate into one render cycle.
1536
+
1537
+ @example
1538
+ ```
1539
+ import {Text, useAnimation} from 'ink';
1540
+
1541
+ const Spinner = () => {
1542
+ const {frame} = useAnimation({interval: 80});
1543
+ const characters = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
1544
+
1545
+ return <Text>{characters[frame % characters.length]}</Text>;
1546
+ };
1547
+ ```
1548
+ */
1549
+ declare function useAnimation(options?: Options): AnimationResult;
1550
+ //#endregion
1551
+ //#region src/hooks/use-window-size.d.ts
1552
+ /**
1553
+ Dimensions of the terminal window.
1554
+ */
1555
+ type WindowSize = {
1556
+ /**
1557
+ Number of columns (horizontal character cells).
1558
+ */
1559
+ readonly columns: number;
1560
+ /**
1561
+ Number of rows (vertical character cells).
1562
+ */
1563
+ readonly rows: number;
1564
+ };
1565
+ /**
1566
+ A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
1567
+ */
1568
+ declare const useWindowSize: () => WindowSize;
1569
+ //#endregion
1570
+ //#region src/hooks/use-box-metrics.d.ts
1571
+ /**
1572
+ Metrics of a box element.
1573
+
1574
+ All positions are relative to the element's parent.
1575
+ */
1576
+ type BoxMetrics = {
1577
+ /**
1578
+ Element width.
1579
+ */
1580
+ readonly width: number;
1581
+ /**
1582
+ Element height.
1583
+ */
1584
+ readonly height: number;
1585
+ /**
1586
+ Distance from the left edge of the parent.
1587
+ */
1588
+ readonly left: number;
1589
+ /**
1590
+ Distance from the top edge of the parent.
1591
+ */
1592
+ readonly top: number;
1593
+ };
1594
+ type UseBoxMetricsResult = BoxMetrics & {
1595
+ /**
1596
+ Whether the currently tracked element has been measured in the latest layout pass.
1597
+ */
1598
+ readonly hasMeasured: boolean;
1599
+ };
1600
+ /**
1601
+ A React hook that returns the current layout metrics for a tracked box element.
1602
+ It updates when layout changes (for example terminal resize, sibling/content changes, or position changes).
1603
+
1604
+ The hook returns `{width: 0, height: 0, left: 0, top: 0}` until the first layout pass completes. It also returns zeros when the tracked ref is detached.
1605
+
1606
+ Use `hasMeasured` to detect when the currently tracked element has been measured.
1607
+
1608
+ @example
1609
+ ```tsx
1610
+ import {useRef} from 'react';
1611
+ import {Box, Text, useBoxMetrics} from 'ink';
1612
+
1613
+ const Example = () => {
1614
+ const ref = useRef(null);
1615
+ const {width, height, left, top, hasMeasured} = useBoxMetrics(ref);
1616
+ return (
1617
+ <Box ref={ref}>
1618
+ <Text>
1619
+ {hasMeasured ? `${width}x${height} at ${left},${top}` : 'Measuring...'}
1620
+ </Text>
1621
+ </Box>
1622
+ );
1623
+ };
1624
+ ```
1625
+ */
1626
+ declare const useBoxMetrics: (ref: RefObject<DOMElement | null>) => UseBoxMetricsResult;
1627
+ //#endregion
1628
+ //#region src/measure-element.d.ts
1629
+ type Output = {
1630
+ /**
1631
+ Horizontal position (0-based column) within the live layout region.
1632
+ */
1633
+ x: number;
1634
+ /**
1635
+ Vertical position (0-based row) within the live layout region.
1636
+ */
1637
+ y: number;
1638
+ /**
1639
+ Element width.
1640
+ */
1641
+ width: number;
1642
+ /**
1643
+ Element height.
1644
+ */
1645
+ height: number;
1646
+ };
1647
+ /**
1648
+ Measure the layout metrics of a particular `<Box>` element.
1649
+ Returns an object with `x`, `y`, `width`, and `height` properties.
1650
+
1651
+ `x` and `y` are the element's position within the live layout region, computed by walking up the layout tree and accumulating each ancestor's offset. These are layout-tree coordinates, not terminal viewport coordinates. To compare them with mouse events, convert the event coordinates using the live region's viewport position. This is necessary even in alternate-screen mode when output, such as `<Static>` content, appears above the live region.
1652
+
1653
+ Note: `measureElement()` returns `{x: 0, y: 0, width: 0, height: 0}` when called during render (before layout is calculated). Call it from post-render code, such as `useEffect`, `useLayoutEffect`, input handlers, or timer callbacks. When content changes, pass the relevant dependency to your effect so it re-measures after each update.
1654
+ */
1655
+ declare const measureElement: (node: DOMElement) => Output;
1656
+ //#endregion
1657
+ export { type AnimationResult, type Props as AppProps, Box, type BoxMetrics, type Props$1 as BoxProps, type CapturedOutputSource, type CursorPosition, type DOMElement, type Output as ElementMetrics, type Instance, type Key, type KittyFlagName, type KittyKeyboardOptions, Newline, type Props$2 as NewlineProps, type RenderOptions, type RenderToStringOptions, Spacer, Static, type Props$3 as StaticProps, type Props$4 as StderrProps, type PublicProps as StdinProps, type Props$5 as StdoutProps, type SuspendTerminal, type TerminalSuspension, Text, type Props$6 as TextProps, Transform, type Props$7 as TransformProps, type UseBoxMetricsResult, type WindowSize, kittyFlags, kittyModifiers, measureElement, render, renderToString, useAnimation, useApp, useBoxMetrics, useCursor, useFocus, useFocusManager, useInput, useIsScreenReaderEnabled, usePaste, useStderr, useStdin, useStdout, useWindowSize };