Substrate
Browser events → typed intents.
The substrate is the input-side layer that turns browser events (beforeinput, keydown, mousedown, pointermove, composition, paste, drop) into typed intents. It is the only place in @spine-editor/dom that owns browser event listeners.
Entry point
The substrate is internal to createSpineDomRuntime(...). Supporting modules live in packages/dom/src/substrate/, including input, mouse, selectionchange, and navigation/clipboard/lifecycle subtrees.
Responsibilities
- Translate input — map each event to an
Intentand dispatch it through the engine. - Cancel native behavior —
preventDefault()on events the engine handles. - Own composition state — suspend keyboard intents during IME composition (see IME).
- Forward pointer events — mouse/touch → selection updates via the selection mapping layer.
- Attach input evidence — for supported shortcuts, the substrate may read committed semantic state to say "this was Space after
#"; the planner still decides whether that becomes a heading.
Non-responsibilities
The substrate does not:
- Mutate the document directly.
- Decide final semantic meaning (planner rules handle that).
- Write the DOM beyond reading event targets.