@alchemy.run/sigil 0.0.0-alpha.2 → 0.0.0-alpha.4
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/README.md +2 -4
- package/THIRD_PARTY_NOTICES.md +31 -22
- package/dist/ansi.d.ts +17 -14
- package/dist/ansi.js +7 -2
- package/dist/{devtools-BhYGjb7h.js → devtools-DbthxoD1.js} +22 -23
- package/dist/index.d.ts +125 -288
- package/dist/index.js +2460 -2864
- package/dist/{truncate-CBiyyZzw.js → truncate-Cr6xVFMa.js} +447 -273
- package/package.json +3 -9
- package/src/ansi/chalk.ts +8 -51
- package/src/ansi/cursor.ts +2 -4
- package/src/ansi/east-asian-width.ts +44 -0
- package/src/ansi/escapes.ts +4 -26
- package/src/ansi/index.ts +12 -14
- package/src/ansi/sgr.ts +2 -5
- package/src/ansi/slice.ts +1 -1
- package/src/ansi/string-width.ts +91 -206
- package/src/ansi/strip.ts +13 -33
- package/src/ansi/supports-color.ts +8 -14
- package/src/ansi/tokenize.ts +94 -166
- package/src/ansi/truncate.ts +5 -3
- package/src/ansi/wrap.ts +13 -14
- package/src/ansi-tokenizer.ts +1 -1
- package/src/colorize.ts +1 -1
- package/src/components/App.tsx +14 -14
- package/src/components/BackgroundContext.ts +2 -2
- package/src/components/Box.tsx +51 -59
- package/src/components/CursorContext.ts +1 -1
- package/src/components/ErrorBoundary.tsx +2 -1
- package/src/components/ErrorOverview.tsx +9 -7
- package/src/components/Newline.tsx +1 -0
- package/src/components/Spacer.tsx +2 -1
- package/src/components/Static.tsx +2 -1
- package/src/components/StderrContext.ts +0 -2
- package/src/components/StdinContext.ts +0 -1
- package/src/components/StdoutContext.ts +1 -3
- package/src/components/Text.tsx +7 -6
- package/src/components/Transform.tsx +2 -1
- package/src/cursor-position.ts +1 -1
- package/src/devtools.ts +84 -24
- package/src/dom.ts +7 -7
- package/src/env.ts +12 -0
- package/src/get-max-width.ts +1 -1
- package/src/global.d.ts +3 -4
- package/src/{boxes.ts → glyphs.ts} +17 -18
- package/src/hooks/use-animation.ts +1 -1
- package/src/hooks/use-app.ts +1 -1
- package/src/hooks/use-box-metrics.ts +1 -1
- package/src/hooks/use-cursor.ts +2 -2
- package/src/hooks/use-focus-manager.ts +1 -1
- package/src/hooks/use-focus.ts +5 -6
- package/src/hooks/use-input.ts +4 -4
- package/src/hooks/use-is-screen-reader-enabled.ts +1 -1
- package/src/hooks/use-paste.ts +2 -2
- package/src/hooks/use-stderr.ts +1 -1
- package/src/hooks/use-stdin.ts +1 -1
- package/src/hooks/use-stdout.ts +1 -1
- package/src/hooks/use-window-size.ts +2 -2
- package/src/index.ts +44 -44
- package/src/ink.tsx +536 -720
- package/src/input-parser.ts +1 -1
- package/src/instances.ts +1 -1
- package/src/kitty-keyboard.ts +128 -0
- package/src/log-update.ts +4 -4
- package/src/measure-element.ts +1 -1
- package/src/measure-text.ts +2 -2
- package/src/output.ts +4 -4
- package/src/parse-keypress.ts +4 -5
- package/src/parse-stack-line.ts +0 -1
- package/src/patch-console.ts +44 -0
- package/src/reconciler.ts +13 -60
- package/src/render-background.ts +3 -3
- package/src/render-border.ts +6 -6
- package/src/render-node-to-output.ts +13 -11
- package/src/render-to-string.ts +4 -4
- package/src/render.ts +9 -10
- package/src/renderer.ts +3 -3
- package/src/sanitize-ansi.ts +1 -1
- package/src/signal-exit.ts +4 -5
- package/src/squash-text-nodes.ts +2 -2
- package/src/stream.ts +2 -4
- package/src/styles.ts +6 -6
- package/src/terminal-size.ts +9 -8
- package/src/types.ts +1 -6
- package/src/utils.ts +2 -2
- package/src/wrap-text.ts +4 -4
- package/src/yoga/config.ts +2 -2
- package/src/yoga/core/absoluteLayout.ts +15 -15
- package/src/yoga/core/baseline.ts +3 -3
- package/src/yoga/core/cache.ts +4 -4
- package/src/yoga/core/calculateLayout.ts +33 -27
- package/src/yoga/core/config.ts +1 -1
- package/src/yoga/core/flexLine.ts +3 -3
- package/src/yoga/core/helpers.ts +3 -3
- package/src/yoga/core/layoutResults.ts +4 -4
- package/src/yoga/core/node.ts +16 -16
- package/src/yoga/core/pixelGrid.ts +4 -4
- package/src/yoga/core/style.ts +11 -11
- package/src/yoga/core/types.ts +2 -2
- package/src/yoga/index.ts +6 -6
- package/src/yoga/node.ts +8 -8
- package/src/ansi/widest-line.ts +0 -12
- package/src/auto-bind.ts +0 -41
- package/src/devtools-window-polyfill.ts +0 -73
- package/src/indent-string.ts +0 -16
- package/src/is-in-ci.ts +0 -7
- package/src/write-synchronized.ts +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,88 +1,8 @@
|
|
|
1
1
|
import { n as ForegroundColorName } from "./sgr-CMfEpjSk.js";
|
|
2
2
|
import { i as Node } from "./index-DDVME65c.js";
|
|
3
3
|
import { Writable } from "node:stream";
|
|
4
|
-
import { ReactNode, RefObject } from "react";
|
|
4
|
+
import { PropsWithChildren, ReactNode, Ref, RefObject } from "react";
|
|
5
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
6
|
//#region src/kitty-keyboard.d.ts
|
|
87
7
|
declare const kittyFlags: {
|
|
88
8
|
readonly disambiguateEscapeCodes: 1;
|
|
@@ -107,12 +27,6 @@ type KittyKeyboardOptions = {
|
|
|
107
27
|
flags?: KittyFlagName[];
|
|
108
28
|
};
|
|
109
29
|
//#endregion
|
|
110
|
-
//#region src/cursor-position.d.ts
|
|
111
|
-
type CursorPosition = {
|
|
112
|
-
x: number;
|
|
113
|
-
y: number;
|
|
114
|
-
};
|
|
115
|
-
//#endregion
|
|
116
30
|
//#region src/stream.d.ts
|
|
117
31
|
type OutputStream = NodeJS.WritableStream & {
|
|
118
32
|
isTTY?: boolean;
|
|
@@ -137,164 +51,31 @@ type RenderMetrics = {
|
|
|
137
51
|
*/
|
|
138
52
|
renderTime: number;
|
|
139
53
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
debug: boolean;
|
|
145
|
-
exitOnCtrlC: boolean;
|
|
54
|
+
/**
|
|
55
|
+
A live Ink renderer for one stdout stream, created by `createInk`.
|
|
56
|
+
*/
|
|
57
|
+
type Ink = {
|
|
146
58
|
/**
|
|
147
|
-
|
|
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.
|
|
59
|
+
Replace the previous root node with a new one or update props of the current root node.
|
|
154
60
|
*/
|
|
155
|
-
|
|
61
|
+
render: (node: ReactNode) => void;
|
|
156
62
|
/**
|
|
157
|
-
|
|
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).
|
|
63
|
+
Unmount the app and release the terminal.
|
|
164
64
|
*/
|
|
165
|
-
|
|
166
|
-
onRender?: (metrics: RenderMetrics) => void;
|
|
167
|
-
isScreenReaderEnabled?: boolean;
|
|
168
|
-
waitUntilExit?: () => Promise<unknown>;
|
|
169
|
-
maxFps?: number;
|
|
170
|
-
incrementalRendering?: boolean;
|
|
65
|
+
unmount: (error?: Error | number | null) => void;
|
|
171
66
|
/**
|
|
172
|
-
|
|
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
|
|
67
|
+
Returns a promise that settles when the app is unmounted.
|
|
183
68
|
*/
|
|
184
|
-
|
|
185
|
-
kittyKeyboard?: KittyKeyboardOptions;
|
|
69
|
+
waitUntilExit: () => Promise<unknown>;
|
|
186
70
|
/**
|
|
187
|
-
|
|
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}
|
|
71
|
+
Returns a promise that settles after pending render output is flushed to stdout.
|
|
200
72
|
*/
|
|
201
|
-
|
|
73
|
+
waitUntilRenderFlush: () => Promise<void>;
|
|
202
74
|
/**
|
|
203
|
-
|
|
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}
|
|
75
|
+
Clear output.
|
|
216
76
|
*/
|
|
217
|
-
|
|
77
|
+
clear: () => void;
|
|
218
78
|
};
|
|
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
79
|
//#endregion
|
|
299
80
|
//#region src/render.d.ts
|
|
300
81
|
type RenderOptions = {
|
|
@@ -395,7 +176,7 @@ type RenderOptions = {
|
|
|
395
176
|
/**
|
|
396
177
|
Override automatic interactive mode detection.
|
|
397
178
|
|
|
398
|
-
By default, Ink detects whether the environment is interactive based on CI detection (
|
|
179
|
+
By default, Ink detects whether the environment is interactive based on CI detection (the `CI` environment variable) and `stdout.isTTY`. Most users should not need to set this.
|
|
399
180
|
|
|
400
181
|
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
182
|
|
|
@@ -519,21 +300,8 @@ declare const renderToString: (node: ReactNode, options?: RenderToStringOptions)
|
|
|
519
300
|
//#region src/render-node-to-output.d.ts
|
|
520
301
|
type OutputTransformer = (s: string, index: number) => string;
|
|
521
302
|
//#endregion
|
|
522
|
-
//#region src/
|
|
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: {
|
|
303
|
+
//#region src/glyphs.d.ts
|
|
304
|
+
declare const BOXES: {
|
|
537
305
|
readonly single: {
|
|
538
306
|
readonly topLeft: "┌";
|
|
539
307
|
readonly top: "─";
|
|
@@ -615,7 +383,20 @@ declare const boxes: {
|
|
|
615
383
|
readonly left: "→";
|
|
616
384
|
};
|
|
617
385
|
};
|
|
618
|
-
type
|
|
386
|
+
type BoxStyle = keyof typeof BOXES;
|
|
387
|
+
/**
|
|
388
|
+
The set of glyphs making up a box border, for custom `borderStyle` objects.
|
|
389
|
+
*/
|
|
390
|
+
type BoxGlyphs = {
|
|
391
|
+
readonly topLeft: string;
|
|
392
|
+
readonly top: string;
|
|
393
|
+
readonly topRight: string;
|
|
394
|
+
readonly right: string;
|
|
395
|
+
readonly bottomRight: string;
|
|
396
|
+
readonly bottom: string;
|
|
397
|
+
readonly bottomLeft: string;
|
|
398
|
+
readonly left: string;
|
|
399
|
+
};
|
|
619
400
|
//#endregion
|
|
620
401
|
//#region src/types.d.ts
|
|
621
402
|
/**
|
|
@@ -624,10 +405,6 @@ without sacrificing auto-completion in IDEs for the literal type part of the
|
|
|
624
405
|
union.
|
|
625
406
|
*/
|
|
626
407
|
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
408
|
//#endregion
|
|
632
409
|
//#region src/styles.d.ts
|
|
633
410
|
type Styles = {
|
|
@@ -728,7 +505,7 @@ type Styles = {
|
|
|
728
505
|
*/
|
|
729
506
|
readonly flexGrow?: number;
|
|
730
507
|
/**
|
|
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
|
|
508
|
+
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
509
|
See [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).
|
|
733
510
|
*/
|
|
734
511
|
readonly flexShrink?: number;
|
|
@@ -806,7 +583,7 @@ type Styles = {
|
|
|
806
583
|
/**
|
|
807
584
|
Add a border with a specified style. If `borderStyle` is `undefined` (the default), no border will be added.
|
|
808
585
|
*/
|
|
809
|
-
readonly borderStyle?:
|
|
586
|
+
readonly borderStyle?: BoxStyle | BoxGlyphs;
|
|
810
587
|
/**
|
|
811
588
|
Determines whether the top border is visible.
|
|
812
589
|
|
|
@@ -978,7 +755,7 @@ type DOMNode<T = {
|
|
|
978
755
|
type DOMNodeAttribute = boolean | string | number;
|
|
979
756
|
//#endregion
|
|
980
757
|
//#region src/components/Box.d.ts
|
|
981
|
-
type Props$1 =
|
|
758
|
+
type Props$1 = Omit<Styles, "textWrap"> & {
|
|
982
759
|
/**
|
|
983
760
|
A label for the element for screen readers.
|
|
984
761
|
*/
|
|
@@ -1009,36 +786,9 @@ type Props$1 = Except<Styles, "textWrap"> & {
|
|
|
1009
786
|
/**
|
|
1010
787
|
`<Box>` is an essential Ink component to build your layout. It's like `<div style="display: flex">` in the browser.
|
|
1011
788
|
*/
|
|
1012
|
-
declare
|
|
1013
|
-
|
|
1014
|
-
|
|
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>>;
|
|
789
|
+
declare function Box({ children, ref, backgroundColor, "aria-label": ariaLabel, "aria-hidden": ariaHidden, "aria-role": role, "aria-state": ariaState, ...style }: PropsWithChildren<Props$1> & {
|
|
790
|
+
readonly ref?: Ref<DOMElement>;
|
|
791
|
+
}): import("react").JSX.Element | null;
|
|
1042
792
|
//#endregion
|
|
1043
793
|
//#region src/components/Text.d.ts
|
|
1044
794
|
type Props$6 = {
|
|
@@ -1093,6 +843,86 @@ This component can display text and change its style to make it bold, underlined
|
|
|
1093
843
|
*/
|
|
1094
844
|
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
845
|
//#endregion
|
|
846
|
+
//#region src/components/AppContext.d.ts
|
|
847
|
+
/**
|
|
848
|
+
A handle returned by `suspendTerminal()` when called without a callback.
|
|
849
|
+
|
|
850
|
+
Call `resume()` to give terminal ownership back to Ink, or use `await using`
|
|
851
|
+
so the suspension is resumed automatically when it leaves scope.
|
|
852
|
+
*/
|
|
853
|
+
type TerminalSuspension = {
|
|
854
|
+
readonly resume: () => Promise<void>;
|
|
855
|
+
readonly [Symbol.asyncDispose]: () => Promise<void>;
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
Temporarily hand the terminal over to a child process (e.g. `$EDITOR`, `less`,
|
|
859
|
+
`fzf`), then restore Ink's terminal state and force a full redraw.
|
|
860
|
+
*/
|
|
861
|
+
type SuspendTerminal = {
|
|
862
|
+
(callback: () => void | Promise<void>): Promise<void>;
|
|
863
|
+
(): Promise<TerminalSuspension>;
|
|
864
|
+
};
|
|
865
|
+
type Props = {
|
|
866
|
+
/**
|
|
867
|
+
Exit (unmount) the whole Ink app.
|
|
868
|
+
|
|
869
|
+
- `exit()` — resolves `waitUntilExit()` with `undefined`.
|
|
870
|
+
- `exit(new Error('…'))` — rejects `waitUntilExit()` with the error.
|
|
871
|
+
- `exit(value)` — resolves `waitUntilExit()` with `value`.
|
|
872
|
+
*/
|
|
873
|
+
readonly exit: (errorOrResult?: unknown) => void;
|
|
874
|
+
/**
|
|
875
|
+
Returns a promise that settles after pending render output is flushed to stdout.
|
|
876
|
+
|
|
877
|
+
@example
|
|
878
|
+
```jsx
|
|
879
|
+
import {useEffect} from 'react';
|
|
880
|
+
import {useApp} from 'ink';
|
|
881
|
+
|
|
882
|
+
const Example = () => {
|
|
883
|
+
const {waitUntilRenderFlush} = useApp();
|
|
884
|
+
|
|
885
|
+
useEffect(() => {
|
|
886
|
+
void (async () => {
|
|
887
|
+
await waitUntilRenderFlush();
|
|
888
|
+
runNextCommand();
|
|
889
|
+
})();
|
|
890
|
+
}, [waitUntilRenderFlush]);
|
|
891
|
+
|
|
892
|
+
return …;
|
|
893
|
+
};
|
|
894
|
+
```
|
|
895
|
+
*/
|
|
896
|
+
readonly waitUntilRenderFlush: () => Promise<void>;
|
|
897
|
+
/**
|
|
898
|
+
Temporarily release the terminal so a child process can take it over, then
|
|
899
|
+
restore Ink's terminal state and force a full redraw.
|
|
900
|
+
|
|
901
|
+
Use the callback form for the common case — Ink restores the terminal even
|
|
902
|
+
if the callback throws:
|
|
903
|
+
|
|
904
|
+
@example
|
|
905
|
+
```jsx
|
|
906
|
+
import {useApp} from 'ink';
|
|
907
|
+
|
|
908
|
+
const {suspendTerminal} = useApp();
|
|
909
|
+
|
|
910
|
+
await suspendTerminal(async () => {
|
|
911
|
+
await runEditor();
|
|
912
|
+
});
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
Or hold a suspension and resume it yourself:
|
|
916
|
+
|
|
917
|
+
@example
|
|
918
|
+
```jsx
|
|
919
|
+
await using suspension = await suspendTerminal();
|
|
920
|
+
await runEditor();
|
|
921
|
+
```
|
|
922
|
+
*/
|
|
923
|
+
readonly suspendTerminal: SuspendTerminal;
|
|
924
|
+
};
|
|
925
|
+
//#endregion
|
|
1096
926
|
//#region src/components/StdinContext.d.ts
|
|
1097
927
|
type PublicProps = {
|
|
1098
928
|
/**
|
|
@@ -1175,6 +1005,7 @@ Transform a string representation of React components before they're written to
|
|
|
1175
1005
|
declare function Transform({ children, transform, accessibilityLabel }: Props$7): import("react").JSX.Element | null;
|
|
1176
1006
|
//#endregion
|
|
1177
1007
|
//#region src/components/Newline.d.ts
|
|
1008
|
+
/** @jsxImportSource react */
|
|
1178
1009
|
type Props$2 = {
|
|
1179
1010
|
/**
|
|
1180
1011
|
Number of newlines to insert.
|
|
@@ -1486,6 +1317,12 @@ This is useful when you want to render different output for screen readers.
|
|
|
1486
1317
|
*/
|
|
1487
1318
|
declare const useIsScreenReaderEnabled: () => boolean;
|
|
1488
1319
|
//#endregion
|
|
1320
|
+
//#region src/cursor-position.d.ts
|
|
1321
|
+
type CursorPosition = {
|
|
1322
|
+
x: number;
|
|
1323
|
+
y: number;
|
|
1324
|
+
};
|
|
1325
|
+
//#endregion
|
|
1489
1326
|
//#region src/hooks/use-cursor.d.ts
|
|
1490
1327
|
/**
|
|
1491
1328
|
A React hook that returns methods to control the terminal cursor position.
|