@ethlete/cdk 4.36.0 → 4.37.0

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.
@@ -1,15 +1,42 @@
1
+ /**
2
+ * A source to be used in a picture element.
3
+ * @see https://www.mediaevent.de/html/picture.html
4
+ * @see https://web.dev/learn/design/responsive-images
5
+ */
1
6
  export interface PictureSource {
2
7
  /**
3
8
  * The mime type of the image.
9
+ * If not provided, it will be inferred from the URL.
10
+ * If it cannot be inferred, it will be `null` and a error will be logged to the console without throwing.
4
11
  * @example `image/jpeg`
5
12
  */
6
- type: string | null;
13
+ type?: string | null;
7
14
  /**
8
15
  * The source set of the image. Can be either a single URL or a comma-separated list of URLs.
16
+ * If a width descriptor is provided (eg. 200w), you must also set the `sizes` property.
17
+ * If a density descriptor is provided (eg. 2x), the browser will automatically select the correct image based on the device's pixel density.
18
+ *
19
+ * **Note**: You can provide either a width descriptor or a density descriptor, but not both.
9
20
  * @example `https://example.com/image.jpg`
10
- * @example `https://example.com/image.jpg, https://example.com/image@2x.jpg`
21
+ * @example `https://example.com/image.jpg 1x, https://example.com/image@2x.jpg 2x`
22
+ * @example `https://example.com/image.jpg 300w, https://example.com/image600.jpg 600w`
11
23
  */
12
24
  srcset: string;
25
+ /**
26
+ * The sizes attribute of the image.
27
+ *
28
+ * **Note**: Only required if the `srcset` property contains width descriptors.
29
+ * @example `100vw` // The image will take up the full width of the viewport
30
+ * @example `(min-width: 800px) 50vw, 100vw` // The image will take up 50% of the viewport width if the viewport is at least 800px wide, otherwise it will take up the full width
31
+ */
32
+ sizes?: string | null;
33
+ /**
34
+ * The media query to which the source applies.
35
+ * If the media query applies, the source will be used.
36
+ * @example `(min-width: 800px)` // Only applies if the viewport is at least 800px wide
37
+ * @example `(min-width: 800px) and (orientation: landscape) and (prefers-color-scheme: dark)` // Only applies if the viewport is at least 800px wide, is in landscape orientation and prefers dark colors
38
+ */
39
+ media?: string | null;
13
40
  }
14
41
  export interface PictureConfig {
15
42
  baseUrl?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/cdk",
3
- "version": "4.36.0",
3
+ "version": "4.37.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "css": "./src/lib/styles/index.css",