@graphcommerce/framer-utils 3.0.2 → 3.0.5

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,51 +1,54 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`bec88d0d7`](https://github.com/graphcommerce-org/graphcommerce/commit/bec88d0d70b679e15150917df89986ecee5b39a6) Thanks [@paales](https://github.com/paales)! - ScrollerButton is rendered while it shouldn’t because there is a rounding error in scroll and offset values
8
+
9
+ ## 3.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655) Thanks [@paales](https://github.com/paales)! - All default exports are now named exports internally and all `index.tsx` are renamed to the component name.
14
+
15
+ * [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef) Thanks [@paales](https://github.com/paales)! - upgrade dependencies
16
+
17
+ ## 3.0.3
18
+
19
+ ### Patch Changes
20
+
21
+ - [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96) Thanks [@paales](https://github.com/paales)! - made packages public
22
+
3
23
  ## 3.0.2
4
24
 
5
25
  ### Patch Changes
6
26
 
7
- - [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
8
- [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2)
9
- Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from
10
- `dependencies` to `peerDependencies`. The result of this is that there will be significantly less
11
- duplicate packages in the node_modules folders.
27
+ - [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2) Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from `dependencies` to `peerDependencies`. The result of this is that there will be significantly less duplicate packages in the node_modules folders.
12
28
 
13
- * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
14
- [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)
15
- Thanks [@paales](https://github.com/paales)! - Upgraded to
16
- [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be
17
- implementing
18
- [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
19
- soon.
29
+ * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d) Thanks [@paales](https://github.com/paales)! - Upgraded to [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be implementing [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta) soon.
20
30
 
21
- This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the
22
- frontend to be able to revalidate pages manually.
31
+ This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the frontend to be able to revalidate pages manually.
23
32
 
24
33
  ## 3.0.1
25
34
 
26
35
  ### Patch Changes
27
36
 
28
- - [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)
29
- Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files,
30
- so that the packages link to back to the website and repository
37
+ - [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514) Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files, so that the packages link to back to the website and repository
31
38
 
32
39
  ## 3.0.0
33
40
 
34
41
  ### Major Changes
35
42
 
36
- - [#1258](https://github.com/ho-nl/m2-pwa/pull/1258)
37
- [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05)
38
- Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
43
+ - [#1258](https://github.com/ho-nl/m2-pwa/pull/1258) [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05) Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
39
44
 
40
- All notable changes to this project will be documented in this file. See
41
- [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
45
+ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
42
46
 
43
47
  ## [2.103.6](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-utils@2.103.5...@graphcommerce/framer-utils@2.103.6) (2021-10-09)
44
48
 
45
49
  ### Bug Fixes
46
50
 
47
- - clientSize.x was incorrect
48
- ([39d12c4](https://github.com/ho-nl/m2-pwa/commit/39d12c4b583b7806f943dbd08c31b2dd940cc74b))
51
+ - clientSize.x was incorrect ([39d12c4](https://github.com/ho-nl/m2-pwa/commit/39d12c4b583b7806f943dbd08c31b2dd940cc74b))
49
52
 
50
53
  ## [2.103.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-utils@2.103.0...@graphcommerce/framer-utils@2.103.1) (2021-09-27)
51
54
 
@@ -55,67 +58,48 @@ All notable changes to this project will be documented in this file. See
55
58
 
56
59
  ### Bug Fixes
57
60
 
58
- - bottom sheet is not properly sized when scrolled
59
- ([93a1dc4](https://github.com/ho-nl/m2-pwa/commit/93a1dc40c37de74a8223657add77c51d51a24d92))
60
- - **framer-sheet:** bottom sheet does not resize properly
61
- ([2ae89db](https://github.com/ho-nl/m2-pwa/commit/2ae89dbd651acba10f40ac68956213dd744e2247))
62
- - **framer-utils:** reading of values didn't happen at the right moment, causing unnessary layout
63
- reflows
64
- ([b119262](https://github.com/ho-nl/m2-pwa/commit/b119262ffb2907a215f9f37f12ef6cf6f62fadcd))
65
- - **framer-utils:** state wasn't directly set when initializing useMotionValueValue
66
- ([3560456](https://github.com/ho-nl/m2-pwa/commit/35604562a4a39fef3b5dc4c0305ce0753608d9e8))
67
- - ignore md files from triggering version updates
68
- ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
61
+ - bottom sheet is not properly sized when scrolled ([93a1dc4](https://github.com/ho-nl/m2-pwa/commit/93a1dc40c37de74a8223657add77c51d51a24d92))
62
+ - **framer-sheet:** bottom sheet does not resize properly ([2ae89db](https://github.com/ho-nl/m2-pwa/commit/2ae89dbd651acba10f40ac68956213dd744e2247))
63
+ - **framer-utils:** reading of values didn't happen at the right moment, causing unnessary layout reflows ([b119262](https://github.com/ho-nl/m2-pwa/commit/b119262ffb2907a215f9f37f12ef6cf6f62fadcd))
64
+ - **framer-utils:** state wasn't directly set when initializing useMotionValueValue ([3560456](https://github.com/ho-nl/m2-pwa/commit/35604562a4a39fef3b5dc4c0305ce0753608d9e8))
65
+ - ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
69
66
 
70
67
  ### Features
71
68
 
72
- - **content-header:** text buttons on mobile - pill buttons on desktop
73
- ([1438838](https://github.com/ho-nl/m2-pwa/commit/1438838fbd2aac1e3510368f2a657314ebd05d2d))
74
- - **framer-utils:** created framer-utils and implemented for framer-sheet and framer-next-pages
75
- ([788bf28](https://github.com/ho-nl/m2-pwa/commit/788bf282d4a38ec5e78ab7244065c540dfc132a1))
76
- - **playwright:** added new playwright package to enable browser testing
77
- ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
78
- - renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of
79
- [@reachdigital](https://github.com/reachdigital)
80
- ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
69
+ - **content-header:** text buttons on mobile - pill buttons on desktop ([1438838](https://github.com/ho-nl/m2-pwa/commit/1438838fbd2aac1e3510368f2a657314ebd05d2d))
70
+ - **framer-utils:** created framer-utils and implemented for framer-sheet and framer-next-pages ([788bf28](https://github.com/ho-nl/m2-pwa/commit/788bf282d4a38ec5e78ab7244065c540dfc132a1))
71
+ - **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
72
+ - renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of [@reachdigital](https://github.com/reachdigital) ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
81
73
 
82
74
  # Change Log
83
75
 
84
- All notable changes to this project will be documented in this file. See
85
- [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
76
+ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
86
77
 
87
78
  ## [2.102.5](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-utils@2.102.4...@graphcommerce/framer-utils@2.102.5) (2021-09-01)
88
79
 
89
80
  ### Bug Fixes
90
81
 
91
- - **framer-utils:** reading of values didn't happen at the right moment, causing unnessary layout
92
- reflows
93
- ([b119262](https://github.com/ho-nl/m2-pwa/commit/b119262ffb2907a215f9f37f12ef6cf6f62fadcd))
94
- - **framer-utils:** state wasn't directly set when initializing useMotionValueValue
95
- ([3560456](https://github.com/ho-nl/m2-pwa/commit/35604562a4a39fef3b5dc4c0305ce0753608d9e8))
82
+ - **framer-utils:** reading of values didn't happen at the right moment, causing unnessary layout reflows ([b119262](https://github.com/ho-nl/m2-pwa/commit/b119262ffb2907a215f9f37f12ef6cf6f62fadcd))
83
+ - **framer-utils:** state wasn't directly set when initializing useMotionValueValue ([3560456](https://github.com/ho-nl/m2-pwa/commit/35604562a4a39fef3b5dc4c0305ce0753608d9e8))
96
84
 
97
85
  ## [2.102.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-utils@2.102.1...@graphcommerce/framer-utils@2.102.2) (2021-08-04)
98
86
 
99
87
  ### Bug Fixes
100
88
 
101
- - bottom sheet is not properly sized when scrolled
102
- ([93a1dc4](https://github.com/ho-nl/m2-pwa/commit/93a1dc40c37de74a8223657add77c51d51a24d92))
89
+ - bottom sheet is not properly sized when scrolled ([93a1dc4](https://github.com/ho-nl/m2-pwa/commit/93a1dc40c37de74a8223657add77c51d51a24d92))
103
90
 
104
91
  # [2.102.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-utils@2.101.1...@graphcommerce/framer-utils@2.102.0) (2021-07-26)
105
92
 
106
93
  ### Features
107
94
 
108
- - **playwright:** added new playwright package to enable browser testing
109
- ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
95
+ - **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
110
96
 
111
97
  # [2.101.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-utils@2.100.10...@graphcommerce/framer-utils@2.101.0) (2021-07-20)
112
98
 
113
99
  ### Bug Fixes
114
100
 
115
- - ignore md files from triggering version updates
116
- ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
101
+ - ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
117
102
 
118
103
  ### Features
119
104
 
120
- - **content-header:** text buttons on mobile - pill buttons on desktop
121
- ([1438838](https://github.com/ho-nl/m2-pwa/commit/1438838fbd2aac1e3510368f2a657314ebd05d2d))
105
+ - **content-header:** text buttons on mobile - pill buttons on desktop ([1438838](https://github.com/ho-nl/m2-pwa/commit/1438838fbd2aac1e3510368f2a657314ebd05d2d))
@@ -30,23 +30,22 @@ export function useElementScroll(
30
30
  const element = ref?.current
31
31
  if (!element) return () => {}
32
32
 
33
- const setProgress = (offset: number, maxOffset: number, value: MotionValue) => {
34
- value.set(!offset && !maxOffset ? noScroll : offset / maxOffset)
35
- }
36
-
37
33
  const updater = () => {
38
34
  sync.read(() => {
39
35
  const { scrollLeft, scrollTop, scrollWidth, scrollHeight, offsetWidth, offsetHeight } =
40
36
  element
41
37
 
38
+ const xMax = Math.max(0, scrollWidth - offsetWidth)
39
+ const yMax = Math.max(0, scrollHeight - offsetHeight)
40
+
42
41
  values.x.set(scrollLeft)
43
42
  values.y.set(scrollTop)
44
- values.xMax.set(scrollWidth - offsetWidth)
45
- values.yMax.set(scrollHeight - offsetHeight)
43
+ values.xMax.set(xMax)
44
+ values.yMax.set(yMax)
46
45
 
47
46
  // Set 0-1 progress
48
- setProgress(scrollLeft, scrollWidth - offsetWidth, values.xProgress)
49
- setProgress(scrollTop, scrollHeight - offsetHeight, values.yProgress)
47
+ values.xProgress.set(!scrollLeft && !xMax ? noScroll : scrollLeft / xMax)
48
+ values.yProgress.set(!scrollTop && !yMax ? noScroll : scrollTop / yMax)
50
49
  })
51
50
  }
52
51
 
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": "3.0.2",
5
+ "version": "3.0.5",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "dev": "tsc -W"
@@ -15,10 +15,10 @@
15
15
  }
16
16
  },
17
17
  "devDependencies": {
18
- "@graphcommerce/eslint-config-pwa": "^4.0.2",
19
- "@graphcommerce/prettier-config-pwa": "^4.0.1",
20
- "@graphcommerce/typescript-config-pwa": "^4.0.1",
21
- "@playwright/test": "^1.19.1"
18
+ "@graphcommerce/eslint-config-pwa": "^4.0.5",
19
+ "@graphcommerce/prettier-config-pwa": "^4.0.3",
20
+ "@graphcommerce/typescript-config-pwa": "^4.0.2",
21
+ "@playwright/test": "^1.19.2"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "framer-motion": "^6.2.4",