@codingfactory/mediables-vue 2.4.0 → 2.4.2
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-D8dt-5Oj.js → PixiFrameExporter-C_1YAQeT.js} +2 -2
- package/dist/{PixiFrameExporter-D8dt-5Oj.js.map → PixiFrameExporter-C_1YAQeT.js.map} +1 -1
- package/dist/{PixiFrameExporter-rWh-JQub.cjs → PixiFrameExporter-Suw6Dxf2.cjs} +2 -2
- package/dist/{PixiFrameExporter-rWh-JQub.cjs.map → PixiFrameExporter-Suw6Dxf2.cjs.map} +1 -1
- package/dist/editor-BUpGsg4D.cjs +42 -0
- package/dist/editor-BUpGsg4D.cjs.map +1 -0
- package/dist/{editor-624YYYUE.js → editor-Cw08D0SQ.js} +323 -281
- package/dist/editor-Cw08D0SQ.js.map +1 -0
- package/dist/{index-Bwmk8LYJ.js → index-mZS1mNLQ.js} +3 -3
- package/dist/{index-Bwmk8LYJ.js.map → index-mZS1mNLQ.js.map} +1 -1
- package/dist/{index-PyOrcGKi.cjs → index-wOQ7eP9R.cjs} +3 -3
- package/dist/{index-PyOrcGKi.cjs.map → index-wOQ7eP9R.cjs.map} +1 -1
- package/dist/mediables-vanilla.cjs +1 -1
- package/dist/mediables-vanilla.mjs +1 -1
- package/dist/mediables-vue.cjs +1 -1
- package/dist/mediables-vue.mjs +2 -2
- package/package.json +1 -1
- package/dist/editor-624YYYUE.js.map +0 -1
- package/dist/editor-BU3jmGLs.cjs +0 -42
- package/dist/editor-BU3jmGLs.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _e = Object.defineProperty;
|
|
2
2
|
var xe = (s, e, t) => e in s ? _e(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
3
|
var j = (s, e, t) => xe(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
4
|
+
import * as b from "pixi-filters";
|
|
5
|
+
import * as S from "pixi.js";
|
|
6
6
|
import { GlProgram as Ce } from "pixi.js";
|
|
7
7
|
class B {
|
|
8
8
|
constructor() {
|
|
@@ -291,18 +291,18 @@ class ve extends B {
|
|
|
291
291
|
* @param {string} imageUrl - URL, data URL, or blob URL of the image
|
|
292
292
|
*/
|
|
293
293
|
async loadTexture(e) {
|
|
294
|
-
var l, c,
|
|
295
|
-
if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return;
|
|
294
|
+
var l, c, d;
|
|
295
|
+
if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return !1;
|
|
296
296
|
const t = window.PIXI, i = await this._loadImageElement(e);
|
|
297
|
-
if (!i || !((c = this.app) != null && c.renderer)) return;
|
|
297
|
+
if (!i || !((c = this.app) != null && c.renderer)) return !1;
|
|
298
298
|
const r = t.Texture.from(i);
|
|
299
299
|
if (!r)
|
|
300
|
-
return;
|
|
300
|
+
return !1;
|
|
301
301
|
this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new t.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
|
|
302
302
|
const { w: a, h: o } = this._getCssSize();
|
|
303
|
-
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((
|
|
303
|
+
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((d = this.app) != null && d.renderer)) return !1;
|
|
304
304
|
const n = this.getFitScaleFor(r);
|
|
305
|
-
Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height });
|
|
305
|
+
return Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height }), !0;
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
308
|
* Export the current image with filters applied
|
|
@@ -325,35 +325,35 @@ class ve extends B {
|
|
|
325
325
|
let v = i / _;
|
|
326
326
|
r && (v = Math.min(1, v)), l = Math.round(o * v);
|
|
327
327
|
}
|
|
328
|
-
const c = this.sprite,
|
|
328
|
+
const c = this.sprite, d = c.x, h = c.y, p = c.width, m = c.height;
|
|
329
329
|
if (p <= 0 || m <= 0)
|
|
330
330
|
return null;
|
|
331
|
-
const
|
|
332
|
-
let
|
|
331
|
+
const x = l / p;
|
|
332
|
+
let g = null;
|
|
333
333
|
try {
|
|
334
|
-
if (c.x = 0, c.y = 0,
|
|
334
|
+
if (c.x = 0, c.y = 0, g = a.RenderTexture.create({
|
|
335
335
|
width: Math.ceil(p),
|
|
336
336
|
height: Math.ceil(m),
|
|
337
|
-
resolution:
|
|
338
|
-
}), this.app.renderer.render({ container: this.app.stage, target:
|
|
337
|
+
resolution: x
|
|
338
|
+
}), this.app.renderer.render({ container: this.app.stage, target: g }), !this.app.renderer.extract)
|
|
339
339
|
return null;
|
|
340
|
-
const _ = this.app.renderer.extract.canvas(
|
|
340
|
+
const _ = this.app.renderer.extract.canvas(g);
|
|
341
341
|
if (!_)
|
|
342
342
|
return null;
|
|
343
343
|
let v = null;
|
|
344
344
|
if (typeof _.toDataURL == "function")
|
|
345
345
|
v = _.toDataURL(`image/${e}`, t);
|
|
346
346
|
else if (typeof _.getContext == "function") {
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
const O =
|
|
350
|
-
O && (O.drawImage(_, 0, 0), v =
|
|
347
|
+
const C = document.createElement("canvas");
|
|
348
|
+
C.width = _.width, C.height = _.height;
|
|
349
|
+
const O = C.getContext("2d");
|
|
350
|
+
O && (O.drawImage(_, 0, 0), v = C.toDataURL(`image/${e}`, t));
|
|
351
351
|
}
|
|
352
352
|
return v || null;
|
|
353
353
|
} catch {
|
|
354
354
|
return null;
|
|
355
355
|
} finally {
|
|
356
|
-
c.x =
|
|
356
|
+
c.x = d, c.y = h, g && g.destroy(!0);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
/**
|
|
@@ -583,9 +583,9 @@ class Pe extends B {
|
|
|
583
583
|
if (!o || !o.createFilter || typeof o.createFilter != "function")
|
|
584
584
|
return;
|
|
585
585
|
const n = this.state.getFilterValues(a), l = o.defaultParams ? { ...o.defaultParams } : {};
|
|
586
|
-
o.controls && Array.isArray(o.controls) && o.controls.forEach((
|
|
587
|
-
const h =
|
|
588
|
-
l[h] = n[
|
|
586
|
+
o.controls && Array.isArray(o.controls) && o.controls.forEach((d) => {
|
|
587
|
+
const h = d.property || d.id;
|
|
588
|
+
l[h] = n[d.id] ?? d.default;
|
|
589
589
|
});
|
|
590
590
|
const c = o.createFilter(l);
|
|
591
591
|
c && (t.push(c), this.instances[a] = c);
|
|
@@ -701,14 +701,14 @@ const T = class T extends B {
|
|
|
701
701
|
if (!e || !r || !a || !o) return null;
|
|
702
702
|
const l = e.width > t, c = e.height > i;
|
|
703
703
|
if (!l && !c) return null;
|
|
704
|
-
const
|
|
704
|
+
const d = T.AUTO_ZOOM_PADDING;
|
|
705
705
|
let h = n;
|
|
706
706
|
if (l) {
|
|
707
|
-
const p = e.width / (
|
|
707
|
+
const p = e.width / (d * r * o);
|
|
708
708
|
h = Math.min(h, p);
|
|
709
709
|
}
|
|
710
710
|
if (c) {
|
|
711
|
-
const p = e.height / (
|
|
711
|
+
const p = e.height / (d * a * o);
|
|
712
712
|
h = Math.min(h, p);
|
|
713
713
|
}
|
|
714
714
|
return h = Math.max(0.1, h), h >= n - 0.01 ? null : h;
|
|
@@ -752,8 +752,8 @@ const T = class T extends B {
|
|
|
752
752
|
if (!l) return;
|
|
753
753
|
const c = this.state.get("crop.shape");
|
|
754
754
|
if (n.save(), c === "circle") {
|
|
755
|
-
const y = l.x + l.width / 2,
|
|
756
|
-
n.beginPath(), n.arc(y,
|
|
755
|
+
const y = l.x + l.width / 2, P = l.y + l.height / 2, _ = Math.min(l.width, l.height) / 2;
|
|
756
|
+
n.beginPath(), n.arc(y, P, _, 0, Math.PI * 2), n.clip();
|
|
757
757
|
} else
|
|
758
758
|
n.beginPath(), n.rect(l.x, l.y, l.width, l.height), n.clip();
|
|
759
759
|
n.clearRect(l.x, l.y, l.width, l.height), n.restore(), n.strokeStyle = "#ffffff", n.lineWidth = 2, n.setLineDash([5, 5]), c === "circle" ? (n.beginPath(), n.arc(
|
|
@@ -763,23 +763,23 @@ const T = class T extends B {
|
|
|
763
763
|
0,
|
|
764
764
|
Math.PI * 2
|
|
765
765
|
), n.stroke()) : n.strokeRect(l.x, l.y, l.width, l.height), n.setLineDash([]), n.strokeStyle = "rgba(255,255,255,0.3)", n.lineWidth = 1;
|
|
766
|
-
const
|
|
766
|
+
const d = l.width / 3, h = l.height / 3;
|
|
767
767
|
for (let y = 1; y <= 2; y++)
|
|
768
|
-
n.beginPath(), n.moveTo(l.x +
|
|
768
|
+
n.beginPath(), n.moveTo(l.x + d * y, l.y), n.lineTo(l.x + d * y, l.y + l.height), n.stroke(), n.beginPath(), n.moveTo(l.x, l.y + h * y), n.lineTo(l.x + l.width, l.y + h * y), n.stroke();
|
|
769
769
|
const p = this.HANDLE_SIZE, m = [
|
|
770
770
|
{ x: l.x, y: l.y, m: "resize-nw" },
|
|
771
771
|
{ x: l.x + l.width, y: l.y, m: "resize-ne" },
|
|
772
772
|
{ x: l.x, y: l.y + l.height, m: "resize-sw" },
|
|
773
773
|
{ x: l.x + l.width, y: l.y + l.height, m: "resize-se" }
|
|
774
|
-
],
|
|
774
|
+
], x = [
|
|
775
775
|
{ x: l.x + l.width / 2, y: l.y, m: "n" },
|
|
776
776
|
{ x: l.x + l.width / 2, y: l.y + l.height, m: "s" },
|
|
777
777
|
{ x: l.x, y: l.y + l.height / 2, m: "w" },
|
|
778
778
|
{ x: l.x + l.width, y: l.y + l.height / 2, m: "e" }
|
|
779
|
-
],
|
|
780
|
-
for (const y of
|
|
781
|
-
const
|
|
782
|
-
n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle =
|
|
779
|
+
], g = [...m, ...x];
|
|
780
|
+
for (const y of g) {
|
|
781
|
+
const P = this._hoverMode === y.m, _ = P ? p + 4 : p;
|
|
782
|
+
n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle = P ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
/**
|
|
@@ -807,12 +807,12 @@ const T = class T extends B {
|
|
|
807
807
|
* Handle pointer move event
|
|
808
808
|
*/
|
|
809
809
|
_handlePointerMove(e) {
|
|
810
|
-
var l, c,
|
|
810
|
+
var l, c, d, h;
|
|
811
811
|
const t = this.renderer.app;
|
|
812
812
|
if (!t) return;
|
|
813
813
|
const i = e.global;
|
|
814
814
|
if (!this._isDragging || !this._dragStart || !this._startRect) {
|
|
815
|
-
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (
|
|
815
|
+
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (d = this._hoverMode) != null && d.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
|
|
816
816
|
return;
|
|
817
817
|
}
|
|
818
818
|
const r = this.state.get("crop.rect");
|
|
@@ -889,30 +889,58 @@ const T = class T extends B {
|
|
|
889
889
|
apply() {
|
|
890
890
|
const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
|
|
891
891
|
if (!r || !t || !e || !i) return null;
|
|
892
|
-
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n,
|
|
893
|
-
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c),
|
|
892
|
+
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n, d = (r.y - t.y) * l;
|
|
893
|
+
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), x = Math.round(d);
|
|
894
894
|
if (h <= 0 || p <= 0) return null;
|
|
895
|
-
const
|
|
895
|
+
const g = new a.Container(), y = new a.Sprite(i);
|
|
896
896
|
if (this.state.get("crop.shape") === "circle") {
|
|
897
|
-
const V = Math.round(Math.max(h, p)), be = m + h / 2, ye =
|
|
898
|
-
m = Math.round(be - V / 2),
|
|
899
|
-
const
|
|
900
|
-
typeof
|
|
897
|
+
const V = Math.round(Math.max(h, p)), be = m + h / 2, ye = x + p / 2;
|
|
898
|
+
m = Math.round(be - V / 2), x = Math.round(ye - V / 2), h = p = V;
|
|
899
|
+
const A = new a.Graphics();
|
|
900
|
+
typeof A.circle == "function" && typeof A.fill == "function" ? A.circle(h / 2, p / 2, h / 2).fill(16777215) : (A.beginFill(16777215, 1), A.drawCircle(h / 2, p / 2, h / 2), A.endFill()), y.mask = A, g.addChild(A);
|
|
901
901
|
}
|
|
902
|
-
y.x = -m, y.y = -
|
|
902
|
+
y.x = -m, y.y = -x, g.addChild(y);
|
|
903
903
|
const _ = a.RenderTexture.create({ width: h, height: p });
|
|
904
904
|
e.renderer.render({
|
|
905
|
-
container:
|
|
905
|
+
container: g,
|
|
906
906
|
target: _,
|
|
907
907
|
clear: !0
|
|
908
|
-
}),
|
|
908
|
+
}), g.destroy({ children: !0 });
|
|
909
909
|
const v = this.renderer.originalTexture;
|
|
910
910
|
v && v !== this.renderer.baseTexture && v.destroy(!0), this.renderer.originalTexture = _, e.stage.removeChild(t), t.destroy();
|
|
911
|
-
const
|
|
912
|
-
e.stage.addChild(
|
|
913
|
-
const O = { x:
|
|
911
|
+
const C = new a.Sprite(_);
|
|
912
|
+
e.stage.addChild(C), this.renderer.sprite = C, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render();
|
|
913
|
+
const O = { x: m, y: x, width: h, height: p }, me = this.state.get("crop.shape") || "free", ge = this.state.get("crop.aspect") || "free";
|
|
914
914
|
return this.disable(), this.state.set("crop.appliedRect", O), this.state.set("crop.appliedShape", me), this.state.set("crop.appliedAspect", ge), this.emit("applied", { width: h, height: p }), { texture: _, preservedZoom: o };
|
|
915
915
|
}
|
|
916
|
+
/**
|
|
917
|
+
* Apply a crop from saved texture-pixel coordinates (for state rehydration).
|
|
918
|
+
* Unlike apply(), this does not read from crop.rect or require the interactive overlay.
|
|
919
|
+
* @param {{ x: number, y: number, width: number, height: number }} pixelRect
|
|
920
|
+
* @param {'free'|'circle'} shape
|
|
921
|
+
* @returns {{ texture: Object, preservedZoom: number }|null}
|
|
922
|
+
*/
|
|
923
|
+
applyFromPixelRect(e, t = "free") {
|
|
924
|
+
const i = this.renderer.app, r = this.renderer.sprite, a = this.renderer.originalTexture;
|
|
925
|
+
if (!e || !r || !i || !a) return null;
|
|
926
|
+
const o = window.PIXI, n = this.renderer.zoom;
|
|
927
|
+
let l = Math.round(Math.max(1, e.width)), c = Math.round(Math.max(1, e.height)), d = Math.round(e.x), h = Math.round(e.y);
|
|
928
|
+
if (l <= 0 || c <= 0) return null;
|
|
929
|
+
const p = new o.Container(), m = new o.Sprite(a);
|
|
930
|
+
if (t === "circle") {
|
|
931
|
+
const P = Math.round(Math.max(l, c)), _ = d + l / 2, v = h + c / 2;
|
|
932
|
+
d = Math.round(_ - P / 2), h = Math.round(v - P / 2), l = c = P;
|
|
933
|
+
const C = new o.Graphics();
|
|
934
|
+
typeof C.circle == "function" && typeof C.fill == "function" ? C.circle(l / 2, c / 2, l / 2).fill(16777215) : (C.beginFill(16777215, 1), C.drawCircle(l / 2, c / 2, l / 2), C.endFill()), m.mask = C, p.addChild(C);
|
|
935
|
+
}
|
|
936
|
+
m.x = -d, m.y = -h, p.addChild(m);
|
|
937
|
+
const x = o.RenderTexture.create({ width: l, height: c });
|
|
938
|
+
i.renderer.render({ container: p, target: x, clear: !0 }), p.destroy({ children: !0 });
|
|
939
|
+
const g = this.renderer.originalTexture;
|
|
940
|
+
g && g !== this.renderer.baseTexture && g.destroy(!0), this.renderer.originalTexture = x, i.stage.removeChild(r), r.destroy();
|
|
941
|
+
const y = new o.Sprite(x);
|
|
942
|
+
return i.stage.addChild(y), this.renderer.sprite = y, this.renderer.fitScale = this.renderer.getFitScaleFor(x), this.renderer.setZoom(n, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), { texture: x, preservedZoom: n };
|
|
943
|
+
}
|
|
916
944
|
/**
|
|
917
945
|
* Cancel crop
|
|
918
946
|
*/
|
|
@@ -993,8 +1021,8 @@ class Me {
|
|
|
993
1021
|
if (!a.ok) {
|
|
994
1022
|
let c = `Background removal failed (HTTP ${a.status})`;
|
|
995
1023
|
try {
|
|
996
|
-
const
|
|
997
|
-
|
|
1024
|
+
const d = await a.text();
|
|
1025
|
+
d && (c += `: ${d}`);
|
|
998
1026
|
} catch {
|
|
999
1027
|
}
|
|
1000
1028
|
throw new Error(c);
|
|
@@ -1053,7 +1081,7 @@ class Me {
|
|
|
1053
1081
|
}
|
|
1054
1082
|
}
|
|
1055
1083
|
}
|
|
1056
|
-
function
|
|
1084
|
+
function u(s, e = {}, ...t) {
|
|
1057
1085
|
const i = document.createElement(s);
|
|
1058
1086
|
for (const [r, a] of Object.entries(e))
|
|
1059
1087
|
if (a != null)
|
|
@@ -1070,16 +1098,16 @@ function d(s, e = {}, ...t) {
|
|
|
1070
1098
|
return i;
|
|
1071
1099
|
}
|
|
1072
1100
|
function oe({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
|
|
1073
|
-
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l =
|
|
1101
|
+
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = u("div", {
|
|
1074
1102
|
className: "slider-control slider-wrapper",
|
|
1075
1103
|
"data-control": n,
|
|
1076
1104
|
"data-testid": `slider-${n}`
|
|
1077
|
-
}), c =
|
|
1105
|
+
}), c = u(
|
|
1078
1106
|
"div",
|
|
1079
1107
|
{ className: "slider-header" },
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
),
|
|
1108
|
+
u("label", { for: s, className: "slider-label" }, e),
|
|
1109
|
+
u("span", { className: "slider-value", id: `${s}-value` }, q(a))
|
|
1110
|
+
), d = u("input", {
|
|
1083
1111
|
type: "range",
|
|
1084
1112
|
id: s,
|
|
1085
1113
|
className: "slider-input",
|
|
@@ -1092,8 +1120,8 @@ function oe({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1092
1120
|
m && (m.textContent = q(p)), o == null || o(p);
|
|
1093
1121
|
}
|
|
1094
1122
|
});
|
|
1095
|
-
return l.appendChild(c), l.appendChild(
|
|
1096
|
-
|
|
1123
|
+
return l.appendChild(c), l.appendChild(d), l.setValue = (h) => {
|
|
1124
|
+
d.value = String(h);
|
|
1097
1125
|
const p = l.querySelector(".slider-value");
|
|
1098
1126
|
p && (p.textContent = q(h));
|
|
1099
1127
|
}, l;
|
|
@@ -1102,24 +1130,24 @@ function q(s) {
|
|
|
1102
1130
|
return Number.isInteger(s) ? String(s) : s.toFixed(2);
|
|
1103
1131
|
}
|
|
1104
1132
|
function ne({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
1105
|
-
const r =
|
|
1133
|
+
const r = u("div", { className: "toggle-control" }), a = u("label", { className: "toggle-label", for: s }, e), o = u("input", {
|
|
1106
1134
|
type: "checkbox",
|
|
1107
1135
|
id: s,
|
|
1108
1136
|
className: "toggle-input",
|
|
1109
1137
|
checked: t ? "checked" : void 0,
|
|
1110
1138
|
onChange: (c) => i == null ? void 0 : i(c.target.checked)
|
|
1111
|
-
}), n =
|
|
1139
|
+
}), n = u("div", {
|
|
1112
1140
|
className: "toggle-switch",
|
|
1113
1141
|
onClick: (c) => {
|
|
1114
1142
|
c.target !== o && (o.checked = !o.checked, i == null || i(o.checked));
|
|
1115
1143
|
}
|
|
1116
|
-
}), l =
|
|
1144
|
+
}), l = u("span", { className: "toggle-slider" });
|
|
1117
1145
|
return n.appendChild(o), n.appendChild(l), r.appendChild(a), r.appendChild(n), r.setChecked = (c) => {
|
|
1118
1146
|
o.checked = c;
|
|
1119
1147
|
}, r;
|
|
1120
1148
|
}
|
|
1121
1149
|
function le({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
1122
|
-
const r =
|
|
1150
|
+
const r = u("div", { className: "color-control" }), a = u("label", { className: "color-label", for: s }, e), o = u("input", {
|
|
1123
1151
|
type: "color",
|
|
1124
1152
|
id: s,
|
|
1125
1153
|
className: "color-input",
|
|
@@ -1131,35 +1159,35 @@ function le({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
|
1131
1159
|
}, r;
|
|
1132
1160
|
}
|
|
1133
1161
|
function ce({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
1134
|
-
const a =
|
|
1162
|
+
const a = u("div", { className: "select-control" }), o = u("label", { className: "select-label", for: s }, e), n = u("select", {
|
|
1135
1163
|
id: s,
|
|
1136
1164
|
className: "select-input",
|
|
1137
1165
|
onChange: (l) => r == null ? void 0 : r(l.target.value)
|
|
1138
1166
|
});
|
|
1139
1167
|
for (const l of t) {
|
|
1140
|
-
const c =
|
|
1168
|
+
const c = u("option", { value: l.value }, l.label);
|
|
1141
1169
|
l.value === i && (c.selected = !0), n.appendChild(c);
|
|
1142
1170
|
}
|
|
1143
1171
|
return a.appendChild(o), a.appendChild(n), a.setValue = (l) => {
|
|
1144
1172
|
n.value = l;
|
|
1145
1173
|
}, a;
|
|
1146
1174
|
}
|
|
1147
|
-
function
|
|
1148
|
-
const a =
|
|
1175
|
+
function z({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
|
|
1176
|
+
const a = u("button", {
|
|
1149
1177
|
type: "button",
|
|
1150
1178
|
className: `btn ${e}`.trim(),
|
|
1151
1179
|
onClick: t,
|
|
1152
1180
|
disabled: r ? "disabled" : void 0
|
|
1153
1181
|
});
|
|
1154
1182
|
if (i) {
|
|
1155
|
-
const o =
|
|
1183
|
+
const o = u("span", { className: "btn-icon" });
|
|
1156
1184
|
o.innerHTML = i;
|
|
1157
1185
|
const n = o.querySelector("svg");
|
|
1158
1186
|
n && n.setAttribute("aria-hidden", "true"), a.appendChild(o);
|
|
1159
1187
|
}
|
|
1160
1188
|
return s && a.appendChild(document.createTextNode(s)), a;
|
|
1161
1189
|
}
|
|
1162
|
-
function
|
|
1190
|
+
function w({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1, testId: a = null, ariaLabel: o = null }) {
|
|
1163
1191
|
const n = {
|
|
1164
1192
|
type: "button",
|
|
1165
1193
|
className: `icon-btn ${t}`.trim(),
|
|
@@ -1169,24 +1197,24 @@ function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1,
|
|
|
1169
1197
|
disabled: r ? "disabled" : void 0
|
|
1170
1198
|
};
|
|
1171
1199
|
a && (n.dataset = { testid: a });
|
|
1172
|
-
const l =
|
|
1200
|
+
const l = u("button", n);
|
|
1173
1201
|
l.innerHTML = s;
|
|
1174
1202
|
const c = l.querySelector("svg");
|
|
1175
1203
|
return c && c.setAttribute("aria-hidden", "true"), l;
|
|
1176
1204
|
}
|
|
1177
1205
|
function Z({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
1178
|
-
const r =
|
|
1206
|
+
const r = u("button", {
|
|
1179
1207
|
type: "button",
|
|
1180
1208
|
className: `chip ${t ? "active" : ""}`.trim(),
|
|
1181
1209
|
onClick: i
|
|
1182
1210
|
});
|
|
1183
1211
|
if (e) {
|
|
1184
|
-
const a =
|
|
1212
|
+
const a = u("span", { className: "chip-icon" });
|
|
1185
1213
|
a.innerHTML = e;
|
|
1186
1214
|
const o = a.querySelector("svg");
|
|
1187
1215
|
o && o.setAttribute("aria-hidden", "true"), r.appendChild(a);
|
|
1188
1216
|
}
|
|
1189
|
-
return r.appendChild(
|
|
1217
|
+
return r.appendChild(u("span", { className: "chip-label" }, s)), r.setActive = (a) => {
|
|
1190
1218
|
r.classList.toggle("active", a);
|
|
1191
1219
|
}, r;
|
|
1192
1220
|
}
|
|
@@ -1200,8 +1228,8 @@ class je {
|
|
|
1200
1228
|
* @returns {HTMLElement}
|
|
1201
1229
|
*/
|
|
1202
1230
|
render() {
|
|
1203
|
-
this.element =
|
|
1204
|
-
const e =
|
|
1231
|
+
this.element = u("div", { className: "editor-toolbar" });
|
|
1232
|
+
const e = u("div", { className: "toolbar-section toolbar-left" }), t = w({
|
|
1205
1233
|
icon: Oe,
|
|
1206
1234
|
title: "Open Image",
|
|
1207
1235
|
className: "toolbar-btn",
|
|
@@ -1210,7 +1238,7 @@ class je {
|
|
|
1210
1238
|
onClick: () => this.editor.openFilePicker()
|
|
1211
1239
|
});
|
|
1212
1240
|
e.appendChild(t);
|
|
1213
|
-
const i =
|
|
1241
|
+
const i = u("div", { className: "toolbar-section toolbar-center" }), r = w({
|
|
1214
1242
|
icon: Ae,
|
|
1215
1243
|
title: "Zoom Out",
|
|
1216
1244
|
className: "toolbar-btn",
|
|
@@ -1221,13 +1249,13 @@ class je {
|
|
|
1221
1249
|
this.editor.setZoom(h - 0.25);
|
|
1222
1250
|
}
|
|
1223
1251
|
});
|
|
1224
|
-
this._zoomLabel =
|
|
1252
|
+
this._zoomLabel = u("span", {
|
|
1225
1253
|
className: "zoom-label",
|
|
1226
1254
|
"aria-live": "polite",
|
|
1227
1255
|
"aria-atomic": "true",
|
|
1228
1256
|
role: "status"
|
|
1229
1257
|
}, "100%");
|
|
1230
|
-
const a =
|
|
1258
|
+
const a = w({
|
|
1231
1259
|
icon: Fe,
|
|
1232
1260
|
title: "Zoom In",
|
|
1233
1261
|
className: "toolbar-btn",
|
|
@@ -1237,7 +1265,7 @@ class je {
|
|
|
1237
1265
|
const h = this.state.get("zoom");
|
|
1238
1266
|
this.editor.setZoom(h + 0.25);
|
|
1239
1267
|
}
|
|
1240
|
-
}), o =
|
|
1268
|
+
}), o = w({
|
|
1241
1269
|
icon: ze,
|
|
1242
1270
|
title: "Fit to Screen",
|
|
1243
1271
|
className: "toolbar-btn",
|
|
@@ -1246,15 +1274,15 @@ class je {
|
|
|
1246
1274
|
onClick: () => this.editor.fitToScreen()
|
|
1247
1275
|
});
|
|
1248
1276
|
i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
|
|
1249
|
-
const n =
|
|
1250
|
-
this._themeBtn =
|
|
1277
|
+
const n = u("div", { className: "toolbar-section toolbar-right" });
|
|
1278
|
+
this._themeBtn = w({
|
|
1251
1279
|
icon: this.state.get("isDarkMode") ? Q : J,
|
|
1252
1280
|
title: "Toggle Theme",
|
|
1253
1281
|
className: "toolbar-btn toolbar-btn-theme",
|
|
1254
1282
|
testId: "btn-toggle-theme",
|
|
1255
1283
|
ariaLabel: "Toggle theme",
|
|
1256
1284
|
onClick: () => this.editor.toggleTheme()
|
|
1257
|
-
}), this._cropBtn =
|
|
1285
|
+
}), this._cropBtn = w({
|
|
1258
1286
|
icon: ue,
|
|
1259
1287
|
title: "Crop",
|
|
1260
1288
|
className: "toolbar-btn toolbar-btn-crop",
|
|
@@ -1264,21 +1292,21 @@ class je {
|
|
|
1264
1292
|
this.state.get("mode") === "crop" ? this.editor.setMode("filters") : this.editor.setMode("crop");
|
|
1265
1293
|
}
|
|
1266
1294
|
});
|
|
1267
|
-
const l =
|
|
1295
|
+
const l = w({
|
|
1268
1296
|
icon: pe,
|
|
1269
1297
|
title: "Reset All",
|
|
1270
1298
|
className: "toolbar-btn",
|
|
1271
1299
|
testId: "btn-reset-all",
|
|
1272
1300
|
ariaLabel: "Reset all changes",
|
|
1273
1301
|
onClick: () => this.editor.resetAll()
|
|
1274
|
-
}), c =
|
|
1302
|
+
}), c = w({
|
|
1275
1303
|
icon: Ye,
|
|
1276
1304
|
title: "Save Image",
|
|
1277
1305
|
className: "toolbar-btn toolbar-btn-primary",
|
|
1278
1306
|
testId: "btn-save-edit",
|
|
1279
1307
|
ariaLabel: "Save image",
|
|
1280
1308
|
onClick: () => this.editor.save()
|
|
1281
|
-
}),
|
|
1309
|
+
}), d = w({
|
|
1282
1310
|
icon: K,
|
|
1283
1311
|
title: "Close",
|
|
1284
1312
|
className: "toolbar-btn",
|
|
@@ -1286,7 +1314,7 @@ class je {
|
|
|
1286
1314
|
ariaLabel: "Close editor",
|
|
1287
1315
|
onClick: () => this.editor.close()
|
|
1288
1316
|
});
|
|
1289
|
-
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(
|
|
1317
|
+
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(d), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
|
|
1290
1318
|
}
|
|
1291
1319
|
/**
|
|
1292
1320
|
* Subscribe to state changes
|
|
@@ -1347,15 +1375,15 @@ class qe {
|
|
|
1347
1375
|
* @returns {HTMLElement}
|
|
1348
1376
|
*/
|
|
1349
1377
|
render(e) {
|
|
1350
|
-
this._onSelect = e, this.element =
|
|
1378
|
+
this._onSelect = e, this.element = u("div", {
|
|
1351
1379
|
className: "category-carousel-container",
|
|
1352
1380
|
"data-testid": "category-carousel"
|
|
1353
|
-
}), this._leftBtn =
|
|
1381
|
+
}), this._leftBtn = w({
|
|
1354
1382
|
icon: he,
|
|
1355
1383
|
title: "Previous categories",
|
|
1356
1384
|
className: "carousel-nav carousel-nav-left",
|
|
1357
1385
|
onClick: () => this._scrollLeft()
|
|
1358
|
-
}), this._carousel =
|
|
1386
|
+
}), this._carousel = u("div", { className: "category-carousel" }), L.forEach((i) => {
|
|
1359
1387
|
const r = Z({
|
|
1360
1388
|
label: i.name,
|
|
1361
1389
|
icon: i.icon,
|
|
@@ -1363,19 +1391,19 @@ class qe {
|
|
|
1363
1391
|
onClick: () => this._selectCategory(i.id)
|
|
1364
1392
|
});
|
|
1365
1393
|
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);
|
|
1366
|
-
}), this._rightBtn =
|
|
1394
|
+
}), this._rightBtn = w({
|
|
1367
1395
|
icon: de,
|
|
1368
1396
|
title: "Next categories",
|
|
1369
1397
|
className: "carousel-nav carousel-nav-right",
|
|
1370
1398
|
onClick: () => this._scrollRight()
|
|
1371
|
-
}), this._pagination =
|
|
1399
|
+
}), this._pagination = u("div", {
|
|
1372
1400
|
className: "carousel-pagination",
|
|
1373
1401
|
role: "tablist",
|
|
1374
1402
|
"aria-label": "Category pages"
|
|
1375
1403
|
});
|
|
1376
1404
|
const t = Math.ceil(L.length / 3);
|
|
1377
1405
|
for (let i = 0; i < t; i++) {
|
|
1378
|
-
const r =
|
|
1406
|
+
const r = u("button", {
|
|
1379
1407
|
type: "button",
|
|
1380
1408
|
className: `pagination-dot ${i === 0 ? "active" : ""}`,
|
|
1381
1409
|
role: "tab",
|
|
@@ -1482,12 +1510,12 @@ class He {
|
|
|
1482
1510
|
* @returns {HTMLElement}
|
|
1483
1511
|
*/
|
|
1484
1512
|
render({ onToggle: e, onSelect: t }) {
|
|
1485
|
-
return this._onToggle = e, this._onSelect = t, this.element =
|
|
1513
|
+
return this._onToggle = e, this._onSelect = t, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn = w({
|
|
1486
1514
|
icon: he,
|
|
1487
1515
|
title: "Previous filters",
|
|
1488
1516
|
className: "carousel-nav carousel-nav-left",
|
|
1489
1517
|
onClick: () => this._scrollLeft()
|
|
1490
|
-
}), this._carousel =
|
|
1518
|
+
}), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn = w({
|
|
1491
1519
|
icon: de,
|
|
1492
1520
|
title: "Next filters",
|
|
1493
1521
|
className: "carousel-nav carousel-nav-right",
|
|
@@ -1534,14 +1562,14 @@ class He {
|
|
|
1534
1562
|
* @returns {HTMLElement}
|
|
1535
1563
|
*/
|
|
1536
1564
|
_createFilterCard(e, { isActive: t, isSelected: i }) {
|
|
1537
|
-
const r =
|
|
1565
|
+
const r = u("div", {
|
|
1538
1566
|
className: `filter-card ${t ? "active" : ""} ${i ? "selected" : ""}`,
|
|
1539
1567
|
"data-filter": e.id,
|
|
1540
1568
|
"data-testid": `filter-${e.id}`,
|
|
1541
1569
|
onClick: () => this._handleCardClick(e.id)
|
|
1542
|
-
}), a =
|
|
1570
|
+
}), a = u("div", { className: "filter-preview" }), o = u("span", { className: "filter-preview-text" }, e.name.charAt(0));
|
|
1543
1571
|
a.appendChild(o);
|
|
1544
|
-
const n =
|
|
1572
|
+
const n = u("span", { className: "filter-name", title: e.name }, e.name), l = u("button", {
|
|
1545
1573
|
className: `filter-toggle ${t ? "active" : ""}`,
|
|
1546
1574
|
onClick: (c) => {
|
|
1547
1575
|
var p;
|
|
@@ -1639,7 +1667,7 @@ class $e {
|
|
|
1639
1667
|
* @returns {HTMLElement}
|
|
1640
1668
|
*/
|
|
1641
1669
|
render({ onChange: e, onReset: t, onAction: i }) {
|
|
1642
|
-
return this._onChange = e, this._onReset = t, this._onAction = i, this.element =
|
|
1670
|
+
return this._onChange = e, this._onReset = t, this._onAction = i, this.element = u("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
|
|
1643
1671
|
}
|
|
1644
1672
|
/**
|
|
1645
1673
|
* Subscribe to state changes
|
|
@@ -1662,24 +1690,24 @@ class $e {
|
|
|
1662
1690
|
const e = this.state.get("selectedFilter");
|
|
1663
1691
|
if (!e) {
|
|
1664
1692
|
this.element.appendChild(
|
|
1665
|
-
|
|
1693
|
+
u("div", { className: "no-filter-selected" }, "Select a filter to adjust")
|
|
1666
1694
|
);
|
|
1667
1695
|
return;
|
|
1668
1696
|
}
|
|
1669
1697
|
const t = this.filterManager.getFilterDef(e);
|
|
1670
1698
|
if (!t) {
|
|
1671
1699
|
this.element.appendChild(
|
|
1672
|
-
|
|
1700
|
+
u("div", { className: "no-filter-selected" }, "Filter not found")
|
|
1673
1701
|
);
|
|
1674
1702
|
return;
|
|
1675
1703
|
}
|
|
1676
|
-
const i =
|
|
1677
|
-
i.appendChild(
|
|
1704
|
+
const i = u("div", { className: "adjustments-header" });
|
|
1705
|
+
i.appendChild(u("span", { className: "adjustments-title" }, t.name)), i.appendChild(z({
|
|
1678
1706
|
label: "Reset",
|
|
1679
1707
|
className: "btn-text",
|
|
1680
1708
|
onClick: () => this._handleReset(e)
|
|
1681
1709
|
})), this.element.appendChild(i);
|
|
1682
|
-
const r =
|
|
1710
|
+
const r = u("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
|
|
1683
1711
|
t.controls.forEach((o) => {
|
|
1684
1712
|
const n = this._createControl(e, o, a[o.id] ?? o.default);
|
|
1685
1713
|
n && (this._controls.set(o.id, n), r.appendChild(n));
|
|
@@ -1730,8 +1758,8 @@ class $e {
|
|
|
1730
1758
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1731
1759
|
});
|
|
1732
1760
|
case "button":
|
|
1733
|
-
const n =
|
|
1734
|
-
return n.appendChild(
|
|
1761
|
+
const n = u("div", { className: "button-control" });
|
|
1762
|
+
return n.appendChild(z({
|
|
1735
1763
|
label: r,
|
|
1736
1764
|
className: "btn-secondary",
|
|
1737
1765
|
onClick: () => this._handleAction(e, t.action || t.id)
|
|
@@ -1842,31 +1870,31 @@ class We {
|
|
|
1842
1870
|
* @param {Object} callbacks - { onChange, onReset, onRemove, onAction }
|
|
1843
1871
|
*/
|
|
1844
1872
|
build(e, { onChange: t, onReset: i, onRemove: r, onAction: a }) {
|
|
1845
|
-
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer =
|
|
1846
|
-
const o =
|
|
1847
|
-
this._titleEl =
|
|
1848
|
-
const n =
|
|
1873
|
+
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = u("div", { className: "mobile-filter-drawer" });
|
|
1874
|
+
const o = u("div", { className: "drawer-header" });
|
|
1875
|
+
this._titleEl = u("span", { className: "drawer-title" }, "Filter");
|
|
1876
|
+
const n = u("div", { className: "drawer-header-actions" }), l = z({
|
|
1849
1877
|
label: "Reset",
|
|
1850
1878
|
className: "btn-text",
|
|
1851
1879
|
onClick: () => {
|
|
1852
1880
|
var h;
|
|
1853
1881
|
this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
|
|
1854
1882
|
}
|
|
1855
|
-
}), c =
|
|
1883
|
+
}), c = z({
|
|
1856
1884
|
label: "Remove",
|
|
1857
1885
|
className: "btn-text btn-danger",
|
|
1858
1886
|
onClick: () => {
|
|
1859
1887
|
var h;
|
|
1860
1888
|
this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
|
|
1861
1889
|
}
|
|
1862
|
-
}),
|
|
1890
|
+
}), d = w({
|
|
1863
1891
|
icon: K,
|
|
1864
1892
|
title: "Close",
|
|
1865
1893
|
className: "btn-icon-sm",
|
|
1866
1894
|
ariaLabel: "Close drawer",
|
|
1867
1895
|
onClick: () => this.close()
|
|
1868
1896
|
});
|
|
1869
|
-
n.appendChild(l), n.appendChild(c), n.appendChild(
|
|
1897
|
+
n.appendChild(l), n.appendChild(c), n.appendChild(d), o.appendChild(this._titleEl), o.appendChild(n), this._drawer.appendChild(o), this._body = u("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
|
|
1870
1898
|
}
|
|
1871
1899
|
/**
|
|
1872
1900
|
* Open the drawer for a specific filter
|
|
@@ -1916,7 +1944,7 @@ class We {
|
|
|
1916
1944
|
const e = this.filterManager.getFilterDef(this._currentFilterId);
|
|
1917
1945
|
if (!e) return;
|
|
1918
1946
|
this._titleEl.textContent = e.name;
|
|
1919
|
-
const t =
|
|
1947
|
+
const t = u("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
|
|
1920
1948
|
e.controls.forEach((r) => {
|
|
1921
1949
|
if (r.hidden) return;
|
|
1922
1950
|
const a = this._createControl(this._currentFilterId, r, i[r.id] ?? r.default);
|
|
@@ -1980,8 +2008,8 @@ class We {
|
|
|
1980
2008
|
});
|
|
1981
2009
|
}
|
|
1982
2010
|
case "button": {
|
|
1983
|
-
const o =
|
|
1984
|
-
return o.appendChild(
|
|
2011
|
+
const o = u("div", { className: "button-control" });
|
|
2012
|
+
return o.appendChild(z({
|
|
1985
2013
|
label: r,
|
|
1986
2014
|
className: "btn-secondary",
|
|
1987
2015
|
onClick: () => {
|
|
@@ -2037,10 +2065,10 @@ class Ze {
|
|
|
2037
2065
|
* @returns {HTMLElement}
|
|
2038
2066
|
*/
|
|
2039
2067
|
render({ onToggle: e, onSelect: t }) {
|
|
2040
|
-
return this._onToggle = e, this._onSelect = t, this.element =
|
|
2068
|
+
return this._onToggle = e, this._onSelect = t, this.element = u("div", {
|
|
2041
2069
|
className: "mobile-active-filters",
|
|
2042
2070
|
"data-testid": "mobile-active-filters"
|
|
2043
|
-
}), this._scrollContainer =
|
|
2071
|
+
}), this._scrollContainer = u("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
|
|
2044
2072
|
}
|
|
2045
2073
|
_subscribeToState() {
|
|
2046
2074
|
const e = this.state.on("change:activeFilters", () => {
|
|
@@ -2056,7 +2084,7 @@ class Ze {
|
|
|
2056
2084
|
this._scrollContainer.innerHTML = "", this._chips.clear();
|
|
2057
2085
|
const e = this.state.get("activeFilters");
|
|
2058
2086
|
if (!e || e.size === 0) {
|
|
2059
|
-
const t =
|
|
2087
|
+
const t = u("div", {
|
|
2060
2088
|
className: "active-filter-placeholder"
|
|
2061
2089
|
}, "No active filters");
|
|
2062
2090
|
this._scrollContainer.appendChild(t);
|
|
@@ -2070,17 +2098,17 @@ class Ze {
|
|
|
2070
2098
|
}), this._updateSelectedState();
|
|
2071
2099
|
}
|
|
2072
2100
|
_createChip(e, t) {
|
|
2073
|
-
const i =
|
|
2101
|
+
const i = u("div", {
|
|
2074
2102
|
className: "active-filter-chip",
|
|
2075
2103
|
"data-filter-id": e,
|
|
2076
2104
|
"data-testid": `active-chip-${e}`
|
|
2077
|
-
}), r =
|
|
2105
|
+
}), r = u("span", {
|
|
2078
2106
|
className: "active-filter-chip-label",
|
|
2079
2107
|
onClick: (o) => {
|
|
2080
2108
|
var n;
|
|
2081
2109
|
o.stopPropagation(), (n = this._onSelect) == null || n.call(this, e);
|
|
2082
2110
|
}
|
|
2083
|
-
}, t.name), a =
|
|
2111
|
+
}, t.name), a = u("button", {
|
|
2084
2112
|
className: "active-filter-chip-check",
|
|
2085
2113
|
"aria-label": `Remove ${t.name} filter`,
|
|
2086
2114
|
onClick: (o) => {
|
|
@@ -2130,39 +2158,39 @@ class Qe {
|
|
|
2130
2158
|
* @returns {HTMLElement}
|
|
2131
2159
|
*/
|
|
2132
2160
|
render() {
|
|
2133
|
-
this.element =
|
|
2161
|
+
this.element = u("div", {
|
|
2134
2162
|
className: "crop-controls",
|
|
2135
2163
|
"data-testid": "crop-controls"
|
|
2136
2164
|
});
|
|
2137
|
-
const e =
|
|
2138
|
-
e.appendChild(
|
|
2139
|
-
const t =
|
|
2165
|
+
const e = u("div", { className: "crop-section" });
|
|
2166
|
+
e.appendChild(u("label", { className: "section-label" }, "Shape"));
|
|
2167
|
+
const t = u("div", { className: "chip-row" }), i = this.state.get("crop.shape");
|
|
2140
2168
|
Ge.forEach((c) => {
|
|
2141
|
-
const
|
|
2169
|
+
const d = Z({
|
|
2142
2170
|
label: c.name,
|
|
2143
2171
|
icon: c.icon,
|
|
2144
2172
|
active: i === c.id,
|
|
2145
2173
|
onClick: () => this._selectShape(c.id)
|
|
2146
2174
|
});
|
|
2147
|
-
|
|
2148
|
-
}), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection =
|
|
2149
|
-
const r =
|
|
2175
|
+
d.dataset.shape = c.id, d.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, d), t.appendChild(d);
|
|
2176
|
+
}), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = u("div", { className: "crop-section" }), this._aspectSection.appendChild(u("label", { className: "section-label" }, "Aspect Ratio"));
|
|
2177
|
+
const r = u("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
|
|
2150
2178
|
Ke.forEach((c) => {
|
|
2151
|
-
const
|
|
2179
|
+
const d = Z({
|
|
2152
2180
|
label: c.name,
|
|
2153
2181
|
active: a === c.id,
|
|
2154
2182
|
onClick: () => this._selectAspect(c.id)
|
|
2155
2183
|
});
|
|
2156
|
-
|
|
2184
|
+
d.dataset.ratio = c.id, d.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, d), r.appendChild(d);
|
|
2157
2185
|
}), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
|
|
2158
|
-
const o =
|
|
2186
|
+
const o = u("div", { className: "crop-actions" }), n = z({
|
|
2159
2187
|
label: "Cancel",
|
|
2160
2188
|
className: "btn-secondary crop-cancel-btn",
|
|
2161
2189
|
icon: K,
|
|
2162
2190
|
onClick: () => this.cropManager.cancel()
|
|
2163
2191
|
});
|
|
2164
2192
|
n.dataset.testid = "cancel-crop";
|
|
2165
|
-
const l =
|
|
2193
|
+
const l = z({
|
|
2166
2194
|
label: "Apply Crop",
|
|
2167
2195
|
className: "btn-primary crop-apply-btn",
|
|
2168
2196
|
icon: G,
|
|
@@ -2238,18 +2266,18 @@ class Je {
|
|
|
2238
2266
|
* @returns {HTMLElement}
|
|
2239
2267
|
*/
|
|
2240
2268
|
render({ onRemove: e, onReset: t, onClearAll: i, onUpdateValue: r, onSelect: a }) {
|
|
2241
|
-
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element =
|
|
2269
|
+
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = u("div", {
|
|
2242
2270
|
className: "active-filters-panel",
|
|
2243
2271
|
"data-testid": "active-filters-panel"
|
|
2244
2272
|
});
|
|
2245
|
-
const o =
|
|
2246
|
-
o.appendChild(
|
|
2247
|
-
const n =
|
|
2273
|
+
const o = u("div", { className: "panel-header" });
|
|
2274
|
+
o.appendChild(u("h3", { className: "panel-title" }, "Active Filters"));
|
|
2275
|
+
const n = z({
|
|
2248
2276
|
label: "Clear All",
|
|
2249
2277
|
className: "btn-text btn-danger",
|
|
2250
2278
|
onClick: () => this._handleClearAll()
|
|
2251
2279
|
});
|
|
2252
|
-
return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer =
|
|
2280
|
+
return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer = u("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
|
|
2253
2281
|
}
|
|
2254
2282
|
/**
|
|
2255
2283
|
* Subscribe to state changes
|
|
@@ -2285,7 +2313,7 @@ class Je {
|
|
|
2285
2313
|
const e = this.state.get("activeFilters");
|
|
2286
2314
|
if (e.size === 0) {
|
|
2287
2315
|
this._listContainer.appendChild(
|
|
2288
|
-
|
|
2316
|
+
u("div", { className: "no-filters-message" }, "No filters active")
|
|
2289
2317
|
);
|
|
2290
2318
|
return;
|
|
2291
2319
|
}
|
|
@@ -2303,26 +2331,26 @@ class Je {
|
|
|
2303
2331
|
* @returns {HTMLElement}
|
|
2304
2332
|
*/
|
|
2305
2333
|
_createFilterItem(e, t) {
|
|
2306
|
-
const r = this.state.get("selectedFilter") === e, a =
|
|
2334
|
+
const r = this.state.get("selectedFilter") === e, a = u("div", {
|
|
2307
2335
|
className: `active-filter-item ${r ? "selected" : ""}`,
|
|
2308
2336
|
"data-active-filter": e,
|
|
2309
2337
|
"data-testid": `active-filter-${e}`,
|
|
2310
2338
|
onClick: (m) => {
|
|
2311
2339
|
m.target.closest(".filter-item-actions") || this._handleSelect(e);
|
|
2312
2340
|
}
|
|
2313
|
-
}), o =
|
|
2341
|
+
}), o = u("div", { className: "filter-item-header" }), n = u("span", { className: "filter-item-name" }, t.name), l = u("div", { className: "filter-item-actions" }), c = w({
|
|
2314
2342
|
icon: pe,
|
|
2315
2343
|
title: "Reset filter",
|
|
2316
2344
|
className: "btn-icon-sm",
|
|
2317
2345
|
onClick: () => this._handleReset(e)
|
|
2318
|
-
}),
|
|
2346
|
+
}), d = w({
|
|
2319
2347
|
icon: Be,
|
|
2320
2348
|
title: "Remove filter",
|
|
2321
2349
|
className: "btn-icon-sm btn-danger",
|
|
2322
2350
|
onClick: () => this._handleRemove(e)
|
|
2323
2351
|
});
|
|
2324
|
-
l.appendChild(c), l.appendChild(
|
|
2325
|
-
const h = this.state.getFilterValues(e), p =
|
|
2352
|
+
l.appendChild(c), l.appendChild(d), o.appendChild(n), o.appendChild(l), a.appendChild(o);
|
|
2353
|
+
const h = this.state.getFilterValues(e), p = u("div", { className: "filter-item-summary" });
|
|
2326
2354
|
return p.textContent = this._getValuesSummary(t, h), a.appendChild(p), a._summaryEl = p, a;
|
|
2327
2355
|
}
|
|
2328
2356
|
/**
|
|
@@ -2531,13 +2559,13 @@ class ei extends B {
|
|
|
2531
2559
|
* Build DOM structure
|
|
2532
2560
|
*/
|
|
2533
2561
|
_buildDOM() {
|
|
2534
|
-
this._container.innerHTML = "", this._editorEl =
|
|
2562
|
+
this._container.innerHTML = "", this._editorEl = u("div", {
|
|
2535
2563
|
className: `vanilla-image-editor ${this._state.get("isDarkMode") ? "dark" : "light"}`
|
|
2536
2564
|
});
|
|
2537
|
-
const e =
|
|
2565
|
+
const e = u("div", { className: "editor-toolbar-container" });
|
|
2538
2566
|
this._editorEl.appendChild(e), this._toolbarContainer = e;
|
|
2539
|
-
const t =
|
|
2540
|
-
this._canvasContainer =
|
|
2567
|
+
const t = u("div", { className: "editor-content" }), i = u("div", { className: "canvas-section" });
|
|
2568
|
+
this._canvasContainer = u("div", { className: "canvas-container" }), this._cropOverlay = u("canvas", { className: "crop-overlay", "aria-hidden": "true" }), i.appendChild(this._canvasContainer), i.appendChild(this._cropOverlay), t.appendChild(i), this._controlsSection = u("div", { className: "controls-section" }), t.appendChild(this._controlsSection), this._editorEl.appendChild(t), this._fileInput = u("input", {
|
|
2541
2569
|
type: "file",
|
|
2542
2570
|
accept: "image/*",
|
|
2543
2571
|
className: "hidden-file-input",
|
|
@@ -2549,9 +2577,9 @@ class ei extends B {
|
|
|
2549
2577
|
* Initialize UI components
|
|
2550
2578
|
*/
|
|
2551
2579
|
_initUI() {
|
|
2552
|
-
this._toolbar = new je(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl =
|
|
2580
|
+
this._toolbar = new je(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = u("div", { className: "filter-controls-container" }), this._categoryCarousel = new qe(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
|
|
2553
2581
|
}));
|
|
2554
|
-
const e =
|
|
2582
|
+
const e = u("div", { className: "filter-layout" }), t = u("div", { className: "filter-left-column" });
|
|
2555
2583
|
this._filterCarousel = new He(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
|
|
2556
2584
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2557
2585
|
onSelect: (r) => {
|
|
@@ -2562,7 +2590,7 @@ class ei extends B {
|
|
|
2562
2590
|
onReset: (r) => this._handleFilterReset(r),
|
|
2563
2591
|
onAction: (r, a) => this._handleFilterAction(r, a)
|
|
2564
2592
|
})), e.appendChild(t);
|
|
2565
|
-
const i =
|
|
2593
|
+
const i = u("div", { className: "filter-right-column" });
|
|
2566
2594
|
this._activeFiltersPanel = new Je(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
|
|
2567
2595
|
onRemove: (r) => this._handleFilterToggle(r, !1),
|
|
2568
2596
|
onReset: (r) => this._handleFilterReset(r),
|
|
@@ -2696,7 +2724,15 @@ class ei extends B {
|
|
|
2696
2724
|
if (this._destroyed) return;
|
|
2697
2725
|
const i = ++this._loadVersion;
|
|
2698
2726
|
let r = e;
|
|
2699
|
-
this._resetEditorState(), e instanceof Blob && (r = URL.createObjectURL(e), this._objectUrls.add(r))
|
|
2727
|
+
this._resetEditorState(), e instanceof Blob && (r = URL.createObjectURL(e), this._objectUrls.add(r));
|
|
2728
|
+
const a = await this._renderer.loadTexture(r);
|
|
2729
|
+
if (!(this._destroyed || this._loadVersion !== i)) {
|
|
2730
|
+
if (!a) {
|
|
2731
|
+
this.emit("error", new Error("Failed to load image"));
|
|
2732
|
+
return;
|
|
2733
|
+
}
|
|
2734
|
+
this._state.set("hasImage", !0), this._state.set("imageUrl", r), t.state && this._hydrateState(t.state), this._options.initialMode === "crop" && this.setMode("crop"), this.emit("imageLoaded", { url: r });
|
|
2735
|
+
}
|
|
2700
2736
|
}
|
|
2701
2737
|
/**
|
|
2702
2738
|
* Reset all editor state (filters + crop) to a clean baseline.
|
|
@@ -2711,12 +2747,18 @@ class ei extends B {
|
|
|
2711
2747
|
* @param {Object} state - ImageEditorSessionState
|
|
2712
2748
|
*/
|
|
2713
2749
|
_hydrateState(e) {
|
|
2714
|
-
if (!(!e || e.version !== 1)
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2750
|
+
if (!(!e || e.version !== 1)) {
|
|
2751
|
+
if (e.crop) {
|
|
2752
|
+
const t = e.crop.shape || "free", i = e.crop.aspectRatio || "free";
|
|
2753
|
+
e.crop.rect && (this._cropManager.applyFromPixelRect(e.crop.rect, t), this._state.set("crop.appliedRect", { ...e.crop.rect }), this._state.set("crop.appliedShape", t), this._state.set("crop.appliedAspect", i)), this._state.set("crop.shape", t), this._state.set("crop.aspect", i);
|
|
2754
|
+
}
|
|
2755
|
+
if (Array.isArray(e.filters)) {
|
|
2756
|
+
for (const t of e.filters)
|
|
2757
|
+
if (t.enabled && (this._state.toggleFilter(t.id, !0), this._filterManager.initializeValues(t.id), t.values))
|
|
2758
|
+
for (const [i, r] of Object.entries(t.values))
|
|
2759
|
+
this._state.setFilterValue(t.id, i, r);
|
|
2760
|
+
this._filterManager.applyFilters();
|
|
2761
|
+
}
|
|
2720
2762
|
}
|
|
2721
2763
|
}
|
|
2722
2764
|
/**
|
|
@@ -2884,9 +2926,9 @@ class ei extends B {
|
|
|
2884
2926
|
_showLoadingOverlay(e) {
|
|
2885
2927
|
var i;
|
|
2886
2928
|
if (!this._loadingOverlay)
|
|
2887
|
-
this._loadingOverlay =
|
|
2888
|
-
|
|
2889
|
-
|
|
2929
|
+
this._loadingOverlay = u("div", { className: "editor-loading-overlay" }, [
|
|
2930
|
+
u("div", { className: "editor-loading-spinner" }),
|
|
2931
|
+
u("div", { className: "editor-loading-text" }, e)
|
|
2890
2932
|
]);
|
|
2891
2933
|
else {
|
|
2892
2934
|
const r = this._loadingOverlay.querySelector(".editor-loading-text");
|
|
@@ -2906,36 +2948,36 @@ class ei extends B {
|
|
|
2906
2948
|
* Destroy the editor and clean up
|
|
2907
2949
|
*/
|
|
2908
2950
|
destroy() {
|
|
2909
|
-
var e, t, i, r, a, o, n, l, c,
|
|
2951
|
+
var e, t, i, r, a, o, n, l, c, d;
|
|
2910
2952
|
this._destroyed = !0;
|
|
2911
2953
|
for (const h of this._objectUrls)
|
|
2912
2954
|
try {
|
|
2913
2955
|
URL.revokeObjectURL(h);
|
|
2914
2956
|
} catch {
|
|
2915
2957
|
}
|
|
2916
|
-
this._objectUrls.clear(), (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (
|
|
2958
|
+
this._objectUrls.clear(), (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (d = this._editorEl) == null || d.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
|
|
2917
2959
|
}
|
|
2918
2960
|
}
|
|
2919
|
-
const
|
|
2961
|
+
const k = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
2920
2962
|
function tt(s, e) {
|
|
2921
2963
|
return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
|
|
2922
2964
|
}
|
|
2923
2965
|
function f(s) {
|
|
2924
2966
|
var e;
|
|
2925
|
-
return
|
|
2967
|
+
return k.has(s.id), k.set(s.id, s), I.has(s.category) || I.set(s.category, []), (e = I.get(s.category)) == null || e.push(s.id), s;
|
|
2926
2968
|
}
|
|
2927
2969
|
function it(s) {
|
|
2928
|
-
return
|
|
2970
|
+
return k.get(s);
|
|
2929
2971
|
}
|
|
2930
2972
|
function U() {
|
|
2931
|
-
return Array.from(
|
|
2973
|
+
return Array.from(k.values());
|
|
2932
2974
|
}
|
|
2933
2975
|
function rt() {
|
|
2934
|
-
U().map((t) => t.id), Object.entries(
|
|
2976
|
+
U().map((t) => t.id), Object.entries(b).filter(
|
|
2935
2977
|
(t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
|
|
2936
2978
|
).forEach(([t, i]) => {
|
|
2937
2979
|
const r = t.replace(/Filter$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2938
|
-
|
|
2980
|
+
k.has(r) || f({
|
|
2939
2981
|
id: r,
|
|
2940
2982
|
name: t.replace(/Filter$/, ""),
|
|
2941
2983
|
category: "unlisted",
|
|
@@ -2955,19 +2997,19 @@ function rt() {
|
|
|
2955
2997
|
});
|
|
2956
2998
|
}
|
|
2957
2999
|
function st(s) {
|
|
2958
|
-
return (I.get(s) || []).map((t) =>
|
|
3000
|
+
return (I.get(s) || []).map((t) => k.get(t)).filter(Boolean);
|
|
2959
3001
|
}
|
|
2960
3002
|
function at() {
|
|
2961
3003
|
return Array.from(I.keys());
|
|
2962
3004
|
}
|
|
2963
3005
|
function ti(s) {
|
|
2964
|
-
return
|
|
3006
|
+
return k.has(s);
|
|
2965
3007
|
}
|
|
2966
3008
|
function ot(s) {
|
|
2967
|
-
const e =
|
|
3009
|
+
const e = k.get(s);
|
|
2968
3010
|
if (!e)
|
|
2969
3011
|
return !1;
|
|
2970
|
-
|
|
3012
|
+
k.delete(s);
|
|
2971
3013
|
const t = I.get(e.category);
|
|
2972
3014
|
if (t) {
|
|
2973
3015
|
const i = t.indexOf(s);
|
|
@@ -2976,11 +3018,11 @@ function ot(s) {
|
|
|
2976
3018
|
return !0;
|
|
2977
3019
|
}
|
|
2978
3020
|
function ii(s, e) {
|
|
2979
|
-
const t =
|
|
3021
|
+
const t = k.get(s);
|
|
2980
3022
|
return t ? tt(t, e) : !1;
|
|
2981
3023
|
}
|
|
2982
3024
|
function nt() {
|
|
2983
|
-
return Array.from(
|
|
3025
|
+
return Array.from(k.values()).map((s) => ({
|
|
2984
3026
|
id: s.id,
|
|
2985
3027
|
name: s.name,
|
|
2986
3028
|
category: s.category,
|
|
@@ -2988,17 +3030,17 @@ function nt() {
|
|
|
2988
3030
|
}));
|
|
2989
3031
|
}
|
|
2990
3032
|
if (typeof window < "u") {
|
|
2991
|
-
window.__DEBUG_FILTERS_LIST = Array.from(
|
|
3033
|
+
window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), window.getAllFilters = U, window.getFilter = it, window.getFiltersByCategory = st, window.getRegisteredFilters = nt;
|
|
2992
3034
|
const s = f;
|
|
2993
3035
|
window.registerFilter = (e) => {
|
|
2994
3036
|
const t = s(e);
|
|
2995
|
-
return window.__DEBUG_FILTERS_LIST = Array.from(
|
|
3037
|
+
return window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), t;
|
|
2996
3038
|
};
|
|
2997
3039
|
}
|
|
2998
3040
|
typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
|
|
2999
3041
|
return [];
|
|
3000
3042
|
});
|
|
3001
|
-
const { AdjustmentFilter: lt } =
|
|
3043
|
+
const { AdjustmentFilter: lt } = b, { ColorMatrixFilter: ct } = S, M = {
|
|
3002
3044
|
gamma: 1,
|
|
3003
3045
|
saturation: 1,
|
|
3004
3046
|
contrast: 1,
|
|
@@ -3017,7 +3059,7 @@ const { AdjustmentFilter: lt } = g, { ColorMatrixFilter: ct } = w, k = {
|
|
|
3017
3059
|
"blue",
|
|
3018
3060
|
"alpha"
|
|
3019
3061
|
]);
|
|
3020
|
-
function
|
|
3062
|
+
function F(s, e) {
|
|
3021
3063
|
if (typeof s == "number" && Number.isFinite(s))
|
|
3022
3064
|
return s;
|
|
3023
3065
|
if (typeof s == "string") {
|
|
@@ -3032,14 +3074,14 @@ function ee(s) {
|
|
|
3032
3074
|
}
|
|
3033
3075
|
function dt(s) {
|
|
3034
3076
|
return {
|
|
3035
|
-
gamma:
|
|
3036
|
-
saturation:
|
|
3037
|
-
contrast:
|
|
3038
|
-
brightness:
|
|
3039
|
-
red:
|
|
3040
|
-
green:
|
|
3041
|
-
blue:
|
|
3042
|
-
alpha:
|
|
3077
|
+
gamma: F(s.gamma, M.gamma),
|
|
3078
|
+
saturation: F(s.saturation, M.saturation),
|
|
3079
|
+
contrast: F(s.contrast, M.contrast),
|
|
3080
|
+
brightness: F(s.brightness, M.brightness),
|
|
3081
|
+
red: F(s.red, M.red),
|
|
3082
|
+
green: F(s.green, M.green),
|
|
3083
|
+
blue: F(s.blue, M.blue),
|
|
3084
|
+
alpha: F(s.alpha, M.alpha)
|
|
3043
3085
|
};
|
|
3044
3086
|
}
|
|
3045
3087
|
function te(s, e) {
|
|
@@ -3060,10 +3102,10 @@ f({
|
|
|
3060
3102
|
try {
|
|
3061
3103
|
if (!ee(o))
|
|
3062
3104
|
return;
|
|
3063
|
-
const l = this._customParams ?? { ...
|
|
3105
|
+
const l = this._customParams ?? { ...M }, c = F(n, l[o]);
|
|
3064
3106
|
l[o] = c, this._customParams = l;
|
|
3065
|
-
const
|
|
3066
|
-
o in
|
|
3107
|
+
const d = this;
|
|
3108
|
+
o in d && (d[o] = c);
|
|
3067
3109
|
} catch {
|
|
3068
3110
|
}
|
|
3069
3111
|
}, i;
|
|
@@ -3073,8 +3115,8 @@ f({
|
|
|
3073
3115
|
try {
|
|
3074
3116
|
if (!ee(n))
|
|
3075
3117
|
return;
|
|
3076
|
-
const c = this._customParams ?? { ...
|
|
3077
|
-
c[n] =
|
|
3118
|
+
const c = this._customParams ?? { ...M }, d = F(l, c[n]);
|
|
3119
|
+
c[n] = d, this._customParams = c, te(this, c);
|
|
3078
3120
|
} catch {
|
|
3079
3121
|
}
|
|
3080
3122
|
}, r;
|
|
@@ -3178,7 +3220,7 @@ f({
|
|
|
3178
3220
|
}
|
|
3179
3221
|
]
|
|
3180
3222
|
});
|
|
3181
|
-
const { ColorMatrixFilter: ut } =
|
|
3223
|
+
const { ColorMatrixFilter: ut } = S, N = {
|
|
3182
3224
|
brightness: 1,
|
|
3183
3225
|
contrast: 1,
|
|
3184
3226
|
saturation: 1,
|
|
@@ -3336,7 +3378,7 @@ f({
|
|
|
3336
3378
|
// Create an instance of the ColorMatrixFilter with alpha adjustment
|
|
3337
3379
|
createFilter: (s) => {
|
|
3338
3380
|
try {
|
|
3339
|
-
const e = s.alpha !== void 0 ? s.alpha : 1, t = new
|
|
3381
|
+
const e = s.alpha !== void 0 ? s.alpha : 1, t = new S.ColorMatrixFilter();
|
|
3340
3382
|
return t.alpha = e, t._customParams = {
|
|
3341
3383
|
alpha: e
|
|
3342
3384
|
}, t.updateUIParam = function(i, r) {
|
|
@@ -3383,7 +3425,7 @@ f({
|
|
|
3383
3425
|
*/
|
|
3384
3426
|
createFilter: (s) => {
|
|
3385
3427
|
try {
|
|
3386
|
-
const e = new
|
|
3428
|
+
const e = new S.BlurFilter({
|
|
3387
3429
|
strength: s.blur || 8,
|
|
3388
3430
|
quality: s.quality || 4
|
|
3389
3431
|
});
|
|
@@ -3442,7 +3484,7 @@ f({
|
|
|
3442
3484
|
description: "Advanced color adjustments including sepia, hue rotation, and more",
|
|
3443
3485
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
3444
3486
|
createFilter: (s) => {
|
|
3445
|
-
const e =
|
|
3487
|
+
const e = S.ColorMatrixFilter;
|
|
3446
3488
|
if (!e)
|
|
3447
3489
|
return null;
|
|
3448
3490
|
const t = new e();
|
|
@@ -3522,7 +3564,7 @@ f({
|
|
|
3522
3564
|
}
|
|
3523
3565
|
]
|
|
3524
3566
|
});
|
|
3525
|
-
const { ColorOverlayFilter: gt } =
|
|
3567
|
+
const { ColorOverlayFilter: gt } = b;
|
|
3526
3568
|
f({
|
|
3527
3569
|
id: "colorOverlay",
|
|
3528
3570
|
name: "Color Overlay",
|
|
@@ -3601,7 +3643,7 @@ f({
|
|
|
3601
3643
|
const e = s.color ? s.color.replace("#", "0x") : "0x000000", t = s.distance !== void 0 ? s.distance : 5, i = s.angle !== void 0 ? s.angle : 90, r = {
|
|
3602
3644
|
x: t * Math.cos(i * Math.PI / 180),
|
|
3603
3645
|
y: t * Math.sin(i * Math.PI / 180)
|
|
3604
|
-
}, a = new
|
|
3646
|
+
}, a = new b.DropShadowFilter({
|
|
3605
3647
|
offset: r,
|
|
3606
3648
|
color: parseInt(e, 16),
|
|
3607
3649
|
alpha: s.alpha !== void 0 ? s.alpha : 0.5,
|
|
@@ -3625,8 +3667,8 @@ f({
|
|
|
3625
3667
|
switch (this._customParams = l, l[o] = n, o) {
|
|
3626
3668
|
case "color":
|
|
3627
3669
|
if (typeof n == "string") {
|
|
3628
|
-
const
|
|
3629
|
-
this.color =
|
|
3670
|
+
const d = parseInt(n.replace("#", "0x"), 16);
|
|
3671
|
+
this.color = d;
|
|
3630
3672
|
}
|
|
3631
3673
|
break;
|
|
3632
3674
|
case "alpha":
|
|
@@ -3769,7 +3811,7 @@ f({
|
|
|
3769
3811
|
}
|
|
3770
3812
|
]
|
|
3771
3813
|
});
|
|
3772
|
-
const { ColorMatrixFilter: bt } =
|
|
3814
|
+
const { ColorMatrixFilter: bt } = S;
|
|
3773
3815
|
f({
|
|
3774
3816
|
id: "grayscale",
|
|
3775
3817
|
name: "Grayscale",
|
|
@@ -3822,7 +3864,7 @@ f({
|
|
|
3822
3864
|
function re(s, e) {
|
|
3823
3865
|
s.reset(), s.greyscale(e);
|
|
3824
3866
|
}
|
|
3825
|
-
const { HslAdjustmentFilter: yt } =
|
|
3867
|
+
const { HslAdjustmentFilter: yt } = b;
|
|
3826
3868
|
f({
|
|
3827
3869
|
id: "hsl-adjustment",
|
|
3828
3870
|
name: "HSL Adjustment",
|
|
@@ -3932,7 +3974,7 @@ f({
|
|
|
3932
3974
|
}
|
|
3933
3975
|
]
|
|
3934
3976
|
});
|
|
3935
|
-
const { KawaseBlurFilter: _t } =
|
|
3977
|
+
const { KawaseBlurFilter: _t } = b;
|
|
3936
3978
|
f({
|
|
3937
3979
|
id: "kawase-blur",
|
|
3938
3980
|
name: "Kawase Blur",
|
|
@@ -4050,7 +4092,7 @@ f({
|
|
|
4050
4092
|
}
|
|
4051
4093
|
]
|
|
4052
4094
|
});
|
|
4053
|
-
const { MotionBlurFilter: xt } =
|
|
4095
|
+
const { MotionBlurFilter: xt } = b;
|
|
4054
4096
|
f({
|
|
4055
4097
|
id: "motion-blur",
|
|
4056
4098
|
name: "Motion Blur",
|
|
@@ -4158,7 +4200,7 @@ f({
|
|
|
4158
4200
|
}
|
|
4159
4201
|
]
|
|
4160
4202
|
});
|
|
4161
|
-
const { RadialBlurFilter: Ct } =
|
|
4203
|
+
const { RadialBlurFilter: Ct } = b;
|
|
4162
4204
|
f({
|
|
4163
4205
|
id: "radial-blur",
|
|
4164
4206
|
name: "Radial Blur",
|
|
@@ -4282,7 +4324,7 @@ f({
|
|
|
4282
4324
|
}
|
|
4283
4325
|
]
|
|
4284
4326
|
});
|
|
4285
|
-
const { TiltShiftFilter: wt } =
|
|
4327
|
+
const { TiltShiftFilter: wt } = b;
|
|
4286
4328
|
f({
|
|
4287
4329
|
id: "tilt-shift",
|
|
4288
4330
|
name: "Tilt Shift",
|
|
@@ -4306,28 +4348,28 @@ f({
|
|
|
4306
4348
|
endY: o
|
|
4307
4349
|
}, n.updateUIParam = function(l, c) {
|
|
4308
4350
|
try {
|
|
4309
|
-
const
|
|
4310
|
-
switch (this._customParams = h, h[l] =
|
|
4351
|
+
const d = Number(c), h = this._customParams || {};
|
|
4352
|
+
switch (this._customParams = h, h[l] = d, l) {
|
|
4311
4353
|
case "blur":
|
|
4312
|
-
this.blur =
|
|
4354
|
+
this.blur = d;
|
|
4313
4355
|
break;
|
|
4314
4356
|
case "gradientBlur":
|
|
4315
|
-
this.gradientBlur =
|
|
4357
|
+
this.gradientBlur = d;
|
|
4316
4358
|
break;
|
|
4317
4359
|
case "startX":
|
|
4318
|
-
this.start && typeof this.start == "object" && (this.start.x =
|
|
4360
|
+
this.start && typeof this.start == "object" && (this.start.x = d);
|
|
4319
4361
|
break;
|
|
4320
4362
|
case "startY":
|
|
4321
|
-
this.start && typeof this.start == "object" && (this.start.y =
|
|
4363
|
+
this.start && typeof this.start == "object" && (this.start.y = d);
|
|
4322
4364
|
break;
|
|
4323
4365
|
case "endX":
|
|
4324
|
-
this.end && typeof this.end == "object" && (this.end.x =
|
|
4366
|
+
this.end && typeof this.end == "object" && (this.end.x = d);
|
|
4325
4367
|
break;
|
|
4326
4368
|
case "endY":
|
|
4327
|
-
this.end && typeof this.end == "object" && (this.end.y =
|
|
4369
|
+
this.end && typeof this.end == "object" && (this.end.y = d);
|
|
4328
4370
|
break;
|
|
4329
4371
|
default:
|
|
4330
|
-
l in this && (this[l] =
|
|
4372
|
+
l in this && (this[l] = d);
|
|
4331
4373
|
break;
|
|
4332
4374
|
}
|
|
4333
4375
|
} catch {
|
|
@@ -4410,7 +4452,7 @@ f({
|
|
|
4410
4452
|
}
|
|
4411
4453
|
]
|
|
4412
4454
|
});
|
|
4413
|
-
const { ZoomBlurFilter: St } =
|
|
4455
|
+
const { ZoomBlurFilter: St } = b;
|
|
4414
4456
|
f({
|
|
4415
4457
|
id: "zoom-blur",
|
|
4416
4458
|
name: "Zoom Blur",
|
|
@@ -4537,7 +4579,7 @@ f({
|
|
|
4537
4579
|
}
|
|
4538
4580
|
]
|
|
4539
4581
|
});
|
|
4540
|
-
const { ColorGradientFilter: se } =
|
|
4582
|
+
const { ColorGradientFilter: se } = b;
|
|
4541
4583
|
f({
|
|
4542
4584
|
id: "color-gradient",
|
|
4543
4585
|
name: "Color Gradient",
|
|
@@ -4641,8 +4683,8 @@ f({
|
|
|
4641
4683
|
}));
|
|
4642
4684
|
break;
|
|
4643
4685
|
case "removeColorStop":
|
|
4644
|
-
const
|
|
4645
|
-
|
|
4686
|
+
const d = [...this.stops];
|
|
4687
|
+
d.length > 2 && (d.pop(), this.stops = d, a.colorStops = this.stops.map((h) => ({
|
|
4646
4688
|
offset: h.offset,
|
|
4647
4689
|
color: typeof h.color == "number" ? "#" + h.color.toString(16).padStart(6, "0") : h.color,
|
|
4648
4690
|
alpha: h.alpha
|
|
@@ -4674,9 +4716,9 @@ f({
|
|
|
4674
4716
|
if (/colorStops\[\d+\]\..*/.test(i)) {
|
|
4675
4717
|
const h = i.match(/colorStops\[(\d+)\]\.(.*)/);
|
|
4676
4718
|
if (h) {
|
|
4677
|
-
const [p, m,
|
|
4678
|
-
if (
|
|
4679
|
-
return
|
|
4719
|
+
const [p, m, x] = h, g = parseInt(m), y = [...this.stops];
|
|
4720
|
+
if (g >= 0 && g < y.length)
|
|
4721
|
+
return x === "color" && typeof r == "string" ? y[g].color = parseInt(r.replace("#", "0x")) : (x === "offset" || x === "alpha") && (y[g][x] = r), this.stops = y, this.stops.sort((P, _) => P.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
|
|
4680
4722
|
}
|
|
4681
4723
|
} else i in this && (this[i] = r);
|
|
4682
4724
|
break;
|
|
@@ -4789,11 +4831,11 @@ f({
|
|
|
4789
4831
|
// Create an instance of the ColorMapFilter with the provided parameters
|
|
4790
4832
|
createFilter: (s) => {
|
|
4791
4833
|
try {
|
|
4792
|
-
const e =
|
|
4834
|
+
const e = b.ColorMapFilter;
|
|
4793
4835
|
if (!e)
|
|
4794
4836
|
return null;
|
|
4795
4837
|
let t = null;
|
|
4796
|
-
s.texturePath ? t =
|
|
4838
|
+
s.texturePath ? t = S.Texture.from(s.texturePath) : t = S.Texture.from("/examples/filters-main/examples/images/colormap.png");
|
|
4797
4839
|
const i = new e({
|
|
4798
4840
|
colorMap: t,
|
|
4799
4841
|
nearest: s.nearest,
|
|
@@ -4803,7 +4845,7 @@ f({
|
|
|
4803
4845
|
const o = this._customParams || {};
|
|
4804
4846
|
switch (this._customParams = o, o[r] = a, r) {
|
|
4805
4847
|
case "texturePath":
|
|
4806
|
-
a && (this.colorMap =
|
|
4848
|
+
a && (this.colorMap = S.Texture.from(a));
|
|
4807
4849
|
break;
|
|
4808
4850
|
case "mix":
|
|
4809
4851
|
this.mix = a;
|
|
@@ -4864,7 +4906,7 @@ f({
|
|
|
4864
4906
|
}
|
|
4865
4907
|
]
|
|
4866
4908
|
});
|
|
4867
|
-
const vt =
|
|
4909
|
+
const vt = b.ColorReplaceFilter;
|
|
4868
4910
|
f({
|
|
4869
4911
|
id: "color-replace",
|
|
4870
4912
|
name: "Color Replace",
|
|
@@ -4945,7 +4987,7 @@ f({
|
|
|
4945
4987
|
}
|
|
4946
4988
|
]
|
|
4947
4989
|
});
|
|
4948
|
-
const kt =
|
|
4990
|
+
const kt = b.MultiColorReplaceFilter;
|
|
4949
4991
|
f({
|
|
4950
4992
|
id: "multi-color-replace",
|
|
4951
4993
|
name: "Multi-Color Replace",
|
|
@@ -5082,7 +5124,7 @@ f({
|
|
|
5082
5124
|
}
|
|
5083
5125
|
]
|
|
5084
5126
|
});
|
|
5085
|
-
const { RGBSplitFilter: Pt } =
|
|
5127
|
+
const { RGBSplitFilter: Pt } = b;
|
|
5086
5128
|
f({
|
|
5087
5129
|
id: "rgb-split",
|
|
5088
5130
|
name: "RGB Split",
|
|
@@ -5216,7 +5258,7 @@ f({
|
|
|
5216
5258
|
}
|
|
5217
5259
|
]
|
|
5218
5260
|
});
|
|
5219
|
-
const { AdvancedBloomFilter: Mt } =
|
|
5261
|
+
const { AdvancedBloomFilter: Mt } = b;
|
|
5220
5262
|
f({
|
|
5221
5263
|
id: "advanced-bloom",
|
|
5222
5264
|
name: "Advanced Bloom",
|
|
@@ -5372,7 +5414,7 @@ f({
|
|
|
5372
5414
|
}
|
|
5373
5415
|
]
|
|
5374
5416
|
});
|
|
5375
|
-
const Ft =
|
|
5417
|
+
const Ft = b.AsciiFilter;
|
|
5376
5418
|
f({
|
|
5377
5419
|
id: "ascii",
|
|
5378
5420
|
name: "ASCII",
|
|
@@ -5451,7 +5493,7 @@ f({
|
|
|
5451
5493
|
}
|
|
5452
5494
|
]
|
|
5453
5495
|
});
|
|
5454
|
-
const At =
|
|
5496
|
+
const At = b.BackdropBlurFilter;
|
|
5455
5497
|
f({
|
|
5456
5498
|
id: "backdrop-blur",
|
|
5457
5499
|
name: "Backdrop Blur",
|
|
@@ -5558,7 +5600,7 @@ f({
|
|
|
5558
5600
|
}
|
|
5559
5601
|
]
|
|
5560
5602
|
});
|
|
5561
|
-
const { BevelFilter: zt } =
|
|
5603
|
+
const { BevelFilter: zt } = b;
|
|
5562
5604
|
f({
|
|
5563
5605
|
id: "bevel",
|
|
5564
5606
|
name: "Bevel",
|
|
@@ -5686,7 +5728,7 @@ f({
|
|
|
5686
5728
|
}
|
|
5687
5729
|
]
|
|
5688
5730
|
});
|
|
5689
|
-
const { BloomFilter: Rt } =
|
|
5731
|
+
const { BloomFilter: Rt } = b;
|
|
5690
5732
|
f({
|
|
5691
5733
|
id: "bloom",
|
|
5692
5734
|
name: "Bloom/Glow",
|
|
@@ -5711,7 +5753,7 @@ f({
|
|
|
5711
5753
|
resolution: r,
|
|
5712
5754
|
kernelSize: a
|
|
5713
5755
|
}, o.updateUIParam = function(n, l) {
|
|
5714
|
-
var c,
|
|
5756
|
+
var c, d;
|
|
5715
5757
|
try {
|
|
5716
5758
|
const h = Number(l), p = this._customParams || {};
|
|
5717
5759
|
switch (this._customParams = p, p[n] = h, n) {
|
|
@@ -5719,7 +5761,7 @@ f({
|
|
|
5719
5761
|
this.strength && typeof this.strength == "object" && (this.strength.x = h, (c = this._updateStrength) == null || c.call(this));
|
|
5720
5762
|
break;
|
|
5721
5763
|
case "strengthY":
|
|
5722
|
-
this.strength && typeof this.strength == "object" && (this.strength.y = h, (
|
|
5764
|
+
this.strength && typeof this.strength == "object" && (this.strength.y = h, (d = this._updateStrength) == null || d.call(this));
|
|
5723
5765
|
break;
|
|
5724
5766
|
case "quality":
|
|
5725
5767
|
this.quality = h;
|
|
@@ -5798,7 +5840,7 @@ f({
|
|
|
5798
5840
|
}
|
|
5799
5841
|
]
|
|
5800
5842
|
});
|
|
5801
|
-
const { BulgePinchFilter: Nt } =
|
|
5843
|
+
const { BulgePinchFilter: Nt } = b;
|
|
5802
5844
|
f({
|
|
5803
5845
|
id: "bulge-pinch",
|
|
5804
5846
|
// ID must match what the application expects
|
|
@@ -5890,7 +5932,7 @@ f({
|
|
|
5890
5932
|
}
|
|
5891
5933
|
]
|
|
5892
5934
|
});
|
|
5893
|
-
const { ConvolutionFilter: Tt } =
|
|
5935
|
+
const { ConvolutionFilter: Tt } = b, E = {
|
|
5894
5936
|
normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
|
|
5895
5937
|
gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
|
|
5896
5938
|
boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
|
|
@@ -6136,7 +6178,7 @@ f({
|
|
|
6136
6178
|
}
|
|
6137
6179
|
]
|
|
6138
6180
|
});
|
|
6139
|
-
const { CrossHatchFilter: It } =
|
|
6181
|
+
const { CrossHatchFilter: It } = b;
|
|
6140
6182
|
f({
|
|
6141
6183
|
id: "cross-hatch",
|
|
6142
6184
|
name: "Cross Hatch",
|
|
@@ -6179,7 +6221,7 @@ f({
|
|
|
6179
6221
|
vignettingBlur: typeof s.vignettingBlur == "number" ? s.vignettingBlur : 0.3,
|
|
6180
6222
|
time: typeof s.time == "number" ? s.time : 0,
|
|
6181
6223
|
seed: typeof s.seed == "number" ? s.seed : Math.random()
|
|
6182
|
-
}, t = new
|
|
6224
|
+
}, t = new b.CRTFilter(e);
|
|
6183
6225
|
return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
|
|
6184
6226
|
try {
|
|
6185
6227
|
const a = this._customParams || {};
|
|
@@ -6343,7 +6385,7 @@ f({
|
|
|
6343
6385
|
}
|
|
6344
6386
|
]
|
|
6345
6387
|
});
|
|
6346
|
-
const Et =
|
|
6388
|
+
const Et = S.DisplacementFilter, Xt = S.Sprite, $ = S.Texture;
|
|
6347
6389
|
f({
|
|
6348
6390
|
id: "displacement",
|
|
6349
6391
|
// ID must match what the application expects
|
|
@@ -6454,7 +6496,7 @@ f({
|
|
|
6454
6496
|
scale: typeof s.scale == "number" ? s.scale : 1,
|
|
6455
6497
|
angle: typeof s.angle == "number" ? s.angle : 5,
|
|
6456
6498
|
grayscale: s.grayscale === !0
|
|
6457
|
-
}, t = new
|
|
6499
|
+
}, t = new b.DotFilter(e);
|
|
6458
6500
|
return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
|
|
6459
6501
|
try {
|
|
6460
6502
|
const a = this._customParams || {};
|
|
@@ -6516,7 +6558,7 @@ f({
|
|
|
6516
6558
|
}
|
|
6517
6559
|
]
|
|
6518
6560
|
});
|
|
6519
|
-
const { EmbossFilter: Yt } =
|
|
6561
|
+
const { EmbossFilter: Yt } = b;
|
|
6520
6562
|
f({
|
|
6521
6563
|
id: "emboss",
|
|
6522
6564
|
name: "Emboss",
|
|
@@ -6565,7 +6607,7 @@ f({
|
|
|
6565
6607
|
}
|
|
6566
6608
|
]
|
|
6567
6609
|
});
|
|
6568
|
-
const { GlitchFilter: Bt } =
|
|
6610
|
+
const { GlitchFilter: Bt } = b, R = {
|
|
6569
6611
|
TRANSPARENT: 0,
|
|
6570
6612
|
ORIGINAL: 1,
|
|
6571
6613
|
LOOP: 2,
|
|
@@ -6610,8 +6652,8 @@ f({
|
|
|
6610
6652
|
break;
|
|
6611
6653
|
case "redX":
|
|
6612
6654
|
case "redY":
|
|
6613
|
-
const
|
|
6614
|
-
n === "redX" ?
|
|
6655
|
+
const d = this.red;
|
|
6656
|
+
n === "redX" ? d.x = l : d.y = l, this.red = d;
|
|
6615
6657
|
break;
|
|
6616
6658
|
case "greenX":
|
|
6617
6659
|
case "greenY":
|
|
@@ -6820,7 +6862,7 @@ f({
|
|
|
6820
6862
|
}
|
|
6821
6863
|
]
|
|
6822
6864
|
});
|
|
6823
|
-
const { GlowFilter: Ot } =
|
|
6865
|
+
const { GlowFilter: Ot } = b;
|
|
6824
6866
|
f({
|
|
6825
6867
|
id: "glow",
|
|
6826
6868
|
name: "Glow",
|
|
@@ -6955,7 +6997,7 @@ f({
|
|
|
6955
6997
|
}
|
|
6956
6998
|
]
|
|
6957
6999
|
});
|
|
6958
|
-
const { GodrayFilter: Lt } =
|
|
7000
|
+
const { GodrayFilter: Lt } = b;
|
|
6959
7001
|
f({
|
|
6960
7002
|
id: "godray",
|
|
6961
7003
|
name: "Godray",
|
|
@@ -7117,7 +7159,7 @@ f({
|
|
|
7117
7159
|
}
|
|
7118
7160
|
]
|
|
7119
7161
|
});
|
|
7120
|
-
const Dt =
|
|
7162
|
+
const Dt = b.SimpleLightmapFilter, ae = S.Texture;
|
|
7121
7163
|
f({
|
|
7122
7164
|
id: "lightmap",
|
|
7123
7165
|
name: "Lightmap",
|
|
@@ -7154,49 +7196,49 @@ f({
|
|
|
7154
7196
|
textureType: e,
|
|
7155
7197
|
color: t,
|
|
7156
7198
|
alpha: i
|
|
7157
|
-
}, l.updateUIParam = function(c,
|
|
7199
|
+
}, l.updateUIParam = function(c, d) {
|
|
7158
7200
|
try {
|
|
7159
7201
|
const h = this._customParams || {};
|
|
7160
|
-
switch (this._customParams = h, h[c] =
|
|
7202
|
+
switch (this._customParams = h, h[c] = d, c) {
|
|
7161
7203
|
case "textureType":
|
|
7162
|
-
h.textureType =
|
|
7204
|
+
h.textureType = d;
|
|
7163
7205
|
const p = document.createElement("canvas");
|
|
7164
7206
|
p.width = 256, p.height = 256;
|
|
7165
7207
|
const m = p.getContext("2d");
|
|
7166
7208
|
if (m) {
|
|
7167
|
-
if (
|
|
7209
|
+
if (d === "spotlight") {
|
|
7168
7210
|
m.fillStyle = "black", m.fillRect(0, 0, 256, 256);
|
|
7169
|
-
const
|
|
7170
|
-
|
|
7171
|
-
} else if (
|
|
7172
|
-
const
|
|
7173
|
-
|
|
7211
|
+
const g = m.createRadialGradient(128, 128, 5, 128, 128, 80);
|
|
7212
|
+
g.addColorStop(0, "white"), g.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), g.addColorStop(1, "rgba(0, 0, 0, 0)"), m.fillStyle = g, m.beginPath(), m.arc(128, 128, 100, 0, Math.PI * 2), m.fill();
|
|
7213
|
+
} else if (d === "softlight") {
|
|
7214
|
+
const g = m.createLinearGradient(0, 0, 256, 256);
|
|
7215
|
+
g.addColorStop(0, "white"), g.addColorStop(0.3, "rgba(220, 220, 220, 1)"), g.addColorStop(0.7, "rgba(150, 150, 150, 1)"), g.addColorStop(1, "rgba(80, 80, 80, 1)"), m.fillStyle = g, m.fillRect(0, 0, 256, 256);
|
|
7174
7216
|
} else {
|
|
7175
|
-
const
|
|
7176
|
-
|
|
7217
|
+
const g = m.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7218
|
+
g.addColorStop(0, "white"), g.addColorStop(0.3, "rgba(220, 220, 220, 1)"), g.addColorStop(0.6, "rgba(150, 150, 150, 1)"), g.addColorStop(1, "black"), m.fillStyle = g, m.fillRect(0, 0, 256, 256);
|
|
7177
7219
|
}
|
|
7178
|
-
const
|
|
7179
|
-
if (this.lightMap =
|
|
7180
|
-
const
|
|
7220
|
+
const x = ae.from(p);
|
|
7221
|
+
if (this.lightMap = x, this.enabled !== void 0) {
|
|
7222
|
+
const g = this.enabled;
|
|
7181
7223
|
this.enabled = !1, setTimeout(() => {
|
|
7182
|
-
this.enabled =
|
|
7224
|
+
this.enabled = g;
|
|
7183
7225
|
}, 0);
|
|
7184
7226
|
}
|
|
7185
7227
|
}
|
|
7186
7228
|
break;
|
|
7187
7229
|
case "color":
|
|
7188
|
-
h.color =
|
|
7230
|
+
h.color = d;
|
|
7189
7231
|
try {
|
|
7190
|
-
typeof
|
|
7232
|
+
typeof d == "string" && d.startsWith("#") ? this.color = parseInt(d.replace("#", "0x"), 16) : this.color = 0;
|
|
7191
7233
|
} catch {
|
|
7192
7234
|
this.color = 0;
|
|
7193
7235
|
}
|
|
7194
7236
|
break;
|
|
7195
7237
|
case "alpha":
|
|
7196
|
-
this.alpha = Number(
|
|
7238
|
+
this.alpha = Number(d);
|
|
7197
7239
|
break;
|
|
7198
7240
|
default:
|
|
7199
|
-
c in this && (this[c] =
|
|
7241
|
+
c in this && (this[c] = d);
|
|
7200
7242
|
break;
|
|
7201
7243
|
}
|
|
7202
7244
|
} catch {
|
|
@@ -7248,7 +7290,7 @@ f({
|
|
|
7248
7290
|
}
|
|
7249
7291
|
]
|
|
7250
7292
|
});
|
|
7251
|
-
const { NoiseFilter: Ut } =
|
|
7293
|
+
const { NoiseFilter: Ut } = S;
|
|
7252
7294
|
f({
|
|
7253
7295
|
id: "noise",
|
|
7254
7296
|
name: "Noise",
|
|
@@ -7333,7 +7375,7 @@ f({
|
|
|
7333
7375
|
}
|
|
7334
7376
|
]
|
|
7335
7377
|
});
|
|
7336
|
-
const { OldFilmFilter: Vt } =
|
|
7378
|
+
const { OldFilmFilter: Vt } = b;
|
|
7337
7379
|
f({
|
|
7338
7380
|
id: "old-film",
|
|
7339
7381
|
name: "Old Film",
|
|
@@ -7522,7 +7564,7 @@ f({
|
|
|
7522
7564
|
}
|
|
7523
7565
|
]
|
|
7524
7566
|
});
|
|
7525
|
-
const { OutlineFilter: jt } =
|
|
7567
|
+
const { OutlineFilter: jt } = b;
|
|
7526
7568
|
f({
|
|
7527
7569
|
id: "outline",
|
|
7528
7570
|
name: "Outline",
|
|
@@ -7622,7 +7664,7 @@ f({
|
|
|
7622
7664
|
}
|
|
7623
7665
|
]
|
|
7624
7666
|
});
|
|
7625
|
-
const { PixelateFilter: qt } =
|
|
7667
|
+
const { PixelateFilter: qt } = b;
|
|
7626
7668
|
f({
|
|
7627
7669
|
id: "pixelate",
|
|
7628
7670
|
name: "Pixelate",
|
|
@@ -7713,7 +7755,7 @@ f({
|
|
|
7713
7755
|
}
|
|
7714
7756
|
]
|
|
7715
7757
|
});
|
|
7716
|
-
const { ReflectionFilter: Ht } =
|
|
7758
|
+
const { ReflectionFilter: Ht } = b;
|
|
7717
7759
|
f({
|
|
7718
7760
|
id: "reflection",
|
|
7719
7761
|
// ID must match what the application expects
|
|
@@ -7881,7 +7923,7 @@ f({
|
|
|
7881
7923
|
}
|
|
7882
7924
|
]
|
|
7883
7925
|
});
|
|
7884
|
-
const { ShockwaveFilter: $t } =
|
|
7926
|
+
const { ShockwaveFilter: $t } = b;
|
|
7885
7927
|
f({
|
|
7886
7928
|
id: "shockwave",
|
|
7887
7929
|
// ID must match what the application expects
|
|
@@ -7891,7 +7933,7 @@ f({
|
|
|
7891
7933
|
// Create an instance of the ShockwaveFilter with the provided parameters
|
|
7892
7934
|
createFilter: (s) => {
|
|
7893
7935
|
try {
|
|
7894
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0,
|
|
7936
|
+
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, d = new $t({
|
|
7895
7937
|
center: i,
|
|
7896
7938
|
amplitude: r,
|
|
7897
7939
|
wavelength: a,
|
|
@@ -7900,7 +7942,7 @@ f({
|
|
|
7900
7942
|
radius: l,
|
|
7901
7943
|
time: c
|
|
7902
7944
|
});
|
|
7903
|
-
return
|
|
7945
|
+
return d._customParams = { ...s }, d.animating = s.animating ?? !1, d.updateUIParam = function(h, p) {
|
|
7904
7946
|
const m = this._customParams || {};
|
|
7905
7947
|
switch (this._customParams = m, m[h] = p, h) {
|
|
7906
7948
|
case "centerX":
|
|
@@ -7925,7 +7967,7 @@ f({
|
|
|
7925
7967
|
break;
|
|
7926
7968
|
}
|
|
7927
7969
|
return !0;
|
|
7928
|
-
},
|
|
7970
|
+
}, d;
|
|
7929
7971
|
} catch {
|
|
7930
7972
|
return null;
|
|
7931
7973
|
}
|
|
@@ -8033,7 +8075,7 @@ f({
|
|
|
8033
8075
|
}
|
|
8034
8076
|
]
|
|
8035
8077
|
});
|
|
8036
|
-
const { SimplexNoiseFilter: Wt } =
|
|
8078
|
+
const { SimplexNoiseFilter: Wt } = b;
|
|
8037
8079
|
f({
|
|
8038
8080
|
id: "simplex-noise",
|
|
8039
8081
|
name: "Simplex Noise",
|
|
@@ -8188,7 +8230,7 @@ f({
|
|
|
8188
8230
|
}
|
|
8189
8231
|
]
|
|
8190
8232
|
});
|
|
8191
|
-
class Zt extends
|
|
8233
|
+
class Zt extends S.Filter {
|
|
8192
8234
|
constructor(e) {
|
|
8193
8235
|
const t = Ce.from({
|
|
8194
8236
|
vertex: `
|
|
@@ -8369,7 +8411,7 @@ f({
|
|
|
8369
8411
|
}
|
|
8370
8412
|
]
|
|
8371
8413
|
});
|
|
8372
|
-
const { AdjustmentFilter: Gt } =
|
|
8414
|
+
const { AdjustmentFilter: Gt } = b;
|
|
8373
8415
|
function D(s) {
|
|
8374
8416
|
const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
|
|
8375
8417
|
return [
|
|
@@ -8522,4 +8564,4 @@ export {
|
|
|
8522
8564
|
ri as i,
|
|
8523
8565
|
f as r
|
|
8524
8566
|
};
|
|
8525
|
-
//# sourceMappingURL=editor-
|
|
8567
|
+
//# sourceMappingURL=editor-Cw08D0SQ.js.map
|