@reliverse/rempts 1.7.58 → 1.7.60
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/bin/libs/animate/{animate-mod.js → animate-mod.ts.txt} +33 -15
- package/bin/libs/figures/figures-mod.d.ts +2 -2
- package/bin/libs/intro/intro-mod.d.ts +1 -2
- package/bin/libs/intro/intro-mod.js +2 -8
- package/bin/libs/outro/outro-mod.d.ts +1 -2
- package/bin/libs/outro/outro-mod.js +4 -10
- package/bin/libs/spinner/spinner-impl.d.ts +70 -0
- package/bin/libs/spinner/spinner-impl.js +336 -0
- package/bin/libs/spinner/spinner-mod.d.ts +4 -92
- package/bin/libs/spinner/spinner-mod.js +12 -15
- package/bin/libs/utils/stream-text.js +2 -2
- package/bin/libs/visual/{visual-mod.js → visual-mod.ts.txt} +9 -3
- package/bin/mod.d.ts +3 -3
- package/bin/mod.js +2 -3
- package/package.json +7 -4
- package/bin/libs/animate/animate-mod.d.ts +0 -14
- package/bin/libs/visual/visual-mod.d.ts +0 -6
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { ChalkAnimation } from "@figliolia/chalk-animation";
|
|
1
|
+
import { type Animation, type AnimationName, ChalkAnimation } from "@figliolia/chalk-animation";
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import type { BorderColorName, ColorName, MsgType, TypographyName } from "../../types";
|
|
4
|
+
import { msg } from "../msg-fmt/messages";
|
|
5
|
+
import { deleteLastLine, getTerminalWidth } from "../msg-fmt/terminal";
|
|
6
|
+
|
|
7
|
+
export const animationMap: Record<AnimationName, (text: string) => Animation> = {
|
|
6
8
|
rainbow: ChalkAnimation.rainbow,
|
|
7
9
|
pulse: ChalkAnimation.pulse,
|
|
8
10
|
glitch: ChalkAnimation.glitch,
|
|
9
11
|
radar: ChalkAnimation.radar,
|
|
10
12
|
neon: ChalkAnimation.neon,
|
|
11
|
-
karaoke: ChalkAnimation.karaoke
|
|
13
|
+
karaoke: ChalkAnimation.karaoke,
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
function calculateDelay(text: string): number {
|
|
17
|
+
const baseDelay = 1000;
|
|
15
18
|
const delayPerCharacter = 50;
|
|
16
19
|
return baseDelay + text.length * delayPerCharacter;
|
|
17
20
|
}
|
|
21
|
+
|
|
18
22
|
export async function animateText({
|
|
19
23
|
title = "",
|
|
20
24
|
anim,
|
|
@@ -24,32 +28,46 @@ export async function animateText({
|
|
|
24
28
|
titleTypography = "none",
|
|
25
29
|
border = true,
|
|
26
30
|
borderColor = "dim",
|
|
27
|
-
horizontalLineLength = 0
|
|
31
|
+
horizontalLineLength = 0,
|
|
32
|
+
}: {
|
|
33
|
+
title: string;
|
|
34
|
+
anim: AnimationName;
|
|
35
|
+
delay?: number;
|
|
36
|
+
type?: MsgType;
|
|
37
|
+
titleColor?: ColorName;
|
|
38
|
+
titleTypography?: TypographyName;
|
|
39
|
+
borderColor?: BorderColorName;
|
|
40
|
+
border?: boolean;
|
|
41
|
+
horizontalLineLength?: number;
|
|
28
42
|
}) {
|
|
29
43
|
if (horizontalLineLength === 0) {
|
|
30
44
|
horizontalLineLength = getTerminalWidth() - 5;
|
|
31
45
|
}
|
|
46
|
+
|
|
32
47
|
const finalDelay = delay ?? calculateDelay(title);
|
|
33
48
|
const animation = animationMap[anim](title);
|
|
49
|
+
|
|
34
50
|
try {
|
|
35
|
-
await new Promise((resolve) => {
|
|
51
|
+
await new Promise<void>((resolve) => {
|
|
36
52
|
setTimeout(() => {
|
|
37
53
|
animation.stop();
|
|
38
54
|
deleteLastLine();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
|
|
56
|
+
if (title.includes("│ ")) {
|
|
57
|
+
title = title.replace("│ ", "");
|
|
58
|
+
} else if (title.includes("ℹ ")) {
|
|
59
|
+
title = title.replace("ℹ ", "");
|
|
43
60
|
}
|
|
61
|
+
|
|
44
62
|
msg({
|
|
45
63
|
type,
|
|
46
|
-
title,
|
|
64
|
+
title: title,
|
|
47
65
|
titleColor,
|
|
48
66
|
titleTypography,
|
|
49
67
|
content: "",
|
|
50
68
|
borderColor,
|
|
51
69
|
border,
|
|
52
|
-
horizontalLineLength
|
|
70
|
+
horizontalLineLength,
|
|
53
71
|
});
|
|
54
72
|
resolve();
|
|
55
73
|
}, finalDelay);
|
|
@@ -229,7 +229,7 @@ export declare const mainSymbols: {
|
|
|
229
229
|
lineSlash: string;
|
|
230
230
|
};
|
|
231
231
|
export declare const fallbackSymbols: Record<string, string>;
|
|
232
|
-
export declare const figures:
|
|
232
|
+
export declare const figures: {
|
|
233
233
|
tick: string;
|
|
234
234
|
info: string;
|
|
235
235
|
warning: string;
|
|
@@ -458,4 +458,4 @@ export declare const figures: Record<string, string> | {
|
|
|
458
458
|
lineCross: string;
|
|
459
459
|
lineBackslash: string;
|
|
460
460
|
lineSlash: string;
|
|
461
|
-
}
|
|
461
|
+
} | Record<string, string>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Fonts } from "figlet";
|
|
2
1
|
import type { PreventWrongTerminalSizeOptions, PromptOptions } from "../../types";
|
|
3
2
|
type StartPromptOptions = PromptOptions & {
|
|
4
3
|
clearConsole?: boolean;
|
|
@@ -14,7 +13,7 @@ type StartPromptOptions = PromptOptions & {
|
|
|
14
13
|
windowsHomeDirRoot?: boolean;
|
|
15
14
|
};
|
|
16
15
|
variant?: "header" | "ascii-art";
|
|
17
|
-
asciiArtFont?:
|
|
16
|
+
asciiArtFont?: any;
|
|
18
17
|
};
|
|
19
18
|
export declare function introPrompt(optionsOrTitle: StartPromptOptions | string): Promise<void>;
|
|
20
19
|
export {};
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
preventWrongTerminalSize
|
|
9
9
|
} from "../utils/prevent.js";
|
|
10
10
|
import { pm, reliversePrompts } from "../utils/system.js";
|
|
11
|
-
import { createAsciiArt } from "../visual/visual-mod.js";
|
|
12
11
|
export async function introPrompt(optionsOrTitle) {
|
|
13
12
|
const options = typeof optionsOrTitle === "string" ? { title: optionsOrTitle } : optionsOrTitle;
|
|
14
13
|
const {
|
|
@@ -29,8 +28,8 @@ export async function introPrompt(optionsOrTitle) {
|
|
|
29
28
|
wrongTerminalSize: true,
|
|
30
29
|
windowsHomeDirRoot: true
|
|
31
30
|
},
|
|
32
|
-
variant = "header"
|
|
33
|
-
asciiArtFont
|
|
31
|
+
variant = "header"
|
|
32
|
+
// asciiArtFont,
|
|
34
33
|
} = options;
|
|
35
34
|
let horizontalLineLength = initialHorizontalLineLength;
|
|
36
35
|
if (prevent.windowsHomeDirRoot) {
|
|
@@ -47,11 +46,6 @@ export async function introPrompt(optionsOrTitle) {
|
|
|
47
46
|
const terminalHeight = getTerminalHeight();
|
|
48
47
|
const formattedTitle = title !== "" ? title : `${packageName} v${packageVersion} | ${pm.packageManager} v${pm.version} | ${getCurrentTerminalName()}${isDev && terminalWidth > 80 ? ` | isDev | w${terminalWidth} h${terminalHeight}` : ""}`;
|
|
49
48
|
if (variant === "ascii-art") {
|
|
50
|
-
await createAsciiArt({
|
|
51
|
-
message: formattedTitle,
|
|
52
|
-
...asciiArtFont !== void 0 && { font: asciiArtFont },
|
|
53
|
-
clearConsole
|
|
54
|
-
});
|
|
55
49
|
return;
|
|
56
50
|
}
|
|
57
51
|
if (horizontalLineLength === 0) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Fonts } from "figlet";
|
|
2
1
|
import type { PromptOptions } from "../../types";
|
|
3
2
|
type EndPromptOptions = PromptOptions & {
|
|
4
3
|
variant?: "footer" | "ascii-art";
|
|
5
|
-
asciiArtFont?:
|
|
4
|
+
asciiArtFont?: any;
|
|
6
5
|
};
|
|
7
6
|
export declare function outroPrompt(optionsOrTitle: EndPromptOptions | string): Promise<void>;
|
|
8
7
|
export {};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { animateText } from "../animate/animate-mod.js";
|
|
2
1
|
import { msg } from "../msg-fmt/messages.js";
|
|
3
2
|
import { getExactTerminalWidth } from "../msg-fmt/terminal.js";
|
|
4
|
-
import { createAsciiArt } from "../visual/visual-mod.js";
|
|
5
3
|
export async function outroPrompt(optionsOrTitle) {
|
|
6
4
|
const options = typeof optionsOrTitle === "string" ? { title: optionsOrTitle } : optionsOrTitle;
|
|
7
5
|
const {
|
|
@@ -14,24 +12,20 @@ export async function outroPrompt(optionsOrTitle) {
|
|
|
14
12
|
border = true,
|
|
15
13
|
borderColor = "dim",
|
|
16
14
|
horizontalLineLength: initialHorizontalLineLength = 0,
|
|
17
|
-
variant = "footer"
|
|
18
|
-
asciiArtFont
|
|
15
|
+
variant = "footer"
|
|
16
|
+
// asciiArtFont,
|
|
19
17
|
} = options;
|
|
20
18
|
let horizontalLineLength = initialHorizontalLineLength;
|
|
21
19
|
if (variant === "ascii-art") {
|
|
22
|
-
await createAsciiArt({
|
|
23
|
-
message: title || " ",
|
|
24
|
-
...asciiArtFont !== void 0 && { font: asciiArtFont }
|
|
25
|
-
});
|
|
26
20
|
return;
|
|
27
21
|
}
|
|
28
22
|
if (horizontalLineLength === 0) {
|
|
29
23
|
horizontalLineLength = getExactTerminalWidth() - 3;
|
|
30
24
|
}
|
|
31
25
|
if (titleAnimation) {
|
|
32
|
-
await
|
|
26
|
+
await msg({
|
|
33
27
|
title: title ? title : " ",
|
|
34
|
-
anim: titleAnimation,
|
|
28
|
+
// anim: titleAnimation,
|
|
35
29
|
...titleAnimationDelay !== void 0 && { delay: titleAnimationDelay },
|
|
36
30
|
type: "M_END",
|
|
37
31
|
titleColor,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { WriteStream } from "node:tty";
|
|
2
|
+
import { type ColorName } from "@reliverse/relico";
|
|
3
|
+
import { type Spinner } from "cli-spinners";
|
|
4
|
+
export declare const info: string;
|
|
5
|
+
export declare const success: string;
|
|
6
|
+
export declare const warning: string;
|
|
7
|
+
export declare const error: string;
|
|
8
|
+
export interface OraOptions {
|
|
9
|
+
text?: string | undefined;
|
|
10
|
+
spinner?: string | Spinner;
|
|
11
|
+
color?: ColorName;
|
|
12
|
+
stream?: WriteStream;
|
|
13
|
+
discardStdin?: boolean;
|
|
14
|
+
hideCursor?: boolean;
|
|
15
|
+
interval?: number;
|
|
16
|
+
isEnabled?: boolean;
|
|
17
|
+
isSilent?: boolean;
|
|
18
|
+
prefixText?: string | (() => string) | undefined;
|
|
19
|
+
suffixText?: string | (() => string) | undefined;
|
|
20
|
+
indent?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface StopAndPersistOptions {
|
|
23
|
+
symbol?: string;
|
|
24
|
+
text?: string | undefined;
|
|
25
|
+
prefixText?: string | (() => string) | undefined;
|
|
26
|
+
suffixText?: string | (() => string) | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface OraPromiseOptions<T = any> extends OraOptions {
|
|
29
|
+
successText?: string | ((result: T) => string);
|
|
30
|
+
failText?: string | ((error: any) => string);
|
|
31
|
+
}
|
|
32
|
+
export declare class Ora {
|
|
33
|
+
#private;
|
|
34
|
+
color: ColorName;
|
|
35
|
+
lastIndent?: number;
|
|
36
|
+
_stream?: WriteStream;
|
|
37
|
+
_isEnabled?: boolean;
|
|
38
|
+
constructor(options?: string | OraOptions);
|
|
39
|
+
get indent(): number | undefined;
|
|
40
|
+
set indent(indent: number | undefined);
|
|
41
|
+
get interval(): number;
|
|
42
|
+
get spinner(): string | Spinner | undefined;
|
|
43
|
+
set spinner(spinner: string | Spinner | undefined);
|
|
44
|
+
get text(): string | undefined;
|
|
45
|
+
set text(value: string | undefined);
|
|
46
|
+
get prefixText(): string | (() => string) | undefined;
|
|
47
|
+
set prefixText(value: string | (() => string) | undefined);
|
|
48
|
+
get suffixText(): string | (() => string) | undefined;
|
|
49
|
+
set suffixText(value: string | (() => string) | undefined);
|
|
50
|
+
get isSpinning(): boolean;
|
|
51
|
+
get isEnabled(): boolean;
|
|
52
|
+
set isEnabled(value: boolean);
|
|
53
|
+
get isSilent(): boolean;
|
|
54
|
+
set isSilent(value: boolean);
|
|
55
|
+
frame(): string;
|
|
56
|
+
clear(): this;
|
|
57
|
+
render(): this;
|
|
58
|
+
start(text?: string): this;
|
|
59
|
+
stop(): this;
|
|
60
|
+
succeed(text?: string): this;
|
|
61
|
+
fail(text?: string): this;
|
|
62
|
+
warn(text?: string): this;
|
|
63
|
+
info(text?: string): this;
|
|
64
|
+
stopAndPersist(options?: StopAndPersistOptions): this;
|
|
65
|
+
}
|
|
66
|
+
export default function ora(options?: string | OraOptions): Ora;
|
|
67
|
+
export declare function oraPromise<T>(action: ((spinner: Ora) => Promise<T>) | Promise<T>, options?: string | (OraPromiseOptions<T> & {
|
|
68
|
+
text?: string | undefined;
|
|
69
|
+
})): Promise<T>;
|
|
70
|
+
export { default as spinners } from "cli-spinners";
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { re } from "@reliverse/relico";
|
|
3
|
+
import cliCursor from "cli-cursor";
|
|
4
|
+
import cliSpinners from "cli-spinners";
|
|
5
|
+
import isInteractive from "is-interactive";
|
|
6
|
+
import isUnicodeSupported from "is-unicode-supported";
|
|
7
|
+
import stdinDiscarder from "stdin-discarder";
|
|
8
|
+
import stringWidth from "string-width";
|
|
9
|
+
import stripAnsi from "strip-ansi";
|
|
10
|
+
const _isUnicodeSupported = isUnicodeSupported();
|
|
11
|
+
export const info = re.blue(_isUnicodeSupported ? "\u2139" : "i");
|
|
12
|
+
export const success = re.green(_isUnicodeSupported ? "\u2714" : "\u221A");
|
|
13
|
+
export const warning = re.yellow(_isUnicodeSupported ? "\u26A0" : "\u203C");
|
|
14
|
+
export const error = re.red(_isUnicodeSupported ? "\u2716" : "\xD7");
|
|
15
|
+
export class Ora {
|
|
16
|
+
#linesToClear = 0;
|
|
17
|
+
#isDiscardingStdin = false;
|
|
18
|
+
#lineCount = 0;
|
|
19
|
+
#frameIndex = -1;
|
|
20
|
+
#lastSpinnerFrameTime = 0;
|
|
21
|
+
#options;
|
|
22
|
+
#spinner;
|
|
23
|
+
#stream;
|
|
24
|
+
#id;
|
|
25
|
+
#initialInterval;
|
|
26
|
+
#isEnabled;
|
|
27
|
+
#isSilent;
|
|
28
|
+
#indent;
|
|
29
|
+
#text;
|
|
30
|
+
#prefixText;
|
|
31
|
+
#suffixText;
|
|
32
|
+
color;
|
|
33
|
+
lastIndent;
|
|
34
|
+
_stream;
|
|
35
|
+
_isEnabled;
|
|
36
|
+
constructor(options) {
|
|
37
|
+
if (typeof options === "string") {
|
|
38
|
+
options = {
|
|
39
|
+
text: options
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
this.#options = {
|
|
43
|
+
color: "cyan",
|
|
44
|
+
stream: process.stderr,
|
|
45
|
+
discardStdin: true,
|
|
46
|
+
hideCursor: true,
|
|
47
|
+
...options
|
|
48
|
+
};
|
|
49
|
+
this.color = this.#options.color ?? "cyan";
|
|
50
|
+
this.spinner = this.#options.spinner;
|
|
51
|
+
this.#initialInterval = this.#options.interval;
|
|
52
|
+
this.#stream = this.#options.stream ?? process.stderr;
|
|
53
|
+
this.#isEnabled = typeof this.#options.isEnabled === "boolean" ? this.#options.isEnabled : isInteractive({ stream: this.#stream });
|
|
54
|
+
this.#isSilent = typeof this.#options.isSilent === "boolean" ? this.#options.isSilent : false;
|
|
55
|
+
this.text = this.#options.text ?? "";
|
|
56
|
+
this.prefixText = this.#options.prefixText ?? "";
|
|
57
|
+
this.suffixText = this.#options.suffixText ?? "";
|
|
58
|
+
this.indent = this.#options.indent ?? 0;
|
|
59
|
+
if (process.env.NODE_ENV === "test") {
|
|
60
|
+
this._stream = this.#stream;
|
|
61
|
+
this._isEnabled = this.#isEnabled;
|
|
62
|
+
Object.defineProperty(this, "_linesToClear", {
|
|
63
|
+
get() {
|
|
64
|
+
return this.#linesToClear;
|
|
65
|
+
},
|
|
66
|
+
set(newValue) {
|
|
67
|
+
this.#linesToClear = newValue;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(this, "_frameIndex", {
|
|
71
|
+
get() {
|
|
72
|
+
return this.#frameIndex;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(this, "_lineCount", {
|
|
76
|
+
get() {
|
|
77
|
+
return this.#lineCount;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
get indent() {
|
|
83
|
+
return this.#indent;
|
|
84
|
+
}
|
|
85
|
+
set indent(indent) {
|
|
86
|
+
const indentValue = indent ?? 0;
|
|
87
|
+
if (!(indentValue >= 0 && Number.isInteger(indentValue))) {
|
|
88
|
+
throw new Error("The `indent` option must be an integer from 0 and up");
|
|
89
|
+
}
|
|
90
|
+
this.#indent = indentValue;
|
|
91
|
+
this.#updateLineCount();
|
|
92
|
+
}
|
|
93
|
+
get interval() {
|
|
94
|
+
return this.#initialInterval ?? this.#spinner.interval ?? 100;
|
|
95
|
+
}
|
|
96
|
+
get spinner() {
|
|
97
|
+
return this.#spinner;
|
|
98
|
+
}
|
|
99
|
+
set spinner(spinner) {
|
|
100
|
+
this.#frameIndex = -1;
|
|
101
|
+
this.#initialInterval = void 0;
|
|
102
|
+
if (typeof spinner === "object") {
|
|
103
|
+
if (spinner.frames === void 0) {
|
|
104
|
+
throw new Error("The given spinner must have a `frames` property");
|
|
105
|
+
}
|
|
106
|
+
this.#spinner = spinner;
|
|
107
|
+
} else if (!isUnicodeSupported()) {
|
|
108
|
+
this.#spinner = cliSpinners.line;
|
|
109
|
+
} else if (spinner === void 0) {
|
|
110
|
+
this.#spinner = cliSpinners.dots;
|
|
111
|
+
} else if (spinner !== "default" && typeof spinner === "string" && spinner in cliSpinners) {
|
|
112
|
+
this.#spinner = cliSpinners[spinner];
|
|
113
|
+
} else {
|
|
114
|
+
throw new Error(
|
|
115
|
+
`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
get text() {
|
|
120
|
+
return this.#text;
|
|
121
|
+
}
|
|
122
|
+
set text(value) {
|
|
123
|
+
this.#text = value ?? "";
|
|
124
|
+
this.#updateLineCount();
|
|
125
|
+
}
|
|
126
|
+
get prefixText() {
|
|
127
|
+
return this.#prefixText;
|
|
128
|
+
}
|
|
129
|
+
set prefixText(value) {
|
|
130
|
+
this.#prefixText = value;
|
|
131
|
+
this.#updateLineCount();
|
|
132
|
+
}
|
|
133
|
+
get suffixText() {
|
|
134
|
+
return this.#suffixText;
|
|
135
|
+
}
|
|
136
|
+
set suffixText(value) {
|
|
137
|
+
this.#suffixText = value;
|
|
138
|
+
this.#updateLineCount();
|
|
139
|
+
}
|
|
140
|
+
get isSpinning() {
|
|
141
|
+
return this.#id !== void 0;
|
|
142
|
+
}
|
|
143
|
+
#getFullPrefixText(prefixText = this.#prefixText, postfix = " ") {
|
|
144
|
+
if (typeof prefixText === "string" && prefixText !== "") {
|
|
145
|
+
return prefixText + postfix;
|
|
146
|
+
}
|
|
147
|
+
if (typeof prefixText === "function") {
|
|
148
|
+
return prefixText() + postfix;
|
|
149
|
+
}
|
|
150
|
+
return "";
|
|
151
|
+
}
|
|
152
|
+
#getFullSuffixText(suffixText = this.#suffixText, prefix = " ") {
|
|
153
|
+
if (typeof suffixText === "string" && suffixText !== "") {
|
|
154
|
+
return prefix + suffixText;
|
|
155
|
+
}
|
|
156
|
+
if (typeof suffixText === "function") {
|
|
157
|
+
return prefix + suffixText();
|
|
158
|
+
}
|
|
159
|
+
return "";
|
|
160
|
+
}
|
|
161
|
+
#updateLineCount() {
|
|
162
|
+
const columns = this.#stream.columns ?? 80;
|
|
163
|
+
const fullPrefixText = this.#getFullPrefixText(this.#prefixText, "-");
|
|
164
|
+
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
165
|
+
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
166
|
+
this.#lineCount = 0;
|
|
167
|
+
for (const line of stripAnsi(fullText).split("\n")) {
|
|
168
|
+
this.#lineCount += Math.max(
|
|
169
|
+
1,
|
|
170
|
+
Math.ceil(stringWidth(line, { countAnsiEscapeCodes: true }) / columns)
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
get isEnabled() {
|
|
175
|
+
return this.#isEnabled && !this.#isSilent;
|
|
176
|
+
}
|
|
177
|
+
set isEnabled(value) {
|
|
178
|
+
if (typeof value !== "boolean") {
|
|
179
|
+
throw new TypeError("The `isEnabled` option must be a boolean");
|
|
180
|
+
}
|
|
181
|
+
this.#isEnabled = value;
|
|
182
|
+
}
|
|
183
|
+
get isSilent() {
|
|
184
|
+
return this.#isSilent;
|
|
185
|
+
}
|
|
186
|
+
set isSilent(value) {
|
|
187
|
+
if (typeof value !== "boolean") {
|
|
188
|
+
throw new TypeError("The `isSilent` option must be a boolean");
|
|
189
|
+
}
|
|
190
|
+
this.#isSilent = value;
|
|
191
|
+
}
|
|
192
|
+
frame() {
|
|
193
|
+
const now = Date.now();
|
|
194
|
+
if (this.#frameIndex === -1 || now - this.#lastSpinnerFrameTime >= this.interval) {
|
|
195
|
+
this.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;
|
|
196
|
+
this.#lastSpinnerFrameTime = now;
|
|
197
|
+
}
|
|
198
|
+
const { frames } = this.#spinner;
|
|
199
|
+
let frame = frames[this.#frameIndex];
|
|
200
|
+
if (this.color) {
|
|
201
|
+
frame = re[this.color](frame ?? "");
|
|
202
|
+
}
|
|
203
|
+
const fullPrefixText = typeof this.#prefixText === "string" && this.#prefixText !== "" ? this.#prefixText + " " : "";
|
|
204
|
+
const fullText = typeof this.text === "string" ? " " + this.text : "";
|
|
205
|
+
const fullSuffixText = typeof this.#suffixText === "string" && this.#suffixText !== "" ? " " + this.#suffixText : "";
|
|
206
|
+
return fullPrefixText + frame + fullText + fullSuffixText;
|
|
207
|
+
}
|
|
208
|
+
clear() {
|
|
209
|
+
if (!this.#isEnabled || !this.#stream.isTTY) {
|
|
210
|
+
return this;
|
|
211
|
+
}
|
|
212
|
+
this.#stream.cursorTo(0);
|
|
213
|
+
for (let index = 0; index < this.#linesToClear; index++) {
|
|
214
|
+
if (index > 0) {
|
|
215
|
+
this.#stream.moveCursor(0, -1);
|
|
216
|
+
}
|
|
217
|
+
this.#stream.clearLine(1);
|
|
218
|
+
}
|
|
219
|
+
if (this.#indent || this.lastIndent !== this.#indent) {
|
|
220
|
+
this.#stream.cursorTo(this.#indent);
|
|
221
|
+
}
|
|
222
|
+
this.lastIndent = this.#indent;
|
|
223
|
+
this.#linesToClear = 0;
|
|
224
|
+
return this;
|
|
225
|
+
}
|
|
226
|
+
render() {
|
|
227
|
+
if (this.#isSilent) {
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
this.clear();
|
|
231
|
+
this.#stream.write(this.frame());
|
|
232
|
+
this.#linesToClear = this.#lineCount;
|
|
233
|
+
return this;
|
|
234
|
+
}
|
|
235
|
+
start(text) {
|
|
236
|
+
if (text) {
|
|
237
|
+
this.text = text;
|
|
238
|
+
}
|
|
239
|
+
if (this.#isSilent) {
|
|
240
|
+
return this;
|
|
241
|
+
}
|
|
242
|
+
if (!this.#isEnabled) {
|
|
243
|
+
if (this.text) {
|
|
244
|
+
this.#stream.write(`- ${this.text}
|
|
245
|
+
`);
|
|
246
|
+
}
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
249
|
+
if (this.isSpinning) {
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
if (this.#options.hideCursor) {
|
|
253
|
+
cliCursor.hide(this.#stream);
|
|
254
|
+
}
|
|
255
|
+
if (this.#options.discardStdin && process.stdin.isTTY) {
|
|
256
|
+
this.#isDiscardingStdin = true;
|
|
257
|
+
stdinDiscarder.start();
|
|
258
|
+
}
|
|
259
|
+
this.render();
|
|
260
|
+
this.#id = setInterval(this.render.bind(this), this.interval);
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
stop() {
|
|
264
|
+
if (!this.#isEnabled) {
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
clearInterval(this.#id);
|
|
268
|
+
this.#id = void 0;
|
|
269
|
+
this.#frameIndex = 0;
|
|
270
|
+
this.clear();
|
|
271
|
+
if (this.#options.hideCursor) {
|
|
272
|
+
cliCursor.show(this.#stream);
|
|
273
|
+
}
|
|
274
|
+
if (this.#options.discardStdin && process.stdin.isTTY && this.#isDiscardingStdin) {
|
|
275
|
+
stdinDiscarder.stop();
|
|
276
|
+
this.#isDiscardingStdin = false;
|
|
277
|
+
}
|
|
278
|
+
return this;
|
|
279
|
+
}
|
|
280
|
+
succeed(text) {
|
|
281
|
+
return this.stopAndPersist({ symbol: success, text });
|
|
282
|
+
}
|
|
283
|
+
fail(text) {
|
|
284
|
+
return this.stopAndPersist({ symbol: error, text });
|
|
285
|
+
}
|
|
286
|
+
warn(text) {
|
|
287
|
+
return this.stopAndPersist({ symbol: warning, text });
|
|
288
|
+
}
|
|
289
|
+
info(text) {
|
|
290
|
+
return this.stopAndPersist({ symbol: info, text });
|
|
291
|
+
}
|
|
292
|
+
stopAndPersist(options = {}) {
|
|
293
|
+
if (this.#isSilent) {
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
const prefixText = options.prefixText ?? this.#prefixText;
|
|
297
|
+
const fullPrefixText = this.#getFullPrefixText(prefixText, " ");
|
|
298
|
+
const symbolText = options.symbol ?? " ";
|
|
299
|
+
const text = options.text ?? this.text;
|
|
300
|
+
const separatorText = symbolText ? " " : "";
|
|
301
|
+
const fullText = typeof text === "string" ? separatorText + text : "";
|
|
302
|
+
const suffixText = options.suffixText ?? this.#suffixText;
|
|
303
|
+
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
304
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + "\n";
|
|
305
|
+
this.stop();
|
|
306
|
+
this.#stream.write(textToWrite);
|
|
307
|
+
return this;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
export default function ora(options) {
|
|
311
|
+
return new Ora(options);
|
|
312
|
+
}
|
|
313
|
+
export async function oraPromise(action, options) {
|
|
314
|
+
const actionIsFunction = typeof action === "function";
|
|
315
|
+
const actionIsPromise = !actionIsFunction && typeof action.then === "function";
|
|
316
|
+
if (!actionIsFunction && !actionIsPromise) {
|
|
317
|
+
throw new TypeError("Parameter `action` must be a Function or a Promise");
|
|
318
|
+
}
|
|
319
|
+
const { successText, failText } = typeof options === "object" ? options : { successText: void 0, failText: void 0 };
|
|
320
|
+
const spinnerOptions = typeof options === "object" && "text" in options ? options : typeof options === "string" ? { text: options } : {};
|
|
321
|
+
const spinner = ora(spinnerOptions).start();
|
|
322
|
+
try {
|
|
323
|
+
const promise = actionIsFunction ? action(spinner) : action;
|
|
324
|
+
const result = await promise;
|
|
325
|
+
spinner.succeed(
|
|
326
|
+
successText === void 0 ? void 0 : typeof successText === "string" ? successText : successText(result)
|
|
327
|
+
);
|
|
328
|
+
return result;
|
|
329
|
+
} catch (error2) {
|
|
330
|
+
spinner.fail(
|
|
331
|
+
failText === void 0 ? void 0 : typeof failText === "string" ? failText : failText(error2)
|
|
332
|
+
);
|
|
333
|
+
throw error2;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
export { default as spinners } from "cli-spinners";
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
* - spinner: "dots", color: "cyan", hideCursor: true, discardStdin: true, stream defaults to stderr.
|
|
8
8
|
*/
|
|
9
9
|
import { randomSpinner } from "cli-spinners";
|
|
10
|
-
import { type Ora, type Options as OraOptions, type PromiseOptions as OraPromiseOptions } from "ora";
|
|
11
10
|
import prettyBytes from "pretty-bytes";
|
|
12
11
|
import prettyMilliseconds from "pretty-ms";
|
|
13
|
-
|
|
12
|
+
import { type Ora, type OraOptions, type OraPromiseOptions } from "./spinner-impl.js";
|
|
13
|
+
export interface SpinnerOptions extends Omit<OraOptions, "text"> {
|
|
14
14
|
readonly respectEnv?: boolean;
|
|
15
15
|
readonly showTiming?: boolean;
|
|
16
16
|
readonly defaultSuccess?: string;
|
|
17
17
|
readonly defaultFail?: string;
|
|
18
|
+
text?: string;
|
|
18
19
|
readonly textColor?: string | ((text: string) => string);
|
|
19
20
|
readonly prefixColor?: string | ((text: string) => string);
|
|
20
21
|
readonly suffixColor?: string | ((text: string) => string);
|
|
@@ -167,94 +168,5 @@ export declare function createTransferSpinner(operation: string, options?: Spinn
|
|
|
167
168
|
complete: (message?: string, totalBytesTransferred?: number) => void;
|
|
168
169
|
error: (error: Error | string) => void;
|
|
169
170
|
};
|
|
170
|
-
export
|
|
171
|
-
readonly toggle: import("cli-spinners").Spinner;
|
|
172
|
-
readonly line: import("cli-spinners").Spinner;
|
|
173
|
-
readonly dots: import("cli-spinners").Spinner;
|
|
174
|
-
readonly dots2: import("cli-spinners").Spinner;
|
|
175
|
-
readonly dots3: import("cli-spinners").Spinner;
|
|
176
|
-
readonly dots4: import("cli-spinners").Spinner;
|
|
177
|
-
readonly dots5: import("cli-spinners").Spinner;
|
|
178
|
-
readonly dots6: import("cli-spinners").Spinner;
|
|
179
|
-
readonly dots7: import("cli-spinners").Spinner;
|
|
180
|
-
readonly dots8: import("cli-spinners").Spinner;
|
|
181
|
-
readonly dots9: import("cli-spinners").Spinner;
|
|
182
|
-
readonly dots10: import("cli-spinners").Spinner;
|
|
183
|
-
readonly dots11: import("cli-spinners").Spinner;
|
|
184
|
-
readonly dots12: import("cli-spinners").Spinner;
|
|
185
|
-
readonly dots8Bit: import("cli-spinners").Spinner;
|
|
186
|
-
readonly sand: import("cli-spinners").Spinner;
|
|
187
|
-
readonly line2: import("cli-spinners").Spinner;
|
|
188
|
-
readonly pipe: import("cli-spinners").Spinner;
|
|
189
|
-
readonly simpleDots: import("cli-spinners").Spinner;
|
|
190
|
-
readonly simpleDotsScrolling: import("cli-spinners").Spinner;
|
|
191
|
-
readonly star: import("cli-spinners").Spinner;
|
|
192
|
-
readonly star2: import("cli-spinners").Spinner;
|
|
193
|
-
readonly flip: import("cli-spinners").Spinner;
|
|
194
|
-
readonly hamburger: import("cli-spinners").Spinner;
|
|
195
|
-
readonly growVertical: import("cli-spinners").Spinner;
|
|
196
|
-
readonly growHorizontal: import("cli-spinners").Spinner;
|
|
197
|
-
readonly balloon: import("cli-spinners").Spinner;
|
|
198
|
-
readonly balloon2: import("cli-spinners").Spinner;
|
|
199
|
-
readonly noise: import("cli-spinners").Spinner;
|
|
200
|
-
readonly bounce: import("cli-spinners").Spinner;
|
|
201
|
-
readonly boxBounce: import("cli-spinners").Spinner;
|
|
202
|
-
readonly boxBounce2: import("cli-spinners").Spinner;
|
|
203
|
-
readonly binary: import("cli-spinners").Spinner;
|
|
204
|
-
readonly triangle: import("cli-spinners").Spinner;
|
|
205
|
-
readonly arc: import("cli-spinners").Spinner;
|
|
206
|
-
readonly circle: import("cli-spinners").Spinner;
|
|
207
|
-
readonly squareCorners: import("cli-spinners").Spinner;
|
|
208
|
-
readonly circleQuarters: import("cli-spinners").Spinner;
|
|
209
|
-
readonly circleHalves: import("cli-spinners").Spinner;
|
|
210
|
-
readonly squish: import("cli-spinners").Spinner;
|
|
211
|
-
readonly toggle2: import("cli-spinners").Spinner;
|
|
212
|
-
readonly toggle3: import("cli-spinners").Spinner;
|
|
213
|
-
readonly toggle4: import("cli-spinners").Spinner;
|
|
214
|
-
readonly toggle5: import("cli-spinners").Spinner;
|
|
215
|
-
readonly toggle6: import("cli-spinners").Spinner;
|
|
216
|
-
readonly toggle7: import("cli-spinners").Spinner;
|
|
217
|
-
readonly toggle8: import("cli-spinners").Spinner;
|
|
218
|
-
readonly toggle9: import("cli-spinners").Spinner;
|
|
219
|
-
readonly toggle10: import("cli-spinners").Spinner;
|
|
220
|
-
readonly toggle11: import("cli-spinners").Spinner;
|
|
221
|
-
readonly toggle12: import("cli-spinners").Spinner;
|
|
222
|
-
readonly toggle13: import("cli-spinners").Spinner;
|
|
223
|
-
readonly arrow: import("cli-spinners").Spinner;
|
|
224
|
-
readonly arrow2: import("cli-spinners").Spinner;
|
|
225
|
-
readonly arrow3: import("cli-spinners").Spinner;
|
|
226
|
-
readonly bouncingBar: import("cli-spinners").Spinner;
|
|
227
|
-
readonly bouncingBall: import("cli-spinners").Spinner;
|
|
228
|
-
readonly smiley: import("cli-spinners").Spinner;
|
|
229
|
-
readonly monkey: import("cli-spinners").Spinner;
|
|
230
|
-
readonly hearts: import("cli-spinners").Spinner;
|
|
231
|
-
readonly clock: import("cli-spinners").Spinner;
|
|
232
|
-
readonly earth: import("cli-spinners").Spinner;
|
|
233
|
-
readonly material: import("cli-spinners").Spinner;
|
|
234
|
-
readonly moon: import("cli-spinners").Spinner;
|
|
235
|
-
readonly runner: import("cli-spinners").Spinner;
|
|
236
|
-
readonly pong: import("cli-spinners").Spinner;
|
|
237
|
-
readonly shark: import("cli-spinners").Spinner;
|
|
238
|
-
readonly dqpb: import("cli-spinners").Spinner;
|
|
239
|
-
readonly weather: import("cli-spinners").Spinner;
|
|
240
|
-
readonly christmas: import("cli-spinners").Spinner;
|
|
241
|
-
readonly grenade: import("cli-spinners").Spinner;
|
|
242
|
-
readonly point: import("cli-spinners").Spinner;
|
|
243
|
-
readonly layer: import("cli-spinners").Spinner;
|
|
244
|
-
readonly betaWave: import("cli-spinners").Spinner;
|
|
245
|
-
readonly fingerDance: import("cli-spinners").Spinner;
|
|
246
|
-
readonly fistBump: import("cli-spinners").Spinner;
|
|
247
|
-
readonly soccerHeader: import("cli-spinners").Spinner;
|
|
248
|
-
readonly mindblown: import("cli-spinners").Spinner;
|
|
249
|
-
readonly speaker: import("cli-spinners").Spinner;
|
|
250
|
-
readonly orangePulse: import("cli-spinners").Spinner;
|
|
251
|
-
readonly bluePulse: import("cli-spinners").Spinner;
|
|
252
|
-
readonly orangeBluePulse: import("cli-spinners").Spinner;
|
|
253
|
-
readonly timeTravel: import("cli-spinners").Spinner;
|
|
254
|
-
readonly aesthetic: import("cli-spinners").Spinner;
|
|
255
|
-
readonly dwarfFortress: import("cli-spinners").Spinner;
|
|
256
|
-
readonly dots13: import("cli-spinners").Spinner;
|
|
257
|
-
readonly dots14: import("cli-spinners").Spinner;
|
|
258
|
-
readonly dotsCircle: import("cli-spinners").Spinner;
|
|
259
|
-
};
|
|
171
|
+
export { default as cliSpinners } from "cli-spinners";
|
|
260
172
|
export { randomSpinner, prettyBytes, prettyMilliseconds };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { re } from "@reliverse/relico";
|
|
2
|
-
import
|
|
3
|
-
import ora, {
|
|
4
|
-
oraPromise
|
|
5
|
-
} from "ora";
|
|
2
|
+
import { randomSpinner } from "cli-spinners";
|
|
6
3
|
import prettyBytes from "pretty-bytes";
|
|
7
4
|
import prettyMilliseconds from "pretty-ms";
|
|
5
|
+
import ora, {
|
|
6
|
+
oraPromise
|
|
7
|
+
} from "./spinner-impl.js";
|
|
8
8
|
function isColorsEnabled(isSpinnerEnabledFlag) {
|
|
9
9
|
if (process.env["CLI_NO_COLOR"] === "1") return false;
|
|
10
10
|
return isSpinnerEnabledFlag;
|
|
@@ -96,10 +96,7 @@ export function createSpinner(input) {
|
|
|
96
96
|
return spinner;
|
|
97
97
|
}
|
|
98
98
|
export async function withSpinnerPromise(action, options) {
|
|
99
|
-
return oraPromise(
|
|
100
|
-
action,
|
|
101
|
-
options
|
|
102
|
-
);
|
|
99
|
+
return oraPromise(action, options);
|
|
103
100
|
}
|
|
104
101
|
export async function withSpinner(textOrOptions, action, onSuccessText, onFailText) {
|
|
105
102
|
const startTime = Date.now();
|
|
@@ -189,7 +186,7 @@ export function createTimedSpinner(input) {
|
|
|
189
186
|
}
|
|
190
187
|
export function createSpinnerGroup(options) {
|
|
191
188
|
const { items, concurrent = false, ...baseOptions } = options;
|
|
192
|
-
const
|
|
189
|
+
const spinners = items.map((item, index) => {
|
|
193
190
|
const spinnerOptions = {
|
|
194
191
|
...baseOptions,
|
|
195
192
|
text: item,
|
|
@@ -198,26 +195,26 @@ export function createSpinnerGroup(options) {
|
|
|
198
195
|
return createSpinner(spinnerOptions);
|
|
199
196
|
});
|
|
200
197
|
return {
|
|
201
|
-
spinners
|
|
198
|
+
spinners,
|
|
202
199
|
updateAll: (text) => {
|
|
203
|
-
for (const spinner of
|
|
200
|
+
for (const spinner of spinners) {
|
|
204
201
|
updateSpinnerText(spinner, text);
|
|
205
202
|
}
|
|
206
203
|
},
|
|
207
204
|
succeedAll: (text) => {
|
|
208
|
-
for (const spinner of
|
|
205
|
+
for (const spinner of spinners) {
|
|
209
206
|
const style = spinner.__successStyler ?? identity;
|
|
210
207
|
spinner.succeed(text ? style(text) : void 0);
|
|
211
208
|
}
|
|
212
209
|
},
|
|
213
210
|
failAll: (text) => {
|
|
214
|
-
for (const spinner of
|
|
211
|
+
for (const spinner of spinners) {
|
|
215
212
|
const style = spinner.__failStyler ?? identity;
|
|
216
213
|
spinner.fail(text ? style(text) : void 0);
|
|
217
214
|
}
|
|
218
215
|
},
|
|
219
216
|
stopAll: () => {
|
|
220
|
-
for (const spinner of
|
|
217
|
+
for (const spinner of spinners) {
|
|
221
218
|
spinner.stop();
|
|
222
219
|
}
|
|
223
220
|
}
|
|
@@ -450,5 +447,5 @@ export function createTransferSpinner(operation, options) {
|
|
|
450
447
|
}
|
|
451
448
|
};
|
|
452
449
|
}
|
|
453
|
-
export
|
|
450
|
+
export { default as cliSpinners } from "cli-spinners";
|
|
454
451
|
export { randomSpinner, prettyBytes, prettyMilliseconds };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { stdout } from "node:process";
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
|
-
import ora from "ora";
|
|
4
3
|
import { cursor } from "sisteransi";
|
|
5
4
|
import terminalSize from "terminal-size";
|
|
6
5
|
import wrapAnsi from "wrap-ansi";
|
|
7
6
|
import { toBaseColor } from "../msg-fmt/colors.js";
|
|
8
7
|
import { colorMap } from "../msg-fmt/mapping.js";
|
|
9
8
|
import { msg } from "../msg-fmt/messages.js";
|
|
9
|
+
import ora from "../spinner/spinner-impl.js";
|
|
10
10
|
function getTerminalWidth() {
|
|
11
11
|
return terminalSize().columns;
|
|
12
12
|
}
|
|
@@ -126,7 +126,7 @@ export async function streamTextWithSpinner({
|
|
|
126
126
|
...baseColor !== void 0 && { color: baseColor },
|
|
127
127
|
spinner: spinnerFrames ? {
|
|
128
128
|
frames: spinnerFrames,
|
|
129
|
-
|
|
129
|
+
interval: spinnerDelay ?? 80
|
|
130
130
|
} : "dots"
|
|
131
131
|
}).start();
|
|
132
132
|
for (const char of text) {
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
|
-
import figlet from "figlet";
|
|
2
|
+
// import figlet, { type Fonts } from "figlet";
|
|
3
|
+
|
|
3
4
|
export async function createAsciiArt({
|
|
4
5
|
message,
|
|
5
6
|
font = "Standard",
|
|
6
|
-
clearConsole = false
|
|
7
|
-
}
|
|
7
|
+
clearConsole = false,
|
|
8
|
+
}: {
|
|
9
|
+
message: string;
|
|
10
|
+
font?: Fonts;
|
|
11
|
+
clearConsole?: boolean;
|
|
12
|
+
}): Promise<void> {
|
|
8
13
|
if (clearConsole) {
|
|
9
14
|
relinka("clear", "");
|
|
10
15
|
}
|
|
16
|
+
|
|
11
17
|
const asciiArt = figlet.textSync(message, { font });
|
|
12
18
|
relinka("log", asciiArt);
|
|
13
19
|
}
|
package/bin/mod.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { animateText, animationMap } from "./libs/animate/animate-mod";
|
|
2
1
|
export { anykeyPrompt } from "./libs/anykey/anykey-mod";
|
|
3
2
|
export type { CancelValue } from "./libs/cancel/cancel";
|
|
4
3
|
export { block, CANCEL, cancel, createCancel, getColumns, isCancel, isWindows, setRawMode, } from "./libs/cancel/cancel";
|
|
@@ -37,8 +36,10 @@ export { numSelectPrompt } from "./libs/select/numselect-prompt";
|
|
|
37
36
|
export { select, selectSimple } from "./libs/select/select-alias";
|
|
38
37
|
export { selectPrompt } from "./libs/select/select-prompt";
|
|
39
38
|
export { togglePrompt } from "./libs/select/toggle-prompt";
|
|
39
|
+
export type { Ora, OraOptions, OraPromiseOptions, StopAndPersistOptions, } from "./libs/spinner/spinner-impl";
|
|
40
|
+
export { error, info, oraPromise, spinners, success, warning } from "./libs/spinner/spinner-impl";
|
|
40
41
|
export type { FileProgressOptions, SimpleSpinner, SpinnerGroupOptions, SpinnerOptions, } from "./libs/spinner/spinner-mod";
|
|
41
|
-
export { createBuildSpinner, createFileProgressSpinner, createMultiStepSpinner, createSpinner, createSpinnerGroup, createTimedSpinner, createTransferSpinner, defaultSpinnerOptions, formatSpinnerBytes, formatSpinnerElapsed, formatSpinnerTiming, isSpinnerEnabled, isSpinnerRunning, prettyBytes, prettyMilliseconds, randomSpinner, safeStopSpinner,
|
|
42
|
+
export { cliSpinners, createBuildSpinner, createFileProgressSpinner, createMultiStepSpinner, createSpinner, createSpinnerGroup, createTimedSpinner, createTransferSpinner, defaultSpinnerOptions, formatSpinnerBytes, formatSpinnerElapsed, formatSpinnerTiming, isSpinnerEnabled, isSpinnerRunning, prettyBytes, prettyMilliseconds, randomSpinner, safeStopSpinner, stopAndPersist, updateSpinnerText, withEnhancedSpinner, withSpinner, withSpinnerPromise, } from "./libs/spinner/spinner-mod";
|
|
42
43
|
export { colorize } from "./libs/utils/colorize";
|
|
43
44
|
export { errorHandler } from "./libs/utils/errors";
|
|
44
45
|
export { preventUnsupportedTTY, preventWindowsHomeDirRoot, preventWrongTerminalSize, } from "./libs/utils/prevent";
|
|
@@ -46,5 +47,4 @@ export { completePrompt, renderEndLine, renderEndLineInput, } from "./libs/utils
|
|
|
46
47
|
export { streamText, streamTextBox, streamTextWithSpinner, } from "./libs/utils/stream-text";
|
|
47
48
|
export { pm, reliversePrompts } from "./libs/utils/system";
|
|
48
49
|
export { isTerminalInteractive, isValidName, normalizeName, } from "./libs/utils/validate";
|
|
49
|
-
export { createAsciiArt } from "./libs/visual/visual-mod";
|
|
50
50
|
export type { AllKinds, BorderColorName, ChoiceOptions, ColorName, ConfirmPromptOptions, DatePromptOptions, EditorExitResult, FmtMsgOptions, InputPromptOptions, MessageConfig, MessageKind, MsgConfig, MsgType, MultiselectPromptParams, OutputColor, PreventWrongTerminalSizeOptions, ProgressBar, ProgressBarOptions, PromptOptions, PromptType, RenderParams, SelectOption, SelectPromptParams, SeparatorOption, StandardColor, StreamOptions, StreamTextOptions, SymbolName, Symbols, TogglePromptParams, TypographyName, VariantName, } from "./types";
|
package/bin/mod.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { animateText, animationMap } from "./libs/animate/animate-mod.js";
|
|
2
1
|
export { anykeyPrompt } from "./libs/anykey/anykey-mod.js";
|
|
3
2
|
export {
|
|
4
3
|
block,
|
|
@@ -72,7 +71,9 @@ export { numSelectPrompt } from "./libs/select/numselect-prompt.js";
|
|
|
72
71
|
export { select, selectSimple } from "./libs/select/select-alias.js";
|
|
73
72
|
export { selectPrompt } from "./libs/select/select-prompt.js";
|
|
74
73
|
export { togglePrompt } from "./libs/select/toggle-prompt.js";
|
|
74
|
+
export { error, info, oraPromise, spinners, success, warning } from "./libs/spinner/spinner-impl.js";
|
|
75
75
|
export {
|
|
76
|
+
cliSpinners,
|
|
76
77
|
createBuildSpinner,
|
|
77
78
|
createFileProgressSpinner,
|
|
78
79
|
createMultiStepSpinner,
|
|
@@ -90,7 +91,6 @@ export {
|
|
|
90
91
|
prettyMilliseconds,
|
|
91
92
|
randomSpinner,
|
|
92
93
|
safeStopSpinner,
|
|
93
|
-
spinners,
|
|
94
94
|
stopAndPersist,
|
|
95
95
|
updateSpinnerText,
|
|
96
96
|
withEnhancedSpinner,
|
|
@@ -120,4 +120,3 @@ export {
|
|
|
120
120
|
isValidName,
|
|
121
121
|
normalizeName
|
|
122
122
|
} from "./libs/utils/validate.js";
|
|
123
|
-
export { createAsciiArt } from "./libs/visual/visual-mod.js";
|
package/package.json
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@figliolia/chalk-animation": "^1.0.4",
|
|
4
3
|
"@reliverse/relico": "^1.3.9",
|
|
5
4
|
"@reliverse/relinka": "^1.6.1",
|
|
6
5
|
"@reliverse/reltime": "^1.1.1",
|
|
7
6
|
"ansi-escapes": "^7.0.0",
|
|
7
|
+
"cli-cursor": "^5.0.0",
|
|
8
8
|
"cli-spinners": "^3.2.0",
|
|
9
|
-
"figlet": "^1.8.2",
|
|
10
9
|
"gradient-string": "^3.0.0",
|
|
10
|
+
"is-interactive": "^2.0.0",
|
|
11
|
+
"is-unicode-supported": "^2.1.0",
|
|
11
12
|
"log-update": "^6.1.0",
|
|
12
|
-
"ora": "^8.2.0",
|
|
13
13
|
"pkg-types": "^2.3.0",
|
|
14
14
|
"pretty-bytes": "^7.0.1",
|
|
15
15
|
"pretty-ms": "^9.2.0",
|
|
16
16
|
"sisteransi": "^1.0.5",
|
|
17
|
+
"stdin-discarder": "^0.2.2",
|
|
18
|
+
"string-width": "^8.0.0",
|
|
19
|
+
"strip-ansi": "^7.1.0",
|
|
17
20
|
"terminal-size": "^4.0.0",
|
|
18
21
|
"ts-regex-builder": "^1.8.2",
|
|
19
22
|
"wrap-ansi": "^9.0.0"
|
|
@@ -23,7 +26,7 @@
|
|
|
23
26
|
"license": "MIT",
|
|
24
27
|
"name": "@reliverse/rempts",
|
|
25
28
|
"type": "module",
|
|
26
|
-
"version": "1.7.
|
|
29
|
+
"version": "1.7.60",
|
|
27
30
|
"author": "reliverse",
|
|
28
31
|
"bugs": {
|
|
29
32
|
"email": "blefnk@gmail.com",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type Animation, type AnimationName } from "@figliolia/chalk-animation";
|
|
2
|
-
import type { BorderColorName, ColorName, MsgType, TypographyName } from "../../types";
|
|
3
|
-
export declare const animationMap: Record<AnimationName, (text: string) => Animation>;
|
|
4
|
-
export declare function animateText({ title, anim, delay, type, titleColor, titleTypography, border, borderColor, horizontalLineLength, }: {
|
|
5
|
-
title: string;
|
|
6
|
-
anim: AnimationName;
|
|
7
|
-
delay?: number;
|
|
8
|
-
type?: MsgType;
|
|
9
|
-
titleColor?: ColorName;
|
|
10
|
-
titleTypography?: TypographyName;
|
|
11
|
-
borderColor?: BorderColorName;
|
|
12
|
-
border?: boolean;
|
|
13
|
-
horizontalLineLength?: number;
|
|
14
|
-
}): Promise<void>;
|