@codingfactory/mediables-vue 2.3.5 → 2.3.6
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/dist/{PixiFrameExporter-DcQaIUle.js → PixiFrameExporter-BAZtrvGS.js} +2 -2
- package/dist/{PixiFrameExporter-DcQaIUle.js.map → PixiFrameExporter-BAZtrvGS.js.map} +1 -1
- package/dist/{PixiFrameExporter-D2kWTTVT.cjs → PixiFrameExporter-DM4yaigy.cjs} +2 -2
- package/dist/{PixiFrameExporter-D2kWTTVT.cjs.map → PixiFrameExporter-DM4yaigy.cjs.map} +1 -1
- package/dist/{editor-BgjKZltI.js → editor-BWpslm--.js} +152 -145
- package/dist/editor-BWpslm--.js.map +1 -0
- package/dist/editor-D_dX1XkE.cjs +42 -0
- package/dist/editor-D_dX1XkE.cjs.map +1 -0
- package/dist/{index-DuQmNimD.cjs → index-6-ArBBEQ.cjs} +3 -3
- package/dist/{index-DuQmNimD.cjs.map → index-6-ArBBEQ.cjs.map} +1 -1
- package/dist/{index-BDB5R5H_.js → index-CMOpozRS.js} +3 -3
- package/dist/{index-BDB5R5H_.js.map → index-CMOpozRS.js.map} +1 -1
- package/dist/mediables-vanilla.cjs +1 -1
- package/dist/mediables-vanilla.mjs +1 -1
- package/dist/mediables-vue.cjs +1 -1
- package/dist/mediables-vue.mjs +2 -2
- package/package.json +1 -1
- package/dist/editor-BgjKZltI.js.map +0 -1
- package/dist/editor-C4OKTznp.cjs +0 -42
- package/dist/editor-C4OKTznp.cjs.map +0 -1
|
@@ -262,7 +262,7 @@ class xe extends B {
|
|
|
262
262
|
* @param {string} imageUrl - URL, data URL, or blob URL of the image
|
|
263
263
|
*/
|
|
264
264
|
async loadTexture(e) {
|
|
265
|
-
var l, c,
|
|
265
|
+
var l, c, u;
|
|
266
266
|
if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return;
|
|
267
267
|
const t = window.PIXI, i = await this._loadImageElement(e);
|
|
268
268
|
if (!i || !((c = this.app) != null && c.renderer)) return;
|
|
@@ -271,7 +271,7 @@ class xe extends B {
|
|
|
271
271
|
return;
|
|
272
272
|
this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new t.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
|
|
273
273
|
const { w: a, h: o } = this._getCssSize();
|
|
274
|
-
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((
|
|
274
|
+
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((u = this.app) != null && u.renderer)) return;
|
|
275
275
|
const n = this.getFitScaleFor(r);
|
|
276
276
|
Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height });
|
|
277
277
|
}
|
|
@@ -290,16 +290,23 @@ class xe extends B {
|
|
|
290
290
|
const a = window.PIXI, o = Math.round(this.originalTexture.width), n = Math.round(this.originalTexture.height);
|
|
291
291
|
if (o <= 0 || n <= 0)
|
|
292
292
|
return null;
|
|
293
|
-
let l = o
|
|
293
|
+
let l = o;
|
|
294
294
|
if (i > 0) {
|
|
295
295
|
const _ = Math.max(o, n);
|
|
296
296
|
let v = i / _;
|
|
297
|
-
r && (v = Math.min(1, v)), l = Math.round(o * v)
|
|
297
|
+
r && (v = Math.min(1, v)), l = Math.round(o * v);
|
|
298
298
|
}
|
|
299
|
-
const
|
|
299
|
+
const c = this.sprite, u = c.x, h = c.y, p = c.width, m = c.height;
|
|
300
|
+
if (p <= 0 || m <= 0)
|
|
301
|
+
return null;
|
|
302
|
+
const C = l / p;
|
|
300
303
|
let b = null;
|
|
301
304
|
try {
|
|
302
|
-
if (
|
|
305
|
+
if (c.x = 0, c.y = 0, b = a.RenderTexture.create({
|
|
306
|
+
width: Math.ceil(p),
|
|
307
|
+
height: Math.ceil(m),
|
|
308
|
+
resolution: C
|
|
309
|
+
}), this.app.renderer.render({ container: this.app.stage, target: b }), !this.app.renderer.extract)
|
|
303
310
|
return null;
|
|
304
311
|
const _ = this.app.renderer.extract.canvas(b);
|
|
305
312
|
if (!_)
|
|
@@ -317,7 +324,7 @@ class xe extends B {
|
|
|
317
324
|
} catch {
|
|
318
325
|
return null;
|
|
319
326
|
} finally {
|
|
320
|
-
|
|
327
|
+
c.x = u, c.y = h, b && b.destroy(!0);
|
|
321
328
|
}
|
|
322
329
|
}
|
|
323
330
|
/**
|
|
@@ -524,9 +531,9 @@ class we extends B {
|
|
|
524
531
|
if (!o || !o.createFilter || typeof o.createFilter != "function")
|
|
525
532
|
return;
|
|
526
533
|
const n = this.state.getFilterValues(a), l = o.defaultParams ? { ...o.defaultParams } : {};
|
|
527
|
-
o.controls && Array.isArray(o.controls) && o.controls.forEach((
|
|
528
|
-
const h =
|
|
529
|
-
l[h] = n[
|
|
534
|
+
o.controls && Array.isArray(o.controls) && o.controls.forEach((u) => {
|
|
535
|
+
const h = u.property || u.id;
|
|
536
|
+
l[h] = n[u.id] ?? u.default;
|
|
530
537
|
});
|
|
531
538
|
const c = o.createFilter(l);
|
|
532
539
|
c && (t.push(c), this.instances[a] = c);
|
|
@@ -645,14 +652,14 @@ const T = class T extends B {
|
|
|
645
652
|
if (!e || !r || !a || !o) return null;
|
|
646
653
|
const l = e.width > t, c = e.height > i;
|
|
647
654
|
if (!l && !c) return null;
|
|
648
|
-
const
|
|
655
|
+
const u = T.AUTO_ZOOM_PADDING;
|
|
649
656
|
let h = n;
|
|
650
657
|
if (l) {
|
|
651
|
-
const p = e.width / (
|
|
658
|
+
const p = e.width / (u * r * o);
|
|
652
659
|
h = Math.min(h, p);
|
|
653
660
|
}
|
|
654
661
|
if (c) {
|
|
655
|
-
const p = e.height / (
|
|
662
|
+
const p = e.height / (u * a * o);
|
|
656
663
|
h = Math.min(h, p);
|
|
657
664
|
}
|
|
658
665
|
return h = Math.max(0.1, h), h >= n - 0.01 ? null : h;
|
|
@@ -707,9 +714,9 @@ const T = class T extends B {
|
|
|
707
714
|
0,
|
|
708
715
|
Math.PI * 2
|
|
709
716
|
), n.stroke()) : n.strokeRect(l.x, l.y, l.width, l.height), n.setLineDash([]), n.strokeStyle = "rgba(255,255,255,0.3)", n.lineWidth = 1;
|
|
710
|
-
const
|
|
717
|
+
const u = l.width / 3, h = l.height / 3;
|
|
711
718
|
for (let y = 1; y <= 2; y++)
|
|
712
|
-
n.beginPath(), n.moveTo(l.x +
|
|
719
|
+
n.beginPath(), n.moveTo(l.x + u * y, l.y), n.lineTo(l.x + u * y, l.y + l.height), n.stroke(), n.beginPath(), n.moveTo(l.x, l.y + h * y), n.lineTo(l.x + l.width, l.y + h * y), n.stroke();
|
|
713
720
|
const p = this.HANDLE_SIZE, m = [
|
|
714
721
|
{ x: l.x, y: l.y, m: "resize-nw" },
|
|
715
722
|
{ x: l.x + l.width, y: l.y, m: "resize-ne" },
|
|
@@ -751,12 +758,12 @@ const T = class T extends B {
|
|
|
751
758
|
* Handle pointer move event
|
|
752
759
|
*/
|
|
753
760
|
_handlePointerMove(e) {
|
|
754
|
-
var l, c,
|
|
761
|
+
var l, c, u, h;
|
|
755
762
|
const t = this.renderer.app;
|
|
756
763
|
if (!t) return;
|
|
757
764
|
const i = e.global;
|
|
758
765
|
if (!this._isDragging || !this._dragStart || !this._startRect) {
|
|
759
|
-
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (
|
|
766
|
+
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (u = this._hoverMode) != null && u.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
|
|
760
767
|
return;
|
|
761
768
|
}
|
|
762
769
|
const r = this.state.get("crop.rect");
|
|
@@ -833,8 +840,8 @@ const T = class T extends B {
|
|
|
833
840
|
apply() {
|
|
834
841
|
const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
|
|
835
842
|
if (!r || !t || !e || !i) return null;
|
|
836
|
-
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n,
|
|
837
|
-
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), C = Math.round(
|
|
843
|
+
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n, u = (r.y - t.y) * l;
|
|
844
|
+
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), C = Math.round(u);
|
|
838
845
|
if (h <= 0 || p <= 0) return null;
|
|
839
846
|
const b = new a.Container(), y = new a.Sprite(i);
|
|
840
847
|
if (this.state.get("crop.shape") === "circle") {
|
|
@@ -933,8 +940,8 @@ class Se {
|
|
|
933
940
|
if (!a.ok) {
|
|
934
941
|
let c = `Background removal failed (HTTP ${a.status})`;
|
|
935
942
|
try {
|
|
936
|
-
const
|
|
937
|
-
|
|
943
|
+
const u = await a.text();
|
|
944
|
+
u && (c += `: ${u}`);
|
|
938
945
|
} catch {
|
|
939
946
|
}
|
|
940
947
|
throw new Error(c);
|
|
@@ -993,7 +1000,7 @@ class Se {
|
|
|
993
1000
|
}
|
|
994
1001
|
}
|
|
995
1002
|
}
|
|
996
|
-
function
|
|
1003
|
+
function d(s, e = {}, ...t) {
|
|
997
1004
|
const i = document.createElement(s);
|
|
998
1005
|
for (const [r, a] of Object.entries(e))
|
|
999
1006
|
if (a != null)
|
|
@@ -1010,16 +1017,16 @@ function u(s, e = {}, ...t) {
|
|
|
1010
1017
|
return i;
|
|
1011
1018
|
}
|
|
1012
1019
|
function ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
|
|
1013
|
-
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l =
|
|
1020
|
+
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = d("div", {
|
|
1014
1021
|
className: "slider-control slider-wrapper",
|
|
1015
1022
|
"data-control": n,
|
|
1016
1023
|
"data-testid": `slider-${n}`
|
|
1017
|
-
}), c =
|
|
1024
|
+
}), c = d(
|
|
1018
1025
|
"div",
|
|
1019
1026
|
{ className: "slider-header" },
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
),
|
|
1027
|
+
d("label", { for: s, className: "slider-label" }, e),
|
|
1028
|
+
d("span", { className: "slider-value", id: `${s}-value` }, j(a))
|
|
1029
|
+
), u = d("input", {
|
|
1023
1030
|
type: "range",
|
|
1024
1031
|
id: s,
|
|
1025
1032
|
className: "slider-input",
|
|
@@ -1032,8 +1039,8 @@ function ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1032
1039
|
m && (m.textContent = j(p)), o == null || o(p);
|
|
1033
1040
|
}
|
|
1034
1041
|
});
|
|
1035
|
-
return l.appendChild(c), l.appendChild(
|
|
1036
|
-
|
|
1042
|
+
return l.appendChild(c), l.appendChild(u), l.setValue = (h) => {
|
|
1043
|
+
u.value = String(h);
|
|
1037
1044
|
const p = l.querySelector(".slider-value");
|
|
1038
1045
|
p && (p.textContent = j(h));
|
|
1039
1046
|
}, l;
|
|
@@ -1042,24 +1049,24 @@ function j(s) {
|
|
|
1042
1049
|
return Number.isInteger(s) ? String(s) : s.toFixed(2);
|
|
1043
1050
|
}
|
|
1044
1051
|
function oe({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
1045
|
-
const r =
|
|
1052
|
+
const r = d("div", { className: "toggle-control" }), a = d("label", { className: "toggle-label", for: s }, e), o = d("input", {
|
|
1046
1053
|
type: "checkbox",
|
|
1047
1054
|
id: s,
|
|
1048
1055
|
className: "toggle-input",
|
|
1049
1056
|
checked: t ? "checked" : void 0,
|
|
1050
1057
|
onChange: (c) => i == null ? void 0 : i(c.target.checked)
|
|
1051
|
-
}), n =
|
|
1058
|
+
}), n = d("div", {
|
|
1052
1059
|
className: "toggle-switch",
|
|
1053
1060
|
onClick: (c) => {
|
|
1054
1061
|
c.target !== o && (o.checked = !o.checked, i == null || i(o.checked));
|
|
1055
1062
|
}
|
|
1056
|
-
}), l =
|
|
1063
|
+
}), l = d("span", { className: "toggle-slider" });
|
|
1057
1064
|
return n.appendChild(o), n.appendChild(l), r.appendChild(a), r.appendChild(n), r.setChecked = (c) => {
|
|
1058
1065
|
o.checked = c;
|
|
1059
1066
|
}, r;
|
|
1060
1067
|
}
|
|
1061
1068
|
function ne({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
1062
|
-
const r =
|
|
1069
|
+
const r = d("div", { className: "color-control" }), a = d("label", { className: "color-label", for: s }, e), o = d("input", {
|
|
1063
1070
|
type: "color",
|
|
1064
1071
|
id: s,
|
|
1065
1072
|
className: "color-input",
|
|
@@ -1071,13 +1078,13 @@ function ne({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
|
1071
1078
|
}, r;
|
|
1072
1079
|
}
|
|
1073
1080
|
function le({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
1074
|
-
const a =
|
|
1081
|
+
const a = d("div", { className: "select-control" }), o = d("label", { className: "select-label", for: s }, e), n = d("select", {
|
|
1075
1082
|
id: s,
|
|
1076
1083
|
className: "select-input",
|
|
1077
1084
|
onChange: (l) => r == null ? void 0 : r(l.target.value)
|
|
1078
1085
|
});
|
|
1079
1086
|
for (const l of t) {
|
|
1080
|
-
const c =
|
|
1087
|
+
const c = d("option", { value: l.value }, l.label);
|
|
1081
1088
|
l.value === i && (c.selected = !0), n.appendChild(c);
|
|
1082
1089
|
}
|
|
1083
1090
|
return a.appendChild(o), a.appendChild(n), a.setValue = (l) => {
|
|
@@ -1085,14 +1092,14 @@ function le({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
|
1085
1092
|
}, a;
|
|
1086
1093
|
}
|
|
1087
1094
|
function A({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
|
|
1088
|
-
const a =
|
|
1095
|
+
const a = d("button", {
|
|
1089
1096
|
type: "button",
|
|
1090
1097
|
className: `btn ${e}`.trim(),
|
|
1091
1098
|
onClick: t,
|
|
1092
1099
|
disabled: r ? "disabled" : void 0
|
|
1093
1100
|
});
|
|
1094
1101
|
if (i) {
|
|
1095
|
-
const o =
|
|
1102
|
+
const o = d("span", { className: "btn-icon" });
|
|
1096
1103
|
o.innerHTML = i;
|
|
1097
1104
|
const n = o.querySelector("svg");
|
|
1098
1105
|
n && n.setAttribute("aria-hidden", "true"), a.appendChild(o);
|
|
@@ -1109,24 +1116,24 @@ function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1,
|
|
|
1109
1116
|
disabled: r ? "disabled" : void 0
|
|
1110
1117
|
};
|
|
1111
1118
|
a && (n.dataset = { testid: a });
|
|
1112
|
-
const l =
|
|
1119
|
+
const l = d("button", n);
|
|
1113
1120
|
l.innerHTML = s;
|
|
1114
1121
|
const c = l.querySelector("svg");
|
|
1115
1122
|
return c && c.setAttribute("aria-hidden", "true"), l;
|
|
1116
1123
|
}
|
|
1117
1124
|
function W({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
1118
|
-
const r =
|
|
1125
|
+
const r = d("button", {
|
|
1119
1126
|
type: "button",
|
|
1120
1127
|
className: `chip ${t ? "active" : ""}`.trim(),
|
|
1121
1128
|
onClick: i
|
|
1122
1129
|
});
|
|
1123
1130
|
if (e) {
|
|
1124
|
-
const a =
|
|
1131
|
+
const a = d("span", { className: "chip-icon" });
|
|
1125
1132
|
a.innerHTML = e;
|
|
1126
1133
|
const o = a.querySelector("svg");
|
|
1127
1134
|
o && o.setAttribute("aria-hidden", "true"), r.appendChild(a);
|
|
1128
1135
|
}
|
|
1129
|
-
return r.appendChild(
|
|
1136
|
+
return r.appendChild(d("span", { className: "chip-label" }, s)), r.setActive = (a) => {
|
|
1130
1137
|
r.classList.toggle("active", a);
|
|
1131
1138
|
}, r;
|
|
1132
1139
|
}
|
|
@@ -1140,8 +1147,8 @@ class Le {
|
|
|
1140
1147
|
* @returns {HTMLElement}
|
|
1141
1148
|
*/
|
|
1142
1149
|
render() {
|
|
1143
|
-
this.element =
|
|
1144
|
-
const e =
|
|
1150
|
+
this.element = d("div", { className: "editor-toolbar" });
|
|
1151
|
+
const e = d("div", { className: "toolbar-section toolbar-left" }), t = x({
|
|
1145
1152
|
icon: Ee,
|
|
1146
1153
|
title: "Open Image",
|
|
1147
1154
|
className: "toolbar-btn",
|
|
@@ -1150,7 +1157,7 @@ class Le {
|
|
|
1150
1157
|
onClick: () => this.editor.openFilePicker()
|
|
1151
1158
|
});
|
|
1152
1159
|
e.appendChild(t);
|
|
1153
|
-
const i =
|
|
1160
|
+
const i = d("div", { className: "toolbar-section toolbar-center" }), r = x({
|
|
1154
1161
|
icon: ke,
|
|
1155
1162
|
title: "Zoom Out",
|
|
1156
1163
|
className: "toolbar-btn",
|
|
@@ -1161,7 +1168,7 @@ class Le {
|
|
|
1161
1168
|
this.editor.setZoom(h - 0.25);
|
|
1162
1169
|
}
|
|
1163
1170
|
});
|
|
1164
|
-
this._zoomLabel =
|
|
1171
|
+
this._zoomLabel = d("span", {
|
|
1165
1172
|
className: "zoom-label",
|
|
1166
1173
|
"aria-live": "polite",
|
|
1167
1174
|
"aria-atomic": "true",
|
|
@@ -1186,7 +1193,7 @@ class Le {
|
|
|
1186
1193
|
onClick: () => this.editor.fitToScreen()
|
|
1187
1194
|
});
|
|
1188
1195
|
i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
|
|
1189
|
-
const n =
|
|
1196
|
+
const n = d("div", { className: "toolbar-section toolbar-right" });
|
|
1190
1197
|
this._themeBtn = x({
|
|
1191
1198
|
icon: this.state.get("isDarkMode") ? K : Q,
|
|
1192
1199
|
title: "Toggle Theme",
|
|
@@ -1218,7 +1225,7 @@ class Le {
|
|
|
1218
1225
|
testId: "btn-save-edit",
|
|
1219
1226
|
ariaLabel: "Save image",
|
|
1220
1227
|
onClick: () => this.editor.save()
|
|
1221
|
-
}),
|
|
1228
|
+
}), u = x({
|
|
1222
1229
|
icon: G,
|
|
1223
1230
|
title: "Close",
|
|
1224
1231
|
className: "toolbar-btn",
|
|
@@ -1226,7 +1233,7 @@ class Le {
|
|
|
1226
1233
|
ariaLabel: "Close editor",
|
|
1227
1234
|
onClick: () => this.editor.close()
|
|
1228
1235
|
});
|
|
1229
|
-
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(
|
|
1236
|
+
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(u), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
|
|
1230
1237
|
}
|
|
1231
1238
|
/**
|
|
1232
1239
|
* Subscribe to state changes
|
|
@@ -1287,7 +1294,7 @@ class De {
|
|
|
1287
1294
|
* @returns {HTMLElement}
|
|
1288
1295
|
*/
|
|
1289
1296
|
render(e) {
|
|
1290
|
-
this._onSelect = e, this.element =
|
|
1297
|
+
this._onSelect = e, this.element = d("div", {
|
|
1291
1298
|
className: "category-carousel-container",
|
|
1292
1299
|
"data-testid": "category-carousel"
|
|
1293
1300
|
}), this._leftBtn = x({
|
|
@@ -1295,7 +1302,7 @@ class De {
|
|
|
1295
1302
|
title: "Previous categories",
|
|
1296
1303
|
className: "carousel-nav carousel-nav-left",
|
|
1297
1304
|
onClick: () => this._scrollLeft()
|
|
1298
|
-
}), this._carousel =
|
|
1305
|
+
}), this._carousel = d("div", { className: "category-carousel" }), L.forEach((i) => {
|
|
1299
1306
|
const r = W({
|
|
1300
1307
|
label: i.name,
|
|
1301
1308
|
icon: i.icon,
|
|
@@ -1308,14 +1315,14 @@ class De {
|
|
|
1308
1315
|
title: "Next categories",
|
|
1309
1316
|
className: "carousel-nav carousel-nav-right",
|
|
1310
1317
|
onClick: () => this._scrollRight()
|
|
1311
|
-
}), this._pagination =
|
|
1318
|
+
}), this._pagination = d("div", {
|
|
1312
1319
|
className: "carousel-pagination",
|
|
1313
1320
|
role: "tablist",
|
|
1314
1321
|
"aria-label": "Category pages"
|
|
1315
1322
|
});
|
|
1316
1323
|
const t = Math.ceil(L.length / 3);
|
|
1317
1324
|
for (let i = 0; i < t; i++) {
|
|
1318
|
-
const r =
|
|
1325
|
+
const r = d("button", {
|
|
1319
1326
|
type: "button",
|
|
1320
1327
|
className: `pagination-dot ${i === 0 ? "active" : ""}`,
|
|
1321
1328
|
role: "tab",
|
|
@@ -1422,12 +1429,12 @@ class Ue {
|
|
|
1422
1429
|
* @returns {HTMLElement}
|
|
1423
1430
|
*/
|
|
1424
1431
|
render({ onToggle: e, onSelect: t }) {
|
|
1425
|
-
return this._onToggle = e, this._onSelect = t, this.element =
|
|
1432
|
+
return this._onToggle = e, this._onSelect = t, this.element = d("div", { className: "filter-carousel-container" }), this._leftBtn = x({
|
|
1426
1433
|
icon: ce,
|
|
1427
1434
|
title: "Previous filters",
|
|
1428
1435
|
className: "carousel-nav carousel-nav-left",
|
|
1429
1436
|
onClick: () => this._scrollLeft()
|
|
1430
|
-
}), this._carousel =
|
|
1437
|
+
}), this._carousel = d("div", { className: "filter-carousel" }), this._rightBtn = x({
|
|
1431
1438
|
icon: he,
|
|
1432
1439
|
title: "Next filters",
|
|
1433
1440
|
className: "carousel-nav carousel-nav-right",
|
|
@@ -1474,14 +1481,14 @@ class Ue {
|
|
|
1474
1481
|
* @returns {HTMLElement}
|
|
1475
1482
|
*/
|
|
1476
1483
|
_createFilterCard(e, { isActive: t, isSelected: i }) {
|
|
1477
|
-
const r =
|
|
1484
|
+
const r = d("div", {
|
|
1478
1485
|
className: `filter-card ${t ? "active" : ""} ${i ? "selected" : ""}`,
|
|
1479
1486
|
"data-filter": e.id,
|
|
1480
1487
|
"data-testid": `filter-${e.id}`,
|
|
1481
1488
|
onClick: () => this._handleCardClick(e.id)
|
|
1482
|
-
}), a =
|
|
1489
|
+
}), a = d("div", { className: "filter-preview" }), o = d("span", { className: "filter-preview-text" }, e.name.charAt(0));
|
|
1483
1490
|
a.appendChild(o);
|
|
1484
|
-
const n =
|
|
1491
|
+
const n = d("span", { className: "filter-name", title: e.name }, e.name), l = d("button", {
|
|
1485
1492
|
className: `filter-toggle ${t ? "active" : ""}`,
|
|
1486
1493
|
onClick: (c) => {
|
|
1487
1494
|
var p;
|
|
@@ -1579,7 +1586,7 @@ class Ve {
|
|
|
1579
1586
|
* @returns {HTMLElement}
|
|
1580
1587
|
*/
|
|
1581
1588
|
render({ onChange: e, onReset: t, onAction: i }) {
|
|
1582
|
-
return this._onChange = e, this._onReset = t, this._onAction = i, this.element =
|
|
1589
|
+
return this._onChange = e, this._onReset = t, this._onAction = i, this.element = d("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
|
|
1583
1590
|
}
|
|
1584
1591
|
/**
|
|
1585
1592
|
* Subscribe to state changes
|
|
@@ -1602,24 +1609,24 @@ class Ve {
|
|
|
1602
1609
|
const e = this.state.get("selectedFilter");
|
|
1603
1610
|
if (!e) {
|
|
1604
1611
|
this.element.appendChild(
|
|
1605
|
-
|
|
1612
|
+
d("div", { className: "no-filter-selected" }, "Select a filter to adjust")
|
|
1606
1613
|
);
|
|
1607
1614
|
return;
|
|
1608
1615
|
}
|
|
1609
1616
|
const t = this.filterManager.getFilterDef(e);
|
|
1610
1617
|
if (!t) {
|
|
1611
1618
|
this.element.appendChild(
|
|
1612
|
-
|
|
1619
|
+
d("div", { className: "no-filter-selected" }, "Filter not found")
|
|
1613
1620
|
);
|
|
1614
1621
|
return;
|
|
1615
1622
|
}
|
|
1616
|
-
const i =
|
|
1617
|
-
i.appendChild(
|
|
1623
|
+
const i = d("div", { className: "adjustments-header" });
|
|
1624
|
+
i.appendChild(d("span", { className: "adjustments-title" }, t.name)), i.appendChild(A({
|
|
1618
1625
|
label: "Reset",
|
|
1619
1626
|
className: "btn-text",
|
|
1620
1627
|
onClick: () => this._handleReset(e)
|
|
1621
1628
|
})), this.element.appendChild(i);
|
|
1622
|
-
const r =
|
|
1629
|
+
const r = d("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
|
|
1623
1630
|
t.controls.forEach((o) => {
|
|
1624
1631
|
const n = this._createControl(e, o, a[o.id] ?? o.default);
|
|
1625
1632
|
n && (this._controls.set(o.id, n), r.appendChild(n));
|
|
@@ -1670,7 +1677,7 @@ class Ve {
|
|
|
1670
1677
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1671
1678
|
});
|
|
1672
1679
|
case "button":
|
|
1673
|
-
const n =
|
|
1680
|
+
const n = d("div", { className: "button-control" });
|
|
1674
1681
|
return n.appendChild(A({
|
|
1675
1682
|
label: r,
|
|
1676
1683
|
className: "btn-secondary",
|
|
@@ -1782,10 +1789,10 @@ class je {
|
|
|
1782
1789
|
* @param {Object} callbacks - { onChange, onReset, onRemove, onAction }
|
|
1783
1790
|
*/
|
|
1784
1791
|
build(e, { onChange: t, onReset: i, onRemove: r, onAction: a }) {
|
|
1785
|
-
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer =
|
|
1786
|
-
const o =
|
|
1787
|
-
this._titleEl =
|
|
1788
|
-
const n =
|
|
1792
|
+
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = d("div", { className: "mobile-filter-drawer" });
|
|
1793
|
+
const o = d("div", { className: "drawer-header" });
|
|
1794
|
+
this._titleEl = d("span", { className: "drawer-title" }, "Filter");
|
|
1795
|
+
const n = d("div", { className: "drawer-header-actions" }), l = A({
|
|
1789
1796
|
label: "Reset",
|
|
1790
1797
|
className: "btn-text",
|
|
1791
1798
|
onClick: () => {
|
|
@@ -1799,14 +1806,14 @@ class je {
|
|
|
1799
1806
|
var h;
|
|
1800
1807
|
this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
|
|
1801
1808
|
}
|
|
1802
|
-
}),
|
|
1809
|
+
}), u = x({
|
|
1803
1810
|
icon: G,
|
|
1804
1811
|
title: "Close",
|
|
1805
1812
|
className: "btn-icon-sm",
|
|
1806
1813
|
ariaLabel: "Close drawer",
|
|
1807
1814
|
onClick: () => this.close()
|
|
1808
1815
|
});
|
|
1809
|
-
n.appendChild(l), n.appendChild(c), n.appendChild(
|
|
1816
|
+
n.appendChild(l), n.appendChild(c), n.appendChild(u), o.appendChild(this._titleEl), o.appendChild(n), this._drawer.appendChild(o), this._body = d("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
|
|
1810
1817
|
}
|
|
1811
1818
|
/**
|
|
1812
1819
|
* Open the drawer for a specific filter
|
|
@@ -1856,7 +1863,7 @@ class je {
|
|
|
1856
1863
|
const e = this.filterManager.getFilterDef(this._currentFilterId);
|
|
1857
1864
|
if (!e) return;
|
|
1858
1865
|
this._titleEl.textContent = e.name;
|
|
1859
|
-
const t =
|
|
1866
|
+
const t = d("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
|
|
1860
1867
|
e.controls.forEach((r) => {
|
|
1861
1868
|
if (r.hidden) return;
|
|
1862
1869
|
const a = this._createControl(this._currentFilterId, r, i[r.id] ?? r.default);
|
|
@@ -1920,7 +1927,7 @@ class je {
|
|
|
1920
1927
|
});
|
|
1921
1928
|
}
|
|
1922
1929
|
case "button": {
|
|
1923
|
-
const o =
|
|
1930
|
+
const o = d("div", { className: "button-control" });
|
|
1924
1931
|
return o.appendChild(A({
|
|
1925
1932
|
label: r,
|
|
1926
1933
|
className: "btn-secondary",
|
|
@@ -1977,10 +1984,10 @@ class qe {
|
|
|
1977
1984
|
* @returns {HTMLElement}
|
|
1978
1985
|
*/
|
|
1979
1986
|
render({ onToggle: e, onSelect: t }) {
|
|
1980
|
-
return this._onToggle = e, this._onSelect = t, this.element =
|
|
1987
|
+
return this._onToggle = e, this._onSelect = t, this.element = d("div", {
|
|
1981
1988
|
className: "mobile-active-filters",
|
|
1982
1989
|
"data-testid": "mobile-active-filters"
|
|
1983
|
-
}), this._scrollContainer =
|
|
1990
|
+
}), this._scrollContainer = d("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
|
|
1984
1991
|
}
|
|
1985
1992
|
_subscribeToState() {
|
|
1986
1993
|
const e = this.state.on("change:activeFilters", () => {
|
|
@@ -1996,7 +2003,7 @@ class qe {
|
|
|
1996
2003
|
this._scrollContainer.innerHTML = "", this._chips.clear();
|
|
1997
2004
|
const e = this.state.get("activeFilters");
|
|
1998
2005
|
if (!e || e.size === 0) {
|
|
1999
|
-
const t =
|
|
2006
|
+
const t = d("div", {
|
|
2000
2007
|
className: "active-filter-placeholder"
|
|
2001
2008
|
}, "No active filters");
|
|
2002
2009
|
this._scrollContainer.appendChild(t);
|
|
@@ -2010,17 +2017,17 @@ class qe {
|
|
|
2010
2017
|
}), this._updateSelectedState();
|
|
2011
2018
|
}
|
|
2012
2019
|
_createChip(e, t) {
|
|
2013
|
-
const i =
|
|
2020
|
+
const i = d("div", {
|
|
2014
2021
|
className: "active-filter-chip",
|
|
2015
2022
|
"data-filter-id": e,
|
|
2016
2023
|
"data-testid": `active-chip-${e}`
|
|
2017
|
-
}), r =
|
|
2024
|
+
}), r = d("span", {
|
|
2018
2025
|
className: "active-filter-chip-label",
|
|
2019
2026
|
onClick: (o) => {
|
|
2020
2027
|
var n;
|
|
2021
2028
|
o.stopPropagation(), (n = this._onSelect) == null || n.call(this, e);
|
|
2022
2029
|
}
|
|
2023
|
-
}, t.name), a =
|
|
2030
|
+
}, t.name), a = d("button", {
|
|
2024
2031
|
className: "active-filter-chip-check",
|
|
2025
2032
|
"aria-label": `Remove ${t.name} filter`,
|
|
2026
2033
|
onClick: (o) => {
|
|
@@ -2062,32 +2069,32 @@ class We {
|
|
|
2062
2069
|
* @returns {HTMLElement}
|
|
2063
2070
|
*/
|
|
2064
2071
|
render() {
|
|
2065
|
-
this.element =
|
|
2072
|
+
this.element = d("div", {
|
|
2066
2073
|
className: "crop-controls",
|
|
2067
2074
|
"data-testid": "crop-controls"
|
|
2068
2075
|
});
|
|
2069
|
-
const e =
|
|
2070
|
-
e.appendChild(
|
|
2071
|
-
const t =
|
|
2076
|
+
const e = d("div", { className: "crop-section" });
|
|
2077
|
+
e.appendChild(d("label", { className: "section-label" }, "Shape"));
|
|
2078
|
+
const t = d("div", { className: "chip-row" }), i = this.state.get("crop.shape");
|
|
2072
2079
|
He.forEach((c) => {
|
|
2073
|
-
const
|
|
2080
|
+
const u = W({
|
|
2074
2081
|
label: c.name,
|
|
2075
2082
|
icon: c.icon,
|
|
2076
2083
|
active: i === c.id,
|
|
2077
2084
|
onClick: () => this._selectShape(c.id)
|
|
2078
2085
|
});
|
|
2079
|
-
|
|
2080
|
-
}), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection =
|
|
2081
|
-
const r =
|
|
2086
|
+
u.dataset.shape = c.id, u.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, u), t.appendChild(u);
|
|
2087
|
+
}), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = d("div", { className: "crop-section" }), this._aspectSection.appendChild(d("label", { className: "section-label" }, "Aspect Ratio"));
|
|
2088
|
+
const r = d("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
|
|
2082
2089
|
$e.forEach((c) => {
|
|
2083
|
-
const
|
|
2090
|
+
const u = W({
|
|
2084
2091
|
label: c.name,
|
|
2085
2092
|
active: a === c.id,
|
|
2086
2093
|
onClick: () => this._selectAspect(c.id)
|
|
2087
2094
|
});
|
|
2088
|
-
|
|
2095
|
+
u.dataset.ratio = c.id, u.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, u), r.appendChild(u);
|
|
2089
2096
|
}), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
|
|
2090
|
-
const o =
|
|
2097
|
+
const o = d("div", { className: "crop-actions" }), n = A({
|
|
2091
2098
|
label: "Cancel",
|
|
2092
2099
|
className: "btn-secondary crop-cancel-btn",
|
|
2093
2100
|
icon: G,
|
|
@@ -2170,18 +2177,18 @@ class Ze {
|
|
|
2170
2177
|
* @returns {HTMLElement}
|
|
2171
2178
|
*/
|
|
2172
2179
|
render({ onRemove: e, onReset: t, onClearAll: i, onUpdateValue: r, onSelect: a }) {
|
|
2173
|
-
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element =
|
|
2180
|
+
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = d("div", {
|
|
2174
2181
|
className: "active-filters-panel",
|
|
2175
2182
|
"data-testid": "active-filters-panel"
|
|
2176
2183
|
});
|
|
2177
|
-
const o =
|
|
2178
|
-
o.appendChild(
|
|
2184
|
+
const o = d("div", { className: "panel-header" });
|
|
2185
|
+
o.appendChild(d("h3", { className: "panel-title" }, "Active Filters"));
|
|
2179
2186
|
const n = A({
|
|
2180
2187
|
label: "Clear All",
|
|
2181
2188
|
className: "btn-text btn-danger",
|
|
2182
2189
|
onClick: () => this._handleClearAll()
|
|
2183
2190
|
});
|
|
2184
|
-
return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer =
|
|
2191
|
+
return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer = d("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
|
|
2185
2192
|
}
|
|
2186
2193
|
/**
|
|
2187
2194
|
* Subscribe to state changes
|
|
@@ -2217,7 +2224,7 @@ class Ze {
|
|
|
2217
2224
|
const e = this.state.get("activeFilters");
|
|
2218
2225
|
if (e.size === 0) {
|
|
2219
2226
|
this._listContainer.appendChild(
|
|
2220
|
-
|
|
2227
|
+
d("div", { className: "no-filters-message" }, "No filters active")
|
|
2221
2228
|
);
|
|
2222
2229
|
return;
|
|
2223
2230
|
}
|
|
@@ -2235,26 +2242,26 @@ class Ze {
|
|
|
2235
2242
|
* @returns {HTMLElement}
|
|
2236
2243
|
*/
|
|
2237
2244
|
_createFilterItem(e, t) {
|
|
2238
|
-
const r = this.state.get("selectedFilter") === e, a =
|
|
2245
|
+
const r = this.state.get("selectedFilter") === e, a = d("div", {
|
|
2239
2246
|
className: `active-filter-item ${r ? "selected" : ""}`,
|
|
2240
2247
|
"data-active-filter": e,
|
|
2241
2248
|
"data-testid": `active-filter-${e}`,
|
|
2242
2249
|
onClick: (m) => {
|
|
2243
2250
|
m.target.closest(".filter-item-actions") || this._handleSelect(e);
|
|
2244
2251
|
}
|
|
2245
|
-
}), o =
|
|
2252
|
+
}), o = d("div", { className: "filter-item-header" }), n = d("span", { className: "filter-item-name" }, t.name), l = d("div", { className: "filter-item-actions" }), c = x({
|
|
2246
2253
|
icon: ue,
|
|
2247
2254
|
title: "Reset filter",
|
|
2248
2255
|
className: "btn-icon-sm",
|
|
2249
2256
|
onClick: () => this._handleReset(e)
|
|
2250
|
-
}),
|
|
2257
|
+
}), u = x({
|
|
2251
2258
|
icon: Ie,
|
|
2252
2259
|
title: "Remove filter",
|
|
2253
2260
|
className: "btn-icon-sm btn-danger",
|
|
2254
2261
|
onClick: () => this._handleRemove(e)
|
|
2255
2262
|
});
|
|
2256
|
-
l.appendChild(c), l.appendChild(
|
|
2257
|
-
const h = this.state.getFilterValues(e), p =
|
|
2263
|
+
l.appendChild(c), l.appendChild(u), o.appendChild(n), o.appendChild(l), a.appendChild(o);
|
|
2264
|
+
const h = this.state.getFilterValues(e), p = d("div", { className: "filter-item-summary" });
|
|
2258
2265
|
return p.textContent = this._getValuesSummary(t, h), a.appendChild(p), a._summaryEl = p, a;
|
|
2259
2266
|
}
|
|
2260
2267
|
/**
|
|
@@ -2463,13 +2470,13 @@ class Gt extends B {
|
|
|
2463
2470
|
* Build DOM structure
|
|
2464
2471
|
*/
|
|
2465
2472
|
_buildDOM() {
|
|
2466
|
-
this._container.innerHTML = "", this._editorEl =
|
|
2473
|
+
this._container.innerHTML = "", this._editorEl = d("div", {
|
|
2467
2474
|
className: `vanilla-image-editor ${this._state.get("isDarkMode") ? "dark" : "light"}`
|
|
2468
2475
|
});
|
|
2469
|
-
const e =
|
|
2476
|
+
const e = d("div", { className: "editor-toolbar-container" });
|
|
2470
2477
|
this._editorEl.appendChild(e), this._toolbarContainer = e;
|
|
2471
|
-
const t =
|
|
2472
|
-
this._canvasContainer =
|
|
2478
|
+
const t = d("div", { className: "editor-content" }), i = d("div", { className: "canvas-section" });
|
|
2479
|
+
this._canvasContainer = d("div", { className: "canvas-container" }), this._cropOverlay = d("canvas", { className: "crop-overlay", "aria-hidden": "true" }), i.appendChild(this._canvasContainer), i.appendChild(this._cropOverlay), t.appendChild(i), this._controlsSection = d("div", { className: "controls-section" }), t.appendChild(this._controlsSection), this._editorEl.appendChild(t), this._fileInput = d("input", {
|
|
2473
2480
|
type: "file",
|
|
2474
2481
|
accept: "image/*",
|
|
2475
2482
|
className: "hidden-file-input",
|
|
@@ -2481,9 +2488,9 @@ class Gt extends B {
|
|
|
2481
2488
|
* Initialize UI components
|
|
2482
2489
|
*/
|
|
2483
2490
|
_initUI() {
|
|
2484
|
-
this._toolbar = new Le(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl =
|
|
2491
|
+
this._toolbar = new Le(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = d("div", { className: "filter-controls-container" }), this._categoryCarousel = new De(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
|
|
2485
2492
|
}));
|
|
2486
|
-
const e =
|
|
2493
|
+
const e = d("div", { className: "filter-layout" }), t = d("div", { className: "filter-left-column" });
|
|
2487
2494
|
this._filterCarousel = new Ue(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
|
|
2488
2495
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2489
2496
|
onSelect: (r) => {
|
|
@@ -2494,7 +2501,7 @@ class Gt extends B {
|
|
|
2494
2501
|
onReset: (r) => this._handleFilterReset(r),
|
|
2495
2502
|
onAction: (r, a) => this._handleFilterAction(r, a)
|
|
2496
2503
|
})), e.appendChild(t);
|
|
2497
|
-
const i =
|
|
2504
|
+
const i = d("div", { className: "filter-right-column" });
|
|
2498
2505
|
this._activeFiltersPanel = new Ze(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
|
|
2499
2506
|
onRemove: (r) => this._handleFilterToggle(r, !1),
|
|
2500
2507
|
onReset: (r) => this._handleFilterReset(r),
|
|
@@ -2775,9 +2782,9 @@ class Gt extends B {
|
|
|
2775
2782
|
_showLoadingOverlay(e) {
|
|
2776
2783
|
var i;
|
|
2777
2784
|
if (!this._loadingOverlay)
|
|
2778
|
-
this._loadingOverlay =
|
|
2779
|
-
|
|
2780
|
-
|
|
2785
|
+
this._loadingOverlay = d("div", { className: "editor-loading-overlay" }, [
|
|
2786
|
+
d("div", { className: "editor-loading-spinner" }),
|
|
2787
|
+
d("div", { className: "editor-loading-text" }, e)
|
|
2781
2788
|
]);
|
|
2782
2789
|
else {
|
|
2783
2790
|
const r = this._loadingOverlay.querySelector(".editor-loading-text");
|
|
@@ -2797,8 +2804,8 @@ class Gt extends B {
|
|
|
2797
2804
|
* Destroy the editor and clean up
|
|
2798
2805
|
*/
|
|
2799
2806
|
destroy() {
|
|
2800
|
-
var e, t, i, r, a, o, n, l, c,
|
|
2801
|
-
(e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (
|
|
2807
|
+
var e, t, i, r, a, o, n, l, c, u;
|
|
2808
|
+
(e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (u = this._editorEl) == null || u.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
|
|
2802
2809
|
}
|
|
2803
2810
|
}
|
|
2804
2811
|
const S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
@@ -2947,8 +2954,8 @@ f({
|
|
|
2947
2954
|
return;
|
|
2948
2955
|
const l = this._customParams ?? { ...k }, c = P(n, l[o]);
|
|
2949
2956
|
l[o] = c, this._customParams = l;
|
|
2950
|
-
const
|
|
2951
|
-
o in
|
|
2957
|
+
const u = this;
|
|
2958
|
+
o in u && (u[o] = c);
|
|
2952
2959
|
} catch {
|
|
2953
2960
|
}
|
|
2954
2961
|
}, i;
|
|
@@ -2958,8 +2965,8 @@ f({
|
|
|
2958
2965
|
try {
|
|
2959
2966
|
if (!J(n))
|
|
2960
2967
|
return;
|
|
2961
|
-
const c = this._customParams ?? { ...k },
|
|
2962
|
-
c[n] =
|
|
2968
|
+
const c = this._customParams ?? { ...k }, u = P(l, c[n]);
|
|
2969
|
+
c[n] = u, this._customParams = c, ee(this, c);
|
|
2963
2970
|
} catch {
|
|
2964
2971
|
}
|
|
2965
2972
|
}, r;
|
|
@@ -3510,8 +3517,8 @@ f({
|
|
|
3510
3517
|
switch (this._customParams = l, l[o] = n, o) {
|
|
3511
3518
|
case "color":
|
|
3512
3519
|
if (typeof n == "string") {
|
|
3513
|
-
const
|
|
3514
|
-
this.color =
|
|
3520
|
+
const u = parseInt(n.replace("#", "0x"), 16);
|
|
3521
|
+
this.color = u;
|
|
3515
3522
|
}
|
|
3516
3523
|
break;
|
|
3517
3524
|
case "alpha":
|
|
@@ -4191,28 +4198,28 @@ f({
|
|
|
4191
4198
|
endY: o
|
|
4192
4199
|
}, n.updateUIParam = function(l, c) {
|
|
4193
4200
|
try {
|
|
4194
|
-
const
|
|
4195
|
-
switch (this._customParams = h, h[l] =
|
|
4201
|
+
const u = Number(c), h = this._customParams || {};
|
|
4202
|
+
switch (this._customParams = h, h[l] = u, l) {
|
|
4196
4203
|
case "blur":
|
|
4197
|
-
this.blur =
|
|
4204
|
+
this.blur = u;
|
|
4198
4205
|
break;
|
|
4199
4206
|
case "gradientBlur":
|
|
4200
|
-
this.gradientBlur =
|
|
4207
|
+
this.gradientBlur = u;
|
|
4201
4208
|
break;
|
|
4202
4209
|
case "startX":
|
|
4203
|
-
this.start && typeof this.start == "object" && (this.start.x =
|
|
4210
|
+
this.start && typeof this.start == "object" && (this.start.x = u);
|
|
4204
4211
|
break;
|
|
4205
4212
|
case "startY":
|
|
4206
|
-
this.start && typeof this.start == "object" && (this.start.y =
|
|
4213
|
+
this.start && typeof this.start == "object" && (this.start.y = u);
|
|
4207
4214
|
break;
|
|
4208
4215
|
case "endX":
|
|
4209
|
-
this.end && typeof this.end == "object" && (this.end.x =
|
|
4216
|
+
this.end && typeof this.end == "object" && (this.end.x = u);
|
|
4210
4217
|
break;
|
|
4211
4218
|
case "endY":
|
|
4212
|
-
this.end && typeof this.end == "object" && (this.end.y =
|
|
4219
|
+
this.end && typeof this.end == "object" && (this.end.y = u);
|
|
4213
4220
|
break;
|
|
4214
4221
|
default:
|
|
4215
|
-
l in this && (this[l] =
|
|
4222
|
+
l in this && (this[l] = u);
|
|
4216
4223
|
break;
|
|
4217
4224
|
}
|
|
4218
4225
|
} catch {
|
|
@@ -4526,8 +4533,8 @@ f({
|
|
|
4526
4533
|
}));
|
|
4527
4534
|
break;
|
|
4528
4535
|
case "removeColorStop":
|
|
4529
|
-
const
|
|
4530
|
-
|
|
4536
|
+
const u = [...this.stops];
|
|
4537
|
+
u.length > 2 && (u.pop(), this.stops = u, a.colorStops = this.stops.map((h) => ({
|
|
4531
4538
|
offset: h.offset,
|
|
4532
4539
|
color: typeof h.color == "number" ? "#" + h.color.toString(16).padStart(6, "0") : h.color,
|
|
4533
4540
|
alpha: h.alpha
|
|
@@ -5596,7 +5603,7 @@ f({
|
|
|
5596
5603
|
resolution: r,
|
|
5597
5604
|
kernelSize: a
|
|
5598
5605
|
}, o.updateUIParam = function(n, l) {
|
|
5599
|
-
var c,
|
|
5606
|
+
var c, u;
|
|
5600
5607
|
try {
|
|
5601
5608
|
const h = Number(l), p = this._customParams || {};
|
|
5602
5609
|
switch (this._customParams = p, p[n] = h, n) {
|
|
@@ -5604,7 +5611,7 @@ f({
|
|
|
5604
5611
|
this.strength && typeof this.strength == "object" && (this.strength.x = h, (c = this._updateStrength) == null || c.call(this));
|
|
5605
5612
|
break;
|
|
5606
5613
|
case "strengthY":
|
|
5607
|
-
this.strength && typeof this.strength == "object" && (this.strength.y = h, (
|
|
5614
|
+
this.strength && typeof this.strength == "object" && (this.strength.y = h, (u = this._updateStrength) == null || u.call(this));
|
|
5608
5615
|
break;
|
|
5609
5616
|
case "quality":
|
|
5610
5617
|
this.quality = h;
|
|
@@ -6495,8 +6502,8 @@ f({
|
|
|
6495
6502
|
break;
|
|
6496
6503
|
case "redX":
|
|
6497
6504
|
case "redY":
|
|
6498
|
-
const
|
|
6499
|
-
n === "redX" ?
|
|
6505
|
+
const u = this.red;
|
|
6506
|
+
n === "redX" ? u.x = l : u.y = l, this.red = u;
|
|
6500
6507
|
break;
|
|
6501
6508
|
case "greenX":
|
|
6502
6509
|
case "greenY":
|
|
@@ -7039,21 +7046,21 @@ f({
|
|
|
7039
7046
|
textureType: e,
|
|
7040
7047
|
color: t,
|
|
7041
7048
|
alpha: i
|
|
7042
|
-
}, l.updateUIParam = function(c,
|
|
7049
|
+
}, l.updateUIParam = function(c, u) {
|
|
7043
7050
|
try {
|
|
7044
7051
|
const h = this._customParams || {};
|
|
7045
|
-
switch (this._customParams = h, h[c] =
|
|
7052
|
+
switch (this._customParams = h, h[c] = u, c) {
|
|
7046
7053
|
case "textureType":
|
|
7047
|
-
h.textureType =
|
|
7054
|
+
h.textureType = u;
|
|
7048
7055
|
const p = document.createElement("canvas");
|
|
7049
7056
|
p.width = 256, p.height = 256;
|
|
7050
7057
|
const m = p.getContext("2d");
|
|
7051
7058
|
if (m) {
|
|
7052
|
-
if (
|
|
7059
|
+
if (u === "spotlight") {
|
|
7053
7060
|
m.fillStyle = "black", m.fillRect(0, 0, 256, 256);
|
|
7054
7061
|
const b = m.createRadialGradient(128, 128, 5, 128, 128, 80);
|
|
7055
7062
|
b.addColorStop(0, "white"), b.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), b.addColorStop(1, "rgba(0, 0, 0, 0)"), m.fillStyle = b, m.beginPath(), m.arc(128, 128, 100, 0, Math.PI * 2), m.fill();
|
|
7056
|
-
} else if (
|
|
7063
|
+
} else if (u === "softlight") {
|
|
7057
7064
|
const b = m.createLinearGradient(0, 0, 256, 256);
|
|
7058
7065
|
b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.7, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "rgba(80, 80, 80, 1)"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
|
|
7059
7066
|
} else {
|
|
@@ -7070,18 +7077,18 @@ f({
|
|
|
7070
7077
|
}
|
|
7071
7078
|
break;
|
|
7072
7079
|
case "color":
|
|
7073
|
-
h.color =
|
|
7080
|
+
h.color = u;
|
|
7074
7081
|
try {
|
|
7075
|
-
typeof
|
|
7082
|
+
typeof u == "string" && u.startsWith("#") ? this.color = parseInt(u.replace("#", "0x"), 16) : this.color = 0;
|
|
7076
7083
|
} catch {
|
|
7077
7084
|
this.color = 0;
|
|
7078
7085
|
}
|
|
7079
7086
|
break;
|
|
7080
7087
|
case "alpha":
|
|
7081
|
-
this.alpha = Number(
|
|
7088
|
+
this.alpha = Number(u);
|
|
7082
7089
|
break;
|
|
7083
7090
|
default:
|
|
7084
|
-
c in this && (this[c] =
|
|
7091
|
+
c in this && (this[c] = u);
|
|
7085
7092
|
break;
|
|
7086
7093
|
}
|
|
7087
7094
|
} catch {
|
|
@@ -7776,7 +7783,7 @@ f({
|
|
|
7776
7783
|
// Create an instance of the ShockwaveFilter with the provided parameters
|
|
7777
7784
|
createFilter: (s) => {
|
|
7778
7785
|
try {
|
|
7779
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0,
|
|
7786
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0, u = new Vt({
|
|
7780
7787
|
center: i,
|
|
7781
7788
|
amplitude: r,
|
|
7782
7789
|
wavelength: a,
|
|
@@ -7785,7 +7792,7 @@ f({
|
|
|
7785
7792
|
radius: l,
|
|
7786
7793
|
time: c
|
|
7787
7794
|
});
|
|
7788
|
-
return
|
|
7795
|
+
return u._customParams = { ...s }, u.animating = s.animating ?? !1, u.updateUIParam = function(h, p) {
|
|
7789
7796
|
const m = this._customParams || {};
|
|
7790
7797
|
switch (this._customParams = m, m[h] = p, h) {
|
|
7791
7798
|
case "centerX":
|
|
@@ -7810,7 +7817,7 @@ f({
|
|
|
7810
7817
|
break;
|
|
7811
7818
|
}
|
|
7812
7819
|
return !0;
|
|
7813
|
-
},
|
|
7820
|
+
}, u;
|
|
7814
7821
|
} catch {
|
|
7815
7822
|
return null;
|
|
7816
7823
|
}
|
|
@@ -8407,4 +8414,4 @@ export {
|
|
|
8407
8414
|
Jt as i,
|
|
8408
8415
|
f as r
|
|
8409
8416
|
};
|
|
8410
|
-
//# sourceMappingURL=editor-
|
|
8417
|
+
//# sourceMappingURL=editor-BWpslm--.js.map
|