@reliverse/relinka 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-npm/components/confirm/confirm-main.js +0 -1
- package/dist-npm/components/date/date.js +1 -2
- package/dist-npm/components/input/text-main.js +15 -4
- package/dist-npm/components/multiselect/multi-select-two.js +1 -2
- package/dist-npm/components/multiselect/num-multi-select.js +1 -2
- package/dist-npm/components/next-steps/next-steps.js +0 -1
- package/dist-npm/components/number/number-main.js +0 -1
- package/dist-npm/components/password/password-main.js +0 -1
- package/dist-npm/components/select/num-select.js +1 -2
- package/dist-npm/components/select/select-two.js +0 -1
- package/dist-npm/components/st-end/end.d.ts +1 -1
- package/dist-npm/components/st-end/end.js +0 -1
- package/dist-npm/components/st-end/start.d.ts +1 -1
- package/dist-npm/components/st-end/start.js +0 -1
- package/dist-npm/types/general.d.ts +2 -1
- package/dist-npm/utils/messages.js +2 -2
- package/package.json +1 -1
|
@@ -70,7 +70,6 @@ export async function datePrompt(options) {
|
|
|
70
70
|
defaultValue,
|
|
71
71
|
schema,
|
|
72
72
|
titleColor = "cyanBright",
|
|
73
|
-
answerColor = "none",
|
|
74
73
|
titleTypography = "bold",
|
|
75
74
|
titleVariant,
|
|
76
75
|
content,
|
|
@@ -113,7 +112,7 @@ export async function datePrompt(options) {
|
|
|
113
112
|
msg({
|
|
114
113
|
type: "M_MIDDLE",
|
|
115
114
|
title: ` ${defaultValue}`,
|
|
116
|
-
titleColor:
|
|
115
|
+
titleColor: "none"
|
|
117
116
|
});
|
|
118
117
|
}
|
|
119
118
|
if (!Value.Check(dateFormatSchema, answer)) {
|
|
@@ -15,7 +15,6 @@ export async function textPrompt(options) {
|
|
|
15
15
|
defaultValue = "",
|
|
16
16
|
schema,
|
|
17
17
|
titleColor = "cyanBright",
|
|
18
|
-
answerColor = "none",
|
|
19
18
|
titleTypography = "bold",
|
|
20
19
|
titleVariant,
|
|
21
20
|
content,
|
|
@@ -23,11 +22,14 @@ export async function textPrompt(options) {
|
|
|
23
22
|
contentTypography,
|
|
24
23
|
contentVariant,
|
|
25
24
|
borderColor = "viceGradient",
|
|
26
|
-
variantOptions
|
|
25
|
+
variantOptions,
|
|
26
|
+
placeholder
|
|
27
27
|
} = options;
|
|
28
28
|
const rl = readline.createInterface({ input, output });
|
|
29
29
|
let linesToDelete = 0;
|
|
30
30
|
let errorMessage = "";
|
|
31
|
+
let currentInput = "";
|
|
32
|
+
let showPlaceholder = true;
|
|
31
33
|
while (true) {
|
|
32
34
|
if (linesToDelete > 0) {
|
|
33
35
|
deleteLastLines(linesToDelete);
|
|
@@ -44,14 +46,23 @@ export async function textPrompt(options) {
|
|
|
44
46
|
contentVariant,
|
|
45
47
|
borderColor,
|
|
46
48
|
hint,
|
|
49
|
+
placeholder: showPlaceholder ? placeholder : void 0,
|
|
47
50
|
variantOptions,
|
|
48
51
|
errorMessage
|
|
49
52
|
});
|
|
50
53
|
const questionLines = countLines(question);
|
|
51
54
|
const prompt = await rl.question(question);
|
|
55
|
+
currentInput = prompt.trim();
|
|
56
|
+
if (showPlaceholder && currentInput !== "") {
|
|
57
|
+
showPlaceholder = false;
|
|
58
|
+
deleteLastLine();
|
|
59
|
+
deleteLastLine();
|
|
60
|
+
msg({ type: "M_MIDDLE", title: ` ${currentInput}` });
|
|
61
|
+
}
|
|
52
62
|
linesToDelete = questionLines + 1;
|
|
53
|
-
const answer =
|
|
54
|
-
if (
|
|
63
|
+
const answer = currentInput || defaultValue;
|
|
64
|
+
if (currentInput === "" && defaultValue !== "") {
|
|
65
|
+
deleteLastLine();
|
|
55
66
|
deleteLastLine();
|
|
56
67
|
const defaultMsg = fmt({
|
|
57
68
|
type: "M_MIDDLE",
|
|
@@ -15,7 +15,6 @@ export async function multiselectPrompt(options) {
|
|
|
15
15
|
schema,
|
|
16
16
|
defaultValue,
|
|
17
17
|
titleColor = "cyanBright",
|
|
18
|
-
answerColor = "none",
|
|
19
18
|
titleTypography = "bold",
|
|
20
19
|
titleVariant,
|
|
21
20
|
hint,
|
|
@@ -74,7 +73,7 @@ ${formattedBar} `;
|
|
|
74
73
|
msg({
|
|
75
74
|
type: "M_MIDDLE",
|
|
76
75
|
title: ` ${Array.isArray(defaultValue) ? defaultValue.join(", ") : defaultValue}`,
|
|
77
|
-
titleColor:
|
|
76
|
+
titleColor: "none"
|
|
78
77
|
});
|
|
79
78
|
msg({ type: "M_NEWLINE" });
|
|
80
79
|
return defaultValue;
|
|
@@ -15,7 +15,6 @@ export async function numMultiSelectPrompt(options) {
|
|
|
15
15
|
schema,
|
|
16
16
|
defaultValue,
|
|
17
17
|
titleColor = "cyanBright",
|
|
18
|
-
answerColor = "none",
|
|
19
18
|
titleTypography = "bold",
|
|
20
19
|
titleVariant,
|
|
21
20
|
hint,
|
|
@@ -74,7 +73,7 @@ ${formattedBar} `;
|
|
|
74
73
|
msg({
|
|
75
74
|
type: "M_MIDDLE",
|
|
76
75
|
title: ` ${Array.isArray(defaultValue) ? defaultValue.join(", ") : defaultValue}`,
|
|
77
|
-
titleColor:
|
|
76
|
+
titleColor: "none"
|
|
78
77
|
});
|
|
79
78
|
msg({ type: "M_NEWLINE" });
|
|
80
79
|
return defaultValue;
|
|
@@ -16,7 +16,6 @@ export async function numSelectPrompt(options) {
|
|
|
16
16
|
defaultValue,
|
|
17
17
|
schema,
|
|
18
18
|
titleColor = "cyanBright",
|
|
19
|
-
answerColor = "none",
|
|
20
19
|
titleTypography = "bold",
|
|
21
20
|
titleVariant,
|
|
22
21
|
content,
|
|
@@ -83,7 +82,7 @@ ${formattedBar} `
|
|
|
83
82
|
msg({
|
|
84
83
|
type: "M_MIDDLE",
|
|
85
84
|
title: ` ${defaultValue}`,
|
|
86
|
-
titleColor:
|
|
85
|
+
titleColor: "none"
|
|
87
86
|
});
|
|
88
87
|
}
|
|
89
88
|
const num = Number(answer);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PromptOptions } from "../../types/general.js";
|
|
2
|
-
export declare function endPrompt({ title, titleColor,
|
|
2
|
+
export declare function endPrompt({ title, titleColor, titleTypography, titleVariant, titleAnimation, titleAnimationDelay, border, borderColor, }: PromptOptions): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PromptOptions } from "../../types/general.js";
|
|
2
|
-
export declare function startPrompt({ title, titleColor,
|
|
2
|
+
export declare function startPrompt({ title, titleColor, titleTypography, titleVariant, borderColor, clearConsole, }: PromptOptions): Promise<void>;
|
|
@@ -37,6 +37,7 @@ export type FmtMsgOptions = {
|
|
|
37
37
|
errorMessage?: string;
|
|
38
38
|
addNewLineBefore?: boolean;
|
|
39
39
|
addNewLineAfter?: boolean;
|
|
40
|
+
placeholder?: string;
|
|
40
41
|
};
|
|
41
42
|
export type RequiredPromptOptions = {
|
|
42
43
|
id: string;
|
|
@@ -54,6 +55,7 @@ export type OptionalPromptOptions<T extends TSchema = any> = {
|
|
|
54
55
|
contentTypography?: TypographyName;
|
|
55
56
|
contentVariant?: Variant;
|
|
56
57
|
hint?: string;
|
|
58
|
+
placeholder?: string;
|
|
57
59
|
validate?: (value: any) => boolean | string | Promise<boolean | string>;
|
|
58
60
|
defaultValue?: string | string[] | number | boolean;
|
|
59
61
|
defaultColor?: ColorName;
|
|
@@ -69,7 +71,6 @@ export type OptionalPromptOptions<T extends TSchema = any> = {
|
|
|
69
71
|
borderColor?: ColorName;
|
|
70
72
|
clearConsole?: boolean;
|
|
71
73
|
additionalLinesToDelete?: number;
|
|
72
|
-
answerColor?: ColorName;
|
|
73
74
|
hintColor?: ColorName;
|
|
74
75
|
hints?: string[];
|
|
75
76
|
required?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { greenBright, redBright } from "picocolors";
|
|
1
|
+
import { greenBright, redBright, dim } from "picocolors";
|
|
2
2
|
import { colorMap, typographyMap } from "../utils/mapping.js";
|
|
3
3
|
import { isUnicodeSupported } from "../utils/platforms.js";
|
|
4
4
|
import { variantMap } from "../utils/variants.js";
|
|
@@ -90,7 +90,7 @@ ${formattedBar}`,
|
|
|
90
90
|
M_GENERAL: {
|
|
91
91
|
symbol: "",
|
|
92
92
|
prefix: greenBright(symbols.step_active),
|
|
93
|
-
suffix: "",
|
|
93
|
+
suffix: opts.placeholder ? dim(opts.placeholder) + "\n" + formattedBar + " " : "",
|
|
94
94
|
newLineBefore: opts.addNewLineBefore ?? false,
|
|
95
95
|
newLineAfter: opts.addNewLineAfter ?? true
|
|
96
96
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reliverse/relinka",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "@reliverse/relinka is a powerful library that enables seamless, typesafe, and resilient prompts for command-line applications. Crafted with simplicity and elegance, it provides developers with an intuitive and robust way to build interactive CLIs.",
|
|
6
6
|
"scripts": {
|