Primitives / foldkit-primitives
foldkit-primitives
Ready-made pieces of browser, clock, device, and interaction state for a Foldkit application: a media query, a timer, a socket, an undo stack, a roving tab stop, a resize observer, a clipboard write. Each comes in the shape Foldkit already has, so adding one adds no store, no hook, and no second reducer. The fact lives in your Model, arrives as a Message, and replays like everything else.
import { MediaQuery } from 'foldkit-primitives/media'The browser reports; the Model owns. A primitive observes something and hands your
updatea Message. What your application keeps, and what it does about it, stays yours.
Running in this page
This site places two primitives in its own Model. What each holds is drawn from that Model, as it changes.
PrefersDark · your system asks for a light color scheme.
model.dark = { matches: false }Timer · 0 ticks.
model.ticks = { count: 0, running: false }