The runtime
Effect-typed: what this page covers uses Effect's own types, so it moves to a new Effect major only in a Wardic major (the roadmap).
A WardicProvider builds one Effect runtime for everything under it, over its Environment: the clock, the frame loop, the renderer, the probe and the rest. These run Effect code of your own on it, for building on Wardic, or reading what it reads.
import { runScoped, useWardicRuntime } from "@wardic/solid" // or "@wardic/solid/unstable/v2"
const runtime = useWardicRuntime()
runScoped(runtime, Stream.runForEach(ticks, (tick) => Effect.sync(() => setTick(tick))))useWardicRuntime()is the nearest provider's runtime. It throws outside a provider. A server render doesn't build it: hold it, but run on it only once the element has mounted (Solid 1'sonMount, Solid 2'sonSettled).runScoped(runtime, effect)runseffectand interrupts it as the current owner is cleaned up, its Scope closed with it, and returns its fiber. A failure is logged aswardic.runScoped: a fiber failedand reported to the Environment's error reporters; an interruption is neither. On a server it starts nothing, and while hydrating it starts once the page has mounted.useWardicFiber(() => effect)isrunScopedon the provider's runtime, the thunk called once.
The services
Code run on the runtime can use the Environment's services, each an Effect service:
| Service | |
|---|---|
Clock, RefreshFrameSource, FrameLoop | Time, the screen's frames, and the loop every animation steps on. |
Renderer | What writes values onto elements. |
Probe | What reads the page: sizes, scroll, the reduced-motion setting, whether the page is shown. |
InterpolatorRegistry | How each kind of value blends: numbers, colours, units. |
PositionalKeys, DefaultTransition | Which keys reduced motion snaps, and each value's default transition. |
Announcer | What speaks to a screen reader. |
AtomRegistry | Where Wardic's reactive values live. |
@wardic/dom's DomLive provides them in a browser, and @wardic/test's TestLive in a test. See Observability for the logs and traces they give.
Types
WardicRuntime: the runtime, aManagedRuntimeof its services.WardicServices: the services, as a union.