@reliverse/rempts 1.7.65 → 2.2.7

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.
Files changed (131) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1534 -1431
  3. package/cleanup.mjs +33 -0
  4. package/dist/cancel.d.ts +31 -0
  5. package/dist/cancel.js +28 -0
  6. package/dist/ffi.d.ts +1 -0
  7. package/dist/ffi.js +165 -0
  8. package/dist/group.d.ts +16 -0
  9. package/dist/group.js +22 -0
  10. package/dist/launcher/command.d.ts +8 -0
  11. package/dist/launcher/command.js +10 -0
  12. package/dist/launcher/discovery.d.ts +3 -0
  13. package/dist/launcher/discovery.js +207 -0
  14. package/dist/launcher/errors.d.ts +15 -0
  15. package/dist/launcher/errors.js +31 -0
  16. package/dist/launcher/help.d.ts +3 -0
  17. package/dist/launcher/help.js +145 -0
  18. package/dist/launcher/mod.d.ts +12 -0
  19. package/dist/launcher/mod.js +222 -0
  20. package/dist/launcher/parser.d.ts +14 -0
  21. package/dist/launcher/parser.js +255 -0
  22. package/dist/launcher/registry.d.ts +10 -0
  23. package/dist/launcher/registry.js +42 -0
  24. package/dist/launcher/types.d.ts +78 -0
  25. package/dist/launcher/validator.d.ts +3 -0
  26. package/dist/launcher/validator.js +39 -0
  27. package/dist/mod.d.ts +6 -0
  28. package/dist/mod.js +6 -0
  29. package/dist/prompt.d.ts +13 -0
  30. package/dist/prompt.js +53 -0
  31. package/dist/selection.d.ts +92 -0
  32. package/dist/selection.js +191 -0
  33. package/dist/spinner.d.ts +26 -0
  34. package/dist/spinner.js +141 -0
  35. package/dist/utils.d.ts +3 -0
  36. package/dist/utils.js +11 -0
  37. package/package.json +41 -47
  38. package/bin/libs/animate/animate-mod.ts.txt +0 -78
  39. package/bin/libs/anykey/anykey-mod.d.ts +0 -12
  40. package/bin/libs/anykey/anykey-mod.js +0 -125
  41. package/bin/libs/cancel/cancel.d.ts +0 -45
  42. package/bin/libs/cancel/cancel.js +0 -72
  43. package/bin/libs/confirm/confirm-alias.d.ts +0 -2
  44. package/bin/libs/confirm/confirm-alias.js +0 -2
  45. package/bin/libs/confirm/confirm-mod.d.ts +0 -5
  46. package/bin/libs/confirm/confirm-mod.js +0 -179
  47. package/bin/libs/date/date.d.ts +0 -2
  48. package/bin/libs/date/date.js +0 -254
  49. package/bin/libs/editor/editor-mod.d.ts +0 -25
  50. package/bin/libs/editor/editor-mod.js +0 -1133
  51. package/bin/libs/figures/figures-mod.d.ts +0 -461
  52. package/bin/libs/figures/figures-mod.js +0 -285
  53. package/bin/libs/group/group-mod.d.ts +0 -33
  54. package/bin/libs/group/group-mod.js +0 -89
  55. package/bin/libs/input/input-alias.d.ts +0 -5
  56. package/bin/libs/input/input-alias.js +0 -4
  57. package/bin/libs/input/input-mod.d.ts +0 -16
  58. package/bin/libs/input/input-mod.js +0 -370
  59. package/bin/libs/intro/intro-alias.d.ts +0 -3
  60. package/bin/libs/intro/intro-alias.js +0 -3
  61. package/bin/libs/intro/intro-mod.d.ts +0 -19
  62. package/bin/libs/intro/intro-mod.js +0 -71
  63. package/bin/libs/launcher/command-runner.d.ts +0 -31
  64. package/bin/libs/launcher/command-runner.js +0 -229
  65. package/bin/libs/launcher/launcher-alias.d.ts +0 -2
  66. package/bin/libs/launcher/launcher-alias.js +0 -2
  67. package/bin/libs/launcher/launcher-mod.d.ts +0 -66
  68. package/bin/libs/launcher/launcher-mod.js +0 -1037
  69. package/bin/libs/launcher/launcher-types.d.ts +0 -176
  70. package/bin/libs/launcher/launcher-types.js +0 -0
  71. package/bin/libs/log/log-alias.d.ts +0 -1
  72. package/bin/libs/log/log-alias.js +0 -2
  73. package/bin/libs/msg-fmt/colors.d.ts +0 -30
  74. package/bin/libs/msg-fmt/colors.js +0 -42
  75. package/bin/libs/msg-fmt/mapping.d.ts +0 -3
  76. package/bin/libs/msg-fmt/mapping.js +0 -41
  77. package/bin/libs/msg-fmt/messages.d.ts +0 -35
  78. package/bin/libs/msg-fmt/messages.js +0 -305
  79. package/bin/libs/msg-fmt/terminal.d.ts +0 -15
  80. package/bin/libs/msg-fmt/terminal.js +0 -60
  81. package/bin/libs/msg-fmt/variants.d.ts +0 -11
  82. package/bin/libs/msg-fmt/variants.js +0 -52
  83. package/bin/libs/multiselect/multiselect-alias.d.ts +0 -2
  84. package/bin/libs/multiselect/multiselect-alias.js +0 -2
  85. package/bin/libs/multiselect/multiselect-prompt.d.ts +0 -2
  86. package/bin/libs/multiselect/multiselect-prompt.js +0 -340
  87. package/bin/libs/next-steps/next-steps.d.ts +0 -13
  88. package/bin/libs/next-steps/next-steps.js +0 -24
  89. package/bin/libs/number/number-mod.d.ts +0 -28
  90. package/bin/libs/number/number-mod.js +0 -234
  91. package/bin/libs/outro/outro-alias.d.ts +0 -3
  92. package/bin/libs/outro/outro-alias.js +0 -3
  93. package/bin/libs/outro/outro-mod.d.ts +0 -7
  94. package/bin/libs/outro/outro-mod.js +0 -49
  95. package/bin/libs/reliarg/reliarg-mod.d.ts +0 -76
  96. package/bin/libs/reliarg/reliarg-mod.js +0 -276
  97. package/bin/libs/results/results.d.ts +0 -7
  98. package/bin/libs/results/results.js +0 -27
  99. package/bin/libs/select/nummultiselect-prompt.d.ts +0 -6
  100. package/bin/libs/select/nummultiselect-prompt.js +0 -141
  101. package/bin/libs/select/numselect-prompt.d.ts +0 -7
  102. package/bin/libs/select/numselect-prompt.js +0 -111
  103. package/bin/libs/select/select-alias.d.ts +0 -9
  104. package/bin/libs/select/select-alias.js +0 -9
  105. package/bin/libs/select/select-prompt.d.ts +0 -5
  106. package/bin/libs/select/select-prompt.js +0 -311
  107. package/bin/libs/select/toggle-prompt.d.ts +0 -5
  108. package/bin/libs/select/toggle-prompt.js +0 -207
  109. package/bin/libs/spinner/spinner-impl.d.ts +0 -70
  110. package/bin/libs/spinner/spinner-impl.js +0 -336
  111. package/bin/libs/spinner/spinner-mod.d.ts +0 -167
  112. package/bin/libs/spinner/spinner-mod.js +0 -447
  113. package/bin/libs/utils/colorize.d.ts +0 -2
  114. package/bin/libs/utils/colorize.js +0 -122
  115. package/bin/libs/utils/errors.d.ts +0 -1
  116. package/bin/libs/utils/errors.js +0 -17
  117. package/bin/libs/utils/prevent.d.ts +0 -8
  118. package/bin/libs/utils/prevent.js +0 -62
  119. package/bin/libs/utils/prompt-end.d.ts +0 -8
  120. package/bin/libs/utils/prompt-end.js +0 -36
  121. package/bin/libs/utils/stream-text.d.ts +0 -18
  122. package/bin/libs/utils/stream-text.js +0 -138
  123. package/bin/libs/utils/system.d.ts +0 -6
  124. package/bin/libs/utils/system.js +0 -7
  125. package/bin/libs/utils/validate.d.ts +0 -21
  126. package/bin/libs/utils/validate.js +0 -17
  127. package/bin/libs/visual/visual-mod.ts.txt +0 -19
  128. package/bin/mod.d.ts +0 -50
  129. package/bin/mod.js +0 -127
  130. package/bin/types.d.ts +0 -372
  131. /package/{bin → dist/launcher}/types.js +0 -0
