@shell-shock/preset-script 0.6.9 → 0.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/banner-function-declaration.cjs +3 -4
- package/dist/components/banner-function-declaration.cjs.map +1 -1
- package/dist/components/banner-function-declaration.mjs +1 -2
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/bin-entry.cjs +3 -1
- package/dist/components/bin-entry.cjs.map +1 -1
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts.map +1 -1
- package/dist/components/bin-entry.mjs +3 -1
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.cjs +1 -1
- package/dist/components/command-entry.mjs +1 -1
- package/dist/components/exit-function-declaration.cjs +161 -0
- package/dist/components/exit-function-declaration.cjs.map +1 -0
- package/dist/components/exit-function-declaration.d.cts +10 -0
- package/dist/components/exit-function-declaration.d.cts.map +1 -0
- package/dist/components/exit-function-declaration.d.mts +10 -0
- package/dist/components/exit-function-declaration.d.mts.map +1 -0
- package/dist/components/exit-function-declaration.mjs +160 -0
- package/dist/components/exit-function-declaration.mjs.map +1 -0
- package/dist/components/help.cjs +3 -4
- package/dist/components/help.cjs.map +1 -1
- package/dist/components/help.d.cts +7 -7
- package/dist/components/help.d.mts +7 -7
- package/dist/components/help.d.mts.map +1 -1
- package/dist/components/help.mjs +1 -2
- package/dist/components/help.mjs.map +1 -1
- package/dist/components/helpers.d.cts +5 -5
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +5 -5
- package/dist/components/index.cjs +3 -20
- package/dist/components/index.d.cts +2 -3
- package/dist/components/index.d.mts +2 -3
- package/dist/components/index.mjs +2 -3
- package/dist/index.cjs +3 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -8
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/package.json +18 -73
- package/dist/components/console-builtin.cjs +0 -2963
- package/dist/components/console-builtin.cjs.map +0 -1
- package/dist/components/console-builtin.d.cts +0 -60
- package/dist/components/console-builtin.d.cts.map +0 -1
- package/dist/components/console-builtin.d.mts +0 -60
- package/dist/components/console-builtin.d.mts.map +0 -1
- package/dist/components/console-builtin.mjs +0 -2953
- package/dist/components/console-builtin.mjs.map +0 -1
- package/dist/components/utils-builtin.cjs +0 -725
- package/dist/components/utils-builtin.cjs.map +0 -1
- package/dist/components/utils-builtin.d.cts +0 -33
- package/dist/components/utils-builtin.d.cts.map +0 -1
- package/dist/components/utils-builtin.d.mts +0 -33
- package/dist/components/utils-builtin.d.mts.map +0 -1
- package/dist/components/utils-builtin.mjs +0 -717
- package/dist/components/utils-builtin.mjs.map +0 -1
- package/dist/contexts/index.cjs +0 -4
- package/dist/contexts/index.d.cts +0 -2
- package/dist/contexts/index.d.mts +0 -2
- package/dist/contexts/index.mjs +0 -3
- package/dist/contexts/theme.cjs +0 -29
- package/dist/contexts/theme.cjs.map +0 -1
- package/dist/contexts/theme.d.cts +0 -20
- package/dist/contexts/theme.d.cts.map +0 -1
- package/dist/contexts/theme.d.mts +0 -20
- package/dist/contexts/theme.d.mts.map +0 -1
- package/dist/contexts/theme.mjs +0 -27
- package/dist/contexts/theme.mjs.map +0 -1
- package/dist/helpers/ansi-utils.cjs +0 -693
- package/dist/helpers/ansi-utils.cjs.map +0 -1
- package/dist/helpers/ansi-utils.d.cts +0 -75
- package/dist/helpers/ansi-utils.d.cts.map +0 -1
- package/dist/helpers/ansi-utils.d.mts +0 -75
- package/dist/helpers/ansi-utils.d.mts.map +0 -1
- package/dist/helpers/ansi-utils.mjs +0 -689
- package/dist/helpers/ansi-utils.mjs.map +0 -1
|
@@ -1,2953 +0,0 @@
|
|
|
1
|
-
import { useColors, useTheme } from "../contexts/theme.mjs";
|
|
2
|
-
import { IsNotDebug, IsNotVerbose } from "./helpers.mjs";
|
|
3
|
-
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { For, Show, code } from "@alloy-js/core";
|
|
5
|
-
import { ElseClause, ElseIfClause, FunctionDeclaration, IfStatement, InterfaceDeclaration, InterfaceMember, TypeDeclaration, VarDeclaration } from "@alloy-js/typescript";
|
|
6
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
|
-
import { TSDoc, TSDocDefaultValue, TSDocExample, TSDocParam, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
8
|
-
import { defu as defu$1 } from "defu";
|
|
9
|
-
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
10
|
-
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
11
|
-
import { getIndefiniteArticle } from "@stryke/string-format/vowels";
|
|
12
|
-
|
|
13
|
-
//#region src/components/console-builtin.tsx
|
|
14
|
-
function AnsiHelpersDeclarations() {
|
|
15
|
-
return [
|
|
16
|
-
createComponent(VarDeclaration, {
|
|
17
|
-
"const": true,
|
|
18
|
-
"export": true,
|
|
19
|
-
name: "beep",
|
|
20
|
-
doc: "The ASCII Bell character, which can be used to trigger a beep sound in the console.",
|
|
21
|
-
children: code` "\\u0007"; `
|
|
22
|
-
}),
|
|
23
|
-
createComponent(Spacing, {}),
|
|
24
|
-
createComponent(VarDeclaration, {
|
|
25
|
-
"const": true,
|
|
26
|
-
"export": true,
|
|
27
|
-
name: "cursor",
|
|
28
|
-
doc: "An object containing ANSI escape codes for controlling the console cursor.",
|
|
29
|
-
children: code` {
|
|
30
|
-
to(x, y) {
|
|
31
|
-
if (!y) {
|
|
32
|
-
return \`\\x1B[\${x + 1}G\`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return \`\\x1B[\${y + 1};\${x + 1}H\`;
|
|
36
|
-
},
|
|
37
|
-
move(x, y) {
|
|
38
|
-
let ret = '';
|
|
39
|
-
|
|
40
|
-
if (x < 0) {
|
|
41
|
-
ret += \`\\x1B[\${-x}D\`;
|
|
42
|
-
} else if (x > 0) {
|
|
43
|
-
ret += \`\\x1B[\${x}C\`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (y < 0) {
|
|
47
|
-
ret += \`\\x1B[\${-y}A\`;
|
|
48
|
-
} else if (y > 0) {
|
|
49
|
-
ret += \`\\x1B[\${y}B\`;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return ret;
|
|
53
|
-
},
|
|
54
|
-
up: (count = 1) => \`\\x1B[\${count}A\`,
|
|
55
|
-
down: (count = 1) => \`\\x1B[\${count}B\`,
|
|
56
|
-
forward: (count = 1) => \`\\x1B[\${count}C\`,
|
|
57
|
-
backward: (count = 1) => \`\\x1B[\${count}D\`,
|
|
58
|
-
nextLine: (count = 1) => "\\x1B[E".repeat(count),
|
|
59
|
-
prevLine: (count = 1) => "\\x1B[F".repeat(count),
|
|
60
|
-
left: "\\x1B[G",
|
|
61
|
-
hide: "\\x1B[?25l",
|
|
62
|
-
show: "\\x1B[?25h",
|
|
63
|
-
save: "\\x1B7",
|
|
64
|
-
restore: "\\x1B8"
|
|
65
|
-
} `
|
|
66
|
-
}),
|
|
67
|
-
createComponent(Spacing, {}),
|
|
68
|
-
createComponent(VarDeclaration, {
|
|
69
|
-
"const": true,
|
|
70
|
-
"export": true,
|
|
71
|
-
name: "erase",
|
|
72
|
-
doc: "An object containing ANSI escape codes for erasing parts of the console.",
|
|
73
|
-
children: code` {
|
|
74
|
-
screen: "\\x1B[2J",
|
|
75
|
-
up: (count = 1) => "\\x1B[1J".repeat(count),
|
|
76
|
-
down: (count = 1) => "\\x1B[J".repeat(count),
|
|
77
|
-
line: "\\x1B[2K",
|
|
78
|
-
lineEnd: "\\x1B[K",
|
|
79
|
-
lineStart: "\\x1B[1K",
|
|
80
|
-
lines(count) {
|
|
81
|
-
let lineClear = "";
|
|
82
|
-
for (let i = 0; i < count; i++) {
|
|
83
|
-
lineClear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (count) {
|
|
87
|
-
lineClear += cursor.left;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return lineClear;
|
|
91
|
-
}
|
|
92
|
-
} `
|
|
93
|
-
}),
|
|
94
|
-
createComponent(Spacing, {}),
|
|
95
|
-
createComponent(VarDeclaration, {
|
|
96
|
-
"const": true,
|
|
97
|
-
"export": true,
|
|
98
|
-
name: "scroll",
|
|
99
|
-
doc: "An object containing ANSI escape codes for scrolling the console.",
|
|
100
|
-
children: code` {
|
|
101
|
-
up: (count = 1) => "\\x1B[S".repeat(count),
|
|
102
|
-
down: (count = 1) => "\\x1B[T".repeat(count)
|
|
103
|
-
} `
|
|
104
|
-
}),
|
|
105
|
-
createComponent(Spacing, {}),
|
|
106
|
-
createComponent(FunctionDeclaration, {
|
|
107
|
-
"export": true,
|
|
108
|
-
name: "clear",
|
|
109
|
-
doc: "A helper function to clear the console based on a count of lines",
|
|
110
|
-
parameters: [{
|
|
111
|
-
name: "current",
|
|
112
|
-
type: "string",
|
|
113
|
-
doc: "The current console output to be cleared"
|
|
114
|
-
}, {
|
|
115
|
-
name: "consoleWidth",
|
|
116
|
-
type: "number",
|
|
117
|
-
doc: "The number of characters per line in the console"
|
|
118
|
-
}],
|
|
119
|
-
children: code`if (!consoleWidth) {
|
|
120
|
-
return erase.line + cursor.to(0);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
let rows = 0;
|
|
124
|
-
const lines = current.split(/\\r?\\n/);
|
|
125
|
-
for (let line of lines) {
|
|
126
|
-
rows += 1 + Math.floor(Math.max([...stripAnsi(line)].length - 1, 0) / consoleWidth);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return erase.lines(rows); `
|
|
130
|
-
}),
|
|
131
|
-
createComponent(Spacing, {})
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* A component to generate a console message function in a Shell Shock project.
|
|
136
|
-
*/
|
|
137
|
-
function ColorFunction({ ansi16, ansi256, ansi16m }) {
|
|
138
|
-
return code` (text: string) => {
|
|
139
|
-
try {
|
|
140
|
-
if (!isColorSupported) {
|
|
141
|
-
return String(text);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (colorSupportLevels.stdout === 1) {
|
|
145
|
-
return wrapAnsi(text, "${ansi16.open}", "${ansi16.close}");
|
|
146
|
-
} else if (colorSupportLevels.stdout === 2) {
|
|
147
|
-
return wrapAnsi(text, "${ansi256.open}", "${ansi256.close}");
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return wrapAnsi(text, "${ansi16m.open}", "${ansi16m.close}");
|
|
151
|
-
} catch {
|
|
152
|
-
return String(text);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
`;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* A component to generate an object containing functions for coloring text in a Shell Shock project.
|
|
159
|
-
*/
|
|
160
|
-
function ColorsDeclaration() {
|
|
161
|
-
const colors = useColors();
|
|
162
|
-
return [
|
|
163
|
-
createComponent(TypeDeclaration, {
|
|
164
|
-
"export": true,
|
|
165
|
-
name: "AnsiColor",
|
|
166
|
-
doc: "The available ANSI colors for console text.",
|
|
167
|
-
get children() {
|
|
168
|
-
return createComponent(For, {
|
|
169
|
-
get each() {
|
|
170
|
-
return Object.keys(colors.ansi16).filter((color) => color !== "theme");
|
|
171
|
-
},
|
|
172
|
-
children: (color, idx) => `${idx > 0 ? " | " : ""}"${color}"`
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}),
|
|
176
|
-
createComponent(Spacing, {}),
|
|
177
|
-
createIntrinsic("hbr", {}),
|
|
178
|
-
code`
|
|
179
|
-
/**
|
|
180
|
-
* A recursive type that defines theme colors for console text.
|
|
181
|
-
*
|
|
182
|
-
* @remarks
|
|
183
|
-
* This type allows for nested theme color definitions, enabling complex theming structures for console applications.
|
|
184
|
-
*/
|
|
185
|
-
export type ThemeColors<T> = T extends object ? { [K in keyof T]: ThemeColors<T[K]>; } : ((text: string) => string); `,
|
|
186
|
-
createComponent(Spacing, {}),
|
|
187
|
-
createComponent(TypeDeclaration, {
|
|
188
|
-
"export": true,
|
|
189
|
-
name: "Colors",
|
|
190
|
-
doc: "An object containing functions for coloring console applications. Each function corresponds to a terminal color. See {@link AnsiColor} for available colors.",
|
|
191
|
-
children: code`Record<AnsiColor, (text: string) => string> & ThemeColors<ThemeColorsResolvedConfig>`
|
|
192
|
-
}),
|
|
193
|
-
createComponent(Spacing, {}),
|
|
194
|
-
createComponent(TSDoc, { heading: "An object containing functions for coloring console applications. Each function corresponds to a terminal color. See {@link Colors} for available colors." }),
|
|
195
|
-
createComponent(VarDeclaration, {
|
|
196
|
-
"const": true,
|
|
197
|
-
"export": true,
|
|
198
|
-
name: "colors",
|
|
199
|
-
type: "Colors",
|
|
200
|
-
get initializer() {
|
|
201
|
-
return [
|
|
202
|
-
code` {
|
|
203
|
-
`,
|
|
204
|
-
createIntrinsic("hbr", {}),
|
|
205
|
-
createComponent(For, {
|
|
206
|
-
get each() {
|
|
207
|
-
return Object.keys(colors.ansi16).filter((color) => color !== "theme");
|
|
208
|
-
},
|
|
209
|
-
comma: true,
|
|
210
|
-
doubleHardline: true,
|
|
211
|
-
enderPunctuation: true,
|
|
212
|
-
children: (color) => [code`${color}: `, createComponent(ColorFunction, {
|
|
213
|
-
get ansi16() {
|
|
214
|
-
return colors.ansi16[color];
|
|
215
|
-
},
|
|
216
|
-
get ansi256() {
|
|
217
|
-
return colors.ansi256[color];
|
|
218
|
-
},
|
|
219
|
-
get ansi16m() {
|
|
220
|
-
return colors.ansi16m[color];
|
|
221
|
-
}
|
|
222
|
-
})]
|
|
223
|
-
}),
|
|
224
|
-
createIntrinsic("hbr", {}),
|
|
225
|
-
code`text: {
|
|
226
|
-
banner: {
|
|
227
|
-
header: {
|
|
228
|
-
primary: ${createComponent(ColorFunction, {
|
|
229
|
-
get ansi16() {
|
|
230
|
-
return colors.ansi16.theme.text.banner.header.primary;
|
|
231
|
-
},
|
|
232
|
-
get ansi256() {
|
|
233
|
-
return colors.ansi256.theme.text.banner.header.primary;
|
|
234
|
-
},
|
|
235
|
-
get ansi16m() {
|
|
236
|
-
return colors.ansi16m.theme.text.banner.header.primary;
|
|
237
|
-
}
|
|
238
|
-
})},
|
|
239
|
-
secondary: ${createComponent(ColorFunction, {
|
|
240
|
-
get ansi16() {
|
|
241
|
-
return colors.ansi16.theme.text.banner.header.secondary;
|
|
242
|
-
},
|
|
243
|
-
get ansi256() {
|
|
244
|
-
return colors.ansi256.theme.text.banner.header.secondary;
|
|
245
|
-
},
|
|
246
|
-
get ansi16m() {
|
|
247
|
-
return colors.ansi16m.theme.text.banner.header.secondary;
|
|
248
|
-
}
|
|
249
|
-
})},
|
|
250
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
251
|
-
get ansi16() {
|
|
252
|
-
return colors.ansi16.theme.text.banner.header.tertiary;
|
|
253
|
-
},
|
|
254
|
-
get ansi256() {
|
|
255
|
-
return colors.ansi256.theme.text.banner.header.tertiary;
|
|
256
|
-
},
|
|
257
|
-
get ansi16m() {
|
|
258
|
-
return colors.ansi16m.theme.text.banner.header.tertiary;
|
|
259
|
-
}
|
|
260
|
-
})}
|
|
261
|
-
},
|
|
262
|
-
footer: {
|
|
263
|
-
primary: ${createComponent(ColorFunction, {
|
|
264
|
-
get ansi16() {
|
|
265
|
-
return colors.ansi16.theme.text.banner.footer.primary;
|
|
266
|
-
},
|
|
267
|
-
get ansi256() {
|
|
268
|
-
return colors.ansi256.theme.text.banner.footer.primary;
|
|
269
|
-
},
|
|
270
|
-
get ansi16m() {
|
|
271
|
-
return colors.ansi16m.theme.text.banner.footer.primary;
|
|
272
|
-
}
|
|
273
|
-
})},
|
|
274
|
-
secondary: ${createComponent(ColorFunction, {
|
|
275
|
-
get ansi16() {
|
|
276
|
-
return colors.ansi16.theme.text.banner.footer.secondary;
|
|
277
|
-
},
|
|
278
|
-
get ansi256() {
|
|
279
|
-
return colors.ansi256.theme.text.banner.footer.secondary;
|
|
280
|
-
},
|
|
281
|
-
get ansi16m() {
|
|
282
|
-
return colors.ansi16m.theme.text.banner.footer.secondary;
|
|
283
|
-
}
|
|
284
|
-
})},
|
|
285
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
286
|
-
get ansi16() {
|
|
287
|
-
return colors.ansi16.theme.text.banner.footer.tertiary;
|
|
288
|
-
},
|
|
289
|
-
get ansi256() {
|
|
290
|
-
return colors.ansi256.theme.text.banner.footer.tertiary;
|
|
291
|
-
},
|
|
292
|
-
get ansi16m() {
|
|
293
|
-
return colors.ansi16m.theme.text.banner.footer.tertiary;
|
|
294
|
-
}
|
|
295
|
-
})}
|
|
296
|
-
},
|
|
297
|
-
command: {
|
|
298
|
-
primary: ${createComponent(ColorFunction, {
|
|
299
|
-
get ansi16() {
|
|
300
|
-
return colors.ansi16.theme.text.banner.command.primary;
|
|
301
|
-
},
|
|
302
|
-
get ansi256() {
|
|
303
|
-
return colors.ansi256.theme.text.banner.command.primary;
|
|
304
|
-
},
|
|
305
|
-
get ansi16m() {
|
|
306
|
-
return colors.ansi16m.theme.text.banner.command.primary;
|
|
307
|
-
}
|
|
308
|
-
})},
|
|
309
|
-
secondary: ${createComponent(ColorFunction, {
|
|
310
|
-
get ansi16() {
|
|
311
|
-
return colors.ansi16.theme.text.banner.command.secondary;
|
|
312
|
-
},
|
|
313
|
-
get ansi256() {
|
|
314
|
-
return colors.ansi256.theme.text.banner.command.secondary;
|
|
315
|
-
},
|
|
316
|
-
get ansi16m() {
|
|
317
|
-
return colors.ansi16m.theme.text.banner.command.secondary;
|
|
318
|
-
}
|
|
319
|
-
})},
|
|
320
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
321
|
-
get ansi16() {
|
|
322
|
-
return colors.ansi16.theme.text.banner.command.tertiary;
|
|
323
|
-
},
|
|
324
|
-
get ansi256() {
|
|
325
|
-
return colors.ansi256.theme.text.banner.command.tertiary;
|
|
326
|
-
},
|
|
327
|
-
get ansi16m() {
|
|
328
|
-
return colors.ansi16m.theme.text.banner.command.tertiary;
|
|
329
|
-
}
|
|
330
|
-
})},
|
|
331
|
-
},
|
|
332
|
-
title: {
|
|
333
|
-
primary: ${createComponent(ColorFunction, {
|
|
334
|
-
get ansi16() {
|
|
335
|
-
return colors.ansi16.theme.text.banner.title.primary;
|
|
336
|
-
},
|
|
337
|
-
get ansi256() {
|
|
338
|
-
return colors.ansi256.theme.text.banner.title.primary;
|
|
339
|
-
},
|
|
340
|
-
get ansi16m() {
|
|
341
|
-
return colors.ansi16m.theme.text.banner.title.primary;
|
|
342
|
-
}
|
|
343
|
-
})},
|
|
344
|
-
secondary: ${createComponent(ColorFunction, {
|
|
345
|
-
get ansi16() {
|
|
346
|
-
return colors.ansi16.theme.text.banner.title.secondary;
|
|
347
|
-
},
|
|
348
|
-
get ansi256() {
|
|
349
|
-
return colors.ansi256.theme.text.banner.title.secondary;
|
|
350
|
-
},
|
|
351
|
-
get ansi16m() {
|
|
352
|
-
return colors.ansi16m.theme.text.banner.title.secondary;
|
|
353
|
-
}
|
|
354
|
-
})},
|
|
355
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
356
|
-
get ansi16() {
|
|
357
|
-
return colors.ansi16.theme.text.banner.title.tertiary;
|
|
358
|
-
},
|
|
359
|
-
get ansi256() {
|
|
360
|
-
return colors.ansi256.theme.text.banner.title.tertiary;
|
|
361
|
-
},
|
|
362
|
-
get ansi16m() {
|
|
363
|
-
return colors.ansi16m.theme.text.banner.title.tertiary;
|
|
364
|
-
}
|
|
365
|
-
})},
|
|
366
|
-
},
|
|
367
|
-
link: {
|
|
368
|
-
primary: ${createComponent(ColorFunction, {
|
|
369
|
-
get ansi16() {
|
|
370
|
-
return colors.ansi16.theme.text.banner.link.primary;
|
|
371
|
-
},
|
|
372
|
-
get ansi256() {
|
|
373
|
-
return colors.ansi256.theme.text.banner.link.primary;
|
|
374
|
-
},
|
|
375
|
-
get ansi16m() {
|
|
376
|
-
return colors.ansi16m.theme.text.banner.link.primary;
|
|
377
|
-
}
|
|
378
|
-
})},
|
|
379
|
-
secondary: ${createComponent(ColorFunction, {
|
|
380
|
-
get ansi16() {
|
|
381
|
-
return colors.ansi16.theme.text.banner.link.secondary;
|
|
382
|
-
},
|
|
383
|
-
get ansi256() {
|
|
384
|
-
return colors.ansi256.theme.text.banner.link.secondary;
|
|
385
|
-
},
|
|
386
|
-
get ansi16m() {
|
|
387
|
-
return colors.ansi16m.theme.text.banner.link.secondary;
|
|
388
|
-
}
|
|
389
|
-
})},
|
|
390
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
391
|
-
get ansi16() {
|
|
392
|
-
return colors.ansi16.theme.text.banner.link.tertiary;
|
|
393
|
-
},
|
|
394
|
-
get ansi256() {
|
|
395
|
-
return colors.ansi256.theme.text.banner.link.tertiary;
|
|
396
|
-
},
|
|
397
|
-
get ansi16m() {
|
|
398
|
-
return colors.ansi16m.theme.text.banner.link.tertiary;
|
|
399
|
-
}
|
|
400
|
-
})},
|
|
401
|
-
},
|
|
402
|
-
description: {
|
|
403
|
-
primary: ${createComponent(ColorFunction, {
|
|
404
|
-
get ansi16() {
|
|
405
|
-
return colors.ansi16.theme.text.banner.description.primary;
|
|
406
|
-
},
|
|
407
|
-
get ansi256() {
|
|
408
|
-
return colors.ansi256.theme.text.banner.description.primary;
|
|
409
|
-
},
|
|
410
|
-
get ansi16m() {
|
|
411
|
-
return colors.ansi16m.theme.text.banner.description.primary;
|
|
412
|
-
}
|
|
413
|
-
})},
|
|
414
|
-
secondary: ${createComponent(ColorFunction, {
|
|
415
|
-
get ansi16() {
|
|
416
|
-
return colors.ansi16.theme.text.banner.description.secondary;
|
|
417
|
-
},
|
|
418
|
-
get ansi256() {
|
|
419
|
-
return colors.ansi256.theme.text.banner.description.secondary;
|
|
420
|
-
},
|
|
421
|
-
get ansi16m() {
|
|
422
|
-
return colors.ansi16m.theme.text.banner.description.secondary;
|
|
423
|
-
}
|
|
424
|
-
})},
|
|
425
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
426
|
-
get ansi16() {
|
|
427
|
-
return colors.ansi16.theme.text.banner.description.tertiary;
|
|
428
|
-
},
|
|
429
|
-
get ansi256() {
|
|
430
|
-
return colors.ansi256.theme.text.banner.description.tertiary;
|
|
431
|
-
},
|
|
432
|
-
get ansi16m() {
|
|
433
|
-
return colors.ansi16m.theme.text.banner.description.tertiary;
|
|
434
|
-
}
|
|
435
|
-
})},
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
heading: {
|
|
439
|
-
primary: ${createComponent(ColorFunction, {
|
|
440
|
-
get ansi16() {
|
|
441
|
-
return colors.ansi16.theme.text.heading.primary;
|
|
442
|
-
},
|
|
443
|
-
get ansi256() {
|
|
444
|
-
return colors.ansi256.theme.text.heading.primary;
|
|
445
|
-
},
|
|
446
|
-
get ansi16m() {
|
|
447
|
-
return colors.ansi16m.theme.text.heading.primary;
|
|
448
|
-
}
|
|
449
|
-
})},
|
|
450
|
-
secondary: ${createComponent(ColorFunction, {
|
|
451
|
-
get ansi16() {
|
|
452
|
-
return colors.ansi16.theme.text.heading.secondary;
|
|
453
|
-
},
|
|
454
|
-
get ansi256() {
|
|
455
|
-
return colors.ansi256.theme.text.heading.secondary;
|
|
456
|
-
},
|
|
457
|
-
get ansi16m() {
|
|
458
|
-
return colors.ansi16m.theme.text.heading.secondary;
|
|
459
|
-
}
|
|
460
|
-
})},
|
|
461
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
462
|
-
get ansi16() {
|
|
463
|
-
return colors.ansi16.theme.text.heading.tertiary;
|
|
464
|
-
},
|
|
465
|
-
get ansi256() {
|
|
466
|
-
return colors.ansi256.theme.text.heading.tertiary;
|
|
467
|
-
},
|
|
468
|
-
get ansi16m() {
|
|
469
|
-
return colors.ansi16m.theme.text.heading.tertiary;
|
|
470
|
-
}
|
|
471
|
-
})},
|
|
472
|
-
},
|
|
473
|
-
body: {
|
|
474
|
-
primary: ${createComponent(ColorFunction, {
|
|
475
|
-
get ansi16() {
|
|
476
|
-
return colors.ansi16.theme.text.body.primary;
|
|
477
|
-
},
|
|
478
|
-
get ansi256() {
|
|
479
|
-
return colors.ansi256.theme.text.body.primary;
|
|
480
|
-
},
|
|
481
|
-
get ansi16m() {
|
|
482
|
-
return colors.ansi16m.theme.text.body.primary;
|
|
483
|
-
}
|
|
484
|
-
})},
|
|
485
|
-
secondary: ${createComponent(ColorFunction, {
|
|
486
|
-
get ansi16() {
|
|
487
|
-
return colors.ansi16.theme.text.body.secondary;
|
|
488
|
-
},
|
|
489
|
-
get ansi256() {
|
|
490
|
-
return colors.ansi256.theme.text.body.secondary;
|
|
491
|
-
},
|
|
492
|
-
get ansi16m() {
|
|
493
|
-
return colors.ansi16m.theme.text.body.secondary;
|
|
494
|
-
}
|
|
495
|
-
})},
|
|
496
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
497
|
-
get ansi16() {
|
|
498
|
-
return colors.ansi16.theme.text.body.tertiary;
|
|
499
|
-
},
|
|
500
|
-
get ansi256() {
|
|
501
|
-
return colors.ansi256.theme.text.body.tertiary;
|
|
502
|
-
},
|
|
503
|
-
get ansi16m() {
|
|
504
|
-
return colors.ansi16m.theme.text.body.tertiary;
|
|
505
|
-
}
|
|
506
|
-
})},
|
|
507
|
-
link: ${createComponent(ColorFunction, {
|
|
508
|
-
get ansi16() {
|
|
509
|
-
return colors.ansi16.theme.text.body.link;
|
|
510
|
-
},
|
|
511
|
-
get ansi256() {
|
|
512
|
-
return colors.ansi256.theme.text.body.link;
|
|
513
|
-
},
|
|
514
|
-
get ansi16m() {
|
|
515
|
-
return colors.ansi16m.theme.text.body.link;
|
|
516
|
-
}
|
|
517
|
-
})}
|
|
518
|
-
},
|
|
519
|
-
message: {
|
|
520
|
-
link: {
|
|
521
|
-
help: ${createComponent(ColorFunction, {
|
|
522
|
-
get ansi16() {
|
|
523
|
-
return colors.ansi16.theme.text.message.link.help;
|
|
524
|
-
},
|
|
525
|
-
get ansi256() {
|
|
526
|
-
return colors.ansi256.theme.text.message.link.help;
|
|
527
|
-
},
|
|
528
|
-
get ansi16m() {
|
|
529
|
-
return colors.ansi16m.theme.text.message.link.help;
|
|
530
|
-
}
|
|
531
|
-
})},
|
|
532
|
-
success: ${createComponent(ColorFunction, {
|
|
533
|
-
get ansi16() {
|
|
534
|
-
return colors.ansi16.theme.text.message.link.success;
|
|
535
|
-
},
|
|
536
|
-
get ansi256() {
|
|
537
|
-
return colors.ansi256.theme.text.message.link.success;
|
|
538
|
-
},
|
|
539
|
-
get ansi16m() {
|
|
540
|
-
return colors.ansi16m.theme.text.message.link.success;
|
|
541
|
-
}
|
|
542
|
-
})},
|
|
543
|
-
info: ${createComponent(ColorFunction, {
|
|
544
|
-
get ansi16() {
|
|
545
|
-
return colors.ansi16.theme.text.message.link.info;
|
|
546
|
-
},
|
|
547
|
-
get ansi256() {
|
|
548
|
-
return colors.ansi256.theme.text.message.link.info;
|
|
549
|
-
},
|
|
550
|
-
get ansi16m() {
|
|
551
|
-
return colors.ansi16m.theme.text.message.link.info;
|
|
552
|
-
}
|
|
553
|
-
})},
|
|
554
|
-
debug: ${createComponent(ColorFunction, {
|
|
555
|
-
get ansi16() {
|
|
556
|
-
return colors.ansi16.theme.text.message.link.debug;
|
|
557
|
-
},
|
|
558
|
-
get ansi256() {
|
|
559
|
-
return colors.ansi256.theme.text.message.link.debug;
|
|
560
|
-
},
|
|
561
|
-
get ansi16m() {
|
|
562
|
-
return colors.ansi16m.theme.text.message.link.debug;
|
|
563
|
-
}
|
|
564
|
-
})},
|
|
565
|
-
warning: ${createComponent(ColorFunction, {
|
|
566
|
-
get ansi16() {
|
|
567
|
-
return colors.ansi16.theme.text.message.link.warning;
|
|
568
|
-
},
|
|
569
|
-
get ansi256() {
|
|
570
|
-
return colors.ansi256.theme.text.message.link.warning;
|
|
571
|
-
},
|
|
572
|
-
get ansi16m() {
|
|
573
|
-
return colors.ansi16m.theme.text.message.link.warning;
|
|
574
|
-
}
|
|
575
|
-
})},
|
|
576
|
-
danger: ${createComponent(ColorFunction, {
|
|
577
|
-
get ansi16() {
|
|
578
|
-
return colors.ansi16.theme.text.message.link.danger;
|
|
579
|
-
},
|
|
580
|
-
get ansi256() {
|
|
581
|
-
return colors.ansi256.theme.text.message.link.danger;
|
|
582
|
-
},
|
|
583
|
-
get ansi16m() {
|
|
584
|
-
return colors.ansi16m.theme.text.message.link.danger;
|
|
585
|
-
}
|
|
586
|
-
})},
|
|
587
|
-
error: ${createComponent(ColorFunction, {
|
|
588
|
-
get ansi16() {
|
|
589
|
-
return colors.ansi16.theme.text.message.link.error;
|
|
590
|
-
},
|
|
591
|
-
get ansi256() {
|
|
592
|
-
return colors.ansi256.theme.text.message.link.error;
|
|
593
|
-
},
|
|
594
|
-
get ansi16m() {
|
|
595
|
-
return colors.ansi16m.theme.text.message.link.error;
|
|
596
|
-
}
|
|
597
|
-
})}
|
|
598
|
-
},
|
|
599
|
-
header: {
|
|
600
|
-
help: ${createComponent(ColorFunction, {
|
|
601
|
-
get ansi16() {
|
|
602
|
-
return colors.ansi16.theme.text.message.header.help;
|
|
603
|
-
},
|
|
604
|
-
get ansi256() {
|
|
605
|
-
return colors.ansi256.theme.text.message.header.help;
|
|
606
|
-
},
|
|
607
|
-
get ansi16m() {
|
|
608
|
-
return colors.ansi16m.theme.text.message.header.help;
|
|
609
|
-
}
|
|
610
|
-
})},
|
|
611
|
-
success: ${createComponent(ColorFunction, {
|
|
612
|
-
get ansi16() {
|
|
613
|
-
return colors.ansi16.theme.text.message.header.success;
|
|
614
|
-
},
|
|
615
|
-
get ansi256() {
|
|
616
|
-
return colors.ansi256.theme.text.message.header.success;
|
|
617
|
-
},
|
|
618
|
-
get ansi16m() {
|
|
619
|
-
return colors.ansi16m.theme.text.message.header.success;
|
|
620
|
-
}
|
|
621
|
-
})},
|
|
622
|
-
info: ${createComponent(ColorFunction, {
|
|
623
|
-
get ansi16() {
|
|
624
|
-
return colors.ansi16.theme.text.message.header.info;
|
|
625
|
-
},
|
|
626
|
-
get ansi256() {
|
|
627
|
-
return colors.ansi256.theme.text.message.header.info;
|
|
628
|
-
},
|
|
629
|
-
get ansi16m() {
|
|
630
|
-
return colors.ansi16m.theme.text.message.header.info;
|
|
631
|
-
}
|
|
632
|
-
})},
|
|
633
|
-
debug: ${createComponent(ColorFunction, {
|
|
634
|
-
get ansi16() {
|
|
635
|
-
return colors.ansi16.theme.text.message.header.debug;
|
|
636
|
-
},
|
|
637
|
-
get ansi256() {
|
|
638
|
-
return colors.ansi256.theme.text.message.header.debug;
|
|
639
|
-
},
|
|
640
|
-
get ansi16m() {
|
|
641
|
-
return colors.ansi16m.theme.text.message.header.debug;
|
|
642
|
-
}
|
|
643
|
-
})},
|
|
644
|
-
warning: ${createComponent(ColorFunction, {
|
|
645
|
-
get ansi16() {
|
|
646
|
-
return colors.ansi16.theme.text.message.header.warning;
|
|
647
|
-
},
|
|
648
|
-
get ansi256() {
|
|
649
|
-
return colors.ansi256.theme.text.message.header.warning;
|
|
650
|
-
},
|
|
651
|
-
get ansi16m() {
|
|
652
|
-
return colors.ansi16m.theme.text.message.header.warning;
|
|
653
|
-
}
|
|
654
|
-
})},
|
|
655
|
-
danger: ${createComponent(ColorFunction, {
|
|
656
|
-
get ansi16() {
|
|
657
|
-
return colors.ansi16.theme.text.message.header.danger;
|
|
658
|
-
},
|
|
659
|
-
get ansi256() {
|
|
660
|
-
return colors.ansi256.theme.text.message.header.danger;
|
|
661
|
-
},
|
|
662
|
-
get ansi16m() {
|
|
663
|
-
return colors.ansi16m.theme.text.message.header.danger;
|
|
664
|
-
}
|
|
665
|
-
})},
|
|
666
|
-
error: ${createComponent(ColorFunction, {
|
|
667
|
-
get ansi16() {
|
|
668
|
-
return colors.ansi16.theme.text.message.header.error;
|
|
669
|
-
},
|
|
670
|
-
get ansi256() {
|
|
671
|
-
return colors.ansi256.theme.text.message.header.error;
|
|
672
|
-
},
|
|
673
|
-
get ansi16m() {
|
|
674
|
-
return colors.ansi16m.theme.text.message.header.error;
|
|
675
|
-
}
|
|
676
|
-
})}
|
|
677
|
-
},
|
|
678
|
-
footer: {
|
|
679
|
-
help: ${createComponent(ColorFunction, {
|
|
680
|
-
get ansi16() {
|
|
681
|
-
return colors.ansi16.theme.text.message.footer.help;
|
|
682
|
-
},
|
|
683
|
-
get ansi256() {
|
|
684
|
-
return colors.ansi256.theme.text.message.footer.help;
|
|
685
|
-
},
|
|
686
|
-
get ansi16m() {
|
|
687
|
-
return colors.ansi16m.theme.text.message.footer.help;
|
|
688
|
-
}
|
|
689
|
-
})},
|
|
690
|
-
success: ${createComponent(ColorFunction, {
|
|
691
|
-
get ansi16() {
|
|
692
|
-
return colors.ansi16.theme.text.message.footer.success;
|
|
693
|
-
},
|
|
694
|
-
get ansi256() {
|
|
695
|
-
return colors.ansi256.theme.text.message.footer.success;
|
|
696
|
-
},
|
|
697
|
-
get ansi16m() {
|
|
698
|
-
return colors.ansi16m.theme.text.message.footer.success;
|
|
699
|
-
}
|
|
700
|
-
})},
|
|
701
|
-
info: ${createComponent(ColorFunction, {
|
|
702
|
-
get ansi16() {
|
|
703
|
-
return colors.ansi16.theme.text.message.footer.info;
|
|
704
|
-
},
|
|
705
|
-
get ansi256() {
|
|
706
|
-
return colors.ansi256.theme.text.message.footer.info;
|
|
707
|
-
},
|
|
708
|
-
get ansi16m() {
|
|
709
|
-
return colors.ansi16m.theme.text.message.footer.info;
|
|
710
|
-
}
|
|
711
|
-
})},
|
|
712
|
-
debug: ${createComponent(ColorFunction, {
|
|
713
|
-
get ansi16() {
|
|
714
|
-
return colors.ansi16.theme.text.message.footer.debug;
|
|
715
|
-
},
|
|
716
|
-
get ansi256() {
|
|
717
|
-
return colors.ansi256.theme.text.message.footer.debug;
|
|
718
|
-
},
|
|
719
|
-
get ansi16m() {
|
|
720
|
-
return colors.ansi16m.theme.text.message.footer.debug;
|
|
721
|
-
}
|
|
722
|
-
})},
|
|
723
|
-
warning: ${createComponent(ColorFunction, {
|
|
724
|
-
get ansi16() {
|
|
725
|
-
return colors.ansi16.theme.text.message.footer.warning;
|
|
726
|
-
},
|
|
727
|
-
get ansi256() {
|
|
728
|
-
return colors.ansi256.theme.text.message.footer.warning;
|
|
729
|
-
},
|
|
730
|
-
get ansi16m() {
|
|
731
|
-
return colors.ansi16m.theme.text.message.footer.warning;
|
|
732
|
-
}
|
|
733
|
-
})},
|
|
734
|
-
danger: ${createComponent(ColorFunction, {
|
|
735
|
-
get ansi16() {
|
|
736
|
-
return colors.ansi16.theme.text.message.footer.danger;
|
|
737
|
-
},
|
|
738
|
-
get ansi256() {
|
|
739
|
-
return colors.ansi256.theme.text.message.footer.danger;
|
|
740
|
-
},
|
|
741
|
-
get ansi16m() {
|
|
742
|
-
return colors.ansi16m.theme.text.message.footer.danger;
|
|
743
|
-
}
|
|
744
|
-
})},
|
|
745
|
-
error: ${createComponent(ColorFunction, {
|
|
746
|
-
get ansi16() {
|
|
747
|
-
return colors.ansi16.theme.text.message.footer.error;
|
|
748
|
-
},
|
|
749
|
-
get ansi256() {
|
|
750
|
-
return colors.ansi256.theme.text.message.footer.error;
|
|
751
|
-
},
|
|
752
|
-
get ansi16m() {
|
|
753
|
-
return colors.ansi16m.theme.text.message.footer.error;
|
|
754
|
-
}
|
|
755
|
-
})}
|
|
756
|
-
},
|
|
757
|
-
description: {
|
|
758
|
-
help: ${createComponent(ColorFunction, {
|
|
759
|
-
get ansi16() {
|
|
760
|
-
return colors.ansi16.theme.text.message.description.help;
|
|
761
|
-
},
|
|
762
|
-
get ansi256() {
|
|
763
|
-
return colors.ansi256.theme.text.message.description.help;
|
|
764
|
-
},
|
|
765
|
-
get ansi16m() {
|
|
766
|
-
return colors.ansi16m.theme.text.message.description.help;
|
|
767
|
-
}
|
|
768
|
-
})},
|
|
769
|
-
success: ${createComponent(ColorFunction, {
|
|
770
|
-
get ansi16() {
|
|
771
|
-
return colors.ansi16.theme.text.message.description.success;
|
|
772
|
-
},
|
|
773
|
-
get ansi256() {
|
|
774
|
-
return colors.ansi256.theme.text.message.description.success;
|
|
775
|
-
},
|
|
776
|
-
get ansi16m() {
|
|
777
|
-
return colors.ansi16m.theme.text.message.description.success;
|
|
778
|
-
}
|
|
779
|
-
})},
|
|
780
|
-
info: ${createComponent(ColorFunction, {
|
|
781
|
-
get ansi16() {
|
|
782
|
-
return colors.ansi16.theme.text.message.description.info;
|
|
783
|
-
},
|
|
784
|
-
get ansi256() {
|
|
785
|
-
return colors.ansi256.theme.text.message.description.info;
|
|
786
|
-
},
|
|
787
|
-
get ansi16m() {
|
|
788
|
-
return colors.ansi16m.theme.text.message.description.info;
|
|
789
|
-
}
|
|
790
|
-
})},
|
|
791
|
-
debug: ${createComponent(ColorFunction, {
|
|
792
|
-
get ansi16() {
|
|
793
|
-
return colors.ansi16.theme.text.message.description.debug;
|
|
794
|
-
},
|
|
795
|
-
get ansi256() {
|
|
796
|
-
return colors.ansi256.theme.text.message.description.debug;
|
|
797
|
-
},
|
|
798
|
-
get ansi16m() {
|
|
799
|
-
return colors.ansi16m.theme.text.message.description.debug;
|
|
800
|
-
}
|
|
801
|
-
})},
|
|
802
|
-
warning: ${createComponent(ColorFunction, {
|
|
803
|
-
get ansi16() {
|
|
804
|
-
return colors.ansi16.theme.text.message.description.warning;
|
|
805
|
-
},
|
|
806
|
-
get ansi256() {
|
|
807
|
-
return colors.ansi256.theme.text.message.description.warning;
|
|
808
|
-
},
|
|
809
|
-
get ansi16m() {
|
|
810
|
-
return colors.ansi16m.theme.text.message.description.warning;
|
|
811
|
-
}
|
|
812
|
-
})},
|
|
813
|
-
danger: ${createComponent(ColorFunction, {
|
|
814
|
-
get ansi16() {
|
|
815
|
-
return colors.ansi16.theme.text.message.description.danger;
|
|
816
|
-
},
|
|
817
|
-
get ansi256() {
|
|
818
|
-
return colors.ansi256.theme.text.message.description.danger;
|
|
819
|
-
},
|
|
820
|
-
get ansi16m() {
|
|
821
|
-
return colors.ansi16m.theme.text.message.description.danger;
|
|
822
|
-
}
|
|
823
|
-
})},
|
|
824
|
-
error: ${createComponent(ColorFunction, {
|
|
825
|
-
get ansi16() {
|
|
826
|
-
return colors.ansi16.theme.text.message.description.error;
|
|
827
|
-
},
|
|
828
|
-
get ansi256() {
|
|
829
|
-
return colors.ansi256.theme.text.message.description.error;
|
|
830
|
-
},
|
|
831
|
-
get ansi16m() {
|
|
832
|
-
return colors.ansi16m.theme.text.message.description.error;
|
|
833
|
-
}
|
|
834
|
-
})}
|
|
835
|
-
}
|
|
836
|
-
},
|
|
837
|
-
usage: {
|
|
838
|
-
bin: ${createComponent(ColorFunction, {
|
|
839
|
-
get ansi16() {
|
|
840
|
-
return colors.ansi16.theme.text.usage.bin;
|
|
841
|
-
},
|
|
842
|
-
get ansi256() {
|
|
843
|
-
return colors.ansi256.theme.text.usage.bin;
|
|
844
|
-
},
|
|
845
|
-
get ansi16m() {
|
|
846
|
-
return colors.ansi16m.theme.text.usage.bin;
|
|
847
|
-
}
|
|
848
|
-
})},
|
|
849
|
-
command: ${createComponent(ColorFunction, {
|
|
850
|
-
get ansi16() {
|
|
851
|
-
return colors.ansi16.theme.text.usage.command;
|
|
852
|
-
},
|
|
853
|
-
get ansi256() {
|
|
854
|
-
return colors.ansi256.theme.text.usage.command;
|
|
855
|
-
},
|
|
856
|
-
get ansi16m() {
|
|
857
|
-
return colors.ansi16m.theme.text.usage.command;
|
|
858
|
-
}
|
|
859
|
-
})},
|
|
860
|
-
dynamic: ${createComponent(ColorFunction, {
|
|
861
|
-
get ansi16() {
|
|
862
|
-
return colors.ansi16.theme.text.usage.dynamic;
|
|
863
|
-
},
|
|
864
|
-
get ansi256() {
|
|
865
|
-
return colors.ansi256.theme.text.usage.dynamic;
|
|
866
|
-
},
|
|
867
|
-
get ansi16m() {
|
|
868
|
-
return colors.ansi16m.theme.text.usage.dynamic;
|
|
869
|
-
}
|
|
870
|
-
})},
|
|
871
|
-
options: ${createComponent(ColorFunction, {
|
|
872
|
-
get ansi16() {
|
|
873
|
-
return colors.ansi16.theme.text.usage.options;
|
|
874
|
-
},
|
|
875
|
-
get ansi256() {
|
|
876
|
-
return colors.ansi256.theme.text.usage.options;
|
|
877
|
-
},
|
|
878
|
-
get ansi16m() {
|
|
879
|
-
return colors.ansi16m.theme.text.usage.options;
|
|
880
|
-
}
|
|
881
|
-
})},
|
|
882
|
-
arguments: ${createComponent(ColorFunction, {
|
|
883
|
-
get ansi16() {
|
|
884
|
-
return colors.ansi16.theme.text.usage.arguments;
|
|
885
|
-
},
|
|
886
|
-
get ansi256() {
|
|
887
|
-
return colors.ansi256.theme.text.usage.arguments;
|
|
888
|
-
},
|
|
889
|
-
get ansi16m() {
|
|
890
|
-
return colors.ansi16m.theme.text.usage.arguments;
|
|
891
|
-
}
|
|
892
|
-
})},
|
|
893
|
-
description: ${createComponent(ColorFunction, {
|
|
894
|
-
get ansi16() {
|
|
895
|
-
return colors.ansi16.theme.text.usage.description;
|
|
896
|
-
},
|
|
897
|
-
get ansi256() {
|
|
898
|
-
return colors.ansi256.theme.text.usage.description;
|
|
899
|
-
},
|
|
900
|
-
get ansi16m() {
|
|
901
|
-
return colors.ansi16m.theme.text.usage.description;
|
|
902
|
-
}
|
|
903
|
-
})}
|
|
904
|
-
},
|
|
905
|
-
prompt: {
|
|
906
|
-
icon: {
|
|
907
|
-
active: ${createComponent(ColorFunction, {
|
|
908
|
-
get ansi16() {
|
|
909
|
-
return colors.ansi16.theme.text.prompt.icon.active;
|
|
910
|
-
},
|
|
911
|
-
get ansi256() {
|
|
912
|
-
return colors.ansi256.theme.text.prompt.icon.active;
|
|
913
|
-
},
|
|
914
|
-
get ansi16m() {
|
|
915
|
-
return colors.ansi16m.theme.text.prompt.icon.active;
|
|
916
|
-
}
|
|
917
|
-
})},
|
|
918
|
-
warning: ${createComponent(ColorFunction, {
|
|
919
|
-
get ansi16() {
|
|
920
|
-
return colors.ansi16.theme.text.prompt.icon.warning;
|
|
921
|
-
},
|
|
922
|
-
get ansi256() {
|
|
923
|
-
return colors.ansi256.theme.text.prompt.icon.warning;
|
|
924
|
-
},
|
|
925
|
-
get ansi16m() {
|
|
926
|
-
return colors.ansi16m.theme.text.prompt.icon.warning;
|
|
927
|
-
}
|
|
928
|
-
})},
|
|
929
|
-
error: ${createComponent(ColorFunction, {
|
|
930
|
-
get ansi16() {
|
|
931
|
-
return colors.ansi16.theme.text.prompt.icon.error;
|
|
932
|
-
},
|
|
933
|
-
get ansi256() {
|
|
934
|
-
return colors.ansi256.theme.text.prompt.icon.error;
|
|
935
|
-
},
|
|
936
|
-
get ansi16m() {
|
|
937
|
-
return colors.ansi16m.theme.text.prompt.icon.error;
|
|
938
|
-
}
|
|
939
|
-
})},
|
|
940
|
-
submitted: ${createComponent(ColorFunction, {
|
|
941
|
-
get ansi16() {
|
|
942
|
-
return colors.ansi16.theme.text.prompt.icon.submitted;
|
|
943
|
-
},
|
|
944
|
-
get ansi256() {
|
|
945
|
-
return colors.ansi256.theme.text.prompt.icon.submitted;
|
|
946
|
-
},
|
|
947
|
-
get ansi16m() {
|
|
948
|
-
return colors.ansi16m.theme.text.prompt.icon.submitted;
|
|
949
|
-
}
|
|
950
|
-
})},
|
|
951
|
-
cancelled: ${createComponent(ColorFunction, {
|
|
952
|
-
get ansi16() {
|
|
953
|
-
return colors.ansi16.theme.text.prompt.icon.cancelled;
|
|
954
|
-
},
|
|
955
|
-
get ansi256() {
|
|
956
|
-
return colors.ansi256.theme.text.prompt.icon.cancelled;
|
|
957
|
-
},
|
|
958
|
-
get ansi16m() {
|
|
959
|
-
return colors.ansi16m.theme.text.prompt.icon.cancelled;
|
|
960
|
-
}
|
|
961
|
-
})},
|
|
962
|
-
disabled: ${createComponent(ColorFunction, {
|
|
963
|
-
get ansi16() {
|
|
964
|
-
return colors.ansi16.theme.text.prompt.icon.disabled;
|
|
965
|
-
},
|
|
966
|
-
get ansi256() {
|
|
967
|
-
return colors.ansi256.theme.text.prompt.icon.disabled;
|
|
968
|
-
},
|
|
969
|
-
get ansi16m() {
|
|
970
|
-
return colors.ansi16m.theme.text.prompt.icon.disabled;
|
|
971
|
-
}
|
|
972
|
-
})}
|
|
973
|
-
},
|
|
974
|
-
message: {
|
|
975
|
-
active: ${createComponent(ColorFunction, {
|
|
976
|
-
get ansi16() {
|
|
977
|
-
return colors.ansi16.theme.text.prompt.message.active;
|
|
978
|
-
},
|
|
979
|
-
get ansi256() {
|
|
980
|
-
return colors.ansi256.theme.text.prompt.message.active;
|
|
981
|
-
},
|
|
982
|
-
get ansi16m() {
|
|
983
|
-
return colors.ansi16m.theme.text.prompt.message.active;
|
|
984
|
-
}
|
|
985
|
-
})},
|
|
986
|
-
warning: ${createComponent(ColorFunction, {
|
|
987
|
-
get ansi16() {
|
|
988
|
-
return colors.ansi16.theme.text.prompt.message.warning;
|
|
989
|
-
},
|
|
990
|
-
get ansi256() {
|
|
991
|
-
return colors.ansi256.theme.text.prompt.message.warning;
|
|
992
|
-
},
|
|
993
|
-
get ansi16m() {
|
|
994
|
-
return colors.ansi16m.theme.text.prompt.message.warning;
|
|
995
|
-
}
|
|
996
|
-
})},
|
|
997
|
-
error: ${createComponent(ColorFunction, {
|
|
998
|
-
get ansi16() {
|
|
999
|
-
return colors.ansi16.theme.text.prompt.message.error;
|
|
1000
|
-
},
|
|
1001
|
-
get ansi256() {
|
|
1002
|
-
return colors.ansi256.theme.text.prompt.message.error;
|
|
1003
|
-
},
|
|
1004
|
-
get ansi16m() {
|
|
1005
|
-
return colors.ansi16m.theme.text.prompt.message.error;
|
|
1006
|
-
}
|
|
1007
|
-
})},
|
|
1008
|
-
submitted: ${createComponent(ColorFunction, {
|
|
1009
|
-
get ansi16() {
|
|
1010
|
-
return colors.ansi16.theme.text.prompt.message.submitted;
|
|
1011
|
-
},
|
|
1012
|
-
get ansi256() {
|
|
1013
|
-
return colors.ansi256.theme.text.prompt.message.submitted;
|
|
1014
|
-
},
|
|
1015
|
-
get ansi16m() {
|
|
1016
|
-
return colors.ansi16m.theme.text.prompt.message.submitted;
|
|
1017
|
-
}
|
|
1018
|
-
})},
|
|
1019
|
-
cancelled: ${createComponent(ColorFunction, {
|
|
1020
|
-
get ansi16() {
|
|
1021
|
-
return colors.ansi16.theme.text.prompt.message.cancelled;
|
|
1022
|
-
},
|
|
1023
|
-
get ansi256() {
|
|
1024
|
-
return colors.ansi256.theme.text.prompt.message.cancelled;
|
|
1025
|
-
},
|
|
1026
|
-
get ansi16m() {
|
|
1027
|
-
return colors.ansi16m.theme.text.prompt.message.cancelled;
|
|
1028
|
-
}
|
|
1029
|
-
})},
|
|
1030
|
-
disabled: ${createComponent(ColorFunction, {
|
|
1031
|
-
get ansi16() {
|
|
1032
|
-
return colors.ansi16.theme.text.prompt.message.disabled;
|
|
1033
|
-
},
|
|
1034
|
-
get ansi256() {
|
|
1035
|
-
return colors.ansi256.theme.text.prompt.message.disabled;
|
|
1036
|
-
},
|
|
1037
|
-
get ansi16m() {
|
|
1038
|
-
return colors.ansi16m.theme.text.prompt.message.disabled;
|
|
1039
|
-
}
|
|
1040
|
-
})}
|
|
1041
|
-
},
|
|
1042
|
-
input: {
|
|
1043
|
-
active: ${createComponent(ColorFunction, {
|
|
1044
|
-
get ansi16() {
|
|
1045
|
-
return colors.ansi16.theme.text.prompt.input.active;
|
|
1046
|
-
},
|
|
1047
|
-
get ansi256() {
|
|
1048
|
-
return colors.ansi256.theme.text.prompt.input.active;
|
|
1049
|
-
},
|
|
1050
|
-
get ansi16m() {
|
|
1051
|
-
return colors.ansi16m.theme.text.prompt.input.active;
|
|
1052
|
-
}
|
|
1053
|
-
})},
|
|
1054
|
-
inactive: ${createComponent(ColorFunction, {
|
|
1055
|
-
get ansi16() {
|
|
1056
|
-
return colors.ansi16.theme.text.prompt.input.inactive;
|
|
1057
|
-
},
|
|
1058
|
-
get ansi256() {
|
|
1059
|
-
return colors.ansi256.theme.text.prompt.input.inactive;
|
|
1060
|
-
},
|
|
1061
|
-
get ansi16m() {
|
|
1062
|
-
return colors.ansi16m.theme.text.prompt.input.inactive;
|
|
1063
|
-
}
|
|
1064
|
-
})},
|
|
1065
|
-
warning: ${createComponent(ColorFunction, {
|
|
1066
|
-
get ansi16() {
|
|
1067
|
-
return colors.ansi16.theme.text.prompt.input.warning;
|
|
1068
|
-
},
|
|
1069
|
-
get ansi256() {
|
|
1070
|
-
return colors.ansi256.theme.text.prompt.input.warning;
|
|
1071
|
-
},
|
|
1072
|
-
get ansi16m() {
|
|
1073
|
-
return colors.ansi16m.theme.text.prompt.input.warning;
|
|
1074
|
-
}
|
|
1075
|
-
})},
|
|
1076
|
-
error: ${createComponent(ColorFunction, {
|
|
1077
|
-
get ansi16() {
|
|
1078
|
-
return colors.ansi16.theme.text.prompt.input.error;
|
|
1079
|
-
},
|
|
1080
|
-
get ansi256() {
|
|
1081
|
-
return colors.ansi256.theme.text.prompt.input.error;
|
|
1082
|
-
},
|
|
1083
|
-
get ansi16m() {
|
|
1084
|
-
return colors.ansi16m.theme.text.prompt.input.error;
|
|
1085
|
-
}
|
|
1086
|
-
})},
|
|
1087
|
-
submitted: ${createComponent(ColorFunction, {
|
|
1088
|
-
get ansi16() {
|
|
1089
|
-
return colors.ansi16.theme.text.prompt.input.submitted;
|
|
1090
|
-
},
|
|
1091
|
-
get ansi256() {
|
|
1092
|
-
return colors.ansi256.theme.text.prompt.input.submitted;
|
|
1093
|
-
},
|
|
1094
|
-
get ansi16m() {
|
|
1095
|
-
return colors.ansi16m.theme.text.prompt.input.submitted;
|
|
1096
|
-
}
|
|
1097
|
-
})},
|
|
1098
|
-
cancelled: ${createComponent(ColorFunction, {
|
|
1099
|
-
get ansi16() {
|
|
1100
|
-
return colors.ansi16.theme.text.prompt.input.cancelled;
|
|
1101
|
-
},
|
|
1102
|
-
get ansi256() {
|
|
1103
|
-
return colors.ansi256.theme.text.prompt.input.cancelled;
|
|
1104
|
-
},
|
|
1105
|
-
get ansi16m() {
|
|
1106
|
-
return colors.ansi16m.theme.text.prompt.input.cancelled;
|
|
1107
|
-
}
|
|
1108
|
-
})},
|
|
1109
|
-
disabled: ${createComponent(ColorFunction, {
|
|
1110
|
-
get ansi16() {
|
|
1111
|
-
return colors.ansi16.theme.text.prompt.input.disabled;
|
|
1112
|
-
},
|
|
1113
|
-
get ansi256() {
|
|
1114
|
-
return colors.ansi256.theme.text.prompt.input.disabled;
|
|
1115
|
-
},
|
|
1116
|
-
get ansi16m() {
|
|
1117
|
-
return colors.ansi16m.theme.text.prompt.input.disabled;
|
|
1118
|
-
}
|
|
1119
|
-
})},
|
|
1120
|
-
placeholder: ${createComponent(ColorFunction, {
|
|
1121
|
-
get ansi16() {
|
|
1122
|
-
return colors.ansi16.theme.text.prompt.input.placeholder;
|
|
1123
|
-
},
|
|
1124
|
-
get ansi256() {
|
|
1125
|
-
return colors.ansi256.theme.text.prompt.input.placeholder;
|
|
1126
|
-
},
|
|
1127
|
-
get ansi16m() {
|
|
1128
|
-
return colors.ansi16m.theme.text.prompt.input.placeholder;
|
|
1129
|
-
}
|
|
1130
|
-
})}
|
|
1131
|
-
},
|
|
1132
|
-
description: {
|
|
1133
|
-
active: ${createComponent(ColorFunction, {
|
|
1134
|
-
get ansi16() {
|
|
1135
|
-
return colors.ansi16.theme.text.prompt.description.active;
|
|
1136
|
-
},
|
|
1137
|
-
get ansi256() {
|
|
1138
|
-
return colors.ansi256.theme.text.prompt.description.active;
|
|
1139
|
-
},
|
|
1140
|
-
get ansi16m() {
|
|
1141
|
-
return colors.ansi16m.theme.text.prompt.description.active;
|
|
1142
|
-
}
|
|
1143
|
-
})},
|
|
1144
|
-
inactive: ${createComponent(ColorFunction, {
|
|
1145
|
-
get ansi16() {
|
|
1146
|
-
return colors.ansi16.theme.text.prompt.description.inactive;
|
|
1147
|
-
},
|
|
1148
|
-
get ansi256() {
|
|
1149
|
-
return colors.ansi256.theme.text.prompt.description.inactive;
|
|
1150
|
-
},
|
|
1151
|
-
get ansi16m() {
|
|
1152
|
-
return colors.ansi16m.theme.text.prompt.description.inactive;
|
|
1153
|
-
}
|
|
1154
|
-
})},
|
|
1155
|
-
warning: ${createComponent(ColorFunction, {
|
|
1156
|
-
get ansi16() {
|
|
1157
|
-
return colors.ansi16.theme.text.prompt.description.warning;
|
|
1158
|
-
},
|
|
1159
|
-
get ansi256() {
|
|
1160
|
-
return colors.ansi256.theme.text.prompt.description.warning;
|
|
1161
|
-
},
|
|
1162
|
-
get ansi16m() {
|
|
1163
|
-
return colors.ansi16m.theme.text.prompt.description.warning;
|
|
1164
|
-
}
|
|
1165
|
-
})},
|
|
1166
|
-
error: ${createComponent(ColorFunction, {
|
|
1167
|
-
get ansi16() {
|
|
1168
|
-
return colors.ansi16.theme.text.prompt.description.error;
|
|
1169
|
-
},
|
|
1170
|
-
get ansi256() {
|
|
1171
|
-
return colors.ansi256.theme.text.prompt.description.error;
|
|
1172
|
-
},
|
|
1173
|
-
get ansi16m() {
|
|
1174
|
-
return colors.ansi16m.theme.text.prompt.description.error;
|
|
1175
|
-
}
|
|
1176
|
-
})},
|
|
1177
|
-
submitted: ${createComponent(ColorFunction, {
|
|
1178
|
-
get ansi16() {
|
|
1179
|
-
return colors.ansi16.theme.text.prompt.description.submitted;
|
|
1180
|
-
},
|
|
1181
|
-
get ansi256() {
|
|
1182
|
-
return colors.ansi256.theme.text.prompt.description.submitted;
|
|
1183
|
-
},
|
|
1184
|
-
get ansi16m() {
|
|
1185
|
-
return colors.ansi16m.theme.text.prompt.description.submitted;
|
|
1186
|
-
}
|
|
1187
|
-
})},
|
|
1188
|
-
cancelled: ${createComponent(ColorFunction, {
|
|
1189
|
-
get ansi16() {
|
|
1190
|
-
return colors.ansi16.theme.text.prompt.description.cancelled;
|
|
1191
|
-
},
|
|
1192
|
-
get ansi256() {
|
|
1193
|
-
return colors.ansi256.theme.text.prompt.description.cancelled;
|
|
1194
|
-
},
|
|
1195
|
-
get ansi16m() {
|
|
1196
|
-
return colors.ansi16m.theme.text.prompt.description.cancelled;
|
|
1197
|
-
}
|
|
1198
|
-
})},
|
|
1199
|
-
disabled: ${createComponent(ColorFunction, {
|
|
1200
|
-
get ansi16() {
|
|
1201
|
-
return colors.ansi16.theme.text.prompt.description.disabled;
|
|
1202
|
-
},
|
|
1203
|
-
get ansi256() {
|
|
1204
|
-
return colors.ansi256.theme.text.prompt.description.disabled;
|
|
1205
|
-
},
|
|
1206
|
-
get ansi16m() {
|
|
1207
|
-
return colors.ansi16m.theme.text.prompt.description.disabled;
|
|
1208
|
-
}
|
|
1209
|
-
})}
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
},
|
|
1213
|
-
border: {
|
|
1214
|
-
banner: {
|
|
1215
|
-
outline: {
|
|
1216
|
-
primary: ${createComponent(ColorFunction, {
|
|
1217
|
-
get ansi16() {
|
|
1218
|
-
return colors.ansi16.theme.border.banner.outline.primary;
|
|
1219
|
-
},
|
|
1220
|
-
get ansi256() {
|
|
1221
|
-
return colors.ansi256.theme.border.banner.outline.primary;
|
|
1222
|
-
},
|
|
1223
|
-
get ansi16m() {
|
|
1224
|
-
return colors.ansi16m.theme.border.banner.outline.primary;
|
|
1225
|
-
}
|
|
1226
|
-
})},
|
|
1227
|
-
secondary: ${createComponent(ColorFunction, {
|
|
1228
|
-
get ansi16() {
|
|
1229
|
-
return colors.ansi16.theme.border.banner.outline.secondary;
|
|
1230
|
-
},
|
|
1231
|
-
get ansi256() {
|
|
1232
|
-
return colors.ansi256.theme.border.banner.outline.secondary;
|
|
1233
|
-
},
|
|
1234
|
-
get ansi16m() {
|
|
1235
|
-
return colors.ansi16m.theme.border.banner.outline.secondary;
|
|
1236
|
-
}
|
|
1237
|
-
})},
|
|
1238
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
1239
|
-
get ansi16() {
|
|
1240
|
-
return colors.ansi16.theme.border.banner.outline.tertiary;
|
|
1241
|
-
},
|
|
1242
|
-
get ansi256() {
|
|
1243
|
-
return colors.ansi256.theme.border.banner.outline.tertiary;
|
|
1244
|
-
},
|
|
1245
|
-
get ansi16m() {
|
|
1246
|
-
return colors.ansi16m.theme.border.banner.outline.tertiary;
|
|
1247
|
-
}
|
|
1248
|
-
})}
|
|
1249
|
-
},
|
|
1250
|
-
divider: {
|
|
1251
|
-
primary: ${createComponent(ColorFunction, {
|
|
1252
|
-
get ansi16() {
|
|
1253
|
-
return colors.ansi16.theme.border.banner.divider.primary;
|
|
1254
|
-
},
|
|
1255
|
-
get ansi256() {
|
|
1256
|
-
return colors.ansi256.theme.border.banner.divider.primary;
|
|
1257
|
-
},
|
|
1258
|
-
get ansi16m() {
|
|
1259
|
-
return colors.ansi16m.theme.border.banner.divider.primary;
|
|
1260
|
-
}
|
|
1261
|
-
})},
|
|
1262
|
-
secondary: ${createComponent(ColorFunction, {
|
|
1263
|
-
get ansi16() {
|
|
1264
|
-
return colors.ansi16.theme.border.banner.divider.secondary;
|
|
1265
|
-
},
|
|
1266
|
-
get ansi256() {
|
|
1267
|
-
return colors.ansi256.theme.border.banner.divider.secondary;
|
|
1268
|
-
},
|
|
1269
|
-
get ansi16m() {
|
|
1270
|
-
return colors.ansi16m.theme.border.banner.divider.secondary;
|
|
1271
|
-
}
|
|
1272
|
-
})},
|
|
1273
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
1274
|
-
get ansi16() {
|
|
1275
|
-
return colors.ansi16.theme.border.banner.divider.tertiary;
|
|
1276
|
-
},
|
|
1277
|
-
get ansi256() {
|
|
1278
|
-
return colors.ansi256.theme.border.banner.divider.tertiary;
|
|
1279
|
-
},
|
|
1280
|
-
get ansi16m() {
|
|
1281
|
-
return colors.ansi16m.theme.border.banner.divider.tertiary;
|
|
1282
|
-
}
|
|
1283
|
-
})}
|
|
1284
|
-
}
|
|
1285
|
-
},
|
|
1286
|
-
app: {
|
|
1287
|
-
table: {
|
|
1288
|
-
primary: ${createComponent(ColorFunction, {
|
|
1289
|
-
get ansi16() {
|
|
1290
|
-
return colors.ansi16.theme.border.app.table.primary;
|
|
1291
|
-
},
|
|
1292
|
-
get ansi256() {
|
|
1293
|
-
return colors.ansi256.theme.border.app.table.primary;
|
|
1294
|
-
},
|
|
1295
|
-
get ansi16m() {
|
|
1296
|
-
return colors.ansi16m.theme.border.app.table.primary;
|
|
1297
|
-
}
|
|
1298
|
-
})},
|
|
1299
|
-
secondary: ${createComponent(ColorFunction, {
|
|
1300
|
-
get ansi16() {
|
|
1301
|
-
return colors.ansi16.theme.border.app.table.secondary;
|
|
1302
|
-
},
|
|
1303
|
-
get ansi256() {
|
|
1304
|
-
return colors.ansi256.theme.border.app.table.secondary;
|
|
1305
|
-
},
|
|
1306
|
-
get ansi16m() {
|
|
1307
|
-
return colors.ansi16m.theme.border.app.table.secondary;
|
|
1308
|
-
}
|
|
1309
|
-
})},
|
|
1310
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
1311
|
-
get ansi16() {
|
|
1312
|
-
return colors.ansi16.theme.border.app.table.tertiary;
|
|
1313
|
-
},
|
|
1314
|
-
get ansi256() {
|
|
1315
|
-
return colors.ansi256.theme.border.app.table.tertiary;
|
|
1316
|
-
},
|
|
1317
|
-
get ansi16m() {
|
|
1318
|
-
return colors.ansi16m.theme.border.app.table.tertiary;
|
|
1319
|
-
}
|
|
1320
|
-
})}
|
|
1321
|
-
},
|
|
1322
|
-
divider: {
|
|
1323
|
-
primary: ${createComponent(ColorFunction, {
|
|
1324
|
-
get ansi16() {
|
|
1325
|
-
return colors.ansi16.theme.border.app.divider.primary;
|
|
1326
|
-
},
|
|
1327
|
-
get ansi256() {
|
|
1328
|
-
return colors.ansi256.theme.border.app.divider.primary;
|
|
1329
|
-
},
|
|
1330
|
-
get ansi16m() {
|
|
1331
|
-
return colors.ansi16m.theme.border.app.divider.primary;
|
|
1332
|
-
}
|
|
1333
|
-
})},
|
|
1334
|
-
secondary: ${createComponent(ColorFunction, {
|
|
1335
|
-
get ansi16() {
|
|
1336
|
-
return colors.ansi16.theme.border.app.divider.secondary;
|
|
1337
|
-
},
|
|
1338
|
-
get ansi256() {
|
|
1339
|
-
return colors.ansi256.theme.border.app.divider.secondary;
|
|
1340
|
-
},
|
|
1341
|
-
get ansi16m() {
|
|
1342
|
-
return colors.ansi16m.theme.border.app.divider.secondary;
|
|
1343
|
-
}
|
|
1344
|
-
})},
|
|
1345
|
-
tertiary: ${createComponent(ColorFunction, {
|
|
1346
|
-
get ansi16() {
|
|
1347
|
-
return colors.ansi16.theme.border.app.divider.tertiary;
|
|
1348
|
-
},
|
|
1349
|
-
get ansi256() {
|
|
1350
|
-
return colors.ansi256.theme.border.app.divider.tertiary;
|
|
1351
|
-
},
|
|
1352
|
-
get ansi16m() {
|
|
1353
|
-
return colors.ansi16m.theme.border.app.divider.tertiary;
|
|
1354
|
-
}
|
|
1355
|
-
})}
|
|
1356
|
-
}
|
|
1357
|
-
},
|
|
1358
|
-
message: {
|
|
1359
|
-
outline: {
|
|
1360
|
-
help: ${createComponent(ColorFunction, {
|
|
1361
|
-
get ansi16() {
|
|
1362
|
-
return colors.ansi16.theme.border.message.outline.help;
|
|
1363
|
-
},
|
|
1364
|
-
get ansi256() {
|
|
1365
|
-
return colors.ansi256.theme.border.message.outline.help;
|
|
1366
|
-
},
|
|
1367
|
-
get ansi16m() {
|
|
1368
|
-
return colors.ansi16m.theme.border.message.outline.help;
|
|
1369
|
-
}
|
|
1370
|
-
})},
|
|
1371
|
-
success: ${createComponent(ColorFunction, {
|
|
1372
|
-
get ansi16() {
|
|
1373
|
-
return colors.ansi16.theme.border.message.outline.success;
|
|
1374
|
-
},
|
|
1375
|
-
get ansi256() {
|
|
1376
|
-
return colors.ansi256.theme.border.message.outline.success;
|
|
1377
|
-
},
|
|
1378
|
-
get ansi16m() {
|
|
1379
|
-
return colors.ansi16m.theme.border.message.outline.success;
|
|
1380
|
-
}
|
|
1381
|
-
})},
|
|
1382
|
-
info: ${createComponent(ColorFunction, {
|
|
1383
|
-
get ansi16() {
|
|
1384
|
-
return colors.ansi16.theme.border.message.outline.info;
|
|
1385
|
-
},
|
|
1386
|
-
get ansi256() {
|
|
1387
|
-
return colors.ansi256.theme.border.message.outline.info;
|
|
1388
|
-
},
|
|
1389
|
-
get ansi16m() {
|
|
1390
|
-
return colors.ansi16m.theme.border.message.outline.info;
|
|
1391
|
-
}
|
|
1392
|
-
})},
|
|
1393
|
-
debug: ${createComponent(ColorFunction, {
|
|
1394
|
-
get ansi16() {
|
|
1395
|
-
return colors.ansi16.theme.border.message.outline.debug;
|
|
1396
|
-
},
|
|
1397
|
-
get ansi256() {
|
|
1398
|
-
return colors.ansi256.theme.border.message.outline.debug;
|
|
1399
|
-
},
|
|
1400
|
-
get ansi16m() {
|
|
1401
|
-
return colors.ansi16m.theme.border.message.outline.debug;
|
|
1402
|
-
}
|
|
1403
|
-
})},
|
|
1404
|
-
warning: ${createComponent(ColorFunction, {
|
|
1405
|
-
get ansi16() {
|
|
1406
|
-
return colors.ansi16.theme.border.message.outline.warning;
|
|
1407
|
-
},
|
|
1408
|
-
get ansi256() {
|
|
1409
|
-
return colors.ansi256.theme.border.message.outline.warning;
|
|
1410
|
-
},
|
|
1411
|
-
get ansi16m() {
|
|
1412
|
-
return colors.ansi16m.theme.border.message.outline.warning;
|
|
1413
|
-
}
|
|
1414
|
-
})},
|
|
1415
|
-
danger: ${createComponent(ColorFunction, {
|
|
1416
|
-
get ansi16() {
|
|
1417
|
-
return colors.ansi16.theme.border.message.outline.danger;
|
|
1418
|
-
},
|
|
1419
|
-
get ansi256() {
|
|
1420
|
-
return colors.ansi256.theme.border.message.outline.danger;
|
|
1421
|
-
},
|
|
1422
|
-
get ansi16m() {
|
|
1423
|
-
return colors.ansi16m.theme.border.message.outline.danger;
|
|
1424
|
-
}
|
|
1425
|
-
})},
|
|
1426
|
-
error: ${createComponent(ColorFunction, {
|
|
1427
|
-
get ansi16() {
|
|
1428
|
-
return colors.ansi16.theme.border.message.outline.error;
|
|
1429
|
-
},
|
|
1430
|
-
get ansi256() {
|
|
1431
|
-
return colors.ansi256.theme.border.message.outline.error;
|
|
1432
|
-
},
|
|
1433
|
-
get ansi16m() {
|
|
1434
|
-
return colors.ansi16m.theme.border.message.outline.error;
|
|
1435
|
-
}
|
|
1436
|
-
})}
|
|
1437
|
-
},
|
|
1438
|
-
divider: {
|
|
1439
|
-
help: ${createComponent(ColorFunction, {
|
|
1440
|
-
get ansi16() {
|
|
1441
|
-
return colors.ansi16.theme.border.message.divider.help;
|
|
1442
|
-
},
|
|
1443
|
-
get ansi256() {
|
|
1444
|
-
return colors.ansi256.theme.border.message.divider.help;
|
|
1445
|
-
},
|
|
1446
|
-
get ansi16m() {
|
|
1447
|
-
return colors.ansi16m.theme.border.message.divider.help;
|
|
1448
|
-
}
|
|
1449
|
-
})},
|
|
1450
|
-
success: ${createComponent(ColorFunction, {
|
|
1451
|
-
get ansi16() {
|
|
1452
|
-
return colors.ansi16.theme.border.message.divider.success;
|
|
1453
|
-
},
|
|
1454
|
-
get ansi256() {
|
|
1455
|
-
return colors.ansi256.theme.border.message.divider.success;
|
|
1456
|
-
},
|
|
1457
|
-
get ansi16m() {
|
|
1458
|
-
return colors.ansi16m.theme.border.message.divider.success;
|
|
1459
|
-
}
|
|
1460
|
-
})},
|
|
1461
|
-
info: ${createComponent(ColorFunction, {
|
|
1462
|
-
get ansi16() {
|
|
1463
|
-
return colors.ansi16.theme.border.message.divider.info;
|
|
1464
|
-
},
|
|
1465
|
-
get ansi256() {
|
|
1466
|
-
return colors.ansi256.theme.border.message.divider.info;
|
|
1467
|
-
},
|
|
1468
|
-
get ansi16m() {
|
|
1469
|
-
return colors.ansi16m.theme.border.message.divider.info;
|
|
1470
|
-
}
|
|
1471
|
-
})},
|
|
1472
|
-
debug: ${createComponent(ColorFunction, {
|
|
1473
|
-
get ansi16() {
|
|
1474
|
-
return colors.ansi16.theme.border.message.divider.debug;
|
|
1475
|
-
},
|
|
1476
|
-
get ansi256() {
|
|
1477
|
-
return colors.ansi256.theme.border.message.divider.debug;
|
|
1478
|
-
},
|
|
1479
|
-
get ansi16m() {
|
|
1480
|
-
return colors.ansi16m.theme.border.message.divider.debug;
|
|
1481
|
-
}
|
|
1482
|
-
})},
|
|
1483
|
-
warning: ${createComponent(ColorFunction, {
|
|
1484
|
-
get ansi16() {
|
|
1485
|
-
return colors.ansi16.theme.border.message.divider.warning;
|
|
1486
|
-
},
|
|
1487
|
-
get ansi256() {
|
|
1488
|
-
return colors.ansi256.theme.border.message.divider.warning;
|
|
1489
|
-
},
|
|
1490
|
-
get ansi16m() {
|
|
1491
|
-
return colors.ansi16m.theme.border.message.divider.warning;
|
|
1492
|
-
}
|
|
1493
|
-
})},
|
|
1494
|
-
danger: ${createComponent(ColorFunction, {
|
|
1495
|
-
get ansi16() {
|
|
1496
|
-
return colors.ansi16.theme.border.message.divider.danger;
|
|
1497
|
-
},
|
|
1498
|
-
get ansi256() {
|
|
1499
|
-
return colors.ansi256.theme.border.message.divider.danger;
|
|
1500
|
-
},
|
|
1501
|
-
get ansi16m() {
|
|
1502
|
-
return colors.ansi16m.theme.border.message.divider.danger;
|
|
1503
|
-
}
|
|
1504
|
-
})},
|
|
1505
|
-
error: ${createComponent(ColorFunction, {
|
|
1506
|
-
get ansi16() {
|
|
1507
|
-
return colors.ansi16.theme.border.message.divider.error;
|
|
1508
|
-
},
|
|
1509
|
-
get ansi256() {
|
|
1510
|
-
return colors.ansi256.theme.border.message.divider.error;
|
|
1511
|
-
},
|
|
1512
|
-
get ansi16m() {
|
|
1513
|
-
return colors.ansi16m.theme.border.message.divider.error;
|
|
1514
|
-
}
|
|
1515
|
-
})}
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
`
|
|
1521
|
-
];
|
|
1522
|
-
}
|
|
1523
|
-
})
|
|
1524
|
-
];
|
|
1525
|
-
}
|
|
1526
|
-
/**
|
|
1527
|
-
* A component to generate the `writeLine` function in the `shell-shock:console` builtin module.
|
|
1528
|
-
*/
|
|
1529
|
-
function WriteLineFunctionDeclaration() {
|
|
1530
|
-
const theme = useTheme();
|
|
1531
|
-
return [
|
|
1532
|
-
createComponent(FunctionDeclaration, {
|
|
1533
|
-
name: "adjustIndex",
|
|
1534
|
-
parameters: [{
|
|
1535
|
-
name: "line",
|
|
1536
|
-
type: "string"
|
|
1537
|
-
}, {
|
|
1538
|
-
name: "index",
|
|
1539
|
-
type: "number"
|
|
1540
|
-
}],
|
|
1541
|
-
returnType: "number",
|
|
1542
|
-
children: code`let adjustedIndex = 0;
|
|
1543
|
-
|
|
1544
|
-
const segments = line.match(/\\x1b\\[(\\d|;)+m.*\\x1b\\[(\\d|;)+m/gi);
|
|
1545
|
-
if (segments && segments.length > 0) {
|
|
1546
|
-
segments.reduce((count, matched) => {
|
|
1547
|
-
if (count < index) {
|
|
1548
|
-
const stripped = stripAnsi(matched);
|
|
1549
|
-
if (count + stripped.length < index) {
|
|
1550
|
-
count += stripped.length;
|
|
1551
|
-
adjustedIndex += matched.length;
|
|
1552
|
-
} else {
|
|
1553
|
-
adjustedIndex += index - count + (matched.slice(0, index - count).match(/\\x1b\\[(\\d|;)+m/g)?.join("")?.length ?? 0);
|
|
1554
|
-
count = index;
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
return count;
|
|
1559
|
-
}, 0);
|
|
1560
|
-
} else {
|
|
1561
|
-
adjustedIndex = index;
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
return adjustedIndex - (line.slice(0, adjustedIndex).match(/\\x1b\\[/g)?.length ?? 0); `
|
|
1565
|
-
}),
|
|
1566
|
-
createComponent(Spacing, {}),
|
|
1567
|
-
createComponent(FunctionDeclaration, {
|
|
1568
|
-
name: "breakLine",
|
|
1569
|
-
parameters: [{
|
|
1570
|
-
name: "line",
|
|
1571
|
-
type: "string"
|
|
1572
|
-
}, {
|
|
1573
|
-
name: "index",
|
|
1574
|
-
type: "number"
|
|
1575
|
-
}],
|
|
1576
|
-
returnType: "[string, string]",
|
|
1577
|
-
children: code`const first = line.slice(0, index);
|
|
1578
|
-
const second = line.slice(index);
|
|
1579
|
-
|
|
1580
|
-
// Match all ANSI escape sequences in the first string
|
|
1581
|
-
const ansiRegex = /[\\x1b\\u009b][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))/g;
|
|
1582
|
-
|
|
1583
|
-
const openCodes: string[] = [];
|
|
1584
|
-
const closeCodes: string[] = [];
|
|
1585
|
-
let match: RegExpExecArray | null;
|
|
1586
|
-
|
|
1587
|
-
while ((match = ansiRegex.exec(first)) !== null) {
|
|
1588
|
-
const code = match[0];
|
|
1589
|
-
// Check if this is a reset/close code (e.g., \\x1b[0m, \\x1b[39m, \\x1b[49m, etc.)
|
|
1590
|
-
if (/\\x1b\\[(?:0|22|23|24|27|28|29|39|49)m/.test(code)) {
|
|
1591
|
-
// A close/reset code cancels the last open code
|
|
1592
|
-
openCodes.pop();
|
|
1593
|
-
closeCodes.pop();
|
|
1594
|
-
} else {
|
|
1595
|
-
openCodes.push(code);
|
|
1596
|
-
// Derive a close code: map SGR open codes to their reset counterparts
|
|
1597
|
-
const sgrMatch = code.match(/\\x1b\\[(\\d+)m/);
|
|
1598
|
-
if (sgrMatch) {
|
|
1599
|
-
const n = parseInt(sgrMatch[1]!, 10);
|
|
1600
|
-
let closeCode: string;
|
|
1601
|
-
if (n >= 30 && n <= 37) closeCode = "\\x1b[39m";
|
|
1602
|
-
else if (n >= 40 && n <= 47) closeCode = "\\x1b[49m";
|
|
1603
|
-
else if (n >= 90 && n <= 97) closeCode = "\\x1b[39m";
|
|
1604
|
-
else if (n >= 100 && n <= 107) closeCode = "\\x1b[49m";
|
|
1605
|
-
else if (n === 1) closeCode = "\\x1b[22m";
|
|
1606
|
-
else if (n === 2) closeCode = "\\x1b[22m";
|
|
1607
|
-
else if (n === 3) closeCode = "\\x1b[23m";
|
|
1608
|
-
else if (n === 4) closeCode = "\\x1b[24m";
|
|
1609
|
-
else if (n === 7) closeCode = "\\x1b[27m";
|
|
1610
|
-
else if (n === 8) closeCode = "\\x1b[28m";
|
|
1611
|
-
else if (n === 9) closeCode = "\\x1b[29m";
|
|
1612
|
-
else closeCode = "\\x1b[0m";
|
|
1613
|
-
closeCodes.push(closeCode);
|
|
1614
|
-
} else {
|
|
1615
|
-
closeCodes.push("\\x1b[0m");
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
// Append close codes to the end of "first" (in reverse order)
|
|
1621
|
-
const closeSequence = closeCodes.slice().reverse().join("");
|
|
1622
|
-
// Prepend open codes to the start of "second"
|
|
1623
|
-
const openSequence = openCodes.join("");
|
|
1624
|
-
|
|
1625
|
-
return [first.replace(/^\\s+/, "").replace(/\\s+$/, "") + closeSequence, openSequence + second.replace(/^\\s+/, "").replace(/\\s+$/, "")]; `
|
|
1626
|
-
}),
|
|
1627
|
-
createComponent(Spacing, {}),
|
|
1628
|
-
createComponent(TSDoc, {
|
|
1629
|
-
heading: "Split text into multiple lines based on a maximum length.",
|
|
1630
|
-
get children() {
|
|
1631
|
-
return [
|
|
1632
|
-
createComponent(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.` }),
|
|
1633
|
-
createIntrinsic("hbr", {}),
|
|
1634
|
-
createComponent(TSDocParam, {
|
|
1635
|
-
name: "text",
|
|
1636
|
-
children: `The text to split into multiple lines.`
|
|
1637
|
-
}),
|
|
1638
|
-
createComponent(TSDocParam, {
|
|
1639
|
-
name: "maxLength",
|
|
1640
|
-
children: `The maximum length of each line.`
|
|
1641
|
-
})
|
|
1642
|
-
];
|
|
1643
|
-
}
|
|
1644
|
-
}),
|
|
1645
|
-
createComponent(FunctionDeclaration, {
|
|
1646
|
-
"export": true,
|
|
1647
|
-
name: "splitText",
|
|
1648
|
-
parameters: [{
|
|
1649
|
-
name: "text",
|
|
1650
|
-
type: "string"
|
|
1651
|
-
}, {
|
|
1652
|
-
name: "maxLength",
|
|
1653
|
-
type: "number | SizeToken"
|
|
1654
|
-
}],
|
|
1655
|
-
children: code`
|
|
1656
|
-
let line = text;
|
|
1657
|
-
let result = [] as string[];
|
|
1658
|
-
|
|
1659
|
-
const calculatedMaxLength = isSizeToken(maxLength) ? calculateWidth(maxLength) : maxLength;
|
|
1660
|
-
while (stripAnsi(line).length > calculatedMaxLength || line.indexOf("\\n") !== -1) {
|
|
1661
|
-
if (line.indexOf("\\n") !== -1) {
|
|
1662
|
-
result.push(...splitText(line.slice(0, line.indexOf("\\n")).replace(/(\\r)?\\n/, ""), calculatedMaxLength));
|
|
1663
|
-
line = line.indexOf("\\n") + 1 < line.length
|
|
1664
|
-
? line.slice(line.indexOf("\\n") + 1)
|
|
1665
|
-
: "";
|
|
1666
|
-
} else {
|
|
1667
|
-
const index = [" ", "/", ".", ",", "-", ":", "|", "@", "+"].reduce((ret, split) => {
|
|
1668
|
-
let current = ret;
|
|
1669
|
-
while (stripAnsi(line).indexOf(split, current + 1) !== -1 && stripAnsi(line).indexOf(split, current + 1) <= calculatedMaxLength) {
|
|
1670
|
-
current = line.indexOf(split, adjustIndex(line, current + 1));
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
return current;
|
|
1674
|
-
}, -1);
|
|
1675
|
-
if (index === -1) {
|
|
1676
|
-
break;
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
const lines = breakLine(line, index);
|
|
1680
|
-
result.push(lines[0]);
|
|
1681
|
-
line = lines[1];
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
while (stripAnsi(line).length > calculatedMaxLength) {
|
|
1686
|
-
const lines = breakLine(line, calculatedMaxLength);
|
|
1687
|
-
result.push(lines[0]);
|
|
1688
|
-
line = lines[1];
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
result.push(line);
|
|
1692
|
-
return result;
|
|
1693
|
-
`
|
|
1694
|
-
}),
|
|
1695
|
-
createComponent(Spacing, {}),
|
|
1696
|
-
createComponent(InterfaceDeclaration, {
|
|
1697
|
-
"export": true,
|
|
1698
|
-
name: "WriteLineOptions",
|
|
1699
|
-
doc: "Options for writing a line to the console.",
|
|
1700
|
-
get children() {
|
|
1701
|
-
return [
|
|
1702
|
-
createComponent(TSDoc, {
|
|
1703
|
-
heading: "Padding to apply to the line",
|
|
1704
|
-
get children() {
|
|
1705
|
-
return createComponent(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.` });
|
|
1706
|
-
}
|
|
1707
|
-
}),
|
|
1708
|
-
createComponent(InterfaceMember, {
|
|
1709
|
-
name: "padding",
|
|
1710
|
-
optional: true,
|
|
1711
|
-
type: "number"
|
|
1712
|
-
}),
|
|
1713
|
-
createIntrinsic("hbr", {}),
|
|
1714
|
-
createComponent(TSDoc, {
|
|
1715
|
-
heading: "Console function to use for writing the line",
|
|
1716
|
-
get children() {
|
|
1717
|
-
return [
|
|
1718
|
-
createComponent(TSDocRemarks, { children: `The console function to use for writing the line. If not specified, the default console function \`console.log\` will be used.` }),
|
|
1719
|
-
createIntrinsic("hbr", {}),
|
|
1720
|
-
createComponent(TSDocDefaultValue, {
|
|
1721
|
-
get type() {
|
|
1722
|
-
return ReflectionKind.method;
|
|
1723
|
-
},
|
|
1724
|
-
defaultValue: `\`console.log\``
|
|
1725
|
-
})
|
|
1726
|
-
];
|
|
1727
|
-
}
|
|
1728
|
-
}),
|
|
1729
|
-
createComponent(InterfaceMember, {
|
|
1730
|
-
name: "consoleFn",
|
|
1731
|
-
optional: true,
|
|
1732
|
-
type: "(text: string) => void"
|
|
1733
|
-
}),
|
|
1734
|
-
createIntrinsic("hbr", {}),
|
|
1735
|
-
createComponent(TSDoc, {
|
|
1736
|
-
heading: "Color of the line text",
|
|
1737
|
-
get children() {
|
|
1738
|
-
return [createComponent(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).` }), createIntrinsic("hbr", {})];
|
|
1739
|
-
}
|
|
1740
|
-
}),
|
|
1741
|
-
createComponent(InterfaceMember, {
|
|
1742
|
-
name: "color",
|
|
1743
|
-
optional: true,
|
|
1744
|
-
type: "\"primary\" | \"secondary\" | \"tertiary\""
|
|
1745
|
-
})
|
|
1746
|
-
];
|
|
1747
|
-
}
|
|
1748
|
-
}),
|
|
1749
|
-
createComponent(Spacing, {}),
|
|
1750
|
-
createComponent(TSDoc, {
|
|
1751
|
-
heading: "Write a line to the console.",
|
|
1752
|
-
get children() {
|
|
1753
|
-
return [
|
|
1754
|
-
createComponent(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.` }),
|
|
1755
|
-
createIntrinsic("hbr", {}),
|
|
1756
|
-
createComponent(TSDocParam, {
|
|
1757
|
-
name: "text",
|
|
1758
|
-
children: `The line text to write to the console.`
|
|
1759
|
-
}),
|
|
1760
|
-
createComponent(TSDocParam, {
|
|
1761
|
-
name: "options",
|
|
1762
|
-
children: `The options to apply when writing the line to the console.`
|
|
1763
|
-
})
|
|
1764
|
-
];
|
|
1765
|
-
}
|
|
1766
|
-
}),
|
|
1767
|
-
createComponent(FunctionDeclaration, {
|
|
1768
|
-
"export": true,
|
|
1769
|
-
name: "writeLine",
|
|
1770
|
-
parameters: [{
|
|
1771
|
-
name: "text",
|
|
1772
|
-
type: "string | number | boolean | null",
|
|
1773
|
-
optional: true
|
|
1774
|
-
}, {
|
|
1775
|
-
name: "options",
|
|
1776
|
-
type: "WriteLineOptions",
|
|
1777
|
-
default: "{}"
|
|
1778
|
-
}],
|
|
1779
|
-
get children() {
|
|
1780
|
-
return code`const consoleFn = options.consoleFn ?? console.log;
|
|
1781
|
-
const color = options.color;
|
|
1782
|
-
if (text === undefined || text === null || text === "") {
|
|
1783
|
-
consoleFn("");
|
|
1784
|
-
return;
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
consoleFn(\`\${" ".repeat(Math.max(options.padding ?? ${theme.padding.app}, 0))}\${color ? colors.text.body[color](String(text)) : String(text)}\`);
|
|
1788
|
-
`;
|
|
1789
|
-
}
|
|
1790
|
-
})
|
|
1791
|
-
];
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* A component to generate the message functions in the `shell-shock:console` builtin module.
|
|
1795
|
-
*/
|
|
1796
|
-
function MessageFunctionDeclaration(props) {
|
|
1797
|
-
const { type, variant, consoleFnName, description, prefix, parameters, timestamp, color = variant } = props;
|
|
1798
|
-
const theme = useTheme();
|
|
1799
|
-
return [createComponent(TSDoc, {
|
|
1800
|
-
get heading() {
|
|
1801
|
-
return `Write ${getIndefiniteArticle(description)} ${description} message to the console.`;
|
|
1802
|
-
},
|
|
1803
|
-
get children() {
|
|
1804
|
-
return [
|
|
1805
|
-
createComponent(TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
|
|
1806
|
-
createIntrinsic("hbr", {}),
|
|
1807
|
-
createComponent(TSDocParam, {
|
|
1808
|
-
name: "message",
|
|
1809
|
-
children: `The message to write to the console.`
|
|
1810
|
-
})
|
|
1811
|
-
];
|
|
1812
|
-
}
|
|
1813
|
-
}), createComponent(FunctionDeclaration, {
|
|
1814
|
-
"export": true,
|
|
1815
|
-
name: type,
|
|
1816
|
-
parameters: parameters ?? [{
|
|
1817
|
-
name: "message",
|
|
1818
|
-
type: "string",
|
|
1819
|
-
optional: false
|
|
1820
|
-
}],
|
|
1821
|
-
get children() {
|
|
1822
|
-
return [createComponent(Show, {
|
|
1823
|
-
get when() {
|
|
1824
|
-
return Boolean(prefix);
|
|
1825
|
-
},
|
|
1826
|
-
get children() {
|
|
1827
|
-
return [
|
|
1828
|
-
prefix,
|
|
1829
|
-
createIntrinsic("hbr", {}),
|
|
1830
|
-
createIntrinsic("hbr", {})
|
|
1831
|
-
];
|
|
1832
|
-
}
|
|
1833
|
-
}), memo(() => code`
|
|
1834
|
-
if (!message) {
|
|
1835
|
-
return;
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
${!theme.labels.message.footer[variant] && timestamp ? `const timestamp = \`\${colors.text.message.footer.${color}(new Date().toLocaleDateString())} \${colors.border.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}")} \${colors.text.message.footer.${color}(new Date().toLocaleTimeString())}\`; ` : ""}
|
|
1839
|
-
|
|
1840
|
-
writeLine("");
|
|
1841
|
-
writeLine(colors.border.message.outline.${color}("${theme.borderStyles.message.outline[variant].topLeft}") + ${theme.labels.message.header[variant] || theme.icons.message.header[variant] ? `colors.border.message.outline.${color}("${theme.borderStyles.message.outline[variant].top}".repeat(4)) + " " + ${theme.icons.message.header[variant] ? `colors.border.message.outline.${color}("${theme.icons.message.header[variant]}") + " " +` : ""} colors.bold(colors.text.message.header.${color}("${theme.labels.message.header[variant]}")) + " " + colors.border.message.outline.${color}("${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 + 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)))` : `colors.border.message.outline.${color}("${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.${color}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
|
|
1842
|
-
splitText(
|
|
1843
|
-
message,
|
|
1844
|
-
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)
|
|
1845
|
-
).forEach((line) => {
|
|
1846
|
-
writeLine(colors.border.message.outline.${color}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + colors.text.message.description.${color}(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.${color}("${theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
1847
|
-
});
|
|
1848
|
-
writeLine(colors.border.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottomLeft}") + ${theme.labels.message.footer[variant] || timestamp ? `colors.border.message.outline.${color}("${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))) + " " + ${`colors.bold(colors.text.message.footer.${color}(${theme.labels.message.footer[variant] ? `"${theme.labels.message.footer[variant]}"` : timestamp && "timestamp"}))`} + " " + colors.border.message.outline.${color}("${theme.borderStyles.message.outline[variant].bottom}".repeat(4))` : `colors.border.message.outline.${color}("${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.${color}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
|
|
1849
|
-
`)];
|
|
1850
|
-
}
|
|
1851
|
-
})];
|
|
1852
|
-
}
|
|
1853
|
-
/**
|
|
1854
|
-
* A component to generate the `wrapAnsi` function in the `shell-shock:console` builtin module.
|
|
1855
|
-
*/
|
|
1856
|
-
function WrapAnsiFunction() {
|
|
1857
|
-
return [createComponent(TSDoc, {
|
|
1858
|
-
heading: "Applies ANSI escape codes to a string.",
|
|
1859
|
-
get children() {
|
|
1860
|
-
return [
|
|
1861
|
-
createComponent(TSDocRemarks, { children: `Split text by /\\\\x1b[\\[|\\]][0-9;]*m/ and wrap non-ANSI parts with open/closeing tags.` }),
|
|
1862
|
-
createComponent(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"` }),
|
|
1863
|
-
createComponent(TSDocParam, {
|
|
1864
|
-
name: "text",
|
|
1865
|
-
children: `The text to apply ANSI codes to.`
|
|
1866
|
-
}),
|
|
1867
|
-
createComponent(TSDocParam, {
|
|
1868
|
-
name: "open",
|
|
1869
|
-
children: `The opening ANSI code.`
|
|
1870
|
-
}),
|
|
1871
|
-
createComponent(TSDocParam, {
|
|
1872
|
-
name: "close",
|
|
1873
|
-
children: `The closing ANSI code.`
|
|
1874
|
-
}),
|
|
1875
|
-
createComponent(TSDocReturns, { children: `The text with ANSI codes applied.` })
|
|
1876
|
-
];
|
|
1877
|
-
}
|
|
1878
|
-
}), createComponent(FunctionDeclaration, {
|
|
1879
|
-
name: "wrapAnsi",
|
|
1880
|
-
parameters: [
|
|
1881
|
-
{
|
|
1882
|
-
name: "text",
|
|
1883
|
-
type: "string | number",
|
|
1884
|
-
optional: false
|
|
1885
|
-
},
|
|
1886
|
-
{
|
|
1887
|
-
name: "open",
|
|
1888
|
-
type: "string",
|
|
1889
|
-
optional: false
|
|
1890
|
-
},
|
|
1891
|
-
{
|
|
1892
|
-
name: "close",
|
|
1893
|
-
type: "string",
|
|
1894
|
-
optional: false
|
|
1895
|
-
}
|
|
1896
|
-
],
|
|
1897
|
-
children: code`const str = String(text);
|
|
1898
|
-
const tokens = [] as string[];
|
|
1899
|
-
|
|
1900
|
-
let last = 0;
|
|
1901
|
-
let match: RegExpExecArray | null;
|
|
1902
|
-
while ((match = /\\\\x1b[\\[|\\]][0-9;]*m/g.exec(str)) !== null) {
|
|
1903
|
-
if (match.index > last) tokens.push(str.slice(last, match.index));
|
|
1904
|
-
tokens.push(match[0]);
|
|
1905
|
-
last = match.index + match[0].length;
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
if (last < str.length) {
|
|
1909
|
-
tokens.push(str.slice(last));
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
let result = "";
|
|
1913
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
1914
|
-
const seg = tokens[i]!;
|
|
1915
|
-
if (/^\\\\x1b[\\[|\\]][0-9;]*m$/.test(seg)) {
|
|
1916
|
-
result += seg;
|
|
1917
|
-
continue;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
if (!seg) {
|
|
1921
|
-
continue;
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
result += i > 0 && /^\\\\x1b[\\[|\\]][0-9;]*m$/.test(tokens[i - 1]!) && i + 1 < tokens.length && /^\\\\x1b[\\[|\\]][0-9;]*m$/.test(tokens[i + 1]!)
|
|
1925
|
-
? seg
|
|
1926
|
-
: \`\${open}\${seg}\${close}\`;
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
|
-
return result;
|
|
1930
|
-
`
|
|
1931
|
-
})];
|
|
1932
|
-
}
|
|
1933
|
-
/**
|
|
1934
|
-
* A component to generate the `stripAnsi` function in the `shell-shock:console` builtin module.
|
|
1935
|
-
*/
|
|
1936
|
-
function StripAnsiFunctionDeclaration() {
|
|
1937
|
-
return [createComponent(TSDoc, {
|
|
1938
|
-
heading: "Removes ANSI escape codes from a string.",
|
|
1939
|
-
get children() {
|
|
1940
|
-
return [
|
|
1941
|
-
createComponent(TSDocExample, { children: `const result = stripAnsi("Hello\\\\x1b[31mWorld\\\\x1b[0mAgain"); // "HelloWorldAgain"` }),
|
|
1942
|
-
createComponent(TSDocParam, {
|
|
1943
|
-
name: "text",
|
|
1944
|
-
children: `The text to strip ANSI codes from.`
|
|
1945
|
-
}),
|
|
1946
|
-
createComponent(TSDocReturns, { children: `The text with ANSI codes removed.` })
|
|
1947
|
-
];
|
|
1948
|
-
}
|
|
1949
|
-
}), createComponent(FunctionDeclaration, {
|
|
1950
|
-
"export": true,
|
|
1951
|
-
name: "stripAnsi",
|
|
1952
|
-
parameters: [{
|
|
1953
|
-
name: "text",
|
|
1954
|
-
type: "string | number",
|
|
1955
|
-
optional: false
|
|
1956
|
-
}],
|
|
1957
|
-
children: code`return String(text).replace(new RegExp([
|
|
1958
|
-
String.raw\`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)\`,
|
|
1959
|
-
String.raw\`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))\`
|
|
1960
|
-
].join("|"), "g"), "");`
|
|
1961
|
-
})];
|
|
1962
|
-
}
|
|
1963
|
-
/**
|
|
1964
|
-
* A component to generate the `stripAnsi` function in the `shell-shock:console` builtin module.
|
|
1965
|
-
*/
|
|
1966
|
-
function DividerFunctionDeclaration() {
|
|
1967
|
-
const theme = useTheme();
|
|
1968
|
-
return [
|
|
1969
|
-
createComponent(InterfaceDeclaration, {
|
|
1970
|
-
"export": true,
|
|
1971
|
-
name: "DividerOptions",
|
|
1972
|
-
doc: "Options for formatting the divider line written to console.",
|
|
1973
|
-
get children() {
|
|
1974
|
-
return [
|
|
1975
|
-
createComponent(InterfaceMember, {
|
|
1976
|
-
name: "width",
|
|
1977
|
-
optional: true,
|
|
1978
|
-
type: "number",
|
|
1979
|
-
doc: "The width of the divider line. If not specified, the divider will span the full width of the console, minus the padding."
|
|
1980
|
-
}),
|
|
1981
|
-
createIntrinsic("hbr", {}),
|
|
1982
|
-
createComponent(TSDoc, {
|
|
1983
|
-
heading: "The border of the divider line. Can be 'primary', 'secondary', 'tertiary', or 'none'. If not specified, the default border style will be used.",
|
|
1984
|
-
get children() {
|
|
1985
|
-
return [createComponent(TSDocRemarks, { children: `The value provided will determine the border style and color based on the current theme configuration.` }), createComponent(TSDocDefaultValue, {
|
|
1986
|
-
get type() {
|
|
1987
|
-
return ReflectionKind.string;
|
|
1988
|
-
},
|
|
1989
|
-
defaultValue: "primary"
|
|
1990
|
-
})];
|
|
1991
|
-
}
|
|
1992
|
-
}),
|
|
1993
|
-
createComponent(InterfaceMember, {
|
|
1994
|
-
name: "border",
|
|
1995
|
-
optional: true,
|
|
1996
|
-
type: "\"primary\" | \"secondary\" | \"tertiary\"",
|
|
1997
|
-
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."
|
|
1998
|
-
}),
|
|
1999
|
-
createIntrinsic("hbr", {}),
|
|
2000
|
-
createComponent(TSDoc, {
|
|
2001
|
-
heading: "Padding to apply to the line",
|
|
2002
|
-
get children() {
|
|
2003
|
-
return [createComponent(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.` }), createComponent(TSDocDefaultValue, {
|
|
2004
|
-
get type() {
|
|
2005
|
-
return ReflectionKind.number;
|
|
2006
|
-
},
|
|
2007
|
-
get defaultValue() {
|
|
2008
|
-
return theme.padding.app * 4;
|
|
2009
|
-
}
|
|
2010
|
-
})];
|
|
2011
|
-
}
|
|
2012
|
-
}),
|
|
2013
|
-
createComponent(InterfaceMember, {
|
|
2014
|
-
name: "padding",
|
|
2015
|
-
optional: true,
|
|
2016
|
-
type: "number"
|
|
2017
|
-
})
|
|
2018
|
-
];
|
|
2019
|
-
}
|
|
2020
|
-
}),
|
|
2021
|
-
createComponent(Spacing, {}),
|
|
2022
|
-
createComponent(TSDoc, {
|
|
2023
|
-
heading: "Write a divider line to the console.",
|
|
2024
|
-
get children() {
|
|
2025
|
-
return [createComponent(TSDocExample, { children: `divider({ width: 50, border: "primary" }); // Writes a divider line of width 50 with primary border.` }), createComponent(TSDocParam, {
|
|
2026
|
-
name: "options",
|
|
2027
|
-
children: `Options for formatting the divider line.`
|
|
2028
|
-
})];
|
|
2029
|
-
}
|
|
2030
|
-
}),
|
|
2031
|
-
createComponent(FunctionDeclaration, {
|
|
2032
|
-
"export": true,
|
|
2033
|
-
name: "divider",
|
|
2034
|
-
parameters: [{
|
|
2035
|
-
name: "options",
|
|
2036
|
-
type: "DividerOptions",
|
|
2037
|
-
optional: false
|
|
2038
|
-
}],
|
|
2039
|
-
get children() {
|
|
2040
|
-
return code`const padding = options.padding ?? ${Math.max(theme.padding.app, 1) * 4};
|
|
2041
|
-
const width = options.width ?? (process.stdout.columns - (Math.max(padding, 0) * 2));
|
|
2042
|
-
const border = options.border === "tertiary" ? colors.border.app.divider.tertiary("${theme.borderStyles.app.divider.tertiary.top}") : options.border === "secondary" ? colors.border.app.divider.secondary("${theme.borderStyles.app.divider.secondary.top}") : colors.border.app.divider.primary("${theme.borderStyles.app.divider.primary.top}");
|
|
2043
|
-
|
|
2044
|
-
writeLine(" ".repeat(Math.max(padding - ${theme.padding.app}, 0)) + border.repeat(Math.max(width / ${theme.borderStyles.app.divider.primary.top.length ?? 1}, 0)));
|
|
2045
|
-
`;
|
|
2046
|
-
}
|
|
2047
|
-
})
|
|
2048
|
-
];
|
|
2049
|
-
}
|
|
2050
|
-
/**
|
|
2051
|
-
* A component to generate the `link` function in the `shell-shock:console` builtin module.
|
|
2052
|
-
*/
|
|
2053
|
-
function LinkFunctionDeclaration() {
|
|
2054
|
-
return [createComponent(TSDoc, {
|
|
2055
|
-
heading: "Render a hyperlink in the console.",
|
|
2056
|
-
get children() {
|
|
2057
|
-
return [
|
|
2058
|
-
createComponent(TSDocParam, {
|
|
2059
|
-
name: "url",
|
|
2060
|
-
children: `The URL to render as a hyperlink.`
|
|
2061
|
-
}),
|
|
2062
|
-
createComponent(TSDocParam, {
|
|
2063
|
-
name: "text",
|
|
2064
|
-
children: `The text to display for the link. If not provided, the URL will be used as the text.`
|
|
2065
|
-
}),
|
|
2066
|
-
createComponent(TSDocReturns, { children: `The formatted hyperlink string.` })
|
|
2067
|
-
];
|
|
2068
|
-
}
|
|
2069
|
-
}), createComponent(FunctionDeclaration, {
|
|
2070
|
-
"export": true,
|
|
2071
|
-
name: "link",
|
|
2072
|
-
parameters: [{
|
|
2073
|
-
name: "url",
|
|
2074
|
-
type: "string",
|
|
2075
|
-
optional: false
|
|
2076
|
-
}, {
|
|
2077
|
-
name: "text",
|
|
2078
|
-
type: "string",
|
|
2079
|
-
optional: true
|
|
2080
|
-
}],
|
|
2081
|
-
get children() {
|
|
2082
|
-
return [
|
|
2083
|
-
createComponent(IfStatement, {
|
|
2084
|
-
condition: code`isHyperlinkSupported()`,
|
|
2085
|
-
children: code`return \`\\x1b]8;;\${url}\\u0007\${text ?? url}\\x1b]8;;\\u0007\`;`
|
|
2086
|
-
}),
|
|
2087
|
-
createIntrinsic("hbr", {}),
|
|
2088
|
-
createComponent(IfStatement, {
|
|
2089
|
-
condition: code`isColorSupported`,
|
|
2090
|
-
children: code`return colors.underline(colors.text.body.link(\`$\{text ?? url\} $\{url\}\`));`
|
|
2091
|
-
}),
|
|
2092
|
-
createIntrinsic("hbr", {}),
|
|
2093
|
-
code`return \`$\{text ?? url\} $\{url\}\`;`
|
|
2094
|
-
];
|
|
2095
|
-
}
|
|
2096
|
-
})];
|
|
2097
|
-
}
|
|
2098
|
-
function extractBorderOptionsObject(direction, theme) {
|
|
2099
|
-
return `borderOptions.${direction} === "primary" ? colors.border.app.table.primary("${theme.borderStyles.app.table.primary[direction]}") : borderOptions.${direction} === "secondary" ? colors.border.app.table.secondary("${theme.borderStyles.app.table.secondary[direction]}") : borderOptions.${direction} === "tertiary" ? colors.border.app.table.tertiary("${theme.borderStyles.app.table.tertiary[direction]}") : !borderOptions.${direction} || borderOptions.${direction} === "none" ? "" : borderOptions.${direction}`;
|
|
2100
|
-
}
|
|
2101
|
-
function extractBorderOptionsString(direction, theme) {
|
|
2102
|
-
return `borderOptions === "primary" ? colors.border.app.table.primary("${theme.borderStyles.app.table.primary[direction]}") : borderOptions === "secondary" ? colors.border.app.table.secondary("${theme.borderStyles.app.table.secondary[direction]}") : borderOptions === "tertiary" ? colors.border.app.table.tertiary("${theme.borderStyles.app.table.tertiary[direction]}") : !borderOptions || borderOptions === "none" ? "" : borderOptions`;
|
|
2103
|
-
}
|
|
2104
|
-
/**
|
|
2105
|
-
* Props for the TableFunctionDeclaration component.
|
|
2106
|
-
*/
|
|
2107
|
-
/**
|
|
2108
|
-
* A component to generate the table functions in the `shell-shock:console` builtin module.
|
|
2109
|
-
*/
|
|
2110
|
-
function TableFunctionDeclaration(props) {
|
|
2111
|
-
const theme = useTheme();
|
|
2112
|
-
return [
|
|
2113
|
-
createComponent(TypeDeclaration, {
|
|
2114
|
-
"export": true,
|
|
2115
|
-
name: "SizeToken",
|
|
2116
|
-
doc: "A type representing the width size of an item in the console.",
|
|
2117
|
-
children: 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%"`
|
|
2118
|
-
}),
|
|
2119
|
-
createComponent(Spacing, {}),
|
|
2120
|
-
createComponent(TSDoc, {
|
|
2121
|
-
heading: "Determine if a value is a valid size token.",
|
|
2122
|
-
get children() {
|
|
2123
|
-
return [
|
|
2124
|
-
createComponent(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%").` }),
|
|
2125
|
-
createComponent(TSDocParam, {
|
|
2126
|
-
name: "value",
|
|
2127
|
-
children: `The value to check for being a valid size token.`
|
|
2128
|
-
}),
|
|
2129
|
-
createComponent(TSDocReturns, { children: `True if the value is a valid size token, false otherwise.` })
|
|
2130
|
-
];
|
|
2131
|
-
}
|
|
2132
|
-
}),
|
|
2133
|
-
createComponent(FunctionDeclaration, {
|
|
2134
|
-
"export": true,
|
|
2135
|
-
doc: "Determines if the provided value is a valid size token.",
|
|
2136
|
-
name: "isSizeToken",
|
|
2137
|
-
parameters: [{
|
|
2138
|
-
name: "value",
|
|
2139
|
-
type: "any"
|
|
2140
|
-
}],
|
|
2141
|
-
returnType: "value is SizeToken",
|
|
2142
|
-
get children() {
|
|
2143
|
-
return [createComponent(IfStatement, {
|
|
2144
|
-
condition: 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)`,
|
|
2145
|
-
children: code`return true; `
|
|
2146
|
-
}), code`return false; `];
|
|
2147
|
-
}
|
|
2148
|
-
}),
|
|
2149
|
-
createComponent(Spacing, {}),
|
|
2150
|
-
createComponent(TSDoc, {
|
|
2151
|
-
heading: "Calculate the width in characters based on the provided width size.",
|
|
2152
|
-
get children() {
|
|
2153
|
-
return [
|
|
2154
|
-
createComponent(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 (process.stdout.columns).` }),
|
|
2155
|
-
createComponent(TSDocParam, {
|
|
2156
|
-
name: "size",
|
|
2157
|
-
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%").`
|
|
2158
|
-
}),
|
|
2159
|
-
createComponent(TSDocReturns, { children: `The calculated width in characters.` })
|
|
2160
|
-
];
|
|
2161
|
-
}
|
|
2162
|
-
}),
|
|
2163
|
-
createComponent(FunctionDeclaration, {
|
|
2164
|
-
"export": true,
|
|
2165
|
-
name: "calculateWidth",
|
|
2166
|
-
parameters: [{
|
|
2167
|
-
name: "size",
|
|
2168
|
-
type: "SizeToken",
|
|
2169
|
-
optional: false
|
|
2170
|
-
}],
|
|
2171
|
-
returnType: "number",
|
|
2172
|
-
get children() {
|
|
2173
|
-
return [
|
|
2174
|
-
createComponent(IfStatement, {
|
|
2175
|
-
condition: code`["full", "100%", "1/1"]. includes(size)`,
|
|
2176
|
-
children: code`return process.stdout.columns;`
|
|
2177
|
-
}),
|
|
2178
|
-
createComponent(ElseIfClause, {
|
|
2179
|
-
condition: code`["1/2", "50%"].includes(size)`,
|
|
2180
|
-
children: code`return Math.round(process.stdout.columns / 2);`
|
|
2181
|
-
}),
|
|
2182
|
-
createComponent(ElseIfClause, {
|
|
2183
|
-
condition: code`["1/3", "33.33%"].includes(size)`,
|
|
2184
|
-
children: code`return Math.round(process.stdout.columns / 3);`
|
|
2185
|
-
}),
|
|
2186
|
-
createComponent(ElseIfClause, {
|
|
2187
|
-
condition: code`["1/4", "25%"].includes(size)`,
|
|
2188
|
-
children: code`return Math.round(process.stdout.columns / 4);`
|
|
2189
|
-
}),
|
|
2190
|
-
createComponent(ElseIfClause, {
|
|
2191
|
-
condition: code`["1/5", "20%"].includes(size)`,
|
|
2192
|
-
children: code`return Math.round(process.stdout.columns / 5);`
|
|
2193
|
-
}),
|
|
2194
|
-
createComponent(ElseIfClause, {
|
|
2195
|
-
condition: code`["1/6", "10%"].includes(size)`,
|
|
2196
|
-
children: code`return Math.round(process.stdout.columns / 6);`
|
|
2197
|
-
}),
|
|
2198
|
-
createComponent(ElseIfClause, {
|
|
2199
|
-
condition: code`["1/12", "5%"].includes(size)`,
|
|
2200
|
-
children: code`return Math.round(process.stdout.columns / 12);`
|
|
2201
|
-
}),
|
|
2202
|
-
createComponent(ElseIfClause, {
|
|
2203
|
-
condition: code`["1/24", "2.5%"].includes(size)`,
|
|
2204
|
-
children: code`return Math.round(process.stdout.columns / 24);`
|
|
2205
|
-
}),
|
|
2206
|
-
createComponent(ElseClause, { children: code`
|
|
2207
|
-
const match = size.match(/(\\d+(\\.\\d+)?)%/);
|
|
2208
|
-
if (match) {
|
|
2209
|
-
return Math.round((process.stdout.columns * parseFloat(match[1])) / 100);
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
throw new Error(\`Invalid width size: \${size}\`);
|
|
2213
|
-
` }),
|
|
2214
|
-
createIntrinsic("hbr", {}),
|
|
2215
|
-
createIntrinsic("hbr", {})
|
|
2216
|
-
];
|
|
2217
|
-
}
|
|
2218
|
-
}),
|
|
2219
|
-
createComponent(TypeDeclaration, {
|
|
2220
|
-
"export": true,
|
|
2221
|
-
name: "BorderOption",
|
|
2222
|
-
doc: "The border options applied to table cells.",
|
|
2223
|
-
children: code`"primary" | "secondary" | "tertiary" | "none" | string; `
|
|
2224
|
-
}),
|
|
2225
|
-
createComponent(Spacing, {}),
|
|
2226
|
-
createComponent(InterfaceDeclaration, {
|
|
2227
|
-
"export": true,
|
|
2228
|
-
name: "TableOutputOptions",
|
|
2229
|
-
doc: "Options to customize the output of the {@link table} function.",
|
|
2230
|
-
get children() {
|
|
2231
|
-
return [
|
|
2232
|
-
createComponent(TSDoc, {
|
|
2233
|
-
heading: "Border variant for the table cell.",
|
|
2234
|
-
get children() {
|
|
2235
|
-
return [
|
|
2236
|
-
createComponent(TSDocRemarks, { children: `The border variant to use for the table cell. This determines the color and style of the border around the cell.` }),
|
|
2237
|
-
createIntrinsic("hbr", {}),
|
|
2238
|
-
createComponent(TSDocDefaultValue, {
|
|
2239
|
-
get type() {
|
|
2240
|
-
return ReflectionKind.property;
|
|
2241
|
-
},
|
|
2242
|
-
defaultValue: "primary"
|
|
2243
|
-
})
|
|
2244
|
-
];
|
|
2245
|
-
}
|
|
2246
|
-
}),
|
|
2247
|
-
createComponent(InterfaceMember, {
|
|
2248
|
-
name: "border",
|
|
2249
|
-
optional: true,
|
|
2250
|
-
type: "BorderOption | { top?: BorderOption; right?: BorderOption; bottom?: BorderOption; left?: BorderOption; topLeft?: BorderOption; topRight?: BorderOption; bottomLeft?: BorderOption; bottomRight?: BorderOption; }"
|
|
2251
|
-
}),
|
|
2252
|
-
createIntrinsic("hbr", {}),
|
|
2253
|
-
createComponent(TSDoc, {
|
|
2254
|
-
heading: "Padding for the table cell.",
|
|
2255
|
-
get children() {
|
|
2256
|
-
return [
|
|
2257
|
-
createComponent(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.` }),
|
|
2258
|
-
createIntrinsic("hbr", {}),
|
|
2259
|
-
createComponent(TSDocDefaultValue, {
|
|
2260
|
-
get type() {
|
|
2261
|
-
return ReflectionKind.property;
|
|
2262
|
-
},
|
|
2263
|
-
get defaultValue() {
|
|
2264
|
-
return `\`${theme.padding.table}\``;
|
|
2265
|
-
}
|
|
2266
|
-
})
|
|
2267
|
-
];
|
|
2268
|
-
}
|
|
2269
|
-
}),
|
|
2270
|
-
createComponent(InterfaceMember, {
|
|
2271
|
-
name: "padding",
|
|
2272
|
-
optional: true,
|
|
2273
|
-
type: "number"
|
|
2274
|
-
}),
|
|
2275
|
-
createIntrinsic("hbr", {}),
|
|
2276
|
-
createComponent(TSDoc, {
|
|
2277
|
-
heading: "Alignment for the table cell.",
|
|
2278
|
-
get children() {
|
|
2279
|
-
return [
|
|
2280
|
-
createComponent(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".` }),
|
|
2281
|
-
createIntrinsic("hbr", {}),
|
|
2282
|
-
createComponent(TSDocDefaultValue, {
|
|
2283
|
-
get type() {
|
|
2284
|
-
return ReflectionKind.property;
|
|
2285
|
-
},
|
|
2286
|
-
defaultValue: "left"
|
|
2287
|
-
})
|
|
2288
|
-
];
|
|
2289
|
-
}
|
|
2290
|
-
}),
|
|
2291
|
-
createComponent(InterfaceMember, {
|
|
2292
|
-
name: "align",
|
|
2293
|
-
optional: true,
|
|
2294
|
-
type: "\"left\" | \"right\" | \"center\""
|
|
2295
|
-
}),
|
|
2296
|
-
createIntrinsic("hbr", {})
|
|
2297
|
-
];
|
|
2298
|
-
}
|
|
2299
|
-
}),
|
|
2300
|
-
createComponent(Spacing, {}),
|
|
2301
|
-
createComponent(InterfaceDeclaration, {
|
|
2302
|
-
"export": true,
|
|
2303
|
-
name: "TableCellOptions",
|
|
2304
|
-
"extends": "TableOutputOptions",
|
|
2305
|
-
doc: "Options for a specific table cell provided to the {@link table} function.",
|
|
2306
|
-
get children() {
|
|
2307
|
-
return [
|
|
2308
|
-
createComponent(InterfaceMember, {
|
|
2309
|
-
name: "value",
|
|
2310
|
-
optional: true,
|
|
2311
|
-
type: "string",
|
|
2312
|
-
doc: "The actual string value of the table cell."
|
|
2313
|
-
}),
|
|
2314
|
-
createIntrinsic("hbr", {}),
|
|
2315
|
-
createComponent(TSDoc, {
|
|
2316
|
-
heading: "Width of the table cell.",
|
|
2317
|
-
get children() {
|
|
2318
|
-
return createComponent(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.` });
|
|
2319
|
-
}
|
|
2320
|
-
}),
|
|
2321
|
-
createComponent(InterfaceMember, {
|
|
2322
|
-
name: "maxWidth",
|
|
2323
|
-
type: "number | SizeToken | undefined"
|
|
2324
|
-
}),
|
|
2325
|
-
createIntrinsic("hbr", {})
|
|
2326
|
-
];
|
|
2327
|
-
}
|
|
2328
|
-
}),
|
|
2329
|
-
createComponent(Spacing, {}),
|
|
2330
|
-
createComponent(InterfaceDeclaration, {
|
|
2331
|
-
"export": true,
|
|
2332
|
-
name: "TableRowOptions",
|
|
2333
|
-
"extends": "TableOutputOptions",
|
|
2334
|
-
doc: "Options for a specific table row provided to the {@link table} function.",
|
|
2335
|
-
get children() {
|
|
2336
|
-
return [createComponent(InterfaceMember, {
|
|
2337
|
-
name: "values",
|
|
2338
|
-
optional: true,
|
|
2339
|
-
type: "(string | TableCellOptions)[]",
|
|
2340
|
-
doc: "The actual string values of the table row's cells."
|
|
2341
|
-
}), createIntrinsic("hbr", {})];
|
|
2342
|
-
}
|
|
2343
|
-
}),
|
|
2344
|
-
createComponent(Spacing, {}),
|
|
2345
|
-
createComponent(InterfaceDeclaration, {
|
|
2346
|
-
"export": true,
|
|
2347
|
-
name: "TableOptions",
|
|
2348
|
-
"extends": "TableOutputOptions",
|
|
2349
|
-
doc: "Options for a specific table cell provided to the {@link table} function.",
|
|
2350
|
-
get children() {
|
|
2351
|
-
return [createComponent(InterfaceMember, {
|
|
2352
|
-
name: "values",
|
|
2353
|
-
optional: true,
|
|
2354
|
-
type: "(string | TableCellOptions)[][]",
|
|
2355
|
-
doc: "The actual string values of the table's rows' cells."
|
|
2356
|
-
}), createIntrinsic("hbr", {})];
|
|
2357
|
-
}
|
|
2358
|
-
}),
|
|
2359
|
-
createComponent(Spacing, {}),
|
|
2360
|
-
createComponent(InterfaceDeclaration, {
|
|
2361
|
-
name: "Dimensions",
|
|
2362
|
-
doc: "The height and width for a specific table/cell used internally in the {@link table} function.",
|
|
2363
|
-
get children() {
|
|
2364
|
-
return [
|
|
2365
|
-
createComponent(InterfaceMember, {
|
|
2366
|
-
name: "height",
|
|
2367
|
-
type: "number",
|
|
2368
|
-
doc: "The height of the row/cell (where 1 is a single line in the terminal)."
|
|
2369
|
-
}),
|
|
2370
|
-
createIntrinsic("hbr", {}),
|
|
2371
|
-
createComponent(InterfaceMember, {
|
|
2372
|
-
name: "width",
|
|
2373
|
-
type: "number",
|
|
2374
|
-
doc: "The width of the row/cell (where 1 is a single character in the terminal)."
|
|
2375
|
-
}),
|
|
2376
|
-
createIntrinsic("hbr", {})
|
|
2377
|
-
];
|
|
2378
|
-
}
|
|
2379
|
-
}),
|
|
2380
|
-
createComponent(Spacing, {}),
|
|
2381
|
-
createComponent(InterfaceDeclaration, {
|
|
2382
|
-
name: "TableCellBorder",
|
|
2383
|
-
doc: "The resolved complete border styles for a table cell.",
|
|
2384
|
-
get children() {
|
|
2385
|
-
return [
|
|
2386
|
-
createComponent(InterfaceMember, {
|
|
2387
|
-
name: "top",
|
|
2388
|
-
type: "string",
|
|
2389
|
-
doc: "The top border style of the table cell."
|
|
2390
|
-
}),
|
|
2391
|
-
createIntrinsic("hbr", {}),
|
|
2392
|
-
createComponent(InterfaceMember, {
|
|
2393
|
-
name: "bottom",
|
|
2394
|
-
type: "string",
|
|
2395
|
-
doc: "The bottom border style of the table cell."
|
|
2396
|
-
}),
|
|
2397
|
-
createIntrinsic("hbr", {}),
|
|
2398
|
-
createComponent(InterfaceMember, {
|
|
2399
|
-
name: "right",
|
|
2400
|
-
type: "string",
|
|
2401
|
-
doc: "The right border style of the table cell."
|
|
2402
|
-
}),
|
|
2403
|
-
createIntrinsic("hbr", {}),
|
|
2404
|
-
createComponent(InterfaceMember, {
|
|
2405
|
-
name: "left",
|
|
2406
|
-
type: "string",
|
|
2407
|
-
doc: "The left border style of the table cell."
|
|
2408
|
-
}),
|
|
2409
|
-
createIntrinsic("hbr", {}),
|
|
2410
|
-
createComponent(InterfaceMember, {
|
|
2411
|
-
name: "topLeft",
|
|
2412
|
-
type: "string",
|
|
2413
|
-
doc: "The top-left border style of the table cell."
|
|
2414
|
-
}),
|
|
2415
|
-
createIntrinsic("hbr", {}),
|
|
2416
|
-
createComponent(InterfaceMember, {
|
|
2417
|
-
name: "topRight",
|
|
2418
|
-
type: "string",
|
|
2419
|
-
doc: "The top-right border style of the table cell."
|
|
2420
|
-
}),
|
|
2421
|
-
createIntrinsic("hbr", {}),
|
|
2422
|
-
createComponent(InterfaceMember, {
|
|
2423
|
-
name: "bottomLeft",
|
|
2424
|
-
type: "string",
|
|
2425
|
-
doc: "The bottom-left border style of the table cell."
|
|
2426
|
-
}),
|
|
2427
|
-
createIntrinsic("hbr", {}),
|
|
2428
|
-
createComponent(InterfaceMember, {
|
|
2429
|
-
name: "bottomRight",
|
|
2430
|
-
type: "string",
|
|
2431
|
-
doc: "The bottom-right border style of the table cell."
|
|
2432
|
-
}),
|
|
2433
|
-
createIntrinsic("hbr", {})
|
|
2434
|
-
];
|
|
2435
|
-
}
|
|
2436
|
-
}),
|
|
2437
|
-
createComponent(Spacing, {}),
|
|
2438
|
-
createComponent(TypeDeclaration, {
|
|
2439
|
-
name: "TableCell",
|
|
2440
|
-
doc: "The internal state of a formatted table cell in the {@link table} function.",
|
|
2441
|
-
children: code`Required<Omit<TableCellOptions, "maxWidth" | "border">> & Dimensions & {
|
|
2442
|
-
border: TableCellBorder;
|
|
2443
|
-
maxWidth?: number;
|
|
2444
|
-
};
|
|
2445
|
-
`
|
|
2446
|
-
}),
|
|
2447
|
-
createComponent(Spacing, {}),
|
|
2448
|
-
createComponent(TSDoc, {
|
|
2449
|
-
heading: "Write a table to the console.",
|
|
2450
|
-
get children() {
|
|
2451
|
-
return [
|
|
2452
|
-
createComponent(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.` }),
|
|
2453
|
-
createIntrinsic("hbr", {}),
|
|
2454
|
-
createComponent(TSDocParam, {
|
|
2455
|
-
name: "options",
|
|
2456
|
-
children: `Options to customize the table output.`
|
|
2457
|
-
})
|
|
2458
|
-
];
|
|
2459
|
-
}
|
|
2460
|
-
}),
|
|
2461
|
-
createComponent(FunctionDeclaration, mergeProps({ "export": true }, props, {
|
|
2462
|
-
name: "table",
|
|
2463
|
-
parameters: [{
|
|
2464
|
-
name: "options",
|
|
2465
|
-
type: "TableOptions | TableRowOptions[] | TableCellOptions[][] | string[] | string[][]",
|
|
2466
|
-
optional: false
|
|
2467
|
-
}],
|
|
2468
|
-
get children() {
|
|
2469
|
-
return [
|
|
2470
|
-
createComponent(IfStatement, {
|
|
2471
|
-
condition: code`!options ||
|
|
2472
|
-
(!Array.isArray(options) && (typeof options !== "object" || !options.values || !Array.isArray(options.values) || options.values.length === 0)) ||
|
|
2473
|
-
(Array.isArray(options) && !options.every(item => typeof item === "object" || typeof item === "string" || Array.isArray(item))) `,
|
|
2474
|
-
children: code`return;`
|
|
2475
|
-
}),
|
|
2476
|
-
createIntrinsic("hbr", {}),
|
|
2477
|
-
createIntrinsic("hbr", {}),
|
|
2478
|
-
createComponent(VarDeclaration, {
|
|
2479
|
-
"let": true,
|
|
2480
|
-
name: "cells",
|
|
2481
|
-
type: `TableCell[][]`,
|
|
2482
|
-
initializer: code`[];`
|
|
2483
|
-
}),
|
|
2484
|
-
createIntrinsic("hbr", {}),
|
|
2485
|
-
memo(() => code`
|
|
2486
|
-
const extractTableCell = (cell: string | TableCellOptions, columnIndex: number, rowLength: number, opts?: TableOutputOptions): TableCell => {
|
|
2487
|
-
if (typeof cell === "string") {
|
|
2488
|
-
const borderOptions = opts?.border || "primary";
|
|
2489
|
-
|
|
2490
|
-
let border = {} as TableCellBorder;
|
|
2491
|
-
if (typeof borderOptions === "object") {
|
|
2492
|
-
border = {
|
|
2493
|
-
top: ${extractBorderOptionsObject("top", theme)},
|
|
2494
|
-
bottom: ${extractBorderOptionsObject("bottom", theme)},
|
|
2495
|
-
left: ${extractBorderOptionsObject("left", theme)},
|
|
2496
|
-
right: ${extractBorderOptionsObject("right", theme)},
|
|
2497
|
-
topLeft: ${extractBorderOptionsObject("topLeft", theme)},
|
|
2498
|
-
topRight: ${extractBorderOptionsObject("topRight", theme)},
|
|
2499
|
-
bottomLeft: ${extractBorderOptionsObject("bottomLeft", theme)},
|
|
2500
|
-
bottomRight: ${extractBorderOptionsObject("bottomRight", theme)},
|
|
2501
|
-
};
|
|
2502
|
-
} else {
|
|
2503
|
-
border.top = ${extractBorderOptionsString("top", theme)};
|
|
2504
|
-
border.bottom = ${extractBorderOptionsString("bottom", theme)};
|
|
2505
|
-
border.left = ${extractBorderOptionsString("left", theme)};
|
|
2506
|
-
border.right = ${extractBorderOptionsString("right", theme)};
|
|
2507
|
-
border.topLeft = ${extractBorderOptionsString("topLeft", theme)};
|
|
2508
|
-
border.topRight = ${extractBorderOptionsString("topRight", theme)};
|
|
2509
|
-
border.bottomLeft = ${extractBorderOptionsString("bottomLeft", theme)};
|
|
2510
|
-
border.bottomRight = ${extractBorderOptionsString("bottomRight", theme)};
|
|
2511
|
-
}
|
|
2512
|
-
|
|
2513
|
-
const padding = Math.max(0, opts?.padding ?? ${theme.padding.table}) * (columnIndex === 0 || columnIndex === rowLength - 1 ? 2 : 1);
|
|
2514
|
-
const value = cell ?? "";
|
|
2515
|
-
const width = stripAnsi(value).length + padding * 2;
|
|
2516
|
-
|
|
2517
|
-
return {
|
|
2518
|
-
value,
|
|
2519
|
-
height: 1,
|
|
2520
|
-
width,
|
|
2521
|
-
border,
|
|
2522
|
-
padding,
|
|
2523
|
-
align: opts?.align || "left",
|
|
2524
|
-
};
|
|
2525
|
-
} else {
|
|
2526
|
-
const borderOptions = cell.border || opts?.border || "primary";
|
|
2527
|
-
|
|
2528
|
-
let border = {} as TableCellBorder;
|
|
2529
|
-
if (typeof borderOptions === "object") {
|
|
2530
|
-
border = {
|
|
2531
|
-
top: ${extractBorderOptionsObject("top", theme)},
|
|
2532
|
-
bottom: ${extractBorderOptionsObject("bottom", theme)},
|
|
2533
|
-
left: ${extractBorderOptionsObject("left", theme)},
|
|
2534
|
-
right: ${extractBorderOptionsObject("right", theme)},
|
|
2535
|
-
topLeft: ${extractBorderOptionsObject("topLeft", theme)},
|
|
2536
|
-
topRight: ${extractBorderOptionsObject("topRight", theme)},
|
|
2537
|
-
bottomLeft: ${extractBorderOptionsObject("bottomLeft", theme)},
|
|
2538
|
-
bottomRight: ${extractBorderOptionsObject("bottomRight", theme)},
|
|
2539
|
-
};
|
|
2540
|
-
} else {
|
|
2541
|
-
border.top = ${extractBorderOptionsString("top", theme)};
|
|
2542
|
-
border.bottom = ${extractBorderOptionsString("bottom", theme)};
|
|
2543
|
-
border.left = ${extractBorderOptionsString("left", theme)};
|
|
2544
|
-
border.right = ${extractBorderOptionsString("right", theme)};
|
|
2545
|
-
border.topLeft = ${extractBorderOptionsString("topLeft", theme)};
|
|
2546
|
-
border.topRight = ${extractBorderOptionsString("topRight", theme)};
|
|
2547
|
-
border.bottomLeft = ${extractBorderOptionsString("bottomLeft", theme)};
|
|
2548
|
-
border.bottomRight = ${extractBorderOptionsString("bottomRight", theme)};
|
|
2549
|
-
}
|
|
2550
|
-
|
|
2551
|
-
const padding = Math.max(0, cell.padding ?? opts?.padding ?? ${theme.padding.table});
|
|
2552
|
-
const value = cell.value ?? "";
|
|
2553
|
-
const width = stripAnsi(value).length + padding * 2;
|
|
2554
|
-
const maxWidth = cell.maxWidth ? typeof cell.maxWidth === "number" ? cell.maxWidth : calculateWidth(cell.maxWidth) : undefined;
|
|
2555
|
-
|
|
2556
|
-
return {
|
|
2557
|
-
value,
|
|
2558
|
-
height: 1,
|
|
2559
|
-
width,
|
|
2560
|
-
maxWidth,
|
|
2561
|
-
border,
|
|
2562
|
-
padding,
|
|
2563
|
-
align: cell.align || opts?.align || "left",
|
|
2564
|
-
};
|
|
2565
|
-
}
|
|
2566
|
-
};
|
|
2567
|
-
|
|
2568
|
-
let colMaxWidths = [] as (number | undefined)[];
|
|
2569
|
-
`),
|
|
2570
|
-
createIntrinsic("hbr", {}),
|
|
2571
|
-
createComponent(IfStatement, {
|
|
2572
|
-
condition: code`Array.isArray(options)`,
|
|
2573
|
-
get children() {
|
|
2574
|
-
return [createComponent(IfStatement, {
|
|
2575
|
-
condition: code`options.every(row => typeof row === "string" || (typeof row === "object" && !Array.isArray(row) && !("values" in row)))`,
|
|
2576
|
-
children: code`cells.push(options.map((cell, index) => extractTableCell(cell as string | TableCellOptions, index, options.length)));`
|
|
2577
|
-
}), createComponent(ElseClause, { children: code`
|
|
2578
|
-
cells.push(
|
|
2579
|
-
...options.map(row => Array.isArray(row)
|
|
2580
|
-
? row.reduce((cellRow, cell, index) => {
|
|
2581
|
-
if (colMaxWidths.length <= index) {
|
|
2582
|
-
colMaxWidths.push(undefined);
|
|
2583
|
-
}
|
|
2584
|
-
const newCell = extractTableCell(cell, index, row.length);
|
|
2585
|
-
if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {
|
|
2586
|
-
colMaxWidths[index] = newCell.maxWidth;
|
|
2587
|
-
}
|
|
2588
|
-
cellRow.push(newCell);
|
|
2589
|
-
return cellRow;
|
|
2590
|
-
}, [] as TableCell[])
|
|
2591
|
-
: (row as TableRowOptions).values?.reduce((cellRow, cell, index) => {
|
|
2592
|
-
if (colMaxWidths.length <= index) {
|
|
2593
|
-
colMaxWidths.push(undefined);
|
|
2594
|
-
}
|
|
2595
|
-
const newCell = extractTableCell(cell, index, (row as TableRowOptions).values?.length ?? 1, row as TableRowOptions);
|
|
2596
|
-
if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {
|
|
2597
|
-
colMaxWidths[index] = newCell.maxWidth;
|
|
2598
|
-
}
|
|
2599
|
-
cellRow.push(newCell);
|
|
2600
|
-
return cellRow;
|
|
2601
|
-
}, [] as TableCell[]) ?? []
|
|
2602
|
-
)
|
|
2603
|
-
);
|
|
2604
|
-
` })];
|
|
2605
|
-
}
|
|
2606
|
-
}),
|
|
2607
|
-
createComponent(ElseClause, { children: code`
|
|
2608
|
-
cells.push(
|
|
2609
|
-
...options.values!.map(row => Array.isArray(row)
|
|
2610
|
-
? row.reduce((cellRow, cell, index) => {
|
|
2611
|
-
if (colMaxWidths.length <= index) {
|
|
2612
|
-
colMaxWidths.push(undefined);
|
|
2613
|
-
}
|
|
2614
|
-
const newCell = extractTableCell(cell, index, row.length);
|
|
2615
|
-
if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {
|
|
2616
|
-
colMaxWidths[index] = newCell.maxWidth;
|
|
2617
|
-
}
|
|
2618
|
-
cellRow.push(newCell);
|
|
2619
|
-
return cellRow;
|
|
2620
|
-
}, [] as TableCell[])
|
|
2621
|
-
: (row as TableRowOptions).values?.reduce((cellRow, cell, index) => {
|
|
2622
|
-
if (colMaxWidths.length <= index) {
|
|
2623
|
-
colMaxWidths.push(undefined);
|
|
2624
|
-
}
|
|
2625
|
-
const newCell = extractTableCell(cell, index, (row as TableRowOptions).values?.length ?? 1, options);
|
|
2626
|
-
if (newCell.maxWidth && (!colMaxWidths[index] || newCell.maxWidth < colMaxWidths[index]!)) {
|
|
2627
|
-
colMaxWidths[index] = newCell.maxWidth;
|
|
2628
|
-
}
|
|
2629
|
-
cellRow.push(newCell);
|
|
2630
|
-
return cellRow;
|
|
2631
|
-
}, [] as TableCell[]) ?? []
|
|
2632
|
-
)
|
|
2633
|
-
);
|
|
2634
|
-
|
|
2635
|
-
` }),
|
|
2636
|
-
createIntrinsic("hbr", {}),
|
|
2637
|
-
memo(() => code`
|
|
2638
|
-
cells = cells.filter(row => row.length > 0);
|
|
2639
|
-
if (cells.length === 0) {
|
|
2640
|
-
return;
|
|
2641
|
-
}
|
|
2642
|
-
|
|
2643
|
-
cells.forEach(row => row.forEach((cell, index) => {
|
|
2644
|
-
if (colMaxWidths[index] && cell.maxWidth !== colMaxWidths[index]!) {
|
|
2645
|
-
cell.maxWidth = colMaxWidths[index]!;
|
|
2646
|
-
}
|
|
2647
|
-
}));
|
|
2648
|
-
|
|
2649
|
-
// Calculate table dimensions
|
|
2650
|
-
let colWidths = [] as number[];
|
|
2651
|
-
let rowDims = [] as Dimensions[];
|
|
2652
|
-
|
|
2653
|
-
const calculateRowDimensions = () => {
|
|
2654
|
-
colWidths = [];
|
|
2655
|
-
return cells.reduce((dims, row) => {
|
|
2656
|
-
dims.push(row.reduce((dim, cell, index) => {
|
|
2657
|
-
dim.width += cell.width;
|
|
2658
|
-
if (cell.height > dim.height) {
|
|
2659
|
-
dim.height = cell.height;
|
|
2660
|
-
}
|
|
2661
|
-
if (!colWidths[index] || cell.width > colWidths[index]!) {
|
|
2662
|
-
colWidths[index] = cell.width;
|
|
2663
|
-
}
|
|
2664
|
-
|
|
2665
|
-
return dim;
|
|
2666
|
-
}, { width: 0, height: 0 } as Dimensions));
|
|
2667
|
-
|
|
2668
|
-
return dims;
|
|
2669
|
-
}, [] as Dimensions[]);
|
|
2670
|
-
}
|
|
2671
|
-
|
|
2672
|
-
let recalculate!: boolean;
|
|
2673
|
-
do {
|
|
2674
|
-
recalculate = false;
|
|
2675
|
-
rowDims = calculateRowDimensions();
|
|
2676
|
-
|
|
2677
|
-
if (!recalculate && colWidths.some((colWidth, index) => colMaxWidths[index] && colWidth > colMaxWidths[index]!)) {
|
|
2678
|
-
(colWidths.map((colWidth, index) => colMaxWidths[index] && colWidth > colMaxWidths[index]! ? index : undefined).filter(colWidth => colWidth !== undefined) as number[]).forEach(index => {
|
|
2679
|
-
cells.forEach(row => {
|
|
2680
|
-
const cell = row[index]!;
|
|
2681
|
-
if (colMaxWidths[index] && cell.width > colMaxWidths[index]) {
|
|
2682
|
-
const lines = splitText(
|
|
2683
|
-
cell.value,
|
|
2684
|
-
colMaxWidths[index] - cell.padding * 2,
|
|
2685
|
-
);
|
|
2686
|
-
|
|
2687
|
-
cell.value = lines.join("\\n");
|
|
2688
|
-
cell.height = lines.length;
|
|
2689
|
-
cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;
|
|
2690
|
-
|
|
2691
|
-
recalculate = true;
|
|
2692
|
-
}
|
|
2693
|
-
});
|
|
2694
|
-
});
|
|
2695
|
-
}
|
|
2696
|
-
|
|
2697
|
-
rowDims.forEach((row, rowIndex) => {
|
|
2698
|
-
if (!recalculate && row.width > Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
|
|
2699
|
-
const cell = cells[rowIndex]!.reduce((largestCell, cell) => {
|
|
2700
|
-
if (cell.width > largestCell.width) {
|
|
2701
|
-
return cell;
|
|
2702
|
-
}
|
|
2703
|
-
return largestCell;
|
|
2704
|
-
}, cells[rowIndex]![0]!);
|
|
2705
|
-
|
|
2706
|
-
const lines = splitText(
|
|
2707
|
-
cell.value,
|
|
2708
|
-
Math.min(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (row.width - (cell.width - cell.padding * 2)), 0),
|
|
2709
|
-
cell.maxWidth ?? Number.POSITIVE_INFINITY)
|
|
2710
|
-
);
|
|
2711
|
-
|
|
2712
|
-
cell.value = lines.join("\\n");
|
|
2713
|
-
cell.height = lines.length;
|
|
2714
|
-
cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;
|
|
2715
|
-
|
|
2716
|
-
recalculate = true;
|
|
2717
|
-
}
|
|
2718
|
-
});
|
|
2719
|
-
|
|
2720
|
-
if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
|
|
2721
|
-
let colIndex = 0;
|
|
2722
|
-
const cell = cells.reduce((ret, row) => {
|
|
2723
|
-
return row.reduce((largest, current, index) => {
|
|
2724
|
-
if (largest.width < current.width) {
|
|
2725
|
-
colIndex = index;
|
|
2726
|
-
return current;
|
|
2727
|
-
}
|
|
2728
|
-
return largest;
|
|
2729
|
-
}, ret);
|
|
2730
|
-
}, cells[0]![0]!);
|
|
2731
|
-
|
|
2732
|
-
const lines = splitText(
|
|
2733
|
-
cell.value,
|
|
2734
|
-
Math.min(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),
|
|
2735
|
-
cell.maxWidth ?? Number.POSITIVE_INFINITY)
|
|
2736
|
-
);
|
|
2737
|
-
|
|
2738
|
-
cell.value = lines.join("\\n");
|
|
2739
|
-
cell.height = lines.length;
|
|
2740
|
-
cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;
|
|
2741
|
-
|
|
2742
|
-
recalculate = true;
|
|
2743
|
-
}
|
|
2744
|
-
} while (recalculate);
|
|
2745
|
-
|
|
2746
|
-
// Render table
|
|
2747
|
-
cells.forEach((row, rowIndex) => {
|
|
2748
|
-
const outputs = [] as string[][];
|
|
2749
|
-
row.forEach((cell, colIndex) => {
|
|
2750
|
-
const lines = cell.value.split("\\n");
|
|
2751
|
-
while (lines.length < rowDims[rowIndex]!.height) {
|
|
2752
|
-
lines.push("");
|
|
2753
|
-
}
|
|
2754
|
-
|
|
2755
|
-
outputs.push(lines.map(line => {
|
|
2756
|
-
let paddedContent = "";
|
|
2757
|
-
switch (cell.align) {
|
|
2758
|
-
case "right":
|
|
2759
|
-
paddedContent = " ".repeat(Math.max(colWidths[colIndex] - stripAnsi(line).length - cell.padding, 0)) + line + " ".repeat(cell.padding);
|
|
2760
|
-
break;
|
|
2761
|
-
case "center":
|
|
2762
|
-
const leftPadding = Math.floor((colWidths[colIndex] - stripAnsi(line).length - cell.padding) / 2);
|
|
2763
|
-
const rightPadding = colWidths[colIndex] - stripAnsi(line).length - leftPadding;
|
|
2764
|
-
paddedContent = " ".repeat(leftPadding) + line + " ".repeat(rightPadding);
|
|
2765
|
-
break;
|
|
2766
|
-
case "left":
|
|
2767
|
-
default:
|
|
2768
|
-
paddedContent = " ".repeat(cell.padding) + line + " ".repeat(Math.max(colWidths[colIndex] - stripAnsi(line).length - cell.padding, 0));
|
|
2769
|
-
break;
|
|
2770
|
-
}
|
|
2771
|
-
|
|
2772
|
-
if (colIndex === row.length - 1) {
|
|
2773
|
-
return cell.border.left + paddedContent + cell.border.right;
|
|
2774
|
-
} else {
|
|
2775
|
-
return cell.border.left + paddedContent;
|
|
2776
|
-
}
|
|
2777
|
-
}));
|
|
2778
|
-
});
|
|
2779
|
-
|
|
2780
|
-
for (let index = 0; index < rowDims[rowIndex]!.height; index++) {
|
|
2781
|
-
writeLine(outputs.map(output => output[index] ?? "").join(""));
|
|
2782
|
-
}
|
|
2783
|
-
});
|
|
2784
|
-
`)
|
|
2785
|
-
];
|
|
2786
|
-
}
|
|
2787
|
-
}))
|
|
2788
|
-
];
|
|
2789
|
-
}
|
|
2790
|
-
/**
|
|
2791
|
-
* A built-in console utilities module for Shell Shock.
|
|
2792
|
-
*/
|
|
2793
|
-
function ConsoleBuiltin(props) {
|
|
2794
|
-
const { children, imports, builtinImports } = props;
|
|
2795
|
-
return createComponent(BuiltinFile, {
|
|
2796
|
-
id: "console",
|
|
2797
|
-
description: "A collection of helper utilities to assist in generating content meant for display in the console.",
|
|
2798
|
-
get imports() {
|
|
2799
|
-
return defu$1(imports, { "@shell-shock/plugin-theme/types/theme": [{
|
|
2800
|
-
name: "ThemeColorsResolvedConfig",
|
|
2801
|
-
type: true
|
|
2802
|
-
}] });
|
|
2803
|
-
},
|
|
2804
|
-
get builtinImports() {
|
|
2805
|
-
return defu$1(builtinImports, {
|
|
2806
|
-
utils: [
|
|
2807
|
-
"hasFlag",
|
|
2808
|
-
"isMinimal",
|
|
2809
|
-
"isColorSupported",
|
|
2810
|
-
"colorSupportLevels",
|
|
2811
|
-
"isHyperlinkSupported"
|
|
2812
|
-
],
|
|
2813
|
-
env: [
|
|
2814
|
-
"env",
|
|
2815
|
-
"isDevelopment",
|
|
2816
|
-
"isDebug"
|
|
2817
|
-
]
|
|
2818
|
-
});
|
|
2819
|
-
},
|
|
2820
|
-
get children() {
|
|
2821
|
-
return [
|
|
2822
|
-
createComponent(AnsiHelpersDeclarations, {}),
|
|
2823
|
-
createComponent(Spacing, {}),
|
|
2824
|
-
createComponent(StripAnsiFunctionDeclaration, {}),
|
|
2825
|
-
createComponent(Spacing, {}),
|
|
2826
|
-
createComponent(WrapAnsiFunction, {}),
|
|
2827
|
-
createComponent(Spacing, {}),
|
|
2828
|
-
createComponent(ColorsDeclaration, {}),
|
|
2829
|
-
createComponent(Spacing, {}),
|
|
2830
|
-
createComponent(WriteLineFunctionDeclaration, {}),
|
|
2831
|
-
createComponent(Spacing, {}),
|
|
2832
|
-
createComponent(LinkFunctionDeclaration, {}),
|
|
2833
|
-
createComponent(Spacing, {}),
|
|
2834
|
-
createComponent(DividerFunctionDeclaration, {}),
|
|
2835
|
-
createComponent(Spacing, {}),
|
|
2836
|
-
createComponent(MessageFunctionDeclaration, {
|
|
2837
|
-
type: "help",
|
|
2838
|
-
variant: "help",
|
|
2839
|
-
consoleFnName: "log",
|
|
2840
|
-
description: "help"
|
|
2841
|
-
}),
|
|
2842
|
-
createComponent(Spacing, {}),
|
|
2843
|
-
createComponent(MessageFunctionDeclaration, {
|
|
2844
|
-
type: "success",
|
|
2845
|
-
variant: "success",
|
|
2846
|
-
consoleFnName: "info",
|
|
2847
|
-
description: "success"
|
|
2848
|
-
}),
|
|
2849
|
-
createComponent(Spacing, {}),
|
|
2850
|
-
createComponent(MessageFunctionDeclaration, {
|
|
2851
|
-
type: "info",
|
|
2852
|
-
variant: "info",
|
|
2853
|
-
consoleFnName: "info",
|
|
2854
|
-
description: "informational"
|
|
2855
|
-
}),
|
|
2856
|
-
createComponent(Spacing, {}),
|
|
2857
|
-
createComponent(MessageFunctionDeclaration, {
|
|
2858
|
-
type: "debug",
|
|
2859
|
-
variant: "debug",
|
|
2860
|
-
consoleFnName: "debug",
|
|
2861
|
-
description: "debug",
|
|
2862
|
-
timestamp: true,
|
|
2863
|
-
get prefix() {
|
|
2864
|
-
return createComponent(IfStatement, {
|
|
2865
|
-
get condition() {
|
|
2866
|
-
return createComponent(IsNotDebug, {});
|
|
2867
|
-
},
|
|
2868
|
-
children: code`return; `
|
|
2869
|
-
});
|
|
2870
|
-
}
|
|
2871
|
-
}),
|
|
2872
|
-
createComponent(Spacing, {}),
|
|
2873
|
-
createComponent(MessageFunctionDeclaration, {
|
|
2874
|
-
type: "verbose",
|
|
2875
|
-
variant: "info",
|
|
2876
|
-
color: "debug",
|
|
2877
|
-
consoleFnName: "debug",
|
|
2878
|
-
description: "verbose",
|
|
2879
|
-
timestamp: true,
|
|
2880
|
-
get prefix() {
|
|
2881
|
-
return createComponent(IfStatement, {
|
|
2882
|
-
get condition() {
|
|
2883
|
-
return createComponent(IsNotVerbose, {});
|
|
2884
|
-
},
|
|
2885
|
-
children: code`return; `
|
|
2886
|
-
});
|
|
2887
|
-
}
|
|
2888
|
-
}),
|
|
2889
|
-
createComponent(Spacing, {}),
|
|
2890
|
-
createComponent(MessageFunctionDeclaration, {
|
|
2891
|
-
type: "warn",
|
|
2892
|
-
variant: "warning",
|
|
2893
|
-
consoleFnName: "warn",
|
|
2894
|
-
description: "warning"
|
|
2895
|
-
}),
|
|
2896
|
-
createComponent(Spacing, {}),
|
|
2897
|
-
createComponent(MessageFunctionDeclaration, {
|
|
2898
|
-
type: "danger",
|
|
2899
|
-
variant: "danger",
|
|
2900
|
-
consoleFnName: "error",
|
|
2901
|
-
description: "destructive/danger"
|
|
2902
|
-
}),
|
|
2903
|
-
createComponent(Spacing, {}),
|
|
2904
|
-
createComponent(MessageFunctionDeclaration, {
|
|
2905
|
-
type: "error",
|
|
2906
|
-
variant: "error",
|
|
2907
|
-
consoleFnName: "error",
|
|
2908
|
-
description: "error",
|
|
2909
|
-
timestamp: true,
|
|
2910
|
-
parameters: [{
|
|
2911
|
-
name: "err",
|
|
2912
|
-
type: "string | Error",
|
|
2913
|
-
optional: false
|
|
2914
|
-
}],
|
|
2915
|
-
get prefix() {
|
|
2916
|
-
return [
|
|
2917
|
-
createComponent(VarDeclaration, {
|
|
2918
|
-
"let": true,
|
|
2919
|
-
name: "message",
|
|
2920
|
-
type: "string | undefined"
|
|
2921
|
-
}),
|
|
2922
|
-
createComponent(Spacing, {}),
|
|
2923
|
-
createComponent(IfStatement, {
|
|
2924
|
-
condition: code`(err as Error)?.message`,
|
|
2925
|
-
children: code`message = (err as Error).message;`
|
|
2926
|
-
}),
|
|
2927
|
-
createComponent(ElseClause, { children: code`message = String(err);` }),
|
|
2928
|
-
createComponent(Spacing, {}),
|
|
2929
|
-
createComponent(IfStatement, {
|
|
2930
|
-
condition: code`env.STACKTRACE`,
|
|
2931
|
-
get children() {
|
|
2932
|
-
return [createComponent(IfStatement, {
|
|
2933
|
-
condition: code`(err as Error)?.stack`,
|
|
2934
|
-
children: code`message += " \\n\\n" + (err as Error).stack;`
|
|
2935
|
-
}), createComponent(ElseClause, { children: code`message += " \\n\\n" + (new Error(" ")).stack.split("\\n").slice(2).map(line => line.trim()).join("\\n");` })];
|
|
2936
|
-
}
|
|
2937
|
-
})
|
|
2938
|
-
];
|
|
2939
|
-
}
|
|
2940
|
-
}),
|
|
2941
|
-
createComponent(Spacing, {}),
|
|
2942
|
-
createComponent(TableFunctionDeclaration, {}),
|
|
2943
|
-
createComponent(Spacing, {}),
|
|
2944
|
-
children,
|
|
2945
|
-
createComponent(Spacing, {})
|
|
2946
|
-
];
|
|
2947
|
-
}
|
|
2948
|
-
});
|
|
2949
|
-
}
|
|
2950
|
-
|
|
2951
|
-
//#endregion
|
|
2952
|
-
export { AnsiHelpersDeclarations, ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, StripAnsiFunctionDeclaration, TableFunctionDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
2953
|
-
//# sourceMappingURL=console-builtin.mjs.map
|