@orangelogic/design-system 3.80.0 → 3.81.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/library/chunks/{asset-link-format.vF2ZaG1Y.js → asset-link-format.BCaHv6rQ.js} +387 -381
- package/library/chunks/{audio.OVvnRj2a.js → audio.Dr0Hus7H.js} +6 -3
- package/library/chunks/{block-width.BH7TR3eZ.js → block-width.DDBxasyy.js} +469 -445
- package/library/chunks/{color-swatch-group.CfYdaquw.js → color-swatch-group.D6W7Zrig.js} +45 -45
- package/library/chunks/{config-manager.CXYDqPVU.js → config-manager.CXUj_qfl.js} +12 -12
- package/library/chunks/{configs-controller.D7ZZytOj.js → configs-controller.C34CcFSA.js} +61 -61
- package/library/chunks/{document-viewer.6SnAxejc.js → document-viewer.BKdDZ9MG.js} +16 -7
- package/library/chunks/{file-on-demand.BMY6QNJY.js → file-on-demand.BAwB-Znv.js} +1 -1
- package/library/chunks/{image.CXQJO9if.js → image.wVxvwZxr.js} +74 -79
- package/library/chunks/{masonry.C9-z9R7j.js → masonry.D4DxZZ03.js} +1 -1
- package/library/chunks/{src.B1k7w53w.js → src.DoJoeNZB.js} +4 -4
- package/library/chunks/src.cBRbsOdC.js +720 -0
- package/library/chunks/{url.CZO_DV8Y.js → url.BCc06dE7.js} +15 -6
- package/library/chunks/{video.Bv7f2jDe.js → video.C9tEIck_.js} +1 -1
- package/library/components/asset-link-format.js +1 -1
- package/library/components/atoms.js +5 -5
- package/library/components/audio.js +1 -1
- package/library/components/color-swatch-group.js +1 -1
- package/library/components/document-viewer.js +1 -1
- package/library/components/file-on-demand.js +1 -1
- package/library/components/image.js +1 -1
- package/library/components/masonry.js +1 -1
- package/library/components/molecules.js +1 -1
- package/library/components/organisms.js +3 -3
- package/library/components/types.js +10287 -10185
- package/library/components/video.js +1 -1
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/audio/audio.d.ts +2 -0
- package/library/packages/atoms/src/components/document-viewer/document-viewer.d.ts +6 -0
- package/library/packages/atoms/src/components/image/image.d.ts +0 -3
- package/library/packages/events/src/events.d.ts +0 -4
- package/library/packages/organisms/src/content-builder/blocks/audio/audio.d.ts +14 -0
- package/library/packages/organisms/src/content-builder/blocks/button/button.d.ts +8 -0
- package/library/packages/organisms/src/content-builder/blocks/column/column.d.ts +5 -0
- package/library/packages/organisms/src/content-builder/blocks/column-group/column-group.d.ts +5 -0
- package/library/packages/organisms/src/content-builder/blocks/document-viewer/document-viewer.d.ts +8 -0
- package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +7 -6
- package/library/packages/organisms/src/content-builder/blocks/timeline/timeline.d.ts +0 -2
- package/library/packages/organisms/src/content-builder/blocks/video/video.d.ts +9 -0
- package/library/packages/organisms/src/content-builder/components/template-manager/template-manager.d.ts +11 -0
- package/library/packages/organisms/src/content-builder/content-builder.d.ts +17 -1
- package/library/packages/organisms/src/content-builder-viewer/content-builder-viewer.d.ts +13 -4
- package/library/packages/organisms/src/form/control-renderer/control-renderer.d.ts +1 -1
- package/library/packages/tools/src/fetch-asset/fetch-asset.d.ts +2 -1
- package/library/packages/tools/src/fetch-image/fetch-image.d.ts +28 -0
- package/library/packages/utils/src/asset-url-mode/asset-url-mode.d.ts +22 -0
- package/library/packages/utils/src/asset-url-mode/index.d.ts +1 -0
- package/library/packages/utils/src/url/url.d.ts +7 -0
- package/library/react-web-component.d.ts +21 -1
- package/library/utils.js +28 -706
- package/package.json +1 -1
- package/library/packages/events/src/cx-image-src-resolved.d.ts +0 -9
- package/library/packages/events/src/cx-timeline-data-resolved.d.ts +0 -9
- package/library/packages/events/src/cx-video-src-resolved.d.ts +0 -8
- package/library/packages/events/src/cx-video-thumbnail-resolved.d.ts +0 -8
|
@@ -23,25 +23,25 @@ import { t as oe } from "./input.AS0kZ6ks.js";
|
|
|
23
23
|
import { t as S } from "./option.CKvalzr2.js";
|
|
24
24
|
import { t as C } from "./space.Dd8jezXK.js";
|
|
25
25
|
import { t as w } from "./select.CmdHRMy_.js";
|
|
26
|
-
import {
|
|
27
|
-
import { t as
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { t as
|
|
26
|
+
import { C as se, T as ce, f as le, m as T, u as E, v as ue, w as de, y as fe } from "./src.cBRbsOdC.js";
|
|
27
|
+
import { t as D } from "./details.B_IIkM1I.js";
|
|
28
|
+
import { t as pe } from "./divider.CqSNZCU8.js";
|
|
29
|
+
import { i as O, n as k, r as A } from "./asset-link-format.DhdgEsA0.js";
|
|
30
|
+
import { t as me } from "./v4.JyXW8GUB.js";
|
|
31
31
|
import "./cropper.D5Vh9xD_.js";
|
|
32
|
-
import { t as
|
|
33
|
-
import { a as
|
|
34
|
-
import { t as
|
|
32
|
+
import { t as he } from "./_baseUniq.h_pGICPH.js";
|
|
33
|
+
import { a as ge, f as j, n as _e, o as M, r as ve, t as ye, u as be } from "./endpoints.CqXqfyiN.js";
|
|
34
|
+
import { t as N } from "./position-picker.Cjk5OdB5.js";
|
|
35
35
|
//#region ../../node_modules/lodash-es/uniq.js
|
|
36
|
-
function
|
|
37
|
-
return e && e.length ?
|
|
36
|
+
function xe(e) {
|
|
37
|
+
return e && e.length ? he(e) : [];
|
|
38
38
|
}
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region ../../packages/services/src/api/asset/asset.utils.ts
|
|
41
|
-
function
|
|
41
|
+
function P(e) {
|
|
42
42
|
return typeof e == "object" && !!e && "URI" in e;
|
|
43
43
|
}
|
|
44
|
-
var
|
|
44
|
+
var Se = {
|
|
45
45
|
artist: "Artist",
|
|
46
46
|
color: "Color",
|
|
47
47
|
createDate: "CreateDate",
|
|
@@ -63,34 +63,34 @@ var xe = {
|
|
|
63
63
|
systemIdentifier: "SystemIdentifier",
|
|
64
64
|
text: "Text",
|
|
65
65
|
title: "Title"
|
|
66
|
-
},
|
|
66
|
+
}, Ce = /* @__PURE__ */ new Set([
|
|
67
67
|
"mediaDate",
|
|
68
68
|
"createDate",
|
|
69
69
|
"editDate"
|
|
70
70
|
]);
|
|
71
|
-
function
|
|
71
|
+
function F(e) {
|
|
72
72
|
return !/[\s&+/*"\\:(),'<>~|[\]{}]/.test(e) && !/^(?:OR|AND|NOT)$/.test(e) ? e : `"${e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
let n = (Array.isArray(t) ? t : [t]).map((t) => `${e}:${
|
|
74
|
+
function we(e, t) {
|
|
75
|
+
let n = (Array.isArray(t) ? t : [t]).map((t) => `${e}:${F(t)}`);
|
|
76
76
|
return n.length > 1 ? `(${n.join(" OR ")})` : n[0] ?? "";
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function Te(e, t) {
|
|
79
79
|
return (Array.isArray(t) ? t : [t]).map((t) => `${e}${t.operator}${t.value}`).join(" AND ");
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Ee(e) {
|
|
82
82
|
let t = [];
|
|
83
83
|
for (let n of Object.keys(e)) {
|
|
84
84
|
let r = n, i = e[r];
|
|
85
85
|
if (i == null) continue;
|
|
86
86
|
if (r === "custom") {
|
|
87
|
-
for (let [e, n] of Object.entries(i)) t.push(
|
|
87
|
+
for (let [e, n] of Object.entries(i)) t.push(we(e, n));
|
|
88
88
|
continue;
|
|
89
89
|
}
|
|
90
|
-
let a =
|
|
90
|
+
let a = Se[r];
|
|
91
91
|
if (a) {
|
|
92
|
-
if (
|
|
93
|
-
t.push(
|
|
92
|
+
if (Ce.has(r)) {
|
|
93
|
+
t.push(Te(a, i));
|
|
94
94
|
continue;
|
|
95
95
|
}
|
|
96
96
|
if (r === "color") {
|
|
@@ -100,87 +100,87 @@ function Te(e) {
|
|
|
100
100
|
if (r === "parentFolderIdentifier") {
|
|
101
101
|
let e = Array.isArray(i) ? i : [i];
|
|
102
102
|
if (e.length === 0) continue;
|
|
103
|
-
let n = [...e.map((e) => `ParentFolderIdentifier:${
|
|
103
|
+
let n = [...e.map((e) => `ParentFolderIdentifier:${F(String(e))}`), ...e.map((e) => `ParentAlbumIdentifier:${F(String(e))}`)];
|
|
104
104
|
t.push(`(${n.join(" OR ")})`);
|
|
105
105
|
continue;
|
|
106
106
|
}
|
|
107
|
-
t.push(
|
|
107
|
+
t.push(we(a, i));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
return t.join(" AND ");
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
if ("and" in e) return e.and.map(
|
|
112
|
+
function I(e) {
|
|
113
|
+
if ("and" in e) return e.and.map(I).filter(Boolean).join(" AND ");
|
|
114
114
|
if ("or" in e) {
|
|
115
|
-
let t = e.or.map(
|
|
115
|
+
let t = e.or.map(I).filter(Boolean);
|
|
116
116
|
return t.length > 1 ? `(${t.join(" OR ")})` : t[0] ?? "";
|
|
117
117
|
}
|
|
118
118
|
if ("not" in e) {
|
|
119
|
-
let t =
|
|
119
|
+
let t = I(e.not);
|
|
120
120
|
return t ? `NOT (${t})` : "";
|
|
121
121
|
}
|
|
122
|
-
return
|
|
122
|
+
return Ee(e);
|
|
123
123
|
}
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region ../../packages/services/src/api/asset/asset.ts
|
|
126
|
-
var
|
|
126
|
+
var De = "CoreField.LargeSizePreview", L = "CoreField.DocType", R = "Document.Title", Oe = "Document.CaptionLong", z = "Document.FileExtension", B = "CoreField.FileSize", ke = "CoreField.Identifier", Ae = "CoreField.MaxHeight", je = "CoreField.MaxWidth", V = "Document.RecordID", Me = "CoreField.DocSubType", Ne = "CoreField.TitleWithFallback", H = "CoreField.OriginalFileName", Pe = "__width", Fe = "__height", Ie = "CoreField.OriginalPreview", Le = "Document.DocSubType", Re = "Document.InPoint", ze = "Document.OutPoint", Be = {
|
|
127
127
|
DEFAULT_VIEW_SIZE: "Document.LargeSizePreview",
|
|
128
128
|
ORIGINAL_VIEW_SIZE: "Document.OriginalPreview"
|
|
129
|
-
},
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
},
|
|
133
|
-
function
|
|
134
|
-
return
|
|
129
|
+
}, Ve = {
|
|
130
|
+
[De]: Be.DEFAULT_VIEW_SIZE,
|
|
131
|
+
[Ie]: Be.ORIGINAL_VIEW_SIZE
|
|
132
|
+
}, He = Object.fromEntries(Object.entries(Ve).map(([e, t]) => [t, e]));
|
|
133
|
+
function Ue(e) {
|
|
134
|
+
return Ve[e] ?? e;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
return e === "CoreField.TitleWithFallback" ? [
|
|
136
|
+
function We(e) {
|
|
137
|
+
return e === "CoreField.TitleWithFallback" ? [R, H] : [Ue(e)];
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function Ge(e) {
|
|
140
140
|
let t = {};
|
|
141
141
|
for (let [n, r] of Object.entries(e)) {
|
|
142
|
-
let e =
|
|
142
|
+
let e = He[n] ?? n;
|
|
143
143
|
t[e] = r;
|
|
144
144
|
}
|
|
145
145
|
return t;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Ke(e, t, n) {
|
|
148
148
|
e[n] = U(t, n);
|
|
149
149
|
let r = t[n];
|
|
150
|
-
return r != null &&
|
|
150
|
+
return r != null && P(r) && (typeof r.Width == "number" && r.Width > 0 && (e[`${n}${Pe}`] = String(r.Width)), typeof r.Height == "number" && r.Height > 0 && (e[`${n}${Fe}`] = String(r.Height))), e;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function qe(e) {
|
|
153
153
|
let t = new URLSearchParams();
|
|
154
154
|
for (let [n, r] of Object.entries(e)) r != null && (Array.isArray(r) ? r.forEach((e) => t.append(n, String(e))) : t.append(n, String(r)));
|
|
155
155
|
return t;
|
|
156
156
|
}
|
|
157
|
-
async function
|
|
158
|
-
let p = n?.flatMap(
|
|
159
|
-
let t =
|
|
160
|
-
return m && (t[
|
|
157
|
+
async function Je({ consistency: e, countPerPage: t, fields: n, getPermanentAssetsPaths: r, httpMethod: i = "GET", isSiteBuilder: a, pageNumber: o, query: s, securityByPassToken: c, siteUrl: l, sort: u, token: d, useSession: f }) {
|
|
158
|
+
let p = n?.flatMap(We), m = n?.includes("CoreField.TitleWithFallback") ?? !1, h = (e) => {
|
|
159
|
+
let t = Ge(e);
|
|
160
|
+
return m && (t[Ne] = U(t, "Document.Title") || U(t, "CoreField.OriginalFileName")), t;
|
|
161
161
|
}, g = {
|
|
162
162
|
Consistency: e || void 0,
|
|
163
163
|
CountPerPage: t,
|
|
164
|
-
Fields:
|
|
164
|
+
Fields: xe(p),
|
|
165
165
|
Format: "json",
|
|
166
|
-
GetPermanentAssetsPaths: r
|
|
166
|
+
GetPermanentAssetsPaths: r ?? void 0,
|
|
167
167
|
PageNumber: o,
|
|
168
|
-
Query:
|
|
168
|
+
Query: I(s),
|
|
169
169
|
SecurityByPassToken: c || void 0,
|
|
170
170
|
Sort: u || void 0,
|
|
171
171
|
UseSession: f || void 0
|
|
172
172
|
}, _ = i === "POST";
|
|
173
173
|
try {
|
|
174
|
-
return (await
|
|
174
|
+
return (await j.request({
|
|
175
175
|
baseURL: l,
|
|
176
176
|
headers: d ? { Authorization: `Bearer ${d}` } : void 0,
|
|
177
177
|
method: i,
|
|
178
|
-
..._ ? { data: a ? g :
|
|
178
|
+
..._ ? { data: a ? g : qe(g) } : {
|
|
179
179
|
params: g,
|
|
180
180
|
paramsSerializer: { indexes: null }
|
|
181
181
|
},
|
|
182
182
|
responseType: "json",
|
|
183
|
-
transformResponse: [...Array.isArray(
|
|
183
|
+
transformResponse: [...Array.isArray(j.defaults.transformResponse) ? j.defaults.transformResponse : [], a ? (e) => ({
|
|
184
184
|
items: (e.results?.Items ?? []).map(h),
|
|
185
185
|
sort: e.results?.GlobalInfo?.Sort ?? "",
|
|
186
186
|
totalCount: e.results?.GlobalInfo?.TotalCount ?? 0
|
|
@@ -189,7 +189,7 @@ async function Ge({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
189
189
|
sort: e.APIResponse?.GlobalInfo?.Sort ?? "",
|
|
190
190
|
totalCount: e.APIResponse?.GlobalInfo?.TotalCount ?? 0
|
|
191
191
|
})],
|
|
192
|
-
url: a ? _ ?
|
|
192
|
+
url: a ? _ ? M.SEARCH_ASSETS_POST : M.SEARCH_ASSETS : be["4.0"]
|
|
193
193
|
})).data;
|
|
194
194
|
} catch {
|
|
195
195
|
return {
|
|
@@ -199,9 +199,9 @@ async function Ge({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
async function
|
|
202
|
+
async function Ye({ assetId: e, extension: t, format: n, siteUrl: r, token: i, transformations: a, useSession: o }) {
|
|
203
203
|
try {
|
|
204
|
-
return (await
|
|
204
|
+
return (await j.request({
|
|
205
205
|
baseURL: r,
|
|
206
206
|
method: "GET",
|
|
207
207
|
params: {
|
|
@@ -213,19 +213,19 @@ async function Ke({ assetId: e, extension: t, format: n, siteUrl: r, token: i, t
|
|
|
213
213
|
UseSession: o || void 0
|
|
214
214
|
},
|
|
215
215
|
timeout: 3e5,
|
|
216
|
-
url:
|
|
216
|
+
url: _e.GET_TRANSFORM_ASSET_LINK
|
|
217
217
|
})).data;
|
|
218
218
|
} catch {
|
|
219
219
|
return null;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
var
|
|
223
|
-
function
|
|
222
|
+
var Xe = 50;
|
|
223
|
+
function Ze(e, t) {
|
|
224
224
|
let n = [];
|
|
225
225
|
for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
|
|
226
226
|
return n;
|
|
227
227
|
}
|
|
228
|
-
async function
|
|
228
|
+
async function Qe({ consistency: e, extraFields: t, getPermanentAssetsPaths: n, isSiteBuilder: r, recordIds: i, securityByPassToken: a, token: o }) {
|
|
229
229
|
if (!Array.isArray(i) || i.length === 0) return {
|
|
230
230
|
facets: [],
|
|
231
231
|
items: [],
|
|
@@ -234,10 +234,10 @@ async function Ye({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
|
|
|
234
234
|
let s = t?.filter((e) => e && typeof e == "string") ?? [], c = [
|
|
235
235
|
...s,
|
|
236
236
|
H,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
], l =
|
|
237
|
+
R,
|
|
238
|
+
Oe,
|
|
239
|
+
V
|
|
240
|
+
], l = Ze(i, Xe), u = await Promise.all(l.map((t) => Je({
|
|
241
241
|
consistency: e,
|
|
242
242
|
countPerPage: t.length,
|
|
243
243
|
fields: c,
|
|
@@ -253,17 +253,17 @@ async function Ye({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
|
|
|
253
253
|
facets: [],
|
|
254
254
|
items: u.flatMap((e) => e.items).map((e) => ({
|
|
255
255
|
name: U(e, H),
|
|
256
|
-
recordId: U(e,
|
|
257
|
-
...s.reduce((t, n) =>
|
|
256
|
+
recordId: U(e, V),
|
|
257
|
+
...s.reduce((t, n) => Ke(t, e, n), {})
|
|
258
258
|
})).sort((e, t) => (d.get(e.recordId) ?? Infinity) - (d.get(t.recordId) ?? Infinity)),
|
|
259
259
|
totalCount: u.reduce((e, t) => e + t.totalCount, 0)
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
function U(e, t) {
|
|
263
263
|
let n = e[t];
|
|
264
|
-
return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) :
|
|
264
|
+
return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) : P(n) ? n.URI : "";
|
|
265
265
|
}
|
|
266
|
-
async function
|
|
266
|
+
async function $e({ consistency: e, countPerPage: t, directParentFolderIdentifier: n, extraFields: r, getPermanentAssetsPaths: i, isSiteBuilder: a, limitedDocTypes: o, pageNumber: s, parentFolderIdentifier: c, searchTerm: l, securityByPassToken: u, sortOrder: d, token: f }) {
|
|
267
267
|
if (!n && !c) return {
|
|
268
268
|
facets: [],
|
|
269
269
|
items: [],
|
|
@@ -274,18 +274,18 @@ async function Xe({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
274
274
|
parentFolderIdentifier: c,
|
|
275
275
|
...l ? { text: l } : {},
|
|
276
276
|
...o && o.length > 0 ? { docType: o } : {}
|
|
277
|
-
}, h = await
|
|
277
|
+
}, h = await Je({
|
|
278
278
|
consistency: e,
|
|
279
279
|
countPerPage: t,
|
|
280
280
|
fields: [
|
|
281
281
|
...p,
|
|
282
|
-
|
|
283
|
-
R,
|
|
284
|
-
F,
|
|
285
|
-
V,
|
|
286
|
-
z,
|
|
287
|
-
L,
|
|
282
|
+
Ne,
|
|
288
283
|
B,
|
|
284
|
+
L,
|
|
285
|
+
Me,
|
|
286
|
+
ke,
|
|
287
|
+
z,
|
|
288
|
+
V,
|
|
289
289
|
H
|
|
290
290
|
],
|
|
291
291
|
getPermanentAssetsPaths: i,
|
|
@@ -300,27 +300,27 @@ async function Xe({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
300
300
|
return {
|
|
301
301
|
facets: [],
|
|
302
302
|
items: h.items.map((e) => {
|
|
303
|
-
let t = U(e,
|
|
303
|
+
let t = U(e, z);
|
|
304
304
|
t && !t.startsWith(".") && (t = "." + t);
|
|
305
|
-
let n = U(e,
|
|
305
|
+
let n = U(e, V);
|
|
306
306
|
return {
|
|
307
|
-
docSubType: U(e,
|
|
307
|
+
docSubType: U(e, Me),
|
|
308
308
|
docType: U(e, "CoreField.DocType") || "",
|
|
309
309
|
extension: t,
|
|
310
310
|
id: n,
|
|
311
|
-
identifier: U(e,
|
|
311
|
+
identifier: U(e, ke),
|
|
312
312
|
name: U(e, H),
|
|
313
313
|
recordId: n,
|
|
314
314
|
size: U(e, "CoreField.FileSize") || "0 MB",
|
|
315
|
-
...p.reduce((t, n) =>
|
|
315
|
+
...p.reduce((t, n) => Ke(t, e, n), {})
|
|
316
316
|
};
|
|
317
317
|
}),
|
|
318
318
|
totalCount: h.totalCount
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
async function
|
|
321
|
+
async function et({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, useSession: i }) {
|
|
322
322
|
try {
|
|
323
|
-
return (await
|
|
323
|
+
return (await j.request({
|
|
324
324
|
method: "GET",
|
|
325
325
|
params: {
|
|
326
326
|
AutoCropMode: e,
|
|
@@ -331,21 +331,21 @@ async function Ze({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, u
|
|
|
331
331
|
},
|
|
332
332
|
responseType: "json",
|
|
333
333
|
timeout: 3e5,
|
|
334
|
-
transformResponse: [...Array.isArray(
|
|
334
|
+
transformResponse: [...Array.isArray(j.defaults.transformResponse) ? j.defaults.transformResponse : [], (e) => ({
|
|
335
335
|
height: e.cropHeight,
|
|
336
336
|
width: e.cropWidth,
|
|
337
337
|
x: e.cropX,
|
|
338
338
|
y: e.cropY
|
|
339
339
|
})],
|
|
340
|
-
url:
|
|
340
|
+
url: _e.GET_CROP_ZONE_SUGGESTION
|
|
341
341
|
})).data;
|
|
342
342
|
} catch {
|
|
343
343
|
return null;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
async function
|
|
346
|
+
async function tt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, useSession: i }) {
|
|
347
347
|
try {
|
|
348
|
-
return (await
|
|
348
|
+
return (await j.request({
|
|
349
349
|
baseURL: n,
|
|
350
350
|
method: "GET",
|
|
351
351
|
params: {
|
|
@@ -354,7 +354,7 @@ async function Qe({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
|
|
|
354
354
|
UseSession: i || void 0
|
|
355
355
|
},
|
|
356
356
|
responseType: "json",
|
|
357
|
-
transformResponse: [...Array.isArray(
|
|
357
|
+
transformResponse: [...Array.isArray(j.defaults.transformResponse) ? j.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? [] : e.proxies?.map((e) => ({
|
|
358
358
|
cdnName: e.cdnName,
|
|
359
359
|
extension: e.extension,
|
|
360
360
|
formatHeight: e.formatHeight,
|
|
@@ -365,31 +365,31 @@ async function Qe({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
|
|
|
365
365
|
proxyName: e.proxyName,
|
|
366
366
|
width: e.width
|
|
367
367
|
})) ?? []],
|
|
368
|
-
url: t ?
|
|
368
|
+
url: t ? M.GET_AVAILABLE_PROXIES : ge
|
|
369
369
|
})).data;
|
|
370
370
|
} catch {
|
|
371
371
|
return [];
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
async function
|
|
374
|
+
async function nt({ siteUrl: e } = {}) {
|
|
375
375
|
try {
|
|
376
|
-
return (await
|
|
376
|
+
return (await j.request({
|
|
377
377
|
baseURL: e,
|
|
378
378
|
method: "GET",
|
|
379
379
|
responseType: "json",
|
|
380
|
-
transformResponse: [...Array.isArray(
|
|
380
|
+
transformResponse: [...Array.isArray(j.defaults.transformResponse) ? j.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? { formatsByDocType: {
|
|
381
381
|
Audio: {},
|
|
382
382
|
Image: {},
|
|
383
383
|
Multimedia: {},
|
|
384
384
|
Video: {}
|
|
385
385
|
} } : { formatsByDocType: e.formatsByDocType ?? {} }],
|
|
386
|
-
url:
|
|
386
|
+
url: ye
|
|
387
387
|
})).data;
|
|
388
388
|
} catch {
|
|
389
389
|
return { formatsByDocType: {} };
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
async function
|
|
392
|
+
async function rt({ recordIds: e, rightsToCheck: t }) {
|
|
393
393
|
let n = {
|
|
394
394
|
authorizedObjects: [],
|
|
395
395
|
forbiddenObjectsOfReadPermission: [],
|
|
@@ -397,7 +397,7 @@ async function et({ recordIds: e, rightsToCheck: t }) {
|
|
|
397
397
|
invalidObjects: []
|
|
398
398
|
};
|
|
399
399
|
try {
|
|
400
|
-
let { data: n } = await
|
|
400
|
+
let { data: n } = await j.request({
|
|
401
401
|
method: "GET",
|
|
402
402
|
params: {
|
|
403
403
|
RecordIDs: e,
|
|
@@ -405,7 +405,7 @@ async function et({ recordIds: e, rightsToCheck: t }) {
|
|
|
405
405
|
},
|
|
406
406
|
paramsSerializer: { indexes: null },
|
|
407
407
|
responseType: "json",
|
|
408
|
-
url:
|
|
408
|
+
url: ve.GET_AUTHORIZED_OBJECTS
|
|
409
409
|
});
|
|
410
410
|
return n;
|
|
411
411
|
} catch {
|
|
@@ -414,7 +414,7 @@ async function et({ recordIds: e, rightsToCheck: t }) {
|
|
|
414
414
|
}
|
|
415
415
|
//#endregion
|
|
416
416
|
//#region ../../packages/tools/src/fetch-image/fetch-image.ts
|
|
417
|
-
var
|
|
417
|
+
var it = 20, W = "TR1", G = "TRX", at = /* @__PURE__ */ new Set([".gif"]), ot = /* @__PURE__ */ new Set([
|
|
418
418
|
".avif",
|
|
419
419
|
".bmp",
|
|
420
420
|
".gif",
|
|
@@ -425,47 +425,51 @@ var tt = 20, W = "TR1", G = "TRX", nt = /* @__PURE__ */ new Set([".gif"]), rt =
|
|
|
425
425
|
".svg",
|
|
426
426
|
".webp"
|
|
427
427
|
]);
|
|
428
|
-
function
|
|
428
|
+
function st(e) {
|
|
429
429
|
let t = e.toLowerCase(), n = t.startsWith(".") ? t : `.${t}`;
|
|
430
|
-
return
|
|
430
|
+
return ot.has(n);
|
|
431
431
|
}
|
|
432
|
-
function
|
|
433
|
-
return e !== void 0 && e !== "" && e !==
|
|
432
|
+
function ct(e, t) {
|
|
433
|
+
return e !== void 0 && e !== "" && e !== k.Image ? !1 : !t || st(t);
|
|
434
434
|
}
|
|
435
|
-
function
|
|
436
|
-
let
|
|
435
|
+
function lt({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i, item: a, manualFormat: o, size: s, useExpiringAssetUrls: c }) {
|
|
436
|
+
let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${W}`, f = (n, r) => {
|
|
437
437
|
let i = a[n];
|
|
438
438
|
if (!i) return;
|
|
439
|
-
let s = a[`${n}${
|
|
439
|
+
let s = a[`${n}${Pe}`], u = a[`${n}${Fe}`], d = e && !c ? E(i, [], {
|
|
440
440
|
autoFormat: !o,
|
|
441
|
-
extension:
|
|
441
|
+
extension: l,
|
|
442
442
|
format: r
|
|
443
443
|
}) : i;
|
|
444
444
|
return {
|
|
445
|
-
maxHeight:
|
|
445
|
+
maxHeight: u,
|
|
446
446
|
maxWidth: s,
|
|
447
|
-
src:
|
|
448
|
-
srcset: t ? le(
|
|
449
|
-
extension:
|
|
447
|
+
src: d,
|
|
448
|
+
srcset: t && !c ? le(d, {
|
|
449
|
+
extension: l,
|
|
450
450
|
format: r,
|
|
451
|
-
maxWidth:
|
|
451
|
+
maxWidth: fe(o, s)
|
|
452
452
|
}) : ""
|
|
453
453
|
};
|
|
454
454
|
};
|
|
455
|
+
if (c) {
|
|
456
|
+
let e = de(a, ct(n, l), l);
|
|
457
|
+
return e ? f(e) ?? {} : {};
|
|
458
|
+
}
|
|
455
459
|
if (!o) {
|
|
456
|
-
let e = ue(
|
|
457
|
-
return
|
|
460
|
+
let e = ue(l, s);
|
|
461
|
+
return f(`path_${e}`, e) ?? f(d, W) ?? {};
|
|
458
462
|
}
|
|
459
|
-
let
|
|
460
|
-
return
|
|
463
|
+
let p = i ? `path_${i}` : void 0;
|
|
464
|
+
return p && a[p] ? i !== G || ct(n, l) ? f(p, i) ?? {} : f(d, W) ?? {} : l && at.has(u) ? f(`path_${G}`, G) ?? f(d, W) ?? {} : f(d, W) ?? {};
|
|
461
465
|
}
|
|
462
|
-
var
|
|
466
|
+
var ut = class {
|
|
463
467
|
constructor(e, t) {
|
|
464
|
-
this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = Infinity, this.pageSize =
|
|
468
|
+
this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = Infinity, this.pageSize = it, this.requestEpoch = 0, this.host = e, this.host.addController?.(this);
|
|
465
469
|
let n = t?.maxEnd;
|
|
466
470
|
this.maxEnd = typeof n == "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : Infinity;
|
|
467
471
|
let r = t?.pageSize;
|
|
468
|
-
this.pageSize = typeof r == "number" && Number.isFinite(r) && r >= 1 ? Math.floor(r) :
|
|
472
|
+
this.pageSize = typeof r == "number" && Number.isFinite(r) && r >= 1 ? Math.floor(r) : it, this.authToken = t?.token, this.securityByPassToken = t?.securityByPassToken, this.isSiteBuilder = t?.isSiteBuilder ?? !1, this.autoFormat = t?.autoFormat ?? !1, this.buildSrcset = t?.buildSrcset ?? !1, this.consistency = t?.consistency;
|
|
469
473
|
}
|
|
470
474
|
get totalDataCount() {
|
|
471
475
|
return this.totalCount;
|
|
@@ -474,34 +478,34 @@ var st = class {
|
|
|
474
478
|
this.securityByPassToken !== e && (this.securityByPassToken = e, this.resetPageCache());
|
|
475
479
|
}
|
|
476
480
|
setPageSize(e) {
|
|
477
|
-
let t = Number.isFinite(e) && e >= 1 ? Math.floor(e) :
|
|
481
|
+
let t = Number.isFinite(e) && e >= 1 ? Math.floor(e) : it;
|
|
478
482
|
if (this.pageSize === t) return;
|
|
479
483
|
let n = this.fetchedPages.size > 0;
|
|
480
484
|
n && t < this.pageSize || (this.pageSize = t, n && (this.requestEpoch += 1, this.fetchedPages.clear()));
|
|
481
485
|
}
|
|
482
486
|
async fetchImages({ end: e, extraFields: t = [], format: n, manualFormat: r = !0, start: i, transformations: a }) {
|
|
483
487
|
if (e < i || this.totalCount > 0 && e >= this.totalCount && (e = this.totalCount - 1, e < i)) return this.data;
|
|
484
|
-
let o = this.requestEpoch;
|
|
488
|
+
let o = this.requestEpoch, s = se(this.host.ownerDocument.defaultView);
|
|
485
489
|
if (!this.folderId || o !== this.requestEpoch) return this.data;
|
|
486
|
-
let
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
].filter((e) => !!e))],
|
|
491
|
-
for (let e =
|
|
490
|
+
let c = n ? `path_${n}` : void 0, l = `path_${W}`, u = `path_${G}`, d = s ? [l, u] : [...new Set([
|
|
491
|
+
c,
|
|
492
|
+
l,
|
|
493
|
+
u
|
|
494
|
+
].filter((e) => !!e))], f = Math.floor(i / this.pageSize) + 1, p = Math.floor(e / this.pageSize) + 1;
|
|
495
|
+
for (let e = f; e <= p; e++) {
|
|
492
496
|
if (this.fetchedPages.has(e)) continue;
|
|
493
|
-
let i = await
|
|
497
|
+
let i = await $e({
|
|
494
498
|
consistency: this.consistency,
|
|
495
499
|
countPerPage: this.pageSize,
|
|
496
500
|
directParentFolderIdentifier: this.folderId,
|
|
497
|
-
extraFields: [...t, ...
|
|
498
|
-
getPermanentAssetsPaths:
|
|
501
|
+
extraFields: [...t, ...d],
|
|
502
|
+
getPermanentAssetsPaths: ce(this.host.ownerDocument.defaultView),
|
|
499
503
|
isSiteBuilder: this.isSiteBuilder,
|
|
500
504
|
limitedDocTypes: [
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
+
k.Image,
|
|
506
|
+
k.Audio,
|
|
507
|
+
k.Video,
|
|
508
|
+
k.Multimedia
|
|
505
509
|
],
|
|
506
510
|
pageNumber: e,
|
|
507
511
|
searchTerm: "",
|
|
@@ -514,36 +518,37 @@ var st = class {
|
|
|
514
518
|
let e = Math.min(this.maxEnd, i.totalCount);
|
|
515
519
|
this.totalCount = e, this.data = Array.from({ length: e }, () => ({
|
|
516
520
|
alt: "",
|
|
517
|
-
id: `temp-${
|
|
521
|
+
id: `temp-${me()}`,
|
|
518
522
|
name: "",
|
|
519
523
|
src: ""
|
|
520
524
|
}));
|
|
521
525
|
}
|
|
522
|
-
let
|
|
526
|
+
let c = (e - 1) * this.pageSize;
|
|
523
527
|
for (let e = 0; e < i.items.length; e++) {
|
|
524
|
-
let o =
|
|
528
|
+
let o = c + e;
|
|
525
529
|
if (o < this.data.length) {
|
|
526
|
-
let
|
|
530
|
+
let c = i.items[e], { maxHeight: l, maxWidth: u, src: d, srcset: f } = lt({
|
|
527
531
|
autoFormat: this.autoFormat,
|
|
528
532
|
buildSrcset: this.buildSrcset,
|
|
529
|
-
docType:
|
|
530
|
-
extension:
|
|
533
|
+
docType: c.docType,
|
|
534
|
+
extension: c.extension,
|
|
531
535
|
format: n,
|
|
532
|
-
item:
|
|
536
|
+
item: c,
|
|
533
537
|
manualFormat: r,
|
|
534
|
-
size:
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
538
|
+
size: c.size,
|
|
539
|
+
useExpiringAssetUrls: s
|
|
540
|
+
}), p = d, m = f;
|
|
541
|
+
!s && p && a && a.length > 0 && (p = E(p, a), m = ""), this.data[o] = {
|
|
542
|
+
alt: c.name,
|
|
543
|
+
docType: c.docType,
|
|
544
|
+
extension: c.extension,
|
|
545
|
+
id: c.id,
|
|
546
|
+
maxHeight: l,
|
|
547
|
+
maxWidth: u,
|
|
548
|
+
name: c.name,
|
|
549
|
+
src: p,
|
|
550
|
+
srcset: m,
|
|
551
|
+
...t.reduce((e, t) => (e[t] = c[t] ?? "", e), {})
|
|
547
552
|
};
|
|
548
553
|
}
|
|
549
554
|
}
|
|
@@ -574,45 +579,46 @@ var st = class {
|
|
|
574
579
|
}
|
|
575
580
|
async fetchImagesByIDs({ extraFields: e = [], format: t, manualFormat: n = !0, recordIds: r, transformations: i }) {
|
|
576
581
|
if (r.length === 0) return [];
|
|
577
|
-
let a = t ? `path_${t}` : void 0,
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
].filter((e) => !!e))],
|
|
582
|
-
return (await
|
|
582
|
+
let a = se(this.host.ownerDocument.defaultView), o = t ? `path_${t}` : void 0, s = `path_${W}`, c = `path_${G}`, l = a ? [s, c] : [...new Set([
|
|
583
|
+
o,
|
|
584
|
+
s,
|
|
585
|
+
c
|
|
586
|
+
].filter((e) => !!e))], u = [z, ...a ? [] : [B]], d = [...e, L];
|
|
587
|
+
return (await Qe({
|
|
583
588
|
consistency: this.consistency,
|
|
584
589
|
extraFields: [
|
|
585
|
-
...
|
|
586
|
-
...
|
|
587
|
-
...
|
|
590
|
+
...d,
|
|
591
|
+
...l,
|
|
592
|
+
...u
|
|
588
593
|
].filter((e) => e !== ""),
|
|
589
|
-
getPermanentAssetsPaths:
|
|
594
|
+
getPermanentAssetsPaths: ce(this.host.ownerDocument.defaultView),
|
|
590
595
|
isSiteBuilder: this.isSiteBuilder,
|
|
591
596
|
recordIds: r,
|
|
592
597
|
securityByPassToken: this.securityByPassToken,
|
|
593
598
|
token: this.authToken
|
|
594
599
|
})).items.map((e) => {
|
|
595
|
-
let { maxHeight: r, maxWidth:
|
|
600
|
+
let { maxHeight: r, maxWidth: o, src: s, srcset: c } = lt({
|
|
596
601
|
autoFormat: this.autoFormat,
|
|
597
602
|
buildSrcset: this.buildSrcset,
|
|
598
|
-
docType: e[
|
|
599
|
-
extension: e[
|
|
603
|
+
docType: e[L],
|
|
604
|
+
extension: e[z],
|
|
600
605
|
format: t,
|
|
601
606
|
item: e,
|
|
602
607
|
manualFormat: n,
|
|
603
|
-
size: e[
|
|
604
|
-
|
|
605
|
-
|
|
608
|
+
size: e[B],
|
|
609
|
+
useExpiringAssetUrls: a
|
|
610
|
+
}), l = s, u = c;
|
|
611
|
+
return !a && l && i && i.length > 0 && (l = E(l, i), u = ""), {
|
|
606
612
|
alt: e.name,
|
|
607
|
-
docType: e[
|
|
613
|
+
docType: e[L],
|
|
608
614
|
extension: e["Document.FileExtension"] || "",
|
|
609
615
|
id: e.recordId,
|
|
610
616
|
maxHeight: r,
|
|
611
|
-
maxWidth:
|
|
617
|
+
maxWidth: o,
|
|
612
618
|
name: e.name,
|
|
613
619
|
src: l,
|
|
614
620
|
srcset: u,
|
|
615
|
-
...
|
|
621
|
+
...d.reduce((t, n) => (t[n] = e[n] ?? "", t), {})
|
|
616
622
|
};
|
|
617
623
|
});
|
|
618
624
|
}
|
|
@@ -668,39 +674,39 @@ var st = class {
|
|
|
668
674
|
resetFolderState() {
|
|
669
675
|
this.resetPageCache();
|
|
670
676
|
}
|
|
671
|
-
},
|
|
677
|
+
}, dt = t`.asset-link-format__details{--header-padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__details::part(icon){width:var(--cx-font-size-3x-large);height:var(--cx-font-size-3x-large);background-color:var(--cx-color-neutral-100);border-radius:var(--cx-border-radius-large);color:var(--cx-color-neutral-600);font-size:var(--cx-font-size-large);justify-content:center;align-items:center;display:flex}.asset-link-format__details::part(input-label){color:var(--cx-color-neutral-400);margin-inline-start:var(--cx-spacing-small)}.asset-link-format__header{padding:var(--cx-spacing-medium)}.asset-link-format__section-header{padding:0 var(--cx-spacing-medium);border-top:var(--section-header-border-width,1px) solid var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-50)}.asset-link-format__undo,.asset-link-format__reset{--color:var(--cx-color-primary);--background-color:transparent}.asset-link-format__footer,.asset-link-format__footer>slot{display:block}`, ft = t`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}`, K = class extends s {
|
|
672
678
|
constructor(...e) {
|
|
673
|
-
super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit =
|
|
674
|
-
[
|
|
679
|
+
super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit = O.Pixel, this.disabledApply = !1, this.noRatioModes = !1, this.showPositionPicker = !1, this.lastAppliedSetting = {
|
|
680
|
+
[O.Pixel]: {
|
|
675
681
|
height: 0,
|
|
676
682
|
percentageHeight: 100,
|
|
677
683
|
percentageWidth: 100,
|
|
678
|
-
unit:
|
|
684
|
+
unit: O.Pixel,
|
|
679
685
|
width: 0,
|
|
680
686
|
x: 0,
|
|
681
687
|
y: 0
|
|
682
688
|
},
|
|
683
|
-
[
|
|
689
|
+
[O.AspectRatio]: {
|
|
684
690
|
height: 1,
|
|
685
691
|
percentageHeight: 100,
|
|
686
692
|
percentageWidth: 100,
|
|
687
|
-
unit:
|
|
693
|
+
unit: O.AspectRatio,
|
|
688
694
|
width: 1,
|
|
689
695
|
x: 0,
|
|
690
696
|
y: 0
|
|
691
697
|
}
|
|
692
698
|
}, this.loading = !1, this.cropModes = [], this.focusModes = [], this.focusMode = "manual", this.cropMode = "free", this.position = v.CenterCenter, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
693
699
|
}
|
|
694
|
-
static #e = this.styles = [l,
|
|
700
|
+
static #e = this.styles = [l, ft];
|
|
695
701
|
static #t = this.dependencies = {
|
|
696
702
|
"cx-button": _,
|
|
697
|
-
"cx-details":
|
|
698
|
-
"cx-divider":
|
|
703
|
+
"cx-details": D,
|
|
704
|
+
"cx-divider": pe,
|
|
699
705
|
"cx-icon": h,
|
|
700
706
|
"cx-icon-button": p,
|
|
701
707
|
"cx-input": oe,
|
|
702
708
|
"cx-option": S,
|
|
703
|
-
"cx-position-picker":
|
|
709
|
+
"cx-position-picker": N,
|
|
704
710
|
"cx-select": w,
|
|
705
711
|
"cx-space": C,
|
|
706
712
|
"cx-typography": b
|
|
@@ -715,11 +721,11 @@ var st = class {
|
|
|
715
721
|
return;
|
|
716
722
|
}
|
|
717
723
|
if (this.keepAspectRatio) {
|
|
718
|
-
if (this.unit ===
|
|
724
|
+
if (this.unit === O.Pixel && this.width && this.height) {
|
|
719
725
|
this.aspectRatio = this.width / this.height;
|
|
720
726
|
return;
|
|
721
727
|
}
|
|
722
|
-
if (this.unit ===
|
|
728
|
+
if (this.unit === O.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
723
729
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
724
730
|
return;
|
|
725
731
|
}
|
|
@@ -748,9 +754,9 @@ var st = class {
|
|
|
748
754
|
}
|
|
749
755
|
this.invalidWidth = !1;
|
|
750
756
|
let t = Number(e.target.value);
|
|
751
|
-
this.unit ===
|
|
752
|
-
let n = this.unit ===
|
|
753
|
-
this.keepAspectRatio && (n = Math.round(t / this.aspectRatio), this.unit ===
|
|
757
|
+
this.unit === O.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1)), e.target.value = t.toString();
|
|
758
|
+
let n = this.unit === O.Pixel ? this.height : this.ratioHeight, r = !1;
|
|
759
|
+
this.keepAspectRatio && (n = Math.round(t / this.aspectRatio), this.unit === O.Pixel && n > this.maxHeight && (n = this.maxHeight, r = !0)), this.invalidHeight = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
754
760
|
breakAspectRatio: r,
|
|
755
761
|
height: n,
|
|
756
762
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -765,9 +771,9 @@ var st = class {
|
|
|
765
771
|
}
|
|
766
772
|
this.invalidHeight = !1;
|
|
767
773
|
let t = Number(e.target.value);
|
|
768
|
-
this.unit ===
|
|
769
|
-
let n = this.unit ===
|
|
770
|
-
this.keepAspectRatio && (n = Math.round(t * this.aspectRatio), this.unit ===
|
|
774
|
+
this.unit === O.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1)), e.target.value = t.toString();
|
|
775
|
+
let n = this.unit === O.Pixel ? this.width : this.ratioWidth, r = !1;
|
|
776
|
+
this.keepAspectRatio && (n = Math.round(t * this.aspectRatio), this.unit === O.Pixel && n > this.maxWidth && (n = this.maxWidth, r = !0)), this.invalidWidth = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
771
777
|
breakAspectRatio: r,
|
|
772
778
|
height: t,
|
|
773
779
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -778,28 +784,28 @@ var st = class {
|
|
|
778
784
|
onCropModeChange(e) {
|
|
779
785
|
let t = e.target.value, n = this.cropModes.find((e) => e.value === t)?.auto;
|
|
780
786
|
if (t === "free") this.selectedMode?.auto && this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
781
|
-
height: this.lastAppliedSetting[
|
|
787
|
+
height: this.lastAppliedSetting[O.Pixel].height,
|
|
782
788
|
keepAspectRatio: !1,
|
|
783
789
|
silent: !0,
|
|
784
|
-
unit:
|
|
785
|
-
width: this.lastAppliedSetting[
|
|
790
|
+
unit: O.Pixel,
|
|
791
|
+
width: this.lastAppliedSetting[O.Pixel].width
|
|
786
792
|
} });
|
|
787
793
|
else if (!n) {
|
|
788
794
|
let [e, n] = t.split(":").map(Number);
|
|
789
|
-
if (this.unit ===
|
|
795
|
+
if (this.unit === O.Pixel) {
|
|
790
796
|
let t = e, r = n;
|
|
791
797
|
Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && ({height: r, width: t} = re(this.maxWidth, this.maxHeight, e, n)), this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
792
798
|
height: r,
|
|
793
799
|
keepAspectRatio: !0,
|
|
794
800
|
silent: !0,
|
|
795
|
-
unit:
|
|
801
|
+
unit: O.Pixel,
|
|
796
802
|
width: t
|
|
797
803
|
} });
|
|
798
804
|
} else this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
799
805
|
height: n,
|
|
800
806
|
keepAspectRatio: !0,
|
|
801
807
|
silent: !0,
|
|
802
|
-
unit:
|
|
808
|
+
unit: O.AspectRatio,
|
|
803
809
|
width: e
|
|
804
810
|
} });
|
|
805
811
|
}
|
|
@@ -813,16 +819,16 @@ var st = class {
|
|
|
813
819
|
this.emit("cx-asset-link-format-crop-position-change", { detail: { position: this.positionPicker.value } });
|
|
814
820
|
}
|
|
815
821
|
onUnitChange(e) {
|
|
816
|
-
e.target.value ===
|
|
817
|
-
height: this.lastAppliedSetting[
|
|
822
|
+
e.target.value === O.AspectRatio ? this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
823
|
+
height: this.lastAppliedSetting[O.AspectRatio].height,
|
|
818
824
|
keepAspectRatio: this.keepAspectRatio,
|
|
819
|
-
unit:
|
|
820
|
-
width: this.lastAppliedSetting[
|
|
825
|
+
unit: O.AspectRatio,
|
|
826
|
+
width: this.lastAppliedSetting[O.AspectRatio].width
|
|
821
827
|
} }) : this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
822
|
-
height: this.lastAppliedSetting[
|
|
828
|
+
height: this.lastAppliedSetting[O.Pixel].height,
|
|
823
829
|
keepAspectRatio: this.keepAspectRatio,
|
|
824
|
-
unit:
|
|
825
|
-
width: this.lastAppliedSetting[
|
|
830
|
+
unit: O.Pixel,
|
|
831
|
+
width: this.lastAppliedSetting[O.Pixel].width
|
|
826
832
|
} }), this.emit("cx-asset-link-format-crop-mode-change", { detail: { mode: "free" } });
|
|
827
833
|
}
|
|
828
834
|
handleInputChange(e) {
|
|
@@ -844,10 +850,10 @@ var st = class {
|
|
|
844
850
|
}
|
|
845
851
|
handleAspectRatioClick() {
|
|
846
852
|
this.keepAspectRatio && this.cropMode !== "free" && this.emit("cx-asset-link-format-crop-mode-change", { detail: { mode: "free" } }), this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
847
|
-
height: this.unit ===
|
|
853
|
+
height: this.unit === O.Pixel ? this.height : this.ratioHeight,
|
|
848
854
|
keepAspectRatio: !this.keepAspectRatio,
|
|
849
855
|
unit: this.unit,
|
|
850
|
-
width: this.unit ===
|
|
856
|
+
width: this.unit === O.Pixel ? this.width : this.ratioWidth
|
|
851
857
|
} });
|
|
852
858
|
}
|
|
853
859
|
render() {
|
|
@@ -857,18 +863,18 @@ var st = class {
|
|
|
857
863
|
${x(n, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}<cx-space spacing="small"><div class="crop__input-group"><cx-input data-testid="cx-asset-link-format-crop-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: {
|
|
858
864
|
mask: Number,
|
|
859
865
|
min: 1
|
|
860
|
-
} }} value=${this.unit ===
|
|
866
|
+
} }} value=${this.unit === O.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-change=${this.handleInputChange} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
861
867
|
W
|
|
862
868
|
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-crop-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: {
|
|
863
869
|
mask: Number,
|
|
864
870
|
min: 1
|
|
865
|
-
} }} value=${this.unit ===
|
|
871
|
+
} }} value=${this.unit === O.Pixel ? this.height.toString() : this.ratioHeight.toString()} ?disabled=${this.loading} @cx-change=${this.handleInputChange} @cx-input=${this.handleHeightChange} required><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
866
872
|
H
|
|
867
|
-
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-unit" value=${this.unit} hoist class="crop__unit-select" ?disabled=${this.loading} @cx-change=${this.onUnitChange}><cx-option value=${
|
|
873
|
+
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-unit" value=${this.unit} hoist class="crop__unit-select" ?disabled=${this.loading} @cx-change=${this.onUnitChange}><cx-option value=${O.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${O.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`)}</cx-space>${m(this.focusModes.length > 0, () => e`<cx-select data-testid="cx-asset-link-format-crop-focus-mode" value=${this.focusMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onFocusModeChange} ?disabled=${this.loading || this.selectedMode?.disabledSize}>${x(this.focusModes, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}
|
|
868
874
|
${m(this.showPositionPicker && this.focusMode === "manual", () => e`<cx-position-picker data-testid="cx-asset-link-format-crop-position" value=${this.position} @cx-change=${this.onPositionChange}></cx-position-picker>`)}<cx-button data-testid="cx-asset-link-format-crop-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${g({ marginLeft: "auto" })} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
869
875
|
}
|
|
870
876
|
};
|
|
871
|
-
a([c(".details"), o("design:type",
|
|
877
|
+
a([c(".details"), o("design:type", D === void 0 ? Object : D)], K.prototype, "base", void 0), a([c("cx-position-picker"), o("design:type", N === void 0 ? Object : N)], K.prototype, "positionPicker", void 0), a([r({
|
|
872
878
|
reflect: !0,
|
|
873
879
|
type: Boolean
|
|
874
880
|
}), o("design:type", Boolean)], K.prototype, "open", void 0), a([r({
|
|
@@ -904,7 +910,7 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], K.prototype, "ba
|
|
|
904
910
|
}), o("design:type", Number)], K.prototype, "percentageHeight", void 0), a([r({
|
|
905
911
|
reflect: !0,
|
|
906
912
|
type: String
|
|
907
|
-
}), o("design:type",
|
|
913
|
+
}), o("design:type", O === void 0 ? Object : O)], K.prototype, "unit", void 0), a([r({
|
|
908
914
|
attribute: "disabled-apply",
|
|
909
915
|
reflect: !0,
|
|
910
916
|
type: Boolean
|
|
@@ -960,11 +966,11 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], K.prototype, "ba
|
|
|
960
966
|
o("design:paramtypes", []),
|
|
961
967
|
o("design:returntype", Promise)
|
|
962
968
|
], K.prototype, "handleOpenChange", null), K = a([u("cx-asset-link-format-crop")], K);
|
|
963
|
-
var
|
|
969
|
+
var pt = K, mt = t`.extension{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border:solid 1px var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-0);& cx-select{flex:1;width:100%}}`, q = class extends s {
|
|
964
970
|
constructor(...e) {
|
|
965
971
|
super(...e), this.localize = new d(this), this.value = "", this.items = [];
|
|
966
972
|
}
|
|
967
|
-
static #e = this.styles = [l,
|
|
973
|
+
static #e = this.styles = [l, mt];
|
|
968
974
|
static #t = this.dependencies = {
|
|
969
975
|
"cx-option": S,
|
|
970
976
|
"cx-select": w,
|
|
@@ -986,15 +992,15 @@ a([r({
|
|
|
986
992
|
reflect: !1,
|
|
987
993
|
type: Array
|
|
988
994
|
}), o("design:type", typeof Array > "u" ? Object : Array)], q.prototype, "items", void 0), q = a([u("cx-asset-link-format-extension")], q);
|
|
989
|
-
var
|
|
995
|
+
var ht = q, gt = t`cx-details::part(base){border-bottom-width:0}`, _t = "auto", J = class extends s {
|
|
990
996
|
constructor(...e) {
|
|
991
997
|
super(...e), this.localize = new d(this), this.open = !1, this.value = "", this.items = [], this.canAutoFormat = !1, this.autoFormat = !1, this.loading = !1, this.scopedValue = "";
|
|
992
998
|
}
|
|
993
|
-
static #e = this.styles = [l,
|
|
999
|
+
static #e = this.styles = [l, gt];
|
|
994
1000
|
static #t = this.dependencies = {
|
|
995
1001
|
"cx-button": _,
|
|
996
|
-
"cx-details":
|
|
997
|
-
"cx-divider":
|
|
1002
|
+
"cx-details": D,
|
|
1003
|
+
"cx-divider": pe,
|
|
998
1004
|
"cx-icon": h,
|
|
999
1005
|
"cx-option": S,
|
|
1000
1006
|
"cx-select": w,
|
|
@@ -1002,7 +1008,7 @@ var ft = q, pt = t`cx-details::part(base){border-bottom-width:0}`, mt = "auto",
|
|
|
1002
1008
|
"cx-typography": b
|
|
1003
1009
|
};
|
|
1004
1010
|
get committedValue() {
|
|
1005
|
-
return this.autoFormat ?
|
|
1011
|
+
return this.autoFormat ? _t : this.value;
|
|
1006
1012
|
}
|
|
1007
1013
|
handleValueChange() {
|
|
1008
1014
|
this.scopedValue = this.committedValue;
|
|
@@ -1034,10 +1040,10 @@ var ft = q, pt = t`cx-details::part(base){border-bottom-width:0}`, mt = "auto",
|
|
|
1034
1040
|
}
|
|
1035
1041
|
render() {
|
|
1036
1042
|
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("format")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small" class="format"><cx-select data-label=${this.localize.term("imageFormat")} data-testid="cx-asset-link-format-proxy-select" value=${this.scopedValue} hoist @cx-change=${this.handleProxyChange} ?disabled=${this.loading}>${x(this.items, (e) => e.id, (t) => e`<cx-option value=${t.id}>${t.proxyLabel}</cx-option>`)}
|
|
1037
|
-
${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${
|
|
1043
|
+
${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${_t}>${this.localize.term("auto")}</cx-option>`, () => n)}</cx-select><cx-button data-testid="cx-asset-link-format-proxy-apply" variant="primary" style=${g({ "margin-left": "auto" })} ?disabled=${this.scopedValue === this.committedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1038
1044
|
}
|
|
1039
1045
|
};
|
|
1040
|
-
a([c(".details"), o("design:type",
|
|
1046
|
+
a([c(".details"), o("design:type", D === void 0 ? Object : D)], J.prototype, "base", void 0), a([r({
|
|
1041
1047
|
reflect: !0,
|
|
1042
1048
|
type: Boolean
|
|
1043
1049
|
}), o("design:type", Object)], J.prototype, "open", void 0), a([r({
|
|
@@ -1069,14 +1075,14 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], J.prototype, "ba
|
|
|
1069
1075
|
o("design:paramtypes", []),
|
|
1070
1076
|
o("design:returntype", void 0)
|
|
1071
1077
|
], J.prototype, "handleOpenChange", null), J = a([u("cx-asset-link-format-proxy")], J);
|
|
1072
|
-
var
|
|
1078
|
+
var vt = J, yt = t`cx-details::part(base){border-bottom-width:0}`, Y = class extends s {
|
|
1073
1079
|
constructor(...e) {
|
|
1074
1080
|
super(...e), this.localize = new d(this), this.open = !1, this.value = 100, this.loading = !1, this.scopedValue = 100;
|
|
1075
1081
|
}
|
|
1076
|
-
static #e = this.styles = [l,
|
|
1082
|
+
static #e = this.styles = [l, yt];
|
|
1077
1083
|
static #t = this.dependencies = {
|
|
1078
1084
|
"cx-button": _,
|
|
1079
|
-
"cx-details":
|
|
1085
|
+
"cx-details": D,
|
|
1080
1086
|
"cx-icon": h,
|
|
1081
1087
|
"cx-input": oe,
|
|
1082
1088
|
"cx-space": C,
|
|
@@ -1110,7 +1116,7 @@ var ht = J, gt = t`cx-details::part(base){border-bottom-width:0}`, Y = class ext
|
|
|
1110
1116
|
} }} value=${this.scopedValue.toString()} style=${g({ flex: "1" })} @cx-input=${this.handleQualityChange}></cx-input></cx-tooltip><cx-button data-testid="cx-asset-link-format-quality-apply" variant="primary" ?disabled=${this.invalidValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1111
1117
|
}
|
|
1112
1118
|
};
|
|
1113
|
-
a([c(".details"), o("design:type",
|
|
1119
|
+
a([c(".details"), o("design:type", D === void 0 ? Object : D)], Y.prototype, "base", void 0), a([r({
|
|
1114
1120
|
reflect: !0,
|
|
1115
1121
|
type: Boolean
|
|
1116
1122
|
}), o("design:type", Object)], Y.prototype, "open", void 0), a([r({
|
|
@@ -1125,23 +1131,23 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], Y.prototype, "ba
|
|
|
1125
1131
|
o("design:paramtypes", []),
|
|
1126
1132
|
o("design:returntype", void 0)
|
|
1127
1133
|
], Y.prototype, "handleValueChange", null), Y = a([u("cx-asset-link-format-quality")], Y);
|
|
1128
|
-
var
|
|
1134
|
+
var bt = Y, xt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.resize__unit-select{width:120px}.resize__input-group{flex:1;display:flex}`, X = class extends s {
|
|
1129
1135
|
constructor(...e) {
|
|
1130
|
-
super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit =
|
|
1131
|
-
[
|
|
1136
|
+
super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit = O.Pixel, this.lastAppliedSetting = {
|
|
1137
|
+
[O.Pixel]: {
|
|
1132
1138
|
height: 0,
|
|
1133
1139
|
width: 0
|
|
1134
1140
|
},
|
|
1135
|
-
[
|
|
1141
|
+
[O.AspectRatio]: {
|
|
1136
1142
|
height: 1,
|
|
1137
1143
|
width: 1
|
|
1138
1144
|
}
|
|
1139
1145
|
}, this.loading = !1, this.noRatioModes = !1, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
1140
1146
|
}
|
|
1141
|
-
static #e = this.styles = [l,
|
|
1147
|
+
static #e = this.styles = [l, xt];
|
|
1142
1148
|
static #t = this.dependencies = {
|
|
1143
1149
|
"cx-button": _,
|
|
1144
|
-
"cx-details":
|
|
1150
|
+
"cx-details": D,
|
|
1145
1151
|
"cx-icon": h,
|
|
1146
1152
|
"cx-icon-button": p,
|
|
1147
1153
|
"cx-input": oe,
|
|
@@ -1156,11 +1162,11 @@ var _t = Y, vt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1156
1162
|
async handleCropModeChange() {
|
|
1157
1163
|
let e = Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && this.maxWidth > 0 && this.maxHeight > 0;
|
|
1158
1164
|
if (this.keepAspectRatio) {
|
|
1159
|
-
if (this.unit ===
|
|
1165
|
+
if (this.unit === O.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
1160
1166
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
1161
1167
|
return;
|
|
1162
1168
|
}
|
|
1163
|
-
if (this.unit ===
|
|
1169
|
+
if (this.unit === O.Pixel && !e && this.width && this.height) {
|
|
1164
1170
|
this.aspectRatio = this.width / this.height;
|
|
1165
1171
|
return;
|
|
1166
1172
|
}
|
|
@@ -1189,8 +1195,8 @@ var _t = Y, vt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1189
1195
|
}
|
|
1190
1196
|
this.invalidWidth = !1;
|
|
1191
1197
|
let t = Number(e.target.value);
|
|
1192
|
-
this.unit ===
|
|
1193
|
-
let n = this.unit ===
|
|
1198
|
+
this.unit === O.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1)), e.target.value = t.toString();
|
|
1199
|
+
let n = this.unit === O.Pixel ? this.height : this.ratioHeight;
|
|
1194
1200
|
this.keepAspectRatio && (n = Math.min(Math.round(t / this.aspectRatio), this.maxHeight), this.invalidHeight = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1195
1201
|
height: n,
|
|
1196
1202
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -1205,8 +1211,8 @@ var _t = Y, vt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1205
1211
|
}
|
|
1206
1212
|
this.invalidHeight = !1;
|
|
1207
1213
|
let t = Number(e.target.value);
|
|
1208
|
-
this.unit ===
|
|
1209
|
-
let n = this.unit ===
|
|
1214
|
+
this.unit === O.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1)), e.target.value = t.toString();
|
|
1215
|
+
let n = this.unit === O.Pixel ? this.width : this.ratioWidth;
|
|
1210
1216
|
this.keepAspectRatio && (n = Math.min(Math.round(t * this.aspectRatio), this.maxWidth), this.invalidWidth = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1211
1217
|
height: t,
|
|
1212
1218
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -1215,16 +1221,16 @@ var _t = Y, vt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1215
1221
|
} });
|
|
1216
1222
|
}
|
|
1217
1223
|
onUnitChange(e) {
|
|
1218
|
-
e.target.value ===
|
|
1219
|
-
height: this.lastAppliedSetting[
|
|
1224
|
+
e.target.value === O.AspectRatio ? this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1225
|
+
height: this.lastAppliedSetting[O.AspectRatio].height,
|
|
1220
1226
|
keepAspectRatio: this.keepAspectRatio,
|
|
1221
|
-
unit:
|
|
1222
|
-
width: this.lastAppliedSetting[
|
|
1227
|
+
unit: O.AspectRatio,
|
|
1228
|
+
width: this.lastAppliedSetting[O.AspectRatio].width
|
|
1223
1229
|
} }) : this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1224
|
-
height: this.lastAppliedSetting[
|
|
1230
|
+
height: this.lastAppliedSetting[O.Pixel].height,
|
|
1225
1231
|
keepAspectRatio: this.keepAspectRatio,
|
|
1226
|
-
unit:
|
|
1227
|
-
width: this.lastAppliedSetting[
|
|
1232
|
+
unit: O.Pixel,
|
|
1233
|
+
width: this.lastAppliedSetting[O.Pixel].width
|
|
1228
1234
|
} });
|
|
1229
1235
|
}
|
|
1230
1236
|
handleApply() {
|
|
@@ -1242,27 +1248,27 @@ var _t = Y, vt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1242
1248
|
}
|
|
1243
1249
|
handleAspectRatioClick() {
|
|
1244
1250
|
this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1245
|
-
height: this.unit ===
|
|
1251
|
+
height: this.unit === O.Pixel ? this.height : this.ratioHeight,
|
|
1246
1252
|
keepAspectRatio: !this.keepAspectRatio,
|
|
1247
1253
|
unit: this.unit,
|
|
1248
|
-
width: this.unit ===
|
|
1254
|
+
width: this.unit === O.Pixel ? this.width : this.ratioWidth
|
|
1249
1255
|
} });
|
|
1250
1256
|
}
|
|
1251
1257
|
render() {
|
|
1252
1258
|
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="aspect_ratio"></cx-icon></div><cx-typography variant="body2">${this.localize.term("resize")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small"><cx-space spacing="small"><div class="resize__input-group"><cx-input data-testid="cx-asset-link-format-resize-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: {
|
|
1253
1259
|
mask: Number,
|
|
1254
1260
|
min: 1
|
|
1255
|
-
} }} value=${this.unit ===
|
|
1261
|
+
} }} value=${this.unit === O.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1256
1262
|
W
|
|
1257
1263
|
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-resize-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-resize-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: {
|
|
1258
1264
|
mask: Number,
|
|
1259
1265
|
min: 1
|
|
1260
|
-
} }} value=${this.unit ===
|
|
1266
|
+
} }} value=${this.unit === O.Pixel ? this.height.toString() : this.ratioHeight.toString()} @cx-input=${this.handleHeightChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1261
1267
|
H
|
|
1262
|
-
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-resize-unit" value=${this.unit} hoist class="resize__unit-select" @cx-change=${this.onUnitChange}><cx-option value=${
|
|
1268
|
+
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-resize-unit" value=${this.unit} hoist class="resize__unit-select" @cx-change=${this.onUnitChange}><cx-option value=${O.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${O.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`)}</cx-space><cx-button data-testid="cx-asset-link-format-resize-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${g({ marginLeft: "auto" })} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1263
1269
|
}
|
|
1264
1270
|
};
|
|
1265
|
-
a([c(".details"), o("design:type",
|
|
1271
|
+
a([c(".details"), o("design:type", D === void 0 ? Object : D)], X.prototype, "base", void 0), a([r({
|
|
1266
1272
|
reflect: !0,
|
|
1267
1273
|
type: Boolean
|
|
1268
1274
|
}), o("design:type", Boolean)], X.prototype, "open", void 0), a([r({
|
|
@@ -1290,7 +1296,7 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], X.prototype, "ba
|
|
|
1290
1296
|
}), o("design:type", Number)], X.prototype, "ratioHeight", void 0), a([r({
|
|
1291
1297
|
reflect: !0,
|
|
1292
1298
|
type: String
|
|
1293
|
-
}), o("design:type",
|
|
1299
|
+
}), o("design:type", O === void 0 ? Object : O)], X.prototype, "unit", void 0), a([r({
|
|
1294
1300
|
attribute: "last-applied-setting",
|
|
1295
1301
|
reflect: !1,
|
|
1296
1302
|
type: Object
|
|
@@ -1319,15 +1325,15 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], X.prototype, "ba
|
|
|
1319
1325
|
o("design:paramtypes", []),
|
|
1320
1326
|
o("design:returntype", Promise)
|
|
1321
1327
|
], X.prototype, "handleOpenChange", null), X = a([u("cx-asset-link-format-resize")], X);
|
|
1322
|
-
var
|
|
1328
|
+
var St = X, Ct = t`cx-details::part(base){border-bottom-width:0}`, Z = class extends s {
|
|
1323
1329
|
constructor(...e) {
|
|
1324
1330
|
super(...e), this.localize = new d(this), this.open = !1, this.value = 0, this.defaultValue = 0, this.loading = !1, this.lastAppliedValue = 0;
|
|
1325
1331
|
}
|
|
1326
|
-
static #e = this.styles = [l,
|
|
1332
|
+
static #e = this.styles = [l, Ct];
|
|
1327
1333
|
static #t = this.dependencies = {
|
|
1328
1334
|
"cx-button": _,
|
|
1329
1335
|
"cx-button-group": ie,
|
|
1330
|
-
"cx-details":
|
|
1336
|
+
"cx-details": D,
|
|
1331
1337
|
"cx-icon": h,
|
|
1332
1338
|
"cx-icon-button": p,
|
|
1333
1339
|
"cx-space": C,
|
|
@@ -1366,7 +1372,7 @@ var yt = X, bt = t`cx-details::part(base){border-bottom-width:0}`, Z = class ext
|
|
|
1366
1372
|
})} @cx-input=${this.handleRotationChange}></cx-input><cx-button data-testid="cx-asset-link-format-rotation-apply" variant="primary" ?disabled=${this.value === this.lastAppliedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1367
1373
|
}
|
|
1368
1374
|
};
|
|
1369
|
-
a([c(".details"), o("design:type",
|
|
1375
|
+
a([c(".details"), o("design:type", D === void 0 ? Object : D)], Z.prototype, "base", void 0), a([r({
|
|
1370
1376
|
reflect: !0,
|
|
1371
1377
|
type: Boolean
|
|
1372
1378
|
}), o("design:type", Object)], Z.prototype, "open", void 0), a([r({
|
|
@@ -1389,15 +1395,15 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], Z.prototype, "ba
|
|
|
1389
1395
|
o("design:paramtypes", []),
|
|
1390
1396
|
o("design:returntype", void 0)
|
|
1391
1397
|
], Z.prototype, "handleOpenChange", null), Z = a([u("cx-asset-link-format-rotation")], Z);
|
|
1392
|
-
var
|
|
1398
|
+
var wt = Z, Tt = t`cx-details::part(base){border-bottom-width:0}`, Q = class extends s {
|
|
1393
1399
|
constructor(...e) {
|
|
1394
1400
|
super(...e), this.localize = new d(this), this.open = !1, this.value = !1;
|
|
1395
1401
|
}
|
|
1396
|
-
static #e = this.styles = [l,
|
|
1402
|
+
static #e = this.styles = [l, Tt];
|
|
1397
1403
|
static #t = this.dependencies = {
|
|
1398
1404
|
"cx-button": _,
|
|
1399
1405
|
"cx-checkbox": ae,
|
|
1400
|
-
"cx-details":
|
|
1406
|
+
"cx-details": D,
|
|
1401
1407
|
"cx-icon": h,
|
|
1402
1408
|
"cx-space": C,
|
|
1403
1409
|
"cx-tooltip": te,
|
|
@@ -1416,47 +1422,47 @@ var xt = Z, St = t`cx-details::part(base){border-bottom-width:0}`, Q = class ext
|
|
|
1416
1422
|
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="short_text"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("metadata")}</cx-typography></cx-space><cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-metadata-tooltip" content=${this.localize.term("metadataHelpText")} hoist><cx-checkbox data-testid="cx-asset-link-format-metadata" class="details__checkbox" ?checked=${this.value} @cx-change=${this.handleApply}>${this.localize.term("preserveMetadata")}</cx-checkbox></cx-tooltip></cx-space></cx-details>`;
|
|
1417
1423
|
}
|
|
1418
1424
|
};
|
|
1419
|
-
a([c(".details"), o("design:type",
|
|
1425
|
+
a([c(".details"), o("design:type", D === void 0 ? Object : D)], Q.prototype, "base", void 0), a([r({
|
|
1420
1426
|
reflect: !0,
|
|
1421
1427
|
type: Boolean
|
|
1422
1428
|
}), o("design:type", Object)], Q.prototype, "open", void 0), a([r({
|
|
1423
1429
|
reflect: !0,
|
|
1424
1430
|
type: Boolean
|
|
1425
1431
|
}), o("design:type", Object)], Q.prototype, "value", void 0), Q = a([u("cx-asset-link-format-metadata")], Q);
|
|
1426
|
-
var
|
|
1427
|
-
static #e =
|
|
1428
|
-
static #t = this.styles = [l,
|
|
1432
|
+
var Et = Q, Dt, $ = class extends s {
|
|
1433
|
+
static #e = Dt = this;
|
|
1434
|
+
static #t = this.styles = [l, dt];
|
|
1429
1435
|
static #n = this.dependencies = {
|
|
1430
|
-
"cx-asset-link-format-crop":
|
|
1431
|
-
"cx-asset-link-format-extension":
|
|
1432
|
-
"cx-asset-link-format-metadata":
|
|
1433
|
-
"cx-asset-link-format-proxy":
|
|
1434
|
-
"cx-asset-link-format-quality":
|
|
1435
|
-
"cx-asset-link-format-resize":
|
|
1436
|
-
"cx-asset-link-format-rotation":
|
|
1436
|
+
"cx-asset-link-format-crop": pt,
|
|
1437
|
+
"cx-asset-link-format-extension": ht,
|
|
1438
|
+
"cx-asset-link-format-metadata": Et,
|
|
1439
|
+
"cx-asset-link-format-proxy": vt,
|
|
1440
|
+
"cx-asset-link-format-quality": bt,
|
|
1441
|
+
"cx-asset-link-format-resize": St,
|
|
1442
|
+
"cx-asset-link-format-rotation": wt,
|
|
1437
1443
|
"cx-button": _,
|
|
1438
1444
|
"cx-space": C,
|
|
1439
1445
|
"cx-typography": b
|
|
1440
1446
|
};
|
|
1441
1447
|
static getTransformExtension(e) {
|
|
1442
|
-
return !e ||
|
|
1448
|
+
return !e || st(e) ? e : "jpg";
|
|
1443
1449
|
}
|
|
1444
1450
|
get hasUnfrozenTransformations() {
|
|
1445
1451
|
return !(this.transformations.length === 0 || this.frozenIndex !== void 0 && this.frozenIndex >= this.transformations.length - 1);
|
|
1446
1452
|
}
|
|
1447
1453
|
get lastAppliedCropUnit() {
|
|
1448
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1454
|
+
return this.transformations.findLast((e) => e.key === A.Crop)?.value.unit ?? O.Pixel;
|
|
1449
1455
|
}
|
|
1450
1456
|
get lastAppliedCropFocusMode() {
|
|
1451
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1457
|
+
return this.transformations.findLast((e) => e.key === A.Crop)?.value.focusMode ?? "manual";
|
|
1452
1458
|
}
|
|
1453
1459
|
get lastAppliedCropPosition() {
|
|
1454
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1460
|
+
return this.transformations.findLast((e) => e.key === A.Crop)?.value.position ?? v.CenterCenter;
|
|
1455
1461
|
}
|
|
1456
1462
|
get disabledCropApply() {
|
|
1457
1463
|
if (!this.asset && this.cropSize.unit !== this.lastAppliedCropUnit) return !1;
|
|
1458
|
-
if (this.cropSize.unit ===
|
|
1459
|
-
let e = this.lastCropSize[
|
|
1464
|
+
if (this.cropSize.unit === O.AspectRatio && !this.asset) {
|
|
1465
|
+
let e = this.lastCropSize[O.AspectRatio];
|
|
1460
1466
|
return this.cropSize.ratioWidth === e.width && this.cropSize.ratioHeight === e.height && this.cropSize.focusMode === this.lastAppliedCropFocusMode && this.cropSize.position === this.lastAppliedCropPosition;
|
|
1461
1467
|
}
|
|
1462
1468
|
if (!this.asset && this.cropSize.focusMode !== this.lastAppliedCropFocusMode || !this.asset && this.cropSize.position !== this.lastAppliedCropPosition) return !1;
|
|
@@ -1467,7 +1473,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1467
1473
|
"width",
|
|
1468
1474
|
"x",
|
|
1469
1475
|
"y"
|
|
1470
|
-
]) if (this.cropSize[e] !== this.lastCropSize[
|
|
1476
|
+
]) if (this.cropSize[e] !== this.lastCropSize[O.Pixel][e]) return !1;
|
|
1471
1477
|
return !0;
|
|
1472
1478
|
}
|
|
1473
1479
|
get formats() {
|
|
@@ -1481,22 +1487,22 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1481
1487
|
}
|
|
1482
1488
|
get lastCropSize() {
|
|
1483
1489
|
if (!this.asset) {
|
|
1484
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1485
|
-
if (e?.value.unit ===
|
|
1486
|
-
[
|
|
1490
|
+
let e = this.transformations.findLast((e) => e.key === A.Crop);
|
|
1491
|
+
if (e?.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
|
|
1492
|
+
[O.AspectRatio]: {
|
|
1487
1493
|
height: e.value.ratioHeight,
|
|
1488
1494
|
percentageHeight: 100,
|
|
1489
1495
|
percentageWidth: 100,
|
|
1490
|
-
unit:
|
|
1496
|
+
unit: O.AspectRatio,
|
|
1491
1497
|
width: e.value.ratioWidth,
|
|
1492
1498
|
x: 0,
|
|
1493
1499
|
y: 0
|
|
1494
1500
|
},
|
|
1495
|
-
[
|
|
1501
|
+
[O.Pixel]: {
|
|
1496
1502
|
height: 1,
|
|
1497
1503
|
percentageHeight: 100,
|
|
1498
1504
|
percentageWidth: 100,
|
|
1499
|
-
unit:
|
|
1505
|
+
unit: O.Pixel,
|
|
1500
1506
|
width: 1,
|
|
1501
1507
|
x: 0,
|
|
1502
1508
|
y: 0
|
|
@@ -1505,20 +1511,20 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1505
1511
|
if (e?.value.width && e?.value.height) {
|
|
1506
1512
|
let { height: t, width: n, x: r = 0, y: i = 0 } = e.value, a = y(n, t);
|
|
1507
1513
|
return {
|
|
1508
|
-
[
|
|
1514
|
+
[O.AspectRatio]: {
|
|
1509
1515
|
height: a.height,
|
|
1510
1516
|
percentageHeight: 100,
|
|
1511
1517
|
percentageWidth: 100,
|
|
1512
|
-
unit:
|
|
1518
|
+
unit: O.AspectRatio,
|
|
1513
1519
|
width: a.width,
|
|
1514
1520
|
x: 0,
|
|
1515
1521
|
y: 0
|
|
1516
1522
|
},
|
|
1517
|
-
[
|
|
1523
|
+
[O.Pixel]: {
|
|
1518
1524
|
height: t,
|
|
1519
1525
|
percentageHeight: 100,
|
|
1520
1526
|
percentageWidth: 100,
|
|
1521
|
-
unit:
|
|
1527
|
+
unit: O.Pixel,
|
|
1522
1528
|
width: n,
|
|
1523
1529
|
x: r,
|
|
1524
1530
|
y: i
|
|
@@ -1531,20 +1537,20 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1531
1537
|
width: 1
|
|
1532
1538
|
};
|
|
1533
1539
|
return {
|
|
1534
|
-
[
|
|
1540
|
+
[O.AspectRatio]: {
|
|
1535
1541
|
height: e.height,
|
|
1536
1542
|
percentageHeight: 100,
|
|
1537
1543
|
percentageWidth: 100,
|
|
1538
|
-
unit:
|
|
1544
|
+
unit: O.AspectRatio,
|
|
1539
1545
|
width: e.width,
|
|
1540
1546
|
x: 0,
|
|
1541
1547
|
y: 0
|
|
1542
1548
|
},
|
|
1543
|
-
[
|
|
1549
|
+
[O.Pixel]: {
|
|
1544
1550
|
height: this.lastImageSize.height,
|
|
1545
1551
|
percentageHeight: 100,
|
|
1546
1552
|
percentageWidth: 100,
|
|
1547
|
-
unit:
|
|
1553
|
+
unit: O.Pixel,
|
|
1548
1554
|
width: this.lastImageSize.width,
|
|
1549
1555
|
x: 0,
|
|
1550
1556
|
y: 0
|
|
@@ -1553,30 +1559,30 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1553
1559
|
}
|
|
1554
1560
|
get lastResizeSize() {
|
|
1555
1561
|
if (!this.asset) {
|
|
1556
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1557
|
-
if (e?.value.unit ===
|
|
1558
|
-
[
|
|
1562
|
+
let e = this.transformations.findLast((e) => e.key === A.Resize);
|
|
1563
|
+
if (e?.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
|
|
1564
|
+
[O.AspectRatio]: {
|
|
1559
1565
|
height: e.value.ratioHeight,
|
|
1560
|
-
unit:
|
|
1566
|
+
unit: O.AspectRatio,
|
|
1561
1567
|
width: e.value.ratioWidth
|
|
1562
1568
|
},
|
|
1563
|
-
[
|
|
1569
|
+
[O.Pixel]: {
|
|
1564
1570
|
height: 1,
|
|
1565
|
-
unit:
|
|
1571
|
+
unit: O.Pixel,
|
|
1566
1572
|
width: 1
|
|
1567
1573
|
}
|
|
1568
1574
|
};
|
|
1569
1575
|
if (e?.value.width && e?.value.height) {
|
|
1570
1576
|
let { height: t, width: n } = e.value, r = y(n, t);
|
|
1571
1577
|
return {
|
|
1572
|
-
[
|
|
1578
|
+
[O.AspectRatio]: {
|
|
1573
1579
|
height: r.height,
|
|
1574
|
-
unit:
|
|
1580
|
+
unit: O.AspectRatio,
|
|
1575
1581
|
width: r.width
|
|
1576
1582
|
},
|
|
1577
|
-
[
|
|
1583
|
+
[O.Pixel]: {
|
|
1578
1584
|
height: t,
|
|
1579
|
-
unit:
|
|
1585
|
+
unit: O.Pixel,
|
|
1580
1586
|
width: n
|
|
1581
1587
|
}
|
|
1582
1588
|
};
|
|
@@ -1587,23 +1593,23 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1587
1593
|
width: 1
|
|
1588
1594
|
};
|
|
1589
1595
|
return {
|
|
1590
|
-
[
|
|
1596
|
+
[O.AspectRatio]: {
|
|
1591
1597
|
height: e.height,
|
|
1592
|
-
unit:
|
|
1598
|
+
unit: O.AspectRatio,
|
|
1593
1599
|
width: e.width
|
|
1594
1600
|
},
|
|
1595
|
-
[
|
|
1601
|
+
[O.Pixel]: {
|
|
1596
1602
|
height: this.lastImageSize.height,
|
|
1597
|
-
unit:
|
|
1603
|
+
unit: O.Pixel,
|
|
1598
1604
|
width: this.lastImageSize.width
|
|
1599
1605
|
}
|
|
1600
1606
|
};
|
|
1601
1607
|
}
|
|
1602
1608
|
get lastRotation() {
|
|
1603
|
-
return this.asset ? 0 : this.transformations.findLast((e) => e.key ===
|
|
1609
|
+
return this.asset ? 0 : this.transformations.findLast((e) => e.key === A.Rotate)?.value.rotation ?? 0;
|
|
1604
1610
|
}
|
|
1605
1611
|
get transformationString() {
|
|
1606
|
-
return
|
|
1612
|
+
return T({
|
|
1607
1613
|
asset: this.asset,
|
|
1608
1614
|
baseUrl: "",
|
|
1609
1615
|
parameters: this.parameters,
|
|
@@ -1679,7 +1685,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1679
1685
|
keepAspectRatio: !0,
|
|
1680
1686
|
ratioHeight: 1,
|
|
1681
1687
|
ratioWidth: 1,
|
|
1682
|
-
unit:
|
|
1688
|
+
unit: O.Pixel,
|
|
1683
1689
|
width: 1
|
|
1684
1690
|
}, this.cropSize = {
|
|
1685
1691
|
cropMode: "free",
|
|
@@ -1691,14 +1697,14 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1691
1697
|
position: v.CenterCenter,
|
|
1692
1698
|
ratioHeight: 1,
|
|
1693
1699
|
ratioWidth: 1,
|
|
1694
|
-
unit:
|
|
1700
|
+
unit: O.Pixel,
|
|
1695
1701
|
width: 1,
|
|
1696
1702
|
x: 0,
|
|
1697
1703
|
y: 0
|
|
1698
1704
|
}, this.rotation = 0, this.defaultSize = {
|
|
1699
1705
|
height: 0,
|
|
1700
1706
|
width: 0
|
|
1701
|
-
}, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.apiGetTransformAssetLink =
|
|
1707
|
+
}, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.apiGetTransformAssetLink = Ye, this.apiGetCropFocusMode = et, this.onCropComplete = this.onCropComplete.bind(this), this.onCropDragStart = this.onCropDragStart.bind(this);
|
|
1702
1708
|
}
|
|
1703
1709
|
runConnectedCallback() {
|
|
1704
1710
|
this.hasUpdated && (this.handleCropperSelectorChange(), this.cropperElement && (this.cropperElement.addEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.addEventListener("cx-cropper-crop-drag-start", this.onCropDragStart)));
|
|
@@ -1714,7 +1720,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1714
1720
|
if (e.has("activeSetting") && this.handleActiveSettingChange(), e.has("selectedFormat") && this.handleSelectedFormatChange(), e.has("resizeSize") && this.handleResizeSizeChange(), e.has("cropSize") && this.handleCropSizeChange(), e.has("rotation") && this.handleRotationChange(), e.has("cropperElement") && this.handleCropperElementChange(), e.has("selectedFormat")) {
|
|
1715
1721
|
if (!this.asset || !this.selectedFormat || this.selectedFormat.extension === e.get("selectedFormat")?.extension) return;
|
|
1716
1722
|
this.loading = !0, this.requestTransformAsset().then((e) => {
|
|
1717
|
-
this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction ===
|
|
1723
|
+
this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction === A.Rotate && (this.rotation = 0), this.lastAction = void 0, this.lastImageSize = {
|
|
1718
1724
|
height: e.height,
|
|
1719
1725
|
width: e.width
|
|
1720
1726
|
}, this.selectedFormat = {
|
|
@@ -1724,7 +1730,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1724
1730
|
width: e.width
|
|
1725
1731
|
});
|
|
1726
1732
|
});
|
|
1727
|
-
let t =
|
|
1733
|
+
let t = T({
|
|
1728
1734
|
asset: this.asset,
|
|
1729
1735
|
baseUrl: "",
|
|
1730
1736
|
extension: this.selectedFormat.extension,
|
|
@@ -1748,7 +1754,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1748
1754
|
get transformRequestOptions() {
|
|
1749
1755
|
return {
|
|
1750
1756
|
assetId: this.asset?.id ?? "",
|
|
1751
|
-
extension:
|
|
1757
|
+
extension: Dt.getTransformExtension(this.selectedFormat?.extension ?? ""),
|
|
1752
1758
|
format: this.proxies?.find((e) => e.id === this.selectedProxy)?.proxyName ?? "",
|
|
1753
1759
|
siteUrl: this.baseUrl,
|
|
1754
1760
|
token: this.token,
|
|
@@ -1786,7 +1792,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1786
1792
|
}
|
|
1787
1793
|
async handleTransformationsChange() {
|
|
1788
1794
|
if (await this.updateComplete, !this.asset) {
|
|
1789
|
-
this.emit("cx-asset-link-format-change", { detail:
|
|
1795
|
+
this.emit("cx-asset-link-format-change", { detail: T({
|
|
1790
1796
|
asset: this.asset,
|
|
1791
1797
|
baseUrl: "",
|
|
1792
1798
|
options: { omitZeroXY: !0 },
|
|
@@ -1794,8 +1800,8 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1794
1800
|
transformations: this.transformations,
|
|
1795
1801
|
useSession: this.useSession
|
|
1796
1802
|
}).replace(/\/t\//g, "") });
|
|
1797
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1798
|
-
if (e?.value.unit ===
|
|
1803
|
+
let e = this.transformations.findLast((e) => e.key === A.Crop && (e.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width && e.value.height));
|
|
1804
|
+
if (e?.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) {
|
|
1799
1805
|
let { focusMode: t, position: n, ratioHeight: r, ratioWidth: i } = e.value;
|
|
1800
1806
|
this.cropSize = {
|
|
1801
1807
|
...this.cropSize,
|
|
@@ -1806,7 +1812,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1806
1812
|
position: n ?? v.CenterCenter,
|
|
1807
1813
|
ratioHeight: r,
|
|
1808
1814
|
ratioWidth: i,
|
|
1809
|
-
unit:
|
|
1815
|
+
unit: O.AspectRatio
|
|
1810
1816
|
};
|
|
1811
1817
|
} else if (e) {
|
|
1812
1818
|
let { focusMode: t, height: n, position: r, unit: i, width: a, x: o = 0, y: s = 0 } = e.value;
|
|
@@ -1818,7 +1824,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1818
1824
|
percentageHeight: 100,
|
|
1819
1825
|
percentageWidth: 100,
|
|
1820
1826
|
position: r ?? v.CenterCenter,
|
|
1821
|
-
unit: i ??
|
|
1827
|
+
unit: i ?? O.Pixel,
|
|
1822
1828
|
width: a,
|
|
1823
1829
|
x: o,
|
|
1824
1830
|
y: s
|
|
@@ -1831,37 +1837,37 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1831
1837
|
percentageHeight: 0,
|
|
1832
1838
|
percentageWidth: 0,
|
|
1833
1839
|
position: v.CenterCenter,
|
|
1834
|
-
unit:
|
|
1840
|
+
unit: O.Pixel,
|
|
1835
1841
|
width: 1,
|
|
1836
1842
|
x: 0,
|
|
1837
1843
|
y: 0
|
|
1838
1844
|
};
|
|
1839
|
-
let t = this.transformations.findLast((e) => e.key ===
|
|
1840
|
-
if (t?.value.unit ===
|
|
1845
|
+
let t = this.transformations.findLast((e) => e.key === A.Resize && (e.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width || e.value.height));
|
|
1846
|
+
if (t?.value.unit === O.AspectRatio && t.value.ratioWidth && t.value.ratioHeight) {
|
|
1841
1847
|
let { ratioHeight: e, ratioWidth: n } = t.value;
|
|
1842
1848
|
this.resizeSize = {
|
|
1843
1849
|
...this.resizeSize,
|
|
1844
1850
|
ratioHeight: e,
|
|
1845
1851
|
ratioWidth: n,
|
|
1846
|
-
unit:
|
|
1852
|
+
unit: O.AspectRatio
|
|
1847
1853
|
};
|
|
1848
1854
|
} else if (t) {
|
|
1849
1855
|
let { height: e = 0, unit: n, width: r = 0 } = t.value;
|
|
1850
1856
|
this.resizeSize = {
|
|
1851
1857
|
...this.resizeSize,
|
|
1852
1858
|
height: e,
|
|
1853
|
-
unit: n ??
|
|
1859
|
+
unit: n ?? O.Pixel,
|
|
1854
1860
|
width: r
|
|
1855
1861
|
};
|
|
1856
1862
|
} else this.resizeSize = {
|
|
1857
1863
|
...this.resizeSize,
|
|
1858
1864
|
height: 1,
|
|
1859
|
-
unit:
|
|
1865
|
+
unit: O.Pixel,
|
|
1860
1866
|
width: 1
|
|
1861
1867
|
};
|
|
1862
|
-
let n = this.transformations.findLast((e) => e.key ===
|
|
1868
|
+
let n = this.transformations.findLast((e) => e.key === A.Rotate);
|
|
1863
1869
|
this.rotation = n?.value.rotation ?? 0;
|
|
1864
|
-
let r = this.transformations.findLast((e) => e.key ===
|
|
1870
|
+
let r = this.transformations.findLast((e) => e.key === A.Quality)?.value.quality ?? 100, i = this.transformations.some((e) => e.key === A.Metadata);
|
|
1865
1871
|
this.selectedFormat = this.selectedFormat ? {
|
|
1866
1872
|
...this.selectedFormat,
|
|
1867
1873
|
keepMetadata: i,
|
|
@@ -1891,7 +1897,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1891
1897
|
keepAspectRatio: !0,
|
|
1892
1898
|
ratioHeight: 1,
|
|
1893
1899
|
ratioWidth: 1,
|
|
1894
|
-
unit:
|
|
1900
|
+
unit: O.Pixel,
|
|
1895
1901
|
width: e.width
|
|
1896
1902
|
}, this.cropSize = {
|
|
1897
1903
|
cropMode: "free",
|
|
@@ -1903,12 +1909,12 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1903
1909
|
position: v.CenterCenter,
|
|
1904
1910
|
ratioHeight: 1,
|
|
1905
1911
|
ratioWidth: 1,
|
|
1906
|
-
unit:
|
|
1912
|
+
unit: O.Pixel,
|
|
1907
1913
|
width: e.width,
|
|
1908
1914
|
x: 0,
|
|
1909
1915
|
y: 0
|
|
1910
|
-
}, this.lastAction ===
|
|
1911
|
-
let t = this.transformations.some((e) => e.key ===
|
|
1916
|
+
}, this.lastAction === A.Rotate && (this.rotation = 0), this.lastAction = void 0;
|
|
1917
|
+
let t = this.transformations.some((e) => e.key === A.Metadata), n = this.transformations.findLast((e) => e.key === A.Quality);
|
|
1912
1918
|
this.selectedFormat = {
|
|
1913
1919
|
...this.selectedFormat,
|
|
1914
1920
|
height: e.height,
|
|
@@ -1917,7 +1923,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1917
1923
|
url: this.baseUrl && this.baseUrl.length > 0 ? `${this.baseUrl}/${e.relativePath}` : e.relativePath,
|
|
1918
1924
|
width: e.width
|
|
1919
1925
|
};
|
|
1920
|
-
let r =
|
|
1926
|
+
let r = T({
|
|
1921
1927
|
asset: this.asset,
|
|
1922
1928
|
baseUrl: "",
|
|
1923
1929
|
extension: this.selectedFormat.extension,
|
|
@@ -1939,7 +1945,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1939
1945
|
height: Number.parseInt(this.asset.height, 10),
|
|
1940
1946
|
width: Number.parseInt(this.asset.width, 10)
|
|
1941
1947
|
});
|
|
1942
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1948
|
+
let e = this.transformations.findLast((e) => e.key === A.Quality);
|
|
1943
1949
|
this.selectedFormat = {
|
|
1944
1950
|
extension: this.asset.extension,
|
|
1945
1951
|
height: this.defaultSize.height,
|
|
@@ -1964,7 +1970,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1964
1970
|
position: v.CenterCenter,
|
|
1965
1971
|
ratioHeight: 1,
|
|
1966
1972
|
ratioWidth: 1,
|
|
1967
|
-
unit:
|
|
1973
|
+
unit: O.Pixel,
|
|
1968
1974
|
width: this.defaultSize.width,
|
|
1969
1975
|
x: 0,
|
|
1970
1976
|
y: 0
|
|
@@ -1983,7 +1989,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1983
1989
|
t.proxyName === "TRX" && (t.formatHeight = Number(this.asset.height), t.formatWidth = Number(this.asset.width));
|
|
1984
1990
|
let n = this.proxies?.find((t) => t.id === e);
|
|
1985
1991
|
n && (this.asset && n.proxyName === "TRX" && (n.formatHeight = Number(this.asset.height), n.formatWidth = Number(this.asset.width)), this.transformations = this.transformations.map((e) => {
|
|
1986
|
-
if (e.key ===
|
|
1992
|
+
if (e.key === A.Crop) {
|
|
1987
1993
|
let r = e.value, i = r.width / n.formatWidth * t.formatWidth, a = r.height / n.formatHeight * t.formatHeight, o = r.x / n.formatWidth * t.formatWidth, s = r.y / n.formatHeight * t.formatHeight;
|
|
1988
1994
|
return {
|
|
1989
1995
|
...e,
|
|
@@ -1996,7 +2002,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
1996
2002
|
}
|
|
1997
2003
|
};
|
|
1998
2004
|
}
|
|
1999
|
-
if (e.key ===
|
|
2005
|
+
if (e.key === A.Resize) {
|
|
2000
2006
|
let r = e.value, i = r.width / n.formatWidth * t.formatWidth, a = r.height / n.formatHeight * t.formatHeight;
|
|
2001
2007
|
return {
|
|
2002
2008
|
...e,
|
|
@@ -2017,24 +2023,24 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2017
2023
|
}, await this.updateComplete, this.cropSize = {
|
|
2018
2024
|
cropMode: "free",
|
|
2019
2025
|
focusMode: "manual",
|
|
2020
|
-
height: this.lastCropSize[
|
|
2026
|
+
height: this.lastCropSize[O.Pixel].height,
|
|
2021
2027
|
keepAspectRatio: !0,
|
|
2022
2028
|
percentageHeight: 100,
|
|
2023
2029
|
percentageWidth: 100,
|
|
2024
2030
|
position: v.CenterCenter,
|
|
2025
2031
|
ratioHeight: 1,
|
|
2026
2032
|
ratioWidth: 1,
|
|
2027
|
-
unit:
|
|
2028
|
-
width: this.lastCropSize[
|
|
2033
|
+
unit: O.Pixel,
|
|
2034
|
+
width: this.lastCropSize[O.Pixel].width,
|
|
2029
2035
|
x: 0,
|
|
2030
2036
|
y: 0
|
|
2031
2037
|
}, this.resizeSize = {
|
|
2032
|
-
height: this.lastResizeSize[
|
|
2038
|
+
height: this.lastResizeSize[O.Pixel].height,
|
|
2033
2039
|
keepAspectRatio: !0,
|
|
2034
2040
|
ratioHeight: 1,
|
|
2035
2041
|
ratioWidth: 1,
|
|
2036
|
-
unit:
|
|
2037
|
-
width: this.lastResizeSize[
|
|
2042
|
+
unit: O.Pixel,
|
|
2043
|
+
width: this.lastResizeSize[O.Pixel].width
|
|
2038
2044
|
};
|
|
2039
2045
|
}
|
|
2040
2046
|
handleLoadingChange() {
|
|
@@ -2054,17 +2060,17 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2054
2060
|
}
|
|
2055
2061
|
handleActiveSettingChange() {
|
|
2056
2062
|
this.cropperElement && (this.resizeSize = {
|
|
2057
|
-
height: this.lastResizeSize[
|
|
2063
|
+
height: this.lastResizeSize[O.Pixel].height,
|
|
2058
2064
|
keepAspectRatio: !0,
|
|
2059
2065
|
ratioHeight: 1,
|
|
2060
2066
|
ratioWidth: 1,
|
|
2061
|
-
unit:
|
|
2062
|
-
width: this.lastResizeSize[
|
|
2067
|
+
unit: O.Pixel,
|
|
2068
|
+
width: this.lastResizeSize[O.Pixel].width
|
|
2063
2069
|
}, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop");
|
|
2064
2070
|
}
|
|
2065
2071
|
async handleRequestAutoCropSuggestion({ cropMode: e, focusMode: t, height: n, keepAspectRatio: r, percentageHeight: i, percentageWidth: a, ratioHeight: o, ratioWidth: s, unit: c, useCropMode: l, width: u }) {
|
|
2066
2072
|
if (!this.selectedFormat?.url || t === "manual") return;
|
|
2067
|
-
this.loading = !0, this.lastAction =
|
|
2073
|
+
this.loading = !0, this.lastAction = A.Crop;
|
|
2068
2074
|
let d = await this.apiGetCropFocusMode({
|
|
2069
2075
|
autoCropMode: t,
|
|
2070
2076
|
cropHeight: n,
|
|
@@ -2140,7 +2146,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2140
2146
|
}
|
|
2141
2147
|
onProxyChange(e) {
|
|
2142
2148
|
let t = e.detail;
|
|
2143
|
-
if (this.lastAction =
|
|
2149
|
+
if (this.lastAction = A.Proxy, t.autoFormat) {
|
|
2144
2150
|
this.autoFormat = !0;
|
|
2145
2151
|
let e = this.autoResolvedProxyId;
|
|
2146
2152
|
e && (this.selectedProxy = e);
|
|
@@ -2156,7 +2162,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2156
2162
|
});
|
|
2157
2163
|
else {
|
|
2158
2164
|
let e = this.focusModes.find((e) => e.value === this.cropSize.focusMode)?.auto, n = this.cropSize.keepAspectRatio, r = this.cropSize.focusMode, i = this.cropSize.x, a = this.cropSize.y;
|
|
2159
|
-
t === "free" ? (n = !1, r = "manual") : this.cropSize.unit ===
|
|
2165
|
+
t === "free" ? (n = !1, r = "manual") : this.cropSize.unit === O.Pixel && !e && (i = 0, a = 0), e ? await this.handleRequestAutoCropSuggestion({
|
|
2160
2166
|
cropMode: t,
|
|
2161
2167
|
focusMode: r,
|
|
2162
2168
|
height: this.cropSize.height,
|
|
@@ -2191,11 +2197,11 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2191
2197
|
}
|
|
2192
2198
|
async onCropChange(e) {
|
|
2193
2199
|
let t = this.cropSize.unit;
|
|
2194
|
-
if (e.detail.unit ===
|
|
2200
|
+
if (e.detail.unit === O.AspectRatio) {
|
|
2195
2201
|
let t = e.detail.width / e.detail.height, n = this.asset ? Math.min(Math.max(Math.round(this.cropSize.height * t), 0), this.resizeSize.width) : 0, r = this.asset ? Math.min(Math.max(Math.round(n / t), 0), this.resizeSize.height) : 0, i = this.asset ? r * 100 / this.selectedFormat.height : 100, a = this.asset ? n * 100 / this.selectedFormat.width : 100, o = this.cropSize.x, s = this.cropSize.y;
|
|
2196
2202
|
o + a > 100 && (o = 100 - a), s + i > 100 && (s = 100 - i);
|
|
2197
2203
|
let c = this.cropSize.cropMode;
|
|
2198
|
-
this.cropModes.find((e) => e.value === c)?.auto && (c = "free"), e.detail.silent ? (this.cropSize.height = r, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = a, this.cropSize.ratioHeight = e.detail.height, this.cropSize.ratioWidth = e.detail.width, this.cropSize.unit =
|
|
2204
|
+
this.cropModes.find((e) => e.value === c)?.auto && (c = "free"), e.detail.silent ? (this.cropSize.height = r, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = a, this.cropSize.ratioHeight = e.detail.height, this.cropSize.ratioWidth = e.detail.width, this.cropSize.unit = O.AspectRatio, this.cropSize.width = n) : this.cropSize = {
|
|
2199
2205
|
...this.cropSize,
|
|
2200
2206
|
cropMode: c,
|
|
2201
2207
|
height: r,
|
|
@@ -2204,7 +2210,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2204
2210
|
percentageWidth: a,
|
|
2205
2211
|
ratioHeight: e.detail.height,
|
|
2206
2212
|
ratioWidth: e.detail.width,
|
|
2207
|
-
unit:
|
|
2213
|
+
unit: O.AspectRatio,
|
|
2208
2214
|
width: n,
|
|
2209
2215
|
x: o,
|
|
2210
2216
|
y: s
|
|
@@ -2213,14 +2219,14 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2213
2219
|
let t = this.asset ? e.detail.height * 100 / this.selectedFormat.height : 100, n = this.asset ? e.detail.width * 100 / this.selectedFormat.width : 100, r = this.cropSize.x, i = this.cropSize.y;
|
|
2214
2220
|
r + n > 100 && (r = 100 - n), i + t > 100 && (i = 100 - t);
|
|
2215
2221
|
let a = this.cropSize.cropMode, o = this.cropModes.find((e) => e.value === a)?.auto;
|
|
2216
|
-
(e.detail.breakAspectRatio || o) && (a = "free"), e.detail.silent ? (this.cropSize.cropMode = a, this.cropSize.height = e.detail.height, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = t, this.cropSize.percentageWidth = n, this.cropSize.unit =
|
|
2222
|
+
(e.detail.breakAspectRatio || o) && (a = "free"), e.detail.silent ? (this.cropSize.cropMode = a, this.cropSize.height = e.detail.height, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = t, this.cropSize.percentageWidth = n, this.cropSize.unit = O.Pixel, this.cropSize.width = e.detail.width, this.cropSize.x = r, this.cropSize.y = i) : this.cropSize = {
|
|
2217
2223
|
...this.cropSize,
|
|
2218
2224
|
cropMode: a,
|
|
2219
2225
|
height: e.detail.height,
|
|
2220
2226
|
keepAspectRatio: e.detail.keepAspectRatio,
|
|
2221
2227
|
percentageHeight: t,
|
|
2222
2228
|
percentageWidth: n,
|
|
2223
|
-
unit:
|
|
2229
|
+
unit: O.Pixel,
|
|
2224
2230
|
width: e.detail.width,
|
|
2225
2231
|
x: r,
|
|
2226
2232
|
y: i
|
|
@@ -2239,11 +2245,11 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2239
2245
|
});
|
|
2240
2246
|
}
|
|
2241
2247
|
onCropApply(e) {
|
|
2242
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2248
|
+
if (this.clearResetSnapshot(), this.lastAction = A.Crop, !this.asset) {
|
|
2243
2249
|
let { focusMode: e, height: t, position: n, ratioHeight: r, ratioWidth: i, unit: a, width: o, x: s, y: c } = this.cropSize, l = this.focusModes.find((t) => t.value === e)?.auto ?? !1;
|
|
2244
|
-
if (a ===
|
|
2250
|
+
if (a === O.AspectRatio) {
|
|
2245
2251
|
i && r && this.upsertTransformation({
|
|
2246
|
-
key:
|
|
2252
|
+
key: A.Crop,
|
|
2247
2253
|
value: {
|
|
2248
2254
|
focusMode: e,
|
|
2249
2255
|
isFocusModeAuto: l,
|
|
@@ -2256,7 +2262,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2256
2262
|
return;
|
|
2257
2263
|
}
|
|
2258
2264
|
(t || o) && this.upsertTransformation({
|
|
2259
|
-
key:
|
|
2265
|
+
key: A.Crop,
|
|
2260
2266
|
value: {
|
|
2261
2267
|
focusMode: e,
|
|
2262
2268
|
height: t,
|
|
@@ -2275,8 +2281,8 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2275
2281
|
let a = this.cropSize.focusMode, o = this.focusModes.find((e) => e.value === a)?.auto ?? !1;
|
|
2276
2282
|
if (t && i && r) {
|
|
2277
2283
|
let e = i, s = t;
|
|
2278
|
-
if (r ===
|
|
2279
|
-
key:
|
|
2284
|
+
if (r === O.AspectRatio && (e = this.cropSize.percentageWidth * this.selectedFormat.width / 100, s = this.cropSize.percentageHeight * this.selectedFormat.height / 100), n) this.transformations = [...this.transformations, {
|
|
2285
|
+
key: A.Crop,
|
|
2280
2286
|
value: {
|
|
2281
2287
|
focusMode: a,
|
|
2282
2288
|
height: s,
|
|
@@ -2288,7 +2294,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2288
2294
|
else {
|
|
2289
2295
|
let t = this.cropSize.x / 100 * this.selectedFormat.width, n = this.cropSize.y / 100 * this.selectedFormat.height;
|
|
2290
2296
|
this.transformations = [...this.transformations, {
|
|
2291
|
-
key:
|
|
2297
|
+
key: A.Crop,
|
|
2292
2298
|
value: {
|
|
2293
2299
|
focusMode: a,
|
|
2294
2300
|
height: s,
|
|
@@ -2301,7 +2307,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2301
2307
|
}];
|
|
2302
2308
|
}
|
|
2303
2309
|
} else n && (this.transformations = [...this.transformations, {
|
|
2304
|
-
key:
|
|
2310
|
+
key: A.Crop,
|
|
2305
2311
|
value: {
|
|
2306
2312
|
focusMode: a,
|
|
2307
2313
|
isFocusModeAuto: o,
|
|
@@ -2310,8 +2316,8 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2310
2316
|
}]);
|
|
2311
2317
|
}
|
|
2312
2318
|
onResizeChange(e) {
|
|
2313
|
-
if (e.detail.unit ===
|
|
2314
|
-
let t = e.detail.width / e.detail.height, n = Math.max(Math.round(this.lastResizeSize[
|
|
2319
|
+
if (e.detail.unit === O.AspectRatio) {
|
|
2320
|
+
let t = e.detail.width / e.detail.height, n = Math.max(Math.round(this.lastResizeSize[O.Pixel].height * t), 0), r = Math.max(Math.round(n / t), 0);
|
|
2315
2321
|
this.resizeSize = {
|
|
2316
2322
|
...this.resizeSize,
|
|
2317
2323
|
height: r,
|
|
@@ -2331,11 +2337,11 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2331
2337
|
}
|
|
2332
2338
|
onResizeApply(e) {
|
|
2333
2339
|
let { height: t, unit: n, width: r } = e.detail;
|
|
2334
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2335
|
-
if (n ===
|
|
2340
|
+
if (this.clearResetSnapshot(), this.lastAction = A.Resize, !this.asset) {
|
|
2341
|
+
if (n === O.AspectRatio) {
|
|
2336
2342
|
let { ratioHeight: e, ratioWidth: t } = this.resizeSize;
|
|
2337
2343
|
t && e && this.upsertTransformation({
|
|
2338
|
-
key:
|
|
2344
|
+
key: A.Resize,
|
|
2339
2345
|
value: {
|
|
2340
2346
|
ratioHeight: e,
|
|
2341
2347
|
ratioWidth: t,
|
|
@@ -2345,7 +2351,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2345
2351
|
return;
|
|
2346
2352
|
}
|
|
2347
2353
|
(t || r) && this.upsertTransformation({
|
|
2348
|
-
key:
|
|
2354
|
+
key: A.Resize,
|
|
2349
2355
|
value: {
|
|
2350
2356
|
height: t,
|
|
2351
2357
|
unit: n,
|
|
@@ -2356,8 +2362,8 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2356
2362
|
}
|
|
2357
2363
|
if (!this.selectedFormat) return;
|
|
2358
2364
|
let i = this.selectedFormat.width || this.defaultSize.width, a = this.selectedFormat.height || this.defaultSize.height, o = r, s = t;
|
|
2359
|
-
this.resizeSize.unit === n ? n ===
|
|
2360
|
-
key:
|
|
2365
|
+
this.resizeSize.unit === n ? n === O.AspectRatio && (o = Math.round(r / t * a), s = a) : (o = i, s = a), this.transformations = [...this.transformations, {
|
|
2366
|
+
key: A.Resize,
|
|
2361
2367
|
value: {
|
|
2362
2368
|
height: s,
|
|
2363
2369
|
unit: n,
|
|
@@ -2370,23 +2376,23 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2370
2376
|
}
|
|
2371
2377
|
onRotationApply(e) {
|
|
2372
2378
|
let t = e.detail;
|
|
2373
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2379
|
+
if (this.clearResetSnapshot(), this.lastAction = A.Rotate, !this.asset) {
|
|
2374
2380
|
t ? this.upsertTransformation({
|
|
2375
|
-
key:
|
|
2381
|
+
key: A.Rotate,
|
|
2376
2382
|
value: { rotation: t }
|
|
2377
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2383
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== A.Rotate);
|
|
2378
2384
|
return;
|
|
2379
2385
|
}
|
|
2380
2386
|
this.selectedFormat && (this.transformations = [...this.transformations, {
|
|
2381
|
-
key:
|
|
2387
|
+
key: A.Rotate,
|
|
2382
2388
|
value: { rotation: t }
|
|
2383
2389
|
}]);
|
|
2384
2390
|
}
|
|
2385
2391
|
onQualityChange(e) {
|
|
2386
2392
|
let t = e.detail;
|
|
2387
|
-
this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction =
|
|
2393
|
+
this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction = A.Quality;
|
|
2388
2394
|
let n = {
|
|
2389
|
-
key:
|
|
2395
|
+
key: A.Quality,
|
|
2390
2396
|
value: { quality: t }
|
|
2391
2397
|
};
|
|
2392
2398
|
this.asset ? this.transformations = [...this.transformations, n] : this.upsertTransformation(n);
|
|
@@ -2398,15 +2404,15 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2398
2404
|
keepMetadata: t
|
|
2399
2405
|
}, !this.asset) {
|
|
2400
2406
|
t ? this.upsertTransformation({
|
|
2401
|
-
key:
|
|
2407
|
+
key: A.Metadata,
|
|
2402
2408
|
value: { keepMetadata: t }
|
|
2403
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2409
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== A.Metadata);
|
|
2404
2410
|
return;
|
|
2405
2411
|
}
|
|
2406
2412
|
t ? this.upsertTransformation({
|
|
2407
|
-
key:
|
|
2413
|
+
key: A.Metadata,
|
|
2408
2414
|
value: { keepMetadata: t }
|
|
2409
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2415
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== A.Metadata);
|
|
2410
2416
|
}
|
|
2411
2417
|
onExtensionChange(e) {
|
|
2412
2418
|
let t = e.detail;
|
|
@@ -2416,7 +2422,7 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2416
2422
|
};
|
|
2417
2423
|
}
|
|
2418
2424
|
syncQuality() {
|
|
2419
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2425
|
+
let e = this.transformations.findLast((e) => e.key === A.Quality)?.value?.quality;
|
|
2420
2426
|
this.selectedFormat &&= {
|
|
2421
2427
|
...this.selectedFormat,
|
|
2422
2428
|
quality: e ?? 100
|
|
@@ -2441,10 +2447,10 @@ var Ct = Q, wt, $ = class extends s {
|
|
|
2441
2447
|
}
|
|
2442
2448
|
render() {
|
|
2443
2449
|
return e`<div class="asset-link-format" @cx-show=${this.onDetailsShow} @cx-hide=${this.onDetailsHide}>${m(!this.hideHeader, () => e`<cx-space class="asset-link-format__section-header" direction="horizontal" spacing="small" align-items="center" justify-content="space-between"><cx-typography variant="body3">${this.localize.term("transformations")}</cx-typography><cx-space direction="horizontal" spacing="3x-small" align-items="center"><cx-button class="asset-link-format__undo" variant="custom" ?disabled=${!this.hasUnfrozenTransformations && this.preResetTransformations === void 0} @click=${this.handleUndo}>${this.localize.term("undo")}</cx-button>${m(this.canReset, () => e`<cx-button class="asset-link-format__reset" variant="custom" ?disabled=${!this.hasResettableState} @click=${this.handleReset}>${this.localize.term("reset")}</cx-button>`)}</cx-space></cx-space>`, () => n)}
|
|
2444
|
-
${m(!this.noFormat, () => e`<cx-asset-link-format-proxy class="asset-link-format__details" value=${this.selectedProxy || this.proxies?.[0]?.id || ""} ?open=${this.activeSetting === "cx-asset-link-format-proxy"} ?auto-format=${this.autoFormat} ?can-auto-format=${this.canAutoFormat} .items=${this.formats} ?loading=${this.loading && this.lastAction ===
|
|
2445
|
-
${m(!this.noCrop, () => e`<cx-asset-link-format-crop class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction ===
|
|
2446
|
-
${m(!this.noResize, () => e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction ===
|
|
2447
|
-
${m(!this.noRotate, () => e`<cx-asset-link-format-rotation class="asset-link-format__details" ?loading=${this.loading && this.lastAction ===
|
|
2450
|
+
${m(!this.noFormat, () => e`<cx-asset-link-format-proxy class="asset-link-format__details" value=${this.selectedProxy || this.proxies?.[0]?.id || ""} ?open=${this.activeSetting === "cx-asset-link-format-proxy"} ?auto-format=${this.autoFormat} ?can-auto-format=${this.canAutoFormat} .items=${this.formats} ?loading=${this.loading && this.lastAction === A.Proxy} @cx-asset-link-format-proxy-change=${this.onProxyChange}></cx-asset-link-format-proxy>`)}
|
|
2451
|
+
${m(!this.noCrop, () => e`<cx-asset-link-format-crop class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction === A.Crop} ?keep-aspect-ratio=${this.cropSize.keepAspectRatio} ?show-position-picker=${!this.asset} focus-mode=${this.cropSize.focusMode} crop-mode=${this.cropSize.cropMode} width=${this.cropSize.width} height=${this.cropSize.height} max-width=${this.asset ? this.lastResizeSize[O.Pixel].width : Infinity} max-height=${this.asset ? this.lastResizeSize[O.Pixel].height : Infinity} percentage-width=${this.cropSize.percentageWidth} percentage-height=${this.cropSize.percentageHeight} position=${this.cropSize.position} ratio-width=${this.cropSize.ratioWidth} ratio-height=${this.cropSize.ratioHeight} unit=${this.cropSize.unit} .lastAppliedSetting=${this.lastCropSize} .cropModes=${this.cropModes} .focusModes=${this.focusModes} @cx-asset-link-format-crop-mode-change=${this.onCropModeChange} @cx-asset-link-format-crop-focus-mode-change=${this.onCropFocusModeChange} @cx-asset-link-format-crop-position-change=${this.onCropPositionChange} @cx-asset-link-format-crop-change=${this.onCropChange} @cx-asset-link-format-crop-changed=${this.onCropChanged} @cx-asset-link-format-crop-apply=${this.onCropApply}></cx-asset-link-format-crop>`)}
|
|
2452
|
+
${m(!this.noResize, () => e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction === A.Resize} ?no-ratio-modes=${!this.asset} ?keep-aspect-ratio=${this.resizeSize.keepAspectRatio} width=${this.resizeSize.width} height=${this.resizeSize.height} max-width=${this.asset ? this.imageSize.width : Infinity} max-height=${this.asset ? this.imageSize.height : Infinity} ratio-width=${this.resizeSize.ratioWidth} ratio-height=${this.resizeSize.ratioHeight} unit=${this.resizeSize.unit} .lastAppliedSetting=${this.lastResizeSize} @cx-asset-link-format-resize-change=${this.onResizeChange} @cx-asset-link-format-resize-apply=${this.onResizeApply}></cx-asset-link-format-resize>`)}
|
|
2453
|
+
${m(!this.noRotate, () => e`<cx-asset-link-format-rotation class="asset-link-format__details" ?loading=${this.loading && this.lastAction === A.Rotate} ?open=${this.activeSetting === "cx-asset-link-format-rotation"} default-value=${this.selectedFormat?.rotation ?? 0} last-applied-value=${this.lastRotation} value=${this.rotation} @cx-asset-link-format-rotation-change=${this.onRotationChange} @cx-asset-link-format-rotation-apply=${this.onRotationApply}></cx-asset-link-format-rotation>`)}<cx-asset-link-format-quality class="asset-link-format__details" ?loading=${this.loading && this.lastAction === A.Quality} ?open=${this.activeSetting === "cx-asset-link-format-quality"} value=${this.selectedFormat?.quality ?? 100} @cx-asset-link-format-quality-change=${this.onQualityChange}></cx-asset-link-format-quality>${m(!this.noMetadata, () => e`<cx-asset-link-format-metadata class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-metadata"} .value=${this.selectedFormat?.keepMetadata ?? !1} @cx-asset-link-format-metadata-change=${this.onMetadataChange}></cx-asset-link-format-metadata>`)}
|
|
2448
2454
|
${m(this.useCustomExtension, () => e`<cx-asset-link-format-extension .items=${this.extensions} value=${this.selectedFormat?.extension ?? ""} @cx-asset-link-format-extension-change=${this.onExtensionChange}></cx-asset-link-format-extension>`)}<div class="asset-link-format__footer"><slot name="footer"></slot></div></div>`;
|
|
2449
2455
|
}
|
|
2450
2456
|
};
|
|
@@ -2552,7 +2558,7 @@ a([r({
|
|
|
2552
2558
|
o("design:type", Function),
|
|
2553
2559
|
o("design:paramtypes", []),
|
|
2554
2560
|
o("design:returntype", void 0)
|
|
2555
|
-
], $.prototype, "handleLoadingChange", null), $ =
|
|
2556
|
-
var
|
|
2561
|
+
], $.prototype, "handleLoadingChange", null), $ = Dt = a([u("cx-asset-link-format"), o("design:paramtypes", [])], $);
|
|
2562
|
+
var Ot = $;
|
|
2557
2563
|
//#endregion
|
|
2558
|
-
export {
|
|
2564
|
+
export { Je as C, tt as S, xe as T, Ne as _, Le as a, Qe as b, z as c, Re as d, Ae as f, Me as g, V as h, st as i, B as l, ze as m, ut as n, R as o, je as p, ct as r, L as s, Ot as t, ke as u, Pe as v, P as w, rt as x, nt as y };
|