@codingfactory/mediables-vue 2.3.4 → 2.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PixiFrameExporter-B6w9IirP.js → PixiFrameExporter-BAZtrvGS.js} +2 -2
- package/dist/{PixiFrameExporter-B6w9IirP.js.map → PixiFrameExporter-BAZtrvGS.js.map} +1 -1
- package/dist/{PixiFrameExporter-BRm0MI7V.cjs → PixiFrameExporter-DM4yaigy.cjs} +2 -2
- package/dist/{PixiFrameExporter-BRm0MI7V.cjs.map → PixiFrameExporter-DM4yaigy.cjs.map} +1 -1
- package/dist/{editor-DrTmgu3R.js → editor-BWpslm--.js} +413 -407
- package/dist/editor-BWpslm--.js.map +1 -0
- package/dist/editor-D_dX1XkE.cjs +42 -0
- package/dist/editor-D_dX1XkE.cjs.map +1 -0
- package/dist/{index-BBpOpdLI.cjs → index-6-ArBBEQ.cjs} +3 -3
- package/dist/{index-BBpOpdLI.cjs.map → index-6-ArBBEQ.cjs.map} +1 -1
- package/dist/{index-CPwV2mtc.js → index-CMOpozRS.js} +3 -3
- package/dist/{index-CPwV2mtc.js.map → index-CMOpozRS.js.map} +1 -1
- package/dist/mediables-vanilla.cjs +1 -1
- package/dist/mediables-vanilla.mjs +1 -1
- package/dist/mediables-vue.cjs +1 -1
- package/dist/mediables-vue.mjs +2 -2
- package/package.json +1 -1
- package/dist/editor-DhRuADQT.cjs +0 -42
- package/dist/editor-DhRuADQT.cjs.map +0 -1
- package/dist/editor-DrTmgu3R.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var V = (s, e, t) =>
|
|
1
|
+
var me = Object.defineProperty;
|
|
2
|
+
var ge = (s, e, t) => e in s ? me(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var V = (s, e, t) => ge(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as g from "pixi-filters";
|
|
5
5
|
import * as w from "pixi.js";
|
|
6
|
-
import { GlProgram as
|
|
7
|
-
class
|
|
6
|
+
import { GlProgram as be } from "pixi.js";
|
|
7
|
+
class B {
|
|
8
8
|
constructor() {
|
|
9
9
|
this._events = /* @__PURE__ */ new Map();
|
|
10
10
|
}
|
|
@@ -34,7 +34,7 @@ class O {
|
|
|
34
34
|
e ? this._events.delete(e) : this._events.clear();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
class
|
|
37
|
+
class ye extends B {
|
|
38
38
|
constructor() {
|
|
39
39
|
super(), this._state = {
|
|
40
40
|
// Image state
|
|
@@ -160,10 +160,10 @@ class _e extends O {
|
|
|
160
160
|
this.set("isDarkMode", this._state.theme === "dark");
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return new
|
|
163
|
+
function _e() {
|
|
164
|
+
return new ye();
|
|
165
165
|
}
|
|
166
|
-
class
|
|
166
|
+
class xe extends B {
|
|
167
167
|
constructor() {
|
|
168
168
|
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
169
|
}
|
|
@@ -262,7 +262,7 @@ class Ce extends O {
|
|
|
262
262
|
* @param {string} imageUrl - URL, data URL, or blob URL of the image
|
|
263
263
|
*/
|
|
264
264
|
async loadTexture(e) {
|
|
265
|
-
var l, c,
|
|
265
|
+
var l, c, u;
|
|
266
266
|
if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return;
|
|
267
267
|
const t = window.PIXI, i = await this._loadImageElement(e);
|
|
268
268
|
if (!i || !((c = this.app) != null && c.renderer)) return;
|
|
@@ -271,7 +271,7 @@ class Ce extends O {
|
|
|
271
271
|
return;
|
|
272
272
|
this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new t.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
|
|
273
273
|
const { w: a, h: o } = this._getCssSize();
|
|
274
|
-
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((
|
|
274
|
+
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((u = this.app) != null && u.renderer)) return;
|
|
275
275
|
const n = this.getFitScaleFor(r);
|
|
276
276
|
Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height });
|
|
277
277
|
}
|
|
@@ -284,41 +284,47 @@ class Ce extends O {
|
|
|
284
284
|
* @returns {string|null} Data URL
|
|
285
285
|
*/
|
|
286
286
|
exportImage(e = "png", t = 0.92, i = 0, r = !0) {
|
|
287
|
-
var
|
|
288
|
-
if (!((
|
|
287
|
+
var y;
|
|
288
|
+
if (!((y = this.app) != null && y.renderer) || !this.originalTexture || !this.sprite)
|
|
289
289
|
return null;
|
|
290
290
|
const a = window.PIXI, o = Math.round(this.originalTexture.width), n = Math.round(this.originalTexture.height);
|
|
291
291
|
if (o <= 0 || n <= 0)
|
|
292
292
|
return null;
|
|
293
|
-
let l = o
|
|
293
|
+
let l = o;
|
|
294
294
|
if (i > 0) {
|
|
295
|
-
const
|
|
296
|
-
let
|
|
297
|
-
r && (
|
|
295
|
+
const _ = Math.max(o, n);
|
|
296
|
+
let v = i / _;
|
|
297
|
+
r && (v = Math.min(1, v)), l = Math.round(o * v);
|
|
298
298
|
}
|
|
299
|
-
const
|
|
300
|
-
|
|
299
|
+
const c = this.sprite, u = c.x, h = c.y, p = c.width, m = c.height;
|
|
300
|
+
if (p <= 0 || m <= 0)
|
|
301
|
+
return null;
|
|
302
|
+
const C = l / p;
|
|
303
|
+
let b = null;
|
|
301
304
|
try {
|
|
302
|
-
|
|
303
|
-
|
|
305
|
+
if (c.x = 0, c.y = 0, b = a.RenderTexture.create({
|
|
306
|
+
width: Math.ceil(p),
|
|
307
|
+
height: Math.ceil(m),
|
|
308
|
+
resolution: C
|
|
309
|
+
}), this.app.renderer.render({ container: this.app.stage, target: b }), !this.app.renderer.extract)
|
|
304
310
|
return null;
|
|
305
|
-
const
|
|
306
|
-
if (!
|
|
311
|
+
const _ = this.app.renderer.extract.canvas(b);
|
|
312
|
+
if (!_)
|
|
307
313
|
return null;
|
|
308
|
-
let
|
|
309
|
-
if (typeof
|
|
310
|
-
|
|
311
|
-
else if (typeof
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
|
|
314
|
+
let v = null;
|
|
315
|
+
if (typeof _.toDataURL == "function")
|
|
316
|
+
v = _.toDataURL(`image/${e}`, t);
|
|
317
|
+
else if (typeof _.getContext == "function") {
|
|
318
|
+
const M = document.createElement("canvas");
|
|
319
|
+
M.width = _.width, M.height = _.height;
|
|
320
|
+
const O = M.getContext("2d");
|
|
321
|
+
O && (O.drawImage(_, 0, 0), v = M.toDataURL(`image/${e}`, t));
|
|
316
322
|
}
|
|
317
|
-
return
|
|
323
|
+
return v || null;
|
|
318
324
|
} catch {
|
|
319
325
|
return null;
|
|
320
326
|
} finally {
|
|
321
|
-
|
|
327
|
+
c.x = u, c.y = h, b && b.destroy(!0);
|
|
322
328
|
}
|
|
323
329
|
}
|
|
324
330
|
/**
|
|
@@ -373,7 +379,7 @@ class Ce extends O {
|
|
|
373
379
|
this.sprite = null, this.originalTexture = null, this.baseTexture = null, this._container = null, this.removeAllListeners();
|
|
374
380
|
}
|
|
375
381
|
}
|
|
376
|
-
const
|
|
382
|
+
const Ce = {
|
|
377
383
|
adjust: ["adjust", "advanced"],
|
|
378
384
|
// adjustment, adjustmentAdvanced, alpha, colorMatrix
|
|
379
385
|
blur: ["blur"],
|
|
@@ -389,7 +395,7 @@ const we = {
|
|
|
389
395
|
stylize: ["stylize"]
|
|
390
396
|
// ascii, crt, crossHatch, dot, emboss
|
|
391
397
|
};
|
|
392
|
-
class
|
|
398
|
+
class we extends B {
|
|
393
399
|
constructor(e, t) {
|
|
394
400
|
super(), this.state = e, this.renderer = t, this.instances = {}, this._filterRegistry = null;
|
|
395
401
|
}
|
|
@@ -424,7 +430,7 @@ class Se extends O {
|
|
|
424
430
|
*/
|
|
425
431
|
getFiltersByCategory(e) {
|
|
426
432
|
if (!this._filterRegistry) return [];
|
|
427
|
-
const t =
|
|
433
|
+
const t = Ce[e] || [e], i = [], r = /* @__PURE__ */ new Set();
|
|
428
434
|
for (const a of t) {
|
|
429
435
|
const o = this._filterRegistry.getFiltersByCategory(a) || [];
|
|
430
436
|
for (const n of o)
|
|
@@ -525,9 +531,9 @@ class Se extends O {
|
|
|
525
531
|
if (!o || !o.createFilter || typeof o.createFilter != "function")
|
|
526
532
|
return;
|
|
527
533
|
const n = this.state.getFilterValues(a), l = o.defaultParams ? { ...o.defaultParams } : {};
|
|
528
|
-
o.controls && Array.isArray(o.controls) && o.controls.forEach((
|
|
529
|
-
const h =
|
|
530
|
-
l[h] = n[
|
|
534
|
+
o.controls && Array.isArray(o.controls) && o.controls.forEach((u) => {
|
|
535
|
+
const h = u.property || u.id;
|
|
536
|
+
l[h] = n[u.id] ?? u.default;
|
|
531
537
|
});
|
|
532
538
|
const c = o.createFilter(l);
|
|
533
539
|
c && (t.push(c), this.instances[a] = c);
|
|
@@ -569,7 +575,7 @@ class Se extends O {
|
|
|
569
575
|
return this.instances[e] || null;
|
|
570
576
|
}
|
|
571
577
|
}
|
|
572
|
-
const T = class T extends
|
|
578
|
+
const T = class T extends B {
|
|
573
579
|
constructor(e, t) {
|
|
574
580
|
super(), this.state = e, this.renderer = t, this._overlayCanvas = null, this._isDragging = !1, this._dragStart = null, this._dragMode = null, this._startRect = null, this._hoverMode = null, this._lastAutoZoomCheck = 0, this.HANDLE_SIZE = 14, this.EDGE_HIT_PAD = 10, this._onPointerDown = this._handlePointerDown.bind(this), this._onPointerMove = this._handlePointerMove.bind(this), this._onPointerUp = this._handlePointerUp.bind(this);
|
|
575
581
|
}
|
|
@@ -646,14 +652,14 @@ const T = class T extends O {
|
|
|
646
652
|
if (!e || !r || !a || !o) return null;
|
|
647
653
|
const l = e.width > t, c = e.height > i;
|
|
648
654
|
if (!l && !c) return null;
|
|
649
|
-
const
|
|
655
|
+
const u = T.AUTO_ZOOM_PADDING;
|
|
650
656
|
let h = n;
|
|
651
657
|
if (l) {
|
|
652
|
-
const p = e.width / (
|
|
658
|
+
const p = e.width / (u * r * o);
|
|
653
659
|
h = Math.min(h, p);
|
|
654
660
|
}
|
|
655
661
|
if (c) {
|
|
656
|
-
const p = e.height / (
|
|
662
|
+
const p = e.height / (u * a * o);
|
|
657
663
|
h = Math.min(h, p);
|
|
658
664
|
}
|
|
659
665
|
return h = Math.max(0.1, h), h >= n - 0.01 ? null : h;
|
|
@@ -697,8 +703,8 @@ const T = class T extends O {
|
|
|
697
703
|
if (!l) return;
|
|
698
704
|
const c = this.state.get("crop.shape");
|
|
699
705
|
if (n.save(), c === "circle") {
|
|
700
|
-
const y = l.x + l.width / 2,
|
|
701
|
-
n.beginPath(), n.arc(y,
|
|
706
|
+
const y = l.x + l.width / 2, z = l.y + l.height / 2, _ = Math.min(l.width, l.height) / 2;
|
|
707
|
+
n.beginPath(), n.arc(y, z, _, 0, Math.PI * 2), n.clip();
|
|
702
708
|
} else
|
|
703
709
|
n.beginPath(), n.rect(l.x, l.y, l.width, l.height), n.clip();
|
|
704
710
|
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(
|
|
@@ -708,9 +714,9 @@ const T = class T extends O {
|
|
|
708
714
|
0,
|
|
709
715
|
Math.PI * 2
|
|
710
716
|
), n.stroke()) : n.strokeRect(l.x, l.y, l.width, l.height), n.setLineDash([]), n.strokeStyle = "rgba(255,255,255,0.3)", n.lineWidth = 1;
|
|
711
|
-
const
|
|
717
|
+
const u = l.width / 3, h = l.height / 3;
|
|
712
718
|
for (let y = 1; y <= 2; y++)
|
|
713
|
-
n.beginPath(), n.moveTo(l.x +
|
|
719
|
+
n.beginPath(), n.moveTo(l.x + u * y, l.y), n.lineTo(l.x + u * y, l.y + l.height), n.stroke(), n.beginPath(), n.moveTo(l.x, l.y + h * y), n.lineTo(l.x + l.width, l.y + h * y), n.stroke();
|
|
714
720
|
const p = this.HANDLE_SIZE, m = [
|
|
715
721
|
{ x: l.x, y: l.y, m: "resize-nw" },
|
|
716
722
|
{ x: l.x + l.width, y: l.y, m: "resize-ne" },
|
|
@@ -723,8 +729,8 @@ const T = class T extends O {
|
|
|
723
729
|
{ x: l.x + l.width, y: l.y + l.height / 2, m: "e" }
|
|
724
730
|
], b = [...m, ...C];
|
|
725
731
|
for (const y of b) {
|
|
726
|
-
const
|
|
727
|
-
n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle =
|
|
732
|
+
const z = this._hoverMode === y.m, _ = z ? p + 4 : p;
|
|
733
|
+
n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle = z ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
|
|
728
734
|
}
|
|
729
735
|
}
|
|
730
736
|
/**
|
|
@@ -752,12 +758,12 @@ const T = class T extends O {
|
|
|
752
758
|
* Handle pointer move event
|
|
753
759
|
*/
|
|
754
760
|
_handlePointerMove(e) {
|
|
755
|
-
var l, c,
|
|
761
|
+
var l, c, u, h;
|
|
756
762
|
const t = this.renderer.app;
|
|
757
763
|
if (!t) return;
|
|
758
764
|
const i = e.global;
|
|
759
765
|
if (!this._isDragging || !this._dragStart || !this._startRect) {
|
|
760
|
-
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (
|
|
766
|
+
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (u = this._hoverMode) != null && u.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
|
|
761
767
|
return;
|
|
762
768
|
}
|
|
763
769
|
const r = this.state.get("crop.rect");
|
|
@@ -834,15 +840,15 @@ const T = class T extends O {
|
|
|
834
840
|
apply() {
|
|
835
841
|
const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
|
|
836
842
|
if (!r || !t || !e || !i) return null;
|
|
837
|
-
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n,
|
|
838
|
-
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), C = Math.round(
|
|
843
|
+
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n, u = (r.y - t.y) * l;
|
|
844
|
+
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), C = Math.round(u);
|
|
839
845
|
if (h <= 0 || p <= 0) return null;
|
|
840
846
|
const b = new a.Container(), y = new a.Sprite(i);
|
|
841
847
|
if (this.state.get("crop.shape") === "circle") {
|
|
842
|
-
const
|
|
843
|
-
m = Math.round(
|
|
844
|
-
const
|
|
845
|
-
typeof
|
|
848
|
+
const M = Math.round(Math.max(h, p)), O = m + h / 2, fe = C + p / 2;
|
|
849
|
+
m = Math.round(O - M / 2), C = Math.round(fe - M / 2), h = p = M;
|
|
850
|
+
const F = new a.Graphics();
|
|
851
|
+
typeof F.circle == "function" && typeof F.fill == "function" ? F.circle(h / 2, p / 2, h / 2).fill(16777215) : (F.beginFill(16777215, 1), F.drawCircle(h / 2, p / 2, h / 2), F.endFill()), y.mask = F, b.addChild(F);
|
|
846
852
|
}
|
|
847
853
|
y.x = -m, y.y = -C, b.addChild(y);
|
|
848
854
|
const _ = a.RenderTexture.create({ width: h, height: p });
|
|
@@ -851,8 +857,8 @@ const T = class T extends O {
|
|
|
851
857
|
target: _,
|
|
852
858
|
clear: !0
|
|
853
859
|
}), b.destroy({ children: !0 }), this.renderer.originalTexture = _, e.stage.removeChild(t), t.destroy();
|
|
854
|
-
const
|
|
855
|
-
return e.stage.addChild(
|
|
860
|
+
const v = new a.Sprite(_);
|
|
861
|
+
return e.stage.addChild(v), this.renderer.sprite = v, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), this.disable(), this.emit("applied", { width: h, height: p }), { texture: _, preservedZoom: o };
|
|
856
862
|
}
|
|
857
863
|
/**
|
|
858
864
|
* Cancel crop
|
|
@@ -884,7 +890,7 @@ V(T, "AUTO_ZOOM_PADDING", 1.1), /**
|
|
|
884
890
|
*/
|
|
885
891
|
V(T, "AUTO_ZOOM_THROTTLE_MS", 100);
|
|
886
892
|
let $ = T;
|
|
887
|
-
class
|
|
893
|
+
class Se {
|
|
888
894
|
/**
|
|
889
895
|
* Create a new RemoveBgManager
|
|
890
896
|
* @param {Object} options
|
|
@@ -934,8 +940,8 @@ class ve {
|
|
|
934
940
|
if (!a.ok) {
|
|
935
941
|
let c = `Background removal failed (HTTP ${a.status})`;
|
|
936
942
|
try {
|
|
937
|
-
const
|
|
938
|
-
|
|
943
|
+
const u = await a.text();
|
|
944
|
+
u && (c += `: ${u}`);
|
|
939
945
|
} catch {
|
|
940
946
|
}
|
|
941
947
|
throw new Error(c);
|
|
@@ -994,7 +1000,7 @@ class ve {
|
|
|
994
1000
|
}
|
|
995
1001
|
}
|
|
996
1002
|
}
|
|
997
|
-
function
|
|
1003
|
+
function d(s, e = {}, ...t) {
|
|
998
1004
|
const i = document.createElement(s);
|
|
999
1005
|
for (const [r, a] of Object.entries(e))
|
|
1000
1006
|
if (a != null)
|
|
@@ -1010,17 +1016,17 @@ function u(s, e = {}, ...t) {
|
|
|
1010
1016
|
typeof r == "string" ? i.appendChild(document.createTextNode(r)) : r instanceof HTMLElement && i.appendChild(r);
|
|
1011
1017
|
return i;
|
|
1012
1018
|
}
|
|
1013
|
-
function
|
|
1014
|
-
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l =
|
|
1019
|
+
function ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
|
|
1020
|
+
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = d("div", {
|
|
1015
1021
|
className: "slider-control slider-wrapper",
|
|
1016
1022
|
"data-control": n,
|
|
1017
1023
|
"data-testid": `slider-${n}`
|
|
1018
|
-
}), c =
|
|
1024
|
+
}), c = d(
|
|
1019
1025
|
"div",
|
|
1020
1026
|
{ className: "slider-header" },
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
),
|
|
1027
|
+
d("label", { for: s, className: "slider-label" }, e),
|
|
1028
|
+
d("span", { className: "slider-value", id: `${s}-value` }, j(a))
|
|
1029
|
+
), u = d("input", {
|
|
1024
1030
|
type: "range",
|
|
1025
1031
|
id: s,
|
|
1026
1032
|
className: "slider-input",
|
|
@@ -1033,8 +1039,8 @@ function ne({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1033
1039
|
m && (m.textContent = j(p)), o == null || o(p);
|
|
1034
1040
|
}
|
|
1035
1041
|
});
|
|
1036
|
-
return l.appendChild(c), l.appendChild(
|
|
1037
|
-
|
|
1042
|
+
return l.appendChild(c), l.appendChild(u), l.setValue = (h) => {
|
|
1043
|
+
u.value = String(h);
|
|
1038
1044
|
const p = l.querySelector(".slider-value");
|
|
1039
1045
|
p && (p.textContent = j(h));
|
|
1040
1046
|
}, l;
|
|
@@ -1042,25 +1048,25 @@ function ne({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1042
1048
|
function j(s) {
|
|
1043
1049
|
return Number.isInteger(s) ? String(s) : s.toFixed(2);
|
|
1044
1050
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const r =
|
|
1051
|
+
function oe({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
1052
|
+
const r = d("div", { className: "toggle-control" }), a = d("label", { className: "toggle-label", for: s }, e), o = d("input", {
|
|
1047
1053
|
type: "checkbox",
|
|
1048
1054
|
id: s,
|
|
1049
1055
|
className: "toggle-input",
|
|
1050
1056
|
checked: t ? "checked" : void 0,
|
|
1051
1057
|
onChange: (c) => i == null ? void 0 : i(c.target.checked)
|
|
1052
|
-
}), n =
|
|
1058
|
+
}), n = d("div", {
|
|
1053
1059
|
className: "toggle-switch",
|
|
1054
1060
|
onClick: (c) => {
|
|
1055
1061
|
c.target !== o && (o.checked = !o.checked, i == null || i(o.checked));
|
|
1056
1062
|
}
|
|
1057
|
-
}), l =
|
|
1063
|
+
}), l = d("span", { className: "toggle-slider" });
|
|
1058
1064
|
return n.appendChild(o), n.appendChild(l), r.appendChild(a), r.appendChild(n), r.setChecked = (c) => {
|
|
1059
1065
|
o.checked = c;
|
|
1060
1066
|
}, r;
|
|
1061
1067
|
}
|
|
1062
|
-
function
|
|
1063
|
-
const r =
|
|
1068
|
+
function ne({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
1069
|
+
const r = d("div", { className: "color-control" }), a = d("label", { className: "color-label", for: s }, e), o = d("input", {
|
|
1064
1070
|
type: "color",
|
|
1065
1071
|
id: s,
|
|
1066
1072
|
className: "color-input",
|
|
@@ -1071,29 +1077,29 @@ function ce({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
|
1071
1077
|
o.value = n;
|
|
1072
1078
|
}, r;
|
|
1073
1079
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const a =
|
|
1080
|
+
function le({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
1081
|
+
const a = d("div", { className: "select-control" }), o = d("label", { className: "select-label", for: s }, e), n = d("select", {
|
|
1076
1082
|
id: s,
|
|
1077
1083
|
className: "select-input",
|
|
1078
1084
|
onChange: (l) => r == null ? void 0 : r(l.target.value)
|
|
1079
1085
|
});
|
|
1080
1086
|
for (const l of t) {
|
|
1081
|
-
const c =
|
|
1087
|
+
const c = d("option", { value: l.value }, l.label);
|
|
1082
1088
|
l.value === i && (c.selected = !0), n.appendChild(c);
|
|
1083
1089
|
}
|
|
1084
1090
|
return a.appendChild(o), a.appendChild(n), a.setValue = (l) => {
|
|
1085
1091
|
n.value = l;
|
|
1086
1092
|
}, a;
|
|
1087
1093
|
}
|
|
1088
|
-
function
|
|
1089
|
-
const a =
|
|
1094
|
+
function A({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
|
|
1095
|
+
const a = d("button", {
|
|
1090
1096
|
type: "button",
|
|
1091
1097
|
className: `btn ${e}`.trim(),
|
|
1092
1098
|
onClick: t,
|
|
1093
1099
|
disabled: r ? "disabled" : void 0
|
|
1094
1100
|
});
|
|
1095
1101
|
if (i) {
|
|
1096
|
-
const o =
|
|
1102
|
+
const o = d("span", { className: "btn-icon" });
|
|
1097
1103
|
o.innerHTML = i;
|
|
1098
1104
|
const n = o.querySelector("svg");
|
|
1099
1105
|
n && n.setAttribute("aria-hidden", "true"), a.appendChild(o);
|
|
@@ -1110,29 +1116,29 @@ function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1,
|
|
|
1110
1116
|
disabled: r ? "disabled" : void 0
|
|
1111
1117
|
};
|
|
1112
1118
|
a && (n.dataset = { testid: a });
|
|
1113
|
-
const l =
|
|
1119
|
+
const l = d("button", n);
|
|
1114
1120
|
l.innerHTML = s;
|
|
1115
1121
|
const c = l.querySelector("svg");
|
|
1116
1122
|
return c && c.setAttribute("aria-hidden", "true"), l;
|
|
1117
1123
|
}
|
|
1118
1124
|
function W({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
1119
|
-
const r =
|
|
1125
|
+
const r = d("button", {
|
|
1120
1126
|
type: "button",
|
|
1121
1127
|
className: `chip ${t ? "active" : ""}`.trim(),
|
|
1122
1128
|
onClick: i
|
|
1123
1129
|
});
|
|
1124
1130
|
if (e) {
|
|
1125
|
-
const a =
|
|
1131
|
+
const a = d("span", { className: "chip-icon" });
|
|
1126
1132
|
a.innerHTML = e;
|
|
1127
1133
|
const o = a.querySelector("svg");
|
|
1128
1134
|
o && o.setAttribute("aria-hidden", "true"), r.appendChild(a);
|
|
1129
1135
|
}
|
|
1130
|
-
return r.appendChild(
|
|
1136
|
+
return r.appendChild(d("span", { className: "chip-label" }, s)), r.setActive = (a) => {
|
|
1131
1137
|
r.classList.toggle("active", a);
|
|
1132
1138
|
}, r;
|
|
1133
1139
|
}
|
|
1134
|
-
const
|
|
1135
|
-
class
|
|
1140
|
+
const ce = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M328 112L184 256l144 144"/></svg>', he = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M184 112l144 144-144 144"/></svg>', ve = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M256 184v74m-37-37h74"/></svg>', ke = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M184 221h74"/></svg>', Pe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M432 320v112H320M80 192V80h112M320 80h112v112M192 432H80V320"/></svg>', Me = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M262.29 192.31a64 64 0 1057.4 57.4 64.13 64.13 0 00-57.4-57.4z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416.39 256a154.34 154.34 0 01-1.53 20.79l45.21 35.46a10.81 10.81 0 012.45 13.75l-42.77 74a10.81 10.81 0 01-13.14 4.59l-44.9-18.08a16.11 16.11 0 00-15.17 1.75A164.48 164.48 0 01325 400.8a15.94 15.94 0 00-8.82 12.14l-6.73 47.89a11.08 11.08 0 01-10.68 9.17h-85.54a11.11 11.11 0 01-10.69-8.87l-6.72-47.82a16.07 16.07 0 00-9-12.22 155.3 155.3 0 01-21.46-12.57 16 16 0 00-15.11-1.71l-44.89 18.07a10.81 10.81 0 01-13.14-4.58l-42.77-74a10.8 10.8 0 012.45-13.75l38.21-30a16.05 16.05 0 006-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 00-6.07-13.94l-38.19-30A10.81 10.81 0 0149.48 186l42.77-74a10.81 10.81 0 0113.14-4.59l44.9 18.08a16.11 16.11 0 0015.17-1.75A164.48 164.48 0 01187 111.2a15.94 15.94 0 008.82-12.14l6.73-47.89A11.08 11.08 0 01213.23 42h85.54a11.11 11.11 0 0110.69 8.87l6.72 47.82a16.07 16.07 0 009 12.22 155.3 155.3 0 0121.46 12.57 16 16 0 0015.11 1.71l44.89-18.07a10.81 10.81 0 0113.14 4.58l42.77 74a10.8 10.8 0 01-2.45 13.75l-38.21 30a16.05 16.05 0 00-6.05 14.08c.33 4.14.55 8.3.55 12.47z"/></svg>', Fe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M400 320c0 88.37-55.63 144-144 144s-144-55.63-144-144c0-94.83 103.23-222.85 134.89-259.88a12 12 0 0118.23 0C296.77 97.15 400 225.17 400 320z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M344 328a72 72 0 01-72 72"/></svg>', Ae = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32" d="M430.11 347.9c-6.6-6.1-16.3-7.6-24.6-9-11.5-1.9-15.9-4-22.6-10-14.3-12.7-14.3-31.1 0-43.8l30.3-26.9c46.4-41 46.4-108.2 0-149.2-34.2-30.1-80.1-45-127.8-45-55.7 0-113.9 20.3-158.8 60.1-83.5 73.8-83.5 194.7 0 268.5 41.5 36.7 97.5 55 152.9 55.4h1.7c55.4 0 110-17.9 148.8-52.4 14.4-12.7 11.99-36.6.1-47.7z"/><circle cx="144" cy="208" r="32"/><circle cx="152" cy="311" r="32"/><circle cx="224" cy="144" r="32"/><circle cx="256" cy="367" r="32"/><circle cx="328" cy="144" r="32"/></svg>', ze = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M259.92 262.91L216.4 149.77a9 9 0 00-16.8 0l-43.52 113.14a9 9 0 01-5.17 5.17L37.77 311.6a9 9 0 000 16.8l113.14 43.52a9 9 0 015.17 5.17l43.52 113.14a9 9 0 0016.8 0l43.52-113.14a9 9 0 015.17-5.17l113.14-43.52a9 9 0 000-16.8l-113.14-43.52a9 9 0 01-5.17-5.17zM108 68L88 16 68 68 16 88l52 20 20 52 20-52 52-20-52-20zM426.67 117.33L400 48l-26.67 69.33L304 144l69.33 26.67L400 240l26.67-69.33L496 144l-69.33-26.67z"/></svg>', Ne = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></svg>', Re = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M315.27 33L96 304h128l-31.51 173.23a2.36 2.36 0 002.33 2.77h0a2.36 2.36 0 001.89-.95L416 208H288l31.66-173.25a2.45 2.45 0 00-2.44-2.75h0a2.42 2.42 0 00-1.95 1z"/></svg>', de = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M144 48v272a48 48 0 0048 48h272"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 464V192a48 48 0 00-48-48H48"/></svg>', Te = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M380.93 57.37A32 32 0 00358.3 48H94.22A46.21 46.21 0 0048 94.22v323.56A46.21 46.21 0 0094.22 464h323.56A46.36 46.36 0 00464 417.78V153.7a32 32 0 00-9.37-22.63zM256 416a64 64 0 1164-64 63.92 63.92 0 01-64 64zm48-224H112a16 16 0 01-16-16v-64a16 16 0 0116-16h192a16 16 0 0116 16v64a16 16 0 01-16 16z"/></svg>', G = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 368L144 144M368 144L144 368"/></svg>', ue = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M320 146s24.36-12-64-12a160 160 0 10160 160"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M256 58l80 80-80 80"/></svg>', Ie = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M80 112h352"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M192 112V72h0a23.93 23.93 0 0124-24h80a23.93 23.93 0 0124 24h0v40M256 176v224M184 176l8 224M328 176l-8 224"/></svg>', Ee = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M64 192v-72a40 40 0 0140-40h75.89a40 40 0 0122.19 6.72l27.84 18.56a40 40 0 0022.19 6.72H408a40 40 0 0140 40v40"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M479.9 226.55L463.68 392a40 40 0 01-39.93 40H88.25a40 40 0 01-39.93-40L32.1 226.55A32 32 0 0164 192h384.1a32 32 0 0131.8 34.55z"/></svg>', Z = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416 128L192 384l-96-96"/></svg>', Xe = '<svg viewBox="0 0 512 512" width="20" height="20"><rect x="64" y="64" width="384" height="384" rx="48" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32"/></svg>', Ye = '<svg viewBox="0 0 512 512" width="20" height="20"><circle cx="256" cy="256" r="208" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/></svg>', Be = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M80 96h64l64 320h64l64-160h96"/></svg>', K = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M256 48v48M256 416v48M403.08 108.92l-33.94 33.94M142.86 369.14l-33.94 33.94M464 256h-48M96 256H48M403.08 403.08l-33.94-33.94M142.86 142.86l-33.94-33.94"/><circle cx="256" cy="256" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32"/></svg>', Q = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M160 136c0-30.62 4.51-61.61 16-88C99.57 81.27 48 159.32 48 248c0 119.29 96.71 216 216 216 88.68 0 166.73-51.57 200-128-26.39 11.49-57.38 16-88 16-119.29 0-216-96.71-216-216z"/></svg>', Oe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M436 80H76a44.05 44.05 0 00-44 44v264a44.05 44.05 0 0044 44h360a44.05 44.05 0 0044-44V124a44.05 44.05 0 00-44-44z"/><circle cx="256" cy="256" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M220 80v56M292 80v56M220 376v56M292 376v56M80 144h56M80 224h56M80 304h56M376 144h56M376 224h56M376 304h56"/></svg>';
|
|
1141
|
+
class Le {
|
|
1136
1142
|
constructor(e, t) {
|
|
1137
1143
|
this.state = e, this.editor = t, this.element = null, this._unsubscribers = [];
|
|
1138
1144
|
}
|
|
@@ -1141,9 +1147,9 @@ class De {
|
|
|
1141
1147
|
* @returns {HTMLElement}
|
|
1142
1148
|
*/
|
|
1143
1149
|
render() {
|
|
1144
|
-
this.element =
|
|
1145
|
-
const e =
|
|
1146
|
-
icon:
|
|
1150
|
+
this.element = d("div", { className: "editor-toolbar" });
|
|
1151
|
+
const e = d("div", { className: "toolbar-section toolbar-left" }), t = x({
|
|
1152
|
+
icon: Ee,
|
|
1147
1153
|
title: "Open Image",
|
|
1148
1154
|
className: "toolbar-btn",
|
|
1149
1155
|
testId: "btn-open-image",
|
|
@@ -1151,8 +1157,8 @@ class De {
|
|
|
1151
1157
|
onClick: () => this.editor.openFilePicker()
|
|
1152
1158
|
});
|
|
1153
1159
|
e.appendChild(t);
|
|
1154
|
-
const i =
|
|
1155
|
-
icon:
|
|
1160
|
+
const i = d("div", { className: "toolbar-section toolbar-center" }), r = x({
|
|
1161
|
+
icon: ke,
|
|
1156
1162
|
title: "Zoom Out",
|
|
1157
1163
|
className: "toolbar-btn",
|
|
1158
1164
|
testId: "btn-zoom-out",
|
|
@@ -1162,14 +1168,14 @@ class De {
|
|
|
1162
1168
|
this.editor.setZoom(h - 0.25);
|
|
1163
1169
|
}
|
|
1164
1170
|
});
|
|
1165
|
-
this._zoomLabel =
|
|
1171
|
+
this._zoomLabel = d("span", {
|
|
1166
1172
|
className: "zoom-label",
|
|
1167
1173
|
"aria-live": "polite",
|
|
1168
1174
|
"aria-atomic": "true",
|
|
1169
1175
|
role: "status"
|
|
1170
1176
|
}, "100%");
|
|
1171
1177
|
const a = x({
|
|
1172
|
-
icon:
|
|
1178
|
+
icon: ve,
|
|
1173
1179
|
title: "Zoom In",
|
|
1174
1180
|
className: "toolbar-btn",
|
|
1175
1181
|
testId: "btn-zoom-in",
|
|
@@ -1179,7 +1185,7 @@ class De {
|
|
|
1179
1185
|
this.editor.setZoom(h + 0.25);
|
|
1180
1186
|
}
|
|
1181
1187
|
}), o = x({
|
|
1182
|
-
icon:
|
|
1188
|
+
icon: Pe,
|
|
1183
1189
|
title: "Fit to Screen",
|
|
1184
1190
|
className: "toolbar-btn",
|
|
1185
1191
|
testId: "btn-fit-screen",
|
|
@@ -1187,16 +1193,16 @@ class De {
|
|
|
1187
1193
|
onClick: () => this.editor.fitToScreen()
|
|
1188
1194
|
});
|
|
1189
1195
|
i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
|
|
1190
|
-
const n =
|
|
1196
|
+
const n = d("div", { className: "toolbar-section toolbar-right" });
|
|
1191
1197
|
this._themeBtn = x({
|
|
1192
|
-
icon: this.state.get("isDarkMode") ?
|
|
1198
|
+
icon: this.state.get("isDarkMode") ? K : Q,
|
|
1193
1199
|
title: "Toggle Theme",
|
|
1194
1200
|
className: "toolbar-btn toolbar-btn-theme",
|
|
1195
1201
|
testId: "btn-toggle-theme",
|
|
1196
1202
|
ariaLabel: "Toggle theme",
|
|
1197
1203
|
onClick: () => this.editor.toggleTheme()
|
|
1198
1204
|
}), this._cropBtn = x({
|
|
1199
|
-
icon:
|
|
1205
|
+
icon: de,
|
|
1200
1206
|
title: "Crop",
|
|
1201
1207
|
className: "toolbar-btn toolbar-btn-crop",
|
|
1202
1208
|
testId: "btn-crop",
|
|
@@ -1206,20 +1212,20 @@ class De {
|
|
|
1206
1212
|
}
|
|
1207
1213
|
});
|
|
1208
1214
|
const l = x({
|
|
1209
|
-
icon:
|
|
1215
|
+
icon: ue,
|
|
1210
1216
|
title: "Reset All",
|
|
1211
1217
|
className: "toolbar-btn",
|
|
1212
1218
|
testId: "btn-reset-all",
|
|
1213
1219
|
ariaLabel: "Reset all changes",
|
|
1214
1220
|
onClick: () => this.editor.resetAll()
|
|
1215
1221
|
}), c = x({
|
|
1216
|
-
icon:
|
|
1222
|
+
icon: Te,
|
|
1217
1223
|
title: "Save Image",
|
|
1218
1224
|
className: "toolbar-btn toolbar-btn-primary",
|
|
1219
1225
|
testId: "btn-save-edit",
|
|
1220
1226
|
ariaLabel: "Save image",
|
|
1221
1227
|
onClick: () => this.editor.save()
|
|
1222
|
-
}),
|
|
1228
|
+
}), u = x({
|
|
1223
1229
|
icon: G,
|
|
1224
1230
|
title: "Close",
|
|
1225
1231
|
className: "toolbar-btn",
|
|
@@ -1227,7 +1233,7 @@ class De {
|
|
|
1227
1233
|
ariaLabel: "Close editor",
|
|
1228
1234
|
onClick: () => this.editor.close()
|
|
1229
1235
|
});
|
|
1230
|
-
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(
|
|
1236
|
+
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(u), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
|
|
1231
1237
|
}
|
|
1232
1238
|
/**
|
|
1233
1239
|
* Subscribe to state changes
|
|
@@ -1238,7 +1244,7 @@ class De {
|
|
|
1238
1244
|
});
|
|
1239
1245
|
this._unsubscribers.push(e);
|
|
1240
1246
|
const t = this.state.on("change:isDarkMode", ({ value: r }) => {
|
|
1241
|
-
this._themeBtn.innerHTML = r ?
|
|
1247
|
+
this._themeBtn.innerHTML = r ? K : Q;
|
|
1242
1248
|
});
|
|
1243
1249
|
this._unsubscribers.push(t);
|
|
1244
1250
|
const i = this.state.on("change:mode", ({ value: r }) => {
|
|
@@ -1262,23 +1268,23 @@ class De {
|
|
|
1262
1268
|
}
|
|
1263
1269
|
}
|
|
1264
1270
|
const L = [
|
|
1265
|
-
{ id: "adjust", name: "Adjust", icon:
|
|
1271
|
+
{ id: "adjust", name: "Adjust", icon: Me },
|
|
1266
1272
|
// adjustment, adjustmentAdvanced, alpha
|
|
1267
|
-
{ id: "blur", name: "Blur", icon:
|
|
1273
|
+
{ id: "blur", name: "Blur", icon: Fe },
|
|
1268
1274
|
// blur, kawaseBlur, motionBlur, radialBlur, etc.
|
|
1269
|
-
{ id: "color", name: "Color", icon:
|
|
1275
|
+
{ id: "color", name: "Color", icon: Ae },
|
|
1270
1276
|
// colorOverlay, grayscale, hslAdjustment, etc.
|
|
1271
|
-
{ id: "effects", name: "Effects", icon:
|
|
1277
|
+
{ id: "effects", name: "Effects", icon: ze },
|
|
1272
1278
|
// noise, vignette, pixelate, dropShadow, etc.
|
|
1273
|
-
{ id: "distortion", name: "Distortion", icon:
|
|
1279
|
+
{ id: "distortion", name: "Distortion", icon: Ne },
|
|
1274
1280
|
// twist, bulgePinch, displacement, etc.
|
|
1275
|
-
{ id: "light", name: "Light", icon:
|
|
1281
|
+
{ id: "light", name: "Light", icon: Re },
|
|
1276
1282
|
// bloom, glow, godray, advancedBloom
|
|
1277
|
-
{ id: "stylize", name: "Stylize", icon:
|
|
1283
|
+
{ id: "stylize", name: "Stylize", icon: Oe },
|
|
1278
1284
|
// ascii, crt, crossHatch, dot, emboss
|
|
1279
|
-
{ id: "crop", name: "Crop", icon:
|
|
1285
|
+
{ id: "crop", name: "Crop", icon: de }
|
|
1280
1286
|
];
|
|
1281
|
-
class
|
|
1287
|
+
class De {
|
|
1282
1288
|
constructor(e, t) {
|
|
1283
1289
|
this.state = e, this.editor = t, this.element = null, this._chips = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [];
|
|
1284
1290
|
}
|
|
@@ -1288,15 +1294,15 @@ class Ue {
|
|
|
1288
1294
|
* @returns {HTMLElement}
|
|
1289
1295
|
*/
|
|
1290
1296
|
render(e) {
|
|
1291
|
-
this._onSelect = e, this.element =
|
|
1297
|
+
this._onSelect = e, this.element = d("div", {
|
|
1292
1298
|
className: "category-carousel-container",
|
|
1293
1299
|
"data-testid": "category-carousel"
|
|
1294
1300
|
}), this._leftBtn = x({
|
|
1295
|
-
icon:
|
|
1301
|
+
icon: ce,
|
|
1296
1302
|
title: "Previous categories",
|
|
1297
1303
|
className: "carousel-nav carousel-nav-left",
|
|
1298
1304
|
onClick: () => this._scrollLeft()
|
|
1299
|
-
}), this._carousel =
|
|
1305
|
+
}), this._carousel = d("div", { className: "category-carousel" }), L.forEach((i) => {
|
|
1300
1306
|
const r = W({
|
|
1301
1307
|
label: i.name,
|
|
1302
1308
|
icon: i.icon,
|
|
@@ -1305,18 +1311,18 @@ class Ue {
|
|
|
1305
1311
|
});
|
|
1306
1312
|
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);
|
|
1307
1313
|
}), this._rightBtn = x({
|
|
1308
|
-
icon:
|
|
1314
|
+
icon: he,
|
|
1309
1315
|
title: "Next categories",
|
|
1310
1316
|
className: "carousel-nav carousel-nav-right",
|
|
1311
1317
|
onClick: () => this._scrollRight()
|
|
1312
|
-
}), this._pagination =
|
|
1318
|
+
}), this._pagination = d("div", {
|
|
1313
1319
|
className: "carousel-pagination",
|
|
1314
1320
|
role: "tablist",
|
|
1315
1321
|
"aria-label": "Category pages"
|
|
1316
1322
|
});
|
|
1317
1323
|
const t = Math.ceil(L.length / 3);
|
|
1318
1324
|
for (let i = 0; i < t; i++) {
|
|
1319
|
-
const r =
|
|
1325
|
+
const r = d("button", {
|
|
1320
1326
|
type: "button",
|
|
1321
1327
|
className: `pagination-dot ${i === 0 ? "active" : ""}`,
|
|
1322
1328
|
role: "tab",
|
|
@@ -1413,7 +1419,7 @@ class Ue {
|
|
|
1413
1419
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1414
1420
|
}
|
|
1415
1421
|
}
|
|
1416
|
-
class
|
|
1422
|
+
class Ue {
|
|
1417
1423
|
constructor(e, t) {
|
|
1418
1424
|
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;
|
|
1419
1425
|
}
|
|
@@ -1423,13 +1429,13 @@ class Ve {
|
|
|
1423
1429
|
* @returns {HTMLElement}
|
|
1424
1430
|
*/
|
|
1425
1431
|
render({ onToggle: e, onSelect: t }) {
|
|
1426
|
-
return this._onToggle = e, this._onSelect = t, this.element =
|
|
1427
|
-
icon:
|
|
1432
|
+
return this._onToggle = e, this._onSelect = t, this.element = d("div", { className: "filter-carousel-container" }), this._leftBtn = x({
|
|
1433
|
+
icon: ce,
|
|
1428
1434
|
title: "Previous filters",
|
|
1429
1435
|
className: "carousel-nav carousel-nav-left",
|
|
1430
1436
|
onClick: () => this._scrollLeft()
|
|
1431
|
-
}), this._carousel =
|
|
1432
|
-
icon:
|
|
1437
|
+
}), this._carousel = d("div", { className: "filter-carousel" }), this._rightBtn = x({
|
|
1438
|
+
icon: he,
|
|
1433
1439
|
title: "Next filters",
|
|
1434
1440
|
className: "carousel-nav carousel-nav-right",
|
|
1435
1441
|
onClick: () => this._scrollRight()
|
|
@@ -1475,14 +1481,14 @@ class Ve {
|
|
|
1475
1481
|
* @returns {HTMLElement}
|
|
1476
1482
|
*/
|
|
1477
1483
|
_createFilterCard(e, { isActive: t, isSelected: i }) {
|
|
1478
|
-
const r =
|
|
1484
|
+
const r = d("div", {
|
|
1479
1485
|
className: `filter-card ${t ? "active" : ""} ${i ? "selected" : ""}`,
|
|
1480
1486
|
"data-filter": e.id,
|
|
1481
1487
|
"data-testid": `filter-${e.id}`,
|
|
1482
1488
|
onClick: () => this._handleCardClick(e.id)
|
|
1483
|
-
}), a =
|
|
1489
|
+
}), a = d("div", { className: "filter-preview" }), o = d("span", { className: "filter-preview-text" }, e.name.charAt(0));
|
|
1484
1490
|
a.appendChild(o);
|
|
1485
|
-
const n =
|
|
1491
|
+
const n = d("span", { className: "filter-name", title: e.name }, e.name), l = d("button", {
|
|
1486
1492
|
className: `filter-toggle ${t ? "active" : ""}`,
|
|
1487
1493
|
onClick: (c) => {
|
|
1488
1494
|
var p;
|
|
@@ -1570,7 +1576,7 @@ class Ve {
|
|
|
1570
1576
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterCards.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1571
1577
|
}
|
|
1572
1578
|
}
|
|
1573
|
-
class
|
|
1579
|
+
class Ve {
|
|
1574
1580
|
constructor(e, t) {
|
|
1575
1581
|
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 = [];
|
|
1576
1582
|
}
|
|
@@ -1580,7 +1586,7 @@ class je {
|
|
|
1580
1586
|
* @returns {HTMLElement}
|
|
1581
1587
|
*/
|
|
1582
1588
|
render({ onChange: e, onReset: t, onAction: i }) {
|
|
1583
|
-
return this._onChange = e, this._onReset = t, this._onAction = i, this.element =
|
|
1589
|
+
return this._onChange = e, this._onReset = t, this._onAction = i, this.element = d("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
|
|
1584
1590
|
}
|
|
1585
1591
|
/**
|
|
1586
1592
|
* Subscribe to state changes
|
|
@@ -1603,24 +1609,24 @@ class je {
|
|
|
1603
1609
|
const e = this.state.get("selectedFilter");
|
|
1604
1610
|
if (!e) {
|
|
1605
1611
|
this.element.appendChild(
|
|
1606
|
-
|
|
1612
|
+
d("div", { className: "no-filter-selected" }, "Select a filter to adjust")
|
|
1607
1613
|
);
|
|
1608
1614
|
return;
|
|
1609
1615
|
}
|
|
1610
1616
|
const t = this.filterManager.getFilterDef(e);
|
|
1611
1617
|
if (!t) {
|
|
1612
1618
|
this.element.appendChild(
|
|
1613
|
-
|
|
1619
|
+
d("div", { className: "no-filter-selected" }, "Filter not found")
|
|
1614
1620
|
);
|
|
1615
1621
|
return;
|
|
1616
1622
|
}
|
|
1617
|
-
const i =
|
|
1618
|
-
i.appendChild(
|
|
1623
|
+
const i = d("div", { className: "adjustments-header" });
|
|
1624
|
+
i.appendChild(d("span", { className: "adjustments-title" }, t.name)), i.appendChild(A({
|
|
1619
1625
|
label: "Reset",
|
|
1620
1626
|
className: "btn-text",
|
|
1621
1627
|
onClick: () => this._handleReset(e)
|
|
1622
1628
|
})), this.element.appendChild(i);
|
|
1623
|
-
const r =
|
|
1629
|
+
const r = d("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
|
|
1624
1630
|
t.controls.forEach((o) => {
|
|
1625
1631
|
const n = this._createControl(e, o, a[o.id] ?? o.default);
|
|
1626
1632
|
n && (this._controls.set(o.id, n), r.appendChild(n));
|
|
@@ -1638,7 +1644,7 @@ class je {
|
|
|
1638
1644
|
const r = t.label || t.id;
|
|
1639
1645
|
switch (this._normalizeControlType(t.type)) {
|
|
1640
1646
|
case "slider":
|
|
1641
|
-
return
|
|
1647
|
+
return ae({
|
|
1642
1648
|
id: `${e}-${t.id}`,
|
|
1643
1649
|
label: r,
|
|
1644
1650
|
min: t.min ?? 0,
|
|
@@ -1648,14 +1654,14 @@ class je {
|
|
|
1648
1654
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1649
1655
|
});
|
|
1650
1656
|
case "toggle":
|
|
1651
|
-
return
|
|
1657
|
+
return oe({
|
|
1652
1658
|
id: `${e}-${t.id}`,
|
|
1653
1659
|
label: r,
|
|
1654
1660
|
checked: !!i,
|
|
1655
1661
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1656
1662
|
});
|
|
1657
1663
|
case "color":
|
|
1658
|
-
return
|
|
1664
|
+
return ne({
|
|
1659
1665
|
id: `${e}-${t.id}`,
|
|
1660
1666
|
label: r,
|
|
1661
1667
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1663,7 +1669,7 @@ class je {
|
|
|
1663
1669
|
});
|
|
1664
1670
|
case "select":
|
|
1665
1671
|
const o = this._normalizeOptions(t.options);
|
|
1666
|
-
return
|
|
1672
|
+
return le({
|
|
1667
1673
|
id: `${e}-${t.id}`,
|
|
1668
1674
|
label: r,
|
|
1669
1675
|
options: o,
|
|
@@ -1671,8 +1677,8 @@ class je {
|
|
|
1671
1677
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1672
1678
|
});
|
|
1673
1679
|
case "button":
|
|
1674
|
-
const n =
|
|
1675
|
-
return n.appendChild(
|
|
1680
|
+
const n = d("div", { className: "button-control" });
|
|
1681
|
+
return n.appendChild(A({
|
|
1676
1682
|
label: r,
|
|
1677
1683
|
className: "btn-secondary",
|
|
1678
1684
|
onClick: () => this._handleAction(e, t.action || t.id)
|
|
@@ -1773,7 +1779,7 @@ class je {
|
|
|
1773
1779
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._controls.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1774
1780
|
}
|
|
1775
1781
|
}
|
|
1776
|
-
class
|
|
1782
|
+
class je {
|
|
1777
1783
|
constructor(e, t) {
|
|
1778
1784
|
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;
|
|
1779
1785
|
}
|
|
@@ -1783,31 +1789,31 @@ class qe {
|
|
|
1783
1789
|
* @param {Object} callbacks - { onChange, onReset, onRemove, onAction }
|
|
1784
1790
|
*/
|
|
1785
1791
|
build(e, { onChange: t, onReset: i, onRemove: r, onAction: a }) {
|
|
1786
|
-
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer =
|
|
1787
|
-
const o =
|
|
1788
|
-
this._titleEl =
|
|
1789
|
-
const n =
|
|
1792
|
+
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = d("div", { className: "mobile-filter-drawer" });
|
|
1793
|
+
const o = d("div", { className: "drawer-header" });
|
|
1794
|
+
this._titleEl = d("span", { className: "drawer-title" }, "Filter");
|
|
1795
|
+
const n = d("div", { className: "drawer-header-actions" }), l = A({
|
|
1790
1796
|
label: "Reset",
|
|
1791
1797
|
className: "btn-text",
|
|
1792
1798
|
onClick: () => {
|
|
1793
1799
|
var h;
|
|
1794
1800
|
this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
|
|
1795
1801
|
}
|
|
1796
|
-
}), c =
|
|
1802
|
+
}), c = A({
|
|
1797
1803
|
label: "Remove",
|
|
1798
1804
|
className: "btn-text btn-danger",
|
|
1799
1805
|
onClick: () => {
|
|
1800
1806
|
var h;
|
|
1801
1807
|
this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
|
|
1802
1808
|
}
|
|
1803
|
-
}),
|
|
1809
|
+
}), u = x({
|
|
1804
1810
|
icon: G,
|
|
1805
1811
|
title: "Close",
|
|
1806
1812
|
className: "btn-icon-sm",
|
|
1807
1813
|
ariaLabel: "Close drawer",
|
|
1808
1814
|
onClick: () => this.close()
|
|
1809
1815
|
});
|
|
1810
|
-
n.appendChild(l), n.appendChild(c), n.appendChild(
|
|
1816
|
+
n.appendChild(l), n.appendChild(c), n.appendChild(u), o.appendChild(this._titleEl), o.appendChild(n), this._drawer.appendChild(o), this._body = d("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
|
|
1811
1817
|
}
|
|
1812
1818
|
/**
|
|
1813
1819
|
* Open the drawer for a specific filter
|
|
@@ -1857,7 +1863,7 @@ class qe {
|
|
|
1857
1863
|
const e = this.filterManager.getFilterDef(this._currentFilterId);
|
|
1858
1864
|
if (!e) return;
|
|
1859
1865
|
this._titleEl.textContent = e.name;
|
|
1860
|
-
const t =
|
|
1866
|
+
const t = d("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
|
|
1861
1867
|
e.controls.forEach((r) => {
|
|
1862
1868
|
if (r.hidden) return;
|
|
1863
1869
|
const a = this._createControl(this._currentFilterId, r, i[r.id] ?? r.default);
|
|
@@ -1875,7 +1881,7 @@ class qe {
|
|
|
1875
1881
|
const r = t.label || t.id;
|
|
1876
1882
|
switch (this._normalizeControlType(t.type)) {
|
|
1877
1883
|
case "slider":
|
|
1878
|
-
return
|
|
1884
|
+
return ae({
|
|
1879
1885
|
id: `drawer-${e}-${t.id}`,
|
|
1880
1886
|
label: r,
|
|
1881
1887
|
min: t.min ?? 0,
|
|
@@ -1888,7 +1894,7 @@ class qe {
|
|
|
1888
1894
|
}
|
|
1889
1895
|
});
|
|
1890
1896
|
case "toggle":
|
|
1891
|
-
return
|
|
1897
|
+
return oe({
|
|
1892
1898
|
id: `drawer-${e}-${t.id}`,
|
|
1893
1899
|
label: r,
|
|
1894
1900
|
checked: !!i,
|
|
@@ -1898,7 +1904,7 @@ class qe {
|
|
|
1898
1904
|
}
|
|
1899
1905
|
});
|
|
1900
1906
|
case "color":
|
|
1901
|
-
return
|
|
1907
|
+
return ne({
|
|
1902
1908
|
id: `drawer-${e}-${t.id}`,
|
|
1903
1909
|
label: r,
|
|
1904
1910
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1909,7 +1915,7 @@ class qe {
|
|
|
1909
1915
|
});
|
|
1910
1916
|
case "select": {
|
|
1911
1917
|
const o = this._normalizeOptions(t.options);
|
|
1912
|
-
return
|
|
1918
|
+
return le({
|
|
1913
1919
|
id: `drawer-${e}-${t.id}`,
|
|
1914
1920
|
label: r,
|
|
1915
1921
|
options: o,
|
|
@@ -1921,8 +1927,8 @@ class qe {
|
|
|
1921
1927
|
});
|
|
1922
1928
|
}
|
|
1923
1929
|
case "button": {
|
|
1924
|
-
const o =
|
|
1925
|
-
return o.appendChild(
|
|
1930
|
+
const o = d("div", { className: "button-control" });
|
|
1931
|
+
return o.appendChild(A({
|
|
1926
1932
|
label: r,
|
|
1927
1933
|
className: "btn-secondary",
|
|
1928
1934
|
onClick: () => {
|
|
@@ -1969,7 +1975,7 @@ class qe {
|
|
|
1969
1975
|
this._controls.clear(), (e = this._drawer) == null || e.remove(), this._drawer = null, this._isOpen = !1, this._currentFilterId = null, this._container = null;
|
|
1970
1976
|
}
|
|
1971
1977
|
}
|
|
1972
|
-
class
|
|
1978
|
+
class qe {
|
|
1973
1979
|
constructor(e, t) {
|
|
1974
1980
|
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;
|
|
1975
1981
|
}
|
|
@@ -1978,10 +1984,10 @@ class He {
|
|
|
1978
1984
|
* @returns {HTMLElement}
|
|
1979
1985
|
*/
|
|
1980
1986
|
render({ onToggle: e, onSelect: t }) {
|
|
1981
|
-
return this._onToggle = e, this._onSelect = t, this.element =
|
|
1987
|
+
return this._onToggle = e, this._onSelect = t, this.element = d("div", {
|
|
1982
1988
|
className: "mobile-active-filters",
|
|
1983
1989
|
"data-testid": "mobile-active-filters"
|
|
1984
|
-
}), this._scrollContainer =
|
|
1990
|
+
}), this._scrollContainer = d("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
|
|
1985
1991
|
}
|
|
1986
1992
|
_subscribeToState() {
|
|
1987
1993
|
const e = this.state.on("change:activeFilters", () => {
|
|
@@ -1997,7 +2003,7 @@ class He {
|
|
|
1997
2003
|
this._scrollContainer.innerHTML = "", this._chips.clear();
|
|
1998
2004
|
const e = this.state.get("activeFilters");
|
|
1999
2005
|
if (!e || e.size === 0) {
|
|
2000
|
-
const t =
|
|
2006
|
+
const t = d("div", {
|
|
2001
2007
|
className: "active-filter-placeholder"
|
|
2002
2008
|
}, "No active filters");
|
|
2003
2009
|
this._scrollContainer.appendChild(t);
|
|
@@ -2011,17 +2017,17 @@ class He {
|
|
|
2011
2017
|
}), this._updateSelectedState();
|
|
2012
2018
|
}
|
|
2013
2019
|
_createChip(e, t) {
|
|
2014
|
-
const i =
|
|
2020
|
+
const i = d("div", {
|
|
2015
2021
|
className: "active-filter-chip",
|
|
2016
2022
|
"data-filter-id": e,
|
|
2017
2023
|
"data-testid": `active-chip-${e}`
|
|
2018
|
-
}), r =
|
|
2024
|
+
}), r = d("span", {
|
|
2019
2025
|
className: "active-filter-chip-label",
|
|
2020
2026
|
onClick: (o) => {
|
|
2021
2027
|
var n;
|
|
2022
2028
|
o.stopPropagation(), (n = this._onSelect) == null || n.call(this, e);
|
|
2023
2029
|
}
|
|
2024
|
-
}, t.name), a =
|
|
2030
|
+
}, t.name), a = d("button", {
|
|
2025
2031
|
className: "active-filter-chip-check",
|
|
2026
2032
|
"aria-label": `Remove ${t.name} filter`,
|
|
2027
2033
|
onClick: (o) => {
|
|
@@ -2042,11 +2048,11 @@ class He {
|
|
|
2042
2048
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2043
2049
|
}
|
|
2044
2050
|
}
|
|
2045
|
-
const
|
|
2046
|
-
{ id: "free", name: "Free", icon:
|
|
2047
|
-
{ id: "square", name: "Square", icon:
|
|
2048
|
-
{ id: "circle", name: "Circle", icon:
|
|
2049
|
-
],
|
|
2051
|
+
const He = [
|
|
2052
|
+
{ id: "free", name: "Free", icon: Be },
|
|
2053
|
+
{ id: "square", name: "Square", icon: Xe },
|
|
2054
|
+
{ id: "circle", name: "Circle", icon: Ye }
|
|
2055
|
+
], $e = [
|
|
2050
2056
|
{ id: "free", name: "Free" },
|
|
2051
2057
|
{ id: "1:1", name: "1:1" },
|
|
2052
2058
|
{ id: "4:3", name: "4:3" },
|
|
@@ -2054,7 +2060,7 @@ const $e = [
|
|
|
2054
2060
|
{ id: "3:2", name: "3:2" },
|
|
2055
2061
|
{ id: "2:3", name: "2:3" }
|
|
2056
2062
|
];
|
|
2057
|
-
class
|
|
2063
|
+
class We {
|
|
2058
2064
|
constructor(e, t) {
|
|
2059
2065
|
this.state = e, this.cropManager = t, this.element = null, this._shapeChips = /* @__PURE__ */ new Map(), this._aspectChips = /* @__PURE__ */ new Map(), this._unsubscribers = [];
|
|
2060
2066
|
}
|
|
@@ -2063,39 +2069,39 @@ class Ze {
|
|
|
2063
2069
|
* @returns {HTMLElement}
|
|
2064
2070
|
*/
|
|
2065
2071
|
render() {
|
|
2066
|
-
this.element =
|
|
2072
|
+
this.element = d("div", {
|
|
2067
2073
|
className: "crop-controls",
|
|
2068
2074
|
"data-testid": "crop-controls"
|
|
2069
2075
|
});
|
|
2070
|
-
const e =
|
|
2071
|
-
e.appendChild(
|
|
2072
|
-
const t =
|
|
2073
|
-
|
|
2074
|
-
const
|
|
2076
|
+
const e = d("div", { className: "crop-section" });
|
|
2077
|
+
e.appendChild(d("label", { className: "section-label" }, "Shape"));
|
|
2078
|
+
const t = d("div", { className: "chip-row" }), i = this.state.get("crop.shape");
|
|
2079
|
+
He.forEach((c) => {
|
|
2080
|
+
const u = W({
|
|
2075
2081
|
label: c.name,
|
|
2076
2082
|
icon: c.icon,
|
|
2077
2083
|
active: i === c.id,
|
|
2078
2084
|
onClick: () => this._selectShape(c.id)
|
|
2079
2085
|
});
|
|
2080
|
-
|
|
2081
|
-
}), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection =
|
|
2082
|
-
const r =
|
|
2083
|
-
|
|
2084
|
-
const
|
|
2086
|
+
u.dataset.shape = c.id, u.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, u), t.appendChild(u);
|
|
2087
|
+
}), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = d("div", { className: "crop-section" }), this._aspectSection.appendChild(d("label", { className: "section-label" }, "Aspect Ratio"));
|
|
2088
|
+
const r = d("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
|
|
2089
|
+
$e.forEach((c) => {
|
|
2090
|
+
const u = W({
|
|
2085
2091
|
label: c.name,
|
|
2086
2092
|
active: a === c.id,
|
|
2087
2093
|
onClick: () => this._selectAspect(c.id)
|
|
2088
2094
|
});
|
|
2089
|
-
|
|
2095
|
+
u.dataset.ratio = c.id, u.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, u), r.appendChild(u);
|
|
2090
2096
|
}), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
|
|
2091
|
-
const o =
|
|
2097
|
+
const o = d("div", { className: "crop-actions" }), n = A({
|
|
2092
2098
|
label: "Cancel",
|
|
2093
2099
|
className: "btn-secondary crop-cancel-btn",
|
|
2094
2100
|
icon: G,
|
|
2095
2101
|
onClick: () => this.cropManager.cancel()
|
|
2096
2102
|
});
|
|
2097
2103
|
n.dataset.testid = "cancel-crop";
|
|
2098
|
-
const l =
|
|
2104
|
+
const l = A({
|
|
2099
2105
|
label: "Apply Crop",
|
|
2100
2106
|
className: "btn-primary crop-apply-btn",
|
|
2101
2107
|
icon: Z,
|
|
@@ -2161,7 +2167,7 @@ class Ze {
|
|
|
2161
2167
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._shapeChips.clear(), this._aspectChips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2162
2168
|
}
|
|
2163
2169
|
}
|
|
2164
|
-
class
|
|
2170
|
+
class Ze {
|
|
2165
2171
|
constructor(e, t) {
|
|
2166
2172
|
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;
|
|
2167
2173
|
}
|
|
@@ -2171,18 +2177,18 @@ class Ge {
|
|
|
2171
2177
|
* @returns {HTMLElement}
|
|
2172
2178
|
*/
|
|
2173
2179
|
render({ onRemove: e, onReset: t, onClearAll: i, onUpdateValue: r, onSelect: a }) {
|
|
2174
|
-
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element =
|
|
2180
|
+
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = d("div", {
|
|
2175
2181
|
className: "active-filters-panel",
|
|
2176
2182
|
"data-testid": "active-filters-panel"
|
|
2177
2183
|
});
|
|
2178
|
-
const o =
|
|
2179
|
-
o.appendChild(
|
|
2180
|
-
const n =
|
|
2184
|
+
const o = d("div", { className: "panel-header" });
|
|
2185
|
+
o.appendChild(d("h3", { className: "panel-title" }, "Active Filters"));
|
|
2186
|
+
const n = A({
|
|
2181
2187
|
label: "Clear All",
|
|
2182
2188
|
className: "btn-text btn-danger",
|
|
2183
2189
|
onClick: () => this._handleClearAll()
|
|
2184
2190
|
});
|
|
2185
|
-
return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer =
|
|
2191
|
+
return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer = d("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
|
|
2186
2192
|
}
|
|
2187
2193
|
/**
|
|
2188
2194
|
* Subscribe to state changes
|
|
@@ -2218,7 +2224,7 @@ class Ge {
|
|
|
2218
2224
|
const e = this.state.get("activeFilters");
|
|
2219
2225
|
if (e.size === 0) {
|
|
2220
2226
|
this._listContainer.appendChild(
|
|
2221
|
-
|
|
2227
|
+
d("div", { className: "no-filters-message" }, "No filters active")
|
|
2222
2228
|
);
|
|
2223
2229
|
return;
|
|
2224
2230
|
}
|
|
@@ -2236,26 +2242,26 @@ class Ge {
|
|
|
2236
2242
|
* @returns {HTMLElement}
|
|
2237
2243
|
*/
|
|
2238
2244
|
_createFilterItem(e, t) {
|
|
2239
|
-
const r = this.state.get("selectedFilter") === e, a =
|
|
2245
|
+
const r = this.state.get("selectedFilter") === e, a = d("div", {
|
|
2240
2246
|
className: `active-filter-item ${r ? "selected" : ""}`,
|
|
2241
2247
|
"data-active-filter": e,
|
|
2242
2248
|
"data-testid": `active-filter-${e}`,
|
|
2243
2249
|
onClick: (m) => {
|
|
2244
2250
|
m.target.closest(".filter-item-actions") || this._handleSelect(e);
|
|
2245
2251
|
}
|
|
2246
|
-
}), o =
|
|
2247
|
-
icon:
|
|
2252
|
+
}), o = d("div", { className: "filter-item-header" }), n = d("span", { className: "filter-item-name" }, t.name), l = d("div", { className: "filter-item-actions" }), c = x({
|
|
2253
|
+
icon: ue,
|
|
2248
2254
|
title: "Reset filter",
|
|
2249
2255
|
className: "btn-icon-sm",
|
|
2250
2256
|
onClick: () => this._handleReset(e)
|
|
2251
|
-
}),
|
|
2252
|
-
icon:
|
|
2257
|
+
}), u = x({
|
|
2258
|
+
icon: Ie,
|
|
2253
2259
|
title: "Remove filter",
|
|
2254
2260
|
className: "btn-icon-sm btn-danger",
|
|
2255
2261
|
onClick: () => this._handleRemove(e)
|
|
2256
2262
|
});
|
|
2257
|
-
l.appendChild(c), l.appendChild(
|
|
2258
|
-
const h = this.state.getFilterValues(e), p =
|
|
2263
|
+
l.appendChild(c), l.appendChild(u), o.appendChild(n), o.appendChild(l), a.appendChild(o);
|
|
2264
|
+
const h = this.state.getFilterValues(e), p = d("div", { className: "filter-item-summary" });
|
|
2259
2265
|
return p.textContent = this._getValuesSummary(t, h), a.appendChild(p), a._summaryEl = p, a;
|
|
2260
2266
|
}
|
|
2261
2267
|
/**
|
|
@@ -2362,7 +2368,7 @@ class Ge {
|
|
|
2362
2368
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterItems.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2363
2369
|
}
|
|
2364
2370
|
}
|
|
2365
|
-
const
|
|
2371
|
+
const Y = {
|
|
2366
2372
|
name: "free",
|
|
2367
2373
|
initialMode: "filters",
|
|
2368
2374
|
cropShape: "free",
|
|
@@ -2376,10 +2382,10 @@ const B = {
|
|
|
2376
2382
|
maxExportHeight: void 0
|
|
2377
2383
|
}, q = {
|
|
2378
2384
|
free: {
|
|
2379
|
-
...
|
|
2385
|
+
...Y
|
|
2380
2386
|
},
|
|
2381
2387
|
avatar: {
|
|
2382
|
-
...
|
|
2388
|
+
...Y,
|
|
2383
2389
|
name: "avatar",
|
|
2384
2390
|
initialMode: "crop",
|
|
2385
2391
|
cropShape: "circle",
|
|
@@ -2389,7 +2395,7 @@ const B = {
|
|
|
2389
2395
|
lockAspectRatio: !0
|
|
2390
2396
|
},
|
|
2391
2397
|
banner: {
|
|
2392
|
-
...
|
|
2398
|
+
...Y,
|
|
2393
2399
|
name: "banner",
|
|
2394
2400
|
initialMode: "crop",
|
|
2395
2401
|
cropShape: "square",
|
|
@@ -2399,7 +2405,7 @@ const B = {
|
|
|
2399
2405
|
lockAspectRatio: !0
|
|
2400
2406
|
},
|
|
2401
2407
|
product: {
|
|
2402
|
-
...
|
|
2408
|
+
...Y,
|
|
2403
2409
|
name: "product",
|
|
2404
2410
|
initialMode: "filters",
|
|
2405
2411
|
cropShape: "square",
|
|
@@ -2409,15 +2415,15 @@ const B = {
|
|
|
2409
2415
|
lockAspectRatio: !1
|
|
2410
2416
|
}
|
|
2411
2417
|
};
|
|
2412
|
-
function
|
|
2418
|
+
function Ge(s) {
|
|
2413
2419
|
if (!s)
|
|
2414
2420
|
return { ...q.free };
|
|
2415
2421
|
if (typeof s == "object" && s !== null)
|
|
2416
|
-
return { ...
|
|
2422
|
+
return { ...Y, ...s };
|
|
2417
2423
|
const e = q[s];
|
|
2418
2424
|
return e ? { ...e } : { ...q.free };
|
|
2419
2425
|
}
|
|
2420
|
-
class
|
|
2426
|
+
class Gt extends B {
|
|
2421
2427
|
/**
|
|
2422
2428
|
* Create a new VanillaImageEditor
|
|
2423
2429
|
* @param {HTMLElement} container - Container element to mount the editor
|
|
@@ -2428,7 +2434,7 @@ class Kt extends O {
|
|
|
2428
2434
|
if (super(), !e)
|
|
2429
2435
|
throw new Error("VanillaImageEditor: container element is required");
|
|
2430
2436
|
this._container = e;
|
|
2431
|
-
const i = t.preset ?
|
|
2437
|
+
const i = t.preset ? Ge(t.preset) : null, r = i ? {
|
|
2432
2438
|
initialMode: i.initialMode === "crop" ? "crop" : "adjust",
|
|
2433
2439
|
cropShape: i.cropShape,
|
|
2434
2440
|
initialAspectRatio: i.aspectRatio
|
|
@@ -2446,7 +2452,7 @@ class Kt extends O {
|
|
|
2446
2452
|
},
|
|
2447
2453
|
...r,
|
|
2448
2454
|
...t
|
|
2449
|
-
}, this._preset = i, this._state =
|
|
2455
|
+
}, this._preset = i, this._state = _e(), this._state.set("theme", this._options.theme), this._state.set("crop.shape", this._options.cropShape), this._state.set("crop.aspect", this._options.initialAspectRatio), this._preset && (this._state.set("lockCropShape", !!this._preset.lockCropShape), this._state.set("lockAspectRatio", !!this._preset.lockAspectRatio), this._state.set("showFilters", this._preset.showFilters !== !1), this._state.set("showCropControls", this._preset.showCropControls !== !1), this._state.set("autoZoomOnCropOverflow", !!this._preset.autoZoomOnCropOverflow)), this._renderer = new xe(), this._filterManager = new we(this._state, this._renderer), this._cropManager = new $(this._state, this._renderer), this._removeBgManager = null, ((a = this._options.backgroundRemoval) == null ? void 0 : a.enabled) !== !1 && (this._removeBgManager = new Se({
|
|
2450
2456
|
endpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.endpoint,
|
|
2451
2457
|
fallbackEndpoint: (n = this._options.backgroundRemoval) == null ? void 0 : n.fallbackEndpoint
|
|
2452
2458
|
})), 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();
|
|
@@ -2464,13 +2470,13 @@ class Kt extends O {
|
|
|
2464
2470
|
* Build DOM structure
|
|
2465
2471
|
*/
|
|
2466
2472
|
_buildDOM() {
|
|
2467
|
-
this._container.innerHTML = "", this._editorEl =
|
|
2473
|
+
this._container.innerHTML = "", this._editorEl = d("div", {
|
|
2468
2474
|
className: `vanilla-image-editor ${this._state.get("isDarkMode") ? "dark" : "light"}`
|
|
2469
2475
|
});
|
|
2470
|
-
const e =
|
|
2476
|
+
const e = d("div", { className: "editor-toolbar-container" });
|
|
2471
2477
|
this._editorEl.appendChild(e), this._toolbarContainer = e;
|
|
2472
|
-
const t =
|
|
2473
|
-
this._canvasContainer =
|
|
2478
|
+
const t = d("div", { className: "editor-content" }), i = d("div", { className: "canvas-section" });
|
|
2479
|
+
this._canvasContainer = d("div", { className: "canvas-container" }), this._cropOverlay = d("canvas", { className: "crop-overlay", "aria-hidden": "true" }), i.appendChild(this._canvasContainer), i.appendChild(this._cropOverlay), t.appendChild(i), this._controlsSection = d("div", { className: "controls-section" }), t.appendChild(this._controlsSection), this._editorEl.appendChild(t), this._fileInput = d("input", {
|
|
2474
2480
|
type: "file",
|
|
2475
2481
|
accept: "image/*",
|
|
2476
2482
|
className: "hidden-file-input",
|
|
@@ -2482,31 +2488,31 @@ class Kt extends O {
|
|
|
2482
2488
|
* Initialize UI components
|
|
2483
2489
|
*/
|
|
2484
2490
|
_initUI() {
|
|
2485
|
-
this._toolbar = new
|
|
2491
|
+
this._toolbar = new Le(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = d("div", { className: "filter-controls-container" }), this._categoryCarousel = new De(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
|
|
2486
2492
|
}));
|
|
2487
|
-
const e =
|
|
2488
|
-
this._filterCarousel = new
|
|
2493
|
+
const e = d("div", { className: "filter-layout" }), t = d("div", { className: "filter-left-column" });
|
|
2494
|
+
this._filterCarousel = new Ue(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
|
|
2489
2495
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2490
2496
|
onSelect: (r) => {
|
|
2491
2497
|
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2492
2498
|
}
|
|
2493
|
-
})), this._filterAdjustments = new
|
|
2499
|
+
})), this._filterAdjustments = new Ve(this._state, this._filterManager), t.appendChild(this._filterAdjustments.render({
|
|
2494
2500
|
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2495
2501
|
onReset: (r) => this._handleFilterReset(r),
|
|
2496
2502
|
onAction: (r, a) => this._handleFilterAction(r, a)
|
|
2497
2503
|
})), e.appendChild(t);
|
|
2498
|
-
const i =
|
|
2499
|
-
this._activeFiltersPanel = new
|
|
2504
|
+
const i = d("div", { className: "filter-right-column" });
|
|
2505
|
+
this._activeFiltersPanel = new Ze(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
|
|
2500
2506
|
onRemove: (r) => this._handleFilterToggle(r, !1),
|
|
2501
2507
|
onReset: (r) => this._handleFilterReset(r),
|
|
2502
2508
|
onClearAll: () => this.resetAll(),
|
|
2503
2509
|
onSelect: (r) => this._handleFilterSelect(r)
|
|
2504
|
-
})), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new
|
|
2510
|
+
})), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new qe(this._state, this._filterManager), this._filterControlsEl.appendChild(this._mobileActiveFilters.render({
|
|
2505
2511
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2506
2512
|
onSelect: (r) => {
|
|
2507
2513
|
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2508
2514
|
}
|
|
2509
|
-
})), this._cropControls = new
|
|
2515
|
+
})), this._cropControls = new We(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 je(this._state, this._filterManager), this._mobileFilterDrawer.build(this._controlsSection, {
|
|
2510
2516
|
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2511
2517
|
onReset: (r) => this._handleFilterReset(r),
|
|
2512
2518
|
onRemove: (r) => {
|
|
@@ -2776,9 +2782,9 @@ class Kt extends O {
|
|
|
2776
2782
|
_showLoadingOverlay(e) {
|
|
2777
2783
|
var i;
|
|
2778
2784
|
if (!this._loadingOverlay)
|
|
2779
|
-
this._loadingOverlay =
|
|
2780
|
-
|
|
2781
|
-
|
|
2785
|
+
this._loadingOverlay = d("div", { className: "editor-loading-overlay" }, [
|
|
2786
|
+
d("div", { className: "editor-loading-spinner" }),
|
|
2787
|
+
d("div", { className: "editor-loading-text" }, e)
|
|
2782
2788
|
]);
|
|
2783
2789
|
else {
|
|
2784
2790
|
const r = this._loadingOverlay.querySelector(".editor-loading-text");
|
|
@@ -2798,30 +2804,30 @@ class Kt extends O {
|
|
|
2798
2804
|
* Destroy the editor and clean up
|
|
2799
2805
|
*/
|
|
2800
2806
|
destroy() {
|
|
2801
|
-
var e, t, i, r, a, o, n, l, c,
|
|
2802
|
-
(e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (
|
|
2807
|
+
var e, t, i, r, a, o, n, l, c, u;
|
|
2808
|
+
(e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (u = this._editorEl) == null || u.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
|
|
2803
2809
|
}
|
|
2804
2810
|
}
|
|
2805
|
-
const
|
|
2806
|
-
function
|
|
2811
|
+
const S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
2812
|
+
function Ke(s, e) {
|
|
2807
2813
|
return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
|
|
2808
2814
|
}
|
|
2809
2815
|
function f(s) {
|
|
2810
2816
|
var e;
|
|
2811
|
-
return
|
|
2817
|
+
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;
|
|
2812
2818
|
}
|
|
2813
|
-
function
|
|
2814
|
-
return
|
|
2819
|
+
function Qe(s) {
|
|
2820
|
+
return S.get(s);
|
|
2815
2821
|
}
|
|
2816
2822
|
function U() {
|
|
2817
|
-
return Array.from(
|
|
2823
|
+
return Array.from(S.values());
|
|
2818
2824
|
}
|
|
2819
|
-
function
|
|
2825
|
+
function Je() {
|
|
2820
2826
|
U().map((t) => t.id), Object.entries(g).filter(
|
|
2821
2827
|
(t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
|
|
2822
2828
|
).forEach(([t, i]) => {
|
|
2823
2829
|
const r = t.replace(/Filter$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2824
|
-
|
|
2830
|
+
S.has(r) || f({
|
|
2825
2831
|
id: r,
|
|
2826
2832
|
name: t.replace(/Filter$/, ""),
|
|
2827
2833
|
category: "unlisted",
|
|
@@ -2840,20 +2846,20 @@ function et() {
|
|
|
2840
2846
|
});
|
|
2841
2847
|
});
|
|
2842
2848
|
}
|
|
2843
|
-
function
|
|
2844
|
-
return (I.get(s) || []).map((t) =>
|
|
2849
|
+
function et(s) {
|
|
2850
|
+
return (I.get(s) || []).map((t) => S.get(t)).filter(Boolean);
|
|
2845
2851
|
}
|
|
2846
|
-
function
|
|
2852
|
+
function tt() {
|
|
2847
2853
|
return Array.from(I.keys());
|
|
2848
2854
|
}
|
|
2849
|
-
function
|
|
2850
|
-
return
|
|
2855
|
+
function Kt(s) {
|
|
2856
|
+
return S.has(s);
|
|
2851
2857
|
}
|
|
2852
|
-
function
|
|
2853
|
-
const e =
|
|
2858
|
+
function it(s) {
|
|
2859
|
+
const e = S.get(s);
|
|
2854
2860
|
if (!e)
|
|
2855
2861
|
return !1;
|
|
2856
|
-
|
|
2862
|
+
S.delete(s);
|
|
2857
2863
|
const t = I.get(e.category);
|
|
2858
2864
|
if (t) {
|
|
2859
2865
|
const i = t.indexOf(s);
|
|
@@ -2861,12 +2867,12 @@ function rt(s) {
|
|
|
2861
2867
|
}
|
|
2862
2868
|
return !0;
|
|
2863
2869
|
}
|
|
2864
|
-
function
|
|
2865
|
-
const t =
|
|
2866
|
-
return t ?
|
|
2870
|
+
function Qt(s, e) {
|
|
2871
|
+
const t = S.get(s);
|
|
2872
|
+
return t ? Ke(t, e) : !1;
|
|
2867
2873
|
}
|
|
2868
|
-
function
|
|
2869
|
-
return Array.from(
|
|
2874
|
+
function rt() {
|
|
2875
|
+
return Array.from(S.values()).map((s) => ({
|
|
2870
2876
|
id: s.id,
|
|
2871
2877
|
name: s.name,
|
|
2872
2878
|
category: s.category,
|
|
@@ -2874,17 +2880,17 @@ function st() {
|
|
|
2874
2880
|
}));
|
|
2875
2881
|
}
|
|
2876
2882
|
if (typeof window < "u") {
|
|
2877
|
-
window.__DEBUG_FILTERS_LIST = Array.from(
|
|
2883
|
+
window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter = Qe, window.getFiltersByCategory = et, window.getRegisteredFilters = rt;
|
|
2878
2884
|
const s = f;
|
|
2879
2885
|
window.registerFilter = (e) => {
|
|
2880
2886
|
const t = s(e);
|
|
2881
|
-
return window.__DEBUG_FILTERS_LIST = Array.from(
|
|
2887
|
+
return window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), t;
|
|
2882
2888
|
};
|
|
2883
2889
|
}
|
|
2884
2890
|
typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
|
|
2885
2891
|
return [];
|
|
2886
2892
|
});
|
|
2887
|
-
const { AdjustmentFilter:
|
|
2893
|
+
const { AdjustmentFilter: st } = g, { ColorMatrixFilter: at } = w, k = {
|
|
2888
2894
|
gamma: 1,
|
|
2889
2895
|
saturation: 1,
|
|
2890
2896
|
contrast: 1,
|
|
@@ -2893,7 +2899,7 @@ const { AdjustmentFilter: at } = g, { ColorMatrixFilter: ot } = w, M = {
|
|
|
2893
2899
|
green: 1,
|
|
2894
2900
|
blue: 1,
|
|
2895
2901
|
alpha: 1
|
|
2896
|
-
},
|
|
2902
|
+
}, ot = /* @__PURE__ */ new Set([
|
|
2897
2903
|
"gamma",
|
|
2898
2904
|
"saturation",
|
|
2899
2905
|
"contrast",
|
|
@@ -2903,7 +2909,7 @@ const { AdjustmentFilter: at } = g, { ColorMatrixFilter: ot } = w, M = {
|
|
|
2903
2909
|
"blue",
|
|
2904
2910
|
"alpha"
|
|
2905
2911
|
]);
|
|
2906
|
-
function
|
|
2912
|
+
function P(s, e) {
|
|
2907
2913
|
if (typeof s == "number" && Number.isFinite(s))
|
|
2908
2914
|
return s;
|
|
2909
2915
|
if (typeof s == "string") {
|
|
@@ -2913,22 +2919,22 @@ function F(s, e) {
|
|
|
2913
2919
|
}
|
|
2914
2920
|
return e;
|
|
2915
2921
|
}
|
|
2916
|
-
function
|
|
2917
|
-
return
|
|
2922
|
+
function J(s) {
|
|
2923
|
+
return ot.has(s);
|
|
2918
2924
|
}
|
|
2919
|
-
function
|
|
2925
|
+
function nt(s) {
|
|
2920
2926
|
return {
|
|
2921
|
-
gamma:
|
|
2922
|
-
saturation:
|
|
2923
|
-
contrast:
|
|
2924
|
-
brightness:
|
|
2925
|
-
red:
|
|
2926
|
-
green:
|
|
2927
|
-
blue:
|
|
2928
|
-
alpha:
|
|
2927
|
+
gamma: P(s.gamma, k.gamma),
|
|
2928
|
+
saturation: P(s.saturation, k.saturation),
|
|
2929
|
+
contrast: P(s.contrast, k.contrast),
|
|
2930
|
+
brightness: P(s.brightness, k.brightness),
|
|
2931
|
+
red: P(s.red, k.red),
|
|
2932
|
+
green: P(s.green, k.green),
|
|
2933
|
+
blue: P(s.blue, k.blue),
|
|
2934
|
+
alpha: P(s.alpha, k.alpha)
|
|
2929
2935
|
};
|
|
2930
2936
|
}
|
|
2931
|
-
function
|
|
2937
|
+
function ee(s, e) {
|
|
2932
2938
|
s.reset(), s.brightness(e.brightness, !0), s.contrast(e.contrast, !0), s.saturate(e.saturation, !0);
|
|
2933
2939
|
}
|
|
2934
2940
|
f({
|
|
@@ -2939,28 +2945,28 @@ f({
|
|
|
2939
2945
|
// Create an instance of the AdjustmentFilter with the provided parameters
|
|
2940
2946
|
createFilter: (s) => {
|
|
2941
2947
|
try {
|
|
2942
|
-
const e =
|
|
2948
|
+
const e = nt(s ?? {}), t = { ...e };
|
|
2943
2949
|
try {
|
|
2944
|
-
const i = new
|
|
2950
|
+
const i = new st(t), r = i;
|
|
2945
2951
|
return r._customParams = { ...e }, r.updateUIParam = function(o, n) {
|
|
2946
2952
|
try {
|
|
2947
|
-
if (!
|
|
2953
|
+
if (!J(o))
|
|
2948
2954
|
return;
|
|
2949
|
-
const l = this._customParams ?? { ...
|
|
2955
|
+
const l = this._customParams ?? { ...k }, c = P(n, l[o]);
|
|
2950
2956
|
l[o] = c, this._customParams = l;
|
|
2951
|
-
const
|
|
2952
|
-
o in
|
|
2957
|
+
const u = this;
|
|
2958
|
+
o in u && (u[o] = c);
|
|
2953
2959
|
} catch {
|
|
2954
2960
|
}
|
|
2955
2961
|
}, i;
|
|
2956
2962
|
} catch {
|
|
2957
|
-
const r = new
|
|
2958
|
-
return a._customParams = { ...e },
|
|
2963
|
+
const r = new at(), a = r;
|
|
2964
|
+
return a._customParams = { ...e }, ee(r, e), a.updateUIParam = function(n, l) {
|
|
2959
2965
|
try {
|
|
2960
|
-
if (!
|
|
2966
|
+
if (!J(n))
|
|
2961
2967
|
return;
|
|
2962
|
-
const c = this._customParams ?? { ...
|
|
2963
|
-
c[n] =
|
|
2968
|
+
const c = this._customParams ?? { ...k }, u = P(l, c[n]);
|
|
2969
|
+
c[n] = u, this._customParams = c, ee(this, c);
|
|
2964
2970
|
} catch {
|
|
2965
2971
|
}
|
|
2966
2972
|
}, r;
|
|
@@ -3064,14 +3070,14 @@ f({
|
|
|
3064
3070
|
}
|
|
3065
3071
|
]
|
|
3066
3072
|
});
|
|
3067
|
-
const { ColorMatrixFilter:
|
|
3073
|
+
const { ColorMatrixFilter: lt } = w, R = {
|
|
3068
3074
|
brightness: 1,
|
|
3069
3075
|
contrast: 1,
|
|
3070
3076
|
saturation: 1,
|
|
3071
3077
|
hue: 0,
|
|
3072
3078
|
sepia: 0,
|
|
3073
3079
|
negative: !1
|
|
3074
|
-
},
|
|
3080
|
+
}, ct = /* @__PURE__ */ new Set([
|
|
3075
3081
|
"brightness",
|
|
3076
3082
|
"contrast",
|
|
3077
3083
|
"saturation",
|
|
@@ -3079,8 +3085,8 @@ const { ColorMatrixFilter: ct } = w, R = {
|
|
|
3079
3085
|
"sepia",
|
|
3080
3086
|
"negative"
|
|
3081
3087
|
]);
|
|
3082
|
-
function
|
|
3083
|
-
return
|
|
3088
|
+
function ht(s) {
|
|
3089
|
+
return ct.has(s);
|
|
3084
3090
|
}
|
|
3085
3091
|
function X(s, e) {
|
|
3086
3092
|
if (typeof s == "number" && Number.isFinite(s))
|
|
@@ -3092,7 +3098,7 @@ function X(s, e) {
|
|
|
3092
3098
|
}
|
|
3093
3099
|
return e;
|
|
3094
3100
|
}
|
|
3095
|
-
function
|
|
3101
|
+
function pe(s, e) {
|
|
3096
3102
|
if (typeof s == "boolean")
|
|
3097
3103
|
return s;
|
|
3098
3104
|
if (typeof s == "string") {
|
|
@@ -3103,17 +3109,17 @@ function me(s, e) {
|
|
|
3103
3109
|
}
|
|
3104
3110
|
return e;
|
|
3105
3111
|
}
|
|
3106
|
-
function
|
|
3112
|
+
function dt(s) {
|
|
3107
3113
|
return {
|
|
3108
3114
|
brightness: X(s.brightness, R.brightness),
|
|
3109
3115
|
contrast: X(s.contrast, R.contrast),
|
|
3110
3116
|
saturation: X(s.saturation, R.saturation),
|
|
3111
3117
|
hue: X(s.hue, R.hue),
|
|
3112
3118
|
sepia: X(s.sepia, R.sepia),
|
|
3113
|
-
negative:
|
|
3119
|
+
negative: pe(s.negative, R.negative)
|
|
3114
3120
|
};
|
|
3115
3121
|
}
|
|
3116
|
-
function
|
|
3122
|
+
function te(s, e) {
|
|
3117
3123
|
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);
|
|
3118
3124
|
}
|
|
3119
3125
|
f({
|
|
@@ -3124,19 +3130,19 @@ f({
|
|
|
3124
3130
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
3125
3131
|
createFilter: (s) => {
|
|
3126
3132
|
try {
|
|
3127
|
-
const e =
|
|
3128
|
-
return i._customParams = { ...e },
|
|
3133
|
+
const e = dt(s ?? {}), t = new lt(), i = t;
|
|
3134
|
+
return i._customParams = { ...e }, te(t, e), i.updateUIParam = function(a, o) {
|
|
3129
3135
|
try {
|
|
3130
|
-
if (!
|
|
3136
|
+
if (!ht(a))
|
|
3131
3137
|
return;
|
|
3132
3138
|
const n = this._customParams ?? { ...R };
|
|
3133
3139
|
if (a === "negative")
|
|
3134
|
-
n.negative =
|
|
3140
|
+
n.negative = pe(o, n.negative);
|
|
3135
3141
|
else {
|
|
3136
3142
|
const l = a;
|
|
3137
3143
|
n[l] = X(o, n[l]);
|
|
3138
3144
|
}
|
|
3139
|
-
this._customParams = n,
|
|
3145
|
+
this._customParams = n, te(this, n);
|
|
3140
3146
|
} catch {
|
|
3141
3147
|
}
|
|
3142
3148
|
}, t;
|
|
@@ -3408,7 +3414,7 @@ f({
|
|
|
3408
3414
|
}
|
|
3409
3415
|
]
|
|
3410
3416
|
});
|
|
3411
|
-
const { ColorOverlayFilter:
|
|
3417
|
+
const { ColorOverlayFilter: ut } = g;
|
|
3412
3418
|
f({
|
|
3413
3419
|
id: "colorOverlay",
|
|
3414
3420
|
name: "Color Overlay",
|
|
@@ -3423,7 +3429,7 @@ f({
|
|
|
3423
3429
|
try {
|
|
3424
3430
|
let e = 16711680;
|
|
3425
3431
|
s.color && (typeof s.color == "string" ? e = parseInt(s.color.replace("#", "0x"), 16) : typeof s.color == "number" && (e = s.color));
|
|
3426
|
-
const t = new
|
|
3432
|
+
const t = new ut({
|
|
3427
3433
|
color: e,
|
|
3428
3434
|
alpha: s.alpha || 0.5
|
|
3429
3435
|
});
|
|
@@ -3511,8 +3517,8 @@ f({
|
|
|
3511
3517
|
switch (this._customParams = l, l[o] = n, o) {
|
|
3512
3518
|
case "color":
|
|
3513
3519
|
if (typeof n == "string") {
|
|
3514
|
-
const
|
|
3515
|
-
this.color =
|
|
3520
|
+
const u = parseInt(n.replace("#", "0x"), 16);
|
|
3521
|
+
this.color = u;
|
|
3516
3522
|
}
|
|
3517
3523
|
break;
|
|
3518
3524
|
case "alpha":
|
|
@@ -3655,7 +3661,7 @@ f({
|
|
|
3655
3661
|
}
|
|
3656
3662
|
]
|
|
3657
3663
|
});
|
|
3658
|
-
const { ColorMatrixFilter:
|
|
3664
|
+
const { ColorMatrixFilter: pt } = w;
|
|
3659
3665
|
f({
|
|
3660
3666
|
id: "grayscale",
|
|
3661
3667
|
name: "Grayscale",
|
|
@@ -3668,14 +3674,14 @@ f({
|
|
|
3668
3674
|
*/
|
|
3669
3675
|
createFilter: (s) => {
|
|
3670
3676
|
try {
|
|
3671
|
-
const e = new
|
|
3677
|
+
const e = new pt();
|
|
3672
3678
|
e._customParams = { ...s };
|
|
3673
3679
|
const t = s.intensity !== void 0 ? s.intensity : 1;
|
|
3674
|
-
return
|
|
3680
|
+
return ie(e, t), e.updateUIParam = function(i, r) {
|
|
3675
3681
|
const a = this._customParams || {};
|
|
3676
3682
|
switch (this._customParams = a, a[i] = r, i) {
|
|
3677
3683
|
case "intensity":
|
|
3678
|
-
|
|
3684
|
+
ie(this, r);
|
|
3679
3685
|
break;
|
|
3680
3686
|
default:
|
|
3681
3687
|
i in this && (this[i] = r);
|
|
@@ -3705,10 +3711,10 @@ f({
|
|
|
3705
3711
|
}
|
|
3706
3712
|
]
|
|
3707
3713
|
});
|
|
3708
|
-
function
|
|
3714
|
+
function ie(s, e) {
|
|
3709
3715
|
s.reset(), s.greyscale(e);
|
|
3710
3716
|
}
|
|
3711
|
-
const { HslAdjustmentFilter:
|
|
3717
|
+
const { HslAdjustmentFilter: ft } = g;
|
|
3712
3718
|
f({
|
|
3713
3719
|
id: "hsl-adjustment",
|
|
3714
3720
|
name: "HSL Adjustment",
|
|
@@ -3720,7 +3726,7 @@ f({
|
|
|
3720
3726
|
*/
|
|
3721
3727
|
createFilter: (s) => {
|
|
3722
3728
|
try {
|
|
3723
|
-
const e = new
|
|
3729
|
+
const e = new ft({
|
|
3724
3730
|
hue: s.hue !== void 0 ? s.hue : 0,
|
|
3725
3731
|
saturation: s.saturation !== void 0 ? s.saturation : 0,
|
|
3726
3732
|
lightness: s.lightness !== void 0 ? s.lightness : 0,
|
|
@@ -3818,7 +3824,7 @@ f({
|
|
|
3818
3824
|
}
|
|
3819
3825
|
]
|
|
3820
3826
|
});
|
|
3821
|
-
const { KawaseBlurFilter:
|
|
3827
|
+
const { KawaseBlurFilter: mt } = g;
|
|
3822
3828
|
f({
|
|
3823
3829
|
id: "kawase-blur",
|
|
3824
3830
|
name: "Kawase Blur",
|
|
@@ -3831,7 +3837,7 @@ f({
|
|
|
3831
3837
|
*/
|
|
3832
3838
|
createFilter: (s) => {
|
|
3833
3839
|
try {
|
|
3834
|
-
const e = new
|
|
3840
|
+
const e = new mt({
|
|
3835
3841
|
strength: s.strength || 4,
|
|
3836
3842
|
quality: s.quality || 3,
|
|
3837
3843
|
clamp: s.clamp || !1,
|
|
@@ -3936,7 +3942,7 @@ f({
|
|
|
3936
3942
|
}
|
|
3937
3943
|
]
|
|
3938
3944
|
});
|
|
3939
|
-
const { MotionBlurFilter:
|
|
3945
|
+
const { MotionBlurFilter: gt } = g;
|
|
3940
3946
|
f({
|
|
3941
3947
|
id: "motion-blur",
|
|
3942
3948
|
name: "Motion Blur",
|
|
@@ -3949,7 +3955,7 @@ f({
|
|
|
3949
3955
|
*/
|
|
3950
3956
|
createFilter: (s) => {
|
|
3951
3957
|
try {
|
|
3952
|
-
const e = new
|
|
3958
|
+
const e = new gt({
|
|
3953
3959
|
velocity: {
|
|
3954
3960
|
x: s.velocityX !== void 0 ? s.velocityX : 0,
|
|
3955
3961
|
y: s.velocityY !== void 0 ? s.velocityY : 0
|
|
@@ -4044,7 +4050,7 @@ f({
|
|
|
4044
4050
|
}
|
|
4045
4051
|
]
|
|
4046
4052
|
});
|
|
4047
|
-
const { RadialBlurFilter:
|
|
4053
|
+
const { RadialBlurFilter: bt } = g;
|
|
4048
4054
|
f({
|
|
4049
4055
|
id: "radial-blur",
|
|
4050
4056
|
name: "Radial Blur",
|
|
@@ -4053,7 +4059,7 @@ f({
|
|
|
4053
4059
|
// Create an instance of the RadialBlurFilter with the provided parameters
|
|
4054
4060
|
createFilter: (s) => {
|
|
4055
4061
|
try {
|
|
4056
|
-
const e = new
|
|
4062
|
+
const e = new bt({
|
|
4057
4063
|
angle: s.angle ?? 20,
|
|
4058
4064
|
center: { x: s.centerX ?? 0, y: s.centerY ?? 0 },
|
|
4059
4065
|
kernelSize: s.kernelSize ?? 15,
|
|
@@ -4168,7 +4174,7 @@ f({
|
|
|
4168
4174
|
}
|
|
4169
4175
|
]
|
|
4170
4176
|
});
|
|
4171
|
-
const { TiltShiftFilter:
|
|
4177
|
+
const { TiltShiftFilter: yt } = g;
|
|
4172
4178
|
f({
|
|
4173
4179
|
id: "tilt-shift",
|
|
4174
4180
|
name: "Tilt Shift",
|
|
@@ -4177,7 +4183,7 @@ f({
|
|
|
4177
4183
|
// Create an instance of the TiltShiftFilter with the provided parameters
|
|
4178
4184
|
createFilter: (s) => {
|
|
4179
4185
|
try {
|
|
4180
|
-
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
|
|
4186
|
+
const e = typeof s.blur == "number" ? s.blur : 100, t = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, i = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, o = typeof s.endY == "number" ? s.endY : 0.5, n = new yt({
|
|
4181
4187
|
blur: Number(e),
|
|
4182
4188
|
gradientBlur: Number(t),
|
|
4183
4189
|
start: { x: Number(i), y: Number(r) },
|
|
@@ -4192,28 +4198,28 @@ f({
|
|
|
4192
4198
|
endY: o
|
|
4193
4199
|
}, n.updateUIParam = function(l, c) {
|
|
4194
4200
|
try {
|
|
4195
|
-
const
|
|
4196
|
-
switch (this._customParams = h, h[l] =
|
|
4201
|
+
const u = Number(c), h = this._customParams || {};
|
|
4202
|
+
switch (this._customParams = h, h[l] = u, l) {
|
|
4197
4203
|
case "blur":
|
|
4198
|
-
this.blur =
|
|
4204
|
+
this.blur = u;
|
|
4199
4205
|
break;
|
|
4200
4206
|
case "gradientBlur":
|
|
4201
|
-
this.gradientBlur =
|
|
4207
|
+
this.gradientBlur = u;
|
|
4202
4208
|
break;
|
|
4203
4209
|
case "startX":
|
|
4204
|
-
this.start && typeof this.start == "object" && (this.start.x =
|
|
4210
|
+
this.start && typeof this.start == "object" && (this.start.x = u);
|
|
4205
4211
|
break;
|
|
4206
4212
|
case "startY":
|
|
4207
|
-
this.start && typeof this.start == "object" && (this.start.y =
|
|
4213
|
+
this.start && typeof this.start == "object" && (this.start.y = u);
|
|
4208
4214
|
break;
|
|
4209
4215
|
case "endX":
|
|
4210
|
-
this.end && typeof this.end == "object" && (this.end.x =
|
|
4216
|
+
this.end && typeof this.end == "object" && (this.end.x = u);
|
|
4211
4217
|
break;
|
|
4212
4218
|
case "endY":
|
|
4213
|
-
this.end && typeof this.end == "object" && (this.end.y =
|
|
4219
|
+
this.end && typeof this.end == "object" && (this.end.y = u);
|
|
4214
4220
|
break;
|
|
4215
4221
|
default:
|
|
4216
|
-
l in this && (this[l] =
|
|
4222
|
+
l in this && (this[l] = u);
|
|
4217
4223
|
break;
|
|
4218
4224
|
}
|
|
4219
4225
|
} catch {
|
|
@@ -4296,7 +4302,7 @@ f({
|
|
|
4296
4302
|
}
|
|
4297
4303
|
]
|
|
4298
4304
|
});
|
|
4299
|
-
const { ZoomBlurFilter:
|
|
4305
|
+
const { ZoomBlurFilter: _t } = g;
|
|
4300
4306
|
f({
|
|
4301
4307
|
id: "zoom-blur",
|
|
4302
4308
|
name: "Zoom Blur",
|
|
@@ -4309,7 +4315,7 @@ f({
|
|
|
4309
4315
|
*/
|
|
4310
4316
|
createFilter: (s) => {
|
|
4311
4317
|
try {
|
|
4312
|
-
const e = new
|
|
4318
|
+
const e = new _t({
|
|
4313
4319
|
strength: s.strength || 0.1,
|
|
4314
4320
|
center: {
|
|
4315
4321
|
x: s.centerX !== void 0 ? s.centerX : 0.5,
|
|
@@ -4423,7 +4429,7 @@ f({
|
|
|
4423
4429
|
}
|
|
4424
4430
|
]
|
|
4425
4431
|
});
|
|
4426
|
-
const { ColorGradientFilter:
|
|
4432
|
+
const { ColorGradientFilter: re } = g;
|
|
4427
4433
|
f({
|
|
4428
4434
|
id: "color-gradient",
|
|
4429
4435
|
name: "Color Gradient",
|
|
@@ -4447,7 +4453,7 @@ f({
|
|
|
4447
4453
|
{ offset: 0, color: 16711680, alpha: 1 },
|
|
4448
4454
|
{ offset: 1, color: 255, alpha: 1 }
|
|
4449
4455
|
]), e.sort((i, r) => i.offset - r.offset);
|
|
4450
|
-
const t = new
|
|
4456
|
+
const t = new re({
|
|
4451
4457
|
type: s.gradientType,
|
|
4452
4458
|
// 0: linear, 1: radial, 2: conic
|
|
4453
4459
|
stops: e,
|
|
@@ -4527,8 +4533,8 @@ f({
|
|
|
4527
4533
|
}));
|
|
4528
4534
|
break;
|
|
4529
4535
|
case "removeColorStop":
|
|
4530
|
-
const
|
|
4531
|
-
|
|
4536
|
+
const u = [...this.stops];
|
|
4537
|
+
u.length > 2 && (u.pop(), this.stops = u, a.colorStops = this.stops.map((h) => ({
|
|
4532
4538
|
offset: h.offset,
|
|
4533
4539
|
color: typeof h.color == "number" ? "#" + h.color.toString(16).padStart(6, "0") : h.color,
|
|
4534
4540
|
alpha: h.alpha
|
|
@@ -4537,7 +4543,7 @@ f({
|
|
|
4537
4543
|
case "cssGradient":
|
|
4538
4544
|
if (r && typeof r == "string" && r.trim() !== "")
|
|
4539
4545
|
try {
|
|
4540
|
-
const h = new
|
|
4546
|
+
const h = new re({ css: r });
|
|
4541
4547
|
this.type = h.type, this.angle = h.angle, this.stops = [...h.stops], a.colorStops = this.stops.map((p) => ({
|
|
4542
4548
|
offset: p.offset,
|
|
4543
4549
|
color: typeof p.color == "number" ? "#" + p.color.toString(16).padStart(6, "0") : p.color,
|
|
@@ -4562,7 +4568,7 @@ f({
|
|
|
4562
4568
|
if (h) {
|
|
4563
4569
|
const [p, m, C] = h, b = parseInt(m), y = [...this.stops];
|
|
4564
4570
|
if (b >= 0 && b < y.length)
|
|
4565
|
-
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((
|
|
4571
|
+
return C === "color" && typeof r == "string" ? y[b].color = parseInt(r.replace("#", "0x")) : (C === "offset" || C === "alpha") && (y[b][C] = r), this.stops = y, this.stops.sort((z, _) => z.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
|
|
4566
4572
|
}
|
|
4567
4573
|
} else i in this && (this[i] = r);
|
|
4568
4574
|
break;
|
|
@@ -4750,7 +4756,7 @@ f({
|
|
|
4750
4756
|
}
|
|
4751
4757
|
]
|
|
4752
4758
|
});
|
|
4753
|
-
const
|
|
4759
|
+
const xt = g.ColorReplaceFilter;
|
|
4754
4760
|
f({
|
|
4755
4761
|
id: "color-replace",
|
|
4756
4762
|
name: "Color Replace",
|
|
@@ -4767,7 +4773,7 @@ f({
|
|
|
4767
4773
|
s.originalColor && (typeof s.originalColor == "string" ? e = parseInt(s.originalColor.replace("#", "0x"), 16) : typeof s.originalColor == "number" && (e = s.originalColor));
|
|
4768
4774
|
let t = 255;
|
|
4769
4775
|
s.targetColor && (typeof s.targetColor == "string" ? t = parseInt(s.targetColor.replace("#", "0x"), 16) : typeof s.targetColor == "number" && (t = s.targetColor));
|
|
4770
|
-
const i = new
|
|
4776
|
+
const i = new xt({
|
|
4771
4777
|
originalColor: e,
|
|
4772
4778
|
targetColor: t,
|
|
4773
4779
|
tolerance: s.tolerance || 0.4
|
|
@@ -4831,7 +4837,7 @@ f({
|
|
|
4831
4837
|
}
|
|
4832
4838
|
]
|
|
4833
4839
|
});
|
|
4834
|
-
const
|
|
4840
|
+
const Ct = g.MultiColorReplaceFilter;
|
|
4835
4841
|
f({
|
|
4836
4842
|
id: "multi-color-replace",
|
|
4837
4843
|
name: "Multi-Color Replace",
|
|
@@ -4857,7 +4863,7 @@ f({
|
|
|
4857
4863
|
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;
|
|
4858
4864
|
e.push([i, r]);
|
|
4859
4865
|
}
|
|
4860
|
-
const t = new
|
|
4866
|
+
const t = new Ct(
|
|
4861
4867
|
e,
|
|
4862
4868
|
s.tolerance || 0.05,
|
|
4863
4869
|
3
|
|
@@ -4968,7 +4974,7 @@ f({
|
|
|
4968
4974
|
}
|
|
4969
4975
|
]
|
|
4970
4976
|
});
|
|
4971
|
-
const { RGBSplitFilter:
|
|
4977
|
+
const { RGBSplitFilter: wt } = g;
|
|
4972
4978
|
f({
|
|
4973
4979
|
id: "rgb-split",
|
|
4974
4980
|
name: "RGB Split",
|
|
@@ -4989,7 +4995,7 @@ f({
|
|
|
4989
4995
|
}, i = {
|
|
4990
4996
|
x: s.blueX !== void 0 ? s.blueX : 0,
|
|
4991
4997
|
y: s.blueY !== void 0 ? s.blueY : 0
|
|
4992
|
-
}, r = new
|
|
4998
|
+
}, r = new wt({
|
|
4993
4999
|
red: e,
|
|
4994
5000
|
green: t,
|
|
4995
5001
|
blue: i
|
|
@@ -5102,7 +5108,7 @@ f({
|
|
|
5102
5108
|
}
|
|
5103
5109
|
]
|
|
5104
5110
|
});
|
|
5105
|
-
const { AdvancedBloomFilter:
|
|
5111
|
+
const { AdvancedBloomFilter: St } = g;
|
|
5106
5112
|
f({
|
|
5107
5113
|
id: "advanced-bloom",
|
|
5108
5114
|
name: "Advanced Bloom",
|
|
@@ -5111,7 +5117,7 @@ f({
|
|
|
5111
5117
|
// Create an instance of the AdvancedBloomFilter with the provided parameters
|
|
5112
5118
|
createFilter: (s) => {
|
|
5113
5119
|
try {
|
|
5114
|
-
const e = new
|
|
5120
|
+
const e = new St({
|
|
5115
5121
|
threshold: s.threshold || 0.5,
|
|
5116
5122
|
bloomScale: s.bloomScale || 1,
|
|
5117
5123
|
brightness: s.brightness || 1,
|
|
@@ -5258,7 +5264,7 @@ f({
|
|
|
5258
5264
|
}
|
|
5259
5265
|
]
|
|
5260
5266
|
});
|
|
5261
|
-
const
|
|
5267
|
+
const vt = g.AsciiFilter;
|
|
5262
5268
|
f({
|
|
5263
5269
|
id: "ascii",
|
|
5264
5270
|
name: "ASCII",
|
|
@@ -5270,7 +5276,7 @@ f({
|
|
|
5270
5276
|
const e = typeof s.size == "number" ? s.size : 8;
|
|
5271
5277
|
let t = s.color;
|
|
5272
5278
|
typeof t == "string" && t.startsWith("#") && (t = parseInt(t.replace("#", "0x"), 16));
|
|
5273
|
-
const i = s.replaceColor === !0, r = new
|
|
5279
|
+
const i = s.replaceColor === !0, r = new vt({
|
|
5274
5280
|
size: e,
|
|
5275
5281
|
color: t,
|
|
5276
5282
|
replaceColor: i
|
|
@@ -5337,7 +5343,7 @@ f({
|
|
|
5337
5343
|
}
|
|
5338
5344
|
]
|
|
5339
5345
|
});
|
|
5340
|
-
const
|
|
5346
|
+
const kt = g.BackdropBlurFilter;
|
|
5341
5347
|
f({
|
|
5342
5348
|
id: "backdrop-blur",
|
|
5343
5349
|
name: "Backdrop Blur",
|
|
@@ -5346,7 +5352,7 @@ f({
|
|
|
5346
5352
|
// Create an instance of the BackdropBlurFilter with the provided parameters
|
|
5347
5353
|
createFilter: (s) => {
|
|
5348
5354
|
try {
|
|
5349
|
-
const e = new
|
|
5355
|
+
const e = new kt({
|
|
5350
5356
|
// Higher strength values (20-50) make the effect more noticeable
|
|
5351
5357
|
strength: s.strength || 20,
|
|
5352
5358
|
quality: s.quality || 4,
|
|
@@ -5444,7 +5450,7 @@ f({
|
|
|
5444
5450
|
}
|
|
5445
5451
|
]
|
|
5446
5452
|
});
|
|
5447
|
-
const { BevelFilter:
|
|
5453
|
+
const { BevelFilter: Pt } = g;
|
|
5448
5454
|
f({
|
|
5449
5455
|
id: "bevel",
|
|
5450
5456
|
name: "Bevel",
|
|
@@ -5456,7 +5462,7 @@ f({
|
|
|
5456
5462
|
*/
|
|
5457
5463
|
createFilter: (s) => {
|
|
5458
5464
|
try {
|
|
5459
|
-
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new
|
|
5465
|
+
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new Pt({
|
|
5460
5466
|
rotation: s.rotation !== void 0 ? s.rotation : 45,
|
|
5461
5467
|
thickness: s.thickness !== void 0 ? s.thickness : 2,
|
|
5462
5468
|
lightColor: parseInt(e, 16),
|
|
@@ -5572,7 +5578,7 @@ f({
|
|
|
5572
5578
|
}
|
|
5573
5579
|
]
|
|
5574
5580
|
});
|
|
5575
|
-
const { BloomFilter:
|
|
5581
|
+
const { BloomFilter: Mt } = g;
|
|
5576
5582
|
f({
|
|
5577
5583
|
id: "bloom",
|
|
5578
5584
|
name: "Bloom/Glow",
|
|
@@ -5581,7 +5587,7 @@ f({
|
|
|
5581
5587
|
// Create an instance of the BloomFilter with the provided parameters
|
|
5582
5588
|
createFilter: (s) => {
|
|
5583
5589
|
try {
|
|
5584
|
-
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
|
|
5590
|
+
const e = typeof s.strengthX == "number" ? s.strengthX : 2, t = typeof s.strengthY == "number" ? s.strengthY : 2, i = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, o = new Mt({
|
|
5585
5591
|
strength: {
|
|
5586
5592
|
x: Number(e),
|
|
5587
5593
|
y: Number(t)
|
|
@@ -5597,7 +5603,7 @@ f({
|
|
|
5597
5603
|
resolution: r,
|
|
5598
5604
|
kernelSize: a
|
|
5599
5605
|
}, o.updateUIParam = function(n, l) {
|
|
5600
|
-
var c,
|
|
5606
|
+
var c, u;
|
|
5601
5607
|
try {
|
|
5602
5608
|
const h = Number(l), p = this._customParams || {};
|
|
5603
5609
|
switch (this._customParams = p, p[n] = h, n) {
|
|
@@ -5605,7 +5611,7 @@ f({
|
|
|
5605
5611
|
this.strength && typeof this.strength == "object" && (this.strength.x = h, (c = this._updateStrength) == null || c.call(this));
|
|
5606
5612
|
break;
|
|
5607
5613
|
case "strengthY":
|
|
5608
|
-
this.strength && typeof this.strength == "object" && (this.strength.y = h, (
|
|
5614
|
+
this.strength && typeof this.strength == "object" && (this.strength.y = h, (u = this._updateStrength) == null || u.call(this));
|
|
5609
5615
|
break;
|
|
5610
5616
|
case "quality":
|
|
5611
5617
|
this.quality = h;
|
|
@@ -5684,7 +5690,7 @@ f({
|
|
|
5684
5690
|
}
|
|
5685
5691
|
]
|
|
5686
5692
|
});
|
|
5687
|
-
const { BulgePinchFilter:
|
|
5693
|
+
const { BulgePinchFilter: Ft } = g;
|
|
5688
5694
|
f({
|
|
5689
5695
|
id: "bulge-pinch",
|
|
5690
5696
|
// ID must match what the application expects
|
|
@@ -5694,7 +5700,7 @@ f({
|
|
|
5694
5700
|
// Create an instance of the BulgePinchFilter with the provided parameters
|
|
5695
5701
|
createFilter: (s) => {
|
|
5696
5702
|
try {
|
|
5697
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new
|
|
5703
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new Ft({
|
|
5698
5704
|
center: {
|
|
5699
5705
|
x: e,
|
|
5700
5706
|
y: t
|
|
@@ -5776,7 +5782,7 @@ f({
|
|
|
5776
5782
|
}
|
|
5777
5783
|
]
|
|
5778
5784
|
});
|
|
5779
|
-
const { ConvolutionFilter:
|
|
5785
|
+
const { ConvolutionFilter: At } = g, E = {
|
|
5780
5786
|
normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
|
|
5781
5787
|
gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
|
|
5782
5788
|
boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
|
|
@@ -5811,7 +5817,7 @@ f({
|
|
|
5811
5817
|
const i = s.preset;
|
|
5812
5818
|
e = E[i] || E.normal;
|
|
5813
5819
|
}
|
|
5814
|
-
const t = new
|
|
5820
|
+
const t = new At(e, s.width || 200, s.height || 200);
|
|
5815
5821
|
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
5816
5822
|
const a = this._customParams || {};
|
|
5817
5823
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -6022,7 +6028,7 @@ f({
|
|
|
6022
6028
|
}
|
|
6023
6029
|
]
|
|
6024
6030
|
});
|
|
6025
|
-
const { CrossHatchFilter:
|
|
6031
|
+
const { CrossHatchFilter: zt } = g;
|
|
6026
6032
|
f({
|
|
6027
6033
|
id: "cross-hatch",
|
|
6028
6034
|
name: "Cross Hatch",
|
|
@@ -6032,7 +6038,7 @@ f({
|
|
|
6032
6038
|
// Note: CrossHatchFilter has NO parameters according to PixiJS examples
|
|
6033
6039
|
createFilter: (s) => {
|
|
6034
6040
|
try {
|
|
6035
|
-
const e = new
|
|
6041
|
+
const e = new zt();
|
|
6036
6042
|
return e.updateUIParam = function(t, i) {
|
|
6037
6043
|
return !0;
|
|
6038
6044
|
}, e;
|
|
@@ -6229,7 +6235,7 @@ f({
|
|
|
6229
6235
|
}
|
|
6230
6236
|
]
|
|
6231
6237
|
});
|
|
6232
|
-
const
|
|
6238
|
+
const Nt = w.DisplacementFilter, Rt = w.Sprite, H = w.Texture;
|
|
6233
6239
|
f({
|
|
6234
6240
|
id: "displacement",
|
|
6235
6241
|
// ID must match what the application expects
|
|
@@ -6255,7 +6261,7 @@ f({
|
|
|
6255
6261
|
}
|
|
6256
6262
|
t = H.from(o);
|
|
6257
6263
|
}
|
|
6258
|
-
const i = new
|
|
6264
|
+
const i = new Rt(t), r = new Nt(i, s.scale || 50);
|
|
6259
6265
|
return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = i, r.updateUIParam = function(a, o) {
|
|
6260
6266
|
const n = this._customParams || {};
|
|
6261
6267
|
switch (this._customParams = n, n[a] = o, a) {
|
|
@@ -6402,7 +6408,7 @@ f({
|
|
|
6402
6408
|
}
|
|
6403
6409
|
]
|
|
6404
6410
|
});
|
|
6405
|
-
const { EmbossFilter:
|
|
6411
|
+
const { EmbossFilter: Tt } = g;
|
|
6406
6412
|
f({
|
|
6407
6413
|
id: "emboss",
|
|
6408
6414
|
name: "Emboss",
|
|
@@ -6411,7 +6417,7 @@ f({
|
|
|
6411
6417
|
// Create an instance of the Emboss filter with the provided parameters
|
|
6412
6418
|
createFilter: (s) => {
|
|
6413
6419
|
try {
|
|
6414
|
-
const e = typeof s.strength == "number" ? s.strength : 5, t = new
|
|
6420
|
+
const e = typeof s.strength == "number" ? s.strength : 5, t = new Tt(e);
|
|
6415
6421
|
return t._customParams = {
|
|
6416
6422
|
strength: e
|
|
6417
6423
|
}, t.updateUIParam = function(i, r) {
|
|
@@ -6451,7 +6457,7 @@ f({
|
|
|
6451
6457
|
}
|
|
6452
6458
|
]
|
|
6453
6459
|
});
|
|
6454
|
-
const { GlitchFilter:
|
|
6460
|
+
const { GlitchFilter: It } = g, N = {
|
|
6455
6461
|
TRANSPARENT: 0,
|
|
6456
6462
|
ORIGINAL: 1,
|
|
6457
6463
|
LOOP: 2,
|
|
@@ -6465,7 +6471,7 @@ f({
|
|
|
6465
6471
|
description: "Apply digital distortion and glitch effects",
|
|
6466
6472
|
createFilter: (s) => {
|
|
6467
6473
|
try {
|
|
6468
|
-
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new
|
|
6474
|
+
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new It({
|
|
6469
6475
|
slices: s.slices,
|
|
6470
6476
|
offset: s.offset,
|
|
6471
6477
|
direction: s.direction,
|
|
@@ -6496,8 +6502,8 @@ f({
|
|
|
6496
6502
|
break;
|
|
6497
6503
|
case "redX":
|
|
6498
6504
|
case "redY":
|
|
6499
|
-
const
|
|
6500
|
-
n === "redX" ?
|
|
6505
|
+
const u = this.red;
|
|
6506
|
+
n === "redX" ? u.x = l : u.y = l, this.red = u;
|
|
6501
6507
|
break;
|
|
6502
6508
|
case "greenX":
|
|
6503
6509
|
case "greenY":
|
|
@@ -6706,7 +6712,7 @@ f({
|
|
|
6706
6712
|
}
|
|
6707
6713
|
]
|
|
6708
6714
|
});
|
|
6709
|
-
const { GlowFilter:
|
|
6715
|
+
const { GlowFilter: Et } = g;
|
|
6710
6716
|
f({
|
|
6711
6717
|
id: "glow",
|
|
6712
6718
|
name: "Glow",
|
|
@@ -6715,7 +6721,7 @@ f({
|
|
|
6715
6721
|
// Create an instance of the GlowFilter with the provided parameters
|
|
6716
6722
|
createFilter: (s) => {
|
|
6717
6723
|
try {
|
|
6718
|
-
const e = parseInt(s.color.replace("#", "0x"), 16), t = new
|
|
6724
|
+
const e = parseInt(s.color.replace("#", "0x"), 16), t = new Et({
|
|
6719
6725
|
distance: s.distance || 10,
|
|
6720
6726
|
outerStrength: s.outerStrength || 4,
|
|
6721
6727
|
innerStrength: s.innerStrength || 0,
|
|
@@ -6841,7 +6847,7 @@ f({
|
|
|
6841
6847
|
}
|
|
6842
6848
|
]
|
|
6843
6849
|
});
|
|
6844
|
-
const { GodrayFilter:
|
|
6850
|
+
const { GodrayFilter: Xt } = g;
|
|
6845
6851
|
f({
|
|
6846
6852
|
id: "godray",
|
|
6847
6853
|
name: "Godray",
|
|
@@ -6850,7 +6856,7 @@ f({
|
|
|
6850
6856
|
// Create an instance of the GodrayFilter with the provided parameters
|
|
6851
6857
|
createFilter: (s) => {
|
|
6852
6858
|
try {
|
|
6853
|
-
const e = new
|
|
6859
|
+
const e = new Xt({
|
|
6854
6860
|
angle: s.angle || 30,
|
|
6855
6861
|
parallel: s.parallel ?? !0,
|
|
6856
6862
|
center: {
|
|
@@ -7003,7 +7009,7 @@ f({
|
|
|
7003
7009
|
}
|
|
7004
7010
|
]
|
|
7005
7011
|
});
|
|
7006
|
-
const
|
|
7012
|
+
const Yt = g.SimpleLightmapFilter, se = w.Texture;
|
|
7007
7013
|
f({
|
|
7008
7014
|
id: "lightmap",
|
|
7009
7015
|
name: "Lightmap",
|
|
@@ -7028,40 +7034,40 @@ f({
|
|
|
7028
7034
|
const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7029
7035
|
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);
|
|
7030
7036
|
}
|
|
7031
|
-
const o =
|
|
7037
|
+
const o = se.from(r);
|
|
7032
7038
|
let n;
|
|
7033
7039
|
try {
|
|
7034
7040
|
typeof t == "string" && t.startsWith("#") ? n = parseInt(t.replace("#", "0x"), 16) : n = 0;
|
|
7035
7041
|
} catch {
|
|
7036
7042
|
n = 0;
|
|
7037
7043
|
}
|
|
7038
|
-
const l = new
|
|
7044
|
+
const l = new Yt(o, n, i);
|
|
7039
7045
|
return l._customParams = {
|
|
7040
7046
|
textureType: e,
|
|
7041
7047
|
color: t,
|
|
7042
7048
|
alpha: i
|
|
7043
|
-
}, l.updateUIParam = function(c,
|
|
7049
|
+
}, l.updateUIParam = function(c, u) {
|
|
7044
7050
|
try {
|
|
7045
7051
|
const h = this._customParams || {};
|
|
7046
|
-
switch (this._customParams = h, h[c] =
|
|
7052
|
+
switch (this._customParams = h, h[c] = u, c) {
|
|
7047
7053
|
case "textureType":
|
|
7048
|
-
h.textureType =
|
|
7054
|
+
h.textureType = u;
|
|
7049
7055
|
const p = document.createElement("canvas");
|
|
7050
7056
|
p.width = 256, p.height = 256;
|
|
7051
7057
|
const m = p.getContext("2d");
|
|
7052
7058
|
if (m) {
|
|
7053
|
-
if (
|
|
7059
|
+
if (u === "spotlight") {
|
|
7054
7060
|
m.fillStyle = "black", m.fillRect(0, 0, 256, 256);
|
|
7055
7061
|
const b = m.createRadialGradient(128, 128, 5, 128, 128, 80);
|
|
7056
7062
|
b.addColorStop(0, "white"), b.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), b.addColorStop(1, "rgba(0, 0, 0, 0)"), m.fillStyle = b, m.beginPath(), m.arc(128, 128, 100, 0, Math.PI * 2), m.fill();
|
|
7057
|
-
} else if (
|
|
7063
|
+
} else if (u === "softlight") {
|
|
7058
7064
|
const b = m.createLinearGradient(0, 0, 256, 256);
|
|
7059
7065
|
b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.7, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "rgba(80, 80, 80, 1)"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
|
|
7060
7066
|
} else {
|
|
7061
7067
|
const b = m.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7062
7068
|
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);
|
|
7063
7069
|
}
|
|
7064
|
-
const C =
|
|
7070
|
+
const C = se.from(p);
|
|
7065
7071
|
if (this.lightMap = C, this.enabled !== void 0) {
|
|
7066
7072
|
const b = this.enabled;
|
|
7067
7073
|
this.enabled = !1, setTimeout(() => {
|
|
@@ -7071,18 +7077,18 @@ f({
|
|
|
7071
7077
|
}
|
|
7072
7078
|
break;
|
|
7073
7079
|
case "color":
|
|
7074
|
-
h.color =
|
|
7080
|
+
h.color = u;
|
|
7075
7081
|
try {
|
|
7076
|
-
typeof
|
|
7082
|
+
typeof u == "string" && u.startsWith("#") ? this.color = parseInt(u.replace("#", "0x"), 16) : this.color = 0;
|
|
7077
7083
|
} catch {
|
|
7078
7084
|
this.color = 0;
|
|
7079
7085
|
}
|
|
7080
7086
|
break;
|
|
7081
7087
|
case "alpha":
|
|
7082
|
-
this.alpha = Number(
|
|
7088
|
+
this.alpha = Number(u);
|
|
7083
7089
|
break;
|
|
7084
7090
|
default:
|
|
7085
|
-
c in this && (this[c] =
|
|
7091
|
+
c in this && (this[c] = u);
|
|
7086
7092
|
break;
|
|
7087
7093
|
}
|
|
7088
7094
|
} catch {
|
|
@@ -7134,7 +7140,7 @@ f({
|
|
|
7134
7140
|
}
|
|
7135
7141
|
]
|
|
7136
7142
|
});
|
|
7137
|
-
const { NoiseFilter:
|
|
7143
|
+
const { NoiseFilter: Bt } = w;
|
|
7138
7144
|
f({
|
|
7139
7145
|
id: "noise",
|
|
7140
7146
|
name: "Noise",
|
|
@@ -7142,7 +7148,7 @@ f({
|
|
|
7142
7148
|
description: "Add random noise to the image",
|
|
7143
7149
|
createFilter: (s) => {
|
|
7144
7150
|
try {
|
|
7145
|
-
const e = new
|
|
7151
|
+
const e = new Bt({
|
|
7146
7152
|
noise: s.noise || 0.5,
|
|
7147
7153
|
seed: s.seed || Math.random()
|
|
7148
7154
|
});
|
|
@@ -7219,7 +7225,7 @@ f({
|
|
|
7219
7225
|
}
|
|
7220
7226
|
]
|
|
7221
7227
|
});
|
|
7222
|
-
const { OldFilmFilter:
|
|
7228
|
+
const { OldFilmFilter: Ot } = g;
|
|
7223
7229
|
f({
|
|
7224
7230
|
id: "old-film",
|
|
7225
7231
|
name: "Old Film",
|
|
@@ -7227,7 +7233,7 @@ f({
|
|
|
7227
7233
|
description: "Apply a vintage film effect with scratches and grain",
|
|
7228
7234
|
createFilter: (s) => {
|
|
7229
7235
|
try {
|
|
7230
|
-
const e = new
|
|
7236
|
+
const e = new Ot({
|
|
7231
7237
|
sepia: s.sepia,
|
|
7232
7238
|
noise: s.noise,
|
|
7233
7239
|
noiseSize: s.noiseSize,
|
|
@@ -7408,7 +7414,7 @@ f({
|
|
|
7408
7414
|
}
|
|
7409
7415
|
]
|
|
7410
7416
|
});
|
|
7411
|
-
const { OutlineFilter:
|
|
7417
|
+
const { OutlineFilter: Lt } = g;
|
|
7412
7418
|
f({
|
|
7413
7419
|
id: "outline",
|
|
7414
7420
|
name: "Outline",
|
|
@@ -7418,7 +7424,7 @@ f({
|
|
|
7418
7424
|
try {
|
|
7419
7425
|
let e = s.color;
|
|
7420
7426
|
typeof e == "string" && (e = parseInt(e.replace("#", "0x"), 16));
|
|
7421
|
-
const t = new
|
|
7427
|
+
const t = new Lt({
|
|
7422
7428
|
thickness: s.thickness || 4,
|
|
7423
7429
|
color: e,
|
|
7424
7430
|
alpha: s.alpha || 1,
|
|
@@ -7508,7 +7514,7 @@ f({
|
|
|
7508
7514
|
}
|
|
7509
7515
|
]
|
|
7510
7516
|
});
|
|
7511
|
-
const { PixelateFilter:
|
|
7517
|
+
const { PixelateFilter: Dt } = g;
|
|
7512
7518
|
f({
|
|
7513
7519
|
id: "pixelate",
|
|
7514
7520
|
name: "Pixelate",
|
|
@@ -7516,7 +7522,7 @@ f({
|
|
|
7516
7522
|
description: "Create a pixelated or mosaic effect",
|
|
7517
7523
|
createFilter: (s) => {
|
|
7518
7524
|
try {
|
|
7519
|
-
const e = new
|
|
7525
|
+
const e = new Dt(
|
|
7520
7526
|
s.useUniform ? Math.max(4, s.size || 10) : [Math.max(4, s.sizeX || 10), Math.max(4, s.sizeY || 10)]
|
|
7521
7527
|
);
|
|
7522
7528
|
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
@@ -7599,7 +7605,7 @@ f({
|
|
|
7599
7605
|
}
|
|
7600
7606
|
]
|
|
7601
7607
|
});
|
|
7602
|
-
const { ReflectionFilter:
|
|
7608
|
+
const { ReflectionFilter: Ut } = g;
|
|
7603
7609
|
f({
|
|
7604
7610
|
id: "reflection",
|
|
7605
7611
|
// ID must match what the application expects
|
|
@@ -7616,7 +7622,7 @@ f({
|
|
|
7616
7622
|
waveLength: new Float32Array([s.wavelengthStart ?? 30, s.wavelengthEnd ?? 100]),
|
|
7617
7623
|
alpha: new Float32Array([s.alphaStart ?? 1, s.alphaEnd ?? 1]),
|
|
7618
7624
|
time: s.time ?? 0
|
|
7619
|
-
}, t = new
|
|
7625
|
+
}, t = new Ut(e);
|
|
7620
7626
|
return t._customParams = { ...s }, t.animating = s.animating ?? !1, t.updateUIParam = function(i, r) {
|
|
7621
7627
|
const a = this._customParams || {};
|
|
7622
7628
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -7767,7 +7773,7 @@ f({
|
|
|
7767
7773
|
}
|
|
7768
7774
|
]
|
|
7769
7775
|
});
|
|
7770
|
-
const { ShockwaveFilter:
|
|
7776
|
+
const { ShockwaveFilter: Vt } = g;
|
|
7771
7777
|
f({
|
|
7772
7778
|
id: "shockwave",
|
|
7773
7779
|
// ID must match what the application expects
|
|
@@ -7777,7 +7783,7 @@ f({
|
|
|
7777
7783
|
// Create an instance of the ShockwaveFilter with the provided parameters
|
|
7778
7784
|
createFilter: (s) => {
|
|
7779
7785
|
try {
|
|
7780
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0,
|
|
7786
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0, u = new Vt({
|
|
7781
7787
|
center: i,
|
|
7782
7788
|
amplitude: r,
|
|
7783
7789
|
wavelength: a,
|
|
@@ -7786,7 +7792,7 @@ f({
|
|
|
7786
7792
|
radius: l,
|
|
7787
7793
|
time: c
|
|
7788
7794
|
});
|
|
7789
|
-
return
|
|
7795
|
+
return u._customParams = { ...s }, u.animating = s.animating ?? !1, u.updateUIParam = function(h, p) {
|
|
7790
7796
|
const m = this._customParams || {};
|
|
7791
7797
|
switch (this._customParams = m, m[h] = p, h) {
|
|
7792
7798
|
case "centerX":
|
|
@@ -7811,7 +7817,7 @@ f({
|
|
|
7811
7817
|
break;
|
|
7812
7818
|
}
|
|
7813
7819
|
return !0;
|
|
7814
|
-
},
|
|
7820
|
+
}, u;
|
|
7815
7821
|
} catch {
|
|
7816
7822
|
return null;
|
|
7817
7823
|
}
|
|
@@ -7919,7 +7925,7 @@ f({
|
|
|
7919
7925
|
}
|
|
7920
7926
|
]
|
|
7921
7927
|
});
|
|
7922
|
-
const { SimplexNoiseFilter:
|
|
7928
|
+
const { SimplexNoiseFilter: jt } = g;
|
|
7923
7929
|
f({
|
|
7924
7930
|
id: "simplex-noise",
|
|
7925
7931
|
name: "Simplex Noise",
|
|
@@ -7927,7 +7933,7 @@ f({
|
|
|
7927
7933
|
description: "Apply procedural noise to create texture effects",
|
|
7928
7934
|
createFilter: (s) => {
|
|
7929
7935
|
try {
|
|
7930
|
-
const e = s.animating ? 0 : s.offsetZ || 0, t = new
|
|
7936
|
+
const e = s.animating ? 0 : s.offsetZ || 0, t = new jt({
|
|
7931
7937
|
strength: s.strength,
|
|
7932
7938
|
noiseScale: s.noiseScale,
|
|
7933
7939
|
offsetX: s.offsetX,
|
|
@@ -8074,9 +8080,9 @@ f({
|
|
|
8074
8080
|
}
|
|
8075
8081
|
]
|
|
8076
8082
|
});
|
|
8077
|
-
class
|
|
8083
|
+
class qt extends w.Filter {
|
|
8078
8084
|
constructor(e) {
|
|
8079
|
-
const t =
|
|
8085
|
+
const t = be.from({
|
|
8080
8086
|
vertex: `
|
|
8081
8087
|
attribute vec2 aPosition;
|
|
8082
8088
|
varying vec2 vTextureCoord;
|
|
@@ -8185,7 +8191,7 @@ f({
|
|
|
8185
8191
|
description: "Creates a twisting distortion effect around a central point",
|
|
8186
8192
|
createFilter: (s) => {
|
|
8187
8193
|
try {
|
|
8188
|
-
const e = new
|
|
8194
|
+
const e = new qt({
|
|
8189
8195
|
centerX: s.centerX ?? 0.5,
|
|
8190
8196
|
centerY: s.centerY ?? 0.5,
|
|
8191
8197
|
radius: s.radius ?? 0.25,
|
|
@@ -8255,7 +8261,7 @@ f({
|
|
|
8255
8261
|
}
|
|
8256
8262
|
]
|
|
8257
8263
|
});
|
|
8258
|
-
const { AdjustmentFilter:
|
|
8264
|
+
const { AdjustmentFilter: Ht } = g;
|
|
8259
8265
|
function D(s) {
|
|
8260
8266
|
const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
|
|
8261
8267
|
return [
|
|
@@ -8264,7 +8270,7 @@ function D(s) {
|
|
|
8264
8270
|
(e & 255) / 255
|
|
8265
8271
|
];
|
|
8266
8272
|
}
|
|
8267
|
-
class
|
|
8273
|
+
class $t extends Ht {
|
|
8268
8274
|
constructor(e = {}) {
|
|
8269
8275
|
super({
|
|
8270
8276
|
brightness: 1,
|
|
@@ -8307,7 +8313,7 @@ f({
|
|
|
8307
8313
|
description: "Add a classic darkened border effect to the image",
|
|
8308
8314
|
createFilter: (s) => {
|
|
8309
8315
|
try {
|
|
8310
|
-
const e = new
|
|
8316
|
+
const e = new $t({
|
|
8311
8317
|
radius: s.radius || 0.8,
|
|
8312
8318
|
strength: s.strength || 1,
|
|
8313
8319
|
color: s.color || "#000000"
|
|
@@ -8371,22 +8377,22 @@ f({
|
|
|
8371
8377
|
}
|
|
8372
8378
|
]
|
|
8373
8379
|
});
|
|
8374
|
-
function
|
|
8380
|
+
function Jt(s) {
|
|
8375
8381
|
try {
|
|
8376
8382
|
let e = [], t = [];
|
|
8377
8383
|
try {
|
|
8378
|
-
e = U(), e.length === 0 &&
|
|
8384
|
+
e = U(), e.length === 0 && Je();
|
|
8379
8385
|
} catch {
|
|
8380
8386
|
}
|
|
8381
8387
|
const i = s == null ? void 0 : s.disabled;
|
|
8382
8388
|
if (Array.isArray(i) && i.length > 0) {
|
|
8383
8389
|
let r = 0;
|
|
8384
8390
|
for (const a of i)
|
|
8385
|
-
|
|
8391
|
+
it(a) && r++;
|
|
8386
8392
|
r > 0;
|
|
8387
8393
|
}
|
|
8388
8394
|
try {
|
|
8389
|
-
e = U(), t =
|
|
8395
|
+
e = U(), t = tt();
|
|
8390
8396
|
} catch {
|
|
8391
8397
|
e || (e = []), t || (t = []);
|
|
8392
8398
|
}
|
|
@@ -8396,16 +8402,16 @@ function ei(s) {
|
|
|
8396
8402
|
}
|
|
8397
8403
|
}
|
|
8398
8404
|
export {
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8405
|
+
Gt as V,
|
|
8406
|
+
Qe as a,
|
|
8407
|
+
et as b,
|
|
8408
|
+
tt as c,
|
|
8409
|
+
Je as d,
|
|
8410
|
+
Qt as e,
|
|
8411
|
+
rt as f,
|
|
8406
8412
|
U as g,
|
|
8407
|
-
|
|
8408
|
-
|
|
8413
|
+
Kt as h,
|
|
8414
|
+
Jt as i,
|
|
8409
8415
|
f as r
|
|
8410
8416
|
};
|
|
8411
|
-
//# sourceMappingURL=editor-
|
|
8417
|
+
//# sourceMappingURL=editor-BWpslm--.js.map
|