@shell-shock/preset-script 0.6.10 → 0.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +8 -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 +8 -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/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/components/virtual-command-entry.cjs +1 -0
- package/dist/components/virtual-command-entry.cjs.map +1 -1
- package/dist/components/virtual-command-entry.mjs +1 -0
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- 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.mts.map +1 -1
- package/package.json +16 -71
- 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,689 +0,0 @@
|
|
|
1
|
-
//#region src/helpers/ansi-utils.ts
|
|
2
|
-
const ANSI_BACKGROUND_OFFSET = 10;
|
|
3
|
-
const modifiers = {
|
|
4
|
-
reset: [0, 0],
|
|
5
|
-
bold: [1, 22],
|
|
6
|
-
dim: [2, 22],
|
|
7
|
-
italic: [3, 23],
|
|
8
|
-
underline: [4, 24],
|
|
9
|
-
overline: [53, 55],
|
|
10
|
-
inverse: [7, 27],
|
|
11
|
-
hidden: [8, 28],
|
|
12
|
-
strikethrough: [9, 29]
|
|
13
|
-
};
|
|
14
|
-
const colors = {
|
|
15
|
-
black: [30, 39],
|
|
16
|
-
red: [31, 39],
|
|
17
|
-
green: [32, 39],
|
|
18
|
-
yellow: [33, 39],
|
|
19
|
-
blue: [34, 39],
|
|
20
|
-
magenta: [35, 39],
|
|
21
|
-
cyan: [36, 39],
|
|
22
|
-
white: [37, 39],
|
|
23
|
-
blackBright: [90, 39],
|
|
24
|
-
gray: [90, 39],
|
|
25
|
-
grey: [90, 39],
|
|
26
|
-
redBright: [91, 39],
|
|
27
|
-
greenBright: [92, 39],
|
|
28
|
-
yellowBright: [93, 39],
|
|
29
|
-
blueBright: [94, 39],
|
|
30
|
-
magentaBright: [95, 39],
|
|
31
|
-
cyanBright: [96, 39],
|
|
32
|
-
whiteBright: [97, 39]
|
|
33
|
-
};
|
|
34
|
-
const bgColors = {
|
|
35
|
-
bgBlack: [40, 49],
|
|
36
|
-
bgRed: [41, 49],
|
|
37
|
-
bgGreen: [42, 49],
|
|
38
|
-
bgYellow: [43, 49],
|
|
39
|
-
bgBlue: [44, 49],
|
|
40
|
-
bgMagenta: [45, 49],
|
|
41
|
-
bgCyan: [46, 49],
|
|
42
|
-
bgWhite: [47, 49],
|
|
43
|
-
bgBlackBright: [100, 49],
|
|
44
|
-
bgGray: [100, 49],
|
|
45
|
-
bgGrey: [100, 49],
|
|
46
|
-
bgRedBright: [101, 49],
|
|
47
|
-
bgGreenBright: [102, 49],
|
|
48
|
-
bgYellowBright: [103, 49],
|
|
49
|
-
bgBlueBright: [104, 49],
|
|
50
|
-
bgMagentaBright: [105, 49],
|
|
51
|
-
bgCyanBright: [106, 49],
|
|
52
|
-
bgWhiteBright: [107, 49]
|
|
53
|
-
};
|
|
54
|
-
const wrapAnsi16 = (offset = 0) => (code) => `\\x1b[${code + offset}m`;
|
|
55
|
-
const wrapAnsi256 = (offset = 0) => (code) => `\\x1b[${38 + offset};5;${code}m`;
|
|
56
|
-
const wrapAnsi16m = (offset = 0) => (code) => {
|
|
57
|
-
const [red, green, blue] = hexToRgb(code);
|
|
58
|
-
return `\\x1b[${38 + offset};2;${red};${green};${blue}m`;
|
|
59
|
-
};
|
|
60
|
-
function rgbToAnsi256(red, green, blue) {
|
|
61
|
-
if (red === green && green === blue) {
|
|
62
|
-
if (red < 8) return 16;
|
|
63
|
-
if (red > 248) return 231;
|
|
64
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
65
|
-
}
|
|
66
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
67
|
-
}
|
|
68
|
-
function hexToRgb(hex) {
|
|
69
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
70
|
-
if (!matches) return [
|
|
71
|
-
0,
|
|
72
|
-
0,
|
|
73
|
-
0
|
|
74
|
-
];
|
|
75
|
-
let [colorString] = matches;
|
|
76
|
-
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
77
|
-
const integer = Number.parseInt(colorString, 16);
|
|
78
|
-
return [
|
|
79
|
-
integer >> 16 & 255,
|
|
80
|
-
integer >> 8 & 255,
|
|
81
|
-
integer & 255
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
function hexToAnsi256(hex) {
|
|
85
|
-
return rgbToAnsi256(...hexToRgb(hex));
|
|
86
|
-
}
|
|
87
|
-
function ansi256ToAnsi(code) {
|
|
88
|
-
if (code < 8) return 30 + code;
|
|
89
|
-
if (code < 16) return 90 + (code - 8);
|
|
90
|
-
let red;
|
|
91
|
-
let green;
|
|
92
|
-
let blue;
|
|
93
|
-
if (code >= 232) {
|
|
94
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
95
|
-
green = red;
|
|
96
|
-
blue = red;
|
|
97
|
-
} else {
|
|
98
|
-
code -= 16;
|
|
99
|
-
const remainder = code % 36;
|
|
100
|
-
red = Math.floor(code / 36) / 5;
|
|
101
|
-
green = Math.floor(remainder / 6) / 5;
|
|
102
|
-
blue = remainder % 6 / 5;
|
|
103
|
-
}
|
|
104
|
-
const value = Math.max(red, green, blue) * 2;
|
|
105
|
-
if (value === 0) return 30;
|
|
106
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
107
|
-
if (value === 2) result += 60;
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
function hexToAnsi(hex) {
|
|
111
|
-
return ansi256ToAnsi(hexToAnsi256(hex));
|
|
112
|
-
}
|
|
113
|
-
function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
|
|
114
|
-
return {
|
|
115
|
-
text: {
|
|
116
|
-
banner: {
|
|
117
|
-
title: {
|
|
118
|
-
primary: {
|
|
119
|
-
open: wrapFn()(convertFn(theme.text.banner.title.primary)),
|
|
120
|
-
close: wrapAnsi16()(39)
|
|
121
|
-
},
|
|
122
|
-
secondary: {
|
|
123
|
-
open: wrapFn()(convertFn(theme.text.banner.title.secondary)),
|
|
124
|
-
close: wrapAnsi16()(39)
|
|
125
|
-
},
|
|
126
|
-
tertiary: {
|
|
127
|
-
open: wrapFn()(convertFn(theme.text.banner.title.tertiary)),
|
|
128
|
-
close: wrapAnsi16()(39)
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
command: {
|
|
132
|
-
primary: {
|
|
133
|
-
open: wrapFn()(convertFn(theme.text.banner.command.primary)),
|
|
134
|
-
close: wrapAnsi16()(39)
|
|
135
|
-
},
|
|
136
|
-
secondary: {
|
|
137
|
-
open: wrapFn()(convertFn(theme.text.banner.command.secondary)),
|
|
138
|
-
close: wrapAnsi16()(39)
|
|
139
|
-
},
|
|
140
|
-
tertiary: {
|
|
141
|
-
open: wrapFn()(convertFn(theme.text.banner.command.tertiary)),
|
|
142
|
-
close: wrapAnsi16()(39)
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
description: {
|
|
146
|
-
primary: {
|
|
147
|
-
open: wrapFn()(convertFn(theme.text.banner.description.primary)),
|
|
148
|
-
close: wrapAnsi16()(39)
|
|
149
|
-
},
|
|
150
|
-
secondary: {
|
|
151
|
-
open: wrapFn()(convertFn(theme.text.banner.description.secondary)),
|
|
152
|
-
close: wrapAnsi16()(39)
|
|
153
|
-
},
|
|
154
|
-
tertiary: {
|
|
155
|
-
open: wrapFn()(convertFn(theme.text.banner.description.tertiary)),
|
|
156
|
-
close: wrapAnsi16()(39)
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
header: {
|
|
160
|
-
primary: {
|
|
161
|
-
open: wrapFn()(convertFn(theme.text.banner.header.primary)),
|
|
162
|
-
close: wrapAnsi16()(39)
|
|
163
|
-
},
|
|
164
|
-
secondary: {
|
|
165
|
-
open: wrapFn()(convertFn(theme.text.banner.header.secondary)),
|
|
166
|
-
close: wrapAnsi16()(39)
|
|
167
|
-
},
|
|
168
|
-
tertiary: {
|
|
169
|
-
open: wrapFn()(convertFn(theme.text.banner.header.tertiary)),
|
|
170
|
-
close: wrapAnsi16()(39)
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
footer: {
|
|
174
|
-
primary: {
|
|
175
|
-
open: wrapFn()(convertFn(theme.text.banner.footer.primary)),
|
|
176
|
-
close: wrapAnsi16()(39)
|
|
177
|
-
},
|
|
178
|
-
secondary: {
|
|
179
|
-
open: wrapFn()(convertFn(theme.text.banner.footer.secondary)),
|
|
180
|
-
close: wrapAnsi16()(39)
|
|
181
|
-
},
|
|
182
|
-
tertiary: {
|
|
183
|
-
open: wrapFn()(convertFn(theme.text.banner.footer.tertiary)),
|
|
184
|
-
close: wrapAnsi16()(39)
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
link: {
|
|
188
|
-
primary: {
|
|
189
|
-
open: wrapFn()(convertFn(theme.text.banner.link.primary)),
|
|
190
|
-
close: wrapAnsi16()(39)
|
|
191
|
-
},
|
|
192
|
-
secondary: {
|
|
193
|
-
open: wrapFn()(convertFn(theme.text.banner.link.secondary)),
|
|
194
|
-
close: wrapAnsi16()(39)
|
|
195
|
-
},
|
|
196
|
-
tertiary: {
|
|
197
|
-
open: wrapFn()(convertFn(theme.text.banner.link.tertiary)),
|
|
198
|
-
close: wrapAnsi16()(39)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
heading: {
|
|
203
|
-
primary: {
|
|
204
|
-
open: wrapFn()(convertFn(theme.text.heading.primary)),
|
|
205
|
-
close: wrapAnsi16()(39)
|
|
206
|
-
},
|
|
207
|
-
secondary: {
|
|
208
|
-
open: wrapFn()(convertFn(theme.text.heading.secondary)),
|
|
209
|
-
close: wrapAnsi16()(39)
|
|
210
|
-
},
|
|
211
|
-
tertiary: {
|
|
212
|
-
open: wrapFn()(convertFn(theme.text.heading.tertiary)),
|
|
213
|
-
close: wrapAnsi16()(39)
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
body: {
|
|
217
|
-
primary: {
|
|
218
|
-
open: wrapFn()(convertFn(theme.text.body.primary)),
|
|
219
|
-
close: wrapAnsi16()(39)
|
|
220
|
-
},
|
|
221
|
-
secondary: {
|
|
222
|
-
open: wrapFn()(convertFn(theme.text.body.secondary)),
|
|
223
|
-
close: wrapAnsi16()(39)
|
|
224
|
-
},
|
|
225
|
-
tertiary: {
|
|
226
|
-
open: wrapFn()(convertFn(theme.text.body.tertiary)),
|
|
227
|
-
close: wrapAnsi16()(39)
|
|
228
|
-
},
|
|
229
|
-
link: {
|
|
230
|
-
open: wrapFn()(convertFn(theme.text.body.link)),
|
|
231
|
-
close: wrapAnsi16()(39)
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
message: {
|
|
235
|
-
description: {
|
|
236
|
-
help: {
|
|
237
|
-
open: wrapFn()(convertFn(theme.text.message.description.help)),
|
|
238
|
-
close: wrapAnsi16()(39)
|
|
239
|
-
},
|
|
240
|
-
success: {
|
|
241
|
-
open: wrapFn()(convertFn(theme.text.message.description.success)),
|
|
242
|
-
close: wrapAnsi16()(39)
|
|
243
|
-
},
|
|
244
|
-
info: {
|
|
245
|
-
open: wrapFn()(convertFn(theme.text.message.description.info)),
|
|
246
|
-
close: wrapAnsi16()(39)
|
|
247
|
-
},
|
|
248
|
-
debug: {
|
|
249
|
-
open: wrapFn()(convertFn(theme.text.message.description.debug)),
|
|
250
|
-
close: wrapAnsi16()(39)
|
|
251
|
-
},
|
|
252
|
-
warning: {
|
|
253
|
-
open: wrapFn()(convertFn(theme.text.message.description.warning)),
|
|
254
|
-
close: wrapAnsi16()(39)
|
|
255
|
-
},
|
|
256
|
-
danger: {
|
|
257
|
-
open: wrapFn()(convertFn(theme.text.message.description.danger)),
|
|
258
|
-
close: wrapAnsi16()(39)
|
|
259
|
-
},
|
|
260
|
-
error: {
|
|
261
|
-
open: wrapFn()(convertFn(theme.text.message.description.error)),
|
|
262
|
-
close: wrapAnsi16()(39)
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
link: {
|
|
266
|
-
help: {
|
|
267
|
-
open: wrapFn()(convertFn(theme.text.message.link.help)),
|
|
268
|
-
close: wrapAnsi16()(39)
|
|
269
|
-
},
|
|
270
|
-
success: {
|
|
271
|
-
open: wrapFn()(convertFn(theme.text.message.link.success)),
|
|
272
|
-
close: wrapAnsi16()(39)
|
|
273
|
-
},
|
|
274
|
-
info: {
|
|
275
|
-
open: wrapFn()(convertFn(theme.text.message.link.info)),
|
|
276
|
-
close: wrapAnsi16()(39)
|
|
277
|
-
},
|
|
278
|
-
debug: {
|
|
279
|
-
open: wrapFn()(convertFn(theme.text.message.link.debug)),
|
|
280
|
-
close: wrapAnsi16()(39)
|
|
281
|
-
},
|
|
282
|
-
warning: {
|
|
283
|
-
open: wrapFn()(convertFn(theme.text.message.link.warning)),
|
|
284
|
-
close: wrapAnsi16()(39)
|
|
285
|
-
},
|
|
286
|
-
danger: {
|
|
287
|
-
open: wrapFn()(convertFn(theme.text.message.link.danger)),
|
|
288
|
-
close: wrapAnsi16()(39)
|
|
289
|
-
},
|
|
290
|
-
error: {
|
|
291
|
-
open: wrapFn()(convertFn(theme.text.message.link.error)),
|
|
292
|
-
close: wrapAnsi16()(39)
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
header: {
|
|
296
|
-
help: {
|
|
297
|
-
open: wrapFn()(convertFn(theme.text.message.header.help)),
|
|
298
|
-
close: wrapAnsi16()(39)
|
|
299
|
-
},
|
|
300
|
-
success: {
|
|
301
|
-
open: wrapFn()(convertFn(theme.text.message.header.success)),
|
|
302
|
-
close: wrapAnsi16()(39)
|
|
303
|
-
},
|
|
304
|
-
info: {
|
|
305
|
-
open: wrapFn()(convertFn(theme.text.message.header.info)),
|
|
306
|
-
close: wrapAnsi16()(39)
|
|
307
|
-
},
|
|
308
|
-
debug: {
|
|
309
|
-
open: wrapFn()(convertFn(theme.text.message.header.debug)),
|
|
310
|
-
close: wrapAnsi16()(39)
|
|
311
|
-
},
|
|
312
|
-
warning: {
|
|
313
|
-
open: wrapFn()(convertFn(theme.text.message.header.warning)),
|
|
314
|
-
close: wrapAnsi16()(39)
|
|
315
|
-
},
|
|
316
|
-
danger: {
|
|
317
|
-
open: wrapFn()(convertFn(theme.text.message.header.danger)),
|
|
318
|
-
close: wrapAnsi16()(39)
|
|
319
|
-
},
|
|
320
|
-
error: {
|
|
321
|
-
open: wrapFn()(convertFn(theme.text.message.header.error)),
|
|
322
|
-
close: wrapAnsi16()(39)
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
footer: {
|
|
326
|
-
help: {
|
|
327
|
-
open: wrapFn()(convertFn(theme.text.message.footer.help)),
|
|
328
|
-
close: wrapAnsi16()(39)
|
|
329
|
-
},
|
|
330
|
-
success: {
|
|
331
|
-
open: wrapFn()(convertFn(theme.text.message.footer.success)),
|
|
332
|
-
close: wrapAnsi16()(39)
|
|
333
|
-
},
|
|
334
|
-
info: {
|
|
335
|
-
open: wrapFn()(convertFn(theme.text.message.footer.info)),
|
|
336
|
-
close: wrapAnsi16()(39)
|
|
337
|
-
},
|
|
338
|
-
debug: {
|
|
339
|
-
open: wrapFn()(convertFn(theme.text.message.footer.debug)),
|
|
340
|
-
close: wrapAnsi16()(39)
|
|
341
|
-
},
|
|
342
|
-
warning: {
|
|
343
|
-
open: wrapFn()(convertFn(theme.text.message.footer.warning)),
|
|
344
|
-
close: wrapAnsi16()(39)
|
|
345
|
-
},
|
|
346
|
-
danger: {
|
|
347
|
-
open: wrapFn()(convertFn(theme.text.message.footer.danger)),
|
|
348
|
-
close: wrapAnsi16()(39)
|
|
349
|
-
},
|
|
350
|
-
error: {
|
|
351
|
-
open: wrapFn()(convertFn(theme.text.message.footer.error)),
|
|
352
|
-
close: wrapAnsi16()(39)
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
usage: {
|
|
357
|
-
bin: {
|
|
358
|
-
open: wrapFn()(convertFn(theme.text.usage.bin)),
|
|
359
|
-
close: wrapAnsi16()(39)
|
|
360
|
-
},
|
|
361
|
-
command: {
|
|
362
|
-
open: wrapFn()(convertFn(theme.text.usage.command)),
|
|
363
|
-
close: wrapAnsi16()(39)
|
|
364
|
-
},
|
|
365
|
-
dynamic: {
|
|
366
|
-
open: wrapFn()(convertFn(theme.text.usage.dynamic)),
|
|
367
|
-
close: wrapAnsi16()(39)
|
|
368
|
-
},
|
|
369
|
-
options: {
|
|
370
|
-
open: wrapFn()(convertFn(theme.text.usage.options)),
|
|
371
|
-
close: wrapAnsi16()(39)
|
|
372
|
-
},
|
|
373
|
-
arguments: {
|
|
374
|
-
open: wrapFn()(convertFn(theme.text.usage.arguments)),
|
|
375
|
-
close: wrapAnsi16()(39)
|
|
376
|
-
},
|
|
377
|
-
description: {
|
|
378
|
-
open: wrapFn()(convertFn(theme.text.usage.description)),
|
|
379
|
-
close: wrapAnsi16()(39)
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
prompt: {
|
|
383
|
-
icon: {
|
|
384
|
-
active: {
|
|
385
|
-
open: wrapFn()(convertFn(theme.text.prompt.icon.active)),
|
|
386
|
-
close: wrapAnsi16()(39)
|
|
387
|
-
},
|
|
388
|
-
warning: {
|
|
389
|
-
open: wrapFn()(convertFn(theme.text.prompt.icon.warning)),
|
|
390
|
-
close: wrapAnsi16()(39)
|
|
391
|
-
},
|
|
392
|
-
error: {
|
|
393
|
-
open: wrapFn()(convertFn(theme.text.prompt.icon.error)),
|
|
394
|
-
close: wrapAnsi16()(39)
|
|
395
|
-
},
|
|
396
|
-
submitted: {
|
|
397
|
-
open: wrapFn()(convertFn(theme.text.prompt.icon.submitted)),
|
|
398
|
-
close: wrapAnsi16()(39)
|
|
399
|
-
},
|
|
400
|
-
cancelled: {
|
|
401
|
-
open: wrapFn()(convertFn(theme.text.prompt.icon.cancelled)),
|
|
402
|
-
close: wrapAnsi16()(39)
|
|
403
|
-
},
|
|
404
|
-
disabled: {
|
|
405
|
-
open: wrapFn()(convertFn(theme.text.prompt.icon.disabled)),
|
|
406
|
-
close: wrapAnsi16()(39)
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
|
-
message: {
|
|
410
|
-
active: {
|
|
411
|
-
open: wrapFn()(convertFn(theme.text.prompt.message.active)),
|
|
412
|
-
close: wrapAnsi16()(39)
|
|
413
|
-
},
|
|
414
|
-
warning: {
|
|
415
|
-
open: wrapFn()(convertFn(theme.text.prompt.message.warning)),
|
|
416
|
-
close: wrapAnsi16()(39)
|
|
417
|
-
},
|
|
418
|
-
error: {
|
|
419
|
-
open: wrapFn()(convertFn(theme.text.prompt.message.error)),
|
|
420
|
-
close: wrapAnsi16()(39)
|
|
421
|
-
},
|
|
422
|
-
submitted: {
|
|
423
|
-
open: wrapFn()(convertFn(theme.text.prompt.message.submitted)),
|
|
424
|
-
close: wrapAnsi16()(39)
|
|
425
|
-
},
|
|
426
|
-
cancelled: {
|
|
427
|
-
open: wrapFn()(convertFn(theme.text.prompt.message.cancelled)),
|
|
428
|
-
close: wrapAnsi16()(39)
|
|
429
|
-
},
|
|
430
|
-
disabled: {
|
|
431
|
-
open: wrapFn()(convertFn(theme.text.prompt.message.disabled)),
|
|
432
|
-
close: wrapAnsi16()(39)
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
input: {
|
|
436
|
-
active: {
|
|
437
|
-
open: wrapFn()(convertFn(theme.text.prompt.input.active)),
|
|
438
|
-
close: wrapAnsi16()(39)
|
|
439
|
-
},
|
|
440
|
-
inactive: {
|
|
441
|
-
open: wrapFn()(convertFn(theme.text.prompt.input.inactive)),
|
|
442
|
-
close: wrapAnsi16()(39)
|
|
443
|
-
},
|
|
444
|
-
warning: {
|
|
445
|
-
open: wrapFn()(convertFn(theme.text.prompt.input.warning)),
|
|
446
|
-
close: wrapAnsi16()(39)
|
|
447
|
-
},
|
|
448
|
-
error: {
|
|
449
|
-
open: wrapFn()(convertFn(theme.text.prompt.input.error)),
|
|
450
|
-
close: wrapAnsi16()(39)
|
|
451
|
-
},
|
|
452
|
-
submitted: {
|
|
453
|
-
open: wrapFn()(convertFn(theme.text.prompt.input.submitted)),
|
|
454
|
-
close: wrapAnsi16()(39)
|
|
455
|
-
},
|
|
456
|
-
cancelled: {
|
|
457
|
-
open: wrapFn()(convertFn(theme.text.prompt.input.cancelled)),
|
|
458
|
-
close: wrapAnsi16()(39)
|
|
459
|
-
},
|
|
460
|
-
disabled: {
|
|
461
|
-
open: wrapFn()(convertFn(theme.text.prompt.input.disabled)),
|
|
462
|
-
close: wrapAnsi16()(39)
|
|
463
|
-
},
|
|
464
|
-
placeholder: {
|
|
465
|
-
open: wrapFn()(convertFn(theme.text.prompt.input.placeholder)),
|
|
466
|
-
close: wrapAnsi16()(39)
|
|
467
|
-
}
|
|
468
|
-
},
|
|
469
|
-
description: {
|
|
470
|
-
active: {
|
|
471
|
-
open: wrapFn()(convertFn(theme.text.prompt.description.active)),
|
|
472
|
-
close: wrapAnsi16()(39)
|
|
473
|
-
},
|
|
474
|
-
inactive: {
|
|
475
|
-
open: wrapFn()(convertFn(theme.text.prompt.description.inactive)),
|
|
476
|
-
close: wrapAnsi16()(39)
|
|
477
|
-
},
|
|
478
|
-
warning: {
|
|
479
|
-
open: wrapFn()(convertFn(theme.text.prompt.description.warning)),
|
|
480
|
-
close: wrapAnsi16()(39)
|
|
481
|
-
},
|
|
482
|
-
error: {
|
|
483
|
-
open: wrapFn()(convertFn(theme.text.prompt.description.error)),
|
|
484
|
-
close: wrapAnsi16()(39)
|
|
485
|
-
},
|
|
486
|
-
submitted: {
|
|
487
|
-
open: wrapFn()(convertFn(theme.text.prompt.description.submitted)),
|
|
488
|
-
close: wrapAnsi16()(39)
|
|
489
|
-
},
|
|
490
|
-
cancelled: {
|
|
491
|
-
open: wrapFn()(convertFn(theme.text.prompt.description.cancelled)),
|
|
492
|
-
close: wrapAnsi16()(39)
|
|
493
|
-
},
|
|
494
|
-
disabled: {
|
|
495
|
-
open: wrapFn()(convertFn(theme.text.prompt.description.disabled)),
|
|
496
|
-
close: wrapAnsi16()(39)
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
},
|
|
501
|
-
border: {
|
|
502
|
-
banner: {
|
|
503
|
-
divider: {
|
|
504
|
-
primary: {
|
|
505
|
-
open: wrapFn()(convertFn(theme.border.banner.divider.primary)),
|
|
506
|
-
close: wrapAnsi16()(39)
|
|
507
|
-
},
|
|
508
|
-
secondary: {
|
|
509
|
-
open: wrapFn()(convertFn(theme.border.banner.divider.secondary)),
|
|
510
|
-
close: wrapAnsi16()(39)
|
|
511
|
-
},
|
|
512
|
-
tertiary: {
|
|
513
|
-
open: wrapFn()(convertFn(theme.border.banner.divider.tertiary)),
|
|
514
|
-
close: wrapAnsi16()(39)
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
outline: {
|
|
518
|
-
primary: {
|
|
519
|
-
open: wrapFn()(convertFn(theme.border.banner.outline.primary)),
|
|
520
|
-
close: wrapAnsi16()(39)
|
|
521
|
-
},
|
|
522
|
-
secondary: {
|
|
523
|
-
open: wrapFn()(convertFn(theme.border.banner.outline.secondary)),
|
|
524
|
-
close: wrapAnsi16()(39)
|
|
525
|
-
},
|
|
526
|
-
tertiary: {
|
|
527
|
-
open: wrapFn()(convertFn(theme.border.banner.outline.tertiary)),
|
|
528
|
-
close: wrapAnsi16()(39)
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
},
|
|
532
|
-
app: {
|
|
533
|
-
divider: {
|
|
534
|
-
primary: {
|
|
535
|
-
open: wrapFn()(convertFn(theme.border.app.divider.primary)),
|
|
536
|
-
close: wrapAnsi16()(39)
|
|
537
|
-
},
|
|
538
|
-
secondary: {
|
|
539
|
-
open: wrapFn()(convertFn(theme.border.app.divider.secondary)),
|
|
540
|
-
close: wrapAnsi16()(39)
|
|
541
|
-
},
|
|
542
|
-
tertiary: {
|
|
543
|
-
open: wrapFn()(convertFn(theme.border.app.divider.tertiary)),
|
|
544
|
-
close: wrapAnsi16()(39)
|
|
545
|
-
}
|
|
546
|
-
},
|
|
547
|
-
table: {
|
|
548
|
-
primary: {
|
|
549
|
-
open: wrapFn()(convertFn(theme.border.app.table.primary)),
|
|
550
|
-
close: wrapAnsi16()(39)
|
|
551
|
-
},
|
|
552
|
-
secondary: {
|
|
553
|
-
open: wrapFn()(convertFn(theme.border.app.table.secondary)),
|
|
554
|
-
close: wrapAnsi16()(39)
|
|
555
|
-
},
|
|
556
|
-
tertiary: {
|
|
557
|
-
open: wrapFn()(convertFn(theme.border.app.table.tertiary)),
|
|
558
|
-
close: wrapAnsi16()(39)
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
},
|
|
562
|
-
message: {
|
|
563
|
-
divider: {
|
|
564
|
-
help: {
|
|
565
|
-
open: wrapFn()(convertFn(theme.border.message.divider.help)),
|
|
566
|
-
close: wrapAnsi16()(39)
|
|
567
|
-
},
|
|
568
|
-
success: {
|
|
569
|
-
open: wrapFn()(convertFn(theme.border.message.divider.success)),
|
|
570
|
-
close: wrapAnsi16()(39)
|
|
571
|
-
},
|
|
572
|
-
info: {
|
|
573
|
-
open: wrapFn()(convertFn(theme.border.message.divider.info)),
|
|
574
|
-
close: wrapAnsi16()(39)
|
|
575
|
-
},
|
|
576
|
-
debug: {
|
|
577
|
-
open: wrapFn()(convertFn(theme.border.message.divider.debug)),
|
|
578
|
-
close: wrapAnsi16()(39)
|
|
579
|
-
},
|
|
580
|
-
warning: {
|
|
581
|
-
open: wrapFn()(convertFn(theme.border.message.divider.warning)),
|
|
582
|
-
close: wrapAnsi16()(39)
|
|
583
|
-
},
|
|
584
|
-
danger: {
|
|
585
|
-
open: wrapFn()(convertFn(theme.border.message.divider.danger)),
|
|
586
|
-
close: wrapAnsi16()(39)
|
|
587
|
-
},
|
|
588
|
-
error: {
|
|
589
|
-
open: wrapFn()(convertFn(theme.border.message.divider.error)),
|
|
590
|
-
close: wrapAnsi16()(39)
|
|
591
|
-
}
|
|
592
|
-
},
|
|
593
|
-
outline: {
|
|
594
|
-
help: {
|
|
595
|
-
open: wrapFn()(convertFn(theme.border.message.outline.help)),
|
|
596
|
-
close: wrapAnsi16()(39)
|
|
597
|
-
},
|
|
598
|
-
success: {
|
|
599
|
-
open: wrapFn()(convertFn(theme.border.message.outline.success)),
|
|
600
|
-
close: wrapAnsi16()(39)
|
|
601
|
-
},
|
|
602
|
-
info: {
|
|
603
|
-
open: wrapFn()(convertFn(theme.border.message.outline.info)),
|
|
604
|
-
close: wrapAnsi16()(39)
|
|
605
|
-
},
|
|
606
|
-
debug: {
|
|
607
|
-
open: wrapFn()(convertFn(theme.border.message.outline.debug)),
|
|
608
|
-
close: wrapAnsi16()(39)
|
|
609
|
-
},
|
|
610
|
-
warning: {
|
|
611
|
-
open: wrapFn()(convertFn(theme.border.message.outline.warning)),
|
|
612
|
-
close: wrapAnsi16()(39)
|
|
613
|
-
},
|
|
614
|
-
danger: {
|
|
615
|
-
open: wrapFn()(convertFn(theme.border.message.outline.danger)),
|
|
616
|
-
close: wrapAnsi16()(39)
|
|
617
|
-
},
|
|
618
|
-
error: {
|
|
619
|
-
open: wrapFn()(convertFn(theme.border.message.outline.error)),
|
|
620
|
-
close: wrapAnsi16()(39)
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Generates ANSI styles based on the provided context.
|
|
629
|
-
*
|
|
630
|
-
* @param theme - The theme colors configuration.
|
|
631
|
-
* @returns The generated ANSI styles.
|
|
632
|
-
*/
|
|
633
|
-
function getAnsiStyles(theme) {
|
|
634
|
-
const output = {
|
|
635
|
-
ansi16: {},
|
|
636
|
-
ansi256: {},
|
|
637
|
-
ansi16m: {}
|
|
638
|
-
};
|
|
639
|
-
for (const [key, value] of Object.entries(modifiers)) {
|
|
640
|
-
output.ansi16[key] = {
|
|
641
|
-
open: wrapAnsi16()(value[0]),
|
|
642
|
-
close: wrapAnsi16()(value[1])
|
|
643
|
-
};
|
|
644
|
-
output.ansi256[key] = {
|
|
645
|
-
open: wrapAnsi16()(value[0]),
|
|
646
|
-
close: wrapAnsi16()(value[1])
|
|
647
|
-
};
|
|
648
|
-
output.ansi16m[key] = {
|
|
649
|
-
open: wrapAnsi16()(value[0]),
|
|
650
|
-
close: wrapAnsi16()(value[1])
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
for (const [key, value] of Object.entries(colors)) {
|
|
654
|
-
output.ansi16[key] = {
|
|
655
|
-
open: wrapAnsi16()(value[0]),
|
|
656
|
-
close: wrapAnsi16()(value[1])
|
|
657
|
-
};
|
|
658
|
-
output.ansi256[key] = {
|
|
659
|
-
open: wrapAnsi16()(value[0]),
|
|
660
|
-
close: wrapAnsi16()(value[1])
|
|
661
|
-
};
|
|
662
|
-
output.ansi16m[key] = {
|
|
663
|
-
open: wrapAnsi16()(value[0]),
|
|
664
|
-
close: wrapAnsi16()(value[1])
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
for (const [key, value] of Object.entries(bgColors)) {
|
|
668
|
-
output.ansi16[key] = {
|
|
669
|
-
open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),
|
|
670
|
-
close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])
|
|
671
|
-
};
|
|
672
|
-
output.ansi256[key] = {
|
|
673
|
-
open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),
|
|
674
|
-
close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])
|
|
675
|
-
};
|
|
676
|
-
output.ansi16m[key] = {
|
|
677
|
-
open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),
|
|
678
|
-
close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
output.ansi16.theme = buildThemeAnsiStyles(theme, wrapAnsi16, hexToAnsi);
|
|
682
|
-
output.ansi256.theme = buildThemeAnsiStyles(theme, wrapAnsi256, hexToAnsi256);
|
|
683
|
-
output.ansi16m.theme = buildThemeAnsiStyles(theme, wrapAnsi16m, (code) => code);
|
|
684
|
-
return output;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
//#endregion
|
|
688
|
-
export { bgColors, colors, getAnsiStyles, modifiers };
|
|
689
|
-
//# sourceMappingURL=ansi-utils.mjs.map
|