etudes 17.0.0 → 18.0.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,9 +1,9 @@
1
1
  import { HTMLAttributes } from 'react';
2
- import { ImageProps } from './Image.js';
2
+ import { PictureProps } from './Picture.js';
3
3
  /**
4
4
  * Type describing the props of {@link CoverImage}.
5
5
  */
6
- export type CoverImageProps = Omit<HTMLAttributes<HTMLDivElement>, 'onLoadStart'> & Pick<ImageProps, 'alt' | 'loadingMode' | 'sizes' | 'src' | 'srcSet' | 'onLoadStart' | 'onLoadComplete' | 'onLoadError'> & {
6
+ export type CoverImageProps = Omit<HTMLAttributes<HTMLDivElement>, 'onLoadStart'> & Pick<PictureProps, 'alt' | 'loadingMode' | 'sources' | 'src' | 'onLoadStart' | 'onLoadComplete' | 'onLoadError'> & {
7
7
  /**
8
8
  * The known aspect ratio of the image, expressed by width / height. If
9
9
  * unprovided, it will be inferred after loading the image.
@@ -1,5 +1,6 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
  import { Size } from 'spase';
3
+ import { ImageSource } from '../types/ImageSource.js';
3
4
  /**
4
5
  * Type describing the props of {@link Image}.
5
6
  */
@@ -11,46 +12,12 @@ export type ImageProps = Omit<HTMLAttributes<HTMLImageElement>, 'alt' | 'loading
11
12
  /**
12
13
  * Loading mode for the image.
13
14
  */
14
- loadingMode?: 'none' | 'lazy' | 'preload';
15
+ loadingMode?: 'eager' | 'lazy';
15
16
  /**
16
- * Descriptor for the `srcset` attribute of the `<img>` element. If `sizes` is
17
- * also provided, then each entry in this list must have a `width` value and
18
- * no `pixelDensity` value.
17
+ * Optional image source. If provided, this will be used to set the `sizes`
18
+ * and `srcset` attributes of the `<img>` element.
19
19
  */
20
- srcSet?: {
21
- /**
22
- * A URL specifying an image location.
23
- */
24
- src: string;
25
- /**
26
- * Optional intrinsic width (in pixels) of the image expressed as a positive
27
- * integer. If set, leave `pixelDensity` unspecified (only one of `width` or
28
- * `pixelDensity` can be specified).
29
- */
30
- width?: number;
31
- /**
32
- * Optional pixel density of the image expressed as a positive floating
33
- * number. If set, leave `width` unspecified (only one of `width` or
34
- * `pixelDensity` can be specified.
35
- */
36
- pixelDensity?: number;
37
- }[];
38
- /**
39
- * Descriptor for the `sizes` attribute of the `<img>` element.
40
- */
41
- sizes?: {
42
- /**
43
- * Optional media query condition (without brackets, i.e. `max-width:
44
- * 100px`). Note that this must be omitted for the last item in this list of
45
- * sizes.
46
- */
47
- mediaCondition?: string;
48
- /**
49
- * A CSS size value indicating the size of the image's slot on the page,
50
- * i.e. `100px`, `100vw`, `50%`, etc.
51
- */
52
- width: string;
53
- }[];
20
+ source?: Omit<ImageSource, 'media' | 'type'>;
54
21
  /**
55
22
  * Fallback image URL for browsers that do not support the `srcset` attribute.
56
23
  */
@@ -0,0 +1,12 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { ImageSource } from '../types/ImageSource.js';
3
+ import { ImageProps } from './Image.js';
4
+ /**
5
+ * Type describing the props of {@link Picture}.
6
+ */
7
+ export type PictureProps = HTMLAttributes<HTMLPictureElement> & Pick<ImageProps, 'alt' | 'loadingMode' | 'src' | 'onLoadStart' | 'onLoadComplete' | 'onLoadError' | 'onSizeChange'> & {
8
+ sources?: ImageSource[];
9
+ };
10
+ export declare const Picture: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLPictureElement> & Pick<ImageProps, "onLoadStart" | "alt" | "src" | "onLoadComplete" | "onLoadError" | "loadingMode" | "onSizeChange"> & {
11
+ sources?: ImageSource[];
12
+ } & import('react').RefAttributes<HTMLPictureElement>>;