ink 3.1.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 +166 -97
- 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 +2 -2
- package/build/reconciler.js +100 -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 +87 -67
- package/readme.md +91 -49
package/build/components/App.js
CHANGED
|
@@ -1,229 +1,283 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
26
|
-
const react_1 = __importStar(require("react"));
|
|
27
|
-
const cli_cursor_1 = __importDefault(require("cli-cursor"));
|
|
28
|
-
const AppContext_1 = __importDefault(require("./AppContext"));
|
|
29
|
-
const StdinContext_1 = __importDefault(require("./StdinContext"));
|
|
30
|
-
const StdoutContext_1 = __importDefault(require("./StdoutContext"));
|
|
31
|
-
const StderrContext_1 = __importDefault(require("./StderrContext"));
|
|
32
|
-
const FocusContext_1 = __importDefault(require("./FocusContext"));
|
|
33
|
-
const ErrorOverview_1 = __importDefault(require("./ErrorOverview"));
|
|
34
|
-
const TAB = '\t';
|
|
35
|
-
const SHIFT_TAB = '\u001B[Z';
|
|
36
|
-
const ESC = '\u001B';
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import React, { PureComponent } from 'react';
|
|
3
|
+
import cliCursor from 'cli-cursor';
|
|
4
|
+
import AppContext from './AppContext.js';
|
|
5
|
+
import StdinContext from './StdinContext.js';
|
|
6
|
+
import StdoutContext from './StdoutContext.js';
|
|
7
|
+
import StderrContext from './StderrContext.js';
|
|
8
|
+
import FocusContext from './FocusContext.js';
|
|
9
|
+
import ErrorOverview from './ErrorOverview.js';
|
|
10
|
+
const tab = '\t';
|
|
11
|
+
const shiftTab = '\u001B[Z';
|
|
12
|
+
const escape = '\u001B';
|
|
37
13
|
// Root component for all Ink apps
|
|
38
14
|
// It renders stdin and stdout contexts, so that children can access them if needed
|
|
39
15
|
// It also handles Ctrl+C exiting and cursor visibility
|
|
40
|
-
class App extends
|
|
16
|
+
export default class App extends PureComponent {
|
|
41
17
|
constructor() {
|
|
42
18
|
super(...arguments);
|
|
43
|
-
this
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
19
|
+
Object.defineProperty(this, "state", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: {
|
|
24
|
+
isFocusEnabled: true,
|
|
25
|
+
activeFocusId: undefined,
|
|
26
|
+
focusables: [],
|
|
27
|
+
error: undefined
|
|
28
|
+
}
|
|
29
|
+
});
|
|
49
30
|
// Count how many components enabled raw mode to avoid disabling
|
|
50
31
|
// raw mode until all components don't need it anymore
|
|
51
|
-
this
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
32
|
+
Object.defineProperty(this, "rawModeEnabledCount", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: 0
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(this, "handleSetRawMode", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: (isEnabled) => {
|
|
43
|
+
const { stdin } = this.props;
|
|
44
|
+
if (!this.isRawModeSupported()) {
|
|
45
|
+
if (stdin === process.stdin) {
|
|
46
|
+
throw new Error('Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw new Error('Raw mode is not supported on the stdin provided to Ink.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
stdin.setEncoding('utf8');
|
|
53
|
+
if (isEnabled) {
|
|
54
|
+
// Ensure raw mode is enabled only once
|
|
55
|
+
if (this.rawModeEnabledCount === 0) {
|
|
56
|
+
stdin.addListener('data', this.handleInput);
|
|
57
|
+
stdin.resume();
|
|
58
|
+
stdin.setRawMode(true);
|
|
59
|
+
}
|
|
60
|
+
this.rawModeEnabledCount++;
|
|
61
|
+
return;
|
|
57
62
|
}
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
// Disable raw mode only when no components left that are using it
|
|
64
|
+
if (--this.rawModeEnabledCount === 0) {
|
|
65
|
+
stdin.setRawMode(false);
|
|
66
|
+
stdin.removeListener('data', this.handleInput);
|
|
67
|
+
stdin.pause();
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(this, "handleInput", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: (input) => {
|
|
76
|
+
// Exit on Ctrl+C
|
|
77
|
+
// eslint-disable-next-line unicorn/no-hex-escape
|
|
78
|
+
if (input === '\x03' && this.props.exitOnCtrlC) {
|
|
79
|
+
this.handleExit();
|
|
80
|
+
}
|
|
81
|
+
// Reset focus when there's an active focused component on Esc
|
|
82
|
+
if (input === escape && this.state.activeFocusId) {
|
|
83
|
+
this.setState({
|
|
84
|
+
activeFocusId: undefined
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (this.state.isFocusEnabled && this.state.focusables.length > 0) {
|
|
88
|
+
if (input === tab) {
|
|
89
|
+
this.focusNext();
|
|
90
|
+
}
|
|
91
|
+
if (input === shiftTab) {
|
|
92
|
+
this.focusPrevious();
|
|
93
|
+
}
|
|
69
94
|
}
|
|
70
|
-
this.rawModeEnabledCount++;
|
|
71
|
-
return;
|
|
72
95
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(this, "handleExit", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
configurable: true,
|
|
100
|
+
writable: true,
|
|
101
|
+
value: (error) => {
|
|
102
|
+
if (this.isRawModeSupported()) {
|
|
103
|
+
this.handleSetRawMode(false);
|
|
104
|
+
}
|
|
105
|
+
this.props.onExit(error);
|
|
78
106
|
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(this, "enableFocus", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
configurable: true,
|
|
111
|
+
writable: true,
|
|
112
|
+
value: () => {
|
|
113
|
+
this.setState({
|
|
114
|
+
isFocusEnabled: true
|
|
115
|
+
});
|
|
85
116
|
}
|
|
86
|
-
|
|
87
|
-
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(this, "disableFocus", {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
configurable: true,
|
|
121
|
+
writable: true,
|
|
122
|
+
value: () => {
|
|
88
123
|
this.setState({
|
|
89
|
-
|
|
124
|
+
isFocusEnabled: false
|
|
90
125
|
});
|
|
91
126
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(this, "focus", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
configurable: true,
|
|
131
|
+
writable: true,
|
|
132
|
+
value: (id) => {
|
|
133
|
+
this.setState(previousState => {
|
|
134
|
+
const hasFocusableId = previousState.focusables.some(focusable => focusable?.id === id);
|
|
135
|
+
if (!hasFocusableId) {
|
|
136
|
+
return previousState;
|
|
137
|
+
}
|
|
138
|
+
return { activeFocusId: id };
|
|
139
|
+
});
|
|
99
140
|
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
141
|
+
});
|
|
142
|
+
Object.defineProperty(this, "focusNext", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
configurable: true,
|
|
145
|
+
writable: true,
|
|
146
|
+
value: () => {
|
|
147
|
+
this.setState(previousState => {
|
|
148
|
+
const firstFocusableId = previousState.focusables[0]?.id;
|
|
149
|
+
const nextFocusableId = this.findNextFocusable(previousState);
|
|
150
|
+
return {
|
|
151
|
+
activeFocusId: nextFocusableId ?? firstFocusableId
|
|
152
|
+
};
|
|
153
|
+
});
|
|
104
154
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
isFocusEnabled: false
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
this.focus = (id) => {
|
|
118
|
-
this.setState(previousState => {
|
|
119
|
-
const hasFocusableId = previousState.focusables.some(focusable => (focusable === null || focusable === void 0 ? void 0 : focusable.id) === id);
|
|
120
|
-
if (!hasFocusableId) {
|
|
121
|
-
return previousState;
|
|
122
|
-
}
|
|
123
|
-
return { activeFocusId: id };
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
this.focusNext = () => {
|
|
127
|
-
this.setState(previousState => {
|
|
128
|
-
var _a;
|
|
129
|
-
const firstFocusableId = (_a = previousState.focusables[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
130
|
-
const nextFocusableId = this.findNextFocusable(previousState);
|
|
131
|
-
return {
|
|
132
|
-
activeFocusId: nextFocusableId || firstFocusableId
|
|
133
|
-
};
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
this.focusPrevious = () => {
|
|
137
|
-
this.setState(previousState => {
|
|
138
|
-
var _a;
|
|
139
|
-
const lastFocusableId = (_a = previousState.focusables[previousState.focusables.length - 1]) === null || _a === void 0 ? void 0 : _a.id;
|
|
140
|
-
const previousFocusableId = this.findPreviousFocusable(previousState);
|
|
141
|
-
return {
|
|
142
|
-
activeFocusId: previousFocusableId || lastFocusableId
|
|
143
|
-
};
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
this.addFocusable = (id, { autoFocus }) => {
|
|
147
|
-
this.setState(previousState => {
|
|
148
|
-
let nextFocusId = previousState.activeFocusId;
|
|
149
|
-
if (!nextFocusId && autoFocus) {
|
|
150
|
-
nextFocusId = id;
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
activeFocusId: nextFocusId,
|
|
154
|
-
focusables: [
|
|
155
|
-
...previousState.focusables,
|
|
156
|
-
{
|
|
157
|
-
id,
|
|
158
|
-
isActive: true
|
|
159
|
-
}
|
|
160
|
-
]
|
|
161
|
-
};
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
this.removeFocusable = (id) => {
|
|
165
|
-
this.setState(previousState => ({
|
|
166
|
-
activeFocusId: previousState.activeFocusId === id
|
|
167
|
-
? undefined
|
|
168
|
-
: previousState.activeFocusId,
|
|
169
|
-
focusables: previousState.focusables.filter(focusable => {
|
|
170
|
-
return focusable.id !== id;
|
|
171
|
-
})
|
|
172
|
-
}));
|
|
173
|
-
};
|
|
174
|
-
this.activateFocusable = (id) => {
|
|
175
|
-
this.setState(previousState => ({
|
|
176
|
-
focusables: previousState.focusables.map(focusable => {
|
|
177
|
-
if (focusable.id !== id) {
|
|
178
|
-
return focusable;
|
|
179
|
-
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(this, "focusPrevious", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
configurable: true,
|
|
159
|
+
writable: true,
|
|
160
|
+
value: () => {
|
|
161
|
+
this.setState(previousState => {
|
|
162
|
+
const lastFocusableId = previousState.focusables[previousState.focusables.length - 1]?.id;
|
|
163
|
+
const previousFocusableId = this.findPreviousFocusable(previousState);
|
|
180
164
|
return {
|
|
181
|
-
|
|
182
|
-
isActive: true
|
|
165
|
+
activeFocusId: previousFocusableId ?? lastFocusableId
|
|
183
166
|
};
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(this, "addFocusable", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
configurable: true,
|
|
173
|
+
writable: true,
|
|
174
|
+
value: (id, { autoFocus }) => {
|
|
175
|
+
this.setState(previousState => {
|
|
176
|
+
let nextFocusId = previousState.activeFocusId;
|
|
177
|
+
if (!nextFocusId && autoFocus) {
|
|
178
|
+
nextFocusId = id;
|
|
195
179
|
}
|
|
196
180
|
return {
|
|
197
|
-
|
|
198
|
-
|
|
181
|
+
activeFocusId: nextFocusId,
|
|
182
|
+
focusables: [
|
|
183
|
+
...previousState.focusables,
|
|
184
|
+
{
|
|
185
|
+
id,
|
|
186
|
+
isActive: true
|
|
187
|
+
}
|
|
188
|
+
]
|
|
199
189
|
};
|
|
200
|
-
})
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
Object.defineProperty(this, "removeFocusable", {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
configurable: true,
|
|
196
|
+
writable: true,
|
|
197
|
+
value: (id) => {
|
|
198
|
+
this.setState(previousState => ({
|
|
199
|
+
activeFocusId: previousState.activeFocusId === id
|
|
200
|
+
? undefined
|
|
201
|
+
: previousState.activeFocusId,
|
|
202
|
+
focusables: previousState.focusables.filter(focusable => {
|
|
203
|
+
return focusable.id !== id;
|
|
204
|
+
})
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(this, "activateFocusable", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
configurable: true,
|
|
211
|
+
writable: true,
|
|
212
|
+
value: (id) => {
|
|
213
|
+
this.setState(previousState => ({
|
|
214
|
+
focusables: previousState.focusables.map(focusable => {
|
|
215
|
+
if (focusable.id !== id) {
|
|
216
|
+
return focusable;
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
id,
|
|
220
|
+
isActive: true
|
|
221
|
+
};
|
|
222
|
+
})
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(this, "deactivateFocusable", {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
configurable: true,
|
|
229
|
+
writable: true,
|
|
230
|
+
value: (id) => {
|
|
231
|
+
this.setState(previousState => ({
|
|
232
|
+
activeFocusId: previousState.activeFocusId === id
|
|
233
|
+
? undefined
|
|
234
|
+
: previousState.activeFocusId,
|
|
235
|
+
focusables: previousState.focusables.map(focusable => {
|
|
236
|
+
if (focusable.id !== id) {
|
|
237
|
+
return focusable;
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
id,
|
|
241
|
+
isActive: false
|
|
242
|
+
};
|
|
243
|
+
})
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
Object.defineProperty(this, "findNextFocusable", {
|
|
248
|
+
enumerable: true,
|
|
249
|
+
configurable: true,
|
|
250
|
+
writable: true,
|
|
251
|
+
value: (state) => {
|
|
252
|
+
const activeIndex = state.focusables.findIndex(focusable => {
|
|
253
|
+
return focusable.id === state.activeFocusId;
|
|
254
|
+
});
|
|
255
|
+
for (let index = activeIndex + 1; index < state.focusables.length; index++) {
|
|
256
|
+
const focusable = state.focusables[index];
|
|
257
|
+
if (focusable?.isActive) {
|
|
258
|
+
return focusable.id;
|
|
259
|
+
}
|
|
211
260
|
}
|
|
261
|
+
return undefined;
|
|
212
262
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
263
|
+
});
|
|
264
|
+
Object.defineProperty(this, "findPreviousFocusable", {
|
|
265
|
+
enumerable: true,
|
|
266
|
+
configurable: true,
|
|
267
|
+
writable: true,
|
|
268
|
+
value: (state) => {
|
|
269
|
+
const activeIndex = state.focusables.findIndex(focusable => {
|
|
270
|
+
return focusable.id === state.activeFocusId;
|
|
271
|
+
});
|
|
272
|
+
for (let index = activeIndex - 1; index >= 0; index--) {
|
|
273
|
+
const focusable = state.focusables[index];
|
|
274
|
+
if (focusable?.isActive) {
|
|
275
|
+
return focusable.id;
|
|
276
|
+
}
|
|
223
277
|
}
|
|
278
|
+
return undefined;
|
|
224
279
|
}
|
|
225
|
-
|
|
226
|
-
};
|
|
280
|
+
});
|
|
227
281
|
}
|
|
228
282
|
static getDerivedStateFromError(error) {
|
|
229
283
|
return { error };
|
|
@@ -233,24 +287,45 @@ class App extends react_1.PureComponent {
|
|
|
233
287
|
return this.props.stdin.isTTY;
|
|
234
288
|
}
|
|
235
289
|
render() {
|
|
236
|
-
return (
|
|
290
|
+
return (React.createElement(AppContext.Provider
|
|
291
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
292
|
+
, {
|
|
293
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
294
|
+
value: {
|
|
237
295
|
exit: this.handleExit
|
|
238
296
|
} },
|
|
239
|
-
|
|
297
|
+
React.createElement(StdinContext.Provider
|
|
298
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
299
|
+
, {
|
|
300
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
301
|
+
value: {
|
|
240
302
|
stdin: this.props.stdin,
|
|
241
303
|
setRawMode: this.handleSetRawMode,
|
|
242
304
|
isRawModeSupported: this.isRawModeSupported(),
|
|
305
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
243
306
|
internal_exitOnCtrlC: this.props.exitOnCtrlC
|
|
244
307
|
} },
|
|
245
|
-
|
|
308
|
+
React.createElement(StdoutContext.Provider
|
|
309
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
310
|
+
, {
|
|
311
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
312
|
+
value: {
|
|
246
313
|
stdout: this.props.stdout,
|
|
247
314
|
write: this.props.writeToStdout
|
|
248
315
|
} },
|
|
249
|
-
|
|
316
|
+
React.createElement(StderrContext.Provider
|
|
317
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
318
|
+
, {
|
|
319
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
320
|
+
value: {
|
|
250
321
|
stderr: this.props.stderr,
|
|
251
322
|
write: this.props.writeToStderr
|
|
252
323
|
} },
|
|
253
|
-
|
|
324
|
+
React.createElement(FocusContext.Provider
|
|
325
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
326
|
+
, {
|
|
327
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
328
|
+
value: {
|
|
254
329
|
activeId: this.state.activeFocusId,
|
|
255
330
|
add: this.addFocusable,
|
|
256
331
|
remove: this.removeFocusable,
|
|
@@ -261,13 +336,13 @@ class App extends react_1.PureComponent {
|
|
|
261
336
|
focusNext: this.focusNext,
|
|
262
337
|
focusPrevious: this.focusPrevious,
|
|
263
338
|
focus: this.focus
|
|
264
|
-
} }, this.state.error ? (
|
|
339
|
+
} }, this.state.error ? (React.createElement(ErrorOverview, { error: this.state.error })) : (this.props.children)))))));
|
|
265
340
|
}
|
|
266
341
|
componentDidMount() {
|
|
267
|
-
|
|
342
|
+
cliCursor.hide(this.props.stdout);
|
|
268
343
|
}
|
|
269
344
|
componentWillUnmount() {
|
|
270
|
-
|
|
345
|
+
cliCursor.show(this.props.stdout);
|
|
271
346
|
// ignore calling setRawMode on an handle stdin it cannot be called
|
|
272
347
|
if (this.isRawModeSupported()) {
|
|
273
348
|
this.handleSetRawMode(false);
|
|
@@ -277,6 +352,10 @@ class App extends react_1.PureComponent {
|
|
|
277
352
|
this.handleExit(error);
|
|
278
353
|
}
|
|
279
354
|
}
|
|
280
|
-
|
|
281
|
-
|
|
355
|
+
Object.defineProperty(App, "displayName", {
|
|
356
|
+
enumerable: true,
|
|
357
|
+
configurable: true,
|
|
358
|
+
writable: true,
|
|
359
|
+
value: 'InternalApp'
|
|
360
|
+
});
|
|
282
361
|
//# sourceMappingURL=App.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../src/components/App.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":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nC,CAAC;IAEQ,oBAAoB;QAC5B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAElC,mEAAmE;QACnE,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE;YAC9B,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;SAC7B;IACF,CAAC;IAEQ,iBAAiB,CAAC,KAAY;QACtC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;;AAjGM;;;;WAAc,aAAa;GAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export type Props = {
|
|
3
3
|
/**
|
|
4
4
|
* Exit (unmount) the whole Ink app.
|
|
5
5
|
*/
|
|
6
6
|
readonly exit: (error?: Error) => void;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
/**
|
|
9
9
|
* `AppContext` is a React context, which exposes a method to manually exit the app (unmount).
|
|
10
10
|
*/
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const react_1 = require("react");
|
|
1
|
+
import { createContext } from 'react';
|
|
4
2
|
/**
|
|
5
3
|
* `AppContext` is a React context, which exposes a method to manually exit the app (unmount).
|
|
6
4
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
6
|
+
const AppContext = createContext({
|
|
7
|
+
exit() { }
|
|
9
8
|
});
|
|
10
9
|
AppContext.displayName = 'InternalAppContext';
|
|
11
|
-
|
|
10
|
+
export default AppContext;
|
|
12
11
|
//# sourceMappingURL=AppContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppContext.js","sourceRoot":"","sources":["../../src/components/AppContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppContext.js","sourceRoot":"","sources":["../../src/components/AppContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AASpC;;GAEG;AACH,gEAAgE;AAChE,MAAM,UAAU,GAAG,aAAa,CAAQ;IACvC,IAAI,KAAI,CAAC;CACT,CAAC,CAAC;AAEH,UAAU,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAE9C,eAAe,UAAU,CAAC"}
|