blyuecode 0.1.4 → 0.1.5
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 +34 -29
- package/dist/ui/RocketBar.js +28 -16
- package/package.json +1 -1
package/dist/ui/Banner.js
CHANGED
|
@@ -17,25 +17,30 @@ function getVersion() {
|
|
|
17
17
|
return '0.0.0';
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
//
|
|
21
|
-
function
|
|
22
|
-
if (process.env.
|
|
23
|
-
return true;
|
|
24
|
-
if (process.env.BLYUE_SLOW === '1')
|
|
20
|
+
// Static mode = no animation. Animated mode = hue cycling.
|
|
21
|
+
function shouldAnimate() {
|
|
22
|
+
if (process.env.BLYUE_ANIMATE === '1')
|
|
25
23
|
return true;
|
|
24
|
+
if (process.env.BLYUE_STATIC === '1')
|
|
25
|
+
return false;
|
|
26
26
|
try {
|
|
27
|
-
// total RAM in GB
|
|
28
27
|
const gb = os.totalmem() / 1024 / 1024 / 1024;
|
|
29
|
-
if (gb < 6)
|
|
30
|
-
return true;
|
|
31
|
-
// CPU cores — Atom usually has 2-4
|
|
32
28
|
const cores = os.cpus().length;
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const mhz = os.cpus()[0]?.speed || 0;
|
|
30
|
+
// Atom = ~1.6 GHz, 4GB → static
|
|
31
|
+
if (gb < 8)
|
|
32
|
+
return false;
|
|
33
|
+
if (cores < 4)
|
|
34
|
+
return false;
|
|
35
|
+
if (mhz > 0 && mhz < 2200)
|
|
36
|
+
return false;
|
|
35
37
|
}
|
|
36
38
|
catch { }
|
|
37
|
-
return
|
|
39
|
+
return true;
|
|
38
40
|
}
|
|
41
|
+
// ─────────────────────────────────────────────
|
|
42
|
+
// BLYUE — 44 cols wide (all lines same length)
|
|
43
|
+
// ─────────────────────────────────────────────
|
|
39
44
|
const BLYUE_BIG = [
|
|
40
45
|
'██████╗ ██╗ ██╗ ██╗ ██╗ ██╗ ███████╗',
|
|
41
46
|
'██╔══██╗██║ ╚██╗ ██╔╝ ██║ ██║ ██╔════╝',
|
|
@@ -50,17 +55,20 @@ const BLYUE_SMALL = [
|
|
|
50
55
|
'| _ \\| |__| |_| | |_| | _| ',
|
|
51
56
|
'|___/|____|\\___/ \\___/|___|',
|
|
52
57
|
];
|
|
58
|
+
// ─────────────────────────────────────────────
|
|
59
|
+
// CODE — 33 cols wide, indented 6 spaces to center under 44-wide BLYUE
|
|
60
|
+
// ─────────────────────────────────────────────
|
|
53
61
|
const CODE_BIG = [
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'
|
|
62
|
+
' ██████╗ ██████╗ ██████╗ ███████╗',
|
|
63
|
+
' ██╔════╝██╔═══██╗██╔══██╗██╔════╝',
|
|
64
|
+
' ██║ ██║ ██║██║ ██║█████╗ ',
|
|
65
|
+
' ██║ ██║ ██║██║ ██║██╔══╝ ',
|
|
66
|
+
' ╚██████╗╚██████╔╝██████╔╝███████╗',
|
|
67
|
+
' ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝',
|
|
60
68
|
];
|
|
61
69
|
const CODE_SMALL = [
|
|
62
|
-
'
|
|
63
|
-
'
|
|
70
|
+
' █▀▀ █▀█ █▀▄ █▀▀',
|
|
71
|
+
' █▄▄ █▄█ █▄▀ ██▄',
|
|
64
72
|
];
|
|
65
73
|
export const Banner = () => {
|
|
66
74
|
const { stdout } = useStdout();
|
|
@@ -68,18 +76,15 @@ export const Banner = () => {
|
|
|
68
76
|
const wide = width >= 60;
|
|
69
77
|
const blyue = wide ? BLYUE_BIG : BLYUE_SMALL;
|
|
70
78
|
const code = wide ? CODE_BIG : CODE_SMALL;
|
|
71
|
-
const [
|
|
79
|
+
const [animate] = useState(() => shouldAnimate());
|
|
72
80
|
const [t, setT] = useState(0);
|
|
73
81
|
useEffect(() => {
|
|
74
|
-
if (
|
|
75
|
-
return;
|
|
76
|
-
const interval = setInterval(() =>
|
|
77
|
-
setT((v) => (v + 1 / 320) % 1);
|
|
78
|
-
}, 100);
|
|
82
|
+
if (!animate)
|
|
83
|
+
return;
|
|
84
|
+
const interval = setInterval(() => setT((v) => (v + 1 / 320) % 1), 120);
|
|
79
85
|
return () => clearInterval(interval);
|
|
80
|
-
}, [
|
|
81
|
-
|
|
82
|
-
const baseHue = staticMode ? 0.15 : t;
|
|
86
|
+
}, [animate]);
|
|
87
|
+
const baseHue = animate ? t : 0.1;
|
|
83
88
|
const brand = hueAt(baseHue);
|
|
84
89
|
const version = getVersion();
|
|
85
90
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(MakerMark, { color: brand }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06) % 1), bold: true, children: line }, 'b' + i))), code.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06 + 0.35) % 1), bold: true, children: line }, 'c' + i))), _jsx(Text, { children: " " }), _jsx(Text, { color: "gray", children: 'a coding agent · v' + version }), _jsx(Text, { children: " " })] }));
|
package/dist/ui/RocketBar.js
CHANGED
|
@@ -1,41 +1,53 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { Text } from 'ink';
|
|
4
|
+
import os from 'os';
|
|
4
5
|
import { theme } from './theme.js';
|
|
5
6
|
import { hueAt } from './animColor.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (process.env.BLYUE_STATIC === '1')
|
|
7
|
+
function shouldAnimate() {
|
|
8
|
+
if (process.env.BLYUE_ANIMATE === '1')
|
|
9
9
|
return true;
|
|
10
|
+
if (process.env.BLYUE_STATIC === '1')
|
|
11
|
+
return false;
|
|
10
12
|
try {
|
|
11
|
-
|
|
13
|
+
const gb = os.totalmem() / 1024 / 1024 / 1024;
|
|
14
|
+
const cores = os.cpus().length;
|
|
15
|
+
const mhz = os.cpus()[0]?.speed || 0;
|
|
16
|
+
if (gb < 8)
|
|
17
|
+
return false;
|
|
18
|
+
if (cores < 4)
|
|
19
|
+
return false;
|
|
20
|
+
if (mhz > 0 && mhz < 2200)
|
|
21
|
+
return false;
|
|
12
22
|
}
|
|
13
23
|
catch { }
|
|
14
|
-
return
|
|
24
|
+
return true;
|
|
15
25
|
}
|
|
16
26
|
export const RocketBar = ({ label, loading, width }) => {
|
|
17
|
-
const [
|
|
27
|
+
const [animate] = useState(() => shouldAnimate());
|
|
18
28
|
const [t, setT] = useState(0);
|
|
19
29
|
const [pos, setPos] = useState(0);
|
|
20
|
-
// Slower tick on low-spec machines
|
|
21
|
-
const tickMs = slow ? 200 : 50;
|
|
22
|
-
const rocketMs = slow ? 200 : 65;
|
|
23
30
|
useEffect(() => {
|
|
24
|
-
if (
|
|
25
|
-
return;
|
|
26
|
-
const int = setInterval(() => setT((v) => (v + 0.00625) % 1),
|
|
31
|
+
if (!animate)
|
|
32
|
+
return;
|
|
33
|
+
const int = setInterval(() => setT((v) => (v + 0.00625) % 1), 120);
|
|
27
34
|
return () => clearInterval(int);
|
|
28
|
-
}, [
|
|
35
|
+
}, [animate]);
|
|
29
36
|
const fixed = 5 + label.length;
|
|
30
37
|
const midLen = Math.max(0, width - fixed);
|
|
31
38
|
useEffect(() => {
|
|
32
39
|
if (!loading || midLen < 6)
|
|
33
40
|
return;
|
|
41
|
+
// Static mode: no rocket motion, just fixed at 1/3 position
|
|
42
|
+
if (!animate) {
|
|
43
|
+
setPos(Math.floor(midLen / 3));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
34
46
|
const track = midLen - 2;
|
|
35
|
-
const int = setInterval(() => setPos((p) => (p + 1) % track),
|
|
47
|
+
const int = setInterval(() => setPos((p) => (p + 1) % track), 90);
|
|
36
48
|
return () => clearInterval(int);
|
|
37
|
-
}, [loading, midLen,
|
|
38
|
-
const hue = hueAt(t);
|
|
49
|
+
}, [loading, midLen, animate]);
|
|
50
|
+
const hue = animate ? hueAt(t) : hueAt(0.1);
|
|
39
51
|
if (!loading || midLen < 6) {
|
|
40
52
|
return (_jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: '╭─ ' }), _jsx(Text, { color: loading ? hue : theme.accent, bold: true, children: label }), _jsx(Text, { color: theme.muted, children: ' ' + '─'.repeat(midLen) + '╮' })] }));
|
|
41
53
|
}
|