ink 3.2.0 → 4.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/colorize.d.ts +3 -3
- package/build/colorize.js +30 -35
- package/build/colorize.js.map +1 -1
- package/build/components/App.d.ts +12 -12
- package/build/components/App.js +287 -208
- package/build/components/App.js.map +1 -1
- package/build/components/AppContext.d.ts +2 -2
- package/build/components/AppContext.js +5 -6
- package/build/components/AppContext.js.map +1 -1
- package/build/components/Box.d.ts +5 -5
- package/build/components/Box.js +15 -38
- package/build/components/Box.js.map +1 -1
- package/build/components/ErrorOverview.d.ts +5 -5
- package/build/components/ErrorOverview.js +40 -58
- package/build/components/ErrorOverview.js.map +1 -1
- package/build/components/FocusContext.d.ts +2 -2
- package/build/components/FocusContext.js +13 -14
- package/build/components/FocusContext.js.map +1 -1
- package/build/components/Newline.d.ts +4 -5
- package/build/components/Newline.js +4 -9
- package/build/components/Newline.js.map +1 -1
- package/build/components/Spacer.d.ts +2 -3
- package/build/components/Spacer.js +5 -10
- package/build/components/Spacer.js.map +1 -1
- package/build/components/Static.d.ts +5 -9
- package/build/components/Static.js +12 -33
- package/build/components/Static.js.map +1 -1
- package/build/components/StderrContext.d.ts +4 -4
- package/build/components/StderrContext.js +7 -7
- package/build/components/StderrContext.js.map +1 -1
- package/build/components/StdinContext.d.ts +4 -4
- package/build/components/StdinContext.js +8 -7
- package/build/components/StdinContext.js.map +1 -1
- package/build/components/StdoutContext.d.ts +4 -4
- package/build/components/StdoutContext.js +7 -7
- package/build/components/StdoutContext.js.map +1 -1
- package/build/components/Text.d.ts +9 -10
- package/build/components/Text.js +14 -29
- package/build/components/Text.js.map +1 -1
- package/build/components/Transform.d.ts +4 -5
- package/build/components/Transform.js +4 -11
- package/build/components/Transform.js.map +1 -1
- package/build/devtools-window-polyfill.js +3 -8
- package/build/devtools-window-polyfill.js.map +1 -1
- package/build/devtools.d.ts +1 -1
- package/build/devtools.js +6 -6
- package/build/devtools.js.map +1 -1
- package/build/dom.d.ts +14 -17
- package/build/dom.js +34 -47
- package/build/dom.js.map +1 -1
- package/build/get-max-width.d.ts +2 -2
- package/build/get-max-width.js +7 -11
- package/build/get-max-width.js.map +1 -1
- package/build/hooks/use-app.d.ts +1 -1
- package/build/hooks/use-app.js +4 -9
- package/build/hooks/use-app.js.map +1 -1
- package/build/hooks/use-focus-manager.d.ts +3 -3
- package/build/hooks/use-focus-manager.js +4 -9
- package/build/hooks/use-focus-manager.js.map +1 -1
- package/build/hooks/use-focus.d.ts +4 -4
- package/build/hooks/use-focus.js +11 -16
- package/build/hooks/use-focus.js.map +1 -1
- package/build/hooks/use-input.d.ts +5 -5
- package/build/hooks/use-input.js +13 -14
- package/build/hooks/use-input.js.map +1 -1
- package/build/hooks/use-stderr.d.ts +1 -1
- package/build/hooks/use-stderr.js +4 -9
- package/build/hooks/use-stderr.js.map +1 -1
- package/build/hooks/use-stdin.d.ts +1 -1
- package/build/hooks/use-stdin.js +4 -9
- package/build/hooks/use-stdin.js.map +1 -1
- package/build/hooks/use-stdout.d.ts +1 -1
- package/build/hooks/use-stdout.js +4 -9
- package/build/hooks/use-stdout.js.map +1 -1
- package/build/index.d.ts +27 -20
- package/build/index.js +15 -32
- package/build/index.js.map +1 -1
- package/build/ink.d.ts +4 -4
- package/build/ink.js +165 -98
- package/build/ink.js.map +1 -1
- package/build/instances.d.ts +4 -2
- package/build/instances.js +2 -3
- package/build/instances.js.map +1 -1
- package/build/log-update.d.ts +5 -6
- package/build/log-update.js +8 -12
- package/build/log-update.js.map +1 -1
- package/build/measure-element.d.ts +5 -5
- package/build/measure-element.js +5 -9
- package/build/measure-element.js.map +1 -1
- package/build/measure-text.d.ts +4 -4
- package/build/measure-text.js +7 -10
- package/build/measure-text.js.map +1 -1
- package/build/output.d.ts +3 -3
- package/build/output.js +25 -15
- package/build/output.js.map +1 -1
- package/build/reconciler.d.ts +1 -1
- package/build/reconciler.js +97 -76
- package/build/reconciler.js.map +1 -1
- package/build/render-border.d.ts +4 -4
- package/build/render-border.js +8 -12
- package/build/render-border.js.map +1 -1
- package/build/render-node-to-output.d.ts +3 -3
- package/build/render-node-to-output.js +17 -24
- package/build/render-node-to-output.js.map +1 -1
- package/build/render.d.ts +8 -8
- package/build/render.js +23 -20
- package/build/render.js.map +1 -1
- package/build/renderer.d.ts +5 -5
- package/build/renderer.js +11 -16
- package/build/renderer.js.map +1 -1
- package/build/squash-text-nodes.d.ts +1 -1
- package/build/squash-text-nodes.js +1 -3
- package/build/squash-text-nodes.js.map +1 -1
- package/build/styles.d.ts +9 -9
- package/build/styles.js +39 -45
- package/build/styles.js.map +1 -1
- package/build/wrap-text.d.ts +3 -3
- package/build/wrap-text.js +9 -12
- package/build/wrap-text.js.map +1 -1
- package/license +1 -1
- package/package.json +86 -66
- package/readme.md +91 -49
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const FocusContext_1 = __importDefault(require("../components/FocusContext"));
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import FocusContext from '../components/FocusContext.js';
|
|
8
3
|
/**
|
|
9
4
|
* This hook exposes methods to enable or disable focus management for all
|
|
10
5
|
* components or manually switch focus to next or previous components.
|
|
11
6
|
*/
|
|
12
7
|
const useFocusManager = () => {
|
|
13
|
-
const focusContext =
|
|
8
|
+
const focusContext = useContext(FocusContext);
|
|
14
9
|
return {
|
|
15
10
|
enableFocus: focusContext.enableFocus,
|
|
16
11
|
disableFocus: focusContext.disableFocus,
|
|
@@ -19,5 +14,5 @@ const useFocusManager = () => {
|
|
|
19
14
|
focus: focusContext.focus
|
|
20
15
|
};
|
|
21
16
|
};
|
|
22
|
-
|
|
17
|
+
export default useFocusManager;
|
|
23
18
|
//# sourceMappingURL=use-focus-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus-manager.js","sourceRoot":"","sources":["../../src/hooks/use-focus-manager.ts"],"names":[],"mappings":"
|
|
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;AAkCvE;;;GAGG;AACH,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,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type Input = {
|
|
2
2
|
/**
|
|
3
3
|
* Enable or disable this component's focus, while still maintaining its position in the list of focusable components.
|
|
4
4
|
*/
|
|
@@ -11,8 +11,8 @@ interface Input {
|
|
|
11
11
|
* Assign an ID to this component, so it can be programmatically focused with `focus(id)`.
|
|
12
12
|
*/
|
|
13
13
|
id?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
14
|
+
};
|
|
15
|
+
type Output = {
|
|
16
16
|
/**
|
|
17
17
|
* Determines whether this component is focused or not.
|
|
18
18
|
*/
|
|
@@ -21,7 +21,7 @@ interface Output {
|
|
|
21
21
|
* Allows focusing a specific element with the provided `id`.
|
|
22
22
|
*/
|
|
23
23
|
focus: (id: string) => void;
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
25
|
/**
|
|
26
26
|
* Component that uses `useFocus` hook becomes "focusable" to Ink,
|
|
27
27
|
* so when user presses <kbd>Tab</kbd>, Ink will switch focus to this component.
|
package/build/hooks/use-focus.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const FocusContext_1 = __importDefault(require("../components/FocusContext"));
|
|
8
|
-
const use_stdin_1 = __importDefault(require("./use-stdin"));
|
|
1
|
+
import { useEffect, useContext, useMemo } from 'react';
|
|
2
|
+
import FocusContext from '../components/FocusContext.js';
|
|
3
|
+
import useStdin from './use-stdin.js';
|
|
9
4
|
/**
|
|
10
5
|
* Component that uses `useFocus` hook becomes "focusable" to Ink,
|
|
11
6
|
* so when user presses <kbd>Tab</kbd>, Ink will switch focus to this component.
|
|
@@ -15,18 +10,18 @@ const use_stdin_1 = __importDefault(require("./use-stdin"));
|
|
|
15
10
|
* determines if this component is focused or not.
|
|
16
11
|
*/
|
|
17
12
|
const useFocus = ({ isActive = true, autoFocus = false, id: customId } = {}) => {
|
|
18
|
-
const { isRawModeSupported, setRawMode } =
|
|
19
|
-
const { activeId, add, remove, activate, deactivate, focus } =
|
|
20
|
-
const id =
|
|
21
|
-
return customId
|
|
13
|
+
const { isRawModeSupported, setRawMode } = useStdin();
|
|
14
|
+
const { activeId, add, remove, activate, deactivate, focus } = useContext(FocusContext);
|
|
15
|
+
const id = useMemo(() => {
|
|
16
|
+
return customId ?? Math.random().toString().slice(2, 7);
|
|
22
17
|
}, [customId]);
|
|
23
|
-
|
|
18
|
+
useEffect(() => {
|
|
24
19
|
add(id, { autoFocus });
|
|
25
20
|
return () => {
|
|
26
21
|
remove(id);
|
|
27
22
|
};
|
|
28
23
|
}, [id, autoFocus]);
|
|
29
|
-
|
|
24
|
+
useEffect(() => {
|
|
30
25
|
if (isActive) {
|
|
31
26
|
activate(id);
|
|
32
27
|
}
|
|
@@ -34,7 +29,7 @@ const useFocus = ({ isActive = true, autoFocus = false, id: customId } = {}) =>
|
|
|
34
29
|
deactivate(id);
|
|
35
30
|
}
|
|
36
31
|
}, [isActive, id]);
|
|
37
|
-
|
|
32
|
+
useEffect(() => {
|
|
38
33
|
if (!isRawModeSupported || !isActive) {
|
|
39
34
|
return;
|
|
40
35
|
}
|
|
@@ -48,5 +43,5 @@ const useFocus = ({ isActive = true, autoFocus = false, id: customId } = {}) =>
|
|
|
48
43
|
focus
|
|
49
44
|
};
|
|
50
45
|
};
|
|
51
|
-
|
|
46
|
+
export default useFocus;
|
|
52
47
|
//# sourceMappingURL=use-focus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus.js","sourceRoot":"","sources":["../../src/hooks/use-focus.ts"],"names":[],"mappings":"
|
|
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;;;;;;;GAOG;AACH,MAAM,QAAQ,GAAG,CAAC,EACjB,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,KAAK,EACjB,EAAE,EAAE,QAAQ,KACF,EAAE,EAAU,EAAE;IACxB,MAAM,EAAC,kBAAkB,EAAE,UAAU,EAAC,GAAG,QAAQ,EAAE,CAAC;IACpD,MAAM,EAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAC,GACzD,UAAU,CAAC,YAAY,CAAC,CAAC;IAE1B,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;QACvB,OAAO,QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,SAAS,CAAC,GAAG,EAAE;QACd,GAAG,CAAC,EAAE,EAAE,EAAC,SAAS,EAAC,CAAC,CAAC;QAErB,OAAO,GAAG,EAAE;YACX,MAAM,CAAC,EAAE,CAAC,CAAC;QACZ,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;IAEpB,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,QAAQ,EAAE;YACb,QAAQ,CAAC,EAAE,CAAC,CAAC;SACb;aAAM;YACN,UAAU,CAAC,EAAE,CAAC,CAAC;SACf;IACF,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAEnB,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,kBAAkB,IAAI,CAAC,QAAQ,EAAE;YACrC,OAAO;SACP;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,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Handy information about a key that was pressed.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Key = {
|
|
5
5
|
/**
|
|
6
6
|
* Up arrow key was pressed.
|
|
7
7
|
*/
|
|
@@ -58,9 +58,9 @@ export interface Key {
|
|
|
58
58
|
* [Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.
|
|
59
59
|
*/
|
|
60
60
|
meta: boolean;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
};
|
|
62
|
+
type Handler = (input: string, key: Key) => void;
|
|
63
|
+
type Options = {
|
|
64
64
|
/**
|
|
65
65
|
* Enable or disable capturing of user input.
|
|
66
66
|
* Useful when there are multiple useInput hooks used at once to avoid handling the same input several times.
|
|
@@ -68,7 +68,7 @@ interface Options {
|
|
|
68
68
|
* @default true
|
|
69
69
|
*/
|
|
70
70
|
isActive?: boolean;
|
|
71
|
-
}
|
|
71
|
+
};
|
|
72
72
|
/**
|
|
73
73
|
* This hook is used for handling user input.
|
|
74
74
|
* It's a more convenient alternative to using `StdinContext` and listening to `data` events.
|
package/build/hooks/use-input.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const use_stdin_1 = __importDefault(require("./use-stdin"));
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import useStdin from './use-stdin.js';
|
|
8
3
|
/**
|
|
9
4
|
* This hook is used for handling user input.
|
|
10
5
|
* It's a more convenient alternative to using `StdinContext` and listening to `data` events.
|
|
@@ -30,8 +25,9 @@ const use_stdin_1 = __importDefault(require("./use-stdin"));
|
|
|
30
25
|
* ```
|
|
31
26
|
*/
|
|
32
27
|
const useInput = (inputHandler, options = {}) => {
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
29
|
+
const { stdin, setRawMode, internal_exitOnCtrlC } = useStdin();
|
|
30
|
+
useEffect(() => {
|
|
35
31
|
if (options.isActive === false) {
|
|
36
32
|
return;
|
|
37
33
|
}
|
|
@@ -40,7 +36,7 @@ const useInput = (inputHandler, options = {}) => {
|
|
|
40
36
|
setRawMode(false);
|
|
41
37
|
};
|
|
42
38
|
}, [options.isActive, setRawMode]);
|
|
43
|
-
|
|
39
|
+
useEffect(() => {
|
|
44
40
|
if (options.isActive === false) {
|
|
45
41
|
return;
|
|
46
42
|
}
|
|
@@ -64,7 +60,10 @@ const useInput = (inputHandler, options = {}) => {
|
|
|
64
60
|
};
|
|
65
61
|
// Copied from `keypress` module
|
|
66
62
|
if (input <= '\u001A' && !key.return) {
|
|
67
|
-
|
|
63
|
+
// eslint-disable-next-line unicorn/prefer-code-point
|
|
64
|
+
input = String.fromCharCode(
|
|
65
|
+
// eslint-disable-next-line unicorn/prefer-code-point
|
|
66
|
+
input.charCodeAt(0) + 'a'.charCodeAt(0) - 1);
|
|
68
67
|
key.ctrl = true;
|
|
69
68
|
}
|
|
70
69
|
if (input.startsWith('\u001B')) {
|
|
@@ -88,11 +87,11 @@ const useInput = (inputHandler, options = {}) => {
|
|
|
88
87
|
inputHandler(input, key);
|
|
89
88
|
}
|
|
90
89
|
};
|
|
91
|
-
stdin
|
|
90
|
+
stdin?.on('data', handleData);
|
|
92
91
|
return () => {
|
|
93
|
-
stdin
|
|
92
|
+
stdin?.off('data', handleData);
|
|
94
93
|
};
|
|
95
94
|
}, [options.isActive, stdin, internal_exitOnCtrlC, inputHandler]);
|
|
96
95
|
};
|
|
97
|
-
|
|
96
|
+
export default useInput;
|
|
98
97
|
//# sourceMappingURL=use-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-input.js","sourceRoot":"","sources":["../../src/hooks/use-input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-input.js","sourceRoot":"","sources":["../../src/hooks/use-input.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAyFtC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,QAAQ,GAAG,CAAC,YAAqB,EAAE,UAAmB,EAAE,EAAE,EAAE;IACjE,gEAAgE;IAChE,MAAM,EAAC,KAAK,EAAE,UAAU,E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H,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,EAAE,YAAY,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const StderrContext_1 = __importDefault(require("../components/StderrContext"));
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import StderrContext from '../components/StderrContext.js';
|
|
8
3
|
/**
|
|
9
4
|
* `useStderr` is a React hook, which exposes stderr stream.
|
|
10
5
|
*/
|
|
11
|
-
const useStderr = () =>
|
|
12
|
-
|
|
6
|
+
const useStderr = () => useContext(StderrContext);
|
|
7
|
+
export default useStderr;
|
|
13
8
|
//# sourceMappingURL=use-stderr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stderr.js","sourceRoot":"","sources":["../../src/hooks/use-stderr.ts"],"names":[],"mappings":"
|
|
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;;GAEG;AACH,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClD,eAAe,SAAS,CAAC"}
|
package/build/hooks/use-stdin.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const StdinContext_1 = __importDefault(require("../components/StdinContext"));
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import StdinContext from '../components/StdinContext.js';
|
|
8
3
|
/**
|
|
9
4
|
* `useStdin` is a React hook, which exposes stdin stream.
|
|
10
5
|
*/
|
|
11
|
-
const useStdin = () =>
|
|
12
|
-
|
|
6
|
+
const useStdin = () => useContext(StdinContext);
|
|
7
|
+
export default useStdin;
|
|
13
8
|
//# sourceMappingURL=use-stdin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stdin.js","sourceRoot":"","sources":["../../src/hooks/use-stdin.ts"],"names":[],"mappings":"
|
|
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;;GAEG;AACH,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAChD,eAAe,QAAQ,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const StdoutContext_1 = __importDefault(require("../components/StdoutContext"));
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import StdoutContext from '../components/StdoutContext.js';
|
|
8
3
|
/**
|
|
9
4
|
* `useStdout` is a React hook, which exposes stdout stream.
|
|
10
5
|
*/
|
|
11
|
-
const useStdout = () =>
|
|
12
|
-
|
|
6
|
+
const useStdout = () => useContext(StdoutContext);
|
|
7
|
+
export default useStdout;
|
|
13
8
|
//# sourceMappingURL=use-stdout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stdout.js","sourceRoot":"","sources":["../../src/hooks/use-stdout.ts"],"names":[],"mappings":"
|
|
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;;GAEG;AACH,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClD,eAAe,SAAS,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { default as
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export { Props as
|
|
6
|
-
export {
|
|
7
|
-
export { Props as
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export { default as
|
|
13
|
-
export {
|
|
14
|
-
export { default as
|
|
15
|
-
export {
|
|
16
|
-
export { default as
|
|
17
|
-
export { default as
|
|
18
|
-
export {
|
|
19
|
-
export { default as
|
|
20
|
-
export {
|
|
1
|
+
export type { RenderOptions, Instance } from './render.js';
|
|
2
|
+
export { default as render } from './render.js';
|
|
3
|
+
export type { Props as BoxProps } from './components/Box.js';
|
|
4
|
+
export { default as Box } from './components/Box.js';
|
|
5
|
+
export type { Props as TextProps } from './components/Text.js';
|
|
6
|
+
export { default as Text } from './components/Text.js';
|
|
7
|
+
export type { Props as AppProps } from './components/AppContext.js';
|
|
8
|
+
export type { Props as StdinProps } from './components/StdinContext.js';
|
|
9
|
+
export type { Props as StdoutProps } from './components/StdoutContext.js';
|
|
10
|
+
export type { Props as StderrProps } from './components/StderrContext.js';
|
|
11
|
+
export type { Props as StaticProps } from './components/Static.js';
|
|
12
|
+
export { default as Static } from './components/Static.js';
|
|
13
|
+
export type { Props as TransformProps } from './components/Transform.js';
|
|
14
|
+
export { default as Transform } from './components/Transform.js';
|
|
15
|
+
export type { Props as NewlineProps } from './components/Newline.js';
|
|
16
|
+
export { default as Newline } from './components/Newline.js';
|
|
17
|
+
export { default as Spacer } from './components/Spacer.js';
|
|
18
|
+
export type { Key } from './hooks/use-input.js';
|
|
19
|
+
export { default as useInput } from './hooks/use-input.js';
|
|
20
|
+
export { default as useApp } from './hooks/use-app.js';
|
|
21
|
+
export { default as useStdin } from './hooks/use-stdin.js';
|
|
22
|
+
export { default as useStdout } from './hooks/use-stdout.js';
|
|
23
|
+
export { default as useStderr } from './hooks/use-stderr.js';
|
|
24
|
+
export { default as useFocus } from './hooks/use-focus.js';
|
|
25
|
+
export { default as useFocusManager } from './hooks/use-focus-manager.js';
|
|
26
|
+
export { default as measureElement } from './measure-element.js';
|
|
27
|
+
export type { DOMElement } from './dom.js';
|
package/build/index.js
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(exports, "Spacer", { enumerable: true, get: function () { return Spacer_1.default; } });
|
|
17
|
-
var use_input_1 = require("./hooks/use-input");
|
|
18
|
-
Object.defineProperty(exports, "useInput", { enumerable: true, get: function () { return use_input_1.default; } });
|
|
19
|
-
var use_app_1 = require("./hooks/use-app");
|
|
20
|
-
Object.defineProperty(exports, "useApp", { enumerable: true, get: function () { return use_app_1.default; } });
|
|
21
|
-
var use_stdin_1 = require("./hooks/use-stdin");
|
|
22
|
-
Object.defineProperty(exports, "useStdin", { enumerable: true, get: function () { return use_stdin_1.default; } });
|
|
23
|
-
var use_stdout_1 = require("./hooks/use-stdout");
|
|
24
|
-
Object.defineProperty(exports, "useStdout", { enumerable: true, get: function () { return use_stdout_1.default; } });
|
|
25
|
-
var use_stderr_1 = require("./hooks/use-stderr");
|
|
26
|
-
Object.defineProperty(exports, "useStderr", { enumerable: true, get: function () { return use_stderr_1.default; } });
|
|
27
|
-
var use_focus_1 = require("./hooks/use-focus");
|
|
28
|
-
Object.defineProperty(exports, "useFocus", { enumerable: true, get: function () { return use_focus_1.default; } });
|
|
29
|
-
var use_focus_manager_1 = require("./hooks/use-focus-manager");
|
|
30
|
-
Object.defineProperty(exports, "useFocusManager", { enumerable: true, get: function () { return use_focus_manager_1.default; } });
|
|
31
|
-
var measure_element_1 = require("./measure-element");
|
|
32
|
-
Object.defineProperty(exports, "measureElement", { enumerable: true, get: function () { return measure_element_1.default; } });
|
|
1
|
+
export { default as render } from './render.js';
|
|
2
|
+
export { default as Box } from './components/Box.js';
|
|
3
|
+
export { default as Text } from './components/Text.js';
|
|
4
|
+
export { default as Static } from './components/Static.js';
|
|
5
|
+
export { default as Transform } from './components/Transform.js';
|
|
6
|
+
export { default as Newline } from './components/Newline.js';
|
|
7
|
+
export { default as Spacer } from './components/Spacer.js';
|
|
8
|
+
export { default as useInput } from './hooks/use-input.js';
|
|
9
|
+
export { default as useApp } from './hooks/use-app.js';
|
|
10
|
+
export { default as useStdin } from './hooks/use-stdin.js';
|
|
11
|
+
export { default as useStdout } from './hooks/use-stdout.js';
|
|
12
|
+
export { default as useStderr } from './hooks/use-stderr.js';
|
|
13
|
+
export { default as useFocus } from './hooks/use-focus.js';
|
|
14
|
+
export { default as useFocusManager } from './hooks/use-focus-manager.js';
|
|
15
|
+
export { default as measureElement } from './measure-element.js';
|
|
33
16
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,sBAAsB,CAAC;AAMrD,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,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,cAAc,EAAC,MAAM,sBAAsB,CAAC"}
|
package/build/ink.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
export
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export type Options = {
|
|
4
4
|
stdout: NodeJS.WriteStream;
|
|
5
5
|
stdin: NodeJS.ReadStream;
|
|
6
6
|
stderr: NodeJS.WriteStream;
|
|
@@ -8,7 +8,7 @@ export interface Options {
|
|
|
8
8
|
exitOnCtrlC: boolean;
|
|
9
9
|
patchConsole: boolean;
|
|
10
10
|
waitUntilExit?: () => Promise<void>;
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
export default class Ink {
|
|
13
13
|
private readonly options;
|
|
14
14
|
private readonly log;
|