@shell-shock/preset-cli 0.6.0 → 0.7.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.
Files changed (45) hide show
  1. package/dist/components/banner-function-declaration.cjs +6 -6
  2. package/dist/components/banner-function-declaration.d.mts +2 -2
  3. package/dist/components/banner-function-declaration.d.mts.map +1 -1
  4. package/dist/components/banner-function-declaration.mjs +6 -6
  5. package/dist/components/banner-function-declaration.mjs.map +1 -1
  6. package/dist/components/command-entry.cjs +134 -127
  7. package/dist/components/command-entry.d.cts +2 -2
  8. package/dist/components/command-entry.d.cts.map +1 -1
  9. package/dist/components/command-entry.d.mts +2 -2
  10. package/dist/components/command-entry.d.mts.map +1 -1
  11. package/dist/components/command-entry.mjs +133 -126
  12. package/dist/components/command-entry.mjs.map +1 -1
  13. package/dist/components/command-router.d.cts +3 -3
  14. package/dist/components/command-router.d.cts.map +1 -1
  15. package/dist/components/prompts-builtin.cjs +35 -10
  16. package/dist/components/prompts-builtin.d.cts +9 -9
  17. package/dist/components/prompts-builtin.d.cts.map +1 -1
  18. package/dist/components/prompts-builtin.d.mts +9 -9
  19. package/dist/components/prompts-builtin.d.mts.map +1 -1
  20. package/dist/components/prompts-builtin.mjs +46 -21
  21. package/dist/components/prompts-builtin.mjs.map +1 -1
  22. package/dist/components/virtual-command-entry.cjs +3 -3
  23. package/dist/components/virtual-command-entry.d.cts +2 -2
  24. package/dist/components/virtual-command-entry.mjs +2 -2
  25. package/dist/index.cjs +2 -0
  26. package/dist/index.d.cts.map +1 -1
  27. package/dist/index.d.mts.map +1 -1
  28. package/dist/index.mjs +2 -0
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/plugin-upgrade/dist/components/index.cjs +2 -0
  31. package/dist/plugin-upgrade/dist/components/index.mjs +4 -0
  32. package/dist/plugin-upgrade/dist/components/upgrade-builtin.cjs +661 -0
  33. package/dist/plugin-upgrade/dist/components/upgrade-builtin.mjs +655 -0
  34. package/dist/plugin-upgrade/dist/components/upgrade-builtin.mjs.map +1 -0
  35. package/dist/plugin-upgrade/dist/components/upgrade-command.cjs +96 -0
  36. package/dist/plugin-upgrade/dist/components/upgrade-command.mjs +96 -0
  37. package/dist/plugin-upgrade/dist/components/upgrade-command.mjs.map +1 -0
  38. package/dist/plugin-upgrade/dist/index.cjs +49 -0
  39. package/dist/plugin-upgrade/dist/index.mjs +49 -0
  40. package/dist/plugin-upgrade/dist/index.mjs.map +1 -0
  41. package/dist/types/plugin.d.cts +6 -10
  42. package/dist/types/plugin.d.cts.map +1 -1
  43. package/dist/types/plugin.d.mts +6 -10
  44. package/dist/types/plugin.d.mts.map +1 -1
  45. package/package.json +10 -10
@@ -2,15 +2,15 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
3
  let __alloy_js_core = require("@alloy-js/core");
4
4
  let __alloy_js_typescript = require("@alloy-js/typescript");
5
- let __shell_shock_preset_script_contexts_theme = require("@shell-shock/preset-script/contexts/theme");
6
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
5
  let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
6
+ let __powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
8
7
  let defu = require("defu");
9
8
  defu = require_rolldown_runtime.__toESM(defu);
10
- let __powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
9
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
10
+ let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
+ let __shell_shock_preset_script_contexts_theme = require("@shell-shock/preset-script/contexts/theme");
11
12
  let __powerlines_plugin_alloy_typescript_components_class_declaration = require("@powerlines/plugin-alloy/typescript/components/class-declaration");
12
13
  let __powerlines_plugin_alloy_typescript_components_interface_declaration = require("@powerlines/plugin-alloy/typescript/components/interface-declaration");
