@shell-shock/plugin-prompts 0.3.36 → 0.3.38
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.
|
@@ -227,7 +227,7 @@ function BasePromptDeclarations() {
|
|
|
227
227
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
228
228
|
name: "readline",
|
|
229
229
|
isPrivateMember: true,
|
|
230
|
-
type: "
|
|
230
|
+
type: "Interface"
|
|
231
231
|
}),
|
|
232
232
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
233
233
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
@@ -440,11 +440,11 @@ function BasePromptDeclarations() {
|
|
|
440
440
|
|
|
441
441
|
this.message = config.message;
|
|
442
442
|
|
|
443
|
-
this.#readline =
|
|
443
|
+
this.#readline = createInterface({
|
|
444
444
|
input: this.input,
|
|
445
445
|
escapeCodeTimeout: 50
|
|
446
446
|
});
|
|
447
|
-
|
|
447
|
+
emitKeypressEvents(this.input, this.#readline);
|
|
448
448
|
|
|
449
449
|
if (this.input.isTTY) {
|
|
450
450
|
this.input.setRawMode(true);
|
|
@@ -498,13 +498,13 @@ function BasePromptDeclarations() {
|
|
|
498
498
|
name: "status",
|
|
499
499
|
type: "string",
|
|
500
500
|
children: _alloy_js_core.code`return this.isSubmitted ? "" : \` \\n \${
|
|
501
|
-
|
|
501
|
+
italic(
|
|
502
502
|
this.isError
|
|
503
|
-
?
|
|
503
|
+
? textColors.prompt.description.error(splitText(this.errorMessage, "3/4").join("\\n"))
|
|
504
504
|
: this.isCancelled
|
|
505
|
-
?
|
|
505
|
+
? textColors.prompt.description.cancelled(splitText("Input was cancelled by user", "3/4").join("\\n"))
|
|
506
506
|
: this.description
|
|
507
|
-
?
|
|
507
|
+
? textColors.prompt.description.active(splitText(this.description, "3/4").join("\\n"))
|
|
508
508
|
: ""
|
|
509
509
|
)
|
|
510
510
|
}\`; `
|
|
@@ -586,14 +586,14 @@ function BasePromptDeclarations() {
|
|
|
586
586
|
"protected": true,
|
|
587
587
|
returnType: "string",
|
|
588
588
|
children: _alloy_js_core.code`return this.isPlaceholder
|
|
589
|
-
?
|
|
589
|
+
? textColors.prompt.input.disabled(this.displayValue)
|
|
590
590
|
: this.isError
|
|
591
|
-
?
|
|
591
|
+
? textColors.prompt.input.error(this.displayValue)
|
|
592
592
|
: this.isSubmitted
|
|
593
|
-
?
|
|
593
|
+
? textColors.prompt.input.submitted(this.maskCompleted(this.displayValue))
|
|
594
594
|
: this.isCancelled
|
|
595
|
-
?
|
|
596
|
-
:
|
|
595
|
+
? textColors.prompt.input.cancelled(this.maskCompleted(this.displayValue))
|
|
596
|
+
: bold(textColors.prompt.input.active(this.displayValue)); `
|
|
597
597
|
}),
|
|
598
598
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
599
599
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
@@ -616,7 +616,7 @@ function BasePromptDeclarations() {
|
|
|
616
616
|
type: "string"
|
|
617
617
|
}, {
|
|
618
618
|
name: "key",
|
|
619
|
-
type: "
|
|
619
|
+
type: "Key"
|
|
620
620
|
}],
|
|
621
621
|
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
622
622
|
if (!action) {
|
|
@@ -672,7 +672,7 @@ function BasePromptDeclarations() {
|
|
|
672
672
|
"protected": true,
|
|
673
673
|
parameters: [{
|
|
674
674
|
name: "key",
|
|
675
|
-
type: "
|
|
675
|
+
type: "Key"
|
|
676
676
|
}],
|
|
677
677
|
returnType: "string | false",
|
|
678
678
|
children: _alloy_js_core.code`if (key.meta && key.name !== "escape") {
|
|
@@ -842,21 +842,21 @@ function BasePromptDeclarations() {
|
|
|
842
842
|
|
|
843
843
|
this.consoleOutput = \` \${
|
|
844
844
|
this.isSubmitted
|
|
845
|
-
?
|
|
845
|
+
? textColors.prompt.icon.submitted("${theme.icons.prompt.submitted}")
|
|
846
846
|
: this.isCancelled
|
|
847
|
-
?
|
|
847
|
+
? textColors.prompt.icon.cancelled("${theme.icons.prompt.cancelled}")
|
|
848
848
|
: this.isError
|
|
849
|
-
?
|
|
850
|
-
:
|
|
849
|
+
? textColors.prompt.icon.error("${theme.icons.prompt.error}")
|
|
850
|
+
: textColors.prompt.icon.active("${theme.icons.prompt.active}")
|
|
851
851
|
} \${
|
|
852
852
|
this.isCompleted
|
|
853
|
-
?
|
|
854
|
-
:
|
|
853
|
+
? textColors.prompt.message.submitted(this.message)
|
|
854
|
+
: bold(textColors.prompt.message.active(this.message))
|
|
855
855
|
} \${
|
|
856
|
-
|
|
856
|
+
borderColors.app.divider.tertiary(
|
|
857
857
|
this.isCompleted
|
|
858
|
-
? (
|
|
859
|
-
: (
|
|
858
|
+
? (isWindows ? "..." : "…")
|
|
859
|
+
: (isWindows ? "»" : "›")
|
|
860
860
|
)
|
|
861
861
|
} \`;
|
|
862
862
|
this.consoleOutput += this.onRender();
|
|
@@ -879,7 +879,7 @@ function BasePromptDeclarations() {
|
|
|
879
879
|
type: "string"
|
|
880
880
|
}, {
|
|
881
881
|
name: "key",
|
|
882
|
-
type: "
|
|
882
|
+
type: "Key"
|
|
883
883
|
}],
|
|
884
884
|
children: _alloy_js_core.code`if (this.#isClosed) {
|
|
885
885
|
return;
|
|
@@ -1032,7 +1032,7 @@ function TextPromptDeclarations() {
|
|
|
1032
1032
|
type: "string"
|
|
1033
1033
|
}, {
|
|
1034
1034
|
name: "key",
|
|
1035
|
-
type: "
|
|
1035
|
+
type: "Key"
|
|
1036
1036
|
}],
|
|
1037
1037
|
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
1038
1038
|
if (action && typeof (this as any)[action] === "function") {
|
|
@@ -1139,14 +1139,14 @@ function TextPromptDeclarations() {
|
|
|
1139
1139
|
"protected": true,
|
|
1140
1140
|
returnType: "string",
|
|
1141
1141
|
children: _alloy_js_core.code`return this.isPlaceholder
|
|
1142
|
-
?
|
|
1142
|
+
? textColors.prompt.input.disabled(this.displayValue)
|
|
1143
1143
|
: this.#isInvalid
|
|
1144
|
-
?
|
|
1144
|
+
? textColors.prompt.input.error(this.displayValue)
|
|
1145
1145
|
: this.isSubmitted
|
|
1146
|
-
?
|
|
1146
|
+
? textColors.prompt.input.submitted(this.displayValue)
|
|
1147
1147
|
: this.isCancelled
|
|
1148
|
-
?
|
|
1149
|
-
:
|
|
1148
|
+
? textColors.prompt.input.cancelled(this.displayValue)
|
|
1149
|
+
: bold(textColors.prompt.input.active(this.displayValue)); `
|
|
1150
1150
|
})
|
|
1151
1151
|
];
|
|
1152
1152
|
}
|
|
@@ -1437,7 +1437,7 @@ function SelectPromptDeclarations() {
|
|
|
1437
1437
|
"protected": true,
|
|
1438
1438
|
parameters: [{
|
|
1439
1439
|
name: "key",
|
|
1440
|
-
type: "
|
|
1440
|
+
type: "Key"
|
|
1441
1441
|
}],
|
|
1442
1442
|
returnType: "string | false",
|
|
1443
1443
|
children: _alloy_js_core.code`let action = super.getAction(key);
|
|
@@ -1561,38 +1561,38 @@ function SelectPromptDeclarations() {
|
|
|
1561
1561
|
output += \`\${
|
|
1562
1562
|
this.options[index].disabled
|
|
1563
1563
|
? this.cursor === index
|
|
1564
|
-
?
|
|
1564
|
+
? bold(textColors.prompt.input.disabled(">"))
|
|
1565
1565
|
: index === startIndex
|
|
1566
|
-
?
|
|
1566
|
+
? borderColors.app.divider.tertiary("↑")
|
|
1567
1567
|
: index === endIndex - 1
|
|
1568
|
-
?
|
|
1568
|
+
? borderColors.app.divider.tertiary("↓")
|
|
1569
1569
|
: " "
|
|
1570
1570
|
: this.cursor === index
|
|
1571
|
-
?
|
|
1571
|
+
? bold(textColors.prompt.input.active(">"))
|
|
1572
1572
|
: index === startIndex
|
|
1573
|
-
?
|
|
1573
|
+
? borderColors.app.divider.tertiary("↑")
|
|
1574
1574
|
: index === endIndex - 1
|
|
1575
|
-
?
|
|
1575
|
+
? borderColors.app.divider.tertiary("↓")
|
|
1576
1576
|
: " "
|
|
1577
1577
|
} \${
|
|
1578
1578
|
this.options[index]!.disabled
|
|
1579
1579
|
? this.cursor === index
|
|
1580
|
-
?
|
|
1581
|
-
:
|
|
1580
|
+
? bold(textColors.prompt.input.disabled(this.options[index]!.icon ? underline(\`\${this.options[index]!.icon} \`) : ""))
|
|
1581
|
+
: strikethrough(textColors.prompt.input.disabled(this.options[index]!.icon ? \`\${this.options[index].icon} \` : ""))
|
|
1582
1582
|
: this.cursor === index
|
|
1583
|
-
?
|
|
1584
|
-
:
|
|
1583
|
+
? bold(textColors.prompt.input.active(this.options[index]!.icon ? underline(\`\${this.options[index]!.icon} \`) : ""))
|
|
1584
|
+
: textColors.prompt.input.inactive(this.options[index]!.icon ? \`\${this.options[index].icon} \` : "")
|
|
1585
1585
|
}\${
|
|
1586
1586
|
this.options[index]!.disabled
|
|
1587
1587
|
? this.cursor === index
|
|
1588
|
-
?
|
|
1589
|
-
:
|
|
1588
|
+
? bold(underline(textColors.prompt.input.disabled(this.options[index].label)))
|
|
1589
|
+
: strikethrough(textColors.prompt.input.disabled(this.options[index]!.label))
|
|
1590
1590
|
: this.cursor === index
|
|
1591
|
-
?
|
|
1592
|
-
:
|
|
1591
|
+
? bold(underline(textColors.prompt.input.active(this.options[index]!.label)))
|
|
1592
|
+
: textColors.prompt.input.inactive(this.options[index]!.label)
|
|
1593
1593
|
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon!.length + 1 : 0))}\${
|
|
1594
1594
|
this.options[index]!.description && this.cursor === index
|
|
1595
|
-
?
|
|
1595
|
+
? italic(textColors.prompt.description.active(this.options[index]!.description))
|
|
1596
1596
|
: ""
|
|
1597
1597
|
} \\n\`;
|
|
1598
1598
|
}
|
|
@@ -1838,7 +1838,7 @@ function NumericPromptDeclarations() {
|
|
|
1838
1838
|
type: "string"
|
|
1839
1839
|
}, {
|
|
1840
1840
|
name: "key",
|
|
1841
|
-
type: "
|
|
1841
|
+
type: "Key"
|
|
1842
1842
|
}],
|
|
1843
1843
|
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
1844
1844
|
if (action && typeof (this as any)[action] === "function") {
|
|
@@ -1982,14 +1982,14 @@ function NumericPromptDeclarations() {
|
|
|
1982
1982
|
"protected": true,
|
|
1983
1983
|
returnType: "string",
|
|
1984
1984
|
children: _alloy_js_core.code`return this.isPlaceholder
|
|
1985
|
-
?
|
|
1985
|
+
? textColors.prompt.input.disabled(this.displayValue)
|
|
1986
1986
|
: this.#isInvalid
|
|
1987
|
-
?
|
|
1987
|
+
? textColors.prompt.input.error(this.displayValue)
|
|
1988
1988
|
: this.isSubmitted
|
|
1989
|
-
?
|
|
1989
|
+
? textColors.prompt.input.submitted(this.displayValue)
|
|
1990
1990
|
: this.isCancelled
|
|
1991
|
-
?
|
|
1992
|
-
:
|
|
1991
|
+
? textColors.prompt.input.cancelled(this.displayValue)
|
|
1992
|
+
: bold(textColors.prompt.input.active(this.displayValue)); `
|
|
1993
1993
|
})
|
|
1994
1994
|
];
|
|
1995
1995
|
}
|
|
@@ -2168,7 +2168,7 @@ function TogglePromptDeclarations() {
|
|
|
2168
2168
|
type: "string"
|
|
2169
2169
|
}, {
|
|
2170
2170
|
name: "key",
|
|
2171
|
-
type: "
|
|
2171
|
+
type: "Key"
|
|
2172
2172
|
}],
|
|
2173
2173
|
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
2174
2174
|
if (action && typeof (this as any)[action] === "function") {
|
|
@@ -2238,13 +2238,13 @@ function TogglePromptDeclarations() {
|
|
|
2238
2238
|
"protected": true,
|
|
2239
2239
|
returnType: "string",
|
|
2240
2240
|
children: _alloy_js_core.code`return this.isSubmitted
|
|
2241
|
-
?
|
|
2241
|
+
? textColors.prompt.input.submitted(this.value ? this.trueMessage : this.falseMessage)
|
|
2242
2242
|
: this.isCancelled
|
|
2243
|
-
?
|
|
2243
|
+
? textColors.prompt.input.cancelled(this.value ? this.trueMessage : this.falseMessage)
|
|
2244
2244
|
: \`\${
|
|
2245
|
-
this.value ?
|
|
2246
|
-
} \${
|
|
2247
|
-
this.value ?
|
|
2245
|
+
this.value ? textColors.prompt.input.inactive(this.falseMessage) : underline(bold(textColors.prompt.input.active(this.falseMessage)))
|
|
2246
|
+
} \${borderColors.app.divider.tertiary("/")} \${
|
|
2247
|
+
this.value ? underline(bold(textColors.prompt.input.active(this.trueMessage))) : textColors.prompt.input.inactive(this.trueMessage)
|
|
2248
2248
|
}\`; `
|
|
2249
2249
|
})
|
|
2250
2250
|
];
|
|
@@ -2471,7 +2471,7 @@ function ConfirmPromptDeclarations() {
|
|
|
2471
2471
|
type: "string"
|
|
2472
2472
|
}, {
|
|
2473
2473
|
name: "key",
|
|
2474
|
-
type: "
|
|
2474
|
+
type: "Key"
|
|
2475
2475
|
}],
|
|
2476
2476
|
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
2477
2477
|
if (action && typeof (this as any)[action] === "function") {
|
|
@@ -2496,10 +2496,10 @@ function ConfirmPromptDeclarations() {
|
|
|
2496
2496
|
"protected": true,
|
|
2497
2497
|
returnType: "string",
|
|
2498
2498
|
children: _alloy_js_core.code`return this.isSubmitted
|
|
2499
|
-
?
|
|
2499
|
+
? textColors.prompt.input.submitted(this.value ? this.yesMessage : this.noMessage)
|
|
2500
2500
|
: this.isCancelled
|
|
2501
|
-
?
|
|
2502
|
-
:
|
|
2501
|
+
? textColors.prompt.input.cancelled(this.value ? this.yesMessage : this.noMessage)
|
|
2502
|
+
: textColors.prompt.input.inactive(this.initialValue ? this.yesOption : this.noOption); `
|
|
2503
2503
|
})
|
|
2504
2504
|
];
|
|
2505
2505
|
}
|
|
@@ -2684,7 +2684,12 @@ function PromptsBuiltin(props) {
|
|
|
2684
2684
|
get imports() {
|
|
2685
2685
|
return (0, defu.default)(rest.imports ?? {}, {
|
|
2686
2686
|
"node:events": "EventEmitter",
|
|
2687
|
-
"node:readline":
|
|
2687
|
+
"node:readline": [
|
|
2688
|
+
"Interface",
|
|
2689
|
+
"Key",
|
|
2690
|
+
"createInterface",
|
|
2691
|
+
"emitKeypressEvents"
|
|
2692
|
+
]
|
|
2688
2693
|
});
|
|
2689
2694
|
},
|
|
2690
2695
|
get builtinImports() {
|
|
@@ -2693,7 +2698,12 @@ function PromptsBuiltin(props) {
|
|
|
2693
2698
|
"erase",
|
|
2694
2699
|
"beep",
|
|
2695
2700
|
"cursor",
|
|
2696
|
-
"
|
|
2701
|
+
"textColors",
|
|
2702
|
+
"borderColors",
|
|
2703
|
+
"bold",
|
|
2704
|
+
"italic",
|
|
2705
|
+
"underline",
|
|
2706
|
+
"strikethrough",
|
|
2697
2707
|
"clear",
|
|
2698
2708
|
"stripAnsi",
|
|
2699
2709
|
"splitText"
|
|
@@ -224,7 +224,7 @@ function BasePromptDeclarations() {
|
|
|
224
224
|
createComponent(ClassField, {
|
|
225
225
|
name: "readline",
|
|
226
226
|
isPrivateMember: true,
|
|
227
|
-
type: "
|
|
227
|
+
type: "Interface"
|
|
228
228
|
}),
|
|
229
229
|
createIntrinsic("hbr", {}),
|
|
230
230
|
createComponent(ClassField, {
|
|
@@ -437,11 +437,11 @@ function BasePromptDeclarations() {
|
|
|
437
437
|
|
|
438
438
|
this.message = config.message;
|
|
439
439
|
|
|
440
|
-
this.#readline =
|
|
440
|
+
this.#readline = createInterface({
|
|
441
441
|
input: this.input,
|
|
442
442
|
escapeCodeTimeout: 50
|
|
443
443
|
});
|
|
444
|
-
|
|
444
|
+
emitKeypressEvents(this.input, this.#readline);
|
|
445
445
|
|
|
446
446
|
if (this.input.isTTY) {
|
|
447
447
|
this.input.setRawMode(true);
|
|
@@ -495,13 +495,13 @@ function BasePromptDeclarations() {
|
|
|
495
495
|
name: "status",
|
|
496
496
|
type: "string",
|
|
497
497
|
children: code`return this.isSubmitted ? "" : \` \\n \${
|
|
498
|
-
|
|
498
|
+
italic(
|
|
499
499
|
this.isError
|
|
500
|
-
?
|
|
500
|
+
? textColors.prompt.description.error(splitText(this.errorMessage, "3/4").join("\\n"))
|
|
501
501
|
: this.isCancelled
|
|
502
|
-
?
|
|
502
|
+
? textColors.prompt.description.cancelled(splitText("Input was cancelled by user", "3/4").join("\\n"))
|
|
503
503
|
: this.description
|
|
504
|
-
?
|
|
504
|
+
? textColors.prompt.description.active(splitText(this.description, "3/4").join("\\n"))
|
|
505
505
|
: ""
|
|
506
506
|
)
|
|
507
507
|
}\`; `
|
|
@@ -583,14 +583,14 @@ function BasePromptDeclarations() {
|
|
|
583
583
|
"protected": true,
|
|
584
584
|
returnType: "string",
|
|
585
585
|
children: code`return this.isPlaceholder
|
|
586
|
-
?
|
|
586
|
+
? textColors.prompt.input.disabled(this.displayValue)
|
|
587
587
|
: this.isError
|
|
588
|
-
?
|
|
588
|
+
? textColors.prompt.input.error(this.displayValue)
|
|
589
589
|
: this.isSubmitted
|
|
590
|
-
?
|
|
590
|
+
? textColors.prompt.input.submitted(this.maskCompleted(this.displayValue))
|
|
591
591
|
: this.isCancelled
|
|
592
|
-
?
|
|
593
|
-
:
|
|
592
|
+
? textColors.prompt.input.cancelled(this.maskCompleted(this.displayValue))
|
|
593
|
+
: bold(textColors.prompt.input.active(this.displayValue)); `
|
|
594
594
|
}),
|
|
595
595
|
createComponent(Spacing, {}),
|
|
596
596
|
createComponent(ClassMethod, {
|
|
@@ -613,7 +613,7 @@ function BasePromptDeclarations() {
|
|
|
613
613
|
type: "string"
|
|
614
614
|
}, {
|
|
615
615
|
name: "key",
|
|
616
|
-
type: "
|
|
616
|
+
type: "Key"
|
|
617
617
|
}],
|
|
618
618
|
children: code`const action = this.getAction(key);
|
|
619
619
|
if (!action) {
|
|
@@ -669,7 +669,7 @@ function BasePromptDeclarations() {
|
|
|
669
669
|
"protected": true,
|
|
670
670
|
parameters: [{
|
|
671
671
|
name: "key",
|
|
672
|
-
type: "
|
|
672
|
+
type: "Key"
|
|
673
673
|
}],
|
|
674
674
|
returnType: "string | false",
|
|
675
675
|
children: code`if (key.meta && key.name !== "escape") {
|
|
@@ -839,21 +839,21 @@ function BasePromptDeclarations() {
|
|
|
839
839
|
|
|
840
840
|
this.consoleOutput = \` \${
|
|
841
841
|
this.isSubmitted
|
|
842
|
-
?
|
|
842
|
+
? textColors.prompt.icon.submitted("${theme.icons.prompt.submitted}")
|
|
843
843
|
: this.isCancelled
|
|
844
|
-
?
|
|
844
|
+
? textColors.prompt.icon.cancelled("${theme.icons.prompt.cancelled}")
|
|
845
845
|
: this.isError
|
|
846
|
-
?
|
|
847
|
-
:
|
|
846
|
+
? textColors.prompt.icon.error("${theme.icons.prompt.error}")
|
|
847
|
+
: textColors.prompt.icon.active("${theme.icons.prompt.active}")
|
|
848
848
|
} \${
|
|
849
849
|
this.isCompleted
|
|
850
|
-
?
|
|
851
|
-
:
|
|
850
|
+
? textColors.prompt.message.submitted(this.message)
|
|
851
|
+
: bold(textColors.prompt.message.active(this.message))
|
|
852
852
|
} \${
|
|
853
|
-
|
|
853
|
+
borderColors.app.divider.tertiary(
|
|
854
854
|
this.isCompleted
|
|
855
|
-
? (
|
|
856
|
-
: (
|
|
855
|
+
? (isWindows ? "..." : "…")
|
|
856
|
+
: (isWindows ? "»" : "›")
|
|
857
857
|
)
|
|
858
858
|
} \`;
|
|
859
859
|
this.consoleOutput += this.onRender();
|
|
@@ -876,7 +876,7 @@ function BasePromptDeclarations() {
|
|
|
876
876
|
type: "string"
|
|
877
877
|
}, {
|
|
878
878
|
name: "key",
|
|
879
|
-
type: "
|
|
879
|
+
type: "Key"
|
|
880
880
|
}],
|
|
881
881
|
children: code`if (this.#isClosed) {
|
|
882
882
|
return;
|
|
@@ -1029,7 +1029,7 @@ function TextPromptDeclarations() {
|
|
|
1029
1029
|
type: "string"
|
|
1030
1030
|
}, {
|
|
1031
1031
|
name: "key",
|
|
1032
|
-
type: "
|
|
1032
|
+
type: "Key"
|
|
1033
1033
|
}],
|
|
1034
1034
|
children: code`const action = this.getAction(key);
|
|
1035
1035
|
if (action && typeof (this as any)[action] === "function") {
|
|
@@ -1136,14 +1136,14 @@ function TextPromptDeclarations() {
|
|
|
1136
1136
|
"protected": true,
|
|
1137
1137
|
returnType: "string",
|
|
1138
1138
|
children: code`return this.isPlaceholder
|
|
1139
|
-
?
|
|
1139
|
+
? textColors.prompt.input.disabled(this.displayValue)
|
|
1140
1140
|
: this.#isInvalid
|
|
1141
|
-
?
|
|
1141
|
+
? textColors.prompt.input.error(this.displayValue)
|
|
1142
1142
|
: this.isSubmitted
|
|
1143
|
-
?
|
|
1143
|
+
? textColors.prompt.input.submitted(this.displayValue)
|
|
1144
1144
|
: this.isCancelled
|
|
1145
|
-
?
|
|
1146
|
-
:
|
|
1145
|
+
? textColors.prompt.input.cancelled(this.displayValue)
|
|
1146
|
+
: bold(textColors.prompt.input.active(this.displayValue)); `
|
|
1147
1147
|
})
|
|
1148
1148
|
];
|
|
1149
1149
|
}
|
|
@@ -1434,7 +1434,7 @@ function SelectPromptDeclarations() {
|
|
|
1434
1434
|
"protected": true,
|
|
1435
1435
|
parameters: [{
|
|
1436
1436
|
name: "key",
|
|
1437
|
-
type: "
|
|
1437
|
+
type: "Key"
|
|
1438
1438
|
}],
|
|
1439
1439
|
returnType: "string | false",
|
|
1440
1440
|
children: code`let action = super.getAction(key);
|
|
@@ -1558,38 +1558,38 @@ function SelectPromptDeclarations() {
|
|
|
1558
1558
|
output += \`\${
|
|
1559
1559
|
this.options[index].disabled
|
|
1560
1560
|
? this.cursor === index
|
|
1561
|
-
?
|
|
1561
|
+
? bold(textColors.prompt.input.disabled(">"))
|
|
1562
1562
|
: index === startIndex
|
|
1563
|
-
?
|
|
1563
|
+
? borderColors.app.divider.tertiary("↑")
|
|
1564
1564
|
: index === endIndex - 1
|
|
1565
|
-
?
|
|
1565
|
+
? borderColors.app.divider.tertiary("↓")
|
|
1566
1566
|
: " "
|
|
1567
1567
|
: this.cursor === index
|
|
1568
|
-
?
|
|
1568
|
+
? bold(textColors.prompt.input.active(">"))
|
|
1569
1569
|
: index === startIndex
|
|
1570
|
-
?
|
|
1570
|
+
? borderColors.app.divider.tertiary("↑")
|
|
1571
1571
|
: index === endIndex - 1
|
|
1572
|
-
?
|
|
1572
|
+
? borderColors.app.divider.tertiary("↓")
|
|
1573
1573
|
: " "
|
|
1574
1574
|
} \${
|
|
1575
1575
|
this.options[index]!.disabled
|
|
1576
1576
|
? this.cursor === index
|
|
1577
|
-
?
|
|
1578
|
-
:
|
|
1577
|
+
? bold(textColors.prompt.input.disabled(this.options[index]!.icon ? underline(\`\${this.options[index]!.icon} \`) : ""))
|
|
1578
|
+
: strikethrough(textColors.prompt.input.disabled(this.options[index]!.icon ? \`\${this.options[index].icon} \` : ""))
|
|
1579
1579
|
: this.cursor === index
|
|
1580
|
-
?
|
|
1581
|
-
:
|
|
1580
|
+
? bold(textColors.prompt.input.active(this.options[index]!.icon ? underline(\`\${this.options[index]!.icon} \`) : ""))
|
|
1581
|
+
: textColors.prompt.input.inactive(this.options[index]!.icon ? \`\${this.options[index].icon} \` : "")
|
|
1582
1582
|
}\${
|
|
1583
1583
|
this.options[index]!.disabled
|
|
1584
1584
|
? this.cursor === index
|
|
1585
|
-
?
|
|
1586
|
-
:
|
|
1585
|
+
? bold(underline(textColors.prompt.input.disabled(this.options[index].label)))
|
|
1586
|
+
: strikethrough(textColors.prompt.input.disabled(this.options[index]!.label))
|
|
1587
1587
|
: this.cursor === index
|
|
1588
|
-
?
|
|
1589
|
-
:
|
|
1588
|
+
? bold(underline(textColors.prompt.input.active(this.options[index]!.label)))
|
|
1589
|
+
: textColors.prompt.input.inactive(this.options[index]!.label)
|
|
1590
1590
|
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon!.length + 1 : 0))}\${
|
|
1591
1591
|
this.options[index]!.description && this.cursor === index
|
|
1592
|
-
?
|
|
1592
|
+
? italic(textColors.prompt.description.active(this.options[index]!.description))
|
|
1593
1593
|
: ""
|
|
1594
1594
|
} \\n\`;
|
|
1595
1595
|
}
|
|
@@ -1835,7 +1835,7 @@ function NumericPromptDeclarations() {
|
|
|
1835
1835
|
type: "string"
|
|
1836
1836
|
}, {
|
|
1837
1837
|
name: "key",
|
|
1838
|
-
type: "
|
|
1838
|
+
type: "Key"
|
|
1839
1839
|
}],
|
|
1840
1840
|
children: code`const action = this.getAction(key);
|
|
1841
1841
|
if (action && typeof (this as any)[action] === "function") {
|
|
@@ -1979,14 +1979,14 @@ function NumericPromptDeclarations() {
|
|
|
1979
1979
|
"protected": true,
|
|
1980
1980
|
returnType: "string",
|
|
1981
1981
|
children: code`return this.isPlaceholder
|
|
1982
|
-
?
|
|
1982
|
+
? textColors.prompt.input.disabled(this.displayValue)
|
|
1983
1983
|
: this.#isInvalid
|
|
1984
|
-
?
|
|
1984
|
+
? textColors.prompt.input.error(this.displayValue)
|
|
1985
1985
|
: this.isSubmitted
|
|
1986
|
-
?
|
|
1986
|
+
? textColors.prompt.input.submitted(this.displayValue)
|
|
1987
1987
|
: this.isCancelled
|
|
1988
|
-
?
|
|
1989
|
-
:
|
|
1988
|
+
? textColors.prompt.input.cancelled(this.displayValue)
|
|
1989
|
+
: bold(textColors.prompt.input.active(this.displayValue)); `
|
|
1990
1990
|
})
|
|
1991
1991
|
];
|
|
1992
1992
|
}
|
|
@@ -2165,7 +2165,7 @@ function TogglePromptDeclarations() {
|
|
|
2165
2165
|
type: "string"
|
|
2166
2166
|
}, {
|
|
2167
2167
|
name: "key",
|
|
2168
|
-
type: "
|
|
2168
|
+
type: "Key"
|
|
2169
2169
|
}],
|
|
2170
2170
|
children: code`const action = this.getAction(key);
|
|
2171
2171
|
if (action && typeof (this as any)[action] === "function") {
|
|
@@ -2235,13 +2235,13 @@ function TogglePromptDeclarations() {
|
|
|
2235
2235
|
"protected": true,
|
|
2236
2236
|
returnType: "string",
|
|
2237
2237
|
children: code`return this.isSubmitted
|
|
2238
|
-
?
|
|
2238
|
+
? textColors.prompt.input.submitted(this.value ? this.trueMessage : this.falseMessage)
|
|
2239
2239
|
: this.isCancelled
|
|
2240
|
-
?
|
|
2240
|
+
? textColors.prompt.input.cancelled(this.value ? this.trueMessage : this.falseMessage)
|
|
2241
2241
|
: \`\${
|
|
2242
|
-
this.value ?
|
|
2243
|
-
} \${
|
|
2244
|
-
this.value ?
|
|
2242
|
+
this.value ? textColors.prompt.input.inactive(this.falseMessage) : underline(bold(textColors.prompt.input.active(this.falseMessage)))
|
|
2243
|
+
} \${borderColors.app.divider.tertiary("/")} \${
|
|
2244
|
+
this.value ? underline(bold(textColors.prompt.input.active(this.trueMessage))) : textColors.prompt.input.inactive(this.trueMessage)
|
|
2245
2245
|
}\`; `
|
|
2246
2246
|
})
|
|
2247
2247
|
];
|
|
@@ -2468,7 +2468,7 @@ function ConfirmPromptDeclarations() {
|
|
|
2468
2468
|
type: "string"
|
|
2469
2469
|
}, {
|
|
2470
2470
|
name: "key",
|
|
2471
|
-
type: "
|
|
2471
|
+
type: "Key"
|
|
2472
2472
|
}],
|
|
2473
2473
|
children: code`const action = this.getAction(key);
|
|
2474
2474
|
if (action && typeof (this as any)[action] === "function") {
|
|
@@ -2493,10 +2493,10 @@ function ConfirmPromptDeclarations() {
|
|
|
2493
2493
|
"protected": true,
|
|
2494
2494
|
returnType: "string",
|
|
2495
2495
|
children: code`return this.isSubmitted
|
|
2496
|
-
?
|
|
2496
|
+
? textColors.prompt.input.submitted(this.value ? this.yesMessage : this.noMessage)
|
|
2497
2497
|
: this.isCancelled
|
|
2498
|
-
?
|
|
2499
|
-
:
|
|
2498
|
+
? textColors.prompt.input.cancelled(this.value ? this.yesMessage : this.noMessage)
|
|
2499
|
+
: textColors.prompt.input.inactive(this.initialValue ? this.yesOption : this.noOption); `
|
|
2500
2500
|
})
|
|
2501
2501
|
];
|
|
2502
2502
|
}
|
|
@@ -2681,7 +2681,12 @@ function PromptsBuiltin(props) {
|
|
|
2681
2681
|
get imports() {
|
|
2682
2682
|
return defu(rest.imports ?? {}, {
|
|
2683
2683
|
"node:events": "EventEmitter",
|
|
2684
|
-
"node:readline":
|
|
2684
|
+
"node:readline": [
|
|
2685
|
+
"Interface",
|
|
2686
|
+
"Key",
|
|
2687
|
+
"createInterface",
|
|
2688
|
+
"emitKeypressEvents"
|
|
2689
|
+
]
|
|
2685
2690
|
});
|
|
2686
2691
|
},
|
|
2687
2692
|
get builtinImports() {
|
|
@@ -2690,7 +2695,12 @@ function PromptsBuiltin(props) {
|
|
|
2690
2695
|
"erase",
|
|
2691
2696
|
"beep",
|
|
2692
2697
|
"cursor",
|
|
2693
|
-
"
|
|
2698
|
+
"textColors",
|
|
2699
|
+
"borderColors",
|
|
2700
|
+
"bold",
|
|
2701
|
+
"italic",
|
|
2702
|
+
"underline",
|
|
2703
|
+
"strikethrough",
|
|
2694
2704
|
"clear",
|
|
2695
2705
|
"stripAnsi",
|
|
2696
2706
|
"splitText"
|