import type { Signal, PrimitiveSignal, Primitive } from './types'; /** * Subscribe the active effect to ONE dep covering every write to `target` — * any key, new keys, deletions, and Map/Set mutations. * * This is what a deep watcher actually wants. Subscribing per key made the * traversal read every value back through the `get` trap purely to reach that * key's dep: ~1200 reads and ~1600 `track` calls on a 200-row fixture, where * one subscription per object is 402 (#644). It also had to track the key-set * dep separately (#641), because a key nobody has read has no per-key dep yet — * an any-write dep subsumes that case, since the `set` trap fires it for a new * key as readily as for a changed one. * * Allocated lazily on first subscription, so an object nobody deep-watches * never creates it and its writes pay one already-loaded null check. * * A no-op on anything that is not a reactive proxy: reading an unknown symbol * off a plain object yields `undefined` and touches nothing. * * @internal */ export declare function trackAnyWrite(target: unknown): void; /** @internal Get the current access observer for computed/model integration */ export declare function getAccessObserver(): ((target: any, key: string | symbol) => void) | null; /** @internal Temporarily suspend the access observer (used by computed to prevent leakage) */ export declare function setAccessObserver(observer: ((target: any, key: string | symbol) => void) | null): void; /** * Detect which reactive property a selector function accesses. * * Runs `selector()` while observing property accesses and returns the * last `[target, key]` pair accessed, or `null` if nothing was read. * Used internally by the model/two-way-binding system. * * @example * ```ts * const state = signal({ form: { name: 'Alice' } }); * const result = detectAccess(() => state.form.name); * // result === [state.form, 'name'] * ``` */ export declare function detectAccess(selector: () => any): [any, string | symbol] | null; /** * Dev-only variant of {@link detectAccess} that also reports whether the * selector returned a value different from the last property it read. * * A valid model getter is a property-access chain whose return value IS the * leaf property (`() => state.a.b` returns `state.a.b`; a writable computed * `() => c.value` returns `c.value`). A transformed expression like * `() => transform(state.x)` or `() => state.count * 2` returns something * other than the property it read, which means a two-way binding would write * the transformed value back into that property — almost never the intent. * * @internal Used by the JSX runtime to warn in development. */ export declare function detectAccessDev(selector: () => any): { access: [any, string | symbol] | null; looksTransformed: boolean; }; /** * Create a reactive signal from a value. * * For primitives, wraps the value as `{ value: T }` — access and mutate via `.value`. * For objects, returns a deeply reactive proxy with `.$set()` for full replacement. * * @example * ```ts * const count = signal(0); * count.value++; * * const user = signal({ name: 'Alice' }); * user.name = 'Bob'; // reactive * user.$set({ name: 'Carol' }); // replace entire object * ``` */ export declare function signal(target: T): PrimitiveSignal; export declare function signal(target: T): Signal; /** * Get the devtools id of a reactive proxy, or `null` if it wasn't * created while a hook was installed. Used by `@sigx/devtools` to * map proxy values to their event ids. */ export declare function getSignalId(proxy: object): number | null; //# sourceMappingURL=signal.d.ts.map