Skip to main content

Module chrome

Module chrome 

Source
Expand description

The chrome model: what a front end shows around the canvas, as values the session builds and a View carries.

Every type here is owned and toolkit-free. The bar’s words, the status line’s fields, the history’s rows, the navigator’s tree, the selection bar’s swatch and the notices are all facts about the session, so they are read off it in one place each; what a widget adds — which panel is open, where the pointer is over the chrome, a rename box’s draft — stays with the widget.

Structs§

Acknowledged
The failure the user acknowledged, by its position among the failures.
Ground
The colours under the diagram.
Lens
What the lens is showing, and what the bar says about it.
NavNode
One block as the tree lists it, with the blocks it holds beneath it in the document’s one draw order.
NavTree
The navigator’s tree: every block the document holds under its top, nested as the document nests them, beside where the canvas is standing and what is selected on it.
Notices
What this session has owned up to and the user has not yet acknowledged: an error nobody can dismiss makes the editor unusable (docs/ui-issues.md). Dropped with the document it was about.
Overlay
The selection bar’s contents: the selection it stands over, and the readings of the document its controls and pickers show — the accent swatch’s colour, the accent index behind it, and the direction the I/O toggle reports.
Reading
Everything the status line could say, before its priority picks one.
ScopePath
Where the canvas is standing: the levels that reach it, outermost first, and the path that names them.
Selection
The selection the bar is drawn for: where it sits on screen, and how many things it holds.
TitleBlock
The status line’s second line: “the text in the lower left corner (let’s consider that the title block) should also indicate on a second line, the author, current rev, and date/time of that rev.”
TopBar
Everything the top bar says: the breadcrumb’s root and its levels, the undo and redo buttons’ entries, the lens, and the liveness dot.

Enums§

Crumb
One thing a breadcrumb draws.
Hung
Where a tree hangs from: the document’s own root, or its designated top.
Liveness
What the document’s own state is, as the dot beside its name reports it.
Locked
Why a document may not be written.
Notice
What the session has to tell the user about its document: why the canvas is read-only, what will be overwritten by the next save, and the load that did not work.

Constants§

MAX_SEGMENTS 🔒
Past this many levels the breadcrumb collapses from the middle.
SELECTION_SEPARATOR 🔒
What separates the levels of a selection path in the status line — the mockup’s own join(" / ").
TAIL_SEGMENTS 🔒
How many levels above the current one survive the collapse.

Functions§

accent_display_role
The Role the accent swatch displays for target given its current accent index current: the mapped accent role, or — when unset — the target’s own un-accented stroke.
block_label
A block’s display label: its name, then its type, joined as name/type, skipping an empty type. The name falls back to the block’s id (b3) when unnamed, so the label is never empty — and so a block that has left the document still names a row.
current_accent 🔒
The accent index target carries now, or None when it has none.
shared_dir 🔒
The one direction every pin in pins is facing, or None where they disagree or the selection has gone.