@codingfactory/mediables-vue 2.3.6 → 2.4.1
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-DM4yaigy.cjs → PixiFrameExporter-8_WF3thr.cjs} +2 -2
- package/dist/{PixiFrameExporter-DM4yaigy.cjs.map → PixiFrameExporter-8_WF3thr.cjs.map} +1 -1
- package/dist/{PixiFrameExporter-BAZtrvGS.js → PixiFrameExporter-vXYgP3wU.js} +2 -2
- package/dist/{PixiFrameExporter-BAZtrvGS.js.map → PixiFrameExporter-vXYgP3wU.js.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-Bl0mzqgX.cjs +42 -0
- package/dist/editor-Bl0mzqgX.cjs.map +1 -0
- package/dist/{editor-BWpslm--.js → editor-DiiyShiW.js} +419 -303
- package/dist/editor-DiiyShiW.js.map +1 -0
- package/dist/{index-CMOpozRS.js → index-B42SSGjg.js} +7717 -7554
- package/dist/index-B42SSGjg.js.map +1 -0
- package/dist/index-CT0VqMgf.cjs +342 -0
- package/dist/index-CT0VqMgf.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
|
}
|
|
@@ -263,17 +292,17 @@ class xe extends B {
|
|
|
263
292
|
*/
|
|
264
293
|
async loadTexture(e) {
|
|
265
294
|
var l, c, u;
|
|
266
|
-
if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return;
|
|
295
|
+
if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return !1;
|
|
267
296
|
const t = window.PIXI, i = await this._loadImageElement(e);
|
|
268
|
-
if (!i || !((c = this.app) != null && c.renderer)) return;
|
|
297
|
+
if (!i || !((c = this.app) != null && c.renderer)) return !1;
|
|
269
298
|
const r = t.Texture.from(i);
|
|
270
299
|
if (!r)
|
|
271
|
-
return;
|
|
300
|
+
return !1;
|
|
272
301
|
this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new t.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
|
|
273
302
|
const { w: a, h: o } = this._getCssSize();
|
|
274
|
-
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((u = this.app) != null && u.renderer)) return;
|
|
303
|
+
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((u = this.app) != null && u.renderer)) return !1;
|
|
275
304
|
const n = this.getFitScaleFor(r);
|
|
276
|
-
Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height });
|
|
305
|
+
return Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height }), !0;
|
|
277
306
|
}
|
|
278
307
|
/**
|
|
279
308
|
* Export the current image with filters applied
|
|
@@ -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,45 @@ 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
|
|
2694
|
+
*/
|
|
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));
|
|
2700
|
+
const a = await this._renderer.loadTexture(r);
|
|
2701
|
+
if (!(this._destroyed || this._loadVersion !== i)) {
|
|
2702
|
+
if (!a) {
|
|
2703
|
+
this.emit("error", new Error("Failed to load image"));
|
|
2704
|
+
return;
|
|
2705
|
+
}
|
|
2706
|
+
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 });
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
/**
|
|
2710
|
+
* Reset all editor state (filters + crop) to a clean baseline.
|
|
2711
|
+
* Called at the start of loadImage() to prevent stale state bleed between sessions.
|
|
2630
2712
|
*/
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
e instanceof File && (t = await this._fileToDataUrl(e)), await this._renderer.loadTexture(t), this._state.set("hasImage", !0), this._state.set("imageUrl", t), this._options.initialMode === "crop" && this.setMode("crop"), this.emit("imageLoaded", { url: t });
|
|
2713
|
+
_resetEditorState() {
|
|
2714
|
+
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"));
|
|
2634
2715
|
}
|
|
2635
2716
|
/**
|
|
2636
|
-
*
|
|
2637
|
-
*
|
|
2638
|
-
* @
|
|
2717
|
+
* Hydrate editor state from a canonical ImageEditorSessionState object.
|
|
2718
|
+
* Restores filter stack + values and crop metadata (shape, aspect, rect).
|
|
2719
|
+
* @param {Object} state - ImageEditorSessionState
|
|
2639
2720
|
*/
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
const
|
|
2643
|
-
|
|
2644
|
-
|
|
2721
|
+
_hydrateState(e) {
|
|
2722
|
+
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))) {
|
|
2723
|
+
for (const t of e.filters)
|
|
2724
|
+
if (t.enabled && (this._state.toggleFilter(t.id, !0), this._filterManager.initializeValues(t.id), t.values))
|
|
2725
|
+
for (const [i, r] of Object.entries(t.values))
|
|
2726
|
+
this._state.setFilterValue(t.id, i, r);
|
|
2727
|
+
this._filterManager.applyFilters();
|
|
2728
|
+
}
|
|
2645
2729
|
}
|
|
2646
2730
|
/**
|
|
2647
2731
|
* Open the file picker dialog
|
|
@@ -2663,24 +2747,50 @@ class Gt extends B {
|
|
|
2663
2747
|
* Save the image (triggers download and emits 'save' event)
|
|
2664
2748
|
*/
|
|
2665
2749
|
save() {
|
|
2666
|
-
var e, t;
|
|
2667
2750
|
if (this._state.get("hasImage")) {
|
|
2668
2751
|
this._state.set("isSaving", !0);
|
|
2669
2752
|
try {
|
|
2670
|
-
const
|
|
2671
|
-
if (!
|
|
2672
|
-
const
|
|
2673
|
-
width: Math.round((
|
|
2674
|
-
height: Math.round((
|
|
2675
|
-
},
|
|
2676
|
-
|
|
2677
|
-
} catch (
|
|
2678
|
-
this.emit("error", { error:
|
|
2753
|
+
const e = this.exportImage("png", 0.92);
|
|
2754
|
+
if (!e) throw new Error("Failed to export image");
|
|
2755
|
+
const t = this._renderer.originalTexture, i = {
|
|
2756
|
+
width: Math.round((t == null ? void 0 : t.width) || 0),
|
|
2757
|
+
height: Math.round((t == null ? void 0 : t.height) || 0)
|
|
2758
|
+
}, r = document.createElement("a");
|
|
2759
|
+
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() });
|
|
2760
|
+
} catch (e) {
|
|
2761
|
+
this.emit("error", { error: e });
|
|
2679
2762
|
} finally {
|
|
2680
2763
|
this._state.set("isSaving", !1);
|
|
2681
2764
|
}
|
|
2682
2765
|
}
|
|
2683
2766
|
}
|
|
2767
|
+
/**
|
|
2768
|
+
* Get a canonical, serializable snapshot of the current editor state.
|
|
2769
|
+
* Safe for persistence — returns a deep copy with no mutable references.
|
|
2770
|
+
* @returns {Object} ImageEditorSessionState
|
|
2771
|
+
*/
|
|
2772
|
+
getSerializableState() {
|
|
2773
|
+
const e = this._state.get("activeFilters"), t = [];
|
|
2774
|
+
if (e)
|
|
2775
|
+
for (const o of e) {
|
|
2776
|
+
const n = this._state.getFilterValues(o);
|
|
2777
|
+
t.push({
|
|
2778
|
+
id: o,
|
|
2779
|
+
enabled: !0,
|
|
2780
|
+
values: { ...n }
|
|
2781
|
+
});
|
|
2782
|
+
}
|
|
2783
|
+
const i = this._state.get("crop.appliedRect"), r = this._state.get("crop.rect"), a = i || r;
|
|
2784
|
+
return {
|
|
2785
|
+
version: 1,
|
|
2786
|
+
crop: {
|
|
2787
|
+
rect: a ? { ...a } : null,
|
|
2788
|
+
aspectRatio: this._state.get("crop.appliedAspect") || this._state.get("crop.aspect") || "free",
|
|
2789
|
+
shape: this._state.get("crop.appliedShape") || this._state.get("crop.shape") || "free"
|
|
2790
|
+
},
|
|
2791
|
+
filters: t
|
|
2792
|
+
};
|
|
2793
|
+
}
|
|
2684
2794
|
/**
|
|
2685
2795
|
* Close the editor (emits 'cancel' event)
|
|
2686
2796
|
*/
|
|
@@ -2805,24 +2915,30 @@ class Gt extends B {
|
|
|
2805
2915
|
*/
|
|
2806
2916
|
destroy() {
|
|
2807
2917
|
var e, t, i, r, a, o, n, l, c, u;
|
|
2808
|
-
|
|
2918
|
+
this._destroyed = !0;
|
|
2919
|
+
for (const h of this._objectUrls)
|
|
2920
|
+
try {
|
|
2921
|
+
URL.revokeObjectURL(h);
|
|
2922
|
+
} catch {
|
|
2923
|
+
}
|
|
2924
|
+
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
2925
|
}
|
|
2810
2926
|
}
|
|
2811
2927
|
const S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
2812
|
-
function
|
|
2928
|
+
function tt(s, e) {
|
|
2813
2929
|
return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
|
|
2814
2930
|
}
|
|
2815
2931
|
function f(s) {
|
|
2816
2932
|
var e;
|
|
2817
2933
|
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
2934
|
}
|
|
2819
|
-
function
|
|
2935
|
+
function it(s) {
|
|
2820
2936
|
return S.get(s);
|
|
2821
2937
|
}
|
|
2822
2938
|
function U() {
|
|
2823
2939
|
return Array.from(S.values());
|
|
2824
2940
|
}
|
|
2825
|
-
function
|
|
2941
|
+
function rt() {
|
|
2826
2942
|
U().map((t) => t.id), Object.entries(g).filter(
|
|
2827
2943
|
(t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
|
|
2828
2944
|
).forEach(([t, i]) => {
|
|
@@ -2846,16 +2962,16 @@ function Je() {
|
|
|
2846
2962
|
});
|
|
2847
2963
|
});
|
|
2848
2964
|
}
|
|
2849
|
-
function
|
|
2965
|
+
function st(s) {
|
|
2850
2966
|
return (I.get(s) || []).map((t) => S.get(t)).filter(Boolean);
|
|
2851
2967
|
}
|
|
2852
|
-
function
|
|
2968
|
+
function at() {
|
|
2853
2969
|
return Array.from(I.keys());
|
|
2854
2970
|
}
|
|
2855
|
-
function
|
|
2971
|
+
function ti(s) {
|
|
2856
2972
|
return S.has(s);
|
|
2857
2973
|
}
|
|
2858
|
-
function
|
|
2974
|
+
function ot(s) {
|
|
2859
2975
|
const e = S.get(s);
|
|
2860
2976
|
if (!e)
|
|
2861
2977
|
return !1;
|
|
@@ -2867,11 +2983,11 @@ function it(s) {
|
|
|
2867
2983
|
}
|
|
2868
2984
|
return !0;
|
|
2869
2985
|
}
|
|
2870
|
-
function
|
|
2986
|
+
function ii(s, e) {
|
|
2871
2987
|
const t = S.get(s);
|
|
2872
|
-
return t ?
|
|
2988
|
+
return t ? tt(t, e) : !1;
|
|
2873
2989
|
}
|
|
2874
|
-
function
|
|
2990
|
+
function nt() {
|
|
2875
2991
|
return Array.from(S.values()).map((s) => ({
|
|
2876
2992
|
id: s.id,
|
|
2877
2993
|
name: s.name,
|
|
@@ -2880,7 +2996,7 @@ function rt() {
|
|
|
2880
2996
|
}));
|
|
2881
2997
|
}
|
|
2882
2998
|
if (typeof window < "u") {
|
|
2883
|
-
window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter =
|
|
2999
|
+
window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter = it, window.getFiltersByCategory = st, window.getRegisteredFilters = nt;
|
|
2884
3000
|
const s = f;
|
|
2885
3001
|
window.registerFilter = (e) => {
|
|
2886
3002
|
const t = s(e);
|
|
@@ -2890,7 +3006,7 @@ if (typeof window < "u") {
|
|
|
2890
3006
|
typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
|
|
2891
3007
|
return [];
|
|
2892
3008
|
});
|
|
2893
|
-
const { AdjustmentFilter:
|
|
3009
|
+
const { AdjustmentFilter: lt } = g, { ColorMatrixFilter: ct } = w, k = {
|
|
2894
3010
|
gamma: 1,
|
|
2895
3011
|
saturation: 1,
|
|
2896
3012
|
contrast: 1,
|
|
@@ -2899,7 +3015,7 @@ const { AdjustmentFilter: st } = g, { ColorMatrixFilter: at } = w, k = {
|
|
|
2899
3015
|
green: 1,
|
|
2900
3016
|
blue: 1,
|
|
2901
3017
|
alpha: 1
|
|
2902
|
-
},
|
|
3018
|
+
}, ht = /* @__PURE__ */ new Set([
|
|
2903
3019
|
"gamma",
|
|
2904
3020
|
"saturation",
|
|
2905
3021
|
"contrast",
|
|
@@ -2919,10 +3035,10 @@ function P(s, e) {
|
|
|
2919
3035
|
}
|
|
2920
3036
|
return e;
|
|
2921
3037
|
}
|
|
2922
|
-
function
|
|
2923
|
-
return
|
|
3038
|
+
function ee(s) {
|
|
3039
|
+
return ht.has(s);
|
|
2924
3040
|
}
|
|
2925
|
-
function
|
|
3041
|
+
function dt(s) {
|
|
2926
3042
|
return {
|
|
2927
3043
|
gamma: P(s.gamma, k.gamma),
|
|
2928
3044
|
saturation: P(s.saturation, k.saturation),
|
|
@@ -2934,7 +3050,7 @@ function nt(s) {
|
|
|
2934
3050
|
alpha: P(s.alpha, k.alpha)
|
|
2935
3051
|
};
|
|
2936
3052
|
}
|
|
2937
|
-
function
|
|
3053
|
+
function te(s, e) {
|
|
2938
3054
|
s.reset(), s.brightness(e.brightness, !0), s.contrast(e.contrast, !0), s.saturate(e.saturation, !0);
|
|
2939
3055
|
}
|
|
2940
3056
|
f({
|
|
@@ -2945,12 +3061,12 @@ f({
|
|
|
2945
3061
|
// Create an instance of the AdjustmentFilter with the provided parameters
|
|
2946
3062
|
createFilter: (s) => {
|
|
2947
3063
|
try {
|
|
2948
|
-
const e =
|
|
3064
|
+
const e = dt(s ?? {}), t = { ...e };
|
|
2949
3065
|
try {
|
|
2950
|
-
const i = new
|
|
3066
|
+
const i = new lt(t), r = i;
|
|
2951
3067
|
return r._customParams = { ...e }, r.updateUIParam = function(o, n) {
|
|
2952
3068
|
try {
|
|
2953
|
-
if (!
|
|
3069
|
+
if (!ee(o))
|
|
2954
3070
|
return;
|
|
2955
3071
|
const l = this._customParams ?? { ...k }, c = P(n, l[o]);
|
|
2956
3072
|
l[o] = c, this._customParams = l;
|
|
@@ -2960,13 +3076,13 @@ f({
|
|
|
2960
3076
|
}
|
|
2961
3077
|
}, i;
|
|
2962
3078
|
} catch {
|
|
2963
|
-
const r = new
|
|
2964
|
-
return a._customParams = { ...e },
|
|
3079
|
+
const r = new ct(), a = r;
|
|
3080
|
+
return a._customParams = { ...e }, te(r, e), a.updateUIParam = function(n, l) {
|
|
2965
3081
|
try {
|
|
2966
|
-
if (!
|
|
3082
|
+
if (!ee(n))
|
|
2967
3083
|
return;
|
|
2968
3084
|
const c = this._customParams ?? { ...k }, u = P(l, c[n]);
|
|
2969
|
-
c[n] = u, this._customParams = c,
|
|
3085
|
+
c[n] = u, this._customParams = c, te(this, c);
|
|
2970
3086
|
} catch {
|
|
2971
3087
|
}
|
|
2972
3088
|
}, r;
|
|
@@ -3070,14 +3186,14 @@ f({
|
|
|
3070
3186
|
}
|
|
3071
3187
|
]
|
|
3072
3188
|
});
|
|
3073
|
-
const { ColorMatrixFilter:
|
|
3189
|
+
const { ColorMatrixFilter: ut } = w, N = {
|
|
3074
3190
|
brightness: 1,
|
|
3075
3191
|
contrast: 1,
|
|
3076
3192
|
saturation: 1,
|
|
3077
3193
|
hue: 0,
|
|
3078
3194
|
sepia: 0,
|
|
3079
3195
|
negative: !1
|
|
3080
|
-
},
|
|
3196
|
+
}, pt = /* @__PURE__ */ new Set([
|
|
3081
3197
|
"brightness",
|
|
3082
3198
|
"contrast",
|
|
3083
3199
|
"saturation",
|
|
@@ -3085,8 +3201,8 @@ const { ColorMatrixFilter: lt } = w, R = {
|
|
|
3085
3201
|
"sepia",
|
|
3086
3202
|
"negative"
|
|
3087
3203
|
]);
|
|
3088
|
-
function
|
|
3089
|
-
return
|
|
3204
|
+
function ft(s) {
|
|
3205
|
+
return pt.has(s);
|
|
3090
3206
|
}
|
|
3091
3207
|
function X(s, e) {
|
|
3092
3208
|
if (typeof s == "number" && Number.isFinite(s))
|
|
@@ -3098,7 +3214,7 @@ function X(s, e) {
|
|
|
3098
3214
|
}
|
|
3099
3215
|
return e;
|
|
3100
3216
|
}
|
|
3101
|
-
function
|
|
3217
|
+
function fe(s, e) {
|
|
3102
3218
|
if (typeof s == "boolean")
|
|
3103
3219
|
return s;
|
|
3104
3220
|
if (typeof s == "string") {
|
|
@@ -3109,17 +3225,17 @@ function pe(s, e) {
|
|
|
3109
3225
|
}
|
|
3110
3226
|
return e;
|
|
3111
3227
|
}
|
|
3112
|
-
function
|
|
3228
|
+
function mt(s) {
|
|
3113
3229
|
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:
|
|
3230
|
+
brightness: X(s.brightness, N.brightness),
|
|
3231
|
+
contrast: X(s.contrast, N.contrast),
|
|
3232
|
+
saturation: X(s.saturation, N.saturation),
|
|
3233
|
+
hue: X(s.hue, N.hue),
|
|
3234
|
+
sepia: X(s.sepia, N.sepia),
|
|
3235
|
+
negative: fe(s.negative, N.negative)
|
|
3120
3236
|
};
|
|
3121
3237
|
}
|
|
3122
|
-
function
|
|
3238
|
+
function ie(s, e) {
|
|
3123
3239
|
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
3240
|
}
|
|
3125
3241
|
f({
|
|
@@ -3130,19 +3246,19 @@ f({
|
|
|
3130
3246
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
3131
3247
|
createFilter: (s) => {
|
|
3132
3248
|
try {
|
|
3133
|
-
const e =
|
|
3134
|
-
return i._customParams = { ...e },
|
|
3249
|
+
const e = mt(s ?? {}), t = new ut(), i = t;
|
|
3250
|
+
return i._customParams = { ...e }, ie(t, e), i.updateUIParam = function(a, o) {
|
|
3135
3251
|
try {
|
|
3136
|
-
if (!
|
|
3252
|
+
if (!ft(a))
|
|
3137
3253
|
return;
|
|
3138
|
-
const n = this._customParams ?? { ...
|
|
3254
|
+
const n = this._customParams ?? { ...N };
|
|
3139
3255
|
if (a === "negative")
|
|
3140
|
-
n.negative =
|
|
3256
|
+
n.negative = fe(o, n.negative);
|
|
3141
3257
|
else {
|
|
3142
3258
|
const l = a;
|
|
3143
3259
|
n[l] = X(o, n[l]);
|
|
3144
3260
|
}
|
|
3145
|
-
this._customParams = n,
|
|
3261
|
+
this._customParams = n, ie(this, n);
|
|
3146
3262
|
} catch {
|
|
3147
3263
|
}
|
|
3148
3264
|
}, t;
|
|
@@ -3414,7 +3530,7 @@ f({
|
|
|
3414
3530
|
}
|
|
3415
3531
|
]
|
|
3416
3532
|
});
|
|
3417
|
-
const { ColorOverlayFilter:
|
|
3533
|
+
const { ColorOverlayFilter: gt } = g;
|
|
3418
3534
|
f({
|
|
3419
3535
|
id: "colorOverlay",
|
|
3420
3536
|
name: "Color Overlay",
|
|
@@ -3429,7 +3545,7 @@ f({
|
|
|
3429
3545
|
try {
|
|
3430
3546
|
let e = 16711680;
|
|
3431
3547
|
s.color && (typeof s.color == "string" ? e = parseInt(s.color.replace("#", "0x"), 16) : typeof s.color == "number" && (e = s.color));
|
|
3432
|
-
const t = new
|
|
3548
|
+
const t = new gt({
|
|
3433
3549
|
color: e,
|
|
3434
3550
|
alpha: s.alpha || 0.5
|
|
3435
3551
|
});
|
|
@@ -3661,7 +3777,7 @@ f({
|
|
|
3661
3777
|
}
|
|
3662
3778
|
]
|
|
3663
3779
|
});
|
|
3664
|
-
const { ColorMatrixFilter:
|
|
3780
|
+
const { ColorMatrixFilter: bt } = w;
|
|
3665
3781
|
f({
|
|
3666
3782
|
id: "grayscale",
|
|
3667
3783
|
name: "Grayscale",
|
|
@@ -3674,14 +3790,14 @@ f({
|
|
|
3674
3790
|
*/
|
|
3675
3791
|
createFilter: (s) => {
|
|
3676
3792
|
try {
|
|
3677
|
-
const e = new
|
|
3793
|
+
const e = new bt();
|
|
3678
3794
|
e._customParams = { ...s };
|
|
3679
3795
|
const t = s.intensity !== void 0 ? s.intensity : 1;
|
|
3680
|
-
return
|
|
3796
|
+
return re(e, t), e.updateUIParam = function(i, r) {
|
|
3681
3797
|
const a = this._customParams || {};
|
|
3682
3798
|
switch (this._customParams = a, a[i] = r, i) {
|
|
3683
3799
|
case "intensity":
|
|
3684
|
-
|
|
3800
|
+
re(this, r);
|
|
3685
3801
|
break;
|
|
3686
3802
|
default:
|
|
3687
3803
|
i in this && (this[i] = r);
|
|
@@ -3711,10 +3827,10 @@ f({
|
|
|
3711
3827
|
}
|
|
3712
3828
|
]
|
|
3713
3829
|
});
|
|
3714
|
-
function
|
|
3830
|
+
function re(s, e) {
|
|
3715
3831
|
s.reset(), s.greyscale(e);
|
|
3716
3832
|
}
|
|
3717
|
-
const { HslAdjustmentFilter:
|
|
3833
|
+
const { HslAdjustmentFilter: yt } = g;
|
|
3718
3834
|
f({
|
|
3719
3835
|
id: "hsl-adjustment",
|
|
3720
3836
|
name: "HSL Adjustment",
|
|
@@ -3726,7 +3842,7 @@ f({
|
|
|
3726
3842
|
*/
|
|
3727
3843
|
createFilter: (s) => {
|
|
3728
3844
|
try {
|
|
3729
|
-
const e = new
|
|
3845
|
+
const e = new yt({
|
|
3730
3846
|
hue: s.hue !== void 0 ? s.hue : 0,
|
|
3731
3847
|
saturation: s.saturation !== void 0 ? s.saturation : 0,
|
|
3732
3848
|
lightness: s.lightness !== void 0 ? s.lightness : 0,
|
|
@@ -3824,7 +3940,7 @@ f({
|
|
|
3824
3940
|
}
|
|
3825
3941
|
]
|
|
3826
3942
|
});
|
|
3827
|
-
const { KawaseBlurFilter:
|
|
3943
|
+
const { KawaseBlurFilter: _t } = g;
|
|
3828
3944
|
f({
|
|
3829
3945
|
id: "kawase-blur",
|
|
3830
3946
|
name: "Kawase Blur",
|
|
@@ -3837,7 +3953,7 @@ f({
|
|
|
3837
3953
|
*/
|
|
3838
3954
|
createFilter: (s) => {
|
|
3839
3955
|
try {
|
|
3840
|
-
const e = new
|
|
3956
|
+
const e = new _t({
|
|
3841
3957
|
strength: s.strength || 4,
|
|
3842
3958
|
quality: s.quality || 3,
|
|
3843
3959
|
clamp: s.clamp || !1,
|
|
@@ -3942,7 +4058,7 @@ f({
|
|
|
3942
4058
|
}
|
|
3943
4059
|
]
|
|
3944
4060
|
});
|
|
3945
|
-
const { MotionBlurFilter:
|
|
4061
|
+
const { MotionBlurFilter: xt } = g;
|
|
3946
4062
|
f({
|
|
3947
4063
|
id: "motion-blur",
|
|
3948
4064
|
name: "Motion Blur",
|
|
@@ -3955,7 +4071,7 @@ f({
|
|
|
3955
4071
|
*/
|
|
3956
4072
|
createFilter: (s) => {
|
|
3957
4073
|
try {
|
|
3958
|
-
const e = new
|
|
4074
|
+
const e = new xt({
|
|
3959
4075
|
velocity: {
|
|
3960
4076
|
x: s.velocityX !== void 0 ? s.velocityX : 0,
|
|
3961
4077
|
y: s.velocityY !== void 0 ? s.velocityY : 0
|
|
@@ -4050,7 +4166,7 @@ f({
|
|
|
4050
4166
|
}
|
|
4051
4167
|
]
|
|
4052
4168
|
});
|
|
4053
|
-
const { RadialBlurFilter:
|
|
4169
|
+
const { RadialBlurFilter: Ct } = g;
|
|
4054
4170
|
f({
|
|
4055
4171
|
id: "radial-blur",
|
|
4056
4172
|
name: "Radial Blur",
|
|
@@ -4059,7 +4175,7 @@ f({
|
|
|
4059
4175
|
// Create an instance of the RadialBlurFilter with the provided parameters
|
|
4060
4176
|
createFilter: (s) => {
|
|
4061
4177
|
try {
|
|
4062
|
-
const e = new
|
|
4178
|
+
const e = new Ct({
|
|
4063
4179
|
angle: s.angle ?? 20,
|
|
4064
4180
|
center: { x: s.centerX ?? 0, y: s.centerY ?? 0 },
|
|
4065
4181
|
kernelSize: s.kernelSize ?? 15,
|
|
@@ -4174,7 +4290,7 @@ f({
|
|
|
4174
4290
|
}
|
|
4175
4291
|
]
|
|
4176
4292
|
});
|
|
4177
|
-
const { TiltShiftFilter:
|
|
4293
|
+
const { TiltShiftFilter: wt } = g;
|
|
4178
4294
|
f({
|
|
4179
4295
|
id: "tilt-shift",
|
|
4180
4296
|
name: "Tilt Shift",
|
|
@@ -4183,7 +4299,7 @@ f({
|
|
|
4183
4299
|
// Create an instance of the TiltShiftFilter with the provided parameters
|
|
4184
4300
|
createFilter: (s) => {
|
|
4185
4301
|
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
|
|
4302
|
+
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
4303
|
blur: Number(e),
|
|
4188
4304
|
gradientBlur: Number(t),
|
|
4189
4305
|
start: { x: Number(i), y: Number(r) },
|
|
@@ -4302,7 +4418,7 @@ f({
|
|
|
4302
4418
|
}
|
|
4303
4419
|
]
|
|
4304
4420
|
});
|
|
4305
|
-
const { ZoomBlurFilter:
|
|
4421
|
+
const { ZoomBlurFilter: St } = g;
|
|
4306
4422
|
f({
|
|
4307
4423
|
id: "zoom-blur",
|
|
4308
4424
|
name: "Zoom Blur",
|
|
@@ -4315,7 +4431,7 @@ f({
|
|
|
4315
4431
|
*/
|
|
4316
4432
|
createFilter: (s) => {
|
|
4317
4433
|
try {
|
|
4318
|
-
const e = new
|
|
4434
|
+
const e = new St({
|
|
4319
4435
|
strength: s.strength || 0.1,
|
|
4320
4436
|
center: {
|
|
4321
4437
|
x: s.centerX !== void 0 ? s.centerX : 0.5,
|
|
@@ -4429,7 +4545,7 @@ f({
|
|
|
4429
4545
|
}
|
|
4430
4546
|
]
|
|
4431
4547
|
});
|
|
4432
|
-
const { ColorGradientFilter:
|
|
4548
|
+
const { ColorGradientFilter: se } = g;
|
|
4433
4549
|
f({
|
|
4434
4550
|
id: "color-gradient",
|
|
4435
4551
|
name: "Color Gradient",
|
|
@@ -4453,7 +4569,7 @@ f({
|
|
|
4453
4569
|
{ offset: 0, color: 16711680, alpha: 1 },
|
|
4454
4570
|
{ offset: 1, color: 255, alpha: 1 }
|
|
4455
4571
|
]), e.sort((i, r) => i.offset - r.offset);
|
|
4456
|
-
const t = new
|
|
4572
|
+
const t = new se({
|
|
4457
4573
|
type: s.gradientType,
|
|
4458
4574
|
// 0: linear, 1: radial, 2: conic
|
|
4459
4575
|
stops: e,
|
|
@@ -4543,7 +4659,7 @@ f({
|
|
|
4543
4659
|
case "cssGradient":
|
|
4544
4660
|
if (r && typeof r == "string" && r.trim() !== "")
|
|
4545
4661
|
try {
|
|
4546
|
-
const h = new
|
|
4662
|
+
const h = new se({ css: r });
|
|
4547
4663
|
this.type = h.type, this.angle = h.angle, this.stops = [...h.stops], a.colorStops = this.stops.map((p) => ({
|
|
4548
4664
|
offset: p.offset,
|
|
4549
4665
|
color: typeof p.color == "number" ? "#" + p.color.toString(16).padStart(6, "0") : p.color,
|
|
@@ -4568,7 +4684,7 @@ f({
|
|
|
4568
4684
|
if (h) {
|
|
4569
4685
|
const [p, m, C] = h, b = parseInt(m), y = [...this.stops];
|
|
4570
4686
|
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((
|
|
4687
|
+
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
4688
|
}
|
|
4573
4689
|
} else i in this && (this[i] = r);
|
|
4574
4690
|
break;
|
|
@@ -4756,7 +4872,7 @@ f({
|
|
|
4756
4872
|
}
|
|
4757
4873
|
]
|
|
4758
4874
|
});
|
|
4759
|
-
const
|
|
4875
|
+
const vt = g.ColorReplaceFilter;
|
|
4760
4876
|
f({
|
|
4761
4877
|
id: "color-replace",
|
|
4762
4878
|
name: "Color Replace",
|
|
@@ -4773,7 +4889,7 @@ f({
|
|
|
4773
4889
|
s.originalColor && (typeof s.originalColor == "string" ? e = parseInt(s.originalColor.replace("#", "0x"), 16) : typeof s.originalColor == "number" && (e = s.originalColor));
|
|
4774
4890
|
let t = 255;
|
|
4775
4891
|
s.targetColor && (typeof s.targetColor == "string" ? t = parseInt(s.targetColor.replace("#", "0x"), 16) : typeof s.targetColor == "number" && (t = s.targetColor));
|
|
4776
|
-
const i = new
|
|
4892
|
+
const i = new vt({
|
|
4777
4893
|
originalColor: e,
|
|
4778
4894
|
targetColor: t,
|
|
4779
4895
|
tolerance: s.tolerance || 0.4
|
|
@@ -4837,7 +4953,7 @@ f({
|
|
|
4837
4953
|
}
|
|
4838
4954
|
]
|
|
4839
4955
|
});
|
|
4840
|
-
const
|
|
4956
|
+
const kt = g.MultiColorReplaceFilter;
|
|
4841
4957
|
f({
|
|
4842
4958
|
id: "multi-color-replace",
|
|
4843
4959
|
name: "Multi-Color Replace",
|
|
@@ -4863,7 +4979,7 @@ f({
|
|
|
4863
4979
|
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
4980
|
e.push([i, r]);
|
|
4865
4981
|
}
|
|
4866
|
-
const t = new
|
|
4982
|
+
const t = new kt(
|
|
4867
4983
|
e,
|
|
4868
4984
|
s.tolerance || 0.05,
|
|
4869
4985
|
3
|
|
@@ -4974,7 +5090,7 @@ f({
|
|
|
4974
5090
|
}
|
|
4975
5091
|
]
|
|
4976
5092
|
});
|
|
4977
|
-
const { RGBSplitFilter:
|
|
5093
|
+
const { RGBSplitFilter: Pt } = g;
|
|
4978
5094
|
f({
|
|
4979
5095
|
id: "rgb-split",
|
|
4980
5096
|
name: "RGB Split",
|
|
@@ -4995,7 +5111,7 @@ f({
|
|
|
4995
5111
|
}, i = {
|
|
4996
5112
|
x: s.blueX !== void 0 ? s.blueX : 0,
|
|
4997
5113
|
y: s.blueY !== void 0 ? s.blueY : 0
|
|
4998
|
-
}, r = new
|
|
5114
|
+
}, r = new Pt({
|
|
4999
5115
|
red: e,
|
|
5000
5116
|
green: t,
|
|
5001
5117
|
blue: i
|
|
@@ -5108,7 +5224,7 @@ f({
|
|
|
5108
5224
|
}
|
|
5109
5225
|
]
|
|
5110
5226
|
});
|
|
5111
|
-
const { AdvancedBloomFilter:
|
|
5227
|
+
const { AdvancedBloomFilter: Mt } = g;
|
|
5112
5228
|
f({
|
|
5113
5229
|
id: "advanced-bloom",
|
|
5114
5230
|
name: "Advanced Bloom",
|
|
@@ -5117,7 +5233,7 @@ f({
|
|
|
5117
5233
|
// Create an instance of the AdvancedBloomFilter with the provided parameters
|
|
5118
5234
|
createFilter: (s) => {
|
|
5119
5235
|
try {
|
|
5120
|
-
const e = new
|
|
5236
|
+
const e = new Mt({
|
|
5121
5237
|
threshold: s.threshold || 0.5,
|
|
5122
5238
|
bloomScale: s.bloomScale || 1,
|
|
5123
5239
|
brightness: s.brightness || 1,
|
|
@@ -5264,7 +5380,7 @@ f({
|
|
|
5264
5380
|
}
|
|
5265
5381
|
]
|
|
5266
5382
|
});
|
|
5267
|
-
const
|
|
5383
|
+
const Ft = g.AsciiFilter;
|
|
5268
5384
|
f({
|
|
5269
5385
|
id: "ascii",
|
|
5270
5386
|
name: "ASCII",
|
|
@@ -5276,7 +5392,7 @@ f({
|
|
|
5276
5392
|
const e = typeof s.size == "number" ? s.size : 8;
|
|
5277
5393
|
let t = s.color;
|
|
5278
5394
|
typeof t == "string" && t.startsWith("#") && (t = parseInt(t.replace("#", "0x"), 16));
|
|
5279
|
-
const i = s.replaceColor === !0, r = new
|
|
5395
|
+
const i = s.replaceColor === !0, r = new Ft({
|
|
5280
5396
|
size: e,
|
|
5281
5397
|
color: t,
|
|
5282
5398
|
replaceColor: i
|
|
@@ -5343,7 +5459,7 @@ f({
|
|
|
5343
5459
|
}
|
|
5344
5460
|
]
|
|
5345
5461
|
});
|
|
5346
|
-
const
|
|
5462
|
+
const At = g.BackdropBlurFilter;
|
|
5347
5463
|
f({
|
|
5348
5464
|
id: "backdrop-blur",
|
|
5349
5465
|
name: "Backdrop Blur",
|
|
@@ -5352,7 +5468,7 @@ f({
|
|
|
5352
5468
|
// Create an instance of the BackdropBlurFilter with the provided parameters
|
|
5353
5469
|
createFilter: (s) => {
|
|
5354
5470
|
try {
|
|
5355
|
-
const e = new
|
|
5471
|
+
const e = new At({
|
|
5356
5472
|
// Higher strength values (20-50) make the effect more noticeable
|
|
5357
5473
|
strength: s.strength || 20,
|
|
5358
5474
|
quality: s.quality || 4,
|
|
@@ -5450,7 +5566,7 @@ f({
|
|
|
5450
5566
|
}
|
|
5451
5567
|
]
|
|
5452
5568
|
});
|
|
5453
|
-
const { BevelFilter:
|
|
5569
|
+
const { BevelFilter: zt } = g;
|
|
5454
5570
|
f({
|
|
5455
5571
|
id: "bevel",
|
|
5456
5572
|
name: "Bevel",
|
|
@@ -5462,7 +5578,7 @@ f({
|
|
|
5462
5578
|
*/
|
|
5463
5579
|
createFilter: (s) => {
|
|
5464
5580
|
try {
|
|
5465
|
-
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new
|
|
5581
|
+
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new zt({
|
|
5466
5582
|
rotation: s.rotation !== void 0 ? s.rotation : 45,
|
|
5467
5583
|
thickness: s.thickness !== void 0 ? s.thickness : 2,
|
|
5468
5584
|
lightColor: parseInt(e, 16),
|
|
@@ -5578,7 +5694,7 @@ f({
|
|
|
5578
5694
|
}
|
|
5579
5695
|
]
|
|
5580
5696
|
});
|
|
5581
|
-
const { BloomFilter:
|
|
5697
|
+
const { BloomFilter: Rt } = g;
|
|
5582
5698
|
f({
|
|
5583
5699
|
id: "bloom",
|
|
5584
5700
|
name: "Bloom/Glow",
|
|
@@ -5587,7 +5703,7 @@ f({
|
|
|
5587
5703
|
// Create an instance of the BloomFilter with the provided parameters
|
|
5588
5704
|
createFilter: (s) => {
|
|
5589
5705
|
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
|
|
5706
|
+
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
5707
|
strength: {
|
|
5592
5708
|
x: Number(e),
|
|
5593
5709
|
y: Number(t)
|
|
@@ -5690,7 +5806,7 @@ f({
|
|
|
5690
5806
|
}
|
|
5691
5807
|
]
|
|
5692
5808
|
});
|
|
5693
|
-
const { BulgePinchFilter:
|
|
5809
|
+
const { BulgePinchFilter: Nt } = g;
|
|
5694
5810
|
f({
|
|
5695
5811
|
id: "bulge-pinch",
|
|
5696
5812
|
// ID must match what the application expects
|
|
@@ -5700,7 +5816,7 @@ f({
|
|
|
5700
5816
|
// Create an instance of the BulgePinchFilter with the provided parameters
|
|
5701
5817
|
createFilter: (s) => {
|
|
5702
5818
|
try {
|
|
5703
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new
|
|
5819
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new Nt({
|
|
5704
5820
|
center: {
|
|
5705
5821
|
x: e,
|
|
5706
5822
|
y: t
|
|
@@ -5782,7 +5898,7 @@ f({
|
|
|
5782
5898
|
}
|
|
5783
5899
|
]
|
|
5784
5900
|
});
|
|
5785
|
-
const { ConvolutionFilter:
|
|
5901
|
+
const { ConvolutionFilter: Tt } = g, E = {
|
|
5786
5902
|
normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
|
|
5787
5903
|
gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
|
|
5788
5904
|
boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
|
|
@@ -5817,7 +5933,7 @@ f({
|
|
|
5817
5933
|
const i = s.preset;
|
|
5818
5934
|
e = E[i] || E.normal;
|
|
5819
5935
|
}
|
|
5820
|
-
const t = new
|
|
5936
|
+
const t = new Tt(e, s.width || 200, s.height || 200);
|
|
5821
5937
|
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
5822
5938
|
const a = this._customParams || {};
|
|
5823
5939
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -6028,7 +6144,7 @@ f({
|
|
|
6028
6144
|
}
|
|
6029
6145
|
]
|
|
6030
6146
|
});
|
|
6031
|
-
const { CrossHatchFilter:
|
|
6147
|
+
const { CrossHatchFilter: It } = g;
|
|
6032
6148
|
f({
|
|
6033
6149
|
id: "cross-hatch",
|
|
6034
6150
|
name: "Cross Hatch",
|
|
@@ -6038,7 +6154,7 @@ f({
|
|
|
6038
6154
|
// Note: CrossHatchFilter has NO parameters according to PixiJS examples
|
|
6039
6155
|
createFilter: (s) => {
|
|
6040
6156
|
try {
|
|
6041
|
-
const e = new
|
|
6157
|
+
const e = new It();
|
|
6042
6158
|
return e.updateUIParam = function(t, i) {
|
|
6043
6159
|
return !0;
|
|
6044
6160
|
}, e;
|
|
@@ -6235,7 +6351,7 @@ f({
|
|
|
6235
6351
|
}
|
|
6236
6352
|
]
|
|
6237
6353
|
});
|
|
6238
|
-
const
|
|
6354
|
+
const Et = w.DisplacementFilter, Xt = w.Sprite, $ = w.Texture;
|
|
6239
6355
|
f({
|
|
6240
6356
|
id: "displacement",
|
|
6241
6357
|
// ID must match what the application expects
|
|
@@ -6248,7 +6364,7 @@ f({
|
|
|
6248
6364
|
const e = s.mapTexture || "/assets/images/displacement_map.png";
|
|
6249
6365
|
let t;
|
|
6250
6366
|
try {
|
|
6251
|
-
t =
|
|
6367
|
+
t = $.from(e), t.source.addressMode = "repeat";
|
|
6252
6368
|
} catch {
|
|
6253
6369
|
const o = document.createElement("canvas");
|
|
6254
6370
|
o.width = 256, o.height = 256;
|
|
@@ -6259,9 +6375,9 @@ f({
|
|
|
6259
6375
|
for (let c = 0; c < 10; c++)
|
|
6260
6376
|
(l + c) % 2 === 0 && n.fillRect(l * 25, c * 25, 25, 25);
|
|
6261
6377
|
}
|
|
6262
|
-
t =
|
|
6378
|
+
t = $.from(o);
|
|
6263
6379
|
}
|
|
6264
|
-
const i = new
|
|
6380
|
+
const i = new Xt(t), r = new Et(i, s.scale || 50);
|
|
6265
6381
|
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
6382
|
const n = this._customParams || {};
|
|
6267
6383
|
switch (this._customParams = n, n[a] = o, a) {
|
|
@@ -6275,7 +6391,7 @@ f({
|
|
|
6275
6391
|
try {
|
|
6276
6392
|
const l = this._displacementSprite;
|
|
6277
6393
|
if (l) {
|
|
6278
|
-
const c =
|
|
6394
|
+
const c = $.from(o);
|
|
6279
6395
|
c.source.addressMode = "repeat", l.texture = c;
|
|
6280
6396
|
}
|
|
6281
6397
|
} catch {
|
|
@@ -6408,7 +6524,7 @@ f({
|
|
|
6408
6524
|
}
|
|
6409
6525
|
]
|
|
6410
6526
|
});
|
|
6411
|
-
const { EmbossFilter:
|
|
6527
|
+
const { EmbossFilter: Yt } = g;
|
|
6412
6528
|
f({
|
|
6413
6529
|
id: "emboss",
|
|
6414
6530
|
name: "Emboss",
|
|
@@ -6417,7 +6533,7 @@ f({
|
|
|
6417
6533
|
// Create an instance of the Emboss filter with the provided parameters
|
|
6418
6534
|
createFilter: (s) => {
|
|
6419
6535
|
try {
|
|
6420
|
-
const e = typeof s.strength == "number" ? s.strength : 5, t = new
|
|
6536
|
+
const e = typeof s.strength == "number" ? s.strength : 5, t = new Yt(e);
|
|
6421
6537
|
return t._customParams = {
|
|
6422
6538
|
strength: e
|
|
6423
6539
|
}, t.updateUIParam = function(i, r) {
|
|
@@ -6457,7 +6573,7 @@ f({
|
|
|
6457
6573
|
}
|
|
6458
6574
|
]
|
|
6459
6575
|
});
|
|
6460
|
-
const { GlitchFilter:
|
|
6576
|
+
const { GlitchFilter: Bt } = g, R = {
|
|
6461
6577
|
TRANSPARENT: 0,
|
|
6462
6578
|
ORIGINAL: 1,
|
|
6463
6579
|
LOOP: 2,
|
|
@@ -6471,7 +6587,7 @@ f({
|
|
|
6471
6587
|
description: "Apply digital distortion and glitch effects",
|
|
6472
6588
|
createFilter: (s) => {
|
|
6473
6589
|
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
|
|
6590
|
+
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
6591
|
slices: s.slices,
|
|
6476
6592
|
offset: s.offset,
|
|
6477
6593
|
direction: s.direction,
|
|
@@ -6549,7 +6665,7 @@ f({
|
|
|
6549
6665
|
slices: 10,
|
|
6550
6666
|
offset: 100,
|
|
6551
6667
|
direction: 0,
|
|
6552
|
-
fillMode:
|
|
6668
|
+
fillMode: R.LOOP,
|
|
6553
6669
|
// LOOP mode looks better for the demo
|
|
6554
6670
|
seed: 0.5,
|
|
6555
6671
|
average: !1,
|
|
@@ -6612,13 +6728,13 @@ f({
|
|
|
6612
6728
|
label: "Fill Mode",
|
|
6613
6729
|
property: "fillMode",
|
|
6614
6730
|
options: [
|
|
6615
|
-
{ value:
|
|
6616
|
-
{ value:
|
|
6617
|
-
{ value:
|
|
6618
|
-
{ value:
|
|
6619
|
-
{ value:
|
|
6731
|
+
{ value: R.TRANSPARENT, label: "Transparent" },
|
|
6732
|
+
{ value: R.ORIGINAL, label: "Original" },
|
|
6733
|
+
{ value: R.LOOP, label: "Loop" },
|
|
6734
|
+
{ value: R.CLAMP, label: "Clamp" },
|
|
6735
|
+
{ value: R.MIRROR, label: "Mirror" }
|
|
6620
6736
|
],
|
|
6621
|
-
default:
|
|
6737
|
+
default: R.LOOP
|
|
6622
6738
|
},
|
|
6623
6739
|
{
|
|
6624
6740
|
id: "seed",
|
|
@@ -6712,7 +6828,7 @@ f({
|
|
|
6712
6828
|
}
|
|
6713
6829
|
]
|
|
6714
6830
|
});
|
|
6715
|
-
const { GlowFilter:
|
|
6831
|
+
const { GlowFilter: Ot } = g;
|
|
6716
6832
|
f({
|
|
6717
6833
|
id: "glow",
|
|
6718
6834
|
name: "Glow",
|
|
@@ -6721,7 +6837,7 @@ f({
|
|
|
6721
6837
|
// Create an instance of the GlowFilter with the provided parameters
|
|
6722
6838
|
createFilter: (s) => {
|
|
6723
6839
|
try {
|
|
6724
|
-
const e = parseInt(s.color.replace("#", "0x"), 16), t = new
|
|
6840
|
+
const e = parseInt(s.color.replace("#", "0x"), 16), t = new Ot({
|
|
6725
6841
|
distance: s.distance || 10,
|
|
6726
6842
|
outerStrength: s.outerStrength || 4,
|
|
6727
6843
|
innerStrength: s.innerStrength || 0,
|
|
@@ -6847,7 +6963,7 @@ f({
|
|
|
6847
6963
|
}
|
|
6848
6964
|
]
|
|
6849
6965
|
});
|
|
6850
|
-
const { GodrayFilter:
|
|
6966
|
+
const { GodrayFilter: Lt } = g;
|
|
6851
6967
|
f({
|
|
6852
6968
|
id: "godray",
|
|
6853
6969
|
name: "Godray",
|
|
@@ -6856,7 +6972,7 @@ f({
|
|
|
6856
6972
|
// Create an instance of the GodrayFilter with the provided parameters
|
|
6857
6973
|
createFilter: (s) => {
|
|
6858
6974
|
try {
|
|
6859
|
-
const e = new
|
|
6975
|
+
const e = new Lt({
|
|
6860
6976
|
angle: s.angle || 30,
|
|
6861
6977
|
parallel: s.parallel ?? !0,
|
|
6862
6978
|
center: {
|
|
@@ -7009,7 +7125,7 @@ f({
|
|
|
7009
7125
|
}
|
|
7010
7126
|
]
|
|
7011
7127
|
});
|
|
7012
|
-
const
|
|
7128
|
+
const Dt = g.SimpleLightmapFilter, ae = w.Texture;
|
|
7013
7129
|
f({
|
|
7014
7130
|
id: "lightmap",
|
|
7015
7131
|
name: "Lightmap",
|
|
@@ -7034,14 +7150,14 @@ f({
|
|
|
7034
7150
|
const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7035
7151
|
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
7152
|
}
|
|
7037
|
-
const o =
|
|
7153
|
+
const o = ae.from(r);
|
|
7038
7154
|
let n;
|
|
7039
7155
|
try {
|
|
7040
7156
|
typeof t == "string" && t.startsWith("#") ? n = parseInt(t.replace("#", "0x"), 16) : n = 0;
|
|
7041
7157
|
} catch {
|
|
7042
7158
|
n = 0;
|
|
7043
7159
|
}
|
|
7044
|
-
const l = new
|
|
7160
|
+
const l = new Dt(o, n, i);
|
|
7045
7161
|
return l._customParams = {
|
|
7046
7162
|
textureType: e,
|
|
7047
7163
|
color: t,
|
|
@@ -7067,7 +7183,7 @@ f({
|
|
|
7067
7183
|
const b = m.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7068
7184
|
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
7185
|
}
|
|
7070
|
-
const C =
|
|
7186
|
+
const C = ae.from(p);
|
|
7071
7187
|
if (this.lightMap = C, this.enabled !== void 0) {
|
|
7072
7188
|
const b = this.enabled;
|
|
7073
7189
|
this.enabled = !1, setTimeout(() => {
|
|
@@ -7140,7 +7256,7 @@ f({
|
|
|
7140
7256
|
}
|
|
7141
7257
|
]
|
|
7142
7258
|
});
|
|
7143
|
-
const { NoiseFilter:
|
|
7259
|
+
const { NoiseFilter: Ut } = w;
|
|
7144
7260
|
f({
|
|
7145
7261
|
id: "noise",
|
|
7146
7262
|
name: "Noise",
|
|
@@ -7148,7 +7264,7 @@ f({
|
|
|
7148
7264
|
description: "Add random noise to the image",
|
|
7149
7265
|
createFilter: (s) => {
|
|
7150
7266
|
try {
|
|
7151
|
-
const e = new
|
|
7267
|
+
const e = new Ut({
|
|
7152
7268
|
noise: s.noise || 0.5,
|
|
7153
7269
|
seed: s.seed || Math.random()
|
|
7154
7270
|
});
|
|
@@ -7225,7 +7341,7 @@ f({
|
|
|
7225
7341
|
}
|
|
7226
7342
|
]
|
|
7227
7343
|
});
|
|
7228
|
-
const { OldFilmFilter:
|
|
7344
|
+
const { OldFilmFilter: Vt } = g;
|
|
7229
7345
|
f({
|
|
7230
7346
|
id: "old-film",
|
|
7231
7347
|
name: "Old Film",
|
|
@@ -7233,7 +7349,7 @@ f({
|
|
|
7233
7349
|
description: "Apply a vintage film effect with scratches and grain",
|
|
7234
7350
|
createFilter: (s) => {
|
|
7235
7351
|
try {
|
|
7236
|
-
const e = new
|
|
7352
|
+
const e = new Vt({
|
|
7237
7353
|
sepia: s.sepia,
|
|
7238
7354
|
noise: s.noise,
|
|
7239
7355
|
noiseSize: s.noiseSize,
|
|
@@ -7414,7 +7530,7 @@ f({
|
|
|
7414
7530
|
}
|
|
7415
7531
|
]
|
|
7416
7532
|
});
|
|
7417
|
-
const { OutlineFilter:
|
|
7533
|
+
const { OutlineFilter: jt } = g;
|
|
7418
7534
|
f({
|
|
7419
7535
|
id: "outline",
|
|
7420
7536
|
name: "Outline",
|
|
@@ -7424,7 +7540,7 @@ f({
|
|
|
7424
7540
|
try {
|
|
7425
7541
|
let e = s.color;
|
|
7426
7542
|
typeof e == "string" && (e = parseInt(e.replace("#", "0x"), 16));
|
|
7427
|
-
const t = new
|
|
7543
|
+
const t = new jt({
|
|
7428
7544
|
thickness: s.thickness || 4,
|
|
7429
7545
|
color: e,
|
|
7430
7546
|
alpha: s.alpha || 1,
|
|
@@ -7514,7 +7630,7 @@ f({
|
|
|
7514
7630
|
}
|
|
7515
7631
|
]
|
|
7516
7632
|
});
|
|
7517
|
-
const { PixelateFilter:
|
|
7633
|
+
const { PixelateFilter: qt } = g;
|
|
7518
7634
|
f({
|
|
7519
7635
|
id: "pixelate",
|
|
7520
7636
|
name: "Pixelate",
|
|
@@ -7522,7 +7638,7 @@ f({
|
|
|
7522
7638
|
description: "Create a pixelated or mosaic effect",
|
|
7523
7639
|
createFilter: (s) => {
|
|
7524
7640
|
try {
|
|
7525
|
-
const e = new
|
|
7641
|
+
const e = new qt(
|
|
7526
7642
|
s.useUniform ? Math.max(4, s.size || 10) : [Math.max(4, s.sizeX || 10), Math.max(4, s.sizeY || 10)]
|
|
7527
7643
|
);
|
|
7528
7644
|
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
@@ -7605,7 +7721,7 @@ f({
|
|
|
7605
7721
|
}
|
|
7606
7722
|
]
|
|
7607
7723
|
});
|
|
7608
|
-
const { ReflectionFilter:
|
|
7724
|
+
const { ReflectionFilter: Ht } = g;
|
|
7609
7725
|
f({
|
|
7610
7726
|
id: "reflection",
|
|
7611
7727
|
// ID must match what the application expects
|
|
@@ -7622,7 +7738,7 @@ f({
|
|
|
7622
7738
|
waveLength: new Float32Array([s.wavelengthStart ?? 30, s.wavelengthEnd ?? 100]),
|
|
7623
7739
|
alpha: new Float32Array([s.alphaStart ?? 1, s.alphaEnd ?? 1]),
|
|
7624
7740
|
time: s.time ?? 0
|
|
7625
|
-
}, t = new
|
|
7741
|
+
}, t = new Ht(e);
|
|
7626
7742
|
return t._customParams = { ...s }, t.animating = s.animating ?? !1, t.updateUIParam = function(i, r) {
|
|
7627
7743
|
const a = this._customParams || {};
|
|
7628
7744
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -7773,7 +7889,7 @@ f({
|
|
|
7773
7889
|
}
|
|
7774
7890
|
]
|
|
7775
7891
|
});
|
|
7776
|
-
const { ShockwaveFilter:
|
|
7892
|
+
const { ShockwaveFilter: $t } = g;
|
|
7777
7893
|
f({
|
|
7778
7894
|
id: "shockwave",
|
|
7779
7895
|
// ID must match what the application expects
|
|
@@ -7783,7 +7899,7 @@ f({
|
|
|
7783
7899
|
// Create an instance of the ShockwaveFilter with the provided parameters
|
|
7784
7900
|
createFilter: (s) => {
|
|
7785
7901
|
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
|
|
7902
|
+
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
7903
|
center: i,
|
|
7788
7904
|
amplitude: r,
|
|
7789
7905
|
wavelength: a,
|
|
@@ -7925,7 +8041,7 @@ f({
|
|
|
7925
8041
|
}
|
|
7926
8042
|
]
|
|
7927
8043
|
});
|
|
7928
|
-
const { SimplexNoiseFilter:
|
|
8044
|
+
const { SimplexNoiseFilter: Wt } = g;
|
|
7929
8045
|
f({
|
|
7930
8046
|
id: "simplex-noise",
|
|
7931
8047
|
name: "Simplex Noise",
|
|
@@ -7933,7 +8049,7 @@ f({
|
|
|
7933
8049
|
description: "Apply procedural noise to create texture effects",
|
|
7934
8050
|
createFilter: (s) => {
|
|
7935
8051
|
try {
|
|
7936
|
-
const e = s.animating ? 0 : s.offsetZ || 0, t = new
|
|
8052
|
+
const e = s.animating ? 0 : s.offsetZ || 0, t = new Wt({
|
|
7937
8053
|
strength: s.strength,
|
|
7938
8054
|
noiseScale: s.noiseScale,
|
|
7939
8055
|
offsetX: s.offsetX,
|
|
@@ -8080,9 +8196,9 @@ f({
|
|
|
8080
8196
|
}
|
|
8081
8197
|
]
|
|
8082
8198
|
});
|
|
8083
|
-
class
|
|
8199
|
+
class Zt extends w.Filter {
|
|
8084
8200
|
constructor(e) {
|
|
8085
|
-
const t =
|
|
8201
|
+
const t = Ce.from({
|
|
8086
8202
|
vertex: `
|
|
8087
8203
|
attribute vec2 aPosition;
|
|
8088
8204
|
varying vec2 vTextureCoord;
|
|
@@ -8191,7 +8307,7 @@ f({
|
|
|
8191
8307
|
description: "Creates a twisting distortion effect around a central point",
|
|
8192
8308
|
createFilter: (s) => {
|
|
8193
8309
|
try {
|
|
8194
|
-
const e = new
|
|
8310
|
+
const e = new Zt({
|
|
8195
8311
|
centerX: s.centerX ?? 0.5,
|
|
8196
8312
|
centerY: s.centerY ?? 0.5,
|
|
8197
8313
|
radius: s.radius ?? 0.25,
|
|
@@ -8261,7 +8377,7 @@ f({
|
|
|
8261
8377
|
}
|
|
8262
8378
|
]
|
|
8263
8379
|
});
|
|
8264
|
-
const { AdjustmentFilter:
|
|
8380
|
+
const { AdjustmentFilter: Gt } = g;
|
|
8265
8381
|
function D(s) {
|
|
8266
8382
|
const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
|
|
8267
8383
|
return [
|
|
@@ -8270,7 +8386,7 @@ function D(s) {
|
|
|
8270
8386
|
(e & 255) / 255
|
|
8271
8387
|
];
|
|
8272
8388
|
}
|
|
8273
|
-
class
|
|
8389
|
+
class Kt extends Gt {
|
|
8274
8390
|
constructor(e = {}) {
|
|
8275
8391
|
super({
|
|
8276
8392
|
brightness: 1,
|
|
@@ -8313,7 +8429,7 @@ f({
|
|
|
8313
8429
|
description: "Add a classic darkened border effect to the image",
|
|
8314
8430
|
createFilter: (s) => {
|
|
8315
8431
|
try {
|
|
8316
|
-
const e = new
|
|
8432
|
+
const e = new Kt({
|
|
8317
8433
|
radius: s.radius || 0.8,
|
|
8318
8434
|
strength: s.strength || 1,
|
|
8319
8435
|
color: s.color || "#000000"
|
|
@@ -8377,22 +8493,22 @@ f({
|
|
|
8377
8493
|
}
|
|
8378
8494
|
]
|
|
8379
8495
|
});
|
|
8380
|
-
function
|
|
8496
|
+
function ri(s) {
|
|
8381
8497
|
try {
|
|
8382
8498
|
let e = [], t = [];
|
|
8383
8499
|
try {
|
|
8384
|
-
e = U(), e.length === 0 &&
|
|
8500
|
+
e = U(), e.length === 0 && rt();
|
|
8385
8501
|
} catch {
|
|
8386
8502
|
}
|
|
8387
8503
|
const i = s == null ? void 0 : s.disabled;
|
|
8388
8504
|
if (Array.isArray(i) && i.length > 0) {
|
|
8389
8505
|
let r = 0;
|
|
8390
8506
|
for (const a of i)
|
|
8391
|
-
|
|
8507
|
+
ot(a) && r++;
|
|
8392
8508
|
r > 0;
|
|
8393
8509
|
}
|
|
8394
8510
|
try {
|
|
8395
|
-
e = U(), t =
|
|
8511
|
+
e = U(), t = at();
|
|
8396
8512
|
} catch {
|
|
8397
8513
|
e || (e = []), t || (t = []);
|
|
8398
8514
|
}
|
|
@@ -8402,16 +8518,16 @@ function Jt(s) {
|
|
|
8402
8518
|
}
|
|
8403
8519
|
}
|
|
8404
8520
|
export {
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8521
|
+
ei as V,
|
|
8522
|
+
it as a,
|
|
8523
|
+
st as b,
|
|
8524
|
+
at as c,
|
|
8525
|
+
rt as d,
|
|
8526
|
+
ii as e,
|
|
8527
|
+
nt as f,
|
|
8412
8528
|
U as g,
|
|
8413
|
-
|
|
8414
|
-
|
|
8529
|
+
ti as h,
|
|
8530
|
+
ri as i,
|
|
8415
8531
|
f as r
|
|
8416
8532
|
};
|
|
8417
|
-
//# sourceMappingURL=editor-
|
|
8533
|
+
//# sourceMappingURL=editor-DiiyShiW.js.map
|