Skip to main content

Module palette

Module palette 

Source
Expand description

The command palette’s rows: what a typed query reaches, how it is scored, and what order the answers come back in.

The palette is a text field over four sources — the frame’s CommandSet, every block in the document (find), the blocks on the current level (expand), the log (rev) — plus two verbs whose argument is typed rather than picked (go <path>, camera <x> <y> <w> <h>). Matching and ranking come from nucleo-matcher, the Helix editor’s scorer.

Results are typed and grouped by their Source: what a row is decides which run it joins, so a block named like a command cannot be mistaken for one. Numeric queries (“everything wider than 8 cells”) are an open question and are not answered here.

None of this is a drawing, and a front end that scored its own rows would answer one query two ways.

Structs§

Offer
One command as the palette reads it: what a row would invoke, and the words it is matched and listed by.
Row
One answer to a query.
Sources
What the palette searches besides the command set: the navigator’s tree (every block, for find; this level’s blocks, for expand; the names a go <path> resolves through) and the log (every commit, for rev).

Enums§

RowId
What a row dispatches when picked: a registry command, navigation to a block found by name, descending into a block on the current level, jumping to a typed content path, framing a typed rect, or putting a past rev on the canvas.
Source
Where a result came from. Read off the row’s own id rather than carried beside it, so a row cannot be filed under a source it does not belong to.

Constants§

CAMERA_MAX_CELLS 🔒
CAMERA_MIN_CELLS 🔒
Bounds on a typed camera’s size, in grid cells. A zero or negative extent has no framing at all, and a huge one zooms so far out the diagram vanishes — both are typos, not intentions.
CAMERA_VERB 🔒
The verb that turns the rest of a query into a camera rect.
GO_VERB 🔒
The verb that turns the rest of a query into a content path.
MAX_MATCHES
Ranked rows shown for a non-empty query; the tail is cut, an empty query lists every available command instead.

Functions§

parse_camera 🔒
Parse camera <x> <y> <w> <h> (grid cells) into the world rect it frames. None unless all four numbers are present and the size is within CAMERA_MIN_CELLS..=CAMERA_MAX_CELLS, so a half-typed or nonsense camera simply offers no row to pick.
rev_row
How a commit reads in the palette: the number a reader types and the label the history panel gives the same rev, so one commit is not named two ways across two surfaces.
rows
The rows a query yields: every available command on an empty query (registry order), otherwise commands, expand <block> entries for the current level, find <block> entries for the whole document and rev entries for the log, scored against label + name and ranked best-first (ties keep registry order).