/** * A headless scheduler with a deterministic idle signal. * * Like `createHeadlessScheduler`, `asap` and `paint` resolve on the * microtask queue (no `requestAnimationFrame`). Unlike it, this scheduler * tracks outstanding work — queued microtasks and in-flight `delay` timers * — and exposes `idle()`, a promise that resolves the moment the scheduler * has nothing left to run. `renderToImage` uses this to settle as fast as a * tree's synchronous + timer-driven behaviors quiesce, instead of waiting a * fixed wall-clock window. * * Note `idle()` cannot observe bare `Promise`s (e.g. `fromPromise` / * `switchMap(async …)`) — those resolve on the JS microtask queue without * touching the scheduler. Their downstream emits *do* re-enter via `asap`, * so already-pending resolutions are absorbed, but a value that arrives over * the network (a real macrotask later) is invisible here. Resolve such data * at the boundary before rendering, or pass `settleMs` to add a quiet guard. */ import type { I$Scheduler } from '../ui/index.js'; export interface ISettleScheduler extends I$Scheduler { /** Resolves once no microtask batch is queued and no `delay` timer is pending. */ idle(): Promise; } export declare function createSettleScheduler(): ISettleScheduler;