@shell-shock/plugin-console 0.2.10 → 0.2.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.
@@ -1,38 +1,4 @@
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 = require("@powerlines/plugin-alloy/typescript");
9
- let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
10
- let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
- let _shell_shock_core_components_helpers = require("@shell-shock/core/components/helpers");
12
- let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
13
- let _shell_shock_plugin_theme_helpers_ansi_utils = require("@shell-shock/plugin-theme/helpers/ansi-utils");
14
- let _stryke_string_format = require("@stryke/string-format");
15
- let _stryke_string_format_vowels = require("@stryke/string-format/vowels");
16
- let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
17
- let defu = require("defu");
18
-
19
- //#region src/components/console-builtin.tsx
20
- function AnsiHelpersDeclarations() {
21
- return [
22
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
23
- "const": true,
24
- "export": true,
25
- name: "beep",
26
- doc: "The ASCII Bell character, which can be used to trigger a beep sound in the console.",
27
- children: _alloy_js_core.code` "\\u0007"; `
28
- }),
29
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
30
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
31
- "const": true,
32
- "export": true,
33
- name: "cursor",
34
- doc: "An object containing ANSI escape codes for controlling the console cursor.",
35
- children: _alloy_js_core.code` {
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@alloy-js/typescript`),r=require(`@powerlines/deepkit/vendor/type`),i=require(`@powerlines/plugin-alloy/core/components/spacing`),a=require(`@powerlines/plugin-alloy/typescript`),o=require(`@powerlines/plugin-alloy/typescript/components/builtin-file`),s=require(`@powerlines/plugin-alloy/typescript/components/tsdoc`),c=require(`@shell-shock/core/components/helpers`),l=require(`@shell-shock/plugin-theme/contexts/theme`),u=require(`@shell-shock/plugin-theme/helpers/ansi-utils`),d=require(`@stryke/string-format`),f=require(`@stryke/string-format/vowels`),p=require(`@stryke/type-checks/is-set-object`),m=require(`defu`);function h(){return[(0,e.createComponent)(n.VarDeclaration,{const:!0,export:!0,name:`beep`,doc:`The ASCII Bell character, which can be used to trigger a beep sound in the console.`,children:t.code` "\\u0007"; `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.VarDeclaration,{const:!0,export:!0,name:`cursor`,doc:`An object containing ANSI escape codes for controlling the console cursor.`,children:t.code` {
36
2
  to(x: number, y?: number) {
37
3
  if (!y) {
38
4
  return \`\\x1B[\${x + 1}G\`;
@@ -68,15 +34,7 @@ function AnsiHelpersDeclarations() {
68
34
  show: "\\x1B[?25h",
69
35
  save: "\\x1B7",
70
36
  restore: "\\x1B8"
71
- } `
72
- }),
73
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
74
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
75
- "const": true,
76
- "export": true,
77
- name: "erase",
78
- doc: "An object containing ANSI escape codes for erasing parts of the console.",
79
- children: _alloy_js_core.code` {
37
+ } `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.VarDeclaration,{const:!0,export:!0,name:`erase`,doc:`An object containing ANSI escape codes for erasing parts of the console.`,children:t.code` {
80
38
  screen: "\\x1B[2J",
81
39
  up: (count = 1) => "\\x1B[1J".repeat(count),
82
40
  down: (count = 1) => "\\x1B[J".repeat(count),
@@ -95,34 +53,10 @@ function AnsiHelpersDeclarations() {
95
53
 
96
54
  return lineClear;
97
55
  }
98
- } `
99
- }),
100
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
101
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
102
- "const": true,
103
- "export": true,
104
- name: "scroll",
105
- doc: "An object containing ANSI escape codes for scrolling the console.",
106
- children: _alloy_js_core.code` {
56
+ } `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.VarDeclaration,{const:!0,export:!0,name:`scroll`,doc:`An object containing ANSI escape codes for scrolling the console.`,children:t.code` {
107
57
  up: (count = 1) => "\\x1B[S".repeat(count),
108
58
  down: (count = 1) => "\\x1B[T".repeat(count)
109
- } `
110
- }),
111
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
112
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
113
- "export": true,
114
- name: "clear",
115
- doc: "A helper function to clear the console based on a count of lines",
116
- parameters: [{
117
- name: "current",
118
- type: "string",
119
- doc: "The current console output to be cleared"
120
- }, {
121
- name: "consoleWidth",
122
- type: "number",
123
- doc: "The number of characters per line in the console"
124
- }],
125
- children: _alloy_js_core.code`if (!consoleWidth) {
59
+ } `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`clear`,doc:`A helper function to clear the console based on a count of lines`,parameters:[{name:`current`,type:`string`,doc:`The current console output to be cleared`},{name:`consoleWidth`,type:`number`,doc:`The number of characters per line in the console`}],children:t.code`if (!consoleWidth) {
126
60
  return erase.line + cursor.to(0);
127
61
  }
128
62
 
@@ -132,16 +66,7 @@ function AnsiHelpersDeclarations() {
132
66
  rows += 1 + Math.floor(Math.max([...stripAnsi(line)].length - 1, 0) / consoleWidth);
133
67
  }
134
68
 
135
- return erase.lines(rows); `
136
- }),
137
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
138
- ];
139
- }
140
- /**
141
- * A component to generate a console message function in a Shell Shock project.
142
- */
143
- function ColorFunction({ ansi16, ansi256, ansi16m, skipBackground = false }) {
144
- return _alloy_js_core.code` (text: string | number | boolean | null | undefined${skipBackground ? "" : `, background = false`}): string => {
69
+ return erase.lines(rows); `}),(0,e.createComponent)(i.Spacing,{})]}function g({ansi16:e,ansi256:n,ansi16m:r,skipBackground:i=!1}){return t.code` (text: string | number | boolean | null | undefined${i?``:`, background = false`}): string => {
145
70
  try {
146
71
  if (text === undefined || text === null || text === "") {
147
72
  return "";
@@ -152,321 +77,17 @@ function ColorFunction({ ansi16, ansi256, ansi16m, skipBackground = false }) {
152
77
  }
153
78
 
154
79
  if (colorSupportLevels.stdout === 1) {
155
- return wrapAnsi(String(text), ${skipBackground ? `"${ansi16.open}", "${ansi16.close}"` : `background ? "${ansi16.background.open}" : "${ansi16.open}", background ? "${ansi16.background.close}" : "${ansi16.close}"`});
80
+ return wrapAnsi(String(text), ${i?`"${e.open}", "${e.close}"`:`background ? "${e.background.open}" : "${e.open}", background ? "${e.background.close}" : "${e.close}"`});
156
81
  } else if (colorSupportLevels.stdout === 2) {
157
- return wrapAnsi(String(text), ${skipBackground ? `"${ansi256.open}", "${ansi256.close}"` : `background ? "${ansi256.background.open}" : "${ansi256.open}", background ? "${ansi256.background.close}" : "${ansi256.close}"`});
82
+ return wrapAnsi(String(text), ${i?`"${n.open}", "${n.close}"`:`background ? "${n.background.open}" : "${n.open}", background ? "${n.background.close}" : "${n.close}"`});
158
83
  }
159
84
 
160
- return wrapAnsi(String(text), ${skipBackground ? `"${ansi16m.open}", "${ansi16m.close}"` : `background ? "${ansi16m.background.open}" : "${ansi16m.open}", background ? "${ansi16m.background.close}" : "${ansi16m.close}"`});
85
+ return wrapAnsi(String(text), ${i?`"${r.open}", "${r.close}"`:`background ? "${r.background.open}" : "${r.open}", background ? "${r.background.close}" : "${r.close}"`});
161
86
  } catch {
162
87
  return String(text);
163
88
  }
164
89
  }
165
- `;
166
- }
167
- function ThemeColorTypeDefinition(props) {
168
- const { ansi16, ansi256, ansi16m, type, subType } = props;
169
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
170
- get each() {
171
- return Object.entries(ansi16);
172
- },
173
- semicolon: true,
174
- doubleHardline: true,
175
- enderPunctuation: true,
176
- children: ([color, value]) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
177
- get when() {
178
- return (0, _stryke_type_checks_is_set_object.isSetObject)(value);
179
- },
180
- get children() {
181
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
182
- get when() {
183
- return "open" in value && "close" in value;
184
- },
185
- get fallback() {
186
- return [
187
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: `An object containing various ${subType ? `${subType} ` : ""}${color}${type ? ` ${type}` : ""} theme coloring functions.` }),
188
- (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code` ${(0, _stryke_string_format.camelCase)(color)}: { `),
189
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
190
- (0, _alloy_js_core_jsx_runtime.createComponent)(ThemeColorTypeDefinition, {
191
- get ansi16() {
192
- return ansi16[color];
193
- },
194
- get ansi256() {
195
- return ansi256[color];
196
- },
197
- get ansi16m() {
198
- return ansi16m[color];
199
- },
200
- type: subType || type,
201
- subType: color
202
- }),
203
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
204
- _alloy_js_core.code` }`
205
- ];
206
- },
207
- get children() {
208
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
209
- get heading() {
210
- return `A function that applies ${(0, _stryke_string_format_vowels.getIndefiniteArticle)(color)} ${color}${type ? ` ${type}` : ""}${subType ? ` ${subType}` : ""} color styling to provided console text.`;
211
- },
212
- get children() {
213
- return [
214
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${color}${type ? ` ${type}` : ""}${subType ? ` ${subType}` : ""} color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.` }),
215
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
216
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
217
- name: "text",
218
- children: `The console text to which the ${color}${type ? ` ${type}` : ""}${subType ? ` ${subType}` : ""} color styling should be applied.`
219
- }),
220
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
221
- name: "background",
222
- children: `A boolean indicating whether to apply the color as a background. Defaults to \`false\`.`
223
- }),
224
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A string with ANSI escape codes applied for ${color}${type ? ` ${type}` : ""}${subType ? ` ${subType}` : ""} color styling, or the original text if the style is not supported in the current terminal.` })
225
- ];
226
- }
227
- }), (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${(0, _stryke_string_format.camelCase)(color)}: (text: string, background?: boolean) => string`)];
228
- }
229
- });
230
- }
231
- })]
232
- });
233
- }
234
- function ThemeColorObjectDefinition(props) {
235
- const { ansi16, ansi256, ansi16m, type, subType } = props;
236
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
237
- get each() {
238
- return Object.entries(ansi16);
239
- },
240
- comma: true,
241
- doubleHardline: true,
242
- enderPunctuation: true,
243
- children: ([color, value]) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
244
- get when() {
245
- return (0, _stryke_type_checks_is_set_object.isSetObject)(value);
246
- },
247
- get children() {
248
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
249
- get when() {
250
- return "open" in value && "close" in value;
251
- },
252
- get fallback() {
253
- return [
254
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: `An object containing various ${subType ? `${subType} ` : ""}${color}${type ? ` ${type}` : ""} theme coloring functions.` }),
255
- (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code` ${(0, _stryke_string_format.camelCase)(color)}: { `),
256
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
257
- (0, _alloy_js_core_jsx_runtime.createComponent)(ThemeColorObjectDefinition, {
258
- get ansi16() {
259
- return ansi16[color];
260
- },
261
- get ansi256() {
262
- return ansi256[color];
263
- },
264
- get ansi16m() {
265
- return ansi16m[color];
266
- },
267
- type: subType || type,
268
- subType: color
269
- }),
270
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
271
- _alloy_js_core.code` }`
272
- ];
273
- },
274
- get children() {
275
- return [
276
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
277
- get heading() {
278
- return `A function that applies ${(0, _stryke_string_format_vowels.getIndefiniteArticle)(color)} ${color}${type ? ` ${type}` : ""}${subType ? ` ${subType}` : ""} color styling to provided console text.`;
279
- },
280
- get children() {
281
- return [
282
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${color}${type ? ` ${type}` : ""}${subType ? ` ${subType}` : ""} color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.` }),
283
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
284
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
285
- name: "text",
286
- children: `The console text to which the ${color}${type ? ` ${type}` : ""}${subType ? ` ${subType}` : ""} color styling should be applied.`
287
- }),
288
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
289
- name: "background",
290
- children: `A boolean indicating whether to apply the color as a background. Defaults to \`false\`.`
291
- }),
292
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A string with ANSI escape codes applied for ${color}${type ? ` ${type}` : ""}${subType ? ` ${subType}` : ""} color styling, or the original text if the style is not supported in the current terminal.` })
293
- ];
294
- }
295
- }),
296
- (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${(0, _stryke_string_format.camelCase)(color)}: `),
297
- (0, _alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
298
- get ansi16() {
299
- return ansi16[color];
300
- },
301
- get ansi256() {
302
- return ansi256[color];
303
- },
304
- get ansi16m() {
305
- return ansi16m[color];
306
- }
307
- })
308
- ];
309
- }
310
- });
311
- }
312
- })]
313
- });
314
- }
315
- /**
316
- * A component to generate an object containing functions for coloring text in a Shell Shock project.
317
- */
318
- function AnsiStyleFunctionsDeclaration() {
319
- const colors = (0, _shell_shock_plugin_theme_contexts_theme.useColors)();
320
- return [
321
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
322
- each: _shell_shock_plugin_theme_helpers_ansi_utils.modifierKeys,
323
- semicolon: true,
324
- doubleHardline: true,
325
- enderPunctuation: true,
326
- children: (modifier) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
327
- get heading() {
328
- return `A function that applies ${(0, _stryke_string_format_vowels.getIndefiniteArticle)((0, _stryke_string_format.titleCase)(modifier))} ${(0, _stryke_string_format.titleCase)(modifier)} text-style to provided console text.`;
329
- },
330
- get children() {
331
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
332
- name: "text",
333
- get children() {
334
- return `The console text to which the ${(0, _stryke_string_format.titleCase)(modifier)} text-style should be applied.`;
335
- }
336
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { get children() {
337
- return `A string with ANSI escape codes applied for ${(0, _stryke_string_format.titleCase)(modifier)} text-style, or the original text if the style is not supported in the current terminal.`;
338
- } })];
339
- }
340
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
341
- "const": true,
342
- "export": true,
343
- get name() {
344
- return (0, _stryke_string_format.camelCase)(modifier);
345
- },
346
- get initializer() {
347
- return (0, _alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
348
- get ansi16() {
349
- return colors.ansi16[modifier];
350
- },
351
- get ansi256() {
352
- return colors.ansi256[modifier];
353
- },
354
- get ansi16m() {
355
- return colors.ansi16m[modifier];
356
- },
357
- skipBackground: true
358
- });
359
- }
360
- })]
361
- }),
362
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
363
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
364
- each: _shell_shock_plugin_theme_helpers_ansi_utils.colorKeys,
365
- semicolon: true,
366
- doubleHardline: true,
367
- enderPunctuation: true,
368
- children: (color) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
369
- get heading() {
370
- return `A function that applies ${(0, _stryke_string_format_vowels.getIndefiniteArticle)((0, _stryke_string_format.titleCase)(color))} ${(0, _stryke_string_format.titleCase)(color)} color styling to provided console text.`;
371
- },
372
- get children() {
373
- return [
374
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { get children() {
375
- return `This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${(0, _stryke_string_format_vowels.getIndefiniteArticle)((0, _stryke_string_format.titleCase)(color))} ${(0, _stryke_string_format.titleCase)(color)} color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`;
376
- } }),
377
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
378
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
379
- name: "text",
380
- get children() {
381
- return `The console text to which the ${(0, _stryke_string_format.titleCase)(color)} color styling should be applied.`;
382
- }
383
- }),
384
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
385
- name: "background",
386
- children: `A boolean indicating whether to apply the color as a background. Defaults to \`false\`.`
387
- }),
388
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { get children() {
389
- return `A string with ANSI escape codes applied for ${(0, _stryke_string_format.titleCase)(color)} color styling, or the original text if the style is not supported in the current terminal.`;
390
- } })
391
- ];
392
- }
393
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
394
- "const": true,
395
- "export": true,
396
- get name() {
397
- return (0, _stryke_string_format.camelCase)(color);
398
- },
399
- get initializer() {
400
- return (0, _alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
401
- get ansi16() {
402
- return colors.ansi16[color];
403
- },
404
- get ansi256() {
405
- return colors.ansi256[color];
406
- },
407
- get ansi16m() {
408
- return colors.ansi16m[color];
409
- }
410
- });
411
- }
412
- })]
413
- }),
414
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
415
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
416
- get each() {
417
- return Object.keys(colors.ansi16.theme);
418
- },
419
- semicolon: true,
420
- doubleHardline: true,
421
- enderPunctuation: true,
422
- children: (type) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: `A nested object containing functions for applying ${type} theme colors to the console.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
423
- "export": true,
424
- get name() {
425
- return `${(0, _stryke_string_format.camelCase)(type)}Colors`;
426
- },
427
- get initializer() {
428
- return [
429
- _alloy_js_core.code` {`,
430
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
431
- (0, _alloy_js_core_jsx_runtime.createComponent)(ThemeColorObjectDefinition, {
432
- get ansi16() {
433
- return colors.ansi16.theme[type];
434
- },
435
- get ansi256() {
436
- return colors.ansi256.theme[type];
437
- },
438
- get ansi16m() {
439
- return colors.ansi16m.theme[type];
440
- },
441
- type
442
- }),
443
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
444
- _alloy_js_core.code`}`
445
- ];
446
- }
447
- })]
448
- }),
449
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
450
- ];
451
- }
452
- /**
453
- * A component to generate the `splitText` function in the `shell-shock:console` builtin module.
454
- */
455
- function SplitTextFunctionDeclaration() {
456
- return [
457
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
458
- name: "adjustIndex",
459
- parameters: [{
460
- name: "line",
461
- type: "string",
462
- doc: "An input line which may contain ANSI escape codes. This is used to adjust the index for splitting the line based on visible characters rather than raw string length, ensuring that ANSI codes do not cause incorrect splitting of the text."
463
- }, {
464
- name: "index",
465
- type: "number",
466
- doc: "The index at which to split the line, based on visible characters (does not account for ANSI escape codes)."
467
- }],
468
- returnType: "number",
469
- children: _alloy_js_core.code`let adjustedIndex = 0;
90
+ `}function _(n){let{ansi16:r,ansi256:i,ansi16m:a,type:o,subType:c}=n;return(0,e.createComponent)(t.For,{get each(){return Object.entries(r)},semicolon:!0,doubleHardline:!0,enderPunctuation:!0,children:([n,l])=>[(0,e.createComponent)(t.Show,{get when(){return(0,p.isSetObject)(l)},get children(){return(0,e.createComponent)(t.Show,{get when(){return`open`in l&&`close`in l},get fallback(){return[(0,e.createComponent)(s.TSDoc,{heading:`An object containing various ${c?`${c} `:``}${n}${o?` ${o}`:``} theme coloring functions.`}),(0,e.memo)(()=>t.code` ${(0,d.camelCase)(n)}: { `),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(_,{get ansi16(){return r[n]},get ansi256(){return i[n]},get ansi16m(){return a[n]},type:c||o,subType:n}),(0,e.createIntrinsic)(`hbr`,{}),t.code` }`]},get children(){return[(0,e.createComponent)(s.TSDoc,{get heading(){return`A function that applies ${(0,f.getIndefiniteArticle)(n)} ${n}${o?` ${o}`:``}${c?` ${c}`:``} color styling to provided console text.`},get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${n}${o?` ${o}`:``}${c?` ${c}`:``} color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The console text to which the ${n}${o?` ${o}`:``}${c?` ${c}`:``} color styling should be applied.`}),(0,e.createComponent)(s.TSDocParam,{name:`background`,children:"A boolean indicating whether to apply the color as a background. Defaults to `false`."}),(0,e.createComponent)(s.TSDocReturns,{children:`A string with ANSI escape codes applied for ${n}${o?` ${o}`:``}${c?` ${c}`:``} color styling, or the original text if the style is not supported in the current terminal.`})]}}),(0,e.memo)(()=>t.code`${(0,d.camelCase)(n)}: (text: string, background?: boolean) => string`)]}})}})]})}function v(n){let{ansi16:r,ansi256:i,ansi16m:a,type:o,subType:c}=n;return(0,e.createComponent)(t.For,{get each(){return Object.entries(r)},comma:!0,doubleHardline:!0,enderPunctuation:!0,children:([n,l])=>[(0,e.createComponent)(t.Show,{get when(){return(0,p.isSetObject)(l)},get children(){return(0,e.createComponent)(t.Show,{get when(){return`open`in l&&`close`in l},get fallback(){return[(0,e.createComponent)(s.TSDoc,{heading:`An object containing various ${c?`${c} `:``}${n}${o?` ${o}`:``} theme coloring functions.`}),(0,e.memo)(()=>t.code` ${(0,d.camelCase)(n)}: { `),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(v,{get ansi16(){return r[n]},get ansi256(){return i[n]},get ansi16m(){return a[n]},type:c||o,subType:n}),(0,e.createIntrinsic)(`hbr`,{}),t.code` }`]},get children(){return[(0,e.createComponent)(s.TSDoc,{get heading(){return`A function that applies ${(0,f.getIndefiniteArticle)(n)} ${n}${o?` ${o}`:``}${c?` ${c}`:``} color styling to provided console text.`},get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${n}${o?` ${o}`:``}${c?` ${c}`:``} color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The console text to which the ${n}${o?` ${o}`:``}${c?` ${c}`:``} color styling should be applied.`}),(0,e.createComponent)(s.TSDocParam,{name:`background`,children:"A boolean indicating whether to apply the color as a background. Defaults to `false`."}),(0,e.createComponent)(s.TSDocReturns,{children:`A string with ANSI escape codes applied for ${n}${o?` ${o}`:``}${c?` ${c}`:``} color styling, or the original text if the style is not supported in the current terminal.`})]}}),(0,e.memo)(()=>t.code`${(0,d.camelCase)(n)}: `),(0,e.createComponent)(g,{get ansi16(){return r[n]},get ansi256(){return i[n]},get ansi16m(){return a[n]}})]}})}})]})}function y(){let r=(0,l.useColors)();return[(0,e.createComponent)(t.For,{each:u.modifierKeys,semicolon:!0,doubleHardline:!0,enderPunctuation:!0,children:t=>[(0,e.createComponent)(s.TSDoc,{get heading(){return`A function that applies ${(0,f.getIndefiniteArticle)((0,d.titleCase)(t))} ${(0,d.titleCase)(t)} text-style to provided console text.`},get children(){return[(0,e.createComponent)(s.TSDocParam,{name:`text`,get children(){return`The console text to which the ${(0,d.titleCase)(t)} text-style should be applied.`}}),(0,e.createComponent)(s.TSDocReturns,{get children(){return`A string with ANSI escape codes applied for ${(0,d.titleCase)(t)} text-style, or the original text if the style is not supported in the current terminal.`}})]}}),(0,e.createComponent)(n.VarDeclaration,{const:!0,export:!0,get name(){return(0,d.camelCase)(t)},get initializer(){return(0,e.createComponent)(g,{get ansi16(){return r.ansi16[t]},get ansi256(){return r.ansi256[t]},get ansi16m(){return r.ansi16m[t]},skipBackground:!0})}})]}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(t.For,{each:u.colorKeys,semicolon:!0,doubleHardline:!0,enderPunctuation:!0,children:t=>[(0,e.createComponent)(s.TSDoc,{get heading(){return`A function that applies ${(0,f.getIndefiniteArticle)((0,d.titleCase)(t))} ${(0,d.titleCase)(t)} color styling to provided console text.`},get children(){return[(0,e.createComponent)(s.TSDocRemarks,{get children(){return`This function takes a string and an optional boolean indicating whether to apply the color as a background. It returns the input string wrapped in the appropriate ANSI escape codes for ${(0,f.getIndefiniteArticle)((0,d.titleCase)(t))} ${(0,d.titleCase)(t)} color styling, based on the terminal's color support level. If colors are not supported, it simply returns the input text as a string.`}}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocParam,{name:`text`,get children(){return`The console text to which the ${(0,d.titleCase)(t)} color styling should be applied.`}}),(0,e.createComponent)(s.TSDocParam,{name:`background`,children:"A boolean indicating whether to apply the color as a background. Defaults to `false`."}),(0,e.createComponent)(s.TSDocReturns,{get children(){return`A string with ANSI escape codes applied for ${(0,d.titleCase)(t)} color styling, or the original text if the style is not supported in the current terminal.`}})]}}),(0,e.createComponent)(n.VarDeclaration,{const:!0,export:!0,get name(){return(0,d.camelCase)(t)},get initializer(){return(0,e.createComponent)(g,{get ansi16(){return r.ansi16[t]},get ansi256(){return r.ansi256[t]},get ansi16m(){return r.ansi16m[t]}})}})]}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(t.For,{get each(){return Object.keys(r.ansi16.theme)},semicolon:!0,doubleHardline:!0,enderPunctuation:!0,children:i=>[(0,e.createComponent)(s.TSDoc,{heading:`A nested object containing functions for applying ${i} theme colors to the console.`}),(0,e.createComponent)(n.VarDeclaration,{export:!0,get name(){return`${(0,d.camelCase)(i)}Colors`},get initializer(){return[t.code` {`,(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(v,{get ansi16(){return r.ansi16.theme[i]},get ansi256(){return r.ansi256.theme[i]},get ansi16m(){return r.ansi16m.theme[i]},type:i}),(0,e.createIntrinsic)(`hbr`,{}),t.code`}`]}})]}),(0,e.createComponent)(i.Spacing,{})]}function b(){return[(0,e.createComponent)(n.FunctionDeclaration,{name:`adjustIndex`,parameters:[{name:`line`,type:`string`,doc:`An input line which may contain ANSI escape codes. This is used to adjust the index for splitting the line based on visible characters rather than raw string length, ensuring that ANSI codes do not cause incorrect splitting of the text.`},{name:`index`,type:`number`,doc:`The index at which to split the line, based on visible characters (does not account for ANSI escape codes).`}],returnType:`number`,children:t.code`let adjustedIndex = 0;
470
91
  let visibleCount = 0;
471
92
  const ansiRegex = new RegExp([
472
93
  String.raw\`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)\`,
@@ -485,20 +106,7 @@ function SplitTextFunctionDeclaration() {
485
106
  }
486
107
  }
487
108
 
488
- return adjustedIndex; `
489
- }),
490
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
491
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
492
- name: "breakLine",
493
- parameters: [{
494
- name: "line",
495
- type: "string"
496
- }, {
497
- name: "index",
498
- type: "number"
499
- }],
500
- returnType: "[string, string]",
501
- children: _alloy_js_core.code`const adjustedIndex = adjustIndex(line, index);
109
+ return adjustedIndex; `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.FunctionDeclaration,{name:`breakLine`,parameters:[{name:`line`,type:`string`},{name:`index`,type:`number`}],returnType:`[string, string]`,children:t.code`const adjustedIndex = adjustIndex(line, index);
502
110
  const first = line.slice(0, adjustedIndex);
503
111
  const second = line.slice(adjustedIndex);
504
112
 
@@ -547,37 +155,7 @@ function SplitTextFunctionDeclaration() {
547
155
  // Prepend open codes to the start of "second"
548
156
  const openSequence = openCodes.join("");
549
157
 
550
- return [first.replace(/^\\s+/, "").replace(/\\s+$/, "") + closeSequence, openSequence + second.replace(/^\\s+/, "").replace(/\\s+$/, "")]; `
551
- }),
552
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
553
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
554
- heading: "Split text into multiple lines based on a maximum length.",
555
- get children() {
556
- return [
557
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function splits the provided text into multiple lines based on the specified maximum length, ensuring that words are not broken in the middle.` }),
558
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
559
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
560
- name: "text",
561
- children: `The text to split into multiple lines.`
562
- }),
563
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
564
- name: "maxLength",
565
- children: `The maximum length of each line.`
566
- })
567
- ];
568
- }
569
- }),
570
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
571
- name: "splitText",
572
- "export": true,
573
- parameters: [{
574
- name: "text",
575
- type: "string"
576
- }, {
577
- name: "maxLength",
578
- type: "number | SizeToken"
579
- }],
580
- children: _alloy_js_core.code`let line = text;
158
+ return [first.replace(/^\\s+/, "").replace(/\\s+$/, "") + closeSequence, openSequence + second.replace(/^\\s+/, "").replace(/\\s+$/, "")]; `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Split text into multiple lines based on a maximum length.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function splits the provided text into multiple lines based on the specified maximum length, ensuring that words are not broken in the middle.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The text to split into multiple lines.`}),(0,e.createComponent)(s.TSDocParam,{name:`maxLength`,children:`The maximum length of each line.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{name:`splitText`,export:!0,parameters:[{name:`text`,type:`string`},{name:`maxLength`,type:`number | SizeToken`}],children:t.code`let line = text;
581
159
  let result = [] as string[];
582
160
 
583
161
  const calculatedMaxLength = isSizeToken(maxLength) ? calculateWidth(maxLength) : maxLength;
@@ -589,7 +167,7 @@ function SplitTextFunctionDeclaration() {
589
167
  : "";
590
168
  } else {
591
169
  const strippedLine = stripAnsi(line);
592
- const index = [" ", "/", "+", ".", ","].reduce((ret, split) => {
170
+ const index = [" ", "/", "+", "="].reduce((ret, split) => {
593
171
  let cursor = ret;
594
172
  while (strippedLine.substring(cursor + 1).includes(split) &&
595
173
  strippedLine.indexOf(split, cursor + 1) <= calculatedMaxLength) {
@@ -615,274 +193,35 @@ function SplitTextFunctionDeclaration() {
615
193
  }
616
194
 
617
195
  result.push(line);
618
- return result; `
619
- })
620
- ];
621
- }
622
- /**
623
- * A component to generate the `write` function in the `shell-shock:console` builtin module.
624
- */
625
- function WriteFunctionDeclaration() {
626
- return [
627
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
628
- "export": true,
629
- name: "WriteOptions",
630
- doc: "Options for writing to the console.",
631
- get children() {
632
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
633
- heading: "Console function to use for writing to the console",
634
- get children() {
635
- return [
636
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The console function to use for writing to the console. If not specified, the default console function \`console.log\` will be used.` }),
637
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
638
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
639
- get type() {
640
- return _powerlines_deepkit_vendor_type.ReflectionKind.method;
641
- },
642
- defaultValue: `\`console.log\``
643
- })
644
- ];
645
- }
646
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
647
- name: "consoleFn",
648
- optional: true,
649
- type: "(text: string) => void"
650
- })];
651
- }
652
- }),
653
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
654
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
655
- heading: "Write to the console.",
656
- get children() {
657
- return [
658
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function writes to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.` }),
659
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
660
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
661
- name: "text",
662
- children: `The text to write to the console.`
663
- }),
664
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
665
- name: "options",
666
- children: `The options to apply when writing to the console.`
667
- })
668
- ];
669
- }
670
- }),
671
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
672
- "export": true,
673
- name: "write",
674
- parameters: [{
675
- name: "text",
676
- type: "string | number | boolean | null",
677
- optional: true
678
- }, {
679
- name: "options",
680
- type: "WriteOptions",
681
- default: "{}"
682
- }],
683
- children: _alloy_js_core.code`const consoleFn = options.consoleFn ?? console.log;
196
+ return result; `})]}function x(){return[(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`WriteOptions`,doc:`Options for writing to the console.`,get children(){return[(0,e.createComponent)(s.TSDoc,{heading:`Console function to use for writing to the console`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:"The console function to use for writing to the console. If not specified, the default console function `console.log` will be used."}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocDefaultValue,{get type(){return r.ReflectionKind.method},defaultValue:"`console.log`"})]}}),(0,e.createComponent)(n.InterfaceMember,{name:`consoleFn`,optional:!0,type:`(text: string) => void`})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Write to the console.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function writes to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The text to write to the console.`}),(0,e.createComponent)(s.TSDocParam,{name:`options`,children:`The options to apply when writing to the console.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`write`,parameters:[{name:`text`,type:`string | number | boolean | null`,optional:!0},{name:`options`,type:`WriteOptions`,default:`{}`}],children:t.code`const consoleFn = options.consoleFn ?? console.log;
684
197
  if (text === undefined || text === null || text === "") {
685
198
  consoleFn("");
686
199
  return;
687
200
  }
688
201
 
689
- consoleFn(String(text)); `
690
- })
691
- ];
692
- }
693
- /**
694
- * A component to generate the `writeLine` function in the `shell-shock:console` builtin module.
695
- */
696
- function WriteLineFunctionDeclaration() {
697
- const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
698
- return [
699
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
700
- "export": true,
701
- name: "WriteLineOptions",
702
- doc: "Options for writing a line to the console.",
703
- "extends": ["WriteOptions"],
704
- get children() {
705
- return [
706
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
707
- heading: "Padding to apply to the line",
708
- get children() {
709
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The amount of padding (in spaces) to apply to the line when writing to the console. This value is applied to both the left and right sides of the line. If not specified, the default padding defined in the current theme configuration will be used.` });
710
- }
711
- }),
712
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
713
- name: "padding",
714
- optional: true,
715
- type: "number"
716
- }),
717
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
718
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
719
- heading: "Color of the line text",
720
- get children() {
721
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The color to apply to the line text when writing to the console. This can be one of the predefined color themes: "primary", "secondary", or "tertiary". If not specified, no specific coloring will be applied to the text (the default/system terminal text color will likely be used).` }), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
722
- }
723
- }),
724
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
725
- name: "color",
726
- optional: true,
727
- type: "\"primary\" | \"secondary\" | \"tertiary\""
728
- })
729
- ];
730
- }
731
- }),
732
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
733
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
734
- heading: "Write a line to the console.",
735
- get children() {
736
- return [
737
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function writes a line to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.` }),
738
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
739
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
740
- name: "text",
741
- children: `The line text to write to the console.`
742
- }),
743
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
744
- name: "options",
745
- children: `The options to apply when writing the line to the console.`
746
- })
747
- ];
748
- }
749
- }),
750
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
751
- "export": true,
752
- name: "writeLine",
753
- parameters: [{
754
- name: "text",
755
- type: "string | number | boolean | null",
756
- optional: true
757
- }, {
758
- name: "options",
759
- type: "WriteLineOptions",
760
- default: "{}"
761
- }],
762
- get children() {
763
- return _alloy_js_core.code`const color = options.color;
202
+ consoleFn(String(text)); `})]}function S(){let r=(0,l.useTheme)();return[(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`WriteLineOptions`,doc:`Options for writing a line to the console.`,extends:[`WriteOptions`],get children(){return[(0,e.createComponent)(s.TSDoc,{heading:`Padding to apply to the line`,get children(){return(0,e.createComponent)(s.TSDocRemarks,{children:`The amount of padding (in spaces) to apply to the line when writing to the console. This value is applied to both the left and right sides of the line. If not specified, the default padding defined in the current theme configuration will be used.`})}}),(0,e.createComponent)(n.InterfaceMember,{name:`padding`,optional:!0,type:`number`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDoc,{heading:`Color of the line text`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`The color to apply to the line text when writing to the console. This can be one of the predefined color themes: "primary", "secondary", or "tertiary". If not specified, no specific coloring will be applied to the text (the default/system terminal text color will likely be used).`}),(0,e.createIntrinsic)(`hbr`,{})]}}),(0,e.createComponent)(n.InterfaceMember,{name:`color`,optional:!0,type:`"primary" | "secondary" | "tertiary"`})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Write a line to the console.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function writes a line to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The line text to write to the console.`}),(0,e.createComponent)(s.TSDocParam,{name:`options`,children:`The options to apply when writing the line to the console.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`writeLine`,parameters:[{name:`text`,type:`string | number | boolean | null`,optional:!0},{name:`options`,type:`WriteLineOptions`,default:`{}`}],get children(){return t.code`const color = options.color;
764
203
  if (text === undefined || text === null || text === "") {
765
204
  write("", options);
766
205
  return;
767
206
  }
768
207
 
769
- write(\`\${" ".repeat(Math.max(options.padding ?? ${theme.padding.app}, 0))}\${color ? textColors.body[color](String(text)) : String(text)}\`, options); `;
770
- }
771
- })
772
- ];
773
- }
774
- /**
775
- * A component to generate the message functions in the `shell-shock:console` builtin module.
776
- */
777
- function MessageFunctionDeclaration(props) {
778
- const { type, variant, consoleFnName, description, prefix, parameters, timestamp, color = variant } = props;
779
- const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
780
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
781
- get heading() {
782
- return `Write ${(0, _stryke_string_format_vowels.getIndefiniteArticle)(description)} ${description} message to the console.`;
783
- },
784
- get children() {
785
- return [
786
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
787
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
788
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
789
- name: "message",
790
- children: `The message to write to the console.`
791
- }),
792
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
793
- name: "header",
794
- children: `An optional header to display above the message. If not provided, a default header based on the message type and variant will be used if defined in the theme configuration; otherwise, no header will be displayed.`
795
- })
796
- ];
797
- }
798
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
799
- "export": true,
800
- name: type,
801
- parameters: parameters ?? [{
802
- name: "message",
803
- type: "string",
804
- optional: false
805
- }, {
806
- name: "header",
807
- type: "string",
808
- optional: true
809
- }],
810
- get children() {
811
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
812
- get when() {
813
- return Boolean(prefix);
814
- },
815
- get children() {
816
- return [
817
- prefix,
818
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
819
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
820
- ];
821
- }
822
- }), (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
208
+ write(\`\${" ".repeat(Math.max(options.padding ?? ${r.padding.app}, 0))}\${color ? textColors.body[color](String(text)) : String(text)}\`, options); `}})]}function C(r){let{type:i,variant:a,consoleFnName:o,description:c,prefix:u,parameters:d,timestamp:p,color:m=a}=r,h=(0,l.useTheme)();return[(0,e.createComponent)(s.TSDoc,{get heading(){return`Write ${(0,f.getIndefiniteArticle)(c)} ${c} message to the console.`},get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function initializes the Powerlines environment configuration object.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocParam,{name:`message`,children:`The message to write to the console.`}),(0,e.createComponent)(s.TSDocParam,{name:`header`,children:`An optional header to display above the message. If not provided, a default header based on the message type and variant will be used if defined in the theme configuration; otherwise, no header will be displayed.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:i,parameters:d??[{name:`message`,type:`string`,optional:!1},{name:`header`,type:`string`,optional:!0}],get children(){return[(0,e.createComponent)(t.Show,{get when(){return!!u},get children(){return[u,(0,e.createIntrinsic)(`hbr`,{}),(0,e.createIntrinsic)(`hbr`,{})]}}),(0,e.memo)(()=>t.code`
823
209
  if (!message) {
824
210
  return;
825
211
  }
826
212
 
827
- ${!theme.labels.message.footer[variant] && timestamp ? `const timestamp = \`\${textColors.message.footer.${color}(new Date().toLocaleDateString())} \${borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}")} \${textColors.message.footer.${color}(new Date().toLocaleTimeString())}\`; ` : ""}
213
+ ${!h.labels.message.footer[a]&&p?`const timestamp = \`\${textColors.message.footer.${m}(new Date().toLocaleDateString())} \${borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].bottom}")} \${textColors.message.footer.${m}(new Date().toLocaleTimeString())}\`; `:``}
828
214
 
829
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topLeft}") + ${theme.labels.message.header[variant] || theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(4)) + " " + ${theme.icons.message.header[variant] ? `borderColors.message.outline.${color}("${theme.icons.message.header[variant]}") + " " +` : ""} bold(textColors.message.header.${color}(header || "${theme.labels.message.header[variant]}")) + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + 4 + (theme.icons.message.header[variant] ? 2 + (theme.labels.message.header[variant] ? 0 : 1) : 0) + (theme.labels.message.header[variant] ? theme.labels.message.header[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].topRight.length}, 0)))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
215
+ writeLine(borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].topLeft}") + ${h.labels.message.header[a]||h.icons.message.header[a]?`borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].top}".repeat(4)) + " " + ${h.icons.message.header[a]?`borderColors.message.outline.${m}("${h.icons.message.header[a]}") + " " +`:``} bold(textColors.message.header.${m}(header || "${h.labels.message.header[a]}")) + " " + borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].top}".repeat(Math.max(getTerminalSize().columns - ${Math.max(h.padding.app,0)*2+h.borderStyles.message.outline[a].topLeft.length+4+(h.icons.message.header[a]?2+ +!h.labels.message.header[a]:0)+(h.labels.message.header[a]?h.labels.message.header[a].length+2:0)+h.borderStyles.message.outline[a].topRight.length}, 0)))`:`borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].top}".repeat(Math.max(getTerminalSize().columns - ${Math.max(h.padding.app,0)*2+h.borderStyles.message.outline[a].topLeft.length+h.borderStyles.message.outline[a].topRight.length}, 0)))`} + borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].topRight}"), { consoleFn: console.${o} });
830
216
  splitText(
831
217
  message,
832
- Math.max(getTerminalSize().columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.message, 0)) * 2 + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}, 12)
218
+ Math.max(getTerminalSize().columns - ${(Math.max(h.padding.app,0)+Math.max(h.padding.message,0))*2+h.borderStyles.message.outline[a].left.length+h.borderStyles.message.outline[a].right.length}, 12)
833
219
  ).forEach(line => {
834
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + textColors.message.description.${color}(line) + " ".repeat(Math.max(getTerminalSize().columns - (stripAnsi(line).length + ${Math.max(theme.padding.app, 0) * 2 + Math.max(theme.padding.message, 0) + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}), 0)) + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
220
+ writeLine(borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].left+` `.repeat(Math.max(h.padding.message,0))}") + textColors.message.description.${m}(line) + " ".repeat(Math.max(getTerminalSize().columns - (stripAnsi(line).length + ${Math.max(h.padding.app,0)*2+Math.max(h.padding.message,0)+h.borderStyles.message.outline[a].left.length+h.borderStyles.message.outline[a].right.length}), 0)) + borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].right}"), { consoleFn: console.${o} });
835
221
  });
836
- writeLine(borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomLeft}") + ${theme.labels.message.footer[variant] || timestamp ? `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + 4 + (theme.labels.message.footer[variant] ? theme.labels.message.footer[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}${!theme.labels.message.footer[variant] && timestamp ? " - (stripAnsi(timestamp).length + 2)" : ""}, 0))) + " " + ${`bold(textColors.message.footer.${color}(${theme.labels.message.footer[variant] ? `"${theme.labels.message.footer[variant]}"` : timestamp && "timestamp"}))`} + " " + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(4))` : `borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}, 0)))`} + borderColors.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
837
- `)];
838
- }
839
- })];
840
- }
841
- /**
842
- * A component to generate the `wrapAnsi` function in the `shell-shock:console` builtin module.
843
- */
844
- function WrapAnsiFunction() {
845
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
846
- heading: "Applies ANSI escape codes to a string.",
847
- get children() {
848
- return [
849
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `Split text by /\\\\x1b[\\[|\\]][0-9;]*m/ and wrap non-ANSI parts with open/closing tags.` }),
850
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const result = wrapAnsi("Hello\\\\x1b[31mWorld\\\\x1b[0mAgain", "\\\\x1b[36m", "\\\\x1b[39");\nconsole.log(result); // "\\\\x1b[36mHello\\\\x1b[39\\\\x1b[31mWorld\\\\x1b[0m\\\\x1b[36mAgain\\\\x1b[39"` }),
851
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
852
- name: "text",
853
- children: `The text to apply ANSI codes to.`
854
- }),
855
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
856
- name: "open",
857
- children: `The opening ANSI code.`
858
- }),
859
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
860
- name: "close",
861
- children: `The closing ANSI code.`
862
- }),
863
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The text with ANSI codes applied.` })
864
- ];
865
- }
866
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
867
- name: "wrapAnsi",
868
- parameters: [
869
- {
870
- name: "text",
871
- type: "string | number",
872
- optional: false
873
- },
874
- {
875
- name: "open",
876
- type: "string",
877
- optional: false
878
- },
879
- {
880
- name: "close",
881
- type: "string",
882
- optional: false
883
- }
884
- ],
885
- children: _alloy_js_core.code`const str = String(text);
222
+ writeLine(borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].bottomLeft}") + ${h.labels.message.footer[a]||p?`borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].bottom}".repeat(Math.max(getTerminalSize().columns - ${Math.max(h.padding.app,0)*2+4+(h.labels.message.footer[a]?h.labels.message.footer[a].length+2:0)+h.borderStyles.message.outline[a].bottomLeft.length+h.borderStyles.message.outline[a].bottomRight.length}${!h.labels.message.footer[a]&&p?` - (stripAnsi(timestamp).length + 2)`:``}, 0))) + " " + ${`bold(textColors.message.footer.${m}(${h.labels.message.footer[a]?`"${h.labels.message.footer[a]}"`:p&&`timestamp`}))`} + " " + borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].bottom}".repeat(4))`:`borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].bottom}".repeat(Math.max(getTerminalSize().columns - ${Math.max(h.padding.app,0)*2+h.borderStyles.message.outline[a].bottomLeft.length+h.borderStyles.message.outline[a].bottomRight.length}, 0)))`} + borderColors.message.outline.${m}("${h.borderStyles.message.outline[a].bottomRight}"), { consoleFn: console.${o} });
223
+ `)]}})]}function w(){return[(0,e.createComponent)(s.TSDoc,{heading:`Applies ANSI escape codes to a string.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`Split text by /\\\\x1b[\\[|\\]][0-9;]*m/ and wrap non-ANSI parts with open/closing tags.`}),(0,e.createComponent)(s.TSDocExample,{children:`const result = wrapAnsi("Hello\\\\x1b[31mWorld\\\\x1b[0mAgain", "\\\\x1b[36m", "\\\\x1b[39");
224
+ console.log(result); // "\\\\x1b[36mHello\\\\x1b[39\\\\x1b[31mWorld\\\\x1b[0m\\\\x1b[36mAgain\\\\x1b[39"`}),(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The text to apply ANSI codes to.`}),(0,e.createComponent)(s.TSDocParam,{name:`open`,children:`The opening ANSI code.`}),(0,e.createComponent)(s.TSDocParam,{name:`close`,children:`The closing ANSI code.`}),(0,e.createComponent)(s.TSDocReturns,{children:`The text with ANSI codes applied.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{name:`wrapAnsi`,parameters:[{name:`text`,type:`string | number`,optional:!1},{name:`open`,type:`string`,optional:!1},{name:`close`,type:`string`,optional:!1}],children:t.code`const str = String(text);
886
225
  const tokens = [] as string[];
887
226
 
888
227
  let last = 0;
@@ -915,239 +254,15 @@ function WrapAnsiFunction() {
915
254
  }
916
255
 
917
256
  return result;
918
- `
919
- })];
920
- }
921
- /**
922
- * A component to generate the `stripAnsi` function in the `shell-shock:console` builtin module.
923
- */
924
- function StripAnsiFunctionDeclaration() {
925
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
926
- heading: "Removes ANSI escape codes from a string.",
927
- get children() {
928
- return [
929
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const result = stripAnsi("Hello\\\\x1b[31mWorld\\\\x1b[0mAgain"); // "HelloWorldAgain"` }),
930
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
931
- name: "text",
932
- children: `The text to strip ANSI codes from.`
933
- }),
934
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The text with ANSI codes removed.` })
935
- ];
936
- }
937
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
938
- "export": true,
939
- name: "stripAnsi",
940
- parameters: [{
941
- name: "text",
942
- type: "string | number",
943
- optional: false
944
- }],
945
- children: _alloy_js_core.code`return String(text).replace(new RegExp([
257
+ `})]}function T(){return[(0,e.createComponent)(s.TSDoc,{heading:`Removes ANSI escape codes from a string.`,get children(){return[(0,e.createComponent)(s.TSDocExample,{children:`const result = stripAnsi("Hello\\\\x1b[31mWorld\\\\x1b[0mAgain"); // "HelloWorldAgain"`}),(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The text to strip ANSI codes from.`}),(0,e.createComponent)(s.TSDocReturns,{children:`The text with ANSI codes removed.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`stripAnsi`,parameters:[{name:`text`,type:`string | number`,optional:!1}],children:t.code`return String(text).replace(new RegExp([
946
258
  String.raw\`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)\`,
947
259
  String.raw\`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))\`
948
- ].join("|"), "g"), "");`
949
- })];
950
- }
951
- /**
952
- * A component to generate the `stripAnsi` function in the `shell-shock:console` builtin module.
953
- */
954
- function DividerFunctionDeclaration() {
955
- const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
956
- return [
957
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
958
- "export": true,
959
- name: "DividerOptions",
960
- doc: "Options for formatting the divider line written to console.",
961
- get children() {
962
- return [
963
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
964
- name: "width",
965
- optional: true,
966
- type: "number",
967
- doc: "The width of the divider line. If not specified, the divider will span the full width of the console, minus the padding."
968
- }),
969
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
970
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
971
- heading: "The border of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used.",
972
- get children() {
973
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The value provided will determine the border style and color based on the current theme configuration.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
974
- get type() {
975
- return _powerlines_deepkit_vendor_type.ReflectionKind.string;
976
- },
977
- defaultValue: "primary"
978
- })];
979
- }
980
- }),
981
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
982
- name: "border",
983
- optional: true,
984
- type: "\"primary\" | \"secondary\" | \"tertiary\"",
985
- doc: "The border style/color of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used."
986
- }),
987
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
988
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
989
- heading: "Padding to apply to the line",
990
- get children() {
991
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The amount of padding (in spaces) to apply to the line when writing to the console. This value is applied to both the left and right sides of the line. If not specified, the default padding defined in the current theme configuration will be used.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
992
- get type() {
993
- return _powerlines_deepkit_vendor_type.ReflectionKind.number;
994
- },
995
- get defaultValue() {
996
- return theme.padding.app * 4;
997
- }
998
- })];
999
- }
1000
- }),
1001
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1002
- name: "padding",
1003
- optional: true,
1004
- type: "number"
1005
- })
1006
- ];
1007
- }
1008
- }),
1009
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1010
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1011
- heading: "Write a horizontal divider line to the console.",
1012
- get children() {
1013
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `divider({ width: 50, border: "primary" }); // Writes a horizontal divider line of width 50 with primary border.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1014
- name: "options",
1015
- children: `Options for formatting the divider line.`
1016
- })];
1017
- }
1018
- }),
1019
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1020
- "export": true,
1021
- name: "divider",
1022
- parameters: [{
1023
- name: "options",
1024
- type: "DividerOptions",
1025
- optional: false
1026
- }],
1027
- get children() {
1028
- return _alloy_js_core.code`const padding = options.padding ?? ${Math.max(theme.padding.app, 1) * 4};
260
+ ].join("|"), "g"), "");`})]}function E(){let a=(0,l.useTheme)();return[(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`DividerOptions`,doc:`Options for formatting the divider line written to console.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`width`,optional:!0,type:`number`,doc:`The width of the divider line. If not specified, the divider will span the full width of the console, minus the padding.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDoc,{heading:`The border of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`The value provided will determine the border style and color based on the current theme configuration.`}),(0,e.createComponent)(s.TSDocDefaultValue,{get type(){return r.ReflectionKind.string},defaultValue:`primary`})]}}),(0,e.createComponent)(n.InterfaceMember,{name:`border`,optional:!0,type:`"primary" | "secondary" | "tertiary"`,doc:`The border style/color of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDoc,{heading:`Padding to apply to the line`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`The amount of padding (in spaces) to apply to the line when writing to the console. This value is applied to both the left and right sides of the line. If not specified, the default padding defined in the current theme configuration will be used.`}),(0,e.createComponent)(s.TSDocDefaultValue,{get type(){return r.ReflectionKind.number},get defaultValue(){return a.padding.app*4}})]}}),(0,e.createComponent)(n.InterfaceMember,{name:`padding`,optional:!0,type:`number`})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Write a horizontal divider line to the console.`,get children(){return[(0,e.createComponent)(s.TSDocExample,{children:`divider({ width: 50, border: "primary" }); // Writes a horizontal divider line of width 50 with primary border.`}),(0,e.createComponent)(s.TSDocParam,{name:`options`,children:`Options for formatting the divider line.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`divider`,parameters:[{name:`options`,type:`DividerOptions`,optional:!1}],get children(){return t.code`const padding = options.padding ?? ${Math.max(a.padding.app,1)*4};
1029
261
  const width = options.width ?? (getTerminalSize().columns - (Math.max(padding, 0) * 2));
1030
- const border = options.border === "tertiary" ? borderColors.app.divider.tertiary("${theme.borderStyles.app.divider.tertiary.top}") : options.border === "secondary" ? borderColors.app.divider.secondary("${theme.borderStyles.app.divider.secondary.top}") : borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}");
262
+ const border = options.border === "tertiary" ? borderColors.app.divider.tertiary("${a.borderStyles.app.divider.tertiary.top}") : options.border === "secondary" ? borderColors.app.divider.secondary("${a.borderStyles.app.divider.secondary.top}") : borderColors.app.divider.primary("${a.borderStyles.app.divider.primary.top}");
1031
263
 
1032
- writeLine(" ".repeat(Math.max(padding - ${theme.padding.app}, 0)) + border.repeat(Math.max(width / ${theme.borderStyles.app.divider.primary.top.length ?? 1}, 0)));
1033
- `;
1034
- }
1035
- })
1036
- ];
1037
- }
1038
- /**
1039
- * A component to generate the `link` function in the `shell-shock:console` builtin module.
1040
- */
1041
- function LinkFunctionDeclaration() {
1042
- const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
1043
- return [
1044
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
1045
- "export": true,
1046
- name: "LinkOptions",
1047
- doc: "Options for formatting a hyperlink in the console.",
1048
- get children() {
1049
- return [
1050
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1051
- name: "external",
1052
- optional: true,
1053
- type: "boolean",
1054
- doc: "Whether the link is external. If true, an external link icon will be displayed next to the link text (if supported by the terminal) and the link may be styled differently based on the current theme configuration."
1055
- }),
1056
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1057
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1058
- name: "text",
1059
- optional: true,
1060
- type: "string",
1061
- doc: "The text to display for the link. If not provided, the URL will be used as the text."
1062
- }),
1063
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1064
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1065
- name: "useTextWhenUnsupported",
1066
- optional: true,
1067
- type: "boolean",
1068
- doc: "Whether to use the text when the hyperlink is not supported. If true, the text will be displayed even if the terminal does not support hyperlinks."
1069
- })
1070
- ];
1071
- }
1072
- }),
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_tsdoc.TSDoc, {
1075
- heading: "Render a hyperlink in the console.",
1076
- get children() {
1077
- return [
1078
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1079
- name: "url",
1080
- children: `The URL to render as a hyperlink.`
1081
- }),
1082
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1083
- name: "options",
1084
- children: `Options for formatting the hyperlink.`
1085
- }),
1086
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The formatted hyperlink string for display in the console.` })
1087
- ];
1088
- }
1089
- }),
1090
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1091
- "export": true,
1092
- name: "link",
1093
- parameters: [{
1094
- name: "url",
1095
- type: "string",
1096
- optional: false
1097
- }, {
1098
- name: "options",
1099
- type: "LinkOptions",
1100
- default: "{}"
1101
- }],
1102
- get children() {
1103
- return [
1104
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1105
- condition: _alloy_js_core.code`isHyperlinkSupported()`,
1106
- get children() {
1107
- return _alloy_js_core.code`return \`\\x1b]8;;\${url}\\u0007\${options.text ? options.text : url}\\x1b]8;;\\u0007\${options.external === true ? "${theme.icons.link.external}" : ""}\`;`;
1108
- }
1109
- }),
1110
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1111
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1112
- condition: _alloy_js_core.code`isColorSupported`,
1113
- get children() {
1114
- return _alloy_js_core.code`return \`\${underline(textColors.body.link(\`\${options.useTextWhenUnsupported && options.text ? options.text : url}\`))}\${options.external === true ? "${theme.icons.link.external}" : ""}\`;`;
1115
- }
1116
- }),
1117
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1118
- (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`return \`\${options.useTextWhenUnsupported && options.text ? options.text : url}\${options.external === true ? "${theme.icons.link.external}" : ""}\`;`)
1119
- ];
1120
- }
1121
- })
1122
- ];
1123
- }
1124
- /**
1125
- * A component to generate the `blockquote` function declaration
1126
- */
1127
- function BlockquoteFunctionDeclaration() {
1128
- const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
1129
- return [
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_tsdoc.TSDoc, {
1132
- heading: `Format a string with blockquote styling for display in console.`,
1133
- get children() {
1134
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1135
- name: "text",
1136
- children: `The text to format with blockquote styling.`
1137
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The formatted string with blockquote styling.` })];
1138
- }
1139
- }),
1140
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1141
- "export": true,
1142
- name: "blockquote",
1143
- parameters: [{
1144
- name: "text",
1145
- type: "string | number | boolean | null",
1146
- optional: true
1147
- }],
1148
- returnType: "string",
1149
- get children() {
1150
- return _alloy_js_core.code`if (text === undefined || text === null || text === "") {
264
+ writeLine(" ".repeat(Math.max(padding - ${a.padding.app}, 0)) + border.repeat(Math.max(width / ${a.borderStyles.app.divider.primary.top.length??1}, 0)));
265
+ `}})]}function D(){let r=(0,l.useTheme)();return[(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`LinkOptions`,doc:`Options for formatting a hyperlink in the console.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`external`,optional:!0,type:`boolean`,doc:`Whether the link is external. If true, an external link icon will be displayed next to the link text (if supported by the terminal) and the link may be styled differently based on the current theme configuration.`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceMember,{name:`text`,optional:!0,type:`string`,doc:`The text to display for the link. If not provided, the URL will be used as the text.`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceMember,{name:`useTextWhenUnsupported`,optional:!0,type:`boolean`,doc:`Whether to use the text when the hyperlink is not supported. If true, the text will be displayed even if the terminal does not support hyperlinks.`})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Render a hyperlink in the console.`,get children(){return[(0,e.createComponent)(s.TSDocParam,{name:`url`,children:`The URL to render as a hyperlink.`}),(0,e.createComponent)(s.TSDocParam,{name:`options`,children:`Options for formatting the hyperlink.`}),(0,e.createComponent)(s.TSDocReturns,{children:`The formatted hyperlink string for display in the console.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`link`,parameters:[{name:`url`,type:`string`,optional:!1},{name:`options`,type:`LinkOptions`,default:`{}`}],get children(){return[(0,e.createComponent)(n.IfStatement,{condition:t.code`isHyperlinkSupported()`,get children(){return t.code`return \`\\x1b]8;;\${url}\\u0007\${options.text ? options.text : url}\\x1b]8;;\\u0007\${options.external === true ? "${r.icons.link.external}" : ""}\`;`}}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.IfStatement,{condition:t.code`isColorSupported`,get children(){return t.code`return \`\${underline(textColors.body.link(\`\${options.useTextWhenUnsupported && options.text ? options.text : url}\`))}\${options.external === true ? "${r.icons.link.external}" : ""}\`;`}}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.memo)(()=>t.code`return \`\${options.useTextWhenUnsupported && options.text ? options.text : url}\${options.external === true ? "${r.icons.link.external}" : ""}\`;`)]}})]}function O(){let r=(0,l.useTheme)();return[(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Format a string with blockquote styling for display in console.`,get children(){return[(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The text to format with blockquote styling.`}),(0,e.createComponent)(s.TSDocReturns,{children:`The formatted string with blockquote styling.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`blockquote`,parameters:[{name:`text`,type:`string | number | boolean | null`,optional:!0}],returnType:`string`,get children(){return t.code`if (text === undefined || text === null || text === "") {
1151
266
  return "";
1152
267
  }
1153
268
 
@@ -1156,42 +271,7 @@ function BlockquoteFunctionDeclaration() {
1156
271
  Math.max(getTerminalSize().columns, 20) - 6
1157
272
  );
1158
273
 
1159
- return lines.map(line => \`\${borderColors.app.blockquote.primary(isUnicodeSupported() ? "${theme.borderStyles.app.blockquote.primary.left}" : "|")} \${italic(line)} \`).join("\\n"); `;
1160
- }
1161
- })
1162
- ];
1163
- }
1164
- /**
1165
- * A component to generate the `code` function declaration
1166
- */
1167
- function CodeFunctionDeclaration() {
1168
- const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
1169
- return [
1170
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1171
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1172
- heading: `Format a source code string for display in console.`,
1173
- get children() {
1174
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1175
- name: "text",
1176
- children: `The source code text to format with code styling.`
1177
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The formatted string with code styling.` })];
1178
- }
1179
- }),
1180
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1181
- "export": true,
1182
- name: "code",
1183
- parameters: [{
1184
- name: "text",
1185
- type: "string | number | boolean | null",
1186
- optional: true
1187
- }, {
1188
- name: "language",
1189
- type: "string",
1190
- optional: true
1191
- }],
1192
- returnType: "string",
1193
- get children() {
1194
- return _alloy_js_core.code`if (text === undefined || text === null || text === "") {
274
+ return lines.map(line => \`\${borderColors.app.blockquote.primary(isUnicodeSupported() ? "${r.borderStyles.app.blockquote.primary.left}" : "|")} \${italic(line)} \`).join("\\n"); `}})]}function k(){let r=(0,l.useTheme)();return[(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Format a source code string for display in console.`,get children(){return[(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The source code text to format with code styling.`}),(0,e.createComponent)(s.TSDocReturns,{children:`The formatted string with code styling.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`code`,parameters:[{name:`text`,type:`string | number | boolean | null`,optional:!0},{name:`language`,type:`string`,optional:!0}],returnType:`string`,get children(){return t.code`if (text === undefined || text === null || text === "") {
1195
275
  return "";
1196
276
  }
1197
277
 
@@ -1200,185 +280,12 @@ function CodeFunctionDeclaration() {
1200
280
  Math.max(getTerminalSize().columns, 20)
1201
281
  );
1202
282
 
1203
- return \` \${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(4))}\${language ? \` \${borderColors.app.divider.primary(language)} \` : ""}\${borderColors.app.divider.primary("${theme.borderStyles.app.divider.primary.top}".repeat(getTerminalSize().columns - (language ? language.length + 2 : 0) - 5))} \\n\${lines.map((line, index) => \` \${" ".repeat(String(lines.length).length - String(index + 1).length)}\${textColors.body.tertiary(index + 1)} \${textColors.body.primary(line)}\`).join("\\n")}\`; `;
1204
- }
1205
- })
1206
- ];
1207
- }
1208
- /**
1209
- * A component to generate the `inlineCode` function declaration
1210
- */
1211
- function InlineCodeFunctionDeclaration() {
1212
- return [
1213
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1214
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1215
- heading: `Format a string with inline code styling for display in console.`,
1216
- get children() {
1217
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1218
- name: "text",
1219
- children: `The text to format with inline code styling.`
1220
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The formatted string with inline code styling.` })];
1221
- }
1222
- }),
1223
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1224
- "export": true,
1225
- name: "inlineCode",
1226
- parameters: [{
1227
- name: "text",
1228
- type: "string | number | boolean | null",
1229
- optional: true
1230
- }],
1231
- returnType: "string",
1232
- children: _alloy_js_core.code`if (text === undefined || text === null || text === "") {
283
+ return \` \${borderColors.app.divider.primary("${r.borderStyles.app.divider.primary.top}".repeat(4))}\${language ? \` \${borderColors.app.divider.primary(language)} \` : ""}\${borderColors.app.divider.primary("${r.borderStyles.app.divider.primary.top}".repeat(getTerminalSize().columns - (language ? language.length + 2 : 0) - 5))} \\n\${lines.map((line, index) => \` \${" ".repeat(String(lines.length).length - String(index + 1).length)}\${textColors.body.tertiary(index + 1)} \${textColors.body.primary(line)}\`).join("\\n")}\`; `}})]}function A(){return[(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Format a string with inline code styling for display in console.`,get children(){return[(0,e.createComponent)(s.TSDocParam,{name:`text`,children:`The text to format with inline code styling.`}),(0,e.createComponent)(s.TSDocReturns,{children:`The formatted string with inline code styling.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`inlineCode`,parameters:[{name:`text`,type:`string | number | boolean | null`,optional:!0}],returnType:`string`,children:t.code`if (text === undefined || text === null || text === "") {
1233
284
  return "";
1234
285
  }
1235
286
 
1236
- return inverse(\`\${text}\`); `
1237
- })
1238
- ];
1239
- }
1240
- /**
1241
- * A component to generate the `spinner` function in the `shell-shock:console` builtin module.
1242
- */
1243
- function SpinnerFunctionDeclaration() {
1244
- const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
1245
- return [
1246
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeDeclaration, {
1247
- name: "WriteStream",
1248
- children: `NodeJS.WriteStream;`
1249
- }),
1250
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1251
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
1252
- "const": true,
1253
- name: "activeHooksPerStream",
1254
- initializer: "new Set();"
1255
- }),
1256
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1257
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
1258
- "export": true,
1259
- name: "SpinnerOptions",
1260
- doc: "Options for configuring the spinner.",
1261
- get children() {
1262
- return [
1263
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1264
- name: "message",
1265
- optional: true,
1266
- type: "string",
1267
- doc: "The message text to display next to the spinner. Defaults to an empty string."
1268
- }),
1269
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1270
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1271
- name: "stream",
1272
- optional: true,
1273
- type: "WriteStream",
1274
- doc: "The output stream to write the spinner to. Defaults to process.stderr."
1275
- }),
1276
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1277
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1278
- name: "spinner",
1279
- optional: true,
1280
- type: "ThemeSpinnerResolvedConfig | SpinnerPreset",
1281
- doc: "The spinner animation to use. Should be an object with a 'frames' property (an array of strings representing each frame of the animation) and an 'interval' property (the time in milliseconds between each frame). If not specified, a default spinner animation will be used."
1282
- })
1283
- ];
1284
- }
1285
- }),
1286
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1287
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassDeclaration, {
1288
- name: "Spinner",
1289
- get children() {
1290
- return [
1291
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1292
- name: "frames",
1293
- isPrivateMember: true,
1294
- type: "string[]"
1295
- }),
1296
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1297
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1298
- name: "interval",
1299
- isPrivateMember: true,
1300
- type: "number"
1301
- }),
1302
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1303
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1304
- name: "currentFrame",
1305
- isPrivateMember: true,
1306
- type: "number",
1307
- children: _alloy_js_core.code`-1`
1308
- }),
1309
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1310
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1311
- name: "timer",
1312
- isPrivateMember: true,
1313
- optional: true,
1314
- type: "NodeJS.Timeout"
1315
- }),
1316
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1317
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1318
- name: "message",
1319
- isPrivateMember: true,
1320
- type: "string",
1321
- children: _alloy_js_core.code`""`
1322
- }),
1323
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1324
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1325
- name: "stream",
1326
- isPrivateMember: true,
1327
- type: "WriteStream",
1328
- children: _alloy_js_core.code`process.stderr`
1329
- }),
1330
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1331
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1332
- name: "lines",
1333
- isPrivateMember: true,
1334
- type: "number",
1335
- children: _alloy_js_core.code`0`
1336
- }),
1337
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1338
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1339
- name: "exitHandlerBound",
1340
- isPrivateMember: true,
1341
- type: "(signal: any) => void",
1342
- children: _alloy_js_core.code`() => {}`
1343
- }),
1344
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1345
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1346
- name: "lastSpinnerFrameTime",
1347
- isPrivateMember: true,
1348
- type: "number",
1349
- children: _alloy_js_core.code`0`
1350
- }),
1351
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1352
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1353
- name: "isSpinning",
1354
- isPrivateMember: true,
1355
- type: "boolean",
1356
- children: _alloy_js_core.code`false`
1357
- }),
1358
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1359
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1360
- name: "hookedStreams",
1361
- isPrivateMember: true,
1362
- type: "Map<WriteStream, { write?: WriteStream[\"write\"]; originalWrite: WriteStream[\"write\"]; hookedWrite: WriteStream[\"write\"] }>",
1363
- children: _alloy_js_core.code`new Map()`
1364
- }),
1365
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1366
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1367
- name: "isInternalWrite",
1368
- isPrivateMember: true,
1369
- type: "boolean",
1370
- children: _alloy_js_core.code`false`
1371
- }),
1372
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1373
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassField, {
1374
- name: "isDeferringRender",
1375
- isPrivateMember: true,
1376
- type: "boolean",
1377
- children: _alloy_js_core.code`false`
1378
- }),
1379
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1380
- (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`constructor(options: SpinnerOptions = {}) {
1381
- const spinner = (typeof options.spinner === "string" ? resolveSpinner(options.spinner as SpinnerPreset) : options.spinner) ?? ${JSON.stringify(theme.spinner)};
287
+ return inverse(\`\${text}\`); `})]}function j(){let r=(0,l.useTheme)();return[(0,e.createComponent)(n.TypeDeclaration,{name:`WriteStream`,children:`NodeJS.WriteStream;`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.VarDeclaration,{const:!0,name:`activeHooksPerStream`,initializer:`new Set();`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`SpinnerOptions`,doc:`Options for configuring the spinner.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`message`,optional:!0,type:`string`,doc:`The message text to display next to the spinner. Defaults to an empty string.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`stream`,optional:!0,type:`WriteStream`,doc:`The output stream to write the spinner to. Defaults to process.stderr.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`spinner`,optional:!0,type:`ThemeSpinnerResolvedConfig | SpinnerPreset`,doc:`The spinner animation to use. Should be an object with a 'frames' property (an array of strings representing each frame of the animation) and an 'interval' property (the time in milliseconds between each frame). If not specified, a default spinner animation will be used.`})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassDeclaration,{name:`Spinner`,get children(){return[(0,e.createComponent)(a.ClassField,{name:`frames`,isPrivateMember:!0,type:`string[]`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`interval`,isPrivateMember:!0,type:`number`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`currentFrame`,isPrivateMember:!0,type:`number`,children:t.code`-1`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`timer`,isPrivateMember:!0,optional:!0,type:`NodeJS.Timeout`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`message`,isPrivateMember:!0,type:`string`,children:t.code`""`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`stream`,isPrivateMember:!0,type:`WriteStream`,children:t.code`process.stderr`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`lines`,isPrivateMember:!0,type:`number`,children:t.code`0`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`exitHandlerBound`,isPrivateMember:!0,type:`(signal: any) => void`,children:t.code`() => {}`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`lastSpinnerFrameTime`,isPrivateMember:!0,type:`number`,children:t.code`0`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`isSpinning`,isPrivateMember:!0,type:`boolean`,children:t.code`false`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`hookedStreams`,isPrivateMember:!0,type:`Map<WriteStream, { write?: WriteStream["write"]; originalWrite: WriteStream["write"]; hookedWrite: WriteStream["write"] }>`,children:t.code`new Map()`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`isInternalWrite`,isPrivateMember:!0,type:`boolean`,children:t.code`false`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(a.ClassField,{name:`isDeferringRender`,isPrivateMember:!0,type:`boolean`,children:t.code`false`}),(0,e.createComponent)(i.Spacing,{}),(0,e.memo)(()=>t.code`constructor(options: SpinnerOptions = {}) {
288
+ const spinner = (typeof options.spinner === "string" ? resolveSpinner(options.spinner as SpinnerPreset) : options.spinner) ?? ${JSON.stringify(r.spinner)};
1382
289
  this.#frames = spinner.frames;
1383
290
  this.#interval = spinner.interval;
1384
291
 
@@ -1582,49 +489,7 @@ function SpinnerFunctionDeclaration() {
1582
489
  }
1583
490
 
1584
491
  process.exit(signal === "SIGINT" ? 130 : (signal === "SIGTERM" ? 143 : 1));
1585
- } `),
1586
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassPropertyGet, {
1587
- "public": true,
1588
- name: "isSpinning",
1589
- type: "boolean",
1590
- doc: "Whether the spinner is currently active and spinning.",
1591
- children: _alloy_js_core.code`return this.#isSpinning;`
1592
- }),
1593
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1594
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassPropertySet, {
1595
- "public": true,
1596
- name: "message",
1597
- type: "string",
1598
- doc: "Set the message displayed by the spinner.",
1599
- children: _alloy_js_core.code`this.#message = value;`
1600
- }),
1601
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1602
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassPropertyGet, {
1603
- "public": true,
1604
- name: "message",
1605
- type: "string",
1606
- doc: "Get the message displayed by the spinner.",
1607
- children: _alloy_js_core.code`return this.#message;`
1608
- }),
1609
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1610
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassMethod, {
1611
- name: "start",
1612
- doc: "Start the spinner animation.",
1613
- parameters: [{
1614
- name: "message",
1615
- type: "string"
1616
- }],
1617
- get children() {
1618
- return [
1619
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1620
- condition: _alloy_js_core.code`message !== undefined`,
1621
- children: _alloy_js_core.code`this.#message = message;`
1622
- }),
1623
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1624
- condition: _alloy_js_core.code`this.isSpinning`,
1625
- children: _alloy_js_core.code`return this;`
1626
- }),
1627
- _alloy_js_core.code`this.#isSpinning = true;
492
+ } `),(0,e.createComponent)(a.ClassPropertyGet,{public:!0,name:`isSpinning`,type:`boolean`,doc:`Whether the spinner is currently active and spinning.`,children:t.code`return this.#isSpinning;`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassPropertySet,{public:!0,name:`message`,type:`string`,doc:`Set the message displayed by the spinner.`,children:t.code`this.#message = value;`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassPropertyGet,{public:!0,name:`message`,type:`string`,doc:`Get the message displayed by the spinner.`,children:t.code`return this.#message;`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassMethod,{name:`start`,doc:`Start the spinner animation.`,parameters:[{name:`message`,type:`string`}],get children(){return[(0,e.createComponent)(n.IfStatement,{condition:t.code`message !== undefined`,children:t.code`this.#message = message;`}),(0,e.createComponent)(n.IfStatement,{condition:t.code`this.isSpinning`,children:t.code`return this;`}),t.code`this.#isSpinning = true;
1628
493
  this.#hideCursor();
1629
494
  this.#installHook();
1630
495
  this.#render();
@@ -1637,20 +502,7 @@ function SpinnerFunctionDeclaration() {
1637
502
  }
1638
503
 
1639
504
  return this;
1640
- `
1641
- ];
1642
- }
1643
- }),
1644
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1645
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassMethod, {
1646
- name: "stop",
1647
- doc: "Stop the spinner animation.",
1648
- parameters: [{
1649
- name: "finalMessage",
1650
- optional: true,
1651
- type: "string"
1652
- }],
1653
- children: _alloy_js_core.code`if (!this.isSpinning) {
505
+ `]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassMethod,{name:`stop`,doc:`Stop the spinner animation.`,parameters:[{name:`finalMessage`,optional:!0,type:`string`}],children:t.code`if (!this.isSpinning) {
1654
506
  return this;
1655
507
  }
1656
508
 
@@ -1674,13 +526,7 @@ function SpinnerFunctionDeclaration() {
1674
526
 
1675
527
  return this;
1676
528
 
1677
- `
1678
- }),
1679
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1680
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassMethod, {
1681
- name: "clear",
1682
- doc: "Clear the spinner animation.",
1683
- children: _alloy_js_core.code`if (!isInteractive) {
529
+ `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassMethod,{name:`clear`,doc:`Clear the spinner animation.`,children:t.code`if (!isInteractive) {
1684
530
  return this;
1685
531
  }
1686
532
 
@@ -1701,477 +547,20 @@ function SpinnerFunctionDeclaration() {
1701
547
  });
1702
548
 
1703
549
  this.#lines = 0;
1704
- return this; `
1705
- }),
1706
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1707
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassMethod, {
1708
- name: "success",
1709
- doc: "Mark the spinner as successful.",
1710
- parameters: [{
1711
- name: "message",
1712
- type: "string"
1713
- }],
1714
- get children() {
1715
- return _alloy_js_core.code`return this.#stopWithIcon(textColors.spinner.icon.success("${theme.icons.spinner.success}"), textColors.spinner.message.success(message)); `;
1716
- }
1717
- }),
1718
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1719
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassMethod, {
1720
- name: "error",
1721
- doc: "Mark the spinner as failed.",
1722
- parameters: [{
1723
- name: "message",
1724
- type: "string"
1725
- }],
1726
- get children() {
1727
- return _alloy_js_core.code`return this.#stopWithIcon(textColors.spinner.icon.error("${theme.icons.spinner.error}"), textColors.spinner.message.error(message)); `;
1728
- }
1729
- }),
1730
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1731
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassMethod, {
1732
- name: "warning",
1733
- doc: "Mark the spinner as warning.",
1734
- parameters: [{
1735
- name: "message",
1736
- type: "string"
1737
- }],
1738
- get children() {
1739
- return _alloy_js_core.code`return this.#stopWithIcon(textColors.spinner.icon.warning("${theme.icons.spinner.warning}"), textColors.spinner.message.warning(message)); `;
1740
- }
1741
- }),
1742
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1743
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassMethod, {
1744
- name: "info",
1745
- doc: "Mark the spinner as informational.",
1746
- parameters: [{
1747
- name: "message",
1748
- type: "string"
1749
- }],
1750
- get children() {
1751
- return _alloy_js_core.code`return this.#stopWithIcon(textColors.spinner.icon.info("${theme.icons.spinner.info}"), textColors.spinner.message.info(message)); `;
1752
- }
1753
- }),
1754
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1755
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.ClassMethod, {
1756
- name: "help",
1757
- doc: "Mark the spinner as help.",
1758
- parameters: [{
1759
- name: "message",
1760
- type: "string"
1761
- }],
1762
- get children() {
1763
- return _alloy_js_core.code`return this.#stopWithIcon(textColors.spinner.icon.help("${theme.icons.spinner.help}"), textColors.spinner.message.help(message)); `;
1764
- }
1765
- }),
1766
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
1767
- ];
1768
- }
1769
- }),
1770
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1771
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1772
- heading: "Render a spinner in the console.",
1773
- get children() {
1774
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1775
- name: "options",
1776
- children: `Options for configuring the spinner, including the message to display, the output stream to write to, and the spinner animation to use.`
1777
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `An instance of the Spinner class, which can be used to control the spinner animation (e.g., start, stop, mark as success/error, etc.).` })];
1778
- }
1779
- }),
1780
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1781
- "export": true,
1782
- name: "createSpinner",
1783
- parameters: [{
1784
- name: "options",
1785
- type: "SpinnerOptions",
1786
- optional: true
1787
- }],
1788
- children: _alloy_js_core.code`return new Spinner(options);`
1789
- })
1790
- ];
1791
- }
1792
- function extractBorderOptionsObject(direction, theme) {
1793
- return `borderOptions.${direction} === "primary" ? borderColors.app.table.primary("${theme.borderStyles.app.table.primary[direction]}") : borderOptions.${direction} === "secondary" ? borderColors.app.table.secondary("${theme.borderStyles.app.table.secondary[direction]}") : borderOptions.${direction} === "tertiary" ? borderColors.app.table.tertiary("${theme.borderStyles.app.table.tertiary[direction]}") : !borderOptions.${direction} || borderOptions.${direction} === "none" ? "" : borderOptions.${direction}`;
1794
- }
1795
- function extractBorderOptionsString(direction, theme) {
1796
- return `borderOptions === "primary" ? borderColors.app.table.primary("${theme.borderStyles.app.table.primary[direction]}") : borderOptions === "secondary" ? borderColors.app.table.secondary("${theme.borderStyles.app.table.secondary[direction]}") : borderOptions === "tertiary" ? borderColors.app.table.tertiary("${theme.borderStyles.app.table.tertiary[direction]}") : !borderOptions || borderOptions === "none" ? "" : borderOptions`;
1797
- }
1798
- /**
1799
- * A component to generate the table functions in the `shell-shock:console` builtin module.
1800
- */
1801
- function TableFunctionDeclaration(props) {
1802
- const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
1803
- return [
1804
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeDeclaration, {
1805
- "export": true,
1806
- name: "SizeToken",
1807
- doc: "A type representing the width size of an item in the console.",
1808
- children: _alloy_js_core.code`"full" | "1/1" | "1/2" | "1/3" | "1/4" | "1/5" | "1/6" | "1/12" | "1/24" | "100%" | "50%" | "33.33%" | "25%" | "20%" | "10%" | "5%" | "2.5%"`
1809
- }),
1810
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1811
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1812
- heading: "Determine if a value is a valid size token.",
1813
- get children() {
1814
- return [
1815
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function checks if the provided value is a valid size token, which can be one of the predefined strings representing common width sizes (e.g., "full", "1/2", "1/3", etc.) or percentage strings (e.g., "50%").` }),
1816
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1817
- name: "value",
1818
- children: `The value to check for being a valid size token.`
1819
- }),
1820
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `True if the value is a valid size token, false otherwise.` })
1821
- ];
1822
- }
1823
- }),
1824
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1825
- "export": true,
1826
- doc: "Determines if the provided value is a valid size token.",
1827
- name: "isSizeToken",
1828
- parameters: [{
1829
- name: "value",
1830
- type: "any"
1831
- }],
1832
- returnType: "value is SizeToken",
1833
- get children() {
1834
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1835
- condition: _alloy_js_core.code`["full", "1/1", "1/2", "1/3", "1/4", "1/5", "1/6", "1/12", "1/24", "100%", "50%", "33.33%", "25%", "20%", "10%", "5%", "2.5%"].includes(value)`,
1836
- children: _alloy_js_core.code`return true; `
1837
- }), _alloy_js_core.code`return false; `];
1838
- }
1839
- }),
1840
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1841
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1842
- heading: "Calculate the width in characters based on the provided width size.",
1843
- get children() {
1844
- return [
1845
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function calculates the width in characters based on the provided width size, which can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%"). The calculation is based on the current width of the console (getTerminalSize().columns).` }),
1846
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
1847
- name: "size",
1848
- children: `The width size to calculate. This can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%").`
1849
- }),
1850
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The calculated width in characters.` })
1851
- ];
1852
- }
1853
- }),
1854
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
1855
- "export": true,
1856
- name: "calculateWidth",
1857
- parameters: [{
1858
- name: "size",
1859
- type: "SizeToken",
1860
- optional: false
1861
- }],
1862
- returnType: "number",
1863
- get children() {
1864
- return [
1865
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
1866
- condition: _alloy_js_core.code`["full", "100%", "1/1"]. includes(size)`,
1867
- children: _alloy_js_core.code`return getTerminalSize().columns;`
1868
- }),
1869
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1870
- condition: _alloy_js_core.code`["1/2", "50%"].includes(size)`,
1871
- children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 2);`
1872
- }),
1873
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1874
- condition: _alloy_js_core.code`["1/3", "33.33%"].includes(size)`,
1875
- children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 3);`
1876
- }),
1877
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1878
- condition: _alloy_js_core.code`["1/4", "25%"].includes(size)`,
1879
- children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 4);`
1880
- }),
1881
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1882
- condition: _alloy_js_core.code`["1/5", "20%"].includes(size)`,
1883
- children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 5);`
1884
- }),
1885
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1886
- condition: _alloy_js_core.code`["1/6", "10%"].includes(size)`,
1887
- children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 6);`
1888
- }),
1889
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1890
- condition: _alloy_js_core.code`["1/12", "5%"].includes(size)`,
1891
- children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 12);`
1892
- }),
1893
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
1894
- condition: _alloy_js_core.code`["1/24", "2.5%"].includes(size)`,
1895
- children: _alloy_js_core.code`return Math.round(getTerminalSize().columns / 24);`
1896
- }),
1897
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`
550
+ return this; `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassMethod,{name:`success`,doc:`Mark the spinner as successful.`,parameters:[{name:`message`,type:`string`}],get children(){return t.code`return this.#stopWithIcon(textColors.spinner.icon.success("${r.icons.spinner.success}"), textColors.spinner.message.success(message)); `}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassMethod,{name:`error`,doc:`Mark the spinner as failed.`,parameters:[{name:`message`,type:`string`}],get children(){return t.code`return this.#stopWithIcon(textColors.spinner.icon.error("${r.icons.spinner.error}"), textColors.spinner.message.error(message)); `}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassMethod,{name:`warning`,doc:`Mark the spinner as warning.`,parameters:[{name:`message`,type:`string`}],get children(){return t.code`return this.#stopWithIcon(textColors.spinner.icon.warning("${r.icons.spinner.warning}"), textColors.spinner.message.warning(message)); `}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassMethod,{name:`info`,doc:`Mark the spinner as informational.`,parameters:[{name:`message`,type:`string`}],get children(){return t.code`return this.#stopWithIcon(textColors.spinner.icon.info("${r.icons.spinner.info}"), textColors.spinner.message.info(message)); `}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(a.ClassMethod,{name:`help`,doc:`Mark the spinner as help.`,parameters:[{name:`message`,type:`string`}],get children(){return t.code`return this.#stopWithIcon(textColors.spinner.icon.help("${r.icons.spinner.help}"), textColors.spinner.message.help(message)); `}}),(0,e.createComponent)(i.Spacing,{})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Render a spinner in the console.`,get children(){return[(0,e.createComponent)(s.TSDocParam,{name:`options`,children:`Options for configuring the spinner, including the message to display, the output stream to write to, and the spinner animation to use.`}),(0,e.createComponent)(s.TSDocReturns,{children:`An instance of the Spinner class, which can be used to control the spinner animation (e.g., start, stop, mark as success/error, etc.).`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`createSpinner`,parameters:[{name:`options`,type:`SpinnerOptions`,optional:!0}],children:t.code`return new Spinner(options);`})]}function M(e,t){return`borderOptions.${e} === "primary" ? borderColors.app.table.primary("${t.borderStyles.app.table.primary[e]}") : borderOptions.${e} === "secondary" ? borderColors.app.table.secondary("${t.borderStyles.app.table.secondary[e]}") : borderOptions.${e} === "tertiary" ? borderColors.app.table.tertiary("${t.borderStyles.app.table.tertiary[e]}") : !borderOptions.${e} || borderOptions.${e} === "none" ? "" : borderOptions.${e}`}function N(e,t){return`borderOptions === "primary" ? borderColors.app.table.primary("${t.borderStyles.app.table.primary[e]}") : borderOptions === "secondary" ? borderColors.app.table.secondary("${t.borderStyles.app.table.secondary[e]}") : borderOptions === "tertiary" ? borderColors.app.table.tertiary("${t.borderStyles.app.table.tertiary[e]}") : !borderOptions || borderOptions === "none" ? "" : borderOptions`}function P(a){let o=(0,l.useTheme)();return[(0,e.createComponent)(n.TypeDeclaration,{export:!0,name:`SizeToken`,doc:`A type representing the width size of an item in the console.`,children:t.code`"full" | "1/1" | "1/2" | "1/3" | "1/4" | "1/5" | "1/6" | "1/12" | "1/24" | "100%" | "50%" | "33.33%" | "25%" | "20%" | "10%" | "5%" | "2.5%"`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Determine if a value is a valid size token.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function checks if the provided value is a valid size token, which can be one of the predefined strings representing common width sizes (e.g., "full", "1/2", "1/3", etc.) or percentage strings (e.g., "50%").`}),(0,e.createComponent)(s.TSDocParam,{name:`value`,children:`The value to check for being a valid size token.`}),(0,e.createComponent)(s.TSDocReturns,{children:`True if the value is a valid size token, false otherwise.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,doc:`Determines if the provided value is a valid size token.`,name:`isSizeToken`,parameters:[{name:`value`,type:`any`}],returnType:`value is SizeToken`,get children(){return[(0,e.createComponent)(n.IfStatement,{condition:t.code`["full", "1/1", "1/2", "1/3", "1/4", "1/5", "1/6", "1/12", "1/24", "100%", "50%", "33.33%", "25%", "20%", "10%", "5%", "2.5%"].includes(value)`,children:t.code`return true; `}),t.code`return false; `]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Calculate the width in characters based on the provided width size.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function calculates the width in characters based on the provided width size, which can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%"). The calculation is based on the current width of the console (getTerminalSize().columns).`}),(0,e.createComponent)(s.TSDocParam,{name:`size`,children:`The width size to calculate. This can be a predefined string (e.g., "full", "1/2", "1/3", etc.) or a percentage string (e.g., "50%").`}),(0,e.createComponent)(s.TSDocReturns,{children:`The calculated width in characters.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,name:`calculateWidth`,parameters:[{name:`size`,type:`SizeToken`,optional:!1}],returnType:`number`,get children(){return[(0,e.createComponent)(n.IfStatement,{condition:t.code`["full", "100%", "1/1"]. includes(size)`,children:t.code`return getTerminalSize().columns;`}),(0,e.createComponent)(n.ElseIfClause,{condition:t.code`["1/2", "50%"].includes(size)`,children:t.code`return Math.round(getTerminalSize().columns / 2);`}),(0,e.createComponent)(n.ElseIfClause,{condition:t.code`["1/3", "33.33%"].includes(size)`,children:t.code`return Math.round(getTerminalSize().columns / 3);`}),(0,e.createComponent)(n.ElseIfClause,{condition:t.code`["1/4", "25%"].includes(size)`,children:t.code`return Math.round(getTerminalSize().columns / 4);`}),(0,e.createComponent)(n.ElseIfClause,{condition:t.code`["1/5", "20%"].includes(size)`,children:t.code`return Math.round(getTerminalSize().columns / 5);`}),(0,e.createComponent)(n.ElseIfClause,{condition:t.code`["1/6", "10%"].includes(size)`,children:t.code`return Math.round(getTerminalSize().columns / 6);`}),(0,e.createComponent)(n.ElseIfClause,{condition:t.code`["1/12", "5%"].includes(size)`,children:t.code`return Math.round(getTerminalSize().columns / 12);`}),(0,e.createComponent)(n.ElseIfClause,{condition:t.code`["1/24", "2.5%"].includes(size)`,children:t.code`return Math.round(getTerminalSize().columns / 24);`}),(0,e.createComponent)(n.ElseClause,{children:t.code`
1898
551
  const match = size.match(/(\\d+(\\.\\d+)?)%/);
