Expand description
Surface-neutral command palette, focus model, accessibility metadata, and diagnostics presentation (VIEW4.06).
These are the interaction semantics SHARED by every view surface – the TUI
(the sim-view-tty consumer) and the Web UI alike. The module is
deliberately surface-neutral: it emits ordinary
Scene values and Intent values and
reads them back, but it never spells ANSI, DOM, or ARIA. A terminal renderer
turns a focus annotation into a highlight; a browser turns the same
annotation into a :focus ring and the A11y record into ARIA
attributes. The core Scene carries only open metadata, so neither surface’s
vocabulary leaks into the shared model.
Four facilities live here:
- a
with_focus/focused_id/move_focusfocus model stored as afocusmetadata field, not a new scene kind; - a
Commandpalette:palette_scenerenders a filtered, deterministic overlay andpalette_intentreduces a chosen command to a validatedIntent; - an
A11yaccessibility record attached as an opena11ymap viawith_a11yand read back witha11y_of; diagnostics_scene, which presents a rejectedDraft’s diagnostics as a deterministic overlay.
§Example
use sim_kernel::Symbol;
use sim_lib_view::palette::{Command, CommandKind, palette_intent, palette_scene};
let cmd = Command {
id: Symbol::new("run"),
label: "Run validation".to_owned(),
kind: CommandKind::Invoke,
};
// The overlay lists the command and validates as a Scene.
let scene = palette_scene(std::slice::from_ref(&cmd), "run");
assert!(sim_lib_scene::validate_scene(&scene).is_ok());
// The chosen command reduces to a validated Intent.
let intent = palette_intent(&cmd, "main", 7).unwrap();
assert!(sim_lib_intent::validate_intent(&intent).is_ok());Structs§
- A11y
- An accessibility record carried as open metadata on a scene node.
- Command
- One palette command: a stable id, a human label, and the kind of Intent it reduces to.
Enums§
- Command
Kind - How a
Commandreduces to anIntentwhen chosen. - Focus
Dir - A direction to advance focus in
move_focus.
Constants§
- A11Y_
KEY - The map key under which
with_a11ystores the accessibility record. - FOCUS_
KEY - The map key under which the focus model stores the focused node id.
Functions§
- a11y_of
- Reads the accessibility record attached by
with_a11y, if present and well-formed. - diagnostics_
scene - Presents a
Draft’s diagnostics as a deterministicscene/overlay. - filter_
commands - Selects the commands whose label contains
filter, case-insensitively, preserving input order. - focused_
id - Reads the focused node id annotated by
with_focus, if any. - move_
focus - Advances focus deterministically through
ids_in_order, wrapping at the ends, and returns the re-annotated scene. - palette_
intent - Reduces a chosen
Commandto its matching validated Intent forpaneattick. - palette_
scene - Builds a
scene/overlaylisting the commands matchingfilter. - with_
a11y - Attaches an
a11ymetadata map (role/label/description/urgency) tonode. - with_
focus - Annotates
scenewithfocused_idas openfocusmetadata.