@reliverse/relinka 1.1.4 → 1.1.6
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/dist-npm/components/anykey/index.js +77 -57
- package/dist-npm/components/block/block.js +61 -48
- package/dist-npm/components/checkbox/index.js +211 -178
- package/dist-npm/components/confirm/confirm-main.js +122 -86
- package/dist-npm/components/confirm/confirm-three.js +27 -24
- package/dist-npm/components/confirm/index.js +45 -36
- package/dist-npm/components/core/Separator.js +17 -15
- package/dist-npm/components/core/create-prompt.js +124 -101
- package/dist-npm/components/core/errors.js +15 -19
- package/dist-npm/components/core/hook-engine.js +120 -91
- package/dist-npm/components/core/index.js +12 -12
- package/dist-npm/components/core/key.js +6 -16
- package/dist-npm/components/core/lines.js +54 -45
- package/dist-npm/components/core/make-theme.js +30 -21
- package/dist-npm/components/core/position.js +23 -27
- package/dist-npm/components/core/promise-polyfill.js +14 -11
- package/dist-npm/components/core/screen-manager.js +74 -59
- package/dist-npm/components/core/theme.js +32 -22
- package/dist-npm/components/core/use-effect.js +15 -9
- package/dist-npm/components/core/use-keypress.js +23 -19
- package/dist-npm/components/core/use-memo.js +16 -10
- package/dist-npm/components/core/use-pagination.js +32 -33
- package/dist-npm/components/core/use-prefix.js +38 -40
- package/dist-npm/components/core/use-ref.js +5 -2
- package/dist-npm/components/core/use-state.js +23 -15
- package/dist-npm/components/core/useKeyPress.js +17 -14
- package/dist-npm/components/core/usePromptState.js +14 -8
- package/dist-npm/components/core/utils.js +16 -7
- package/dist-npm/components/date/date.js +204 -168
- package/dist-npm/components/editor/index.js +92 -71
- package/dist-npm/components/expand/index.js +124 -96
- package/dist-npm/components/figures/index.js +294 -283
- package/dist-npm/components/input/index.js +87 -61
- package/dist-npm/components/input/text-main.js +124 -86
- package/dist-npm/components/input/text.js +28 -24
- package/dist-npm/components/instance/basic.js +25 -17
- package/dist-npm/components/instance/browser.js +18 -14
- package/dist-npm/components/instance/reporter/basic.js +65 -46
- package/dist-npm/components/instance/reporter/browser.js +47 -44
- package/dist-npm/components/instance/reporter/fancy.js +96 -83
- package/dist-npm/components/instance/shared.js +2 -2
- package/dist-npm/components/mono/mono.js +62 -52
- package/dist-npm/components/mono/monoTwo.js +49 -35
- package/dist-npm/components/multiselect/group-multiselect.js +71 -55
- package/dist-npm/components/multiselect/multi-select-two.js +130 -98
- package/dist-npm/components/multiselect/multi-select.js +49 -43
- package/dist-npm/components/multiselect/multiselect-main.js +146 -120
- package/dist-npm/components/multiselect/num-multi-select.js +130 -98
- package/dist-npm/components/multiselect/num-multiselect-main.js +35 -24
- package/dist-npm/components/next-steps/next-steps.js +25 -24
- package/dist-npm/components/number/index.js +112 -78
- package/dist-npm/components/number/number-main.js +2 -96
- package/dist-npm/components/password/index.js +73 -54
- package/dist-npm/components/password/password-main.js +2 -120
- package/dist-npm/components/password/password-three.js +30 -26
- package/dist-npm/components/progressbar/ProgressBar.js +64 -45
- package/dist-npm/components/progressbar/helper.js +40 -33
- package/dist-npm/components/progressbar/index.js +1 -1
- package/dist-npm/components/prompts/create.js +44 -29
- package/dist-npm/components/prompts/index.js +45 -45
- package/dist-npm/components/prompts/prompt.js +260 -211
- package/dist-npm/components/prompts/promptTwo.js +605 -561
- package/dist-npm/components/prompts/relinka.js +295 -237
- package/dist-npm/components/range/range.js +294 -247
- package/dist-npm/components/rawlist/index.js +107 -87
- package/dist-npm/components/results/results.js +37 -31
- package/dist-npm/components/search/index.js +193 -148
- package/dist-npm/components/select/index.js +186 -148
- package/dist-npm/components/select/num-select-main.js +27 -27
- package/dist-npm/components/select/num-select.js +5 -125
- package/dist-npm/components/select/select-key.js +25 -24
- package/dist-npm/components/select/select-main.js +133 -109
- package/dist-npm/components/select/select-three.js +36 -32
- package/dist-npm/components/select/select-two.js +87 -95
- package/dist-npm/components/spinner/index.js +136 -107
- package/dist-npm/components/st-end/end.d.ts +1 -1
- package/dist-npm/components/st-end/end.js +26 -35
- package/dist-npm/components/st-end/start.d.ts +1 -1
- package/dist-npm/components/st-end/start.js +15 -30
- package/dist-npm/components/toggle/index.js +137 -113
- package/dist-npm/components/visual/animate/animate.js +10 -53
- package/dist-npm/components/visual/ascii-art/ascii-art.js +1 -12
- package/dist-npm/mod.js +2 -1
- package/dist-npm/testing/index.js +83 -58
- package/dist-npm/types/general.d.ts +2 -1
- package/dist-npm/types/general.js +1 -0
- package/dist-npm/types/index.js +3 -2
- package/dist-npm/types/keypress.js +36 -35
- package/dist-npm/types/readline.js +1 -0
- package/dist-npm/types/relinka.js +1 -0
- package/dist-npm/types/utils.js +1 -0
- package/dist-npm/utils/box.js +137 -135
- package/dist-npm/utils/color.js +74 -65
- package/dist-npm/utils/colorize.js +156 -124
- package/dist-npm/utils/component.js +657 -532
- package/dist-npm/utils/constants.js +63 -64
- package/dist-npm/utils/core.js +3 -2
- package/dist-npm/utils/decoder.js +223 -244
- package/dist-npm/utils/error.js +9 -4
- package/dist-npm/utils/errors.js +4 -14
- package/dist-npm/utils/format.js +24 -19
- package/dist-npm/utils/keypress.js +414 -316
- package/dist-npm/utils/log.js +15 -11
- package/dist-npm/utils/mapping.js +52 -45
- package/dist-npm/utils/messages.js +183 -183
- package/dist-npm/utils/platforms.js +20 -16
- package/dist-npm/utils/prompt-tmp.js +286 -235
- package/dist-npm/utils/prompt-two.js +286 -235
- package/dist-npm/utils/readline.js +7 -5
- package/dist-npm/utils/skeleton.js +170 -130
- package/dist-npm/utils/stream.js +2 -2
- package/dist-npm/utils/string.js +58 -44
- package/dist-npm/utils/terminal.js +34 -23
- package/dist-npm/utils/tree.js +41 -30
- package/dist-npm/utils/types.js +1 -0
- package/dist-npm/utils/utils.js +8 -8
- package/dist-npm/utils/variants.js +44 -36
- package/package.json +20 -28
|
@@ -1,254 +1,305 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import readline from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import wrap from
|
|
1
|
+
import process, {stdin, stdout} from 'node:process';
|
|
2
|
+
import readline from 'node:readline';
|
|
3
|
+
import {WriteStream} from 'node:tty';
|
|
4
|
+
import {cursor, erase} from 'sisteransi';
|
|
5
|
+
import wrap from 'wrap-ansi';
|
|
6
|
+
|
|
6
7
|
function diffLines(a, b) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
if (a === b) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const aLines = a.split('\n');
|
|
13
|
+
const bLines = b.split('\n');
|
|
14
|
+
const diff = [];
|
|
15
|
+
|
|
16
|
+
for (let i = 0; i < Math.max(aLines.length, bLines.length); i++) {
|
|
17
|
+
if (aLines[i] !== bLines[i]) {
|
|
18
|
+
diff.push(i);
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
|
|
22
|
+
return diff;
|
|
19
23
|
}
|
|
20
|
-
|
|
24
|
+
|
|
25
|
+
const cancel = Symbol('rp:cancel');
|
|
26
|
+
|
|
21
27
|
export function isCancel(value) {
|
|
22
|
-
|
|
28
|
+
return value === cancel;
|
|
23
29
|
}
|
|
30
|
+
|
|
24
31
|
function setRawMode(input, value) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
if (input.isTTY) {
|
|
33
|
+
input.setRawMode(value);
|
|
34
|
+
}
|
|
28
35
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
|
|
37
|
+
const aliases = new Map([
|
|
38
|
+
['k', 'up'],
|
|
39
|
+
['j', 'down'],
|
|
40
|
+
['h', 'left'],
|
|
41
|
+
['l', 'right'],
|
|
34
42
|
]);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
arr.push({ cb, once: true });
|
|
105
|
-
subscribers.set(event, arr);
|
|
106
|
-
}
|
|
107
|
-
function emit(event, ...data) {
|
|
108
|
-
const cbs = subscribers.get(event) ?? [];
|
|
109
|
-
const cleanup = [];
|
|
110
|
-
for (const subscriber of cbs) {
|
|
111
|
-
subscriber.cb(...data);
|
|
112
|
-
if (subscriber.once) {
|
|
113
|
-
cleanup.push(() => cbs.splice(cbs.indexOf(subscriber), 1));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
for (const cb of cleanup) {
|
|
117
|
-
cb();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function unsubscribe() {
|
|
121
|
-
subscribers.clear();
|
|
122
|
-
}
|
|
123
|
-
function onKeypress(char, key) {
|
|
124
|
-
if (state === "error") {
|
|
125
|
-
state = "active";
|
|
126
|
-
}
|
|
127
|
-
if (key?.name && !_track && aliases.has(key.name)) {
|
|
128
|
-
emit("cursor", aliases.get(key.name));
|
|
129
|
-
}
|
|
130
|
-
if (key?.name && keys.has(key.name)) {
|
|
131
|
-
emit("cursor", key.name);
|
|
132
|
-
}
|
|
133
|
-
if (char && (char.toLowerCase() === "y" || char.toLowerCase() === "n")) {
|
|
134
|
-
emit("confirm", char.toLowerCase() === "y");
|
|
43
|
+
|
|
44
|
+
const keys = new Set([
|
|
45
|
+
'up',
|
|
46
|
+
'down',
|
|
47
|
+
'left',
|
|
48
|
+
'right',
|
|
49
|
+
'space',
|
|
50
|
+
'enter',
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
export function createPrompt({render: renderFn, input = stdin, output = stdout, ...opts}, trackValue = true) {
|
|
54
|
+
const _input = input;
|
|
55
|
+
const _output = output;
|
|
56
|
+
let _rl;
|
|
57
|
+
const _opts = opts;
|
|
58
|
+
const _track = trackValue;
|
|
59
|
+
let _cursor = 0;
|
|
60
|
+
let state = 'initial';
|
|
61
|
+
let value = _opts.initialValue ?? '';
|
|
62
|
+
let error = '';
|
|
63
|
+
const subscribers = /* @__PURE__ */new Map();
|
|
64
|
+
let _prevFrame = '';
|
|
65
|
+
const self = {};
|
|
66
|
+
const _render = () => renderFn.call(self);
|
|
67
|
+
|
|
68
|
+
function prompt() {
|
|
69
|
+
const sink = new WriteStream(0);
|
|
70
|
+
|
|
71
|
+
sink._write = (chunk, encoding, done) => {
|
|
72
|
+
if (_track) {
|
|
73
|
+
value = _rl.line.replace(/\t/g, '');
|
|
74
|
+
_cursor = _rl.cursor;
|
|
75
|
+
emit('value', value);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
done();
|
|
79
|
+
};
|
|
80
|
+
_input.pipe(sink);
|
|
81
|
+
_rl = readline.createInterface({
|
|
82
|
+
input: _input,
|
|
83
|
+
output: sink,
|
|
84
|
+
tabSize: 2,
|
|
85
|
+
prompt: '',
|
|
86
|
+
escapeCodeTimeout: 50,
|
|
87
|
+
});
|
|
88
|
+
readline.emitKeypressEvents(_input, _rl);
|
|
89
|
+
_rl.prompt();
|
|
90
|
+
if (_opts.initialValue !== void 0 && _track) {
|
|
91
|
+
_rl.write(_opts.initialValue);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_input.on('keypress', onKeypress);
|
|
95
|
+
setRawMode(_input, true);
|
|
96
|
+
_output.on('resize', render);
|
|
97
|
+
render();
|
|
98
|
+
return new Promise((resolve) => {
|
|
99
|
+
once('submit', () => {
|
|
100
|
+
_output.write(cursor.show);
|
|
101
|
+
_output.off('resize', render);
|
|
102
|
+
setRawMode(_input, false);
|
|
103
|
+
resolve(value);
|
|
104
|
+
});
|
|
105
|
+
once('cancel', () => {
|
|
106
|
+
_output.write(cursor.show);
|
|
107
|
+
_output.off('resize', render);
|
|
108
|
+
setRawMode(_input, false);
|
|
109
|
+
resolve(cancel);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
135
112
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
113
|
+
|
|
114
|
+
function on(event, cb) {
|
|
115
|
+
const arr = subscribers.get(event) ?? [];
|
|
116
|
+
arr.push({
|
|
117
|
+
cb,
|
|
118
|
+
});
|
|
119
|
+
subscribers.set(event, arr);
|
|
141
120
|
}
|
|
142
|
-
|
|
143
|
-
|
|
121
|
+
|
|
122
|
+
function once(event, cb) {
|
|
123
|
+
const arr = subscribers.get(event) ?? [];
|
|
124
|
+
arr.push({
|
|
125
|
+
cb,
|
|
126
|
+
once: true,
|
|
127
|
+
});
|
|
128
|
+
subscribers.set(event, arr);
|
|
144
129
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
130
|
+
|
|
131
|
+
function emit(event, ...data) {
|
|
132
|
+
const cbs = subscribers.get(event) ?? [];
|
|
133
|
+
const cleanup = [];
|
|
134
|
+
|
|
135
|
+
for (const subscriber of cbs) {
|
|
136
|
+
subscriber.cb(...data);
|
|
137
|
+
if (subscriber.once) {
|
|
138
|
+
cleanup.push(() => cbs.splice(cbs.indexOf(subscriber), 1));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
for (const cb of cleanup) {
|
|
143
|
+
cb();
|
|
144
|
+
}
|
|
157
145
|
}
|
|
158
|
-
|
|
159
|
-
|
|
146
|
+
|
|
147
|
+
function unsubscribe() {
|
|
148
|
+
subscribers.clear();
|
|
160
149
|
}
|
|
161
|
-
|
|
162
|
-
|
|
150
|
+
|
|
151
|
+
function onKeypress(char, key) {
|
|
152
|
+
if (state === 'error') {
|
|
153
|
+
state = 'active';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (key?.name && !_track && aliases.has(key.name)) {
|
|
157
|
+
emit('cursor', aliases.get(key.name));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (key?.name && keys.has(key.name)) {
|
|
161
|
+
emit('cursor', key.name);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (char && (char.toLowerCase() === 'y' || char.toLowerCase() === 'n')) {
|
|
165
|
+
emit('confirm', char.toLowerCase() === 'y');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (char === ' ' && _opts.placeholder && !value) {
|
|
169
|
+
_rl.write(_opts.placeholder);
|
|
170
|
+
emit('value', _opts.placeholder);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (char) {
|
|
174
|
+
emit('key', char.toLowerCase());
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (key?.name === 'return') {
|
|
178
|
+
if (_opts.validate) {
|
|
179
|
+
const problem = _opts.validate(value);
|
|
180
|
+
|
|
181
|
+
if (problem) {
|
|
182
|
+
error = problem;
|
|
183
|
+
state = 'error';
|
|
184
|
+
_rl.write(value);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (state !== 'error') {
|
|
189
|
+
state = 'submit';
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (char === '') {
|
|
194
|
+
state = 'cancel';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (state === 'submit' || state === 'cancel') {
|
|
198
|
+
emit('finalize');
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
render();
|
|
202
|
+
if (state === 'submit' || state === 'cancel') {
|
|
203
|
+
close();
|
|
204
|
+
}
|
|
163
205
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
206
|
+
|
|
207
|
+
function close() {
|
|
208
|
+
_input.unpipe();
|
|
209
|
+
_input.removeListener('keypress', onKeypress);
|
|
210
|
+
_output.write('\n');
|
|
211
|
+
setRawMode(_input, false);
|
|
212
|
+
_rl.close();
|
|
213
|
+
emit(state, value);
|
|
214
|
+
unsubscribe();
|
|
167
215
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
_rl.close();
|
|
175
|
-
emit(state, value);
|
|
176
|
-
unsubscribe();
|
|
177
|
-
}
|
|
178
|
-
function restoreCursor() {
|
|
179
|
-
const lines = wrap(_prevFrame, process.stdout.columns, { hard: true }).split("\n").length - 1;
|
|
180
|
-
_output.write(cursor.move(-999, lines * -1));
|
|
181
|
-
}
|
|
182
|
-
function render() {
|
|
183
|
-
const frame = wrap(_render() || "", process.stdout.columns, {
|
|
184
|
-
hard: true
|
|
185
|
-
});
|
|
186
|
-
if (frame === _prevFrame) {
|
|
187
|
-
return;
|
|
216
|
+
|
|
217
|
+
function restoreCursor() {
|
|
218
|
+
const lines = wrap(_prevFrame, process.stdout.columns, {
|
|
219
|
+
hard: true,
|
|
220
|
+
}).split('\n').length - 1;
|
|
221
|
+
_output.write(cursor.move(-999, lines * -1));
|
|
188
222
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
223
|
+
|
|
224
|
+
function render() {
|
|
225
|
+
const frame = wrap(_render() || '', process.stdout.columns, {
|
|
226
|
+
hard: true,
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
if (frame === _prevFrame) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (state === 'initial') {
|
|
234
|
+
_output.write(cursor.hide);
|
|
235
|
+
} else {
|
|
236
|
+
const diff = diffLines(_prevFrame, frame);
|
|
237
|
+
restoreCursor();
|
|
238
|
+
if (diff && diff.length === 1) {
|
|
239
|
+
const [diffLine] = diff;
|
|
240
|
+
_output.write(cursor.move(0, diffLine));
|
|
241
|
+
_output.write(erase.lines(1));
|
|
242
|
+
const lines = frame.split('\n');
|
|
243
|
+
_output.write(lines[diffLine]);
|
|
244
|
+
_prevFrame = frame;
|
|
245
|
+
_output.write(cursor.move(0, lines.length - diffLine - 1));
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (diff && diff.length > 1) {
|
|
250
|
+
const [diffLine] = diff;
|
|
251
|
+
_output.write(cursor.move(0, diffLine));
|
|
252
|
+
_output.write(erase.down());
|
|
253
|
+
const lines = frame.split('\n');
|
|
254
|
+
const newLines = lines.slice(diffLine);
|
|
255
|
+
|
|
256
|
+
_output.write(newLines.join('\n'));
|
|
257
|
+
_prevFrame = frame;
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
_output.write(erase.down());
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
_output.write(frame);
|
|
265
|
+
if (state === 'initial') {
|
|
266
|
+
state = 'active';
|
|
267
|
+
}
|
|
268
|
+
|
|
210
269
|
_prevFrame = frame;
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
_output.write(erase.down());
|
|
214
270
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
_output,
|
|
250
|
-
_rl,
|
|
251
|
-
_opts
|
|
252
|
-
});
|
|
253
|
-
return self;
|
|
271
|
+
|
|
272
|
+
Object.assign(self, {
|
|
273
|
+
prompt,
|
|
274
|
+
on,
|
|
275
|
+
once,
|
|
276
|
+
emit,
|
|
277
|
+
close,
|
|
278
|
+
render,
|
|
279
|
+
get state() {
|
|
280
|
+
return state;
|
|
281
|
+
},
|
|
282
|
+
set state(val) {
|
|
283
|
+
state = val;
|
|
284
|
+
},
|
|
285
|
+
get value() {
|
|
286
|
+
return value;
|
|
287
|
+
},
|
|
288
|
+
set value(val) {
|
|
289
|
+
value = val;
|
|
290
|
+
},
|
|
291
|
+
get error() {
|
|
292
|
+
return error;
|
|
293
|
+
},
|
|
294
|
+
set error(val) {
|
|
295
|
+
error = val;
|
|
296
|
+
},
|
|
297
|
+
_cursor,
|
|
298
|
+
_track,
|
|
299
|
+
_input,
|
|
300
|
+
_output,
|
|
301
|
+
_rl,
|
|
302
|
+
_opts,
|
|
303
|
+
});
|
|
304
|
+
return self;
|
|
254
305
|
}
|