1899
552
  if (match) {
1900
553
  return Math.round((getTerminalSize().columns * parseFloat(match[1])) / 100);
1901
554
  }
1902
555
 
1903
556
  throw new Error(\`Invalid width size: \${size}\`);
1904
- ` }),
1905
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
1906
- ];
1907
- }
1908
- }),
1909
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeDeclaration, {
1910
- "export": true,
1911
- name: "BorderOption",
1912
- doc: "The border options applied to table cells.",
1913
- children: _alloy_js_core.code`"primary" | "secondary" | "tertiary" | "none" | string; `
1914
- }),
1915
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1916
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
1917
- "export": true,
1918
- name: "TableOutputOptions",
1919
- doc: "Options to customize the output of the {@link table} function.",
1920
- get children() {
1921
- return [
1922
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1923
- heading: "Border variant for the table cell.",
1924
- get children() {
1925
- return [
1926
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The border variant to use for the table cell. This determines the color and style of the border around the cell.` }),
1927
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1928
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
1929
- get type() {
1930
- return _powerlines_deepkit_vendor_type.ReflectionKind.property;
1931
- },
1932
- defaultValue: "primary"
1933
- })
1934
- ];
1935
- }
1936
- }),
1937
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1938
- name: "border",
1939
- optional: true,
1940
- type: "BorderOption | { top?: BorderOption; right?: BorderOption; bottom?: BorderOption; left?: BorderOption; topLeft?: BorderOption; topRight?: BorderOption; bottomLeft?: BorderOption; bottomRight?: BorderOption; }"
1941
- }),
1942
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1943
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1944
- heading: "Padding for the table cell.",
1945
- get children() {
1946
- return [
1947
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The amount of padding (in spaces) to apply to the table cell. This value is applied to both the left and right sides of the cell. If not specified, the default table padding defined in the current theme configuration will be used.` }),
1948
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1949
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
1950
- get type() {
1951
- return _powerlines_deepkit_vendor_type.ReflectionKind.property;
1952
- },
1953
- get defaultValue() {
1954
- return `\`${theme.padding.table}\``;
1955
- }
1956
- })
1957
- ];
1958
- }
1959
- }),
1960
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1961
- name: "padding",
1962
- optional: true,
1963
- type: "number"
1964
- }),
1965
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1966
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
1967
- heading: "Alignment for the table cell.",
1968
- get children() {
1969
- return [
1970
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The alignment for the table cell. This determines how the text within the cell is aligned. If not specified, the default alignment is "left".` }),
1971
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
1972
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
1973
- get type() {
1974
- return _powerlines_deepkit_vendor_type.ReflectionKind.property;
1975
- },
1976
- defaultValue: "left"
1977
- })
1978
- ];
1979
- }
1980
- }),
1981
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1982
- name: "align",
1983
- optional: true,
1984
- type: "\"left\" | \"right\" | \"center\""
1985
- }),
1986
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
1987
- ];
1988
- }
1989
- }),
1990
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1991
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
1992
- "export": true,
1993
- name: "TableCellOptions",
1994
- "extends": "TableOutputOptions",
1995
- doc: "Options for a specific table cell provided to the {@link table} function.",
1996
- get children() {
1997
- return [
1998
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
1999
- name: "value",
2000
- optional: true,
2001
- type: "string",
2002
- doc: "The actual string value of the table cell."
2003
- }),
2004
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2005
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
2006
- heading: "Width of the table cell.",
2007
- get children() {
2008
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The width of the table cell (where 1 is a single character in the terminal). If not specified, the width will be determined based on the content of the cell and the available space in the console.` });
2009
- }
2010
- }),
2011
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2012
- name: "maxWidth",
2013
- type: "number | SizeToken | undefined"
2014
- }),
2015
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
2016
- ];
2017
- }
2018
- }),
2019
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2020
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
2021
- "export": true,
2022
- name: "TableRowOptions",
2023
- "extends": "TableOutputOptions",
2024
- doc: "Options for a specific table row provided to the {@link table} function.",
2025
- get children() {
2026
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2027
- name: "values",
2028
- optional: true,
2029
- type: "(string | TableCellOptions)[]",
2030
- doc: "The actual string values of the table row's cells."
2031
- }), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
2032
- }
2033
- }),
2034
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2035
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
2036
- "export": true,
2037
- name: "TableOptions",
2038
- "extends": "TableOutputOptions",
2039
- doc: "Options for a specific table cell provided to the {@link table} function.",
2040
- get children() {
2041
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2042
- name: "values",
2043
- optional: true,
2044
- type: "(string | TableCellOptions)[][]",
2045
- doc: "The actual string values of the table's rows' cells."
2046
- }), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
2047
- }
2048
- }),
2049
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2050
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
2051
- name: "Dimensions",
2052
- doc: "The height and width for a specific table/cell used internally in the {@link table} function.",
2053
- get children() {
2054
- return [
2055
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2056
- name: "height",
2057
- type: "number",
2058
- doc: "The height of the row/cell (where 1 is a single line in the terminal)."
2059
- }),
2060
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2061
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2062
- name: "width",
2063
- type: "number",
2064
- doc: "The width of the row/cell (where 1 is a single character in the terminal)."
2065
- }),
2066
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
2067
- ];
2068
- }
2069
- }),
2070
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2071
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
2072
- name: "TableCellBorder",
2073
- doc: "The resolved complete border styles for a table cell.",
2074
- get children() {
2075
- return [
2076
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2077
- name: "top",
2078
- type: "string",
2079
- doc: "The top border style of the table cell."
2080
- }),
2081
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2082
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2083
- name: "bottom",
2084
- type: "string",
2085
- doc: "The bottom border style of the table cell."
2086
- }),
2087
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2088
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2089
- name: "right",
2090
- type: "string",
2091
- doc: "The right border style of the table cell."
2092
- }),
2093
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2094
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2095
- name: "left",
2096
- type: "string",
2097
- doc: "The left border style of the table cell."
2098
- }),
2099
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2100
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2101
- name: "topLeft",
2102
- type: "string",
2103
- doc: "The top-left border style of the table cell."
2104
- }),
2105
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2106
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2107
- name: "topRight",
2108
- type: "string",
2109
- doc: "The top-right border style of the table cell."
2110
- }),
2111
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2112
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2113
- name: "bottomLeft",
2114
- type: "string",
2115
- doc: "The bottom-left border style of the table cell."
2116
- }),
2117
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2118
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
2119
- name: "bottomRight",
2120
- type: "string",
2121
- doc: "The bottom-right border style of the table cell."
2122
- }),
2123
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
2124
- ];
2125
- }
2126
- }),
2127
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2128
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeDeclaration, {
2129
- name: "TableCell",
2130
- doc: "The internal state of a formatted table cell in the {@link table} function.",
2131
- children: _alloy_js_core.code`Required<Omit<TableCellOptions, "maxWidth" | "border">> & Dimensions & {
557
+ `}),(0,e.createComponent)(i.Spacing,{})]}}),(0,e.createComponent)(n.TypeDeclaration,{export:!0,name:`BorderOption`,doc:`The border options applied to table cells.`,children:t.code`"primary" | "secondary" | "tertiary" | "none" | string; `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`TableOutputOptions`,doc:`Options to customize the output of the {@link table} function.`,get children(){return[(0,e.createComponent)(s.TSDoc,{heading:`Border variant for the table cell.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`The border variant to use for the table cell. This determines the color and style of the border around the cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocDefaultValue,{get type(){return r.ReflectionKind.property},defaultValue:`primary`})]}}),(0,e.createComponent)(n.InterfaceMember,{name:`border`,optional:!0,type:`BorderOption | { top?: BorderOption; right?: BorderOption; bottom?: BorderOption; left?: BorderOption; topLeft?: BorderOption; topRight?: BorderOption; bottomLeft?: BorderOption; bottomRight?: BorderOption; }`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDoc,{heading:`Padding for the table cell.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`The amount of padding (in spaces) to apply to the table cell. This value is applied to both the left and right sides of the cell. If not specified, the default table padding defined in the current theme configuration will be used.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocDefaultValue,{get type(){return r.ReflectionKind.property},get defaultValue(){return`\`${o.padding.table}\``}})]}}),(0,e.createComponent)(n.InterfaceMember,{name:`padding`,optional:!0,type:`number`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDoc,{heading:`Alignment for the table cell.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`The alignment for the table cell. This determines how the text within the cell is aligned. If not specified, the default alignment is "left".`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocDefaultValue,{get type(){return r.ReflectionKind.property},defaultValue:`left`})]}}),(0,e.createComponent)(n.InterfaceMember,{name:`align`,optional:!0,type:`"left" | "right" | "center"`}),(0,e.createIntrinsic)(`hbr`,{})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`TableCellOptions`,extends:`TableOutputOptions`,doc:`Options for a specific table cell provided to the {@link table} function.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`value`,optional:!0,type:`string`,doc:`The actual string value of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDoc,{heading:`Width of the table cell.`,get children(){return(0,e.createComponent)(s.TSDocRemarks,{children:`The width of the table cell (where 1 is a single character in the terminal). If not specified, the width will be determined based on the content of the cell and the available space in the console.`})}}),(0,e.createComponent)(n.InterfaceMember,{name:`maxWidth`,type:`number | SizeToken | undefined`}),(0,e.createIntrinsic)(`hbr`,{})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`TableRowOptions`,extends:`TableOutputOptions`,doc:`Options for a specific table row provided to the {@link table} function.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`values`,optional:!0,type:`(string | TableCellOptions)[]`,doc:`The actual string values of the table row's cells.`}),(0,e.createIntrinsic)(`hbr`,{})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`TableOptions`,extends:`TableOutputOptions`,doc:`Options for a specific table cell provided to the {@link table} function.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`values`,optional:!0,type:`(string | TableCellOptions)[][]`,doc:`The actual string values of the table's rows' cells.`}),(0,e.createIntrinsic)(`hbr`,{})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceDeclaration,{name:`Dimensions`,doc:`The height and width for a specific table/cell used internally in the {@link table} function.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`height`,type:`number`,doc:`The height of the row/cell (where 1 is a single line in the terminal).`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`width`,type:`number`,doc:`The width of the row/cell (where 1 is a single character in the terminal).`}),(0,e.createIntrinsic)(`hbr`,{})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.InterfaceDeclaration,{name:`TableCellBorder`,doc:`The resolved complete border styles for a table cell.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`top`,type:`string`,doc:`The top border style of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`bottom`,type:`string`,doc:`The bottom border style of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`right`,type:`string`,doc:`The right border style of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`left`,type:`string`,doc:`The left border style of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`topLeft`,type:`string`,doc:`The top-left border style of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`topRight`,type:`string`,doc:`The top-right border style of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`bottomLeft`,type:`string`,doc:`The bottom-left border style of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`bottomRight`,type:`string`,doc:`The bottom-right border style of the table cell.`}),(0,e.createIntrinsic)(`hbr`,{})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.TypeDeclaration,{name:`TableCell`,doc:`The internal state of a formatted table cell in the {@link table} function.`,children:t.code`Required<Omit<TableCellOptions, "maxWidth" | "border">> & Dimensions & {
2132
558
  border: TableCellBorder;
2133
559
  maxWidth?: number;
2134
560
  };
2135
- `
2136
- }),
2137
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2138
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
2139
- heading: "Write a table to the console.",
2140
- get children() {
2141
- return [
2142
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function writes a table to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.` }),
2143
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2144
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
2145
- name: "options",
2146
- children: `Options to customize the table output.`
2147
- })
2148
- ];
2149
- }
2150
- }),
2151
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, (0, _alloy_js_core_jsx_runtime.mergeProps)({ "export": true }, props, {
2152
- name: "table",
2153
- parameters: [{
2154
- name: "options",
2155
- type: "TableOptions | TableRowOptions[] | TableCellOptions[][] | string[] | string[][]",
2156
- optional: false
2157
- }],
2158
- get children() {
2159
- return [
2160
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
2161
- condition: _alloy_js_core.code`!options ||
561
+ `}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:`Write a table to the console.`,get children(){return[(0,e.createComponent)(s.TSDocRemarks,{children:`This function writes a table to the console, applying the appropriate padding as defined in the current theme configuration and wrapping as needed.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(s.TSDocParam,{name:`options`,children:`Options to customize the table output.`})]}}),(0,e.createComponent)(n.FunctionDeclaration,(0,e.mergeProps)({export:!0},a,{name:`table`,parameters:[{name:`options`,type:`TableOptions | TableRowOptions[] | TableCellOptions[][] | string[] | string[][]`,optional:!1}],get children(){return[(0,e.createComponent)(n.IfStatement,{condition:t.code`!options ||
2162
562
  (!Array.isArray(options) && (typeof options !== "object" || !options.values || !Array.isArray(options.values) || options.values.length === 0)) ||
2163
- (Array.isArray(options) && !options.every(item => typeof item === "object" || typeof item === "string" || Array.isArray(item))) `,
2164
- children: _alloy_js_core.code`return;`
2165
- }),
2166
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2167
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
2168
- "let": true,
2169
- name: "cells",
2170
- type: `TableCell[][]`,
2171
- initializer: _alloy_js_core.code`[];`
2172
- }),
2173
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2174
- (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
563
+ (Array.isArray(options) && !options.every(item => typeof item === "object" || typeof item === "string" || Array.isArray(item))) `,children:t.code`return;`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.VarDeclaration,{let:!0,name:`cells`,type:`TableCell[][]`,initializer:t.code`[];`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.memo)(()=>t.code`
2175
564
  const extractTableCell = (cell: string | TableCellOptions, columnIndex: number, rowLength: number, opts?: TableOutputOptions): TableCell => {
2176
565
  if (typeof cell === "string") {
2177
566
  const borderOptions = opts?.border || "primary";
@@ -2179,27 +568,27 @@ function TableFunctionDeclaration(props) {
2179
568
  let border = {} as TableCellBorder;
2180
569
  if (typeof borderOptions === "object") {
2181
570
  border = {
2182
- top: ${extractBorderOptionsObject("top", theme)},
2183
- bottom: ${extractBorderOptionsObject("bottom", theme)},
2184
- left: ${extractBorderOptionsObject("left", theme)},
2185
- right: ${extractBorderOptionsObject("right", theme)},
2186
- topLeft: ${extractBorderOptionsObject("topLeft", theme)},
2187
- topRight: ${extractBorderOptionsObject("topRight", theme)},
2188
- bottomLeft: ${extractBorderOptionsObject("bottomLeft", theme)},
2189
- bottomRight: ${extractBorderOptionsObject("bottomRight", theme)},
571
+ top: ${M(`top`,o)},
572
+ bottom: ${M(`bottom`,o)},
573
+ left: ${M(`left`,o)},
574
+ right: ${M(`right`,o)},
575
+ topLeft: ${M(`topLeft`,o)},
576
+ topRight: ${M(`topRight`,o)},
577
+ bottomLeft: ${M(`bottomLeft`,o)},
578
+ bottomRight: ${M(`bottomRight`,o)},
2190
579
  };
2191
580
  } else {
2192
- border.top = ${extractBorderOptionsString("top", theme)};
2193
- border.bottom = ${extractBorderOptionsString("bottom", theme)};
2194
- border.left = ${extractBorderOptionsString("left", theme)};
2195
- border.right = ${extractBorderOptionsString("right", theme)};
2196
- border.topLeft = ${extractBorderOptionsString("topLeft", theme)};
2197
- border.topRight = ${extractBorderOptionsString("topRight", theme)};
2198
- border.bottomLeft = ${extractBorderOptionsString("bottomLeft", theme)};
2199
- border.bottomRight = ${extractBorderOptionsString("bottomRight", theme)};
581
+ border.top = ${N(`top`,o)};
582
+ border.bottom = ${N(`bottom`,o)};
583
+ border.left = ${N(`left`,o)};
584
+ border.right = ${N(`right`,o)};
585
+ border.topLeft = ${N(`topLeft`,o)};
586
+ border.topRight = ${N(`topRight`,o)};
587
+ border.bottomLeft = ${N(`bottomLeft`,o)};
588
+ border.bottomRight = ${N(`bottomRight`,o)};
2200
589
  }
2201
590
 
2202
- const padding = Math.max(0, opts?.padding ?? ${theme.padding.table}) * (columnIndex === 0 || columnIndex === rowLength - 1 ? 2 : 1);
591
+ const padding = Math.max(0, opts?.padding ?? ${o.padding.table}) * (columnIndex === 0 || columnIndex === rowLength - 1 ? 2 : 1);
2203
592
  const value = cell ?? "";
2204
593
  const width = stripAnsi(value).length + padding * 2;
2205
594
 
@@ -2217,27 +606,27 @@ function TableFunctionDeclaration(props) {
2217
606
  let border = {} as TableCellBorder;
2218
607
  if (typeof borderOptions === "object") {
2219
608
  border = {
2220
- top: ${extractBorderOptionsObject("top", theme)},
2221
- bottom: ${extractBorderOptionsObject("bottom", theme)},
2222
- left: ${extractBorderOptionsObject("left", theme)},
2223
- right: ${extractBorderOptionsObject("right", theme)},
2224
- topLeft: ${extractBorderOptionsObject("topLeft", theme)},
2225
- topRight: ${extractBorderOptionsObject("topRight", theme)},
2226
- bottomLeft: ${extractBorderOptionsObject("bottomLeft", theme)},
2227
- bottomRight: ${extractBorderOptionsObject("bottomRight", theme)},
609
+ top: ${M(`top`,o)},
610
+ bottom: ${M(`bottom`,o)},
611
+ left: ${M(`left`,o)},
612
+ right: ${M(`right`,o)},
613
+ topLeft: ${M(`topLeft`,o)},
614
+ topRight: ${M(`topRight`,o)},
615
+ bottomLeft: ${M(`bottomLeft`,o)},
616
+ bottomRight: ${M(`bottomRight`,o)},
2228
617
  };
2229
618
  } else {
2230
- border.top = ${extractBorderOptionsString("top", theme)};
2231
- border.bottom = ${extractBorderOptionsString("bottom", theme)};
2232
- border.left = ${extractBorderOptionsString("left", theme)};
2233
- border.right = ${extractBorderOptionsString("right", theme)};
2234
- border.topLeft = ${extractBorderOptionsString("topLeft", theme)};
2235
- border.topRight = ${extractBorderOptionsString("topRight", theme)};
2236
- border.bottomLeft = ${extractBorderOptionsString("bottomLeft", theme)};
2237
- border.bottomRight = ${extractBorderOptionsString("bottomRight", theme)};
619
+ border.top = ${N(`top`,o)};
620
+ border.bottom = ${N(`bottom`,o)};
621
+ border.left = ${N(`left`,o)};
622
+ border.right = ${N(`right`,o)};
623
+ border.topLeft = ${N(`topLeft`,o)};
624
+ border.topRight = ${N(`topRight`,o)};
625
+ border.bottomLeft = ${N(`bottomLeft`,o)};
626
+ border.bottomRight = ${N(`bottomRight`,o)};
2238
627
  }
2239
628
 
2240
- const padding = Math.max(0, cell.padding ?? opts?.padding ?? ${theme.padding.table});
629
+ const padding = Math.max(0, cell.padding ?? opts?.padding ?? ${o.padding.table});
2241
630
  const value = cell.value ?? "";
2242
631
  const width = stripAnsi(value).length + padding * 2;
2243
632
  const maxWidth = cell.maxWidth ? typeof cell.maxWidth === "number" ? cell.maxWidth : calculateWidth(cell.maxWidth) : undefined;
@@ -2255,15 +644,7 @@ function TableFunctionDeclaration(props) {
2255
644
  };
2256
645
 
2257
646
  let colMaxWidths = [] as (number | undefined)[];
2258
- `),
2259
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2260
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
2261
- condition: _alloy_js_core.code`Array.isArray(options)`,
2262
- get children() {
2263
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
2264
- condition: _alloy_js_core.code`options.every(row => typeof row === "string" || (typeof row === "object" && !Array.isArray(row) && !("values" in row)))`,
2265
- children: _alloy_js_core.code`cells.push(options.map((cell, index) => extractTableCell(cell as string | TableCellOptions, index, options.length)));`
2266
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`
647
+ `),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.IfStatement,{condition:t.code`Array.isArray(options)`,get children(){return[(0,e.createComponent)(n.IfStatement,{condition:t.code`options.every(row => typeof row === "string" || (typeof row === "object" && !Array.isArray(row) && !("values" in row)))`,children:t.code`cells.push(options.map((cell, index) => extractTableCell(cell as string | TableCellOptions, index, options.length)));`}),(0,e.createComponent)(n.ElseClause,{children:t.code`
2267
648
  cells.push(
2268
649
  ...options.map(row => Array.isArray(row)
2269
650
  ? row.reduce((cellRow, cell, index) => {
@@ -2290,10 +671,7 @@ function TableFunctionDeclaration(props) {
2290
671
  }, [] as TableCell[]) ?? []
2291
672
  )
2292
673
  );
2293
- ` })];
2294
- }
2295
- }),
2296
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`
674
+ `})]}}),(0,e.createComponent)(n.ElseClause,{children:t.code`
2297
675
  cells.push(
2298
676
  ...options.values!.map(row => Array.isArray(row)
2299
677
  ? row.reduce((cellRow, cell, index) => {
@@ -2321,9 +699,7 @@ function TableFunctionDeclaration(props) {
2321
699
  )
2322
700
  );
2323
701
 
2324
- ` }),
2325
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
2326
- (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
702
+ `}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.memo)(()=>t.code`
2327
703
  cells = cells.filter(row => row.length > 0);
2328
704
  if (cells.length === 0) {
2329
705
  return;
@@ -2384,7 +760,7 @@ do {
2384
760
  }
2385
761
 
2386
762
  rowDims.forEach((row, rowIndex) => {
2387
- if (!recalculate && row.width > Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
763
+ if (!recalculate && row.width > Math.max(getTerminalSize().columns - ${Math.max(o.padding.app,0)*2}, 0)) {
2388
764
  const cell = cells[rowIndex]!.reduce((largestCell, cell) => {
2389
765
  if (cell.width > largestCell.width) {
2390
766
  return cell;
@@ -2394,7 +770,7 @@ do {
2394
770
 
2395
771
  const lines = splitText(
2396
772
  cell.value,
2397
- Math.min(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2} - (row.width - (cell.width - cell.padding * 2)), 0),
773
+ Math.min(Math.max(getTerminalSize().columns - ${Math.max(o.padding.app,0)*2} - (row.width - (cell.width - cell.padding * 2)), 0),
2398
774
  cell.maxWidth ?? Number.POSITIVE_INFINITY)
2399
775
  );
2400
776
 
@@ -2406,7 +782,7 @@ do {
2406
782
  }
2407
783
  });
2408
784
 
2409
- if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
785
+ if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(getTerminalSize().columns - ${Math.max(o.padding.app,0)*2}, 0)) {
2410
786
  let colIndex = 0;
2411
787
  const cell = cells.reduce((ret, row) => {
2412
788
  return row.reduce((largest, current, index) => {
@@ -2420,7 +796,7 @@ do {
2420
796
 
2421
797
  const lines = splitText(
2422
798
  cell.value,
2423
- Math.min(Math.max(getTerminalSize().columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0),
799
+ Math.min(Math.max(getTerminalSize().columns - ${Math.max(o.padding.app,0)*2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0),
2424
800
  cell.maxWidth ?? Number.POSITIVE_INFINITY)
2425
801
  );
2426
802
 
@@ -2470,167 +846,7 @@ cells.forEach((row, rowIndex) => {
2470
846
  writeLine(outputs.map(output => output[index] ?? "").join(""));
2471
847
  }
2472
848
  });
2473
- `)
2474
- ];
2475
- }
2476
- }))
2477
- ];
2478
- }
2479
- /**
2480
- * A built-in console utilities module for Shell Shock.
2481
- */
2482
- function ConsoleBuiltin(props) {
2483
- const { children, imports, builtinImports } = props;
2484
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, {
2485
- id: "console",
2486
- description: "A collection of helper utilities to assist in generating content meant for display in the console.",
2487
- get imports() {
2488
- return (0, defu.defu)(imports, {
2489
- "@shell-shock/plugin-theme/types/theme": ["ThemeSpinnerResolvedConfig"],
2490
- "@shell-shock/plugin-theme/helpers/spinners": ["SpinnerPreset", "resolveSpinner"],
2491
- "node:util": ["stripVTControlCharacters"]
2492
- });
2493
- },
2494
- get builtinImports() {
2495
- return (0, defu.defu)(builtinImports, {
2496
- utils: [
2497
- "isInteractive",
2498
- "isColorSupported",
2499
- "colorSupportLevels",
2500
- "isUnicodeSupported",
2501
- "isHyperlinkSupported",
2502
- "getTerminalSize"
2503
- ],
2504
- env: [
2505
- "env",
2506
- "isDevelopment",
2507
- "isDebug"
2508
- ],
2509
- state: ["hasFlag"]
2510
- });
2511
- },
2512
- get children() {
2513
- return [
2514
- (0, _alloy_js_core_jsx_runtime.createComponent)(AnsiHelpersDeclarations, {}),
2515
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2516
- (0, _alloy_js_core_jsx_runtime.createComponent)(StripAnsiFunctionDeclaration, {}),
2517
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2518
- (0, _alloy_js_core_jsx_runtime.createComponent)(WrapAnsiFunction, {}),
2519
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2520
- (0, _alloy_js_core_jsx_runtime.createComponent)(AnsiStyleFunctionsDeclaration, {}),
2521
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2522
- (0, _alloy_js_core_jsx_runtime.createComponent)(WriteFunctionDeclaration, {}),
2523
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2524
- (0, _alloy_js_core_jsx_runtime.createComponent)(WriteLineFunctionDeclaration, {}),
2525
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2526
- (0, _alloy_js_core_jsx_runtime.createComponent)(SplitTextFunctionDeclaration, {}),
2527
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2528
- (0, _alloy_js_core_jsx_runtime.createComponent)(LinkFunctionDeclaration, {}),
2529
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2530
- (0, _alloy_js_core_jsx_runtime.createComponent)(DividerFunctionDeclaration, {}),
2531
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2532
- (0, _alloy_js_core_jsx_runtime.createComponent)(SpinnerFunctionDeclaration, {}),
2533
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2534
- (0, _alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
2535
- type: "help",
2536
- variant: "help",
2537
- consoleFnName: "log",
2538
- description: "help"
2539
- }),
2540
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2541
- (0, _alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
2542
- type: "success",
2543
- variant: "success",
2544
- consoleFnName: "info",
2545
- description: "success"
2546
- }),
2547
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2548
- (0, _alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
2549
- type: "info",
2550
- variant: "info",
2551
- consoleFnName: "info",
2552
- description: "informational"
2553
- }),
2554
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2555
- (0, _alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
2556
- type: "debug",
2557
- variant: "debug",
2558
- consoleFnName: "debug",
2559
- description: "debug",
2560
- timestamp: true,
2561
- get prefix() {
2562
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
2563
- get condition() {
2564
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_helpers.IsNotDebug, {});
2565
- },
2566
- children: _alloy_js_core.code`return; `
2567
- });
2568
- }
2569
- }),
2570
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2571
- (0, _alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
2572
- type: "verbose",
2573
- variant: "info",
2574
- color: "debug",
2575
- consoleFnName: "debug",
2576
- description: "verbose",
2577
- timestamp: true,
2578
- get prefix() {
2579
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
2580
- get condition() {
2581
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_helpers.IsNotVerbose, {});
2582
- },
2583
- children: _alloy_js_core.code`return; `
2584
- });
2585
- }
2586
- }),
2587
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2588
- (0, _alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
2589
- type: "warn",
2590
- variant: "warning",
2591
- consoleFnName: "warn",
2592
- description: "warning"
2593
- }),
2594
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2595
- (0, _alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
2596
- type: "danger",
2597
- variant: "danger",
2598
- consoleFnName: "error",
2599
- description: "destructive/danger"
2600
- }),
2601
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2602
- (0, _alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
2603
- type: "error",
2604
- variant: "error",
2605
- consoleFnName: "error",
2606
- description: "error",
2607
- timestamp: true,
2608
- parameters: [{
2609
- name: "err",
2610
- type: "string | { message: string; stack?: string }",
2611
- optional: false
2612
- }, {
2613
- name: "header",
2614
- type: "string",
2615
- optional: true
2616
- }],
2617
- get prefix() {
2618
- return [
2619
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
2620
- "let": true,
2621
- name: "message",
2622
- type: "string | undefined"
2623
- }),
2624
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2625
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
2626
- condition: _alloy_js_core.code`(err as { message: string; stack?: string })?.message`,
2627
- children: _alloy_js_core.code`message = (err as { message: string; stack?: string }).message;`
2628
- }),
2629
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`message = String(err);` }),
2630
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2631
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
2632
- condition: _alloy_js_core.code`env.STACKTRACE && typeof err === "object" && (err as { stack?: string })?.stack`,
2633
- children: _alloy_js_core.code`message += " \\n\\n" + (err as { stack: string }).stack.split("\\n").slice(1).map(line => {
849
+ `)]}}))]}function F(r){let{children:a,imports:s,builtinImports:l}=r;return(0,e.createComponent)(o.BuiltinFile,{id:`console`,description:`A collection of helper utilities to assist in generating content meant for display in the console.`,get imports(){return(0,m.defu)(s,{"@shell-shock/plugin-theme/types/theme":[`ThemeSpinnerResolvedConfig`],"@shell-shock/plugin-theme/helpers/spinners":[`SpinnerPreset`,`resolveSpinner`],"node:util":[`stripVTControlCharacters`]})},get builtinImports(){return(0,m.defu)(l,{utils:[`isInteractive`,`isColorSupported`,`colorSupportLevels`,`isUnicodeSupported`,`isHyperlinkSupported`,`getTerminalSize`],env:[`env`,`isDevelopment`,`isDebug`],state:[`hasFlag`]})},get children(){return[(0,e.createComponent)(h,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(T,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(w,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(y,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(x,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(S,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(b,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(D,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(E,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(j,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(C,{type:`help`,variant:`help`,consoleFnName:`log`,description:`help`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(C,{type:`success`,variant:`success`,consoleFnName:`info`,description:`success`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(C,{type:`info`,variant:`info`,consoleFnName:`info`,description:`informational`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(C,{type:`debug`,variant:`debug`,consoleFnName:`debug`,description:`debug`,timestamp:!0,get prefix(){return(0,e.createComponent)(n.IfStatement,{get condition(){return(0,e.createComponent)(c.IsNotDebug,{})},children:t.code`return; `})}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(C,{type:`verbose`,variant:`info`,color:`debug`,consoleFnName:`debug`,description:`verbose`,timestamp:!0,get prefix(){return(0,e.createComponent)(n.IfStatement,{get condition(){return(0,e.createComponent)(c.IsNotVerbose,{})},children:t.code`return; `})}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(C,{type:`warn`,variant:`warning`,consoleFnName:`warn`,description:`warning`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(C,{type:`danger`,variant:`danger`,consoleFnName:`error`,description:`destructive/danger`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(C,{type:`error`,variant:`error`,consoleFnName:`error`,description:`error`,timestamp:!0,parameters:[{name:`err`,type:`string | { message: string; stack?: string }`,optional:!1},{name:`header`,type:`string`,optional:!0}],get prefix(){return[(0,e.createComponent)(n.VarDeclaration,{let:!0,name:`message`,type:`string | undefined`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.IfStatement,{condition:t.code`(err as { message: string; stack?: string })?.message`,children:t.code`message = (err as { message: string; stack?: string }).message;`}),(0,e.createComponent)(n.ElseClause,{children:t.code`message = String(err);`}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(n.IfStatement,{condition:t.code`env.STACKTRACE && typeof err === "object" && (err as { stack?: string })?.stack`,children:t.code`message += " \\n\\n" + (err as { stack: string }).stack.split("\\n").slice(1).map(line => {
2634
850
  const match = line.match(/at (?:(.+?)\\s+\\()?(?:(.+?):(\\d+)(?::(\\d+))?|([^)]+))\\)?/);
2635
851
  if (match) {
2636
852
  const filePath = match[2] || match[5] || "<unknown>";
@@ -2638,43 +854,4 @@ function ConsoleBuiltin(props) {
2638
854
  }
2639
855
 
2640
856
  return line.trim();
2641
- }).join("\\n"); `
2642
- })
2643
- ];
2644
- }
2645
- }),
2646
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2647
- (0, _alloy_js_core_jsx_runtime.createComponent)(TableFunctionDeclaration, {}),
2648
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2649
- (0, _alloy_js_core_jsx_runtime.createComponent)(BlockquoteFunctionDeclaration, {}),
2650
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2651
- (0, _alloy_js_core_jsx_runtime.createComponent)(CodeFunctionDeclaration, {}),
2652
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2653
- (0, _alloy_js_core_jsx_runtime.createComponent)(InlineCodeFunctionDeclaration, {}),
2654
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
2655
- children,
2656
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
2657
- ];
2658
- }
2659
- });
2660
- }
2661
-
2662
- //#endregion
2663
- exports.AnsiHelpersDeclarations = AnsiHelpersDeclarations;
2664
- exports.AnsiStyleFunctionsDeclaration = AnsiStyleFunctionsDeclaration;
2665
- exports.BlockquoteFunctionDeclaration = BlockquoteFunctionDeclaration;
2666
- exports.CodeFunctionDeclaration = CodeFunctionDeclaration;
2667
- exports.ConsoleBuiltin = ConsoleBuiltin;
2668
- exports.DividerFunctionDeclaration = DividerFunctionDeclaration;
2669
- exports.InlineCodeFunctionDeclaration = InlineCodeFunctionDeclaration;
2670
- exports.LinkFunctionDeclaration = LinkFunctionDeclaration;
2671
- exports.MessageFunctionDeclaration = MessageFunctionDeclaration;
2672
- exports.SpinnerFunctionDeclaration = SpinnerFunctionDeclaration;
2673
- exports.SplitTextFunctionDeclaration = SplitTextFunctionDeclaration;
2674
- exports.StripAnsiFunctionDeclaration = StripAnsiFunctionDeclaration;
2675
- exports.TableFunctionDeclaration = TableFunctionDeclaration;
2676
- exports.ThemeColorObjectDefinition = ThemeColorObjectDefinition;
2677
- exports.ThemeColorTypeDefinition = ThemeColorTypeDefinition;
2678
- exports.WrapAnsiFunction = WrapAnsiFunction;
2679
- exports.WriteFunctionDeclaration = WriteFunctionDeclaration;
2680
- exports.WriteLineFunctionDeclaration = WriteLineFunctionDeclaration;
857
+ }).join("\\n"); `})]}}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(P,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(O,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(k,{}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(A,{}),(0,e.createComponent)(i.Spacing,{}),a,(0,e.createComponent)(i.Spacing,{})]}})}exports.AnsiHelpersDeclarations=h,exports.AnsiStyleFunctionsDeclaration=y,exports.BlockquoteFunctionDeclaration=O,exports.CodeFunctionDeclaration=k,exports.ConsoleBuiltin=F,exports.DividerFunctionDeclaration=E,exports.InlineCodeFunctionDeclaration=A,exports.LinkFunctionDeclaration=D,exports.MessageFunctionDeclaration=C,exports.SpinnerFunctionDeclaration=j,exports.SplitTextFunctionDeclaration=b,exports.StripAnsiFunctionDeclaration=T,exports.TableFunctionDeclaration=P,exports.ThemeColorObjectDefinition=v,exports.ThemeColorTypeDefinition=_,exports.WrapAnsiFunction=w,exports.WriteFunctionDeclaration=x,exports.WriteLineFunctionDeclaration=S;