Primitives / State
foldkit-primitives/state
Application state with nowhere else to live: the current page, the undo stack, the locale, a selection, a virtualized list's window. These bundles own the frame, not the contents; loading the rows stays the application's job. (source)
| Name | Form | Model | Messages | Args |
|---|---|---|---|---|
Pagination | bundle | { page, perPage, total } | GoToPage, NextPage, PrevPage, SetPerPage, SetTotal | { perPage, total? } |
history({ name, value, capacity? }) | bundle factory | { past, present, future, group } | Push { value, group? }, Undo, Redo, GoTo { step }, Clear | { initial } |
History.* | functions | the same steps, pure | ||
Locale | bundle | { locale } | SetLocale | { default } |
SelectionSet | bundle | { selected } | Select, Deselect, Toggle, ReplaceAll, Clear | none |
Virtual | bundle | scroll, heights, layout | Scrolled, Measured, Prune, Settled | layout args |
Viewport, MeasureRow({ key }) | Mounts | ViewportScrolled, RowMeasured | ||
range(start, end, step?) | function | |||
windowFor, isAtEnd, distanceToEnd, offsetFor, stickyHeader, masonry | functions |
Persisted state lives one package over: Mirror.kv keeps a slice in Effect's
KeyValueStore across reloads. Nothing here duplicates it.