jevsnes.git / packages / panels / CLAUDE.md
1@README.md
2
3- No window, socket or clock in here: it compiles for wasm. What is specific
4  to one host (the MCP panel, since only the native app has a server) lives in
5  that app.
6- `Confidence` cannot hold a value outside 0..=1; build one with
7  `Confidence::new` and handle the `None`.
8- The pad is laid out in its own coordinates and scaled to the width it is
9  given. Move a button by changing its `Part`, not the painter calls.
10- **Every panel here must survive its value being absent or empty.** The bot
11  has no tasks at a menu and no goals before it has seen a screen; say so in
12  the panel rather than drawing an empty one.
13- **`layout.rs` has the layout invariant as a test** — equal side panels, an
14  exact 4:3 picture cell, and (since the replay scrubber landed) a `scrubber`
15  rect spanning the picture's own width, directly between it and the pad. A
16  panel that wants more room asks the app for a different cell; it never
17  widens itself. Run `buck2 test //packages/panels:test` after anything that
18  touches sizing.
19- **`replay.rs` takes plain data too**, the same shape as `bot.rs`/`jev.rs`:
20  `packages/replay` is native-only (it writes files) and this crate compiles
21  for wasm, so nothing from that crate - `Tree`, `BranchMeta`, `FrameEntry` -
22  may appear in this file's public API. The app converts.
23- **Colours live in `palette.rs` and nowhere else.** A colour literal in a
24  panel file is a meaning nobody can look up.
25- **`bot.rs` takes plain data, never `zbanks` types.** `zbanks` links C and is
26  native-only; this crate compiles for wasm.
27- **`jev.rs` takes plain data too, with one deliberate exception:** the
28  request sent to Jev stays a `serde_json::Value` rather than being
29  pre-formatted to a `String`, so pretty-printing it happens only inside a
30  history row's `CollapsingHeader` body - which egui calls only while that
31  row is open - instead of on every row on every frame. `serde_json` has no
32  I/O and already compiles for wasm, so this is not the same kind of
33  exception `zbanks`/`decisions` types would be.
34- **Keep `-Csave-temps=true`/`-Clink-dead-code` in `BUCK`.** They are what
35  let `tools/hotpatch/patch.sh` fold a panels edit into a hot patch; without
36  them it skips this crate and the patch silently keeps the old panels code.