@shell-shock/preset-script 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/dist/components/args-parser-logic.d.cts +7 -7
  3. package/dist/components/args-parser-logic.d.mts +7 -7
  4. package/dist/components/args-parser-logic.d.mts.map +1 -1
  5. package/dist/components/bin-entry.cjs +0 -1
  6. package/dist/components/bin-entry.cjs.map +1 -1
  7. package/dist/components/bin-entry.d.cts.map +1 -1
  8. package/dist/components/bin-entry.d.mts.map +1 -1
  9. package/dist/components/bin-entry.mjs +0 -1
  10. package/dist/components/bin-entry.mjs.map +1 -1
  11. package/dist/components/command-entry.d.cts +4 -4
  12. package/dist/components/command-entry.d.mts +4 -4
  13. package/dist/components/command-router.cjs +2 -2
  14. package/dist/components/command-router.cjs.map +1 -1
  15. package/dist/components/command-router.mjs +2 -2
  16. package/dist/components/command-router.mjs.map +1 -1
  17. package/dist/components/console-builtin.cjs +246 -34
  18. package/dist/components/console-builtin.cjs.map +1 -1
  19. package/dist/components/console-builtin.d.cts +12 -2
  20. package/dist/components/console-builtin.d.cts.map +1 -1
  21. package/dist/components/console-builtin.d.mts +12 -2
  22. package/dist/components/console-builtin.d.mts.map +1 -1
  23. package/dist/components/console-builtin.mjs +247 -36
  24. package/dist/components/console-builtin.mjs.map +1 -1
  25. package/dist/components/help.cjs +4 -4
  26. package/dist/components/help.cjs.map +1 -1
  27. package/dist/components/help.d.mts +5 -5
  28. package/dist/components/help.mjs +4 -4
  29. package/dist/components/help.mjs.map +1 -1
  30. package/dist/components/index.cjs +1 -0
  31. package/dist/components/index.d.cts +2 -2
  32. package/dist/components/index.d.mts +2 -2
  33. package/dist/components/index.mjs +2 -2
  34. package/dist/components/utils-builtin.cjs +18 -16
  35. package/dist/components/utils-builtin.cjs.map +1 -1
  36. package/dist/components/utils-builtin.d.cts.map +1 -1
  37. package/dist/components/utils-builtin.d.mts +7 -7
  38. package/dist/components/utils-builtin.d.mts.map +1 -1
  39. package/dist/components/utils-builtin.mjs +18 -16
  40. package/dist/components/utils-builtin.mjs.map +1 -1
  41. package/dist/components/virtual-command-entry.d.mts +3 -3
  42. package/dist/components/virtual-command-entry.d.mts.map +1 -1
  43. package/dist/helpers/ansi-utils.cjs +74 -10
  44. package/dist/helpers/ansi-utils.cjs.map +1 -1
  45. package/dist/helpers/ansi-utils.mjs +74 -10
  46. package/dist/helpers/ansi-utils.mjs.map +1 -1
  47. package/dist/helpers/get-default-options.cjs +20 -0
  48. package/dist/helpers/get-default-options.cjs.map +1 -1
  49. package/dist/helpers/get-default-options.mjs +20 -0
  50. package/dist/helpers/get-default-options.mjs.map +1 -1
  51. package/dist/index.cjs +10 -8
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts.map +1 -1
  54. package/dist/index.d.mts.map +1 -1
  55. package/dist/index.mjs +11 -9
  56. package/dist/index.mjs.map +1 -1
  57. package/dist/types/plugin.d.mts.map +1 -1
  58. package/package.json +10 -10
@@ -1,6 +1,6 @@
1
1
  import { Children } from "@alloy-js/core";
2
2
  import { FunctionDeclarationProps } from "@alloy-js/typescript";
3
- import { ThemeMessageVariant } from "@shell-shock/plugin-theme/types/theme";
3
+ import { ThemeColorVariant, ThemeMessageVariant } from "@shell-shock/plugin-theme/types/theme";
4
4
 
5
5
  //#region src/components/console-builtin.d.ts
6
6
 
