@platecms/delta-types 1.12.0 → 1.13.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": "@platecms/delta-types",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "This package contains various utility types.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -17,8 +17,8 @@
17
17
  "src/**/*"
18
18
  ],
19
19
  "peerDependencies": {
20
- "@platecms/delta-cast": "1.12.0",
21
- "@platecms/delta-plate-resource-notation": "1.12.0",
20
+ "@platecms/delta-cast": "1.13.0",
21
+ "@platecms/delta-plate-resource-notation": "1.13.0",
22
22
  "class-transformer": "0.5.1",
23
23
  "reflect-metadata": "0.2.2",
24
24
  "tslib": "2.8.1"
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./lib/primitive.type";
5
5
  export * from "./lib/stage.enum";
6
6
  export * from "./lib/header-keys.enum";
7
7
  export * from "./lib/action-type.enum";
8
+ export * from "./lib/processed-asset-options.interface";
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Options for generating a processed (e.g. resized, reformatted) version of an asset URL.
3
+ */
4
+ export interface ProcessedAssetOptions {
5
+ readonly width?: number | null;
6
+ readonly height?: number | null;
7
+ readonly quality?: number | null;
8
+ readonly resizingType?: string | null;
9
+ readonly format?: string | null;
10
+ readonly dpr?: number | null;
11
+ }
12
+
13
+ // Default presets.
14
+ const PRESET_2XL_WEBP: ProcessedAssetOptions = { width: 3840, height: 2160, format: "webp" };
15
+ const PRESET_XL_WEBP: ProcessedAssetOptions = { width: 2560, height: 1400, format: "webp" };
16
+ const PRESET_LG_WEBP: ProcessedAssetOptions = { width: 1920, height: 1080, format: "webp" };
17
+ const PRESET_MD_WEBP: ProcessedAssetOptions = { width: 1280, height: 720, format: "webp" };
18
+ const PRESET_SM_WEBP: ProcessedAssetOptions = { width: 800, height: 450, format: "webp" };
19
+ const PRESET_XS_WEBP: ProcessedAssetOptions = { width: 400, height: 150, format: "webp" };
20
+ const PRESET_2XS_WEBP: ProcessedAssetOptions = { width: 200, height: 150, format: "webp" };
21
+
22
+ const PRESET_ICON_WEBP: ProcessedAssetOptions = { width: 32, height: 32, format: "webp" };
23
+ const PRESET_THUMBNAIL_WEBP: ProcessedAssetOptions = { width: 300, height: 300, format: "webp" };
24
+
25
+ const PRESET_2XL: ProcessedAssetOptions = { width: 3840, height: 2160 };
26
+ const PRESET_XL: ProcessedAssetOptions = { width: 2560, height: 1400 };
27
+ const PRESET_LG: ProcessedAssetOptions = { width: 1920, height: 1080 };
28
+ const PRESET_MD: ProcessedAssetOptions = { width: 1280, height: 720 };
29
+ const PRESET_SM: ProcessedAssetOptions = { width: 800, height: 450 };
30
+ const PRESET_XS: ProcessedAssetOptions = { width: 400, height: 150 };
31
+ const PRESET_2XS: ProcessedAssetOptions = { width: 200, height: 150 };
32
+
33
+ const PRESET_ICON: ProcessedAssetOptions = { width: 32, height: 32 };
34
+ const PRESET_THUMBNAIL: ProcessedAssetOptions = { width: 300, height: 300 };
35
+
36
+ /**
37
+ * Default image sizes preset for exposing assets.
38
+ * Order matters. Do not reorder, only append.
39
+ */
40
+ export const DEFAULT_IMAGE_SIZES_PRESET: readonly ProcessedAssetOptions[] = [
41
+ PRESET_2XL_WEBP,
42
+ PRESET_XL_WEBP,
43
+ PRESET_LG_WEBP,
44
+ PRESET_MD_WEBP,
45
+ PRESET_SM_WEBP,
46
+ PRESET_XS_WEBP,
47
+ PRESET_2XS_WEBP,
48
+ PRESET_ICON_WEBP,
49
+ PRESET_THUMBNAIL_WEBP,
50
+
51
+ PRESET_2XL,
52
+ PRESET_XL,
53
+ PRESET_LG,
54
+ PRESET_MD,
55
+ PRESET_SM,
56
+ PRESET_XS,
57
+ PRESET_2XS,
58
+ PRESET_ICON,
59
+ PRESET_THUMBNAIL,
60
+ ];