@codingfactory/mediables-vue 2.4.16 → 2.4.18
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-BJgx5idV.js → PixiFrameExporter-nyNuO2Eg.js} +2 -2
- package/dist/{PixiFrameExporter-BJgx5idV.js.map → PixiFrameExporter-nyNuO2Eg.js.map} +1 -1
- package/dist/{PixiFrameExporter-DKN__2tw.cjs → PixiFrameExporter-xKH2b9TP.cjs} +2 -2
- package/dist/{PixiFrameExporter-DKN__2tw.cjs.map → PixiFrameExporter-xKH2b9TP.cjs.map} +1 -1
- package/dist/components/ImageEditorModal.vue.d.ts +1 -2
- package/dist/editor-BIDFjsrP.cjs +42 -0
- package/dist/editor-BIDFjsrP.cjs.map +1 -0
- package/dist/{editor-BQNym0-5.js → editor-BfdrdqUU.js} +451 -441
- package/dist/editor-BfdrdqUU.js.map +1 -0
- package/dist/{index-DCljToZr.cjs → index-BLELmZZs.cjs} +4 -4
- package/dist/index-BLELmZZs.cjs.map +1 -0
- package/dist/{index-DHKu69UX.js → index-JKTSyJp3.js} +8 -9
- package/dist/index-JKTSyJp3.js.map +1 -0
- package/dist/mediables-vanilla.cjs +1 -1
- package/dist/mediables-vanilla.mjs +1 -1
- package/dist/mediables-vue.cjs +1 -1
- package/dist/mediables-vue.mjs +2 -2
- package/dist/render-page/assets/{index-DigDyl_v.js → index-ZZVWF3LA.js} +34 -4
- package/dist/render-page/index.html +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/editor-2YMaYryX.cjs +0 -42
- package/dist/editor-2YMaYryX.cjs.map +0 -1
- package/dist/editor-BQNym0-5.js.map +0 -1
- package/dist/index-DCljToZr.cjs.map +0 -1
- package/dist/index-DHKu69UX.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Ce = Object.defineProperty;
|
|
2
|
+
var we = (s, e, t) => e in s ? Ce(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var W = (s, e, t) => we(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as b from "pixi-filters";
|
|
5
|
-
import * as
|
|
6
|
-
import { GlProgram as
|
|
7
|
-
class
|
|
5
|
+
import * as w from "pixi.js";
|
|
6
|
+
import { GlProgram as Se } from "pixi.js";
|
|
7
|
+
class U {
|
|
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 ve extends U {
|
|
38
38
|
constructor() {
|
|
39
39
|
super(), this._state = {
|
|
40
40
|
// Image state
|
|
@@ -189,10 +189,10 @@ class Se extends O {
|
|
|
189
189
|
this.set("isDarkMode", this._state.theme === "dark");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
return new
|
|
192
|
+
function ke() {
|
|
193
|
+
return new ve();
|
|
194
194
|
}
|
|
195
|
-
class
|
|
195
|
+
class Pe extends U {
|
|
196
196
|
constructor() {
|
|
197
197
|
super(), this.app = null, this.sprite = null, this.originalTexture = null, this.baseTexture = null, this.fitScale = 1, this.zoom = 1, this._container = null, this._mountPromise = null;
|
|
198
198
|
}
|
|
@@ -313,47 +313,47 @@ class ke extends O {
|
|
|
313
313
|
* @returns {string|null} Data URL
|
|
314
314
|
*/
|
|
315
315
|
exportImage(e = "png", t = 0.92, i = 0, r = !0) {
|
|
316
|
-
var
|
|
317
|
-
if (!((
|
|
316
|
+
var S;
|
|
317
|
+
if (!((S = this.app) != null && S.renderer) || !this.originalTexture || !this.sprite)
|
|
318
318
|
return null;
|
|
319
319
|
const a = window.PIXI, o = Math.round(this.originalTexture.width), n = Math.round(this.originalTexture.height);
|
|
320
320
|
if (o <= 0 || n <= 0)
|
|
321
321
|
return null;
|
|
322
|
-
let l = o;
|
|
322
|
+
let l = o, c = n;
|
|
323
323
|
if (i > 0) {
|
|
324
|
-
const
|
|
325
|
-
let
|
|
326
|
-
r && (
|
|
324
|
+
const M = Math.max(o, n);
|
|
325
|
+
let F = i / M;
|
|
326
|
+
r && (F = Math.min(1, F)), l = Math.round(o * F), c = Math.round(n * F);
|
|
327
327
|
}
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
328
|
+
const d = this.sprite, h = d.x, p = d.y, f = d.scale.x, _ = d.scale.y, g = d.width, y = d.height;
|
|
329
|
+
if (g <= 0 || y <= 0)
|
|
330
330
|
return null;
|
|
331
|
-
const
|
|
332
|
-
let
|
|
331
|
+
const v = l / g, x = c / y;
|
|
332
|
+
let P = null;
|
|
333
333
|
try {
|
|
334
|
-
if (
|
|
335
|
-
width: Math.ceil(
|
|
336
|
-
height: Math.ceil(
|
|
337
|
-
resolution:
|
|
338
|
-
}), this.app.renderer.render({ container: this.app.stage, target:
|
|
334
|
+
if (d.x = 0, d.y = 0, d.scale.x = f * v, d.scale.y = _ * x, P = a.RenderTexture.create({
|
|
335
|
+
width: Math.ceil(l),
|
|
336
|
+
height: Math.ceil(c),
|
|
337
|
+
resolution: 1
|
|
338
|
+
}), this.app.renderer.render({ container: this.app.stage, target: P }), !this.app.renderer.extract)
|
|
339
339
|
return null;
|
|
340
|
-
const
|
|
341
|
-
if (!
|
|
340
|
+
const M = this.app.renderer.extract.canvas(P);
|
|
341
|
+
if (!M)
|
|
342
342
|
return null;
|
|
343
|
-
let
|
|
344
|
-
if (typeof
|
|
345
|
-
|
|
346
|
-
else if (typeof
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
|
|
343
|
+
let F = null;
|
|
344
|
+
if (typeof M.toDataURL == "function")
|
|
345
|
+
F = M.toDataURL(`image/${e}`, t);
|
|
346
|
+
else if (typeof M.getContext == "function") {
|
|
347
|
+
const B = document.createElement("canvas");
|
|
348
|
+
B.width = M.width, B.height = M.height;
|
|
349
|
+
const V = B.getContext("2d");
|
|
350
|
+
V && (V.drawImage(M, 0, 0), F = B.toDataURL(`image/${e}`, t));
|
|
351
351
|
}
|
|
352
|
-
return
|
|
352
|
+
return F || null;
|
|
353
353
|
} catch {
|
|
354
354
|
return null;
|
|
355
355
|
} finally {
|
|
356
|
-
|
|
356
|
+
d.x = h, d.y = p, d.scale.x = f, d.scale.y = _, P && P.destroy(!0);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
/**
|
|
@@ -431,7 +431,7 @@ class ke extends O {
|
|
|
431
431
|
this.sprite = null, this.originalTexture = null, this.baseTexture = null, this._container = null, this.removeAllListeners();
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
const
|
|
434
|
+
const Me = {
|
|
435
435
|
adjust: ["adjust", "advanced"],
|
|
436
436
|
// adjustment, adjustmentAdvanced, alpha, colorMatrix
|
|
437
437
|
blur: ["blur"],
|
|
@@ -447,7 +447,7 @@ const Pe = {
|
|
|
447
447
|
stylize: ["stylize"]
|
|
448
448
|
// ascii, crt, crossHatch, dot, emboss
|
|
449
449
|
};
|
|
450
|
-
class
|
|
450
|
+
class Fe extends U {
|
|
451
451
|
constructor(e, t) {
|
|
452
452
|
super(), this.state = e, this.renderer = t, this.instances = {}, this._filterRegistry = null;
|
|
453
453
|
}
|
|
@@ -482,7 +482,7 @@ class Me extends O {
|
|
|
482
482
|
*/
|
|
483
483
|
getFiltersByCategory(e) {
|
|
484
484
|
if (!this._filterRegistry) return [];
|
|
485
|
-
const t =
|
|
485
|
+
const t = Me[e] || [e], i = [], r = /* @__PURE__ */ new Set();
|
|
486
486
|
for (const a of t) {
|
|
487
487
|
const o = this._filterRegistry.getFiltersByCategory(a) || [];
|
|
488
488
|
for (const n of o)
|
|
@@ -624,7 +624,7 @@ class Me extends O {
|
|
|
624
624
|
return this.instances[e] || null;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
const
|
|
627
|
+
const X = class X extends U {
|
|
628
628
|
constructor(e, t) {
|
|
629
629
|
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);
|
|
630
630
|
}
|
|
@@ -701,7 +701,7 @@ const I = class I extends O {
|
|
|
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 d =
|
|
704
|
+
const d = X.AUTO_ZOOM_PADDING;
|
|
705
705
|
let h = n;
|
|
706
706
|
if (l) {
|
|
707
707
|
const p = e.width / (d * r * o);
|
|
@@ -720,11 +720,11 @@ const I = class I extends O {
|
|
|
720
720
|
_checkAutoZoom() {
|
|
721
721
|
if (!this.state.get("autoZoomOnCropOverflow")) return;
|
|
722
722
|
const e = Date.now();
|
|
723
|
-
if (e - this._lastAutoZoomCheck <
|
|
723
|
+
if (e - this._lastAutoZoomCheck < X.AUTO_ZOOM_THROTTLE_MS) return;
|
|
724
724
|
this._lastAutoZoomCheck = e;
|
|
725
725
|
const t = this.state.get("crop.rect"), i = this.renderer.sprite, r = this.renderer.originalTexture;
|
|
726
726
|
if (!t || !i || !r) return;
|
|
727
|
-
const a =
|
|
727
|
+
const a = X.calcAutoZoom(
|
|
728
728
|
t,
|
|
729
729
|
i.width,
|
|
730
730
|
i.height,
|
|
@@ -752,8 +752,8 @@ const I = class I extends O {
|
|
|
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, v = l.y + l.height / 2, x = Math.min(l.width, l.height) / 2;
|
|
756
|
+
n.beginPath(), n.arc(y, v, x, 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(
|
|
@@ -766,20 +766,20 @@ const I = class I extends O {
|
|
|
766
766
|
const d = l.width / 3, h = l.height / 3;
|
|
767
767
|
for (let y = 1; y <= 2; y++)
|
|
768
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
|
-
const p = this.HANDLE_SIZE,
|
|
769
|
+
const p = this.HANDLE_SIZE, f = [
|
|
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
|
+
], _ = [
|
|
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
|
-
], g = [...
|
|
779
|
+
], g = [...f, ..._];
|
|
780
780
|
for (const y of g) {
|
|
781
|
-
const
|
|
782
|
-
n.beginPath(), n.rect(y.x -
|
|
781
|
+
const v = this._hoverMode === y.m, x = v ? p + 4 : p;
|
|
782
|
+
n.beginPath(), n.rect(y.x - x / 2, y.y - x / 2, x, x), n.fillStyle = v ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
/**
|
|
@@ -863,8 +863,18 @@ const I = class I extends O {
|
|
|
863
863
|
if (!e || !t) return;
|
|
864
864
|
let i = this.state.get("crop.rect");
|
|
865
865
|
if (!i) {
|
|
866
|
-
|
|
867
|
-
|
|
866
|
+
this.state.get("crop.shape") === "circle" && this.state.set("crop.aspect", "1:1");
|
|
867
|
+
const o = this.state.get("crop.aspect"), n = this._getAspectRatio(o);
|
|
868
|
+
let l, c;
|
|
869
|
+
if (n) {
|
|
870
|
+
const p = t.width * 0.9, f = t.height * 0.9;
|
|
871
|
+
p / f > n ? (c = f, l = c * n) : (l = p, c = l / n);
|
|
872
|
+
} else {
|
|
873
|
+
const p = Math.min(e.screen.width, e.screen.height) * 0.7;
|
|
874
|
+
l = p, c = p;
|
|
875
|
+
}
|
|
876
|
+
const d = t.x + (t.width - l) / 2, h = t.y + (t.height - c) / 2;
|
|
877
|
+
i = { x: d, y: h, width: l, height: c }, this.state.set("crop.rect", i), o !== "free" && this.constrainCropRect();
|
|
868
878
|
}
|
|
869
879
|
const r = e.stage;
|
|
870
880
|
r.eventMode = "static", r.hitArea = e.screen, r.cursor = "crosshair", r.on("pointerdown", this._onPointerDown), r.on("pointermove", this._onPointerMove), r.on("pointerup", this._onPointerUp), r.on("pointerupoutside", this._onPointerUp), this.state.set("mode", "crop"), this.drawOverlay(), this.emit("enabled");
|
|
@@ -890,33 +900,33 @@ const I = class I extends O {
|
|
|
890
900
|
const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
|
|
891
901
|
if (!r || !t || !e || !i) return null;
|
|
892
902
|
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)),
|
|
903
|
+
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), f = Math.round(c), _ = Math.round(d);
|
|
894
904
|
if (h <= 0 || p <= 0) return null;
|
|
895
905
|
const g = new a.Container(), y = new a.Sprite(i);
|
|
896
906
|
if (this.state.get("crop.shape") === "circle") {
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
typeof
|
|
907
|
+
const $ = Math.round(Math.max(h, p)), _e = f + h / 2, xe = _ + p / 2;
|
|
908
|
+
f = Math.round(_e - $ / 2), _ = Math.round(xe - $ / 2), h = p = $;
|
|
909
|
+
const R = new a.Graphics();
|
|
910
|
+
typeof R.circle == "function" && typeof R.fill == "function" ? R.circle(h / 2, p / 2, h / 2).fill(16777215) : (R.beginFill(16777215, 1), R.drawCircle(h / 2, p / 2, h / 2), R.endFill()), y.mask = R, g.addChild(R);
|
|
901
911
|
}
|
|
902
|
-
y.x = -
|
|
903
|
-
const
|
|
912
|
+
y.x = -f, y.y = -_, g.addChild(y);
|
|
913
|
+
const x = a.RenderTexture.create({ width: h, height: p });
|
|
904
914
|
e.renderer.render({
|
|
905
915
|
container: g,
|
|
906
|
-
target:
|
|
916
|
+
target: x,
|
|
907
917
|
clear: !0
|
|
908
918
|
}), g.destroy({ children: !0 });
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
const
|
|
912
|
-
e.stage.addChild(
|
|
913
|
-
const
|
|
914
|
-
x: Math.round(
|
|
915
|
-
y: Math.round(
|
|
919
|
+
const P = this.renderer.originalTexture;
|
|
920
|
+
P && P !== this.renderer.baseTexture && P.destroy(!0), this.renderer.originalTexture = x, e.stage.removeChild(t), t.destroy();
|
|
921
|
+
const S = new a.Sprite(x);
|
|
922
|
+
e.stage.addChild(S), this.renderer.sprite = S, this.renderer.fitScale = this.renderer.getFitScaleFor(x), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render();
|
|
923
|
+
const T = this.state.get("crop.appliedRect"), F = T && Number.isFinite(T.x) && Number.isFinite(T.y) && Number.isFinite(T.width) && Number.isFinite(T.height) ? {
|
|
924
|
+
x: Math.round(T.x + f),
|
|
925
|
+
y: Math.round(T.y + _),
|
|
916
926
|
width: h,
|
|
917
927
|
height: p
|
|
918
|
-
} : { x:
|
|
919
|
-
return this.disable(), this.state.set("crop.appliedRect",
|
|
928
|
+
} : { x: f, y: _, width: h, height: p }, B = this.state.get("crop.shape") || "free", V = this.state.get("crop.aspect") || "free";
|
|
929
|
+
return this.disable(), this.state.set("crop.appliedRect", F), this.state.set("crop.appliedShape", B), this.state.set("crop.appliedAspect", V), this.emit("applied", { width: h, height: p }), { texture: x, preservedZoom: o };
|
|
920
930
|
}
|
|
921
931
|
/**
|
|
922
932
|
* Apply a crop from saved texture-pixel coordinates (for state rehydration).
|
|
@@ -931,20 +941,20 @@ const I = class I extends O {
|
|
|
931
941
|
const o = window.PIXI, n = this.renderer.zoom;
|
|
932
942
|
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);
|
|
933
943
|
if (l <= 0 || c <= 0) return null;
|
|
934
|
-
const p = new o.Container(),
|
|
944
|
+
const p = new o.Container(), f = new o.Sprite(a);
|
|
935
945
|
if (t === "circle") {
|
|
936
|
-
const
|
|
937
|
-
d = Math.round(
|
|
938
|
-
const
|
|
939
|
-
typeof
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
const
|
|
943
|
-
i.renderer.render({ container: p, target:
|
|
946
|
+
const v = Math.round(Math.max(l, c)), x = d + l / 2, P = h + c / 2;
|
|
947
|
+
d = Math.round(x - v / 2), h = Math.round(P - v / 2), l = c = v;
|
|
948
|
+
const S = new o.Graphics();
|
|
949
|
+
typeof S.circle == "function" && typeof S.fill == "function" ? S.circle(l / 2, c / 2, l / 2).fill(16777215) : (S.beginFill(16777215, 1), S.drawCircle(l / 2, c / 2, l / 2), S.endFill()), f.mask = S, p.addChild(S);
|
|
950
|
+
}
|
|
951
|
+
f.x = -d, f.y = -h, p.addChild(f);
|
|
952
|
+
const _ = o.RenderTexture.create({ width: l, height: c });
|
|
953
|
+
i.renderer.render({ container: p, target: _, clear: !0 }), p.destroy({ children: !0 });
|
|
944
954
|
const g = this.renderer.originalTexture;
|
|
945
|
-
g && g !== this.renderer.baseTexture && g.destroy(!0), this.renderer.originalTexture =
|
|
946
|
-
const y = new o.Sprite(
|
|
947
|
-
return i.stage.addChild(y), this.renderer.sprite = y, this.renderer.fitScale = this.renderer.getFitScaleFor(
|
|
955
|
+
g && g !== this.renderer.baseTexture && g.destroy(!0), this.renderer.originalTexture = _, i.stage.removeChild(r), r.destroy();
|
|
956
|
+
const y = new o.Sprite(_);
|
|
957
|
+
return i.stage.addChild(y), this.renderer.sprite = y, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(n, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), { texture: _, preservedZoom: n };
|
|
948
958
|
}
|
|
949
959
|
/**
|
|
950
960
|
* Cancel crop
|
|
@@ -971,12 +981,12 @@ const I = class I extends O {
|
|
|
971
981
|
* Padding factor for auto-zoom: image will be ~91% of crop size (1/1.1).
|
|
972
982
|
* Higher values = more aggressive zoom-out, more padding around image.
|
|
973
983
|
*/
|
|
974
|
-
|
|
984
|
+
W(X, "AUTO_ZOOM_PADDING", 1.1), /**
|
|
975
985
|
* Minimum interval (ms) between auto-zoom adjustments during drag.
|
|
976
986
|
*/
|
|
977
|
-
|
|
978
|
-
let
|
|
979
|
-
class
|
|
987
|
+
W(X, "AUTO_ZOOM_THROTTLE_MS", 100);
|
|
988
|
+
let Q = X;
|
|
989
|
+
class Ae {
|
|
980
990
|
/**
|
|
981
991
|
* Create a new RemoveBgManager
|
|
982
992
|
* @param {Object} options
|
|
@@ -1102,7 +1112,7 @@ function u(s, e = {}, ...t) {
|
|
|
1102
1112
|
typeof r == "string" ? i.appendChild(document.createTextNode(r)) : r instanceof HTMLElement && i.appendChild(r);
|
|
1103
1113
|
return i;
|
|
1104
1114
|
}
|
|
1105
|
-
function
|
|
1115
|
+
function he({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
|
|
1106
1116
|
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = u("div", {
|
|
1107
1117
|
className: "slider-control slider-wrapper",
|
|
1108
1118
|
"data-control": n,
|
|
@@ -1111,7 +1121,7 @@ function oe({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1111
1121
|
"div",
|
|
1112
1122
|
{ className: "slider-header" },
|
|
1113
1123
|
u("label", { for: s, className: "slider-label" }, e),
|
|
1114
|
-
u("span", { className: "slider-value", id: `${s}-value` },
|
|
1124
|
+
u("span", { className: "slider-value", id: `${s}-value` }, Z(a))
|
|
1115
1125
|
), d = u("input", {
|
|
1116
1126
|
type: "range",
|
|
1117
1127
|
id: s,
|
|
@@ -1121,20 +1131,20 @@ function oe({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
|
|
|
1121
1131
|
step: String(r),
|
|
1122
1132
|
value: String(a),
|
|
1123
1133
|
onInput: (h) => {
|
|
1124
|
-
const p = parseFloat(h.target.value),
|
|
1125
|
-
|
|
1134
|
+
const p = parseFloat(h.target.value), f = l.querySelector(".slider-value");
|
|
1135
|
+
f && (f.textContent = Z(p)), o == null || o(p);
|
|
1126
1136
|
}
|
|
1127
1137
|
});
|
|
1128
1138
|
return l.appendChild(c), l.appendChild(d), l.setValue = (h) => {
|
|
1129
1139
|
d.value = String(h);
|
|
1130
1140
|
const p = l.querySelector(".slider-value");
|
|
1131
|
-
p && (p.textContent =
|
|
1141
|
+
p && (p.textContent = Z(h));
|
|
1132
1142
|
}, l;
|
|
1133
1143
|
}
|
|
1134
|
-
function
|
|
1144
|
+
function Z(s) {
|
|
1135
1145
|
return Number.isInteger(s) ? String(s) : s.toFixed(2);
|
|
1136
1146
|
}
|
|
1137
|
-
function
|
|
1147
|
+
function de({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
1138
1148
|
const r = u("div", { className: "toggle-control" }), a = u("label", { className: "toggle-label", for: s }, e), o = u("input", {
|
|
1139
1149
|
type: "checkbox",
|
|
1140
1150
|
id: s,
|
|
@@ -1151,7 +1161,7 @@ function ne({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
|
1151
1161
|
o.checked = c;
|
|
1152
1162
|
}, r;
|
|
1153
1163
|
}
|
|
1154
|
-
function
|
|
1164
|
+
function ue({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
1155
1165
|
const r = u("div", { className: "color-control" }), a = u("label", { className: "color-label", for: s }, e), o = u("input", {
|
|
1156
1166
|
type: "color",
|
|
1157
1167
|
id: s,
|
|
@@ -1163,7 +1173,7 @@ function le({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
|
1163
1173
|
o.value = n;
|
|
1164
1174
|
}, r;
|
|
1165
1175
|
}
|
|
1166
|
-
function
|
|
1176
|
+
function pe({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
1167
1177
|
const a = u("div", { className: "select-control" }), o = u("label", { className: "select-label", for: s }, e), n = u("select", {
|
|
1168
1178
|
id: s,
|
|
1169
1179
|
className: "select-input",
|
|
@@ -1177,7 +1187,7 @@ function ce({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
|
1177
1187
|
n.value = l;
|
|
1178
1188
|
}, a;
|
|
1179
1189
|
}
|
|
1180
|
-
function
|
|
1190
|
+
function N({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
|
|
1181
1191
|
const a = u("button", {
|
|
1182
1192
|
type: "button",
|
|
1183
1193
|
className: `btn ${e}`.trim(),
|
|
@@ -1192,7 +1202,7 @@ function R({ label: s, className: e = "", onClick: t, icon: i = null, disabled:
|
|
|
1192
1202
|
}
|
|
1193
1203
|
return s && a.appendChild(document.createTextNode(s)), a;
|
|
1194
1204
|
}
|
|
1195
|
-
function
|
|
1205
|
+
function C({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1, testId: a = null, ariaLabel: o = null }) {
|
|
1196
1206
|
const n = {
|
|
1197
1207
|
type: "button",
|
|
1198
1208
|
className: `icon-btn ${t}`.trim(),
|
|
@@ -1207,7 +1217,7 @@ function w({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1,
|
|
|
1207
1217
|
const c = l.querySelector("svg");
|
|
1208
1218
|
return c && c.setAttribute("aria-hidden", "true"), l;
|
|
1209
1219
|
}
|
|
1210
|
-
function
|
|
1220
|
+
function J({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
1211
1221
|
const r = u("button", {
|
|
1212
1222
|
type: "button",
|
|
1213
1223
|
className: `chip ${t ? "active" : ""}`.trim(),
|
|
@@ -1223,8 +1233,8 @@ function Z({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
|
1223
1233
|
r.classList.toggle("active", a);
|
|
1224
1234
|
}, r;
|
|
1225
1235
|
}
|
|
1226
|
-
const
|
|
1227
|
-
class
|
|
1236
|
+
const fe = '<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>', me = '<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>', 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="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>', 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="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>', 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="M432 320v112H320M80 192V80h112M320 80h112v112M192 432H80V320"/></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="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>', 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="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>', Ee = '<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>', Xe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="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>', Ye = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></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="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>', ge = '<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>', 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="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>', 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="M368 368L144 144M368 144L144 368"/></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="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>', Le = '<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>', 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="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>', 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="M416 128L192 384l-96-96"/></svg>', Ue = '<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>', Ve = '<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>', je = '<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>', ie = '<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>', 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="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>', qe = '<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>';
|
|
1237
|
+
class He {
|
|
1228
1238
|
constructor(e, t) {
|
|
1229
1239
|
this.state = e, this.editor = t, this.element = null, this._unsubscribers = [];
|
|
1230
1240
|
}
|
|
@@ -1234,8 +1244,8 @@ class qe {
|
|
|
1234
1244
|
*/
|
|
1235
1245
|
render() {
|
|
1236
1246
|
this.element = u("div", { className: "editor-toolbar" });
|
|
1237
|
-
const e = u("div", { className: "toolbar-section toolbar-left" }), t =
|
|
1238
|
-
icon:
|
|
1247
|
+
const e = u("div", { className: "toolbar-section toolbar-left" }), t = C({
|
|
1248
|
+
icon: De,
|
|
1239
1249
|
title: "Open Image",
|
|
1240
1250
|
className: "toolbar-btn",
|
|
1241
1251
|
testId: "btn-open-image",
|
|
@@ -1243,8 +1253,8 @@ class qe {
|
|
|
1243
1253
|
onClick: () => this.editor.openFilePicker()
|
|
1244
1254
|
});
|
|
1245
1255
|
e.appendChild(t);
|
|
1246
|
-
const i = u("div", { className: "toolbar-section toolbar-center" }), r =
|
|
1247
|
-
icon:
|
|
1256
|
+
const i = u("div", { className: "toolbar-section toolbar-center" }), r = C({
|
|
1257
|
+
icon: Re,
|
|
1248
1258
|
title: "Zoom Out",
|
|
1249
1259
|
className: "toolbar-btn",
|
|
1250
1260
|
testId: "btn-zoom-out",
|
|
@@ -1260,8 +1270,8 @@ class qe {
|
|
|
1260
1270
|
"aria-atomic": "true",
|
|
1261
1271
|
role: "status"
|
|
1262
1272
|
}, "100%");
|
|
1263
|
-
const a =
|
|
1264
|
-
icon:
|
|
1273
|
+
const a = C({
|
|
1274
|
+
icon: ze,
|
|
1265
1275
|
title: "Zoom In",
|
|
1266
1276
|
className: "toolbar-btn",
|
|
1267
1277
|
testId: "btn-zoom-in",
|
|
@@ -1270,8 +1280,8 @@ class qe {
|
|
|
1270
1280
|
const h = this.state.get("zoom");
|
|
1271
1281
|
this.editor.setZoom(h + 0.25);
|
|
1272
1282
|
}
|
|
1273
|
-
}), o =
|
|
1274
|
-
icon:
|
|
1283
|
+
}), o = C({
|
|
1284
|
+
icon: Ne,
|
|
1275
1285
|
title: "Fit to Screen",
|
|
1276
1286
|
className: "toolbar-btn",
|
|
1277
1287
|
testId: "btn-fit-screen",
|
|
@@ -1280,15 +1290,15 @@ class qe {
|
|
|
1280
1290
|
});
|
|
1281
1291
|
i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
|
|
1282
1292
|
const n = u("div", { className: "toolbar-section toolbar-right" });
|
|
1283
|
-
this._themeBtn =
|
|
1284
|
-
icon: this.state.get("isDarkMode") ?
|
|
1293
|
+
this._themeBtn = C({
|
|
1294
|
+
icon: this.state.get("isDarkMode") ? ie : re,
|
|
1285
1295
|
title: "Toggle Theme",
|
|
1286
1296
|
className: "toolbar-btn toolbar-btn-theme",
|
|
1287
1297
|
testId: "btn-toggle-theme",
|
|
1288
1298
|
ariaLabel: "Toggle theme",
|
|
1289
1299
|
onClick: () => this.editor.toggleTheme()
|
|
1290
|
-
}), this._cropBtn =
|
|
1291
|
-
icon:
|
|
1300
|
+
}), this._cropBtn = C({
|
|
1301
|
+
icon: ge,
|
|
1292
1302
|
title: "Crop",
|
|
1293
1303
|
className: "toolbar-btn toolbar-btn-crop",
|
|
1294
1304
|
testId: "btn-crop",
|
|
@@ -1297,22 +1307,22 @@ class qe {
|
|
|
1297
1307
|
this.state.get("mode") === "crop" ? this.editor.setMode("filters") : this.editor.setMode("crop");
|
|
1298
1308
|
}
|
|
1299
1309
|
});
|
|
1300
|
-
const l =
|
|
1301
|
-
icon:
|
|
1310
|
+
const l = C({
|
|
1311
|
+
icon: be,
|
|
1302
1312
|
title: "Reset All",
|
|
1303
1313
|
className: "toolbar-btn",
|
|
1304
1314
|
testId: "btn-reset-all",
|
|
1305
1315
|
ariaLabel: "Reset all changes",
|
|
1306
1316
|
onClick: () => this.editor.resetAll()
|
|
1307
|
-
}), c =
|
|
1308
|
-
icon:
|
|
1317
|
+
}), c = C({
|
|
1318
|
+
icon: Oe,
|
|
1309
1319
|
title: "Save Image",
|
|
1310
1320
|
className: "toolbar-btn toolbar-btn-primary",
|
|
1311
1321
|
testId: "btn-save-edit",
|
|
1312
1322
|
ariaLabel: "Save image",
|
|
1313
1323
|
onClick: () => this.editor.save()
|
|
1314
|
-
}), d =
|
|
1315
|
-
icon:
|
|
1324
|
+
}), d = C({
|
|
1325
|
+
icon: te,
|
|
1316
1326
|
title: "Close",
|
|
1317
1327
|
className: "toolbar-btn",
|
|
1318
1328
|
testId: "btn-cancel-edit",
|
|
@@ -1330,7 +1340,7 @@ class qe {
|
|
|
1330
1340
|
});
|
|
1331
1341
|
this._unsubscribers.push(e);
|
|
1332
1342
|
const t = this.state.on("change:isDarkMode", ({ value: r }) => {
|
|
1333
|
-
this._themeBtn.innerHTML = r ?
|
|
1343
|
+
this._themeBtn.innerHTML = r ? ie : re;
|
|
1334
1344
|
});
|
|
1335
1345
|
this._unsubscribers.push(t);
|
|
1336
1346
|
const i = this.state.on("change:mode", ({ value: r }) => {
|
|
@@ -1353,24 +1363,24 @@ class qe {
|
|
|
1353
1363
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], (e = this.element) == null || e.remove(), this.element = null;
|
|
1354
1364
|
}
|
|
1355
1365
|
}
|
|
1356
|
-
const
|
|
1357
|
-
{ id: "adjust", name: "Adjust", icon:
|
|
1366
|
+
const j = [
|
|
1367
|
+
{ id: "adjust", name: "Adjust", icon: Te },
|
|
1358
1368
|
// adjustment, adjustmentAdvanced, alpha
|
|
1359
|
-
{ id: "blur", name: "Blur", icon:
|
|
1369
|
+
{ id: "blur", name: "Blur", icon: Ie },
|
|
1360
1370
|
// blur, kawaseBlur, motionBlur, radialBlur, etc.
|
|
1361
|
-
{ id: "color", name: "Color", icon:
|
|
1371
|
+
{ id: "color", name: "Color", icon: Ee },
|
|
1362
1372
|
// colorOverlay, grayscale, hslAdjustment, etc.
|
|
1363
|
-
{ id: "effects", name: "Effects", icon:
|
|
1373
|
+
{ id: "effects", name: "Effects", icon: Xe },
|
|
1364
1374
|
// noise, vignette, pixelate, dropShadow, etc.
|
|
1365
|
-
{ id: "distortion", name: "Distortion", icon:
|
|
1375
|
+
{ id: "distortion", name: "Distortion", icon: Ye },
|
|
1366
1376
|
// twist, bulgePinch, displacement, etc.
|
|
1367
|
-
{ id: "light", name: "Light", icon:
|
|
1377
|
+
{ id: "light", name: "Light", icon: Be },
|
|
1368
1378
|
// bloom, glow, godray, advancedBloom
|
|
1369
|
-
{ id: "stylize", name: "Stylize", icon:
|
|
1379
|
+
{ id: "stylize", name: "Stylize", icon: qe },
|
|
1370
1380
|
// ascii, crt, crossHatch, dot, emboss
|
|
1371
|
-
{ id: "crop", name: "Crop", icon:
|
|
1381
|
+
{ id: "crop", name: "Crop", icon: ge }
|
|
1372
1382
|
];
|
|
1373
|
-
class
|
|
1383
|
+
class $e {
|
|
1374
1384
|
constructor(e, t) {
|
|
1375
1385
|
this.state = e, this.editor = t, this.element = null, this._chips = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [];
|
|
1376
1386
|
}
|
|
@@ -1383,21 +1393,21 @@ class He {
|
|
|
1383
1393
|
this._onSelect = e, this.element = u("div", {
|
|
1384
1394
|
className: "category-carousel-container",
|
|
1385
1395
|
"data-testid": "category-carousel"
|
|
1386
|
-
}), this._leftBtn =
|
|
1387
|
-
icon:
|
|
1396
|
+
}), this._leftBtn = C({
|
|
1397
|
+
icon: fe,
|
|
1388
1398
|
title: "Previous categories",
|
|
1389
1399
|
className: "carousel-nav carousel-nav-left",
|
|
1390
1400
|
onClick: () => this._scrollLeft()
|
|
1391
|
-
}), this._carousel = u("div", { className: "category-carousel" }),
|
|
1392
|
-
const r =
|
|
1401
|
+
}), this._carousel = u("div", { className: "category-carousel" }), j.forEach((i) => {
|
|
1402
|
+
const r = J({
|
|
1393
1403
|
label: i.name,
|
|
1394
1404
|
icon: i.icon,
|
|
1395
1405
|
active: this.state.get("selectedCategory") === i.id,
|
|
1396
1406
|
onClick: () => this._selectCategory(i.id)
|
|
1397
1407
|
});
|
|
1398
1408
|
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);
|
|
1399
|
-
}), this._rightBtn =
|
|
1400
|
-
icon:
|
|
1409
|
+
}), this._rightBtn = C({
|
|
1410
|
+
icon: me,
|
|
1401
1411
|
title: "Next categories",
|
|
1402
1412
|
className: "carousel-nav carousel-nav-right",
|
|
1403
1413
|
onClick: () => this._scrollRight()
|
|
@@ -1406,7 +1416,7 @@ class He {
|
|
|
1406
1416
|
role: "tablist",
|
|
1407
1417
|
"aria-label": "Category pages"
|
|
1408
1418
|
});
|
|
1409
|
-
const t = Math.ceil(
|
|
1419
|
+
const t = Math.ceil(j.length / 3);
|
|
1410
1420
|
for (let i = 0; i < t; i++) {
|
|
1411
1421
|
const r = u("button", {
|
|
1412
1422
|
type: "button",
|
|
@@ -1453,7 +1463,7 @@ class He {
|
|
|
1453
1463
|
* Scroll carousel right
|
|
1454
1464
|
*/
|
|
1455
1465
|
_scrollRight() {
|
|
1456
|
-
this._scrollIndex <
|
|
1466
|
+
this._scrollIndex < j.length - 3 && (this._scrollIndex++, this._scrollCarousel());
|
|
1457
1467
|
}
|
|
1458
1468
|
/**
|
|
1459
1469
|
* Scroll to a specific page
|
|
@@ -1480,7 +1490,7 @@ class He {
|
|
|
1480
1490
|
* Update navigation button states
|
|
1481
1491
|
*/
|
|
1482
1492
|
_updateNavButtons() {
|
|
1483
|
-
this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >=
|
|
1493
|
+
this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >= j.length - 3);
|
|
1484
1494
|
}
|
|
1485
1495
|
/**
|
|
1486
1496
|
* Update pagination dot states
|
|
@@ -1509,7 +1519,7 @@ class He {
|
|
|
1509
1519
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1510
1520
|
}
|
|
1511
1521
|
}
|
|
1512
|
-
class
|
|
1522
|
+
class We {
|
|
1513
1523
|
constructor(e, t) {
|
|
1514
1524
|
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;
|
|
1515
1525
|
}
|
|
@@ -1519,13 +1529,13 @@ class $e {
|
|
|
1519
1529
|
* @returns {HTMLElement}
|
|
1520
1530
|
*/
|
|
1521
1531
|
render({ onToggle: e, onSelect: t }) {
|
|
1522
|
-
return this._onToggle = e, this._onSelect = t, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn =
|
|
1523
|
-
icon:
|
|
1532
|
+
return this._onToggle = e, this._onSelect = t, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn = C({
|
|
1533
|
+
icon: fe,
|
|
1524
1534
|
title: "Previous filters",
|
|
1525
1535
|
className: "carousel-nav carousel-nav-left",
|
|
1526
1536
|
onClick: () => this._scrollLeft()
|
|
1527
|
-
}), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn =
|
|
1528
|
-
icon:
|
|
1537
|
+
}), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn = C({
|
|
1538
|
+
icon: me,
|
|
1529
1539
|
title: "Next filters",
|
|
1530
1540
|
className: "carousel-nav carousel-nav-right",
|
|
1531
1541
|
onClick: () => this._scrollRight()
|
|
@@ -1587,7 +1597,7 @@ class $e {
|
|
|
1587
1597
|
this._handleToggle(e.id, h), h && (this.state.set("selectedFilter", e.id), (p = this._onSelect) == null || p.call(this, e.id));
|
|
1588
1598
|
}
|
|
1589
1599
|
});
|
|
1590
|
-
return l.innerHTML = t ?
|
|
1600
|
+
return l.innerHTML = t ? ee : "", r.appendChild(a), r.appendChild(n), r.appendChild(l), r._toggle = l, r._isActive = t, r;
|
|
1591
1601
|
}
|
|
1592
1602
|
/**
|
|
1593
1603
|
* Handle filter card click (select)
|
|
@@ -1613,7 +1623,7 @@ class $e {
|
|
|
1613
1623
|
const e = this.state.get("activeFilters");
|
|
1614
1624
|
this._filterCards.forEach((t, i) => {
|
|
1615
1625
|
const r = e.has(i);
|
|
1616
|
-
t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ?
|
|
1626
|
+
t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ? ee : "", t._isActive = r;
|
|
1617
1627
|
});
|
|
1618
1628
|
}
|
|
1619
1629
|
/**
|
|
@@ -1666,7 +1676,7 @@ class $e {
|
|
|
1666
1676
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterCards.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1667
1677
|
}
|
|
1668
1678
|
}
|
|
1669
|
-
class
|
|
1679
|
+
class Ze {
|
|
1670
1680
|
constructor(e, t) {
|
|
1671
1681
|
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 = [];
|
|
1672
1682
|
}
|
|
@@ -1711,7 +1721,7 @@ class We {
|
|
|
1711
1721
|
return;
|
|
1712
1722
|
}
|
|
1713
1723
|
const i = u("div", { className: "adjustments-header" });
|
|
1714
|
-
i.appendChild(u("span", { className: "adjustments-title" }, t.name)), i.appendChild(
|
|
1724
|
+
i.appendChild(u("span", { className: "adjustments-title" }, t.name)), i.appendChild(N({
|
|
1715
1725
|
label: "Reset",
|
|
1716
1726
|
className: "btn-text",
|
|
1717
1727
|
onClick: () => this._handleReset(e)
|
|
@@ -1734,7 +1744,7 @@ class We {
|
|
|
1734
1744
|
const r = t.label || t.id;
|
|
1735
1745
|
switch (this._normalizeControlType(t.type)) {
|
|
1736
1746
|
case "slider":
|
|
1737
|
-
return
|
|
1747
|
+
return he({
|
|
1738
1748
|
id: `${e}-${t.id}`,
|
|
1739
1749
|
label: r,
|
|
1740
1750
|
min: t.min ?? 0,
|
|
@@ -1744,14 +1754,14 @@ class We {
|
|
|
1744
1754
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1745
1755
|
});
|
|
1746
1756
|
case "toggle":
|
|
1747
|
-
return
|
|
1757
|
+
return de({
|
|
1748
1758
|
id: `${e}-${t.id}`,
|
|
1749
1759
|
label: r,
|
|
1750
1760
|
checked: !!i,
|
|
1751
1761
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1752
1762
|
});
|
|
1753
1763
|
case "color":
|
|
1754
|
-
return
|
|
1764
|
+
return ue({
|
|
1755
1765
|
id: `${e}-${t.id}`,
|
|
1756
1766
|
label: r,
|
|
1757
1767
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -1759,7 +1769,7 @@ class We {
|
|
|
1759
1769
|
});
|
|
1760
1770
|
case "select":
|
|
1761
1771
|
const o = this._normalizeOptions(t.options);
|
|
1762
|
-
return
|
|
1772
|
+
return pe({
|
|
1763
1773
|
id: `${e}-${t.id}`,
|
|
1764
1774
|
label: r,
|
|
1765
1775
|
options: o,
|
|
@@ -1768,7 +1778,7 @@ class We {
|
|
|
1768
1778
|
});
|
|
1769
1779
|
case "button":
|
|
1770
1780
|
const n = u("div", { className: "button-control" });
|
|
1771
|
-
return n.appendChild(
|
|
1781
|
+
return n.appendChild(N({
|
|
1772
1782
|
label: r,
|
|
1773
1783
|
className: "btn-secondary",
|
|
1774
1784
|
onClick: () => this._handleAction(e, t.action || t.id)
|
|
@@ -1869,7 +1879,7 @@ class We {
|
|
|
1869
1879
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._controls.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1870
1880
|
}
|
|
1871
1881
|
}
|
|
1872
|
-
class
|
|
1882
|
+
class Ge {
|
|
1873
1883
|
constructor(e, t) {
|
|
1874
1884
|
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;
|
|
1875
1885
|
}
|
|
@@ -1882,22 +1892,22 @@ class Ze {
|
|
|
1882
1892
|
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = u("div", { className: "mobile-filter-drawer" });
|
|
1883
1893
|
const o = u("div", { className: "drawer-header" });
|
|
1884
1894
|
this._titleEl = u("span", { className: "drawer-title" }, "Filter");
|
|
1885
|
-
const n = u("div", { className: "drawer-header-actions" }), l =
|
|
1895
|
+
const n = u("div", { className: "drawer-header-actions" }), l = N({
|
|
1886
1896
|
label: "Reset",
|
|
1887
1897
|
className: "btn-text",
|
|
1888
1898
|
onClick: () => {
|
|
1889
1899
|
var h;
|
|
1890
1900
|
this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
|
|
1891
1901
|
}
|
|
1892
|
-
}), c =
|
|
1902
|
+
}), c = N({
|
|
1893
1903
|
label: "Remove",
|
|
1894
1904
|
className: "btn-text btn-danger",
|
|
1895
1905
|
onClick: () => {
|
|
1896
1906
|
var h;
|
|
1897
1907
|
this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
|
|
1898
1908
|
}
|
|
1899
|
-
}), d =
|
|
1900
|
-
icon:
|
|
1909
|
+
}), d = C({
|
|
1910
|
+
icon: te,
|
|
1901
1911
|
title: "Close",
|
|
1902
1912
|
className: "btn-icon-sm",
|
|
1903
1913
|
ariaLabel: "Close drawer",
|
|
@@ -1971,7 +1981,7 @@ class Ze {
|
|
|
1971
1981
|
const r = t.label || t.id;
|
|
1972
1982
|
switch (this._normalizeControlType(t.type)) {
|
|
1973
1983
|
case "slider":
|
|
1974
|
-
return
|
|
1984
|
+
return he({
|
|
1975
1985
|
id: `drawer-${e}-${t.id}`,
|
|
1976
1986
|
label: r,
|
|
1977
1987
|
min: t.min ?? 0,
|
|
@@ -1984,7 +1994,7 @@ class Ze {
|
|
|
1984
1994
|
}
|
|
1985
1995
|
});
|
|
1986
1996
|
case "toggle":
|
|
1987
|
-
return
|
|
1997
|
+
return de({
|
|
1988
1998
|
id: `drawer-${e}-${t.id}`,
|
|
1989
1999
|
label: r,
|
|
1990
2000
|
checked: !!i,
|
|
@@ -1994,7 +2004,7 @@ class Ze {
|
|
|
1994
2004
|
}
|
|
1995
2005
|
});
|
|
1996
2006
|
case "color":
|
|
1997
|
-
return
|
|
2007
|
+
return ue({
|
|
1998
2008
|
id: `drawer-${e}-${t.id}`,
|
|
1999
2009
|
label: r,
|
|
2000
2010
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
@@ -2005,7 +2015,7 @@ class Ze {
|
|
|
2005
2015
|
});
|
|
2006
2016
|
case "select": {
|
|
2007
2017
|
const o = this._normalizeOptions(t.options);
|
|
2008
|
-
return
|
|
2018
|
+
return pe({
|
|
2009
2019
|
id: `drawer-${e}-${t.id}`,
|
|
2010
2020
|
label: r,
|
|
2011
2021
|
options: o,
|
|
@@ -2018,7 +2028,7 @@ class Ze {
|
|
|
2018
2028
|
}
|
|
2019
2029
|
case "button": {
|
|
2020
2030
|
const o = u("div", { className: "button-control" });
|
|
2021
|
-
return o.appendChild(
|
|
2031
|
+
return o.appendChild(N({
|
|
2022
2032
|
label: r,
|
|
2023
2033
|
className: "btn-secondary",
|
|
2024
2034
|
onClick: () => {
|
|
@@ -2065,7 +2075,7 @@ class Ze {
|
|
|
2065
2075
|
this._controls.clear(), (e = this._drawer) == null || e.remove(), this._drawer = null, this._isOpen = !1, this._currentFilterId = null, this._container = null;
|
|
2066
2076
|
}
|
|
2067
2077
|
}
|
|
2068
|
-
class
|
|
2078
|
+
class Ke {
|
|
2069
2079
|
constructor(e, t) {
|
|
2070
2080
|
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;
|
|
2071
2081
|
}
|
|
@@ -2138,11 +2148,11 @@ class Ge {
|
|
|
2138
2148
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2139
2149
|
}
|
|
2140
2150
|
}
|
|
2141
|
-
const
|
|
2142
|
-
{ id: "free", name: "Free", icon:
|
|
2143
|
-
{ id: "square", name: "Square", icon:
|
|
2144
|
-
{ id: "circle", name: "Circle", icon:
|
|
2145
|
-
],
|
|
2151
|
+
const Qe = [
|
|
2152
|
+
{ id: "free", name: "Free", icon: je },
|
|
2153
|
+
{ id: "square", name: "Square", icon: Ue },
|
|
2154
|
+
{ id: "circle", name: "Circle", icon: Ve }
|
|
2155
|
+
], Je = [
|
|
2146
2156
|
{ id: "free", name: "Free" },
|
|
2147
2157
|
{ id: "1:1", name: "1:1" },
|
|
2148
2158
|
{ id: "4:3", name: "4:3" },
|
|
@@ -2150,7 +2160,7 @@ const Ke = [
|
|
|
2150
2160
|
{ id: "3:2", name: "3:2" },
|
|
2151
2161
|
{ id: "2:3", name: "2:3" }
|
|
2152
2162
|
];
|
|
2153
|
-
class
|
|
2163
|
+
class et {
|
|
2154
2164
|
constructor(e, t) {
|
|
2155
2165
|
this.state = e, this.cropManager = t, this.element = null, this._shapeChips = /* @__PURE__ */ new Map(), this._aspectChips = /* @__PURE__ */ new Map(), this._unsubscribers = [];
|
|
2156
2166
|
}
|
|
@@ -2174,8 +2184,8 @@ class Je {
|
|
|
2174
2184
|
const e = u("div", { className: "crop-section" });
|
|
2175
2185
|
e.appendChild(u("label", { className: "section-label" }, "Shape"));
|
|
2176
2186
|
const t = u("div", { className: "chip-row" }), i = this.state.get("crop.shape");
|
|
2177
|
-
|
|
2178
|
-
const d =
|
|
2187
|
+
Qe.forEach((c) => {
|
|
2188
|
+
const d = J({
|
|
2179
2189
|
label: c.name,
|
|
2180
2190
|
icon: c.icon,
|
|
2181
2191
|
active: i === c.id,
|
|
@@ -2184,25 +2194,25 @@ class Je {
|
|
|
2184
2194
|
d.dataset.shape = c.id, d.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, d), t.appendChild(d);
|
|
2185
2195
|
}), 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"));
|
|
2186
2196
|
const r = u("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
|
|
2187
|
-
|
|
2188
|
-
const d =
|
|
2197
|
+
Je.forEach((c) => {
|
|
2198
|
+
const d = J({
|
|
2189
2199
|
label: c.name,
|
|
2190
2200
|
active: a === c.id,
|
|
2191
2201
|
onClick: () => this._selectAspect(c.id)
|
|
2192
2202
|
});
|
|
2193
2203
|
d.dataset.ratio = c.id, d.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, d), r.appendChild(d);
|
|
2194
2204
|
}), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
|
|
2195
|
-
const o = u("div", { className: "crop-actions" }), n =
|
|
2205
|
+
const o = u("div", { className: "crop-actions" }), n = N({
|
|
2196
2206
|
label: "Cancel",
|
|
2197
2207
|
className: "btn-secondary crop-cancel-btn",
|
|
2198
|
-
icon:
|
|
2208
|
+
icon: te,
|
|
2199
2209
|
onClick: () => this.cropManager.cancel()
|
|
2200
2210
|
});
|
|
2201
2211
|
n.dataset.testid = "cancel-crop";
|
|
2202
|
-
const l =
|
|
2212
|
+
const l = N({
|
|
2203
2213
|
label: "Apply Crop",
|
|
2204
2214
|
className: "btn-primary crop-apply-btn",
|
|
2205
|
-
icon:
|
|
2215
|
+
icon: ee,
|
|
2206
2216
|
onClick: () => this._applyCropAndReturnToFilters()
|
|
2207
2217
|
});
|
|
2208
2218
|
return l.dataset.testid = "apply-crop", o.appendChild(n), o.appendChild(l), this.element.appendChild(o), this._subscribeToState(), this.element;
|
|
@@ -2265,7 +2275,7 @@ class Je {
|
|
|
2265
2275
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._shapeChips.clear(), this._aspectChips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2266
2276
|
}
|
|
2267
2277
|
}
|
|
2268
|
-
class
|
|
2278
|
+
class tt {
|
|
2269
2279
|
constructor(e, t) {
|
|
2270
2280
|
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;
|
|
2271
2281
|
}
|
|
@@ -2281,7 +2291,7 @@ class et {
|
|
|
2281
2291
|
});
|
|
2282
2292
|
const o = u("div", { className: "panel-header" });
|
|
2283
2293
|
o.appendChild(u("h3", { className: "panel-title" }, "Active Filters"));
|
|
2284
|
-
const n =
|
|
2294
|
+
const n = N({
|
|
2285
2295
|
label: "Clear All",
|
|
2286
2296
|
className: "btn-text btn-danger",
|
|
2287
2297
|
onClick: () => this._handleClearAll()
|
|
@@ -2344,16 +2354,16 @@ class et {
|
|
|
2344
2354
|
className: `active-filter-item ${r ? "selected" : ""}`,
|
|
2345
2355
|
"data-active-filter": e,
|
|
2346
2356
|
"data-testid": `active-filter-${e}`,
|
|
2347
|
-
onClick: (
|
|
2348
|
-
|
|
2357
|
+
onClick: (f) => {
|
|
2358
|
+
f.target.closest(".filter-item-actions") || this._handleSelect(e);
|
|
2349
2359
|
}
|
|
2350
|
-
}), o = u("div", { className: "filter-item-header" }), n = u("span", { className: "filter-item-name" }, t.name), l = u("div", { className: "filter-item-actions" }), c =
|
|
2351
|
-
icon:
|
|
2360
|
+
}), o = u("div", { className: "filter-item-header" }), n = u("span", { className: "filter-item-name" }, t.name), l = u("div", { className: "filter-item-actions" }), c = C({
|
|
2361
|
+
icon: be,
|
|
2352
2362
|
title: "Reset filter",
|
|
2353
2363
|
className: "btn-icon-sm",
|
|
2354
2364
|
onClick: () => this._handleReset(e)
|
|
2355
|
-
}), d =
|
|
2356
|
-
icon:
|
|
2365
|
+
}), d = C({
|
|
2366
|
+
icon: Le,
|
|
2357
2367
|
title: "Remove filter",
|
|
2358
2368
|
className: "btn-icon-sm btn-danger",
|
|
2359
2369
|
onClick: () => this._handleRemove(e)
|
|
@@ -2466,7 +2476,7 @@ class et {
|
|
|
2466
2476
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterItems.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2467
2477
|
}
|
|
2468
2478
|
}
|
|
2469
|
-
const
|
|
2479
|
+
const D = {
|
|
2470
2480
|
name: "free",
|
|
2471
2481
|
initialMode: "filters",
|
|
2472
2482
|
cropShape: "free",
|
|
@@ -2478,12 +2488,12 @@ const B = {
|
|
|
2478
2488
|
showCropControls: !0,
|
|
2479
2489
|
maxExportWidth: void 0,
|
|
2480
2490
|
maxExportHeight: void 0
|
|
2481
|
-
},
|
|
2491
|
+
}, G = {
|
|
2482
2492
|
free: {
|
|
2483
|
-
...
|
|
2493
|
+
...D
|
|
2484
2494
|
},
|
|
2485
2495
|
avatar: {
|
|
2486
|
-
...
|
|
2496
|
+
...D,
|
|
2487
2497
|
name: "avatar",
|
|
2488
2498
|
initialMode: "crop",
|
|
2489
2499
|
cropShape: "circle",
|
|
@@ -2493,7 +2503,7 @@ const B = {
|
|
|
2493
2503
|
lockAspectRatio: !0
|
|
2494
2504
|
},
|
|
2495
2505
|
banner: {
|
|
2496
|
-
...
|
|
2506
|
+
...D,
|
|
2497
2507
|
name: "banner",
|
|
2498
2508
|
initialMode: "crop",
|
|
2499
2509
|
cropShape: "square",
|
|
@@ -2503,7 +2513,7 @@ const B = {
|
|
|
2503
2513
|
lockAspectRatio: !0
|
|
2504
2514
|
},
|
|
2505
2515
|
product: {
|
|
2506
|
-
...
|
|
2516
|
+
...D,
|
|
2507
2517
|
name: "product",
|
|
2508
2518
|
initialMode: "filters",
|
|
2509
2519
|
cropShape: "square",
|
|
@@ -2513,15 +2523,15 @@ const B = {
|
|
|
2513
2523
|
lockAspectRatio: !1
|
|
2514
2524
|
}
|
|
2515
2525
|
};
|
|
2516
|
-
function
|
|
2526
|
+
function it(s) {
|
|
2517
2527
|
if (!s)
|
|
2518
|
-
return { ...
|
|
2528
|
+
return { ...G.free };
|
|
2519
2529
|
if (typeof s == "object" && s !== null)
|
|
2520
|
-
return { ...
|
|
2521
|
-
const e =
|
|
2522
|
-
return e ? { ...e } : { ...
|
|
2530
|
+
return { ...D, ...s };
|
|
2531
|
+
const e = G[s];
|
|
2532
|
+
return e ? { ...e } : { ...G.free };
|
|
2523
2533
|
}
|
|
2524
|
-
class ii extends
|
|
2534
|
+
class ii extends U {
|
|
2525
2535
|
/**
|
|
2526
2536
|
* Create a new VanillaImageEditor
|
|
2527
2537
|
* @param {HTMLElement} container - Container element to mount the editor
|
|
@@ -2532,7 +2542,7 @@ class ii extends O {
|
|
|
2532
2542
|
if (super(), !e)
|
|
2533
2543
|
throw new Error("VanillaImageEditor: container element is required");
|
|
2534
2544
|
this._container = e, this._destroyed = !1, this._loadVersion = 0, this._objectUrls = /* @__PURE__ */ new Set();
|
|
2535
|
-
const i = t.preset ?
|
|
2545
|
+
const i = t.preset ? it(t.preset) : null, r = i ? {
|
|
2536
2546
|
initialMode: i.initialMode === "crop" ? "crop" : "adjust",
|
|
2537
2547
|
cropShape: i.cropShape,
|
|
2538
2548
|
initialAspectRatio: i.aspectRatio
|
|
@@ -2550,7 +2560,7 @@ class ii extends O {
|
|
|
2550
2560
|
},
|
|
2551
2561
|
...r,
|
|
2552
2562
|
...t
|
|
2553
|
-
}, this._preset = i, this._state =
|
|
2563
|
+
}, this._preset = i, this._state = ke(), 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 Pe(), this._filterManager = new Fe(this._state, this._renderer), this._cropManager = new Q(this._state, this._renderer), this._removeBgManager = null, ((a = this._options.backgroundRemoval) == null ? void 0 : a.enabled) !== !1 && (this._removeBgManager = new Ae({
|
|
2554
2564
|
endpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.endpoint,
|
|
2555
2565
|
fallbackEndpoint: (n = this._options.backgroundRemoval) == null ? void 0 : n.fallbackEndpoint
|
|
2556
2566
|
})), 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();
|
|
@@ -2586,31 +2596,31 @@ class ii extends O {
|
|
|
2586
2596
|
* Initialize UI components
|
|
2587
2597
|
*/
|
|
2588
2598
|
_initUI() {
|
|
2589
|
-
this._toolbar = new
|
|
2599
|
+
this._toolbar = new He(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = u("div", { className: "filter-controls-container" }), this._categoryCarousel = new $e(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
|
|
2590
2600
|
}));
|
|
2591
2601
|
const e = u("div", { className: "filter-layout" }), t = u("div", { className: "filter-left-column" });
|
|
2592
|
-
this._filterCarousel = new
|
|
2602
|
+
this._filterCarousel = new We(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
|
|
2593
2603
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2594
2604
|
onSelect: (r) => {
|
|
2595
2605
|
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2596
2606
|
}
|
|
2597
|
-
})), this._filterAdjustments = new
|
|
2607
|
+
})), this._filterAdjustments = new Ze(this._state, this._filterManager), t.appendChild(this._filterAdjustments.render({
|
|
2598
2608
|
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2599
2609
|
onReset: (r) => this._handleFilterReset(r),
|
|
2600
2610
|
onAction: (r, a) => this._handleFilterAction(r, a)
|
|
2601
2611
|
})), e.appendChild(t);
|
|
2602
2612
|
const i = u("div", { className: "filter-right-column" });
|
|
2603
|
-
this._activeFiltersPanel = new
|
|
2613
|
+
this._activeFiltersPanel = new tt(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
|
|
2604
2614
|
onRemove: (r) => this._handleFilterToggle(r, !1),
|
|
2605
2615
|
onReset: (r) => this._handleFilterReset(r),
|
|
2606
2616
|
onClearAll: () => this.resetAll(),
|
|
2607
2617
|
onSelect: (r) => this._handleFilterSelect(r)
|
|
2608
|
-
})), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new
|
|
2618
|
+
})), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new Ke(this._state, this._filterManager), this._filterControlsEl.appendChild(this._mobileActiveFilters.render({
|
|
2609
2619
|
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2610
2620
|
onSelect: (r) => {
|
|
2611
2621
|
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2612
2622
|
}
|
|
2613
|
-
})), this._cropControls = new
|
|
2623
|
+
})), this._cropControls = new et(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 Ge(this._state, this._filterManager), this._mobileFilterDrawer.build(this._controlsSection, {
|
|
2614
2624
|
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2615
2625
|
onReset: (r) => this._handleFilterReset(r),
|
|
2616
2626
|
onRemove: (r) => {
|
|
@@ -2967,26 +2977,26 @@ class ii extends O {
|
|
|
2967
2977
|
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();
|
|
2968
2978
|
}
|
|
2969
2979
|
}
|
|
2970
|
-
const k = /* @__PURE__ */ new Map(),
|
|
2971
|
-
function
|
|
2980
|
+
const k = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
|
|
2981
|
+
function rt(s, e) {
|
|
2972
2982
|
return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
|
|
2973
2983
|
}
|
|
2974
|
-
function
|
|
2984
|
+
function m(s) {
|
|
2975
2985
|
var e;
|
|
2976
|
-
return k.has(s.id), k.set(s.id, s),
|
|
2986
|
+
return k.has(s.id), k.set(s.id, s), Y.has(s.category) || Y.set(s.category, []), (e = Y.get(s.category)) == null || e.push(s.id), s;
|
|
2977
2987
|
}
|
|
2978
|
-
function
|
|
2988
|
+
function st(s) {
|
|
2979
2989
|
return k.get(s);
|
|
2980
2990
|
}
|
|
2981
|
-
function
|
|
2991
|
+
function H() {
|
|
2982
2992
|
return Array.from(k.values());
|
|
2983
2993
|
}
|
|
2984
|
-
function
|
|
2985
|
-
|
|
2994
|
+
function at() {
|
|
2995
|
+
H().map((t) => t.id), Object.entries(b).filter(
|
|
2986
2996
|
(t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
|
|
2987
2997
|
).forEach(([t, i]) => {
|
|
2988
2998
|
const r = t.replace(/Filter$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2989
|
-
k.has(r) ||
|
|
2999
|
+
k.has(r) || m({
|
|
2990
3000
|
id: r,
|
|
2991
3001
|
name: t.replace(/Filter$/, ""),
|
|
2992
3002
|
category: "unlisted",
|
|
@@ -3005,32 +3015,32 @@ function st() {
|
|
|
3005
3015
|
});
|
|
3006
3016
|
});
|
|
3007
3017
|
}
|
|
3008
|
-
function
|
|
3009
|
-
return (
|
|
3018
|
+
function ot(s) {
|
|
3019
|
+
return (Y.get(s) || []).map((t) => k.get(t)).filter(Boolean);
|
|
3010
3020
|
}
|
|
3011
|
-
function
|
|
3012
|
-
return Array.from(
|
|
3021
|
+
function nt() {
|
|
3022
|
+
return Array.from(Y.keys());
|
|
3013
3023
|
}
|
|
3014
3024
|
function ri(s) {
|
|
3015
3025
|
return k.has(s);
|
|
3016
3026
|
}
|
|
3017
|
-
function
|
|
3027
|
+
function lt(s) {
|
|
3018
3028
|
const e = k.get(s);
|
|
3019
3029
|
if (!e)
|
|
3020
3030
|
return !1;
|
|
3021
3031
|
k.delete(s);
|
|
3022
|
-
const t =
|
|
3032
|
+
const t = Y.get(e.category);
|
|
3023
3033
|
if (t) {
|
|
3024
3034
|
const i = t.indexOf(s);
|
|
3025
|
-
i !== -1 && t.splice(i, 1), t.length === 0 &&
|
|
3035
|
+
i !== -1 && t.splice(i, 1), t.length === 0 && Y.delete(e.category);
|
|
3026
3036
|
}
|
|
3027
3037
|
return !0;
|
|
3028
3038
|
}
|
|
3029
3039
|
function si(s, e) {
|
|
3030
3040
|
const t = k.get(s);
|
|
3031
|
-
return t ?
|
|
3041
|
+
return t ? rt(t, e) : !1;
|
|
3032
3042
|
}
|
|
3033
|
-
function
|
|
3043
|
+
function ct() {
|
|
3034
3044
|
return Array.from(k.values()).map((s) => ({
|
|
3035
3045
|
id: s.id,
|
|
3036
3046
|
name: s.name,
|
|
@@ -3039,8 +3049,8 @@ function lt() {
|
|
|
3039
3049
|
}));
|
|
3040
3050
|
}
|
|
3041
3051
|
if (typeof window < "u") {
|
|
3042
|
-
window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), window.getAllFilters =
|
|
3043
|
-
const s =
|
|
3052
|
+
window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), window.getAllFilters = H, window.getFilter = st, window.getFiltersByCategory = ot, window.getRegisteredFilters = ct;
|
|
3053
|
+
const s = m;
|
|
3044
3054
|
window.registerFilter = (e) => {
|
|
3045
3055
|
const t = s(e);
|
|
3046
3056
|
return window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), t;
|
|
@@ -3049,7 +3059,7 @@ if (typeof window < "u") {
|
|
|
3049
3059
|
typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
|
|
3050
3060
|
return [];
|
|
3051
3061
|
});
|
|
3052
|
-
const { AdjustmentFilter:
|
|
3062
|
+
const { AdjustmentFilter: ht } = b, { ColorMatrixFilter: dt } = w, A = {
|
|
3053
3063
|
gamma: 1,
|
|
3054
3064
|
saturation: 1,
|
|
3055
3065
|
contrast: 1,
|
|
@@ -3058,7 +3068,7 @@ const { AdjustmentFilter: ct } = b, { ColorMatrixFilter: ht } = S, F = {
|
|
|
3058
3068
|
green: 1,
|
|
3059
3069
|
blue: 1,
|
|
3060
3070
|
alpha: 1
|
|
3061
|
-
},
|
|
3071
|
+
}, ut = /* @__PURE__ */ new Set([
|
|
3062
3072
|
"gamma",
|
|
3063
3073
|
"saturation",
|
|
3064
3074
|
"contrast",
|
|
@@ -3068,7 +3078,7 @@ const { AdjustmentFilter: ct } = b, { ColorMatrixFilter: ht } = S, F = {
|
|
|
3068
3078
|
"blue",
|
|
3069
3079
|
"alpha"
|
|
3070
3080
|
]);
|
|
3071
|
-
function
|
|
3081
|
+
function z(s, e) {
|
|
3072
3082
|
if (typeof s == "number" && Number.isFinite(s))
|
|
3073
3083
|
return s;
|
|
3074
3084
|
if (typeof s == "string") {
|
|
@@ -3078,25 +3088,25 @@ function A(s, e) {
|
|
|
3078
3088
|
}
|
|
3079
3089
|
return e;
|
|
3080
3090
|
}
|
|
3081
|
-
function
|
|
3082
|
-
return
|
|
3091
|
+
function se(s) {
|
|
3092
|
+
return ut.has(s);
|
|
3083
3093
|
}
|
|
3084
|
-
function
|
|
3094
|
+
function pt(s) {
|
|
3085
3095
|
return {
|
|
3086
|
-
gamma:
|
|
3087
|
-
saturation:
|
|
3088
|
-
contrast:
|
|
3089
|
-
brightness:
|
|
3090
|
-
red:
|
|
3091
|
-
green:
|
|
3092
|
-
blue:
|
|
3093
|
-
alpha:
|
|
3096
|
+
gamma: z(s.gamma, A.gamma),
|
|
3097
|
+
saturation: z(s.saturation, A.saturation),
|
|
3098
|
+
contrast: z(s.contrast, A.contrast),
|
|
3099
|
+
brightness: z(s.brightness, A.brightness),
|
|
3100
|
+
red: z(s.red, A.red),
|
|
3101
|
+
green: z(s.green, A.green),
|
|
3102
|
+
blue: z(s.blue, A.blue),
|
|
3103
|
+
alpha: z(s.alpha, A.alpha)
|
|
3094
3104
|
};
|
|
3095
3105
|
}
|
|
3096
|
-
function
|
|
3106
|
+
function ae(s, e) {
|
|
3097
3107
|
s.reset(), s.brightness(e.brightness, !0), s.contrast(e.contrast, !0), s.saturate(e.saturation, !0);
|
|
3098
3108
|
}
|
|
3099
|
-
|
|
3109
|
+
m({
|
|
3100
3110
|
id: "adjustment",
|
|
3101
3111
|
name: "Adjustment",
|
|
3102
3112
|
category: "adjust",
|
|
@@ -3104,14 +3114,14 @@ f({
|
|
|
3104
3114
|
// Create an instance of the AdjustmentFilter with the provided parameters
|
|
3105
3115
|
createFilter: (s) => {
|
|
3106
3116
|
try {
|
|
3107
|
-
const e =
|
|
3117
|
+
const e = pt(s ?? {}), t = { ...e };
|
|
3108
3118
|
try {
|
|
3109
|
-
const i = new
|
|
3119
|
+
const i = new ht(t), r = i;
|
|
3110
3120
|
return r._customParams = { ...e }, r.updateUIParam = function(o, n) {
|
|
3111
3121
|
try {
|
|
3112
|
-
if (!
|
|
3122
|
+
if (!se(o))
|
|
3113
3123
|
return;
|
|
3114
|
-
const l = this._customParams ?? { ...
|
|
3124
|
+
const l = this._customParams ?? { ...A }, c = z(n, l[o]);
|
|
3115
3125
|
l[o] = c, this._customParams = l;
|
|
3116
3126
|
const d = this;
|
|
3117
3127
|
o in d && (d[o] = c);
|
|
@@ -3119,13 +3129,13 @@ f({
|
|
|
3119
3129
|
}
|
|
3120
3130
|
}, i;
|
|
3121
3131
|
} catch {
|
|
3122
|
-
const r = new
|
|
3123
|
-
return a._customParams = { ...e },
|
|
3132
|
+
const r = new dt(), a = r;
|
|
3133
|
+
return a._customParams = { ...e }, ae(r, e), a.updateUIParam = function(n, l) {
|
|
3124
3134
|
try {
|
|
3125
|
-
if (!
|
|
3135
|
+
if (!se(n))
|
|
3126
3136
|
return;
|
|
3127
|
-
const c = this._customParams ?? { ...
|
|
3128
|
-
c[n] = d, this._customParams = c,
|
|
3137
|
+
const c = this._customParams ?? { ...A }, d = z(l, c[n]);
|
|
3138
|
+
c[n] = d, this._customParams = c, ae(this, c);
|
|
3129
3139
|
} catch {
|
|
3130
3140
|
}
|
|
3131
3141
|
}, r;
|
|
@@ -3229,14 +3239,14 @@ f({
|
|
|
3229
3239
|
}
|
|
3230
3240
|
]
|
|
3231
3241
|
});
|
|
3232
|
-
const { ColorMatrixFilter:
|
|
3242
|
+
const { ColorMatrixFilter: ft } = w, E = {
|
|
3233
3243
|
brightness: 1,
|
|
3234
3244
|
contrast: 1,
|
|
3235
3245
|
saturation: 1,
|
|
3236
3246
|
hue: 0,
|
|
3237
3247
|
sepia: 0,
|
|
3238
3248
|
negative: !1
|
|
3239
|
-
},
|
|
3249
|
+
}, mt = /* @__PURE__ */ new Set([
|
|
3240
3250
|
"brightness",
|
|
3241
3251
|
"contrast",
|
|
3242
3252
|
"saturation",
|
|
@@ -3244,10 +3254,10 @@ const { ColorMatrixFilter: pt } = S, T = {
|
|
|
3244
3254
|
"sepia",
|
|
3245
3255
|
"negative"
|
|
3246
3256
|
]);
|
|
3247
|
-
function
|
|
3248
|
-
return
|
|
3257
|
+
function gt(s) {
|
|
3258
|
+
return mt.has(s);
|
|
3249
3259
|
}
|
|
3250
|
-
function
|
|
3260
|
+
function L(s, e) {
|
|
3251
3261
|
if (typeof s == "number" && Number.isFinite(s))
|
|
3252
3262
|
return s;
|
|
3253
3263
|
if (typeof s == "string") {
|
|
@@ -3257,7 +3267,7 @@ function Y(s, e) {
|
|
|
3257
3267
|
}
|
|
3258
3268
|
return e;
|
|
3259
3269
|
}
|
|
3260
|
-
function
|
|
3270
|
+
function ye(s, e) {
|
|
3261
3271
|
if (typeof s == "boolean")
|
|
3262
3272
|
return s;
|
|
3263
3273
|
if (typeof s == "string") {
|
|
@@ -3268,20 +3278,20 @@ function fe(s, e) {
|
|
|
3268
3278
|
}
|
|
3269
3279
|
return e;
|
|
3270
3280
|
}
|
|
3271
|
-
function
|
|
3281
|
+
function bt(s) {
|
|
3272
3282
|
return {
|
|
3273
|
-
brightness:
|
|
3274
|
-
contrast:
|
|
3275
|
-
saturation:
|
|
3276
|
-
hue:
|
|
3277
|
-
sepia:
|
|
3278
|
-
negative:
|
|
3283
|
+
brightness: L(s.brightness, E.brightness),
|
|
3284
|
+
contrast: L(s.contrast, E.contrast),
|
|
3285
|
+
saturation: L(s.saturation, E.saturation),
|
|
3286
|
+
hue: L(s.hue, E.hue),
|
|
3287
|
+
sepia: L(s.sepia, E.sepia),
|
|
3288
|
+
negative: ye(s.negative, E.negative)
|
|
3279
3289
|
};
|
|
3280
3290
|
}
|
|
3281
|
-
function
|
|
3291
|
+
function oe(s, e) {
|
|
3282
3292
|
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);
|
|
3283
3293
|
}
|
|
3284
|
-
|
|
3294
|
+
m({
|
|
3285
3295
|
id: "adjustment-advanced",
|
|
3286
3296
|
name: "Advanced Adjustment",
|
|
3287
3297
|
category: "adjust",
|
|
@@ -3289,19 +3299,19 @@ f({
|
|
|
3289
3299
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
3290
3300
|
createFilter: (s) => {
|
|
3291
3301
|
try {
|
|
3292
|
-
const e =
|
|
3293
|
-
return i._customParams = { ...e },
|
|
3302
|
+
const e = bt(s ?? {}), t = new ft(), i = t;
|
|
3303
|
+
return i._customParams = { ...e }, oe(t, e), i.updateUIParam = function(a, o) {
|
|
3294
3304
|
try {
|
|
3295
|
-
if (!
|
|
3305
|
+
if (!gt(a))
|
|
3296
3306
|
return;
|
|
3297
|
-
const n = this._customParams ?? { ...
|
|
3307
|
+
const n = this._customParams ?? { ...E };
|
|
3298
3308
|
if (a === "negative")
|
|
3299
|
-
n.negative =
|
|
3309
|
+
n.negative = ye(o, n.negative);
|
|
3300
3310
|
else {
|
|
3301
3311
|
const l = a;
|
|
3302
|
-
n[l] =
|
|
3312
|
+
n[l] = L(o, n[l]);
|
|
3303
3313
|
}
|
|
3304
|
-
this._customParams = n,
|
|
3314
|
+
this._customParams = n, oe(this, n);
|
|
3305
3315
|
} catch {
|
|
3306
3316
|
}
|
|
3307
3317
|
}, t;
|
|
@@ -3379,7 +3389,7 @@ f({
|
|
|
3379
3389
|
}
|
|
3380
3390
|
]
|
|
3381
3391
|
});
|
|
3382
|
-
|
|
3392
|
+
m({
|
|
3383
3393
|
id: "alpha",
|
|
3384
3394
|
name: "Alpha",
|
|
3385
3395
|
category: "adjust",
|
|
@@ -3387,7 +3397,7 @@ f({
|
|
|
3387
3397
|
// Create an instance of the ColorMatrixFilter with alpha adjustment
|
|
3388
3398
|
createFilter: (s) => {
|
|
3389
3399
|
try {
|
|
3390
|
-
const e = s.alpha !== void 0 ? s.alpha : 1, t = new
|
|
3400
|
+
const e = s.alpha !== void 0 ? s.alpha : 1, t = new w.ColorMatrixFilter();
|
|
3391
3401
|
return t.alpha = e, t._customParams = {
|
|
3392
3402
|
alpha: e
|
|
3393
3403
|
}, t.updateUIParam = function(i, r) {
|
|
@@ -3423,7 +3433,7 @@ f({
|
|
|
3423
3433
|
}
|
|
3424
3434
|
]
|
|
3425
3435
|
});
|
|
3426
|
-
|
|
3436
|
+
m({
|
|
3427
3437
|
id: "blur",
|
|
3428
3438
|
name: "Blur",
|
|
3429
3439
|
category: "blur",
|
|
@@ -3434,7 +3444,7 @@ f({
|
|
|
3434
3444
|
*/
|
|
3435
3445
|
createFilter: (s) => {
|
|
3436
3446
|
try {
|
|
3437
|
-
const e = new
|
|
3447
|
+
const e = new w.BlurFilter({
|
|
3438
3448
|
strength: s.blur || 8,
|
|
3439
3449
|
quality: s.quality || 4
|
|
3440
3450
|
});
|
|
@@ -3486,14 +3496,14 @@ f({
|
|
|
3486
3496
|
}
|
|
3487
3497
|
]
|
|
3488
3498
|
});
|
|
3489
|
-
|
|
3499
|
+
m({
|
|
3490
3500
|
id: "color-matrix",
|
|
3491
3501
|
name: "Color Matrix",
|
|
3492
3502
|
category: "advanced",
|
|
3493
3503
|
description: "Advanced color adjustments including sepia, hue rotation, and more",
|
|
3494
3504
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
3495
3505
|
createFilter: (s) => {
|
|
3496
|
-
const e =
|
|
3506
|
+
const e = w.ColorMatrixFilter;
|
|
3497
3507
|
if (!e)
|
|
3498
3508
|
return null;
|
|
3499
3509
|
const t = new e();
|
|
@@ -3573,8 +3583,8 @@ f({
|
|
|
3573
3583
|
}
|
|
3574
3584
|
]
|
|
3575
3585
|
});
|
|
3576
|
-
const { ColorOverlayFilter:
|
|
3577
|
-
|
|
3586
|
+
const { ColorOverlayFilter: yt } = b;
|
|
3587
|
+
m({
|
|
3578
3588
|
id: "colorOverlay",
|
|
3579
3589
|
name: "Color Overlay",
|
|
3580
3590
|
category: "color",
|
|
@@ -3588,7 +3598,7 @@ f({
|
|
|
3588
3598
|
try {
|
|
3589
3599
|
let e = 16711680;
|
|
3590
3600
|
s.color && (typeof s.color == "string" ? e = parseInt(s.color.replace("#", "0x"), 16) : typeof s.color == "number" && (e = s.color));
|
|
3591
|
-
const t = new
|
|
3601
|
+
const t = new yt({
|
|
3592
3602
|
color: e,
|
|
3593
3603
|
alpha: s.alpha || 0.5
|
|
3594
3604
|
});
|
|
@@ -3638,7 +3648,7 @@ f({
|
|
|
3638
3648
|
}
|
|
3639
3649
|
]
|
|
3640
3650
|
});
|
|
3641
|
-
|
|
3651
|
+
m({
|
|
3642
3652
|
id: "drop-shadow",
|
|
3643
3653
|
name: "Drop Shadow",
|
|
3644
3654
|
category: "effects",
|
|
@@ -3820,8 +3830,8 @@ f({
|
|
|
3820
3830
|
}
|
|
3821
3831
|
]
|
|
3822
3832
|
});
|
|
3823
|
-
const { ColorMatrixFilter:
|
|
3824
|
-
|
|
3833
|
+
const { ColorMatrixFilter: _t } = w;
|
|
3834
|
+
m({
|
|
3825
3835
|
id: "grayscale",
|
|
3826
3836
|
name: "Grayscale",
|
|
3827
3837
|
category: "color",
|
|
@@ -3833,14 +3843,14 @@ f({
|
|
|
3833
3843
|
*/
|
|
3834
3844
|
createFilter: (s) => {
|
|
3835
3845
|
try {
|
|
3836
|
-
const e = new
|
|
3846
|
+
const e = new _t();
|
|
3837
3847
|
e._customParams = { ...s };
|
|
3838
3848
|
const t = s.intensity !== void 0 ? s.intensity : 1;
|
|
3839
|
-
return
|
|
3849
|
+
return ne(e, t), e.updateUIParam = function(i, r) {
|
|
3840
3850
|
const a = this._customParams || {};
|
|
3841
3851
|
switch (this._customParams = a, a[i] = r, i) {
|
|
3842
3852
|
case "intensity":
|
|
3843
|
-
|
|
3853
|
+
ne(this, r);
|
|
3844
3854
|
break;
|
|
3845
3855
|
default:
|
|
3846
3856
|
i in this && (this[i] = r);
|
|
@@ -3870,11 +3880,11 @@ f({
|
|
|
3870
3880
|
}
|
|
3871
3881
|
]
|
|
3872
3882
|
});
|
|
3873
|
-
function
|
|
3883
|
+
function ne(s, e) {
|
|
3874
3884
|
s.reset(), s.greyscale(e);
|
|
3875
3885
|
}
|
|
3876
|
-
const { HslAdjustmentFilter:
|
|
3877
|
-
|
|
3886
|
+
const { HslAdjustmentFilter: xt } = b;
|
|
3887
|
+
m({
|
|
3878
3888
|
id: "hsl-adjustment",
|
|
3879
3889
|
name: "HSL Adjustment",
|
|
3880
3890
|
category: "color",
|
|
@@ -3885,7 +3895,7 @@ f({
|
|
|
3885
3895
|
*/
|
|
3886
3896
|
createFilter: (s) => {
|
|
3887
3897
|
try {
|
|
3888
|
-
const e = new
|
|
3898
|
+
const e = new xt({
|
|
3889
3899
|
hue: s.hue !== void 0 ? s.hue : 0,
|
|
3890
3900
|
saturation: s.saturation !== void 0 ? s.saturation : 0,
|
|
3891
3901
|
lightness: s.lightness !== void 0 ? s.lightness : 0,
|
|
@@ -3983,8 +3993,8 @@ f({
|
|
|
3983
3993
|
}
|
|
3984
3994
|
]
|
|
3985
3995
|
});
|
|
3986
|
-
const { KawaseBlurFilter:
|
|
3987
|
-
|
|
3996
|
+
const { KawaseBlurFilter: Ct } = b;
|
|
3997
|
+
m({
|
|
3988
3998
|
id: "kawase-blur",
|
|
3989
3999
|
name: "Kawase Blur",
|
|
3990
4000
|
category: "blur",
|
|
@@ -3996,7 +4006,7 @@ f({
|
|
|
3996
4006
|
*/
|
|
3997
4007
|
createFilter: (s) => {
|
|
3998
4008
|
try {
|
|
3999
|
-
const e = new
|
|
4009
|
+
const e = new Ct({
|
|
4000
4010
|
strength: s.strength || 4,
|
|
4001
4011
|
quality: s.quality || 3,
|
|
4002
4012
|
clamp: s.clamp || !1,
|
|
@@ -4101,8 +4111,8 @@ f({
|
|
|
4101
4111
|
}
|
|
4102
4112
|
]
|
|
4103
4113
|
});
|
|
4104
|
-
const { MotionBlurFilter:
|
|
4105
|
-
|
|
4114
|
+
const { MotionBlurFilter: wt } = b;
|
|
4115
|
+
m({
|
|
4106
4116
|
id: "motion-blur",
|
|
4107
4117
|
name: "Motion Blur",
|
|
4108
4118
|
category: "blur",
|
|
@@ -4114,7 +4124,7 @@ f({
|
|
|
4114
4124
|
*/
|
|
4115
4125
|
createFilter: (s) => {
|
|
4116
4126
|
try {
|
|
4117
|
-
const e = new
|
|
4127
|
+
const e = new wt({
|
|
4118
4128
|
velocity: {
|
|
4119
4129
|
x: s.velocityX !== void 0 ? s.velocityX : 0,
|
|
4120
4130
|
y: s.velocityY !== void 0 ? s.velocityY : 0
|
|
@@ -4209,8 +4219,8 @@ f({
|
|
|
4209
4219
|
}
|
|
4210
4220
|
]
|
|
4211
4221
|
});
|
|
4212
|
-
const { RadialBlurFilter:
|
|
4213
|
-
|
|
4222
|
+
const { RadialBlurFilter: St } = b;
|
|
4223
|
+
m({
|
|
4214
4224
|
id: "radial-blur",
|
|
4215
4225
|
name: "Radial Blur",
|
|
4216
4226
|
category: "blur",
|
|
@@ -4218,7 +4228,7 @@ f({
|
|
|
4218
4228
|
// Create an instance of the RadialBlurFilter with the provided parameters
|
|
4219
4229
|
createFilter: (s) => {
|
|
4220
4230
|
try {
|
|
4221
|
-
const e = new
|
|
4231
|
+
const e = new St({
|
|
4222
4232
|
angle: s.angle ?? 20,
|
|
4223
4233
|
center: { x: s.centerX ?? 0, y: s.centerY ?? 0 },
|
|
4224
4234
|
kernelSize: s.kernelSize ?? 15,
|
|
@@ -4333,8 +4343,8 @@ f({
|
|
|
4333
4343
|
}
|
|
4334
4344
|
]
|
|
4335
4345
|
});
|
|
4336
|
-
const { TiltShiftFilter:
|
|
4337
|
-
|
|
4346
|
+
const { TiltShiftFilter: vt } = b;
|
|
4347
|
+
m({
|
|
4338
4348
|
id: "tilt-shift",
|
|
4339
4349
|
name: "Tilt Shift",
|
|
4340
4350
|
category: "blur",
|
|
@@ -4342,7 +4352,7 @@ f({
|
|
|
4342
4352
|
// Create an instance of the TiltShiftFilter with the provided parameters
|
|
4343
4353
|
createFilter: (s) => {
|
|
4344
4354
|
try {
|
|
4345
|
-
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
|
|
4355
|
+
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 vt({
|
|
4346
4356
|
blur: Number(e),
|
|
4347
4357
|
gradientBlur: Number(t),
|
|
4348
4358
|
start: { x: Number(i), y: Number(r) },
|
|
@@ -4461,8 +4471,8 @@ f({
|
|
|
4461
4471
|
}
|
|
4462
4472
|
]
|
|
4463
4473
|
});
|
|
4464
|
-
const { ZoomBlurFilter:
|
|
4465
|
-
|
|
4474
|
+
const { ZoomBlurFilter: kt } = b;
|
|
4475
|
+
m({
|
|
4466
4476
|
id: "zoom-blur",
|
|
4467
4477
|
name: "Zoom Blur",
|
|
4468
4478
|
category: "blur",
|
|
@@ -4474,7 +4484,7 @@ f({
|
|
|
4474
4484
|
*/
|
|
4475
4485
|
createFilter: (s) => {
|
|
4476
4486
|
try {
|
|
4477
|
-
const e = new
|
|
4487
|
+
const e = new kt({
|
|
4478
4488
|
strength: s.strength || 0.1,
|
|
4479
4489
|
center: {
|
|
4480
4490
|
x: s.centerX !== void 0 ? s.centerX : 0.5,
|
|
@@ -4588,8 +4598,8 @@ f({
|
|
|
4588
4598
|
}
|
|
4589
4599
|
]
|
|
4590
4600
|
});
|
|
4591
|
-
const { ColorGradientFilter:
|
|
4592
|
-
|
|
4601
|
+
const { ColorGradientFilter: le } = b;
|
|
4602
|
+
m({
|
|
4593
4603
|
id: "color-gradient",
|
|
4594
4604
|
name: "Color Gradient",
|
|
4595
4605
|
category: "color",
|
|
@@ -4612,7 +4622,7 @@ f({
|
|
|
4612
4622
|
{ offset: 0, color: 16711680, alpha: 1 },
|
|
4613
4623
|
{ offset: 1, color: 255, alpha: 1 }
|
|
4614
4624
|
]), e.sort((i, r) => i.offset - r.offset);
|
|
4615
|
-
const t = new
|
|
4625
|
+
const t = new le({
|
|
4616
4626
|
type: s.gradientType,
|
|
4617
4627
|
// 0: linear, 1: radial, 2: conic
|
|
4618
4628
|
stops: e,
|
|
@@ -4676,8 +4686,8 @@ f({
|
|
|
4676
4686
|
// Will be adjusted later
|
|
4677
4687
|
alpha: 1,
|
|
4678
4688
|
color: (() => {
|
|
4679
|
-
const h = Math.floor(Math.random() * 255), p = Math.floor(Math.random() * 255),
|
|
4680
|
-
return h << 16 | p << 8 |
|
|
4689
|
+
const h = Math.floor(Math.random() * 255), p = Math.floor(Math.random() * 255), f = Math.floor(Math.random() * 255);
|
|
4690
|
+
return h << 16 | p << 8 | f;
|
|
4681
4691
|
})()
|
|
4682
4692
|
};
|
|
4683
4693
|
if (o.length > 0) {
|
|
@@ -4702,7 +4712,7 @@ f({
|
|
|
4702
4712
|
case "cssGradient":
|
|
4703
4713
|
if (r && typeof r == "string" && r.trim() !== "")
|
|
4704
4714
|
try {
|
|
4705
|
-
const h = new
|
|
4715
|
+
const h = new le({ css: r });
|
|
4706
4716
|
this.type = h.type, this.angle = h.angle, this.stops = [...h.stops], a.colorStops = this.stops.map((p) => ({
|
|
4707
4717
|
offset: p.offset,
|
|
4708
4718
|
color: typeof p.color == "number" ? "#" + p.color.toString(16).padStart(6, "0") : p.color,
|
|
@@ -4718,16 +4728,16 @@ f({
|
|
|
4718
4728
|
color: typeof p.color == "string" ? parseInt(p.color.replace("#", "0x")) : p.color,
|
|
4719
4729
|
alpha: p.alpha
|
|
4720
4730
|
}));
|
|
4721
|
-
h.sort((p,
|
|
4731
|
+
h.sort((p, f) => p.offset - f.offset), this.stops = h;
|
|
4722
4732
|
}
|
|
4723
4733
|
break;
|
|
4724
4734
|
default:
|
|
4725
4735
|
if (/colorStops\[\d+\]\..*/.test(i)) {
|
|
4726
4736
|
const h = i.match(/colorStops\[(\d+)\]\.(.*)/);
|
|
4727
4737
|
if (h) {
|
|
4728
|
-
const [p,
|
|
4738
|
+
const [p, f, _] = h, g = parseInt(f), y = [...this.stops];
|
|
4729
4739
|
if (g >= 0 && g < y.length)
|
|
4730
|
-
return
|
|
4740
|
+
return _ === "color" && typeof r == "string" ? y[g].color = parseInt(r.replace("#", "0x")) : (_ === "offset" || _ === "alpha") && (y[g][_] = r), this.stops = y, this.stops.sort((v, x) => v.offset - x.offset), a.colorStops = this.getColorStopsForUI(), !0;
|
|
4731
4741
|
}
|
|
4732
4742
|
} else i in this && (this[i] = r);
|
|
4733
4743
|
break;
|
|
@@ -4832,7 +4842,7 @@ f({
|
|
|
4832
4842
|
}
|
|
4833
4843
|
]
|
|
4834
4844
|
});
|
|
4835
|
-
|
|
4845
|
+
m({
|
|
4836
4846
|
id: "color-map",
|
|
4837
4847
|
name: "Color Map",
|
|
4838
4848
|
category: "color",
|
|
@@ -4844,7 +4854,7 @@ f({
|
|
|
4844
4854
|
if (!e)
|
|
4845
4855
|
return null;
|
|
4846
4856
|
let t = null;
|
|
4847
|
-
s.texturePath ? t =
|
|
4857
|
+
s.texturePath ? t = w.Texture.from(s.texturePath) : t = w.Texture.from("/examples/filters-main/examples/images/colormap.png");
|
|
4848
4858
|
const i = new e({
|
|
4849
4859
|
colorMap: t,
|
|
4850
4860
|
nearest: s.nearest,
|
|
@@ -4854,7 +4864,7 @@ f({
|
|
|
4854
4864
|
const o = this._customParams || {};
|
|
4855
4865
|
switch (this._customParams = o, o[r] = a, r) {
|
|
4856
4866
|
case "texturePath":
|
|
4857
|
-
a && (this.colorMap =
|
|
4867
|
+
a && (this.colorMap = w.Texture.from(a));
|
|
4858
4868
|
break;
|
|
4859
4869
|
case "mix":
|
|
4860
4870
|
this.mix = a;
|
|
@@ -4915,8 +4925,8 @@ f({
|
|
|
4915
4925
|
}
|
|
4916
4926
|
]
|
|
4917
4927
|
});
|
|
4918
|
-
const
|
|
4919
|
-
|
|
4928
|
+
const Pt = b.ColorReplaceFilter;
|
|
4929
|
+
m({
|
|
4920
4930
|
id: "color-replace",
|
|
4921
4931
|
name: "Color Replace",
|
|
4922
4932
|
category: "color",
|
|
@@ -4932,7 +4942,7 @@ f({
|
|
|
4932
4942
|
s.originalColor && (typeof s.originalColor == "string" ? e = parseInt(s.originalColor.replace("#", "0x"), 16) : typeof s.originalColor == "number" && (e = s.originalColor));
|
|
4933
4943
|
let t = 255;
|
|
4934
4944
|
s.targetColor && (typeof s.targetColor == "string" ? t = parseInt(s.targetColor.replace("#", "0x"), 16) : typeof s.targetColor == "number" && (t = s.targetColor));
|
|
4935
|
-
const i = new
|
|
4945
|
+
const i = new Pt({
|
|
4936
4946
|
originalColor: e,
|
|
4937
4947
|
targetColor: t,
|
|
4938
4948
|
tolerance: s.tolerance || 0.4
|
|
@@ -4996,8 +5006,8 @@ f({
|
|
|
4996
5006
|
}
|
|
4997
5007
|
]
|
|
4998
5008
|
});
|
|
4999
|
-
const
|
|
5000
|
-
|
|
5009
|
+
const Mt = b.MultiColorReplaceFilter;
|
|
5010
|
+
m({
|
|
5001
5011
|
id: "multi-color-replace",
|
|
5002
5012
|
name: "Multi-Color Replace",
|
|
5003
5013
|
category: "color",
|
|
@@ -5022,7 +5032,7 @@ f({
|
|
|
5022
5032
|
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;
|
|
5023
5033
|
e.push([i, r]);
|
|
5024
5034
|
}
|
|
5025
|
-
const t = new
|
|
5035
|
+
const t = new Mt(
|
|
5026
5036
|
e,
|
|
5027
5037
|
s.tolerance || 0.05,
|
|
5028
5038
|
3
|
|
@@ -5133,8 +5143,8 @@ f({
|
|
|
5133
5143
|
}
|
|
5134
5144
|
]
|
|
5135
5145
|
});
|
|
5136
|
-
const { RGBSplitFilter:
|
|
5137
|
-
|
|
5146
|
+
const { RGBSplitFilter: Ft } = b;
|
|
5147
|
+
m({
|
|
5138
5148
|
id: "rgb-split",
|
|
5139
5149
|
name: "RGB Split",
|
|
5140
5150
|
category: "color",
|
|
@@ -5154,7 +5164,7 @@ f({
|
|
|
5154
5164
|
}, i = {
|
|
5155
5165
|
x: s.blueX !== void 0 ? s.blueX : 0,
|
|
5156
5166
|
y: s.blueY !== void 0 ? s.blueY : 0
|
|
5157
|
-
}, r = new
|
|
5167
|
+
}, r = new Ft({
|
|
5158
5168
|
red: e,
|
|
5159
5169
|
green: t,
|
|
5160
5170
|
blue: i
|
|
@@ -5267,8 +5277,8 @@ f({
|
|
|
5267
5277
|
}
|
|
5268
5278
|
]
|
|
5269
5279
|
});
|
|
5270
|
-
const { AdvancedBloomFilter:
|
|
5271
|
-
|
|
5280
|
+
const { AdvancedBloomFilter: At } = b;
|
|
5281
|
+
m({
|
|
5272
5282
|
id: "advanced-bloom",
|
|
5273
5283
|
name: "Advanced Bloom",
|
|
5274
5284
|
category: "light",
|
|
@@ -5276,7 +5286,7 @@ f({
|
|
|
5276
5286
|
// Create an instance of the AdvancedBloomFilter with the provided parameters
|
|
5277
5287
|
createFilter: (s) => {
|
|
5278
5288
|
try {
|
|
5279
|
-
const e = new
|
|
5289
|
+
const e = new At({
|
|
5280
5290
|
threshold: s.threshold || 0.5,
|
|
5281
5291
|
bloomScale: s.bloomScale || 1,
|
|
5282
5292
|
brightness: s.brightness || 1,
|
|
@@ -5423,8 +5433,8 @@ f({
|
|
|
5423
5433
|
}
|
|
5424
5434
|
]
|
|
5425
5435
|
});
|
|
5426
|
-
const
|
|
5427
|
-
|
|
5436
|
+
const zt = b.AsciiFilter;
|
|
5437
|
+
m({
|
|
5428
5438
|
id: "ascii",
|
|
5429
5439
|
name: "ASCII",
|
|
5430
5440
|
category: "stylize",
|
|
@@ -5435,7 +5445,7 @@ f({
|
|
|
5435
5445
|
const e = typeof s.size == "number" ? s.size : 8;
|
|
5436
5446
|
let t = s.color;
|
|
5437
5447
|
typeof t == "string" && t.startsWith("#") && (t = parseInt(t.replace("#", "0x"), 16));
|
|
5438
|
-
const i = s.replaceColor === !0, r = new
|
|
5448
|
+
const i = s.replaceColor === !0, r = new zt({
|
|
5439
5449
|
size: e,
|
|
5440
5450
|
color: t,
|
|
5441
5451
|
replaceColor: i
|
|
@@ -5502,8 +5512,8 @@ f({
|
|
|
5502
5512
|
}
|
|
5503
5513
|
]
|
|
5504
5514
|
});
|
|
5505
|
-
const
|
|
5506
|
-
|
|
5515
|
+
const Rt = b.BackdropBlurFilter;
|
|
5516
|
+
m({
|
|
5507
5517
|
id: "backdrop-blur",
|
|
5508
5518
|
name: "Backdrop Blur",
|
|
5509
5519
|
category: "blur",
|
|
@@ -5511,7 +5521,7 @@ f({
|
|
|
5511
5521
|
// Create an instance of the BackdropBlurFilter with the provided parameters
|
|
5512
5522
|
createFilter: (s) => {
|
|
5513
5523
|
try {
|
|
5514
|
-
const e = new
|
|
5524
|
+
const e = new Rt({
|
|
5515
5525
|
// Higher strength values (20-50) make the effect more noticeable
|
|
5516
5526
|
strength: s.strength || 20,
|
|
5517
5527
|
quality: s.quality || 4,
|
|
@@ -5609,8 +5619,8 @@ f({
|
|
|
5609
5619
|
}
|
|
5610
5620
|
]
|
|
5611
5621
|
});
|
|
5612
|
-
const { BevelFilter:
|
|
5613
|
-
|
|
5622
|
+
const { BevelFilter: Nt } = b;
|
|
5623
|
+
m({
|
|
5614
5624
|
id: "bevel",
|
|
5615
5625
|
name: "Bevel",
|
|
5616
5626
|
category: "effects",
|
|
@@ -5621,7 +5631,7 @@ f({
|
|
|
5621
5631
|
*/
|
|
5622
5632
|
createFilter: (s) => {
|
|
5623
5633
|
try {
|
|
5624
|
-
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new
|
|
5634
|
+
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new Nt({
|
|
5625
5635
|
rotation: s.rotation !== void 0 ? s.rotation : 45,
|
|
5626
5636
|
thickness: s.thickness !== void 0 ? s.thickness : 2,
|
|
5627
5637
|
lightColor: parseInt(e, 16),
|
|
@@ -5737,8 +5747,8 @@ f({
|
|
|
5737
5747
|
}
|
|
5738
5748
|
]
|
|
5739
5749
|
});
|
|
5740
|
-
const { BloomFilter:
|
|
5741
|
-
|
|
5750
|
+
const { BloomFilter: Tt } = b;
|
|
5751
|
+
m({
|
|
5742
5752
|
id: "bloom",
|
|
5743
5753
|
name: "Bloom/Glow",
|
|
5744
5754
|
category: "light",
|
|
@@ -5746,7 +5756,7 @@ f({
|
|
|
5746
5756
|
// Create an instance of the BloomFilter with the provided parameters
|
|
5747
5757
|
createFilter: (s) => {
|
|
5748
5758
|
try {
|
|
5749
|
-
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
|
|
5759
|
+
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 Tt({
|
|
5750
5760
|
strength: {
|
|
5751
5761
|
x: Number(e),
|
|
5752
5762
|
y: Number(t)
|
|
@@ -5849,8 +5859,8 @@ f({
|
|
|
5849
5859
|
}
|
|
5850
5860
|
]
|
|
5851
5861
|
});
|
|
5852
|
-
const { BulgePinchFilter:
|
|
5853
|
-
|
|
5862
|
+
const { BulgePinchFilter: It } = b;
|
|
5863
|
+
m({
|
|
5854
5864
|
id: "bulge-pinch",
|
|
5855
5865
|
// ID must match what the application expects
|
|
5856
5866
|
name: "Bulge/Pinch",
|
|
@@ -5859,7 +5869,7 @@ f({
|
|
|
5859
5869
|
// Create an instance of the BulgePinchFilter with the provided parameters
|
|
5860
5870
|
createFilter: (s) => {
|
|
5861
5871
|
try {
|
|
5862
|
-
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new
|
|
5872
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new It({
|
|
5863
5873
|
center: {
|
|
5864
5874
|
x: e,
|
|
5865
5875
|
y: t
|
|
@@ -5941,7 +5951,7 @@ f({
|
|
|
5941
5951
|
}
|
|
5942
5952
|
]
|
|
5943
5953
|
});
|
|
5944
|
-
const { ConvolutionFilter:
|
|
5954
|
+
const { ConvolutionFilter: Et } = b, O = {
|
|
5945
5955
|
normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
|
|
5946
5956
|
gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
|
|
5947
5957
|
boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
|
|
@@ -5952,7 +5962,7 @@ const { ConvolutionFilter: It } = b, X = {
|
|
|
5952
5962
|
sobelHorizontal: [1, 2, 1, 0, 0, 0, -1, -2, -1],
|
|
5953
5963
|
sobelVertical: [1, 0, -1, 2, 0, -2, 1, 0, -1]
|
|
5954
5964
|
};
|
|
5955
|
-
|
|
5965
|
+
m({
|
|
5956
5966
|
id: "convolution",
|
|
5957
5967
|
name: "Convolution Matrix",
|
|
5958
5968
|
category: "effects",
|
|
@@ -5974,16 +5984,16 @@ f({
|
|
|
5974
5984
|
];
|
|
5975
5985
|
else {
|
|
5976
5986
|
const i = s.preset;
|
|
5977
|
-
e =
|
|
5987
|
+
e = O[i] || O.normal;
|
|
5978
5988
|
}
|
|
5979
|
-
const t = new
|
|
5989
|
+
const t = new Et(e, s.width || 200, s.height || 200);
|
|
5980
5990
|
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
5981
5991
|
const a = this._customParams || {};
|
|
5982
5992
|
switch (this._customParams = a, a[i] = r, i) {
|
|
5983
5993
|
case "preset":
|
|
5984
5994
|
if (!a.customMatrix) {
|
|
5985
5995
|
const o = r;
|
|
5986
|
-
|
|
5996
|
+
O[o] && (this.matrix = O[o]);
|
|
5987
5997
|
}
|
|
5988
5998
|
break;
|
|
5989
5999
|
case "customMatrix":
|
|
@@ -5992,7 +6002,7 @@ f({
|
|
|
5992
6002
|
a.m00 = o[0], a.m01 = o[1], a.m02 = o[2], a.m10 = o[3], a.m11 = o[4], a.m12 = o[5], a.m20 = o[6], a.m21 = o[7], a.m22 = o[8];
|
|
5993
6003
|
} else {
|
|
5994
6004
|
const o = a.preset;
|
|
5995
|
-
this.matrix =
|
|
6005
|
+
this.matrix = O[o] || O.normal;
|
|
5996
6006
|
}
|
|
5997
6007
|
break;
|
|
5998
6008
|
case "m00":
|
|
@@ -6187,8 +6197,8 @@ f({
|
|
|
6187
6197
|
}
|
|
6188
6198
|
]
|
|
6189
6199
|
});
|
|
6190
|
-
const { CrossHatchFilter:
|
|
6191
|
-
|
|
6200
|
+
const { CrossHatchFilter: Xt } = b;
|
|
6201
|
+
m({
|
|
6192
6202
|
id: "cross-hatch",
|
|
6193
6203
|
name: "Cross Hatch",
|
|
6194
6204
|
category: "stylize",
|
|
@@ -6197,7 +6207,7 @@ f({
|
|
|
6197
6207
|
// Note: CrossHatchFilter has NO parameters according to PixiJS examples
|
|
6198
6208
|
createFilter: (s) => {
|
|
6199
6209
|
try {
|
|
6200
|
-
const e = new
|
|
6210
|
+
const e = new Xt();
|
|
6201
6211
|
return e.updateUIParam = function(t, i) {
|
|
6202
6212
|
return !0;
|
|
6203
6213
|
}, e;
|
|
@@ -6210,7 +6220,7 @@ f({
|
|
|
6210
6220
|
// No UI controls since CrossHatchFilter has no parameters
|
|
6211
6221
|
controls: []
|
|
6212
6222
|
});
|
|
6213
|
-
|
|
6223
|
+
m({
|
|
6214
6224
|
id: "crt",
|
|
6215
6225
|
name: "CRT Screen",
|
|
6216
6226
|
category: "stylize",
|
|
@@ -6394,8 +6404,8 @@ f({
|
|
|
6394
6404
|
}
|
|
6395
6405
|
]
|
|
6396
6406
|
});
|
|
6397
|
-
const
|
|
6398
|
-
|
|
6407
|
+
const Yt = w.DisplacementFilter, Bt = w.Sprite, K = w.Texture;
|
|
6408
|
+
m({
|
|
6399
6409
|
id: "displacement",
|
|
6400
6410
|
// ID must match what the application expects
|
|
6401
6411
|
name: "Displacement Map",
|
|
@@ -6407,7 +6417,7 @@ f({
|
|
|
6407
6417
|
const e = s.mapTexture || "/assets/images/displacement_map.png";
|
|
6408
6418
|
let t;
|
|
6409
6419
|
try {
|
|
6410
|
-
t =
|
|
6420
|
+
t = K.from(e), t.source.addressMode = "repeat";
|
|
6411
6421
|
} catch {
|
|
6412
6422
|
const o = document.createElement("canvas");
|
|
6413
6423
|
o.width = 256, o.height = 256;
|
|
@@ -6418,9 +6428,9 @@ f({
|
|
|
6418
6428
|
for (let c = 0; c < 10; c++)
|
|
6419
6429
|
(l + c) % 2 === 0 && n.fillRect(l * 25, c * 25, 25, 25);
|
|
6420
6430
|
}
|
|
6421
|
-
t =
|
|
6431
|
+
t = K.from(o);
|
|
6422
6432
|
}
|
|
6423
|
-
const i = new
|
|
6433
|
+
const i = new Bt(t), r = new Yt(i, s.scale || 50);
|
|
6424
6434
|
return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = i, r.updateUIParam = function(a, o) {
|
|
6425
6435
|
const n = this._customParams || {};
|
|
6426
6436
|
switch (this._customParams = n, n[a] = o, a) {
|
|
@@ -6434,7 +6444,7 @@ f({
|
|
|
6434
6444
|
try {
|
|
6435
6445
|
const l = this._displacementSprite;
|
|
6436
6446
|
if (l) {
|
|
6437
|
-
const c =
|
|
6447
|
+
const c = K.from(o);
|
|
6438
6448
|
c.source.addressMode = "repeat", l.texture = c;
|
|
6439
6449
|
}
|
|
6440
6450
|
} catch {
|
|
@@ -6493,7 +6503,7 @@ f({
|
|
|
6493
6503
|
}
|
|
6494
6504
|
]
|
|
6495
6505
|
});
|
|
6496
|
-
|
|
6506
|
+
m({
|
|
6497
6507
|
id: "dot",
|
|
6498
6508
|
name: "Dot Screen",
|
|
6499
6509
|
category: "stylize",
|
|
@@ -6567,8 +6577,8 @@ f({
|
|
|
6567
6577
|
}
|
|
6568
6578
|
]
|
|
6569
6579
|
});
|
|
6570
|
-
const { EmbossFilter:
|
|
6571
|
-
|
|
6580
|
+
const { EmbossFilter: Ot } = b;
|
|
6581
|
+
m({
|
|
6572
6582
|
id: "emboss",
|
|
6573
6583
|
name: "Emboss",
|
|
6574
6584
|
category: "stylize",
|
|
@@ -6576,7 +6586,7 @@ f({
|
|
|
6576
6586
|
// Create an instance of the Emboss filter with the provided parameters
|
|
6577
6587
|
createFilter: (s) => {
|
|
6578
6588
|
try {
|
|
6579
|
-
const e = typeof s.strength == "number" ? s.strength : 5, t = new
|
|
6589
|
+
const e = typeof s.strength == "number" ? s.strength : 5, t = new Ot(e);
|
|
6580
6590
|
return t._customParams = {
|
|
6581
6591
|
strength: e
|
|
6582
6592
|
}, t.updateUIParam = function(i, r) {
|
|
@@ -6616,21 +6626,21 @@ f({
|
|
|
6616
6626
|
}
|
|
6617
6627
|
]
|
|
6618
6628
|
});
|
|
6619
|
-
const { GlitchFilter:
|
|
6629
|
+
const { GlitchFilter: Lt } = b, I = {
|
|
6620
6630
|
TRANSPARENT: 0,
|
|
6621
6631
|
ORIGINAL: 1,
|
|
6622
6632
|
LOOP: 2,
|
|
6623
6633
|
CLAMP: 3,
|
|
6624
6634
|
MIRROR: 4
|
|
6625
6635
|
};
|
|
6626
|
-
|
|
6636
|
+
m({
|
|
6627
6637
|
id: "glitch",
|
|
6628
6638
|
name: "Glitch",
|
|
6629
6639
|
category: "effects",
|
|
6630
6640
|
description: "Apply digital distortion and glitch effects",
|
|
6631
6641
|
createFilter: (s) => {
|
|
6632
6642
|
try {
|
|
6633
|
-
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new
|
|
6643
|
+
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new Lt({
|
|
6634
6644
|
slices: s.slices,
|
|
6635
6645
|
offset: s.offset,
|
|
6636
6646
|
direction: s.direction,
|
|
@@ -6708,7 +6718,7 @@ f({
|
|
|
6708
6718
|
slices: 10,
|
|
6709
6719
|
offset: 100,
|
|
6710
6720
|
direction: 0,
|
|
6711
|
-
fillMode:
|
|
6721
|
+
fillMode: I.LOOP,
|
|
6712
6722
|
// LOOP mode looks better for the demo
|
|
6713
6723
|
seed: 0.5,
|
|
6714
6724
|
average: !1,
|
|
@@ -6771,13 +6781,13 @@ f({
|
|
|
6771
6781
|
label: "Fill Mode",
|
|
6772
6782
|
property: "fillMode",
|
|
6773
6783
|
options: [
|
|
6774
|
-
{ value:
|
|
6775
|
-
{ value:
|
|
6776
|
-
{ value:
|
|
6777
|
-
{ value:
|
|
6778
|
-
{ value:
|
|
6784
|
+
{ value: I.TRANSPARENT, label: "Transparent" },
|
|
6785
|
+
{ value: I.ORIGINAL, label: "Original" },
|
|
6786
|
+
{ value: I.LOOP, label: "Loop" },
|
|
6787
|
+
{ value: I.CLAMP, label: "Clamp" },
|
|
6788
|
+
{ value: I.MIRROR, label: "Mirror" }
|
|
6779
6789
|
],
|
|
6780
|
-
default:
|
|
6790
|
+
default: I.LOOP
|
|
6781
6791
|
},
|
|
6782
6792
|
{
|
|
6783
6793
|
id: "seed",
|
|
@@ -6871,8 +6881,8 @@ f({
|
|
|
6871
6881
|
}
|
|
6872
6882
|
]
|
|
6873
6883
|
});
|
|
6874
|
-
const { GlowFilter:
|
|
6875
|
-
|
|
6884
|
+
const { GlowFilter: Dt } = b;
|
|
6885
|
+
m({
|
|
6876
6886
|
id: "glow",
|
|
6877
6887
|
name: "Glow",
|
|
6878
6888
|
category: "light",
|
|
@@ -6880,7 +6890,7 @@ f({
|
|
|
6880
6890
|
// Create an instance of the GlowFilter with the provided parameters
|
|
6881
6891
|
createFilter: (s) => {
|
|
6882
6892
|
try {
|
|
6883
|
-
const e = parseInt(s.color.replace("#", "0x"), 16), t = new
|
|
6893
|
+
const e = parseInt(s.color.replace("#", "0x"), 16), t = new Dt({
|
|
6884
6894
|
distance: s.distance || 10,
|
|
6885
6895
|
outerStrength: s.outerStrength || 4,
|
|
6886
6896
|
innerStrength: s.innerStrength || 0,
|
|
@@ -7006,8 +7016,8 @@ f({
|
|
|
7006
7016
|
}
|
|
7007
7017
|
]
|
|
7008
7018
|
});
|
|
7009
|
-
const { GodrayFilter:
|
|
7010
|
-
|
|
7019
|
+
const { GodrayFilter: Ut } = b;
|
|
7020
|
+
m({
|
|
7011
7021
|
id: "godray",
|
|
7012
7022
|
name: "Godray",
|
|
7013
7023
|
category: "light",
|
|
@@ -7015,7 +7025,7 @@ f({
|
|
|
7015
7025
|
// Create an instance of the GodrayFilter with the provided parameters
|
|
7016
7026
|
createFilter: (s) => {
|
|
7017
7027
|
try {
|
|
7018
|
-
const e = new
|
|
7028
|
+
const e = new Ut({
|
|
7019
7029
|
angle: s.angle || 30,
|
|
7020
7030
|
parallel: s.parallel ?? !0,
|
|
7021
7031
|
center: {
|
|
@@ -7168,8 +7178,8 @@ f({
|
|
|
7168
7178
|
}
|
|
7169
7179
|
]
|
|
7170
7180
|
});
|
|
7171
|
-
const
|
|
7172
|
-
|
|
7181
|
+
const Vt = b.SimpleLightmapFilter, ce = w.Texture;
|
|
7182
|
+
m({
|
|
7173
7183
|
id: "lightmap",
|
|
7174
7184
|
name: "Lightmap",
|
|
7175
7185
|
category: "light",
|
|
@@ -7193,14 +7203,14 @@ f({
|
|
|
7193
7203
|
const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7194
7204
|
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);
|
|
7195
7205
|
}
|
|
7196
|
-
const o =
|
|
7206
|
+
const o = ce.from(r);
|
|
7197
7207
|
let n;
|
|
7198
7208
|
try {
|
|
7199
7209
|
typeof t == "string" && t.startsWith("#") ? n = parseInt(t.replace("#", "0x"), 16) : n = 0;
|
|
7200
7210
|
} catch {
|
|
7201
7211
|
n = 0;
|
|
7202
7212
|
}
|
|
7203
|
-
const l = new
|
|
7213
|
+
const l = new Vt(o, n, i);
|
|
7204
7214
|
return l._customParams = {
|
|
7205
7215
|
textureType: e,
|
|
7206
7216
|
color: t,
|
|
@@ -7213,21 +7223,21 @@ f({
|
|
|
7213
7223
|
h.textureType = d;
|
|
7214
7224
|
const p = document.createElement("canvas");
|
|
7215
7225
|
p.width = 256, p.height = 256;
|
|
7216
|
-
const
|
|
7217
|
-
if (
|
|
7226
|
+
const f = p.getContext("2d");
|
|
7227
|
+
if (f) {
|
|
7218
7228
|
if (d === "spotlight") {
|
|
7219
|
-
|
|
7220
|
-
const g =
|
|
7221
|
-
g.addColorStop(0, "white"), g.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), g.addColorStop(1, "rgba(0, 0, 0, 0)"),
|
|
7229
|
+
f.fillStyle = "black", f.fillRect(0, 0, 256, 256);
|
|
7230
|
+
const g = f.createRadialGradient(128, 128, 5, 128, 128, 80);
|
|
7231
|
+
g.addColorStop(0, "white"), g.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), g.addColorStop(1, "rgba(0, 0, 0, 0)"), f.fillStyle = g, f.beginPath(), f.arc(128, 128, 100, 0, Math.PI * 2), f.fill();
|
|
7222
7232
|
} else if (d === "softlight") {
|
|
7223
|
-
const g =
|
|
7224
|
-
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)"),
|
|
7233
|
+
const g = f.createLinearGradient(0, 0, 256, 256);
|
|
7234
|
+
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)"), f.fillStyle = g, f.fillRect(0, 0, 256, 256);
|
|
7225
7235
|
} else {
|
|
7226
|
-
const g =
|
|
7227
|
-
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"),
|
|
7236
|
+
const g = f.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
7237
|
+
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"), f.fillStyle = g, f.fillRect(0, 0, 256, 256);
|
|
7228
7238
|
}
|
|
7229
|
-
const
|
|
7230
|
-
if (this.lightMap =
|
|
7239
|
+
const _ = ce.from(p);
|
|
7240
|
+
if (this.lightMap = _, this.enabled !== void 0) {
|
|
7231
7241
|
const g = this.enabled;
|
|
7232
7242
|
this.enabled = !1, setTimeout(() => {
|
|
7233
7243
|
this.enabled = g;
|
|
@@ -7299,15 +7309,15 @@ f({
|
|
|
7299
7309
|
}
|
|
7300
7310
|
]
|
|
7301
7311
|
});
|
|
7302
|
-
const { NoiseFilter:
|
|
7303
|
-
|
|
7312
|
+
const { NoiseFilter: jt } = w;
|
|
7313
|
+
m({
|
|
7304
7314
|
id: "noise",
|
|
7305
7315
|
name: "Noise",
|
|
7306
7316
|
category: "effects",
|
|
7307
7317
|
description: "Add random noise to the image",
|
|
7308
7318
|
createFilter: (s) => {
|
|
7309
7319
|
try {
|
|
7310
|
-
const e = new
|
|
7320
|
+
const e = new jt({
|
|
7311
7321
|
noise: s.noise || 0.5,
|
|
7312
7322
|
seed: s.seed || Math.random()
|
|
7313
7323
|
});
|
|
@@ -7384,15 +7394,15 @@ f({
|
|
|
7384
7394
|
}
|
|
7385
7395
|
]
|
|
7386
7396
|
});
|
|
7387
|
-
const { OldFilmFilter:
|
|
7388
|
-
|
|
7397
|
+
const { OldFilmFilter: qt } = b;
|
|
7398
|
+
m({
|
|
7389
7399
|
id: "old-film",
|
|
7390
7400
|
name: "Old Film",
|
|
7391
7401
|
category: "effects",
|
|
7392
7402
|
description: "Apply a vintage film effect with scratches and grain",
|
|
7393
7403
|
createFilter: (s) => {
|
|
7394
7404
|
try {
|
|
7395
|
-
const e = new
|
|
7405
|
+
const e = new qt({
|
|
7396
7406
|
sepia: s.sepia,
|
|
7397
7407
|
noise: s.noise,
|
|
7398
7408
|
noiseSize: s.noiseSize,
|
|
@@ -7573,8 +7583,8 @@ f({
|
|
|
7573
7583
|
}
|
|
7574
7584
|
]
|
|
7575
7585
|
});
|
|
7576
|
-
const { OutlineFilter:
|
|
7577
|
-
|
|
7586
|
+
const { OutlineFilter: Ht } = b;
|
|
7587
|
+
m({
|
|
7578
7588
|
id: "outline",
|
|
7579
7589
|
name: "Outline",
|
|
7580
7590
|
category: "effects",
|
|
@@ -7583,7 +7593,7 @@ f({
|
|
|
7583
7593
|
try {
|
|
7584
7594
|
let e = s.color;
|
|
7585
7595
|
typeof e == "string" && (e = parseInt(e.replace("#", "0x"), 16));
|
|
7586
|
-
const t = new
|
|
7596
|
+
const t = new Ht({
|
|
7587
7597
|
thickness: s.thickness || 4,
|
|
7588
7598
|
color: e,
|
|
7589
7599
|
alpha: s.alpha || 1,
|
|
@@ -7673,15 +7683,15 @@ f({
|
|
|
7673
7683
|
}
|
|
7674
7684
|
]
|
|
7675
7685
|
});
|
|
7676
|
-
const { PixelateFilter:
|
|
7677
|
-
|
|
7686
|
+
const { PixelateFilter: $t } = b;
|
|
7687
|
+
m({
|
|
7678
7688
|
id: "pixelate",
|
|
7679
7689
|
name: "Pixelate",
|
|
7680
7690
|
category: "effects",
|
|
7681
7691
|
description: "Create a pixelated or mosaic effect",
|
|
7682
7692
|
createFilter: (s) => {
|
|
7683
7693
|
try {
|
|
7684
|
-
const e = new
|
|
7694
|
+
const e = new $t(
|
|
7685
7695
|
s.useUniform ? Math.max(4, s.size || 10) : [Math.max(4, s.sizeX || 10), Math.max(4, s.sizeY || 10)]
|
|
7686
7696
|
);
|
|
7687
7697
|
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
@@ -7764,8 +7774,8 @@ f({
|
|
|
7764
7774
|
}
|
|
7765
7775
|
]
|
|
7766
7776
|
});
|
|
7767
|
-
const { ReflectionFilter:
|
|
7768
|
-
|
|
7777
|
+
const { ReflectionFilter: Wt } = b;
|
|
7778
|
+
m({
|
|
7769
7779
|
id: "reflection",
|
|
7770
7780
|
// ID must match what the application expects
|
|
7771
7781
|
name: "Reflection",
|
|
@@ -7781,7 +7791,7 @@ f({
|
|
|
7781
7791
|
waveLength: new Float32Array([s.wavelengthStart ?? 30, s.wavelengthEnd ?? 100]),
|
|
7782
7792
|
alpha: new Float32Array([s.alphaStart ?? 1, s.alphaEnd ?? 1]),
|
|
7783
7793
|
time: s.time ?? 0
|
|
7784
|
-
}, t = new
|
|
7794
|
+
}, t = new Wt(e);
|
|
7785
7795
|
return t._customParams = { ...s }, t.animating = s.animating ?? !1, t.updateUIParam = function(i, r) {
|
|
7786
7796
|
const a = this._customParams || {};
|
|
7787
7797
|
switch (this._customParams = a, a[i] = r, i) {
|
|
@@ -7932,8 +7942,8 @@ f({
|
|
|
7932
7942
|
}
|
|
7933
7943
|
]
|
|
7934
7944
|
});
|
|
7935
|
-
const { ShockwaveFilter:
|
|
7936
|
-
|
|
7945
|
+
const { ShockwaveFilter: Zt } = b;
|
|
7946
|
+
m({
|
|
7937
7947
|
id: "shockwave",
|
|
7938
7948
|
// ID must match what the application expects
|
|
7939
7949
|
name: "Shockwave",
|
|
@@ -7942,7 +7952,7 @@ f({
|
|
|
7942
7952
|
// Create an instance of the ShockwaveFilter with the provided parameters
|
|
7943
7953
|
createFilter: (s) => {
|
|
7944
7954
|
try {
|
|
7945
|
-
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
|
|
7955
|
+
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 Zt({
|
|
7946
7956
|
center: i,
|
|
7947
7957
|
amplitude: r,
|
|
7948
7958
|
wavelength: a,
|
|
@@ -7952,8 +7962,8 @@ f({
|
|
|
7952
7962
|
time: c
|
|
7953
7963
|
});
|
|
7954
7964
|
return d._customParams = { ...s }, d.animating = s.animating ?? !1, d.updateUIParam = function(h, p) {
|
|
7955
|
-
const
|
|
7956
|
-
switch (this._customParams =
|
|
7965
|
+
const f = this._customParams || {};
|
|
7966
|
+
switch (this._customParams = f, f[h] = p, h) {
|
|
7957
7967
|
case "centerX":
|
|
7958
7968
|
this.center || (this.center = { x: 0.5, y: 0.5 }), this.center.x = p;
|
|
7959
7969
|
break;
|
|
@@ -8084,15 +8094,15 @@ f({
|
|
|
8084
8094
|
}
|
|
8085
8095
|
]
|
|
8086
8096
|
});
|
|
8087
|
-
const { SimplexNoiseFilter:
|
|
8088
|
-
|
|
8097
|
+
const { SimplexNoiseFilter: Gt } = b;
|
|
8098
|
+
m({
|
|
8089
8099
|
id: "simplex-noise",
|
|
8090
8100
|
name: "Simplex Noise",
|
|
8091
8101
|
category: "effects",
|
|
8092
8102
|
description: "Apply procedural noise to create texture effects",
|
|
8093
8103
|
createFilter: (s) => {
|
|
8094
8104
|
try {
|
|
8095
|
-
const e = s.animating ? 0 : s.offsetZ || 0, t = new
|
|
8105
|
+
const e = s.animating ? 0 : s.offsetZ || 0, t = new Gt({
|
|
8096
8106
|
strength: s.strength,
|
|
8097
8107
|
noiseScale: s.noiseScale,
|
|
8098
8108
|
offsetX: s.offsetX,
|
|
@@ -8239,9 +8249,9 @@ f({
|
|
|
8239
8249
|
}
|
|
8240
8250
|
]
|
|
8241
8251
|
});
|
|
8242
|
-
class
|
|
8252
|
+
class Kt extends w.Filter {
|
|
8243
8253
|
constructor(e) {
|
|
8244
|
-
const t =
|
|
8254
|
+
const t = Se.from({
|
|
8245
8255
|
vertex: `
|
|
8246
8256
|
attribute vec2 aPosition;
|
|
8247
8257
|
varying vec2 vTextureCoord;
|
|
@@ -8343,14 +8353,14 @@ class Gt extends S.Filter {
|
|
|
8343
8353
|
}
|
|
8344
8354
|
}
|
|
8345
8355
|
}
|
|
8346
|
-
|
|
8356
|
+
m({
|
|
8347
8357
|
id: "twist",
|
|
8348
8358
|
name: "Twist",
|
|
8349
8359
|
category: "distortion",
|
|
8350
8360
|
description: "Creates a twisting distortion effect around a central point",
|
|
8351
8361
|
createFilter: (s) => {
|
|
8352
8362
|
try {
|
|
8353
|
-
const e = new
|
|
8363
|
+
const e = new Kt({
|
|
8354
8364
|
centerX: s.centerX ?? 0.5,
|
|
8355
8365
|
centerY: s.centerY ?? 0.5,
|
|
8356
8366
|
radius: s.radius ?? 0.25,
|
|
@@ -8420,8 +8430,8 @@ f({
|
|
|
8420
8430
|
}
|
|
8421
8431
|
]
|
|
8422
8432
|
});
|
|
8423
|
-
const { AdjustmentFilter:
|
|
8424
|
-
function
|
|
8433
|
+
const { AdjustmentFilter: Qt } = b;
|
|
8434
|
+
function q(s) {
|
|
8425
8435
|
const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
|
|
8426
8436
|
return [
|
|
8427
8437
|
(e >> 16 & 255) / 255,
|
|
@@ -8429,14 +8439,14 @@ function D(s) {
|
|
|
8429
8439
|
(e & 255) / 255
|
|
8430
8440
|
];
|
|
8431
8441
|
}
|
|
8432
|
-
class
|
|
8442
|
+
class Jt extends Qt {
|
|
8433
8443
|
constructor(e = {}) {
|
|
8434
8444
|
super({
|
|
8435
8445
|
brightness: 1,
|
|
8436
8446
|
contrast: 1,
|
|
8437
8447
|
saturation: 1,
|
|
8438
8448
|
alpha: 1
|
|
8439
|
-
}), this._radius = 0.8, this._strength = 1, this._colorRgb = [0, 0, 0], this._colorValue = "#000000", this._radius = e.radius ?? 0.8, this._strength = e.strength ?? 1, e.color !== void 0 && (typeof e.color == "string" ? (this._colorValue = e.color, this._colorRgb =
|
|
8449
|
+
}), this._radius = 0.8, this._strength = 1, this._colorRgb = [0, 0, 0], this._colorValue = "#000000", this._radius = e.radius ?? 0.8, this._strength = e.strength ?? 1, e.color !== void 0 && (typeof e.color == "string" ? (this._colorValue = e.color, this._colorRgb = q(e.color)) : (this._colorValue = "#" + e.color.toString(16).padStart(6, "0"), this._colorRgb = q(e.color))), this.updateVignette();
|
|
8440
8450
|
}
|
|
8441
8451
|
/**
|
|
8442
8452
|
* Updates the filter parameters to simulate a vignette effect
|
|
@@ -8462,17 +8472,17 @@ class Qt extends Kt {
|
|
|
8462
8472
|
return this._colorValue;
|
|
8463
8473
|
}
|
|
8464
8474
|
set color(e) {
|
|
8465
|
-
typeof e == "string" ? (this._colorValue = e, this._colorRgb =
|
|
8475
|
+
typeof e == "string" ? (this._colorValue = e, this._colorRgb = q(e)) : (this._colorValue = "#" + e.toString(16).padStart(6, "0"), this._colorRgb = q(e)), this.updateVignette();
|
|
8466
8476
|
}
|
|
8467
8477
|
}
|
|
8468
|
-
|
|
8478
|
+
m({
|
|
8469
8479
|
id: "vignette",
|
|
8470
8480
|
name: "Vignette",
|
|
8471
8481
|
category: "effects",
|
|
8472
8482
|
description: "Add a classic darkened border effect to the image",
|
|
8473
8483
|
createFilter: (s) => {
|
|
8474
8484
|
try {
|
|
8475
|
-
const e = new
|
|
8485
|
+
const e = new Jt({
|
|
8476
8486
|
radius: s.radius || 0.8,
|
|
8477
8487
|
strength: s.strength || 1,
|
|
8478
8488
|
color: s.color || "#000000"
|
|
@@ -8540,18 +8550,18 @@ function ai(s) {
|
|
|
8540
8550
|
try {
|
|
8541
8551
|
let e = [], t = [];
|
|
8542
8552
|
try {
|
|
8543
|
-
e =
|
|
8553
|
+
e = H(), e.length === 0 && at();
|
|
8544
8554
|
} catch {
|
|
8545
8555
|
}
|
|
8546
8556
|
const i = s == null ? void 0 : s.disabled;
|
|
8547
8557
|
if (Array.isArray(i) && i.length > 0) {
|
|
8548
8558
|
let r = 0;
|
|
8549
8559
|
for (const a of i)
|
|
8550
|
-
|
|
8560
|
+
lt(a) && r++;
|
|
8551
8561
|
r > 0;
|
|
8552
8562
|
}
|
|
8553
8563
|
try {
|
|
8554
|
-
e =
|
|
8564
|
+
e = H(), t = nt();
|
|
8555
8565
|
} catch {
|
|
8556
8566
|
e || (e = []), t || (t = []);
|
|
8557
8567
|
}
|
|
@@ -8562,15 +8572,15 @@ function ai(s) {
|
|
|
8562
8572
|
}
|
|
8563
8573
|
export {
|
|
8564
8574
|
ii as V,
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8575
|
+
st as a,
|
|
8576
|
+
ot as b,
|
|
8577
|
+
nt as c,
|
|
8578
|
+
at as d,
|
|
8569
8579
|
si as e,
|
|
8570
|
-
|
|
8571
|
-
|
|
8580
|
+
ct as f,
|
|
8581
|
+
H as g,
|
|
8572
8582
|
ri as h,
|
|
8573
8583
|
ai as i,
|
|
8574
|
-
|
|
8584
|
+
m as r
|
|
8575
8585
|
};
|
|
8576
|
-
//# sourceMappingURL=editor-
|
|
8586
|
+
//# sourceMappingURL=editor-BfdrdqUU.js.map
|