@shell-shock/preset-cli 0.4.1 → 0.5.0
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.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.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 +83 -65
- 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.map +1 -1
- package/dist/components/prompts-builtin.mjs +83 -65
- 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,
|
|
@@ -242,7 +213,13 @@ function BasePromptDeclarations() {
|
|
|
242
213
|
type: "string",
|
|
243
214
|
doc: "The default error message to display when validation fails"
|
|
244
215
|
}),
|
|
245
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
216
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
217
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
218
|
+
name: "timeout",
|
|
219
|
+
optional: true,
|
|
220
|
+
type: "number",
|
|
221
|
+
doc: "The timeout duration in milliseconds for the prompt. If none is provided, the prompt will not time out."
|
|
222
|
+
})
|
|
246
223
|
];
|
|
247
224
|
}
|
|
248
225
|
}),
|
|
@@ -277,7 +254,7 @@ function BasePromptDeclarations() {
|
|
|
277
254
|
type: "boolean",
|
|
278
255
|
children: __alloy_js_core.code`false; `
|
|
279
256
|
}),
|
|
280
|
-
(0, __alloy_js_core_jsx_runtime.
|
|
257
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
281
258
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
282
259
|
name: "initialValue",
|
|
283
260
|
abstract: true,
|
|
@@ -435,6 +412,14 @@ function BasePromptDeclarations() {
|
|
|
435
412
|
this.formatter = config.format.bind(this);
|
|
436
413
|
}
|
|
437
414
|
|
|
415
|
+
if (config.timeout !== undefined && !Number.isNaN(config.timeout)) {
|
|
416
|
+
setTimeout(() => {
|
|
417
|
+
if (!this.isCompleted) {
|
|
418
|
+
this.cancel();
|
|
419
|
+
}
|
|
420
|
+
}, config.timeout);
|
|
421
|
+
}
|
|
422
|
+
|
|
438
423
|
this.message = config.message;
|
|
439
424
|
|
|
440
425
|
this.#readline = readline.createInterface({
|
|
@@ -490,12 +475,12 @@ function BasePromptDeclarations() {
|
|
|
490
475
|
"protected": true,
|
|
491
476
|
name: "status",
|
|
492
477
|
type: "string",
|
|
493
|
-
children: __alloy_js_core.code`return this.
|
|
478
|
+
children: __alloy_js_core.code`return this.isCompleted ? "" : \` \\n \${
|
|
494
479
|
colors.italic(
|
|
495
480
|
this.isError
|
|
496
|
-
? colors.text.prompt.description.error(splitText(this.errorMessage, "
|
|
497
|
-
: this.
|
|
498
|
-
? colors.text.prompt.description.active(this.description)
|
|
481
|
+
? colors.text.prompt.description.error(splitText(this.errorMessage, "3/4").join("\\n"))
|
|
482
|
+
: this.description
|
|
483
|
+
? colors.text.prompt.description.active(splitText(this.description, "3/4").join("\\n"))
|
|
499
484
|
: ""
|
|
500
485
|
)
|
|
501
486
|
}\`; `
|
|
@@ -814,20 +799,27 @@ function BasePromptDeclarations() {
|
|
|
814
799
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
815
800
|
"export": true,
|
|
816
801
|
name: "CANCEL_SYMBOL",
|
|
817
|
-
doc: "A unique symbol used to indicate that a prompt was cancelled, which can be returned from a prompt
|
|
802
|
+
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.",
|
|
818
803
|
children: __alloy_js_core.code`Symbol("shell-shock:prompts:cancel"); `
|
|
819
804
|
}),
|
|
820
805
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
806
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
807
|
+
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.",
|
|
808
|
+
get children() {
|
|
809
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
810
|
+
name: "value",
|
|
811
|
+
children: `The value to check.`
|
|
812
|
+
}), (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.` })];
|
|
813
|
+
}
|
|
814
|
+
}),
|
|
821
815
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
822
816
|
name: "isCancel",
|
|
823
817
|
"export": true,
|
|
824
|
-
doc: "Checks if a given value is a {@link CANCEL_SYMBOL | cancel symbol}.",
|
|
825
818
|
parameters: [{
|
|
826
819
|
name: "value",
|
|
827
|
-
type: "any"
|
|
828
|
-
doc: "The value to check"
|
|
820
|
+
type: "any"
|
|
829
821
|
}],
|
|
830
|
-
returnType: "
|
|
822
|
+
returnType: "value is typeof CANCEL_SYMBOL",
|
|
831
823
|
children: __alloy_js_core.code`return value === CANCEL_SYMBOL; `
|
|
832
824
|
})
|
|
833
825
|
];
|
|
@@ -876,6 +868,7 @@ function TextPromptDeclarations() {
|
|
|
876
868
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
877
869
|
name: "initialValue",
|
|
878
870
|
"protected": true,
|
|
871
|
+
override: true,
|
|
879
872
|
type: "string",
|
|
880
873
|
children: __alloy_js_core.code`""; `
|
|
881
874
|
}),
|
|
@@ -1109,7 +1102,7 @@ function TextPromptDeclarations() {
|
|
|
1109
1102
|
get children() {
|
|
1110
1103
|
return [
|
|
1111
1104
|
(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.` }),
|
|
1112
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { text, isCancel } from "shell-shock
|
|
1105
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { text, isCancel } from "shell-shock:prompts";
|
|
1113
1106
|
|
|
1114
1107
|
async function run() {
|
|
1115
1108
|
const name = await text({
|
|
@@ -1161,6 +1154,10 @@ function SelectPromptDeclarations() {
|
|
|
1161
1154
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1162
1155
|
name: "PromptOptionConfig",
|
|
1163
1156
|
doc: "Configuration for an option the user can select from the select prompt",
|
|
1157
|
+
typeParameters: [{
|
|
1158
|
+
name: "TValue",
|
|
1159
|
+
default: "string"
|
|
1160
|
+
}],
|
|
1164
1161
|
get children() {
|
|
1165
1162
|
return [
|
|
1166
1163
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
@@ -1179,7 +1176,7 @@ function SelectPromptDeclarations() {
|
|
|
1179
1176
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1180
1177
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1181
1178
|
name: "value",
|
|
1182
|
-
type: "
|
|
1179
|
+
type: "TValue",
|
|
1183
1180
|
doc: "The value of the option"
|
|
1184
1181
|
}),
|
|
1185
1182
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -1210,10 +1207,19 @@ function SelectPromptDeclarations() {
|
|
|
1210
1207
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1211
1208
|
"export": true,
|
|
1212
1209
|
name: "PromptOption",
|
|
1213
|
-
"extends": "PromptOptionConfig",
|
|
1210
|
+
"extends": "PromptOptionConfig<TValue>",
|
|
1214
1211
|
doc: "An option the user can select from the select prompt",
|
|
1212
|
+
typeParameters: [{
|
|
1213
|
+
name: "TValue",
|
|
1214
|
+
default: "string"
|
|
1215
|
+
}],
|
|
1215
1216
|
get children() {
|
|
1216
1217
|
return [
|
|
1218
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1219
|
+
name: "label",
|
|
1220
|
+
type: "string",
|
|
1221
|
+
doc: "The message label for the option"
|
|
1222
|
+
}),
|
|
1217
1223
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1218
1224
|
name: "index",
|
|
1219
1225
|
type: "number",
|
|
@@ -1237,8 +1243,12 @@ function SelectPromptDeclarations() {
|
|
|
1237
1243
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1238
1244
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1239
1245
|
name: "SelectPromptConfig",
|
|
1240
|
-
"extends": "PromptConfig<
|
|
1246
|
+
"extends": "PromptConfig<TValue>",
|
|
1241
1247
|
doc: "An options object for configuring a select prompt",
|
|
1248
|
+
typeParameters: [{
|
|
1249
|
+
name: "TValue",
|
|
1250
|
+
default: "string"
|
|
1251
|
+
}],
|
|
1242
1252
|
get children() {
|
|
1243
1253
|
return [
|
|
1244
1254
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
@@ -1250,7 +1260,7 @@ function SelectPromptDeclarations() {
|
|
|
1250
1260
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1251
1261
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1252
1262
|
name: "options",
|
|
1253
|
-
type: "Array<string | PromptOptionConfig
|
|
1263
|
+
type: "Array<string | PromptOptionConfig<TValue>>",
|
|
1254
1264
|
doc: "The options available for the select prompt"
|
|
1255
1265
|
}),
|
|
1256
1266
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -1270,13 +1280,14 @@ function SelectPromptDeclarations() {
|
|
|
1270
1280
|
"extends": "Prompt<TValue>",
|
|
1271
1281
|
typeParameters: [{
|
|
1272
1282
|
name: "TValue",
|
|
1273
|
-
default: "
|
|
1283
|
+
default: "string"
|
|
1274
1284
|
}],
|
|
1275
1285
|
get children() {
|
|
1276
1286
|
return [
|
|
1277
1287
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1278
1288
|
name: "initialValue",
|
|
1279
1289
|
"protected": true,
|
|
1290
|
+
override: true,
|
|
1280
1291
|
type: "TValue"
|
|
1281
1292
|
}),
|
|
1282
1293
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
@@ -1290,47 +1301,48 @@ function SelectPromptDeclarations() {
|
|
|
1290
1301
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1291
1302
|
name: "options",
|
|
1292
1303
|
"protected": true,
|
|
1293
|
-
type: "PromptOption[]",
|
|
1304
|
+
type: "PromptOption<TValue>[]",
|
|
1294
1305
|
children: __alloy_js_core.code`[]; `
|
|
1295
1306
|
}),
|
|
1296
1307
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1297
|
-
__alloy_js_core.code`constructor(config: SelectPromptConfig) {
|
|
1308
|
+
__alloy_js_core.code`constructor(config: SelectPromptConfig<TValue>) {
|
|
1298
1309
|
super(config);
|
|
1299
1310
|
|
|
1300
1311
|
if (config.initialValue) {
|
|
1301
|
-
this.initialValue = config.initialValue;
|
|
1312
|
+
this.initialValue = config.initialValue as TValue;
|
|
1313
|
+
} else {
|
|
1314
|
+
this.initialValue = undefined as unknown as TValue;
|
|
1302
1315
|
}
|
|
1303
1316
|
|
|
1304
|
-
this.options = config.options.map(opt => {
|
|
1305
|
-
let option
|
|
1317
|
+
this.options = config.options.map((opt, index) => {
|
|
1318
|
+
let option = {} as Partial<PromptOption<TValue>>;
|
|
1306
1319
|
if (typeof opt === "string") {
|
|
1307
|
-
option = {
|
|
1320
|
+
option = { label: opt, value: opt as TValue, selected: false, disabled: false };
|
|
1308
1321
|
} else if (typeof opt === "object") {
|
|
1309
|
-
option = opt
|
|
1322
|
+
option = opt;
|
|
1310
1323
|
} else {
|
|
1311
1324
|
throw new Error(\`Invalid option provided to SelectPrompt at index #\${index}\`);
|
|
1312
1325
|
}
|
|
1313
1326
|
|
|
1314
1327
|
return {
|
|
1315
|
-
label: String(option.value),
|
|
1328
|
+
label: String(option.value) || "",
|
|
1316
1329
|
...option,
|
|
1317
|
-
index: -1,
|
|
1318
1330
|
description: option.description,
|
|
1319
1331
|
selected: !!option.selected || (this.initialValue !== undefined && option.value === this.initialValue),
|
|
1320
1332
|
disabled: !!option.disabled
|
|
1321
|
-
}
|
|
1333
|
+
} as PromptOption<TValue>;
|
|
1322
1334
|
}).sort((a, b) => a.label.localeCompare(b.label)).map((option, index) => ({ ...option, index }));
|
|
1323
1335
|
|
|
1324
1336
|
const selected = this.options.findIndex(option => option.selected);
|
|
1325
1337
|
if (selected > -1) {
|
|
1326
1338
|
this.cursor = selected;
|
|
1327
1339
|
if (this.options[this.cursor]) {
|
|
1328
|
-
this.initialValue = this.options[this.cursor].value;
|
|
1340
|
+
this.initialValue = this.options[this.cursor].value as TValue;
|
|
1329
1341
|
}
|
|
1330
1342
|
}
|
|
1331
1343
|
|
|
1332
1344
|
if (this.initialValue === undefined && this.options.length > 0 && this.options[0]) {
|
|
1333
|
-
this.initialValue = this.options[0].value;
|
|
1345
|
+
this.initialValue = this.options[0].value as TValue;
|
|
1334
1346
|
}
|
|
1335
1347
|
|
|
1336
1348
|
if (config.optionsPerPage) {
|
|
@@ -1343,9 +1355,9 @@ function SelectPromptDeclarations() {
|
|
|
1343
1355
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
1344
1356
|
doc: "Returns the currently selected option",
|
|
1345
1357
|
name: "selectedOption",
|
|
1346
|
-
type: "PromptOption | null",
|
|
1358
|
+
type: "PromptOption<TValue> | null",
|
|
1347
1359
|
"protected": true,
|
|
1348
|
-
children: __alloy_js_core.code`return this.options
|
|
1360
|
+
children: __alloy_js_core.code`return this.options.find(option => option.value === this.value) ?? null; `
|
|
1349
1361
|
}),
|
|
1350
1362
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1351
1363
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
@@ -1464,6 +1476,7 @@ function SelectPromptDeclarations() {
|
|
|
1464
1476
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1465
1477
|
doc: "A method to render the prompt",
|
|
1466
1478
|
name: "render",
|
|
1479
|
+
override: true,
|
|
1467
1480
|
"protected": true,
|
|
1468
1481
|
children: __alloy_js_core.code`if (this.isInitial) {
|
|
1469
1482
|
this.output.write(cursor.hide);
|
|
@@ -1510,7 +1523,7 @@ function SelectPromptDeclarations() {
|
|
|
1510
1523
|
: this.cursor === index
|
|
1511
1524
|
? colors.bold(colors.underline(colors.text.prompt.input.active(this.options[index]!.label)))
|
|
1512
1525
|
: colors.text.prompt.input.inactive(this.options[index]!.label)
|
|
1513
|
-
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon
|
|
1526
|
+
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon!.length + 1 : 0))}\${
|
|
1514
1527
|
this.options[index]!.description && this.cursor === index
|
|
1515
1528
|
? colors.italic(colors.text.prompt.description.active(this.options[index]!.description))
|
|
1516
1529
|
: ""
|
|
@@ -1543,7 +1556,7 @@ function SelectPromptDeclarations() {
|
|
|
1543
1556
|
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.",
|
|
1544
1557
|
get children() {
|
|
1545
1558
|
return [
|
|
1546
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { select, isCancel } from "shell-shock
|
|
1559
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { select, isCancel } from "shell-shock:prompts";
|
|
1547
1560
|
|
|
1548
1561
|
async function run() {
|
|
1549
1562
|
const color = await select({
|
|
@@ -1651,6 +1664,7 @@ function NumericPromptDeclarations() {
|
|
|
1651
1664
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1652
1665
|
name: "initialValue",
|
|
1653
1666
|
"protected": true,
|
|
1667
|
+
override: true,
|
|
1654
1668
|
type: "number",
|
|
1655
1669
|
children: __alloy_js_core.code`0; `
|
|
1656
1670
|
}),
|
|
@@ -1745,6 +1759,7 @@ function NumericPromptDeclarations() {
|
|
|
1745
1759
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1746
1760
|
doc: "A method to reset the prompt input",
|
|
1747
1761
|
name: "reset",
|
|
1762
|
+
override: true,
|
|
1748
1763
|
"protected": true,
|
|
1749
1764
|
children: __alloy_js_core.code`super.reset();
|
|
1750
1765
|
this.currentInput = "";
|
|
@@ -1762,6 +1777,7 @@ function NumericPromptDeclarations() {
|
|
|
1762
1777
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1763
1778
|
doc: "A method to handle keypress events and determine the corresponding action",
|
|
1764
1779
|
name: "keypress",
|
|
1780
|
+
override: true,
|
|
1765
1781
|
"protected": true,
|
|
1766
1782
|
parameters: [{
|
|
1767
1783
|
name: "char",
|
|
@@ -1871,7 +1887,7 @@ function NumericPromptDeclarations() {
|
|
|
1871
1887
|
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.",
|
|
1872
1888
|
get children() {
|
|
1873
1889
|
return [
|
|
1874
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { numeric, isCancel } from "shell-shock
|
|
1890
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { numeric, isCancel } from "shell-shock:prompts";
|
|
1875
1891
|
|
|
1876
1892
|
async function run() {
|
|
1877
1893
|
const age = await numeric({
|
|
@@ -1955,6 +1971,7 @@ function TogglePromptDeclarations() {
|
|
|
1955
1971
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1956
1972
|
name: "initialValue",
|
|
1957
1973
|
"protected": true,
|
|
1974
|
+
override: true,
|
|
1958
1975
|
type: "boolean",
|
|
1959
1976
|
children: __alloy_js_core.code`false; `
|
|
1960
1977
|
}),
|
|
@@ -2017,6 +2034,7 @@ function TogglePromptDeclarations() {
|
|
|
2017
2034
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2018
2035
|
doc: "A method to handle keypress events and determine the corresponding action",
|
|
2019
2036
|
name: "keypress",
|
|
2037
|
+
override: true,
|
|
2020
2038
|
"protected": true,
|
|
2021
2039
|
parameters: [{
|
|
2022
2040
|
name: "char",
|
|
@@ -2100,7 +2118,7 @@ function TogglePromptDeclarations() {
|
|
|
2100
2118
|
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.",
|
|
2101
2119
|
get children() {
|
|
2102
2120
|
return [
|
|
2103
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { toggle, isCancel } from "shell-shock
|
|
2121
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { toggle, isCancel } from "shell-shock:prompts";
|
|
2104
2122
|
|
|
2105
2123
|
async function run() {
|
|
2106
2124
|
const likesIceCream = await toggle({
|
|
@@ -2172,7 +2190,7 @@ function PasswordPromptDeclaration() {
|
|
|
2172
2190
|
return [
|
|
2173
2191
|
(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.` }),
|
|
2174
2192
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2175
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { password, isCancel } from "shell-shock
|
|
2193
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { password, isCancel } from "shell-shock:prompts";
|
|
2176
2194
|
|
|
2177
2195
|
async function run() {
|
|
2178
2196
|
const userPassword = await password({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core4 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_core4.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_core4.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_core4.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_core4.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_core4.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_core4.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_core4.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;AAwsBgB,iBAxsBA,sBAAA,CAAA,CAwsBsB,EAxsBA,eAAA,CAAA,QAwsBA;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 +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;AAwsBgB,iBAxsBA,sBAAA,CAAA,CAwsBsB,EAxsBA,eAAA,CAAA,QAwsBA;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"}
|