@nighthq/model
v0.1.1
Published
The framework-neutral view kernel: one semantic model both a desktop and a compact presentation bind to.
Readme
@nighthq/model
The framework-neutral view kernel: one semantic model both a desktop and a compact presentation bind to.
This package imports nothing — not Svelte, not the DOM, not a dependency. That is the invariant everything else here leans on: a screen's behaviour can be tested with no browser in the room, and driven from a host that is not Svelte.
What it holds:
defineModel— a model with declared state, guarded actions (ok/noverdicts), and capabilities a presentation may refine without diverging silently.Protocols —
createSelection,createOverlay,createCollection(fields, sorting, paging, obligations), andcreateNavigation:import { createNavigation } from '@nighthq/model'; const navigation = createNavigation({ routes });Effects — a model never performs a side effect; it declares one (
navigate,title.set,announce,focus) and@nighthq/hostperforms it.performandexhaustivekeep the union closed.Outcomes —
pending,accepted,refused,cancelled, and theTERMINALset, so a flow's end states are values rather than conventions.
MIT © Bitspark
