Import
import { makeState } from "@typed/ui/Composite";Signatures
export declare function makeState(initial?: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
readonly activeId: string | null;
readonly orientation: "horizontal" | "vertical" | "both";
readonly loop: boolean;
readonly rtl: boolean;
readonly virtualFocus: boolean;
}, Schema.SchemaError, never, never>, never, import("effect/Scope").Scope>;Why
State and collection ownership can be composed and tested independently from any renderer.
Ownership and lifetime
The returned Effect creates the RefSubject when run. That state is renderer-independent; collection registrations belong to the separate Scope that runs register or ref, not to state creation.
Examples
import * as Effect from "effect/Effect";
import * as Collection from "@typed/ui/Collection";
import * as Composite from "@typed/ui/Composite";
const program = Effect.scoped(
Effect.gen(function* () {
const state = yield* Composite.makeState({});
const collection = yield* Collection.makeState<string>();
return { state: yield* state, collection: yield* collection };
}),
);Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.