@reliverse/rempts 1.7.27 → 1.7.29

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 (41) hide show
  1. package/README.md +84 -8
  2. package/bin/components/aliases/aliases-mod.d.ts +11 -0
  3. package/bin/components/aliases/aliases-mod.js +16 -0
  4. package/bin/components/{visual/animate → animate}/animate.d.ts +1 -1
  5. package/bin/components/{visual/animate → animate}/animate.js +2 -2
  6. package/bin/components/anykey/anykey-mod.d.ts +2 -2
  7. package/bin/components/anykey/anykey-mod.js +2 -2
  8. package/bin/components/cancel/cancel.d.ts +45 -0
  9. package/bin/components/cancel/cancel.js +72 -0
  10. package/bin/components/editor/editor-mod.d.ts +4 -4
  11. package/bin/components/{st-end/start.d.ts → intro/intro-start.d.ts} +4 -1
  12. package/bin/components/{st-end/start.js → intro/intro-start.js} +33 -19
  13. package/bin/components/launcher/launcher-types.d.ts +14 -14
  14. package/bin/components/log/log.d.ts +2 -0
  15. package/bin/components/log/log.js +2 -0
  16. package/bin/components/next-steps/next-steps.d.ts +2 -2
  17. package/bin/components/number/number-mod.d.ts +2 -2
  18. package/bin/components/outro/outro-end.d.ts +8 -0
  19. package/bin/components/outro/outro-end.js +55 -0
  20. package/bin/components/results/results.d.ts +2 -2
  21. package/bin/components/select/select-prompt.d.ts +6 -5
  22. package/bin/components/select/select-prompt.js +4 -2
  23. package/bin/components/spinner/spinner-mod.d.ts +106 -0
  24. package/bin/components/spinner/spinner-mod.js +263 -0
  25. package/bin/components/task/progress.d.ts +1 -1
  26. package/bin/components/task/progress.js +1 -1
  27. package/bin/components/task/{spinner.d.ts → task-spin.d.ts} +3 -3
  28. package/bin/components/task/{spinner.js → task-spin.js} +1 -1
  29. package/bin/mod.d.ts +11 -8
  30. package/bin/mod.js +31 -8
  31. package/bin/types.d.ts +36 -36
  32. package/bin/utils/validate.d.ts +2 -2
  33. package/package.json +2 -2
  34. package/bin/components/st-end/end.d.ts +0 -2
  35. package/bin/components/st-end/end.js +0 -42
  36. package/bin/hooks/spinner/spinner-mod.d.ts +0 -64
  37. package/bin/hooks/spinner/spinner-mod.js +0 -74
  38. /package/bin/components/{visual/ascii-art → ascii-art}/ascii-art.d.ts +0 -0
  39. /package/bin/components/{visual/ascii-art → ascii-art}/ascii-art.js +0 -0
  40. /package/bin/components/{input → confirm}/confirm-prompt.d.ts +0 -0
  41. /package/bin/components/{input → confirm}/confirm-prompt.js +0 -0
package/bin/types.d.ts CHANGED
@@ -4,15 +4,15 @@ export type BorderColorName = "reset" | "inverse" | "dim" | "black" | "red" | "r
4
4
  export type ColorName = BorderColorName | "gradientGradient" | "rainbowGradient" | "cristalGradient" | "mindGradient" | "passionGradient" | "viceGradient" | "retroGradient" | "none";
5
5
  type AnimationName = "rainbow" | "pulse" | "glitch" | "radar" | "neon" | "karaoke";
6
6
  export type VariantName = "doubleBox" | "none";
