Demo chrome
The frame for an interactive figure or a small research tool: header, controls, a black stage, and a status line.
Experimental May change in any minor version before 1.0.
In this chapter 15 pages
App shell
Probability machine
One more bin than rows.
A complete version with this exact shell is the demo page pattern.
<AppShell title="Probability machine">
<Fragment slot="head"><Button size="sm" variant="secondary">Run again</Button></Fragment>
<Fragment slot="controls">
<Slider label="Rows of pegs" name="rows" min={2} max={14} value={8} />
</Fragment>
<Machine rows={8} /> <!-- the stage -->
<Fragment slot="status"><Status state="idle">Ready</Status></Fragment>
</AppShell>The shell's title is an h2. Under a section heading of its own, pass level=3, as this page does.
Readout
- Balls
- 40
- Mean bin
- 4.03
- Expected
- 4.00
<Readout items={[{ label: "Mean bin", value: "4.03" }]} />Empty state
No runs yet
Pick a dataset and press Train. Results appear here, newest first.
An empty state says what is missing and gives the one action that fills it. Its mark is a complex with no edges yet: a few loose points. When the empty state is the page's content, as on a 404, give its title a heading level with level={1}, so the page has a heading.
Working model
Model is the frame every working model on a paper page shares: a flush black panel holding one inline SVG, the controls and readout under the panel on the page ground, and an exhibit caption that says what the model is. A model illustrates a paper's mechanism, and its caption says so. The drawing's classes (.ply-m-chalk, .ply-m-move, and the rest) set chalk lines and points on the panel, mustard at half strength for filled regions, and tomato for the one moving part.
<Model name="gate" title="A gate that opens at a threshold" firstRun>
<svg viewBox="0 0 100 56">...</svg>
<div slot="controls" class="ply-model__axis" style="--x0: 0.1; --x1: 0.9">
<Slider label="Position" name="gate-x" value={80} />
</div>
<Fragment slot="caption">What the model shows, and that it illustrates the mechanism.</Fragment>
</Model>name is for the model's own script, and draft marks a figure not yet checked with a wall label. A slider that moves a mark along the drawing's horizontal axis wears .ply-model__axis with --x0 and --x1, the fractions of the panel's width where the axis starts and ends, so its thumb sits under the mark at every value and width.
firstRun holds the figure back as a blank panel until the model's script draws its start state, then runs the model once, the first time it is half in view. Reduced motion skips the wait, a script that stalls shows the finished drawing after 2.5 seconds, and any input on a control ends the run. js/firstrun.js exports firstRun(figure, { duration, start, frame, end }), which returns a player with replay(), and the curves arrive, easeOut, and bezier.
import { firstRun, easeOut } from "@dario-loi/polytope/js/firstrun.js";
const player = firstRun(figure, {
duration: 2,
start() { setPosition(0); },
frame(p) { setPosition(80 * easeOut(p)); },
end(cancelled) { setPosition(80); },
});Page not found
Lost sets the ways onward from an address that is not here: each a name in wood type with an arrow and a line saying what is there, hairlines between, the name turning tomato on hover. The exhibit goes beside them from 64rem and first when stacked. A complex whose radius is too small to join its points is the exhibit this was drawn for. Put it under a mast with the headline and one plain sentence, and mark the page noindex in Seo.
<Mast title="Page not found" lede="This page does not exist, though these ones do." compact rule />
<Lost ways={[{ href: "/papers/", label: "Papers", note: "Every paper, with code and BibTeX." }]}>
<ComplexStatic slot="exhibit" seed={404} radius={0.12} label="A complex of unconnected points" />
</Lost>