@graphcommerce/framer-utils 6.0.0-canary.39 → 6.0.0-canary.41
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
|
@@ -75,13 +75,13 @@ export function useClientSize(options?: UseClientSizeOptions): UseClientSizeRetu
|
|
|
75
75
|
|
|
76
76
|
useEffect(() => {
|
|
77
77
|
setTimeout(() => ret.x.set(`${clientSize.x.get()}px`), 1000)
|
|
78
|
-
const cX = clientSize.x.
|
|
78
|
+
const cX = clientSize.x.on('change', (xv) => ret.x.set(`${xv}px`))
|
|
79
79
|
return () => cX()
|
|
80
80
|
}, [ret.x])
|
|
81
81
|
|
|
82
82
|
useEffect(() => {
|
|
83
83
|
setTimeout(() => ret.y.set(`${clientSize.y.get()}px`), 1000)
|
|
84
|
-
const cY = clientSize.y.
|
|
84
|
+
const cY = clientSize.y.on('change', (yv) => ret.y.set(`${yv}px`))
|
|
85
85
|
return () => cY()
|
|
86
86
|
}, [ret.y])
|
|
87
87
|
|
|
@@ -18,7 +18,7 @@ export function useMotionSelector<T extends [...any[]], R>(
|
|
|
18
18
|
const set = () => startTransition(() => setResult(calcEffect))
|
|
19
19
|
setResult(calcEffect)
|
|
20
20
|
|
|
21
|
-
const unsubscribers = motionValues.map((motionValue) => motionValue.
|
|
21
|
+
const unsubscribers = motionValues.map((motionValue) => motionValue.on('change', set))
|
|
22
22
|
return () => unsubscribers.forEach((unsubscribe) => unsubscribe())
|
|
23
23
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
24
|
}, [motionValues])
|
|
@@ -3,16 +3,13 @@ import { startTransition, useState } from 'react'
|
|
|
3
3
|
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'
|
|
4
4
|
|
|
5
5
|
/** Get the MotionValue's value and return the value as a state update. */
|
|
6
|
-
export function useMotionValueValue<T, R>(
|
|
7
|
-
motionValue: Pick<MotionValue<T>, 'onChange' | 'get'>,
|
|
8
|
-
effect: (v: T) => R,
|
|
9
|
-
) {
|
|
6
|
+
export function useMotionValueValue<T, R>(motionValue: MotionValue<T>, effect: (v: T) => R) {
|
|
10
7
|
const [result, setResult] = useState<R>(effect(motionValue.get()))
|
|
11
8
|
|
|
12
9
|
useIsomorphicLayoutEffect(() => {
|
|
13
10
|
const set = (v: T) => startTransition(() => setResult(effect(v)))
|
|
14
11
|
setResult(effect(motionValue.get()))
|
|
15
|
-
return motionValue.
|
|
12
|
+
return motionValue.on('change', set)
|
|
16
13
|
// we're not recalculating
|
|
17
14
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
15
|
}, [motionValue])
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/framer-utils",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "6.0.0-canary.
|
|
5
|
+
"version": "6.0.0-canary.41",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "tsc -W"
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "6.0.0-canary.
|
|
19
|
-
"@graphcommerce/prettier-config-pwa": "6.0.0-canary.
|
|
20
|
-
"@graphcommerce/typescript-config-pwa": "6.0.0-canary.
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "6.0.0-canary.41",
|
|
19
|
+
"@graphcommerce/prettier-config-pwa": "6.0.0-canary.41",
|
|
20
|
+
"@graphcommerce/typescript-config-pwa": "6.0.0-canary.41"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"framer-motion": "^10.0.0",
|