@orangelogic/design-system 4.53.0 → 4.55.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.C7jo45Pq.js → alert.2Esbser8.js} +2 -2
- package/library/chunks/{array-line-clamp.DKxxZlon.js → array-line-clamp.sxTWf9Iz.js} +2 -2
- package/library/chunks/{asset-link-format.B_gS4nTL.js → asset-link-format.b1PRwN5q.js} +493 -454
- package/library/chunks/{audio.C8rPv9iZ.js → audio.B0VfXBIx.js} +2 -2
- package/library/chunks/{bicolor-picker.DrQWK6-q.js → bicolor-picker.BEs23Gs0.js} +1 -1
- package/library/chunks/{block-width.-jEx3KZ4.js → block-width.5rlxqu64.js} +46 -46
- package/library/chunks/{border-input-group.PiWnqlx7.js → border-input-group.dw1516Kf.js} +3 -3
- package/library/chunks/{breadcrumb.BLCAOe89.js → breadcrumb.DkINVxcJ.js} +1 -1
- package/library/chunks/{button.DnOMjl_G.js → button.BjijpxeK.js} +3 -3
- package/library/chunks/{checkbox.aFoOxk2j.js → checkbox.BdSpQlwf.js} +1 -1
- package/library/chunks/{color-picker.DkVQou0p.js → color-picker.D38VZ1JB.js} +11 -11
- package/library/chunks/{color-swatch-group.C85bEtP3.js → color-swatch-group.D4cJJmvA.js} +36 -36
- package/library/chunks/{color-swatch.Biz89VJr.js → color-swatch.PNkiDQx5.js} +3 -3
- package/library/chunks/{config-manager.Cc9QkEey.js → config-manager.CVYMQ0tt.js} +33 -33
- package/library/chunks/{configs-controller.DBzBhYjU.js → configs-controller.0FoXQnJn.js} +20 -20
- package/library/chunks/{confirm-popover.DpVrPWXU.js → confirm-popover.BHKVBESN.js} +4 -4
- package/library/chunks/{copy-button.CSUoVbip.js → copy-button.CQO3gEFh.js} +2 -2
- package/library/chunks/{corner-position-input-group.vhSOueRn.js → corner-position-input-group.BzYJD8zG.js} +4 -4
- package/library/chunks/{date-calendar.BpfgvrtE.js → date-calendar.B7e6WBzh.js} +1 -1
- package/library/chunks/{details.BGlfx87d.js → details.DSgp6VAD.js} +1 -1
- package/library/chunks/{dialog.DprCsbFG.js → dialog.QENKQ3wO.js} +3 -3
- package/library/chunks/{diff.DZjfy2VU.js → diff.Bmdpmpvo.js} +1 -1
- package/library/chunks/{document-viewer.BRJqmyum.js → document-viewer.CSSI__TI.js} +14 -14
- package/library/chunks/{dom.BsVeSE01.js → dom.BLHsooDR.js} +1 -1
- package/library/chunks/{dot-pagination.CfK67Z-x.js → dot-pagination.8huF7K9E.js} +2 -2
- package/library/chunks/{drawer.Ba0CKg86.js → drawer.CLSdjLR9.js} +2 -2
- package/library/chunks/{dropdown.CKad9CvP.js → dropdown.BTQ07f9L.js} +5 -5
- package/library/chunks/{dynamic-select.DmTXLyzH.js → dynamic-select.BEKv0lpx.js} +5 -5
- package/library/chunks/{e-chart.BkqfNGfV.js → e-chart.DKFAToIc.js} +2 -2
- package/library/chunks/{element-clamp.CwFlUOET.js → element-clamp.DSKvP36j.js} +2 -2
- package/library/chunks/{file-on-demand.Cuj5wcYW.js → file-on-demand.DNVrOUTH.js} +17 -17
- package/library/chunks/{folder-select.DpQEZDg1.js → folder-select.B16qEGcG.js} +16 -16
- package/library/chunks/{form.JYXtmwQ2.js → form.D_eBa3AQ.js} +1 -1
- package/library/chunks/{format-time.ysWqJKLC.js → format-time.QkJcKYrT.js} +1 -1
- package/library/chunks/{header.CD4B3ylz.js → header.B11-tX9H.js} +2 -2
- package/library/chunks/{i18n.CQPiI18Q.js → i18n.Bjg2ubA4.js} +2 -1
- package/library/chunks/{icon-button.BAUsYiQh.js → icon-button.qJd_az6T.js} +2 -2
- package/library/chunks/{iframe.CKoHB0lA.js → iframe.sl2wnUcC.js} +1 -1
- package/library/chunks/{image-comparer.WUKRGHqI.js → image-comparer.BCD6kzLm.js} +1 -1
- package/library/chunks/{image.C6-Opjew.js → image.alhsAc_i.js} +2 -2
- package/library/chunks/{input.D1UkXp3F.js → input.kTjqEyC8.js} +2 -2
- package/library/chunks/{line-clamp.COXyDBRB.js → line-clamp.BYoTFCvo.js} +2 -2
- package/library/chunks/{markdown.CgWP0X61.js → markdown.BzDRvv-f.js} +3 -3
- package/library/chunks/{masonry.4Lcy37gf.js → masonry.B8EOiLu0.js} +3 -3
- package/library/chunks/{menu-item.CCbtHE5R.js → menu-item.Z7pkEEyC.js} +3 -3
- package/library/chunks/{menu.DNeN3pz0.js → menu.Dlt4EsSJ.js} +2 -2
- package/library/chunks/option.DWE0tark.js +136 -0
- package/library/chunks/{padding-input-group.CGDq3Cct.js → padding-input-group.B-hbA7P2.js} +1 -1
- package/library/chunks/{pagination.Mr-XiQBd.js → pagination.ATa3enAG.js} +7 -7
- package/library/chunks/{popup.yll4fQau.js → popup.LaRE0W3Q.js} +1 -1
- package/library/chunks/{position-picker.DzRyAx7a.js → position-picker.X2hhfGx7.js} +2 -2
- package/library/chunks/{progress-bar.BfHPsueW.js → progress-bar.CynVLLnY.js} +1 -1
- package/library/chunks/{progress-ring.Cn08Dbar.js → progress-ring.Bfdj3-uB.js} +1 -1
- package/library/chunks/{radio-card.jROctGtI.js → radio-card.BVkRnAT5.js} +1 -1
- package/library/chunks/{radio-group.DSnDDjKe.js → radio-group.CHlxPcrs.js} +1 -1
- package/library/chunks/{range.CQzHuhd9.js → range.BWrWIE6S.js} +3 -3
- package/library/chunks/{rating.BjGQtyCk.js → rating.CNeNn996.js} +1 -1
- package/library/chunks/{relative-time.BcpFkSZT.js → relative-time.BfE3UOhF.js} +1 -1
- package/library/chunks/{select.CEgt2ciT.js → select.DJSXKV7u.js} +154 -102
- package/library/chunks/{shadow-input-group.C13mC7rW.js → shadow-input-group.B_06ZQpb.js} +2 -2
- package/library/chunks/{share-option-list.CdQeYk-I.js → share-option-list.BetSdhgh.js} +3 -3
- package/library/chunks/sidebar.CiZOJ49X.js +120 -0
- package/library/chunks/{size-input-group.DtldCuqS.js → size-input-group.VZ4Yt8qW.js} +5 -5
- package/library/chunks/{spinner.DsWszid8.js → spinner.Bv06U7NJ.js} +1 -1
- package/library/chunks/{split-panel.KzmC5IAW.js → split-panel.Cag0lAvv.js} +1 -1
- package/library/chunks/src.CQ2H22mE.js +103 -0
- package/library/chunks/{src.BJpSLSUr.js → src.CgqvT9Zj.js} +4 -4
- package/library/chunks/{step.BlnWLzqI.js → step.CA3PQN8l.js} +3 -3
- package/library/chunks/{stepper-wizard.t7enm9Uz.js → stepper-wizard.B72l6S-I.js} +2 -2
- package/library/chunks/{stepper.DzhUPTLW.js → stepper.DgoOS-k1.js} +1 -1
- package/library/chunks/{string.DAuTpyw8.js → string.9yahdkB8.js} +39 -1
- package/library/chunks/{switch.CBho2RVW.js → switch.BM9msK5T.js} +1 -1
- package/library/chunks/{tab-group.BSdtDqou.js → tab-group.DhX_Aowk.js} +8 -8
- package/library/chunks/{tab.C0oUx7MY.js → tab.vGimW19a.js} +3 -3
- package/library/chunks/{tag.B2S21_nF.js → tag.Dr7Na8Kf.js} +3 -3
- package/library/chunks/{textarea.BgWdR_7D.js → textarea.CHSZI8vt.js} +1 -1
- package/library/chunks/{timecode.DME2imtx.js → timecode.DjI1OTXD.js} +1 -1
- package/library/chunks/{tooltip.DJl5qcTx.js → tooltip.BpXJhnhh.js} +2 -2
- package/library/chunks/{tree.CnEAk97A.js → tree.BEdI81wd.js} +12 -6
- package/library/chunks/{typeface.Dr9m4SZE.js → typeface.CDjUSIt9.js} +3 -3
- package/library/chunks/{video.bGH-n4pZ.js → video.Dbzi5Pxz.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 +55 -55
- 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/checkbox.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/diff.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 +16 -16
- 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/radio-group.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/switch.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/textarea.js +1 -1
- package/library/components/timecode.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 +12634 -12634
- package/library/components/video.js +1 -1
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/option/option.d.ts +15 -2
- package/library/packages/atoms/src/components/select/select.d.ts +23 -2
- package/library/packages/molecules/src/sidebar/sidebar.d.ts +16 -2
- package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +5 -0
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-crop/asset-link-format-crop.d.ts +13 -0
- package/library/packages/types/src/sidebar.d.ts +2 -0
- package/library/packages/utils/src/custom-element/i18n.d.ts +1 -0
- package/library/packages/utils/src/string/string.d.ts +20 -0
- package/library/react-web-component.d.ts +22 -2
- package/library/utils.js +27 -27
- package/package.json +1 -1
- package/library/chunks/option.Da60zYvc.js +0 -100
- package/library/chunks/sidebar.CwAW3KaC.js +0 -100
- package/library/chunks/src.CYwPx1Vw.js +0 -103
|
@@ -3,38 +3,38 @@ 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.Bjg2ubA4.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.qJd_az6T.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
|
-
import { t as _ } from "./button.
|
|
13
|
-
import {
|
|
14
|
-
import { t as te } from "./tooltip.
|
|
12
|
+
import { t as _ } from "./button.BjijpxeK.js";
|
|
13
|
+
import { g as ee } from "./string.9yahdkB8.js";
|
|
14
|
+
import { t as te } from "./tooltip.BpXJhnhh.js";
|
|
15
15
|
import { n as v } from "./position-picker.dY_vgF_H.js";
|
|
16
16
|
import { l as ne, r as y } from "./number.CNp5LKkv.js";
|
|
17
17
|
import { t as re } from "./image.C0s1gL4z.js";
|
|
18
|
-
import {
|
|
18
|
+
import { n as b, t as x } from "./typography.B0mkhqTB.js";
|
|
19
19
|
import { t as ie } from "./button-group.CPfXrqyq.js";
|
|
20
|
-
import { t as ae } from "./checkbox.
|
|
21
|
-
import { t as
|
|
22
|
-
import { t as oe } from "./input.
|
|
23
|
-
import { t as
|
|
24
|
-
import { t as
|
|
25
|
-
import { t as
|
|
20
|
+
import { t as ae } from "./checkbox.BdSpQlwf.js";
|
|
21
|
+
import { t as S } from "./repeat.CKv9FPlC.js";
|
|
22
|
+
import { t as oe } from "./input.kTjqEyC8.js";
|
|
23
|
+
import { t as C } from "./option.DWE0tark.js";
|
|
24
|
+
import { t as w } from "./space.Dd8jezXK.js";
|
|
25
|
+
import { t as T } from "./select.DJSXKV7u.js";
|
|
26
26
|
import { t as se } from "./visually-hidden.Bv3SInZp.js";
|
|
27
|
-
import { E as ce, T as le, b as ue, d as de, h as fe, p as pe, w as me, y as he } from "./src.
|
|
28
|
-
import { t as
|
|
27
|
+
import { E as ce, T as le, b as ue, d as de, h as fe, p as pe, w as me, y as he } from "./src.CgqvT9Zj.js";
|
|
28
|
+
import { t as E } from "./details.DSgp6VAD.js";
|
|
29
29
|
import { t as ge } from "./divider.CqSNZCU8.js";
|
|
30
|
-
import { a as
|
|
30
|
+
import { a as D, c as O, l as k, n as _e, o as A, r as j, s as M, t as N } from "./asset-link-format.COPyGdND.js";
|
|
31
31
|
import { t as ve } from "./menu-label.B-FOyfAX.js";
|
|
32
|
-
import { t as ye } from "./switch.
|
|
32
|
+
import { t as ye } from "./switch.BM9msK5T.js";
|
|
33
33
|
import { t as be } from "./v4.JyXW8GUB.js";
|
|
34
34
|
import "./cropper.BRsN8h2t.js";
|
|
35
35
|
import { t as xe } from "./_baseUniq.h_pGICPH.js";
|
|
36
|
-
import { d as Se, i as Ce, n as we, o as Te, p as
|
|
37
|
-
import { t as ke } from "./position-picker.
|
|
36
|
+
import { d as Se, i as Ce, n as we, o as Te, p as P, r as Ee, s as De, t as Oe } from "./string-array.Dstcqyjm.js";
|
|
37
|
+
import { t as ke } from "./position-picker.X2hhfGx7.js";
|
|
38
38
|
//#region ../../node_modules/lodash-es/uniq.js
|
|
39
39
|
function Ae(e) {
|
|
40
40
|
return e && e.length ? xe(e) : [];
|
|
@@ -126,7 +126,7 @@ function Re(e) {
|
|
|
126
126
|
}
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region ../../packages/services/src/api/asset/asset.ts
|
|
129
|
-
var ze = "CoreField.LargeSizePreview",
|
|
129
|
+
var ze = "CoreField.LargeSizePreview", F = "CoreField.DocType", Be = "Document.Title", Ve = "Document.CaptionLong", I = "Document.FileExtension", He = "CoreField.FileSize", Ue = "CoreField.Identifier", We = "CoreField.MaxHeight", Ge = "CoreField.MaxWidth", L = "Document.RecordID", Ke = "CoreField.DocSubType", qe = "CoreField.TitleWithFallback", R = "CoreField.OriginalFileName", Je = "__width", Ye = "__height", Xe = "CoreField.OriginalPreview", Ze = "Document.DocSubType", Qe = "Document.InPoint", $e = "Document.OutPoint", et = {
|
|
130
130
|
DEFAULT_VIEW_SIZE: "Document.LargeSizePreview",
|
|
131
131
|
ORIGINAL_VIEW_SIZE: "Document.OriginalPreview"
|
|
132
132
|
}, tt = {
|
|
@@ -137,7 +137,7 @@ function rt(e) {
|
|
|
137
137
|
return tt[e] ?? e;
|
|
138
138
|
}
|
|
139
139
|
function it(e) {
|
|
140
|
-
return e === "CoreField.TitleWithFallback" ? [Be,
|
|
140
|
+
return e === "CoreField.TitleWithFallback" ? [Be, R] : [rt(e)];
|
|
141
141
|
}
|
|
142
142
|
function at(e) {
|
|
143
143
|
let t = {};
|
|
@@ -148,7 +148,7 @@ function at(e) {
|
|
|
148
148
|
return t;
|
|
149
149
|
}
|
|
150
150
|
function ot(e, t, n) {
|
|
151
|
-
e[n] =
|
|
151
|
+
e[n] = z(t, n);
|
|
152
152
|
let r = t[n];
|
|
153
153
|
return r != null && je(r) && (typeof r.Width == "number" && r.Width > 0 && (e[`${n}${Je}`] = String(r.Width)), typeof r.Height == "number" && r.Height > 0 && (e[`${n}${Ye}`] = String(r.Height))), e;
|
|
154
154
|
}
|
|
@@ -160,7 +160,7 @@ function st(e) {
|
|
|
160
160
|
async function ct({ consistency: e, countPerPage: t, fields: n, getPermanentAssetsPaths: r, httpMethod: i = "GET", isSiteBuilder: a, pageNumber: o, query: s, securityByPassToken: c, siteUrl: l, sort: u, throwOnError: d, token: f, useSession: p }) {
|
|
161
161
|
let m = n?.flatMap(it), h = n?.includes("CoreField.TitleWithFallback") ?? !1, g = (e) => {
|
|
162
162
|
let t = at(e);
|
|
163
|
-
return h && (t[qe] =
|
|
163
|
+
return h && (t[qe] = z(t, "Document.Title") || z(t, "CoreField.OriginalFileName")), t;
|
|
164
164
|
}, _ = {
|
|
165
165
|
Consistency: e || void 0,
|
|
166
166
|
CountPerPage: t,
|
|
@@ -174,7 +174,7 @@ async function ct({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
174
174
|
UseSession: p || void 0
|
|
175
175
|
}, ee = i === "POST";
|
|
176
176
|
try {
|
|
177
|
-
return (await
|
|
177
|
+
return (await P.request({
|
|
178
178
|
baseURL: l,
|
|
179
179
|
headers: f ? { Authorization: `Bearer ${f}` } : void 0,
|
|
180
180
|
method: i,
|
|
@@ -183,7 +183,7 @@ async function ct({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
183
183
|
paramsSerializer: { indexes: null }
|
|
184
184
|
},
|
|
185
185
|
responseType: "json",
|
|
186
|
-
transformResponse: [...Array.isArray(
|
|
186
|
+
transformResponse: [...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [], a ? (e) => ({
|
|
187
187
|
items: (e.results?.Items ?? []).map(g),
|
|
188
188
|
sort: e.results?.GlobalInfo?.Sort ?? "",
|
|
189
189
|
totalCount: e.results?.GlobalInfo?.TotalCount ?? 0
|
|
@@ -205,7 +205,7 @@ async function ct({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
|
|
|
205
205
|
}
|
|
206
206
|
async function lt({ assetId: e, extension: t, format: n, siteUrl: r, token: i, transformations: a, useSession: o }) {
|
|
207
207
|
try {
|
|
208
|
-
return (await
|
|
208
|
+
return (await P.request({
|
|
209
209
|
baseURL: r,
|
|
210
210
|
method: "GET",
|
|
211
211
|
params: {
|
|
@@ -237,10 +237,10 @@ async function ft({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
|
|
|
237
237
|
};
|
|
238
238
|
let c = t?.filter((e) => e && typeof e == "string") ?? [], l = [
|
|
239
239
|
...c,
|
|
240
|
-
|
|
240
|
+
R,
|
|
241
241
|
Be,
|
|
242
242
|
Ve,
|
|
243
|
-
|
|
243
|
+
L
|
|
244
244
|
], u = dt(i, ut), d = await Promise.all(u.map((t) => ct({
|
|
245
245
|
consistency: e,
|
|
246
246
|
countPerPage: t.length,
|
|
@@ -257,14 +257,14 @@ async function ft({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
|
|
|
257
257
|
return {
|
|
258
258
|
facets: [],
|
|
259
259
|
items: d.flatMap((e) => e.items).map((e) => ({
|
|
260
|
-
name:
|
|
261
|
-
recordId:
|
|
260
|
+
name: z(e, R),
|
|
261
|
+
recordId: z(e, L),
|
|
262
262
|
...c.reduce((t, n) => ot(t, e, n), {})
|
|
263
263
|
})).sort((e, t) => (f.get(e.recordId) ?? Infinity) - (f.get(t.recordId) ?? Infinity)),
|
|
264
264
|
totalCount: d.reduce((e, t) => e + t.totalCount, 0)
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function z(e, t) {
|
|
268
268
|
let n = e[t];
|
|
269
269
|
return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) : je(n) ? n.URI : "";
|
|
270
270
|
}
|
|
@@ -286,12 +286,12 @@ async function pt({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
286
286
|
...m,
|
|
287
287
|
qe,
|
|
288
288
|
He,
|
|
289
|
-
|
|
289
|
+
F,
|
|
290
290
|
Ke,
|
|
291
291
|
Ue,
|
|
292
|
-
F,
|
|
293
292
|
I,
|
|
294
|
-
L
|
|
293
|
+
L,
|
|
294
|
+
R
|
|
295
295
|
],
|
|
296
296
|
getPermanentAssetsPaths: i,
|
|
297
297
|
isSiteBuilder: a,
|
|
@@ -305,18 +305,18 @@ async function pt({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
305
305
|
return {
|
|
306
306
|
facets: [],
|
|
307
307
|
items: g.items.map((e) => {
|
|
308
|
-
let t =
|
|
308
|
+
let t = z(e, I);
|
|
309
309
|
t && !t.startsWith(".") && (t = "." + t);
|
|
310
|
-
let n =
|
|
310
|
+
let n = z(e, L);
|
|
311
311
|
return {
|
|
312
|
-
docSubType:
|
|
313
|
-
docType:
|
|
312
|
+
docSubType: z(e, Ke),
|
|
313
|
+
docType: z(e, "CoreField.DocType") || "",
|
|
314
314
|
extension: t,
|
|
315
315
|
id: n,
|
|
316
|
-
identifier:
|
|
317
|
-
name:
|
|
316
|
+
identifier: z(e, Ue),
|
|
317
|
+
name: z(e, R),
|
|
318
318
|
recordId: n,
|
|
319
|
-
size:
|
|
319
|
+
size: z(e, "CoreField.FileSize") || "0 MB",
|
|
320
320
|
...m.reduce((t, n) => ot(t, e, n), {})
|
|
321
321
|
};
|
|
322
322
|
}),
|
|
@@ -325,7 +325,7 @@ async function pt({ consistency: e, countPerPage: t, directParentFolderIdentifie
|
|
|
325
325
|
}
|
|
326
326
|
async function mt({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, useSession: i }) {
|
|
327
327
|
try {
|
|
328
|
-
return (await
|
|
328
|
+
return (await P.request({
|
|
329
329
|
method: "GET",
|
|
330
330
|
params: {
|
|
331
331
|
AutoCropMode: e,
|
|
@@ -336,7 +336,7 @@ async function mt({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, u
|
|
|
336
336
|
},
|
|
337
337
|
responseType: "json",
|
|
338
338
|
timeout: 3e5,
|
|
339
|
-
transformResponse: [...Array.isArray(
|
|
339
|
+
transformResponse: [...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [], (e) => ({
|
|
340
340
|
height: e.cropHeight,
|
|
341
341
|
width: e.cropWidth,
|
|
342
342
|
x: e.cropX,
|
|
@@ -350,7 +350,7 @@ async function mt({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, u
|
|
|
350
350
|
}
|
|
351
351
|
async function ht({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, useSession: i }) {
|
|
352
352
|
try {
|
|
353
|
-
return (await
|
|
353
|
+
return (await P.request({
|
|
354
354
|
baseURL: n,
|
|
355
355
|
method: "GET",
|
|
356
356
|
params: {
|
|
@@ -359,7 +359,7 @@ async function ht({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
|
|
|
359
359
|
UseSession: i || void 0
|
|
360
360
|
},
|
|
361
361
|
responseType: "json",
|
|
362
|
-
transformResponse: [...Array.isArray(
|
|
362
|
+
transformResponse: [...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? [] : e.proxies?.map((e) => ({
|
|
363
363
|
cdnName: e.cdnName,
|
|
364
364
|
extension: e.extension,
|
|
365
365
|
formatHeight: e.formatHeight,
|
|
@@ -378,11 +378,11 @@ async function ht({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
|
|
|
378
378
|
}
|
|
379
379
|
async function gt({ siteUrl: e } = {}) {
|
|
380
380
|
try {
|
|
381
|
-
return (await
|
|
381
|
+
return (await P.request({
|
|
382
382
|
baseURL: e,
|
|
383
383
|
method: "GET",
|
|
384
384
|
responseType: "json",
|
|
385
|
-
transformResponse: [...Array.isArray(
|
|
385
|
+
transformResponse: [...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? { formatsByDocType: {
|
|
386
386
|
Audio: {},
|
|
387
387
|
Image: {},
|
|
388
388
|
Multimedia: {},
|
|
@@ -402,7 +402,7 @@ async function _t({ recordIds: e, rightsToCheck: t }) {
|
|
|
402
402
|
invalidObjects: []
|
|
403
403
|
};
|
|
404
404
|
try {
|
|
405
|
-
let { data: n } = await
|
|
405
|
+
let { data: n } = await P.request({
|
|
406
406
|
method: "GET",
|
|
407
407
|
params: {
|
|
408
408
|
RecordIDs: e,
|
|
@@ -419,7 +419,7 @@ async function _t({ recordIds: e, rightsToCheck: t }) {
|
|
|
419
419
|
}
|
|
420
420
|
//#endregion
|
|
421
421
|
//#region ../../packages/tools/src/fetch-image/fetch-image.ts
|
|
422
|
-
var vt = 20,
|
|
422
|
+
var vt = 20, B = "TR1", V = "TRX", yt = /* @__PURE__ */ new Set([".gif"]), bt = /* @__PURE__ */ new Set([
|
|
423
423
|
".avif",
|
|
424
424
|
".bmp",
|
|
425
425
|
".gif",
|
|
@@ -435,10 +435,10 @@ function xt(e) {
|
|
|
435
435
|
return bt.has(n);
|
|
436
436
|
}
|
|
437
437
|
function St(e, t) {
|
|
438
|
-
return e !== void 0 && e !== "" && e !==
|
|
438
|
+
return e !== void 0 && e !== "" && e !== M.Image ? !1 : !t || xt(t);
|
|
439
439
|
}
|
|
440
440
|
function Ct({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i, item: a, manualFormat: o, size: s, useExpiringAssetUrls: c }) {
|
|
441
|
-
let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${
|
|
441
|
+
let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${B}`, f = (n, r) => {
|
|
442
442
|
let i = a[n];
|
|
443
443
|
if (!i) return;
|
|
444
444
|
let s = a[`${n}${Je}`], u = a[`${n}${Ye}`], d = e && !c ? de(i, [], {
|
|
@@ -463,10 +463,10 @@ function Ct({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i
|
|
|
463
463
|
}
|
|
464
464
|
if (!o) {
|
|
465
465
|
let e = he(l, s);
|
|
466
|
-
return f(`path_${e}`, e) ?? f(d,
|
|
466
|
+
return f(`path_${e}`, e) ?? f(d, B) ?? {};
|
|
467
467
|
}
|
|
468
468
|
let p = i ? `path_${i}` : void 0;
|
|
469
|
-
return p && a[p] ? i !==
|
|
469
|
+
return p && a[p] ? i !== V || St(n, l) ? f(p, i) ?? {} : f(d, B) ?? {} : l && yt.has(u) ? f(`path_${V}`, V) ?? f(d, B) ?? {} : f(d, B) ?? {};
|
|
470
470
|
}
|
|
471
471
|
var wt = class {
|
|
472
472
|
constructor(e, t) {
|
|
@@ -492,7 +492,7 @@ var wt = class {
|
|
|
492
492
|
if (e < i || this.totalCount > 0 && e >= this.totalCount && (e = this.totalCount - 1, e < i)) return this.data;
|
|
493
493
|
let s = this.requestEpoch, c = me(this.host.ownerDocument.defaultView);
|
|
494
494
|
if (!this.folderId || s !== this.requestEpoch) return this.data;
|
|
495
|
-
let l = n ? `path_${n}` : void 0, u = `path_${
|
|
495
|
+
let l = n ? `path_${n}` : void 0, u = `path_${B}`, d = `path_${V}`, f = c ? [u, d] : [...new Set([
|
|
496
496
|
l,
|
|
497
497
|
u,
|
|
498
498
|
d
|
|
@@ -507,10 +507,10 @@ var wt = class {
|
|
|
507
507
|
getPermanentAssetsPaths: ce(this.host.ownerDocument.defaultView),
|
|
508
508
|
isSiteBuilder: this.isSiteBuilder,
|
|
509
509
|
limitedDocTypes: [
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
510
|
+
M.Image,
|
|
511
|
+
M.Audio,
|
|
512
|
+
M.Video,
|
|
513
|
+
M.Multimedia
|
|
514
514
|
],
|
|
515
515
|
pageNumber: e,
|
|
516
516
|
searchTerm: "",
|
|
@@ -587,11 +587,11 @@ var wt = class {
|
|
|
587
587
|
}
|
|
588
588
|
async fetchImagesByIDs({ extraFields: e = [], format: t, manualFormat: n = !0, recordIds: r, throwOnError: i = !1, transformations: a }) {
|
|
589
589
|
if (r.length === 0) return [];
|
|
590
|
-
let o = me(this.host.ownerDocument.defaultView), s = t ? `path_${t}` : void 0, c = `path_${
|
|
590
|
+
let o = me(this.host.ownerDocument.defaultView), s = t ? `path_${t}` : void 0, c = `path_${B}`, l = `path_${V}`, u = o ? [c, l] : [...new Set([
|
|
591
591
|
s,
|
|
592
592
|
c,
|
|
593
593
|
l
|
|
594
|
-
].filter((e) => !!e))], d = [
|
|
594
|
+
].filter((e) => !!e))], d = [I, ...o ? [] : [He]], f = [...e, F];
|
|
595
595
|
return (await ft({
|
|
596
596
|
consistency: this.consistency,
|
|
597
597
|
extraFields: [
|
|
@@ -609,8 +609,8 @@ var wt = class {
|
|
|
609
609
|
let { maxHeight: r, maxWidth: i, src: s, srcset: c } = Ct({
|
|
610
610
|
autoFormat: this.autoFormat,
|
|
611
611
|
buildSrcset: this.buildSrcset,
|
|
612
|
-
docType: e[
|
|
613
|
-
extension: e[
|
|
612
|
+
docType: e[F],
|
|
613
|
+
extension: e[I],
|
|
614
614
|
format: t,
|
|
615
615
|
item: e,
|
|
616
616
|
manualFormat: n,
|
|
@@ -619,7 +619,7 @@ var wt = class {
|
|
|
619
619
|
}), l = s, u = c;
|
|
620
620
|
return !o && l && a && a.length > 0 && (l = de(l, a), u = ""), {
|
|
621
621
|
alt: e.name,
|
|
622
|
-
docType: e[
|
|
622
|
+
docType: e[F],
|
|
623
623
|
extension: e["Document.FileExtension"] || "",
|
|
624
624
|
id: e.recordId,
|
|
625
625
|
maxHeight: r,
|
|
@@ -686,24 +686,24 @@ var wt = class {
|
|
|
686
686
|
resetFolderState() {
|
|
687
687
|
this.resetPageCache();
|
|
688
688
|
}
|
|
689
|
-
}, Tt = t`.asset-link-format__panel{position:relative}.asset-link-format--formats .asset-link-format__panel:not(:last-child){border-bottom:1px solid var(--cx-color-neutral-200)}.asset-link-format__panel--placeholder,.asset-link-format--formats .asset-link-format__panel--placeholder:not(:last-child){height:var(--cx-spacing-3x-small);background-color:var(--cx-color-primary);border:none;overflow:hidden}.asset-link-format__panel--placeholder>*{visibility:hidden}.asset-link-format__drag-handle{cursor:grab;touch-action:none;width:max-content;margin-inline:auto;position:absolute;inset-block-start:calc(var(--cx-spacing-small) + var(--cx-font-size-3x-large) / 2);inset-inline:0;transform:translateY(-50%)}.asset-link-format__drag-handle::part(base){cursor:grab}.asset-link-format__drag-handle:active,.asset-link-format__drag-handle:active::part(base){cursor:grabbing}.asset-link-format__drag-handle::part(icon){color:var(--cx-color-neutral-300);rotate:90deg}.asset-link-format__announcement{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.asset-link-format__order-hint{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border-bottom:1px solid var(--cx-color-neutral-200);color:var(--cx-color
|
|
690
|
-
static #e =
|
|
689
|
+
}, Tt = t`.asset-link-format__panel{position:relative}.asset-link-format--formats .asset-link-format__panel:not(:last-child){border-bottom:1px solid var(--cx-color-neutral-200)}.asset-link-format__panel--placeholder,.asset-link-format--formats .asset-link-format__panel--placeholder:not(:last-child){height:var(--cx-spacing-3x-small);background-color:var(--cx-color-primary);border:none;overflow:hidden}.asset-link-format__panel--placeholder>*{visibility:hidden}.asset-link-format__drag-handle{cursor:grab;touch-action:none;width:max-content;margin-inline:auto;position:absolute;inset-block-start:calc(var(--cx-spacing-small) + var(--cx-font-size-3x-large) / 2);inset-inline:0;transform:translateY(-50%)}.asset-link-format__drag-handle::part(base){cursor:grab}.asset-link-format__drag-handle:active,.asset-link-format__drag-handle:active::part(base){cursor:grabbing}.asset-link-format__drag-handle::part(icon){color:var(--cx-color-neutral-300);rotate:90deg}.asset-link-format__announcement{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.asset-link-format__order-hint{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border-bottom:1px solid var(--cx-color-neutral-200);color:var(--cx-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}`, Et = t`:host([inline]){display:block}cx-details::part(base){border-bottom-width:0}.details--inline::part(base){border-width:0}.details--inline::part(header){display:none}.details--inline::part(content){padding:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}.crop__limit{color:var(--cx-input-help-text-color);margin-block-start:calc(-1 * var(--spacing-container-gap))}.crop__limit:empty{position:absolute}`, H, U = class extends s {
|
|
690
|
+
static #e = H = this;
|
|
691
691
|
constructor(...e) {
|
|
692
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit =
|
|
693
|
-
[
|
|
692
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit = k.Pixel, this.disabledApply = !1, this.noRatioModes = !1, this.showPositionPicker = !1, this.hasCropper = !1, this.dimensionsLimited = !1, this.lastAppliedSetting = {
|
|
693
|
+
[k.Pixel]: {
|
|
694
694
|
height: 0,
|
|
695
695
|
percentageHeight: 100,
|
|
696
696
|
percentageWidth: 100,
|
|
697
|
-
unit:
|
|
697
|
+
unit: k.Pixel,
|
|
698
698
|
width: 0,
|
|
699
699
|
x: 0,
|
|
700
700
|
y: 0
|
|
701
701
|
},
|
|
702
|
-
[
|
|
702
|
+
[k.AspectRatio]: {
|
|
703
703
|
height: 1,
|
|
704
704
|
percentageHeight: 100,
|
|
705
705
|
percentageWidth: 100,
|
|
706
|
-
unit:
|
|
706
|
+
unit: k.AspectRatio,
|
|
707
707
|
width: 1,
|
|
708
708
|
x: 0,
|
|
709
709
|
y: 0
|
|
@@ -713,19 +713,19 @@ var wt = class {
|
|
|
713
713
|
static #t = this.styles = [l, Et];
|
|
714
714
|
static #n = this.dependencies = {
|
|
715
715
|
"cx-button": _,
|
|
716
|
-
"cx-details":
|
|
716
|
+
"cx-details": E,
|
|
717
717
|
"cx-divider": ge,
|
|
718
718
|
"cx-icon": h,
|
|
719
719
|
"cx-icon-button": p,
|
|
720
720
|
"cx-input": oe,
|
|
721
|
-
"cx-option":
|
|
721
|
+
"cx-option": C,
|
|
722
722
|
"cx-position-picker": ke,
|
|
723
|
-
"cx-select":
|
|
724
|
-
"cx-space":
|
|
725
|
-
"cx-typography":
|
|
723
|
+
"cx-select": T,
|
|
724
|
+
"cx-space": w,
|
|
725
|
+
"cx-typography": x
|
|
726
726
|
};
|
|
727
727
|
static getRatioSize(e, t, n, r, i) {
|
|
728
|
-
return n ===
|
|
728
|
+
return n === k.Pixel && Number.isFinite(r) && Number.isFinite(i) ? re(r, i, e, t) : {
|
|
729
729
|
height: t,
|
|
730
730
|
width: e
|
|
731
731
|
};
|
|
@@ -743,11 +743,11 @@ var wt = class {
|
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
745
|
if (this.keepAspectRatio) {
|
|
746
|
-
if (this.unit ===
|
|
746
|
+
if (this.unit === k.Pixel && this.width && this.height) {
|
|
747
747
|
this.aspectRatio = this.width / this.height;
|
|
748
748
|
return;
|
|
749
749
|
}
|
|
750
|
-
if (this.unit ===
|
|
750
|
+
if (this.unit === k.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
751
751
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
752
752
|
return;
|
|
753
753
|
}
|
|
@@ -775,9 +775,9 @@ var wt = class {
|
|
|
775
775
|
this.invalidWidth = !0;
|
|
776
776
|
return;
|
|
777
777
|
}
|
|
778
|
-
this.invalidWidth = !1, this.unit ===
|
|
779
|
-
let n = this.unit ===
|
|
780
|
-
this.keepAspectRatio && (n = Math.max(Math.round(t / this.aspectRatio), 1)), this.unit ===
|
|
778
|
+
this.invalidWidth = !1, this.unit === k.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1));
|
|
779
|
+
let n = this.unit === k.Pixel ? this.height : this.ratioHeight, r = !1;
|
|
780
|
+
this.keepAspectRatio && (n = Math.max(Math.round(t / this.aspectRatio), 1)), this.unit === k.Pixel && this.maxHeight >= 1 && n > this.maxHeight && (n = this.maxHeight, r = this.keepAspectRatio), e.target.value = t.toString(), this.invalidHeight = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
781
781
|
breakAspectRatio: r,
|
|
782
782
|
height: n,
|
|
783
783
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -791,9 +791,9 @@ var wt = class {
|
|
|
791
791
|
this.invalidHeight = !0;
|
|
792
792
|
return;
|
|
793
793
|
}
|
|
794
|
-
this.invalidHeight = !1, this.unit ===
|
|
795
|
-
let n = this.unit ===
|
|
796
|
-
this.keepAspectRatio && (n = Math.max(Math.round(t * this.aspectRatio), 1)), this.unit ===
|
|
794
|
+
this.invalidHeight = !1, this.unit === k.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1));
|
|
795
|
+
let n = this.unit === k.Pixel ? this.width : this.ratioWidth, r = !1;
|
|
796
|
+
this.keepAspectRatio && (n = Math.max(Math.round(t * this.aspectRatio), 1)), this.unit === k.Pixel && this.maxWidth >= 1 && n > this.maxWidth && (n = this.maxWidth, r = this.keepAspectRatio), e.target.value = t.toString(), this.invalidWidth = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
797
797
|
breakAspectRatio: r,
|
|
798
798
|
height: t,
|
|
799
799
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -804,17 +804,17 @@ var wt = class {
|
|
|
804
804
|
onCropModeChange(e) {
|
|
805
805
|
let t = e.target.value, n = this.cropModes.find((e) => e.value === t)?.auto;
|
|
806
806
|
if (t === "free") this.selectedMode?.auto && this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
807
|
-
height: this.lastAppliedSetting[
|
|
807
|
+
height: this.lastAppliedSetting[k.Pixel].height,
|
|
808
808
|
keepAspectRatio: !1,
|
|
809
809
|
silent: !0,
|
|
810
|
-
unit:
|
|
811
|
-
width: this.lastAppliedSetting[
|
|
810
|
+
unit: k.Pixel,
|
|
811
|
+
width: this.lastAppliedSetting[k.Pixel].width
|
|
812
812
|
} });
|
|
813
813
|
else if (!n) {
|
|
814
|
-
let [e, n] = t.split(":").map(Number), r = this.unit ===
|
|
814
|
+
let [e, n] = t.split(":").map(Number), r = this.unit === k.Pixel && this.hasMaxSize ? k.Pixel : k.AspectRatio;
|
|
815
815
|
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
816
|
-
...
|
|
817
|
-
keepAspectRatio: r ===
|
|
816
|
+
...H.getRatioSize(e, n, r, this.maxWidth, this.maxHeight),
|
|
817
|
+
keepAspectRatio: r === k.Pixel || !this.inline,
|
|
818
818
|
silent: !0,
|
|
819
819
|
unit: r
|
|
820
820
|
} });
|
|
@@ -829,7 +829,15 @@ var wt = class {
|
|
|
829
829
|
this.emit("cx-asset-link-format-crop-position-change", { detail: { position: this.positionPicker.value } });
|
|
830
830
|
}
|
|
831
831
|
onUnitChange(e) {
|
|
832
|
-
let t = e.target.value ===
|
|
832
|
+
let t = e.target.value === k.AspectRatio ? k.AspectRatio : k.Pixel;
|
|
833
|
+
if (this.hasCropper) {
|
|
834
|
+
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
835
|
+
...this.#i(t),
|
|
836
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
837
|
+
unit: t
|
|
838
|
+
} });
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
833
841
|
if (this.inline && !this.selectedMode?.auto) {
|
|
834
842
|
this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
835
843
|
...this.#r(t),
|
|
@@ -845,22 +853,36 @@ var wt = class {
|
|
|
845
853
|
} }), this.emit("cx-asset-link-format-crop-mode-change", { detail: { mode: "free" } });
|
|
846
854
|
}
|
|
847
855
|
#r(e) {
|
|
848
|
-
let t = e ===
|
|
856
|
+
let t = e === k.Pixel;
|
|
849
857
|
if (/^\d+:\d+$/.test(this.cropMode)) {
|
|
850
858
|
let [n, r] = this.cropMode.split(":").map(Number);
|
|
851
859
|
return {
|
|
852
|
-
...
|
|
860
|
+
...H.getRatioSize(n, r, e, this.maxWidth, this.maxHeight),
|
|
853
861
|
keepAspectRatio: t
|
|
854
862
|
};
|
|
855
863
|
}
|
|
856
|
-
return e ===
|
|
864
|
+
return e === k.AspectRatio ? {
|
|
857
865
|
...y(this.width, this.height),
|
|
858
866
|
keepAspectRatio: t
|
|
859
867
|
} : {
|
|
860
|
-
...
|
|
868
|
+
...H.getRatioSize(this.ratioWidth, this.ratioHeight, e, this.maxWidth, this.maxHeight),
|
|
861
869
|
keepAspectRatio: t
|
|
862
870
|
};
|
|
863
871
|
}
|
|
872
|
+
#i(e) {
|
|
873
|
+
if (e === k.Pixel) return {
|
|
874
|
+
height: this.height,
|
|
875
|
+
width: this.width
|
|
876
|
+
};
|
|
877
|
+
if (/^\d+:\d+$/.test(this.cropMode)) {
|
|
878
|
+
let [e, t] = this.cropMode.split(":").map(Number);
|
|
879
|
+
return {
|
|
880
|
+
height: t,
|
|
881
|
+
width: e
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
return y(this.width, this.height);
|
|
885
|
+
}
|
|
864
886
|
handleInputChange(e) {
|
|
865
887
|
e.stopPropagation(), this.emit("cx-asset-link-format-crop-changed");
|
|
866
888
|
}
|
|
@@ -880,14 +902,14 @@ var wt = class {
|
|
|
880
902
|
}
|
|
881
903
|
handleAspectRatioClick() {
|
|
882
904
|
this.keepAspectRatio && this.cropMode !== "free" && this.emit("cx-asset-link-format-crop-mode-change", { detail: { mode: "free" } }), this.emit("cx-asset-link-format-crop-change", { detail: {
|
|
883
|
-
height: this.unit ===
|
|
905
|
+
height: this.unit === k.Pixel ? this.height : this.ratioHeight,
|
|
884
906
|
keepAspectRatio: !this.keepAspectRatio,
|
|
885
907
|
unit: this.unit,
|
|
886
|
-
width: this.unit ===
|
|
908
|
+
width: this.unit === k.Pixel ? this.width : this.ratioWidth
|
|
887
909
|
} });
|
|
888
910
|
}
|
|
889
911
|
getSizeMaskBlocks(e) {
|
|
890
|
-
let t = this.unit ===
|
|
912
|
+
let t = this.unit === k.Pixel && e >= 1 ? e : Infinity;
|
|
891
913
|
return { num: {
|
|
892
914
|
autofix: !0,
|
|
893
915
|
mask: Number,
|
|
@@ -899,99 +921,107 @@ var wt = class {
|
|
|
899
921
|
}
|
|
900
922
|
render() {
|
|
901
923
|
let t = this.cropModes.filter((e) => !e.auto), n = this.cropModes.filter((e) => e.auto);
|
|
902
|
-
return e`<cx-details class="details ${this.inline ? "details--inline" : ""}" ?open=${this.inline || this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small">${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${
|
|
924
|
+
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}>${S(t, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}
|
|
903
925
|
${m(n.length > 0, () => e`<cx-divider></cx-divider><small>${this.localize.term("autoCropping")}</small>`)}
|
|
904
|
-
${
|
|
926
|
+
${S(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 === k.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">
|
|
905
927
|
W
|
|
906
|
-
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-crop-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading || this.inline && this.unit ===
|
|
928
|
+
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-crop-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading || this.inline && this.unit === k.AspectRatio}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${this.getSizeMaskBlocks(this.maxHeight)} value=${this.unit === k.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">
|
|
907
929
|
H
|
|
908
|
-
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-unit" value=${this.unit} hoist class="crop__unit-select" ?disabled=${this.loading} @cx-change=${this.onUnitChange}><cx-option value=${
|
|
930
|
+
</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=${k.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${k.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}>${S(this.focusModes, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}
|
|
909
931
|
${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>`)}
|
|
910
932
|
${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>`;
|
|
911
933
|
}
|
|
912
934
|
};
|
|
913
|
-
a([c(".details"), o("design:type",
|
|
935
|
+
a([c(".details"), o("design:type", E === void 0 ? Object : E)], U.prototype, "base", void 0), a([c("cx-position-picker"), o("design:type", ke === void 0 ? Object : ke)], U.prototype, "positionPicker", void 0), a([r({
|
|
914
936
|
reflect: !0,
|
|
915
937
|
type: Boolean
|
|
916
|
-
}), o("design:type", Boolean)],
|
|
938
|
+
}), o("design:type", Boolean)], U.prototype, "open", void 0), a([r({
|
|
917
939
|
reflect: !0,
|
|
918
940
|
type: Boolean
|
|
919
|
-
}), o("design:type", Boolean)],
|
|
941
|
+
}), o("design:type", Boolean)], U.prototype, "inline", void 0), a([r({
|
|
920
942
|
reflect: !0,
|
|
921
943
|
type: Number
|
|
922
|
-
}), o("design:type", Number)],
|
|
944
|
+
}), o("design:type", Number)], U.prototype, "width", void 0), a([r({
|
|
923
945
|
reflect: !0,
|
|
924
946
|
type: Number
|
|
925
|
-
}), o("design:type", Number)],
|
|
947
|
+
}), o("design:type", Number)], U.prototype, "height", void 0), a([r({
|
|
926
948
|
attribute: "max-width",
|
|
927
949
|
reflect: !0,
|
|
928
950
|
type: Number
|
|
929
|
-
}), o("design:type", Number)],
|
|
951
|
+
}), o("design:type", Number)], U.prototype, "maxWidth", void 0), a([r({
|
|
930
952
|
attribute: "max-height",
|
|
931
953
|
reflect: !0,
|
|
932
954
|
type: Number
|
|
933
|
-
}), o("design:type", Number)],
|
|
955
|
+
}), o("design:type", Number)], U.prototype, "maxHeight", void 0), a([r({
|
|
934
956
|
attribute: "ratio-width",
|
|
935
957
|
reflect: !0,
|
|
936
958
|
type: Number
|
|
937
|
-
}), o("design:type", Number)],
|
|
959
|
+
}), o("design:type", Number)], U.prototype, "ratioWidth", void 0), a([r({
|
|
938
960
|
attribute: "ratio-height",
|
|
939
961
|
reflect: !0,
|
|
940
962
|
type: Number
|
|
941
|
-
}), o("design:type", Number)],
|
|
963
|
+
}), o("design:type", Number)], U.prototype, "ratioHeight", void 0), a([r({
|
|
942
964
|
attribute: "percentage-width",
|
|
943
965
|
reflect: !0,
|
|
944
966
|
type: Number
|
|
945
|
-
}), o("design:type", Number)],
|
|
967
|
+
}), o("design:type", Number)], U.prototype, "percentageWidth", void 0), a([r({
|
|
946
968
|
attribute: "percentage-height",
|
|
947
969
|
reflect: !0,
|
|
948
970
|
type: Number
|
|
949
|
-
}), o("design:type", Number)],
|
|
971
|
+
}), o("design:type", Number)], U.prototype, "percentageHeight", void 0), a([r({
|
|
950
972
|
reflect: !0,
|
|
951
973
|
type: String
|
|
952
|
-
}), o("design:type",
|
|
974
|
+
}), o("design:type", k === void 0 ? Object : k)], U.prototype, "unit", void 0), a([r({
|
|
953
975
|
attribute: "disabled-apply",
|
|
954
976
|
reflect: !0,
|
|
955
977
|
type: Boolean
|
|
956
|
-
}), o("design:type", Boolean)],
|
|
978
|
+
}), o("design:type", Boolean)], U.prototype, "disabledApply", void 0), a([r({
|
|
957
979
|
attribute: "no-ratio-modes",
|
|
958
980
|
reflect: !0,
|
|
959
981
|
type: Boolean
|
|
960
|
-
}), o("design:type", Boolean)],
|
|
982
|
+
}), o("design:type", Boolean)], U.prototype, "noRatioModes", void 0), a([r({
|
|
961
983
|
attribute: "show-position-picker",
|
|
962
984
|
reflect: !0,
|
|
963
985
|
type: Boolean
|
|
964
|
-
}), o("design:type", Boolean)],
|
|
986
|
+
}), o("design:type", Boolean)], U.prototype, "showPositionPicker", void 0), a([r({
|
|
987
|
+
attribute: "has-cropper",
|
|
988
|
+
reflect: !0,
|
|
989
|
+
type: Boolean
|
|
990
|
+
}), o("design:type", Boolean)], U.prototype, "hasCropper", void 0), a([r({
|
|
991
|
+
attribute: "dimensions-limited",
|
|
992
|
+
reflect: !0,
|
|
993
|
+
type: Boolean
|
|
994
|
+
}), o("design:type", Boolean)], U.prototype, "dimensionsLimited", void 0), a([r({
|
|
965
995
|
attribute: "last-applied-setting",
|
|
966
996
|
reflect: !1,
|
|
967
997
|
type: Object
|
|
968
|
-
}), o("design:type", typeof Record > "u" ? Object : Record)],
|
|
998
|
+
}), o("design:type", typeof Record > "u" ? Object : Record)], U.prototype, "lastAppliedSetting", void 0), a([r({
|
|
969
999
|
reflect: !0,
|
|
970
1000
|
type: Boolean
|
|
971
|
-
}), o("design:type", Boolean)],
|
|
1001
|
+
}), o("design:type", Boolean)], U.prototype, "loading", void 0), a([r({
|
|
972
1002
|
attribute: "crop-modes",
|
|
973
1003
|
reflect: !1,
|
|
974
1004
|
type: Array
|
|
975
|
-
}), o("design:type", Array)],
|
|
1005
|
+
}), o("design:type", Array)], U.prototype, "cropModes", void 0), a([r({
|
|
976
1006
|
attribute: "focus-modes",
|
|
977
1007
|
reflect: !1,
|
|
978
1008
|
type: Object
|
|
979
|
-
}), o("design:type", Array)],
|
|
1009
|
+
}), o("design:type", Array)], U.prototype, "focusModes", void 0), a([r({
|
|
980
1010
|
attribute: "focus-mode",
|
|
981
1011
|
reflect: !0,
|
|
982
1012
|
type: String
|
|
983
|
-
}), o("design:type", String)],
|
|
1013
|
+
}), o("design:type", String)], U.prototype, "focusMode", void 0), a([r({
|
|
984
1014
|
attribute: "crop-mode",
|
|
985
1015
|
reflect: !0,
|
|
986
1016
|
type: String
|
|
987
|
-
}), o("design:type", String)],
|
|
1017
|
+
}), o("design:type", String)], U.prototype, "cropMode", void 0), a([r({
|
|
988
1018
|
reflect: !0,
|
|
989
1019
|
type: String
|
|
990
|
-
}), o("design:type", v === void 0 ? Object : v)],
|
|
1020
|
+
}), o("design:type", v === void 0 ? Object : v)], U.prototype, "position", void 0), a([r({
|
|
991
1021
|
attribute: "keep-aspect-ratio",
|
|
992
1022
|
reflect: !0,
|
|
993
1023
|
type: Boolean
|
|
994
|
-
}), o("design:type", Boolean)],
|
|
1024
|
+
}), o("design:type", Boolean)], U.prototype, "keepAspectRatio", void 0), a([i(), o("design:type", Boolean)], U.prototype, "invalidWidth", void 0), a([i(), o("design:type", Boolean)], U.prototype, "invalidHeight", void 0), a([i(), o("design:type", Number)], U.prototype, "aspectRatio", void 0), a([
|
|
995
1025
|
f("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
996
1026
|
f("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
997
1027
|
f("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
@@ -999,33 +1029,33 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], H.prototype, "ba
|
|
|
999
1029
|
o("design:type", Function),
|
|
1000
1030
|
o("design:paramtypes", []),
|
|
1001
1031
|
o("design:returntype", Promise)
|
|
1002
|
-
],
|
|
1032
|
+
], U.prototype, "handleCropModeChange", null), a([
|
|
1003
1033
|
f("open", { waitUntilFirstUpdate: !0 }),
|
|
1004
1034
|
o("design:type", Function),
|
|
1005
1035
|
o("design:paramtypes", []),
|
|
1006
1036
|
o("design:returntype", Promise)
|
|
1007
|
-
],
|
|
1008
|
-
var Dt =
|
|
1009
|
-
[
|
|
1037
|
+
], U.prototype, "handleOpenChange", null), U = H = a([u("cx-asset-link-format-crop")], U);
|
|
1038
|
+
var Dt = U, Ot = t`:host{display:block}.asset-link-format__dimensions-select{width:100%}.details::part(base){border-bottom-width:0}.asset-link-format__dimensions-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__dimensions-inline .asset-link-format__dimensions-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__dimensions-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}`, kt = {
|
|
1039
|
+
[A.Percent]: { num: {
|
|
1010
1040
|
mask: Number,
|
|
1011
1041
|
min: 1,
|
|
1012
1042
|
radix: ".",
|
|
1013
1043
|
scale: 2
|
|
1014
1044
|
} },
|
|
1015
|
-
[
|
|
1045
|
+
[A.Pixel]: { num: {
|
|
1016
1046
|
mask: Number,
|
|
1017
1047
|
min: 1,
|
|
1018
1048
|
radix: ".",
|
|
1019
1049
|
scale: 0
|
|
1020
1050
|
} }
|
|
1021
|
-
},
|
|
1051
|
+
}, W = class extends s {
|
|
1022
1052
|
constructor(...e) {
|
|
1023
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior =
|
|
1024
|
-
[
|
|
1053
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior = N.Legacy, this.loading = !1, this.items = [], this.canCustom = !1, this.customDimensionsUnit = A.Pixel, this.dimensionsSelection = "", this.customDimensionsDrafts = {
|
|
1054
|
+
[A.Percent]: {
|
|
1025
1055
|
height: "100",
|
|
1026
1056
|
width: "100"
|
|
1027
1057
|
},
|
|
1028
|
-
[
|
|
1058
|
+
[A.Pixel]: {
|
|
1029
1059
|
height: "1080",
|
|
1030
1060
|
width: "1920"
|
|
1031
1061
|
}
|
|
@@ -1034,19 +1064,19 @@ var Dt = H, Ot = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1034
1064
|
static #e = this.styles = [l, Ot];
|
|
1035
1065
|
static #t = this.dependencies = {
|
|
1036
1066
|
"cx-button": _,
|
|
1037
|
-
"cx-details":
|
|
1067
|
+
"cx-details": E,
|
|
1038
1068
|
"cx-divider": ge,
|
|
1039
1069
|
"cx-icon": h,
|
|
1040
1070
|
"cx-input": oe,
|
|
1041
1071
|
"cx-menu-label": ve,
|
|
1042
|
-
"cx-option":
|
|
1043
|
-
"cx-select":
|
|
1044
|
-
"cx-space":
|
|
1045
|
-
"cx-typography":
|
|
1072
|
+
"cx-option": C,
|
|
1073
|
+
"cx-select": T,
|
|
1074
|
+
"cx-space": w,
|
|
1075
|
+
"cx-typography": x
|
|
1046
1076
|
};
|
|
1047
1077
|
handleDimensionsValueChange() {
|
|
1048
1078
|
let e = this.value;
|
|
1049
|
-
this.dimensionsSelection = e?.mode ===
|
|
1079
|
+
this.dimensionsSelection = e?.mode === D.Custom ? D.Custom : e?.mode === D.Preset ? `preset:${e.value}` : "", e?.mode === D.Custom && (this.customDimensionsUnit = e.unit, this.customDimensionsDrafts = {
|
|
1050
1080
|
...this.customDimensionsDrafts,
|
|
1051
1081
|
[e.unit]: {
|
|
1052
1082
|
height: String(e.height),
|
|
@@ -1059,26 +1089,26 @@ var Dt = H, Ot = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1059
1089
|
}
|
|
1060
1090
|
getCustomDimensionsValue() {
|
|
1061
1091
|
let e = this.customDimensionsUnit, t = this.customDimensionsDrafts[e], n = Number(t.width), r = Number(t.height);
|
|
1062
|
-
if (!(!Number.isFinite(n) || !Number.isFinite(r) || n < 1 || r < 1) && (e !==
|
|
1092
|
+
if (!(!Number.isFinite(n) || !Number.isFinite(r) || n < 1 || r < 1) && (e !== A.Pixel || Number.isInteger(n) && Number.isInteger(r))) return {
|
|
1063
1093
|
height: r,
|
|
1064
|
-
mode:
|
|
1094
|
+
mode: D.Custom,
|
|
1065
1095
|
unit: e,
|
|
1066
1096
|
width: n
|
|
1067
1097
|
};
|
|
1068
1098
|
}
|
|
1069
1099
|
get pendingValue() {
|
|
1070
|
-
if (this.dimensionsSelection ===
|
|
1100
|
+
if (this.dimensionsSelection === D.Custom) return this.getCustomDimensionsValue();
|
|
1071
1101
|
if (this.dimensionsSelection.startsWith("preset:")) {
|
|
1072
1102
|
let e = this.items.find((e) => `preset:${e.value}` === this.dimensionsSelection && !e.disabled);
|
|
1073
1103
|
return e ? {
|
|
1074
|
-
mode:
|
|
1104
|
+
mode: D.Preset,
|
|
1075
1105
|
value: e.value
|
|
1076
1106
|
} : void 0;
|
|
1077
1107
|
}
|
|
1078
1108
|
}
|
|
1079
1109
|
get applyDisabled() {
|
|
1080
1110
|
let e = this.pendingValue;
|
|
1081
|
-
return !e || !this.value || e.mode !== this.value.mode ? !e : e.mode ===
|
|
1111
|
+
return !e || !this.value || e.mode !== this.value.mode ? !e : e.mode === D.Preset && this.value.mode === D.Preset ? e.value === this.value.value : e.mode === D.Custom && this.value.mode === D.Custom && e.height === this.value.height && e.unit === this.value.unit && e.width === this.value.width;
|
|
1082
1112
|
}
|
|
1083
1113
|
applyPendingValue() {
|
|
1084
1114
|
let e = this.pendingValue;
|
|
@@ -1087,11 +1117,11 @@ var Dt = H, Ot = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1087
1117
|
onDimensionsSelectChange(e) {
|
|
1088
1118
|
if (e.target !== e.currentTarget || this.loading) return;
|
|
1089
1119
|
let t = e.currentTarget.value;
|
|
1090
|
-
if (t ===
|
|
1120
|
+
if (t === D.Custom && this.canCustom) this.dimensionsSelection = D.Custom, this.applyBehavior !== N.Manual && this.applyPendingValue();
|
|
1091
1121
|
else if (t.startsWith("preset:")) {
|
|
1092
1122
|
let e = this.items.find((e) => `preset:${e.value}` === t && !e.disabled);
|
|
1093
|
-
e && (this.dimensionsSelection = t, this.applyBehavior !==
|
|
1094
|
-
mode:
|
|
1123
|
+
e && (this.dimensionsSelection = t, this.applyBehavior !== N.Manual && this.emitDimensionsValue({
|
|
1124
|
+
mode: D.Preset,
|
|
1095
1125
|
value: e.value
|
|
1096
1126
|
}));
|
|
1097
1127
|
}
|
|
@@ -1108,12 +1138,12 @@ var Dt = H, Ot = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1108
1138
|
};
|
|
1109
1139
|
}
|
|
1110
1140
|
onDimensionsCustomChange(e) {
|
|
1111
|
-
e.target === e.currentTarget && !this.loading && this.canCustom && e.currentTarget.reportValidity() && this.applyBehavior !==
|
|
1141
|
+
e.target === e.currentTarget && !this.loading && this.canCustom && e.currentTarget.reportValidity() && this.applyBehavior !== N.Manual && this.applyPendingValue();
|
|
1112
1142
|
}
|
|
1113
1143
|
onDimensionsUnitChange(e) {
|
|
1114
1144
|
if (e.target !== e.currentTarget || this.loading || !this.canCustom) return;
|
|
1115
1145
|
let t = e.currentTarget.value;
|
|
1116
|
-
(t ===
|
|
1146
|
+
(t === A.Pixel || t === A.Percent) && (this.customDimensionsUnit = t, this.applyBehavior !== N.Manual && this.applyPendingValue());
|
|
1117
1147
|
}
|
|
1118
1148
|
onApply() {
|
|
1119
1149
|
!this.loading && !this.applyDisabled && this.applyPendingValue();
|
|
@@ -1126,21 +1156,21 @@ var Dt = H, Ot = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1126
1156
|
}
|
|
1127
1157
|
renderCustomDimensions() {
|
|
1128
1158
|
let t = this.customDimensionsUnit, n = this.customDimensionsDrafts[t];
|
|
1129
|
-
return e`<cx-space class="asset-link-format__dimensions-custom" spacing="small"><cx-input name="width" mask="num" .maskBlocks=${kt[t]} aria-label=${this.localize.term("maxWidth")} value=${n.width} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">W</cx-typography></cx-input><cx-input name="height" mask="num" .maskBlocks=${kt[t]} aria-label=${this.localize.term("maxHeight")} value=${n.height} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">H</cx-typography></cx-input><cx-select data-label=${this.localize.term("unit")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsUnitChange}><cx-option value=${
|
|
1159
|
+
return e`<cx-space class="asset-link-format__dimensions-custom" spacing="small"><cx-input name="width" mask="num" .maskBlocks=${kt[t]} aria-label=${this.localize.term("maxWidth")} value=${n.width} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">W</cx-typography></cx-input><cx-input name="height" mask="num" .maskBlocks=${kt[t]} aria-label=${this.localize.term("maxHeight")} value=${n.height} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">H</cx-typography></cx-input><cx-select data-label=${this.localize.term("unit")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsUnitChange}><cx-option value=${A.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${A.Percent}>${this.localize.term("dimensionsPercent")}</cx-option></cx-select></cx-space>`;
|
|
1130
1160
|
}
|
|
1131
1161
|
renderSummary() {
|
|
1132
|
-
return e`<cx-space class="asset-link-format__dimensions-summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant
|
|
1162
|
+
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 ? b.Body3 : b.Body2}>${this.localize.term("dimensions")}</cx-typography></cx-space>`;
|
|
1133
1163
|
}
|
|
1134
1164
|
renderContent() {
|
|
1135
|
-
let t = this.canCustom && this.dimensionsSelection ===
|
|
1136
|
-
return e`<cx-space class="asset-link-format__dimensions-content" direction="vertical" spacing="small"><cx-select class="asset-link-format__dimensions-select" data-label=${this.localize.term("dimensions")} value=${this.dimensionsSelection ===
|
|
1165
|
+
let t = this.canCustom && this.dimensionsSelection === D.Custom;
|
|
1166
|
+
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 === D.Custom && !this.canCustom ? "" : this.dimensionsSelection} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsSelectChange}>${S(this.items, (e) => e.value, (t, n) => e`
|
|
1137
1167
|
${m(t.group !== this.items[n - 1]?.group, () => e`
|
|
1138
1168
|
${m(n > 0, () => e`<cx-divider></cx-divider>`)}
|
|
1139
1169
|
${m(!!t.group, () => e`<cx-menu-label>${t.group}</cx-menu-label>`)}
|
|
1140
1170
|
`)}<cx-option value=${`preset:${t.value}`} ?disabled=${t.disabled}>${t.label}</cx-option>`)}
|
|
1141
1171
|
${m(this.canCustom, () => e`
|
|
1142
|
-
${m(this.items.length > 0, () => e`<cx-divider></cx-divider>`)}<cx-option value=${
|
|
1143
|
-
${m(this.applyBehavior ===
|
|
1172
|
+
${m(this.items.length > 0, () => e`<cx-divider></cx-divider>`)}<cx-option value=${D.Custom}><cx-icon slot="prefix" name="edit"></cx-icon>${this.localize.term("custom")}</cx-option>`)}</cx-select>${m(t, () => this.renderCustomDimensions())}
|
|
1173
|
+
${m(this.applyBehavior === N.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>`;
|
|
1144
1174
|
}
|
|
1145
1175
|
render() {
|
|
1146
1176
|
return this.inline ? e`<div class="asset-link-format__dimensions-inline">${this.renderSummary()}
|
|
@@ -1150,71 +1180,71 @@ var Dt = H, Ot = t`:host{display:block}.asset-link-format__dimensions-select{wid
|
|
|
1150
1180
|
a([r({
|
|
1151
1181
|
reflect: !0,
|
|
1152
1182
|
type: Boolean
|
|
1153
|
-
}), o("design:type", Object)],
|
|
1183
|
+
}), o("design:type", Object)], W.prototype, "open", void 0), a([r({
|
|
1154
1184
|
reflect: !0,
|
|
1155
1185
|
type: Boolean
|
|
1156
|
-
}), o("design:type", Object)],
|
|
1186
|
+
}), o("design:type", Object)], W.prototype, "inline", void 0), a([r({
|
|
1157
1187
|
attribute: "apply-behavior",
|
|
1158
1188
|
reflect: !0,
|
|
1159
1189
|
type: String
|
|
1160
|
-
}), o("design:type", Object)],
|
|
1190
|
+
}), o("design:type", Object)], W.prototype, "applyBehavior", void 0), a([r({
|
|
1161
1191
|
reflect: !0,
|
|
1162
1192
|
type: Boolean
|
|
1163
|
-
}), o("design:type", Object)],
|
|
1193
|
+
}), o("design:type", Object)], W.prototype, "loading", void 0), a([r({
|
|
1164
1194
|
attribute: !1,
|
|
1165
1195
|
type: Array
|
|
1166
|
-
}), o("design:type", Array)],
|
|
1196
|
+
}), o("design:type", Array)], W.prototype, "items", void 0), a([r({
|
|
1167
1197
|
attribute: "can-custom",
|
|
1168
1198
|
type: Boolean
|
|
1169
|
-
}), o("design:type", Object)],
|
|
1199
|
+
}), o("design:type", Object)], W.prototype, "canCustom", void 0), a([r({
|
|
1170
1200
|
attribute: !1,
|
|
1171
1201
|
type: Object
|
|
1172
|
-
}), o("design:type", Object)],
|
|
1202
|
+
}), 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), a([
|
|
1173
1203
|
f("value"),
|
|
1174
1204
|
o("design:type", Function),
|
|
1175
1205
|
o("design:paramtypes", []),
|
|
1176
1206
|
o("design:returntype", void 0)
|
|
1177
|
-
],
|
|
1178
|
-
var At =
|
|
1207
|
+
], W.prototype, "handleDimensionsValueChange", null), W = a([u("cx-asset-link-format-dimensions")], W);
|
|
1208
|
+
var At = W, jt = t`.extension{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border:solid 1px var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-0);& cx-select{flex:1;width:100%}}`, G = class extends s {
|
|
1179
1209
|
constructor(...e) {
|
|
1180
1210
|
super(...e), this.localize = new d(this), this.value = "", this.items = [];
|
|
1181
1211
|
}
|
|
1182
1212
|
static #e = this.styles = [l, jt];
|
|
1183
1213
|
static #t = this.dependencies = {
|
|
1184
|
-
"cx-option":
|
|
1185
|
-
"cx-select":
|
|
1186
|
-
"cx-space":
|
|
1187
|
-
"cx-typography":
|
|
1214
|
+
"cx-option": C,
|
|
1215
|
+
"cx-select": T,
|
|
1216
|
+
"cx-space": w,
|
|
1217
|
+
"cx-typography": x
|
|
1188
1218
|
};
|
|
1189
1219
|
handleExtensionChange(e) {
|
|
1190
1220
|
let t = e.target.value;
|
|
1191
1221
|
this.emit("cx-asset-link-format-extension-change", { detail: t });
|
|
1192
1222
|
}
|
|
1193
1223
|
render() {
|
|
1194
|
-
return e`<cx-space direction="vertical" spacing="small" class="extension"><cx-typography variant="body2">${this.localize.term("extension")}</cx-typography><cx-select data-label=${this.localize.term("extension")} data-testid="cx-asset-link-format-extension-select" value=${this.value} hoist @cx-change=${this.handleExtensionChange}>${
|
|
1224
|
+
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}>${S(this.items, (e) => e.value, (t) => e`<cx-option value=${t.value}>${t.displayName}</cx-option>`)}</cx-select></cx-space>`;
|
|
1195
1225
|
}
|
|
1196
1226
|
};
|
|
1197
1227
|
a([r({
|
|
1198
1228
|
reflect: !0,
|
|
1199
1229
|
type: String
|
|
1200
|
-
}), o("design:type", String)],
|
|
1230
|
+
}), o("design:type", String)], G.prototype, "value", void 0), a([r({
|
|
1201
1231
|
reflect: !1,
|
|
1202
1232
|
type: Array
|
|
1203
|
-
}), o("design:type", typeof Array > "u" ? Object : Array)],
|
|
1204
|
-
var Mt =
|
|
1233
|
+
}), o("design:type", typeof Array > "u" ? Object : Array)], G.prototype, "items", void 0), G = a([u("cx-asset-link-format-extension")], G);
|
|
1234
|
+
var Mt = G, Nt = t`cx-details::part(base){border-bottom-width:0}`, Pt = "auto", K = class extends s {
|
|
1205
1235
|
constructor(...e) {
|
|
1206
1236
|
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 = "";
|
|
1207
1237
|
}
|
|
1208
1238
|
static #e = this.styles = [l, Nt];
|
|
1209
1239
|
static #t = this.dependencies = {
|
|
1210
1240
|
"cx-button": _,
|
|
1211
|
-
"cx-details":
|
|
1241
|
+
"cx-details": E,
|
|
1212
1242
|
"cx-divider": ge,
|
|
1213
1243
|
"cx-icon": h,
|
|
1214
|
-
"cx-option":
|
|
1215
|
-
"cx-select":
|
|
1216
|
-
"cx-space":
|
|
1217
|
-
"cx-typography":
|
|
1244
|
+
"cx-option": C,
|
|
1245
|
+
"cx-select": T,
|
|
1246
|
+
"cx-space": w,
|
|
1247
|
+
"cx-typography": x
|
|
1218
1248
|
};
|
|
1219
1249
|
get committedValue() {
|
|
1220
1250
|
return this.autoFormat ? Pt : this.value;
|
|
@@ -1248,58 +1278,58 @@ var Mt = W, Nt = t`cx-details::part(base){border-bottom-width:0}`, Pt = "auto",
|
|
|
1248
1278
|
e.target !== this.base && e.stopPropagation();
|
|
1249
1279
|
}
|
|
1250
1280
|
render() {
|
|
1251
|
-
return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("format")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small" class="format"><cx-select data-label=${this.localize.term("imageFormat")} data-testid="cx-asset-link-format-proxy-select" value=${this.scopedValue} hoist @cx-change=${this.handleProxyChange} ?disabled=${this.loading}>${
|
|
1281
|
+
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}>${S(this.items, (e) => e.id, (t) => e`<cx-option value=${t.id}>${t.proxyLabel}</cx-option>`)}
|
|
1252
1282
|
${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${Pt}>${this.localize.term("auto")}</cx-option>`, () => n)}</cx-select><cx-button data-testid="cx-asset-link-format-proxy-apply" variant="primary" style=${g({ "margin-left": "auto" })} ?disabled=${this.scopedValue === this.committedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
1253
1283
|
}
|
|
1254
1284
|
};
|
|
1255
|
-
a([c(".details"), o("design:type",
|
|
1285
|
+
a([c(".details"), o("design:type", E === void 0 ? Object : E)], K.prototype, "base", void 0), a([r({
|
|
1256
1286
|
reflect: !0,
|
|
1257
1287
|
type: Boolean
|
|
1258
|
-
}), o("design:type", Object)],
|
|
1288
|
+
}), o("design:type", Object)], K.prototype, "open", void 0), a([r({
|
|
1259
1289
|
reflect: !0,
|
|
1260
1290
|
type: String
|
|
1261
|
-
}), o("design:type", Object)],
|
|
1291
|
+
}), o("design:type", Object)], K.prototype, "value", void 0), a([r({
|
|
1262
1292
|
reflect: !1,
|
|
1263
1293
|
type: Array
|
|
1264
|
-
}), o("design:type", Array)],
|
|
1294
|
+
}), o("design:type", Array)], K.prototype, "items", void 0), a([r({
|
|
1265
1295
|
attribute: "can-auto-format",
|
|
1266
1296
|
reflect: !0,
|
|
1267
1297
|
type: Boolean
|
|
1268
|
-
}), o("design:type", Object)],
|
|
1298
|
+
}), o("design:type", Object)], K.prototype, "canAutoFormat", void 0), a([r({
|
|
1269
1299
|
attribute: "auto-format",
|
|
1270
1300
|
reflect: !0,
|
|
1271
1301
|
type: Boolean
|
|
1272
|
-
}), o("design:type", Object)],
|
|
1302
|
+
}), o("design:type", Object)], K.prototype, "autoFormat", void 0), a([r({
|
|
1273
1303
|
reflect: !0,
|
|
1274
1304
|
type: Boolean
|
|
1275
|
-
}), o("design:type", Object)],
|
|
1305
|
+
}), o("design:type", Object)], K.prototype, "loading", void 0), a([i(), o("design:type", Object)], K.prototype, "scopedValue", void 0), a([
|
|
1276
1306
|
f("autoFormat"),
|
|
1277
1307
|
f("value"),
|
|
1278
1308
|
o("design:type", Function),
|
|
1279
1309
|
o("design:paramtypes", []),
|
|
1280
1310
|
o("design:returntype", void 0)
|
|
1281
|
-
],
|
|
1311
|
+
], K.prototype, "handleValueChange", null), a([
|
|
1282
1312
|
f("open", { waitUntilFirstUpdate: !0 }),
|
|
1283
1313
|
o("design:type", Function),
|
|
1284
1314
|
o("design:paramtypes", []),
|
|
1285
1315
|
o("design:returntype", void 0)
|
|
1286
|
-
],
|
|
1287
|
-
var Ft =
|
|
1316
|
+
], K.prototype, "handleOpenChange", null), K = a([u("cx-asset-link-format-proxy")], K);
|
|
1317
|
+
var Ft = K, It = t`cx-details::part(base){border-bottom-width:0}.asset-link-format__quality-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__quality-inline .asset-link-format__quality-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__quality-inline .asset-link-format__quality-summary cx-typography{--font-weight:var(--cx-font-weight-medium)}.asset-link-format__quality-apply{margin-inline-start:auto}`, q = class extends s {
|
|
1288
1318
|
constructor(...e) {
|
|
1289
|
-
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior =
|
|
1319
|
+
super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior = N.Legacy, this.value = 100, this.items = [], this.customSelected = !1, this.loading = !1, this.scopedValue = 100;
|
|
1290
1320
|
}
|
|
1291
1321
|
static #e = this.styles = [l, It];
|
|
1292
1322
|
static #t = this.dependencies = {
|
|
1293
1323
|
"cx-button": _,
|
|
1294
|
-
"cx-details":
|
|
1324
|
+
"cx-details": E,
|
|
1295
1325
|
"cx-divider": ge,
|
|
1296
1326
|
"cx-icon": h,
|
|
1297
1327
|
"cx-input": oe,
|
|
1298
|
-
"cx-option":
|
|
1299
|
-
"cx-select":
|
|
1300
|
-
"cx-space":
|
|
1328
|
+
"cx-option": C,
|
|
1329
|
+
"cx-select": T,
|
|
1330
|
+
"cx-space": w,
|
|
1301
1331
|
"cx-tooltip": te,
|
|
1302
|
-
"cx-typography":
|
|
1332
|
+
"cx-typography": x
|
|
1303
1333
|
};
|
|
1304
1334
|
get invalidValue() {
|
|
1305
1335
|
return isNaN(Number(this.scopedValue)) || Number(this.scopedValue) < 1 || Number(this.scopedValue) > 100 || this.value === this.scopedValue;
|
|
@@ -1312,14 +1342,14 @@ var Ft = G, It = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1312
1342
|
let t = e.currentTarget.value;
|
|
1313
1343
|
if (this.customSelected = t === "custom", this.customSelected) return;
|
|
1314
1344
|
let n = this.items.find((e) => String(e.value) === t && !e.disabled);
|
|
1315
|
-
!n || !Number.isFinite(n.value) || n.value < 1 || n.value > 100 || (this.scopedValue = n.value, n.value !== this.value && this.applyBehavior !==
|
|
1345
|
+
!n || !Number.isFinite(n.value) || n.value < 1 || n.value > 100 || (this.scopedValue = n.value, n.value !== this.value && this.applyBehavior !== N.Manual && this.handleApply());
|
|
1316
1346
|
}
|
|
1317
1347
|
handleQualityChange(e) {
|
|
1318
1348
|
let t = e.target.value;
|
|
1319
1349
|
this.customSelected = !0, this.scopedValue = Number(t);
|
|
1320
1350
|
}
|
|
1321
1351
|
handleQualityCommit(e) {
|
|
1322
|
-
e.target === e.currentTarget && this.applyBehavior ===
|
|
1352
|
+
e.target === e.currentTarget && this.applyBehavior === N.Automatic && this.handleApply();
|
|
1323
1353
|
}
|
|
1324
1354
|
handleApply() {
|
|
1325
1355
|
this.loading || this.invalidValue || this.emit("cx-asset-link-format-quality-change", { detail: Number(this.scopedValue) });
|
|
@@ -1332,11 +1362,11 @@ var Ft = G, It = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1332
1362
|
}
|
|
1333
1363
|
renderPresets() {
|
|
1334
1364
|
let t = !this.customSelected && this.items.some((e) => e.value === this.scopedValue) ? String(this.scopedValue) : "custom";
|
|
1335
|
-
return e`<cx-select data-label=${this.localize.term("quality")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.handlePresetChange}>${
|
|
1365
|
+
return e`<cx-select data-label=${this.localize.term("quality")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.handlePresetChange}>${S(this.items, (e) => e.value, (t) => e`<cx-option value=${String(t.value)} ?disabled=${t.disabled}>${t.label}
|
|
1336
1366
|
${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>`;
|
|
1337
1367
|
}
|
|
1338
1368
|
renderSummary() {
|
|
1339
|
-
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
|
|
1369
|
+
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 ? b.Body3 : b.Body2}>${this.localize.term("quality")}</cx-typography></cx-space>`;
|
|
1340
1370
|
}
|
|
1341
1371
|
renderApplyButton() {
|
|
1342
1372
|
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>`;
|
|
@@ -1350,47 +1380,47 @@ var Ft = G, It = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1350
1380
|
min: 1,
|
|
1351
1381
|
radix: ".",
|
|
1352
1382
|
scale: 0
|
|
1353
|
-
} }} value=${this.scopedValue.toString()} style=${g({ flex: "1" })} @cx-input=${this.handleQualityChange} @cx-change=${this.handleQualityCommit}></cx-input></cx-tooltip>${m(this.applyBehavior ===
|
|
1354
|
-
${m(this.applyBehavior ===
|
|
1383
|
+
} }} 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>`)}
|
|
1384
|
+
${m(this.applyBehavior === N.Manual, () => this.renderApplyButton())}</cx-space>`;
|
|
1355
1385
|
}
|
|
1356
1386
|
render() {
|
|
1357
1387
|
return this.inline ? e`<div class="asset-link-format__quality-inline">${this.renderSummary()}
|
|
1358
1388
|
${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>`;
|
|
1359
1389
|
}
|
|
1360
1390
|
};
|
|
1361
|
-
a([c(".details"), o("design:type",
|
|
1391
|
+
a([c(".details"), o("design:type", E === void 0 ? Object : E)], q.prototype, "base", void 0), a([r({
|
|
1362
1392
|
reflect: !0,
|
|
1363
1393
|
type: Boolean
|
|
1364
|
-
}), o("design:type", Object)],
|
|
1394
|
+
}), o("design:type", Object)], q.prototype, "open", void 0), a([r({
|
|
1365
1395
|
reflect: !0,
|
|
1366
1396
|
type: Boolean
|
|
1367
|
-
}), o("design:type", Object)],
|
|
1397
|
+
}), o("design:type", Object)], q.prototype, "inline", void 0), a([r({
|
|
1368
1398
|
attribute: "apply-behavior",
|
|
1369
1399
|
reflect: !0,
|
|
1370
1400
|
type: String
|
|
1371
|
-
}), o("design:type", Object)],
|
|
1401
|
+
}), o("design:type", Object)], q.prototype, "applyBehavior", void 0), a([r({
|
|
1372
1402
|
reflect: !0,
|
|
1373
1403
|
type: Number
|
|
1374
|
-
}), o("design:type", Object)],
|
|
1404
|
+
}), o("design:type", Object)], q.prototype, "value", void 0), a([r({
|
|
1375
1405
|
attribute: !1,
|
|
1376
1406
|
type: Array
|
|
1377
|
-
}), o("design:type", Array)],
|
|
1407
|
+
}), o("design:type", Array)], q.prototype, "items", void 0), a([i(), o("design:type", Object)], q.prototype, "customSelected", void 0), a([r({
|
|
1378
1408
|
reflect: !0,
|
|
1379
1409
|
type: Boolean
|
|
1380
|
-
}), o("design:type", Object)],
|
|
1410
|
+
}), o("design:type", Object)], q.prototype, "loading", void 0), a([i(), o("design:type", Object)], q.prototype, "scopedValue", void 0), a([
|
|
1381
1411
|
f("value"),
|
|
1382
1412
|
o("design:type", Function),
|
|
1383
1413
|
o("design:paramtypes", []),
|
|
1384
1414
|
o("design:returntype", void 0)
|
|
1385
|
-
],
|
|
1386
|
-
var Lt =
|
|
1415
|
+
], q.prototype, "handleValueChange", null), q = a([u("cx-asset-link-format-quality")], q);
|
|
1416
|
+
var Lt = q, Rt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.resize__unit-select{width:120px}.resize__input-group{flex:1;display:flex}`, J = class extends s {
|
|
1387
1417
|
constructor(...e) {
|
|
1388
|
-
super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit =
|
|
1389
|
-
[
|
|
1418
|
+
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 = k.Pixel, this.lastAppliedSetting = {
|
|
1419
|
+
[k.Pixel]: {
|
|
1390
1420
|
height: 0,
|
|
1391
1421
|
width: 0
|
|
1392
1422
|
},
|
|
1393
|
-
[
|
|
1423
|
+
[k.AspectRatio]: {
|
|
1394
1424
|
height: 1,
|
|
1395
1425
|
width: 1
|
|
1396
1426
|
}
|
|
@@ -1399,14 +1429,14 @@ var Lt = K, Rt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1399
1429
|
static #e = this.styles = [l, Rt];
|
|
1400
1430
|
static #t = this.dependencies = {
|
|
1401
1431
|
"cx-button": _,
|
|
1402
|
-
"cx-details":
|
|
1432
|
+
"cx-details": E,
|
|
1403
1433
|
"cx-icon": h,
|
|
1404
1434
|
"cx-icon-button": p,
|
|
1405
1435
|
"cx-input": oe,
|
|
1406
|
-
"cx-option":
|
|
1407
|
-
"cx-select":
|
|
1408
|
-
"cx-space":
|
|
1409
|
-
"cx-typography":
|
|
1436
|
+
"cx-option": C,
|
|
1437
|
+
"cx-select": T,
|
|
1438
|
+
"cx-space": w,
|
|
1439
|
+
"cx-typography": x
|
|
1410
1440
|
};
|
|
1411
1441
|
get disabledApply() {
|
|
1412
1442
|
return this.lastAppliedSetting[this.unit].width === this.width && this.lastAppliedSetting[this.unit].height === this.height;
|
|
@@ -1414,11 +1444,11 @@ var Lt = K, Rt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1414
1444
|
async handleCropModeChange() {
|
|
1415
1445
|
let e = Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && this.maxWidth > 0 && this.maxHeight > 0;
|
|
1416
1446
|
if (this.keepAspectRatio) {
|
|
1417
|
-
if (this.unit ===
|
|
1447
|
+
if (this.unit === k.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
1418
1448
|
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
1419
1449
|
return;
|
|
1420
1450
|
}
|
|
1421
|
-
if (this.unit ===
|
|
1451
|
+
if (this.unit === k.Pixel && !e && this.width && this.height) {
|
|
1422
1452
|
this.aspectRatio = this.width / this.height;
|
|
1423
1453
|
return;
|
|
1424
1454
|
}
|
|
@@ -1446,8 +1476,8 @@ var Lt = K, Rt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1446
1476
|
this.invalidWidth = !0;
|
|
1447
1477
|
return;
|
|
1448
1478
|
}
|
|
1449
|
-
this.invalidWidth = !1, this.unit ===
|
|
1450
|
-
let n = this.unit ===
|
|
1479
|
+
this.invalidWidth = !1, this.unit === k.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1)), e.target.value = t.toString();
|
|
1480
|
+
let n = this.unit === k.Pixel ? this.height : this.ratioHeight;
|
|
1451
1481
|
this.keepAspectRatio && (n = Math.max(Math.min(Math.round(t / this.aspectRatio), this.maxHeight), 1), this.invalidHeight = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1452
1482
|
height: n,
|
|
1453
1483
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -1461,8 +1491,8 @@ var Lt = K, Rt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1461
1491
|
this.invalidHeight = !0;
|
|
1462
1492
|
return;
|
|
1463
1493
|
}
|
|
1464
|
-
this.invalidHeight = !1, this.unit ===
|
|
1465
|
-
let n = this.unit ===
|
|
1494
|
+
this.invalidHeight = !1, this.unit === k.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1)), e.target.value = t.toString();
|
|
1495
|
+
let n = this.unit === k.Pixel ? this.width : this.ratioWidth;
|
|
1466
1496
|
this.keepAspectRatio && (n = Math.max(Math.min(Math.round(t * this.aspectRatio), this.maxWidth), 1), this.invalidWidth = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1467
1497
|
height: t,
|
|
1468
1498
|
keepAspectRatio: this.keepAspectRatio,
|
|
@@ -1471,16 +1501,16 @@ var Lt = K, Rt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1471
1501
|
} });
|
|
1472
1502
|
}
|
|
1473
1503
|
onUnitChange(e) {
|
|
1474
|
-
e.target.value ===
|
|
1475
|
-
height: this.lastAppliedSetting[
|
|
1504
|
+
e.target.value === k.AspectRatio ? this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1505
|
+
height: this.lastAppliedSetting[k.AspectRatio].height,
|
|
1476
1506
|
keepAspectRatio: this.keepAspectRatio,
|
|
1477
|
-
unit:
|
|
1478
|
-
width: this.lastAppliedSetting[
|
|
1507
|
+
unit: k.AspectRatio,
|
|
1508
|
+
width: this.lastAppliedSetting[k.AspectRatio].width
|
|
1479
1509
|
} }) : this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1480
|
-
height: this.lastAppliedSetting[
|
|
1510
|
+
height: this.lastAppliedSetting[k.Pixel].height,
|
|
1481
1511
|
keepAspectRatio: this.keepAspectRatio,
|
|
1482
|
-
unit:
|
|
1483
|
-
width: this.lastAppliedSetting[
|
|
1512
|
+
unit: k.Pixel,
|
|
1513
|
+
width: this.lastAppliedSetting[k.Pixel].width
|
|
1484
1514
|
} });
|
|
1485
1515
|
}
|
|
1486
1516
|
handleApply() {
|
|
@@ -1498,10 +1528,10 @@ var Lt = K, Rt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1498
1528
|
}
|
|
1499
1529
|
handleAspectRatioClick() {
|
|
1500
1530
|
this.emit("cx-asset-link-format-resize-change", { detail: {
|
|
1501
|
-
height: this.unit ===
|
|
1531
|
+
height: this.unit === k.Pixel ? this.height : this.ratioHeight,
|
|
1502
1532
|
keepAspectRatio: !this.keepAspectRatio,
|
|
1503
1533
|
unit: this.unit,
|
|
1504
|
-
width: this.unit ===
|
|
1534
|
+
width: this.unit === k.Pixel ? this.width : this.ratioWidth
|
|
1505
1535
|
} });
|
|
1506
1536
|
}
|
|
1507
1537
|
render() {
|
|
@@ -1510,62 +1540,62 @@ var Lt = K, Rt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
|
|
|
1510
1540
|
min: 1,
|
|
1511
1541
|
radix: ".",
|
|
1512
1542
|
scale: 0
|
|
1513
|
-
} }} value=${this.unit ===
|
|
1543
|
+
} }} value=${this.unit === k.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1514
1544
|
W
|
|
1515
1545
|
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-resize-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-resize-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: {
|
|
1516
1546
|
mask: Number,
|
|
1517
1547
|
min: 1,
|
|
1518
1548
|
radix: ".",
|
|
1519
1549
|
scale: 0
|
|
1520
|
-
} }} value=${this.unit ===
|
|
1550
|
+
} }} value=${this.unit === k.Pixel ? this.height.toString() : this.ratioHeight.toString()} @cx-input=${this.handleHeightChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1521
1551
|
H
|
|
1522
|
-
</cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-resize-unit" value=${this.unit} hoist class="resize__unit-select" @cx-change=${this.onUnitChange}><cx-option value=${
|
|
1552
|
+
</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=${k.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${k.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>`;
|
|
1523
1553
|
}
|
|
1524
1554
|
};
|
|
1525
|
-
a([c(".details"), o("design:type",
|
|
1555
|
+
a([c(".details"), o("design:type", E === void 0 ? Object : E)], J.prototype, "base", void 0), a([r({
|
|
1526
1556
|
reflect: !0,
|
|
1527
1557
|
type: Boolean
|
|
1528
|
-
}), o("design:type", Boolean)],
|
|
1558
|
+
}), o("design:type", Boolean)], J.prototype, "open", void 0), a([r({
|
|
1529
1559
|
reflect: !0,
|
|
1530
1560
|
type: Number
|
|
1531
|
-
}), o("design:type", Number)],
|
|
1561
|
+
}), o("design:type", Number)], J.prototype, "width", void 0), a([r({
|
|
1532
1562
|
reflect: !0,
|
|
1533
1563
|
type: Number
|
|
1534
|
-
}), o("design:type", Number)],
|
|
1564
|
+
}), o("design:type", Number)], J.prototype, "height", void 0), a([r({
|
|
1535
1565
|
attribute: "max-width",
|
|
1536
1566
|
reflect: !0,
|
|
1537
1567
|
type: Number
|
|
1538
|
-
}), o("design:type", Number)],
|
|
1568
|
+
}), o("design:type", Number)], J.prototype, "maxWidth", void 0), a([r({
|
|
1539
1569
|
attribute: "max-height",
|
|
1540
1570
|
reflect: !0,
|
|
1541
1571
|
type: Number
|
|
1542
|
-
}), o("design:type", Number)],
|
|
1572
|
+
}), o("design:type", Number)], J.prototype, "maxHeight", void 0), a([r({
|
|
1543
1573
|
attribute: "ratio-width",
|
|
1544
1574
|
reflect: !0,
|
|
1545
1575
|
type: Number
|
|
1546
|
-
}), o("design:type", Number)],
|
|
1576
|
+
}), o("design:type", Number)], J.prototype, "ratioWidth", void 0), a([r({
|
|
1547
1577
|
attribute: "ratio-height",
|
|
1548
1578
|
reflect: !0,
|
|
1549
1579
|
type: Number
|
|
1550
|
-
}), o("design:type", Number)],
|
|
1580
|
+
}), o("design:type", Number)], J.prototype, "ratioHeight", void 0), a([r({
|
|
1551
1581
|
reflect: !0,
|
|
1552
1582
|
type: String
|
|
1553
|
-
}), o("design:type",
|
|
1583
|
+
}), o("design:type", k === void 0 ? Object : k)], J.prototype, "unit", void 0), a([r({
|
|
1554
1584
|
attribute: "last-applied-setting",
|
|
1555
1585
|
reflect: !1,
|
|
1556
1586
|
type: Object
|
|
1557
|
-
}), o("design:type", typeof Record > "u" ? Object : Record)],
|
|
1587
|
+
}), o("design:type", typeof Record > "u" ? Object : Record)], J.prototype, "lastAppliedSetting", void 0), a([r({
|
|
1558
1588
|
reflect: !0,
|
|
1559
1589
|
type: Boolean
|
|
1560
|
-
}), o("design:type", Boolean)],
|
|
1590
|
+
}), o("design:type", Boolean)], J.prototype, "loading", void 0), a([r({
|
|
1561
1591
|
attribute: "no-ratio-modes",
|
|
1562
1592
|
reflect: !0,
|
|
1563
1593
|
type: Boolean
|
|
1564
|
-
}), o("design:type", Boolean)],
|
|
1594
|
+
}), o("design:type", Boolean)], J.prototype, "noRatioModes", void 0), a([r({
|
|
1565
1595
|
attribute: "keep-aspect-ratio",
|
|
1566
1596
|
reflect: !0,
|
|
1567
1597
|
type: Boolean
|
|
1568
|
-
}), o("design:type", Boolean)],
|
|
1598
|
+
}), 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([
|
|
1569
1599
|
f("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
1570
1600
|
f("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
1571
1601
|
f("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
@@ -1573,13 +1603,13 @@ a([c(".details"), o("design:type", T === void 0 ? Object : T)], q.prototype, "ba
|
|
|
1573
1603
|
o("design:type", Function),
|
|
1574
1604
|
o("design:paramtypes", []),
|
|
1575
1605
|
o("design:returntype", Promise)
|
|
1576
|
-
],
|
|
1606
|
+
], J.prototype, "handleCropModeChange", null), a([
|
|
1577
1607
|
f("open", { waitUntilFirstUpdate: !0 }),
|
|
1578
1608
|
o("design:type", Function),
|
|
1579
1609
|
o("design:paramtypes", []),
|
|
1580
1610
|
o("design:returntype", Promise)
|
|
1581
|
-
],
|
|
1582
|
-
var zt =
|
|
1611
|
+
], J.prototype, "handleOpenChange", null), J = a([u("cx-asset-link-format-resize")], J);
|
|
1612
|
+
var zt = J, Bt = t`cx-details::part(base){border-bottom-width:0}.asset-link-format__rotation-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__rotation-inline .asset-link-format__rotation-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__rotation-inline .asset-link-format__rotation-summary cx-typography{--font-weight:var(--cx-font-weight-medium)}`, Y = class extends s {
|
|
1583
1613
|
constructor(...e) {
|
|
1584
1614
|
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;
|
|
1585
1615
|
}
|
|
@@ -1587,11 +1617,11 @@ var zt = q, Bt = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1587
1617
|
static #t = this.dependencies = {
|
|
1588
1618
|
"cx-button": _,
|
|
1589
1619
|
"cx-button-group": ie,
|
|
1590
|
-
"cx-details":
|
|
1620
|
+
"cx-details": E,
|
|
1591
1621
|
"cx-icon": h,
|
|
1592
1622
|
"cx-icon-button": p,
|
|
1593
|
-
"cx-space":
|
|
1594
|
-
"cx-typography":
|
|
1623
|
+
"cx-space": w,
|
|
1624
|
+
"cx-typography": x
|
|
1595
1625
|
};
|
|
1596
1626
|
handleOpenChange() {
|
|
1597
1627
|
this.open || this.emit("cx-asset-link-format-rotation-change", { detail: this.lastAppliedValue });
|
|
@@ -1615,7 +1645,7 @@ var zt = q, Bt = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1615
1645
|
this.value === 360 || this.value === -360 || this.loading || this.emit("cx-asset-link-format-rotation-apply", { detail: this.value });
|
|
1616
1646
|
}
|
|
1617
1647
|
renderSummary() {
|
|
1618
|
-
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
|
|
1648
|
+
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 ? b.Body3 : b.Body2}>${this.localize.term("rotate")}</cx-typography></cx-space>`;
|
|
1619
1649
|
}
|
|
1620
1650
|
renderControls() {
|
|
1621
1651
|
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: {
|
|
@@ -1635,33 +1665,33 @@ var zt = q, Bt = t`cx-details::part(base){border-bottom-width:0}.asset-link-form
|
|
|
1635
1665
|
${this.renderControls()}</div>` : e`<cx-details class="details" ?open=${this.open}><div slot="summary">${this.renderSummary()}</div>${this.renderControls()}</cx-details>`;
|
|
1636
1666
|
}
|
|
1637
1667
|
};
|
|
1638
|
-
a([c(".details"), o("design:type",
|
|
1668
|
+
a([c(".details"), o("design:type", E === void 0 ? Object : E)], Y.prototype, "base", void 0), a([r({
|
|
1639
1669
|
reflect: !0,
|
|
1640
1670
|
type: Boolean
|
|
1641
|
-
}), o("design:type", Object)],
|
|
1671
|
+
}), o("design:type", Object)], Y.prototype, "open", void 0), a([r({
|
|
1642
1672
|
reflect: !0,
|
|
1643
1673
|
type: Boolean
|
|
1644
|
-
}), o("design:type", Object)],
|
|
1674
|
+
}), o("design:type", Object)], Y.prototype, "inline", void 0), a([r({
|
|
1645
1675
|
reflect: !0,
|
|
1646
1676
|
type: Number
|
|
1647
|
-
}), o("design:type", Object)],
|
|
1677
|
+
}), o("design:type", Object)], Y.prototype, "value", void 0), a([r({
|
|
1648
1678
|
attribute: "default-value",
|
|
1649
1679
|
reflect: !0,
|
|
1650
1680
|
type: Number
|
|
1651
|
-
}), o("design:type", Object)],
|
|
1681
|
+
}), o("design:type", Object)], Y.prototype, "defaultValue", void 0), a([r({
|
|
1652
1682
|
reflect: !0,
|
|
1653
1683
|
type: Boolean
|
|
1654
|
-
}), o("design:type", Object)],
|
|
1684
|
+
}), o("design:type", Object)], Y.prototype, "loading", void 0), a([r({
|
|
1655
1685
|
attribute: "last-applied-value",
|
|
1656
1686
|
reflect: !0,
|
|
1657
1687
|
type: Number
|
|
1658
|
-
}), o("design:type", Object)],
|
|
1688
|
+
}), o("design:type", Object)], Y.prototype, "lastAppliedValue", void 0), a([
|
|
1659
1689
|
f("open", { waitUntilFirstUpdate: !0 }),
|
|
1660
1690
|
o("design:type", Function),
|
|
1661
1691
|
o("design:paramtypes", []),
|
|
1662
1692
|
o("design:returntype", void 0)
|
|
1663
|
-
],
|
|
1664
|
-
var Vt =
|
|
1693
|
+
], Y.prototype, "handleOpenChange", null), Y = a([u("cx-asset-link-format-rotation")], Y);
|
|
1694
|
+
var Vt = Y, Ht = t`cx-details::part(base){border-bottom-width:0}`, X = class extends s {
|
|
1665
1695
|
constructor(...e) {
|
|
1666
1696
|
super(...e), this.localize = new d(this), this.open = !1, this.value = !1;
|
|
1667
1697
|
}
|
|
@@ -1669,11 +1699,11 @@ var Vt = J, Ht = t`cx-details::part(base){border-bottom-width:0}`, Y = class ext
|
|
|
1669
1699
|
static #t = this.dependencies = {
|
|
1670
1700
|
"cx-button": _,
|
|
1671
1701
|
"cx-checkbox": ae,
|
|
1672
|
-
"cx-details":
|
|
1702
|
+
"cx-details": E,
|
|
1673
1703
|
"cx-icon": h,
|
|
1674
|
-
"cx-space":
|
|
1704
|
+
"cx-space": w,
|
|
1675
1705
|
"cx-tooltip": te,
|
|
1676
|
-
"cx-typography":
|
|
1706
|
+
"cx-typography": x
|
|
1677
1707
|
};
|
|
1678
1708
|
handleApply(e) {
|
|
1679
1709
|
this.emit("cx-asset-link-format-metadata-change", { detail: e.target.checked });
|
|
@@ -1688,38 +1718,38 @@ var Vt = J, Ht = t`cx-details::part(base){border-bottom-width:0}`, Y = class ext
|
|
|
1688
1718
|
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>`;
|
|
1689
1719
|
}
|
|
1690
1720
|
};
|
|
1691
|
-
a([c(".details"), o("design:type",
|
|
1721
|
+
a([c(".details"), o("design:type", E === void 0 ? Object : E)], X.prototype, "base", void 0), a([r({
|
|
1692
1722
|
reflect: !0,
|
|
1693
1723
|
type: Boolean
|
|
1694
|
-
}), o("design:type", Object)],
|
|
1724
|
+
}), o("design:type", Object)], X.prototype, "open", void 0), a([r({
|
|
1695
1725
|
reflect: !0,
|
|
1696
1726
|
type: Boolean
|
|
1697
|
-
}), o("design:type", Object)],
|
|
1698
|
-
var Ut =
|
|
1699
|
-
[
|
|
1700
|
-
[
|
|
1701
|
-
[
|
|
1702
|
-
[
|
|
1703
|
-
[
|
|
1704
|
-
},
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
],
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
...
|
|
1727
|
+
}), o("design:type", Object)], X.prototype, "value", void 0), X = a([u("cx-asset-link-format-metadata")], X);
|
|
1728
|
+
var Ut = X, Z, Wt = {
|
|
1729
|
+
[j.Crop]: O.Crop,
|
|
1730
|
+
[j.Dimensions]: O.Dimensions,
|
|
1731
|
+
[j.Quality]: O.Quality,
|
|
1732
|
+
[j.Resize]: O.Resize,
|
|
1733
|
+
[j.Rotate]: O.Rotate
|
|
1734
|
+
}, Gt = [
|
|
1735
|
+
j.Proxy,
|
|
1736
|
+
j.Crop,
|
|
1737
|
+
j.Resize,
|
|
1738
|
+
j.Rotate,
|
|
1739
|
+
j.Quality,
|
|
1740
|
+
j.Metadata
|
|
1741
|
+
], Kt = [
|
|
1742
|
+
j.Proxy,
|
|
1743
|
+
j.Dimensions,
|
|
1744
|
+
...Gt.slice(1)
|
|
1715
1745
|
], Q = [
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1746
|
+
j.Dimensions,
|
|
1747
|
+
j.Crop,
|
|
1748
|
+
j.Resize,
|
|
1749
|
+
j.Rotate,
|
|
1750
|
+
j.Quality
|
|
1721
1751
|
], $ = class extends s {
|
|
1722
|
-
static #e =
|
|
1752
|
+
static #e = Z = this;
|
|
1723
1753
|
static #t = this.styles = [l, Tt];
|
|
1724
1754
|
static #n = this.dependencies = {
|
|
1725
1755
|
"cx-asset-link-format-crop": Dt,
|
|
@@ -1733,9 +1763,9 @@ var Ut = Y, X, Wt = {
|
|
|
1733
1763
|
"cx-button": _,
|
|
1734
1764
|
"cx-icon": h,
|
|
1735
1765
|
"cx-icon-button": p,
|
|
1736
|
-
"cx-space":
|
|
1766
|
+
"cx-space": w,
|
|
1737
1767
|
"cx-switch": ye,
|
|
1738
|
-
"cx-typography":
|
|
1768
|
+
"cx-typography": x,
|
|
1739
1769
|
"cx-visually-hidden": se
|
|
1740
1770
|
};
|
|
1741
1771
|
static getTransformExtension(e) {
|
|
@@ -1756,8 +1786,8 @@ var Ut = Y, X, Wt = {
|
|
|
1756
1786
|
} : void 0;
|
|
1757
1787
|
}
|
|
1758
1788
|
static getDimensionsSize(e) {
|
|
1759
|
-
if (e?.mode ===
|
|
1760
|
-
if (e?.mode ===
|
|
1789
|
+
if (e?.mode === D.Preset) return Z.getDimensionsPresetSize(e.value);
|
|
1790
|
+
if (e?.mode === D.Custom && e.unit === A.Pixel && Number.isInteger(e.width) && Number.isInteger(e.height) && e.width >= 1 && e.height >= 1) return {
|
|
1761
1791
|
height: e.height,
|
|
1762
1792
|
width: e.width
|
|
1763
1793
|
};
|
|
@@ -1765,15 +1795,15 @@ var Ut = Y, X, Wt = {
|
|
|
1765
1795
|
static getSizeBoundAfterStep(e, t) {
|
|
1766
1796
|
let { height: n = 0, rotation: r = 0, unit: i, width: a = 0 } = t.value, o = Math.round(a) >= 1 && Math.round(n) >= 1;
|
|
1767
1797
|
switch (t.key) {
|
|
1768
|
-
case
|
|
1798
|
+
case O.Resize: return i !== k.AspectRatio && o ? {
|
|
1769
1799
|
height: Math.round(n),
|
|
1770
1800
|
width: Math.round(a)
|
|
1771
1801
|
} : void 0;
|
|
1772
|
-
case
|
|
1802
|
+
case O.Dimensions: return o ? {
|
|
1773
1803
|
height: Math.min(e?.height ?? Infinity, Math.round(n)),
|
|
1774
1804
|
width: Math.min(e?.width ?? Infinity, Math.round(a))
|
|
1775
1805
|
} : e;
|
|
1776
|
-
case
|
|
1806
|
+
case O.Rotate: {
|
|
1777
1807
|
if (!e) return;
|
|
1778
1808
|
let t = r * Math.PI / 180, n = Math.abs(Math.cos(t)), i = Math.abs(Math.sin(t));
|
|
1779
1809
|
return {
|
|
@@ -1794,18 +1824,18 @@ var Ut = Y, X, Wt = {
|
|
|
1794
1824
|
return !(this.transformations.length === 0 || this.frozenIndex !== void 0 && this.frozenIndex >= this.transformations.length - 1);
|
|
1795
1825
|
}
|
|
1796
1826
|
get lastAppliedCropUnit() {
|
|
1797
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1827
|
+
return this.transformations.findLast((e) => e.key === O.Crop)?.value.unit ?? k.Pixel;
|
|
1798
1828
|
}
|
|
1799
1829
|
get lastAppliedCropFocusMode() {
|
|
1800
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1830
|
+
return this.transformations.findLast((e) => e.key === O.Crop)?.value.focusMode ?? "manual";
|
|
1801
1831
|
}
|
|
1802
1832
|
get lastAppliedCropPosition() {
|
|
1803
|
-
return this.transformations.findLast((e) => e.key ===
|
|
1833
|
+
return this.transformations.findLast((e) => e.key === O.Crop)?.value.position ?? v.CenterCenter;
|
|
1804
1834
|
}
|
|
1805
1835
|
get disabledCropApply() {
|
|
1806
1836
|
if (!this.asset && this.cropSize.unit !== this.lastAppliedCropUnit) return !1;
|
|
1807
|
-
if (this.cropSize.unit ===
|
|
1808
|
-
let e = this.lastCropSize[
|
|
1837
|
+
if (this.cropSize.unit === k.AspectRatio && !this.asset) {
|
|
1838
|
+
let e = this.lastCropSize[k.AspectRatio];
|
|
1809
1839
|
return this.cropSize.ratioWidth === e.width && this.cropSize.ratioHeight === e.height && this.cropSize.focusMode === this.lastAppliedCropFocusMode && this.cropSize.position === this.lastAppliedCropPosition;
|
|
1810
1840
|
}
|
|
1811
1841
|
if (!this.asset && this.cropSize.focusMode !== this.lastAppliedCropFocusMode || !this.asset && this.cropSize.position !== this.lastAppliedCropPosition) return !1;
|
|
@@ -1816,14 +1846,14 @@ var Ut = Y, X, Wt = {
|
|
|
1816
1846
|
"width",
|
|
1817
1847
|
"x",
|
|
1818
1848
|
"y"
|
|
1819
|
-
]) if (this.cropSize[e] !== this.lastCropSize[
|
|
1849
|
+
]) if (this.cropSize[e] !== this.lastCropSize[k.Pixel][e]) return !1;
|
|
1820
1850
|
return !0;
|
|
1821
1851
|
}
|
|
1822
1852
|
get formats() {
|
|
1823
1853
|
return this.proxies?.filter((e) => !e.cdnName) || [];
|
|
1824
1854
|
}
|
|
1825
1855
|
get activeParts() {
|
|
1826
|
-
let e = new Set(Object.values(
|
|
1856
|
+
let e = new Set(Object.values(j)), t = /* @__PURE__ */ new Set();
|
|
1827
1857
|
for (let n of this.parts) e.has(n) && t.add(n);
|
|
1828
1858
|
return [...t];
|
|
1829
1859
|
}
|
|
@@ -1834,39 +1864,48 @@ var Ut = Y, X, Wt = {
|
|
|
1834
1864
|
};
|
|
1835
1865
|
}
|
|
1836
1866
|
get stepsBeforeCrop() {
|
|
1837
|
-
let e = this.transformations.findIndex((e) => e.key ===
|
|
1867
|
+
let e = this.transformations.findIndex((e) => e.key === O.Crop);
|
|
1838
1868
|
if (e >= 0) return this.transformations.slice(0, e);
|
|
1839
1869
|
if (!this.canReorder) return this.transformations;
|
|
1840
1870
|
let t = {
|
|
1841
|
-
key:
|
|
1871
|
+
key: O.Crop,
|
|
1842
1872
|
value: {}
|
|
1843
|
-
}, n =
|
|
1873
|
+
}, n = Z.orderTransformations([...this.transformations, t], this.activeParts);
|
|
1844
1874
|
return n.slice(0, n.indexOf(t));
|
|
1845
1875
|
}
|
|
1846
1876
|
get cropMaxSize() {
|
|
1847
|
-
return this.stepsBeforeCrop.reduce(
|
|
1877
|
+
return this.stepsBeforeCrop.reduce(Z.getSizeBoundAfterStep, void 0) ?? {
|
|
1848
1878
|
height: Infinity,
|
|
1849
1879
|
width: Infinity
|
|
1850
1880
|
};
|
|
1851
1881
|
}
|
|
1882
|
+
get isCropAtDimensionsLimit() {
|
|
1883
|
+
let e = this.stepsBeforeCrop;
|
|
1884
|
+
if (this.asset || this.cropSize.unit !== k.Pixel || !e.some((e) => e.key === O.Dimensions)) return !1;
|
|
1885
|
+
let t = {
|
|
1886
|
+
height: Infinity,
|
|
1887
|
+
width: Infinity
|
|
1888
|
+
}, n = e.reduce(Z.getSizeBoundAfterStep, void 0) ?? t, r = e.filter((e) => e.key !== O.Dimensions).reduce(Z.getSizeBoundAfterStep, void 0) ?? t;
|
|
1889
|
+
return n.width < r.width && this.cropSize.width >= n.width || n.height < r.height && this.cropSize.height >= n.height;
|
|
1890
|
+
}
|
|
1852
1891
|
get lastCropSize() {
|
|
1853
1892
|
if (!this.asset) {
|
|
1854
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1855
|
-
if (e?.value.unit ===
|
|
1856
|
-
[
|
|
1893
|
+
let e = this.transformations.findLast((e) => e.key === O.Crop);
|
|
1894
|
+
if (e?.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
|
|
1895
|
+
[k.AspectRatio]: {
|
|
1857
1896
|
height: e.value.ratioHeight,
|
|
1858
1897
|
percentageHeight: 100,
|
|
1859
1898
|
percentageWidth: 100,
|
|
1860
|
-
unit:
|
|
1899
|
+
unit: k.AspectRatio,
|
|
1861
1900
|
width: e.value.ratioWidth,
|
|
1862
1901
|
x: 0,
|
|
1863
1902
|
y: 0
|
|
1864
1903
|
},
|
|
1865
|
-
[
|
|
1904
|
+
[k.Pixel]: {
|
|
1866
1905
|
height: 1,
|
|
1867
1906
|
percentageHeight: 100,
|
|
1868
1907
|
percentageWidth: 100,
|
|
1869
|
-
unit:
|
|
1908
|
+
unit: k.Pixel,
|
|
1870
1909
|
width: 1,
|
|
1871
1910
|
x: 0,
|
|
1872
1911
|
y: 0
|
|
@@ -1875,20 +1914,20 @@ var Ut = Y, X, Wt = {
|
|
|
1875
1914
|
if (e?.value.width && e?.value.height) {
|
|
1876
1915
|
let { height: t, width: n, x: r = 0, y: i = 0 } = e.value, a = y(n, t);
|
|
1877
1916
|
return {
|
|
1878
|
-
[
|
|
1917
|
+
[k.AspectRatio]: {
|
|
1879
1918
|
height: a.height,
|
|
1880
1919
|
percentageHeight: 100,
|
|
1881
1920
|
percentageWidth: 100,
|
|
1882
|
-
unit:
|
|
1921
|
+
unit: k.AspectRatio,
|
|
1883
1922
|
width: a.width,
|
|
1884
1923
|
x: 0,
|
|
1885
1924
|
y: 0
|
|
1886
1925
|
},
|
|
1887
|
-
[
|
|
1926
|
+
[k.Pixel]: {
|
|
1888
1927
|
height: t,
|
|
1889
1928
|
percentageHeight: 100,
|
|
1890
1929
|
percentageWidth: 100,
|
|
1891
|
-
unit:
|
|
1930
|
+
unit: k.Pixel,
|
|
1892
1931
|
width: n,
|
|
1893
1932
|
x: r,
|
|
1894
1933
|
y: i
|
|
@@ -1901,20 +1940,20 @@ var Ut = Y, X, Wt = {
|
|
|
1901
1940
|
width: 1
|
|
1902
1941
|
};
|
|
1903
1942
|
return {
|
|
1904
|
-
[
|
|
1943
|
+
[k.AspectRatio]: {
|
|
1905
1944
|
height: e.height,
|
|
1906
1945
|
percentageHeight: 100,
|
|
1907
1946
|
percentageWidth: 100,
|
|
1908
|
-
unit:
|
|
1947
|
+
unit: k.AspectRatio,
|
|
1909
1948
|
width: e.width,
|
|
1910
1949
|
x: 0,
|
|
1911
1950
|
y: 0
|
|
1912
1951
|
},
|
|
1913
|
-
[
|
|
1952
|
+
[k.Pixel]: {
|
|
1914
1953
|
height: this.lastImageSize.height,
|
|
1915
1954
|
percentageHeight: 100,
|
|
1916
1955
|
percentageWidth: 100,
|
|
1917
|
-
unit:
|
|
1956
|
+
unit: k.Pixel,
|
|
1918
1957
|
width: this.lastImageSize.width,
|
|
1919
1958
|
x: 0,
|
|
1920
1959
|
y: 0
|
|
@@ -1923,30 +1962,30 @@ var Ut = Y, X, Wt = {
|
|
|
1923
1962
|
}
|
|
1924
1963
|
get lastResizeSize() {
|
|
1925
1964
|
if (!this.asset) {
|
|
1926
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
1927
|
-
if (e?.value.unit ===
|
|
1928
|
-
[
|
|
1965
|
+
let e = this.transformations.findLast((e) => e.key === O.Resize);
|
|
1966
|
+
if (e?.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
|
|
1967
|
+
[k.AspectRatio]: {
|
|
1929
1968
|
height: e.value.ratioHeight,
|
|
1930
|
-
unit:
|
|
1969
|
+
unit: k.AspectRatio,
|
|
1931
1970
|
width: e.value.ratioWidth
|
|
1932
1971
|
},
|
|
1933
|
-
[
|
|
1972
|
+
[k.Pixel]: {
|
|
1934
1973
|
height: 1,
|
|
1935
|
-
unit:
|
|
1974
|
+
unit: k.Pixel,
|
|
1936
1975
|
width: 1
|
|
1937
1976
|
}
|
|
1938
1977
|
};
|
|
1939
1978
|
if (e?.value.width && e?.value.height) {
|
|
1940
1979
|
let { height: t, width: n } = e.value, r = y(n, t);
|
|
1941
1980
|
return {
|
|
1942
|
-
[
|
|
1981
|
+
[k.AspectRatio]: {
|
|
1943
1982
|
height: r.height,
|
|
1944
|
-
unit:
|
|
1983
|
+
unit: k.AspectRatio,
|
|
1945
1984
|
width: r.width
|
|
1946
1985
|
},
|
|
1947
|
-
[
|
|
1986
|
+
[k.Pixel]: {
|
|
1948
1987
|
height: t,
|
|
1949
|
-
unit:
|
|
1988
|
+
unit: k.Pixel,
|
|
1950
1989
|
width: n
|
|
1951
1990
|
}
|
|
1952
1991
|
};
|
|
@@ -1957,20 +1996,20 @@ var Ut = Y, X, Wt = {
|
|
|
1957
1996
|
width: 1
|
|
1958
1997
|
};
|
|
1959
1998
|
return {
|
|
1960
|
-
[
|
|
1999
|
+
[k.AspectRatio]: {
|
|
1961
2000
|
height: e.height,
|
|
1962
|
-
unit:
|
|
2001
|
+
unit: k.AspectRatio,
|
|
1963
2002
|
width: e.width
|
|
1964
2003
|
},
|
|
1965
|
-
[
|
|
2004
|
+
[k.Pixel]: {
|
|
1966
2005
|
height: this.lastImageSize.height,
|
|
1967
|
-
unit:
|
|
2006
|
+
unit: k.Pixel,
|
|
1968
2007
|
width: this.lastImageSize.width
|
|
1969
2008
|
}
|
|
1970
2009
|
};
|
|
1971
2010
|
}
|
|
1972
2011
|
get lastRotation() {
|
|
1973
|
-
return this.asset ? 0 : this.transformations.findLast((e) => e.key ===
|
|
2012
|
+
return this.asset ? 0 : this.transformations.findLast((e) => e.key === O.Rotate)?.value.rotation ?? 0;
|
|
1974
2013
|
}
|
|
1975
2014
|
get transformationString() {
|
|
1976
2015
|
return fe({
|
|
@@ -1982,7 +2021,7 @@ var Ut = Y, X, Wt = {
|
|
|
1982
2021
|
}).replace(/\/t\//g, "");
|
|
1983
2022
|
}
|
|
1984
2023
|
constructor() {
|
|
1985
|
-
super(), this.localize = new d(this), this.initialParts = [...
|
|
2024
|
+
super(), this.localize = new d(this), this.initialParts = [...Gt], this.sortableRevision = 0, this.dragPreviousSibling = null, this.baseUrl = void 0, this.token = void 0, this.asset = void 0, this.cropModes = [
|
|
1986
2025
|
{
|
|
1987
2026
|
label: "Free",
|
|
1988
2027
|
value: "free"
|
|
@@ -2049,7 +2088,7 @@ var Ut = Y, X, Wt = {
|
|
|
2049
2088
|
keepAspectRatio: !0,
|
|
2050
2089
|
ratioHeight: 1,
|
|
2051
2090
|
ratioWidth: 1,
|
|
2052
|
-
unit:
|
|
2091
|
+
unit: k.Pixel,
|
|
2053
2092
|
width: 1
|
|
2054
2093
|
}, this.cropSize = {
|
|
2055
2094
|
cropMode: "free",
|
|
@@ -2061,7 +2100,7 @@ var Ut = Y, X, Wt = {
|
|
|
2061
2100
|
position: v.CenterCenter,
|
|
2062
2101
|
ratioHeight: 1,
|
|
2063
2102
|
ratioWidth: 1,
|
|
2064
|
-
unit:
|
|
2103
|
+
unit: k.Pixel,
|
|
2065
2104
|
width: 1,
|
|
2066
2105
|
x: 0,
|
|
2067
2106
|
y: 0
|
|
@@ -2087,7 +2126,7 @@ var Ut = Y, X, Wt = {
|
|
|
2087
2126
|
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")) {
|
|
2088
2127
|
if (!this.asset || !this.selectedFormat || this.selectedFormat.extension === e.get("selectedFormat")?.extension) return;
|
|
2089
2128
|
this.loading = !0, this.requestTransformAsset().then((e) => {
|
|
2090
|
-
this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction ===
|
|
2129
|
+
this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction === O.Rotate && (this.rotation = 0), this.lastAction = void 0, this.lastImageSize = {
|
|
2091
2130
|
height: e.height,
|
|
2092
2131
|
width: e.width
|
|
2093
2132
|
}, this.selectedFormat = {
|
|
@@ -2121,7 +2160,7 @@ var Ut = Y, X, Wt = {
|
|
|
2121
2160
|
get transformRequestOptions() {
|
|
2122
2161
|
return {
|
|
2123
2162
|
assetId: this.asset?.id ?? "",
|
|
2124
|
-
extension:
|
|
2163
|
+
extension: Z.getTransformExtension(this.selectedFormat?.extension ?? ""),
|
|
2125
2164
|
format: this.proxies?.find((e) => e.id === this.selectedProxy)?.proxyName ?? "",
|
|
2126
2165
|
siteUrl: this.baseUrl,
|
|
2127
2166
|
token: this.token,
|
|
@@ -2151,20 +2190,20 @@ var Ut = Y, X, Wt = {
|
|
|
2151
2190
|
this.frozenIndex = this.transformations.length - 1;
|
|
2152
2191
|
}
|
|
2153
2192
|
upsertTransformation(e) {
|
|
2154
|
-
e.key ===
|
|
2193
|
+
e.key === O.Crop && (this.editedCrop = e), this.asset || (this.transformations = Z.uniqueTransformations(this.transformations));
|
|
2155
2194
|
let t = this.transformations.findIndex((t) => t.key === e.key);
|
|
2156
2195
|
if (t >= 0) {
|
|
2157
2196
|
let n = [...this.transformations];
|
|
2158
2197
|
n[t] = e, this.transformations = n;
|
|
2159
2198
|
} else this.transformations = [...this.transformations, e];
|
|
2160
|
-
this.canReorder && (this.transformations =
|
|
2199
|
+
this.canReorder && (this.transformations = Z.orderTransformations(this.transformations, this.activeParts));
|
|
2161
2200
|
}
|
|
2162
2201
|
isCropPanelSize(e) {
|
|
2163
|
-
let { height: t, ratioHeight: n, ratioWidth: r, unit: i =
|
|
2164
|
-
return i === this.cropSize.unit ? i ===
|
|
2202
|
+
let { height: t, ratioHeight: n, ratioWidth: r, unit: i = k.Pixel, width: a } = e.value;
|
|
2203
|
+
return i === this.cropSize.unit ? i === k.AspectRatio ? r === this.cropSize.ratioWidth && n === this.cropSize.ratioHeight : a === this.cropSize.width && t === this.cropSize.height : !1;
|
|
2165
2204
|
}
|
|
2166
2205
|
#r(e) {
|
|
2167
|
-
let { height: t = 0, ratioHeight: n = 0, ratioWidth: r = 0, unit: i =
|
|
2206
|
+
let { height: t = 0, ratioHeight: n = 0, ratioWidth: r = 0, unit: i = k.Pixel, width: a = 0 } = e.value, o = i === k.AspectRatio, s = o ? r : a, c = o ? n : t;
|
|
2168
2207
|
if (!s || !c) return;
|
|
2169
2208
|
let l = this.cropModes.filter((e) => !e.auto && /^\d+:\d+$/.test(e.value)).map(({ value: e }) => {
|
|
2170
2209
|
let [t, n] = e.split(":").map(Number);
|
|
@@ -2177,8 +2216,8 @@ var Ut = Y, X, Wt = {
|
|
|
2177
2216
|
return u || o ? u?.value : l.find(({ modeHeight: e, modeWidth: t }) => Math.abs(t * c - e * s) <= Math.max(t, e) / 2)?.value;
|
|
2178
2217
|
}
|
|
2179
2218
|
capCropToMaxSize() {
|
|
2180
|
-
let e = this.transformations.find((e) => e.key ===
|
|
2181
|
-
if (this.asset || !e || (e.value.unit ??
|
|
2219
|
+
let e = this.transformations.find((e) => e.key === O.Crop);
|
|
2220
|
+
if (this.asset || !e || (e.value.unit ?? k.Pixel) !== k.Pixel) return;
|
|
2182
2221
|
let { height: t = 0, width: n = 0 } = e.value, r = this.cropMaxSize;
|
|
2183
2222
|
if (n <= r.width && t <= r.height) return;
|
|
2184
2223
|
let i = Math.min(t, r.height), a = Math.min(n, r.width), o = this.isCropPanelSize(e) && n * i === t * a;
|
|
@@ -2199,7 +2238,7 @@ var Ut = Y, X, Wt = {
|
|
|
2199
2238
|
async handleTransformationsChange(e) {
|
|
2200
2239
|
let t = e, n = this.canReorder && t !== void 0 && t.length === this.transformations.length && t.every((e) => this.transformations.includes(e));
|
|
2201
2240
|
if (!this.asset) {
|
|
2202
|
-
let e =
|
|
2241
|
+
let e = Z.uniqueTransformations(this.transformations), t = this.canReorder ? Z.orderTransformations(e, this.activeParts) : e;
|
|
2203
2242
|
(t.length !== this.transformations.length || t.some((e, t) => e !== this.transformations[t])) && (this.transformations = t);
|
|
2204
2243
|
}
|
|
2205
2244
|
if (this.syncSelectedDimensions(), await this.updateComplete, !this.asset) {
|
|
@@ -2211,8 +2250,8 @@ var Ut = Y, X, Wt = {
|
|
|
2211
2250
|
transformations: this.transformations,
|
|
2212
2251
|
useSession: this.useSession
|
|
2213
2252
|
}).replace(/\/t\//g, "") }), n) return;
|
|
2214
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2215
|
-
if (e?.value.unit ===
|
|
2253
|
+
let e = this.transformations.findLast((e) => e.key === O.Crop && (e.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width && e.value.height)), t = e !== void 0 && e === this.editedCrop && this.isCropPanelSize(e), r = e && !t ? this.#r(e) : void 0, i = t ? this.cropSize.cropMode : r ?? "free";
|
|
2254
|
+
if (e?.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) {
|
|
2216
2255
|
let { focusMode: n, position: r, ratioHeight: a, ratioWidth: o } = e.value;
|
|
2217
2256
|
this.cropSize = {
|
|
2218
2257
|
...this.cropSize,
|
|
@@ -2224,7 +2263,7 @@ var Ut = Y, X, Wt = {
|
|
|
2224
2263
|
position: r ?? v.CenterCenter,
|
|
2225
2264
|
ratioHeight: a,
|
|
2226
2265
|
ratioWidth: o,
|
|
2227
|
-
unit:
|
|
2266
|
+
unit: k.AspectRatio
|
|
2228
2267
|
};
|
|
2229
2268
|
} else if (e) {
|
|
2230
2269
|
let { focusMode: t, height: n, position: a, unit: o, width: s, x: c = 0, y: l = 0 } = e.value;
|
|
@@ -2237,7 +2276,7 @@ var Ut = Y, X, Wt = {
|
|
|
2237
2276
|
percentageHeight: 100,
|
|
2238
2277
|
percentageWidth: 100,
|
|
2239
2278
|
position: a ?? v.CenterCenter,
|
|
2240
|
-
unit: o ??
|
|
2279
|
+
unit: o ?? k.Pixel,
|
|
2241
2280
|
width: s,
|
|
2242
2281
|
x: c,
|
|
2243
2282
|
y: l
|
|
@@ -2250,37 +2289,37 @@ var Ut = Y, X, Wt = {
|
|
|
2250
2289
|
percentageHeight: 0,
|
|
2251
2290
|
percentageWidth: 0,
|
|
2252
2291
|
position: v.CenterCenter,
|
|
2253
|
-
unit:
|
|
2292
|
+
unit: k.Pixel,
|
|
2254
2293
|
width: 1,
|
|
2255
2294
|
x: 0,
|
|
2256
2295
|
y: 0
|
|
2257
2296
|
};
|
|
2258
|
-
let a = this.transformations.findLast((e) => e.key ===
|
|
2259
|
-
if (a?.value.unit ===
|
|
2297
|
+
let a = this.transformations.findLast((e) => e.key === O.Resize && (e.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width || e.value.height));
|
|
2298
|
+
if (a?.value.unit === k.AspectRatio && a.value.ratioWidth && a.value.ratioHeight) {
|
|
2260
2299
|
let { ratioHeight: e, ratioWidth: t } = a.value;
|
|
2261
2300
|
this.resizeSize = {
|
|
2262
2301
|
...this.resizeSize,
|
|
2263
2302
|
ratioHeight: e,
|
|
2264
2303
|
ratioWidth: t,
|
|
2265
|
-
unit:
|
|
2304
|
+
unit: k.AspectRatio
|
|
2266
2305
|
};
|
|
2267
2306
|
} else if (a) {
|
|
2268
2307
|
let { height: e = 0, unit: t, width: n = 0 } = a.value;
|
|
2269
2308
|
this.resizeSize = {
|
|
2270
2309
|
...this.resizeSize,
|
|
2271
2310
|
height: e,
|
|
2272
|
-
unit: t ??
|
|
2311
|
+
unit: t ?? k.Pixel,
|
|
2273
2312
|
width: n
|
|
2274
2313
|
};
|
|
2275
2314
|
} else this.resizeSize = {
|
|
2276
2315
|
...this.resizeSize,
|
|
2277
2316
|
height: 1,
|
|
2278
|
-
unit:
|
|
2317
|
+
unit: k.Pixel,
|
|
2279
2318
|
width: 1
|
|
2280
2319
|
};
|
|
2281
|
-
let o = this.transformations.findLast((e) => e.key ===
|
|
2320
|
+
let o = this.transformations.findLast((e) => e.key === O.Rotate);
|
|
2282
2321
|
this.rotation = o?.value.rotation ?? 0;
|
|
2283
|
-
let s = this.transformations.findLast((e) => e.key ===
|
|
2322
|
+
let s = this.transformations.findLast((e) => e.key === O.Quality)?.value.quality ?? 100, c = this.transformations.some((e) => e.key === O.Metadata);
|
|
2284
2323
|
this.selectedFormat = this.selectedFormat ? {
|
|
2285
2324
|
...this.selectedFormat,
|
|
2286
2325
|
keepMetadata: c,
|
|
@@ -2310,7 +2349,7 @@ var Ut = Y, X, Wt = {
|
|
|
2310
2349
|
keepAspectRatio: !0,
|
|
2311
2350
|
ratioHeight: 1,
|
|
2312
2351
|
ratioWidth: 1,
|
|
2313
|
-
unit:
|
|
2352
|
+
unit: k.Pixel,
|
|
2314
2353
|
width: r.width
|
|
2315
2354
|
}, this.cropSize = {
|
|
2316
2355
|
cropMode: "free",
|
|
@@ -2322,12 +2361,12 @@ var Ut = Y, X, Wt = {
|
|
|
2322
2361
|
position: v.CenterCenter,
|
|
2323
2362
|
ratioHeight: 1,
|
|
2324
2363
|
ratioWidth: 1,
|
|
2325
|
-
unit:
|
|
2364
|
+
unit: k.Pixel,
|
|
2326
2365
|
width: r.width,
|
|
2327
2366
|
x: 0,
|
|
2328
2367
|
y: 0
|
|
2329
|
-
}, this.lastAction ===
|
|
2330
|
-
let i = this.transformations.some((e) => e.key ===
|
|
2368
|
+
}, this.lastAction === O.Rotate && (this.rotation = 0), this.lastAction = void 0;
|
|
2369
|
+
let i = this.transformations.some((e) => e.key === O.Metadata), a = this.transformations.findLast((e) => e.key === O.Quality);
|
|
2331
2370
|
this.selectedFormat = {
|
|
2332
2371
|
...this.selectedFormat,
|
|
2333
2372
|
height: r.height,
|
|
@@ -2358,7 +2397,7 @@ var Ut = Y, X, Wt = {
|
|
|
2358
2397
|
height: Number.parseInt(this.asset.height, 10),
|
|
2359
2398
|
width: Number.parseInt(this.asset.width, 10)
|
|
2360
2399
|
});
|
|
2361
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2400
|
+
let e = this.transformations.findLast((e) => e.key === O.Quality);
|
|
2362
2401
|
this.selectedFormat = {
|
|
2363
2402
|
extension: this.asset.extension,
|
|
2364
2403
|
height: this.defaultSize.height,
|
|
@@ -2383,7 +2422,7 @@ var Ut = Y, X, Wt = {
|
|
|
2383
2422
|
position: v.CenterCenter,
|
|
2384
2423
|
ratioHeight: 1,
|
|
2385
2424
|
ratioWidth: 1,
|
|
2386
|
-
unit:
|
|
2425
|
+
unit: k.Pixel,
|
|
2387
2426
|
width: this.defaultSize.width,
|
|
2388
2427
|
x: 0,
|
|
2389
2428
|
y: 0
|
|
@@ -2402,7 +2441,7 @@ var Ut = Y, X, Wt = {
|
|
|
2402
2441
|
t.proxyName === "TRX" && (t.formatHeight = Number(this.asset.height), t.formatWidth = Number(this.asset.width));
|
|
2403
2442
|
let n = this.proxies?.find((t) => t.id === e);
|
|
2404
2443
|
n && (this.asset && n.proxyName === "TRX" && (n.formatHeight = Number(this.asset.height), n.formatWidth = Number(this.asset.width)), this.transformations = this.transformations.map((e) => {
|
|
2405
|
-
if (e.key ===
|
|
2444
|
+
if (e.key === O.Crop) {
|
|
2406
2445
|
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;
|
|
2407
2446
|
return {
|
|
2408
2447
|
...e,
|
|
@@ -2415,7 +2454,7 @@ var Ut = Y, X, Wt = {
|
|
|
2415
2454
|
}
|
|
2416
2455
|
};
|
|
2417
2456
|
}
|
|
2418
|
-
if (e.key ===
|
|
2457
|
+
if (e.key === O.Resize) {
|
|
2419
2458
|
let r = e.value, i = r.width / n.formatWidth * t.formatWidth, a = r.height / n.formatHeight * t.formatHeight;
|
|
2420
2459
|
return {
|
|
2421
2460
|
...e,
|
|
@@ -2436,24 +2475,24 @@ var Ut = Y, X, Wt = {
|
|
|
2436
2475
|
}, await this.updateComplete, this.cropSize = {
|
|
2437
2476
|
cropMode: "free",
|
|
2438
2477
|
focusMode: "manual",
|
|
2439
|
-
height: this.lastCropSize[
|
|
2478
|
+
height: this.lastCropSize[k.Pixel].height,
|
|
2440
2479
|
keepAspectRatio: !0,
|
|
2441
2480
|
percentageHeight: 100,
|
|
2442
2481
|
percentageWidth: 100,
|
|
2443
2482
|
position: v.CenterCenter,
|
|
2444
2483
|
ratioHeight: 1,
|
|
2445
2484
|
ratioWidth: 1,
|
|
2446
|
-
unit:
|
|
2447
|
-
width: this.lastCropSize[
|
|
2485
|
+
unit: k.Pixel,
|
|
2486
|
+
width: this.lastCropSize[k.Pixel].width,
|
|
2448
2487
|
x: 0,
|
|
2449
2488
|
y: 0
|
|
2450
2489
|
}, this.resizeSize = {
|
|
2451
|
-
height: this.lastResizeSize[
|
|
2490
|
+
height: this.lastResizeSize[k.Pixel].height,
|
|
2452
2491
|
keepAspectRatio: !0,
|
|
2453
2492
|
ratioHeight: 1,
|
|
2454
2493
|
ratioWidth: 1,
|
|
2455
|
-
unit:
|
|
2456
|
-
width: this.lastResizeSize[
|
|
2494
|
+
unit: k.Pixel,
|
|
2495
|
+
width: this.lastResizeSize[k.Pixel].width
|
|
2457
2496
|
};
|
|
2458
2497
|
}
|
|
2459
2498
|
handleLoadingChange() {
|
|
@@ -2473,17 +2512,17 @@ var Ut = Y, X, Wt = {
|
|
|
2473
2512
|
}
|
|
2474
2513
|
handlePartsChange() {
|
|
2475
2514
|
if (this.activeParts.some((e) => {
|
|
2476
|
-
let t = e ===
|
|
2515
|
+
let t = e === j.Rotate ? "rotation" : e;
|
|
2477
2516
|
return this.activeSetting === `cx-asset-link-format-${t}`;
|
|
2478
2517
|
}) || (this.activeSetting = ""), this.canReorder) {
|
|
2479
|
-
let e =
|
|
2518
|
+
let e = Z.orderTransformations(Z.uniqueTransformations(this.transformations), this.activeParts);
|
|
2480
2519
|
(e.length !== this.transformations.length || e.some((e, t) => e !== this.transformations[t])) && (this.transformations = e);
|
|
2481
2520
|
}
|
|
2482
2521
|
}
|
|
2483
2522
|
handleReorderableChange() {
|
|
2484
2523
|
if (this.orderUndo = [], this.canReorder && this.parts === this.initialParts && this.transformations.length > 0) {
|
|
2485
|
-
let e =
|
|
2486
|
-
this.parts =
|
|
2524
|
+
let e = Z.uniqueTransformations(this.transformations).flatMap((e) => Gt.filter((t) => Wt[t] === e.key)), t = [...e, ...Gt.filter((t) => Wt[t] && !e.includes(t))], n = 0;
|
|
2525
|
+
this.parts = Gt.map((e) => Wt[e] ? t[n++] : e);
|
|
2487
2526
|
}
|
|
2488
2527
|
this.handlePartsChange(), this.syncSortable();
|
|
2489
2528
|
}
|
|
@@ -2542,7 +2581,7 @@ var Ut = Y, X, Wt = {
|
|
|
2542
2581
|
this.rememberOrder(), n.splice(r, 1), n.splice(t, 0, e);
|
|
2543
2582
|
let i = 0;
|
|
2544
2583
|
this.parts = this.activeParts.map((e) => Q.includes(e) ? n[i++] : e);
|
|
2545
|
-
let a =
|
|
2584
|
+
let a = Z.orderTransformations(this.transformations, this.parts);
|
|
2546
2585
|
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(() => {
|
|
2547
2586
|
this.shadowRoot?.querySelector(`[data-part="${e}"] .asset-link-format__drag-handle`)?.focus();
|
|
2548
2587
|
});
|
|
@@ -2555,17 +2594,17 @@ var Ut = Y, X, Wt = {
|
|
|
2555
2594
|
}
|
|
2556
2595
|
handleActiveSettingChange() {
|
|
2557
2596
|
this.cropperElement && (this.resizeSize = {
|
|
2558
|
-
height: this.lastResizeSize[
|
|
2597
|
+
height: this.lastResizeSize[k.Pixel].height,
|
|
2559
2598
|
keepAspectRatio: !0,
|
|
2560
2599
|
ratioHeight: 1,
|
|
2561
2600
|
ratioWidth: 1,
|
|
2562
|
-
unit:
|
|
2563
|
-
width: this.lastResizeSize[
|
|
2601
|
+
unit: k.Pixel,
|
|
2602
|
+
width: this.lastResizeSize[k.Pixel].width
|
|
2564
2603
|
}, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop");
|
|
2565
2604
|
}
|
|
2566
2605
|
async handleRequestAutoCropSuggestion({ cropMode: e, focusMode: t, height: n, keepAspectRatio: r, percentageHeight: i, percentageWidth: a, ratioHeight: o, ratioWidth: s, unit: c, useCropMode: l, width: u }) {
|
|
2567
2606
|
if (!this.selectedFormat?.url || t === "manual") return;
|
|
2568
|
-
this.loading = !0, this.lastAction =
|
|
2607
|
+
this.loading = !0, this.lastAction = O.Crop;
|
|
2569
2608
|
let d = await this.apiGetCropFocusMode({
|
|
2570
2609
|
autoCropMode: t,
|
|
2571
2610
|
cropHeight: n,
|
|
@@ -2641,7 +2680,7 @@ var Ut = Y, X, Wt = {
|
|
|
2641
2680
|
}
|
|
2642
2681
|
onProxyChange(e) {
|
|
2643
2682
|
let t = e.detail;
|
|
2644
|
-
if (this.lastAction =
|
|
2683
|
+
if (this.lastAction = O.Proxy, t.autoFormat) {
|
|
2645
2684
|
this.autoFormat = !0;
|
|
2646
2685
|
let e = this.autoResolvedProxyId;
|
|
2647
2686
|
e && (this.selectedProxy = e);
|
|
@@ -2657,7 +2696,7 @@ var Ut = Y, X, Wt = {
|
|
|
2657
2696
|
});
|
|
2658
2697
|
else {
|
|
2659
2698
|
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;
|
|
2660
|
-
t === "free" ? (n = !1, r = "manual") : this.cropSize.unit ===
|
|
2699
|
+
t === "free" ? (n = !1, r = "manual") : this.cropSize.unit === k.Pixel && !e && (i = 0, a = 0), e ? await this.handleRequestAutoCropSuggestion({
|
|
2661
2700
|
cropMode: t,
|
|
2662
2701
|
focusMode: r,
|
|
2663
2702
|
height: this.cropSize.height,
|
|
@@ -2693,11 +2732,11 @@ var Ut = Y, X, Wt = {
|
|
|
2693
2732
|
}
|
|
2694
2733
|
async onCropChange(e) {
|
|
2695
2734
|
let t = this.cropSize.unit;
|
|
2696
|
-
if (e.detail.unit ===
|
|
2735
|
+
if (e.detail.unit === k.AspectRatio) {
|
|
2697
2736
|
let t = e.detail.width / e.detail.height, n = this.asset ? Math.min(Math.max(Math.round(this.cropSize.height * t), 0), this.resizeSize.width) : 0, r = this.asset ? Math.min(Math.max(Math.round(n / t), 0), this.resizeSize.height) : 0, i = this.asset ? r * 100 / this.selectedFormat.height : 100, a = this.asset ? n * 100 / this.selectedFormat.width : 100, o = this.cropSize.x, s = this.cropSize.y;
|
|
2698
2737
|
o + a > 100 && (o = 100 - a), s + i > 100 && (s = 100 - i);
|
|
2699
2738
|
let c = this.cropSize.cropMode, l = this.cropModes.find((e) => e.value === c)?.auto, u = /^(\d+):(\d+)$/.exec(c), d = u !== null && !e.detail.keepAspectRatio && Number(u[1]) * e.detail.height !== Number(u[2]) * e.detail.width;
|
|
2700
|
-
(l || d) && (c = "free"), e.detail.silent ? (this.cropSize.height = r, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = a, this.cropSize.ratioHeight = e.detail.height, this.cropSize.ratioWidth = e.detail.width, this.cropSize.unit =
|
|
2739
|
+
(l || d) && (c = "free"), e.detail.silent ? (this.cropSize.height = r, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = a, this.cropSize.ratioHeight = e.detail.height, this.cropSize.ratioWidth = e.detail.width, this.cropSize.unit = k.AspectRatio, this.cropSize.width = n) : this.cropSize = {
|
|
2701
2740
|
...this.cropSize,
|
|
2702
2741
|
cropMode: c,
|
|
2703
2742
|
height: r,
|
|
@@ -2706,7 +2745,7 @@ var Ut = Y, X, Wt = {
|
|
|
2706
2745
|
percentageWidth: a,
|
|
2707
2746
|
ratioHeight: e.detail.height,
|
|
2708
2747
|
ratioWidth: e.detail.width,
|
|
2709
|
-
unit:
|
|
2748
|
+
unit: k.AspectRatio,
|
|
2710
2749
|
width: n,
|
|
2711
2750
|
x: o,
|
|
2712
2751
|
y: s
|
|
@@ -2715,20 +2754,20 @@ var Ut = Y, X, Wt = {
|
|
|
2715
2754
|
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;
|
|
2716
2755
|
r + n > 100 && (r = 100 - n), i + t > 100 && (i = 100 - t);
|
|
2717
2756
|
let a = this.cropSize.cropMode, o = this.cropModes.find((e) => e.value === a)?.auto;
|
|
2718
|
-
(e.detail.breakAspectRatio || o) && (a = "free"), e.detail.silent ? (this.cropSize.cropMode = a, this.cropSize.height = e.detail.height, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = t, this.cropSize.percentageWidth = n, this.cropSize.unit =
|
|
2757
|
+
(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 = k.Pixel, this.cropSize.width = e.detail.width, this.cropSize.x = r, this.cropSize.y = i) : this.cropSize = {
|
|
2719
2758
|
...this.cropSize,
|
|
2720
2759
|
cropMode: a,
|
|
2721
2760
|
height: e.detail.height,
|
|
2722
2761
|
keepAspectRatio: e.detail.keepAspectRatio,
|
|
2723
2762
|
percentageHeight: t,
|
|
2724
2763
|
percentageWidth: n,
|
|
2725
|
-
unit:
|
|
2764
|
+
unit: k.Pixel,
|
|
2726
2765
|
width: e.detail.width,
|
|
2727
2766
|
x: r,
|
|
2728
2767
|
y: i
|
|
2729
2768
|
};
|
|
2730
2769
|
}
|
|
2731
|
-
t !== this.cropSize.unit && (this.isFormatsLayout
|
|
2770
|
+
t !== this.cropSize.unit && (!this.isFormatsLayout && !this.cropperElement && (this.cropSize = {
|
|
2732
2771
|
...this.cropSize,
|
|
2733
2772
|
cropMode: "free"
|
|
2734
2773
|
}), this.onCropChanged()), this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
|
|
@@ -2748,11 +2787,11 @@ var Ut = Y, X, Wt = {
|
|
|
2748
2787
|
unit: this.cropSize.unit,
|
|
2749
2788
|
width: this.cropSize.width
|
|
2750
2789
|
}) {
|
|
2751
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2790
|
+
if (this.clearResetSnapshot(), this.lastAction = O.Crop, !this.asset) {
|
|
2752
2791
|
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;
|
|
2753
|
-
if (a ===
|
|
2792
|
+
if (a === k.AspectRatio) {
|
|
2754
2793
|
i && r && this.upsertTransformation({
|
|
2755
|
-
key:
|
|
2794
|
+
key: O.Crop,
|
|
2756
2795
|
value: {
|
|
2757
2796
|
focusMode: e,
|
|
2758
2797
|
isFocusModeAuto: l,
|
|
@@ -2765,7 +2804,7 @@ var Ut = Y, X, Wt = {
|
|
|
2765
2804
|
return;
|
|
2766
2805
|
}
|
|
2767
2806
|
(t || o) && Number.isFinite(t) && Number.isFinite(o) && this.upsertTransformation({
|
|
2768
|
-
key:
|
|
2807
|
+
key: O.Crop,
|
|
2769
2808
|
value: {
|
|
2770
2809
|
focusMode: e,
|
|
2771
2810
|
height: t,
|
|
@@ -2784,8 +2823,8 @@ var Ut = Y, X, Wt = {
|
|
|
2784
2823
|
let a = this.cropSize.focusMode, o = this.focusModes.find((e) => e.value === a)?.auto ?? !1;
|
|
2785
2824
|
if (t && i && r) {
|
|
2786
2825
|
let e = i, s = t;
|
|
2787
|
-
if (r ===
|
|
2788
|
-
key:
|
|
2826
|
+
if (r === k.AspectRatio && (e = this.cropSize.percentageWidth * this.selectedFormat.width / 100, s = this.cropSize.percentageHeight * this.selectedFormat.height / 100), n) this.transformations = [...this.transformations, {
|
|
2827
|
+
key: O.Crop,
|
|
2789
2828
|
value: {
|
|
2790
2829
|
focusMode: a,
|
|
2791
2830
|
height: s,
|
|
@@ -2797,7 +2836,7 @@ var Ut = Y, X, Wt = {
|
|
|
2797
2836
|
else {
|
|
2798
2837
|
let t = this.cropSize.x / 100 * this.selectedFormat.width, n = this.cropSize.y / 100 * this.selectedFormat.height;
|
|
2799
2838
|
this.transformations = [...this.transformations, {
|
|
2800
|
-
key:
|
|
2839
|
+
key: O.Crop,
|
|
2801
2840
|
value: {
|
|
2802
2841
|
focusMode: a,
|
|
2803
2842
|
height: s,
|
|
@@ -2810,7 +2849,7 @@ var Ut = Y, X, Wt = {
|
|
|
2810
2849
|
}];
|
|
2811
2850
|
}
|
|
2812
2851
|
} else n && (this.transformations = [...this.transformations, {
|
|
2813
|
-
key:
|
|
2852
|
+
key: O.Crop,
|
|
2814
2853
|
value: {
|
|
2815
2854
|
focusMode: a,
|
|
2816
2855
|
isFocusModeAuto: o,
|
|
@@ -2819,8 +2858,8 @@ var Ut = Y, X, Wt = {
|
|
|
2819
2858
|
}]);
|
|
2820
2859
|
}
|
|
2821
2860
|
onResizeChange(e) {
|
|
2822
|
-
if (e.detail.unit ===
|
|
2823
|
-
let t = e.detail.width / e.detail.height, n = Math.max(Math.round(this.lastResizeSize[
|
|
2861
|
+
if (e.detail.unit === k.AspectRatio) {
|
|
2862
|
+
let t = e.detail.width / e.detail.height, n = Math.max(Math.round(this.lastResizeSize[k.Pixel].height * t), 0), r = Math.max(Math.round(n / t), 0);
|
|
2824
2863
|
this.resizeSize = {
|
|
2825
2864
|
...this.resizeSize,
|
|
2826
2865
|
height: r,
|
|
@@ -2841,11 +2880,11 @@ var Ut = Y, X, Wt = {
|
|
|
2841
2880
|
onResizeApply(e) {
|
|
2842
2881
|
let { height: t, unit: n, width: r } = e.detail;
|
|
2843
2882
|
if (!Number.isFinite(r) || !Number.isFinite(t)) return;
|
|
2844
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2845
|
-
if (n ===
|
|
2883
|
+
if (this.clearResetSnapshot(), this.lastAction = O.Resize, !this.asset) {
|
|
2884
|
+
if (n === k.AspectRatio) {
|
|
2846
2885
|
let { ratioHeight: e, ratioWidth: t } = this.resizeSize;
|
|
2847
2886
|
t && e && this.upsertTransformation({
|
|
2848
|
-
key:
|
|
2887
|
+
key: O.Resize,
|
|
2849
2888
|
value: {
|
|
2850
2889
|
ratioHeight: e,
|
|
2851
2890
|
ratioWidth: t,
|
|
@@ -2855,7 +2894,7 @@ var Ut = Y, X, Wt = {
|
|
|
2855
2894
|
return;
|
|
2856
2895
|
}
|
|
2857
2896
|
(t || r) && (this.upsertTransformation({
|
|
2858
|
-
key:
|
|
2897
|
+
key: O.Resize,
|
|
2859
2898
|
value: {
|
|
2860
2899
|
height: t,
|
|
2861
2900
|
unit: n,
|
|
@@ -2866,8 +2905,8 @@ var Ut = Y, X, Wt = {
|
|
|
2866
2905
|
}
|
|
2867
2906
|
if (!this.selectedFormat) return;
|
|
2868
2907
|
let i = this.selectedFormat.width || this.defaultSize.width, a = this.selectedFormat.height || this.defaultSize.height, o = r, s = t;
|
|
2869
|
-
this.resizeSize.unit === n ? n ===
|
|
2870
|
-
key:
|
|
2908
|
+
this.resizeSize.unit === n ? n === k.AspectRatio && (o = Math.round(r / t * a), s = a) : (o = i, s = a), this.transformations = [...this.transformations, {
|
|
2909
|
+
key: O.Resize,
|
|
2871
2910
|
value: {
|
|
2872
2911
|
height: s,
|
|
2873
2912
|
unit: n,
|
|
@@ -2882,23 +2921,23 @@ var Ut = Y, X, Wt = {
|
|
|
2882
2921
|
this.applyRotationTransformation(e.detail);
|
|
2883
2922
|
}
|
|
2884
2923
|
applyRotationTransformation(e) {
|
|
2885
|
-
if (this.clearResetSnapshot(), this.lastAction =
|
|
2924
|
+
if (this.clearResetSnapshot(), this.lastAction = O.Rotate, !this.asset) {
|
|
2886
2925
|
e ? this.upsertTransformation({
|
|
2887
|
-
key:
|
|
2926
|
+
key: O.Rotate,
|
|
2888
2927
|
value: { rotation: e }
|
|
2889
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2928
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== O.Rotate);
|
|
2890
2929
|
return;
|
|
2891
2930
|
}
|
|
2892
2931
|
this.selectedFormat && (this.transformations = [...this.transformations, {
|
|
2893
|
-
key:
|
|
2932
|
+
key: O.Rotate,
|
|
2894
2933
|
value: { rotation: e }
|
|
2895
2934
|
}]);
|
|
2896
2935
|
}
|
|
2897
2936
|
onQualityChange(e) {
|
|
2898
2937
|
let t = e.detail;
|
|
2899
|
-
this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction =
|
|
2938
|
+
this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction = O.Quality;
|
|
2900
2939
|
let n = {
|
|
2901
|
-
key:
|
|
2940
|
+
key: O.Quality,
|
|
2902
2941
|
value: { quality: t }
|
|
2903
2942
|
};
|
|
2904
2943
|
this.asset ? this.transformations = [...this.transformations, n] : this.upsertTransformation(n);
|
|
@@ -2910,15 +2949,15 @@ var Ut = Y, X, Wt = {
|
|
|
2910
2949
|
keepMetadata: t
|
|
2911
2950
|
}, !this.asset) {
|
|
2912
2951
|
t ? this.upsertTransformation({
|
|
2913
|
-
key:
|
|
2952
|
+
key: O.Metadata,
|
|
2914
2953
|
value: { keepMetadata: t }
|
|
2915
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2954
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== O.Metadata);
|
|
2916
2955
|
return;
|
|
2917
2956
|
}
|
|
2918
2957
|
t ? this.upsertTransformation({
|
|
2919
|
-
key:
|
|
2958
|
+
key: O.Metadata,
|
|
2920
2959
|
value: { keepMetadata: t }
|
|
2921
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
2960
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== O.Metadata);
|
|
2922
2961
|
}
|
|
2923
2962
|
onExtensionChange(e) {
|
|
2924
2963
|
let t = e.detail;
|
|
@@ -2928,14 +2967,14 @@ var Ut = Y, X, Wt = {
|
|
|
2928
2967
|
};
|
|
2929
2968
|
}
|
|
2930
2969
|
syncQuality() {
|
|
2931
|
-
let e = this.transformations.findLast((e) => e.key ===
|
|
2970
|
+
let e = this.transformations.findLast((e) => e.key === O.Quality)?.value?.quality;
|
|
2932
2971
|
this.selectedFormat &&= {
|
|
2933
2972
|
...this.selectedFormat,
|
|
2934
2973
|
quality: e ?? 100
|
|
2935
2974
|
};
|
|
2936
2975
|
}
|
|
2937
2976
|
syncSelectedDimensions(e = !0) {
|
|
2938
|
-
let t = this.transformations.findLast((e) => e.key ===
|
|
2977
|
+
let t = this.transformations.findLast((e) => e.key === O.Dimensions), n = Z.getDimensionsSize(this.selectedDimensions);
|
|
2939
2978
|
if (!t) {
|
|
2940
2979
|
n && (this.selectedDimensions = void 0);
|
|
2941
2980
|
return;
|
|
@@ -2943,21 +2982,21 @@ var Ut = Y, X, Wt = {
|
|
|
2943
2982
|
let r = Math.round(t.value.width ?? 0), i = Math.round(t.value.height ?? 0);
|
|
2944
2983
|
if (e && n?.width === r && n.height === i) return;
|
|
2945
2984
|
let a = this.dimensionsItems.find((e) => {
|
|
2946
|
-
let t =
|
|
2985
|
+
let t = Z.getDimensionsPresetSize(e.value);
|
|
2947
2986
|
return !e.disabled && t?.width === r && t.height === i;
|
|
2948
2987
|
});
|
|
2949
2988
|
this.selectedDimensions = a ? {
|
|
2950
|
-
mode:
|
|
2989
|
+
mode: D.Preset,
|
|
2951
2990
|
value: a.value
|
|
2952
2991
|
} : {
|
|
2953
2992
|
height: i,
|
|
2954
|
-
mode:
|
|
2955
|
-
unit:
|
|
2993
|
+
mode: D.Custom,
|
|
2994
|
+
unit: A.Pixel,
|
|
2956
2995
|
width: r
|
|
2957
2996
|
};
|
|
2958
2997
|
}
|
|
2959
2998
|
get hasResettableState() {
|
|
2960
|
-
let e =
|
|
2999
|
+
let e = Kt.filter((e) => this.activeParts.includes(e));
|
|
2961
3000
|
return this.canReorder && this.activeParts.some((t, n) => t !== e[n]) || this.transformations.length > 0 ? !0 : this.canAutoFormat && !this.autoFormat;
|
|
2962
3001
|
}
|
|
2963
3002
|
clearResetSnapshot() {
|
|
@@ -2977,21 +3016,21 @@ var Ut = Y, X, Wt = {
|
|
|
2977
3016
|
let e = !!this.defaultProxy && !!this.proxies?.some((e) => e.id === this.defaultProxy);
|
|
2978
3017
|
this.selectedProxy = e ? this.defaultProxy : this.selectedProxy || this.proxies?.[0]?.id || "";
|
|
2979
3018
|
}
|
|
2980
|
-
this.transformations = [], this.canReorder && (this.parts =
|
|
3019
|
+
this.transformations = [], this.canReorder && (this.parts = Kt.filter((e) => this.activeParts.includes(e)), this.emitReorder()), this.frozenIndex = -1, this.syncQuality();
|
|
2981
3020
|
}
|
|
2982
3021
|
onDimensionsChange(e) {
|
|
2983
3022
|
e.stopPropagation();
|
|
2984
|
-
let t =
|
|
2985
|
-
this.clearResetSnapshot(), this.lastAction =
|
|
2986
|
-
key:
|
|
3023
|
+
let t = Z.getDimensionsSize(e.detail);
|
|
3024
|
+
this.clearResetSnapshot(), this.lastAction = O.Dimensions, this.selectedDimensions = { ...e.detail }, t ? this.upsertTransformation({
|
|
3025
|
+
key: O.Dimensions,
|
|
2987
3026
|
value: t
|
|
2988
|
-
}) : this.transformations = this.transformations.filter((e) => e.key !==
|
|
3027
|
+
}) : this.transformations = this.transformations.filter((e) => e.key !== O.Dimensions), this.capCropToMaxSize();
|
|
2989
3028
|
}
|
|
2990
3029
|
onCropToggle(e) {
|
|
2991
|
-
e.stopPropagation(), this.clearResetSnapshot(), this.cropEnabled = e.currentTarget.checked, this.cropEnabled || (this.transformations = this.transformations.filter((e) => e.key !==
|
|
3030
|
+
e.stopPropagation(), this.clearResetSnapshot(), this.cropEnabled = e.currentTarget.checked, this.cropEnabled || (this.transformations = this.transformations.filter((e) => e.key !== O.Crop)), this.emit("cx-asset-link-format-crop-toggle", { detail: this.cropEnabled });
|
|
2992
3031
|
}
|
|
2993
3032
|
renderDimensionsPart() {
|
|
2994
|
-
return e`<cx-asset-link-format-dimensions class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ?
|
|
3033
|
+
return e`<cx-asset-link-format-dimensions class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ? N.Automatic : N.Manual} .inline=${this.isFormatsLayout} ?open=${this.activeSetting === "cx-asset-link-format-dimensions"} ?loading=${this.loading} .items=${this.dimensionsItems} .value=${this.selectedDimensions} ?can-custom=${this.canCustomDimensions} @cx-asset-link-format-dimensions-change=${this.onDimensionsChange}></cx-asset-link-format-dimensions>`;
|
|
2995
3034
|
}
|
|
2996
3035
|
renderHeader() {
|
|
2997
3036
|
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);
|
|
@@ -3000,42 +3039,42 @@ var Ut = Y, X, Wt = {
|
|
|
3000
3039
|
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>`);
|
|
3001
3040
|
}
|
|
3002
3041
|
renderProxyPart() {
|
|
3003
|
-
return e`<cx-asset-link-format-proxy class="asset-link-format__details" value=${this.selectedProxy || this.proxies?.[0]?.id || ""} ?open=${this.activeSetting === "cx-asset-link-format-proxy"} ?auto-format=${this.autoFormat} ?can-auto-format=${this.canAutoFormat} .items=${this.formats} ?loading=${this.loading && this.lastAction ===
|
|
3042
|
+
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 === O.Proxy} @cx-asset-link-format-proxy-change=${this.onProxyChange}></cx-asset-link-format-proxy>`;
|
|
3004
3043
|
}
|
|
3005
3044
|
renderCropEditor(t) {
|
|
3006
|
-
let n = this.asset ? this.lastResizeSize[
|
|
3007
|
-
return e`<cx-asset-link-format-crop class="asset-link-format__details" .inline=${t} ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction ===
|
|
3045
|
+
let n = this.asset ? this.lastResizeSize[k.Pixel] : this.cropMaxSize;
|
|
3046
|
+
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 === O.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.cropModes} .focusModes=${this.focusModes} @cx-asset-link-format-crop-mode-change=${this.onCropModeChange} @cx-asset-link-format-crop-focus-mode-change=${this.onCropFocusModeChange} @cx-asset-link-format-crop-position-change=${this.onCropPositionChange} @cx-asset-link-format-crop-change=${this.onCropChange} @cx-asset-link-format-crop-changed=${this.onCropChanged} @cx-asset-link-format-crop-apply=${this.onCropApply}></cx-asset-link-format-crop>`;
|
|
3008
3047
|
}
|
|
3009
3048
|
renderCropPart() {
|
|
3010
|
-
return this.isFormatsLayout ? e`<div class="asset-link-format__formats-crop"><cx-space class="asset-link-format__formats-summary" align-items="center" justify-content="space-between"><cx-space align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="
|
|
3049
|
+
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);
|
|
3011
3050
|
}
|
|
3012
3051
|
renderResizePart() {
|
|
3013
|
-
return e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction ===
|
|
3052
|
+
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 === O.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>`;
|
|
3014
3053
|
}
|
|
3015
3054
|
renderRotatePart() {
|
|
3016
|
-
return e`<cx-asset-link-format-rotation class="asset-link-format__details" .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction ===
|
|
3055
|
+
return e`<cx-asset-link-format-rotation class="asset-link-format__details" .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction === O.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>`;
|
|
3017
3056
|
}
|
|
3018
3057
|
renderQualityPart() {
|
|
3019
|
-
return e`<cx-asset-link-format-quality class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ?
|
|
3058
|
+
return e`<cx-asset-link-format-quality class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ? N.Automatic : N.Manual} .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction === O.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>`;
|
|
3020
3059
|
}
|
|
3021
3060
|
renderMetadataPart() {
|
|
3022
3061
|
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>`;
|
|
3023
3062
|
}
|
|
3024
3063
|
renderPart(e) {
|
|
3025
3064
|
switch (e) {
|
|
3026
|
-
case
|
|
3027
|
-
case
|
|
3028
|
-
case
|
|
3029
|
-
case
|
|
3030
|
-
case
|
|
3031
|
-
case
|
|
3032
|
-
case
|
|
3065
|
+
case j.Dimensions: return this.renderDimensionsPart();
|
|
3066
|
+
case j.Proxy: return this.renderProxyPart();
|
|
3067
|
+
case j.Crop: return this.renderCropPart();
|
|
3068
|
+
case j.Resize: return this.renderResizePart();
|
|
3069
|
+
case j.Rotate: return this.renderRotatePart();
|
|
3070
|
+
case j.Quality: return this.renderQualityPart();
|
|
3071
|
+
case j.Metadata: return this.renderMetadataPart();
|
|
3033
3072
|
default: return n;
|
|
3034
3073
|
}
|
|
3035
3074
|
}
|
|
3036
3075
|
render() {
|
|
3037
3076
|
return e`<div class="asset-link-format ${this.isFormatsLayout ? "asset-link-format--formats" : ""}" @cx-show=${this.onDetailsShow} @cx-hide=${this.onDetailsHide}>${this.renderHeader()}
|
|
3038
|
-
${this.renderOrderHint()}<div class="asset-link-format__panels">${
|
|
3077
|
+
${this.renderOrderHint()}<div class="asset-link-format__panels">${S(this.activeParts, (e) => e, (t) => e`<div class="asset-link-format__panel" data-part=${t} ?data-reorderable=${this.canReorder && Q.includes(t)}>${m(this.canReorder && Q.includes(t), () => e`<cx-icon-button class="asset-link-format__drag-handle" name="drag_indicator" label=${this.localize.term("reorderTransformation", this.localize.term(t))} ?disabled=${this.loading} @keydown=${this.handleReorderKeyDown}></cx-icon-button>`)}
|
|
3039
3078
|
${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>`;
|
|
3040
3079
|
}
|
|
3041
3080
|
};
|
|
@@ -3153,7 +3192,7 @@ a([r({
|
|
|
3153
3192
|
o("design:type", Function),
|
|
3154
3193
|
o("design:paramtypes", []),
|
|
3155
3194
|
o("design:returntype", void 0)
|
|
3156
|
-
], $.prototype, "handleReorderableChange", null), $ =
|
|
3157
|
-
var
|
|
3195
|
+
], $.prototype, "handleReorderableChange", null), $ = Z = a([u("cx-asset-link-format"), o("design:paramtypes", [])], $);
|
|
3196
|
+
var qt = $;
|
|
3158
3197
|
//#endregion
|
|
3159
|
-
export { ct as C, ht as S, Ae as T, qe as _, Ze as a, ft as b,
|
|
3198
|
+
export { ct as C, ht as S, Ae as T, qe as _, Ze as a, ft as b, I as c, Qe as d, We as f, Ke as g, L as h, xt as i, He as l, $e as m, wt as n, Be as o, Ge as p, St as r, F as s, qt as t, Ue as u, Je as v, je as w, _t as x, gt as y };
|