@reliverse/relinka 1.1.2 → 1.1.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.
Files changed (80) hide show
  1. package/dist-npm/components/checkbox/index.js +8 -6
  2. package/dist-npm/components/confirm/index.js +7 -4
  3. package/dist-npm/components/core/Separator.d.ts +0 -4
  4. package/dist-npm/components/core/create-prompt.js +1 -1
  5. package/dist-npm/components/core/key.js +6 -6
  6. package/dist-npm/components/core/lines.d.ts +5 -17
  7. package/dist-npm/components/core/lines.js +6 -2
  8. package/dist-npm/components/core/make-theme.js +3 -1
  9. package/dist-npm/components/core/position.d.ts +0 -8
  10. package/dist-npm/components/core/position.js +9 -3
  11. package/dist-npm/components/core/promise-polyfill.js +2 -2
  12. package/dist-npm/components/core/screen-manager.js +2 -1
  13. package/dist-npm/components/core/theme.d.ts +12 -146
  14. package/dist-npm/components/core/theme.js +1 -1
  15. package/dist-npm/components/core/use-keypress.js +3 -1
  16. package/dist-npm/components/core/use-pagination.d.ts +4 -8
  17. package/dist-npm/components/core/use-prefix.js +1 -1
  18. package/dist-npm/components/core/useKeyPress.js +3 -1
  19. package/dist-npm/components/core/utils.d.ts +0 -11
  20. package/dist-npm/components/date/date.js +1 -1
  21. package/dist-npm/components/expand/index.js +4 -2
  22. package/dist-npm/components/figures/index.js +5 -5
  23. package/dist-npm/components/instance/basic.d.ts +0 -12
  24. package/dist-npm/components/instance/basic.js +1 -1
  25. package/dist-npm/components/instance/browser.d.ts +0 -14
  26. package/dist-npm/components/instance/reporter/browser.js +5 -5
  27. package/dist-npm/components/instance/reporter/fancy.d.ts +1 -1
  28. package/dist-npm/components/instance/reporter/fancy.js +1 -1
  29. package/dist-npm/components/mono/mono.js +9 -9
  30. package/dist-npm/components/mono/monoTwo.d.ts +13 -76
  31. package/dist-npm/components/password/password-main.js +1 -1
  32. package/dist-npm/components/progressbar/ProgressBar.d.ts +3 -14
  33. package/dist-npm/components/progressbar/ProgressBar.js +3 -14
  34. package/dist-npm/components/progressbar/helper.d.ts +2 -18
  35. package/dist-npm/components/prompts/create.d.ts +0 -13
  36. package/dist-npm/components/prompts/prompt.js +3 -3
  37. package/dist-npm/components/prompts/promptTwo.d.ts +34 -252
  38. package/dist-npm/components/prompts/promptTwo.js +6 -27
  39. package/dist-npm/components/prompts/relinka.d.ts +17 -114
  40. package/dist-npm/components/prompts/relinka.js +18 -103
  41. package/dist-npm/components/range/range.d.ts +12 -64
  42. package/dist-npm/components/range/range.js +36 -59
  43. package/dist-npm/components/rawlist/index.js +6 -4
  44. package/dist-npm/components/search/index.js +7 -5
  45. package/dist-npm/components/select/index.js +9 -3
  46. package/dist-npm/components/select/select-main.js +3 -1
  47. package/dist-npm/components/select/select-two.js +3 -1
  48. package/dist-npm/components/toggle/index.js +3 -1
  49. package/dist-npm/testing/index.js +1 -1
  50. package/dist-npm/types/general.d.ts +30 -141
  51. package/dist-npm/types/keypress.d.ts +0 -3
  52. package/dist-npm/types/keypress.js +1 -1
  53. package/dist-npm/types/readline.d.ts +1 -9
  54. package/dist-npm/types/relinka.d.ts +1 -9
  55. package/dist-npm/types/utils.d.ts +0 -12
  56. package/dist-npm/utils/box.d.ts +14 -104
  57. package/dist-npm/utils/color.d.ts +0 -20
  58. package/dist-npm/utils/colorize.js +2 -1
  59. package/dist-npm/utils/component.d.ts +5 -26
  60. package/dist-npm/utils/component.js +1 -2
  61. package/dist-npm/utils/constants.d.ts +0 -21
  62. package/dist-npm/utils/constants.js +8 -8
  63. package/dist-npm/utils/decoder.d.ts +2 -17
  64. package/dist-npm/utils/decoder.js +54 -25
  65. package/dist-npm/utils/error.d.ts +0 -5
  66. package/dist-npm/utils/errors.d.ts +1 -1
  67. package/dist-npm/utils/errors.js +8 -4
  68. package/dist-npm/utils/format.d.ts +0 -12
  69. package/dist-npm/utils/keypress.d.ts +0 -6
  70. package/dist-npm/utils/keypress.js +12 -23
  71. package/dist-npm/utils/log.d.ts +0 -11
  72. package/dist-npm/utils/prompt-tmp.js +2 -2
  73. package/dist-npm/utils/prompt-two.js +2 -2
  74. package/dist-npm/utils/skeleton.d.ts +0 -3
  75. package/dist-npm/utils/skeleton.js +66 -22
  76. package/dist-npm/utils/stream.d.ts +0 -13
  77. package/dist-npm/utils/string.d.ts +0 -45
  78. package/dist-npm/utils/tree.d.ts +5 -34
  79. package/dist-npm/utils/variants.js +9 -9
  80. package/package.json +9 -5
