Primitives / API
foldkit-primitives/state
Namespaces
Box | Boxes that move and resize, as pure functions over the box's numbers: the constraints (an area to stay in, a smallest and largest size, an aspect ratio, a… |
History | The steps of a history as pure functions of its Model. |
Functions
canRedo | Whether Redo would move: the future is non-empty. |
canUndo | Whether Undo would move: the past is non-empty. |
distanceToEnd | Pixels from the viewport's bottom edge to the content's end: negative past it, zero exactly there. Prefetch thresholds want this number ("load when within… |
history | Undo/redo as a bundle factory: the past, present, and future of one value live in the Model, so every step replays. A value that names its own step ({… |
HistoryModel | |
isAtEnd | Whether the viewport rests at (or past) the end, within threshold pixels: the infinite-scroll check. An empty list counts as ended — there is nothing to… |
isSelected | Whether the id is currently selected. |
masonry | Masonry layout as a pure function: fixed column count and width, each item packed into the currently shortest column. Unmeasured items use the estimate;… |
offset | The offset of the first item on the page, for a slice or a query. |
offsetFor | Pixel offset of a row's top edge: padding plus the prefix before it. |
pageCount | The number of pages, or null while the total is unknown. |
range | A numeric range as an array: range(1, 4) is [1, 2, 3], inclusive of the start and exclusive of the end, like Array.from length math. The pagination… |
stickyHeader | Which section header sticks for a window: the last section starting at or before the first rendered row, or null above the first section. Order independent… |
totalHeight | Total scrollable height: padding, measured rows, estimates, and gaps. |
visibleRange | Which rows to render for a scroll position: the rows intersecting [scrollTop, scrollTop + viewportHeight), widened by overscan on both sides and clamped to… |
windowFor | The rows to render plus the spacer height, from the Model, the key order, and the viewport height. Layout and overscan come from the Model, so the call… |
Values
Locale | Locale as a bundle: the current locale string in the Model. Starts from navigator.language where available, falling back to the configured default; changes… |
LocaleMessage | |
LocaleModel | |
MeasureRow | One row's height, its border box, reported on every resize starting with the current one. The key is the application's row identity, echoed back so the… |
MeasureRows | The heights of an element's rows, border boxes, from one observer on the list rather than a Mount per row: each child carrying attribute is a row, its value… |
Pagination | Pagination as a bundle: the page, page size, and total live in the Model, so page changes replay and every transition clamps into range. Pure logic, no… |
PaginationMessage | |
PaginationModel | |
RowMeasured | |
RowsMeasured | |
SelectionSet | A selection set as a bundle: the selected ids in the Model, changed one at a time or replaced whole. Order follows first selection; toggling moves a… |
SelectionSetMessage | |
SelectionSetModel | |
Viewport | The scroll container's position, reported on its own scrolls starting with the current one. Attach to the scrolling element; a list that scrolls with the… |
ViewportPlaced | |
ViewportScrolled | |
Virtual | Windowing math for virtualized lists as pure functions: which rows to render, how tall the scrollable area is, and where each row starts. Row heights come… |
VirtualMessage | |
VirtualModel | |
WindowViewport | Where the window's viewport lies over a list that scrolls with the document: top is how far the viewport's top edge is past the element's (negative while… |
Interfaces
MasonryPlacement | Where masonry puts one item: its column and its box, in pixels. |
PushOptions | How push records a value. |
VirtualLayout | Layout constants: per-row estimate, inter-row gap, and end padding. |
VirtualWindow | The rows to draw: a half-open range of indexes. |