Primitives / API

foldkit-primitives/dom

Namespaces

DRAGGINGWhat a drag under way writes on the document's root, for something that follows the pointer to read without the view drawing again on every move: the…
FOCUS_MARKThe data- names (without the prefix) that mark focus owners and their parts.
scrollThumbThe custom properties ScrollBars writes on each bar, in pixels, for its thumb to read: how far along the bar the thumb starts, and how long it is. Physical:…

Functions

applyMaskThe mask as a pure function: # takes a digit, A a letter, * either, and any other character of the pattern is written in once input reaches past it. Input…
boxOfAn element's box. An element drawn as display: contents has none, so its first child's stands for it, as an editor's node wrapper's does.
canScrollWhether anything from target up to root can still scroll along axis the way a finger moving along (positive is down or right) pulls it: a finger going down…
copyTextCopies text to the clipboard. Without a clipboard API (SSR, insecure context, denied permission) the command yields CopyFailed instead of throwing, so…
cornerRadiusThe radius a box of width by height draws for a computed border-top-left-radius of value (8px, 50%, 8px 4px): its horizontal length in pixels, a share of…
decodeImageFetches and decodes source (img.decode()), yielding Decoded once it can be painted at once, or DecodeFailed when it cannot be fetched or read, or there is…
edgeScrollerScrolls while move was last given a point near an edge of the nearest ancestor of element that can scroll that way, one frame at a time, and calls…
fluidHoveredThe custom properties FluidHover writes on its container for a highlight named name.
keepScrollKeeps the window's scroll (or scroller's) across same-document navigations: a pushed entry starts at the top, and Back, Forward or a reload return where…
keyboardInsetThe part of the layout viewport's height below the visual viewport: what the on-screen keyboard covers. Rounded down, since a fraction of a pixel of zoom is…
loadScriptLoads a script by URL, once per URL.
measuredThe custom properties Measure writes for a target named name.
measurePaddingBoxAn element's padding box now, in the viewport, as PointerPosition measures it: for a size kept beside its places, which a ResizeObserver's content box does…
paddingBoxOfThe padding box of an element whose border box is rect: inside its border, padding included. An absolutely positioned child (a thumb, a stroke) is laid out…
pointedLinksThe address of the link a reader means to follow, on the page's own origin: for a Data.preload before they go (Site.routing's preload). A pointer or focus…
readTextReads the clipboard's text. The browser may ask the user first; a refusal, an insecure context or no clipboard API yields ReadFailed.
shareShares data through the platform sheet.
tabbableWithinTabbable descendants in DOM order: focusable, visible, and not tabindex="-1".
targetOfThe id of the nearest marked element at or above from, inside container.
textOfA field's text. A browser ends an edited element with a line break it adds itself, which is not the author's; in one line, the author's breaks are spaces.
trackedBoxThe custom properties TrackBox writes for name, as measured names Measure's.
velocityOfThe velocity of the samples within SWIPE_WINDOW of the last: the way from the oldest of them to the last over the time between. A pointer that came to rest…
visibleLinksThe address of each same-origin link that scrolls into view, for a Data.preload before the reader reaches it. Opt-in: merge it into Site.routing's…
zoneOfThe zone of a box a vertical position falls in, by thirds.

Values

