maz-ui
Version:
A standalone components library for Vue.Js 3 & Nuxt.Js 3
82 lines (81 loc) • 2.06 kB
TypeScript
import { Plugin } from 'vue';
import { Router } from 'vue-router';
export interface AosOptions {
animation?: {
/**
* The delay of the animation
* @default 0
*/
delay?: number;
/**
* The duration of the animation
* @default 300
*/
duration?: number;
/**
* If true, the animation will be triggered only once
* @default true
*/
once?: boolean;
};
/**
* The delay before the animation starts
* @default 100
*/
delay?: number;
/**
* The observer options
* @default {
* root: undefined,
* rootMargin: '0px',
* threshold: 0.2,
* }
*/
observer?: IntersectionObserverInit;
/**
* The router instance to trigger the animation on route change
* @default undefined
*/
router?: Router;
}
interface ClassOptions extends Omit<AosOptions, 'router'> {
animation: {
delay: number;
duration: number;
once: boolean;
};
delay: number;
observer: IntersectionObserverInit & {
rootMargin: string;
threshold: number | number[];
};
}
export declare class AosHandler {
options: ClassOptions;
constructor(options?: Omit<AosOptions, 'router'>);
private handleIntersect;
private handleObserver;
runAnimations(): Promise<void> | undefined;
}
export declare const AosPlugin: Plugin<[AosOptions?]>;
declare module 'vue' {
interface ComponentCustomProperties {
/**
* Aos handler instance
* @description You should install the plugin to use this property
* @examl
* ```ts
* import { AosPlugin } from 'maz-ui/plugins/aos'
* import { createApp } from 'vue'
*
* const app = createApp(App)
* app.use(AosPlugin)
*
* const aos = useAos()
* aos.runAnimations()
*/
$mazAos: AosHandler;
}
}
export declare function getAosInstance(): AosHandler;
export {};