@elench/testkit 0.1.113 → 0.1.115
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/lib/cli/assistant/app.mjs +4 -2
- package/lib/cli/assistant/session.mjs +5 -1
- package/lib/cli/assistant/state.mjs +1 -2
- package/lib/cli/components/blocks/run-tree.mjs +7 -2
- package/lib/cli/components/hooks/use-element-layout.mjs +63 -0
- package/lib/cli/components/hooks/use-spinner-frame.mjs +26 -0
- package/lib/playwright/index.d.ts +1 -0
- package/lib/playwright/index.mjs +1 -0
- package/lib/runner/default-runtime-runner.mjs +5 -28
- package/lib/runner/lifecycle.mjs +2 -51
- package/lib/runner/managed-processes.mjs +2 -1
- package/lib/runner/playwright-config.mjs +13 -1
- package/lib/runner/playwright-runner.mjs +85 -15
- package/lib/runner/processes.mjs +59 -3
- package/lib/runner/subprocess.mjs +155 -0
- package/lib/shared/file-timeout.mjs +1 -1
- package/lib/ui/index.d.ts +2 -0
- package/lib/ui/index.mjs +1 -0
- package/node_modules/@alcalzone/ansi-tokenize/README.md +0 -5
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.d.ts +8 -0
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js +10 -8
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js.map +1 -1
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.d.ts +1 -5
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js +9 -45
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js.map +1 -1
- package/node_modules/@alcalzone/ansi-tokenize/package.json +1 -1
- package/node_modules/@elench/next-analysis/package.json +1 -1
- package/node_modules/@elench/testkit-bridge/package.json +2 -2
- package/node_modules/@elench/testkit-protocol/package.json +1 -1
- package/node_modules/@elench/ts-analysis/package.json +1 -1
- package/node_modules/cli-boxes/index.d.ts +95 -90
- package/node_modules/cli-boxes/index.js +5 -2
- package/node_modules/cli-boxes/package.json +6 -13
- package/node_modules/cli-boxes/readme.md +15 -3
- package/node_modules/cli-truncate/index.d.ts +1 -1
- package/node_modules/cli-truncate/package.json +4 -4
- package/node_modules/cli-truncate/readme.md +1 -0
- package/node_modules/ink/build/apply-styles.js +175 -0
- package/node_modules/ink/build/build-layout.js +77 -0
- package/node_modules/ink/build/calculate-wrapped-text.js +53 -0
- package/node_modules/ink/build/components/App.d.ts +1 -4
- package/node_modules/ink/build/components/App.js +22 -142
- package/node_modules/ink/build/components/App.js.map +1 -1
- package/node_modules/ink/build/components/AppContext.d.ts +3 -23
- package/node_modules/ink/build/components/AppContext.js +4 -7
- package/node_modules/ink/build/components/AppContext.js.map +1 -1
- package/node_modules/ink/build/components/Box.d.ts +3 -16
- package/node_modules/ink/build/components/Color.js +62 -0
- package/node_modules/ink/build/components/Cursor.d.ts +83 -0
- package/node_modules/ink/build/components/Cursor.js +53 -0
- package/node_modules/ink/build/components/Cursor.js.map +1 -0
- package/node_modules/ink/build/components/ErrorBoundary.d.ts +2 -2
- package/node_modules/ink/build/components/ErrorOverview.js +6 -6
- package/node_modules/ink/build/components/ErrorOverview.js.map +1 -1
- package/node_modules/ink/build/components/Static.js.map +1 -1
- package/node_modules/ink/build/components/StdinContext.d.ts +1 -7
- package/node_modules/ink/build/components/StdinContext.js +0 -1
- package/node_modules/ink/build/components/StdinContext.js.map +1 -1
- package/node_modules/ink/build/components/Text.d.ts +1 -1
- package/node_modules/ink/build/components/Text.js +1 -1
- package/node_modules/ink/build/components/Text.js.map +1 -1
- package/node_modules/ink/build/components/Transform.d.ts +1 -1
- package/node_modules/ink/build/devtools-window-polyfill.js +4 -7
- package/node_modules/ink/build/devtools-window-polyfill.js.map +1 -1
- package/node_modules/ink/build/devtools.js +6 -31
- package/node_modules/ink/build/devtools.js.map +1 -1
- package/node_modules/ink/build/dom.d.ts +1 -5
- package/node_modules/ink/build/dom.js +1 -20
- package/node_modules/ink/build/dom.js.map +1 -1
- package/node_modules/ink/build/experimental/apply-style.js +140 -0
- package/node_modules/ink/build/experimental/dom.js +123 -0
- package/node_modules/ink/build/experimental/output.js +91 -0
- package/node_modules/ink/build/experimental/reconciler.js +141 -0
- package/node_modules/ink/build/experimental/renderer.js +81 -0
- package/node_modules/ink/build/hooks/use-app.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-app.js +1 -1
- package/node_modules/ink/build/hooks/use-cursor.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-cursor.js +1 -1
- package/node_modules/ink/build/hooks/use-focus-manager.d.ts +2 -17
- package/node_modules/ink/build/hooks/use-focus-manager.js +1 -2
- package/node_modules/ink/build/hooks/use-focus-manager.js.map +1 -1
- package/node_modules/ink/build/hooks/use-focus.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-focus.js +4 -5
- package/node_modules/ink/build/hooks/use-focus.js.map +1 -1
- package/node_modules/ink/build/hooks/use-input.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-input.js +80 -82
- package/node_modules/ink/build/hooks/use-input.js.map +1 -1
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js +1 -2
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
- package/node_modules/ink/build/hooks/use-stderr.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-stderr.js +1 -1
- package/node_modules/ink/build/hooks/use-stdin.d.ts +2 -4
- package/node_modules/ink/build/hooks/use-stdin.js +1 -2
- package/node_modules/ink/build/hooks/use-stdin.js.map +1 -1
- package/node_modules/ink/build/hooks/use-stdout.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-stdout.js +1 -1
- package/node_modules/ink/build/hooks/useInput.js +38 -0
- package/node_modules/ink/build/index.d.ts +1 -8
- package/node_modules/ink/build/index.js +0 -4
- package/node_modules/ink/build/index.js.map +1 -1
- package/node_modules/ink/build/ink.d.ts +3 -48
- package/node_modules/ink/build/ink.js +155 -325
- package/node_modules/ink/build/ink.js.map +1 -1
- package/node_modules/ink/build/input-parser.d.ts +1 -4
- package/node_modules/ink/build/input-parser.js +30 -70
- package/node_modules/ink/build/input-parser.js.map +1 -1
- package/node_modules/ink/build/instance.js +205 -0
- package/node_modules/ink/build/layout.d.ts +7 -0
- package/node_modules/ink/build/layout.js +33 -0
- package/node_modules/ink/build/layout.js.map +1 -0
- package/node_modules/ink/build/log-update.d.ts +0 -1
- package/node_modules/ink/build/log-update.js +1 -13
- package/node_modules/ink/build/log-update.js.map +1 -1
- package/node_modules/ink/build/measure-element.d.ts +0 -4
- package/node_modules/ink/build/measure-element.js +0 -4
- package/node_modules/ink/build/measure-element.js.map +1 -1
- package/node_modules/ink/build/options.d.ts +52 -0
- package/node_modules/ink/build/options.js +2 -0
- package/node_modules/ink/build/options.js.map +1 -0
- package/node_modules/ink/build/output.js +0 -25
- package/node_modules/ink/build/output.js.map +1 -1
- package/node_modules/ink/build/parse-keypress.d.ts +3 -1
- package/node_modules/ink/build/parse-keypress.js +17 -19
- package/node_modules/ink/build/parse-keypress.js.map +1 -1
- package/node_modules/ink/build/reconciler.js +27 -46
- package/node_modules/ink/build/reconciler.js.map +1 -1
- package/node_modules/ink/build/render-border.js +18 -29
- package/node_modules/ink/build/render-border.js.map +1 -1
- package/node_modules/ink/build/render-to-string.js +1 -2
- package/node_modules/ink/build/render-to-string.js.map +1 -1
- package/node_modules/ink/build/render.d.ts +2 -57
- package/node_modules/ink/build/render.js +11 -18
- package/node_modules/ink/build/render.js.map +1 -1
- package/node_modules/ink/build/screen-reader-update.d.ts +13 -0
- package/node_modules/ink/build/screen-reader-update.js +38 -0
- package/node_modules/ink/build/screen-reader-update.js.map +1 -0
- package/node_modules/ink/build/styles.d.ts +16 -78
- package/node_modules/ink/build/styles.js +31 -102
- package/node_modules/ink/build/styles.js.map +1 -1
- package/node_modules/ink/build/utils.d.ts +2 -9
- package/node_modules/ink/build/utils.js +3 -18
- package/node_modules/ink/build/utils.js.map +1 -1
- package/node_modules/ink/build/wrap-text.js +0 -7
- package/node_modules/ink/build/wrap-text.js.map +1 -1
- package/node_modules/ink/build/write-synchronized.d.ts +1 -1
- package/node_modules/ink/build/write-synchronized.js +2 -4
- package/node_modules/ink/build/write-synchronized.js.map +1 -1
- package/node_modules/ink/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/ink/node_modules/emoji-regex/README.md +107 -0
- package/node_modules/ink/node_modules/emoji-regex/index.d.ts +3 -0
- package/node_modules/ink/node_modules/emoji-regex/index.js +4 -0
- package/node_modules/ink/node_modules/emoji-regex/index.mjs +4 -0
- package/node_modules/ink/node_modules/emoji-regex/package.json +45 -0
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/index.d.ts +1 -1
- package/node_modules/ink/node_modules/wrap-ansi/index.js +222 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.d.ts +39 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.js +82 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/license +9 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/package.json +64 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/readme.md +66 -0
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/package.json +11 -11
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/readme.md +0 -2
- package/node_modules/ink/package.json +98 -34
- package/node_modules/ink/readme.md +48 -554
- package/node_modules/slice-ansi/index.d.ts +1 -1
- package/node_modules/slice-ansi/index.js +89 -146
- package/node_modules/slice-ansi/package.json +5 -5
- package/node_modules/slice-ansi/readme.md +0 -1
- package/node_modules/slice-ansi/tokenize-ansi.js +1 -1
- package/package.json +11 -10
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts +188 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js +293 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/package.json +25 -0
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.d.ts +0 -17
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.js +0 -28
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.js.map +0 -1
- package/node_modules/ink/build/components/AnimationContext.d.ts +0 -9
- package/node_modules/ink/build/components/AnimationContext.js +0 -13
- package/node_modules/ink/build/components/AnimationContext.js.map +0 -1
- package/node_modules/ink/build/hooks/use-animation.d.ts +0 -49
- package/node_modules/ink/build/hooks/use-animation.js +0 -87
- package/node_modules/ink/build/hooks/use-animation.js.map +0 -1
- package/node_modules/ink/build/hooks/use-box-metrics.d.ts +0 -59
- package/node_modules/ink/build/hooks/use-box-metrics.js +0 -88
- package/node_modules/ink/build/hooks/use-box-metrics.js.map +0 -1
- package/node_modules/ink/build/hooks/use-paste.d.ts +0 -35
- package/node_modules/ink/build/hooks/use-paste.js +0 -62
- package/node_modules/ink/build/hooks/use-paste.js.map +0 -1
- package/node_modules/ink/build/hooks/use-window-size.d.ts +0 -18
- package/node_modules/ink/build/hooks/use-window-size.js +0 -22
- package/node_modules/ink/build/hooks/use-window-size.js.map +0 -1
- package/node_modules/wrap-ansi/index.js +0 -468
- /package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/license +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useEffect
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
2
|
import parseKeypress, { nonAlphanumericKeys } from '../parse-keypress.js';
|
|
3
3
|
import reconciler from '../reconciler.js';
|
|
4
|
-
import
|
|
4
|
+
import useStdin from './use-stdin.js';
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
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`.
|
|
6
|
+
This hook is used for handling user input. 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`.
|
|
8
7
|
|
|
9
8
|
```
|
|
10
9
|
import {useInput} from 'ink';
|
|
@@ -26,7 +25,7 @@ const UserInput = () => {
|
|
|
26
25
|
*/
|
|
27
26
|
const useInput = (inputHandler, options = {}) => {
|
|
28
27
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
29
|
-
const { setRawMode, internal_exitOnCtrlC, internal_eventEmitter } =
|
|
28
|
+
const { stdin, setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = useStdin();
|
|
30
29
|
useEffect(() => {
|
|
31
30
|
if (options.isActive === false) {
|
|
32
31
|
return;
|
|
@@ -36,91 +35,90 @@ const useInput = (inputHandler, options = {}) => {
|
|
|
36
35
|
setRawMode(false);
|
|
37
36
|
};
|
|
38
37
|
}, [options.isActive, setRawMode]);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (options.isActive === false) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const handleData = (data) => {
|
|
43
|
+
const keypress = parseKeypress(data);
|
|
44
|
+
const key = {
|
|
45
|
+
upArrow: keypress.name === 'up',
|
|
46
|
+
downArrow: keypress.name === 'down',
|
|
47
|
+
leftArrow: keypress.name === 'left',
|
|
48
|
+
rightArrow: keypress.name === 'right',
|
|
49
|
+
pageDown: keypress.name === 'pagedown',
|
|
50
|
+
pageUp: keypress.name === 'pageup',
|
|
51
|
+
home: keypress.name === 'home',
|
|
52
|
+
end: keypress.name === 'end',
|
|
53
|
+
return: keypress.name === 'return',
|
|
54
|
+
escape: keypress.name === 'escape',
|
|
55
|
+
ctrl: keypress.ctrl,
|
|
56
|
+
shift: keypress.shift,
|
|
57
|
+
tab: keypress.name === 'tab',
|
|
58
|
+
backspace: keypress.name === 'backspace',
|
|
59
|
+
delete: keypress.name === 'delete',
|
|
60
|
+
// `parseKeypress` parses \u001B\u001B[A (meta + up arrow) as meta = false
|
|
61
|
+
// but with option = true, so we need to take this into account here
|
|
62
|
+
// to avoid breaking changes in Ink.
|
|
63
|
+
// TODO(vadimdemedes): consider removing this in the next major version.
|
|
64
|
+
meta: keypress.meta || keypress.name === 'escape' || keypress.option,
|
|
65
|
+
// Kitty keyboard protocol modifiers
|
|
66
|
+
super: keypress.super ?? false,
|
|
67
|
+
hyper: keypress.hyper ?? false,
|
|
68
|
+
capsLock: keypress.capsLock ?? false,
|
|
69
|
+
numLock: keypress.numLock ?? false,
|
|
70
|
+
eventType: keypress.eventType,
|
|
71
|
+
};
|
|
72
|
+
let input;
|
|
73
|
+
if (keypress.isKittyProtocol) {
|
|
74
|
+
// Use text-as-codepoints field for printable keys (needed when
|
|
75
|
+
// reportAllKeysAsEscapeCodes flag is enabled), suppress non-printable
|
|
76
|
+
if (keypress.isPrintable) {
|
|
77
|
+
input = keypress.text ?? keypress.name;
|
|
78
|
+
}
|
|
79
|
+
else if (keypress.ctrl && keypress.name.length === 1) {
|
|
80
|
+
// Ctrl+letter via codepoint 1-26 form: not printable text, but
|
|
81
|
+
// the letter name must flow through so handlers (e.g. exitOnCtrlC
|
|
82
|
+
// checking `input === 'c' && key.ctrl`) still work.
|
|
83
|
+
input = keypress.name;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
input = '';
|
|
87
|
+
}
|
|
71
88
|
}
|
|
72
|
-
else if (keypress.ctrl
|
|
73
|
-
// Ctrl+letter via codepoint 1-26 form: not printable text, but
|
|
74
|
-
// the letter name must flow through so handlers (e.g. exitOnCtrlC
|
|
75
|
-
// checking `input === 'c' && key.ctrl`) still work.
|
|
89
|
+
else if (keypress.ctrl) {
|
|
76
90
|
input = keypress.name;
|
|
77
91
|
}
|
|
78
92
|
else {
|
|
93
|
+
input = keypress.sequence;
|
|
94
|
+
}
|
|
95
|
+
if (!keypress.isKittyProtocol &&
|
|
96
|
+
nonAlphanumericKeys.includes(keypress.name)) {
|
|
79
97
|
input = '';
|
|
80
98
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
input
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (input.length === 1 && /[A-Z]/.test(input)) {
|
|
101
|
-
key.shift = true;
|
|
102
|
-
}
|
|
103
|
-
// If app is supposed to exit on Ctrl+C, skip input listeners.
|
|
104
|
-
if (input === 'c' && key.ctrl && internal_exitOnCtrlC) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// Use discreteUpdates to assign DiscreteEventPriority to state
|
|
108
|
-
// updates from keyboard input, ensuring they are processed at the
|
|
109
|
-
// highest priority in concurrent mode.
|
|
110
|
-
// @ts-expect-error Types require 5 arguments (fn, a, b, c, d) but only fn is needed at runtime.
|
|
111
|
-
reconciler.discreteUpdates(() => {
|
|
112
|
-
inputHandler(input, key);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
useEffect(() => {
|
|
116
|
-
if (options.isActive === false) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
internal_eventEmitter.on('input', handleData);
|
|
99
|
+
// Strip meta if it's still remaining after `parseKeypress`
|
|
100
|
+
// TODO(vadimdemedes): remove this in the next major version.
|
|
101
|
+
if (input.startsWith('\u001B')) {
|
|
102
|
+
input = input.slice(1);
|
|
103
|
+
}
|
|
104
|
+
if (input.length === 1 &&
|
|
105
|
+
typeof input[0] === 'string' &&
|
|
106
|
+
/[A-Z]/.test(input[0])) {
|
|
107
|
+
key.shift = true;
|
|
108
|
+
}
|
|
109
|
+
// If app is not supposed to exit on Ctrl+C, then let input listener handle it
|
|
110
|
+
if (!(input === 'c' && key.ctrl) || !internal_exitOnCtrlC) {
|
|
111
|
+
// @ts-expect-error TypeScript types for `batchedUpdates` require an argument, but React's codebase doesn't provide it and it works without it as expected.
|
|
112
|
+
reconciler.batchedUpdates(() => {
|
|
113
|
+
inputHandler(input, key);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
internal_eventEmitter?.on('input', handleData);
|
|
120
118
|
return () => {
|
|
121
|
-
internal_eventEmitter
|
|
119
|
+
internal_eventEmitter?.removeListener('input', handleData);
|
|
122
120
|
};
|
|
123
|
-
}, [options.isActive,
|
|
121
|
+
}, [options.isActive, stdin, internal_exitOnCtrlC, inputHandler]);
|
|
124
122
|
};
|
|
125
123
|
export default useInput;
|
|
126
124
|
//# sourceMappingURL=use-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-input.js","sourceRoot":"","sources":["../../src/hooks/use-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"use-input.js","sourceRoot":"","sources":["../../src/hooks/use-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,aAAa,EAAE,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AACxE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,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E,YAAY,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
This is useful when you want to render different output for screen readers.
|
|
2
|
+
Returns whether a screen reader is enabled. This is useful when you want to render different output for screen readers.
|
|
4
3
|
*/
|
|
5
4
|
declare const useIsScreenReaderEnabled: () => boolean;
|
|
6
5
|
export default useIsScreenReaderEnabled;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { accessibilityContext } from '../components/AccessibilityContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
This is useful when you want to render different output for screen readers.
|
|
4
|
+
Returns whether a screen reader is enabled. This is useful when you want to render different output for screen readers.
|
|
6
5
|
*/
|
|
7
6
|
const useIsScreenReaderEnabled = () => {
|
|
8
7
|
const { isScreenReaderEnabled } = useContext(accessibilityContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-is-screen-reader-enabled.js","sourceRoot":"","sources":["../../src/hooks/use-is-screen-reader-enabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,EAAC,oBAAoB,EAAC,MAAM,uCAAuC,CAAC;AAE3E
|
|
1
|
+
{"version":3,"file":"use-is-screen-reader-enabled.js","sourceRoot":"","sources":["../../src/hooks/use-is-screen-reader-enabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,EAAC,oBAAoB,EAAC,MAAM,uCAAuC,CAAC;AAE3E;;EAEE;AACF,MAAM,wBAAwB,GAAG,GAAY,EAAE;IAC9C,MAAM,EAAC,qBAAqB,EAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACjE,OAAO,qBAAqB,CAAC;AAC9B,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import StderrContext from '../components/StderrContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
4
|
+
`useStderr` is a React hook that exposes the stderr stream.
|
|
5
5
|
*/
|
|
6
6
|
const useStderr = () => useContext(StderrContext);
|
|
7
7
|
export default useStderr;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { type PublicProps, type Props } from '../components/StdinContext.js';
|
|
2
1
|
/**
|
|
3
|
-
|
|
2
|
+
`useStdin` is a React hook that exposes the stdin stream.
|
|
4
3
|
*/
|
|
5
|
-
declare const useStdin: () =>
|
|
6
|
-
export declare const useStdinContext: () => Props;
|
|
4
|
+
declare const useStdin: () => import("../components/StdinContext.js").Props;
|
|
7
5
|
export default useStdin;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import StdinContext from '../components/StdinContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
4
|
+
`useStdin` is a React hook that exposes the stdin stream.
|
|
5
5
|
*/
|
|
6
6
|
const useStdin = () => useContext(StdinContext);
|
|
7
|
-
export const useStdinContext = () => useContext(StdinContext);
|
|
8
7
|
export default useStdin;
|
|
9
8
|
//# sourceMappingURL=use-stdin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stdin.js","sourceRoot":"","sources":["../../src/hooks/use-stdin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"use-stdin.js","sourceRoot":"","sources":["../../src/hooks/use-stdin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAEzD;;EAEE;AACF,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAChD,eAAe,QAAQ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
2
|
+
`useStdout` is a React hook that exposes the stdout stream where Ink renders your app.
|
|
3
3
|
*/
|
|
4
4
|
declare const useStdout: () => import("../components/StdoutContext.js").Props;
|
|
5
5
|
export default useStdout;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import StdoutContext from '../components/StdoutContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
4
|
+
`useStdout` is a React hook that exposes the stdout stream where Ink renders your app.
|
|
5
5
|
*/
|
|
6
6
|
const useStdout = () => useContext(StdoutContext);
|
|
7
7
|
export default useStdout;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _ = require("..");
|
|
11
|
+
|
|
12
|
+
var _default = inputHandler => {
|
|
13
|
+
const {
|
|
14
|
+
stdin,
|
|
15
|
+
setRawMode
|
|
16
|
+
} = (0, _react.useContext)(_.StdinContext);
|
|
17
|
+
(0, _react.useLayoutEffect)(() => {
|
|
18
|
+
setRawMode(true);
|
|
19
|
+
return () => setRawMode(false);
|
|
20
|
+
}, [setRawMode]);
|
|
21
|
+
(0, _react.useLayoutEffect)(() => {
|
|
22
|
+
const handleData = data => {
|
|
23
|
+
const input = String(data);
|
|
24
|
+
const meta = {
|
|
25
|
+
up: input === '\u001B[A',
|
|
26
|
+
down: input === '\u001B[B',
|
|
27
|
+
left: input === '\u001B[D',
|
|
28
|
+
right: input === '\u001B[C'
|
|
29
|
+
};
|
|
30
|
+
inputHandler(input, meta);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
stdin.on('data', handleData);
|
|
34
|
+
return () => stdin.off('data', handleData);
|
|
35
|
+
}, [stdin, inputHandler]);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.default = _default;
|
|
@@ -7,7 +7,7 @@ export { default as Box } from './components/Box.js';
|
|
|
7
7
|
export type { Props as TextProps } from './components/Text.js';
|
|
8
8
|
export { default as Text } from './components/Text.js';
|
|
9
9
|
export type { Props as AppProps } from './components/AppContext.js';
|
|
10
|
-
export type {
|
|
10
|
+
export type { Props as StdinProps } from './components/StdinContext.js';
|
|
11
11
|
export type { Props as StdoutProps } from './components/StdoutContext.js';
|
|
12
12
|
export type { Props as StderrProps } from './components/StderrContext.js';
|
|
13
13
|
export type { Props as StaticProps } from './components/Static.js';
|
|
@@ -19,7 +19,6 @@ export { default as Newline } from './components/Newline.js';
|
|
|
19
19
|
export { default as Spacer } from './components/Spacer.js';
|
|
20
20
|
export type { Key } from './hooks/use-input.js';
|
|
21
21
|
export { default as useInput } from './hooks/use-input.js';
|
|
22
|
-
export { default as usePaste } from './hooks/use-paste.js';
|
|
23
22
|
export { default as useApp } from './hooks/use-app.js';
|
|
24
23
|
export { default as useStdin } from './hooks/use-stdin.js';
|
|
25
24
|
export { default as useStdout } from './hooks/use-stdout.js';
|
|
@@ -28,12 +27,6 @@ export { default as useFocus } from './hooks/use-focus.js';
|
|
|
28
27
|
export { default as useFocusManager } from './hooks/use-focus-manager.js';
|
|
29
28
|
export { default as useIsScreenReaderEnabled } from './hooks/use-is-screen-reader-enabled.js';
|
|
30
29
|
export { default as useCursor } from './hooks/use-cursor.js';
|
|
31
|
-
export type { AnimationResult } from './hooks/use-animation.js';
|
|
32
|
-
export { default as useAnimation } from './hooks/use-animation.js';
|
|
33
|
-
export type { WindowSize } from './hooks/use-window-size.js';
|
|
34
|
-
export { default as useWindowSize } from './hooks/use-window-size.js';
|
|
35
|
-
export type { BoxMetrics, UseBoxMetricsResult } from './hooks/use-box-metrics.js';
|
|
36
|
-
export { default as useBoxMetrics } from './hooks/use-box-metrics.js';
|
|
37
30
|
export type { CursorPosition } from './log-update.js';
|
|
38
31
|
export { default as measureElement } from './measure-element.js';
|
|
39
32
|
export type { DOMElement } from './dom.js';
|
|
@@ -7,7 +7,6 @@ export { default as Transform } from './components/Transform.js';
|
|
|
7
7
|
export { default as Newline } from './components/Newline.js';
|
|
8
8
|
export { default as Spacer } from './components/Spacer.js';
|
|
9
9
|
export { default as useInput } from './hooks/use-input.js';
|
|
10
|
-
export { default as usePaste } from './hooks/use-paste.js';
|
|
11
10
|
export { default as useApp } from './hooks/use-app.js';
|
|
12
11
|
export { default as useStdin } from './hooks/use-stdin.js';
|
|
13
12
|
export { default as useStdout } from './hooks/use-stdout.js';
|
|
@@ -16,9 +15,6 @@ export { default as useFocus } from './hooks/use-focus.js';
|
|
|
16
15
|
export { default as useFocusManager } from './hooks/use-focus-manager.js';
|
|
17
16
|
export { default as useIsScreenReaderEnabled } from './hooks/use-is-screen-reader-enabled.js';
|
|
18
17
|
export { default as useCursor } from './hooks/use-cursor.js';
|
|
19
|
-
export { default as useAnimation } from './hooks/use-animation.js';
|
|
20
|
-
export { default as useWindowSize } from './hooks/use-window-size.js';
|
|
21
|
-
export { default as useBoxMetrics } from './hooks/use-box-metrics.js';
|
|
22
18
|
export { default as measureElement } from './measure-element.js';
|
|
23
19
|
export { kittyFlags, kittyModifiers } from './kitty-keyboard.js';
|
|
24
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAC,OAAO,IAAI,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,sBAAsB,CAAC;A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uB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAC,OAAO,IAAI,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -30,45 +30,13 @@ 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. The `concurrent` option only takes effect on the first render for a given stdout. If you need to change the rendering mode, call `unmount()` first.
|
|
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;
|
|
72
40
|
};
|
|
73
41
|
export default class Ink {
|
|
74
42
|
/**
|
|
@@ -80,9 +48,6 @@ export default class Ink {
|
|
|
80
48
|
private cursorPosition;
|
|
81
49
|
private readonly throttledLog;
|
|
82
50
|
private readonly isScreenReaderEnabled;
|
|
83
|
-
private readonly interactive;
|
|
84
|
-
private readonly renderThrottleMs;
|
|
85
|
-
private alternateScreen;
|
|
86
51
|
private isUnmounted;
|
|
87
52
|
private isUnmounting;
|
|
88
53
|
private lastOutput;
|
|
@@ -92,7 +57,7 @@ export default class Ink {
|
|
|
92
57
|
private readonly container;
|
|
93
58
|
private readonly rootNode;
|
|
94
59
|
private fullStaticOutput;
|
|
95
|
-
private
|
|
60
|
+
private exitPromise?;
|
|
96
61
|
private exitResult;
|
|
97
62
|
private beforeExitHandler?;
|
|
98
63
|
private restoreConsole?;
|
|
@@ -101,8 +66,8 @@ export default class Ink {
|
|
|
101
66
|
private hasPendingThrottledRender;
|
|
102
67
|
private kittyProtocolEnabled;
|
|
103
68
|
private cancelKittyDetection?;
|
|
104
|
-
private nextRenderCommit?;
|
|
105
69
|
constructor(options: Options);
|
|
70
|
+
getTerminalWidth: () => number;
|
|
106
71
|
resized: () => void;
|
|
107
72
|
resolveExitPromise: (result?: unknown) => void;
|
|
108
73
|
rejectExitPromise: (reason?: Error) => void;
|
|
@@ -117,18 +82,8 @@ export default class Ink {
|
|
|
117
82
|
writeToStderr(data: string): void;
|
|
118
83
|
unmount(error?: Error | number | null): void;
|
|
119
84
|
waitUntilExit(): Promise<unknown>;
|
|
120
|
-
waitUntilRenderFlush(): Promise<void>;
|
|
121
85
|
clear(): void;
|
|
122
86
|
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;
|
|
132
87
|
private initKittyKeyboard;
|
|
133
88
|
private confirmKittySupport;
|
|
134
89
|
private enableKittyProtocol;
|