sitevision-cli 0.6.0-beta.0 → 0.6.0-beta.1
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/AnimatedLogo.js +21 -17
- package/package.json +1 -1
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { Box, Text } from 'ink';
|
|
4
|
-
import { BIG_LOGO, BIG_LOGO_WIDTH } from '../utils/branding.js';
|
|
4
|
+
import { AUTHOR, BIG_LOGO, BIG_LOGO_WIDTH } from '../utils/branding.js';
|
|
5
5
|
const FRAME_MS = 45;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const SWEEP_COLS_PER_FRAME = 7; // how fast the wipe edge moves left → right
|
|
7
|
+
const BAND = 18; // width of the rainbow zone trailing the sweep edge
|
|
8
|
+
const HOLD_FRAMES = 6; // frames to hold the fully-settled logo before finishing
|
|
9
|
+
// The sweep edge runs past the right side by BAND so the rainbow zone trails
|
|
10
|
+
// all the way off, leaving every character settled to the terminal default.
|
|
11
|
+
const SWEEP_FRAMES = Math.ceil((BIG_LOGO_WIDTH + BAND) / SWEEP_COLS_PER_FRAME);
|
|
12
|
+
const TOTAL_FRAMES = SWEEP_FRAMES + HOLD_FRAMES;
|
|
10
13
|
// Convert HSL (h in degrees, s/l in 0..1) to a #rrggbb string for ink/chalk.
|
|
11
14
|
function hslToHex(h, s, l) {
|
|
12
15
|
const hue = h / 360;
|
|
@@ -22,22 +25,25 @@ function hslToHex(h, s, l) {
|
|
|
22
25
|
};
|
|
23
26
|
return `#${channel(0)}${channel(8)}${channel(4)}`;
|
|
24
27
|
}
|
|
25
|
-
function buildSpans(line, y, frame,
|
|
28
|
+
function buildSpans(line, y, frame, edge) {
|
|
26
29
|
const spans = [];
|
|
27
30
|
for (const [x, char] of [...line].entries()) {
|
|
28
|
-
const hidden = x
|
|
29
|
-
|
|
31
|
+
const hidden = x > edge;
|
|
32
|
+
// Distance behind the sweep edge. Inside BAND → rainbow; past it the
|
|
33
|
+
// character has "settled" to the terminal default (no colour override).
|
|
34
|
+
const behind = edge - x;
|
|
35
|
+
const lit = !hidden && char !== ' ' && behind < BAND;
|
|
30
36
|
// Moving diagonal rainbow: hue depends on column + row + time, quantised
|
|
31
37
|
// so neighbouring characters share a colour and runs stay long.
|
|
32
38
|
const col = x * 1.6;
|
|
33
39
|
const row = y * 6;
|
|
34
40
|
const time = frame * 7;
|
|
35
41
|
const stepped = Math.round((col + row + time) / 8) * 8;
|
|
36
|
-
const hue =
|
|
42
|
+
const hue = stepped % 360;
|
|
37
43
|
// Shadow characters sit darker than the solid blocks for a bit of depth.
|
|
38
|
-
const color =
|
|
39
|
-
?
|
|
40
|
-
:
|
|
44
|
+
const color = lit
|
|
45
|
+
? hslToHex(hue, 0.95, char === '░' ? 0.32 : 0.58)
|
|
46
|
+
: undefined;
|
|
41
47
|
const text = hidden ? ' ' : char;
|
|
42
48
|
const last = spans.at(-1);
|
|
43
49
|
if (last && last.color === color) {
|
|
@@ -72,8 +78,6 @@ export function AnimatedLogo({ onDone }) {
|
|
|
72
78
|
onDone();
|
|
73
79
|
}
|
|
74
80
|
}, [frame, onDone]);
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
: (frame + 1) * REVEAL_COLS_PER_FRAME;
|
|
78
|
-
return (_jsx(Box, { flexDirection: "column", padding: 1, children: BIG_LOGO.map((line, y) => (_jsx(Text, { children: buildSpans(line, y, frame, reveal).map((span, index) => (_jsx(Fragment, { children: span.color ? (_jsx(Text, { color: span.color, children: span.text })) : (_jsx(Text, { children: span.text })) }, index))) }, y))) }));
|
|
81
|
+
const edge = (frame + 1) * SWEEP_COLS_PER_FRAME;
|
|
82
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [BIG_LOGO.map((line, y) => (_jsx(Text, { children: buildSpans(line, y, frame, edge).map((span, index) => (_jsx(Fragment, { children: span.color ? (_jsx(Text, { color: span.color, children: span.text })) : (_jsx(Text, { children: span.text })) }, index))) }, y))), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { dimColor: true, children: ' a tool by ' }), _jsx(Text, { bold: true, children: AUTHOR })] })] }));
|
|
79
83
|
}
|