@shell-shock/plugin-prompts 0.3.8 → 0.3.12
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/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/prompts-builtin.cjs +632 -631
- 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.map +1 -1
- package/dist/index.cjs +9 -10
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +11 -11
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
let
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
|
+
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
7
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
|
+
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
9
|
+
let _powerlines_plugin_alloy_typescript_components_class_declaration = require("@powerlines/plugin-alloy/typescript/components/class-declaration");
|
|
10
|
+
let _powerlines_plugin_alloy_typescript_components_interface_declaration = require("@powerlines/plugin-alloy/typescript/components/interface-declaration");
|
|
11
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
12
|
+
let _powerlines_plugin_alloy_typescript_components_type_declaration = require("@powerlines/plugin-alloy/typescript/components/type-declaration");
|
|
13
|
+
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
13
14
|
let defu = require("defu");
|
|
14
|
-
defu =
|
|
15
|
+
defu = require_runtime.__toESM(defu);
|
|
15
16
|
|
|
16
17
|
//#region src/components/prompts-builtin.tsx
|
|
17
18
|
/**
|
|
18
19
|
* 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.
|
|
19
20
|
*/
|
|
20
21
|
function BasePromptDeclarations() {
|
|
21
|
-
const theme = (0,
|
|
22
|
+
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
22
23
|
return [
|
|
23
|
-
(0,
|
|
24
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
24
25
|
heading: "A utility function to pause execution for a specified duration, which can be used in prompt interactions to create delays or timeouts. The function returns a promise that resolves after the specified duration in milliseconds, allowing it to be used with async/await syntax for easier handling of asynchronous prompt logic.",
|
|
25
26
|
get children() {
|
|
26
|
-
return [(0,
|
|
27
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
27
28
|
name: "duration",
|
|
28
29
|
children: `The duration to sleep in milliseconds.`
|
|
29
|
-
}), (0,
|
|
30
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves after the specified duration, allowing for asynchronous delays in prompt interactions.` })];
|
|
30
31
|
}
|
|
31
32
|
}),
|
|
32
|
-
(0,
|
|
33
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
33
34
|
"export": true,
|
|
34
35
|
name: "sleep",
|
|
35
36
|
parameters: [{
|
|
@@ -37,10 +38,10 @@ function BasePromptDeclarations() {
|
|
|
37
38
|
type: "number"
|
|
38
39
|
}],
|
|
39
40
|
returnType: "Promise<void>",
|
|
40
|
-
children:
|
|
41
|
+
children: _alloy_js_core.code`return new Promise((resolve) => setTimeout(resolve, duration)); `
|
|
41
42
|
}),
|
|
42
|
-
(0,
|
|
43
|
-
(0,
|
|
43
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
44
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
|
|
44
45
|
"export": true,
|
|
45
46
|
name: "PromptParser",
|
|
46
47
|
typeParameters: [{
|
|
@@ -48,10 +49,10 @@ function BasePromptDeclarations() {
|
|
|
48
49
|
default: "string"
|
|
49
50
|
}],
|
|
50
51
|
doc: "A type for a custom prompt input parser, which can be used to create custom input styles for prompts. The function should return the parsed value for the given input string.",
|
|
51
|
-
children:
|
|
52
|
+
children: _alloy_js_core.code`(this: Prompt<TValue>, input: string) => TValue; `
|
|
52
53
|
}),
|
|
53
|
-
(0,
|
|
54
|
-
(0,
|
|
54
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
55
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
|
|
55
56
|
"export": true,
|
|
56
57
|
name: "PromptFormatter",
|
|
57
58
|
typeParameters: [{
|
|
@@ -59,10 +60,10 @@ function BasePromptDeclarations() {
|
|
|
59
60
|
default: "string"
|
|
60
61
|
}],
|
|
61
62
|
doc: "A type for a custom prompt input formatter, which can be used to create custom display styles for prompts. The function should return the formatted string to display for the given input value.",
|
|
62
|
-
children:
|
|
63
|
+
children: _alloy_js_core.code`(this: Prompt<TValue>, input: TValue) => string; `
|
|
63
64
|
}),
|
|
64
|
-
(0,
|
|
65
|
-
(0,
|
|
65
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
66
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
66
67
|
"export": true,
|
|
67
68
|
name: "noMask",
|
|
68
69
|
doc: "A built-in prompt mask function that just returns the input as is, making it invisible",
|
|
@@ -71,10 +72,10 @@ function BasePromptDeclarations() {
|
|
|
71
72
|
type: "string"
|
|
72
73
|
}],
|
|
73
74
|
returnType: "string",
|
|
74
|
-
children:
|
|
75
|
+
children: _alloy_js_core.code`return input; `
|
|
75
76
|
}),
|
|
76
|
-
(0,
|
|
77
|
-
(0,
|
|
77
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
78
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
78
79
|
"export": true,
|
|
79
80
|
name: "invisibleMask",
|
|
80
81
|
doc: "A built-in prompt mask function that makes input invisible",
|
|
@@ -83,10 +84,10 @@ function BasePromptDeclarations() {
|
|
|
83
84
|
type: "string"
|
|
84
85
|
}],
|
|
85
86
|
returnType: "string",
|
|
86
|
-
children:
|
|
87
|
+
children: _alloy_js_core.code`return " ".repeat(input.length); `
|
|
87
88
|
}),
|
|
88
|
-
(0,
|
|
89
|
-
(0,
|
|
89
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
90
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
90
91
|
"export": true,
|
|
91
92
|
name: "PromptState",
|
|
92
93
|
doc: "The current state of a prompt",
|
|
@@ -96,48 +97,48 @@ function BasePromptDeclarations() {
|
|
|
96
97
|
}],
|
|
97
98
|
get children() {
|
|
98
99
|
return [
|
|
99
|
-
(0,
|
|
100
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
100
101
|
name: "value",
|
|
101
102
|
type: "TValue",
|
|
102
103
|
doc: "The current value of the prompt"
|
|
103
104
|
}),
|
|
104
|
-
(0,
|
|
105
|
-
(0,
|
|
105
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
106
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
106
107
|
name: "isError",
|
|
107
108
|
type: "boolean",
|
|
108
109
|
doc: "Indicates whether the prompt is in an error state"
|
|
109
110
|
}),
|
|
110
|
-
(0,
|
|
111
|
-
(0,
|
|
111
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
112
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
112
113
|
name: "errorMessage",
|
|
113
114
|
optional: true,
|
|
114
115
|
type: "string",
|
|
115
116
|
doc: "If the prompt is in an error state, this will contain the error message to display"
|
|
116
117
|
}),
|
|
117
|
-
(0,
|
|
118
|
-
(0,
|
|
118
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
119
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
119
120
|
name: "isSubmitted",
|
|
120
121
|
type: "boolean",
|
|
121
122
|
doc: "Indicates whether the prompt is submitted"
|
|
122
123
|
}),
|
|
123
|
-
(0,
|
|
124
|
-
(0,
|
|
124
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
125
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
125
126
|
name: "isCancelled",
|
|
126
127
|
type: "boolean",
|
|
127
128
|
doc: "Indicates whether the prompt is cancelled"
|
|
128
129
|
}),
|
|
129
|
-
(0,
|
|
130
|
-
(0,
|
|
130
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
131
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
131
132
|
name: "isCompleted",
|
|
132
133
|
type: "boolean",
|
|
133
134
|
doc: "Indicates whether the prompt is completed, which can be used to indicate that the prompt interaction is finished regardless of whether it was submitted or cancelled"
|
|
134
135
|
}),
|
|
135
|
-
(0,
|
|
136
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
136
137
|
];
|
|
137
138
|
}
|
|
138
139
|
}),
|
|
139
|
-
(0,
|
|
140
|
-
(0,
|
|
140
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
141
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
141
142
|
name: "PromptConfig",
|
|
142
143
|
doc: "Configuration options for creating a prompt",
|
|
143
144
|
typeParameters: [{
|
|
@@ -146,83 +147,83 @@ function BasePromptDeclarations() {
|
|
|
146
147
|
}],
|
|
147
148
|
get children() {
|
|
148
149
|
return [
|
|
149
|
-
(0,
|
|
150
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
150
151
|
name: "input",
|
|
151
152
|
optional: true,
|
|
152
153
|
type: "NodeJS.ReadStream",
|
|
153
154
|
doc: "The readable stream to use for prompt input, defaults to process.stdin"
|
|
154
155
|
}),
|
|
155
|
-
(0,
|
|
156
|
-
(0,
|
|
156
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
157
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
157
158
|
name: "output",
|
|
158
159
|
optional: true,
|
|
159
160
|
type: "NodeJS.WriteStream",
|
|
160
161
|
doc: "The writable stream to use for prompt output, defaults to process.stdout"
|
|
161
162
|
}),
|
|
162
|
-
(0,
|
|
163
|
-
(0,
|
|
163
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
164
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
164
165
|
name: "message",
|
|
165
166
|
type: "string",
|
|
166
167
|
doc: "The prompt message to display"
|
|
167
168
|
}),
|
|
168
|
-
(0,
|
|
169
|
-
(0,
|
|
169
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
170
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
170
171
|
name: "description",
|
|
171
172
|
optional: true,
|
|
172
173
|
type: "string",
|
|
173
174
|
doc: "The prompt description message to display"
|
|
174
175
|
}),
|
|
175
|
-
(0,
|
|
176
|
-
(0,
|
|
176
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
177
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
177
178
|
name: "initialValue",
|
|
178
179
|
optional: true,
|
|
179
180
|
type: "TValue",
|
|
180
181
|
doc: "The initial value of the prompt"
|
|
181
182
|
}),
|
|
182
|
-
(0,
|
|
183
|
-
(0,
|
|
183
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
184
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
184
185
|
name: "validate",
|
|
185
186
|
optional: true,
|
|
186
187
|
type: "(value: TValue) => boolean | string | null | undefined | Promise<boolean | string | null | undefined>",
|
|
187
188
|
doc: "A validation function that returns true if the input is valid, false or a string error message if the input is invalid"
|
|
188
189
|
}),
|
|
189
|
-
(0,
|
|
190
|
-
(0,
|
|
190
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
191
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
191
192
|
name: "parse",
|
|
192
193
|
optional: true,
|
|
193
194
|
type: "PromptParser<TValue>",
|
|
194
195
|
doc: "A function that parses the input value and returns the parsed result or throws an error if the input is invalid"
|
|
195
196
|
}),
|
|
196
|
-
(0,
|
|
197
|
-
(0,
|
|
197
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
198
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
198
199
|
name: "format",
|
|
199
200
|
optional: true,
|
|
200
201
|
type: "PromptFormatter<TValue>",
|
|
201
202
|
doc: "A function that formats the input value and returns the formatted result or throws an error if the input is invalid"
|
|
202
203
|
}),
|
|
203
|
-
(0,
|
|
204
|
-
(0,
|
|
204
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
205
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
205
206
|
name: "mask",
|
|
206
207
|
optional: true,
|
|
207
208
|
type: "(input: string) => string",
|
|
208
209
|
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
|
}),
|
|
210
|
-
(0,
|
|
211
|
-
(0,
|
|
211
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
212
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
212
213
|
name: "maskCompleted",
|
|
213
214
|
optional: true,
|
|
214
215
|
type: "(input: string) => string",
|
|
215
216
|
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."
|
|
216
217
|
}),
|
|
217
|
-
(0,
|
|
218
|
-
(0,
|
|
218
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
219
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
219
220
|
name: "defaultErrorMessage",
|
|
220
221
|
optional: true,
|
|
221
222
|
type: "string",
|
|
222
223
|
doc: "The default error message to display when validation fails"
|
|
223
224
|
}),
|
|
224
|
-
(0,
|
|
225
|
-
(0,
|
|
225
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
226
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
226
227
|
name: "timeout",
|
|
227
228
|
optional: true,
|
|
228
229
|
type: "number",
|
|
@@ -231,8 +232,8 @@ function BasePromptDeclarations() {
|
|
|
231
232
|
];
|
|
232
233
|
}
|
|
233
234
|
}),
|
|
234
|
-
(0,
|
|
235
|
-
(0,
|
|
235
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
236
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassDeclaration, {
|
|
236
237
|
abstract: true,
|
|
237
238
|
name: "Prompt",
|
|
238
239
|
doc: "Base prompt class that other prompt types can extend from",
|
|
@@ -243,181 +244,181 @@ function BasePromptDeclarations() {
|
|
|
243
244
|
}],
|
|
244
245
|
get children() {
|
|
245
246
|
return [
|
|
246
|
-
(0,
|
|
247
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
247
248
|
name: "readline",
|
|
248
249
|
isPrivateMember: true,
|
|
249
250
|
type: "readline.Interface"
|
|
250
251
|
}),
|
|
251
|
-
(0,
|
|
252
|
-
(0,
|
|
252
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
253
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
253
254
|
name: "value",
|
|
254
255
|
isPrivateMember: true,
|
|
255
256
|
optional: true,
|
|
256
257
|
type: "TValue"
|
|
257
258
|
}),
|
|
258
|
-
(0,
|
|
259
|
-
(0,
|
|
259
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
260
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
260
261
|
name: "isKeyPressed",
|
|
261
262
|
isPrivateMember: true,
|
|
262
263
|
type: "boolean",
|
|
263
|
-
children:
|
|
264
|
+
children: _alloy_js_core.code`false; `
|
|
264
265
|
}),
|
|
265
|
-
(0,
|
|
266
|
-
(0,
|
|
266
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
267
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
267
268
|
name: "isDirty",
|
|
268
269
|
isPrivateMember: true,
|
|
269
270
|
type: "boolean",
|
|
270
|
-
children:
|
|
271
|
+
children: _alloy_js_core.code`false; `
|
|
271
272
|
}),
|
|
272
|
-
(0,
|
|
273
|
-
(0,
|
|
273
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
274
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
274
275
|
name: "isClosed",
|
|
275
276
|
isPrivateMember: true,
|
|
276
277
|
type: "boolean",
|
|
277
|
-
children:
|
|
278
|
+
children: _alloy_js_core.code`false; `
|
|
278
279
|
}),
|
|
279
|
-
(0,
|
|
280
|
-
(0,
|
|
280
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
281
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
281
282
|
name: "initialValue",
|
|
282
283
|
abstract: true,
|
|
283
284
|
"protected": true,
|
|
284
285
|
type: "TValue"
|
|
285
286
|
}),
|
|
286
|
-
(0,
|
|
287
|
-
(0,
|
|
287
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
288
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
288
289
|
name: "input",
|
|
289
290
|
"protected": true,
|
|
290
291
|
type: "NodeJS.ReadStream",
|
|
291
|
-
children:
|
|
292
|
+
children: _alloy_js_core.code`process.stdin; `
|
|
292
293
|
}),
|
|
293
|
-
(0,
|
|
294
|
-
(0,
|
|
294
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
295
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
295
296
|
name: "output",
|
|
296
297
|
"protected": true,
|
|
297
298
|
type: "NodeJS.WriteStream",
|
|
298
|
-
children:
|
|
299
|
+
children: _alloy_js_core.code`process.stdout; `
|
|
299
300
|
}),
|
|
300
|
-
(0,
|
|
301
|
-
(0,
|
|
301
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
302
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
302
303
|
name: "message",
|
|
303
304
|
"protected": true,
|
|
304
305
|
type: "string",
|
|
305
|
-
children:
|
|
306
|
+
children: _alloy_js_core.code`""; `
|
|
306
307
|
}),
|
|
307
|
-
(0,
|
|
308
|
-
(0,
|
|
308
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
309
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
309
310
|
name: "description",
|
|
310
311
|
"protected": true,
|
|
311
312
|
type: "string",
|
|
312
|
-
children:
|
|
313
|
+
children: _alloy_js_core.code`""; `
|
|
313
314
|
}),
|
|
314
|
-
(0,
|
|
315
|
-
(0,
|
|
315
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
316
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
316
317
|
name: "errorMessage",
|
|
317
318
|
"protected": true,
|
|
318
319
|
type: "string | null",
|
|
319
|
-
children:
|
|
320
|
+
children: _alloy_js_core.code`null; `
|
|
320
321
|
}),
|
|
321
|
-
(0,
|
|
322
|
-
(0,
|
|
322
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
323
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
323
324
|
name: "defaultErrorMessage",
|
|
324
325
|
"protected": true,
|
|
325
326
|
type: "string",
|
|
326
|
-
children:
|
|
327
|
+
children: _alloy_js_core.code`"An invalid value was provided"; `
|
|
327
328
|
}),
|
|
328
|
-
(0,
|
|
329
|
-
(0,
|
|
329
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
330
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
330
331
|
name: "isSubmitted",
|
|
331
332
|
"protected": true,
|
|
332
333
|
type: "boolean",
|
|
333
|
-
children:
|
|
334
|
+
children: _alloy_js_core.code`false; `
|
|
334
335
|
}),
|
|
335
|
-
(0,
|
|
336
|
-
(0,
|
|
336
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
337
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
337
338
|
name: "isCancelled",
|
|
338
339
|
"protected": true,
|
|
339
340
|
type: "boolean",
|
|
340
|
-
children:
|
|
341
|
+
children: _alloy_js_core.code`false; `
|
|
341
342
|
}),
|
|
342
|
-
(0,
|
|
343
|
-
(0,
|
|
343
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
344
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
344
345
|
name: "isInitial",
|
|
345
346
|
"protected": true,
|
|
346
347
|
type: "boolean",
|
|
347
|
-
children:
|
|
348
|
+
children: _alloy_js_core.code`true; `
|
|
348
349
|
}),
|
|
349
|
-
(0,
|
|
350
|
-
(0,
|
|
350
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
351
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
351
352
|
name: "consoleOutput",
|
|
352
353
|
"protected": true,
|
|
353
354
|
type: "string",
|
|
354
|
-
children:
|
|
355
|
+
children: _alloy_js_core.code`""; `
|
|
355
356
|
}),
|
|
356
|
-
(0,
|
|
357
|
-
(0,
|
|
357
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
358
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
358
359
|
name: "consoleStatus",
|
|
359
360
|
"protected": true,
|
|
360
361
|
type: "string",
|
|
361
|
-
children:
|
|
362
|
+
children: _alloy_js_core.code`""; `
|
|
362
363
|
}),
|
|
363
|
-
(0,
|
|
364
|
-
(0,
|
|
364
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
365
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
365
366
|
name: "displayValue",
|
|
366
367
|
"protected": true,
|
|
367
368
|
type: "string",
|
|
368
|
-
children:
|
|
369
|
+
children: _alloy_js_core.code`""; `
|
|
369
370
|
}),
|
|
370
|
-
(0,
|
|
371
|
-
(0,
|
|
371
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
372
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
372
373
|
name: "validate",
|
|
373
374
|
"protected": true,
|
|
374
375
|
type: "(value: TValue) => boolean | string | null | undefined | Promise<boolean | string | null | undefined>",
|
|
375
|
-
children:
|
|
376
|
+
children: _alloy_js_core.code`() => true; `
|
|
376
377
|
}),
|
|
377
|
-
(0,
|
|
378
|
-
(0,
|
|
378
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
379
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
379
380
|
name: "parse",
|
|
380
381
|
"protected": true,
|
|
381
382
|
type: "PromptParser<TValue>",
|
|
382
|
-
children:
|
|
383
|
+
children: _alloy_js_core.code`(value: string) => value as TValue; `
|
|
383
384
|
}),
|
|
384
|
-
(0,
|
|
385
|
-
(0,
|
|
385
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
386
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
386
387
|
name: "format",
|
|
387
388
|
"protected": true,
|
|
388
389
|
type: "PromptFormatter<TValue>",
|
|
389
|
-
children:
|
|
390
|
+
children: _alloy_js_core.code`(value: TValue) => String(value); `
|
|
390
391
|
}),
|
|
391
|
-
(0,
|
|
392
|
-
(0,
|
|
392
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
393
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
393
394
|
name: "mask",
|
|
394
395
|
"protected": true,
|
|
395
396
|
type: "(input: string) => string",
|
|
396
|
-
children:
|
|
397
|
+
children: _alloy_js_core.code`noMask; `
|
|
397
398
|
}),
|
|
398
|
-
(0,
|
|
399
|
-
(0,
|
|
399
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
400
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
400
401
|
name: "maskCompleted",
|
|
401
402
|
"protected": true,
|
|
402
403
|
type: "(input: string) => string",
|
|
403
|
-
children:
|
|
404
|
+
children: _alloy_js_core.code`this.mask; `
|
|
404
405
|
}),
|
|
405
|
-
(0,
|
|
406
|
-
(0,
|
|
406
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
407
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
407
408
|
name: "cursor",
|
|
408
409
|
"protected": true,
|
|
409
410
|
type: "number",
|
|
410
|
-
children:
|
|
411
|
+
children: _alloy_js_core.code`0; `
|
|
411
412
|
}),
|
|
412
|
-
(0,
|
|
413
|
-
(0,
|
|
413
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
414
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
414
415
|
name: "cursorHidden",
|
|
415
416
|
"protected": true,
|
|
416
417
|
type: "boolean",
|
|
417
|
-
children:
|
|
418
|
+
children: _alloy_js_core.code`false; `
|
|
418
419
|
}),
|
|
419
|
-
(0,
|
|
420
|
-
|
|
420
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
421
|
+
_alloy_js_core.code`constructor(protected config: PromptConfig<TValue>) {
|
|
421
422
|
super();
|
|
422
423
|
|
|
423
424
|
if (config.input) {
|
|
@@ -475,48 +476,48 @@ function BasePromptDeclarations() {
|
|
|
475
476
|
[Symbol.dispose]() {
|
|
476
477
|
this.close();
|
|
477
478
|
} `,
|
|
478
|
-
(0,
|
|
479
|
-
(0,
|
|
479
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
480
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
480
481
|
"public": true,
|
|
481
482
|
name: "value",
|
|
482
483
|
type: "TValue",
|
|
483
484
|
doc: "A getter for the prompt value that returns the current value or the initial value if the current value is not set",
|
|
484
|
-
children:
|
|
485
|
+
children: _alloy_js_core.code`return this.#value || this.initialValue; `
|
|
485
486
|
}),
|
|
486
|
-
(0,
|
|
487
|
-
(0,
|
|
487
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
488
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
488
489
|
"public": true,
|
|
489
490
|
name: "isError",
|
|
490
491
|
type: "boolean",
|
|
491
|
-
children:
|
|
492
|
+
children: _alloy_js_core.code`return !!this.errorMessage; `
|
|
492
493
|
}),
|
|
493
|
-
(0,
|
|
494
|
-
(0,
|
|
494
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
495
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
495
496
|
"protected": true,
|
|
496
497
|
name: "isSelect",
|
|
497
498
|
type: "boolean",
|
|
498
|
-
children:
|
|
499
|
+
children: _alloy_js_core.code`return false; `
|
|
499
500
|
}),
|
|
500
|
-
(0,
|
|
501
|
-
(0,
|
|
501
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
502
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
502
503
|
"protected": true,
|
|
503
504
|
name: "isCompleted",
|
|
504
505
|
type: "boolean",
|
|
505
|
-
children:
|
|
506
|
+
children: _alloy_js_core.code`return this.isCancelled || this.isSubmitted; `
|
|
506
507
|
}),
|
|
507
|
-
(0,
|
|
508
|
-
(0,
|
|
508
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
509
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
509
510
|
"protected": true,
|
|
510
511
|
name: "isPlaceholder",
|
|
511
512
|
type: "boolean",
|
|
512
|
-
children:
|
|
513
|
+
children: _alloy_js_core.code`return (this.displayValue === this.format(this.initialValue) && !this.#isDirty) || !this.#isKeyPressed; `
|
|
513
514
|
}),
|
|
514
|
-
(0,
|
|
515
|
-
(0,
|
|
515
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
516
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
516
517
|
"protected": true,
|
|
517
518
|
name: "status",
|
|
518
519
|
type: "string",
|
|
519
|
-
children:
|
|
520
|
+
children: _alloy_js_core.code`return this.isSubmitted ? "" : \` \\n \${
|
|
520
521
|
colors.italic(
|
|
521
522
|
this.isError
|
|
522
523
|
? colors.text.prompt.description.error(splitText(this.errorMessage, "3/4").join("\\n"))
|
|
@@ -528,24 +529,24 @@ function BasePromptDeclarations() {
|
|
|
528
529
|
)
|
|
529
530
|
}\`; `
|
|
530
531
|
}),
|
|
531
|
-
(0,
|
|
532
|
-
(0,
|
|
532
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
533
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
533
534
|
doc: "A property to check if the cursor is at the start",
|
|
534
535
|
name: "isCursorAtStart",
|
|
535
536
|
"protected": true,
|
|
536
537
|
type: "boolean",
|
|
537
|
-
children:
|
|
538
|
+
children: _alloy_js_core.code`return this.cursor <= 0 || (this.isPlaceholder && this.cursor <= 1); `
|
|
538
539
|
}),
|
|
539
|
-
(0,
|
|
540
|
-
(0,
|
|
540
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
541
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
541
542
|
doc: "A property to check if the cursor is at the end",
|
|
542
543
|
name: "isCursorAtEnd",
|
|
543
544
|
"protected": true,
|
|
544
545
|
type: "boolean",
|
|
545
|
-
children:
|
|
546
|
+
children: _alloy_js_core.code`return this.cursor >= this.displayValue.length || (this.isPlaceholder && this.cursor >= this.displayValue.length - 1); `
|
|
546
547
|
}),
|
|
547
|
-
(0,
|
|
548
|
-
(0,
|
|
548
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
549
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
549
550
|
doc: "A method to change the prompt value, which also updates the display value and fires a state update event. This method can be called by subclasses whenever the prompt value needs to be updated based on user input or other interactions.",
|
|
550
551
|
name: "changeValue",
|
|
551
552
|
"protected": true,
|
|
@@ -553,7 +554,7 @@ function BasePromptDeclarations() {
|
|
|
553
554
|
name: "value",
|
|
554
555
|
type: "TValue"
|
|
555
556
|
}],
|
|
556
|
-
children:
|
|
557
|
+
children: _alloy_js_core.code`const previousValue = this.value;
|
|
557
558
|
|
|
558
559
|
let updatedValue = value;
|
|
559
560
|
if (value === undefined || value === "") {
|
|
@@ -576,12 +577,12 @@ function BasePromptDeclarations() {
|
|
|
576
577
|
|
|
577
578
|
this.sync(); `
|
|
578
579
|
}),
|
|
579
|
-
(0,
|
|
580
|
-
(0,
|
|
580
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
581
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
581
582
|
doc: "A method to emit the current state",
|
|
582
583
|
name: "sync",
|
|
583
584
|
"protected": true,
|
|
584
|
-
children:
|
|
585
|
+
children: _alloy_js_core.code`this.emit("state", {
|
|
585
586
|
value: this.value,
|
|
586
587
|
errorMessage: this.errorMessage,
|
|
587
588
|
isError: this.isError,
|
|
@@ -591,20 +592,20 @@ function BasePromptDeclarations() {
|
|
|
591
592
|
});
|
|
592
593
|
this.render(); `
|
|
593
594
|
}),
|
|
594
|
-
(0,
|
|
595
|
-
(0,
|
|
595
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
596
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
596
597
|
doc: "A method to ring the bell",
|
|
597
598
|
name: "bell",
|
|
598
599
|
"protected": true,
|
|
599
|
-
children:
|
|
600
|
+
children: _alloy_js_core.code`this.output.write(beep); `
|
|
600
601
|
}),
|
|
601
|
-
(0,
|
|
602
|
-
(0,
|
|
602
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
603
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
603
604
|
doc: "A method to render the prompt",
|
|
604
605
|
name: "onRender",
|
|
605
606
|
"protected": true,
|
|
606
607
|
returnType: "string",
|
|
607
|
-
children:
|
|
608
|
+
children: _alloy_js_core.code`return this.isPlaceholder
|
|
608
609
|
? colors.text.prompt.input.disabled(this.displayValue)
|
|
609
610
|
: this.isError
|
|
610
611
|
? colors.text.prompt.input.error(this.displayValue)
|
|
@@ -614,8 +615,8 @@ function BasePromptDeclarations() {
|
|
|
614
615
|
? colors.text.prompt.input.cancelled(this.maskCompleted(this.displayValue))
|
|
615
616
|
: colors.bold(colors.text.prompt.input.active(this.displayValue)); `
|
|
616
617
|
}),
|
|
617
|
-
(0,
|
|
618
|
-
(0,
|
|
618
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
619
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
619
620
|
doc: "A method to handle changes in the prompt value",
|
|
620
621
|
name: "onChange",
|
|
621
622
|
"protected": true,
|
|
@@ -623,10 +624,10 @@ function BasePromptDeclarations() {
|
|
|
623
624
|
name: "previousValue",
|
|
624
625
|
type: "TValue"
|
|
625
626
|
}],
|
|
626
|
-
children:
|
|
627
|
+
children: _alloy_js_core.code` // can be implemented by subclasses to handle value changes if needed, this method is called whenever the prompt value changes and receives the previous value as an argument for reference`
|
|
627
628
|
}),
|
|
628
|
-
(0,
|
|
629
|
-
(0,
|
|
629
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
630
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
630
631
|
doc: "A method to handle key press events and determine the corresponding action",
|
|
631
632
|
name: "onKeyPress",
|
|
632
633
|
"protected": true,
|
|
@@ -637,20 +638,20 @@ function BasePromptDeclarations() {
|
|
|
637
638
|
name: "key",
|
|
638
639
|
type: "readline.Key"
|
|
639
640
|
}],
|
|
640
|
-
children:
|
|
641
|
+
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
641
642
|
if (!action) {
|
|
642
643
|
this.bell();
|
|
643
644
|
} else if (typeof (this as any)[action] === "function") {
|
|
644
645
|
(this as any)[action](key);
|
|
645
646
|
} `
|
|
646
647
|
}),
|
|
647
|
-
(0,
|
|
648
|
-
(0,
|
|
648
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
649
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
649
650
|
doc: "A method to close the prompt and clean up resources, which also emits a submit or cancel event based on the prompt state. This method should be called when the prompt interaction is finished and the prompt needs to be closed.",
|
|
650
651
|
name: "close",
|
|
651
652
|
async: true,
|
|
652
653
|
"protected": true,
|
|
653
|
-
children:
|
|
654
|
+
children: _alloy_js_core.code`if (this.#isClosed) {
|
|
654
655
|
return;
|
|
655
656
|
}
|
|
656
657
|
|
|
@@ -665,8 +666,8 @@ function BasePromptDeclarations() {
|
|
|
665
666
|
this.emit(this.isSubmitted ? "submit" : "cancel", this.value);
|
|
666
667
|
this.#isClosed = true; `
|
|
667
668
|
}),
|
|
668
|
-
(0,
|
|
669
|
-
(0,
|
|
669
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
670
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
670
671
|
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.",
|
|
671
672
|
name: "checkValidations",
|
|
672
673
|
async: true,
|
|
@@ -675,7 +676,7 @@ function BasePromptDeclarations() {
|
|
|
675
676
|
name: "value",
|
|
676
677
|
type: "TValue"
|
|
677
678
|
}],
|
|
678
|
-
children:
|
|
679
|
+
children: _alloy_js_core.code`let result = await this.validate(value);
|
|
679
680
|
if (typeof result === "string") {
|
|
680
681
|
this.errorMessage = result;
|
|
681
682
|
} else if (typeof result === "boolean") {
|
|
@@ -684,8 +685,8 @@ function BasePromptDeclarations() {
|
|
|
684
685
|
this.errorMessage = null;
|
|
685
686
|
} `
|
|
686
687
|
}),
|
|
687
|
-
(0,
|
|
688
|
-
(0,
|
|
688
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
689
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
689
690
|
doc: "A method to route key press events to specific prompt actions based on the key pressed. This method maps various key combinations and keys to corresponding actions that can be handled by the prompt, such as submitting, cancelling, navigating, etc.",
|
|
690
691
|
name: "getAction",
|
|
691
692
|
"protected": true,
|
|
@@ -694,7 +695,7 @@ function BasePromptDeclarations() {
|
|
|
694
695
|
type: "readline.Key"
|
|
695
696
|
}],
|
|
696
697
|
returnType: "string | false",
|
|
697
|
-
children:
|
|
698
|
+
children: _alloy_js_core.code`if (key.meta && key.name !== "escape") {
|
|
698
699
|
return false;
|
|
699
700
|
}
|
|
700
701
|
|
|
@@ -726,8 +727,8 @@ function BasePromptDeclarations() {
|
|
|
726
727
|
|
|
727
728
|
return action || false; `
|
|
728
729
|
}),
|
|
729
|
-
(0,
|
|
730
|
-
(0,
|
|
730
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
731
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
731
732
|
doc: "A method to move the cursor to the left or right by a \\`count\\` of positions",
|
|
732
733
|
name: "moveCursor",
|
|
733
734
|
parameters: [{
|
|
@@ -735,7 +736,7 @@ function BasePromptDeclarations() {
|
|
|
735
736
|
type: "number"
|
|
736
737
|
}],
|
|
737
738
|
"protected": true,
|
|
738
|
-
children:
|
|
739
|
+
children: _alloy_js_core.code`if (this.cursor + count < 0) {
|
|
739
740
|
this.cursor = 0;
|
|
740
741
|
} else if (this.cursor + count > this.displayValue.length) {
|
|
741
742
|
this.cursor = this.displayValue.length;
|
|
@@ -745,12 +746,12 @@ function BasePromptDeclarations() {
|
|
|
745
746
|
|
|
746
747
|
`
|
|
747
748
|
}),
|
|
748
|
-
(0,
|
|
749
|
-
(0,
|
|
749
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
750
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
750
751
|
doc: "A method to remove the character backward of the cursor",
|
|
751
752
|
name: "backspace",
|
|
752
753
|
"protected": true,
|
|
753
|
-
children:
|
|
754
|
+
children: _alloy_js_core.code`if (this.isCursorAtStart) {
|
|
754
755
|
return this.bell();
|
|
755
756
|
}
|
|
756
757
|
|
|
@@ -770,12 +771,12 @@ function BasePromptDeclarations() {
|
|
|
770
771
|
|
|
771
772
|
this.sync(); `
|
|
772
773
|
}),
|
|
773
|
-
(0,
|
|
774
|
-
(0,
|
|
774
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
775
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
775
776
|
doc: "A method to remove the character forward of the cursor",
|
|
776
777
|
name: "delete",
|
|
777
778
|
"protected": true,
|
|
778
|
-
children:
|
|
779
|
+
children: _alloy_js_core.code`if (this.isCursorAtEnd) {
|
|
779
780
|
return this.bell();
|
|
780
781
|
}
|
|
781
782
|
|
|
@@ -791,12 +792,12 @@ function BasePromptDeclarations() {
|
|
|
791
792
|
|
|
792
793
|
this.sync(); `
|
|
793
794
|
}),
|
|
794
|
-
(0,
|
|
795
|
-
(0,
|
|
795
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
796
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
796
797
|
doc: "A method to reset the prompt input",
|
|
797
798
|
name: "reset",
|
|
798
799
|
"protected": true,
|
|
799
|
-
children:
|
|
800
|
+
children: _alloy_js_core.code`this.changeValue(this.initialValue);
|
|
800
801
|
this.cursor = 0;
|
|
801
802
|
|
|
802
803
|
this.errorMessage = null;
|
|
@@ -805,12 +806,12 @@ function BasePromptDeclarations() {
|
|
|
805
806
|
|
|
806
807
|
this.sync(); `
|
|
807
808
|
}),
|
|
808
|
-
(0,
|
|
809
|
-
(0,
|
|
809
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
810
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
810
811
|
doc: "A method to cancel the prompt input",
|
|
811
812
|
name: "cancel",
|
|
812
813
|
"protected": true,
|
|
813
|
-
children:
|
|
814
|
+
children: _alloy_js_core.code`this.errorMessage = null;
|
|
814
815
|
this.isCancelled = true;
|
|
815
816
|
this.isSubmitted = false;
|
|
816
817
|
|
|
@@ -818,13 +819,13 @@ function BasePromptDeclarations() {
|
|
|
818
819
|
this.output.write("\\n");
|
|
819
820
|
this.close(); `
|
|
820
821
|
}),
|
|
821
|
-
(0,
|
|
822
|
-
(0,
|
|
822
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
823
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
823
824
|
doc: "A method to submit the prompt input",
|
|
824
825
|
name: "submit",
|
|
825
826
|
async: true,
|
|
826
827
|
"protected": true,
|
|
827
|
-
children:
|
|
828
|
+
children: _alloy_js_core.code`this.cursor = this.displayValue.length;
|
|
828
829
|
|
|
829
830
|
await this.checkValidations(this.value);
|
|
830
831
|
if (this.isError) {
|
|
@@ -839,13 +840,13 @@ function BasePromptDeclarations() {
|
|
|
839
840
|
this.close();
|
|
840
841
|
} `
|
|
841
842
|
}),
|
|
842
|
-
(0,
|
|
843
|
-
(0,
|
|
843
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
844
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
844
845
|
doc: "A method to render the prompt",
|
|
845
846
|
name: "render",
|
|
846
847
|
"private": true,
|
|
847
848
|
get children() {
|
|
848
|
-
return
|
|
849
|
+
return _alloy_js_core.code`if (this.#isClosed) {
|
|
849
850
|
return;
|
|
850
851
|
}
|
|
851
852
|
|
|
@@ -888,8 +889,8 @@ function BasePromptDeclarations() {
|
|
|
888
889
|
this.consoleStatus = this.status; `;
|
|
889
890
|
}
|
|
890
891
|
}),
|
|
891
|
-
(0,
|
|
892
|
-
(0,
|
|
892
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
893
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
893
894
|
doc: "A method to handle key press events and determine the corresponding action",
|
|
894
895
|
name: "keypress",
|
|
895
896
|
"private": true,
|
|
@@ -900,7 +901,7 @@ function BasePromptDeclarations() {
|
|
|
900
901
|
name: "key",
|
|
901
902
|
type: "readline.Key"
|
|
902
903
|
}],
|
|
903
|
-
children:
|
|
904
|
+
children: _alloy_js_core.code`if (this.#isClosed) {
|
|
904
905
|
return;
|
|
905
906
|
}
|
|
906
907
|
|
|
@@ -913,8 +914,8 @@ function BasePromptDeclarations() {
|
|
|
913
914
|
];
|
|
914
915
|
}
|
|
915
916
|
}),
|
|
916
|
-
(0,
|
|
917
|
-
(0,
|
|
917
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
918
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
918
919
|
name: "PromptFactoryConfig",
|
|
919
920
|
"extends": "PromptConfig<TValue>",
|
|
920
921
|
doc: "Configuration options for creating a prompt with a prompt factory function",
|
|
@@ -924,21 +925,21 @@ function BasePromptDeclarations() {
|
|
|
924
925
|
}],
|
|
925
926
|
get children() {
|
|
926
927
|
return [
|
|
927
|
-
(0,
|
|
928
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
928
929
|
name: "onState",
|
|
929
930
|
optional: true,
|
|
930
931
|
type: "(state: PromptState<TValue>) => any",
|
|
931
932
|
doc: "A function that is called when the prompt state changes, useful for updating the prompt message or other properties dynamically"
|
|
932
933
|
}),
|
|
933
|
-
(0,
|
|
934
|
-
(0,
|
|
934
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
935
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
935
936
|
name: "onSubmit",
|
|
936
937
|
optional: true,
|
|
937
938
|
type: "(value: TValue) => any",
|
|
938
939
|
doc: "A function that is called when the prompt is submitted, useful for handling the submitted value or performing actions based on the prompt state"
|
|
939
940
|
}),
|
|
940
|
-
(0,
|
|
941
|
-
(0,
|
|
941
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
942
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
942
943
|
name: "onCancel",
|
|
943
944
|
optional: true,
|
|
944
945
|
type: "(event: any) => any",
|
|
@@ -947,24 +948,24 @@ function BasePromptDeclarations() {
|
|
|
947
948
|
];
|
|
948
949
|
}
|
|
949
950
|
}),
|
|
950
|
-
(0,
|
|
951
|
-
(0,
|
|
952
|
-
(0,
|
|
951
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
952
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "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." }),
|
|
953
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
953
954
|
"export": true,
|
|
954
955
|
name: "CANCEL_SYMBOL",
|
|
955
|
-
children:
|
|
956
|
+
children: _alloy_js_core.code`Symbol("shell-shock:prompts:cancel"); `
|
|
956
957
|
}),
|
|
957
|
-
(0,
|
|
958
|
-
(0,
|
|
958
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
959
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
959
960
|
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.",
|
|
960
961
|
get children() {
|
|
961
|
-
return [(0,
|
|
962
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
962
963
|
name: "value",
|
|
963
964
|
children: `The value to check.`
|
|
964
|
-
}), (0,
|
|
965
|
+
}), (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.` })];
|
|
965
966
|
}
|
|
966
967
|
}),
|
|
967
|
-
(0,
|
|
968
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
968
969
|
name: "isCancel",
|
|
969
970
|
"export": true,
|
|
970
971
|
parameters: [{
|
|
@@ -972,7 +973,7 @@ function BasePromptDeclarations() {
|
|
|
972
973
|
type: "any"
|
|
973
974
|
}],
|
|
974
975
|
returnType: "value is typeof CANCEL_SYMBOL",
|
|
975
|
-
children:
|
|
976
|
+
children: _alloy_js_core.code`return value === CANCEL_SYMBOL; `
|
|
976
977
|
})
|
|
977
978
|
];
|
|
978
979
|
}
|
|
@@ -981,20 +982,20 @@ function BasePromptDeclarations() {
|
|
|
981
982
|
*/
|
|
982
983
|
function TextPromptDeclarations() {
|
|
983
984
|
return [
|
|
984
|
-
(0,
|
|
985
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
985
986
|
name: "StringPromptConfig",
|
|
986
987
|
"extends": "PromptConfig<string>",
|
|
987
988
|
doc: "Configuration options for creating a text-based prompt",
|
|
988
989
|
get children() {
|
|
989
990
|
return [
|
|
990
|
-
(0,
|
|
991
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
991
992
|
name: "initialValue",
|
|
992
993
|
optional: true,
|
|
993
994
|
type: "string",
|
|
994
995
|
doc: "The initial value of the prompt"
|
|
995
996
|
}),
|
|
996
|
-
(0,
|
|
997
|
-
(0,
|
|
997
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
998
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
998
999
|
name: "mask",
|
|
999
1000
|
optional: true,
|
|
1000
1001
|
type: "(input: string) => string",
|
|
@@ -1003,29 +1004,29 @@ function TextPromptDeclarations() {
|
|
|
1003
1004
|
];
|
|
1004
1005
|
}
|
|
1005
1006
|
}),
|
|
1006
|
-
(0,
|
|
1007
|
-
(0,
|
|
1007
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1008
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassDeclaration, {
|
|
1008
1009
|
name: "StringPrompt",
|
|
1009
1010
|
doc: "A prompt for text input",
|
|
1010
1011
|
"extends": "Prompt<string>",
|
|
1011
1012
|
get children() {
|
|
1012
1013
|
return [
|
|
1013
|
-
(0,
|
|
1014
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1014
1015
|
name: "isInvalid",
|
|
1015
1016
|
isPrivateMember: true,
|
|
1016
1017
|
type: "boolean",
|
|
1017
|
-
children:
|
|
1018
|
+
children: _alloy_js_core.code`false; `
|
|
1018
1019
|
}),
|
|
1019
|
-
(0,
|
|
1020
|
-
(0,
|
|
1020
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1021
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1021
1022
|
name: "initialValue",
|
|
1022
1023
|
"protected": true,
|
|
1023
1024
|
override: true,
|
|
1024
1025
|
type: "string",
|
|
1025
|
-
children:
|
|
1026
|
+
children: _alloy_js_core.code`""; `
|
|
1026
1027
|
}),
|
|
1027
|
-
(0,
|
|
1028
|
-
|
|
1028
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1029
|
+
_alloy_js_core.code`constructor(config: StringPromptConfig) {
|
|
1029
1030
|
super(config);
|
|
1030
1031
|
|
|
1031
1032
|
if (config.initialValue) {
|
|
@@ -1040,8 +1041,8 @@ function TextPromptDeclarations() {
|
|
|
1040
1041
|
this.sync();
|
|
1041
1042
|
this.last();
|
|
1042
1043
|
} `,
|
|
1043
|
-
(0,
|
|
1044
|
-
(0,
|
|
1044
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1045
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1045
1046
|
doc: "A method to handle onKeyPress events and determine the corresponding action",
|
|
1046
1047
|
name: "onKeyPress",
|
|
1047
1048
|
override: true,
|
|
@@ -1053,7 +1054,7 @@ function TextPromptDeclarations() {
|
|
|
1053
1054
|
name: "key",
|
|
1054
1055
|
type: "readline.Key"
|
|
1055
1056
|
}],
|
|
1056
|
-
children:
|
|
1057
|
+
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
1057
1058
|
if (action && typeof (this as any)[action] === "function") {
|
|
1058
1059
|
return (this as any)[action]();
|
|
1059
1060
|
}
|
|
@@ -1069,8 +1070,8 @@ function TextPromptDeclarations() {
|
|
|
1069
1070
|
}\`);
|
|
1070
1071
|
this.sync(); `
|
|
1071
1072
|
}),
|
|
1072
|
-
(0,
|
|
1073
|
-
(0,
|
|
1073
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1074
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1074
1075
|
doc: "A method to handle changes in the prompt value",
|
|
1075
1076
|
name: "onChange",
|
|
1076
1077
|
override: true,
|
|
@@ -1079,85 +1080,85 @@ function TextPromptDeclarations() {
|
|
|
1079
1080
|
name: "previousValue",
|
|
1080
1081
|
type: "string"
|
|
1081
1082
|
}],
|
|
1082
|
-
children:
|
|
1083
|
+
children: _alloy_js_core.code`this.#isInvalid = false;
|
|
1083
1084
|
this.cursor = this.displayValue.slice(0, this.cursor).length + 1; `
|
|
1084
1085
|
}),
|
|
1085
|
-
(0,
|
|
1086
|
-
(0,
|
|
1086
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1087
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1087
1088
|
doc: "A method to reset the prompt input",
|
|
1088
1089
|
name: "reset",
|
|
1089
1090
|
override: true,
|
|
1090
1091
|
"protected": true,
|
|
1091
|
-
children:
|
|
1092
|
+
children: _alloy_js_core.code`this.cursor = Number(!!this.initialValue);
|
|
1092
1093
|
super.reset(); `
|
|
1093
1094
|
}),
|
|
1094
|
-
(0,
|
|
1095
|
-
(0,
|
|
1095
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1096
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1096
1097
|
doc: "A method to validate the prompt input",
|
|
1097
1098
|
name: "checkValidations",
|
|
1098
1099
|
override: true,
|
|
1099
1100
|
async: true,
|
|
1100
1101
|
"protected": true,
|
|
1101
|
-
children:
|
|
1102
|
+
children: _alloy_js_core.code`await super.checkValidations(this.value);
|
|
1102
1103
|
this.#isInvalid = this.isError; `
|
|
1103
1104
|
}),
|
|
1104
|
-
(0,
|
|
1105
|
-
(0,
|
|
1105
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1106
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1106
1107
|
doc: "A method to move the cursor to the end of the input",
|
|
1107
1108
|
name: "next",
|
|
1108
1109
|
"protected": true,
|
|
1109
|
-
children:
|
|
1110
|
+
children: _alloy_js_core.code`this.changeValue(this.initialValue);
|
|
1110
1111
|
this.cursor = this.displayValue.length;
|
|
1111
1112
|
this.sync(); `
|
|
1112
1113
|
}),
|
|
1113
|
-
(0,
|
|
1114
|
-
(0,
|
|
1114
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1115
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1115
1116
|
doc: "A method to move the cursor to the start",
|
|
1116
1117
|
name: "first",
|
|
1117
1118
|
"protected": true,
|
|
1118
|
-
children:
|
|
1119
|
+
children: _alloy_js_core.code`this.cursor = 0;
|
|
1119
1120
|
this.sync(); `
|
|
1120
1121
|
}),
|
|
1121
|
-
(0,
|
|
1122
|
-
(0,
|
|
1122
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1123
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1123
1124
|
doc: "A method to move the cursor to the end",
|
|
1124
1125
|
name: "last",
|
|
1125
1126
|
"protected": true,
|
|
1126
|
-
children:
|
|
1127
|
+
children: _alloy_js_core.code`this.cursor = this.displayValue.length;
|
|
1127
1128
|
this.sync(); `
|
|
1128
1129
|
}),
|
|
1129
|
-
(0,
|
|
1130
|
-
(0,
|
|
1130
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1131
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1131
1132
|
doc: "A method to move the cursor to the left",
|
|
1132
1133
|
name: "left",
|
|
1133
1134
|
"protected": true,
|
|
1134
|
-
children:
|
|
1135
|
+
children: _alloy_js_core.code`if (this.cursor <= 0) {
|
|
1135
1136
|
return this.bell();
|
|
1136
1137
|
}
|
|
1137
1138
|
|
|
1138
1139
|
this.moveCursor(-1);
|
|
1139
1140
|
this.sync(); `
|
|
1140
1141
|
}),
|
|
1141
|
-
(0,
|
|
1142
|
-
(0,
|
|
1142
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1143
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1143
1144
|
doc: "A method to move the cursor to the right",
|
|
1144
1145
|
name: "right",
|
|
1145
1146
|
"protected": true,
|
|
1146
|
-
children:
|
|
1147
|
+
children: _alloy_js_core.code`if (this.cursor >= this.displayValue.length) {
|
|
1147
1148
|
return this.bell();
|
|
1148
1149
|
}
|
|
1149
1150
|
|
|
1150
1151
|
this.moveCursor(1);
|
|
1151
1152
|
this.sync(); `
|
|
1152
1153
|
}),
|
|
1153
|
-
(0,
|
|
1154
|
-
(0,
|
|
1154
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1155
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1155
1156
|
doc: "A method to render the prompt",
|
|
1156
1157
|
name: "onRender",
|
|
1157
1158
|
override: true,
|
|
1158
1159
|
"protected": true,
|
|
1159
1160
|
returnType: "string",
|
|
1160
|
-
children:
|
|
1161
|
+
children: _alloy_js_core.code`return this.isPlaceholder
|
|
1161
1162
|
? colors.text.prompt.input.disabled(this.displayValue)
|
|
1162
1163
|
: this.#isInvalid
|
|
1163
1164
|
? colors.text.prompt.input.error(this.displayValue)
|
|
@@ -1170,20 +1171,20 @@ function TextPromptDeclarations() {
|
|
|
1170
1171
|
];
|
|
1171
1172
|
}
|
|
1172
1173
|
}),
|
|
1173
|
-
(0,
|
|
1174
|
-
(0,
|
|
1175
|
-
(0,
|
|
1174
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1175
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "A type definition for the configuration options to pass to the text prompt, which extends the base PromptConfig with additional options specific to text prompts. This type can be used when creating a text prompt using the {@link text | text prompt factory function} or when manually creating an instance of the TextPrompt class. The TextConfig type includes all the properties of the base PromptConfig, such as message, description, initialValue, validate, parse, format, mask, etc., as well as any additional properties that are specific to text prompts." }),
|
|
1176
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
|
|
1176
1177
|
name: "TextConfig",
|
|
1177
1178
|
"export": true,
|
|
1178
|
-
children:
|
|
1179
|
+
children: _alloy_js_core.code`PromptFactoryConfig<string> & StringPromptConfig; `
|
|
1179
1180
|
}),
|
|
1180
|
-
(0,
|
|
1181
|
-
(0,
|
|
1181
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1182
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
1182
1183
|
heading: "A function to create and run a text 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.",
|
|
1183
1184
|
get children() {
|
|
1184
1185
|
return [
|
|
1185
|
-
(0,
|
|
1186
|
-
(0,
|
|
1186
|
+
(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.` }),
|
|
1187
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { text, isCancel } from "shell-shock:prompts";
|
|
1187
1188
|
|
|
1188
1189
|
async function run() {
|
|
1189
1190
|
const name = await text({
|
|
@@ -1200,16 +1201,16 @@ async function run() {
|
|
|
1200
1201
|
}
|
|
1201
1202
|
|
|
1202
1203
|
run(); ` }),
|
|
1203
|
-
(0,
|
|
1204
|
-
(0,
|
|
1204
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1205
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
1205
1206
|
name: "config",
|
|
1206
1207
|
children: `The configuration options to pass to the text prompt, which extends the base PromptConfig with additional options specific to text prompts`
|
|
1207
1208
|
}),
|
|
1208
|
-
(0,
|
|
1209
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled` })
|
|
1209
1210
|
];
|
|
1210
1211
|
}
|
|
1211
1212
|
}),
|
|
1212
|
-
(0,
|
|
1213
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1213
1214
|
name: "text",
|
|
1214
1215
|
"export": true,
|
|
1215
1216
|
parameters: [{
|
|
@@ -1217,7 +1218,7 @@ run(); ` }),
|
|
|
1217
1218
|
type: "TextConfig"
|
|
1218
1219
|
}],
|
|
1219
1220
|
returnType: "Promise<string | symbol>",
|
|
1220
|
-
children:
|
|
1221
|
+
children: _alloy_js_core.code`return new Promise<string | symbol>((response, reject) => {
|
|
1221
1222
|
const prompt = new StringPrompt(config);
|
|
1222
1223
|
|
|
1223
1224
|
prompt.on("state", state => config.onState?.(state));
|
|
@@ -1232,7 +1233,7 @@ run(); ` }),
|
|
|
1232
1233
|
*/
|
|
1233
1234
|
function SelectPromptDeclarations() {
|
|
1234
1235
|
return [
|
|
1235
|
-
(0,
|
|
1236
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1236
1237
|
name: "PromptOptionConfig",
|
|
1237
1238
|
doc: "Configuration for an option the user can select from the select prompt",
|
|
1238
1239
|
typeParameters: [{
|
|
@@ -1241,41 +1242,41 @@ function SelectPromptDeclarations() {
|
|
|
1241
1242
|
}],
|
|
1242
1243
|
get children() {
|
|
1243
1244
|
return [
|
|
1244
|
-
(0,
|
|
1245
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1245
1246
|
name: "label",
|
|
1246
1247
|
optional: true,
|
|
1247
1248
|
type: "string",
|
|
1248
1249
|
doc: "The message label for the option"
|
|
1249
1250
|
}),
|
|
1250
|
-
(0,
|
|
1251
|
-
(0,
|
|
1251
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1252
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1252
1253
|
name: "icon",
|
|
1253
1254
|
optional: true,
|
|
1254
1255
|
type: "string",
|
|
1255
1256
|
doc: "An icon for the option"
|
|
1256
1257
|
}),
|
|
1257
|
-
(0,
|
|
1258
|
-
(0,
|
|
1258
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1259
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1259
1260
|
name: "value",
|
|
1260
1261
|
type: "TValue",
|
|
1261
1262
|
doc: "The value of the option"
|
|
1262
1263
|
}),
|
|
1263
|
-
(0,
|
|
1264
|
-
(0,
|
|
1264
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1265
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1265
1266
|
name: "description",
|
|
1266
1267
|
optional: true,
|
|
1267
1268
|
type: "string",
|
|
1268
1269
|
doc: "The description of the option"
|
|
1269
1270
|
}),
|
|
1270
|
-
(0,
|
|
1271
|
-
(0,
|
|
1271
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1272
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1272
1273
|
name: "selected",
|
|
1273
1274
|
optional: true,
|
|
1274
1275
|
type: "boolean",
|
|
1275
1276
|
doc: "Whether the option is selected"
|
|
1276
1277
|
}),
|
|
1277
|
-
(0,
|
|
1278
|
-
(0,
|
|
1278
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1279
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1279
1280
|
name: "disabled",
|
|
1280
1281
|
optional: true,
|
|
1281
1282
|
type: "boolean",
|
|
@@ -1284,8 +1285,8 @@ function SelectPromptDeclarations() {
|
|
|
1284
1285
|
];
|
|
1285
1286
|
}
|
|
1286
1287
|
}),
|
|
1287
|
-
(0,
|
|
1288
|
-
(0,
|
|
1288
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1289
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1289
1290
|
"export": true,
|
|
1290
1291
|
name: "PromptOption",
|
|
1291
1292
|
"extends": "PromptOptionConfig<TValue>",
|
|
@@ -1296,24 +1297,24 @@ function SelectPromptDeclarations() {
|
|
|
1296
1297
|
}],
|
|
1297
1298
|
get children() {
|
|
1298
1299
|
return [
|
|
1299
|
-
(0,
|
|
1300
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1300
1301
|
name: "label",
|
|
1301
1302
|
type: "string",
|
|
1302
1303
|
doc: "The message label for the option"
|
|
1303
1304
|
}),
|
|
1304
|
-
(0,
|
|
1305
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1305
1306
|
name: "index",
|
|
1306
1307
|
type: "number",
|
|
1307
1308
|
doc: "The index of the option"
|
|
1308
1309
|
}),
|
|
1309
|
-
(0,
|
|
1310
|
-
(0,
|
|
1310
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1311
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1311
1312
|
name: "selected",
|
|
1312
1313
|
type: "boolean",
|
|
1313
1314
|
doc: "Whether the option is selected"
|
|
1314
1315
|
}),
|
|
1315
|
-
(0,
|
|
1316
|
-
(0,
|
|
1316
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1317
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1317
1318
|
name: "disabled",
|
|
1318
1319
|
type: "boolean",
|
|
1319
1320
|
doc: "Whether the option is disabled"
|
|
@@ -1321,8 +1322,8 @@ function SelectPromptDeclarations() {
|
|
|
1321
1322
|
];
|
|
1322
1323
|
}
|
|
1323
1324
|
}),
|
|
1324
|
-
(0,
|
|
1325
|
-
(0,
|
|
1325
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1326
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1326
1327
|
name: "SelectPromptConfig",
|
|
1327
1328
|
"extends": "PromptConfig<TValue>",
|
|
1328
1329
|
doc: "An options object for configuring a select prompt",
|
|
@@ -1332,20 +1333,20 @@ function SelectPromptDeclarations() {
|
|
|
1332
1333
|
}],
|
|
1333
1334
|
get children() {
|
|
1334
1335
|
return [
|
|
1335
|
-
(0,
|
|
1336
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1336
1337
|
name: "hint",
|
|
1337
1338
|
optional: true,
|
|
1338
1339
|
type: "string",
|
|
1339
1340
|
doc: "A hint to display to the user"
|
|
1340
1341
|
}),
|
|
1341
|
-
(0,
|
|
1342
|
-
(0,
|
|
1342
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1343
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1343
1344
|
name: "options",
|
|
1344
1345
|
type: "Array<string | PromptOptionConfig<TValue>>",
|
|
1345
1346
|
doc: "The options available for the select prompt"
|
|
1346
1347
|
}),
|
|
1347
|
-
(0,
|
|
1348
|
-
(0,
|
|
1348
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1349
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1349
1350
|
name: "optionsPerPage",
|
|
1350
1351
|
optional: true,
|
|
1351
1352
|
type: "number",
|
|
@@ -1354,8 +1355,8 @@ function SelectPromptDeclarations() {
|
|
|
1354
1355
|
];
|
|
1355
1356
|
}
|
|
1356
1357
|
}),
|
|
1357
|
-
(0,
|
|
1358
|
-
(0,
|
|
1358
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1359
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassDeclaration, {
|
|
1359
1360
|
name: "SelectPrompt",
|
|
1360
1361
|
doc: "A prompt for selecting an option from a list",
|
|
1361
1362
|
"extends": "Prompt<TValue>",
|
|
@@ -1365,36 +1366,36 @@ function SelectPromptDeclarations() {
|
|
|
1365
1366
|
}],
|
|
1366
1367
|
get children() {
|
|
1367
1368
|
return [
|
|
1368
|
-
(0,
|
|
1369
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1369
1370
|
name: "initialValue",
|
|
1370
1371
|
"protected": true,
|
|
1371
1372
|
override: true,
|
|
1372
1373
|
type: "TValue"
|
|
1373
1374
|
}),
|
|
1374
|
-
(0,
|
|
1375
|
-
(0,
|
|
1375
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1376
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1376
1377
|
name: "optionsPerPage",
|
|
1377
1378
|
"protected": true,
|
|
1378
1379
|
type: "number",
|
|
1379
|
-
children:
|
|
1380
|
+
children: _alloy_js_core.code`8; `
|
|
1380
1381
|
}),
|
|
1381
|
-
(0,
|
|
1382
|
-
(0,
|
|
1382
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1383
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1383
1384
|
name: "options",
|
|
1384
1385
|
"protected": true,
|
|
1385
1386
|
type: "PromptOption<TValue>[]",
|
|
1386
|
-
children:
|
|
1387
|
+
children: _alloy_js_core.code`[]; `
|
|
1387
1388
|
}),
|
|
1388
|
-
(0,
|
|
1389
|
-
(0,
|
|
1389
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1390
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1390
1391
|
name: "cursorHidden",
|
|
1391
1392
|
"protected": true,
|
|
1392
1393
|
override: true,
|
|
1393
1394
|
type: "boolean",
|
|
1394
|
-
children:
|
|
1395
|
+
children: _alloy_js_core.code`true; `
|
|
1395
1396
|
}),
|
|
1396
|
-
(0,
|
|
1397
|
-
|
|
1397
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1398
|
+
_alloy_js_core.code`constructor(config: SelectPromptConfig<TValue>) {
|
|
1398
1399
|
super(config);
|
|
1399
1400
|
|
|
1400
1401
|
if (config.initialValue) {
|
|
@@ -1440,16 +1441,16 @@ function SelectPromptDeclarations() {
|
|
|
1440
1441
|
|
|
1441
1442
|
this.sync();
|
|
1442
1443
|
} `,
|
|
1443
|
-
(0,
|
|
1444
|
-
(0,
|
|
1444
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1445
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassPropertyGet, {
|
|
1445
1446
|
doc: "Returns the currently selected option",
|
|
1446
1447
|
name: "selectedOption",
|
|
1447
1448
|
type: "PromptOption<TValue> | null",
|
|
1448
1449
|
"protected": true,
|
|
1449
|
-
children:
|
|
1450
|
+
children: _alloy_js_core.code`return this.options.find(option => option.value === this.value) ?? null; `
|
|
1450
1451
|
}),
|
|
1451
|
-
(0,
|
|
1452
|
-
(0,
|
|
1452
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1453
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1453
1454
|
doc: "A method to route key press events to specific prompt actions based on the key pressed. This method maps various key combinations and keys to corresponding actions that can be handled by the prompt, such as submitting, cancelling, navigating, etc.",
|
|
1454
1455
|
name: "getAction",
|
|
1455
1456
|
override: true,
|
|
@@ -1459,7 +1460,7 @@ function SelectPromptDeclarations() {
|
|
|
1459
1460
|
type: "readline.Key"
|
|
1460
1461
|
}],
|
|
1461
1462
|
returnType: "string | false",
|
|
1462
|
-
children:
|
|
1463
|
+
children: _alloy_js_core.code`let action = super.getAction(key);
|
|
1463
1464
|
if (!action) {
|
|
1464
1465
|
if (key.name === "j") action = "down";
|
|
1465
1466
|
if (key.name === "k") action = "up";
|
|
@@ -1467,38 +1468,38 @@ function SelectPromptDeclarations() {
|
|
|
1467
1468
|
|
|
1468
1469
|
return action || false; `
|
|
1469
1470
|
}),
|
|
1470
|
-
(0,
|
|
1471
|
-
(0,
|
|
1471
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1472
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1472
1473
|
doc: "A method to reset the prompt input",
|
|
1473
1474
|
name: "reset",
|
|
1474
1475
|
override: true,
|
|
1475
1476
|
"protected": true,
|
|
1476
|
-
children:
|
|
1477
|
+
children: _alloy_js_core.code`this.moveCursor(0);
|
|
1477
1478
|
super.reset(); `
|
|
1478
1479
|
}),
|
|
1479
|
-
(0,
|
|
1480
|
-
(0,
|
|
1480
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1481
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1481
1482
|
doc: "A method to submit the prompt input",
|
|
1482
1483
|
name: "submit",
|
|
1483
1484
|
async: true,
|
|
1484
1485
|
override: true,
|
|
1485
1486
|
"protected": true,
|
|
1486
|
-
children:
|
|
1487
|
+
children: _alloy_js_core.code`if (!this.selectedOption?.disabled) {
|
|
1487
1488
|
await super.submit();
|
|
1488
1489
|
} else {
|
|
1489
1490
|
this.bell();
|
|
1490
1491
|
} `
|
|
1491
1492
|
}),
|
|
1492
|
-
(0,
|
|
1493
|
-
(0,
|
|
1493
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1494
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1494
1495
|
doc: "A method to move the cursor to the end of the input",
|
|
1495
1496
|
name: "next",
|
|
1496
1497
|
"protected": true,
|
|
1497
|
-
children:
|
|
1498
|
+
children: _alloy_js_core.code`this.moveCursor((this.cursor + 1) % this.options.length);
|
|
1498
1499
|
this.sync(); `
|
|
1499
1500
|
}),
|
|
1500
|
-
(0,
|
|
1501
|
-
(0,
|
|
1501
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1502
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1502
1503
|
doc: "A method to move the cursor to the left or right by a \\`count\\` of positions",
|
|
1503
1504
|
name: "moveCursor",
|
|
1504
1505
|
parameters: [{
|
|
@@ -1507,41 +1508,41 @@ function SelectPromptDeclarations() {
|
|
|
1507
1508
|
}],
|
|
1508
1509
|
override: true,
|
|
1509
1510
|
"protected": true,
|
|
1510
|
-
children:
|
|
1511
|
+
children: _alloy_js_core.code`this.cursor = count;
|
|
1511
1512
|
|
|
1512
1513
|
this.changeValue(this.options[count]!.value);
|
|
1513
1514
|
this.sync(); `
|
|
1514
1515
|
}),
|
|
1515
|
-
(0,
|
|
1516
|
-
(0,
|
|
1516
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1517
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1517
1518
|
doc: "A method to move the cursor to the first option",
|
|
1518
1519
|
name: "first",
|
|
1519
1520
|
"protected": true,
|
|
1520
|
-
children:
|
|
1521
|
+
children: _alloy_js_core.code`this.moveCursor(0);
|
|
1521
1522
|
this.sync(); `
|
|
1522
1523
|
}),
|
|
1523
|
-
(0,
|
|
1524
|
-
(0,
|
|
1524
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1525
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1525
1526
|
doc: "A method to move the cursor to the last option",
|
|
1526
1527
|
name: "last",
|
|
1527
1528
|
"protected": true,
|
|
1528
|
-
children:
|
|
1529
|
+
children: _alloy_js_core.code`this.moveCursor(this.options.length - 1);
|
|
1529
1530
|
this.sync(); `
|
|
1530
1531
|
}),
|
|
1531
|
-
(0,
|
|
1532
|
-
(0,
|
|
1532
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1533
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1533
1534
|
doc: "A method to move the cursor to the start",
|
|
1534
1535
|
name: "first",
|
|
1535
1536
|
"protected": true,
|
|
1536
|
-
children:
|
|
1537
|
+
children: _alloy_js_core.code`this.cursor = 0;
|
|
1537
1538
|
this.sync(); `
|
|
1538
1539
|
}),
|
|
1539
|
-
(0,
|
|
1540
|
-
(0,
|
|
1540
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1541
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1541
1542
|
doc: "A method to move the cursor to the up",
|
|
1542
1543
|
name: "up",
|
|
1543
1544
|
"protected": true,
|
|
1544
|
-
children:
|
|
1545
|
+
children: _alloy_js_core.code`if (this.cursor === 0) {
|
|
1545
1546
|
this.moveCursor(this.options.length - 1);
|
|
1546
1547
|
} else {
|
|
1547
1548
|
this.moveCursor(this.cursor - 1);
|
|
@@ -1549,12 +1550,12 @@ function SelectPromptDeclarations() {
|
|
|
1549
1550
|
|
|
1550
1551
|
this.sync(); `
|
|
1551
1552
|
}),
|
|
1552
|
-
(0,
|
|
1553
|
-
(0,
|
|
1553
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1554
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1554
1555
|
doc: "A method to move the cursor to the down",
|
|
1555
1556
|
name: "down",
|
|
1556
1557
|
"protected": true,
|
|
1557
|
-
children:
|
|
1558
|
+
children: _alloy_js_core.code`if (this.cursor === this.options.length - 1) {
|
|
1558
1559
|
this.moveCursor(0);
|
|
1559
1560
|
} else {
|
|
1560
1561
|
this.moveCursor(this.cursor + 1);
|
|
@@ -1562,13 +1563,13 @@ function SelectPromptDeclarations() {
|
|
|
1562
1563
|
|
|
1563
1564
|
this.sync(); `
|
|
1564
1565
|
}),
|
|
1565
|
-
(0,
|
|
1566
|
-
(0,
|
|
1566
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1567
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1567
1568
|
doc: "A method to render the prompt",
|
|
1568
1569
|
name: "onRender",
|
|
1569
1570
|
override: true,
|
|
1570
1571
|
"protected": true,
|
|
1571
|
-
children:
|
|
1572
|
+
children: _alloy_js_core.code`const spacing = Math.max(...this.options.map(option => option.label?.length || 0)) + 2;
|
|
1572
1573
|
|
|
1573
1574
|
const startIndex = Math.max(Math.min(this.options.length - this.optionsPerPage, this.cursor - Math.floor(this.optionsPerPage / 2)), 0);
|
|
1574
1575
|
const endIndex = Math.min(startIndex + this.optionsPerPage, this.options.length);
|
|
@@ -1625,24 +1626,24 @@ function SelectPromptDeclarations() {
|
|
|
1625
1626
|
];
|
|
1626
1627
|
}
|
|
1627
1628
|
}),
|
|
1628
|
-
(0,
|
|
1629
|
-
(0,
|
|
1629
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1630
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
1630
1631
|
heading: "A type definition for the configuration options to pass to the select prompt, which extends the base PromptConfig with additional options specific to select prompts. This type can be used when creating a select prompt using the {@link select | select prompt factory function}.",
|
|
1631
1632
|
get children() {
|
|
1632
|
-
return (0,
|
|
1633
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The Select Config type includes all the properties of the base PromptConfig, such as message, description, initialValue, validate, parse, format, etc., as well as any additional properties that are specific to select prompts, such as the list of options and pagination settings.` });
|
|
1633
1634
|
}
|
|
1634
1635
|
}),
|
|
1635
|
-
(0,
|
|
1636
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
|
|
1636
1637
|
"export": true,
|
|
1637
1638
|
name: "SelectConfig",
|
|
1638
|
-
children:
|
|
1639
|
+
children: _alloy_js_core.code`PromptFactoryConfig<string> & SelectPromptConfig; `
|
|
1639
1640
|
}),
|
|
1640
|
-
(0,
|
|
1641
|
-
(0,
|
|
1641
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1642
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
1642
1643
|
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.",
|
|
1643
1644
|
get children() {
|
|
1644
1645
|
return [
|
|
1645
|
-
(0,
|
|
1646
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { select, isCancel } from "shell-shock:prompts";
|
|
1646
1647
|
|
|
1647
1648
|
async function run() {
|
|
1648
1649
|
const color = await select({
|
|
@@ -1665,16 +1666,16 @@ async function run() {
|
|
|
1665
1666
|
}
|
|
1666
1667
|
|
|
1667
1668
|
run(); ` }),
|
|
1668
|
-
(0,
|
|
1669
|
-
(0,
|
|
1669
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1670
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
1670
1671
|
name: "config",
|
|
1671
1672
|
children: `The configuration options to pass to the select prompt, which extends the base PromptConfig with additional options specific to select prompts`
|
|
1672
1673
|
}),
|
|
1673
|
-
(0,
|
|
1674
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled` })
|
|
1674
1675
|
];
|
|
1675
1676
|
}
|
|
1676
1677
|
}),
|
|
1677
|
-
(0,
|
|
1678
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1678
1679
|
name: "select",
|
|
1679
1680
|
"export": true,
|
|
1680
1681
|
parameters: [{
|
|
@@ -1682,7 +1683,7 @@ run(); ` }),
|
|
|
1682
1683
|
type: "SelectConfig"
|
|
1683
1684
|
}],
|
|
1684
1685
|
returnType: "Promise<string | symbol>",
|
|
1685
|
-
children:
|
|
1686
|
+
children: _alloy_js_core.code`return new Promise<string | symbol>((response, reject) => {
|
|
1686
1687
|
const prompt = new SelectPrompt(config);
|
|
1687
1688
|
|
|
1688
1689
|
prompt.on("state", state => config.onState?.(state));
|
|
@@ -1697,41 +1698,41 @@ run(); ` }),
|
|
|
1697
1698
|
*/
|
|
1698
1699
|
function NumericPromptDeclarations() {
|
|
1699
1700
|
return [
|
|
1700
|
-
(0,
|
|
1701
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
1701
1702
|
name: "NumberPromptConfig",
|
|
1702
1703
|
"extends": "PromptConfig<number>",
|
|
1703
1704
|
doc: "Configuration options for creating a numeric prompt",
|
|
1704
1705
|
get children() {
|
|
1705
1706
|
return [
|
|
1706
|
-
(0,
|
|
1707
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1707
1708
|
name: "isFloat",
|
|
1708
1709
|
optional: true,
|
|
1709
1710
|
type: "boolean",
|
|
1710
1711
|
doc: "Whether the prompt should accept floating point numbers"
|
|
1711
1712
|
}),
|
|
1712
|
-
(0,
|
|
1713
|
-
(0,
|
|
1713
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1714
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1714
1715
|
name: "precision",
|
|
1715
1716
|
optional: true,
|
|
1716
1717
|
type: "number",
|
|
1717
1718
|
doc: "The number of decimal places to round the input to, defaults to 2"
|
|
1718
1719
|
}),
|
|
1719
|
-
(0,
|
|
1720
|
-
(0,
|
|
1720
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1721
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1721
1722
|
name: "increment",
|
|
1722
1723
|
optional: true,
|
|
1723
1724
|
type: "number",
|
|
1724
1725
|
doc: "The increment value for the number prompt, defaults to 1"
|
|
1725
1726
|
}),
|
|
1726
|
-
(0,
|
|
1727
|
-
(0,
|
|
1727
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1728
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1728
1729
|
name: "min",
|
|
1729
1730
|
optional: true,
|
|
1730
1731
|
type: "number",
|
|
1731
1732
|
doc: "The minimum value for the number prompt, defaults to -Infinity"
|
|
1732
1733
|
}),
|
|
1733
|
-
(0,
|
|
1734
|
-
(0,
|
|
1734
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1735
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
1735
1736
|
name: "max",
|
|
1736
1737
|
optional: true,
|
|
1737
1738
|
type: "number",
|
|
@@ -1740,72 +1741,72 @@ function NumericPromptDeclarations() {
|
|
|
1740
1741
|
];
|
|
1741
1742
|
}
|
|
1742
1743
|
}),
|
|
1743
|
-
(0,
|
|
1744
|
-
(0,
|
|
1744
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1745
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassDeclaration, {
|
|
1745
1746
|
name: "NumberPrompt",
|
|
1746
1747
|
doc: "A prompt for selecting a number input",
|
|
1747
1748
|
"extends": "Prompt<number>",
|
|
1748
1749
|
get children() {
|
|
1749
1750
|
return [
|
|
1750
|
-
(0,
|
|
1751
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1751
1752
|
name: "isInvalid",
|
|
1752
1753
|
isPrivateMember: true,
|
|
1753
1754
|
type: "boolean",
|
|
1754
|
-
children:
|
|
1755
|
+
children: _alloy_js_core.code`false; `
|
|
1755
1756
|
}),
|
|
1756
|
-
(0,
|
|
1757
|
-
(0,
|
|
1757
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1758
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1758
1759
|
name: "initialValue",
|
|
1759
1760
|
"protected": true,
|
|
1760
1761
|
override: true,
|
|
1761
1762
|
type: "number",
|
|
1762
|
-
children:
|
|
1763
|
+
children: _alloy_js_core.code`0; `
|
|
1763
1764
|
}),
|
|
1764
|
-
(0,
|
|
1765
|
-
(0,
|
|
1765
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1766
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1766
1767
|
name: "defaultErrorMessage",
|
|
1767
1768
|
"protected": true,
|
|
1768
1769
|
override: true,
|
|
1769
1770
|
type: "string",
|
|
1770
|
-
children:
|
|
1771
|
+
children: _alloy_js_core.code`"A valid numeric value must be provided"; `
|
|
1771
1772
|
}),
|
|
1772
|
-
(0,
|
|
1773
|
-
(0,
|
|
1773
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1774
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1774
1775
|
name: "isFloat",
|
|
1775
1776
|
"protected": true,
|
|
1776
1777
|
type: "boolean",
|
|
1777
|
-
children:
|
|
1778
|
+
children: _alloy_js_core.code`false; `
|
|
1778
1779
|
}),
|
|
1779
|
-
(0,
|
|
1780
|
-
(0,
|
|
1780
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1781
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1781
1782
|
name: "precision",
|
|
1782
1783
|
"protected": true,
|
|
1783
1784
|
type: "number",
|
|
1784
|
-
children:
|
|
1785
|
+
children: _alloy_js_core.code`2; `
|
|
1785
1786
|
}),
|
|
1786
|
-
(0,
|
|
1787
|
-
(0,
|
|
1787
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1788
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1788
1789
|
name: "increment",
|
|
1789
1790
|
"protected": true,
|
|
1790
1791
|
type: "number",
|
|
1791
|
-
children:
|
|
1792
|
+
children: _alloy_js_core.code`1; `
|
|
1792
1793
|
}),
|
|
1793
|
-
(0,
|
|
1794
|
-
(0,
|
|
1794
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1795
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1795
1796
|
name: "min",
|
|
1796
1797
|
"protected": true,
|
|
1797
1798
|
type: "number",
|
|
1798
|
-
children:
|
|
1799
|
+
children: _alloy_js_core.code`Number.NEGATIVE_INFINITY; `
|
|
1799
1800
|
}),
|
|
1800
|
-
(0,
|
|
1801
|
-
(0,
|
|
1801
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1802
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
1802
1803
|
name: "max",
|
|
1803
1804
|
"protected": true,
|
|
1804
1805
|
type: "number",
|
|
1805
|
-
children:
|
|
1806
|
+
children: _alloy_js_core.code`Number.POSITIVE_INFINITY; `
|
|
1806
1807
|
}),
|
|
1807
|
-
(0,
|
|
1808
|
-
|
|
1808
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1809
|
+
_alloy_js_core.code`constructor(config: NumberPromptConfig) {
|
|
1809
1810
|
super(config);
|
|
1810
1811
|
|
|
1811
1812
|
if (config.initialValue) {
|
|
@@ -1846,8 +1847,8 @@ function NumericPromptDeclarations() {
|
|
|
1846
1847
|
this.sync();
|
|
1847
1848
|
this.last();
|
|
1848
1849
|
} `,
|
|
1849
|
-
(0,
|
|
1850
|
-
(0,
|
|
1850
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1851
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1851
1852
|
doc: "A method to handle key press events and determine the corresponding action",
|
|
1852
1853
|
name: "onKeyPress",
|
|
1853
1854
|
override: true,
|
|
@@ -1859,7 +1860,7 @@ function NumericPromptDeclarations() {
|
|
|
1859
1860
|
name: "key",
|
|
1860
1861
|
type: "readline.Key"
|
|
1861
1862
|
}],
|
|
1862
|
-
children:
|
|
1863
|
+
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
1863
1864
|
if (action && typeof (this as any)[action] === "function") {
|
|
1864
1865
|
return (this as any)[action]();
|
|
1865
1866
|
}
|
|
@@ -1889,8 +1890,8 @@ function NumericPromptDeclarations() {
|
|
|
1889
1890
|
this.changeValue(value);
|
|
1890
1891
|
this.sync(); `
|
|
1891
1892
|
}),
|
|
1892
|
-
(0,
|
|
1893
|
-
(0,
|
|
1893
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1894
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1894
1895
|
doc: "A method to handle changes in the prompt value",
|
|
1895
1896
|
name: "onChange",
|
|
1896
1897
|
override: true,
|
|
@@ -1899,33 +1900,33 @@ function NumericPromptDeclarations() {
|
|
|
1899
1900
|
name: "previousValue",
|
|
1900
1901
|
type: "number"
|
|
1901
1902
|
}],
|
|
1902
|
-
children:
|
|
1903
|
+
children: _alloy_js_core.code`this.#isInvalid = false;
|
|
1903
1904
|
this.cursor = this.displayValue.slice(0, this.cursor).length + 1; `
|
|
1904
1905
|
}),
|
|
1905
|
-
(0,
|
|
1906
|
-
(0,
|
|
1906
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1907
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1907
1908
|
doc: "A method to validate the prompt input",
|
|
1908
1909
|
name: "checkValidations",
|
|
1909
1910
|
override: true,
|
|
1910
1911
|
async: true,
|
|
1911
1912
|
"protected": true,
|
|
1912
|
-
children:
|
|
1913
|
+
children: _alloy_js_core.code`await super.checkValidations(this.value);
|
|
1913
1914
|
this.#isInvalid = this.isError; `
|
|
1914
1915
|
}),
|
|
1915
|
-
(0,
|
|
1916
|
-
(0,
|
|
1916
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1917
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1917
1918
|
doc: "A method to move the cursor to the end of the input",
|
|
1918
1919
|
name: "next",
|
|
1919
1920
|
"protected": true,
|
|
1920
|
-
children:
|
|
1921
|
+
children: _alloy_js_core.code`this.changeValue(this.initialValue);
|
|
1921
1922
|
this.sync(); `
|
|
1922
1923
|
}),
|
|
1923
|
-
(0,
|
|
1924
|
-
(0,
|
|
1924
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1925
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1925
1926
|
doc: "A method to move the cursor to the up",
|
|
1926
1927
|
name: "up",
|
|
1927
1928
|
"protected": true,
|
|
1928
|
-
children:
|
|
1929
|
+
children: _alloy_js_core.code`let value = this.value;
|
|
1929
1930
|
if (this.isPlaceholder) {
|
|
1930
1931
|
value = this.min < 0 ? 0 : this.min;
|
|
1931
1932
|
} else if (value >= this.max) {
|
|
@@ -1937,12 +1938,12 @@ function NumericPromptDeclarations() {
|
|
|
1937
1938
|
this.sync();
|
|
1938
1939
|
this.last(); `
|
|
1939
1940
|
}),
|
|
1940
|
-
(0,
|
|
1941
|
-
(0,
|
|
1941
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1942
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1942
1943
|
doc: "A method to move the cursor to the down",
|
|
1943
1944
|
name: "down",
|
|
1944
1945
|
"protected": true,
|
|
1945
|
-
children:
|
|
1946
|
+
children: _alloy_js_core.code`let value = this.value;
|
|
1946
1947
|
if (this.isPlaceholder) {
|
|
1947
1948
|
value = this.min < 0 ? 0 : this.min;
|
|
1948
1949
|
} else if (value <= this.min) {
|
|
@@ -1953,54 +1954,54 @@ function NumericPromptDeclarations() {
|
|
|
1953
1954
|
this.sync();
|
|
1954
1955
|
this.last(); `
|
|
1955
1956
|
}),
|
|
1956
|
-
(0,
|
|
1957
|
-
(0,
|
|
1957
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1958
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1958
1959
|
doc: "A method to move the cursor to the left",
|
|
1959
1960
|
name: "left",
|
|
1960
1961
|
"protected": true,
|
|
1961
|
-
children:
|
|
1962
|
+
children: _alloy_js_core.code`if (this.cursor <= 0) {
|
|
1962
1963
|
return this.bell();
|
|
1963
1964
|
}
|
|
1964
1965
|
|
|
1965
1966
|
this.moveCursor(-1);
|
|
1966
1967
|
this.sync(); `
|
|
1967
1968
|
}),
|
|
1968
|
-
(0,
|
|
1969
|
-
(0,
|
|
1969
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1970
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1970
1971
|
doc: "A method to move the cursor to the right",
|
|
1971
1972
|
name: "right",
|
|
1972
1973
|
"protected": true,
|
|
1973
|
-
children:
|
|
1974
|
+
children: _alloy_js_core.code`if (this.cursor >= this.displayValue.length) {
|
|
1974
1975
|
return this.bell();
|
|
1975
1976
|
}
|
|
1976
1977
|
|
|
1977
1978
|
this.moveCursor(1);
|
|
1978
1979
|
this.sync(); `
|
|
1979
1980
|
}),
|
|
1980
|
-
(0,
|
|
1981
|
-
(0,
|
|
1981
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1982
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1982
1983
|
doc: "A method to move the cursor to the start",
|
|
1983
1984
|
name: "first",
|
|
1984
1985
|
"protected": true,
|
|
1985
|
-
children:
|
|
1986
|
+
children: _alloy_js_core.code`this.cursor = 0;
|
|
1986
1987
|
this.sync(); `
|
|
1987
1988
|
}),
|
|
1988
|
-
(0,
|
|
1989
|
-
(0,
|
|
1989
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1990
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1990
1991
|
doc: "A method to move the cursor to the end",
|
|
1991
1992
|
name: "last",
|
|
1992
1993
|
"protected": true,
|
|
1993
|
-
children:
|
|
1994
|
+
children: _alloy_js_core.code`this.cursor = this.displayValue.length;
|
|
1994
1995
|
this.sync(); `
|
|
1995
1996
|
}),
|
|
1996
|
-
(0,
|
|
1997
|
-
(0,
|
|
1997
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1998
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
1998
1999
|
doc: "A method to render the prompt",
|
|
1999
2000
|
name: "onRender",
|
|
2000
2001
|
override: true,
|
|
2001
2002
|
"protected": true,
|
|
2002
2003
|
returnType: "string",
|
|
2003
|
-
children:
|
|
2004
|
+
children: _alloy_js_core.code`return this.isPlaceholder
|
|
2004
2005
|
? colors.text.prompt.input.disabled(this.displayValue)
|
|
2005
2006
|
: this.#isInvalid
|
|
2006
2007
|
? colors.text.prompt.input.error(this.displayValue)
|
|
@@ -2013,19 +2014,19 @@ function NumericPromptDeclarations() {
|
|
|
2013
2014
|
];
|
|
2014
2015
|
}
|
|
2015
2016
|
}),
|
|
2016
|
-
(0,
|
|
2017
|
-
(0,
|
|
2018
|
-
(0,
|
|
2017
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2018
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "An object representing the configuration options for a numeric prompt." }),
|
|
2019
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
|
|
2019
2020
|
name: "NumericConfig",
|
|
2020
2021
|
"export": true,
|
|
2021
|
-
children:
|
|
2022
|
+
children: _alloy_js_core.code`PromptFactoryConfig<number> & NumberPromptConfig; `
|
|
2022
2023
|
}),
|
|
2023
|
-
(0,
|
|
2024
|
-
(0,
|
|
2024
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2025
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2025
2026
|
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.",
|
|
2026
2027
|
get children() {
|
|
2027
2028
|
return [
|
|
2028
|
-
(0,
|
|
2029
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { numeric, isCancel } from "shell-shock:prompts";
|
|
2029
2030
|
|
|
2030
2031
|
async function run() {
|
|
2031
2032
|
const age = await numeric({
|
|
@@ -2042,16 +2043,16 @@ async function run() {
|
|
|
2042
2043
|
}
|
|
2043
2044
|
|
|
2044
2045
|
run(); ` }),
|
|
2045
|
-
(0,
|
|
2046
|
-
(0,
|
|
2046
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2047
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
2047
2048
|
name: "config",
|
|
2048
2049
|
children: `The configuration options to pass to the numeric prompt, which extends the base PromptFactoryConfig with additional options specific to numeric prompts`
|
|
2049
2050
|
}),
|
|
2050
|
-
(0,
|
|
2051
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled` })
|
|
2051
2052
|
];
|
|
2052
2053
|
}
|
|
2053
2054
|
}),
|
|
2054
|
-
(0,
|
|
2055
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
2055
2056
|
name: "numeric",
|
|
2056
2057
|
"export": true,
|
|
2057
2058
|
parameters: [{
|
|
@@ -2059,7 +2060,7 @@ run(); ` }),
|
|
|
2059
2060
|
type: "NumericConfig"
|
|
2060
2061
|
}],
|
|
2061
2062
|
returnType: "Promise<number | symbol>",
|
|
2062
|
-
children:
|
|
2063
|
+
children: _alloy_js_core.code`return new Promise<number | symbol>((response, reject) => {
|
|
2063
2064
|
const prompt = new NumberPrompt(config);
|
|
2064
2065
|
|
|
2065
2066
|
prompt.on("state", state => config.onState?.(state));
|
|
@@ -2074,69 +2075,69 @@ run(); ` }),
|
|
|
2074
2075
|
*/
|
|
2075
2076
|
function TogglePromptDeclarations() {
|
|
2076
2077
|
return [
|
|
2077
|
-
(0,
|
|
2078
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
2078
2079
|
"export": true,
|
|
2079
2080
|
name: "TogglePromptConfig",
|
|
2080
2081
|
"extends": "PromptConfig<boolean>",
|
|
2081
2082
|
doc: "Configuration options for creating a boolean toggle prompt",
|
|
2082
2083
|
get children() {
|
|
2083
2084
|
return [
|
|
2084
|
-
(0,
|
|
2085
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
2085
2086
|
name: "trueMessage",
|
|
2086
2087
|
optional: true,
|
|
2087
2088
|
type: "string",
|
|
2088
2089
|
doc: "The message for the true state of the prompt"
|
|
2089
2090
|
}),
|
|
2090
|
-
(0,
|
|
2091
|
-
(0,
|
|
2091
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2092
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
2092
2093
|
name: "falseMessage",
|
|
2093
2094
|
optional: true,
|
|
2094
2095
|
type: "string",
|
|
2095
2096
|
doc: "The message for the false state of the prompt"
|
|
2096
2097
|
}),
|
|
2097
|
-
(0,
|
|
2098
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
2098
2099
|
];
|
|
2099
2100
|
}
|
|
2100
2101
|
}),
|
|
2101
|
-
(0,
|
|
2102
|
-
(0,
|
|
2102
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2103
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassDeclaration, {
|
|
2103
2104
|
"export": true,
|
|
2104
2105
|
name: "TogglePrompt",
|
|
2105
2106
|
doc: "A prompt for toggling a boolean input",
|
|
2106
2107
|
"extends": "Prompt<boolean>",
|
|
2107
2108
|
get children() {
|
|
2108
2109
|
return [
|
|
2109
|
-
(0,
|
|
2110
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2110
2111
|
name: "initialValue",
|
|
2111
2112
|
"protected": true,
|
|
2112
2113
|
override: true,
|
|
2113
2114
|
type: "boolean",
|
|
2114
|
-
children:
|
|
2115
|
+
children: _alloy_js_core.code`false; `
|
|
2115
2116
|
}),
|
|
2116
|
-
(0,
|
|
2117
|
-
(0,
|
|
2117
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2118
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2118
2119
|
name: "trueMessage",
|
|
2119
2120
|
"protected": true,
|
|
2120
2121
|
type: "string",
|
|
2121
|
-
children:
|
|
2122
|
+
children: _alloy_js_core.code`"Yes"; `
|
|
2122
2123
|
}),
|
|
2123
|
-
(0,
|
|
2124
|
-
(0,
|
|
2124
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2125
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2125
2126
|
name: "falseMessage",
|
|
2126
2127
|
"protected": true,
|
|
2127
2128
|
type: "string",
|
|
2128
|
-
children:
|
|
2129
|
+
children: _alloy_js_core.code`"No"; `
|
|
2129
2130
|
}),
|
|
2130
|
-
(0,
|
|
2131
|
-
(0,
|
|
2131
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2132
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2132
2133
|
name: "cursorHidden",
|
|
2133
2134
|
"protected": true,
|
|
2134
2135
|
override: true,
|
|
2135
2136
|
type: "boolean",
|
|
2136
|
-
children:
|
|
2137
|
+
children: _alloy_js_core.code`true; `
|
|
2137
2138
|
}),
|
|
2138
|
-
(0,
|
|
2139
|
-
|
|
2139
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2140
|
+
_alloy_js_core.code`constructor(config: TogglePromptConfig) {
|
|
2140
2141
|
super(config);
|
|
2141
2142
|
|
|
2142
2143
|
if (config.initialValue) {
|
|
@@ -2152,32 +2153,32 @@ function TogglePromptDeclarations() {
|
|
|
2152
2153
|
|
|
2153
2154
|
this.sync();
|
|
2154
2155
|
} `,
|
|
2155
|
-
(0,
|
|
2156
|
-
(0,
|
|
2156
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2157
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2157
2158
|
doc: "Update the toggle value to a checked state based on user input",
|
|
2158
2159
|
name: "check",
|
|
2159
2160
|
"protected": true,
|
|
2160
|
-
children:
|
|
2161
|
+
children: _alloy_js_core.code`if (this.value === true) {
|
|
2161
2162
|
return this.bell();
|
|
2162
2163
|
}
|
|
2163
2164
|
|
|
2164
2165
|
this.changeValue(true);
|
|
2165
2166
|
this.sync(); `
|
|
2166
2167
|
}),
|
|
2167
|
-
(0,
|
|
2168
|
-
(0,
|
|
2168
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2169
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2169
2170
|
doc: "Update the toggle value to an unchecked state based on user input",
|
|
2170
2171
|
name: "uncheck",
|
|
2171
2172
|
"protected": true,
|
|
2172
|
-
children:
|
|
2173
|
+
children: _alloy_js_core.code`if (this.value === false) {
|
|
2173
2174
|
return this.bell();
|
|
2174
2175
|
}
|
|
2175
2176
|
|
|
2176
2177
|
this.changeValue(false);
|
|
2177
2178
|
this.sync(); `
|
|
2178
2179
|
}),
|
|
2179
|
-
(0,
|
|
2180
|
-
(0,
|
|
2180
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2181
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2181
2182
|
doc: "A method to handle key press events and determine the corresponding action",
|
|
2182
2183
|
name: "onKeyPress",
|
|
2183
2184
|
override: true,
|
|
@@ -2189,7 +2190,7 @@ function TogglePromptDeclarations() {
|
|
|
2189
2190
|
name: "key",
|
|
2190
2191
|
type: "readline.Key"
|
|
2191
2192
|
}],
|
|
2192
|
-
children:
|
|
2193
|
+
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
2193
2194
|
if (action && typeof (this as any)[action] === "function") {
|
|
2194
2195
|
return (this as any)[action]();
|
|
2195
2196
|
}
|
|
@@ -2206,57 +2207,57 @@ function TogglePromptDeclarations() {
|
|
|
2206
2207
|
|
|
2207
2208
|
this.sync(); `
|
|
2208
2209
|
}),
|
|
2209
|
-
(0,
|
|
2210
|
-
(0,
|
|
2210
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2211
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2211
2212
|
doc: "A method to remove the character backward of the cursor",
|
|
2212
2213
|
name: "backspace",
|
|
2213
2214
|
"protected": true,
|
|
2214
|
-
children:
|
|
2215
|
+
children: _alloy_js_core.code`this.uncheck(); `
|
|
2215
2216
|
}),
|
|
2216
|
-
(0,
|
|
2217
|
-
(0,
|
|
2217
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2218
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2218
2219
|
doc: "A method to move the cursor to the left",
|
|
2219
2220
|
name: "left",
|
|
2220
2221
|
"protected": true,
|
|
2221
|
-
children:
|
|
2222
|
+
children: _alloy_js_core.code`this.uncheck(); `
|
|
2222
2223
|
}),
|
|
2223
|
-
(0,
|
|
2224
|
-
(0,
|
|
2224
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2225
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2225
2226
|
doc: "A method to move the cursor to the right",
|
|
2226
2227
|
name: "right",
|
|
2227
2228
|
"protected": true,
|
|
2228
|
-
children:
|
|
2229
|
+
children: _alloy_js_core.code`this.check(); `
|
|
2229
2230
|
}),
|
|
2230
|
-
(0,
|
|
2231
|
-
(0,
|
|
2231
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2232
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2232
2233
|
doc: "A method to move the cursor to down",
|
|
2233
2234
|
name: "down",
|
|
2234
2235
|
"protected": true,
|
|
2235
|
-
children:
|
|
2236
|
+
children: _alloy_js_core.code`this.uncheck(); `
|
|
2236
2237
|
}),
|
|
2237
|
-
(0,
|
|
2238
|
-
(0,
|
|
2238
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2239
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2239
2240
|
doc: "A method to move the cursor to up",
|
|
2240
2241
|
name: "up",
|
|
2241
2242
|
"protected": true,
|
|
2242
|
-
children:
|
|
2243
|
+
children: _alloy_js_core.code`this.check(); `
|
|
2243
2244
|
}),
|
|
2244
|
-
(0,
|
|
2245
|
-
(0,
|
|
2245
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2246
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2246
2247
|
doc: "A method to move to the next value",
|
|
2247
2248
|
name: "next",
|
|
2248
2249
|
"protected": true,
|
|
2249
|
-
children:
|
|
2250
|
+
children: _alloy_js_core.code`this.changeValue(!this.value);
|
|
2250
2251
|
this.sync(); `
|
|
2251
2252
|
}),
|
|
2252
|
-
(0,
|
|
2253
|
-
(0,
|
|
2253
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2254
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2254
2255
|
doc: "A method to render the prompt",
|
|
2255
2256
|
name: "onRender",
|
|
2256
2257
|
override: true,
|
|
2257
2258
|
"protected": true,
|
|
2258
2259
|
returnType: "string",
|
|
2259
|
-
children:
|
|
2260
|
+
children: _alloy_js_core.code`return this.isSubmitted
|
|
2260
2261
|
? colors.text.prompt.input.submitted(this.value ? this.trueMessage : this.falseMessage)
|
|
2261
2262
|
: this.isCancelled
|
|
2262
2263
|
? colors.text.prompt.input.cancelled(this.value ? this.trueMessage : this.falseMessage)
|
|
@@ -2269,19 +2270,19 @@ function TogglePromptDeclarations() {
|
|
|
2269
2270
|
];
|
|
2270
2271
|
}
|
|
2271
2272
|
}),
|
|
2272
|
-
(0,
|
|
2273
|
-
(0,
|
|
2274
|
-
(0,
|
|
2273
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2274
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "An object representing the configuration options for a toggle prompt, which extends the base PromptFactoryConfig with additional options specific to the toggle prompt." }),
|
|
2275
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
|
|
2275
2276
|
name: "ToggleConfig",
|
|
2276
2277
|
"export": true,
|
|
2277
|
-
children:
|
|
2278
|
+
children: _alloy_js_core.code`PromptFactoryConfig<boolean> & TogglePromptConfig; `
|
|
2278
2279
|
}),
|
|
2279
|
-
(0,
|
|
2280
|
-
(0,
|
|
2280
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2281
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2281
2282
|
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.",
|
|
2282
2283
|
get children() {
|
|
2283
2284
|
return [
|
|
2284
|
-
(0,
|
|
2285
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { toggle, isCancel } from "shell-shock:prompts";
|
|
2285
2286
|
|
|
2286
2287
|
async function run() {
|
|
2287
2288
|
const likesIceCream = await toggle({
|
|
@@ -2296,16 +2297,16 @@ async function run() {
|
|
|
2296
2297
|
}
|
|
2297
2298
|
|
|
2298
2299
|
run(); ` }),
|
|
2299
|
-
(0,
|
|
2300
|
-
(0,
|
|
2300
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2301
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
2301
2302
|
name: "config",
|
|
2302
2303
|
children: `The configuration options to pass to the toggle prompt, which extends the base PromptFactoryConfig with additional options specific to the toggle prompt`
|
|
2303
2304
|
}),
|
|
2304
|
-
(0,
|
|
2305
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled` })
|
|
2305
2306
|
];
|
|
2306
2307
|
}
|
|
2307
2308
|
}),
|
|
2308
|
-
(0,
|
|
2309
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
2309
2310
|
name: "toggle",
|
|
2310
2311
|
"export": true,
|
|
2311
2312
|
parameters: [{
|
|
@@ -2313,7 +2314,7 @@ run(); ` }),
|
|
|
2313
2314
|
type: "ToggleConfig"
|
|
2314
2315
|
}],
|
|
2315
2316
|
returnType: "Promise<boolean | symbol>",
|
|
2316
|
-
children:
|
|
2317
|
+
children: _alloy_js_core.code`return new Promise<boolean | symbol>((response, reject) => {
|
|
2317
2318
|
const prompt = new TogglePrompt(config);
|
|
2318
2319
|
|
|
2319
2320
|
prompt.on("state", state => config.onState?.(state));
|
|
@@ -2328,76 +2329,76 @@ run(); ` }),
|
|
|
2328
2329
|
*/
|
|
2329
2330
|
function ConfirmPromptDeclarations() {
|
|
2330
2331
|
return [
|
|
2331
|
-
(0,
|
|
2332
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
2332
2333
|
"export": true,
|
|
2333
2334
|
name: "ConfirmPromptConfig",
|
|
2334
2335
|
"extends": "PromptConfig<boolean>",
|
|
2335
2336
|
doc: "Configuration options for creating a boolean confirm prompt",
|
|
2336
2337
|
get children() {
|
|
2337
2338
|
return [
|
|
2338
|
-
(0,
|
|
2339
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2339
2340
|
heading: "The message for the \\`Yes\\` state of the prompt",
|
|
2340
2341
|
get children() {
|
|
2341
|
-
return (0,
|
|
2342
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
2342
2343
|
get type() {
|
|
2343
|
-
return
|
|
2344
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
2344
2345
|
},
|
|
2345
2346
|
defaultValue: "Yes"
|
|
2346
2347
|
});
|
|
2347
2348
|
}
|
|
2348
2349
|
}),
|
|
2349
|
-
(0,
|
|
2350
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
2350
2351
|
name: "yesMessage",
|
|
2351
2352
|
optional: true,
|
|
2352
2353
|
type: "string"
|
|
2353
2354
|
}),
|
|
2354
|
-
(0,
|
|
2355
|
-
(0,
|
|
2355
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2356
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2356
2357
|
heading: "The \\`Yes\\` option when choosing between yes/no",
|
|
2357
2358
|
get children() {
|
|
2358
|
-
return (0,
|
|
2359
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
2359
2360
|
get type() {
|
|
2360
|
-
return
|
|
2361
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
2361
2362
|
},
|
|
2362
2363
|
defaultValue: "1"
|
|
2363
2364
|
});
|
|
2364
2365
|
}
|
|
2365
2366
|
}),
|
|
2366
|
-
(0,
|
|
2367
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
2367
2368
|
name: "yesOption",
|
|
2368
2369
|
optional: true,
|
|
2369
2370
|
type: "string"
|
|
2370
2371
|
}),
|
|
2371
|
-
(0,
|
|
2372
|
-
(0,
|
|
2372
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2373
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2373
2374
|
heading: "The message for the \\`No\\` state of the prompt",
|
|
2374
2375
|
get children() {
|
|
2375
|
-
return (0,
|
|
2376
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
2376
2377
|
get type() {
|
|
2377
|
-
return
|
|
2378
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
2378
2379
|
},
|
|
2379
2380
|
defaultValue: "(Y/n)"
|
|
2380
2381
|
});
|
|
2381
2382
|
}
|
|
2382
2383
|
}),
|
|
2383
|
-
(0,
|
|
2384
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
2384
2385
|
name: "noMessage",
|
|
2385
2386
|
optional: true,
|
|
2386
2387
|
type: "string"
|
|
2387
2388
|
}),
|
|
2388
|
-
(0,
|
|
2389
|
-
(0,
|
|
2389
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2390
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2390
2391
|
heading: "The \\`No\\` option when choosing between yes/no",
|
|
2391
2392
|
get children() {
|
|
2392
|
-
return (0,
|
|
2393
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
2393
2394
|
get type() {
|
|
2394
|
-
return
|
|
2395
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
2395
2396
|
},
|
|
2396
2397
|
defaultValue: "(y/N)"
|
|
2397
2398
|
});
|
|
2398
2399
|
}
|
|
2399
2400
|
}),
|
|
2400
|
-
(0,
|
|
2401
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceMember, {
|
|
2401
2402
|
name: "noOption",
|
|
2402
2403
|
optional: true,
|
|
2403
2404
|
type: "string"
|
|
@@ -2405,59 +2406,59 @@ function ConfirmPromptDeclarations() {
|
|
|
2405
2406
|
];
|
|
2406
2407
|
}
|
|
2407
2408
|
}),
|
|
2408
|
-
(0,
|
|
2409
|
-
(0,
|
|
2409
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2410
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassDeclaration, {
|
|
2410
2411
|
"export": true,
|
|
2411
2412
|
name: "ConfirmPrompt",
|
|
2412
2413
|
doc: "A prompt for confirming a boolean input",
|
|
2413
2414
|
"extends": "Prompt<boolean>",
|
|
2414
2415
|
get children() {
|
|
2415
2416
|
return [
|
|
2416
|
-
(0,
|
|
2417
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2417
2418
|
name: "initialValue",
|
|
2418
2419
|
"protected": true,
|
|
2419
2420
|
override: true,
|
|
2420
2421
|
type: "boolean",
|
|
2421
|
-
children:
|
|
2422
|
+
children: _alloy_js_core.code`false; `
|
|
2422
2423
|
}),
|
|
2423
|
-
(0,
|
|
2424
|
-
(0,
|
|
2424
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2425
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2425
2426
|
name: "yesMessage",
|
|
2426
2427
|
"protected": true,
|
|
2427
2428
|
type: "string",
|
|
2428
|
-
children:
|
|
2429
|
+
children: _alloy_js_core.code`"Yes"; `
|
|
2429
2430
|
}),
|
|
2430
|
-
(0,
|
|
2431
|
-
(0,
|
|
2431
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2432
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2432
2433
|
name: "yesOption",
|
|
2433
2434
|
"protected": true,
|
|
2434
2435
|
type: "string",
|
|
2435
|
-
children:
|
|
2436
|
+
children: _alloy_js_core.code`"(Y/n)"; `
|
|
2436
2437
|
}),
|
|
2437
|
-
(0,
|
|
2438
|
-
(0,
|
|
2438
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2439
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2439
2440
|
name: "noMessage",
|
|
2440
2441
|
"protected": true,
|
|
2441
2442
|
type: "string",
|
|
2442
|
-
children:
|
|
2443
|
+
children: _alloy_js_core.code`"No"; `
|
|
2443
2444
|
}),
|
|
2444
|
-
(0,
|
|
2445
|
-
(0,
|
|
2445
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2446
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2446
2447
|
name: "noOption",
|
|
2447
2448
|
"protected": true,
|
|
2448
2449
|
type: "string",
|
|
2449
|
-
children:
|
|
2450
|
+
children: _alloy_js_core.code`"(y/N)"; `
|
|
2450
2451
|
}),
|
|
2451
|
-
(0,
|
|
2452
|
-
(0,
|
|
2452
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2453
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassField, {
|
|
2453
2454
|
name: "cursorHidden",
|
|
2454
2455
|
"protected": true,
|
|
2455
2456
|
override: true,
|
|
2456
2457
|
type: "boolean",
|
|
2457
|
-
children:
|
|
2458
|
+
children: _alloy_js_core.code`true; `
|
|
2458
2459
|
}),
|
|
2459
|
-
(0,
|
|
2460
|
-
|
|
2460
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2461
|
+
_alloy_js_core.code`constructor(config: ConfirmPromptConfig) {
|
|
2461
2462
|
super(config);
|
|
2462
2463
|
|
|
2463
2464
|
if (config.initialValue) {
|
|
@@ -2479,8 +2480,8 @@ function ConfirmPromptDeclarations() {
|
|
|
2479
2480
|
|
|
2480
2481
|
this.sync();
|
|
2481
2482
|
} `,
|
|
2482
|
-
(0,
|
|
2483
|
-
(0,
|
|
2483
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2484
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2484
2485
|
doc: "A method to handle key press events and determine the corresponding action",
|
|
2485
2486
|
name: "onKeyPress",
|
|
2486
2487
|
override: true,
|
|
@@ -2492,7 +2493,7 @@ function ConfirmPromptDeclarations() {
|
|
|
2492
2493
|
name: "key",
|
|
2493
2494
|
type: "readline.Key"
|
|
2494
2495
|
}],
|
|
2495
|
-
children:
|
|
2496
|
+
children: _alloy_js_core.code`const action = this.getAction(key);
|
|
2496
2497
|
if (action && typeof (this as any)[action] === "function") {
|
|
2497
2498
|
return (this as any)[action]();
|
|
2498
2499
|
}
|
|
@@ -2507,14 +2508,14 @@ function ConfirmPromptDeclarations() {
|
|
|
2507
2508
|
return this.bell();
|
|
2508
2509
|
} `
|
|
2509
2510
|
}),
|
|
2510
|
-
(0,
|
|
2511
|
-
(0,
|
|
2511
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2512
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_class_declaration.ClassMethod, {
|
|
2512
2513
|
doc: "A method to render the prompt",
|
|
2513
2514
|
name: "onRender",
|
|
2514
2515
|
override: true,
|
|
2515
2516
|
"protected": true,
|
|
2516
2517
|
returnType: "string",
|
|
2517
|
-
children:
|
|
2518
|
+
children: _alloy_js_core.code`return this.isSubmitted
|
|
2518
2519
|
? colors.text.prompt.input.submitted(this.value ? this.yesMessage : this.noMessage)
|
|
2519
2520
|
: this.isCancelled
|
|
2520
2521
|
? colors.text.prompt.input.cancelled(this.value ? this.yesMessage : this.noMessage)
|
|
@@ -2523,19 +2524,19 @@ function ConfirmPromptDeclarations() {
|
|
|
2523
2524
|
];
|
|
2524
2525
|
}
|
|
2525
2526
|
}),
|
|
2526
|
-
(0,
|
|
2527
|
-
(0,
|
|
2528
|
-
(0,
|
|
2527
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2528
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "An object representing the configuration options for a confirm prompt, which extends the base PromptFactoryConfig with additional options specific to the confirm prompt." }),
|
|
2529
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
|
|
2529
2530
|
name: "ConfirmConfig",
|
|
2530
2531
|
"export": true,
|
|
2531
|
-
children:
|
|
2532
|
+
children: _alloy_js_core.code`PromptFactoryConfig<boolean> & ConfirmPromptConfig; `
|
|
2532
2533
|
}),
|
|
2533
|
-
(0,
|
|
2534
|
-
(0,
|
|
2534
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2535
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2535
2536
|
heading: "A function to create and run a confirm 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.",
|
|
2536
2537
|
get children() {
|
|
2537
2538
|
return [
|
|
2538
|
-
(0,
|
|
2539
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { confirm, isCancel } from "shell-shock:prompts";
|
|
2539
2540
|
|
|
2540
2541
|
async function run() {
|
|
2541
2542
|
const likesIceCream = await confirm({
|
|
@@ -2550,16 +2551,16 @@ async function run() {
|
|
|
2550
2551
|
}
|
|
2551
2552
|
|
|
2552
2553
|
run(); ` }),
|
|
2553
|
-
(0,
|
|
2554
|
-
(0,
|
|
2554
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2555
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
2555
2556
|
name: "config",
|
|
2556
2557
|
children: `The configuration options to pass to the confirm prompt, which extends the base PromptFactoryConfig with additional options specific to the confirm prompt`
|
|
2557
2558
|
}),
|
|
2558
|
-
(0,
|
|
2559
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled` })
|
|
2559
2560
|
];
|
|
2560
2561
|
}
|
|
2561
2562
|
}),
|
|
2562
|
-
(0,
|
|
2563
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
2563
2564
|
name: "confirm",
|
|
2564
2565
|
"export": true,
|
|
2565
2566
|
parameters: [{
|
|
@@ -2567,7 +2568,7 @@ run(); ` }),
|
|
|
2567
2568
|
type: "ConfirmConfig"
|
|
2568
2569
|
}],
|
|
2569
2570
|
returnType: "Promise<boolean | symbol>",
|
|
2570
|
-
children:
|
|
2571
|
+
children: _alloy_js_core.code`return new Promise<boolean | symbol>((response, reject) => {
|
|
2571
2572
|
const prompt = new ConfirmPrompt(config);
|
|
2572
2573
|
|
|
2573
2574
|
prompt.on("state", state => config.onState?.(state));
|
|
@@ -2582,7 +2583,7 @@ run(); ` }),
|
|
|
2582
2583
|
*/
|
|
2583
2584
|
function PasswordPromptDeclaration() {
|
|
2584
2585
|
return [
|
|
2585
|
-
(0,
|
|
2586
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
2586
2587
|
"export": true,
|
|
2587
2588
|
name: "passwordMask",
|
|
2588
2589
|
doc: "A built-in prompt mask function that masks input with asterisks",
|
|
@@ -2591,23 +2592,23 @@ function PasswordPromptDeclaration() {
|
|
|
2591
2592
|
type: "string"
|
|
2592
2593
|
}],
|
|
2593
2594
|
returnType: "string",
|
|
2594
|
-
children:
|
|
2595
|
+
children: _alloy_js_core.code`return "*".repeat(input.length); `
|
|
2595
2596
|
}),
|
|
2596
|
-
(0,
|
|
2597
|
-
(0,
|
|
2598
|
-
(0,
|
|
2597
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2598
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "An object representing the configuration options for a password prompt, which extends the base PromptFactoryConfig with additional options specific to password prompts." }),
|
|
2599
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_type_declaration.TypeDeclaration, {
|
|
2599
2600
|
name: "PasswordConfig",
|
|
2600
2601
|
"export": true,
|
|
2601
|
-
children:
|
|
2602
|
+
children: _alloy_js_core.code`Omit<TextConfig, "mask" | "maskCompleted">; `
|
|
2602
2603
|
}),
|
|
2603
|
-
(0,
|
|
2604
|
-
(0,
|
|
2604
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2605
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2605
2606
|
heading: "A function to create and run a password 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.",
|
|
2606
2607
|
get children() {
|
|
2607
2608
|
return [
|
|
2608
|
-
(0,
|
|
2609
|
-
(0,
|
|
2610
|
-
(0,
|
|
2609
|
+
(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.` }),
|
|
2610
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2611
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { password, isCancel } from "shell-shock:prompts";
|
|
2611
2612
|
|
|
2612
2613
|
async function run() {
|
|
2613
2614
|
const userPassword = await password({
|
|
@@ -2622,16 +2623,16 @@ async function run() {
|
|
|
2622
2623
|
}
|
|
2623
2624
|
|
|
2624
2625
|
run(); ` }),
|
|
2625
|
-
(0,
|
|
2626
|
-
(0,
|
|
2626
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2627
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
2627
2628
|
name: "config",
|
|
2628
2629
|
children: `The configuration options to pass to the password prompt, which extends the base PromptConfig with additional options specific to password prompts`
|
|
2629
2630
|
}),
|
|
2630
|
-
(0,
|
|
2631
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled` })
|
|
2631
2632
|
];
|
|
2632
2633
|
}
|
|
2633
2634
|
}),
|
|
2634
|
-
(0,
|
|
2635
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
2635
2636
|
name: "password",
|
|
2636
2637
|
"export": true,
|
|
2637
2638
|
parameters: [{
|
|
@@ -2639,7 +2640,7 @@ run(); ` }),
|
|
|
2639
2640
|
type: "PasswordConfig"
|
|
2640
2641
|
}],
|
|
2641
2642
|
returnType: "Promise<string | symbol>",
|
|
2642
|
-
children:
|
|
2643
|
+
children: _alloy_js_core.code`return text({
|
|
2643
2644
|
...config,
|
|
2644
2645
|
mask: passwordMask,
|
|
2645
2646
|
maskCompleted: () => "*******"
|
|
@@ -2648,13 +2649,13 @@ run(); ` }),
|
|
|
2648
2649
|
];
|
|
2649
2650
|
}
|
|
2650
2651
|
function WaitForKeyPressDeclaration() {
|
|
2651
|
-
return [(0,
|
|
2652
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
2652
2653
|
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.",
|
|
2653
2654
|
get children() {
|
|
2654
2655
|
return [
|
|
2655
|
-
(0,
|
|
2656
|
-
(0,
|
|
2657
|
-
(0,
|
|
2656
|
+
(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.` }),
|
|
2657
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2658
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `import { waitForKeyPress } from "shell-shock:prompts";
|
|
2658
2659
|
|
|
2659
2660
|
async function run() {
|
|
2660
2661
|
const result = await waitForKeyPress();
|
|
@@ -2662,22 +2663,22 @@ async function run() {
|
|
|
2662
2663
|
}
|
|
2663
2664
|
|
|
2664
2665
|
run(); ` }),
|
|
2665
|
-
(0,
|
|
2666
|
-
(0,
|
|
2666
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2667
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
2667
2668
|
name: "timeout",
|
|
2668
2669
|
children: `The amount of time in milliseconds to wait before automatically resolving the prompt, defaults to 2 hours (7200000 ms)`
|
|
2669
2670
|
}),
|
|
2670
|
-
(0,
|
|
2671
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves when any key is pressed` })
|
|
2671
2672
|
];
|
|
2672
2673
|
}
|
|
2673
|
-
}), (0,
|
|
2674
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
2674
2675
|
name: "waitForKeyPress",
|
|
2675
2676
|
"export": true,
|
|
2676
2677
|
parameters: [{
|
|
2677
2678
|
name: "timeout",
|
|
2678
2679
|
default: "7200000"
|
|
2679
2680
|
}],
|
|
2680
|
-
children:
|
|
2681
|
+
children: _alloy_js_core.code`process.stdin.setRawMode(true);
|
|
2681
2682
|
return new Promise(resolve => process.stdin.once("data", () => {
|
|
2682
2683
|
if (timeout >= 0) {
|
|
2683
2684
|
setTimeout(() => {
|
|
@@ -2695,8 +2696,8 @@ run(); ` }),
|
|
|
2695
2696
|
* A built-in prompts module for Shell Shock.
|
|
2696
2697
|
*/
|
|
2697
2698
|
function PromptsBuiltin(props) {
|
|
2698
|
-
const [{ children }, rest] = (0,
|
|
2699
|
-
return (0,
|
|
2699
|
+
const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
|
|
2700
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
2700
2701
|
id: "prompts",
|
|
2701
2702
|
description: "A collection of prompts that allow for interactive input in command-line applications."
|
|
2702
2703
|
}, rest, {
|
|
@@ -2729,24 +2730,24 @@ function PromptsBuiltin(props) {
|
|
|
2729
2730
|
},
|
|
2730
2731
|
get children() {
|
|
2731
2732
|
return [
|
|
2732
|
-
(0,
|
|
2733
|
-
(0,
|
|
2734
|
-
(0,
|
|
2735
|
-
(0,
|
|
2736
|
-
(0,
|
|
2737
|
-
(0,
|
|
2738
|
-
(0,
|
|
2739
|
-
(0,
|
|
2740
|
-
(0,
|
|
2741
|
-
(0,
|
|
2742
|
-
(0,
|
|
2743
|
-
(0,
|
|
2744
|
-
(0,
|
|
2745
|
-
(0,
|
|
2746
|
-
(0,
|
|
2747
|
-
(0,
|
|
2748
|
-
(0,
|
|
2749
|
-
(0,
|
|
2733
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2734
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(BasePromptDeclarations, {}),
|
|
2735
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2736
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(TextPromptDeclarations, {}),
|
|
2737
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2738
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(SelectPromptDeclarations, {}),
|
|
2739
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2740
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(NumericPromptDeclarations, {}),
|
|
2741
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2742
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(TogglePromptDeclarations, {}),
|
|
2743
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2744
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(PasswordPromptDeclaration, {}),
|
|
2745
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2746
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(ConfirmPromptDeclarations, {}),
|
|
2747
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2748
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(WaitForKeyPressDeclaration, {}),
|
|
2749
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
2750
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
2750
2751
|
get when() {
|
|
2751
2752
|
return Boolean(children);
|
|
2752
2753
|
},
|