Primitives / DOM
foldkit-primitives/dom
Element Mounts that act while attached, and one-shot Commands that run once and report back. Nothing here owns lasting state: a Mount reads and writes the DOM for its element, a Command's result comes back as a Message your union wraps. (source)
| Name | Form | Reports or yields | Args |
|---|---|---|---|
copyText(text) | Command | Copied, CopyFailed | |
readText() | Command | Read { text }, ReadFailed | |
share(data) | Command | Shared, Dismissed, ShareFailed | { title?, text?, url? } |
loadScript(src) | Command | Loaded, LoadFailed | |
decodeImage(source) | Command | Decoded { src }, DecodeFailed { src, message } | { src, srcset?, sizes? } |
Autofocus() | Mount | Focused | |
InputMask({ pattern }) | Mount | Input { value, raw } | #, A, * placeholders |
KeepInView({ selector }) | Mount | nothing | |
Measure({ targets }) | Mount | nothing; writes custom properties | |
DragPreview() | Mount | nothing | shows a popover="manual" element in top layer (PointerDrag) |
TrackBox({ name, radius? }) | Mount | TrackedTarget { target, found }; writes custom properties | the target's id in data-target |
FluidHover({ name, item, axis, gapClick, gapReach?, follows?, from? }) | Mount | nothing; writes custom properties | axis: x, y, xy |
ScrollBars({ idle?, scroller? }) | Mount | nothing; writes custom properties and marks | idle in ms, default 600 |
FocusScope(options) | Mount | nothing | { contain?, restore?, initialFocus? } |
FollowTabStop | Mount | nothing | |
KeyboardInset | Mount | nothing; writes --fk-keyboard-inset | |
FocusRecovery({ fallback }) | Mount | nothing | fallback: steps per part slot |
FocusReturn() | Mount | nothing | none |
ScrollLock, HideOutside | Mounts | nothing | |
PointerPosition({ focus? }) | Mount | PointerPressed, PointerMoved, PointerReleased | focus: a selector |
Swipe({ measure?, slop?, scrolls?, touchOnly? }) | Mount | SwipeStarted, Swiped, SwipeEnded | see below |
ScrollSettle({ item?, axis?, start? }) | Mount | ScrollSettled { index } | see below |
Move, Targets, PointerDrag, Marquee, EditableText | Mounts | their facts | each is in interaction, beside its Behavior |
keepScroll(options?) | entry | nothing | |
pointedLinks(options?) | stream | Url | rest: how long a hover or focus rests, default 50 ms |
visibleLinks(options?) | stream | Url | atMost (8), margin |
applyMask(value, pattern) | function | { value, raw } |