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

BundleBehaviorThe mixin half of a Bundle: a Behavior whose slots are wired to the Bundle's Messages through its Declared placement.
DismissLayerDismissable layers: Escape closes the topmost open layer unless a handler below it already took the key (defaultPrevented), a pointer press outside closes…
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…
FocusRecoveryFocusRecovery as a Behavior: marks an owner slot and the part slots whose focus it recovers, and attaches the foldkit-primitives/dom Mount to the owner. No…
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…
InlineEditEditing a value where it is shown, in an <input>: a title becomes a text field on Enter, F2 or a double click, Enter saves, Escape puts it back. The Model…
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…
MarqueeMarquee as a Behavior: a lasso over the container's marked descendants. No Bundle: the rectangle is for the view to draw in a Slot of its own, and the ids…
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…
PresencePresence as a Behavior: draws a phase the Model already holds. A row that is leaving is inert for the whole exit, so it takes no click, Tab or focus and…
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…
ReorderMoving an item to another place in a list or a tree, by keyboard and by pointer, as one Bundle. Space or Enter (or the grab chords) on an item picks it up,…
RepeatRepeat: a held stepper. Pressing steps once, and holding on steps again every intervalMs after delayMs, until the press ends or the parent says the bound is…
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…
SpatialNavigationArrow keys over freely placed items (a board, a canvas, a dashboard of cards), where there are no rows or columns: each arrow moves to the nearest item…
SwipeActionsSwipe-to-reveal actions behind a row, with a way in that needs no pointer: which row side is open, what a release of a Swipe means (open, close, or run the…
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…