@graphcommerce/image 3.1.2 → 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 CHANGED
@@ -1,5 +1,26 @@
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
+
12
+ ## 3.1.4
13
+
14
+ ### Patch Changes
15
+
16
+ - [#1387](https://github.com/graphcommerce-org/graphcommerce/pull/1387) [`0e425e85e`](https://github.com/graphcommerce-org/graphcommerce/commit/0e425e85ee8fed280349317ee0440c7bceea5823) Thanks [@NickdeK](https://github.com/NickdeK)! - Export Sizes type to be used for passing Sizes prop
17
+
18
+ ## 3.1.3
19
+
20
+ ### Patch Changes
21
+
22
+ - [#1378](https://github.com/graphcommerce-org/graphcommerce/pull/1378) [`b610a6e40`](https://github.com/graphcommerce-org/graphcommerce/commit/b610a6e4049e8c9e8b5d2aeff31b8e1bfc24abe5) Thanks [@paales](https://github.com/paales)! - Pin all versions internally so we can’t end up in an unfixable state for the user
23
+
3
24
  ## 3.1.2
4
25
 
5
26
  ### Patch Changes
@@ -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: ImageLoaderProps['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: ImageLoaderProps['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, config })} ${
153
+ `${loader({ src, quality, width: w })} ${
152
154
  kind === 'w' ? Math.round(w * scale) : i + 1
153
155
  }${kind}`,
154
156
  )
@@ -176,7 +178,7 @@ type SizesString =
176
178
  | `max(${string})`
177
179
  | `clamp(${string})`
178
180
  type SizesRecord = Record<number, SizesString>
179
- type Sizes = SizesString | SizesRecord | undefined
181
+ export type Sizes = SizesString | SizesRecord | undefined
180
182
 
181
183
  function isSizesRecord(sizes?: Sizes): sizes is SizesRecord {
182
184
  return typeof sizes === 'object'
@@ -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: ImageLoaderProps['config'] = useMemo(() => {
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.2",
5
+ "version": "3.1.5",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "dev": "tsc -W"
@@ -15,18 +15,18 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "@graphcommerce/framer-utils": "^3.1.1"
18
+ "@graphcommerce/framer-utils": "3.1.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@graphcommerce/eslint-config-pwa": "^4.1.3",
22
- "@graphcommerce/prettier-config-pwa": "^4.0.5",
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.20.1",
25
- "type-fest": "2.12.1"
24
+ "@playwright/test": "^1.21.1",
25
+ "type-fest": "^2.12.2"
26
26
  },
27
27
  "peerDependencies": {
28
- "@mui/material": "^5.5.0",
29
- "next": "^12.1.0",
28
+ "@mui/material": "5.5.3",
29
+ "next": "12.1.2",
30
30
  "react": "^17.0.2",
31
31
  "react-dom": "^17.0.2"
32
32
  }