Skip to content

Commit

Permalink
fix: add types
Browse files Browse the repository at this point in the history
  • Loading branch information
yitengjun committed Mar 16, 2023
1 parent 2e835a9 commit 693bec2
Show file tree
Hide file tree
Showing 9 changed files with 1,631 additions and 9 deletions.
39 changes: 39 additions & 0 deletions dist/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export default class Ukiyo {
private elements;
private options;
private instances;
private externalRAF;
private requestId?;
private timer?;
private onResizeEvent;
private isInit;
private constructor();
/**
* Initializes
*/
private init;
/**
* Animation
*/
animate(): void;
/**
* Cancel animation
*/
private cancel;
/**
* Reset all instances
*/
reset(): void;
/**
* Resize event
*/
private resize;
/**
* Add event listeners
*/
private addEventListeners;
/**
* Destroy all instances
*/
destroy(): void;
}
7 changes: 7 additions & 0 deletions dist/types/options.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export declare const defaults: {
scale: number;
speed: number;
wrapperClass: null;
willChange: boolean;
externalRAF: boolean;
};
77 changes: 77 additions & 0 deletions dist/types/parallax.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import type { UkiyoOptions } from '../types/index';
/**
* Parallax class
*/
export declare class Parallax {
private options;
private element;
private wrapper;
private overflow?;
private vh;
private observer?;
private isVisible;
private wrapperHeight?;
private damp;
private elementTagName;
constructor(element: HTMLElement, options: Partial<UkiyoOptions>);
/**
* Create Parallax
*/
private createParallax;
/**
* Update options
*/
private updateOptions;
/**
* Sets the style of an element
*/
private setStyle;
/**
* Wrap element
*/
private wrapElement;
/**
* Check visible
*/
private checkVisible;
/**
* Create Observer
*/
private createObserver;
/**
* Observer callback
*/
private handleIntersect;
/**
* OnEnter
*/
private onEnter;
/**
* OnLeave
*/
private onLeave;
/**
* Calculating the value of parallax
*/
private calcTranslateValue;
/**
* Calculate parallax damp
*/
private calcDamp;
/**
* Set the parallax value to element
*/
private transformParallax;
/**
* Animate parallax
*/
animate(): void;
/**
* Reset parallax
*/
reset(): void;
/**
* Destroy instance
*/
destroy(): void;
}
17 changes: 17 additions & 0 deletions dist/types/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { TElement } from '../types/index';
/**
* Check if the current browser supports the required features
*/
export declare const isSupportedBrowser: () => boolean;
/**
* Determine if an image is loaded
*/
export declare const isImageLoaded: (src: string) => Promise<HTMLImageElement>;
/**
* Get an array of elements
*/
export declare const getElements: (elements: TElement) => HTMLElement[];
/**
* Determine if the current browser is Safari on iOS
*/
export declare const isSPSafari: () => boolean;
1 change: 0 additions & 1 deletion docs/js/ukiyo.min.js.map

This file was deleted.

0 comments on commit 693bec2

Please sign in to comment.