tav-ui
Version:
38 lines (37 loc) • 2.04 kB
TypeScript
import type { FunctionArgs } from '@vueuse/core';
export interface ViewportOffsetResult {
left: number;
top: number;
right: number;
bottom: number;
rightIncludeBody: number;
bottomIncludeBody: number;
}
interface Fn<T = any, R = T> {
(...arg: T[]): R;
}
export declare function getBoundingClientRect(element: Element): DOMRect | number;
export declare function hasClass(el: Element, cls: string): boolean;
export declare function addClass(el: Element, cls: string): void;
export declare function removeClass(el: Element, cls: string): void;
/**
* Get the left and top offset of the current element
* left: the distance between the leftmost element and the left side of the document
* top: the distance from the top of the element to the top of the document
* right: the distance from the far right of the element to the right of the document
* bottom: the distance from the bottom of the element to the bottom of the document
* rightIncludeBody: the distance between the leftmost element and the right side of the document
* bottomIncludeBody: the distance from the bottom of the element to the bottom of the document
*
* @description:
*/
export declare function getViewportOffset(element: Element): ViewportOffsetResult;
export declare function hackCss(attr: string, value: string): any;
export declare function on(element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject): void;
export declare function off(element: Element | HTMLElement | Document | Window, event: string, handler: Fn): void;
export declare function once(el: HTMLElement, event: string, fn: EventListener): void;
export declare function useRafThrottle<T extends FunctionArgs>(fn: T): any;
export declare function componentRendered(callback?: (...args: any[]) => any): Promise<unknown> | undefined;
export declare function parentsUntil(el: any, selector: any, filter: any): HTMLDivElement[];
export declare function closest(el: any, selector: any): HTMLDivElement | null;
export {};