Interactive & furniture
A live canvas demo and the contract behind it, then the quiet components every note is framed by — the ones you have been looking at since the first page.
§3.1DemoMount — live
The division of labor is the package's usual one: the mount markup (stage, controls slot, caption slot) ships in the package; the demo module and its loader belong to the site. This site keeps its loader in src/lib/demo-loader.ts and calls mountAllDemos() once from the layout; the call runs on every page, but a demo module chunk is fetched only for a page that carries a [data-demo] mount.
A demo that takes pointer input on its canvas passes interactive — the stage then claims touch gestures and shows a crosshair. This one is passive (render-only), so it leaves the flag off and a swipe over the canvas still scrolls the page. It draws two-source wave interference with the page's own ink token, so it follows the theme:
Two point sources emit circular waves; where crests meet crests the ink pools, where crests meet troughs the paper shows through. Toggle the theme — the demo re-inks itself from the live tokens.
The module contract is one default export, mount(ctx), returning a cleanup function; the loader resolves module ids like waves/interference however the site pleases (import.meta.glob here).
A demo can also live beside the page that shows it, with no loader of the site's own: name its module by its path from the site root with module, and the engine loads it (lib/page-demos.ts finds every .ts under src/content/). The module is handed the mount's root, stage, canvases, controls and the page's locale, and reads its words from a JSON beside it with inLocale (lib/figure-file.ts), so the Chinese page shows the same module and the same file in Chinese:
§3.2Page furniture
The remaining components frame a note rather than fill it:
Heroopens a note: kicker, display title, a lede that goes through the full Markdown pipeline, a meta line, and optionaltocLabelthat adds an unnumbered "intro" row to the sidebar. The note's frontmattertitlestays the short canonical one for<title>and cards; the hero's may be long.PartHeroopens a chapter of a hub — this page's own head. Its kicker is never typed: the route passes the chapter's "Part III · …" label in asprops.partLabel.Partdivides a long single-page note into parts; the numbering preset turns it into the "PART II · Foundations" group rows of the sidebar. The kitchen-sink is cut that way.HubCardand.hub-gridare a hub's landing cards;.pathis its reading-path box — both on the overview of this gallery.LocalTocrenders an in-page jump list; it accepts both ToC shapes the two numbering presets produce, and hides itself under a configurable minimum. Below, live, on this chapter's own ToC.SidebarMemorykeeps a scrolling sidebar where the reader left it across page loads, and centres the current item ([aria-current="page"]by default) whenever it would otherwise be out of view. Drop it inside the sidebar's scroll box, after the navigation markup; it runs before first paint, so the sidebar never flashes at the top. The demo's own sidebar carries it.LineageSvgframes an SVG that carries no words — a lineage tree, a taxonomy — as a card; a diagram with words in it is aFlowDiagram, below.PageFooteris the small print at a note's foot — the line under every note here.- The browse pieces live in the wiki chapter; the Markdown side of the gallery is the kitchen-sink.
§3.3LocalToc and FlowDiagram, live
LocalToc fed this page's own build-time ToC — the same data the sidebar consumes, handed to the note as props.toc:
The same figure as a FlowDiagram — the boxes are HTML that size to their words, the arrows are measured after layout, so nothing can leave its box in any font:
§3.4FlowDiagram — boxes that size to their words
A diagram that carries words is a FlowDiagram (or a mermaid fence). A hand-positioned <svg> with <text> is drawn against one font and breaks in the next wider one — and every site renders with its own; LineageSvg stays for SVG that carries no text a font could widen out of shape. The spec is data: cols, nodes (col / row / span, a tone, lines, a tag, ghost for a dashed note, mono for paths), edges (label, dashed, off for a broken link), optional lanes and heads:
Lanes label the rows and draw the separators; a tone colors a box's border and tag; a wire goes around every box it does not join and every heading; a wire's label is always drawn: a wire between neighbouring boxes of one row widens their gap for it, a label wraps or shrinks to the room it finds, and a label with no room clear of the boxes and the other wires becomes a numbered key on its wire, or beside it on a short lead, its words listed under the diagram.
A heads entry titles the rows under it, so a diagram drawn as groups is a heading row followed by the group's boxes; wires go around a heading's words as they go around a box. A wire with no way between the boxes runs down the diagram's gutter — the strip on either side of the boxes, inside the frame's padding — and the wire layer covers the gutter, so the wire and its key stay inside the figure:
Each box is at least ten letters wide, and each column as wide as the longest word in its boxes, so no word is split; a snake_case name may break after an underscore. On a column too narrow for all of them, a phone's for one, the diagram scrolls sideways inside its frame while the title and the caption stand still; the diagram keeps the structure it was written with.
When several labelled wires leave one box, some labels find no room clear of the boxes and become keys. A key is placed as a label is: never on a box, a heading, a label or another key. It sits on its wire where the wire has a clear spot, and otherwise beside the wire, joined to it by a short lead:
§3.5Deck — slides made of a note
Deck turns the content it wraps into slides: a thematic break (--- on a line of its own, a blank line before it) ends a slide, and a slide with only a heading and at most one paragraph is a divider whose name every slide of its part prints in its corner. The content stays the note's own blocks, so a site that wraps a whole note's <Content /> in a Deck keeps in-place editing, wikilinks and every component inside the slides. The reader sees a stack of 16:9 slides; Present shows one at a time over the whole screen from the slide in view (→ ← Space PageUp PageDown Home End, Esc leaves, a swipe on touch screens), and the slide number is the location hash, so #/3 links to the third slide. Every slide is laid out on a 960 × 540 canvas and scaled to the width it is shown at, so it looks the same in the column, on a projector and in print (one slide per 10 × 5.625 in page); on a phone a slide is laid out unscaled at the column's width.
A figure that more than one place shows is kept in its own JSON file beside the page that answers it, and drawn by FigureFile: the file holds title, an optional caption and flow (a FlowDiagram spec), every word an object of the languages ({ "en": …, "zh": … }). Every place imports the file by its path from the site root (import deckPipeline from '/src/content/notes/components/interactive/deck-pipeline.json'), so no site needs an alias, and changing the file changes every place. A word with no text in the page's language shows in the language the figure was written in, the first key of its title. The same file, once here and once on the third slide below:
§3.9Furniture without a component
A few pieces are plain classes in base.css, for sites that render them from their own layout or write them as HTML in prose:
| Class | What it is |
|---|---|
.page-head + .kicker, .page-desc, .page-date | a frontmatter-driven page head (kicker, h1, description, date) rendered by a layout instead of a <Hero> |
.banner, .banner-fallback | a one-line notice under the head; the fallback variant is the muted one |
.page-foot | a two-column small-print footer (left slot, right slot) |
.speak | the plain-language gloss under a deep-dive heading; its label is --speak-label |
.path + .title, .route, .arrow | a reading-path box on a hub |
.ref-tag | a small monospace tag in a reference list (a venue, a year) |
.tag, .tag.teal / .mustard / .violet | the paper-card badges, usable anywhere |
.measured + .measured-head, .measured-body, .measured-pane (.doc), .measured-tag | the documented-versus-measured comparison card: a solid teal title bar over two panes, the .doc pane carrying the claim and the other the measurement — a silhouette distinct from every callout |
.paper .idea-label | the small uppercase key-idea label inside a PaperCard body, e.g. <span class="idea-label">Key idea</span> |