13
- let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
14
14
  let __powerlines_plugin_alloy_typescript_components_type_declaration = require("@powerlines/plugin-alloy/typescript/components/type-declaration");
15
15
 
16
16
  //#region src/components/prompts-builtin.tsx
@@ -205,7 +205,14 @@ function BasePromptDeclarations() {
205
205
  name: "mask",
206
206
  optional: true,
207
207
  type: "(input: string) => string",
208
- doc: "A function that masks the input value and returns the masked result or throws an error if the input is invalid"
208
+ doc: "A function that masks the input value and returns the masked result. This can be used to create password inputs or other sensitive input types where the actual input value should not be displayed. If not provided, the prompt will display the input as is without masking."
209
+ }),
210
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
211
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
212
+ name: "maskSubmitted",
213
+ optional: true,
214
+ type: "(input: string) => string",
215
+ doc: "A function that masks the value submitted by the user so that it can then be used in the console output or elsewhere without exposing sensitive information. If not provided, the prompt will use the same mask function for both input and submitted value masking."
209
216
  }),
210
217
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
211
218
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
@@ -321,6 +328,7 @@ function BasePromptDeclarations() {
321
328
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
322
329
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
323
330
  name: "isInitial",
331
+ "protected": true,
324
332
  type: "boolean",
325
333
  children: __alloy_js_core.code`true; `
326
334
  }),
@@ -374,6 +382,12 @@ function BasePromptDeclarations() {
374
382
  children: __alloy_js_core.code`noMask; `
375
383
  }),
376
384
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
385
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
386
+ name: "maskSubmitted",
387
+ "protected": true,
388
+ type: "(input: string) => string"
389
+ }),
390
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
377
391
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
378
392
  name: "cursor",
379
393
  "protected": true,
@@ -420,6 +434,16 @@ function BasePromptDeclarations() {
420
434
  this.formatter = config.format.bind(this);
421
435
  }
422
436
 
