import { MaybeRefOrGetter } from "vue"; //#region src/use-scroll-view.d.ts /** * 滚动方向 * - horizontal: 水平滚动 * - vertical: 垂直滚动 */ type ScrollDirection = 'horizontal' | 'vertical'; /** * 滚动视图配置选项 */ type ScrollViewOptions = { /** * 激活元素的 CSS 选择器 * @default '.active' */ activeClassName?: string; /** * 是否启用滚轮滚动 * @default true */ enableWheel?: boolean; /** * 滚动方向 * @default 'vertical' */ direction?: ScrollDirection; /** * 滚轮滚动时的滚动偏移量,默认为容器尺寸 */ scrollOffset?: number; /** * 滚动防抖延迟时间(毫秒) * @default 500 */ debounceDelay?: number; /** * 是否在容器尺寸变化时自动滚动到激活元素 * @default true */ autoScrollOnResize?: boolean; /** * scrollIntoView 的默认配置选项 */ scrollIntoViewOptions?: ScrollIntoViewOptions; }; /** * 滚动视图 Composable * 提供平滑滚动到激活元素的功能,支持滚轮滚动和自动调整 * * @param templateRef 目标滚动容器的模板引用 * @param options 配置选项 * @returns 返回包含滚动方法和状态的对象 * * @example * ```ts * const containerRef = ref() * const { scrollToView, scrollToNext, scrollToPrevious } = useScrollView(containerRef, { * activeClassName: '.active', * enableWheel: true, * direction: 'vertical' * }) * ``` */ declare function useScrollView(templateRef: MaybeRefOrGetter, options?: ScrollViewOptions): { scrollToView: (customOptions?: ScrollIntoViewOptions) => Promise; scrollToElement: (element: Element, customOptions?: ScrollIntoViewOptions) => Promise; scrollToNext: () => Promise; scrollToPrevious: () => Promise; getActiveElement: () => Element | null; getScrollableElements: () => Element[]; }; /** * useScrollView 函数的返回类型 */ type UseScrollViewReturns = ReturnType; //#endregion export { ScrollDirection, ScrollViewOptions, UseScrollViewReturns, useScrollView };