UNPKG

@sv-use/core

Version:

A collection of Svelte 5 utilities.

30 lines (29 loc) 956 B
type GetActiveElementOptions = { /** * Whether to automatically cleanup the event listener or not. * * If set to `true`, it must run in the component initialization lifecycle. * @default true */ autoCleanup?: boolean; /** * Whether to search for the active element inside shadow DOM or not. * @default true */ searchInShadow?: boolean; }; type GetActiveElementReturn = { /** The current active element or `null`. */ readonly current: HTMLElement | null; /** * The function to cleanup the event listener. * @note Is called automatically if `options.autoCleanup` is set to `true`. */ cleanup: () => void; }; /** * Returns the element within the DOM that currently has focus. * @see https://svelte-librarian.github.io/sv-use/docs/core/get-active-element */ export declare function getActiveElement(options?: GetActiveElementOptions): GetActiveElementReturn; export {};