@sv-use/core
Version:
A collection of Svelte 5 utilities.
26 lines (25 loc) • 891 B
TypeScript
import { type ObserveResizeOptions } from '../observe-resize/index.svelte.js';
import type { MaybeGetter } from '../__internal__/types.js';
export interface ElementSize {
width: number;
height: number;
}
interface GetElementSizeOptions extends Omit<ObserveResizeOptions, 'autoCleanup'> {
/**
* The initial size of the element.
* @default { width: 0, height: 0 }
*/
initialSize?: ElementSize;
}
type GetElementSizeReturn = {
readonly width: number;
readonly height: number;
};
/**
* Tracks the size of an element.
* @param element The element to track.
* @param options Additional options to customize the behavior.
* @see https://svelte-librarian.github.io/sv-use/docs/core/get-element-size
*/
export declare function getElementSize(element: MaybeGetter<HTMLElement | undefined>, options?: GetElementSizeOptions): GetElementSizeReturn;
export {};