7
- export type MsgConfig = {
7
+ export interface MsgConfig {
8
8
  symbol: string;
9
9
  prefix?: string;
10
10
  color?: (text: string) => string;
11
11
  newLineBefore?: boolean;
12
12
  newLineAfter?: boolean;
13
13
  suffix?: string;
14
- };
15
- export type PromptOptions = {
14
+ }
15
+ export interface PromptOptions {
16
16
  schema?: any;
17
17
  title?: string;
18
18
  titleColor?: ColorName;
@@ -49,23 +49,23 @@ export type PromptOptions = {
49
49
  horizontalLineLength?: number;
50
50
  symbol?: string;
51
51
  customSymbol?: string;
52
- };
53
- type ChoiceRequiredOptions = {
52
+ }
53
+ interface ChoiceRequiredOptions {
54
54
  id: string;
55
55
  title: string;
56
- };
57
- type ChoiceOptionalOptions = {
56
+ }
57
+ interface ChoiceOptionalOptions {
58
58
  description?: string;
59
59
  titleTypography?: TypographyName;
60
60
  action?: () => Promise<void>;
61
- };
61
+ }
62
62
  export type ChoiceOptions = ChoiceRequiredOptions & ChoiceOptionalOptions;
63
- export type SelectOption<T> = {
63
+ export interface SelectOption<T> {
64
64
  value: T;
65
65
  label: string;
66
66
  hint?: string;
67
67
  disabled?: boolean;
68
- };
68
+ }
69
69
  /**
70
70
  * Standard terminal colors supported by most terminals
71
71
  */
@@ -74,28 +74,28 @@ export type StandardColor = "black" | "red" | "green" | "yellow" | "blue" | "mag
74
74
  * All possible output colors including special colors
75
75
  */
76
76
  export type OutputColor = StandardColor | "dim";
77
- export type EditorExitResult = {
77
+ export interface EditorExitResult {
78
78
  saved: boolean;
79
79
  content: string | null;
80
80
  filename: string | null;
81
- };
81
+ }
82
82
  export type MessageKind = "log" | "info" | "warn" | "error" | "success";
83
83
  type VerboseKind = `${MessageKind}-verbose`;
84
84
  export type AllKinds = MessageKind | VerboseKind;
85
- export type MessageConfig = {
85
+ export interface MessageConfig {
86
86
  type: "M_INFO" | "M_ERROR";
87
87
  titleColor?: "retroGradient" | "viceGradient" | "yellowBright";
88
88
  titleTypography?: "bold";
89
89
  contentColor?: "dim";
90
90
  contentTypography?: "italic";
91
- };
92
- export type StreamOptions = {
91
+ }
92
+ export interface StreamOptions {
93
93
  delay?: number;
94
94
  useSpinner?: boolean;
95
95
  spinnerFrames?: string[];
96
96
  spinnerDelay?: number;
97
- };
98
- export type ProgressBarOptions = {
97
+ }
98
+ export interface ProgressBarOptions {
99
99
  total: number;
100
100
  width?: number;
101
101
  completeChar?: string;
@@ -104,17 +104,17 @@ export type ProgressBarOptions = {
104
104
  colorize?: boolean;
105
105
  increment?: number;
106
106
  desiredTotalTime?: number;
107
- };
108
- export type ProgressBar = {
107
+ }
108
+ export interface ProgressBar {
109
109
  update: (value: number) => Promise<void>;
110
110
  increment: (amount?: number) => Promise<void>;
111
111
  render: () => Promise<void>;
112
- };
112
+ }
113
113
  /**
114
114
  * Union type for available prompt types.
115
115
  */
116
116
  export type PromptType = "input" | "inputmasked" | "select" | "multiselect" | "nummultiselect" | "numselect" | "toggle" | "confirm" | "spinner" | "progressbar" | "results" | "nextsteps" | "animatedtext" | "date" | "end";
117
- export type ConfirmPromptOptions = {
117
+ export interface ConfirmPromptOptions {
118
118
  title: string;
119
119
  defaultValue?: boolean;
120
120
  content?: string;
@@ -134,8 +134,8 @@ export type ConfirmPromptOptions = {
134
134
  endTitleColor?: ColorName;
135
135
  border?: boolean;
136
136
  terminalWidth?: number;
137
- };
138
- export type StreamTextOptions = {
137
+ }
138
+ export interface StreamTextOptions {
139
139
  /**
140
140
  * Text to stream
141
141
  */
@@ -169,14 +169,14 @@ export type StreamTextOptions = {
169
169
  * Callback function to update the spinner text
170
170
  */
171
171
  onProgress?: (currentText: string) => void;
172
- };
173
- export type PreventWrongTerminalSizeOptions = {
172
+ }
173
+ export interface PreventWrongTerminalSizeOptions {
174
174
  isDev?: boolean;
175
175
  shouldExit?: boolean;
176
176
  minWidth?: number;
177
177
  minHeight?: number;
178
178
  sizeErrorDescription?: string;
179
- };
179
+ }
180
180
  /**
181
181
  * InputPromptOptions
182
182
  *
@@ -216,7 +216,7 @@ export type InputPromptOptions = {
216
216
  validate?: (value: string) => string | boolean | undefined | Promise<string | boolean | undefined>;
217
217
  variantOptions?: unknown;
218
218
  } & PromptOptions;
219
- export type RenderParams = {
219
+ export interface RenderParams {
220
220
  border: boolean;
221
221
  borderColor?: BorderColorName;
222
222
  content?: string;
@@ -237,13 +237,13 @@ export type RenderParams = {
237
237
  titleVariant?: VariantName;
238
238
  userInput: string;
239
239
  isRerender?: boolean;
240
- };
240
+ }
241
241
  /**
242
242
  * Known symbol names that will have IntelliSense support
243
243
  */
244
244
  export type SymbolName = "pointer" | "start" | "middle" | "end" | "line" | "corner_top_right" | "step_active" | "step_error" | "log" | "success" | "info" | "warn" | "error";
245
245
  export type Symbols = Record<SymbolName, string>;
246
- export type FmtMsgOptions = {
246
+ export interface FmtMsgOptions {
247
247
  type: MsgType;
248
248
  title?: string;
249
249
  titleAfterAnim?: string;
@@ -279,8 +279,8 @@ export type FmtMsgOptions = {
279
279
  customSymbol?: string;
280
280
  symbolColor?: ColorName;
281
281
  noNewLine?: boolean;
282
- };
283
- export type TogglePromptParams<T extends string> = {
282
+ }
283
+ export interface TogglePromptParams<T extends string> {
284
284
  title: string;
285
285
  content?: string;
286
286
  options?: [T, T];
@@ -296,13 +296,13 @@ export type TogglePromptParams<T extends string> = {
296
296
  endTitleColor?: ColorName;
297
297
  displayInstructions?: boolean;
298
298
  debug?: boolean;
299
- };
300
- export type SeparatorOption = {
299
+ }
300
+ export interface SeparatorOption {
301
301
  separator: true;
302
302
  width?: number;
303
303
  symbol?: SymbolName;
304
- };
305
- export type MultiselectPromptParams<T extends string> = {
304
+ }
305
+ export interface MultiselectPromptParams<T extends string> {
306
306
  title: string;
307
307
  content?: string;
308
308
  options: (SelectOption<T> | SeparatorOption)[];
@@ -322,7 +322,7 @@ export type MultiselectPromptParams<T extends string> = {
322
322
  minSelect?: number;
323
323
  maxSelect?: number;
324
324
  selectAll?: boolean;
325
- };
325
+ }
326
326
  export type DatePromptOptions = PromptOptions & {
327
327
  dateFormat: string;
328
328
  dateKind: "birthday" | "other";
@@ -7,10 +7,10 @@ export declare function isTerminalInteractive(input?: NodeJS.ReadStream & {
7
7
  /**
8
8
  * Validates a name against allowed characters
9
9
  */
10
- type ValidationResult = {
10
+ interface ValidationResult {
11
11
  isValid: boolean;
12
12
  message?: string;
13
- };
13
+ }
14
14
  export declare function isValidName(name: string): ValidationResult;
15
15
  /**
16
16
  * Cleans up project name from config by removing scope and invalid characters.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "@figliolia/chalk-animation": "^1.0.4",
4
- "@reliverse/pathkit": "^1.3.3",
4
+ "@reliverse/pathkit": "^1.3.4",
5
5
  "@reliverse/reliarg": "^1.0.3",
6
6
  "@reliverse/relico": "^1.1.2",
7
7
  "@reliverse/relifso": "^1.4.5",
@@ -29,7 +29,7 @@
29
29
  "license": "MIT",
30
30
  "name": "@reliverse/rempts",
31
31
  "type": "module",
32
- "version": "1.7.27",
32
+ "version": "1.7.29",
33
33
  "author": "reliverse",
34
34
  "bugs": {
35
35
  "email": "blefnk@gmail.com",
@@ -1,2 +0,0 @@
1
- import type { PromptOptions } from "../../types.js";
2
- export declare function endPrompt({ title, titleColor, titleTypography, titleVariant, titleAnimation, titleAnimationDelay, border, borderColor, horizontalLineLength, }: PromptOptions): Promise<void>;
@@ -1,42 +0,0 @@
1
- import { msg } from "../msg-fmt/messages.js";
2
- import { getExactTerminalWidth } from "../msg-fmt/terminal.js";
3
- import { animateText } from "../visual/animate/animate.js";
4
- export async function endPrompt({
5
- title = "",
6
- titleColor = "cyan",
7
- titleTypography = "none",
8
- titleVariant,
9
- titleAnimation,
10
- titleAnimationDelay,
11
- border = true,
12
- borderColor = "dim",
13
- horizontalLineLength = 0
14
- }) {
15
- if (horizontalLineLength === 0) {
16
- horizontalLineLength = getExactTerminalWidth() - 3;
17
- }
18
- if (titleAnimation) {
19
- await animateText({
20
- title: title ? title : " ",
21
- anim: titleAnimation,
22
- delay: titleAnimationDelay,
23
- type: "M_END",
24
- titleColor,
25
- titleTypography,
26
- border,
27
- borderColor,
28
- horizontalLineLength
29
- });
30
- } else {
31
- msg({
32
- type: "M_END",
33
- title: title ? title : " ",
34
- titleColor,
35
- titleTypography,
36
- titleVariant,
37
- border,
38
- borderColor,
39
- horizontalLineLength
40
- });
41
- }
42
- }
@@ -1,64 +0,0 @@
1
- import { type Color, type Options as OraOptions } from "ora";
2
- type SpinnerOptions = {
3
- text: string;
4
- color?: Color;
5
- spinner?: OraOptions["spinner"];
6
- successText?: string;
7
- failText?: string;
8
- };
9
- type SpinnerControls = {
10
- start: (text?: string) => SpinnerControls;
11
- stop: () => void;
12
- setText: (text: string) => void;
13
- succeed: (text?: string) => void;
14
- fail: (text?: string) => void;
15
- warn: (text?: string) => void;
16
- info: (text?: string) => void;
17
- isSpinning: () => boolean;
18
- clear: () => void;
19
- };
20
- /**
21
- * Creates a terminal spinner with enhanced controls and styling options.
22
- *
23
- * @example
24
- * ```typescript
25
- * // Basic usage
26
- * const spinner = useSpinner({ text: "Loading..." }).start();
27
- * spinner.stop();
28
- *
29
- * // With custom color and spinner
30
- * const spinner = useSpinner({
31
- * text: "Processing...",
32
- * color: "cyan",
33
- * spinner: "dots"
34
- * }).start();
35
- *
36
- * // With success/failure states
37
- * const spinner = useSpinner({
38
- * text: "Uploading...",
39
- * successText: "Upload complete!",
40
- * failText: "Upload failed!"
41
- * }).start();
42
- * try {
43
- * await uploadFile();
44
- * spinner.succeed();
45
- * } catch (error) {
46
- * spinner.fail();
47
- * }
48
- *
49
- * // Using the wrapper for async operations
50
- * await useSpinner.promise(
51
- * async () => { await longOperation(); },
52
- * {
53
- * text: "Working...",
54
- * successText: "Done!",
55
- * failText: "Failed!"
56
- * }
57
- * );
58
- * ```
59
- */
60
- export declare function useSpinner(options: SpinnerOptions): SpinnerControls;
61
- export declare namespace useSpinner {
62
- var promise: <T>(operation: () => Promise<T>, options: SpinnerOptions) => Promise<T>;
63
- }
64
- export {};
@@ -1,74 +0,0 @@
1
- import ora from "ora";
2
- export function useSpinner(options) {
3
- let spinnerInstance = null;
4
- const controls = {
5
- start: (text) => {
6
- if (text) {
7
- options.text = text;
8
- }
9
- if (!spinnerInstance) {
10
- spinnerInstance = ora({
11
- text: options.text,
12
- color: options.color,
13
- spinner: options.spinner
14
- });
15
- } else {
16
- spinnerInstance.text = options.text;
17
- }
18
- spinnerInstance.start();
19
- return controls;
20
- },
21
- stop: () => {
22
- if (spinnerInstance) {
23
- spinnerInstance.stop();
24
- }
25
- },
26
- setText: (text) => {
27
- if (spinnerInstance) {
28
- spinnerInstance.text = text;
29
- } else {
30
- options.text = text;
31
- }
32
- },
33
- succeed: (text) => {
34
- if (spinnerInstance) {
35
- spinnerInstance.succeed(text ?? options.successText);
36
- }
37
- },
38
- fail: (text) => {
39
- if (spinnerInstance) {
40
- spinnerInstance.fail(text ?? options.failText);
41
- }
42
- },
43
- warn: (text) => {
44
- if (spinnerInstance) {
45
- spinnerInstance.warn(text);
46
- }
47
- },
48
- info: (text) => {
49
- if (spinnerInstance) {
50
- spinnerInstance.info(text);
51
- }
52
- },
53
- isSpinning: () => {
54
- return spinnerInstance?.isSpinning ?? false;
55
- },
56
- clear: () => {
57
- if (spinnerInstance) {
58
- spinnerInstance.clear();
59
- }
60
- }
61
- };
62
- return controls;
63
- }
64
- useSpinner.promise = async (operation, options) => {
65
- const spinner = useSpinner(options).start();
66
- try {
67
- const result = await operation();
68
- spinner.succeed();
69
- return result;
70
- } catch (error) {
71
- spinner.fail();
72
- throw error;
73
- }
74
- };