@sveltia/cms 0.67.0 → 0.68.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/cms",
3
- "version": "0.67.0",
3
+ "version": "0.68.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  "provenance": true
14
14
  },
15
15
  "devDependencies": {
16
- "@types/react": "^19.0.12"
16
+ "@types/react": "^19.1.0"
17
17
  },
18
18
  "files": [
19
19
  "dist",
package/types/public.d.ts CHANGED
@@ -13,6 +13,49 @@ export type FieldKeyPath = string;
13
13
  * Supported media library name.
14
14
  */
15
15
  export type MediaLibraryName = "default" | "cloudinary" | "uploadcare";
16
+ /**
17
+ * Supported raster image format.
18
+ */
19
+ export type RasterImageFormat = "avif" | "bmp" | "gif" | "jpeg" | "png" | "webp";
20
+ /**
21
+ * Supported raster image conversion format. We don’t support AVIF at this time because no browser
22
+ * supports AVIF encoding natively and `@jsquash/avif` is slow. Meanwhile, browsers other than
23
+ * Safari support WebP encoding and `@jsquash/webp` is relatively fast.
24
+ */
25
+ export type RasterImageConversionFormat = "webp";
26
+ /**
27
+ * Raster image transformation options.
28
+ */
29
+ export type RasterImageTransformationOptions = {
30
+ /**
31
+ * New format. Default: `webp`.
32
+ */
33
+ format?: RasterImageConversionFormat;
34
+ /**
35
+ * Image quality between 0 and 100. Default: 85.
36
+ */
37
+ quality?: number;
38
+ /**
39
+ * Max width. Default: original width.
40
+ */
41
+ width?: number;
42
+ /**
43
+ * Max height. Default: original height.
44
+ */
45
+ height?: number;
46
+ };
47
+ /**
48
+ * Raster image transformation option map.
49
+ */
50
+ export type RasterImageTransformations = Record<RasterImageFormat | "raster_image", RasterImageTransformationOptions>;
51
+ /**
52
+ * Image transformation option map.
53
+ */
54
+ export type ImageTransformations = RasterImageTransformations;
55
+ /**
56
+ * File transformation option map.
57
+ */
58
+ export type FileTransformations = ImageTransformations;
16
59
  /**
17
60
  * Configuration for the default media library.
18
61
  */
@@ -21,6 +64,12 @@ export type DefaultMediaLibraryOptions = {
21
64
  * Maximum file size in bytes that can be accepted for uploading.
22
65
  */
23
66
  max_file_size?: number;
67
+ /**
68
+ * File transformation option map. The key is an
69
+ * original format like `png` or `jpeg`. It can also be `raster_image` that matches any supported
70
+ * raster image format.
71
+ */
72
+ transformations?: FileTransformations;
24
73
  };
25
74
  /**
26
75
  * Options for the default media library.