Primitives / API

foldkit-primitives/dom

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.
copyTextCopies text to the clipboard. Without a clipboard API (SSR, insecure context, denied permission) the command yields CopyFailed instead of throwing, so…
fluidHoveredThe custom properties FluidHover writes on its container for a highlight named name.
keepScrollKeeps the window's scroll across same-document navigations: a pushed entry starts at the top, and Back, Forward or a reload return where that entry was.…
loadScriptLoads a script by URL, once per URL.
measuredThe custom properties Measure writes for a target named name.
pointedLinksThe address of the link a reader points at or tabs to, on the page's own origin: where they may go next, for a Data.preload before they go. Each link once…
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.
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…
DragStarted
DragZone
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_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
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 inert while it is mounted, and restores it after.
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,…
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
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;…
ScriptMessage
ScrollLockLocks the document's scroll while the element is mounted; nested locks release with the last.
ShareData
ShareMessage
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

Interfaces

KeepScrollOptionsHow keepScroll remembers and restores each history entry's offset.

Types