ink 6.7.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ansi-tokenizer.d.ts +38 -0
- package/build/ansi-tokenizer.js +316 -0
- package/build/ansi-tokenizer.js.map +1 -0
- package/build/components/AnimationContext.d.ts +9 -0
- package/build/components/AnimationContext.js +13 -0
- package/build/components/AnimationContext.js.map +1 -0
- package/build/components/App.d.ts +5 -2
- package/build/components/App.js +192 -41
- package/build/components/App.js.map +1 -1
- package/build/components/AppContext.d.ts +33 -3
- package/build/components/AppContext.js +2 -1
- package/build/components/AppContext.js.map +1 -1
- package/build/components/Box.d.ts +16 -3
- package/build/components/ErrorBoundary.d.ts +2 -2
- package/build/components/ErrorOverview.js +6 -6
- package/build/components/ErrorOverview.js.map +1 -1
- package/build/components/Static.js.map +1 -1
- package/build/components/StdinContext.d.ts +7 -1
- package/build/components/StdinContext.js +1 -0
- package/build/components/StdinContext.js.map +1 -1
- package/build/components/Text.d.ts +1 -1
- package/build/components/Text.js +1 -1
- package/build/components/Text.js.map +1 -1
- package/build/components/Transform.d.ts +1 -1
- package/build/devtools-window-polyfill.js +7 -4
- package/build/devtools-window-polyfill.js.map +1 -1
- package/build/devtools.js +31 -6
- package/build/devtools.js.map +1 -1
- package/build/dom.d.ts +5 -1
- package/build/dom.js +25 -5
- package/build/dom.js.map +1 -1
- package/build/hooks/use-animation.d.ts +49 -0
- package/build/hooks/use-animation.js +87 -0
- package/build/hooks/use-animation.js.map +1 -0
- package/build/hooks/use-app.d.ts +5 -2
- package/build/hooks/use-app.js +1 -1
- package/build/hooks/use-box-metrics.d.ts +59 -0
- package/build/hooks/use-box-metrics.js +88 -0
- package/build/hooks/use-box-metrics.js.map +1 -0
- package/build/hooks/use-cursor.d.ts +1 -1
- package/build/hooks/use-cursor.js +1 -1
- package/build/hooks/use-focus-manager.d.ts +17 -2
- package/build/hooks/use-focus-manager.js +2 -1
- package/build/hooks/use-focus-manager.js.map +1 -1
- package/build/hooks/use-focus.d.ts +2 -1
- package/build/hooks/use-focus.js +5 -4
- package/build/hooks/use-focus.js.map +1 -1
- package/build/hooks/use-input.d.ts +2 -1
- package/build/hooks/use-input.js +82 -80
- package/build/hooks/use-input.js.map +1 -1
- package/build/hooks/use-is-screen-reader-enabled.d.ts +2 -1
- package/build/hooks/use-is-screen-reader-enabled.js +2 -1
- package/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
- package/build/hooks/use-paste.d.ts +35 -0
- package/build/hooks/use-paste.js +62 -0
- package/build/hooks/use-paste.js.map +1 -0
- package/build/hooks/use-stderr.d.ts +1 -1
- package/build/hooks/use-stderr.js +1 -1
- package/build/hooks/use-stdin.d.ts +4 -2
- package/build/hooks/use-stdin.js +2 -1
- package/build/hooks/use-stdin.js.map +1 -1
- package/build/hooks/use-stdout.d.ts +1 -1
- package/build/hooks/use-stdout.js +1 -1
- package/build/hooks/use-window-size.d.ts +18 -0
- package/build/hooks/use-window-size.js +22 -0
- package/build/hooks/use-window-size.js.map +1 -0
- package/build/index.d.ts +10 -1
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/ink.d.ts +55 -6
- package/build/ink.js +433 -162
- package/build/ink.js.map +1 -1
- package/build/input-parser.d.ts +10 -0
- package/build/input-parser.js +194 -0
- package/build/input-parser.js.map +1 -0
- package/build/log-update.d.ts +1 -0
- package/build/log-update.js +13 -1
- package/build/log-update.js.map +1 -1
- package/build/measure-element.d.ts +4 -0
- package/build/measure-element.js +4 -0
- package/build/measure-element.js.map +1 -1
- package/build/output.d.ts +1 -0
- package/build/output.js +63 -5
- package/build/output.js.map +1 -1
- package/build/parse-keypress.d.ts +1 -3
- package/build/parse-keypress.js +19 -17
- package/build/parse-keypress.js.map +1 -1
- package/build/reconciler.js +48 -19
- package/build/reconciler.js.map +1 -1
- package/build/render-border.js +29 -18
- package/build/render-border.js.map +1 -1
- package/build/render-to-string.d.ts +38 -0
- package/build/render-to-string.js +116 -0
- package/build/render-to-string.js.map +1 -0
- package/build/render.d.ts +69 -3
- package/build/render.js +18 -11
- package/build/render.js.map +1 -1
- package/build/sanitize-ansi.d.ts +2 -0
- package/build/sanitize-ansi.js +27 -0
- package/build/sanitize-ansi.js.map +1 -0
- package/build/squash-text-nodes.js +2 -1
- package/build/squash-text-nodes.js.map +1 -1
- package/build/styles.d.ts +78 -16
- package/build/styles.js +102 -31
- package/build/styles.js.map +1 -1
- package/build/utils.d.ts +9 -0
- package/build/utils.js +19 -0
- package/build/utils.js.map +1 -0
- package/build/wrap-text.js +7 -0
- package/build/wrap-text.js.map +1 -1
- package/build/write-synchronized.d.ts +1 -1
- package/build/write-synchronized.js +4 -2
- package/build/write-synchronized.js.map +1 -1
- package/package.json +40 -101
- package/readme.md +674 -56
- package/build/apply-styles.js +0 -175
- package/build/build-layout.js +0 -77
- package/build/calculate-wrapped-text.js +0 -53
- package/build/components/Color.js +0 -62
- package/build/experimental/apply-style.js +0 -140
- package/build/experimental/dom.js +0 -123
- package/build/experimental/output.js +0 -91
- package/build/experimental/reconciler.js +0 -141
- package/build/experimental/renderer.js +0 -81
- package/build/hooks/useInput.js +0 -38
- package/build/instance.js +0 -205
- package/build/options.d.ts +0 -52
- package/build/options.js +0 -2
- package/build/options.js.map +0 -1
- package/build/screen-reader-update.d.ts +0 -13
- package/build/screen-reader-update.js +0 -38
- package/build/screen-reader-update.js.map +0 -1
package/build/ink.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type Options = {
|
|
|
19
19
|
patchConsole: boolean;
|
|
20
20
|
onRender?: (metrics: RenderMetrics) => void;
|
|
21
21
|
isScreenReaderEnabled?: boolean;
|
|
22
|
-
waitUntilExit?: () => Promise<
|
|
22
|
+
waitUntilExit?: () => Promise<unknown>;
|
|
23
23
|
maxFps?: number;
|
|
24
24
|
incrementalRendering?: boolean;
|
|
25
25
|
/**
|
|
@@ -30,13 +30,45 @@ export type Options = {
|
|
|
30
30
|
- `useTransition` and `useDeferredValue` are fully functional
|
|
31
31
|
- Updates can be interrupted for higher priority work
|
|
32
32
|
|
|
33
|
-
Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates.
|
|
33
|
+
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.
|
|
34
34
|
|
|
35
35
|
@default false
|
|
36
36
|
@experimental
|
|
37
37
|
*/
|
|
38
38
|
concurrent?: boolean;
|
|
39
39
|
kittyKeyboard?: KittyKeyboardOptions;
|
|
40
|
+
/**
|
|
41
|
+
Override automatic interactive mode detection.
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
@default true (false if in CI or `stdout.isTTY` is falsy)
|
|
52
|
+
|
|
53
|
+
@see {@link RenderOptions.interactive}
|
|
54
|
+
*/
|
|
55
|
+
interactive?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
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.
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
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.
|
|
62
|
+
|
|
63
|
+
Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
@default false
|
|
68
|
+
|
|
69
|
+
@see {@link RenderOptions.alternateScreen}
|
|
70
|
+
*/
|
|
71
|
+
alternateScreen?: boolean;
|
|
40
72
|
};
|
|
41
73
|
export default class Ink {
|
|
42
74
|
/**
|
|
@@ -48,7 +80,11 @@ export default class Ink {
|
|
|
48
80
|
private cursorPosition;
|
|
49
81
|
private readonly throttledLog;
|
|
50
82
|
private readonly isScreenReaderEnabled;
|
|
83
|
+
private readonly interactive;
|
|
84
|
+
private readonly renderThrottleMs;
|
|
85
|
+
private alternateScreen;
|
|
51
86
|
private isUnmounted;
|
|
87
|
+
private isUnmounting;
|
|
52
88
|
private lastOutput;
|
|
53
89
|
private lastOutputToRender;
|
|
54
90
|
private lastOutputHeight;
|
|
@@ -56,19 +92,22 @@ export default class Ink {
|
|
|
56
92
|
private readonly container;
|
|
57
93
|
private readonly rootNode;
|
|
58
94
|
private fullStaticOutput;
|
|
59
|
-
private exitPromise
|
|
95
|
+
private readonly exitPromise;
|
|
96
|
+
private exitResult;
|
|
60
97
|
private beforeExitHandler?;
|
|
61
98
|
private restoreConsole?;
|
|
62
99
|
private readonly unsubscribeResize?;
|
|
63
100
|
private readonly throttledOnRender?;
|
|
101
|
+
private hasPendingThrottledRender;
|
|
64
102
|
private kittyProtocolEnabled;
|
|
65
103
|
private cancelKittyDetection?;
|
|
104
|
+
private nextRenderCommit?;
|
|
66
105
|
constructor(options: Options);
|
|
67
|
-
getTerminalWidth: () => number;
|
|
68
106
|
resized: () => void;
|
|
69
|
-
resolveExitPromise: () => void;
|
|
107
|
+
resolveExitPromise: (result?: unknown) => void;
|
|
70
108
|
rejectExitPromise: (reason?: Error) => void;
|
|
71
109
|
unsubscribeExit: () => void;
|
|
110
|
+
handleAppExit: (errorOrResult?: unknown) => void;
|
|
72
111
|
setCursorPosition: (position: CursorPosition | undefined) => void;
|
|
73
112
|
restoreLastOutput: () => void;
|
|
74
113
|
calculateLayout: () => void;
|
|
@@ -77,9 +116,19 @@ export default class Ink {
|
|
|
77
116
|
writeToStdout(data: string): void;
|
|
78
117
|
writeToStderr(data: string): void;
|
|
79
118
|
unmount(error?: Error | number | null): void;
|
|
80
|
-
waitUntilExit(): Promise<
|
|
119
|
+
waitUntilExit(): Promise<unknown>;
|
|
120
|
+
waitUntilRenderFlush(): Promise<void>;
|
|
81
121
|
clear(): void;
|
|
82
122
|
patchConsole(): void;
|
|
123
|
+
private setAlternateScreen;
|
|
124
|
+
private resolveInteractiveOption;
|
|
125
|
+
private resolveAlternateScreenOption;
|
|
126
|
+
private shouldSync;
|
|
127
|
+
private writeBestEffort;
|
|
128
|
+
private awaitExit;
|
|
129
|
+
private hasPendingConcurrentWork;
|
|
130
|
+
private awaitNextRender;
|
|
131
|
+
private renderInteractiveFrame;
|
|
83
132
|
private initKittyKeyboard;
|
|
84
133
|
private confirmKittySupport;
|
|
85
134
|
private enableKittyProtocol;
|