@shell-shock/preset-cli 0.4.0 → 0.4.2
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/README.md +1 -1
- package/dist/components/banner-function-declaration.cjs +1 -1
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.cts.map +1 -1
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +1 -1
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +18 -11
- package/dist/components/command-entry.d.cts +2 -2
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +2 -2
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +18 -11
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.d.cts +3 -3
- package/dist/components/command-router.d.mts +3 -3
- package/dist/components/prompts-builtin.cjs +71 -68
- package/dist/components/prompts-builtin.d.cts +8 -8
- package/dist/components/prompts-builtin.d.cts.map +1 -1
- package/dist/components/prompts-builtin.d.mts +8 -8
- package/dist/components/prompts-builtin.d.mts.map +1 -1
- package/dist/components/prompts-builtin.mjs +71 -68
- package/dist/components/prompts-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.d.cts +2 -2
- package/dist/components/virtual-command-entry.d.mts +2 -2
- package/package.json +9 -9
|
@@ -84,35 +84,6 @@ function BasePromptDeclarations() {
|
|
|
84
84
|
returnType: "string",
|
|
85
85
|
children: __alloy_js_core.code`return " ".repeat(input.length); `
|
|
86
86
|
}),
|
|
87
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
88
|
-
__alloy_js_core.code`
|
|
89
|
-
const DEFAULT_ICONS = process.platform === "win32" ? {
|
|
90
|
-
arrowUp: "↑",
|
|
91
|
-
arrowDown: "↓",
|
|
92
|
-
arrowLeft: "←",
|
|
93
|
-
arrowRight: "→",
|
|
94
|
-
radioOn: "(*)",
|
|
95
|
-
radioOff: "( )",
|
|
96
|
-
tick: "√",
|
|
97
|
-
cross: "×",
|
|
98
|
-
ellipsis: "...",
|
|
99
|
-
pointerSmall: "»",
|
|
100
|
-
line: "─",
|
|
101
|
-
pointer: ">"
|
|
102
|
-
} : {
|
|
103
|
-
arrowUp: "↑",
|
|
104
|
-
arrowDown: "↓",
|
|
105
|
-
arrowLeft: "←",
|
|
106
|
-
arrowRight: "→",
|
|
107
|
-
radioOn: "◉",
|
|
108
|
-
radioOff: "◯",
|
|
109
|
-
tick: "✔",
|
|
110
|
-
cross: "✖",
|
|
111
|
-
ellipsis: "…",
|
|
112
|
-
pointerSmall: "›",
|
|
113
|
-
line: "─",
|
|
114
|
-
pointer: "❯"
|
|
115
|
-
}; `,
|
|
116
87
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
117
88
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
118
89
|
"export": true,
|
|
@@ -211,7 +182,7 @@ function BasePromptDeclarations() {
|
|
|
211
182
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
212
183
|
name: "validate",
|
|
213
184
|
optional: true,
|
|
214
|
-
type: "(value: TValue) => boolean | string | Promise<boolean | string>",
|
|
185
|
+
type: "(value: TValue) => boolean | string | null | undefined | Promise<boolean | string | null | undefined>",
|
|
215
186
|
doc: "A validation function that returns true if the input is valid, false or a string error message if the input is invalid"
|
|
216
187
|
}),
|
|
217
188
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -371,7 +342,7 @@ function BasePromptDeclarations() {
|
|
|
371
342
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
372
343
|
name: "validator",
|
|
373
344
|
"protected": true,
|
|
374
|
-
type: "(value: TValue) => boolean | string | Promise<boolean | string>",
|
|
345
|
+
type: "(value: TValue) => boolean | string | null | undefined | Promise<boolean | string | null | undefined>",
|
|
375
346
|
children: __alloy_js_core.code`() => true; `
|
|
376
347
|
}),
|
|
377
348
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
@@ -490,12 +461,12 @@ function BasePromptDeclarations() {
|
|
|
490
461
|
"protected": true,
|
|
491
462
|
name: "status",
|
|
492
463
|
type: "string",
|
|
493
|
-
children: __alloy_js_core.code`return this.
|
|
464
|
+
children: __alloy_js_core.code`return this.isCompleted ? "" : \` \\n \${
|
|
494
465
|
colors.italic(
|
|
495
466
|
this.isError
|
|
496
|
-
? colors.text.prompt.description.error(splitText(this.errorMessage, "
|
|
497
|
-
: this.
|
|
498
|
-
? colors.text.prompt.description.active(this.description)
|
|
467
|
+
? colors.text.prompt.description.error(splitText(this.errorMessage, "3/4").join("\\n"))
|
|
468
|
+
: this.description
|
|
469
|
+
? colors.text.prompt.description.active(splitText(this.description, "3/4").join("\\n"))
|
|
499
470
|
: ""
|
|
500
471
|
)
|
|
501
472
|
}\`; `
|
|
@@ -519,8 +490,7 @@ function BasePromptDeclarations() {
|
|
|
519
490
|
this.displayValue = this.formatter(updatedValue);
|
|
520
491
|
this.#value = updatedValue;
|
|
521
492
|
setTimeout(() => {
|
|
522
|
-
this.validate(updatedValue);
|
|
523
|
-
this.sync();
|
|
493
|
+
Promise.resolve(this.validate(updatedValue)).then(() => this.sync());
|
|
524
494
|
}, 0);
|
|
525
495
|
|
|
526
496
|
this.sync(); `
|
|
@@ -605,12 +575,12 @@ function BasePromptDeclarations() {
|
|
|
605
575
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
606
576
|
doc: "A method to validate the prompt input using the provided validator function, which updates the error message and error state based on the validation result. This method is called whenever the prompt value changes and needs to be validated.",
|
|
607
577
|
name: "validate",
|
|
578
|
+
async: true,
|
|
608
579
|
"protected": true,
|
|
609
580
|
parameters: [{
|
|
610
581
|
name: "value",
|
|
611
582
|
type: "TValue"
|
|
612
583
|
}],
|
|
613
|
-
async: true,
|
|
614
584
|
children: __alloy_js_core.code`let result = await this.validator(value);
|
|
615
585
|
if (typeof result === "string") {
|
|
616
586
|
this.errorMessage = result;
|
|
@@ -815,20 +785,27 @@ function BasePromptDeclarations() {
|
|
|
815
785
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
816
786
|
"export": true,
|
|
817
787
|
name: "CANCEL_SYMBOL",
|
|
818
|
-
doc: "A unique symbol used to indicate that a prompt was cancelled, which can be returned from a prompt
|
|
788
|
+
doc: "A unique symbol used to indicate that a prompt was cancelled, which can be returned from a prompt function to signal that the prompt interaction should be cancelled and any pending promises should be rejected with this symbol. This allows for a consistent way to handle prompt cancellations across different prompt types and interactions.",
|
|
819
789
|
children: __alloy_js_core.code`Symbol("shell-shock:prompts:cancel"); `
|
|
820
790
|
}),
|
|
821
791
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
792
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
793
|
+
heading: "A utility function to check if a given value is the {@link CANCEL_SYMBOL | cancel symbol}, which can be used to determine if a prompt interaction was cancelled based on the value returned from a prompt factory function. This function checks if the provided value is strictly equal to the {@link CANCEL_SYMBOL | CANCEL_SYMBOL}, allowing for a consistent way to handle prompt cancellations across different prompt types and interactions.",
|
|
794
|
+
get children() {
|
|
795
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
796
|
+
name: "value",
|
|
797
|
+
children: `The value to check.`
|
|
798
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A boolean indicating whether the provided value is the {@link CANCEL_SYMBOL | cancel symbol}, which can be used to determine if a prompt interaction was cancelled.` })];
|
|
799
|
+
}
|
|
800
|
+
}),
|
|
822
801
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
823
802
|
name: "isCancel",
|
|
824
803
|
"export": true,
|
|
825
|
-
doc: "Checks if a given value is a {@link CANCEL_SYMBOL | cancel symbol}.",
|
|
826
804
|
parameters: [{
|
|
827
805
|
name: "value",
|
|
828
|
-
type: "any"
|
|
829
|
-
doc: "The value to check"
|
|
806
|
+
type: "any"
|
|
830
807
|
}],
|
|
831
|
-
returnType: "
|
|
808
|
+
returnType: "value is typeof CANCEL_SYMBOL",
|
|
832
809
|
children: __alloy_js_core.code`return value === CANCEL_SYMBOL; `
|
|
833
810
|
})
|
|
834
811
|
];
|
|
@@ -877,6 +854,7 @@ function TextPromptDeclarations() {
|
|
|
877
854
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
878
855
|
name: "initialValue",
|
|
879
856
|
"protected": true,
|
|
857
|
+
override: true,
|
|
880
858
|
type: "string",
|
|
881
859
|
children: __alloy_js_core.code`""; `
|
|
882
860
|
}),
|
|
@@ -1110,7 +1088,7 @@ function TextPromptDeclarations() {
|
|
|
1110
1088
|
get children() {
|
|
1111
1089
|
return [
|
|
1112
1090
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: __alloy_js_core.code`This function can be used to easily create and run a text prompt without needing to manually create an instance of the TextPrompt class and handle its events. The function accepts a configuration object that extends the base PromptFactoryConfig with additional options specific to text prompts, such as the initial value and mask function. The returned promise allows for easy handling of the prompt result using async/await syntax or traditional promise chaining.` }),
|
|
1113
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { text, isCancel } from "shell-shock
|
|
1091
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { text, isCancel } from "shell-shock:prompts";
|
|
1114
1092
|
|
|
1115
1093
|
async function run() {
|
|
1116
1094
|
const name = await text({
|
|
@@ -1162,6 +1140,10 @@ function SelectPromptDeclarations() {
|
|
|
1162
1140
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1163
1141
|
name: "PromptOptionConfig",
|
|
1164
1142
|
doc: "Configuration for an option the user can select from the select prompt",
|
|
1143
|
+
typeParameters: [{
|
|
1144
|
+
name: "TValue",
|
|
1145
|
+
default: "string"
|
|
1146
|
+
}],
|
|
1165
1147
|
get children() {
|
|
1166
1148
|
return [
|
|
1167
1149
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
@@ -1180,7 +1162,7 @@ function SelectPromptDeclarations() {
|
|
|
1180
1162
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1181
1163
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1182
1164
|
name: "value",
|
|
1183
|
-
type: "
|
|
1165
|
+
type: "TValue",
|
|
1184
1166
|
doc: "The value of the option"
|
|
1185
1167
|
}),
|
|
1186
1168
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -1211,10 +1193,19 @@ function SelectPromptDeclarations() {
|
|
|
1211
1193
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1212
1194
|
"export": true,
|
|
1213
1195
|
name: "PromptOption",
|
|
1214
|
-
"extends": "PromptOptionConfig",
|
|
1196
|
+
"extends": "PromptOptionConfig<TValue>",
|
|
1215
1197
|
doc: "An option the user can select from the select prompt",
|
|
1198
|
+
typeParameters: [{
|
|
1199
|
+
name: "TValue",
|
|
1200
|
+
default: "string"
|
|
1201
|
+
}],
|
|
1216
1202
|
get children() {
|
|
1217
1203
|
return [
|
|
1204
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1205
|
+
name: "label",
|
|
1206
|
+
type: "string",
|
|
1207
|
+
doc: "The message label for the option"
|
|
1208
|
+
}),
|
|
1218
1209
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1219
1210
|
name: "index",
|
|
1220
1211
|
type: "number",
|
|
@@ -1238,8 +1229,12 @@ function SelectPromptDeclarations() {
|
|
|
1238
1229
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1239
1230
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1240
1231
|
name: "SelectPromptConfig",
|
|
1241
|
-
"extends": "PromptConfig<
|
|
1232
|
+
"extends": "PromptConfig<TValue>",
|
|
1242
1233
|
doc: "An options object for configuring a select prompt",
|
|
1234
|
+
typeParameters: [{
|
|
1235
|
+
name: "TValue",
|
|
1236
|
+
default: "string"
|
|
1237
|
+
}],
|
|
1243
1238
|
get children() {
|
|
1244
1239
|
return [
|
|
1245
1240
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
@@ -1251,7 +1246,7 @@ function SelectPromptDeclarations() {
|
|
|
1251
1246
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1252
1247
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1253
1248
|
name: "options",
|
|
1254
|
-
type: "Array<string | PromptOptionConfig
|
|
1249
|
+
type: "Array<string | PromptOptionConfig<TValue>>",
|
|
1255
1250
|
doc: "The options available for the select prompt"
|
|
1256
1251
|
}),
|
|
1257
1252
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -1271,13 +1266,14 @@ function SelectPromptDeclarations() {
|
|
|
1271
1266
|
"extends": "Prompt<TValue>",
|
|
1272
1267
|
typeParameters: [{
|
|
1273
1268
|
name: "TValue",
|
|
1274
|
-
default: "
|
|
1269
|
+
default: "string"
|
|
1275
1270
|
}],
|
|
1276
1271
|
get children() {
|
|
1277
1272
|
return [
|
|
1278
1273
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1279
1274
|
name: "initialValue",
|
|
1280
1275
|
"protected": true,
|
|
1276
|
+
override: true,
|
|
1281
1277
|
type: "TValue"
|
|
1282
1278
|
}),
|
|
1283
1279
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
@@ -1291,47 +1287,48 @@ function SelectPromptDeclarations() {
|
|
|
1291
1287
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1292
1288
|
name: "options",
|
|
1293
1289
|
"protected": true,
|
|
1294
|
-
type: "PromptOption[]",
|
|
1290
|
+
type: "PromptOption<TValue>[]",
|
|
1295
1291
|
children: __alloy_js_core.code`[]; `
|
|
1296
1292
|
}),
|
|
1297
1293
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1298
|
-
__alloy_js_core.code`constructor(config: SelectPromptConfig) {
|
|
1294
|
+
__alloy_js_core.code`constructor(config: SelectPromptConfig<TValue>) {
|
|
1299
1295
|
super(config);
|
|
1300
1296
|
|
|
1301
1297
|
if (config.initialValue) {
|
|
1302
|
-
this.initialValue = config.initialValue;
|
|
1298
|
+
this.initialValue = config.initialValue as TValue;
|
|
1299
|
+
} else {
|
|
1300
|
+
this.initialValue = undefined as unknown as TValue;
|
|
1303
1301
|
}
|
|
1304
1302
|
|
|
1305
|
-
this.options = config.options.map(opt => {
|
|
1306
|
-
let option
|
|
1303
|
+
this.options = config.options.map((opt, index) => {
|
|
1304
|
+
let option = {} as Partial<PromptOption<TValue>>;
|
|
1307
1305
|
if (typeof opt === "string") {
|
|
1308
|
-
option = {
|
|
1306
|
+
option = { label: opt, value: opt as TValue, selected: false, disabled: false };
|
|
1309
1307
|
} else if (typeof opt === "object") {
|
|
1310
|
-
option = opt
|
|
1308
|
+
option = opt;
|
|
1311
1309
|
} else {
|
|
1312
1310
|
throw new Error(\`Invalid option provided to SelectPrompt at index #\${index}\`);
|
|
1313
1311
|
}
|
|
1314
1312
|
|
|
1315
1313
|
return {
|
|
1316
|
-
label: String(option.value),
|
|
1314
|
+
label: String(option.value) || "",
|
|
1317
1315
|
...option,
|
|
1318
|
-
index: -1,
|
|
1319
1316
|
description: option.description,
|
|
1320
1317
|
selected: !!option.selected || (this.initialValue !== undefined && option.value === this.initialValue),
|
|
1321
1318
|
disabled: !!option.disabled
|
|
1322
|
-
}
|
|
1319
|
+
} as PromptOption<TValue>;
|
|
1323
1320
|
}).sort((a, b) => a.label.localeCompare(b.label)).map((option, index) => ({ ...option, index }));
|
|
1324
1321
|
|
|
1325
1322
|
const selected = this.options.findIndex(option => option.selected);
|
|
1326
1323
|
if (selected > -1) {
|
|
1327
1324
|
this.cursor = selected;
|
|
1328
1325
|
if (this.options[this.cursor]) {
|
|
1329
|
-
this.initialValue = this.options[this.cursor].value;
|
|
1326
|
+
this.initialValue = this.options[this.cursor].value as TValue;
|
|
1330
1327
|
}
|
|
1331
1328
|
}
|
|
1332
1329
|
|
|
1333
1330
|
if (this.initialValue === undefined && this.options.length > 0 && this.options[0]) {
|
|
1334
|
-
this.initialValue = this.options[0].value;
|
|
1331
|
+
this.initialValue = this.options[0].value as TValue;
|
|
1335
1332
|
}
|
|
1336
1333
|
|
|
1337
1334
|
if (config.optionsPerPage) {
|
|
@@ -1344,9 +1341,9 @@ function SelectPromptDeclarations() {
|
|
|
1344
1341
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
1345
1342
|
doc: "Returns the currently selected option",
|
|
1346
1343
|
name: "selectedOption",
|
|
1347
|
-
type: "PromptOption | null",
|
|
1344
|
+
type: "PromptOption<TValue> | null",
|
|
1348
1345
|
"protected": true,
|
|
1349
|
-
children: __alloy_js_core.code`return this.options
|
|
1346
|
+
children: __alloy_js_core.code`return this.options.find(option => option.selected) ?? null; `
|
|
1350
1347
|
}),
|
|
1351
1348
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1352
1349
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
@@ -1465,6 +1462,7 @@ function SelectPromptDeclarations() {
|
|
|
1465
1462
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1466
1463
|
doc: "A method to render the prompt",
|
|
1467
1464
|
name: "render",
|
|
1465
|
+
override: true,
|
|
1468
1466
|
"protected": true,
|
|
1469
1467
|
children: __alloy_js_core.code`if (this.isInitial) {
|
|
1470
1468
|
this.output.write(cursor.hide);
|
|
@@ -1511,7 +1509,7 @@ function SelectPromptDeclarations() {
|
|
|
1511
1509
|
: this.cursor === index
|
|
1512
1510
|
? colors.bold(colors.underline(colors.text.prompt.input.active(this.options[index]!.label)))
|
|
1513
1511
|
: colors.text.prompt.input.inactive(this.options[index]!.label)
|
|
1514
|
-
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon
|
|
1512
|
+
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon!.length + 1 : 0))}\${
|
|
1515
1513
|
this.options[index]!.description && this.cursor === index
|
|
1516
1514
|
? colors.italic(colors.text.prompt.description.active(this.options[index]!.description))
|
|
1517
1515
|
: ""
|
|
@@ -1544,7 +1542,7 @@ function SelectPromptDeclarations() {
|
|
|
1544
1542
|
heading: "A function to create and run a select prompt, which returns a promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled.",
|
|
1545
1543
|
get children() {
|
|
1546
1544
|
return [
|
|
1547
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { select, isCancel } from "shell-shock
|
|
1545
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { select, isCancel } from "shell-shock:prompts";
|
|
1548
1546
|
|
|
1549
1547
|
async function run() {
|
|
1550
1548
|
const color = await select({
|
|
@@ -1652,6 +1650,7 @@ function NumericPromptDeclarations() {
|
|
|
1652
1650
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1653
1651
|
name: "initialValue",
|
|
1654
1652
|
"protected": true,
|
|
1653
|
+
override: true,
|
|
1655
1654
|
type: "number",
|
|
1656
1655
|
children: __alloy_js_core.code`0; `
|
|
1657
1656
|
}),
|
|
@@ -1746,6 +1745,7 @@ function NumericPromptDeclarations() {
|
|
|
1746
1745
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1747
1746
|
doc: "A method to reset the prompt input",
|
|
1748
1747
|
name: "reset",
|
|
1748
|
+
override: true,
|
|
1749
1749
|
"protected": true,
|
|
1750
1750
|
children: __alloy_js_core.code`super.reset();
|
|
1751
1751
|
this.currentInput = "";
|
|
@@ -1763,6 +1763,7 @@ function NumericPromptDeclarations() {
|
|
|
1763
1763
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1764
1764
|
doc: "A method to handle keypress events and determine the corresponding action",
|
|
1765
1765
|
name: "keypress",
|
|
1766
|
+
override: true,
|
|
1766
1767
|
"protected": true,
|
|
1767
1768
|
parameters: [{
|
|
1768
1769
|
name: "char",
|
|
@@ -1872,7 +1873,7 @@ function NumericPromptDeclarations() {
|
|
|
1872
1873
|
heading: "A function to create and run a numeric prompt, which returns a promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled.",
|
|
1873
1874
|
get children() {
|
|
1874
1875
|
return [
|
|
1875
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { numeric, isCancel } from "shell-shock
|
|
1876
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { numeric, isCancel } from "shell-shock:prompts";
|
|
1876
1877
|
|
|
1877
1878
|
async function run() {
|
|
1878
1879
|
const age = await numeric({
|
|
@@ -1956,6 +1957,7 @@ function TogglePromptDeclarations() {
|
|
|
1956
1957
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1957
1958
|
name: "initialValue",
|
|
1958
1959
|
"protected": true,
|
|
1960
|
+
override: true,
|
|
1959
1961
|
type: "boolean",
|
|
1960
1962
|
children: __alloy_js_core.code`false; `
|
|
1961
1963
|
}),
|
|
@@ -2018,6 +2020,7 @@ function TogglePromptDeclarations() {
|
|
|
2018
2020
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2019
2021
|
doc: "A method to handle keypress events and determine the corresponding action",
|
|
2020
2022
|
name: "keypress",
|
|
2023
|
+
override: true,
|
|
2021
2024
|
"protected": true,
|
|
2022
2025
|
parameters: [{
|
|
2023
2026
|
name: "char",
|
|
@@ -2101,7 +2104,7 @@ function TogglePromptDeclarations() {
|
|
|
2101
2104
|
heading: "A function to create and run a toggle prompt, which returns a promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled.",
|
|
2102
2105
|
get children() {
|
|
2103
2106
|
return [
|
|
2104
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { toggle, isCancel } from "shell-shock
|
|
2107
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { toggle, isCancel } from "shell-shock:prompts";
|
|
2105
2108
|
|
|
2106
2109
|
async function run() {
|
|
2107
2110
|
const likesIceCream = await toggle({
|
|
@@ -2173,7 +2176,7 @@ function PasswordPromptDeclaration() {
|
|
|
2173
2176
|
return [
|
|
2174
2177
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: __alloy_js_core.code`This function creates an instance of the TextPrompt class with the provided configuration options and a custom mask function to handle password input. It sets up event listeners for state updates, submission, and cancellation to handle the prompt interactions and return the appropriate results. The password prompt allows users to input text that is masked for privacy, making it suitable for scenarios like entering passwords or sensitive information.` }),
|
|
2175
2178
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2176
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { password, isCancel } from "shell-shock
|
|
2179
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { password, isCancel } from "shell-shock:prompts";
|
|
2177
2180
|
|
|
2178
2181
|
async function run() {
|
|
2179
2182
|
const userPassword = await password({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/prompts-builtin.d.ts
|
|
@@ -6,31 +6,31 @@ interface PromptsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description
|
|
|
6
6
|
/**
|
|
7
7
|
* A component that generates TypeScript declarations for built-in prompt types and related utilities, such as the base Prompt class, specific prompt types like TextPrompt and SelectPrompt, and utility functions for handling prompt cancellations. This component serves as a central place to define the types and interfaces for prompts used in the Shell Shock CLI, providing a consistent API for creating and managing prompts throughout the application.
|
|
8
8
|
*/
|
|
9
|
-
declare function BasePromptDeclarations():
|
|
9
|
+
declare function BasePromptDeclarations(): _alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Declarations for a text-based prompt that allows users to input and edit text, with support for cursor movement, deletion, and custom masking. This prompt type can be used for various text input scenarios, such as entering a username, password, or any other string input. The TextPrompt class extends the base Prompt class and implements specific logic for handling text input and editing interactions.
|
|
12
12
|
*/
|
|
13
|
-
declare function TextPromptDeclarations():
|
|
13
|
+
declare function TextPromptDeclarations(): _alloy_js_core0.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Declarations for a select prompt that allows users to choose from a list of options, with support for pagination, option descriptions, and disabled options. This prompt type can be used for scenarios where the user needs to select one option from a predefined list, such as choosing a color, selecting a file, or picking an item from a menu. The SelectPrompt class extends the base Prompt class and implements specific logic for handling option selection and navigation interactions.
|
|
16
16
|
*/
|
|
17
|
-
declare function SelectPromptDeclarations():
|
|
17
|
+
declare function SelectPromptDeclarations(): _alloy_js_core0.Children;
|
|
18
18
|
/**
|
|
19
19
|
* A component that renders the declarations for the built-in numeric prompt, which allows users to input and select numeric values with various configuration options such as floating point support, precision, increment, and min/max values.
|
|
20
20
|
*/
|
|
21
|
-
declare function NumericPromptDeclarations():
|
|
21
|
+
declare function NumericPromptDeclarations(): _alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* A component that renders the declarations for the built-in toggle prompt, which allows users to select a boolean value (true/false) with support for custom messages for the true and false states. This prompt type can be used for scenarios where the user needs to toggle a setting on or off, such as enabling or disabling a feature. The TogglePrompt class extends the base Prompt class and implements specific logic for handling boolean input and rendering interactions.
|
|
24
24
|
*/
|
|
25
|
-
declare function TogglePromptDeclarations():
|
|
25
|
+
declare function TogglePromptDeclarations(): _alloy_js_core0.Children;
|
|
26
26
|
/**
|
|
27
27
|
* Declarations for a password prompt that allows users to input and edit text, with support for cursor movement, deletion, and custom masking. This prompt type can be used for various text input scenarios, such as entering a password or any other string input. The PasswordPrompt class extends the base Prompt class and implements specific logic for handling password input and editing interactions.
|
|
28
28
|
*/
|
|
29
|
-
declare function PasswordPromptDeclaration():
|
|
29
|
+
declare function PasswordPromptDeclaration(): _alloy_js_core0.Children;
|
|
30
30
|
/**
|
|
31
31
|
* A built-in prompts module for Shell Shock.
|
|
32
32
|
*/
|
|
33
|
-
declare function PromptsBuiltin(props: PromptsBuiltinProps):
|
|
33
|
+
declare function PromptsBuiltin(props: PromptsBuiltinProps): _alloy_js_core0.Children;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { BasePromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
|
|
36
36
|
//# sourceMappingURL=prompts-builtin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts-builtin.d.cts","names":[],"sources":["../../src/components/prompts-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA4CiB,mBAAA,SACP,KAAK;;AADf;AAMA;
|
|
1
|
+
{"version":3,"file":"prompts-builtin.d.cts","names":[],"sources":["../../src/components/prompts-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA4CiB,mBAAA,SACP,KAAK;;AADf;AAMA;AA0rBgB,iBA1rBA,sBAAA,CAAA,CA0rBsB,EA1rBA,eAAA,CAAA,QA0rBA;AA2TtC;AAmbA;AAwSA;AAuNgB,iBA7uCA,sBAAA,CAAA,CA6uCyB,EA7uCH,eAAA,CAAA,QA6uCG;AAqEzC;;;iBAv/BgB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAmbxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAwSzB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAuNxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAqEzB,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/prompts-builtin.d.ts
|
|
@@ -6,31 +6,31 @@ interface PromptsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description
|
|
|
6
6
|
/**
|
|
7
7
|
* A component that generates TypeScript declarations for built-in prompt types and related utilities, such as the base Prompt class, specific prompt types like TextPrompt and SelectPrompt, and utility functions for handling prompt cancellations. This component serves as a central place to define the types and interfaces for prompts used in the Shell Shock CLI, providing a consistent API for creating and managing prompts throughout the application.
|
|
8
8
|
*/
|
|
9
|
-
declare function BasePromptDeclarations():
|
|
9
|
+
declare function BasePromptDeclarations(): _alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Declarations for a text-based prompt that allows users to input and edit text, with support for cursor movement, deletion, and custom masking. This prompt type can be used for various text input scenarios, such as entering a username, password, or any other string input. The TextPrompt class extends the base Prompt class and implements specific logic for handling text input and editing interactions.
|
|
12
12
|
*/
|
|
13
|
-
declare function TextPromptDeclarations():
|
|
13
|
+
declare function TextPromptDeclarations(): _alloy_js_core0.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Declarations for a select prompt that allows users to choose from a list of options, with support for pagination, option descriptions, and disabled options. This prompt type can be used for scenarios where the user needs to select one option from a predefined list, such as choosing a color, selecting a file, or picking an item from a menu. The SelectPrompt class extends the base Prompt class and implements specific logic for handling option selection and navigation interactions.
|
|
16
16
|
*/
|
|
17
|
-
declare function SelectPromptDeclarations():
|
|
17
|
+
declare function SelectPromptDeclarations(): _alloy_js_core0.Children;
|
|
18
18
|
/**
|
|
19
19
|
* A component that renders the declarations for the built-in numeric prompt, which allows users to input and select numeric values with various configuration options such as floating point support, precision, increment, and min/max values.
|
|
20
20
|
*/
|
|
21
|
-
declare function NumericPromptDeclarations():
|
|
21
|
+
declare function NumericPromptDeclarations(): _alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* A component that renders the declarations for the built-in toggle prompt, which allows users to select a boolean value (true/false) with support for custom messages for the true and false states. This prompt type can be used for scenarios where the user needs to toggle a setting on or off, such as enabling or disabling a feature. The TogglePrompt class extends the base Prompt class and implements specific logic for handling boolean input and rendering interactions.
|
|
24
24
|
*/
|
|
25
|
-
declare function TogglePromptDeclarations():
|
|
25
|
+
declare function TogglePromptDeclarations(): _alloy_js_core0.Children;
|
|
26
26
|
/**
|
|
27
27
|
* Declarations for a password prompt that allows users to input and edit text, with support for cursor movement, deletion, and custom masking. This prompt type can be used for various text input scenarios, such as entering a password or any other string input. The PasswordPrompt class extends the base Prompt class and implements specific logic for handling password input and editing interactions.
|
|
28
28
|
*/
|
|
29
|
-
declare function PasswordPromptDeclaration():
|
|
29
|
+
declare function PasswordPromptDeclaration(): _alloy_js_core0.Children;
|
|
30
30
|
/**
|
|
31
31
|
* A built-in prompts module for Shell Shock.
|
|
32
32
|
*/
|
|
33
|
-
declare function PromptsBuiltin(props: PromptsBuiltinProps):
|
|
33
|
+
declare function PromptsBuiltin(props: PromptsBuiltinProps): _alloy_js_core0.Children;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { BasePromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
|
|
36
36
|
//# sourceMappingURL=prompts-builtin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts-builtin.d.mts","names":[],"sources":["../../src/components/prompts-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA4CiB,mBAAA,SACP,KAAK;;AADf;AAMA;
|
|
1
|
+
{"version":3,"file":"prompts-builtin.d.mts","names":[],"sources":["../../src/components/prompts-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA4CiB,mBAAA,SACP,KAAK;;AADf;AAMA;AA0rBgB,iBA1rBA,sBAAA,CAAA,CA0rBsB,EA1rBA,eAAA,CAAA,QA0rBA;AA2TtC;AAmbA;AAwSA;AAuNgB,iBA7uCA,sBAAA,CAAA,CA6uCyB,EA7uCH,eAAA,CAAA,QA6uCG;AAqEzC;;;iBAv/BgB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAmbxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAwSzB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAuNxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAqEzB,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
|