@graphcommerce/framer-scroller 2.1.39 → 2.1.40
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 +9 -0
- package/hooks/useVelocitySnapTo.ts +11 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 2.1.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1662](https://github.com/graphcommerce-org/graphcommerce/pull/1662) [`f5eae0afd`](https://github.com/graphcommerce-org/graphcommerce/commit/f5eae0afdbd474b1f81c450425ffadf2d025187a) Thanks [@paales](https://github.com/paales)! - Move to useMatchMedia to have a simple boolean utility that allows to match to a certain breakpoint
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`0c21c5c23`](https://github.com/graphcommerce-org/graphcommerce/commit/0c21c5c233ebab15f6629c234e3de1cc8c0452e1), [`de8925aa9`](https://github.com/graphcommerce-org/graphcommerce/commit/de8925aa910b191c62041530c68c697a58a1e52d), [`f5eae0afd`](https://github.com/graphcommerce-org/graphcommerce/commit/f5eae0afdbd474b1f81c450425ffadf2d025187a)]:
|
|
10
|
+
- @graphcommerce/next-ui@4.28.0
|
|
11
|
+
|
|
3
12
|
## 2.1.39
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMatchMedia } from '@graphcommerce/next-ui'
|
|
2
|
+
import { useTheme } from '@mui/material'
|
|
2
3
|
import { PanInfo } from 'framer-motion'
|
|
3
4
|
import { inertia, InertiaOptions } from 'popmotion'
|
|
4
5
|
import { scrollSnapTypeDirection } from '../utils/scrollSnapTypeDirection'
|
|
@@ -21,9 +22,13 @@ export const useVelocitySnapTo = (
|
|
|
21
22
|
) => {
|
|
22
23
|
const { disableSnap, enableSnap, register, getScrollSnapPositions, scrollSnap } =
|
|
23
24
|
useScrollerContext()
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
const matchMedia = useMatchMedia()
|
|
27
|
+
|
|
28
|
+
const direction = () =>
|
|
29
|
+
matchMedia.down('md')
|
|
30
|
+
? scrollSnapTypeDirection(scrollSnap.scrollSnapTypeSm)
|
|
31
|
+
: scrollSnapTypeDirection(scrollSnap.scrollSnapTypeMd)
|
|
27
32
|
|
|
28
33
|
const inertiaOptions: InertiaOptions = {
|
|
29
34
|
power: 1,
|
|
@@ -43,7 +48,7 @@ export const useVelocitySnapTo = (
|
|
|
43
48
|
const xDone = new Promise<void>((onComplete) => {
|
|
44
49
|
const targetX = clamp(info, 'x') * -1 + scrollLeft
|
|
45
50
|
const closestX =
|
|
46
|
-
direction !== 'block' ? closest(getScrollSnapPositions().x, targetX) : undefined
|
|
51
|
+
direction() !== 'block' ? closest(getScrollSnapPositions().x, targetX) : undefined
|
|
47
52
|
|
|
48
53
|
if ((closestX ?? 0) !== scrollLeft) {
|
|
49
54
|
disableSnap()
|
|
@@ -67,7 +72,7 @@ export const useVelocitySnapTo = (
|
|
|
67
72
|
const yDone = new Promise<void>((onComplete) => {
|
|
68
73
|
const targetY = clamp(info, 'y') * -1 + scrollTop
|
|
69
74
|
const closestY =
|
|
70
|
-
direction !== 'inline' ? closest(getScrollSnapPositions().y, targetY) : undefined
|
|
75
|
+
direction() !== 'inline' ? closest(getScrollSnapPositions().y, targetY) : undefined
|
|
71
76
|
|
|
72
77
|
if ((closestY ?? 0) !== scrollTop) {
|
|
73
78
|
disableSnap()
|
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.40",
|
|
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.2.0",
|
|
19
19
|
"@graphcommerce/image": "3.1.9",
|
|
20
|
-
"@graphcommerce/next-ui": "4.
|
|
20
|
+
"@graphcommerce/next-ui": "4.28.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@graphcommerce/eslint-config-pwa": "^4.1.10",
|