talented-args 0.2.4-beta → 0.3.0-beta
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/README.md +497 -10
- package/dist/clipboard.d.ts +10 -0
- package/dist/clipboard.js +79 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/compile.d.ts +67 -0
- package/dist/compile.js +188 -0
- package/dist/compile.js.map +1 -0
- package/dist/descriptors.d.ts +322 -0
- package/dist/descriptors.js +362 -0
- package/dist/descriptors.js.map +1 -0
- package/dist/display.d.ts +31 -0
- package/dist/display.js +235 -0
- package/dist/display.js.map +1 -0
- package/dist/errors.d.ts +34 -17
- package/dist/errors.js +61 -75
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +69 -37
- package/dist/options.js +198 -31
- package/dist/options.js.map +1 -1
- package/dist/parse.d.ts +70 -0
- package/dist/parse.js +551 -0
- package/dist/parse.js.map +1 -0
- package/dist/program.d.ts +125 -0
- package/dist/program.js +337 -0
- package/dist/program.js.map +1 -0
- package/dist/remember.d.ts +71 -0
- package/dist/remember.js +216 -0
- package/dist/remember.js.map +1 -0
- package/dist/styling.d.ts +38 -9
- package/dist/styling.js +155 -75
- package/dist/styling.js.map +1 -1
- package/dist/terminal.d.ts +205 -0
- package/dist/terminal.js +152 -0
- package/dist/terminal.js.map +1 -0
- package/dist/tools.d.ts +35 -31
- package/dist/tools.js +68 -140
- package/dist/tools.js.map +1 -1
- package/dist/tui.d.ts +96 -0
- package/dist/tui.js +397 -0
- package/dist/tui.js.map +1 -0
- package/dist/tui_layout.d.ts +152 -0
- package/dist/tui_layout.js +554 -0
- package/dist/tui_layout.js.map +1 -0
- package/dist/tui_model.d.ts +149 -0
- package/dist/tui_model.js +666 -0
- package/dist/tui_model.js.map +1 -0
- package/package.json +18 -14
- package/.eslintrc.js +0 -24
- package/.idea/codeStyles/Project.xml +0 -364
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/compiler.xml +0 -7
- package/.idea/encodings.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -12
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -8
- package/.idea/talented-args.iml +0 -11
- package/.idea/vcs.xml +0 -6
- package/.prettierrc.yaml +0 -4
- package/dist/definitions.d.ts +0 -70
- package/dist/definitions.js +0 -38
- package/dist/definitions.js.map +0 -1
- package/dist/main.d.ts +0 -33
- package/dist/main.js +0 -313
- package/dist/main.js.map +0 -1
- package/jest.config.js +0 -4
- package/tsconfig.json +0 -18
package/dist/tui.js
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TuiScreen = void 0;
|
|
4
|
+
exports.supportsUnicode = supportsUnicode;
|
|
5
|
+
exports.runTui = runTui;
|
|
6
|
+
const terminal_1 = require("./terminal");
|
|
7
|
+
const tools_1 = require("./tools");
|
|
8
|
+
const tui_layout_1 = require("./tui_layout");
|
|
9
|
+
const tui_model_1 = require("./tui_model");
|
|
10
|
+
/** Text editing actions handled by field widgets. Other keys are routed to the model. */
|
|
11
|
+
const TEXT_EDIT_KEYS = {
|
|
12
|
+
BACKSPACE: 'backDelete',
|
|
13
|
+
DELETE: 'delete',
|
|
14
|
+
LEFT: 'backward',
|
|
15
|
+
RIGHT: 'forward',
|
|
16
|
+
CTRL_LEFT: 'startOfWord',
|
|
17
|
+
CTRL_RIGHT: 'endOfWord',
|
|
18
|
+
HOME: 'startOfLine',
|
|
19
|
+
END: 'endOfLine',
|
|
20
|
+
CTRL_A: 'startOfLine',
|
|
21
|
+
CTRL_E: 'endOfLine',
|
|
22
|
+
};
|
|
23
|
+
const NO_KEYS = {};
|
|
24
|
+
/** Signals requiring terminal restoration before process exit. */
|
|
25
|
+
const FATAL_SIGNALS = { SIGINT: 130, SIGTERM: 143, SIGHUP: 129 };
|
|
26
|
+
/** Whether the configured locale indicates UTF-8 support for Unicode glyphs. */
|
|
27
|
+
function supportsUnicode(env) {
|
|
28
|
+
const locale = env['LC_ALL'] || env['LC_CTYPE'] || env['LANG'] || '';
|
|
29
|
+
return /utf-?8/i.test(locale);
|
|
30
|
+
}
|
|
31
|
+
class TuiScreen {
|
|
32
|
+
options;
|
|
33
|
+
session;
|
|
34
|
+
model;
|
|
35
|
+
terminal;
|
|
36
|
+
kit;
|
|
37
|
+
document;
|
|
38
|
+
theme;
|
|
39
|
+
glyphs;
|
|
40
|
+
text;
|
|
41
|
+
scroll = { commands: 0, fields: 0 };
|
|
42
|
+
elements = [];
|
|
43
|
+
focusedBox = null;
|
|
44
|
+
previewElement = null;
|
|
45
|
+
messageElement = null;
|
|
46
|
+
messageSignElement = null;
|
|
47
|
+
hintElements = new Map();
|
|
48
|
+
hintSignElements = new Map();
|
|
49
|
+
renderPending = false;
|
|
50
|
+
keyQueue = [];
|
|
51
|
+
closed = false;
|
|
52
|
+
restored = false;
|
|
53
|
+
cleanups = [];
|
|
54
|
+
result = (0, tools_1.createDeferred)();
|
|
55
|
+
constructor(options, session) {
|
|
56
|
+
this.options = options;
|
|
57
|
+
this.session = session;
|
|
58
|
+
this.terminal = session.terminal;
|
|
59
|
+
this.kit = session.kit;
|
|
60
|
+
this.theme = (0, tui_layout_1.createTheme)(options.styles);
|
|
61
|
+
this.glyphs = supportsUnicode(options.env) ? tui_layout_1.UNICODE_GLYPHS : tui_layout_1.ASCII_GLYPHS;
|
|
62
|
+
this.text = (0, terminal_1.createTextTools)(session.kit, this.glyphs.ellipsis);
|
|
63
|
+
this.model = new tui_model_1.TuiModel(options.schema, options.seed, {
|
|
64
|
+
executable: options.executable,
|
|
65
|
+
commandChosen: options.commandChosen,
|
|
66
|
+
maskChar: this.glyphs.mask,
|
|
67
|
+
remembered: options.remembered,
|
|
68
|
+
});
|
|
69
|
+
try {
|
|
70
|
+
this.terminal.fullscreen(true);
|
|
71
|
+
this.terminal.grabInput({});
|
|
72
|
+
this.document = this.terminal.createDocument({
|
|
73
|
+
keyBindings: NO_KEYS,
|
|
74
|
+
backgroundAttr: (0, terminal_1.toKitAttr)(this.theme.text),
|
|
75
|
+
noInput: true,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
// Restore the terminal if initialization fails after entering the alternate screen.
|
|
80
|
+
this.closed = true;
|
|
81
|
+
this.restoreTerminal();
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
// Queue terminal keys while widgets are being rebuilt.
|
|
85
|
+
this.terminal.off('key', this.document.onEventSourceKey);
|
|
86
|
+
this.terminal.on('key', (key, altKeys, data) => this.guarded(() => {
|
|
87
|
+
this.keyQueue.push({ key, altKeys, data });
|
|
88
|
+
this.drainKeys();
|
|
89
|
+
}));
|
|
90
|
+
this.document.on('key', (key, _altKeys, data) => this.onKey(key, data.isCharacter));
|
|
91
|
+
// Remove widgets before resizing the document so old dimensions cannot leave them outside the screen.
|
|
92
|
+
// Rebuild the widgets only after the document has adopted the new dimensions.
|
|
93
|
+
this.terminal.off('resize', this.document.onEventSourceResize);
|
|
94
|
+
this.terminal.on('resize', (width, height) => this.guarded(() => {
|
|
95
|
+
if (this.closed) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.clearElements();
|
|
99
|
+
this.document.onEventSourceResize(width, height);
|
|
100
|
+
this.render();
|
|
101
|
+
}));
|
|
102
|
+
try {
|
|
103
|
+
this.guardProcess();
|
|
104
|
+
this.render();
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
this.closed = true;
|
|
108
|
+
this.tearDown();
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Resolve with a run, copy, or cancel outcome after restoring the terminal.
|
|
114
|
+
* Reject on failure after terminal cleanup.
|
|
115
|
+
*/
|
|
116
|
+
finished() {
|
|
117
|
+
return this.result.promise;
|
|
118
|
+
}
|
|
119
|
+
/** Current rendered screen buffer, used by tests to inspect text and attributes. */
|
|
120
|
+
get screen() {
|
|
121
|
+
return this.document.inputDst;
|
|
122
|
+
}
|
|
123
|
+
// *******************************************************************************************************************
|
|
124
|
+
/**
|
|
125
|
+
* Restore the terminal before process exit or signal termination,
|
|
126
|
+
* including input mode, cursor visibility, and the original screen.
|
|
127
|
+
*/
|
|
128
|
+
guardProcess() {
|
|
129
|
+
const onExit = () => this.restoreTerminal();
|
|
130
|
+
process.once('exit', onExit);
|
|
131
|
+
this.cleanups.push(() => process.removeListener('exit', onExit));
|
|
132
|
+
for (const [signal, code] of Object.entries(FATAL_SIGNALS)) {
|
|
133
|
+
const onSignal = () => {
|
|
134
|
+
this.restoreTerminal();
|
|
135
|
+
process.exit(code);
|
|
136
|
+
};
|
|
137
|
+
process.once(signal, onSignal);
|
|
138
|
+
this.cleanups.push(() => process.removeListener(signal, onSignal));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
restoreTerminal() {
|
|
142
|
+
// Track our own restoration state. Terminal-kit can mark itself shut down during process exit
|
|
143
|
+
// before our full cleanup runs.
|
|
144
|
+
if (this.restored) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
this.restored = true;
|
|
148
|
+
this.terminal.hideCursor(false);
|
|
149
|
+
this.terminal.grabInput(false);
|
|
150
|
+
this.terminal.fullscreen(false);
|
|
151
|
+
this.terminal.styleReset();
|
|
152
|
+
this.session.release();
|
|
153
|
+
}
|
|
154
|
+
close(outcome) {
|
|
155
|
+
if (this.closed) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
this.closed = true;
|
|
159
|
+
// Wait for pending widget callbacks in this event loop turn before destroying the widgets.
|
|
160
|
+
setImmediate(() => {
|
|
161
|
+
try {
|
|
162
|
+
this.tearDown();
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
this.result.reject(err);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.result.resolve(outcome);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
tearDown() {
|
|
172
|
+
try {
|
|
173
|
+
this.document.destroy(false, true);
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
// Restore terminal state even if widget destruction fails.
|
|
177
|
+
this.restoreTerminal();
|
|
178
|
+
for (const cleanup of this.cleanups) {
|
|
179
|
+
cleanup();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Run an event handler with cleanup on failure.
|
|
185
|
+
* Restore the terminal and reject the result if the handler throws.
|
|
186
|
+
*/
|
|
187
|
+
guarded(action) {
|
|
188
|
+
try {
|
|
189
|
+
action();
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
if (this.closed) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.closed = true;
|
|
196
|
+
try {
|
|
197
|
+
this.tearDown();
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// Preserve the original error if cleanup also fails.
|
|
201
|
+
}
|
|
202
|
+
this.result.reject(err);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Deliver queued keys until a redraw is required.
|
|
207
|
+
* Focus changes take effect when widgets are rebuilt, so subsequent typed or pasted keys
|
|
208
|
+
* must wait for that render before reaching the next field.
|
|
209
|
+
*/
|
|
210
|
+
drainKeys() {
|
|
211
|
+
while (!this.renderPending && !this.closed) {
|
|
212
|
+
const next = this.keyQueue.shift();
|
|
213
|
+
if (!next) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
this.document.onEventSourceKey(next.key, next.altKeys, next.data);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/** Handle a key not consumed by the focused widget. */
|
|
220
|
+
onKey(key, isCharacter) {
|
|
221
|
+
if (this.closed) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const reaction = this.model.handleKey(key, isCharacter);
|
|
225
|
+
if (reaction === 'redraw') {
|
|
226
|
+
this.scheduleRender();
|
|
227
|
+
}
|
|
228
|
+
else if (reaction !== 'none') {
|
|
229
|
+
this.close(reaction);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
scheduleRender() {
|
|
233
|
+
if (this.renderPending || this.closed) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
this.renderPending = true;
|
|
237
|
+
// Defer rebuilding until the current widget callback has finished.
|
|
238
|
+
setImmediate(() => this.guarded(() => {
|
|
239
|
+
this.renderPending = false;
|
|
240
|
+
if (!this.closed) {
|
|
241
|
+
this.render();
|
|
242
|
+
}
|
|
243
|
+
}));
|
|
244
|
+
}
|
|
245
|
+
clearElements() {
|
|
246
|
+
for (const element of this.elements) {
|
|
247
|
+
element.destroy(false, true);
|
|
248
|
+
}
|
|
249
|
+
this.elements = [];
|
|
250
|
+
this.focusedBox = null;
|
|
251
|
+
this.previewElement = null;
|
|
252
|
+
this.messageElement = null;
|
|
253
|
+
this.messageSignElement = null;
|
|
254
|
+
this.hintElements.clear();
|
|
255
|
+
this.hintSignElements.clear();
|
|
256
|
+
}
|
|
257
|
+
/** Rebuild widgets from the current model and draw the document. */
|
|
258
|
+
render() {
|
|
259
|
+
const { kit, document, terminal } = this;
|
|
260
|
+
this.clearElements();
|
|
261
|
+
const view = (0, tui_layout_1.layoutTui)(this.model, {
|
|
262
|
+
width: terminal.width,
|
|
263
|
+
height: terminal.height,
|
|
264
|
+
theme: this.theme,
|
|
265
|
+
glyphs: this.glyphs,
|
|
266
|
+
text: this.text,
|
|
267
|
+
appInfo: this.options.appInfo,
|
|
268
|
+
scroll: this.scroll,
|
|
269
|
+
});
|
|
270
|
+
let focused = null;
|
|
271
|
+
const noteFocus = (target, element) => {
|
|
272
|
+
if ((0, tui_layout_1.sameTarget)(target, view.focus)) {
|
|
273
|
+
focused = element;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
for (const node of view.nodes) {
|
|
277
|
+
const place = {
|
|
278
|
+
parent: document,
|
|
279
|
+
x: node.x,
|
|
280
|
+
y: node.y,
|
|
281
|
+
width: node.width,
|
|
282
|
+
height: node.height,
|
|
283
|
+
noDraw: true,
|
|
284
|
+
};
|
|
285
|
+
switch (node.kind) {
|
|
286
|
+
case 'text': {
|
|
287
|
+
const element = new kit.Text({
|
|
288
|
+
...place,
|
|
289
|
+
content: node.lines,
|
|
290
|
+
attr: (0, terminal_1.toKitAttr)(node.attr),
|
|
291
|
+
});
|
|
292
|
+
this.elements.push(element);
|
|
293
|
+
if (node.role === 'preview') {
|
|
294
|
+
this.previewElement = element;
|
|
295
|
+
}
|
|
296
|
+
else if (node.role === 'message') {
|
|
297
|
+
this.messageElement = element;
|
|
298
|
+
}
|
|
299
|
+
else if (node.role === 'messageSign') {
|
|
300
|
+
this.messageSignElement = element;
|
|
301
|
+
}
|
|
302
|
+
else if (node.role === 'hint' && node.field) {
|
|
303
|
+
this.hintElements.set(node.field, element);
|
|
304
|
+
}
|
|
305
|
+
else if (node.role === 'hintSign' && node.field) {
|
|
306
|
+
this.hintSignElements.set(node.field, element);
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
case 'button': {
|
|
311
|
+
const element = new kit.Button({
|
|
312
|
+
...place,
|
|
313
|
+
content: node.content,
|
|
314
|
+
blurContent: node.content,
|
|
315
|
+
focusContent: node.focusedContent,
|
|
316
|
+
blurAttr: (0, terminal_1.toKitAttr)(node.attr),
|
|
317
|
+
focusAttr: (0, terminal_1.toKitAttr)(node.focusedAttr),
|
|
318
|
+
keyBindings: NO_KEYS,
|
|
319
|
+
});
|
|
320
|
+
this.elements.push(element);
|
|
321
|
+
noteFocus(node.target, element);
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
case 'input': {
|
|
325
|
+
const element = new kit.EditableTextBox({
|
|
326
|
+
...place,
|
|
327
|
+
content: node.value,
|
|
328
|
+
textAttr: (0, terminal_1.toKitAttr)(node.attr),
|
|
329
|
+
voidAttr: (0, terminal_1.toKitAttr)(node.attr),
|
|
330
|
+
keyBindings: TEXT_EDIT_KEYS,
|
|
331
|
+
debounceTimeout: 0,
|
|
332
|
+
...(node.masked ? { hiddenContent: this.glyphs.mask } : {}),
|
|
333
|
+
});
|
|
334
|
+
element.textBuffer.moveToEndOfBuffer();
|
|
335
|
+
element.on('change', () => this.onTextChange(node.field, element));
|
|
336
|
+
this.elements.push(element);
|
|
337
|
+
if ((0, tui_layout_1.sameTarget)(node.target, view.focus)) {
|
|
338
|
+
focused = element;
|
|
339
|
+
this.focusedBox = element;
|
|
340
|
+
}
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (focused) {
|
|
346
|
+
document.giveFocusTo(focused);
|
|
347
|
+
}
|
|
348
|
+
document.draw();
|
|
349
|
+
this.placeCursor();
|
|
350
|
+
this.drainKeys();
|
|
351
|
+
}
|
|
352
|
+
/** Show the cursor in the focused text field; hide it when no text field is focused. */
|
|
353
|
+
placeCursor() {
|
|
354
|
+
if (this.focusedBox) {
|
|
355
|
+
this.terminal.hideCursor(false);
|
|
356
|
+
this.focusedBox.drawCursor();
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
this.terminal.hideCursor();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Update dependent text after a field widget edits and redraws itself.
|
|
364
|
+
* Avoid rebuilding the focused widget while it is handling text input.
|
|
365
|
+
*/
|
|
366
|
+
onTextChange(field, box) {
|
|
367
|
+
if (this.closed) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
this.guarded(() => this.applyTextChange(field, box));
|
|
371
|
+
}
|
|
372
|
+
applyTextChange(field, box) {
|
|
373
|
+
this.model.setText(field, box.getValue());
|
|
374
|
+
const update = (element, content, attr) => {
|
|
375
|
+
if (!element) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
element.attr = (0, terminal_1.toKitAttr)(attr);
|
|
379
|
+
element.setContent([this.text.truncate(content, element.outputWidth)], false, true);
|
|
380
|
+
element.draw();
|
|
381
|
+
};
|
|
382
|
+
update(this.previewElement, this.model.preview(), this.theme.text);
|
|
383
|
+
const message = (0, tui_layout_1.messageOf)(this.model, this.theme, this.glyphs, this.text, this.messageElement?.outputWidth ?? Infinity);
|
|
384
|
+
update(this.messageElement, message.text, message.attr);
|
|
385
|
+
update(this.messageSignElement, message.isProblem ? this.glyphs.problem : '', message.isProblem ? this.theme.error : this.theme.text);
|
|
386
|
+
// Clear the field's displayed error while the user edits its value.
|
|
387
|
+
update(this.hintElements.get(field), field.hint, this.theme.muted);
|
|
388
|
+
update(this.hintSignElements.get(field), '', this.theme.text);
|
|
389
|
+
this.placeCursor();
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
exports.TuiScreen = TuiScreen;
|
|
393
|
+
/** Open the interactive editor on the supplied streams and wait for a run, copy, or cancel outcome. */
|
|
394
|
+
function runTui(options) {
|
|
395
|
+
return new TuiScreen(options, (0, terminal_1.openTerminal)(options.stdin, options.stdout)).finished();
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=tui.js.map
|
package/dist/tui.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":";;;AA8EA,0CAGC;AA6YD,wBAEC;AA3dD,yCAYoB;AACpB,mCAAqD;AACrD,6CAWsB;AACtB,2CAA+D;AA2B/D,yFAAyF;AACzF,MAAM,cAAc,GAAqC;IACvD,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,aAAa;IACxB,UAAU,EAAE,WAAW;IACvB,IAAI,EAAE,aAAa;I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AC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CACvD,CAAC;QACF,oEAAoE;QACpE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACnE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9D,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;CACF;AAxYD,8BAwYC;AAED,uGAAuG;AACvG,SAAgB,MAAM,CAAC,OAAoB;IACzC,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,IAAA,uBAAY,EAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { IAppInfo } from './options';
|
|
2
|
+
import { IResolvedStyles, ITextAttr } from './styling';
|
|
3
|
+
import { ITextTools } from './tools';
|
|
4
|
+
import { ITuiButton, ITuiField, TuiModel } from './tui_model';
|
|
5
|
+
/**
|
|
6
|
+
* Build positioned and styled view nodes from the editor model.
|
|
7
|
+
* Layout does not draw widgets. Nodes and text are constrained to the terminal dimensions.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Text attributes for the interactive editor.
|
|
11
|
+
* Use the terminal's default colors for readable text, distinguishing states with weight and inversion.
|
|
12
|
+
* Reserve the accent color for decoration because its contrast depends on the user's terminal theme.
|
|
13
|
+
*/
|
|
14
|
+
export interface ITuiTheme {
|
|
15
|
+
readonly text: ITextAttr;
|
|
16
|
+
readonly muted: ITextAttr;
|
|
17
|
+
/** Application title attributes. */
|
|
18
|
+
readonly title: ITextAttr;
|
|
19
|
+
readonly logo: ITextAttr;
|
|
20
|
+
readonly frame: ITextAttr;
|
|
21
|
+
readonly frameActive: ITextAttr;
|
|
22
|
+
readonly panelTitle: ITextAttr;
|
|
23
|
+
readonly panelTitleActive: ITextAttr;
|
|
24
|
+
/** Selected command attributes when focus is in another panel. */
|
|
25
|
+
readonly selected: ITextAttr;
|
|
26
|
+
/** Focused row or button attributes. */
|
|
27
|
+
readonly focused: ITextAttr;
|
|
28
|
+
readonly labelFocused: ITextAttr;
|
|
29
|
+
readonly input: ITextAttr;
|
|
30
|
+
readonly inputFocused: ITextAttr;
|
|
31
|
+
readonly button: ITextAttr;
|
|
32
|
+
/** Problem marker attributes. The explanatory text uses `problem`. */
|
|
33
|
+
readonly error: ITextAttr;
|
|
34
|
+
/** Problem explanation attributes. */
|
|
35
|
+
readonly problem: ITextAttr;
|
|
36
|
+
}
|
|
37
|
+
export declare function createTheme(styles: IResolvedStyles): ITuiTheme;
|
|
38
|
+
export interface IGlyphs {
|
|
39
|
+
readonly topLeft: string;
|
|
40
|
+
readonly topRight: string;
|
|
41
|
+
readonly bottomLeft: string;
|
|
42
|
+
readonly bottomRight: string;
|
|
43
|
+
readonly horizontal: string;
|
|
44
|
+
readonly vertical: string;
|
|
45
|
+
/** Marker for the selected or focused row. */
|
|
46
|
+
readonly marker: string;
|
|
47
|
+
readonly more: {
|
|
48
|
+
readonly up: string;
|
|
49
|
+
readonly down: string;
|
|
50
|
+
};
|
|
51
|
+
/** Marker for a field or message with a validation problem. */
|
|
52
|
+
readonly problem: string;
|
|
53
|
+
/** Suffix indicating truncated text. */
|
|
54
|
+
readonly ellipsis: string;
|
|
55
|
+
readonly mask: string;
|
|
56
|
+
readonly separator: string;
|
|
57
|
+
readonly keys: {
|
|
58
|
+
readonly vertical: string;
|
|
59
|
+
readonly horizontal: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export declare const UNICODE_GLYPHS: IGlyphs;
|
|
63
|
+
/** Fallback glyphs for locales without detected UTF-8 support. */
|
|
64
|
+
export declare const ASCII_GLYPHS: IGlyphs;
|
|
65
|
+
export type IFocusTarget = {
|
|
66
|
+
readonly kind: 'command';
|
|
67
|
+
readonly index: number;
|
|
68
|
+
} | {
|
|
69
|
+
readonly kind: 'field';
|
|
70
|
+
readonly index: number;
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: 'button';
|
|
73
|
+
readonly button: ITuiButton;
|
|
74
|
+
};
|
|
75
|
+
interface IRect {
|
|
76
|
+
readonly x: number;
|
|
77
|
+
readonly y: number;
|
|
78
|
+
readonly width: number;
|
|
79
|
+
readonly height: number;
|
|
80
|
+
}
|
|
81
|
+
/** Text view node. `role` identifies nodes updated in place while a field is edited. */
|
|
82
|
+
export interface ITextNode extends IRect {
|
|
83
|
+
readonly kind: 'text';
|
|
84
|
+
readonly lines: readonly string[];
|
|
85
|
+
readonly attr: ITextAttr;
|
|
86
|
+
readonly role: 'static' | 'preview' | 'message' | 'messageSign' | 'hint' | 'hintSign';
|
|
87
|
+
/** Field associated with a hint or problem marker, or `null` for other text nodes. */
|
|
88
|
+
readonly field: ITuiField | null;
|
|
89
|
+
}
|
|
90
|
+
/** Focusable row or button with separate focused content and attributes. */
|
|
91
|
+
export interface IButtonNode extends IRect {
|
|
92
|
+
readonly kind: 'button';
|
|
93
|
+
readonly target: IFocusTarget;
|
|
94
|
+
readonly content: string;
|
|
95
|
+
readonly focusedContent: string;
|
|
96
|
+
readonly attr: ITextAttr;
|
|
97
|
+
readonly focusedAttr: ITextAttr;
|
|
98
|
+
}
|
|
99
|
+
/** Editable text field view node. */
|
|
100
|
+
export interface IInputNode extends IRect {
|
|
101
|
+
readonly kind: 'input';
|
|
102
|
+
readonly target: IFocusTarget;
|
|
103
|
+
readonly field: ITuiField;
|
|
104
|
+
readonly value: string;
|
|
105
|
+
readonly masked: boolean;
|
|
106
|
+
readonly attr: ITextAttr;
|
|
107
|
+
}
|
|
108
|
+
export type IViewNode = ITextNode | IButtonNode | IInputNode;
|
|
109
|
+
export interface ITuiView {
|
|
110
|
+
readonly nodes: readonly IViewNode[];
|
|
111
|
+
/** Focused widget target, or `null` when the screen is too small to render controls. */
|
|
112
|
+
readonly focus: IFocusTarget | null;
|
|
113
|
+
}
|
|
114
|
+
/** Scroll offsets stored separately from the model because they depend on terminal dimensions. */
|
|
115
|
+
export interface IScrollState {
|
|
116
|
+
commands: number;
|
|
117
|
+
fields: number;
|
|
118
|
+
}
|
|
119
|
+
export interface ILayoutContext {
|
|
120
|
+
readonly width: number;
|
|
121
|
+
readonly height: number;
|
|
122
|
+
readonly theme: ITuiTheme;
|
|
123
|
+
readonly glyphs: IGlyphs;
|
|
124
|
+
readonly text: ITextTools;
|
|
125
|
+
readonly appInfo: IAppInfo;
|
|
126
|
+
readonly scroll: IScrollState;
|
|
127
|
+
}
|
|
128
|
+
export declare const MIN_WIDTH = 24;
|
|
129
|
+
export declare const MIN_HEIGHT = 7;
|
|
130
|
+
export declare function sameTarget(a: IFocusTarget | null, b: IFocusTarget | null): boolean;
|
|
131
|
+
export interface ITuiMessageLook {
|
|
132
|
+
readonly text: string;
|
|
133
|
+
readonly attr: ITextAttr;
|
|
134
|
+
/** Whether to show a problem marker before the message. */
|
|
135
|
+
readonly isProblem: boolean;
|
|
136
|
+
}
|
|
137
|
+
/** Choose the footer message: a validation error, an informational message, or key hints. */
|
|
138
|
+
export declare function messageOf(model: TuiModel, theme: ITuiTheme, glyphs: IGlyphs, text: ITextTools, width: number): ITuiMessageLook;
|
|
139
|
+
export interface IHeaderPlan {
|
|
140
|
+
/** Logo placement relative to the title: beside it, above it, or hidden. */
|
|
141
|
+
readonly logo: 'beside' | 'above' | 'none';
|
|
142
|
+
/** Editor width. Additional terminal columns remain unused. */
|
|
143
|
+
readonly width: number;
|
|
144
|
+
/** Title and description column width. */
|
|
145
|
+
readonly textWidth: number;
|
|
146
|
+
/** Number of visible description lines. */
|
|
147
|
+
readonly descriptionRows: number;
|
|
148
|
+
}
|
|
149
|
+
/** Choose logo placement, editor width, and banner text dimensions for the available terminal size. */
|
|
150
|
+
export declare function planHeader(appInfo: IAppInfo, text: ITextTools, width: number, height: number): IHeaderPlan;
|
|
151
|
+
export declare function layoutTui(model: TuiModel, context: ILayoutContext): ITuiView;
|
|
152
|
+
export {};
|