@codingfactory/mediables-vue 2.3.6 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PixiFrameExporter-BAZtrvGS.js → PixiFrameExporter-D8dt-5Oj.js} +2 -2
- package/dist/{PixiFrameExporter-BAZtrvGS.js.map → PixiFrameExporter-D8dt-5Oj.js.map} +1 -1
- package/dist/{PixiFrameExporter-DM4yaigy.cjs → PixiFrameExporter-rWh-JQub.cjs} +2 -2
- package/dist/{PixiFrameExporter-DM4yaigy.cjs.map → PixiFrameExporter-rWh-JQub.cjs.map} +1 -1
- package/dist/components/ImageEditorModal.vue.d.ts +4 -2
- package/dist/composables/useImageEditorModal.d.ts +288 -16
- package/dist/composables/useRadialMenu.d.ts +1 -1
- package/dist/{editor-BWpslm--.js → editor-624YYYUE.js} +406 -298
- package/dist/editor-624YYYUE.js.map +1 -0
- package/dist/editor-BU3jmGLs.cjs +42 -0
- package/dist/editor-BU3jmGLs.cjs.map +1 -0
- package/dist/{index-CMOpozRS.js → index-Bwmk8LYJ.js} +7717 -7554
- package/dist/index-Bwmk8LYJ.js.map +1 -0
- package/dist/index-PyOrcGKi.cjs +342 -0
- package/dist/index-PyOrcGKi.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- 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 +59 -52
- package/dist/style.css +1 -1
- package/dist/types/editor.d.ts +87 -2
- package/dist/utils/imageEditorState.d.ts +26 -0
- package/package.json +1 -1
- package/dist/editor-BWpslm--.js.map +0 -1
- package/dist/editor-D_dX1XkE.cjs +0 -42
- package/dist/editor-D_dX1XkE.cjs.map +0 -1
- package/dist/index-6-ArBBEQ.cjs +0 -342
- package/dist/index-6-ArBBEQ.cjs.map +0 -1
- package/dist/index-CMOpozRS.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var _e = Object.defineProperty;
|
|
2
|
+
var xe = (s, e, t) => e in s ? _e(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var j = (s, e, t) => xe(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as g from "pixi-filters";
|
|
5
5
|
import * as w from "pixi.js";
|
|
6
|
-
import { GlProgram as
|
|
6
|
+
import { GlProgram as Ce } from "pixi.js";
|
|
7
7
|
class B {
|
|
8
8
|
constructor() {
|
|
9
9
|
this._events = /* @__PURE__ */ new Map();
|
|
@@ -34,7 +34,7 @@ class B {
|
|
|
34
34
|
e ? this._events.delete(e) : this._events.clear();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
class
|
|
37
|
+
class we extends B {
|
|
38
38
|
constructor() {
|
|
39
39
|
super(), this._state = {
|
|
40
40
|
// Image state
|
|
@@ -102,11 +102,40 @@ class ye extends B {
|
|
|
102
102
|
this.emit(`change:${e}`, { value: t, old: i }), this.emit("change", { key: e, value: t, old: i });
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
* Get the entire state object (for debugging)
|
|
105
|
+
* Get the entire state object (for debugging).
|
|
106
|
+
* WARNING: Shallow copy only — nested objects are live references.
|
|
107
|
+
* For persistence, use getSerializableState() instead.
|
|
106
108
|
*/
|
|
107
109
|
getAll() {
|
|
108
110
|
return { ...this._state };
|
|
109
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Get a deep, serializable snapshot of the editor state.
|
|
114
|
+
* Safe for persistence — no mutable references leak out.
|
|
115
|
+
* @returns {Object} ImageEditorSessionState-compatible object
|
|
116
|
+
*/
|
|
117
|
+
getSerializableState() {
|
|
118
|
+
const e = [];
|
|
119
|
+
if (this._state.activeFilters)
|
|
120
|
+
for (const i of this._state.activeFilters) {
|
|
121
|
+
const r = this._state.filterValues[i];
|
|
122
|
+
e.push({
|
|
123
|
+
id: i,
|
|
124
|
+
enabled: !0,
|
|
125
|
+
values: r ? { ...r } : {}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
const t = this._state.crop;
|
|
129
|
+
return {
|
|
130
|
+
version: 1,
|
|
131
|
+
crop: {
|
|
132
|
+
rect: t != null && t.rect ? { ...t.rect } : null,
|
|
133
|
+
aspectRatio: (t == null ? void 0 : t.aspect) || "free",
|
|
134
|
+
shape: (t == null ? void 0 : t.shape) || "free"
|
|
135
|
+
},
|
|
136
|
+
filters: e
|
|
137
|
+
};
|
|
138
|
+
}
|
|
110
139
|
/**
|
|
111
140
|
* Toggle a filter in the active filters set
|
|
112
141
|
* @param {string} filterId
|
|
@@ -160,10 +189,10 @@ class ye extends B {
|
|
|
160
189
|
this.set("isDarkMode", this._state.theme === "dark");
|
|
161
190
|
}
|
|
162
191
|
}
|
|
163
|
-
function
|
|
164
|
-
return new
|
|
192
|
+
function Se() {
|
|
193
|
+
return new we();
|
|
165
194
|
}
|
|
166
|
-
class
|
|
195
|
+
class ve extends B {
|
|
167
196
|
constructor() {
|
|
168
197
|
super(), this.app = null, this.sprite = null, this.originalTexture = null, this.baseTexture = null, this.fitScale = 1, this.zoom = 1, this._container = null, this._mountPromise = null;
|
|
169
198
|
}
|
|
@@ -315,10 +344,10 @@ class xe extends B {
|
|
|
315
344
|
if (typeof _.toDataURL == "function")
|
|
316
345
|
v = _.toDataURL(`image/${e}`, t);
|
|
317
346
|
else if (typeof _.getContext == "function") {
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
const O =
|
|
321
|
-
O && (O.drawImage(_, 0, 0), v =
|
|
347
|
+
const z = document.createElement("canvas");
|
|
348
|
+
z.width = _.width, z.height = _.height;
|
|
349
|
+
const O = z.getContext("2d");
|
|
350
|
+
O && (O.drawImage(_, 0, 0), v = z.toDataURL(`image/${e}`, t));
|
|
322
351
|
}
|
|
323
352
|
return v || null;
|
|
324
353
|
} catch {
|
|
@@ -327,6 +356,29 @@ class xe extends B {
|
|
|
327
356
|
c.x = u, c.y = h, b && b.destroy(!0);
|
|
328
357
|
}
|
|
329
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Get the actual export dimensions (texture size, not display size).
|
|
361
|
+
* @returns {{ width: number, height: number }}
|
|
362
|
+
*/
|
|
363
|
+
getExportDimensions() {
|
|
364
|
+
const e = this.originalTexture;
|
|
365
|
+
return {
|
|
366
|
+
width: Math.round((e == null ? void 0 : e.width) || 0),
|
|
367
|
+
height: Math.round((e == null ? void 0 : e.height) || 0)
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Export the current image as a Blob with correct dimensions.
|
|
372
|
+
* @param {string} format - 'png' or 'jpeg'
|
|
373
|
+
* @param {number} quality - Quality for jpeg (0-1)
|
|
374
|
+
* @returns {Promise<{ blob: Blob, width: number, height: number } | null>}
|
|
375
|
+
*/
|
|
376
|
+
async exportBlob(e = "png", t = 0.92) {
|
|
377
|
+
const i = this.exportImage(e, t);
|
|
378
|
+
if (!i) return null;
|
|
379
|
+
const a = await (await fetch(i)).blob(), o = this.getExportDimensions();
|
|
380
|
+
return { blob: a, width: o.width, height: o.height };
|
|
381
|
+
}
|
|
330
382
|
/**
|
|
331
383
|
* Resize renderer to container
|
|
332
384
|
* @param {HTMLElement} container
|
|
@@ -379,7 +431,7 @@ class xe extends B {
|
|
|
379
431
|
this.sprite = null, this.originalTexture = null, this.baseTexture = null, this._container = null, this.removeAllListeners();
|
|
380
432
|
}
|
|
381
433
|
}
|
|
382
|
-
const
|
|
434
|
+
const ke = {
|
|
383
435
|
adjust: ["adjust", "advanced"],
|
|
384
436
|
// adjustment, adjustmentAdvanced, alpha, colorMatrix
|
|
385
437
|
blur: ["blur"],
|
|
@@ -395,7 +447,7 @@ const Ce = {
|
|
|
395
447
|
stylize: ["stylize"]
|
|
396
448
|
// ascii, crt, crossHatch, dot, emboss
|
|
397
449
|
};
|
|
398
|
-
class
|
|
450
|
+
class Pe extends B {
|
|
399
451
|
constructor(e, t) {
|
|
400
452
|
super(), this.state = e, this.renderer = t, this.instances = {}, this._filterRegistry = null;
|
|
401
453
|
}
|
|
@@ -430,7 +482,7 @@ class we extends B {
|
|
|
430
482
|
*/
|
|
431
483
|
getFiltersByCategory(e) {
|
|
432
484
|
if (!this._filterRegistry) return [];
|
|
433
|
-
const t =
|
|
485
|
+
const t = ke[e] || [e], i = [], r = /* @__PURE__ */ new Set();
|
|
434
486
|
for (const a of t) {
|
|
435
487
|
const o = this._filterRegistry.getFiltersByCategory(a) || [];
|
|
436
488
|
for (const n of o)
|
|
@@ -553,18 +605,15 @@ class we extends B {
|
|
|
553
605
|
i.length > 0;
|
|
554
606
|
}
|
|
555
607
|
/**
|
|
556
|
-
* Reset all filters
|
|
608
|
+
* Reset all filters.
|
|
609
|
+
* IMPORTANT: Only clears filter instances and sprite.filters.
|
|
610
|
+
* Does NOT touch baseTexture/originalTexture/sprite — that would
|
|
611
|
+
* destroy any applied crop, which is a separate concern.
|
|
557
612
|
*/
|
|
558
613
|
resetAll() {
|
|
559
614
|
for (const e in this.instances)
|
|
560
615
|
delete this.instances[e];
|
|
561
|
-
|
|
562
|
-
const e = window.PIXI;
|
|
563
|
-
this.renderer.originalTexture = this.renderer.baseTexture, this.renderer.app.stage.removeChild(this.renderer.sprite), this.renderer.sprite.destroy();
|
|
564
|
-
const t = new e.Sprite(this.renderer.originalTexture);
|
|
565
|
-
this.renderer.app.stage.addChild(t), this.renderer.sprite = t, this.renderer.fitScale = this.renderer.getFitScaleFor(this.renderer.originalTexture), this.renderer.setZoom(1, { keepCenter: !1 }), this.renderer.applyViewTransform();
|
|
566
|
-
}
|
|
567
|
-
this.renderer.render(), this.emit("filtersReset");
|
|
616
|
+
this.state.resetFilters(), this.renderer.sprite && (this.renderer.sprite.filters = null), this.renderer.render(), this.emit("filtersReset");
|
|
568
617
|
}
|
|
569
618
|
/**
|
|
570
619
|
* Get a filter instance
|
|
@@ -703,8 +752,8 @@ const T = class T extends B {
|
|
|
703
752
|
if (!l) return;
|
|
704
753
|
const c = this.state.get("crop.shape");
|
|
705
754
|
if (n.save(), c === "circle") {
|
|
706
|
-
const y = l.x + l.width / 2,
|
|
707
|
-
n.beginPath(), n.arc(y,
|
|
755
|
+
const y = l.x + l.width / 2, A = l.y + l.height / 2, _ = Math.min(l.width, l.height) / 2;
|
|
756
|
+
n.beginPath(), n.arc(y, A, _, 0, Math.PI * 2), n.clip();
|
|
708
757
|
} else
|
|
709
758
|
n.beginPath(), n.rect(l.x, l.y, l.width, l.height), n.clip();
|
|
710
759
|
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(
|
|
@@ -729,8 +778,8 @@ const T = class T extends B {
|
|
|
729
778
|
{ x: l.x + l.width, y: l.y + l.height / 2, m: "e" }
|
|
730
779
|
], b = [...m, ...C];
|
|
731
780
|
for (const y of b) {
|
|
732
|
-
const
|
|
733
|
-
n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle =
|
|
781
|
+
const A = this._hoverMode === y.m, _ = A ? p + 4 : p;
|
|
782
|
+
n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle = A ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
|
|
734
783
|
}
|
|
735
784
|
}
|
|
736
785
|
/**
|
|
@@ -845,10 +894,10 @@ const T = class T extends B {
|
|
|
845
894
|
if (h <= 0 || p <= 0) return null;
|
|
846
895
|
const b = new a.Container(), y = new a.Sprite(i);
|
|
847
896
|
if (this.state.get("crop.shape") === "circle") {
|
|
848
|
-
const
|
|
849
|
-
m = Math.round(
|
|
850
|
-
const
|
|
851
|
-
typeof
|
|
897
|
+
const V = Math.round(Math.max(h, p)), be = m + h / 2, ye = C + p / 2;
|
|
898
|
+
m = Math.round(be - V / 2), C = Math.round(ye - V / 2), h = p = V;
|
|
899
|
+
const M = new a.Graphics();
|
|
900
|
+
typeof M.circle == "function" && typeof M.fill == "function" ? M.circle(h / 2, p / 2, h / 2).fill(16777215) : (M.beginFill(16777215, 1), M.drawCircle(h / 2, p / 2, h / 2), M.endFill()), y.mask = M, b.addChild(M);
|
|
852
901
|
}
|
|
853
902
|
y.x = -m, y.y = -C, b.addChild(y);
|
|
854
903
|
const _ = a.RenderTexture.create({ width: h, height: p });
|
|
@@ -856,9 +905,13 @@ const T = class T extends B {
|
|
|
856
905
|
container: b,
|
|
857
906
|
target: _,
|
|
858
907
|
clear: !0
|
|
859
|
-
}), b.destroy({ children: !0 })
|
|
860
|
-
const v =
|
|
861
|
-
|
|
908
|
+
}), b.destroy({ children: !0 });
|
|
909
|
+
const v = this.renderer.originalTexture;
|
|
910
|
+
v && v !== this.renderer.baseTexture && v.destroy(!0), this.renderer.originalTexture = _, e.stage.removeChild(t), t.destroy();
|
|
911
|
+
const z = new a.Sprite(_);
|
|
912
|
+
e.stage.addChild(z), this.renderer.sprite = z, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render();
|
|
913
|
+
const O = { x: r.x, y: r.y, width: r.width, height: r.height }, me = this.state.get("crop.shape") || "free", ge = this.state.get("crop.aspect") || "free";
|
|
914
|
+
return this.disable(), this.state.set("crop.appliedRect", O), this.state.set("crop.appliedShape", me), this.state.set("crop.appliedAspect", ge), this.emit("applied", { width: h, height: p }), { texture: _, preservedZoom: o };
|
|
862
915
|
}
|
|
863
916
|
/**
|
|
864
917
|
* Cancel crop
|
|
@@ -885,12 +938,12 @@ const T = class T extends B {
|
|
|
885
938
|
* Padding factor for auto-zoom: image will be ~91% of crop size (1/1.1).
|
|
886
939
|
* Higher values = more aggressive zoom-out, more padding around image.
|
|
887
940
|
*/
|
|
888
|
-
|
|
941
|
+
j(T, "AUTO_ZOOM_PADDING", 1.1), /**
|
|
889
942
|
* Minimum interval (ms) between auto-zoom adjustments during drag.
|
|
890
943
|
*/
|
|
891
|
-
|
|
892
|
-
let
|
|
893
|
-
class
|
|
944
|
+
j(T, "AUTO_ZOOM_THROTTLE_MS", 100);
|
|
945
|
+
let W = T;
|
|
946
|
+
class Me {
|
|
894
947
|
/**
|
|
895
948
|
* Create a new RemoveBgManager
|
|
896
949
|
* @param {Object} options
|
|
@@ -1016,7 +1069,7 @@ function d(s, e = {}, ...t) {
|
|
|
1016
1069
|
typeof r == "string" ? i.appendChild(document.createTextNode(r)) : r instanceof HTMLElement && i.appendChild(r);
|
|
1017
1070
|
return i;
|
|
1018
1071
|
}
|
|
1019
|
-
function
|
|
1072
|
+
function oe({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
|
|
1020
1073
|
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = d("div", {
|
|
1021
1074
|
className: "slider-control slider-wrapper",
|
|
1022
1075
|
"data-control": n,
|
|
@@ -1025,7 +1078,7 @@ function ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1025
1078
|
"div",
|
|
1026
1079
|
{ className: "slider-header" },
|
|
1027
1080
|
d("label", { for: s, className: "slider-label" }, e),
|
|
1028
|
-
d("span", { className: "slider-value", id: `${s}-value` },
|
|
1081
|
+
d("span", { className: "slider-value", id: `${s}-value` }, q(a))
|
|
1029
1082
|
), u = d("input", {
|
|
1030
1083
|
type: "range",
|
|
1031
1084
|
id: s,
|
|
@@ -1036,19 +1089,19 @@ function ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1036
1089
|
value: String(a),
|
|
1037
1090
|
onInput: (h) => {
|
|
1038
1091
|
const p = parseFloat(h.target.value), m = l.querySelector(".slider-value");
|
|
1039
|
-
m && (m.textContent =
|
|
1092
|
+
m && (m.textContent = q(p)), o == null || o(p);
|
|
1040
1093
|
}
|
|
1041
1094
|
});
|
|
1042
1095
|
return l.appendChild(c), l.appendChild(u), l.setValue = (h) => {
|
|
1043
1096
|
u.value = String(h);
|
|
1044
1097
|
const p = l.querySelector(".slider-value");
|
|
1045
|
-
p && (p.textContent =
|
|
1098
|
+
p && (p.textContent = q(h));
|
|
1046
1099
|
}, l;
|
|
1047
1100
|
}
|
|
1048
|
-
function
|
|
1101
|
+
function q(s) {
|
|
1049
1102
|
return Number.isInteger(s) ? String(s) : s.toFixed(2);
|
|
1050
1103
|
}
|
|
1051
|
-
function
|
|
1104
|
+
function ne({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
1052
1105
|
const r = d("div", { className: "toggle-control" }), a = d("label", { className: "toggle-label", for: s }, e), o = d("input", {
|
|
1053
1106
|
type: "checkbox",
|
|
1054
1107
|
id: s,
|
|
@@ -1065,7 +1118,7 @@ function oe({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
|
1065
1118
|
o.checked = c;
|
|
1066
1119
|
}, r;
|
|
1067
1120
|
}
|
|
1068
|
-
function
|
|
1121
|
+
function le({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
1069
1122
|
const r = d("div", { className: "color-control" }), a = d("label", { className: "color-label", for: s }, e), o = d("input", {
|
|
1070
1123
|
type: "color",
|
|
1071
1124
|
id: s,
|
|
@@ -1077,7 +1130,7 @@ function ne({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
|
1077
1130
|
o.value = n;
|
|
1078
1131
|
}, r;
|
|
1079
1132
|
}
|
|
1080
|
-
function
|
|
1133
|
+
function ce({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
1081
1134
|
const a = d("div", { className: "select-control" }), o = d("label", { className: "select-label", for: s }, e), n = d("select", {
|
|
1082
1135
|
id: s,
|
|
1083
1136
|
className: "select-input",
|
|
@@ -1091,7 +1144,7 @@ function le({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
|
1091
1144
|
n.value = l;
|
|
1092
1145
|
}, a;
|
|
1093
1146
|
}
|
|
1094
|
-
function
|
|
1147
|
+
function F({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
|
|
1095
1148
|
const a = d("button", {
|
|
1096
1149
|
type: "button",
|
|
1097
1150
|
className: `btn ${e}`.trim(),
|
|
@@ -1121,7 +1174,7 @@ function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1,
|
|
|
1121
1174
|
const c = l.querySelector("svg");
|
|
1122
1175
|
return c && c.setAttribute("aria-hidden", "true"), l;
|
|
1123
1176
|
}
|
|
1124
|
-
function
|
|
1177
|
+
function Z({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
1125
1178
|
const r = d("button", {
|
|
1126
1179
|
type: "button",
|
|
1127
1180
|
className: `chip ${t ? "active" : ""}`.trim(),
|
|
@@ -1137,8 +1190,8 @@ function W({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
|
1137
1190
|
r.classList.toggle("active", a);
|
|
1138
1191
|
}, r;
|
|
1139
1192
|
}
|
|
1140
|
-
const
|
|
1141
|
-
class
|
|
1193
|
+
const 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="M328 112L184 256l144 144"/></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="48" d="M184 112l144 144-144 144"/></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="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>', Ae = '<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>', 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="M432 320v112H320M80 192V80h112M320 80h112v112M192 432H80V320"/></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="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>', 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="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>', Te = '<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>', 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="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>', 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="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></svg>', Xe = '<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>', 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="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>', Ye = '<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>', K = '<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>', 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="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>', 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="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>', 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="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>', 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="M416 128L192 384l-96-96"/></svg>', Le = '<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>', De = '<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>', 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="M80 96h64l64 320h64l64-160h96"/></svg>', Q = '<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>', J = '<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>', 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="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>';
|
|
1194
|
+
class je {
|
|
1142
1195
|
constructor(e, t) {
|
|
1143
1196
|
this.state = e, this.editor = t, this.element = null, this._unsubscribers = [];
|
|
1144
1197
|
}
|
|
@@ -1149,7 +1202,7 @@ class Le {
|
|
|
1149
1202
|
render() {
|
|
1150
1203
|
this.element = d("div", { className: "editor-toolbar" });
|
|
1151
1204
|
const e = d("div", { className: "toolbar-section toolbar-left" }), t = x({
|
|
1152
|
-
icon:
|
|
1205
|
+
icon: Oe,
|
|
1153
1206
|
title: "Open Image",
|
|
1154
1207
|
className: "toolbar-btn",
|
|
1155
1208
|
testId: "btn-open-image",
|
|
@@ -1158,7 +1211,7 @@ class Le {
|
|
|
1158
1211
|
});
|
|
1159
1212
|
e.appendChild(t);
|
|
1160
1213
|
const i = d("div", { className: "toolbar-section toolbar-center" }), r = x({
|
|
1161
|
-
icon:
|
|
1214
|
+
icon: Ae,
|
|
1162
1215
|
title: "Zoom Out",
|
|
1163
1216
|
className: "toolbar-btn",
|
|
1164
1217
|
testId: "btn-zoom-out",
|
|
@@ -1175,7 +1228,7 @@ class Le {
|
|
|
1175
1228
|
role: "status"
|
|
1176
1229
|
}, "100%");
|
|
1177
1230
|
const a = x({
|
|
1178
|
-
icon:
|
|
1231
|
+
icon: Fe,
|
|
1179
1232
|
title: "Zoom In",
|
|
1180
1233
|
className: "toolbar-btn",
|
|
1181
1234
|
testId: "btn-zoom-in",
|
|
@@ -1185,7 +1238,7 @@ class Le {
|
|
|
1185
1238
|
this.editor.setZoom(h + 0.25);
|
|
1186
1239
|
}
|
|
1187
1240
|
}), o = x({
|
|
1188
|
-
icon:
|
|
1241
|
+
icon: ze,
|
|
1189
1242
|
title: "Fit to Screen",
|
|
1190
1243
|
className: "toolbar-btn",
|
|
1191
1244
|
testId: "btn-fit-screen",
|
|
@@ -1195,14 +1248,14 @@ class Le {
|
|
|
1195
1248
|
i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
|
|
1196
1249
|
const n = d("div", { className: "toolbar-section toolbar-right" });
|
|
1197
1250
|
this._themeBtn = x({
|
|
1198
|
-
icon: this.state.get("isDarkMode") ?
|
|
1251
|
+
icon: this.state.get("isDarkMode") ? Q : J,
|
|
1199
1252
|
title: "Toggle Theme",
|
|
1200
1253
|
className: "toolbar-btn toolbar-btn-theme",
|
|
1201
1254
|
testId: "btn-toggle-theme",
|
|
1202
1255
|
ariaLabel: "Toggle theme",
|
|
1203
1256
|
onClick: () => this.editor.toggleTheme()
|
|
1204
1257
|
}), this._cropBtn = x({
|
|
1205
|
-
icon:
|
|
1258
|
+
icon: ue,
|
|
1206
1259
|
title: "Crop",
|
|
1207
1260
|
className: "toolbar-btn toolbar-btn-crop",
|
|
1208
1261
|
testId: "btn-crop",
|
|
@@ -1212,21 +1265,21 @@ class Le {
|
|
|
1212
1265
|
}
|
|
1213
1266
|
});
|
|
1214
1267
|
const l = x({
|
|
1215
|
-
icon:
|
|
1268
|
+
icon: pe,
|
|
1216
1269
|
title: "Reset All",
|
|
1217
1270
|
className: "toolbar-btn",
|
|
1218
1271
|
testId: "btn-reset-all",
|
|
1219
1272
|
ariaLabel: "Reset all changes",
|
|
1220
1273
|
onClick: () => this.editor.resetAll()
|
|
1221
1274
|
}), c = x({
|
|
1222
|
-
icon:
|
|
1275
|
+
icon: Ye,
|
|
1223
1276
|
title: "Save Image",
|
|
1224
1277
|
className: "toolbar-btn toolbar-btn-primary",
|
|
1225
1278
|
testId: "btn-save-edit",
|
|
1226
1279
|
ariaLabel: "Save image",
|
|
1227
1280
|
onClick: () => this.editor.save()
|
|
1228
1281
|
}), u = x({
|
|
1229
|
-
icon:
|
|
1282
|
+
icon: K,
|
|
1230
1283
|
title: "Close",
|
|
1231
1284
|
className: "toolbar-btn",
|
|
1232
1285
|
testId: "btn-cancel-edit",
|
|
@@ -1244,7 +1297,7 @@ class Le {
|
|
|
1244
1297
|
});
|
|
1245
1298
|
this._unsubscribers.push(e);
|
|
1246
1299
|
const t = this.state.on("change:isDarkMode", ({ value: r }) => {
|
|
1247
|
-
this._themeBtn.innerHTML = r ?
|
|
1300
|
+
this._themeBtn.innerHTML = r ? Q : J;
|
|
1248
1301
|
});
|
|
1249
1302
|
this._unsubscribers.push(t);
|
|
1250
1303
|
const i = this.state.on("change:mode", ({ value: r }) => {
|
|
@@ -1268,23 +1321,23 @@ class Le {
|
|
|
1268
1321
|
}
|
|
1269
1322
|
}
|
|
1270
1323
|
const L = [
|
|
1271
|
-
{ id: "adjust", name: "Adjust", icon:
|
|
1324
|
+
{ id: "adjust", name: "Adjust", icon: Re },
|
|
1272
1325
|
// adjustment, adjustmentAdvanced, alpha
|
|
1273
|
-
{ id: "blur", name: "Blur", icon:
|
|
1326
|
+
{ id: "blur", name: "Blur", icon: Ne },
|
|
1274
1327
|
// blur, kawaseBlur, motionBlur, radialBlur, etc.
|
|
1275
|
-
{ id: "color", name: "Color", icon:
|
|
1328
|
+
{ id: "color", name: "Color", icon: Te },
|
|
1276
1329
|
// colorOverlay, grayscale, hslAdjustment, etc.
|
|
1277
|
-
{ id: "effects", name: "Effects", icon:
|
|
1330
|
+
{ id: "effects", name: "Effects", icon: Ie },
|
|
1278
1331
|
// noise, vignette, pixelate, dropShadow, etc.
|
|
1279
|
-
{ id: "distortion", name: "Distortion", icon:
|
|
1332
|
+
{ id: "distortion", name: "Distortion", icon: Ee },
|
|
1280
1333
|
// twist, bulgePinch, displacement, etc.
|
|
1281
|
-
{ id: "light", name: "Light", icon:
|
|
1334
|
+
{ id: "light", name: "Light", icon: Xe },
|
|
1282
1335
|
// bloom, glow, godray, advancedBloom
|
|
1283
|
-
{ id: "stylize", name: "Stylize", icon:
|
|
1336
|
+
{ id: "stylize", name: "Stylize", icon: Ve },
|
|
1284
1337
|
// ascii, crt, crossHatch, dot, emboss
|
|
1285
|
-
{ id: "crop", name: "Crop", icon:
|
|
1338
|
+
{ id: "crop", name: "Crop", icon: ue }
|
|
1286
1339
|
];
|
|
1287
|
-
class
|
|
1340
|
+
class qe {
|
|
1288
1341
|
constructor(e, t) {
|
|
1289
1342
|
this.state = e, this.editor = t, this.element = null, this._chips = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [];
|
|
1290
1343
|
}
|
|
@@ -1298,12 +1351,12 @@ class De {
|
|
|
1298
1351
|
className: "category-carousel-container",
|
|
1299
1352
|
"data-testid": "category-carousel"
|
|
1300
1353
|
}), this._leftBtn = x({
|
|
1301
|
-
icon:
|
|
1354
|
+
icon: he,
|
|
1302
1355
|
title: "Previous categories",
|
|
1303
1356
|
className: "carousel-nav carousel-nav-left",
|
|
1304
1357
|
onClick: () => this._scrollLeft()
|
|
1305
1358
|
}), this._carousel = d("div", { className: "category-carousel" }), L.forEach((i) => {
|
|
1306
|
-
const r =
|
|
1359
|
+
const r = Z({
|
|
1307
1360
|
label: i.name,
|
|
1308
1361
|
icon: i.icon,
|
|
1309
1362
|
active: this.state.get("selectedCategory") === i.id,
|
|
@@ -1311,7 +1364,7 @@ class De {
|
|
|
1311
1364
|
});
|
|
1312
1365
|
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
1366
|
}), this._rightBtn = x({
|
|
1314
|
-
icon:
|
|
1367
|
+
icon: de,
|
|
1315
1368
|
title: "Next categories",
|
|
1316
1369
|
className: "carousel-nav carousel-nav-right",
|
|
1317
1370
|
onClick: () => this._scrollRight()
|
|
@@ -1419,7 +1472,7 @@ class De {
|
|
|
1419
1472
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1420
1473
|
}
|
|
1421
1474
|
}
|
|
1422
|
-
class
|
|
1475
|
+
class He {
|
|
1423
1476
|
constructor(e, t) {
|
|
1424
1477
|
this.state = e, this.filterManager = t, this.element = null, this._filterCards = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [], this._onToggle = null, this._onSelect = null;
|
|
1425
1478
|
}
|
|
@@ -1430,12 +1483,12 @@ class Ue {
|
|
|
1430
1483
|
*/
|
|
1431
1484
|
render({ onToggle: e, onSelect: t }) {
|
|
1432
1485
|
return this._onToggle = e, this._onSelect = t, this.element = d("div", { className: "filter-carousel-container" }), this._leftBtn = x({
|
|
1433
|
-
icon:
|
|
1486
|
+
icon: he,
|
|
1434
1487
|
title: "Previous filters",
|
|
1435
1488
|
className: "carousel-nav carousel-nav-left",
|
|
1436
1489
|
onClick: () => this._scrollLeft()
|
|
1437
1490
|
}), this._carousel = d("div", { className: "filter-carousel" }), this._rightBtn = x({
|
|
1438
|
-
icon:
|
|
1491
|
+
icon: de,
|
|
1439
1492
|
title: "Next filters",
|
|
1440
1493
|
className: "carousel-nav carousel-nav-right",
|
|
1441
1494
|
onClick: () => this._scrollRight()
|
|
@@ -1497,7 +1550,7 @@ class Ue {
|
|
|
1497
1550
|
this._handleToggle(e.id, h), h && (this.state.set("selectedFilter", e.id), (p = this._onSelect) == null || p.call(this, e.id));
|
|
1498
1551
|
}
|
|
1499
1552
|
});
|
|
1500
|
-
return l.innerHTML = t ?
|
|
1553
|
+
return l.innerHTML = t ? G : "", r.appendChild(a), r.appendChild(n), r.appendChild(l), r._toggle = l, r._isActive = t, r;
|
|
1501
1554
|
}
|
|
1502
1555
|
/**
|
|
1503
1556
|
* Handle filter card click (select)
|
|
@@ -1523,7 +1576,7 @@ class Ue {
|
|
|
1523
1576
|
const e = this.state.get("activeFilters");
|
|
1524
1577
|
this._filterCards.forEach((t, i) => {
|
|
1525
1578
|
const r = e.has(i);
|
|
1526
|
-
t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ?
|
|
1579
|
+
t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ? G : "", t._isActive = r;
|
|
1527
1580
|
});
|
|
1528
1581
|
}
|
|
1529
1582
|
/**
|
|
@@ -1576,7 +1629,7 @@ class Ue {
|
|
|
1576
1629
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterCards.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1577
1630
|
}
|
|
1578
1631
|
}
|
|
1579
|
-
class
|
|
1632
|
+
class $e {
|
|
1580
1633
|
constructor(e, t) {
|
|
1581
1634
|
this.state = e, this.filterManager = t, this.element = null, this._controls = /* @__PURE__ */ new Map(), this._onChange = null, this._onReset = null, this._onAction = null, this._unsubscribers = [];
|
|
1582
1635
|
}
|
|
@@ -1621,7 +1674,7 @@ class Ve {
|
|
|
1621
1674
|
return;
|
|
1622
1675
|
}
|
|
1623
1676
|
const i = d("div", { className: "adjustments-header" });
|
|
1624
|
-
i.appendChild(d("span", { className: "adjustments-title" }, t.name)), i.appendChild(
|
|
1677
|
+
i.appendChild(d("span", { className: "adjustments-title" }, t.name)), i.appendChild(F({
|
|
1625
1678
|
label: "Reset",
|
|
1626
1679
|
className: "btn-text",
|
|
1627
1680
|
onClick: () => this._handleReset(e)
|
|
@@ -1644,7 +1697,7 @@ class Ve {
|
|
|
1644
1697
|
const r = t.label || t.id;
|
|
1645
1698
|
switch (this._normalizeControlType(t.type)) {
|
|
1646
1699
|
case "slider":
|
|
1647
|
-
return
|
|
1700
|
+
return oe({
|
|
1648
1701
|
id: `${e}-${t.id}`,
|
|
1649
1702
|
label: r,
|
|
1650
1703
|
min: t.min ?? 0,
|
|
@@ -1654,14 +1707,14 @@ class Ve {
|
|
|
1654
1707
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1655
1708
|
});
|
|
1656
1709
|
case "toggle":
|
|
1657
|
-
return
|
|
1710
|
+
return ne({
|
|
1658
1711
|
id: `${e}-${t.id}`,
|
|
1659
1712
|
label: r,
|
|
1660
1713
|
checked: !!i,
|
|
1661
1714
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1662
1715
|
});
|
|
1663
1716
|
case "color":
|
|
1664
|
-
return
|
|
1717
|
+
return le({
|
|
1665
1718
|
id: `${e}-${t.id}`,
|
|
1666
1719
|
label: r,
|
|
1667
1720
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1669,7 +1722,7 @@ class Ve {
|
|
|
1669
1722
|
});
|
|
1670
1723
|
case "select":
|
|
1671
1724
|
const o = this._normalizeOptions(t.options);
|
|
1672
|
-
return
|
|
1725
|
+
return ce({
|
|
1673
1726
|
id: `${e}-${t.id}`,
|
|
1674
1727
|
label: r,
|
|
1675
1728
|
options: o,
|
|
@@ -1678,7 +1731,7 @@ class Ve {
|
|
|
1678
1731
|
});
|
|
1679
1732
|
case "button":
|
|
1680
1733
|
const n = d("div", { className: "button-control" });
|
|
1681
|
-
return n.appendChild(
|
|
1734
|
+
return n.appendChild(F({
|
|
1682
1735
|
label: r,
|
|
1683
1736
|
className: "btn-secondary",
|
|
1684
1737
|
onClick: () => this._handleAction(e, t.action || t.id)
|
|
@@ -1779,7 +1832,7 @@ class Ve {
|
|
|
1779
1832
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._controls.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1780
1833
|
}
|
|
1781
1834
|
}
|
|
1782
|
-
class
|
|
1835
|
+
class We {
|
|
1783
1836
|
constructor(e, t) {
|
|
1784
1837
|
this.state = e, this.filterManager = t, this._drawer = null, this._body = null, this._titleEl = null, this._isOpen = !1, this._currentFilterId = null, this._controls = /* @__PURE__ */ new Map(), this._onChange = null, this._onReset = null, this._onRemove = null, this._onAction = null, this._container = null;
|
|
1785
1838
|
}
|
|
@@ -1792,14 +1845,14 @@ class je {
|
|
|
1792
1845
|
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = d("div", { className: "mobile-filter-drawer" });
|
|
1793
1846
|
const o = d("div", { className: "drawer-header" });
|
|
1794
1847
|
this._titleEl = d("span", { className: "drawer-title" }, "Filter");
|
|
1795
|
-
const n = d("div", { className: "drawer-header-actions" }), l =
|
|
1848
|
+
const n = d("div", { className: "drawer-header-actions" }), l = F({
|
|
1796
1849
|
label: "Reset",
|
|
1797
1850
|
className: "btn-text",
|
|
1798
1851
|
onClick: () => {
|
|
1799
1852
|
var h;
|
|
1800
1853
|
this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
|
|
1801
1854
|
}
|
|
1802
|
-
}), c =
|
|
1855
|
+
}), c = F({
|
|
1803
1856
|
label: "Remove",
|
|
1804
1857
|
className: "btn-text btn-danger",
|
|
1805
1858
|
onClick: () => {
|
|
@@ -1807,7 +1860,7 @@ class je {
|
|
|
1807
1860
|
this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
|
|
1808
1861
|
}
|
|
1809
1862
|
}), u = x({
|
|
1810
|
-
icon:
|
|
1863
|
+
icon: K,
|
|
1811
1864
|
title: "Close",
|
|
1812
1865
|
className: "btn-icon-sm",
|
|
1813
1866
|
ariaLabel: "Close drawer",
|
|
@@ -1881,7 +1934,7 @@ class je {
|
|
|
1881
1934
|
const r = t.label || t.id;
|
|
1882
1935
|
switch (this._normalizeControlType(t.type)) {
|
|
1883
1936
|
case "slider":
|
|
1884
|
-
return
|
|
1937
|
+
return oe({
|
|
1885
1938
|
id: `drawer-${e}-${t.id}`,
|
|
1886
1939
|
label: r,
|
|
1887
1940
|
min: t.min ?? 0,
|
|
@@ -1894,7 +1947,7 @@ class je {
|
|
|
1894
1947
|
}
|
|
1895
1948
|
});
|
|
1896
1949
|
case "toggle":
|
|
1897
|
-
return
|
|
1950
|
+
return ne({
|
|
1898
1951
|
id: `drawer-${e}-${t.id}`,
|
|
1899
1952
|
label: r,
|
|
1900
1953
|
checked: !!i,
|
|
@@ -1904,7 +1957,7 @@ class je {
|
|
|
1904
1957
|
}
|
|
1905
1958
|
});
|
|
1906
1959
|
case "color":
|
|
1907
|
-
return
|
|
1960
|
+
return le({
|
|
1908
1961
|
id: `drawer-${e}-${t.id}`,
|
|
1909
1962
|
label: r,
|
|
1910
1963
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1915,7 +1968,7 @@ class je {
|
|
|
1915
1968
|
});
|
|
1916
1969
|
case "select": {
|
|
1917
1970
|
const o = this._normalizeOptions(t.options);
|
|
1918
|
-
return
|
|
1971
|
+
return ce({
|
|
1919
1972
|
id: `drawer-${e}-${t.id}`,
|
|
1920
1973
|
label: r,
|
|
1921
1974
|
options: o,
|
|
@@ -1928,7 +1981,7 @@ class je {
|
|
|
1928
1981
|
}
|
|
1929
1982
|
case "button": {
|
|
1930
1983
|
const o = d("div", { className: "button-control" });
|
|
1931
|
-
return o.appendChild(
|
|
1984
|
+
return o.appendChild(F({
|
|
1932
1985
|
label: r,
|
|
1933
1986
|
className: "btn-secondary",
|
|
1934
1987
|
onClick: () => {
|
|
@@ -1975,7 +2028,7 @@ class je {
|
|
|
1975
2028
|
this._controls.clear(), (e = this._drawer) == null || e.remove(), this._drawer = null, this._isOpen = !1, this._currentFilterId = null, this._container = null;
|
|
1976
2029
|
}
|
|
1977
2030
|
}
|
|
1978
|
-
class
|
|
2031
|
+
class Ze {
|
|
1979
2032
|
constructor(e, t) {
|
|
1980
2033
|
this.state = e, this.filterManager = t, this.element = null, this._scrollContainer = null, this._chips = /* @__PURE__ */ new Map(), this._unsubscribers = [], this._onToggle = null, this._onSelect = null;
|
|
1981
2034
|
}
|
|
@@ -2048,11 +2101,11 @@ class qe {
|
|
|
2048
2101
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2049
2102
|
}
|
|
2050
2103
|
}
|
|
2051
|
-
const
|
|
2052
|
-
{ id: "free", name: "Free", icon:
|
|
2053
|
-
{ id: "square", name: "Square", icon:
|
|
2054
|
-
{ id: "circle", name: "Circle", icon:
|
|
2055
|
-
],
|
|
2104
|
+
const Ge = [
|
|
2105
|
+
{ id: "free", name: "Free", icon: Ue },
|
|
2106
|
+
{ id: "square", name: "Square", icon: Le },
|
|
2107
|
+
{ id: "circle", name: "Circle", icon: De }
|
|
2108
|
+
], Ke = [
|
|
2056
2109
|
{ id: "free", name: "Free" },
|
|
2057
2110
|
{ id: "1:1", name: "1:1" },
|
|
2058
2111
|
{ id: "4:3", name: "4:3" },
|
|
@@ -2060,10 +2113,18 @@ const He = [
|
|
|
2060
2113
|
{ id: "3:2", name: "3:2" },
|
|
2061
2114
|
{ id: "2:3", name: "2:3" }
|
|
2062
2115
|
];
|
|
2063
|
-
class
|
|
2116
|
+
class Qe {
|
|
2064
2117
|
constructor(e, t) {
|
|
2065
2118
|
this.state = e, this.cropManager = t, this.element = null, this._shapeChips = /* @__PURE__ */ new Map(), this._aspectChips = /* @__PURE__ */ new Map(), this._unsubscribers = [];
|
|
2066
2119
|
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Apply crop and return the editor UI to filter mode.
|
|
2122
|
+
* If crop application cannot complete, force-disable crop mode to avoid
|
|
2123
|
+
* leaving the editor stuck in crop controls.
|
|
2124
|
+
*/
|
|
2125
|
+
_applyCropAndReturnToFilters() {
|
|
2126
|
+
this.cropManager.apply() === null && typeof this.cropManager.disable == "function" && this.cropManager.disable(), this.state.set("selectedCategory", "adjust");
|
|
2127
|
+
}
|
|
2067
2128
|
/**
|
|
2068
2129
|
* Create and render the crop controls
|
|
2069
2130
|
* @returns {HTMLElement}
|
|
@@ -2076,8 +2137,8 @@ class We {
|
|
|
2076
2137
|
const e = d("div", { className: "crop-section" });
|
|
2077
2138
|
e.appendChild(d("label", { className: "section-label" }, "Shape"));
|
|
2078
2139
|
const t = d("div", { className: "chip-row" }), i = this.state.get("crop.shape");
|
|
2079
|
-
|
|
2080
|
-
const u =
|
|
2140
|
+
Ge.forEach((c) => {
|
|
2141
|
+
const u = Z({
|
|
2081
2142
|
label: c.name,
|
|
2082
2143
|
icon: c.icon,
|
|
2083
2144
|
active: i === c.id,
|
|
@@ -2086,26 +2147,26 @@ class We {
|
|
|
2086
2147
|
u.dataset.shape = c.id, u.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, u), t.appendChild(u);
|
|
2087
2148
|
}), 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
2149
|
const r = d("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
|
|
2089
|
-
|
|
2090
|
-
const u =
|
|
2150
|
+
Ke.forEach((c) => {
|
|
2151
|
+
const u = Z({
|
|
2091
2152
|
label: c.name,
|
|
2092
2153
|
active: a === c.id,
|
|
2093
2154
|
onClick: () => this._selectAspect(c.id)
|
|
2094
2155
|
});
|
|
2095
2156
|
u.dataset.ratio = c.id, u.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, u), r.appendChild(u);
|
|
2096
2157
|
}), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
|
|
2097
|
-
const o = d("div", { className: "crop-actions" }), n =
|
|
2158
|
+
const o = d("div", { className: "crop-actions" }), n = F({
|
|
2098
2159
|
label: "Cancel",
|
|
2099
2160
|
className: "btn-secondary crop-cancel-btn",
|
|
2100
|
-
icon:
|
|
2161
|
+
icon: K,
|
|
2101
2162
|
onClick: () => this.cropManager.cancel()
|
|
2102
2163
|
});
|
|
2103
2164
|
n.dataset.testid = "cancel-crop";
|
|
2104
|
-
const l =
|
|
2165
|
+
const l = F({
|
|
2105
2166
|
label: "Apply Crop",
|
|
2106
2167
|
className: "btn-primary crop-apply-btn",
|
|
2107
|
-
icon:
|
|
2108
|
-
onClick: () => this.
|
|
2168
|
+
icon: G,
|
|
2169
|
+
onClick: () => this._applyCropAndReturnToFilters()
|
|
2109
2170
|
});
|
|
2110
2171
|
return l.dataset.testid = "apply-crop", o.appendChild(n), o.appendChild(l), this.element.appendChild(o), this._subscribeToState(), this.element;
|
|
2111
2172
|
}
|
|
@@ -2167,7 +2228,7 @@ class We {
|
|
|
2167
2228
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._shapeChips.clear(), this._aspectChips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2168
2229
|
}
|
|
2169
2230
|
}
|
|
2170
|
-
class
|
|
2231
|
+
class Je {
|
|
2171
2232
|
constructor(e, t) {
|
|
2172
2233
|
this.state = e, this.filterManager = t, this.element = null, this._filterItems = /* @__PURE__ */ new Map(), this._unsubscribers = [], this._onRemove = null, this._onReset = null, this._onClearAll = null, this._onUpdateValue = null, this._onSelect = null;
|
|
2173
2234
|
}
|
|
@@ -2183,7 +2244,7 @@ class Ze {
|
|
|
2183
2244
|
});
|
|
2184
2245
|
const o = d("div", { className: "panel-header" });
|
|
2185
2246
|
o.appendChild(d("h3", { className: "panel-title" }, "Active Filters"));
|
|
2186
|
-
const n =
|
|
2247
|
+
const n = F({
|
|
2187
2248
|
label: "Clear All",
|
|
2188
2249
|
className: "btn-text btn-danger",
|
|
2189
2250
|
onClick: () => this._handleClearAll()
|
|
@@ -2250,12 +2311,12 @@ class Ze {
|
|
|
2250
2311
|
m.target.closest(".filter-item-actions") || this._handleSelect(e);
|
|
2251
2312
|
}
|
|
2252
2313
|
}), 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({
|
|
2253
|
-
icon:
|
|
2314
|
+
icon: pe,
|
|
2254
2315
|
title: "Reset filter",
|
|
2255
2316
|
className: "btn-icon-sm",
|
|
2256
2317
|
onClick: () => this._handleReset(e)
|
|
2257
2318
|
}), u = x({
|
|
2258
|
-
icon:
|
|
2319
|
+
icon: Be,
|
|
2259
2320
|
title: "Remove filter",
|
|
2260
2321
|
className: "btn-icon-sm btn-danger",
|
|
2261
2322
|
onClick: () => this._handleRemove(e)
|
|
@@ -2380,7 +2441,7 @@ const Y = {
|
|
|
2380
2441
|
showCropControls: !0,
|
|
2381
2442
|
maxExportWidth: void 0,
|
|
2382
2443
|
maxExportHeight: void 0
|
|
2383
|
-
},
|
|
2444
|
+
}, H = {
|
|
2384
2445
|
free: {
|
|
2385
2446
|
...Y
|
|
2386
2447
|
},
|
|
@@ -2415,15 +2476,15 @@ const Y = {
|
|
|
2415
2476
|
lockAspectRatio: !1
|
|
2416
2477
|
}
|
|
2417
2478
|
};
|
|
2418
|
-
function
|
|
2479
|
+
function et(s) {
|
|
2419
2480
|
if (!s)
|
|
2420
|
-
return { ...
|
|
2481
|
+
return { ...H.free };
|
|
2421
2482
|
if (typeof s == "object" && s !== null)
|
|
2422
2483
|
return { ...Y, ...s };
|
|
2423
|
-
const e =
|
|
2424
|
-
return e ? { ...e } : { ...
|
|
2484
|
+
const e = H[s];
|
|
2485
|
+
return e ? { ...e } : { ...H.free };
|
|
2425
2486
|
}
|
|
2426
|
-
class
|
|
2487
|
+
class ei extends B {
|
|
2427
2488
|
/**
|
|
2428
2489
|
* Create a new VanillaImageEditor
|
|
2429
2490
|
* @param {HTMLElement} container - Container element to mount the editor
|
|
@@ -2433,8 +2494,8 @@ class Gt extends B {
|
|
|
2433
2494
|
var a, o, n;
|
|
2434
2495
|
if (super(), !e)
|
|
2435
2496
|
throw new Error("VanillaImageEditor: container element is required");
|
|
2436
|
-
this._container = e;
|
|
2437
|
-
const i = t.preset ?
|
|
2497
|
+
this._container = e, this._destroyed = !1, this._loadVersion = 0, this._objectUrls = /* @__PURE__ */ new Set();
|
|
2498
|
+
const i = t.preset ? et(t.preset) : null, r = i ? {
|
|
2438
2499
|
initialMode: i.initialMode === "crop" ? "crop" : "adjust",
|
|
2439
2500
|
cropShape: i.cropShape,
|
|
2440
2501
|
initialAspectRatio: i.aspectRatio
|
|
@@ -2452,7 +2513,7 @@ class Gt extends B {
|
|
|
2452
2513
|
},
|
|
2453
2514
|
...r,
|
|
2454
2515
|
...t
|
|
2455
|
-
}, this._preset = i, this._state =
|
|
2516
|
+
}, this._preset = i, this._state = Se(), 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 ve(), this._filterManager = new Pe(this._state, this._renderer), this._cropManager = new W(this._state, this._renderer), this._removeBgManager = null, ((a = this._options.backgroundRemoval) == null ? void 0 : a.enabled) !== !1 && (this._removeBgManager = new Me({
|
|
2456
2517
|
endpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.endpoint,
|
|
2457
2518
|
fallbackEndpoint: (n = this._options.backgroundRemoval) == null ? void 0 : n.fallbackEndpoint
|
|
2458
2519
|
})), 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();
|
|
@@ -2488,31 +2549,31 @@ class Gt extends B {
|
|
|
2488
2549
|
* Initialize UI components
|
|
2489
2550
|
*/
|
|
2490
2551
|
_initUI() {
|
|
2491
|
-
this._toolbar = new
|
|
2552
|
+
this._toolbar = new je(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = d("div", { className: "filter-controls-container" }), this._categoryCarousel = new qe(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
|
|
2492
2553
|
}));
|
|
2493
2554
|
const e = d("div", { className: "filter-layout" }), t = d("div", { className: "filter-left-column" });
|
|
2494
|
-
this._filterCarousel = new
|
|
2555
|
+
this._filterCarousel = new He(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
|
|
2495
2556
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2496
2557
|
onSelect: (r) => {
|
|
2497
2558
|
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2498
2559
|
}
|
|
2499
|
-
})), this._filterAdjustments = new
|
|
2560
|
+
})), this._filterAdjustments = new $e(this._state, this._filterManager), t.appendChild(this._filterAdjustments.render({
|
|
2500
2561
|
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2501
2562
|
onReset: (r) => this._handleFilterReset(r),
|
|
2502
2563
|
onAction: (r, a) => this._handleFilterAction(r, a)
|
|
2503
2564
|
})), e.appendChild(t);
|
|
2504
2565
|
const i = d("div", { className: "filter-right-column" });
|
|
2505
|
-
this._activeFiltersPanel = new
|
|
2566
|
+
this._activeFiltersPanel = new Je(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
|
|
2506
2567
|
onRemove: (r) => this._handleFilterToggle(r, !1),
|
|
2507
2568
|
onReset: (r) => this._handleFilterReset(r),
|
|
2508
2569
|
onClearAll: () => this.resetAll(),
|
|
2509
2570
|
onSelect: (r) => this._handleFilterSelect(r)
|
|
2510
|
-
})), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new
|
|
2571
|
+
})), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new Ze(this._state, this._filterManager), this._filterControlsEl.appendChild(this._mobileActiveFilters.render({
|
|
2511
2572
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2512
2573
|
onSelect: (r) => {
|
|
2513
2574
|
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2514
2575
|
}
|
|
2515
|
-
})), this._cropControls = new
|
|
2576
|
+
})), this._cropControls = new Qe(this._state, this._cropManager), this._cropControlsEl = this._cropControls.render(), this._cropControlsEl.style.display = "none", this._controlsSection.appendChild(this._filterControlsEl), this._controlsSection.appendChild(this._cropControlsEl), this._mobileFilterDrawer = new We(this._state, this._filterManager), this._mobileFilterDrawer.build(this._controlsSection, {
|
|
2516
2577
|
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2517
2578
|
onReset: (r) => this._handleFilterReset(r),
|
|
2518
2579
|
onRemove: (r) => {
|
|
@@ -2626,22 +2687,37 @@ class Gt extends B {
|
|
|
2626
2687
|
}
|
|
2627
2688
|
/**
|
|
2628
2689
|
* Load an image into the editor
|
|
2629
|
-
* @param {string|File} imageSource - URL, data URL, or File object
|
|
2690
|
+
* @param {string|Blob|File} imageSource - URL, data URL, Blob, or File object
|
|
2691
|
+
* @param {Object} [options] - Load options
|
|
2692
|
+
* @param {Object|null} [options.state] - ImageEditorSessionState to restore
|
|
2693
|
+
* @param {string|number} [options.sessionKey] - Session boundary identifier
|
|
2630
2694
|
*/
|
|
2631
|
-
async loadImage(e) {
|
|
2632
|
-
|
|
2633
|
-
|
|
2695
|
+
async loadImage(e, t = {}) {
|
|
2696
|
+
if (this._destroyed) return;
|
|
2697
|
+
const i = ++this._loadVersion;
|
|
2698
|
+
let r = e;
|
|
2699
|
+
this._resetEditorState(), e instanceof Blob && (r = URL.createObjectURL(e), this._objectUrls.add(r)), await this._renderer.loadTexture(r), !(this._destroyed || this._loadVersion !== i) && (this._state.set("hasImage", !0), this._state.set("imageUrl", r), t.state && this._hydrateState(t.state), this._options.initialMode === "crop" && this.setMode("crop"), this.emit("imageLoaded", { url: r }));
|
|
2634
2700
|
}
|
|
2635
2701
|
/**
|
|
2636
|
-
*
|
|
2637
|
-
*
|
|
2638
|
-
* @returns {Promise<string>}
|
|
2702
|
+
* Reset all editor state (filters + crop) to a clean baseline.
|
|
2703
|
+
* Called at the start of loadImage() to prevent stale state bleed between sessions.
|
|
2639
2704
|
*/
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2705
|
+
_resetEditorState() {
|
|
2706
|
+
this._filterManager.resetAll(), this._state.set("crop.rect", null), this._state.set("crop.appliedRect", null), this._state.set("crop.appliedShape", null), this._state.set("crop.appliedAspect", null), this._state.set("crop.shape", this._options.cropShape || "free"), this._state.set("crop.aspect", this._options.initialAspectRatio || "free"), this._state.get("mode") === "crop" && (this._cropManager.disable(), this._state.set("mode", "filters"));
|
|
2707
|
+
}
|
|
2708
|
+
/**
|
|
2709
|
+
* Hydrate editor state from a canonical ImageEditorSessionState object.
|
|
2710
|
+
* Restores filter stack + values and crop metadata (shape, aspect, rect).
|
|
2711
|
+
* @param {Object} state - ImageEditorSessionState
|
|
2712
|
+
*/
|
|
2713
|
+
_hydrateState(e) {
|
|
2714
|
+
if (!(!e || e.version !== 1) && (e.crop && (e.crop.rect && this._state.set("crop.rect", { ...e.crop.rect }), e.crop.shape && this._state.set("crop.shape", e.crop.shape), e.crop.aspectRatio && this._state.set("crop.aspect", e.crop.aspectRatio)), Array.isArray(e.filters))) {
|
|
2715
|
+
for (const t of e.filters)
|
|
2716
|
+
if (t.enabled && (this._state.toggleFilter(t.id, !0), this._filterManager.initializeValues(t.id), t.values))
|
|
2717
|
+
for (const [i, r] of Object.entries(t.values))
|
|
2718
|
+
this._state.setFilterValue(t.id, i, r);
|
|
2719
|
+
this._filterManager.applyFilters();
|
|
2720
|
+
}
|
|
2645
2721
|
}
|
|
2646
2722
|
/**
|
|
2647
2723
|
* Open the file picker dialog
|
|
@@ -2663,24 +2739,50 @@ class Gt extends B {
|
|
|
2663
2739
|
* Save the image (triggers download and emits 'save' event)
|
|
2664
2740
|
*/
|
|
2665
2741
|
save() {
|
|
2666
|
-
var e, t;
|
|
2667
2742
|
if (this._state.get("hasImage")) {
|
|
2668
2743
|
this._state.set("isSaving", !0);
|
|
2669
2744
|
try {
|
|
2670
|
-
const
|
|
2671
|
-
if (!
|
|
2672
|
-
const
|
|
2673
|
-
width: Math.round((
|
|
2674
|
-
height: Math.round((
|
|
2675
|
-
},
|
|
2676
|
-
|
|
2677
|
-
} catch (
|
|
2678
|
-
this.emit("error", { error:
|
|
2745
|
+
const e = this.exportImage("png", 0.92);
|
|
2746
|
+
if (!e) throw new Error("Failed to export image");
|
|
2747
|
+
const t = this._renderer.originalTexture, i = {
|
|
2748
|
+
width: Math.round((t == null ? void 0 : t.width) || 0),
|
|
2749
|
+
height: Math.round((t == null ? void 0 : t.height) || 0)
|
|
2750
|
+
}, r = document.createElement("a");
|
|
2751
|
+
r.href = e, r.download = `edited-image-${Date.now()}.png`, document.body.appendChild(r), r.click(), document.body.removeChild(r), this.emit("save", { imageData: e, dimensions: i, state: this.getSerializableState() });
|
|
2752
|
+
} catch (e) {
|
|
2753
|
+
this.emit("error", { error: e });
|
|
2679
2754
|
} finally {
|
|
2680
2755
|
this._state.set("isSaving", !1);
|
|
2681
2756
|
}
|
|
2682
2757
|
}
|
|
2683
2758
|
}
|
|
2759
|
+
/**
|
|
2760
|
+
* Get a canonical, serializable snapshot of the current editor state.
|
|
2761
|
+
* Safe for persistence — returns a deep copy with no mutable references.
|
|
2762
|
+
* @returns {Object} ImageEditorSessionState
|
|
2763
|
+
*/
|
|
2764
|
+
getSerializableState() {
|
|
2765
|
+
const e = this._state.get("activeFilters"), t = [];
|
|
2766
|
+
if (e)
|
|
2767
|
+
for (const o of e) {
|
|
2768
|
+
const n = this._state.getFilterValues(o);
|
|
2769
|
+
t.push({
|
|
2770
|
+
id: o,
|
|
2771
|
+
enabled: !0,
|
|
2772
|
+
values: { ...n }
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
const i = this._state.get("crop.appliedRect"), r = this._state.get("crop.rect"), a = i || r;
|
|
2776
|
+
return {
|
|
2777
|
+
version: 1,
|
|
2778
|
+
crop: {
|
|
2779
|
+
rect: a ? { ...a } : null,
|
|
2780
|
+
aspectRatio: this._state.get("crop.appliedAspect") || this._state.get("crop.aspect") || "free",
|
|
2781
|
+
shape: this._state.get("crop.appliedShape") || this._state.get("crop.shape") || "free"
|
|
2782
|
+
},
|
|
2783
|
+
filters: t
|
|
2784
|
+
};
|
|
2785
|
+
}
|
|
2684
2786
|
/**
|
|
2685
2787
|
* Close the editor (emits 'cancel' event)
|
|
2686
2788
|
*/
|
|
@@ -2805,24 +2907,30 @@ class Gt extends B {
|
|
|
2805
2907
|
*/
|
|
2806
2908
|
destroy() {
|
|
2807
2909
|
var e, t, i, r, a, o, n, l, c, u;
|
|
2808
|
-
|
|
2910
|
+
this._destroyed = !0;
|
|
2911
|
+
for (const h of this._objectUrls)
|
|
2912
|
+
try {
|
|
2913
|
+
URL.revokeObjectURL(h);
|
|
2914
|
+
} catch {
|
|
2915
|
+
}
|
|
2916
|
+
this._objectUrls.clear(), (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();
|
|
2809
2917
|
}
|
|
2810
2918
|
}
|
|
2811
2919
|
const S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
2812
|
-
function
|
|
2920
|
+
function tt(s, e) {
|
|
2813
2921
|
return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
|
|
2814
2922
|
}
|
|
2815
2923
|
function f(s) {
|
|
2816
2924
|
var e;
|
|
2817
2925
|
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
2926
|
}
|
|
2819
|
-
function
|
|
2927
|
+
function it(s) {
|
|
2820
2928
|
return S.get(s);
|
|
2821
2929
|
}
|
|
2822
2930
|
function U() {
|
|
2823
2931
|
return Array.from(S.values());
|
|
2824
2932
|
}
|
|
2825
|
-
function
|
|
2933
|
+
function rt() {
|
|
2826
2934
|
U().map((t) => t.id), Object.entries(g).filter(
|
|
2827
2935
|
(t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
|
|
2828
2936
|
).forEach(([t, i]) => {
|
|
@@ -2846,16 +2954,16 @@ function Je() {
|
|
|
2846
2954
|
});
|
|
2847
2955
|
});
|
|
2848
2956
|
}
|
|
2849
|
-
function
|
|
2957
|
+
function st(s) {
|
|
2850
2958
|
return (I.get(s) || []).map((t) => S.get(t)).filter(Boolean);
|
|
2851
2959
|
}
|
|
2852
|
-
function
|
|
2960
|
+
function at() {
|
|
2853
2961
|
return Array.from(I.keys());
|
|
2854
2962
|
}
|
|
2855
|
-
function
|
|
2963
|
+
function ti(s) {
|
|
2856
2964
|
return S.has(s);
|
|
2857
2965
|
}
|
|
2858
|
-
function
|
|
2966
|
+
function ot(s) {
|
|
2859
2967
|
const e = S.get(s);
|
|
2860
2968
|
if (!e)
|
|
2861
2969
|
return !1;
|
|
@@ -2867,11 +2975,11 @@ function it(s) {
|
|
|
2867
2975
|
}
|
|
2868
2976
|
return !0;
|
|
2869
2977
|
}
|
|
2870
|
-
function
|
|
2978
|
+
function ii(s, e) {
|
|
2871
2979
|
const t = S.get(s);
|
|
2872
|
-
return t ?
|
|
2980
|
+
return t ? tt(t, e) : !1;
|
|
2873
2981
|
}
|
|
2874
|
-
function
|
|
2982
|
+
function nt() {
|
|
2875
2983
|
return Array.from(S.values()).map((s) => ({
|
|
2876
2984
|
id: s.id,
|
|
2877
2985
|
name: s.name,
|
|
@@ -2880,7 +2988,7 @@ function rt() {
|
|
|
2880
2988
|
}));
|
|
2881
2989
|
}
|
|
2882
2990
|
if (typeof window < "u") {
|
|
2883
|
-
window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter =
|
|
2991
|
+
window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter = it, window.getFiltersByCategory = st, window.getRegisteredFilters = nt;
|
|
2884
2992
|
const s = f;
|
|
2885
2993
|
window.registerFilter = (e) => {
|
|
2886
2994
|
const t = s(e);
|
|
@@ -2890,7 +2998,7 @@ if (typeof window < "u") {
|
|
|
2890
2998
|
typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
|
|
2891
2999
|
return [];
|
|
2892
3000
|
});
|
|
2893
|
-
const { AdjustmentFilter:
|
|
3001
|
+
const { AdjustmentFilter: lt } = g, { ColorMatrixFilter: ct } = w, k = {
|
|
2894
3002
|
gamma: 1,
|
|
2895
3003
|
saturation: 1,
|
|
2896
3004
|
contrast: 1,
|
|
@@ -2899,7 +3007,7 @@ const { AdjustmentFilter: st } = g, { ColorMatrixFilter: at } = w, k = {
|
|
|
2899
3007
|
green: 1,
|
|
2900
3008
|
blue: 1,
|
|
2901
3009
|
alpha: 1
|
|
2902
|
-
},
|
|
3010
|
+
}, ht = /* @__PURE__ */ new Set([
|
|
2903
3011
|
"gamma",
|
|
2904
3012
|
"saturation",
|
|
2905
3013
|
"contrast",
|
|
@@ -2919,10 +3027,10 @@ function P(s, e) {
|
|
|
2919
3027
|
}
|
|
2920
3028
|
return e;
|
|
2921
3029
|
}
|
|
2922
|
-
function
|
|
2923
|
-
return
|
|
3030
|
+
function ee(s) {
|
|
3031
|
+
return ht.has(s);
|
|
2924
3032
|
}
|
|
2925
|
-
function
|
|
3033
|
+
function dt(s) {
|
|
2926
3034
|
return {
|
|
2927
3035
|
gamma: P(s.gamma, k.gamma),
|
|
2928
3036
|
saturation: P(s.saturation, k.saturation),
|
|
@@ -2934,7 +3042,7 @@ function nt(s) {
|
|
|
2934
3042
|
alpha: P(s.alpha, k.alpha)
|
|
2935
3043
|
};
|
|
2936
3044
|
}
|
|
2937
|
-
function
|
|
3045
|
+
function te(s, e) {
|
|
2938
3046
|
s.reset(), s.brightness(e.brightness, !0), s.contrast(e.contrast, !0), s.saturate(e.saturation, !0);
|
|
2939
3047
|
}
|
|
2940
3048
|
f({
|
|
@@ -2945,12 +3053,12 @@ f({
|
|
|
2945
3053
|
// Create an instance of the AdjustmentFilter with the provided parameters
|
|
2946
3054
|
createFilter: (s) => {
|
|
2947
3055
|
try {
|
|
2948
|
-
const e =
|
|
3056
|
+
const e = dt(s ?? {}), t = { ...e };
|
|
2949
3057
|
try {
|
|
2950
|
-
const i = new
|
|
3058
|
+
const i = new lt(t), r = i;
|
|
2951
3059
|
return r._customParams = { ...e }, r.updateUIParam = function(o, n) {
|
|
2952
3060
|
try {
|
|
2953
|
-
if (!
|
|
3061
|
+
if (!ee(o))
|
|
2954
3062
|
return;
|
|
2955
3063
|
const l = this._customParams ?? { ...k }, c = P(n, l[o]);
|
|
2956
3064
|
l[o] = c, this._customParams = l;
|
|
@@ -2960,13 +3068,13 @@ f({
|
|
|
2960
3068
|
}
|
|
2961
3069
|
}, i;
|
|
2962
3070
|
} catch {
|
|
2963
|
-
const r = new
|
|
2964
|
-
return a._customParams = { ...e },
|
|
3071
|
+
const r = new ct(), a = r;
|
|
3072
|
+
return a._customParams = { ...e }, te(r, e), a.updateUIParam = function(n, l) {
|
|
2965
3073
|
try {
|
|
2966
|
-
if (!
|
|
3074
|
+
if (!ee(n))
|
|
2967
3075
|
return;
|
|
2968
3076
|
const c = this._customParams ?? { ...k }, u = P(l, c[n]);
|
|
2969
|
-
c[n] = u, this._customParams = c,
|
|
3077
|
+
c[n] = u, this._customParams = c, te(this, c);
|
|
2970
3078
|
} catch {
|
|
2971
3079
|
}
|
|
2972
3080
|
}, r;
|
|
@@ -3070,14 +3178,14 @@ f({
|
|
|
3070
3178
|
}
|
|
3071
3179
|
]
|
|
3072
3180
|
});
|
|
3073
|
-
const { ColorMatrixFilter:
|
|
3181
|
+
const { ColorMatrixFilter: ut } = w, N = {
|
|
3074
3182
|
brightness: 1,
|
|
3075
3183
|
contrast: 1,
|
|
3076
3184
|
saturation: 1,
|
|
3077
3185
|
hue: 0,
|
|
3078
3186
|
sepia: 0,
|
|
3079
3187
|
negative: !1
|
|
3080
|
-
},
|
|
3188
|
+
}, pt = /* @__PURE__ */ new Set([
|
|
3081
3189
|
"brightness",
|
|
3082
3190
|
"contrast",
|
|
3083
3191
|
"saturation",
|
|
@@ -3085,8 +3193,8 @@ const { ColorMatrixFilter: lt } = w, R = {
|
|
|
3085
3193
|
"sepia",
|
|
3086
3194
|
"negative"
|
|
3087
3195
|
]);
|
|
3088
|
-
function
|
|
3089
|
-
return
|
|
3196
|
+
function ft(s) {
|
|
3197
|
+
return pt.has(s);
|
|
3090
3198
|
}
|
|
3091
3199
|
function X(s, e) {
|
|
3092
3200
|
if (typeof s == "number" && Number.isFinite(s))
|
|
@@ -3098,7 +3206,7 @@ function X(s, e) {
|
|
|
3098
3206
|
}
|
|
3099
3207
|
return e;
|
|
3100
3208
|
}
|
|
3101
|
-
function
|
|
3209
|
+
function fe(s, e) {
|
|
3102
3210
|
if (typeof s == "boolean")
|
|
3103
3211
|
return s;
|
|
3104
3212
|
if (typeof s == "string") {
|
|
@@ -3109,17 +3217,17 @@ function pe(s, e) {
|
|
|
3109
3217
|
}
|
|
3110
3218
|
return e;
|
|
3111
3219
|
}
|
|
3112
|
-
function
|
|
3220
|
+
function mt(s) {
|
|
3113
3221
|
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:
|
|
3222
|
+
brightness: X(s.brightness, N.brightness),
|
|
3223
|
+
contrast: X(s.contrast, N.contrast),
|
|
3224
|
+
saturation: X(s.saturation, N.saturation),
|
|
3225
|
+
hue: X(s.hue, N.hue),
|
|
3226
|
+
sepia: X(s.sepia, N.sepia),
|
|
3227
|
+
negative: fe(s.negative, N.negative)
|
|
3120
3228
|
};
|
|
3121
3229
|
}
|
|
3122
|
-
function
|
|
3230
|
+
function ie(s, e) {
|
|
3123
3231
|
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
3232
|
}
|
|
3125
3233
|
f({
|
|
@@ -3130,19 +3238,19 @@ f({
|
|
|
3130
3238
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
3131
3239
|
createFilter: (s) => {
|
|
3132
3240
|
try {
|
|
3133
|
-
const e =
|
|
3134
|
-
return i._customParams = { ...e },
|
|
3241
|
+
const e = mt(s ?? {}), t = new ut(), i = t;
|
|
3242
|
+
return i._customParams = { ...e }, ie(t, e), i.updateUIParam = function(a, o) {
|
|
3135
3243
|
try {
|
|
3136
|
-
if (!
|
|
3244
|
+
if (!ft(a))
|
|
3137
3245
|
return;
|
|
3138
|
-
const n = this._customParams ?? { ...
|
|
3246
|
+
const n = this._customParams ?? { ...N };
|
|
3139
3247
|
if (a === "negative")
|
|
3140
|
-
n.negative =
|
|
3248
|
+
n.negative = fe(o, n.negative);
|
|
3141
3249
|
else {
|
|
3142
3250
|
const l = a;
|
|
3143
3251
|
n[l] = X(o, n[l]);
|
|
3144
3252
|
}
|
|
3145
|
-
this._customParams = n,
|
|
3253
|
+
this._customParams = n, ie(this, n);
|
|
3146
3254
|
} catch {
|
|
3147
3255
|
}
|
|
3148
3256
|
}, t;
|
|
@@ -3414,7 +3522,7 @@ f({
|
|
|
3414
3522
|
}
|
|
3415
3523
|
]
|
|
3416
3524
|
});
|
|
3417
|
-
const { ColorOverlayFilter:
|
|
3525
|
+
const { ColorOverlayFilter: gt } = g;
|
|
3418
3526
|
f({
|
|
3419
3527
|
id: "colorOverlay",
|
|
3420
3528
|
name: "Color Overlay",
|
|
@@ -3429,7 +3537,7 @@ f({
|
|
|
3429
3537
|
try {
|
|
3430
3538
|
let e = 16711680;
|
|
3431
3539
|
s.color && (typeof s.color == "string" ? e = parseInt(s.color.replace("#", "0x"), 16) : typeof s.color == "number" && (e = s.color));
|
|
3432
|
-
const t = new
|
|
3540
|
+
const t = new gt({
|
|
3433
3541
|
color: e,
|
|
3434
3542
|
alpha: s.alpha || 0.5
|
|
3435
3543
|
});
|
|
@@ -3661,7 +3769,7 @@ f({
|
|
|
3661
3769
|
}
|
|
3662
3770
|
]
|
|
3663
3771
|
});
|
|
3664
|
-
const { ColorMatrixFilter:
|
|
3772
|
+
const { ColorMatrixFilter: bt } = w;
|
|
3665
3773
|
f({
|
|
3666
3774
|
id: "grayscale",
|
|
3667
3775
|
name: "Grayscale",
|
|
@@ -3674,14 +3782,14 @@ f({
|
|
|
3674
3782
|
*/
|
|
3675
3783
|
createFilter: (s) => {
|
|
3676
3784
|
try {
|
|
3677
|
-
const e = new
|
|
3785
|
+
const e = new bt();
|
|
3678
3786
|
e._customParams = { ...s };
|
|
3679
3787
|
const t = s.intensity !== void 0 ? s.intensity : 1;
|
|
3680
|
-
return
|
|
3788
|
+
return re(e, t), e.updateUIParam = function(i, r) {
|
|
3681
3789
|
const a = this._customParams || {};
|
|
3682
3790
|
switch (this._customParams = a, a[i] = r, i) {
|
|
3683
3791
|
case "intensity":
|
|
3684
|
-
|
|
3792
|
+
re(this, r);
|
|
3685
3793
|
break;
|
|
3686
3794
|
default:
|
|
3687
3795
|
i in this && (this[i] = r);
|
|
@@ -3711,10 +3819,10 @@ f({
|
|
|
3711
3819
|
}
|
|
3712
3820
|
]
|
|
3713
3821
|
});
|
|
3714
|
-
function
|
|
3822
|
+
function re(s, e) {
|
|
3715
3823
|
s.reset(), s.greyscale(e);
|
|
3716
3824
|
}
|
|
3717
|
-
const { HslAdjustmentFilter:
|
|
3825
|
+
const { HslAdjustmentFilter: yt } = g;
|
|
3718
3826
|
f({
|
|
3719
3827
|
id: "hsl-adjustment",
|
|
3720
3828
|
name: "HSL Adjustment",
|
|
@@ -3726,7 +3834,7 @@ f({
|
|
|
3726
3834
|
*/
|
|
3727
3835
|
createFilter: (s) => {
|
|
3728
3836
|
try {
|
|
3729
|
-
const e = new
|
|
3837
|
+
const e = new yt({
|
|
3730
3838
|
hue: s.hue !== void 0 ? s.hue : 0,
|
|
3731
3839
|
saturation: s.saturation !== void 0 ? s.saturation : 0,
|
|
3732
3840
|
lightness: s.lightness !== void 0 ? s.lightness : 0,
|
|
@@ -3824,7 +3932,7 @@ f({
|
|
|
3824
3932
|
}
|
|
3825
3933
|
]
|
|
3826
3934
|
});
|
|
3827
|
-
const { KawaseBlurFilter:
|
|
3935
|
+
const { KawaseBlurFilter: _t } = g;
|
|
3828
3936
|
f({
|
|
3829
3937
|
id: "kawase-blur",
|
|
3830
3938
|
name: "Kawase Blur",
|
|
@@ -3837,7 +3945,7 @@ f({
|
|
|
3837
3945
|
*/
|
|
3838
3946
|
createFilter: (s) => {
|
|
3839
3947
|
try {
|
|
3840
|
-
const e = new
|
|
3948
|
+
const e = new _t({
|
|
3841
3949
|
strength: s.strength || 4,
|
|
3842
3950
|
quality: s.quality || 3,
|
|
3843
3951
|
clamp: s.clamp || !1,
|
|
@@ -3942,7 +4050,7 @@ f({
|
|
|
3942
4050
|
}
|
|
3943
4051
|
]
|
|
3944
4052
|
});
|
|
3945
|
-
const { MotionBlurFilter:
|
|
4053
|
+
const { MotionBlurFilter: xt } = g;
|
|
3946
4054
|
f({
|
|
3947
4055
|
id: "motion-blur",
|
|
3948
4056
|
name: "Motion Blur",
|
|
@@ -3955,7 +4063,7 @@ f({
|
|
|
3955
4063
|
*/
|
|
3956
4064
|
createFilter: (s) => {
|
|
3957
4065
|
try {
|
|
3958
|
-
const e = new
|
|
4066
|
+
const e = new xt({
|
|
3959
4067
|
velocity: {
|
|
3960
4068
|
x: s.velocityX !== void 0 ? s.velocityX : 0,
|
|
3961
4069
|
y: s.velocityY !== void 0 ? s.velocityY : 0
|
|
@@ -4050,7 +4158,7 @@ f({
|
|
|
4050
4158
|
}
|
|
4051
4159
|
]
|
|
4052
4160
|
});
|
|
4053
|
-
const { RadialBlurFilter:
|
|
4161
|
+
const { RadialBlurFilter: Ct } = g;
|
|
4054
4162
|
f({
|
|
4055
4163
|
id: "radial-blur",
|
|
4056
4164
|
name: "Radial Blur",
|
|
@@ -4059,7 +4167,7 @@ f({
|
|
|
4059
4167
|
// Create an instance of the RadialBlurFilter with the provided parameters
|
|
4060
4168
|
createFilter: (s) => {
|
|
4061
4169
|
try {
|
|
4062
|
-
const e = new
|
|
4170
|
+
const e = new Ct({
|
|
4063
4171
|
angle: s.angle ?? 20,
|
|
4064
4172
|
center: { x: s.centerX ?? 0, y: s.centerY ?? 0 },
|
|
4065
4173
|
kernelSize: s.kernelSize ?? 15,
|
|
@@ -4174,7 +4282,7 @@ f({
|
|
|
4174
4282
|
}
|
|
4175
4283
|
]
|
|
4176
4284
|
});
|
|
4177
|
-
const { TiltShiftFilter:
|
|
4285
|
+
const { TiltShiftFilter: wt } = g;
|
|
4178
4286
|
f({
|
|
4179
4287
|
id: "tilt-shift",
|
|
4180
4288
|
name: "Tilt Shift",
|
|
@@ -4183,7 +4291,7 @@ f({
|
|
|
4183
4291
|
// Create an instance of the TiltShiftFilter with the provided parameters
|
|
4184
4292
|
createFilter: (s) => {
|
|
4185
4293
|
try {
|
|
4186
|
-
const e = typeof s.blur == "number" ? s.blur : 100, t = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, i = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, o = typeof s.endY == "number" ? s.endY : 0.5, n = new
|
|
4294
|
+
const e = typeof s.blur == "number" ? s.blur : 100, t = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, i = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, o = typeof s.endY == "number" ? s.endY : 0.5, n = new wt({
|
|
4187
4295
|
blur: Number(e),
|
|
4188
4296
|
gradientBlur: Number(t),
|
|
4189
4297
|
start: { x: Number(i), y: Number(r) },
|
|
@@ -4302,7 +4410,7 @@ f({
|
|
|
4302
4410
|
}
|
|
4303
4411
|
]
|
|
4304
4412
|
});
|
|
4305
|
-
const { ZoomBlurFilter:
|
|
4413
|
+
const { ZoomBlurFilter: St } = g;
|
|
4306
4414
|
f({
|
|
4307
4415
|
id: "zoom-blur",
|
|
4308
4416
|
name: "Zoom Blur",
|
|
@@ -4315,7 +4423,7 @@ f({
|
|
|
4315
4423
|
*/
|
|
4316
4424
|
createFilter: (s) => {
|
|
4317
4425
|
try {
|
|
4318
|
-
const e = new
|
|
4426
|
+
const e = new St({
|
|
4319
4427
|
strength: s.strength || 0.1,
|
|
4320
4428
|
center: {
|
|
4321
4429
|
x: s.centerX !== void 0 ? s.centerX : 0.5,
|
|
@@ -4429,7 +4537,7 @@ f({
|
|
|
4429
4537
|
}
|
|
4430
4538
|
]
|
|
4431
4539
|
});
|
|
4432
|
-
const { ColorGradientFilter:
|
|
4540
|
+
const { ColorGradientFilter: se } = g;
|
|
4433
4541
|
f({
|
|
4434
4542
|
id: "color-gradient",
|
|
4435
4543
|
name: "Color Gradient",
|
|
@@ -4453,7 +4561,7 @@ f({
|
|
|
4453
4561
|
{ offset: 0, color: 16711680, alpha: 1 },
|
|
4454
4562
|
{ offset: 1, color: 255, alpha: 1 }
|
|
4455
4563
|
]), e.sort((i, r) => i.offset - r.offset);
|
|
4456
|
-
const t = new
|
|
4564
|
+
const t = new se({
|
|
4457
4565
|
type: s.gradientType,
|
|
4458
4566
|
// 0: linear, 1: radial, 2: conic
|
|
4459
4567
|
stops: e,
|
|
@@ -4543,7 +4651,7 @@ f({
|
|
|
4543
4651
|
case "cssGradient":
|
|
4544
4652
|
if (r && typeof r == "string" && r.trim() !== "")
|
|
4545
4653
|
try {
|
|
4546
|
-
const h = new
|
|
4654
|
+
const h = new se({ css: r });
|
|
4547
4655
|
this.type = h.type, this.angle = h.angle, this.stops = [...h.stops], a.colorStops = this.stops.map((p) => ({
|
|
4548
4656
|
offset: p.offset,
|
|
4549
4657
|
color: typeof p.color == "number" ? "#" + p.color.toString(16).padStart(6, "0") : p.color,
|
|
@@ -4568,7 +4676,7 @@ f({
|
|
|
4568
4676
|
if (h) {
|
|
4569
4677
|
const [p, m, C] = h, b = parseInt(m), y = [...this.stops];
|
|
4570
4678
|
if (b >= 0 && b < y.length)
|
|
4571
|
-
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((
|
|
4679
|
+
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((A, _) => A.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
|
|
4572
4680
|
}
|
|
4573
4681
|
} else i in this && (this[i] = r);
|
|
4574
4682
|
break;
|
|
@@ -4756,7 +4864,7 @@ f({
|
|
|
4756
4864
|
}
|
|
4757
4865
|
]
|
|
4758
4866
|
});
|
|
4759
|
-
const
|
|
4867
|
+
const vt = g.ColorReplaceFilter;
|
|
4760
4868
|
f({
|
|
4761
4869
|
id: "color-replace",
|
|
4762
4870
|
name: "Color Replace",
|
|
@@ -4773,7 +4881,7 @@ f({
|
|
|
4773
4881
|
s.originalColor && (typeof s.originalColor == "string" ? e = parseInt(s.originalColor.replace("#", "0x"), 16) : typeof s.originalColor == "number" && (e = s.originalColor));
|
|
4774
4882
|
let t = 255;
|
|
4775
4883
|
s.targetColor && (typeof s.targetColor == "string" ? t = parseInt(s.targetColor.replace("#", "0x"), 16) : typeof s.targetColor == "number" && (t = s.targetColor));
|
|
4776
|
-
const i = new
|
|
4884
|
+
const i = new vt({
|
|
4777
4885
|
originalColor: e,
|
|
4778
4886
|
targetColor: t,
|
|
4779
4887
|
tolerance: s.tolerance || 0.4
|
|
@@ -4837,7 +4945,7 @@ f({
|
|
|
4837
4945
|
}
|
|
4838
4946
|
]
|
|
4839
4947
|
});
|
|
4840
|
-
const
|
|
4948
|
+
const kt = g.MultiColorReplaceFilter;
|
|
4841
4949
|
f({
|
|
4842
4950
|
id: "multi-color-replace",
|
|
4843
4951
|
name: "Multi-Color Replace",
|
|
@@ -4863,7 +4971,7 @@ f({
|
|
|
4863
4971
|
const i = typeof s.originalColor3 == "string" ? parseInt(s.originalColor3.replace("#", "0x"), 16) : s.originalColor3, r = typeof s.targetColor3 == "string" ? parseInt(s.targetColor3.replace("#", "0x"), 16) : s.targetColor3;
|
|
4864
4972
|
e.push([i, r]);
|
|
4865
4973
|
}
|
|
4866
|
-
const t = new
|
|
4974
|
+
const t = new kt(
|
|
4867
4975
|
e,
|
|
4868
4976
|
s.tolerance || 0.05,
|
|
4869
4977
|
3
|
|
@@ -4974,7 +5082,7 @@ f({
|
|
|
4974
5082
|
}
|
|
4975
5083
|
]
|
|
4976
5084
|
});
|
|
4977
|
-
const { RGBSplitFilter:
|
|
5085
|
+
const { RGBSplitFilter: Pt } = g;
|
|
4978
5086
|
f({
|
|
4979
5087
|
id: "rgb-split",
|
|
4980
5088
|
name: "RGB Split",
|
|
@@ -4995,7 +5103,7 @@ f({
|
|
|
4995
5103
|
}, i = {
|
|
4996
5104
|
x: s.blueX !== void 0 ? s.blueX : 0,
|
|
4997
5105
|
y: s.blueY !== void 0 ? s.blueY : 0
|
|
4998
|
-
}, r = new
|
|
5106
|
+
}, r = new Pt({
|
|
4999
5107
|
red: e,
|
|
5000
5108
|
green: t,
|
|
5001
5109
|
blue: i
|
|
@@ -5108,7 +5216,7 @@ f({
|
|
|
5108
5216
|
}
|
|
5109
5217
|
]
|
|
5110
5218
|
});
|
|
5111
|
-
const { AdvancedBloomFilter:
|
|
5219
|
+
const { AdvancedBloomFilter: Mt } = g;
|
|
5112
5220
|
f({
|
|
5113
5221
|
id: "advanced-bloom",
|
|
5114
5222
|
name: "Advanced Bloom",
|
|
@@ -5117,7 +5225,7 @@ f({
|
|
|
5117
5225
|
// Create an instance of the AdvancedBloomFilter with the provided parameters
|
|
5118
5226
|
createFilter: (s) => {
|
|
5119
5227
|
try {
|
|
5120
|
-
const e = new
|
|
5228
|
+
const e = new Mt({
|
|
5121
5229
|
threshold: s.threshold || 0.5,
|
|
5122
5230
|
bloomScale: s.bloomScale || 1,
|
|
5123
5231
|
brightness: s.brightness || 1,
|
|
@@ -5264,7 +5372,7 @@ f({
|
|
|
5264
5372
|
}
|
|
5265
5373
|
]
|
|
5266
5374
|
});
|
|
5267
|
-
const
|
|
5375
|
+
const Ft = g.AsciiFilter;
|
|
5268
5376
|
f({
|
|
5269
5377
|
id: "ascii",
|
|
5270
5378
|
name: "ASCII",
|
|
@@ -5276,7 +5384,7 @@ f({
|
|
|
5276
5384
|
const e = typeof s.size == "number" ? s.size : 8;
|
|
5277
5385
|
let t = s.color;
|
|
5278
5386
|
typeof t == "string" && t.startsWith("#") && (t = parseInt(t.replace("#", "0x"), 16));
|
|
5279
|
-
const i = s.replaceColor === !0, r = new
|
|
5387
|
+
const i = s.replaceColor === !0, r = new Ft({
|
|
5280
5388
|
size: e,
|
|
5281
5389
|
color: t,
|
|
5282
5390
|
replaceColor: i
|
|
@@ -5343,7 +5451,7 @@ f({
|
|
|
5343
5451
|
}
|
|
5344
5452
|
]
|
|
5345
5453
|
});
|
|
5346
|
-
const
|
|
5454
|
+
const At = g.BackdropBlurFilter;
|
|
5347
5455
|
f({
|
|
5348
5456
|
id: "backdrop-blur",
|
|
5349
5457
|
name: "Backdrop Blur",
|
|
@@ -5352,7 +5460,7 @@ f({
|
|
|
5352
5460
|
// Create an instance of the BackdropBlurFilter with the provided parameters
|
|
5353
5461
|
createFilter: (s) => {
|
|
5354
5462
|
try {
|
|
5355
|
-
const e = new
|
|
5463
|
+
const e = new At({
|
|
5356
5464
|
// Higher strength values (20-50) make the effect more noticeable
|
|
5357
5465
|
strength: s.strength || 20,
|
|
5358
5466
|
quality: s.quality || 4,
|
|
@@ -5450,7 +5558,7 @@ f({
|
|
|
5450
5558
|
}
|
|
5451
5559
|
]
|
|
5452
5560
|
});
|
|
5453
|
-
const { BevelFilter:
|
|
5561
|
+
const { BevelFilter: zt } = g;
|
|
5454
5562
|
f({
|
|
5455
5563
|
id: "bevel",
|
|
5456
5564
|
name: "Bevel",
|
|
@@ -5462,7 +5570,7 @@ f({
|
|
|
5462
5570
|
*/
|
|
5463
5571
|
createFilter: (s) => {
|
|
5464
5572
|
try {
|
|
5465
|
-
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new
|
|
5573
|
+
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new zt({
|
|
5466
5574
|
rotation: s.rotation !== void 0 ? s.rotation : 45,
|
|
5467
5575
|
thickness: s.thickness !== void 0 ? s.thickness : 2,
|
|
5468
5576
|
lightColor: parseInt(e, 16),
|
|
@@ -5578,7 +5686,7 @@ f({
|
|
|
5578
5686
|
}
|
|
5579
5687
|
]
|
|
5580
5688
|
});
|
|
5581
|
-
const { BloomFilter:
|
|
5689
|
+
const { BloomFilter: Rt } = g;
|
|
5582
5690
|
f({
|
|
5583
5691
|
id: "bloom",
|
|
5584
5692
|
name: "Bloom/Glow",
|
|
@@ -5587,7 +5695,7 @@ f({
|
|
|
5587
5695
|
// Create an instance of the BloomFilter with the provided parameters
|
|
5588
5696
|
createFilter: (s) => {
|
|
5589
5697
|
try {
|
|
5590
|
-
const e = typeof s.strengthX == "number" ? s.strengthX : 2, t = typeof s.strengthY == "number" ? s.strengthY : 2, i = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, o = new
|
|
5698
|
+
const e = typeof s.strengthX == "number" ? s.strengthX : 2, t = typeof s.strengthY == "number" ? s.strengthY : 2, i = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, o = new Rt({
|
|
5591
5699
|
strength: {
|
|
5592
5700
|
x: Number(e),
|
|
5593
5701
|
y: Number(t)
|
|
@@ -5690,7 +5798,7 @@ f({
|
|
|
5690
5798
|
}
|
|
5691
5799
|
]
|
|
5692
5800
|
});
|
|
5693
|
-
const { BulgePinchFilter:
|
|
5801
|
+
const { BulgePinchFilter: Nt } = g;
|
|
5694
5802
|
f({
|
|
5695
5803
|
id: "bulge-pinch",
|
|
5696
5804
|
// ID must match what the application expects
|
|
@@ -5700,7 +5808,7 @@ f({
|
|
|
5700
5808
|
// Create an instance of the BulgePinchFilter with the provided parameters
|
|
5701
5809
|
createFilter: (s) => {
|
|
5702
5810
|
try {
|
|
5703
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new
|
|
5811
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new Nt({
|
|
5704
5812
|
center: {
|
|
5705
5813
|
x: e,
|
|
5706
5814
|
y: t
|
|
@@ -5782,7 +5890,7 @@ f({
|
|
|
5782
5890
|
}
|
|
5783
5891
|
]
|
|
5784
5892
|
});
|
|
5785
|
-
const { ConvolutionFilter:
|
|
5893
|
+
const { ConvolutionFilter: Tt } = g, E = {
|
|
5786
5894
|
normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
|
|
5787
5895
|
gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
|
|
5788
5896
|
boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
|
|
@@ -5817,7 +5925,7 @@ f({
|
|
|
5817
5925
|
const i = s.preset;
|
|
5818
5926
|
e = E[i] || E.normal;
|
|
5819
5927
|
}
|
|
5820
|
-
const t = new
|
|
5928
|
+
const t = new Tt(e, s.width || 200, s.height || 200);
|
|
5821
5929
|
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
5822
5930
|
const a = this._customParams || {};
|
|
5823
5931
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -6028,7 +6136,7 @@ f({
|
|
|
6028
6136
|
}
|
|
6029
6137
|
]
|
|
6030
6138
|
});
|
|
6031
|
-
const { CrossHatchFilter:
|
|
6139
|
+
const { CrossHatchFilter: It } = g;
|
|
6032
6140
|
f({
|
|
6033
6141
|
id: "cross-hatch",
|
|
6034
6142
|
name: "Cross Hatch",
|
|
@@ -6038,7 +6146,7 @@ f({
|
|
|
6038
6146
|
// Note: CrossHatchFilter has NO parameters according to PixiJS examples
|
|
6039
6147
|
createFilter: (s) => {
|
|
6040
6148
|
try {
|
|
6041
|
-
const e = new
|
|
6149
|
+
const e = new It();
|
|
6042
6150
|
return e.updateUIParam = function(t, i) {
|
|
6043
6151
|
return !0;
|
|
6044
6152
|
}, e;
|
|
@@ -6235,7 +6343,7 @@ f({
|
|
|
6235
6343
|
}
|
|
6236
6344
|
]
|
|
6237
6345
|
});
|
|
6238
|
-
const
|
|
6346
|
+
const Et = w.DisplacementFilter, Xt = w.Sprite, $ = w.Texture;
|
|
6239
6347
|
f({
|
|
6240
6348
|
id: "displacement",
|
|
6241
6349
|
// ID must match what the application expects
|
|
@@ -6248,7 +6356,7 @@ f({
|
|
|
6248
6356
|
const e = s.mapTexture || "/assets/images/displacement_map.png";
|
|
6249
6357
|
let t;
|
|
6250
6358
|
try {
|
|
6251
|
-
t =
|
|
6359
|
+
t = $.from(e), t.source.addressMode = "repeat";
|
|
6252
6360
|
} catch {
|
|
6253
6361
|
const o = document.createElement("canvas");
|
|
6254
6362
|
o.width = 256, o.height = 256;
|
|
@@ -6259,9 +6367,9 @@ f({
|
|
|
6259
6367
|
for (let c = 0; c < 10; c++)
|
|
6260
6368
|
(l + c) % 2 === 0 && n.fillRect(l * 25, c * 25, 25, 25);
|
|
6261
6369
|
}
|
|
6262
|
-
t =
|
|
6370
|
+
t = $.from(o);
|
|
6263
6371
|
}
|
|
6264
|
-
const i = new
|
|
6372
|
+
const i = new Xt(t), r = new Et(i, s.scale || 50);
|
|
6265
6373
|
return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = i, r.updateUIParam = function(a, o) {
|
|
6266
6374
|
const n = this._customParams || {};
|
|
6267
6375
|
switch (this._customParams = n, n[a] = o, a) {
|
|
@@ -6275,7 +6383,7 @@ f({
|
|
|
6275
6383
|
try {
|
|
6276
6384
|
const l = this._displacementSprite;
|
|
6277
6385
|
if (l) {
|
|
6278
|
-
const c =
|
|
6386
|
+
const c = $.from(o);
|
|
6279
6387
|
c.source.addressMode = "repeat", l.texture = c;
|
|
6280
6388
|
}
|
|
6281
6389
|
} catch {
|
|
@@ -6408,7 +6516,7 @@ f({
|
|
|
6408
6516
|
}
|
|
6409
6517
|
]
|
|
6410
6518
|
});
|
|
6411
|
-
const { EmbossFilter:
|
|
6519
|
+
const { EmbossFilter: Yt } = g;
|
|
6412
6520
|
f({
|
|
6413
6521
|
id: "emboss",
|
|
6414
6522
|
name: "Emboss",
|
|
@@ -6417,7 +6525,7 @@ f({
|
|
|
6417
6525
|
// Create an instance of the Emboss filter with the provided parameters
|
|
6418
6526
|
createFilter: (s) => {
|
|
6419
6527
|
try {
|
|
6420
|
-
const e = typeof s.strength == "number" ? s.strength : 5, t = new
|
|
6528
|
+
const e = typeof s.strength == "number" ? s.strength : 5, t = new Yt(e);
|
|
6421
6529
|
return t._customParams = {
|
|
6422
6530
|
strength: e
|
|
6423
6531
|
}, t.updateUIParam = function(i, r) {
|
|
@@ -6457,7 +6565,7 @@ f({
|
|
|
6457
6565
|
}
|
|
6458
6566
|
]
|
|
6459
6567
|
});
|
|
6460
|
-
const { GlitchFilter:
|
|
6568
|
+
const { GlitchFilter: Bt } = g, R = {
|
|
6461
6569
|
TRANSPARENT: 0,
|
|
6462
6570
|
ORIGINAL: 1,
|
|
6463
6571
|
LOOP: 2,
|
|
@@ -6471,7 +6579,7 @@ f({
|
|
|
6471
6579
|
description: "Apply digital distortion and glitch effects",
|
|
6472
6580
|
createFilter: (s) => {
|
|
6473
6581
|
try {
|
|
6474
|
-
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new
|
|
6582
|
+
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new Bt({
|
|
6475
6583
|
slices: s.slices,
|
|
6476
6584
|
offset: s.offset,
|
|
6477
6585
|
direction: s.direction,
|
|
@@ -6549,7 +6657,7 @@ f({
|
|
|
6549
6657
|
slices: 10,
|
|
6550
6658
|
offset: 100,
|
|
6551
6659
|
direction: 0,
|
|
6552
|
-
fillMode:
|
|
6660
|
+
fillMode: R.LOOP,
|
|
6553
6661
|
// LOOP mode looks better for the demo
|
|
6554
6662
|
seed: 0.5,
|
|
6555
6663
|
average: !1,
|
|
@@ -6612,13 +6720,13 @@ f({
|
|
|
6612
6720
|
label: "Fill Mode",
|
|
6613
6721
|
property: "fillMode",
|
|
6614
6722
|
options: [
|
|
6615
|
-
{ value:
|
|
6616
|
-
{ value:
|
|
6617
|
-
{ value:
|
|
6618
|
-
{ value:
|
|
6619
|
-
{ value:
|
|
6723
|
+
{ value: R.TRANSPARENT, label: "Transparent" },
|
|
6724
|
+
{ value: R.ORIGINAL, label: "Original" },
|
|
6725
|
+
{ value: R.LOOP, label: "Loop" },
|
|
6726
|
+
{ value: R.CLAMP, label: "Clamp" },
|
|
6727
|
+
{ value: R.MIRROR, label: "Mirror" }
|
|
6620
6728
|
],
|
|
6621
|
-
default:
|
|
6729
|
+
default: R.LOOP
|
|
6622
6730
|
},
|
|
6623
6731
|
{
|
|
6624
6732
|
id: "seed",
|
|
@@ -6712,7 +6820,7 @@ f({
|
|
|
6712
6820
|
}
|
|
6713
6821
|
]
|
|
6714
6822
|
});
|
|
6715
|
-
const { GlowFilter:
|
|
6823
|
+
const { GlowFilter: Ot } = g;
|
|
6716
6824
|
f({
|
|
6717
6825
|
id: "glow",
|
|
6718
6826
|
name: "Glow",
|
|
@@ -6721,7 +6829,7 @@ f({
|
|
|
6721
6829
|
// Create an instance of the GlowFilter with the provided parameters
|
|
6722
6830
|
createFilter: (s) => {
|
|
6723
6831
|
try {
|
|
6724
|
-
const e = parseInt(s.color.replace("#", "0x"), 16), t = new
|
|
6832
|
+
const e = parseInt(s.color.replace("#", "0x"), 16), t = new Ot({
|
|
6725
6833
|
distance: s.distance || 10,
|
|
6726
6834
|
outerStrength: s.outerStrength || 4,
|
|
6727
6835
|
innerStrength: s.innerStrength || 0,
|
|
@@ -6847,7 +6955,7 @@ f({
|
|
|
6847
6955
|
}
|
|
6848
6956
|
]
|
|
6849
6957
|
});
|
|
6850
|
-
const { GodrayFilter:
|
|
6958
|
+
const { GodrayFilter: Lt } = g;
|
|
6851
6959
|
f({
|
|
6852
6960
|
id: "godray",
|
|
6853
6961
|
name: "Godray",
|
|
@@ -6856,7 +6964,7 @@ f({
|
|
|
6856
6964
|
// Create an instance of the GodrayFilter with the provided parameters
|
|
6857
6965
|
createFilter: (s) => {
|
|
6858
6966
|
try {
|
|
6859
|
-
const e = new
|
|
6967
|
+
const e = new Lt({
|
|
6860
6968
|
angle: s.angle || 30,
|
|
6861
6969
|
parallel: s.parallel ?? !0,
|
|
6862
6970
|
center: {
|
|
@@ -7009,7 +7117,7 @@ f({
|
|
|
7009
7117
|
}
|
|
7010
7118
|
]
|
|
7011
7119
|
});
|
|
7012
|
-
const
|
|
7120
|
+
const Dt = g.SimpleLightmapFilter, ae = w.Texture;
|
|
7013
7121
|
f({
|
|
7014
7122
|
id: "lightmap",
|
|
7015
7123
|
name: "Lightmap",
|
|
@@ -7034,14 +7142,14 @@ f({
|
|
|
7034
7142
|
const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7035
7143
|
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
7144
|
}
|
|
7037
|
-
const o =
|
|
7145
|
+
const o = ae.from(r);
|
|
7038
7146
|
let n;
|
|
7039
7147
|
try {
|
|
7040
7148
|
typeof t == "string" && t.startsWith("#") ? n = parseInt(t.replace("#", "0x"), 16) : n = 0;
|
|
7041
7149
|
} catch {
|
|
7042
7150
|
n = 0;
|
|
7043
7151
|
}
|
|
7044
|
-
const l = new
|
|
7152
|
+
const l = new Dt(o, n, i);
|
|
7045
7153
|
return l._customParams = {
|
|
7046
7154
|
textureType: e,
|
|
7047
7155
|
color: t,
|
|
@@ -7067,7 +7175,7 @@ f({
|
|
|
7067
7175
|
const b = m.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7068
7176
|
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
7177
|
}
|
|
7070
|
-
const C =
|
|
7178
|
+
const C = ae.from(p);
|
|
7071
7179
|
if (this.lightMap = C, this.enabled !== void 0) {
|
|
7072
7180
|
const b = this.enabled;
|
|
7073
7181
|
this.enabled = !1, setTimeout(() => {
|
|
@@ -7140,7 +7248,7 @@ f({
|
|
|
7140
7248
|
}
|
|
7141
7249
|
]
|
|
7142
7250
|
});
|
|
7143
|
-
const { NoiseFilter:
|
|
7251
|
+
const { NoiseFilter: Ut } = w;
|
|
7144
7252
|
f({
|
|
7145
7253
|
id: "noise",
|
|
7146
7254
|
name: "Noise",
|
|
@@ -7148,7 +7256,7 @@ f({
|
|
|
7148
7256
|
description: "Add random noise to the image",
|
|
7149
7257
|
createFilter: (s) => {
|
|
7150
7258
|
try {
|
|
7151
|
-
const e = new
|
|
7259
|
+
const e = new Ut({
|
|
7152
7260
|
noise: s.noise || 0.5,
|
|
7153
7261
|
seed: s.seed || Math.random()
|
|
7154
7262
|
});
|
|
@@ -7225,7 +7333,7 @@ f({
|
|
|
7225
7333
|
}
|
|
7226
7334
|
]
|
|
7227
7335
|
});
|
|
7228
|
-
const { OldFilmFilter:
|
|
7336
|
+
const { OldFilmFilter: Vt } = g;
|
|
7229
7337
|
f({
|
|
7230
7338
|
id: "old-film",
|
|
7231
7339
|
name: "Old Film",
|
|
@@ -7233,7 +7341,7 @@ f({
|
|
|
7233
7341
|
description: "Apply a vintage film effect with scratches and grain",
|
|
7234
7342
|
createFilter: (s) => {
|
|
7235
7343
|
try {
|
|
7236
|
-
const e = new
|
|
7344
|
+
const e = new Vt({
|
|
7237
7345
|
sepia: s.sepia,
|
|
7238
7346
|
noise: s.noise,
|
|
7239
7347
|
noiseSize: s.noiseSize,
|
|
@@ -7414,7 +7522,7 @@ f({
|
|
|
7414
7522
|
}
|
|
7415
7523
|
]
|
|
7416
7524
|
});
|
|
7417
|
-
const { OutlineFilter:
|
|
7525
|
+
const { OutlineFilter: jt } = g;
|
|
7418
7526
|
f({
|
|
7419
7527
|
id: "outline",
|
|
7420
7528
|
name: "Outline",
|
|
@@ -7424,7 +7532,7 @@ f({
|
|
|
7424
7532
|
try {
|
|
7425
7533
|
let e = s.color;
|
|
7426
7534
|
typeof e == "string" && (e = parseInt(e.replace("#", "0x"), 16));
|
|
7427
|
-
const t = new
|
|
7535
|
+
const t = new jt({
|
|
7428
7536
|
thickness: s.thickness || 4,
|
|
7429
7537
|
color: e,
|
|
7430
7538
|
alpha: s.alpha || 1,
|
|
@@ -7514,7 +7622,7 @@ f({
|
|
|
7514
7622
|
}
|
|
7515
7623
|
]
|
|
7516
7624
|
});
|
|
7517
|
-
const { PixelateFilter:
|
|
7625
|
+
const { PixelateFilter: qt } = g;
|
|
7518
7626
|
f({
|
|
7519
7627
|
id: "pixelate",
|
|
7520
7628
|
name: "Pixelate",
|
|
@@ -7522,7 +7630,7 @@ f({
|
|
|
7522
7630
|
description: "Create a pixelated or mosaic effect",
|
|
7523
7631
|
createFilter: (s) => {
|
|
7524
7632
|
try {
|
|
7525
|
-
const e = new
|
|
7633
|
+
const e = new qt(
|
|
7526
7634
|
s.useUniform ? Math.max(4, s.size || 10) : [Math.max(4, s.sizeX || 10), Math.max(4, s.sizeY || 10)]
|
|
7527
7635
|
);
|
|
7528
7636
|
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
@@ -7605,7 +7713,7 @@ f({
|
|
|
7605
7713
|
}
|
|
7606
7714
|
]
|
|
7607
7715
|
});
|
|
7608
|
-
const { ReflectionFilter:
|
|
7716
|
+
const { ReflectionFilter: Ht } = g;
|
|
7609
7717
|
f({
|
|
7610
7718
|
id: "reflection",
|
|
7611
7719
|
// ID must match what the application expects
|
|
@@ -7622,7 +7730,7 @@ f({
|
|
|
7622
7730
|
waveLength: new Float32Array([s.wavelengthStart ?? 30, s.wavelengthEnd ?? 100]),
|
|
7623
7731
|
alpha: new Float32Array([s.alphaStart ?? 1, s.alphaEnd ?? 1]),
|
|
7624
7732
|
time: s.time ?? 0
|
|
7625
|
-
}, t = new
|
|
7733
|
+
}, t = new Ht(e);
|
|
7626
7734
|
return t._customParams = { ...s }, t.animating = s.animating ?? !1, t.updateUIParam = function(i, r) {
|
|
7627
7735
|
const a = this._customParams || {};
|
|
7628
7736
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -7773,7 +7881,7 @@ f({
|
|
|
7773
7881
|
}
|
|
7774
7882
|
]
|
|
7775
7883
|
});
|
|
7776
|
-
const { ShockwaveFilter:
|
|
7884
|
+
const { ShockwaveFilter: $t } = g;
|
|
7777
7885
|
f({
|
|
7778
7886
|
id: "shockwave",
|
|
7779
7887
|
// ID must match what the application expects
|
|
@@ -7783,7 +7891,7 @@ f({
|
|
|
7783
7891
|
// Create an instance of the ShockwaveFilter with the provided parameters
|
|
7784
7892
|
createFilter: (s) => {
|
|
7785
7893
|
try {
|
|
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
|
|
7894
|
+
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 $t({
|
|
7787
7895
|
center: i,
|
|
7788
7896
|
amplitude: r,
|
|
7789
7897
|
wavelength: a,
|
|
@@ -7925,7 +8033,7 @@ f({
|
|
|
7925
8033
|
}
|
|
7926
8034
|
]
|
|
7927
8035
|
});
|
|
7928
|
-
const { SimplexNoiseFilter:
|
|
8036
|
+
const { SimplexNoiseFilter: Wt } = g;
|
|
7929
8037
|
f({
|
|
7930
8038
|
id: "simplex-noise",
|
|
7931
8039
|
name: "Simplex Noise",
|
|
@@ -7933,7 +8041,7 @@ f({
|
|
|
7933
8041
|
description: "Apply procedural noise to create texture effects",
|
|
7934
8042
|
createFilter: (s) => {
|
|
7935
8043
|
try {
|
|
7936
|
-
const e = s.animating ? 0 : s.offsetZ || 0, t = new
|
|
8044
|
+
const e = s.animating ? 0 : s.offsetZ || 0, t = new Wt({
|
|
7937
8045
|
strength: s.strength,
|
|
7938
8046
|
noiseScale: s.noiseScale,
|
|
7939
8047
|
offsetX: s.offsetX,
|
|
@@ -8080,9 +8188,9 @@ f({
|
|
|
8080
8188
|
}
|
|
8081
8189
|
]
|
|
8082
8190
|
});
|
|
8083
|
-
class
|
|
8191
|
+
class Zt extends w.Filter {
|
|
8084
8192
|
constructor(e) {
|
|
8085
|
-
const t =
|
|
8193
|
+
const t = Ce.from({
|
|
8086
8194
|
vertex: `
|
|
8087
8195
|
attribute vec2 aPosition;
|
|
8088
8196
|
varying vec2 vTextureCoord;
|
|
@@ -8191,7 +8299,7 @@ f({
|
|
|
8191
8299
|
description: "Creates a twisting distortion effect around a central point",
|
|
8192
8300
|
createFilter: (s) => {
|
|
8193
8301
|
try {
|
|
8194
|
-
const e = new
|
|
8302
|
+
const e = new Zt({
|
|
8195
8303
|
centerX: s.centerX ?? 0.5,
|
|
8196
8304
|
centerY: s.centerY ?? 0.5,
|
|
8197
8305
|
radius: s.radius ?? 0.25,
|
|
@@ -8261,7 +8369,7 @@ f({
|
|
|
8261
8369
|
}
|
|
8262
8370
|
]
|
|
8263
8371
|
});
|
|
8264
|
-
const { AdjustmentFilter:
|
|
8372
|
+
const { AdjustmentFilter: Gt } = g;
|
|
8265
8373
|
function D(s) {
|
|
8266
8374
|
const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
|
|
8267
8375
|
return [
|
|
@@ -8270,7 +8378,7 @@ function D(s) {
|
|
|
8270
8378
|
(e & 255) / 255
|
|
8271
8379
|
];
|
|
8272
8380
|
}
|
|
8273
|
-
class
|
|
8381
|
+
class Kt extends Gt {
|
|
8274
8382
|
constructor(e = {}) {
|
|
8275
8383
|
super({
|
|
8276
8384
|
brightness: 1,
|
|
@@ -8313,7 +8421,7 @@ f({
|
|
|
8313
8421
|
description: "Add a classic darkened border effect to the image",
|
|
8314
8422
|
createFilter: (s) => {
|
|
8315
8423
|
try {
|
|
8316
|
-
const e = new
|
|
8424
|
+
const e = new Kt({
|
|
8317
8425
|
radius: s.radius || 0.8,
|
|
8318
8426
|
strength: s.strength || 1,
|
|
8319
8427
|
color: s.color || "#000000"
|
|
@@ -8377,22 +8485,22 @@ f({
|
|
|
8377
8485
|
}
|
|
8378
8486
|
]
|
|
8379
8487
|
});
|
|
8380
|
-
function
|
|
8488
|
+
function ri(s) {
|
|
8381
8489
|
try {
|
|
8382
8490
|
let e = [], t = [];
|
|
8383
8491
|
try {
|
|
8384
|
-
e = U(), e.length === 0 &&
|
|
8492
|
+
e = U(), e.length === 0 && rt();
|
|
8385
8493
|
} catch {
|
|
8386
8494
|
}
|
|
8387
8495
|
const i = s == null ? void 0 : s.disabled;
|
|
8388
8496
|
if (Array.isArray(i) && i.length > 0) {
|
|
8389
8497
|
let r = 0;
|
|
8390
8498
|
for (const a of i)
|
|
8391
|
-
|
|
8499
|
+
ot(a) && r++;
|
|
8392
8500
|
r > 0;
|
|
8393
8501
|
}
|
|
8394
8502
|
try {
|
|
8395
|
-
e = U(), t =
|
|
8503
|
+
e = U(), t = at();
|
|
8396
8504
|
} catch {
|
|
8397
8505
|
e || (e = []), t || (t = []);
|
|
8398
8506
|
}
|
|
@@ -8402,16 +8510,16 @@ function Jt(s) {
|
|
|
8402
8510
|
}
|
|
8403
8511
|
}
|
|
8404
8512
|
export {
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8513
|
+
ei as V,
|
|
8514
|
+
it as a,
|
|
8515
|
+
st as b,
|
|
8516
|
+
at as c,
|
|
8517
|
+
rt as d,
|
|
8518
|
+
ii as e,
|
|
8519
|
+
nt as f,
|
|
8412
8520
|
U as g,
|
|
8413
|
-
|
|
8414
|
-
|
|
8521
|
+
ti as h,
|
|
8522
|
+
ri as i,
|
|
8415
8523
|
f as r
|
|
8416
8524
|
};
|
|
8417
|
-
//# sourceMappingURL=editor-
|
|
8525
|
+
//# sourceMappingURL=editor-624YYYUE.js.map
|