import { DIVESceneObject } from '../../../index.ts'; import { EntitySchema, PartialSchema, RegisteredEntity } from '../types/index.ts'; /** * Holds every entity the state knows: its data, its scene object, and the * teardown for the listeners on that object. * * The map itself never leaves this class. Actions get the registry and use * `read` / `write` / `register` / `unregister`, so how an entity is stored stays * a detail here — and `write` being the only way in means the vector-copy rule * is enforced rather than remembered at each call site. * * @module */ export declare class EntityRegistry { private readonly _entities; /** How many entities are registered. */ get size(): number; /** Every entity. */ read(): RegisteredEntity[]; /** One entity, or `undefined` if it is not registered. */ read(id: string): RegisteredEntity | undefined; /** * Patches an entity's data. * * Copies vectors on the way in. The engine reports them as live references * into a buffer it reuses next frame, and `merge` assigns by reference when * the target key is absent — so a moving object would otherwise keep * rewriting its own stored transform. * * @param id - The entity to patch. * @param patch - The fields to apply; anything absent stays as it is. */ write(id: string, patch: PartialSchema): void; /** * Takes an entity in. * * @param schema - The entity data. * @param node - Its scene object, absent for a state-only entity. * @param unwatch - Drops the listeners on the node again. */ register(schema: EntitySchema, node?: DIVESceneObject, unwatch?: () => void): void; /** * Drops an entity and the listeners on its node. * * @param id - The entity to drop. * @returns Whether it was registered. */ unregister(id: string): boolean; /** Drops everything, listeners included. */ clear(): void; }