LazyWardic
Gives the w.* elements in its section more Features, beside their provider's and their Wardic instance's. Motion's LazyMotion. Solid 1's alone.
An app's Features are usually its instances'. A section is for the Features an instance can't name: a third-party component's plain w.*, a Feature handed over at runtime, or a load that runs again each time the section renders.
import { drag, LazyWardic, w } from "@wardic/solid/v1"
// At once: `drag` ships with this page's code.
<LazyWardic features={[drag]}>
<w.div drag />
</LazyWardic>
// Loaded each time the section renders: a module of its own that exports `drag`.
<LazyWardic features={() => import("./drag-feature").then((m) => m.drag)}>
<w.div drag />
</LazyWardic>Props
| Prop | |
|---|---|
features | Its Features: one, a list, or a function that loads them. Read once. |
strict | In development, a wardic.* element under it throws. Read once. |
A loaded Feature takes effect as it arrives: values animate at once, a gesture or a drag starts when its Feature lands, and a layout element starts laying out then. Nothing tried before is replayed. A server loads nothing, and renders each element at its starting style. See Shipping less.
Solid 2
LazyWardic isn't on Solid 2. A hook ward brings each Feature the first time it uses it; makeWard({ features }) gives a module's hooks theirs, at once or by a loader; and a WardicProvider given features={() => import(…)} loads its own as it renders, a provider of its own for a subtree.
Coming from Motion
Motion's LazyMotion loads its Features for the whole page; a LazyWardic's are its section's. Its function returns the Features themselves, not a module: .then((m) => m.drag), not res.default.