@@ -4,90 +4,27 @@ type SelectOption = {
4
4
  hint?: string;
5
5
  };
6
6
  export type TextPromptOptions = {
7
- /**
8
- * Specifies the prompt type as text.
9
- * @optional
10
- * @default "text"
11
- */
12
- type?: "text";
13
- /**
14
- * The default text value.
15
- * @optional
16
- */
17
- default?: string;
18
- /**
19
- * A placeholder text displayed in the prompt.
20
- * @optional
21
- */
22
- placeholder?: string;
23
- /**
24
- * The initial text value.
25
- * @optional
26
- */
27
- initial?: string;
7
+ type?: "text";
8
+ default?: string;
9
+ placeholder?: string;
10
+ initial?: string;
28
11
  };
29
12
  export type ConfirmPromptOptions = {
30
- /**
31
- * Specifies the prompt type as confirm.
32
- */
33
- type: "confirm";
34
- /**
35
- * The initial value for the confirm prompt.
36
- * @optional
37
- */
38
- initial?: boolean;
13
+ type: "confirm";
14
+ initial?: boolean;
39
15
  };
40
16
  export type SelectPromptOptions = {
41
- /**
42
- * Specifies the prompt type as select.
43
- */
44
- type: "select";
45
- /**
46
- * The initial value for the select prompt.
47
- * @optional
48
- */
49
- initial?: string;
50
- /**
51
- * The options to select from. See {@link SelectOption}.
52
- */
53
- options: (string | SelectOption)[];
17
+ type: "select";
18
+ initial?: string;
19
+ options: (string | SelectOption)[];
54
20
  };
55
21
  export type MultiSelectOptions = {
56
- /**
57
- * Specifies the prompt type as multiselect.
58
- */
59
- type: "multiselect";
60
- /**
61
- * The options to select from. See {@link SelectOption}.
62
- */
63
- initial?: string[];
64
- /**
65
- * The options to select from. See {@link SelectOption}.
66
- */
67
- options: (string | SelectOption)[];
68
- /**
69
- * Whether the prompt requires at least one selection.
70
- */
71
- required?: boolean;
22
+ type: "multiselect";
23
+ initial?: string[];
24
+ options: (string | SelectOption)[];
25
+ required?: boolean;
72
26
  };
73
- /**
74
- * Defines a combined type for all prompt options.
75
- */
76
27
  export type PromptOptions = TextPromptOptions | ConfirmPromptOptions | SelectPromptOptions | MultiSelectOptions;
77
28
  type inferPromptReturnType<T extends PromptOptions> = T extends TextPromptOptions ? string : T extends ConfirmPromptOptions ? boolean : T extends SelectPromptOptions ? T["options"][number] extends SelectOption ? T["options"][number]["value"] : T["options"][number] : T extends MultiSelectOptions ? T["options"] : unknown;
78
- /**
79
- * Asynchronously prompts the user for input based on specified options.
80
- * Supports text, confirm, select and multi-select prompts.
81
- *
82
- * @param {string} message - The message to display in the prompt.
83
- * @param {PromptOptions} [opts={}] - The prompt options. See {@link PromptOptions}.
84
- * @returns {Promise<inferPromptReturnType<T>>} - A promise that resolves with the user's response, the type of which is inferred from the options. See {@link inferPromptReturnType}.
85
- */
86
29
  export declare function prompt<_ = any, __ = any, T extends PromptOptions = TextPromptOptions>(message: string, opts?: PromptOptions): Promise<inferPromptReturnType<T>>;
