interface Emitter { on(field: string, handler: () => void): () => void; emit(field: string): void; readonly emits: number; } type SetOptions = { default?: boolean; }; /** * A scope: its fields as plain properties, plus `$emitter` and `$set`. A write to a field emits it; a write inside * a field's value changes plain data and emits nothing. * * @example * const root: ReactiveProxy = createProxyScope(); * const off = root.$emitter.on("user", () => console.log(root.user)); */ type ReactiveProxy> = T & { /** Field subscriptions, e.g. `scope.$emitter.on("user", handler)`, which returns the unsubscribe function. */ $emitter: Pick; /** Writes a field, like assignment. `{ default: true }` writes only while it is undefined (first writer wins). */ $set: (field: string, value: unknown, options?: SetOptions) => void; }; declare const countEmits: (scope: ReactiveProxy) => number; /** * Creates a reactive scope: a shallow proxy over `bag`. A write to a field emits it, so every element reading that * field re-renders. * * @example * const userCtx = createProxyScope({ name: "Hopper", plan: "pro" }); * const init: InitFn = ({ scopes }) => { scopes.userCtx = userCtx; }; // read as scopes.userCtx.name * * @example * userCtx.plan = "free"; // emits "plan" * userCtx.$set("plan", "pro", { default: true }); // no-op: "plan" is set */ declare function createProxyScope(bag?: T): ReactiveProxy; type ForwardTarget = { scope: ReactiveProxy; field: string; }; type RowScope = { proxy: ReactiveProxy>; retarget(element: unknown): boolean; see(scopes: Record, sources: readonly string[]): void; detach(): void; }; declare const unwrapRows: (value: unknown) => unknown; declare const getForwardTargets: (proxy: ReactiveProxy) => ForwardTarget[]; declare function createRowScope(): RowScope; type RowState = { proxy: ReactiveProxy>; retarget(element: unknown, index: number, id: string | number): void; }; declare function createRowState(): RowState; export { createProxyScope, createRowScope, createRowState, countEmits, getForwardTargets, unwrapRows, type ReactiveProxy, type RowScope, type RowState, };