formshell 1.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/LICENSE +21 -0
- package/README.md +665 -0
- package/dist/global.d.ts +26 -0
- package/dist/index.d.ts +615 -0
- package/dist/index.js +1070 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all field types
|
|
3
|
+
*/
|
|
4
|
+
export declare class BaseField {
|
|
5
|
+
readonly type: FieldType;
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
value: FieldValue;
|
|
10
|
+
error: string | null;
|
|
11
|
+
condition?: (formData: FormData_2) => boolean;
|
|
12
|
+
constructor(config: FieldConfig);
|
|
13
|
+
/**
|
|
14
|
+
* Validate the field (to be overridden in subclasses)
|
|
15
|
+
*/
|
|
16
|
+
validate(value: FieldValue): ValidationResult;
|
|
17
|
+
/**
|
|
18
|
+
* Format the value for display
|
|
19
|
+
*/
|
|
20
|
+
format(value: FieldValue): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get the current value
|
|
23
|
+
*/
|
|
24
|
+
getValue(): FieldValue;
|
|
25
|
+
/**
|
|
26
|
+
* Set the value
|
|
27
|
+
*/
|
|
28
|
+
setValue(value: FieldValue): boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare interface BaseFieldConfig {
|
|
32
|
+
id: string;
|
|
33
|
+
type: FieldType;
|
|
34
|
+
label: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
defaultValue?: string | number | boolean | null;
|
|
38
|
+
condition?: (formData: FormData_2) => boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare interface BoxCharacters {
|
|
42
|
+
topLeft: string;
|
|
43
|
+
topRight: string;
|
|
44
|
+
bottomLeft: string;
|
|
45
|
+
bottomRight: string;
|
|
46
|
+
horizontal: string;
|
|
47
|
+
vertical: string;
|
|
48
|
+
doubleTopLeft: string;
|
|
49
|
+
doubleTopRight: string;
|
|
50
|
+
doubleBottomLeft: string;
|
|
51
|
+
doubleBottomRight: string;
|
|
52
|
+
doubleHorizontal: string;
|
|
53
|
+
doubleVertical: string;
|
|
54
|
+
filled: string;
|
|
55
|
+
empty: string;
|
|
56
|
+
halfFilled: string;
|
|
57
|
+
shadow: string[];
|
|
58
|
+
fade: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Single choice field
|
|
63
|
+
*/
|
|
64
|
+
export declare class ChoiceField extends BaseField {
|
|
65
|
+
options: Array<string | {
|
|
66
|
+
value: string;
|
|
67
|
+
label: string;
|
|
68
|
+
}>;
|
|
69
|
+
constructor(config: ChoiceFieldConfig | FieldConfig);
|
|
70
|
+
validate(value: FieldValue): ValidationResult;
|
|
71
|
+
setValue(value: FieldValue): boolean;
|
|
72
|
+
format(value: FieldValue): string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare interface ChoiceFieldConfig extends BaseFieldConfig {
|
|
76
|
+
type: 'choice';
|
|
77
|
+
options: string[] | Array<{
|
|
78
|
+
value: string;
|
|
79
|
+
label: string;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* FormShell Theme - Elegant Design System
|
|
85
|
+
* Color palette, Unicode icons, box styles for elegant console rendering
|
|
86
|
+
*/
|
|
87
|
+
declare interface ColorPalette {
|
|
88
|
+
primary: string;
|
|
89
|
+
secondary: string;
|
|
90
|
+
accent: string;
|
|
91
|
+
success: string;
|
|
92
|
+
error: string;
|
|
93
|
+
warning: string;
|
|
94
|
+
info: string;
|
|
95
|
+
text: {
|
|
96
|
+
primary: string;
|
|
97
|
+
secondary: string;
|
|
98
|
+
muted: string;
|
|
99
|
+
dark: string;
|
|
100
|
+
};
|
|
101
|
+
background: {
|
|
102
|
+
main: string;
|
|
103
|
+
secondary: string;
|
|
104
|
+
accent: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Date field (format DD/MM/YYYY)
|
|
110
|
+
*/
|
|
111
|
+
export declare class DateField extends TextField {
|
|
112
|
+
constructor(config: FieldConfig);
|
|
113
|
+
validate(value: FieldValue): ValidationResult;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare interface DateFieldConfig extends BaseFieldConfig {
|
|
117
|
+
type: 'date';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Email field
|
|
122
|
+
*/
|
|
123
|
+
export declare class EmailField extends TextField {
|
|
124
|
+
constructor(config: FieldConfig);
|
|
125
|
+
validate(value: FieldValue): ValidationResult;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export declare interface EmailFieldConfig extends BaseFieldConfig {
|
|
129
|
+
type: 'email';
|
|
130
|
+
minLength?: number;
|
|
131
|
+
maxLength?: number;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export declare type FieldConfig = TextFieldConfig | NumberFieldConfig | EmailFieldConfig | URLFieldConfig | DateFieldConfig | ChoiceFieldConfig | MultipleChoiceFieldConfig | RatingFieldConfig | YesNoFieldConfig;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Factory to create fields from type
|
|
138
|
+
*/
|
|
139
|
+
export declare const FieldFactory: {
|
|
140
|
+
create(config: FieldConfig): BaseField;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export declare interface FieldInstance {
|
|
144
|
+
readonly type: FieldType;
|
|
145
|
+
id: string;
|
|
146
|
+
label: string;
|
|
147
|
+
required: boolean;
|
|
148
|
+
value: FieldValue;
|
|
149
|
+
error: string | null;
|
|
150
|
+
condition?: (formData: FormData_2) => boolean;
|
|
151
|
+
validate(value: FieldValue): ValidationResult;
|
|
152
|
+
format(value: FieldValue): string;
|
|
153
|
+
getValue(): FieldValue;
|
|
154
|
+
setValue(value: FieldValue): boolean;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Core TypeScript types for FormShell
|
|
159
|
+
*/
|
|
160
|
+
export declare type FieldType = 'text' | 'number' | 'email' | 'url' | 'date' | 'choice' | 'multiple-choice' | 'rating' | 'yesno';
|
|
161
|
+
|
|
162
|
+
export declare type FieldValue = string | number | boolean | string[] | null;
|
|
163
|
+
|
|
164
|
+
declare interface FormatFunctions {
|
|
165
|
+
title: (text: string) => [string, string];
|
|
166
|
+
subtitle: (text: string) => [string, string];
|
|
167
|
+
body: (text: string) => [string, string];
|
|
168
|
+
success: (text: string) => [string, string];
|
|
169
|
+
error: (text: string) => [string, string];
|
|
170
|
+
muted: (text: string) => [string, string];
|
|
171
|
+
highlight: (text: string) => [string, string];
|
|
172
|
+
colored: (text: string, color: string) => [string, string];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export declare interface FormConfig {
|
|
176
|
+
title: string;
|
|
177
|
+
subtitle?: string;
|
|
178
|
+
endpoint?: string;
|
|
179
|
+
steps: FieldConfig[];
|
|
180
|
+
onComplete?: (data: FormData_2) => void | Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare interface FormData_2 {
|
|
184
|
+
[fieldId: string]: FieldValue;
|
|
185
|
+
}
|
|
186
|
+
export { FormData_2 as FormData }
|
|
187
|
+
|
|
188
|
+
declare class FormShell {
|
|
189
|
+
title: string;
|
|
190
|
+
subtitle: string | null;
|
|
191
|
+
endpoint: string | null;
|
|
192
|
+
onComplete: ((data: FormData_2) => void | Promise<void>) | null;
|
|
193
|
+
steps: Step[];
|
|
194
|
+
private currentStepIndex;
|
|
195
|
+
private renderer;
|
|
196
|
+
private started;
|
|
197
|
+
private completed;
|
|
198
|
+
private startTime;
|
|
199
|
+
private helpActive;
|
|
200
|
+
constructor(config: FormConfig);
|
|
201
|
+
/**
|
|
202
|
+
* Initialize steps with appropriate field types
|
|
203
|
+
*/
|
|
204
|
+
private initializeSteps;
|
|
205
|
+
/**
|
|
206
|
+
* Show welcome screen
|
|
207
|
+
*/
|
|
208
|
+
private showWelcome;
|
|
209
|
+
/**
|
|
210
|
+
* Show help screen with commands.
|
|
211
|
+
* Can be called at any time without interrupting the form flow.
|
|
212
|
+
* Use formShell.continue() to resume where you left off.
|
|
213
|
+
*/
|
|
214
|
+
help(): void;
|
|
215
|
+
/**
|
|
216
|
+
* Start the form (only from welcome screen)
|
|
217
|
+
*/
|
|
218
|
+
start(): void;
|
|
219
|
+
/**
|
|
220
|
+
* Resume the form after viewing help
|
|
221
|
+
*/
|
|
222
|
+
continue(): void;
|
|
223
|
+
/**
|
|
224
|
+
* Check if a step should be shown based on its condition
|
|
225
|
+
*/
|
|
226
|
+
private shouldShowStep;
|
|
227
|
+
/**
|
|
228
|
+
* Get next visible step index
|
|
229
|
+
*/
|
|
230
|
+
private getNextVisibleStep;
|
|
231
|
+
/**
|
|
232
|
+
* Get previous visible step index
|
|
233
|
+
*/
|
|
234
|
+
private getPreviousVisibleStep;
|
|
235
|
+
/**
|
|
236
|
+
* Advance to next step (internal method)
|
|
237
|
+
*/
|
|
238
|
+
private _advanceStep;
|
|
239
|
+
/**
|
|
240
|
+
* Go back to previous step
|
|
241
|
+
*/
|
|
242
|
+
back(): void;
|
|
243
|
+
/**
|
|
244
|
+
* Answer the current question
|
|
245
|
+
*/
|
|
246
|
+
answer(value: string | number): void;
|
|
247
|
+
/**
|
|
248
|
+
* Shortcut to answer "Yes"
|
|
249
|
+
*/
|
|
250
|
+
y(): void;
|
|
251
|
+
/**
|
|
252
|
+
* Shortcut to answer "No"
|
|
253
|
+
*/
|
|
254
|
+
n(): void;
|
|
255
|
+
/**
|
|
256
|
+
* Skip the current question (only if not required)
|
|
257
|
+
*/
|
|
258
|
+
skip(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Reset the form
|
|
261
|
+
*/
|
|
262
|
+
reset(): void;
|
|
263
|
+
/**
|
|
264
|
+
* Submit data to server
|
|
265
|
+
*/
|
|
266
|
+
submit(): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* Collect all form data
|
|
269
|
+
*/
|
|
270
|
+
private collectData;
|
|
271
|
+
/**
|
|
272
|
+
* Calculate completion percentage
|
|
273
|
+
*/
|
|
274
|
+
getProgress(): ProgressInfo;
|
|
275
|
+
/**
|
|
276
|
+
* Estimate remaining time
|
|
277
|
+
*/
|
|
278
|
+
getEstimatedTime(): string | null;
|
|
279
|
+
/**
|
|
280
|
+
* Render the current step
|
|
281
|
+
*/
|
|
282
|
+
private renderCurrentStep;
|
|
283
|
+
/**
|
|
284
|
+
* Get the visible step number (position among visible steps)
|
|
285
|
+
*/
|
|
286
|
+
private getVisibleStepNumber;
|
|
287
|
+
/**
|
|
288
|
+
* Render a field based on its type
|
|
289
|
+
*/
|
|
290
|
+
private renderField;
|
|
291
|
+
/**
|
|
292
|
+
* Get a placeholder for the field
|
|
293
|
+
*/
|
|
294
|
+
private getPlaceholder;
|
|
295
|
+
/**
|
|
296
|
+
* Show final summary
|
|
297
|
+
*/
|
|
298
|
+
private showSummary;
|
|
299
|
+
/**
|
|
300
|
+
* Cleanup when form is destroyed
|
|
301
|
+
*/
|
|
302
|
+
destroy(): void;
|
|
303
|
+
}
|
|
304
|
+
export { FormShell }
|
|
305
|
+
export default FormShell;
|
|
306
|
+
|
|
307
|
+
declare interface Icons {
|
|
308
|
+
checkmark: string;
|
|
309
|
+
cross: string;
|
|
310
|
+
star: string;
|
|
311
|
+
starEmpty: string;
|
|
312
|
+
arrow: string;
|
|
313
|
+
bullet: string;
|
|
314
|
+
bulletEmpty: string;
|
|
315
|
+
chevron: string;
|
|
316
|
+
heart: string;
|
|
317
|
+
info: string;
|
|
318
|
+
warning: string;
|
|
319
|
+
question: string;
|
|
320
|
+
cursor: string;
|
|
321
|
+
cursorBlink: string;
|
|
322
|
+
spinner: string[];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Multiple choice field
|
|
327
|
+
*/
|
|
328
|
+
export declare class MultipleChoiceField extends BaseField {
|
|
329
|
+
options: Array<string | {
|
|
330
|
+
value: string;
|
|
331
|
+
label: string;
|
|
332
|
+
}>;
|
|
333
|
+
minChoices: number;
|
|
334
|
+
maxChoices: number;
|
|
335
|
+
constructor(config: MultipleChoiceFieldConfig | FieldConfig);
|
|
336
|
+
validate(value: FieldValue): ValidationResult;
|
|
337
|
+
setValue(value: FieldValue): boolean;
|
|
338
|
+
format(value: FieldValue): string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export declare interface MultipleChoiceFieldConfig extends BaseFieldConfig {
|
|
342
|
+
type: 'multiple-choice';
|
|
343
|
+
options: string[] | Array<{
|
|
344
|
+
value: string;
|
|
345
|
+
label: string;
|
|
346
|
+
}>;
|
|
347
|
+
minChoices?: number;
|
|
348
|
+
maxChoices?: number;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Numeric field
|
|
353
|
+
*/
|
|
354
|
+
export declare class NumberField extends BaseField {
|
|
355
|
+
min: number | null;
|
|
356
|
+
max: number | null;
|
|
357
|
+
integer: boolean;
|
|
358
|
+
constructor(config: NumberFieldConfig | FieldConfig);
|
|
359
|
+
validate(value: FieldValue): ValidationResult;
|
|
360
|
+
format(value: FieldValue): string;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export declare interface NumberFieldConfig extends BaseFieldConfig {
|
|
364
|
+
type: 'number';
|
|
365
|
+
min?: number;
|
|
366
|
+
max?: number;
|
|
367
|
+
integer?: boolean;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* FormShell TUI Renderer
|
|
372
|
+
* Handles elegant rendering in the browser console
|
|
373
|
+
* Includes blinking cursor, animations, Unicode boxes, and CSS styling
|
|
374
|
+
*/
|
|
375
|
+
declare interface ProgressBarResult {
|
|
376
|
+
bar: string;
|
|
377
|
+
percentage: number;
|
|
378
|
+
text: string;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export declare interface ProgressInfo {
|
|
382
|
+
current: number;
|
|
383
|
+
total: number;
|
|
384
|
+
percentage: number;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Rating field (scale 1-5 with stars)
|
|
389
|
+
*/
|
|
390
|
+
export declare class RatingField extends NumberField {
|
|
391
|
+
constructor(config: RatingFieldConfig | FieldConfig);
|
|
392
|
+
validate(value: FieldValue): ValidationResult;
|
|
393
|
+
format(value: FieldValue): string;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export declare interface RatingFieldConfig extends BaseFieldConfig {
|
|
397
|
+
type: 'rating';
|
|
398
|
+
min?: number;
|
|
399
|
+
max?: number;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export declare interface Step {
|
|
403
|
+
id: string;
|
|
404
|
+
field: FieldInstance;
|
|
405
|
+
description: string | null;
|
|
406
|
+
answered: boolean;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
declare interface StylePreset {
|
|
410
|
+
[key: string]: string | undefined;
|
|
411
|
+
color: string;
|
|
412
|
+
fontSize: string;
|
|
413
|
+
fontWeight?: string;
|
|
414
|
+
fontStyle?: string;
|
|
415
|
+
lineHeight?: string;
|
|
416
|
+
textShadow?: string;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
declare interface StylePresets {
|
|
420
|
+
title: StylePreset;
|
|
421
|
+
subtitle: StylePreset;
|
|
422
|
+
body: StylePreset;
|
|
423
|
+
success: StylePreset;
|
|
424
|
+
error: StylePreset;
|
|
425
|
+
muted: StylePreset;
|
|
426
|
+
highlight: StylePreset;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Free text field
|
|
431
|
+
*/
|
|
432
|
+
export declare class TextField extends BaseField {
|
|
433
|
+
minLength: number | null;
|
|
434
|
+
maxLength: number | null;
|
|
435
|
+
pattern: RegExp | null;
|
|
436
|
+
constructor(config: TextFieldConfig | FieldConfig);
|
|
437
|
+
validate(value: FieldValue): ValidationResult;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export declare interface TextFieldConfig extends BaseFieldConfig {
|
|
441
|
+
type: 'text';
|
|
442
|
+
minLength?: number;
|
|
443
|
+
maxLength?: number;
|
|
444
|
+
pattern?: RegExp;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
declare interface TextFormatters {
|
|
448
|
+
bold: (text: string) => string;
|
|
449
|
+
italic: (text: string) => string;
|
|
450
|
+
underline: (text: string) => string;
|
|
451
|
+
boldUnicode: (text: string) => string;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export declare const Theme: ThemeType;
|
|
455
|
+
|
|
456
|
+
declare interface ThemeType {
|
|
457
|
+
colors: ColorPalette;
|
|
458
|
+
icons: Icons;
|
|
459
|
+
box: BoxCharacters;
|
|
460
|
+
text: TextFormatters;
|
|
461
|
+
styles: StylePresets;
|
|
462
|
+
createStyle: (styleObj: Record<string, string | undefined>) => string;
|
|
463
|
+
format: FormatFunctions;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export declare class TUIRenderer {
|
|
467
|
+
private cursorVisible;
|
|
468
|
+
private cursorInterval;
|
|
469
|
+
constructor();
|
|
470
|
+
/**
|
|
471
|
+
* Initialize the renderer and start cursor blinking
|
|
472
|
+
*/
|
|
473
|
+
init(): void;
|
|
474
|
+
/**
|
|
475
|
+
* Clear the console
|
|
476
|
+
*/
|
|
477
|
+
clear(): void;
|
|
478
|
+
/**
|
|
479
|
+
* Start the cursor blinking animation
|
|
480
|
+
*/
|
|
481
|
+
startCursorBlink(): void;
|
|
482
|
+
/**
|
|
483
|
+
* Stop the cursor animation
|
|
484
|
+
*/
|
|
485
|
+
stopCursorBlink(): void;
|
|
486
|
+
/**
|
|
487
|
+
* Get the current cursor character
|
|
488
|
+
*/
|
|
489
|
+
getCursor(): string;
|
|
490
|
+
/**
|
|
491
|
+
* Create a decorative horizontal line
|
|
492
|
+
*/
|
|
493
|
+
createHorizontalLine(width?: number, char?: string): string;
|
|
494
|
+
/**
|
|
495
|
+
* Create a box with Unicode borders
|
|
496
|
+
*/
|
|
497
|
+
createBox(content: string | string[], width?: number, style?: 'single' | 'double'): string[];
|
|
498
|
+
/**
|
|
499
|
+
* Create an elegant progress bar
|
|
500
|
+
*/
|
|
501
|
+
createProgressBar(current: number, total: number, width?: number): ProgressBarResult;
|
|
502
|
+
/**
|
|
503
|
+
* Render the main title with style
|
|
504
|
+
*/
|
|
505
|
+
renderTitle(title: string): void;
|
|
506
|
+
/**
|
|
507
|
+
* Render the subtitle with style
|
|
508
|
+
*/
|
|
509
|
+
renderSubtitle(subtitle: string): void;
|
|
510
|
+
/**
|
|
511
|
+
* Render normal text
|
|
512
|
+
*/
|
|
513
|
+
renderText(text: string, color?: string | null): void;
|
|
514
|
+
/**
|
|
515
|
+
* Render a success message
|
|
516
|
+
*/
|
|
517
|
+
renderSuccess(message: string): void;
|
|
518
|
+
/**
|
|
519
|
+
* Render an error message
|
|
520
|
+
*/
|
|
521
|
+
renderError(message: string): void;
|
|
522
|
+
/**
|
|
523
|
+
* Render muted/secondary text
|
|
524
|
+
*/
|
|
525
|
+
renderMuted(text: string): void;
|
|
526
|
+
/**
|
|
527
|
+
* Render highlighted text
|
|
528
|
+
*/
|
|
529
|
+
renderHighlight(text: string): void;
|
|
530
|
+
/**
|
|
531
|
+
* Render a complete box
|
|
532
|
+
*/
|
|
533
|
+
renderBox(content: string | string[], width?: number, style?: 'single' | 'double'): void;
|
|
534
|
+
/**
|
|
535
|
+
* Render a separator line
|
|
536
|
+
*/
|
|
537
|
+
renderSeparator(width?: number, char?: string): void;
|
|
538
|
+
/**
|
|
539
|
+
* Render the progress bar with info
|
|
540
|
+
*/
|
|
541
|
+
renderProgress(current: number, total: number, label?: string): void;
|
|
542
|
+
/**
|
|
543
|
+
* Render a list of options
|
|
544
|
+
*/
|
|
545
|
+
renderOptions(options: string[], highlightIndex?: number | null): void;
|
|
546
|
+
/**
|
|
547
|
+
* Render an input field with cursor
|
|
548
|
+
*/
|
|
549
|
+
renderInput(label: string, value?: string, showCursor?: boolean): void;
|
|
550
|
+
/**
|
|
551
|
+
* Render a yes/no question
|
|
552
|
+
*/
|
|
553
|
+
renderYesNo(question: string, value?: boolean | null, yesLabel?: string, noLabel?: string): void;
|
|
554
|
+
/**
|
|
555
|
+
* Render rating with stars
|
|
556
|
+
*/
|
|
557
|
+
renderRating(label: string, value?: number, max?: number): void;
|
|
558
|
+
/**
|
|
559
|
+
* Render a summary with key-value data
|
|
560
|
+
*/
|
|
561
|
+
renderSummary(title: string, data: Record<string, unknown>): void;
|
|
562
|
+
/**
|
|
563
|
+
* Render a help/commands message
|
|
564
|
+
*/
|
|
565
|
+
renderHelp(commands: Array<{
|
|
566
|
+
command: string;
|
|
567
|
+
description: string;
|
|
568
|
+
}>, title?: string): void;
|
|
569
|
+
/**
|
|
570
|
+
* Render an animated welcome message
|
|
571
|
+
*/
|
|
572
|
+
renderWelcome(title: string, subtitle?: string | null): void;
|
|
573
|
+
/**
|
|
574
|
+
* Render a spinner/loader (static, not animated)
|
|
575
|
+
*/
|
|
576
|
+
renderLoader(message?: string): void;
|
|
577
|
+
/**
|
|
578
|
+
* Cleanup the renderer
|
|
579
|
+
*/
|
|
580
|
+
destroy(): void;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* URL field
|
|
585
|
+
*/
|
|
586
|
+
export declare class URLField extends TextField {
|
|
587
|
+
constructor(config: FieldConfig);
|
|
588
|
+
validate(value: FieldValue): ValidationResult;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export declare interface URLFieldConfig extends BaseFieldConfig {
|
|
592
|
+
type: 'url';
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export declare interface ValidationResult {
|
|
596
|
+
valid: boolean;
|
|
597
|
+
error?: string;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Yes/No field
|
|
602
|
+
*/
|
|
603
|
+
export declare class YesNoField extends BaseField {
|
|
604
|
+
constructor(config: FieldConfig);
|
|
605
|
+
validate(value: FieldValue): ValidationResult;
|
|
606
|
+
setValue(value: FieldValue): boolean;
|
|
607
|
+
format(value: FieldValue): string;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export declare interface YesNoFieldConfig extends BaseFieldConfig {
|
|
611
|
+
type: 'yesno';
|
|
612
|
+
defaultValue?: boolean;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
export { }
|