87
30
  export {};
88
- /**
89
- * Asynchronously prompts the user for a multi-select input.
90
- *
91
- * @param {MultiselectPromptOptionsSeparate} opts - The options for the multi-select prompt.
92
- * @returns {Promise<string[] | symbol>} - A promise that resolves with an array of selected options or a symbol.
93
- */
@@ -104,7 +104,7 @@ ${formattedBar}`);
104
104
  stdin.pause();
105
105
  stdin.removeListener("data", onData);
106
106
  reject(new Error("User aborted."));
107
- } else if (char === "\x7F" || // Backspace
107
+ } else if (char === "\x7F" ||
108
108
  char === "\b" || char === "\x7F" || char === "\b") {
109
109
  if (password.length > 0) {
110
110
  password = password.slice(0, -1);
@@ -16,18 +16,7 @@ export declare class ProgressBar {
16
16
  private format;
17
17
  private colorize;
18
18
  constructor(options: ProgressBarOptions);
19
- /**
20
- * Update the progress bar to a specific value.
21
- * @param value - The current progress value.
22
- */
23
- update(value: number): void;
24
- /**
25
- * Increment the progress bar by a specific amount.
26
- * @param amount - The amount to increment.
27
- */
28
- increment(amount?: number): void;
29
- /**
30
- * Render the progress bar in the console.
31
- */
32
- private render;
19
+ update(value: number): void;
20
+ increment(amount?: number): void;
21
+ private render;
33
22
  }
@@ -21,28 +21,17 @@ export class ProgressBar {
21
21
  this.format = options.format || "Progress: [:bar] :percent% | Elapsed: :elapsed s";
22
22
  this.colorize = options.colorize || false;
23
23
  }
24
- /**
25
- * Update the progress bar to a specific value.
26
- * @param value - The current progress value.
27
- */
28
- update(value) {
24
+ update(value) {
29
25
  const newValue = Math.min(value, this.total);
30
26
  if (newValue !== this.current) {
31
27
  this.current = newValue;
32
28
  this.render();
33
29
  }
34
30
  }
35
- /**
36
- * Increment the progress bar by a specific amount.
37
- * @param amount - The amount to increment.
38
- */
39
- increment(amount = 1) {
31
+ increment(amount = 1) {
40
32
  this.update(this.current + amount);
41
33
  }
42
- /**
43
- * Render the progress bar in the console.
44
- */
45
- render() {
34
+ render() {
46
35
  const percent = this.current / this.total;
47
36
  const filledLength = Math.round(this.width * percent);
48
37
  const emptyLength = this.width - filledLength;
@@ -1,22 +1,6 @@
1
1
  import type { ProgressBarOptions } from "./ProgressBar.js";
2
- /**
3
- * Options for the progressbar helper function.
4
- */
5
2
  export type ProgressBarTaskOptions = ProgressBarOptions & {
6
- /**
7
- * The amount to increment the progress bar each step.
8
- * @default 1
9
- */
10
- increment?: number;
11
- /**
12
- * Desired total time for the progress bar to complete in milliseconds.
13
- * @default 3000
14
- */
15
- desiredTotalTime?: number;
3
+ increment?: number;
4
+ desiredTotalTime?: number;
16
5
  };
17
- /**
18
- * Displays a progress bar that completes based on the provided options.
19
- * @param options - Configuration options for the progress bar.
20
- * @returns A promise that resolves when the progress bar completes.
21
- */
22
6
  export declare function progressbar(options: ProgressBarTaskOptions): Promise<void>;
@@ -1,21 +1,8 @@
1
1
  import type { RelinkaOptions } from "../../types/general.js";
2
2
  import type { RelinkaInstance } from "./relinka.js";
3
3
  export * from "../instance/shared.js";
4
- /**
5
- * Factory function to create a new Relinka instance tailored for use in different environments.
6
- * It automatically adjusts logging levels based on environment variables and execution context.
7
- *
8
- * @param {Partial<RelinkaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptions}.
9
- * @returns {RelinkaInstance} A new Relinka instance with configurations based on the given options and the execution environment.
10
- */
11
4
  export declare function createRelinka(options?: Partial<RelinkaOptions & {
12
5
  fancy: boolean;
13
6
  }>): RelinkaInstance;
14
- /**
15
- * A default instance of Relinka, created and configured for immediate use.
16
- * This instance is configured based on the execution environment and the options provided.
17
- *
18
- * @type {RelinkaInstance} relinka - The default Relinka instance, ready to use.
19
- */
20
7
  export declare const relinka: RelinkaInstance;
21
8
  export default relinka;
@@ -26,13 +26,13 @@ function setRawMode(input, value) {
26
26
  input.setRawMode(value);
27
27
  }
28
28
  }
29
- const aliases = /* @__PURE__ */ new Map([
29
+ const aliases = new Map([
30
30
  ["k", "up"],
31
31
  ["j", "down"],
32
32
  ["h", "left"],
33
33
  ["l", "right"]
34
34
  ]);
35
- const keys = /* @__PURE__ */ new Set(["up", "down", "left", "right", "space", "enter"]);
35
+ const keys = new Set(["up", "down", "left", "right", "space", "enter"]);
36
36
  export default class Prompt {
37
37
  input;
38
38
  output;
@@ -103,7 +103,7 @@ export default class Prompt {
103
103
  });
104
104
  });
105
105
  }
106
- subscribers = /* @__PURE__ */ new Map();
106
+ subscribers = new Map();
107
107
  on(event, cb) {
108
108
  const arr = this.subscribers.get(event) ?? [];
109
109
  arr.push({ cb });
@@ -1,98 +1,26 @@
1
1
  export { isCancel } from "../../components/prompts/prompt.js";
2
2
  export type TextOptions = {
3
- /**
4
- * The primary message to display for the prompt.
5
- */
6
- message: string;
7
- /**
8
- * A placeholder string that is displayed in the input field when it is empty. It disappears when the user starts typing.
9
- * @optional
10
- */
11
- placeholder?: string;
12
- /**
13
- * The primary message to display for the prompt.
14
- * A default value for the input field.This value will be returned if the user does not enter a value.
15
- * @optional
16
- */
17
- defaultValue?: string;
18
- /**
19
- * An initial value that appears in the input field. Unlike `defaultValue`, it can be edited or removed by the user.
20
- * @optional
21
- */
22
- initialValue?: string;
23
- /**
24
- * A function to validate the input. If the input is not valid, this function should return a string message.
25
- * The prompt will continue until a valid value is entered or the prompt is aborted.
26
- * @param {string} value - The current value of the input field.
27
- * @returns {string | void} A string with an error message if validation fails or `void` if the input is valid.
28
- * optional
29
- */
30
- validate?: (value: string) => string | void;
3
+ message: string;
4
+ placeholder?: string;
5
+ defaultValue?: string;
6
+ initialValue?: string;
7
+ validate?: (value: string) => string | void;
31
8
  };
32
- /**
33
- * Provides text input functionality with customizable options.
34
- * @param {TextOptions} opts - Options to customize the text prompt. See {@link TextOptions}.
35
- * @returns {Promise<string | symbol>} A promise that resolves to the user input or a symbol for special cases.
36
- */
37
9
  export declare const text: (opts: TextOptions) => any;
38
10
  export type PasswordOptions = {
39
- /**
40
- * The message to be displayed above the input field.
41
- */
42
- message: string;
43
- /**
44
- * A character that masks the user's input, hiding the text they type.
45
- * @optional
46
- */
47
- mask?: string;
48
- /**
49
- * A function to validate the input. Returns an error message if the input fails validation.
50
- * @param {string} value - The current value of the input field.
51
- * @returns {string | void} An error message if the input fails validation, or `void` if the input is valid.
52
- * @optional
53
- */
54
- validate?: (value: string) => string | void;
11
+ message: string;
12
+ mask?: string;
13
+ validate?: (value: string) => string | void;
55
14
  };
56
- /**
57
- * Provides password input functionality with customizable options, including input masking.
58
- * @param {PasswordOptions} opts - Options to customize the password prompt. See {@link PasswordOptions}.
59
- * @returns {Promise<string | symbol>} A promise that resolves to the user input or a symbol for special cases.
60
- */
61
15
  export declare const password: (opts: PasswordOptions) => any;
62
16
  export type ConfirmOptions = {
63
- /**
64
- * The primary message to display for the prompt.
65
- */
66
- message: string;
67
- /**
68
- * The text to display for the active/affirmative choice.
69
- * @optional
70
- */
71
- active?: string;
72
- /**
73
- * Text to display for the inactive/negative choice.
74
- * @optional
75
- */
76
- inactive?: string;
77
- /**
78
- * The initial selection value.
79
- * @optional
80
- */
81
- initialValue?: boolean;
17
+ message: string;
18
+ active?: string;
19
+ inactive?: string;
20
+ initialValue?: boolean;
82
21
  };
83
- /**
84
- * Provides a confirmation prompt with customizable options.
85
- * @param {ConfirmOptions} opts - Options to customize the confirmation prompt. See {@link ConfirmOptions}.
86
- * @returns {Promise<boolean | symbol>} A promise that resolves to the user's choice, or a symbol for special cases.
87
- */
88
22
  export declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
89
- /**
90
- * A generic type for option values in a select prompt, supporting both primitive and complex types.
91
- */
92
23
  type Primitive = Readonly<string | boolean | number>;
93
- /**
94
- * Defines the structure of an option in a select prompt.
95
- */
96
24
  type Option<Value> = Value extends Primitive ? {
97
25
  value: Value;
98
26
  label?: string;
@@ -102,181 +30,45 @@ type Option<Value> = Value extends Primitive ? {
102
30
  label: string;
103
31
  hint?: string;
104
32
  };
105
- /**
106
- * Options for configuring the select prompt.
107
- * @template Options - An array of option objects. See {@link Option}.
108
- * @template Value - The type of option value. See {@link Option}.
109
- */
110
33
  export type SelectOptions<Options extends Option<Value>[], Value> = {
111
- /**
112
- * The primary message to display at the prompt.
113
- */
114
- message: string;
115
- /**
116
- * The list of options from which the user can choose. See {@link Option}.
117
- */
118
- options: Options;
119
- /**
120
- * The initial value selected in the prompt. See {@link Value}.
121
- * @optional
122
- */
123
- initialValue?: Value;
34
+ message: string;
35
+ options: Options;
36
+ initialValue?: Value;
124
37
  };
125
- /**
126
- * Provides a select prompt functionality where the user can choose from a list of options.
127
- * @param {SelectOptions<Options, Value>} opts - Options to customize the select prompt. See {@link SelectOptions}.
128
- * @returns {Promise<Value | Symbol>} A promise that resolves to the selected value or a symbol for special cases. See {@link Value}.
129
- */
130
38
  export declare const select: <Options extends Option<Value>[], Value>(opts: SelectOptions<Options, Value>) => Promise<Value | symbol>;
131
- /**
132
- * Provides a prompt that allows the user to select an option by pressing a key.
133
- * This is useful for scenarios where each option is associated with a specific key.
134
- * @param {SelectOptions<Options, Value>} opts - Configuration options for the select key prompt. See {@link SelectOptions}.
135
- * @returns {Promise<Value | Symbol>} A promise that resolves to the value of the selected option, or a symbol for special cases such as abort. See {@link Value}.
136
- */
137
39
  export declare const selectKey: <Options extends Option<Value>[], Value extends string>(opts: SelectOptions<Options, Value>) => Promise<Value | symbol>;
138
40
  export type MultiSelectOptions<Options extends Option<Value>[], Value> = {
139
- /**
140
- * The primary message to be displayed above the multi-select list.
141
- */
142
- message: string;
143
- /**
144
- * The list of options from which users can select multiple items. See {@link Option}.
145
- */
146
- options: Options;
147
- /**
148
- * An array of values representing the options initially selected in the prompt. See {@link Value}.
149
- * @optional
150
- */
151
- initialValues?: Value[];
152
- /**
153
- * Specifies whether at least one selection is required before submitting.
154
- * @optional
155
- */
156
- required?: boolean;
157
- /**
158
- * The value of the option on which the cursor is initially placed when the command prompt opens. See {@link Value}.
159
- * @optional
160
- */
161
- cursorAt?: Value;
41
+ message: string;
42
+ options: Options;
43
+ initialValues?: Value[];
44
+ required?: boolean;
45
+ cursorAt?: Value;
162
46
  };
163
- /**
164
- * Provides multi-select prompt functionality where the user can select multiple options from a list.
165
- * @param {MultiSelectOptions<Options, Value>} opts - Options to customize the multi-select prompt. See {@link MultiSelectOptions}.
166
- * @returns {Promise<Value[] | Symbol>} A promise that resolves to an array of selected values, or a symbol for special cases.
167
- */
168
47
  export declare const multiselect: <Options extends Option<Value>[], Value>(opts: MultiSelectOptions<Options, Value>) => Promise<Value[] | symbol>;
169
48
  export type GroupMultiSelectOptions<Options extends Option<Value>[], Value> = {
170
- /**
171
- * The primary message to be displayed above the group multi-select list.
172
- */
173
- message: string;
174
- /**
175
- * An object containing groups of options. Each key represents a group name,
176
- * and the associated value is an array of options within that group. See {@link Option}.
177
- */
178
- options: Record<string, Options>;
179
- /**
180
- * An array of values representing the initially selected options across all groups. See {@link Value}.
181
- * @optional
182
- */
183
- initialValues?: Value[];
184
- /**
185
- * Specifies whether at least one selection is required before submission is allowed.
186
- * @optional
187
- */
188
- required?: boolean;
189
- /**
190
- * The value of the option on which the cursor will initially appear when the command prompt opens. See {@link Value}.
191
- * @optional
192
- */
193
- cursorAt?: Value;
49
+ message: string;
50
+ options: Record<string, Options>;
51
+ initialValues?: Value[];
52
+ required?: boolean;
53
+ cursorAt?: Value;
194
54
  };
195
55
  export declare const groupMultiselect: <Options extends Option<Value>[], Value>(opts: GroupMultiSelectOptions<Options, Value>) => Promise<Value[] | symbol>;
196
- /**
197
- * Displays a formatted note in the console, with an optional title. The note is visually distinguished
198
- * from regular console output with ANSI color codes and styles to make it stand out. The function calculates
199
- * the length of the longest line to ensure the note is properly aligned and framed.
200
- *
201
- * @param {string} [message=""] - The main text of the note. Supports multiline strings.
202
- * @param {string} [title=""] - An optional title for the note. If provided, it'll be displayed above the message.
203
- */
204
56
  export declare const note: (message?: string, title?: string) => void;
205
- /**
206
- * Prints an abort message to the console. This is typically used to indicate
207
- * that a process or operation has been cancelled. The message is colored for
208
- * for emphasis and visual differentiation.
209
- *
210
- * @param {string} [message=""] - The cancellation message to display. This parameter
211
- * is optional; if omitted, the default styling will be used without a specific message.
212
- */
213
57
  export declare const cancel: (message?: string) => void;
214
- /**
215
- * Prints an introductory message to the console. This function is used to
216
- * Display a title or short message at the beginning of a script or application.
217
- * framed by a specified bar character for visual distinction.
218
- *
219
- * @param {string} [title=""] - The title or message to display. This parameter is optional; if omitted, only the framing bar will be printed.
220
- */
221
58
  export declare const intro: (title?: string) => void;
222
- /**
223
- * Prints a closing message to the console. Similar to the `intro` function,
224
- * `outro' is designed to indicate the end of a script or application execution
225
- * with a framed message for clear visual separation from the rest of the console output.
226
- *
227
- * @param {string} [message=""] - The final message to display. This parameter is optional; if omitted, only the border will be printed.
228
- */
229
59
  export declare const outro: (message?: string) => void;
