@codingfactory/mediables-vue 2.3.3 → 2.3.5
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-BKFYai9I.cjs → PixiFrameExporter-D2kWTTVT.cjs} +2 -2
- package/dist/{PixiFrameExporter-BKFYai9I.cjs.map → PixiFrameExporter-D2kWTTVT.cjs.map} +1 -1
- package/dist/{PixiFrameExporter-w_UZwFZG.js → PixiFrameExporter-DcQaIUle.js} +2 -2
- package/dist/{PixiFrameExporter-w_UZwFZG.js.map → PixiFrameExporter-DcQaIUle.js.map} +1 -1
- package/dist/{editor-DJXRx8vN.js → editor-BgjKZltI.js} +191 -198
- package/dist/editor-BgjKZltI.js.map +1 -0
- package/dist/editor-C4OKTznp.cjs +42 -0
- package/dist/editor-C4OKTznp.cjs.map +1 -0
- package/dist/{index-j6fnH8-G.js → index-BDB5R5H_.js} +3 -3
- package/dist/{index-j6fnH8-G.js.map → index-BDB5R5H_.js.map} +1 -1
- package/dist/{index-BSiVRjOF.cjs → index-DuQmNimD.cjs} +3 -3
- package/dist/{index-BSiVRjOF.cjs.map → index-DuQmNimD.cjs.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-DAx1zj7y.cjs +0 -42
- package/dist/editor-DAx1zj7y.cjs.map +0 -1
- package/dist/editor-DJXRx8vN.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var me = Object.defineProperty;
|
|
2
2
|
var ge = (s, e, t) => e in s ? me(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var
|
|
3
|
+
var V = (s, e, t) => ge(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as g from "pixi-filters";
|
|
5
5
|
import * as w from "pixi.js";
|
|
6
6
|
import { GlProgram as be } from "pixi.js";
|
|
@@ -284,47 +284,40 @@ class xe extends B {
|
|
|
284
284
|
* @returns {string|null} Data URL
|
|
285
285
|
*/
|
|
286
286
|
exportImage(e = "png", t = 0.92, i = 0, r = !0) {
|
|
287
|
-
var
|
|
288
|
-
if (!((
|
|
287
|
+
var y;
|
|
288
|
+
if (!((y = this.app) != null && y.renderer) || !this.originalTexture || !this.sprite)
|
|
289
289
|
return null;
|
|
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
293
|
let l = o, c = n;
|
|
294
294
|
if (i > 0) {
|
|
295
|
-
const
|
|
296
|
-
let
|
|
297
|
-
r && (
|
|
298
|
-
}
|
|
299
|
-
const d = new a.Container(), h = new a.Sprite(this.originalTexture);
|
|
300
|
-
if (h.scale.set(l / o, c / n), (_ = (b = this.sprite) == null ? void 0 : b.filters) != null && _.length) {
|
|
301
|
-
const x = this.sprite.filters.map(
|
|
302
|
-
(y) => typeof (y == null ? void 0 : y.clone) == "function" ? y.clone() : y
|
|
303
|
-
);
|
|
304
|
-
h.filters = x;
|
|
295
|
+
const _ = Math.max(o, n);
|
|
296
|
+
let v = i / _;
|
|
297
|
+
r && (v = Math.min(1, v)), l = Math.round(o * v), c = Math.round(n * v);
|
|
305
298
|
}
|
|
306
|
-
d.
|
|
307
|
-
let
|
|
299
|
+
const d = this.sprite, h = d.x, p = d.y, m = d.scale.x, C = d.scale.y;
|
|
300
|
+
let b = null;
|
|
308
301
|
try {
|
|
309
|
-
if (
|
|
302
|
+
if (d.x = 0, d.y = 0, d.scale.set(l / o, c / n), b = a.RenderTexture.create({ width: l, height: c }), this.app.renderer.render({ container: this.app.stage, target: b }), !this.app.renderer.extract)
|
|
310
303
|
return null;
|
|
311
|
-
const
|
|
312
|
-
if (!
|
|
304
|
+
const _ = this.app.renderer.extract.canvas(b);
|
|
305
|
+
if (!_)
|
|
313
306
|
return null;
|
|
314
|
-
let
|
|
315
|
-
if (typeof
|
|
316
|
-
|
|
317
|
-
else if (typeof
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
|
|
307
|
+
let v = null;
|
|
308
|
+
if (typeof _.toDataURL == "function")
|
|
309
|
+
v = _.toDataURL(`image/${e}`, t);
|
|
310
|
+
else if (typeof _.getContext == "function") {
|
|
311
|
+
const M = document.createElement("canvas");
|
|
312
|
+
M.width = _.width, M.height = _.height;
|
|
313
|
+
const O = M.getContext("2d");
|
|
314
|
+
O && (O.drawImage(_, 0, 0), v = M.toDataURL(`image/${e}`, t));
|
|
322
315
|
}
|
|
323
|
-
return
|
|
316
|
+
return v || null;
|
|
324
317
|
} catch {
|
|
325
318
|
return null;
|
|
326
319
|
} finally {
|
|
327
|
-
|
|
320
|
+
d.x = h, d.y = p, d.scale.set(m, C), b && b.destroy(!0);
|
|
328
321
|
}
|
|
329
322
|
}
|
|
330
323
|
/**
|
|
@@ -575,7 +568,7 @@ class we extends B {
|
|
|
575
568
|
return this.instances[e] || null;
|
|
576
569
|
}
|
|
577
570
|
}
|
|
578
|
-
const
|
|
571
|
+
const T = class T extends B {
|
|
579
572
|
constructor(e, t) {
|
|
580
573
|
super(), this.state = e, this.renderer = t, this._overlayCanvas = null, this._isDragging = !1, this._dragStart = null, this._dragMode = null, this._startRect = null, this._hoverMode = null, this._lastAutoZoomCheck = 0, this.HANDLE_SIZE = 14, this.EDGE_HIT_PAD = 10, this._onPointerDown = this._handlePointerDown.bind(this), this._onPointerMove = this._handlePointerMove.bind(this), this._onPointerUp = this._handlePointerUp.bind(this);
|
|
581
574
|
}
|
|
@@ -652,7 +645,7 @@ const R = class R extends B {
|
|
|
652
645
|
if (!e || !r || !a || !o) return null;
|
|
653
646
|
const l = e.width > t, c = e.height > i;
|
|
654
647
|
if (!l && !c) return null;
|
|
655
|
-
const d =
|
|
648
|
+
const d = T.AUTO_ZOOM_PADDING;
|
|
656
649
|
let h = n;
|
|
657
650
|
if (l) {
|
|
658
651
|
const p = e.width / (d * r * o);
|
|
@@ -671,11 +664,11 @@ const R = class R extends B {
|
|
|
671
664
|
_checkAutoZoom() {
|
|
672
665
|
if (!this.state.get("autoZoomOnCropOverflow")) return;
|
|
673
666
|
const e = Date.now();
|
|
674
|
-
if (e - this._lastAutoZoomCheck <
|
|
667
|
+
if (e - this._lastAutoZoomCheck < T.AUTO_ZOOM_THROTTLE_MS) return;
|
|
675
668
|
this._lastAutoZoomCheck = e;
|
|
676
669
|
const t = this.state.get("crop.rect"), i = this.renderer.sprite, r = this.renderer.originalTexture;
|
|
677
670
|
if (!t || !i || !r) return;
|
|
678
|
-
const a =
|
|
671
|
+
const a = T.calcAutoZoom(
|
|
679
672
|
t,
|
|
680
673
|
i.width,
|
|
681
674
|
i.height,
|
|
@@ -703,8 +696,8 @@ const R = class R extends B {
|
|
|
703
696
|
if (!l) return;
|
|
704
697
|
const c = this.state.get("crop.shape");
|
|
705
698
|
if (n.save(), c === "circle") {
|
|
706
|
-
const
|
|
707
|
-
n.beginPath(), n.arc(
|
|
699
|
+
const y = l.x + l.width / 2, z = l.y + l.height / 2, _ = Math.min(l.width, l.height) / 2;
|
|
700
|
+
n.beginPath(), n.arc(y, z, _, 0, Math.PI * 2), n.clip();
|
|
708
701
|
} else
|
|
709
702
|
n.beginPath(), n.rect(l.x, l.y, l.width, l.height), n.clip();
|
|
710
703
|
n.clearRect(l.x, l.y, l.width, l.height), n.restore(), n.strokeStyle = "#ffffff", n.lineWidth = 2, n.setLineDash([5, 5]), c === "circle" ? (n.beginPath(), n.arc(
|
|
@@ -715,22 +708,22 @@ const R = class R extends B {
|
|
|
715
708
|
Math.PI * 2
|
|
716
709
|
), 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;
|
|
717
710
|
const d = l.width / 3, h = l.height / 3;
|
|
718
|
-
for (let
|
|
719
|
-
n.beginPath(), n.moveTo(l.x + d *
|
|
711
|
+
for (let y = 1; y <= 2; y++)
|
|
712
|
+
n.beginPath(), n.moveTo(l.x + d * y, l.y), n.lineTo(l.x + d * 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();
|
|
720
713
|
const p = this.HANDLE_SIZE, m = [
|
|
721
714
|
{ x: l.x, y: l.y, m: "resize-nw" },
|
|
722
715
|
{ x: l.x + l.width, y: l.y, m: "resize-ne" },
|
|
723
716
|
{ x: l.x, y: l.y + l.height, m: "resize-sw" },
|
|
724
717
|
{ x: l.x + l.width, y: l.y + l.height, m: "resize-se" }
|
|
725
|
-
],
|
|
718
|
+
], C = [
|
|
726
719
|
{ x: l.x + l.width / 2, y: l.y, m: "n" },
|
|
727
720
|
{ x: l.x + l.width / 2, y: l.y + l.height, m: "s" },
|
|
728
721
|
{ x: l.x, y: l.y + l.height / 2, m: "w" },
|
|
729
722
|
{ x: l.x + l.width, y: l.y + l.height / 2, m: "e" }
|
|
730
|
-
], b = [...m, ...
|
|
731
|
-
for (const
|
|
732
|
-
const
|
|
733
|
-
n.beginPath(), n.rect(
|
|
723
|
+
], b = [...m, ...C];
|
|
724
|
+
for (const y of b) {
|
|
725
|
+
const z = this._hoverMode === y.m, _ = z ? p + 4 : p;
|
|
726
|
+
n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle = z ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
|
|
734
727
|
}
|
|
735
728
|
}
|
|
736
729
|
/**
|
|
@@ -841,24 +834,24 @@ const R = class R extends B {
|
|
|
841
834
|
const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
|
|
842
835
|
if (!r || !t || !e || !i) return null;
|
|
843
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, d = (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),
|
|
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(d);
|
|
845
838
|
if (h <= 0 || p <= 0) return null;
|
|
846
|
-
const b = new a.Container(),
|
|
839
|
+
const b = new a.Container(), y = new a.Sprite(i);
|
|
847
840
|
if (this.state.get("crop.shape") === "circle") {
|
|
848
|
-
const
|
|
849
|
-
m = Math.round(
|
|
850
|
-
const
|
|
851
|
-
typeof
|
|
841
|
+
const M = Math.round(Math.max(h, p)), O = m + h / 2, fe = C + p / 2;
|
|
842
|
+
m = Math.round(O - M / 2), C = Math.round(fe - M / 2), h = p = M;
|
|
843
|
+
const F = new a.Graphics();
|
|
844
|
+
typeof F.circle == "function" && typeof F.fill == "function" ? F.circle(h / 2, p / 2, h / 2).fill(16777215) : (F.beginFill(16777215, 1), F.drawCircle(h / 2, p / 2, h / 2), F.endFill()), y.mask = F, b.addChild(F);
|
|
852
845
|
}
|
|
853
|
-
|
|
854
|
-
const
|
|
846
|
+
y.x = -m, y.y = -C, b.addChild(y);
|
|
847
|
+
const _ = a.RenderTexture.create({ width: h, height: p });
|
|
855
848
|
e.renderer.render({
|
|
856
849
|
container: b,
|
|
857
|
-
target:
|
|
850
|
+
target: _,
|
|
858
851
|
clear: !0
|
|
859
|
-
}), b.destroy({ children: !0 }), this.renderer.originalTexture =
|
|
860
|
-
const
|
|
861
|
-
return e.stage.addChild(
|
|
852
|
+
}), b.destroy({ children: !0 }), this.renderer.originalTexture = _, e.stage.removeChild(t), t.destroy();
|
|
853
|
+
const v = new a.Sprite(_);
|
|
854
|
+
return e.stage.addChild(v), this.renderer.sprite = v, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), this.disable(), this.emit("applied", { width: h, height: p }), { texture: _, preservedZoom: o };
|
|
862
855
|
}
|
|
863
856
|
/**
|
|
864
857
|
* Cancel crop
|
|
@@ -885,11 +878,11 @@ const R = class R extends B {
|
|
|
885
878
|
* Padding factor for auto-zoom: image will be ~91% of crop size (1/1.1).
|
|
886
879
|
* Higher values = more aggressive zoom-out, more padding around image.
|
|
887
880
|
*/
|
|
888
|
-
|
|
881
|
+
V(T, "AUTO_ZOOM_PADDING", 1.1), /**
|
|
889
882
|
* Minimum interval (ms) between auto-zoom adjustments during drag.
|
|
890
883
|
*/
|
|
891
|
-
|
|
892
|
-
let
|
|
884
|
+
V(T, "AUTO_ZOOM_THROTTLE_MS", 100);
|
|
885
|
+
let $ = T;
|
|
893
886
|
class Se {
|
|
894
887
|
/**
|
|
895
888
|
* Create a new RemoveBgManager
|
|
@@ -1016,7 +1009,7 @@ function u(s, e = {}, ...t) {
|
|
|
1016
1009
|
typeof r == "string" ? i.appendChild(document.createTextNode(r)) : r instanceof HTMLElement && i.appendChild(r);
|
|
1017
1010
|
return i;
|
|
1018
1011
|
}
|
|
1019
|
-
function
|
|
1012
|
+
function ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
|
|
1020
1013
|
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = u("div", {
|
|
1021
1014
|
className: "slider-control slider-wrapper",
|
|
1022
1015
|
"data-control": n,
|
|
@@ -1025,7 +1018,7 @@ function se({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1025
1018
|
"div",
|
|
1026
1019
|
{ className: "slider-header" },
|
|
1027
1020
|
u("label", { for: s, className: "slider-label" }, e),
|
|
1028
|
-
u("span", { className: "slider-value", id: `${s}-value` },
|
|
1021
|
+
u("span", { className: "slider-value", id: `${s}-value` }, j(a))
|
|
1029
1022
|
), d = u("input", {
|
|
1030
1023
|
type: "range",
|
|
1031
1024
|
id: s,
|
|
@@ -1036,19 +1029,19 @@ function se({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1036
1029
|
value: String(a),
|
|
1037
1030
|
onInput: (h) => {
|
|
1038
1031
|
const p = parseFloat(h.target.value), m = l.querySelector(".slider-value");
|
|
1039
|
-
m && (m.textContent =
|
|
1032
|
+
m && (m.textContent = j(p)), o == null || o(p);
|
|
1040
1033
|
}
|
|
1041
1034
|
});
|
|
1042
1035
|
return l.appendChild(c), l.appendChild(d), l.setValue = (h) => {
|
|
1043
1036
|
d.value = String(h);
|
|
1044
1037
|
const p = l.querySelector(".slider-value");
|
|
1045
|
-
p && (p.textContent =
|
|
1038
|
+
p && (p.textContent = j(h));
|
|
1046
1039
|
}, l;
|
|
1047
1040
|
}
|
|
1048
|
-
function
|
|
1041
|
+
function j(s) {
|
|
1049
1042
|
return Number.isInteger(s) ? String(s) : s.toFixed(2);
|
|
1050
1043
|
}
|
|
1051
|
-
function
|
|
1044
|
+
function oe({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
1052
1045
|
const r = u("div", { className: "toggle-control" }), a = u("label", { className: "toggle-label", for: s }, e), o = u("input", {
|
|
1053
1046
|
type: "checkbox",
|
|
1054
1047
|
id: s,
|
|
@@ -1065,7 +1058,7 @@ function ae({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
|
1065
1058
|
o.checked = c;
|
|
1066
1059
|
}, r;
|
|
1067
1060
|
}
|
|
1068
|
-
function
|
|
1061
|
+
function ne({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
1069
1062
|
const r = u("div", { className: "color-control" }), a = u("label", { className: "color-label", for: s }, e), o = u("input", {
|
|
1070
1063
|
type: "color",
|
|
1071
1064
|
id: s,
|
|
@@ -1077,7 +1070,7 @@ function oe({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
|
1077
1070
|
o.value = n;
|
|
1078
1071
|
}, r;
|
|
1079
1072
|
}
|
|
1080
|
-
function
|
|
1073
|
+
function le({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
1081
1074
|
const a = u("div", { className: "select-control" }), o = u("label", { className: "select-label", for: s }, e), n = u("select", {
|
|
1082
1075
|
id: s,
|
|
1083
1076
|
className: "select-input",
|
|
@@ -1091,7 +1084,7 @@ function ne({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
|
1091
1084
|
n.value = l;
|
|
1092
1085
|
}, a;
|
|
1093
1086
|
}
|
|
1094
|
-
function
|
|
1087
|
+
function A({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
|
|
1095
1088
|
const a = u("button", {
|
|
1096
1089
|
type: "button",
|
|
1097
1090
|
className: `btn ${e}`.trim(),
|
|
@@ -1106,7 +1099,7 @@ function F({ label: s, className: e = "", onClick: t, icon: i = null, disabled:
|
|
|
1106
1099
|
}
|
|
1107
1100
|
return s && a.appendChild(document.createTextNode(s)), a;
|
|
1108
1101
|
}
|
|
1109
|
-
function
|
|
1102
|
+
function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1, testId: a = null, ariaLabel: o = null }) {
|
|
1110
1103
|
const n = {
|
|
1111
1104
|
type: "button",
|
|
1112
1105
|
className: `icon-btn ${t}`.trim(),
|
|
@@ -1121,7 +1114,7 @@ function C({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1,
|
|
|
1121
1114
|
const c = l.querySelector("svg");
|
|
1122
1115
|
return c && c.setAttribute("aria-hidden", "true"), l;
|
|
1123
1116
|
}
|
|
1124
|
-
function
|
|
1117
|
+
function W({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
1125
1118
|
const r = u("button", {
|
|
1126
1119
|
type: "button",
|
|
1127
1120
|
className: `chip ${t ? "active" : ""}`.trim(),
|
|
@@ -1137,7 +1130,7 @@ function $({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
|
1137
1130
|
r.classList.toggle("active", a);
|
|
1138
1131
|
}, r;
|
|
1139
1132
|
}
|
|
1140
|
-
const
|
|
1133
|
+
const ce = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M328 112L184 256l144 144"/></svg>', he = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M184 112l144 144-144 144"/></svg>', ve = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M256 184v74m-37-37h74"/></svg>', ke = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M184 221h74"/></svg>', Pe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M432 320v112H320M80 192V80h112M320 80h112v112M192 432H80V320"/></svg>', Me = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M262.29 192.31a64 64 0 1057.4 57.4 64.13 64.13 0 00-57.4-57.4z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416.39 256a154.34 154.34 0 01-1.53 20.79l45.21 35.46a10.81 10.81 0 012.45 13.75l-42.77 74a10.81 10.81 0 01-13.14 4.59l-44.9-18.08a16.11 16.11 0 00-15.17 1.75A164.48 164.48 0 01325 400.8a15.94 15.94 0 00-8.82 12.14l-6.73 47.89a11.08 11.08 0 01-10.68 9.17h-85.54a11.11 11.11 0 01-10.69-8.87l-6.72-47.82a16.07 16.07 0 00-9-12.22 155.3 155.3 0 01-21.46-12.57 16 16 0 00-15.11-1.71l-44.89 18.07a10.81 10.81 0 01-13.14-4.58l-42.77-74a10.8 10.8 0 012.45-13.75l38.21-30a16.05 16.05 0 006-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 00-6.07-13.94l-38.19-30A10.81 10.81 0 0149.48 186l42.77-74a10.81 10.81 0 0113.14-4.59l44.9 18.08a16.11 16.11 0 0015.17-1.75A164.48 164.48 0 01187 111.2a15.94 15.94 0 008.82-12.14l6.73-47.89A11.08 11.08 0 01213.23 42h85.54a11.11 11.11 0 0110.69 8.87l6.72 47.82a16.07 16.07 0 009 12.22 155.3 155.3 0 0121.46 12.57 16 16 0 0015.11 1.71l44.89-18.07a10.81 10.81 0 0113.14 4.58l42.77 74a10.8 10.8 0 01-2.45 13.75l-38.21 30a16.05 16.05 0 00-6.05 14.08c.33 4.14.55 8.3.55 12.47z"/></svg>', Fe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M400 320c0 88.37-55.63 144-144 144s-144-55.63-144-144c0-94.83 103.23-222.85 134.89-259.88a12 12 0 0118.23 0C296.77 97.15 400 225.17 400 320z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M344 328a72 72 0 01-72 72"/></svg>', Ae = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32" d="M430.11 347.9c-6.6-6.1-16.3-7.6-24.6-9-11.5-1.9-15.9-4-22.6-10-14.3-12.7-14.3-31.1 0-43.8l30.3-26.9c46.4-41 46.4-108.2 0-149.2-34.2-30.1-80.1-45-127.8-45-55.7 0-113.9 20.3-158.8 60.1-83.5 73.8-83.5 194.7 0 268.5 41.5 36.7 97.5 55 152.9 55.4h1.7c55.4 0 110-17.9 148.8-52.4 14.4-12.7 11.99-36.6.1-47.7z"/><circle cx="144" cy="208" r="32"/><circle cx="152" cy="311" r="32"/><circle cx="224" cy="144" r="32"/><circle cx="256" cy="367" r="32"/><circle cx="328" cy="144" r="32"/></svg>', ze = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M259.92 262.91L216.4 149.77a9 9 0 00-16.8 0l-43.52 113.14a9 9 0 01-5.17 5.17L37.77 311.6a9 9 0 000 16.8l113.14 43.52a9 9 0 015.17 5.17l43.52 113.14a9 9 0 0016.8 0l43.52-113.14a9 9 0 015.17-5.17l113.14-43.52a9 9 0 000-16.8l-113.14-43.52a9 9 0 01-5.17-5.17zM108 68L88 16 68 68 16 88l52 20 20 52 20-52 52-20-52-20zM426.67 117.33L400 48l-26.67 69.33L304 144l69.33 26.67L400 240l26.67-69.33L496 144l-69.33-26.67z"/></svg>', Ne = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></svg>', Re = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M315.27 33L96 304h128l-31.51 173.23a2.36 2.36 0 002.33 2.77h0a2.36 2.36 0 001.89-.95L416 208H288l31.66-173.25a2.45 2.45 0 00-2.44-2.75h0a2.42 2.42 0 00-1.95 1z"/></svg>', de = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M144 48v272a48 48 0 0048 48h272"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 464V192a48 48 0 00-48-48H48"/></svg>', Te = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M380.93 57.37A32 32 0 00358.3 48H94.22A46.21 46.21 0 0048 94.22v323.56A46.21 46.21 0 0094.22 464h323.56A46.36 46.36 0 00464 417.78V153.7a32 32 0 00-9.37-22.63zM256 416a64 64 0 1164-64 63.92 63.92 0 01-64 64zm48-224H112a16 16 0 01-16-16v-64a16 16 0 0116-16h192a16 16 0 0116 16v64a16 16 0 01-16 16z"/></svg>', G = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 368L144 144M368 144L144 368"/></svg>', ue = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M320 146s24.36-12-64-12a160 160 0 10160 160"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M256 58l80 80-80 80"/></svg>', Ie = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M80 112h352"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M192 112V72h0a23.93 23.93 0 0124-24h80a23.93 23.93 0 0124 24h0v40M256 176v224M184 176l8 224M328 176l-8 224"/></svg>', Ee = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M64 192v-72a40 40 0 0140-40h75.89a40 40 0 0122.19 6.72l27.84 18.56a40 40 0 0022.19 6.72H408a40 40 0 0140 40v40"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M479.9 226.55L463.68 392a40 40 0 01-39.93 40H88.25a40 40 0 01-39.93-40L32.1 226.55A32 32 0 0164 192h384.1a32 32 0 0131.8 34.55z"/></svg>', Z = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416 128L192 384l-96-96"/></svg>', Xe = '<svg viewBox="0 0 512 512" width="20" height="20"><rect x="64" y="64" width="384" height="384" rx="48" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32"/></svg>', Ye = '<svg viewBox="0 0 512 512" width="20" height="20"><circle cx="256" cy="256" r="208" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/></svg>', Be = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M80 96h64l64 320h64l64-160h96"/></svg>', K = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M256 48v48M256 416v48M403.08 108.92l-33.94 33.94M142.86 369.14l-33.94 33.94M464 256h-48M96 256H48M403.08 403.08l-33.94-33.94M142.86 142.86l-33.94-33.94"/><circle cx="256" cy="256" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32"/></svg>', Q = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M160 136c0-30.62 4.51-61.61 16-88C99.57 81.27 48 159.32 48 248c0 119.29 96.71 216 216 216 88.68 0 166.73-51.57 200-128-26.39 11.49-57.38 16-88 16-119.29 0-216-96.71-216-216z"/></svg>', Oe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M436 80H76a44.05 44.05 0 00-44 44v264a44.05 44.05 0 0044 44h360a44.05 44.05 0 0044-44V124a44.05 44.05 0 00-44-44z"/><circle cx="256" cy="256" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M220 80v56M292 80v56M220 376v56M292 376v56M80 144h56M80 224h56M80 304h56M376 144h56M376 224h56M376 304h56"/></svg>';
|
|
1141
1134
|
class Le {
|
|
1142
1135
|
constructor(e, t) {
|
|
1143
1136
|
this.state = e, this.editor = t, this.element = null, this._unsubscribers = [];
|
|
@@ -1148,7 +1141,7 @@ class Le {
|
|
|
1148
1141
|
*/
|
|
1149
1142
|
render() {
|
|
1150
1143
|
this.element = u("div", { className: "editor-toolbar" });
|
|
1151
|
-
const e = u("div", { className: "toolbar-section toolbar-left" }), t =
|
|
1144
|
+
const e = u("div", { className: "toolbar-section toolbar-left" }), t = x({
|
|
1152
1145
|
icon: Ee,
|
|
1153
1146
|
title: "Open Image",
|
|
1154
1147
|
className: "toolbar-btn",
|
|
@@ -1157,7 +1150,7 @@ class Le {
|
|
|
1157
1150
|
onClick: () => this.editor.openFilePicker()
|
|
1158
1151
|
});
|
|
1159
1152
|
e.appendChild(t);
|
|
1160
|
-
const i = u("div", { className: "toolbar-section toolbar-center" }), r =
|
|
1153
|
+
const i = u("div", { className: "toolbar-section toolbar-center" }), r = x({
|
|
1161
1154
|
icon: ke,
|
|
1162
1155
|
title: "Zoom Out",
|
|
1163
1156
|
className: "toolbar-btn",
|
|
@@ -1174,7 +1167,7 @@ class Le {
|
|
|
1174
1167
|
"aria-atomic": "true",
|
|
1175
1168
|
role: "status"
|
|
1176
1169
|
}, "100%");
|
|
1177
|
-
const a =
|
|
1170
|
+
const a = x({
|
|
1178
1171
|
icon: ve,
|
|
1179
1172
|
title: "Zoom In",
|
|
1180
1173
|
className: "toolbar-btn",
|
|
@@ -1184,7 +1177,7 @@ class Le {
|
|
|
1184
1177
|
const h = this.state.get("zoom");
|
|
1185
1178
|
this.editor.setZoom(h + 0.25);
|
|
1186
1179
|
}
|
|
1187
|
-
}), o =
|
|
1180
|
+
}), o = x({
|
|
1188
1181
|
icon: Pe,
|
|
1189
1182
|
title: "Fit to Screen",
|
|
1190
1183
|
className: "toolbar-btn",
|
|
@@ -1194,15 +1187,15 @@ class Le {
|
|
|
1194
1187
|
});
|
|
1195
1188
|
i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
|
|
1196
1189
|
const n = u("div", { className: "toolbar-section toolbar-right" });
|
|
1197
|
-
this._themeBtn =
|
|
1198
|
-
icon: this.state.get("isDarkMode") ?
|
|
1190
|
+
this._themeBtn = x({
|
|
1191
|
+
icon: this.state.get("isDarkMode") ? K : Q,
|
|
1199
1192
|
title: "Toggle Theme",
|
|
1200
1193
|
className: "toolbar-btn toolbar-btn-theme",
|
|
1201
1194
|
testId: "btn-toggle-theme",
|
|
1202
1195
|
ariaLabel: "Toggle theme",
|
|
1203
1196
|
onClick: () => this.editor.toggleTheme()
|
|
1204
|
-
}), this._cropBtn =
|
|
1205
|
-
icon:
|
|
1197
|
+
}), this._cropBtn = x({
|
|
1198
|
+
icon: de,
|
|
1206
1199
|
title: "Crop",
|
|
1207
1200
|
className: "toolbar-btn toolbar-btn-crop",
|
|
1208
1201
|
testId: "btn-crop",
|
|
@@ -1211,22 +1204,22 @@ class Le {
|
|
|
1211
1204
|
this.state.get("mode") === "crop" ? this.editor.setMode("filters") : this.editor.setMode("crop");
|
|
1212
1205
|
}
|
|
1213
1206
|
});
|
|
1214
|
-
const l =
|
|
1215
|
-
icon:
|
|
1207
|
+
const l = x({
|
|
1208
|
+
icon: ue,
|
|
1216
1209
|
title: "Reset All",
|
|
1217
1210
|
className: "toolbar-btn",
|
|
1218
1211
|
testId: "btn-reset-all",
|
|
1219
1212
|
ariaLabel: "Reset all changes",
|
|
1220
1213
|
onClick: () => this.editor.resetAll()
|
|
1221
|
-
}), c =
|
|
1214
|
+
}), c = x({
|
|
1222
1215
|
icon: Te,
|
|
1223
1216
|
title: "Save Image",
|
|
1224
1217
|
className: "toolbar-btn toolbar-btn-primary",
|
|
1225
1218
|
testId: "btn-save-edit",
|
|
1226
1219
|
ariaLabel: "Save image",
|
|
1227
1220
|
onClick: () => this.editor.save()
|
|
1228
|
-
}), d =
|
|
1229
|
-
icon:
|
|
1221
|
+
}), d = x({
|
|
1222
|
+
icon: G,
|
|
1230
1223
|
title: "Close",
|
|
1231
1224
|
className: "toolbar-btn",
|
|
1232
1225
|
testId: "btn-cancel-edit",
|
|
@@ -1244,7 +1237,7 @@ class Le {
|
|
|
1244
1237
|
});
|
|
1245
1238
|
this._unsubscribers.push(e);
|
|
1246
1239
|
const t = this.state.on("change:isDarkMode", ({ value: r }) => {
|
|
1247
|
-
this._themeBtn.innerHTML = r ?
|
|
1240
|
+
this._themeBtn.innerHTML = r ? K : Q;
|
|
1248
1241
|
});
|
|
1249
1242
|
this._unsubscribers.push(t);
|
|
1250
1243
|
const i = this.state.on("change:mode", ({ value: r }) => {
|
|
@@ -1267,7 +1260,7 @@ class Le {
|
|
|
1267
1260
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], (e = this.element) == null || e.remove(), this.element = null;
|
|
1268
1261
|
}
|
|
1269
1262
|
}
|
|
1270
|
-
const
|
|
1263
|
+
const L = [
|
|
1271
1264
|
{ id: "adjust", name: "Adjust", icon: Me },
|
|
1272
1265
|
// adjustment, adjustmentAdvanced, alpha
|
|
1273
1266
|
{ id: "blur", name: "Blur", icon: Fe },
|
|
@@ -1282,7 +1275,7 @@ const O = [
|
|
|
1282
1275
|
// bloom, glow, godray, advancedBloom
|
|
1283
1276
|
{ id: "stylize", name: "Stylize", icon: Oe },
|
|
1284
1277
|
// ascii, crt, crossHatch, dot, emboss
|
|
1285
|
-
{ id: "crop", name: "Crop", icon:
|
|
1278
|
+
{ id: "crop", name: "Crop", icon: de }
|
|
1286
1279
|
];
|
|
1287
1280
|
class De {
|
|
1288
1281
|
constructor(e, t) {
|
|
@@ -1297,21 +1290,21 @@ class De {
|
|
|
1297
1290
|
this._onSelect = e, this.element = u("div", {
|
|
1298
1291
|
className: "category-carousel-container",
|
|
1299
1292
|
"data-testid": "category-carousel"
|
|
1300
|
-
}), this._leftBtn =
|
|
1301
|
-
icon:
|
|
1293
|
+
}), this._leftBtn = x({
|
|
1294
|
+
icon: ce,
|
|
1302
1295
|
title: "Previous categories",
|
|
1303
1296
|
className: "carousel-nav carousel-nav-left",
|
|
1304
1297
|
onClick: () => this._scrollLeft()
|
|
1305
|
-
}), this._carousel = u("div", { className: "category-carousel" }),
|
|
1306
|
-
const r =
|
|
1298
|
+
}), this._carousel = u("div", { className: "category-carousel" }), L.forEach((i) => {
|
|
1299
|
+
const r = W({
|
|
1307
1300
|
label: i.name,
|
|
1308
1301
|
icon: i.icon,
|
|
1309
1302
|
active: this.state.get("selectedCategory") === i.id,
|
|
1310
1303
|
onClick: () => this._selectCategory(i.id)
|
|
1311
1304
|
});
|
|
1312
1305
|
r.dataset.categoryId = i.id, r.dataset.category = i.id, r.dataset.testid = `category-${i.id}`, this._chips.set(i.id, r), this._carousel.appendChild(r);
|
|
1313
|
-
}), this._rightBtn =
|
|
1314
|
-
icon:
|
|
1306
|
+
}), this._rightBtn = x({
|
|
1307
|
+
icon: he,
|
|
1315
1308
|
title: "Next categories",
|
|
1316
1309
|
className: "carousel-nav carousel-nav-right",
|
|
1317
1310
|
onClick: () => this._scrollRight()
|
|
@@ -1320,7 +1313,7 @@ class De {
|
|
|
1320
1313
|
role: "tablist",
|
|
1321
1314
|
"aria-label": "Category pages"
|
|
1322
1315
|
});
|
|
1323
|
-
const t = Math.ceil(
|
|
1316
|
+
const t = Math.ceil(L.length / 3);
|
|
1324
1317
|
for (let i = 0; i < t; i++) {
|
|
1325
1318
|
const r = u("button", {
|
|
1326
1319
|
type: "button",
|
|
@@ -1363,7 +1356,7 @@ class De {
|
|
|
1363
1356
|
* Scroll carousel right
|
|
1364
1357
|
*/
|
|
1365
1358
|
_scrollRight() {
|
|
1366
|
-
this._scrollIndex <
|
|
1359
|
+
this._scrollIndex < L.length - 3 && (this._scrollIndex++, this._scrollCarousel());
|
|
1367
1360
|
}
|
|
1368
1361
|
/**
|
|
1369
1362
|
* Scroll to a specific page
|
|
@@ -1390,7 +1383,7 @@ class De {
|
|
|
1390
1383
|
* Update navigation button states
|
|
1391
1384
|
*/
|
|
1392
1385
|
_updateNavButtons() {
|
|
1393
|
-
this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >=
|
|
1386
|
+
this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >= L.length - 3);
|
|
1394
1387
|
}
|
|
1395
1388
|
/**
|
|
1396
1389
|
* Update pagination dot states
|
|
@@ -1429,13 +1422,13 @@ class Ue {
|
|
|
1429
1422
|
* @returns {HTMLElement}
|
|
1430
1423
|
*/
|
|
1431
1424
|
render({ onToggle: e, onSelect: t }) {
|
|
1432
|
-
return this._onToggle = e, this._onSelect = t, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn =
|
|
1433
|
-
icon:
|
|
1425
|
+
return this._onToggle = e, this._onSelect = t, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn = x({
|
|
1426
|
+
icon: ce,
|
|
1434
1427
|
title: "Previous filters",
|
|
1435
1428
|
className: "carousel-nav carousel-nav-left",
|
|
1436
1429
|
onClick: () => this._scrollLeft()
|
|
1437
|
-
}), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn =
|
|
1438
|
-
icon:
|
|
1430
|
+
}), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn = x({
|
|
1431
|
+
icon: he,
|
|
1439
1432
|
title: "Next filters",
|
|
1440
1433
|
className: "carousel-nav carousel-nav-right",
|
|
1441
1434
|
onClick: () => this._scrollRight()
|
|
@@ -1497,7 +1490,7 @@ class Ue {
|
|
|
1497
1490
|
this._handleToggle(e.id, h), h && (this.state.set("selectedFilter", e.id), (p = this._onSelect) == null || p.call(this, e.id));
|
|
1498
1491
|
}
|
|
1499
1492
|
});
|
|
1500
|
-
return l.innerHTML = t ?
|
|
1493
|
+
return l.innerHTML = t ? Z : "", r.appendChild(a), r.appendChild(n), r.appendChild(l), r._toggle = l, r._isActive = t, r;
|
|
1501
1494
|
}
|
|
1502
1495
|
/**
|
|
1503
1496
|
* Handle filter card click (select)
|
|
@@ -1523,7 +1516,7 @@ class Ue {
|
|
|
1523
1516
|
const e = this.state.get("activeFilters");
|
|
1524
1517
|
this._filterCards.forEach((t, i) => {
|
|
1525
1518
|
const r = e.has(i);
|
|
1526
|
-
t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ?
|
|
1519
|
+
t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ? Z : "", t._isActive = r;
|
|
1527
1520
|
});
|
|
1528
1521
|
}
|
|
1529
1522
|
/**
|
|
@@ -1621,7 +1614,7 @@ class Ve {
|
|
|
1621
1614
|
return;
|
|
1622
1615
|
}
|
|
1623
1616
|
const i = u("div", { className: "adjustments-header" });
|
|
1624
|
-
i.appendChild(u("span", { className: "adjustments-title" }, t.name)), i.appendChild(
|
|
1617
|
+
i.appendChild(u("span", { className: "adjustments-title" }, t.name)), i.appendChild(A({
|
|
1625
1618
|
label: "Reset",
|
|
1626
1619
|
className: "btn-text",
|
|
1627
1620
|
onClick: () => this._handleReset(e)
|
|
@@ -1644,7 +1637,7 @@ class Ve {
|
|
|
1644
1637
|
const r = t.label || t.id;
|
|
1645
1638
|
switch (this._normalizeControlType(t.type)) {
|
|
1646
1639
|
case "slider":
|
|
1647
|
-
return
|
|
1640
|
+
return ae({
|
|
1648
1641
|
id: `${e}-${t.id}`,
|
|
1649
1642
|
label: r,
|
|
1650
1643
|
min: t.min ?? 0,
|
|
@@ -1654,14 +1647,14 @@ class Ve {
|
|
|
1654
1647
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1655
1648
|
});
|
|
1656
1649
|
case "toggle":
|
|
1657
|
-
return
|
|
1650
|
+
return oe({
|
|
1658
1651
|
id: `${e}-${t.id}`,
|
|
1659
1652
|
label: r,
|
|
1660
1653
|
checked: !!i,
|
|
1661
1654
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1662
1655
|
});
|
|
1663
1656
|
case "color":
|
|
1664
|
-
return
|
|
1657
|
+
return ne({
|
|
1665
1658
|
id: `${e}-${t.id}`,
|
|
1666
1659
|
label: r,
|
|
1667
1660
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1669,7 +1662,7 @@ class Ve {
|
|
|
1669
1662
|
});
|
|
1670
1663
|
case "select":
|
|
1671
1664
|
const o = this._normalizeOptions(t.options);
|
|
1672
|
-
return
|
|
1665
|
+
return le({
|
|
1673
1666
|
id: `${e}-${t.id}`,
|
|
1674
1667
|
label: r,
|
|
1675
1668
|
options: o,
|
|
@@ -1678,7 +1671,7 @@ class Ve {
|
|
|
1678
1671
|
});
|
|
1679
1672
|
case "button":
|
|
1680
1673
|
const n = u("div", { className: "button-control" });
|
|
1681
|
-
return n.appendChild(
|
|
1674
|
+
return n.appendChild(A({
|
|
1682
1675
|
label: r,
|
|
1683
1676
|
className: "btn-secondary",
|
|
1684
1677
|
onClick: () => this._handleAction(e, t.action || t.id)
|
|
@@ -1792,22 +1785,22 @@ class je {
|
|
|
1792
1785
|
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = u("div", { className: "mobile-filter-drawer" });
|
|
1793
1786
|
const o = u("div", { className: "drawer-header" });
|
|
1794
1787
|
this._titleEl = u("span", { className: "drawer-title" }, "Filter");
|
|
1795
|
-
const n = u("div", { className: "drawer-header-actions" }), l =
|
|
1788
|
+
const n = u("div", { className: "drawer-header-actions" }), l = A({
|
|
1796
1789
|
label: "Reset",
|
|
1797
1790
|
className: "btn-text",
|
|
1798
1791
|
onClick: () => {
|
|
1799
1792
|
var h;
|
|
1800
1793
|
this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
|
|
1801
1794
|
}
|
|
1802
|
-
}), c =
|
|
1795
|
+
}), c = A({
|
|
1803
1796
|
label: "Remove",
|
|
1804
1797
|
className: "btn-text btn-danger",
|
|
1805
1798
|
onClick: () => {
|
|
1806
1799
|
var h;
|
|
1807
1800
|
this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
|
|
1808
1801
|
}
|
|
1809
|
-
}), d =
|
|
1810
|
-
icon:
|
|
1802
|
+
}), d = x({
|
|
1803
|
+
icon: G,
|
|
1811
1804
|
title: "Close",
|
|
1812
1805
|
className: "btn-icon-sm",
|
|
1813
1806
|
ariaLabel: "Close drawer",
|
|
@@ -1881,7 +1874,7 @@ class je {
|
|
|
1881
1874
|
const r = t.label || t.id;
|
|
1882
1875
|
switch (this._normalizeControlType(t.type)) {
|
|
1883
1876
|
case "slider":
|
|
1884
|
-
return
|
|
1877
|
+
return ae({
|
|
1885
1878
|
id: `drawer-${e}-${t.id}`,
|
|
1886
1879
|
label: r,
|
|
1887
1880
|
min: t.min ?? 0,
|
|
@@ -1894,7 +1887,7 @@ class je {
|
|
|
1894
1887
|
}
|
|
1895
1888
|
});
|
|
1896
1889
|
case "toggle":
|
|
1897
|
-
return
|
|
1890
|
+
return oe({
|
|
1898
1891
|
id: `drawer-${e}-${t.id}`,
|
|
1899
1892
|
label: r,
|
|
1900
1893
|
checked: !!i,
|
|
@@ -1904,7 +1897,7 @@ class je {
|
|
|
1904
1897
|
}
|
|
1905
1898
|
});
|
|
1906
1899
|
case "color":
|
|
1907
|
-
return
|
|
1900
|
+
return ne({
|
|
1908
1901
|
id: `drawer-${e}-${t.id}`,
|
|
1909
1902
|
label: r,
|
|
1910
1903
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1915,7 +1908,7 @@ class je {
|
|
|
1915
1908
|
});
|
|
1916
1909
|
case "select": {
|
|
1917
1910
|
const o = this._normalizeOptions(t.options);
|
|
1918
|
-
return
|
|
1911
|
+
return le({
|
|
1919
1912
|
id: `drawer-${e}-${t.id}`,
|
|
1920
1913
|
label: r,
|
|
1921
1914
|
options: o,
|
|
@@ -1928,7 +1921,7 @@ class je {
|
|
|
1928
1921
|
}
|
|
1929
1922
|
case "button": {
|
|
1930
1923
|
const o = u("div", { className: "button-control" });
|
|
1931
|
-
return o.appendChild(
|
|
1924
|
+
return o.appendChild(A({
|
|
1932
1925
|
label: r,
|
|
1933
1926
|
className: "btn-secondary",
|
|
1934
1927
|
onClick: () => {
|
|
@@ -2077,7 +2070,7 @@ class We {
|
|
|
2077
2070
|
e.appendChild(u("label", { className: "section-label" }, "Shape"));
|
|
2078
2071
|
const t = u("div", { className: "chip-row" }), i = this.state.get("crop.shape");
|
|
2079
2072
|
He.forEach((c) => {
|
|
2080
|
-
const d =
|
|
2073
|
+
const d = W({
|
|
2081
2074
|
label: c.name,
|
|
2082
2075
|
icon: c.icon,
|
|
2083
2076
|
active: i === c.id,
|
|
@@ -2087,24 +2080,24 @@ class We {
|
|
|
2087
2080
|
}), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = u("div", { className: "crop-section" }), this._aspectSection.appendChild(u("label", { className: "section-label" }, "Aspect Ratio"));
|
|
2088
2081
|
const r = u("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
|
|
2089
2082
|
$e.forEach((c) => {
|
|
2090
|
-
const d =
|
|
2083
|
+
const d = W({
|
|
2091
2084
|
label: c.name,
|
|
2092
2085
|
active: a === c.id,
|
|
2093
2086
|
onClick: () => this._selectAspect(c.id)
|
|
2094
2087
|
});
|
|
2095
2088
|
d.dataset.ratio = c.id, d.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, d), r.appendChild(d);
|
|
2096
2089
|
}), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
|
|
2097
|
-
const o = u("div", { className: "crop-actions" }), n =
|
|
2090
|
+
const o = u("div", { className: "crop-actions" }), n = A({
|
|
2098
2091
|
label: "Cancel",
|
|
2099
2092
|
className: "btn-secondary crop-cancel-btn",
|
|
2100
|
-
icon:
|
|
2093
|
+
icon: G,
|
|
2101
2094
|
onClick: () => this.cropManager.cancel()
|
|
2102
2095
|
});
|
|
2103
2096
|
n.dataset.testid = "cancel-crop";
|
|
2104
|
-
const l =
|
|
2097
|
+
const l = A({
|
|
2105
2098
|
label: "Apply Crop",
|
|
2106
2099
|
className: "btn-primary crop-apply-btn",
|
|
2107
|
-
icon:
|
|
2100
|
+
icon: Z,
|
|
2108
2101
|
onClick: () => this.cropManager.apply()
|
|
2109
2102
|
});
|
|
2110
2103
|
return l.dataset.testid = "apply-crop", o.appendChild(n), o.appendChild(l), this.element.appendChild(o), this._subscribeToState(), this.element;
|
|
@@ -2183,7 +2176,7 @@ class Ze {
|
|
|
2183
2176
|
});
|
|
2184
2177
|
const o = u("div", { className: "panel-header" });
|
|
2185
2178
|
o.appendChild(u("h3", { className: "panel-title" }, "Active Filters"));
|
|
2186
|
-
const n =
|
|
2179
|
+
const n = A({
|
|
2187
2180
|
label: "Clear All",
|
|
2188
2181
|
className: "btn-text btn-danger",
|
|
2189
2182
|
onClick: () => this._handleClearAll()
|
|
@@ -2249,12 +2242,12 @@ class Ze {
|
|
|
2249
2242
|
onClick: (m) => {
|
|
2250
2243
|
m.target.closest(".filter-item-actions") || this._handleSelect(e);
|
|
2251
2244
|
}
|
|
2252
|
-
}), o = u("div", { className: "filter-item-header" }), n = u("span", { className: "filter-item-name" }, t.name), l = u("div", { className: "filter-item-actions" }), c =
|
|
2253
|
-
icon:
|
|
2245
|
+
}), o = u("div", { className: "filter-item-header" }), n = u("span", { className: "filter-item-name" }, t.name), l = u("div", { className: "filter-item-actions" }), c = x({
|
|
2246
|
+
icon: ue,
|
|
2254
2247
|
title: "Reset filter",
|
|
2255
2248
|
className: "btn-icon-sm",
|
|
2256
2249
|
onClick: () => this._handleReset(e)
|
|
2257
|
-
}), d =
|
|
2250
|
+
}), d = x({
|
|
2258
2251
|
icon: Ie,
|
|
2259
2252
|
title: "Remove filter",
|
|
2260
2253
|
className: "btn-icon-sm btn-danger",
|
|
@@ -2380,7 +2373,7 @@ const Y = {
|
|
|
2380
2373
|
showCropControls: !0,
|
|
2381
2374
|
maxExportWidth: void 0,
|
|
2382
2375
|
maxExportHeight: void 0
|
|
2383
|
-
},
|
|
2376
|
+
}, q = {
|
|
2384
2377
|
free: {
|
|
2385
2378
|
...Y
|
|
2386
2379
|
},
|
|
@@ -2417,11 +2410,11 @@ const Y = {
|
|
|
2417
2410
|
};
|
|
2418
2411
|
function Ge(s) {
|
|
2419
2412
|
if (!s)
|
|
2420
|
-
return { ...
|
|
2413
|
+
return { ...q.free };
|
|
2421
2414
|
if (typeof s == "object" && s !== null)
|
|
2422
2415
|
return { ...Y, ...s };
|
|
2423
|
-
const e =
|
|
2424
|
-
return e ? { ...e } : { ...
|
|
2416
|
+
const e = q[s];
|
|
2417
|
+
return e ? { ...e } : { ...q.free };
|
|
2425
2418
|
}
|
|
2426
2419
|
class Gt extends B {
|
|
2427
2420
|
/**
|
|
@@ -2452,7 +2445,7 @@ class Gt extends B {
|
|
|
2452
2445
|
},
|
|
2453
2446
|
...r,
|
|
2454
2447
|
...t
|
|
2455
|
-
}, this._preset = i, this._state = _e(), this._state.set("theme", this._options.theme), this._state.set("crop.shape", this._options.cropShape), this._state.set("crop.aspect", this._options.initialAspectRatio), this._preset && (this._state.set("lockCropShape", !!this._preset.lockCropShape), this._state.set("lockAspectRatio", !!this._preset.lockAspectRatio), this._state.set("showFilters", this._preset.showFilters !== !1), this._state.set("showCropControls", this._preset.showCropControls !== !1), this._state.set("autoZoomOnCropOverflow", !!this._preset.autoZoomOnCropOverflow)), this._renderer = new xe(), this._filterManager = new we(this._state, this._renderer), this._cropManager = new
|
|
2448
|
+
}, this._preset = i, this._state = _e(), this._state.set("theme", this._options.theme), this._state.set("crop.shape", this._options.cropShape), this._state.set("crop.aspect", this._options.initialAspectRatio), this._preset && (this._state.set("lockCropShape", !!this._preset.lockCropShape), this._state.set("lockAspectRatio", !!this._preset.lockAspectRatio), this._state.set("showFilters", this._preset.showFilters !== !1), this._state.set("showCropControls", this._preset.showCropControls !== !1), this._state.set("autoZoomOnCropOverflow", !!this._preset.autoZoomOnCropOverflow)), this._renderer = new xe(), this._filterManager = new we(this._state, this._renderer), this._cropManager = new $(this._state, this._renderer), this._removeBgManager = null, ((a = this._options.backgroundRemoval) == null ? void 0 : a.enabled) !== !1 && (this._removeBgManager = new Se({
|
|
2456
2449
|
endpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.endpoint,
|
|
2457
2450
|
fallbackEndpoint: (n = this._options.backgroundRemoval) == null ? void 0 : n.fallbackEndpoint
|
|
2458
2451
|
})), this._loadingOverlay = null, this._isMobile = typeof window < "u" ? window.innerWidth <= 768 : !1, this._toolbar = null, this._categoryCarousel = null, this._filterCarousel = null, this._filterAdjustments = null, this._mobileFilterDrawer = null, this._mobileActiveFilters = null, this._cropControls = null, this._activeFiltersPanel = null, this._editorEl = null, this._canvasContainer = null, this._cropOverlay = null, this._controlsSection = null, this._filterControlsEl = null, this._fileInput = null, this._resizeObserver = null, this._init();
|
|
@@ -2808,26 +2801,26 @@ class Gt extends B {
|
|
|
2808
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(), (d = this._editorEl) == null || d.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
|
|
2809
2802
|
}
|
|
2810
2803
|
}
|
|
2811
|
-
const
|
|
2804
|
+
const S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
2812
2805
|
function Ke(s, e) {
|
|
2813
2806
|
return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
|
|
2814
2807
|
}
|
|
2815
2808
|
function f(s) {
|
|
2816
2809
|
var e;
|
|
2817
|
-
return
|
|
2810
|
+
return S.has(s.id), S.set(s.id, s), I.has(s.category) || I.set(s.category, []), (e = I.get(s.category)) == null || e.push(s.id), s;
|
|
2818
2811
|
}
|
|
2819
2812
|
function Qe(s) {
|
|
2820
|
-
return
|
|
2813
|
+
return S.get(s);
|
|
2821
2814
|
}
|
|
2822
|
-
function
|
|
2823
|
-
return Array.from(
|
|
2815
|
+
function U() {
|
|
2816
|
+
return Array.from(S.values());
|
|
2824
2817
|
}
|
|
2825
2818
|
function Je() {
|
|
2826
|
-
|
|
2819
|
+
U().map((t) => t.id), Object.entries(g).filter(
|
|
2827
2820
|
(t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
|
|
2828
2821
|
).forEach(([t, i]) => {
|
|
2829
2822
|
const r = t.replace(/Filter$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2830
|
-
|
|
2823
|
+
S.has(r) || f({
|
|
2831
2824
|
id: r,
|
|
2832
2825
|
name: t.replace(/Filter$/, ""),
|
|
2833
2826
|
category: "unlisted",
|
|
@@ -2847,32 +2840,32 @@ function Je() {
|
|
|
2847
2840
|
});
|
|
2848
2841
|
}
|
|
2849
2842
|
function et(s) {
|
|
2850
|
-
return (
|
|
2843
|
+
return (I.get(s) || []).map((t) => S.get(t)).filter(Boolean);
|
|
2851
2844
|
}
|
|
2852
2845
|
function tt() {
|
|
2853
|
-
return Array.from(
|
|
2846
|
+
return Array.from(I.keys());
|
|
2854
2847
|
}
|
|
2855
2848
|
function Kt(s) {
|
|
2856
|
-
return
|
|
2849
|
+
return S.has(s);
|
|
2857
2850
|
}
|
|
2858
2851
|
function it(s) {
|
|
2859
|
-
const e =
|
|
2852
|
+
const e = S.get(s);
|
|
2860
2853
|
if (!e)
|
|
2861
2854
|
return !1;
|
|
2862
|
-
|
|
2863
|
-
const t =
|
|
2855
|
+
S.delete(s);
|
|
2856
|
+
const t = I.get(e.category);
|
|
2864
2857
|
if (t) {
|
|
2865
2858
|
const i = t.indexOf(s);
|
|
2866
|
-
i !== -1 && t.splice(i, 1), t.length === 0 &&
|
|
2859
|
+
i !== -1 && t.splice(i, 1), t.length === 0 && I.delete(e.category);
|
|
2867
2860
|
}
|
|
2868
2861
|
return !0;
|
|
2869
2862
|
}
|
|
2870
2863
|
function Qt(s, e) {
|
|
2871
|
-
const t =
|
|
2864
|
+
const t = S.get(s);
|
|
2872
2865
|
return t ? Ke(t, e) : !1;
|
|
2873
2866
|
}
|
|
2874
2867
|
function rt() {
|
|
2875
|
-
return Array.from(
|
|
2868
|
+
return Array.from(S.values()).map((s) => ({
|
|
2876
2869
|
id: s.id,
|
|
2877
2870
|
name: s.name,
|
|
2878
2871
|
category: s.category,
|
|
@@ -2880,11 +2873,11 @@ function rt() {
|
|
|
2880
2873
|
}));
|
|
2881
2874
|
}
|
|
2882
2875
|
if (typeof window < "u") {
|
|
2883
|
-
window.__DEBUG_FILTERS_LIST = Array.from(
|
|
2876
|
+
window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter = Qe, window.getFiltersByCategory = et, window.getRegisteredFilters = rt;
|
|
2884
2877
|
const s = f;
|
|
2885
2878
|
window.registerFilter = (e) => {
|
|
2886
2879
|
const t = s(e);
|
|
2887
|
-
return window.__DEBUG_FILTERS_LIST = Array.from(
|
|
2880
|
+
return window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), t;
|
|
2888
2881
|
};
|
|
2889
2882
|
}
|
|
2890
2883
|
typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
|
|
@@ -2919,7 +2912,7 @@ function P(s, e) {
|
|
|
2919
2912
|
}
|
|
2920
2913
|
return e;
|
|
2921
2914
|
}
|
|
2922
|
-
function
|
|
2915
|
+
function J(s) {
|
|
2923
2916
|
return ot.has(s);
|
|
2924
2917
|
}
|
|
2925
2918
|
function nt(s) {
|
|
@@ -2934,7 +2927,7 @@ function nt(s) {
|
|
|
2934
2927
|
alpha: P(s.alpha, k.alpha)
|
|
2935
2928
|
};
|
|
2936
2929
|
}
|
|
2937
|
-
function
|
|
2930
|
+
function ee(s, e) {
|
|
2938
2931
|
s.reset(), s.brightness(e.brightness, !0), s.contrast(e.contrast, !0), s.saturate(e.saturation, !0);
|
|
2939
2932
|
}
|
|
2940
2933
|
f({
|
|
@@ -2950,7 +2943,7 @@ f({
|
|
|
2950
2943
|
const i = new st(t), r = i;
|
|
2951
2944
|
return r._customParams = { ...e }, r.updateUIParam = function(o, n) {
|
|
2952
2945
|
try {
|
|
2953
|
-
if (!
|
|
2946
|
+
if (!J(o))
|
|
2954
2947
|
return;
|
|
2955
2948
|
const l = this._customParams ?? { ...k }, c = P(n, l[o]);
|
|
2956
2949
|
l[o] = c, this._customParams = l;
|
|
@@ -2961,12 +2954,12 @@ f({
|
|
|
2961
2954
|
}, i;
|
|
2962
2955
|
} catch {
|
|
2963
2956
|
const r = new at(), a = r;
|
|
2964
|
-
return a._customParams = { ...e },
|
|
2957
|
+
return a._customParams = { ...e }, ee(r, e), a.updateUIParam = function(n, l) {
|
|
2965
2958
|
try {
|
|
2966
|
-
if (!
|
|
2959
|
+
if (!J(n))
|
|
2967
2960
|
return;
|
|
2968
2961
|
const c = this._customParams ?? { ...k }, d = P(l, c[n]);
|
|
2969
|
-
c[n] = d, this._customParams = c,
|
|
2962
|
+
c[n] = d, this._customParams = c, ee(this, c);
|
|
2970
2963
|
} catch {
|
|
2971
2964
|
}
|
|
2972
2965
|
}, r;
|
|
@@ -3070,7 +3063,7 @@ f({
|
|
|
3070
3063
|
}
|
|
3071
3064
|
]
|
|
3072
3065
|
});
|
|
3073
|
-
const { ColorMatrixFilter: lt } = w,
|
|
3066
|
+
const { ColorMatrixFilter: lt } = w, R = {
|
|
3074
3067
|
brightness: 1,
|
|
3075
3068
|
contrast: 1,
|
|
3076
3069
|
saturation: 1,
|
|
@@ -3098,7 +3091,7 @@ function X(s, e) {
|
|
|
3098
3091
|
}
|
|
3099
3092
|
return e;
|
|
3100
3093
|
}
|
|
3101
|
-
function
|
|
3094
|
+
function pe(s, e) {
|
|
3102
3095
|
if (typeof s == "boolean")
|
|
3103
3096
|
return s;
|
|
3104
3097
|
if (typeof s == "string") {
|
|
@@ -3111,15 +3104,15 @@ function ue(s, e) {
|
|
|
3111
3104
|
}
|
|
3112
3105
|
function dt(s) {
|
|
3113
3106
|
return {
|
|
3114
|
-
brightness: X(s.brightness,
|
|
3115
|
-
contrast: X(s.contrast,
|
|
3116
|
-
saturation: X(s.saturation,
|
|
3117
|
-
hue: X(s.hue,
|
|
3118
|
-
sepia: X(s.sepia,
|
|
3119
|
-
negative:
|
|
3107
|
+
brightness: X(s.brightness, R.brightness),
|
|
3108
|
+
contrast: X(s.contrast, R.contrast),
|
|
3109
|
+
saturation: X(s.saturation, R.saturation),
|
|
3110
|
+
hue: X(s.hue, R.hue),
|
|
3111
|
+
sepia: X(s.sepia, R.sepia),
|
|
3112
|
+
negative: pe(s.negative, R.negative)
|
|
3120
3113
|
};
|
|
3121
3114
|
}
|
|
3122
|
-
function
|
|
3115
|
+
function te(s, e) {
|
|
3123
3116
|
s.reset(), e.brightness !== 1 && s.brightness(e.brightness, !0), e.contrast !== 1 && s.contrast(e.contrast, !0), e.saturation !== 1 && s.saturate(e.saturation, !0), e.hue !== 0 && s.hue(e.hue, !0), e.sepia > 0 && s.sepia(!0), e.negative && s.negative(!0);
|
|
3124
3117
|
}
|
|
3125
3118
|
f({
|
|
@@ -3131,18 +3124,18 @@ f({
|
|
|
3131
3124
|
createFilter: (s) => {
|
|
3132
3125
|
try {
|
|
3133
3126
|
const e = dt(s ?? {}), t = new lt(), i = t;
|
|
3134
|
-
return i._customParams = { ...e },
|
|
3127
|
+
return i._customParams = { ...e }, te(t, e), i.updateUIParam = function(a, o) {
|
|
3135
3128
|
try {
|
|
3136
3129
|
if (!ht(a))
|
|
3137
3130
|
return;
|
|
3138
|
-
const n = this._customParams ?? { ...
|
|
3131
|
+
const n = this._customParams ?? { ...R };
|
|
3139
3132
|
if (a === "negative")
|
|
3140
|
-
n.negative =
|
|
3133
|
+
n.negative = pe(o, n.negative);
|
|
3141
3134
|
else {
|
|
3142
3135
|
const l = a;
|
|
3143
3136
|
n[l] = X(o, n[l]);
|
|
3144
3137
|
}
|
|
3145
|
-
this._customParams = n,
|
|
3138
|
+
this._customParams = n, te(this, n);
|
|
3146
3139
|
} catch {
|
|
3147
3140
|
}
|
|
3148
3141
|
}, t;
|
|
@@ -3677,11 +3670,11 @@ f({
|
|
|
3677
3670
|
const e = new pt();
|
|
3678
3671
|
e._customParams = { ...s };
|
|
3679
3672
|
const t = s.intensity !== void 0 ? s.intensity : 1;
|
|
3680
|
-
return
|
|
3673
|
+
return ie(e, t), e.updateUIParam = function(i, r) {
|
|
3681
3674
|
const a = this._customParams || {};
|
|
3682
3675
|
switch (this._customParams = a, a[i] = r, i) {
|
|
3683
3676
|
case "intensity":
|
|
3684
|
-
|
|
3677
|
+
ie(this, r);
|
|
3685
3678
|
break;
|
|
3686
3679
|
default:
|
|
3687
3680
|
i in this && (this[i] = r);
|
|
@@ -3711,7 +3704,7 @@ f({
|
|
|
3711
3704
|
}
|
|
3712
3705
|
]
|
|
3713
3706
|
});
|
|
3714
|
-
function
|
|
3707
|
+
function ie(s, e) {
|
|
3715
3708
|
s.reset(), s.greyscale(e);
|
|
3716
3709
|
}
|
|
3717
3710
|
const { HslAdjustmentFilter: ft } = g;
|
|
@@ -4429,7 +4422,7 @@ f({
|
|
|
4429
4422
|
}
|
|
4430
4423
|
]
|
|
4431
4424
|
});
|
|
4432
|
-
const { ColorGradientFilter:
|
|
4425
|
+
const { ColorGradientFilter: re } = g;
|
|
4433
4426
|
f({
|
|
4434
4427
|
id: "color-gradient",
|
|
4435
4428
|
name: "Color Gradient",
|
|
@@ -4453,7 +4446,7 @@ f({
|
|
|
4453
4446
|
{ offset: 0, color: 16711680, alpha: 1 },
|
|
4454
4447
|
{ offset: 1, color: 255, alpha: 1 }
|
|
4455
4448
|
]), e.sort((i, r) => i.offset - r.offset);
|
|
4456
|
-
const t = new
|
|
4449
|
+
const t = new re({
|
|
4457
4450
|
type: s.gradientType,
|
|
4458
4451
|
// 0: linear, 1: radial, 2: conic
|
|
4459
4452
|
stops: e,
|
|
@@ -4543,7 +4536,7 @@ f({
|
|
|
4543
4536
|
case "cssGradient":
|
|
4544
4537
|
if (r && typeof r == "string" && r.trim() !== "")
|
|
4545
4538
|
try {
|
|
4546
|
-
const h = new
|
|
4539
|
+
const h = new re({ css: r });
|
|
4547
4540
|
this.type = h.type, this.angle = h.angle, this.stops = [...h.stops], a.colorStops = this.stops.map((p) => ({
|
|
4548
4541
|
offset: p.offset,
|
|
4549
4542
|
color: typeof p.color == "number" ? "#" + p.color.toString(16).padStart(6, "0") : p.color,
|
|
@@ -4566,9 +4559,9 @@ f({
|
|
|
4566
4559
|
if (/colorStops\[\d+\]\..*/.test(i)) {
|
|
4567
4560
|
const h = i.match(/colorStops\[(\d+)\]\.(.*)/);
|
|
4568
4561
|
if (h) {
|
|
4569
|
-
const [p, m,
|
|
4570
|
-
if (b >= 0 && b <
|
|
4571
|
-
return
|
|
4562
|
+
const [p, m, C] = h, b = parseInt(m), y = [...this.stops];
|
|
4563
|
+
if (b >= 0 && b < y.length)
|
|
4564
|
+
return C === "color" && typeof r == "string" ? y[b].color = parseInt(r.replace("#", "0x")) : (C === "offset" || C === "alpha") && (y[b][C] = r), this.stops = y, this.stops.sort((z, _) => z.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
|
|
4572
4565
|
}
|
|
4573
4566
|
} else i in this && (this[i] = r);
|
|
4574
4567
|
break;
|
|
@@ -6235,7 +6228,7 @@ f({
|
|
|
6235
6228
|
}
|
|
6236
6229
|
]
|
|
6237
6230
|
});
|
|
6238
|
-
const Nt = w.DisplacementFilter, Rt = w.Sprite,
|
|
6231
|
+
const Nt = w.DisplacementFilter, Rt = w.Sprite, H = w.Texture;
|
|
6239
6232
|
f({
|
|
6240
6233
|
id: "displacement",
|
|
6241
6234
|
// ID must match what the application expects
|
|
@@ -6248,7 +6241,7 @@ f({
|
|
|
6248
6241
|
const e = s.mapTexture || "/assets/images/displacement_map.png";
|
|
6249
6242
|
let t;
|
|
6250
6243
|
try {
|
|
6251
|
-
t =
|
|
6244
|
+
t = H.from(e), t.source.addressMode = "repeat";
|
|
6252
6245
|
} catch {
|
|
6253
6246
|
const o = document.createElement("canvas");
|
|
6254
6247
|
o.width = 256, o.height = 256;
|
|
@@ -6259,7 +6252,7 @@ f({
|
|
|
6259
6252
|
for (let c = 0; c < 10; c++)
|
|
6260
6253
|
(l + c) % 2 === 0 && n.fillRect(l * 25, c * 25, 25, 25);
|
|
6261
6254
|
}
|
|
6262
|
-
t =
|
|
6255
|
+
t = H.from(o);
|
|
6263
6256
|
}
|
|
6264
6257
|
const i = new Rt(t), r = new Nt(i, s.scale || 50);
|
|
6265
6258
|
return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = i, r.updateUIParam = function(a, o) {
|
|
@@ -6275,7 +6268,7 @@ f({
|
|
|
6275
6268
|
try {
|
|
6276
6269
|
const l = this._displacementSprite;
|
|
6277
6270
|
if (l) {
|
|
6278
|
-
const c =
|
|
6271
|
+
const c = H.from(o);
|
|
6279
6272
|
c.source.addressMode = "repeat", l.texture = c;
|
|
6280
6273
|
}
|
|
6281
6274
|
} catch {
|
|
@@ -6457,7 +6450,7 @@ f({
|
|
|
6457
6450
|
}
|
|
6458
6451
|
]
|
|
6459
6452
|
});
|
|
6460
|
-
const { GlitchFilter: It } = g,
|
|
6453
|
+
const { GlitchFilter: It } = g, N = {
|
|
6461
6454
|
TRANSPARENT: 0,
|
|
6462
6455
|
ORIGINAL: 1,
|
|
6463
6456
|
LOOP: 2,
|
|
@@ -6549,7 +6542,7 @@ f({
|
|
|
6549
6542
|
slices: 10,
|
|
6550
6543
|
offset: 100,
|
|
6551
6544
|
direction: 0,
|
|
6552
|
-
fillMode:
|
|
6545
|
+
fillMode: N.LOOP,
|
|
6553
6546
|
// LOOP mode looks better for the demo
|
|
6554
6547
|
seed: 0.5,
|
|
6555
6548
|
average: !1,
|
|
@@ -6612,13 +6605,13 @@ f({
|
|
|
6612
6605
|
label: "Fill Mode",
|
|
6613
6606
|
property: "fillMode",
|
|
6614
6607
|
options: [
|
|
6615
|
-
{ value:
|
|
6616
|
-
{ value:
|
|
6617
|
-
{ value:
|
|
6618
|
-
{ value:
|
|
6619
|
-
{ value:
|
|
6608
|
+
{ value: N.TRANSPARENT, label: "Transparent" },
|
|
6609
|
+
{ value: N.ORIGINAL, label: "Original" },
|
|
6610
|
+
{ value: N.LOOP, label: "Loop" },
|
|
6611
|
+
{ value: N.CLAMP, label: "Clamp" },
|
|
6612
|
+
{ value: N.MIRROR, label: "Mirror" }
|
|
6620
6613
|
],
|
|
6621
|
-
default:
|
|
6614
|
+
default: N.LOOP
|
|
6622
6615
|
},
|
|
6623
6616
|
{
|
|
6624
6617
|
id: "seed",
|
|
@@ -7009,7 +7002,7 @@ f({
|
|
|
7009
7002
|
}
|
|
7010
7003
|
]
|
|
7011
7004
|
});
|
|
7012
|
-
const Yt = g.SimpleLightmapFilter,
|
|
7005
|
+
const Yt = g.SimpleLightmapFilter, se = w.Texture;
|
|
7013
7006
|
f({
|
|
7014
7007
|
id: "lightmap",
|
|
7015
7008
|
name: "Lightmap",
|
|
@@ -7034,7 +7027,7 @@ f({
|
|
|
7034
7027
|
const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7035
7028
|
c.addColorStop(0, "white"), c.addColorStop(0.3, "rgba(220, 220, 220, 1)"), c.addColorStop(0.6, "rgba(150, 150, 150, 1)"), c.addColorStop(1, "black"), a.fillStyle = c, a.fillRect(0, 0, 256, 256);
|
|
7036
7029
|
}
|
|
7037
|
-
const o =
|
|
7030
|
+
const o = se.from(r);
|
|
7038
7031
|
let n;
|
|
7039
7032
|
try {
|
|
7040
7033
|
typeof t == "string" && t.startsWith("#") ? n = parseInt(t.replace("#", "0x"), 16) : n = 0;
|
|
@@ -7067,8 +7060,8 @@ f({
|
|
|
7067
7060
|
const b = m.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7068
7061
|
b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.6, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "black"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
|
|
7069
7062
|
}
|
|
7070
|
-
const
|
|
7071
|
-
if (this.lightMap =
|
|
7063
|
+
const C = se.from(p);
|
|
7064
|
+
if (this.lightMap = C, this.enabled !== void 0) {
|
|
7072
7065
|
const b = this.enabled;
|
|
7073
7066
|
this.enabled = !1, setTimeout(() => {
|
|
7074
7067
|
this.enabled = b;
|
|
@@ -8262,7 +8255,7 @@ f({
|
|
|
8262
8255
|
]
|
|
8263
8256
|
});
|
|
8264
8257
|
const { AdjustmentFilter: Ht } = g;
|
|
8265
|
-
function
|
|
8258
|
+
function D(s) {
|
|
8266
8259
|
const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
|
|
8267
8260
|
return [
|
|
8268
8261
|
(e >> 16 & 255) / 255,
|
|
@@ -8277,7 +8270,7 @@ class $t extends Ht {
|
|
|
8277
8270
|
contrast: 1,
|
|
8278
8271
|
saturation: 1,
|
|
8279
8272
|
alpha: 1
|
|
8280
|
-
}), this._radius = 0.8, this._strength = 1, this._colorRgb = [0, 0, 0], this._colorValue = "#000000", this._radius = e.radius ?? 0.8, this._strength = e.strength ?? 1, e.color !== void 0 && (typeof e.color == "string" ? (this._colorValue = e.color, this._colorRgb =
|
|
8273
|
+
}), this._radius = 0.8, this._strength = 1, this._colorRgb = [0, 0, 0], this._colorValue = "#000000", this._radius = e.radius ?? 0.8, this._strength = e.strength ?? 1, e.color !== void 0 && (typeof e.color == "string" ? (this._colorValue = e.color, this._colorRgb = D(e.color)) : (this._colorValue = "#" + e.color.toString(16).padStart(6, "0"), this._colorRgb = D(e.color))), this.updateVignette();
|
|
8281
8274
|
}
|
|
8282
8275
|
/**
|
|
8283
8276
|
* Updates the filter parameters to simulate a vignette effect
|
|
@@ -8303,7 +8296,7 @@ class $t extends Ht {
|
|
|
8303
8296
|
return this._colorValue;
|
|
8304
8297
|
}
|
|
8305
8298
|
set color(e) {
|
|
8306
|
-
typeof e == "string" ? (this._colorValue = e, this._colorRgb =
|
|
8299
|
+
typeof e == "string" ? (this._colorValue = e, this._colorRgb = D(e)) : (this._colorValue = "#" + e.toString(16).padStart(6, "0"), this._colorRgb = D(e)), this.updateVignette();
|
|
8307
8300
|
}
|
|
8308
8301
|
}
|
|
8309
8302
|
f({
|
|
@@ -8381,7 +8374,7 @@ function Jt(s) {
|
|
|
8381
8374
|
try {
|
|
8382
8375
|
let e = [], t = [];
|
|
8383
8376
|
try {
|
|
8384
|
-
e =
|
|
8377
|
+
e = U(), e.length === 0 && Je();
|
|
8385
8378
|
} catch {
|
|
8386
8379
|
}
|
|
8387
8380
|
const i = s == null ? void 0 : s.disabled;
|
|
@@ -8392,7 +8385,7 @@ function Jt(s) {
|
|
|
8392
8385
|
r > 0;
|
|
8393
8386
|
}
|
|
8394
8387
|
try {
|
|
8395
|
-
e =
|
|
8388
|
+
e = U(), t = tt();
|
|
8396
8389
|
} catch {
|
|
8397
8390
|
e || (e = []), t || (t = []);
|
|
8398
8391
|
}
|
|
@@ -8409,9 +8402,9 @@ export {
|
|
|
8409
8402
|
Je as d,
|
|
8410
8403
|
Qt as e,
|
|
8411
8404
|
rt as f,
|
|
8412
|
-
|
|
8405
|
+
U as g,
|
|
8413
8406
|
Kt as h,
|
|
8414
8407
|
Jt as i,
|
|
8415
8408
|
f as r
|
|
8416
8409
|
};
|
|
8417
|
-
//# sourceMappingURL=editor-
|
|
8410
|
+
//# sourceMappingURL=editor-BgjKZltI.js.map
|