@graphcommerce/framer-scroller 1.1.24 → 1.2.2

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
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.2.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@1.1.25...@graphcommerce/framer-scroller@1.2.0) (2022-01-03)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * make sure the useVelocitySnapTo resolves completely ([9d13fcb](https://github.com/ho-nl/m2-pwa/commit/9d13fcbf63ef8c0a964b9bd81accb6259a693c5c))
12
+
13
+
14
+ ### Features
15
+
16
+ * **framer-next-pages:** reduce rerenders when navigating to a new page ([5cf3301](https://github.com/ho-nl/m2-pwa/commit/5cf330130bb3527057da015e3c4a6fa295d7262e))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.1.24](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@1.1.23...@graphcommerce/framer-scroller@1.1.24) (2021-12-23)
7
23
 
8
24
 
@@ -72,4 +72,6 @@ const MotionImageAspect = m(
72
72
  }),
73
73
  )
74
74
 
75
+ MotionImageAspect.displayName = 'MotionImageAspect'
76
+
75
77
  export default MotionImageAspect
@@ -1,3 +1,4 @@
1
+ import { useConstant } from '@graphcommerce/framer-utils'
1
2
  import { MotionValue, motionValue, Point, useMotionValue } from 'framer-motion'
2
3
  import { PlaybackControls } from 'popmotion'
3
4
  import React, { useEffect, useRef, useMemo, useCallback } from 'react'
@@ -312,7 +313,7 @@ export default function ScrollerProvider(props: ScrollerProviderProps) {
312
313
  return { x: 0, y: 0, [axis]: position }
313
314
  }
314
315
 
315
- const value: ScrollerContext = {
316
+ const value = useConstant<ScrollerContext>(() => ({
316
317
  scrollerRef,
317
318
  scrollSnap,
318
319
  stop,
@@ -324,7 +325,7 @@ export default function ScrollerProvider(props: ScrollerProviderProps) {
324
325
  getSnapPosition,
325
326
  getScrollSnapPositions,
326
327
  registerChildren,
327
- }
328
+ }))
328
329
 
329
330
  return <scrollerContext.Provider value={value} {...providerProps} />
330
331
  }
@@ -45,7 +45,7 @@ export const useVelocitySnapTo = (
45
45
  const closestX =
46
46
  direction !== 'block' ? closest(getScrollSnapPositions().x, targetX) : undefined
47
47
 
48
- if (closestX !== scrollLeft) {
48
+ if ((closestX ?? 0) !== scrollLeft) {
49
49
  disableSnap()
50
50
  register(
51
51
  inertia({
@@ -69,7 +69,7 @@ export const useVelocitySnapTo = (
69
69
  const closestY =
70
70
  direction !== 'inline' ? closest(getScrollSnapPositions().y, targetY) : undefined
71
71
 
72
- if (closestY !== scrollTop) {
72
+ if ((closestY ?? 0) !== scrollTop) {
73
73
  disableSnap()
74
74
  register(
75
75
  inertia({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/framer-scroller",
3
- "version": "1.1.24",
3
+ "version": "1.2.2",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "dev": "tsc -W"
@@ -16,15 +16,15 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@graphcommerce/framer-utils": "^2.103.20",
20
- "@graphcommerce/image": "^2.105.11",
21
- "@graphcommerce/next-ui": "^3.21.14",
19
+ "@graphcommerce/framer-utils": "^2.103.21",
20
+ "@graphcommerce/image": "^2.105.13",
21
+ "@graphcommerce/next-ui": "^3.22.2",
22
22
  "@material-ui/core": "^4.12.3",
23
23
  "popmotion": "11.0.3"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@graphcommerce/browserslist-config-pwa": "^3.0.3",
27
- "@graphcommerce/eslint-config-pwa": "^3.1.9",
27
+ "@graphcommerce/eslint-config-pwa": "^3.1.10",
28
28
  "@graphcommerce/prettier-config-pwa": "^3.0.5",
29
29
  "@graphcommerce/typescript-config-pwa": "^3.1.2",
30
30
  "@playwright/test": "^1.17.1"
@@ -36,5 +36,5 @@
36
36
  "react-dom": "^17.0.2",
37
37
  "type-fest": "^2.8.0"
38
38
  },
39
- "gitHead": "ce4499b06791f3b2e54a7e88bfca40abbcd1401c"
39
+ "gitHead": "0553535bc06348d46a64c90e5330f8ff108c0cbc"
40
40
  }