@graphcommerce/image 3.1.4 → 3.1.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 +9 -0
- package/components/Image.tsx +6 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`da0ae7d02`](https://github.com/graphcommerce-org/graphcommerce/commit/da0ae7d0236e4908ba0bf0fa16656be516e841d4) Thanks [@paales](https://github.com/paales)! - Updated dependencies
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`da0ae7d02`](https://github.com/graphcommerce-org/graphcommerce/commit/da0ae7d0236e4908ba0bf0fa16656be516e841d4)]:
|
|
10
|
+
- @graphcommerce/framer-utils@3.1.2
|
|
11
|
+
|
|
3
12
|
## 3.1.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/components/Image.tsx
CHANGED
|
@@ -32,6 +32,8 @@ if (typeof window === 'undefined') {
|
|
|
32
32
|
|
|
33
33
|
export type { ImageLoaderProps, ImageLoader }
|
|
34
34
|
|
|
35
|
+
type ImageConfig = ImageConfigComplete & { allSizes: number[] }
|
|
36
|
+
|
|
35
37
|
const DEFAULT_SIZES: SizesRecord = { 0: '100vw', 1200: '50vw' }
|
|
36
38
|
|
|
37
39
|
const VALID_LOADING_VALUES = ['lazy', 'eager', undefined] as const
|
|
@@ -84,7 +86,7 @@ export function srcToString(src: StaticImport | string) {
|
|
|
84
86
|
// allSizes.sort((a, b) => a - b)
|
|
85
87
|
|
|
86
88
|
function getWidths(
|
|
87
|
-
config:
|
|
89
|
+
config: ImageConfig,
|
|
88
90
|
width: number | undefined,
|
|
89
91
|
layout: LayoutValue,
|
|
90
92
|
sizes = '',
|
|
@@ -138,7 +140,7 @@ type GenImgAttrsData = {
|
|
|
138
140
|
quality?: number
|
|
139
141
|
sizes: string
|
|
140
142
|
scale: number
|
|
141
|
-
config:
|
|
143
|
+
config: ImageConfig
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
function generateSrcSet(props: GenImgAttrsData): string {
|
|
@@ -148,7 +150,7 @@ function generateSrcSet(props: GenImgAttrsData): string {
|
|
|
148
150
|
return widths
|
|
149
151
|
.map(
|
|
150
152
|
(w, i) =>
|
|
151
|
-
`${loader({ src, quality, width: w
|
|
153
|
+
`${loader({ src, quality, width: w })} ${
|
|
152
154
|
kind === 'w' ? Math.round(w * scale) : i + 1
|
|
153
155
|
}${kind}`,
|
|
154
156
|
)
|
|
@@ -266,7 +268,7 @@ const Image = React.forwardRef<HTMLImageElement, ImageProps>(
|
|
|
266
268
|
const combinedRef = useForkRef(ref, forwardedRef)
|
|
267
269
|
|
|
268
270
|
const configContext = useContext(ImageConfigContext)
|
|
269
|
-
const config:
|
|
271
|
+
const config: ImageConfig = useMemo(() => {
|
|
270
272
|
const c = configEnv || configContext || imageConfigDefault
|
|
271
273
|
const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b)
|
|
272
274
|
const deviceSizes = c.deviceSizes.sort((a, b) => a - b)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/image",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.1.
|
|
5
|
+
"version": "3.1.5",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "tsc -W"
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@graphcommerce/framer-utils": "3.1.
|
|
18
|
+
"@graphcommerce/framer-utils": "3.1.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
22
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.
|
|
21
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.5",
|
|
22
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
23
23
|
"@graphcommerce/typescript-config-pwa": "^4.0.2",
|
|
24
|
-
"@playwright/test": "^1.
|
|
25
|
-
"type-fest": "2.12.
|
|
24
|
+
"@playwright/test": "^1.21.1",
|
|
25
|
+
"type-fest": "^2.12.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@mui/material": "5.5.3",
|