@uniformdev/assets 20.7.1-alpha.23 → 20.7.1-alpha.28
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/dist/index.d.mts +52 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.esm.js +73 -1
- package/dist/index.js +75 -2
- package/dist/index.mjs +73 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -219,6 +219,27 @@ interface components$1 {
|
|
|
219
219
|
* @description ID of the workflow that instances of this content type will use by default. When not set, no workflow is attached
|
|
220
220
|
*/
|
|
221
221
|
workflowId?: string;
|
|
222
|
+
/** @description Configurations for previewing an entry on a consuming pattern or composition. */
|
|
223
|
+
previewConfigurations?: components$1["schemas"]["ContentTypePreviewConfiguration"][];
|
|
224
|
+
};
|
|
225
|
+
/** @description Defines a configuration for previewing an entry on a consuming pattern or composition. */
|
|
226
|
+
ContentTypePreviewConfiguration: {
|
|
227
|
+
/**
|
|
228
|
+
* @description The type of preview configuration
|
|
229
|
+
* @enum {string}
|
|
230
|
+
*/
|
|
231
|
+
type: "pattern" | "project-map";
|
|
232
|
+
/** @description Display label for the preview configuration */
|
|
233
|
+
label: string;
|
|
234
|
+
/**
|
|
235
|
+
* Format: uuid
|
|
236
|
+
* @description Target preview entity ID (project map node ID or pattern ID)
|
|
237
|
+
*/
|
|
238
|
+
id: string;
|
|
239
|
+
/** @description Optional mapping of dynamic input names to their values */
|
|
240
|
+
dynamicInputs?: {
|
|
241
|
+
[key: string]: string;
|
|
242
|
+
};
|
|
222
243
|
};
|
|
223
244
|
/** @description Defines an editable parameter on a component */
|
|
224
245
|
ComponentParameter: {
|
|
@@ -1581,6 +1602,9 @@ type AssetDefinition = {
|
|
|
1581
1602
|
};
|
|
1582
1603
|
declare const assetDefinitions: Record<AssetDefinitionType, AssetDefinition>;
|
|
1583
1604
|
|
|
1605
|
+
/**
|
|
1606
|
+
* A union type of possible query parameters for the image delivery API.
|
|
1607
|
+
*/
|
|
1584
1608
|
type ImageDeliveryParams = XOR<{
|
|
1585
1609
|
format: 'original';
|
|
1586
1610
|
}, {
|
|
@@ -1594,6 +1618,7 @@ type ImageDeliveryParams = XOR<{
|
|
|
1594
1618
|
* "cover" additionally supports specifying a focal point via the "focal" parameter
|
|
1595
1619
|
*/
|
|
1596
1620
|
fit?: 'scale-down' | 'contain' | 'cover';
|
|
1621
|
+
focal?: undefined;
|
|
1597
1622
|
}, {
|
|
1598
1623
|
width?: number;
|
|
1599
1624
|
height?: number;
|
|
@@ -1602,6 +1627,32 @@ type ImageDeliveryParams = XOR<{
|
|
|
1602
1627
|
/** "string" is in format NxM - N and M are numbers between 0.00 and 1.00, N representing the x-axis and M representing the y-axis */
|
|
1603
1628
|
focal: 'auto' | 'center' | string;
|
|
1604
1629
|
}>;
|
|
1630
|
+
/**
|
|
1631
|
+
* A union type of possible transformations accepted by the `imageFrom` function.
|
|
1632
|
+
* Differentiates slightly from the `ImageDeliveryParams` type, in that the focal
|
|
1633
|
+
* point is represented by an object { x: number, y: number }, and not a string.
|
|
1634
|
+
*/
|
|
1635
|
+
type ImageFromTransformProps = XOR<{
|
|
1636
|
+
width?: number;
|
|
1637
|
+
height?: number;
|
|
1638
|
+
fit?: 'scale-down' | 'contain' | 'cover';
|
|
1639
|
+
}, {
|
|
1640
|
+
width?: number;
|
|
1641
|
+
height?: number;
|
|
1642
|
+
fit?: 'cover';
|
|
1643
|
+
focal: 'auto' | 'center' | {
|
|
1644
|
+
x: number;
|
|
1645
|
+
y: number;
|
|
1646
|
+
};
|
|
1647
|
+
}>;
|
|
1648
|
+
/**
|
|
1649
|
+
* A helper function for extracting the image URL from an asset and optionally
|
|
1650
|
+
* applying transformation URL query parameters.
|
|
1651
|
+
*/
|
|
1652
|
+
declare const imageFrom: (asset: Asset | AssetParamValueItem | string) => {
|
|
1653
|
+
url: () => string;
|
|
1654
|
+
transform: (transformProps: ImageFromTransformProps) => /*elided*/ any;
|
|
1655
|
+
};
|
|
1605
1656
|
|
|
1606
1657
|
/**
|
|
1607
1658
|
* Converts a content asset to a put content asset body that has only the properties expected to the PUT API.
|
|
@@ -1609,4 +1660,4 @@ type ImageDeliveryParams = XOR<{
|
|
|
1609
1660
|
*/
|
|
1610
1661
|
declare function convertAssetToPutAsset(asset: AssetGetResponseSingle): AssetUpsertRequest;
|
|
1611
1662
|
|
|
1612
|
-
export { type Asset, AssetClient, type AssetDefinitionType, type AssetDeleteRequest, type AssetGetRequest, type AssetGetRequestList, type AssetGetRequestSingle, type AssetGetResponse, type AssetGetResponseList, type AssetGetResponseSingle, type AssetParamValue, type AssetParamValueItem, type AssetUpsertRequest, type ImageDeliveryParams, UncachedAssetClient, assetDefinitions, convertAssetToPutAsset };
|
|
1663
|
+
export { type Asset, AssetClient, type AssetDefinitionType, type AssetDeleteRequest, type AssetGetRequest, type AssetGetRequestList, type AssetGetRequestSingle, type AssetGetResponse, type AssetGetResponseList, type AssetGetResponseSingle, type AssetParamValue, type AssetParamValueItem, type AssetUpsertRequest, type ImageDeliveryParams, type ImageFromTransformProps, UncachedAssetClient, assetDefinitions, convertAssetToPutAsset, imageFrom };
|
package/dist/index.d.ts
CHANGED
|
@@ -219,6 +219,27 @@ interface components$1 {
|
|
|
219
219
|
* @description ID of the workflow that instances of this content type will use by default. When not set, no workflow is attached
|
|
220
220
|
*/
|
|
221
221
|
workflowId?: string;
|
|
222
|
+
/** @description Configurations for previewing an entry on a consuming pattern or composition. */
|
|
223
|
+
previewConfigurations?: components$1["schemas"]["ContentTypePreviewConfiguration"][];
|
|
224
|
+
};
|
|
225
|
+
/** @description Defines a configuration for previewing an entry on a consuming pattern or composition. */
|
|
226
|
+
ContentTypePreviewConfiguration: {
|
|
227
|
+
/**
|
|
228
|
+
* @description The type of preview configuration
|
|
229
|
+
* @enum {string}
|
|
230
|
+
*/
|
|
231
|
+
type: "pattern" | "project-map";
|
|
232
|
+
/** @description Display label for the preview configuration */
|
|
233
|
+
label: string;
|
|
234
|
+
/**
|
|
235
|
+
* Format: uuid
|
|
236
|
+
* @description Target preview entity ID (project map node ID or pattern ID)
|
|
237
|
+
*/
|
|
238
|
+
id: string;
|
|
239
|
+
/** @description Optional mapping of dynamic input names to their values */
|
|
240
|
+
dynamicInputs?: {
|
|
241
|
+
[key: string]: string;
|
|
242
|
+
};
|
|
222
243
|
};
|
|
223
244
|
/** @description Defines an editable parameter on a component */
|
|
224
245
|
ComponentParameter: {
|
|
@@ -1581,6 +1602,9 @@ type AssetDefinition = {
|
|
|
1581
1602
|
};
|
|
1582
1603
|
declare const assetDefinitions: Record<AssetDefinitionType, AssetDefinition>;
|
|
1583
1604
|
|
|
1605
|
+
/**
|
|
1606
|
+
* A union type of possible query parameters for the image delivery API.
|
|
1607
|
+
*/
|
|
1584
1608
|
type ImageDeliveryParams = XOR<{
|
|
1585
1609
|
format: 'original';
|
|
1586
1610
|
}, {
|
|
@@ -1594,6 +1618,7 @@ type ImageDeliveryParams = XOR<{
|
|
|
1594
1618
|
* "cover" additionally supports specifying a focal point via the "focal" parameter
|
|
1595
1619
|
*/
|
|
1596
1620
|
fit?: 'scale-down' | 'contain' | 'cover';
|
|
1621
|
+
focal?: undefined;
|
|
1597
1622
|
}, {
|
|
1598
1623
|
width?: number;
|
|
1599
1624
|
height?: number;
|
|
@@ -1602,6 +1627,32 @@ type ImageDeliveryParams = XOR<{
|
|
|
1602
1627
|
/** "string" is in format NxM - N and M are numbers between 0.00 and 1.00, N representing the x-axis and M representing the y-axis */
|
|
1603
1628
|
focal: 'auto' | 'center' | string;
|
|
1604
1629
|
}>;
|
|
1630
|
+
/**
|
|
1631
|
+
* A union type of possible transformations accepted by the `imageFrom` function.
|
|
1632
|
+
* Differentiates slightly from the `ImageDeliveryParams` type, in that the focal
|
|
1633
|
+
* point is represented by an object { x: number, y: number }, and not a string.
|
|
1634
|
+
*/
|
|
1635
|
+
type ImageFromTransformProps = XOR<{
|
|
1636
|
+
width?: number;
|
|
1637
|
+
height?: number;
|
|
1638
|
+
fit?: 'scale-down' | 'contain' | 'cover';
|
|
1639
|
+
}, {
|
|
1640
|
+
width?: number;
|
|
1641
|
+
height?: number;
|
|
1642
|
+
fit?: 'cover';
|
|
1643
|
+
focal: 'auto' | 'center' | {
|
|
1644
|
+
x: number;
|
|
1645
|
+
y: number;
|
|
1646
|
+
};
|
|
1647
|
+
}>;
|
|
1648
|
+
/**
|
|
1649
|
+
* A helper function for extracting the image URL from an asset and optionally
|
|
1650
|
+
* applying transformation URL query parameters.
|
|
1651
|
+
*/
|
|
1652
|
+
declare const imageFrom: (asset: Asset | AssetParamValueItem | string) => {
|
|
1653
|
+
url: () => string;
|
|
1654
|
+
transform: (transformProps: ImageFromTransformProps) => /*elided*/ any;
|
|
1655
|
+
};
|
|
1605
1656
|
|
|
1606
1657
|
/**
|
|
1607
1658
|
* Converts a content asset to a put content asset body that has only the properties expected to the PUT API.
|
|
@@ -1609,4 +1660,4 @@ type ImageDeliveryParams = XOR<{
|
|
|
1609
1660
|
*/
|
|
1610
1661
|
declare function convertAssetToPutAsset(asset: AssetGetResponseSingle): AssetUpsertRequest;
|
|
1611
1662
|
|
|
1612
|
-
export { type Asset, AssetClient, type AssetDefinitionType, type AssetDeleteRequest, type AssetGetRequest, type AssetGetRequestList, type AssetGetRequestSingle, type AssetGetResponse, type AssetGetResponseList, type AssetGetResponseSingle, type AssetParamValue, type AssetParamValueItem, type AssetUpsertRequest, type ImageDeliveryParams, UncachedAssetClient, assetDefinitions, convertAssetToPutAsset };
|
|
1663
|
+
export { type Asset, AssetClient, type AssetDefinitionType, type AssetDeleteRequest, type AssetGetRequest, type AssetGetRequestList, type AssetGetRequestSingle, type AssetGetResponse, type AssetGetResponseList, type AssetGetResponseSingle, type AssetParamValue, type AssetParamValueItem, type AssetUpsertRequest, type ImageDeliveryParams, type ImageFromTransformProps, UncachedAssetClient, assetDefinitions, convertAssetToPutAsset, imageFrom };
|
package/dist/index.esm.js
CHANGED
|
@@ -62,6 +62,77 @@ var assetDefinitions = {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
// src/imageDelivery.ts
|
|
66
|
+
var isUniformImageUrl = (imageUrl) => {
|
|
67
|
+
try {
|
|
68
|
+
if (typeof imageUrl !== "string") {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return /(img).uniform.(rocks|global)$/.test(new URL(imageUrl).hostname);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var imageFrom = (asset) => {
|
|
77
|
+
var _a, _b, _c, _d;
|
|
78
|
+
const baseUrl = typeof asset === "string" ? asset : (_b = (_a = asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value;
|
|
79
|
+
const isUniformHosted = isUniformImageUrl(baseUrl);
|
|
80
|
+
const deliveryParams = {};
|
|
81
|
+
if (typeof asset !== "string") {
|
|
82
|
+
if ((_d = (_c = asset.fields) == null ? void 0 : _c.focalPoint) == null ? void 0 : _d.value) {
|
|
83
|
+
deliveryParams.focal = `${asset.fields.focalPoint.value.x}x${asset.fields.focalPoint.value.y}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const api = {
|
|
87
|
+
url: () => {
|
|
88
|
+
if (!baseUrl) {
|
|
89
|
+
return "";
|
|
90
|
+
}
|
|
91
|
+
if (!isUniformHosted) {
|
|
92
|
+
return baseUrl;
|
|
93
|
+
}
|
|
94
|
+
const url = new URL(baseUrl);
|
|
95
|
+
const params = deliveryParams;
|
|
96
|
+
if (params.width !== void 0) {
|
|
97
|
+
url.searchParams.set("width", params.width.toString());
|
|
98
|
+
}
|
|
99
|
+
if (params.height !== void 0) {
|
|
100
|
+
url.searchParams.set("height", params.height.toString());
|
|
101
|
+
}
|
|
102
|
+
if (params.fit !== void 0) {
|
|
103
|
+
url.searchParams.set("fit", params.fit);
|
|
104
|
+
} else if (params.width !== void 0 && params.height !== void 0) {
|
|
105
|
+
url.searchParams.set("fit", "cover");
|
|
106
|
+
params.fit = "cover";
|
|
107
|
+
}
|
|
108
|
+
if (params.width !== void 0 && params.height !== void 0 && params.focal !== void 0 && params.fit === "cover") {
|
|
109
|
+
url.searchParams.set("focal", params.focal);
|
|
110
|
+
}
|
|
111
|
+
return url.toString();
|
|
112
|
+
},
|
|
113
|
+
transform: (transformProps) => {
|
|
114
|
+
if (transformProps.width !== void 0) {
|
|
115
|
+
deliveryParams.width = transformProps.width;
|
|
116
|
+
}
|
|
117
|
+
if (transformProps.height !== void 0) {
|
|
118
|
+
deliveryParams.height = transformProps.height;
|
|
119
|
+
}
|
|
120
|
+
if (transformProps.fit !== void 0) {
|
|
121
|
+
deliveryParams.fit = transformProps.fit;
|
|
122
|
+
}
|
|
123
|
+
if (transformProps.focal !== void 0) {
|
|
124
|
+
if (typeof transformProps.focal === "string") {
|
|
125
|
+
deliveryParams.focal = transformProps.focal;
|
|
126
|
+
} else {
|
|
127
|
+
deliveryParams.focal = `${transformProps.focal.x}x${transformProps.focal.y}`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return api;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
return api;
|
|
134
|
+
};
|
|
135
|
+
|
|
65
136
|
// src/utils/assetConverter.ts
|
|
66
137
|
function convertAssetToPutAsset(asset) {
|
|
67
138
|
var _a, _b, _c, _d;
|
|
@@ -85,5 +156,6 @@ export {
|
|
|
85
156
|
AssetClient,
|
|
86
157
|
UncachedAssetClient,
|
|
87
158
|
assetDefinitions,
|
|
88
|
-
convertAssetToPutAsset
|
|
159
|
+
convertAssetToPutAsset,
|
|
160
|
+
imageFrom
|
|
89
161
|
};
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,8 @@ __export(src_exports, {
|
|
|
23
23
|
AssetClient: () => AssetClient,
|
|
24
24
|
UncachedAssetClient: () => UncachedAssetClient,
|
|
25
25
|
assetDefinitions: () => assetDefinitions,
|
|
26
|
-
convertAssetToPutAsset: () => convertAssetToPutAsset
|
|
26
|
+
convertAssetToPutAsset: () => convertAssetToPutAsset,
|
|
27
|
+
imageFrom: () => imageFrom
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(src_exports);
|
|
29
30
|
|
|
@@ -91,6 +92,77 @@ var assetDefinitions = {
|
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
94
|
|
|
95
|
+
// src/imageDelivery.ts
|
|
96
|
+
var isUniformImageUrl = (imageUrl) => {
|
|
97
|
+
try {
|
|
98
|
+
if (typeof imageUrl !== "string") {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return /(img).uniform.(rocks|global)$/.test(new URL(imageUrl).hostname);
|
|
102
|
+
} catch (e) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var imageFrom = (asset) => {
|
|
107
|
+
var _a, _b, _c, _d;
|
|
108
|
+
const baseUrl = typeof asset === "string" ? asset : (_b = (_a = asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value;
|
|
109
|
+
const isUniformHosted = isUniformImageUrl(baseUrl);
|
|
110
|
+
const deliveryParams = {};
|
|
111
|
+
if (typeof asset !== "string") {
|
|
112
|
+
if ((_d = (_c = asset.fields) == null ? void 0 : _c.focalPoint) == null ? void 0 : _d.value) {
|
|
113
|
+
deliveryParams.focal = `${asset.fields.focalPoint.value.x}x${asset.fields.focalPoint.value.y}`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const api = {
|
|
117
|
+
url: () => {
|
|
118
|
+
if (!baseUrl) {
|
|
119
|
+
return "";
|
|
120
|
+
}
|
|
121
|
+
if (!isUniformHosted) {
|
|
122
|
+
return baseUrl;
|
|
123
|
+
}
|
|
124
|
+
const url = new URL(baseUrl);
|
|
125
|
+
const params = deliveryParams;
|
|
126
|
+
if (params.width !== void 0) {
|
|
127
|
+
url.searchParams.set("width", params.width.toString());
|
|
128
|
+
}
|
|
129
|
+
if (params.height !== void 0) {
|
|
130
|
+
url.searchParams.set("height", params.height.toString());
|
|
131
|
+
}
|
|
132
|
+
if (params.fit !== void 0) {
|
|
133
|
+
url.searchParams.set("fit", params.fit);
|
|
134
|
+
} else if (params.width !== void 0 && params.height !== void 0) {
|
|
135
|
+
url.searchParams.set("fit", "cover");
|
|
136
|
+
params.fit = "cover";
|
|
137
|
+
}
|
|
138
|
+
if (params.width !== void 0 && params.height !== void 0 && params.focal !== void 0 && params.fit === "cover") {
|
|
139
|
+
url.searchParams.set("focal", params.focal);
|
|
140
|
+
}
|
|
141
|
+
return url.toString();
|
|
142
|
+
},
|
|
143
|
+
transform: (transformProps) => {
|
|
144
|
+
if (transformProps.width !== void 0) {
|
|
145
|
+
deliveryParams.width = transformProps.width;
|
|
146
|
+
}
|
|
147
|
+
if (transformProps.height !== void 0) {
|
|
148
|
+
deliveryParams.height = transformProps.height;
|
|
149
|
+
}
|
|
150
|
+
if (transformProps.fit !== void 0) {
|
|
151
|
+
deliveryParams.fit = transformProps.fit;
|
|
152
|
+
}
|
|
153
|
+
if (transformProps.focal !== void 0) {
|
|
154
|
+
if (typeof transformProps.focal === "string") {
|
|
155
|
+
deliveryParams.focal = transformProps.focal;
|
|
156
|
+
} else {
|
|
157
|
+
deliveryParams.focal = `${transformProps.focal.x}x${transformProps.focal.y}`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return api;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return api;
|
|
164
|
+
};
|
|
165
|
+
|
|
94
166
|
// src/utils/assetConverter.ts
|
|
95
167
|
function convertAssetToPutAsset(asset) {
|
|
96
168
|
var _a, _b, _c, _d;
|
|
@@ -115,5 +187,6 @@ function convertAssetToPutAsset(asset) {
|
|
|
115
187
|
AssetClient,
|
|
116
188
|
UncachedAssetClient,
|
|
117
189
|
assetDefinitions,
|
|
118
|
-
convertAssetToPutAsset
|
|
190
|
+
convertAssetToPutAsset,
|
|
191
|
+
imageFrom
|
|
119
192
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -62,6 +62,77 @@ var assetDefinitions = {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
// src/imageDelivery.ts
|
|
66
|
+
var isUniformImageUrl = (imageUrl) => {
|
|
67
|
+
try {
|
|
68
|
+
if (typeof imageUrl !== "string") {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return /(img).uniform.(rocks|global)$/.test(new URL(imageUrl).hostname);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var imageFrom = (asset) => {
|
|
77
|
+
var _a, _b, _c, _d;
|
|
78
|
+
const baseUrl = typeof asset === "string" ? asset : (_b = (_a = asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value;
|
|
79
|
+
const isUniformHosted = isUniformImageUrl(baseUrl);
|
|
80
|
+
const deliveryParams = {};
|
|
81
|
+
if (typeof asset !== "string") {
|
|
82
|
+
if ((_d = (_c = asset.fields) == null ? void 0 : _c.focalPoint) == null ? void 0 : _d.value) {
|
|
83
|
+
deliveryParams.focal = `${asset.fields.focalPoint.value.x}x${asset.fields.focalPoint.value.y}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const api = {
|
|
87
|
+
url: () => {
|
|
88
|
+
if (!baseUrl) {
|
|
89
|
+
return "";
|
|
90
|
+
}
|
|
91
|
+
if (!isUniformHosted) {
|
|
92
|
+
return baseUrl;
|
|
93
|
+
}
|
|
94
|
+
const url = new URL(baseUrl);
|
|
95
|
+
const params = deliveryParams;
|
|
96
|
+
if (params.width !== void 0) {
|
|
97
|
+
url.searchParams.set("width", params.width.toString());
|
|
98
|
+
}
|
|
99
|
+
if (params.height !== void 0) {
|
|
100
|
+
url.searchParams.set("height", params.height.toString());
|
|
101
|
+
}
|
|
102
|
+
if (params.fit !== void 0) {
|
|
103
|
+
url.searchParams.set("fit", params.fit);
|
|
104
|
+
} else if (params.width !== void 0 && params.height !== void 0) {
|
|
105
|
+
url.searchParams.set("fit", "cover");
|
|
106
|
+
params.fit = "cover";
|
|
107
|
+
}
|
|
108
|
+
if (params.width !== void 0 && params.height !== void 0 && params.focal !== void 0 && params.fit === "cover") {
|
|
109
|
+
url.searchParams.set("focal", params.focal);
|
|
110
|
+
}
|
|
111
|
+
return url.toString();
|
|
112
|
+
},
|
|
113
|
+
transform: (transformProps) => {
|
|
114
|
+
if (transformProps.width !== void 0) {
|
|
115
|
+
deliveryParams.width = transformProps.width;
|
|
116
|
+
}
|
|
117
|
+
if (transformProps.height !== void 0) {
|
|
118
|
+
deliveryParams.height = transformProps.height;
|
|
119
|
+
}
|
|
120
|
+
if (transformProps.fit !== void 0) {
|
|
121
|
+
deliveryParams.fit = transformProps.fit;
|
|
122
|
+
}
|
|
123
|
+
if (transformProps.focal !== void 0) {
|
|
124
|
+
if (typeof transformProps.focal === "string") {
|
|
125
|
+
deliveryParams.focal = transformProps.focal;
|
|
126
|
+
} else {
|
|
127
|
+
deliveryParams.focal = `${transformProps.focal.x}x${transformProps.focal.y}`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return api;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
return api;
|
|
134
|
+
};
|
|
135
|
+
|
|
65
136
|
// src/utils/assetConverter.ts
|
|
66
137
|
function convertAssetToPutAsset(asset) {
|
|
67
138
|
var _a, _b, _c, _d;
|
|
@@ -85,5 +156,6 @@ export {
|
|
|
85
156
|
AssetClient,
|
|
86
157
|
UncachedAssetClient,
|
|
87
158
|
assetDefinitions,
|
|
88
|
-
convertAssetToPutAsset
|
|
159
|
+
convertAssetToPutAsset,
|
|
160
|
+
imageFrom
|
|
89
161
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/assets",
|
|
3
|
-
"version": "20.7.1-alpha.
|
|
3
|
+
"version": "20.7.1-alpha.28+5b9868df5c",
|
|
4
4
|
"description": "Uniform Assets",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@uniformdev/context": "20.7.1-alpha.
|
|
39
|
+
"@uniformdev/context": "20.7.1-alpha.28+5b9868df5c"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"ts-xor": "^1.3.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "5b9868df5c62413be37a4f1e59c11f05d52ac169"
|
|
45
45
|
}
|