blyuecode 0.1.5 → 0.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/ui/Banner.js +10 -11
- package/package.json +1 -1
package/dist/ui/Banner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { Box, Text, useStdout } from 'ink';
|
|
4
4
|
import { readFileSync } from 'fs';
|
|
@@ -6,7 +6,6 @@ import { fileURLToPath } from 'url';
|
|
|
6
6
|
import { dirname, join } from 'path';
|
|
7
7
|
import os from 'os';
|
|
8
8
|
import { hueAt } from './animColor.js';
|
|
9
|
-
import { MakerMark } from './MakerMark.js';
|
|
10
9
|
function getVersion() {
|
|
11
10
|
try {
|
|
12
11
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
@@ -17,7 +16,6 @@ function getVersion() {
|
|
|
17
16
|
return '0.0.0';
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
// Static mode = no animation. Animated mode = hue cycling.
|
|
21
19
|
function shouldAnimate() {
|
|
22
20
|
if (process.env.BLYUE_ANIMATE === '1')
|
|
23
21
|
return true;
|
|
@@ -27,7 +25,6 @@ function shouldAnimate() {
|
|
|
27
25
|
const gb = os.totalmem() / 1024 / 1024 / 1024;
|
|
28
26
|
const cores = os.cpus().length;
|
|
29
27
|
const mhz = os.cpus()[0]?.speed || 0;
|
|
30
|
-
// Atom = ~1.6 GHz, 4GB → static
|
|
31
28
|
if (gb < 8)
|
|
32
29
|
return false;
|
|
33
30
|
if (cores < 4)
|
|
@@ -38,9 +35,6 @@ function shouldAnimate() {
|
|
|
38
35
|
catch { }
|
|
39
36
|
return true;
|
|
40
37
|
}
|
|
41
|
-
// ─────────────────────────────────────────────
|
|
42
|
-
// BLYUE — 44 cols wide (all lines same length)
|
|
43
|
-
// ─────────────────────────────────────────────
|
|
44
38
|
const BLYUE_BIG = [
|
|
45
39
|
'██████╗ ██╗ ██╗ ██╗ ██╗ ██╗ ███████╗',
|
|
46
40
|
'██╔══██╗██║ ╚██╗ ██╔╝ ██║ ██║ ██╔════╝',
|
|
@@ -55,9 +49,6 @@ const BLYUE_SMALL = [
|
|
|
55
49
|
'| _ \\| |__| |_| | |_| | _| ',
|
|
56
50
|
'|___/|____|\\___/ \\___/|___|',
|
|
57
51
|
];
|
|
58
|
-
// ─────────────────────────────────────────────
|
|
59
|
-
// CODE — 33 cols wide, indented 6 spaces to center under 44-wide BLYUE
|
|
60
|
-
// ─────────────────────────────────────────────
|
|
61
52
|
const CODE_BIG = [
|
|
62
53
|
' ██████╗ ██████╗ ██████╗ ███████╗',
|
|
63
54
|
' ██╔════╝██╔═══██╗██╔══██╗██╔════╝',
|
|
@@ -70,12 +61,18 @@ const CODE_SMALL = [
|
|
|
70
61
|
' █▀▀ █▀█ █▀▄ █▀▀',
|
|
71
62
|
' █▄▄ █▄█ █▄▀ ██▄',
|
|
72
63
|
];
|
|
64
|
+
const BLYUE_WIDTH = 44;
|
|
65
|
+
const BLYUE_SMALL_WIDTH = 27;
|
|
73
66
|
export const Banner = () => {
|
|
74
67
|
const { stdout } = useStdout();
|
|
75
68
|
const width = stdout?.columns ?? 80;
|
|
76
69
|
const wide = width >= 60;
|
|
77
70
|
const blyue = wide ? BLYUE_BIG : BLYUE_SMALL;
|
|
78
71
|
const code = wide ? CODE_BIG : CODE_SMALL;
|
|
72
|
+
const blockWidth = wide ? BLYUE_WIDTH : BLYUE_SMALL_WIDTH;
|
|
73
|
+
// Left padding to center whole block in terminal
|
|
74
|
+
const leftPad = Math.max(0, Math.floor((width - blockWidth) / 2));
|
|
75
|
+
const pad = ' '.repeat(leftPad);
|
|
79
76
|
const [animate] = useState(() => shouldAnimate());
|
|
80
77
|
const [t, setT] = useState(0);
|
|
81
78
|
useEffect(() => {
|
|
@@ -87,5 +84,7 @@ export const Banner = () => {
|
|
|
87
84
|
const baseHue = animate ? t : 0.1;
|
|
88
85
|
const brand = hueAt(baseHue);
|
|
89
86
|
const version = getVersion();
|
|
90
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(
|
|
87
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [pad, _jsx(MakerMarkInline, { color: brand })] }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06) % 1), bold: true, children: pad + line }, 'b' + i))), code.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06 + 0.35) % 1), bold: true, children: pad + line }, 'c' + i))), _jsx(Text, { children: " " }), _jsxs(Text, { children: [pad, _jsx(Text, { color: "gray", children: 'a coding agent · v' + version })] }), _jsx(Text, { children: " " })] }));
|
|
91
88
|
};
|
|
89
|
+
// Inline version of MakerMark so it aligns inside the padded Text
|
|
90
|
+
const MakerMarkInline = ({ color }) => (_jsxs(_Fragment, { children: [_jsx(Text, { color: color, bold: true, children: "\u25C6 " }), _jsx(Text, { color: color, bold: true, children: "L U M E N" })] }));
|