Skip to content

Interface: ModeEngineSpec<Ctx>

Defined in: modal/engine.ts:197

Type Parameters

Ctx

Ctx

Properties

available?

optional available?: Readonly<Record<string, (state, ctx) => boolean>>

Defined in: modal/engine.ts:224

Availability overrides. Most commands need none — availability is DERIVED by dry-running the pure reducer ("would it change anything here?"). Verbs (pure effects that move no region) derive to "never", so they declare their gate here; a command whose availability differs from its reduction (an arm gate on a context fact) can override too. Keys must name declared commands.

This is a GATE, not a hint: an unavailable command is refused by ModeEngine.dispatch itself, not merely greyed out in the bar. The difference is the whole point — a bar button, a key, an agent's control() write and a recovered turn all arrive as the same dispatch, and a rule that only the bar enforces is a rule that holds until the first other caller.


commands

commands: Readonly<Record<string, CommandFn<Ctx>>>

Defined in: modal/engine.ts:199


escOrder?

optional escOrder?: readonly string[]

Defined in: modal/engine.ts:207

Region names ranked for Esc: per press, the highest-ranked region not at its base steps out ONE level (toggle → off, choice → initial, ladder → one rung down, stopping at its escFloor). Esc is never destructive beyond that one scope; a press with everything at base is a no-op the host may pass to the page.


excludes?

optional excludes?: readonly ExcludeRule[]

Defined in: modal/engine.ts:208


on?

optional on?: Readonly<Record<string, EventBinding>>

Defined in: modal/engine.ts:210

System events → commands (engine turnClosed, socket drop, tab close).


regions

regions: Readonly<Record<string, RegionSpec>>

Defined in: modal/engine.ts:198