Skip to content

Commit

Permalink
improve ts
Browse files Browse the repository at this point in the history
  • Loading branch information
clementroche committed Jun 4, 2024
1 parent cb978e2 commit 4b0a97b
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 630 deletions.
47 changes: 31 additions & 16 deletions dist/lenis-snap.d.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
import Lenis from 'lenis';

type UID = number;

type Viewport = {
width: number;
height: number;
};
type SnapOptions = {
type?: 'mandatory' | 'proximity';
lerp?: number;
easing?: (t: number) => number;
duration?: number;
velocityThreshold?: number;
onSnapStart?: (t: number) => number;
onSnapComplete?: (t: number) => number;
};
declare class Snap {
constructor(lenis: any, { type, lerp, easing, duration, velocityThreshold, onSnapStart, onSnapComplete, }?: {
type?: string;
lerp: any;
easing: any;
duration: any;
velocityThreshold?: number;
onSnapStart: any;
onSnapComplete: any;
});
lenis: Lenis;
options: SnapOptions;
elements: Map<number, Node>;
snaps: Map<number, number>;
viewport: Viewport;
isStopped: Boolean;
constructor(lenis: Lenis, { type, lerp, easing, duration, velocityThreshold, onSnapStart, onSnapComplete, }?: SnapOptions);
destroy(): void;
start(): void;
stop(): void;
add(value: any): () => void;
remove(id: any): void;
addElement(element: any, options?: {}): () => void;
removeElement(id: any): void;
add(value: number): () => void;
remove(id: UID): void;
addElement(element: Node, options?: {}): () => void;
removeElement(id: UID): void;
onWindowResize: () => void;
onScroll: ({ scroll, limit, lastVelocity, velocity, isScrolling, isTouching, userData, }: {
onScroll: ({ scroll, limit, lastVelocity, velocity, isScrolling, userData, isHorizontal, }: {
scroll: any;
limit: any;
lastVelocity: any;
velocity: any;
isScrolling: any;
isTouching: any;
userData: any;
isHorizontal: any;
}) => void;
}

export { Snap as default };
export { type SnapOptions, Snap as default };
39 changes: 19 additions & 20 deletions dist/lenis-snap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lenis-snap.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lenis-snap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4b0a97b

Please sign in to comment.