437
+ if (config.maskSubmitted) {
438
+ this.maskSubmitted = config.maskSubmitted;
439
+ }
440
+ if (config.mask) {
441
+ this.mask = config.mask;
442
+ }
443
+ if (!this.maskSubmitted) {
444
+ this.maskSubmitted = this.mask;
445
+ }
446
+
423
447
  if (config.timeout !== undefined && !Number.isNaN(config.timeout)) {
424
448
  setTimeout(() => {
425
449
  if (!this.isCompleted) {
@@ -509,7 +533,7 @@ function BasePromptDeclarations() {
509
533
  updatedValue = value;
510
534
  }
511
535
 
512
- this.displayValue = this.formatter(updatedValue);
536
+ this.displayValue = this.mask(this.formatter(updatedValue));
513
537
  this.#value = updatedValue;
514
538
  setTimeout(() => {
515
539
  Promise.resolve(this.validate(updatedValue)).then(() => this.sync());
@@ -763,7 +787,7 @@ function BasePromptDeclarations() {
763
787
  : this.isError
764
788
  ? colors.text.prompt.input.error(this.displayValue)
765
789
  : this.isSubmitted
766
- ? colors.text.prompt.input.submitted(this.displayValue)
790
+ ? colors.text.prompt.input.submitted(this.maskSubmitted(this.displayValue))
767
791
  : this.isCancelled
768
792
  ? colors.text.prompt.input.cancelled(this.displayValue)
769
793
  : colors.bold(colors.text.prompt.input.active(this.displayValue)); `
@@ -2581,7 +2605,7 @@ function PasswordPromptDeclaration() {
2581
2605
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
2582
2606
  name: "PasswordConfig",
2583
2607
  "export": true,
2584
- children: __alloy_js_core.code`Omit<TextConfig, "mask">; `
2608
+ children: __alloy_js_core.code`Omit<TextConfig, "mask" | "maskSubmitted">; `
2585
2609
  }),
2586
2610
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2587
2611
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
@@ -2624,7 +2648,8 @@ run(); ` }),
2624
2648
  returnType: "Promise<string | symbol>",
2625
2649
  children: __alloy_js_core.code`return text({
2626
2650
  ...config,
2627
- mask: passwordMask
2651
+ mask: passwordMask,
2652
+ maskSubmitted: () => "*******"
2628
2653
  });`
2629
2654
  })
2630
2655
  ];
@@ -2636,7 +2661,7 @@ function PromptsBuiltin(props) {
2636
2661
  const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
2637
2662
  return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({
2638
2663
  id: "prompts",
2639
- description: "A collection of prompts that allow for interactive input in command line applications."
2664
+ description: "A collection of prompts that allow for interactive input in command-line applications."
2640
2665
  }, rest, {
2641
2666
  get imports() {
2642
2667
  return (0, defu.default)(rest.imports ?? {}, {
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core3 from "@alloy-js/core";
1
+ import * as _alloy_js_core2 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,35 +6,35 @@ 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(): _alloy_js_core3.Children;
9
+ declare function BasePromptDeclarations(): _alloy_js_core2.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(): _alloy_js_core3.Children;
13
+ declare function TextPromptDeclarations(): _alloy_js_core2.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(): _alloy_js_core3.Children;
17
+ declare function SelectPromptDeclarations(): _alloy_js_core2.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(): _alloy_js_core3.Children;
21
+ declare function NumericPromptDeclarations(): _alloy_js_core2.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(): _alloy_js_core3.Children;
25
+ declare function TogglePromptDeclarations(): _alloy_js_core2.Children;
26
26
  /**
27
27
  * A component that renders the declarations for the built-in confirm 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 ConfirmPrompt class extends the base Prompt class and implements specific logic for handling boolean input and rendering interactions.
28
28
  */
29
- declare function ConfirmPromptDeclarations(): _alloy_js_core3.Children;
29
+ declare function ConfirmPromptDeclarations(): _alloy_js_core2.Children;
30
30
  /**
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
- declare function PasswordPromptDeclaration(): _alloy_js_core3.Children;
33
+ declare function PasswordPromptDeclaration(): _alloy_js_core2.Children;
34
34
  /**
35
35
  * A built-in prompts module for Shell Shock.
36
36
  */
37
- declare function PromptsBuiltin(props: PromptsBuiltinProps): _alloy_js_core3.Children;
37
+ declare function PromptsBuiltin(props: PromptsBuiltinProps): _alloy_js_core2.Children;
38
38
  //#endregion
39
39
  export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
40
40
  //# 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;AA4sBgB,iBA5sBA,sBAAA,CAAA,CA4sBsB,EA5sBA,eAAA,CAAA,QA4sBA;AA4TtC;AAmbA;AA2YA;AA4OgB,iBAt2CA,sBAAA,CAAA,CAs2CyB,EAt2CH,eAAA,CAAA,QAs2CG;AA8LzC;AAqEA;;iBA7yCgB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAmbxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA2YzB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBA4OxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA8LzB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAqEzB,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
1
+ {"version":3,"file":"prompts-builtin.d.cts","names":[],"sources":["../../src/components/prompts-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA8CiB,mBAAA,SAA4B,KAC3C;;AADF;AAQA;AAmuBgB,iBAnuBA,sBAAA,CAAA,CAmuBsB,EAnuBA,eAAA,CAAA,QAmuBA;AA4TtC;AAmbA;AA2YA;AA4OgB,iBAt2CA,sBAAA,CAAA,CAs2CyB,EAt2CH,eAAA,CAAA,QAs2CG;AA8LzC;AAsEA;;iBA9yCgB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAmbxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA2YzB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBA4OxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA8LzB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAsEzB,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core2 from "@alloy-js/core";
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,35 +6,35 @@ 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(): _alloy_js_core2.Children;
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(): _alloy_js_core2.Children;
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(): _alloy_js_core2.Children;
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(): _alloy_js_core2.Children;
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(): _alloy_js_core2.Children;
25
+ declare function TogglePromptDeclarations(): _alloy_js_core4.Children;
26
26
  /**
27
27
  * A component that renders the declarations for the built-in confirm 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 ConfirmPrompt class extends the base Prompt class and implements specific logic for handling boolean input and rendering interactions.
28
28
  */
29
- declare function ConfirmPromptDeclarations(): _alloy_js_core2.Children;
29
+ declare function ConfirmPromptDeclarations(): _alloy_js_core4.Children;
30
30
  /**
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
- declare function PasswordPromptDeclaration(): _alloy_js_core2.Children;
33
+ declare function PasswordPromptDeclaration(): _alloy_js_core4.Children;
34
34
  /**
35
35
  * A built-in prompts module for Shell Shock.
36
36
  */
37
- declare function PromptsBuiltin(props: PromptsBuiltinProps): _alloy_js_core2.Children;
37
+ declare function PromptsBuiltin(props: PromptsBuiltinProps): _alloy_js_core4.Children;
38
38
  //#endregion
39
39
  export { BasePromptDeclarations, ConfirmPromptDeclarations, NumericPromptDeclarations, PasswordPromptDeclaration, PromptsBuiltin, PromptsBuiltinProps, SelectPromptDeclarations, TextPromptDeclarations, TogglePromptDeclarations };
40
40
  //# 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;AA4sBgB,iBA5sBA,sBAAA,CAAA,CA4sBsB,EA5sBA,eAAA,CAAA,QA4sBA;AA4TtC;AAmbA;AA2YA;AA4OgB,iBAt2CA,sBAAA,CAAA,CAs2CyB,EAt2CH,eAAA,CAAA,QAs2CG;AA8LzC;AAqEA;;iBA7yCgB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAmbxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA2YzB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBA4OxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA8LzB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAqEzB,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
1
+ {"version":3,"file":"prompts-builtin.d.mts","names":[],"sources":["../../src/components/prompts-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA8CiB,mBAAA,SAA4B,KAC3C;;AADF;AAQA;AAmuBgB,iBAnuBA,sBAAA,CAAA,CAmuBsB,EAnuBA,eAAA,CAAA,QAmuBA;AA4TtC;AAmbA;AA2YA;AA4OgB,iBAt2CA,sBAAA,CAAA,CAs2CyB,EAt2CH,eAAA,CAAA,QAs2CG;AA8LzC;AAsEA;;iBA9yCgB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBAmbxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA2YzB,wBAAA,CAAA,GAAwB,eAAA,CAAA;;;;iBA4OxB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA8LzB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBAsEzB,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
@@ -1,14 +1,14 @@
1
1
  import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
2
2
  import { Show, code, splitProps } from "@alloy-js/core";
3
3
  import { FunctionDeclaration, VarDeclaration } from "@alloy-js/typescript";
4
- import { useTheme } from "@shell-shock/preset-script/contexts/theme";
5
- import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
6
4
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
7
- import defu from "defu";
8
5
  import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
9
- import { ClassDeclaration, ClassField, ClassMethod, ClassPropertyGet } from "@powerlines/plugin-alloy/typescript/components/class-declaration";
10
- import { InterfaceDeclaration, InterfaceMember } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
6
+ import defu from "defu";
7
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
11
8
  import { TSDoc, TSDocDefaultValue, TSDocExample, TSDocParam, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
9
+ import { useTheme } from "@shell-shock/preset-script/contexts/theme";
10
+ import { ClassDeclaration, ClassField, ClassMethod, ClassPropertyGet } from "@powerlines/plugin-alloy/typescript/components/class-declaration";
11
+ import { InterfaceDeclaration as InterfaceDeclaration$1, InterfaceMember } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
12
12
  import { TypeDeclaration } from "@powerlines/plugin-alloy/typescript/components/type-declaration";
13
13
 
14
14
  //#region src/components/prompts-builtin.tsx
@@ -84,7 +84,7 @@ function BasePromptDeclarations() {
84
84
  children: code`return " ".repeat(input.length); `
85
85
  }),
86
86
  createComponent(Spacing, {}),
87
- createComponent(InterfaceDeclaration, {
87
+ createComponent(InterfaceDeclaration$1, {
88
88
  "export": true,
89
89
  name: "PromptState",
90
90
  doc: "The current state of a prompt",
@@ -135,7 +135,7 @@ function BasePromptDeclarations() {
135
135
  }
136
136
  }),
137
137
  createComponent(Spacing, {}),
138
- createComponent(InterfaceDeclaration, {
138
+ createComponent(InterfaceDeclaration$1, {
139
139
  name: "PromptConfig",
140
140
  doc: "Configuration options for creating a prompt",
141
141
  typeParameters: [{
@@ -203,7 +203,14 @@ function BasePromptDeclarations() {
203
203
  name: "mask",
204
204
  optional: true,
205
205
  type: "(input: string) => string",
206
- doc: "A function that masks the input value and returns the masked result or throws an error if the input is invalid"
206
+ doc: "A function that masks the input value and returns the masked result. This can be used to create password inputs or other sensitive input types where the actual input value should not be displayed. If not provided, the prompt will display the input as is without masking."
207
+ }),
208
+ createComponent(Spacing, {}),
209
+ createComponent(InterfaceMember, {
210
+ name: "maskSubmitted",
211
+ optional: true,
212
+ type: "(input: string) => string",
213
+ doc: "A function that masks the value submitted by the user so that it can then be used in the console output or elsewhere without exposing sensitive information. If not provided, the prompt will use the same mask function for both input and submitted value masking."
207
214
  }),
208
215
  createComponent(Spacing, {}),
209
216
  createComponent(InterfaceMember, {
@@ -319,6 +326,7 @@ function BasePromptDeclarations() {
319
326
  createIntrinsic("hbr", {}),
320
327
  createComponent(ClassField, {
321
328
  name: "isInitial",
329
+ "protected": true,
322
330
  type: "boolean",
323
331
  children: code`true; `
324
332
  }),
@@ -372,6 +380,12 @@ function BasePromptDeclarations() {
372
380
  children: code`noMask; `
373
381
  }),
374
382
  createIntrinsic("hbr", {}),
383
+ createComponent(ClassField, {
384
+ name: "maskSubmitted",
385
+ "protected": true,
386
+ type: "(input: string) => string"
387
+ }),
388
+ createIntrinsic("hbr", {}),
375
389
  createComponent(ClassField, {
376
390
  name: "cursor",
377
391
  "protected": true,
@@ -418,6 +432,16 @@ function BasePromptDeclarations() {
418
432
  this.formatter = config.format.bind(this);
419
433
  }
420
434
 
435
+ if (config.maskSubmitted) {
436
+ this.maskSubmitted = config.maskSubmitted;
437
+ }
438
+ if (config.mask) {
439
+ this.mask = config.mask;
440
+ }
441
+ if (!this.maskSubmitted) {
442
+ this.maskSubmitted = this.mask;
443
+ }
444
+
421
445
  if (config.timeout !== undefined && !Number.isNaN(config.timeout)) {
422
446
  setTimeout(() => {
423
447
  if (!this.isCompleted) {
@@ -507,7 +531,7 @@ function BasePromptDeclarations() {
507
531
  updatedValue = value;
508
532
  }
509
533
 
510
- this.displayValue = this.formatter(updatedValue);
534
+ this.displayValue = this.mask(this.formatter(updatedValue));
511
535
  this.#value = updatedValue;
512
536
  setTimeout(() => {
513
537
  Promise.resolve(this.validate(updatedValue)).then(() => this.sync());
@@ -761,7 +785,7 @@ function BasePromptDeclarations() {
761
785
  : this.isError
762
786
  ? colors.text.prompt.input.error(this.displayValue)
763
787
  : this.isSubmitted
764
- ? colors.text.prompt.input.submitted(this.displayValue)
788
+ ? colors.text.prompt.input.submitted(this.maskSubmitted(this.displayValue))
765
789
  : this.isCancelled
766
790
  ? colors.text.prompt.input.cancelled(this.displayValue)
767
791
  : colors.bold(colors.text.prompt.input.active(this.displayValue)); `
@@ -770,7 +794,7 @@ function BasePromptDeclarations() {
770
794
  }
771
795
  }),
772
796
  createComponent(Spacing, {}),
773
- createComponent(InterfaceDeclaration, {
797
+ createComponent(InterfaceDeclaration$1, {
774
798
  name: "PromptFactoryConfig",
775
799
  "extends": "PromptConfig<TValue>",
776
800
  doc: "Configuration options for creating a prompt with a prompt factory function",
@@ -837,7 +861,7 @@ function BasePromptDeclarations() {
837
861
  */
838
862
  function TextPromptDeclarations() {
839
863
  return [
840
- createComponent(InterfaceDeclaration, {
864
+ createComponent(InterfaceDeclaration$1, {
841
865
  name: "StringPromptConfig",
842
866
  "extends": "PromptConfig<string>",
843
867
  doc: "Configuration options for creating a text-based prompt",
@@ -1160,7 +1184,7 @@ run(); ` }),
1160
1184
  */
1161
1185
  function SelectPromptDeclarations() {
1162
1186
  return [
1163
- createComponent(InterfaceDeclaration, {
1187
+ createComponent(InterfaceDeclaration$1, {
1164
1188
  name: "PromptOptionConfig",
1165
1189
  doc: "Configuration for an option the user can select from the select prompt",
1166
1190
  typeParameters: [{
@@ -1213,7 +1237,7 @@ function SelectPromptDeclarations() {
1213
1237
  }
1214
1238
  }),
1215
1239
  createComponent(Spacing, {}),
1216
- createComponent(InterfaceDeclaration, {
1240
+ createComponent(InterfaceDeclaration$1, {
1217
1241
  "export": true,
1218
1242
  name: "PromptOption",
1219
1243
  "extends": "PromptOptionConfig<TValue>",
@@ -1250,7 +1274,7 @@ function SelectPromptDeclarations() {
1250
1274
  }
1251
1275
  }),
1252
1276
  createComponent(Spacing, {}),
1253
- createComponent(InterfaceDeclaration, {
1277
+ createComponent(InterfaceDeclaration$1, {
1254
1278
  name: "SelectPromptConfig",
1255
1279
  "extends": "PromptConfig<TValue>",
1256
1280
  doc: "An options object for configuring a select prompt",
@@ -1624,7 +1648,7 @@ run(); ` }),
1624
1648
  */
1625
1649
  function NumericPromptDeclarations() {
1626
1650
  return [
1627
- createComponent(InterfaceDeclaration, {
1651
+ createComponent(InterfaceDeclaration$1, {
1628
1652
  name: "NumberPromptConfig",
1629
1653
  "extends": "PromptConfig<number>",
1630
1654
  doc: "Configuration options for creating a numeric prompt",
@@ -2053,7 +2077,7 @@ run(); ` }),
2053
2077
  */
2054
2078
  function TogglePromptDeclarations() {
2055
2079
  return [
2056
- createComponent(InterfaceDeclaration, {
2080
+ createComponent(InterfaceDeclaration$1, {
2057
2081
  "export": true,
2058
2082
  name: "TogglePromptConfig",
2059
2083
  "extends": "PromptConfig<boolean>",
@@ -2307,7 +2331,7 @@ run(); ` }),
2307
2331
  */
2308
2332
  function ConfirmPromptDeclarations() {
2309
2333
  return [
2310
- createComponent(InterfaceDeclaration, {
2334
+ createComponent(InterfaceDeclaration$1, {
2311
2335
  "export": true,
2312
2336
  name: "ConfirmPromptConfig",
2313
2337
  "extends": "PromptConfig<boolean>",
@@ -2579,7 +2603,7 @@ function PasswordPromptDeclaration() {
2579
2603
  createComponent(TypeDeclaration, {
2580
2604
  name: "PasswordConfig",
2581
2605
  "export": true,
2582
- children: code`Omit<TextConfig, "mask">; `
2606
+ children: code`Omit<TextConfig, "mask" | "maskSubmitted">; `
2583
2607
  }),
2584
2608
  createComponent(Spacing, {}),
2585
2609
  createComponent(TSDoc, {
@@ -2622,7 +2646,8 @@ run(); ` }),
2622
2646
  returnType: "Promise<string | symbol>",
2623
2647
  children: code`return text({
2624
2648
  ...config,
2625
- mask: passwordMask
2649
+ mask: passwordMask,
2650
+ maskSubmitted: () => "*******"
2626
2651
  });`
2627
2652
  })
2628
2653
  ];
@@ -2634,7 +2659,7 @@ function PromptsBuiltin(props) {
2634
2659
  const [{ children }, rest] = splitProps(props, ["children"]);
2635
2660
  return createComponent(BuiltinFile, mergeProps({
2636
2661
  id: "prompts",
2637
- description: "A collection of prompts that allow for interactive input in command line applications."
2662
+ description: "A collection of prompts that allow for interactive input in command-line applications."
2638
2663
  }, rest, {
2639
2664
  get imports() {
2640
2665
  return defu(rest.imports ?? {}, {