/** * Computed reactive values. */ import { type ReactiveSource } from './internals'; /** * A computed value that derives from other reactive sources. * * Computed values are lazily evaluated and cached. They only * recompute when their dependencies change. * * @template T - The type of the computed value */ export declare class Computed implements ReactiveSource { private readonly compute; private cachedValue; private hasCachedValue; private dirty; private disposed; private subscribers; private readonly markDirty; /** * Creates a new computed value. * @param compute - Function that computes the value */ constructor(compute: () => T); /** * Gets the computed value, recomputing if dependencies changed. * During untrack calls, getCurrentObserver returns undefined, preventing dependency tracking. */ get value(): T; /** * Reads the current computed value without tracking. * Useful when you need the value but don't want to create a dependency. * * @returns The current cached value (recomputes if dirty) */ peek(): T; /** * Removes an observer from this computed's subscriber set. * @internal */ unsubscribe(observer: () => void): void; /** * Disposes the computed value by unsubscribing its internal observer * from all upstream dependencies and clearing subscribers. */ dispose(): void; } /** * Creates a new computed value. * * If created inside an {@link effectScope}, the computed value is automatically * collected and will be disposed when the scope stops. * * @template T - The type of the computed value * @param fn - Function that computes the value from reactive sources * @returns A new Computed instance */ export declare const computed: (fn: () => T) => Computed; //# sourceMappingURL=computed.d.ts.map