@graphcommerce/framer-scroller 2.1.19 → 2.1.22
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/CHANGELOG.md +23 -0
- package/hooks/useScrollTo.ts +8 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 2.1.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1522](https://github.com/graphcommerce-org/graphcommerce/pull/1522) [`584b683a2`](https://github.com/graphcommerce-org/graphcommerce/commit/584b683a2aedcdf5067644c8dcc0e63a5b9e894c) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Make sure useScrollTo uses the MotionConfigContext to determine the speed of the animation
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`8d8fda262`](https://github.com/graphcommerce-org/graphcommerce/commit/8d8fda2623e561cb43441110c67ffa34b692668a), [`cefa7b365`](https://github.com/graphcommerce-org/graphcommerce/commit/cefa7b3652b55108d2178927e3c5d98a111cf373)]:
|
|
10
|
+
- @graphcommerce/next-ui@4.13.0
|
|
11
|
+
|
|
12
|
+
## 2.1.21
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`c756f42e5`](https://github.com/graphcommerce-org/graphcommerce/commit/c756f42e503761a497e4a5a7a02d02141df231c3)]:
|
|
17
|
+
- @graphcommerce/next-ui@4.12.0
|
|
18
|
+
|
|
19
|
+
## 2.1.20
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`fe4baa42d`](https://github.com/graphcommerce-org/graphcommerce/commit/fe4baa42db0081ed960d62aef688bd36a7ac974f)]:
|
|
24
|
+
- @graphcommerce/next-ui@4.11.2
|
|
25
|
+
|
|
3
26
|
## 2.1.19
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/hooks/useScrollTo.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { useElementScroll } from '@graphcommerce/framer-utils'
|
|
2
|
-
import { Point } from 'framer-motion'
|
|
2
|
+
import { MotionConfigContext, Point, Tween } from 'framer-motion'
|
|
3
3
|
import { animate } from 'popmotion'
|
|
4
|
-
import { useCallback } from 'react'
|
|
4
|
+
import { useCallback, useContext } from 'react'
|
|
5
5
|
import { useScrollerContext } from './useScrollerContext'
|
|
6
6
|
|
|
7
7
|
export function useScrollTo() {
|
|
8
8
|
const { scrollerRef, register, disableSnap, enableSnap } = useScrollerContext()
|
|
9
9
|
const scroll = useElementScroll(scrollerRef)
|
|
10
10
|
|
|
11
|
+
const duration =
|
|
12
|
+
((useContext(MotionConfigContext).transition as Tween | undefined)?.duration ?? 0.375) * 1000
|
|
13
|
+
|
|
11
14
|
const scrollTo = useCallback(
|
|
12
15
|
async (to: Point) => {
|
|
13
16
|
const ref = scrollerRef.current
|
|
@@ -39,7 +42,7 @@ export function useScrollTo() {
|
|
|
39
42
|
},
|
|
40
43
|
onComplete,
|
|
41
44
|
onStop: onComplete,
|
|
42
|
-
duration
|
|
45
|
+
duration,
|
|
43
46
|
}),
|
|
44
47
|
)
|
|
45
48
|
} else onComplete()
|
|
@@ -59,7 +62,7 @@ export function useScrollTo() {
|
|
|
59
62
|
},
|
|
60
63
|
onComplete,
|
|
61
64
|
onStop: onComplete,
|
|
62
|
-
duration
|
|
65
|
+
duration,
|
|
63
66
|
}),
|
|
64
67
|
)
|
|
65
68
|
} else {
|
|
@@ -72,7 +75,7 @@ export function useScrollTo() {
|
|
|
72
75
|
scroll.scroll.stop()
|
|
73
76
|
enableSnap()
|
|
74
77
|
},
|
|
75
|
-
[disableSnap, enableSnap, register, scroll, scrollerRef],
|
|
78
|
+
[disableSnap, enableSnap, register, scroll, scrollerRef, duration],
|
|
76
79
|
)
|
|
77
80
|
|
|
78
81
|
return scrollTo
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/framer-scroller",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "2.1.
|
|
5
|
+
"version": "2.1.22",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "tsc -W"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@graphcommerce/framer-utils": "3.1.4",
|
|
19
19
|
"@graphcommerce/image": "3.1.7",
|
|
20
|
-
"@graphcommerce/next-ui": "4.
|
|
20
|
+
"@graphcommerce/next-ui": "4.13.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@graphcommerce/eslint-config-pwa": "^4.1.8",
|