@graphcommerce/framer-scroller 2.1.21 → 2.1.24

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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.1.24
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`afcd8e4bf`](https://github.com/graphcommerce-org/graphcommerce/commit/afcd8e4bfb7010da4d5faeed85b61991ed7975f4), [`02e1988e5`](https://github.com/graphcommerce-org/graphcommerce/commit/02e1988e5f361c6f66ae30d3bbee38ef2ac062df), [`323fdee4b`](https://github.com/graphcommerce-org/graphcommerce/commit/323fdee4b15ae23e0e84dd0588cb2c6446dcfd50)]:
8
+ - @graphcommerce/next-ui@4.14.0
9
+
10
+ ## 2.1.23
11
+
12
+ ### Patch Changes
13
+
14
+ - [#1550](https://github.com/graphcommerce-org/graphcommerce/pull/1550) [`b4936e961`](https://github.com/graphcommerce-org/graphcommerce/commit/b4936e96175fe80717895822e245274db05638bd) Thanks [@paales](https://github.com/paales)! - Upgraded Framer Motion to latest version, which reduces initial bundle size load
15
+
16
+ - Updated dependencies [[`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce), [`c5c539c44`](https://github.com/graphcommerce-org/graphcommerce/commit/c5c539c44eeac524cd62ce649e132d2e00333794), [`6f69bc54c`](https://github.com/graphcommerce-org/graphcommerce/commit/6f69bc54c6e0224452817c532ae58d9c332b61ea), [`21886d6fa`](https://github.com/graphcommerce-org/graphcommerce/commit/21886d6fa64a48d9e932bfaf8d138c9b13c36e43)]:
17
+ - @graphcommerce/next-ui@4.13.1
18
+
19
+ ## 2.1.22
20
+
21
+ ### Patch Changes
22
+
23
+ - [#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
24
+
25
+ - Updated dependencies [[`8d8fda262`](https://github.com/graphcommerce-org/graphcommerce/commit/8d8fda2623e561cb43441110c67ffa34b692668a), [`cefa7b365`](https://github.com/graphcommerce-org/graphcommerce/commit/cefa7b3652b55108d2178927e3c5d98a111cf373)]:
26
+ - @graphcommerce/next-ui@4.13.0
27
+
3
28
  ## 2.1.21
4
29
 
5
30
  ### Patch Changes
@@ -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
@@ -22,6 +25,7 @@ export function useScrollTo() {
22
25
  // return
23
26
  // }
24
27
 
28
+ // @ts-expect-error private api, but we're updating the animation value here manually instead of relying on the event listener.
25
29
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
26
30
  scroll.scroll.start(() => () => {})
27
31
 
@@ -39,7 +43,7 @@ export function useScrollTo() {
39
43
  },
40
44
  onComplete,
41
45
  onStop: onComplete,
42
- duration: 375,
46
+ duration,
43
47
  }),
44
48
  )
45
49
  } else onComplete()
@@ -59,7 +63,7 @@ export function useScrollTo() {
59
63
  },
60
64
  onComplete,
61
65
  onStop: onComplete,
62
- duration: 375,
66
+ duration,
63
67
  }),
64
68
  )
65
69
  } else {
@@ -72,7 +76,7 @@ export function useScrollTo() {
72
76
  scroll.scroll.stop()
73
77
  enableSnap()
74
78
  },
75
- [disableSnap, enableSnap, register, scroll, scrollerRef],
79
+ [disableSnap, enableSnap, register, scroll, scrollerRef, duration],
76
80
  )
77
81
 
78
82
  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.21",
5
+ "version": "2.1.24",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "dev": "tsc -W"
@@ -17,12 +17,12 @@
17
17
  "dependencies": {
18
18
  "@graphcommerce/framer-utils": "3.1.4",
19
19
  "@graphcommerce/image": "3.1.7",
20
- "@graphcommerce/next-ui": "4.12.0"
20
+ "@graphcommerce/next-ui": "4.14.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@graphcommerce/eslint-config-pwa": "^4.1.8",
23
+ "@graphcommerce/eslint-config-pwa": "^4.1.9",
24
24
  "@graphcommerce/prettier-config-pwa": "^4.0.6",
25
- "@graphcommerce/typescript-config-pwa": "^4.0.3",
25
+ "@graphcommerce/typescript-config-pwa": "^4.0.4",
26
26
  "@playwright/test": "^1.21.1"
27
27
  },
28
28
  "peerDependencies": {