/** Accumulates numeric deltas and applies their sum once per scheduled flush. */
export interface NumericBatcher {
/** Add a signed delta; schedules a flush if one is not already pending. */
add(delta: number): void;
/** Apply the accumulated sum immediately (if non-zero) and clear any pending flush. */
flushNow(): void;
/** Drop any accumulated delta and pending flush without applying. */
cancel(): void;
}
/**
* Coalesce numeric deltas. Multiple `add()` calls within one event-loop turn (e.g. several wheel
* notches in a single stdin chunk, or across chunks in the same tick) are summed and `apply`d once.
* `schedule`/`cancelSchedule` are injectable for testing; default is setImmediate (flushes after
* the current I/O callbacks, so a burst of stdin events collapses into one apply).
*/
export declare function createNumericBatcher(apply: (sum: number) => void, schedule?: (cb: () => void) => unknown, cancelSchedule?: (handle: unknown) => void): NumericBatcher;
/** A throttled function wrapper: leading call fires immediately, trailing call is deferred. */
export interface Throttled {
call(...args: A): void;
/** Cancel a pending trailing call. */
cancel(): void;
}
/**
* Leading + trailing throttle. The first call in an idle period runs immediately; subsequent calls
* within `intervalMs` are coalesced into a single trailing call fired at the end of the window with
* the latest arguments. Used to cap drag-selection re-renders at ~one per frame while still landing
* the final cursor position. `now`/`schedule`/`cancelSchedule` are injectable for tests.
*/
export declare function createThrottle(fn: (...args: A) => void, intervalMs: number, deps?: {
now?: () => number;
schedule?: (cb: () => void, ms: number) => unknown;
cancelSchedule?: (handle: unknown) => void;
}): Throttled;