ink 6.2.2 → 6.3.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/components/AppContext.d.ts +4 -4
- package/build/components/AppContext.js +2 -2
- package/build/components/AppContext.js.map +1 -1
- package/build/components/Box.d.ts +18 -18
- package/build/components/Box.js +2 -2
- package/build/components/Box.js.map +1 -1
- package/build/components/Newline.d.ts +6 -6
- package/build/components/Newline.js +2 -2
- package/build/components/Newline.js.map +1 -1
- package/build/components/Spacer.d.ts +4 -3
- package/build/components/Spacer.js +4 -3
- package/build/components/Spacer.js.map +1 -1
- package/build/components/Static.d.ts +12 -19
- package/build/components/Static.js +6 -11
- package/build/components/Static.js.map +1 -1
- package/build/components/StderrContext.d.ts +6 -8
- package/build/components/StderrContext.js +2 -2
- package/build/components/StderrContext.js.map +1 -1
- package/build/components/StdinContext.d.ts +8 -9
- package/build/components/StdinContext.js +2 -2
- package/build/components/StdinContext.js.map +1 -1
- package/build/components/StdoutContext.d.ts +6 -8
- package/build/components/StdoutContext.js +2 -2
- package/build/components/StdoutContext.js.map +1 -1
- package/build/components/Text.d.ts +24 -26
- package/build/components/Text.js +2 -2
- package/build/components/Text.js.map +1 -1
- package/build/components/Transform.d.ts +6 -10
- package/build/components/Transform.js +2 -5
- package/build/components/Transform.js.map +1 -1
- package/build/hooks/use-app.d.ts +2 -2
- package/build/hooks/use-app.js +2 -2
- package/build/hooks/use-app.js.map +1 -1
- package/build/hooks/use-focus-manager.d.ts +12 -18
- package/build/hooks/use-focus-manager.js +2 -3
- package/build/hooks/use-focus-manager.js.map +1 -1
- package/build/hooks/use-focus.d.ts +12 -17
- package/build/hooks/use-focus.js +2 -7
- package/build/hooks/use-focus.js.map +1 -1
- package/build/hooks/use-input.d.ts +54 -58
- package/build/hooks/use-input.js +20 -23
- package/build/hooks/use-input.js.map +1 -1
- package/build/hooks/use-is-screen-reader-enabled.d.ts +2 -3
- package/build/hooks/use-is-screen-reader-enabled.js +2 -3
- package/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
- package/build/hooks/use-stderr.d.ts +2 -2
- package/build/hooks/use-stderr.js +2 -2
- package/build/hooks/use-stderr.js.map +1 -1
- package/build/hooks/use-stdin.d.ts +2 -2
- package/build/hooks/use-stdin.js +2 -2
- package/build/hooks/use-stdin.js.map +1 -1
- package/build/hooks/use-stdout.d.ts +2 -2
- package/build/hooks/use-stdout.js +2 -2
- package/build/hooks/use-stdout.js.map +1 -1
- package/build/ink.d.ts +1 -0
- package/build/ink.js +3 -1
- package/build/ink.js.map +1 -1
- package/build/measure-element.d.ts +6 -6
- package/build/measure-element.js +2 -2
- package/build/measure-element.js.map +1 -1
- package/build/options.d.ts +52 -0
- package/build/options.js +2 -0
- package/build/options.js.map +1 -0
- package/build/output.d.ts +6 -7
- package/build/output.js.map +1 -1
- package/build/render-node-to-output.js +1 -3
- package/build/render-node-to-output.js.map +1 -1
- package/build/render.d.ts +45 -38
- package/build/render.js +3 -2
- package/build/render.js.map +1 -1
- package/build/styles.d.ts +132 -141
- package/build/styles.js.map +1 -1
- package/package.json +2 -4
- package/readme.md +154 -153
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import { type Props } from '../components/FocusContext.js';
|
|
2
2
|
type Output = {
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
Enable focus management for all components.
|
|
5
|
+
*/
|
|
6
6
|
enableFocus: Props['enableFocus'];
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Disable focus management for all components. The currently active component (if there's one) will lose its focus.
|
|
9
|
+
*/
|
|
10
10
|
disableFocus: Props['disableFocus'];
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* If active component is the last in the list of focusable components, focus will be switched to the first component.
|
|
15
|
-
*/
|
|
12
|
+
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.
|
|
13
|
+
*/
|
|
16
14
|
focusNext: Props['focusNext'];
|
|
17
15
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* If active component is the first in the list of focusable components, focus will be switched to the last component.
|
|
21
|
-
*/
|
|
16
|
+
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.
|
|
17
|
+
*/
|
|
22
18
|
focusPrevious: Props['focusPrevious'];
|
|
23
19
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*/
|
|
20
|
+
Switch focus to the element with provided `id`. If there's no element with that `id`, focus will be given to the first focusable component.
|
|
21
|
+
*/
|
|
27
22
|
focus: Props['focus'];
|
|
28
23
|
};
|
|
29
24
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*/
|
|
25
|
+
This hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.
|
|
26
|
+
*/
|
|
33
27
|
declare const useFocusManager: () => Output;
|
|
34
28
|
export default useFocusManager;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import FocusContext from '../components/FocusContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
4
|
+
This hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.
|
|
5
|
+
*/
|
|
7
6
|
const useFocusManager = () => {
|
|
8
7
|
const focusContext = useContext(FocusContext);
|
|
9
8
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus-manager.js","sourceRoot":"","sources":["../../src/hooks/use-focus-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,YAA0B,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-focus-manager.js","sourceRoot":"","sources":["../../src/hooks/use-focus-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,YAA0B,MAAM,+BAA+B,CAAC;AA6BvE;;EAEE;AACF,MAAM,eAAe,GAAG,GAAW,EAAE;IACpC,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAE9C,OAAO;QACN,WAAW,EAAE,YAAY,CAAC,WAAW;QACrC,YAAY,EAAE,YAAY,CAAC,YAAY;QACvC,SAAS,EAAE,YAAY,CAAC,SAAS;QACjC,aAAa,EAAE,YAAY,CAAC,aAAa;QACzC,KAAK,EAAE,YAAY,CAAC,KAAK;KACzB,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
type Input = {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Enable or disable this component's focus, while still maintaining its position in the list of focusable components.
|
|
4
|
+
*/
|
|
5
5
|
isActive?: boolean;
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Auto-focus this component if there's no active (focused) component right now.
|
|
8
|
+
*/
|
|
9
9
|
autoFocus?: boolean;
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Assign an ID to this component, so it can be programmatically focused with `focus(id)`.
|
|
12
|
+
*/
|
|
13
13
|
id?: string;
|
|
14
14
|
};
|
|
15
15
|
type Output = {
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
Determines whether this component is focused.
|
|
18
|
+
*/
|
|
19
19
|
isFocused: boolean;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
Allows focusing a specific element with the provided `id`.
|
|
22
|
+
*/
|
|
23
23
|
focus: (id: string) => void;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* If there are multiple components that execute `useFocus` hook, focus will be
|
|
29
|
-
* given to them in the order that these components are rendered in.
|
|
30
|
-
* This hook returns an object with `isFocused` boolean property, which
|
|
31
|
-
* determines if this component is focused or not.
|
|
32
|
-
*/
|
|
26
|
+
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. This hook returns an object with an `isFocused` boolean property, which determines whether this component is focused.
|
|
27
|
+
*/
|
|
33
28
|
declare const useFocus: ({ isActive, autoFocus, id: customId, }?: Input) => Output;
|
|
34
29
|
export default useFocus;
|
package/build/hooks/use-focus.js
CHANGED
|
@@ -2,13 +2,8 @@ import { useEffect, useContext, useMemo } from 'react';
|
|
|
2
2
|
import FocusContext from '../components/FocusContext.js';
|
|
3
3
|
import useStdin from './use-stdin.js';
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* If there are multiple components that execute `useFocus` hook, focus will be
|
|
8
|
-
* given to them in the order that these components are rendered in.
|
|
9
|
-
* This hook returns an object with `isFocused` boolean property, which
|
|
10
|
-
* determines if this component is focused or not.
|
|
11
|
-
*/
|
|
5
|
+
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. This hook returns an object with an `isFocused` boolean property, which determines whether this component is focused.
|
|
6
|
+
*/
|
|
12
7
|
const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) => {
|
|
13
8
|
const { isRawModeSupported, setRawMode } = useStdin();
|
|
14
9
|
const { activeId, add, remove, activate, deactivate, focus } = useContext(FocusContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus.js","sourceRoot":"","sources":["../../src/hooks/use-focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AACrD,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,O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EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAEnB,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,kBAAkB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtC,OAAO;QACR,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,CAAC;QAEjB,OAAO,GAAG,EAAE;YACX,UAAU,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO;QACN,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,IAAI,QAAQ,KAAK,EAAE;QACzC,KAAK;KACL,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,97 +1,93 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Handy information about a key that was pressed.
|
|
3
|
+
*/
|
|
4
4
|
export type Key = {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Up arrow key was pressed.
|
|
7
|
+
*/
|
|
8
8
|
upArrow: boolean;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Down arrow key was pressed.
|
|
11
|
+
*/
|
|
12
12
|
downArrow: boolean;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Left arrow key was pressed.
|
|
15
|
+
*/
|
|
16
16
|
leftArrow: boolean;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
Right arrow key was pressed.
|
|
19
|
+
*/
|
|
20
20
|
rightArrow: boolean;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Page Down key was pressed.
|
|
23
|
+
*/
|
|
24
24
|
pageDown: boolean;
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
Page Up key was pressed.
|
|
27
|
+
*/
|
|
28
28
|
pageUp: boolean;
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
Return (Enter) key was pressed.
|
|
31
|
+
*/
|
|
32
32
|
return: boolean;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
Escape key was pressed.
|
|
35
|
+
*/
|
|
36
36
|
escape: boolean;
|
|
37
37
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
Ctrl key was pressed.
|
|
39
|
+
*/
|
|
40
40
|
ctrl: boolean;
|
|
41
41
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
Shift key was pressed.
|
|
43
|
+
*/
|
|
44
44
|
shift: boolean;
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
Tab key was pressed.
|
|
47
|
+
*/
|
|
48
48
|
tab: boolean;
|
|
49
49
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Backspace key was pressed.
|
|
51
|
+
*/
|
|
52
52
|
backspace: boolean;
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
Delete key was pressed.
|
|
55
|
+
*/
|
|
56
56
|
delete: boolean;
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.
|
|
59
|
+
*/
|
|
60
60
|
meta: boolean;
|
|
61
61
|
};
|
|
62
62
|
type Handler = (input: string, key: Key) => void;
|
|
63
63
|
type Options = {
|
|
64
64
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*/
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
@default true
|
|
68
|
+
*/
|
|
70
69
|
isActive?: boolean;
|
|
71
70
|
};
|
|
72
71
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
* };
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
72
|
+
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`.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
import {useInput} from 'ink';
|
|
76
|
+
|
|
77
|
+
const UserInput = () => {
|
|
78
|
+
useInput((input, key) => {
|
|
79
|
+
if (input === 'q') {
|
|
80
|
+
// Exit program
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (key.leftArrow) {
|
|
84
|
+
// Left arrow key pressed
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return …
|
|
89
|
+
};
|
|
90
|
+
```
|
|
91
|
+
*/
|
|
96
92
|
declare const useInput: (inputHandler: Handler, options?: Options) => void;
|
|
97
93
|
export default useInput;
|
package/build/hooks/use-input.js
CHANGED
|
@@ -3,29 +3,26 @@ import parseKeypress, { nonAlphanumericKeys } from '../parse-keypress.js';
|
|
|
3
3
|
import reconciler from '../reconciler.js';
|
|
4
4
|
import useStdin from './use-stdin.js';
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* };
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
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`.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
import {useInput} from 'ink';
|
|
10
|
+
|
|
11
|
+
const UserInput = () => {
|
|
12
|
+
useInput((input, key) => {
|
|
13
|
+
if (input === 'q') {
|
|
14
|
+
// Exit program
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (key.leftArrow) {
|
|
18
|
+
// Left arrow key pressed
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return …
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
*/
|
|
29
26
|
const useInput = (inputHandler, options = {}) => {
|
|
30
27
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31
28
|
const { stdin, setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = useStdin();
|
|
@@ -1 +1 @@
|
|
|
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,OAAO,QAAQ,MAAM,gBAAgB,CAAC;
|
|
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,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAwFtC;;;;;;;;;;;;;;;;;;;;EAoBE;AACF,MAAM,QAAQ,G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AE,UAAU,CAAC,CAAC;QAE/C,OAAO,GAAG,EAAE;YACX,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC5D,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,EAAE,YAAY,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
2
|
+
Returns whether a screen reader is enabled. This is useful when you want to render different output for screen readers.
|
|
3
|
+
*/
|
|
5
4
|
declare const useIsScreenReaderEnabled: () => boolean;
|
|
6
5
|
export default useIsScreenReaderEnabled;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { accessibilityContext } from '../components/AccessibilityContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
4
|
+
Returns whether a screen reader is enabled. This is useful when you want to render different output for screen readers.
|
|
5
|
+
*/
|
|
7
6
|
const useIsScreenReaderEnabled = () => {
|
|
8
7
|
const { isScreenReaderEnabled } = useContext(accessibilityContext);
|
|
9
8
|
return isScreenReaderEnabled;
|
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import StderrContext from '../components/StderrContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
`useStderr` is a React hook that exposes the stderr stream.
|
|
5
|
+
*/
|
|
6
6
|
const useStderr = () => useContext(StderrContext);
|
|
7
7
|
export default useStderr;
|
|
8
8
|
//# sourceMappingURL=use-stderr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stderr.js","sourceRoot":"","sources":["../../src/hooks/use-stderr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAE3D;;
|
|
1
|
+
{"version":3,"file":"use-stderr.js","sourceRoot":"","sources":["../../src/hooks/use-stderr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAE3D;;EAEE;AACF,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClD,eAAe,SAAS,CAAC"}
|
package/build/hooks/use-stdin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import StdinContext from '../components/StdinContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
`useStdin` is a React hook that exposes the stdin stream.
|
|
5
|
+
*/
|
|
6
6
|
const useStdin = () => useContext(StdinContext);
|
|
7
7
|
export default useStdin;
|
|
8
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,YAAY,MAAM,+BAA+B,CAAC;AAEzD;;
|
|
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
|
-
|
|
3
|
-
|
|
2
|
+
`useStdout` is a React hook that exposes the stdout stream where Ink renders your app.
|
|
3
|
+
*/
|
|
4
4
|
declare const useStdout: () => import("../components/StdoutContext.js").Props;
|
|
5
5
|
export default useStdout;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import StdoutContext from '../components/StdoutContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
`useStdout` is a React hook that exposes the stdout stream where Ink renders your app.
|
|
5
|
+
*/
|
|
6
6
|
const useStdout = () => useContext(StdoutContext);
|
|
7
7
|
export default useStdout;
|
|
8
8
|
//# sourceMappingURL=use-stdout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stdout.js","sourceRoot":"","sources":["../../src/hooks/use-stdout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAE3D;;
|
|
1
|
+
{"version":3,"file":"use-stdout.js","sourceRoot":"","sources":["../../src/hooks/use-stdout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAE3D;;EAEE;AACF,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClD,eAAe,SAAS,CAAC"}
|
package/build/ink.d.ts
CHANGED
package/build/ink.js
CHANGED
|
@@ -43,9 +43,11 @@ export default class Ink {
|
|
|
43
43
|
options.isScreenReaderEnabled ??
|
|
44
44
|
process.env['INK_SCREEN_READER'] === 'true';
|
|
45
45
|
const unthrottled = options.debug || this.isScreenReaderEnabled;
|
|
46
|
+
const maxFps = options.maxFps ?? 30;
|
|
47
|
+
const renderThrottleMs = maxFps > 0 ? Math.max(1, Math.ceil(1000 / maxFps)) : 0;
|
|
46
48
|
this.rootNode.onRender = unthrottled
|
|
47
49
|
? this.onRender
|
|
48
|
-
: throttle(this.onRender,
|
|
50
|
+
: throttle(this.onRender, renderThrottleMs, {
|
|
49
51
|
leading: true,
|
|
50
52
|
trailing: true,
|
|
51
53
|
});
|
package/build/ink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink.js","sourceRoot":"","sources":["../src/ink.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,+BAA+B,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
10
|
height: number;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
Measure the dimensions of a particular `<Box>` element.
|
|
14
|
+
*/
|
|
15
15
|
declare const measureElement: (node: DOMElement) => Output;
|
|
16
16
|
export default measureElement;
|
package/build/measure-element.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Measure the dimensions of a particular `<Box>` element.
|
|
3
|
+
*/
|
|
4
4
|
const measureElement = (node) => ({
|
|
5
5
|
width: node.yogaNode?.getComputedWidth() ?? 0,
|
|
6
6
|
height: node.yogaNode?.getComputedHeight() ?? 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure-element.js","sourceRoot":"","sources":["../src/measure-element.ts"],"names":[],"mappings":"AAcA;;
|
|
1
|
+
{"version":3,"file":"measure-element.js","sourceRoot":"","sources":["../src/measure-element.ts"],"names":[],"mappings":"AAcA;;EAEE;AACF,MAAM,cAAc,GAAG,CAAC,IAAgB,EAAU,EAAE,CAAC,CAAC;IACrD,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC;IAC7C,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;CAC/C,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type CommonOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Output stream where app will be rendered.
|
|
4
|
+
*
|
|
5
|
+
* @default process.stdout
|
|
6
|
+
*/
|
|
7
|
+
stdout?: NodeJS.WriteStream;
|
|
8
|
+
/**
|
|
9
|
+
* Input stream where app will listen for input.
|
|
10
|
+
*
|
|
11
|
+
* @default process.stdin
|
|
12
|
+
*/
|
|
13
|
+
stdin?: NodeJS.ReadStream;
|
|
14
|
+
/**
|
|
15
|
+
* Error stream.
|
|
16
|
+
* @default process.stderr
|
|
17
|
+
*/
|
|
18
|
+
stderr?: NodeJS.WriteStream;
|
|
19
|
+
/**
|
|
20
|
+
* If true, each update will be rendered as a separate output, without replacing the previous one.
|
|
21
|
+
*
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
debug?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Configure whether Ink should listen to 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 process is expected to handle it manually.
|
|
27
|
+
*
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
exitOnCtrlC?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Patch console methods to ensure console output doesn't mix with Ink output.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
patchConsole?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Enable screen reader support.
|
|
39
|
+
* See https://github.com/vadimdemedes/ink/blob/master/readme.md#screen-reader-support
|
|
40
|
+
*
|
|
41
|
+
* @default process.env['INK_SCREEN_READER'] === 'true'
|
|
42
|
+
*/
|
|
43
|
+
isScreenReaderEnabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Maximum frames per second for render updates.
|
|
46
|
+
* This controls how frequently the UI can update to prevent excessive re-rendering.
|
|
47
|
+
* Higher values allow more frequent updates but may impact performance.
|
|
48
|
+
*
|
|
49
|
+
* @default 30
|
|
50
|
+
*/
|
|
51
|
+
maxFps?: number;
|
|
52
|
+
};
|