@@ -18,11 +18,21 @@ type MessageFunctionDeclarationProps = Partial<Pick<FunctionDeclarationProps, "p
18
18
  consoleFnName: "log" | "info" | "warn" | "error" | "debug";
19
19
  description: string;
20
20
  prefix?: Children;
21
+ timestamp?: boolean;
21
22
  };
22
23
  /**
23
24
  * A component to generate the message functions in the `shell-shock:console` builtin module.
24
25
  */
25
26
  declare function MessageFunctionDeclaration(props: MessageFunctionDeclarationProps): Children;
27
+ interface BannerFunctionDeclarationProps {
28
+ variant?: ThemeColorVariant;
29
+ consoleFnName?: "log" | "info" | "warn" | "error" | "debug";
30
+ title?: string;
31
+ }
32
+ /**
33
+ * A component to generate the `banner` function in the `shell-shock:console` builtin module.
34
+ */
35
+ declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): Children;
26
36
  /**
27
37
  * A component to generate the `wrapAnsi` function in the `shell-shock:console` builtin module.
28
38
  */
@@ -52,5 +62,5 @@ declare function TableFunctionDeclaration(props: TableFunctionDeclarationProps):
52
62
  */
53
63
  declare function ConsoleBuiltin(): Children;
54
64
  //#endregion
55
- export { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration };
65
+ export { BannerFunctionDeclaration, BannerFunctionDeclarationProps, ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration };
56
66
  //# sourceMappingURL=console-builtin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-builtin.d.cts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AA8EA;AA47BgB,iBA57BA,iBAAA,CAAA,CA47B4B,EA57BX,QA47BW;AAuJ5C;;;AAA8C,iBAvJ9B,4BAAA,CAAA,CAuJ8B,EAvJF,QAuJE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EAGA,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAAQ,OAAA,EAHR,mBAGQ;EAMH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EAoGO,WAAA,EAAA,MAAgB;EA4EhB,MAAA,CAAA,EAvLL,QAuLK;AAmChB,CAAA;AAsFA;AA0FA;AAQA;AAsegB,iBAl3BA,0BAAA,CAk3Bc,KAAA,EAj3BrB,+BAi3BqB,CAAA,EAj3BU,QAi3BV;;;;iBA7wBd,gBAAA,CAAA,GAAgB;;;;iBA4EhB,4BAAA,CAAA,GAA4B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAsF1B,uBAAA,CAAA,GAAuB;;;;KA0F3B,6BAAA,GAAgC,KAC1C;;;;iBAOc,wBAAA,QAAgC,gCAA6B;;;;iBAse7D,cAAA,CAAA,GAAc"}
1
+ {"version":3,"file":"console-builtin.d.cts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAuFA;AAwpCgB,iBAxpCA,iBAAA,CAAA,CAwpC4B,EAxpCX,QAwpCW;AAuJ5C;;;AAA8C,iBAvJ9B,4BAAA,CAAA,CAuJ8B,EAvJF,QAuJE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EAGA,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAAQ,OAAA,EAHR,mBAGQ;EAOH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EAuKQ,WAAA,EAAA,MAAA;EASD,MAAA,CAAA,EAxLL,QAwLK;EA0LA,SAAA,CAAA,EAAA,OAAgB;AA4EhC,CAAA;AAmCA;AAsFA;AA0FA;AAQgB,iBAlpBA,0BAAA,CAkpBgC,KAAA,EAjpBvC,+BAipBoE,CAAA,EAjpBrC,QAipBqC;AAse7D,UAh9BC,8BAAA,CAg9Ba;YA/8BlB;;;;;;;iBAQI,yBAAA,QACP,iCAA8B;;;;iBAyLvB,gBAAA,CAAA,GAAgB;;;;iBA4EhB,4BAAA,CAAA,GAA4B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAsF1B,uBAAA,CAAA,GAAuB;;;;KA0F3B,6BAAA,GAAgC,KAC1C;;;;iBAOc,wBAAA,QAAgC,gCAA6B;;;;iBAse7D,cAAA,CAAA,GAAc"}
@@ -1,6 +1,6 @@
1
1
  import { Children } from "@alloy-js/core";
