@orangelogic/design-system 4.50.0 → 4.51.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.Ca8KxyCV.js → asset-link-format.CV-Jw-hk.js} +557 -522
- package/library/chunks/{block-width.BiCAGZxV.js → block-width.B8m9MQM3.js} +1 -1
- package/library/chunks/{config-manager.Bwkq7ll7.js → config-manager.OCrUXBER.js} +3 -3
- package/library/components/asset-link-format.js +1 -1
- package/library/components/organisms.js +1 -1
- package/library/components/types.js +3 -3
- package/library/package.json +1 -1
- package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +8 -2
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-crop/asset-link-format-crop.d.ts +11 -3
- package/package.json +1 -1
|
@@ -13,38 +13,38 @@ import { t as _ } from "./button.DnOMjl_G.js";
|
|
|
13
13
|
import { m as ee } from "./string.DAuTpyw8.js";
|
|
14
14
|
import { t as te } from "./tooltip.DJl5qcTx.js";
|
|
15
15
|
import { n as v } from "./position-picker.dY_vgF_H.js";
|
|
16
|
-
import { l as ne, r as
|
|
17
|
-
import { t as
|
|
18
|
-
import { t as
|
|
19
|
-
import { t as
|
|
20
|
-
import { t as
|
|
21
|
-
import { t as
|
|
22
|
-
import { t as
|
|
23
|
-
import { t as
|
|
24
|
-
import { t as
|
|
25
|
-
import { t as
|
|
26
|
-
import { t as
|
|
27
|
-
import { E as
|
|
16
|
+
import { l as ne, r as y } from "./number.CNp5LKkv.js";
|
|
17
|
+
import { t as re } from "./image.C0s1gL4z.js";
|
|
18
|
+
import { t as b } from "./typography.B0mkhqTB.js";
|
|
19
|
+
import { t as ie } from "./button-group.CPfXrqyq.js";
|
|
20
|
+
import { t as ae } from "./checkbox.aFoOxk2j.js";
|
|
21
|
+
import { t as x } from "./repeat.CKv9FPlC.js";
|
|
22
|
+
import { t as oe } from "./input.D1UkXp3F.js";
|
|
23
|
+
import { t as S } from "./option.Da60zYvc.js";
|
|
24
|
+
import { t as C } from "./space.Dd8jezXK.js";
|
|
25
|
+
import { t as w } from "./select.NhbQgMNA.js";
|
|
26
|
+
import { t as se } from "./visually-hidden.Bv3SInZp.js";
|
|
27
|
+
import { E as ce, T as le, b as ue, d as de, h as fe, p as pe, w as me, y as he } from "./src.CFxipFzl.js";
|
|
28
28
|
import { t as T } from "./details.BGlfx87d.js";
|
|
29
|
-
import { t as
|
|
30
|
-
import { a as
|
|
31
|
-
import { t as
|
|
32
|
-
import { t as
|
|
33
|
-
import { t as
|
|
29
|
+
import { t as ge } from "./divider.CqSNZCU8.js";
|
|
30
|
+
import { a as E, c as D, l as O, n as _e, o as k, r as A, s as j, t as M } from "./asset-link-format.COPyGdND.js";
|
|
31
|
+
import { t as ve } from "./menu-label.B-FOyfAX.js";
|
|
32
|
+
import { t as ye } from "./switch.CBho2RVW.js";
|
|
33
|
+
import { t as be } from "./v4.JyXW8GUB.js";
|
|
34
34
|
import "./cropper.BRsN8h2t.js";
|
|
35
|
-
import { t as
|
|
36
|
-
import { d as
|
|
37
|
-
import { t as
|
|
35
|
+
import { t as xe } from "./_baseUniq.h_pGICPH.js";
|
|
36
|
+
import { d as Se, i as Ce, n as we, o as Te, p as N, r as Ee, s as De, t as Oe } from "./string-array.Dstcqyjm.js";
|
|
37
|
+
import { t as ke } from "./position-picker.DzRyAx7a.js";
|
|
38
38
|
//#region ../../node_modules/lodash-es/uniq.js
|
|
39
|
-
function
|
|
40
|
-
return e && e.length ?
|
|
39
|
+
function Ae(e) {
|
|
40
|
+
return e && e.length ? xe(e) : [];
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region ../../packages/services/src/api/asset/asset.utils.ts
|
|
44
|
-
function
|
|
44
|
+
function je(e) {
|
|
45
45
|
return typeof e == "object" && !!e && "URI" in e;
|
|
46
46
|
}
|
|
47
|
-
var
|
|
47
|
+
var Me = {
|
|
48
48
|
artist: "Artist",
|
|
49
49
|
color: "Color",
|
|
50
50
|
createDate: "CreateDate",
|
|
@@ -66,34 +66,34 @@ var je = {
|
|
|
66
66
|
systemIdentifier: "SystemIdentifier",
|
|
67
67
|
text: "Text",
|
|
68
68
|
title: "Title"
|
|
69
|
-
},
|
|
69
|
+
}, Ne = /* @__PURE__ */ new Set([
|
|
70
70
|
"mediaDate",
|
|
71
71
|
"createDate",
|
|
72
72
|
"editDate"
|
|
73
73
|
]);
|
|
74
|
-
function
|
|
74
|
+
function Pe(e) {
|
|
75
75
|
return !/[\s&+/*"\\:(),'<>~|[\]{}]/.test(e) && !/^(?:OR|AND|NOT)$/.test(e) ? e : `"${e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
let n = (Array.isArray(t) ? t : [t]).map((t) => `${e}:${
|
|
77
|
+
function Fe(e, t) {
|
|
78
|
+
let n = (Array.isArray(t) ? t : [t]).map((t) => `${e}:${Pe(t)}`);
|
|
79
79
|
return n.length > 1 ? `(${n.join(" OR ")})` : n[0] ?? "";
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Ie(e, t) {
|
|
82
82
|
return (Array.isArray(t) ? t : [t]).map((t) => `${e}${t.operator}${t.value}`).join(" AND ");
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Le(e) {
|
|
85
85
|
let t = [];
|
|
86
86
|
for (let n of Object.keys(e)) {
|
|
87
87
|
let r = n, i = e[r];
|
|
88
88
|
if (i == null) continue;
|
|
89
89
|
if (r === "custom") {
|
|
90
|
-
for (let [e, n] of Object.entries(i)) t.push(
|
|
90
|
+
for (let [e, n] of Object.entries(i)) t.push(Fe(e, n));
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
|
-
let a =
|
|
93
|
+
let a = Me[r];
|
|
94
94
|
if (a) {
|
|
95
|
-
if (
|
|
96
|
-
t.push(
|
|
95
|
+
if (Ne.has(r)) {
|
|
96
|
+
t.push(Ie(a, i));
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
99
|
if (r === "color") {
|
|
@@ -103,87 +103,87 @@ function Ie(e) {
|
|
|
103
103
|
if (r === "parentFolderIdentifier") {
|
|
104
104
|
let e = Array.isArray(i) ? i : [i];
|
|
105
105
|
if (e.length === 0) continue;
|
|
106
|
-
let n = [...e.map((e) => `ParentFolderIdentifier:${
|
|
106
|
+
let n = [...e.map((e) => `ParentFolderIdentifier:${Pe(String(e))}`), ...e.map((e) => `ParentAlbumIdentifier:${Pe(String(e))}`)];
|
|
107
107
|
t.push(`(${n.join(" OR ")})`);
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
|
-
t.push(
|
|
110
|
+
t.push(Fe(a, i));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
return t.join(" AND ");
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
if ("and" in e) return e.and.map(
|
|
115
|
+
function Re(e) {
|
|
116
|
+
if ("and" in e) return e.and.map(Re).filter(Boolean).join(" AND ");
|
|
117
117
|
if ("or" in e) {
|
|
118
|
-
let t = e.or.map(
|
|
118
|
+
let t = e.or.map(Re).filter(Boolean);
|
|
119
119
|
return t.length > 1 ? `(${t.join(" OR ")})` : t[0] ?? "";
|
|
120
120
|
}
|
|
121
121
|
if ("not" in e) {
|
|
122
|
-
let t =
|
|
122
|
+
let t = Re(e.not);
|
|
123
123
|
return t ? `NOT (${t})` : "";
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return Le(e);
|
|
126
126
|
}
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region ../../packages/services/src/api/asset/asset.ts
|
|
129
|
-
var
|
|
129
|
+
var ze = "CoreField.LargeSizePreview", P = "CoreField.DocType", Be = "Document.Title", Ve = "Document.CaptionLong", F = "Document.FileExtension", He = "CoreField.FileSize", Ue = "CoreField.Identifier", We = "CoreField.MaxHeight", Ge = "CoreField.MaxWidth", I = "Document.RecordID", Ke = "CoreField.DocSubType", qe = "CoreField.TitleWithFallback", L = "CoreField.OriginalFileName", Je = "__width", Ye = "__height", Xe = "CoreField.OriginalPreview", Ze = "Document.DocSubType", Qe = "Document.InPoint", $e = "Document.OutPoint", et = {
|
|
130
130
|
DEFAULT_VIEW_SIZE: "Document.LargeSizePreview",
|
|
131
131
|
ORIGINAL_VIEW_SIZE: "Document.OriginalPreview"
|
|
132
|
-
},
|
|
133
|
-
[
|
|
134
|
-
[
|
|
135
|
-
},
|
|
136
|
-
function nt(e) {
|
|
137
|
-
return et[e] ?? e;
|
|
138
|
-
}
|
|
132
|
+
}, tt = {
|
|
133
|
+
[ze]: et.DEFAULT_VIEW_SIZE,
|
|
134
|
+
[Xe]: et.ORIGINAL_VIEW_SIZE
|
|
135
|
+
}, nt = Object.fromEntries(Object.entries(tt).map(([e, t]) => [t, e]));
|
|
139
136
|
function rt(e) {
|
|
140
|
-
return e
|
|
137
|
+
return tt[e] ?? e;
|
|
141
138
|
}
|
|
142
139
|
function it(e) {
|
|
140
|
+
return e === "CoreField.TitleWithFallback" ? [Be, L] : [rt(e)];
|
|
141
|
+
}
|
|
142
|
+
function at(e) {
|
|
143
143
|
let t = {};
|
|
144
144
|
for (let [n, r] of Object.entries(e)) {
|
|
145
|
-
let e =
|
|
145
|
+
let e = nt[n] ?? n;
|
|
146
146
|
t[e] = r;
|
|
147
147
|
}
|
|
148
148
|
return t;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
e[n] =
|
|
150
|
+
function ot(e, t, n) {
|
|
151
|
+
e[n] = R(t, n);
|
|
152
152
|
let r = t[n];
|
|
153
|
-
return r != null &&
|
|
153
|
+
return r != null && je(r) && (typeof r.Width == "number" && r.Width > 0 && (e[`${n}${Je}`] = String(r.Width)), typeof r.Height == "number" && r.Height > 0 && (e[`${n}${Ye}`] = String(r.Height))), e;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function st(e) {
|
|
156
156
|
let t = new URLSearchParams();
|
|
157
157
|
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)));
|
|
158
158
|
return t;
|
|
159
159
|
}
|
|
160
|
-
async function
|
|
161
|
-
let m = n?.flatMap(
|
|
162
|
-
let t =
|
|
163
|
-
return h && (t[
|
|
160
|
+
async function ct({ consistency: e, countPerPage: t, fields: n, getPermanentAssetsPaths: r, httpMethod: i = "GET", isSiteBuilder: a, pageNumber: o, query: s, securityByPassToken: c, siteUrl: l, sort: u, throwOnError: d, token: f, useSession: p }) {
|
|
161
|
+
let m = n?.flatMap(it), h = n?.includes("CoreField.TitleWithFallback") ?? !1, g = (e) => {
|
|
162
|
+
let t = at(e);
|
|
163
|
+
return h && (t[qe] = R(t, "Document.Title") || R(t, "CoreField.OriginalFileName")), t;
|
|
164
164
|
}, _ = {
|
|
165
165
|
Consistency: e || void 0,
|
|
166
166
|
CountPerPage: t,
|
|
167
|
-
Fields:
|
|
167
|
+
Fields: Ae(m),
|
|
168
168
|
Format: "json",
|
|
169
169
|
GetPermanentAssetsPaths: r ?? void 0,
|
|
170
170
|
PageNumber: o,
|
|
171
|
-
Query:
|
|
171
|
+
Query: Re(s),
|
|
172
172
|
SecurityByPassToken: c || void 0,
|
|
173
173
|
Sort: u || void 0,
|
|
174
174
|
UseSession: p || void 0
|
|
175
175
|
}, ee = i === "POST";
|
|
176
176
|
try {
|
|
177
|
-
return (await
|
|
177
|
+
return (await N.request({
|
|
178
178
|
baseURL: l,
|
|
179
179
|
headers: f ? { Authorization: `Bearer ${f}` } : void 0,
|
|
180
180
|
method: i,
|
|
181
|
-
...ee ? { data:
|
|
181
|
+
...ee ? { data: st(_) } : {
|
|
182
182
|
params: _,
|
|
183
183
|
paramsSerializer: { indexes: null }
|
|
184
184
|
},
|
|
185
185
|
responseType: "json",
|
|
186
|
-
transformResponse: [...Array.isArray(
|
|
186
|
+
transformResponse: [...Array.isArray(N.defaults.transformResponse) ? N.defaults.transformResponse : [], a ? (e) => ({
|
|
187
187
|
items: (e.results?.Items ?? []).map(g),
|
|
188
188
|
sort: e.results?.GlobalInfo?.Sort ?? "",
|
|
189
189
|
totalCount: e.results?.GlobalInfo?.TotalCount ?? 0
|
|
@@ -192,7 +192,7 @@ async function st({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
192
192
|
sort: e.APIResponse?.GlobalInfo?.Sort ?? "",
|
|
193
193
|
totalCount: e.APIResponse?.GlobalInfo?.TotalCount ?? 0
|
|
194
194
|
})],
|
|
195
|
-
url: a ?
|
|
195
|
+
url: a ? De.SEARCH_ASSETS : Se["4.0"]
|
|
196
196
|
})).data;
|
|
197
197
|
} catch (e) {
|
|
198
198
|
if (d) throw e;
|
|
@@ -203,9 +203,9 @@ async function st({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
async function
|
|
206
|
+
async function lt({ assetId: e, extension: t, format: n, siteUrl: r, token: i, transformations: a, useSession: o }) {
|
|
207
207
|
try {
|
|
208
|
-
return (await
|
|
208
|
+
return (await N.request({
|
|
209
209
|
baseURL: r,
|
|
210
210
|
method: "GET",
|
|
211
211
|
params: {
|
|
@@ -217,19 +217,19 @@ async function ct({ assetId: e, extension: t, format: n, siteUrl: r, token: i, t
|
|
|
217
217
|
UseSession: o || void 0
|
|
218
218
|
},
|
|
219
219
|
timeout: 3e5,
|
|
220
|
-
url:
|
|
220
|
+
url: Ee.GET_TRANSFORM_ASSET_LINK
|
|
221
221
|
})).data;
|
|
222
222
|
} catch {
|
|
223
223
|
return null;
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
var
|
|
227
|
-
function
|
|
226
|
+
var ut = 50;
|
|
227
|
+
function dt(e, t) {
|
|
228
228
|
let n = [];
|
|
229
229
|
for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
|
|
230
230
|
return n;
|
|
231
231
|
}
|
|
232
|
-
async function
|
|
232
|
+
async function ft({ consistency: e, extraFields: t, getPermanentAssetsPaths: n, isSiteBuilder: r, recordIds: i, securityByPassToken: a, throwOnError: o, token: s }) {
|
|
233
233
|
if (!Array.isArray(i) || i.length === 0) return {
|
|
234
234
|
facets: [],
|
|
235
235
|
items: [],
|
|
@@ -237,11 +237,11 @@ async function dt({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
|
|
|
237
237
|
};
|
|
238
238
|
let c = t?.filter((e) => e && typeof e == "string") ?? [], l = [
|
|
239
239
|
...c,
|
|
240
|
-
|
|
241
|
-
ze,
|
|
240
|
+
L,
|
|
242
241
|
Be,
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
Ve,
|
|
243
|
+
I
|
|
244
|
+
], u = dt(i, ut), d = await Promise.all(u.map((t) => ct({
|
|
245
245
|
consistency: e,
|
|
246
246
|
countPerPage: t.length,
|
|
247
247
|
fields: l,
|
|
@@ -257,18 +257,18 @@ async function dt({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
|
|
|
257
257
|
return {
|
|
258
258
|
facets: [],
|
|
259
259
|
items: d.flatMap((e) => e.items).map((e) => ({
|
|
260
|
-
name:
|
|
261
|
-
recordId:
|
|
262
|
-
...c.reduce((t, n) =>
|
|
260
|
+
name: R(e, L),
|
|
261
|
+
recordId: R(e, I),
|
|
262
|
+
...c.reduce((t, n) => ot(t, e, n), {})
|
|
263
263
|
})).sort((e, t) => (f.get(e.recordId) ?? Infinity) - (f.get(t.recordId) ?? Infinity)),
|
|
264
264
|
totalCount: d.reduce((e, t) => e + t.totalCount, 0)
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function R(e, t) {
|
|
268
268
|
let n = e[t];
|
|
269
|
-
return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) :
|
|
269
|
+
return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) : je(n) ? n.URI : "";
|
|
270
270
|
}
|
|
271
|
-
async function
|
|
271
|
+
async function pt({ consistency: e, countPerPage: t, directParentFolderIdentifier: n, extraFields: r, getPermanentAssetsPaths: i, isSiteBuilder: a, limitedDocTypes: o, pageNumber: s, parentFolderIdentifier: c, searchTerm: l, securityByPassToken: u, sortOrder: d, throwOnError: f, token: p }) {
|
|
272
272
|
if (!n && !c) return {
|
|
273
273
|
facets: [],
|
|
274
274
|
items: [],
|
|
@@ -279,19 +279,19 @@ async function ft({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
279
279
|
parentFolderIdentifier: c,
|
|
280
280
|
...l ? { text: l } : {},
|
|
281
281
|
...o && o.length > 0 ? { docType: o } : {}
|
|
282
|
-
}, g = await
|
|
282
|
+
}, g = await ct({
|
|
283
283
|
consistency: e,
|
|
284
284
|
countPerPage: t,
|
|
285
285
|
fields: [
|
|
286
286
|
...m,
|
|
287
|
+
qe,
|
|
288
|
+
He,
|
|
289
|
+
P,
|
|
287
290
|
Ke,
|
|
288
|
-
|
|
291
|
+
Ue,
|
|
289
292
|
F,
|
|
290
|
-
Ge,
|
|
291
|
-
He,
|
|
292
293
|
I,
|
|
293
|
-
L
|
|
294
|
-
R
|
|
294
|
+
L
|
|
295
295
|
],
|
|
296
296
|
getPermanentAssetsPaths: i,
|
|
297
297
|
isSiteBuilder: a,
|
|
@@ -305,27 +305,27 @@ async function ft({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
305
305
|
return {
|
|
306
306
|
facets: [],
|
|
307
307
|
items: g.items.map((e) => {
|
|
308
|
-
let t =
|
|
308
|
+
let t = R(e, F);
|
|
309
309
|
t && !t.startsWith(".") && (t = "." + t);
|
|
310
|
-
let n =
|
|
310
|
+
let n = R(e, I);
|
|
311
311
|
return {
|
|
312
|
-
docSubType:
|
|
313
|
-
docType:
|
|
312
|
+
docSubType: R(e, Ke),
|
|
313
|
+
docType: R(e, "CoreField.DocType") || "",
|
|
314
314
|
extension: t,
|
|
315
315
|
id: n,
|
|
316
|
-
identifier:
|
|
317
|
-
name:
|
|
316
|
+
identifier: R(e, Ue),
|
|
317
|
+
name: R(e, L),
|
|
318
318
|
recordId: n,
|
|
319
|
-
size:
|
|
320
|
-
...m.reduce((t, n) =>
|
|
319
|
+
size: R(e, "CoreField.FileSize") || "0 MB",
|
|
320
|
+
...m.reduce((t, n) => ot(t, e, n), {})
|
|
321
321
|
};
|
|
322
322
|
}),
|
|
323
323
|
totalCount: g.totalCount
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
async function
|
|
326
|
+
async function mt({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, useSession: i }) {
|
|
327
327
|
try {
|
|
328
|
-
return (await
|
|
328
|
+
return (await N.request({
|
|
329
329
|
method: "GET",
|
|
330
330
|
params: {
|
|
331
331
|
AutoCropMode: e,
|
|
@@ -336,21 +336,21 @@ async function pt({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, u
|
|
|
336
336
|
},
|
|
337
337
|
responseType: "json",
|
|
338
338
|
timeout: 3e5,
|
|
339
|
-
transformResponse: [...Array.isArray(
|
|
339
|
+
transformResponse: [...Array.isArray(N.defaults.transformResponse) ? N.defaults.transformResponse : [], (e) => ({
|
|
340
340
|
height: e.cropHeight,
|
|
341
341
|
width: e.cropWidth,
|
|
342
342
|
x: e.cropX,
|
|
343
343
|
y: e.cropY
|
|
344
344
|
})],
|
|
345
|
-
url:
|
|
345
|
+
url: Ee.GET_CROP_ZONE_SUGGESTION
|
|
346
346
|
})).data;
|
|
347
347
|
} catch {
|
|
348
348
|
return null;
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
async function
|
|
351
|
+
async function ht({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, useSession: i }) {
|
|
352
352
|
try {
|
|
353
|
-
return (await
|
|
353
|
+
return (await N.request({
|
|
354
354
|
baseURL: n,
|
|
355
355
|
method: "GET",
|
|
356
356
|
params: {
|
|
@@ -359,7 +359,7 @@ async function mt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
|
|
|
359
359
|
UseSession: i || void 0
|
|
360
360
|
},
|
|
361
361
|
responseType: "json",
|
|
362
|
-
transformResponse: [...Array.isArray(
|
|
362
|
+
transformResponse: [...Array.isArray(N.defaults.transformResponse) ? N.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? [] : e.proxies?.map((e) => ({
|
|
363
363
|
cdnName: e.cdnName,
|
|
364
364
|
extension: e.extension,
|
|
365
365
|
formatHeight: e.formatHeight,
|
|
@@ -370,31 +370,31 @@ async function mt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
|
|
|
370
370
|
proxyName: e.proxyName,
|
|
371
371
|
width: e.width
|
|
372
372
|
})) ?? []],
|
|
373
|
-
url: t ?
|
|
373
|
+
url: t ? De.GET_AVAILABLE_PROXIES : Te
|
|
374
374
|
})).data;
|
|
375
375
|
} catch {
|
|
376
376
|
return [];
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
async function
|
|
379
|
+
async function gt({ siteUrl: e } = {}) {
|
|
380
380
|
try {
|
|
381
|
-
return (await
|
|
381
|
+
return (await N.request({
|
|
382
382
|
baseURL: e,
|
|
383
383
|
method: "GET",
|
|
384
384
|
responseType: "json",
|
|
385
|
-
transformResponse: [...Array.isArray(
|
|
385
|
+
transformResponse: [...Array.isArray(N.defaults.transformResponse) ? N.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? { formatsByDocType: {
|
|
386
386
|
Audio: {},
|
|
387
387
|
Image: {},
|
|
388
388
|
Multimedia: {},
|
|
389
389
|
Video: {}
|
|
390
390
|
} } : { formatsByDocType: e.formatsByDocType ?? {} }],
|
|
391
|
-
url:
|
|
391
|
+
url: we
|
|
392
392
|
})).data;
|
|
393
393
|
} catch {
|
|
394
394
|
return { formatsByDocType: {} };
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
async function
|
|
397
|
+
async function _t({ recordIds: e, rightsToCheck: t }) {
|
|
398
398
|
let n = {
|
|
399
399
|
authorizedObjects: [],
|
|
400
400
|
forbiddenObjectsOfReadPermission: [],
|
|
@@ -402,7 +402,7 @@ async function gt({ recordIds: e, rightsToCheck: t }) {
|
|
|
402
402
|
invalidObjects: []
|
|
403
403
|
};
|
|
404
404
|
try {
|
|
405
|
-
let { data: n } = await
|
|
405
|
+
let { data: n } = await N.request({
|
|
406
406
|
method: "GET",
|
|
407
407
|
params: {
|
|
408
408
|
RecordIDs: e,
|
|
@@ -410,7 +410,7 @@ async function gt({ recordIds: e, rightsToCheck: t }) {
|
|
|
410
410
|
},
|
|
411
411
|
paramsSerializer: { indexes: null },
|
|
412
412
|
responseType: "json",
|
|
413
|
-
url:
|
|
413
|
+
url: Ce.GET_AUTHORIZED_OBJECTS
|
|
414
414
|
});
|
|
415
415
|
return n;
|
|
416
416
|
} catch {
|
|
@@ -419,7 +419,7 @@ async function gt({ recordIds: e, rightsToCheck: t }) {
|
|
|
419
419
|
}
|
|
420
420
|
//#endregion
|
|
421
421
|
//#region ../../packages/tools/src/fetch-image/fetch-image.ts
|
|
422
|
-
var
|
|
422
|
+
var vt = 20, z = "TR1", B = "TRX", yt = /* @__PURE__ */ new Set([".gif"]), bt = /* @__PURE__ */ new Set([
|
|
423
423
|
".avif",
|
|
424
424
|
".bmp",
|
|
425
425
|
".gif",
|
|
@@ -430,18 +430,18 @@ var _t = 20, B = "TR1", V = "TRX", vt = /* @__PURE__ */ new Set([".gif"]), yt =
|
|
|
430
430
|
".svg",
|
|
431
431
|
".webp"
|
|
432
432
|
]);
|
|
433
|
-
function
|
|
433
|
+
function xt(e) {
|
|
434
434
|
let t = e.toLowerCase(), n = t.startsWith(".") ? t : `.${t}`;
|
|
435
|
-
return
|
|
435
|
+
return bt.has(n);
|
|
436
436
|
}
|
|
437
|
-
function
|
|
438
|
-
return e !== void 0 && e !== "" && e !==
|
|
437
|
+
function St(e, t) {
|
|
438
|
+
return e !== void 0 && e !== "" && e !== j.Image ? !1 : !t || xt(t);
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${
|
|
440
|
+
function Ct({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i, item: a, manualFormat: o, size: s, useExpiringAssetUrls: c }) {
|
|
441
|
+
let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${z}`, f = (n, r) => {
|
|
442
442
|
let i = a[n];
|
|
443
443
|
if (!i) return;
|
|
444
|
-
let s = a[`${n}${
|
|
444
|
+
let s = a[`${n}${Je}`], u = a[`${n}${Ye}`], d = e && !c ? de(i, [], {
|
|
445
445
|
autoFormat: !o,
|
|
446
446
|
extension: l,
|
|
447
447
|
format: r
|
|
@@ -453,28 +453,28 @@ function St({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i
|
|
|
453
453
|
srcset: t && !c ? pe(d, {
|
|
454
454
|
extension: l,
|
|
455
455
|
format: r,
|
|
456
|
-
maxWidth:
|
|
456
|
+
maxWidth: ue(o, s)
|
|
457
457
|
}) : ""
|
|
458
458
|
};
|
|
459
459
|
};
|
|
460
460
|
if (c) {
|
|
461
|
-
let e =
|
|
461
|
+
let e = le(a, St(n, l), l);
|
|
462
462
|
return e ? f(e) ?? {} : {};
|
|
463
463
|
}
|
|
464
464
|
if (!o) {
|
|
465
465
|
let e = he(l, s);
|
|
466
|
-
return f(`path_${e}`, e) ?? f(d,
|
|
466
|
+
return f(`path_${e}`, e) ?? f(d, z) ?? {};
|
|
467
467
|
}
|
|
468
468
|
let p = i ? `path_${i}` : void 0;
|
|
469
|
-
return p && a[p] ? i !==
|
|
469
|
+
return p && a[p] ? i !== B || St(n, l) ? f(p, i) ?? {} : f(d, z) ?? {} : l && yt.has(u) ? f(`path_${B}`, B) ?? f(d, z) ?? {} : f(d, z) ?? {};
|
|
470
470
|
}
|
|
471
|
-
var
|
|
471
|
+
var wt = class {
|
|
472
472
|
constructor(e, t) {
|
|
473
|
-
this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = Infinity, this.pageSize =
|
|
473
|
+
this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = Infinity, this.pageSize = vt, this.requestEpoch = 0, this.host = e, this.host.addController?.(this);
|
|
474
474
|
let n = t?.maxEnd;
|
|
475
475
|
this.maxEnd = typeof n == "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : Infinity;
|
|
476
476
|
let r = t?.pageSize;
|
|
477
|
-
this.pageSize = typeof r == "number" && Number.isFinite(r) && r >= 1 ? Math.floor(r) :
|
|
477
|
+
this.pageSize = typeof r == "number" && Number.isFinite(r) && r >= 1 ? Math.floor(r) : vt, 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;
|
|
478
478
|
}
|
|
479
479
|
get totalDataCount() {
|
|
480
480
|
return this.totalCount;
|
|
@@ -483,7 +483,7 @@ var Ct = class {
|
|
|
483
483
|
this.securityByPassToken !== e && (this.securityByPassToken = e, this.resetPageCache());
|
|
484
484
|
}
|
|
485
485
|
setPageSize(e) {
|
|
486
|
-
let t = Number.isFinite(e) && e >= 1 ? Math.floor(e) :
|
|
486
|
+
let t = Number.isFinite(e) && e >= 1 ? Math.floor(e) : vt;
|
|
487
487
|
if (this.pageSize === t) return;
|
|
488
488
|
let n = this.fetchedPages.size > 0;
|
|
489
489
|
n && t < this.pageSize || (this.pageSize = t, n && (this.requestEpoch += 1, this.fetchedPages.clear()));
|
|
@@ -492,25 +492,25 @@ var Ct = class {
|
|
|
492
492
|
if (e < i || this.totalCount > 0 && e >= this.totalCount && (e = this.totalCount - 1, e < i)) return this.data;
|
|
493
493
|
let s = this.requestEpoch, c = me(this.host.ownerDocument.defaultView);
|
|
494
494
|
if (!this.folderId || s !== this.requestEpoch) return this.data;
|
|
495
|
-
let l = n ? `path_${n}` : void 0, u = `path_${
|
|
495
|
+
let l = n ? `path_${n}` : void 0, u = `path_${z}`, d = `path_${B}`, f = c ? [u, d] : [...new Set([
|
|
496
496
|
l,
|
|
497
497
|
u,
|
|
498
498
|
d
|
|
499
499
|
].filter((e) => !!e))], p = Math.floor(i / this.pageSize) + 1, m = Math.floor(e / this.pageSize) + 1;
|
|
500
500
|
for (let e = p; e <= m; e++) {
|
|
501
501
|
if (this.fetchedPages.has(e)) continue;
|
|
502
|
-
let i = await
|
|
502
|
+
let i = await pt({
|
|
503
503
|
consistency: this.consistency,
|
|
504
504
|
countPerPage: this.pageSize,
|
|
505
505
|
directParentFolderIdentifier: this.folderId,
|
|
506
506
|
extraFields: [...t, ...f],
|
|
507
|
-
getPermanentAssetsPaths:
|
|
507
|
+
getPermanentAssetsPaths: ce(this.host.ownerDocument.defaultView),
|
|
508
508
|
isSiteBuilder: this.isSiteBuilder,
|
|
509
509
|
limitedDocTypes: [
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
510
|
+
j.Image,
|
|
511
|
+
j.Audio,
|
|
512
|
+
j.Video,
|
|
513
|
+
j.Multimedia
|
|
514
514
|
],
|
|
515
515
|
pageNumber: e,
|
|
516
516
|
searchTerm: "",
|
|
@@ -524,7 +524,7 @@ var Ct = class {
|
|
|
524
524
|
let e = Math.min(this.maxEnd, i.totalCount);
|
|
525
525
|
this.totalCount = e, this.data = Array.from({ length: e }, () => ({
|
|
526
526
|
alt: "",
|
|
527
|
-
id: `temp-${
|
|
527
|
+
id: `temp-${be()}`,
|
|
528
528
|
name: "",
|
|
529
529
|
src: ""
|
|
530
530
|
}));
|
|
@@ -533,7 +533,7 @@ var Ct = class {
|
|
|
533
533
|
for (let e = 0; e < i.items.length; e++) {
|
|
534
534
|
let a = l + e;
|
|
535
535
|
if (a < this.data.length) {
|
|
536
|
-
let s = i.items[e], { maxHeight: l, maxWidth: u, src: d, srcset: f } =
|
|
536
|
+
let s = i.items[e], { maxHeight: l, maxWidth: u, src: d, srcset: f } = Ct({
|
|
537
537
|
autoFormat: this.autoFormat,
|
|
538
538
|
buildSrcset: this.buildSrcset,
|
|
539
539
|
docType: s.docType,
|
|
@@ -544,7 +544,7 @@ var Ct = class {
|
|
|
544
544
|
size: s.size,
|
|
545
545
|
useExpiringAssetUrls: c
|
|
546
546
|
}), p = d, m = f;
|
|
547
|
-
!c && p && o && o.length > 0 && (p =
|
|
547
|
+
!c && p && o && o.length > 0 && (p = de(p, o), m = ""), this.data[a] = {
|
|
548
548
|
alt: s.name,
|
|
549
549
|
docType: s.docType,
|
|
550
550
|
extension: s.extension,
|
|
@@ -587,39 +587,39 @@ var Ct = class {
|
|
|
587
587
|
}
|
|
588
588
|
async fetchImagesByIDs({ extraFields: e = [], format: t, manualFormat: n = !0, recordIds: r, throwOnError: i = !1, transformations: a }) {
|
|
589
589
|
if (r.length === 0) return [];
|
|
590
|
-
let o = me(this.host.ownerDocument.defaultView), s = t ? `path_${t}` : void 0, c = `path_${
|
|
590
|
+
let o = me(this.host.ownerDocument.defaultView), s = t ? `path_${t}` : void 0, c = `path_${z}`, l = `path_${B}`, u = o ? [c, l] : [...new Set([
|
|
591
591
|
s,
|
|
592
592
|
c,
|
|
593
593
|
l
|
|
594
|
-
].filter((e) => !!e))], d = [
|
|
595
|
-
return (await
|
|
594
|
+
].filter((e) => !!e))], d = [F, ...o ? [] : [He]], f = [...e, P];
|
|
595
|
+
return (await ft({
|
|
596
596
|
consistency: this.consistency,
|
|
597
597
|
extraFields: [
|
|
598
598
|
...f,
|
|
599
599
|
...u,
|
|
600
600
|
...d
|
|
601
601
|
].filter((e) => e !== ""),
|
|
602
|
-
getPermanentAssetsPaths:
|
|
602
|
+
getPermanentAssetsPaths: ce(this.host.ownerDocument.defaultView),
|
|
603
603
|
isSiteBuilder: this.isSiteBuilder,
|
|
604
604
|
recordIds: r,
|
|
605
605
|
securityByPassToken: this.securityByPassToken,
|
|
606
606
|
throwOnError: i,
|
|
607
607
|
token: this.authToken
|
|
608
608
|
})).items.map((e) => {
|
|
609
|
-
let { maxHeight: r, maxWidth: i, src: s, srcset: c } =
|
|
609
|
+
let { maxHeight: r, maxWidth: i, src: s, srcset: c } = Ct({
|
|
610
610
|
autoFormat: this.autoFormat,
|
|
611
611
|
buildSrcset: this.buildSrcset,
|
|
612
|
-
docType: e[
|
|
613
|
-
extension: e[
|
|
612
|
+
docType: e[P],
|
|
613
|
+
extension: e[F],
|
|
614
614
|
format: t,
|
|
615
615
|
item: e,
|
|
616
616
|
manualFormat: n,
|
|
617
|
-
size: e[
|
|
617
|
+
size: e[He],
|
|
618
618
|
useExpiringAssetUrls: o
|
|
619
619
|
}), l = s, u = c;
|
|
620
|
-
return !o && l && a && a.length > 0 && (l =
|
|
620
|
+
return !o && l && a && a.length > 0 && (l = de(l, a), u = ""), {
|
|
621
621
|
alt: e.name,
|
|
622
|
-
docType: e[
|
|
622
|
+
docType: e[P],
|
|
623
623
|
extension: e["Document.FileExtension"] || "",
|
|
624
624
|
id: e.recordId,
|
|
625
625
|
maxHeight: r,
|
|
@@ -686,46 +686,56 @@ var Ct = class {
|
|
|
686
686
|
resetFolderState() {
|
|
687
687
|
this.resetPageCache();
|
|
688
688
|
}
|
|
689
|
-
},
|
|
689
|
+
}, Tt = t`.asset-link-format__panel{position:relative}.asset-link-format--formats .asset-link-format__panel:not(:last-child){border-bottom:1px solid var(--cx-color-neutral-200)}.asset-link-format__panel--placeholder,.asset-link-format--formats .asset-link-format__panel--placeholder:not(:last-child){height:var(--cx-spacing-3x-small);background-color:var(--cx-color-primary);border:none;overflow:hidden}.asset-link-format__panel--placeholder>*{visibility:hidden}.asset-link-format__drag-handle{cursor:grab;touch-action:none;width:max-content;margin-inline:auto;position:absolute;inset-block-start:calc(var(--cx-spacing-small) + var(--cx-font-size-3x-large) / 2);inset-inline:0;transform:translateY(-50%)}.asset-link-format__drag-handle::part(base){cursor:grab}.asset-link-format__drag-handle:active,.asset-link-format__drag-handle:active::part(base){cursor:grabbing}.asset-link-format__drag-handle::part(icon){color:var(--cx-color-neutral-300);rotate:90deg}.asset-link-format__announcement{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.asset-link-format__order-hint{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border-bottom:1px solid var(--cx-color-neutral-200);color:var(--cx-color-success);font:var(--cx-font-label-x-small)}.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__formats-summary{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__formats-summary [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__formats-crop cx-asset-link-format-crop{box-sizing:border-box;width:100%;padding:0 var(--cx-spacing-medium) 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}`, Et = t`:host([inline]){display:block}cx-details::part(base){border-bottom-width:0}.details--inline::part(base){border-width:0}.details--inline::part(header){display:none}.details--inline::part(content){padding:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}`, V, H = class extends s {
|
|
690
|
+
static #e = V = this;
|
|
690
691
|
constructor(...e) {
|
|
691
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !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 =
|
|
692
|
-
[
|
|
692
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !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 = {
|
|
693
|
+
[O.Pixel]: {
|
|
693
694
|
height: 0,
|
|
694
695
|
percentageHeight: 100,
|
|
695
696
|
percentageWidth: 100,
|
|
696
|
-
unit:
|
|
697
|
+
unit: O.Pixel,
|
|
697
698
|
width: 0,
|
|
698
699
|
x: 0,
|
|
699
700
|
y: 0
|
|
700
701
|
},
|
|
701
|
-
[
|
|
702
|
+
[O.AspectRatio]: {
|
|
702
703
|
height: 1,
|
|
703
704
|
percentageHeight: 100,
|
|
704
705
|
percentageWidth: 100,
|
|
705
|
-
unit:
|
|
706
|
+
unit: O.AspectRatio,
|
|
706
707
|
width: 1,
|
|
707
708
|
x: 0,
|
|
708
709
|
y: 0
|
|
709
710
|
}
|
|
710
711
|
}, 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;
|
|
711
712
|
}
|
|
712
|
-
static #
|
|
713
|
-
static #
|
|
713
|
+
static #t = this.styles = [l, Et];
|
|
714
|
+
static #n = this.dependencies = {
|
|
714
715
|
"cx-button": _,
|
|
715
716
|
"cx-details": T,
|
|
716
|
-
"cx-divider":
|
|
717
|
+
"cx-divider": ge,
|
|
717
718
|
"cx-icon": h,
|
|
718
719
|
"cx-icon-button": p,
|
|
719
|
-
"cx-input":
|
|
720
|
-
"cx-option":
|
|
721
|
-
"cx-position-picker":
|
|
722
|
-
"cx-select":
|
|
723
|
-
"cx-space":
|
|
724
|
-
"cx-typography":
|
|
720
|
+
"cx-input": oe,
|
|
721
|
+
"cx-option": S,
|
|
722
|
+
"cx-position-picker": ke,
|
|
723
|
+
"cx-select": w,
|
|
724
|
+
"cx-space": C,
|
|
725
|
+
"cx-typography": b
|
|
725
726
|
};
|
|
727
|
+
static getRatioSize(e, t, n, r, i) {
|
|
728
|
+
return n === O.Pixel && Number.isFinite(r) && Number.isFinite(i) ? re(r, i, e, t) : {
|
|
729
|
+
height: t,
|
|
730
|
+
width: e
|
|
731
|
+
};
|
|
732
|
+
}
|
|
726
733
|
get selectedMode() {
|
|
727
734
|
return this.cropModes.find((e) => e.value === this.cropMode);
|
|
728
735
|
}
|
|
736
|
+
get hasMaxSize() {
|
|
737
|
+
return Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight);
|
|
738
|
+
}
|
|
729
739
|
async handleCropModeChange() {
|
|
730
740
|
if (typeof this.cropMode == "string" && /^\d+:\d+$/.test(this.cropMode)) {
|
|
731
741
|
let [e, t] = this.cropMode.split(":").map(Number);
|
|
@@ -733,11 +743,11 @@ var Ct = class {
|
|
|
733
743
|
return;
|
|
734
744
|
}
|
|
735
745
|
if (this.keepAspectRatio) {
|
|
736
|
-
if (this.unit ===
|
|
746
|
+
if (this.unit === O.Pixel && this.width && this.height) {
|
|
737
747
|
this.aspectRatio = this.width / this.height;
|
|
738
748
|
return;
|
|
739
749
|
}
|
|
740
|
-
if (this.unit ===
|
|
750
|
+
if (this.unit === O.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
741
751
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
742
752
|
return;
|
|
743
753
|
}
|
|
@@ -765,9 +775,9 @@ var Ct = class {
|
|
|
765
775
|
this.invalidWidth = !0;
|
|
766
776
|
return;
|
|
767
777
|
}
|
|
768
|
-
this.invalidWidth = !1, this.unit ===
|
|
769
|
-
let n = this.unit ===
|
|
770
|
-
this.keepAspectRatio && (n = Math.max(Math.round(t / this.aspectRatio), 1)), this.unit ===
|
|
778
|
+
this.invalidWidth = !1, this.unit === O.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1));
|
|
779
|
+
let n = this.unit === O.Pixel ? this.height : this.ratioHeight, r = !1;
|
|
780
|
+
this.keepAspectRatio && (n = Math.max(Math.round(t / this.aspectRatio), 1)), this.unit === O.Pixel && this.maxHeight >= 1 && n > this.maxHeight && (n = this.maxHeight, r = this.keepAspectRatio), e.target.value = t.toString(), this.invalidHeight = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
771
781
|
breakAspectRatio: r,
|
|
772
782
|
height: n,
|
|
773
783
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -781,9 +791,9 @@ var Ct = class {
|
|
|
781
791
|
this.invalidHeight = !0;
|
|
782
792
|
return;
|
|
783
793
|
}
|
|
784
|
-
this.invalidHeight = !1, this.unit ===
|
|
785
|
-
let n = this.unit ===
|
|
786
|
-
this.keepAspectRatio && (n = Math.max(Math.round(t * this.aspectRatio), 1)), this.unit ===
|
|
794
|
+
this.invalidHeight = !1, this.unit === O.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1));
|
|
795
|
+
let n = this.unit === O.Pixel ? this.width : this.ratioWidth, r = !1;
|
|
796
|
+
this.keepAspectRatio && (n = Math.max(Math.round(t * this.aspectRatio), 1)), this.unit === O.Pixel && this.maxWidth >= 1 && n > this.maxWidth && (n = this.maxWidth, r = this.keepAspectRatio), e.target.value = t.toString(), this.invalidWidth = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
787
797
|
breakAspectRatio: r,
|
|
788
798
|
height: t,
|
|
789
799
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -794,29 +804,19 @@ var Ct = class {
|
|
|
794
804
|
onCropModeChange(e) {
|
|
795
805
|
let t = e.target.value, n = this.cropModes.find((e) => e.value === t)?.auto;
|
|
796
806
|
if (t === "free") this.selectedMode?.auto && this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
797
|
-
height: this.lastAppliedSetting[
|
|
807
|
+
height: this.lastAppliedSetting[O.Pixel].height,
|
|
798
808
|
keepAspectRatio: !1,
|
|
799
809
|
silent: !0,
|
|
800
|
-
unit:
|
|
801
|
-
width: this.lastAppliedSetting[
|
|
810
|
+
unit: O.Pixel,
|
|
811
|
+
width: this.lastAppliedSetting[O.Pixel].width
|
|
802
812
|
} });
|
|
803
813
|
else if (!n) {
|
|
804
|
-
let [e, n] = t.split(":").map(Number);
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
height: r,
|
|
809
|
-
keepAspectRatio: !0,
|
|
810
|
-
silent: !0,
|
|
811
|
-
unit: k.Pixel,
|
|
812
|
-
width: t
|
|
813
|
-
} });
|
|
814
|
-
} else this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
815
|
-
height: n,
|
|
816
|
-
keepAspectRatio: !0,
|
|
814
|
+
let [e, n] = t.split(":").map(Number), r = this.unit === O.Pixel && this.hasMaxSize ? O.Pixel : O.AspectRatio;
|
|
815
|
+
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
816
|
+
...V.getRatioSize(e, n, r, this.maxWidth, this.maxHeight),
|
|
817
|
+
keepAspectRatio: r === O.Pixel || !this.inline,
|
|
817
818
|
silent: !0,
|
|
818
|
-
unit:
|
|
819
|
-
width: e
|
|
819
|
+
unit: r
|
|
820
820
|
} });
|
|
821
821
|
}
|
|
822
822
|
this.emit("cx-asset-link-format-crop-mode-change", { detail: { mode: t } });
|
|
@@ -829,18 +829,38 @@ var Ct = class {
|
|
|
829
829
|
this.emit("cx-asset-link-format-crop-position-change", { detail: { position: this.positionPicker.value } });
|
|
830
830
|
}
|
|
831
831
|
onUnitChange(e) {
|
|
832
|
-
e.target.value ===
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
832
|
+
let t = e.target.value === O.AspectRatio ? O.AspectRatio : O.Pixel;
|
|
833
|
+
if (this.inline && !this.selectedMode?.auto) {
|
|
834
|
+
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
835
|
+
...this.#r(t),
|
|
836
|
+
unit: t
|
|
837
|
+
} });
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
841
|
+
height: this.lastAppliedSetting[t].height,
|
|
839
842
|
keepAspectRatio: this.keepAspectRatio,
|
|
840
|
-
unit:
|
|
841
|
-
width: this.lastAppliedSetting[
|
|
843
|
+
unit: t,
|
|
844
|
+
width: this.lastAppliedSetting[t].width
|
|
842
845
|
} }), this.emit("cx-asset-link-format-crop-mode-change", { detail: { mode: "free" } });
|
|
843
846
|
}
|
|
847
|
+
#r(e) {
|
|
848
|
+
let t = e === O.Pixel;
|
|
849
|
+
if (/^\d+:\d+$/.test(this.cropMode)) {
|
|
850
|
+
let [n, r] = this.cropMode.split(":").map(Number);
|
|
851
|
+
return {
|
|
852
|
+
...V.getRatioSize(n, r, e, this.maxWidth, this.maxHeight),
|
|
853
|
+
keepAspectRatio: t
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
return e === O.AspectRatio ? {
|
|
857
|
+
...y(this.width, this.height),
|
|
858
|
+
keepAspectRatio: t
|
|
859
|
+
} : {
|
|
860
|
+
...V.getRatioSize(this.ratioWidth, this.ratioHeight, e, this.maxWidth, this.maxHeight),
|
|
861
|
+
keepAspectRatio: t
|
|
862
|
+
};
|
|
863
|
+
}
|
|
844
864
|
handleInputChange(e) {
|
|
845
865
|
e.stopPropagation(), this.emit("cx-asset-link-format-crop-changed");
|
|
846
866
|
}
|
|
@@ -860,14 +880,14 @@ var Ct = class {
|
|
|
860
880
|
}
|
|
861
881
|
handleAspectRatioClick() {
|
|
862
882
|
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: {
|
|
863
|
-
height: this.unit ===
|
|
883
|
+
height: this.unit === O.Pixel ? this.height : this.ratioHeight,
|
|
864
884
|
keepAspectRatio: !this.keepAspectRatio,
|
|
865
885
|
unit: this.unit,
|
|
866
|
-
width: this.unit ===
|
|
886
|
+
width: this.unit === O.Pixel ? this.width : this.ratioWidth
|
|
867
887
|
} });
|
|
868
888
|
}
|
|
869
889
|
getSizeMaskBlocks(e) {
|
|
870
|
-
let t = this.unit ===
|
|
890
|
+
let t = this.unit === O.Pixel && e >= 1 ? e : Infinity;
|
|
871
891
|
return { num: {
|
|
872
892
|
autofix: !0,
|
|
873
893
|
mask: Number,
|
|
@@ -879,18 +899,18 @@ var Ct = class {
|
|
|
879
899
|
}
|
|
880
900
|
render() {
|
|
881
901
|
let t = this.cropModes.filter((e) => !e.auto), n = this.cropModes.filter((e) => e.auto);
|
|
882
|
-
return e`<cx-details class="details ${this.inline ? "details--inline" : ""}" ?open=${this.inline || this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small">${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${
|
|
902
|
+
return e`<cx-details class="details ${this.inline ? "details--inline" : ""}" ?open=${this.inline || this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small">${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${x(t, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}
|
|
883
903
|
${m(n.length > 0, () => e`<cx-divider></cx-divider><small>${this.localize.term("autoCropping")}</small>`)}
|
|
884
|
-
${
|
|
904
|
+
${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=${this.getSizeMaskBlocks(this.maxWidth)} 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">
|
|
885
905
|
W
|
|
886
|
-
</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=${this.getSizeMaskBlocks(this.maxHeight)} value=${this.unit ===
|
|
906
|
+
</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 || this.inline && this.unit === O.AspectRatio}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${this.getSizeMaskBlocks(this.maxHeight)} 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">
|
|
887
907
|
H
|
|
888
|
-
</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=${
|
|
908
|
+
</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>`)}
|
|
889
909
|
${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>`)}
|
|
890
910
|
${m(!this.inline, () => e`<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>`;
|
|
891
911
|
}
|
|
892
912
|
};
|
|
893
|
-
a([c(".details"), o("design:type", T === void 0 ? Object : T)], H.prototype, "base", void 0), a([c("cx-position-picker"), o("design:type",
|
|
913
|
+
a([c(".details"), o("design:type", T === void 0 ? Object : T)], H.prototype, "base", void 0), a([c("cx-position-picker"), o("design:type", ke === void 0 ? Object : ke)], H.prototype, "positionPicker", void 0), a([r({
|
|
894
914
|
reflect: !0,
|
|
895
915
|
type: Boolean
|
|
896
916
|
}), o("design:type", Boolean)], H.prototype, "open", void 0), a([r({
|
|
@@ -929,7 +949,7 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], H.prototype, "ba
|
|
|
929
949
|
}), o("design:type", Number)], H.prototype, "percentageHeight", void 0), a([r({
|
|
930
950
|
reflect: !0,
|
|
931
951
|
type: String
|
|
932
|
-
}), o("design:type",
|
|
952
|
+
}), o("design:type", O === void 0 ? Object : O)], H.prototype, "unit", void 0), a([r({
|
|
933
953
|
attribute: "disabled-apply",
|
|
934
954
|
reflect: !0,
|
|
935
955
|
type: Boolean
|
|
@@ -984,15 +1004,15 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], H.prototype, "ba
|
|
|
984
1004
|
o("design:type", Function),
|
|
985
1005
|
o("design:paramtypes", []),
|
|
986
1006
|
o("design:returntype", Promise)
|
|
987
|
-
], H.prototype, "handleOpenChange", null), H = a([u("cx-asset-link-format-crop")], H);
|
|
988
|
-
var
|
|
989
|
-
[
|
|
1007
|
+
], H.prototype, "handleOpenChange", null), H = V = a([u("cx-asset-link-format-crop")], H);
|
|
1008
|
+
var Dt = H, Ot = t`:host{display:block}.asset-link-format__dimensions-select{width:100%}.details::part(base){border-bottom-width:0}.asset-link-format__dimensions-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__dimensions-inline .asset-link-format__dimensions-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__dimensions-custom{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,7rem);align-items:center;display:grid}.asset-link-format__dimensions-custom cx-input,.asset-link-format__dimensions-custom cx-select{min-width:0}.asset-link-format__dimensions-apply{margin-inline-start:auto}`, kt = {
|
|
1009
|
+
[k.Percent]: { num: {
|
|
990
1010
|
mask: Number,
|
|
991
1011
|
min: 1,
|
|
992
1012
|
radix: ".",
|
|
993
1013
|
scale: 2
|
|
994
1014
|
} },
|
|
995
|
-
[
|
|
1015
|
+
[k.Pixel]: { num: {
|
|
996
1016
|
mask: Number,
|
|
997
1017
|
min: 1,
|
|
998
1018
|
radix: ".",
|
|
@@ -1000,33 +1020,33 @@ var Et = H, Dt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1000
1020
|
} }
|
|
1001
1021
|
}, U = class extends s {
|
|
1002
1022
|
constructor(...e) {
|
|
1003
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior =
|
|
1004
|
-
[
|
|
1023
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior = M.Legacy, this.loading = !1, this.items = [], this.canCustom = !1, this.customDimensionsUnit = k.Pixel, this.dimensionsSelection = "", this.customDimensionsDrafts = {
|
|
1024
|
+
[k.Percent]: {
|
|
1005
1025
|
height: "100",
|
|
1006
1026
|
width: "100"
|
|
1007
1027
|
},
|
|
1008
|
-
[
|
|
1028
|
+
[k.Pixel]: {
|
|
1009
1029
|
height: "1080",
|
|
1010
1030
|
width: "1920"
|
|
1011
1031
|
}
|
|
1012
1032
|
};
|
|
1013
1033
|
}
|
|
1014
|
-
static #e = this.styles = [l,
|
|
1034
|
+
static #e = this.styles = [l, Ot];
|
|
1015
1035
|
static #t = this.dependencies = {
|
|
1016
1036
|
"cx-button": _,
|
|
1017
1037
|
"cx-details": T,
|
|
1018
|
-
"cx-divider":
|
|
1038
|
+
"cx-divider": ge,
|
|
1019
1039
|
"cx-icon": h,
|
|
1020
|
-
"cx-input":
|
|
1021
|
-
"cx-menu-label":
|
|
1022
|
-
"cx-option":
|
|
1023
|
-
"cx-select":
|
|
1024
|
-
"cx-space":
|
|
1025
|
-
"cx-typography":
|
|
1040
|
+
"cx-input": oe,
|
|
1041
|
+
"cx-menu-label": ve,
|
|
1042
|
+
"cx-option": S,
|
|
1043
|
+
"cx-select": w,
|
|
1044
|
+
"cx-space": C,
|
|
1045
|
+
"cx-typography": b
|
|
1026
1046
|
};
|
|
1027
1047
|
handleDimensionsValueChange() {
|
|
1028
1048
|
let e = this.value;
|
|
1029
|
-
this.dimensionsSelection = e?.mode ===
|
|
1049
|
+
this.dimensionsSelection = e?.mode === E.Custom ? E.Custom : e?.mode === E.Preset ? `preset:${e.value}` : "", e?.mode === E.Custom && (this.customDimensionsUnit = e.unit, this.customDimensionsDrafts = {
|
|
1030
1050
|
...this.customDimensionsDrafts,
|
|
1031
1051
|
[e.unit]: {
|
|
1032
1052
|
height: String(e.height),
|
|
@@ -1039,26 +1059,26 @@ var Et = H, Dt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1039
1059
|
}
|
|
1040
1060
|
getCustomDimensionsValue() {
|
|
1041
1061
|
let e = this.customDimensionsUnit, t = this.customDimensionsDrafts[e], n = Number(t.width), r = Number(t.height);
|
|
1042
|
-
if (!(!Number.isFinite(n) || !Number.isFinite(r) || n < 1 || r < 1) && (e !==
|
|
1062
|
+
if (!(!Number.isFinite(n) || !Number.isFinite(r) || n < 1 || r < 1) && (e !== k.Pixel || Number.isInteger(n) && Number.isInteger(r))) return {
|
|
1043
1063
|
height: r,
|
|
1044
|
-
mode:
|
|
1064
|
+
mode: E.Custom,
|
|
1045
1065
|
unit: e,
|
|
1046
1066
|
width: n
|
|
1047
1067
|
};
|
|
1048
1068
|
}
|
|
1049
1069
|
get pendingValue() {
|
|
1050
|
-
if (this.dimensionsSelection ===
|
|
1070
|
+
if (this.dimensionsSelection === E.Custom) return this.getCustomDimensionsValue();
|
|
1051
1071
|
if (this.dimensionsSelection.startsWith("preset:")) {
|
|
1052
1072
|
let e = this.items.find((e) => `preset:${e.value}` === this.dimensionsSelection && !e.disabled);
|
|
1053
1073
|
return e ? {
|
|
1054
|
-
mode:
|
|
1074
|
+
mode: E.Preset,
|
|
1055
1075
|
value: e.value
|
|
1056
1076
|
} : void 0;
|
|
1057
1077
|
}
|
|
1058
1078
|
}
|
|
1059
1079
|
get applyDisabled() {
|
|
1060
1080
|
let e = this.pendingValue;
|
|
1061
|
-
return !e || !this.value || e.mode !== this.value.mode ? !e : e.mode ===
|
|
1081
|
+
return !e || !this.value || e.mode !== this.value.mode ? !e : e.mode === E.Preset && this.value.mode === E.Preset ? e.value === this.value.value : e.mode === E.Custom && this.value.mode === E.Custom && e.height === this.value.height && e.unit === this.value.unit && e.width === this.value.width;
|
|
1062
1082
|
}
|
|
1063
1083
|
applyPendingValue() {
|
|
1064
1084
|
let e = this.pendingValue;
|
|
@@ -1067,11 +1087,11 @@ var Et = H, Dt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1067
1087
|
onDimensionsSelectChange(e) {
|
|
1068
1088
|
if (e.target !== e.currentTarget || this.loading) return;
|
|
1069
1089
|
let t = e.currentTarget.value;
|
|
1070
|
-
if (t ===
|
|
1090
|
+
if (t === E.Custom && this.canCustom) this.dimensionsSelection = E.Custom, this.applyBehavior !== M.Manual && this.applyPendingValue();
|
|
1071
1091
|
else if (t.startsWith("preset:")) {
|
|
1072
1092
|
let e = this.items.find((e) => `preset:${e.value}` === t && !e.disabled);
|
|
1073
|
-
e && (this.dimensionsSelection = t, this.applyBehavior !==
|
|
1074
|
-
mode:
|
|
1093
|
+
e && (this.dimensionsSelection = t, this.applyBehavior !== M.Manual && this.emitDimensionsValue({
|
|
1094
|
+
mode: E.Preset,
|
|
1075
1095
|
value: e.value
|
|
1076
1096
|
}));
|
|
1077
1097
|
}
|
|
@@ -1088,12 +1108,12 @@ var Et = H, Dt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1088
1108
|
};
|
|
1089
1109
|
}
|
|
1090
1110
|
onDimensionsCustomChange(e) {
|
|
1091
|
-
e.target === e.currentTarget && !this.loading && this.canCustom && e.currentTarget.reportValidity() && this.applyBehavior !==
|
|
1111
|
+
e.target === e.currentTarget && !this.loading && this.canCustom && e.currentTarget.reportValidity() && this.applyBehavior !== M.Manual && this.applyPendingValue();
|
|
1092
1112
|
}
|
|
1093
1113
|
onDimensionsUnitChange(e) {
|
|
1094
1114
|
if (e.target !== e.currentTarget || this.loading || !this.canCustom) return;
|
|
1095
1115
|
let t = e.currentTarget.value;
|
|
1096
|
-
(t ===
|
|
1116
|
+
(t === k.Pixel || t === k.Percent) && (this.customDimensionsUnit = t, this.applyBehavior !== M.Manual && this.applyPendingValue());
|
|
1097
1117
|
}
|
|
1098
1118
|
onApply() {
|
|
1099
1119
|
!this.loading && !this.applyDisabled && this.applyPendingValue();
|
|
@@ -1106,21 +1126,21 @@ var Et = H, Dt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1106
1126
|
}
|
|
1107
1127
|
renderCustomDimensions() {
|
|
1108
1128
|
let t = this.customDimensionsUnit, n = this.customDimensionsDrafts[t];
|
|
1109
|
-
return e`<cx-space class="asset-link-format__dimensions-custom" spacing="small"><cx-input name="width" mask="num" .maskBlocks=${
|
|
1129
|
+
return e`<cx-space class="asset-link-format__dimensions-custom" spacing="small"><cx-input name="width" mask="num" .maskBlocks=${kt[t]} aria-label=${this.localize.term("maxWidth")} value=${n.width} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">W</cx-typography></cx-input><cx-input name="height" mask="num" .maskBlocks=${kt[t]} aria-label=${this.localize.term("maxHeight")} value=${n.height} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">H</cx-typography></cx-input><cx-select data-label=${this.localize.term("unit")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsUnitChange}><cx-option value=${k.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${k.Percent}>${this.localize.term("dimensionsPercent")}</cx-option></cx-select></cx-space>`;
|
|
1110
1130
|
}
|
|
1111
1131
|
renderSummary() {
|
|
1112
1132
|
return e`<cx-space class="asset-link-format__dimensions-summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("dimensions")}</cx-typography></cx-space>`;
|
|
1113
1133
|
}
|
|
1114
1134
|
renderContent() {
|
|
1115
|
-
let t = this.canCustom && this.dimensionsSelection ===
|
|
1116
|
-
return e`<cx-space class="asset-link-format__dimensions-content" direction="vertical" spacing="small"><cx-select class="asset-link-format__dimensions-select" data-label=${this.localize.term("dimensions")} value=${this.dimensionsSelection ===
|
|
1135
|
+
let t = this.canCustom && this.dimensionsSelection === E.Custom;
|
|
1136
|
+
return e`<cx-space class="asset-link-format__dimensions-content" direction="vertical" spacing="small"><cx-select class="asset-link-format__dimensions-select" data-label=${this.localize.term("dimensions")} value=${this.dimensionsSelection === E.Custom && !this.canCustom ? "" : this.dimensionsSelection} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsSelectChange}>${x(this.items, (e) => e.value, (t, n) => e`
|
|
1117
1137
|
${m(t.group !== this.items[n - 1]?.group, () => e`
|
|
1118
1138
|
${m(n > 0, () => e`<cx-divider></cx-divider>`)}
|
|
1119
1139
|
${m(!!t.group, () => e`<cx-menu-label>${t.group}</cx-menu-label>`)}
|
|
1120
1140
|
`)}<cx-option value=${`preset:${t.value}`} ?disabled=${t.disabled}>${t.label}</cx-option>`)}
|
|
1121
1141
|
${m(this.canCustom, () => e`
|
|
1122
|
-
${m(this.items.length > 0, () => e`<cx-divider></cx-divider>`)}<cx-option value=${
|
|
1123
|
-
${m(this.applyBehavior ===
|
|
1142
|
+
${m(this.items.length > 0, () => e`<cx-divider></cx-divider>`)}<cx-option value=${E.Custom}><cx-icon slot="prefix" name="edit"></cx-icon>${this.localize.term("custom")}</cx-option>`)}</cx-select>${m(t, () => this.renderCustomDimensions())}
|
|
1143
|
+
${m(this.applyBehavior === M.Manual, () => e`<cx-button class="asset-link-format__dimensions-apply" data-testid="cx-asset-link-format-dimensions-apply" variant="primary" ?disabled=${this.applyDisabled} ?loading=${this.loading} @click=${this.onApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space>`;
|
|
1124
1144
|
}
|
|
1125
1145
|
render() {
|
|
1126
1146
|
return this.inline ? e`<div class="asset-link-format__dimensions-inline">${this.renderSummary()}
|
|
@@ -1155,23 +1175,23 @@ a([r({
|
|
|
1155
1175
|
o("design:paramtypes", []),
|
|
1156
1176
|
o("design:returntype", void 0)
|
|
1157
1177
|
], U.prototype, "handleDimensionsValueChange", null), U = a([u("cx-asset-link-format-dimensions")], U);
|
|
1158
|
-
var
|
|
1178
|
+
var At = U, jt = 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%}}`, W = class extends s {
|
|
1159
1179
|
constructor(...e) {
|
|
1160
1180
|
super(...e), this.localize = new d(this), this.value = "", this.items = [];
|
|
1161
1181
|
}
|
|
1162
|
-
static #e = this.styles = [l,
|
|
1182
|
+
static #e = this.styles = [l, jt];
|
|
1163
1183
|
static #t = this.dependencies = {
|
|
1164
|
-
"cx-option":
|
|
1165
|
-
"cx-select":
|
|
1166
|
-
"cx-space":
|
|
1167
|
-
"cx-typography":
|
|
1184
|
+
"cx-option": S,
|
|
1185
|
+
"cx-select": w,
|
|
1186
|
+
"cx-space": C,
|
|
1187
|
+
"cx-typography": b
|
|
1168
1188
|
};
|
|
1169
1189
|
handleExtensionChange(e) {
|
|
1170
1190
|
let t = e.target.value;
|
|
1171
1191
|
this.emit("cx-asset-link-format-extension-change", { detail: t });
|
|
1172
1192
|
}
|
|
1173
1193
|
render() {
|
|
1174
|
-
return e`<cx-space direction="vertical" spacing="small" class="extension"><cx-typography variant="body2">${this.localize.term("extension")}</cx-typography><cx-select data-label=${this.localize.term("extension")} data-testid="cx-asset-link-format-extension-select" value=${this.value} hoist @cx-change=${this.handleExtensionChange}>${
|
|
1194
|
+
return e`<cx-space direction="vertical" spacing="small" class="extension"><cx-typography variant="body2">${this.localize.term("extension")}</cx-typography><cx-select data-label=${this.localize.term("extension")} data-testid="cx-asset-link-format-extension-select" value=${this.value} hoist @cx-change=${this.handleExtensionChange}>${x(this.items, (e) => e.value, (t) => e`<cx-option value=${t.value}>${t.displayName}</cx-option>`)}</cx-select></cx-space>`;
|
|
1175
1195
|
}
|
|
1176
1196
|
};
|
|
1177
1197
|
a([r({
|
|
@@ -1181,23 +1201,23 @@ a([r({
|
|
|
1181
1201
|
reflect: !1,
|
|
1182
1202
|
type: Array
|
|
1183
1203
|
}), o("design:type", typeof Array > "u" ? Object : Array)], W.prototype, "items", void 0), W = a([u("cx-asset-link-format-extension")], W);
|
|
1184
|
-
var
|
|
1204
|
+
var Mt = W, Nt = t`cx-details::part(base){border-bottom-width:0}`, Pt = "auto", G = class extends s {
|
|
1185
1205
|
constructor(...e) {
|
|
1186
1206
|
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 = "";
|
|
1187
1207
|
}
|
|
1188
|
-
static #e = this.styles = [l,
|
|
1208
|
+
static #e = this.styles = [l, Nt];
|
|
1189
1209
|
static #t = this.dependencies = {
|
|
1190
1210
|
"cx-button": _,
|
|
1191
1211
|
"cx-details": T,
|
|
1192
|
-
"cx-divider":
|
|
1212
|
+
"cx-divider": ge,
|
|
1193
1213
|
"cx-icon": h,
|
|
1194
|
-
"cx-option":
|
|
1195
|
-
"cx-select":
|
|
1196
|
-
"cx-space":
|
|
1197
|
-
"cx-typography":
|
|
1214
|
+
"cx-option": S,
|
|
1215
|
+
"cx-select": w,
|
|
1216
|
+
"cx-space": C,
|
|
1217
|
+
"cx-typography": b
|
|
1198
1218
|
};
|
|
1199
1219
|
get committedValue() {
|
|
1200
|
-
return this.autoFormat ?
|
|
1220
|
+
return this.autoFormat ? Pt : this.value;
|
|
1201
1221
|
}
|
|
1202
1222
|
handleValueChange() {
|
|
1203
1223
|
this.scopedValue = this.committedValue;
|
|
@@ -1228,8 +1248,8 @@ var jt = W, Mt = t`cx-details::part(base){border-bottom-width:0}`, Nt = "auto",
|
|
|
1228
1248
|
e.target !== this.base && e.stopPropagation();
|
|
1229
1249
|
}
|
|
1230
1250
|
render() {
|
|
1231
|
-
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}>${
|
|
1232
|
-
${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${
|
|
1251
|
+
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>`)}
|
|
1252
|
+
${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${Pt}>${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>`;
|
|
1233
1253
|
}
|
|
1234
1254
|
};
|
|
1235
1255
|
a([c(".details"), o("design:type", T === void 0 ? Object : T)], G.prototype, "base", void 0), a([r({
|
|
@@ -1264,22 +1284,22 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], G.prototype, "ba
|
|
|
1264
1284
|
o("design:paramtypes", []),
|
|
1265
1285
|
o("design:returntype", void 0)
|
|
1266
1286
|
], G.prototype, "handleOpenChange", null), G = a([u("cx-asset-link-format-proxy")], G);
|
|
1267
|
-
var
|
|
1287
|
+
var Ft = G, It = t`cx-details::part(base){border-bottom-width:0}.asset-link-format__quality-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__quality-inline .asset-link-format__quality-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__quality-apply{margin-inline-start:auto}`, K = class extends s {
|
|
1268
1288
|
constructor(...e) {
|
|
1269
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior =
|
|
1289
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior = M.Legacy, this.value = 100, this.items = [], this.customSelected = !1, this.loading = !1, this.scopedValue = 100;
|
|
1270
1290
|
}
|
|
1271
|
-
static #e = this.styles = [l,
|
|
1291
|
+
static #e = this.styles = [l, It];
|
|
1272
1292
|
static #t = this.dependencies = {
|
|
1273
1293
|
"cx-button": _,
|
|
1274
1294
|
"cx-details": T,
|
|
1275
|
-
"cx-divider":
|
|
1295
|
+
"cx-divider": ge,
|
|
1276
1296
|
"cx-icon": h,
|
|
1277
|
-
"cx-input":
|
|
1278
|
-
"cx-option":
|
|
1279
|
-
"cx-select":
|
|
1280
|
-
"cx-space":
|
|
1297
|
+
"cx-input": oe,
|
|
1298
|
+
"cx-option": S,
|
|
1299
|
+
"cx-select": w,
|
|
1300
|
+
"cx-space": C,
|
|
1281
1301
|
"cx-tooltip": te,
|
|
1282
|
-
"cx-typography":
|
|
1302
|
+
"cx-typography": b
|
|
1283
1303
|
};
|
|
1284
1304
|
get invalidValue() {
|
|
1285
1305
|
return isNaN(Number(this.scopedValue)) || Number(this.scopedValue) < 1 || Number(this.scopedValue) > 100 || this.value === this.scopedValue;
|
|
@@ -1292,14 +1312,14 @@ var Pt = G, Ft = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1292
1312
|
let t = e.currentTarget.value;
|
|
1293
1313
|
if (this.customSelected = t === "custom", this.customSelected) return;
|
|
1294
1314
|
let n = this.items.find((e) => String(e.value) === t && !e.disabled);
|
|
1295
|
-
!n || !Number.isFinite(n.value) || n.value < 1 || n.value > 100 || (this.scopedValue = n.value, n.value !== this.value && this.applyBehavior !==
|
|
1315
|
+
!n || !Number.isFinite(n.value) || n.value < 1 || n.value > 100 || (this.scopedValue = n.value, n.value !== this.value && this.applyBehavior !== M.Manual && this.handleApply());
|
|
1296
1316
|
}
|
|
1297
1317
|
handleQualityChange(e) {
|
|
1298
1318
|
let t = e.target.value;
|
|
1299
1319
|
this.customSelected = !0, this.scopedValue = Number(t);
|
|
1300
1320
|
}
|
|
1301
1321
|
handleQualityCommit(e) {
|
|
1302
|
-
e.target === e.currentTarget && this.applyBehavior ===
|
|
1322
|
+
e.target === e.currentTarget && this.applyBehavior === M.Automatic && this.handleApply();
|
|
1303
1323
|
}
|
|
1304
1324
|
handleApply() {
|
|
1305
1325
|
this.loading || this.invalidValue || this.emit("cx-asset-link-format-quality-change", { detail: Number(this.scopedValue) });
|
|
@@ -1312,7 +1332,7 @@ var Pt = G, Ft = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1312
1332
|
}
|
|
1313
1333
|
renderPresets() {
|
|
1314
1334
|
let t = !this.customSelected && this.items.some((e) => e.value === this.scopedValue) ? String(this.scopedValue) : "custom";
|
|
1315
|
-
return e`<cx-select data-label=${this.localize.term("quality")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.handlePresetChange}>${
|
|
1335
|
+
return e`<cx-select data-label=${this.localize.term("quality")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.handlePresetChange}>${x(this.items, (e) => e.value, (t) => e`<cx-option value=${String(t.value)} ?disabled=${t.disabled}>${t.label}
|
|
1316
1336
|
${m(!!t.description, () => e`<span slot="help-text">${t.description}</span>`)}</cx-option>`)}<cx-divider></cx-divider><cx-option value="custom"><cx-icon slot="prefix" name="edit"></cx-icon>${this.localize.term("custom")}<span slot="help-text">${this.localize.term("qualityHelpText")}</span></cx-option></cx-select>`;
|
|
1317
1337
|
}
|
|
1318
1338
|
renderSummary() {
|
|
@@ -1330,8 +1350,8 @@ var Pt = G, Ft = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1330
1350
|
min: 1,
|
|
1331
1351
|
radix: ".",
|
|
1332
1352
|
scale: 0
|
|
1333
|
-
} }} value=${this.scopedValue.toString()} style=${g({ flex: "1" })} @cx-input=${this.handleQualityChange} @cx-change=${this.handleQualityCommit}></cx-input></cx-tooltip>${m(this.applyBehavior ===
|
|
1334
|
-
${m(this.applyBehavior ===
|
|
1353
|
+
} }} value=${this.scopedValue.toString()} style=${g({ flex: "1" })} @cx-input=${this.handleQualityChange} @cx-change=${this.handleQualityCommit}></cx-input></cx-tooltip>${m(this.applyBehavior === M.Legacy, () => this.renderApplyButton())}</cx-space>`)}
|
|
1354
|
+
${m(this.applyBehavior === M.Manual, () => this.renderApplyButton())}</cx-space>`;
|
|
1335
1355
|
}
|
|
1336
1356
|
render() {
|
|
1337
1357
|
return this.inline ? e`<div class="asset-link-format__quality-inline">${this.renderSummary()}
|
|
@@ -1363,30 +1383,30 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], K.prototype, "ba
|
|
|
1363
1383
|
o("design:paramtypes", []),
|
|
1364
1384
|
o("design:returntype", void 0)
|
|
1365
1385
|
], K.prototype, "handleValueChange", null), K = a([u("cx-asset-link-format-quality")], K);
|
|
1366
|
-
var
|
|
1386
|
+
var Lt = K, Rt = 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}`, q = class extends s {
|
|
1367
1387
|
constructor(...e) {
|
|
1368
|
-
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 =
|
|
1369
|
-
[
|
|
1388
|
+
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 = {
|
|
1389
|
+
[O.Pixel]: {
|
|
1370
1390
|
height: 0,
|
|
1371
1391
|
width: 0
|
|
1372
1392
|
},
|
|
1373
|
-
[
|
|
1393
|
+
[O.AspectRatio]: {
|
|
1374
1394
|
height: 1,
|
|
1375
1395
|
width: 1
|
|
1376
1396
|
}
|
|
1377
1397
|
}, this.loading = !1, this.noRatioModes = !1, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
1378
1398
|
}
|
|
1379
|
-
static #e = this.styles = [l,
|
|
1399
|
+
static #e = this.styles = [l, Rt];
|
|
1380
1400
|
static #t = this.dependencies = {
|
|
1381
1401
|
"cx-button": _,
|
|
1382
1402
|
"cx-details": T,
|
|
1383
1403
|
"cx-icon": h,
|
|
1384
1404
|
"cx-icon-button": p,
|
|
1385
|
-
"cx-input":
|
|
1386
|
-
"cx-option":
|
|
1387
|
-
"cx-select":
|
|
1388
|
-
"cx-space":
|
|
1389
|
-
"cx-typography":
|
|
1405
|
+
"cx-input": oe,
|
|
1406
|
+
"cx-option": S,
|
|
1407
|
+
"cx-select": w,
|
|
1408
|
+
"cx-space": C,
|
|
1409
|
+
"cx-typography": b
|
|
1390
1410
|
};
|
|
1391
1411
|
get disabledApply() {
|
|
1392
1412
|
return this.lastAppliedSetting[this.unit].width === this.width && this.lastAppliedSetting[this.unit].height === this.height;
|
|
@@ -1394,11 +1414,11 @@ var It = K, Lt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1394
1414
|
async handleCropModeChange() {
|
|
1395
1415
|
let e = Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && this.maxWidth > 0 && this.maxHeight > 0;
|
|
1396
1416
|
if (this.keepAspectRatio) {
|
|
1397
|
-
if (this.unit ===
|
|
1417
|
+
if (this.unit === O.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
1398
1418
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
1399
1419
|
return;
|
|
1400
1420
|
}
|
|
1401
|
-
if (this.unit ===
|
|
1421
|
+
if (this.unit === O.Pixel && !e && this.width && this.height) {
|
|
1402
1422
|
this.aspectRatio = this.width / this.height;
|
|
1403
1423
|
return;
|
|
1404
1424
|
}
|
|
@@ -1426,8 +1446,8 @@ var It = K, Lt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1426
1446
|
this.invalidWidth = !0;
|
|
1427
1447
|
return;
|
|
1428
1448
|
}
|
|
1429
|
-
this.invalidWidth = !1, this.unit ===
|
|
1430
|
-
let n = this.unit ===
|
|
1449
|
+
this.invalidWidth = !1, this.unit === O.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1)), e.target.value = t.toString();
|
|
1450
|
+
let n = this.unit === O.Pixel ? this.height : this.ratioHeight;
|
|
1431
1451
|
this.keepAspectRatio && (n = Math.max(Math.min(Math.round(t / this.aspectRatio), this.maxHeight), 1), this.invalidHeight = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1432
1452
|
height: n,
|
|
1433
1453
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -1441,8 +1461,8 @@ var It = K, Lt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1441
1461
|
this.invalidHeight = !0;
|
|
1442
1462
|
return;
|
|
1443
1463
|
}
|
|
1444
|
-
this.invalidHeight = !1, this.unit ===
|
|
1445
|
-
let n = this.unit ===
|
|
1464
|
+
this.invalidHeight = !1, this.unit === O.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1)), e.target.value = t.toString();
|
|
1465
|
+
let n = this.unit === O.Pixel ? this.width : this.ratioWidth;
|
|
1446
1466
|
this.keepAspectRatio && (n = Math.max(Math.min(Math.round(t * this.aspectRatio), this.maxWidth), 1), this.invalidWidth = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1447
1467
|
height: t,
|
|
1448
1468
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -1451,16 +1471,16 @@ var It = K, Lt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1451
1471
|
} });
|
|
1452
1472
|
}
|
|
1453
1473
|
onUnitChange(e) {
|
|
1454
|
-
e.target.value ===
|
|
1455
|
-
height: this.lastAppliedSetting[
|
|
1474
|
+
e.target.value === O.AspectRatio ? this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1475
|
+
height: this.lastAppliedSetting[O.AspectRatio].height,
|
|
1456
1476
|
keepAspectRatio: this.keepAspectRatio,
|
|
1457
|
-
unit:
|
|
1458
|
-
width: this.lastAppliedSetting[
|
|
1477
|
+
unit: O.AspectRatio,
|
|
1478
|
+
width: this.lastAppliedSetting[O.AspectRatio].width
|
|
1459
1479
|
} }) : this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1460
|
-
height: this.lastAppliedSetting[
|
|
1480
|
+
height: this.lastAppliedSetting[O.Pixel].height,
|
|
1461
1481
|
keepAspectRatio: this.keepAspectRatio,
|
|
1462
|
-
unit:
|
|
1463
|
-
width: this.lastAppliedSetting[
|
|
1482
|
+
unit: O.Pixel,
|
|
1483
|
+
width: this.lastAppliedSetting[O.Pixel].width
|
|
1464
1484
|
} });
|
|
1465
1485
|
}
|
|
1466
1486
|
handleApply() {
|
|
@@ -1478,10 +1498,10 @@ var It = K, Lt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1478
1498
|
}
|
|
1479
1499
|
handleAspectRatioClick() {
|
|
1480
1500
|
this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1481
|
-
height: this.unit ===
|
|
1501
|
+
height: this.unit === O.Pixel ? this.height : this.ratioHeight,
|
|
1482
1502
|
keepAspectRatio: !this.keepAspectRatio,
|
|
1483
1503
|
unit: this.unit,
|
|
1484
|
-
width: this.unit ===
|
|
1504
|
+
width: this.unit === O.Pixel ? this.width : this.ratioWidth
|
|
1485
1505
|
} });
|
|
1486
1506
|
}
|
|
1487
1507
|
render() {
|
|
@@ -1490,16 +1510,16 @@ var It = K, Lt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1490
1510
|
min: 1,
|
|
1491
1511
|
radix: ".",
|
|
1492
1512
|
scale: 0
|
|
1493
|
-
} }} value=${this.unit ===
|
|
1513
|
+
} }} 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">
|
|
1494
1514
|
W
|
|
1495
1515
|
</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: {
|
|
1496
1516
|
mask: Number,
|
|
1497
1517
|
min: 1,
|
|
1498
1518
|
radix: ".",
|
|
1499
1519
|
scale: 0
|
|
1500
|
-
} }} value=${this.unit ===
|
|
1520
|
+
} }} 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">
|
|
1501
1521
|
H
|
|
1502
|
-
</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=${
|
|
1522
|
+
</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>`;
|
|
1503
1523
|
}
|
|
1504
1524
|
};
|
|
1505
1525
|
a([c(".details"), o("design:type", T === void 0 ? Object : T)], q.prototype, "base", void 0), a([r({
|
|
@@ -1530,7 +1550,7 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], q.prototype, "ba
|
|
|
1530
1550
|
}), o("design:type", Number)], q.prototype, "ratioHeight", void 0), a([r({
|
|
1531
1551
|
reflect: !0,
|
|
1532
1552
|
type: String
|
|
1533
|
-
}), o("design:type",
|
|
1553
|
+
}), o("design:type", O === void 0 ? Object : O)], q.prototype, "unit", void 0), a([r({
|
|
1534
1554
|
attribute: "last-applied-setting",
|
|
1535
1555
|
reflect: !1,
|
|
1536
1556
|
type: Object
|
|
@@ -1559,19 +1579,19 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], q.prototype, "ba
|
|
|
1559
1579
|
o("design:paramtypes", []),
|
|
1560
1580
|
o("design:returntype", Promise)
|
|
1561
1581
|
], q.prototype, "handleOpenChange", null), q = a([u("cx-asset-link-format-resize")], q);
|
|
1562
|
-
var
|
|
1582
|
+
var zt = q, Bt = t`cx-details::part(base){border-bottom-width:0}.asset-link-format__rotation-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__rotation-inline .asset-link-format__rotation-summary{margin-block-end:var(--cx-spacing-small)}`, J = class extends s {
|
|
1563
1583
|
constructor(...e) {
|
|
1564
1584
|
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.value = 0, this.defaultValue = 0, this.loading = !1, this.lastAppliedValue = 0;
|
|
1565
1585
|
}
|
|
1566
|
-
static #e = this.styles = [l,
|
|
1586
|
+
static #e = this.styles = [l, Bt];
|
|
1567
1587
|
static #t = this.dependencies = {
|
|
1568
1588
|
"cx-button": _,
|
|
1569
|
-
"cx-button-group":
|
|
1589
|
+
"cx-button-group": ie,
|
|
1570
1590
|
"cx-details": T,
|
|
1571
1591
|
"cx-icon": h,
|
|
1572
1592
|
"cx-icon-button": p,
|
|
1573
|
-
"cx-space":
|
|
1574
|
-
"cx-typography":
|
|
1593
|
+
"cx-space": C,
|
|
1594
|
+
"cx-typography": b
|
|
1575
1595
|
};
|
|
1576
1596
|
handleOpenChange() {
|
|
1577
1597
|
this.open || this.emit("cx-asset-link-format-rotation-change", { detail: this.lastAppliedValue });
|
|
@@ -1641,19 +1661,19 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], J.prototype, "ba
|
|
|
1641
1661
|
o("design:paramtypes", []),
|
|
1642
1662
|
o("design:returntype", void 0)
|
|
1643
1663
|
], J.prototype, "handleOpenChange", null), J = a([u("cx-asset-link-format-rotation")], J);
|
|
1644
|
-
var
|
|
1664
|
+
var Vt = J, Ht = t`cx-details::part(base){border-bottom-width:0}`, Y = class extends s {
|
|
1645
1665
|
constructor(...e) {
|
|
1646
1666
|
super(...e), this.localize = new d(this), this.open = !1, this.value = !1;
|
|
1647
1667
|
}
|
|
1648
|
-
static #e = this.styles = [l,
|
|
1668
|
+
static #e = this.styles = [l, Ht];
|
|
1649
1669
|
static #t = this.dependencies = {
|
|
1650
1670
|
"cx-button": _,
|
|
1651
|
-
"cx-checkbox":
|
|
1671
|
+
"cx-checkbox": ae,
|
|
1652
1672
|
"cx-details": T,
|
|
1653
1673
|
"cx-icon": h,
|
|
1654
|
-
"cx-space":
|
|
1674
|
+
"cx-space": C,
|
|
1655
1675
|
"cx-tooltip": te,
|
|
1656
|
-
"cx-typography":
|
|
1676
|
+
"cx-typography": b
|
|
1657
1677
|
};
|
|
1658
1678
|
handleApply(e) {
|
|
1659
1679
|
this.emit("cx-asset-link-format-metadata-change", { detail: e.target.checked });
|
|
@@ -1675,57 +1695,57 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], Y.prototype, "ba
|
|
|
1675
1695
|
reflect: !0,
|
|
1676
1696
|
type: Boolean
|
|
1677
1697
|
}), o("design:type", Object)], Y.prototype, "value", void 0), Y = a([u("cx-asset-link-format-metadata")], Y);
|
|
1678
|
-
var
|
|
1679
|
-
[
|
|
1680
|
-
[
|
|
1681
|
-
[
|
|
1682
|
-
[
|
|
1683
|
-
[
|
|
1698
|
+
var Ut = Y, X, Wt = {
|
|
1699
|
+
[A.Crop]: D.Crop,
|
|
1700
|
+
[A.Dimensions]: D.Dimensions,
|
|
1701
|
+
[A.Quality]: D.Quality,
|
|
1702
|
+
[A.Resize]: D.Resize,
|
|
1703
|
+
[A.Rotate]: D.Rotate
|
|
1684
1704
|
}, Z = [
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
],
|
|
1692
|
-
|
|
1693
|
-
|
|
1705
|
+
A.Proxy,
|
|
1706
|
+
A.Crop,
|
|
1707
|
+
A.Resize,
|
|
1708
|
+
A.Rotate,
|
|
1709
|
+
A.Quality,
|
|
1710
|
+
A.Metadata
|
|
1711
|
+
], Gt = [
|
|
1712
|
+
A.Proxy,
|
|
1713
|
+
A.Dimensions,
|
|
1694
1714
|
...Z.slice(1)
|
|
1695
1715
|
], Q = [
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1716
|
+
A.Dimensions,
|
|
1717
|
+
A.Crop,
|
|
1718
|
+
A.Resize,
|
|
1719
|
+
A.Rotate,
|
|
1720
|
+
A.Quality
|
|
1701
1721
|
], $ = class extends s {
|
|
1702
1722
|
static #e = X = this;
|
|
1703
|
-
static #t = this.styles = [l,
|
|
1723
|
+
static #t = this.styles = [l, Tt];
|
|
1704
1724
|
static #n = this.dependencies = {
|
|
1705
|
-
"cx-asset-link-format-crop":
|
|
1706
|
-
"cx-asset-link-format-dimensions":
|
|
1707
|
-
"cx-asset-link-format-extension":
|
|
1708
|
-
"cx-asset-link-format-metadata":
|
|
1709
|
-
"cx-asset-link-format-proxy":
|
|
1710
|
-
"cx-asset-link-format-quality":
|
|
1711
|
-
"cx-asset-link-format-resize":
|
|
1712
|
-
"cx-asset-link-format-rotation":
|
|
1725
|
+
"cx-asset-link-format-crop": Dt,
|
|
1726
|
+
"cx-asset-link-format-dimensions": At,
|
|
1727
|
+
"cx-asset-link-format-extension": Mt,
|
|
1728
|
+
"cx-asset-link-format-metadata": Ut,
|
|
1729
|
+
"cx-asset-link-format-proxy": Ft,
|
|
1730
|
+
"cx-asset-link-format-quality": Lt,
|
|
1731
|
+
"cx-asset-link-format-resize": zt,
|
|
1732
|
+
"cx-asset-link-format-rotation": Vt,
|
|
1713
1733
|
"cx-button": _,
|
|
1714
1734
|
"cx-icon": h,
|
|
1715
1735
|
"cx-icon-button": p,
|
|
1716
|
-
"cx-space":
|
|
1717
|
-
"cx-switch":
|
|
1718
|
-
"cx-typography":
|
|
1719
|
-
"cx-visually-hidden":
|
|
1736
|
+
"cx-space": C,
|
|
1737
|
+
"cx-switch": ye,
|
|
1738
|
+
"cx-typography": b,
|
|
1739
|
+
"cx-visually-hidden": se
|
|
1720
1740
|
};
|
|
1721
1741
|
static getTransformExtension(e) {
|
|
1722
|
-
return !e ||
|
|
1742
|
+
return !e || xt(e) ? e : "jpg";
|
|
1723
1743
|
}
|
|
1724
1744
|
static uniqueTransformations(e) {
|
|
1725
1745
|
return [...new Map(e.map((e) => [e.key, e])).values()];
|
|
1726
1746
|
}
|
|
1727
1747
|
static orderTransformations(e, t) {
|
|
1728
|
-
let n = t.map((e) =>
|
|
1748
|
+
let n = t.map((e) => Wt[e]).filter((e) => e !== void 0), r = e.filter((e) => n.includes(e.key)).sort((e, t) => n.indexOf(e.key) - n.indexOf(t.key)), i = 0;
|
|
1729
1749
|
return e.map((e) => n.includes(e.key) ? r[i++] : e);
|
|
1730
1750
|
}
|
|
1731
1751
|
static getDimensionsPresetSize(e) {
|
|
@@ -1736,8 +1756,8 @@ var Ht = Y, X, Ut = {
|
|
|
1736
1756
|
} : void 0;
|
|
1737
1757
|
}
|
|
1738
1758
|
static getDimensionsSize(e) {
|
|
1739
|
-
if (e?.mode ===
|
|
1740
|
-
if (e?.mode ===
|
|
1759
|
+
if (e?.mode === E.Preset) return X.getDimensionsPresetSize(e.value);
|
|
1760
|
+
if (e?.mode === E.Custom && e.unit === k.Pixel && Number.isInteger(e.width) && Number.isInteger(e.height) && e.width >= 1 && e.height >= 1) return {
|
|
1741
1761
|
height: e.height,
|
|
1742
1762
|
width: e.width
|
|
1743
1763
|
};
|
|
@@ -1745,15 +1765,15 @@ var Ht = Y, X, Ut = {
|
|
|
1745
1765
|
static getSizeBoundAfterStep(e, t) {
|
|
1746
1766
|
let { height: n = 0, rotation: r = 0, unit: i, width: a = 0 } = t.value, o = Math.round(a) >= 1 && Math.round(n) >= 1;
|
|
1747
1767
|
switch (t.key) {
|
|
1748
|
-
case
|
|
1768
|
+
case D.Resize: return i !== O.AspectRatio && o ? {
|
|
1749
1769
|
height: Math.round(n),
|
|
1750
1770
|
width: Math.round(a)
|
|
1751
1771
|
} : void 0;
|
|
1752
|
-
case
|
|
1772
|
+
case D.Dimensions: return o ? {
|
|
1753
1773
|
height: Math.min(e?.height ?? Infinity, Math.round(n)),
|
|
1754
1774
|
width: Math.min(e?.width ?? Infinity, Math.round(a))
|
|
1755
1775
|
} : e;
|
|
1756
|
-
case
|
|
1776
|
+
case D.Rotate: {
|
|
1757
1777
|
if (!e) return;
|
|
1758
1778
|
let t = r * Math.PI / 180, n = Math.abs(Math.cos(t)), i = Math.abs(Math.sin(t));
|
|
1759
1779
|
return {
|
|
@@ -1768,24 +1788,24 @@ var Ht = Y, X, Ut = {
|
|
|
1768
1788
|
return this.reorderable && !this.asset;
|
|
1769
1789
|
}
|
|
1770
1790
|
get isFormatsLayout() {
|
|
1771
|
-
return this.layout ===
|
|
1791
|
+
return this.layout === _e.Formats;
|
|
1772
1792
|
}
|
|
1773
1793
|
get hasUnfrozenTransformations() {
|
|
1774
1794
|
return !(this.transformations.length === 0 || this.frozenIndex !== void 0 && this.frozenIndex >= this.transformations.length - 1);
|
|
1775
1795
|
}
|
|
1776
1796
|
get lastAppliedCropUnit() {
|
|
1777
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1797
|
+
return this.transformations.findLast((e) => e.key === D.Crop)?.value.unit ?? O.Pixel;
|
|
1778
1798
|
}
|
|
1779
1799
|
get lastAppliedCropFocusMode() {
|
|
1780
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1800
|
+
return this.transformations.findLast((e) => e.key === D.Crop)?.value.focusMode ?? "manual";
|
|
1781
1801
|
}
|
|
1782
1802
|
get lastAppliedCropPosition() {
|
|
1783
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1803
|
+
return this.transformations.findLast((e) => e.key === D.Crop)?.value.position ?? v.CenterCenter;
|
|
1784
1804
|
}
|
|
1785
1805
|
get disabledCropApply() {
|
|
1786
1806
|
if (!this.asset && this.cropSize.unit !== this.lastAppliedCropUnit) return !1;
|
|
1787
|
-
if (this.cropSize.unit ===
|
|
1788
|
-
let e = this.lastCropSize[
|
|
1807
|
+
if (this.cropSize.unit === O.AspectRatio && !this.asset) {
|
|
1808
|
+
let e = this.lastCropSize[O.AspectRatio];
|
|
1789
1809
|
return this.cropSize.ratioWidth === e.width && this.cropSize.ratioHeight === e.height && this.cropSize.focusMode === this.lastAppliedCropFocusMode && this.cropSize.position === this.lastAppliedCropPosition;
|
|
1790
1810
|
}
|
|
1791
1811
|
if (!this.asset && this.cropSize.focusMode !== this.lastAppliedCropFocusMode || !this.asset && this.cropSize.position !== this.lastAppliedCropPosition) return !1;
|
|
@@ -1796,14 +1816,14 @@ var Ht = Y, X, Ut = {
|
|
|
1796
1816
|
"width",
|
|
1797
1817
|
"x",
|
|
1798
1818
|
"y"
|
|
1799
|
-
]) if (this.cropSize[e] !== this.lastCropSize[
|
|
1819
|
+
]) if (this.cropSize[e] !== this.lastCropSize[O.Pixel][e]) return !1;
|
|
1800
1820
|
return !0;
|
|
1801
1821
|
}
|
|
1802
1822
|
get formats() {
|
|
1803
1823
|
return this.proxies?.filter((e) => !e.cdnName) || [];
|
|
1804
1824
|
}
|
|
1805
1825
|
get activeParts() {
|
|
1806
|
-
let e = new Set(Object.values(
|
|
1826
|
+
let e = new Set(Object.values(A)), t = /* @__PURE__ */ new Set();
|
|
1807
1827
|
for (let n of this.parts) e.has(n) && t.add(n);
|
|
1808
1828
|
return [...t];
|
|
1809
1829
|
}
|
|
@@ -1814,11 +1834,11 @@ var Ht = Y, X, Ut = {
|
|
|
1814
1834
|
};
|
|
1815
1835
|
}
|
|
1816
1836
|
get stepsBeforeCrop() {
|
|
1817
|
-
let e = this.transformations.findIndex((e) => e.key ===
|
|
1837
|
+
let e = this.transformations.findIndex((e) => e.key === D.Crop);
|
|
1818
1838
|
if (e >= 0) return this.transformations.slice(0, e);
|
|
1819
1839
|
if (!this.canReorder) return this.transformations;
|
|
1820
1840
|
let t = {
|
|
1821
|
-
key:
|
|
1841
|
+
key: D.Crop,
|
|
1822
1842
|
value: {}
|
|
1823
1843
|
}, n = X.orderTransformations([...this.transformations, t], this.activeParts);
|
|
1824
1844
|
return n.slice(0, n.indexOf(t));
|
|
@@ -1831,44 +1851,44 @@ var Ht = Y, X, Ut = {
|
|
|
1831
1851
|
}
|
|
1832
1852
|
get lastCropSize() {
|
|
1833
1853
|
if (!this.asset) {
|
|
1834
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1835
|
-
if (e?.value.unit ===
|
|
1836
|
-
[
|
|
1854
|
+
let e = this.transformations.findLast((e) => e.key === D.Crop);
|
|
1855
|
+
if (e?.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
|
|
1856
|
+
[O.AspectRatio]: {
|
|
1837
1857
|
height: e.value.ratioHeight,
|
|
1838
1858
|
percentageHeight: 100,
|
|
1839
1859
|
percentageWidth: 100,
|
|
1840
|
-
unit:
|
|
1860
|
+
unit: O.AspectRatio,
|
|
1841
1861
|
width: e.value.ratioWidth,
|
|
1842
1862
|
x: 0,
|
|
1843
1863
|
y: 0
|
|
1844
1864
|
},
|
|
1845
|
-
[
|
|
1865
|
+
[O.Pixel]: {
|
|
1846
1866
|
height: 1,
|
|
1847
1867
|
percentageHeight: 100,
|
|
1848
1868
|
percentageWidth: 100,
|
|
1849
|
-
unit:
|
|
1869
|
+
unit: O.Pixel,
|
|
1850
1870
|
width: 1,
|
|
1851
1871
|
x: 0,
|
|
1852
1872
|
y: 0
|
|
1853
1873
|
}
|
|
1854
1874
|
};
|
|
1855
1875
|
if (e?.value.width && e?.value.height) {
|
|
1856
|
-
let { height: t, width: n, x: r = 0, y: i = 0 } = e.value, a =
|
|
1876
|
+
let { height: t, width: n, x: r = 0, y: i = 0 } = e.value, a = y(n, t);
|
|
1857
1877
|
return {
|
|
1858
|
-
[
|
|
1878
|
+
[O.AspectRatio]: {
|
|
1859
1879
|
height: a.height,
|
|
1860
1880
|
percentageHeight: 100,
|
|
1861
1881
|
percentageWidth: 100,
|
|
1862
|
-
unit:
|
|
1882
|
+
unit: O.AspectRatio,
|
|
1863
1883
|
width: a.width,
|
|
1864
1884
|
x: 0,
|
|
1865
1885
|
y: 0
|
|
1866
1886
|
},
|
|
1867
|
-
[
|
|
1887
|
+
[O.Pixel]: {
|
|
1868
1888
|
height: t,
|
|
1869
1889
|
percentageHeight: 100,
|
|
1870
1890
|
percentageWidth: 100,
|
|
1871
|
-
unit:
|
|
1891
|
+
unit: O.Pixel,
|
|
1872
1892
|
width: n,
|
|
1873
1893
|
x: r,
|
|
1874
1894
|
y: i
|
|
@@ -1876,25 +1896,25 @@ var Ht = Y, X, Ut = {
|
|
|
1876
1896
|
};
|
|
1877
1897
|
}
|
|
1878
1898
|
}
|
|
1879
|
-
let e = this.lastImageSize.width && this.lastImageSize.height ?
|
|
1899
|
+
let e = this.lastImageSize.width && this.lastImageSize.height ? y(this.lastImageSize.width, this.lastImageSize.height) : {
|
|
1880
1900
|
height: 1,
|
|
1881
1901
|
width: 1
|
|
1882
1902
|
};
|
|
1883
1903
|
return {
|
|
1884
|
-
[
|
|
1904
|
+
[O.AspectRatio]: {
|
|
1885
1905
|
height: e.height,
|
|
1886
1906
|
percentageHeight: 100,
|
|
1887
1907
|
percentageWidth: 100,
|
|
1888
|
-
unit:
|
|
1908
|
+
unit: O.AspectRatio,
|
|
1889
1909
|
width: e.width,
|
|
1890
1910
|
x: 0,
|
|
1891
1911
|
y: 0
|
|
1892
1912
|
},
|
|
1893
|
-
[
|
|
1913
|
+
[O.Pixel]: {
|
|
1894
1914
|
height: this.lastImageSize.height,
|
|
1895
1915
|
percentageHeight: 100,
|
|
1896
1916
|
percentageWidth: 100,
|
|
1897
|
-
unit:
|
|
1917
|
+
unit: O.Pixel,
|
|
1898
1918
|
width: this.lastImageSize.width,
|
|
1899
1919
|
x: 0,
|
|
1900
1920
|
y: 0
|
|
@@ -1903,57 +1923,57 @@ var Ht = Y, X, Ut = {
|
|
|
1903
1923
|
}
|
|
1904
1924
|
get lastResizeSize() {
|
|
1905
1925
|
if (!this.asset) {
|
|
1906
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1907
|
-
if (e?.value.unit ===
|
|
1908
|
-
[
|
|
1926
|
+
let e = this.transformations.findLast((e) => e.key === D.Resize);
|
|
1927
|
+
if (e?.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
|
|
1928
|
+
[O.AspectRatio]: {
|
|
1909
1929
|
height: e.value.ratioHeight,
|
|
1910
|
-
unit:
|
|
1930
|
+
unit: O.AspectRatio,
|
|
1911
1931
|
width: e.value.ratioWidth
|
|
1912
1932
|
},
|
|
1913
|
-
[
|
|
1933
|
+
[O.Pixel]: {
|
|
1914
1934
|
height: 1,
|
|
1915
|
-
unit:
|
|
1935
|
+
unit: O.Pixel,
|
|
1916
1936
|
width: 1
|
|
1917
1937
|
}
|
|
1918
1938
|
};
|
|
1919
1939
|
if (e?.value.width && e?.value.height) {
|
|
1920
|
-
let { height: t, width: n } = e.value, r =
|
|
1940
|
+
let { height: t, width: n } = e.value, r = y(n, t);
|
|
1921
1941
|
return {
|
|
1922
|
-
[
|
|
1942
|
+
[O.AspectRatio]: {
|
|
1923
1943
|
height: r.height,
|
|
1924
|
-
unit:
|
|
1944
|
+
unit: O.AspectRatio,
|
|
1925
1945
|
width: r.width
|
|
1926
1946
|
},
|
|
1927
|
-
[
|
|
1947
|
+
[O.Pixel]: {
|
|
1928
1948
|
height: t,
|
|
1929
|
-
unit:
|
|
1949
|
+
unit: O.Pixel,
|
|
1930
1950
|
width: n
|
|
1931
1951
|
}
|
|
1932
1952
|
};
|
|
1933
1953
|
}
|
|
1934
1954
|
}
|
|
1935
|
-
let e = this.lastImageSize.width && this.lastImageSize.height ?
|
|
1955
|
+
let e = this.lastImageSize.width && this.lastImageSize.height ? y(this.lastImageSize.width, this.lastImageSize.height) : {
|
|
1936
1956
|
height: 1,
|
|
1937
1957
|
width: 1
|
|
1938
1958
|
};
|
|
1939
1959
|
return {
|
|
1940
|
-
[
|
|
1960
|
+
[O.AspectRatio]: {
|
|
1941
1961
|
height: e.height,
|
|
1942
|
-
unit:
|
|
1962
|
+
unit: O.AspectRatio,
|
|
1943
1963
|
width: e.width
|
|
1944
1964
|
},
|
|
1945
|
-
[
|
|
1965
|
+
[O.Pixel]: {
|
|
1946
1966
|
height: this.lastImageSize.height,
|
|
1947
|
-
unit:
|
|
1967
|
+
unit: O.Pixel,
|
|
1948
1968
|
width: this.lastImageSize.width
|
|
1949
1969
|
}
|
|
1950
1970
|
};
|
|
1951
1971
|
}
|
|
1952
1972
|
get lastRotation() {
|
|
1953
|
-
return this.asset ? 0 : this.transformations.findLast((e) => e.key ===
|
|
1973
|
+
return this.asset ? 0 : this.transformations.findLast((e) => e.key === D.Rotate)?.value.rotation ?? 0;
|
|
1954
1974
|
}
|
|
1955
1975
|
get transformationString() {
|
|
1956
|
-
return
|
|
1976
|
+
return fe({
|
|
1957
1977
|
asset: this.asset,
|
|
1958
1978
|
baseUrl: "",
|
|
1959
1979
|
parameters: this.parameters,
|
|
@@ -2021,7 +2041,7 @@ var Ht = Y, X, Ut = {
|
|
|
2021
2041
|
label: "Smart Swatch",
|
|
2022
2042
|
value: "SmartSwatch"
|
|
2023
2043
|
}
|
|
2024
|
-
], this.extensions = [], this.proxies = void 0, this.forCropper = void 0, this.useSession = "", this.transformations = [], this.selectedProxy = "", this.defaultProxy = "", this.canAutoFormat = !1, this.autoFormat = !1, this.useCustomExtension = !1, this.parts = this.initialParts, this.layout =
|
|
2044
|
+
], this.extensions = [], this.proxies = void 0, this.forCropper = void 0, this.useSession = "", this.transformations = [], this.selectedProxy = "", this.defaultProxy = "", this.canAutoFormat = !1, this.autoFormat = !1, this.useCustomExtension = !1, this.parts = this.initialParts, this.layout = _e.Accordion, this.cropEnabled = !1, this.reorderable = !1, this.dimensionsItems = [], this.qualityItems = [], this.canCustomDimensions = !1, this.lastImageSize = {
|
|
2025
2045
|
height: 0,
|
|
2026
2046
|
width: 0
|
|
2027
2047
|
}, this.hideHeader = !1, this.canReset = !1, this.queryElement = null, this.activeSetting = "cx-asset-link-format-proxy", this.selectedFormat = void 0, this.resizeSize = {
|
|
@@ -2029,7 +2049,7 @@ var Ht = Y, X, Ut = {
|
|
|
2029
2049
|
keepAspectRatio: !0,
|
|
2030
2050
|
ratioHeight: 1,
|
|
2031
2051
|
ratioWidth: 1,
|
|
2032
|
-
unit:
|
|
2052
|
+
unit: O.Pixel,
|
|
2033
2053
|
width: 1
|
|
2034
2054
|
}, this.cropSize = {
|
|
2035
2055
|
cropMode: "free",
|
|
@@ -2041,14 +2061,14 @@ var Ht = Y, X, Ut = {
|
|
|
2041
2061
|
position: v.CenterCenter,
|
|
2042
2062
|
ratioHeight: 1,
|
|
2043
2063
|
ratioWidth: 1,
|
|
2044
|
-
unit:
|
|
2064
|
+
unit: O.Pixel,
|
|
2045
2065
|
width: 1,
|
|
2046
2066
|
x: 0,
|
|
2047
2067
|
y: 0
|
|
2048
2068
|
}, this.rotation = 0, this.defaultSize = {
|
|
2049
2069
|
height: 0,
|
|
2050
2070
|
width: 0
|
|
2051
|
-
}, 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.reorderAnnouncement = "", this.orderUndo = [], this.apiGetTransformAssetLink =
|
|
2071
|
+
}, 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.reorderAnnouncement = "", this.orderUndo = [], this.apiGetTransformAssetLink = lt, this.apiGetCropFocusMode = mt, this.onCropComplete = this.onCropComplete.bind(this), this.onCropDragStart = this.onCropDragStart.bind(this);
|
|
2052
2072
|
}
|
|
2053
2073
|
runConnectedCallback() {
|
|
2054
2074
|
this.hasUpdated && (this.syncSortable(), this.handleCropperSelectorChange(), this.cropperElement && (this.cropperElement.addEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.addEventListener("cx-cropper-crop-drag-start", this.onCropDragStart)));
|
|
@@ -2067,7 +2087,7 @@ var Ht = Y, X, Ut = {
|
|
|
2067
2087
|
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")) {
|
|
2068
2088
|
if (!this.asset || !this.selectedFormat || this.selectedFormat.extension === e.get("selectedFormat")?.extension) return;
|
|
2069
2089
|
this.loading = !0, this.requestTransformAsset().then((e) => {
|
|
2070
|
-
this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction ===
|
|
2090
|
+
this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction === D.Rotate && (this.rotation = 0), this.lastAction = void 0, this.lastImageSize = {
|
|
2071
2091
|
height: e.height,
|
|
2072
2092
|
width: e.width
|
|
2073
2093
|
}, this.selectedFormat = {
|
|
@@ -2077,7 +2097,7 @@ var Ht = Y, X, Ut = {
|
|
|
2077
2097
|
width: e.width
|
|
2078
2098
|
});
|
|
2079
2099
|
});
|
|
2080
|
-
let t =
|
|
2100
|
+
let t = fe({
|
|
2081
2101
|
asset: this.asset,
|
|
2082
2102
|
baseUrl: "",
|
|
2083
2103
|
extension: this.selectedFormat.extension,
|
|
@@ -2131,7 +2151,7 @@ var Ht = Y, X, Ut = {
|
|
|
2131
2151
|
this.frozenIndex = this.transformations.length - 1;
|
|
2132
2152
|
}
|
|
2133
2153
|
upsertTransformation(e) {
|
|
2134
|
-
this.asset || (this.transformations = X.uniqueTransformations(this.transformations));
|
|
2154
|
+
e.key === D.Crop && (this.editedCrop = e), this.asset || (this.transformations = X.uniqueTransformations(this.transformations));
|
|
2135
2155
|
let t = this.transformations.findIndex((t) => t.key === e.key);
|
|
2136
2156
|
if (t >= 0) {
|
|
2137
2157
|
let n = [...this.transformations];
|
|
@@ -2140,12 +2160,25 @@ var Ht = Y, X, Ut = {
|
|
|
2140
2160
|
this.canReorder && (this.transformations = X.orderTransformations(this.transformations, this.activeParts));
|
|
2141
2161
|
}
|
|
2142
2162
|
isCropPanelSize(e) {
|
|
2143
|
-
let { height: t, ratioHeight: n, ratioWidth: r, unit: i =
|
|
2144
|
-
return i === this.cropSize.unit ? i ===
|
|
2163
|
+
let { height: t, ratioHeight: n, ratioWidth: r, unit: i = O.Pixel, width: a } = e.value;
|
|
2164
|
+
return i === this.cropSize.unit ? i === O.AspectRatio ? r === this.cropSize.ratioWidth && n === this.cropSize.ratioHeight : a === this.cropSize.width && t === this.cropSize.height : !1;
|
|
2165
|
+
}
|
|
2166
|
+
#r(e) {
|
|
2167
|
+
let { height: t = 0, ratioHeight: n = 0, ratioWidth: r = 0, unit: i = O.Pixel, width: a = 0 } = e.value, o = i === O.AspectRatio, s = o ? r : a, c = o ? n : t;
|
|
2168
|
+
if (!s || !c) return;
|
|
2169
|
+
let l = this.cropModes.filter((e) => !e.auto && /^\d+:\d+$/.test(e.value)).map(({ value: e }) => {
|
|
2170
|
+
let [t, n] = e.split(":").map(Number);
|
|
2171
|
+
return {
|
|
2172
|
+
modeHeight: n,
|
|
2173
|
+
modeWidth: t,
|
|
2174
|
+
value: e
|
|
2175
|
+
};
|
|
2176
|
+
}), u = l.find(({ modeHeight: e, modeWidth: t }) => t * c === e * s);
|
|
2177
|
+
return u || o ? u?.value : l.find(({ modeHeight: e, modeWidth: t }) => Math.abs(t * c - e * s) <= Math.max(t, e) / 2)?.value;
|
|
2145
2178
|
}
|
|
2146
2179
|
capCropToMaxSize() {
|
|
2147
|
-
let e = this.transformations.find((e) => e.key ===
|
|
2148
|
-
if (this.asset || !e || (e.value.unit ??
|
|
2180
|
+
let e = this.transformations.find((e) => e.key === D.Crop);
|
|
2181
|
+
if (this.asset || !e || (e.value.unit ?? O.Pixel) !== O.Pixel) return;
|
|
2149
2182
|
let { height: t = 0, width: n = 0 } = e.value, r = this.cropMaxSize;
|
|
2150
2183
|
if (n <= r.width && t <= r.height) return;
|
|
2151
2184
|
let i = Math.min(t, r.height), a = Math.min(n, r.width), o = this.isCropPanelSize(e) && n * i === t * a;
|
|
@@ -2170,7 +2203,7 @@ var Ht = Y, X, Ut = {
|
|
|
2170
2203
|
(t.length !== this.transformations.length || t.some((e, t) => e !== this.transformations[t])) && (this.transformations = t);
|
|
2171
2204
|
}
|
|
2172
2205
|
if (this.syncSelectedDimensions(), await this.updateComplete, !this.asset) {
|
|
2173
|
-
if (this.emit("cx-asset-link-format-change", { detail:
|
|
2206
|
+
if (this.emit("cx-asset-link-format-change", { detail: fe({
|
|
2174
2207
|
asset: this.asset,
|
|
2175
2208
|
baseUrl: "",
|
|
2176
2209
|
options: { omitZeroXY: !0 },
|
|
@@ -2178,34 +2211,36 @@ var Ht = Y, X, Ut = {
|
|
|
2178
2211
|
transformations: this.transformations,
|
|
2179
2212
|
useSession: this.useSession
|
|
2180
2213
|
}).replace(/\/t\//g, "") }), n) return;
|
|
2181
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2182
|
-
if (e?.value.unit ===
|
|
2183
|
-
let { focusMode: n, position: r, ratioHeight:
|
|
2214
|
+
let e = this.transformations.findLast((e) => e.key === D.Crop && (e.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width && e.value.height)), t = e !== void 0 && e === this.editedCrop && this.isCropPanelSize(e), r = e && !t ? this.#r(e) : void 0, i = t ? this.cropSize.cropMode : r ?? "free";
|
|
2215
|
+
if (e?.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) {
|
|
2216
|
+
let { focusMode: n, position: r, ratioHeight: a, ratioWidth: o } = e.value;
|
|
2184
2217
|
this.cropSize = {
|
|
2185
2218
|
...this.cropSize,
|
|
2186
|
-
cropMode:
|
|
2219
|
+
cropMode: i,
|
|
2187
2220
|
focusMode: n ?? "manual",
|
|
2221
|
+
keepAspectRatio: t && this.cropSize.keepAspectRatio,
|
|
2188
2222
|
percentageHeight: 100,
|
|
2189
2223
|
percentageWidth: 100,
|
|
2190
2224
|
position: r ?? v.CenterCenter,
|
|
2191
|
-
ratioHeight:
|
|
2192
|
-
ratioWidth:
|
|
2193
|
-
unit:
|
|
2225
|
+
ratioHeight: a,
|
|
2226
|
+
ratioWidth: o,
|
|
2227
|
+
unit: O.AspectRatio
|
|
2194
2228
|
};
|
|
2195
2229
|
} else if (e) {
|
|
2196
|
-
let { focusMode:
|
|
2230
|
+
let { focusMode: t, height: n, position: a, unit: o, width: s, x: c = 0, y: l = 0 } = e.value;
|
|
2197
2231
|
this.cropSize = {
|
|
2198
2232
|
...this.cropSize,
|
|
2199
|
-
cropMode:
|
|
2200
|
-
focusMode:
|
|
2201
|
-
height:
|
|
2233
|
+
cropMode: i,
|
|
2234
|
+
focusMode: t ?? "manual",
|
|
2235
|
+
height: n,
|
|
2236
|
+
keepAspectRatio: r !== void 0 || this.cropSize.keepAspectRatio,
|
|
2202
2237
|
percentageHeight: 100,
|
|
2203
2238
|
percentageWidth: 100,
|
|
2204
|
-
position:
|
|
2205
|
-
unit:
|
|
2206
|
-
width:
|
|
2207
|
-
x:
|
|
2208
|
-
y:
|
|
2239
|
+
position: a ?? v.CenterCenter,
|
|
2240
|
+
unit: o ?? O.Pixel,
|
|
2241
|
+
width: s,
|
|
2242
|
+
x: c,
|
|
2243
|
+
y: l
|
|
2209
2244
|
};
|
|
2210
2245
|
} else this.cropSize = {
|
|
2211
2246
|
...this.cropSize,
|
|
@@ -2215,46 +2250,46 @@ var Ht = Y, X, Ut = {
|
|
|
2215
2250
|
percentageHeight: 0,
|
|
2216
2251
|
percentageWidth: 0,
|
|
2217
2252
|
position: v.CenterCenter,
|
|
2218
|
-
unit:
|
|
2253
|
+
unit: O.Pixel,
|
|
2219
2254
|
width: 1,
|
|
2220
2255
|
x: 0,
|
|
2221
2256
|
y: 0
|
|
2222
2257
|
};
|
|
2223
|
-
let
|
|
2224
|
-
if (
|
|
2225
|
-
let { ratioHeight: e, ratioWidth: t } =
|
|
2258
|
+
let a = this.transformations.findLast((e) => e.key === D.Resize && (e.value.unit === O.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width || e.value.height));
|
|
2259
|
+
if (a?.value.unit === O.AspectRatio && a.value.ratioWidth && a.value.ratioHeight) {
|
|
2260
|
+
let { ratioHeight: e, ratioWidth: t } = a.value;
|
|
2226
2261
|
this.resizeSize = {
|
|
2227
2262
|
...this.resizeSize,
|
|
2228
2263
|
ratioHeight: e,
|
|
2229
2264
|
ratioWidth: t,
|
|
2230
|
-
unit:
|
|
2265
|
+
unit: O.AspectRatio
|
|
2231
2266
|
};
|
|
2232
|
-
} else if (
|
|
2233
|
-
let { height: e = 0, unit: t, width: n = 0 } =
|
|
2267
|
+
} else if (a) {
|
|
2268
|
+
let { height: e = 0, unit: t, width: n = 0 } = a.value;
|
|
2234
2269
|
this.resizeSize = {
|
|
2235
2270
|
...this.resizeSize,
|
|
2236
2271
|
height: e,
|
|
2237
|
-
unit: t ??
|
|
2272
|
+
unit: t ?? O.Pixel,
|
|
2238
2273
|
width: n
|
|
2239
2274
|
};
|
|
2240
2275
|
} else this.resizeSize = {
|
|
2241
2276
|
...this.resizeSize,
|
|
2242
2277
|
height: 1,
|
|
2243
|
-
unit:
|
|
2278
|
+
unit: O.Pixel,
|
|
2244
2279
|
width: 1
|
|
2245
2280
|
};
|
|
2246
|
-
let
|
|
2247
|
-
this.rotation =
|
|
2248
|
-
let
|
|
2281
|
+
let o = this.transformations.findLast((e) => e.key === D.Rotate);
|
|
2282
|
+
this.rotation = o?.value.rotation ?? 0;
|
|
2283
|
+
let s = this.transformations.findLast((e) => e.key === D.Quality)?.value.quality ?? 100, c = this.transformations.some((e) => e.key === D.Metadata);
|
|
2249
2284
|
this.selectedFormat = this.selectedFormat ? {
|
|
2250
2285
|
...this.selectedFormat,
|
|
2251
|
-
keepMetadata:
|
|
2252
|
-
quality:
|
|
2286
|
+
keepMetadata: c,
|
|
2287
|
+
quality: s
|
|
2253
2288
|
} : {
|
|
2254
2289
|
extension: "",
|
|
2255
2290
|
height: 0,
|
|
2256
|
-
keepMetadata:
|
|
2257
|
-
quality:
|
|
2291
|
+
keepMetadata: c,
|
|
2292
|
+
quality: s,
|
|
2258
2293
|
rotation: 0,
|
|
2259
2294
|
url: "",
|
|
2260
2295
|
width: 0,
|
|
@@ -2275,7 +2310,7 @@ var Ht = Y, X, Ut = {
|
|
|
2275
2310
|
keepAspectRatio: !0,
|
|
2276
2311
|
ratioHeight: 1,
|
|
2277
2312
|
ratioWidth: 1,
|
|
2278
|
-
unit:
|
|
2313
|
+
unit: O.Pixel,
|
|
2279
2314
|
width: r.width
|
|
2280
2315
|
}, this.cropSize = {
|
|
2281
2316
|
cropMode: "free",
|
|
@@ -2287,12 +2322,12 @@ var Ht = Y, X, Ut = {
|
|
|
2287
2322
|
position: v.CenterCenter,
|
|
2288
2323
|
ratioHeight: 1,
|
|
2289
2324
|
ratioWidth: 1,
|
|
2290
|
-
unit:
|
|
2325
|
+
unit: O.Pixel,
|
|
2291
2326
|
width: r.width,
|
|
2292
2327
|
x: 0,
|
|
2293
2328
|
y: 0
|
|
2294
|
-
}, this.lastAction ===
|
|
2295
|
-
let i = this.transformations.some((e) => e.key ===
|
|
2329
|
+
}, this.lastAction === D.Rotate && (this.rotation = 0), this.lastAction = void 0;
|
|
2330
|
+
let i = this.transformations.some((e) => e.key === D.Metadata), a = this.transformations.findLast((e) => e.key === D.Quality);
|
|
2296
2331
|
this.selectedFormat = {
|
|
2297
2332
|
...this.selectedFormat,
|
|
2298
2333
|
height: r.height,
|
|
@@ -2301,7 +2336,7 @@ var Ht = Y, X, Ut = {
|
|
|
2301
2336
|
url: this.baseUrl && this.baseUrl.length > 0 ? `${this.baseUrl}/${r.relativePath}` : r.relativePath,
|
|
2302
2337
|
width: r.width
|
|
2303
2338
|
};
|
|
2304
|
-
let o =
|
|
2339
|
+
let o = fe({
|
|
2305
2340
|
asset: this.asset,
|
|
2306
2341
|
baseUrl: "",
|
|
2307
2342
|
extension: this.selectedFormat.extension,
|
|
@@ -2323,7 +2358,7 @@ var Ht = Y, X, Ut = {
|
|
|
2323
2358
|
height: Number.parseInt(this.asset.height, 10),
|
|
2324
2359
|
width: Number.parseInt(this.asset.width, 10)
|
|
2325
2360
|
});
|
|
2326
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2361
|
+
let e = this.transformations.findLast((e) => e.key === D.Quality);
|
|
2327
2362
|
this.selectedFormat = {
|
|
2328
2363
|
extension: this.asset.extension,
|
|
2329
2364
|
height: this.defaultSize.height,
|
|
@@ -2348,7 +2383,7 @@ var Ht = Y, X, Ut = {
|
|
|
2348
2383
|
position: v.CenterCenter,
|
|
2349
2384
|
ratioHeight: 1,
|
|
2350
2385
|
ratioWidth: 1,
|
|
2351
|
-
unit:
|
|
2386
|
+
unit: O.Pixel,
|
|
2352
2387
|
width: this.defaultSize.width,
|
|
2353
2388
|
x: 0,
|
|
2354
2389
|
y: 0
|
|
@@ -2367,7 +2402,7 @@ var Ht = Y, X, Ut = {
|
|
|
2367
2402
|
t.proxyName === "TRX" && (t.formatHeight = Number(this.asset.height), t.formatWidth = Number(this.asset.width));
|
|
2368
2403
|
let n = this.proxies?.find((t) => t.id === e);
|
|
2369
2404
|
n && (this.asset && n.proxyName === "TRX" && (n.formatHeight = Number(this.asset.height), n.formatWidth = Number(this.asset.width)), this.transformations = this.transformations.map((e) => {
|
|
2370
|
-
if (e.key ===
|
|
2405
|
+
if (e.key === D.Crop) {
|
|
2371
2406
|
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;
|
|
2372
2407
|
return {
|
|
2373
2408
|
...e,
|
|
@@ -2380,7 +2415,7 @@ var Ht = Y, X, Ut = {
|
|
|
2380
2415
|
}
|
|
2381
2416
|
};
|
|
2382
2417
|
}
|
|
2383
|
-
if (e.key ===
|
|
2418
|
+
if (e.key === D.Resize) {
|
|
2384
2419
|
let r = e.value, i = r.width / n.formatWidth * t.formatWidth, a = r.height / n.formatHeight * t.formatHeight;
|
|
2385
2420
|
return {
|
|
2386
2421
|
...e,
|
|
@@ -2401,24 +2436,24 @@ var Ht = Y, X, Ut = {
|
|
|
2401
2436
|
}, await this.updateComplete, this.cropSize = {
|
|
2402
2437
|
cropMode: "free",
|
|
2403
2438
|
focusMode: "manual",
|
|
2404
|
-
height: this.lastCropSize[
|
|
2439
|
+
height: this.lastCropSize[O.Pixel].height,
|
|
2405
2440
|
keepAspectRatio: !0,
|
|
2406
2441
|
percentageHeight: 100,
|
|
2407
2442
|
percentageWidth: 100,
|
|
2408
2443
|
position: v.CenterCenter,
|
|
2409
2444
|
ratioHeight: 1,
|
|
2410
2445
|
ratioWidth: 1,
|
|
2411
|
-
unit:
|
|
2412
|
-
width: this.lastCropSize[
|
|
2446
|
+
unit: O.Pixel,
|
|
2447
|
+
width: this.lastCropSize[O.Pixel].width,
|
|
2413
2448
|
x: 0,
|
|
2414
2449
|
y: 0
|
|
2415
2450
|
}, this.resizeSize = {
|
|
2416
|
-
height: this.lastResizeSize[
|
|
2451
|
+
height: this.lastResizeSize[O.Pixel].height,
|
|
2417
2452
|
keepAspectRatio: !0,
|
|
2418
2453
|
ratioHeight: 1,
|
|
2419
2454
|
ratioWidth: 1,
|
|
2420
|
-
unit:
|
|
2421
|
-
width: this.lastResizeSize[
|
|
2455
|
+
unit: O.Pixel,
|
|
2456
|
+
width: this.lastResizeSize[O.Pixel].width
|
|
2422
2457
|
};
|
|
2423
2458
|
}
|
|
2424
2459
|
handleLoadingChange() {
|
|
@@ -2438,7 +2473,7 @@ var Ht = Y, X, Ut = {
|
|
|
2438
2473
|
}
|
|
2439
2474
|
handlePartsChange() {
|
|
2440
2475
|
if (this.activeParts.some((e) => {
|
|
2441
|
-
let t = e ===
|
|
2476
|
+
let t = e === A.Rotate ? "rotation" : e;
|
|
2442
2477
|
return this.activeSetting === `cx-asset-link-format-${t}`;
|
|
2443
2478
|
}) || (this.activeSetting = ""), this.canReorder) {
|
|
2444
2479
|
let e = X.orderTransformations(X.uniqueTransformations(this.transformations), this.activeParts);
|
|
@@ -2447,8 +2482,8 @@ var Ht = Y, X, Ut = {
|
|
|
2447
2482
|
}
|
|
2448
2483
|
handleReorderableChange() {
|
|
2449
2484
|
if (this.orderUndo = [], this.canReorder && this.parts === this.initialParts && this.transformations.length > 0) {
|
|
2450
|
-
let e = X.uniqueTransformations(this.transformations).flatMap((e) => Z.filter((t) =>
|
|
2451
|
-
this.parts = Z.map((e) =>
|
|
2485
|
+
let e = X.uniqueTransformations(this.transformations).flatMap((e) => Z.filter((t) => Wt[t] === e.key)), t = [...e, ...Z.filter((t) => Wt[t] && !e.includes(t))], n = 0;
|
|
2486
|
+
this.parts = Z.map((e) => Wt[e] ? t[n++] : e);
|
|
2452
2487
|
}
|
|
2453
2488
|
this.handlePartsChange(), this.syncSortable();
|
|
2454
2489
|
}
|
|
@@ -2520,17 +2555,17 @@ var Ht = Y, X, Ut = {
|
|
|
2520
2555
|
}
|
|
2521
2556
|
handleActiveSettingChange() {
|
|
2522
2557
|
this.cropperElement && (this.resizeSize = {
|
|
2523
|
-
height: this.lastResizeSize[
|
|
2558
|
+
height: this.lastResizeSize[O.Pixel].height,
|
|
2524
2559
|
keepAspectRatio: !0,
|
|
2525
2560
|
ratioHeight: 1,
|
|
2526
2561
|
ratioWidth: 1,
|
|
2527
|
-
unit:
|
|
2528
|
-
width: this.lastResizeSize[
|
|
2562
|
+
unit: O.Pixel,
|
|
2563
|
+
width: this.lastResizeSize[O.Pixel].width
|
|
2529
2564
|
}, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop");
|
|
2530
2565
|
}
|
|
2531
2566
|
async handleRequestAutoCropSuggestion({ cropMode: e, focusMode: t, height: n, keepAspectRatio: r, percentageHeight: i, percentageWidth: a, ratioHeight: o, ratioWidth: s, unit: c, useCropMode: l, width: u }) {
|
|
2532
2567
|
if (!this.selectedFormat?.url || t === "manual") return;
|
|
2533
|
-
this.loading = !0, this.lastAction =
|
|
2568
|
+
this.loading = !0, this.lastAction = D.Crop;
|
|
2534
2569
|
let d = await this.apiGetCropFocusMode({
|
|
2535
2570
|
autoCropMode: t,
|
|
2536
2571
|
cropHeight: n,
|
|
@@ -2606,7 +2641,7 @@ var Ht = Y, X, Ut = {
|
|
|
2606
2641
|
}
|
|
2607
2642
|
onProxyChange(e) {
|
|
2608
2643
|
let t = e.detail;
|
|
2609
|
-
if (this.lastAction =
|
|
2644
|
+
if (this.lastAction = D.Proxy, t.autoFormat) {
|
|
2610
2645
|
this.autoFormat = !0;
|
|
2611
2646
|
let e = this.autoResolvedProxyId;
|
|
2612
2647
|
e && (this.selectedProxy = e);
|
|
@@ -2622,7 +2657,7 @@ var Ht = Y, X, Ut = {
|
|
|
2622
2657
|
});
|
|
2623
2658
|
else {
|
|
2624
2659
|
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;
|
|
2625
|
-
t === "free" ? (n = !1, r = "manual") : this.cropSize.unit ===
|
|
2660
|
+
t === "free" ? (n = !1, r = "manual") : this.cropSize.unit === O.Pixel && !e && (i = 0, a = 0), e ? await this.handleRequestAutoCropSuggestion({
|
|
2626
2661
|
cropMode: t,
|
|
2627
2662
|
focusMode: r,
|
|
2628
2663
|
height: this.cropSize.height,
|
|
@@ -2658,11 +2693,11 @@ var Ht = Y, X, Ut = {
|
|
|
2658
2693
|
}
|
|
2659
2694
|
async onCropChange(e) {
|
|
2660
2695
|
let t = this.cropSize.unit;
|
|
2661
|
-
if (e.detail.unit ===
|
|
2696
|
+
if (e.detail.unit === O.AspectRatio) {
|
|
2662
2697
|
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;
|
|
2663
2698
|
o + a > 100 && (o = 100 - a), s + i > 100 && (s = 100 - i);
|
|
2664
|
-
let c = this.cropSize.cropMode;
|
|
2665
|
-
|
|
2699
|
+
let c = this.cropSize.cropMode, l = this.cropModes.find((e) => e.value === c)?.auto, u = /^(\d+):(\d+)$/.exec(c), d = u !== null && !e.detail.keepAspectRatio && Number(u[1]) * e.detail.height !== Number(u[2]) * e.detail.width;
|
|
2700
|
+
(l || d) && (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 = {
|
|
2666
2701
|
...this.cropSize,
|
|
2667
2702
|
cropMode: c,
|
|
2668
2703
|
height: r,
|
|
@@ -2671,7 +2706,7 @@ var Ht = Y, X, Ut = {
|
|
|
2671
2706
|
percentageWidth: a,
|
|
2672
2707
|
ratioHeight: e.detail.height,
|
|
2673
2708
|
ratioWidth: e.detail.width,
|
|
2674
|
-
unit:
|
|
2709
|
+
unit: O.AspectRatio,
|
|
2675
2710
|
width: n,
|
|
2676
2711
|
x: o,
|
|
2677
2712
|
y: s
|
|
@@ -2680,23 +2715,23 @@ var Ht = Y, X, Ut = {
|
|
|
2680
2715
|
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;
|
|
2681
2716
|
r + n > 100 && (r = 100 - n), i + t > 100 && (i = 100 - t);
|
|
2682
2717
|
let a = this.cropSize.cropMode, o = this.cropModes.find((e) => e.value === a)?.auto;
|
|
2683
|
-
(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 =
|
|
2718
|
+
(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 = {
|
|
2684
2719
|
...this.cropSize,
|
|
2685
2720
|
cropMode: a,
|
|
2686
2721
|
height: e.detail.height,
|
|
2687
2722
|
keepAspectRatio: e.detail.keepAspectRatio,
|
|
2688
2723
|
percentageHeight: t,
|
|
2689
2724
|
percentageWidth: n,
|
|
2690
|
-
unit:
|
|
2725
|
+
unit: O.Pixel,
|
|
2691
2726
|
width: e.detail.width,
|
|
2692
2727
|
x: r,
|
|
2693
2728
|
y: i
|
|
2694
2729
|
};
|
|
2695
2730
|
}
|
|
2696
|
-
t !== this.cropSize.unit && (this.cropSize = {
|
|
2731
|
+
t !== this.cropSize.unit && (this.isFormatsLayout || (this.cropSize = {
|
|
2697
2732
|
...this.cropSize,
|
|
2698
2733
|
cropMode: "free"
|
|
2699
|
-
}, this.onCropChanged()), this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
|
|
2734
|
+
}), this.onCropChanged()), this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
|
|
2700
2735
|
}
|
|
2701
2736
|
async onCropChanged() {
|
|
2702
2737
|
this.focusModes.find((e) => e.value === this.cropSize.focusMode)?.auto && await this.handleRequestAutoCropSuggestion({
|
|
@@ -2713,11 +2748,11 @@ var Ht = Y, X, Ut = {
|
|
|
2713
2748
|
unit: this.cropSize.unit,
|
|
2714
2749
|
width: this.cropSize.width
|
|
2715
2750
|
}) {
|
|
2716
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2751
|
+
if (this.clearResetSnapshot(), this.lastAction = D.Crop, !this.asset) {
|
|
2717
2752
|
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;
|
|
2718
|
-
if (a ===
|
|
2753
|
+
if (a === O.AspectRatio) {
|
|
2719
2754
|
i && r && this.upsertTransformation({
|
|
2720
|
-
key:
|
|
2755
|
+
key: D.Crop,
|
|
2721
2756
|
value: {
|
|
2722
2757
|
focusMode: e,
|
|
2723
2758
|
isFocusModeAuto: l,
|
|
@@ -2730,7 +2765,7 @@ var Ht = Y, X, Ut = {
|
|
|
2730
2765
|
return;
|
|
2731
2766
|
}
|
|
2732
2767
|
(t || o) && Number.isFinite(t) && Number.isFinite(o) && this.upsertTransformation({
|
|
2733
|
-
key:
|
|
2768
|
+
key: D.Crop,
|
|
2734
2769
|
value: {
|
|
2735
2770
|
focusMode: e,
|
|
2736
2771
|
height: t,
|
|
@@ -2749,8 +2784,8 @@ var Ht = Y, X, Ut = {
|
|
|
2749
2784
|
let a = this.cropSize.focusMode, o = this.focusModes.find((e) => e.value === a)?.auto ?? !1;
|
|
2750
2785
|
if (t && i && r) {
|
|
2751
2786
|
let e = i, s = t;
|
|
2752
|
-
if (r ===
|
|
2753
|
-
key:
|
|
2787
|
+
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, {
|
|
2788
|
+
key: D.Crop,
|
|
2754
2789
|
value: {
|
|
2755
2790
|
focusMode: a,
|
|
2756
2791
|
height: s,
|
|
@@ -2762,7 +2797,7 @@ var Ht = Y, X, Ut = {
|
|
|
2762
2797
|
else {
|
|
2763
2798
|
let t = this.cropSize.x / 100 * this.selectedFormat.width, n = this.cropSize.y / 100 * this.selectedFormat.height;
|
|
2764
2799
|
this.transformations = [...this.transformations, {
|
|
2765
|
-
key:
|
|
2800
|
+
key: D.Crop,
|
|
2766
2801
|
value: {
|
|
2767
2802
|
focusMode: a,
|
|
2768
2803
|
height: s,
|
|
@@ -2775,7 +2810,7 @@ var Ht = Y, X, Ut = {
|
|
|
2775
2810
|
}];
|
|
2776
2811
|
}
|
|
2777
2812
|
} else n && (this.transformations = [...this.transformations, {
|
|
2778
|
-
key:
|
|
2813
|
+
key: D.Crop,
|
|
2779
2814
|
value: {
|
|
2780
2815
|
focusMode: a,
|
|
2781
2816
|
isFocusModeAuto: o,
|
|
@@ -2784,8 +2819,8 @@ var Ht = Y, X, Ut = {
|
|
|
2784
2819
|
}]);
|
|
2785
2820
|
}
|
|
2786
2821
|
onResizeChange(e) {
|
|
2787
|
-
if (e.detail.unit ===
|
|
2788
|
-
let t = e.detail.width / e.detail.height, n = Math.max(Math.round(this.lastResizeSize[
|
|
2822
|
+
if (e.detail.unit === O.AspectRatio) {
|
|
2823
|
+
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);
|
|
2789
2824
|
this.resizeSize = {
|
|
2790
2825
|
...this.resizeSize,
|
|
2791
2826
|
height: r,
|
|
@@ -2806,11 +2841,11 @@ var Ht = Y, X, Ut = {
|
|
|
2806
2841
|
onResizeApply(e) {
|
|
2807
2842
|
let { height: t, unit: n, width: r } = e.detail;
|
|
2808
2843
|
if (!Number.isFinite(r) || !Number.isFinite(t)) return;
|
|
2809
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2810
|
-
if (n ===
|
|
2844
|
+
if (this.clearResetSnapshot(), this.lastAction = D.Resize, !this.asset) {
|
|
2845
|
+
if (n === O.AspectRatio) {
|
|
2811
2846
|
let { ratioHeight: e, ratioWidth: t } = this.resizeSize;
|
|
2812
2847
|
t && e && this.upsertTransformation({
|
|
2813
|
-
key:
|
|
2848
|
+
key: D.Resize,
|
|
2814
2849
|
value: {
|
|
2815
2850
|
ratioHeight: e,
|
|
2816
2851
|
ratioWidth: t,
|
|
@@ -2820,7 +2855,7 @@ var Ht = Y, X, Ut = {
|
|
|
2820
2855
|
return;
|
|
2821
2856
|
}
|
|
2822
2857
|
(t || r) && (this.upsertTransformation({
|
|
2823
|
-
key:
|
|
2858
|
+
key: D.Resize,
|
|
2824
2859
|
value: {
|
|
2825
2860
|
height: t,
|
|
2826
2861
|
unit: n,
|
|
@@ -2831,8 +2866,8 @@ var Ht = Y, X, Ut = {
|
|
|
2831
2866
|
}
|
|
2832
2867
|
if (!this.selectedFormat) return;
|
|
2833
2868
|
let i = this.selectedFormat.width || this.defaultSize.width, a = this.selectedFormat.height || this.defaultSize.height, o = r, s = t;
|
|
2834
|
-
this.resizeSize.unit === n ? n ===
|
|
2835
|
-
key:
|
|
2869
|
+
this.resizeSize.unit === n ? n === O.AspectRatio && (o = Math.round(r / t * a), s = a) : (o = i, s = a), this.transformations = [...this.transformations, {
|
|
2870
|
+
key: D.Resize,
|
|
2836
2871
|
value: {
|
|
2837
2872
|
height: s,
|
|
2838
2873
|
unit: n,
|
|
@@ -2847,23 +2882,23 @@ var Ht = Y, X, Ut = {
|
|
|
2847
2882
|
this.applyRotationTransformation(e.detail);
|
|
2848
2883
|
}
|
|
2849
2884
|
applyRotationTransformation(e) {
|
|
2850
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2885
|
+
if (this.clearResetSnapshot(), this.lastAction = D.Rotate, !this.asset) {
|
|
2851
2886
|
e ? this.upsertTransformation({
|
|
2852
|
-
key:
|
|
2887
|
+
key: D.Rotate,
|
|
2853
2888
|
value: { rotation: e }
|
|
2854
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2889
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== D.Rotate);
|
|
2855
2890
|
return;
|
|
2856
2891
|
}
|
|
2857
2892
|
this.selectedFormat && (this.transformations = [...this.transformations, {
|
|
2858
|
-
key:
|
|
2893
|
+
key: D.Rotate,
|
|
2859
2894
|
value: { rotation: e }
|
|
2860
2895
|
}]);
|
|
2861
2896
|
}
|
|
2862
2897
|
onQualityChange(e) {
|
|
2863
2898
|
let t = e.detail;
|
|
2864
|
-
this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction =
|
|
2899
|
+
this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction = D.Quality;
|
|
2865
2900
|
let n = {
|
|
2866
|
-
key:
|
|
2901
|
+
key: D.Quality,
|
|
2867
2902
|
value: { quality: t }
|
|
2868
2903
|
};
|
|
2869
2904
|
this.asset ? this.transformations = [...this.transformations, n] : this.upsertTransformation(n);
|
|
@@ -2875,15 +2910,15 @@ var Ht = Y, X, Ut = {
|
|
|
2875
2910
|
keepMetadata: t
|
|
2876
2911
|
}, !this.asset) {
|
|
2877
2912
|
t ? this.upsertTransformation({
|
|
2878
|
-
key:
|
|
2913
|
+
key: D.Metadata,
|
|
2879
2914
|
value: { keepMetadata: t }
|
|
2880
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2915
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== D.Metadata);
|
|
2881
2916
|
return;
|
|
2882
2917
|
}
|
|
2883
2918
|
t ? this.upsertTransformation({
|
|
2884
|
-
key:
|
|
2919
|
+
key: D.Metadata,
|
|
2885
2920
|
value: { keepMetadata: t }
|
|
2886
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2921
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== D.Metadata);
|
|
2887
2922
|
}
|
|
2888
2923
|
onExtensionChange(e) {
|
|
2889
2924
|
let t = e.detail;
|
|
@@ -2893,14 +2928,14 @@ var Ht = Y, X, Ut = {
|
|
|
2893
2928
|
};
|
|
2894
2929
|
}
|
|
2895
2930
|
syncQuality() {
|
|
2896
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2931
|
+
let e = this.transformations.findLast((e) => e.key === D.Quality)?.value?.quality;
|
|
2897
2932
|
this.selectedFormat &&= {
|
|
2898
2933
|
...this.selectedFormat,
|
|
2899
2934
|
quality: e ?? 100
|
|
2900
2935
|
};
|
|
2901
2936
|
}
|
|
2902
2937
|
syncSelectedDimensions(e = !0) {
|
|
2903
|
-
let t = this.transformations.findLast((e) => e.key ===
|
|
2938
|
+
let t = this.transformations.findLast((e) => e.key === D.Dimensions), n = X.getDimensionsSize(this.selectedDimensions);
|
|
2904
2939
|
if (!t) {
|
|
2905
2940
|
n && (this.selectedDimensions = void 0);
|
|
2906
2941
|
return;
|
|
@@ -2912,17 +2947,17 @@ var Ht = Y, X, Ut = {
|
|
|
2912
2947
|
return !e.disabled && t?.width === r && t.height === i;
|
|
2913
2948
|
});
|
|
2914
2949
|
this.selectedDimensions = a ? {
|
|
2915
|
-
mode:
|
|
2950
|
+
mode: E.Preset,
|
|
2916
2951
|
value: a.value
|
|
2917
2952
|
} : {
|
|
2918
2953
|
height: i,
|
|
2919
|
-
mode:
|
|
2920
|
-
unit:
|
|
2954
|
+
mode: E.Custom,
|
|
2955
|
+
unit: k.Pixel,
|
|
2921
2956
|
width: r
|
|
2922
2957
|
};
|
|
2923
2958
|
}
|
|
2924
2959
|
get hasResettableState() {
|
|
2925
|
-
let e =
|
|
2960
|
+
let e = Gt.filter((e) => this.activeParts.includes(e));
|
|
2926
2961
|
return this.canReorder && this.activeParts.some((t, n) => t !== e[n]) || this.transformations.length > 0 ? !0 : this.canAutoFormat && !this.autoFormat;
|
|
2927
2962
|
}
|
|
2928
2963
|
clearResetSnapshot() {
|
|
@@ -2942,21 +2977,21 @@ var Ht = Y, X, Ut = {
|
|
|
2942
2977
|
let e = !!this.defaultProxy && !!this.proxies?.some((e) => e.id === this.defaultProxy);
|
|
2943
2978
|
this.selectedProxy = e ? this.defaultProxy : this.selectedProxy || this.proxies?.[0]?.id || "";
|
|
2944
2979
|
}
|
|
2945
|
-
this.transformations = [], this.canReorder && (this.parts =
|
|
2980
|
+
this.transformations = [], this.canReorder && (this.parts = Gt.filter((e) => this.activeParts.includes(e)), this.emitReorder()), this.frozenIndex = -1, this.syncQuality();
|
|
2946
2981
|
}
|
|
2947
2982
|
onDimensionsChange(e) {
|
|
2948
2983
|
e.stopPropagation();
|
|
2949
2984
|
let t = X.getDimensionsSize(e.detail);
|
|
2950
|
-
this.clearResetSnapshot(), this.lastAction =
|
|
2951
|
-
key:
|
|
2985
|
+
this.clearResetSnapshot(), this.lastAction = D.Dimensions, this.selectedDimensions = { ...e.detail }, t ? this.upsertTransformation({
|
|
2986
|
+
key: D.Dimensions,
|
|
2952
2987
|
value: t
|
|
2953
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2988
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== D.Dimensions), this.capCropToMaxSize();
|
|
2954
2989
|
}
|
|
2955
2990
|
onCropToggle(e) {
|
|
2956
|
-
e.stopPropagation(), this.clearResetSnapshot(), this.cropEnabled = e.currentTarget.checked, this.cropEnabled || (this.transformations = this.transformations.filter((e) => e.key !==
|
|
2991
|
+
e.stopPropagation(), this.clearResetSnapshot(), this.cropEnabled = e.currentTarget.checked, this.cropEnabled || (this.transformations = this.transformations.filter((e) => e.key !== D.Crop)), this.emit("cx-asset-link-format-crop-toggle", { detail: this.cropEnabled });
|
|
2957
2992
|
}
|
|
2958
2993
|
renderDimensionsPart() {
|
|
2959
|
-
return e`<cx-asset-link-format-dimensions class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ?
|
|
2994
|
+
return e`<cx-asset-link-format-dimensions class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ? M.Automatic : M.Manual} .inline=${this.isFormatsLayout} ?open=${this.activeSetting === "cx-asset-link-format-dimensions"} ?loading=${this.loading} .items=${this.dimensionsItems} .value=${this.selectedDimensions} ?can-custom=${this.canCustomDimensions} @cx-asset-link-format-dimensions-change=${this.onDimensionsChange}></cx-asset-link-format-dimensions>`;
|
|
2960
2995
|
}
|
|
2961
2996
|
renderHeader() {
|
|
2962
2997
|
return m(!this.hideHeader && !this.isFormatsLayout, () => 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 && (!this.canReorder || this.orderUndo.length === 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);
|
|
@@ -2965,42 +3000,42 @@ var Ht = Y, X, Ut = {
|
|
|
2965
3000
|
return m(this.canReorder, () => e`<div class="asset-link-format__order-hint" data-testid="cx-asset-link-format-order-hint">${this.localize.term("transformationOrderHint")}</div>`);
|
|
2966
3001
|
}
|
|
2967
3002
|
renderProxyPart() {
|
|
2968
|
-
return 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 ===
|
|
3003
|
+
return 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 === D.Proxy} @cx-asset-link-format-proxy-change=${this.onProxyChange}></cx-asset-link-format-proxy>`;
|
|
2969
3004
|
}
|
|
2970
3005
|
renderCropEditor(t) {
|
|
2971
|
-
let n = this.asset ? this.lastResizeSize[
|
|
2972
|
-
return e`<cx-asset-link-format-crop class="asset-link-format__details" .inline=${t} ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction ===
|
|
3006
|
+
let n = this.asset ? this.lastResizeSize[O.Pixel] : this.cropMaxSize;
|
|
3007
|
+
return e`<cx-asset-link-format-crop class="asset-link-format__details" .inline=${t} ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction === D.Crop} ?show-position-picker=${!this.asset} ?keep-aspect-ratio=${this.cropSize.keepAspectRatio} focus-mode=${this.cropSize.focusMode} crop-mode=${this.cropSize.cropMode} width=${this.cropSize.width} height=${this.cropSize.height} max-width=${n.width} max-height=${n.height} 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>`;
|
|
2973
3008
|
}
|
|
2974
3009
|
renderCropPart() {
|
|
2975
3010
|
return this.isFormatsLayout ? e`<div class="asset-link-format__formats-crop"><cx-space class="asset-link-format__formats-summary" align-items="center" justify-content="space-between"><cx-space align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-switch data-testid="cx-asset-link-format-crop-toggle" .checked=${this.cropEnabled} ?disabled=${this.loading} @cx-change=${this.onCropToggle}><cx-visually-hidden>${this.localize.term("crop")}</cx-visually-hidden></cx-switch></cx-space>${m(this.cropEnabled, () => this.renderCropEditor(!0))}</div>` : this.renderCropEditor(!1);
|
|
2976
3011
|
}
|
|
2977
3012
|
renderResizePart() {
|
|
2978
|
-
return e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction ===
|
|
3013
|
+
return e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction === D.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>`;
|
|
2979
3014
|
}
|
|
2980
3015
|
renderRotatePart() {
|
|
2981
|
-
return e`<cx-asset-link-format-rotation class="asset-link-format__details" .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction ===
|
|
3016
|
+
return e`<cx-asset-link-format-rotation class="asset-link-format__details" .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction === D.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>`;
|
|
2982
3017
|
}
|
|
2983
3018
|
renderQualityPart() {
|
|
2984
|
-
return e`<cx-asset-link-format-quality class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ?
|
|
3019
|
+
return e`<cx-asset-link-format-quality class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ? M.Automatic : M.Manual} .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction === D.Quality} ?open=${this.activeSetting === "cx-asset-link-format-quality"} value=${this.selectedFormat?.quality ?? 100} .items=${this.qualityItems} @cx-asset-link-format-quality-change=${this.onQualityChange}></cx-asset-link-format-quality>`;
|
|
2985
3020
|
}
|
|
2986
3021
|
renderMetadataPart() {
|
|
2987
3022
|
return 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>`;
|
|
2988
3023
|
}
|
|
2989
3024
|
renderPart(e) {
|
|
2990
3025
|
switch (e) {
|
|
2991
|
-
case
|
|
2992
|
-
case
|
|
2993
|
-
case
|
|
2994
|
-
case
|
|
2995
|
-
case
|
|
2996
|
-
case
|
|
2997
|
-
case
|
|
3026
|
+
case A.Dimensions: return this.renderDimensionsPart();
|
|
3027
|
+
case A.Proxy: return this.renderProxyPart();
|
|
3028
|
+
case A.Crop: return this.renderCropPart();
|
|
3029
|
+
case A.Resize: return this.renderResizePart();
|
|
3030
|
+
case A.Rotate: return this.renderRotatePart();
|
|
3031
|
+
case A.Quality: return this.renderQualityPart();
|
|
3032
|
+
case A.Metadata: return this.renderMetadataPart();
|
|
2998
3033
|
default: return n;
|
|
2999
3034
|
}
|
|
3000
3035
|
}
|
|
3001
3036
|
render() {
|
|
3002
3037
|
return e`<div class="asset-link-format ${this.isFormatsLayout ? "asset-link-format--formats" : ""}" @cx-show=${this.onDetailsShow} @cx-hide=${this.onDetailsHide}>${this.renderHeader()}
|
|
3003
|
-
${this.renderOrderHint()}<div class="asset-link-format__panels">${
|
|
3038
|
+
${this.renderOrderHint()}<div class="asset-link-format__panels">${x(this.activeParts, (e) => e, (t) => e`<div class="asset-link-format__panel" data-part=${t} ?data-reorderable=${this.canReorder && Q.includes(t)}>${m(this.canReorder && Q.includes(t), () => e`<cx-icon-button class="asset-link-format__drag-handle" name="drag_indicator" label=${this.localize.term("reorderTransformation", this.localize.term(t))} ?disabled=${this.loading} @keydown=${this.handleReorderKeyDown}></cx-icon-button>`)}
|
|
3004
3039
|
${this.renderPart(t)}</div>`)}</div><span class="asset-link-format__announcement" role="status" aria-live="polite">${this.reorderAnnouncement}</span>${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>`;
|
|
3005
3040
|
}
|
|
3006
3041
|
};
|
|
@@ -3060,12 +3095,12 @@ a([r({
|
|
|
3060
3095
|
type: Boolean
|
|
3061
3096
|
}), o("design:type", Boolean)], $.prototype, "useCustomExtension", void 0), a([r({
|
|
3062
3097
|
attribute: "parts",
|
|
3063
|
-
converter:
|
|
3098
|
+
converter: Oe,
|
|
3064
3099
|
type: Array
|
|
3065
3100
|
}), o("design:type", Array)], $.prototype, "parts", void 0), a([r({
|
|
3066
3101
|
reflect: !0,
|
|
3067
3102
|
type: String
|
|
3068
|
-
}), o("design:type",
|
|
3103
|
+
}), o("design:type", _e === void 0 ? Object : _e)], $.prototype, "layout", void 0), a([r({
|
|
3069
3104
|
attribute: "crop-enabled",
|
|
3070
3105
|
reflect: !0,
|
|
3071
3106
|
type: Boolean
|
|
@@ -3119,6 +3154,6 @@ a([r({
|
|
|
3119
3154
|
o("design:paramtypes", []),
|
|
3120
3155
|
o("design:returntype", void 0)
|
|
3121
3156
|
], $.prototype, "handleReorderableChange", null), $ = X = a([u("cx-asset-link-format"), o("design:paramtypes", [])], $);
|
|
3122
|
-
var
|
|
3157
|
+
var Kt = $;
|
|
3123
3158
|
//#endregion
|
|
3124
|
-
export {
|
|
3159
|
+
export { ct as C, ht as S, Ae as T, qe as _, Ze as a, ft as b, F as c, Qe as d, We as f, Ke as g, I as h, xt as i, He as l, $e as m, wt as n, Be as o, Ge as p, St as r, P as s, Kt as t, Ue as u, Je as v, je as w, _t as x, gt as y };
|