@reliverse/relinka 1.1.4 → 1.1.6
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-npm/components/anykey/index.js +77 -57
- package/dist-npm/components/block/block.js +61 -48
- package/dist-npm/components/checkbox/index.js +211 -178
- package/dist-npm/components/confirm/confirm-main.js +122 -86
- package/dist-npm/components/confirm/confirm-three.js +27 -24
- package/dist-npm/components/confirm/index.js +45 -36
- package/dist-npm/components/core/Separator.js +17 -15
- package/dist-npm/components/core/create-prompt.js +124 -101
- package/dist-npm/components/core/errors.js +15 -19
- package/dist-npm/components/core/hook-engine.js +120 -91
- package/dist-npm/components/core/index.js +12 -12
- package/dist-npm/components/core/key.js +6 -16
- package/dist-npm/components/core/lines.js +54 -45
- package/dist-npm/components/core/make-theme.js +30 -21
- package/dist-npm/components/core/position.js +23 -27
- package/dist-npm/components/core/promise-polyfill.js +14 -11
- package/dist-npm/components/core/screen-manager.js +74 -59
- package/dist-npm/components/core/theme.js +32 -22
- package/dist-npm/components/core/use-effect.js +15 -9
- package/dist-npm/components/core/use-keypress.js +23 -19
- package/dist-npm/components/core/use-memo.js +16 -10
- package/dist-npm/components/core/use-pagination.js +32 -33
- package/dist-npm/components/core/use-prefix.js +38 -40
- package/dist-npm/components/core/use-ref.js +5 -2
- package/dist-npm/components/core/use-state.js +23 -15
- package/dist-npm/components/core/useKeyPress.js +17 -14
- package/dist-npm/components/core/usePromptState.js +14 -8
- package/dist-npm/components/core/utils.js +16 -7
- package/dist-npm/components/date/date.js +204 -168
- package/dist-npm/components/editor/index.js +92 -71
- package/dist-npm/components/expand/index.js +124 -96
- package/dist-npm/components/figures/index.js +294 -283
- package/dist-npm/components/input/index.js +87 -61
- package/dist-npm/components/input/text-main.js +124 -86
- package/dist-npm/components/input/text.js +28 -24
- package/dist-npm/components/instance/basic.js +25 -17
- package/dist-npm/components/instance/browser.js +18 -14
- package/dist-npm/components/instance/reporter/basic.js +65 -46
- package/dist-npm/components/instance/reporter/browser.js +47 -44
- package/dist-npm/components/instance/reporter/fancy.js +96 -83
- package/dist-npm/components/instance/shared.js +2 -2
- package/dist-npm/components/mono/mono.js +62 -52
- package/dist-npm/components/mono/monoTwo.js +49 -35
- package/dist-npm/components/multiselect/group-multiselect.js +71 -55
- package/dist-npm/components/multiselect/multi-select-two.js +130 -98
- package/dist-npm/components/multiselect/multi-select.js +49 -43
- package/dist-npm/components/multiselect/multiselect-main.js +146 -120
- package/dist-npm/components/multiselect/num-multi-select.js +130 -98
- package/dist-npm/components/multiselect/num-multiselect-main.js +35 -24
- package/dist-npm/components/next-steps/next-steps.js +25 -24
- package/dist-npm/components/number/index.js +112 -78
- package/dist-npm/components/number/number-main.js +2 -96
- package/dist-npm/components/password/index.js +73 -54
- package/dist-npm/components/password/password-main.js +2 -120
- package/dist-npm/components/password/password-three.js +30 -26
- package/dist-npm/components/progressbar/ProgressBar.js +64 -45
- package/dist-npm/components/progressbar/helper.js +40 -33
- package/dist-npm/components/progressbar/index.js +1 -1
- package/dist-npm/components/prompts/create.js +44 -29
- package/dist-npm/components/prompts/index.js +45 -45
- package/dist-npm/components/prompts/prompt.js +260 -211
- package/dist-npm/components/prompts/promptTwo.js +605 -561
- package/dist-npm/components/prompts/relinka.js +295 -237
- package/dist-npm/components/range/range.js +294 -247
- package/dist-npm/components/rawlist/index.js +107 -87
- package/dist-npm/components/results/results.js +37 -31
- package/dist-npm/components/search/index.js +193 -148
- package/dist-npm/components/select/index.js +186 -148
- package/dist-npm/components/select/num-select-main.js +27 -27
- package/dist-npm/components/select/num-select.js +5 -125
- package/dist-npm/components/select/select-key.js +25 -24
- package/dist-npm/components/select/select-main.js +133 -109
- package/dist-npm/components/select/select-three.js +36 -32
- package/dist-npm/components/select/select-two.js +87 -95
- package/dist-npm/components/spinner/index.js +136 -107
- package/dist-npm/components/st-end/end.d.ts +1 -1
- package/dist-npm/components/st-end/end.js +26 -35
- package/dist-npm/components/st-end/start.d.ts +1 -1
- package/dist-npm/components/st-end/start.js +15 -30
- package/dist-npm/components/toggle/index.js +137 -113
- package/dist-npm/components/visual/animate/animate.js +10 -53
- package/dist-npm/components/visual/ascii-art/ascii-art.js +1 -12
- package/dist-npm/mod.js +2 -1
- package/dist-npm/testing/index.js +83 -58
- package/dist-npm/types/general.d.ts +2 -1
- package/dist-npm/types/general.js +1 -0
- package/dist-npm/types/index.js +3 -2
- package/dist-npm/types/keypress.js +36 -35
- package/dist-npm/types/readline.js +1 -0
- package/dist-npm/types/relinka.js +1 -0
- package/dist-npm/types/utils.js +1 -0
- package/dist-npm/utils/box.js +137 -135
- package/dist-npm/utils/color.js +74 -65
- package/dist-npm/utils/colorize.js +156 -124
- package/dist-npm/utils/component.js +657 -532
- package/dist-npm/utils/constants.js +63 -64
- package/dist-npm/utils/core.js +3 -2
- package/dist-npm/utils/decoder.js +223 -244
- package/dist-npm/utils/error.js +9 -4
- package/dist-npm/utils/errors.js +4 -14
- package/dist-npm/utils/format.js +24 -19
- package/dist-npm/utils/keypress.js +414 -316
- package/dist-npm/utils/log.js +15 -11
- package/dist-npm/utils/mapping.js +52 -45
- package/dist-npm/utils/messages.js +183 -183
- package/dist-npm/utils/platforms.js +20 -16
- package/dist-npm/utils/prompt-tmp.js +286 -235
- package/dist-npm/utils/prompt-two.js +286 -235
- package/dist-npm/utils/readline.js +7 -5
- package/dist-npm/utils/skeleton.js +170 -130
- package/dist-npm/utils/stream.js +2 -2
- package/dist-npm/utils/string.js +58 -44
- package/dist-npm/utils/terminal.js +34 -23
- package/dist-npm/utils/tree.js +41 -30
- package/dist-npm/utils/types.js +1 -0
- package/dist-npm/utils/utils.js +8 -8
- package/dist-npm/utils/variants.js +44 -36
- package/package.json +20 -28
package/dist-npm/utils/log.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
export function isPlainObject(obj) {
|
|
2
|
-
|
|
2
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
3
3
|
}
|
|
4
|
+
|
|
4
5
|
export function isLogObj(arg) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
if (!isPlainObject(arg)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (!arg.message && !arg.args) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (arg.stack) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return true;
|
|
15
19
|
}
|
|
@@ -1,49 +1,56 @@
|
|
|
1
|
-
import chalk from
|
|
2
|
-
import gradient, {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import gradient, {
|
|
3
|
+
cristal,
|
|
4
|
+
mind,
|
|
5
|
+
passion,
|
|
6
|
+
retro,
|
|
7
|
+
vice,
|
|
8
|
+
rainbow,
|
|
9
|
+
} from 'gradient-string';
|
|
10
|
+
import colors from 'picocolors';
|
|
11
|
+
|
|
5
12
|
export const colorMap = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
13
|
+
none: colors.reset,
|
|
14
|
+
inverse: colors.inverse,
|
|
15
|
+
black: colors.black,
|
|
16
|
+
blue: colors.blue,
|
|
17
|
+
blueBright: colors.blueBright,
|
|
18
|
+
cyan: colors.cyan,
|
|
19
|
+
cyanBright: colors.cyanBright,
|
|
20
|
+
bgCyan: colors.bgCyan,
|
|
21
|
+
bgCyanBright: colors.bgCyanBright,
|
|
22
|
+
dim: colors.dim,
|
|
23
|
+
gray: colors.gray,
|
|
24
|
+
green: colors.green,
|
|
25
|
+
greenBright: colors.greenBright,
|
|
26
|
+
bgGreen: colors.bgGreen,
|
|
27
|
+
bgGreenBright: colors.bgGreenBright,
|
|
28
|
+
magenta: colors.magenta,
|
|
29
|
+
red: colors.red,
|
|
30
|
+
redBright: colors.redBright,
|
|
31
|
+
bgRed: colors.bgRed,
|
|
32
|
+
bgRedBright: colors.bgRedBright,
|
|
33
|
+
white: colors.white,
|
|
34
|
+
yellow: colors.yellow,
|
|
35
|
+
yellowBright: colors.yellowBright,
|
|
36
|
+
cristalGradient: cristal,
|
|
37
|
+
mindGradient: mind,
|
|
38
|
+
passionGradient: passion,
|
|
39
|
+
rainbowGradient: rainbow,
|
|
40
|
+
retroGradient: retro,
|
|
41
|
+
viceGradient: vice,
|
|
42
|
+
gradientGradient: gradient([
|
|
43
|
+
'red',
|
|
44
|
+
'yellow',
|
|
45
|
+
'green',
|
|
46
|
+
'cyan',
|
|
47
|
+
'blue',
|
|
48
|
+
'magenta',
|
|
49
|
+
]),
|
|
43
50
|
};
|
|
44
51
|
export const typographyMap = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
bold: chalk.bold,
|
|
53
|
+
italic: chalk.italic,
|
|
54
|
+
underline: chalk.underline,
|
|
55
|
+
strikethrough: chalk.strikethrough,
|
|
49
56
|
};
|
|
@@ -1,200 +1,200 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
greenBright,
|
|
3
|
+
redBright,
|
|
4
|
+
dim,
|
|
5
|
+
} from 'picocolors';
|
|
6
|
+
import {colorMap, typographyMap} from '../utils/mapping.js';
|
|
7
|
+
import {isUnicodeSupported} from '../utils/platforms.js';
|
|
8
|
+
import {variantMap} from '../utils/variants.js';
|
|
9
|
+
|
|
5
10
|
const unicode = isUnicodeSupported();
|
|
6
11
|
const u = (c, fallback) => unicode ? c : fallback;
|
|
12
|
+
|
|
7
13
|
export const symbols = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
pointer: u('\u{1F449}', '>'),
|
|
15
|
+
start: u('\u256D', 'T'),
|
|
16
|
+
middle: u('\u2502', '|'),
|
|
17
|
+
end: u('\u2570', '*'),
|
|
18
|
+
line: u('\u2500', '\u2014'),
|
|
19
|
+
corner_top_right: u('\xBB', 'T'),
|
|
20
|
+
step_active: u('\u25C6', '\u2666'),
|
|
21
|
+
step_error: u('\u{1F5F4}', 'x'),
|
|
22
|
+
info: u('\u2139', 'i'),
|
|
17
23
|
};
|
|
18
|
-
function applyStyles(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
function applyStyles(styledText, colorName = '', typographyName = '', variantName = '', borderColor = '') {
|
|
25
|
+
if (!variantName) {
|
|
26
|
+
if (colorName && colorMap[colorName]) {
|
|
27
|
+
styledText = colorMap[colorName](styledText);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typographyName && typographyMap[typographyName]) {
|
|
31
|
+
styledText = typographyMap[typographyName](styledText);
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
console.warn(
|
|
32
|
-
`Warning: Invalid typography "${typographyName}" provided to applyStyles.`
|
|
33
|
-
);
|
|
34
|
+
|
|
35
|
+
if (variantName && variantMap[variantName]) {
|
|
36
|
+
styledText = variantMap[variantName](styledText, borderColor);
|
|
34
37
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
styledText = variantMap[variantName](styledText, borderColor);
|
|
38
|
-
} else if (variantName) {
|
|
39
|
-
console.warn(
|
|
40
|
-
`Warning: Invalid variant "${variantName}" provided to applyStyles.`
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
return styledText;
|
|
38
|
+
|
|
39
|
+
return styledText;
|
|
44
40
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}) => colorMap[borderColor](symbols.middle);
|
|
41
|
+
|
|
42
|
+
export const bar = ({borderColor = 'viceGradient'}) => colorMap[borderColor](symbols.middle);
|
|
48
43
|
export function fmt(opts) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
opts.borderColor
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
44
|
+
if (opts.title?.includes('\u2502 ') && !opts.dontRemoveBar) {
|
|
45
|
+
opts.title = opts.title.replace('\u2502 ', '');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!opts.borderColor) {
|
|
49
|
+
opts.borderColor = 'viceGradient';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const formattedBar = bar({
|
|
53
|
+
borderColor: opts.borderColor,
|
|
54
|
+
});
|
|
55
|
+
const prefixStartLine = opts.borderColor ? colorMap[opts.borderColor](symbols.start + symbols.line) : symbols.start + symbols.line;
|
|
56
|
+
const prefixEndLine = opts.borderColor ? colorMap[opts.borderColor](symbols.end + symbols.line) : symbols.end + symbols.line;
|
|
57
|
+
const suffixStartLine = opts.borderColor ? colorMap[opts.borderColor](`${symbols.line.repeat(28)}\u22B1`) : `${symbols.line.repeat(28)}\u22B1`;
|
|
58
|
+
const suffixEndLine = opts.borderColor ? colorMap[opts.borderColor](`${symbols.line.repeat(58)}\u22B1`) : `${symbols.line.repeat(58)}\u22B1`;
|
|
59
|
+
|
|
60
|
+
const MSG_CONFIGS = {
|
|
61
|
+
M_NULL: {
|
|
62
|
+
symbol: '',
|
|
63
|
+
prefix: '',
|
|
64
|
+
suffix: '',
|
|
65
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
66
|
+
newLineAfter: opts.addNewLineAfter ?? false,
|
|
67
|
+
},
|
|
68
|
+
M_INFO_NULL: {
|
|
69
|
+
symbol: '',
|
|
70
|
+
prefix: formattedBar,
|
|
71
|
+
suffix: '',
|
|
72
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
73
|
+
newLineAfter: opts.addNewLineAfter ?? false,
|
|
74
|
+
},
|
|
75
|
+
M_START: {
|
|
76
|
+
symbol: '',
|
|
77
|
+
prefix: prefixStartLine,
|
|
78
|
+
suffix: ` ${suffixStartLine}
|
|
79
79
|
${formattedBar}`,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
80
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
81
|
+
newLineAfter: opts.addNewLineAfter ?? false,
|
|
82
|
+
},
|
|
83
|
+
M_MIDDLE: {
|
|
84
|
+
symbol: formattedBar,
|
|
85
|
+
prefix: '',
|
|
86
|
+
suffix: '',
|
|
87
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
88
|
+
newLineAfter: opts.addNewLineAfter ?? false,
|
|
89
|
+
},
|
|
90
|
+
M_GENERAL: {
|
|
91
|
+
symbol: '',
|
|
92
|
+
prefix: greenBright(symbols.step_active),
|
|
93
|
+
suffix: opts.placeholder ? dim(opts.placeholder) + '\n' + formattedBar + ' ' : '',
|
|
94
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
95
|
+
newLineAfter: opts.addNewLineAfter ?? true,
|
|
96
|
+
},
|
|
97
|
+
M_INFO: {
|
|
98
|
+
symbol: '',
|
|
99
|
+
prefix: greenBright(symbols.info),
|
|
100
|
+
suffix: '',
|
|
101
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
102
|
+
newLineAfter: opts.addNewLineAfter ?? true,
|
|
103
|
+
},
|
|
104
|
+
M_ERROR: {
|
|
105
|
+
symbol: '',
|
|
106
|
+
prefix: redBright(symbols.step_error),
|
|
107
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
108
|
+
newLineAfter: opts.addNewLineAfter ?? true,
|
|
109
|
+
},
|
|
110
|
+
M_END: {
|
|
111
|
+
symbol: '',
|
|
112
|
+
prefix: greenBright(symbols.info),
|
|
113
|
+
suffix: opts.border ? `
|
|
114
114
|
${formattedBar}
|
|
115
115
|
${prefixEndLine}${suffixEndLine}
|
|
116
|
-
` :
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
` : '',
|
|
117
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
118
|
+
newLineAfter: opts.addNewLineAfter ?? false,
|
|
119
|
+
},
|
|
120
|
+
M_NEWLINE: {
|
|
121
|
+
symbol: '',
|
|
122
|
+
prefix: formattedBar,
|
|
123
|
+
newLineBefore: opts.addNewLineBefore ?? false,
|
|
124
|
+
newLineAfter: opts.addNewLineAfter ?? false,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const config = MSG_CONFIGS[opts.type];
|
|
129
|
+
|
|
130
|
+
if (!config) {
|
|
131
|
+
throw Error(`Invalid message type: ${opts.type}`);
|
|
125
132
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
opts.title,
|
|
146
|
-
opts.titleColor,
|
|
147
|
-
opts.titleTypography,
|
|
148
|
-
opts.titleVariant,
|
|
149
|
-
opts.borderColor
|
|
150
|
-
);
|
|
151
|
-
if (opts.hint) {
|
|
152
|
-
formattedTitle += `
|
|
133
|
+
|
|
134
|
+
const {
|
|
135
|
+
symbol = '',
|
|
136
|
+
prefix = '',
|
|
137
|
+
suffix = '',
|
|
138
|
+
newLineBefore = false,
|
|
139
|
+
newLineAfter = false,
|
|
140
|
+
} = config;
|
|
141
|
+
|
|
142
|
+
const formattedPrefix = prefix ? `${prefix}${opts.type === 'M_START' ? ' ' : ' '}` : '';
|
|
143
|
+
const border = applyStyles(symbols.middle, opts.borderColor);
|
|
144
|
+
const borderError = applyStyles(symbols.middle, 'red');
|
|
145
|
+
const borderWithSpace = `${border} `;
|
|
146
|
+
let formattedTitle = '';
|
|
147
|
+
|
|
148
|
+
if (opts.title) {
|
|
149
|
+
formattedTitle = applyStyles(opts.title, opts.titleColor, opts.titleTypography, opts.titleVariant, opts.borderColor);
|
|
150
|
+
if (opts.hint) {
|
|
151
|
+
formattedTitle += `
|
|
153
152
|
${borderWithSpace}${colorMap.blueBright(opts.hint)}`;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"",
|
|
161
|
-
opts.borderColor
|
|
162
|
-
);
|
|
163
|
-
formattedTitle += `
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (opts.errorMessage) {
|
|
156
|
+
const formattedError = applyStyles(opts.errorMessage, 'red', 'bold', '', opts.borderColor);
|
|
157
|
+
|
|
158
|
+
formattedTitle += `
|
|
164
159
|
${borderError} ${formattedError}`;
|
|
160
|
+
}
|
|
165
161
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
162
|
+
|
|
163
|
+
let formattedContent = '';
|
|
164
|
+
|
|
165
|
+
if (opts.content) {
|
|
166
|
+
const contentLines = opts.content.split('\n');
|
|
167
|
+
|
|
168
|
+
formattedContent = contentLines
|
|
169
|
+
.map((line) => {
|
|
170
|
+
const styledLine = applyStyles(line, opts.contentColor, opts.contentTypography, opts.contentVariant, opts.borderColor);
|
|
171
|
+
|
|
172
|
+
if (opts.type !== 'M_START') {
|
|
173
|
+
return `${borderWithSpace}${styledLine}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return styledLine;
|
|
177
|
+
})
|
|
178
|
+
.join('\n');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const text = [formattedTitle, formattedContent]
|
|
182
|
+
.filter(Boolean)
|
|
183
|
+
.join(`
|
|
186
184
|
`);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
185
|
+
|
|
186
|
+
return [
|
|
187
|
+
symbol,
|
|
188
|
+
newLineBefore ? `
|
|
189
|
+
${formattedBar} ` : '',
|
|
190
|
+
formattedPrefix,
|
|
191
|
+
text,
|
|
192
|
+
newLineAfter ? `
|
|
193
|
+
${formattedBar} ` : '',
|
|
194
|
+
suffix,
|
|
195
|
+
]
|
|
196
|
+
.filter(Boolean)
|
|
197
|
+
.join('');
|
|
200
198
|
}
|
|
199
|
+
|
|
200
|
+
export function msg() {}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import process from
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
|
|
2
3
|
const platforms = {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
linux: process.platform !== 'win32',
|
|
5
|
+
win32: process.platform === 'win32',
|
|
5
6
|
};
|
|
7
|
+
|
|
6
8
|
const terminals = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
linuxConsoleKernel: process.env.TERM !== 'linux',
|
|
10
|
+
windowsTerminal: Boolean(process.env.WT_SESSION),
|
|
11
|
+
terminusSublimeOld: Boolean(process.env.TERMINUS_SUBLIME),
|
|
12
|
+
cmderTerminal: process.env.ConEmuTask === '{cmd::Cmder}',
|
|
13
|
+
terminusSublimeNew: process.env.TERM_PROGRAM === 'Terminus-Sublime',
|
|
14
|
+
visualStudioCode: process.env.TERM_PROGRAM === 'vscode',
|
|
15
|
+
xterm256color: process.env.TERM === 'xterm-256color',
|
|
16
|
+
alacrittyTerminal: process.env.TERM === 'alacritty',
|
|
17
|
+
jetbrainsJediTerm: process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm',
|
|
16
18
|
};
|
|
19
|
+
|
|
17
20
|
export function isUnicodeSupported() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (platforms.linux) {
|
|
22
|
+
return terminals.linuxConsoleKernel;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return terminals.windowsTerminal || terminals.terminusSublimeOld || terminals.cmderTerminal || terminals.terminusSublimeNew || terminals.visualStudioCode || terminals.xterm256color || terminals.alacrittyTerminal || terminals.jetbrainsJediTerm;
|
|
22
26
|
}
|