2
2
  import { FunctionDeclarationProps } from "@alloy-js/typescript";
3
- import { ThemeMessageVariant } from "@shell-shock/plugin-theme/types/theme";
3
+ import { ThemeColorVariant, ThemeMessageVariant } from "@shell-shock/plugin-theme/types/theme";
4
4
 
5
5
  //#region src/components/console-builtin.d.ts
6
6
 
@@ -18,11 +18,21 @@ type MessageFunctionDeclarationProps = Partial<Pick<FunctionDeclarationProps, "p
18
18
  consoleFnName: "log" | "info" | "warn" | "error" | "debug";
19
19
  description: string;
20
20
  prefix?: Children;
21
+ timestamp?: boolean;
21
22
  };
22
23
  /**
23
24
  * A component to generate the message functions in the `shell-shock:console` builtin module.
24
25
  */
25
26
  declare function MessageFunctionDeclaration(props: MessageFunctionDeclarationProps): Children;
27
+ interface BannerFunctionDeclarationProps {
28
+ variant?: ThemeColorVariant;
29
+ consoleFnName?: "log" | "info" | "warn" | "error" | "debug";
30
+ title?: string;
31
+ }
32
+ /**
33
+ * A component to generate the `banner` function in the `shell-shock:console` builtin module.
34
+ */
35
+ declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): Children;
26
36
  /**
27
37
  * A component to generate the `wrapAnsi` function in the `shell-shock:console` builtin module.
28
38
  */
@@ -52,5 +62,5 @@ declare function TableFunctionDeclaration(props: TableFunctionDeclarationProps):
52
62
  */
53
63
  declare function ConsoleBuiltin(): Children;
54
64
  //#endregion
55
- export { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration };
65
+ export { BannerFunctionDeclaration, BannerFunctionDeclarationProps, ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration };
56
66
  //# sourceMappingURL=console-builtin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-builtin.d.mts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AA8EA;AA47BgB,iBA57BA,iBAAA,CAAA,CA47B4B,EA57BX,QA47BW;AAuJ5C;;;AAA8C,iBAvJ9B,4BAAA,CAAA,CAuJ8B,EAvJF,QAuJE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EAGA,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAAQ,OAAA,EAHR,mBAGQ;EAMH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EAoGO,WAAA,EAAA,MAAgB;EA4EhB,MAAA,CAAA,EAvLL,QAuLK;AAmChB,CAAA;AAsFA;AA0FA;AAQA;AAsegB,iBAl3BA,0BAAA,CAk3Bc,KAAA,EAj3BrB,+BAi3BqB,CAAA,EAj3BU,QAi3BV;;;;iBA7wBd,gBAAA,CAAA,GAAgB;;;;iBA4EhB,4BAAA,CAAA,GAA4B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAsF1B,uBAAA,CAAA,GAAuB;;;;KA0F3B,6BAAA,GAAgC,KAC1C;;;;iBAOc,wBAAA,QAAgC,gCAA6B;;;;iBAse7D,cAAA,CAAA,GAAc"}
1
+ {"version":3,"file":"console-builtin.d.mts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAuFA;AAwpCgB,iBAxpCA,iBAAA,CAAA,CAwpC4B,EAxpCX,QAwpCW;AAuJ5C;;;AAA8C,iBAvJ9B,4BAAA,CAAA,CAuJ8B,EAvJF,QAuJE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EAGA,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAAQ,OAAA,EAHR,mBAGQ;EAOH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EAuKQ,WAAA,EAAA,MAAA;EASD,MAAA,CAAA,EAxLL,QAwLK;EA0LA,SAAA,CAAA,EAAA,OAAgB;AA4EhC,CAAA;AAmCA;AAsFA;AA0FA;AAQgB,iBAlpBA,0BAAA,CAkpBgC,KAAA,EAjpBvC,+BAipBoE,CAAA,EAjpBrC,QAipBqC;AAse7D,UAh9BC,8BAAA,CAg9Ba;YA/8BlB;;;;;;;iBAQI,yBAAA,QACP,iCAA8B;;;;iBAyLvB,gBAAA,CAAA,GAAgB;;;;iBA4EhB,4BAAA,CAAA,GAA4B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAsF1B,uBAAA,CAAA,GAAuB;;;;KA0F3B,6BAAA,GAAgC,KAC1C;;;;iBAOc,wBAAA,QAAgC,gCAA6B;;;;iBAse7D,cAAA,CAAA,GAAc"}
@@ -1,10 +1,14 @@
1
1
  import { useColors, useTheme } from "../contexts/theme.mjs";
