Features

A w.* element animates its values with nothing else. Each thing it does beyond that is a Feature, given to a Wardic instance, makeWard({ features, elements }) (on Solid 1, createWardic(features)), or to a section, a WardicProvider or, on Solid 1, a LazyWardic, so a page ships only those it uses. A wardic.* element has every one.

import { domAnimation, layout } from "@wardic/solid" // or "@wardic/solid/v1", with its `createWardic`
import { elements, makeWard } from "@wardic/solid/hooks"

export const { w } = makeWard({ features: [domAnimation, layout], elements })
FeatureWhat it brings
hoverwhileHover, and hovering's callbacks or events
presswhileTap, and the tap's, from a pointer and the keyboard
focuswhileFocus
inViewwhileInView, viewport, and the viewport's callbacks or events
panThe pan's callbacks or events
dragdrag and its props, dragControls, and the drag's callbacks or events
layoutlayout, layoutId, layoutScroll and layoutRoot
colorsoklch(), oklab(), lab(), lch(), hwb() and color(). Hex, rgb(), hsl() and the colour names need none.
scrollA container's scroll, for createScroll, which brings it itself.
domAnimationMotion's set: hover, press, focus and inView.
domMaxMotion's other set: every Feature an element's props use, so all but scroll.

A list can nest them: [domAnimation, layout]. A prop whose Feature an instance lacks is a type error naming it; on the binding's w, under a section without it, the prop does nothing, and development warns once, naming the Feature. See Shipping less for what each costs.

Coming from Motion

Motion's domAnimation and domMax are here by the same names, and Wardic splits them further, a Feature for each gesture. Motion's layout comes only in domMax; here it's a Feature of its own.

Types

  • Feature: one Feature. Its name is part of its type, Feature<…, "drag">, which is how an instance knows its props.
  • Features: one, or a list of them, nested or not.
  • FeatureLoad: a function that loads them: () => Promise<Features>.
  • FeaturesProp: what features takes: Features, or a FeatureLoad.