import type { ComponentDef, EntityHandle, FieldValue, Schema, SchemaOf } from '@ecsia/schema'; import { onAdd } from '../reactivity/index.js'; interface StableIndexWorld { observe(term: ReturnType, handler: (e: { handle: EntityHandle; read(def: unknown): unknown; }) => void): { dispose(): void; }; decodeHandle(handle: EntityHandle): { index: number; }; } export interface StableIndex { /** The entity currently holding stable id `k`, or undefined. */ get(k: K): EntityHandle | undefined; /** Does some live entity hold `k`? */ has(k: K): boolean; /** Stop observing and clear the index. */ dispose(): void; } /** * Build a world-level `idField → entity` index over a component carrying a stable id field. Maintained * via onAdd/onRemove: when the component is added, its id field is read and the entity recorded; when * removed (or the entity despawned), the mapping is dropped. Last writer wins on collision. */ export declare function createStableIndex, F extends keyof SchemaOf & string>(world: StableIndexWorld, component: C, idField: F): StableIndex[F]>>; export {}; //# sourceMappingURL=stable-index.d.ts.map