import * as THREE from 'three'; import type { ComposerHandle } from '../post/composer.js'; import type { FrameContext, SeededRng, FrameLoop } from '../types.js'; /** * Live link between a function-valued JSX prop and the mounted object it * drives. * * @remarks * The render loop calls `apply(get())` for every registered binding once per * frame — polling accessors on the frame tick is the entire reconciliation * model. Nothing re-renders; objects are mutated in place. */ export interface ReactiveBinding { /** Reads the current value (the accessor passed as the JSX prop). */ get: () => unknown; /** Writes a value onto the live three.js object. */ apply: (value: unknown) => void; } /** * Per-`render()` context threaded through the mount: the shared scene, * renderer, frame loop, RNG, and the registries hosts and hooks write into. * * @remarks * Created once per `render()` call and exposed to function components via the * hooks. Registrations are append-only: reactive bindings are re-applied every * frame, disposers run at `RenderHandle.dispose()`, post setups run once after * the whole tree has mounted. */ export interface Runtime { /** Root scene all mounted objects end up under. */ scene: THREE.Scene; /** The WebGL renderer created by `render()`. */ renderer: THREE.WebGLRenderer; /** Frame loop driving reactive bindings and rendering. */ loop: FrameLoop; /** Seeded RNG shared by the whole tree. */ rng: SeededRng; /** The currently active camera. */ getCamera(): THREE.Camera; /** Install a camera; `isDefault: false` only wins while no camera has been chosen. */ setCamera(camera: THREE.Camera, isDefault?: boolean): void; /** Canvas aspect ratio (width / height). */ getAspect(): number; /** Canvas size in pixels as `[width, height]`. */ getSize(): [number, number]; /** Register a binding to re-apply on every frame. */ addReactive(binding: ReactiveBinding): void; /** Register cleanup to run when the tree is disposed. */ addDisposer(fn: () => void): void; /** Defer a callback until the whole tree has mounted (used by ``). */ addPostSetup(fn: () => void): void; /** Route frame rendering through a post-processing composer. */ setComposer(handle: ComposerHandle): void; /** Suppress the built-in orbit gesture (a follow camera owns the view). */ disableOrbit(): void; } /** * A mounted intrinsic element: a real three.js object plus its prop applier. * * @remarks * Hosts are created exactly once at mount — there is no re-render. After * mount the only mutation path is `setProp`, which the loop calls each frame * for reactive (function-valued) props, mutating the live object in place. */ export interface Host { /** Object added to the parent, or `null` for non-spatial elements like ``. */ object: THREE.Object3D | null; /** Object the element's children mount into (usually `object` itself). */ container: THREE.Object3D | null; /** Apply one named prop by mutating the underlying object in place. */ setProp(name: string, value: unknown): void; /** Release resources this element owns; runs at tree disposal. */ dispose(): void; } export declare function createHost(type: string, props: Record, rt: Runtime): Host; export declare const RAW_FUNCTION_PROPS: Set; export type { FrameContext }; //# sourceMappingURL=components.d.ts.map