@orangelogic/design-system 2.191.0 → 2.193.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.CEDcHah6.js → asset-link-format.BX1hdLgZ.js} +1249 -1083
- package/library/chunks/{color-swatch-group.tnhiQ0jp.js → color-swatch-group.BpEQJM1b.js} +4 -3
- package/library/chunks/{confirm-popover.CrQKEChc.js → confirm-popover.jCP9CdcD.js} +1 -1
- package/library/chunks/content-builder.BX4pHujE.js +60 -0
- package/library/chunks/{dialog.CWGtufDA.js → dialog.B6hZ7fvn.js} +2 -2
- package/library/chunks/{document-viewer.C90j1Xrr.js → document-viewer.DZsbpf0x.js} +3 -2
- package/library/chunks/{image.CTMzUqCC.js → image.BSvc6eti.js} +194 -191
- package/library/chunks/{toast.CXEAfCvN.js → toast.C5Ir5yKA.js} +1 -1
- package/library/chunks/transformation.CkwgrwKQ.js +312 -0
- package/library/components/asset-link-format.js +2 -2
- package/library/components/atoms.js +3 -3
- package/library/components/color-swatch-group.js +3 -3
- package/library/components/confirm-popover.js +2 -2
- package/library/components/cropper.js +1 -1
- package/library/components/dialog.js +1 -1
- package/library/components/document-viewer.js +2 -2
- package/library/components/drawer.js +2 -2
- package/library/components/file-on-demand.js +2 -2
- package/library/components/image.js +2 -3
- package/library/components/masonry.js +110 -79
- package/library/components/molecules.js +1 -1
- package/library/components/organisms.js +2 -2
- package/library/components/popup.js +100 -97
- package/library/components/select.js +16 -11
- package/library/components/types.js +22562 -22239
- package/library/components/video.js +1 -1
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/image/image.d.ts +38 -4
- package/library/packages/atoms/src/components/popup/popup.d.ts +11 -0
- package/library/packages/atoms/src/components/select/select.d.ts +8 -0
- package/library/packages/events/src/cx-asset-transformation-dialog-confirm.d.ts +2 -0
- package/library/packages/molecules/src/cropper/cropper.d.ts +0 -1
- package/library/packages/molecules/src/cropper/react/Cropper.d.ts +0 -1
- package/library/packages/molecules/src/gallery-item/gallery-item.d.ts +10 -0
- package/library/packages/molecules/src/masonry/masonry.d.ts +24 -0
- package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +46 -2
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-proxy/asset-link-format-proxy.d.ts +36 -1
- package/library/packages/organisms/src/asset-transformation-dialog/asset-transformation-dialog.d.ts +20 -2
- package/library/packages/organisms/src/bento-grid/bento-grid.d.ts +101 -0
- package/library/packages/organisms/src/carousel/carousel.d.ts +26 -0
- package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +67 -1
- package/library/packages/organisms/src/content-builder/blocks/video/video.d.ts +5 -0
- package/library/packages/organisms/src/content-builder/components/config-form/config-form.d.ts +2 -1
- package/library/packages/organisms/src/content-builder/components/gallery-picker/gallery-picker.d.ts +6 -0
- package/library/packages/organisms/src/content-builder/configs/carousel.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/gallery.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/image.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/configs/timeline.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/video.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs-controller.d.ts +10 -0
- package/library/packages/organisms/src/content-builder/styleController.d.ts +2 -0
- package/library/packages/services/src/api/asset/asset.d.ts +10 -1
- package/library/packages/tools/src/fetch-image/fetch-image.d.ts +28 -5
- package/library/packages/types/src/asset-link-format.d.ts +0 -1
- package/library/packages/types/src/content-builder.d.ts +7 -0
- package/library/packages/types/src/gallery-item.d.ts +2 -0
- package/library/packages/types/src/masonry.d.ts +2 -0
- package/library/packages/utils/src/transformation/transformation.d.ts +100 -0
- package/library/react-web-component.d.ts +63 -7
- package/library/utils.js +193 -182
- package/package.json +1 -1
- package/library/chunks/transformation.8uLv6uwG.js +0 -264
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import "../components/cropper.js";
|
|
2
|
-
import { C as
|
|
3
|
-
import
|
|
4
|
-
import { C as
|
|
5
|
-
import { n as
|
|
6
|
-
import { h as I, a as
|
|
2
|
+
import { C as Y } from "./button.BnkkUqiI.js";
|
|
3
|
+
import U from "../components/space.js";
|
|
4
|
+
import { C as B } from "./typography.IqHbnd3C.js";
|
|
5
|
+
import { n as h, C as q } from "./lib-cortex-element.CVMmyPMC.js";
|
|
6
|
+
import { h as I, a as Ot, C as Lt, S as Yt, b as Jt, c as te, d as ee } from "./endpoints.mJ5S-tIs.js";
|
|
7
7
|
import "./browser.BHOCIF_A.js";
|
|
8
|
-
import { i as
|
|
8
|
+
import { i as j, x as C, E as Ut } from "./lit-element.jLBm65_O.js";
|
|
9
9
|
import "./form.DSsy3Fcy.js";
|
|
10
|
-
import { L as
|
|
11
|
-
import { a as
|
|
10
|
+
import { L as V } from "./i18n.DbXTTLXx.js";
|
|
11
|
+
import { a as ie } from "./string.CfI2ejyR.js";
|
|
12
12
|
import "./date-picker.BGHn6qg8.js";
|
|
13
|
-
import
|
|
13
|
+
import "./content-builder.BX4pHujE.js";
|
|
14
14
|
import "./unsafe-html.Dff7-rCx.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import { C as
|
|
29
|
-
import { C as
|
|
30
|
-
import { C as
|
|
31
|
-
import xt from "
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import {
|
|
15
|
+
import { c as Mt, r as Bt, d as nt } from "./transformation.CkwgrwKQ.js";
|
|
16
|
+
import { b as se } from "./_baseUniq.lwMgmtt2.js";
|
|
17
|
+
import { c as G } from "./component.styles.CRO4Odto.js";
|
|
18
|
+
import { v as ae } from "./v4.CKZ6klMF.js";
|
|
19
|
+
import { U as r, T as f } from "./asset-link-format.ClaYu_v8.js";
|
|
20
|
+
import { P as N } from "./position-picker.DjnhxIKF.js";
|
|
21
|
+
import { c as Q } from "./custom-element.L4WJXn1j.js";
|
|
22
|
+
import { w as P } from "./watch.DJF5K-8U.js";
|
|
23
|
+
import { s as It, a as ht } from "./number.Cx2ncfJJ.js";
|
|
24
|
+
import { r as b } from "./state.CSDxrqLd.js";
|
|
25
|
+
import { n as _ } from "./when.Dr1es41R.js";
|
|
26
|
+
import it from "../components/details.js";
|
|
27
|
+
import qt from "../components/divider.js";
|
|
28
|
+
import { C as st } from "./icon.CpHbi8tH.js";
|
|
29
|
+
import { C as kt } from "./icon-button.CVrxJcZq.js";
|
|
30
|
+
import { C as Rt } from "./input.33UmFGqR.js";
|
|
31
|
+
import { C as xt } from "./option.B6odSlS2.js";
|
|
32
|
+
import yt from "../components/select.js";
|
|
33
|
+
import oe from "../components/position-picker.js";
|
|
34
|
+
import { c as re } from "./image.Y5c_hFx8.js";
|
|
35
|
+
import { e as J } from "./query.BBf1UFkC.js";
|
|
35
36
|
import { c as ot } from "./repeat.CFjcER6_.js";
|
|
36
|
-
import { o as
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
function
|
|
41
|
-
return t && t.length ?
|
|
37
|
+
import { o as O } from "./style-map.llVFPd__.js";
|
|
38
|
+
import jt from "../components/tooltip.js";
|
|
39
|
+
import ne from "../components/button-group.js";
|
|
40
|
+
import he from "../components/checkbox.js";
|
|
41
|
+
function le(t) {
|
|
42
|
+
return t && t.length ? se(t) : [];
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function Vt(t) {
|
|
44
45
|
return typeof t == "object" && t !== null && "URI" in t;
|
|
45
46
|
}
|
|
46
|
-
const
|
|
47
|
+
const ce = {
|
|
47
48
|
artist: "Artist",
|
|
48
49
|
color: "Color",
|
|
49
50
|
createDate: "CreateDate",
|
|
@@ -65,127 +66,127 @@ const oe = {
|
|
|
65
66
|
systemIdentifier: "SystemIdentifier",
|
|
66
67
|
text: "Text",
|
|
67
68
|
title: "Title"
|
|
68
|
-
},
|
|
69
|
-
function
|
|
69
|
+
}, pe = /* @__PURE__ */ new Set(["mediaDate", "createDate", "editDate"]);
|
|
70
|
+
function Ct(t) {
|
|
70
71
|
return !/[\s&+/*"\\:(),'<>~|[\]{}]/.test(t) && !/^(?:OR|AND|NOT)$/.test(t) ? t : `"${t.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
const s = (Array.isArray(e) ? e : [e]).map((a) => `${t}:${
|
|
73
|
+
function Et(t, e) {
|
|
74
|
+
const s = (Array.isArray(e) ? e : [e]).map((a) => `${t}:${Ct(a)}`);
|
|
74
75
|
return s.length > 1 ? `(${s.join(" OR ")})` : s[0] ?? "";
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
+
function de(t, e) {
|
|
77
78
|
return (Array.isArray(e) ? e : [e]).map((s) => `${t}${s.operator}${s.value}`).join(" AND ");
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
+
function ue(t) {
|
|
80
81
|
const e = [];
|
|
81
82
|
for (const i of Object.keys(t)) {
|
|
82
83
|
const s = i, a = t[s];
|
|
83
84
|
if (a == null)
|
|
84
85
|
continue;
|
|
85
86
|
if (s === "custom") {
|
|
86
|
-
for (const [n,
|
|
87
|
+
for (const [n, l] of Object.entries(
|
|
87
88
|
a
|
|
88
89
|
))
|
|
89
|
-
e.push(
|
|
90
|
+
e.push(Et(n, l));
|
|
90
91
|
continue;
|
|
91
92
|
}
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
if (
|
|
93
|
+
const o = ce[s];
|
|
94
|
+
if (o) {
|
|
95
|
+
if (pe.has(s)) {
|
|
95
96
|
e.push(
|
|
96
|
-
|
|
97
|
+
de(o, a)
|
|
97
98
|
);
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
101
|
if (s === "color") {
|
|
101
|
-
e.push(`${
|
|
102
|
+
e.push(`${o}:${a}`);
|
|
102
103
|
continue;
|
|
103
104
|
}
|
|
104
105
|
if (s === "parentFolderIdentifier") {
|
|
105
106
|
const n = Array.isArray(a) ? a : [a];
|
|
106
107
|
if (n.length === 0)
|
|
107
108
|
continue;
|
|
108
|
-
const
|
|
109
|
-
...n.map((p) => `ParentFolderIdentifier:${
|
|
110
|
-
...n.map((p) => `ParentAlbumIdentifier:${
|
|
109
|
+
const l = [
|
|
110
|
+
...n.map((p) => `ParentFolderIdentifier:${Ct(String(p))}`),
|
|
111
|
+
...n.map((p) => `ParentAlbumIdentifier:${Ct(String(p))}`)
|
|
111
112
|
];
|
|
112
|
-
e.push(`(${
|
|
113
|
+
e.push(`(${l.join(" OR ")})`);
|
|
113
114
|
continue;
|
|
114
115
|
}
|
|
115
|
-
e.push(
|
|
116
|
+
e.push(Et(o, a));
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
return e.join(" AND ");
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
+
function lt(t) {
|
|
121
122
|
if ("and" in t)
|
|
122
|
-
return t.and.map(
|
|
123
|
+
return t.and.map(lt).filter(Boolean).join(" AND ");
|
|
123
124
|
if ("or" in t) {
|
|
124
|
-
const e = t.or.map(
|
|
125
|
+
const e = t.or.map(lt).filter(Boolean);
|
|
125
126
|
return e.length > 1 ? `(${e.join(" OR ")})` : e[0] ?? "";
|
|
126
127
|
}
|
|
127
128
|
if ("not" in t) {
|
|
128
|
-
const e =
|
|
129
|
+
const e = lt(t.not);
|
|
129
130
|
return e ? `NOT (${e})` : "";
|
|
130
131
|
}
|
|
131
|
-
return
|
|
132
|
+
return ue(t);
|
|
132
133
|
}
|
|
133
|
-
const
|
|
134
|
+
const me = "CoreField.LargeSizePreview", ct = "CoreField.DocType", fe = "Document.Title", ge = "Document.CaptionLong", rt = "Document.FileExtension", pt = "CoreField.FileSize", Ht = "CoreField.Identifier", Tt = "CoreField.Keywords", dt = "CoreField.MaxHeight", ut = "CoreField.MaxWidth", mt = "Document.RecordID", Wt = "CoreField.DocSubType", Gt = "CoreField.TitleWithFallback", ft = "CoreField.OriginalFileName", gt = "CoreField.UpdatedFileName", $t = "__width", xe = "CoreField.OriginalPreview", Ni = "Document.DocSubType", Oi = "Document.InPoint", Li = "Document.OutPoint", At = {
|
|
134
135
|
DEFAULT_VIEW_SIZE: "Document.LargeSizePreview",
|
|
135
136
|
FIELD_TITLE_WITH_FALLBACK: "Document.TitleWithFallback",
|
|
136
137
|
ORIGINAL_VIEW_SIZE: "Document.OriginalPreview"
|
|
137
|
-
},
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
},
|
|
142
|
-
Object.entries(
|
|
138
|
+
}, Qt = {
|
|
139
|
+
[me]: At.DEFAULT_VIEW_SIZE,
|
|
140
|
+
[Gt]: At.FIELD_TITLE_WITH_FALLBACK,
|
|
141
|
+
[xe]: At.ORIGINAL_VIEW_SIZE
|
|
142
|
+
}, ye = Object.fromEntries(
|
|
143
|
+
Object.entries(Qt).map(([t, e]) => [
|
|
143
144
|
e,
|
|
144
145
|
t
|
|
145
146
|
])
|
|
146
147
|
);
|
|
147
|
-
function
|
|
148
|
-
return
|
|
148
|
+
function Se(t) {
|
|
149
|
+
return Qt[t] ?? t;
|
|
149
150
|
}
|
|
150
|
-
function
|
|
151
|
+
function Dt(t) {
|
|
151
152
|
const e = {};
|
|
152
153
|
for (const [i, s] of Object.entries(t)) {
|
|
153
|
-
const a =
|
|
154
|
+
const a = ye[i] ?? i;
|
|
154
155
|
e[a] = s;
|
|
155
156
|
}
|
|
156
157
|
return e;
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
+
function Ae(t) {
|
|
159
160
|
const e = new URLSearchParams();
|
|
160
161
|
for (const [i, s] of Object.entries(t))
|
|
161
162
|
s != null && (Array.isArray(s) ? s.forEach((a) => e.append(i, String(a))) : e.append(i, String(s)));
|
|
162
163
|
return e;
|
|
163
164
|
}
|
|
164
|
-
async function
|
|
165
|
+
async function Xt({
|
|
165
166
|
countPerPage: t,
|
|
166
167
|
fields: e,
|
|
167
168
|
getPermanentAssetsPaths: i,
|
|
168
169
|
httpMethod: s = "GET",
|
|
169
170
|
isSiteBuilder: a,
|
|
170
|
-
pageNumber:
|
|
171
|
+
pageNumber: o,
|
|
171
172
|
query: n,
|
|
172
|
-
securityByPassToken:
|
|
173
|
+
securityByPassToken: l,
|
|
173
174
|
siteUrl: p,
|
|
174
|
-
sort:
|
|
175
|
+
sort: y,
|
|
175
176
|
token: c,
|
|
176
177
|
useSession: g
|
|
177
178
|
}) {
|
|
178
|
-
const
|
|
179
|
+
const S = e?.map(Se), d = {
|
|
179
180
|
CountPerPage: t,
|
|
180
|
-
Fields:
|
|
181
|
+
Fields: le(S),
|
|
181
182
|
Format: "json",
|
|
182
183
|
GetPermanentAssetsPaths: i || void 0,
|
|
183
|
-
PageNumber:
|
|
184
|
-
Query:
|
|
185
|
-
SecurityByPassToken:
|
|
186
|
-
Sort:
|
|
184
|
+
PageNumber: o,
|
|
185
|
+
Query: lt(n),
|
|
186
|
+
SecurityByPassToken: l || void 0,
|
|
187
|
+
Sort: y || void 0,
|
|
187
188
|
UseSession: g || void 0
|
|
188
|
-
},
|
|
189
|
+
}, A = s === "POST";
|
|
189
190
|
try {
|
|
190
191
|
return (await I.request({
|
|
191
192
|
baseURL: p,
|
|
@@ -193,33 +194,33 @@ async function Bt({
|
|
|
193
194
|
method: s,
|
|
194
195
|
// POST large RecordID queries as a urlencoded body to dodge the ~2KB URL cap;
|
|
195
196
|
// GET keeps the same fields on the query string.
|
|
196
|
-
...
|
|
197
|
+
...A ? { data: Ae(d) } : { params: d, paramsSerializer: { indexes: null } },
|
|
197
198
|
responseType: "json",
|
|
198
199
|
transformResponse: [
|
|
199
200
|
...Array.isArray(I.defaults.transformResponse) ? I.defaults.transformResponse : [],
|
|
200
201
|
a ? (u) => ({
|
|
201
|
-
items: (u.results?.Items ?? []).map(
|
|
202
|
+
items: (u.results?.Items ?? []).map(Dt),
|
|
202
203
|
sort: u.results?.GlobalInfo?.Sort ?? "",
|
|
203
204
|
totalCount: u.results?.GlobalInfo?.TotalCount ?? 0
|
|
204
205
|
}) : (u) => ({
|
|
205
|
-
items: (u.APIResponse?.Items ?? []).map(
|
|
206
|
+
items: (u.APIResponse?.Items ?? []).map(Dt),
|
|
206
207
|
sort: u.APIResponse?.GlobalInfo?.Sort ?? "",
|
|
207
208
|
totalCount: u.APIResponse?.GlobalInfo?.TotalCount ?? 0
|
|
208
209
|
})
|
|
209
210
|
],
|
|
210
|
-
url: a ?
|
|
211
|
+
url: a ? Lt.SEARCH_ASSETS : Yt["4.0"]
|
|
211
212
|
})).data;
|
|
212
213
|
} catch {
|
|
213
214
|
return { items: [], sort: "", totalCount: 0 };
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
|
-
async function
|
|
217
|
+
async function ve({
|
|
217
218
|
assetId: t,
|
|
218
219
|
extension: e,
|
|
219
220
|
format: i,
|
|
220
221
|
siteUrl: s,
|
|
221
222
|
token: a,
|
|
222
|
-
transformations:
|
|
223
|
+
transformations: o,
|
|
223
224
|
useSession: n
|
|
224
225
|
}) {
|
|
225
226
|
try {
|
|
@@ -229,9 +230,9 @@ async function me({
|
|
|
229
230
|
params: {
|
|
230
231
|
SourceAssetFormat: i,
|
|
231
232
|
SourceAssetRecordID: t,
|
|
232
|
-
TargetExtension:
|
|
233
|
+
TargetExtension: ie(e),
|
|
233
234
|
Token: a || void 0,
|
|
234
|
-
Transformations:
|
|
235
|
+
Transformations: o,
|
|
235
236
|
UseSession: n || void 0
|
|
236
237
|
},
|
|
237
238
|
/**
|
|
@@ -239,151 +240,158 @@ async function me({
|
|
|
239
240
|
*/
|
|
240
241
|
timeout: 3e5,
|
|
241
242
|
// 5 minutes
|
|
242
|
-
url:
|
|
243
|
+
url: Ot.GET_TRANSFORM_ASSET_LINK
|
|
243
244
|
})).data;
|
|
244
245
|
} catch {
|
|
245
246
|
return null;
|
|
246
247
|
}
|
|
247
248
|
}
|
|
248
|
-
const
|
|
249
|
-
function
|
|
249
|
+
const ze = 50;
|
|
250
|
+
function Ce(t, e) {
|
|
250
251
|
const i = [];
|
|
251
252
|
for (let s = 0; s < t.length; s += e)
|
|
252
253
|
i.push(t.slice(s, s + e));
|
|
253
254
|
return i;
|
|
254
255
|
}
|
|
255
|
-
async function
|
|
256
|
+
async function we({
|
|
256
257
|
extraFields: t,
|
|
257
258
|
getPermanentAssetsPaths: e,
|
|
258
259
|
isSiteBuilder: i,
|
|
259
260
|
recordIds: s,
|
|
260
261
|
securityByPassToken: a,
|
|
261
|
-
token:
|
|
262
|
+
token: o
|
|
262
263
|
}) {
|
|
263
264
|
if (!Array.isArray(s) || s.length === 0)
|
|
264
265
|
return { facets: [], items: [], totalCount: 0 };
|
|
265
|
-
const n = t?.filter((d) => d && typeof d == "string") ?? [],
|
|
266
|
+
const n = t?.filter((d) => d && typeof d == "string") ?? [], l = [
|
|
266
267
|
...n,
|
|
267
|
-
|
|
268
|
+
gt,
|
|
268
269
|
ft,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
], p = ge(s, fe), f = await Promise.all(
|
|
270
|
+
fe,
|
|
271
|
+
ge,
|
|
272
|
+
mt
|
|
273
|
+
], p = Ce(s, ze), y = await Promise.all(
|
|
274
274
|
p.map(
|
|
275
|
-
(d) =>
|
|
275
|
+
(d) => Xt({
|
|
276
276
|
countPerPage: d.length,
|
|
277
|
-
fields:
|
|
277
|
+
fields: l,
|
|
278
278
|
getPermanentAssetsPaths: e,
|
|
279
279
|
httpMethod: i ? "GET" : "POST",
|
|
280
280
|
isSiteBuilder: i,
|
|
281
281
|
pageNumber: 1,
|
|
282
282
|
query: { recordId: d },
|
|
283
283
|
securityByPassToken: a,
|
|
284
|
-
token:
|
|
284
|
+
token: o
|
|
285
285
|
})
|
|
286
286
|
)
|
|
287
|
-
), c = new Map(s.map((d,
|
|
288
|
-
let
|
|
289
|
-
return
|
|
290
|
-
name:
|
|
291
|
-
|
|
292
|
-
recordId: k(d, ut),
|
|
287
|
+
), c = new Map(s.map((d, A) => [d, A])), g = y.flatMap((d) => d.items).map((d) => {
|
|
288
|
+
let A = F(d, gt);
|
|
289
|
+
return A === "" && (A = F(d, ft)), {
|
|
290
|
+
name: A,
|
|
291
|
+
recordId: F(d, mt),
|
|
293
292
|
...n.reduce(
|
|
294
|
-
(
|
|
293
|
+
(k, u) => {
|
|
294
|
+
k[u] = F(d, u);
|
|
295
|
+
const R = Kt(d, u);
|
|
296
|
+
return R !== void 0 && (k[`${u}${$t}`] = String(R)), k;
|
|
297
|
+
},
|
|
295
298
|
{}
|
|
296
299
|
)
|
|
297
300
|
};
|
|
298
301
|
}).sort(
|
|
299
|
-
(d,
|
|
300
|
-
),
|
|
301
|
-
(d,
|
|
302
|
+
(d, A) => (c.get(d.recordId) ?? 1 / 0) - (c.get(A.recordId) ?? 1 / 0)
|
|
303
|
+
), S = y.reduce(
|
|
304
|
+
(d, A) => d + A.totalCount,
|
|
302
305
|
0
|
|
303
306
|
);
|
|
304
|
-
return { facets: [], items: g, totalCount:
|
|
307
|
+
return { facets: [], items: g, totalCount: S };
|
|
305
308
|
}
|
|
306
|
-
function
|
|
309
|
+
function F(t, e) {
|
|
307
310
|
const i = t[e];
|
|
308
|
-
return i == null ? "" : typeof i == "string" ? i : typeof i == "number" || typeof i == "boolean" ? String(i) :
|
|
311
|
+
return i == null ? "" : typeof i == "string" ? i : typeof i == "number" || typeof i == "boolean" ? String(i) : Vt(i) ? i.URI : "";
|
|
309
312
|
}
|
|
310
|
-
|
|
313
|
+
function Kt(t, e) {
|
|
314
|
+
const i = t[e];
|
|
315
|
+
if (!(i == null || !Vt(i)))
|
|
316
|
+
return typeof i.Width == "number" && i.Width > 0 ? i.Width : void 0;
|
|
317
|
+
}
|
|
318
|
+
async function be({
|
|
311
319
|
countPerPage: t,
|
|
312
320
|
directParentFolderIdentifier: e,
|
|
313
321
|
extraFields: i,
|
|
314
322
|
getPermanentAssetsPaths: s,
|
|
315
323
|
isSiteBuilder: a,
|
|
316
|
-
limitedDocTypes:
|
|
324
|
+
limitedDocTypes: o,
|
|
317
325
|
pageNumber: n,
|
|
318
|
-
parentFolderIdentifier:
|
|
326
|
+
parentFolderIdentifier: l,
|
|
319
327
|
searchTerm: p,
|
|
320
|
-
securityByPassToken:
|
|
328
|
+
securityByPassToken: y,
|
|
321
329
|
sortOrder: c,
|
|
322
330
|
token: g
|
|
323
331
|
}) {
|
|
324
|
-
if (!e && !
|
|
332
|
+
if (!e && !l)
|
|
325
333
|
return { facets: [], items: [], totalCount: 0 };
|
|
326
|
-
const
|
|
334
|
+
const S = (i?.filter((u) => u && typeof u == "string") ?? []).map((u) => u.replace("%20", " ")), d = {
|
|
327
335
|
directParentFolderIdentifier: e,
|
|
328
|
-
parentFolderIdentifier:
|
|
329
|
-
...
|
|
330
|
-
},
|
|
336
|
+
parentFolderIdentifier: l,
|
|
337
|
+
...o && o.length > 0 ? { docType: o } : {}
|
|
338
|
+
}, A = await Xt({
|
|
331
339
|
countPerPage: t,
|
|
332
340
|
fields: [
|
|
333
|
-
...
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
It,
|
|
341
|
+
...S,
|
|
342
|
+
Gt,
|
|
343
|
+
Tt,
|
|
344
|
+
ut,
|
|
338
345
|
dt,
|
|
339
346
|
pt,
|
|
340
|
-
_t,
|
|
341
|
-
lt,
|
|
342
|
-
Et,
|
|
343
|
-
Mt,
|
|
344
347
|
ct,
|
|
345
|
-
|
|
348
|
+
Wt,
|
|
349
|
+
Ht,
|
|
350
|
+
rt,
|
|
346
351
|
mt,
|
|
347
|
-
ft
|
|
352
|
+
ft,
|
|
353
|
+
gt
|
|
348
354
|
],
|
|
349
355
|
getPermanentAssetsPaths: s,
|
|
350
356
|
isSiteBuilder: a,
|
|
351
357
|
pageNumber: n,
|
|
352
358
|
query: d,
|
|
353
|
-
securityByPassToken:
|
|
359
|
+
securityByPassToken: y,
|
|
354
360
|
sort: void 0,
|
|
355
361
|
token: g
|
|
356
|
-
}),
|
|
357
|
-
let
|
|
358
|
-
|
|
359
|
-
const
|
|
362
|
+
}), k = A.items.map((u) => {
|
|
363
|
+
let R = F(u, rt), D = F(u, gt);
|
|
364
|
+
R && !R.startsWith(".") && (R = "." + R), D === "" && (D = F(u, ft));
|
|
365
|
+
const E = F(u, mt);
|
|
360
366
|
return {
|
|
361
|
-
docSubType:
|
|
362
|
-
docType:
|
|
363
|
-
extension:
|
|
364
|
-
height:
|
|
365
|
-
id:
|
|
366
|
-
identifier:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
367
|
+
docSubType: F(u, Wt),
|
|
368
|
+
docType: F(u, ct) || "",
|
|
369
|
+
extension: R,
|
|
370
|
+
height: F(u, dt) || "0",
|
|
371
|
+
id: E,
|
|
372
|
+
identifier: F(u, Ht),
|
|
373
|
+
name: D,
|
|
374
|
+
recordId: E,
|
|
375
|
+
size: F(u, pt) || "0 MB",
|
|
376
|
+
tags: F(u, Tt),
|
|
377
|
+
width: F(u, ut) || "0",
|
|
378
|
+
...S.reduce(
|
|
379
|
+
(at, et) => {
|
|
380
|
+
at[et] = F(u, et);
|
|
381
|
+
const K = Kt(u, et);
|
|
382
|
+
return K !== void 0 && (at[`${et}${$t}`] = String(K)), at;
|
|
383
|
+
},
|
|
376
384
|
{}
|
|
377
385
|
)
|
|
378
386
|
};
|
|
379
387
|
});
|
|
380
388
|
return {
|
|
381
389
|
facets: [],
|
|
382
|
-
items:
|
|
383
|
-
totalCount:
|
|
390
|
+
items: k,
|
|
391
|
+
totalCount: A.totalCount
|
|
384
392
|
};
|
|
385
393
|
}
|
|
386
|
-
async function
|
|
394
|
+
async function ke({
|
|
387
395
|
autoCropMode: t,
|
|
388
396
|
cropHeight: e,
|
|
389
397
|
cropWidth: i,
|
|
@@ -412,13 +420,13 @@ async function Se({
|
|
|
412
420
|
y: n.cropY
|
|
413
421
|
})
|
|
414
422
|
],
|
|
415
|
-
url:
|
|
423
|
+
url: Ot.GET_CROP_ZONE_SUGGESTION
|
|
416
424
|
})).data;
|
|
417
425
|
} catch {
|
|
418
426
|
return null;
|
|
419
427
|
}
|
|
420
428
|
}
|
|
421
|
-
async function
|
|
429
|
+
async function Ui({
|
|
422
430
|
assetRecordId: t,
|
|
423
431
|
isSiteBuilder: e,
|
|
424
432
|
siteUrl: i,
|
|
@@ -437,25 +445,25 @@ async function Ii({
|
|
|
437
445
|
responseType: "json",
|
|
438
446
|
transformResponse: [
|
|
439
447
|
...Array.isArray(I.defaults.transformResponse) ? I.defaults.transformResponse : [],
|
|
440
|
-
(n) => !n || typeof n != "object" ? [] : n.proxies?.map((
|
|
441
|
-
cdnName:
|
|
442
|
-
extension:
|
|
443
|
-
formatHeight:
|
|
444
|
-
formatWidth:
|
|
445
|
-
height:
|
|
446
|
-
permanentLink:
|
|
447
|
-
proxyLabel:
|
|
448
|
-
proxyName:
|
|
449
|
-
width:
|
|
448
|
+
(n) => !n || typeof n != "object" ? [] : n.proxies?.map((l) => ({
|
|
449
|
+
cdnName: l.cdnName,
|
|
450
|
+
extension: l.extension,
|
|
451
|
+
formatHeight: l.formatHeight,
|
|
452
|
+
formatWidth: l.formatWidth,
|
|
453
|
+
height: l.height,
|
|
454
|
+
permanentLink: l.permanentLink,
|
|
455
|
+
proxyLabel: l.proxyLabel,
|
|
456
|
+
proxyName: l.proxyName,
|
|
457
|
+
width: l.width
|
|
450
458
|
})) ?? []
|
|
451
459
|
],
|
|
452
|
-
url: e ?
|
|
460
|
+
url: e ? Lt.GET_AVAILABLE_PROXIES : ee
|
|
453
461
|
})).data;
|
|
454
462
|
} catch {
|
|
455
463
|
return [];
|
|
456
464
|
}
|
|
457
465
|
}
|
|
458
|
-
async function
|
|
466
|
+
async function Bi({
|
|
459
467
|
siteUrl: t
|
|
460
468
|
} = {}) {
|
|
461
469
|
try {
|
|
@@ -476,13 +484,13 @@ async function Ei({
|
|
|
476
484
|
formatsByDocType: i.formatsByDocType ?? {}
|
|
477
485
|
}
|
|
478
486
|
],
|
|
479
|
-
url:
|
|
487
|
+
url: Jt
|
|
480
488
|
})).data;
|
|
481
489
|
} catch {
|
|
482
490
|
return { formatsByDocType: {} };
|
|
483
491
|
}
|
|
484
492
|
}
|
|
485
|
-
async function
|
|
493
|
+
async function qi({
|
|
486
494
|
recordIds: t,
|
|
487
495
|
rightsToCheck: e
|
|
488
496
|
}) {
|
|
@@ -498,14 +506,14 @@ async function Hi({
|
|
|
498
506
|
params: { RecordIDs: t, RightsToCheck: e },
|
|
499
507
|
paramsSerializer: { indexes: null },
|
|
500
508
|
responseType: "json",
|
|
501
|
-
url:
|
|
509
|
+
url: te.GET_AUTHORIZED_OBJECTS
|
|
502
510
|
});
|
|
503
511
|
return s;
|
|
504
512
|
} catch {
|
|
505
513
|
return i;
|
|
506
514
|
}
|
|
507
515
|
}
|
|
508
|
-
const
|
|
516
|
+
const vt = 20, wt = "TR1", bt = "TRX", Re = /* @__PURE__ */ new Set([".gif"]), $e = /* @__PURE__ */ new Set([
|
|
509
517
|
".avif",
|
|
510
518
|
".bmp",
|
|
511
519
|
".gif",
|
|
@@ -516,17 +524,32 @@ const Tt = 20, Wt = "TR1", Ce = /* @__PURE__ */ new Set([
|
|
|
516
524
|
".svg",
|
|
517
525
|
".webp"
|
|
518
526
|
]);
|
|
519
|
-
function
|
|
527
|
+
function Zt(t) {
|
|
520
528
|
const e = t.toLowerCase(), i = e.startsWith(".") ? e : `.${e}`;
|
|
521
|
-
return
|
|
529
|
+
return $e.has(i);
|
|
530
|
+
}
|
|
531
|
+
function Nt({
|
|
532
|
+
extension: t,
|
|
533
|
+
format: e,
|
|
534
|
+
item: i,
|
|
535
|
+
manualFormat: s,
|
|
536
|
+
size: a
|
|
537
|
+
}) {
|
|
538
|
+
const o = t?.toLowerCase() ?? "", n = o.startsWith(".") ? o : `.${o}`, l = `path_${wt}`, p = (S) => i[S] ? { maxWidth: i[`${S}${$t}`], src: i[S] } : void 0;
|
|
539
|
+
if (!s)
|
|
540
|
+
return p(`path_${Bt(o, a)}`) ?? p(l) ?? {};
|
|
541
|
+
if (!!o && Re.has(n))
|
|
542
|
+
return p(`path_${bt}`) ?? p(l) ?? {};
|
|
543
|
+
const c = !o || Zt(o), g = e ? `path_${e}` : void 0;
|
|
544
|
+
return g && c && i[g] ? p(g) ?? {} : p(l) ?? {};
|
|
522
545
|
}
|
|
523
|
-
class
|
|
546
|
+
class ji {
|
|
524
547
|
constructor(e, i) {
|
|
525
|
-
this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = 1 / 0, this.pageSize =
|
|
548
|
+
this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = 1 / 0, this.pageSize = vt, this.requestEpoch = 0, this.host = e, this.host.addController?.(this);
|
|
526
549
|
const s = i?.maxEnd;
|
|
527
550
|
this.maxEnd = typeof s == "number" && Number.isFinite(s) && s >= 0 ? Math.floor(s) : 1 / 0;
|
|
528
551
|
const a = i?.pageSize;
|
|
529
|
-
this.pageSize = typeof a == "number" && Number.isFinite(a) && a >= 1 ? Math.floor(a) :
|
|
552
|
+
this.pageSize = typeof a == "number" && Number.isFinite(a) && a >= 1 ? Math.floor(a) : vt, this.authToken = i?.token, this.securityByPassToken = i?.securityByPassToken, this.isSiteBuilder = i?.isSiteBuilder ?? !1;
|
|
530
553
|
}
|
|
531
554
|
get totalDataCount() {
|
|
532
555
|
return this.totalCount;
|
|
@@ -534,61 +557,92 @@ class Ti {
|
|
|
534
557
|
setSecurityByPassToken(e) {
|
|
535
558
|
this.securityByPassToken !== e && (this.securityByPassToken = e, this.resetPageCache());
|
|
536
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Changes how many items each request asks for.
|
|
562
|
+
*
|
|
563
|
+
* A new size moves every page boundary, so cached pages are dropped and the next fetch
|
|
564
|
+
* starts from page 1. `data` is kept — it is indexed absolutely, so the refetch
|
|
565
|
+
* overwrites in place instead of blanking the grid.
|
|
566
|
+
*
|
|
567
|
+
* Shrinking is ignored once pages are cached: collapsing already has what it needs.
|
|
568
|
+
*/
|
|
569
|
+
setPageSize(e) {
|
|
570
|
+
const i = Number.isFinite(e) && e >= 1 ? Math.floor(e) : vt;
|
|
571
|
+
if (this.pageSize === i)
|
|
572
|
+
return;
|
|
573
|
+
const s = this.fetchedPages.size > 0;
|
|
574
|
+
s && i < this.pageSize || (this.pageSize = i, s && (this.requestEpoch += 1, this.fetchedPages.clear()));
|
|
575
|
+
}
|
|
537
576
|
async fetchImages({
|
|
538
577
|
end: e,
|
|
539
578
|
extraFields: i = [],
|
|
540
579
|
format: s,
|
|
541
|
-
|
|
542
|
-
|
|
580
|
+
manualFormat: a = !0,
|
|
581
|
+
start: o,
|
|
582
|
+
transformations: n
|
|
543
583
|
}) {
|
|
544
|
-
if (e <
|
|
584
|
+
if (e < o)
|
|
545
585
|
return this.data;
|
|
546
|
-
if (this.totalCount > 0 && e >= this.totalCount && (e = this.totalCount - 1, e <
|
|
586
|
+
if (this.totalCount > 0 && e >= this.totalCount && (e = this.totalCount - 1, e < o))
|
|
547
587
|
return this.data;
|
|
548
|
-
const
|
|
549
|
-
if (!this.folderId ||
|
|
588
|
+
const l = this.requestEpoch;
|
|
589
|
+
if (!this.folderId || l !== this.requestEpoch)
|
|
550
590
|
return this.data;
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
|
|
591
|
+
const p = s ? `path_${s}` : void 0, y = `path_${wt}`, c = `path_${bt}`, g = [
|
|
592
|
+
...new Set(
|
|
593
|
+
[p, y, c].filter(
|
|
594
|
+
(A) => !!A
|
|
595
|
+
)
|
|
596
|
+
)
|
|
597
|
+
], S = Math.floor(o / this.pageSize) + 1, d = Math.floor(e / this.pageSize) + 1;
|
|
598
|
+
for (let A = S; A <= d; A++) {
|
|
599
|
+
if (this.fetchedPages.has(A))
|
|
554
600
|
continue;
|
|
555
|
-
const
|
|
601
|
+
const k = await be({
|
|
556
602
|
countPerPage: this.pageSize,
|
|
557
603
|
directParentFolderIdentifier: this.folderId,
|
|
558
|
-
extraFields: [...i, ...
|
|
559
|
-
getPermanentAssetsPaths:
|
|
604
|
+
extraFields: [...i, ...g],
|
|
605
|
+
getPermanentAssetsPaths: !0,
|
|
560
606
|
isSiteBuilder: this.isSiteBuilder,
|
|
561
|
-
pageNumber:
|
|
607
|
+
pageNumber: A,
|
|
562
608
|
searchTerm: "",
|
|
563
609
|
securityByPassToken: this.securityByPassToken,
|
|
564
610
|
sortOrder: "",
|
|
565
611
|
token: this.authToken
|
|
566
612
|
});
|
|
567
|
-
if (
|
|
613
|
+
if (l !== this.requestEpoch)
|
|
568
614
|
return this.data;
|
|
569
|
-
if (this.fetchedPages.add(
|
|
570
|
-
const
|
|
571
|
-
this.totalCount =
|
|
615
|
+
if (this.fetchedPages.add(A), !this.totalCount && k.totalCount) {
|
|
616
|
+
const R = Math.min(this.maxEnd, k.totalCount);
|
|
617
|
+
this.totalCount = R, this.data = Array.from({ length: R }, () => ({
|
|
572
618
|
alt: "",
|
|
573
|
-
id: `temp-${
|
|
619
|
+
id: `temp-${ae()}`,
|
|
574
620
|
name: "",
|
|
575
621
|
src: ""
|
|
576
622
|
}));
|
|
577
623
|
}
|
|
578
|
-
const
|
|
579
|
-
for (let
|
|
580
|
-
const
|
|
581
|
-
if (
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
624
|
+
const u = (A - 1) * this.pageSize;
|
|
625
|
+
for (let R = 0; R < k.items.length; R++) {
|
|
626
|
+
const D = u + R;
|
|
627
|
+
if (D < this.data.length) {
|
|
628
|
+
const E = k.items[R], { maxWidth: at, src: et } = Nt({
|
|
629
|
+
extension: E.extension,
|
|
630
|
+
format: s,
|
|
631
|
+
item: E,
|
|
632
|
+
manualFormat: a,
|
|
633
|
+
size: E.size
|
|
634
|
+
});
|
|
635
|
+
let K = et;
|
|
636
|
+
K && n && n.length > 0 && (K = Mt(K, n)), this.data[D] = {
|
|
637
|
+
alt: E.name,
|
|
638
|
+
docType: E.docType,
|
|
639
|
+
extension: E.extension,
|
|
640
|
+
id: E.id,
|
|
641
|
+
maxWidth: at,
|
|
642
|
+
name: E.name,
|
|
643
|
+
src: K,
|
|
590
644
|
...i.reduce(
|
|
591
|
-
(
|
|
645
|
+
(Ft, _t) => (Ft[_t] = E[_t] ?? "", Ft),
|
|
592
646
|
{}
|
|
593
647
|
)
|
|
594
648
|
};
|
|
@@ -601,67 +655,85 @@ class Ti {
|
|
|
601
655
|
extraFields: i = [],
|
|
602
656
|
folderId: s,
|
|
603
657
|
forceRefetch: a = !1,
|
|
604
|
-
format:
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
658
|
+
format: o,
|
|
659
|
+
manualFormat: n = !0,
|
|
660
|
+
minLimit: l = 5,
|
|
661
|
+
noPlaceholders: p = !1,
|
|
662
|
+
transformations: y
|
|
608
663
|
}) {
|
|
609
664
|
(!this.folderId || this.folderId !== s) && (this.folderId = s, this.resetFolderState()), a && this.resetPageCache();
|
|
610
|
-
const
|
|
665
|
+
const c = Math.max(5, l), g = e, S = e + c, d = [
|
|
611
666
|
...i,
|
|
612
|
-
|
|
613
|
-
|
|
667
|
+
dt,
|
|
668
|
+
ut
|
|
614
669
|
];
|
|
615
670
|
await this.fetchImages({
|
|
616
|
-
end:
|
|
617
|
-
extraFields:
|
|
618
|
-
format:
|
|
619
|
-
|
|
620
|
-
|
|
671
|
+
end: S,
|
|
672
|
+
extraFields: d.filter((u) => u !== ""),
|
|
673
|
+
format: o,
|
|
674
|
+
manualFormat: n,
|
|
675
|
+
start: g,
|
|
676
|
+
transformations: y
|
|
621
677
|
});
|
|
622
|
-
let
|
|
623
|
-
|
|
624
|
-
const
|
|
678
|
+
let A = e - c;
|
|
679
|
+
A < 0 && (this.totalCount === 0 ? A = 0 : A = Math.max(0, this.totalCount + A));
|
|
680
|
+
const k = A + c;
|
|
625
681
|
return await this.fetchImages({
|
|
626
|
-
end:
|
|
627
|
-
extraFields:
|
|
628
|
-
format:
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
682
|
+
end: k,
|
|
683
|
+
extraFields: d.filter((u) => u !== ""),
|
|
684
|
+
format: o,
|
|
685
|
+
manualFormat: n,
|
|
686
|
+
start: A,
|
|
687
|
+
transformations: y
|
|
688
|
+
}), p ? this.data.filter((u) => u.id && !u.id.startsWith("temp-")) : this.data;
|
|
632
689
|
}
|
|
633
690
|
async fetchImagesByIDs({
|
|
634
691
|
extraFields: e = [],
|
|
635
692
|
format: i,
|
|
636
|
-
|
|
637
|
-
|
|
693
|
+
manualFormat: s = !0,
|
|
694
|
+
recordIds: a,
|
|
695
|
+
transformations: o
|
|
638
696
|
}) {
|
|
639
|
-
if (
|
|
697
|
+
if (a.length === 0)
|
|
640
698
|
return [];
|
|
641
|
-
const
|
|
699
|
+
const n = i ? `path_${i}` : void 0, l = `path_${wt}`, p = `path_${bt}`, y = [
|
|
700
|
+
...new Set(
|
|
701
|
+
[n, l, p].filter(
|
|
702
|
+
(d) => !!d
|
|
703
|
+
)
|
|
704
|
+
)
|
|
705
|
+
], c = [rt, pt], g = [
|
|
642
706
|
...e,
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
707
|
+
ct,
|
|
708
|
+
dt,
|
|
709
|
+
ut
|
|
646
710
|
];
|
|
647
|
-
return (await
|
|
648
|
-
extraFields: [...
|
|
649
|
-
getPermanentAssetsPaths:
|
|
711
|
+
return (await we({
|
|
712
|
+
extraFields: [...g, ...y, ...c].filter((d) => d !== ""),
|
|
713
|
+
getPermanentAssetsPaths: !0,
|
|
650
714
|
isSiteBuilder: this.isSiteBuilder,
|
|
651
|
-
recordIds:
|
|
715
|
+
recordIds: a,
|
|
652
716
|
securityByPassToken: this.securityByPassToken,
|
|
653
717
|
token: this.authToken
|
|
654
|
-
})).items.map((
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
718
|
+
})).items.map((d) => {
|
|
719
|
+
const { maxWidth: A, src: k } = Nt({
|
|
720
|
+
extension: d[rt],
|
|
721
|
+
format: i,
|
|
722
|
+
item: d,
|
|
723
|
+
manualFormat: s,
|
|
724
|
+
size: d[pt]
|
|
725
|
+
});
|
|
726
|
+
let u = k;
|
|
727
|
+
return u && o && o.length > 0 && (u = Mt(u, o)), {
|
|
728
|
+
alt: d.name,
|
|
729
|
+
docType: d[ct],
|
|
730
|
+
extension: d[rt] || "",
|
|
731
|
+
id: d.recordId,
|
|
732
|
+
maxWidth: A,
|
|
733
|
+
name: d.name,
|
|
662
734
|
src: u,
|
|
663
|
-
...
|
|
664
|
-
(
|
|
735
|
+
...g.reduce(
|
|
736
|
+
(R, D) => (R[D] = d[D] ?? "", R),
|
|
665
737
|
{}
|
|
666
738
|
)
|
|
667
739
|
};
|
|
@@ -672,57 +744,63 @@ class Ti {
|
|
|
672
744
|
folderId: i,
|
|
673
745
|
forceRefetch: s = !1,
|
|
674
746
|
format: a,
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
747
|
+
manualFormat: o = !0,
|
|
748
|
+
noPlaceholders: n = !1,
|
|
749
|
+
page: l,
|
|
750
|
+
pageSize: p = 10,
|
|
751
|
+
transformations: y
|
|
679
752
|
}) {
|
|
680
753
|
(!this.folderId || this.folderId !== i) && (this.folderId = i, this.resetFolderState()), s && this.resetPageCache();
|
|
681
|
-
const
|
|
754
|
+
const c = l * p, g = c + p - 1;
|
|
682
755
|
return await this.fetchImages({
|
|
683
|
-
end:
|
|
756
|
+
end: g,
|
|
684
757
|
extraFields: e,
|
|
685
758
|
format: a,
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
759
|
+
manualFormat: o,
|
|
760
|
+
start: c,
|
|
761
|
+
transformations: y
|
|
762
|
+
}), n ? this.data.filter((S) => S.id && !S.id.startsWith("temp-")) : this.data;
|
|
689
763
|
}
|
|
690
764
|
async *fetchImagesInFolderByChunk({
|
|
691
765
|
chunkSize: e = 10,
|
|
692
766
|
end: i = 0,
|
|
693
767
|
extraFields: s = [],
|
|
694
768
|
folderId: a,
|
|
695
|
-
forceRefetch:
|
|
769
|
+
forceRefetch: o = !1,
|
|
696
770
|
format: n,
|
|
697
|
-
|
|
698
|
-
|
|
771
|
+
manualFormat: l = !0,
|
|
772
|
+
start: p = 0,
|
|
773
|
+
transformations: y
|
|
699
774
|
}) {
|
|
700
|
-
const
|
|
701
|
-
if ((!this.folderId || this.folderId !== a) && (this.folderId = a, this.resetFolderState()),
|
|
775
|
+
const c = Math.max(1, e);
|
|
776
|
+
if ((!this.folderId || this.folderId !== a) && (this.folderId = a, this.resetFolderState()), o && this.resetPageCache(), i !== -1) {
|
|
702
777
|
await this.fetchImages({
|
|
703
778
|
end: i,
|
|
704
779
|
extraFields: s,
|
|
705
780
|
format: n,
|
|
706
|
-
|
|
707
|
-
|
|
781
|
+
manualFormat: l,
|
|
782
|
+
start: p,
|
|
783
|
+
transformations: y
|
|
708
784
|
}), yield this.data;
|
|
709
785
|
return;
|
|
710
786
|
}
|
|
711
|
-
let
|
|
787
|
+
let g = p, S = p + c;
|
|
712
788
|
if (await this.fetchImages({
|
|
713
|
-
end:
|
|
789
|
+
end: S,
|
|
714
790
|
extraFields: s,
|
|
715
791
|
format: n,
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
792
|
+
manualFormat: l,
|
|
793
|
+
start: g,
|
|
794
|
+
transformations: y
|
|
795
|
+
}), yield this.data, !(!this.totalCount || this.totalCount <= S))
|
|
796
|
+
for (; S < this.totalCount; )
|
|
797
|
+
g = S, S = Math.min(S + c, this.totalCount), await this.fetchImages({
|
|
798
|
+
end: S,
|
|
722
799
|
extraFields: s,
|
|
723
800
|
format: n,
|
|
724
|
-
|
|
725
|
-
|
|
801
|
+
manualFormat: l,
|
|
802
|
+
start: g,
|
|
803
|
+
transformations: y
|
|
726
804
|
}), yield this.data;
|
|
727
805
|
}
|
|
728
806
|
hostConnected() {
|
|
@@ -737,34 +815,34 @@ class Ti {
|
|
|
737
815
|
this.resetPageCache();
|
|
738
816
|
}
|
|
739
817
|
}
|
|
740
|
-
const
|
|
741
|
-
var
|
|
742
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
743
|
-
(n = t[
|
|
744
|
-
return s && a &&
|
|
818
|
+
const Pe = j`.asset-link-format__details{--header-padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__details::part(icon){width:var(--cx-font-size-3x-large);height:var(--cx-font-size-3x-large);background-color:var(--cx-color-neutral-100);border-radius:var(--cx-border-radius-large);color:var(--cx-color-neutral-600);font-size:var(--cx-font-size-large);justify-content:center;align-items:center;display:flex}.asset-link-format__details::part(input-label){color:var(--cx-color-neutral-400);margin-inline-start:var(--cx-spacing-small)}.asset-link-format__header{padding:var(--cx-spacing-medium)}.asset-link-format__section-header{padding:0 var(--cx-spacing-medium);border-top:var(--section-header-border-width,1px) solid var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-50)}.asset-link-format__undo,.asset-link-format__reset{--color:var(--cx-color-primary);--background-color:transparent}`, Fe = j`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}`;
|
|
819
|
+
var _e = Object.defineProperty, Me = Object.getOwnPropertyDescriptor, z = (t, e, i, s) => {
|
|
820
|
+
for (var a = s > 1 ? void 0 : s ? Me(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
821
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
822
|
+
return s && a && _e(e, i, a), a;
|
|
745
823
|
};
|
|
746
|
-
let
|
|
824
|
+
let v = class extends q {
|
|
747
825
|
constructor() {
|
|
748
|
-
super(...arguments), this.localize = new
|
|
749
|
-
[
|
|
826
|
+
super(...arguments), this.localize = new V(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit = r.Pixel, this.disabledApply = !1, this.noRatioModes = !1, this.showPositionPicker = !1, this.lastAppliedSetting = {
|
|
827
|
+
[r.Pixel]: {
|
|
750
828
|
height: 0,
|
|
751
829
|
percentageHeight: 100,
|
|
752
830
|
percentageWidth: 100,
|
|
753
|
-
unit:
|
|
831
|
+
unit: r.Pixel,
|
|
754
832
|
width: 0,
|
|
755
833
|
x: 0,
|
|
756
834
|
y: 0
|
|
757
835
|
},
|
|
758
|
-
[
|
|
836
|
+
[r.AspectRatio]: {
|
|
759
837
|
height: 1,
|
|
760
838
|
percentageHeight: 100,
|
|
761
839
|
percentageWidth: 100,
|
|
762
|
-
unit:
|
|
840
|
+
unit: r.AspectRatio,
|
|
763
841
|
width: 1,
|
|
764
842
|
x: 0,
|
|
765
843
|
y: 0
|
|
766
844
|
}
|
|
767
|
-
}, this.loading = !1, this.cropModes = [], this.focusModes = [], this.focusMode = "manual", this.cropMode = "free", this.position =
|
|
845
|
+
}, this.loading = !1, this.cropModes = [], this.focusModes = [], this.focusMode = "manual", this.cropMode = "free", this.position = N.CenterCenter, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
768
846
|
}
|
|
769
847
|
get selectedMode() {
|
|
770
848
|
return this.cropModes.find((t) => t.value === this.cropMode);
|
|
@@ -776,10 +854,10 @@ let C = class extends B {
|
|
|
776
854
|
return;
|
|
777
855
|
}
|
|
778
856
|
if (this.keepAspectRatio) {
|
|
779
|
-
if (this.unit ===
|
|
857
|
+
if (this.unit === r.Pixel && this.width && this.height) {
|
|
780
858
|
this.aspectRatio = this.width / this.height;
|
|
781
859
|
return;
|
|
782
|
-
} else if (this.unit ===
|
|
860
|
+
} else if (this.unit === r.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
783
861
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
784
862
|
return;
|
|
785
863
|
}
|
|
@@ -810,9 +888,9 @@ let C = class extends B {
|
|
|
810
888
|
}
|
|
811
889
|
this.invalidWidth = !1;
|
|
812
890
|
let e = Number(t.target.value);
|
|
813
|
-
this.unit ===
|
|
814
|
-
let i = this.unit ===
|
|
815
|
-
this.keepAspectRatio && (i = Math.round(e / this.aspectRatio), this.unit ===
|
|
891
|
+
this.unit === r.Pixel && (e = Math.max(Math.min(e, this.maxWidth), 1)), t.target.value = e.toString();
|
|
892
|
+
let i = this.unit === r.Pixel ? this.height : this.ratioHeight, s = !1;
|
|
893
|
+
this.keepAspectRatio && (i = Math.round(e / this.aspectRatio), this.unit === r.Pixel && i > this.maxHeight && (i = this.maxHeight, s = !0)), this.invalidHeight = !1, this.emit("cx-asset-link-format-crop-change", {
|
|
816
894
|
detail: {
|
|
817
895
|
breakAspectRatio: s,
|
|
818
896
|
height: i,
|
|
@@ -829,9 +907,9 @@ let C = class extends B {
|
|
|
829
907
|
}
|
|
830
908
|
this.invalidHeight = !1;
|
|
831
909
|
let e = Number(t.target.value);
|
|
832
|
-
this.unit ===
|
|
833
|
-
let i = this.unit ===
|
|
834
|
-
this.keepAspectRatio && (i = Math.round(e * this.aspectRatio), this.unit ===
|
|
910
|
+
this.unit === r.Pixel && (e = Math.max(Math.min(e, this.maxHeight), 1)), t.target.value = e.toString();
|
|
911
|
+
let i = this.unit === r.Pixel ? this.width : this.ratioWidth, s = !1;
|
|
912
|
+
this.keepAspectRatio && (i = Math.round(e * this.aspectRatio), this.unit === r.Pixel && i > this.maxWidth && (i = this.maxWidth, s = !0)), this.invalidWidth = !1, this.emit("cx-asset-link-format-crop-change", {
|
|
835
913
|
detail: {
|
|
836
914
|
breakAspectRatio: s,
|
|
837
915
|
height: e,
|
|
@@ -846,18 +924,18 @@ let C = class extends B {
|
|
|
846
924
|
if (e === "free")
|
|
847
925
|
this.selectedMode?.auto && this.emit("cx-asset-link-format-crop-change", {
|
|
848
926
|
detail: {
|
|
849
|
-
height: this.lastAppliedSetting[
|
|
927
|
+
height: this.lastAppliedSetting[r.Pixel].height,
|
|
850
928
|
keepAspectRatio: !1,
|
|
851
929
|
silent: !0,
|
|
852
|
-
unit:
|
|
853
|
-
width: this.lastAppliedSetting[
|
|
930
|
+
unit: r.Pixel,
|
|
931
|
+
width: this.lastAppliedSetting[r.Pixel].width
|
|
854
932
|
}
|
|
855
933
|
});
|
|
856
934
|
else if (!i) {
|
|
857
935
|
const [s, a] = e.split(":").map(Number);
|
|
858
|
-
if (this.unit ===
|
|
859
|
-
let
|
|
860
|
-
Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && ({ height: n, width:
|
|
936
|
+
if (this.unit === r.Pixel) {
|
|
937
|
+
let o = s, n = a;
|
|
938
|
+
Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && ({ height: n, width: o } = re(
|
|
861
939
|
this.maxWidth,
|
|
862
940
|
this.maxHeight,
|
|
863
941
|
s,
|
|
@@ -867,8 +945,8 @@ let C = class extends B {
|
|
|
867
945
|
height: n,
|
|
868
946
|
keepAspectRatio: !0,
|
|
869
947
|
silent: !0,
|
|
870
|
-
unit:
|
|
871
|
-
width:
|
|
948
|
+
unit: r.Pixel,
|
|
949
|
+
width: o
|
|
872
950
|
}
|
|
873
951
|
});
|
|
874
952
|
} else
|
|
@@ -877,7 +955,7 @@ let C = class extends B {
|
|
|
877
955
|
height: a,
|
|
878
956
|
keepAspectRatio: !0,
|
|
879
957
|
silent: !0,
|
|
880
|
-
unit:
|
|
958
|
+
unit: r.AspectRatio,
|
|
881
959
|
width: s
|
|
882
960
|
}
|
|
883
961
|
});
|
|
@@ -910,19 +988,19 @@ let C = class extends B {
|
|
|
910
988
|
* This allows the parent component to update the crop settings accordingly.
|
|
911
989
|
*/
|
|
912
990
|
onUnitChange(t) {
|
|
913
|
-
t.target.value ===
|
|
991
|
+
t.target.value === r.AspectRatio ? this.emit("cx-asset-link-format-crop-change", {
|
|
914
992
|
detail: {
|
|
915
|
-
height: this.lastAppliedSetting[
|
|
993
|
+
height: this.lastAppliedSetting[r.AspectRatio].height,
|
|
916
994
|
keepAspectRatio: this.keepAspectRatio,
|
|
917
|
-
unit:
|
|
918
|
-
width: this.lastAppliedSetting[
|
|
995
|
+
unit: r.AspectRatio,
|
|
996
|
+
width: this.lastAppliedSetting[r.AspectRatio].width
|
|
919
997
|
}
|
|
920
998
|
}) : this.emit("cx-asset-link-format-crop-change", {
|
|
921
999
|
detail: {
|
|
922
|
-
height: this.lastAppliedSetting[
|
|
1000
|
+
height: this.lastAppliedSetting[r.Pixel].height,
|
|
923
1001
|
keepAspectRatio: this.keepAspectRatio,
|
|
924
|
-
unit:
|
|
925
|
-
width: this.lastAppliedSetting[
|
|
1002
|
+
unit: r.Pixel,
|
|
1003
|
+
width: this.lastAppliedSetting[r.Pixel].width
|
|
926
1004
|
}
|
|
927
1005
|
}), this.emit("cx-asset-link-format-crop-mode-change", {
|
|
928
1006
|
detail: {
|
|
@@ -966,173 +1044,173 @@ let C = class extends B {
|
|
|
966
1044
|
}
|
|
967
1045
|
}), this.emit("cx-asset-link-format-crop-change", {
|
|
968
1046
|
detail: {
|
|
969
|
-
height: this.unit ===
|
|
1047
|
+
height: this.unit === r.Pixel ? this.height : this.ratioHeight,
|
|
970
1048
|
keepAspectRatio: !this.keepAspectRatio,
|
|
971
1049
|
unit: this.unit,
|
|
972
|
-
width: this.unit ===
|
|
1050
|
+
width: this.unit === r.Pixel ? this.width : this.ratioWidth
|
|
973
1051
|
}
|
|
974
1052
|
});
|
|
975
1053
|
}
|
|
976
1054
|
render() {
|
|
977
1055
|
const t = this.cropModes.filter((i) => !i.auto), e = this.cropModes.filter((i) => i.auto);
|
|
978
|
-
return
|
|
1056
|
+
return C`<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="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small">${_(
|
|
979
1057
|
!this.noRatioModes,
|
|
980
|
-
() =>
|
|
1058
|
+
() => C`<cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${O({
|
|
981
1059
|
width: "100%"
|
|
982
1060
|
})} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${ot(
|
|
983
1061
|
t,
|
|
984
1062
|
(i) => i.value,
|
|
985
|
-
({ label: i, value: s }) =>
|
|
1063
|
+
({ label: i, value: s }) => C`<cx-option value=${s}>${i}</cx-option>`
|
|
986
1064
|
)}
|
|
987
|
-
${
|
|
1065
|
+
${_(
|
|
988
1066
|
e.length > 0,
|
|
989
|
-
() =>
|
|
1067
|
+
() => C`<cx-divider></cx-divider><small>${this.localize.term("autoCropping")}</small>`
|
|
990
1068
|
)}
|
|
991
1069
|
${ot(
|
|
992
1070
|
e,
|
|
993
1071
|
(i) => i.value,
|
|
994
|
-
({ label: i, value: s }) =>
|
|
1072
|
+
({ label: i, value: s }) => C`<cx-option value=${s}>${i}</cx-option>`
|
|
995
1073
|
)}</cx-select>`
|
|
996
|
-
)}<cx-space spacing="small"><div class="crop__input-group"><cx-input data-testid="cx-asset-link-format-crop-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit ===
|
|
1074
|
+
)}<cx-space spacing="small"><div class="crop__input-group"><cx-input data-testid="cx-asset-link-format-crop-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit === r.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">
|
|
997
1075
|
W
|
|
998
|
-
</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=${
|
|
1076
|
+
</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=${O({
|
|
999
1077
|
color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0
|
|
1000
|
-
})} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit ===
|
|
1078
|
+
})} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit === r.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">
|
|
1001
1079
|
H
|
|
1002
|
-
</cx-typography></cx-input></div>${
|
|
1080
|
+
</cx-typography></cx-input></div>${_(
|
|
1003
1081
|
!this.noRatioModes,
|
|
1004
|
-
() =>
|
|
1005
|
-
)}</cx-space>${
|
|
1082
|
+
() => C`<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=${r.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${r.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`
|
|
1083
|
+
)}</cx-space>${_(
|
|
1006
1084
|
this.focusModes.length > 0,
|
|
1007
|
-
() =>
|
|
1085
|
+
() => C`<cx-select data-testid="cx-asset-link-format-crop-focus-mode" value=${this.focusMode} hoist style=${O({
|
|
1008
1086
|
width: "100%"
|
|
1009
1087
|
})} @cx-change=${this.onFocusModeChange} ?disabled=${this.loading || this.selectedMode?.disabledSize}>${ot(
|
|
1010
1088
|
this.focusModes,
|
|
1011
1089
|
(i) => i.value,
|
|
1012
|
-
({ label: i, value: s }) =>
|
|
1090
|
+
({ label: i, value: s }) => C`<cx-option value=${s}>${i}</cx-option>`
|
|
1013
1091
|
)}</cx-select>`
|
|
1014
1092
|
)}
|
|
1015
|
-
${
|
|
1093
|
+
${_(
|
|
1016
1094
|
this.showPositionPicker && this.focusMode === "manual",
|
|
1017
|
-
() =>
|
|
1018
|
-
)}<cx-button data-testid="cx-asset-link-format-crop-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${
|
|
1095
|
+
() => C`<cx-position-picker data-testid="cx-asset-link-format-crop-position" value=${this.position} @cx-change=${this.onPositionChange}></cx-position-picker>`
|
|
1096
|
+
)}<cx-button data-testid="cx-asset-link-format-crop-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${O({
|
|
1019
1097
|
marginLeft: "auto"
|
|
1020
1098
|
})} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1021
1099
|
}
|
|
1022
1100
|
};
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
"cx-button":
|
|
1026
|
-
"cx-details":
|
|
1027
|
-
"cx-divider":
|
|
1028
|
-
"cx-icon":
|
|
1029
|
-
"cx-icon-button":
|
|
1030
|
-
"cx-input":
|
|
1031
|
-
"cx-option":
|
|
1032
|
-
"cx-position-picker":
|
|
1033
|
-
"cx-select":
|
|
1034
|
-
"cx-space":
|
|
1035
|
-
"cx-typography":
|
|
1101
|
+
v.styles = [G, Fe];
|
|
1102
|
+
v.dependencies = {
|
|
1103
|
+
"cx-button": Y,
|
|
1104
|
+
"cx-details": it,
|
|
1105
|
+
"cx-divider": qt,
|
|
1106
|
+
"cx-icon": st,
|
|
1107
|
+
"cx-icon-button": kt,
|
|
1108
|
+
"cx-input": Rt,
|
|
1109
|
+
"cx-option": xt,
|
|
1110
|
+
"cx-position-picker": oe,
|
|
1111
|
+
"cx-select": yt,
|
|
1112
|
+
"cx-space": U,
|
|
1113
|
+
"cx-typography": B
|
|
1036
1114
|
};
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
],
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
],
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
],
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
],
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
],
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
],
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
],
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
],
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
],
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
],
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
],
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
],
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
],
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
],
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
],
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
],
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
],
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
],
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
],
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
],
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
],
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
],
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
],
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
],
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
],
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
],
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
],
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
],
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
],
|
|
1127
|
-
const
|
|
1128
|
-
var
|
|
1129
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
1130
|
-
(n = t[
|
|
1131
|
-
return s && a &&
|
|
1115
|
+
z([
|
|
1116
|
+
J(".details")
|
|
1117
|
+
], v.prototype, "base", 2);
|
|
1118
|
+
z([
|
|
1119
|
+
J("cx-position-picker")
|
|
1120
|
+
], v.prototype, "positionPicker", 2);
|
|
1121
|
+
z([
|
|
1122
|
+
h({ reflect: !0, type: Boolean })
|
|
1123
|
+
], v.prototype, "open", 2);
|
|
1124
|
+
z([
|
|
1125
|
+
h({ reflect: !0, type: Number })
|
|
1126
|
+
], v.prototype, "width", 2);
|
|
1127
|
+
z([
|
|
1128
|
+
h({ reflect: !0, type: Number })
|
|
1129
|
+
], v.prototype, "height", 2);
|
|
1130
|
+
z([
|
|
1131
|
+
h({ attribute: "max-width", reflect: !0, type: Number })
|
|
1132
|
+
], v.prototype, "maxWidth", 2);
|
|
1133
|
+
z([
|
|
1134
|
+
h({ attribute: "max-height", reflect: !0, type: Number })
|
|
1135
|
+
], v.prototype, "maxHeight", 2);
|
|
1136
|
+
z([
|
|
1137
|
+
h({ attribute: "ratio-width", reflect: !0, type: Number })
|
|
1138
|
+
], v.prototype, "ratioWidth", 2);
|
|
1139
|
+
z([
|
|
1140
|
+
h({ attribute: "ratio-height", reflect: !0, type: Number })
|
|
1141
|
+
], v.prototype, "ratioHeight", 2);
|
|
1142
|
+
z([
|
|
1143
|
+
h({ attribute: "percentage-width", reflect: !0, type: Number })
|
|
1144
|
+
], v.prototype, "percentageWidth", 2);
|
|
1145
|
+
z([
|
|
1146
|
+
h({ attribute: "percentage-height", reflect: !0, type: Number })
|
|
1147
|
+
], v.prototype, "percentageHeight", 2);
|
|
1148
|
+
z([
|
|
1149
|
+
h({ reflect: !0, type: String })
|
|
1150
|
+
], v.prototype, "unit", 2);
|
|
1151
|
+
z([
|
|
1152
|
+
h({ attribute: "disabled-apply", reflect: !0, type: Boolean })
|
|
1153
|
+
], v.prototype, "disabledApply", 2);
|
|
1154
|
+
z([
|
|
1155
|
+
h({ attribute: "no-ratio-modes", reflect: !0, type: Boolean })
|
|
1156
|
+
], v.prototype, "noRatioModes", 2);
|
|
1157
|
+
z([
|
|
1158
|
+
h({ attribute: "show-position-picker", reflect: !0, type: Boolean })
|
|
1159
|
+
], v.prototype, "showPositionPicker", 2);
|
|
1160
|
+
z([
|
|
1161
|
+
h({ attribute: "last-applied-setting", reflect: !1, type: Object })
|
|
1162
|
+
], v.prototype, "lastAppliedSetting", 2);
|
|
1163
|
+
z([
|
|
1164
|
+
h({ reflect: !0, type: Boolean })
|
|
1165
|
+
], v.prototype, "loading", 2);
|
|
1166
|
+
z([
|
|
1167
|
+
h({ attribute: "crop-modes", reflect: !1, type: Array })
|
|
1168
|
+
], v.prototype, "cropModes", 2);
|
|
1169
|
+
z([
|
|
1170
|
+
h({ attribute: "focus-modes", reflect: !1, type: Object })
|
|
1171
|
+
], v.prototype, "focusModes", 2);
|
|
1172
|
+
z([
|
|
1173
|
+
h({ attribute: "focus-mode", reflect: !0, type: String })
|
|
1174
|
+
], v.prototype, "focusMode", 2);
|
|
1175
|
+
z([
|
|
1176
|
+
h({ attribute: "crop-mode", reflect: !0, type: String })
|
|
1177
|
+
], v.prototype, "cropMode", 2);
|
|
1178
|
+
z([
|
|
1179
|
+
h({ reflect: !0, type: String })
|
|
1180
|
+
], v.prototype, "position", 2);
|
|
1181
|
+
z([
|
|
1182
|
+
h({ attribute: "keep-aspect-ratio", reflect: !0, type: Boolean })
|
|
1183
|
+
], v.prototype, "keepAspectRatio", 2);
|
|
1184
|
+
z([
|
|
1185
|
+
b()
|
|
1186
|
+
], v.prototype, "invalidWidth", 2);
|
|
1187
|
+
z([
|
|
1188
|
+
b()
|
|
1189
|
+
], v.prototype, "invalidHeight", 2);
|
|
1190
|
+
z([
|
|
1191
|
+
b()
|
|
1192
|
+
], v.prototype, "aspectRatio", 2);
|
|
1193
|
+
z([
|
|
1194
|
+
P("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
1195
|
+
P("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
1196
|
+
P("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
1197
|
+
P("keepAspectRatio")
|
|
1198
|
+
], v.prototype, "handleCropModeChange", 1);
|
|
1199
|
+
z([
|
|
1200
|
+
P("open", { waitUntilFirstUpdate: !0 })
|
|
1201
|
+
], v.prototype, "handleOpenChange", 1);
|
|
1202
|
+
v = z([
|
|
1203
|
+
Q("cx-asset-link-format-crop")
|
|
1204
|
+
], v);
|
|
1205
|
+
const Ie = j`.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%}}`;
|
|
1206
|
+
var Ee = Object.defineProperty, He = Object.getOwnPropertyDescriptor, Pt = (t, e, i, s) => {
|
|
1207
|
+
for (var a = s > 1 ? void 0 : s ? He(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1208
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
1209
|
+
return s && a && Ee(e, i, a), a;
|
|
1132
1210
|
};
|
|
1133
|
-
let
|
|
1211
|
+
let Z = class extends q {
|
|
1134
1212
|
constructor() {
|
|
1135
|
-
super(...arguments), this.localize = new
|
|
1213
|
+
super(...arguments), this.localize = new V(this), this.value = "", this.items = [];
|
|
1136
1214
|
}
|
|
1137
1215
|
handleExtensionChange(t) {
|
|
1138
1216
|
const e = t.target.value;
|
|
@@ -1141,44 +1219,52 @@ let K = class extends B {
|
|
|
1141
1219
|
});
|
|
1142
1220
|
}
|
|
1143
1221
|
render() {
|
|
1144
|
-
return
|
|
1222
|
+
return C`<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}>${ot(
|
|
1145
1223
|
this.items,
|
|
1146
1224
|
(t) => t.value,
|
|
1147
|
-
(t) =>
|
|
1225
|
+
(t) => C`<cx-option value=${t.value}>${t.displayName}</cx-option>`
|
|
1148
1226
|
)}</cx-select></cx-space>`;
|
|
1149
1227
|
}
|
|
1150
1228
|
};
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
"cx-option":
|
|
1154
|
-
"cx-select":
|
|
1155
|
-
"cx-space":
|
|
1156
|
-
"cx-typography":
|
|
1229
|
+
Z.styles = [G, Ie];
|
|
1230
|
+
Z.dependencies = {
|
|
1231
|
+
"cx-option": xt,
|
|
1232
|
+
"cx-select": yt,
|
|
1233
|
+
"cx-space": U,
|
|
1234
|
+
"cx-typography": B
|
|
1157
1235
|
};
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
],
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
],
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
],
|
|
1167
|
-
const
|
|
1168
|
-
var
|
|
1169
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
1170
|
-
(n = t[
|
|
1171
|
-
return s && a &&
|
|
1236
|
+
Pt([
|
|
1237
|
+
h({ reflect: !0, type: String })
|
|
1238
|
+
], Z.prototype, "value", 2);
|
|
1239
|
+
Pt([
|
|
1240
|
+
h({ reflect: !1, type: Array })
|
|
1241
|
+
], Z.prototype, "items", 2);
|
|
1242
|
+
Z = Pt([
|
|
1243
|
+
Q("cx-asset-link-format-extension")
|
|
1244
|
+
], Z);
|
|
1245
|
+
const Te = j`cx-details::part(base){border-bottom-width:0}`;
|
|
1246
|
+
var We = Object.defineProperty, De = Object.getOwnPropertyDescriptor, W = (t, e, i, s) => {
|
|
1247
|
+
for (var a = s > 1 ? void 0 : s ? De(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1248
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
1249
|
+
return s && a && We(e, i, a), a;
|
|
1172
1250
|
};
|
|
1173
|
-
|
|
1251
|
+
const zt = "auto";
|
|
1252
|
+
let M = class extends q {
|
|
1174
1253
|
constructor() {
|
|
1175
|
-
super(...arguments), this.localize = new
|
|
1254
|
+
super(...arguments), this.localize = new V(this), this.open = !1, this.value = "", this.items = [], this.canAutoFormat = !1, this.autoFormat = !1, this.loading = !1, this.scopedValue = "";
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* The listbox value that represents the committed choice: the `Auto` entry when that is
|
|
1258
|
+
* active, otherwise the resolved proxy id.
|
|
1259
|
+
*/
|
|
1260
|
+
get committedValue() {
|
|
1261
|
+
return this.autoFormat ? zt : this.value;
|
|
1176
1262
|
}
|
|
1177
1263
|
handleValueChange() {
|
|
1178
|
-
this.scopedValue = this.
|
|
1264
|
+
this.scopedValue = this.committedValue;
|
|
1179
1265
|
}
|
|
1180
1266
|
handleOpenChange() {
|
|
1181
|
-
this.open || (this.scopedValue = this.
|
|
1267
|
+
this.open || (this.scopedValue = this.committedValue);
|
|
1182
1268
|
}
|
|
1183
1269
|
handleProxyChange(t) {
|
|
1184
1270
|
const e = t.target.value;
|
|
@@ -1192,11 +1278,17 @@ let E = class extends B {
|
|
|
1192
1278
|
handleApply() {
|
|
1193
1279
|
if (this.loading)
|
|
1194
1280
|
return;
|
|
1195
|
-
|
|
1196
|
-
(
|
|
1281
|
+
if (this.scopedValue === zt) {
|
|
1282
|
+
this.emit("cx-asset-link-format-proxy-change", {
|
|
1283
|
+
detail: { autoFormat: !0 }
|
|
1284
|
+
});
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
const e = this.items.find(
|
|
1288
|
+
(i) => i.id === this.scopedValue
|
|
1197
1289
|
);
|
|
1198
|
-
|
|
1199
|
-
detail:
|
|
1290
|
+
e && this.emit("cx-asset-link-format-proxy-change", {
|
|
1291
|
+
detail: { ...e, autoFormat: !1 }
|
|
1200
1292
|
});
|
|
1201
1293
|
}
|
|
1202
1294
|
/**
|
|
@@ -1216,61 +1308,74 @@ let E = class extends B {
|
|
|
1216
1308
|
t.target !== this.base && t.stopPropagation();
|
|
1217
1309
|
}
|
|
1218
1310
|
render() {
|
|
1219
|
-
return
|
|
1311
|
+
return C`<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}>${ot(
|
|
1220
1312
|
this.items,
|
|
1221
1313
|
(t) => t.id,
|
|
1222
|
-
(t) =>
|
|
1223
|
-
)}
|
|
1314
|
+
(t) => C`<cx-option value=${t.id}>${t.proxyLabel}</cx-option>`
|
|
1315
|
+
)}
|
|
1316
|
+
${_(
|
|
1317
|
+
this.canAutoFormat,
|
|
1318
|
+
() => C`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${zt}>${this.localize.term("auto")}</cx-option>`,
|
|
1319
|
+
() => Ut
|
|
1320
|
+
)}</cx-select><cx-button data-testid="cx-asset-link-format-proxy-apply" variant="primary" style=${O({
|
|
1224
1321
|
"margin-left": "auto"
|
|
1225
|
-
})} ?disabled=${this.scopedValue === this.
|
|
1322
|
+
})} ?disabled=${this.scopedValue === this.committedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1226
1323
|
}
|
|
1227
1324
|
};
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
"cx-button":
|
|
1231
|
-
"cx-details":
|
|
1232
|
-
"cx-
|
|
1233
|
-
"cx-
|
|
1234
|
-
"cx-
|
|
1235
|
-
"cx-
|
|
1236
|
-
"cx-
|
|
1325
|
+
M.styles = [G, Te];
|
|
1326
|
+
M.dependencies = {
|
|
1327
|
+
"cx-button": Y,
|
|
1328
|
+
"cx-details": it,
|
|
1329
|
+
"cx-divider": qt,
|
|
1330
|
+
"cx-icon": st,
|
|
1331
|
+
"cx-option": xt,
|
|
1332
|
+
"cx-select": yt,
|
|
1333
|
+
"cx-space": U,
|
|
1334
|
+
"cx-typography": B
|
|
1237
1335
|
};
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
],
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
],
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
],
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
],
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
],
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
],
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
],
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
],
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1336
|
+
W([
|
|
1337
|
+
J(".details")
|
|
1338
|
+
], M.prototype, "base", 2);
|
|
1339
|
+
W([
|
|
1340
|
+
h({ reflect: !0, type: Boolean })
|
|
1341
|
+
], M.prototype, "open", 2);
|
|
1342
|
+
W([
|
|
1343
|
+
h({ reflect: !0, type: String })
|
|
1344
|
+
], M.prototype, "value", 2);
|
|
1345
|
+
W([
|
|
1346
|
+
h({ reflect: !1, type: Array })
|
|
1347
|
+
], M.prototype, "items", 2);
|
|
1348
|
+
W([
|
|
1349
|
+
h({ attribute: "can-auto-format", reflect: !0, type: Boolean })
|
|
1350
|
+
], M.prototype, "canAutoFormat", 2);
|
|
1351
|
+
W([
|
|
1352
|
+
h({ attribute: "auto-format", reflect: !0, type: Boolean })
|
|
1353
|
+
], M.prototype, "autoFormat", 2);
|
|
1354
|
+
W([
|
|
1355
|
+
h({ reflect: !0, type: Boolean })
|
|
1356
|
+
], M.prototype, "loading", 2);
|
|
1357
|
+
W([
|
|
1358
|
+
b()
|
|
1359
|
+
], M.prototype, "scopedValue", 2);
|
|
1360
|
+
W([
|
|
1361
|
+
P("autoFormat"),
|
|
1362
|
+
P("value")
|
|
1363
|
+
], M.prototype, "handleValueChange", 1);
|
|
1364
|
+
W([
|
|
1365
|
+
P("open", { waitUntilFirstUpdate: !0 })
|
|
1366
|
+
], M.prototype, "handleOpenChange", 1);
|
|
1367
|
+
M = W([
|
|
1368
|
+
Q("cx-asset-link-format-proxy")
|
|
1369
|
+
], M);
|
|
1370
|
+
const Ne = j`cx-details::part(base){border-bottom-width:0}`;
|
|
1371
|
+
var Oe = Object.defineProperty, Le = Object.getOwnPropertyDescriptor, tt = (t, e, i, s) => {
|
|
1372
|
+
for (var a = s > 1 ? void 0 : s ? Le(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1373
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
1374
|
+
return s && a && Oe(e, i, a), a;
|
|
1270
1375
|
};
|
|
1271
|
-
let T = class extends
|
|
1376
|
+
let T = class extends q {
|
|
1272
1377
|
constructor() {
|
|
1273
|
-
super(...arguments), this.localize = new
|
|
1378
|
+
super(...arguments), this.localize = new V(this), this.open = !1, this.value = 100, this.loading = !1, this.scopedValue = 100;
|
|
1274
1379
|
}
|
|
1275
1380
|
/**
|
|
1276
1381
|
* A computed property that checks if the current quality value is invalid.
|
|
@@ -1314,53 +1419,53 @@ let T = class extends B {
|
|
|
1314
1419
|
t.target !== this.base && t.stopPropagation();
|
|
1315
1420
|
}
|
|
1316
1421
|
render() {
|
|
1317
|
-
return
|
|
1422
|
+
return C`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="blur_on"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("quality")}</cx-typography></cx-space><cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-quality-tooltip" content=${this.localize.term("qualityHelpText")} hoist><cx-input data-testid="cx-asset-link-format-quality" class="details__checkbox" mask="num" .maskBlocks=${{ num: { mask: Number, max: 100, min: 1 } }} value=${this.scopedValue.toString()} style=${O({
|
|
1318
1423
|
flex: "1"
|
|
1319
1424
|
})} @cx-input=${this.handleQualityChange}></cx-input></cx-tooltip><cx-button data-testid="cx-asset-link-format-quality-apply" variant="primary" ?disabled=${this.invalidValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1320
1425
|
}
|
|
1321
1426
|
};
|
|
1322
|
-
T.styles = [
|
|
1427
|
+
T.styles = [G, Ne];
|
|
1323
1428
|
T.dependencies = {
|
|
1324
|
-
"cx-button":
|
|
1325
|
-
"cx-details":
|
|
1326
|
-
"cx-icon":
|
|
1327
|
-
"cx-input":
|
|
1328
|
-
"cx-space":
|
|
1329
|
-
"cx-tooltip":
|
|
1330
|
-
"cx-typography":
|
|
1429
|
+
"cx-button": Y,
|
|
1430
|
+
"cx-details": it,
|
|
1431
|
+
"cx-icon": st,
|
|
1432
|
+
"cx-input": Rt,
|
|
1433
|
+
"cx-space": U,
|
|
1434
|
+
"cx-tooltip": jt,
|
|
1435
|
+
"cx-typography": B
|
|
1331
1436
|
};
|
|
1332
|
-
|
|
1333
|
-
|
|
1437
|
+
tt([
|
|
1438
|
+
J(".details")
|
|
1334
1439
|
], T.prototype, "base", 2);
|
|
1335
|
-
|
|
1336
|
-
|
|
1440
|
+
tt([
|
|
1441
|
+
h({ reflect: !0, type: Boolean })
|
|
1337
1442
|
], T.prototype, "open", 2);
|
|
1338
|
-
|
|
1339
|
-
|
|
1443
|
+
tt([
|
|
1444
|
+
h({ reflect: !0, type: Number })
|
|
1340
1445
|
], T.prototype, "value", 2);
|
|
1341
|
-
|
|
1342
|
-
|
|
1446
|
+
tt([
|
|
1447
|
+
h({ reflect: !0, type: Boolean })
|
|
1343
1448
|
], T.prototype, "loading", 2);
|
|
1344
|
-
|
|
1345
|
-
|
|
1449
|
+
tt([
|
|
1450
|
+
b()
|
|
1346
1451
|
], T.prototype, "scopedValue", 2);
|
|
1347
|
-
|
|
1348
|
-
|
|
1452
|
+
tt([
|
|
1453
|
+
P("value")
|
|
1349
1454
|
], T.prototype, "handleValueChange", 1);
|
|
1350
|
-
T =
|
|
1351
|
-
|
|
1455
|
+
T = tt([
|
|
1456
|
+
Q("cx-asset-link-format-quality")
|
|
1352
1457
|
], T);
|
|
1353
|
-
const
|
|
1354
|
-
var
|
|
1355
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
1356
|
-
(n = t[
|
|
1357
|
-
return s && a &&
|
|
1458
|
+
const Ue = j`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}`;
|
|
1459
|
+
var Be = Object.defineProperty, qe = Object.getOwnPropertyDescriptor, $ = (t, e, i, s) => {
|
|
1460
|
+
for (var a = s > 1 ? void 0 : s ? qe(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1461
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
1462
|
+
return s && a && Be(e, i, a), a;
|
|
1358
1463
|
};
|
|
1359
|
-
let
|
|
1464
|
+
let w = class extends q {
|
|
1360
1465
|
constructor() {
|
|
1361
|
-
super(...arguments), this.localize = new
|
|
1362
|
-
[
|
|
1363
|
-
[
|
|
1466
|
+
super(...arguments), this.localize = new V(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit = r.Pixel, this.lastAppliedSetting = {
|
|
1467
|
+
[r.Pixel]: { height: 0, width: 0 },
|
|
1468
|
+
[r.AspectRatio]: { height: 1, width: 1 }
|
|
1364
1469
|
}, this.loading = !1, this.noRatioModes = !1, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
1365
1470
|
}
|
|
1366
1471
|
/**
|
|
@@ -1374,11 +1479,11 @@ let v = class extends B {
|
|
|
1374
1479
|
async handleCropModeChange() {
|
|
1375
1480
|
const t = Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && this.maxWidth > 0 && this.maxHeight > 0;
|
|
1376
1481
|
if (this.keepAspectRatio) {
|
|
1377
|
-
if (this.unit ===
|
|
1482
|
+
if (this.unit === r.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
1378
1483
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
1379
1484
|
return;
|
|
1380
1485
|
}
|
|
1381
|
-
if (this.unit ===
|
|
1486
|
+
if (this.unit === r.Pixel && !t && this.width && this.height) {
|
|
1382
1487
|
this.aspectRatio = this.width / this.height;
|
|
1383
1488
|
return;
|
|
1384
1489
|
}
|
|
@@ -1409,8 +1514,8 @@ let v = class extends B {
|
|
|
1409
1514
|
}
|
|
1410
1515
|
this.invalidWidth = !1;
|
|
1411
1516
|
let e = Number(t.target.value);
|
|
1412
|
-
this.unit ===
|
|
1413
|
-
let i = this.unit ===
|
|
1517
|
+
this.unit === r.Pixel && (e = Math.max(Math.min(e, this.maxWidth), 1)), t.target.value = e.toString();
|
|
1518
|
+
let i = this.unit === r.Pixel ? this.height : this.ratioHeight;
|
|
1414
1519
|
this.keepAspectRatio && (i = Math.min(
|
|
1415
1520
|
Math.round(e / this.aspectRatio),
|
|
1416
1521
|
this.maxHeight
|
|
@@ -1430,8 +1535,8 @@ let v = class extends B {
|
|
|
1430
1535
|
}
|
|
1431
1536
|
this.invalidHeight = !1;
|
|
1432
1537
|
let e = Number(t.target.value);
|
|
1433
|
-
this.unit ===
|
|
1434
|
-
let i = this.unit ===
|
|
1538
|
+
this.unit === r.Pixel && (e = Math.max(Math.min(e, this.maxHeight), 1)), t.target.value = e.toString();
|
|
1539
|
+
let i = this.unit === r.Pixel ? this.width : this.ratioWidth;
|
|
1435
1540
|
this.keepAspectRatio && (i = Math.min(
|
|
1436
1541
|
Math.round(e * this.aspectRatio),
|
|
1437
1542
|
this.maxWidth
|
|
@@ -1445,19 +1550,19 @@ let v = class extends B {
|
|
|
1445
1550
|
});
|
|
1446
1551
|
}
|
|
1447
1552
|
onUnitChange(t) {
|
|
1448
|
-
t.target.value ===
|
|
1553
|
+
t.target.value === r.AspectRatio ? this.emit("cx-asset-link-format-resize-change", {
|
|
1449
1554
|
detail: {
|
|
1450
|
-
height: this.lastAppliedSetting[
|
|
1555
|
+
height: this.lastAppliedSetting[r.AspectRatio].height,
|
|
1451
1556
|
keepAspectRatio: this.keepAspectRatio,
|
|
1452
|
-
unit:
|
|
1453
|
-
width: this.lastAppliedSetting[
|
|
1557
|
+
unit: r.AspectRatio,
|
|
1558
|
+
width: this.lastAppliedSetting[r.AspectRatio].width
|
|
1454
1559
|
}
|
|
1455
1560
|
}) : this.emit("cx-asset-link-format-resize-change", {
|
|
1456
1561
|
detail: {
|
|
1457
|
-
height: this.lastAppliedSetting[
|
|
1562
|
+
height: this.lastAppliedSetting[r.Pixel].height,
|
|
1458
1563
|
keepAspectRatio: this.keepAspectRatio,
|
|
1459
|
-
unit:
|
|
1460
|
-
width: this.lastAppliedSetting[
|
|
1564
|
+
unit: r.Pixel,
|
|
1565
|
+
width: this.lastAppliedSetting[r.Pixel].width
|
|
1461
1566
|
}
|
|
1462
1567
|
});
|
|
1463
1568
|
}
|
|
@@ -1489,109 +1594,109 @@ let v = class extends B {
|
|
|
1489
1594
|
handleAspectRatioClick() {
|
|
1490
1595
|
this.emit("cx-asset-link-format-resize-change", {
|
|
1491
1596
|
detail: {
|
|
1492
|
-
height: this.unit ===
|
|
1597
|
+
height: this.unit === r.Pixel ? this.height : this.ratioHeight,
|
|
1493
1598
|
keepAspectRatio: !this.keepAspectRatio,
|
|
1494
1599
|
unit: this.unit,
|
|
1495
|
-
width: this.unit ===
|
|
1600
|
+
width: this.unit === r.Pixel ? this.width : this.ratioWidth
|
|
1496
1601
|
}
|
|
1497
1602
|
});
|
|
1498
1603
|
}
|
|
1499
1604
|
render() {
|
|
1500
|
-
return
|
|
1605
|
+
return C`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="aspect_ratio"></cx-icon></div><cx-typography variant="body2">${this.localize.term("resize")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small"><cx-space spacing="small"><div class="resize__input-group"><cx-input data-testid="cx-asset-link-format-resize-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit === r.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1501
1606
|
W
|
|
1502
|
-
</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=${
|
|
1607
|
+
</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=${O({
|
|
1503
1608
|
color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0
|
|
1504
|
-
})} ?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: { mask: Number, min: 1 } }} value=${this.unit ===
|
|
1609
|
+
})} ?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: { mask: Number, min: 1 } }} value=${this.unit === r.Pixel ? this.height.toString() : this.ratioHeight.toString()} @cx-input=${this.handleHeightChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1505
1610
|
H
|
|
1506
|
-
</cx-typography></cx-input></div>${
|
|
1611
|
+
</cx-typography></cx-input></div>${_(
|
|
1507
1612
|
!this.noRatioModes,
|
|
1508
|
-
() =>
|
|
1509
|
-
)}</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=${
|
|
1613
|
+
() => C`<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=${r.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${r.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`
|
|
1614
|
+
)}</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=${O({
|
|
1510
1615
|
marginLeft: "auto"
|
|
1511
1616
|
})} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1512
1617
|
}
|
|
1513
1618
|
};
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
"cx-button":
|
|
1517
|
-
"cx-details":
|
|
1518
|
-
"cx-icon":
|
|
1519
|
-
"cx-icon-button":
|
|
1520
|
-
"cx-input":
|
|
1521
|
-
"cx-option":
|
|
1522
|
-
"cx-select":
|
|
1523
|
-
"cx-space":
|
|
1524
|
-
"cx-typography":
|
|
1619
|
+
w.styles = [G, Ue];
|
|
1620
|
+
w.dependencies = {
|
|
1621
|
+
"cx-button": Y,
|
|
1622
|
+
"cx-details": it,
|
|
1623
|
+
"cx-icon": st,
|
|
1624
|
+
"cx-icon-button": kt,
|
|
1625
|
+
"cx-input": Rt,
|
|
1626
|
+
"cx-option": xt,
|
|
1627
|
+
"cx-select": yt,
|
|
1628
|
+
"cx-space": U,
|
|
1629
|
+
"cx-typography": B
|
|
1525
1630
|
};
|
|
1526
1631
|
$([
|
|
1527
|
-
|
|
1528
|
-
],
|
|
1632
|
+
J(".details")
|
|
1633
|
+
], w.prototype, "base", 2);
|
|
1529
1634
|
$([
|
|
1530
|
-
|
|
1531
|
-
],
|
|
1635
|
+
h({ reflect: !0, type: Boolean })
|
|
1636
|
+
], w.prototype, "open", 2);
|
|
1532
1637
|
$([
|
|
1533
|
-
|
|
1534
|
-
],
|
|
1638
|
+
h({ reflect: !0, type: Number })
|
|
1639
|
+
], w.prototype, "width", 2);
|
|
1535
1640
|
$([
|
|
1536
|
-
|
|
1537
|
-
],
|
|
1641
|
+
h({ reflect: !0, type: Number })
|
|
1642
|
+
], w.prototype, "height", 2);
|
|
1538
1643
|
$([
|
|
1539
|
-
|
|
1540
|
-
],
|
|
1644
|
+
h({ attribute: "max-width", reflect: !0, type: Number })
|
|
1645
|
+
], w.prototype, "maxWidth", 2);
|
|
1541
1646
|
$([
|
|
1542
|
-
|
|
1543
|
-
],
|
|
1647
|
+
h({ attribute: "max-height", reflect: !0, type: Number })
|
|
1648
|
+
], w.prototype, "maxHeight", 2);
|
|
1544
1649
|
$([
|
|
1545
|
-
|
|
1546
|
-
],
|
|
1650
|
+
h({ attribute: "ratio-width", reflect: !0, type: Number })
|
|
1651
|
+
], w.prototype, "ratioWidth", 2);
|
|
1547
1652
|
$([
|
|
1548
|
-
|
|
1549
|
-
],
|
|
1653
|
+
h({ attribute: "ratio-height", reflect: !0, type: Number })
|
|
1654
|
+
], w.prototype, "ratioHeight", 2);
|
|
1550
1655
|
$([
|
|
1551
|
-
|
|
1552
|
-
],
|
|
1656
|
+
h({ reflect: !0, type: String })
|
|
1657
|
+
], w.prototype, "unit", 2);
|
|
1553
1658
|
$([
|
|
1554
|
-
|
|
1555
|
-
],
|
|
1659
|
+
h({ attribute: "last-applied-setting", reflect: !1, type: Object })
|
|
1660
|
+
], w.prototype, "lastAppliedSetting", 2);
|
|
1556
1661
|
$([
|
|
1557
|
-
|
|
1558
|
-
],
|
|
1662
|
+
h({ reflect: !0, type: Boolean })
|
|
1663
|
+
], w.prototype, "loading", 2);
|
|
1559
1664
|
$([
|
|
1560
|
-
|
|
1561
|
-
],
|
|
1665
|
+
h({ attribute: "no-ratio-modes", reflect: !0, type: Boolean })
|
|
1666
|
+
], w.prototype, "noRatioModes", 2);
|
|
1562
1667
|
$([
|
|
1563
|
-
|
|
1564
|
-
],
|
|
1668
|
+
h({ attribute: "keep-aspect-ratio", reflect: !0, type: Boolean })
|
|
1669
|
+
], w.prototype, "keepAspectRatio", 2);
|
|
1565
1670
|
$([
|
|
1566
|
-
|
|
1567
|
-
],
|
|
1671
|
+
b()
|
|
1672
|
+
], w.prototype, "invalidWidth", 2);
|
|
1568
1673
|
$([
|
|
1569
|
-
|
|
1570
|
-
],
|
|
1674
|
+
b()
|
|
1675
|
+
], w.prototype, "invalidHeight", 2);
|
|
1571
1676
|
$([
|
|
1572
|
-
|
|
1573
|
-
],
|
|
1677
|
+
b()
|
|
1678
|
+
], w.prototype, "aspectRatio", 2);
|
|
1574
1679
|
$([
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
],
|
|
1680
|
+
P("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
1681
|
+
P("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
1682
|
+
P("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
1683
|
+
P("keepAspectRatio")
|
|
1684
|
+
], w.prototype, "handleCropModeChange", 1);
|
|
1580
1685
|
$([
|
|
1581
|
-
|
|
1582
|
-
],
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
],
|
|
1586
|
-
const
|
|
1587
|
-
var
|
|
1588
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
1589
|
-
(n = t[
|
|
1590
|
-
return s && a &&
|
|
1686
|
+
P("open", { waitUntilFirstUpdate: !0 })
|
|
1687
|
+
], w.prototype, "handleOpenChange", 1);
|
|
1688
|
+
w = $([
|
|
1689
|
+
Q("cx-asset-link-format-resize")
|
|
1690
|
+
], w);
|
|
1691
|
+
const je = j`cx-details::part(base){border-bottom-width:0}`;
|
|
1692
|
+
var Ve = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, X = (t, e, i, s) => {
|
|
1693
|
+
for (var a = s > 1 ? void 0 : s ? Ge(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1694
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
1695
|
+
return s && a && Ve(e, i, a), a;
|
|
1591
1696
|
};
|
|
1592
|
-
let H = class extends
|
|
1697
|
+
let H = class extends q {
|
|
1593
1698
|
constructor() {
|
|
1594
|
-
super(...arguments), this.localize = new
|
|
1699
|
+
super(...arguments), this.localize = new V(this), this.open = !1, this.value = 0, this.defaultValue = 0, this.loading = !1, this.lastAppliedValue = 0;
|
|
1595
1700
|
}
|
|
1596
1701
|
handleOpenChange() {
|
|
1597
1702
|
this.open || this.emit("cx-asset-link-format-rotation-change", {
|
|
@@ -1602,14 +1707,14 @@ let H = class extends B {
|
|
|
1602
1707
|
const e = t.target.value, i = Number(e);
|
|
1603
1708
|
if (Number.isNaN(i))
|
|
1604
1709
|
return;
|
|
1605
|
-
const s =
|
|
1710
|
+
const s = It(i);
|
|
1606
1711
|
(i > 360 || i < -360) && (t.target.value = s.toString()), this.emit("cx-asset-link-format-rotation-change", {
|
|
1607
1712
|
detail: s
|
|
1608
1713
|
});
|
|
1609
1714
|
}
|
|
1610
1715
|
handleButtonClick(t) {
|
|
1611
1716
|
this.emit("cx-asset-link-format-rotation-change", {
|
|
1612
|
-
detail:
|
|
1717
|
+
detail: It(t)
|
|
1613
1718
|
});
|
|
1614
1719
|
}
|
|
1615
1720
|
handleClockwiseClick() {
|
|
@@ -1629,55 +1734,55 @@ let H = class extends B {
|
|
|
1629
1734
|
});
|
|
1630
1735
|
}
|
|
1631
1736
|
render() {
|
|
1632
|
-
return
|
|
1737
|
+
return C`<cx-details class="details" ?open=${this.open}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="rotate_90_degrees_cw"></cx-icon></div><cx-typography variant="body2">Rotate</cx-typography></cx-space><cx-space spacing="small"><cx-button-group label=${this.localize.term("history")}><cx-icon-button data-testid="cx-asset-link-format-rotation-ccw" name="rotate_90_degrees_ccw" label=${this.localize.term("undo")} outline size="small" ?disabled=${this.loading || this.value === -360} @click=${this.handleCounterClockwiseClick}></cx-icon-button><cx-icon-button data-testid="cx-asset-link-format-rotation-cw" name="rotate_90_degrees_cw" label=${this.localize.term("redo")} outline size="small" ?disabled=${this.loading || this.value === 360} @click=${this.handleClockwiseClick}></cx-icon-button></cx-button-group><cx-input data-testid="cx-asset-link-format-rotation" value=${(this.value + this.defaultValue).toString()} placeholder="0" mask="num" .maskBlocks=${{ num: { mask: Number, max: 360, min: -360, signed: !0 } }} ?disabled=${this.loading} style=${O({
|
|
1633
1738
|
flex: "none",
|
|
1634
1739
|
width: "80px"
|
|
1635
1740
|
})} @cx-input=${this.handleRotationChange}></cx-input><cx-button data-testid="cx-asset-link-format-rotation-apply" variant="primary" ?disabled=${this.value === this.lastAppliedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1636
1741
|
}
|
|
1637
1742
|
};
|
|
1638
|
-
H.styles = [
|
|
1743
|
+
H.styles = [G, je];
|
|
1639
1744
|
H.dependencies = {
|
|
1640
|
-
"cx-button":
|
|
1641
|
-
"cx-button-group":
|
|
1642
|
-
"cx-details":
|
|
1643
|
-
"cx-icon":
|
|
1644
|
-
"cx-icon-button":
|
|
1645
|
-
"cx-space":
|
|
1646
|
-
"cx-typography":
|
|
1745
|
+
"cx-button": Y,
|
|
1746
|
+
"cx-button-group": ne,
|
|
1747
|
+
"cx-details": it,
|
|
1748
|
+
"cx-icon": st,
|
|
1749
|
+
"cx-icon-button": kt,
|
|
1750
|
+
"cx-space": U,
|
|
1751
|
+
"cx-typography": B
|
|
1647
1752
|
};
|
|
1648
|
-
|
|
1649
|
-
|
|
1753
|
+
X([
|
|
1754
|
+
J(".details")
|
|
1650
1755
|
], H.prototype, "base", 2);
|
|
1651
|
-
|
|
1652
|
-
|
|
1756
|
+
X([
|
|
1757
|
+
h({ reflect: !0, type: Boolean })
|
|
1653
1758
|
], H.prototype, "open", 2);
|
|
1654
|
-
|
|
1655
|
-
|
|
1759
|
+
X([
|
|
1760
|
+
h({ reflect: !0, type: Number })
|
|
1656
1761
|
], H.prototype, "value", 2);
|
|
1657
|
-
|
|
1658
|
-
|
|
1762
|
+
X([
|
|
1763
|
+
h({ attribute: "default-value", reflect: !0, type: Number })
|
|
1659
1764
|
], H.prototype, "defaultValue", 2);
|
|
1660
|
-
|
|
1661
|
-
|
|
1765
|
+
X([
|
|
1766
|
+
h({ reflect: !0, type: Boolean })
|
|
1662
1767
|
], H.prototype, "loading", 2);
|
|
1663
|
-
|
|
1664
|
-
|
|
1768
|
+
X([
|
|
1769
|
+
h({ attribute: "last-applied-value", reflect: !0, type: Number })
|
|
1665
1770
|
], H.prototype, "lastAppliedValue", 2);
|
|
1666
|
-
|
|
1667
|
-
|
|
1771
|
+
X([
|
|
1772
|
+
P("open", { waitUntilFirstUpdate: !0 })
|
|
1668
1773
|
], H.prototype, "handleOpenChange", 1);
|
|
1669
|
-
H =
|
|
1670
|
-
|
|
1774
|
+
H = X([
|
|
1775
|
+
Q("cx-asset-link-format-rotation")
|
|
1671
1776
|
], H);
|
|
1672
|
-
const
|
|
1673
|
-
var
|
|
1674
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
1675
|
-
(n = t[
|
|
1676
|
-
return s && a &&
|
|
1777
|
+
const Qe = j`cx-details::part(base){border-bottom-width:0}`;
|
|
1778
|
+
var Xe = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, St = (t, e, i, s) => {
|
|
1779
|
+
for (var a = s > 1 ? void 0 : s ? Ke(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1780
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
1781
|
+
return s && a && Xe(e, i, a), a;
|
|
1677
1782
|
};
|
|
1678
|
-
let
|
|
1783
|
+
let L = class extends q {
|
|
1679
1784
|
constructor() {
|
|
1680
|
-
super(...arguments), this.localize = new
|
|
1785
|
+
super(...arguments), this.localize = new V(this), this.open = !1, this.value = !1;
|
|
1681
1786
|
}
|
|
1682
1787
|
handleApply(t) {
|
|
1683
1788
|
this.emit("cx-asset-link-format-metadata-change", {
|
|
@@ -1701,39 +1806,39 @@ let O = class extends B {
|
|
|
1701
1806
|
t.target !== this.base && t.stopPropagation();
|
|
1702
1807
|
}
|
|
1703
1808
|
render() {
|
|
1704
|
-
return
|
|
1809
|
+
return C`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="short_text"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("metadata")}</cx-typography></cx-space><cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-metadata-tooltip" content=${this.localize.term("metadataHelpText")} hoist><cx-checkbox data-testid="cx-asset-link-format-metadata" class="details__checkbox" ?checked=${this.value} @cx-change=${this.handleApply}>${this.localize.term("preserveMetadata")}</cx-checkbox></cx-tooltip></cx-space></cx-details>`;
|
|
1705
1810
|
}
|
|
1706
1811
|
};
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
"cx-button":
|
|
1710
|
-
"cx-checkbox":
|
|
1711
|
-
"cx-details":
|
|
1712
|
-
"cx-icon":
|
|
1713
|
-
"cx-space":
|
|
1714
|
-
"cx-tooltip":
|
|
1715
|
-
"cx-typography":
|
|
1812
|
+
L.styles = [G, Qe];
|
|
1813
|
+
L.dependencies = {
|
|
1814
|
+
"cx-button": Y,
|
|
1815
|
+
"cx-checkbox": he,
|
|
1816
|
+
"cx-details": it,
|
|
1817
|
+
"cx-icon": st,
|
|
1818
|
+
"cx-space": U,
|
|
1819
|
+
"cx-tooltip": jt,
|
|
1820
|
+
"cx-typography": B
|
|
1716
1821
|
};
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
],
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
],
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
],
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
],
|
|
1729
|
-
var
|
|
1730
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
1731
|
-
(n = t[
|
|
1732
|
-
return s && a &&
|
|
1822
|
+
St([
|
|
1823
|
+
J(".details")
|
|
1824
|
+
], L.prototype, "base", 2);
|
|
1825
|
+
St([
|
|
1826
|
+
h({ reflect: !0, type: Boolean })
|
|
1827
|
+
], L.prototype, "open", 2);
|
|
1828
|
+
St([
|
|
1829
|
+
h({ reflect: !0, type: Boolean })
|
|
1830
|
+
], L.prototype, "value", 2);
|
|
1831
|
+
L = St([
|
|
1832
|
+
Q("cx-asset-link-format-metadata")
|
|
1833
|
+
], L);
|
|
1834
|
+
var Ze = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, x = (t, e, i, s) => {
|
|
1835
|
+
for (var a = s > 1 ? void 0 : s ? Ye(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1836
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
1837
|
+
return s && a && Ze(e, i, a), a;
|
|
1733
1838
|
};
|
|
1734
|
-
let
|
|
1839
|
+
let m = class extends q {
|
|
1735
1840
|
constructor() {
|
|
1736
|
-
super(), this.localize = new
|
|
1841
|
+
super(), this.localize = new V(this), this.baseUrl = void 0, this.token = void 0, this.asset = void 0, this.cropModes = [
|
|
1737
1842
|
{
|
|
1738
1843
|
label: "Free",
|
|
1739
1844
|
value: "free"
|
|
@@ -1792,7 +1897,7 @@ let x = class extends B {
|
|
|
1792
1897
|
label: "Smart Swatch",
|
|
1793
1898
|
value: "SmartSwatch"
|
|
1794
1899
|
}
|
|
1795
|
-
], this.extensions = [], this.proxies = void 0, this.forCropper = void 0, this.useSession = "", this.transformations = [], this.selectedProxy = "", this.defaultProxy = "", this.useCustomExtension = !1, this.noMetadata = !1, this.noFormat = !1, this.noCrop = !1, this.noResize = !1, this.noRotate = !1, this.lastImageSize = {
|
|
1900
|
+
], 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.noMetadata = !1, this.noFormat = !1, this.noCrop = !1, this.noResize = !1, this.noRotate = !1, this.lastImageSize = {
|
|
1796
1901
|
height: 0,
|
|
1797
1902
|
width: 0
|
|
1798
1903
|
}, this.hideHeader = !1, this.canReset = !1, this.queryElement = null, this.activeSetting = "cx-asset-link-format-proxy", this.selectedFormat = void 0, this.resizeSize = {
|
|
@@ -1805,7 +1910,7 @@ let x = class extends B {
|
|
|
1805
1910
|
keepAspectRatio: !0,
|
|
1806
1911
|
ratioHeight: 1,
|
|
1807
1912
|
ratioWidth: 1,
|
|
1808
|
-
unit:
|
|
1913
|
+
unit: r.Pixel,
|
|
1809
1914
|
width: 1
|
|
1810
1915
|
}, this.cropSize = {
|
|
1811
1916
|
cropMode: "free",
|
|
@@ -1819,17 +1924,17 @@ let x = class extends B {
|
|
|
1819
1924
|
keepAspectRatio: !0,
|
|
1820
1925
|
percentageHeight: 0,
|
|
1821
1926
|
percentageWidth: 0,
|
|
1822
|
-
position:
|
|
1927
|
+
position: N.CenterCenter,
|
|
1823
1928
|
ratioHeight: 1,
|
|
1824
1929
|
ratioWidth: 1,
|
|
1825
|
-
unit:
|
|
1930
|
+
unit: r.Pixel,
|
|
1826
1931
|
width: 1,
|
|
1827
1932
|
x: 0,
|
|
1828
1933
|
y: 0
|
|
1829
1934
|
}, this.rotation = 0, this.defaultSize = {
|
|
1830
1935
|
height: 0,
|
|
1831
1936
|
width: 0
|
|
1832
|
-
}, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.apiGetTransformAssetLink =
|
|
1937
|
+
}, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.apiGetTransformAssetLink = ve, this.apiGetCropFocusMode = ke, this.onCropComplete = this.onCropComplete.bind(this), this.onCropDragStart = this.onCropDragStart.bind(this);
|
|
1833
1938
|
}
|
|
1834
1939
|
/**
|
|
1835
1940
|
* Transform requests must resolve to a web-displayable image (the browser renders the
|
|
@@ -1838,7 +1943,7 @@ let x = class extends B {
|
|
|
1838
1943
|
* extension fallback in asset-transformation-dialog.
|
|
1839
1944
|
*/
|
|
1840
1945
|
static getTransformExtension(t) {
|
|
1841
|
-
return !t ||
|
|
1946
|
+
return !t || Zt(t) ? t : "jpg";
|
|
1842
1947
|
}
|
|
1843
1948
|
/** True when there are transformations beyond the frozen index (i.e. user has added new ones). */
|
|
1844
1949
|
get hasUnfrozenTransformations() {
|
|
@@ -1851,8 +1956,8 @@ let x = class extends B {
|
|
|
1851
1956
|
*/
|
|
1852
1957
|
get lastAppliedCropUnit() {
|
|
1853
1958
|
return this.transformations.findLast(
|
|
1854
|
-
(e) => e.key ===
|
|
1855
|
-
)?.value.unit ??
|
|
1959
|
+
(e) => e.key === f.Crop
|
|
1960
|
+
)?.value.unit ?? r.Pixel;
|
|
1856
1961
|
}
|
|
1857
1962
|
/**
|
|
1858
1963
|
* The focus mode of the last applied crop transformation, for the no-asset case only.
|
|
@@ -1861,7 +1966,7 @@ let x = class extends B {
|
|
|
1861
1966
|
*/
|
|
1862
1967
|
get lastAppliedCropFocusMode() {
|
|
1863
1968
|
return this.transformations.findLast(
|
|
1864
|
-
(e) => e.key ===
|
|
1969
|
+
(e) => e.key === f.Crop
|
|
1865
1970
|
)?.value.focusMode ?? "manual";
|
|
1866
1971
|
}
|
|
1867
1972
|
/**
|
|
@@ -1871,8 +1976,8 @@ let x = class extends B {
|
|
|
1871
1976
|
*/
|
|
1872
1977
|
get lastAppliedCropPosition() {
|
|
1873
1978
|
return this.transformations.findLast(
|
|
1874
|
-
(e) => e.key ===
|
|
1875
|
-
)?.value.position ??
|
|
1979
|
+
(e) => e.key === f.Crop
|
|
1980
|
+
)?.value.position ?? N.CenterCenter;
|
|
1876
1981
|
}
|
|
1877
1982
|
/**
|
|
1878
1983
|
* Checks if the crop apply button should be disabled.
|
|
@@ -1883,8 +1988,8 @@ let x = class extends B {
|
|
|
1883
1988
|
get disabledCropApply() {
|
|
1884
1989
|
if (!this.asset && this.cropSize.unit !== this.lastAppliedCropUnit)
|
|
1885
1990
|
return !1;
|
|
1886
|
-
if (this.cropSize.unit ===
|
|
1887
|
-
const e = this.lastCropSize[
|
|
1991
|
+
if (this.cropSize.unit === r.AspectRatio && !this.asset) {
|
|
1992
|
+
const e = this.lastCropSize[r.AspectRatio];
|
|
1888
1993
|
return this.cropSize.ratioWidth === e.width && this.cropSize.ratioHeight === e.height && this.cropSize.focusMode === this.lastAppliedCropFocusMode && this.cropSize.position === this.lastAppliedCropPosition;
|
|
1889
1994
|
}
|
|
1890
1995
|
if (!this.asset && this.cropSize.focusMode !== this.lastAppliedCropFocusMode || !this.asset && this.cropSize.position !== this.lastAppliedCropPosition)
|
|
@@ -1898,7 +2003,7 @@ let x = class extends B {
|
|
|
1898
2003
|
"y"
|
|
1899
2004
|
];
|
|
1900
2005
|
for (const e of t)
|
|
1901
|
-
if (this.cropSize[e] !== this.lastCropSize[
|
|
2006
|
+
if (this.cropSize[e] !== this.lastCropSize[r.Pixel][e])
|
|
1902
2007
|
return !1;
|
|
1903
2008
|
return !0;
|
|
1904
2009
|
}
|
|
@@ -1923,15 +2028,15 @@ let x = class extends B {
|
|
|
1923
2028
|
get lastCropSize() {
|
|
1924
2029
|
if (!this.asset) {
|
|
1925
2030
|
const e = this.transformations.findLast(
|
|
1926
|
-
(i) => i.key ===
|
|
2031
|
+
(i) => i.key === f.Crop
|
|
1927
2032
|
);
|
|
1928
|
-
if (e?.value.unit ===
|
|
2033
|
+
if (e?.value.unit === r.AspectRatio && e.value.ratioWidth && e.value.ratioHeight)
|
|
1929
2034
|
return {
|
|
1930
|
-
[
|
|
2035
|
+
[r.AspectRatio]: {
|
|
1931
2036
|
height: e.value.ratioHeight,
|
|
1932
2037
|
percentageHeight: 100,
|
|
1933
2038
|
percentageWidth: 100,
|
|
1934
|
-
unit:
|
|
2039
|
+
unit: r.AspectRatio,
|
|
1935
2040
|
width: e.value.ratioWidth,
|
|
1936
2041
|
x: 0,
|
|
1937
2042
|
y: 0
|
|
@@ -1942,56 +2047,56 @@ let x = class extends B {
|
|
|
1942
2047
|
* `min: 1`) instead of 0x0, so switching the unit selector back to Pixel and
|
|
1943
2048
|
* clicking Apply immediately still commits a meaningful crop instead of a no-op.
|
|
1944
2049
|
*/
|
|
1945
|
-
[
|
|
2050
|
+
[r.Pixel]: {
|
|
1946
2051
|
height: 1,
|
|
1947
2052
|
percentageHeight: 100,
|
|
1948
2053
|
percentageWidth: 100,
|
|
1949
|
-
unit:
|
|
2054
|
+
unit: r.Pixel,
|
|
1950
2055
|
width: 1,
|
|
1951
2056
|
x: 0,
|
|
1952
2057
|
y: 0
|
|
1953
2058
|
}
|
|
1954
2059
|
};
|
|
1955
2060
|
if (e?.value.width && e?.value.height) {
|
|
1956
|
-
const { height: i, width: s, x: a = 0, y:
|
|
2061
|
+
const { height: i, width: s, x: a = 0, y: o = 0 } = e.value, n = ht(s, i);
|
|
1957
2062
|
return {
|
|
1958
|
-
[
|
|
2063
|
+
[r.AspectRatio]: {
|
|
1959
2064
|
height: n.height,
|
|
1960
2065
|
percentageHeight: 100,
|
|
1961
2066
|
percentageWidth: 100,
|
|
1962
|
-
unit:
|
|
2067
|
+
unit: r.AspectRatio,
|
|
1963
2068
|
width: n.width,
|
|
1964
2069
|
x: 0,
|
|
1965
2070
|
y: 0
|
|
1966
2071
|
},
|
|
1967
|
-
[
|
|
2072
|
+
[r.Pixel]: {
|
|
1968
2073
|
height: i,
|
|
1969
2074
|
percentageHeight: 100,
|
|
1970
2075
|
percentageWidth: 100,
|
|
1971
|
-
unit:
|
|
2076
|
+
unit: r.Pixel,
|
|
1972
2077
|
width: s,
|
|
1973
2078
|
x: a,
|
|
1974
|
-
y:
|
|
2079
|
+
y: o
|
|
1975
2080
|
}
|
|
1976
2081
|
};
|
|
1977
2082
|
}
|
|
1978
2083
|
}
|
|
1979
|
-
const t = this.lastImageSize.width && this.lastImageSize.height ?
|
|
2084
|
+
const t = this.lastImageSize.width && this.lastImageSize.height ? ht(this.lastImageSize.width, this.lastImageSize.height) : { height: 1, width: 1 };
|
|
1980
2085
|
return {
|
|
1981
|
-
[
|
|
2086
|
+
[r.AspectRatio]: {
|
|
1982
2087
|
height: t.height,
|
|
1983
2088
|
percentageHeight: 100,
|
|
1984
2089
|
percentageWidth: 100,
|
|
1985
|
-
unit:
|
|
2090
|
+
unit: r.AspectRatio,
|
|
1986
2091
|
width: t.width,
|
|
1987
2092
|
x: 0,
|
|
1988
2093
|
y: 0
|
|
1989
2094
|
},
|
|
1990
|
-
[
|
|
2095
|
+
[r.Pixel]: {
|
|
1991
2096
|
height: this.lastImageSize.height,
|
|
1992
2097
|
percentageHeight: 100,
|
|
1993
2098
|
percentageWidth: 100,
|
|
1994
|
-
unit:
|
|
2099
|
+
unit: r.Pixel,
|
|
1995
2100
|
width: this.lastImageSize.width,
|
|
1996
2101
|
x: 0,
|
|
1997
2102
|
y: 0
|
|
@@ -2006,48 +2111,48 @@ let x = class extends B {
|
|
|
2006
2111
|
get lastResizeSize() {
|
|
2007
2112
|
if (!this.asset) {
|
|
2008
2113
|
const e = this.transformations.findLast(
|
|
2009
|
-
(i) => i.key ===
|
|
2114
|
+
(i) => i.key === f.Resize
|
|
2010
2115
|
);
|
|
2011
|
-
if (e?.value.unit ===
|
|
2116
|
+
if (e?.value.unit === r.AspectRatio && e.value.ratioWidth && e.value.ratioHeight)
|
|
2012
2117
|
return {
|
|
2013
|
-
[
|
|
2118
|
+
[r.AspectRatio]: {
|
|
2014
2119
|
height: e.value.ratioHeight,
|
|
2015
|
-
unit:
|
|
2120
|
+
unit: r.AspectRatio,
|
|
2016
2121
|
width: e.value.ratioWidth
|
|
2017
2122
|
},
|
|
2018
2123
|
// See lastCropSize's equivalent branch for why this falls back to 1x1, not 0x0.
|
|
2019
|
-
[
|
|
2124
|
+
[r.Pixel]: {
|
|
2020
2125
|
height: 1,
|
|
2021
|
-
unit:
|
|
2126
|
+
unit: r.Pixel,
|
|
2022
2127
|
width: 1
|
|
2023
2128
|
}
|
|
2024
2129
|
};
|
|
2025
2130
|
if (e?.value.width && e?.value.height) {
|
|
2026
|
-
const { height: i, width: s } = e.value, a =
|
|
2131
|
+
const { height: i, width: s } = e.value, a = ht(s, i);
|
|
2027
2132
|
return {
|
|
2028
|
-
[
|
|
2133
|
+
[r.AspectRatio]: {
|
|
2029
2134
|
height: a.height,
|
|
2030
|
-
unit:
|
|
2135
|
+
unit: r.AspectRatio,
|
|
2031
2136
|
width: a.width
|
|
2032
2137
|
},
|
|
2033
|
-
[
|
|
2138
|
+
[r.Pixel]: {
|
|
2034
2139
|
height: i,
|
|
2035
|
-
unit:
|
|
2140
|
+
unit: r.Pixel,
|
|
2036
2141
|
width: s
|
|
2037
2142
|
}
|
|
2038
2143
|
};
|
|
2039
2144
|
}
|
|
2040
2145
|
}
|
|
2041
|
-
const t = this.lastImageSize.width && this.lastImageSize.height ?
|
|
2146
|
+
const t = this.lastImageSize.width && this.lastImageSize.height ? ht(this.lastImageSize.width, this.lastImageSize.height) : { height: 1, width: 1 };
|
|
2042
2147
|
return {
|
|
2043
|
-
[
|
|
2148
|
+
[r.AspectRatio]: {
|
|
2044
2149
|
height: t.height,
|
|
2045
|
-
unit:
|
|
2150
|
+
unit: r.AspectRatio,
|
|
2046
2151
|
width: t.width
|
|
2047
2152
|
},
|
|
2048
|
-
[
|
|
2153
|
+
[r.Pixel]: {
|
|
2049
2154
|
height: this.lastImageSize.height,
|
|
2050
|
-
unit:
|
|
2155
|
+
unit: r.Pixel,
|
|
2051
2156
|
width: this.lastImageSize.width
|
|
2052
2157
|
}
|
|
2053
2158
|
};
|
|
@@ -2062,14 +2167,14 @@ let x = class extends B {
|
|
|
2062
2167
|
*/
|
|
2063
2168
|
get lastRotation() {
|
|
2064
2169
|
return this.asset ? 0 : this.transformations.findLast(
|
|
2065
|
-
(e) => e.key ===
|
|
2170
|
+
(e) => e.key === f.Rotate
|
|
2066
2171
|
)?.value.rotation ?? 0;
|
|
2067
2172
|
}
|
|
2068
2173
|
/**
|
|
2069
2174
|
* Returns the transformation string for the asset link.
|
|
2070
2175
|
*/
|
|
2071
2176
|
get transformationString() {
|
|
2072
|
-
return
|
|
2177
|
+
return nt({
|
|
2073
2178
|
asset: this.asset,
|
|
2074
2179
|
baseUrl: "",
|
|
2075
2180
|
parameters: this.parameters,
|
|
@@ -2096,7 +2201,11 @@ let x = class extends B {
|
|
|
2096
2201
|
));
|
|
2097
2202
|
}
|
|
2098
2203
|
updated(t) {
|
|
2099
|
-
if ((t.has("forCropper") || t.has("queryElement")) && this.handleCropperSelectorChange(), t.has("asset") && this.handleAssetChange(), t.has("proxies") && this.handleProxiesChange(),
|
|
2204
|
+
if ((t.has("forCropper") || t.has("queryElement")) && this.handleCropperSelectorChange(), t.has("asset") && this.handleAssetChange(), t.has("proxies") && this.handleProxiesChange(), this.autoFormat && (t.has("asset") || t.has("proxies"))) {
|
|
2205
|
+
const e = this.autoResolvedProxyId;
|
|
2206
|
+
e && (this.selectedProxy = e);
|
|
2207
|
+
}
|
|
2208
|
+
if (t.has("activeSetting") && this.handleActiveSettingChange(), t.has("selectedFormat") && this.handleSelectedFormatChange(), t.has("resizeSize") && this.handleResizeSizeChange(), t.has("cropSize") && this.handleCropSizeChange(), t.has("rotation") && this.handleRotationChange(), t.has("cropperElement") && this.handleCropperElementChange(), t.has("selectedFormat")) {
|
|
2100
2209
|
if (!this.asset || !this.selectedFormat || this.selectedFormat.extension === t.get("selectedFormat")?.extension)
|
|
2101
2210
|
return;
|
|
2102
2211
|
const e = this.proxies?.find(
|
|
@@ -2104,13 +2213,13 @@ let x = class extends B {
|
|
|
2104
2213
|
);
|
|
2105
2214
|
this.loading = !0, this.apiGetTransformAssetLink({
|
|
2106
2215
|
assetId: this.asset.id,
|
|
2107
|
-
extension:
|
|
2216
|
+
extension: m.getTransformExtension(this.asset.extension),
|
|
2108
2217
|
format: e?.proxyName ?? "",
|
|
2109
2218
|
siteUrl: this.baseUrl,
|
|
2110
2219
|
token: this.token,
|
|
2111
2220
|
transformations: this.transformationString
|
|
2112
2221
|
}).then((s) => {
|
|
2113
|
-
this.loading = !1, !(!s?.relativePath || !this.selectedFormat) && (this.lastAction ===
|
|
2222
|
+
this.loading = !1, !(!s?.relativePath || !this.selectedFormat) && (this.lastAction === f.Rotate && (this.rotation = 0), this.lastAction = void 0, this.lastImageSize = {
|
|
2114
2223
|
height: s.height,
|
|
2115
2224
|
width: s.width
|
|
2116
2225
|
}, this.selectedFormat = {
|
|
@@ -2124,7 +2233,7 @@ let x = class extends B {
|
|
|
2124
2233
|
*/
|
|
2125
2234
|
});
|
|
2126
2235
|
});
|
|
2127
|
-
const i =
|
|
2236
|
+
const i = nt({
|
|
2128
2237
|
asset: this.asset,
|
|
2129
2238
|
baseUrl: "",
|
|
2130
2239
|
extension: this.selectedFormat.extension,
|
|
@@ -2157,7 +2266,7 @@ let x = class extends B {
|
|
|
2157
2266
|
async handleTransformationsChange() {
|
|
2158
2267
|
if (await this.updateComplete, !this.asset) {
|
|
2159
2268
|
this.emit("cx-asset-link-format-change", {
|
|
2160
|
-
detail:
|
|
2269
|
+
detail: nt({
|
|
2161
2270
|
asset: this.asset,
|
|
2162
2271
|
baseUrl: "",
|
|
2163
2272
|
options: {
|
|
@@ -2168,24 +2277,24 @@ let x = class extends B {
|
|
|
2168
2277
|
useSession: this.useSession
|
|
2169
2278
|
}).replace(/\/t\//g, "")
|
|
2170
2279
|
});
|
|
2171
|
-
const
|
|
2172
|
-
(c) => c.key ===
|
|
2280
|
+
const o = this.transformations.findLast(
|
|
2281
|
+
(c) => c.key === f.Crop && (c.value.unit === r.AspectRatio && c.value.ratioWidth && c.value.ratioHeight || c.value.width && c.value.height)
|
|
2173
2282
|
);
|
|
2174
|
-
if (
|
|
2175
|
-
const { focusMode: c, position: g, ratioHeight:
|
|
2283
|
+
if (o?.value.unit === r.AspectRatio && o.value.ratioWidth && o.value.ratioHeight) {
|
|
2284
|
+
const { focusMode: c, position: g, ratioHeight: S, ratioWidth: d } = o.value;
|
|
2176
2285
|
this.cropSize = {
|
|
2177
2286
|
...this.cropSize,
|
|
2178
2287
|
cropMode: "free",
|
|
2179
2288
|
focusMode: c ?? "manual",
|
|
2180
2289
|
percentageHeight: 100,
|
|
2181
2290
|
percentageWidth: 100,
|
|
2182
|
-
position: g ??
|
|
2183
|
-
ratioHeight:
|
|
2291
|
+
position: g ?? N.CenterCenter,
|
|
2292
|
+
ratioHeight: S,
|
|
2184
2293
|
ratioWidth: d,
|
|
2185
|
-
unit:
|
|
2294
|
+
unit: r.AspectRatio
|
|
2186
2295
|
};
|
|
2187
|
-
} else if (
|
|
2188
|
-
const { focusMode: c, height: g, position:
|
|
2296
|
+
} else if (o) {
|
|
2297
|
+
const { focusMode: c, height: g, position: S, unit: d, width: A, x: k = 0, y: u = 0 } = o.value;
|
|
2189
2298
|
this.cropSize = {
|
|
2190
2299
|
...this.cropSize,
|
|
2191
2300
|
cropMode: "free",
|
|
@@ -2193,10 +2302,10 @@ let x = class extends B {
|
|
|
2193
2302
|
height: g,
|
|
2194
2303
|
percentageHeight: 100,
|
|
2195
2304
|
percentageWidth: 100,
|
|
2196
|
-
position:
|
|
2197
|
-
unit: d ??
|
|
2198
|
-
width:
|
|
2199
|
-
x:
|
|
2305
|
+
position: S ?? N.CenterCenter,
|
|
2306
|
+
unit: d ?? r.Pixel,
|
|
2307
|
+
width: A,
|
|
2308
|
+
x: k,
|
|
2200
2309
|
y: u
|
|
2201
2310
|
};
|
|
2202
2311
|
} else
|
|
@@ -2213,30 +2322,30 @@ let x = class extends B {
|
|
|
2213
2322
|
height: 1,
|
|
2214
2323
|
percentageHeight: 0,
|
|
2215
2324
|
percentageWidth: 0,
|
|
2216
|
-
position:
|
|
2217
|
-
unit:
|
|
2325
|
+
position: N.CenterCenter,
|
|
2326
|
+
unit: r.Pixel,
|
|
2218
2327
|
width: 1,
|
|
2219
2328
|
x: 0,
|
|
2220
2329
|
y: 0
|
|
2221
2330
|
};
|
|
2222
2331
|
const n = this.transformations.findLast(
|
|
2223
|
-
(c) => c.key ===
|
|
2332
|
+
(c) => c.key === f.Resize && (c.value.unit === r.AspectRatio && c.value.ratioWidth && c.value.ratioHeight || c.value.width || c.value.height)
|
|
2224
2333
|
);
|
|
2225
|
-
if (n?.value.unit ===
|
|
2334
|
+
if (n?.value.unit === r.AspectRatio && n.value.ratioWidth && n.value.ratioHeight) {
|
|
2226
2335
|
const { ratioHeight: c, ratioWidth: g } = n.value;
|
|
2227
2336
|
this.resizeSize = {
|
|
2228
2337
|
...this.resizeSize,
|
|
2229
2338
|
ratioHeight: c,
|
|
2230
2339
|
ratioWidth: g,
|
|
2231
|
-
unit:
|
|
2340
|
+
unit: r.AspectRatio
|
|
2232
2341
|
};
|
|
2233
2342
|
} else if (n) {
|
|
2234
|
-
const { height: c = 0, unit: g, width:
|
|
2343
|
+
const { height: c = 0, unit: g, width: S = 0 } = n.value;
|
|
2235
2344
|
this.resizeSize = {
|
|
2236
2345
|
...this.resizeSize,
|
|
2237
2346
|
height: c,
|
|
2238
|
-
unit: g ??
|
|
2239
|
-
width:
|
|
2347
|
+
unit: g ?? r.Pixel,
|
|
2348
|
+
width: S
|
|
2240
2349
|
};
|
|
2241
2350
|
} else
|
|
2242
2351
|
this.resizeSize = {
|
|
@@ -2247,21 +2356,20 @@ let x = class extends B {
|
|
|
2247
2356
|
* Apply silently no-op.
|
|
2248
2357
|
*/
|
|
2249
2358
|
height: 1,
|
|
2250
|
-
unit:
|
|
2359
|
+
unit: r.Pixel,
|
|
2251
2360
|
width: 1
|
|
2252
2361
|
};
|
|
2253
|
-
const
|
|
2254
|
-
(c) => c.key ===
|
|
2362
|
+
const l = this.transformations.findLast(
|
|
2363
|
+
(c) => c.key === f.Rotate
|
|
2255
2364
|
);
|
|
2256
|
-
this.rotation =
|
|
2257
|
-
const p = this.transformations.findLast((c) => c.key ===
|
|
2258
|
-
(c) => c.key ===
|
|
2365
|
+
this.rotation = l?.value.rotation ?? 0;
|
|
2366
|
+
const p = this.transformations.findLast((c) => c.key === f.Quality)?.value.quality ?? 100, y = this.transformations.some(
|
|
2367
|
+
(c) => c.key === f.Metadata
|
|
2259
2368
|
);
|
|
2260
|
-
this.selectedFormat ? this.selectedFormat = { ...this.selectedFormat, keepMetadata:
|
|
2369
|
+
this.selectedFormat ? this.selectedFormat = { ...this.selectedFormat, keepMetadata: y, quality: p } : this.selectedFormat = {
|
|
2261
2370
|
extension: "",
|
|
2262
2371
|
height: 0,
|
|
2263
|
-
keepMetadata:
|
|
2264
|
-
originalUrl: "",
|
|
2372
|
+
keepMetadata: y,
|
|
2265
2373
|
quality: p,
|
|
2266
2374
|
rotation: 0,
|
|
2267
2375
|
url: "",
|
|
@@ -2274,12 +2382,12 @@ let x = class extends B {
|
|
|
2274
2382
|
if (!this.selectedFormat)
|
|
2275
2383
|
return;
|
|
2276
2384
|
const t = this.proxies?.find(
|
|
2277
|
-
(
|
|
2385
|
+
(o) => o.id === this.selectedProxy
|
|
2278
2386
|
);
|
|
2279
2387
|
this.loading = !0;
|
|
2280
2388
|
const e = await this.apiGetTransformAssetLink({
|
|
2281
2389
|
assetId: this.asset.id,
|
|
2282
|
-
extension:
|
|
2390
|
+
extension: m.getTransformExtension(this.selectedFormat.extension),
|
|
2283
2391
|
format: t?.proxyName ?? "",
|
|
2284
2392
|
siteUrl: this.baseUrl,
|
|
2285
2393
|
token: this.token,
|
|
@@ -2295,7 +2403,7 @@ let x = class extends B {
|
|
|
2295
2403
|
keepAspectRatio: !0,
|
|
2296
2404
|
ratioHeight: 1,
|
|
2297
2405
|
ratioWidth: 1,
|
|
2298
|
-
unit:
|
|
2406
|
+
unit: r.Pixel,
|
|
2299
2407
|
width: e.width
|
|
2300
2408
|
}, this.cropSize = {
|
|
2301
2409
|
cropMode: "free",
|
|
@@ -2304,18 +2412,18 @@ let x = class extends B {
|
|
|
2304
2412
|
keepAspectRatio: this.cropSize.keepAspectRatio,
|
|
2305
2413
|
percentageHeight: 100,
|
|
2306
2414
|
percentageWidth: 100,
|
|
2307
|
-
position:
|
|
2415
|
+
position: N.CenterCenter,
|
|
2308
2416
|
ratioHeight: 1,
|
|
2309
2417
|
ratioWidth: 1,
|
|
2310
|
-
unit:
|
|
2418
|
+
unit: r.Pixel,
|
|
2311
2419
|
width: e.width,
|
|
2312
2420
|
x: 0,
|
|
2313
2421
|
y: 0
|
|
2314
|
-
}, this.lastAction ===
|
|
2422
|
+
}, this.lastAction === f.Rotate && (this.rotation = 0), this.lastAction = void 0;
|
|
2315
2423
|
const i = this.transformations.some(
|
|
2316
|
-
(
|
|
2424
|
+
(o) => o.key === f.Metadata
|
|
2317
2425
|
), s = this.transformations.findLast(
|
|
2318
|
-
(
|
|
2426
|
+
(o) => o.key === f.Quality
|
|
2319
2427
|
);
|
|
2320
2428
|
this.selectedFormat = {
|
|
2321
2429
|
...this.selectedFormat,
|
|
@@ -2329,7 +2437,7 @@ let x = class extends B {
|
|
|
2329
2437
|
* url: `${this.baseUrl}/${response.relativePath}`,
|
|
2330
2438
|
*/
|
|
2331
2439
|
};
|
|
2332
|
-
const a =
|
|
2440
|
+
const a = nt({
|
|
2333
2441
|
asset: this.asset,
|
|
2334
2442
|
baseUrl: "",
|
|
2335
2443
|
extension: this.selectedFormat.extension,
|
|
@@ -2361,13 +2469,12 @@ let x = class extends B {
|
|
|
2361
2469
|
width: Number.parseInt(this.asset.width, 10)
|
|
2362
2470
|
});
|
|
2363
2471
|
const t = this.transformations.findLast(
|
|
2364
|
-
(e) => e.key ===
|
|
2472
|
+
(e) => e.key === f.Quality
|
|
2365
2473
|
);
|
|
2366
2474
|
this.selectedFormat = {
|
|
2367
2475
|
extension: this.asset.extension,
|
|
2368
2476
|
height: this.defaultSize.height,
|
|
2369
2477
|
keepMetadata: !1,
|
|
2370
|
-
originalUrl: this.asset.originalUrl,
|
|
2371
2478
|
quality: t?.value?.quality || 100,
|
|
2372
2479
|
rotation: 0,
|
|
2373
2480
|
url: this.asset.imageUrl,
|
|
@@ -2385,17 +2492,26 @@ let x = class extends B {
|
|
|
2385
2492
|
keepAspectRatio: !0,
|
|
2386
2493
|
percentageHeight: 100,
|
|
2387
2494
|
percentageWidth: 100,
|
|
2388
|
-
position:
|
|
2495
|
+
position: N.CenterCenter,
|
|
2389
2496
|
ratioHeight: 1,
|
|
2390
2497
|
ratioWidth: 1,
|
|
2391
|
-
unit:
|
|
2498
|
+
unit: r.Pixel,
|
|
2392
2499
|
width: this.defaultSize.width,
|
|
2393
2500
|
x: 0,
|
|
2394
2501
|
y: 0
|
|
2395
|
-
}, this.selectedProxy || (this.selectedProxy = this.
|
|
2502
|
+
}, this.selectedProxy || (this.selectedProxy = this.resolveFallbackProxyId());
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* The proxy id to fall back to when none is set or the current one is not in the list.
|
|
2506
|
+
*
|
|
2507
|
+
* Under `Auto` the asset's extension decides, so the first proxy in the list is only a
|
|
2508
|
+
* last resort — used when the mapped format is not offered for this asset.
|
|
2509
|
+
*/
|
|
2510
|
+
resolveFallbackProxyId() {
|
|
2511
|
+
return !this.proxies || this.proxies.length === 0 ? "" : this.autoFormat ? this.autoResolvedProxyId || this.proxies[0].id : this.proxies[0].id;
|
|
2396
2512
|
}
|
|
2397
2513
|
handleProxiesChange() {
|
|
2398
|
-
!this.proxies || this.proxies.length === 0 || (!this.selectedProxy || !this.proxies.some((t) => t.id === this.selectedProxy)) && (this.selectedProxy = this.
|
|
2514
|
+
!this.proxies || this.proxies.length === 0 || (!this.selectedProxy || !this.proxies.some((t) => t.id === this.selectedProxy)) && (this.selectedProxy = this.resolveFallbackProxyId());
|
|
2399
2515
|
}
|
|
2400
2516
|
async handleSelectedProxyChange(t) {
|
|
2401
2517
|
if (!this.asset || !this.selectedProxy)
|
|
@@ -2408,26 +2524,26 @@ let x = class extends B {
|
|
|
2408
2524
|
e.proxyName === "TRX" && (e.formatHeight = Number(this.asset.height), e.formatWidth = Number(this.asset.width));
|
|
2409
2525
|
const i = this.proxies?.find((s) => s.id === t);
|
|
2410
2526
|
i && (this.asset && i.proxyName === "TRX" && (i.formatHeight = Number(this.asset.height), i.formatWidth = Number(this.asset.width)), this.transformations = this.transformations.map((s) => {
|
|
2411
|
-
if (s.key ===
|
|
2412
|
-
const a = s.value,
|
|
2527
|
+
if (s.key === f.Crop) {
|
|
2528
|
+
const a = s.value, o = a.width / i.formatWidth * e.formatWidth, n = a.height / i.formatHeight * e.formatHeight, l = a.x / i.formatWidth * e.formatWidth, p = a.y / i.formatHeight * e.formatHeight;
|
|
2413
2529
|
return {
|
|
2414
2530
|
...s,
|
|
2415
2531
|
value: {
|
|
2416
2532
|
...s.value,
|
|
2417
2533
|
height: n,
|
|
2418
|
-
width:
|
|
2419
|
-
x:
|
|
2534
|
+
width: o,
|
|
2535
|
+
x: l,
|
|
2420
2536
|
y: p
|
|
2421
2537
|
}
|
|
2422
2538
|
};
|
|
2423
2539
|
}
|
|
2424
|
-
if (s.key ===
|
|
2425
|
-
const a = s.value,
|
|
2540
|
+
if (s.key === f.Resize) {
|
|
2541
|
+
const a = s.value, o = a.width / i.formatWidth * e.formatWidth, n = a.height / i.formatHeight * e.formatHeight;
|
|
2426
2542
|
return {
|
|
2427
2543
|
...s,
|
|
2428
2544
|
value: {
|
|
2429
2545
|
height: n,
|
|
2430
|
-
width:
|
|
2546
|
+
width: o
|
|
2431
2547
|
}
|
|
2432
2548
|
};
|
|
2433
2549
|
}
|
|
@@ -2442,24 +2558,24 @@ let x = class extends B {
|
|
|
2442
2558
|
}, await this.updateComplete, this.cropSize = {
|
|
2443
2559
|
cropMode: "free",
|
|
2444
2560
|
focusMode: "manual",
|
|
2445
|
-
height: this.lastCropSize[
|
|
2561
|
+
height: this.lastCropSize[r.Pixel].height,
|
|
2446
2562
|
keepAspectRatio: !0,
|
|
2447
2563
|
percentageHeight: 100,
|
|
2448
2564
|
percentageWidth: 100,
|
|
2449
|
-
position:
|
|
2565
|
+
position: N.CenterCenter,
|
|
2450
2566
|
ratioHeight: 1,
|
|
2451
2567
|
ratioWidth: 1,
|
|
2452
|
-
unit:
|
|
2453
|
-
width: this.lastCropSize[
|
|
2568
|
+
unit: r.Pixel,
|
|
2569
|
+
width: this.lastCropSize[r.Pixel].width,
|
|
2454
2570
|
x: 0,
|
|
2455
2571
|
y: 0
|
|
2456
2572
|
}, this.resizeSize = {
|
|
2457
|
-
height: this.lastResizeSize[
|
|
2573
|
+
height: this.lastResizeSize[r.Pixel].height,
|
|
2458
2574
|
keepAspectRatio: !0,
|
|
2459
2575
|
ratioHeight: 1,
|
|
2460
2576
|
ratioWidth: 1,
|
|
2461
|
-
unit:
|
|
2462
|
-
width: this.lastResizeSize[
|
|
2577
|
+
unit: r.Pixel,
|
|
2578
|
+
width: this.lastResizeSize[r.Pixel].width
|
|
2463
2579
|
};
|
|
2464
2580
|
}
|
|
2465
2581
|
handleLoadingChange() {
|
|
@@ -2479,12 +2595,12 @@ let x = class extends B {
|
|
|
2479
2595
|
}
|
|
2480
2596
|
handleActiveSettingChange() {
|
|
2481
2597
|
this.cropperElement && (this.resizeSize = {
|
|
2482
|
-
height: this.lastResizeSize[
|
|
2598
|
+
height: this.lastResizeSize[r.Pixel].height,
|
|
2483
2599
|
keepAspectRatio: !0,
|
|
2484
2600
|
ratioHeight: 1,
|
|
2485
2601
|
ratioWidth: 1,
|
|
2486
|
-
unit:
|
|
2487
|
-
width: this.lastResizeSize[
|
|
2602
|
+
unit: r.Pixel,
|
|
2603
|
+
width: this.lastResizeSize[r.Pixel].width
|
|
2488
2604
|
}, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop");
|
|
2489
2605
|
}
|
|
2490
2606
|
async handleRequestAutoCropSuggestion({
|
|
@@ -2493,16 +2609,16 @@ let x = class extends B {
|
|
|
2493
2609
|
height: i,
|
|
2494
2610
|
keepAspectRatio: s,
|
|
2495
2611
|
percentageHeight: a,
|
|
2496
|
-
percentageWidth:
|
|
2612
|
+
percentageWidth: o,
|
|
2497
2613
|
ratioHeight: n,
|
|
2498
|
-
ratioWidth:
|
|
2614
|
+
ratioWidth: l,
|
|
2499
2615
|
unit: p,
|
|
2500
|
-
useCropMode:
|
|
2616
|
+
useCropMode: y,
|
|
2501
2617
|
width: c
|
|
2502
2618
|
}) {
|
|
2503
2619
|
if (!this.selectedFormat?.url || e === "manual")
|
|
2504
2620
|
return;
|
|
2505
|
-
this.loading = !0, this.lastAction =
|
|
2621
|
+
this.loading = !0, this.lastAction = f.Crop;
|
|
2506
2622
|
const g = await this.apiGetCropFocusMode({
|
|
2507
2623
|
autoCropMode: e,
|
|
2508
2624
|
cropHeight: i,
|
|
@@ -2510,16 +2626,16 @@ let x = class extends B {
|
|
|
2510
2626
|
imageUrl: this.selectedFormat.url
|
|
2511
2627
|
});
|
|
2512
2628
|
if (g) {
|
|
2513
|
-
let
|
|
2514
|
-
i || (
|
|
2629
|
+
let S = a, d = o;
|
|
2630
|
+
i || (S = g.height * 100 / this.selectedFormat.height), c || (d = g.width * 100 / this.selectedFormat.width), this.cropSize = {
|
|
2515
2631
|
...this.cropSize,
|
|
2516
2632
|
height: g.height,
|
|
2517
|
-
percentageHeight:
|
|
2633
|
+
percentageHeight: S ?? this.cropSize.percentageHeight,
|
|
2518
2634
|
percentageWidth: d ?? this.cropSize.percentageWidth,
|
|
2519
2635
|
width: g.width,
|
|
2520
2636
|
x: g.x * 100 / this.selectedFormat.width,
|
|
2521
2637
|
y: g.y * 100 / this.selectedFormat.height,
|
|
2522
|
-
...
|
|
2638
|
+
...y ? {
|
|
2523
2639
|
cropMode: e,
|
|
2524
2640
|
focusMode: "manual",
|
|
2525
2641
|
keepAspectRatio: !1
|
|
@@ -2529,7 +2645,7 @@ let x = class extends B {
|
|
|
2529
2645
|
},
|
|
2530
2646
|
keepAspectRatio: s ?? this.cropSize.keepAspectRatio,
|
|
2531
2647
|
ratioHeight: n ?? this.cropSize.ratioHeight,
|
|
2532
|
-
ratioWidth:
|
|
2648
|
+
ratioWidth: l ?? this.cropSize.ratioWidth,
|
|
2533
2649
|
unit: p ?? this.cropSize.unit
|
|
2534
2650
|
};
|
|
2535
2651
|
}
|
|
@@ -2540,32 +2656,32 @@ let x = class extends B {
|
|
|
2540
2656
|
height: i,
|
|
2541
2657
|
width: s,
|
|
2542
2658
|
x: a,
|
|
2543
|
-
y:
|
|
2659
|
+
y: o
|
|
2544
2660
|
} = e;
|
|
2545
2661
|
if (s === 0 || i === 0)
|
|
2546
2662
|
return;
|
|
2547
|
-
const n = this.cropSize.percentageWidth !== s,
|
|
2548
|
-
let p = this.cropSize.height,
|
|
2549
|
-
n && (
|
|
2663
|
+
const n = this.cropSize.percentageWidth !== s, l = this.cropSize.percentageHeight !== i;
|
|
2664
|
+
let p = this.cropSize.height, y = this.cropSize.width;
|
|
2665
|
+
n && (y = Math.round(s * this.selectedFormat.width / 100)), l && (p = Math.round(
|
|
2550
2666
|
i * this.selectedFormat.height / 100
|
|
2551
2667
|
));
|
|
2552
2668
|
const c = this.cropSize.focusMode;
|
|
2553
2669
|
this.focusModes.find(
|
|
2554
|
-
(
|
|
2670
|
+
(S) => S.value === c
|
|
2555
2671
|
)?.auto && this.selectedFormat?.url && this.cropperElement ? await this.handleRequestAutoCropSuggestion({
|
|
2556
2672
|
focusMode: c,
|
|
2557
2673
|
height: p,
|
|
2558
2674
|
percentageHeight: i,
|
|
2559
2675
|
percentageWidth: s,
|
|
2560
|
-
width:
|
|
2676
|
+
width: y
|
|
2561
2677
|
}) : this.cropSize = {
|
|
2562
2678
|
...this.cropSize,
|
|
2563
2679
|
height: p,
|
|
2564
2680
|
percentageHeight: i,
|
|
2565
2681
|
percentageWidth: s,
|
|
2566
|
-
width:
|
|
2682
|
+
width: y,
|
|
2567
2683
|
x: a,
|
|
2568
|
-
y:
|
|
2684
|
+
y: o
|
|
2569
2685
|
};
|
|
2570
2686
|
}
|
|
2571
2687
|
onCropDragStart() {
|
|
@@ -2586,9 +2702,26 @@ let x = class extends B {
|
|
|
2586
2702
|
onDetailsHide(t) {
|
|
2587
2703
|
this.activeSetting === t.target.localName && (this.activeSetting = "");
|
|
2588
2704
|
}
|
|
2705
|
+
/**
|
|
2706
|
+
* The proxy id that `Auto` resolves to for the current asset, or `''` when the mapped
|
|
2707
|
+
* format is not among the available proxies.
|
|
2708
|
+
*
|
|
2709
|
+
* `resolveAutoFormat` yields a proxy *name* (`TRX` / `TR1`) while `selectedProxy` holds
|
|
2710
|
+
* a proxy *id*, so the name has to be looked up in `proxies` rather than used directly.
|
|
2711
|
+
*/
|
|
2712
|
+
get autoResolvedProxyId() {
|
|
2713
|
+
const t = Bt(this.asset?.extension);
|
|
2714
|
+
return this.proxies?.find((e) => e.proxyName === t)?.id ?? "";
|
|
2715
|
+
}
|
|
2589
2716
|
onProxyChange(t) {
|
|
2590
2717
|
const e = t.detail;
|
|
2591
|
-
this.lastAction =
|
|
2718
|
+
if (this.lastAction = f.Proxy, e.autoFormat) {
|
|
2719
|
+
this.autoFormat = !0;
|
|
2720
|
+
const i = this.autoResolvedProxyId;
|
|
2721
|
+
i && (this.selectedProxy = i);
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
this.autoFormat = !1, this.selectedProxy = e.id;
|
|
2592
2725
|
}
|
|
2593
2726
|
async onCropModeChange(t) {
|
|
2594
2727
|
const { mode: e } = t.detail;
|
|
@@ -2601,20 +2734,20 @@ let x = class extends B {
|
|
|
2601
2734
|
const s = this.focusModes.find(
|
|
2602
2735
|
(p) => p.value === this.cropSize.focusMode
|
|
2603
2736
|
)?.auto;
|
|
2604
|
-
let a = this.cropSize.keepAspectRatio,
|
|
2605
|
-
e === "free" ? (a = !1,
|
|
2737
|
+
let a = this.cropSize.keepAspectRatio, o = this.cropSize.focusMode, n = this.cropSize.x, l = this.cropSize.y;
|
|
2738
|
+
e === "free" ? (a = !1, o = "manual") : this.cropSize.unit === r.Pixel && !s && (n = 0, l = 0), s ? await this.handleRequestAutoCropSuggestion({
|
|
2606
2739
|
cropMode: e,
|
|
2607
|
-
focusMode:
|
|
2740
|
+
focusMode: o,
|
|
2608
2741
|
height: this.cropSize.height,
|
|
2609
2742
|
keepAspectRatio: a,
|
|
2610
2743
|
width: this.cropSize.width
|
|
2611
2744
|
}) : this.cropSize = {
|
|
2612
2745
|
...this.cropSize,
|
|
2613
2746
|
cropMode: e,
|
|
2614
|
-
focusMode:
|
|
2747
|
+
focusMode: o,
|
|
2615
2748
|
keepAspectRatio: a,
|
|
2616
2749
|
x: n,
|
|
2617
|
-
y:
|
|
2750
|
+
y: l
|
|
2618
2751
|
};
|
|
2619
2752
|
}
|
|
2620
2753
|
}
|
|
@@ -2637,52 +2770,52 @@ let x = class extends B {
|
|
|
2637
2770
|
}
|
|
2638
2771
|
async onCropChange(t) {
|
|
2639
2772
|
const e = this.cropSize.unit;
|
|
2640
|
-
if (t.detail.unit ===
|
|
2773
|
+
if (t.detail.unit === r.AspectRatio) {
|
|
2641
2774
|
const i = t.detail.width / t.detail.height, s = this.asset ? Math.min(
|
|
2642
2775
|
Math.max(Math.round(this.cropSize.height * i), 0),
|
|
2643
2776
|
this.resizeSize.width
|
|
2644
2777
|
) : 0, a = this.asset ? Math.min(
|
|
2645
2778
|
Math.max(Math.round(s / i), 0),
|
|
2646
2779
|
this.resizeSize.height
|
|
2647
|
-
) : 0,
|
|
2648
|
-
let
|
|
2649
|
-
|
|
2650
|
-
let
|
|
2780
|
+
) : 0, o = this.asset ? a * 100 / this.selectedFormat.height : 100, n = this.asset ? s * 100 / this.selectedFormat.width : 100;
|
|
2781
|
+
let l = this.cropSize.x, p = this.cropSize.y;
|
|
2782
|
+
l + n > 100 && (l = 100 - n), p + o > 100 && (p = 100 - o);
|
|
2783
|
+
let y = this.cropSize.cropMode;
|
|
2651
2784
|
this.cropModes.find(
|
|
2652
|
-
(g) => g.value ===
|
|
2653
|
-
)?.auto && (
|
|
2785
|
+
(g) => g.value === y
|
|
2786
|
+
)?.auto && (y = "free"), t.detail.silent ? (this.cropSize.height = a, this.cropSize.keepAspectRatio = t.detail.keepAspectRatio, this.cropSize.percentageHeight = o, this.cropSize.percentageWidth = n, this.cropSize.ratioHeight = t.detail.height, this.cropSize.ratioWidth = t.detail.width, this.cropSize.unit = r.AspectRatio, this.cropSize.width = s) : this.cropSize = {
|
|
2654
2787
|
...this.cropSize,
|
|
2655
|
-
cropMode:
|
|
2788
|
+
cropMode: y,
|
|
2656
2789
|
height: a,
|
|
2657
2790
|
keepAspectRatio: t.detail.keepAspectRatio,
|
|
2658
|
-
percentageHeight:
|
|
2791
|
+
percentageHeight: o,
|
|
2659
2792
|
percentageWidth: n,
|
|
2660
2793
|
ratioHeight: t.detail.height,
|
|
2661
2794
|
ratioWidth: t.detail.width,
|
|
2662
|
-
unit:
|
|
2795
|
+
unit: r.AspectRatio,
|
|
2663
2796
|
width: s,
|
|
2664
|
-
x:
|
|
2797
|
+
x: l,
|
|
2665
2798
|
y: p
|
|
2666
2799
|
};
|
|
2667
2800
|
} else {
|
|
2668
2801
|
const i = this.asset ? t.detail.height * 100 / this.selectedFormat.height : 100, s = this.asset ? t.detail.width * 100 / this.selectedFormat.width : 100;
|
|
2669
|
-
let a = this.cropSize.x,
|
|
2670
|
-
a + s > 100 && (a = 100 - s),
|
|
2802
|
+
let a = this.cropSize.x, o = this.cropSize.y;
|
|
2803
|
+
a + s > 100 && (a = 100 - s), o + i > 100 && (o = 100 - i);
|
|
2671
2804
|
let n = this.cropSize.cropMode;
|
|
2672
|
-
const
|
|
2805
|
+
const l = this.cropModes.find(
|
|
2673
2806
|
(p) => p.value === n
|
|
2674
2807
|
)?.auto;
|
|
2675
|
-
(t.detail.breakAspectRatio ||
|
|
2808
|
+
(t.detail.breakAspectRatio || l) && (n = "free"), t.detail.silent ? (this.cropSize.cropMode = n, this.cropSize.height = t.detail.height, this.cropSize.keepAspectRatio = t.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = s, this.cropSize.unit = r.Pixel, this.cropSize.width = t.detail.width, this.cropSize.x = a, this.cropSize.y = o) : this.cropSize = {
|
|
2676
2809
|
...this.cropSize,
|
|
2677
2810
|
cropMode: n,
|
|
2678
2811
|
height: t.detail.height,
|
|
2679
2812
|
keepAspectRatio: t.detail.keepAspectRatio,
|
|
2680
2813
|
percentageHeight: i,
|
|
2681
2814
|
percentageWidth: s,
|
|
2682
|
-
unit:
|
|
2815
|
+
unit: r.Pixel,
|
|
2683
2816
|
width: t.detail.width,
|
|
2684
2817
|
x: a,
|
|
2685
|
-
y:
|
|
2818
|
+
y: o
|
|
2686
2819
|
};
|
|
2687
2820
|
}
|
|
2688
2821
|
e !== this.cropSize.unit && (this.cropSize = {
|
|
@@ -2700,42 +2833,42 @@ let x = class extends B {
|
|
|
2700
2833
|
});
|
|
2701
2834
|
}
|
|
2702
2835
|
onCropApply(t) {
|
|
2703
|
-
if (this.
|
|
2836
|
+
if (this.clearResetSnapshot(), this.lastAction = f.Crop, !this.asset) {
|
|
2704
2837
|
const {
|
|
2705
|
-
focusMode:
|
|
2838
|
+
focusMode: l,
|
|
2706
2839
|
height: p,
|
|
2707
|
-
position:
|
|
2840
|
+
position: y,
|
|
2708
2841
|
ratioHeight: c,
|
|
2709
2842
|
ratioWidth: g,
|
|
2710
|
-
unit:
|
|
2843
|
+
unit: S,
|
|
2711
2844
|
width: d,
|
|
2712
|
-
x:
|
|
2713
|
-
y:
|
|
2845
|
+
x: A,
|
|
2846
|
+
y: k
|
|
2714
2847
|
} = this.cropSize, u = this.focusModes.find(
|
|
2715
|
-
(
|
|
2848
|
+
(R) => R.value === l
|
|
2716
2849
|
)?.auto ?? !1;
|
|
2717
|
-
if (
|
|
2850
|
+
if (S === r.AspectRatio) {
|
|
2718
2851
|
g && c && this.upsertTransformation({
|
|
2719
|
-
key:
|
|
2852
|
+
key: f.Crop,
|
|
2720
2853
|
value: {
|
|
2721
|
-
focusMode:
|
|
2854
|
+
focusMode: l,
|
|
2722
2855
|
isFocusModeAuto: u,
|
|
2723
|
-
position:
|
|
2856
|
+
position: y,
|
|
2724
2857
|
ratioHeight: c,
|
|
2725
2858
|
ratioWidth: g,
|
|
2726
|
-
unit:
|
|
2859
|
+
unit: S
|
|
2727
2860
|
}
|
|
2728
2861
|
});
|
|
2729
2862
|
return;
|
|
2730
2863
|
}
|
|
2731
2864
|
(p || d) && this.upsertTransformation({
|
|
2732
|
-
key:
|
|
2865
|
+
key: f.Crop,
|
|
2733
2866
|
value: {
|
|
2734
|
-
focusMode:
|
|
2867
|
+
focusMode: l,
|
|
2735
2868
|
height: p,
|
|
2736
2869
|
isFocusModeAuto: u,
|
|
2737
|
-
position:
|
|
2738
|
-
unit:
|
|
2870
|
+
position: y,
|
|
2871
|
+
unit: S,
|
|
2739
2872
|
width: d,
|
|
2740
2873
|
/**
|
|
2741
2874
|
* Without an asset there is no cropper to drag, so x/y are always the 0
|
|
@@ -2744,8 +2877,8 @@ let x = class extends B {
|
|
|
2744
2877
|
* string) so `hasManualXY` in buildTransformationString doesn't spuriously
|
|
2745
2878
|
* suppress the focus mode / position `c_g_` gravity value.
|
|
2746
2879
|
*/
|
|
2747
|
-
x: Number.isFinite(
|
|
2748
|
-
y: Number.isFinite(
|
|
2880
|
+
x: Number.isFinite(A) && A !== 0 ? A : void 0,
|
|
2881
|
+
y: Number.isFinite(k) && k !== 0 ? k : void 0
|
|
2749
2882
|
}
|
|
2750
2883
|
});
|
|
2751
2884
|
return;
|
|
@@ -2753,38 +2886,38 @@ let x = class extends B {
|
|
|
2753
2886
|
const { height: e, mode: i, unit: s, width: a } = t.detail;
|
|
2754
2887
|
if (!this.cropperElement || !this.selectedFormat)
|
|
2755
2888
|
return;
|
|
2756
|
-
const
|
|
2757
|
-
(
|
|
2889
|
+
const o = this.cropSize.focusMode, n = this.focusModes.find(
|
|
2890
|
+
(l) => l.value === o
|
|
2758
2891
|
)?.auto ?? !1;
|
|
2759
2892
|
if (e && a && s) {
|
|
2760
|
-
let
|
|
2761
|
-
if (s ===
|
|
2893
|
+
let l = a, p = e;
|
|
2894
|
+
if (s === r.AspectRatio && (l = this.cropSize.percentageWidth * this.selectedFormat.width / 100, p = this.cropSize.percentageHeight * this.selectedFormat.height / 100), i)
|
|
2762
2895
|
this.transformations = [
|
|
2763
2896
|
...this.transformations,
|
|
2764
2897
|
{
|
|
2765
|
-
key:
|
|
2898
|
+
key: f.Crop,
|
|
2766
2899
|
value: {
|
|
2767
|
-
focusMode:
|
|
2900
|
+
focusMode: o,
|
|
2768
2901
|
height: p,
|
|
2769
2902
|
isFocusModeAuto: n,
|
|
2770
2903
|
mode: i,
|
|
2771
|
-
width:
|
|
2904
|
+
width: l
|
|
2772
2905
|
}
|
|
2773
2906
|
}
|
|
2774
2907
|
];
|
|
2775
2908
|
else {
|
|
2776
|
-
const
|
|
2909
|
+
const y = this.cropSize.x / 100 * this.selectedFormat.width, c = this.cropSize.y / 100 * this.selectedFormat.height;
|
|
2777
2910
|
this.transformations = [
|
|
2778
2911
|
...this.transformations,
|
|
2779
2912
|
{
|
|
2780
|
-
key:
|
|
2913
|
+
key: f.Crop,
|
|
2781
2914
|
value: {
|
|
2782
|
-
focusMode:
|
|
2915
|
+
focusMode: o,
|
|
2783
2916
|
height: p,
|
|
2784
2917
|
isFocusModeAuto: n,
|
|
2785
2918
|
unit: s,
|
|
2786
|
-
width:
|
|
2787
|
-
x:
|
|
2919
|
+
width: l,
|
|
2920
|
+
x: y,
|
|
2788
2921
|
y: c
|
|
2789
2922
|
}
|
|
2790
2923
|
}
|
|
@@ -2793,9 +2926,9 @@ let x = class extends B {
|
|
|
2793
2926
|
} else i && (this.transformations = [
|
|
2794
2927
|
...this.transformations,
|
|
2795
2928
|
{
|
|
2796
|
-
key:
|
|
2929
|
+
key: f.Crop,
|
|
2797
2930
|
value: {
|
|
2798
|
-
focusMode:
|
|
2931
|
+
focusMode: o,
|
|
2799
2932
|
isFocusModeAuto: n,
|
|
2800
2933
|
mode: i
|
|
2801
2934
|
}
|
|
@@ -2803,9 +2936,9 @@ let x = class extends B {
|
|
|
2803
2936
|
]);
|
|
2804
2937
|
}
|
|
2805
2938
|
onResizeChange(t) {
|
|
2806
|
-
if (t.detail.unit ===
|
|
2939
|
+
if (t.detail.unit === r.AspectRatio) {
|
|
2807
2940
|
const e = t.detail.width / t.detail.height, i = Math.max(
|
|
2808
|
-
Math.round(this.lastResizeSize[
|
|
2941
|
+
Math.round(this.lastResizeSize[r.Pixel].height * e),
|
|
2809
2942
|
0
|
|
2810
2943
|
), s = Math.max(Math.round(i / e), 0);
|
|
2811
2944
|
this.resizeSize = {
|
|
@@ -2828,21 +2961,21 @@ let x = class extends B {
|
|
|
2828
2961
|
}
|
|
2829
2962
|
onResizeApply(t) {
|
|
2830
2963
|
const { height: e, unit: i, width: s } = t.detail;
|
|
2831
|
-
if (this.
|
|
2832
|
-
if (i ===
|
|
2833
|
-
const { ratioHeight: p, ratioWidth:
|
|
2834
|
-
|
|
2835
|
-
key:
|
|
2964
|
+
if (this.clearResetSnapshot(), this.lastAction = f.Resize, !this.asset) {
|
|
2965
|
+
if (i === r.AspectRatio) {
|
|
2966
|
+
const { ratioHeight: p, ratioWidth: y } = this.resizeSize;
|
|
2967
|
+
y && p && this.upsertTransformation({
|
|
2968
|
+
key: f.Resize,
|
|
2836
2969
|
value: {
|
|
2837
2970
|
ratioHeight: p,
|
|
2838
|
-
ratioWidth:
|
|
2971
|
+
ratioWidth: y,
|
|
2839
2972
|
unit: i
|
|
2840
2973
|
}
|
|
2841
2974
|
});
|
|
2842
2975
|
return;
|
|
2843
2976
|
}
|
|
2844
2977
|
(e || s) && this.upsertTransformation({
|
|
2845
|
-
key:
|
|
2978
|
+
key: f.Resize,
|
|
2846
2979
|
value: {
|
|
2847
2980
|
height: e,
|
|
2848
2981
|
unit: i,
|
|
@@ -2853,14 +2986,14 @@ let x = class extends B {
|
|
|
2853
2986
|
}
|
|
2854
2987
|
if (!this.selectedFormat)
|
|
2855
2988
|
return;
|
|
2856
|
-
const a = this.selectedFormat.width || this.defaultSize.width,
|
|
2857
|
-
let n = s,
|
|
2858
|
-
this.resizeSize.unit !== i ? (n = a,
|
|
2989
|
+
const a = this.selectedFormat.width || this.defaultSize.width, o = this.selectedFormat.height || this.defaultSize.height;
|
|
2990
|
+
let n = s, l = e;
|
|
2991
|
+
this.resizeSize.unit !== i ? (n = a, l = o) : i === r.AspectRatio && (n = Math.round(s / e * o), l = o), this.transformations = [
|
|
2859
2992
|
...this.transformations,
|
|
2860
2993
|
{
|
|
2861
|
-
key:
|
|
2994
|
+
key: f.Resize,
|
|
2862
2995
|
value: {
|
|
2863
|
-
height:
|
|
2996
|
+
height: l,
|
|
2864
2997
|
unit: i,
|
|
2865
2998
|
width: n
|
|
2866
2999
|
}
|
|
@@ -2872,21 +3005,21 @@ let x = class extends B {
|
|
|
2872
3005
|
}
|
|
2873
3006
|
onRotationApply(t) {
|
|
2874
3007
|
const e = t.detail;
|
|
2875
|
-
if (this.
|
|
3008
|
+
if (this.clearResetSnapshot(), this.lastAction = f.Rotate, !this.asset) {
|
|
2876
3009
|
e ? this.upsertTransformation({
|
|
2877
|
-
key:
|
|
3010
|
+
key: f.Rotate,
|
|
2878
3011
|
value: {
|
|
2879
3012
|
rotation: e
|
|
2880
3013
|
}
|
|
2881
3014
|
}) : this.transformations = this.transformations.filter(
|
|
2882
|
-
(i) => i.key !==
|
|
3015
|
+
(i) => i.key !== f.Rotate
|
|
2883
3016
|
);
|
|
2884
3017
|
return;
|
|
2885
3018
|
}
|
|
2886
3019
|
this.selectedFormat && (this.transformations = [
|
|
2887
3020
|
...this.transformations,
|
|
2888
3021
|
{
|
|
2889
|
-
key:
|
|
3022
|
+
key: f.Rotate,
|
|
2890
3023
|
value: {
|
|
2891
3024
|
rotation: e
|
|
2892
3025
|
}
|
|
@@ -2895,9 +3028,9 @@ let x = class extends B {
|
|
|
2895
3028
|
}
|
|
2896
3029
|
onQualityChange(t) {
|
|
2897
3030
|
const e = t.detail;
|
|
2898
|
-
this.selectedFormat && (this.selectedFormat.quality = e), this.
|
|
3031
|
+
this.selectedFormat && (this.selectedFormat.quality = e), this.clearResetSnapshot(), this.lastAction = f.Quality;
|
|
2899
3032
|
const i = {
|
|
2900
|
-
key:
|
|
3033
|
+
key: f.Quality,
|
|
2901
3034
|
value: {
|
|
2902
3035
|
quality: e
|
|
2903
3036
|
}
|
|
@@ -2906,27 +3039,27 @@ let x = class extends B {
|
|
|
2906
3039
|
}
|
|
2907
3040
|
onMetadataChange(t) {
|
|
2908
3041
|
const e = t.detail;
|
|
2909
|
-
if (this.
|
|
3042
|
+
if (this.clearResetSnapshot(), this.selectedFormat && (this.selectedFormat = {
|
|
2910
3043
|
...this.selectedFormat,
|
|
2911
3044
|
keepMetadata: e
|
|
2912
3045
|
}), !this.asset) {
|
|
2913
3046
|
e ? this.upsertTransformation({
|
|
2914
|
-
key:
|
|
3047
|
+
key: f.Metadata,
|
|
2915
3048
|
value: {
|
|
2916
3049
|
keepMetadata: e
|
|
2917
3050
|
}
|
|
2918
3051
|
}) : this.transformations = this.transformations.filter(
|
|
2919
|
-
(i) => i.key !==
|
|
3052
|
+
(i) => i.key !== f.Metadata
|
|
2920
3053
|
);
|
|
2921
3054
|
return;
|
|
2922
3055
|
}
|
|
2923
3056
|
e ? this.upsertTransformation({
|
|
2924
|
-
key:
|
|
3057
|
+
key: f.Metadata,
|
|
2925
3058
|
value: {
|
|
2926
3059
|
keepMetadata: e
|
|
2927
3060
|
}
|
|
2928
3061
|
}) : this.transformations = this.transformations.filter(
|
|
2929
|
-
(i) => i.key !==
|
|
3062
|
+
(i) => i.key !== f.Metadata
|
|
2930
3063
|
);
|
|
2931
3064
|
}
|
|
2932
3065
|
onExtensionChange(t) {
|
|
@@ -2938,203 +3071,236 @@ let x = class extends B {
|
|
|
2938
3071
|
}
|
|
2939
3072
|
syncQuality() {
|
|
2940
3073
|
const t = this.transformations.findLast(
|
|
2941
|
-
(e) => e.key ===
|
|
3074
|
+
(e) => e.key === f.Quality
|
|
2942
3075
|
)?.value?.quality;
|
|
2943
3076
|
this.selectedFormat && (this.selectedFormat = {
|
|
2944
3077
|
...this.selectedFormat,
|
|
2945
3078
|
quality: t ?? 100
|
|
2946
3079
|
});
|
|
2947
3080
|
}
|
|
3081
|
+
/**
|
|
3082
|
+
* Whether there is anything for Reset to undo.
|
|
3083
|
+
*
|
|
3084
|
+
* Transformations are one way to diverge from the defaults; leaving `Auto` for an
|
|
3085
|
+
* explicit format is another, and Reset is what puts that back.
|
|
3086
|
+
*/
|
|
3087
|
+
get hasResettableState() {
|
|
3088
|
+
return this.transformations.length > 0 ? !0 : this.canAutoFormat && !this.autoFormat;
|
|
3089
|
+
}
|
|
3090
|
+
/**
|
|
3091
|
+
* Drops the one-step Reset snapshot.
|
|
3092
|
+
*
|
|
3093
|
+
* Called whenever the user applies a new transformation: at that point Undo means
|
|
3094
|
+
* "remove that transformation", not "go back to before the Reset".
|
|
3095
|
+
*/
|
|
3096
|
+
clearResetSnapshot() {
|
|
3097
|
+
this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0;
|
|
3098
|
+
}
|
|
2948
3099
|
handleUndo() {
|
|
2949
|
-
!this.hasUnfrozenTransformations && this.preResetTransformations !== void 0 ? (this.transformations = this.preResetTransformations, this.preResetTransformations = void 0) : this.transformations = this.transformations.slice(0, -1), this.syncQuality();
|
|
3100
|
+
!this.hasUnfrozenTransformations && this.preResetTransformations !== void 0 ? (this.transformations = this.preResetTransformations, this.preResetTransformations = void 0, this.preResetAutoFormat !== void 0 && (this.autoFormat = this.preResetAutoFormat, this.preResetAutoFormat = void 0), this.preResetSelectedProxy !== void 0 && (this.selectedProxy = this.preResetSelectedProxy, this.preResetSelectedProxy = void 0)) : this.transformations = this.transformations.slice(0, -1), this.syncQuality();
|
|
2950
3101
|
}
|
|
2951
3102
|
handleReset() {
|
|
2952
|
-
this.preResetTransformations = [...this.transformations]
|
|
2953
|
-
|
|
2954
|
-
|
|
3103
|
+
if (this.preResetTransformations = [...this.transformations], this.preResetAutoFormat = this.autoFormat, this.preResetSelectedProxy = this.selectedProxy, this.canAutoFormat)
|
|
3104
|
+
this.autoFormat = !0, this.selectedProxy = this.autoResolvedProxyId || this.selectedProxy;
|
|
3105
|
+
else {
|
|
3106
|
+
const t = !!this.defaultProxy && !!this.proxies?.some((e) => e.id === this.defaultProxy);
|
|
3107
|
+
this.selectedProxy = t ? this.defaultProxy : this.selectedProxy || this.proxies?.[0]?.id || "";
|
|
3108
|
+
}
|
|
3109
|
+
this.transformations = [], this.frozenIndex = -1, this.syncQuality();
|
|
2955
3110
|
}
|
|
2956
3111
|
render() {
|
|
2957
|
-
return
|
|
3112
|
+
return C`<div class="asset-link-format" @cx-show=${this.onDetailsShow} @cx-hide=${this.onDetailsHide}>${_(
|
|
2958
3113
|
!this.hideHeader,
|
|
2959
|
-
() =>
|
|
2960
|
-
() =>
|
|
3114
|
+
() => C`<cx-space class="asset-link-format__section-header" direction="horizontal" spacing="small" align-items="center" justify-content="space-between"><cx-typography variant="body3">${this.localize.term("transformations")}</cx-typography><cx-space direction="horizontal" spacing="3x-small" align-items="center"><cx-button class="asset-link-format__undo" variant="custom" ?disabled=${!this.hasUnfrozenTransformations && this.preResetTransformations === void 0} @click=${this.handleUndo}>${this.localize.term("undo")}</cx-button>${_(this.canReset, () => C`<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>`,
|
|
3115
|
+
() => Ut
|
|
2961
3116
|
)}
|
|
2962
|
-
${
|
|
3117
|
+
${_(
|
|
2963
3118
|
!this.noFormat,
|
|
2964
|
-
() =>
|
|
3119
|
+
() => C`<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 === f.Proxy} @cx-asset-link-format-proxy-change=${this.onProxyChange}></cx-asset-link-format-proxy>`
|
|
2965
3120
|
)}
|
|
2966
|
-
${
|
|
3121
|
+
${_(
|
|
2967
3122
|
!this.noCrop,
|
|
2968
|
-
() =>
|
|
3123
|
+
() => C`<cx-asset-link-format-crop class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction === f.Crop} ?keep-aspect-ratio=${this.cropSize.keepAspectRatio} ?show-position-picker=${!this.asset} focus-mode=${this.cropSize.focusMode} crop-mode=${this.cropSize.cropMode} width=${this.cropSize.width} height=${this.cropSize.height} max-width=${this.asset ? this.lastResizeSize[r.Pixel].width : 1 / 0} max-height=${this.asset ? this.lastResizeSize[r.Pixel].height : 1 / 0} 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>`
|
|
2969
3124
|
)}
|
|
2970
|
-
${
|
|
3125
|
+
${_(
|
|
2971
3126
|
!this.noResize,
|
|
2972
|
-
() =>
|
|
3127
|
+
() => C`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction === f.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 : 1 / 0} max-height=${this.asset ? this.imageSize.height : 1 / 0} 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>`
|
|
2973
3128
|
)}
|
|
2974
|
-
${
|
|
3129
|
+
${_(
|
|
2975
3130
|
!this.noRotate,
|
|
2976
|
-
() =>
|
|
2977
|
-
)}<cx-asset-link-format-quality class="asset-link-format__details" ?loading=${this.loading && this.lastAction ===
|
|
3131
|
+
() => C`<cx-asset-link-format-rotation class="asset-link-format__details" ?loading=${this.loading && this.lastAction === f.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>`
|
|
3132
|
+
)}<cx-asset-link-format-quality class="asset-link-format__details" ?loading=${this.loading && this.lastAction === f.Quality} ?open=${this.activeSetting === "cx-asset-link-format-quality"} value=${this.selectedFormat?.quality ?? 100} @cx-asset-link-format-quality-change=${this.onQualityChange}></cx-asset-link-format-quality>${_(
|
|
2978
3133
|
!this.noMetadata,
|
|
2979
|
-
() =>
|
|
3134
|
+
() => C`<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>`
|
|
2980
3135
|
)}
|
|
2981
|
-
${
|
|
3136
|
+
${_(
|
|
2982
3137
|
this.useCustomExtension,
|
|
2983
|
-
() =>
|
|
3138
|
+
() => C`<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>`
|
|
2984
3139
|
)}</div>`;
|
|
2985
3140
|
}
|
|
2986
3141
|
};
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
"cx-asset-link-format-crop":
|
|
2990
|
-
"cx-asset-link-format-extension":
|
|
2991
|
-
"cx-asset-link-format-metadata":
|
|
2992
|
-
"cx-asset-link-format-proxy":
|
|
3142
|
+
m.styles = [G, Pe];
|
|
3143
|
+
m.dependencies = {
|
|
3144
|
+
"cx-asset-link-format-crop": v,
|
|
3145
|
+
"cx-asset-link-format-extension": Z,
|
|
3146
|
+
"cx-asset-link-format-metadata": L,
|
|
3147
|
+
"cx-asset-link-format-proxy": M,
|
|
2993
3148
|
"cx-asset-link-format-quality": T,
|
|
2994
|
-
"cx-asset-link-format-resize":
|
|
3149
|
+
"cx-asset-link-format-resize": w,
|
|
2995
3150
|
"cx-asset-link-format-rotation": H,
|
|
2996
|
-
"cx-button":
|
|
2997
|
-
"cx-space":
|
|
2998
|
-
"cx-typography":
|
|
3151
|
+
"cx-button": Y,
|
|
3152
|
+
"cx-space": U,
|
|
3153
|
+
"cx-typography": B
|
|
2999
3154
|
};
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
],
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
],
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
],
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
],
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
],
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
],
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
],
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
],
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
],
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
],
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
],
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
],
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
],
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
],
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
],
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
],
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
],
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
],
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
],
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
],
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
],
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
],
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
],
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
],
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
],
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
],
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
],
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
],
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
],
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
],
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
],
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
],
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
],
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
],
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
],
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
],
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
],
|
|
3111
|
-
x
|
|
3112
|
-
|
|
3113
|
-
],
|
|
3155
|
+
x([
|
|
3156
|
+
h({ attribute: "base-url", type: String })
|
|
3157
|
+
], m.prototype, "baseUrl", 2);
|
|
3158
|
+
x([
|
|
3159
|
+
h({ attribute: "token", type: String })
|
|
3160
|
+
], m.prototype, "token", 2);
|
|
3161
|
+
x([
|
|
3162
|
+
h({ reflect: !1, type: Object })
|
|
3163
|
+
], m.prototype, "asset", 2);
|
|
3164
|
+
x([
|
|
3165
|
+
h({ attribute: "crop-modes", reflect: !1, type: Array })
|
|
3166
|
+
], m.prototype, "cropModes", 2);
|
|
3167
|
+
x([
|
|
3168
|
+
h({ attribute: "focus-modes", reflect: !1, type: Object })
|
|
3169
|
+
], m.prototype, "focusModes", 2);
|
|
3170
|
+
x([
|
|
3171
|
+
h({ reflect: !1, type: Array })
|
|
3172
|
+
], m.prototype, "extensions", 2);
|
|
3173
|
+
x([
|
|
3174
|
+
h({ reflect: !1, type: Array })
|
|
3175
|
+
], m.prototype, "proxies", 2);
|
|
3176
|
+
x([
|
|
3177
|
+
h({ attribute: "for-cropper", reflect: !0, type: String })
|
|
3178
|
+
], m.prototype, "forCropper", 2);
|
|
3179
|
+
x([
|
|
3180
|
+
h({ attribute: "use-session", reflect: !0, type: String })
|
|
3181
|
+
], m.prototype, "useSession", 2);
|
|
3182
|
+
x([
|
|
3183
|
+
h({ reflect: !1, type: Array })
|
|
3184
|
+
], m.prototype, "transformations", 2);
|
|
3185
|
+
x([
|
|
3186
|
+
h({ attribute: "selected-proxy", reflect: !0, type: String })
|
|
3187
|
+
], m.prototype, "selectedProxy", 2);
|
|
3188
|
+
x([
|
|
3189
|
+
h({ attribute: "default-proxy", reflect: !0, type: String })
|
|
3190
|
+
], m.prototype, "defaultProxy", 2);
|
|
3191
|
+
x([
|
|
3192
|
+
h({ attribute: "can-auto-format", reflect: !0, type: Boolean })
|
|
3193
|
+
], m.prototype, "canAutoFormat", 2);
|
|
3194
|
+
x([
|
|
3195
|
+
h({ attribute: "auto-format", reflect: !0, type: Boolean })
|
|
3196
|
+
], m.prototype, "autoFormat", 2);
|
|
3197
|
+
x([
|
|
3198
|
+
h({ attribute: "use-custom-extension", reflect: !0, type: Boolean })
|
|
3199
|
+
], m.prototype, "useCustomExtension", 2);
|
|
3200
|
+
x([
|
|
3201
|
+
h({ attribute: "no-metadata", reflect: !0, type: Boolean })
|
|
3202
|
+
], m.prototype, "noMetadata", 2);
|
|
3203
|
+
x([
|
|
3204
|
+
h({ attribute: "no-format", reflect: !0, type: Boolean })
|
|
3205
|
+
], m.prototype, "noFormat", 2);
|
|
3206
|
+
x([
|
|
3207
|
+
h({ attribute: "no-crop", reflect: !0, type: Boolean })
|
|
3208
|
+
], m.prototype, "noCrop", 2);
|
|
3209
|
+
x([
|
|
3210
|
+
h({ attribute: "no-resize", reflect: !0, type: Boolean })
|
|
3211
|
+
], m.prototype, "noResize", 2);
|
|
3212
|
+
x([
|
|
3213
|
+
h({ attribute: "no-rotate", reflect: !0, type: Boolean })
|
|
3214
|
+
], m.prototype, "noRotate", 2);
|
|
3215
|
+
x([
|
|
3216
|
+
h({ attribute: "last-image-size", reflect: !1, type: Object })
|
|
3217
|
+
], m.prototype, "lastImageSize", 2);
|
|
3218
|
+
x([
|
|
3219
|
+
h({ attribute: "hide-header", reflect: !1, type: Boolean })
|
|
3220
|
+
], m.prototype, "hideHeader", 2);
|
|
3221
|
+
x([
|
|
3222
|
+
h({ attribute: "can-reset", type: Boolean })
|
|
3223
|
+
], m.prototype, "canReset", 2);
|
|
3224
|
+
x([
|
|
3225
|
+
h({ attribute: !1, reflect: !1, type: Object })
|
|
3226
|
+
], m.prototype, "queryElement", 2);
|
|
3227
|
+
x([
|
|
3228
|
+
b()
|
|
3229
|
+
], m.prototype, "activeSetting", 2);
|
|
3230
|
+
x([
|
|
3231
|
+
b()
|
|
3232
|
+
], m.prototype, "selectedFormat", 2);
|
|
3233
|
+
x([
|
|
3234
|
+
b()
|
|
3235
|
+
], m.prototype, "resizeSize", 2);
|
|
3236
|
+
x([
|
|
3237
|
+
b()
|
|
3238
|
+
], m.prototype, "cropSize", 2);
|
|
3239
|
+
x([
|
|
3240
|
+
b()
|
|
3241
|
+
], m.prototype, "rotation", 2);
|
|
3242
|
+
x([
|
|
3243
|
+
b()
|
|
3244
|
+
], m.prototype, "defaultSize", 2);
|
|
3245
|
+
x([
|
|
3246
|
+
b()
|
|
3247
|
+
], m.prototype, "cropperElement", 2);
|
|
3248
|
+
x([
|
|
3249
|
+
b()
|
|
3250
|
+
], m.prototype, "parameters", 2);
|
|
3251
|
+
x([
|
|
3252
|
+
b()
|
|
3253
|
+
], m.prototype, "loading", 2);
|
|
3254
|
+
x([
|
|
3255
|
+
b()
|
|
3256
|
+
], m.prototype, "lastAction", 2);
|
|
3257
|
+
x([
|
|
3258
|
+
b()
|
|
3259
|
+
], m.prototype, "frozenIndex", 2);
|
|
3260
|
+
x([
|
|
3261
|
+
b()
|
|
3262
|
+
], m.prototype, "preResetTransformations", 2);
|
|
3263
|
+
x([
|
|
3264
|
+
b()
|
|
3265
|
+
], m.prototype, "preResetAutoFormat", 2);
|
|
3266
|
+
x([
|
|
3267
|
+
b()
|
|
3268
|
+
], m.prototype, "preResetSelectedProxy", 2);
|
|
3269
|
+
x([
|
|
3270
|
+
P("transformations")
|
|
3271
|
+
], m.prototype, "handleTransformationsChange", 1);
|
|
3272
|
+
x([
|
|
3273
|
+
P("selectedProxy")
|
|
3274
|
+
], m.prototype, "handleSelectedProxyChange", 1);
|
|
3275
|
+
x([
|
|
3276
|
+
P("loading")
|
|
3277
|
+
], m.prototype, "handleLoadingChange", 1);
|
|
3278
|
+
m = x([
|
|
3279
|
+
Q("cx-asset-link-format")
|
|
3280
|
+
], m);
|
|
3114
3281
|
export {
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
se as u
|
|
3282
|
+
m as C,
|
|
3283
|
+
rt as F,
|
|
3284
|
+
$t as M,
|
|
3285
|
+
we as a,
|
|
3286
|
+
fe as b,
|
|
3287
|
+
Gt as c,
|
|
3288
|
+
Bi as d,
|
|
3289
|
+
qi as e,
|
|
3290
|
+
Ui as f,
|
|
3291
|
+
Xt as g,
|
|
3292
|
+
mt as h,
|
|
3293
|
+
Zt as i,
|
|
3294
|
+
ct as j,
|
|
3295
|
+
pt as k,
|
|
3296
|
+
Ht as l,
|
|
3297
|
+
dt as m,
|
|
3298
|
+
ut as n,
|
|
3299
|
+
Wt as o,
|
|
3300
|
+
ji as p,
|
|
3301
|
+
Vt as q,
|
|
3302
|
+
Ni as r,
|
|
3303
|
+
Oi as s,
|
|
3304
|
+
Li as t,
|
|
3305
|
+
le as u
|
|
3140
3306
|
};
|