/** * @param input Object or array to clone * @description A simple clone using JSON.stringify and JSON.parse. Properties with an undefined value will be included in the result with a value of null */ export declare function clone(input: T): T; /** * @description * Force DOM layout. Coupled with a requestAnimationFrame this can be * used to make sure newly added elements exist in the DOM before performing * some other action, such as an animated transition */ export declare function forceLayout(): number; /** * @async * @param type - Media type * @param src - Media source */ export declare function preloadMedia(type: 'img' | 'video', src: string): Promise; /** * @param text - string to truncate * @param maxLines - Restrict to n lines. Determined by line breaks * @param maxChars - Restrict to n total characters */ export declare function getTruncatedText({ text, maxLines, maxChars }: { text?: string; maxLines?: number; maxChars?: number; }): string; /** * Generate a placeholder svg image */ export declare function getPlaceholderImage(width: number, height: number): string; /** * @async * @param els - An array of elements * @returns A promise that resolve with the index of the most visible el * @description * Find the most visible element in an array. Compares intersectionRatios. * If multiple elements tie for highest intersectionRatio, the most visible * element that appears earliest in the array is returned. */ export declare function getMostVisible(els: Array): Promise; /** * @param el - The target element * @returns a {result: Promise, abort: () => void} * @description More performant async replacement for getBoundingClientRect */ export declare function getAsyncRect(el: Element, cb: (rect: DOMRect) => void): () => void; /** * @param el - the element to query * @description * Get first document or shadowRoot ancestor of an element */ export declare function getClosestShadowRootOrDocument(el: Node): Document | ShadowRoot; /** * @param callback - function to throttle * @param wait - minimum time between invocations * @param thisArg - this context to apply to callback * @param throttleFirst - start with a delay? */ export declare function throttle) => void>(callback: T, wait: number, thisArg: unknown, throttleFirst?: boolean): (...args: Parameters) => void; /** * @param target - An element to toggle classes on * @param classes - An object with the format { className: boolean } * @description * Add or remove classes on a target element with classname keys and boolean values */ export declare function setClasses(target: Element, classes: { [key: string]: boolean; }): void; /** * @param target - An element to set a CSS custom property on * @param vars - An object of the form { "--var-name": "var-value" } */ export declare function setCssVars(target: HTMLElement | undefined, vars: { [key: string]: string; }): void; /** * @param obj1 - Object to compare * @param obj2 - Object to compare * @param props - An array of properties to compare * @description * Compares the properties of two objects literal. Returns true if, for * any property in the props array, obj1[prop] !== obj2[prop] */ export declare function hasChanges(obj1: any, obj2: any, props: string | string[], depth?: 0 | 1): boolean; /** * @param a - value to compare * @param b - value to compare * @param fuzzyNumbers - if set to true '1' will be considered equal to 1. WARNING: this mutates inputs * @param sortArrays - if set to true arrays are sorted before comparing. WARNING: this mutates inputs * @description * Check if two values are the same */ export declare function isEqual(a: any, b: any, fuzzyNumbers?: boolean, sortArrays?: boolean): boolean; /** * @param text - The text to announce * @param mood - assertive or polite * @description - announces some text to screenreaders only */ export declare function announceToScreenReader(text: string, mood?: string): void; /** * @param array - Array to push value into * @param val - Value to push * @param limit - Array length limit * @description - Push a value into an array, remove from beginning of array if array.length > limit */ export declare function pushWithLimit(array: any[], val: any, limit: number): void; export declare function replaceAspectRatioInImageClass(urlString: string, newVal: string): string; //# sourceMappingURL=utils.d.ts.map