230
60
  export type LogMessageOptions = {
231
- /**
232
- * A custom icon to be placed in front of the log message. This allows visual differentiation
233
- * log messages based on their importance or category (e.g. info, error).
234
- * @optional
235
- */
236
- symbol?: string;
61
+ symbol?: string;
237
62
  };
238
- /**
239
- * Logs a message to the console, with support for different types of messages (info, success, warning, error).
240
- */
241
63
  export declare const log: {
242
- /**
243
- * Logs an message, prefixed with a gray bar.
244
- * @param {string} message - The message to log.
245
- * @param {LogMessageOptions} [opts] - Optional settings for the log message. See {@link LogMessageOptions}.
246
- */
247
- message: (message?: string, { symbol }?: LogMessageOptions) => void;
248
- /**
249
- * Logs an information message, prefixed with a blue info icon.
250
- * @param {string} message - The message to log.
251
- */
252
- info: (message: string) => void;
253
- /**
254
- * Logs a success message, preceded by a green check symbol.
255
- * @param {string} message - The message to log.
256
- */
257
- success: (message: string) => void;
258
- /**
259
- * Logs a step message, typically used to indicate a step in a process, preceded by a green submit symbol.
260
- * @param {string} message - The message to log.
261
- */
262
- step: (message: string) => void;
263
- /**
264
- * Logs a warning message, preceded by a yellow warning icon.
265
- * @param {string} message - The message to log.
266
- */
267
- warn: (message: string) => void;
268
- /** alias for `log.warn()`. See {@link log.warn}. */
269
- warning: (message: string) => void;
270
- /**
271
- * Logs an error message, preceded by a red error icon.
272
- * @param {string} message - The message to log.
273
- */
274
- error: (message: string) => void;
64
+ message: (message?: string, { symbol }?: LogMessageOptions) => void;
65
+ info: (message: string) => void;
66
+ success: (message: string) => void;
67
+ step: (message: string) => void;
68
+ warn: (message: string) => void;
69
+ warning: (message: string) => void;
70
+ error: (message: string) => void;
275
71
  };
