-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(target): flaws on SSR and
bottom
, right
position
Also, extract types from `index.ts` to `types.ts`
- Loading branch information
Showing
5 changed files
with
150 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,5 +80,5 @@ | |
}, | ||
"type": "module", | ||
"types": "./dist/index.d.ts", | ||
"version": "4.2.0" | ||
"version": "4.2.0-beta.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/** Enumeration for axis values */ | ||
export enum Axis { | ||
/** | ||
* The x-axis represents the horizontal direction. | ||
*/ | ||
X = 'x', | ||
/** | ||
* The y-axis represents the vertical direction. | ||
*/ | ||
Y = 'y' | ||
} | ||
|
||
/** Enumeration for direction values */ | ||
export enum Direction { | ||
/** | ||
* The up direction represents the scroll direction moving towards the top. | ||
*/ | ||
Up = 'up', | ||
/** | ||
* The down direction represents the scroll direction moving towards the bottom. | ||
*/ | ||
Down = 'down', | ||
/** | ||
* The left direction represents the scroll direction moving towards the left. | ||
*/ | ||
Left = 'left', | ||
/** | ||
* The right direction represents the scroll direction moving towards the right. | ||
*/ | ||
Right = 'right', | ||
/** | ||
* The still direction represents the scroll direction when the user is not scrolling. | ||
*/ | ||
Still = 'still' | ||
} | ||
|
||
export type ScrollPosition = { | ||
/** | ||
* The top position represents the distance from the top edge of the page. | ||
*/ | ||
top: number; | ||
/** | ||
* The bottom position represents the distance from the bottom edge of the page. | ||
*/ | ||
bottom: number; | ||
/** | ||
* The left position represents the distance from the left edge of the page. | ||
*/ | ||
left: number; | ||
/** | ||
* The right position represents the distance from the right edge of the page. | ||
*/ | ||
right: number; | ||
}; | ||
|
||
/** Type declaration for the returned scroll information */ | ||
export type ScrollInfo = { | ||
/** | ||
* The scrollDir represents the current scroll direction. | ||
*/ | ||
scrollDir: Direction; | ||
/** | ||
* The scrollPosition represents the current scroll position. | ||
*/ | ||
scrollPosition: ScrollPosition; | ||
}; | ||
|
||
/** Type declaration for scroll properties */ | ||
export type ScrollProps = { | ||
/** | ||
* The target represents the scrollable element to check for scroll detection. | ||
*/ | ||
target?: HTMLDivElement | Window; | ||
/** | ||
* The thr represents the threshold value for scroll detection. | ||
*/ | ||
thr?: number; | ||
/** | ||
* The axis represents the scroll axis (x or y). | ||
*/ | ||
axis?: Axis; | ||
/** | ||
* The scrollUp represents the scroll direction when moving up. | ||
*/ | ||
scrollUp?: Direction; | ||
/** | ||
* The scrollDown represents the scroll direction when moving down. | ||
*/ | ||
scrollDown?: Direction; | ||
/** | ||
* The still represents the scroll direction when the user is not scrolling. | ||
*/ | ||
still?: Direction; | ||
}; |