返回 CodeWhale
WEBSITE.md
1 # Component website
2
3 The explorer lives inside the existing Codewhale website at `/ratatui`, with
4 individual `/ratatui/<gallery-name>` pages. Its source is in
5 [`Hmbown/CodeWhale/web`](https://github.com/Hmbown/CodeWhale/tree/wave/0.10.1-next/web).
6 Website deployment follows that repository's manual Cloudflare workflow.
7
8 Visitors can search all 199 catalogue entries by name or public API, choose a
9 collection, compare nine terminal profiles and four column widths, inspect
10 the exact Rust rendering source, download an SVG, and follow build and release
11 checks. The native motion player has pause, restart, speed and frame controls.
12 It starts paused and stops when the page is hidden.
13
14 The previews are actual Ratatui buffers with example data. The website does
15 not run the Engine or dispatch terminal input; use the interactive Cargo
16 examples for those host interactions. A source fixture can call private
17 gallery helpers. Each page links the complete source file, and the getting
18 started example uses the public `NativeComposer` API.
19
20 ## Update the catalogue
21
22 From this repository, export the current library once, then target the owning
23 website checkout. No new web framework or rendering implementation is needed.
24
25 ```sh
26 cargo run --locked --example website -- target/website-buffers
27 python3 -B tools/export-website.py target/website-buffers /path/to/CodeWhale/web/public/ratatui
28 python3 -B tools/export-website.py target/website-buffers /path/to/CodeWhale/web/public/ratatui --check
29 ```
30
31 The exporter reuses the README collections, source crosswalk and exact gallery
32 fixtures. Every component has native, 40, 80 and 120 column renders in every
33 profile. It records the rendering source revision and digest, validates the
34 geometry, and only replaces files owned by its previous manifest.
35
36 ## Update motion
37
38 The Gallery workflow already creates the source frame directories. For a
39 local update, run its existing habitat, motion and showcase frame exports,
40 then regenerate their GIFs when the recorded hashes have changed. The website
41 exporter checks those hashes before copying any frame.
42
43 ```sh
44 python3 -B tools/export-web-motion.py /path/to/CodeWhale/web/public/ratatui/motion
45 python3 -B tools/export-web-motion.py /path/to/CodeWhale/web/public/ratatui/motion --check
46 python3 -B -m unittest discover -s tests -p '*website*test.py'
47 python3 -B -m unittest discover -s tests -p 'web_motion_test.py'
48 ```
49
50 The six motion bundles contain 762 native frames. Each stays below Cloudflare's
51 25 MB asset limit. The website loads only the selected component or motion
52 bundle; serve JSON with HTTP compression. Its tests verify profile and width
53 coverage, source links, search, asset boundaries and motion timing. English
54 and Chinese website copy use the site's existing locale system.
55
55 lines MARKDOWN