create-rezi 0.1.0-alpha.51 → 0.1.0-alpha.53
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/README.md +6 -0
- package/package.json +2 -2
- package/templates/animation-lab/README.md +4 -3
- package/templates/animation-lab/package.json +1 -1
- package/templates/animation-lab/src/__tests__/keybindings.test.ts +1 -0
- package/templates/animation-lab/src/__tests__/reducer.test.ts +8 -0
- package/templates/animation-lab/src/helpers/keybindings.ts +3 -1
- package/templates/animation-lab/src/helpers/state.ts +10 -0
- package/templates/animation-lab/src/main.ts +26 -5
- package/templates/animation-lab/src/screens/reactor-lab.ts +190 -118
- package/templates/animation-lab/src/theme.ts +63 -0
- package/templates/animation-lab/src/types.ts +4 -0
- package/templates/cli-tool/README.md +1 -0
- package/templates/cli-tool/package.json +1 -1
- package/templates/cli-tool/src/__tests__/reducer.test.ts +7 -0
- package/templates/cli-tool/src/helpers/state.ts +2 -1
- package/templates/cli-tool/src/screens/settings.ts +5 -20
- package/templates/cli-tool/src/screens/shell.ts +5 -3
- package/templates/cli-tool/src/theme.ts +14 -1
- package/templates/dashboard/README.md +1 -0
- package/templates/dashboard/package.json +1 -1
- package/templates/dashboard/src/screens/overview.ts +15 -18
- package/templates/minimal/README.md +1 -0
- package/templates/minimal/package.json +1 -1
- package/templates/minimal/src/helpers/state.ts +2 -2
- package/templates/minimal/src/screens/main-screen.ts +27 -12
- package/templates/minimal/src/theme.ts +20 -2
- package/templates/starship/package.json +1 -1
- package/templates/starship/src/screens/bridge.ts +11 -11
- package/templates/starship/src/screens/cargo.ts +13 -10
- package/templates/starship/src/screens/comms.ts +4 -4
- package/templates/starship/src/screens/engineering.ts +2 -3
- package/templates/starship/src/screens/primitives.ts +13 -3
- package/templates/starship/src/screens/shell.ts +71 -78
- package/templates/starship/src/theme.ts +125 -156
- package/templates/stress-test/README.md +2 -0
- package/templates/stress-test/package.json +1 -1
- package/templates/stress-test/src/main.ts +131 -34
package/README.md
CHANGED
|
@@ -66,5 +66,11 @@ Scaffolded templates now follow the same baseline structure:
|
|
|
66
66
|
- `src/main.ts`
|
|
67
67
|
- `src/__tests__/`
|
|
68
68
|
|
|
69
|
+
Template theming convention:
|
|
70
|
+
|
|
71
|
+
- `src/theme.ts` is the canonical source for theme catalogs and style helpers.
|
|
72
|
+
- Screens should derive visual styling from active theme tokens instead of hardcoded RGB/hex literals.
|
|
73
|
+
- `stress-test` is the current exception and keeps theme/catalog wiring in `src/main.ts`.
|
|
74
|
+
|
|
69
75
|
For template descriptions and highlights, see:
|
|
70
76
|
https://rezitui.dev/docs/getting-started/create-rezi/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rezi",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.53",
|
|
4
4
|
"description": "Scaffold a Rezi terminal UI app.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://rezitui.dev",
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"bun": ">=1.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@rezi-ui/testkit": "0.1.0-alpha.
|
|
31
|
+
"@rezi-ui/testkit": "0.1.0-alpha.53"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -9,12 +9,12 @@ Scaffolded with `create-rezi` using the **__TEMPLATE_LABEL__** template.
|
|
|
9
9
|
- Canvas-driven reactor visualization combined with charts, gauges, and staggered module rails.
|
|
10
10
|
- Reducer-managed animation targets with deterministic tick updates.
|
|
11
11
|
- Responsive layout that adapts to terminal resize events.
|
|
12
|
-
- Keyboard controls for autoplay, single-step, vector tuning, burst impulses, and
|
|
12
|
+
- Keyboard controls for autoplay, single-step, vector tuning, burst impulses, phase cycling, and theme cycling.
|
|
13
13
|
|
|
14
14
|
## File Layout
|
|
15
15
|
|
|
16
16
|
- `src/types.ts`: animation state and action contracts.
|
|
17
|
-
- `src/theme.ts`: template identity
|
|
17
|
+
- `src/theme.ts`: template identity + built-in theme catalog.
|
|
18
18
|
- `src/helpers/state.ts`: viewport normalization + reducer transitions.
|
|
19
19
|
- `src/helpers/keybindings.ts`: key to command resolver.
|
|
20
20
|
- `src/screens/reactor-lab.ts`: reactor field screen renderer.
|
|
@@ -41,4 +41,5 @@ bun run start
|
|
|
41
41
|
- Arrow keys: Nudge drift/flux/orbit vectors
|
|
42
42
|
- `b`: Burst impulse
|
|
43
43
|
- `r`: Randomized retarget
|
|
44
|
-
- `m`: Cycle
|
|
44
|
+
- `m`: Cycle phase
|
|
45
|
+
- `t`: Cycle theme preset
|
|
@@ -9,5 +9,6 @@ test("animation lab keybinding map resolves expected commands", () => {
|
|
|
9
9
|
assert.equal(resolveAnimationLabCommand("right"), "nudge-right");
|
|
10
10
|
assert.equal(resolveAnimationLabCommand("b"), "burst");
|
|
11
11
|
assert.equal(resolveAnimationLabCommand("m"), "cycle-phase");
|
|
12
|
+
assert.equal(resolveAnimationLabCommand("t"), "cycle-theme");
|
|
12
13
|
assert.equal(resolveAnimationLabCommand("x"), undefined);
|
|
13
14
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
3
|
import { createInitialState, reduceAnimationLabState } from "../helpers/state.js";
|
|
4
|
+
import { DEFAULT_THEME_NAME } from "../theme.js";
|
|
4
5
|
|
|
5
6
|
test("animation lab reducer advances and keeps bounds", () => {
|
|
6
7
|
const initial = createInitialState();
|
|
@@ -39,3 +40,10 @@ test("animation lab reducer supports nudge and phase cycle", () => {
|
|
|
39
40
|
assert.ok(cycled.driftTarget > initial.driftTarget);
|
|
40
41
|
assert.ok(cycled.fluxTarget > initial.fluxTarget);
|
|
41
42
|
});
|
|
43
|
+
|
|
44
|
+
test("animation lab reducer cycles theme", () => {
|
|
45
|
+
const initial = createInitialState();
|
|
46
|
+
assert.equal(initial.themeName, DEFAULT_THEME_NAME);
|
|
47
|
+
const next = reduceAnimationLabState(initial, { type: "cycle-theme" });
|
|
48
|
+
assert.notEqual(next.themeName, initial.themeName);
|
|
49
|
+
});
|
|
@@ -8,7 +8,8 @@ export type AnimationLabCommand =
|
|
|
8
8
|
| "nudge-down"
|
|
9
9
|
| "burst"
|
|
10
10
|
| "randomize"
|
|
11
|
-
| "cycle-phase"
|
|
11
|
+
| "cycle-phase"
|
|
12
|
+
| "cycle-theme";
|
|
12
13
|
|
|
13
14
|
const COMMAND_MAP: Readonly<Record<string, AnimationLabCommand>> = Object.freeze({
|
|
14
15
|
q: "quit",
|
|
@@ -23,6 +24,7 @@ const COMMAND_MAP: Readonly<Record<string, AnimationLabCommand>> = Object.freeze
|
|
|
23
24
|
b: "burst",
|
|
24
25
|
r: "randomize",
|
|
25
26
|
m: "cycle-phase",
|
|
27
|
+
t: "cycle-theme",
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
export function resolveAnimationLabCommand(key: string): AnimationLabCommand | undefined {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_THEME_NAME, cycleThemeName } from "../theme.js";
|
|
1
2
|
import type { AnimationLabAction, AnimationLabState, NudgePayload } from "../types.js";
|
|
2
3
|
|
|
3
4
|
const MODULE_SET: readonly string[] = Object.freeze([
|
|
@@ -48,6 +49,7 @@ export function createInitialState(viewport?: Viewport): AnimationLabState {
|
|
|
48
49
|
return Object.freeze({
|
|
49
50
|
tick: 0,
|
|
50
51
|
phase: 0,
|
|
52
|
+
themeName: DEFAULT_THEME_NAME,
|
|
51
53
|
viewportCols: layout.viewportCols,
|
|
52
54
|
viewportRows: layout.viewportRows,
|
|
53
55
|
panelOpacity: 0.9,
|
|
@@ -84,6 +86,7 @@ function advanceState(previous: AnimationLabState): AnimationLabState {
|
|
|
84
86
|
return Object.freeze({
|
|
85
87
|
tick: nextTick,
|
|
86
88
|
phase: previous.phase,
|
|
89
|
+
themeName: previous.themeName,
|
|
87
90
|
viewportCols: previous.viewportCols,
|
|
88
91
|
viewportRows: previous.viewportRows,
|
|
89
92
|
panelOpacity: clamp(panelOpacityTarget, 0.3, 1),
|
|
@@ -126,6 +129,13 @@ export function reduceAnimationLabState(
|
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
|
|
132
|
+
if (action.type === "cycle-theme") {
|
|
133
|
+
return Object.freeze({
|
|
134
|
+
...previous,
|
|
135
|
+
themeName: cycleThemeName(previous.themeName),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
129
139
|
if (action.type === "burst") {
|
|
130
140
|
return applyNudge(previous, { burstDelta: 0.9 });
|
|
131
141
|
}
|
|
@@ -3,6 +3,7 @@ import { createNodeApp } from "@rezi-ui/node";
|
|
|
3
3
|
import { resolveAnimationLabCommand } from "./helpers/keybindings.js";
|
|
4
4
|
import { createInitialState, reduceAnimationLabState } from "./helpers/state.js";
|
|
5
5
|
import { renderReactorLab } from "./screens/reactor-lab.js";
|
|
6
|
+
import { cycleThemeName, themeSpec } from "./theme.js";
|
|
6
7
|
import type { AnimationLabAction, NudgePayload } from "./types.js";
|
|
7
8
|
|
|
8
9
|
function describeThrown(error: unknown): string {
|
|
@@ -10,16 +11,30 @@ function describeThrown(error: unknown): string {
|
|
|
10
11
|
return String(error);
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
const initialState = createInitialState({
|
|
15
|
+
cols: typeof process.stdout.columns === "number" ? process.stdout.columns : 96,
|
|
16
|
+
rows: typeof process.stdout.rows === "number" ? process.stdout.rows : 32,
|
|
17
|
+
});
|
|
18
|
+
|
|
13
19
|
const app = createNodeApp({
|
|
14
|
-
initialState
|
|
15
|
-
|
|
16
|
-
rows: typeof process.stdout.rows === "number" ? process.stdout.rows : 32,
|
|
17
|
-
}),
|
|
20
|
+
initialState,
|
|
21
|
+
theme: themeSpec(initialState.themeName).theme,
|
|
18
22
|
config: { fpsCap: 30, executionMode: "inline" },
|
|
19
23
|
});
|
|
20
24
|
|
|
25
|
+
let activeThemeName = initialState.themeName;
|
|
26
|
+
|
|
21
27
|
function dispatch(action: AnimationLabAction): void {
|
|
22
|
-
|
|
28
|
+
if (action.type === "cycle-theme") {
|
|
29
|
+
activeThemeName = cycleThemeName(activeThemeName);
|
|
30
|
+
app.setTheme(themeSpec(activeThemeName).theme);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
app.update((previous) => {
|
|
34
|
+
const next = reduceAnimationLabState(previous, action);
|
|
35
|
+
activeThemeName = next.themeName;
|
|
36
|
+
return next;
|
|
37
|
+
});
|
|
23
38
|
}
|
|
24
39
|
|
|
25
40
|
let stopping = false;
|
|
@@ -97,6 +112,11 @@ function applyCommand(command: ReturnType<typeof resolveAnimationLabCommand>): v
|
|
|
97
112
|
return;
|
|
98
113
|
}
|
|
99
114
|
|
|
115
|
+
if (command === "cycle-theme") {
|
|
116
|
+
dispatch({ type: "cycle-theme" });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
100
120
|
if (command === "randomize") {
|
|
101
121
|
dispatch({ type: "nudge", payload: randomNudge() });
|
|
102
122
|
return;
|
|
@@ -145,6 +165,7 @@ app.keys({
|
|
|
145
165
|
b: () => applyCommand(resolveAnimationLabCommand("b")),
|
|
146
166
|
r: () => applyCommand(resolveAnimationLabCommand("r")),
|
|
147
167
|
m: () => applyCommand(resolveAnimationLabCommand("m")),
|
|
168
|
+
t: () => applyCommand(resolveAnimationLabCommand("t")),
|
|
148
169
|
});
|
|
149
170
|
|
|
150
171
|
app.onEvent((event) => {
|