WardicProvider
Puts Wardic in your app: every Wardic element, ward and hook sits under one. Give it the Environment Wardic runs in, DomLive in a browser, and the Features your elements use.
import { DomLive } from "@wardic/dom"
import { domAnimation, WardicProvider } from "@wardic/solid" // or "@wardic/solid/unstable/v2"
<WardicProvider env={DomLive} features={[domAnimation]}>
<App />
</WardicProvider>It builds nothing until the first element under it needs it. During a server render it builds nothing at all, and renders each element at its starting style.
Props
| Prop | |
|---|---|
env | The Environment: DomLive in a browser. Merge Effect's own Layers beside it for logs and traces. Read once, and built at once: a Layer that waits as it builds, such as DevTools.layer(), goes in built. |
features | The Features every w.* element under it has: at once, [domAnimation], or loaded with a function. Read once. |
strict | In development, a wardic.* element under it throws. Read once. |
reducedMotion | "user" (the default) follows the visitor's setting, "always" reduces motion, "never" doesn't. See Reduced motion. |
appear | false: on a server-rendered page, entrances wait for the JavaScript. "explain" logs why each one that can't play waits. See Server rendering. |
nonce | The nonce your page's Content Security Policy gives inline styles: the <style> a server render writes for its entrances carries it, and a streamed chunk's too. |
scaleCorrectors | Your own corrections of values a layout animation's scale would distort, by key: Motion's addScaleCorrector, given here. Read once. |
The same props on both bindings. A WardicConfig sets the settings that change, for a subtree.
Coming from Motion
Motion needs no provider. Wardic's holds its runtime, and takes the Features that LazyMotion would; MotionConfig's settings are WardicConfig's.
Types
WardicEnv: whatenvtakes: a Layer giving Wardic's services, such asDomLive, with anything else merged beside it.WardicScaleCorrector: a scale corrector, in Motion's form:{ correct(latest, { target, treeScale, projectionDelta }), applyTo? }.