276
- /**
277
- * Displays an animated spinner with a message, with functionality to start and stop the animation.
278
- * @returns an object with `start` and `stop` methods to control the spinner.
279
- */
280
72
  export declare const spinner: () => {
281
73
  start(message?: string): void;
282
74
  stop(message?: string): void;
@@ -285,11 +77,7 @@ export type PromptGroupAwaitedReturn<T> = {
285
77
  [P in keyof T]: Exclude<Awaited<T[P]>, symbol>;
286
78
  };
287
79
  export type PromptGroupOptions<T> = {
288
- /**
289
- * Control how the group can be canceled
290
- * if one of the prompts is canceled.
291
- */
292
- onCancel?: (opts: {
80
+ onCancel?: (opts: {
293
81
  results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
294
82
  }) => void;
295
83
  };
@@ -301,10 +89,4 @@ export type PromptGroup<T> = {
301
89
  results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
302
90
  }) => void | Promise<T[P] | void>;
303
91
  };
304
- /**
305
- * Groups multiple prompts together so that they can be displayed and resolved in sequence.
306
- * @param {PromptGroup<T>} prompts - The prompts to display in the group. See {@link PromptGroup}.
307
- * @param {PromptGroupOptions<T>} [opts] - Optional settings for the prompt group. See {@link PromptGroupOptions}.
308
- * @returns {Promise<Prettify<PromptGroupAwaitedReturn<T>>>} A promise that resolves to an object containing the results of each prompt in the group.
309
- */
310
92
  export declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>) => Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