@@ -1,60 +0,0 @@
1
- import { relinka } from "@reliverse/relinka";
2
- import ansiEscapes from "ansi-escapes";
3
- import { cursor } from "sisteransi";
4
- import terminalSize from "terminal-size";
5
- import wrapAnsi from "wrap-ansi";
6
- export function getTerminalHeight() {
7
- return terminalSize().rows ?? 24;
8
- }
9
- export function getExactTerminalWidth() {
10
- return terminalSize().columns ?? 80;
11
- }
12
- export function getTerminalWidth(terminalWidth = 0) {
13
- if (terminalWidth === 0) {
14
- terminalWidth = getExactTerminalWidth();
15
- }
16
- if (terminalWidth > 150) {
17
- return terminalWidth - 40;
18
- }
19
- if (terminalWidth > 120) {
20
- return terminalWidth - 30;
21
- }
22
- if (terminalWidth > 100) {
23
- return terminalWidth - 20;
24
- }
25
- return terminalWidth;
26
- }
27
- export function breakLines(content, terminalWidth = 0) {
28
- if (terminalWidth === 0) {
29
- terminalWidth = getTerminalWidth();
30
- }
31
- return content.split("\n").flatMap(
32
- (line) => wrapAnsi(line, terminalWidth, { trim: false, hard: true }).split("\n").map((str) => str.trimEnd())
33
- ).join("\n");
34
- }
35
- export function removeCursor() {
36
- process.stdout.write(cursor.hide);
37
- }
38
- export function restoreCursor() {
39
- process.stdout.write(cursor.show);
40
- }
41
- export function deleteLastLine() {
42
- process.stdout.write(ansiEscapes.cursorUp(1) + ansiEscapes.eraseLine);
43
- }
44
- export function deleteLastLines(count) {
45
- if (count <= 0) {
46
- relinka("error", "Count is less than or equal to 0. Nothing to delete.");
47
- return;
48
- }
49
- process.stdout.write(ansiEscapes.eraseLines(count));
50
- }
51
- export function countLines(text) {
52
- const adjustedWidth = getTerminalWidth();
53
- const lines = text.split("\n");
54
- let lineCount = 0;
55
- for (const line of lines) {
56
- const wrapped = wrapAnsi(line, adjustedWidth, { hard: true });
57
- lineCount += wrapped.split("\n").length;
58
- }
59
- return lineCount;
60
- }
@@ -1,11 +0,0 @@
1
- import type { ColorName, VariantName } from "../../types";
2
- export declare const variantMap: {
3
- doubleBox: typeof createDoubleBox;
4
- };
5
- type ValidVariant = keyof typeof variantMap;
6
- export declare function isValidVariant(variant: string | undefined): variant is ValidVariant;
7
- export declare function applyVariant(lines: string[] | string, variant?: VariantName, options?: {
8
- limit?: number;
9
- }, borderColor?: ColorName): Promise<string>;
10
- declare function createDoubleBox(lines: string[], limit?: number, borderColor?: ColorName): string;
11
- export {};
@@ -1,52 +0,0 @@
1
- import { colorMap } from "./mapping.js";
2
- export const variantMap = {
3
- // box: createBox,
4
- doubleBox: createDoubleBox
5
- // banner: createBanner,
6
- // underline: createUnderline,
7
- };
8
- export function isValidVariant(variant) {
9
- return variant !== void 0 && variant !== "none" && variant in variantMap;
10
- }
11
- export async function applyVariant(lines, variant, options, borderColor) {
12
- const linesArray = Array.isArray(lines) ? lines : [lines];
13
- switch (variant) {
14
- // case "box":
15
- // return createBox(linesArray, options?.limit);
16
- case "doubleBox":
17
- return createDoubleBox(linesArray, options?.limit, borderColor);
18
- // case "banner":
19
- // return createBanner(linesArray);
20
- // case "underline":
21
- // return createUnderline(linesArray);
22
- default:
23
- return linesArray.join("\n");
24
- }
25
- }
26
- function createDoubleBox(lines, limit, borderColor) {
27
- const processedLines = processLines(lines, limit);
28
- const maxLength = Math.max(...processedLines.map((line) => line.length));
29
- const indentation = "";
30
- if (borderColor === void 0) {
31
- borderColor = "dim";
32
- }
33
- const topBorder = borderColor ? colorMap[borderColor](`${"\u2550".repeat(maxLength)}\u2557`) : `${"\u2550".repeat(maxLength)}\u2557`;
34
- const bottomBorder = borderColor ? colorMap[borderColor](`${indentation}\u255A${"\u2550".repeat(maxLength + 2)}\u255D`) : `${indentation}\u255A${"\u2550".repeat(maxLength + 2)}\u255D`;
35
- const middle = processedLines.map((line, index) => {
36
- const lineIndentation = index === 0 ? indentation : `${indentation} `;
37
- return `${lineIndentation}${borderColor ? colorMap[borderColor]("\u2551") : "\u2551"} ${colorMap[borderColor](line.padEnd(maxLength))} ${borderColor ? colorMap[borderColor]("\u2551") : "\u2551"}`;
38
- }).join("\n");
39
- return `${topBorder}
40
- ${middle}
41
- ${bottomBorder}`;
42
- }
43
- function processLines(lines, limit) {
44
- const linesArray = Array.isArray(lines) ? lines : [lines];
45
- return linesArray.map((line) => {
46
- let truncatedLine = line;
47
- if (limit && line.length > limit) {
48
- truncatedLine = `${line.slice(0, limit - 3)}...`;
49
- }
50
- return truncatedLine.padEnd(limit || truncatedLine.length);
51
- });
52
- }
@@ -1,2 +0,0 @@
1
- import type { MultiselectPromptParams } from "../../types";
2
- export declare const multiselect: <T extends string>(params: MultiselectPromptParams<T>) => Promise<T[]>;
@@ -1,2 +0,0 @@
1
- import { multiselectPrompt } from "../multiselect/multiselect-prompt.js";
2
- export const multiselect = multiselectPrompt;
@@ -1,2 +0,0 @@
1
- import type { MultiselectPromptParams } from "../../types";
2
- export declare function multiselectPrompt<T extends string>(params: MultiselectPromptParams<T>): Promise<T[]>;
@@ -1,340 +0,0 @@
1
- import { stdin as input, stdout as output } from "node:process";
2
- import readline from "node:readline";
3
- import { re } from "@reliverse/relico";
4
- import { relinka } from "@reliverse/relinka";
5
- import { msg, symbols } from "../msg-fmt/messages.js";
6
- import { deleteLastLine } from "../msg-fmt/terminal.js";
7
- import { completePrompt } from "../utils/prompt-end.js";
8
- function isSelectOption(option) {
9
- return !("separator" in option);
10
- }
11
- function renderPromptUI(params) {
12
- const {
13
- title,
14
- content,
15
- options,
16
- pointer,
17
- selectedOptions,
18
- errorMessage,
19
- displayInstructions,
20
- instructions,
21
- allDisabled,
22
- titleColor,
23
- contentColor,
24
- contentTypography,
25
- debug,
26
- titleVariant,
27
- titleTypography,
28
- isRerender = false
29
- } = params;
30
- if (!isRerender) {
31
- msg({
32
- type: "M_NULL",
33
- title,
34
- titleColor,
35
- ...titleTypography ? { titleTypography } : {},
36
- ...titleVariant ? { titleVariant } : {}
37
- });
38
- if (content) {
39
- msg({
40
- type: "M_NULL",
41
- content,
42
- contentColor,
43
- contentTypography
44
- });
45
- }
46
- }
47
- let uiLineCount = 0;
48
- if (errorMessage) {
49
- msg({
50
- type: "M_NULL",
51
- title: `${re.redBright(symbols.step_error)} ${re.redBright(errorMessage)}`
52
- });
53
- uiLineCount++;
54
- } else if (allDisabled) {
55
- msg({ type: "M_NULL", title: re.redBright("All options are disabled.") });
56
- uiLineCount++;
57
- } else if (displayInstructions && !isRerender) {
58
- msg({ type: "M_NULL", title: re.blue(instructions) });
59
- uiLineCount++;
60
- }
61
- for (let index = 0; index < options.length; index++) {
62
- const option = options[index];
63
- if (!option) continue;
64
- if (!isSelectOption(option)) {
65
- const width = option.width ?? 20;
66
- const symbolKey = option.symbol ?? "line";
67
- const lineSymbol = symbolKey in symbols ? symbols[symbolKey] : "\u2500";
68
- msg({ type: "M_NULL", title: re.dim(lineSymbol.repeat(width)) });
69
- uiLineCount++;
70
- continue;
71
- }
72
- const isSelected = selectedOptions.has(index);
73
- const isHighlighted = index === pointer;
74
- const isDisabled = option.disabled;
75
- const checkbox = isSelected ? "[x]" : "[ ]";
76
- const prefix = isHighlighted ? re.yellow(re.reset("> ")) : " ";
77
- const labelColor = isDisabled ? re.dim(re.reset(option.label)) : isHighlighted ? re.reset(re.yellow(option.label)) : re.reset(option.label);
78
- const hint = option.hint ? re.reset(` (${isDisabled ? re.dim(option.hint) : re.gray(option.hint)})`) : "";
79
- const formattedCheckbox = isHighlighted ? re.yellow(checkbox) : checkbox;
80
- msg({
81
- type: "M_NULL",
82
- title: `${prefix}${formattedCheckbox} ${labelColor}${hint}`
83
- });
84
- uiLineCount++;
85
- }
86
- if (debug) {
87
- relinka("log", "", { optionsCount: options.length });
88
- }
89
- return uiLineCount;
90
- }
91
- export async function multiselectPrompt(params) {
92
- const {
93
- title = "",
94
- message,
95
- content = "",
96
- options,
97
- defaultValue = [],
98
- initialValues,
99
- borderColor = "dim",
100
- titleColor = "cyan",
101
- titleTypography = "none",
102
- titleVariant,
103
- contentColor = "dim",
104
- contentTypography = "italic",
105
- border = true,
106
- endTitle = "",
107
- endTitleColor = "dim",
108
- debug = false,
109
- terminalWidth: customTerminalWidth = 90,
110
- displayInstructions = false,
111
- required = false,
112
- minSelect = 0,
113
- maxSelect,
114
- selectAll = false
115
- } = params;
116
- const finalTitle = message && title ? `${title}: ${message}` : message ?? title ?? "Select options";
117
- const finalDefaultValue = defaultValue ?? initialValues;
118
- const effectiveMinSelect = required ? Math.max(1, minSelect) : minSelect;
119
- let pointer = finalDefaultValue.length > 0 ? options.findIndex(
120
- (opt) => opt && isSelectOption(opt) && finalDefaultValue.includes(opt.value) && !opt.disabled
121
- ) : 0;
122
- if (pointer === -1) {
123
- pointer = options.findIndex((opt) => opt && isSelectOption(opt) && !opt.disabled);
124
- if (pointer === -1) {
125
- pointer = 0;
126
- }
127
- }
128
- const selectedOptions = new Set(
129
- selectAll ? options.map((opt, index) => opt && isSelectOption(opt) && !opt.disabled ? index : -1).filter((i) => i !== -1) : finalDefaultValue.map((val) => options.findIndex((o) => o && isSelectOption(o) && o.value === val)).filter(
130
- (i) => i >= 0 && options[i] && isSelectOption(options[i]) && !options[i].disabled
131
- )
132
- );
133
- const rl = readline.createInterface({ input, output });
134
- readline.emitKeypressEvents(input, rl);
135
- if (typeof input.setRawMode === "function") {
136
- input.setRawMode(true);
137
- }
138
- let errorMessage = "";
139
- const allDisabled = options.filter(isSelectOption).every((option) => option.disabled);
140
- const instructions = "Use <\u2191/\u2193> to navigate, <Space> to toggle, <A> to toggle all";
141
- function toggleSelectAll() {
142
- const selectableIndexes = options.map((opt, i) => isSelectOption(opt) && !opt.disabled ? i : -1).filter((i) => i !== -1);
143
- const allSelected = selectableIndexes.every((i) => selectedOptions.has(i));
144
- if (allSelected) {
145
- for (const i of selectableIndexes) {
146
- selectedOptions.delete(i);
147
- }
148
- } else {
149
- for (const i of selectableIndexes) {
150
- selectedOptions.add(i);
151
- }
152
- }
153
- }
154
- function movePointerUp() {
155
- const originalPointer = pointer;
156
- do {
157
- pointer = (pointer - 1 + options.length) % options.length;
158
- const currentOption = options[pointer];
159
- if (currentOption && isSelectOption(currentOption) && !currentOption.disabled) {
160
- break;
161
- }
162
- } while (pointer !== originalPointer);
163
- errorMessage = "";
164
- }
165
- function movePointerDown() {
166
- const originalPointer = pointer;
167
- do {
168
- pointer = (pointer + 1) % options.length;
169
- const currentOption = options[pointer];
170
- if (currentOption && isSelectOption(currentOption) && !currentOption.disabled) {
171
- break;
172
- }
173
- } while (pointer !== originalPointer);
174
- errorMessage = "";
175
- }
176
- let lastUILineCount = 0;
177
- function renderOptions() {
178
- if (lastUILineCount > 0) {
179
- for (let i = 0; i < lastUILineCount; i++) {
180
- process.stdout.write("\x1B[1A\x1B[2K");
181
- }
182
- }
183
- lastUILineCount = renderPromptUI({
184
- title: finalTitle,
185
- content,
186
- options,
187
- pointer,
188
- selectedOptions,
189
- errorMessage,
190
- displayInstructions,
191
- instructions,
192
- allDisabled,
193
- titleColor,
194
- contentColor,
195
- contentTypography,
196
- debug,
197
- borderColor,
198
- ...titleVariant !== void 0 && { titleVariant },
199
- titleTypography,
200
- terminalWidth: customTerminalWidth,
201
- resized: false,
202
- isRerender: true
203
- });
204
- }
205
- lastUILineCount = renderPromptUI({
206
- title: finalTitle,
207
- content,
208
- options,
209
- pointer,
210
- selectedOptions,
211
- errorMessage,
212
- displayInstructions,
213
- instructions,
214
- allDisabled,
215
- titleColor,
216
- contentColor,
217
- contentTypography,
218
- debug,
219
- borderColor,
220
- ...titleVariant !== void 0 && { titleVariant },
221
- titleTypography,
222
- terminalWidth: customTerminalWidth,
223
- resized: false,
224
- isRerender: false
225
- });
226
- return new Promise((resolve) => {
227
- function cleanup(isCtrlC = false) {
228
- if (typeof input.setRawMode === "function") {
229
- input.setRawMode(false);
230
- }
231
- rl.close();
232
- input.removeListener("keypress", handleKeypress);
233
- if (isCtrlC) {
234
- process.exit(0);
235
- }
236
- }
237
- async function endPrompt(isCtrlC = false) {
238
- await completePrompt(
239
- "multiselect",
240
- isCtrlC,
241
- endTitle,
242
- endTitleColor,
243
- titleTypography,
244
- titleVariant ? titleVariant : void 0,
245
- border,
246
- borderColor,
247
- void 0,
248
- false
249
- );
250
- cleanup(isCtrlC);
251
- }
252
- async function confirmSelection() {
253
- const selectedCount = selectedOptions.size;
254
- if (selectedCount < effectiveMinSelect) {
255
- deleteLastLine();
256
- errorMessage = `You must select at least ${effectiveMinSelect} option${effectiveMinSelect !== 1 ? "s" : ""}.`;
257
- renderOptions();
258
- return;
259
- }
260
- if (maxSelect !== void 0 && selectedCount > maxSelect) {
261
- deleteLastLine();
262
- errorMessage = `You can select at most ${maxSelect} option${maxSelect !== 1 ? "s" : ""}.`;
263
- renderOptions();
264
- return;
265
- }
266
- const selectedValues = Array.from(selectedOptions).filter((idx) => {
267
- const opt = options[idx];
268
- return opt && isSelectOption(opt) && !opt.disabled;
269
- }).map((idx) => {
270
- const opt = options[idx];
271
- return opt && isSelectOption(opt) ? opt.value : null;
272
- }).filter((val) => val !== null && val !== void 0);
273
- cleanup();
274
- resolve(selectedValues);
275
- deleteLastLine();
276
- await completePrompt(
277
- "multiselect",
278
- false,
279
- endTitle,
280
- endTitleColor,
281
- titleTypography,
282
- titleVariant ? titleVariant : void 0,
283
- border,
284
- borderColor,
285
- void 0,
286
- true
287
- );
288
- }
289
- function handleKeypress(_str, key) {
290
- if (allDisabled) {
291
- if (key.name === "c" && key.ctrl) {
292
- void endPrompt(true);
293
- return;
294
- }
295
- return;
296
- }
297
- switch (key.name) {
298
- case "up":
299
- case "k":
300
- movePointerUp();
301
- renderOptions();
302
- break;
303
- case "down":
304
- case "j":
305
- movePointerDown();
306
- renderOptions();
307
- break;
308
- case "space": {
309
- const currentOption = options[pointer];
310
- if (!currentOption || !isSelectOption(currentOption) || currentOption.disabled) {
311
- errorMessage = "This option is disabled";
312
- } else {
313
- if (selectedOptions.has(pointer)) {
314
- selectedOptions.delete(pointer);
315
- } else {
316
- selectedOptions.add(pointer);
317
- }
318
- errorMessage = "";
319
- }
320
- renderOptions();
321
- break;
322
- }
323
- case "return":
324
- void confirmSelection();
325
- break;
326
- case "c":
327
- if (key.ctrl) {
328
- void endPrompt(true);
329
- }
330
- break;
331
- case "a":
332
- toggleSelectAll();
333
- errorMessage = "";
334
- renderOptions();
335
- break;
336
- }
337
- }
338
- input.on("keypress", handleKeypress);
339
- });
340
- }
@@ -1,13 +0,0 @@
1
- import type { ColorName, TypographyName, VariantName } from "../../types";
2
- interface NextStepsPromptOptions {
3
- title?: string;
4
- titleColor?: ColorName;
5
- titleVariant?: VariantName;
6
- titleTypography?: TypographyName;
7
- content: string[];
8
- contentColor?: ColorName;
9
- contentVariant?: VariantName;
10
- contentTypography?: TypographyName;
11
- }
12
- export declare function nextStepsPrompt(options: NextStepsPromptOptions): Promise<void>;
13
- export {};
@@ -1,24 +0,0 @@
1
- import { msg } from "../msg-fmt/messages.js";
2
- export async function nextStepsPrompt(options) {
3
- const {
4
- title = "",
5
- titleColor = "cyan",
6
- titleVariant,
7
- titleTypography = "none",
8
- content = [],
9
- contentColor = "dim",
10
- contentVariant,
11
- contentTypography = "italic"
12
- } = options;
13
- msg({
14
- type: "M_INFO",
15
- title,
16
- titleColor,
17
- titleTypography,
18
- ...titleVariant ? { titleVariant } : {},
19
- content: Array.isArray(content) ? content.join("\n") : content,
20
- contentColor,
21
- contentTypography,
22
- ...contentVariant ? { contentVariant } : {}
23
- });
24
- }
@@ -1,28 +0,0 @@
1
- import type { BorderColorName, ColorName, FmtMsgOptions, TypographyName } from "../../types";
2
- type VariantName = FmtMsgOptions["titleVariant"];
3
- interface NumberPromptOptions {
4
- title: string;
5
- hint?: string;
6
- hintPlaceholderColor?: ColorName;
7
- validate?: (value: number) => string | undefined | boolean | Promise<string | undefined | boolean>;
8
- defaultValue?: string | number;
9
- schema?: any;
10
- titleColor?: ColorName;
11
- titleTypography?: TypographyName;
12
- titleVariant?: VariantName;
13
- content?: string;
14
- contentColor?: ColorName;
15
- contentTypography?: TypographyName;
16
- contentVariant?: VariantName;
17
- borderColor?: BorderColorName;
18
- variantOptions?: any;
19
- endTitle?: string;
20
- endTitleColor?: ColorName;
21
- border?: boolean;
22
- hardcoded?: {
23
- userInput?: string;
24
- errorMessage?: string;
25
- };
26
- }
27
- export declare function numberPrompt(opts: NumberPromptOptions): Promise<number>;
28
- export {};