UNPKG

@design.estate/dees-domtools

Version:

A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.

52 lines (51 loc) 1.64 kB
import type { DomTools } from './domtools.classes.domtools.js'; export declare class Scroller { domtoolsInstance: DomTools; private scrollCallbacks; private lenisInstance; private handleNativeScroll; private handleLenisScroll; constructor(domtoolsInstanceArg: DomTools); private sweetScroller; /** * Scrolls to a given element with options. */ toElement(elementArg: HTMLElement, optionsArg: Parameters<typeof this.sweetScroller.toElement>[1]): Promise<void>; /** * Detects whether native smooth scrolling is enabled. */ detectNativeSmoothScroll(): Promise<boolean>; /** * Enables Lenis scrolling. * If optionsArg.disableOnNativeSmoothScroll is true and native smooth scrolling is detected, * Lenis will be destroyed immediately. */ enableLenisScroll(optionsArg?: { disableOnNativeSmoothScroll?: boolean; }): Promise<void>; /** * Registers a callback to be executed on scroll. * @param callback A function to execute on each scroll event. */ onScroll(callback: () => void): void; /** * Executes all registered scroll callbacks concurrently. */ private executeScrollCallbacks; /** * Attaches the native scroll event listener. */ private attachNativeScrollListener; /** * Detaches the native scroll event listener. */ private detachNativeScrollListener; /** * Attaches the Lenis scroll event listener. */ private attachLenisScrollListener; /** * Detaches the Lenis scroll event listener. */ private detachLenisScrollListener; }