@codingfactory/mediables-vue 2.3.5 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PixiFrameExporter-DcQaIUle.js → PixiFrameExporter-D8dt-5Oj.js} +2 -2
- package/dist/{PixiFrameExporter-DcQaIUle.js.map → PixiFrameExporter-D8dt-5Oj.js.map} +1 -1
- package/dist/{PixiFrameExporter-D2kWTTVT.cjs → PixiFrameExporter-rWh-JQub.cjs} +2 -2
- package/dist/{PixiFrameExporter-D2kWTTVT.cjs.map → PixiFrameExporter-rWh-JQub.cjs.map} +1 -1
- package/dist/components/ImageEditorModal.vue.d.ts +4 -2
- package/dist/composables/useImageEditorModal.d.ts +288 -16
- package/dist/composables/useRadialMenu.d.ts +1 -1
- package/dist/{editor-BgjKZltI.js → editor-624YYYUE.js} +547 -432
- package/dist/editor-624YYYUE.js.map +1 -0
- package/dist/editor-BU3jmGLs.cjs +42 -0
- package/dist/editor-BU3jmGLs.cjs.map +1 -0
- package/dist/{index-BDB5R5H_.js → index-Bwmk8LYJ.js} +7717 -7554
- package/dist/index-Bwmk8LYJ.js.map +1 -0
- package/dist/index-PyOrcGKi.cjs +342 -0
- package/dist/index-PyOrcGKi.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/mediables-vanilla.cjs +1 -1
- package/dist/mediables-vanilla.mjs +1 -1
- package/dist/mediables-vue.cjs +1 -1
- package/dist/mediables-vue.mjs +59 -52
- package/dist/style.css +1 -1
- package/dist/types/editor.d.ts +87 -2
- package/dist/utils/imageEditorState.d.ts +26 -0
- package/package.json +1 -1
- package/dist/editor-BgjKZltI.js.map +0 -1
- package/dist/editor-C4OKTznp.cjs +0 -42
- package/dist/editor-C4OKTznp.cjs.map +0 -1
- package/dist/index-BDB5R5H_.js.map +0 -1
- package/dist/index-DuQmNimD.cjs +0 -342
- package/dist/index-DuQmNimD.cjs.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
|
}
|
|
@@ -262,7 +291,7 @@ class xe extends B {
|
|
|
262
291
|
* @param {string} imageUrl - URL, data URL, or blob URL of the image
|
|
263
292
|
*/
|
|
264
293
|
async loadTexture(e) {
|
|
265
|
-
var l, c,
|
|
294
|
+
var l, c, u;
|
|
266
295
|
if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return;
|
|
267
296
|
const t = window.PIXI, i = await this._loadImageElement(e);
|
|
268
297
|
if (!i || !((c = this.app) != null && c.renderer)) return;
|
|
@@ -271,7 +300,7 @@ class xe extends B {
|
|
|
271
300
|
return;
|
|
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), !((
|
|
303
|
+
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((u = this.app) != null && u.renderer)) return;
|
|
275
304
|
const n = this.getFitScaleFor(r);
|
|
276
305
|
Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height });
|
|
277
306
|
}
|
|
@@ -290,16 +319,23 @@ class xe extends B {
|
|
|
290
319
|
const a = window.PIXI, o = Math.round(this.originalTexture.width), n = Math.round(this.originalTexture.height);
|
|
291
320
|
if (o <= 0 || n <= 0)
|
|
292
321
|
return null;
|
|
293
|
-
let l = o
|
|
322
|
+
let l = o;
|
|
294
323
|
if (i > 0) {
|
|
295
324
|
const _ = Math.max(o, n);
|
|
296
325
|
let v = i / _;
|
|
297
|
-
r && (v = Math.min(1, v)), l = Math.round(o * v)
|
|
326
|
+
r && (v = Math.min(1, v)), l = Math.round(o * v);
|
|
298
327
|
}
|
|
299
|
-
const
|
|
328
|
+
const c = this.sprite, u = c.x, h = c.y, p = c.width, m = c.height;
|
|
329
|
+
if (p <= 0 || m <= 0)
|
|
330
|
+
return null;
|
|
331
|
+
const C = l / p;
|
|
300
332
|
let b = null;
|
|
301
333
|
try {
|
|
302
|
-
if (
|
|
334
|
+
if (c.x = 0, c.y = 0, b = a.RenderTexture.create({
|
|
335
|
+
width: Math.ceil(p),
|
|
336
|
+
height: Math.ceil(m),
|
|
337
|
+
resolution: C
|
|
338
|
+
}), this.app.renderer.render({ container: this.app.stage, target: b }), !this.app.renderer.extract)
|
|
303
339
|
return null;
|
|
304
340
|
const _ = this.app.renderer.extract.canvas(b);
|
|
305
341
|
if (!_)
|
|
@@ -308,18 +344,41 @@ class xe extends B {
|
|
|
308
344
|
if (typeof _.toDataURL == "function")
|
|
309
345
|
v = _.toDataURL(`image/${e}`, t);
|
|
310
346
|
else if (typeof _.getContext == "function") {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
const O =
|
|
314
|
-
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));
|
|
315
351
|
}
|
|
316
352
|
return v || null;
|
|
317
353
|
} catch {
|
|
318
354
|
return null;
|
|
319
355
|
} finally {
|
|
320
|
-
|
|
356
|
+
c.x = u, c.y = h, b && b.destroy(!0);
|
|
321
357
|
}
|
|
322
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
|
+
}
|
|
323
382
|
/**
|
|
324
383
|
* Resize renderer to container
|
|
325
384
|
* @param {HTMLElement} container
|
|
@@ -372,7 +431,7 @@ class xe extends B {
|
|
|
372
431
|
this.sprite = null, this.originalTexture = null, this.baseTexture = null, this._container = null, this.removeAllListeners();
|
|
373
432
|
}
|
|
374
433
|
}
|
|
375
|
-
const
|
|
434
|
+
const ke = {
|
|
376
435
|
adjust: ["adjust", "advanced"],
|
|
377
436
|
// adjustment, adjustmentAdvanced, alpha, colorMatrix
|
|
378
437
|
blur: ["blur"],
|
|
@@ -388,7 +447,7 @@ const Ce = {
|
|
|
388
447
|
stylize: ["stylize"]
|
|
389
448
|
// ascii, crt, crossHatch, dot, emboss
|
|
390
449
|
};
|
|
391
|
-
class
|
|
450
|
+
class Pe extends B {
|
|
392
451
|
constructor(e, t) {
|
|
393
452
|
super(), this.state = e, this.renderer = t, this.instances = {}, this._filterRegistry = null;
|
|
394
453
|
}
|
|
@@ -423,7 +482,7 @@ class we extends B {
|
|
|
423
482
|
*/
|
|
424
483
|
getFiltersByCategory(e) {
|
|
425
484
|
if (!this._filterRegistry) return [];
|
|
426
|
-
const t =
|
|
485
|
+
const t = ke[e] || [e], i = [], r = /* @__PURE__ */ new Set();
|
|
427
486
|
for (const a of t) {
|
|
428
487
|
const o = this._filterRegistry.getFiltersByCategory(a) || [];
|
|
429
488
|
for (const n of o)
|
|
@@ -524,9 +583,9 @@ class we extends B {
|
|
|
524
583
|
if (!o || !o.createFilter || typeof o.createFilter != "function")
|
|
525
584
|
return;
|
|
526
585
|
const n = this.state.getFilterValues(a), l = o.defaultParams ? { ...o.defaultParams } : {};
|
|
527
|
-
o.controls && Array.isArray(o.controls) && o.controls.forEach((
|
|
528
|
-
const h =
|
|
529
|
-
l[h] = n[
|
|
586
|
+
o.controls && Array.isArray(o.controls) && o.controls.forEach((u) => {
|
|
587
|
+
const h = u.property || u.id;
|
|
588
|
+
l[h] = n[u.id] ?? u.default;
|
|
530
589
|
});
|
|
531
590
|
const c = o.createFilter(l);
|
|
532
591
|
c && (t.push(c), this.instances[a] = c);
|
|
@@ -546,18 +605,15 @@ class we extends B {
|
|
|
546
605
|
i.length > 0;
|
|
547
606
|
}
|
|
548
607
|
/**
|
|
549
|
-
* 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.
|
|
550
612
|
*/
|
|
551
613
|
resetAll() {
|
|
552
614
|
for (const e in this.instances)
|
|
553
615
|
delete this.instances[e];
|
|
554
|
-
|
|
555
|
-
const e = window.PIXI;
|
|
556
|
-
this.renderer.originalTexture = this.renderer.baseTexture, this.renderer.app.stage.removeChild(this.renderer.sprite), this.renderer.sprite.destroy();
|
|
557
|
-
const t = new e.Sprite(this.renderer.originalTexture);
|
|
558
|
-
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();
|
|
559
|
-
}
|
|
560
|
-
this.renderer.render(), this.emit("filtersReset");
|
|
616
|
+
this.state.resetFilters(), this.renderer.sprite && (this.renderer.sprite.filters = null), this.renderer.render(), this.emit("filtersReset");
|
|
561
617
|
}
|
|
562
618
|
/**
|
|
563
619
|
* Get a filter instance
|
|
@@ -645,14 +701,14 @@ const T = class T extends B {
|
|
|
645
701
|
if (!e || !r || !a || !o) return null;
|
|
646
702
|
const l = e.width > t, c = e.height > i;
|
|
647
703
|
if (!l && !c) return null;
|
|
648
|
-
const
|
|
704
|
+
const u = T.AUTO_ZOOM_PADDING;
|
|
649
705
|
let h = n;
|
|
650
706
|
if (l) {
|
|
651
|
-
const p = e.width / (
|
|
707
|
+
const p = e.width / (u * r * o);
|
|
652
708
|
h = Math.min(h, p);
|
|
653
709
|
}
|
|
654
710
|
if (c) {
|
|
655
|
-
const p = e.height / (
|
|
711
|
+
const p = e.height / (u * a * o);
|
|
656
712
|
h = Math.min(h, p);
|
|
657
713
|
}
|
|
658
714
|
return h = Math.max(0.1, h), h >= n - 0.01 ? null : h;
|
|
@@ -696,8 +752,8 @@ const T = class T extends B {
|
|
|
696
752
|
if (!l) return;
|
|
697
753
|
const c = this.state.get("crop.shape");
|
|
698
754
|
if (n.save(), c === "circle") {
|
|
699
|
-
const y = l.x + l.width / 2,
|
|
700
|
-
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();
|
|
701
757
|
} else
|
|
702
758
|
n.beginPath(), n.rect(l.x, l.y, l.width, l.height), n.clip();
|
|
703
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(
|
|
@@ -707,9 +763,9 @@ const T = class T extends B {
|
|
|
707
763
|
0,
|
|
708
764
|
Math.PI * 2
|
|
709
765
|
), n.stroke()) : n.strokeRect(l.x, l.y, l.width, l.height), n.setLineDash([]), n.strokeStyle = "rgba(255,255,255,0.3)", n.lineWidth = 1;
|
|
710
|
-
const
|
|
766
|
+
const u = l.width / 3, h = l.height / 3;
|
|
711
767
|
for (let y = 1; y <= 2; y++)
|
|
712
|
-
n.beginPath(), n.moveTo(l.x +
|
|
768
|
+
n.beginPath(), n.moveTo(l.x + u * y, l.y), n.lineTo(l.x + u * y, l.y + l.height), n.stroke(), n.beginPath(), n.moveTo(l.x, l.y + h * y), n.lineTo(l.x + l.width, l.y + h * y), n.stroke();
|
|
713
769
|
const p = this.HANDLE_SIZE, m = [
|
|
714
770
|
{ x: l.x, y: l.y, m: "resize-nw" },
|
|
715
771
|
{ x: l.x + l.width, y: l.y, m: "resize-ne" },
|
|
@@ -722,8 +778,8 @@ const T = class T extends B {
|
|
|
722
778
|
{ x: l.x + l.width, y: l.y + l.height / 2, m: "e" }
|
|
723
779
|
], b = [...m, ...C];
|
|
724
780
|
for (const y of b) {
|
|
725
|
-
const
|
|
726
|
-
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();
|
|
727
783
|
}
|
|
728
784
|
}
|
|
729
785
|
/**
|
|
@@ -751,12 +807,12 @@ const T = class T extends B {
|
|
|
751
807
|
* Handle pointer move event
|
|
752
808
|
*/
|
|
753
809
|
_handlePointerMove(e) {
|
|
754
|
-
var l, c,
|
|
810
|
+
var l, c, u, h;
|
|
755
811
|
const t = this.renderer.app;
|
|
756
812
|
if (!t) return;
|
|
757
813
|
const i = e.global;
|
|
758
814
|
if (!this._isDragging || !this._dragStart || !this._startRect) {
|
|
759
|
-
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (
|
|
815
|
+
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (u = this._hoverMode) != null && u.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
|
|
760
816
|
return;
|
|
761
817
|
}
|
|
762
818
|
const r = this.state.get("crop.rect");
|
|
@@ -833,15 +889,15 @@ const T = class T extends B {
|
|
|
833
889
|
apply() {
|
|
834
890
|
const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
|
|
835
891
|
if (!r || !t || !e || !i) return null;
|
|
836
|
-
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n,
|
|
837
|
-
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), C = Math.round(
|
|
892
|
+
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n, u = (r.y - t.y) * l;
|
|
893
|
+
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), C = Math.round(u);
|
|
838
894
|
if (h <= 0 || p <= 0) return null;
|
|
839
895
|
const b = new a.Container(), y = new a.Sprite(i);
|
|
840
896
|
if (this.state.get("crop.shape") === "circle") {
|
|
841
|
-
const
|
|
842
|
-
m = Math.round(
|
|
843
|
-
const
|
|
844
|
-
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);
|
|
845
901
|
}
|
|
846
902
|
y.x = -m, y.y = -C, b.addChild(y);
|
|
847
903
|
const _ = a.RenderTexture.create({ width: h, height: p });
|
|
@@ -849,9 +905,13 @@ const T = class T extends B {
|
|
|
849
905
|
container: b,
|
|
850
906
|
target: _,
|
|
851
907
|
clear: !0
|
|
852
|
-
}), b.destroy({ children: !0 })
|
|
853
|
-
const v =
|
|
854
|
-
|
|
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 };
|
|
855
915
|
}
|
|
856
916
|
/**
|
|
857
917
|
* Cancel crop
|
|
@@ -878,12 +938,12 @@ const T = class T extends B {
|
|
|
878
938
|
* Padding factor for auto-zoom: image will be ~91% of crop size (1/1.1).
|
|
879
939
|
* Higher values = more aggressive zoom-out, more padding around image.
|
|
880
940
|
*/
|
|
881
|
-
|
|
941
|
+
j(T, "AUTO_ZOOM_PADDING", 1.1), /**
|
|
882
942
|
* Minimum interval (ms) between auto-zoom adjustments during drag.
|
|
883
943
|
*/
|
|
884
|
-
|
|
885
|
-
let
|
|
886
|
-
class
|
|
944
|
+
j(T, "AUTO_ZOOM_THROTTLE_MS", 100);
|
|
945
|
+
let W = T;
|
|
946
|
+
class Me {
|
|
887
947
|
/**
|
|
888
948
|
* Create a new RemoveBgManager
|
|
889
949
|
* @param {Object} options
|
|
@@ -933,8 +993,8 @@ class Se {
|
|
|
933
993
|
if (!a.ok) {
|
|
934
994
|
let c = `Background removal failed (HTTP ${a.status})`;
|
|
935
995
|
try {
|
|
936
|
-
const
|
|
937
|
-
|
|
996
|
+
const u = await a.text();
|
|
997
|
+
u && (c += `: ${u}`);
|
|
938
998
|
} catch {
|
|
939
999
|
}
|
|
940
1000
|
throw new Error(c);
|
|
@@ -993,7 +1053,7 @@ class Se {
|
|
|
993
1053
|
}
|
|
994
1054
|
}
|
|
995
1055
|
}
|
|
996
|
-
function
|
|
1056
|
+
function d(s, e = {}, ...t) {
|
|
997
1057
|
const i = document.createElement(s);
|
|
998
1058
|
for (const [r, a] of Object.entries(e))
|
|
999
1059
|
if (a != null)
|
|
@@ -1009,17 +1069,17 @@ function u(s, e = {}, ...t) {
|
|
|
1009
1069
|
typeof r == "string" ? i.appendChild(document.createTextNode(r)) : r instanceof HTMLElement && i.appendChild(r);
|
|
1010
1070
|
return i;
|
|
1011
1071
|
}
|
|
1012
|
-
function
|
|
1013
|
-
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l =
|
|
1072
|
+
function oe({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
|
|
1073
|
+
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = d("div", {
|
|
1014
1074
|
className: "slider-control slider-wrapper",
|
|
1015
1075
|
"data-control": n,
|
|
1016
1076
|
"data-testid": `slider-${n}`
|
|
1017
|
-
}), c =
|
|
1077
|
+
}), c = d(
|
|
1018
1078
|
"div",
|
|
1019
1079
|
{ className: "slider-header" },
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
),
|
|
1080
|
+
d("label", { for: s, className: "slider-label" }, e),
|
|
1081
|
+
d("span", { className: "slider-value", id: `${s}-value` }, q(a))
|
|
1082
|
+
), u = d("input", {
|
|
1023
1083
|
type: "range",
|
|
1024
1084
|
id: s,
|
|
1025
1085
|
className: "slider-input",
|
|
@@ -1029,37 +1089,37 @@ function ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1029
1089
|
value: String(a),
|
|
1030
1090
|
onInput: (h) => {
|
|
1031
1091
|
const p = parseFloat(h.target.value), m = l.querySelector(".slider-value");
|
|
1032
|
-
m && (m.textContent =
|
|
1092
|
+
m && (m.textContent = q(p)), o == null || o(p);
|
|
1033
1093
|
}
|
|
1034
1094
|
});
|
|
1035
|
-
return l.appendChild(c), l.appendChild(
|
|
1036
|
-
|
|
1095
|
+
return l.appendChild(c), l.appendChild(u), l.setValue = (h) => {
|
|
1096
|
+
u.value = String(h);
|
|
1037
1097
|
const p = l.querySelector(".slider-value");
|
|
1038
|
-
p && (p.textContent =
|
|
1098
|
+
p && (p.textContent = q(h));
|
|
1039
1099
|
}, l;
|
|
1040
1100
|
}
|
|
1041
|
-
function
|
|
1101
|
+
function q(s) {
|
|
1042
1102
|
return Number.isInteger(s) ? String(s) : s.toFixed(2);
|
|
1043
1103
|
}
|
|
1044
|
-
function
|
|
1045
|
-
const r =
|
|
1104
|
+
function ne({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
1105
|
+
const r = d("div", { className: "toggle-control" }), a = d("label", { className: "toggle-label", for: s }, e), o = d("input", {
|
|
1046
1106
|
type: "checkbox",
|
|
1047
1107
|
id: s,
|
|
1048
1108
|
className: "toggle-input",
|
|
1049
1109
|
checked: t ? "checked" : void 0,
|
|
1050
1110
|
onChange: (c) => i == null ? void 0 : i(c.target.checked)
|
|
1051
|
-
}), n =
|
|
1111
|
+
}), n = d("div", {
|
|
1052
1112
|
className: "toggle-switch",
|
|
1053
1113
|
onClick: (c) => {
|
|
1054
1114
|
c.target !== o && (o.checked = !o.checked, i == null || i(o.checked));
|
|
1055
1115
|
}
|
|
1056
|
-
}), l =
|
|
1116
|
+
}), l = d("span", { className: "toggle-slider" });
|
|
1057
1117
|
return n.appendChild(o), n.appendChild(l), r.appendChild(a), r.appendChild(n), r.setChecked = (c) => {
|
|
1058
1118
|
o.checked = c;
|
|
1059
1119
|
}, r;
|
|
1060
1120
|
}
|
|
1061
|
-
function
|
|
1062
|
-
const r =
|
|
1121
|
+
function le({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
1122
|
+
const r = d("div", { className: "color-control" }), a = d("label", { className: "color-label", for: s }, e), o = d("input", {
|
|
1063
1123
|
type: "color",
|
|
1064
1124
|
id: s,
|
|
1065
1125
|
className: "color-input",
|
|
@@ -1070,29 +1130,29 @@ function ne({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
|
1070
1130
|
o.value = n;
|
|
1071
1131
|
}, r;
|
|
1072
1132
|
}
|
|
1073
|
-
function
|
|
1074
|
-
const a =
|
|
1133
|
+
function ce({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
1134
|
+
const a = d("div", { className: "select-control" }), o = d("label", { className: "select-label", for: s }, e), n = d("select", {
|
|
1075
1135
|
id: s,
|
|
1076
1136
|
className: "select-input",
|
|
1077
1137
|
onChange: (l) => r == null ? void 0 : r(l.target.value)
|
|
1078
1138
|
});
|
|
1079
1139
|
for (const l of t) {
|
|
1080
|
-
const c =
|
|
1140
|
+
const c = d("option", { value: l.value }, l.label);
|
|
1081
1141
|
l.value === i && (c.selected = !0), n.appendChild(c);
|
|
1082
1142
|
}
|
|
1083
1143
|
return a.appendChild(o), a.appendChild(n), a.setValue = (l) => {
|
|
1084
1144
|
n.value = l;
|
|
1085
1145
|
}, a;
|
|
1086
1146
|
}
|
|
1087
|
-
function
|
|
1088
|
-
const a =
|
|
1147
|
+
function F({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
|
|
1148
|
+
const a = d("button", {
|
|
1089
1149
|
type: "button",
|
|
1090
1150
|
className: `btn ${e}`.trim(),
|
|
1091
1151
|
onClick: t,
|
|
1092
1152
|
disabled: r ? "disabled" : void 0
|
|
1093
1153
|
});
|
|
1094
1154
|
if (i) {
|
|
1095
|
-
const o =
|
|
1155
|
+
const o = d("span", { className: "btn-icon" });
|
|
1096
1156
|
o.innerHTML = i;
|
|
1097
1157
|
const n = o.querySelector("svg");
|
|
1098
1158
|
n && n.setAttribute("aria-hidden", "true"), a.appendChild(o);
|
|
@@ -1109,29 +1169,29 @@ function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1,
|
|
|
1109
1169
|
disabled: r ? "disabled" : void 0
|
|
1110
1170
|
};
|
|
1111
1171
|
a && (n.dataset = { testid: a });
|
|
1112
|
-
const l =
|
|
1172
|
+
const l = d("button", n);
|
|
1113
1173
|
l.innerHTML = s;
|
|
1114
1174
|
const c = l.querySelector("svg");
|
|
1115
1175
|
return c && c.setAttribute("aria-hidden", "true"), l;
|
|
1116
1176
|
}
|
|
1117
|
-
function
|
|
1118
|
-
const r =
|
|
1177
|
+
function Z({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
1178
|
+
const r = d("button", {
|
|
1119
1179
|
type: "button",
|
|
1120
1180
|
className: `chip ${t ? "active" : ""}`.trim(),
|
|
1121
1181
|
onClick: i
|
|
1122
1182
|
});
|
|
1123
1183
|
if (e) {
|
|
1124
|
-
const a =
|
|
1184
|
+
const a = d("span", { className: "chip-icon" });
|
|
1125
1185
|
a.innerHTML = e;
|
|
1126
1186
|
const o = a.querySelector("svg");
|
|
1127
1187
|
o && o.setAttribute("aria-hidden", "true"), r.appendChild(a);
|
|
1128
1188
|
}
|
|
1129
|
-
return r.appendChild(
|
|
1189
|
+
return r.appendChild(d("span", { className: "chip-label" }, s)), r.setActive = (a) => {
|
|
1130
1190
|
r.classList.toggle("active", a);
|
|
1131
1191
|
}, r;
|
|
1132
1192
|
}
|
|
1133
|
-
const
|
|
1134
|
-
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 {
|
|
1135
1195
|
constructor(e, t) {
|
|
1136
1196
|
this.state = e, this.editor = t, this.element = null, this._unsubscribers = [];
|
|
1137
1197
|
}
|
|
@@ -1140,9 +1200,9 @@ class Le {
|
|
|
1140
1200
|
* @returns {HTMLElement}
|
|
1141
1201
|
*/
|
|
1142
1202
|
render() {
|
|
1143
|
-
this.element =
|
|
1144
|
-
const e =
|
|
1145
|
-
icon:
|
|
1203
|
+
this.element = d("div", { className: "editor-toolbar" });
|
|
1204
|
+
const e = d("div", { className: "toolbar-section toolbar-left" }), t = x({
|
|
1205
|
+
icon: Oe,
|
|
1146
1206
|
title: "Open Image",
|
|
1147
1207
|
className: "toolbar-btn",
|
|
1148
1208
|
testId: "btn-open-image",
|
|
@@ -1150,8 +1210,8 @@ class Le {
|
|
|
1150
1210
|
onClick: () => this.editor.openFilePicker()
|
|
1151
1211
|
});
|
|
1152
1212
|
e.appendChild(t);
|
|
1153
|
-
const i =
|
|
1154
|
-
icon:
|
|
1213
|
+
const i = d("div", { className: "toolbar-section toolbar-center" }), r = x({
|
|
1214
|
+
icon: Ae,
|
|
1155
1215
|
title: "Zoom Out",
|
|
1156
1216
|
className: "toolbar-btn",
|
|
1157
1217
|
testId: "btn-zoom-out",
|
|
@@ -1161,14 +1221,14 @@ class Le {
|
|
|
1161
1221
|
this.editor.setZoom(h - 0.25);
|
|
1162
1222
|
}
|
|
1163
1223
|
});
|
|
1164
|
-
this._zoomLabel =
|
|
1224
|
+
this._zoomLabel = d("span", {
|
|
1165
1225
|
className: "zoom-label",
|
|
1166
1226
|
"aria-live": "polite",
|
|
1167
1227
|
"aria-atomic": "true",
|
|
1168
1228
|
role: "status"
|
|
1169
1229
|
}, "100%");
|
|
1170
1230
|
const a = x({
|
|
1171
|
-
icon:
|
|
1231
|
+
icon: Fe,
|
|
1172
1232
|
title: "Zoom In",
|
|
1173
1233
|
className: "toolbar-btn",
|
|
1174
1234
|
testId: "btn-zoom-in",
|
|
@@ -1178,7 +1238,7 @@ class Le {
|
|
|
1178
1238
|
this.editor.setZoom(h + 0.25);
|
|
1179
1239
|
}
|
|
1180
1240
|
}), o = x({
|
|
1181
|
-
icon:
|
|
1241
|
+
icon: ze,
|
|
1182
1242
|
title: "Fit to Screen",
|
|
1183
1243
|
className: "toolbar-btn",
|
|
1184
1244
|
testId: "btn-fit-screen",
|
|
@@ -1186,16 +1246,16 @@ class Le {
|
|
|
1186
1246
|
onClick: () => this.editor.fitToScreen()
|
|
1187
1247
|
});
|
|
1188
1248
|
i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
|
|
1189
|
-
const n =
|
|
1249
|
+
const n = d("div", { className: "toolbar-section toolbar-right" });
|
|
1190
1250
|
this._themeBtn = x({
|
|
1191
|
-
icon: this.state.get("isDarkMode") ?
|
|
1251
|
+
icon: this.state.get("isDarkMode") ? Q : J,
|
|
1192
1252
|
title: "Toggle Theme",
|
|
1193
1253
|
className: "toolbar-btn toolbar-btn-theme",
|
|
1194
1254
|
testId: "btn-toggle-theme",
|
|
1195
1255
|
ariaLabel: "Toggle theme",
|
|
1196
1256
|
onClick: () => this.editor.toggleTheme()
|
|
1197
1257
|
}), this._cropBtn = x({
|
|
1198
|
-
icon:
|
|
1258
|
+
icon: ue,
|
|
1199
1259
|
title: "Crop",
|
|
1200
1260
|
className: "toolbar-btn toolbar-btn-crop",
|
|
1201
1261
|
testId: "btn-crop",
|
|
@@ -1205,28 +1265,28 @@ class Le {
|
|
|
1205
1265
|
}
|
|
1206
1266
|
});
|
|
1207
1267
|
const l = x({
|
|
1208
|
-
icon:
|
|
1268
|
+
icon: pe,
|
|
1209
1269
|
title: "Reset All",
|
|
1210
1270
|
className: "toolbar-btn",
|
|
1211
1271
|
testId: "btn-reset-all",
|
|
1212
1272
|
ariaLabel: "Reset all changes",
|
|
1213
1273
|
onClick: () => this.editor.resetAll()
|
|
1214
1274
|
}), c = x({
|
|
1215
|
-
icon:
|
|
1275
|
+
icon: Ye,
|
|
1216
1276
|
title: "Save Image",
|
|
1217
1277
|
className: "toolbar-btn toolbar-btn-primary",
|
|
1218
1278
|
testId: "btn-save-edit",
|
|
1219
1279
|
ariaLabel: "Save image",
|
|
1220
1280
|
onClick: () => this.editor.save()
|
|
1221
|
-
}),
|
|
1222
|
-
icon:
|
|
1281
|
+
}), u = x({
|
|
1282
|
+
icon: K,
|
|
1223
1283
|
title: "Close",
|
|
1224
1284
|
className: "toolbar-btn",
|
|
1225
1285
|
testId: "btn-cancel-edit",
|
|
1226
1286
|
ariaLabel: "Close editor",
|
|
1227
1287
|
onClick: () => this.editor.close()
|
|
1228
1288
|
});
|
|
1229
|
-
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(
|
|
1289
|
+
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(u), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
|
|
1230
1290
|
}
|
|
1231
1291
|
/**
|
|
1232
1292
|
* Subscribe to state changes
|
|
@@ -1237,7 +1297,7 @@ class Le {
|
|
|
1237
1297
|
});
|
|
1238
1298
|
this._unsubscribers.push(e);
|
|
1239
1299
|
const t = this.state.on("change:isDarkMode", ({ value: r }) => {
|
|
1240
|
-
this._themeBtn.innerHTML = r ?
|
|
1300
|
+
this._themeBtn.innerHTML = r ? Q : J;
|
|
1241
1301
|
});
|
|
1242
1302
|
this._unsubscribers.push(t);
|
|
1243
1303
|
const i = this.state.on("change:mode", ({ value: r }) => {
|
|
@@ -1261,23 +1321,23 @@ class Le {
|
|
|
1261
1321
|
}
|
|
1262
1322
|
}
|
|
1263
1323
|
const L = [
|
|
1264
|
-
{ id: "adjust", name: "Adjust", icon:
|
|
1324
|
+
{ id: "adjust", name: "Adjust", icon: Re },
|
|
1265
1325
|
// adjustment, adjustmentAdvanced, alpha
|
|
1266
|
-
{ id: "blur", name: "Blur", icon:
|
|
1326
|
+
{ id: "blur", name: "Blur", icon: Ne },
|
|
1267
1327
|
// blur, kawaseBlur, motionBlur, radialBlur, etc.
|
|
1268
|
-
{ id: "color", name: "Color", icon:
|
|
1328
|
+
{ id: "color", name: "Color", icon: Te },
|
|
1269
1329
|
// colorOverlay, grayscale, hslAdjustment, etc.
|
|
1270
|
-
{ id: "effects", name: "Effects", icon:
|
|
1330
|
+
{ id: "effects", name: "Effects", icon: Ie },
|
|
1271
1331
|
// noise, vignette, pixelate, dropShadow, etc.
|
|
1272
|
-
{ id: "distortion", name: "Distortion", icon:
|
|
1332
|
+
{ id: "distortion", name: "Distortion", icon: Ee },
|
|
1273
1333
|
// twist, bulgePinch, displacement, etc.
|
|
1274
|
-
{ id: "light", name: "Light", icon:
|
|
1334
|
+
{ id: "light", name: "Light", icon: Xe },
|
|
1275
1335
|
// bloom, glow, godray, advancedBloom
|
|
1276
|
-
{ id: "stylize", name: "Stylize", icon:
|
|
1336
|
+
{ id: "stylize", name: "Stylize", icon: Ve },
|
|
1277
1337
|
// ascii, crt, crossHatch, dot, emboss
|
|
1278
|
-
{ id: "crop", name: "Crop", icon:
|
|
1338
|
+
{ id: "crop", name: "Crop", icon: ue }
|
|
1279
1339
|
];
|
|
1280
|
-
class
|
|
1340
|
+
class qe {
|
|
1281
1341
|
constructor(e, t) {
|
|
1282
1342
|
this.state = e, this.editor = t, this.element = null, this._chips = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [];
|
|
1283
1343
|
}
|
|
@@ -1287,16 +1347,16 @@ class De {
|
|
|
1287
1347
|
* @returns {HTMLElement}
|
|
1288
1348
|
*/
|
|
1289
1349
|
render(e) {
|
|
1290
|
-
this._onSelect = e, this.element =
|
|
1350
|
+
this._onSelect = e, this.element = d("div", {
|
|
1291
1351
|
className: "category-carousel-container",
|
|
1292
1352
|
"data-testid": "category-carousel"
|
|
1293
1353
|
}), this._leftBtn = x({
|
|
1294
|
-
icon:
|
|
1354
|
+
icon: he,
|
|
1295
1355
|
title: "Previous categories",
|
|
1296
1356
|
className: "carousel-nav carousel-nav-left",
|
|
1297
1357
|
onClick: () => this._scrollLeft()
|
|
1298
|
-
}), this._carousel =
|
|
1299
|
-
const r =
|
|
1358
|
+
}), this._carousel = d("div", { className: "category-carousel" }), L.forEach((i) => {
|
|
1359
|
+
const r = Z({
|
|
1300
1360
|
label: i.name,
|
|
1301
1361
|
icon: i.icon,
|
|
1302
1362
|
active: this.state.get("selectedCategory") === i.id,
|
|
@@ -1304,18 +1364,18 @@ class De {
|
|
|
1304
1364
|
});
|
|
1305
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);
|
|
1306
1366
|
}), this._rightBtn = x({
|
|
1307
|
-
icon:
|
|
1367
|
+
icon: de,
|
|
1308
1368
|
title: "Next categories",
|
|
1309
1369
|
className: "carousel-nav carousel-nav-right",
|
|
1310
1370
|
onClick: () => this._scrollRight()
|
|
1311
|
-
}), this._pagination =
|
|
1371
|
+
}), this._pagination = d("div", {
|
|
1312
1372
|
className: "carousel-pagination",
|
|
1313
1373
|
role: "tablist",
|
|
1314
1374
|
"aria-label": "Category pages"
|
|
1315
1375
|
});
|
|
1316
1376
|
const t = Math.ceil(L.length / 3);
|
|
1317
1377
|
for (let i = 0; i < t; i++) {
|
|
1318
|
-
const r =
|
|
1378
|
+
const r = d("button", {
|
|
1319
1379
|
type: "button",
|
|
1320
1380
|
className: `pagination-dot ${i === 0 ? "active" : ""}`,
|
|
1321
1381
|
role: "tab",
|
|
@@ -1412,7 +1472,7 @@ class De {
|
|
|
1412
1472
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1413
1473
|
}
|
|
1414
1474
|
}
|
|
1415
|
-
class
|
|
1475
|
+
class He {
|
|
1416
1476
|
constructor(e, t) {
|
|
1417
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;
|
|
1418
1478
|
}
|
|
@@ -1422,13 +1482,13 @@ class Ue {
|
|
|
1422
1482
|
* @returns {HTMLElement}
|
|
1423
1483
|
*/
|
|
1424
1484
|
render({ onToggle: e, onSelect: t }) {
|
|
1425
|
-
return this._onToggle = e, this._onSelect = t, this.element =
|
|
1426
|
-
icon:
|
|
1485
|
+
return this._onToggle = e, this._onSelect = t, this.element = d("div", { className: "filter-carousel-container" }), this._leftBtn = x({
|
|
1486
|
+
icon: he,
|
|
1427
1487
|
title: "Previous filters",
|
|
1428
1488
|
className: "carousel-nav carousel-nav-left",
|
|
1429
1489
|
onClick: () => this._scrollLeft()
|
|
1430
|
-
}), this._carousel =
|
|
1431
|
-
icon:
|
|
1490
|
+
}), this._carousel = d("div", { className: "filter-carousel" }), this._rightBtn = x({
|
|
1491
|
+
icon: de,
|
|
1432
1492
|
title: "Next filters",
|
|
1433
1493
|
className: "carousel-nav carousel-nav-right",
|
|
1434
1494
|
onClick: () => this._scrollRight()
|
|
@@ -1474,14 +1534,14 @@ class Ue {
|
|
|
1474
1534
|
* @returns {HTMLElement}
|
|
1475
1535
|
*/
|
|
1476
1536
|
_createFilterCard(e, { isActive: t, isSelected: i }) {
|
|
1477
|
-
const r =
|
|
1537
|
+
const r = d("div", {
|
|
1478
1538
|
className: `filter-card ${t ? "active" : ""} ${i ? "selected" : ""}`,
|
|
1479
1539
|
"data-filter": e.id,
|
|
1480
1540
|
"data-testid": `filter-${e.id}`,
|
|
1481
1541
|
onClick: () => this._handleCardClick(e.id)
|
|
1482
|
-
}), a =
|
|
1542
|
+
}), a = d("div", { className: "filter-preview" }), o = d("span", { className: "filter-preview-text" }, e.name.charAt(0));
|
|
1483
1543
|
a.appendChild(o);
|
|
1484
|
-
const n =
|
|
1544
|
+
const n = d("span", { className: "filter-name", title: e.name }, e.name), l = d("button", {
|
|
1485
1545
|
className: `filter-toggle ${t ? "active" : ""}`,
|
|
1486
1546
|
onClick: (c) => {
|
|
1487
1547
|
var p;
|
|
@@ -1490,7 +1550,7 @@ class Ue {
|
|
|
1490
1550
|
this._handleToggle(e.id, h), h && (this.state.set("selectedFilter", e.id), (p = this._onSelect) == null || p.call(this, e.id));
|
|
1491
1551
|
}
|
|
1492
1552
|
});
|
|
1493
|
-
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;
|
|
1494
1554
|
}
|
|
1495
1555
|
/**
|
|
1496
1556
|
* Handle filter card click (select)
|
|
@@ -1516,7 +1576,7 @@ class Ue {
|
|
|
1516
1576
|
const e = this.state.get("activeFilters");
|
|
1517
1577
|
this._filterCards.forEach((t, i) => {
|
|
1518
1578
|
const r = e.has(i);
|
|
1519
|
-
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;
|
|
1520
1580
|
});
|
|
1521
1581
|
}
|
|
1522
1582
|
/**
|
|
@@ -1569,7 +1629,7 @@ class Ue {
|
|
|
1569
1629
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterCards.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1570
1630
|
}
|
|
1571
1631
|
}
|
|
1572
|
-
class
|
|
1632
|
+
class $e {
|
|
1573
1633
|
constructor(e, t) {
|
|
1574
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 = [];
|
|
1575
1635
|
}
|
|
@@ -1579,7 +1639,7 @@ class Ve {
|
|
|
1579
1639
|
* @returns {HTMLElement}
|
|
1580
1640
|
*/
|
|
1581
1641
|
render({ onChange: e, onReset: t, onAction: i }) {
|
|
1582
|
-
return this._onChange = e, this._onReset = t, this._onAction = i, this.element =
|
|
1642
|
+
return this._onChange = e, this._onReset = t, this._onAction = i, this.element = d("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
|
|
1583
1643
|
}
|
|
1584
1644
|
/**
|
|
1585
1645
|
* Subscribe to state changes
|
|
@@ -1602,24 +1662,24 @@ class Ve {
|
|
|
1602
1662
|
const e = this.state.get("selectedFilter");
|
|
1603
1663
|
if (!e) {
|
|
1604
1664
|
this.element.appendChild(
|
|
1605
|
-
|
|
1665
|
+
d("div", { className: "no-filter-selected" }, "Select a filter to adjust")
|
|
1606
1666
|
);
|
|
1607
1667
|
return;
|
|
1608
1668
|
}
|
|
1609
1669
|
const t = this.filterManager.getFilterDef(e);
|
|
1610
1670
|
if (!t) {
|
|
1611
1671
|
this.element.appendChild(
|
|
1612
|
-
|
|
1672
|
+
d("div", { className: "no-filter-selected" }, "Filter not found")
|
|
1613
1673
|
);
|
|
1614
1674
|
return;
|
|
1615
1675
|
}
|
|
1616
|
-
const i =
|
|
1617
|
-
i.appendChild(
|
|
1676
|
+
const i = d("div", { className: "adjustments-header" });
|
|
1677
|
+
i.appendChild(d("span", { className: "adjustments-title" }, t.name)), i.appendChild(F({
|
|
1618
1678
|
label: "Reset",
|
|
1619
1679
|
className: "btn-text",
|
|
1620
1680
|
onClick: () => this._handleReset(e)
|
|
1621
1681
|
})), this.element.appendChild(i);
|
|
1622
|
-
const r =
|
|
1682
|
+
const r = d("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
|
|
1623
1683
|
t.controls.forEach((o) => {
|
|
1624
1684
|
const n = this._createControl(e, o, a[o.id] ?? o.default);
|
|
1625
1685
|
n && (this._controls.set(o.id, n), r.appendChild(n));
|
|
@@ -1637,7 +1697,7 @@ class Ve {
|
|
|
1637
1697
|
const r = t.label || t.id;
|
|
1638
1698
|
switch (this._normalizeControlType(t.type)) {
|
|
1639
1699
|
case "slider":
|
|
1640
|
-
return
|
|
1700
|
+
return oe({
|
|
1641
1701
|
id: `${e}-${t.id}`,
|
|
1642
1702
|
label: r,
|
|
1643
1703
|
min: t.min ?? 0,
|
|
@@ -1647,14 +1707,14 @@ class Ve {
|
|
|
1647
1707
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1648
1708
|
});
|
|
1649
1709
|
case "toggle":
|
|
1650
|
-
return
|
|
1710
|
+
return ne({
|
|
1651
1711
|
id: `${e}-${t.id}`,
|
|
1652
1712
|
label: r,
|
|
1653
1713
|
checked: !!i,
|
|
1654
1714
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1655
1715
|
});
|
|
1656
1716
|
case "color":
|
|
1657
|
-
return
|
|
1717
|
+
return le({
|
|
1658
1718
|
id: `${e}-${t.id}`,
|
|
1659
1719
|
label: r,
|
|
1660
1720
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1662,7 +1722,7 @@ class Ve {
|
|
|
1662
1722
|
});
|
|
1663
1723
|
case "select":
|
|
1664
1724
|
const o = this._normalizeOptions(t.options);
|
|
1665
|
-
return
|
|
1725
|
+
return ce({
|
|
1666
1726
|
id: `${e}-${t.id}`,
|
|
1667
1727
|
label: r,
|
|
1668
1728
|
options: o,
|
|
@@ -1670,8 +1730,8 @@ class Ve {
|
|
|
1670
1730
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1671
1731
|
});
|
|
1672
1732
|
case "button":
|
|
1673
|
-
const n =
|
|
1674
|
-
return n.appendChild(
|
|
1733
|
+
const n = d("div", { className: "button-control" });
|
|
1734
|
+
return n.appendChild(F({
|
|
1675
1735
|
label: r,
|
|
1676
1736
|
className: "btn-secondary",
|
|
1677
1737
|
onClick: () => this._handleAction(e, t.action || t.id)
|
|
@@ -1772,7 +1832,7 @@ class Ve {
|
|
|
1772
1832
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._controls.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1773
1833
|
}
|
|
1774
1834
|
}
|
|
1775
|
-
class
|
|
1835
|
+
class We {
|
|
1776
1836
|
constructor(e, t) {
|
|
1777
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;
|
|
1778
1838
|
}
|
|
@@ -1782,31 +1842,31 @@ class je {
|
|
|
1782
1842
|
* @param {Object} callbacks - { onChange, onReset, onRemove, onAction }
|
|
1783
1843
|
*/
|
|
1784
1844
|
build(e, { onChange: t, onReset: i, onRemove: r, onAction: a }) {
|
|
1785
|
-
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer =
|
|
1786
|
-
const o =
|
|
1787
|
-
this._titleEl =
|
|
1788
|
-
const n =
|
|
1845
|
+
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = d("div", { className: "mobile-filter-drawer" });
|
|
1846
|
+
const o = d("div", { className: "drawer-header" });
|
|
1847
|
+
this._titleEl = d("span", { className: "drawer-title" }, "Filter");
|
|
1848
|
+
const n = d("div", { className: "drawer-header-actions" }), l = F({
|
|
1789
1849
|
label: "Reset",
|
|
1790
1850
|
className: "btn-text",
|
|
1791
1851
|
onClick: () => {
|
|
1792
1852
|
var h;
|
|
1793
1853
|
this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
|
|
1794
1854
|
}
|
|
1795
|
-
}), c =
|
|
1855
|
+
}), c = F({
|
|
1796
1856
|
label: "Remove",
|
|
1797
1857
|
className: "btn-text btn-danger",
|
|
1798
1858
|
onClick: () => {
|
|
1799
1859
|
var h;
|
|
1800
1860
|
this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
|
|
1801
1861
|
}
|
|
1802
|
-
}),
|
|
1803
|
-
icon:
|
|
1862
|
+
}), u = x({
|
|
1863
|
+
icon: K,
|
|
1804
1864
|
title: "Close",
|
|
1805
1865
|
className: "btn-icon-sm",
|
|
1806
1866
|
ariaLabel: "Close drawer",
|
|
1807
1867
|
onClick: () => this.close()
|
|
1808
1868
|
});
|
|
1809
|
-
n.appendChild(l), n.appendChild(c), n.appendChild(
|
|
1869
|
+
n.appendChild(l), n.appendChild(c), n.appendChild(u), o.appendChild(this._titleEl), o.appendChild(n), this._drawer.appendChild(o), this._body = d("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
|
|
1810
1870
|
}
|
|
1811
1871
|
/**
|
|
1812
1872
|
* Open the drawer for a specific filter
|
|
@@ -1856,7 +1916,7 @@ class je {
|
|
|
1856
1916
|
const e = this.filterManager.getFilterDef(this._currentFilterId);
|
|
1857
1917
|
if (!e) return;
|
|
1858
1918
|
this._titleEl.textContent = e.name;
|
|
1859
|
-
const t =
|
|
1919
|
+
const t = d("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
|
|
1860
1920
|
e.controls.forEach((r) => {
|
|
1861
1921
|
if (r.hidden) return;
|
|
1862
1922
|
const a = this._createControl(this._currentFilterId, r, i[r.id] ?? r.default);
|
|
@@ -1874,7 +1934,7 @@ class je {
|
|
|
1874
1934
|
const r = t.label || t.id;
|
|
1875
1935
|
switch (this._normalizeControlType(t.type)) {
|
|
1876
1936
|
case "slider":
|
|
1877
|
-
return
|
|
1937
|
+
return oe({
|
|
1878
1938
|
id: `drawer-${e}-${t.id}`,
|
|
1879
1939
|
label: r,
|
|
1880
1940
|
min: t.min ?? 0,
|
|
@@ -1887,7 +1947,7 @@ class je {
|
|
|
1887
1947
|
}
|
|
1888
1948
|
});
|
|
1889
1949
|
case "toggle":
|
|
1890
|
-
return
|
|
1950
|
+
return ne({
|
|
1891
1951
|
id: `drawer-${e}-${t.id}`,
|
|
1892
1952
|
label: r,
|
|
1893
1953
|
checked: !!i,
|
|
@@ -1897,7 +1957,7 @@ class je {
|
|
|
1897
1957
|
}
|
|
1898
1958
|
});
|
|
1899
1959
|
case "color":
|
|
1900
|
-
return
|
|
1960
|
+
return le({
|
|
1901
1961
|
id: `drawer-${e}-${t.id}`,
|
|
1902
1962
|
label: r,
|
|
1903
1963
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1908,7 +1968,7 @@ class je {
|
|
|
1908
1968
|
});
|
|
1909
1969
|
case "select": {
|
|
1910
1970
|
const o = this._normalizeOptions(t.options);
|
|
1911
|
-
return
|
|
1971
|
+
return ce({
|
|
1912
1972
|
id: `drawer-${e}-${t.id}`,
|
|
1913
1973
|
label: r,
|
|
1914
1974
|
options: o,
|
|
@@ -1920,8 +1980,8 @@ class je {
|
|
|
1920
1980
|
});
|
|
1921
1981
|
}
|
|
1922
1982
|
case "button": {
|
|
1923
|
-
const o =
|
|
1924
|
-
return o.appendChild(
|
|
1983
|
+
const o = d("div", { className: "button-control" });
|
|
1984
|
+
return o.appendChild(F({
|
|
1925
1985
|
label: r,
|
|
1926
1986
|
className: "btn-secondary",
|
|
1927
1987
|
onClick: () => {
|
|
@@ -1968,7 +2028,7 @@ class je {
|
|
|
1968
2028
|
this._controls.clear(), (e = this._drawer) == null || e.remove(), this._drawer = null, this._isOpen = !1, this._currentFilterId = null, this._container = null;
|
|
1969
2029
|
}
|
|
1970
2030
|
}
|
|
1971
|
-
class
|
|
2031
|
+
class Ze {
|
|
1972
2032
|
constructor(e, t) {
|
|
1973
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;
|
|
1974
2034
|
}
|
|
@@ -1977,10 +2037,10 @@ class qe {
|
|
|
1977
2037
|
* @returns {HTMLElement}
|
|
1978
2038
|
*/
|
|
1979
2039
|
render({ onToggle: e, onSelect: t }) {
|
|
1980
|
-
return this._onToggle = e, this._onSelect = t, this.element =
|
|
2040
|
+
return this._onToggle = e, this._onSelect = t, this.element = d("div", {
|
|
1981
2041
|
className: "mobile-active-filters",
|
|
1982
2042
|
"data-testid": "mobile-active-filters"
|
|
1983
|
-
}), this._scrollContainer =
|
|
2043
|
+
}), this._scrollContainer = d("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
|
|
1984
2044
|
}
|
|
1985
2045
|
_subscribeToState() {
|
|
1986
2046
|
const e = this.state.on("change:activeFilters", () => {
|
|
@@ -1996,7 +2056,7 @@ class qe {
|
|
|
1996
2056
|
this._scrollContainer.innerHTML = "", this._chips.clear();
|
|
1997
2057
|
const e = this.state.get("activeFilters");
|
|
1998
2058
|
if (!e || e.size === 0) {
|
|
1999
|
-
const t =
|
|
2059
|
+
const t = d("div", {
|
|
2000
2060
|
className: "active-filter-placeholder"
|
|
2001
2061
|
}, "No active filters");
|
|
2002
2062
|
this._scrollContainer.appendChild(t);
|
|
@@ -2010,17 +2070,17 @@ class qe {
|
|
|
2010
2070
|
}), this._updateSelectedState();
|
|
2011
2071
|
}
|
|
2012
2072
|
_createChip(e, t) {
|
|
2013
|
-
const i =
|
|
2073
|
+
const i = d("div", {
|
|
2014
2074
|
className: "active-filter-chip",
|
|
2015
2075
|
"data-filter-id": e,
|
|
2016
2076
|
"data-testid": `active-chip-${e}`
|
|
2017
|
-
}), r =
|
|
2077
|
+
}), r = d("span", {
|
|
2018
2078
|
className: "active-filter-chip-label",
|
|
2019
2079
|
onClick: (o) => {
|
|
2020
2080
|
var n;
|
|
2021
2081
|
o.stopPropagation(), (n = this._onSelect) == null || n.call(this, e);
|
|
2022
2082
|
}
|
|
2023
|
-
}, t.name), a =
|
|
2083
|
+
}, t.name), a = d("button", {
|
|
2024
2084
|
className: "active-filter-chip-check",
|
|
2025
2085
|
"aria-label": `Remove ${t.name} filter`,
|
|
2026
2086
|
onClick: (o) => {
|
|
@@ -2041,11 +2101,11 @@ class qe {
|
|
|
2041
2101
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2042
2102
|
}
|
|
2043
2103
|
}
|
|
2044
|
-
const
|
|
2045
|
-
{ id: "free", name: "Free", icon:
|
|
2046
|
-
{ id: "square", name: "Square", icon:
|
|
2047
|
-
{ id: "circle", name: "Circle", icon:
|
|
2048
|
-
],
|
|
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 = [
|
|
2049
2109
|
{ id: "free", name: "Free" },
|
|
2050
2110
|
{ id: "1:1", name: "1:1" },
|
|
2051
2111
|
{ id: "4:3", name: "4:3" },
|
|
@@ -2053,52 +2113,60 @@ const He = [
|
|
|
2053
2113
|
{ id: "3:2", name: "3:2" },
|
|
2054
2114
|
{ id: "2:3", name: "2:3" }
|
|
2055
2115
|
];
|
|
2056
|
-
class
|
|
2116
|
+
class Qe {
|
|
2057
2117
|
constructor(e, t) {
|
|
2058
2118
|
this.state = e, this.cropManager = t, this.element = null, this._shapeChips = /* @__PURE__ */ new Map(), this._aspectChips = /* @__PURE__ */ new Map(), this._unsubscribers = [];
|
|
2059
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
|
+
}
|
|
2060
2128
|
/**
|
|
2061
2129
|
* Create and render the crop controls
|
|
2062
2130
|
* @returns {HTMLElement}
|
|
2063
2131
|
*/
|
|
2064
2132
|
render() {
|
|
2065
|
-
this.element =
|
|
2133
|
+
this.element = d("div", {
|
|
2066
2134
|
className: "crop-controls",
|
|
2067
2135
|
"data-testid": "crop-controls"
|
|
2068
2136
|
});
|
|
2069
|
-
const e =
|
|
2070
|
-
e.appendChild(
|
|
2071
|
-
const t =
|
|
2072
|
-
|
|
2073
|
-
const
|
|
2137
|
+
const e = d("div", { className: "crop-section" });
|
|
2138
|
+
e.appendChild(d("label", { className: "section-label" }, "Shape"));
|
|
2139
|
+
const t = d("div", { className: "chip-row" }), i = this.state.get("crop.shape");
|
|
2140
|
+
Ge.forEach((c) => {
|
|
2141
|
+
const u = Z({
|
|
2074
2142
|
label: c.name,
|
|
2075
2143
|
icon: c.icon,
|
|
2076
2144
|
active: i === c.id,
|
|
2077
2145
|
onClick: () => this._selectShape(c.id)
|
|
2078
2146
|
});
|
|
2079
|
-
|
|
2080
|
-
}), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection =
|
|
2081
|
-
const r =
|
|
2082
|
-
|
|
2083
|
-
const
|
|
2147
|
+
u.dataset.shape = c.id, u.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, u), t.appendChild(u);
|
|
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"));
|
|
2149
|
+
const r = d("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
|
|
2150
|
+
Ke.forEach((c) => {
|
|
2151
|
+
const u = Z({
|
|
2084
2152
|
label: c.name,
|
|
2085
2153
|
active: a === c.id,
|
|
2086
2154
|
onClick: () => this._selectAspect(c.id)
|
|
2087
2155
|
});
|
|
2088
|
-
|
|
2156
|
+
u.dataset.ratio = c.id, u.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, u), r.appendChild(u);
|
|
2089
2157
|
}), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
|
|
2090
|
-
const o =
|
|
2158
|
+
const o = d("div", { className: "crop-actions" }), n = F({
|
|
2091
2159
|
label: "Cancel",
|
|
2092
2160
|
className: "btn-secondary crop-cancel-btn",
|
|
2093
|
-
icon:
|
|
2161
|
+
icon: K,
|
|
2094
2162
|
onClick: () => this.cropManager.cancel()
|
|
2095
2163
|
});
|
|
2096
2164
|
n.dataset.testid = "cancel-crop";
|
|
2097
|
-
const l =
|
|
2165
|
+
const l = F({
|
|
2098
2166
|
label: "Apply Crop",
|
|
2099
2167
|
className: "btn-primary crop-apply-btn",
|
|
2100
|
-
icon:
|
|
2101
|
-
onClick: () => this.
|
|
2168
|
+
icon: G,
|
|
2169
|
+
onClick: () => this._applyCropAndReturnToFilters()
|
|
2102
2170
|
});
|
|
2103
2171
|
return l.dataset.testid = "apply-crop", o.appendChild(n), o.appendChild(l), this.element.appendChild(o), this._subscribeToState(), this.element;
|
|
2104
2172
|
}
|
|
@@ -2160,7 +2228,7 @@ class We {
|
|
|
2160
2228
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._shapeChips.clear(), this._aspectChips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2161
2229
|
}
|
|
2162
2230
|
}
|
|
2163
|
-
class
|
|
2231
|
+
class Je {
|
|
2164
2232
|
constructor(e, t) {
|
|
2165
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;
|
|
2166
2234
|
}
|
|
@@ -2170,18 +2238,18 @@ class Ze {
|
|
|
2170
2238
|
* @returns {HTMLElement}
|
|
2171
2239
|
*/
|
|
2172
2240
|
render({ onRemove: e, onReset: t, onClearAll: i, onUpdateValue: r, onSelect: a }) {
|
|
2173
|
-
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element =
|
|
2241
|
+
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = d("div", {
|
|
2174
2242
|
className: "active-filters-panel",
|
|
2175
2243
|
"data-testid": "active-filters-panel"
|
|
2176
2244
|
});
|
|
2177
|
-
const o =
|
|
2178
|
-
o.appendChild(
|
|
2179
|
-
const n =
|
|
2245
|
+
const o = d("div", { className: "panel-header" });
|
|
2246
|
+
o.appendChild(d("h3", { className: "panel-title" }, "Active Filters"));
|
|
2247
|
+
const n = F({
|
|
2180
2248
|
label: "Clear All",
|
|
2181
2249
|
className: "btn-text btn-danger",
|
|
2182
2250
|
onClick: () => this._handleClearAll()
|
|
2183
2251
|
});
|
|
2184
|
-
return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer =
|
|
2252
|
+
return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer = d("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
|
|
2185
2253
|
}
|
|
2186
2254
|
/**
|
|
2187
2255
|
* Subscribe to state changes
|
|
@@ -2217,7 +2285,7 @@ class Ze {
|
|
|
2217
2285
|
const e = this.state.get("activeFilters");
|
|
2218
2286
|
if (e.size === 0) {
|
|
2219
2287
|
this._listContainer.appendChild(
|
|
2220
|
-
|
|
2288
|
+
d("div", { className: "no-filters-message" }, "No filters active")
|
|
2221
2289
|
);
|
|
2222
2290
|
return;
|
|
2223
2291
|
}
|
|
@@ -2235,26 +2303,26 @@ class Ze {
|
|
|
2235
2303
|
* @returns {HTMLElement}
|
|
2236
2304
|
*/
|
|
2237
2305
|
_createFilterItem(e, t) {
|
|
2238
|
-
const r = this.state.get("selectedFilter") === e, a =
|
|
2306
|
+
const r = this.state.get("selectedFilter") === e, a = d("div", {
|
|
2239
2307
|
className: `active-filter-item ${r ? "selected" : ""}`,
|
|
2240
2308
|
"data-active-filter": e,
|
|
2241
2309
|
"data-testid": `active-filter-${e}`,
|
|
2242
2310
|
onClick: (m) => {
|
|
2243
2311
|
m.target.closest(".filter-item-actions") || this._handleSelect(e);
|
|
2244
2312
|
}
|
|
2245
|
-
}), o =
|
|
2246
|
-
icon:
|
|
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({
|
|
2314
|
+
icon: pe,
|
|
2247
2315
|
title: "Reset filter",
|
|
2248
2316
|
className: "btn-icon-sm",
|
|
2249
2317
|
onClick: () => this._handleReset(e)
|
|
2250
|
-
}),
|
|
2251
|
-
icon:
|
|
2318
|
+
}), u = x({
|
|
2319
|
+
icon: Be,
|
|
2252
2320
|
title: "Remove filter",
|
|
2253
2321
|
className: "btn-icon-sm btn-danger",
|
|
2254
2322
|
onClick: () => this._handleRemove(e)
|
|
2255
2323
|
});
|
|
2256
|
-
l.appendChild(c), l.appendChild(
|
|
2257
|
-
const h = this.state.getFilterValues(e), p =
|
|
2324
|
+
l.appendChild(c), l.appendChild(u), o.appendChild(n), o.appendChild(l), a.appendChild(o);
|
|
2325
|
+
const h = this.state.getFilterValues(e), p = d("div", { className: "filter-item-summary" });
|
|
2258
2326
|
return p.textContent = this._getValuesSummary(t, h), a.appendChild(p), a._summaryEl = p, a;
|
|
2259
2327
|
}
|
|
2260
2328
|
/**
|
|
@@ -2373,7 +2441,7 @@ const Y = {
|
|
|
2373
2441
|
showCropControls: !0,
|
|
2374
2442
|
maxExportWidth: void 0,
|
|
2375
2443
|
maxExportHeight: void 0
|
|
2376
|
-
},
|
|
2444
|
+
}, H = {
|
|
2377
2445
|
free: {
|
|
2378
2446
|
...Y
|
|
2379
2447
|
},
|
|
@@ -2408,15 +2476,15 @@ const Y = {
|
|
|
2408
2476
|
lockAspectRatio: !1
|
|
2409
2477
|
}
|
|
2410
2478
|
};
|
|
2411
|
-
function
|
|
2479
|
+
function et(s) {
|
|
2412
2480
|
if (!s)
|
|
2413
|
-
return { ...
|
|
2481
|
+
return { ...H.free };
|
|
2414
2482
|
if (typeof s == "object" && s !== null)
|
|
2415
2483
|
return { ...Y, ...s };
|
|
2416
|
-
const e =
|
|
2417
|
-
return e ? { ...e } : { ...
|
|
2484
|
+
const e = H[s];
|
|
2485
|
+
return e ? { ...e } : { ...H.free };
|
|
2418
2486
|
}
|
|
2419
|
-
class
|
|
2487
|
+
class ei extends B {
|
|
2420
2488
|
/**
|
|
2421
2489
|
* Create a new VanillaImageEditor
|
|
2422
2490
|
* @param {HTMLElement} container - Container element to mount the editor
|
|
@@ -2426,8 +2494,8 @@ class Gt extends B {
|
|
|
2426
2494
|
var a, o, n;
|
|
2427
2495
|
if (super(), !e)
|
|
2428
2496
|
throw new Error("VanillaImageEditor: container element is required");
|
|
2429
|
-
this._container = e;
|
|
2430
|
-
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 ? {
|
|
2431
2499
|
initialMode: i.initialMode === "crop" ? "crop" : "adjust",
|
|
2432
2500
|
cropShape: i.cropShape,
|
|
2433
2501
|
initialAspectRatio: i.aspectRatio
|
|
@@ -2445,7 +2513,7 @@ class Gt extends B {
|
|
|
2445
2513
|
},
|
|
2446
2514
|
...r,
|
|
2447
2515
|
...t
|
|
2448
|
-
}, 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({
|
|
2449
2517
|
endpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.endpoint,
|
|
2450
2518
|
fallbackEndpoint: (n = this._options.backgroundRemoval) == null ? void 0 : n.fallbackEndpoint
|
|
2451
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();
|
|
@@ -2463,13 +2531,13 @@ class Gt extends B {
|
|
|
2463
2531
|
* Build DOM structure
|
|
2464
2532
|
*/
|
|
2465
2533
|
_buildDOM() {
|
|
2466
|
-
this._container.innerHTML = "", this._editorEl =
|
|
2534
|
+
this._container.innerHTML = "", this._editorEl = d("div", {
|
|
2467
2535
|
className: `vanilla-image-editor ${this._state.get("isDarkMode") ? "dark" : "light"}`
|
|
2468
2536
|
});
|
|
2469
|
-
const e =
|
|
2537
|
+
const e = d("div", { className: "editor-toolbar-container" });
|
|
2470
2538
|
this._editorEl.appendChild(e), this._toolbarContainer = e;
|
|
2471
|
-
const t =
|
|
2472
|
-
this._canvasContainer =
|
|
2539
|
+
const t = d("div", { className: "editor-content" }), i = d("div", { className: "canvas-section" });
|
|
2540
|
+
this._canvasContainer = d("div", { className: "canvas-container" }), this._cropOverlay = d("canvas", { className: "crop-overlay", "aria-hidden": "true" }), i.appendChild(this._canvasContainer), i.appendChild(this._cropOverlay), t.appendChild(i), this._controlsSection = d("div", { className: "controls-section" }), t.appendChild(this._controlsSection), this._editorEl.appendChild(t), this._fileInput = d("input", {
|
|
2473
2541
|
type: "file",
|
|
2474
2542
|
accept: "image/*",
|
|
2475
2543
|
className: "hidden-file-input",
|
|
@@ -2481,31 +2549,31 @@ class Gt extends B {
|
|
|
2481
2549
|
* Initialize UI components
|
|
2482
2550
|
*/
|
|
2483
2551
|
_initUI() {
|
|
2484
|
-
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) => {
|
|
2485
2553
|
}));
|
|
2486
|
-
const e =
|
|
2487
|
-
this._filterCarousel = new
|
|
2554
|
+
const e = d("div", { className: "filter-layout" }), t = d("div", { className: "filter-left-column" });
|
|
2555
|
+
this._filterCarousel = new He(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
|
|
2488
2556
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2489
2557
|
onSelect: (r) => {
|
|
2490
2558
|
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2491
2559
|
}
|
|
2492
|
-
})), this._filterAdjustments = new
|
|
2560
|
+
})), this._filterAdjustments = new $e(this._state, this._filterManager), t.appendChild(this._filterAdjustments.render({
|
|
2493
2561
|
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2494
2562
|
onReset: (r) => this._handleFilterReset(r),
|
|
2495
2563
|
onAction: (r, a) => this._handleFilterAction(r, a)
|
|
2496
2564
|
})), e.appendChild(t);
|
|
2497
|
-
const i =
|
|
2498
|
-
this._activeFiltersPanel = new
|
|
2565
|
+
const i = d("div", { className: "filter-right-column" });
|
|
2566
|
+
this._activeFiltersPanel = new Je(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
|
|
2499
2567
|
onRemove: (r) => this._handleFilterToggle(r, !1),
|
|
2500
2568
|
onReset: (r) => this._handleFilterReset(r),
|
|
2501
2569
|
onClearAll: () => this.resetAll(),
|
|
2502
2570
|
onSelect: (r) => this._handleFilterSelect(r)
|
|
2503
|
-
})), 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({
|
|
2504
2572
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2505
2573
|
onSelect: (r) => {
|
|
2506
2574
|
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2507
2575
|
}
|
|
2508
|
-
})), 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, {
|
|
2509
2577
|
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2510
2578
|
onReset: (r) => this._handleFilterReset(r),
|
|
2511
2579
|
onRemove: (r) => {
|
|
@@ -2619,22 +2687,37 @@ class Gt extends B {
|
|
|
2619
2687
|
}
|
|
2620
2688
|
/**
|
|
2621
2689
|
* Load an image into the editor
|
|
2622
|
-
* @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
|
|
2623
2694
|
*/
|
|
2624
|
-
async loadImage(e) {
|
|
2625
|
-
|
|
2626
|
-
|
|
2695
|
+
async loadImage(e, t = {}) {
|
|
2696
|
+
if (this._destroyed) return;
|
|
2697
|
+
const i = ++this._loadVersion;
|
|
2698
|
+
let r = e;
|
|
2699
|
+
this._resetEditorState(), e instanceof Blob && (r = URL.createObjectURL(e), this._objectUrls.add(r)), await this._renderer.loadTexture(r), !(this._destroyed || this._loadVersion !== i) && (this._state.set("hasImage", !0), this._state.set("imageUrl", r), t.state && this._hydrateState(t.state), this._options.initialMode === "crop" && this.setMode("crop"), this.emit("imageLoaded", { url: r }));
|
|
2627
2700
|
}
|
|
2628
2701
|
/**
|
|
2629
|
-
*
|
|
2630
|
-
*
|
|
2631
|
-
* @returns {Promise<string>}
|
|
2702
|
+
* Reset all editor state (filters + crop) to a clean baseline.
|
|
2703
|
+
* Called at the start of loadImage() to prevent stale state bleed between sessions.
|
|
2632
2704
|
*/
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2705
|
+
_resetEditorState() {
|
|
2706
|
+
this._filterManager.resetAll(), this._state.set("crop.rect", null), this._state.set("crop.appliedRect", null), this._state.set("crop.appliedShape", null), this._state.set("crop.appliedAspect", null), this._state.set("crop.shape", this._options.cropShape || "free"), this._state.set("crop.aspect", this._options.initialAspectRatio || "free"), this._state.get("mode") === "crop" && (this._cropManager.disable(), this._state.set("mode", "filters"));
|
|
2707
|
+
}
|
|
2708
|
+
/**
|
|
2709
|
+
* Hydrate editor state from a canonical ImageEditorSessionState object.
|
|
2710
|
+
* Restores filter stack + values and crop metadata (shape, aspect, rect).
|
|
2711
|
+
* @param {Object} state - ImageEditorSessionState
|
|
2712
|
+
*/
|
|
2713
|
+
_hydrateState(e) {
|
|
2714
|
+
if (!(!e || e.version !== 1) && (e.crop && (e.crop.rect && this._state.set("crop.rect", { ...e.crop.rect }), e.crop.shape && this._state.set("crop.shape", e.crop.shape), e.crop.aspectRatio && this._state.set("crop.aspect", e.crop.aspectRatio)), Array.isArray(e.filters))) {
|
|
2715
|
+
for (const t of e.filters)
|
|
2716
|
+
if (t.enabled && (this._state.toggleFilter(t.id, !0), this._filterManager.initializeValues(t.id), t.values))
|
|
2717
|
+
for (const [i, r] of Object.entries(t.values))
|
|
2718
|
+
this._state.setFilterValue(t.id, i, r);
|
|
2719
|
+
this._filterManager.applyFilters();
|
|
2720
|
+
}
|
|
2638
2721
|
}
|
|
2639
2722
|
/**
|
|
2640
2723
|
* Open the file picker dialog
|
|
@@ -2656,24 +2739,50 @@ class Gt extends B {
|
|
|
2656
2739
|
* Save the image (triggers download and emits 'save' event)
|
|
2657
2740
|
*/
|
|
2658
2741
|
save() {
|
|
2659
|
-
var e, t;
|
|
2660
2742
|
if (this._state.get("hasImage")) {
|
|
2661
2743
|
this._state.set("isSaving", !0);
|
|
2662
2744
|
try {
|
|
2663
|
-
const
|
|
2664
|
-
if (!
|
|
2665
|
-
const
|
|
2666
|
-
width: Math.round((
|
|
2667
|
-
height: Math.round((
|
|
2668
|
-
},
|
|
2669
|
-
|
|
2670
|
-
} catch (
|
|
2671
|
-
this.emit("error", { error:
|
|
2745
|
+
const e = this.exportImage("png", 0.92);
|
|
2746
|
+
if (!e) throw new Error("Failed to export image");
|
|
2747
|
+
const t = this._renderer.originalTexture, i = {
|
|
2748
|
+
width: Math.round((t == null ? void 0 : t.width) || 0),
|
|
2749
|
+
height: Math.round((t == null ? void 0 : t.height) || 0)
|
|
2750
|
+
}, r = document.createElement("a");
|
|
2751
|
+
r.href = e, r.download = `edited-image-${Date.now()}.png`, document.body.appendChild(r), r.click(), document.body.removeChild(r), this.emit("save", { imageData: e, dimensions: i, state: this.getSerializableState() });
|
|
2752
|
+
} catch (e) {
|
|
2753
|
+
this.emit("error", { error: e });
|
|
2672
2754
|
} finally {
|
|
2673
2755
|
this._state.set("isSaving", !1);
|
|
2674
2756
|
}
|
|
2675
2757
|
}
|
|
2676
2758
|
}
|
|
2759
|
+
/**
|
|
2760
|
+
* Get a canonical, serializable snapshot of the current editor state.
|
|
2761
|
+
* Safe for persistence — returns a deep copy with no mutable references.
|
|
2762
|
+
* @returns {Object} ImageEditorSessionState
|
|
2763
|
+
*/
|
|
2764
|
+
getSerializableState() {
|
|
2765
|
+
const e = this._state.get("activeFilters"), t = [];
|
|
2766
|
+
if (e)
|
|
2767
|
+
for (const o of e) {
|
|
2768
|
+
const n = this._state.getFilterValues(o);
|
|
2769
|
+
t.push({
|
|
2770
|
+
id: o,
|
|
2771
|
+
enabled: !0,
|
|
2772
|
+
values: { ...n }
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
const i = this._state.get("crop.appliedRect"), r = this._state.get("crop.rect"), a = i || r;
|
|
2776
|
+
return {
|
|
2777
|
+
version: 1,
|
|
2778
|
+
crop: {
|
|
2779
|
+
rect: a ? { ...a } : null,
|
|
2780
|
+
aspectRatio: this._state.get("crop.appliedAspect") || this._state.get("crop.aspect") || "free",
|
|
2781
|
+
shape: this._state.get("crop.appliedShape") || this._state.get("crop.shape") || "free"
|
|
2782
|
+
},
|
|
2783
|
+
filters: t
|
|
2784
|
+
};
|
|
2785
|
+
}
|
|
2677
2786
|
/**
|
|
2678
2787
|
* Close the editor (emits 'cancel' event)
|
|
2679
2788
|
*/
|
|
@@ -2775,9 +2884,9 @@ class Gt extends B {
|
|
|
2775
2884
|
_showLoadingOverlay(e) {
|
|
2776
2885
|
var i;
|
|
2777
2886
|
if (!this._loadingOverlay)
|
|
2778
|
-
this._loadingOverlay =
|
|
2779
|
-
|
|
2780
|
-
|
|
2887
|
+
this._loadingOverlay = d("div", { className: "editor-loading-overlay" }, [
|
|
2888
|
+
d("div", { className: "editor-loading-spinner" }),
|
|
2889
|
+
d("div", { className: "editor-loading-text" }, e)
|
|
2781
2890
|
]);
|
|
2782
2891
|
else {
|
|
2783
2892
|
const r = this._loadingOverlay.querySelector(".editor-loading-text");
|
|
@@ -2797,25 +2906,31 @@ class Gt extends B {
|
|
|
2797
2906
|
* Destroy the editor and clean up
|
|
2798
2907
|
*/
|
|
2799
2908
|
destroy() {
|
|
2800
|
-
var e, t, i, r, a, o, n, l, c,
|
|
2801
|
-
|
|
2909
|
+
var e, t, i, r, a, o, n, l, c, u;
|
|
2910
|
+
this._destroyed = !0;
|
|
2911
|
+
for (const h of this._objectUrls)
|
|
2912
|
+
try {
|
|
2913
|
+
URL.revokeObjectURL(h);
|
|
2914
|
+
} catch {
|
|
2915
|
+
}
|
|
2916
|
+
this._objectUrls.clear(), (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (u = this._editorEl) == null || u.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
|
|
2802
2917
|
}
|
|
2803
2918
|
}
|
|
2804
2919
|
const S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
2805
|
-
function
|
|
2920
|
+
function tt(s, e) {
|
|
2806
2921
|
return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
|
|
2807
2922
|
}
|
|
2808
2923
|
function f(s) {
|
|
2809
2924
|
var e;
|
|
2810
2925
|
return S.has(s.id), S.set(s.id, s), I.has(s.category) || I.set(s.category, []), (e = I.get(s.category)) == null || e.push(s.id), s;
|
|
2811
2926
|
}
|
|
2812
|
-
function
|
|
2927
|
+
function it(s) {
|
|
2813
2928
|
return S.get(s);
|
|
2814
2929
|
}
|
|
2815
2930
|
function U() {
|
|
2816
2931
|
return Array.from(S.values());
|
|
2817
2932
|
}
|
|
2818
|
-
function
|
|
2933
|
+
function rt() {
|
|
2819
2934
|
U().map((t) => t.id), Object.entries(g).filter(
|
|
2820
2935
|
(t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
|
|
2821
2936
|
).forEach(([t, i]) => {
|
|
@@ -2839,16 +2954,16 @@ function Je() {
|
|
|
2839
2954
|
});
|
|
2840
2955
|
});
|
|
2841
2956
|
}
|
|
2842
|
-
function
|
|
2957
|
+
function st(s) {
|
|
2843
2958
|
return (I.get(s) || []).map((t) => S.get(t)).filter(Boolean);
|
|
2844
2959
|
}
|
|
2845
|
-
function
|
|
2960
|
+
function at() {
|
|
2846
2961
|
return Array.from(I.keys());
|
|
2847
2962
|
}
|
|
2848
|
-
function
|
|
2963
|
+
function ti(s) {
|
|
2849
2964
|
return S.has(s);
|
|
2850
2965
|
}
|
|
2851
|
-
function
|
|
2966
|
+
function ot(s) {
|
|
2852
2967
|
const e = S.get(s);
|
|
2853
2968
|
if (!e)
|
|
2854
2969
|
return !1;
|
|
@@ -2860,11 +2975,11 @@ function it(s) {
|
|
|
2860
2975
|
}
|
|
2861
2976
|
return !0;
|
|
2862
2977
|
}
|
|
2863
|
-
function
|
|
2978
|
+
function ii(s, e) {
|
|
2864
2979
|
const t = S.get(s);
|
|
2865
|
-
return t ?
|
|
2980
|
+
return t ? tt(t, e) : !1;
|
|
2866
2981
|
}
|
|
2867
|
-
function
|
|
2982
|
+
function nt() {
|
|
2868
2983
|
return Array.from(S.values()).map((s) => ({
|
|
2869
2984
|
id: s.id,
|
|
2870
2985
|
name: s.name,
|
|
@@ -2873,7 +2988,7 @@ function rt() {
|
|
|
2873
2988
|
}));
|
|
2874
2989
|
}
|
|
2875
2990
|
if (typeof window < "u") {
|
|
2876
|
-
window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter =
|
|
2991
|
+
window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter = it, window.getFiltersByCategory = st, window.getRegisteredFilters = nt;
|
|
2877
2992
|
const s = f;
|
|
2878
2993
|
window.registerFilter = (e) => {
|
|
2879
2994
|
const t = s(e);
|
|
@@ -2883,7 +2998,7 @@ if (typeof window < "u") {
|
|
|
2883
2998
|
typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
|
|
2884
2999
|
return [];
|
|
2885
3000
|
});
|
|
2886
|
-
const { AdjustmentFilter:
|
|
3001
|
+
const { AdjustmentFilter: lt } = g, { ColorMatrixFilter: ct } = w, k = {
|
|
2887
3002
|
gamma: 1,
|
|
2888
3003
|
saturation: 1,
|
|
2889
3004
|
contrast: 1,
|
|
@@ -2892,7 +3007,7 @@ const { AdjustmentFilter: st } = g, { ColorMatrixFilter: at } = w, k = {
|
|
|
2892
3007
|
green: 1,
|
|
2893
3008
|
blue: 1,
|
|
2894
3009
|
alpha: 1
|
|
2895
|
-
},
|
|
3010
|
+
}, ht = /* @__PURE__ */ new Set([
|
|
2896
3011
|
"gamma",
|
|
2897
3012
|
"saturation",
|
|
2898
3013
|
"contrast",
|
|
@@ -2912,10 +3027,10 @@ function P(s, e) {
|
|
|
2912
3027
|
}
|
|
2913
3028
|
return e;
|
|
2914
3029
|
}
|
|
2915
|
-
function
|
|
2916
|
-
return
|
|
3030
|
+
function ee(s) {
|
|
3031
|
+
return ht.has(s);
|
|
2917
3032
|
}
|
|
2918
|
-
function
|
|
3033
|
+
function dt(s) {
|
|
2919
3034
|
return {
|
|
2920
3035
|
gamma: P(s.gamma, k.gamma),
|
|
2921
3036
|
saturation: P(s.saturation, k.saturation),
|
|
@@ -2927,7 +3042,7 @@ function nt(s) {
|
|
|
2927
3042
|
alpha: P(s.alpha, k.alpha)
|
|
2928
3043
|
};
|
|
2929
3044
|
}
|
|
2930
|
-
function
|
|
3045
|
+
function te(s, e) {
|
|
2931
3046
|
s.reset(), s.brightness(e.brightness, !0), s.contrast(e.contrast, !0), s.saturate(e.saturation, !0);
|
|
2932
3047
|
}
|
|
2933
3048
|
f({
|
|
@@ -2938,28 +3053,28 @@ f({
|
|
|
2938
3053
|
// Create an instance of the AdjustmentFilter with the provided parameters
|
|
2939
3054
|
createFilter: (s) => {
|
|
2940
3055
|
try {
|
|
2941
|
-
const e =
|
|
3056
|
+
const e = dt(s ?? {}), t = { ...e };
|
|
2942
3057
|
try {
|
|
2943
|
-
const i = new
|
|
3058
|
+
const i = new lt(t), r = i;
|
|
2944
3059
|
return r._customParams = { ...e }, r.updateUIParam = function(o, n) {
|
|
2945
3060
|
try {
|
|
2946
|
-
if (!
|
|
3061
|
+
if (!ee(o))
|
|
2947
3062
|
return;
|
|
2948
3063
|
const l = this._customParams ?? { ...k }, c = P(n, l[o]);
|
|
2949
3064
|
l[o] = c, this._customParams = l;
|
|
2950
|
-
const
|
|
2951
|
-
o in
|
|
3065
|
+
const u = this;
|
|
3066
|
+
o in u && (u[o] = c);
|
|
2952
3067
|
} catch {
|
|
2953
3068
|
}
|
|
2954
3069
|
}, i;
|
|
2955
3070
|
} catch {
|
|
2956
|
-
const r = new
|
|
2957
|
-
return a._customParams = { ...e },
|
|
3071
|
+
const r = new ct(), a = r;
|
|
3072
|
+
return a._customParams = { ...e }, te(r, e), a.updateUIParam = function(n, l) {
|
|
2958
3073
|
try {
|
|
2959
|
-
if (!
|
|
3074
|
+
if (!ee(n))
|
|
2960
3075
|
return;
|
|
2961
|
-
const c = this._customParams ?? { ...k },
|
|
2962
|
-
c[n] =
|
|
3076
|
+
const c = this._customParams ?? { ...k }, u = P(l, c[n]);
|
|
3077
|
+
c[n] = u, this._customParams = c, te(this, c);
|
|
2963
3078
|
} catch {
|
|
2964
3079
|
}
|
|
2965
3080
|
}, r;
|
|
@@ -3063,14 +3178,14 @@ f({
|
|
|
3063
3178
|
}
|
|
3064
3179
|
]
|
|
3065
3180
|
});
|
|
3066
|
-
const { ColorMatrixFilter:
|
|
3181
|
+
const { ColorMatrixFilter: ut } = w, N = {
|
|
3067
3182
|
brightness: 1,
|
|
3068
3183
|
contrast: 1,
|
|
3069
3184
|
saturation: 1,
|
|
3070
3185
|
hue: 0,
|
|
3071
3186
|
sepia: 0,
|
|
3072
3187
|
negative: !1
|
|
3073
|
-
},
|
|
3188
|
+
}, pt = /* @__PURE__ */ new Set([
|
|
3074
3189
|
"brightness",
|
|
3075
3190
|
"contrast",
|
|
3076
3191
|
"saturation",
|
|
@@ -3078,8 +3193,8 @@ const { ColorMatrixFilter: lt } = w, R = {
|
|
|
3078
3193
|
"sepia",
|
|
3079
3194
|
"negative"
|
|
3080
3195
|
]);
|
|
3081
|
-
function
|
|
3082
|
-
return
|
|
3196
|
+
function ft(s) {
|
|
3197
|
+
return pt.has(s);
|
|
3083
3198
|
}
|
|
3084
3199
|
function X(s, e) {
|
|
3085
3200
|
if (typeof s == "number" && Number.isFinite(s))
|
|
@@ -3091,7 +3206,7 @@ function X(s, e) {
|
|
|
3091
3206
|
}
|
|
3092
3207
|
return e;
|
|
3093
3208
|
}
|
|
3094
|
-
function
|
|
3209
|
+
function fe(s, e) {
|
|
3095
3210
|
if (typeof s == "boolean")
|
|
3096
3211
|
return s;
|
|
3097
3212
|
if (typeof s == "string") {
|
|
@@ -3102,17 +3217,17 @@ function pe(s, e) {
|
|
|
3102
3217
|
}
|
|
3103
3218
|
return e;
|
|
3104
3219
|
}
|
|
3105
|
-
function
|
|
3220
|
+
function mt(s) {
|
|
3106
3221
|
return {
|
|
3107
|
-
brightness: X(s.brightness,
|
|
3108
|
-
contrast: X(s.contrast,
|
|
3109
|
-
saturation: X(s.saturation,
|
|
3110
|
-
hue: X(s.hue,
|
|
3111
|
-
sepia: X(s.sepia,
|
|
3112
|
-
negative:
|
|
3222
|
+
brightness: X(s.brightness, N.brightness),
|
|
3223
|
+
contrast: X(s.contrast, N.contrast),
|
|
3224
|
+
saturation: X(s.saturation, N.saturation),
|
|
3225
|
+
hue: X(s.hue, N.hue),
|
|
3226
|
+
sepia: X(s.sepia, N.sepia),
|
|
3227
|
+
negative: fe(s.negative, N.negative)
|
|
3113
3228
|
};
|
|
3114
3229
|
}
|
|
3115
|
-
function
|
|
3230
|
+
function ie(s, e) {
|
|
3116
3231
|
s.reset(), e.brightness !== 1 && s.brightness(e.brightness, !0), e.contrast !== 1 && s.contrast(e.contrast, !0), e.saturation !== 1 && s.saturate(e.saturation, !0), e.hue !== 0 && s.hue(e.hue, !0), e.sepia > 0 && s.sepia(!0), e.negative && s.negative(!0);
|
|
3117
3232
|
}
|
|
3118
3233
|
f({
|
|
@@ -3123,19 +3238,19 @@ f({
|
|
|
3123
3238
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
3124
3239
|
createFilter: (s) => {
|
|
3125
3240
|
try {
|
|
3126
|
-
const e =
|
|
3127
|
-
return i._customParams = { ...e },
|
|
3241
|
+
const e = mt(s ?? {}), t = new ut(), i = t;
|
|
3242
|
+
return i._customParams = { ...e }, ie(t, e), i.updateUIParam = function(a, o) {
|
|
3128
3243
|
try {
|
|
3129
|
-
if (!
|
|
3244
|
+
if (!ft(a))
|
|
3130
3245
|
return;
|
|
3131
|
-
const n = this._customParams ?? { ...
|
|
3246
|
+
const n = this._customParams ?? { ...N };
|
|
3132
3247
|
if (a === "negative")
|
|
3133
|
-
n.negative =
|
|
3248
|
+
n.negative = fe(o, n.negative);
|
|
3134
3249
|
else {
|
|
3135
3250
|
const l = a;
|
|
3136
3251
|
n[l] = X(o, n[l]);
|
|
3137
3252
|
}
|
|
3138
|
-
this._customParams = n,
|
|
3253
|
+
this._customParams = n, ie(this, n);
|
|
3139
3254
|
} catch {
|
|
3140
3255
|
}
|
|
3141
3256
|
}, t;
|
|
@@ -3407,7 +3522,7 @@ f({
|
|
|
3407
3522
|
}
|
|
3408
3523
|
]
|
|
3409
3524
|
});
|
|
3410
|
-
const { ColorOverlayFilter:
|
|
3525
|
+
const { ColorOverlayFilter: gt } = g;
|
|
3411
3526
|
f({
|
|
3412
3527
|
id: "colorOverlay",
|
|
3413
3528
|
name: "Color Overlay",
|
|
@@ -3422,7 +3537,7 @@ f({
|
|
|
3422
3537
|
try {
|
|
3423
3538
|
let e = 16711680;
|
|
3424
3539
|
s.color && (typeof s.color == "string" ? e = parseInt(s.color.replace("#", "0x"), 16) : typeof s.color == "number" && (e = s.color));
|
|
3425
|
-
const t = new
|
|
3540
|
+
const t = new gt({
|
|
3426
3541
|
color: e,
|
|
3427
3542
|
alpha: s.alpha || 0.5
|
|
3428
3543
|
});
|
|
@@ -3510,8 +3625,8 @@ f({
|
|
|
3510
3625
|
switch (this._customParams = l, l[o] = n, o) {
|
|
3511
3626
|
case "color":
|
|
3512
3627
|
if (typeof n == "string") {
|
|
3513
|
-
const
|
|
3514
|
-
this.color =
|
|
3628
|
+
const u = parseInt(n.replace("#", "0x"), 16);
|
|
3629
|
+
this.color = u;
|
|
3515
3630
|
}
|
|
3516
3631
|
break;
|
|
3517
3632
|
case "alpha":
|
|
@@ -3654,7 +3769,7 @@ f({
|
|
|
3654
3769
|
}
|
|
3655
3770
|
]
|
|
3656
3771
|
});
|
|
3657
|
-
const { ColorMatrixFilter:
|
|
3772
|
+
const { ColorMatrixFilter: bt } = w;
|
|
3658
3773
|
f({
|
|
3659
3774
|
id: "grayscale",
|
|
3660
3775
|
name: "Grayscale",
|
|
@@ -3667,14 +3782,14 @@ f({
|
|
|
3667
3782
|
*/
|
|
3668
3783
|
createFilter: (s) => {
|
|
3669
3784
|
try {
|
|
3670
|
-
const e = new
|
|
3785
|
+
const e = new bt();
|
|
3671
3786
|
e._customParams = { ...s };
|
|
3672
3787
|
const t = s.intensity !== void 0 ? s.intensity : 1;
|
|
3673
|
-
return
|
|
3788
|
+
return re(e, t), e.updateUIParam = function(i, r) {
|
|
3674
3789
|
const a = this._customParams || {};
|
|
3675
3790
|
switch (this._customParams = a, a[i] = r, i) {
|
|
3676
3791
|
case "intensity":
|
|
3677
|
-
|
|
3792
|
+
re(this, r);
|
|
3678
3793
|
break;
|
|
3679
3794
|
default:
|
|
3680
3795
|
i in this && (this[i] = r);
|
|
@@ -3704,10 +3819,10 @@ f({
|
|
|
3704
3819
|
}
|
|
3705
3820
|
]
|
|
3706
3821
|
});
|
|
3707
|
-
function
|
|
3822
|
+
function re(s, e) {
|
|
3708
3823
|
s.reset(), s.greyscale(e);
|
|
3709
3824
|
}
|
|
3710
|
-
const { HslAdjustmentFilter:
|
|
3825
|
+
const { HslAdjustmentFilter: yt } = g;
|
|
3711
3826
|
f({
|
|
3712
3827
|
id: "hsl-adjustment",
|
|
3713
3828
|
name: "HSL Adjustment",
|
|
@@ -3719,7 +3834,7 @@ f({
|
|
|
3719
3834
|
*/
|
|
3720
3835
|
createFilter: (s) => {
|
|
3721
3836
|
try {
|
|
3722
|
-
const e = new
|
|
3837
|
+
const e = new yt({
|
|
3723
3838
|
hue: s.hue !== void 0 ? s.hue : 0,
|
|
3724
3839
|
saturation: s.saturation !== void 0 ? s.saturation : 0,
|
|
3725
3840
|
lightness: s.lightness !== void 0 ? s.lightness : 0,
|
|
@@ -3817,7 +3932,7 @@ f({
|
|
|
3817
3932
|
}
|
|
3818
3933
|
]
|
|
3819
3934
|
});
|
|
3820
|
-
const { KawaseBlurFilter:
|
|
3935
|
+
const { KawaseBlurFilter: _t } = g;
|
|
3821
3936
|
f({
|
|
3822
3937
|
id: "kawase-blur",
|
|
3823
3938
|
name: "Kawase Blur",
|
|
@@ -3830,7 +3945,7 @@ f({
|
|
|
3830
3945
|
*/
|
|
3831
3946
|
createFilter: (s) => {
|
|
3832
3947
|
try {
|
|
3833
|
-
const e = new
|
|
3948
|
+
const e = new _t({
|
|
3834
3949
|
strength: s.strength || 4,
|
|
3835
3950
|
quality: s.quality || 3,
|
|
3836
3951
|
clamp: s.clamp || !1,
|
|
@@ -3935,7 +4050,7 @@ f({
|
|
|
3935
4050
|
}
|
|
3936
4051
|
]
|
|
3937
4052
|
});
|
|
3938
|
-
const { MotionBlurFilter:
|
|
4053
|
+
const { MotionBlurFilter: xt } = g;
|
|
3939
4054
|
f({
|
|
3940
4055
|
id: "motion-blur",
|
|
3941
4056
|
name: "Motion Blur",
|
|
@@ -3948,7 +4063,7 @@ f({
|
|
|
3948
4063
|
*/
|
|
3949
4064
|
createFilter: (s) => {
|
|
3950
4065
|
try {
|
|
3951
|
-
const e = new
|
|
4066
|
+
const e = new xt({
|
|
3952
4067
|
velocity: {
|
|
3953
4068
|
x: s.velocityX !== void 0 ? s.velocityX : 0,
|
|
3954
4069
|
y: s.velocityY !== void 0 ? s.velocityY : 0
|
|
@@ -4043,7 +4158,7 @@ f({
|
|
|
4043
4158
|
}
|
|
4044
4159
|
]
|
|
4045
4160
|
});
|
|
4046
|
-
const { RadialBlurFilter:
|
|
4161
|
+
const { RadialBlurFilter: Ct } = g;
|
|
4047
4162
|
f({
|
|
4048
4163
|
id: "radial-blur",
|
|
4049
4164
|
name: "Radial Blur",
|
|
@@ -4052,7 +4167,7 @@ f({
|
|
|
4052
4167
|
// Create an instance of the RadialBlurFilter with the provided parameters
|
|
4053
4168
|
createFilter: (s) => {
|
|
4054
4169
|
try {
|
|
4055
|
-
const e = new
|
|
4170
|
+
const e = new Ct({
|
|
4056
4171
|
angle: s.angle ?? 20,
|
|
4057
4172
|
center: { x: s.centerX ?? 0, y: s.centerY ?? 0 },
|
|
4058
4173
|
kernelSize: s.kernelSize ?? 15,
|
|
@@ -4167,7 +4282,7 @@ f({
|
|
|
4167
4282
|
}
|
|
4168
4283
|
]
|
|
4169
4284
|
});
|
|
4170
|
-
const { TiltShiftFilter:
|
|
4285
|
+
const { TiltShiftFilter: wt } = g;
|
|
4171
4286
|
f({
|
|
4172
4287
|
id: "tilt-shift",
|
|
4173
4288
|
name: "Tilt Shift",
|
|
@@ -4176,7 +4291,7 @@ f({
|
|
|
4176
4291
|
// Create an instance of the TiltShiftFilter with the provided parameters
|
|
4177
4292
|
createFilter: (s) => {
|
|
4178
4293
|
try {
|
|
4179
|
-
const e = typeof s.blur == "number" ? s.blur : 100, t = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, i = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, o = typeof s.endY == "number" ? s.endY : 0.5, n = new
|
|
4294
|
+
const e = typeof s.blur == "number" ? s.blur : 100, t = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, i = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, o = typeof s.endY == "number" ? s.endY : 0.5, n = new wt({
|
|
4180
4295
|
blur: Number(e),
|
|
4181
4296
|
gradientBlur: Number(t),
|
|
4182
4297
|
start: { x: Number(i), y: Number(r) },
|
|
@@ -4191,28 +4306,28 @@ f({
|
|
|
4191
4306
|
endY: o
|
|
4192
4307
|
}, n.updateUIParam = function(l, c) {
|
|
4193
4308
|
try {
|
|
4194
|
-
const
|
|
4195
|
-
switch (this._customParams = h, h[l] =
|
|
4309
|
+
const u = Number(c), h = this._customParams || {};
|
|
4310
|
+
switch (this._customParams = h, h[l] = u, l) {
|
|
4196
4311
|
case "blur":
|
|
4197
|
-
this.blur =
|
|
4312
|
+
this.blur = u;
|
|
4198
4313
|
break;
|
|
4199
4314
|
case "gradientBlur":
|
|
4200
|
-
this.gradientBlur =
|
|
4315
|
+
this.gradientBlur = u;
|
|
4201
4316
|
break;
|
|
4202
4317
|
case "startX":
|
|
4203
|
-
this.start && typeof this.start == "object" && (this.start.x =
|
|
4318
|
+
this.start && typeof this.start == "object" && (this.start.x = u);
|
|
4204
4319
|
break;
|
|
4205
4320
|
case "startY":
|
|
4206
|
-
this.start && typeof this.start == "object" && (this.start.y =
|
|
4321
|
+
this.start && typeof this.start == "object" && (this.start.y = u);
|
|
4207
4322
|
break;
|
|
4208
4323
|
case "endX":
|
|
4209
|
-
this.end && typeof this.end == "object" && (this.end.x =
|
|
4324
|
+
this.end && typeof this.end == "object" && (this.end.x = u);
|
|
4210
4325
|
break;
|
|
4211
4326
|
case "endY":
|
|
4212
|
-
this.end && typeof this.end == "object" && (this.end.y =
|
|
4327
|
+
this.end && typeof this.end == "object" && (this.end.y = u);
|
|
4213
4328
|
break;
|
|
4214
4329
|
default:
|
|
4215
|
-
l in this && (this[l] =
|
|
4330
|
+
l in this && (this[l] = u);
|
|
4216
4331
|
break;
|
|
4217
4332
|
}
|
|
4218
4333
|
} catch {
|
|
@@ -4295,7 +4410,7 @@ f({
|
|
|
4295
4410
|
}
|
|
4296
4411
|
]
|
|
4297
4412
|
});
|
|
4298
|
-
const { ZoomBlurFilter:
|
|
4413
|
+
const { ZoomBlurFilter: St } = g;
|
|
4299
4414
|
f({
|
|
4300
4415
|
id: "zoom-blur",
|
|
4301
4416
|
name: "Zoom Blur",
|
|
@@ -4308,7 +4423,7 @@ f({
|
|
|
4308
4423
|
*/
|
|
4309
4424
|
createFilter: (s) => {
|
|
4310
4425
|
try {
|
|
4311
|
-
const e = new
|
|
4426
|
+
const e = new St({
|
|
4312
4427
|
strength: s.strength || 0.1,
|
|
4313
4428
|
center: {
|
|
4314
4429
|
x: s.centerX !== void 0 ? s.centerX : 0.5,
|
|
@@ -4422,7 +4537,7 @@ f({
|
|
|
4422
4537
|
}
|
|
4423
4538
|
]
|
|
4424
4539
|
});
|
|
4425
|
-
const { ColorGradientFilter:
|
|
4540
|
+
const { ColorGradientFilter: se } = g;
|
|
4426
4541
|
f({
|
|
4427
4542
|
id: "color-gradient",
|
|
4428
4543
|
name: "Color Gradient",
|
|
@@ -4446,7 +4561,7 @@ f({
|
|
|
4446
4561
|
{ offset: 0, color: 16711680, alpha: 1 },
|
|
4447
4562
|
{ offset: 1, color: 255, alpha: 1 }
|
|
4448
4563
|
]), e.sort((i, r) => i.offset - r.offset);
|
|
4449
|
-
const t = new
|
|
4564
|
+
const t = new se({
|
|
4450
4565
|
type: s.gradientType,
|
|
4451
4566
|
// 0: linear, 1: radial, 2: conic
|
|
4452
4567
|
stops: e,
|
|
@@ -4526,8 +4641,8 @@ f({
|
|
|
4526
4641
|
}));
|
|
4527
4642
|
break;
|
|
4528
4643
|
case "removeColorStop":
|
|
4529
|
-
const
|
|
4530
|
-
|
|
4644
|
+
const u = [...this.stops];
|
|
4645
|
+
u.length > 2 && (u.pop(), this.stops = u, a.colorStops = this.stops.map((h) => ({
|
|
4531
4646
|
offset: h.offset,
|
|
4532
4647
|
color: typeof h.color == "number" ? "#" + h.color.toString(16).padStart(6, "0") : h.color,
|
|
4533
4648
|
alpha: h.alpha
|
|
@@ -4536,7 +4651,7 @@ f({
|
|
|
4536
4651
|
case "cssGradient":
|
|
4537
4652
|
if (r && typeof r == "string" && r.trim() !== "")
|
|
4538
4653
|
try {
|
|
4539
|
-
const h = new
|
|
4654
|
+
const h = new se({ css: r });
|
|
4540
4655
|
this.type = h.type, this.angle = h.angle, this.stops = [...h.stops], a.colorStops = this.stops.map((p) => ({
|
|
4541
4656
|
offset: p.offset,
|
|
4542
4657
|
color: typeof p.color == "number" ? "#" + p.color.toString(16).padStart(6, "0") : p.color,
|
|
@@ -4561,7 +4676,7 @@ f({
|
|
|
4561
4676
|
if (h) {
|
|
4562
4677
|
const [p, m, C] = h, b = parseInt(m), y = [...this.stops];
|
|
4563
4678
|
if (b >= 0 && b < y.length)
|
|
4564
|
-
return C === "color" && typeof r == "string" ? y[b].color = parseInt(r.replace("#", "0x")) : (C === "offset" || C === "alpha") && (y[b][C] = r), this.stops = y, this.stops.sort((
|
|
4679
|
+
return C === "color" && typeof r == "string" ? y[b].color = parseInt(r.replace("#", "0x")) : (C === "offset" || C === "alpha") && (y[b][C] = r), this.stops = y, this.stops.sort((A, _) => A.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
|
|
4565
4680
|
}
|
|
4566
4681
|
} else i in this && (this[i] = r);
|
|
4567
4682
|
break;
|
|
@@ -4749,7 +4864,7 @@ f({
|
|
|
4749
4864
|
}
|
|
4750
4865
|
]
|
|
4751
4866
|
});
|
|
4752
|
-
const
|
|
4867
|
+
const vt = g.ColorReplaceFilter;
|
|
4753
4868
|
f({
|
|
4754
4869
|
id: "color-replace",
|
|
4755
4870
|
name: "Color Replace",
|
|
@@ -4766,7 +4881,7 @@ f({
|
|
|
4766
4881
|
s.originalColor && (typeof s.originalColor == "string" ? e = parseInt(s.originalColor.replace("#", "0x"), 16) : typeof s.originalColor == "number" && (e = s.originalColor));
|
|
4767
4882
|
let t = 255;
|
|
4768
4883
|
s.targetColor && (typeof s.targetColor == "string" ? t = parseInt(s.targetColor.replace("#", "0x"), 16) : typeof s.targetColor == "number" && (t = s.targetColor));
|
|
4769
|
-
const i = new
|
|
4884
|
+
const i = new vt({
|
|
4770
4885
|
originalColor: e,
|
|
4771
4886
|
targetColor: t,
|
|
4772
4887
|
tolerance: s.tolerance || 0.4
|
|
@@ -4830,7 +4945,7 @@ f({
|
|
|
4830
4945
|
}
|
|
4831
4946
|
]
|
|
4832
4947
|
});
|
|
4833
|
-
const
|
|
4948
|
+
const kt = g.MultiColorReplaceFilter;
|
|
4834
4949
|
f({
|
|
4835
4950
|
id: "multi-color-replace",
|
|
4836
4951
|
name: "Multi-Color Replace",
|
|
@@ -4856,7 +4971,7 @@ f({
|
|
|
4856
4971
|
const i = typeof s.originalColor3 == "string" ? parseInt(s.originalColor3.replace("#", "0x"), 16) : s.originalColor3, r = typeof s.targetColor3 == "string" ? parseInt(s.targetColor3.replace("#", "0x"), 16) : s.targetColor3;
|
|
4857
4972
|
e.push([i, r]);
|
|
4858
4973
|
}
|
|
4859
|
-
const t = new
|
|
4974
|
+
const t = new kt(
|
|
4860
4975
|
e,
|
|
4861
4976
|
s.tolerance || 0.05,
|
|
4862
4977
|
3
|
|
@@ -4967,7 +5082,7 @@ f({
|
|
|
4967
5082
|
}
|
|
4968
5083
|
]
|
|
4969
5084
|
});
|
|
4970
|
-
const { RGBSplitFilter:
|
|
5085
|
+
const { RGBSplitFilter: Pt } = g;
|
|
4971
5086
|
f({
|
|
4972
5087
|
id: "rgb-split",
|
|
4973
5088
|
name: "RGB Split",
|
|
@@ -4988,7 +5103,7 @@ f({
|
|
|
4988
5103
|
}, i = {
|
|
4989
5104
|
x: s.blueX !== void 0 ? s.blueX : 0,
|
|
4990
5105
|
y: s.blueY !== void 0 ? s.blueY : 0
|
|
4991
|
-
}, r = new
|
|
5106
|
+
}, r = new Pt({
|
|
4992
5107
|
red: e,
|
|
4993
5108
|
green: t,
|
|
4994
5109
|
blue: i
|
|
@@ -5101,7 +5216,7 @@ f({
|
|
|
5101
5216
|
}
|
|
5102
5217
|
]
|
|
5103
5218
|
});
|
|
5104
|
-
const { AdvancedBloomFilter:
|
|
5219
|
+
const { AdvancedBloomFilter: Mt } = g;
|
|
5105
5220
|
f({
|
|
5106
5221
|
id: "advanced-bloom",
|
|
5107
5222
|
name: "Advanced Bloom",
|
|
@@ -5110,7 +5225,7 @@ f({
|
|
|
5110
5225
|
// Create an instance of the AdvancedBloomFilter with the provided parameters
|
|
5111
5226
|
createFilter: (s) => {
|
|
5112
5227
|
try {
|
|
5113
|
-
const e = new
|
|
5228
|
+
const e = new Mt({
|
|
5114
5229
|
threshold: s.threshold || 0.5,
|
|
5115
5230
|
bloomScale: s.bloomScale || 1,
|
|
5116
5231
|
brightness: s.brightness || 1,
|
|
@@ -5257,7 +5372,7 @@ f({
|
|
|
5257
5372
|
}
|
|
5258
5373
|
]
|
|
5259
5374
|
});
|
|
5260
|
-
const
|
|
5375
|
+
const Ft = g.AsciiFilter;
|
|
5261
5376
|
f({
|
|
5262
5377
|
id: "ascii",
|
|
5263
5378
|
name: "ASCII",
|
|
@@ -5269,7 +5384,7 @@ f({
|
|
|
5269
5384
|
const e = typeof s.size == "number" ? s.size : 8;
|
|
5270
5385
|
let t = s.color;
|
|
5271
5386
|
typeof t == "string" && t.startsWith("#") && (t = parseInt(t.replace("#", "0x"), 16));
|
|
5272
|
-
const i = s.replaceColor === !0, r = new
|
|
5387
|
+
const i = s.replaceColor === !0, r = new Ft({
|
|
5273
5388
|
size: e,
|
|
5274
5389
|
color: t,
|
|
5275
5390
|
replaceColor: i
|
|
@@ -5336,7 +5451,7 @@ f({
|
|
|
5336
5451
|
}
|
|
5337
5452
|
]
|
|
5338
5453
|
});
|
|
5339
|
-
const
|
|
5454
|
+
const At = g.BackdropBlurFilter;
|
|
5340
5455
|
f({
|
|
5341
5456
|
id: "backdrop-blur",
|
|
5342
5457
|
name: "Backdrop Blur",
|
|
@@ -5345,7 +5460,7 @@ f({
|
|
|
5345
5460
|
// Create an instance of the BackdropBlurFilter with the provided parameters
|
|
5346
5461
|
createFilter: (s) => {
|
|
5347
5462
|
try {
|
|
5348
|
-
const e = new
|
|
5463
|
+
const e = new At({
|
|
5349
5464
|
// Higher strength values (20-50) make the effect more noticeable
|
|
5350
5465
|
strength: s.strength || 20,
|
|
5351
5466
|
quality: s.quality || 4,
|
|
@@ -5443,7 +5558,7 @@ f({
|
|
|
5443
5558
|
}
|
|
5444
5559
|
]
|
|
5445
5560
|
});
|
|
5446
|
-
const { BevelFilter:
|
|
5561
|
+
const { BevelFilter: zt } = g;
|
|
5447
5562
|
f({
|
|
5448
5563
|
id: "bevel",
|
|
5449
5564
|
name: "Bevel",
|
|
@@ -5455,7 +5570,7 @@ f({
|
|
|
5455
5570
|
*/
|
|
5456
5571
|
createFilter: (s) => {
|
|
5457
5572
|
try {
|
|
5458
|
-
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new
|
|
5573
|
+
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new zt({
|
|
5459
5574
|
rotation: s.rotation !== void 0 ? s.rotation : 45,
|
|
5460
5575
|
thickness: s.thickness !== void 0 ? s.thickness : 2,
|
|
5461
5576
|
lightColor: parseInt(e, 16),
|
|
@@ -5571,7 +5686,7 @@ f({
|
|
|
5571
5686
|
}
|
|
5572
5687
|
]
|
|
5573
5688
|
});
|
|
5574
|
-
const { BloomFilter:
|
|
5689
|
+
const { BloomFilter: Rt } = g;
|
|
5575
5690
|
f({
|
|
5576
5691
|
id: "bloom",
|
|
5577
5692
|
name: "Bloom/Glow",
|
|
@@ -5580,7 +5695,7 @@ f({
|
|
|
5580
5695
|
// Create an instance of the BloomFilter with the provided parameters
|
|
5581
5696
|
createFilter: (s) => {
|
|
5582
5697
|
try {
|
|
5583
|
-
const e = typeof s.strengthX == "number" ? s.strengthX : 2, t = typeof s.strengthY == "number" ? s.strengthY : 2, i = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, o = new
|
|
5698
|
+
const e = typeof s.strengthX == "number" ? s.strengthX : 2, t = typeof s.strengthY == "number" ? s.strengthY : 2, i = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, o = new Rt({
|
|
5584
5699
|
strength: {
|
|
5585
5700
|
x: Number(e),
|
|
5586
5701
|
y: Number(t)
|
|
@@ -5596,7 +5711,7 @@ f({
|
|
|
5596
5711
|
resolution: r,
|
|
5597
5712
|
kernelSize: a
|
|
5598
5713
|
}, o.updateUIParam = function(n, l) {
|
|
5599
|
-
var c,
|
|
5714
|
+
var c, u;
|
|
5600
5715
|
try {
|
|
5601
5716
|
const h = Number(l), p = this._customParams || {};
|
|
5602
5717
|
switch (this._customParams = p, p[n] = h, n) {
|
|
@@ -5604,7 +5719,7 @@ f({
|
|
|
5604
5719
|
this.strength && typeof this.strength == "object" && (this.strength.x = h, (c = this._updateStrength) == null || c.call(this));
|
|
5605
5720
|
break;
|
|
5606
5721
|
case "strengthY":
|
|
5607
|
-
this.strength && typeof this.strength == "object" && (this.strength.y = h, (
|
|
5722
|
+
this.strength && typeof this.strength == "object" && (this.strength.y = h, (u = this._updateStrength) == null || u.call(this));
|
|
5608
5723
|
break;
|
|
5609
5724
|
case "quality":
|
|
5610
5725
|
this.quality = h;
|
|
@@ -5683,7 +5798,7 @@ f({
|
|
|
5683
5798
|
}
|
|
5684
5799
|
]
|
|
5685
5800
|
});
|
|
5686
|
-
const { BulgePinchFilter:
|
|
5801
|
+
const { BulgePinchFilter: Nt } = g;
|
|
5687
5802
|
f({
|
|
5688
5803
|
id: "bulge-pinch",
|
|
5689
5804
|
// ID must match what the application expects
|
|
@@ -5693,7 +5808,7 @@ f({
|
|
|
5693
5808
|
// Create an instance of the BulgePinchFilter with the provided parameters
|
|
5694
5809
|
createFilter: (s) => {
|
|
5695
5810
|
try {
|
|
5696
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new
|
|
5811
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new Nt({
|
|
5697
5812
|
center: {
|
|
5698
5813
|
x: e,
|
|
5699
5814
|
y: t
|
|
@@ -5775,7 +5890,7 @@ f({
|
|
|
5775
5890
|
}
|
|
5776
5891
|
]
|
|
5777
5892
|
});
|
|
5778
|
-
const { ConvolutionFilter:
|
|
5893
|
+
const { ConvolutionFilter: Tt } = g, E = {
|
|
5779
5894
|
normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
|
|
5780
5895
|
gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
|
|
5781
5896
|
boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
|
|
@@ -5810,7 +5925,7 @@ f({
|
|
|
5810
5925
|
const i = s.preset;
|
|
5811
5926
|
e = E[i] || E.normal;
|
|
5812
5927
|
}
|
|
5813
|
-
const t = new
|
|
5928
|
+
const t = new Tt(e, s.width || 200, s.height || 200);
|
|
5814
5929
|
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
5815
5930
|
const a = this._customParams || {};
|
|
5816
5931
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -6021,7 +6136,7 @@ f({
|
|
|
6021
6136
|
}
|
|
6022
6137
|
]
|
|
6023
6138
|
});
|
|
6024
|
-
const { CrossHatchFilter:
|
|
6139
|
+
const { CrossHatchFilter: It } = g;
|
|
6025
6140
|
f({
|
|
6026
6141
|
id: "cross-hatch",
|
|
6027
6142
|
name: "Cross Hatch",
|
|
@@ -6031,7 +6146,7 @@ f({
|
|
|
6031
6146
|
// Note: CrossHatchFilter has NO parameters according to PixiJS examples
|
|
6032
6147
|
createFilter: (s) => {
|
|
6033
6148
|
try {
|
|
6034
|
-
const e = new
|
|
6149
|
+
const e = new It();
|
|
6035
6150
|
return e.updateUIParam = function(t, i) {
|
|
6036
6151
|
return !0;
|
|
6037
6152
|
}, e;
|
|
@@ -6228,7 +6343,7 @@ f({
|
|
|
6228
6343
|
}
|
|
6229
6344
|
]
|
|
6230
6345
|
});
|
|
6231
|
-
const
|
|
6346
|
+
const Et = w.DisplacementFilter, Xt = w.Sprite, $ = w.Texture;
|
|
6232
6347
|
f({
|
|
6233
6348
|
id: "displacement",
|
|
6234
6349
|
// ID must match what the application expects
|
|
@@ -6241,7 +6356,7 @@ f({
|
|
|
6241
6356
|
const e = s.mapTexture || "/assets/images/displacement_map.png";
|
|
6242
6357
|
let t;
|
|
6243
6358
|
try {
|
|
6244
|
-
t =
|
|
6359
|
+
t = $.from(e), t.source.addressMode = "repeat";
|
|
6245
6360
|
} catch {
|
|
6246
6361
|
const o = document.createElement("canvas");
|
|
6247
6362
|
o.width = 256, o.height = 256;
|
|
@@ -6252,9 +6367,9 @@ f({
|
|
|
6252
6367
|
for (let c = 0; c < 10; c++)
|
|
6253
6368
|
(l + c) % 2 === 0 && n.fillRect(l * 25, c * 25, 25, 25);
|
|
6254
6369
|
}
|
|
6255
|
-
t =
|
|
6370
|
+
t = $.from(o);
|
|
6256
6371
|
}
|
|
6257
|
-
const i = new
|
|
6372
|
+
const i = new Xt(t), r = new Et(i, s.scale || 50);
|
|
6258
6373
|
return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = i, r.updateUIParam = function(a, o) {
|
|
6259
6374
|
const n = this._customParams || {};
|
|
6260
6375
|
switch (this._customParams = n, n[a] = o, a) {
|
|
@@ -6268,7 +6383,7 @@ f({
|
|
|
6268
6383
|
try {
|
|
6269
6384
|
const l = this._displacementSprite;
|
|
6270
6385
|
if (l) {
|
|
6271
|
-
const c =
|
|
6386
|
+
const c = $.from(o);
|
|
6272
6387
|
c.source.addressMode = "repeat", l.texture = c;
|
|
6273
6388
|
}
|
|
6274
6389
|
} catch {
|
|
@@ -6401,7 +6516,7 @@ f({
|
|
|
6401
6516
|
}
|
|
6402
6517
|
]
|
|
6403
6518
|
});
|
|
6404
|
-
const { EmbossFilter:
|
|
6519
|
+
const { EmbossFilter: Yt } = g;
|
|
6405
6520
|
f({
|
|
6406
6521
|
id: "emboss",
|
|
6407
6522
|
name: "Emboss",
|
|
@@ -6410,7 +6525,7 @@ f({
|
|
|
6410
6525
|
// Create an instance of the Emboss filter with the provided parameters
|
|
6411
6526
|
createFilter: (s) => {
|
|
6412
6527
|
try {
|
|
6413
|
-
const e = typeof s.strength == "number" ? s.strength : 5, t = new
|
|
6528
|
+
const e = typeof s.strength == "number" ? s.strength : 5, t = new Yt(e);
|
|
6414
6529
|
return t._customParams = {
|
|
6415
6530
|
strength: e
|
|
6416
6531
|
}, t.updateUIParam = function(i, r) {
|
|
@@ -6450,7 +6565,7 @@ f({
|
|
|
6450
6565
|
}
|
|
6451
6566
|
]
|
|
6452
6567
|
});
|
|
6453
|
-
const { GlitchFilter:
|
|
6568
|
+
const { GlitchFilter: Bt } = g, R = {
|
|
6454
6569
|
TRANSPARENT: 0,
|
|
6455
6570
|
ORIGINAL: 1,
|
|
6456
6571
|
LOOP: 2,
|
|
@@ -6464,7 +6579,7 @@ f({
|
|
|
6464
6579
|
description: "Apply digital distortion and glitch effects",
|
|
6465
6580
|
createFilter: (s) => {
|
|
6466
6581
|
try {
|
|
6467
|
-
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new
|
|
6582
|
+
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new Bt({
|
|
6468
6583
|
slices: s.slices,
|
|
6469
6584
|
offset: s.offset,
|
|
6470
6585
|
direction: s.direction,
|
|
@@ -6495,8 +6610,8 @@ f({
|
|
|
6495
6610
|
break;
|
|
6496
6611
|
case "redX":
|
|
6497
6612
|
case "redY":
|
|
6498
|
-
const
|
|
6499
|
-
n === "redX" ?
|
|
6613
|
+
const u = this.red;
|
|
6614
|
+
n === "redX" ? u.x = l : u.y = l, this.red = u;
|
|
6500
6615
|
break;
|
|
6501
6616
|
case "greenX":
|
|
6502
6617
|
case "greenY":
|
|
@@ -6542,7 +6657,7 @@ f({
|
|
|
6542
6657
|
slices: 10,
|
|
6543
6658
|
offset: 100,
|
|
6544
6659
|
direction: 0,
|
|
6545
|
-
fillMode:
|
|
6660
|
+
fillMode: R.LOOP,
|
|
6546
6661
|
// LOOP mode looks better for the demo
|
|
6547
6662
|
seed: 0.5,
|
|
6548
6663
|
average: !1,
|
|
@@ -6605,13 +6720,13 @@ f({
|
|
|
6605
6720
|
label: "Fill Mode",
|
|
6606
6721
|
property: "fillMode",
|
|
6607
6722
|
options: [
|
|
6608
|
-
{ value:
|
|
6609
|
-
{ value:
|
|
6610
|
-
{ value:
|
|
6611
|
-
{ value:
|
|
6612
|
-
{ value:
|
|
6723
|
+
{ value: R.TRANSPARENT, label: "Transparent" },
|
|
6724
|
+
{ value: R.ORIGINAL, label: "Original" },
|
|
6725
|
+
{ value: R.LOOP, label: "Loop" },
|
|
6726
|
+
{ value: R.CLAMP, label: "Clamp" },
|
|
6727
|
+
{ value: R.MIRROR, label: "Mirror" }
|
|
6613
6728
|
],
|
|
6614
|
-
default:
|
|
6729
|
+
default: R.LOOP
|
|
6615
6730
|
},
|
|
6616
6731
|
{
|
|
6617
6732
|
id: "seed",
|
|
@@ -6705,7 +6820,7 @@ f({
|
|
|
6705
6820
|
}
|
|
6706
6821
|
]
|
|
6707
6822
|
});
|
|
6708
|
-
const { GlowFilter:
|
|
6823
|
+
const { GlowFilter: Ot } = g;
|
|
6709
6824
|
f({
|
|
6710
6825
|
id: "glow",
|
|
6711
6826
|
name: "Glow",
|
|
@@ -6714,7 +6829,7 @@ f({
|
|
|
6714
6829
|
// Create an instance of the GlowFilter with the provided parameters
|
|
6715
6830
|
createFilter: (s) => {
|
|
6716
6831
|
try {
|
|
6717
|
-
const e = parseInt(s.color.replace("#", "0x"), 16), t = new
|
|
6832
|
+
const e = parseInt(s.color.replace("#", "0x"), 16), t = new Ot({
|
|
6718
6833
|
distance: s.distance || 10,
|
|
6719
6834
|
outerStrength: s.outerStrength || 4,
|
|
6720
6835
|
innerStrength: s.innerStrength || 0,
|
|
@@ -6840,7 +6955,7 @@ f({
|
|
|
6840
6955
|
}
|
|
6841
6956
|
]
|
|
6842
6957
|
});
|
|
6843
|
-
const { GodrayFilter:
|
|
6958
|
+
const { GodrayFilter: Lt } = g;
|
|
6844
6959
|
f({
|
|
6845
6960
|
id: "godray",
|
|
6846
6961
|
name: "Godray",
|
|
@@ -6849,7 +6964,7 @@ f({
|
|
|
6849
6964
|
// Create an instance of the GodrayFilter with the provided parameters
|
|
6850
6965
|
createFilter: (s) => {
|
|
6851
6966
|
try {
|
|
6852
|
-
const e = new
|
|
6967
|
+
const e = new Lt({
|
|
6853
6968
|
angle: s.angle || 30,
|
|
6854
6969
|
parallel: s.parallel ?? !0,
|
|
6855
6970
|
center: {
|
|
@@ -7002,7 +7117,7 @@ f({
|
|
|
7002
7117
|
}
|
|
7003
7118
|
]
|
|
7004
7119
|
});
|
|
7005
|
-
const
|
|
7120
|
+
const Dt = g.SimpleLightmapFilter, ae = w.Texture;
|
|
7006
7121
|
f({
|
|
7007
7122
|
id: "lightmap",
|
|
7008
7123
|
name: "Lightmap",
|
|
@@ -7027,40 +7142,40 @@ f({
|
|
|
7027
7142
|
const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7028
7143
|
c.addColorStop(0, "white"), c.addColorStop(0.3, "rgba(220, 220, 220, 1)"), c.addColorStop(0.6, "rgba(150, 150, 150, 1)"), c.addColorStop(1, "black"), a.fillStyle = c, a.fillRect(0, 0, 256, 256);
|
|
7029
7144
|
}
|
|
7030
|
-
const o =
|
|
7145
|
+
const o = ae.from(r);
|
|
7031
7146
|
let n;
|
|
7032
7147
|
try {
|
|
7033
7148
|
typeof t == "string" && t.startsWith("#") ? n = parseInt(t.replace("#", "0x"), 16) : n = 0;
|
|
7034
7149
|
} catch {
|
|
7035
7150
|
n = 0;
|
|
7036
7151
|
}
|
|
7037
|
-
const l = new
|
|
7152
|
+
const l = new Dt(o, n, i);
|
|
7038
7153
|
return l._customParams = {
|
|
7039
7154
|
textureType: e,
|
|
7040
7155
|
color: t,
|
|
7041
7156
|
alpha: i
|
|
7042
|
-
}, l.updateUIParam = function(c,
|
|
7157
|
+
}, l.updateUIParam = function(c, u) {
|
|
7043
7158
|
try {
|
|
7044
7159
|
const h = this._customParams || {};
|
|
7045
|
-
switch (this._customParams = h, h[c] =
|
|
7160
|
+
switch (this._customParams = h, h[c] = u, c) {
|
|
7046
7161
|
case "textureType":
|
|
7047
|
-
h.textureType =
|
|
7162
|
+
h.textureType = u;
|
|
7048
7163
|
const p = document.createElement("canvas");
|
|
7049
7164
|
p.width = 256, p.height = 256;
|
|
7050
7165
|
const m = p.getContext("2d");
|
|
7051
7166
|
if (m) {
|
|
7052
|
-
if (
|
|
7167
|
+
if (u === "spotlight") {
|
|
7053
7168
|
m.fillStyle = "black", m.fillRect(0, 0, 256, 256);
|
|
7054
7169
|
const b = m.createRadialGradient(128, 128, 5, 128, 128, 80);
|
|
7055
7170
|
b.addColorStop(0, "white"), b.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), b.addColorStop(1, "rgba(0, 0, 0, 0)"), m.fillStyle = b, m.beginPath(), m.arc(128, 128, 100, 0, Math.PI * 2), m.fill();
|
|
7056
|
-
} else if (
|
|
7171
|
+
} else if (u === "softlight") {
|
|
7057
7172
|
const b = m.createLinearGradient(0, 0, 256, 256);
|
|
7058
7173
|
b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.7, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "rgba(80, 80, 80, 1)"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
|
|
7059
7174
|
} else {
|
|
7060
7175
|
const b = m.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7061
7176
|
b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.6, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "black"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
|
|
7062
7177
|
}
|
|
7063
|
-
const C =
|
|
7178
|
+
const C = ae.from(p);
|
|
7064
7179
|
if (this.lightMap = C, this.enabled !== void 0) {
|
|
7065
7180
|
const b = this.enabled;
|
|
7066
7181
|
this.enabled = !1, setTimeout(() => {
|
|
@@ -7070,18 +7185,18 @@ f({
|
|
|
7070
7185
|
}
|
|
7071
7186
|
break;
|
|
7072
7187
|
case "color":
|
|
7073
|
-
h.color =
|
|
7188
|
+
h.color = u;
|
|
7074
7189
|
try {
|
|
7075
|
-
typeof
|
|
7190
|
+
typeof u == "string" && u.startsWith("#") ? this.color = parseInt(u.replace("#", "0x"), 16) : this.color = 0;
|
|
7076
7191
|
} catch {
|
|
7077
7192
|
this.color = 0;
|
|
7078
7193
|
}
|
|
7079
7194
|
break;
|
|
7080
7195
|
case "alpha":
|
|
7081
|
-
this.alpha = Number(
|
|
7196
|
+
this.alpha = Number(u);
|
|
7082
7197
|
break;
|
|
7083
7198
|
default:
|
|
7084
|
-
c in this && (this[c] =
|
|
7199
|
+
c in this && (this[c] = u);
|
|
7085
7200
|
break;
|
|
7086
7201
|
}
|
|
7087
7202
|
} catch {
|
|
@@ -7133,7 +7248,7 @@ f({
|
|
|
7133
7248
|
}
|
|
7134
7249
|
]
|
|
7135
7250
|
});
|
|
7136
|
-
const { NoiseFilter:
|
|
7251
|
+
const { NoiseFilter: Ut } = w;
|
|
7137
7252
|
f({
|
|
7138
7253
|
id: "noise",
|
|
7139
7254
|
name: "Noise",
|
|
@@ -7141,7 +7256,7 @@ f({
|
|
|
7141
7256
|
description: "Add random noise to the image",
|
|
7142
7257
|
createFilter: (s) => {
|
|
7143
7258
|
try {
|
|
7144
|
-
const e = new
|
|
7259
|
+
const e = new Ut({
|
|
7145
7260
|
noise: s.noise || 0.5,
|
|
7146
7261
|
seed: s.seed || Math.random()
|
|
7147
7262
|
});
|
|
@@ -7218,7 +7333,7 @@ f({
|
|
|
7218
7333
|
}
|
|
7219
7334
|
]
|
|
7220
7335
|
});
|
|
7221
|
-
const { OldFilmFilter:
|
|
7336
|
+
const { OldFilmFilter: Vt } = g;
|
|
7222
7337
|
f({
|
|
7223
7338
|
id: "old-film",
|
|
7224
7339
|
name: "Old Film",
|
|
@@ -7226,7 +7341,7 @@ f({
|
|
|
7226
7341
|
description: "Apply a vintage film effect with scratches and grain",
|
|
7227
7342
|
createFilter: (s) => {
|
|
7228
7343
|
try {
|
|
7229
|
-
const e = new
|
|
7344
|
+
const e = new Vt({
|
|
7230
7345
|
sepia: s.sepia,
|
|
7231
7346
|
noise: s.noise,
|
|
7232
7347
|
noiseSize: s.noiseSize,
|
|
@@ -7407,7 +7522,7 @@ f({
|
|
|
7407
7522
|
}
|
|
7408
7523
|
]
|
|
7409
7524
|
});
|
|
7410
|
-
const { OutlineFilter:
|
|
7525
|
+
const { OutlineFilter: jt } = g;
|
|
7411
7526
|
f({
|
|
7412
7527
|
id: "outline",
|
|
7413
7528
|
name: "Outline",
|
|
@@ -7417,7 +7532,7 @@ f({
|
|
|
7417
7532
|
try {
|
|
7418
7533
|
let e = s.color;
|
|
7419
7534
|
typeof e == "string" && (e = parseInt(e.replace("#", "0x"), 16));
|
|
7420
|
-
const t = new
|
|
7535
|
+
const t = new jt({
|
|
7421
7536
|
thickness: s.thickness || 4,
|
|
7422
7537
|
color: e,
|
|
7423
7538
|
alpha: s.alpha || 1,
|
|
@@ -7507,7 +7622,7 @@ f({
|
|
|
7507
7622
|
}
|
|
7508
7623
|
]
|
|
7509
7624
|
});
|
|
7510
|
-
const { PixelateFilter:
|
|
7625
|
+
const { PixelateFilter: qt } = g;
|
|
7511
7626
|
f({
|
|
7512
7627
|
id: "pixelate",
|
|
7513
7628
|
name: "Pixelate",
|
|
@@ -7515,7 +7630,7 @@ f({
|
|
|
7515
7630
|
description: "Create a pixelated or mosaic effect",
|
|
7516
7631
|
createFilter: (s) => {
|
|
7517
7632
|
try {
|
|
7518
|
-
const e = new
|
|
7633
|
+
const e = new qt(
|
|
7519
7634
|
s.useUniform ? Math.max(4, s.size || 10) : [Math.max(4, s.sizeX || 10), Math.max(4, s.sizeY || 10)]
|
|
7520
7635
|
);
|
|
7521
7636
|
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
@@ -7598,7 +7713,7 @@ f({
|
|
|
7598
7713
|
}
|
|
7599
7714
|
]
|
|
7600
7715
|
});
|
|
7601
|
-
const { ReflectionFilter:
|
|
7716
|
+
const { ReflectionFilter: Ht } = g;
|
|
7602
7717
|
f({
|
|
7603
7718
|
id: "reflection",
|
|
7604
7719
|
// ID must match what the application expects
|
|
@@ -7615,7 +7730,7 @@ f({
|
|
|
7615
7730
|
waveLength: new Float32Array([s.wavelengthStart ?? 30, s.wavelengthEnd ?? 100]),
|
|
7616
7731
|
alpha: new Float32Array([s.alphaStart ?? 1, s.alphaEnd ?? 1]),
|
|
7617
7732
|
time: s.time ?? 0
|
|
7618
|
-
}, t = new
|
|
7733
|
+
}, t = new Ht(e);
|
|
7619
7734
|
return t._customParams = { ...s }, t.animating = s.animating ?? !1, t.updateUIParam = function(i, r) {
|
|
7620
7735
|
const a = this._customParams || {};
|
|
7621
7736
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -7766,7 +7881,7 @@ f({
|
|
|
7766
7881
|
}
|
|
7767
7882
|
]
|
|
7768
7883
|
});
|
|
7769
|
-
const { ShockwaveFilter:
|
|
7884
|
+
const { ShockwaveFilter: $t } = g;
|
|
7770
7885
|
f({
|
|
7771
7886
|
id: "shockwave",
|
|
7772
7887
|
// ID must match what the application expects
|
|
@@ -7776,7 +7891,7 @@ f({
|
|
|
7776
7891
|
// Create an instance of the ShockwaveFilter with the provided parameters
|
|
7777
7892
|
createFilter: (s) => {
|
|
7778
7893
|
try {
|
|
7779
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0,
|
|
7894
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0, u = new $t({
|
|
7780
7895
|
center: i,
|
|
7781
7896
|
amplitude: r,
|
|
7782
7897
|
wavelength: a,
|
|
@@ -7785,7 +7900,7 @@ f({
|
|
|
7785
7900
|
radius: l,
|
|
7786
7901
|
time: c
|
|
7787
7902
|
});
|
|
7788
|
-
return
|
|
7903
|
+
return u._customParams = { ...s }, u.animating = s.animating ?? !1, u.updateUIParam = function(h, p) {
|
|
7789
7904
|
const m = this._customParams || {};
|
|
7790
7905
|
switch (this._customParams = m, m[h] = p, h) {
|
|
7791
7906
|
case "centerX":
|
|
@@ -7810,7 +7925,7 @@ f({
|
|
|
7810
7925
|
break;
|
|
7811
7926
|
}
|
|
7812
7927
|
return !0;
|
|
7813
|
-
},
|
|
7928
|
+
}, u;
|
|
7814
7929
|
} catch {
|
|
7815
7930
|
return null;
|
|
7816
7931
|
}
|
|
@@ -7918,7 +8033,7 @@ f({
|
|
|
7918
8033
|
}
|
|
7919
8034
|
]
|
|
7920
8035
|
});
|
|
7921
|
-
const { SimplexNoiseFilter:
|
|
8036
|
+
const { SimplexNoiseFilter: Wt } = g;
|
|
7922
8037
|
f({
|
|
7923
8038
|
id: "simplex-noise",
|
|
7924
8039
|
name: "Simplex Noise",
|
|
@@ -7926,7 +8041,7 @@ f({
|
|
|
7926
8041
|
description: "Apply procedural noise to create texture effects",
|
|
7927
8042
|
createFilter: (s) => {
|
|
7928
8043
|
try {
|
|
7929
|
-
const e = s.animating ? 0 : s.offsetZ || 0, t = new
|
|
8044
|
+
const e = s.animating ? 0 : s.offsetZ || 0, t = new Wt({
|
|
7930
8045
|
strength: s.strength,
|
|
7931
8046
|
noiseScale: s.noiseScale,
|
|
7932
8047
|
offsetX: s.offsetX,
|
|
@@ -8073,9 +8188,9 @@ f({
|
|
|
8073
8188
|
}
|
|
8074
8189
|
]
|
|
8075
8190
|
});
|
|
8076
|
-
class
|
|
8191
|
+
class Zt extends w.Filter {
|
|
8077
8192
|
constructor(e) {
|
|
8078
|
-
const t =
|
|
8193
|
+
const t = Ce.from({
|
|
8079
8194
|
vertex: `
|
|
8080
8195
|
attribute vec2 aPosition;
|
|
8081
8196
|
varying vec2 vTextureCoord;
|
|
@@ -8184,7 +8299,7 @@ f({
|
|
|
8184
8299
|
description: "Creates a twisting distortion effect around a central point",
|
|
8185
8300
|
createFilter: (s) => {
|
|
8186
8301
|
try {
|
|
8187
|
-
const e = new
|
|
8302
|
+
const e = new Zt({
|
|
8188
8303
|
centerX: s.centerX ?? 0.5,
|
|
8189
8304
|
centerY: s.centerY ?? 0.5,
|
|
8190
8305
|
radius: s.radius ?? 0.25,
|
|
@@ -8254,7 +8369,7 @@ f({
|
|
|
8254
8369
|
}
|
|
8255
8370
|
]
|
|
8256
8371
|
});
|
|
8257
|
-
const { AdjustmentFilter:
|
|
8372
|
+
const { AdjustmentFilter: Gt } = g;
|
|
8258
8373
|
function D(s) {
|
|
8259
8374
|
const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
|
|
8260
8375
|
return [
|
|
@@ -8263,7 +8378,7 @@ function D(s) {
|
|
|
8263
8378
|
(e & 255) / 255
|
|
8264
8379
|
];
|
|
8265
8380
|
}
|
|
8266
|
-
class
|
|
8381
|
+
class Kt extends Gt {
|
|
8267
8382
|
constructor(e = {}) {
|
|
8268
8383
|
super({
|
|
8269
8384
|
brightness: 1,
|
|
@@ -8306,7 +8421,7 @@ f({
|
|
|
8306
8421
|
description: "Add a classic darkened border effect to the image",
|
|
8307
8422
|
createFilter: (s) => {
|
|
8308
8423
|
try {
|
|
8309
|
-
const e = new
|
|
8424
|
+
const e = new Kt({
|
|
8310
8425
|
radius: s.radius || 0.8,
|
|
8311
8426
|
strength: s.strength || 1,
|
|
8312
8427
|
color: s.color || "#000000"
|
|
@@ -8370,22 +8485,22 @@ f({
|
|
|
8370
8485
|
}
|
|
8371
8486
|
]
|
|
8372
8487
|
});
|
|
8373
|
-
function
|
|
8488
|
+
function ri(s) {
|
|
8374
8489
|
try {
|
|
8375
8490
|
let e = [], t = [];
|
|
8376
8491
|
try {
|
|
8377
|
-
e = U(), e.length === 0 &&
|
|
8492
|
+
e = U(), e.length === 0 && rt();
|
|
8378
8493
|
} catch {
|
|
8379
8494
|
}
|
|
8380
8495
|
const i = s == null ? void 0 : s.disabled;
|
|
8381
8496
|
if (Array.isArray(i) && i.length > 0) {
|
|
8382
8497
|
let r = 0;
|
|
8383
8498
|
for (const a of i)
|
|
8384
|
-
|
|
8499
|
+
ot(a) && r++;
|
|
8385
8500
|
r > 0;
|
|
8386
8501
|
}
|
|
8387
8502
|
try {
|
|
8388
|
-
e = U(), t =
|
|
8503
|
+
e = U(), t = at();
|
|
8389
8504
|
} catch {
|
|
8390
8505
|
e || (e = []), t || (t = []);
|
|
8391
8506
|
}
|
|
@@ -8395,16 +8510,16 @@ function Jt(s) {
|
|
|
8395
8510
|
}
|
|
8396
8511
|
}
|
|
8397
8512
|
export {
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8513
|
+
ei as V,
|
|
8514
|
+
it as a,
|
|
8515
|
+
st as b,
|
|
8516
|
+
at as c,
|
|
8517
|
+
rt as d,
|
|
8518
|
+
ii as e,
|
|
8519
|
+
nt as f,
|
|
8405
8520
|
U as g,
|
|
8406
|
-
|
|
8407
|
-
|
|
8521
|
+
ti as h,
|
|
8522
|
+
ri as i,
|
|
8408
8523
|
f as r
|
|
8409
8524
|
};
|
|
8410
|
-
//# sourceMappingURL=editor-
|
|
8525
|
+
//# sourceMappingURL=editor-624YYYUE.js.map
|