@orangelogic/design-system 4.70.0 → 4.71.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/{alert.R0uU2KH7.js → alert.BMbwDsmP.js} +2 -2
- package/library/chunks/{array-line-clamp.sdjI6U9A.js → array-line-clamp.Bl0fIoAD.js} +2 -2
- package/library/chunks/{asset-link-format.dq41gJTI.js → asset-link-format.C0Bz-mEZ.js} +732 -657
- package/library/chunks/{audio.Bh_OVMPq.js → audio.WFMBpGdz.js} +2 -2
- package/library/chunks/{bicolor-picker.BiEM_IkN.js → bicolor-picker.BPzbYxLV.js} +1 -1
- package/library/chunks/{block-width.DVoxwnhY.js → block-width.DjdPu6UK.js} +34 -34
- package/library/chunks/{border-input-group.zw5e2uZT.js → border-input-group.BAQeCwt1.js} +3 -3
- package/library/chunks/{breadcrumb.BUMgMApw.js → breadcrumb.D9bL86V1.js} +1 -1
- package/library/chunks/{button.Dja-uoTw.js → button.cbOwOkfp.js} +2 -2
- package/library/chunks/{color-picker.dyBoEYVk.js → color-picker.DbKVaaKI.js} +10 -10
- package/library/chunks/{color-swatch-group.D7ezyFa4.js → color-swatch-group.Cm0A4rYA.js} +18 -18
- package/library/chunks/{color-swatch.y7Bpth0U.js → color-swatch.Bf8fvLkg.js} +3 -3
- package/library/chunks/{config-manager.DxNqEyoQ.js → config-manager.DB7-b-EK.js} +27 -27
- package/library/chunks/{configs-controller.Dw2p65Lp.js → configs-controller.DFWOYKsW.js} +7 -7
- package/library/chunks/{confirm-popover.CBU6yy6Y.js → confirm-popover.CWujDeV1.js} +4 -4
- package/library/chunks/{copy-button.FXPqVprU.js → copy-button.D4K7M_oK.js} +2 -2
- package/library/chunks/{corner-position-input-group.itPK9LEh.js → corner-position-input-group.DDWSDorz.js} +4 -4
- package/library/chunks/{date-calendar.CVCAmoi6.js → date-calendar.QUer9O4E.js} +2 -2
- package/library/chunks/{details.DmHi0fqd.js → details.tNVJTWTC.js} +1 -1
- package/library/chunks/{dialog.DpY6WRVN.js → dialog.Cda1uhdF.js} +3 -3
- package/library/chunks/{document-viewer.b3Nej7rG.js → document-viewer.Bimlwspw.js} +14 -14
- package/library/chunks/{dot-pagination.ByrS9Fz0.js → dot-pagination.QSoeQPKs.js} +2 -2
- package/library/chunks/{drawer.B9v7mKrO.js → drawer.D7McF8LV.js} +2 -2
- package/library/chunks/{dropdown.BPVXbna1.js → dropdown.POAxHVKf.js} +4 -4
- package/library/chunks/{dynamic-select.D2zWyFJw.js → dynamic-select.CkyOkzsa.js} +5 -5
- package/library/chunks/{e-chart.Dbh7iFWT.js → e-chart.CYtsjq1T.js} +2 -2
- package/library/chunks/{element-clamp.CM3ydK4k.js → element-clamp.n_Lrq1kt.js} +2 -2
- package/library/chunks/{file-on-demand.BqWBYhdM.js → file-on-demand.CqlWEx1w.js} +16 -16
- package/library/chunks/{folder-select.oEUjUT-R.js → folder-select.Df1upp0M.js} +7 -7
- package/library/chunks/{format-time.QdzoTicK.js → format-time.JhYL2G9j.js} +1 -1
- package/library/chunks/{header.l6qj73ci.js → header.ClRvFgwz.js} +2 -2
- package/library/chunks/{i18n.BYpiX0kX.js → i18n.X_3rP_Iz.js} +2 -0
- package/library/chunks/{icon-button.4VGhMghV.js → icon-button.CAfxRI1U.js} +2 -2
- package/library/chunks/{iframe.CQ4J2A_9.js → iframe.DkQJMbzH.js} +1 -1
- package/library/chunks/{image-comparer.DMCUgZXb.js → image-comparer.CaUpG5Zj.js} +1 -1
- package/library/chunks/{image.DQCunWsS.js → image.CVuRwLzz.js} +2 -2
- package/library/chunks/{input.DWh_E1GV.js → input.C6fbxRuC.js} +1 -1
- package/library/chunks/{line-clamp.DgWfU-Yi.js → line-clamp.C8G30nOV.js} +2 -2
- package/library/chunks/{markdown.7JZ0SpEP.js → markdown.C6AfbcBc.js} +2 -2
- package/library/chunks/{masonry.CMGXrgQ8.js → masonry.Bd2v23iE.js} +3 -3
- package/library/chunks/{menu-item.CJFkQ-YV.js → menu-item.BotPBD7O.js} +3 -3
- package/library/chunks/{menu.BYeW0I0d.js → menu.YdOirIbC.js} +2 -2
- package/library/chunks/{option.Dk32KiRr.js → option.DXF1O3-h.js} +1 -1
- package/library/chunks/{padding-input-group.BlSd4VCs.js → padding-input-group.B8ph-5ls.js} +1 -1
- package/library/chunks/{pagination.C0Zu1uP7.js → pagination.B2hheBNY.js} +7 -7
- package/library/chunks/{popup.DaV-mbsU.js → popup.jgKP0_Eq.js} +1 -1
- package/library/chunks/{position-picker.mxReT7rl.js → position-picker.BSOusbGw.js} +1 -1
- package/library/chunks/{progress-bar.OOVw3Ho1.js → progress-bar.D5DPdmL-.js} +1 -1
- package/library/chunks/{progress-ring.DDNC-hmO.js → progress-ring.DAcWv9zS.js} +1 -1
- package/library/chunks/{radio-card.CbaIYFEi.js → radio-card.Bmd-28FP.js} +1 -1
- package/library/chunks/{range.1d77B-YM.js → range.CI4oCDot.js} +2 -2
- package/library/chunks/{rating.u1DIMFu_.js → rating.CwqqF6CH.js} +1 -1
- package/library/chunks/{relative-time.Ca958bVn.js → relative-time.CXeuhQzB.js} +1 -1
- package/library/chunks/{select.Blx7Am5x.js → select.D6nU_tMZ.js} +6 -6
- package/library/chunks/{shadow-input-group.E6JTidSM.js → shadow-input-group.DQDXISvK.js} +2 -2
- package/library/chunks/{share-option-list.CVazDKnW.js → share-option-list.B9Raz9GO.js} +2 -2
- package/library/chunks/{sidebar.2H_HDEhd.js → sidebar.7phLIXE9.js} +2 -2
- package/library/chunks/{size-input-group.CxTubAwO.js → size-input-group._YdmvlAr.js} +5 -5
- package/library/chunks/{spinner.AokDNIMB.js → spinner.BfyplUu3.js} +1 -1
- package/library/chunks/{split-panel.B0tLqJqx.js → split-panel.CUs1jgH4.js} +1 -1
- package/library/chunks/{src.BQtwu7L_.js → src.Bs5rZ16K.js} +1 -1
- package/library/chunks/{src.D6mhR5h1.js → src.tHpCbOII.js} +47 -47
- package/library/chunks/{step.qMEvWQSa.js → step.BRT1Duvf.js} +3 -3
- package/library/chunks/{stepper-wizard.DbU4i26F.js → stepper-wizard.CAzhXeYZ.js} +2 -2
- package/library/chunks/{stepper.BxTR5LWg.js → stepper.C_a00Rul.js} +1 -1
- package/library/chunks/{tab-group.CBg0wLFC.js → tab-group.Bj4mUm_k.js} +7 -7
- package/library/chunks/{tab.Dmb7JL1e.js → tab.BbIB084o.js} +3 -3
- package/library/chunks/{tag.BGu9ORJf.js → tag.3vLG7AWG.js} +3 -3
- package/library/chunks/{tooltip.CboSydrY.js → tooltip.CaAdk5m9.js} +2 -2
- package/library/chunks/{tree.CJcVgjAA.js → tree.D_yv5J9e.js} +3 -3
- package/library/chunks/{typeface.rz2bQ3m1.js → typeface.J4nY7adt.js} +3 -3
- package/library/chunks/{video.vPLA5d28.js → video.D07SfJEm.js} +3 -3
- package/library/components/alert.js +1 -1
- package/library/components/array-line-clamp.js +1 -1
- package/library/components/asset-link-format.js +1 -1
- package/library/components/atoms.js +50 -50
- package/library/components/audio.js +1 -1
- package/library/components/bicolor-picker.js +1 -1
- package/library/components/border-input-group.js +1 -1
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +1 -1
- package/library/components/color-picker.js +1 -1
- package/library/components/color-swatch-group.js +1 -1
- package/library/components/color-swatch.js +1 -1
- package/library/components/confirm-popover.js +1 -1
- package/library/components/copy-button.js +1 -1
- package/library/components/corner-position-input-group.js +1 -1
- package/library/components/date-calendar.js +1 -1
- package/library/components/details.js +1 -1
- package/library/components/dialog.js +1 -1
- package/library/components/document-viewer.js +1 -1
- package/library/components/dot-pagination.js +1 -1
- package/library/components/drawer.js +1 -1
- package/library/components/dropdown.js +1 -1
- package/library/components/dynamic-select.js +1 -1
- package/library/components/e-chart.js +1 -1
- package/library/components/element-clamp.js +1 -1
- package/library/components/file-on-demand.js +1 -1
- package/library/components/folder-select.js +1 -1
- package/library/components/format-bytes.js +1 -1
- package/library/components/format-date.js +1 -1
- package/library/components/format-number.js +1 -1
- package/library/components/format-time.js +1 -1
- package/library/components/header.js +1 -1
- package/library/components/icon-button.js +1 -1
- package/library/components/iframe.js +1 -1
- package/library/components/image-comparer.js +1 -1
- package/library/components/image.js +1 -1
- package/library/components/input.js +1 -1
- package/library/components/line-clamp.js +1 -1
- package/library/components/markdown.js +1 -1
- package/library/components/masonry.js +1 -1
- package/library/components/menu-item.js +1 -1
- package/library/components/menu.js +1 -1
- package/library/components/molecules.js +17 -17
- package/library/components/option.js +1 -1
- package/library/components/organisms.js +3 -3
- package/library/components/padding-input-group.js +1 -1
- package/library/components/pagination.js +1 -1
- package/library/components/popup.js +1 -1
- package/library/components/position-picker.js +1 -1
- package/library/components/progress-bar.js +1 -1
- package/library/components/progress-ring.js +1 -1
- package/library/components/radio-card.js +1 -1
- package/library/components/range.js +1 -1
- package/library/components/rating.js +1 -1
- package/library/components/relative-time.js +1 -1
- package/library/components/select.js +1 -1
- package/library/components/shadow-input-group.js +1 -1
- package/library/components/share-option-list.js +1 -1
- package/library/components/sidebar.js +1 -1
- package/library/components/size-input-group.js +1 -1
- package/library/components/spinner.js +1 -1
- package/library/components/split-panel.js +1 -1
- package/library/components/step.js +1 -1
- package/library/components/stepper-wizard.js +1 -1
- package/library/components/stepper.js +1 -1
- package/library/components/tab-group.js +1 -1
- package/library/components/tab.js +1 -1
- package/library/components/tag.js +1 -1
- package/library/components/tooltip.js +1 -1
- package/library/components/tree-item.js +1 -1
- package/library/components/tree.js +1 -1
- package/library/components/typeface.js +1 -1
- package/library/components/types.js +81 -81
- package/library/components/video.js +1 -1
- package/library/package.json +1 -1
- package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +43 -2
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-dimensions/asset-link-format-dimensions.d.ts +12 -3
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-quality/asset-link-format-quality.d.ts +1 -0
- package/library/packages/utils/src/custom-element/i18n.d.ts +2 -0
- package/library/react-web-component.d.ts +12 -4
- package/library/utils.js +2 -2
- package/package.json +1 -1
|
@@ -3,49 +3,50 @@ import { a as r, i, n as a, r as o, t as s } from "./cortex-element.DTrNUtdr.js"
|
|
|
3
3
|
import { t as c } from "./query.B1yi7t71.js";
|
|
4
4
|
import { t as l } from "./component.styles.0xM1ZmBs.js";
|
|
5
5
|
import { t as u } from "./custom-element.BEMYNDK1.js";
|
|
6
|
-
import { t as d } from "./i18n.
|
|
6
|
+
import { t as d } from "./i18n.X_3rP_Iz.js";
|
|
7
7
|
import { t as f } from "./watch.Ub5r8btz.js";
|
|
8
|
-
import { t as p } from "./icon-button.
|
|
8
|
+
import { t as p } from "./icon-button.CAfxRI1U.js";
|
|
9
9
|
import { t as m } from "./when.BUskJLtZ.js";
|
|
10
10
|
import { t as h } from "./icon.CeQpEaQz.js";
|
|
11
11
|
import { t as g } from "./style-map.DPGQIxip.js";
|
|
12
12
|
import { c as ee } from "./browser.gIznFIix.js";
|
|
13
|
-
import { t as _ } from "./button.
|
|
13
|
+
import { t as _ } from "./button.cbOwOkfp.js";
|
|
14
14
|
import { g as te } from "./string.TY0RTPc8.js";
|
|
15
|
-
import { t as ne } from "./tooltip.
|
|
15
|
+
import { t as ne } from "./tooltip.CaAdk5m9.js";
|
|
16
16
|
import { n as v } from "./position-picker.dY_vgF_H.js";
|
|
17
|
-
import { l as re, r as
|
|
18
|
-
import { t as
|
|
19
|
-
import { n as
|
|
20
|
-
import { t as
|
|
21
|
-
import { t as
|
|
22
|
-
import { t as
|
|
23
|
-
import { t as
|
|
24
|
-
import { t as
|
|
25
|
-
import { t as
|
|
26
|
-
import { t as
|
|
27
|
-
import { t as
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { t as
|
|
31
|
-
import {
|
|
32
|
-
import { t as
|
|
33
|
-
import { t as
|
|
34
|
-
import { t as
|
|
17
|
+
import { l as re, r as ie } from "./number.CNp5LKkv.js";
|
|
18
|
+
import { t as ae } from "./image.C0s1gL4z.js";
|
|
19
|
+
import { n as y, t as b } from "./typography.B0mkhqTB.js";
|
|
20
|
+
import { t as oe } from "./button-group.CPfXrqyq.js";
|
|
21
|
+
import { t as se } from "./checkbox.BzR50Is_.js";
|
|
22
|
+
import { t as ce } from "./math.od1DVmRk.js";
|
|
23
|
+
import { t as x } from "./repeat.CKv9FPlC.js";
|
|
24
|
+
import { t as le } from "./input.C6fbxRuC.js";
|
|
25
|
+
import { t as S } from "./option.DXF1O3-h.js";
|
|
26
|
+
import { t as C } from "./space.Dd8jezXK.js";
|
|
27
|
+
import { t as w } from "./select.D6nU_tMZ.js";
|
|
28
|
+
import { t as ue } from "./visually-hidden.Bv3SInZp.js";
|
|
29
|
+
import { D as de, E as fe, T as pe, b as me, f as he, g as ge, m as _e, x as ve } from "./src.Bs5rZ16K.js";
|
|
30
|
+
import { t as T } from "./details.tNVJTWTC.js";
|
|
31
|
+
import { t as ye } from "./divider.CqSNZCU8.js";
|
|
32
|
+
import { a as E, c as be, l as D, n as xe, o as O, r as k, s as A, t as j, u as M } from "./asset-link-format.D6L-qc3X.js";
|
|
33
|
+
import { t as Se } from "./menu-label.B-FOyfAX.js";
|
|
34
|
+
import { t as Ce } from "./switch.BuleQplE.js";
|
|
35
|
+
import { t as we } from "./v4.JyXW8GUB.js";
|
|
35
36
|
import "./cropper.D8Uu43xy.js";
|
|
36
|
-
import { t as
|
|
37
|
-
import { d as
|
|
38
|
-
import { t as
|
|
37
|
+
import { t as Te } from "./_baseUniq.h_pGICPH.js";
|
|
38
|
+
import { d as Ee, i as De, n as Oe, o as ke, p as N, r as Ae, s as je, t as Me } from "./string-array.F2GuxHp0.js";
|
|
39
|
+
import { t as Ne } from "./position-picker.BSOusbGw.js";
|
|
39
40
|
//#region ../../node_modules/lodash-es/uniq.js
|
|
40
|
-
function
|
|
41
|
-
return e && e.length ?
|
|
41
|
+
function Pe(e) {
|
|
42
|
+
return e && e.length ? Te(e) : [];
|
|
42
43
|
}
|
|
43
44
|
//#endregion
|
|
44
45
|
//#region ../../packages/services/src/api/asset/asset.utils.ts
|
|
45
|
-
function
|
|
46
|
+
function Fe(e) {
|
|
46
47
|
return typeof e == "object" && !!e && "URI" in e;
|
|
47
48
|
}
|
|
48
|
-
var
|
|
49
|
+
var Ie = {
|
|
49
50
|
artist: "Artist",
|
|
50
51
|
color: "Color",
|
|
51
52
|
createDate: "CreateDate",
|
|
@@ -67,34 +68,34 @@ var Ne = {
|
|
|
67
68
|
systemIdentifier: "SystemIdentifier",
|
|
68
69
|
text: "Text",
|
|
69
70
|
title: "Title"
|
|
70
|
-
},
|
|
71
|
+
}, Le = /* @__PURE__ */ new Set([
|
|
71
72
|
"mediaDate",
|
|
72
73
|
"createDate",
|
|
73
74
|
"editDate"
|
|
74
75
|
]);
|
|
75
|
-
function
|
|
76
|
+
function Re(e) {
|
|
76
77
|
return !/[\s&+/*"\\:(),'<>~|[\]{}]/.test(e) && !/^(?:OR|AND|NOT)$/.test(e) ? e : `"${e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
-
let n = (Array.isArray(t) ? t : [t]).map((t) => `${e}:${
|
|
79
|
+
function ze(e, t) {
|
|
80
|
+
let n = (Array.isArray(t) ? t : [t]).map((t) => `${e}:${Re(t)}`);
|
|
80
81
|
return n.length > 1 ? `(${n.join(" OR ")})` : n[0] ?? "";
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function Be(e, t) {
|
|
83
84
|
return (Array.isArray(t) ? t : [t]).map((t) => `${e}${t.operator}${t.value}`).join(" AND ");
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
+
function Ve(e) {
|
|
86
87
|
let t = [];
|
|
87
88
|
for (let n of Object.keys(e)) {
|
|
88
89
|
let r = n, i = e[r];
|
|
89
90
|
if (i == null) continue;
|
|
90
91
|
if (r === "custom") {
|
|
91
|
-
for (let [e, n] of Object.entries(i)) t.push(
|
|
92
|
+
for (let [e, n] of Object.entries(i)) t.push(ze(e, n));
|
|
92
93
|
continue;
|
|
93
94
|
}
|
|
94
|
-
let a =
|
|
95
|
+
let a = Ie[r];
|
|
95
96
|
if (a) {
|
|
96
|
-
if (
|
|
97
|
-
t.push(
|
|
97
|
+
if (Le.has(r)) {
|
|
98
|
+
t.push(Be(a, i));
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
101
|
if (r === "color") {
|
|
@@ -104,87 +105,87 @@ function Re(e) {
|
|
|
104
105
|
if (r === "parentFolderIdentifier") {
|
|
105
106
|
let e = Array.isArray(i) ? i : [i];
|
|
106
107
|
if (e.length === 0) continue;
|
|
107
|
-
let n = [...e.map((e) => `ParentFolderIdentifier:${
|
|
108
|
+
let n = [...e.map((e) => `ParentFolderIdentifier:${Re(String(e))}`), ...e.map((e) => `ParentAlbumIdentifier:${Re(String(e))}`)];
|
|
108
109
|
t.push(`(${n.join(" OR ")})`);
|
|
109
110
|
continue;
|
|
110
111
|
}
|
|
111
|
-
t.push(
|
|
112
|
+
t.push(ze(a, i));
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
return t.join(" AND ");
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
-
if ("and" in e) return e.and.map(
|
|
117
|
+
function He(e) {
|
|
118
|
+
if ("and" in e) return e.and.map(He).filter(Boolean).join(" AND ");
|
|
118
119
|
if ("or" in e) {
|
|
119
|
-
let t = e.or.map(
|
|
120
|
+
let t = e.or.map(He).filter(Boolean);
|
|
120
121
|
return t.length > 1 ? `(${t.join(" OR ")})` : t[0] ?? "";
|
|
121
122
|
}
|
|
122
123
|
if ("not" in e) {
|
|
123
|
-
let t =
|
|
124
|
+
let t = He(e.not);
|
|
124
125
|
return t ? `NOT (${t})` : "";
|
|
125
126
|
}
|
|
126
|
-
return
|
|
127
|
+
return Ve(e);
|
|
127
128
|
}
|
|
128
129
|
//#endregion
|
|
129
130
|
//#region ../../packages/services/src/api/asset/asset.ts
|
|
130
|
-
var
|
|
131
|
+
var Ue = "CoreField.LargeSizePreview", P = "CoreField.DocType", We = "Document.Title", Ge = "Document.CaptionLong", F = "Document.FileExtension", Ke = "CoreField.FileSize", qe = "CoreField.Identifier", Je = "CoreField.MaxHeight", Ye = "CoreField.MaxWidth", I = "Document.RecordID", Xe = "CoreField.DocSubType", Ze = "CoreField.TitleWithFallback", L = "CoreField.OriginalFileName", Qe = "__width", $e = "__height", et = "CoreField.OriginalPreview", tt = "Document.DocSubType", nt = "Document.InPoint", rt = "Document.OutPoint", it = {
|
|
131
132
|
DEFAULT_VIEW_SIZE: "Document.LargeSizePreview",
|
|
132
133
|
ORIGINAL_VIEW_SIZE: "Document.OriginalPreview"
|
|
133
|
-
},
|
|
134
|
-
[
|
|
135
|
-
[
|
|
136
|
-
},
|
|
137
|
-
function
|
|
138
|
-
return
|
|
134
|
+
}, at = {
|
|
135
|
+
[Ue]: it.DEFAULT_VIEW_SIZE,
|
|
136
|
+
[et]: it.ORIGINAL_VIEW_SIZE
|
|
137
|
+
}, ot = Object.fromEntries(Object.entries(at).map(([e, t]) => [t, e]));
|
|
138
|
+
function st(e) {
|
|
139
|
+
return at[e] ?? e;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
return e === "CoreField.TitleWithFallback" ? [
|
|
141
|
+
function ct(e) {
|
|
142
|
+
return e === "CoreField.TitleWithFallback" ? [We, L] : [st(e)];
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
+
function lt(e) {
|
|
144
145
|
let t = {};
|
|
145
146
|
for (let [n, r] of Object.entries(e)) {
|
|
146
|
-
let e =
|
|
147
|
+
let e = ot[n] ?? n;
|
|
147
148
|
t[e] = r;
|
|
148
149
|
}
|
|
149
150
|
return t;
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
-
e[n] =
|
|
152
|
+
function ut(e, t, n) {
|
|
153
|
+
e[n] = R(t, n);
|
|
153
154
|
let r = t[n];
|
|
154
|
-
return r != null &&
|
|
155
|
+
return r != null && Fe(r) && (typeof r.Width == "number" && r.Width > 0 && (e[`${n}${Qe}`] = String(r.Width)), typeof r.Height == "number" && r.Height > 0 && (e[`${n}${$e}`] = String(r.Height))), e;
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
+
function dt(e) {
|
|
157
158
|
let t = new URLSearchParams();
|
|
158
159
|
for (let [n, r] of Object.entries(e)) r != null && (Array.isArray(r) ? r.forEach((e) => t.append(n, String(e))) : t.append(n, String(r)));
|
|
159
160
|
return t;
|
|
160
161
|
}
|
|
161
|
-
async function
|
|
162
|
-
let m = n?.flatMap(
|
|
163
|
-
let t =
|
|
164
|
-
return h && (t[
|
|
162
|
+
async function ft({ consistency: e, countPerPage: t, fields: n, getPermanentAssetsPaths: r, httpMethod: i = "GET", isSiteBuilder: a, pageNumber: o, query: s, securityByPassToken: c, siteUrl: l, sort: u, throwOnError: d, token: f, useSession: p }) {
|
|
163
|
+
let m = n?.flatMap(ct), h = n?.includes("CoreField.TitleWithFallback") ?? !1, g = (e) => {
|
|
164
|
+
let t = lt(e);
|
|
165
|
+
return h && (t[Ze] = R(t, "Document.Title") || R(t, "CoreField.OriginalFileName")), t;
|
|
165
166
|
}, ee = {
|
|
166
167
|
Consistency: e || void 0,
|
|
167
168
|
CountPerPage: t,
|
|
168
|
-
Fields:
|
|
169
|
+
Fields: Pe(m),
|
|
169
170
|
Format: "json",
|
|
170
171
|
GetPermanentAssetsPaths: r ?? void 0,
|
|
171
172
|
PageNumber: o,
|
|
172
|
-
Query:
|
|
173
|
+
Query: He(s),
|
|
173
174
|
SecurityByPassToken: c || void 0,
|
|
174
175
|
Sort: u || void 0,
|
|
175
176
|
UseSession: p || void 0
|
|
176
177
|
}, _ = i === "POST";
|
|
177
178
|
try {
|
|
178
|
-
return (await
|
|
179
|
+
return (await N.request({
|
|
179
180
|
baseURL: l,
|
|
180
181
|
headers: f ? { Authorization: `Bearer ${f}` } : void 0,
|
|
181
182
|
method: i,
|
|
182
|
-
..._ ? { data: a ? ee :
|
|
183
|
+
..._ ? { data: a ? ee : dt(ee) } : {
|
|
183
184
|
params: ee,
|
|
184
185
|
paramsSerializer: { indexes: null }
|
|
185
186
|
},
|
|
186
187
|
responseType: "json",
|
|
187
|
-
transformResponse: [...Array.isArray(
|
|
188
|
+
transformResponse: [...Array.isArray(N.defaults.transformResponse) ? N.defaults.transformResponse : [], a ? (e) => ({
|
|
188
189
|
items: (e.results?.Items ?? []).map(g),
|
|
189
190
|
sort: e.results?.GlobalInfo?.Sort ?? "",
|
|
190
191
|
totalCount: e.results?.GlobalInfo?.TotalCount ?? 0
|
|
@@ -193,7 +194,7 @@ async function lt({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
193
194
|
sort: e.APIResponse?.GlobalInfo?.Sort ?? "",
|
|
194
195
|
totalCount: e.APIResponse?.GlobalInfo?.TotalCount ?? 0
|
|
195
196
|
})],
|
|
196
|
-
url: a ? _ ?
|
|
197
|
+
url: a ? _ ? je.SEARCH_ASSETS_POST : je.SEARCH_ASSETS : Ee["4.0"]
|
|
197
198
|
})).data;
|
|
198
199
|
} catch (e) {
|
|
199
200
|
if (d) throw e;
|
|
@@ -204,9 +205,9 @@ async function lt({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
204
205
|
};
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
|
-
async function
|
|
208
|
+
async function pt({ assetId: e, extension: t, format: n, siteUrl: r, token: i, transformations: a, useSession: o }) {
|
|
208
209
|
try {
|
|
209
|
-
return (await
|
|
210
|
+
return (await N.request({
|
|
210
211
|
baseURL: r,
|
|
211
212
|
method: "GET",
|
|
212
213
|
params: {
|
|
@@ -218,19 +219,19 @@ async function ut({ assetId: e, extension: t, format: n, siteUrl: r, token: i, t
|
|
|
218
219
|
UseSession: o || void 0
|
|
219
220
|
},
|
|
220
221
|
timeout: 3e5,
|
|
221
|
-
url:
|
|
222
|
+
url: Ae.GET_TRANSFORM_ASSET_LINK
|
|
222
223
|
})).data;
|
|
223
224
|
} catch {
|
|
224
225
|
return null;
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
|
-
var
|
|
228
|
-
function
|
|
228
|
+
var mt = 50;
|
|
229
|
+
function ht(e, t) {
|
|
229
230
|
let n = [];
|
|
230
231
|
for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
|
|
231
232
|
return n;
|
|
232
233
|
}
|
|
233
|
-
async function
|
|
234
|
+
async function gt({ consistency: e, extraFields: t, getPermanentAssetsPaths: n, isSiteBuilder: r, recordIds: i, securityByPassToken: a, throwOnError: o, token: s }) {
|
|
234
235
|
if (!Array.isArray(i) || i.length === 0) return {
|
|
235
236
|
facets: [],
|
|
236
237
|
items: [],
|
|
@@ -238,11 +239,11 @@ async function pt({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
|
|
|
238
239
|
};
|
|
239
240
|
let c = t?.filter((e) => e && typeof e == "string") ?? [], l = [
|
|
240
241
|
...c,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
], u =
|
|
242
|
+
L,
|
|
243
|
+
We,
|
|
244
|
+
Ge,
|
|
245
|
+
I
|
|
246
|
+
], u = ht(i, mt), d = await Promise.all(u.map((t) => ft({
|
|
246
247
|
consistency: e,
|
|
247
248
|
countPerPage: t.length,
|
|
248
249
|
fields: l,
|
|
@@ -258,18 +259,18 @@ async function pt({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
|
|
|
258
259
|
return {
|
|
259
260
|
facets: [],
|
|
260
261
|
items: d.flatMap((e) => e.items).map((e) => ({
|
|
261
|
-
name:
|
|
262
|
-
recordId:
|
|
263
|
-
...c.reduce((t, n) =>
|
|
262
|
+
name: R(e, L),
|
|
263
|
+
recordId: R(e, I),
|
|
264
|
+
...c.reduce((t, n) => ut(t, e, n), {})
|
|
264
265
|
})).sort((e, t) => (f.get(e.recordId) ?? Infinity) - (f.get(t.recordId) ?? Infinity)),
|
|
265
266
|
totalCount: d.reduce((e, t) => e + t.totalCount, 0)
|
|
266
267
|
};
|
|
267
268
|
}
|
|
268
|
-
function
|
|
269
|
+
function R(e, t) {
|
|
269
270
|
let n = e[t];
|
|
270
|
-
return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) :
|
|
271
|
+
return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) : Fe(n) ? n.URI : "";
|
|
271
272
|
}
|
|
272
|
-
async function
|
|
273
|
+
async function _t({ consistency: e, countPerPage: t, directParentFolderIdentifier: n, extraFields: r, getPermanentAssetsPaths: i, isSiteBuilder: a, limitedDocTypes: o, pageNumber: s, parentFolderIdentifier: c, searchTerm: l, securityByPassToken: u, sortOrder: d, throwOnError: f, token: p }) {
|
|
273
274
|
if (!n && !c) return {
|
|
274
275
|
facets: [],
|
|
275
276
|
items: [],
|
|
@@ -280,19 +281,19 @@ async function mt({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
280
281
|
parentFolderIdentifier: c,
|
|
281
282
|
...l ? { text: l } : {},
|
|
282
283
|
...o && o.length > 0 ? { docType: o } : {}
|
|
283
|
-
}, g = await
|
|
284
|
+
}, g = await ft({
|
|
284
285
|
consistency: e,
|
|
285
286
|
countPerPage: t,
|
|
286
287
|
fields: [
|
|
287
288
|
...m,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
Ze,
|
|
290
|
+
Ke,
|
|
291
|
+
P,
|
|
292
|
+
Xe,
|
|
291
293
|
qe,
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
z
|
|
294
|
+
F,
|
|
295
|
+
I,
|
|
296
|
+
L
|
|
296
297
|
],
|
|
297
298
|
getPermanentAssetsPaths: i,
|
|
298
299
|
httpMethod: "POST",
|
|
@@ -307,27 +308,27 @@ async function mt({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
307
308
|
return {
|
|
308
309
|
facets: [],
|
|
309
310
|
items: g.items.map((e) => {
|
|
310
|
-
let t =
|
|
311
|
+
let t = R(e, F);
|
|
311
312
|
t && !t.startsWith(".") && (t = "." + t);
|
|
312
|
-
let n =
|
|
313
|
+
let n = R(e, I);
|
|
313
314
|
return {
|
|
314
|
-
docSubType:
|
|
315
|
-
docType:
|
|
315
|
+
docSubType: R(e, Xe),
|
|
316
|
+
docType: R(e, "CoreField.DocType") || "",
|
|
316
317
|
extension: t,
|
|
317
318
|
id: n,
|
|
318
|
-
identifier:
|
|
319
|
-
name:
|
|
319
|
+
identifier: R(e, qe),
|
|
320
|
+
name: R(e, L),
|
|
320
321
|
recordId: n,
|
|
321
|
-
size:
|
|
322
|
-
...m.reduce((t, n) =>
|
|
322
|
+
size: R(e, "CoreField.FileSize") || "0 MB",
|
|
323
|
+
...m.reduce((t, n) => ut(t, e, n), {})
|
|
323
324
|
};
|
|
324
325
|
}),
|
|
325
326
|
totalCount: g.totalCount
|
|
326
327
|
};
|
|
327
328
|
}
|
|
328
|
-
async function
|
|
329
|
+
async function vt({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, useSession: i }) {
|
|
329
330
|
try {
|
|
330
|
-
return (await
|
|
331
|
+
return (await N.request({
|
|
331
332
|
method: "GET",
|
|
332
333
|
params: {
|
|
333
334
|
AutoCropMode: e,
|
|
@@ -338,21 +339,21 @@ async function ht({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, u
|
|
|
338
339
|
},
|
|
339
340
|
responseType: "json",
|
|
340
341
|
timeout: 3e5,
|
|
341
|
-
transformResponse: [...Array.isArray(
|
|
342
|
+
transformResponse: [...Array.isArray(N.defaults.transformResponse) ? N.defaults.transformResponse : [], (e) => ({
|
|
342
343
|
height: e.cropHeight,
|
|
343
344
|
width: e.cropWidth,
|
|
344
345
|
x: e.cropX,
|
|
345
346
|
y: e.cropY
|
|
346
347
|
})],
|
|
347
|
-
url:
|
|
348
|
+
url: Ae.GET_CROP_ZONE_SUGGESTION
|
|
348
349
|
})).data;
|
|
349
350
|
} catch {
|
|
350
351
|
return null;
|
|
351
352
|
}
|
|
352
353
|
}
|
|
353
|
-
async function
|
|
354
|
+
async function yt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, useSession: i }) {
|
|
354
355
|
try {
|
|
355
|
-
return (await
|
|
356
|
+
return (await N.request({
|
|
356
357
|
baseURL: n,
|
|
357
358
|
method: "GET",
|
|
358
359
|
params: {
|
|
@@ -361,7 +362,7 @@ async function gt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
|
|
|
361
362
|
UseSession: i || void 0
|
|
362
363
|
},
|
|
363
364
|
responseType: "json",
|
|
364
|
-
transformResponse: [...Array.isArray(
|
|
365
|
+
transformResponse: [...Array.isArray(N.defaults.transformResponse) ? N.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? [] : e.proxies?.map((e) => ({
|
|
365
366
|
cdnName: e.cdnName,
|
|
366
367
|
extension: e.extension,
|
|
367
368
|
formatHeight: e.formatHeight,
|
|
@@ -372,31 +373,31 @@ async function gt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
|
|
|
372
373
|
proxyName: e.proxyName,
|
|
373
374
|
width: e.width
|
|
374
375
|
})) ?? []],
|
|
375
|
-
url: t ?
|
|
376
|
+
url: t ? je.GET_AVAILABLE_PROXIES : ke
|
|
376
377
|
})).data;
|
|
377
378
|
} catch {
|
|
378
379
|
return [];
|
|
379
380
|
}
|
|
380
381
|
}
|
|
381
|
-
async function
|
|
382
|
+
async function bt({ siteUrl: e } = {}) {
|
|
382
383
|
try {
|
|
383
|
-
return (await
|
|
384
|
+
return (await N.request({
|
|
384
385
|
baseURL: e,
|
|
385
386
|
method: "GET",
|
|
386
387
|
responseType: "json",
|
|
387
|
-
transformResponse: [...Array.isArray(
|
|
388
|
+
transformResponse: [...Array.isArray(N.defaults.transformResponse) ? N.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? { formatsByDocType: {
|
|
388
389
|
Audio: {},
|
|
389
390
|
Image: {},
|
|
390
391
|
Multimedia: {},
|
|
391
392
|
Video: {}
|
|
392
393
|
} } : { formatsByDocType: e.formatsByDocType ?? {} }],
|
|
393
|
-
url:
|
|
394
|
+
url: Oe
|
|
394
395
|
})).data;
|
|
395
396
|
} catch {
|
|
396
397
|
return { formatsByDocType: {} };
|
|
397
398
|
}
|
|
398
399
|
}
|
|
399
|
-
async function
|
|
400
|
+
async function xt({ recordIds: e, rightsToCheck: t }) {
|
|
400
401
|
let n = {
|
|
401
402
|
authorizedObjects: [],
|
|
402
403
|
forbiddenObjectsOfReadPermission: [],
|
|
@@ -404,7 +405,7 @@ async function vt({ recordIds: e, rightsToCheck: t }) {
|
|
|
404
405
|
invalidObjects: []
|
|
405
406
|
};
|
|
406
407
|
try {
|
|
407
|
-
let { data: n } = await
|
|
408
|
+
let { data: n } = await N.request({
|
|
408
409
|
method: "GET",
|
|
409
410
|
params: {
|
|
410
411
|
RecordIDs: e,
|
|
@@ -412,7 +413,7 @@ async function vt({ recordIds: e, rightsToCheck: t }) {
|
|
|
412
413
|
},
|
|
413
414
|
paramsSerializer: { indexes: null },
|
|
414
415
|
responseType: "json",
|
|
415
|
-
url:
|
|
416
|
+
url: De.GET_AUTHORIZED_OBJECTS
|
|
416
417
|
});
|
|
417
418
|
return n;
|
|
418
419
|
} catch {
|
|
@@ -421,7 +422,7 @@ async function vt({ recordIds: e, rightsToCheck: t }) {
|
|
|
421
422
|
}
|
|
422
423
|
//#endregion
|
|
423
424
|
//#region ../../packages/tools/src/fetch-image/fetch-image.ts
|
|
424
|
-
var
|
|
425
|
+
var St = 20, z = "TR1", B = "TRX", Ct = /* @__PURE__ */ new Set([".gif"]), wt = /* @__PURE__ */ new Set([
|
|
425
426
|
".avif",
|
|
426
427
|
".bmp",
|
|
427
428
|
".gif",
|
|
@@ -432,18 +433,18 @@ var yt = 20, V = "TR1", H = "TRX", bt = /* @__PURE__ */ new Set([".gif"]), xt =
|
|
|
432
433
|
".svg",
|
|
433
434
|
".webp"
|
|
434
435
|
]);
|
|
435
|
-
function
|
|
436
|
+
function Tt(e) {
|
|
436
437
|
let t = e.toLowerCase(), n = t.startsWith(".") ? t : `.${t}`;
|
|
437
|
-
return
|
|
438
|
+
return wt.has(n);
|
|
438
439
|
}
|
|
439
|
-
function
|
|
440
|
-
return e !== void 0 && e !== "" && e !==
|
|
440
|
+
function Et(e, t) {
|
|
441
|
+
return e !== void 0 && e !== "" && e !== be.Image ? !1 : !t || Tt(t);
|
|
441
442
|
}
|
|
442
|
-
function
|
|
443
|
-
let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${
|
|
443
|
+
function Dt({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i, item: a, manualFormat: o, size: s, useExpiringAssetUrls: c }) {
|
|
444
|
+
let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${z}`, f = (n, r) => {
|
|
444
445
|
let i = a[n];
|
|
445
446
|
if (!i) return;
|
|
446
|
-
let s = a[`${n}${
|
|
447
|
+
let s = a[`${n}${Qe}`], u = a[`${n}${$e}`], d = e && !c ? he(i, [], {
|
|
447
448
|
autoFormat: !o,
|
|
448
449
|
extension: l,
|
|
449
450
|
format: r
|
|
@@ -452,31 +453,31 @@ function wt({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i
|
|
|
452
453
|
maxHeight: u,
|
|
453
454
|
maxWidth: s,
|
|
454
455
|
src: d,
|
|
455
|
-
srcset: t && !c ?
|
|
456
|
+
srcset: t && !c ? _e(d, {
|
|
456
457
|
extension: l,
|
|
457
458
|
format: r,
|
|
458
|
-
maxWidth:
|
|
459
|
+
maxWidth: ve(o, s)
|
|
459
460
|
}) : ""
|
|
460
461
|
};
|
|
461
462
|
};
|
|
462
463
|
if (c) {
|
|
463
|
-
let e =
|
|
464
|
+
let e = fe(a, Et(n, l), l);
|
|
464
465
|
return e ? f(e) ?? {} : {};
|
|
465
466
|
}
|
|
466
467
|
if (!o) {
|
|
467
|
-
let e =
|
|
468
|
-
return f(`path_${e}`, e) ?? f(d,
|
|
468
|
+
let e = me(l, s);
|
|
469
|
+
return f(`path_${e}`, e) ?? f(d, z) ?? {};
|
|
469
470
|
}
|
|
470
471
|
let p = i ? `path_${i}` : void 0;
|
|
471
|
-
return p && a[p] ? i !==
|
|
472
|
+
return p && a[p] ? i !== B || Et(n, l) ? f(p, i) ?? {} : f(d, z) ?? {} : l && Ct.has(u) ? f(`path_${B}`, B) ?? f(d, z) ?? {} : f(d, z) ?? {};
|
|
472
473
|
}
|
|
473
|
-
var
|
|
474
|
+
var Ot = class {
|
|
474
475
|
constructor(e, t) {
|
|
475
|
-
this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = Infinity, this.pageSize =
|
|
476
|
+
this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = Infinity, this.pageSize = St, this.requestEpoch = 0, this.host = e, this.host.addController?.(this);
|
|
476
477
|
let n = t?.maxEnd;
|
|
477
478
|
this.maxEnd = typeof n == "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : Infinity;
|
|
478
479
|
let r = t?.pageSize;
|
|
479
|
-
this.pageSize = typeof r == "number" && Number.isFinite(r) && r >= 1 ? Math.floor(r) :
|
|
480
|
+
this.pageSize = typeof r == "number" && Number.isFinite(r) && r >= 1 ? Math.floor(r) : St, this.authToken = t?.token, this.securityByPassToken = t?.securityByPassToken, this.isSiteBuilder = t?.isSiteBuilder ?? !1, this.autoFormat = t?.autoFormat ?? !1, this.buildSrcset = t?.buildSrcset ?? !1, this.consistency = t?.consistency;
|
|
480
481
|
}
|
|
481
482
|
get totalDataCount() {
|
|
482
483
|
return this.totalCount;
|
|
@@ -485,34 +486,34 @@ var Tt = class {
|
|
|
485
486
|
this.securityByPassToken !== e && (this.securityByPassToken = e, this.resetPageCache());
|
|
486
487
|
}
|
|
487
488
|
setPageSize(e) {
|
|
488
|
-
let t = Number.isFinite(e) && e >= 1 ? Math.floor(e) :
|
|
489
|
+
let t = Number.isFinite(e) && e >= 1 ? Math.floor(e) : St;
|
|
489
490
|
if (this.pageSize === t) return;
|
|
490
491
|
let n = this.fetchedPages.size > 0;
|
|
491
492
|
n && t < this.pageSize || (this.pageSize = t, n && (this.requestEpoch += 1, this.fetchedPages.clear()));
|
|
492
493
|
}
|
|
493
494
|
async fetchImages({ end: e, extraFields: t = [], format: n, manualFormat: r = !0, start: i, throwOnError: a = !1, transformations: o }) {
|
|
494
495
|
if (e < i || this.totalCount > 0 && e >= this.totalCount && (e = this.totalCount - 1, e < i)) return this.data;
|
|
495
|
-
let s = this.requestEpoch, c =
|
|
496
|
+
let s = this.requestEpoch, c = pe(this.host.ownerDocument.defaultView);
|
|
496
497
|
if (!this.folderId || s !== this.requestEpoch) return this.data;
|
|
497
|
-
let l = n ? `path_${n}` : void 0, u = `path_${
|
|
498
|
+
let l = n ? `path_${n}` : void 0, u = `path_${z}`, d = `path_${B}`, f = c ? [u, d] : [...new Set([
|
|
498
499
|
l,
|
|
499
500
|
u,
|
|
500
501
|
d
|
|
501
502
|
].filter((e) => !!e))], p = Math.floor(i / this.pageSize) + 1, m = Math.floor(e / this.pageSize) + 1;
|
|
502
503
|
for (let e = p; e <= m; e++) {
|
|
503
504
|
if (this.fetchedPages.has(e)) continue;
|
|
504
|
-
let i = await
|
|
505
|
+
let i = await _t({
|
|
505
506
|
consistency: this.consistency,
|
|
506
507
|
countPerPage: this.pageSize,
|
|
507
508
|
directParentFolderIdentifier: this.folderId,
|
|
508
509
|
extraFields: [...t, ...f],
|
|
509
|
-
getPermanentAssetsPaths:
|
|
510
|
+
getPermanentAssetsPaths: de(this.host.ownerDocument.defaultView),
|
|
510
511
|
isSiteBuilder: this.isSiteBuilder,
|
|
511
512
|
limitedDocTypes: [
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
be.Image,
|
|
514
|
+
be.Audio,
|
|
515
|
+
be.Video,
|
|
516
|
+
be.Multimedia
|
|
516
517
|
],
|
|
517
518
|
pageNumber: e,
|
|
518
519
|
searchTerm: "",
|
|
@@ -526,7 +527,7 @@ var Tt = class {
|
|
|
526
527
|
let e = Math.min(this.maxEnd, i.totalCount);
|
|
527
528
|
this.totalCount = e, this.data = Array.from({ length: e }, () => ({
|
|
528
529
|
alt: "",
|
|
529
|
-
id: `temp-${
|
|
530
|
+
id: `temp-${we()}`,
|
|
530
531
|
name: "",
|
|
531
532
|
src: ""
|
|
532
533
|
}));
|
|
@@ -535,7 +536,7 @@ var Tt = class {
|
|
|
535
536
|
for (let e = 0; e < i.items.length; e++) {
|
|
536
537
|
let a = l + e;
|
|
537
538
|
if (a < this.data.length) {
|
|
538
|
-
let s = i.items[e], { maxHeight: l, maxWidth: u, src: d, srcset: f } =
|
|
539
|
+
let s = i.items[e], { maxHeight: l, maxWidth: u, src: d, srcset: f } = Dt({
|
|
539
540
|
autoFormat: this.autoFormat,
|
|
540
541
|
buildSrcset: this.buildSrcset,
|
|
541
542
|
docType: s.docType,
|
|
@@ -546,7 +547,7 @@ var Tt = class {
|
|
|
546
547
|
size: s.size,
|
|
547
548
|
useExpiringAssetUrls: c
|
|
548
549
|
}), p = d, m = f;
|
|
549
|
-
!c && p && o && o.length > 0 && (p =
|
|
550
|
+
!c && p && o && o.length > 0 && (p = he(p, o), m = ""), this.data[a] = {
|
|
550
551
|
alt: s.name,
|
|
551
552
|
docType: s.docType,
|
|
552
553
|
extension: s.extension,
|
|
@@ -589,39 +590,39 @@ var Tt = class {
|
|
|
589
590
|
}
|
|
590
591
|
async fetchImagesByIDs({ extraFields: e = [], format: t, manualFormat: n = !0, recordIds: r, throwOnError: i = !1, transformations: a }) {
|
|
591
592
|
if (r.length === 0) return [];
|
|
592
|
-
let o =
|
|
593
|
+
let o = pe(this.host.ownerDocument.defaultView), s = t ? `path_${t}` : void 0, c = `path_${z}`, l = `path_${B}`, u = o ? [c, l] : [...new Set([
|
|
593
594
|
s,
|
|
594
595
|
c,
|
|
595
596
|
l
|
|
596
|
-
].filter((e) => !!e))], d = [
|
|
597
|
-
return (await
|
|
597
|
+
].filter((e) => !!e))], d = [F, ...o ? [] : [Ke]], f = [...e, P];
|
|
598
|
+
return (await gt({
|
|
598
599
|
consistency: this.consistency,
|
|
599
600
|
extraFields: [
|
|
600
601
|
...f,
|
|
601
602
|
...u,
|
|
602
603
|
...d
|
|
603
604
|
].filter((e) => e !== ""),
|
|
604
|
-
getPermanentAssetsPaths:
|
|
605
|
+
getPermanentAssetsPaths: de(this.host.ownerDocument.defaultView),
|
|
605
606
|
isSiteBuilder: this.isSiteBuilder,
|
|
606
607
|
recordIds: r,
|
|
607
608
|
securityByPassToken: this.securityByPassToken,
|
|
608
609
|
throwOnError: i,
|
|
609
610
|
token: this.authToken
|
|
610
611
|
})).items.map((e) => {
|
|
611
|
-
let { maxHeight: r, maxWidth: i, src: s, srcset: c } =
|
|
612
|
+
let { maxHeight: r, maxWidth: i, src: s, srcset: c } = Dt({
|
|
612
613
|
autoFormat: this.autoFormat,
|
|
613
614
|
buildSrcset: this.buildSrcset,
|
|
614
|
-
docType: e[
|
|
615
|
-
extension: e[
|
|
615
|
+
docType: e[P],
|
|
616
|
+
extension: e[F],
|
|
616
617
|
format: t,
|
|
617
618
|
item: e,
|
|
618
619
|
manualFormat: n,
|
|
619
|
-
size: e[
|
|
620
|
+
size: e[Ke],
|
|
620
621
|
useExpiringAssetUrls: o
|
|
621
622
|
}), l = s, u = c;
|
|
622
|
-
return !o && l && a && a.length > 0 && (l =
|
|
623
|
+
return !o && l && a && a.length > 0 && (l = he(l, a), u = ""), {
|
|
623
624
|
alt: e.name,
|
|
624
|
-
docType: e[
|
|
625
|
+
docType: e[P],
|
|
625
626
|
extension: e["Document.FileExtension"] || "",
|
|
626
627
|
id: e.recordId,
|
|
627
628
|
maxHeight: r,
|
|
@@ -688,46 +689,46 @@ var Tt = class {
|
|
|
688
689
|
resetFolderState() {
|
|
689
690
|
this.resetPageCache();
|
|
690
691
|
}
|
|
691
|
-
},
|
|
692
|
-
static #e =
|
|
692
|
+
}, kt = t`.asset-link-format__panel{position:relative}.asset-link-format--formats .asset-link-format__panel:not(:last-child){border-bottom:1px solid var(--cx-color-neutral-200)}.asset-link-format__panel--placeholder,.asset-link-format--formats .asset-link-format__panel--placeholder:not(:last-child){height:var(--cx-spacing-3x-small);background-color:var(--cx-color-primary);border:none;overflow:hidden}.asset-link-format__panel--placeholder>*{visibility:hidden}.asset-link-format__drag-handle{cursor:grab;touch-action:none;width:max-content;margin-inline:auto;position:absolute;inset-block-start:calc(var(--cx-spacing-small) + var(--cx-font-size-3x-large) / 2);inset-inline:0;transform:translateY(-50%)}.asset-link-format__drag-handle::part(base){cursor:grab}.asset-link-format__drag-handle:active,.asset-link-format__drag-handle:active::part(base){cursor:grabbing}.asset-link-format__drag-handle::part(icon){color:var(--cx-color-neutral-300);rotate:90deg}.asset-link-format__announcement{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.asset-link-format__order-hint{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border-bottom:1px solid var(--cx-color-neutral-200);color:var(--cx-input-help-text-color);font:var(--cx-font-label-x-small)}.asset-link-format__details{--header-padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__details::part(icon){width:var(--cx-font-size-3x-large);height:var(--cx-font-size-3x-large);background-color:var(--cx-color-neutral-100);border-radius:var(--cx-border-radius-large);color:var(--cx-color-neutral-600);font-size:var(--cx-font-size-large);justify-content:center;align-items:center;display:flex}.asset-link-format__details::part(input-label){color:var(--cx-color-neutral-400);margin-inline-start:var(--cx-spacing-small)}.asset-link-format__formats-summary{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__formats-summary cx-typography{--font-weight:var(--cx-font-weight-medium)}.asset-link-format__formats-summary [part=icon]{width:var(--cx-font-size-3x-large);height:var(--cx-font-size-3x-large);background-color:var(--cx-color-neutral-100);border-radius:var(--cx-border-radius-large);color:var(--cx-color-neutral-600);font-size:var(--cx-font-size-large);justify-content:center;align-items:center;display:flex}.asset-link-format__formats-crop cx-asset-link-format-crop{box-sizing:border-box;width:100%;padding:0 var(--cx-spacing-medium) var(--cx-spacing-small)}.asset-link-format__header{padding:var(--cx-spacing-medium)}.asset-link-format__section-header{padding:0 var(--cx-spacing-medium);border-top:var(--section-header-border-width,1px) solid var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-50)}.asset-link-format__undo,.asset-link-format__reset{--color:var(--cx-color-primary);--background-color:transparent}.asset-link-format__footer,.asset-link-format__footer>slot{display:block}`, At = t`:host([inline]){display:block}cx-details::part(base){border-bottom-width:0}.details--inline::part(base){border-width:0}.details--inline::part(header){display:none}.details--inline::part(content){padding:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}.crop__limit{color:var(--cx-input-help-text-color);margin-block-start:calc(-1 * var(--spacing-container-gap))}.crop__limit:empty{position:absolute}`, V, H = class extends s {
|
|
693
|
+
static #e = V = this;
|
|
693
694
|
constructor(...e) {
|
|
694
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit =
|
|
695
|
-
[
|
|
695
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit = M.Pixel, this.disabledApply = !1, this.noRatioModes = !1, this.showPositionPicker = !1, this.hasCropper = !1, this.dimensionsLimited = !1, this.lastAppliedSetting = {
|
|
696
|
+
[M.Pixel]: {
|
|
696
697
|
height: 0,
|
|
697
698
|
percentageHeight: 100,
|
|
698
699
|
percentageWidth: 100,
|
|
699
|
-
unit:
|
|
700
|
+
unit: M.Pixel,
|
|
700
701
|
width: 0,
|
|
701
702
|
x: 0,
|
|
702
703
|
y: 0
|
|
703
704
|
},
|
|
704
|
-
[
|
|
705
|
+
[M.AspectRatio]: {
|
|
705
706
|
height: 1,
|
|
706
707
|
percentageHeight: 100,
|
|
707
708
|
percentageWidth: 100,
|
|
708
|
-
unit:
|
|
709
|
+
unit: M.AspectRatio,
|
|
709
710
|
width: 1,
|
|
710
711
|
x: 0,
|
|
711
712
|
y: 0
|
|
712
713
|
}
|
|
713
714
|
}, this.loading = !1, this.cropModes = [], this.focusModes = [], this.focusMode = "manual", this.cropMode = "free", this.position = v.CenterCenter, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
714
715
|
}
|
|
715
|
-
static #t = this.styles = [l,
|
|
716
|
+
static #t = this.styles = [l, At];
|
|
716
717
|
static #n = this.dependencies = {
|
|
717
718
|
"cx-button": _,
|
|
718
|
-
"cx-details":
|
|
719
|
-
"cx-divider":
|
|
719
|
+
"cx-details": T,
|
|
720
|
+
"cx-divider": ye,
|
|
720
721
|
"cx-icon": h,
|
|
721
722
|
"cx-icon-button": p,
|
|
722
|
-
"cx-input":
|
|
723
|
-
"cx-option":
|
|
724
|
-
"cx-position-picker":
|
|
725
|
-
"cx-select":
|
|
726
|
-
"cx-space":
|
|
727
|
-
"cx-typography":
|
|
723
|
+
"cx-input": le,
|
|
724
|
+
"cx-option": S,
|
|
725
|
+
"cx-position-picker": Ne,
|
|
726
|
+
"cx-select": w,
|
|
727
|
+
"cx-space": C,
|
|
728
|
+
"cx-typography": b
|
|
728
729
|
};
|
|
729
730
|
static getRatioSize(e, t, n, r, i) {
|
|
730
|
-
return n ===
|
|
731
|
+
return n === M.Pixel && Number.isFinite(r) && Number.isFinite(i) ? ae(r, i, e, t) : {
|
|
731
732
|
height: t,
|
|
732
733
|
width: e
|
|
733
734
|
};
|
|
@@ -745,11 +746,11 @@ var Tt = class {
|
|
|
745
746
|
return;
|
|
746
747
|
}
|
|
747
748
|
if (this.keepAspectRatio) {
|
|
748
|
-
if (this.unit ===
|
|
749
|
+
if (this.unit === M.Pixel && this.width && this.height) {
|
|
749
750
|
this.aspectRatio = this.width / this.height;
|
|
750
751
|
return;
|
|
751
752
|
}
|
|
752
|
-
if (this.unit ===
|
|
753
|
+
if (this.unit === M.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
753
754
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
754
755
|
return;
|
|
755
756
|
}
|
|
@@ -777,9 +778,9 @@ var Tt = class {
|
|
|
777
778
|
this.invalidWidth = !0;
|
|
778
779
|
return;
|
|
779
780
|
}
|
|
780
|
-
this.invalidWidth = !1, t = Math.min(t,
|
|
781
|
-
let n = this.unit ===
|
|
782
|
-
this.keepAspectRatio ? n = Math.max(Math.round(t / this.aspectRatio), 1) : this.unit ===
|
|
781
|
+
this.invalidWidth = !1, t = Math.min(t, A), this.unit === M.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1));
|
|
782
|
+
let n = this.unit === M.Pixel ? this.height : this.ratioHeight, r = !1;
|
|
783
|
+
this.keepAspectRatio ? n = Math.max(Math.round(t / this.aspectRatio), 1) : this.unit === M.AspectRatio && ([t, n] = this.fitRatioSides(t, n, this.maxWidth, this.maxHeight));
|
|
783
784
|
let i = this.getSideMax(this.maxHeight);
|
|
784
785
|
n > i && (n = i, r = this.keepAspectRatio), r ||= this.#a(t, n), e.target.value = t.toString(), this.invalidHeight = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
785
786
|
breakAspectRatio: r,
|
|
@@ -795,9 +796,9 @@ var Tt = class {
|
|
|
795
796
|
this.invalidHeight = !0;
|
|
796
797
|
return;
|
|
797
798
|
}
|
|
798
|
-
this.invalidHeight = !1, t = Math.min(t,
|
|
799
|
-
let n = this.unit ===
|
|
800
|
-
this.keepAspectRatio ? n = Math.max(Math.round(t * this.aspectRatio), 1) : this.unit ===
|
|
799
|
+
this.invalidHeight = !1, t = Math.min(t, A), this.unit === M.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1));
|
|
800
|
+
let n = this.unit === M.Pixel ? this.width : this.ratioWidth, r = !1;
|
|
801
|
+
this.keepAspectRatio ? n = Math.max(Math.round(t * this.aspectRatio), 1) : this.unit === M.AspectRatio && ([t, n] = this.fitRatioSides(t, n, this.maxHeight, this.maxWidth));
|
|
801
802
|
let i = this.getSideMax(this.maxWidth);
|
|
802
803
|
n > i && (n = i, r = this.keepAspectRatio), r ||= this.#a(n, t), e.target.value = t.toString(), this.invalidWidth = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
803
804
|
breakAspectRatio: r,
|
|
@@ -810,17 +811,17 @@ var Tt = class {
|
|
|
810
811
|
onCropModeChange(e) {
|
|
811
812
|
let t = e.target.value, n = this.cropModes.find((e) => e.value === t)?.auto;
|
|
812
813
|
if (t === "free") this.selectedMode?.auto && this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
813
|
-
height: this.lastAppliedSetting[
|
|
814
|
+
height: this.lastAppliedSetting[M.Pixel].height,
|
|
814
815
|
keepAspectRatio: !1,
|
|
815
816
|
silent: !0,
|
|
816
|
-
unit:
|
|
817
|
-
width: this.lastAppliedSetting[
|
|
817
|
+
unit: M.Pixel,
|
|
818
|
+
width: this.lastAppliedSetting[M.Pixel].width
|
|
818
819
|
} });
|
|
819
|
-
else if (!n) {
|
|
820
|
-
let [e, n] = t.split(":").map(Number), r = this.unit ===
|
|
820
|
+
else if (!n && /^\d+:\d+$/.test(t)) {
|
|
821
|
+
let [e, n] = t.split(":").map(Number), r = this.unit === M.Pixel && this.hasMaxSize ? M.Pixel : M.AspectRatio;
|
|
821
822
|
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
822
|
-
...
|
|
823
|
-
keepAspectRatio: r ===
|
|
823
|
+
...V.getRatioSize(e, n, r, this.maxWidth, this.maxHeight),
|
|
824
|
+
keepAspectRatio: r === M.Pixel || !this.inline,
|
|
824
825
|
silent: !0,
|
|
825
826
|
unit: r
|
|
826
827
|
} });
|
|
@@ -835,7 +836,7 @@ var Tt = class {
|
|
|
835
836
|
this.emit("cx-asset-link-format-crop-position-change", { detail: { position: this.positionPicker.value } });
|
|
836
837
|
}
|
|
837
838
|
onUnitChange(e) {
|
|
838
|
-
let t = e.target.value ===
|
|
839
|
+
let t = e.target.value === M.AspectRatio ? M.AspectRatio : M.Pixel;
|
|
839
840
|
if (this.hasCropper) {
|
|
840
841
|
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
841
842
|
...this.#i(t),
|
|
@@ -863,21 +864,21 @@ var Tt = class {
|
|
|
863
864
|
if (/^\d+:\d+$/.test(this.cropMode)) {
|
|
864
865
|
let [n, r] = this.cropMode.split(":").map(Number);
|
|
865
866
|
return {
|
|
866
|
-
...
|
|
867
|
+
...V.getRatioSize(n, r, e, this.maxWidth, this.maxHeight),
|
|
867
868
|
keepAspectRatio: t
|
|
868
869
|
};
|
|
869
870
|
}
|
|
870
|
-
return e ===
|
|
871
|
+
return e === M.AspectRatio ? {
|
|
871
872
|
height: this.height,
|
|
872
873
|
keepAspectRatio: t,
|
|
873
874
|
width: this.width
|
|
874
875
|
} : {
|
|
875
|
-
...
|
|
876
|
+
...V.getRatioSize(this.ratioWidth, this.ratioHeight, e, this.maxWidth, this.maxHeight),
|
|
876
877
|
keepAspectRatio: t
|
|
877
878
|
};
|
|
878
879
|
}
|
|
879
880
|
#i(e) {
|
|
880
|
-
if (e ===
|
|
881
|
+
if (e === M.AspectRatio && /^\d+:\d+$/.test(this.cropMode)) {
|
|
881
882
|
let [e, t] = this.cropMode.split(":").map(Number);
|
|
882
883
|
return {
|
|
883
884
|
height: t,
|
|
@@ -908,14 +909,14 @@ var Tt = class {
|
|
|
908
909
|
}
|
|
909
910
|
handleAspectRatioClick() {
|
|
910
911
|
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
911
|
-
height: this.unit ===
|
|
912
|
+
height: this.unit === M.Pixel ? this.height : this.ratioHeight,
|
|
912
913
|
keepAspectRatio: !this.keepAspectRatio,
|
|
913
914
|
unit: this.unit,
|
|
914
|
-
width: this.unit ===
|
|
915
|
+
width: this.unit === M.Pixel ? this.width : this.ratioWidth
|
|
915
916
|
} });
|
|
916
917
|
}
|
|
917
918
|
getSideMax(e) {
|
|
918
|
-
return this.unit ===
|
|
919
|
+
return this.unit === M.Pixel && e >= 1 ? Math.min(e, A) : A;
|
|
919
920
|
}
|
|
920
921
|
getSizeMaskBlocks(e) {
|
|
921
922
|
return { num: {
|
|
@@ -934,111 +935,111 @@ var Tt = class {
|
|
|
934
935
|
}
|
|
935
936
|
#a(e, t) {
|
|
936
937
|
let n = /^(\d+):(\d+)$/.exec(this.cropMode);
|
|
937
|
-
return this.unit ===
|
|
938
|
+
return this.unit === M.Pixel && !this.keepAspectRatio && n !== null && Number(n[1]) * t !== Number(n[2]) * e;
|
|
938
939
|
}
|
|
939
940
|
render() {
|
|
940
941
|
let t = this.cropModes.filter((e) => !e.auto), n = this.cropModes.filter((e) => e.auto);
|
|
941
|
-
return e`<cx-details class="details ${this.inline ? "details--inline" : ""}" ?open=${this.inline || this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small">${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${
|
|
942
|
+
return e`<cx-details class="details ${this.inline ? "details--inline" : ""}" ?open=${this.inline || this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small">${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${x(t, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}
|
|
942
943
|
${m(n.length > 0, () => e`<cx-divider></cx-divider><small>${this.localize.term("autoCropping")}</small>`)}
|
|
943
|
-
${
|
|
944
|
+
${x(n, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}<cx-space spacing="small"><div class="crop__input-group"><cx-input data-testid="cx-asset-link-format-crop-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${this.getSizeMaskBlocks(this.maxWidth)} value=${this.unit === M.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">
|
|
944
945
|
W
|
|
945
|
-
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-crop-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} label=${this.localize.term("keepAspectRatio")} .pressed=${this.keepAspectRatio} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${this.getSizeMaskBlocks(this.maxHeight)} value=${this.unit ===
|
|
946
|
+
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-crop-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} label=${this.localize.term("keepAspectRatio")} .pressed=${this.keepAspectRatio} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${this.getSizeMaskBlocks(this.maxHeight)} value=${this.unit === M.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">
|
|
946
947
|
H
|
|
947
|
-
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-unit" value=${this.unit} hoist class="crop__unit-select" ?disabled=${this.loading} @cx-change=${this.onUnitChange}><cx-option value=${
|
|
948
|
+
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-unit" value=${this.unit} hoist class="crop__unit-select" ?disabled=${this.loading} @cx-change=${this.onUnitChange}><cx-option value=${M.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${M.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`)}</cx-space><div class="crop__limit" data-testid="cx-asset-link-format-crop-dimensions-limit" role="status">${m(this.dimensionsLimited, () => e`<cx-typography variant="small">${this.localize.term("cropLimitedByDimensions", this.maxWidth, this.maxHeight)}</cx-typography>`)}</div>${m(this.focusModes.length > 0, () => e`<cx-select data-testid="cx-asset-link-format-crop-focus-mode" value=${this.focusMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onFocusModeChange} ?disabled=${this.loading || this.selectedMode?.disabledSize}>${x(this.focusModes, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}
|
|
948
949
|
${m(this.showPositionPicker && this.focusMode === "manual", () => e`<cx-position-picker data-testid="cx-asset-link-format-crop-position" value=${this.position} @cx-change=${this.onPositionChange}></cx-position-picker>`)}
|
|
949
950
|
${m(!this.inline, () => e`<cx-button data-testid="cx-asset-link-format-crop-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${g({ marginLeft: "auto" })} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space></cx-details>`;
|
|
950
951
|
}
|
|
951
952
|
};
|
|
952
|
-
a([c(".details"), o("design:type",
|
|
953
|
+
a([c(".details"), o("design:type", T === void 0 ? Object : T)], H.prototype, "base", void 0), a([c("cx-position-picker"), o("design:type", Ne === void 0 ? Object : Ne)], H.prototype, "positionPicker", void 0), a([r({
|
|
953
954
|
reflect: !0,
|
|
954
955
|
type: Boolean
|
|
955
|
-
}), o("design:type", Boolean)],
|
|
956
|
+
}), o("design:type", Boolean)], H.prototype, "open", void 0), a([r({
|
|
956
957
|
reflect: !0,
|
|
957
958
|
type: Boolean
|
|
958
|
-
}), o("design:type", Boolean)],
|
|
959
|
+
}), o("design:type", Boolean)], H.prototype, "inline", void 0), a([r({
|
|
959
960
|
reflect: !0,
|
|
960
961
|
type: Number
|
|
961
|
-
}), o("design:type", Number)],
|
|
962
|
+
}), o("design:type", Number)], H.prototype, "width", void 0), a([r({
|
|
962
963
|
reflect: !0,
|
|
963
964
|
type: Number
|
|
964
|
-
}), o("design:type", Number)],
|
|
965
|
+
}), o("design:type", Number)], H.prototype, "height", void 0), a([r({
|
|
965
966
|
attribute: "max-width",
|
|
966
967
|
reflect: !0,
|
|
967
968
|
type: Number
|
|
968
|
-
}), o("design:type", Number)],
|
|
969
|
+
}), o("design:type", Number)], H.prototype, "maxWidth", void 0), a([r({
|
|
969
970
|
attribute: "max-height",
|
|
970
971
|
reflect: !0,
|
|
971
972
|
type: Number
|
|
972
|
-
}), o("design:type", Number)],
|
|
973
|
+
}), o("design:type", Number)], H.prototype, "maxHeight", void 0), a([r({
|
|
973
974
|
attribute: "ratio-width",
|
|
974
975
|
reflect: !0,
|
|
975
976
|
type: Number
|
|
976
|
-
}), o("design:type", Number)],
|
|
977
|
+
}), o("design:type", Number)], H.prototype, "ratioWidth", void 0), a([r({
|
|
977
978
|
attribute: "ratio-height",
|
|
978
979
|
reflect: !0,
|
|
979
980
|
type: Number
|
|
980
|
-
}), o("design:type", Number)],
|
|
981
|
+
}), o("design:type", Number)], H.prototype, "ratioHeight", void 0), a([r({
|
|
981
982
|
attribute: "percentage-width",
|
|
982
983
|
reflect: !0,
|
|
983
984
|
type: Number
|
|
984
|
-
}), o("design:type", Number)],
|
|
985
|
+
}), o("design:type", Number)], H.prototype, "percentageWidth", void 0), a([r({
|
|
985
986
|
attribute: "percentage-height",
|
|
986
987
|
reflect: !0,
|
|
987
988
|
type: Number
|
|
988
|
-
}), o("design:type", Number)],
|
|
989
|
+
}), o("design:type", Number)], H.prototype, "percentageHeight", void 0), a([r({
|
|
989
990
|
reflect: !0,
|
|
990
991
|
type: String
|
|
991
|
-
}), o("design:type",
|
|
992
|
+
}), o("design:type", M === void 0 ? Object : M)], H.prototype, "unit", void 0), a([r({
|
|
992
993
|
attribute: "disabled-apply",
|
|
993
994
|
reflect: !0,
|
|
994
995
|
type: Boolean
|
|
995
|
-
}), o("design:type", Boolean)],
|
|
996
|
+
}), o("design:type", Boolean)], H.prototype, "disabledApply", void 0), a([r({
|
|
996
997
|
attribute: "no-ratio-modes",
|
|
997
998
|
reflect: !0,
|
|
998
999
|
type: Boolean
|
|
999
|
-
}), o("design:type", Boolean)],
|
|
1000
|
+
}), o("design:type", Boolean)], H.prototype, "noRatioModes", void 0), a([r({
|
|
1000
1001
|
attribute: "show-position-picker",
|
|
1001
1002
|
reflect: !0,
|
|
1002
1003
|
type: Boolean
|
|
1003
|
-
}), o("design:type", Boolean)],
|
|
1004
|
+
}), o("design:type", Boolean)], H.prototype, "showPositionPicker", void 0), a([r({
|
|
1004
1005
|
attribute: "has-cropper",
|
|
1005
1006
|
reflect: !0,
|
|
1006
1007
|
type: Boolean
|
|
1007
|
-
}), o("design:type", Boolean)],
|
|
1008
|
+
}), o("design:type", Boolean)], H.prototype, "hasCropper", void 0), a([r({
|
|
1008
1009
|
attribute: "dimensions-limited",
|
|
1009
1010
|
reflect: !0,
|
|
1010
1011
|
type: Boolean
|
|
1011
|
-
}), o("design:type", Boolean)],
|
|
1012
|
+
}), o("design:type", Boolean)], H.prototype, "dimensionsLimited", void 0), a([r({
|
|
1012
1013
|
attribute: "last-applied-setting",
|
|
1013
1014
|
reflect: !1,
|
|
1014
1015
|
type: Object
|
|
1015
|
-
}), o("design:type", typeof Record > "u" ? Object : Record)],
|
|
1016
|
+
}), o("design:type", typeof Record > "u" ? Object : Record)], H.prototype, "lastAppliedSetting", void 0), a([r({
|
|
1016
1017
|
reflect: !0,
|
|
1017
1018
|
type: Boolean
|
|
1018
|
-
}), o("design:type", Boolean)],
|
|
1019
|
+
}), o("design:type", Boolean)], H.prototype, "loading", void 0), a([r({
|
|
1019
1020
|
attribute: "crop-modes",
|
|
1020
1021
|
reflect: !1,
|
|
1021
1022
|
type: Array
|
|
1022
|
-
}), o("design:type", Array)],
|
|
1023
|
+
}), o("design:type", Array)], H.prototype, "cropModes", void 0), a([r({
|
|
1023
1024
|
attribute: "focus-modes",
|
|
1024
1025
|
reflect: !1,
|
|
1025
1026
|
type: Object
|
|
1026
|
-
}), o("design:type", Array)],
|
|
1027
|
+
}), o("design:type", Array)], H.prototype, "focusModes", void 0), a([r({
|
|
1027
1028
|
attribute: "focus-mode",
|
|
1028
1029
|
reflect: !0,
|
|
1029
1030
|
type: String
|
|
1030
|
-
}), o("design:type", String)],
|
|
1031
|
+
}), o("design:type", String)], H.prototype, "focusMode", void 0), a([r({
|
|
1031
1032
|
attribute: "crop-mode",
|
|
1032
1033
|
reflect: !0,
|
|
1033
1034
|
type: String
|
|
1034
|
-
}), o("design:type", String)],
|
|
1035
|
+
}), o("design:type", String)], H.prototype, "cropMode", void 0), a([r({
|
|
1035
1036
|
reflect: !0,
|
|
1036
1037
|
type: String
|
|
1037
|
-
}), o("design:type", v === void 0 ? Object : v)],
|
|
1038
|
+
}), o("design:type", v === void 0 ? Object : v)], H.prototype, "position", void 0), a([r({
|
|
1038
1039
|
attribute: "keep-aspect-ratio",
|
|
1039
1040
|
reflect: !0,
|
|
1040
1041
|
type: Boolean
|
|
1041
|
-
}), o("design:type", Boolean)],
|
|
1042
|
+
}), o("design:type", Boolean)], H.prototype, "keepAspectRatio", void 0), a([i(), o("design:type", Boolean)], H.prototype, "invalidWidth", void 0), a([i(), o("design:type", Boolean)], H.prototype, "invalidHeight", void 0), a([i(), o("design:type", Number)], H.prototype, "aspectRatio", void 0), a([
|
|
1042
1043
|
f("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
1043
1044
|
f("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
1044
1045
|
f("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
@@ -1046,56 +1047,65 @@ a([c(".details"), o("design:type", E === void 0 ? Object : E)], W.prototype, "ba
|
|
|
1046
1047
|
o("design:type", Function),
|
|
1047
1048
|
o("design:paramtypes", []),
|
|
1048
1049
|
o("design:returntype", Promise)
|
|
1049
|
-
],
|
|
1050
|
+
], H.prototype, "handleCropModeChange", null), a([
|
|
1050
1051
|
f("open", { waitUntilFirstUpdate: !0 }),
|
|
1051
1052
|
o("design:type", Function),
|
|
1052
1053
|
o("design:paramtypes", []),
|
|
1053
1054
|
o("design:returntype", Promise)
|
|
1054
|
-
],
|
|
1055
|
-
var
|
|
1056
|
-
[
|
|
1055
|
+
], H.prototype, "handleOpenChange", null), H = V = a([u("cx-asset-link-format-crop")], H);
|
|
1056
|
+
var jt = H, Mt = t`:host{display:block}.asset-link-format__dimensions-select{width:100%}.details::part(base){border-bottom-width:0}.asset-link-format__dimensions-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__dimensions-inline .asset-link-format__dimensions-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__dimensions-inline .asset-link-format__dimensions-summary cx-typography{--font-weight:var(--cx-font-weight-medium)}.asset-link-format__dimensions-custom{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,7rem);align-items:center;display:grid}.asset-link-format__dimensions-custom cx-input,.asset-link-format__dimensions-custom cx-select{min-width:0}.asset-link-format__dimensions-apply{margin-inline-start:auto}`, U = 1, Nt = {
|
|
1057
|
+
[O.Percent]: { num: {
|
|
1058
|
+
autofix: !0,
|
|
1057
1059
|
mask: Number,
|
|
1058
|
-
|
|
1060
|
+
max: 100,
|
|
1061
|
+
min: U,
|
|
1059
1062
|
radix: ".",
|
|
1060
|
-
scale:
|
|
1063
|
+
scale: 0
|
|
1061
1064
|
} },
|
|
1062
|
-
[
|
|
1065
|
+
[O.Pixel]: { num: {
|
|
1063
1066
|
autofix: !0,
|
|
1064
1067
|
mask: Number,
|
|
1065
|
-
max:
|
|
1066
|
-
min:
|
|
1068
|
+
max: A,
|
|
1069
|
+
min: U,
|
|
1067
1070
|
radix: ".",
|
|
1068
1071
|
scale: 0
|
|
1069
1072
|
} }
|
|
1070
|
-
},
|
|
1073
|
+
}, W = class extends s {
|
|
1071
1074
|
constructor(...e) {
|
|
1072
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior =
|
|
1073
|
-
[
|
|
1075
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior = j.Legacy, this.loading = !1, this.items = [], this.canCustom = !1, this.canPercent = !1, this.customDimensionsUnit = O.Pixel, this.dimensionsSelection = "", this.customDimensionsDrafts = {
|
|
1076
|
+
[O.Percent]: {
|
|
1074
1077
|
height: "100",
|
|
1075
1078
|
width: "100"
|
|
1076
1079
|
},
|
|
1077
|
-
[
|
|
1080
|
+
[O.Pixel]: {
|
|
1078
1081
|
height: "1080",
|
|
1079
1082
|
width: "1920"
|
|
1080
1083
|
}
|
|
1081
1084
|
};
|
|
1082
1085
|
}
|
|
1083
|
-
static #e = this.styles = [l,
|
|
1086
|
+
static #e = this.styles = [l, Mt];
|
|
1084
1087
|
static #t = this.dependencies = {
|
|
1085
1088
|
"cx-button": _,
|
|
1086
|
-
"cx-details":
|
|
1087
|
-
"cx-divider":
|
|
1089
|
+
"cx-details": T,
|
|
1090
|
+
"cx-divider": ye,
|
|
1088
1091
|
"cx-icon": h,
|
|
1089
|
-
"cx-input":
|
|
1090
|
-
"cx-menu-label":
|
|
1091
|
-
"cx-option":
|
|
1092
|
-
"cx-select":
|
|
1093
|
-
"cx-space":
|
|
1094
|
-
"cx-typography":
|
|
1092
|
+
"cx-input": le,
|
|
1093
|
+
"cx-menu-label": Se,
|
|
1094
|
+
"cx-option": S,
|
|
1095
|
+
"cx-select": w,
|
|
1096
|
+
"cx-space": C,
|
|
1097
|
+
"cx-typography": b
|
|
1095
1098
|
};
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
+
willUpdate(e) {
|
|
1100
|
+
super.willUpdate(e), (e.has("value") && e.get("value") !== this.value || e.has("canPercent")) && this.#n();
|
|
1101
|
+
}
|
|
1102
|
+
#n() {
|
|
1103
|
+
let e = this.value, t = e?.mode === E.Custom && e.unit === O.Percent && !this.canPercent;
|
|
1104
|
+
if (this.canPercent || (this.customDimensionsUnit = O.Pixel), t) {
|
|
1105
|
+
this.dimensionsSelection = "";
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
this.dimensionsSelection = e?.mode === E.Custom ? E.Custom : e?.mode === E.Preset ? `preset:${e.value}` : "", e?.mode === E.Custom && (this.customDimensionsUnit = e.unit, this.customDimensionsDrafts = {
|
|
1099
1109
|
...this.customDimensionsDrafts,
|
|
1100
1110
|
[e.unit]: {
|
|
1101
1111
|
height: String(e.height),
|
|
@@ -1108,26 +1118,45 @@ var Ot = W, kt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1108
1118
|
}
|
|
1109
1119
|
getCustomDimensionsValue() {
|
|
1110
1120
|
let e = this.customDimensionsUnit, t = this.customDimensionsDrafts[e], n = Number(t.width), r = Number(t.height);
|
|
1111
|
-
if (!(!Number.
|
|
1121
|
+
if (!(!Number.isInteger(n) || !Number.isInteger(r) || n < U || r < U) && !(e === O.Percent && (n > 100 || n !== r))) return {
|
|
1112
1122
|
height: r,
|
|
1113
|
-
mode:
|
|
1123
|
+
mode: E.Custom,
|
|
1114
1124
|
unit: e,
|
|
1115
1125
|
width: n
|
|
1116
1126
|
};
|
|
1117
1127
|
}
|
|
1128
|
+
#r(e, t) {
|
|
1129
|
+
let n = this.customDimensionsUnit, r = n === O.Percent ? {
|
|
1130
|
+
height: t,
|
|
1131
|
+
width: t
|
|
1132
|
+
} : {
|
|
1133
|
+
...this.customDimensionsDrafts[n],
|
|
1134
|
+
[e]: t
|
|
1135
|
+
};
|
|
1136
|
+
this.customDimensionsDrafts = {
|
|
1137
|
+
...this.customDimensionsDrafts,
|
|
1138
|
+
[n]: r
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
#i(e) {
|
|
1142
|
+
let t = this.customDimensionsUnit, n = this.customDimensionsDrafts[t][e], r = Number(n), i = this.value, a = i?.mode === E.Custom && i.unit === t && String(i[e]) === n;
|
|
1143
|
+
if (!n || a || Number.isNaN(r)) return;
|
|
1144
|
+
let o = t === O.Percent ? 100 : A, s = String(ce(r, U, o));
|
|
1145
|
+
s !== n && this.#r(e, s);
|
|
1146
|
+
}
|
|
1118
1147
|
get pendingValue() {
|
|
1119
|
-
if (this.dimensionsSelection ===
|
|
1148
|
+
if (this.dimensionsSelection === E.Custom) return this.getCustomDimensionsValue();
|
|
1120
1149
|
if (this.dimensionsSelection.startsWith("preset:")) {
|
|
1121
1150
|
let e = this.items.find((e) => `preset:${e.value}` === this.dimensionsSelection && !e.disabled);
|
|
1122
1151
|
return e ? {
|
|
1123
|
-
mode:
|
|
1152
|
+
mode: E.Preset,
|
|
1124
1153
|
value: e.value
|
|
1125
1154
|
} : void 0;
|
|
1126
1155
|
}
|
|
1127
1156
|
}
|
|
1128
1157
|
get applyDisabled() {
|
|
1129
1158
|
let e = this.pendingValue;
|
|
1130
|
-
return !e || !this.value || e.mode !== this.value.mode ? !e : e.mode ===
|
|
1159
|
+
return !e || !this.value || e.mode !== this.value.mode ? !e : e.mode === E.Preset && this.value.mode === E.Preset ? e.value === this.value.value : e.mode === E.Custom && this.value.mode === E.Custom && e.height === this.value.height && e.unit === this.value.unit && e.width === this.value.width;
|
|
1131
1160
|
}
|
|
1132
1161
|
applyPendingValue() {
|
|
1133
1162
|
let e = this.pendingValue;
|
|
@@ -1136,33 +1165,29 @@ var Ot = W, kt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1136
1165
|
onDimensionsSelectChange(e) {
|
|
1137
1166
|
if (e.target !== e.currentTarget || this.loading) return;
|
|
1138
1167
|
let t = e.currentTarget.value;
|
|
1139
|
-
if (t ===
|
|
1168
|
+
if (t === E.Custom && this.canCustom) this.dimensionsSelection = E.Custom, this.applyBehavior !== j.Manual && this.applyPendingValue();
|
|
1140
1169
|
else if (t.startsWith("preset:")) {
|
|
1141
1170
|
let e = this.items.find((e) => `preset:${e.value}` === t && !e.disabled);
|
|
1142
|
-
e && (this.dimensionsSelection = t, this.applyBehavior !==
|
|
1143
|
-
mode:
|
|
1171
|
+
e && (this.dimensionsSelection = t, this.applyBehavior !== j.Manual && this.emitDimensionsValue({
|
|
1172
|
+
mode: E.Preset,
|
|
1144
1173
|
value: e.value
|
|
1145
1174
|
}));
|
|
1146
1175
|
}
|
|
1147
1176
|
}
|
|
1148
1177
|
onDimensionsInput(e) {
|
|
1149
1178
|
if (e.target !== e.currentTarget || this.loading || !this.canCustom) return;
|
|
1150
|
-
let t = e.currentTarget
|
|
1151
|
-
this.
|
|
1152
|
-
...this.customDimensionsDrafts,
|
|
1153
|
-
[r]: {
|
|
1154
|
-
...this.customDimensionsDrafts[r],
|
|
1155
|
-
[n]: t.value
|
|
1156
|
-
}
|
|
1157
|
-
};
|
|
1179
|
+
let t = e.currentTarget;
|
|
1180
|
+
this.#r(t.name === "height" ? "height" : "width", t.value);
|
|
1158
1181
|
}
|
|
1159
1182
|
onDimensionsCustomChange(e) {
|
|
1160
|
-
e.target
|
|
1183
|
+
if (e.target !== e.currentTarget || this.loading || !this.canCustom) return;
|
|
1184
|
+
let t = e.currentTarget;
|
|
1185
|
+
this.#i(t.name === "height" ? "height" : "width"), t.reportValidity() && this.applyBehavior !== j.Manual && this.applyPendingValue();
|
|
1161
1186
|
}
|
|
1162
1187
|
onDimensionsUnitChange(e) {
|
|
1163
1188
|
if (e.target !== e.currentTarget || this.loading || !this.canCustom) return;
|
|
1164
1189
|
let t = e.currentTarget.value;
|
|
1165
|
-
(t ===
|
|
1190
|
+
(t === O.Pixel || t === O.Percent && this.canPercent) && (this.customDimensionsUnit = t, this.applyBehavior !== j.Manual && this.applyPendingValue());
|
|
1166
1191
|
}
|
|
1167
1192
|
onApply() {
|
|
1168
1193
|
!this.loading && !this.applyDisabled && this.applyPendingValue();
|
|
@@ -1175,21 +1200,21 @@ var Ot = W, kt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1175
1200
|
}
|
|
1176
1201
|
renderCustomDimensions() {
|
|
1177
1202
|
let t = this.customDimensionsUnit, n = this.customDimensionsDrafts[t];
|
|
1178
|
-
return e`<cx-space class="asset-link-format__dimensions-custom" spacing="small"><cx-input name="width" mask="num" .maskBlocks=${
|
|
1203
|
+
return e`<cx-space class="asset-link-format__dimensions-custom" spacing="small"><cx-input name="width" mask="num" .maskBlocks=${Nt[t]} aria-label=${this.localize.term("maxWidth")} value=${n.width} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">W</cx-typography></cx-input><cx-input name="height" mask="num" .maskBlocks=${Nt[t]} aria-label=${this.localize.term("maxHeight")} value=${n.height} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">H</cx-typography></cx-input><cx-select data-label=${this.localize.term("unit")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsUnitChange}><cx-option value=${O.Pixel}>${this.localize.term("pixels")}</cx-option>${m(this.canPercent, () => e`<cx-option value=${O.Percent}>${this.localize.term("dimensionsPercent")}</cx-option>`)}</cx-select></cx-space>`;
|
|
1179
1204
|
}
|
|
1180
1205
|
renderSummary() {
|
|
1181
|
-
return e`<cx-space class="asset-link-format__dimensions-summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant=${this.inline ?
|
|
1206
|
+
return e`<cx-space class="asset-link-format__dimensions-summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant=${this.inline ? y.Body3 : y.Body2}>${this.localize.term("dimensions")}</cx-typography></cx-space>`;
|
|
1182
1207
|
}
|
|
1183
1208
|
renderContent() {
|
|
1184
|
-
let t = this.canCustom && this.dimensionsSelection ===
|
|
1185
|
-
return e`<cx-space class="asset-link-format__dimensions-content" direction="vertical" spacing="small"><cx-select class="asset-link-format__dimensions-select" data-label=${this.localize.term("dimensions")} value=${this.dimensionsSelection ===
|
|
1209
|
+
let t = this.canCustom && this.dimensionsSelection === E.Custom;
|
|
1210
|
+
return e`<cx-space class="asset-link-format__dimensions-content" direction="vertical" spacing="small"><cx-select class="asset-link-format__dimensions-select" data-label=${this.localize.term("dimensions")} value=${this.dimensionsSelection === E.Custom && !this.canCustom ? "" : this.dimensionsSelection} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsSelectChange}>${x(this.items, (e) => e.value, (t, n) => e`
|
|
1186
1211
|
${m(t.group !== this.items[n - 1]?.group, () => e`
|
|
1187
1212
|
${m(n > 0, () => e`<cx-divider></cx-divider>`)}
|
|
1188
1213
|
${m(!!t.group, () => e`<cx-menu-label>${t.group}</cx-menu-label>`)}
|
|
1189
1214
|
`)}<cx-option value=${`preset:${t.value}`} ?disabled=${t.disabled}>${t.label}</cx-option>`)}
|
|
1190
1215
|
${m(this.canCustom, () => e`
|
|
1191
|
-
${m(this.items.length > 0, () => e`<cx-divider></cx-divider>`)}<cx-option value=${
|
|
1192
|
-
${m(this.applyBehavior ===
|
|
1216
|
+
${m(this.items.length > 0, () => e`<cx-divider></cx-divider>`)}<cx-option value=${E.Custom}><cx-icon slot="prefix" name="edit"></cx-icon>${this.localize.term("custom")}</cx-option>`)}</cx-select>${m(t, () => this.renderCustomDimensions())}
|
|
1217
|
+
${m(this.applyBehavior === j.Manual, () => e`<cx-button class="asset-link-format__dimensions-apply" data-testid="cx-asset-link-format-dimensions-apply" variant="primary" ?disabled=${this.applyDisabled} ?loading=${this.loading} @click=${this.onApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space>`;
|
|
1193
1218
|
}
|
|
1194
1219
|
render() {
|
|
1195
1220
|
return this.inline ? e`<div class="asset-link-format__dimensions-inline">${this.renderSummary()}
|
|
@@ -1199,74 +1224,72 @@ var Ot = W, kt = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1199
1224
|
a([r({
|
|
1200
1225
|
reflect: !0,
|
|
1201
1226
|
type: Boolean
|
|
1202
|
-
}), o("design:type", Object)],
|
|
1227
|
+
}), o("design:type", Object)], W.prototype, "open", void 0), a([r({
|
|
1203
1228
|
reflect: !0,
|
|
1204
1229
|
type: Boolean
|
|
1205
|
-
}), o("design:type", Object)],
|
|
1230
|
+
}), o("design:type", Object)], W.prototype, "inline", void 0), a([r({
|
|
1206
1231
|
attribute: "apply-behavior",
|
|
1207
1232
|
reflect: !0,
|
|
1208
1233
|
type: String
|
|
1209
|
-
}), o("design:type", Object)],
|
|
1234
|
+
}), o("design:type", Object)], W.prototype, "applyBehavior", void 0), a([r({
|
|
1210
1235
|
reflect: !0,
|
|
1211
1236
|
type: Boolean
|
|
1212
|
-
}), o("design:type", Object)],
|
|
1237
|
+
}), o("design:type", Object)], W.prototype, "loading", void 0), a([r({
|
|
1213
1238
|
attribute: !1,
|
|
1214
1239
|
type: Array
|
|
1215
|
-
}), o("design:type", Array)],
|
|
1240
|
+
}), o("design:type", Array)], W.prototype, "items", void 0), a([r({
|
|
1216
1241
|
attribute: "can-custom",
|
|
1217
1242
|
type: Boolean
|
|
1218
|
-
}), o("design:type", Object)],
|
|
1243
|
+
}), o("design:type", Object)], W.prototype, "canCustom", void 0), a([r({
|
|
1244
|
+
attribute: "can-percent",
|
|
1245
|
+
type: Boolean
|
|
1246
|
+
}), o("design:type", Object)], W.prototype, "canPercent", void 0), a([r({
|
|
1219
1247
|
attribute: !1,
|
|
1220
1248
|
type: Object
|
|
1221
|
-
}), o("design:type", Object)],
|
|
1222
|
-
|
|
1223
|
-
o("design:type", Function),
|
|
1224
|
-
o("design:paramtypes", []),
|
|
1225
|
-
o("design:returntype", void 0)
|
|
1226
|
-
], G.prototype, "handleDimensionsValueChange", null), G = a([u("cx-asset-link-format-dimensions")], G);
|
|
1227
|
-
var jt = G, Mt = t`.extension{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border:solid 1px var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-0);& cx-select{flex:1;width:100%}}`, K = class extends s {
|
|
1249
|
+
}), o("design:type", Object)], W.prototype, "value", void 0), a([i(), o("design:type", Object)], W.prototype, "customDimensionsUnit", void 0), a([i(), o("design:type", Object)], W.prototype, "dimensionsSelection", void 0), a([i(), o("design:type", Object)], W.prototype, "customDimensionsDrafts", void 0), W = a([u("cx-asset-link-format-dimensions")], W);
|
|
1250
|
+
var Pt = W, Ft = t`.extension{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border:solid 1px var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-0);& cx-select{flex:1;width:100%}}`, G = class extends s {
|
|
1228
1251
|
constructor(...e) {
|
|
1229
1252
|
super(...e), this.localize = new d(this), this.value = "", this.items = [];
|
|
1230
1253
|
}
|
|
1231
|
-
static #e = this.styles = [l,
|
|
1254
|
+
static #e = this.styles = [l, Ft];
|
|
1232
1255
|
static #t = this.dependencies = {
|
|
1233
|
-
"cx-option":
|
|
1234
|
-
"cx-select":
|
|
1235
|
-
"cx-space":
|
|
1236
|
-
"cx-typography":
|
|
1256
|
+
"cx-option": S,
|
|
1257
|
+
"cx-select": w,
|
|
1258
|
+
"cx-space": C,
|
|
1259
|
+
"cx-typography": b
|
|
1237
1260
|
};
|
|
1238
1261
|
handleExtensionChange(e) {
|
|
1239
1262
|
let t = e.target.value;
|
|
1240
1263
|
this.emit("cx-asset-link-format-extension-change", { detail: t });
|
|
1241
1264
|
}
|
|
1242
1265
|
render() {
|
|
1243
|
-
return e`<cx-space direction="vertical" spacing="small" class="extension"><cx-typography variant="body2">${this.localize.term("extension")}</cx-typography><cx-select data-label=${this.localize.term("extension")} data-testid="cx-asset-link-format-extension-select" value=${this.value} hoist @cx-change=${this.handleExtensionChange}>${
|
|
1266
|
+
return e`<cx-space direction="vertical" spacing="small" class="extension"><cx-typography variant="body2">${this.localize.term("extension")}</cx-typography><cx-select data-label=${this.localize.term("extension")} data-testid="cx-asset-link-format-extension-select" value=${this.value} hoist @cx-change=${this.handleExtensionChange}>${x(this.items, (e) => e.value, (t) => e`<cx-option value=${t.value}>${t.displayName}</cx-option>`)}</cx-select></cx-space>`;
|
|
1244
1267
|
}
|
|
1245
1268
|
};
|
|
1246
1269
|
a([r({
|
|
1247
1270
|
reflect: !0,
|
|
1248
1271
|
type: String
|
|
1249
|
-
}), o("design:type", String)],
|
|
1272
|
+
}), o("design:type", String)], G.prototype, "value", void 0), a([r({
|
|
1250
1273
|
reflect: !1,
|
|
1251
1274
|
type: Array
|
|
1252
|
-
}), o("design:type", typeof Array > "u" ? Object : Array)],
|
|
1253
|
-
var
|
|
1275
|
+
}), o("design:type", typeof Array > "u" ? Object : Array)], G.prototype, "items", void 0), G = a([u("cx-asset-link-format-extension")], G);
|
|
1276
|
+
var It = G, Lt = t`cx-details::part(base){border-bottom-width:0}`, Rt = "auto", K = class extends s {
|
|
1254
1277
|
constructor(...e) {
|
|
1255
1278
|
super(...e), this.localize = new d(this), this.open = !1, this.value = "", this.items = [], this.canAutoFormat = !1, this.autoFormat = !1, this.loading = !1, this.scopedValue = "";
|
|
1256
1279
|
}
|
|
1257
|
-
static #e = this.styles = [l,
|
|
1280
|
+
static #e = this.styles = [l, Lt];
|
|
1258
1281
|
static #t = this.dependencies = {
|
|
1259
1282
|
"cx-button": _,
|
|
1260
|
-
"cx-details":
|
|
1261
|
-
"cx-divider":
|
|
1283
|
+
"cx-details": T,
|
|
1284
|
+
"cx-divider": ye,
|
|
1262
1285
|
"cx-icon": h,
|
|
1263
|
-
"cx-option":
|
|
1264
|
-
"cx-select":
|
|
1265
|
-
"cx-space":
|
|
1266
|
-
"cx-typography":
|
|
1286
|
+
"cx-option": S,
|
|
1287
|
+
"cx-select": w,
|
|
1288
|
+
"cx-space": C,
|
|
1289
|
+
"cx-typography": b
|
|
1267
1290
|
};
|
|
1268
1291
|
get committedValue() {
|
|
1269
|
-
return this.autoFormat ?
|
|
1292
|
+
return this.autoFormat ? Rt : this.value;
|
|
1270
1293
|
}
|
|
1271
1294
|
handleValueChange() {
|
|
1272
1295
|
this.scopedValue = this.committedValue;
|
|
@@ -1297,61 +1320,68 @@ var Nt = K, Pt = t`cx-details::part(base){border-bottom-width:0}`, Ft = "auto",
|
|
|
1297
1320
|
e.target !== this.base && e.stopPropagation();
|
|
1298
1321
|
}
|
|
1299
1322
|
render() {
|
|
1300
|
-
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("format")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small" class="format"><cx-select data-label=${this.localize.term("imageFormat")} data-testid="cx-asset-link-format-proxy-select" value=${this.scopedValue} hoist @cx-change=${this.handleProxyChange} ?disabled=${this.loading}>${
|
|
1301
|
-
${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${
|
|
1323
|
+
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("format")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small" class="format"><cx-select data-label=${this.localize.term("imageFormat")} data-testid="cx-asset-link-format-proxy-select" value=${this.scopedValue} hoist @cx-change=${this.handleProxyChange} ?disabled=${this.loading}>${x(this.items, (e) => e.id, (t) => e`<cx-option value=${t.id}>${t.proxyLabel}</cx-option>`)}
|
|
1324
|
+
${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${Rt}>${this.localize.term("auto")}</cx-option>`, () => n)}</cx-select><cx-button data-testid="cx-asset-link-format-proxy-apply" variant="primary" style=${g({ "margin-left": "auto" })} ?disabled=${this.scopedValue === this.committedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1302
1325
|
}
|
|
1303
1326
|
};
|
|
1304
|
-
a([c(".details"), o("design:type",
|
|
1327
|
+
a([c(".details"), o("design:type", T === void 0 ? Object : T)], K.prototype, "base", void 0), a([r({
|
|
1305
1328
|
reflect: !0,
|
|
1306
1329
|
type: Boolean
|
|
1307
|
-
}), o("design:type", Object)],
|
|
1330
|
+
}), o("design:type", Object)], K.prototype, "open", void 0), a([r({
|
|
1308
1331
|
reflect: !0,
|
|
1309
1332
|
type: String
|
|
1310
|
-
}), o("design:type", Object)],
|
|
1333
|
+
}), o("design:type", Object)], K.prototype, "value", void 0), a([r({
|
|
1311
1334
|
reflect: !1,
|
|
1312
1335
|
type: Array
|
|
1313
|
-
}), o("design:type", Array)],
|
|
1336
|
+
}), o("design:type", Array)], K.prototype, "items", void 0), a([r({
|
|
1314
1337
|
attribute: "can-auto-format",
|
|
1315
1338
|
reflect: !0,
|
|
1316
1339
|
type: Boolean
|
|
1317
|
-
}), o("design:type", Object)],
|
|
1340
|
+
}), o("design:type", Object)], K.prototype, "canAutoFormat", void 0), a([r({
|
|
1318
1341
|
attribute: "auto-format",
|
|
1319
1342
|
reflect: !0,
|
|
1320
1343
|
type: Boolean
|
|
1321
|
-
}), o("design:type", Object)],
|
|
1344
|
+
}), o("design:type", Object)], K.prototype, "autoFormat", void 0), a([r({
|
|
1322
1345
|
reflect: !0,
|
|
1323
1346
|
type: Boolean
|
|
1324
|
-
}), o("design:type", Object)],
|
|
1347
|
+
}), o("design:type", Object)], K.prototype, "loading", void 0), a([i(), o("design:type", Object)], K.prototype, "scopedValue", void 0), a([
|
|
1325
1348
|
f("autoFormat"),
|
|
1326
1349
|
f("value"),
|
|
1327
1350
|
o("design:type", Function),
|
|
1328
1351
|
o("design:paramtypes", []),
|
|
1329
1352
|
o("design:returntype", void 0)
|
|
1330
|
-
],
|
|
1353
|
+
], K.prototype, "handleValueChange", null), a([
|
|
1331
1354
|
f("open", { waitUntilFirstUpdate: !0 }),
|
|
1332
1355
|
o("design:type", Function),
|
|
1333
1356
|
o("design:paramtypes", []),
|
|
1334
1357
|
o("design:returntype", void 0)
|
|
1335
|
-
],
|
|
1336
|
-
var
|
|
1358
|
+
], K.prototype, "handleOpenChange", null), K = a([u("cx-asset-link-format-proxy")], K);
|
|
1359
|
+
var zt = K, Bt = t`cx-details::part(base){border-bottom-width:0}.asset-link-format__quality-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__quality-inline .asset-link-format__quality-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__quality-inline .asset-link-format__quality-summary cx-typography{--font-weight:var(--cx-font-weight-medium)}.asset-link-format__quality-apply{margin-inline-start:auto}`, Vt = 1, Ht = 100, Ut = { num: {
|
|
1360
|
+
autofix: !0,
|
|
1361
|
+
mask: Number,
|
|
1362
|
+
max: Ht,
|
|
1363
|
+
min: Vt,
|
|
1364
|
+
radix: ".",
|
|
1365
|
+
scale: 0
|
|
1366
|
+
} }, q = class extends s {
|
|
1337
1367
|
constructor(...e) {
|
|
1338
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior =
|
|
1368
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior = j.Legacy, this.value = 100, this.items = [], this.customSelected = !1, this.loading = !1, this.scopedValue = 100;
|
|
1339
1369
|
}
|
|
1340
|
-
static #e = this.styles = [l,
|
|
1370
|
+
static #e = this.styles = [l, Bt];
|
|
1341
1371
|
static #t = this.dependencies = {
|
|
1342
1372
|
"cx-button": _,
|
|
1343
|
-
"cx-details":
|
|
1344
|
-
"cx-divider":
|
|
1373
|
+
"cx-details": T,
|
|
1374
|
+
"cx-divider": ye,
|
|
1345
1375
|
"cx-icon": h,
|
|
1346
|
-
"cx-input":
|
|
1347
|
-
"cx-option":
|
|
1348
|
-
"cx-select":
|
|
1349
|
-
"cx-space":
|
|
1376
|
+
"cx-input": le,
|
|
1377
|
+
"cx-option": S,
|
|
1378
|
+
"cx-select": w,
|
|
1379
|
+
"cx-space": C,
|
|
1350
1380
|
"cx-tooltip": ne,
|
|
1351
|
-
"cx-typography":
|
|
1381
|
+
"cx-typography": b
|
|
1352
1382
|
};
|
|
1353
1383
|
get invalidValue() {
|
|
1354
|
-
return isNaN(Number(this.scopedValue)) || Number(this.scopedValue) <
|
|
1384
|
+
return isNaN(Number(this.scopedValue)) || Number(this.scopedValue) < Vt || Number(this.scopedValue) > Ht || this.value === this.scopedValue;
|
|
1355
1385
|
}
|
|
1356
1386
|
handleValueChange() {
|
|
1357
1387
|
this.scopedValue = this.value, this.customSelected = !1;
|
|
@@ -1361,14 +1391,17 @@ var It = q, Lt = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1361
1391
|
let t = e.currentTarget.value;
|
|
1362
1392
|
if (this.customSelected = t === "custom", this.customSelected) return;
|
|
1363
1393
|
let n = this.items.find((e) => String(e.value) === t && !e.disabled);
|
|
1364
|
-
!n || !Number.isFinite(n.value) || n.value <
|
|
1394
|
+
!n || !Number.isFinite(n.value) || n.value < Vt || n.value > Ht || (this.scopedValue = n.value, n.value !== this.value && this.applyBehavior !== j.Manual && this.handleApply());
|
|
1365
1395
|
}
|
|
1366
1396
|
handleQualityChange(e) {
|
|
1367
1397
|
let t = e.target.value;
|
|
1368
1398
|
this.customSelected = !0, this.scopedValue = Number(t);
|
|
1369
1399
|
}
|
|
1370
1400
|
handleQualityCommit(e) {
|
|
1371
|
-
e.target === e.currentTarget && this.applyBehavior ===
|
|
1401
|
+
e.target === e.currentTarget && (this.#n(e.target.value), this.applyBehavior === j.Automatic && this.handleApply());
|
|
1402
|
+
}
|
|
1403
|
+
#n(e) {
|
|
1404
|
+
e && this.scopedValue !== this.value && (this.scopedValue = ce(this.scopedValue, Vt, Ht));
|
|
1372
1405
|
}
|
|
1373
1406
|
handleApply() {
|
|
1374
1407
|
this.loading || this.invalidValue || this.emit("cx-asset-link-format-quality-change", { detail: Number(this.scopedValue) });
|
|
@@ -1381,11 +1414,11 @@ var It = q, Lt = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1381
1414
|
}
|
|
1382
1415
|
renderPresets() {
|
|
1383
1416
|
let t = !this.customSelected && this.items.some((e) => e.value === this.scopedValue) ? String(this.scopedValue) : "custom";
|
|
1384
|
-
return e`<cx-select data-label=${this.localize.term("quality")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.handlePresetChange}>${
|
|
1417
|
+
return e`<cx-select data-label=${this.localize.term("quality")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.handlePresetChange}>${x(this.items, (e) => e.value, (t) => e`<cx-option value=${String(t.value)} ?disabled=${t.disabled}>${t.label}
|
|
1385
1418
|
${m(!!t.description, () => e`<span slot="help-text">${t.description}</span>`)}</cx-option>`)}<cx-divider></cx-divider><cx-option value="custom"><cx-icon slot="prefix" name="edit"></cx-icon>${this.localize.term("custom")}<span slot="help-text">${this.localize.term("qualityHelpText")}</span></cx-option></cx-select>`;
|
|
1386
1419
|
}
|
|
1387
1420
|
renderSummary() {
|
|
1388
|
-
return e`<cx-space class="asset-link-format__quality-summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="blur_on"></cx-icon></div></div><cx-typography variant=${this.inline ?
|
|
1421
|
+
return e`<cx-space class="asset-link-format__quality-summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="blur_on"></cx-icon></div></div><cx-typography variant=${this.inline ? y.Body3 : y.Body2}>${this.localize.term("quality")}</cx-typography></cx-space>`;
|
|
1389
1422
|
}
|
|
1390
1423
|
renderApplyButton() {
|
|
1391
1424
|
return e`<cx-button class="asset-link-format__quality-apply" 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>`;
|
|
@@ -1393,76 +1426,70 @@ var It = q, Lt = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1393
1426
|
renderContent() {
|
|
1394
1427
|
let t = this.items.length === 0 || this.customSelected || !this.items.some((e) => e.value === this.scopedValue);
|
|
1395
1428
|
return e`<cx-space class="asset-link-format__quality-content" direction="vertical" spacing="small">${m(this.items.length > 0, () => this.renderPresets())}
|
|
1396
|
-
${m(t, () => e`<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=${{
|
|
1397
|
-
|
|
1398
|
-
max: 100,
|
|
1399
|
-
min: 1,
|
|
1400
|
-
radix: ".",
|
|
1401
|
-
scale: 0
|
|
1402
|
-
} }} value=${this.scopedValue.toString()} style=${g({ flex: "1" })} @cx-input=${this.handleQualityChange} @cx-change=${this.handleQualityCommit}></cx-input></cx-tooltip>${m(this.applyBehavior === N.Legacy, () => this.renderApplyButton())}</cx-space>`)}
|
|
1403
|
-
${m(this.applyBehavior === N.Manual, () => this.renderApplyButton())}</cx-space>`;
|
|
1429
|
+
${m(t, () => e`<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=${Ut} value=${this.scopedValue.toString()} style=${g({ flex: "1" })} @cx-input=${this.handleQualityChange} @cx-change=${this.handleQualityCommit}></cx-input></cx-tooltip>${m(this.applyBehavior === j.Legacy, () => this.renderApplyButton())}</cx-space>`)}
|
|
1430
|
+
${m(this.applyBehavior === j.Manual, () => this.renderApplyButton())}</cx-space>`;
|
|
1404
1431
|
}
|
|
1405
1432
|
render() {
|
|
1406
1433
|
return this.inline ? e`<div class="asset-link-format__quality-inline">${this.renderSummary()}
|
|
1407
1434
|
${this.renderContent()}</div>` : e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><div slot="summary">${this.renderSummary()}</div>${this.renderContent()}</cx-details>`;
|
|
1408
1435
|
}
|
|
1409
1436
|
};
|
|
1410
|
-
a([c(".details"), o("design:type",
|
|
1437
|
+
a([c(".details"), o("design:type", T === void 0 ? Object : T)], q.prototype, "base", void 0), a([r({
|
|
1411
1438
|
reflect: !0,
|
|
1412
1439
|
type: Boolean
|
|
1413
|
-
}), o("design:type", Object)],
|
|
1440
|
+
}), o("design:type", Object)], q.prototype, "open", void 0), a([r({
|
|
1414
1441
|
reflect: !0,
|
|
1415
1442
|
type: Boolean
|
|
1416
|
-
}), o("design:type", Object)],
|
|
1443
|
+
}), o("design:type", Object)], q.prototype, "inline", void 0), a([r({
|
|
1417
1444
|
attribute: "apply-behavior",
|
|
1418
1445
|
reflect: !0,
|
|
1419
1446
|
type: String
|
|
1420
|
-
}), o("design:type", Object)],
|
|
1447
|
+
}), o("design:type", Object)], q.prototype, "applyBehavior", void 0), a([r({
|
|
1421
1448
|
reflect: !0,
|
|
1422
1449
|
type: Number
|
|
1423
|
-
}), o("design:type", Object)],
|
|
1450
|
+
}), o("design:type", Object)], q.prototype, "value", void 0), a([r({
|
|
1424
1451
|
attribute: !1,
|
|
1425
1452
|
type: Array
|
|
1426
|
-
}), o("design:type", Array)],
|
|
1453
|
+
}), o("design:type", Array)], q.prototype, "items", void 0), a([i(), o("design:type", Object)], q.prototype, "customSelected", void 0), a([r({
|
|
1427
1454
|
reflect: !0,
|
|
1428
1455
|
type: Boolean
|
|
1429
|
-
}), o("design:type", Object)],
|
|
1456
|
+
}), o("design:type", Object)], q.prototype, "loading", void 0), a([i(), o("design:type", Object)], q.prototype, "scopedValue", void 0), a([
|
|
1430
1457
|
f("value"),
|
|
1431
1458
|
o("design:type", Function),
|
|
1432
1459
|
o("design:paramtypes", []),
|
|
1433
1460
|
o("design:returntype", void 0)
|
|
1434
|
-
],
|
|
1435
|
-
var
|
|
1461
|
+
], q.prototype, "handleValueChange", null), q = a([u("cx-asset-link-format-quality")], q);
|
|
1462
|
+
var Wt = q, Gt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.resize__unit-select{width:120px}.resize__input-group{flex:1;display:flex}`, Kt = { num: {
|
|
1436
1463
|
autofix: !0,
|
|
1437
1464
|
mask: Number,
|
|
1438
|
-
max:
|
|
1465
|
+
max: A,
|
|
1439
1466
|
min: 1,
|
|
1440
1467
|
radix: ".",
|
|
1441
1468
|
scale: 0
|
|
1442
|
-
} },
|
|
1469
|
+
} }, J = class extends s {
|
|
1443
1470
|
constructor(...e) {
|
|
1444
|
-
super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit =
|
|
1445
|
-
[
|
|
1471
|
+
super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit = M.Pixel, this.lastAppliedSetting = {
|
|
1472
|
+
[M.Pixel]: {
|
|
1446
1473
|
height: 0,
|
|
1447
1474
|
width: 0
|
|
1448
1475
|
},
|
|
1449
|
-
[
|
|
1476
|
+
[M.AspectRatio]: {
|
|
1450
1477
|
height: 1,
|
|
1451
1478
|
width: 1
|
|
1452
1479
|
}
|
|
1453
1480
|
}, this.loading = !1, this.noRatioModes = !1, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
1454
1481
|
}
|
|
1455
|
-
static #e = this.styles = [l,
|
|
1482
|
+
static #e = this.styles = [l, Gt];
|
|
1456
1483
|
static #t = this.dependencies = {
|
|
1457
1484
|
"cx-button": _,
|
|
1458
|
-
"cx-details":
|
|
1485
|
+
"cx-details": T,
|
|
1459
1486
|
"cx-icon": h,
|
|
1460
1487
|
"cx-icon-button": p,
|
|
1461
|
-
"cx-input":
|
|
1462
|
-
"cx-option":
|
|
1463
|
-
"cx-select":
|
|
1464
|
-
"cx-space":
|
|
1465
|
-
"cx-typography":
|
|
1488
|
+
"cx-input": le,
|
|
1489
|
+
"cx-option": S,
|
|
1490
|
+
"cx-select": w,
|
|
1491
|
+
"cx-space": C,
|
|
1492
|
+
"cx-typography": b
|
|
1466
1493
|
};
|
|
1467
1494
|
get disabledApply() {
|
|
1468
1495
|
return this.lastAppliedSetting[this.unit].width === this.width && this.lastAppliedSetting[this.unit].height === this.height;
|
|
@@ -1470,11 +1497,11 @@ var Rt = J, zt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1470
1497
|
async handleCropModeChange() {
|
|
1471
1498
|
let e = Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && this.maxWidth > 0 && this.maxHeight > 0;
|
|
1472
1499
|
if (this.keepAspectRatio) {
|
|
1473
|
-
if (this.unit ===
|
|
1500
|
+
if (this.unit === M.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
1474
1501
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
1475
1502
|
return;
|
|
1476
1503
|
}
|
|
1477
|
-
if (this.unit ===
|
|
1504
|
+
if (this.unit === M.Pixel && !e && this.width && this.height) {
|
|
1478
1505
|
this.aspectRatio = this.width / this.height;
|
|
1479
1506
|
return;
|
|
1480
1507
|
}
|
|
@@ -1502,9 +1529,9 @@ var Rt = J, zt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1502
1529
|
this.invalidWidth = !0;
|
|
1503
1530
|
return;
|
|
1504
1531
|
}
|
|
1505
|
-
this.invalidWidth = !1, t = Math.min(t,
|
|
1506
|
-
let n = this.unit ===
|
|
1507
|
-
!this.keepAspectRatio && this.unit ===
|
|
1532
|
+
this.invalidWidth = !1, t = Math.min(t, A), this.unit === M.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1));
|
|
1533
|
+
let n = this.unit === M.Pixel ? this.height : this.ratioHeight;
|
|
1534
|
+
!this.keepAspectRatio && this.unit === M.AspectRatio && ([t, n] = this.fitRatioSides(t, n, this.maxWidth, this.maxHeight)), e.target.value = t.toString(), this.keepAspectRatio && (n = Math.max(Math.min(Math.round(t / this.aspectRatio), this.maxHeight, A), 1), this.invalidHeight = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1508
1535
|
height: n,
|
|
1509
1536
|
keepAspectRatio: this.keepAspectRatio,
|
|
1510
1537
|
unit: this.unit,
|
|
@@ -1517,9 +1544,9 @@ var Rt = J, zt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1517
1544
|
this.invalidHeight = !0;
|
|
1518
1545
|
return;
|
|
1519
1546
|
}
|
|
1520
|
-
this.invalidHeight = !1, t = Math.min(t,
|
|
1521
|
-
let n = this.unit ===
|
|
1522
|
-
!this.keepAspectRatio && this.unit ===
|
|
1547
|
+
this.invalidHeight = !1, t = Math.min(t, A), this.unit === M.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1));
|
|
1548
|
+
let n = this.unit === M.Pixel ? this.width : this.ratioWidth;
|
|
1549
|
+
!this.keepAspectRatio && this.unit === M.AspectRatio && ([t, n] = this.fitRatioSides(t, n, this.maxHeight, this.maxWidth)), e.target.value = t.toString(), this.keepAspectRatio && (n = Math.max(Math.min(Math.round(t * this.aspectRatio), this.maxWidth, A), 1), this.invalidWidth = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1523
1550
|
height: t,
|
|
1524
1551
|
keepAspectRatio: this.keepAspectRatio,
|
|
1525
1552
|
unit: this.unit,
|
|
@@ -1527,16 +1554,16 @@ var Rt = J, zt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1527
1554
|
} });
|
|
1528
1555
|
}
|
|
1529
1556
|
onUnitChange(e) {
|
|
1530
|
-
e.target.value ===
|
|
1531
|
-
height: this.lastAppliedSetting[
|
|
1557
|
+
e.target.value === M.AspectRatio ? this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1558
|
+
height: this.lastAppliedSetting[M.AspectRatio].height,
|
|
1532
1559
|
keepAspectRatio: this.keepAspectRatio,
|
|
1533
|
-
unit:
|
|
1534
|
-
width: this.lastAppliedSetting[
|
|
1560
|
+
unit: M.AspectRatio,
|
|
1561
|
+
width: this.lastAppliedSetting[M.AspectRatio].width
|
|
1535
1562
|
} }) : this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1536
|
-
height: this.lastAppliedSetting[
|
|
1563
|
+
height: this.lastAppliedSetting[M.Pixel].height,
|
|
1537
1564
|
keepAspectRatio: this.keepAspectRatio,
|
|
1538
|
-
unit:
|
|
1539
|
-
width: this.lastAppliedSetting[
|
|
1565
|
+
unit: M.Pixel,
|
|
1566
|
+
width: this.lastAppliedSetting[M.Pixel].width
|
|
1540
1567
|
} });
|
|
1541
1568
|
}
|
|
1542
1569
|
handleApply() {
|
|
@@ -1554,10 +1581,10 @@ var Rt = J, zt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1554
1581
|
}
|
|
1555
1582
|
handleAspectRatioClick() {
|
|
1556
1583
|
this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1557
|
-
height: this.unit ===
|
|
1584
|
+
height: this.unit === M.Pixel ? this.height : this.ratioHeight,
|
|
1558
1585
|
keepAspectRatio: !this.keepAspectRatio,
|
|
1559
1586
|
unit: this.unit,
|
|
1560
|
-
width: this.unit ===
|
|
1587
|
+
width: this.unit === M.Pixel ? this.width : this.ratioWidth
|
|
1561
1588
|
} });
|
|
1562
1589
|
}
|
|
1563
1590
|
fitRatioSides(e, t, n, r) {
|
|
@@ -1566,57 +1593,57 @@ var Rt = J, zt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1566
1593
|
return [i, Math.min(t, r * i)];
|
|
1567
1594
|
}
|
|
1568
1595
|
render() {
|
|
1569
|
-
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="aspect_ratio"></cx-icon></div><cx-typography variant="body2">${this.localize.term("resize")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small"><cx-space spacing="small"><div class="resize__input-group"><cx-input data-testid="cx-asset-link-format-resize-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${
|
|
1596
|
+
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="aspect_ratio"></cx-icon></div><cx-typography variant="body2">${this.localize.term("resize")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small"><cx-space spacing="small"><div class="resize__input-group"><cx-input data-testid="cx-asset-link-format-resize-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${Kt} value=${this.unit === M.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1570
1597
|
W
|
|
1571
|
-
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-resize-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} label=${this.localize.term("keepAspectRatio")} .pressed=${this.keepAspectRatio} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-resize-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${
|
|
1598
|
+
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-resize-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} label=${this.localize.term("keepAspectRatio")} .pressed=${this.keepAspectRatio} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-resize-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${Kt} value=${this.unit === M.Pixel ? this.height.toString() : this.ratioHeight.toString()} @cx-input=${this.handleHeightChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1572
1599
|
H
|
|
1573
|
-
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-resize-unit" value=${this.unit} hoist class="resize__unit-select" @cx-change=${this.onUnitChange}><cx-option value=${
|
|
1600
|
+
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-resize-unit" value=${this.unit} hoist class="resize__unit-select" @cx-change=${this.onUnitChange}><cx-option value=${M.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${M.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`)}</cx-space><cx-button data-testid="cx-asset-link-format-resize-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${g({ marginLeft: "auto" })} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1574
1601
|
}
|
|
1575
1602
|
};
|
|
1576
|
-
a([c(".details"), o("design:type",
|
|
1603
|
+
a([c(".details"), o("design:type", T === void 0 ? Object : T)], J.prototype, "base", void 0), a([r({
|
|
1577
1604
|
reflect: !0,
|
|
1578
1605
|
type: Boolean
|
|
1579
|
-
}), o("design:type", Boolean)],
|
|
1606
|
+
}), o("design:type", Boolean)], J.prototype, "open", void 0), a([r({
|
|
1580
1607
|
reflect: !0,
|
|
1581
1608
|
type: Number
|
|
1582
|
-
}), o("design:type", Number)],
|
|
1609
|
+
}), o("design:type", Number)], J.prototype, "width", void 0), a([r({
|
|
1583
1610
|
reflect: !0,
|
|
1584
1611
|
type: Number
|
|
1585
|
-
}), o("design:type", Number)],
|
|
1612
|
+
}), o("design:type", Number)], J.prototype, "height", void 0), a([r({
|
|
1586
1613
|
attribute: "max-width",
|
|
1587
1614
|
reflect: !0,
|
|
1588
1615
|
type: Number
|
|
1589
|
-
}), o("design:type", Number)],
|
|
1616
|
+
}), o("design:type", Number)], J.prototype, "maxWidth", void 0), a([r({
|
|
1590
1617
|
attribute: "max-height",
|
|
1591
1618
|
reflect: !0,
|
|
1592
1619
|
type: Number
|
|
1593
|
-
}), o("design:type", Number)],
|
|
1620
|
+
}), o("design:type", Number)], J.prototype, "maxHeight", void 0), a([r({
|
|
1594
1621
|
attribute: "ratio-width",
|
|
1595
1622
|
reflect: !0,
|
|
1596
1623
|
type: Number
|
|
1597
|
-
}), o("design:type", Number)],
|
|
1624
|
+
}), o("design:type", Number)], J.prototype, "ratioWidth", void 0), a([r({
|
|
1598
1625
|
attribute: "ratio-height",
|
|
1599
1626
|
reflect: !0,
|
|
1600
1627
|
type: Number
|
|
1601
|
-
}), o("design:type", Number)],
|
|
1628
|
+
}), o("design:type", Number)], J.prototype, "ratioHeight", void 0), a([r({
|
|
1602
1629
|
reflect: !0,
|
|
1603
1630
|
type: String
|
|
1604
|
-
}), o("design:type",
|
|
1631
|
+
}), o("design:type", M === void 0 ? Object : M)], J.prototype, "unit", void 0), a([r({
|
|
1605
1632
|
attribute: "last-applied-setting",
|
|
1606
1633
|
reflect: !1,
|
|
1607
1634
|
type: Object
|
|
1608
|
-
}), o("design:type", typeof Record > "u" ? Object : Record)],
|
|
1635
|
+
}), o("design:type", typeof Record > "u" ? Object : Record)], J.prototype, "lastAppliedSetting", void 0), a([r({
|
|
1609
1636
|
reflect: !0,
|
|
1610
1637
|
type: Boolean
|
|
1611
|
-
}), o("design:type", Boolean)],
|
|
1638
|
+
}), o("design:type", Boolean)], J.prototype, "loading", void 0), a([r({
|
|
1612
1639
|
attribute: "no-ratio-modes",
|
|
1613
1640
|
reflect: !0,
|
|
1614
1641
|
type: Boolean
|
|
1615
|
-
}), o("design:type", Boolean)],
|
|
1642
|
+
}), o("design:type", Boolean)], J.prototype, "noRatioModes", void 0), a([r({
|
|
1616
1643
|
attribute: "keep-aspect-ratio",
|
|
1617
1644
|
reflect: !0,
|
|
1618
1645
|
type: Boolean
|
|
1619
|
-
}), o("design:type", Boolean)],
|
|
1646
|
+
}), o("design:type", Boolean)], J.prototype, "keepAspectRatio", void 0), a([i(), o("design:type", Boolean)], J.prototype, "invalidWidth", void 0), a([i(), o("design:type", Boolean)], J.prototype, "invalidHeight", void 0), a([i(), o("design:type", Number)], J.prototype, "aspectRatio", void 0), a([
|
|
1620
1647
|
f("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
1621
1648
|
f("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
1622
1649
|
f("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
@@ -1624,25 +1651,25 @@ a([c(".details"), o("design:type", E === void 0 ? Object : E)], Y.prototype, "ba
|
|
|
1624
1651
|
o("design:type", Function),
|
|
1625
1652
|
o("design:paramtypes", []),
|
|
1626
1653
|
o("design:returntype", Promise)
|
|
1627
|
-
],
|
|
1654
|
+
], J.prototype, "handleCropModeChange", null), a([
|
|
1628
1655
|
f("open", { waitUntilFirstUpdate: !0 }),
|
|
1629
1656
|
o("design:type", Function),
|
|
1630
1657
|
o("design:paramtypes", []),
|
|
1631
1658
|
o("design:returntype", Promise)
|
|
1632
|
-
],
|
|
1633
|
-
var
|
|
1659
|
+
], J.prototype, "handleOpenChange", null), J = a([u("cx-asset-link-format-resize")], J);
|
|
1660
|
+
var qt = J, Jt = t`cx-details::part(base){border-bottom-width:0}.asset-link-format__rotation-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__rotation-inline .asset-link-format__rotation-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__rotation-inline .asset-link-format__rotation-summary cx-typography{--font-weight:var(--cx-font-weight-medium)}`, Y = class extends s {
|
|
1634
1661
|
constructor(...e) {
|
|
1635
1662
|
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.value = 0, this.defaultValue = 0, this.loading = !1, this.lastAppliedValue = 0;
|
|
1636
1663
|
}
|
|
1637
|
-
static #e = this.styles = [l,
|
|
1664
|
+
static #e = this.styles = [l, Jt];
|
|
1638
1665
|
static #t = this.dependencies = {
|
|
1639
1666
|
"cx-button": _,
|
|
1640
|
-
"cx-button-group":
|
|
1641
|
-
"cx-details":
|
|
1667
|
+
"cx-button-group": oe,
|
|
1668
|
+
"cx-details": T,
|
|
1642
1669
|
"cx-icon": h,
|
|
1643
1670
|
"cx-icon-button": p,
|
|
1644
|
-
"cx-space":
|
|
1645
|
-
"cx-typography":
|
|
1671
|
+
"cx-space": C,
|
|
1672
|
+
"cx-typography": b
|
|
1646
1673
|
};
|
|
1647
1674
|
handleOpenChange() {
|
|
1648
1675
|
this.open || this.emit("cx-asset-link-format-rotation-change", { detail: this.lastAppliedValue });
|
|
@@ -1666,7 +1693,7 @@ var Vt = Y, Ht = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1666
1693
|
this.value === 360 || this.value === -360 || this.loading || this.emit("cx-asset-link-format-rotation-apply", { detail: this.value });
|
|
1667
1694
|
}
|
|
1668
1695
|
renderSummary() {
|
|
1669
|
-
return e`<cx-space class="asset-link-format__rotation-summary" align-items="center"><div part="icon"><cx-icon name="rotate_90_degrees_cw"></cx-icon></div><cx-typography variant=${this.inline ?
|
|
1696
|
+
return e`<cx-space class="asset-link-format__rotation-summary" align-items="center"><div part="icon"><cx-icon name="rotate_90_degrees_cw"></cx-icon></div><cx-typography variant=${this.inline ? y.Body3 : y.Body2}>${this.localize.term("rotate")}</cx-typography></cx-space>`;
|
|
1670
1697
|
}
|
|
1671
1698
|
renderControls() {
|
|
1672
1699
|
return e`<cx-space class="asset-link-format__rotation-controls" spacing="small"><cx-button-group label=${this.localize.term("rotate")}><cx-icon-button data-testid="cx-asset-link-format-rotation-ccw" name="rotate_90_degrees_ccw" label=${this.localize.term("rotateCounterclockwise")} 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("rotateClockwise")} 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: {
|
|
@@ -1686,45 +1713,45 @@ var Vt = Y, Ht = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1686
1713
|
${this.renderControls()}</div>` : e`<cx-details class="details" ?open=${this.open}><div slot="summary">${this.renderSummary()}</div>${this.renderControls()}</cx-details>`;
|
|
1687
1714
|
}
|
|
1688
1715
|
};
|
|
1689
|
-
a([c(".details"), o("design:type",
|
|
1716
|
+
a([c(".details"), o("design:type", T === void 0 ? Object : T)], Y.prototype, "base", void 0), a([r({
|
|
1690
1717
|
reflect: !0,
|
|
1691
1718
|
type: Boolean
|
|
1692
|
-
}), o("design:type", Object)],
|
|
1719
|
+
}), o("design:type", Object)], Y.prototype, "open", void 0), a([r({
|
|
1693
1720
|
reflect: !0,
|
|
1694
1721
|
type: Boolean
|
|
1695
|
-
}), o("design:type", Object)],
|
|
1722
|
+
}), o("design:type", Object)], Y.prototype, "inline", void 0), a([r({
|
|
1696
1723
|
reflect: !0,
|
|
1697
1724
|
type: Number
|
|
1698
|
-
}), o("design:type", Object)],
|
|
1725
|
+
}), o("design:type", Object)], Y.prototype, "value", void 0), a([r({
|
|
1699
1726
|
attribute: "default-value",
|
|
1700
1727
|
reflect: !0,
|
|
1701
1728
|
type: Number
|
|
1702
|
-
}), o("design:type", Object)],
|
|
1729
|
+
}), o("design:type", Object)], Y.prototype, "defaultValue", void 0), a([r({
|
|
1703
1730
|
reflect: !0,
|
|
1704
1731
|
type: Boolean
|
|
1705
|
-
}), o("design:type", Object)],
|
|
1732
|
+
}), o("design:type", Object)], Y.prototype, "loading", void 0), a([r({
|
|
1706
1733
|
attribute: "last-applied-value",
|
|
1707
1734
|
reflect: !0,
|
|
1708
1735
|
type: Number
|
|
1709
|
-
}), o("design:type", Object)],
|
|
1736
|
+
}), o("design:type", Object)], Y.prototype, "lastAppliedValue", void 0), a([
|
|
1710
1737
|
f("open", { waitUntilFirstUpdate: !0 }),
|
|
1711
1738
|
o("design:type", Function),
|
|
1712
1739
|
o("design:paramtypes", []),
|
|
1713
1740
|
o("design:returntype", void 0)
|
|
1714
|
-
],
|
|
1715
|
-
var
|
|
1741
|
+
], Y.prototype, "handleOpenChange", null), Y = a([u("cx-asset-link-format-rotation")], Y);
|
|
1742
|
+
var Yt = Y, Xt = t`cx-details::part(base){border-bottom-width:0}`, X = class extends s {
|
|
1716
1743
|
constructor(...e) {
|
|
1717
1744
|
super(...e), this.localize = new d(this), this.open = !1, this.value = !1;
|
|
1718
1745
|
}
|
|
1719
|
-
static #e = this.styles = [l,
|
|
1746
|
+
static #e = this.styles = [l, Xt];
|
|
1720
1747
|
static #t = this.dependencies = {
|
|
1721
1748
|
"cx-button": _,
|
|
1722
|
-
"cx-checkbox":
|
|
1723
|
-
"cx-details":
|
|
1749
|
+
"cx-checkbox": se,
|
|
1750
|
+
"cx-details": T,
|
|
1724
1751
|
"cx-icon": h,
|
|
1725
|
-
"cx-space":
|
|
1752
|
+
"cx-space": C,
|
|
1726
1753
|
"cx-tooltip": ne,
|
|
1727
|
-
"cx-typography":
|
|
1754
|
+
"cx-typography": b
|
|
1728
1755
|
};
|
|
1729
1756
|
handleApply(e) {
|
|
1730
1757
|
this.emit("cx-asset-link-format-metadata-change", { detail: e.target.checked });
|
|
@@ -1739,61 +1766,61 @@ var Ut = X, Wt = t`cx-details::part(base){border-bottom-width:0}`, Z = class ext
|
|
|
1739
1766
|
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="short_text"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("metadata")}</cx-typography></cx-space><cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-metadata-tooltip" content=${this.localize.term("metadataHelpText")} hoist><cx-checkbox data-testid="cx-asset-link-format-metadata" class="details__checkbox" ?checked=${this.value} @cx-change=${this.handleApply}>${this.localize.term("preserveMetadata")}</cx-checkbox></cx-tooltip></cx-space></cx-details>`;
|
|
1740
1767
|
}
|
|
1741
1768
|
};
|
|
1742
|
-
a([c(".details"), o("design:type",
|
|
1769
|
+
a([c(".details"), o("design:type", T === void 0 ? Object : T)], X.prototype, "base", void 0), a([r({
|
|
1743
1770
|
reflect: !0,
|
|
1744
1771
|
type: Boolean
|
|
1745
|
-
}), o("design:type", Object)],
|
|
1772
|
+
}), o("design:type", Object)], X.prototype, "open", void 0), a([r({
|
|
1746
1773
|
reflect: !0,
|
|
1747
1774
|
type: Boolean
|
|
1748
|
-
}), o("design:type", Object)],
|
|
1749
|
-
var
|
|
1750
|
-
[
|
|
1751
|
-
[
|
|
1752
|
-
[
|
|
1753
|
-
[
|
|
1754
|
-
[
|
|
1755
|
-
},
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
],
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
...
|
|
1766
|
-
],
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
], $ = class extends s {
|
|
1773
|
-
static #e =
|
|
1774
|
-
static #t = this.styles = [l,
|
|
1775
|
+
}), o("design:type", Object)], X.prototype, "value", void 0), X = a([u("cx-asset-link-format-metadata")], X);
|
|
1776
|
+
var Zt = X, Z, Qt = {
|
|
1777
|
+
[k.Crop]: D.Crop,
|
|
1778
|
+
[k.Dimensions]: D.Dimensions,
|
|
1779
|
+
[k.Quality]: D.Quality,
|
|
1780
|
+
[k.Resize]: D.Resize,
|
|
1781
|
+
[k.Rotate]: D.Rotate
|
|
1782
|
+
}, Q = [
|
|
1783
|
+
k.Proxy,
|
|
1784
|
+
k.Crop,
|
|
1785
|
+
k.Resize,
|
|
1786
|
+
k.Rotate,
|
|
1787
|
+
k.Quality,
|
|
1788
|
+
k.Metadata
|
|
1789
|
+
], $t = [
|
|
1790
|
+
k.Proxy,
|
|
1791
|
+
k.Dimensions,
|
|
1792
|
+
...Q.slice(1)
|
|
1793
|
+
], en = [
|
|
1794
|
+
k.Dimensions,
|
|
1795
|
+
k.Crop,
|
|
1796
|
+
k.Resize,
|
|
1797
|
+
k.Rotate,
|
|
1798
|
+
k.Quality
|
|
1799
|
+
], tn = "|", $ = class extends s {
|
|
1800
|
+
static #e = Z = this;
|
|
1801
|
+
static #t = this.styles = [l, kt];
|
|
1775
1802
|
static #n = this.dependencies = {
|
|
1776
|
-
"cx-asset-link-format-crop":
|
|
1777
|
-
"cx-asset-link-format-dimensions":
|
|
1778
|
-
"cx-asset-link-format-extension":
|
|
1779
|
-
"cx-asset-link-format-metadata":
|
|
1780
|
-
"cx-asset-link-format-proxy":
|
|
1781
|
-
"cx-asset-link-format-quality":
|
|
1782
|
-
"cx-asset-link-format-resize":
|
|
1783
|
-
"cx-asset-link-format-rotation":
|
|
1803
|
+
"cx-asset-link-format-crop": jt,
|
|
1804
|
+
"cx-asset-link-format-dimensions": Pt,
|
|
1805
|
+
"cx-asset-link-format-extension": It,
|
|
1806
|
+
"cx-asset-link-format-metadata": Zt,
|
|
1807
|
+
"cx-asset-link-format-proxy": zt,
|
|
1808
|
+
"cx-asset-link-format-quality": Wt,
|
|
1809
|
+
"cx-asset-link-format-resize": qt,
|
|
1810
|
+
"cx-asset-link-format-rotation": Yt,
|
|
1784
1811
|
"cx-button": _,
|
|
1785
1812
|
"cx-icon": h,
|
|
1786
1813
|
"cx-icon-button": p,
|
|
1787
|
-
"cx-space":
|
|
1788
|
-
"cx-switch":
|
|
1789
|
-
"cx-typography":
|
|
1790
|
-
"cx-visually-hidden":
|
|
1814
|
+
"cx-space": C,
|
|
1815
|
+
"cx-switch": Ce,
|
|
1816
|
+
"cx-typography": b,
|
|
1817
|
+
"cx-visually-hidden": ue
|
|
1791
1818
|
};
|
|
1792
1819
|
static getTransformExtension(e) {
|
|
1793
|
-
return !e ||
|
|
1820
|
+
return !e || Tt(e) ? e : "jpg";
|
|
1794
1821
|
}
|
|
1795
1822
|
static fitRatioResizeSize(e, t, n, r) {
|
|
1796
|
-
let { height: i, width: a } =
|
|
1823
|
+
let { height: i, width: a } = ae(n, r, e, t);
|
|
1797
1824
|
return {
|
|
1798
1825
|
height: Math.max(i, 1),
|
|
1799
1826
|
width: Math.max(a, 1)
|
|
@@ -1803,7 +1830,7 @@ var Gt = Z, Q, Kt = {
|
|
|
1803
1830
|
return [...new Map(e.map((e) => [e.key, e])).values()];
|
|
1804
1831
|
}
|
|
1805
1832
|
static orderTransformations(e, t) {
|
|
1806
|
-
let n = t.map((e) =>
|
|
1833
|
+
let n = t.map((e) => Qt[e]).filter((e) => e !== void 0), r = e.filter((e) => n.includes(e.key)).sort((e, t) => n.indexOf(e.key) - n.indexOf(t.key)), i = 0;
|
|
1807
1834
|
return e.map((e) => n.includes(e.key) ? r[i++] : e);
|
|
1808
1835
|
}
|
|
1809
1836
|
static getDimensionsPresetSize(e) {
|
|
@@ -1814,24 +1841,36 @@ var Gt = Z, Q, Kt = {
|
|
|
1814
1841
|
} : void 0;
|
|
1815
1842
|
}
|
|
1816
1843
|
static getDimensionsSize(e) {
|
|
1817
|
-
if (e?.mode ===
|
|
1818
|
-
if (e?.mode ===
|
|
1844
|
+
if (e?.mode === E.Preset) return Z.getDimensionsPresetSize(e.value);
|
|
1845
|
+
if (e?.mode === E.Custom && e.unit === O.Pixel && Number.isInteger(e.width) && Number.isInteger(e.height) && e.width >= 1 && e.height >= 1) return {
|
|
1819
1846
|
height: e.height,
|
|
1820
1847
|
width: e.width
|
|
1821
1848
|
};
|
|
1822
1849
|
}
|
|
1850
|
+
static getPercentDimensions(e) {
|
|
1851
|
+
return e?.mode === E.Custom && e.unit === O.Percent ? e : void 0;
|
|
1852
|
+
}
|
|
1853
|
+
static parsePercentDimensions(e) {
|
|
1854
|
+
let t = /^\s*(\d+)\s*%\s*,\s*(\d+)\s*%\s*$/.exec(e), n = Number(t?.[1]), r = Number(t?.[2]);
|
|
1855
|
+
return n >= 1 && n <= 100 && r === n ? {
|
|
1856
|
+
height: r,
|
|
1857
|
+
mode: E.Custom,
|
|
1858
|
+
unit: O.Percent,
|
|
1859
|
+
width: n
|
|
1860
|
+
} : void 0;
|
|
1861
|
+
}
|
|
1823
1862
|
static getSizeBoundAfterStep(e, t) {
|
|
1824
1863
|
let { height: n = 0, rotation: r = 0, unit: i, width: a = 0 } = t.value, o = Math.round(a) >= 1 && Math.round(n) >= 1;
|
|
1825
1864
|
switch (t.key) {
|
|
1826
|
-
case
|
|
1865
|
+
case D.Resize: return i !== M.AspectRatio && o ? {
|
|
1827
1866
|
height: Math.round(n),
|
|
1828
1867
|
width: Math.round(a)
|
|
1829
1868
|
} : void 0;
|
|
1830
|
-
case
|
|
1869
|
+
case D.Dimensions: return o ? {
|
|
1831
1870
|
height: Math.min(e?.height ?? Infinity, Math.round(n)),
|
|
1832
1871
|
width: Math.min(e?.width ?? Infinity, Math.round(a))
|
|
1833
1872
|
} : e;
|
|
1834
|
-
case
|
|
1873
|
+
case D.Rotate: {
|
|
1835
1874
|
if (!e) return;
|
|
1836
1875
|
let t = r * Math.PI / 180, n = Math.abs(Math.cos(t)), i = Math.abs(Math.sin(t));
|
|
1837
1876
|
return {
|
|
@@ -1842,28 +1881,32 @@ var Gt = Z, Q, Kt = {
|
|
|
1842
1881
|
default: return e;
|
|
1843
1882
|
}
|
|
1844
1883
|
}
|
|
1884
|
+
#r;
|
|
1885
|
+
#i;
|
|
1886
|
+
#a;
|
|
1887
|
+
#o;
|
|
1845
1888
|
get canReorder() {
|
|
1846
1889
|
return this.reorderable && !this.asset;
|
|
1847
1890
|
}
|
|
1848
1891
|
get isFormatsLayout() {
|
|
1849
|
-
return this.layout ===
|
|
1892
|
+
return this.layout === xe.Formats;
|
|
1850
1893
|
}
|
|
1851
1894
|
get hasUnfrozenTransformations() {
|
|
1852
1895
|
return !(this.transformations.length === 0 || this.frozenIndex !== void 0 && this.frozenIndex >= this.transformations.length - 1);
|
|
1853
1896
|
}
|
|
1854
1897
|
get lastAppliedCropUnit() {
|
|
1855
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1898
|
+
return this.transformations.findLast((e) => e.key === D.Crop)?.value.unit ?? M.Pixel;
|
|
1856
1899
|
}
|
|
1857
1900
|
get lastAppliedCropFocusMode() {
|
|
1858
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1901
|
+
return this.transformations.findLast((e) => e.key === D.Crop)?.value.focusMode ?? "manual";
|
|
1859
1902
|
}
|
|
1860
1903
|
get lastAppliedCropPosition() {
|
|
1861
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1904
|
+
return this.transformations.findLast((e) => e.key === D.Crop)?.value.position ?? v.CenterCenter;
|
|
1862
1905
|
}
|
|
1863
1906
|
get disabledCropApply() {
|
|
1864
1907
|
if (!this.asset && this.cropSize.unit !== this.lastAppliedCropUnit) return !1;
|
|
1865
|
-
if (this.cropSize.unit ===
|
|
1866
|
-
let e = this.lastCropSize[
|
|
1908
|
+
if (this.cropSize.unit === M.AspectRatio && !this.asset) {
|
|
1909
|
+
let e = this.lastCropSize[M.AspectRatio];
|
|
1867
1910
|
return this.cropSize.ratioWidth === e.width && this.cropSize.ratioHeight === e.height && this.cropSize.focusMode === this.lastAppliedCropFocusMode && this.cropSize.position === this.lastAppliedCropPosition;
|
|
1868
1911
|
}
|
|
1869
1912
|
if (!this.asset && this.cropSize.focusMode !== this.lastAppliedCropFocusMode || !this.asset && this.cropSize.position !== this.lastAppliedCropPosition) return !1;
|
|
@@ -1874,14 +1917,14 @@ var Gt = Z, Q, Kt = {
|
|
|
1874
1917
|
"width",
|
|
1875
1918
|
"x",
|
|
1876
1919
|
"y"
|
|
1877
|
-
]) if (this.cropSize[e] !== this.lastCropSize[
|
|
1920
|
+
]) if (this.cropSize[e] !== this.lastCropSize[M.Pixel][e]) return !1;
|
|
1878
1921
|
return !0;
|
|
1879
1922
|
}
|
|
1880
1923
|
get formats() {
|
|
1881
1924
|
return this.proxies?.filter((e) => !e.cdnName) || [];
|
|
1882
1925
|
}
|
|
1883
1926
|
get activeParts() {
|
|
1884
|
-
let e = new Set(Object.values(
|
|
1927
|
+
let e = new Set(Object.values(k)), t = /* @__PURE__ */ new Set();
|
|
1885
1928
|
for (let n of this.parts) e.has(n) && t.add(n);
|
|
1886
1929
|
return [...t];
|
|
1887
1930
|
}
|
|
@@ -1892,70 +1935,78 @@ var Gt = Z, Q, Kt = {
|
|
|
1892
1935
|
};
|
|
1893
1936
|
}
|
|
1894
1937
|
get stepsBeforeCrop() {
|
|
1895
|
-
let e = this.transformations.findIndex((e) => e.key ===
|
|
1938
|
+
let e = this.transformations.findIndex((e) => e.key === D.Crop);
|
|
1896
1939
|
if (e >= 0) return this.transformations.slice(0, e);
|
|
1897
1940
|
if (!this.canReorder) return this.transformations;
|
|
1898
1941
|
let t = {
|
|
1899
|
-
key:
|
|
1942
|
+
key: D.Crop,
|
|
1900
1943
|
value: {}
|
|
1901
|
-
}, n =
|
|
1944
|
+
}, n = Z.orderTransformations([...this.transformations, t], this.activeParts);
|
|
1902
1945
|
return n.slice(0, n.indexOf(t));
|
|
1903
1946
|
}
|
|
1904
1947
|
get cropMaxSize() {
|
|
1905
|
-
return this.stepsBeforeCrop.reduce(
|
|
1948
|
+
return this.stepsBeforeCrop.reduce(Z.getSizeBoundAfterStep, void 0) ?? {
|
|
1906
1949
|
height: Infinity,
|
|
1907
1950
|
width: Infinity
|
|
1908
1951
|
};
|
|
1909
1952
|
}
|
|
1953
|
+
get #s() {
|
|
1954
|
+
if (!this.canPercentDimensions) return "";
|
|
1955
|
+
let e = Z.getPercentDimensions(this.selectedDimensions);
|
|
1956
|
+
return e ? `${tn}${e.width}%,${e.height}%` : tn;
|
|
1957
|
+
}
|
|
1958
|
+
get #c() {
|
|
1959
|
+
return this.canPercentDimensions && this.canCustomDimensions && !this.asset && this.activeParts.includes(k.Dimensions);
|
|
1960
|
+
}
|
|
1910
1961
|
get isCropAtDimensionsLimit() {
|
|
1911
1962
|
let e = this.stepsBeforeCrop;
|
|
1912
|
-
if (this.asset || this.cropSize.unit !==
|
|
1963
|
+
if (this.asset || this.cropSize.unit !== M.Pixel || !e.some((e) => e.key === D.Dimensions)) return !1;
|
|
1913
1964
|
let t = {
|
|
1914
1965
|
height: Infinity,
|
|
1915
1966
|
width: Infinity
|
|
1916
|
-
}, n = e.reduce(
|
|
1967
|
+
}, n = e.reduce(Z.getSizeBoundAfterStep, void 0) ?? t, r = e.filter((e) => e.key !== D.Dimensions).reduce(Z.getSizeBoundAfterStep, void 0) ?? t;
|
|
1917
1968
|
return n.width < r.width && this.cropSize.width >= n.width || n.height < r.height && this.cropSize.height >= n.height;
|
|
1918
1969
|
}
|
|
1919
1970
|
get lastCropSize() {
|
|
1920
1971
|
if (!this.asset) {
|
|
1921
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1922
|
-
if (e?.value.unit ===
|
|
1923
|
-
[
|
|
1972
|
+
let e = this.transformations.findLast((e) => e.key === D.Crop);
|
|
1973
|
+
if (e?.value.unit === M.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
|
|
1974
|
+
[M.AspectRatio]: {
|
|
1924
1975
|
height: e.value.ratioHeight,
|
|
1925
1976
|
percentageHeight: 100,
|
|
1926
1977
|
percentageWidth: 100,
|
|
1927
|
-
unit:
|
|
1978
|
+
unit: M.AspectRatio,
|
|
1928
1979
|
width: e.value.ratioWidth,
|
|
1929
1980
|
x: 0,
|
|
1930
1981
|
y: 0
|
|
1931
1982
|
},
|
|
1932
|
-
[
|
|
1983
|
+
[M.Pixel]: {
|
|
1933
1984
|
height: 1,
|
|
1934
1985
|
percentageHeight: 100,
|
|
1935
1986
|
percentageWidth: 100,
|
|
1936
|
-
unit:
|
|
1987
|
+
unit: M.Pixel,
|
|
1937
1988
|
width: 1,
|
|
1938
1989
|
x: 0,
|
|
1939
1990
|
y: 0
|
|
1940
1991
|
}
|
|
1941
1992
|
};
|
|
1942
1993
|
if (e?.value.width && e?.value.height) {
|
|
1943
|
-
let { height: t, width: n, x: r = 0, y: i = 0 } = e.value, a =
|
|
1994
|
+
let { height: t, width: n, x: r = 0, y: i = 0 } = e.value, a = ie(n, t);
|
|
1944
1995
|
return {
|
|
1945
|
-
[
|
|
1996
|
+
[M.AspectRatio]: {
|
|
1946
1997
|
height: a.height,
|
|
1947
1998
|
percentageHeight: 100,
|
|
1948
1999
|
percentageWidth: 100,
|
|
1949
|
-
unit:
|
|
2000
|
+
unit: M.AspectRatio,
|
|
1950
2001
|
width: a.width,
|
|
1951
2002
|
x: 0,
|
|
1952
2003
|
y: 0
|
|
1953
2004
|
},
|
|
1954
|
-
[
|
|
2005
|
+
[M.Pixel]: {
|
|
1955
2006
|
height: t,
|
|
1956
2007
|
percentageHeight: 100,
|
|
1957
2008
|
percentageWidth: 100,
|
|
1958
|
-
unit:
|
|
2009
|
+
unit: M.Pixel,
|
|
1959
2010
|
width: n,
|
|
1960
2011
|
x: r,
|
|
1961
2012
|
y: i
|
|
@@ -1963,25 +2014,25 @@ var Gt = Z, Q, Kt = {
|
|
|
1963
2014
|
};
|
|
1964
2015
|
}
|
|
1965
2016
|
}
|
|
1966
|
-
let e = this.lastImageSize.width && this.lastImageSize.height ?
|
|
2017
|
+
let e = this.lastImageSize.width && this.lastImageSize.height ? ie(this.lastImageSize.width, this.lastImageSize.height) : {
|
|
1967
2018
|
height: 1,
|
|
1968
2019
|
width: 1
|
|
1969
2020
|
};
|
|
1970
2021
|
return {
|
|
1971
|
-
[
|
|
2022
|
+
[M.AspectRatio]: {
|
|
1972
2023
|
height: e.height,
|
|
1973
2024
|
percentageHeight: 100,
|
|
1974
2025
|
percentageWidth: 100,
|
|
1975
|
-
unit:
|
|
2026
|
+
unit: M.AspectRatio,
|
|
1976
2027
|
width: e.width,
|
|
1977
2028
|
x: 0,
|
|
1978
2029
|
y: 0
|
|
1979
2030
|
},
|
|
1980
|
-
[
|
|
2031
|
+
[M.Pixel]: {
|
|
1981
2032
|
height: this.lastImageSize.height,
|
|
1982
2033
|
percentageHeight: 100,
|
|
1983
2034
|
percentageWidth: 100,
|
|
1984
|
-
unit:
|
|
2035
|
+
unit: M.Pixel,
|
|
1985
2036
|
width: this.lastImageSize.width,
|
|
1986
2037
|
x: 0,
|
|
1987
2038
|
y: 0
|
|
@@ -1990,57 +2041,57 @@ var Gt = Z, Q, Kt = {
|
|
|
1990
2041
|
}
|
|
1991
2042
|
get lastResizeSize() {
|
|
1992
2043
|
if (!this.asset) {
|
|
1993
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1994
|
-
if (e?.value.unit ===
|
|
1995
|
-
[
|
|
2044
|
+
let e = this.transformations.findLast((e) => e.key === D.Resize);
|
|
2045
|
+
if (e?.value.unit === M.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
|
|
2046
|
+
[M.AspectRatio]: {
|
|
1996
2047
|
height: e.value.ratioHeight,
|
|
1997
|
-
unit:
|
|
2048
|
+
unit: M.AspectRatio,
|
|
1998
2049
|
width: e.value.ratioWidth
|
|
1999
2050
|
},
|
|
2000
|
-
[
|
|
2051
|
+
[M.Pixel]: {
|
|
2001
2052
|
height: 1,
|
|
2002
|
-
unit:
|
|
2053
|
+
unit: M.Pixel,
|
|
2003
2054
|
width: 1
|
|
2004
2055
|
}
|
|
2005
2056
|
};
|
|
2006
2057
|
if (e?.value.width && e?.value.height) {
|
|
2007
|
-
let { height: t, width: n } = e.value, r =
|
|
2058
|
+
let { height: t, width: n } = e.value, r = ie(n, t);
|
|
2008
2059
|
return {
|
|
2009
|
-
[
|
|
2060
|
+
[M.AspectRatio]: {
|
|
2010
2061
|
height: r.height,
|
|
2011
|
-
unit:
|
|
2062
|
+
unit: M.AspectRatio,
|
|
2012
2063
|
width: r.width
|
|
2013
2064
|
},
|
|
2014
|
-
[
|
|
2065
|
+
[M.Pixel]: {
|
|
2015
2066
|
height: t,
|
|
2016
|
-
unit:
|
|
2067
|
+
unit: M.Pixel,
|
|
2017
2068
|
width: n
|
|
2018
2069
|
}
|
|
2019
2070
|
};
|
|
2020
2071
|
}
|
|
2021
2072
|
}
|
|
2022
|
-
let e = this.lastImageSize.width && this.lastImageSize.height ?
|
|
2073
|
+
let e = this.lastImageSize.width && this.lastImageSize.height ? ie(this.lastImageSize.width, this.lastImageSize.height) : {
|
|
2023
2074
|
height: 1,
|
|
2024
2075
|
width: 1
|
|
2025
2076
|
};
|
|
2026
2077
|
return {
|
|
2027
|
-
[
|
|
2078
|
+
[M.AspectRatio]: {
|
|
2028
2079
|
height: e.height,
|
|
2029
|
-
unit:
|
|
2080
|
+
unit: M.AspectRatio,
|
|
2030
2081
|
width: e.width
|
|
2031
2082
|
},
|
|
2032
|
-
[
|
|
2083
|
+
[M.Pixel]: {
|
|
2033
2084
|
height: this.lastImageSize.height,
|
|
2034
|
-
unit:
|
|
2085
|
+
unit: M.Pixel,
|
|
2035
2086
|
width: this.lastImageSize.width
|
|
2036
2087
|
}
|
|
2037
2088
|
};
|
|
2038
2089
|
}
|
|
2039
2090
|
get lastRotation() {
|
|
2040
|
-
return this.asset ? 0 : this.transformations.findLast((e) => e.key ===
|
|
2091
|
+
return this.asset ? 0 : this.transformations.findLast((e) => e.key === D.Rotate)?.value.rotation ?? 0;
|
|
2041
2092
|
}
|
|
2042
2093
|
get transformationString() {
|
|
2043
|
-
return
|
|
2094
|
+
return ge({
|
|
2044
2095
|
asset: this.asset,
|
|
2045
2096
|
baseUrl: "",
|
|
2046
2097
|
parameters: this.parameters,
|
|
@@ -2049,7 +2100,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2049
2100
|
}).replace(/\/t\//g, "");
|
|
2050
2101
|
}
|
|
2051
2102
|
constructor() {
|
|
2052
|
-
super(), this.localize = new d(this), this.initialParts = [...
|
|
2103
|
+
super(), this.localize = new d(this), this.initialParts = [...Q], this.sortableRevision = 0, this.dragPreviousSibling = null, this.#r = void 0, this.#i = !1, this.#a = [], this.#o = [], this.baseUrl = void 0, this.token = void 0, this.asset = void 0, this.cropModes = [
|
|
2053
2104
|
{
|
|
2054
2105
|
label: "Free",
|
|
2055
2106
|
value: "free"
|
|
@@ -2108,7 +2159,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2108
2159
|
label: "Smart Swatch",
|
|
2109
2160
|
value: "SmartSwatch"
|
|
2110
2161
|
}
|
|
2111
|
-
], this.extensions = [], this.proxies = void 0, this.forCropper = void 0, this.useSession = "", this.transformations = [], this.selectedProxy = "", this.defaultProxy = "", this.canAutoFormat = !1, this.autoFormat = !1, this.useCustomExtension = !1, this.parts = this.initialParts, this.layout =
|
|
2162
|
+
], this.extensions = [], this.proxies = void 0, this.forCropper = void 0, this.useSession = "", this.transformations = [], this.selectedProxy = "", this.defaultProxy = "", this.canAutoFormat = !1, this.autoFormat = !1, this.useCustomExtension = !1, this.parts = this.initialParts, this.layout = xe.Accordion, this.cropEnabled = !1, this.reorderable = !1, this.dimensionsItems = [], this.qualityItems = [], this.canCustomDimensions = !1, this.canPercentDimensions = !1, this.percentDimensions = "", this.lastImageSize = {
|
|
2112
2163
|
height: 0,
|
|
2113
2164
|
width: 0
|
|
2114
2165
|
}, this.hideHeader = !1, this.canReset = !1, this.queryElement = null, this.activeSetting = "cx-asset-link-format-proxy", this.selectedFormat = void 0, this.resizeSize = {
|
|
@@ -2116,7 +2167,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2116
2167
|
keepAspectRatio: !0,
|
|
2117
2168
|
ratioHeight: 1,
|
|
2118
2169
|
ratioWidth: 1,
|
|
2119
|
-
unit:
|
|
2170
|
+
unit: M.Pixel,
|
|
2120
2171
|
width: 1
|
|
2121
2172
|
}, this.cropSize = {
|
|
2122
2173
|
cropMode: "free",
|
|
@@ -2128,14 +2179,14 @@ var Gt = Z, Q, Kt = {
|
|
|
2128
2179
|
position: v.CenterCenter,
|
|
2129
2180
|
ratioHeight: 1,
|
|
2130
2181
|
ratioWidth: 1,
|
|
2131
|
-
unit:
|
|
2182
|
+
unit: M.Pixel,
|
|
2132
2183
|
width: 1,
|
|
2133
2184
|
x: 0,
|
|
2134
2185
|
y: 0
|
|
2135
2186
|
}, this.rotation = 0, this.defaultSize = {
|
|
2136
2187
|
height: 0,
|
|
2137
2188
|
width: 0
|
|
2138
|
-
}, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.reorderAnnouncement = "", this.orderUndo = [], this.apiGetTransformAssetLink =
|
|
2189
|
+
}, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.reorderAnnouncement = "", this.orderUndo = [], this.apiGetTransformAssetLink = pt, this.apiGetCropFocusMode = vt, this.onCropComplete = this.onCropComplete.bind(this), this.onCropDragStart = this.onCropDragStart.bind(this);
|
|
2139
2190
|
}
|
|
2140
2191
|
runConnectedCallback() {
|
|
2141
2192
|
this.hasUpdated && (this.syncSortable(), this.handleCropperSelectorChange(), this.cropperElement && (this.cropperElement.addEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.addEventListener("cx-cropper-crop-drag-start", this.onCropDragStart)));
|
|
@@ -2144,7 +2195,9 @@ var Gt = Z, Q, Kt = {
|
|
|
2144
2195
|
super.disconnectedCallback(), this.sortableRevision++, this.destroySortable(), this.cropperElement && (this.cropperElement.removeEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.removeEventListener("cx-cropper-crop-drag-start", this.onCropDragStart));
|
|
2145
2196
|
}
|
|
2146
2197
|
willUpdate(e) {
|
|
2147
|
-
super.willUpdate(e), e.has("dimensionsItems") && this.syncSelectedDimensions(!1);
|
|
2198
|
+
super.willUpdate(e), this.parts ??= this.initialParts, e.has("dimensionsItems") && this.syncSelectedDimensions(!1);
|
|
2199
|
+
let t = this.#c, n = t !== this.#i;
|
|
2200
|
+
this.#i = t, (e.has("percentDimensions") || n) && this.#m(), this.#p(e);
|
|
2148
2201
|
}
|
|
2149
2202
|
updated(e) {
|
|
2150
2203
|
if ((e.has("forCropper") || e.has("queryElement")) && this.handleCropperSelectorChange(), e.has("asset") && this.handleAssetChange(), e.has("proxies") && this.handleProxiesChange(), this.autoFormat && (e.has("asset") || e.has("proxies"))) {
|
|
@@ -2154,7 +2207,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2154
2207
|
if (e.has("activeSetting") && this.handleActiveSettingChange(), e.has("selectedFormat") && this.handleSelectedFormatChange(), e.has("resizeSize") && this.handleResizeSizeChange(), e.has("cropSize") && this.handleCropSizeChange(), e.has("rotation") && this.handleRotationChange(), e.has("cropperElement") && this.handleCropperElementChange(), e.has("selectedFormat")) {
|
|
2155
2208
|
if (!this.asset || !this.selectedFormat || this.selectedFormat.extension === e.get("selectedFormat")?.extension) return;
|
|
2156
2209
|
this.loading = !0, this.requestTransformAsset().then((e) => {
|
|
2157
|
-
this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction ===
|
|
2210
|
+
this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction === D.Rotate && (this.rotation = 0), this.lastAction = void 0, this.lastImageSize = {
|
|
2158
2211
|
height: e.height,
|
|
2159
2212
|
width: e.width
|
|
2160
2213
|
}, this.selectedFormat = {
|
|
@@ -2164,7 +2217,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2164
2217
|
width: e.width
|
|
2165
2218
|
});
|
|
2166
2219
|
});
|
|
2167
|
-
let t =
|
|
2220
|
+
let t = ge({
|
|
2168
2221
|
asset: this.asset,
|
|
2169
2222
|
baseUrl: "",
|
|
2170
2223
|
extension: this.selectedFormat.extension,
|
|
@@ -2188,7 +2241,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2188
2241
|
get transformRequestOptions() {
|
|
2189
2242
|
return {
|
|
2190
2243
|
assetId: this.asset?.id ?? "",
|
|
2191
|
-
extension:
|
|
2244
|
+
extension: Z.getTransformExtension(this.selectedFormat?.extension ?? ""),
|
|
2192
2245
|
format: this.proxies?.find((e) => e.id === this.selectedProxy)?.proxyName ?? "",
|
|
2193
2246
|
siteUrl: this.baseUrl,
|
|
2194
2247
|
token: this.token,
|
|
@@ -2218,20 +2271,20 @@ var Gt = Z, Q, Kt = {
|
|
|
2218
2271
|
this.frozenIndex = this.transformations.length - 1;
|
|
2219
2272
|
}
|
|
2220
2273
|
upsertTransformation(e) {
|
|
2221
|
-
e.key ===
|
|
2274
|
+
e.key === D.Crop && (this.editedCrop = e), this.asset || (this.transformations = Z.uniqueTransformations(this.transformations));
|
|
2222
2275
|
let t = this.transformations.findIndex((t) => t.key === e.key);
|
|
2223
2276
|
if (t >= 0) {
|
|
2224
2277
|
let n = [...this.transformations];
|
|
2225
2278
|
n[t] = e, this.transformations = n;
|
|
2226
2279
|
} else this.transformations = [...this.transformations, e];
|
|
2227
|
-
this.canReorder && (this.transformations =
|
|
2280
|
+
this.canReorder && (this.transformations = Z.orderTransformations(this.transformations, this.activeParts));
|
|
2228
2281
|
}
|
|
2229
2282
|
isCropPanelSize(e) {
|
|
2230
|
-
let { height: t, ratioHeight: n, ratioWidth: r, unit: i =
|
|
2231
|
-
return i === this.cropSize.unit ? i ===
|
|
2283
|
+
let { height: t, ratioHeight: n, ratioWidth: r, unit: i = M.Pixel, width: a } = e.value;
|
|
2284
|
+
return i === this.cropSize.unit ? i === M.AspectRatio ? r === this.cropSize.ratioWidth && n === this.cropSize.ratioHeight : a === this.cropSize.width && t === this.cropSize.height : !1;
|
|
2232
2285
|
}
|
|
2233
|
-
#
|
|
2234
|
-
let { height: t = 0, ratioHeight: n = 0, ratioWidth: r = 0, unit: i =
|
|
2286
|
+
#l(e) {
|
|
2287
|
+
let { height: t = 0, ratioHeight: n = 0, ratioWidth: r = 0, unit: i = M.Pixel, width: a = 0 } = e.value, o = i === M.AspectRatio, s = o ? r : a, c = o ? n : t;
|
|
2235
2288
|
if (!s || !c) return;
|
|
2236
2289
|
let l = this.cropModes.filter((e) => !e.auto && /^\d+:\d+$/.test(e.value)).map(({ value: e }) => {
|
|
2237
2290
|
let [t, n] = e.split(":").map(Number);
|
|
@@ -2244,8 +2297,8 @@ var Gt = Z, Q, Kt = {
|
|
|
2244
2297
|
return u || o ? u?.value : l.find(({ modeHeight: e, modeWidth: t }) => Math.abs(t * c - e * s) <= Math.max(t, e) / 2)?.value;
|
|
2245
2298
|
}
|
|
2246
2299
|
capCropToMaxSize() {
|
|
2247
|
-
let e = this.transformations.find((e) => e.key ===
|
|
2248
|
-
if (this.asset || !e || (e.value.unit ??
|
|
2300
|
+
let e = this.transformations.find((e) => e.key === D.Crop);
|
|
2301
|
+
if (this.asset || !e || (e.value.unit ?? M.Pixel) !== M.Pixel) return;
|
|
2249
2302
|
let { height: t = 0, width: n = 0 } = e.value, r = this.cropMaxSize;
|
|
2250
2303
|
if (n <= r.width && t <= r.height) return;
|
|
2251
2304
|
let i = Math.min(t, r.height), a = Math.min(n, r.width), o = this.isCropPanelSize(e) && n * i === t * a;
|
|
@@ -2266,20 +2319,20 @@ var Gt = Z, Q, Kt = {
|
|
|
2266
2319
|
async handleTransformationsChange(e) {
|
|
2267
2320
|
let t = e, n = this.canReorder && t !== void 0 && t.length === this.transformations.length && t.every((e) => this.transformations.includes(e));
|
|
2268
2321
|
if (!this.asset) {
|
|
2269
|
-
let e =
|
|
2322
|
+
let e = Z.uniqueTransformations(this.transformations), t = this.canReorder ? Z.orderTransformations(e, this.activeParts) : e;
|
|
2270
2323
|
(t.length !== this.transformations.length || t.some((e, t) => e !== this.transformations[t])) && (this.transformations = t), n || this.capCropToMaxSize();
|
|
2271
2324
|
}
|
|
2272
2325
|
if (this.syncSelectedDimensions(), await this.updateComplete, !this.asset) {
|
|
2273
|
-
if (this.emit("cx-asset-link-format-change", { detail:
|
|
2326
|
+
if (this.emit("cx-asset-link-format-change", { detail: ge({
|
|
2274
2327
|
asset: this.asset,
|
|
2275
2328
|
baseUrl: "",
|
|
2276
2329
|
options: { omitZeroXY: !0 },
|
|
2277
2330
|
parameters: this.parameters,
|
|
2278
2331
|
transformations: this.transformations,
|
|
2279
2332
|
useSession: this.useSession
|
|
2280
|
-
}).replace(/\/t\//g, "") }), n) return;
|
|
2281
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2282
|
-
if (e?.value.unit ===
|
|
2333
|
+
}).replace(/\/t\//g, "") + this.#s }), n) return;
|
|
2334
|
+
let e = this.transformations.findLast((e) => e.key === D.Crop && (e.value.unit === M.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width && e.value.height)), t = e !== void 0 && e === this.editedCrop && this.isCropPanelSize(e), r = e && !t ? this.#l(e) : void 0, i = t ? this.cropSize.cropMode : r ?? "free";
|
|
2335
|
+
if (e?.value.unit === M.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) {
|
|
2283
2336
|
let { focusMode: n, position: r, ratioHeight: a, ratioWidth: o } = e.value;
|
|
2284
2337
|
this.cropSize = {
|
|
2285
2338
|
...this.cropSize,
|
|
@@ -2291,7 +2344,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2291
2344
|
position: r ?? v.CenterCenter,
|
|
2292
2345
|
ratioHeight: a,
|
|
2293
2346
|
ratioWidth: o,
|
|
2294
|
-
unit:
|
|
2347
|
+
unit: M.AspectRatio
|
|
2295
2348
|
};
|
|
2296
2349
|
} else if (e) {
|
|
2297
2350
|
let { focusMode: t, height: n, position: a, unit: o, width: s, x: c = 0, y: l = 0 } = e.value;
|
|
@@ -2304,7 +2357,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2304
2357
|
percentageHeight: 100,
|
|
2305
2358
|
percentageWidth: 100,
|
|
2306
2359
|
position: a ?? v.CenterCenter,
|
|
2307
|
-
unit: o ??
|
|
2360
|
+
unit: o ?? M.Pixel,
|
|
2308
2361
|
width: s,
|
|
2309
2362
|
x: c,
|
|
2310
2363
|
y: l
|
|
@@ -2317,37 +2370,37 @@ var Gt = Z, Q, Kt = {
|
|
|
2317
2370
|
percentageHeight: 0,
|
|
2318
2371
|
percentageWidth: 0,
|
|
2319
2372
|
position: v.CenterCenter,
|
|
2320
|
-
unit:
|
|
2373
|
+
unit: M.Pixel,
|
|
2321
2374
|
width: 1,
|
|
2322
2375
|
x: 0,
|
|
2323
2376
|
y: 0
|
|
2324
2377
|
};
|
|
2325
|
-
let a = this.transformations.findLast((e) => e.key ===
|
|
2326
|
-
if (a?.value.unit ===
|
|
2378
|
+
let a = this.transformations.findLast((e) => e.key === D.Resize && (e.value.unit === M.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width || e.value.height));
|
|
2379
|
+
if (a?.value.unit === M.AspectRatio && a.value.ratioWidth && a.value.ratioHeight) {
|
|
2327
2380
|
let { ratioHeight: e, ratioWidth: t } = a.value;
|
|
2328
2381
|
this.resizeSize = {
|
|
2329
2382
|
...this.resizeSize,
|
|
2330
2383
|
ratioHeight: e,
|
|
2331
2384
|
ratioWidth: t,
|
|
2332
|
-
unit:
|
|
2385
|
+
unit: M.AspectRatio
|
|
2333
2386
|
};
|
|
2334
2387
|
} else if (a) {
|
|
2335
2388
|
let { height: e = 0, unit: t, width: n = 0 } = a.value;
|
|
2336
2389
|
this.resizeSize = {
|
|
2337
2390
|
...this.resizeSize,
|
|
2338
2391
|
height: e,
|
|
2339
|
-
unit: t ??
|
|
2392
|
+
unit: t ?? M.Pixel,
|
|
2340
2393
|
width: n
|
|
2341
2394
|
};
|
|
2342
2395
|
} else this.resizeSize = {
|
|
2343
2396
|
...this.resizeSize,
|
|
2344
2397
|
height: 1,
|
|
2345
|
-
unit:
|
|
2398
|
+
unit: M.Pixel,
|
|
2346
2399
|
width: 1
|
|
2347
2400
|
};
|
|
2348
|
-
let o = this.transformations.findLast((e) => e.key ===
|
|
2401
|
+
let o = this.transformations.findLast((e) => e.key === D.Rotate);
|
|
2349
2402
|
this.rotation = o?.value.rotation ?? 0;
|
|
2350
|
-
let s = this.transformations.findLast((e) => e.key ===
|
|
2403
|
+
let s = this.transformations.findLast((e) => e.key === D.Quality)?.value.quality ?? 100, c = this.transformations.some((e) => e.key === D.Metadata);
|
|
2351
2404
|
this.selectedFormat = this.selectedFormat ? {
|
|
2352
2405
|
...this.selectedFormat,
|
|
2353
2406
|
keepMetadata: c,
|
|
@@ -2377,7 +2430,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2377
2430
|
keepAspectRatio: !0,
|
|
2378
2431
|
ratioHeight: 1,
|
|
2379
2432
|
ratioWidth: 1,
|
|
2380
|
-
unit:
|
|
2433
|
+
unit: M.Pixel,
|
|
2381
2434
|
width: r.width
|
|
2382
2435
|
}, this.cropSize = {
|
|
2383
2436
|
cropMode: "free",
|
|
@@ -2389,12 +2442,12 @@ var Gt = Z, Q, Kt = {
|
|
|
2389
2442
|
position: v.CenterCenter,
|
|
2390
2443
|
ratioHeight: 1,
|
|
2391
2444
|
ratioWidth: 1,
|
|
2392
|
-
unit:
|
|
2445
|
+
unit: M.Pixel,
|
|
2393
2446
|
width: r.width,
|
|
2394
2447
|
x: 0,
|
|
2395
2448
|
y: 0
|
|
2396
|
-
}, this.lastAction ===
|
|
2397
|
-
let i = this.transformations.some((e) => e.key ===
|
|
2449
|
+
}, this.lastAction === D.Rotate && (this.rotation = 0), this.lastAction = void 0;
|
|
2450
|
+
let i = this.transformations.some((e) => e.key === D.Metadata), a = this.transformations.findLast((e) => e.key === D.Quality);
|
|
2398
2451
|
this.selectedFormat = {
|
|
2399
2452
|
...this.selectedFormat,
|
|
2400
2453
|
height: r.height,
|
|
@@ -2403,7 +2456,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2403
2456
|
url: this.baseUrl && this.baseUrl.length > 0 ? `${this.baseUrl}/${r.relativePath}` : r.relativePath,
|
|
2404
2457
|
width: r.width
|
|
2405
2458
|
};
|
|
2406
|
-
let o =
|
|
2459
|
+
let o = ge({
|
|
2407
2460
|
asset: this.asset,
|
|
2408
2461
|
baseUrl: "",
|
|
2409
2462
|
extension: this.selectedFormat.extension,
|
|
@@ -2425,7 +2478,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2425
2478
|
height: Number.parseInt(this.asset.height, 10),
|
|
2426
2479
|
width: Number.parseInt(this.asset.width, 10)
|
|
2427
2480
|
});
|
|
2428
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2481
|
+
let e = this.transformations.findLast((e) => e.key === D.Quality);
|
|
2429
2482
|
this.selectedFormat = {
|
|
2430
2483
|
extension: this.asset.extension,
|
|
2431
2484
|
height: this.defaultSize.height,
|
|
@@ -2450,7 +2503,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2450
2503
|
position: v.CenterCenter,
|
|
2451
2504
|
ratioHeight: 1,
|
|
2452
2505
|
ratioWidth: 1,
|
|
2453
|
-
unit:
|
|
2506
|
+
unit: M.Pixel,
|
|
2454
2507
|
width: this.defaultSize.width,
|
|
2455
2508
|
x: 0,
|
|
2456
2509
|
y: 0
|
|
@@ -2469,7 +2522,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2469
2522
|
t.proxyName === "TRX" && (t.formatHeight = Number(this.asset.height), t.formatWidth = Number(this.asset.width));
|
|
2470
2523
|
let n = this.proxies?.find((t) => t.id === e);
|
|
2471
2524
|
n && (this.asset && n.proxyName === "TRX" && (n.formatHeight = Number(this.asset.height), n.formatWidth = Number(this.asset.width)), this.transformations = this.transformations.map((e) => {
|
|
2472
|
-
if (e.key ===
|
|
2525
|
+
if (e.key === D.Crop) {
|
|
2473
2526
|
let r = e.value, i = r.width / n.formatWidth * t.formatWidth, a = r.height / n.formatHeight * t.formatHeight, o = r.x / n.formatWidth * t.formatWidth, s = r.y / n.formatHeight * t.formatHeight;
|
|
2474
2527
|
return {
|
|
2475
2528
|
...e,
|
|
@@ -2482,7 +2535,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2482
2535
|
}
|
|
2483
2536
|
};
|
|
2484
2537
|
}
|
|
2485
|
-
if (e.key ===
|
|
2538
|
+
if (e.key === D.Resize) {
|
|
2486
2539
|
let r = e.value, i = r.width / n.formatWidth * t.formatWidth, a = r.height / n.formatHeight * t.formatHeight;
|
|
2487
2540
|
return {
|
|
2488
2541
|
...e,
|
|
@@ -2503,24 +2556,24 @@ var Gt = Z, Q, Kt = {
|
|
|
2503
2556
|
}, await this.updateComplete, this.cropSize = {
|
|
2504
2557
|
cropMode: "free",
|
|
2505
2558
|
focusMode: "manual",
|
|
2506
|
-
height: this.lastCropSize[
|
|
2559
|
+
height: this.lastCropSize[M.Pixel].height,
|
|
2507
2560
|
keepAspectRatio: !0,
|
|
2508
2561
|
percentageHeight: 100,
|
|
2509
2562
|
percentageWidth: 100,
|
|
2510
2563
|
position: v.CenterCenter,
|
|
2511
2564
|
ratioHeight: 1,
|
|
2512
2565
|
ratioWidth: 1,
|
|
2513
|
-
unit:
|
|
2514
|
-
width: this.lastCropSize[
|
|
2566
|
+
unit: M.Pixel,
|
|
2567
|
+
width: this.lastCropSize[M.Pixel].width,
|
|
2515
2568
|
x: 0,
|
|
2516
2569
|
y: 0
|
|
2517
2570
|
}, this.resizeSize = {
|
|
2518
|
-
height: this.lastResizeSize[
|
|
2571
|
+
height: this.lastResizeSize[M.Pixel].height,
|
|
2519
2572
|
keepAspectRatio: !0,
|
|
2520
2573
|
ratioHeight: 1,
|
|
2521
2574
|
ratioWidth: 1,
|
|
2522
|
-
unit:
|
|
2523
|
-
width: this.lastResizeSize[
|
|
2575
|
+
unit: M.Pixel,
|
|
2576
|
+
width: this.lastResizeSize[M.Pixel].width
|
|
2524
2577
|
};
|
|
2525
2578
|
}
|
|
2526
2579
|
handleLoadingChange() {
|
|
@@ -2540,17 +2593,17 @@ var Gt = Z, Q, Kt = {
|
|
|
2540
2593
|
}
|
|
2541
2594
|
handlePartsChange() {
|
|
2542
2595
|
if (this.activeParts.some((e) => {
|
|
2543
|
-
let t = e ===
|
|
2596
|
+
let t = e === k.Rotate ? "rotation" : e;
|
|
2544
2597
|
return this.activeSetting === `cx-asset-link-format-${t}`;
|
|
2545
2598
|
}) || (this.activeSetting = ""), this.canReorder) {
|
|
2546
|
-
let e =
|
|
2599
|
+
let e = Z.orderTransformations(Z.uniqueTransformations(this.transformations), this.activeParts);
|
|
2547
2600
|
(e.length !== this.transformations.length || e.some((e, t) => e !== this.transformations[t])) && (this.transformations = e);
|
|
2548
2601
|
}
|
|
2549
2602
|
}
|
|
2550
2603
|
handleReorderableChange() {
|
|
2551
2604
|
if (this.orderUndo = [], this.canReorder && this.parts === this.initialParts && this.transformations.length > 0) {
|
|
2552
|
-
let e =
|
|
2553
|
-
this.parts =
|
|
2605
|
+
let e = Z.uniqueTransformations(this.transformations).flatMap((e) => Q.filter((t) => Qt[t] === e.key)), t = [...e, ...Q.filter((t) => Qt[t] && !e.includes(t))], n = 0;
|
|
2606
|
+
this.parts = Q.map((e) => Qt[e] ? t[n++] : e);
|
|
2554
2607
|
}
|
|
2555
2608
|
this.handlePartsChange(), this.syncSortable();
|
|
2556
2609
|
}
|
|
@@ -2588,6 +2641,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2588
2641
|
this.orderUndo = [...this.orderUndo, {
|
|
2589
2642
|
autoFormat: this.autoFormat,
|
|
2590
2643
|
parts: [...this.activeParts],
|
|
2644
|
+
percentDimensions: Z.getPercentDimensions(this.selectedDimensions),
|
|
2591
2645
|
selectedProxy: this.selectedProxy,
|
|
2592
2646
|
transformations: this.transformations.map((e) => ({
|
|
2593
2647
|
...e,
|
|
@@ -2606,12 +2660,12 @@ var Gt = Z, Q, Kt = {
|
|
|
2606
2660
|
}
|
|
2607
2661
|
movePart(e, t) {
|
|
2608
2662
|
if (!this.canReorder || this.loading) return;
|
|
2609
|
-
let n = this.activeParts.filter((e) =>
|
|
2663
|
+
let n = this.activeParts.filter((e) => en.includes(e)), r = n.indexOf(e);
|
|
2610
2664
|
if (r < 0 || t < 0 || t >= n.length || r === t) return;
|
|
2611
2665
|
this.rememberOrder(), n.splice(r, 1), n.splice(t, 0, e);
|
|
2612
2666
|
let i = 0;
|
|
2613
|
-
this.parts = this.activeParts.map((e) =>
|
|
2614
|
-
let a =
|
|
2667
|
+
this.parts = this.activeParts.map((e) => en.includes(e) ? n[i++] : e);
|
|
2668
|
+
let a = Z.orderTransformations(this.transformations, this.parts);
|
|
2615
2669
|
a.some((e, t) => e !== this.transformations[t]) && (this.transformations = a), this.capCropToMaxSize(), this.reorderAnnouncement = `${this.localize.term(e)}: ${t + 1} / ${n.length}`, this.emitReorder(), this.updateComplete.then(() => {
|
|
2616
2670
|
this.shadowRoot?.querySelector(`[data-part="${e}"] .asset-link-format__drag-handle`)?.focus();
|
|
2617
2671
|
});
|
|
@@ -2619,22 +2673,22 @@ var Gt = Z, Q, Kt = {
|
|
|
2619
2673
|
handleReorderKeyDown(e) {
|
|
2620
2674
|
if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
|
|
2621
2675
|
e.preventDefault(), e.stopPropagation();
|
|
2622
|
-
let t = e.currentTarget.closest("[data-part]")?.dataset.part, n = this.activeParts.filter((e) =>
|
|
2676
|
+
let t = e.currentTarget.closest("[data-part]")?.dataset.part, n = this.activeParts.filter((e) => en.includes(e));
|
|
2623
2677
|
this.movePart(t, n.indexOf(t) + (e.key === "ArrowUp" ? -1 : 1));
|
|
2624
2678
|
}
|
|
2625
2679
|
handleActiveSettingChange() {
|
|
2626
2680
|
this.cropperElement && (this.resizeSize = {
|
|
2627
|
-
height: this.lastResizeSize[
|
|
2681
|
+
height: this.lastResizeSize[M.Pixel].height,
|
|
2628
2682
|
keepAspectRatio: !0,
|
|
2629
2683
|
ratioHeight: 1,
|
|
2630
2684
|
ratioWidth: 1,
|
|
2631
|
-
unit:
|
|
2632
|
-
width: this.lastResizeSize[
|
|
2685
|
+
unit: M.Pixel,
|
|
2686
|
+
width: this.lastResizeSize[M.Pixel].width
|
|
2633
2687
|
}, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop");
|
|
2634
2688
|
}
|
|
2635
2689
|
async handleRequestAutoCropSuggestion({ cropMode: e, focusMode: t, height: n, keepAspectRatio: r, percentageHeight: i, percentageWidth: a, ratioHeight: o, ratioWidth: s, unit: c, useCropMode: l, width: u }) {
|
|
2636
2690
|
if (!this.selectedFormat?.url || t === "manual") return;
|
|
2637
|
-
this.loading = !0, this.lastAction =
|
|
2691
|
+
this.loading = !0, this.lastAction = D.Crop;
|
|
2638
2692
|
let d = await this.apiGetCropFocusMode({
|
|
2639
2693
|
autoCropMode: t,
|
|
2640
2694
|
cropHeight: n,
|
|
@@ -2672,7 +2726,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2672
2726
|
if (r === 0 || n === 0) return;
|
|
2673
2727
|
let o = this.cropSize.percentageWidth !== r, s = this.cropSize.percentageHeight !== n, c = this.cropSize.height, l = this.cropSize.width;
|
|
2674
2728
|
o && (l = Math.round(r * this.selectedFormat.width / 100)), s && (c = Math.round(n * this.selectedFormat.height / 100));
|
|
2675
|
-
let u = this.cropSize.focusMode, d = this.focusModes.find((e) => e.value === u)?.auto, f = l !== this.cropSize.width || c !== this.cropSize.height, p = f ? this.#
|
|
2729
|
+
let u = this.cropSize.focusMode, d = this.focusModes.find((e) => e.value === u)?.auto, f = l !== this.cropSize.width || c !== this.cropSize.height, p = f ? this.#u(l, c) : {};
|
|
2676
2730
|
d && this.selectedFormat?.url && this.cropperElement ? await this.handleRequestAutoCropSuggestion({
|
|
2677
2731
|
...p,
|
|
2678
2732
|
focusMode: u,
|
|
@@ -2689,13 +2743,13 @@ var Gt = Z, Q, Kt = {
|
|
|
2689
2743
|
width: l,
|
|
2690
2744
|
x: i,
|
|
2691
2745
|
y: a
|
|
2692
|
-
}, f && this.#
|
|
2746
|
+
}, f && this.#f();
|
|
2693
2747
|
}
|
|
2694
|
-
#
|
|
2748
|
+
#u(e, t) {
|
|
2695
2749
|
let { keepAspectRatio: n, unit: r } = this.cropSize, i = {};
|
|
2696
|
-
return n ? i : (this.#
|
|
2750
|
+
return n ? i : (this.#d(e, t) && (i.cropMode = "free"), r === M.AspectRatio && (i.ratioHeight = t, i.ratioWidth = e), i);
|
|
2697
2751
|
}
|
|
2698
|
-
#
|
|
2752
|
+
#d(e, t) {
|
|
2699
2753
|
let n = /^(\d+):(\d+)$/.exec(this.cropSize.cropMode);
|
|
2700
2754
|
return n !== null && Number(n[1]) * t !== Number(n[2]) * e;
|
|
2701
2755
|
}
|
|
@@ -2715,12 +2769,12 @@ var Gt = Z, Q, Kt = {
|
|
|
2715
2769
|
this.activeSetting === e.target.localName && (this.activeSetting = "");
|
|
2716
2770
|
}
|
|
2717
2771
|
get autoResolvedProxyId() {
|
|
2718
|
-
let e =
|
|
2772
|
+
let e = me(this.asset?.extension, this.asset?.size);
|
|
2719
2773
|
return this.proxies?.find((t) => t.proxyName === e)?.id ?? "";
|
|
2720
2774
|
}
|
|
2721
2775
|
onProxyChange(e) {
|
|
2722
2776
|
let t = e.detail;
|
|
2723
|
-
if (this.lastAction =
|
|
2777
|
+
if (this.lastAction = D.Proxy, t.autoFormat) {
|
|
2724
2778
|
this.autoFormat = !0;
|
|
2725
2779
|
let e = this.autoResolvedProxyId;
|
|
2726
2780
|
e && (this.selectedProxy = e);
|
|
@@ -2736,7 +2790,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2736
2790
|
});
|
|
2737
2791
|
else {
|
|
2738
2792
|
let e = this.focusModes.find((e) => e.value === this.cropSize.focusMode)?.auto, n = this.cropSize.keepAspectRatio, r = this.cropSize.focusMode, i = this.cropSize.x, a = this.cropSize.y;
|
|
2739
|
-
t === "free" ? (n = !1, this.cropperElement && (r = "manual")) : this.cropSize.unit ===
|
|
2793
|
+
t === "free" ? (n = !1, this.cropperElement && (r = "manual")) : this.cropSize.unit === M.Pixel && !e && (i = 0, a = 0), this.focusModes.find((e) => e.value === r)?.auto && this.selectedFormat?.url ? await this.handleRequestAutoCropSuggestion({
|
|
2740
2794
|
cropMode: t,
|
|
2741
2795
|
focusMode: r,
|
|
2742
2796
|
height: this.cropSize.height,
|
|
@@ -2772,11 +2826,11 @@ var Gt = Z, Q, Kt = {
|
|
|
2772
2826
|
}
|
|
2773
2827
|
async onCropChange(e) {
|
|
2774
2828
|
let t = this.cropSize.unit;
|
|
2775
|
-
if (e.detail.unit ===
|
|
2829
|
+
if (e.detail.unit === M.AspectRatio) {
|
|
2776
2830
|
let t = e.detail.width / e.detail.height, n = this.asset ? Math.min(Math.max(Math.round(this.cropSize.height * t), 1), this.resizeSize.width) : 0, r = this.asset ? Math.min(Math.max(Math.round(n / t), 1), this.resizeSize.height) : 0, i = this.asset ? r * 100 / this.selectedFormat.height : 100, a = this.asset ? n * 100 / this.selectedFormat.width : 100, o = this.cropSize.x, s = this.cropSize.y;
|
|
2777
2831
|
o + a > 100 && (o = 100 - a), s + i > 100 && (s = 100 - i);
|
|
2778
|
-
let c = this.cropSize.cropMode, l = this.cropModes.find((e) => e.value === c)?.auto, u = !e.detail.keepAspectRatio && this.#
|
|
2779
|
-
(l || u) && (c = "free"), e.detail.silent ? (this.cropSize.height = r, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = a, this.cropSize.ratioHeight = e.detail.height, this.cropSize.ratioWidth = e.detail.width, this.cropSize.unit =
|
|
2832
|
+
let c = this.cropSize.cropMode, l = this.cropModes.find((e) => e.value === c)?.auto, u = !e.detail.keepAspectRatio && this.#d(e.detail.width, e.detail.height);
|
|
2833
|
+
(l || u) && (c = "free"), e.detail.silent ? (this.cropSize.height = r, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = a, this.cropSize.ratioHeight = e.detail.height, this.cropSize.ratioWidth = e.detail.width, this.cropSize.unit = M.AspectRatio, this.cropSize.width = n) : this.cropSize = {
|
|
2780
2834
|
...this.cropSize,
|
|
2781
2835
|
cropMode: c,
|
|
2782
2836
|
height: r,
|
|
@@ -2785,7 +2839,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2785
2839
|
percentageWidth: a,
|
|
2786
2840
|
ratioHeight: e.detail.height,
|
|
2787
2841
|
ratioWidth: e.detail.width,
|
|
2788
|
-
unit:
|
|
2842
|
+
unit: M.AspectRatio,
|
|
2789
2843
|
width: n,
|
|
2790
2844
|
x: o,
|
|
2791
2845
|
y: s
|
|
@@ -2794,14 +2848,14 @@ var Gt = Z, Q, Kt = {
|
|
|
2794
2848
|
let t = this.asset ? e.detail.height * 100 / this.selectedFormat.height : 100, n = this.asset ? e.detail.width * 100 / this.selectedFormat.width : 100, r = this.cropSize.x, i = this.cropSize.y;
|
|
2795
2849
|
r + n > 100 && (r = 100 - n), i + t > 100 && (i = 100 - t);
|
|
2796
2850
|
let a = this.cropSize.cropMode, o = this.cropModes.find((e) => e.value === a)?.auto;
|
|
2797
|
-
(e.detail.breakAspectRatio || o) && (a = "free"), e.detail.silent ? (this.cropSize.cropMode = a, this.cropSize.height = e.detail.height, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = t, this.cropSize.percentageWidth = n, this.cropSize.unit =
|
|
2851
|
+
(e.detail.breakAspectRatio || o) && (a = "free"), e.detail.silent ? (this.cropSize.cropMode = a, this.cropSize.height = e.detail.height, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = t, this.cropSize.percentageWidth = n, this.cropSize.unit = M.Pixel, this.cropSize.width = e.detail.width, this.cropSize.x = r, this.cropSize.y = i) : this.cropSize = {
|
|
2798
2852
|
...this.cropSize,
|
|
2799
2853
|
cropMode: a,
|
|
2800
2854
|
height: e.detail.height,
|
|
2801
2855
|
keepAspectRatio: e.detail.keepAspectRatio,
|
|
2802
2856
|
percentageHeight: t,
|
|
2803
2857
|
percentageWidth: n,
|
|
2804
|
-
unit:
|
|
2858
|
+
unit: M.Pixel,
|
|
2805
2859
|
width: e.detail.width,
|
|
2806
2860
|
x: r,
|
|
2807
2861
|
y: i
|
|
@@ -2812,10 +2866,10 @@ var Gt = Z, Q, Kt = {
|
|
|
2812
2866
|
cropMode: "free"
|
|
2813
2867
|
}), this.onCropChanged()), this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
|
|
2814
2868
|
}
|
|
2815
|
-
#
|
|
2869
|
+
#f() {
|
|
2816
2870
|
let { ratioHeight: e, ratioWidth: t, unit: n } = this.cropSize;
|
|
2817
|
-
if (n !==
|
|
2818
|
-
let r =
|
|
2871
|
+
if (n !== M.AspectRatio) return;
|
|
2872
|
+
let r = ie(t, e);
|
|
2819
2873
|
(r.width !== t || r.height !== e) && (this.cropSize = {
|
|
2820
2874
|
...this.cropSize,
|
|
2821
2875
|
ratioHeight: r.height,
|
|
@@ -2823,7 +2877,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2823
2877
|
});
|
|
2824
2878
|
}
|
|
2825
2879
|
async onCropChanged() {
|
|
2826
|
-
this.#
|
|
2880
|
+
this.#f(), this.focusModes.find((e) => e.value === this.cropSize.focusMode)?.auto && await this.handleRequestAutoCropSuggestion({
|
|
2827
2881
|
focusMode: this.cropSize.focusMode,
|
|
2828
2882
|
height: this.cropSize.height,
|
|
2829
2883
|
width: this.cropSize.width
|
|
@@ -2837,11 +2891,11 @@ var Gt = Z, Q, Kt = {
|
|
|
2837
2891
|
unit: this.cropSize.unit,
|
|
2838
2892
|
width: this.cropSize.width
|
|
2839
2893
|
}) {
|
|
2840
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2894
|
+
if (this.clearResetSnapshot(), this.lastAction = D.Crop, !this.asset) {
|
|
2841
2895
|
let { focusMode: e, height: t, position: n, ratioHeight: r, ratioWidth: i, unit: a, width: o, x: s, y: c } = this.cropSize, l = this.focusModes.find((t) => t.value === e)?.auto ?? !1;
|
|
2842
|
-
if (a ===
|
|
2896
|
+
if (a === M.AspectRatio) {
|
|
2843
2897
|
i && r && this.upsertTransformation({
|
|
2844
|
-
key:
|
|
2898
|
+
key: D.Crop,
|
|
2845
2899
|
value: {
|
|
2846
2900
|
focusMode: e,
|
|
2847
2901
|
isFocusModeAuto: l,
|
|
@@ -2854,7 +2908,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2854
2908
|
return;
|
|
2855
2909
|
}
|
|
2856
2910
|
(t || o) && Number.isFinite(t) && Number.isFinite(o) && this.upsertTransformation({
|
|
2857
|
-
key:
|
|
2911
|
+
key: D.Crop,
|
|
2858
2912
|
value: {
|
|
2859
2913
|
focusMode: e,
|
|
2860
2914
|
height: t,
|
|
@@ -2873,8 +2927,8 @@ var Gt = Z, Q, Kt = {
|
|
|
2873
2927
|
let a = this.cropSize.focusMode, o = this.focusModes.find((e) => e.value === a)?.auto ?? !1;
|
|
2874
2928
|
if (t && i && r) {
|
|
2875
2929
|
let e = i, s = t;
|
|
2876
|
-
if (r ===
|
|
2877
|
-
key:
|
|
2930
|
+
if (r === M.AspectRatio && (e = this.cropSize.percentageWidth * this.selectedFormat.width / 100, s = this.cropSize.percentageHeight * this.selectedFormat.height / 100), n) this.transformations = [...this.transformations, {
|
|
2931
|
+
key: D.Crop,
|
|
2878
2932
|
value: {
|
|
2879
2933
|
focusMode: a,
|
|
2880
2934
|
height: s,
|
|
@@ -2886,7 +2940,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2886
2940
|
else {
|
|
2887
2941
|
let t = this.cropSize.x / 100 * this.selectedFormat.width, n = this.cropSize.y / 100 * this.selectedFormat.height;
|
|
2888
2942
|
this.transformations = [...this.transformations, {
|
|
2889
|
-
key:
|
|
2943
|
+
key: D.Crop,
|
|
2890
2944
|
value: {
|
|
2891
2945
|
focusMode: a,
|
|
2892
2946
|
height: s,
|
|
@@ -2899,7 +2953,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2899
2953
|
}];
|
|
2900
2954
|
}
|
|
2901
2955
|
} else n && (this.transformations = [...this.transformations, {
|
|
2902
|
-
key:
|
|
2956
|
+
key: D.Crop,
|
|
2903
2957
|
value: {
|
|
2904
2958
|
focusMode: a,
|
|
2905
2959
|
isFocusModeAuto: o,
|
|
@@ -2909,15 +2963,15 @@ var Gt = Z, Q, Kt = {
|
|
|
2909
2963
|
}
|
|
2910
2964
|
getRatioResizePreviewSize(e, t) {
|
|
2911
2965
|
let { height: n, width: r } = this.imageSize;
|
|
2912
|
-
if (this.asset && r && n) return
|
|
2913
|
-
let i = e / t, a = Math.max(Math.round(this.lastResizeSize[
|
|
2966
|
+
if (this.asset && r && n) return Z.fitRatioResizeSize(e, t, r, n);
|
|
2967
|
+
let i = e / t, a = Math.max(Math.round(this.lastResizeSize[M.Pixel].height * i), 0);
|
|
2914
2968
|
return {
|
|
2915
2969
|
height: Math.max(Math.round(a / i), 0),
|
|
2916
2970
|
width: a
|
|
2917
2971
|
};
|
|
2918
2972
|
}
|
|
2919
2973
|
onResizeChange(e) {
|
|
2920
|
-
if (e.detail.unit ===
|
|
2974
|
+
if (e.detail.unit === M.AspectRatio) {
|
|
2921
2975
|
let { height: t, width: n } = this.getRatioResizePreviewSize(e.detail.width, e.detail.height);
|
|
2922
2976
|
this.resizeSize = {
|
|
2923
2977
|
...this.resizeSize,
|
|
@@ -2939,11 +2993,11 @@ var Gt = Z, Q, Kt = {
|
|
|
2939
2993
|
onResizeApply(e) {
|
|
2940
2994
|
let { height: t, unit: n, width: r } = e.detail;
|
|
2941
2995
|
if (!Number.isFinite(r) || !Number.isFinite(t)) return;
|
|
2942
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2943
|
-
if (n ===
|
|
2996
|
+
if (this.clearResetSnapshot(), this.lastAction = D.Resize, !this.asset) {
|
|
2997
|
+
if (n === M.AspectRatio) {
|
|
2944
2998
|
let { ratioHeight: e, ratioWidth: t } = this.resizeSize;
|
|
2945
2999
|
t && e && this.upsertTransformation({
|
|
2946
|
-
key:
|
|
3000
|
+
key: D.Resize,
|
|
2947
3001
|
value: {
|
|
2948
3002
|
ratioHeight: e,
|
|
2949
3003
|
ratioWidth: t,
|
|
@@ -2953,7 +3007,7 @@ var Gt = Z, Q, Kt = {
|
|
|
2953
3007
|
return;
|
|
2954
3008
|
}
|
|
2955
3009
|
(t || r) && (this.upsertTransformation({
|
|
2956
|
-
key:
|
|
3010
|
+
key: D.Resize,
|
|
2957
3011
|
value: {
|
|
2958
3012
|
height: t,
|
|
2959
3013
|
unit: n,
|
|
@@ -2964,8 +3018,8 @@ var Gt = Z, Q, Kt = {
|
|
|
2964
3018
|
}
|
|
2965
3019
|
if (!this.selectedFormat) return;
|
|
2966
3020
|
let i = this.selectedFormat.width || this.defaultSize.width, a = this.selectedFormat.height || this.defaultSize.height, o = r, s = t;
|
|
2967
|
-
this.resizeSize.unit === n ? n ===
|
|
2968
|
-
key:
|
|
3021
|
+
this.resizeSize.unit === n ? n === M.AspectRatio && ({height: s, width: o} = Z.fitRatioResizeSize(r, t, i, a)) : (o = i, s = a), this.transformations = [...this.transformations, {
|
|
3022
|
+
key: D.Resize,
|
|
2969
3023
|
value: {
|
|
2970
3024
|
height: s,
|
|
2971
3025
|
unit: n,
|
|
@@ -2980,23 +3034,23 @@ var Gt = Z, Q, Kt = {
|
|
|
2980
3034
|
this.applyRotationTransformation(e.detail);
|
|
2981
3035
|
}
|
|
2982
3036
|
applyRotationTransformation(e) {
|
|
2983
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
3037
|
+
if (this.clearResetSnapshot(), this.lastAction = D.Rotate, !this.asset) {
|
|
2984
3038
|
e ? this.upsertTransformation({
|
|
2985
|
-
key:
|
|
3039
|
+
key: D.Rotate,
|
|
2986
3040
|
value: { rotation: e }
|
|
2987
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
3041
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== D.Rotate);
|
|
2988
3042
|
return;
|
|
2989
3043
|
}
|
|
2990
3044
|
this.selectedFormat && (this.transformations = [...this.transformations, {
|
|
2991
|
-
key:
|
|
3045
|
+
key: D.Rotate,
|
|
2992
3046
|
value: { rotation: e }
|
|
2993
3047
|
}]);
|
|
2994
3048
|
}
|
|
2995
3049
|
onQualityChange(e) {
|
|
2996
3050
|
let t = e.detail;
|
|
2997
|
-
this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction =
|
|
3051
|
+
this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction = D.Quality;
|
|
2998
3052
|
let n = {
|
|
2999
|
-
key:
|
|
3053
|
+
key: D.Quality,
|
|
3000
3054
|
value: { quality: t }
|
|
3001
3055
|
};
|
|
3002
3056
|
this.asset ? this.transformations = [...this.transformations, n] : this.upsertTransformation(n);
|
|
@@ -3008,15 +3062,15 @@ var Gt = Z, Q, Kt = {
|
|
|
3008
3062
|
keepMetadata: t
|
|
3009
3063
|
}, !this.asset) {
|
|
3010
3064
|
t ? this.upsertTransformation({
|
|
3011
|
-
key:
|
|
3065
|
+
key: D.Metadata,
|
|
3012
3066
|
value: { keepMetadata: t }
|
|
3013
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
3067
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== D.Metadata);
|
|
3014
3068
|
return;
|
|
3015
3069
|
}
|
|
3016
3070
|
t ? this.upsertTransformation({
|
|
3017
|
-
key:
|
|
3071
|
+
key: D.Metadata,
|
|
3018
3072
|
value: { keepMetadata: t }
|
|
3019
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
3073
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== D.Metadata);
|
|
3020
3074
|
}
|
|
3021
3075
|
onExtensionChange(e) {
|
|
3022
3076
|
let t = e.detail;
|
|
@@ -3026,14 +3080,14 @@ var Gt = Z, Q, Kt = {
|
|
|
3026
3080
|
};
|
|
3027
3081
|
}
|
|
3028
3082
|
syncQuality() {
|
|
3029
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
3083
|
+
let e = this.transformations.findLast((e) => e.key === D.Quality)?.value?.quality;
|
|
3030
3084
|
this.selectedFormat &&= {
|
|
3031
3085
|
...this.selectedFormat,
|
|
3032
3086
|
quality: e ?? 100
|
|
3033
3087
|
};
|
|
3034
3088
|
}
|
|
3035
3089
|
syncSelectedDimensions(e = !0) {
|
|
3036
|
-
let t = this.transformations.findLast((e) => e.key ===
|
|
3090
|
+
let t = this.transformations.findLast((e) => e.key === D.Dimensions), n = Z.getDimensionsSize(this.selectedDimensions);
|
|
3037
3091
|
if (!t) {
|
|
3038
3092
|
n && (this.selectedDimensions = void 0);
|
|
3039
3093
|
return;
|
|
@@ -3041,55 +3095,70 @@ var Gt = Z, Q, Kt = {
|
|
|
3041
3095
|
let r = Math.round(t.value.width ?? 0), i = Math.round(t.value.height ?? 0);
|
|
3042
3096
|
if (e && n?.width === r && n.height === i) return;
|
|
3043
3097
|
let a = this.dimensionsItems.find((e) => {
|
|
3044
|
-
let t =
|
|
3098
|
+
let t = Z.getDimensionsPresetSize(e.value);
|
|
3045
3099
|
return !e.disabled && t?.width === r && t.height === i;
|
|
3046
3100
|
});
|
|
3047
3101
|
this.selectedDimensions = a ? {
|
|
3048
|
-
mode:
|
|
3102
|
+
mode: E.Preset,
|
|
3049
3103
|
value: a.value
|
|
3050
3104
|
} : {
|
|
3051
3105
|
height: i,
|
|
3052
|
-
mode:
|
|
3053
|
-
unit:
|
|
3106
|
+
mode: E.Custom,
|
|
3107
|
+
unit: O.Pixel,
|
|
3054
3108
|
width: r
|
|
3055
3109
|
};
|
|
3056
3110
|
}
|
|
3111
|
+
#p(e) {
|
|
3112
|
+
e.has("cropModes") && (this.#a = this.cropModes.some((e) => e.value === "free") ? this.cropModes : [{
|
|
3113
|
+
label: this.localize.term("cropFreeMode"),
|
|
3114
|
+
value: "free"
|
|
3115
|
+
}, ...this.cropModes]), e.has("focusModes") && (this.#o = this.focusModes.some((e) => e.value === "manual") ? this.focusModes : [{
|
|
3116
|
+
label: this.localize.term("cropManualFocus"),
|
|
3117
|
+
value: "manual"
|
|
3118
|
+
}, ...this.focusModes]);
|
|
3119
|
+
}
|
|
3120
|
+
#m() {
|
|
3121
|
+
this.transformations.some((e) => e.key === D.Dimensions) || this.#h(this.#i ? Z.parsePercentDimensions(this.percentDimensions) : void 0);
|
|
3122
|
+
}
|
|
3123
|
+
#h(e) {
|
|
3124
|
+
e ? this.selectedDimensions = e : Z.getPercentDimensions(this.selectedDimensions) && (this.selectedDimensions = void 0);
|
|
3125
|
+
}
|
|
3057
3126
|
get hasResettableState() {
|
|
3058
|
-
let e =
|
|
3059
|
-
return this.canReorder && this.activeParts.some((t, n) => t !== e[n]) || this.transformations.length > 0 ? !0 : this.canAutoFormat && !this.autoFormat;
|
|
3127
|
+
let e = $t.filter((e) => this.activeParts.includes(e));
|
|
3128
|
+
return this.canReorder && this.activeParts.some((t, n) => t !== e[n]) || this.transformations.length > 0 || Z.getPercentDimensions(this.selectedDimensions) ? !0 : this.canAutoFormat && !this.autoFormat;
|
|
3060
3129
|
}
|
|
3061
3130
|
clearResetSnapshot() {
|
|
3062
|
-
this.canReorder && this.rememberOrder(), this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0;
|
|
3131
|
+
this.canReorder && this.rememberOrder(), this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.#r = void 0;
|
|
3063
3132
|
}
|
|
3064
3133
|
handleUndo() {
|
|
3065
3134
|
if (this.canReorder && this.orderUndo.length > 0) {
|
|
3066
3135
|
let e = this.orderUndo[this.orderUndo.length - 1];
|
|
3067
|
-
this.orderUndo = this.orderUndo.slice(0, -1), this.parts = e.parts, this.autoFormat = e.autoFormat, this.selectedProxy = e.selectedProxy, this.transformations = e.transformations, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.emitReorder(), this.syncQuality();
|
|
3136
|
+
this.orderUndo = this.orderUndo.slice(0, -1), this.parts = e.parts, this.autoFormat = e.autoFormat, this.selectedProxy = e.selectedProxy, this.#h(e.percentDimensions), this.transformations = e.transformations, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.#r = void 0, this.emitReorder(), this.syncQuality();
|
|
3068
3137
|
return;
|
|
3069
3138
|
}
|
|
3070
|
-
!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();
|
|
3139
|
+
!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.#h(this.#r), this.#r = void 0) : this.transformations = this.transformations.slice(0, -1), this.syncQuality();
|
|
3071
3140
|
}
|
|
3072
3141
|
handleReset() {
|
|
3073
|
-
if (this.canReorder && this.rememberOrder(), this.preResetTransformations = [...this.transformations], this.preResetAutoFormat = this.autoFormat, this.preResetSelectedProxy = this.selectedProxy, this.canAutoFormat) this.autoFormat = !0, this.selectedProxy = this.autoResolvedProxyId || this.selectedProxy;
|
|
3142
|
+
if (this.canReorder && this.rememberOrder(), this.preResetTransformations = [...this.transformations], this.preResetAutoFormat = this.autoFormat, this.preResetSelectedProxy = this.selectedProxy, this.#r = Z.getPercentDimensions(this.selectedDimensions), this.#h(void 0), this.canAutoFormat) this.autoFormat = !0, this.selectedProxy = this.autoResolvedProxyId || this.selectedProxy;
|
|
3074
3143
|
else {
|
|
3075
3144
|
let e = !!this.defaultProxy && !!this.proxies?.some((e) => e.id === this.defaultProxy);
|
|
3076
3145
|
this.selectedProxy = e ? this.defaultProxy : this.selectedProxy || this.proxies?.[0]?.id || "";
|
|
3077
3146
|
}
|
|
3078
|
-
this.transformations = [], this.canReorder && (this.parts =
|
|
3147
|
+
this.transformations = [], this.canReorder && (this.parts = $t.filter((e) => this.activeParts.includes(e)), this.emitReorder()), this.frozenIndex = -1, this.syncQuality();
|
|
3079
3148
|
}
|
|
3080
3149
|
onDimensionsChange(e) {
|
|
3081
3150
|
e.stopPropagation();
|
|
3082
|
-
let t =
|
|
3083
|
-
this.clearResetSnapshot(), this.lastAction =
|
|
3084
|
-
key:
|
|
3151
|
+
let t = Z.getDimensionsSize(e.detail);
|
|
3152
|
+
this.clearResetSnapshot(), this.lastAction = D.Dimensions, this.selectedDimensions = { ...e.detail }, t ? this.upsertTransformation({
|
|
3153
|
+
key: D.Dimensions,
|
|
3085
3154
|
value: t
|
|
3086
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
3155
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== D.Dimensions), this.capCropToMaxSize();
|
|
3087
3156
|
}
|
|
3088
3157
|
onCropToggle(e) {
|
|
3089
|
-
e.stopPropagation(), this.clearResetSnapshot(), this.cropEnabled = e.currentTarget.checked, this.cropEnabled || (this.transformations = this.transformations.filter((e) => e.key !==
|
|
3158
|
+
e.stopPropagation(), this.clearResetSnapshot(), this.cropEnabled = e.currentTarget.checked, this.cropEnabled || (this.transformations = this.transformations.filter((e) => e.key !== D.Crop)), this.emit("cx-asset-link-format-crop-toggle", { detail: this.cropEnabled });
|
|
3090
3159
|
}
|
|
3091
3160
|
renderDimensionsPart() {
|
|
3092
|
-
return e`<cx-asset-link-format-dimensions class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ?
|
|
3161
|
+
return e`<cx-asset-link-format-dimensions class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ? j.Automatic : j.Manual} .inline=${this.isFormatsLayout} ?open=${this.activeSetting === "cx-asset-link-format-dimensions"} ?loading=${this.loading} .items=${this.dimensionsItems} .value=${this.selectedDimensions} ?can-custom=${this.canCustomDimensions} ?can-percent=${this.#i} @cx-asset-link-format-dimensions-change=${this.onDimensionsChange}></cx-asset-link-format-dimensions>`;
|
|
3093
3162
|
}
|
|
3094
3163
|
renderHeader() {
|
|
3095
3164
|
return m(!this.hideHeader && !this.isFormatsLayout, () => e`<cx-space class="asset-link-format__section-header" direction="horizontal" spacing="small" align-items="center" justify-content="space-between"><cx-typography variant="body3">${this.localize.term("transformations")}</cx-typography><cx-space direction="horizontal" spacing="3x-small" align-items="center"><cx-button class="asset-link-format__undo" variant="custom" ?disabled=${!this.hasUnfrozenTransformations && this.preResetTransformations === void 0 && (!this.canReorder || this.orderUndo.length === 0)} @click=${this.handleUndo}>${this.localize.term("undo")}</cx-button>${m(this.canReset, () => e`<cx-button class="asset-link-format__reset" variant="custom" ?disabled=${!this.hasResettableState} @click=${this.handleReset}>${this.localize.term("reset")}</cx-button>`)}</cx-space></cx-space>`, () => n);
|
|
@@ -3098,42 +3167,42 @@ var Gt = Z, Q, Kt = {
|
|
|
3098
3167
|
return m(this.canReorder, () => e`<div class="asset-link-format__order-hint" data-testid="cx-asset-link-format-order-hint">${this.localize.term("transformationOrderHint")}</div>`);
|
|
3099
3168
|
}
|
|
3100
3169
|
renderProxyPart() {
|
|
3101
|
-
return e`<cx-asset-link-format-proxy class="asset-link-format__details" value=${this.selectedProxy || this.proxies?.[0]?.id || ""} ?open=${this.activeSetting === "cx-asset-link-format-proxy"} ?auto-format=${this.autoFormat} ?can-auto-format=${this.canAutoFormat} .items=${this.formats} ?loading=${this.loading && this.lastAction ===
|
|
3170
|
+
return e`<cx-asset-link-format-proxy class="asset-link-format__details" value=${this.selectedProxy || this.proxies?.[0]?.id || ""} ?open=${this.activeSetting === "cx-asset-link-format-proxy"} ?auto-format=${this.autoFormat} ?can-auto-format=${this.canAutoFormat} .items=${this.formats} ?loading=${this.loading && this.lastAction === D.Proxy} @cx-asset-link-format-proxy-change=${this.onProxyChange}></cx-asset-link-format-proxy>`;
|
|
3102
3171
|
}
|
|
3103
3172
|
renderCropEditor(t) {
|
|
3104
|
-
let n = this.asset ? this.lastResizeSize[
|
|
3105
|
-
return e`<cx-asset-link-format-crop class="asset-link-format__details" .inline=${t} ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction ===
|
|
3173
|
+
let n = this.asset ? this.lastResizeSize[M.Pixel] : this.cropMaxSize;
|
|
3174
|
+
return e`<cx-asset-link-format-crop class="asset-link-format__details" .inline=${t} ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction === D.Crop} ?show-position-picker=${!this.asset} ?has-cropper=${!!this.cropperElement} ?dimensions-limited=${this.isCropAtDimensionsLimit} ?keep-aspect-ratio=${this.cropSize.keepAspectRatio} focus-mode=${this.cropSize.focusMode} crop-mode=${this.cropSize.cropMode} width=${this.cropSize.width} height=${this.cropSize.height} max-width=${n.width} max-height=${n.height} percentage-width=${this.cropSize.percentageWidth} percentage-height=${this.cropSize.percentageHeight} position=${this.cropSize.position} ratio-width=${this.cropSize.ratioWidth} ratio-height=${this.cropSize.ratioHeight} unit=${this.cropSize.unit} .lastAppliedSetting=${this.lastCropSize} .cropModes=${this.#a} .focusModes=${this.#o} @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>`;
|
|
3106
3175
|
}
|
|
3107
3176
|
renderCropPart() {
|
|
3108
3177
|
return this.isFormatsLayout ? e`<div class="asset-link-format__formats-crop"><cx-space class="asset-link-format__formats-summary" align-items="center" justify-content="space-between"><cx-space align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body3">${this.localize.term("crop")}</cx-typography></cx-space><cx-switch data-testid="cx-asset-link-format-crop-toggle" .checked=${this.cropEnabled} ?disabled=${this.loading} @cx-change=${this.onCropToggle}><cx-visually-hidden>${this.localize.term("crop")}</cx-visually-hidden></cx-switch></cx-space>${m(this.cropEnabled, () => this.renderCropEditor(!0))}</div>` : this.renderCropEditor(!1);
|
|
3109
3178
|
}
|
|
3110
3179
|
renderResizePart() {
|
|
3111
|
-
return e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction ===
|
|
3180
|
+
return e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction === D.Resize} ?no-ratio-modes=${!this.asset} ?keep-aspect-ratio=${this.resizeSize.keepAspectRatio} width=${this.resizeSize.width} height=${this.resizeSize.height} max-width=${this.asset ? this.imageSize.width : Infinity} max-height=${this.asset ? this.imageSize.height : Infinity} ratio-width=${this.resizeSize.ratioWidth} ratio-height=${this.resizeSize.ratioHeight} unit=${this.resizeSize.unit} .lastAppliedSetting=${this.lastResizeSize} @cx-asset-link-format-resize-change=${this.onResizeChange} @cx-asset-link-format-resize-apply=${this.onResizeApply}></cx-asset-link-format-resize>`;
|
|
3112
3181
|
}
|
|
3113
3182
|
renderRotatePart() {
|
|
3114
|
-
return e`<cx-asset-link-format-rotation class="asset-link-format__details" .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction ===
|
|
3183
|
+
return e`<cx-asset-link-format-rotation class="asset-link-format__details" .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction === D.Rotate} ?open=${this.activeSetting === "cx-asset-link-format-rotation"} default-value=${this.selectedFormat?.rotation ?? 0} last-applied-value=${this.lastRotation} value=${this.rotation} @cx-asset-link-format-rotation-change=${this.onRotationChange} @cx-asset-link-format-rotation-apply=${this.onRotationApply}></cx-asset-link-format-rotation>`;
|
|
3115
3184
|
}
|
|
3116
3185
|
renderQualityPart() {
|
|
3117
|
-
return e`<cx-asset-link-format-quality class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ?
|
|
3186
|
+
return e`<cx-asset-link-format-quality class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ? j.Automatic : j.Manual} .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction === D.Quality} ?open=${this.activeSetting === "cx-asset-link-format-quality"} value=${this.selectedFormat?.quality ?? 100} .items=${this.qualityItems} @cx-asset-link-format-quality-change=${this.onQualityChange}></cx-asset-link-format-quality>`;
|
|
3118
3187
|
}
|
|
3119
3188
|
renderMetadataPart() {
|
|
3120
3189
|
return e`<cx-asset-link-format-metadata class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-metadata"} .value=${this.selectedFormat?.keepMetadata ?? !1} @cx-asset-link-format-metadata-change=${this.onMetadataChange}></cx-asset-link-format-metadata>`;
|
|
3121
3190
|
}
|
|
3122
3191
|
renderPart(e) {
|
|
3123
3192
|
switch (e) {
|
|
3124
|
-
case
|
|
3125
|
-
case
|
|
3126
|
-
case
|
|
3127
|
-
case
|
|
3128
|
-
case
|
|
3129
|
-
case
|
|
3130
|
-
case
|
|
3193
|
+
case k.Dimensions: return this.renderDimensionsPart();
|
|
3194
|
+
case k.Proxy: return this.renderProxyPart();
|
|
3195
|
+
case k.Crop: return this.renderCropPart();
|
|
3196
|
+
case k.Resize: return this.renderResizePart();
|
|
3197
|
+
case k.Rotate: return this.renderRotatePart();
|
|
3198
|
+
case k.Quality: return this.renderQualityPart();
|
|
3199
|
+
case k.Metadata: return this.renderMetadataPart();
|
|
3131
3200
|
default: return n;
|
|
3132
3201
|
}
|
|
3133
3202
|
}
|
|
3134
3203
|
render() {
|
|
3135
3204
|
return e`<div class="asset-link-format ${this.isFormatsLayout ? "asset-link-format--formats" : ""}" @cx-show=${this.onDetailsShow} @cx-hide=${this.onDetailsHide}>${this.renderHeader()}
|
|
3136
|
-
${this.renderOrderHint()}<div class="asset-link-format__panels">${
|
|
3205
|
+
${this.renderOrderHint()}<div class="asset-link-format__panels">${x(this.activeParts, (e) => e, (t) => e`<div class="asset-link-format__panel" data-part=${t} ?data-reorderable=${this.canReorder && en.includes(t)}>${m(this.canReorder && en.includes(t), () => e`<cx-icon-button class="asset-link-format__drag-handle" name="drag_indicator" label=${this.localize.term("reorderTransformation", this.localize.term(t))} ?disabled=${this.loading} @keydown=${this.handleReorderKeyDown}></cx-icon-button>`)}
|
|
3137
3206
|
${this.renderPart(t)}</div>`)}</div><span class="asset-link-format__announcement" role="status" aria-live="polite">${this.reorderAnnouncement}</span>${m(this.useCustomExtension, () => e`<cx-asset-link-format-extension .items=${this.extensions} value=${this.selectedFormat?.extension ?? ""} @cx-asset-link-format-extension-change=${this.onExtensionChange}></cx-asset-link-format-extension>`)}<div class="asset-link-format__footer"><slot name="footer"></slot></div></div>`;
|
|
3138
3207
|
}
|
|
3139
3208
|
};
|
|
@@ -3193,12 +3262,12 @@ a([c(".sortable-fallback"), o("design:type", Object)], $.prototype, "dragCopy",
|
|
|
3193
3262
|
type: Boolean
|
|
3194
3263
|
}), o("design:type", Boolean)], $.prototype, "useCustomExtension", void 0), a([r({
|
|
3195
3264
|
attribute: "parts",
|
|
3196
|
-
converter:
|
|
3265
|
+
converter: Me,
|
|
3197
3266
|
type: Array
|
|
3198
3267
|
}), o("design:type", Array)], $.prototype, "parts", void 0), a([r({
|
|
3199
3268
|
reflect: !0,
|
|
3200
3269
|
type: String
|
|
3201
|
-
}), o("design:type",
|
|
3270
|
+
}), o("design:type", xe === void 0 ? Object : xe)], $.prototype, "layout", void 0), a([r({
|
|
3202
3271
|
attribute: "crop-enabled",
|
|
3203
3272
|
reflect: !0,
|
|
3204
3273
|
type: Boolean
|
|
@@ -3212,6 +3281,12 @@ a([c(".sortable-fallback"), o("design:type", Object)], $.prototype, "dragCopy",
|
|
|
3212
3281
|
attribute: "can-custom-dimensions",
|
|
3213
3282
|
type: Boolean
|
|
3214
3283
|
}), o("design:type", Object)], $.prototype, "canCustomDimensions", void 0), a([r({
|
|
3284
|
+
attribute: "can-percent-dimensions",
|
|
3285
|
+
type: Boolean
|
|
3286
|
+
}), o("design:type", Object)], $.prototype, "canPercentDimensions", void 0), a([r({
|
|
3287
|
+
attribute: "percent-dimensions",
|
|
3288
|
+
type: String
|
|
3289
|
+
}), o("design:type", Object)], $.prototype, "percentDimensions", void 0), a([r({
|
|
3215
3290
|
attribute: "last-image-size",
|
|
3216
3291
|
reflect: !1,
|
|
3217
3292
|
type: Object
|
|
@@ -3251,7 +3326,7 @@ a([c(".sortable-fallback"), o("design:type", Object)], $.prototype, "dragCopy",
|
|
|
3251
3326
|
o("design:type", Function),
|
|
3252
3327
|
o("design:paramtypes", []),
|
|
3253
3328
|
o("design:returntype", void 0)
|
|
3254
|
-
], $.prototype, "handleReorderableChange", null), $ =
|
|
3255
|
-
var
|
|
3329
|
+
], $.prototype, "handleReorderableChange", null), $ = Z = a([u("cx-asset-link-format"), o("design:paramtypes", [])], $);
|
|
3330
|
+
var nn = $;
|
|
3256
3331
|
//#endregion
|
|
3257
|
-
export {
|
|
3332
|
+
export { ft as C, yt as S, Pe as T, Ze as _, tt as a, gt as b, F as c, nt as d, Je as f, Xe as g, I as h, Tt as i, Ke as l, rt as m, Ot as n, We as o, Ye as p, Et as r, P as s, nn as t, qe as u, Qe as v, Fe as w, xt as x, bt as y };
|