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/hooks/use-focus.js
CHANGED
|
@@ -2,7 +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
|
-
A
|
|
5
|
+
A React hook that returns focus state and focus controls for the current component.
|
|
6
|
+
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.
|
|
6
7
|
*/
|
|
7
8
|
const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) => {
|
|
8
9
|
const { isRawModeSupported, setRawMode } = useStdin();
|
|
@@ -15,7 +16,7 @@ const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) =>
|
|
|
15
16
|
return () => {
|
|
16
17
|
remove(id);
|
|
17
18
|
};
|
|
18
|
-
}, [id, autoFocus]);
|
|
19
|
+
}, [id, autoFocus, add, remove]);
|
|
19
20
|
useEffect(() => {
|
|
20
21
|
if (isActive) {
|
|
21
22
|
activate(id);
|
|
@@ -23,7 +24,7 @@ const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) =>
|
|
|
23
24
|
else {
|
|
24
25
|
deactivate(id);
|
|
25
26
|
}
|
|
26
|
-
}, [isActive, id]);
|
|
27
|
+
}, [isActive, id, activate, deactivate]);
|
|
27
28
|
useEffect(() => {
|
|
28
29
|
if (!isRawModeSupported || !isActive) {
|
|
29
30
|
return;
|
|
@@ -32,7 +33,7 @@ const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) =>
|
|
|
32
33
|
return () => {
|
|
33
34
|
setRawMode(false);
|
|
34
35
|
};
|
|
35
|
-
}, [isActive]);
|
|
36
|
+
}, [isActive, isRawModeSupported, setRawMode]);
|
|
36
37
|
return {
|
|
37
38
|
isFocused: Boolean(id) && activeId === id,
|
|
38
39
|
focus,
|
|
@@ -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,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AA+BtC
|
|
1
|
+
{"version":3,"file":"use-focus.js","sourceRoot":"","sources":["../../src/hooks/use-focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAA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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,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC;IAE/C,OAAO;QACN,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,IAAI,QAAQ,KAAK,EAAE;QACzC,KAAK;KACL,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -107,7 +107,8 @@ type Options = {
|
|
|
107
107
|
isActive?: boolean;
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
|
-
|
|
110
|
+
A React hook that returns `void` and handles user input.
|
|
111
|
+
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`.
|
|
111
112
|
|
|
112
113
|
```
|
|
113
114
|
import {useInput} from 'ink';
|
package/build/hooks/use-input.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
1
|
+
import { useEffect, useEffectEvent } from 'react';
|
|
2
2
|
import parseKeypress, { nonAlphanumericKeys } from '../parse-keypress.js';
|
|
3
3
|
import reconciler from '../reconciler.js';
|
|
4
|
-
import
|
|
4
|
+
import { useStdinContext } from './use-stdin.js';
|
|
5
5
|
/**
|
|
6
|
-
|
|
6
|
+
A React hook that returns `void` and handles user input.
|
|
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`.
|
|
7
8
|
|
|
8
9
|
```
|
|
9
10
|
import {useInput} from 'ink';
|
|
@@ -25,7 +26,7 @@ const UserInput = () => {
|
|
|
25
26
|
*/
|
|
26
27
|
const useInput = (inputHandler, options = {}) => {
|
|
27
28
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
|
-
const {
|
|
29
|
+
const { setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = useStdinContext();
|
|
29
30
|
useEffect(() => {
|
|
30
31
|
if (options.isActive === false) {
|
|
31
32
|
return;
|
|
@@ -35,90 +36,91 @@ const useInput = (inputHandler, options = {}) => {
|
|
|
35
36
|
setRawMode(false);
|
|
36
37
|
};
|
|
37
38
|
}, [options.isActive, setRawMode]);
|
|
38
|
-
|
|
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
|
-
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
|
-
}
|
|
39
|
+
const handleData = useEffectEvent((data) => {
|
|
40
|
+
const keypress = parseKeypress(data);
|
|
41
|
+
const key = {
|
|
42
|
+
upArrow: keypress.name === 'up',
|
|
43
|
+
downArrow: keypress.name === 'down',
|
|
44
|
+
leftArrow: keypress.name === 'left',
|
|
45
|
+
rightArrow: keypress.name === 'right',
|
|
46
|
+
pageDown: keypress.name === 'pagedown',
|
|
47
|
+
pageUp: keypress.name === 'pageup',
|
|
48
|
+
home: keypress.name === 'home',
|
|
49
|
+
end: keypress.name === 'end',
|
|
50
|
+
return: keypress.name === 'return',
|
|
51
|
+
escape: keypress.name === 'escape',
|
|
52
|
+
ctrl: keypress.ctrl,
|
|
53
|
+
shift: keypress.shift,
|
|
54
|
+
tab: keypress.name === 'tab',
|
|
55
|
+
backspace: keypress.name === 'backspace',
|
|
56
|
+
delete: keypress.name === 'delete',
|
|
57
|
+
meta: keypress.meta,
|
|
58
|
+
// Kitty keyboard protocol modifiers
|
|
59
|
+
super: keypress.super ?? false,
|
|
60
|
+
hyper: keypress.hyper ?? false,
|
|
61
|
+
capsLock: keypress.capsLock ?? false,
|
|
62
|
+
numLock: keypress.numLock ?? false,
|
|
63
|
+
eventType: keypress.eventType,
|
|
64
|
+
};
|
|
65
|
+
let input;
|
|
66
|
+
if (keypress.isKittyProtocol) {
|
|
67
|
+
// Use text-as-codepoints field for printable keys (needed when
|
|
68
|
+
// reportAllKeysAsEscapeCodes flag is enabled), suppress non-printable
|
|
69
|
+
if (keypress.isPrintable) {
|
|
70
|
+
input = keypress.text ?? keypress.name;
|
|
88
71
|
}
|
|
89
|
-
else if (keypress.ctrl) {
|
|
72
|
+
else if (keypress.ctrl && keypress.name.length === 1) {
|
|
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.
|
|
90
76
|
input = keypress.name;
|
|
91
77
|
}
|
|
92
78
|
else {
|
|
93
|
-
input = keypress.sequence;
|
|
94
|
-
}
|
|
95
|
-
if (!keypress.isKittyProtocol &&
|
|
96
|
-
nonAlphanumericKeys.includes(keypress.name)) {
|
|
97
79
|
input = '';
|
|
98
80
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
81
|
+
}
|
|
82
|
+
else if (keypress.ctrl) {
|
|
83
|
+
// Keypress.name is guaranteed non-undefined by parseKeypress,
|
|
84
|
+
// but guard defensively since a TypeError here would crash the
|
|
85
|
+
// entire Ink app (see https://github.com/vadimdemedes/ink/issues/901).
|
|
86
|
+
input = keypress.name ?? '';
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
input = keypress.sequence;
|
|
90
|
+
}
|
|
91
|
+
if (!keypress.isKittyProtocol &&
|
|
92
|
+
nonAlphanumericKeys.includes(keypress.name)) {
|
|
93
|
+
input = '';
|
|
94
|
+
}
|
|
95
|
+
// Strip escape prefix from broken/incomplete sequences that
|
|
96
|
+
// parseKeypress did not fully resolve (e.g. a flushed "\u001B[").
|
|
97
|
+
if (input.startsWith('\u001B')) {
|
|
98
|
+
input = input.slice(1);
|
|
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);
|
|
118
120
|
return () => {
|
|
119
|
-
internal_eventEmitter
|
|
121
|
+
internal_eventEmitter.removeListener('input', handleData);
|
|
120
122
|
};
|
|
121
|
-
}, [options.isActive,
|
|
123
|
+
}, [options.isActive, internal_eventEmitter]);
|
|
122
124
|
};
|
|
123
125
|
export default useInput;
|
|
124
126
|
//# 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,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-input.js","sourceRoot":"","sources":["../../src/hooks/use-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,cAAc,EAAC,MAAM,OAAO,CAAC;AAChD,OAAO,aAAa,EAAE,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AACxE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAqI/C;;;;;;;;;;;;;;;;;;;;;EAqBE;AACF,MAAM,QAAQ,GAAG,CAAC,YAAqB,EAAE,UAAmB,EAAE,EAAE,EAAE;IACjE,gEAAgE;IAChE,MAAM,EAAC,UAAU,EAAE,oBAAoB,EAAE,qBAAqB,EAAC,GAC9D,eAAe,EAAE,CAAC;IAEnB,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK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AAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,CAAC;QAED,8DAA8D;QAC9D,IAAI,KAAK,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,IAAI,oBAAoB,EAAE,CAAC;YACvD,OAAO;QACR,CAAC;QAED,+DAA+D;QAC/D,kEAAkE;QAClE,uCAAuC;QACvC,gGAAgG;QAChG,UAAU,CAAC,eAAe,CAAC,GAAG,EAAE;YAC/B,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO;QACR,CAAC;QAED,qBAAqB,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAE9C,OAAO,GAAG,EAAE;YACX,qBAAqB,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
2
|
+
A React hook that returns whether a screen reader is enabled.
|
|
3
|
+
This is useful when you want to render different output for screen readers.
|
|
3
4
|
*/
|
|
4
5
|
declare const useIsScreenReaderEnabled: () => boolean;
|
|
5
6
|
export default useIsScreenReaderEnabled;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { accessibilityContext } from '../components/AccessibilityContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
4
|
+
A React hook that returns whether a screen reader is enabled.
|
|
5
|
+
This is useful when you want to render different output for screen readers.
|
|
5
6
|
*/
|
|
6
7
|
const useIsScreenReaderEnabled = () => {
|
|
7
8
|
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;;;EAGE;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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type Options = {
|
|
2
|
+
/**
|
|
3
|
+
Enable or disable the paste handler. Useful when multiple components use `usePaste` and only one should be active at a time.
|
|
4
|
+
|
|
5
|
+
@default true
|
|
6
|
+
*/
|
|
7
|
+
isActive?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
A React hook that calls `handler` whenever the user pastes text in the terminal. Bracketed paste mode (`\x1b[?2004h`) is automatically enabled while the hook is active, so pasted text arrives as a single string rather than being misinterpreted as individual key presses.
|
|
11
|
+
|
|
12
|
+
`usePaste` and `useInput` can be used together in the same component. They operate on separate event channels, so paste content is never forwarded to `useInput` handlers when `usePaste` is active.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
import {useInput, usePaste} from 'ink';
|
|
16
|
+
|
|
17
|
+
const MyInput = () => {
|
|
18
|
+
useInput((input, key) => {
|
|
19
|
+
// Only receives typed characters and key events, not pasted text.
|
|
20
|
+
if (key.return) {
|
|
21
|
+
// Submit
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
usePaste((text) => {
|
|
26
|
+
// Receives the full pasted string, including newlines.
|
|
27
|
+
console.log('Pasted:', text);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return …
|
|
31
|
+
};
|
|
32
|
+
```
|
|
33
|
+
*/
|
|
34
|
+
declare const usePaste: (handler: (text: string) => void, options?: Options) => void;
|
|
35
|
+
export default usePaste;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useEffect, useEffectEvent } from 'react';
|
|
2
|
+
import reconciler from '../reconciler.js';
|
|
3
|
+
import { useStdinContext } from './use-stdin.js';
|
|
4
|
+
/**
|
|
5
|
+
A React hook that calls `handler` whenever the user pastes text in the terminal. Bracketed paste mode (`\x1b[?2004h`) is automatically enabled while the hook is active, so pasted text arrives as a single string rather than being misinterpreted as individual key presses.
|
|
6
|
+
|
|
7
|
+
`usePaste` and `useInput` can be used together in the same component. They operate on separate event channels, so paste content is never forwarded to `useInput` handlers when `usePaste` is active.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
import {useInput, usePaste} from 'ink';
|
|
11
|
+
|
|
12
|
+
const MyInput = () => {
|
|
13
|
+
useInput((input, key) => {
|
|
14
|
+
// Only receives typed characters and key events, not pasted text.
|
|
15
|
+
if (key.return) {
|
|
16
|
+
// Submit
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
usePaste((text) => {
|
|
21
|
+
// Receives the full pasted string, including newlines.
|
|
22
|
+
console.log('Pasted:', text);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return …
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
*/
|
|
29
|
+
const usePaste = (handler, options = {}) => {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31
|
+
const { setRawMode, setBracketedPasteMode, internal_eventEmitter } = useStdinContext();
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (options.isActive === false) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
setRawMode(true);
|
|
37
|
+
setBracketedPasteMode(true);
|
|
38
|
+
return () => {
|
|
39
|
+
setRawMode(false);
|
|
40
|
+
setBracketedPasteMode(false);
|
|
41
|
+
};
|
|
42
|
+
}, [options.isActive, setRawMode, setBracketedPasteMode]);
|
|
43
|
+
const handlePaste = useEffectEvent((text) => {
|
|
44
|
+
// Use discreteUpdates to assign DiscreteEventPriority to state
|
|
45
|
+
// updates triggered by paste, matching the priority of useInput.
|
|
46
|
+
// @ts-expect-error Types require 5 arguments (fn, a, b, c, d) but only fn is needed at runtime.
|
|
47
|
+
reconciler.discreteUpdates(() => {
|
|
48
|
+
handler(text);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (options.isActive === false) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
internal_eventEmitter.on('paste', handlePaste);
|
|
56
|
+
return () => {
|
|
57
|
+
internal_eventEmitter.removeListener('paste', handlePaste);
|
|
58
|
+
};
|
|
59
|
+
}, [options.isActive, internal_eventEmitter]);
|
|
60
|
+
};
|
|
61
|
+
export default usePaste;
|
|
62
|
+
//# sourceMappingURL=use-paste.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-paste.js","sourceRoot":"","sources":["../../src/hooks/use-paste.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,cAAc,EAAC,MAAM,OAAO,CAAC;AAChD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAW/C;;;;;;;;;;;;;;;;;;;;;;;;EAwBE;AACF,MAAM,QAAQ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derrContext from '../components/StderrContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
4
|
+
A React hook that returns the stderr stream.
|
|
5
5
|
*/
|
|
6
6
|
const useStderr = () => useContext(StderrContext);
|
|
7
7
|
export default useStderr;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type PublicProps, type Props } from '../components/StdinContext.js';
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
+
A React hook that returns the stdin stream and stdin-related utilities.
|
|
3
4
|
*/
|
|
4
|
-
declare const useStdin: () =>
|
|
5
|
+
declare const useStdin: () => PublicProps;
|
|
6
|
+
export declare const useStdinContext: () => Props;
|
|
5
7
|
export default useStdin;
|
package/build/hooks/use-stdin.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import StdinContext from '../components/StdinContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
4
|
+
A React hook that returns the stdin stream and stdin-related utilities.
|
|
5
5
|
*/
|
|
6
6
|
const useStdin = () => useContext(StdinContext);
|
|
7
|
+
export const useStdinContext = () => useContext(StdinContext);
|
|
7
8
|
export default useStdin;
|
|
8
9
|
//# 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,YAGN,MAAM,+BAA+B,CAAC;AAEvC;;EAEE;AACF,MAAM,QAAQ,GAAG,GAAgB,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,eAAe,GAAG,GAAU,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAErE,eAAe,QAAQ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
2
|
+
A React hook that returns 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
|
+
A React hook that returns the stdout stream where Ink renders your app.
|
|
5
5
|
*/
|
|
6
6
|
const useStdout = () => useContext(StdoutContext);
|
|
7
7
|
export default useStdout;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Dimensions of the terminal window.
|
|
3
|
+
*/
|
|
4
|
+
export type WindowSize = {
|
|
5
|
+
/**
|
|
6
|
+
Number of columns (horizontal character cells).
|
|
7
|
+
*/
|
|
8
|
+
readonly columns: number;
|
|
9
|
+
/**
|
|
10
|
+
Number of rows (vertical character cells).
|
|
11
|
+
*/
|
|
12
|
+
readonly rows: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
|
|
16
|
+
*/
|
|
17
|
+
declare const useWindowSize: () => WindowSize;
|
|
18
|
+
export default useWindowSize;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { getWindowSize } from '../utils.js';
|
|
3
|
+
import useStdout from './use-stdout.js';
|
|
4
|
+
/**
|
|
5
|
+
A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
|
|
6
|
+
*/
|
|
7
|
+
const useWindowSize = () => {
|
|
8
|
+
const { stdout } = useStdout();
|
|
9
|
+
const [size, setSize] = useState(() => getWindowSize(stdout));
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const onResize = () => {
|
|
12
|
+
setSize(getWindowSize(stdout));
|
|
13
|
+
};
|
|
14
|
+
stdout.on('resize', onResize);
|
|
15
|
+
return () => {
|
|
16
|
+
stdout.off('resize', onResize);
|
|
17
|
+
};
|
|
18
|
+
}, [stdout]);
|
|
19
|
+
return size;
|
|
20
|
+
};
|
|
21
|
+
export default useWindowSize;
|
|
22
|
+
//# sourceMappingURL=use-window-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-window-size.js","sourceRoot":"","sources":["../../src/hooks/use-window-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAiBxC;;EAEE;AACF,MAAM,aAAa,GAAG,GAAe,EAAE;IACtC,MAAM,EAAC,MAAM,EAAC,GAAG,SAAS,EAAE,CAAC;IAC7B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAa,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1E,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,QAAQ,GAAG,GAAG,EAAE;YACrB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;QAChC,CAAC,CAAC;QAEF,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAE9B,OAAO,GAAG,EAAE;YACX,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAChC,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export type { RenderOptions, Instance } from './render.js';
|
|
2
2
|
export { default as render } from './render.js';
|
|
3
|
+
export type { RenderToStringOptions } from './render-to-string.js';
|
|
4
|
+
export { default as renderToString } from './render-to-string.js';
|
|
3
5
|
export type { Props as BoxProps } from './components/Box.js';
|
|
4
6
|
export { default as Box } from './components/Box.js';
|
|
5
7
|
export type { Props as TextProps } from './components/Text.js';
|
|
6
8
|
export { default as Text } from './components/Text.js';
|
|
7
9
|
export type { Props as AppProps } from './components/AppContext.js';
|
|
8
|
-
export type {
|
|
10
|
+
export type { PublicProps as StdinProps } from './components/StdinContext.js';
|
|
9
11
|
export type { Props as StdoutProps } from './components/StdoutContext.js';
|
|
10
12
|
export type { Props as StderrProps } from './components/StderrContext.js';
|
|
11
13
|
export type { Props as StaticProps } from './components/Static.js';
|
|
@@ -17,6 +19,7 @@ export { default as Newline } from './components/Newline.js';
|
|
|
17
19
|
export { default as Spacer } from './components/Spacer.js';
|
|
18
20
|
export type { Key } from './hooks/use-input.js';
|
|
19
21
|
export { default as useInput } from './hooks/use-input.js';
|
|
22
|
+
export { default as usePaste } from './hooks/use-paste.js';
|
|
20
23
|
export { default as useApp } from './hooks/use-app.js';
|
|
21
24
|
export { default as useStdin } from './hooks/use-stdin.js';
|
|
22
25
|
export { default as useStdout } from './hooks/use-stdout.js';
|
|
@@ -25,6 +28,12 @@ export { default as useFocus } from './hooks/use-focus.js';
|
|
|
25
28
|
export { default as useFocusManager } from './hooks/use-focus-manager.js';
|
|
26
29
|
export { default as useIsScreenReaderEnabled } from './hooks/use-is-screen-reader-enabled.js';
|
|
27
30
|
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';
|
|
28
37
|
export type { CursorPosition } from './log-update.js';
|
|
29
38
|
export { default as measureElement } from './measure-element.js';
|
|
30
39
|
export type { DOMElement } from './dom.js';
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as render } from './render.js';
|
|
2
|
+
export { default as renderToString } from './render-to-string.js';
|
|
2
3
|
export { default as Box } from './components/Box.js';
|
|
3
4
|
export { default as Text } from './components/Text.js';
|
|
4
5
|
export { default as Static } from './components/Static.js';
|
|
@@ -6,6 +7,7 @@ export { default as Transform } from './components/Transform.js';
|
|
|
6
7
|
export { default as Newline } from './components/Newline.js';
|
|
7
8
|
export { default as Spacer } from './components/Spacer.js';
|
|
8
9
|
export { default as useInput } from './hooks/use-input.js';
|
|
10
|
+
export { default as usePaste } from './hooks/use-paste.js';
|
|
9
11
|
export { default as useApp } from './hooks/use-app.js';
|
|
10
12
|
export { default as useStdin } from './hooks/use-stdin.js';
|
|
11
13
|
export { default as useStdout } from './hooks/use-stdout.js';
|
|
@@ -14,6 +16,9 @@ export { default as useFocus } from './hooks/use-focus.js';
|
|
|
14
16
|
export { default as useFocusManager } from './hooks/use-focus-manager.js';
|
|
15
17
|
export { default as useIsScreenReaderEnabled } from './hooks/use-is-screen-reader-enabled.js';
|
|
16
18
|
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';
|
|
17
22
|
export { default as measureElement } from './measure-element.js';
|
|
18
23
|
export { kittyFlags, kittyModifiers } from './kitty-keyboard.js';
|
|
19
24
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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