@graphcommerce/framer-scroller 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ScrollerProvider.tsx +2 -2
- package/hooks/useScrollTo.ts +2 -2
- package/package.json +7 -7
- package/types.ts +2 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MotionValue, motionValue,
|
|
1
|
+
import { MotionValue, motionValue, Point, useMotionValue } from 'framer-motion'
|
|
2
2
|
import { PlaybackControls } from 'popmotion'
|
|
3
3
|
import React, { useEffect, useRef, useMemo, useCallback } from 'react'
|
|
4
4
|
import { scrollerContext } from '../context/scrollerContext'
|
|
@@ -279,7 +279,7 @@ export default function ScrollerProvider(props: ScrollerProviderProps) {
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
function getSnapPosition(direction: 'left' | 'right' | 'up' | 'down'):
|
|
282
|
+
function getSnapPosition(direction: 'left' | 'right' | 'up' | 'down'): Point {
|
|
283
283
|
if (!scrollerRef.current) return { x: 0, y: 0 }
|
|
284
284
|
|
|
285
285
|
const axis: Axis = direction === 'up' || direction === 'down' ? 'y' : 'x'
|
package/hooks/useScrollTo.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useElementScroll } from '@graphcommerce/framer-utils'
|
|
2
|
-
import {
|
|
2
|
+
import { Point } from 'framer-motion'
|
|
3
3
|
import { animate } from 'popmotion'
|
|
4
4
|
import { useScrollerContext } from './useScrollerContext'
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ export function useScrollTo() {
|
|
|
7
7
|
const { scrollerRef, register, disableSnap, enableSnap } = useScrollerContext()
|
|
8
8
|
const scroll = useElementScroll(scrollerRef)
|
|
9
9
|
|
|
10
|
-
return async (to:
|
|
10
|
+
return async (to: Point) => {
|
|
11
11
|
const ref = scrollerRef.current
|
|
12
12
|
if (!ref) return
|
|
13
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/framer-scroller",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "tsc -W"
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@graphcommerce/framer-utils": "^2.103.
|
|
20
|
-
"@graphcommerce/image": "^2.105.
|
|
21
|
-
"@graphcommerce/next-ui": "^3.20.
|
|
19
|
+
"@graphcommerce/framer-utils": "^2.103.18",
|
|
20
|
+
"@graphcommerce/image": "^2.105.7",
|
|
21
|
+
"@graphcommerce/next-ui": "^3.20.7",
|
|
22
22
|
"@material-ui/core": "^4.12.3",
|
|
23
23
|
"popmotion": "11.0.3"
|
|
24
24
|
},
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"clsx": "^1.1.1",
|
|
34
|
-
"framer-motion": "^4.
|
|
34
|
+
"framer-motion": "^5.4.5",
|
|
35
35
|
"react": "^17.0.2",
|
|
36
36
|
"react-dom": "^17.0.2",
|
|
37
|
-
"type-fest": "^2.
|
|
37
|
+
"type-fest": "^2.8.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "f8974380ace982793000e5b181b5bb314a1945fb"
|
|
40
40
|
}
|
package/types.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { MotionValue } from 'framer-motion'
|
|
1
|
+
import { MotionValue, Point } from 'framer-motion'
|
|
2
2
|
import { PlaybackControls } from 'popmotion'
|
|
3
|
-
import { Point2D } from 'popmotion/lib/types'
|
|
4
3
|
import React from 'react'
|
|
5
4
|
|
|
6
5
|
export type ItemState = {
|
|
@@ -37,7 +36,7 @@ export type ScrollerContext = {
|
|
|
37
36
|
/** @private */
|
|
38
37
|
stop(): void
|
|
39
38
|
/** @private */
|
|
40
|
-
getSnapPosition(direction: SnapPositionDirection):
|
|
39
|
+
getSnapPosition(direction: SnapPositionDirection): Point
|
|
41
40
|
/** @private */
|
|
42
41
|
getScrollSnapPositions(): Record<Axis, number[]>
|
|
43
42
|
/** @private */
|