/** * Copyright 2026 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ /** * Whether the element has an active CSS transition: at least one * `transition-duration` entry is non-zero. Returns `false` when no transition * will run (none declared, or reduced motion has zeroed it out), in which case * `transitionend` will not fire and callers should run their completion logic * immediately instead of waiting for it. * * @param element - The element whose computed `transition-duration` is read. */ export declare function hasActiveTransition(element: Element): boolean; /** * The longest `transition-duration` on the element, in milliseconds. Useful as a * fallback timeout for browsers that do not fire `transitionend` for * `transition-behavior: allow-discrete` discrete properties. * * @param element - The element whose computed `transition-duration` is read. */ export declare function maxTransitionDurationMs(element: Element): number; /** * Run `callback` once `element`'s CSS transition settles, or synchronously when * no transition will run (none declared, or reduced motion) since neither * `transitionend` nor `transitioncancel` will fire in that case. A * `transitioncancel` (interrupted transition) settles the callback as promptly * as a normal `transitionend`. * * When `fallback` is `true` (the default) a timer (the longest declared duration * plus a small buffer) also settles the callback, covering browsers that skip * both transition events for `transition-behavior: allow-discrete` properties * (e.g. Firefox). Pass `fallback: false` when no completion-gated work depends on * the callback (e.g. an open transition, where a delayed `transitionend` should * not be pre-empted by the timer). The listeners and the timer are mutually * cancelling, so the callback runs exactly once. * * @param element - The element whose transition completion is awaited. * @param callback - Invoked once when the transition settles. * @returns A cancel function that removes the listeners and clears the timer * **without** running the callback. Call it to supersede a pending run (for * example a new open/close cycle) or to clean up on disconnect. */ export declare function runAfterTransition(element: Element, callback: () => void, { fallback }?: { fallback?: boolean; }): () => void;