type-alias / @typed/template/Render

TemplateContext

Advanced per-template DOM rendering state used by renderer extensions.

Package version
1.0.0-beta.7
Category
Template run context
Since
1.0.0

Import

import { TemplateContext } from "@typed/template/Render";

Signatures

export type TemplateContext<R = never> = {
    readonly document: Document;
    readonly renderQueue: RQ.RenderQueue;
    readonly disposables: Set<Disposable>;
    readonly eventSource: EventSource;
    readonly refCounter: IndexRefCounter;
    readonly scope: Scope.Closeable;
    readonly eventScope: Scope.Scope;
    readonly disposeEventHandlers: boolean;
    readonly values: ArrayLike<Renderable<unknown, any, any>>;
    readonly services: Context.Context<R | Scope.Scope>;
    readonly onCause: (cause: Cause.Cause<any>) => Effect.Effect<unknown>;
    readonly hydrateContext: HydrateContext | undefined;
};

Why

The context gathers explicit Effect services, a forked child Scope, delegated native events, queue policy, ref coordination, and optional hydration state without relying on a hidden component tree.

Ownership and lifetime

The child scope owns one-shot render setup. The surrounding eventScope owns mounted dynamic parts, handler fibers, queued callbacks, and ref finalizers until the rendered range is unmounted. Replaceable parts create their own child event Scope so replacement disposes only that part.

Examples

import type { TemplateContext } from "@typed/template/Render"

declare const context: TemplateContext
context.renderQueue

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source