AutofocusAutofocus as a Mount: focuses the element on insert, then emits Focused. The message means focus was requested — a non-focusable element or a hidden tab may…
ClipboardMessage
ClipboardReadMessage
DRAG_THRESHOLDHow far, in CSS pixels, a press moves before it is a drag rather than a click.
DragCancelled
DragDropped
DraggedOver
DragPlaceA marked descendant under the pointer, and the zone of it the pointer is in. part is the value of the part attribute on the element found, such as the empty…
DragPreviewWhat a drag carries, shown as an element that follows the pointer, as a Mount. The view draws the element once while a drag is under way, with…
DragStarted
DragZone
EDGE_BAND
EDGE_SPEED
EdgeScrollScrolling the nearest scrolling ancestor while a pointer is held near its edge, so a drag or a lasso reaches what is out of view. An empty struct takes the…
EditableTextText typed into an editable descendant of an element, as a Mount: one set of listeners on the container, like Targets. A field is a descendant marked by an…
EditAsked
FLUID_HELD_ATTRIBUTEThe attribute FluidHover sets on its container, to the highlight's name, while the item that highlight is on is held. A stylist draws the press on the…
FLUID_HOVER_ATTRIBUTEThe attribute FluidHover sets on its container, to the highlight's name, while it runs: a stylist draws the highlight, and drops each item's own hover, only…
FLUID_LIT_ATTRIBUTEThe attribute on the item the highlight is shown on, for what CSS draws beside it.
FLUID_PRESS_ATTRIBUTEThe attribute that names, inside an item, the control a press in a gap reaches.
FluidHoverOne highlight that follows the pointer across a container's items, as a Mount, with no Message and no Model: which item the pointer is nearest is…
Focused
FocusRecoveryRecovers focus for a container of parts, as a Mount. While focus is on a marked part (FocusRecovery.behavior draws the marks), the container remembers it;…
FocusReturnGives focus a way back for an overlay whose own restoring is not ours (a Dialog's: it returns to its opener, and to body when that is gone). It takes the…
FocusScopeA focus scope as a Mount: on insert it remembers what was focused, focuses an initial element inside, and with contain keeps Tab and Shift+Tab cycling…
FollowTabStopKeeps focus that is inside a container of roving tab stops on its stop, as a Mount: when a transition moves the stop (a row made current by a command the…
HideOutsideMakes everything outside the element, and outside each layer opened after it, inert while it is mounted, and restores it after.
HOLD_SLOPHow far, in CSS pixels, a held finger may wander before the hold is a scroll.
HOLD_TO_DRAG_MSHow long a finger is held still before its press is a drag. A touch that moves first is a scroll, so a list of draggable rows still scrolls under a finger.
ImageDecodeMessage
InputWhat InputMask reports after each edit: the masked text shown, and the characters typed.
InputMaskAn input mask as a Mount plus a pure mask function. The pattern language is three placeholders — # digit, A letter, * either, all ASCII — with every other…
KeepInViewKeeps what is marked in view as a Mount: whenever an element in the mounted one's subtree newly matches selector, such as the row just selected in a list,…
KEYBOARD_INSETThe custom property KeyboardInset writes on its element: how much of the layout viewport's bottom the on-screen keyboard (or anything else the visual…
KeyboardInsetThe on-screen keyboard's height as a Mount, with no Message and no Model: where it is is the browser's. iOS Safari, and Chrome on Android unless the page…
MarqueeA lasso over an element's marked descendants, as a Mount. A press on empty space (anywhere in the element that is no marked descendant, no control and no…
MarqueeCancelled
MarqueeChanged
MarqueeEnded
MarqueeRectA rectangle in the container's content coordinates: from its padding box's top left, scrolled with it.
MarqueeStarted
MeasureMeasures marked elements as a Mount, for a view to draw something over them, such as an editor's selection outline, with no Message and no Model: where an…
MovePointer movement on an element as a Mount: a primary-button pointer down captures the pointer, each move reports the delta from where it started, and up…
Moved
MoveEnded
MoveStarted
NO_SWIPEWhat a swipe never starts on when its element scrolls: a field whose own drag selects text or moves a thumb, and anything marked data-no-swipe.
PointerDragDragging one marked descendant of an element onto another, as a Mount. A descendant is marked by an attribute whose value is its id, as Targets marks them;…
PointerMoved
PointerPointA place in an element's padding box, in CSS pixels from its top left corner, and the pointer's pressure there (0 to 1; a mouse reads 0.5 while a button is…
PointerPositionWhere one pointer is inside an element, as a Mount, for a surface the pointer draws on or points into (a color area, a dial, a signature pad): a primary…
PointerPressed
PointerReleased
REDUCED_STEP_MSUnder reduced motion the scroll jumps this often, by what the same time would have moved it.
ScriptMessage
SCROLL_BAR_ATTRIBUTEThe attribute that marks a bar beside a scroller ScrollBars runs on, set to the axis it shows: block (the up-and-down bar) or inline.
SCROLL_OVERLAID_ATTRIBUTEThe attribute ScrollBars sets on its scroller while it draws the bars, so a style hides the native bar only then: with no Mount running (a coarse pointer, a…
ScrollBarsAn overlay scrollbar as a Mount, with no Message and no Model: where a scroller is scrolled is the browser's, and the bar only shows it.
ScrollLockLocks the document's scroll while the element is mounted; nested locks release with the last.
ScrollSettleHears a scroller come to rest, as a Mount: after a swipe, a fling, a trackpad or a scroll a Command made, it reports which of its items starts nearest its…
ScrollSettled
SETTLE_QUIETHow long a scroll must be still to count as settled, where scrollend is missing.
ShareData
ShareMessage
StepWhere focus goes when the part that had it is gone, tried in order.
SwipeMove with the speed of its release, for a gesture that a flick ends (a sheet dragged to dismiss, a card swiped away): a primary-button pointer down (or,…
SWIPE_WINDOWHow far back, in milliseconds, the release velocity looks.
Swiped
SwipeEnded
SwipeStarted
TargetHovered
TargetPressed
TargetsWhich marked descendant of an element the pointer is over, and which one was pressed, as a Mount: one set of listeners on the container, not one per item. A…
TextCancelled
TextCommitted
TextEdited
TRACK_TARGET_ATTRIBUTEThe attribute on the mounted element naming the element TrackBox follows, by id.
TrackBoxFollows another element's box, as a Mount: the element whose id is the mounted element's data-target (TRACK_TARGET_ATTRIBUTE). Its box in viewport pixels is…
TrackedTargetSent as the followed element changes: its id, and whether it is on the page.
UNRECOVEREDDispatched, bubbling, from an owner that found no step to take: the next owner out decides.

Interfaces

ImageSourceWhat to decode: a URL, or an img's candidates, so the browser decodes the one it would draw.
KeepScrollOptionsHow keepScroll remembers and restores each history entry's offset.
Rect

Types