Expand description
FRAME-36: keys — a component’s shortcuts, the host’s to handle.
A component declares them (rhx: keys(#{ "ctrl+k": "open", … }), the
tree’s keys; a module: bus.keys({ … })); the host keeps one registry
per page (Keys, on the crate::bus::Bus) and listens on the window
in the capture phase. A press that matches is the host’s alone: the
listener calls preventDefault(), stopPropagation() and
stopImmediatePropagation() before anything else hears it, then runs
what it names. A component’s entries go when it leaves the bus (destroy,
swap) — nothing outlives it.
- A chord is
[ctrl+][alt+][shift+][meta+]key,keythe event’sKeyboardEvent.keylower-cased (" "isspace); shift is said only with a letter or a named key — a character shift makes (?) carries it. A sequence is chords separated by a space, each withinSEQUENCE_MSof the one before. - An editable target (
input,textarea,select, contenteditable) is skipped unless the entry saysin_inputsor its chord holds ctrl or meta. FRAME-38: plainenterandspaceon an activatable target (a button, a link, asummary,[role=button]) are skipped unless the entry saysin_controls— the press still clicks. - Two entries on one press both run, the last registered (the deeper,
mounted later) first; an entry that says
onlyruns alone — the first such in that order. ?, when nothing binds it and anything is registered, toggles the overlay of every registered key, grouped by component;escapecloses it; an autorepeated?toggles nothing. FRAME-38: the overlay follows the registry — redrawn on every change while open, closed when it empties (Keys::on_change).
Pure: the DOM’s listener (tree::dom) turns a KeyboardEvent into a
Press and asks Keys::press; the native tests ask it directly.
Structs§
- KeyDecl
- One declaration: the sequence, what it runs (a fold’s name, or a module’s function’s), its label, and its two switches.
- Keys
- The page’s keys (a handle: clones are the same registry).
- Keys
Held - Entries held: dropping it takes them out.
- Press
- One key press, as the window heard it.
Enums§
- Heard
- What
Keys::pressdid with a press.
Constants§
- NAMED
- The named keys a chord may end in (the compiler’s list,
plexus_ui_compiler::keys::NAMED). - RESERVED
- EDITOR-13: the chords the browser keeps — no page ever hears them, so
binding one is refused:
ctrlormeta(withshiftor not, neveralt) andt,w,nortab. The compiler’s and the engine’s lists, byte for byte. - SEQUENCE_
MS - How long the next chord of a sequence may wait, in milliseconds.
Functions§
- chord
- One declared chord, canonical — the modifiers in the order ctrl, alt,
shift, meta; or why it is not one. FRAME-38: a chord is lower case — an
upper-case letter (
K: shift+k, or k?) is refused. The compiler’s twin, byte for byte. - event_
chord - The chord a
KeyboardEventis — itskeyand modifiers — or none for a modifier alone (or a dead key, or a composition’s). - hides
- FRAME-38:
ahidesb— a chord (or sequence) bound alone thatbbegins with, sobcould never be pressed. - reserved
- Why a chord (its modifiers held, its key) is the browser’s, or none.
- sequence
- A declared sequence: its chords, canonical.