import { Options as Options$1, ScrollAction } from './compute.js'; /** @public */ type Options = StandardBehaviorOptions | CustomBehaviorOptions; /** * Only scrolls if the `node` is partially out of view: * ```ts * scrollIntoView(node, { scrollMode: 'if-needed' }) * ``` * Skips scrolling `overflow: hidden` elements: * ```ts * scrollIntoView(node, { skipOverflowHiddenElements: true }) * ``` * When scrolling is needed do the least and smoothest scrolling possible: * ```ts * scrollIntoView(node, { * behavior: 'smooth', * scrollMode: 'if-needed', * block: 'nearest', * inline: 'nearest', * }) * ``` * @public */ interface StandardBehaviorOptions extends Options$1 { /** * @defaultValue 'auto */ behavior?: ScrollBehavior; } /** @public */ interface CustomBehaviorOptions extends Options$1 { behavior: CustomScrollBehaviorCallback; } /** @public */ type CustomScrollBehaviorCallback = (actions: ScrollAction[]) => T; /** * Scrolls the given element into view, with options for when, and how. * Supports the same `options` as [`Element.prototype.scrollIntoView`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) with additions such as `scrollMode`, `behavior: Function` and `skipOverflowHiddenElements`. * @public */ declare function scrollIntoView(target: Element, options?: StandardBehaviorOptions | boolean): void; /** * Scrolls the given element into view, with options for when, and how. * Supports the same `options` as [`Element.prototype.scrollIntoView`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) with additions such as `scrollMode`, `behavior: Function` and `skipOverflowHiddenElements`. * * You can set the expected return type for `behavior: Function`: * ```ts * await scrollIntoView>(node, { * behavior: async actions => { * return Promise.all(actions.map( * // animate() resolves to `true` if anything was animated, `false` if the element already were in the end state * ({ el, left, top }) => animate(el, {scroll: {left, top}}) * )) * } * }) * ``` * @public */ declare function scrollIntoView(target: Element, options: CustomBehaviorOptions): T; export { type CustomBehaviorOptions, type CustomScrollBehaviorCallback, type Options, type StandardBehaviorOptions, scrollIntoView as default };