/** * Waiting on an animation is not the same as waiting on a timer, and a * component that closes a modal behind one has to know the difference. * * The animations here are driven by requestAnimationFrame, through popmotion's * framesync. Browsers throttle that to a standstill in a background tab and * stop it altogether in some cases, so an animation promise is **not** a * reliable signal that it is safe to change DOM state: if the user switches tab * mid-transition it may never resolve, and everything sequenced after it never * runs. For a dialog or a drawer that means a half-faded element that is still * modal and swallows every click on the page. * * Timers are only clamped in a background tab, never cancelled, so a timer * always releases us eventually. These two helpers are the shape that gives. * * Both are shared by `nv-dialog` and `nv-drawer`, which is why they live here: * the two had identical private copies, and a fix applied to one copy is a fix * the other silently misses. */ /** Extra margin before the animation fallback timer releases a transition. */ export declare const ANIMATION_FALLBACK_SLACK = 50; /** Upper bound for waiting on a single animation frame, in ms. */ export declare const FRAME_FALLBACK = 50; /** * Awaits an animation, but never for longer than its own duration plus a small * margin. * @param {Promise} animation - The animation, already started. * @param {number} duration - The animation's nominal duration in ms. * @returns {Promise} Resolves on completion, or when the fallback fires. */ export declare function settleAnimation(animation: Promise, duration: number): Promise; /** * Waits for the next animation frame, or a short timer when frames are not * being delivered. * @returns {Promise} Resolves on the next frame, or when the fallback fires. */ export declare function nextFrame(): Promise;