@orangelogic/design-system 2.88.0 → 2.89.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/components/asset-link-format.js +151 -138
- package/library/components/drawer.js +55 -50
- package/library/components/menu.js +25 -24
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/drawer/drawer.d.ts +1 -0
- package/library/packages/atoms/src/components/menu/menu.d.ts +2 -1
- package/library/packages/types/src/menu.d.ts +4 -0
- package/library/react-web-component.d.ts +2 -2
- package/package.json +1 -1
|
@@ -37,26 +37,39 @@ function J({
|
|
|
37
37
|
useSession: h = ""
|
|
38
38
|
}) {
|
|
39
39
|
let r = e;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(v) => v.key === c.Quality
|
|
40
|
+
const y = a?.findLast(
|
|
41
|
+
(x) => x.key === c.Quality
|
|
43
42
|
);
|
|
44
|
-
|
|
43
|
+
if (y && (a = [
|
|
45
44
|
...a?.filter(
|
|
46
|
-
(
|
|
45
|
+
(x) => x.key !== c.Quality
|
|
47
46
|
) || [],
|
|
48
|
-
|
|
49
|
-
]), a
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
y
|
|
48
|
+
]), a) {
|
|
49
|
+
const x = [];
|
|
50
|
+
for (let g = 0; g < a.length; g++) {
|
|
51
|
+
const m = a[g];
|
|
52
|
+
if (m.key === c.Rotate) {
|
|
53
|
+
let n = m.value.rotation ?? 0;
|
|
54
|
+
for (; a[g + 1]?.key === c.Rotate; )
|
|
55
|
+
g++, n += a[g].value.rotation ?? 0;
|
|
56
|
+
n !== 0 && x.push({ key: c.Rotate, value: { rotation: n } });
|
|
57
|
+
} else
|
|
58
|
+
x.push(m);
|
|
59
|
+
}
|
|
60
|
+
a = x;
|
|
61
|
+
}
|
|
62
|
+
a && a.length > 0 && (r += "/t/"), a?.forEach(({ key: x, value: g }) => {
|
|
63
|
+
if (x === c.Resize) {
|
|
64
|
+
const m = [
|
|
52
65
|
...[
|
|
53
66
|
{
|
|
54
67
|
key: "re_w_",
|
|
55
|
-
value: Math.round(
|
|
68
|
+
value: Math.round(g.width ?? 0)
|
|
56
69
|
},
|
|
57
70
|
{
|
|
58
71
|
key: "re_h_",
|
|
59
|
-
value: Math.round(
|
|
72
|
+
value: Math.round(g.height ?? 0)
|
|
60
73
|
}
|
|
61
74
|
].filter((n) => n.value !== void 0).map((n) => ({
|
|
62
75
|
key: n.key,
|
|
@@ -67,33 +80,33 @@ function J({
|
|
|
67
80
|
value: "stretch"
|
|
68
81
|
}
|
|
69
82
|
];
|
|
70
|
-
|
|
71
|
-
r += `${n}${$}${B <
|
|
83
|
+
m.forEach(({ key: n, value: $ }, B) => {
|
|
84
|
+
r += `${n}${$}${B < m.length - 1 ? "," : ""}`;
|
|
72
85
|
}), r += "/";
|
|
73
86
|
}
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
87
|
+
if (x === c.Crop) {
|
|
88
|
+
const m = [
|
|
76
89
|
...[
|
|
77
90
|
{
|
|
78
91
|
key: "c_",
|
|
79
|
-
value:
|
|
92
|
+
value: g.mode
|
|
80
93
|
},
|
|
81
|
-
...
|
|
94
|
+
...g.disabledSize ? [] : [
|
|
82
95
|
{
|
|
83
96
|
key: "c_w_",
|
|
84
|
-
value: Math.round(
|
|
97
|
+
value: Math.round(g.width ?? 0)
|
|
85
98
|
},
|
|
86
99
|
{
|
|
87
100
|
key: "c_h_",
|
|
88
|
-
value: Math.round(
|
|
101
|
+
value: Math.round(g.height ?? 0)
|
|
89
102
|
},
|
|
90
103
|
{
|
|
91
104
|
key: "c_x_",
|
|
92
|
-
value: Math.round(
|
|
105
|
+
value: Math.round(g.x ?? 0)
|
|
93
106
|
},
|
|
94
107
|
{
|
|
95
108
|
key: "c_y_",
|
|
96
|
-
value: Math.round(
|
|
109
|
+
value: Math.round(g.y ?? 0)
|
|
97
110
|
}
|
|
98
111
|
]
|
|
99
112
|
].filter((n) => n.value !== void 0 && n.value !== null).map((n) => ({
|
|
@@ -105,56 +118,56 @@ function J({
|
|
|
105
118
|
value: "pixel"
|
|
106
119
|
}
|
|
107
120
|
];
|
|
108
|
-
|
|
121
|
+
m.forEach(({ key: n, value: $ }, B) => {
|
|
109
122
|
const ot = ["c_w_", "c_h_", "c_x_", "c_y_"].includes(n);
|
|
110
|
-
r += `${n}${ot ? Math.round(Number($)) : $}${B <
|
|
123
|
+
r += `${n}${ot ? Math.round(Number($)) : $}${B < m.length - 1 ? "," : ""}`;
|
|
111
124
|
}), r += "/";
|
|
112
125
|
}
|
|
113
|
-
if (
|
|
126
|
+
if (x === c.Rotate && ([
|
|
114
127
|
{
|
|
115
128
|
key: "r_a_",
|
|
116
|
-
value:
|
|
129
|
+
value: g.rotation
|
|
117
130
|
}
|
|
118
131
|
].filter((n) => n.value !== void 0).map((n) => ({
|
|
119
132
|
key: n.key,
|
|
120
133
|
value: Math.round(Number(n.value))
|
|
121
134
|
})).forEach(({ key: n, value: $ }) => {
|
|
122
135
|
r += `${n}${$}`;
|
|
123
|
-
}), r += "/"),
|
|
124
|
-
const
|
|
136
|
+
}), r += "/"), x === c.Quality) {
|
|
137
|
+
const m = [
|
|
125
138
|
{
|
|
126
139
|
key: "q_level_",
|
|
127
|
-
value:
|
|
140
|
+
value: g.quality
|
|
128
141
|
}
|
|
129
142
|
].filter((n) => n.value !== void 0).map((n) => ({
|
|
130
143
|
key: n.key,
|
|
131
144
|
value: Math.round(Number(n.value))
|
|
132
145
|
}));
|
|
133
|
-
|
|
134
|
-
r += `${n}${$}${B <
|
|
146
|
+
m.forEach(({ key: n, value: $ }, B) => {
|
|
147
|
+
r += `${n}${$}${B < m.length - 1 ? "," : ""}`;
|
|
135
148
|
}), r += "/";
|
|
136
149
|
}
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
150
|
+
if (x === c.Metadata) {
|
|
151
|
+
const m = [
|
|
139
152
|
{
|
|
140
153
|
key: "fl_keep_metadata",
|
|
141
|
-
value:
|
|
154
|
+
value: g.keepMetadata
|
|
142
155
|
}
|
|
143
156
|
].filter((n) => n.value !== void 0).map((n) => ({ key: n.key, value: n.value }));
|
|
144
|
-
|
|
145
|
-
r += `${n}${$ <
|
|
157
|
+
m.forEach(({ key: n }, $) => {
|
|
158
|
+
r += `${n}${$ < m.length - 1 ? "," : ""}`;
|
|
146
159
|
}), r += "/";
|
|
147
160
|
}
|
|
148
161
|
}), i && (r += `${t?.identifier}${i}`);
|
|
149
|
-
const
|
|
150
|
-
return s && s.length > 0 && s.forEach(({ key:
|
|
151
|
-
|
|
152
|
-
`${encodeURIComponent(
|
|
162
|
+
const w = [];
|
|
163
|
+
return s && s.length > 0 && s.forEach(({ key: x, value: g }) => {
|
|
164
|
+
w.push(
|
|
165
|
+
`${encodeURIComponent(x.trim())}=${encodeURIComponent(g.trim())}`
|
|
153
166
|
);
|
|
154
|
-
}),
|
|
167
|
+
}), w.length > 0 && (r += `?${w.join("&")}`), r.endsWith("/") && (r = r.slice(0, -1)), r;
|
|
155
168
|
}
|
|
156
169
|
const gt = D`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}`;
|
|
157
|
-
var mt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor,
|
|
170
|
+
var mt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, f = (t, e, i, s) => {
|
|
158
171
|
for (var a = s > 1 ? void 0 : s ? xt(e, i) : e, h = t.length - 1, r; h >= 0; h--)
|
|
159
172
|
(r = t[h]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
160
173
|
return s && a && mt(e, i, a), a;
|
|
@@ -428,82 +441,82 @@ u.dependencies = {
|
|
|
428
441
|
"cx-space": H,
|
|
429
442
|
"cx-typography": W
|
|
430
443
|
};
|
|
431
|
-
|
|
444
|
+
f([
|
|
432
445
|
T(".details")
|
|
433
446
|
], u.prototype, "base", 2);
|
|
434
|
-
|
|
447
|
+
f([
|
|
435
448
|
l({ reflect: !0, type: Boolean })
|
|
436
449
|
], u.prototype, "open", 2);
|
|
437
|
-
|
|
450
|
+
f([
|
|
438
451
|
l({ reflect: !0, type: Number })
|
|
439
452
|
], u.prototype, "width", 2);
|
|
440
|
-
|
|
453
|
+
f([
|
|
441
454
|
l({ reflect: !0, type: Number })
|
|
442
455
|
], u.prototype, "height", 2);
|
|
443
|
-
|
|
456
|
+
f([
|
|
444
457
|
l({ attribute: "max-width", reflect: !0, type: Number })
|
|
445
458
|
], u.prototype, "maxWidth", 2);
|
|
446
|
-
|
|
459
|
+
f([
|
|
447
460
|
l({ attribute: "max-height", reflect: !0, type: Number })
|
|
448
461
|
], u.prototype, "maxHeight", 2);
|
|
449
|
-
|
|
462
|
+
f([
|
|
450
463
|
l({ attribute: "ratio-width", reflect: !0, type: Number })
|
|
451
464
|
], u.prototype, "ratioWidth", 2);
|
|
452
|
-
|
|
465
|
+
f([
|
|
453
466
|
l({ attribute: "ratio-height", reflect: !0, type: Number })
|
|
454
467
|
], u.prototype, "ratioHeight", 2);
|
|
455
|
-
|
|
468
|
+
f([
|
|
456
469
|
l({ attribute: "percentage-width", reflect: !0, type: Number })
|
|
457
470
|
], u.prototype, "percentageWidth", 2);
|
|
458
|
-
|
|
471
|
+
f([
|
|
459
472
|
l({ attribute: "percentage-height", reflect: !0, type: Number })
|
|
460
473
|
], u.prototype, "percentageHeight", 2);
|
|
461
|
-
|
|
474
|
+
f([
|
|
462
475
|
l({ reflect: !0, type: String })
|
|
463
476
|
], u.prototype, "unit", 2);
|
|
464
|
-
|
|
477
|
+
f([
|
|
465
478
|
l({ attribute: "disabled-apply", reflect: !0, type: Boolean })
|
|
466
479
|
], u.prototype, "disabledApply", 2);
|
|
467
|
-
|
|
480
|
+
f([
|
|
468
481
|
l({ attribute: "last-applied-setting", reflect: !1, type: Object })
|
|
469
482
|
], u.prototype, "lastAppliedSetting", 2);
|
|
470
|
-
|
|
483
|
+
f([
|
|
471
484
|
l({ reflect: !0, type: Boolean })
|
|
472
485
|
], u.prototype, "loading", 2);
|
|
473
|
-
|
|
486
|
+
f([
|
|
474
487
|
l({ attribute: "crop-modes", reflect: !1, type: Array })
|
|
475
488
|
], u.prototype, "cropModes", 2);
|
|
476
|
-
|
|
489
|
+
f([
|
|
477
490
|
l({ attribute: "focus-modes", reflect: !1, type: Object })
|
|
478
491
|
], u.prototype, "focusModes", 2);
|
|
479
|
-
|
|
492
|
+
f([
|
|
480
493
|
l({ attribute: "focus-mode", reflect: !0, type: String })
|
|
481
494
|
], u.prototype, "focusMode", 2);
|
|
482
|
-
|
|
495
|
+
f([
|
|
483
496
|
l({ attribute: "crop-mode", reflect: !0, type: String })
|
|
484
497
|
], u.prototype, "cropMode", 2);
|
|
485
|
-
|
|
498
|
+
f([
|
|
486
499
|
l({ attribute: "keep-aspect-ratio", reflect: !0, type: Boolean })
|
|
487
500
|
], u.prototype, "keepAspectRatio", 2);
|
|
488
|
-
|
|
501
|
+
f([
|
|
489
502
|
z()
|
|
490
503
|
], u.prototype, "invalidWidth", 2);
|
|
491
|
-
|
|
504
|
+
f([
|
|
492
505
|
z()
|
|
493
506
|
], u.prototype, "invalidHeight", 2);
|
|
494
|
-
|
|
507
|
+
f([
|
|
495
508
|
z()
|
|
496
509
|
], u.prototype, "aspectRatio", 2);
|
|
497
|
-
|
|
510
|
+
f([
|
|
498
511
|
k("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
499
512
|
k("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
500
513
|
k("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
501
514
|
k("keepAspectRatio")
|
|
502
515
|
], u.prototype, "handleCropModeChange", 1);
|
|
503
|
-
|
|
516
|
+
f([
|
|
504
517
|
k("open")
|
|
505
518
|
], u.prototype, "handleOpenChange", 1);
|
|
506
|
-
u =
|
|
519
|
+
u = f([
|
|
507
520
|
N("cx-asset-link-format-crop")
|
|
508
521
|
], u);
|
|
509
522
|
const ft = D`.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%}}`;
|
|
@@ -738,7 +751,7 @@ var At = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, S = (t, e,
|
|
|
738
751
|
(r = t[h]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
739
752
|
return s && a && At(e, i, a), a;
|
|
740
753
|
};
|
|
741
|
-
let
|
|
754
|
+
let v = class extends F {
|
|
742
755
|
constructor() {
|
|
743
756
|
super(...arguments), this.localize = new O(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit = o.Pixel, this.lastAppliedSetting = {
|
|
744
757
|
[o.Pixel]: { height: 0, width: 0 },
|
|
@@ -885,8 +898,8 @@ let f = class extends F {
|
|
|
885
898
|
})} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
886
899
|
}
|
|
887
900
|
};
|
|
888
|
-
|
|
889
|
-
|
|
901
|
+
v.styles = [E, Ct];
|
|
902
|
+
v.dependencies = {
|
|
890
903
|
"cx-button": q,
|
|
891
904
|
"cx-details": L,
|
|
892
905
|
"cx-icon": j,
|
|
@@ -899,61 +912,61 @@ f.dependencies = {
|
|
|
899
912
|
};
|
|
900
913
|
S([
|
|
901
914
|
T(".details")
|
|
902
|
-
],
|
|
915
|
+
], v.prototype, "base", 2);
|
|
903
916
|
S([
|
|
904
917
|
l({ reflect: !0, type: Boolean })
|
|
905
|
-
],
|
|
918
|
+
], v.prototype, "open", 2);
|
|
906
919
|
S([
|
|
907
920
|
l({ reflect: !0, type: Number })
|
|
908
|
-
],
|
|
921
|
+
], v.prototype, "width", 2);
|
|
909
922
|
S([
|
|
910
923
|
l({ reflect: !0, type: Number })
|
|
911
|
-
],
|
|
924
|
+
], v.prototype, "height", 2);
|
|
912
925
|
S([
|
|
913
926
|
l({ attribute: "max-width", reflect: !0, type: Number })
|
|
914
|
-
],
|
|
927
|
+
], v.prototype, "maxWidth", 2);
|
|
915
928
|
S([
|
|
916
929
|
l({ attribute: "max-height", reflect: !0, type: Number })
|
|
917
|
-
],
|
|
930
|
+
], v.prototype, "maxHeight", 2);
|
|
918
931
|
S([
|
|
919
932
|
l({ attribute: "ratio-width", reflect: !0, type: Number })
|
|
920
|
-
],
|
|
933
|
+
], v.prototype, "ratioWidth", 2);
|
|
921
934
|
S([
|
|
922
935
|
l({ attribute: "ratio-height", reflect: !0, type: Number })
|
|
923
|
-
],
|
|
936
|
+
], v.prototype, "ratioHeight", 2);
|
|
924
937
|
S([
|
|
925
938
|
l({ reflect: !0, type: String })
|
|
926
|
-
],
|
|
939
|
+
], v.prototype, "unit", 2);
|
|
927
940
|
S([
|
|
928
941
|
l({ attribute: "last-applied-setting", reflect: !1, type: Object })
|
|
929
|
-
],
|
|
942
|
+
], v.prototype, "lastAppliedSetting", 2);
|
|
930
943
|
S([
|
|
931
944
|
l({ reflect: !0, type: Boolean })
|
|
932
|
-
],
|
|
945
|
+
], v.prototype, "loading", 2);
|
|
933
946
|
S([
|
|
934
947
|
l({ attribute: "keep-aspect-ratio", reflect: !0, type: Boolean })
|
|
935
|
-
],
|
|
948
|
+
], v.prototype, "keepAspectRatio", 2);
|
|
936
949
|
S([
|
|
937
950
|
z()
|
|
938
|
-
],
|
|
951
|
+
], v.prototype, "invalidWidth", 2);
|
|
939
952
|
S([
|
|
940
953
|
z()
|
|
941
|
-
],
|
|
954
|
+
], v.prototype, "invalidHeight", 2);
|
|
942
955
|
S([
|
|
943
956
|
z()
|
|
944
|
-
],
|
|
957
|
+
], v.prototype, "aspectRatio", 2);
|
|
945
958
|
S([
|
|
946
959
|
k("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
947
960
|
k("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
948
961
|
k("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
949
962
|
k("keepAspectRatio")
|
|
950
|
-
],
|
|
963
|
+
], v.prototype, "handleCropModeChange", 1);
|
|
951
964
|
S([
|
|
952
965
|
k("open")
|
|
953
|
-
],
|
|
954
|
-
|
|
966
|
+
], v.prototype, "handleOpenChange", 1);
|
|
967
|
+
v = S([
|
|
955
968
|
N("cx-asset-link-format-resize")
|
|
956
|
-
],
|
|
969
|
+
], v);
|
|
957
970
|
const Mt = D`cx-details::part(base){border-bottom-width:0}`;
|
|
958
971
|
var _t = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, V = (t, e, i, s) => {
|
|
959
972
|
for (var a = s > 1 ? void 0 : s ? Pt(e, i) : e, h = t.length - 1, r; h >= 0; h--)
|
|
@@ -1488,14 +1501,14 @@ let p = class extends F {
|
|
|
1488
1501
|
const i = this.proxies?.find((s) => s.id === t);
|
|
1489
1502
|
i && (this.asset && i.proxyName === "TRX" && (i.formatHeight = Number(this.asset.height), i.formatWidth = Number(this.asset.width)), this.transformations = this.transformations.map((s) => {
|
|
1490
1503
|
if (s.key === c.Crop) {
|
|
1491
|
-
const a = s.value, h = a.width / i.formatWidth * e.formatWidth, r = a.height / i.formatHeight * e.formatHeight,
|
|
1504
|
+
const a = s.value, h = a.width / i.formatWidth * e.formatWidth, r = a.height / i.formatHeight * e.formatHeight, y = a.x / i.formatWidth * e.formatWidth, w = a.y / i.formatHeight * e.formatHeight;
|
|
1492
1505
|
return {
|
|
1493
1506
|
...s,
|
|
1494
1507
|
value: {
|
|
1495
1508
|
height: r,
|
|
1496
1509
|
width: h,
|
|
1497
|
-
x:
|
|
1498
|
-
y
|
|
1510
|
+
x: y,
|
|
1511
|
+
y: w
|
|
1499
1512
|
}
|
|
1500
1513
|
};
|
|
1501
1514
|
}
|
|
@@ -1572,31 +1585,31 @@ let p = class extends F {
|
|
|
1572
1585
|
percentageHeight: a,
|
|
1573
1586
|
percentageWidth: h,
|
|
1574
1587
|
ratioHeight: r,
|
|
1575
|
-
ratioWidth:
|
|
1576
|
-
unit:
|
|
1577
|
-
useCropMode:
|
|
1578
|
-
width:
|
|
1588
|
+
ratioWidth: y,
|
|
1589
|
+
unit: w,
|
|
1590
|
+
useCropMode: x,
|
|
1591
|
+
width: g
|
|
1579
1592
|
}) {
|
|
1580
1593
|
if (!this.selectedFormat?.url || e === "manual")
|
|
1581
1594
|
return;
|
|
1582
1595
|
this.loading = !0, this.lastAction = c.Crop;
|
|
1583
|
-
const
|
|
1596
|
+
const m = await this.apiGetCropFocusMode({
|
|
1584
1597
|
autoCropMode: e,
|
|
1585
1598
|
cropHeight: i,
|
|
1586
|
-
cropWidth:
|
|
1599
|
+
cropWidth: g,
|
|
1587
1600
|
imageUrl: this.selectedFormat.url
|
|
1588
1601
|
});
|
|
1589
|
-
if (
|
|
1602
|
+
if (m) {
|
|
1590
1603
|
let n = a, $ = h;
|
|
1591
|
-
i || (n =
|
|
1604
|
+
i || (n = m.height * 100 / this.selectedFormat.height), g || ($ = m.width * 100 / this.selectedFormat.width), this.cropSize = {
|
|
1592
1605
|
...this.cropSize,
|
|
1593
|
-
height:
|
|
1606
|
+
height: m.height,
|
|
1594
1607
|
percentageHeight: n ?? this.cropSize.percentageHeight,
|
|
1595
1608
|
percentageWidth: $ ?? this.cropSize.percentageWidth,
|
|
1596
|
-
width:
|
|
1597
|
-
x:
|
|
1598
|
-
y:
|
|
1599
|
-
...
|
|
1609
|
+
width: m.width,
|
|
1610
|
+
x: m.x * 100 / this.selectedFormat.width,
|
|
1611
|
+
y: m.y * 100 / this.selectedFormat.height,
|
|
1612
|
+
...x ? {
|
|
1600
1613
|
cropMode: e,
|
|
1601
1614
|
focusMode: "manual",
|
|
1602
1615
|
keepAspectRatio: !1
|
|
@@ -1606,8 +1619,8 @@ let p = class extends F {
|
|
|
1606
1619
|
},
|
|
1607
1620
|
keepAspectRatio: s ?? this.cropSize.keepAspectRatio,
|
|
1608
1621
|
ratioHeight: r ?? this.cropSize.ratioHeight,
|
|
1609
|
-
ratioWidth:
|
|
1610
|
-
unit:
|
|
1622
|
+
ratioWidth: y ?? this.cropSize.ratioWidth,
|
|
1623
|
+
unit: w ?? this.cropSize.unit
|
|
1611
1624
|
};
|
|
1612
1625
|
}
|
|
1613
1626
|
this.loading = !1, this.lastAction = void 0;
|
|
@@ -1618,26 +1631,26 @@ let p = class extends F {
|
|
|
1618
1631
|
width: s,
|
|
1619
1632
|
x: a,
|
|
1620
1633
|
y: h
|
|
1621
|
-
} = e, r = this.cropSize.percentageWidth !== s,
|
|
1622
|
-
let
|
|
1623
|
-
r && (
|
|
1634
|
+
} = e, r = this.cropSize.percentageWidth !== s, y = this.cropSize.percentageHeight !== i;
|
|
1635
|
+
let w = this.cropSize.height, x = this.cropSize.width;
|
|
1636
|
+
r && (x = Math.round(s * this.selectedFormat.width / 100)), y && (w = Math.round(
|
|
1624
1637
|
i * this.selectedFormat.height / 100
|
|
1625
1638
|
));
|
|
1626
|
-
const
|
|
1639
|
+
const g = this.cropSize.focusMode;
|
|
1627
1640
|
this.focusModes.find(
|
|
1628
|
-
(n) => n.value ===
|
|
1641
|
+
(n) => n.value === g
|
|
1629
1642
|
)?.auto && this.selectedFormat?.url && this.cropperElement ? await this.handleRequestAutoCropSuggestion({
|
|
1630
|
-
focusMode:
|
|
1631
|
-
height:
|
|
1643
|
+
focusMode: g,
|
|
1644
|
+
height: w,
|
|
1632
1645
|
percentageHeight: i,
|
|
1633
1646
|
percentageWidth: s,
|
|
1634
|
-
width:
|
|
1647
|
+
width: x
|
|
1635
1648
|
}) : this.cropSize = {
|
|
1636
1649
|
...this.cropSize,
|
|
1637
|
-
height:
|
|
1650
|
+
height: w,
|
|
1638
1651
|
percentageHeight: i,
|
|
1639
1652
|
percentageWidth: s,
|
|
1640
|
-
width:
|
|
1653
|
+
width: x,
|
|
1641
1654
|
x: a,
|
|
1642
1655
|
y: h
|
|
1643
1656
|
};
|
|
@@ -1673,10 +1686,10 @@ let p = class extends F {
|
|
|
1673
1686
|
});
|
|
1674
1687
|
else {
|
|
1675
1688
|
const s = this.focusModes.find(
|
|
1676
|
-
(
|
|
1689
|
+
(w) => w.value === this.cropSize.focusMode
|
|
1677
1690
|
)?.auto;
|
|
1678
|
-
let a = this.cropSize.keepAspectRatio, h = this.cropSize.focusMode, r = this.cropSize.x,
|
|
1679
|
-
e === "free" ? (a = !1, h = "manual") : this.cropSize.unit === o.Pixel && !s && (r = 0,
|
|
1691
|
+
let a = this.cropSize.keepAspectRatio, h = this.cropSize.focusMode, r = this.cropSize.x, y = this.cropSize.y;
|
|
1692
|
+
e === "free" ? (a = !1, h = "manual") : this.cropSize.unit === o.Pixel && !s && (r = 0, y = 0), s ? await this.handleRequestAutoCropSuggestion({
|
|
1680
1693
|
cropMode: e,
|
|
1681
1694
|
focusMode: h,
|
|
1682
1695
|
height: this.cropSize.height,
|
|
@@ -1688,7 +1701,7 @@ let p = class extends F {
|
|
|
1688
1701
|
focusMode: h,
|
|
1689
1702
|
keepAspectRatio: a,
|
|
1690
1703
|
x: r,
|
|
1691
|
-
y
|
|
1704
|
+
y
|
|
1692
1705
|
};
|
|
1693
1706
|
}
|
|
1694
1707
|
}
|
|
@@ -1713,14 +1726,14 @@ let p = class extends F {
|
|
|
1713
1726
|
Math.max(Math.round(s / i), 0),
|
|
1714
1727
|
this.resizeSize.height
|
|
1715
1728
|
), h = a * 100 / this.selectedFormat.height, r = s * 100 / this.selectedFormat.width;
|
|
1716
|
-
let
|
|
1717
|
-
|
|
1718
|
-
let
|
|
1729
|
+
let y = this.cropSize.x, w = this.cropSize.y;
|
|
1730
|
+
y + r > 100 && (y = 100 - r), w + h > 100 && (w = 100 - h);
|
|
1731
|
+
let x = this.cropSize.cropMode;
|
|
1719
1732
|
this.cropModes.find(
|
|
1720
|
-
(
|
|
1721
|
-
)?.auto && (
|
|
1733
|
+
(m) => m.value === x
|
|
1734
|
+
)?.auto && (x = "free"), t.detail.silent ? (this.cropSize.height = a, this.cropSize.keepAspectRatio = t.detail.keepAspectRatio, this.cropSize.percentageHeight = h, this.cropSize.percentageWidth = r, this.cropSize.ratioHeight = t.detail.height, this.cropSize.ratioWidth = t.detail.width, this.cropSize.unit = o.AspectRatio, this.cropSize.width = s) : this.cropSize = {
|
|
1722
1735
|
...this.cropSize,
|
|
1723
|
-
cropMode:
|
|
1736
|
+
cropMode: x,
|
|
1724
1737
|
height: a,
|
|
1725
1738
|
keepAspectRatio: t.detail.keepAspectRatio,
|
|
1726
1739
|
percentageHeight: h,
|
|
@@ -1729,18 +1742,18 @@ let p = class extends F {
|
|
|
1729
1742
|
ratioWidth: t.detail.width,
|
|
1730
1743
|
unit: o.AspectRatio,
|
|
1731
1744
|
width: s,
|
|
1732
|
-
x:
|
|
1733
|
-
y
|
|
1745
|
+
x: y,
|
|
1746
|
+
y: w
|
|
1734
1747
|
};
|
|
1735
1748
|
} else {
|
|
1736
1749
|
const i = this.selectedFormat ? t.detail.height * 100 / this.selectedFormat.height : 100, s = this.selectedFormat ? t.detail.width * 100 / this.selectedFormat.width : 100;
|
|
1737
1750
|
let a = this.cropSize.x, h = this.cropSize.y;
|
|
1738
1751
|
a + s > 100 && (a = 100 - s), h + i > 100 && (h = 100 - i);
|
|
1739
1752
|
let r = this.cropSize.cropMode;
|
|
1740
|
-
const
|
|
1741
|
-
(
|
|
1753
|
+
const y = this.cropModes.find(
|
|
1754
|
+
(w) => w.value === r
|
|
1742
1755
|
)?.auto;
|
|
1743
|
-
(t.detail.breakAspectRatio ||
|
|
1756
|
+
(t.detail.breakAspectRatio || y) && (r = "free"), t.detail.silent ? (this.cropSize.cropMode = r, this.cropSize.height = t.detail.height, this.cropSize.keepAspectRatio = t.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = s, this.cropSize.unit = o.Pixel, this.cropSize.width = t.detail.width, this.cropSize.x = a, this.cropSize.y = h) : this.cropSize = {
|
|
1744
1757
|
...this.cropSize,
|
|
1745
1758
|
cropMode: r,
|
|
1746
1759
|
height: t.detail.height,
|
|
@@ -1785,7 +1798,7 @@ let p = class extends F {
|
|
|
1785
1798
|
}
|
|
1786
1799
|
];
|
|
1787
1800
|
else {
|
|
1788
|
-
const
|
|
1801
|
+
const y = this.cropSize.x / 100 * this.selectedFormat.width, w = this.cropSize.y / 100 * this.selectedFormat.height;
|
|
1789
1802
|
this.transformations = [
|
|
1790
1803
|
...this.transformations,
|
|
1791
1804
|
{
|
|
@@ -1794,8 +1807,8 @@ let p = class extends F {
|
|
|
1794
1807
|
height: r,
|
|
1795
1808
|
unit: s,
|
|
1796
1809
|
width: h,
|
|
1797
|
-
x:
|
|
1798
|
-
y
|
|
1810
|
+
x: y,
|
|
1811
|
+
y: w
|
|
1799
1812
|
}
|
|
1800
1813
|
}
|
|
1801
1814
|
];
|
|
@@ -1840,13 +1853,13 @@ let p = class extends F {
|
|
|
1840
1853
|
const { height: e, unit: i, width: s } = t.detail;
|
|
1841
1854
|
this.lastAction = c.Resize;
|
|
1842
1855
|
const a = this.selectedFormat.width || this.defaultSize.width, h = this.selectedFormat.height || this.defaultSize.height;
|
|
1843
|
-
let r = s,
|
|
1844
|
-
this.resizeSize.unit !== i ? (r = a,
|
|
1856
|
+
let r = s, y = e;
|
|
1857
|
+
this.resizeSize.unit !== i ? (r = a, y = h) : i === o.AspectRatio && (r = Math.round(s / e * h), y = h), this.transformations = [
|
|
1845
1858
|
...this.transformations,
|
|
1846
1859
|
{
|
|
1847
1860
|
key: c.Resize,
|
|
1848
1861
|
value: {
|
|
1849
|
-
height:
|
|
1862
|
+
height: y,
|
|
1850
1863
|
unit: i,
|
|
1851
1864
|
width: r
|
|
1852
1865
|
}
|
|
@@ -1942,7 +1955,7 @@ p.dependencies = {
|
|
|
1942
1955
|
"cx-asset-link-format-metadata": P,
|
|
1943
1956
|
"cx-asset-link-format-proxy": C,
|
|
1944
1957
|
"cx-asset-link-format-quality": A,
|
|
1945
|
-
"cx-asset-link-format-resize":
|
|
1958
|
+
"cx-asset-link-format-resize": v,
|
|
1946
1959
|
"cx-asset-link-format-rotation": R,
|
|
1947
1960
|
"cx-button": q,
|
|
1948
1961
|
"cx-space": H,
|
|
@@ -5,23 +5,23 @@ import { c as z } from "../chunks/custom-element.L4WJXn1j.js";
|
|
|
5
5
|
import { w as v } from "../chunks/event.mFzZi4sr.js";
|
|
6
6
|
import { L as O } from "../chunks/i18n.CgwQHLcP.js";
|
|
7
7
|
import { M as $ } from "../chunks/modal.U1QltQKe.js";
|
|
8
|
-
import { l as m, u
|
|
8
|
+
import { l as m, u } from "../chunks/scroll.xtO5yojm.js";
|
|
9
9
|
import { H as B } from "../chunks/slot.j5oheLJC.js";
|
|
10
10
|
import { w as _ } from "../chunks/watch.BCJD77bD.js";
|
|
11
11
|
import { i as P, x as y } from "../chunks/lit-element.jLBm65_O.js";
|
|
12
12
|
import { r as S } from "../chunks/state.CSDxrqLd.js";
|
|
13
|
-
import { e as
|
|
13
|
+
import { e as w } from "../chunks/query.BBf1UFkC.js";
|
|
14
14
|
import { e as g } from "../chunks/class-map.BiVq-cVR.js";
|
|
15
15
|
import { o as b } from "../chunks/if-defined.BRoBj_Rp.js";
|
|
16
16
|
import { n as A } from "../chunks/when.Dr1es41R.js";
|
|
17
17
|
import { c as x } from "../chunks/capitalize.CNStXZBq.js";
|
|
18
|
-
import { s as
|
|
18
|
+
import { s as r, g as c } from "../chunks/animation-registry.HmpwNuGH.js";
|
|
19
19
|
import { C as q } from "../chunks/icon-button.BpwPU4Vg.js";
|
|
20
20
|
const D = P`:host{--size:25rem;--header-spacing:var(--cx-spacing-large);--body-spacing:var(--cx-spacing-large);--footer-spacing:var(--cx-spacing-large);--font-family:var(--cx-font-sans);display:contents}.drawer{top:0;pointer-events:none;width:0;height:0;inset-inline-start:0;overflow:hidden}.drawer--open{width:100%;height:100%}.drawer--persistent.drawer--open{width:var(--size);min-width:var(--size)}.drawer--contained{z-index:initial;position:absolute}.drawer--persistent{position:relative}.drawer--fixed{z-index:var(--cx-z-index-drawer);position:fixed}.drawer__panel{z-index:2;background-color:var(--cx-panel-background-color);max-width:100%;max-height:100%;box-shadow:var(--cx-shadow-large);pointer-events:all;flex-direction:column;display:flex;position:absolute;overflow:auto}.drawer__panel:focus{outline:none}.drawer--top .drawer__panel{top:0;inset-inline-end:auto;bottom:auto;width:100%;height:var(--size);inset-inline-start:0}.drawer--end .drawer__panel{top:0;inset-inline-end:0;bottom:auto;width:var(--size);height:100%;inset-inline-start:auto}.drawer--bottom .drawer__panel{top:auto;inset-inline-end:auto;bottom:0;width:100%;height:var(--size);inset-inline-start:0}.drawer--start .drawer__panel{top:0;inset-inline-end:auto;bottom:auto;width:var(--size);height:100%;inset-inline-start:0}.drawer__header{gap:var(--cx-spacing-small);padding:var(--header-spacing);border-bottom:solid 1px var(--cx-input-border-color);font-family:var(--font-family);display:flex}.drawer__title{font:inherit;font-size:var(--cx-font-size-large);font-weight:var(--cx-font-weight-semibold);line-height:var(--cx-line-height-medium);flex:auto;align-items:center;margin:0;display:flex}.drawer__header-actions{justify-content:end;gap:var(--cx-spacing-2x-small);flex-wrap:wrap;flex-shrink:0;display:flex}.drawer__header-actions cx-icon-button,.drawer__header-actions ::slotted(cx-icon-button){font-size:var(--cx-font-size-medium);flex:none;align-items:center;display:flex}.drawer__body{padding:var(--body-spacing);-webkit-overflow-scrolling:touch;font-family:var(--font-family);flex:auto;display:block;overflow:auto}.drawer__footer{text-align:right;padding:var(--footer-spacing);font-family:var(--font-family)}.drawer__footer ::slotted(cx-button:not(:last-of-type)){margin-inline-end:var(--cx-spacing-x-small)}.drawer:not(.drawer--has-footer) .drawer__footer{display:none}.drawer__overlay{background-color:var(--cx-overlay-background-color);pointer-events:all;display:block;position:fixed;inset:0}.drawer--contained .drawer__overlay{opacity:0;position:absolute}.drawer__overlay--disabled{display:none}@media (forced-colors:active){.drawer__panel{border:solid 1px var(--cx-color-neutral-0)}}`;
|
|
21
|
-
var
|
|
22
|
-
for (var s = l > 1 ? void 0 : l ?
|
|
23
|
-
(f = e[h]) && (s = (l ? f(
|
|
24
|
-
return l && s &&
|
|
21
|
+
var E = Object.defineProperty, L = Object.getOwnPropertyDescriptor, i = (e, a, o, l) => {
|
|
22
|
+
for (var s = l > 1 ? void 0 : l ? L(a, o) : a, h = e.length - 1, f; h >= 0; h--)
|
|
23
|
+
(f = e[h]) && (s = (l ? f(a, o, s) : f(s)) || s);
|
|
24
|
+
return l && s && E(a, o, s), s;
|
|
25
25
|
};
|
|
26
26
|
let t = class extends C {
|
|
27
27
|
constructor() {
|
|
@@ -33,7 +33,7 @@ let t = class extends C {
|
|
|
33
33
|
this.drawer.hidden = !this.open, this.open && (this.addOpenListeners(), this.contained || (this.modal.activate(), m(this)));
|
|
34
34
|
}
|
|
35
35
|
disconnectedCallback() {
|
|
36
|
-
super.disconnectedCallback(),
|
|
36
|
+
super.disconnectedCallback(), u(this), this.removeOpenListeners();
|
|
37
37
|
}
|
|
38
38
|
willUpdate(e) {
|
|
39
39
|
if (super.willUpdate(e), !e.has("open"))
|
|
@@ -45,10 +45,10 @@ let t = class extends C {
|
|
|
45
45
|
cancelable: !0,
|
|
46
46
|
detail: { source: e }
|
|
47
47
|
}).defaultPrevented) {
|
|
48
|
-
const
|
|
48
|
+
const o = c(this, "drawer.denyClose", {
|
|
49
49
|
dir: this.localize.dir()
|
|
50
50
|
});
|
|
51
|
-
d(this.panel,
|
|
51
|
+
d(this.panel, o.keyframes, o.options);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
this.hide();
|
|
@@ -59,6 +59,11 @@ let t = class extends C {
|
|
|
59
59
|
removeOpenListeners() {
|
|
60
60
|
document.removeEventListener("keydown", this.handleDocumentKeyDown), this.closeWatcher?.destroy();
|
|
61
61
|
}
|
|
62
|
+
resetMultipleMenus() {
|
|
63
|
+
[...this.querySelectorAll("cx-menu")].forEach((a) => {
|
|
64
|
+
a.variant === "multiple" && a.resetActiveMenu();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
62
67
|
async handleOpenChange() {
|
|
63
68
|
if (this.open) {
|
|
64
69
|
this.emit("cx-show"), this.addOpenListeners(), this.originalTrigger = document.activeElement, this.contained || (this.modal.activate(), m(this));
|
|
@@ -73,25 +78,25 @@ let t = class extends C {
|
|
|
73
78
|
preventScroll: !0
|
|
74
79
|
}) : this.panel.focus({ preventScroll: !0 })), e && e.setAttribute("autofocus", "");
|
|
75
80
|
});
|
|
76
|
-
const
|
|
81
|
+
const a = c(
|
|
77
82
|
this,
|
|
78
83
|
`drawer.show${x(this.placement)}`,
|
|
79
84
|
{
|
|
80
85
|
dir: this.localize.dir()
|
|
81
86
|
}
|
|
82
|
-
),
|
|
87
|
+
), o = c(this, "drawer.overlay.show", {
|
|
83
88
|
dir: this.localize.dir()
|
|
84
89
|
});
|
|
85
90
|
await Promise.all([
|
|
86
|
-
d(this.panel,
|
|
91
|
+
d(this.panel, a.keyframes, a.options),
|
|
87
92
|
this.contained ? Promise.resolve() : d(
|
|
88
93
|
this.overlay,
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
o.keyframes,
|
|
95
|
+
o.options
|
|
91
96
|
)
|
|
92
97
|
]), this.emit("cx-after-show");
|
|
93
98
|
} else {
|
|
94
|
-
this.emit("cx-hide"), this.removeOpenListeners(), this.contained || (this.modal.deactivate(),
|
|
99
|
+
this.emit("cx-hide"), this.removeOpenListeners(), this.contained || (this.modal.deactivate(), u(this)), await Promise.all([
|
|
95
100
|
p(this.drawer),
|
|
96
101
|
p(this.overlay)
|
|
97
102
|
]);
|
|
@@ -101,14 +106,14 @@ let t = class extends C {
|
|
|
101
106
|
{
|
|
102
107
|
dir: this.localize.dir()
|
|
103
108
|
}
|
|
104
|
-
),
|
|
109
|
+
), a = c(this, "drawer.overlay.hide", {
|
|
105
110
|
dir: this.localize.dir()
|
|
106
111
|
});
|
|
107
112
|
await Promise.all([
|
|
108
113
|
(this.contained ? Promise.resolve() : d(
|
|
109
114
|
this.overlay,
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
a.keyframes,
|
|
116
|
+
a.options
|
|
112
117
|
)).then(() => {
|
|
113
118
|
this.overlay.hidden = !0;
|
|
114
119
|
}),
|
|
@@ -120,12 +125,12 @@ let t = class extends C {
|
|
|
120
125
|
this.panel.hidden = !0;
|
|
121
126
|
})
|
|
122
127
|
]), this.drawer.hidden = !0, this.isClosing = !1, this.overlay.hidden = !1, this.panel.hidden = !1;
|
|
123
|
-
const
|
|
124
|
-
typeof
|
|
128
|
+
const o = this.originalTrigger;
|
|
129
|
+
typeof o?.focus == "function" && setTimeout(() => o.focus()), this.resetMultipleMenus(), this.emit("cx-after-hide");
|
|
125
130
|
}
|
|
126
131
|
}
|
|
127
132
|
handleNoModalChange() {
|
|
128
|
-
this.open && !this.contained && (this.modal.activate(), m(this)), this.open && this.contained && (this.modal.deactivate(),
|
|
133
|
+
this.open && !this.contained && (this.modal.activate(), m(this)), this.open && this.contained && (this.modal.deactivate(), u(this));
|
|
129
134
|
}
|
|
130
135
|
/** Shows the drawer. */
|
|
131
136
|
async show() {
|
|
@@ -168,63 +173,63 @@ let t = class extends C {
|
|
|
168
173
|
};
|
|
169
174
|
t.styles = [k, D];
|
|
170
175
|
t.dependencies = { "cx-icon-button": q };
|
|
171
|
-
|
|
172
|
-
|
|
176
|
+
i([
|
|
177
|
+
w(".drawer")
|
|
173
178
|
], t.prototype, "drawer", 2);
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
i([
|
|
180
|
+
w(".drawer__panel")
|
|
176
181
|
], t.prototype, "panel", 2);
|
|
177
|
-
|
|
178
|
-
|
|
182
|
+
i([
|
|
183
|
+
w(".drawer__overlay")
|
|
179
184
|
], t.prototype, "overlay", 2);
|
|
180
|
-
|
|
185
|
+
i([
|
|
181
186
|
S()
|
|
182
187
|
], t.prototype, "isClosing", 2);
|
|
183
|
-
|
|
188
|
+
i([
|
|
184
189
|
n({ reflect: !0, type: Boolean })
|
|
185
190
|
], t.prototype, "open", 2);
|
|
186
|
-
|
|
191
|
+
i([
|
|
187
192
|
n({ reflect: !0 })
|
|
188
193
|
], t.prototype, "label", 2);
|
|
189
|
-
|
|
194
|
+
i([
|
|
190
195
|
n({ reflect: !0 })
|
|
191
196
|
], t.prototype, "placement", 2);
|
|
192
|
-
|
|
197
|
+
i([
|
|
193
198
|
n({ reflect: !0, type: Boolean })
|
|
194
199
|
], t.prototype, "contained", 2);
|
|
195
|
-
|
|
200
|
+
i([
|
|
196
201
|
n({ attribute: "no-header", reflect: !0, type: Boolean })
|
|
197
202
|
], t.prototype, "noHeader", 2);
|
|
198
|
-
|
|
203
|
+
i([
|
|
199
204
|
n({ reflect: !0, type: String })
|
|
200
205
|
], t.prototype, "variant", 2);
|
|
201
|
-
|
|
206
|
+
i([
|
|
202
207
|
n({ attribute: "no-close-button", reflect: !0, type: Boolean })
|
|
203
208
|
], t.prototype, "noCloseButton", 2);
|
|
204
|
-
|
|
209
|
+
i([
|
|
205
210
|
_("open", { waitUntilFirstUpdate: !0 })
|
|
206
211
|
], t.prototype, "handleOpenChange", 1);
|
|
207
|
-
|
|
212
|
+
i([
|
|
208
213
|
_("contained", { waitUntilFirstUpdate: !0 })
|
|
209
214
|
], t.prototype, "handleNoModalChange", 1);
|
|
210
|
-
t =
|
|
215
|
+
t = i([
|
|
211
216
|
z("cx-drawer")
|
|
212
217
|
], t);
|
|
213
|
-
|
|
218
|
+
r("drawer.showTop", {
|
|
214
219
|
keyframes: [
|
|
215
220
|
{ opacity: 0, translate: "0 -100%" },
|
|
216
221
|
{ opacity: 1, translate: "0 0" }
|
|
217
222
|
],
|
|
218
223
|
options: { duration: 250, easing: "ease" }
|
|
219
224
|
});
|
|
220
|
-
|
|
225
|
+
r("drawer.hideTop", {
|
|
221
226
|
keyframes: [
|
|
222
227
|
{ opacity: 1, translate: "0 0" },
|
|
223
228
|
{ opacity: 0, translate: "0 -100%" }
|
|
224
229
|
],
|
|
225
230
|
options: { duration: 250, easing: "ease" }
|
|
226
231
|
});
|
|
227
|
-
|
|
232
|
+
r("drawer.showEnd", {
|
|
228
233
|
keyframes: [
|
|
229
234
|
{ opacity: 0, translate: "100%" },
|
|
230
235
|
{ opacity: 1, translate: "0" }
|
|
@@ -235,7 +240,7 @@ i("drawer.showEnd", {
|
|
|
235
240
|
{ opacity: 1, translate: "0" }
|
|
236
241
|
]
|
|
237
242
|
});
|
|
238
|
-
|
|
243
|
+
r("drawer.hideEnd", {
|
|
239
244
|
keyframes: [
|
|
240
245
|
{ opacity: 1, translate: "0" },
|
|
241
246
|
{ opacity: 0, translate: "100%" }
|
|
@@ -246,21 +251,21 @@ i("drawer.hideEnd", {
|
|
|
246
251
|
{ opacity: 0, translate: "-100%" }
|
|
247
252
|
]
|
|
248
253
|
});
|
|
249
|
-
|
|
254
|
+
r("drawer.showBottom", {
|
|
250
255
|
keyframes: [
|
|
251
256
|
{ opacity: 0, translate: "0 100%" },
|
|
252
257
|
{ opacity: 1, translate: "0 0" }
|
|
253
258
|
],
|
|
254
259
|
options: { duration: 250, easing: "ease" }
|
|
255
260
|
});
|
|
256
|
-
|
|
261
|
+
r("drawer.hideBottom", {
|
|
257
262
|
keyframes: [
|
|
258
263
|
{ opacity: 1, translate: "0 0" },
|
|
259
264
|
{ opacity: 0, translate: "0 100%" }
|
|
260
265
|
],
|
|
261
266
|
options: { duration: 250, easing: "ease" }
|
|
262
267
|
});
|
|
263
|
-
|
|
268
|
+
r("drawer.showStart", {
|
|
264
269
|
keyframes: [
|
|
265
270
|
{ opacity: 0, translate: "-100%" },
|
|
266
271
|
{ opacity: 1, translate: "0" }
|
|
@@ -271,7 +276,7 @@ i("drawer.showStart", {
|
|
|
271
276
|
{ opacity: 1, translate: "0" }
|
|
272
277
|
]
|
|
273
278
|
});
|
|
274
|
-
|
|
279
|
+
r("drawer.hideStart", {
|
|
275
280
|
keyframes: [
|
|
276
281
|
{ opacity: 1, translate: "0" },
|
|
277
282
|
{ opacity: 0, translate: "-100%" }
|
|
@@ -282,15 +287,15 @@ i("drawer.hideStart", {
|
|
|
282
287
|
{ opacity: 0, translate: "100%" }
|
|
283
288
|
]
|
|
284
289
|
});
|
|
285
|
-
|
|
290
|
+
r("drawer.denyClose", {
|
|
286
291
|
keyframes: [{ scale: 1 }, { scale: 1.01 }, { scale: 1 }],
|
|
287
292
|
options: { duration: 250 }
|
|
288
293
|
});
|
|
289
|
-
|
|
294
|
+
r("drawer.overlay.show", {
|
|
290
295
|
keyframes: [{ opacity: 0 }, { opacity: 1 }],
|
|
291
296
|
options: { duration: 250 }
|
|
292
297
|
});
|
|
293
|
-
|
|
298
|
+
r("drawer.overlay.hide", {
|
|
294
299
|
keyframes: [{ opacity: 1 }, { opacity: 0 }],
|
|
295
300
|
options: { duration: 250 }
|
|
296
301
|
});
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { n as c, C as
|
|
2
|
-
import { c as
|
|
3
|
-
import { c as
|
|
4
|
-
import { L as
|
|
5
|
-
import { i as
|
|
6
|
-
import { r as
|
|
7
|
-
import { e as
|
|
8
|
-
import { n as
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { n as c, C as p } from "../chunks/lib-cortex-element.CVMmyPMC.js";
|
|
2
|
+
import { c as b } from "../chunks/component.styles.CRO4Odto.js";
|
|
3
|
+
import { c as g } from "../chunks/custom-element.L4WJXn1j.js";
|
|
4
|
+
import { L as v } from "../chunks/i18n.CgwQHLcP.js";
|
|
5
|
+
import { i as y, x as f } from "../chunks/lit-element.jLBm65_O.js";
|
|
6
|
+
import { r as w } from "../chunks/state.CSDxrqLd.js";
|
|
7
|
+
import { e as x } from "../chunks/query.BBf1UFkC.js";
|
|
8
|
+
import { n as M } from "../chunks/when.Dr1es41R.js";
|
|
9
|
+
import k from "./menu-item.js";
|
|
10
|
+
var d = /* @__PURE__ */ ((e) => (e.Default = "default", e.Multiple = "multiple", e))(d || {});
|
|
11
|
+
const A = y`:host{background:var(--cx-panel-background-color);border:solid var(--cx-panel-border-width) var(--cx-panel-border-color);border-radius:var(--cx-border-radius-large);padding:var(--cx-spacing-x-small) 0;--divider-color:var(--cx-panel-border-color);--divider-width:var(--cx-panel-border-width);--divider-spacing:var(--cx-spacing-x-small);display:block;position:relative;overflow:auto}:host([horizontal]){padding:0 var(--cx-spacing-x-small);flex-wrap:wrap;justify-content:space-between;display:flex}::slotted(cx-divider){--color:var(--divider-color);--width:var(--divider-width);--spacing:var(--divider-spacing)}::slotted([data-alternating-grouping]):before{content:" ";background-color:var(--divider-color);margin:var(--divider-spacing) 0;height:var(--divider-width);display:block}::slotted([data-alternating-grouping=horizontal]):before{height:100%;margin:0 var(--divider-spacing);width:var(--divider-width);display:inline-block}:host([horizontal]) ::slotted(cx-menu-section){flex-wrap:wrap;justify-content:space-between;display:flex}:host([horizontal]) ::slotted(cx-menu-item){display:flex}:host([variant=multiple]){position:relative;overflow:hidden}:host([variant=multiple]) ::slotted(cx-menu[name]){opacity:0;pointer-events:none;transition:opacity var(--cx-transition-fast) ease-in-out, transform var(--cx-transition-medium) ease-in-out;border:none;top:0;left:0;transform:translate(-50%);position:absolute!important}:host([variant=multiple]) ::slotted(cx-menu[active]){opacity:1;pointer-events:auto;transform:translate(0)}.back__button::part(checked-icon),.back__button::part(submenu-icon){display:none}.back__divider{--spacing:var(--cx-spacing-x-small)}`;
|
|
12
|
+
var I = Object.defineProperty, C = Object.getOwnPropertyDescriptor, u = (e, t, r, i) => {
|
|
13
|
+
for (var o = i > 1 ? void 0 : i ? C(t, r) : t, h = e.length - 1, n; h >= 0; h--)
|
|
13
14
|
(n = e[h]) && (o = (i ? n(t, r, o) : n(o)) || o);
|
|
14
|
-
return i && o &&
|
|
15
|
+
return i && o && I(t, r, o), o;
|
|
15
16
|
};
|
|
16
17
|
function m(e) {
|
|
17
18
|
return e.tagName.toLowerCase() === "cx-menu" && e instanceof l && e.getAttribute("role") === "menu";
|
|
18
19
|
}
|
|
19
|
-
let l = class extends
|
|
20
|
+
let l = class extends p {
|
|
20
21
|
constructor() {
|
|
21
|
-
super(...arguments), this.localize = new
|
|
22
|
+
super(...arguments), this.localize = new v(this), this.horizontal = !1, this.variant = d.Default, this.active = !1, this.name = "", this.back = "", this.default = !1, this.bubbleKeyDown = !1, this.ignoredKeys = [], this.disabledTabLoop = !1, this.resizeObserver = null, this.slotMutationObserver = null;
|
|
22
23
|
}
|
|
23
24
|
connectedCallback() {
|
|
24
25
|
super.connectedCallback(), this.setAttribute("role", "menu"), this.slotMutationObserver = new MutationObserver(() => this.handleSlotChange()), this.slotMutationObserver.observe(this, {
|
|
@@ -31,7 +32,7 @@ let l = class extends f {
|
|
|
31
32
|
super.disconnectedCallback(), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.slotMutationObserver && (this.slotMutationObserver.disconnect(), this.slotMutationObserver = null);
|
|
32
33
|
}
|
|
33
34
|
runFirstUpdated() {
|
|
34
|
-
if (this.variant ===
|
|
35
|
+
if (this.variant === d.Multiple) {
|
|
35
36
|
const e = this.getAllSubMenus();
|
|
36
37
|
this.setActiveMenu(e[0]?.name ?? ""), this.updateComplete.then(() => {
|
|
37
38
|
this.adjustMenuSize();
|
|
@@ -72,7 +73,7 @@ let l = class extends f {
|
|
|
72
73
|
].includes(e.key)) {
|
|
73
74
|
const t = this.getAllItems(), r = this.getCurrentItem();
|
|
74
75
|
let i = r ? t.indexOf(r) : 0;
|
|
75
|
-
if (["ArrowLeft", "ArrowRight"].includes(e.key) && !this.bubbleKeyDown && !(this.parentElement instanceof l) && !(this.parentElement instanceof
|
|
76
|
+
if (["ArrowLeft", "ArrowRight"].includes(e.key) && !this.bubbleKeyDown && !(this.parentElement instanceof l) && !(this.parentElement instanceof k) && e.stopPropagation(), t.length > 0) {
|
|
76
77
|
const o = this.horizontal ? e.key === "ArrowRight" || i === t.length - 1 && e.key === "ArrowDown" : e.key === "ArrowDown", h = this.horizontal ? e.key === "ArrowLeft" || i === 0 && e.key === "ArrowUp" : e.key === "ArrowUp";
|
|
77
78
|
if (["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp"].includes(
|
|
78
79
|
e.key
|
|
@@ -265,16 +266,16 @@ let l = class extends f {
|
|
|
265
266
|
});
|
|
266
267
|
}
|
|
267
268
|
render() {
|
|
268
|
-
const e =
|
|
269
|
+
const e = M(
|
|
269
270
|
this.back,
|
|
270
|
-
() =>
|
|
271
|
+
() => f`<slot name="back-button" role="menuitem" menu=${this.back}><cx-menu-item part="back-button" class="back__button" menu=${this.back}><cx-icon slot="prefix" name="chevron_left"></cx-icon>${this.localize.term("back")}</cx-menu-item><cx-divider class="back__divider"></cx-divider></slot>`
|
|
271
272
|
);
|
|
272
|
-
return this.variant ===
|
|
273
|
+
return this.variant === d.Multiple ? f`${e}<slot @slotchange=${this.handleSlotChange} @click=${this.handleClick} @keydown=${this.handleKeyDown} @mousedown=${this.handleMouseDown}></slot>` : f`${e}<slot @slotchange=${this.handleSlotChange} @click=${this.handleClick} @keydown=${this.handleKeyDown} @mousedown=${this.handleMouseDown}></slot>`;
|
|
273
274
|
}
|
|
274
275
|
};
|
|
275
|
-
l.styles = [
|
|
276
|
+
l.styles = [b, A];
|
|
276
277
|
u([
|
|
277
|
-
|
|
278
|
+
x("slot")
|
|
278
279
|
], l.prototype, "defaultSlot", 2);
|
|
279
280
|
u([
|
|
280
281
|
c({ type: Boolean })
|
|
@@ -311,10 +312,10 @@ u([
|
|
|
311
312
|
c({ attribute: "disabled-tab-loop", reflect: !0, type: Boolean })
|
|
312
313
|
], l.prototype, "disabledTabLoop", 2);
|
|
313
314
|
u([
|
|
314
|
-
|
|
315
|
+
w()
|
|
315
316
|
], l.prototype, "resizeObserver", 2);
|
|
316
317
|
l = u([
|
|
317
|
-
|
|
318
|
+
g("cx-menu")
|
|
318
319
|
], l);
|
|
319
320
|
export {
|
|
320
321
|
l as default
|
package/library/package.json
CHANGED
|
@@ -109,6 +109,7 @@ export default class CxDrawer extends CortexElement {
|
|
|
109
109
|
private requestClose;
|
|
110
110
|
private addOpenListeners;
|
|
111
111
|
private removeOpenListeners;
|
|
112
|
+
private resetMultipleMenus;
|
|
112
113
|
private handleDocumentKeyDown;
|
|
113
114
|
handleOpenChange(): Promise<void>;
|
|
114
115
|
handleNoModalChange(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as CortexElement } from '../../../../base/src/cortex-element.ts';
|
|
2
|
+
import { MenuMode } from '../../../../types/src/menu';
|
|
2
3
|
import { CSSResultGroup } from 'lit';
|
|
3
4
|
import { default as CxMenuItem } from '../menu-item/menu-item';
|
|
4
5
|
|
|
@@ -23,7 +24,7 @@ export default class CxMenu extends CortexElement {
|
|
|
23
24
|
defaultSlot: HTMLSlotElement;
|
|
24
25
|
horizontal: boolean;
|
|
25
26
|
/** The menu's variant */
|
|
26
|
-
variant:
|
|
27
|
+
variant: MenuMode.Default | MenuMode.Multiple;
|
|
27
28
|
/** Whether the menu is currently active, used for 'multiple' variant */
|
|
28
29
|
active: boolean;
|
|
29
30
|
/** The name of the menu, used for 'multiple' variant */
|
|
@@ -5004,7 +5004,7 @@
|
|
|
5004
5004
|
/**
|
|
5005
5005
|
* The selection behavior of the tree. Single selection allows only one node to be selected at a time. Multiple displays checkboxes and allows more than one node to be selected. Leaf allows only leaf nodes to be selected.
|
|
5006
5006
|
*/
|
|
5007
|
-
selection?: '
|
|
5007
|
+
selection?: 'single' | 'multiple' | 'leaf';
|
|
5008
5008
|
/**
|
|
5009
5009
|
* Whether to automatically expand after loading finishes.
|
|
5010
5010
|
*/
|
|
@@ -6016,7 +6016,7 @@
|
|
|
6016
6016
|
/**
|
|
6017
6017
|
*
|
|
6018
6018
|
*/
|
|
6019
|
-
selection?: '
|
|
6019
|
+
selection?: 'single' | 'multiple';
|
|
6020
6020
|
/**
|
|
6021
6021
|
*
|
|
6022
6022
|
*/
|