import { computed, signal } from "alien-signals"; //#region src/core.d.ts type MaybeReactive = T | Reactive; declare class Reactive { protected source: ReturnType> | ReturnType>; constructor(source: ReturnType> | ReturnType>); get(): T; peek(): T; trigger(): void; } declare class Signal extends Reactive { private readonlyComputed; /** * Create a new mutable signal. * * @param initialValue - Initial value stored in the signal. */ constructor(initialValue: T); /** * Update the stored value and notify subscribers. * * @param value - Next value to store in the signal. */ set(value: T): void; readonly(): Computed; } declare class Computed extends Reactive { /** * Create a read-only derived signal. * * @param getter - Function that derives the value from dependencies. */ constructor(getter: (previousValue?: T) => T); } /** * Factory that creates a mutable `Signal` instance. * * @param initialValue - Initial value stored in the signal. */ declare function signal$1(initialValue: T): Signal; /** * Type guard that checks whether an object is a `Signal` instance. */ declare function isSignal(obj: unknown): obj is Signal; /** * Factory that creates a read-only `Computed` instance. * * @param getter - Function that derives the value from dependencies. */ declare function computed$1(getter: (previousValue?: T) => T): Computed; /** * Type guard that checks whether an object is a `Computed` instance. */ declare function isComputed(obj: unknown): obj is Computed; /** * Type guard that checks whether an object is a `Signal` or a `Computed` instance. */ declare function isReactive(obj: unknown): obj is Reactive; /** * Execute a function inside a `alien-signals` batch to group updates. * * @param fn - Function whose updates should be batched. * @return The value returned by the function. */ declare function batch(fn: () => T): T; /** * Temporarily clears the active subscriber while running `fn`, so reads * performed inside the callback do not become dependencies of the currently * active subscriber. Effects created inside the callback are not parented to * the active subscriber. * * @param fn Callback function to run. * @returns Value returned by the callback. */ declare function untracked(fn: () => T): T; /** * Returns a promise that resolves when two values become strictly equal. * * The values are compared using `unwrap` and strict equality (`===`). * * @param a First value to compare. * @param b Second value to compare. * * @returns A promise that resolves when both values become strictly equal. * * @throws {CannotBecomeEqualError} If both values are non-reactive and different, * as they can never become equal. */ declare function whenEqual(a: MaybeReactive, b: MaybeReactive): Promise; declare class CannotBecomeEqualError extends Error { constructor(); } /** * Returns a promise that resolves when the given condition becomes true. * * The condition run inside an effect, so it will re-evaluate * whenever a reactive dependencies used inside it change. * * @param condition A function returning a boolean condition. * * @returns A promise that resolves when `condition()` returns `true`. * The promise may never resolve if the condition never becomes true. */ declare function when(condition: () => boolean): Promise; /** * Returns the underlying value of a `Reactive` instance, * or the value itself if it is not reactive. */ declare function unwrap(value: T | Reactive): T; //#endregion export { CannotBecomeEqualError, Computed, MaybeReactive, Reactive, Signal, batch, computed$1 as computed, isComputed, isReactive, isSignal, signal$1 as signal, untracked, unwrap, when, whenEqual };