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 })| Feature | What it brings |
|---|---|
hover | whileHover, and hovering's callbacks or events |
press | whileTap, and the tap's, from a pointer and the keyboard |
focus | whileFocus |
inView | whileInView, viewport, and the viewport's callbacks or events |
pan | The pan's callbacks or events |
drag | drag and its props, dragControls, and the drag's callbacks or events |
layout | layout, layoutId, layoutScroll and layoutRoot |
colors | oklch(), oklab(), lab(), lch(), hwb() and color(). Hex, rgb(), hsl() and the colour names need none. |
scroll | A container's scroll, for createScroll, which brings it itself. |
domAnimation | Motion's set: hover, press, focus and inView. |
domMax | Motion'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: whatfeaturestakes:Features, or aFeatureLoad.