2
2
  import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
3
- import { For, Show, code } from "@alloy-js/core";
3
+ import { For, Show, code, computed } from "@alloy-js/core";
4
4
  import { ElseClause, FunctionDeclaration, IfStatement, InterfaceDeclaration, InterfaceMember, TypeDeclaration, VarDeclaration } from "@alloy-js/typescript";
5
+ import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
6
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
5
7
  import { TSDoc, TSDocDefaultValue, TSDocExample, TSDocParam, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
6
8
  import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
9
+ import { useCommand } from "@shell-shock/core/contexts/command";
7
10
  import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
11
+ import { getIndefiniteArticle } from "@stryke/string-format/vowels";
8
12
 
9
13
  //#region src/components/console-builtin.tsx
10
14
  /**
@@ -103,61 +107,216 @@ function ColorsDeclaration() {
103
107
  createIntrinsic("hbr", {}),
104
108
  code`text: {
105
109
  banner: {
106
- title: ${createComponent(ColorFunction, {
110
+ header: {
111
+ primary: ${createComponent(ColorFunction, {
107
112
  get ansi16() {
108
- return colors.ansi16.theme.text.banner.title;
113
+ return colors.ansi16.theme.text.banner.header.primary;
109
114
  },
110
115
  get ansi256() {
111
- return colors.ansi256.theme.text.banner.title;
116
+ return colors.ansi256.theme.text.banner.header.primary;
112
117
  },
113
118
  get ansi16m() {
114
- return colors.ansi16m.theme.text.banner.title;
119
+ return colors.ansi16m.theme.text.banner.header.primary;
115
120
  }
116
121
  })},
117
- header: ${createComponent(ColorFunction, {
122
+ secondary: ${createComponent(ColorFunction, {
118
123
  get ansi16() {
119
- return colors.ansi16.theme.text.banner.header;
124
+ return colors.ansi16.theme.text.banner.header.secondary;
120
125
  },
121
126
  get ansi256() {
122
- return colors.ansi256.theme.text.banner.header;
127
+ return colors.ansi256.theme.text.banner.header.secondary;
123
128
  },
124
129
  get ansi16m() {
125
- return colors.ansi16m.theme.text.banner.header;
130
+ return colors.ansi16m.theme.text.banner.header.secondary;
126
131
  }
127
132
  })},
128
- footer: ${createComponent(ColorFunction, {
133
+ tertiary: ${createComponent(ColorFunction, {
129
134
  get ansi16() {
130
- return colors.ansi16.theme.text.banner.footer;
135
+ return colors.ansi16.theme.text.banner.header.tertiary;
131
136
  },
132
137
  get ansi256() {
133
- return colors.ansi256.theme.text.banner.footer;
138
+ return colors.ansi256.theme.text.banner.header.tertiary;
134
139
  },
135
140
  get ansi16m() {
136
- return colors.ansi16m.theme.text.banner.footer;
141
+ return colors.ansi16m.theme.text.banner.header.tertiary;
142
+ }
143
+ })}
144
+ },
145
+ footer: {
146
+ primary: ${createComponent(ColorFunction, {
147
+ get ansi16() {
148
+ return colors.ansi16.theme.text.banner.footer.primary;
149
+ },
150
+ get ansi256() {
151
+ return colors.ansi256.theme.text.banner.footer.primary;
152
+ },
153
+ get ansi16m() {
154
+ return colors.ansi16m.theme.text.banner.footer.primary;
137
155
  }
138
156
  })},
139
- command: ${createComponent(ColorFunction, {
157
+ secondary: ${createComponent(ColorFunction, {
140
158
  get ansi16() {
141
- return colors.ansi16.theme.text.banner.command;
159
+ return colors.ansi16.theme.text.banner.footer.secondary;
142
160
  },
143
161
  get ansi256() {
144
- return colors.ansi256.theme.text.banner.command;
162
+ return colors.ansi256.theme.text.banner.footer.secondary;
145
163
  },
146
164
  get ansi16m() {
147
- return colors.ansi16m.theme.text.banner.command;
165
+ return colors.ansi16m.theme.text.banner.footer.secondary;
148
166
  }
149
167
  })},
150
- description: ${createComponent(ColorFunction, {
168
+ tertiary: ${createComponent(ColorFunction, {
151
169
  get ansi16() {
152
- return colors.ansi16.theme.text.banner.description;
170
+ return colors.ansi16.theme.text.banner.footer.tertiary;
153
171
  },
154
172
  get ansi256() {
155
- return colors.ansi256.theme.text.banner.description;
173
+ return colors.ansi256.theme.text.banner.footer.tertiary;
156
174
  },
157
175
  get ansi16m() {
158
- return colors.ansi16m.theme.text.banner.description;
176
+ return colors.ansi16m.theme.text.banner.footer.tertiary;
159
177
  }
160
178
  })}
179
+ },
180
+ command: {
181
+ primary: ${createComponent(ColorFunction, {
182
+ get ansi16() {
183
+ return colors.ansi16.theme.text.banner.command.primary;
184
+ },
185
+ get ansi256() {
186
+ return colors.ansi256.theme.text.banner.command.primary;
187
+ },
188
+ get ansi16m() {
189
+ return colors.ansi16m.theme.text.banner.command.primary;
190
+ }
191
+ })},
192
+ secondary: ${createComponent(ColorFunction, {
193
+ get ansi16() {
194
+ return colors.ansi16.theme.text.banner.command.secondary;
195
+ },
196
+ get ansi256() {
197
+ return colors.ansi256.theme.text.banner.command.secondary;
198
+ },
199
+ get ansi16m() {
200
+ return colors.ansi16m.theme.text.banner.command.secondary;
201
+ }
202
+ })},
203
+ tertiary: ${createComponent(ColorFunction, {
204
+ get ansi16() {
205
+ return colors.ansi16.theme.text.banner.command.tertiary;
206
+ },
207
+ get ansi256() {
208
+ return colors.ansi256.theme.text.banner.command.tertiary;
209
+ },
210
+ get ansi16m() {
211
+ return colors.ansi16m.theme.text.banner.command.tertiary;
212
+ }
213
+ })},
214
+ },
215
+ title: {
216
+ primary: ${createComponent(ColorFunction, {
217
+ get ansi16() {
218
+ return colors.ansi16.theme.text.banner.title.primary;
219
+ },
220
+ get ansi256() {
221
+ return colors.ansi256.theme.text.banner.title.primary;
222
+ },
223
+ get ansi16m() {
224
+ return colors.ansi16m.theme.text.banner.title.primary;
225
+ }
226
+ })},
227
+ secondary: ${createComponent(ColorFunction, {
228
+ get ansi16() {
229
+ return colors.ansi16.theme.text.banner.title.secondary;
230
+ },
231
+ get ansi256() {
232
+ return colors.ansi256.theme.text.banner.title.secondary;
233
+ },
234
+ get ansi16m() {
235
+ return colors.ansi16m.theme.text.banner.title.secondary;
236
+ }
237
+ })},
238
+ tertiary: ${createComponent(ColorFunction, {
239
+ get ansi16() {
240
+ return colors.ansi16.theme.text.banner.title.tertiary;
241
+ },
242
+ get ansi256() {
243
+ return colors.ansi256.theme.text.banner.title.tertiary;
244
+ },
245
+ get ansi16m() {
246
+ return colors.ansi16m.theme.text.banner.title.tertiary;
247
+ }
248
+ })},
249
+ },
250
+ link: {
251
+ primary: ${createComponent(ColorFunction, {
252
+ get ansi16() {
253
+ return colors.ansi16.theme.text.banner.link.primary;
254
+ },
255
+ get ansi256() {
256
+ return colors.ansi256.theme.text.banner.link.primary;
257
+ },
258
+ get ansi16m() {
259
+ return colors.ansi16m.theme.text.banner.link.primary;
260
+ }
261
+ })},
262
+ secondary: ${createComponent(ColorFunction, {
263
+ get ansi16() {
264
+ return colors.ansi16.theme.text.banner.link.secondary;
265
+ },
266
+ get ansi256() {
267
+ return colors.ansi256.theme.text.banner.link.secondary;
268
+ },
269
+ get ansi16m() {
270
+ return colors.ansi16m.theme.text.banner.link.secondary;
271
+ }
272
+ })},
273
+ tertiary: ${createComponent(ColorFunction, {
274
+ get ansi16() {
275
+ return colors.ansi16.theme.text.banner.link.tertiary;
276
+ },
277
+ get ansi256() {
278
+ return colors.ansi256.theme.text.banner.link.tertiary;
279
+ },
280
+ get ansi16m() {
281
+ return colors.ansi16m.theme.text.banner.link.tertiary;
282
+ }
283
+ })},
284
+ },
285
+ description: {
286
+ primary: ${createComponent(ColorFunction, {
287
+ get ansi16() {
288
+ return colors.ansi16.theme.text.banner.description.primary;
289
+ },
290
+ get ansi256() {
291
+ return colors.ansi256.theme.text.banner.description.primary;
292
+ },
293
+ get ansi16m() {
294
+ return colors.ansi16m.theme.text.banner.description.primary;
295
+ }
296
+ })},
297
+ secondary: ${createComponent(ColorFunction, {
298
+ get ansi16() {
299
+ return colors.ansi16.theme.text.banner.description.secondary;
300
+ },
301
+ get ansi256() {
302
+ return colors.ansi256.theme.text.banner.description.secondary;
303
+ },
304
+ get ansi16m() {
305
+ return colors.ansi16m.theme.text.banner.description.secondary;
306
+ }
307
+ })},
308
+ tertiary: ${createComponent(ColorFunction, {
309
+ get ansi16() {
310
+ return colors.ansi16.theme.text.banner.description.tertiary;
311
+ },
312
+ get ansi256() {
313
+ return colors.ansi256.theme.text.banner.description.tertiary;
314
+ },
315
+ get ansi16m() {
316
+ return colors.ansi16m.theme.text.banner.description.tertiary;
317
+ }
318
+ })},
319
+ }
161
320
  },
162
321
  heading: {
163
322
  primary: ${createComponent(ColorFunction, {
@@ -192,7 +351,7 @@ function ColorsDeclaration() {
192
351
  get ansi16m() {
193
352
  return colors.ansi16m.theme.text.heading.tertiary;
194
353
  }
195
- })}
354
+ })},
196
355
  },
197
356
  body: {
198
357
  primary: ${createComponent(ColorFunction, {
@@ -1114,17 +1273,11 @@ consoleFn(\`\${" ".repeat(Math.max(options.padding ?? ${theme.padding.app}, 0))}
1114
1273
  * A component to generate the message functions in the `shell-shock:console` builtin module.
1115
1274
  */
1116
1275
  function MessageFunctionDeclaration(props) {
1117
- const { type, variant, consoleFnName, description, prefix, parameters } = props;
1276
+ const { type, variant, consoleFnName, description, prefix, parameters, timestamp } = props;
1118
1277
  const theme = useTheme();
1119
1278
  return [createComponent(TSDoc, {
1120
1279
  get heading() {
1121
- return `Write ${[
1122
- "a",
1123
- "e",
1124
- "i",
1125
- "o",
1126
- "u"
1127
- ].includes(description.charAt(0)) ? "an" : "a"} ${description} message to the console.`;
1280
+ return `Write ${getIndefiniteArticle(description)} ${description} message to the console.`;
1128
1281
  },
1129
1282
  get children() {
1130
1283
  return [
@@ -1161,19 +1314,69 @@ function MessageFunctionDeclaration(props) {
1161
1314
  return;
1162
1315
  }
1163
1316
 
1164
- writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].topLeft}") + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.message, 0)) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0) / ${theme.borderStyles.message.outline[variant].top.length ?? 1})) + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
1317
+ ${!theme.labels.message.footer[variant] && timestamp ? `const timestamp = \`\${colors.text.message.footer.${variant}(new Date().toLocaleDateString())} \${colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}")} \${colors.text.message.footer.${variant}(new Date().toLocaleTimeString())}\`; ` : ""}
1318
+ writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].topLeft}") + ${theme.labels.message.header[variant] || theme.icons.message.header[variant] ? `colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].top}".repeat(4)) + " " + ${theme.icons.message.header[variant] ? `colors.border.message.outline.${variant}("${theme.icons.message.header[variant]}") + " " +` : ""} colors.text.message.header.${variant}("${theme.labels.message.header[variant]}") + " " + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + 4 + (theme.icons.message.header[variant] ? theme.icons.message.header[variant].length + 1 + (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].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))` : `colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))`} + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
1165
1319
  splitText(
1166
1320
  message,
1167
1321
  Math.max(process.stdout.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}, 0)
1168
1322
  ).forEach((line) => {
1169
- writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + line + colors.border.message.outline.${variant}("${" ".repeat(Math.max(theme.padding.message, 0)) + theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
1323
+ writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + colors.text.message.description.${variant}(line) + " ".repeat(Math.max(process.stdout.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)) + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
1170
1324
  });
1171
- writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottomLeft}") + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.message, 0)) * 2 + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}, 0) / ${theme.borderStyles.message.outline[variant].bottom.length ?? 1})) + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
1325
+ writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottomLeft}") + ${theme.labels.message.footer[variant] || timestamp ? `colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.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))) + " " + ${theme.labels.message.footer[variant] ? `colors.text.message.footer.${variant}("${theme.labels.message.footer[variant]}")` : timestamp && "timestamp"} + " " + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}".repeat(4))` : `colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}, 0)))`} + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
1172
1326
  `)];
1173
1327
  }
1174
1328
  })];
1175
1329
  }
1176
1330
  /**
1331
+ * A component to generate the `banner` function in the `shell-shock:console` builtin module.
1332
+ */
1333
+ function BannerFunctionDeclaration(props) {
1334
+ const { consoleFnName = "log", variant = "primary", title: titleProp } = props;
1335
+ const theme = useTheme();
1336
+ const context = usePowerlines();
1337
+ const command = useCommand();
1338
+ const header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || "1.0.0"}`);
1339
+ const description = computed(() => command?.description || getAppDescription(context));
1340
+ const footer = computed(() => theme.labels.banner.footer[variant]);
1341
+ const title = computed(() => titleProp || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
1342
+ const bannerPadding = computed(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
1343
+ const totalPadding = computed(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
1344
+ return [createComponent(FunctionDeclaration, {
1345
+ "export": true,
1346
+ name: "banner",
1347
+ doc: "Write the application banner to the console.",
1348
+ get children() {
1349
+ return code`
1350
+ if (hasFlag("no-banner") || hasFlag("hide-banner") || isCI || isMinimal) {
1351
+ return;
1352
+ }
1353
+
1354
+ writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topLeft}") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(4)) + " " + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}("${theme.icons.banner.header[variant]}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}") + " " +` : ""} colors.text.banner.header.${variant}("${header.value}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${4 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header.value ? header.value.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
1355
+
1356
+ splitText(
1357
+ colors.text.banner.title.${variant}("${title.value}"),
1358
+ Math.max(process.stdout.columns - ${totalPadding.value}, 0)
1359
+ ).forEach((line) => {
1360
+ writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
1361
+ });
1362
+
1363
+ ${command?.title ? `writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomLeft}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
1364
+
1365
+ writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.command.${variant}("${command.title}") + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); ` : ""}
1366
+
1367
+ splitText(
1368
+ ${command?.title ? "colors.text.banner.description" : "colors.text.banner.command"}.${variant}("${description.value.replace(/"/g, "\\\"")}"),
1369
+ Math.max(process.stdout.columns - ${totalPadding.value}, 0)
1370
+ ).forEach((line) => {
1371
+ writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
1372
+ });
1373
+
1374
+ writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomLeft}") + ${footer.value ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${6 + (footer.value ? footer.value.length : 0) + bannerPadding.value}, 0))) + " " + ${footer.value ? `colors.text.banner.footer.${variant}("${footer.value}")` : ""} + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(4))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
1375
+ `;
1376
+ }
1377
+ })];
1378
+ }
1379
+ /**
1177
1380
  * A component to generate the `wrapAnsi` function in the `shell-shock:console` builtin module.
1178
1381
  */
1179
1382
  function WrapAnsiFunction() {
@@ -1883,7 +2086,7 @@ do {
1883
2086
 
1884
2087
  const lines = splitText(
1885
2088
  cell.value,
1886
- Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2), 0)
2089
+ Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0)
1887
2090
  );
1888
2091
 
1889
2092
  cell.value = lines.join("\\n");
@@ -1952,6 +2155,7 @@ function ConsoleBuiltin() {
1952
2155
  builtinImports: {
1953
2156
  utils: [
1954
2157
  "hasFlag",
2158
+ "isMinimal",
1955
2159
  "isColorSupported",
1956
2160
  "colorSupportLevels",
1957
2161
  "isHyperlinkSupported"
@@ -1959,7 +2163,8 @@ function ConsoleBuiltin() {
1959
2163
  env: [
1960
2164
  "env",
1961
2165
  "isDevelopment",
1962
- "isDebug"
2166
+ "isDebug",
2167
+ "isCI"
1963
2168
  ]
1964
2169
  },
1965
2170
  get children() {
@@ -1982,6 +2187,9 @@ function ConsoleBuiltin() {
1982
2187
  createComponent(DividerFunctionDeclaration, {}),
1983
2188
  createIntrinsic("hbr", {}),
1984
2189
  createIntrinsic("hbr", {}),
2190
+ createComponent(BannerFunctionDeclaration, {}),
2191
+ createIntrinsic("hbr", {}),
2192
+ createIntrinsic("hbr", {}),
1985
2193
  createComponent(MessageFunctionDeclaration, {
1986
2194
  type: "help",
1987
2195
  variant: "help",
@@ -2011,6 +2219,7 @@ function ConsoleBuiltin() {
2011
2219
  variant: "debug",
2012
2220
  consoleFnName: "debug",
2013
2221
  description: "debug",
2222
+ timestamp: true,
2014
2223
  get prefix() {
2015
2224
  return createComponent(IfStatement, {
2016
2225
  condition: code`!isDevelopment && !isDebug && env.LOG_LEVEL !== "debug"`,
@@ -2025,6 +2234,7 @@ function ConsoleBuiltin() {
2025
2234
  variant: "debug",
2026
2235
  consoleFnName: "debug",
2027
2236
  description: "verbose",
2237
+ timestamp: true,
2028
2238
  get prefix() {
2029
2239
  return createComponent(IfStatement, {
2030
2240
  condition: code`!(isDevelopment || isDebug || env.LOG_LEVEL === "debug" || hasFlag(["verbose", "verbose=true", "verbose=always"]))`,
@@ -2055,6 +2265,7 @@ function ConsoleBuiltin() {
2055
2265
  variant: "error",
2056
2266
  consoleFnName: "error",
2057
2267
  description: "error",
2268
+ timestamp: true,
2058
2269
  parameters: [{
2059
2270
  name: "err",
2060
2271
  type: "string | Error",
@@ -2093,5 +2304,5 @@ function ConsoleBuiltin() {
2093
2304
  }
2094
2305
 
2095
2306
  //#endregion
2096
- export { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, StripAnsiFunctionDeclaration, TableFunctionDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
2307
+ export { BannerFunctionDeclaration, ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, StripAnsiFunctionDeclaration, TableFunctionDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
2097
2308
  //# sourceMappingURL=console-builtin.mjs.map