feat(toc): add constellation variant#21
Open
stanley-910 wants to merge 2 commits intotoc-variantsfrom
Open
Conversation
Adds a fourth TableOfContents variant that renders headings as a star map: dots laid out deterministically per-post (seeded PRNG), connected by faint amber edges in reading order. Active node glows; active edge brightens. - lib/toc-starmap.ts: seeded mulberry32 + repulsion layout so each post gets stable positions across reloads. - toc.css: scoped .toc-variant-constellation block (dot, label, edge, active states); extends shared positioning with the other variants. - toc.tsx: ConstellationToc sub-component. Auto-falls back to staffline when headings.length > 12 or prefers-reduced-motion. No post opts in yet — ship behind explicit variant="constellation".
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Opts the RNN post into variant="constellation" for a visible demo of the new star-map TOC. Nine headings is at the upper edge of what the narrow sidebar handles cleanly — labels can overlap when a pair of stars lands close in a horizontal row. If that becomes a problem we can either widen the sidebar, shorten headings, or drop back to the vim variant.
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.
Stacked on #20 — merge that first.
Summary
TableOfContentsvariant that renders section headings as a star map: dots laid out deterministically per-post (seeded PRNG, mulberry32 + repulsion), connected by faint amber edges in reading order. Active node glows amber; the active → next edge brightens from 0.2 → 0.5 opacity.lib/toc-starmap.tshelper owns the layout (hashStr + mulberry32 + rejection sampling). Seed is the post pathname, so positions are stable across reloads.headings.length > 12(constellation breaks visually past ~10 nodes) or when the user hasprefers-reduced-motion: reduce.variant="constellation"yet, and the tag → variant map is unchanged. Enable per-post later.Test plan
variant="constellation"on the Whitten post (4 headings), renders 4 nodes + 3 edges; labels in Instrument Serif, dots muted until active.variant="constellation"), falls back to staffline list.