/** @internal Start collecting effect disposers (used by router). */ export declare function _setEffectCollector(collector: (() => void)[] | null): void; /** @internal Read the current effect collector (used by html renderer). */ export declare function _getEffectCollector(): (() => void)[] | null; /** @internal Called when a signal is created. */ export declare let __debugSignalCreate: ((s: Signal, label?: string) => void) | null; /** @internal Called when a signal value changes. */ export declare let __debugSignalUpdate: ((s: Signal, oldVal: unknown, newVal: unknown) => void) | null; /** @internal Set the debug hooks, then replay signals created before now. */ export declare function __setDebugSignalHooks(onCreate: typeof __debugSignalCreate, onUpdate: typeof __debugSignalUpdate): void; export interface Signal { value: T; /** @internal */ readonly _t4: true; /** @internal subscribe directly (used by html renderer) */ _subscribe(fn: () => void): () => void; /** @internal read without tracking */ peek(): T; } export interface ReadonlySignal { readonly value: T; /** @internal */ readonly _t4: true; /** @internal */ _subscribe(fn: () => void): () => void; peek(): T; } /** * Create a reactive signal — a value that notifies subscribers when it changes. * * @param initial - The initial value. * @param label - Optional debug label shown in the debug overlay. * @returns A signal whose `.value` getter/setter is reactive. * * @example * const count = signal(0); * count.value; // read: 0 * count.value = 5; // write: triggers all subscribers * * const name = signal('Alice', 'userName'); // labelled for debug overlay */ export declare function signal(initial: T, label?: string): Signal; /** * Create a derived signal that auto-tracks its dependencies. * Re-computes whenever any signal read inside `fn` changes. * The result is read-only — writing throws. * * @param fn - Pure function that reads signals and returns a derived value. * @returns A read-only signal. * * @example * const price = signal(10); * const qty = signal(3); * const total = computed(() => price.value * qty.value); * total.value; // 30 — updates automatically when price or qty change */ export declare function computed(fn: () => T): ReadonlySignal; /** * Run a side-effect that auto-tracks signal dependencies. * Runs immediately, then re-runs whenever a dependency changes. * If the effect throws, sibling effects still run; the first error is re-thrown * after all subscribers have been notified. * * @param fn - The side-effect function. Reads signals to establish tracking. * @returns A `dispose` function — call it to stop the effect. * * @example * const count = signal(0); * const stop = effect(() => { * console.log('count is', count.value); * }); * // logs immediately, then on every count change * stop(); // unsubscribe */ export declare function effect(fn: () => void): () => void; /** * Batch multiple signal updates into a single notification pass. * Subscribers are notified once after `fn` completes, not after each write. * * @param fn - Function containing one or more signal writes. * * @example * const a = signal(1); * const b = signal(2); * batch(() => { * a.value = 10; * b.value = 20; * }); // effects run once, not twice */ export declare function batch(fn: () => void): void; /** Check if a value is a tina4 signal. */ export declare function isSignal(value: unknown): value is Signal; //# sourceMappingURL=signal.d.ts.map