Primitives / API

foldkit-primitives/interaction

Interaction primitives: a Bundle (or a Mount) for the state, a matching foldkit-mixins Behavior to wire it to a view's slots. Importing this subpath needs foldkit-mixins; the others do not.

Namespaces

DismissLayerDismissable layers: Escape closes the topmost open layer, a pointer press outside closes the layers it is outside of. One Bundle, placed once, owns the…
EditableTextEditableText as a Behavior: attaches the foldkit-primitives/dom Mount to a container slot and maps what it reports into the view's Messages. No Bundle: the…
FocusScopeFocusScope as a Behavior: attaches the foldkit-primitives/dom Mount to a container slot. No Bundle, because which element has focus is a DOM fact.
FocusVisibleFocusVisible as a Behavior over a placed InputModality: the target gets data-focus-visible while the page is being driven by keyboard, so a stylesheet can…
GridNavigationTwo-dimensional arrow keys over a set of items laid out in rows of columns (a calendar grid, a color swatch picker, an emoji palette). The Model slice is…
LayersScrollLock and HideOutside as Behaviors: each attaches its foldkit-primitives/dom Mount to a container slot. No Bundle, because the lock and the inert set…
ListNavigationKeyboard navigation of a list in one placement: a roving tab stop, type to find, and PageUp and PageDown. One Bundle holds the current item's id and the…
LiveAnnounceAnnouncements for assistive technology: one Bundle, placed once, holds the text of a polite and an assertive live region. An announcement waits debounceMs…
LongPressLongPress: holding an element down for thresholdMs is one fact. It reads the same facts Press.events reports; the threshold is a Command on Effect's clock…
MoveMove as a Behavior: attaches the foldkit-primitives/dom Mount to a draggable slot and maps its facts into the view's Messages. No Bundle: a drag's meaning…
OverlayOne overlay policy value instead of nine subtly different overlay implementations. modal and nonModal cover the two shapes; anything else is an explicit…
PlacingKeeps a floating panel inside the viewport: on insert it shifts left past the right edge and flips above its trigger when the bottom overflows and the room…
PointerDragPointerDrag as a Behavior: attaches the foldkit-primitives/dom Mount to a container slot and maps what it reports into the view's Messages. No Bundle: what…
PressPress: pointer and keyboard activation of one element as one fact. A Mount reports what the element saw (pointer down, up, cancel, key down, up, click) with…
RovingTabindexOne tab stop for a set of items (a toolbar, a tab list, a listbox): arrows move focus between them, the rest stay out of the tab order. The current item's…
SelectionSelection over a set of items: which ids are selected, and the anchor a range extends from. mode is 'single' (a click replaces), 'multiple' (a click…
TargetsTargets as a Behavior: attaches the foldkit-primitives/dom Mount to a container slot and maps what it reports into the view's Messages. No Bundle: which…
TreeNavigationKeyboard navigation of a tree (a file explorer, a page's layers, a nested menu), after the WAI-ARIA tree pattern: one tab stop, Up and Down through the rows…
TypeaheadTypeahead over a set of items: printable keys build a query that a timer clears, and the query picks the item to move to. The query lives in the Model so a…