@shell-shock/plugin-prompts 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs +2 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/components/prompts-builtin.cjs +83 -40
- package/dist/components/prompts-builtin.d.cts +2 -1
- package/dist/components/prompts-builtin.d.cts.map +1 -1
- package/dist/components/prompts-builtin.d.mts +2 -1
- package/dist/components/prompts-builtin.d.mts.map +1 -1
- package/dist/components/prompts-builtin.mjs +82 -40
- package/dist/components/prompts-builtin.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -7,4 +7,5 @@ exports.PasswordPromptDeclaration = require_components_prompts_builtin.PasswordP
|
|
|
7
7
|
exports.PromptsBuiltin = require_components_prompts_builtin.PromptsBuiltin;
|
|
8
8
|
exports.SelectPromptDeclarations = require_components_prompts_builtin.SelectPromptDeclarations;
|
|
9
9
|
exports.TextPromptDeclarations = require_components_prompts_builtin.TextPromptDeclarations;
|
|
10
|
-
exports.TogglePromptDeclarations = require_components_prompts_builtin.TogglePromptDeclarations;
|
|
10
|
+
exports.TogglePromptDeclarations = require_components_prompts_builtin.TogglePromptDeclarations;
|
|
11
|
+
exports.WaitForKeyPressDeclaration = require_components_prompts_builtin.WaitForKeyPressDeclaration;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations } from "./prompts-builtin.cjs";
|
|
2
|
-
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
|
|
1
|
+
import { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations, WaitForKeyPressDeclaration } from "./prompts-builtin.cjs";
|
|
2
|
+
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations, WaitForKeyPressDeclaration };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations } from "./prompts-builtin.mjs";
|
|
2
|
-
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
|
|
1
|
+
import { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations, WaitForKeyPressDeclaration } from "./prompts-builtin.mjs";
|
|
2
|
+
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations, WaitForKeyPressDeclaration };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations } from "./prompts-builtin.mjs";
|
|
1
|
+
import { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations, WaitForKeyPressDeclaration } from "./prompts-builtin.mjs";
|
|
2
2
|
|
|
3
|
-
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
|
|
3
|
+
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations, WaitForKeyPressDeclaration };
|
|
@@ -183,7 +183,7 @@ function BasePromptDeclarations() {
|
|
|
183
183
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
184
184
|
name: "validate",
|
|
185
185
|
optional: true,
|
|
186
|
-
type: "(value: TValue) => boolean | string |
|
|
186
|
+
type: "(value: TValue) => boolean | string | null | undefined | Promise<boolean | string | null | undefined>",
|
|
187
187
|
doc: "A validation function that returns true if the input is valid, false or a string error message if the input is invalid"
|
|
188
188
|
}),
|
|
189
189
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -369,21 +369,21 @@ function BasePromptDeclarations() {
|
|
|
369
369
|
}),
|
|
370
370
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
371
371
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
372
|
-
name: "
|
|
372
|
+
name: "validate",
|
|
373
373
|
"protected": true,
|
|
374
374
|
type: "(value: TValue) => boolean | string | null | undefined | Promise<boolean | string | null | undefined>",
|
|
375
375
|
children: __alloy_js_core.code`() => true; `
|
|
376
376
|
}),
|
|
377
377
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
378
378
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
379
|
-
name: "
|
|
379
|
+
name: "parse",
|
|
380
380
|
"protected": true,
|
|
381
381
|
type: "PromptParser<TValue>",
|
|
382
382
|
children: __alloy_js_core.code`(value: string) => value as TValue; `
|
|
383
383
|
}),
|
|
384
384
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
385
385
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
386
|
-
name: "
|
|
386
|
+
name: "format",
|
|
387
387
|
"protected": true,
|
|
388
388
|
type: "PromptFormatter<TValue>",
|
|
389
389
|
children: __alloy_js_core.code`(value: TValue) => String(value); `
|
|
@@ -399,7 +399,8 @@ function BasePromptDeclarations() {
|
|
|
399
399
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
400
400
|
name: "maskCompleted",
|
|
401
401
|
"protected": true,
|
|
402
|
-
type: "(input: string) => string"
|
|
402
|
+
type: "(input: string) => string",
|
|
403
|
+
children: __alloy_js_core.code`this.mask; `
|
|
403
404
|
}),
|
|
404
405
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
405
406
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
@@ -439,13 +440,13 @@ function BasePromptDeclarations() {
|
|
|
439
440
|
this.description = config.description;
|
|
440
441
|
}
|
|
441
442
|
if (config.validate) {
|
|
442
|
-
this.
|
|
443
|
+
this.validate = config.validate;
|
|
443
444
|
}
|
|
444
445
|
if (config.parse) {
|
|
445
|
-
this.
|
|
446
|
+
this.parse = config.parse.bind(this);
|
|
446
447
|
}
|
|
447
448
|
if (config.format) {
|
|
448
|
-
this.
|
|
449
|
+
this.format = config.format.bind(this);
|
|
449
450
|
}
|
|
450
451
|
|
|
451
452
|
if (config.maskCompleted) {
|
|
@@ -454,9 +455,6 @@ function BasePromptDeclarations() {
|
|
|
454
455
|
if (config.mask) {
|
|
455
456
|
this.mask = config.mask;
|
|
456
457
|
}
|
|
457
|
-
if (!this.maskCompleted) {
|
|
458
|
-
this.maskCompleted = this.mask;
|
|
459
|
-
}
|
|
460
458
|
|
|
461
459
|
if (config.timeout !== undefined && !Number.isNaN(config.timeout)) {
|
|
462
460
|
setTimeout(() => {
|
|
@@ -518,7 +516,7 @@ function BasePromptDeclarations() {
|
|
|
518
516
|
"protected": true,
|
|
519
517
|
name: "isPlaceholder",
|
|
520
518
|
type: "boolean",
|
|
521
|
-
children: __alloy_js_core.code`return (this.displayValue === this.
|
|
519
|
+
children: __alloy_js_core.code`return (this.displayValue === this.format(this.initialValue) && !this.#isDirty) || !this.#isKeyPressed; `
|
|
522
520
|
}),
|
|
523
521
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
524
522
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
@@ -571,7 +569,7 @@ function BasePromptDeclarations() {
|
|
|
571
569
|
updatedValue = value;
|
|
572
570
|
}
|
|
573
571
|
|
|
574
|
-
this.displayValue = this.mask(this.
|
|
572
|
+
this.displayValue = this.mask(this.format(updatedValue));
|
|
575
573
|
this.#value = updatedValue;
|
|
576
574
|
|
|
577
575
|
if (!this.#isDirty && this.#value !== this.initialValue) {
|
|
@@ -580,7 +578,7 @@ function BasePromptDeclarations() {
|
|
|
580
578
|
|
|
581
579
|
this.onChange(previousValue);
|
|
582
580
|
setTimeout(() => {
|
|
583
|
-
Promise.resolve(this.
|
|
581
|
+
Promise.resolve(this.checkValidations(updatedValue)).then(() => this.sync());
|
|
584
582
|
}, 0);
|
|
585
583
|
|
|
586
584
|
this.sync(); `
|
|
@@ -677,14 +675,14 @@ function BasePromptDeclarations() {
|
|
|
677
675
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
678
676
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
679
677
|
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.",
|
|
680
|
-
name: "
|
|
678
|
+
name: "checkValidations",
|
|
681
679
|
async: true,
|
|
682
680
|
"protected": true,
|
|
683
681
|
parameters: [{
|
|
684
682
|
name: "value",
|
|
685
683
|
type: "TValue"
|
|
686
684
|
}],
|
|
687
|
-
children: __alloy_js_core.code`let result = await this.
|
|
685
|
+
children: __alloy_js_core.code`let result = await this.validate(value);
|
|
688
686
|
if (typeof result === "string") {
|
|
689
687
|
this.errorMessage = result;
|
|
690
688
|
} else if (typeof result === "boolean") {
|
|
@@ -761,11 +759,11 @@ function BasePromptDeclarations() {
|
|
|
761
759
|
return this.bell();
|
|
762
760
|
}
|
|
763
761
|
|
|
764
|
-
this.changeValue(\`\${
|
|
762
|
+
this.changeValue(this.parse(\`\${
|
|
765
763
|
this.displayValue.slice(0, this.cursor - 1)
|
|
766
764
|
}\${
|
|
767
765
|
this.displayValue.slice(this.cursor)
|
|
768
|
-
}\`);
|
|
766
|
+
}\`));
|
|
769
767
|
|
|
770
768
|
if (this.isCursorAtStart) {
|
|
771
769
|
this.cursorOffset = 0;
|
|
@@ -785,11 +783,11 @@ function BasePromptDeclarations() {
|
|
|
785
783
|
return this.bell();
|
|
786
784
|
}
|
|
787
785
|
|
|
788
|
-
this.changeValue(\`\${
|
|
786
|
+
this.changeValue(this.parse(\`\${
|
|
789
787
|
this.displayValue.slice(0, this.cursor)
|
|
790
788
|
}\${
|
|
791
789
|
this.displayValue.slice(this.cursor + 1)
|
|
792
|
-
}\`);
|
|
790
|
+
}\`));
|
|
793
791
|
|
|
794
792
|
if (this.isCursorAtEnd) {
|
|
795
793
|
this.cursorOffset = 0;
|
|
@@ -835,7 +833,7 @@ function BasePromptDeclarations() {
|
|
|
835
833
|
children: __alloy_js_core.code`this.cursorOffset = 0;
|
|
836
834
|
this.cursor = this.displayValue.length;
|
|
837
835
|
|
|
838
|
-
await this.
|
|
836
|
+
await this.checkValidations(this.value);
|
|
839
837
|
if (this.isError) {
|
|
840
838
|
this.sync();
|
|
841
839
|
this.bell();
|
|
@@ -1086,7 +1084,7 @@ function TextPromptDeclarations() {
|
|
|
1086
1084
|
"protected": true,
|
|
1087
1085
|
parameters: [{
|
|
1088
1086
|
name: "previousValue",
|
|
1089
|
-
type: "
|
|
1087
|
+
type: "string"
|
|
1090
1088
|
}],
|
|
1091
1089
|
children: __alloy_js_core.code`this.#isInvalid = false;
|
|
1092
1090
|
this.cursor = this.displayValue.slice(0, this.cursor).length + 1; `
|
|
@@ -1103,11 +1101,11 @@ function TextPromptDeclarations() {
|
|
|
1103
1101
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1104
1102
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1105
1103
|
doc: "A method to validate the prompt input",
|
|
1106
|
-
name: "
|
|
1104
|
+
name: "checkValidations",
|
|
1107
1105
|
override: true,
|
|
1108
1106
|
async: true,
|
|
1109
1107
|
"protected": true,
|
|
1110
|
-
children: __alloy_js_core.code`await super.
|
|
1108
|
+
children: __alloy_js_core.code`await super.checkValidations(this.value);
|
|
1111
1109
|
this.#isInvalid = this.isError; `
|
|
1112
1110
|
}),
|
|
1113
1111
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -1836,17 +1834,17 @@ function NumericPromptDeclarations() {
|
|
|
1836
1834
|
}
|
|
1837
1835
|
|
|
1838
1836
|
if (config.parse) {
|
|
1839
|
-
this.
|
|
1837
|
+
this.parse = config.parse.bind(this);
|
|
1840
1838
|
} else {
|
|
1841
|
-
const
|
|
1842
|
-
this.
|
|
1839
|
+
const parse = (value: string) => this.isFloat ? Math.round(Math.pow(10, this.precision) * Number.parseFloat(value)) / Math.pow(10, this.precision) : Number.parseInt(value);
|
|
1840
|
+
this.parse = parse.bind(this);
|
|
1843
1841
|
}
|
|
1844
1842
|
|
|
1845
1843
|
if (config.validate) {
|
|
1846
|
-
this.
|
|
1844
|
+
this.validate = config.validate.bind(this);
|
|
1847
1845
|
} else {
|
|
1848
|
-
const
|
|
1849
|
-
this.
|
|
1846
|
+
const validate = (value: number) => !Number.isNaN(value) && value >= this.min && value <= this.max;
|
|
1847
|
+
this.validate = validate.bind(this);
|
|
1850
1848
|
}
|
|
1851
1849
|
|
|
1852
1850
|
this.changeValue(this.initialValue);
|
|
@@ -1882,7 +1880,7 @@ function NumericPromptDeclarations() {
|
|
|
1882
1880
|
this.displayValue.slice(this.cursor)
|
|
1883
1881
|
}\`;
|
|
1884
1882
|
|
|
1885
|
-
let value = this.
|
|
1883
|
+
let value = this.parse(displayValue);
|
|
1886
1884
|
if (!Number.isNaN(value)) {
|
|
1887
1885
|
|
|
1888
1886
|
value = Math.min(value, this.max);
|
|
@@ -1905,7 +1903,7 @@ function NumericPromptDeclarations() {
|
|
|
1905
1903
|
"protected": true,
|
|
1906
1904
|
parameters: [{
|
|
1907
1905
|
name: "previousValue",
|
|
1908
|
-
type: "
|
|
1906
|
+
type: "number"
|
|
1909
1907
|
}],
|
|
1910
1908
|
children: __alloy_js_core.code`this.#isInvalid = false;
|
|
1911
1909
|
this.cursor = this.displayValue.slice(0, this.cursor).length + 1; `
|
|
@@ -1913,11 +1911,11 @@ function NumericPromptDeclarations() {
|
|
|
1913
1911
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1914
1912
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1915
1913
|
doc: "A method to validate the prompt input",
|
|
1916
|
-
name: "
|
|
1914
|
+
name: "checkValidations",
|
|
1917
1915
|
override: true,
|
|
1918
1916
|
async: true,
|
|
1919
1917
|
"protected": true,
|
|
1920
|
-
children: __alloy_js_core.code`await super.
|
|
1918
|
+
children: __alloy_js_core.code`await super.checkValidations(this.value);
|
|
1921
1919
|
this.#isInvalid = this.isError; `
|
|
1922
1920
|
}),
|
|
1923
1921
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -2503,16 +2501,14 @@ function ConfirmPromptDeclarations() {
|
|
|
2503
2501
|
}
|
|
2504
2502
|
|
|
2505
2503
|
if (char.toLowerCase() === "y" || char.toLowerCase() === "t" || char.toLowerCase() === "0") {
|
|
2506
|
-
this.
|
|
2504
|
+
this.changeValue(true);
|
|
2507
2505
|
return this.submit();
|
|
2508
2506
|
} else if (char.toLowerCase() === "n" || char.toLowerCase() === "f" || char.toLowerCase() === "1") {
|
|
2509
|
-
this.
|
|
2507
|
+
this.changeValue(false);
|
|
2510
2508
|
return this.submit();
|
|
2511
2509
|
} else {
|
|
2512
2510
|
return this.bell();
|
|
2513
|
-
}
|
|
2514
|
-
|
|
2515
|
-
this.sync(); `
|
|
2511
|
+
} `
|
|
2516
2512
|
}),
|
|
2517
2513
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2518
2514
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
@@ -2654,6 +2650,50 @@ run(); ` }),
|
|
|
2654
2650
|
})
|
|
2655
2651
|
];
|
|
2656
2652
|
}
|
|
2653
|
+
function WaitForKeyPressDeclaration() {
|
|
2654
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2655
|
+
heading: "A function to create and run a wait-for-key-press prompt, which returns a promise that resolves when any key is pressed or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled.",
|
|
2656
|
+
get children() {
|
|
2657
|
+
return [
|
|
2658
|
+
(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 Prompt class with a custom onKeyPress handler that resolves the promise when any key is pressed. It sets up event listeners for state updates and cancellation to handle the prompt interactions and return the appropriate results. The wait-for-key-press prompt is useful for scenarios where you want to pause execution until the user presses any key, such as waiting for user input before proceeding with a task.` }),
|
|
2659
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2660
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { waitForKeyPress } from "shell-shock:prompts";
|
|
2661
|
+
|
|
2662
|
+
async function run() {
|
|
2663
|
+
const result = await waitForKeyPress();
|
|
2664
|
+
console.log("A key was pressed!");
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
run(); ` }),
|
|
2668
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2669
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
2670
|
+
name: "timeout",
|
|
2671
|
+
children: `The amount of time in milliseconds to wait before automatically resolving the prompt, defaults to 2 hours (7200000 ms)`
|
|
2672
|
+
}),
|
|
2673
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves when any key is pressed` })
|
|
2674
|
+
];
|
|
2675
|
+
}
|
|
2676
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
2677
|
+
name: "waitForKeyPress",
|
|
2678
|
+
"export": true,
|
|
2679
|
+
parameters: [{
|
|
2680
|
+
name: "timeout",
|
|
2681
|
+
default: "7200000"
|
|
2682
|
+
}],
|
|
2683
|
+
children: __alloy_js_core.code`process.stdin.setRawMode(true);
|
|
2684
|
+
return new Promise(resolve => process.stdin.once("data", () => {
|
|
2685
|
+
if (timeout >= 0) {
|
|
2686
|
+
setTimeout(() => {
|
|
2687
|
+
process.stdin.setRawMode(false);
|
|
2688
|
+
resolve(void 0);
|
|
2689
|
+
}, timeout);
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2692
|
+
process.stdin.setRawMode(false);
|
|
2693
|
+
resolve(void 0);
|
|
2694
|
+
})); `
|
|
2695
|
+
})];
|
|
2696
|
+
}
|
|
2657
2697
|
/**
|
|
2658
2698
|
* A built-in prompts module for Shell Shock.
|
|
2659
2699
|
*/
|
|
@@ -2707,6 +2747,8 @@ function PromptsBuiltin(props) {
|
|
|
2707
2747
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2708
2748
|
(0, __alloy_js_core_jsx_runtime.createComponent)(ConfirmPromptDeclarations, {}),
|
|
2709
2749
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2750
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(WaitForKeyPressDeclaration, {}),
|
|
2751
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2710
2752
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
2711
2753
|
get when() {
|
|
2712
2754
|
return Boolean(children);
|
|
@@ -2726,4 +2768,5 @@ exports.PasswordPromptDeclaration = PasswordPromptDeclaration;
|
|
|
2726
2768
|
exports.PromptsBuiltin = PromptsBuiltin;
|
|
2727
2769
|
exports.SelectPromptDeclarations = SelectPromptDeclarations;
|
|
2728
2770
|
exports.TextPromptDeclarations = TextPromptDeclarations;
|
|
2729
|
-
exports.TogglePromptDeclarations = TogglePromptDeclarations;
|
|
2771
|
+
exports.TogglePromptDeclarations = TogglePromptDeclarations;
|
|
2772
|
+
exports.WaitForKeyPressDeclaration = WaitForKeyPressDeclaration;
|
|
@@ -31,10 +31,11 @@ declare function ConfirmPromptDeclarations(): _alloy_js_core0.Children;
|
|
|
31
31
|
* 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.
|
|
32
32
|
*/
|
|
33
33
|
declare function PasswordPromptDeclaration(): _alloy_js_core0.Children;
|
|
34
|
+
declare function WaitForKeyPressDeclaration(): _alloy_js_core0.Children;
|
|
34
35
|
/**
|
|
35
36
|
* A built-in prompts module for Shell Shock.
|
|
36
37
|
*/
|
|
37
38
|
declare function PromptsBuiltin(props: PromptsBuiltinProps): _alloy_js_core0.Children;
|
|
38
39
|
//#endregion
|
|
39
|
-
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
|
|
40
|
+
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations, WaitForKeyPressDeclaration };
|
|
40
41
|
//# 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":";;;;UA8CiB,mBAAA,SAA4B,KAC3C;;AADF;AAQA;
|
|
1
|
+
{"version":3,"file":"prompts-builtin.d.cts","names":[],"sources":["../../src/components/prompts-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA8CiB,mBAAA,SAA4B,KAC3C;;AADF;AAQA;AA21BgB,iBA31BA,sBAAA,CAAA,CA21BsB,EA31BA,eAAA,CAAA,QA21BA;AAoPtC;AAobA;AAyVA;AA4OgB,iBA7uCA,sBAAA,CAAA,CA6uCyB,EA7uCH,eAAA,CAAA,QA6uCG;AA4LzC;AAmEA;AAuDA;iBA/yCgB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAobxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAyVzB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBA4OxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA4LzB,yBAAA,CAAA,GAAyB,eAAA,CAAA;iBAmEzB,0BAAA,CAAA,GAA0B,eAAA,CAAA;;;;iBAuD1B,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
|
|
@@ -31,10 +31,11 @@ declare function ConfirmPromptDeclarations(): _alloy_js_core0.Children;
|
|
|
31
31
|
* 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.
|
|
32
32
|
*/
|
|
33
33
|
declare function PasswordPromptDeclaration(): _alloy_js_core0.Children;
|
|
34
|
+
declare function WaitForKeyPressDeclaration(): _alloy_js_core0.Children;
|
|
34
35
|
/**
|
|
35
36
|
* A built-in prompts module for Shell Shock.
|
|
36
37
|
*/
|
|
37
38
|
declare function PromptsBuiltin(props: PromptsBuiltinProps): _alloy_js_core0.Children;
|
|
38
39
|
//#endregion
|
|
39
|
-
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
|
|
40
|
+
export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations, WaitForKeyPressDeclaration };
|
|
40
41
|
//# 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":";;;;UA8CiB,mBAAA,SAA4B,KAC3C;;AADF;AAQA;
|
|
1
|
+
{"version":3,"file":"prompts-builtin.d.mts","names":[],"sources":["../../src/components/prompts-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA8CiB,mBAAA,SAA4B,KAC3C;;AADF;AAQA;AA21BgB,iBA31BA,sBAAA,CAAA,CA21BsB,EA31BA,eAAA,CAAA,QA21BA;AAoPtC;AAobA;AAyVA;AA4OgB,iBA7uCA,sBAAA,CAAA,CA6uCyB,EA7uCH,eAAA,CAAA,QA6uCG;AA4LzC;AAmEA;AAuDA;iBA/yCgB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAobxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAyVzB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBA4OxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA4LzB,yBAAA,CAAA,GAAyB,eAAA,CAAA;iBAmEzB,0BAAA,CAAA,GAA0B,eAAA,CAAA;;;;iBAuD1B,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
|