@ghl-ai/aw 0.1.36-beta.42 → 0.1.36-beta.43
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/fmt.mjs +30 -9
- package/package.json +1 -1
package/fmt.mjs
CHANGED
|
@@ -8,6 +8,19 @@ export { chalk };
|
|
|
8
8
|
|
|
9
9
|
// ─── Banner ───
|
|
10
10
|
|
|
11
|
+
// Big ASCII art icons — same height as ANSI Shadow font (6 lines)
|
|
12
|
+
// Placed BEFORE the text, same scale as the letters
|
|
13
|
+
const ICON_ART = {
|
|
14
|
+
'⟁': [
|
|
15
|
+
' ▲ ',
|
|
16
|
+
' ▲▲▲ ',
|
|
17
|
+
' ▲▲▲▲▲ ',
|
|
18
|
+
' ▲▲▲▲▲▲▲ ',
|
|
19
|
+
' ▲▲▲▲▲▲▲▲▲ ',
|
|
20
|
+
'▲▲▲▲▲▲▲▲▲▲▲',
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
|
|
11
24
|
export function banner(text, opts = {}) {
|
|
12
25
|
const {
|
|
13
26
|
font = 'ANSI Shadow',
|
|
@@ -21,19 +34,27 @@ export function banner(text, opts = {}) {
|
|
|
21
34
|
const art = figlet.textSync(text, { font, horizontalLayout: 'default' });
|
|
22
35
|
const divider = chalk.dim(dividerChar.repeat(Math.min(cols, 80)));
|
|
23
36
|
|
|
24
|
-
let artStr
|
|
25
|
-
if (icon) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
let artStr;
|
|
38
|
+
if (icon && ICON_ART[icon]) {
|
|
39
|
+
// Prepend big icon art side-by-side with the text art
|
|
40
|
+
const iconLines = [...ICON_ART[icon]];
|
|
41
|
+
const textLines = art.split('\n');
|
|
42
|
+
// Strip trailing empty lines from figlet output
|
|
43
|
+
while (textLines.length > 0 && !textLines[textLines.length - 1].trim()) textLines.pop();
|
|
44
|
+
// Pad both sides to the same height
|
|
45
|
+
const maxH = Math.max(iconLines.length, textLines.length);
|
|
46
|
+
const iconW = iconLines[0].length;
|
|
47
|
+
while (iconLines.length < maxH) iconLines.unshift(' '.repeat(iconW));
|
|
48
|
+
while (textLines.length < maxH) textLines.push('');
|
|
49
|
+
// Combine side by side
|
|
50
|
+
artStr = iconLines.map((il, i) => `${color(il)} ${color(textLines[i])}`).join('\n');
|
|
51
|
+
} else {
|
|
52
|
+
artStr = color(art);
|
|
32
53
|
}
|
|
33
54
|
|
|
34
55
|
console.log('');
|
|
35
56
|
console.log(divider);
|
|
36
|
-
console.log(
|
|
57
|
+
console.log(artStr);
|
|
37
58
|
console.log(divider);
|
|
38
59
|
if (subtitle) {
|
|
39
60
|
console.log('');
|