@@ -568,43 +568,22 @@ export const log = {
568
568
  process.stdout.write(`${parts.join("\n")}
569
569
  `);
570
570
  },
571
- /**
572
- * Logs an information message, prefixed with a blue info icon.
573
- * @param {string} message - The message to log.
574
- */
575
- info: (message) => {
571
+ info: (message) => {
576
572
  log.message(message, { symbol: color.blue(S_INFO) });
577
573
  },
578
- /**
579
- * Logs a success message, preceded by a green check symbol.
580
- * @param {string} message - The message to log.
581
- */
582
- success: (message) => {
574
+ success: (message) => {
583
575
  log.message(message, { symbol: color.green(S_SUCCESS) });
584
576
  },
585
- /**
586
- * Logs a step message, typically used to indicate a step in a process, preceded by a green submit symbol.
587
- * @param {string} message - The message to log.
588
- */
589
- step: (message) => {
577
+ step: (message) => {
590
578
  log.message(message, { symbol: color.green(S_STEP_SUBMIT) });
591
579
  },
592
- /**
593
- * Logs a warning message, preceded by a yellow warning icon.
594
- * @param {string} message - The message to log.
595
- */
596
- warn: (message) => {
580
+ warn: (message) => {
597
581
  log.message(message, { symbol: color.yellow(S_WARN) });
598
582
  },
599
- /** alias for `log.warn()`. See {@link log.warn}. */
600
- warning: (message) => {
583
+ warning: (message) => {
601
584
  log.warn(message);
602
585
  },
603
- /**
604
- * Logs an error message, preceded by a red error icon.
605
- * @param {string} message - The message to log.
606
- */
607
- error: (message) => {
586
+ error: (message) => {
608
587
  log.message(message, { symbol: color.red(S_ERROR) });
609
588
  }
610
589
  };