Phase 5f: the figure compute/render split — four figures print for real - #17
Merged
Conversation
…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>
Deploying gradient-lab with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 aforeignObject, 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 renderforeignObject).scripts/emit-figures.tswrites each as SVG → PDF viarsvg-convert, and the emitter swaps its placeholder for\includegraphicswherever 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-contouronly 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-checkclean. Book compiles locally (npm run book); CI now installslibrsvgand watchessrc/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