mepcli 2.0.0-beta.2 → 2.0.0-beta.3
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/ansi.d.ts +36 -0
- package/dist/ansi.js +1 -0
- package/dist/base.d.ts +60 -0
- package/dist/base.js +1 -0
- package/dist/{src/core.js → core.d.ts} +175 -345
- package/dist/core.js +1 -0
- package/dist/data/countries.d.ts +2 -0
- package/dist/data/countries.js +1 -0
- package/dist/data/licenses.d.ts +2 -0
- package/dist/data/licenses.js +1 -0
- package/dist/highlight.d.ts +7 -0
- package/dist/highlight.js +1 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +1 -0
- package/dist/input.d.ts +14 -0
- package/dist/input.js +1 -0
- package/dist/pipeline.d.ts +90 -0
- package/dist/pipeline.js +1 -0
- package/dist/prompts/autocomplete.d.ts +22 -0
- package/dist/prompts/autocomplete.js +1 -0
- package/dist/prompts/box.d.ts +21 -0
- package/dist/prompts/box.js +4 -0
- package/dist/prompts/breadcrumb-search.d.ts +14 -0
- package/dist/prompts/breadcrumb-search.js +2 -0
- package/dist/prompts/breadcrumb.d.ts +32 -0
- package/dist/prompts/breadcrumb.js +3 -0
- package/dist/prompts/byte.d.ts +13 -0
- package/dist/prompts/byte.js +5 -0
- package/dist/prompts/calculator.d.ts +17 -0
- package/dist/prompts/calculator.js +3 -0
- package/dist/prompts/calendar.d.ts +33 -0
- package/dist/prompts/calendar.js +3 -0
- package/dist/prompts/checkbox.d.ts +13 -0
- package/dist/prompts/checkbox.js +2 -0
- package/dist/prompts/code.d.ts +19 -0
- package/dist/prompts/code.js +4 -0
- package/dist/prompts/color.d.ts +14 -0
- package/dist/prompts/color.js +10 -0
- package/dist/prompts/confirm.d.ts +8 -0
- package/dist/prompts/confirm.js +1 -0
- package/dist/prompts/connection-string.d.ts +18 -0
- package/dist/prompts/connection-string.js +1 -0
- package/dist/prompts/cron.d.ts +13 -0
- package/dist/prompts/cron.js +4 -0
- package/dist/prompts/curl-utils.d.ts +25 -0
- package/dist/prompts/curl-utils.js +1 -0
- package/dist/prompts/curl.d.ts +41 -0
- package/dist/prompts/curl.js +12 -0
- package/dist/prompts/data-inspector.d.ts +22 -0
- package/dist/prompts/data-inspector.js +5 -0
- package/dist/prompts/date.d.ts +12 -0
- package/dist/prompts/date.js +2 -0
- package/dist/prompts/dependency.d.ts +16 -0
- package/dist/prompts/dependency.js +3 -0
- package/dist/prompts/dial.d.ts +10 -0
- package/dist/prompts/dial.js +3 -0
- package/dist/prompts/diff.d.ts +10 -0
- package/dist/prompts/diff.js +10 -0
- package/dist/prompts/draw.d.ts +20 -0
- package/dist/prompts/draw.js +6 -0
- package/dist/prompts/editor.d.ts +14 -0
- package/dist/prompts/editor.js +2 -0
- package/dist/prompts/emoji.d.ts +18 -0
- package/dist/prompts/emoji.js +5 -0
- package/dist/prompts/exec.d.ts +17 -0
- package/dist/prompts/exec.js +1 -0
- package/dist/prompts/file.d.ts +21 -0
- package/dist/prompts/file.js +2 -0
- package/dist/prompts/form.d.ts +18 -0
- package/dist/prompts/form.js +1 -0
- package/dist/prompts/fuzzy-multi-column.d.ts +12 -0
- package/dist/prompts/fuzzy-multi-column.js +2 -0
- package/dist/prompts/fuzzy.d.ts +12 -0
- package/dist/prompts/fuzzy.js +2 -0
- package/dist/prompts/gauge.d.ts +21 -0
- package/dist/prompts/gauge.js +4 -0
- package/dist/prompts/grid.d.ts +14 -0
- package/dist/prompts/grid.js +2 -0
- package/dist/prompts/heatmap.d.ts +13 -0
- package/dist/prompts/heatmap.js +2 -0
- package/dist/prompts/ip.d.ts +11 -0
- package/dist/prompts/ip.js +3 -0
- package/dist/prompts/kanban.d.ts +17 -0
- package/dist/prompts/kanban.js +4 -0
- package/dist/prompts/keypress.d.ts +7 -0
- package/dist/prompts/keypress.js +1 -0
- package/dist/prompts/license.d.ts +9 -0
- package/dist/prompts/license.js +13 -0
- package/dist/prompts/list.d.ts +9 -0
- package/dist/prompts/list.js +1 -0
- package/dist/prompts/map.d.ts +17 -0
- package/dist/prompts/map.js +5 -0
- package/dist/prompts/match.d.ts +19 -0
- package/dist/prompts/match.js +7 -0
- package/dist/prompts/miller.d.ts +15 -0
- package/dist/prompts/miller.js +2 -0
- package/dist/prompts/multi-column-select.d.ts +10 -0
- package/dist/prompts/multi-column-select.js +2 -0
- package/dist/prompts/multi-range.d.ts +9 -0
- package/dist/prompts/multi-range.js +3 -0
- package/dist/prompts/multi-select.d.ts +15 -0
- package/dist/prompts/multi-select.js +4 -0
- package/dist/prompts/number.d.ts +11 -0
- package/dist/prompts/number.js +2 -0
- package/dist/prompts/otp.d.ts +10 -0
- package/dist/prompts/otp.js +2 -0
- package/dist/prompts/pattern.d.ts +22 -0
- package/dist/prompts/pattern.js +4 -0
- package/dist/prompts/phone.d.ts +41 -0
- package/dist/prompts/phone.js +3 -0
- package/dist/prompts/quiz-select.d.ts +10 -0
- package/dist/prompts/quiz-select.js +7 -0
- package/dist/prompts/quiz-text.d.ts +11 -0
- package/dist/prompts/quiz-text.js +8 -0
- package/dist/prompts/range.d.ts +9 -0
- package/dist/prompts/range.js +1 -0
- package/dist/prompts/rating.d.ts +8 -0
- package/dist/prompts/rating.js +1 -0
- package/dist/prompts/regex.d.ts +13 -0
- package/dist/prompts/regex.js +5 -0
- package/dist/prompts/region.d.ts +11 -0
- package/dist/prompts/region.js +5 -0
- package/dist/prompts/schedule.d.ts +20 -0
- package/dist/prompts/schedule.js +5 -0
- package/dist/prompts/scroll.d.ts +13 -0
- package/dist/prompts/scroll.js +1 -0
- package/dist/prompts/seat.d.ts +17 -0
- package/dist/prompts/seat.js +5 -0
- package/dist/prompts/select-range.d.ts +8 -0
- package/dist/prompts/select-range.js +3 -0
- package/dist/prompts/select.d.ts +15 -0
- package/dist/prompts/select.js +2 -0
- package/dist/prompts/semver.d.ts +6 -0
- package/dist/prompts/semver.js +1 -0
- package/dist/prompts/shortcut.d.ts +9 -0
- package/dist/prompts/shortcut.js +1 -0
- package/dist/prompts/slider.d.ts +8 -0
- package/dist/prompts/slider.js +1 -0
- package/dist/prompts/slot.d.ts +16 -0
- package/dist/prompts/slot.js +8 -0
- package/dist/prompts/snippet.d.ts +19 -0
- package/dist/prompts/snippet.js +4 -0
- package/dist/prompts/sort-grid.d.ts +16 -0
- package/dist/prompts/sort-grid.js +2 -0
- package/dist/prompts/sort.d.ts +14 -0
- package/dist/prompts/sort.js +2 -0
- package/dist/prompts/spam.d.ts +17 -0
- package/dist/prompts/spam.js +2 -0
- package/dist/prompts/spreadsheet.d.ts +21 -0
- package/dist/prompts/spreadsheet.js +7 -0
- package/dist/prompts/table.d.ts +14 -0
- package/dist/prompts/table.js +3 -0
- package/dist/prompts/text.d.ts +17 -0
- package/dist/prompts/text.js +2 -0
- package/dist/prompts/time.d.ts +12 -0
- package/dist/prompts/time.js +2 -0
- package/dist/prompts/toggle.d.ts +8 -0
- package/dist/prompts/toggle.js +1 -0
- package/dist/prompts/transfer.d.ts +18 -0
- package/dist/prompts/transfer.js +5 -0
- package/dist/prompts/tree-select.d.ts +31 -0
- package/dist/prompts/tree-select.js +3 -0
- package/dist/prompts/tree.d.ts +20 -0
- package/dist/prompts/tree.js +3 -0
- package/dist/prompts/wait.d.ts +18 -0
- package/dist/prompts/wait.js +1 -0
- package/dist/spinner.d.ts +33 -0
- package/dist/spinner.js +3 -0
- package/dist/symbols.d.ts +33 -0
- package/dist/symbols.js +1 -0
- package/dist/tasks.d.ts +57 -0
- package/dist/tasks.js +1 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +1 -0
- package/dist/types.d.ts +503 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +81 -0
- package/dist/utils.js +1 -0
- package/package.json +8 -9
- package/dist/src/ansi.js +0 -50
- package/dist/src/ansi.js.map +0 -1
- package/dist/src/base.js +0 -258
- package/dist/src/base.js.map +0 -1
- package/dist/src/core.js.map +0 -1
- package/dist/src/data/countries.js +0 -569
- package/dist/src/data/countries.js.map +0 -1
- package/dist/src/data/licenses.js +0 -480
- package/dist/src/data/licenses.js.map +0 -1
- package/dist/src/highlight.js +0 -185
- package/dist/src/highlight.js.map +0 -1
- package/dist/src/index.js +0 -66
- package/dist/src/index.js.map +0 -1
- package/dist/src/input.js +0 -158
- package/dist/src/input.js.map +0 -1
- package/dist/src/pipeline.js +0 -273
- package/dist/src/pipeline.js.map +0 -1
- package/dist/src/prompts/autocomplete.js +0 -171
- package/dist/src/prompts/autocomplete.js.map +0 -1
- package/dist/src/prompts/box.js +0 -225
- package/dist/src/prompts/box.js.map +0 -1
- package/dist/src/prompts/breadcrumb-search.js +0 -260
- package/dist/src/prompts/breadcrumb-search.js.map +0 -1
- package/dist/src/prompts/breadcrumb.js +0 -307
- package/dist/src/prompts/breadcrumb.js.map +0 -1
- package/dist/src/prompts/byte.js +0 -176
- package/dist/src/prompts/byte.js.map +0 -1
- package/dist/src/prompts/calculator.js +0 -243
- package/dist/src/prompts/calculator.js.map +0 -1
- package/dist/src/prompts/calendar.js +0 -430
- package/dist/src/prompts/calendar.js.map +0 -1
- package/dist/src/prompts/checkbox.js +0 -159
- package/dist/src/prompts/checkbox.js.map +0 -1
- package/dist/src/prompts/code.js +0 -271
- package/dist/src/prompts/code.js.map +0 -1
- package/dist/src/prompts/color.js +0 -165
- package/dist/src/prompts/color.js.map +0 -1
- package/dist/src/prompts/confirm.js +0 -55
- package/dist/src/prompts/confirm.js.map +0 -1
- package/dist/src/prompts/connection-string.js +0 -120
- package/dist/src/prompts/connection-string.js.map +0 -1
- package/dist/src/prompts/cron.js +0 -207
- package/dist/src/prompts/cron.js.map +0 -1
- package/dist/src/prompts/curl-utils.js +0 -71
- package/dist/src/prompts/curl-utils.js.map +0 -1
- package/dist/src/prompts/curl.js +0 -431
- package/dist/src/prompts/curl.js.map +0 -1
- package/dist/src/prompts/data-inspector.js +0 -261
- package/dist/src/prompts/data-inspector.js.map +0 -1
- package/dist/src/prompts/date.js +0 -185
- package/dist/src/prompts/date.js.map +0 -1
- package/dist/src/prompts/dependency.js +0 -283
- package/dist/src/prompts/dependency.js.map +0 -1
- package/dist/src/prompts/dial.js +0 -124
- package/dist/src/prompts/dial.js.map +0 -1
- package/dist/src/prompts/diff.js +0 -118
- package/dist/src/prompts/diff.js.map +0 -1
- package/dist/src/prompts/draw.js +0 -191
- package/dist/src/prompts/draw.js.map +0 -1
- package/dist/src/prompts/editor.js +0 -234
- package/dist/src/prompts/editor.js.map +0 -1
- package/dist/src/prompts/emoji.js +0 -226
- package/dist/src/prompts/emoji.js.map +0 -1
- package/dist/src/prompts/exec.js +0 -151
- package/dist/src/prompts/exec.js.map +0 -1
- package/dist/src/prompts/file.js +0 -217
- package/dist/src/prompts/file.js.map +0 -1
- package/dist/src/prompts/form.js +0 -241
- package/dist/src/prompts/form.js.map +0 -1
- package/dist/src/prompts/fuzzy-multi-column.js +0 -161
- package/dist/src/prompts/fuzzy-multi-column.js.map +0 -1
- package/dist/src/prompts/fuzzy.js +0 -147
- package/dist/src/prompts/fuzzy.js.map +0 -1
- package/dist/src/prompts/gauge.js +0 -137
- package/dist/src/prompts/gauge.js.map +0 -1
- package/dist/src/prompts/grid.js +0 -191
- package/dist/src/prompts/grid.js.map +0 -1
- package/dist/src/prompts/heatmap.js +0 -147
- package/dist/src/prompts/heatmap.js.map +0 -1
- package/dist/src/prompts/ip.js +0 -138
- package/dist/src/prompts/ip.js.map +0 -1
- package/dist/src/prompts/kanban.js +0 -233
- package/dist/src/prompts/kanban.js.map +0 -1
- package/dist/src/prompts/keypress.js +0 -54
- package/dist/src/prompts/keypress.js.map +0 -1
- package/dist/src/prompts/license.js +0 -144
- package/dist/src/prompts/license.js.map +0 -1
- package/dist/src/prompts/list.js +0 -124
- package/dist/src/prompts/list.js.map +0 -1
- package/dist/src/prompts/map.js +0 -262
- package/dist/src/prompts/map.js.map +0 -1
- package/dist/src/prompts/match.js +0 -271
- package/dist/src/prompts/match.js.map +0 -1
- package/dist/src/prompts/miller.js +0 -228
- package/dist/src/prompts/miller.js.map +0 -1
- package/dist/src/prompts/multi-column-select.js +0 -176
- package/dist/src/prompts/multi-column-select.js.map +0 -1
- package/dist/src/prompts/multi-range.js +0 -189
- package/dist/src/prompts/multi-range.js.map +0 -1
- package/dist/src/prompts/multi-select.js +0 -183
- package/dist/src/prompts/multi-select.js.map +0 -1
- package/dist/src/prompts/number.js +0 -166
- package/dist/src/prompts/number.js.map +0 -1
- package/dist/src/prompts/otp.js +0 -107
- package/dist/src/prompts/otp.js.map +0 -1
- package/dist/src/prompts/pattern.js +0 -252
- package/dist/src/prompts/pattern.js.map +0 -1
- package/dist/src/prompts/phone.js +0 -398
- package/dist/src/prompts/phone.js.map +0 -1
- package/dist/src/prompts/quiz-select.js +0 -114
- package/dist/src/prompts/quiz-select.js.map +0 -1
- package/dist/src/prompts/quiz-text.js +0 -98
- package/dist/src/prompts/quiz-text.js.map +0 -1
- package/dist/src/prompts/range.js +0 -164
- package/dist/src/prompts/range.js.map +0 -1
- package/dist/src/prompts/rating.js +0 -83
- package/dist/src/prompts/rating.js.map +0 -1
- package/dist/src/prompts/regex.js +0 -145
- package/dist/src/prompts/regex.js.map +0 -1
- package/dist/src/prompts/region.js +0 -170
- package/dist/src/prompts/region.js.map +0 -1
- package/dist/src/prompts/schedule.js +0 -270
- package/dist/src/prompts/schedule.js.map +0 -1
- package/dist/src/prompts/scroll.js +0 -155
- package/dist/src/prompts/scroll.js.map +0 -1
- package/dist/src/prompts/seat.js +0 -164
- package/dist/src/prompts/seat.js.map +0 -1
- package/dist/src/prompts/select-range.js +0 -148
- package/dist/src/prompts/select-range.js.map +0 -1
- package/dist/src/prompts/select.js +0 -163
- package/dist/src/prompts/select.js.map +0 -1
- package/dist/src/prompts/semver.js +0 -43
- package/dist/src/prompts/semver.js.map +0 -1
- package/dist/src/prompts/shortcut.js +0 -133
- package/dist/src/prompts/shortcut.js.map +0 -1
- package/dist/src/prompts/slider.js +0 -69
- package/dist/src/prompts/slider.js.map +0 -1
- package/dist/src/prompts/slot.js +0 -117
- package/dist/src/prompts/slot.js.map +0 -1
- package/dist/src/prompts/snippet.js +0 -228
- package/dist/src/prompts/snippet.js.map +0 -1
- package/dist/src/prompts/sort-grid.js +0 -151
- package/dist/src/prompts/sort-grid.js.map +0 -1
- package/dist/src/prompts/sort.js +0 -166
- package/dist/src/prompts/sort.js.map +0 -1
- package/dist/src/prompts/spam.js +0 -80
- package/dist/src/prompts/spam.js.map +0 -1
- package/dist/src/prompts/spreadsheet.js +0 -240
- package/dist/src/prompts/spreadsheet.js.map +0 -1
- package/dist/src/prompts/table.js +0 -120
- package/dist/src/prompts/table.js.map +0 -1
- package/dist/src/prompts/text.js +0 -317
- package/dist/src/prompts/text.js.map +0 -1
- package/dist/src/prompts/time.js +0 -211
- package/dist/src/prompts/time.js.map +0 -1
- package/dist/src/prompts/toggle.js +0 -53
- package/dist/src/prompts/toggle.js.map +0 -1
- package/dist/src/prompts/transfer.js +0 -207
- package/dist/src/prompts/transfer.js.map +0 -1
- package/dist/src/prompts/tree-select.js +0 -270
- package/dist/src/prompts/tree-select.js.map +0 -1
- package/dist/src/prompts/tree.js +0 -233
- package/dist/src/prompts/tree.js.map +0 -1
- package/dist/src/prompts/wait.js +0 -79
- package/dist/src/prompts/wait.js.map +0 -1
- package/dist/src/spinner.js +0 -105
- package/dist/src/spinner.js.map +0 -1
- package/dist/src/symbols.js +0 -66
- package/dist/src/symbols.js.map +0 -1
- package/dist/src/tasks.js +0 -231
- package/dist/src/tasks.js.map +0 -1
- package/dist/src/theme.js +0 -29
- package/dist/src/theme.js.map +0 -1
- package/dist/src/types.js +0 -8
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils.js +0 -480
- package/dist/src/utils.js.map +0 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Mep CLI interactions.
|
|
3
|
+
*/
|
|
4
|
+
export interface ThemeConfig {
|
|
5
|
+
main: string;
|
|
6
|
+
success: string;
|
|
7
|
+
error: string;
|
|
8
|
+
muted: string;
|
|
9
|
+
title: string;
|
|
10
|
+
syntax: {
|
|
11
|
+
key: string;
|
|
12
|
+
string: string;
|
|
13
|
+
number: string;
|
|
14
|
+
boolean: string;
|
|
15
|
+
null: string;
|
|
16
|
+
punctuation: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface BaseOptions {
|
|
20
|
+
message: string;
|
|
21
|
+
mouse?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface MouseEvent {
|
|
24
|
+
name: 'mouse';
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
button: number;
|
|
28
|
+
action: 'press' | 'release' | 'move' | 'scroll';
|
|
29
|
+
scroll?: 'up' | 'down';
|
|
30
|
+
shift?: boolean;
|
|
31
|
+
ctrl?: boolean;
|
|
32
|
+
meta?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface TextOptions extends BaseOptions {
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
initial?: string;
|
|
37
|
+
validate?: (value: string) => string | boolean | Promise<string | boolean>;
|
|
38
|
+
isPassword?: boolean;
|
|
39
|
+
multiline?: boolean;
|
|
40
|
+
mask?: string;
|
|
41
|
+
suggest?: (input: string) => string | Promise<string>;
|
|
42
|
+
}
|
|
43
|
+
export interface Separator {
|
|
44
|
+
separator: true;
|
|
45
|
+
text?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SelectChoice<V> {
|
|
48
|
+
title: string;
|
|
49
|
+
value: V;
|
|
50
|
+
description?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface SelectOptions<V> extends BaseOptions {
|
|
53
|
+
choices: (SelectChoice<V> | Separator)[];
|
|
54
|
+
}
|
|
55
|
+
export interface TransferOptions<V> extends BaseOptions {
|
|
56
|
+
source: (string | SelectChoice<V>)[];
|
|
57
|
+
target?: (string | SelectChoice<V>)[];
|
|
58
|
+
}
|
|
59
|
+
export interface CronOptions extends BaseOptions {
|
|
60
|
+
initial?: string;
|
|
61
|
+
placeholder?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface CheckboxChoice<V> extends SelectChoice<V> {
|
|
64
|
+
selected?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface CheckboxOptions<V> extends BaseOptions {
|
|
67
|
+
choices: CheckboxChoice<V>[];
|
|
68
|
+
min?: number;
|
|
69
|
+
max?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface ConfirmOptions extends BaseOptions {
|
|
72
|
+
initial?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface NumberOptions extends BaseOptions {
|
|
75
|
+
initial?: number;
|
|
76
|
+
min?: number;
|
|
77
|
+
max?: number;
|
|
78
|
+
step?: number;
|
|
79
|
+
placeholder?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ToggleOptions extends BaseOptions {
|
|
82
|
+
initial?: boolean;
|
|
83
|
+
activeText?: string;
|
|
84
|
+
inactiveText?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ListOptions extends BaseOptions {
|
|
87
|
+
placeholder?: string;
|
|
88
|
+
initial?: string[];
|
|
89
|
+
validate?: (value: string[]) => string | boolean | Promise<string | boolean>;
|
|
90
|
+
}
|
|
91
|
+
export interface SliderOptions extends BaseOptions {
|
|
92
|
+
min: number;
|
|
93
|
+
max: number;
|
|
94
|
+
initial?: number;
|
|
95
|
+
step?: number;
|
|
96
|
+
unit?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface RangeOptions extends BaseOptions {
|
|
99
|
+
min: number;
|
|
100
|
+
max: number;
|
|
101
|
+
initial?: [number, number];
|
|
102
|
+
step?: number;
|
|
103
|
+
unit?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface SelectRangeOptions<V> extends Omit<SelectOptions<V>, 'initial'> {
|
|
106
|
+
initial?: [number, number];
|
|
107
|
+
}
|
|
108
|
+
export interface RatingOptions extends BaseOptions {
|
|
109
|
+
min?: number;
|
|
110
|
+
max?: number;
|
|
111
|
+
initial?: number;
|
|
112
|
+
}
|
|
113
|
+
export interface DateOptions extends BaseOptions {
|
|
114
|
+
initial?: Date;
|
|
115
|
+
min?: Date;
|
|
116
|
+
max?: Date;
|
|
117
|
+
}
|
|
118
|
+
export interface FileOptions extends BaseOptions {
|
|
119
|
+
basePath?: string;
|
|
120
|
+
extensions?: string[];
|
|
121
|
+
onlyDirectories?: boolean;
|
|
122
|
+
}
|
|
123
|
+
export interface MultiSelectOptions<V> extends CheckboxOptions<V> {
|
|
124
|
+
}
|
|
125
|
+
export interface AutocompleteOptions<V> extends BaseOptions {
|
|
126
|
+
suggest: (input: string) => Promise<SelectChoice<V>[]>;
|
|
127
|
+
limit?: number;
|
|
128
|
+
fallback?: string;
|
|
129
|
+
initial?: string;
|
|
130
|
+
}
|
|
131
|
+
export interface SortOptions extends BaseOptions {
|
|
132
|
+
items: string[];
|
|
133
|
+
}
|
|
134
|
+
export interface EditorOptions extends BaseOptions {
|
|
135
|
+
initial?: string;
|
|
136
|
+
extension?: string;
|
|
137
|
+
waitUserInput?: boolean;
|
|
138
|
+
}
|
|
139
|
+
export interface TableRow<V> {
|
|
140
|
+
value: V;
|
|
141
|
+
row: string[];
|
|
142
|
+
}
|
|
143
|
+
export interface TableOptions<V> extends BaseOptions {
|
|
144
|
+
columns: string[];
|
|
145
|
+
data: TableRow<V>[];
|
|
146
|
+
rows?: number;
|
|
147
|
+
}
|
|
148
|
+
export interface TreeNode<V> {
|
|
149
|
+
title: string;
|
|
150
|
+
value: V;
|
|
151
|
+
children?: TreeNode<V>[];
|
|
152
|
+
expanded?: boolean;
|
|
153
|
+
disabled?: boolean;
|
|
154
|
+
selected?: boolean | 'indeterminate';
|
|
155
|
+
}
|
|
156
|
+
export interface TreeOptions<V> extends BaseOptions {
|
|
157
|
+
data: TreeNode<V>[];
|
|
158
|
+
initial?: V;
|
|
159
|
+
indent?: number;
|
|
160
|
+
}
|
|
161
|
+
export interface KeypressOptions extends BaseOptions {
|
|
162
|
+
keys?: string[];
|
|
163
|
+
showInvisible?: boolean;
|
|
164
|
+
}
|
|
165
|
+
export interface FormField {
|
|
166
|
+
name: string;
|
|
167
|
+
message: string;
|
|
168
|
+
initial?: string;
|
|
169
|
+
validate?: (value: string) => string | boolean | Promise<string | boolean>;
|
|
170
|
+
}
|
|
171
|
+
export interface FormOptions extends BaseOptions {
|
|
172
|
+
fields: FormField[];
|
|
173
|
+
}
|
|
174
|
+
export interface SnippetOptions extends BaseOptions {
|
|
175
|
+
template: string;
|
|
176
|
+
values?: Record<string, string>;
|
|
177
|
+
fields?: Record<string, {
|
|
178
|
+
message?: string;
|
|
179
|
+
validate?: (value: string) => string | boolean;
|
|
180
|
+
}>;
|
|
181
|
+
}
|
|
182
|
+
export interface SpamOptions extends BaseOptions {
|
|
183
|
+
threshold: number;
|
|
184
|
+
spamKey?: string;
|
|
185
|
+
decay?: boolean;
|
|
186
|
+
}
|
|
187
|
+
export interface WaitOptions extends BaseOptions {
|
|
188
|
+
seconds: number;
|
|
189
|
+
autoSubmit?: boolean;
|
|
190
|
+
}
|
|
191
|
+
export interface CodeOptions extends BaseOptions {
|
|
192
|
+
template: string;
|
|
193
|
+
language?: 'json' | 'env' | 'toml' | 'csv' | 'sh' | 'bash' | 'zsh' | 'properties' | 'props' | 'conf';
|
|
194
|
+
/**
|
|
195
|
+
* Enable syntax highlighting (Experimental).
|
|
196
|
+
* @default true
|
|
197
|
+
*/
|
|
198
|
+
highlight?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Initial values for variables in the template.
|
|
201
|
+
*/
|
|
202
|
+
values?: Record<string, string>;
|
|
203
|
+
}
|
|
204
|
+
export interface TreeSelectNode<V> {
|
|
205
|
+
title: string;
|
|
206
|
+
value: V;
|
|
207
|
+
children?: TreeSelectNode<V>[];
|
|
208
|
+
expanded?: boolean;
|
|
209
|
+
disabled?: boolean;
|
|
210
|
+
selected?: boolean | 'indeterminate';
|
|
211
|
+
}
|
|
212
|
+
export interface TreeSelectOptions<V> extends BaseOptions {
|
|
213
|
+
data: TreeSelectNode<V>[];
|
|
214
|
+
initial?: V[];
|
|
215
|
+
indent?: number;
|
|
216
|
+
}
|
|
217
|
+
export interface ColorOptions extends BaseOptions {
|
|
218
|
+
initial?: string;
|
|
219
|
+
format?: 'hex' | 'rgb' | 'hsl';
|
|
220
|
+
}
|
|
221
|
+
export interface GridOptions extends BaseOptions {
|
|
222
|
+
rows: string[];
|
|
223
|
+
columns: string[];
|
|
224
|
+
initial?: boolean[][];
|
|
225
|
+
}
|
|
226
|
+
export interface SortGridOptions extends BaseOptions {
|
|
227
|
+
data: string[][];
|
|
228
|
+
}
|
|
229
|
+
export interface CalendarOptions extends BaseOptions {
|
|
230
|
+
mode?: 'single' | 'range';
|
|
231
|
+
multiple?: boolean;
|
|
232
|
+
initial?: Date | [Date, Date];
|
|
233
|
+
min?: Date;
|
|
234
|
+
max?: Date;
|
|
235
|
+
weekStart?: 0 | 1;
|
|
236
|
+
}
|
|
237
|
+
export interface MapOptions extends BaseOptions {
|
|
238
|
+
initial?: Record<string, string>;
|
|
239
|
+
suggestions?: string[];
|
|
240
|
+
}
|
|
241
|
+
export interface SemVerOptions extends BaseOptions {
|
|
242
|
+
currentVersion: string;
|
|
243
|
+
}
|
|
244
|
+
export interface IPOptions extends BaseOptions {
|
|
245
|
+
initial?: string;
|
|
246
|
+
}
|
|
247
|
+
export interface OTPOptions extends BaseOptions {
|
|
248
|
+
length?: number;
|
|
249
|
+
mask?: string;
|
|
250
|
+
secure?: boolean;
|
|
251
|
+
placeholder?: string;
|
|
252
|
+
}
|
|
253
|
+
export interface QuizSelectOptions<V> extends SelectOptions<V> {
|
|
254
|
+
correctValue: V;
|
|
255
|
+
explanation?: string;
|
|
256
|
+
}
|
|
257
|
+
export interface QuizTextOptions extends TextOptions {
|
|
258
|
+
verify?: (value: string) => boolean | Promise<boolean>;
|
|
259
|
+
correctAnswer: string;
|
|
260
|
+
explanation?: string;
|
|
261
|
+
}
|
|
262
|
+
export interface KanbanItem {
|
|
263
|
+
id: string;
|
|
264
|
+
title: string;
|
|
265
|
+
[key: string]: any;
|
|
266
|
+
}
|
|
267
|
+
export interface KanbanColumn<V extends KanbanItem> {
|
|
268
|
+
id: string;
|
|
269
|
+
title: string;
|
|
270
|
+
items: V[];
|
|
271
|
+
}
|
|
272
|
+
export interface KanbanOptions<V extends KanbanItem> extends BaseOptions {
|
|
273
|
+
columns: KanbanColumn<V>[];
|
|
274
|
+
}
|
|
275
|
+
export interface TimeOptions extends BaseOptions {
|
|
276
|
+
format?: '12h' | '24h';
|
|
277
|
+
step?: number;
|
|
278
|
+
initial?: Date | string;
|
|
279
|
+
}
|
|
280
|
+
export interface HeatmapLegend {
|
|
281
|
+
value: number;
|
|
282
|
+
char: string;
|
|
283
|
+
color: (str: string) => string;
|
|
284
|
+
}
|
|
285
|
+
export interface HeatmapOptions extends BaseOptions {
|
|
286
|
+
rows: string[];
|
|
287
|
+
columns: string[];
|
|
288
|
+
legend: HeatmapLegend[];
|
|
289
|
+
initial?: number[][];
|
|
290
|
+
}
|
|
291
|
+
export interface ByteOptions extends BaseOptions {
|
|
292
|
+
initial?: number;
|
|
293
|
+
min?: number;
|
|
294
|
+
max?: number;
|
|
295
|
+
}
|
|
296
|
+
export interface SlotOptions extends BaseOptions {
|
|
297
|
+
choices: string[];
|
|
298
|
+
rows?: number;
|
|
299
|
+
initial?: number;
|
|
300
|
+
}
|
|
301
|
+
export interface GaugeOptions extends BaseOptions {
|
|
302
|
+
theme?: Partial<ThemeConfig>;
|
|
303
|
+
width?: number;
|
|
304
|
+
/** Safe zone width as a percentage (0-1) or absolute character count (>1). Default: 0.2 (20%) */
|
|
305
|
+
safeZone?: number;
|
|
306
|
+
}
|
|
307
|
+
export interface CalculatorOptions extends BaseOptions {
|
|
308
|
+
initial?: string;
|
|
309
|
+
variables?: Record<string, number>;
|
|
310
|
+
precision?: number;
|
|
311
|
+
placeholder?: string;
|
|
312
|
+
}
|
|
313
|
+
export interface EmojiItem {
|
|
314
|
+
char: string;
|
|
315
|
+
name: string;
|
|
316
|
+
description?: string;
|
|
317
|
+
}
|
|
318
|
+
export interface EmojiOptions extends BaseOptions {
|
|
319
|
+
emojis: EmojiItem[];
|
|
320
|
+
recent?: string[];
|
|
321
|
+
cols?: number;
|
|
322
|
+
}
|
|
323
|
+
export interface MatchItem {
|
|
324
|
+
id: string;
|
|
325
|
+
label: string;
|
|
326
|
+
value?: any;
|
|
327
|
+
}
|
|
328
|
+
export interface MatchOptions extends BaseOptions {
|
|
329
|
+
source: (string | MatchItem)[];
|
|
330
|
+
target: (string | MatchItem)[];
|
|
331
|
+
constraints?: {
|
|
332
|
+
required?: boolean;
|
|
333
|
+
oneToMany?: boolean;
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
export interface DiffOptions extends BaseOptions {
|
|
337
|
+
original: string;
|
|
338
|
+
modified: string;
|
|
339
|
+
context?: number;
|
|
340
|
+
mode?: 'inline' | 'split';
|
|
341
|
+
}
|
|
342
|
+
export interface DialOptions extends BaseOptions {
|
|
343
|
+
min: number;
|
|
344
|
+
max: number;
|
|
345
|
+
step?: number;
|
|
346
|
+
radius?: number;
|
|
347
|
+
pointerSymbol?: string;
|
|
348
|
+
initial?: number;
|
|
349
|
+
}
|
|
350
|
+
export interface DrawOptions extends BaseOptions {
|
|
351
|
+
width: number;
|
|
352
|
+
height: number;
|
|
353
|
+
exportType?: 'matrix' | 'text';
|
|
354
|
+
initial?: boolean[][];
|
|
355
|
+
}
|
|
356
|
+
export interface MultiColumnSelectOptions<V> extends SelectOptions<V> {
|
|
357
|
+
cols?: number | 'auto';
|
|
358
|
+
}
|
|
359
|
+
export interface FuzzySelectOptions<V> extends SelectOptions<V> {
|
|
360
|
+
}
|
|
361
|
+
export interface MillerOptions<V> extends BaseOptions {
|
|
362
|
+
data: TreeNode<V>[];
|
|
363
|
+
initial?: V[];
|
|
364
|
+
separator?: string;
|
|
365
|
+
}
|
|
366
|
+
export interface PatternOptions extends BaseOptions {
|
|
367
|
+
rows?: number;
|
|
368
|
+
cols?: number;
|
|
369
|
+
nodeChar?: string;
|
|
370
|
+
lineChar?: string;
|
|
371
|
+
}
|
|
372
|
+
export interface MapRegion {
|
|
373
|
+
id: string;
|
|
374
|
+
label: string;
|
|
375
|
+
x: number;
|
|
376
|
+
y: number;
|
|
377
|
+
description?: string;
|
|
378
|
+
}
|
|
379
|
+
export interface RegionOptions extends BaseOptions {
|
|
380
|
+
mapArt: string;
|
|
381
|
+
regions: MapRegion[];
|
|
382
|
+
initial?: string;
|
|
383
|
+
}
|
|
384
|
+
export interface SpreadsheetColumn {
|
|
385
|
+
name: string;
|
|
386
|
+
key: string;
|
|
387
|
+
width?: number;
|
|
388
|
+
editable?: boolean;
|
|
389
|
+
}
|
|
390
|
+
export interface SpreadsheetOptions extends BaseOptions {
|
|
391
|
+
columns: SpreadsheetColumn[];
|
|
392
|
+
data: Record<string, any>[];
|
|
393
|
+
rows?: number;
|
|
394
|
+
keyBindings?: {
|
|
395
|
+
save?: string[];
|
|
396
|
+
cancel?: string[];
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
export interface ScrollOptions extends BaseOptions {
|
|
400
|
+
content: string;
|
|
401
|
+
height?: number;
|
|
402
|
+
requireScrollToBottom?: boolean;
|
|
403
|
+
}
|
|
404
|
+
export interface BreadcrumbOptions extends BaseOptions {
|
|
405
|
+
root?: string;
|
|
406
|
+
separator?: string;
|
|
407
|
+
showHidden?: boolean;
|
|
408
|
+
}
|
|
409
|
+
export interface ScheduleTask {
|
|
410
|
+
name: string;
|
|
411
|
+
start: Date;
|
|
412
|
+
end: Date;
|
|
413
|
+
metadata?: any;
|
|
414
|
+
}
|
|
415
|
+
export interface ScheduleOptions extends BaseOptions {
|
|
416
|
+
data: ScheduleTask[];
|
|
417
|
+
}
|
|
418
|
+
export interface DataInspectorOptions extends BaseOptions {
|
|
419
|
+
data: any;
|
|
420
|
+
maxDepth?: number;
|
|
421
|
+
}
|
|
422
|
+
export interface ExecOptions extends BaseOptions {
|
|
423
|
+
command: string;
|
|
424
|
+
timeout?: number;
|
|
425
|
+
cwd?: string;
|
|
426
|
+
streamOutput?: boolean;
|
|
427
|
+
}
|
|
428
|
+
export interface ShortcutResult {
|
|
429
|
+
name: string;
|
|
430
|
+
ctrl: boolean;
|
|
431
|
+
shift: boolean;
|
|
432
|
+
meta: boolean;
|
|
433
|
+
sequence: string;
|
|
434
|
+
}
|
|
435
|
+
export interface ShortcutOptions extends BaseOptions {
|
|
436
|
+
initial?: ShortcutResult;
|
|
437
|
+
}
|
|
438
|
+
export interface SeatOptions extends BaseOptions {
|
|
439
|
+
layout: string[];
|
|
440
|
+
rows?: string[];
|
|
441
|
+
cols?: string[];
|
|
442
|
+
initial?: string[];
|
|
443
|
+
multiple?: boolean;
|
|
444
|
+
}
|
|
445
|
+
export interface DependencyItem<V> extends CheckboxChoice<V> {
|
|
446
|
+
dependsOn?: V[];
|
|
447
|
+
triggers?: V[];
|
|
448
|
+
conflictsWith?: V[];
|
|
449
|
+
}
|
|
450
|
+
export interface DependencyOptions<V> extends BaseOptions {
|
|
451
|
+
choices: DependencyItem<V>[];
|
|
452
|
+
min?: number;
|
|
453
|
+
max?: number;
|
|
454
|
+
autoResolve?: boolean;
|
|
455
|
+
}
|
|
456
|
+
export interface License {
|
|
457
|
+
id: string;
|
|
458
|
+
name: string;
|
|
459
|
+
description: string;
|
|
460
|
+
permissions: string[];
|
|
461
|
+
conditions: string[];
|
|
462
|
+
limitations: string[];
|
|
463
|
+
}
|
|
464
|
+
export interface LicenseOptions extends BaseOptions {
|
|
465
|
+
defaultLicense?: string;
|
|
466
|
+
}
|
|
467
|
+
export interface RegexOptions extends BaseOptions {
|
|
468
|
+
tests: string[];
|
|
469
|
+
flags?: string;
|
|
470
|
+
}
|
|
471
|
+
export interface BoxOptions extends BaseOptions {
|
|
472
|
+
initial?: number | {
|
|
473
|
+
top: number;
|
|
474
|
+
right: number;
|
|
475
|
+
bottom: number;
|
|
476
|
+
left: number;
|
|
477
|
+
};
|
|
478
|
+
min?: number;
|
|
479
|
+
max?: number;
|
|
480
|
+
step?: number;
|
|
481
|
+
}
|
|
482
|
+
export interface PhoneOptions extends BaseOptions {
|
|
483
|
+
defaultCountry?: string;
|
|
484
|
+
placeholder?: string;
|
|
485
|
+
strict?: boolean;
|
|
486
|
+
validate?: (value: string) => string | boolean | Promise<string | boolean>;
|
|
487
|
+
}
|
|
488
|
+
export type TaskStatus = 'pending' | 'loading' | 'success' | 'error' | 'warning';
|
|
489
|
+
export interface TaskConfig {
|
|
490
|
+
id: string;
|
|
491
|
+
title: string;
|
|
492
|
+
type?: 'spinner' | 'progress';
|
|
493
|
+
total?: number;
|
|
494
|
+
}
|
|
495
|
+
export interface TaskState extends TaskConfig {
|
|
496
|
+
status: TaskStatus;
|
|
497
|
+
current: number;
|
|
498
|
+
message?: string;
|
|
499
|
+
}
|
|
500
|
+
export interface TaskGroupOptions {
|
|
501
|
+
concurrency?: number;
|
|
502
|
+
renderer?: 'default' | 'minimal';
|
|
503
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects terminal capabilities.
|
|
3
|
+
*/
|
|
4
|
+
export declare function detectCapabilities(): {
|
|
5
|
+
isCI: boolean;
|
|
6
|
+
hasTrueColor: boolean;
|
|
7
|
+
hasUnicode: boolean | "";
|
|
8
|
+
hasMouse: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Strips ANSI escape codes from a string.
|
|
12
|
+
*/
|
|
13
|
+
export declare function stripAnsi(str: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Calculates the visual width of a string.
|
|
16
|
+
* Uses binary search for wide characters.
|
|
17
|
+
* Handles ANSI codes (zero width).
|
|
18
|
+
*/
|
|
19
|
+
export declare function stringWidth(str: string): number;
|
|
20
|
+
/**
|
|
21
|
+
* Safely splits a string into an array of grapheme clusters.
|
|
22
|
+
* Uses Intl.Segmenter (Node 16+).
|
|
23
|
+
*/
|
|
24
|
+
export declare function safeSplit(str: string): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Fuzzy match algorithm (Subsequence matching).
|
|
27
|
+
* Returns score and matched indices, or null if no match.
|
|
28
|
+
*/
|
|
29
|
+
export declare function fuzzyMatch(query: string, target: string): {
|
|
30
|
+
score: number;
|
|
31
|
+
indices: number[];
|
|
32
|
+
} | null;
|
|
33
|
+
/**
|
|
34
|
+
* Layout utilities for advanced rendering (Split View, etc.)
|
|
35
|
+
*/
|
|
36
|
+
export declare const Layout: {
|
|
37
|
+
/**
|
|
38
|
+
* Truncates a string to a specific visual width, respecting ANSI codes.
|
|
39
|
+
*/
|
|
40
|
+
truncate(str: string, width: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* Pads a string to a specific visual length.
|
|
43
|
+
* Respects ANSI codes (does not count them towards length).
|
|
44
|
+
*/
|
|
45
|
+
pad(text: string, length: number, align?: "left" | "right" | "center"): string;
|
|
46
|
+
/**
|
|
47
|
+
* Splits two multi-line strings side-by-side.
|
|
48
|
+
* @param left Content for left column
|
|
49
|
+
* @param right Content for right column
|
|
50
|
+
* @param width Total available width
|
|
51
|
+
* @param options Configuration for ratio and gap
|
|
52
|
+
*/
|
|
53
|
+
split(left: string, right: string, width: number, options?: {
|
|
54
|
+
ratio?: number;
|
|
55
|
+
gap?: number;
|
|
56
|
+
}): string;
|
|
57
|
+
/**
|
|
58
|
+
* Wraps a string to a specific visual width.
|
|
59
|
+
* Respects word boundaries where possible.
|
|
60
|
+
*/
|
|
61
|
+
wrap(str: string, width: number): string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Graph utilities for dependency management
|
|
65
|
+
*/
|
|
66
|
+
export declare const Graph: {
|
|
67
|
+
/**
|
|
68
|
+
* Returns all dependencies (transitive) for an item.
|
|
69
|
+
*/
|
|
70
|
+
getDependencies<T>(item: T, getDeps: (i: T) => T[]): T[];
|
|
71
|
+
/**
|
|
72
|
+
* Topologically sorts items based on dependencies.
|
|
73
|
+
* Returns items in order (dependencies first).
|
|
74
|
+
* Throws error if cycle detected.
|
|
75
|
+
*/
|
|
76
|
+
topologicalSort<T>(items: T[], getDeps: (i: T) => T[]): T[];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Generates a progress bar string.
|
|
80
|
+
*/
|
|
81
|
+
export declare function generateProgressBar(current: number, total: number, width?: number): string;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get Graph(){return Graph},get Layout(){return Layout},get detectCapabilities(){return detectCapabilities},get fuzzyMatch(){return fuzzyMatch},get generateProgressBar(){return generateProgressBar},get safeSplit(){return safeSplit},get stringWidth(){return stringWidth},get stripAnsi(){return stripAnsi}});function detectCapabilities(){const env=process.env;const isCI=!!env.CI;const hasTrueColor=env.COLORTERM==="truecolor"||!!env.WT_SESSION;const isTTY=process.stdout.isTTY;const isWindows=process.platform==="win32";const isUnicodeSupported=()=>{if(isWindows){if(env.WT_SESSION)return true;if(env.TERM_PROGRAM==="vscode")return true;if(env.TERM==="xterm-256color"||env.TERM==="alacritty")return true;if(env.ConEmuTask)return true;if(isCI)return true;return false}if(env.TERM_PROGRAM==="Apple_Terminal")return true;const lang=env.LANG||"";const lcAll=env.LC_ALL||"";return lang&&lang.toUpperCase().endsWith("UTF-8")||lcAll&&lcAll.toUpperCase().endsWith("UTF-8")};return{isCI,hasTrueColor,hasUnicode:isTTY&&isUnicodeSupported(),hasMouse:isTTY&&!isCI}}function stripAnsi(str){return str.replace(/\x1b\[[0-9;]*m/g,"")}const WIDE_RANGES=[[4352,4607],[11904,12031],[12032,12255],[12288,12351],[12352,12447],[12448,12543],[12544,12591],[12592,12687],[12800,13055],[13056,13311],[13312,19903],[19968,40959],[43360,43391],[44032,55215],[55216,55295],[63744,64255],[65040,65055],[65072,65103],[65104,65135],[65281,65376],[65504,65510],[127744,128767],[129280,129535]];function isWideCodePoint(cp){let low=0;let high=WIDE_RANGES.length-1;while(low<=high){const mid=Math.floor((low+high)/2);const[start,end]=WIDE_RANGES[mid];if(cp>=start&&cp<=end){return true}else if(cp<start){high=mid-1}else{low=mid+1}}return false}function stringWidth(str){let width=0;let inAnsi=false;for(let i=0;i<str.length;i++){const code=str.charCodeAt(i);if(str[i]==="\x1b"){inAnsi=true;continue}if(inAnsi){if(str[i]==="["){continue}if(str[i]>="@"&&str[i]<="~"){inAnsi=false}continue}let cp=code;if(code>=55296&&code<=56319&&i+1<str.length){const next=str.charCodeAt(i+1);if(next>=56320&&next<=57343){cp=(code-55296)*1024+(next-56320)+65536;i++}}width+=isWideCodePoint(cp)?2:1}return width}function safeSplit(str){const segmenter=new Intl.Segmenter(undefined,{granularity:"grapheme"});const segments=segmenter.segment(str);const result=[];for(const segment of segments){result.push(segment.segment)}return result}function fuzzyMatch(query,target){if(!query)return{score:0,indices:[]};const queryLower=query.toLowerCase();const targetLower=target.toLowerCase();let queryIdx=0;let targetIdx=0;const indices=[];let score=0;let consecutive=0;let lastMatchIdx=-1;while(queryIdx<queryLower.length&&targetIdx<targetLower.length){const qChar=queryLower[queryIdx];const tChar=targetLower[targetIdx];if(qChar===tChar){indices.push(targetIdx);let charScore=1;if(lastMatchIdx!==-1&&targetIdx===lastMatchIdx+1){consecutive++;charScore+=consecutive*2}else{consecutive=0}if(targetIdx===0){charScore+=5}else if(targetIdx>0){const prevChar=target.charAt(targetIdx-1);if(/[\s_\-.]/.test(prevChar)||prevChar==="/"){charScore+=4}else if(prevChar!==prevChar.toUpperCase()&&target.charAt(targetIdx)===target.charAt(targetIdx).toUpperCase()){charScore+=3}}score+=charScore;lastMatchIdx=targetIdx;queryIdx++}targetIdx++}if(queryIdx<queryLower.length){return null}score-=target.length*.1;if(indices.length>1){const spread=indices[indices.length-1]-indices[0];score-=spread*.5}return{score,indices}}const Layout={truncate(str,width){const visualWidth=stringWidth(str);if(visualWidth<=width){return str}let currentWidth=0;let cutIndex=0;let inAnsi=false;for(let i=0;i<str.length;i++){if(str[i]==="\x1b")inAnsi=true;if(!inAnsi){const code=str.charCodeAt(i);if(code>=55296&&code<=56319&&i+1<str.length){const next=str.charCodeAt(i+1);if(next>=56320&&next<=57343){const cp=(code-55296)*1024+(next-56320)+65536;const w=isWideCodePoint(cp)?2:1;if(currentWidth+w>width)break;currentWidth+=w;cutIndex=i+2;i++;continue}}const w=isWideCodePoint(code)?2:1;if(currentWidth+w>width)break;currentWidth+=w}else{if(str[i]==="m"||str[i]>="A"&&str[i]<="Z")inAnsi=false}cutIndex=i+1}return str.substring(0,cutIndex)+"\x1b[0m"},pad(text,length,align="left"){const visualLen=stringWidth(text);if(visualLen>=length)return text;const padLen=Math.max(0,length-visualLen);if(align==="left"){return text+" ".repeat(padLen)}else if(align==="right"){return" ".repeat(padLen)+text}else{const leftPad=Math.floor(padLen/2);const rightPad=padLen-leftPad;return" ".repeat(leftPad)+text+" ".repeat(rightPad)}},split(left,right,width,options={}){const ratio=options.ratio??.5;const gap=options.gap??2;let leftWidth=Math.floor((width-gap)*ratio);let rightWidth=width-leftWidth-gap;if(leftWidth<1||rightWidth<1){leftWidth=Math.max(0,width);rightWidth=0}const leftLines=left.split("\n");const rightLines=right.split("\n");const maxLines=Math.max(leftLines.length,rightLines.length);const result=[];for(let i=0;i<maxLines;i++){const leftLine=leftLines[i]||"";const rightLine=rightLines[i]||"";const l=Layout.pad(Layout.truncate(leftLine,leftWidth),leftWidth);const r=Layout.pad(Layout.truncate(rightLine,rightWidth),rightWidth);result.push(`${l}${" ".repeat(gap)}${r}`)}return result.join("\n")},wrap(str,width){const paragraphs=str.split("\n");return paragraphs.map(para=>{const words=para.split(" ");let currentLine="";const lines=[];for(const word of words){const wordWidth=stringWidth(word);const currentWidth=stringWidth(currentLine);const spaceWidth=currentLine?1:0;if(currentWidth+spaceWidth+wordWidth<=width){currentLine+=(currentLine?" ":"")+word}else{if(currentLine)lines.push(currentLine);currentLine=word}}if(currentLine)lines.push(currentLine);return lines.join("\n")}).join("\n")}};const Graph={getDependencies(item,getDeps){const visited=new Set;const result=[];const visit=current=>{if(visited.has(current))return;visited.add(current);const deps=getDeps(current);for(const dep of deps){visit(dep)}if(current!==item){result.push(current)}};visit(item);return result},topologicalSort(items,getDeps){const visited=new Set;const temp=new Set;const order=[];const visit=node=>{if(temp.has(node)){throw new Error("Cyclic dependency detected")}if(visited.has(node))return;temp.add(node);const deps=getDeps(node);for(const dep of deps){visit(dep)}temp.delete(node);visited.add(node);order.push(node)};for(const item of items){if(!visited.has(item)){visit(item)}}return order}};function generateProgressBar(current,total,width=20){const percentage=Math.min(Math.max(current/total,0),1);const barWidth=width;const filledWidth=Math.round(barWidth*percentage);const emptyWidth=barWidth-filledWidth;const filled="█".repeat(filledWidth);const empty="-".repeat(emptyWidth);const percentStr=Math.round(percentage*100)+"%";return`[${filled}${empty}] ${percentStr}`}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mepcli",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"description": "Zero-dependency interactive CLI prompt",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
17
|
"typecheck": "tsc --noEmit",
|
|
18
|
-
"
|
|
18
|
+
"compile": "swc src -d dist --strip-leading-paths --config-file .swcrc",
|
|
19
|
+
"types": "tsc --emitDeclarationOnly --outDir dist",
|
|
20
|
+
"build": "bun run compile && bun run types",
|
|
19
21
|
"prepublishOnly": "bun run build",
|
|
20
22
|
"test": "bun test",
|
|
21
23
|
"demo": "bun example.ts",
|
|
22
|
-
"lint": "
|
|
23
|
-
"lint:fix": "
|
|
24
|
+
"lint": "biome check ./src",
|
|
25
|
+
"lint:fix": "biome check --write ./src"
|
|
24
26
|
},
|
|
25
27
|
"keywords": [
|
|
26
28
|
"cli",
|
|
@@ -45,13 +47,10 @@
|
|
|
45
47
|
"author": "CodeTease",
|
|
46
48
|
"license": "MIT",
|
|
47
49
|
"devDependencies": {
|
|
48
|
-
"@
|
|
50
|
+
"@biomejs/biome": "^1.9.4",
|
|
49
51
|
"@swc/cli": "^0.8.0",
|
|
50
52
|
"@swc/core": "^1.15.18",
|
|
51
53
|
"@types/node": "^22.19.13",
|
|
52
|
-
"
|
|
53
|
-
"globals": "^17.4.0",
|
|
54
|
-
"typescript": "^5.9.3",
|
|
55
|
-
"typescript-eslint": "^8.56.1"
|
|
54
|
+
"typescript": "^5.9.3"
|
|
56
55
|
}
|
|
57
56
|
}
|
package/dist/src/ansi.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ANSI Escape Codes
|
|
3
|
-
* Manual definitions to maintain zero-dependency status.
|
|
4
|
-
*/ "use strict";
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports, "ANSI", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function() {
|
|
11
|
-
return ANSI;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
const ANSI = {
|
|
15
|
-
RESET: '\x1b[0m',
|
|
16
|
-
BOLD: '\x1b[1m',
|
|
17
|
-
DIM: '\x1b[2m',
|
|
18
|
-
ITALIC: '\x1b[3m',
|
|
19
|
-
UNDERLINE: '\x1b[4m',
|
|
20
|
-
REVERSE: '\x1b[7m',
|
|
21
|
-
// Colors
|
|
22
|
-
FG_GREEN: '\x1b[32m',
|
|
23
|
-
FG_CYAN: '\x1b[36m',
|
|
24
|
-
FG_YELLOW: '\x1b[33m',
|
|
25
|
-
FG_RED: '\x1b[31m',
|
|
26
|
-
FG_GRAY: '\x1b[90m',
|
|
27
|
-
FG_WHITE: '\x1b[37m',
|
|
28
|
-
FG_BLUE: '\x1b[34m',
|
|
29
|
-
FG_MAGENTA: '\x1b[35m',
|
|
30
|
-
FG_BLACK: '\x1b[30m',
|
|
31
|
-
BG_YELLOW: '\x1b[43m',
|
|
32
|
-
BG_BLUE: '\x1b[44m',
|
|
33
|
-
BG_CYAN: '\x1b[46m',
|
|
34
|
-
BG_GREEN: '\x1b[42m',
|
|
35
|
-
BG_RED: '\x1b[41m',
|
|
36
|
-
// Cursor & Erasing
|
|
37
|
-
ERASE_LINE: '\x1b[2K',
|
|
38
|
-
ERASE_DOWN: '\x1b[J',
|
|
39
|
-
CURSOR_LEFT: '\x1b[1000D',
|
|
40
|
-
HIDE_CURSOR: '\x1b[?25l',
|
|
41
|
-
SHOW_CURSOR: '\x1b[?25h',
|
|
42
|
-
UP: '\x1b[A',
|
|
43
|
-
DOWN: '\x1b[B',
|
|
44
|
-
// Mouse Tracking (SGR Protocol)
|
|
45
|
-
SET_ANY_EVENT_MOUSE: '\x1b[?1003h',
|
|
46
|
-
SET_SGR_EXT_MODE_MOUSE: '\x1b[?1006h',
|
|
47
|
-
DISABLE_MOUSE: '\x1b[?1003l\x1b[?1006l'
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=ansi.js.map
|
package/dist/src/ansi.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ansi.ts"],"sourcesContent":["/**\n * ANSI Escape Codes\n * Manual definitions to maintain zero-dependency status.\n */\n\nexport const ANSI = {\n RESET: '\\x1b[0m',\n BOLD: '\\x1b[1m',\n DIM: '\\x1b[2m',\n ITALIC: '\\x1b[3m',\n UNDERLINE: '\\x1b[4m',\n REVERSE: '\\x1b[7m',\n\n // Colors\n FG_GREEN: '\\x1b[32m',\n FG_CYAN: '\\x1b[36m',\n FG_YELLOW: '\\x1b[33m',\n FG_RED: '\\x1b[31m',\n FG_GRAY: '\\x1b[90m',\n FG_WHITE: '\\x1b[37m',\n FG_BLUE: '\\x1b[34m',\n FG_MAGENTA: '\\x1b[35m',\n FG_BLACK: '\\x1b[30m',\n\n BG_YELLOW: '\\x1b[43m',\n BG_BLUE: '\\x1b[44m',\n BG_CYAN: '\\x1b[46m',\n BG_GREEN: '\\x1b[42m',\n BG_RED: '\\x1b[41m',\n\n // Cursor & Erasing\n ERASE_LINE: '\\x1b[2K', // Clear current line\n ERASE_DOWN: '\\x1b[J', // Clear from cursor to end of screen\n CURSOR_LEFT: '\\x1b[1000D', // Move cursor to start of line\n HIDE_CURSOR: '\\x1b[?25l',\n SHOW_CURSOR: '\\x1b[?25h',\n UP: '\\x1b[A',\n DOWN: '\\x1b[B',\n\n // Mouse Tracking (SGR Protocol)\n SET_ANY_EVENT_MOUSE: '\\x1b[?1003h',\n SET_SGR_EXT_MODE_MOUSE: '\\x1b[?1006h',\n DISABLE_MOUSE: '\\x1b[?1003l\\x1b[?1006l',\n};\n"],"names":["ANSI","RESET","BOLD","DIM","ITALIC","UNDERLINE","REVERSE","FG_GREEN","FG_CYAN","FG_YELLOW","FG_RED","FG_GRAY","FG_WHITE","FG_BLUE","FG_MAGENTA","FG_BLACK","BG_YELLOW","BG_BLUE","BG_CYAN","BG_GREEN","BG_RED","ERASE_LINE","ERASE_DOWN","CURSOR_LEFT","HIDE_CURSOR","SHOW_CURSOR","UP","DOWN","SET_ANY_EVENT_MOUSE","SET_SGR_EXT_MODE_MOUSE","DISABLE_MOUSE"],"mappings":"AAAA;;;CAGC;;;;+BAEYA;;;eAAAA;;;AAAN,MAAMA,OAAO;IAChBC,OAAO;IACPC,MAAM;IACNC,KAAK;IACLC,QAAQ;IACRC,WAAW;IACXC,SAAS;IAET,SAAS;IACTC,UAAU;IACVC,SAAS;IACTC,WAAW;IACXC,QAAQ;IACRC,SAAS;IACTC,UAAU;IACVC,SAAS;IACTC,YAAY;IACZC,UAAU;IAEVC,WAAW;IACXC,SAAS;IACTC,SAAS;IACTC,UAAU;IACVC,QAAQ;IAER,mBAAmB;IACnBC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,aAAa;IACbC,aAAa;IACbC,IAAI;IACJC,MAAM;IAEN,gCAAgC;IAChCC,qBAAqB;IACrBC,wBAAwB;IACxBC,eAAe;AACnB"}
|