Skip to content

Phase 5f: the figure compute/render split — four figures print for real - #17

Merged
NeoVand merged 1 commit into
mainfrom
phase5f-figure-split
Jul 8, 2026
Merged

Phase 5f: the figure compute/render split — four figures print for real#17
NeoVand merged 1 commit into
mainfrom
phase5f-figure-split

Conversation

@NeoVand

@NeoVand NeoVand commented Jul 2, 2026

Copy link
Copy Markdown
Owner

What this does

src/figures/ begins the compute/render split from the plan doc: each figure is pure compute + one SVG-string render with two targets:

  • 'app' — colours stay CSS variables (the theme cascade keeps doing the theming) and math labels render through KaTeX in a foreignObject, exactly the markup the hand-written figures used. The chapter shell now renders these strings via {@html}.
  • 'print' — the day palette concretized (standalone SVGs can't resolve vars) with plain SVG text labels (rasterizers don't render foreignObject). scripts/emit-figures.ts writes each as SVG → PDF via rsvg-convert, and the emitter swaps its placeholder for \includegraphics wherever a split figure exists.

Migrated: derivative-secant, curvature-bend, curvature-regimes, downhill-proof. The book now carries four honest simulations — Figure 4.1 is the actual secant sweep, chords tilting into the tangent, computed by the same code the app runs.

Verified — a new ritual for figures

Text parity can't see SVG, so this PR adds a geometry byte-compare: every path/line/circle/label of all four figures extracted from the DOM and compared against main. It caught two transcription slips before commit (the bend figure's " large"/" small" label words; a whitespace text node between the regime label spans) — and one latent bug: the proof figure's panel divider never rendered on main (.fig-contour only styles children of .fig, and this figure's wrapper is .proof-fig), so the faint divider the markup always intended now actually draws.

App: 199 tests, svelte-check clean. Book compiles locally (npm run book); CI now installs librsvg and watches src/figures/.

Next

The same pattern sweeps the remaining static figures (landscape two-views, shapes with its canvas heatmap — that one adds the injectable-canvas piece, noise ball, γ triptych, generalization curves, family tree), then the interactive islands get print fallbacks, then typography.

🤖 Generated with Claude Code

…r real

src/figures/ begins: each figure is pure compute + one SVG-string render
with two targets. 'app' keeps CSS variables and KaTeX foreignObject
labels (the exact markup the hand-written figures used); 'print' is the
day palette concretized with plain SVG text labels (rasterizers have no
foreignObject). The app's chapter shell renders the same strings via
{@html}; scripts/emit-figures.ts writes them as SVG and converts to PDF
via rsvg-convert, and the emitter swaps its placeholder for
\includegraphics wherever a split figure exists.

Migrated: derivative-secant, curvature-bend, curvature-regimes,
downhill-proof — the book now carries four honest simulations.

Verified by a new geometry ritual: every path/line/circle/label of all
four figures byte-compared against main in the DOM. It caught two
transcription slips before commit (the bend figure's ' large'/' small'
label words, and a whitespace text node between the regime label spans)
— and one latent bug worth knowing: the proof figure's panel divider
NEVER rendered on main (.fig-contour only styles children of .fig, and
this figure's wrapper is .proof-fig); the baked styles now draw the
faint divider the markup always intended.

CI installs librsvg and watches src/figures/. App: 199 tests,
svelte-check clean, build green; book compiles at 295KB.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploying gradient-lab with  Cloudflare Pages  Cloudflare Pages

Latest commit: 088bfea
Status: ✅  Deploy successful!
Preview URL: https://ecf569d2.gradient-lab.pages.dev
Branch Preview URL: https://phase5f-figure-split.gradient-lab.pages.dev

View logs

@NeoVand
NeoVand merged commit 7d2cfca into main Jul 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant