@shell-shock/preset-cli 0.4.1 → 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.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.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/prompts-builtin.cjs +67 -63
- 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 +67 -63
- package/dist/components/prompts-builtin.mjs.map +1 -1
- 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,
|
|
@@ -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
|
}\`; `
|
|
@@ -814,20 +785,27 @@ function BasePromptDeclarations() {
|
|
|
814
785
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
815
786
|
"export": true,
|
|
816
787
|
name: "CANCEL_SYMBOL",
|
|
817
|
-
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.",
|
|
818
789
|
children: __alloy_js_core.code`Symbol("shell-shock:prompts:cancel"); `
|
|
819
790
|
}),
|
|
820
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
|
+
}),
|
|
821
801
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
822
802
|
name: "isCancel",
|
|
823
803
|
"export": true,
|
|
824
|
-
doc: "Checks if a given value is a {@link CANCEL_SYMBOL | cancel symbol}.",
|
|
825
804
|
parameters: [{
|
|
826
805
|
name: "value",
|
|
827
|
-
type: "any"
|
|
828
|
-
doc: "The value to check"
|
|
806
|
+
type: "any"
|
|
829
807
|
}],
|
|
830
|
-
returnType: "
|
|
808
|
+
returnType: "value is typeof CANCEL_SYMBOL",
|
|
831
809
|
children: __alloy_js_core.code`return value === CANCEL_SYMBOL; `
|
|
832
810
|
})
|
|
833
811
|
];
|
|
@@ -876,6 +854,7 @@ function TextPromptDeclarations() {
|
|
|
876
854
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
877
855
|
name: "initialValue",
|
|
878
856
|
"protected": true,
|
|
857
|
+
override: true,
|
|
879
858
|
type: "string",
|
|
880
859
|
children: __alloy_js_core.code`""; `
|
|
881
860
|
}),
|
|
@@ -1109,7 +1088,7 @@ function TextPromptDeclarations() {
|
|
|
1109
1088
|
get children() {
|
|
1110
1089
|
return [
|
|
1111
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.` }),
|
|
1112
|
-
(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";
|
|
1113
1092
|
|
|
1114
1093
|
async function run() {
|
|
1115
1094
|
const name = await text({
|
|
@@ -1161,6 +1140,10 @@ function SelectPromptDeclarations() {
|
|
|
1161
1140
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1162
1141
|
name: "PromptOptionConfig",
|
|
1163
1142
|
doc: "Configuration for an option the user can select from the select prompt",
|
|
1143
|
+
typeParameters: [{
|
|
1144
|
+
name: "TValue",
|
|
1145
|
+
default: "string"
|
|
1146
|
+
}],
|
|
1164
1147
|
get children() {
|
|
1165
1148
|
return [
|
|
1166
1149
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
@@ -1179,7 +1162,7 @@ function SelectPromptDeclarations() {
|
|
|
1179
1162
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1180
1163
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1181
1164
|
name: "value",
|
|
1182
|
-
type: "
|
|
1165
|
+
type: "TValue",
|
|
1183
1166
|
doc: "The value of the option"
|
|
1184
1167
|
}),
|
|
1185
1168
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -1210,10 +1193,19 @@ function SelectPromptDeclarations() {
|
|
|
1210
1193
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1211
1194
|
"export": true,
|
|
1212
1195
|
name: "PromptOption",
|
|
1213
|
-
"extends": "PromptOptionConfig",
|
|
1196
|
+
"extends": "PromptOptionConfig<TValue>",
|
|
1214
1197
|
doc: "An option the user can select from the select prompt",
|
|
1198
|
+
typeParameters: [{
|
|
1199
|
+
name: "TValue",
|
|
1200
|
+
default: "string"
|
|
1201
|
+
}],
|
|
1215
1202
|
get children() {
|
|
1216
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
|
+
}),
|
|
1217
1209
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1218
1210
|
name: "index",
|
|
1219
1211
|
type: "number",
|
|
@@ -1237,8 +1229,12 @@ function SelectPromptDeclarations() {
|
|
|
1237
1229
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1238
1230
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1239
1231
|
name: "SelectPromptConfig",
|
|
1240
|
-
"extends": "PromptConfig<
|
|
1232
|
+
"extends": "PromptConfig<TValue>",
|
|
1241
1233
|
doc: "An options object for configuring a select prompt",
|
|
1234
|
+
typeParameters: [{
|
|
1235
|
+
name: "TValue",
|
|
1236
|
+
default: "string"
|
|
1237
|
+
}],
|
|
1242
1238
|
get children() {
|
|
1243
1239
|
return [
|
|
1244
1240
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
@@ -1250,7 +1246,7 @@ function SelectPromptDeclarations() {
|
|
|
1250
1246
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1251
1247
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1252
1248
|
name: "options",
|
|
1253
|
-
type: "Array<string | PromptOptionConfig
|
|
1249
|
+
type: "Array<string | PromptOptionConfig<TValue>>",
|
|
1254
1250
|
doc: "The options available for the select prompt"
|
|
1255
1251
|
}),
|
|
1256
1252
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -1270,13 +1266,14 @@ function SelectPromptDeclarations() {
|
|
|
1270
1266
|
"extends": "Prompt<TValue>",
|
|
1271
1267
|
typeParameters: [{
|
|
1272
1268
|
name: "TValue",
|
|
1273
|
-
default: "
|
|
1269
|
+
default: "string"
|
|
1274
1270
|
}],
|
|
1275
1271
|
get children() {
|
|
1276
1272
|
return [
|
|
1277
1273
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1278
1274
|
name: "initialValue",
|
|
1279
1275
|
"protected": true,
|
|
1276
|
+
override: true,
|
|
1280
1277
|
type: "TValue"
|
|
1281
1278
|
}),
|
|
1282
1279
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
@@ -1290,47 +1287,48 @@ function SelectPromptDeclarations() {
|
|
|
1290
1287
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1291
1288
|
name: "options",
|
|
1292
1289
|
"protected": true,
|
|
1293
|
-
type: "PromptOption[]",
|
|
1290
|
+
type: "PromptOption<TValue>[]",
|
|
1294
1291
|
children: __alloy_js_core.code`[]; `
|
|
1295
1292
|
}),
|
|
1296
1293
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1297
|
-
__alloy_js_core.code`constructor(config: SelectPromptConfig) {
|
|
1294
|
+
__alloy_js_core.code`constructor(config: SelectPromptConfig<TValue>) {
|
|
1298
1295
|
super(config);
|
|
1299
1296
|
|
|
1300
1297
|
if (config.initialValue) {
|
|
1301
|
-
this.initialValue = config.initialValue;
|
|
1298
|
+
this.initialValue = config.initialValue as TValue;
|
|
1299
|
+
} else {
|
|
1300
|
+
this.initialValue = undefined as unknown as TValue;
|
|
1302
1301
|
}
|
|
1303
1302
|
|
|
1304
|
-
this.options = config.options.map(opt => {
|
|
1305
|
-
let option
|
|
1303
|
+
this.options = config.options.map((opt, index) => {
|
|
1304
|
+
let option = {} as Partial<PromptOption<TValue>>;
|
|
1306
1305
|
if (typeof opt === "string") {
|
|
1307
|
-
option = {
|
|
1306
|
+
option = { label: opt, value: opt as TValue, selected: false, disabled: false };
|
|
1308
1307
|
} else if (typeof opt === "object") {
|
|
1309
|
-
option = opt
|
|
1308
|
+
option = opt;
|
|
1310
1309
|
} else {
|
|
1311
1310
|
throw new Error(\`Invalid option provided to SelectPrompt at index #\${index}\`);
|
|
1312
1311
|
}
|
|
1313
1312
|
|
|
1314
1313
|
return {
|
|
1315
|
-
label: String(option.value),
|
|
1314
|
+
label: String(option.value) || "",
|
|
1316
1315
|
...option,
|
|
1317
|
-
index: -1,
|
|
1318
1316
|
description: option.description,
|
|
1319
1317
|
selected: !!option.selected || (this.initialValue !== undefined && option.value === this.initialValue),
|
|
1320
1318
|
disabled: !!option.disabled
|
|
1321
|
-
}
|
|
1319
|
+
} as PromptOption<TValue>;
|
|
1322
1320
|
}).sort((a, b) => a.label.localeCompare(b.label)).map((option, index) => ({ ...option, index }));
|
|
1323
1321
|
|
|
1324
1322
|
const selected = this.options.findIndex(option => option.selected);
|
|
1325
1323
|
if (selected > -1) {
|
|
1326
1324
|
this.cursor = selected;
|
|
1327
1325
|
if (this.options[this.cursor]) {
|
|
1328
|
-
this.initialValue = this.options[this.cursor].value;
|
|
1326
|
+
this.initialValue = this.options[this.cursor].value as TValue;
|
|
1329
1327
|
}
|
|
1330
1328
|
}
|
|
1331
1329
|
|
|
1332
1330
|
if (this.initialValue === undefined && this.options.length > 0 && this.options[0]) {
|
|
1333
|
-
this.initialValue = this.options[0].value;
|
|
1331
|
+
this.initialValue = this.options[0].value as TValue;
|
|
1334
1332
|
}
|
|
1335
1333
|
|
|
1336
1334
|
if (config.optionsPerPage) {
|
|
@@ -1343,9 +1341,9 @@ function SelectPromptDeclarations() {
|
|
|
1343
1341
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
1344
1342
|
doc: "Returns the currently selected option",
|
|
1345
1343
|
name: "selectedOption",
|
|
1346
|
-
type: "PromptOption | null",
|
|
1344
|
+
type: "PromptOption<TValue> | null",
|
|
1347
1345
|
"protected": true,
|
|
1348
|
-
children: __alloy_js_core.code`return this.options
|
|
1346
|
+
children: __alloy_js_core.code`return this.options.find(option => option.selected) ?? null; `
|
|
1349
1347
|
}),
|
|
1350
1348
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1351
1349
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
@@ -1464,6 +1462,7 @@ function SelectPromptDeclarations() {
|
|
|
1464
1462
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1465
1463
|
doc: "A method to render the prompt",
|
|
1466
1464
|
name: "render",
|
|
1465
|
+
override: true,
|
|
1467
1466
|
"protected": true,
|
|
1468
1467
|
children: __alloy_js_core.code`if (this.isInitial) {
|
|
1469
1468
|
this.output.write(cursor.hide);
|
|
@@ -1510,7 +1509,7 @@ function SelectPromptDeclarations() {
|
|
|
1510
1509
|
: this.cursor === index
|
|
1511
1510
|
? colors.bold(colors.underline(colors.text.prompt.input.active(this.options[index]!.label)))
|
|
1512
1511
|
: 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
|
|
1512
|
+
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon!.length + 1 : 0))}\${
|
|
1514
1513
|
this.options[index]!.description && this.cursor === index
|
|
1515
1514
|
? colors.italic(colors.text.prompt.description.active(this.options[index]!.description))
|
|
1516
1515
|
: ""
|
|
@@ -1543,7 +1542,7 @@ function SelectPromptDeclarations() {
|
|
|
1543
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.",
|
|
1544
1543
|
get children() {
|
|
1545
1544
|
return [
|
|
1546
|
-
(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";
|
|
1547
1546
|
|
|
1548
1547
|
async function run() {
|
|
1549
1548
|
const color = await select({
|
|
@@ -1651,6 +1650,7 @@ function NumericPromptDeclarations() {
|
|
|
1651
1650
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1652
1651
|
name: "initialValue",
|
|
1653
1652
|
"protected": true,
|
|
1653
|
+
override: true,
|
|
1654
1654
|
type: "number",
|
|
1655
1655
|
children: __alloy_js_core.code`0; `
|
|
1656
1656
|
}),
|
|
@@ -1745,6 +1745,7 @@ function NumericPromptDeclarations() {
|
|
|
1745
1745
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1746
1746
|
doc: "A method to reset the prompt input",
|
|
1747
1747
|
name: "reset",
|
|
1748
|
+
override: true,
|
|
1748
1749
|
"protected": true,
|
|
1749
1750
|
children: __alloy_js_core.code`super.reset();
|
|
1750
1751
|
this.currentInput = "";
|
|
@@ -1762,6 +1763,7 @@ function NumericPromptDeclarations() {
|
|
|
1762
1763
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1763
1764
|
doc: "A method to handle keypress events and determine the corresponding action",
|
|
1764
1765
|
name: "keypress",
|
|
1766
|
+
override: true,
|
|
1765
1767
|
"protected": true,
|
|
1766
1768
|
parameters: [{
|
|
1767
1769
|
name: "char",
|
|
@@ -1871,7 +1873,7 @@ function NumericPromptDeclarations() {
|
|
|
1871
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.",
|
|
1872
1874
|
get children() {
|
|
1873
1875
|
return [
|
|
1874
|
-
(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";
|
|
1875
1877
|
|
|
1876
1878
|
async function run() {
|
|
1877
1879
|
const age = await numeric({
|
|
@@ -1955,6 +1957,7 @@ function TogglePromptDeclarations() {
|
|
|
1955
1957
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1956
1958
|
name: "initialValue",
|
|
1957
1959
|
"protected": true,
|
|
1960
|
+
override: true,
|
|
1958
1961
|
type: "boolean",
|
|
1959
1962
|
children: __alloy_js_core.code`false; `
|
|
1960
1963
|
}),
|
|
@@ -2017,6 +2020,7 @@ function TogglePromptDeclarations() {
|
|
|
2017
2020
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2018
2021
|
doc: "A method to handle keypress events and determine the corresponding action",
|
|
2019
2022
|
name: "keypress",
|
|
2023
|
+
override: true,
|
|
2020
2024
|
"protected": true,
|
|
2021
2025
|
parameters: [{
|
|
2022
2026
|
name: "char",
|
|
@@ -2100,7 +2104,7 @@ function TogglePromptDeclarations() {
|
|
|
2100
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.",
|
|
2101
2105
|
get children() {
|
|
2102
2106
|
return [
|
|
2103
|
-
(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";
|
|
2104
2108
|
|
|
2105
2109
|
async function run() {
|
|
2106
2110
|
const likesIceCream = await toggle({
|
|
@@ -2172,7 +2176,7 @@ function PasswordPromptDeclaration() {
|
|
|
2172
2176
|
return [
|
|
2173
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.` }),
|
|
2174
2178
|
(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
|
|
2179
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { password, isCancel } from "shell-shock:prompts";
|
|
2176
2180
|
|
|
2177
2181
|
async function run() {
|
|
2178
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 +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"}
|