@codingfactory/mediables-vue 2.3.2 → 2.3.4
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-Cz7dg92v.js → PixiFrameExporter-B6w9IirP.js} +2 -2
- package/dist/{PixiFrameExporter-Cz7dg92v.js.map → PixiFrameExporter-B6w9IirP.js.map} +1 -1
- package/dist/{PixiFrameExporter-dBsAo3iz.cjs → PixiFrameExporter-BRm0MI7V.cjs} +2 -2
- package/dist/{PixiFrameExporter-dBsAo3iz.cjs.map → PixiFrameExporter-BRm0MI7V.cjs.map} +1 -1
- package/dist/components/video/VideoEditorDialog.vue.d.ts +2 -2
- package/dist/editor-DhRuADQT.cjs +42 -0
- package/dist/editor-DhRuADQT.cjs.map +1 -0
- package/dist/{editor-CfH1RN8F.js → editor-DrTmgu3R.js} +1278 -978
- package/dist/editor-DrTmgu3R.js.map +1 -0
- package/dist/index-BBpOpdLI.cjs +342 -0
- package/dist/index-BBpOpdLI.cjs.map +1 -0
- package/dist/{index-DDmYo-6o.js → index-CPwV2mtc.js} +7277 -6673
- package/dist/index-CPwV2mtc.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/style.css +1 -1
- package/package.json +1 -1
- package/dist/editor-BPW3mi6G.cjs +0 -42
- package/dist/editor-BPW3mi6G.cjs.map +0 -1
- package/dist/editor-CfH1RN8F.js.map +0 -1
- package/dist/index-DDmYo-6o.js.map +0 -1
- package/dist/index-Du0vZ5BO.cjs +0 -39
- package/dist/index-Du0vZ5BO.cjs.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var ge = Object.defineProperty;
|
|
2
|
+
var be = (s, e, t) => e in s ? ge(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var V = (s, e, t) => be(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as g from "pixi-filters";
|
|
5
|
-
import * as
|
|
6
|
-
import { GlProgram as
|
|
7
|
-
class
|
|
5
|
+
import * as w from "pixi.js";
|
|
6
|
+
import { GlProgram as ye } from "pixi.js";
|
|
7
|
+
class O {
|
|
8
8
|
constructor() {
|
|
9
9
|
this._events = /* @__PURE__ */ new Map();
|
|
10
10
|
}
|
|
@@ -17,16 +17,16 @@ class B {
|
|
|
17
17
|
}
|
|
18
18
|
emit(e, ...t) {
|
|
19
19
|
const i = this._events.get(e);
|
|
20
|
-
i && i.forEach((
|
|
20
|
+
i && i.forEach((r) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
r(...t);
|
|
23
23
|
} catch {
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
once(e, t) {
|
|
28
|
-
const i = (...
|
|
29
|
-
this.off(e, i), t(...
|
|
28
|
+
const i = (...r) => {
|
|
29
|
+
this.off(e, i), t(...r);
|
|
30
30
|
};
|
|
31
31
|
return this.on(e, i);
|
|
32
32
|
}
|
|
@@ -34,7 +34,7 @@ class B {
|
|
|
34
34
|
e ? this._events.delete(e) : this._events.clear();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
class
|
|
37
|
+
class _e extends O {
|
|
38
38
|
constructor() {
|
|
39
39
|
super(), this._state = {
|
|
40
40
|
// Image state
|
|
@@ -76,9 +76,9 @@ class pe extends B {
|
|
|
76
76
|
if (e.includes(".")) {
|
|
77
77
|
const t = e.split(".");
|
|
78
78
|
let i = this._state;
|
|
79
|
-
for (const
|
|
79
|
+
for (const r of t) {
|
|
80
80
|
if (i == null) return;
|
|
81
|
-
i = i[
|
|
81
|
+
i = i[r];
|
|
82
82
|
}
|
|
83
83
|
return i;
|
|
84
84
|
}
|
|
@@ -92,9 +92,9 @@ class pe extends B {
|
|
|
92
92
|
set(e, t) {
|
|
93
93
|
const i = this.get(e);
|
|
94
94
|
if (e.includes(".")) {
|
|
95
|
-
const
|
|
95
|
+
const r = e.split("."), a = r.pop();
|
|
96
96
|
let o = this._state;
|
|
97
|
-
for (const n of
|
|
97
|
+
for (const n of r)
|
|
98
98
|
o[n] === void 0 && (o[n] = {}), o = o[n];
|
|
99
99
|
o[a] = t;
|
|
100
100
|
} else
|
|
@@ -160,10 +160,10 @@ class pe extends B {
|
|
|
160
160
|
this.set("isDarkMode", this._state.theme === "dark");
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return new
|
|
163
|
+
function xe() {
|
|
164
|
+
return new _e();
|
|
165
165
|
}
|
|
166
|
-
class
|
|
166
|
+
class Ce extends O {
|
|
167
167
|
constructor() {
|
|
168
168
|
super(), this.app = null, this.sprite = null, this.originalTexture = null, this.baseTexture = null, this.fitScale = 1, this.zoom = 1, this._container = null, this._mountPromise = null;
|
|
169
169
|
}
|
|
@@ -181,8 +181,8 @@ class me extends B {
|
|
|
181
181
|
* canvas getter which throws when renderer is undefined.
|
|
182
182
|
*/
|
|
183
183
|
_getCssSize() {
|
|
184
|
-
var
|
|
185
|
-
const e = (a = (
|
|
184
|
+
var r, a, o, n, l, c;
|
|
185
|
+
const e = (a = (r = this.app) == null ? void 0 : r.renderer) == null ? void 0 : a.canvas, t = (e == null ? void 0 : e.clientWidth) ?? ((n = (o = this.app) == null ? void 0 : o.screen) == null ? void 0 : n.width) ?? 0, i = (e == null ? void 0 : e.clientHeight) ?? ((c = (l = this.app) == null ? void 0 : l.screen) == null ? void 0 : c.height) ?? 0;
|
|
186
186
|
return { w: t, h: i };
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
@@ -204,15 +204,15 @@ class me extends B {
|
|
|
204
204
|
if (!this.app || !e) return 1;
|
|
205
205
|
const { w: t, h: i } = this._getCssSize();
|
|
206
206
|
if (t <= 1 || i <= 1) return 1;
|
|
207
|
-
let
|
|
208
|
-
return (!Number.isFinite(
|
|
207
|
+
let r = Math.min(t / e.width, i / e.height) * 0.9;
|
|
208
|
+
return (!Number.isFinite(r) || r <= 0) && (r = 1), r;
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
211
|
* Apply view transform (position and scale) to sprite
|
|
212
212
|
*/
|
|
213
213
|
applyViewTransform(e = {}) {
|
|
214
214
|
if (!this.app || !this.sprite || !this.originalTexture) return;
|
|
215
|
-
const t = this.fitScale * this.zoom, { w: i, h:
|
|
215
|
+
const t = this.fitScale * this.zoom, { w: i, h: r } = this._getCssSize(), a = e.keepCenter ? { x: this.sprite.x + this.sprite.width / 2, y: this.sprite.y + this.sprite.height / 2 } : e.center ?? { x: i / 2, y: r / 2 };
|
|
216
216
|
this.sprite.width = this.originalTexture.width * t, this.sprite.height = this.originalTexture.height * t, this.sprite.x = a.x - this.sprite.width / 2, this.sprite.y = a.y - this.sprite.height / 2, this.render();
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
@@ -239,12 +239,12 @@ class me extends B {
|
|
|
239
239
|
this._container = e;
|
|
240
240
|
const i = async () => {
|
|
241
241
|
var l;
|
|
242
|
-
const
|
|
243
|
-
if (!
|
|
242
|
+
const r = window.PIXI;
|
|
243
|
+
if (!r)
|
|
244
244
|
throw new Error("PIXI.js not found. Please ensure PIXI is loaded globally.");
|
|
245
|
-
(l =
|
|
245
|
+
(l = r.Assets) != null && l.setPreferences && r.Assets.setPreferences({ crossOrigin: "anonymous" });
|
|
246
246
|
const a = e.clientWidth || 600, o = e.clientHeight || 400;
|
|
247
|
-
this.app = new
|
|
247
|
+
this.app = new r.Application(), await this.app.init({
|
|
248
248
|
width: a,
|
|
249
249
|
height: o,
|
|
250
250
|
backgroundColor: t,
|
|
@@ -266,14 +266,14 @@ class me extends B {
|
|
|
266
266
|
if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return;
|
|
267
267
|
const t = window.PIXI, i = await this._loadImageElement(e);
|
|
268
268
|
if (!i || !((c = this.app) != null && c.renderer)) return;
|
|
269
|
-
const
|
|
270
|
-
if (!
|
|
269
|
+
const r = t.Texture.from(i);
|
|
270
|
+
if (!r)
|
|
271
271
|
return;
|
|
272
|
-
this.originalTexture =
|
|
272
|
+
this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new t.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
|
|
273
273
|
const { w: a, h: o } = this._getCssSize();
|
|
274
274
|
if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((d = this.app) != null && d.renderer)) return;
|
|
275
|
-
const n = this.getFitScaleFor(
|
|
276
|
-
Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width:
|
|
275
|
+
const n = this.getFitScaleFor(r);
|
|
276
|
+
Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height });
|
|
277
277
|
}
|
|
278
278
|
/**
|
|
279
279
|
* Export the current image with filters applied
|
|
@@ -283,48 +283,42 @@ class me extends B {
|
|
|
283
283
|
* @param {boolean} dontUpscale - Don't upscale smaller images
|
|
284
284
|
* @returns {string|null} Data URL
|
|
285
285
|
*/
|
|
286
|
-
exportImage(e = "png", t = 0.92, i = 0,
|
|
287
|
-
var
|
|
288
|
-
if (!((
|
|
286
|
+
exportImage(e = "png", t = 0.92, i = 0, r = !0) {
|
|
287
|
+
var _;
|
|
288
|
+
if (!((_ = this.app) != null && _.renderer) || !this.originalTexture || !this.sprite)
|
|
289
289
|
return null;
|
|
290
290
|
const a = window.PIXI, o = Math.round(this.originalTexture.width), n = Math.round(this.originalTexture.height);
|
|
291
291
|
if (o <= 0 || n <= 0)
|
|
292
292
|
return null;
|
|
293
293
|
let l = o, c = n;
|
|
294
294
|
if (i > 0) {
|
|
295
|
-
const
|
|
296
|
-
let
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
const d = new a.Container(), h = new a.Sprite(this.originalTexture);
|
|
300
|
-
if (h.scale.set(l / o, c / n), (_ = (b = this.sprite) == null ? void 0 : b.filters) != null && _.length) {
|
|
301
|
-
const x = this.sprite.filters.map(
|
|
302
|
-
(y) => typeof (y == null ? void 0 : y.clone) == "function" ? y.clone() : y
|
|
303
|
-
);
|
|
304
|
-
h.filters = x;
|
|
295
|
+
const A = Math.max(o, n);
|
|
296
|
+
let S = i / A;
|
|
297
|
+
r && (S = Math.min(1, S)), l = Math.round(o * S), c = Math.round(n * S);
|
|
305
298
|
}
|
|
306
|
-
d.
|
|
307
|
-
let
|
|
299
|
+
const d = this.sprite, h = d.parent, p = h ? h.getChildIndex(d) : 0, m = d.x, C = d.y, b = d.scale.x, y = d.scale.y;
|
|
300
|
+
let v = null;
|
|
308
301
|
try {
|
|
309
|
-
|
|
302
|
+
const A = new a.Container();
|
|
303
|
+
if (A.addChild(d), d.x = 0, d.y = 0, d.scale.set(l / o, c / n), v = a.RenderTexture.create({ width: l, height: c }), this.app.renderer.render({ container: A, target: v }), !this.app.renderer.extract)
|
|
310
304
|
return null;
|
|
311
|
-
const
|
|
312
|
-
if (!
|
|
305
|
+
const S = this.app.renderer.extract.canvas(v);
|
|
306
|
+
if (!S)
|
|
313
307
|
return null;
|
|
314
|
-
let
|
|
315
|
-
if (typeof
|
|
316
|
-
|
|
317
|
-
else if (typeof
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
|
|
308
|
+
let Y = null;
|
|
309
|
+
if (typeof S.toDataURL == "function")
|
|
310
|
+
Y = S.toDataURL(`image/${e}`, t);
|
|
311
|
+
else if (typeof S.getContext == "function") {
|
|
312
|
+
const k = document.createElement("canvas");
|
|
313
|
+
k.width = S.width, k.height = S.height;
|
|
314
|
+
const Q = k.getContext("2d");
|
|
315
|
+
Q && (Q.drawImage(S, 0, 0), Y = k.toDataURL(`image/${e}`, t));
|
|
322
316
|
}
|
|
323
|
-
return
|
|
317
|
+
return Y || null;
|
|
324
318
|
} catch {
|
|
325
319
|
return null;
|
|
326
320
|
} finally {
|
|
327
|
-
|
|
321
|
+
h && h.addChildAt(d, Math.min(p, h.children.length)), d.x = m, d.y = C, d.scale.set(b, y), v && v.destroy(!0);
|
|
328
322
|
}
|
|
329
323
|
}
|
|
330
324
|
/**
|
|
@@ -332,8 +326,8 @@ class me extends B {
|
|
|
332
326
|
* @param {HTMLElement} container
|
|
333
327
|
*/
|
|
334
328
|
resizeTo(e) {
|
|
335
|
-
var
|
|
336
|
-
if (!((
|
|
329
|
+
var r;
|
|
330
|
+
if (!((r = this.app) != null && r.renderer) || !e) return;
|
|
337
331
|
const t = e.clientWidth, i = e.clientHeight;
|
|
338
332
|
if (!(t === Math.round(this.app.screen.width) && i === Math.round(this.app.screen.height)) && !(t <= 0 || i <= 0) && (this.app.renderer.resize(t, i), this.originalTexture && this.sprite)) {
|
|
339
333
|
const a = {
|
|
@@ -379,7 +373,7 @@ class me extends B {
|
|
|
379
373
|
this.sprite = null, this.originalTexture = null, this.baseTexture = null, this._container = null, this.removeAllListeners();
|
|
380
374
|
}
|
|
381
375
|
}
|
|
382
|
-
const
|
|
376
|
+
const we = {
|
|
383
377
|
adjust: ["adjust", "advanced"],
|
|
384
378
|
// adjustment, adjustmentAdvanced, alpha, colorMatrix
|
|
385
379
|
blur: ["blur"],
|
|
@@ -395,7 +389,7 @@ const ge = {
|
|
|
395
389
|
stylize: ["stylize"]
|
|
396
390
|
// ascii, crt, crossHatch, dot, emboss
|
|
397
391
|
};
|
|
398
|
-
class
|
|
392
|
+
class Se extends O {
|
|
399
393
|
constructor(e, t) {
|
|
400
394
|
super(), this.state = e, this.renderer = t, this.instances = {}, this._filterRegistry = null;
|
|
401
395
|
}
|
|
@@ -430,11 +424,11 @@ class be extends B {
|
|
|
430
424
|
*/
|
|
431
425
|
getFiltersByCategory(e) {
|
|
432
426
|
if (!this._filterRegistry) return [];
|
|
433
|
-
const t =
|
|
427
|
+
const t = we[e] || [e], i = [], r = /* @__PURE__ */ new Set();
|
|
434
428
|
for (const a of t) {
|
|
435
429
|
const o = this._filterRegistry.getFiltersByCategory(a) || [];
|
|
436
430
|
for (const n of o)
|
|
437
|
-
|
|
431
|
+
r.has(n.id) || (r.add(n.id), i.push(n));
|
|
438
432
|
}
|
|
439
433
|
return i;
|
|
440
434
|
}
|
|
@@ -458,13 +452,13 @@ class be extends B {
|
|
|
458
452
|
e[t] = i;
|
|
459
453
|
return;
|
|
460
454
|
}
|
|
461
|
-
const
|
|
455
|
+
const r = t.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
462
456
|
let a = e;
|
|
463
|
-
for (let n = 0; n <
|
|
464
|
-
const l =
|
|
457
|
+
for (let n = 0; n < r.length - 1; n++) {
|
|
458
|
+
const l = r[n];
|
|
465
459
|
if (!(l in a) || (a = a[l], a == null)) return;
|
|
466
460
|
}
|
|
467
|
-
const o =
|
|
461
|
+
const o = r[r.length - 1];
|
|
468
462
|
a[o] = i;
|
|
469
463
|
}
|
|
470
464
|
/**
|
|
@@ -474,8 +468,8 @@ class be extends B {
|
|
|
474
468
|
initializeValues(e) {
|
|
475
469
|
const t = this.getFilterDef(e);
|
|
476
470
|
t && t.controls.forEach((i) => {
|
|
477
|
-
const
|
|
478
|
-
i.id in
|
|
471
|
+
const r = this.state.getFilterValues(e);
|
|
472
|
+
i.id in r || this.state.setFilterValue(e, i.id, i.default);
|
|
479
473
|
});
|
|
480
474
|
}
|
|
481
475
|
/**
|
|
@@ -504,12 +498,12 @@ class be extends B {
|
|
|
504
498
|
* @returns {boolean} True if updated in-place
|
|
505
499
|
*/
|
|
506
500
|
updateValue(e, t, i) {
|
|
507
|
-
const
|
|
508
|
-
this.state.setFilterValue(e, t,
|
|
501
|
+
const r = this._normalizeValue(i);
|
|
502
|
+
this.state.setFilterValue(e, t, r);
|
|
509
503
|
const a = this.instances[e];
|
|
510
504
|
if (a) {
|
|
511
505
|
const o = this.getFilterDef(e), n = o == null ? void 0 : o.controls.find((c) => c.id === t), l = (n == null ? void 0 : n.property) || t;
|
|
512
|
-
return typeof a.updateUIParam == "function" ? (a.updateUIParam(l,
|
|
506
|
+
return typeof a.updateUIParam == "function" ? (a.updateUIParam(l, r), !0) : (this._setDeepProp(a, l, r), a.uniforms && l in a.uniforms && (a.uniforms[l] = r), !0);
|
|
513
507
|
}
|
|
514
508
|
return !1;
|
|
515
509
|
}
|
|
@@ -575,7 +569,7 @@ class be extends B {
|
|
|
575
569
|
return this.instances[e] || null;
|
|
576
570
|
}
|
|
577
571
|
}
|
|
578
|
-
const
|
|
572
|
+
const T = class T extends O {
|
|
579
573
|
constructor(e, t) {
|
|
580
574
|
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);
|
|
581
575
|
}
|
|
@@ -603,9 +597,9 @@ const N = class N extends B {
|
|
|
603
597
|
if (t[e] !== void 0) return t[e];
|
|
604
598
|
const i = e.split(":");
|
|
605
599
|
if (i.length === 2) {
|
|
606
|
-
const
|
|
607
|
-
if (Number.isFinite(
|
|
608
|
-
return
|
|
600
|
+
const r = parseFloat(i[0]), a = parseFloat(i[1]);
|
|
601
|
+
if (Number.isFinite(r) && Number.isFinite(a) && a > 0)
|
|
602
|
+
return r / a;
|
|
609
603
|
}
|
|
610
604
|
return null;
|
|
611
605
|
}
|
|
@@ -617,8 +611,8 @@ const N = class N extends B {
|
|
|
617
611
|
if (!e || t === "free") return;
|
|
618
612
|
const i = this._getAspectRatio(t);
|
|
619
613
|
if (!i) return;
|
|
620
|
-
const
|
|
621
|
-
Math.abs(
|
|
614
|
+
const r = e.width / e.height;
|
|
615
|
+
Math.abs(r - i) < 0.01 || (r > i ? e.width = e.height * i : e.height = e.width / i, this.state.set("crop.rect", e));
|
|
622
616
|
}
|
|
623
617
|
/**
|
|
624
618
|
* Constrain crop rect to bounds
|
|
@@ -628,8 +622,8 @@ const N = class N extends B {
|
|
|
628
622
|
if (!e) return;
|
|
629
623
|
const t = this.renderer.sprite, i = this.renderer.app;
|
|
630
624
|
if (!t || !i) return;
|
|
631
|
-
const
|
|
632
|
-
if (e.x = Math.max(o.x, Math.min(e.x, o.x + o.w - e.width)), e.y = Math.max(o.y, Math.min(e.y, o.y + o.h - e.height)), e.width = Math.min(e.width, o.w), e.height = Math.min(e.height, o.h),
|
|
625
|
+
const r = this.state.get("crop.shape"), o = r === "circle" || !!this.state.get("autoZoomOnCropOverflow") ? { x: 0, y: 0, w: i.screen.width, h: i.screen.height } : { x: t.x, y: t.y, w: t.width, h: t.height };
|
|
626
|
+
if (e.x = Math.max(o.x, Math.min(e.x, o.x + o.w - e.width)), e.y = Math.max(o.y, Math.min(e.y, o.y + o.h - e.height)), e.width = Math.min(e.width, o.w), e.height = Math.min(e.height, o.h), r !== "free" || this.state.get("crop.aspect") === "1:1") {
|
|
633
627
|
const n = Math.min(e.width, e.height);
|
|
634
628
|
e.width = n, e.height = n;
|
|
635
629
|
}
|
|
@@ -648,14 +642,14 @@ const N = class N extends B {
|
|
|
648
642
|
* @param {number} currentZoom - Current zoom level
|
|
649
643
|
* @returns {number|null} Target zoom level, or null if no zoom needed
|
|
650
644
|
*/
|
|
651
|
-
static calcAutoZoom(e, t, i,
|
|
652
|
-
if (!e || !
|
|
645
|
+
static calcAutoZoom(e, t, i, r, a, o, n) {
|
|
646
|
+
if (!e || !r || !a || !o) return null;
|
|
653
647
|
const l = e.width > t, c = e.height > i;
|
|
654
648
|
if (!l && !c) return null;
|
|
655
|
-
const d =
|
|
649
|
+
const d = T.AUTO_ZOOM_PADDING;
|
|
656
650
|
let h = n;
|
|
657
651
|
if (l) {
|
|
658
|
-
const p = e.width / (d *
|
|
652
|
+
const p = e.width / (d * r * o);
|
|
659
653
|
h = Math.min(h, p);
|
|
660
654
|
}
|
|
661
655
|
if (c) {
|
|
@@ -671,16 +665,16 @@ const N = class N extends B {
|
|
|
671
665
|
_checkAutoZoom() {
|
|
672
666
|
if (!this.state.get("autoZoomOnCropOverflow")) return;
|
|
673
667
|
const e = Date.now();
|
|
674
|
-
if (e - this._lastAutoZoomCheck <
|
|
668
|
+
if (e - this._lastAutoZoomCheck < T.AUTO_ZOOM_THROTTLE_MS) return;
|
|
675
669
|
this._lastAutoZoomCheck = e;
|
|
676
|
-
const t = this.state.get("crop.rect"), i = this.renderer.sprite,
|
|
677
|
-
if (!t || !i || !
|
|
678
|
-
const a =
|
|
670
|
+
const t = this.state.get("crop.rect"), i = this.renderer.sprite, r = this.renderer.originalTexture;
|
|
671
|
+
if (!t || !i || !r) return;
|
|
672
|
+
const a = T.calcAutoZoom(
|
|
679
673
|
t,
|
|
680
674
|
i.width,
|
|
681
675
|
i.height,
|
|
682
|
-
|
|
683
|
-
|
|
676
|
+
r.width,
|
|
677
|
+
r.height,
|
|
684
678
|
this.renderer.fitScale,
|
|
685
679
|
this.renderer.zoom
|
|
686
680
|
);
|
|
@@ -694,17 +688,17 @@ const N = class N extends B {
|
|
|
694
688
|
if (!e) return;
|
|
695
689
|
const t = this.renderer.app;
|
|
696
690
|
if (!t) return;
|
|
697
|
-
const i = t.canvas,
|
|
698
|
-
(e.width !== Math.max(1, Math.floor(
|
|
691
|
+
const i = t.canvas, r = i.clientWidth, a = i.clientHeight, o = window.devicePixelRatio || 1;
|
|
692
|
+
(e.width !== Math.max(1, Math.floor(r * o)) || e.height !== Math.max(1, Math.floor(a * o))) && (e.width = Math.max(1, Math.floor(r * o)), e.height = Math.max(1, Math.floor(a * o)), e.style.width = r + "px", e.style.height = a + "px");
|
|
699
693
|
const n = e.getContext("2d");
|
|
700
694
|
if (!n) return;
|
|
701
|
-
n.setTransform(o, 0, 0, o, 0, 0), n.clearRect(0, 0,
|
|
695
|
+
n.setTransform(o, 0, 0, o, 0, 0), n.clearRect(0, 0, r, a), n.fillStyle = "rgba(0, 0, 0, 0.5)", n.fillRect(0, 0, r, a);
|
|
702
696
|
const l = this.state.get("crop.rect");
|
|
703
697
|
if (!l) return;
|
|
704
698
|
const c = this.state.get("crop.shape");
|
|
705
699
|
if (n.save(), c === "circle") {
|
|
706
|
-
const
|
|
707
|
-
n.beginPath(), n.arc(
|
|
700
|
+
const y = l.x + l.width / 2, v = l.y + l.height / 2, _ = Math.min(l.width, l.height) / 2;
|
|
701
|
+
n.beginPath(), n.arc(y, v, _, 0, Math.PI * 2), n.clip();
|
|
708
702
|
} else
|
|
709
703
|
n.beginPath(), n.rect(l.x, l.y, l.width, l.height), n.clip();
|
|
710
704
|
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(
|
|
@@ -715,22 +709,22 @@ const N = class N extends B {
|
|
|
715
709
|
Math.PI * 2
|
|
716
710
|
), n.stroke()) : n.strokeRect(l.x, l.y, l.width, l.height), n.setLineDash([]), n.strokeStyle = "rgba(255,255,255,0.3)", n.lineWidth = 1;
|
|
717
711
|
const d = l.width / 3, h = l.height / 3;
|
|
718
|
-
for (let
|
|
719
|
-
n.beginPath(), n.moveTo(l.x + d *
|
|
712
|
+
for (let y = 1; y <= 2; y++)
|
|
713
|
+
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();
|
|
720
714
|
const p = this.HANDLE_SIZE, m = [
|
|
721
715
|
{ x: l.x, y: l.y, m: "resize-nw" },
|
|
722
716
|
{ x: l.x + l.width, y: l.y, m: "resize-ne" },
|
|
723
717
|
{ x: l.x, y: l.y + l.height, m: "resize-sw" },
|
|
724
718
|
{ x: l.x + l.width, y: l.y + l.height, m: "resize-se" }
|
|
725
|
-
],
|
|
719
|
+
], C = [
|
|
726
720
|
{ x: l.x + l.width / 2, y: l.y, m: "n" },
|
|
727
721
|
{ x: l.x + l.width / 2, y: l.y + l.height, m: "s" },
|
|
728
722
|
{ x: l.x, y: l.y + l.height / 2, m: "w" },
|
|
729
723
|
{ x: l.x + l.width, y: l.y + l.height / 2, m: "e" }
|
|
730
|
-
], b = [...m, ...
|
|
731
|
-
for (const
|
|
732
|
-
const
|
|
733
|
-
n.beginPath(), n.rect(
|
|
724
|
+
], b = [...m, ...C];
|
|
725
|
+
for (const y of b) {
|
|
726
|
+
const v = this._hoverMode === y.m, _ = v ? p + 4 : p;
|
|
727
|
+
n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle = v ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
|
|
734
728
|
}
|
|
735
729
|
}
|
|
736
730
|
/**
|
|
@@ -742,8 +736,8 @@ const N = class N extends B {
|
|
|
742
736
|
_hitHandle(e, t) {
|
|
743
737
|
const i = this.state.get("crop.rect");
|
|
744
738
|
if (!i) return null;
|
|
745
|
-
const
|
|
746
|
-
return
|
|
739
|
+
const r = (a, o, n, l, c) => Math.abs(a - n) <= c && Math.abs(o - l) <= c;
|
|
740
|
+
return r(e, t, i.x, i.y, this.HANDLE_SIZE) ? "resize-nw" : r(e, t, i.x + i.width, i.y, this.HANDLE_SIZE) ? "resize-ne" : r(e, t, i.x, i.y + i.height, this.HANDLE_SIZE) ? "resize-sw" : r(e, t, i.x + i.width, i.y + i.height, this.HANDLE_SIZE) ? "resize-se" : Math.abs(t - i.y) <= this.EDGE_HIT_PAD && e >= i.x && e <= i.x + i.width ? "n" : Math.abs(t - (i.y + i.height)) <= this.EDGE_HIT_PAD && e >= i.x && e <= i.x + i.width ? "s" : Math.abs(e - i.x) <= this.EDGE_HIT_PAD && t >= i.y && t <= i.y + i.height ? "w" : Math.abs(e - (i.x + i.width)) <= this.EDGE_HIT_PAD && t >= i.y && t <= i.y + i.height ? "e" : e >= i.x && e <= i.x + i.width && t >= i.y && t <= i.y + i.height ? "move" : null;
|
|
747
741
|
}
|
|
748
742
|
/**
|
|
749
743
|
* Handle pointer down event
|
|
@@ -766,39 +760,39 @@ const N = class N extends B {
|
|
|
766
760
|
this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (d = this._hoverMode) != null && d.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
|
|
767
761
|
return;
|
|
768
762
|
}
|
|
769
|
-
const
|
|
770
|
-
if (!
|
|
763
|
+
const r = this.state.get("crop.rect");
|
|
764
|
+
if (!r) return;
|
|
771
765
|
const a = i.x - this._dragStart.x, o = i.y - this._dragStart.y;
|
|
772
766
|
switch (this._dragMode) {
|
|
773
767
|
case "move":
|
|
774
|
-
|
|
768
|
+
r.x = this._startRect.x + a, r.y = this._startRect.y + o;
|
|
775
769
|
break;
|
|
776
770
|
case "n":
|
|
777
|
-
|
|
771
|
+
r.y = this._startRect.y + o, r.height = this._startRect.height - o;
|
|
778
772
|
break;
|
|
779
773
|
case "s":
|
|
780
|
-
|
|
774
|
+
r.height = this._startRect.height + o;
|
|
781
775
|
break;
|
|
782
776
|
case "w":
|
|
783
|
-
|
|
777
|
+
r.x = this._startRect.x + a, r.width = this._startRect.width - a;
|
|
784
778
|
break;
|
|
785
779
|
case "e":
|
|
786
|
-
|
|
780
|
+
r.width = this._startRect.width + a;
|
|
787
781
|
break;
|
|
788
782
|
case "resize-nw":
|
|
789
|
-
|
|
783
|
+
r.x = this._startRect.x + a, r.y = this._startRect.y + o, r.width = this._startRect.width - a, r.height = this._startRect.height - o;
|
|
790
784
|
break;
|
|
791
785
|
case "resize-ne":
|
|
792
|
-
|
|
786
|
+
r.y = this._startRect.y + o, r.width = this._startRect.width + a, r.height = this._startRect.height - o;
|
|
793
787
|
break;
|
|
794
788
|
case "resize-sw":
|
|
795
|
-
|
|
789
|
+
r.x = this._startRect.x + a, r.width = this._startRect.width - a, r.height = this._startRect.height + o;
|
|
796
790
|
break;
|
|
797
791
|
case "resize-se":
|
|
798
|
-
|
|
792
|
+
r.width = this._startRect.width + a, r.height = this._startRect.height + o;
|
|
799
793
|
break;
|
|
800
794
|
}
|
|
801
|
-
|
|
795
|
+
r.width = Math.max(50, r.width), r.height = Math.max(50, r.height), this.state.set("crop.rect", r), this.state.get("crop.shape") === "circle" && this.state.get("crop.aspect") !== "1:1" && this.state.set("crop.aspect", "1:1"), this.applyAspectRatio(), this._dragMode !== "move" && this._checkAutoZoom(), this.constrainCropRect(), this.drawOverlay();
|
|
802
796
|
}
|
|
803
797
|
/**
|
|
804
798
|
* Handle pointer up event
|
|
@@ -817,8 +811,8 @@ const N = class N extends B {
|
|
|
817
811
|
const a = Math.min(e.screen.width, e.screen.height) * 0.7, o = t.x + (t.width - a) / 2, n = t.y + (t.height - a) / 2;
|
|
818
812
|
i = { x: o, y: n, width: a, height: a }, this.state.set("crop.rect", i), this.state.get("crop.shape") === "circle" && this.state.set("crop.aspect", "1:1"), this.state.get("crop.aspect") !== "free" && (this.applyAspectRatio(), this.constrainCropRect());
|
|
819
813
|
}
|
|
820
|
-
const
|
|
821
|
-
|
|
814
|
+
const r = e.stage;
|
|
815
|
+
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");
|
|
822
816
|
}
|
|
823
817
|
/**
|
|
824
818
|
* Disable crop mode
|
|
@@ -838,27 +832,27 @@ const N = class N extends B {
|
|
|
838
832
|
* @returns {{ texture: PIXI.Texture, preservedZoom: number }|null}
|
|
839
833
|
*/
|
|
840
834
|
apply() {
|
|
841
|
-
const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture,
|
|
842
|
-
if (!
|
|
843
|
-
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (
|
|
844
|
-
let h = Math.round(Math.max(1,
|
|
835
|
+
const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
|
|
836
|
+
if (!r || !t || !e || !i) return null;
|
|
837
|
+
const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n, d = (r.y - t.y) * l;
|
|
838
|
+
let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), C = Math.round(d);
|
|
845
839
|
if (h <= 0 || p <= 0) return null;
|
|
846
|
-
const b = new a.Container(),
|
|
840
|
+
const b = new a.Container(), y = new a.Sprite(i);
|
|
847
841
|
if (this.state.get("crop.shape") === "circle") {
|
|
848
|
-
const
|
|
849
|
-
m = Math.round(
|
|
850
|
-
const
|
|
851
|
-
typeof
|
|
842
|
+
const A = Math.round(Math.max(h, p)), S = m + h / 2, Y = C + p / 2;
|
|
843
|
+
m = Math.round(S - A / 2), C = Math.round(Y - A / 2), h = p = A;
|
|
844
|
+
const k = new a.Graphics();
|
|
845
|
+
typeof k.circle == "function" && typeof k.fill == "function" ? k.circle(h / 2, p / 2, h / 2).fill(16777215) : (k.beginFill(16777215, 1), k.drawCircle(h / 2, p / 2, h / 2), k.endFill()), y.mask = k, b.addChild(k);
|
|
852
846
|
}
|
|
853
|
-
|
|
854
|
-
const
|
|
847
|
+
y.x = -m, y.y = -C, b.addChild(y);
|
|
848
|
+
const _ = a.RenderTexture.create({ width: h, height: p });
|
|
855
849
|
e.renderer.render({
|
|
856
850
|
container: b,
|
|
857
|
-
target:
|
|
851
|
+
target: _,
|
|
858
852
|
clear: !0
|
|
859
|
-
}), b.destroy({ children: !0 }), this.renderer.originalTexture =
|
|
860
|
-
const
|
|
861
|
-
return e.stage.addChild(
|
|
853
|
+
}), b.destroy({ children: !0 }), this.renderer.originalTexture = _, e.stage.removeChild(t), t.destroy();
|
|
854
|
+
const K = new a.Sprite(_);
|
|
855
|
+
return e.stage.addChild(K), this.renderer.sprite = K, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), this.disable(), this.emit("applied", { width: h, height: p }), { texture: _, preservedZoom: o };
|
|
862
856
|
}
|
|
863
857
|
/**
|
|
864
858
|
* Cancel crop
|
|
@@ -885,12 +879,12 @@ const N = class N extends B {
|
|
|
885
879
|
* Padding factor for auto-zoom: image will be ~91% of crop size (1/1.1).
|
|
886
880
|
* Higher values = more aggressive zoom-out, more padding around image.
|
|
887
881
|
*/
|
|
888
|
-
|
|
882
|
+
V(T, "AUTO_ZOOM_PADDING", 1.1), /**
|
|
889
883
|
* Minimum interval (ms) between auto-zoom adjustments during drag.
|
|
890
884
|
*/
|
|
891
|
-
|
|
892
|
-
let
|
|
893
|
-
class
|
|
885
|
+
V(T, "AUTO_ZOOM_THROTTLE_MS", 100);
|
|
886
|
+
let $ = T;
|
|
887
|
+
class ve {
|
|
894
888
|
/**
|
|
895
889
|
* Create a new RemoveBgManager
|
|
896
890
|
* @param {Object} options
|
|
@@ -913,13 +907,13 @@ class ye {
|
|
|
913
907
|
* @returns {Promise<{dataUrl: string, model: string, processMs: string}>}
|
|
914
908
|
*/
|
|
915
909
|
async removeBackground(e, t = {}) {
|
|
916
|
-
const i = typeof e == "string" ? await this._dataUrlToBlob(e) : e,
|
|
917
|
-
|
|
910
|
+
const i = typeof e == "string" ? await this._dataUrlToBlob(e) : e, r = new FormData();
|
|
911
|
+
r.append("file", i, "image.png"), r.append("tier", t.tier || "balanced"), t.model && r.append("model", t.model), t.alpha_matting && (r.append("alpha_matting", "true"), r.append("alpha_f", String(t.alpha_f ?? 10)), r.append("alpha_fr", String(t.alpha_fr ?? 15)), r.append("alpha_erode_size", String(t.alpha_erode_size ?? 10)));
|
|
918
912
|
let a, o;
|
|
919
913
|
try {
|
|
920
914
|
a = await fetch(this._endpoint, {
|
|
921
915
|
method: "POST",
|
|
922
|
-
body:
|
|
916
|
+
body: r,
|
|
923
917
|
credentials: "include"
|
|
924
918
|
// For Sanctum auth
|
|
925
919
|
});
|
|
@@ -930,7 +924,7 @@ class ye {
|
|
|
930
924
|
try {
|
|
931
925
|
a = await fetch(this._fallbackEndpoint, {
|
|
932
926
|
method: "POST",
|
|
933
|
-
body:
|
|
927
|
+
body: r
|
|
934
928
|
});
|
|
935
929
|
} catch (c) {
|
|
936
930
|
o || (o = c);
|
|
@@ -960,7 +954,7 @@ class ye {
|
|
|
960
954
|
*/
|
|
961
955
|
async _dataUrlToBlob(e) {
|
|
962
956
|
if (e.startsWith("data:")) {
|
|
963
|
-
const [i,
|
|
957
|
+
const [i, r] = e.split(","), a = i.match(/:(.*?);/), o = a ? a[1] : "image/png", n = atob(r), l = new Uint8Array(n.length);
|
|
964
958
|
for (let c = 0; c < n.length; c++)
|
|
965
959
|
l[c] = n.charCodeAt(c);
|
|
966
960
|
return new Blob([l], { type: o });
|
|
@@ -974,8 +968,8 @@ class ye {
|
|
|
974
968
|
*/
|
|
975
969
|
_blobToDataUrl(e) {
|
|
976
970
|
return new Promise((t, i) => {
|
|
977
|
-
const
|
|
978
|
-
|
|
971
|
+
const r = new FileReader();
|
|
972
|
+
r.onload = () => t(r.result), r.onerror = () => i(new Error("Failed to read blob as data URL")), r.readAsDataURL(e);
|
|
979
973
|
});
|
|
980
974
|
}
|
|
981
975
|
/**
|
|
@@ -1000,58 +994,58 @@ class ye {
|
|
|
1000
994
|
}
|
|
1001
995
|
}
|
|
1002
996
|
}
|
|
1003
|
-
function u(
|
|
1004
|
-
const i = document.createElement(
|
|
1005
|
-
for (const [
|
|
997
|
+
function u(s, e = {}, ...t) {
|
|
998
|
+
const i = document.createElement(s);
|
|
999
|
+
for (const [r, a] of Object.entries(e))
|
|
1006
1000
|
if (a != null)
|
|
1007
|
-
if (
|
|
1001
|
+
if (r === "className")
|
|
1008
1002
|
i.className = a;
|
|
1009
|
-
else if (
|
|
1003
|
+
else if (r === "style" && typeof a == "object")
|
|
1010
1004
|
Object.assign(i.style, a);
|
|
1011
|
-
else if (
|
|
1012
|
-
const o =
|
|
1005
|
+
else if (r.startsWith("on") && typeof a == "function") {
|
|
1006
|
+
const o = r.slice(2).toLowerCase();
|
|
1013
1007
|
i.addEventListener(o, a);
|
|
1014
|
-
} else
|
|
1015
|
-
for (const
|
|
1016
|
-
typeof
|
|
1008
|
+
} else r === "dataset" && typeof a == "object" ? Object.assign(i.dataset, a) : i.setAttribute(r, a);
|
|
1009
|
+
for (const r of t)
|
|
1010
|
+
typeof r == "string" ? i.appendChild(document.createTextNode(r)) : r instanceof HTMLElement && i.appendChild(r);
|
|
1017
1011
|
return i;
|
|
1018
1012
|
}
|
|
1019
|
-
function
|
|
1020
|
-
const n =
|
|
1013
|
+
function ne({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
|
|
1014
|
+
const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = u("div", {
|
|
1021
1015
|
className: "slider-control slider-wrapper",
|
|
1022
1016
|
"data-control": n,
|
|
1023
1017
|
"data-testid": `slider-${n}`
|
|
1024
1018
|
}), c = u(
|
|
1025
1019
|
"div",
|
|
1026
1020
|
{ className: "slider-header" },
|
|
1027
|
-
u("label", { for:
|
|
1028
|
-
u("span", { className: "slider-value", id: `${
|
|
1021
|
+
u("label", { for: s, className: "slider-label" }, e),
|
|
1022
|
+
u("span", { className: "slider-value", id: `${s}-value` }, j(a))
|
|
1029
1023
|
), d = u("input", {
|
|
1030
1024
|
type: "range",
|
|
1031
|
-
id:
|
|
1025
|
+
id: s,
|
|
1032
1026
|
className: "slider-input",
|
|
1033
1027
|
min: String(t),
|
|
1034
1028
|
max: String(i),
|
|
1035
|
-
step: String(
|
|
1029
|
+
step: String(r),
|
|
1036
1030
|
value: String(a),
|
|
1037
1031
|
onInput: (h) => {
|
|
1038
1032
|
const p = parseFloat(h.target.value), m = l.querySelector(".slider-value");
|
|
1039
|
-
m && (m.textContent =
|
|
1033
|
+
m && (m.textContent = j(p)), o == null || o(p);
|
|
1040
1034
|
}
|
|
1041
1035
|
});
|
|
1042
1036
|
return l.appendChild(c), l.appendChild(d), l.setValue = (h) => {
|
|
1043
1037
|
d.value = String(h);
|
|
1044
1038
|
const p = l.querySelector(".slider-value");
|
|
1045
|
-
p && (p.textContent =
|
|
1039
|
+
p && (p.textContent = j(h));
|
|
1046
1040
|
}, l;
|
|
1047
1041
|
}
|
|
1048
|
-
function
|
|
1049
|
-
return Number.isInteger(
|
|
1042
|
+
function j(s) {
|
|
1043
|
+
return Number.isInteger(s) ? String(s) : s.toFixed(2);
|
|
1050
1044
|
}
|
|
1051
|
-
function
|
|
1052
|
-
const
|
|
1045
|
+
function le({ id: s, label: e, checked: t = !1, onChange: i }) {
|
|
1046
|
+
const r = u("div", { className: "toggle-control" }), a = u("label", { className: "toggle-label", for: s }, e), o = u("input", {
|
|
1053
1047
|
type: "checkbox",
|
|
1054
|
-
id:
|
|
1048
|
+
id: s,
|
|
1055
1049
|
className: "toggle-input",
|
|
1056
1050
|
checked: t ? "checked" : void 0,
|
|
1057
1051
|
onChange: (c) => i == null ? void 0 : i(c.target.checked)
|
|
@@ -1061,27 +1055,27 @@ function xe({ id: r, label: e, checked: t = !1, onChange: i }) {
|
|
|
1061
1055
|
c.target !== o && (o.checked = !o.checked, i == null || i(o.checked));
|
|
1062
1056
|
}
|
|
1063
1057
|
}), l = u("span", { className: "toggle-slider" });
|
|
1064
|
-
return n.appendChild(o), n.appendChild(l),
|
|
1058
|
+
return n.appendChild(o), n.appendChild(l), r.appendChild(a), r.appendChild(n), r.setChecked = (c) => {
|
|
1065
1059
|
o.checked = c;
|
|
1066
|
-
},
|
|
1060
|
+
}, r;
|
|
1067
1061
|
}
|
|
1068
|
-
function
|
|
1069
|
-
const
|
|
1062
|
+
function ce({ id: s, label: e, value: t = "#000000", onChange: i }) {
|
|
1063
|
+
const r = u("div", { className: "color-control" }), a = u("label", { className: "color-label", for: s }, e), o = u("input", {
|
|
1070
1064
|
type: "color",
|
|
1071
|
-
id:
|
|
1065
|
+
id: s,
|
|
1072
1066
|
className: "color-input",
|
|
1073
1067
|
value: t,
|
|
1074
1068
|
onInput: (n) => i == null ? void 0 : i(n.target.value)
|
|
1075
1069
|
});
|
|
1076
|
-
return
|
|
1070
|
+
return r.appendChild(a), r.appendChild(o), r.setValue = (n) => {
|
|
1077
1071
|
o.value = n;
|
|
1078
|
-
},
|
|
1072
|
+
}, r;
|
|
1079
1073
|
}
|
|
1080
|
-
function
|
|
1081
|
-
const a = u("div", { className: "select-control" }), o = u("label", { className: "select-label", for:
|
|
1082
|
-
id:
|
|
1074
|
+
function he({ id: s, label: e, options: t = [], value: i, onChange: r }) {
|
|
1075
|
+
const a = u("div", { className: "select-control" }), o = u("label", { className: "select-label", for: s }, e), n = u("select", {
|
|
1076
|
+
id: s,
|
|
1083
1077
|
className: "select-input",
|
|
1084
|
-
onChange: (l) =>
|
|
1078
|
+
onChange: (l) => r == null ? void 0 : r(l.target.value)
|
|
1085
1079
|
});
|
|
1086
1080
|
for (const l of t) {
|
|
1087
1081
|
const c = u("option", { value: l.value }, l.label);
|
|
@@ -1091,12 +1085,12 @@ function we({ id: r, label: e, options: t = [], value: i, onChange: s }) {
|
|
|
1091
1085
|
n.value = l;
|
|
1092
1086
|
}, a;
|
|
1093
1087
|
}
|
|
1094
|
-
function
|
|
1088
|
+
function z({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
|
|
1095
1089
|
const a = u("button", {
|
|
1096
1090
|
type: "button",
|
|
1097
1091
|
className: `btn ${e}`.trim(),
|
|
1098
1092
|
onClick: t,
|
|
1099
|
-
disabled:
|
|
1093
|
+
disabled: r ? "disabled" : void 0
|
|
1100
1094
|
});
|
|
1101
1095
|
if (i) {
|
|
1102
1096
|
const o = u("span", { className: "btn-icon" });
|
|
@@ -1104,25 +1098,25 @@ function Y({ label: r, className: e = "", onClick: t, icon: i = null, disabled:
|
|
|
1104
1098
|
const n = o.querySelector("svg");
|
|
1105
1099
|
n && n.setAttribute("aria-hidden", "true"), a.appendChild(o);
|
|
1106
1100
|
}
|
|
1107
|
-
return
|
|
1101
|
+
return s && a.appendChild(document.createTextNode(s)), a;
|
|
1108
1102
|
}
|
|
1109
|
-
function
|
|
1103
|
+
function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1, testId: a = null, ariaLabel: o = null }) {
|
|
1110
1104
|
const n = {
|
|
1111
1105
|
type: "button",
|
|
1112
1106
|
className: `icon-btn ${t}`.trim(),
|
|
1113
1107
|
title: e,
|
|
1114
1108
|
"aria-label": o || e,
|
|
1115
1109
|
onClick: i,
|
|
1116
|
-
disabled:
|
|
1110
|
+
disabled: r ? "disabled" : void 0
|
|
1117
1111
|
};
|
|
1118
1112
|
a && (n.dataset = { testid: a });
|
|
1119
1113
|
const l = u("button", n);
|
|
1120
|
-
l.innerHTML =
|
|
1114
|
+
l.innerHTML = s;
|
|
1121
1115
|
const c = l.querySelector("svg");
|
|
1122
1116
|
return c && c.setAttribute("aria-hidden", "true"), l;
|
|
1123
1117
|
}
|
|
1124
|
-
function
|
|
1125
|
-
const
|
|
1118
|
+
function W({ label: s, icon: e, active: t = !1, onClick: i }) {
|
|
1119
|
+
const r = u("button", {
|
|
1126
1120
|
type: "button",
|
|
1127
1121
|
className: `chip ${t ? "active" : ""}`.trim(),
|
|
1128
1122
|
onClick: i
|
|
@@ -1131,14 +1125,14 @@ function $({ label: r, icon: e, active: t = !1, onClick: i }) {
|
|
|
1131
1125
|
const a = u("span", { className: "chip-icon" });
|
|
1132
1126
|
a.innerHTML = e;
|
|
1133
1127
|
const o = a.querySelector("svg");
|
|
1134
|
-
o && o.setAttribute("aria-hidden", "true"),
|
|
1128
|
+
o && o.setAttribute("aria-hidden", "true"), r.appendChild(a);
|
|
1135
1129
|
}
|
|
1136
|
-
return
|
|
1137
|
-
|
|
1138
|
-
},
|
|
1130
|
+
return r.appendChild(u("span", { className: "chip-label" }, s)), r.setActive = (a) => {
|
|
1131
|
+
r.classList.toggle("active", a);
|
|
1132
|
+
}, r;
|
|
1139
1133
|
}
|
|
1140
|
-
const
|
|
1141
|
-
class
|
|
1134
|
+
const de = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M328 112L184 256l144 144"/></svg>', ue = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M184 112l144 144-144 144"/></svg>', ke = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M256 184v74m-37-37h74"/></svg>', Pe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="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>', Me = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M432 320v112H320M80 192V80h112M320 80h112v112M192 432H80V320"/></svg>', Fe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="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>', Ae = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="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>', ze = '<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>', 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="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>', 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="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></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="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>', pe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="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>', 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="M380.93 57.37A32 32 0 00358.3 48H94.22A46.21 46.21 0 0048 94.22v323.56A46.21 46.21 0 0094.22 464h323.56A46.36 46.36 0 00464 417.78V153.7a32 32 0 00-9.37-22.63zM256 416a64 64 0 1164-64 63.92 63.92 0 01-64 64zm48-224H112a16 16 0 01-16-16v-64a16 16 0 0116-16h192a16 16 0 0116 16v64a16 16 0 01-16 16z"/></svg>', G = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 368L144 144M368 144L144 368"/></svg>', fe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="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>', 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="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>', 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="M64 192v-72a40 40 0 0140-40h75.89a40 40 0 0122.19 6.72l27.84 18.56a40 40 0 0022.19 6.72H408a40 40 0 0140 40v40"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M479.9 226.55L463.68 392a40 40 0 01-39.93 40H88.25a40 40 0 01-39.93-40L32.1 226.55A32 32 0 0164 192h384.1a32 32 0 0131.8 34.55z"/></svg>', Z = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416 128L192 384l-96-96"/></svg>', Ye = '<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>', Be = '<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>', 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="M80 96h64l64 320h64l64-160h96"/></svg>', J = '<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>', 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="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>', 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="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>';
|
|
1135
|
+
class De {
|
|
1142
1136
|
constructor(e, t) {
|
|
1143
1137
|
this.state = e, this.editor = t, this.element = null, this._unsubscribers = [];
|
|
1144
1138
|
}
|
|
@@ -1148,7 +1142,7 @@ class Le {
|
|
|
1148
1142
|
*/
|
|
1149
1143
|
render() {
|
|
1150
1144
|
this.element = u("div", { className: "editor-toolbar" });
|
|
1151
|
-
const e = u("div", { className: "toolbar-section toolbar-left" }), t =
|
|
1145
|
+
const e = u("div", { className: "toolbar-section toolbar-left" }), t = x({
|
|
1152
1146
|
icon: Xe,
|
|
1153
1147
|
title: "Open Image",
|
|
1154
1148
|
className: "toolbar-btn",
|
|
@@ -1157,8 +1151,8 @@ class Le {
|
|
|
1157
1151
|
onClick: () => this.editor.openFilePicker()
|
|
1158
1152
|
});
|
|
1159
1153
|
e.appendChild(t);
|
|
1160
|
-
const i = u("div", { className: "toolbar-section toolbar-center" }),
|
|
1161
|
-
icon:
|
|
1154
|
+
const i = u("div", { className: "toolbar-section toolbar-center" }), r = x({
|
|
1155
|
+
icon: Pe,
|
|
1162
1156
|
title: "Zoom Out",
|
|
1163
1157
|
className: "toolbar-btn",
|
|
1164
1158
|
testId: "btn-zoom-out",
|
|
@@ -1174,8 +1168,8 @@ class Le {
|
|
|
1174
1168
|
"aria-atomic": "true",
|
|
1175
1169
|
role: "status"
|
|
1176
1170
|
}, "100%");
|
|
1177
|
-
const a =
|
|
1178
|
-
icon:
|
|
1171
|
+
const a = x({
|
|
1172
|
+
icon: ke,
|
|
1179
1173
|
title: "Zoom In",
|
|
1180
1174
|
className: "toolbar-btn",
|
|
1181
1175
|
testId: "btn-zoom-in",
|
|
@@ -1184,60 +1178,73 @@ class Le {
|
|
|
1184
1178
|
const h = this.state.get("zoom");
|
|
1185
1179
|
this.editor.setZoom(h + 0.25);
|
|
1186
1180
|
}
|
|
1187
|
-
}), o =
|
|
1188
|
-
icon:
|
|
1181
|
+
}), o = x({
|
|
1182
|
+
icon: Me,
|
|
1189
1183
|
title: "Fit to Screen",
|
|
1190
1184
|
className: "toolbar-btn",
|
|
1191
1185
|
testId: "btn-fit-screen",
|
|
1192
1186
|
ariaLabel: "Fit to screen",
|
|
1193
1187
|
onClick: () => this.editor.fitToScreen()
|
|
1194
1188
|
});
|
|
1195
|
-
i.appendChild(
|
|
1189
|
+
i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
|
|
1196
1190
|
const n = u("div", { className: "toolbar-section toolbar-right" });
|
|
1197
|
-
this._themeBtn =
|
|
1198
|
-
icon: this.state.get("isDarkMode") ?
|
|
1191
|
+
this._themeBtn = x({
|
|
1192
|
+
icon: this.state.get("isDarkMode") ? J : ee,
|
|
1199
1193
|
title: "Toggle Theme",
|
|
1200
|
-
className: "toolbar-btn",
|
|
1194
|
+
className: "toolbar-btn toolbar-btn-theme",
|
|
1201
1195
|
testId: "btn-toggle-theme",
|
|
1202
1196
|
ariaLabel: "Toggle theme",
|
|
1203
1197
|
onClick: () => this.editor.toggleTheme()
|
|
1198
|
+
}), this._cropBtn = x({
|
|
1199
|
+
icon: pe,
|
|
1200
|
+
title: "Crop",
|
|
1201
|
+
className: "toolbar-btn toolbar-btn-crop",
|
|
1202
|
+
testId: "btn-crop",
|
|
1203
|
+
ariaLabel: "Crop image",
|
|
1204
|
+
onClick: () => {
|
|
1205
|
+
this.state.get("mode") === "crop" ? this.editor.setMode("filters") : this.editor.setMode("crop");
|
|
1206
|
+
}
|
|
1204
1207
|
});
|
|
1205
|
-
const l =
|
|
1206
|
-
icon:
|
|
1208
|
+
const l = x({
|
|
1209
|
+
icon: fe,
|
|
1207
1210
|
title: "Reset All",
|
|
1208
1211
|
className: "toolbar-btn",
|
|
1209
1212
|
testId: "btn-reset-all",
|
|
1210
1213
|
ariaLabel: "Reset all changes",
|
|
1211
1214
|
onClick: () => this.editor.resetAll()
|
|
1212
|
-
}), c =
|
|
1213
|
-
icon:
|
|
1215
|
+
}), c = x({
|
|
1216
|
+
icon: Ie,
|
|
1214
1217
|
title: "Save Image",
|
|
1215
1218
|
className: "toolbar-btn toolbar-btn-primary",
|
|
1216
1219
|
testId: "btn-save-edit",
|
|
1217
1220
|
ariaLabel: "Save image",
|
|
1218
1221
|
onClick: () => this.editor.save()
|
|
1219
|
-
}), d =
|
|
1220
|
-
icon:
|
|
1222
|
+
}), d = x({
|
|
1223
|
+
icon: G,
|
|
1221
1224
|
title: "Close",
|
|
1222
1225
|
className: "toolbar-btn",
|
|
1223
1226
|
testId: "btn-cancel-edit",
|
|
1224
1227
|
ariaLabel: "Close editor",
|
|
1225
1228
|
onClick: () => this.editor.close()
|
|
1226
1229
|
});
|
|
1227
|
-
return n.appendChild(this._themeBtn), n.appendChild(l), n.appendChild(c), n.appendChild(d), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
|
|
1230
|
+
return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(d), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
|
|
1228
1231
|
}
|
|
1229
1232
|
/**
|
|
1230
1233
|
* Subscribe to state changes
|
|
1231
1234
|
*/
|
|
1232
1235
|
_subscribeToState() {
|
|
1233
|
-
const e = this.state.on("change:zoom", ({ value:
|
|
1234
|
-
this._zoomLabel.textContent = `${Math.round(
|
|
1236
|
+
const e = this.state.on("change:zoom", ({ value: r }) => {
|
|
1237
|
+
this._zoomLabel.textContent = `${Math.round(r * 100)}%`;
|
|
1235
1238
|
});
|
|
1236
1239
|
this._unsubscribers.push(e);
|
|
1237
|
-
const t = this.state.on("change:isDarkMode", ({ value:
|
|
1238
|
-
this._themeBtn.innerHTML =
|
|
1240
|
+
const t = this.state.on("change:isDarkMode", ({ value: r }) => {
|
|
1241
|
+
this._themeBtn.innerHTML = r ? J : ee;
|
|
1239
1242
|
});
|
|
1240
1243
|
this._unsubscribers.push(t);
|
|
1244
|
+
const i = this.state.on("change:mode", ({ value: r }) => {
|
|
1245
|
+
this._cropBtn && this._cropBtn.classList.toggle("toolbar-btn-primary", r === "crop");
|
|
1246
|
+
});
|
|
1247
|
+
this._unsubscribers.push(i);
|
|
1241
1248
|
}
|
|
1242
1249
|
/**
|
|
1243
1250
|
* Update zoom display
|
|
@@ -1254,22 +1261,22 @@ class Le {
|
|
|
1254
1261
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], (e = this.element) == null || e.remove(), this.element = null;
|
|
1255
1262
|
}
|
|
1256
1263
|
}
|
|
1257
|
-
const
|
|
1258
|
-
{ id: "adjust", name: "Adjust", icon:
|
|
1264
|
+
const L = [
|
|
1265
|
+
{ id: "adjust", name: "Adjust", icon: Fe },
|
|
1259
1266
|
// adjustment, adjustmentAdvanced, alpha
|
|
1260
|
-
{ id: "blur", name: "Blur", icon:
|
|
1267
|
+
{ id: "blur", name: "Blur", icon: Ae },
|
|
1261
1268
|
// blur, kawaseBlur, motionBlur, radialBlur, etc.
|
|
1262
|
-
{ id: "color", name: "Color", icon:
|
|
1269
|
+
{ id: "color", name: "Color", icon: ze },
|
|
1263
1270
|
// colorOverlay, grayscale, hslAdjustment, etc.
|
|
1264
|
-
{ id: "effects", name: "Effects", icon:
|
|
1271
|
+
{ id: "effects", name: "Effects", icon: Ne },
|
|
1265
1272
|
// noise, vignette, pixelate, dropShadow, etc.
|
|
1266
|
-
{ id: "distortion", name: "Distortion", icon:
|
|
1273
|
+
{ id: "distortion", name: "Distortion", icon: Re },
|
|
1267
1274
|
// twist, bulgePinch, displacement, etc.
|
|
1268
|
-
{ id: "light", name: "Light", icon:
|
|
1275
|
+
{ id: "light", name: "Light", icon: Te },
|
|
1269
1276
|
// bloom, glow, godray, advancedBloom
|
|
1270
|
-
{ id: "stylize", name: "Stylize", icon:
|
|
1277
|
+
{ id: "stylize", name: "Stylize", icon: Le },
|
|
1271
1278
|
// ascii, crt, crossHatch, dot, emboss
|
|
1272
|
-
{ id: "crop", name: "Crop", icon:
|
|
1279
|
+
{ id: "crop", name: "Crop", icon: pe }
|
|
1273
1280
|
];
|
|
1274
1281
|
class Ue {
|
|
1275
1282
|
constructor(e, t) {
|
|
@@ -1284,21 +1291,21 @@ class Ue {
|
|
|
1284
1291
|
this._onSelect = e, this.element = u("div", {
|
|
1285
1292
|
className: "category-carousel-container",
|
|
1286
1293
|
"data-testid": "category-carousel"
|
|
1287
|
-
}), this._leftBtn =
|
|
1288
|
-
icon:
|
|
1294
|
+
}), this._leftBtn = x({
|
|
1295
|
+
icon: de,
|
|
1289
1296
|
title: "Previous categories",
|
|
1290
1297
|
className: "carousel-nav carousel-nav-left",
|
|
1291
1298
|
onClick: () => this._scrollLeft()
|
|
1292
|
-
}), this._carousel = u("div", { className: "category-carousel" }),
|
|
1293
|
-
const
|
|
1299
|
+
}), this._carousel = u("div", { className: "category-carousel" }), L.forEach((i) => {
|
|
1300
|
+
const r = W({
|
|
1294
1301
|
label: i.name,
|
|
1295
1302
|
icon: i.icon,
|
|
1296
1303
|
active: this.state.get("selectedCategory") === i.id,
|
|
1297
1304
|
onClick: () => this._selectCategory(i.id)
|
|
1298
1305
|
});
|
|
1299
|
-
|
|
1300
|
-
}), this._rightBtn =
|
|
1301
|
-
icon:
|
|
1306
|
+
r.dataset.categoryId = i.id, r.dataset.category = i.id, r.dataset.testid = `category-${i.id}`, this._chips.set(i.id, r), this._carousel.appendChild(r);
|
|
1307
|
+
}), this._rightBtn = x({
|
|
1308
|
+
icon: ue,
|
|
1302
1309
|
title: "Next categories",
|
|
1303
1310
|
className: "carousel-nav carousel-nav-right",
|
|
1304
1311
|
onClick: () => this._scrollRight()
|
|
@@ -1307,9 +1314,9 @@ class Ue {
|
|
|
1307
1314
|
role: "tablist",
|
|
1308
1315
|
"aria-label": "Category pages"
|
|
1309
1316
|
});
|
|
1310
|
-
const t = Math.ceil(
|
|
1317
|
+
const t = Math.ceil(L.length / 3);
|
|
1311
1318
|
for (let i = 0; i < t; i++) {
|
|
1312
|
-
const
|
|
1319
|
+
const r = u("button", {
|
|
1313
1320
|
type: "button",
|
|
1314
1321
|
className: `pagination-dot ${i === 0 ? "active" : ""}`,
|
|
1315
1322
|
role: "tab",
|
|
@@ -1317,7 +1324,7 @@ class Ue {
|
|
|
1317
1324
|
"aria-selected": i === 0 ? "true" : "false",
|
|
1318
1325
|
onClick: () => this._scrollToPage(i)
|
|
1319
1326
|
});
|
|
1320
|
-
this._pagination.appendChild(
|
|
1327
|
+
this._pagination.appendChild(r);
|
|
1321
1328
|
}
|
|
1322
1329
|
return this.element.appendChild(this._leftBtn), this.element.appendChild(this._carousel), this.element.appendChild(this._rightBtn), this.element.appendChild(this._pagination), this._subscribeToState(), this._updateNavButtons(), this.element;
|
|
1323
1330
|
}
|
|
@@ -1326,8 +1333,8 @@ class Ue {
|
|
|
1326
1333
|
*/
|
|
1327
1334
|
_subscribeToState() {
|
|
1328
1335
|
const e = this.state.on("change:selectedCategory", ({ value: t }) => {
|
|
1329
|
-
this._chips.forEach((i,
|
|
1330
|
-
i.setActive(
|
|
1336
|
+
this._chips.forEach((i, r) => {
|
|
1337
|
+
i.setActive(r === t);
|
|
1331
1338
|
});
|
|
1332
1339
|
});
|
|
1333
1340
|
this._unsubscribers.push(e);
|
|
@@ -1350,7 +1357,7 @@ class Ue {
|
|
|
1350
1357
|
* Scroll carousel right
|
|
1351
1358
|
*/
|
|
1352
1359
|
_scrollRight() {
|
|
1353
|
-
this._scrollIndex <
|
|
1360
|
+
this._scrollIndex < L.length - 3 && (this._scrollIndex++, this._scrollCarousel());
|
|
1354
1361
|
}
|
|
1355
1362
|
/**
|
|
1356
1363
|
* Scroll to a specific page
|
|
@@ -1377,7 +1384,7 @@ class Ue {
|
|
|
1377
1384
|
* Update navigation button states
|
|
1378
1385
|
*/
|
|
1379
1386
|
_updateNavButtons() {
|
|
1380
|
-
this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >=
|
|
1387
|
+
this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >= L.length - 3);
|
|
1381
1388
|
}
|
|
1382
1389
|
/**
|
|
1383
1390
|
* Update pagination dot states
|
|
@@ -1385,8 +1392,8 @@ class Ue {
|
|
|
1385
1392
|
_updatePagination() {
|
|
1386
1393
|
if (this._pagination) {
|
|
1387
1394
|
const e = this._pagination.querySelectorAll(".pagination-dot"), t = Math.floor(this._scrollIndex / 3);
|
|
1388
|
-
e.forEach((i,
|
|
1389
|
-
const a =
|
|
1395
|
+
e.forEach((i, r) => {
|
|
1396
|
+
const a = r === t;
|
|
1390
1397
|
i.classList.toggle("active", a), i.setAttribute("aria-selected", a ? "true" : "false");
|
|
1391
1398
|
});
|
|
1392
1399
|
}
|
|
@@ -1406,7 +1413,7 @@ class Ue {
|
|
|
1406
1413
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1407
1414
|
}
|
|
1408
1415
|
}
|
|
1409
|
-
class
|
|
1416
|
+
class Ve {
|
|
1410
1417
|
constructor(e, t) {
|
|
1411
1418
|
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;
|
|
1412
1419
|
}
|
|
@@ -1416,13 +1423,13 @@ class De {
|
|
|
1416
1423
|
* @returns {HTMLElement}
|
|
1417
1424
|
*/
|
|
1418
1425
|
render({ onToggle: e, onSelect: t }) {
|
|
1419
|
-
return this._onToggle = e, this._onSelect = t, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn =
|
|
1420
|
-
icon:
|
|
1426
|
+
return this._onToggle = e, this._onSelect = t, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn = x({
|
|
1427
|
+
icon: de,
|
|
1421
1428
|
title: "Previous filters",
|
|
1422
1429
|
className: "carousel-nav carousel-nav-left",
|
|
1423
1430
|
onClick: () => this._scrollLeft()
|
|
1424
|
-
}), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn =
|
|
1425
|
-
icon:
|
|
1431
|
+
}), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn = x({
|
|
1432
|
+
icon: ue,
|
|
1426
1433
|
title: "Next filters",
|
|
1427
1434
|
className: "carousel-nav carousel-nav-right",
|
|
1428
1435
|
onClick: () => this._scrollRight()
|
|
@@ -1452,11 +1459,11 @@ class De {
|
|
|
1452
1459
|
this._carousel.innerHTML = "", this._filterCards.clear(), this._scrollIndex = 0;
|
|
1453
1460
|
const e = this.state.get("selectedCategory");
|
|
1454
1461
|
if (e === "crop") return;
|
|
1455
|
-
const t = this.filterManager.getFiltersByCategory(e), i = this.state.get("activeFilters"),
|
|
1462
|
+
const t = this.filterManager.getFiltersByCategory(e), i = this.state.get("activeFilters"), r = this.state.get("selectedFilter");
|
|
1456
1463
|
t.forEach((a) => {
|
|
1457
1464
|
const o = this._createFilterCard(a, {
|
|
1458
1465
|
isActive: i.has(a.id),
|
|
1459
|
-
isSelected:
|
|
1466
|
+
isSelected: r === a.id
|
|
1460
1467
|
});
|
|
1461
1468
|
this._filterCards.set(a.id, o), this._carousel.appendChild(o);
|
|
1462
1469
|
}), this._updateNavButtons();
|
|
@@ -1468,7 +1475,7 @@ class De {
|
|
|
1468
1475
|
* @returns {HTMLElement}
|
|
1469
1476
|
*/
|
|
1470
1477
|
_createFilterCard(e, { isActive: t, isSelected: i }) {
|
|
1471
|
-
const
|
|
1478
|
+
const r = u("div", {
|
|
1472
1479
|
className: `filter-card ${t ? "active" : ""} ${i ? "selected" : ""}`,
|
|
1473
1480
|
"data-filter": e.id,
|
|
1474
1481
|
"data-testid": `filter-${e.id}`,
|
|
@@ -1484,7 +1491,7 @@ class De {
|
|
|
1484
1491
|
this._handleToggle(e.id, h), h && (this.state.set("selectedFilter", e.id), (p = this._onSelect) == null || p.call(this, e.id));
|
|
1485
1492
|
}
|
|
1486
1493
|
});
|
|
1487
|
-
return l.innerHTML = t ? Z : "",
|
|
1494
|
+
return l.innerHTML = t ? Z : "", r.appendChild(a), r.appendChild(n), r.appendChild(l), r._toggle = l, r._isActive = t, r;
|
|
1488
1495
|
}
|
|
1489
1496
|
/**
|
|
1490
1497
|
* Handle filter card click (select)
|
|
@@ -1509,8 +1516,8 @@ class De {
|
|
|
1509
1516
|
_updateActiveStates() {
|
|
1510
1517
|
const e = this.state.get("activeFilters");
|
|
1511
1518
|
this._filterCards.forEach((t, i) => {
|
|
1512
|
-
const
|
|
1513
|
-
t.classList.toggle("active",
|
|
1519
|
+
const r = e.has(i);
|
|
1520
|
+
t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ? Z : "", t._isActive = r;
|
|
1514
1521
|
});
|
|
1515
1522
|
}
|
|
1516
1523
|
/**
|
|
@@ -1563,7 +1570,7 @@ class De {
|
|
|
1563
1570
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterCards.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1564
1571
|
}
|
|
1565
1572
|
}
|
|
1566
|
-
class
|
|
1573
|
+
class je {
|
|
1567
1574
|
constructor(e, t) {
|
|
1568
1575
|
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 = [];
|
|
1569
1576
|
}
|
|
@@ -1608,16 +1615,16 @@ class Ve {
|
|
|
1608
1615
|
return;
|
|
1609
1616
|
}
|
|
1610
1617
|
const i = u("div", { className: "adjustments-header" });
|
|
1611
|
-
i.appendChild(u("span", { className: "adjustments-title" }, t.name)), i.appendChild(
|
|
1618
|
+
i.appendChild(u("span", { className: "adjustments-title" }, t.name)), i.appendChild(z({
|
|
1612
1619
|
label: "Reset",
|
|
1613
1620
|
className: "btn-text",
|
|
1614
1621
|
onClick: () => this._handleReset(e)
|
|
1615
1622
|
})), this.element.appendChild(i);
|
|
1616
|
-
const
|
|
1623
|
+
const r = u("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
|
|
1617
1624
|
t.controls.forEach((o) => {
|
|
1618
1625
|
const n = this._createControl(e, o, a[o.id] ?? o.default);
|
|
1619
|
-
n && (this._controls.set(o.id, n),
|
|
1620
|
-
}), this.element.appendChild(
|
|
1626
|
+
n && (this._controls.set(o.id, n), r.appendChild(n));
|
|
1627
|
+
}), this.element.appendChild(r);
|
|
1621
1628
|
}
|
|
1622
1629
|
/**
|
|
1623
1630
|
* Create a control element based on type
|
|
@@ -1628,12 +1635,12 @@ class Ve {
|
|
|
1628
1635
|
*/
|
|
1629
1636
|
_createControl(e, t, i) {
|
|
1630
1637
|
if (t.hidden) return null;
|
|
1631
|
-
const
|
|
1638
|
+
const r = t.label || t.id;
|
|
1632
1639
|
switch (this._normalizeControlType(t.type)) {
|
|
1633
1640
|
case "slider":
|
|
1634
|
-
return
|
|
1641
|
+
return ne({
|
|
1635
1642
|
id: `${e}-${t.id}`,
|
|
1636
|
-
label:
|
|
1643
|
+
label: r,
|
|
1637
1644
|
min: t.min ?? 0,
|
|
1638
1645
|
max: t.max ?? 1,
|
|
1639
1646
|
step: t.step ?? 0.01,
|
|
@@ -1641,32 +1648,32 @@ class Ve {
|
|
|
1641
1648
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1642
1649
|
});
|
|
1643
1650
|
case "toggle":
|
|
1644
|
-
return
|
|
1651
|
+
return le({
|
|
1645
1652
|
id: `${e}-${t.id}`,
|
|
1646
|
-
label:
|
|
1653
|
+
label: r,
|
|
1647
1654
|
checked: !!i,
|
|
1648
1655
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1649
1656
|
});
|
|
1650
1657
|
case "color":
|
|
1651
|
-
return
|
|
1658
|
+
return ce({
|
|
1652
1659
|
id: `${e}-${t.id}`,
|
|
1653
|
-
label:
|
|
1660
|
+
label: r,
|
|
1654
1661
|
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
1655
1662
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1656
1663
|
});
|
|
1657
1664
|
case "select":
|
|
1658
1665
|
const o = this._normalizeOptions(t.options);
|
|
1659
|
-
return
|
|
1666
|
+
return he({
|
|
1660
1667
|
id: `${e}-${t.id}`,
|
|
1661
|
-
label:
|
|
1668
|
+
label: r,
|
|
1662
1669
|
options: o,
|
|
1663
1670
|
value: i ?? t.default,
|
|
1664
1671
|
onChange: (l) => this._handleChange(e, t.id, l)
|
|
1665
1672
|
});
|
|
1666
1673
|
case "button":
|
|
1667
1674
|
const n = u("div", { className: "button-control" });
|
|
1668
|
-
return n.appendChild(
|
|
1669
|
-
label:
|
|
1675
|
+
return n.appendChild(z({
|
|
1676
|
+
label: r,
|
|
1670
1677
|
className: "btn-secondary",
|
|
1671
1678
|
onClick: () => this._handleAction(e, t.action || t.id)
|
|
1672
1679
|
})), n;
|
|
@@ -1711,8 +1718,8 @@ class Ve {
|
|
|
1711
1718
|
* @param {*} value
|
|
1712
1719
|
*/
|
|
1713
1720
|
_handleChange(e, t, i) {
|
|
1714
|
-
var
|
|
1715
|
-
(
|
|
1721
|
+
var r;
|
|
1722
|
+
(r = this._onChange) == null || r.call(this, e, t, i);
|
|
1716
1723
|
}
|
|
1717
1724
|
/**
|
|
1718
1725
|
* Handle reset button
|
|
@@ -1738,10 +1745,10 @@ class Ve {
|
|
|
1738
1745
|
const e = this.state.get("selectedFilter");
|
|
1739
1746
|
if (!e) return;
|
|
1740
1747
|
const t = this.state.getFilterValues(e), i = this.filterManager.getFilterDef(e);
|
|
1741
|
-
i && i.controls.forEach((
|
|
1742
|
-
const a = this._controls.get(
|
|
1748
|
+
i && i.controls.forEach((r) => {
|
|
1749
|
+
const a = this._controls.get(r.id);
|
|
1743
1750
|
if (a && typeof a.setValue == "function") {
|
|
1744
|
-
const o = t[
|
|
1751
|
+
const o = t[r.id] ?? r.default;
|
|
1745
1752
|
a.setValue(o);
|
|
1746
1753
|
}
|
|
1747
1754
|
});
|
|
@@ -1766,11 +1773,280 @@ class Ve {
|
|
|
1766
1773
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._controls.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1767
1774
|
}
|
|
1768
1775
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1776
|
+
class qe {
|
|
1777
|
+
constructor(e, t) {
|
|
1778
|
+
this.state = e, this.filterManager = t, this._drawer = null, this._body = null, this._titleEl = null, this._isOpen = !1, this._currentFilterId = null, this._controls = /* @__PURE__ */ new Map(), this._onChange = null, this._onReset = null, this._onRemove = null, this._onAction = null, this._container = null;
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* Build the drawer DOM and append to container (should be the controls section)
|
|
1782
|
+
* @param {HTMLElement} container - Parent element (controls-section)
|
|
1783
|
+
* @param {Object} callbacks - { onChange, onReset, onRemove, onAction }
|
|
1784
|
+
*/
|
|
1785
|
+
build(e, { onChange: t, onReset: i, onRemove: r, onAction: a }) {
|
|
1786
|
+
this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = u("div", { className: "mobile-filter-drawer" });
|
|
1787
|
+
const o = u("div", { className: "drawer-header" });
|
|
1788
|
+
this._titleEl = u("span", { className: "drawer-title" }, "Filter");
|
|
1789
|
+
const n = u("div", { className: "drawer-header-actions" }), l = z({
|
|
1790
|
+
label: "Reset",
|
|
1791
|
+
className: "btn-text",
|
|
1792
|
+
onClick: () => {
|
|
1793
|
+
var h;
|
|
1794
|
+
this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
|
|
1795
|
+
}
|
|
1796
|
+
}), c = z({
|
|
1797
|
+
label: "Remove",
|
|
1798
|
+
className: "btn-text btn-danger",
|
|
1799
|
+
onClick: () => {
|
|
1800
|
+
var h;
|
|
1801
|
+
this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
|
|
1802
|
+
}
|
|
1803
|
+
}), d = x({
|
|
1804
|
+
icon: G,
|
|
1805
|
+
title: "Close",
|
|
1806
|
+
className: "btn-icon-sm",
|
|
1807
|
+
ariaLabel: "Close drawer",
|
|
1808
|
+
onClick: () => this.close()
|
|
1809
|
+
});
|
|
1810
|
+
n.appendChild(l), n.appendChild(c), n.appendChild(d), o.appendChild(this._titleEl), o.appendChild(n), this._drawer.appendChild(o), this._body = u("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Open the drawer for a specific filter
|
|
1814
|
+
* @param {string} filterId
|
|
1815
|
+
*/
|
|
1816
|
+
open(e) {
|
|
1817
|
+
this._isOpen && this._currentFilterId === e || (this._currentFilterId = e, this._renderControls(), this._isOpen || (this._isOpen = !0, this._sizeToContainer(), this._animateOpen()));
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Close the drawer
|
|
1821
|
+
*/
|
|
1822
|
+
close() {
|
|
1823
|
+
this._isOpen && (this._isOpen = !1, this._animateClose(), this._currentFilterId = null);
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Check if drawer is open
|
|
1827
|
+
* @returns {boolean}
|
|
1828
|
+
*/
|
|
1829
|
+
get isOpen() {
|
|
1830
|
+
return this._isOpen;
|
|
1831
|
+
}
|
|
1832
|
+
/**
|
|
1833
|
+
* Size the drawer to match the container (controls section) height
|
|
1834
|
+
*/
|
|
1835
|
+
_sizeToContainer() {
|
|
1836
|
+
if (!this._container || !this._drawer) return;
|
|
1837
|
+
const e = this._container.offsetHeight;
|
|
1838
|
+
e > 0 && (this._drawer.style.height = e + "px");
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* Animate drawer open (CSS transition)
|
|
1842
|
+
*/
|
|
1843
|
+
_animateOpen() {
|
|
1844
|
+
this._drawer.style.transition = "none", this._drawer.style.transform = "translateY(100%)", this._drawer.offsetHeight, this._drawer.style.transition = "transform 0.25s cubic-bezier(0.33, 1, 0.68, 1)", this._drawer.style.transform = "translateY(0)";
|
|
1845
|
+
}
|
|
1846
|
+
/**
|
|
1847
|
+
* Animate drawer close (CSS transition)
|
|
1848
|
+
*/
|
|
1849
|
+
_animateClose() {
|
|
1850
|
+
this._drawer.style.transition = "transform 0.2s cubic-bezier(0.32, 0, 0.67, 0)", this._drawer.style.transform = "translateY(100%)";
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Render controls for the current filter
|
|
1854
|
+
*/
|
|
1855
|
+
_renderControls() {
|
|
1856
|
+
if (this._body.innerHTML = "", this._controls.clear(), !this._currentFilterId) return;
|
|
1857
|
+
const e = this.filterManager.getFilterDef(this._currentFilterId);
|
|
1858
|
+
if (!e) return;
|
|
1859
|
+
this._titleEl.textContent = e.name;
|
|
1860
|
+
const t = u("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
|
|
1861
|
+
e.controls.forEach((r) => {
|
|
1862
|
+
if (r.hidden) return;
|
|
1863
|
+
const a = this._createControl(this._currentFilterId, r, i[r.id] ?? r.default);
|
|
1864
|
+
a && (this._controls.set(r.id, a), t.appendChild(a));
|
|
1865
|
+
}), this._body.appendChild(t);
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Create a control element based on type
|
|
1869
|
+
* @param {string} filterId
|
|
1870
|
+
* @param {Object} ctl
|
|
1871
|
+
* @param {*} value
|
|
1872
|
+
* @returns {HTMLElement|null}
|
|
1873
|
+
*/
|
|
1874
|
+
_createControl(e, t, i) {
|
|
1875
|
+
const r = t.label || t.id;
|
|
1876
|
+
switch (this._normalizeControlType(t.type)) {
|
|
1877
|
+
case "slider":
|
|
1878
|
+
return ne({
|
|
1879
|
+
id: `drawer-${e}-${t.id}`,
|
|
1880
|
+
label: r,
|
|
1881
|
+
min: t.min ?? 0,
|
|
1882
|
+
max: t.max ?? 1,
|
|
1883
|
+
step: t.step ?? 0.01,
|
|
1884
|
+
value: typeof i == "number" ? i : t.default ?? 0,
|
|
1885
|
+
onChange: (o) => {
|
|
1886
|
+
var n;
|
|
1887
|
+
return (n = this._onChange) == null ? void 0 : n.call(this, e, t.id, o);
|
|
1888
|
+
}
|
|
1889
|
+
});
|
|
1890
|
+
case "toggle":
|
|
1891
|
+
return le({
|
|
1892
|
+
id: `drawer-${e}-${t.id}`,
|
|
1893
|
+
label: r,
|
|
1894
|
+
checked: !!i,
|
|
1895
|
+
onChange: (o) => {
|
|
1896
|
+
var n;
|
|
1897
|
+
return (n = this._onChange) == null ? void 0 : n.call(this, e, t.id, o);
|
|
1898
|
+
}
|
|
1899
|
+
});
|
|
1900
|
+
case "color":
|
|
1901
|
+
return ce({
|
|
1902
|
+
id: `drawer-${e}-${t.id}`,
|
|
1903
|
+
label: r,
|
|
1904
|
+
value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
|
|
1905
|
+
onChange: (o) => {
|
|
1906
|
+
var n;
|
|
1907
|
+
return (n = this._onChange) == null ? void 0 : n.call(this, e, t.id, o);
|
|
1908
|
+
}
|
|
1909
|
+
});
|
|
1910
|
+
case "select": {
|
|
1911
|
+
const o = this._normalizeOptions(t.options);
|
|
1912
|
+
return he({
|
|
1913
|
+
id: `drawer-${e}-${t.id}`,
|
|
1914
|
+
label: r,
|
|
1915
|
+
options: o,
|
|
1916
|
+
value: i ?? t.default,
|
|
1917
|
+
onChange: (n) => {
|
|
1918
|
+
var l;
|
|
1919
|
+
return (l = this._onChange) == null ? void 0 : l.call(this, e, t.id, n);
|
|
1920
|
+
}
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
case "button": {
|
|
1924
|
+
const o = u("div", { className: "button-control" });
|
|
1925
|
+
return o.appendChild(z({
|
|
1926
|
+
label: r,
|
|
1927
|
+
className: "btn-secondary",
|
|
1928
|
+
onClick: () => {
|
|
1929
|
+
var n;
|
|
1930
|
+
return (n = this._onAction) == null ? void 0 : n.call(this, e, t.action || t.id);
|
|
1931
|
+
}
|
|
1932
|
+
})), o;
|
|
1933
|
+
}
|
|
1934
|
+
default:
|
|
1935
|
+
return null;
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Normalize control type
|
|
1940
|
+
* @param {string} type
|
|
1941
|
+
* @returns {string}
|
|
1942
|
+
*/
|
|
1943
|
+
_normalizeControlType(e) {
|
|
1944
|
+
return {
|
|
1945
|
+
slider: "slider",
|
|
1946
|
+
range: "slider",
|
|
1947
|
+
toggle: "toggle",
|
|
1948
|
+
checkbox: "toggle",
|
|
1949
|
+
color: "color",
|
|
1950
|
+
select: "select",
|
|
1951
|
+
dropdown: "select",
|
|
1952
|
+
button: "button",
|
|
1953
|
+
text: "slider"
|
|
1954
|
+
}[e] || e;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Normalize options array
|
|
1958
|
+
* @param {Array} options
|
|
1959
|
+
* @returns {Array}
|
|
1960
|
+
*/
|
|
1961
|
+
_normalizeOptions(e) {
|
|
1962
|
+
return !e || !Array.isArray(e) ? [] : e.map((t) => typeof t == "object" && t.value !== void 0 ? { value: t.value, label: t.label || String(t.value) } : typeof t == "string" ? { value: t, label: t } : typeof t == "number" ? { value: t, label: String(t) } : { value: t, label: String(t) });
|
|
1963
|
+
}
|
|
1964
|
+
/**
|
|
1965
|
+
* Clean up
|
|
1966
|
+
*/
|
|
1967
|
+
destroy() {
|
|
1968
|
+
var e;
|
|
1969
|
+
this._controls.clear(), (e = this._drawer) == null || e.remove(), this._drawer = null, this._isOpen = !1, this._currentFilterId = null, this._container = null;
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
class He {
|
|
1973
|
+
constructor(e, t) {
|
|
1974
|
+
this.state = e, this.filterManager = t, this.element = null, this._scrollContainer = null, this._chips = /* @__PURE__ */ new Map(), this._unsubscribers = [], this._onToggle = null, this._onSelect = null;
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* @param {Object} callbacks - { onToggle(filterId, enabled), onSelect(filterId) }
|
|
1978
|
+
* @returns {HTMLElement}
|
|
1979
|
+
*/
|
|
1980
|
+
render({ onToggle: e, onSelect: t }) {
|
|
1981
|
+
return this._onToggle = e, this._onSelect = t, this.element = u("div", {
|
|
1982
|
+
className: "mobile-active-filters",
|
|
1983
|
+
"data-testid": "mobile-active-filters"
|
|
1984
|
+
}), this._scrollContainer = u("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
|
|
1985
|
+
}
|
|
1986
|
+
_subscribeToState() {
|
|
1987
|
+
const e = this.state.on("change:activeFilters", () => {
|
|
1988
|
+
this._renderChips();
|
|
1989
|
+
});
|
|
1990
|
+
this._unsubscribers.push(e);
|
|
1991
|
+
const t = this.state.on("change:selectedFilter", () => {
|
|
1992
|
+
this._updateSelectedState();
|
|
1993
|
+
});
|
|
1994
|
+
this._unsubscribers.push(t);
|
|
1995
|
+
}
|
|
1996
|
+
_renderChips() {
|
|
1997
|
+
this._scrollContainer.innerHTML = "", this._chips.clear();
|
|
1998
|
+
const e = this.state.get("activeFilters");
|
|
1999
|
+
if (!e || e.size === 0) {
|
|
2000
|
+
const t = u("div", {
|
|
2001
|
+
className: "active-filter-placeholder"
|
|
2002
|
+
}, "No active filters");
|
|
2003
|
+
this._scrollContainer.appendChild(t);
|
|
2004
|
+
return;
|
|
2005
|
+
}
|
|
2006
|
+
e.forEach((t) => {
|
|
2007
|
+
const i = this.filterManager.getFilterDef(t);
|
|
2008
|
+
if (!i) return;
|
|
2009
|
+
const r = this._createChip(t, i);
|
|
2010
|
+
this._chips.set(t, r), this._scrollContainer.appendChild(r);
|
|
2011
|
+
}), this._updateSelectedState();
|
|
2012
|
+
}
|
|
2013
|
+
_createChip(e, t) {
|
|
2014
|
+
const i = u("div", {
|
|
2015
|
+
className: "active-filter-chip",
|
|
2016
|
+
"data-filter-id": e,
|
|
2017
|
+
"data-testid": `active-chip-${e}`
|
|
2018
|
+
}), r = u("span", {
|
|
2019
|
+
className: "active-filter-chip-label",
|
|
2020
|
+
onClick: (o) => {
|
|
2021
|
+
var n;
|
|
2022
|
+
o.stopPropagation(), (n = this._onSelect) == null || n.call(this, e);
|
|
2023
|
+
}
|
|
2024
|
+
}, t.name), a = u("button", {
|
|
2025
|
+
className: "active-filter-chip-check",
|
|
2026
|
+
"aria-label": `Remove ${t.name} filter`,
|
|
2027
|
+
onClick: (o) => {
|
|
2028
|
+
var n;
|
|
2029
|
+
o.stopPropagation(), (n = this._onToggle) == null || n.call(this, e, !1);
|
|
2030
|
+
}
|
|
2031
|
+
});
|
|
2032
|
+
return a.innerHTML = '<svg width="10" height="10" viewBox="0 0 12 12"><path d="M2 6l3 3 5-5" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>', i.appendChild(r), i.appendChild(a), i;
|
|
2033
|
+
}
|
|
2034
|
+
_updateSelectedState() {
|
|
2035
|
+
const e = this.state.get("selectedFilter");
|
|
2036
|
+
this._chips.forEach((t, i) => {
|
|
2037
|
+
t.classList.toggle("selected", i === e);
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
destroy() {
|
|
2041
|
+
var e;
|
|
2042
|
+
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
const $e = [
|
|
2046
|
+
{ id: "free", name: "Free", icon: Oe },
|
|
2047
|
+
{ id: "square", name: "Square", icon: Ye },
|
|
2048
|
+
{ id: "circle", name: "Circle", icon: Be }
|
|
2049
|
+
], We = [
|
|
1774
2050
|
{ id: "free", name: "Free" },
|
|
1775
2051
|
{ id: "1:1", name: "1:1" },
|
|
1776
2052
|
{ id: "4:3", name: "4:3" },
|
|
@@ -1778,7 +2054,7 @@ const je = [
|
|
|
1778
2054
|
{ id: "3:2", name: "3:2" },
|
|
1779
2055
|
{ id: "2:3", name: "2:3" }
|
|
1780
2056
|
];
|
|
1781
|
-
class
|
|
2057
|
+
class Ze {
|
|
1782
2058
|
constructor(e, t) {
|
|
1783
2059
|
this.state = e, this.cropManager = t, this.element = null, this._shapeChips = /* @__PURE__ */ new Map(), this._aspectChips = /* @__PURE__ */ new Map(), this._unsubscribers = [];
|
|
1784
2060
|
}
|
|
@@ -1794,8 +2070,8 @@ class He {
|
|
|
1794
2070
|
const e = u("div", { className: "crop-section" });
|
|
1795
2071
|
e.appendChild(u("label", { className: "section-label" }, "Shape"));
|
|
1796
2072
|
const t = u("div", { className: "chip-row" }), i = this.state.get("crop.shape");
|
|
1797
|
-
|
|
1798
|
-
const d =
|
|
2073
|
+
$e.forEach((c) => {
|
|
2074
|
+
const d = W({
|
|
1799
2075
|
label: c.name,
|
|
1800
2076
|
icon: c.icon,
|
|
1801
2077
|
active: i === c.id,
|
|
@@ -1803,23 +2079,23 @@ class He {
|
|
|
1803
2079
|
});
|
|
1804
2080
|
d.dataset.shape = c.id, d.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, d), t.appendChild(d);
|
|
1805
2081
|
}), 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"));
|
|
1806
|
-
const
|
|
1807
|
-
|
|
1808
|
-
const d =
|
|
2082
|
+
const r = u("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
|
|
2083
|
+
We.forEach((c) => {
|
|
2084
|
+
const d = W({
|
|
1809
2085
|
label: c.name,
|
|
1810
2086
|
active: a === c.id,
|
|
1811
2087
|
onClick: () => this._selectAspect(c.id)
|
|
1812
2088
|
});
|
|
1813
|
-
d.dataset.ratio = c.id, d.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, d),
|
|
1814
|
-
}), this._aspectSection.appendChild(
|
|
1815
|
-
const o = u("div", { className: "crop-actions" }), n =
|
|
2089
|
+
d.dataset.ratio = c.id, d.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, d), r.appendChild(d);
|
|
2090
|
+
}), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
|
|
2091
|
+
const o = u("div", { className: "crop-actions" }), n = z({
|
|
1816
2092
|
label: "Cancel",
|
|
1817
2093
|
className: "btn-secondary crop-cancel-btn",
|
|
1818
|
-
icon:
|
|
2094
|
+
icon: G,
|
|
1819
2095
|
onClick: () => this.cropManager.cancel()
|
|
1820
2096
|
});
|
|
1821
2097
|
n.dataset.testid = "cancel-crop";
|
|
1822
|
-
const l =
|
|
2098
|
+
const l = z({
|
|
1823
2099
|
label: "Apply Crop",
|
|
1824
2100
|
className: "btn-primary crop-apply-btn",
|
|
1825
2101
|
icon: Z,
|
|
@@ -1832,14 +2108,14 @@ class He {
|
|
|
1832
2108
|
*/
|
|
1833
2109
|
_subscribeToState() {
|
|
1834
2110
|
const e = this.state.on("change:crop.shape", ({ value: i }) => {
|
|
1835
|
-
this._shapeChips.forEach((
|
|
1836
|
-
|
|
2111
|
+
this._shapeChips.forEach((r, a) => {
|
|
2112
|
+
r.setActive(a === i);
|
|
1837
2113
|
}), this._updateAspectVisibility();
|
|
1838
2114
|
});
|
|
1839
2115
|
this._unsubscribers.push(e);
|
|
1840
2116
|
const t = this.state.on("change:crop.aspect", ({ value: i }) => {
|
|
1841
|
-
this._aspectChips.forEach((
|
|
1842
|
-
|
|
2117
|
+
this._aspectChips.forEach((r, a) => {
|
|
2118
|
+
r.setActive(a === i);
|
|
1843
2119
|
});
|
|
1844
2120
|
});
|
|
1845
2121
|
this._unsubscribers.push(t);
|
|
@@ -1885,7 +2161,7 @@ class He {
|
|
|
1885
2161
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._shapeChips.clear(), this._aspectChips.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
1886
2162
|
}
|
|
1887
2163
|
}
|
|
1888
|
-
class
|
|
2164
|
+
class Ge {
|
|
1889
2165
|
constructor(e, t) {
|
|
1890
2166
|
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;
|
|
1891
2167
|
}
|
|
@@ -1894,14 +2170,14 @@ class $e {
|
|
|
1894
2170
|
* @param {Object} options - { onRemove, onReset, onClearAll, onUpdateValue, onSelect }
|
|
1895
2171
|
* @returns {HTMLElement}
|
|
1896
2172
|
*/
|
|
1897
|
-
render({ onRemove: e, onReset: t, onClearAll: i, onUpdateValue:
|
|
1898
|
-
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue =
|
|
2173
|
+
render({ onRemove: e, onReset: t, onClearAll: i, onUpdateValue: r, onSelect: a }) {
|
|
2174
|
+
this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = u("div", {
|
|
1899
2175
|
className: "active-filters-panel",
|
|
1900
2176
|
"data-testid": "active-filters-panel"
|
|
1901
2177
|
});
|
|
1902
2178
|
const o = u("div", { className: "panel-header" });
|
|
1903
2179
|
o.appendChild(u("h3", { className: "panel-title" }, "Active Filters"));
|
|
1904
|
-
const n =
|
|
2180
|
+
const n = z({
|
|
1905
2181
|
label: "Clear All",
|
|
1906
2182
|
className: "btn-text btn-danger",
|
|
1907
2183
|
onClick: () => this._handleClearAll()
|
|
@@ -1949,8 +2225,8 @@ class $e {
|
|
|
1949
2225
|
e.forEach((t) => {
|
|
1950
2226
|
const i = this.filterManager.getFilterDef(t);
|
|
1951
2227
|
if (!i) return;
|
|
1952
|
-
const
|
|
1953
|
-
this._filterItems.set(t,
|
|
2228
|
+
const r = this._createFilterItem(t, i);
|
|
2229
|
+
this._filterItems.set(t, r), this._listContainer.appendChild(r);
|
|
1954
2230
|
});
|
|
1955
2231
|
}
|
|
1956
2232
|
/**
|
|
@@ -1960,20 +2236,20 @@ class $e {
|
|
|
1960
2236
|
* @returns {HTMLElement}
|
|
1961
2237
|
*/
|
|
1962
2238
|
_createFilterItem(e, t) {
|
|
1963
|
-
const
|
|
1964
|
-
className: `active-filter-item ${
|
|
2239
|
+
const r = this.state.get("selectedFilter") === e, a = u("div", {
|
|
2240
|
+
className: `active-filter-item ${r ? "selected" : ""}`,
|
|
1965
2241
|
"data-active-filter": e,
|
|
1966
2242
|
"data-testid": `active-filter-${e}`,
|
|
1967
2243
|
onClick: (m) => {
|
|
1968
2244
|
m.target.closest(".filter-item-actions") || this._handleSelect(e);
|
|
1969
2245
|
}
|
|
1970
|
-
}), o = u("div", { className: "filter-item-header" }), n = u("span", { className: "filter-item-name" }, t.name), l = u("div", { className: "filter-item-actions" }), c =
|
|
1971
|
-
icon:
|
|
2246
|
+
}), o = u("div", { className: "filter-item-header" }), n = u("span", { className: "filter-item-name" }, t.name), l = u("div", { className: "filter-item-actions" }), c = x({
|
|
2247
|
+
icon: fe,
|
|
1972
2248
|
title: "Reset filter",
|
|
1973
2249
|
className: "btn-icon-sm",
|
|
1974
2250
|
onClick: () => this._handleReset(e)
|
|
1975
|
-
}), d =
|
|
1976
|
-
icon:
|
|
2251
|
+
}), d = x({
|
|
2252
|
+
icon: Ee,
|
|
1977
2253
|
title: "Remove filter",
|
|
1978
2254
|
className: "btn-icon-sm btn-danger",
|
|
1979
2255
|
onClick: () => this._handleRemove(e)
|
|
@@ -2009,11 +2285,11 @@ class $e {
|
|
|
2009
2285
|
if (!e.controls || !Array.isArray(e.controls))
|
|
2010
2286
|
return "Default values";
|
|
2011
2287
|
const i = [];
|
|
2012
|
-
return e.controls.forEach((
|
|
2013
|
-
const a = this._normalizeControlType(
|
|
2288
|
+
return e.controls.forEach((r) => {
|
|
2289
|
+
const a = this._normalizeControlType(r.type);
|
|
2014
2290
|
if (a === "button") return;
|
|
2015
|
-
const o =
|
|
2016
|
-
n !==
|
|
2291
|
+
const o = r.label || r.id, n = t[r.id] ?? r.default;
|
|
2292
|
+
n !== r.default && (a === "slider" ? i.push(`${o}: ${this._formatValue(n)}`) : a === "toggle" ? n && i.push(o) : a === "color" ? i.push(`${o}: ${n}`) : a === "select" && i.push(`${o}: ${n}`));
|
|
2017
2293
|
}), i.length > 0 ? i.join(", ") : "Default values";
|
|
2018
2294
|
}
|
|
2019
2295
|
/**
|
|
@@ -2031,8 +2307,8 @@ class $e {
|
|
|
2031
2307
|
this._filterItems.forEach((e, t) => {
|
|
2032
2308
|
const i = this.filterManager.getFilterDef(t);
|
|
2033
2309
|
if (!i || !e._summaryEl) return;
|
|
2034
|
-
const
|
|
2035
|
-
e._summaryEl.textContent = this._getValuesSummary(i,
|
|
2310
|
+
const r = this.state.getFilterValues(t);
|
|
2311
|
+
e._summaryEl.textContent = this._getValuesSummary(i, r);
|
|
2036
2312
|
});
|
|
2037
2313
|
}
|
|
2038
2314
|
/**
|
|
@@ -2086,7 +2362,7 @@ class $e {
|
|
|
2086
2362
|
this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterItems.clear(), (e = this.element) == null || e.remove(), this.element = null;
|
|
2087
2363
|
}
|
|
2088
2364
|
}
|
|
2089
|
-
const
|
|
2365
|
+
const B = {
|
|
2090
2366
|
name: "free",
|
|
2091
2367
|
initialMode: "filters",
|
|
2092
2368
|
cropShape: "free",
|
|
@@ -2098,12 +2374,12 @@ const E = {
|
|
|
2098
2374
|
showCropControls: !0,
|
|
2099
2375
|
maxExportWidth: void 0,
|
|
2100
2376
|
maxExportHeight: void 0
|
|
2101
|
-
},
|
|
2377
|
+
}, q = {
|
|
2102
2378
|
free: {
|
|
2103
|
-
...
|
|
2379
|
+
...B
|
|
2104
2380
|
},
|
|
2105
2381
|
avatar: {
|
|
2106
|
-
...
|
|
2382
|
+
...B,
|
|
2107
2383
|
name: "avatar",
|
|
2108
2384
|
initialMode: "crop",
|
|
2109
2385
|
cropShape: "circle",
|
|
@@ -2113,7 +2389,7 @@ const E = {
|
|
|
2113
2389
|
lockAspectRatio: !0
|
|
2114
2390
|
},
|
|
2115
2391
|
banner: {
|
|
2116
|
-
...
|
|
2392
|
+
...B,
|
|
2117
2393
|
name: "banner",
|
|
2118
2394
|
initialMode: "crop",
|
|
2119
2395
|
cropShape: "square",
|
|
@@ -2123,7 +2399,7 @@ const E = {
|
|
|
2123
2399
|
lockAspectRatio: !0
|
|
2124
2400
|
},
|
|
2125
2401
|
product: {
|
|
2126
|
-
...
|
|
2402
|
+
...B,
|
|
2127
2403
|
name: "product",
|
|
2128
2404
|
initialMode: "filters",
|
|
2129
2405
|
cropShape: "square",
|
|
@@ -2133,15 +2409,15 @@ const E = {
|
|
|
2133
2409
|
lockAspectRatio: !1
|
|
2134
2410
|
}
|
|
2135
2411
|
};
|
|
2136
|
-
function
|
|
2137
|
-
if (!
|
|
2138
|
-
return { ...
|
|
2139
|
-
if (typeof
|
|
2140
|
-
return { ...
|
|
2141
|
-
const e =
|
|
2142
|
-
return e ? { ...e } : { ...
|
|
2412
|
+
function Ke(s) {
|
|
2413
|
+
if (!s)
|
|
2414
|
+
return { ...q.free };
|
|
2415
|
+
if (typeof s == "object" && s !== null)
|
|
2416
|
+
return { ...B, ...s };
|
|
2417
|
+
const e = q[s];
|
|
2418
|
+
return e ? { ...e } : { ...q.free };
|
|
2143
2419
|
}
|
|
2144
|
-
class
|
|
2420
|
+
class Kt extends O {
|
|
2145
2421
|
/**
|
|
2146
2422
|
* Create a new VanillaImageEditor
|
|
2147
2423
|
* @param {HTMLElement} container - Container element to mount the editor
|
|
@@ -2152,7 +2428,7 @@ class Zt extends B {
|
|
|
2152
2428
|
if (super(), !e)
|
|
2153
2429
|
throw new Error("VanillaImageEditor: container element is required");
|
|
2154
2430
|
this._container = e;
|
|
2155
|
-
const i = t.preset ?
|
|
2431
|
+
const i = t.preset ? Ke(t.preset) : null, r = i ? {
|
|
2156
2432
|
initialMode: i.initialMode === "crop" ? "crop" : "adjust",
|
|
2157
2433
|
cropShape: i.cropShape,
|
|
2158
2434
|
initialAspectRatio: i.aspectRatio
|
|
@@ -2168,12 +2444,12 @@ class Zt extends B {
|
|
|
2168
2444
|
endpoint: "/api/v1/media/remove-bg",
|
|
2169
2445
|
fallbackEndpoint: null
|
|
2170
2446
|
},
|
|
2171
|
-
...
|
|
2447
|
+
...r,
|
|
2172
2448
|
...t
|
|
2173
|
-
}, this._preset = i, this._state =
|
|
2449
|
+
}, this._preset = i, this._state = xe(), 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 Ce(), this._filterManager = new Se(this._state, this._renderer), this._cropManager = new $(this._state, this._renderer), this._removeBgManager = null, ((a = this._options.backgroundRemoval) == null ? void 0 : a.enabled) !== !1 && (this._removeBgManager = new ve({
|
|
2174
2450
|
endpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.endpoint,
|
|
2175
2451
|
fallbackEndpoint: (n = this._options.backgroundRemoval) == null ? void 0 : n.fallbackEndpoint
|
|
2176
|
-
})), this._loadingOverlay = null, this._toolbar = null, this._categoryCarousel = null, this._filterCarousel = null, this._filterAdjustments = 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();
|
|
2452
|
+
})), 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();
|
|
2177
2453
|
}
|
|
2178
2454
|
/**
|
|
2179
2455
|
* Initialize the editor
|
|
@@ -2182,7 +2458,7 @@ class Zt extends B {
|
|
|
2182
2458
|
this._state.detectTheme(), this._buildDOM(), await this._renderer.mount(
|
|
2183
2459
|
this._canvasContainer,
|
|
2184
2460
|
this._state.get("isDarkMode") ? 657930 : 16777215
|
|
2185
|
-
), this._cropManager.setOverlayCanvas(this._cropOverlay), this._initUI(), this._setupResizeObserver(), this._subscribeToState(), this._options.initialImage && await this.loadImage(this._options.initialImage), this.emit("ready");
|
|
2461
|
+
), this._cropManager.setOverlayCanvas(this._cropOverlay), this._initUI(), this._setupResizeObserver(), this._setupWindowResize(), this._subscribeToState(), this._options.initialImage && await this.loadImage(this._options.initialImage), this.emit("ready");
|
|
2186
2462
|
}
|
|
2187
2463
|
/**
|
|
2188
2464
|
* Build DOM structure
|
|
@@ -2199,31 +2475,45 @@ class Zt extends B {
|
|
|
2199
2475
|
accept: "image/*",
|
|
2200
2476
|
className: "hidden-file-input",
|
|
2201
2477
|
"aria-label": "Choose image file to edit",
|
|
2202
|
-
onChange: (
|
|
2478
|
+
onChange: (r) => this._handleFileSelect(r)
|
|
2203
2479
|
}), this._editorEl.appendChild(this._fileInput), this._container.appendChild(this._editorEl);
|
|
2204
2480
|
}
|
|
2205
2481
|
/**
|
|
2206
2482
|
* Initialize UI components
|
|
2207
2483
|
*/
|
|
2208
2484
|
_initUI() {
|
|
2209
|
-
this._toolbar = new
|
|
2485
|
+
this._toolbar = new De(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = u("div", { className: "filter-controls-container" }), this._categoryCarousel = new Ue(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
|
|
2210
2486
|
}));
|
|
2211
2487
|
const e = u("div", { className: "filter-layout" }), t = u("div", { className: "filter-left-column" });
|
|
2212
|
-
this._filterCarousel = new
|
|
2213
|
-
onToggle: (
|
|
2214
|
-
onSelect: (
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2488
|
+
this._filterCarousel = new Ve(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
|
|
2489
|
+
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2490
|
+
onSelect: (r) => {
|
|
2491
|
+
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2492
|
+
}
|
|
2493
|
+
})), this._filterAdjustments = new je(this._state, this._filterManager), t.appendChild(this._filterAdjustments.render({
|
|
2494
|
+
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2495
|
+
onReset: (r) => this._handleFilterReset(r),
|
|
2496
|
+
onAction: (r, a) => this._handleFilterAction(r, a)
|
|
2219
2497
|
})), e.appendChild(t);
|
|
2220
2498
|
const i = u("div", { className: "filter-right-column" });
|
|
2221
|
-
this._activeFiltersPanel = new
|
|
2222
|
-
onRemove: (
|
|
2223
|
-
onReset: (
|
|
2499
|
+
this._activeFiltersPanel = new Ge(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
|
|
2500
|
+
onRemove: (r) => this._handleFilterToggle(r, !1),
|
|
2501
|
+
onReset: (r) => this._handleFilterReset(r),
|
|
2224
2502
|
onClearAll: () => this.resetAll(),
|
|
2225
|
-
onSelect: (
|
|
2226
|
-
})), e.appendChild(i), this._filterControlsEl.appendChild(e), this.
|
|
2503
|
+
onSelect: (r) => this._handleFilterSelect(r)
|
|
2504
|
+
})), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new He(this._state, this._filterManager), this._filterControlsEl.appendChild(this._mobileActiveFilters.render({
|
|
2505
|
+
onToggle: (r, a) => this._handleFilterToggle(r, a),
|
|
2506
|
+
onSelect: (r) => {
|
|
2507
|
+
this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
|
|
2508
|
+
}
|
|
2509
|
+
})), this._cropControls = new Ze(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 qe(this._state, this._filterManager), this._mobileFilterDrawer.build(this._controlsSection, {
|
|
2510
|
+
onChange: (r, a, o) => this._handleFilterChange(r, a, o),
|
|
2511
|
+
onReset: (r) => this._handleFilterReset(r),
|
|
2512
|
+
onRemove: (r) => {
|
|
2513
|
+
this._handleFilterToggle(r, !1), this._state.set("selectedFilter", null);
|
|
2514
|
+
},
|
|
2515
|
+
onAction: (r, a) => this._handleFilterAction(r, a)
|
|
2516
|
+
});
|
|
2227
2517
|
}
|
|
2228
2518
|
/**
|
|
2229
2519
|
* Set up resize observer with debounce to prevent infinite loops.
|
|
@@ -2240,12 +2530,21 @@ class Zt extends B {
|
|
|
2240
2530
|
}, 50);
|
|
2241
2531
|
}), this._resizeObserver.observe(this._canvasContainer);
|
|
2242
2532
|
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Set up window resize listener for mobile detection
|
|
2535
|
+
*/
|
|
2536
|
+
_setupWindowResize() {
|
|
2537
|
+
this._handleWindowResize = () => {
|
|
2538
|
+
var e;
|
|
2539
|
+
this._isMobile = window.innerWidth <= 768, !this._isMobile && ((e = this._mobileFilterDrawer) != null && e.isOpen) && this._mobileFilterDrawer.close();
|
|
2540
|
+
}, window.addEventListener("resize", this._handleWindowResize);
|
|
2541
|
+
}
|
|
2243
2542
|
/**
|
|
2244
2543
|
* Subscribe to state changes
|
|
2245
2544
|
*/
|
|
2246
2545
|
_subscribeToState() {
|
|
2247
2546
|
this._state.on("change:mode", ({ value: e }) => {
|
|
2248
|
-
this._updateModeUI(e);
|
|
2547
|
+
this._updateModeUI(e), e === "filters" && this._filterManager.applyFilters();
|
|
2249
2548
|
}), this._state.on("change:isDarkMode", ({ value: e }) => {
|
|
2250
2549
|
this._editorEl.classList.toggle("dark", e), this._editorEl.classList.toggle("light", !e), this._renderer.setBackgroundColor(e ? 657930 : 16777215);
|
|
2251
2550
|
}), this._state.on("change:hasImage", ({ value: e }) => {
|
|
@@ -2259,7 +2558,8 @@ class Zt extends B {
|
|
|
2259
2558
|
* @param {string} mode
|
|
2260
2559
|
*/
|
|
2261
2560
|
_updateModeUI(e) {
|
|
2262
|
-
|
|
2561
|
+
var t;
|
|
2562
|
+
e === "crop" ? (this._filterControlsEl.style.display = "none", this._cropControlsEl.style.display = "", (t = this._mobileFilterDrawer) != null && t.isOpen && this._mobileFilterDrawer.close()) : (this._filterControlsEl.style.display = "", this._cropControlsEl.style.display = "none");
|
|
2263
2563
|
}
|
|
2264
2564
|
/**
|
|
2265
2565
|
* Handle file selection
|
|
@@ -2333,8 +2633,8 @@ class Zt extends B {
|
|
|
2333
2633
|
*/
|
|
2334
2634
|
_fileToDataUrl(e) {
|
|
2335
2635
|
return new Promise((t, i) => {
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2636
|
+
const r = new FileReader();
|
|
2637
|
+
r.onload = () => t(r.result), r.onerror = i, r.readAsDataURL(e);
|
|
2338
2638
|
});
|
|
2339
2639
|
}
|
|
2340
2640
|
/**
|
|
@@ -2363,11 +2663,11 @@ class Zt extends B {
|
|
|
2363
2663
|
try {
|
|
2364
2664
|
const i = this.exportImage("png", 0.92);
|
|
2365
2665
|
if (!i) throw new Error("Failed to export image");
|
|
2366
|
-
const
|
|
2666
|
+
const r = {
|
|
2367
2667
|
width: Math.round(((e = this._renderer.sprite) == null ? void 0 : e.width) || 0),
|
|
2368
2668
|
height: Math.round(((t = this._renderer.sprite) == null ? void 0 : t.height) || 0)
|
|
2369
2669
|
}, a = document.createElement("a");
|
|
2370
|
-
a.href = i, a.download = `edited-image-${Date.now()}.png`, document.body.appendChild(a), a.click(), document.body.removeChild(a), this.emit("save", { imageData: i, dimensions:
|
|
2670
|
+
a.href = i, a.download = `edited-image-${Date.now()}.png`, document.body.appendChild(a), a.click(), document.body.removeChild(a), this.emit("save", { imageData: i, dimensions: r });
|
|
2371
2671
|
} catch (i) {
|
|
2372
2672
|
this.emit("error", { error: i });
|
|
2373
2673
|
} finally {
|
|
@@ -2481,8 +2781,8 @@ class Zt extends B {
|
|
|
2481
2781
|
u("div", { className: "editor-loading-text" }, e)
|
|
2482
2782
|
]);
|
|
2483
2783
|
else {
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2784
|
+
const r = this._loadingOverlay.querySelector(".editor-loading-text");
|
|
2785
|
+
r && (r.textContent = e);
|
|
2486
2786
|
}
|
|
2487
2787
|
const t = (i = this._canvasContainer) == null ? void 0 : i.parentElement;
|
|
2488
2788
|
t && !this._loadingOverlay.parentElement && t.appendChild(this._loadingOverlay);
|
|
@@ -2498,31 +2798,31 @@ class Zt extends B {
|
|
|
2498
2798
|
* Destroy the editor and clean up
|
|
2499
2799
|
*/
|
|
2500
2800
|
destroy() {
|
|
2501
|
-
var e, t, i,
|
|
2502
|
-
(e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (
|
|
2801
|
+
var e, t, i, r, a, o, n, l, c, d;
|
|
2802
|
+
(e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (d = this._editorEl) == null || d.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
|
|
2503
2803
|
}
|
|
2504
2804
|
}
|
|
2505
|
-
const
|
|
2506
|
-
function
|
|
2507
|
-
return !Array.isArray(
|
|
2805
|
+
const P = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
2806
|
+
function Qe(s, e) {
|
|
2807
|
+
return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
|
|
2508
2808
|
}
|
|
2509
|
-
function f(
|
|
2809
|
+
function f(s) {
|
|
2510
2810
|
var e;
|
|
2511
|
-
return
|
|
2811
|
+
return P.has(s.id), P.set(s.id, s), I.has(s.category) || I.set(s.category, []), (e = I.get(s.category)) == null || e.push(s.id), s;
|
|
2512
2812
|
}
|
|
2513
|
-
function
|
|
2514
|
-
return
|
|
2813
|
+
function Je(s) {
|
|
2814
|
+
return P.get(s);
|
|
2515
2815
|
}
|
|
2516
2816
|
function U() {
|
|
2517
|
-
return Array.from(
|
|
2817
|
+
return Array.from(P.values());
|
|
2518
2818
|
}
|
|
2519
|
-
function
|
|
2819
|
+
function et() {
|
|
2520
2820
|
U().map((t) => t.id), Object.entries(g).filter(
|
|
2521
2821
|
(t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
|
|
2522
2822
|
).forEach(([t, i]) => {
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2525
|
-
id:
|
|
2823
|
+
const r = t.replace(/Filter$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2824
|
+
P.has(r) || f({
|
|
2825
|
+
id: r,
|
|
2526
2826
|
name: t.replace(/Filter$/, ""),
|
|
2527
2827
|
category: "unlisted",
|
|
2528
2828
|
// Put in a category that won't be shown in UI
|
|
@@ -2540,51 +2840,51 @@ function Ke() {
|
|
|
2540
2840
|
});
|
|
2541
2841
|
});
|
|
2542
2842
|
}
|
|
2543
|
-
function
|
|
2544
|
-
return (
|
|
2843
|
+
function tt(s) {
|
|
2844
|
+
return (I.get(s) || []).map((t) => P.get(t)).filter(Boolean);
|
|
2545
2845
|
}
|
|
2546
|
-
function
|
|
2547
|
-
return Array.from(
|
|
2846
|
+
function it() {
|
|
2847
|
+
return Array.from(I.keys());
|
|
2548
2848
|
}
|
|
2549
|
-
function
|
|
2550
|
-
return
|
|
2849
|
+
function Qt(s) {
|
|
2850
|
+
return P.has(s);
|
|
2551
2851
|
}
|
|
2552
|
-
function
|
|
2553
|
-
const e =
|
|
2852
|
+
function rt(s) {
|
|
2853
|
+
const e = P.get(s);
|
|
2554
2854
|
if (!e)
|
|
2555
2855
|
return !1;
|
|
2556
|
-
|
|
2557
|
-
const t =
|
|
2856
|
+
P.delete(s);
|
|
2857
|
+
const t = I.get(e.category);
|
|
2558
2858
|
if (t) {
|
|
2559
|
-
const i = t.indexOf(
|
|
2560
|
-
i !== -1 && t.splice(i, 1), t.length === 0 &&
|
|
2859
|
+
const i = t.indexOf(s);
|
|
2860
|
+
i !== -1 && t.splice(i, 1), t.length === 0 && I.delete(e.category);
|
|
2561
2861
|
}
|
|
2562
2862
|
return !0;
|
|
2563
2863
|
}
|
|
2564
|
-
function
|
|
2565
|
-
const t =
|
|
2566
|
-
return t ?
|
|
2864
|
+
function Jt(s, e) {
|
|
2865
|
+
const t = P.get(s);
|
|
2866
|
+
return t ? Qe(t, e) : !1;
|
|
2567
2867
|
}
|
|
2568
|
-
function
|
|
2569
|
-
return Array.from(
|
|
2570
|
-
id:
|
|
2571
|
-
name:
|
|
2572
|
-
category:
|
|
2573
|
-
controls:
|
|
2868
|
+
function st() {
|
|
2869
|
+
return Array.from(P.values()).map((s) => ({
|
|
2870
|
+
id: s.id,
|
|
2871
|
+
name: s.name,
|
|
2872
|
+
category: s.category,
|
|
2873
|
+
controls: s.controls
|
|
2574
2874
|
}));
|
|
2575
2875
|
}
|
|
2576
2876
|
if (typeof window < "u") {
|
|
2577
|
-
window.__DEBUG_FILTERS_LIST = Array.from(
|
|
2578
|
-
const
|
|
2877
|
+
window.__DEBUG_FILTERS_LIST = Array.from(P.keys()), window.getAllFilters = U, window.getFilter = Je, window.getFiltersByCategory = tt, window.getRegisteredFilters = st;
|
|
2878
|
+
const s = f;
|
|
2579
2879
|
window.registerFilter = (e) => {
|
|
2580
|
-
const t =
|
|
2581
|
-
return window.__DEBUG_FILTERS_LIST = Array.from(
|
|
2880
|
+
const t = s(e);
|
|
2881
|
+
return window.__DEBUG_FILTERS_LIST = Array.from(P.keys()), t;
|
|
2582
2882
|
};
|
|
2583
2883
|
}
|
|
2584
2884
|
typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
|
|
2585
2885
|
return [];
|
|
2586
2886
|
});
|
|
2587
|
-
const { AdjustmentFilter:
|
|
2887
|
+
const { AdjustmentFilter: at } = g, { ColorMatrixFilter: ot } = w, M = {
|
|
2588
2888
|
gamma: 1,
|
|
2589
2889
|
saturation: 1,
|
|
2590
2890
|
contrast: 1,
|
|
@@ -2593,7 +2893,7 @@ const { AdjustmentFilter: it } = g, { ColorMatrixFilter: rt } = C, k = {
|
|
|
2593
2893
|
green: 1,
|
|
2594
2894
|
blue: 1,
|
|
2595
2895
|
alpha: 1
|
|
2596
|
-
},
|
|
2896
|
+
}, nt = /* @__PURE__ */ new Set([
|
|
2597
2897
|
"gamma",
|
|
2598
2898
|
"saturation",
|
|
2599
2899
|
"contrast",
|
|
@@ -2603,33 +2903,33 @@ const { AdjustmentFilter: it } = g, { ColorMatrixFilter: rt } = C, k = {
|
|
|
2603
2903
|
"blue",
|
|
2604
2904
|
"alpha"
|
|
2605
2905
|
]);
|
|
2606
|
-
function
|
|
2607
|
-
if (typeof
|
|
2608
|
-
return
|
|
2609
|
-
if (typeof
|
|
2610
|
-
const t = Number(
|
|
2906
|
+
function F(s, e) {
|
|
2907
|
+
if (typeof s == "number" && Number.isFinite(s))
|
|
2908
|
+
return s;
|
|
2909
|
+
if (typeof s == "string") {
|
|
2910
|
+
const t = Number(s);
|
|
2611
2911
|
if (Number.isFinite(t))
|
|
2612
2912
|
return t;
|
|
2613
2913
|
}
|
|
2614
2914
|
return e;
|
|
2615
2915
|
}
|
|
2616
|
-
function
|
|
2617
|
-
return
|
|
2916
|
+
function te(s) {
|
|
2917
|
+
return nt.has(s);
|
|
2618
2918
|
}
|
|
2619
|
-
function
|
|
2919
|
+
function lt(s) {
|
|
2620
2920
|
return {
|
|
2621
|
-
gamma:
|
|
2622
|
-
saturation:
|
|
2623
|
-
contrast:
|
|
2624
|
-
brightness:
|
|
2625
|
-
red:
|
|
2626
|
-
green:
|
|
2627
|
-
blue:
|
|
2628
|
-
alpha:
|
|
2921
|
+
gamma: F(s.gamma, M.gamma),
|
|
2922
|
+
saturation: F(s.saturation, M.saturation),
|
|
2923
|
+
contrast: F(s.contrast, M.contrast),
|
|
2924
|
+
brightness: F(s.brightness, M.brightness),
|
|
2925
|
+
red: F(s.red, M.red),
|
|
2926
|
+
green: F(s.green, M.green),
|
|
2927
|
+
blue: F(s.blue, M.blue),
|
|
2928
|
+
alpha: F(s.alpha, M.alpha)
|
|
2629
2929
|
};
|
|
2630
2930
|
}
|
|
2631
|
-
function
|
|
2632
|
-
|
|
2931
|
+
function ie(s, e) {
|
|
2932
|
+
s.reset(), s.brightness(e.brightness, !0), s.contrast(e.contrast, !0), s.saturate(e.saturation, !0);
|
|
2633
2933
|
}
|
|
2634
2934
|
f({
|
|
2635
2935
|
id: "adjustment",
|
|
@@ -2637,16 +2937,16 @@ f({
|
|
|
2637
2937
|
category: "adjust",
|
|
2638
2938
|
description: "Adjust basic image properties like brightness, contrast, and saturation",
|
|
2639
2939
|
// Create an instance of the AdjustmentFilter with the provided parameters
|
|
2640
|
-
createFilter: (
|
|
2940
|
+
createFilter: (s) => {
|
|
2641
2941
|
try {
|
|
2642
|
-
const e =
|
|
2942
|
+
const e = lt(s ?? {}), t = { ...e };
|
|
2643
2943
|
try {
|
|
2644
|
-
const i = new
|
|
2645
|
-
return
|
|
2944
|
+
const i = new at(t), r = i;
|
|
2945
|
+
return r._customParams = { ...e }, r.updateUIParam = function(o, n) {
|
|
2646
2946
|
try {
|
|
2647
|
-
if (!
|
|
2947
|
+
if (!te(o))
|
|
2648
2948
|
return;
|
|
2649
|
-
const l = this._customParams ?? { ...
|
|
2949
|
+
const l = this._customParams ?? { ...M }, c = F(n, l[o]);
|
|
2650
2950
|
l[o] = c, this._customParams = l;
|
|
2651
2951
|
const d = this;
|
|
2652
2952
|
o in d && (d[o] = c);
|
|
@@ -2654,16 +2954,16 @@ f({
|
|
|
2654
2954
|
}
|
|
2655
2955
|
}, i;
|
|
2656
2956
|
} catch {
|
|
2657
|
-
const
|
|
2658
|
-
return a._customParams = { ...e },
|
|
2957
|
+
const r = new ot(), a = r;
|
|
2958
|
+
return a._customParams = { ...e }, ie(r, e), a.updateUIParam = function(n, l) {
|
|
2659
2959
|
try {
|
|
2660
|
-
if (!
|
|
2960
|
+
if (!te(n))
|
|
2661
2961
|
return;
|
|
2662
|
-
const c = this._customParams ?? { ...
|
|
2663
|
-
c[n] = d, this._customParams = c,
|
|
2962
|
+
const c = this._customParams ?? { ...M }, d = F(l, c[n]);
|
|
2963
|
+
c[n] = d, this._customParams = c, ie(this, c);
|
|
2664
2964
|
} catch {
|
|
2665
2965
|
}
|
|
2666
|
-
},
|
|
2966
|
+
}, r;
|
|
2667
2967
|
}
|
|
2668
2968
|
} catch {
|
|
2669
2969
|
return null;
|
|
@@ -2764,14 +3064,14 @@ f({
|
|
|
2764
3064
|
}
|
|
2765
3065
|
]
|
|
2766
3066
|
});
|
|
2767
|
-
const { ColorMatrixFilter:
|
|
3067
|
+
const { ColorMatrixFilter: ct } = w, R = {
|
|
2768
3068
|
brightness: 1,
|
|
2769
3069
|
contrast: 1,
|
|
2770
3070
|
saturation: 1,
|
|
2771
3071
|
hue: 0,
|
|
2772
3072
|
sepia: 0,
|
|
2773
3073
|
negative: !1
|
|
2774
|
-
},
|
|
3074
|
+
}, ht = /* @__PURE__ */ new Set([
|
|
2775
3075
|
"brightness",
|
|
2776
3076
|
"contrast",
|
|
2777
3077
|
"saturation",
|
|
@@ -2779,42 +3079,42 @@ const { ColorMatrixFilter: ot } = C, z = {
|
|
|
2779
3079
|
"sepia",
|
|
2780
3080
|
"negative"
|
|
2781
3081
|
]);
|
|
2782
|
-
function
|
|
2783
|
-
return
|
|
3082
|
+
function dt(s) {
|
|
3083
|
+
return ht.has(s);
|
|
2784
3084
|
}
|
|
2785
|
-
function X(
|
|
2786
|
-
if (typeof
|
|
2787
|
-
return
|
|
2788
|
-
if (typeof
|
|
2789
|
-
const t = Number(
|
|
3085
|
+
function X(s, e) {
|
|
3086
|
+
if (typeof s == "number" && Number.isFinite(s))
|
|
3087
|
+
return s;
|
|
3088
|
+
if (typeof s == "string") {
|
|
3089
|
+
const t = Number(s);
|
|
2790
3090
|
if (Number.isFinite(t))
|
|
2791
3091
|
return t;
|
|
2792
3092
|
}
|
|
2793
3093
|
return e;
|
|
2794
3094
|
}
|
|
2795
|
-
function
|
|
2796
|
-
if (typeof
|
|
2797
|
-
return
|
|
2798
|
-
if (typeof
|
|
2799
|
-
if (
|
|
3095
|
+
function me(s, e) {
|
|
3096
|
+
if (typeof s == "boolean")
|
|
3097
|
+
return s;
|
|
3098
|
+
if (typeof s == "string") {
|
|
3099
|
+
if (s === "true")
|
|
2800
3100
|
return !0;
|
|
2801
|
-
if (
|
|
3101
|
+
if (s === "false")
|
|
2802
3102
|
return !1;
|
|
2803
3103
|
}
|
|
2804
3104
|
return e;
|
|
2805
3105
|
}
|
|
2806
|
-
function
|
|
3106
|
+
function ut(s) {
|
|
2807
3107
|
return {
|
|
2808
|
-
brightness: X(
|
|
2809
|
-
contrast: X(
|
|
2810
|
-
saturation: X(
|
|
2811
|
-
hue: X(
|
|
2812
|
-
sepia: X(
|
|
2813
|
-
negative:
|
|
3108
|
+
brightness: X(s.brightness, R.brightness),
|
|
3109
|
+
contrast: X(s.contrast, R.contrast),
|
|
3110
|
+
saturation: X(s.saturation, R.saturation),
|
|
3111
|
+
hue: X(s.hue, R.hue),
|
|
3112
|
+
sepia: X(s.sepia, R.sepia),
|
|
3113
|
+
negative: me(s.negative, R.negative)
|
|
2814
3114
|
};
|
|
2815
3115
|
}
|
|
2816
|
-
function
|
|
2817
|
-
|
|
3116
|
+
function re(s, e) {
|
|
3117
|
+
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);
|
|
2818
3118
|
}
|
|
2819
3119
|
f({
|
|
2820
3120
|
id: "adjustment-advanced",
|
|
@@ -2822,21 +3122,21 @@ f({
|
|
|
2822
3122
|
category: "adjust",
|
|
2823
3123
|
description: "Comprehensive image adjustments including brightness, contrast, saturation, hue, and more",
|
|
2824
3124
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
2825
|
-
createFilter: (
|
|
3125
|
+
createFilter: (s) => {
|
|
2826
3126
|
try {
|
|
2827
|
-
const e =
|
|
2828
|
-
return i._customParams = { ...e },
|
|
3127
|
+
const e = ut(s ?? {}), t = new ct(), i = t;
|
|
3128
|
+
return i._customParams = { ...e }, re(t, e), i.updateUIParam = function(a, o) {
|
|
2829
3129
|
try {
|
|
2830
|
-
if (!
|
|
3130
|
+
if (!dt(a))
|
|
2831
3131
|
return;
|
|
2832
|
-
const n = this._customParams ?? { ...
|
|
3132
|
+
const n = this._customParams ?? { ...R };
|
|
2833
3133
|
if (a === "negative")
|
|
2834
|
-
n.negative =
|
|
3134
|
+
n.negative = me(o, n.negative);
|
|
2835
3135
|
else {
|
|
2836
3136
|
const l = a;
|
|
2837
3137
|
n[l] = X(o, n[l]);
|
|
2838
3138
|
}
|
|
2839
|
-
this._customParams = n,
|
|
3139
|
+
this._customParams = n, re(this, n);
|
|
2840
3140
|
} catch {
|
|
2841
3141
|
}
|
|
2842
3142
|
}, t;
|
|
@@ -2920,19 +3220,19 @@ f({
|
|
|
2920
3220
|
category: "adjust",
|
|
2921
3221
|
description: "Adjust the transparency of the image",
|
|
2922
3222
|
// Create an instance of the ColorMatrixFilter with alpha adjustment
|
|
2923
|
-
createFilter: (
|
|
3223
|
+
createFilter: (s) => {
|
|
2924
3224
|
try {
|
|
2925
|
-
const e =
|
|
3225
|
+
const e = s.alpha !== void 0 ? s.alpha : 1, t = new w.ColorMatrixFilter();
|
|
2926
3226
|
return t.alpha = e, t._customParams = {
|
|
2927
3227
|
alpha: e
|
|
2928
|
-
}, t.updateUIParam = function(i,
|
|
3228
|
+
}, t.updateUIParam = function(i, r) {
|
|
2929
3229
|
try {
|
|
2930
3230
|
const a = this._customParams || {};
|
|
2931
3231
|
if (this._customParams = a, i === "alpha") {
|
|
2932
|
-
const o = Number(
|
|
3232
|
+
const o = Number(r);
|
|
2933
3233
|
this.alpha = o, a.alpha = o;
|
|
2934
3234
|
} else
|
|
2935
|
-
i in this && (this[i] =
|
|
3235
|
+
i in this && (this[i] = r);
|
|
2936
3236
|
} catch {
|
|
2937
3237
|
}
|
|
2938
3238
|
}, t;
|
|
@@ -2967,15 +3267,15 @@ f({
|
|
|
2967
3267
|
* Create an instance of the BlurFilter from pixi.js package
|
|
2968
3268
|
* This implementation matches the PixiJS example exactly, using 'blur' and 'quality' parameters
|
|
2969
3269
|
*/
|
|
2970
|
-
createFilter: (
|
|
3270
|
+
createFilter: (s) => {
|
|
2971
3271
|
try {
|
|
2972
|
-
const e = new
|
|
2973
|
-
strength:
|
|
2974
|
-
quality:
|
|
3272
|
+
const e = new w.BlurFilter({
|
|
3273
|
+
strength: s.blur || 8,
|
|
3274
|
+
quality: s.quality || 4
|
|
2975
3275
|
});
|
|
2976
|
-
return e._customParams = { ...
|
|
2977
|
-
const
|
|
2978
|
-
switch (this._customParams =
|
|
3276
|
+
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
3277
|
+
const r = this._customParams || {};
|
|
3278
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
2979
3279
|
case "blur":
|
|
2980
3280
|
this.strength = i;
|
|
2981
3281
|
break;
|
|
@@ -3027,13 +3327,13 @@ f({
|
|
|
3027
3327
|
category: "advanced",
|
|
3028
3328
|
description: "Advanced color adjustments including sepia, hue rotation, and more",
|
|
3029
3329
|
// Create an instance of the ColorMatrixFilter with the provided parameters
|
|
3030
|
-
createFilter: (
|
|
3031
|
-
const e =
|
|
3330
|
+
createFilter: (s) => {
|
|
3331
|
+
const e = w.ColorMatrixFilter;
|
|
3032
3332
|
if (!e)
|
|
3033
3333
|
return null;
|
|
3034
3334
|
const t = new e();
|
|
3035
3335
|
try {
|
|
3036
|
-
return typeof t.reset == "function" && t.reset(),
|
|
3336
|
+
return typeof t.reset == "function" && t.reset(), s.brightness !== 1 && typeof t.brightness == "function" && t.brightness(s.brightness, !1), s.contrast !== 1 && typeof t.contrast == "function" && t.contrast(s.contrast, !1), s.saturation !== 1 && typeof t.saturate == "function" && t.saturate(s.saturation, !1), s.hue !== 0 && typeof t.hue == "function" && t.hue(s.hue, !1), s.sepia > 0 && typeof t.sepia == "function" && t.sepia(s.sepia), s.negative && typeof t.negative == "function" && t.negative(!1), t;
|
|
3037
3337
|
} catch {
|
|
3038
3338
|
return t;
|
|
3039
3339
|
}
|
|
@@ -3108,7 +3408,7 @@ f({
|
|
|
3108
3408
|
}
|
|
3109
3409
|
]
|
|
3110
3410
|
});
|
|
3111
|
-
const { ColorOverlayFilter:
|
|
3411
|
+
const { ColorOverlayFilter: pt } = g;
|
|
3112
3412
|
f({
|
|
3113
3413
|
id: "colorOverlay",
|
|
3114
3414
|
name: "Color Overlay",
|
|
@@ -3119,26 +3419,26 @@ f({
|
|
|
3119
3419
|
* This implementation follows the pattern from ColorGradientFilter, adding
|
|
3120
3420
|
* proper parameter handling with an updateUIParam method
|
|
3121
3421
|
*/
|
|
3122
|
-
createFilter: (
|
|
3422
|
+
createFilter: (s) => {
|
|
3123
3423
|
try {
|
|
3124
3424
|
let e = 16711680;
|
|
3125
|
-
|
|
3126
|
-
const t = new
|
|
3425
|
+
s.color && (typeof s.color == "string" ? e = parseInt(s.color.replace("#", "0x"), 16) : typeof s.color == "number" && (e = s.color));
|
|
3426
|
+
const t = new pt({
|
|
3127
3427
|
color: e,
|
|
3128
|
-
alpha:
|
|
3428
|
+
alpha: s.alpha || 0.5
|
|
3129
3429
|
});
|
|
3130
|
-
return t._customParams = { ...
|
|
3430
|
+
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
3131
3431
|
const a = this._customParams || {};
|
|
3132
|
-
switch (this._customParams = a, a[i] =
|
|
3432
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
3133
3433
|
case "color":
|
|
3134
3434
|
let o;
|
|
3135
|
-
typeof
|
|
3435
|
+
typeof r == "string" ? o = parseInt(r.replace("#", "0x"), 16) : o = Number(r), this.color = o, this.uniforms && (this.uniforms.uColor = o);
|
|
3136
3436
|
break;
|
|
3137
3437
|
case "alpha":
|
|
3138
|
-
this.alpha = Number(
|
|
3438
|
+
this.alpha = Number(r), this.uniforms && (this.uniforms.uAlpha = Number(r));
|
|
3139
3439
|
break;
|
|
3140
3440
|
default:
|
|
3141
|
-
i in this && (this[i] =
|
|
3441
|
+
i in this && (this[i] = r);
|
|
3142
3442
|
break;
|
|
3143
3443
|
}
|
|
3144
3444
|
return !0;
|
|
@@ -3182,27 +3482,27 @@ f({
|
|
|
3182
3482
|
* Create an instance of the DropShadowFilter with the provided parameters
|
|
3183
3483
|
* Using the official pixi-filters implementation
|
|
3184
3484
|
*/
|
|
3185
|
-
createFilter: (
|
|
3485
|
+
createFilter: (s) => {
|
|
3186
3486
|
try {
|
|
3187
|
-
const e =
|
|
3487
|
+
const e = s.color ? s.color.replace("#", "0x") : "0x000000", t = s.distance !== void 0 ? s.distance : 5, i = s.angle !== void 0 ? s.angle : 90, r = {
|
|
3188
3488
|
x: t * Math.cos(i * Math.PI / 180),
|
|
3189
3489
|
y: t * Math.sin(i * Math.PI / 180)
|
|
3190
3490
|
}, a = new g.DropShadowFilter({
|
|
3191
|
-
offset:
|
|
3491
|
+
offset: r,
|
|
3192
3492
|
color: parseInt(e, 16),
|
|
3193
|
-
alpha:
|
|
3194
|
-
blur:
|
|
3195
|
-
quality:
|
|
3196
|
-
shadowOnly:
|
|
3493
|
+
alpha: s.alpha !== void 0 ? s.alpha : 0.5,
|
|
3494
|
+
blur: s.blur !== void 0 ? s.blur : 2,
|
|
3495
|
+
quality: s.quality !== void 0 ? s.quality : 3,
|
|
3496
|
+
shadowOnly: s.shadowOnly !== void 0 ? s.shadowOnly : !1,
|
|
3197
3497
|
pixelSize: {
|
|
3198
|
-
x:
|
|
3199
|
-
y:
|
|
3498
|
+
x: s.pixelSizeX !== void 0 ? s.pixelSizeX : 1,
|
|
3499
|
+
y: s.pixelSizeY !== void 0 ? s.pixelSizeY : 1
|
|
3200
3500
|
}
|
|
3201
3501
|
});
|
|
3202
3502
|
return a._customParams = {
|
|
3203
|
-
...
|
|
3503
|
+
...s,
|
|
3204
3504
|
// Also store the calculated offset for use in updateUIParam
|
|
3205
|
-
_offset:
|
|
3505
|
+
_offset: r,
|
|
3206
3506
|
_distance: t,
|
|
3207
3507
|
_angle: i
|
|
3208
3508
|
}, a.updateUIParam = function(o, n) {
|
|
@@ -3355,7 +3655,7 @@ f({
|
|
|
3355
3655
|
}
|
|
3356
3656
|
]
|
|
3357
3657
|
});
|
|
3358
|
-
const { ColorMatrixFilter:
|
|
3658
|
+
const { ColorMatrixFilter: ft } = w;
|
|
3359
3659
|
f({
|
|
3360
3660
|
id: "grayscale",
|
|
3361
3661
|
name: "Grayscale",
|
|
@@ -3366,19 +3666,19 @@ f({
|
|
|
3366
3666
|
* This implementation follows the pattern from ColorGradientFilter, adding
|
|
3367
3667
|
* proper parameter handling with an updateUIParam method
|
|
3368
3668
|
*/
|
|
3369
|
-
createFilter: (
|
|
3669
|
+
createFilter: (s) => {
|
|
3370
3670
|
try {
|
|
3371
|
-
const e = new
|
|
3372
|
-
e._customParams = { ...
|
|
3373
|
-
const t =
|
|
3374
|
-
return
|
|
3671
|
+
const e = new ft();
|
|
3672
|
+
e._customParams = { ...s };
|
|
3673
|
+
const t = s.intensity !== void 0 ? s.intensity : 1;
|
|
3674
|
+
return se(e, t), e.updateUIParam = function(i, r) {
|
|
3375
3675
|
const a = this._customParams || {};
|
|
3376
|
-
switch (this._customParams = a, a[i] =
|
|
3676
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
3377
3677
|
case "intensity":
|
|
3378
|
-
|
|
3678
|
+
se(this, r);
|
|
3379
3679
|
break;
|
|
3380
3680
|
default:
|
|
3381
|
-
i in this && (this[i] =
|
|
3681
|
+
i in this && (this[i] = r);
|
|
3382
3682
|
break;
|
|
3383
3683
|
}
|
|
3384
3684
|
return !0;
|
|
@@ -3405,10 +3705,10 @@ f({
|
|
|
3405
3705
|
}
|
|
3406
3706
|
]
|
|
3407
3707
|
});
|
|
3408
|
-
function
|
|
3409
|
-
|
|
3708
|
+
function se(s, e) {
|
|
3709
|
+
s.reset(), s.greyscale(e);
|
|
3410
3710
|
}
|
|
3411
|
-
const { HslAdjustmentFilter:
|
|
3711
|
+
const { HslAdjustmentFilter: mt } = g;
|
|
3412
3712
|
f({
|
|
3413
3713
|
id: "hsl-adjustment",
|
|
3414
3714
|
name: "HSL Adjustment",
|
|
@@ -3418,19 +3718,19 @@ f({
|
|
|
3418
3718
|
* Create an instance of the HslAdjustmentFilter with the provided parameters
|
|
3419
3719
|
* Using the official pixi-filters implementation instead of a custom one
|
|
3420
3720
|
*/
|
|
3421
|
-
createFilter: (
|
|
3721
|
+
createFilter: (s) => {
|
|
3422
3722
|
try {
|
|
3423
|
-
const e = new
|
|
3424
|
-
hue:
|
|
3425
|
-
saturation:
|
|
3426
|
-
lightness:
|
|
3427
|
-
colorize:
|
|
3428
|
-
alpha:
|
|
3723
|
+
const e = new mt({
|
|
3724
|
+
hue: s.hue !== void 0 ? s.hue : 0,
|
|
3725
|
+
saturation: s.saturation !== void 0 ? s.saturation : 0,
|
|
3726
|
+
lightness: s.lightness !== void 0 ? s.lightness : 0,
|
|
3727
|
+
colorize: s.colorize !== void 0 ? s.colorize : !1,
|
|
3728
|
+
alpha: s.alpha !== void 0 ? s.alpha : 1
|
|
3429
3729
|
});
|
|
3430
|
-
return e._customParams = { ...
|
|
3730
|
+
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
3431
3731
|
try {
|
|
3432
|
-
const
|
|
3433
|
-
switch (this._customParams =
|
|
3732
|
+
const r = this._customParams || {};
|
|
3733
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
3434
3734
|
case "hue":
|
|
3435
3735
|
this.hue = Number(i), this.uniforms && (this.uniforms.uHue = Number(i));
|
|
3436
3736
|
break;
|
|
@@ -3518,7 +3818,7 @@ f({
|
|
|
3518
3818
|
}
|
|
3519
3819
|
]
|
|
3520
3820
|
});
|
|
3521
|
-
const { KawaseBlurFilter:
|
|
3821
|
+
const { KawaseBlurFilter: gt } = g;
|
|
3522
3822
|
f({
|
|
3523
3823
|
id: "kawase-blur",
|
|
3524
3824
|
name: "Kawase Blur",
|
|
@@ -3529,17 +3829,17 @@ f({
|
|
|
3529
3829
|
* This implementation follows the pattern from ColorGradientFilter, adding
|
|
3530
3830
|
* proper parameter handling with an updateUIParam method
|
|
3531
3831
|
*/
|
|
3532
|
-
createFilter: (
|
|
3832
|
+
createFilter: (s) => {
|
|
3533
3833
|
try {
|
|
3534
|
-
const e = new
|
|
3535
|
-
strength:
|
|
3536
|
-
quality:
|
|
3537
|
-
clamp:
|
|
3538
|
-
pixelSize:
|
|
3834
|
+
const e = new gt({
|
|
3835
|
+
strength: s.strength || 4,
|
|
3836
|
+
quality: s.quality || 3,
|
|
3837
|
+
clamp: s.clamp || !1,
|
|
3838
|
+
pixelSize: s.pixelSize || 1
|
|
3539
3839
|
});
|
|
3540
|
-
return e._customParams = { ...
|
|
3541
|
-
const
|
|
3542
|
-
switch (this._customParams =
|
|
3840
|
+
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
3841
|
+
const r = this._customParams || {};
|
|
3842
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
3543
3843
|
case "strength":
|
|
3544
3844
|
this.strength = i;
|
|
3545
3845
|
break;
|
|
@@ -3636,7 +3936,7 @@ f({
|
|
|
3636
3936
|
}
|
|
3637
3937
|
]
|
|
3638
3938
|
});
|
|
3639
|
-
const { MotionBlurFilter:
|
|
3939
|
+
const { MotionBlurFilter: bt } = g;
|
|
3640
3940
|
f({
|
|
3641
3941
|
id: "motion-blur",
|
|
3642
3942
|
name: "Motion Blur",
|
|
@@ -3647,19 +3947,19 @@ f({
|
|
|
3647
3947
|
* This implementation follows the pattern from ColorGradientFilter, adding
|
|
3648
3948
|
* proper parameter handling with an updateUIParam method
|
|
3649
3949
|
*/
|
|
3650
|
-
createFilter: (
|
|
3950
|
+
createFilter: (s) => {
|
|
3651
3951
|
try {
|
|
3652
|
-
const e = new
|
|
3952
|
+
const e = new bt({
|
|
3653
3953
|
velocity: {
|
|
3654
|
-
x:
|
|
3655
|
-
y:
|
|
3954
|
+
x: s.velocityX !== void 0 ? s.velocityX : 0,
|
|
3955
|
+
y: s.velocityY !== void 0 ? s.velocityY : 0
|
|
3656
3956
|
},
|
|
3657
|
-
kernelSize:
|
|
3658
|
-
offset:
|
|
3957
|
+
kernelSize: s.kernelSize || 5,
|
|
3958
|
+
offset: s.offset !== void 0 ? s.offset : 0
|
|
3659
3959
|
});
|
|
3660
|
-
return e._customParams = { ...
|
|
3661
|
-
const
|
|
3662
|
-
switch (this._customParams =
|
|
3960
|
+
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
3961
|
+
const r = this._customParams || {};
|
|
3962
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
3663
3963
|
case "velocityX":
|
|
3664
3964
|
this.velocityX = i;
|
|
3665
3965
|
break;
|
|
@@ -3744,24 +4044,24 @@ f({
|
|
|
3744
4044
|
}
|
|
3745
4045
|
]
|
|
3746
4046
|
});
|
|
3747
|
-
const { RadialBlurFilter:
|
|
4047
|
+
const { RadialBlurFilter: yt } = g;
|
|
3748
4048
|
f({
|
|
3749
4049
|
id: "radial-blur",
|
|
3750
4050
|
name: "Radial Blur",
|
|
3751
4051
|
category: "blur",
|
|
3752
4052
|
description: "Creates a circular blur effect emanating from a center point",
|
|
3753
4053
|
// Create an instance of the RadialBlurFilter with the provided parameters
|
|
3754
|
-
createFilter: (
|
|
4054
|
+
createFilter: (s) => {
|
|
3755
4055
|
try {
|
|
3756
|
-
const e = new
|
|
3757
|
-
angle:
|
|
3758
|
-
center: { x:
|
|
3759
|
-
kernelSize:
|
|
3760
|
-
radius:
|
|
4056
|
+
const e = new yt({
|
|
4057
|
+
angle: s.angle ?? 20,
|
|
4058
|
+
center: { x: s.centerX ?? 0, y: s.centerY ?? 0 },
|
|
4059
|
+
kernelSize: s.kernelSize ?? 15,
|
|
4060
|
+
radius: s.radius ?? 300
|
|
3761
4061
|
});
|
|
3762
4062
|
return e._customParams = {
|
|
3763
|
-
centerX:
|
|
3764
|
-
centerY:
|
|
4063
|
+
centerX: s.centerX ?? 0,
|
|
4064
|
+
centerY: s.centerY ?? 0
|
|
3765
4065
|
}, e.updateUIParam = function(t, i) {
|
|
3766
4066
|
try {
|
|
3767
4067
|
switch (t) {
|
|
@@ -3868,26 +4168,26 @@ f({
|
|
|
3868
4168
|
}
|
|
3869
4169
|
]
|
|
3870
4170
|
});
|
|
3871
|
-
const { TiltShiftFilter:
|
|
4171
|
+
const { TiltShiftFilter: _t } = g;
|
|
3872
4172
|
f({
|
|
3873
4173
|
id: "tilt-shift",
|
|
3874
4174
|
name: "Tilt Shift",
|
|
3875
4175
|
category: "blur",
|
|
3876
4176
|
description: "Creates a depth-of-field effect simulating miniature photography",
|
|
3877
4177
|
// Create an instance of the TiltShiftFilter with the provided parameters
|
|
3878
|
-
createFilter: (
|
|
4178
|
+
createFilter: (s) => {
|
|
3879
4179
|
try {
|
|
3880
|
-
const e = typeof
|
|
4180
|
+
const e = typeof s.blur == "number" ? s.blur : 100, t = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, i = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, o = typeof s.endY == "number" ? s.endY : 0.5, n = new _t({
|
|
3881
4181
|
blur: Number(e),
|
|
3882
4182
|
gradientBlur: Number(t),
|
|
3883
|
-
start: { x: Number(i), y: Number(
|
|
4183
|
+
start: { x: Number(i), y: Number(r) },
|
|
3884
4184
|
end: { x: Number(a), y: Number(o) }
|
|
3885
4185
|
});
|
|
3886
4186
|
return n._customParams = {
|
|
3887
4187
|
blur: e,
|
|
3888
4188
|
gradientBlur: t,
|
|
3889
4189
|
startX: i,
|
|
3890
|
-
startY:
|
|
4190
|
+
startY: r,
|
|
3891
4191
|
endX: a,
|
|
3892
4192
|
endY: o
|
|
3893
4193
|
}, n.updateUIParam = function(l, c) {
|
|
@@ -3996,7 +4296,7 @@ f({
|
|
|
3996
4296
|
}
|
|
3997
4297
|
]
|
|
3998
4298
|
});
|
|
3999
|
-
const { ZoomBlurFilter:
|
|
4299
|
+
const { ZoomBlurFilter: xt } = g;
|
|
4000
4300
|
f({
|
|
4001
4301
|
id: "zoom-blur",
|
|
4002
4302
|
name: "Zoom Blur",
|
|
@@ -4007,21 +4307,21 @@ f({
|
|
|
4007
4307
|
* This implementation follows the pattern from ColorGradientFilter, adding
|
|
4008
4308
|
* proper parameter handling with an updateUIParam method
|
|
4009
4309
|
*/
|
|
4010
|
-
createFilter: (
|
|
4310
|
+
createFilter: (s) => {
|
|
4011
4311
|
try {
|
|
4012
|
-
const e = new
|
|
4013
|
-
strength:
|
|
4312
|
+
const e = new xt({
|
|
4313
|
+
strength: s.strength || 0.1,
|
|
4014
4314
|
center: {
|
|
4015
|
-
x:
|
|
4016
|
-
y:
|
|
4315
|
+
x: s.centerX !== void 0 ? s.centerX : 0.5,
|
|
4316
|
+
y: s.centerY !== void 0 ? s.centerY : 0.5
|
|
4017
4317
|
},
|
|
4018
|
-
innerRadius:
|
|
4019
|
-
radius:
|
|
4020
|
-
maxKernelSize:
|
|
4318
|
+
innerRadius: s.innerRadius || 80,
|
|
4319
|
+
radius: s.radius !== void 0 ? s.radius : -1,
|
|
4320
|
+
maxKernelSize: s.maxKernelSize || 32
|
|
4021
4321
|
});
|
|
4022
|
-
return e._customParams = { ...
|
|
4023
|
-
const
|
|
4024
|
-
switch (this._customParams =
|
|
4322
|
+
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
4323
|
+
const r = this._customParams || {};
|
|
4324
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
4025
4325
|
case "strength":
|
|
4026
4326
|
this.strength = i;
|
|
4027
4327
|
break;
|
|
@@ -4123,7 +4423,7 @@ f({
|
|
|
4123
4423
|
}
|
|
4124
4424
|
]
|
|
4125
4425
|
});
|
|
4126
|
-
const { ColorGradientFilter:
|
|
4426
|
+
const { ColorGradientFilter: ae } = g;
|
|
4127
4427
|
f({
|
|
4128
4428
|
id: "color-gradient",
|
|
4129
4429
|
name: "Color Gradient",
|
|
@@ -4133,10 +4433,10 @@ f({
|
|
|
4133
4433
|
* Create an instance of the ColorGradientFilter with the provided parameters
|
|
4134
4434
|
* This implementation supports unlimited color stops like the PixiJS example app
|
|
4135
4435
|
*/
|
|
4136
|
-
createFilter: (
|
|
4436
|
+
createFilter: (s) => {
|
|
4137
4437
|
try {
|
|
4138
4438
|
let e = [];
|
|
4139
|
-
e = (
|
|
4439
|
+
e = (s.colorStops || [
|
|
4140
4440
|
{ offset: 0, color: "#ff0000", alpha: 1 },
|
|
4141
4441
|
{ offset: 1, color: "#0000ff", alpha: 1 }
|
|
4142
4442
|
]).map((i) => ({
|
|
@@ -4146,32 +4446,32 @@ f({
|
|
|
4146
4446
|
})), e.length < 2 && (e = [
|
|
4147
4447
|
{ offset: 0, color: 16711680, alpha: 1 },
|
|
4148
4448
|
{ offset: 1, color: 255, alpha: 1 }
|
|
4149
|
-
]), e.sort((i,
|
|
4150
|
-
const t = new
|
|
4151
|
-
type:
|
|
4449
|
+
]), e.sort((i, r) => i.offset - r.offset);
|
|
4450
|
+
const t = new ae({
|
|
4451
|
+
type: s.gradientType,
|
|
4152
4452
|
// 0: linear, 1: radial, 2: conic
|
|
4153
4453
|
stops: e,
|
|
4154
|
-
angle:
|
|
4155
|
-
alpha:
|
|
4156
|
-
maxColors:
|
|
4157
|
-
replace:
|
|
4454
|
+
angle: s.angle,
|
|
4455
|
+
alpha: s.alpha,
|
|
4456
|
+
maxColors: s.maxColors || 0,
|
|
4457
|
+
replace: s.replace
|
|
4158
4458
|
});
|
|
4159
|
-
return t._customParams = { ...
|
|
4160
|
-
return !this.stops || !Array.isArray(this.stops) ? [] : this.stops.map((
|
|
4161
|
-
offset:
|
|
4162
|
-
color: typeof
|
|
4163
|
-
alpha:
|
|
4459
|
+
return t._customParams = { ...s }, t.getColorStopsForUI = function() {
|
|
4460
|
+
return !this.stops || !Array.isArray(this.stops) ? [] : this.stops.map((r) => ({
|
|
4461
|
+
offset: r.offset,
|
|
4462
|
+
color: typeof r.color == "number" ? "#" + r.color.toString(16).padStart(6, "0") : r.color,
|
|
4463
|
+
alpha: r.alpha
|
|
4164
4464
|
}));
|
|
4165
4465
|
}, t.getDynamicControls = function() {
|
|
4166
|
-
const i = this.getColorStopsForUI(),
|
|
4466
|
+
const i = this.getColorStopsForUI(), r = [];
|
|
4167
4467
|
return i.forEach((a, o) => {
|
|
4168
|
-
|
|
4468
|
+
r.push({
|
|
4169
4469
|
id: `colorStop-${o}-color`,
|
|
4170
4470
|
type: "color",
|
|
4171
4471
|
label: `Stop ${o + 1} Color`,
|
|
4172
4472
|
property: `colorStops[${o}].color`,
|
|
4173
4473
|
default: a.color
|
|
4174
|
-
}),
|
|
4474
|
+
}), r.push({
|
|
4175
4475
|
id: `colorStop-${o}-offset`,
|
|
4176
4476
|
type: "slider",
|
|
4177
4477
|
label: `Stop ${o + 1} Position`,
|
|
@@ -4180,7 +4480,7 @@ f({
|
|
|
4180
4480
|
max: 1,
|
|
4181
4481
|
step: 0.01,
|
|
4182
4482
|
default: a.offset
|
|
4183
|
-
}),
|
|
4483
|
+
}), r.push({
|
|
4184
4484
|
id: `colorStop-${o}-alpha`,
|
|
4185
4485
|
type: "slider",
|
|
4186
4486
|
label: `Stop ${o + 1} Alpha`,
|
|
@@ -4190,20 +4490,20 @@ f({
|
|
|
4190
4490
|
step: 0.01,
|
|
4191
4491
|
default: a.alpha
|
|
4192
4492
|
});
|
|
4193
|
-
}),
|
|
4493
|
+
}), r;
|
|
4194
4494
|
}, t.handleButtonAction = function(i) {
|
|
4195
4495
|
(i === "addColorStop" || i === "removeColorStop") && this.updateUIParam(i, !0);
|
|
4196
|
-
}, t.updateUIParam = function(i,
|
|
4496
|
+
}, t.updateUIParam = function(i, r) {
|
|
4197
4497
|
const a = this._customParams || {};
|
|
4198
|
-
switch (this._customParams = a, a[i] =
|
|
4498
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
4199
4499
|
case "gradientType":
|
|
4200
|
-
this.type =
|
|
4500
|
+
this.type = r;
|
|
4201
4501
|
break;
|
|
4202
4502
|
case "angle":
|
|
4203
4503
|
case "alpha":
|
|
4204
4504
|
case "maxColors":
|
|
4205
4505
|
case "replace":
|
|
4206
|
-
i in this && (this[i] =
|
|
4506
|
+
i in this && (this[i] = r);
|
|
4207
4507
|
break;
|
|
4208
4508
|
case "addColorStop":
|
|
4209
4509
|
const o = [...this.stops], c = {
|
|
@@ -4235,9 +4535,9 @@ f({
|
|
|
4235
4535
|
})));
|
|
4236
4536
|
break;
|
|
4237
4537
|
case "cssGradient":
|
|
4238
|
-
if (
|
|
4538
|
+
if (r && typeof r == "string" && r.trim() !== "")
|
|
4239
4539
|
try {
|
|
4240
|
-
const h = new
|
|
4540
|
+
const h = new ae({ css: r });
|
|
4241
4541
|
this.type = h.type, this.angle = h.angle, this.stops = [...h.stops], a.colorStops = this.stops.map((p) => ({
|
|
4242
4542
|
offset: p.offset,
|
|
4243
4543
|
color: typeof p.color == "number" ? "#" + p.color.toString(16).padStart(6, "0") : p.color,
|
|
@@ -4247,8 +4547,8 @@ f({
|
|
|
4247
4547
|
}
|
|
4248
4548
|
break;
|
|
4249
4549
|
case "colorStops":
|
|
4250
|
-
if (Array.isArray(
|
|
4251
|
-
const h =
|
|
4550
|
+
if (Array.isArray(r)) {
|
|
4551
|
+
const h = r.map((p) => ({
|
|
4252
4552
|
offset: p.offset,
|
|
4253
4553
|
color: typeof p.color == "string" ? parseInt(p.color.replace("#", "0x")) : p.color,
|
|
4254
4554
|
alpha: p.alpha
|
|
@@ -4260,11 +4560,11 @@ f({
|
|
|
4260
4560
|
if (/colorStops\[\d+\]\..*/.test(i)) {
|
|
4261
4561
|
const h = i.match(/colorStops\[(\d+)\]\.(.*)/);
|
|
4262
4562
|
if (h) {
|
|
4263
|
-
const [p, m,
|
|
4264
|
-
if (b >= 0 && b <
|
|
4265
|
-
return
|
|
4563
|
+
const [p, m, C] = h, b = parseInt(m), y = [...this.stops];
|
|
4564
|
+
if (b >= 0 && b < y.length)
|
|
4565
|
+
return C === "color" && typeof r == "string" ? y[b].color = parseInt(r.replace("#", "0x")) : (C === "offset" || C === "alpha") && (y[b][C] = r), this.stops = y, this.stops.sort((v, _) => v.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
|
|
4266
4566
|
}
|
|
4267
|
-
} else i in this && (this[i] =
|
|
4567
|
+
} else i in this && (this[i] = r);
|
|
4268
4568
|
break;
|
|
4269
4569
|
}
|
|
4270
4570
|
}, t;
|
|
@@ -4373,23 +4673,23 @@ f({
|
|
|
4373
4673
|
category: "color",
|
|
4374
4674
|
description: "Maps colors using a reference texture as a lookup table",
|
|
4375
4675
|
// Create an instance of the ColorMapFilter with the provided parameters
|
|
4376
|
-
createFilter: (
|
|
4676
|
+
createFilter: (s) => {
|
|
4377
4677
|
try {
|
|
4378
4678
|
const e = g.ColorMapFilter;
|
|
4379
4679
|
if (!e)
|
|
4380
4680
|
return null;
|
|
4381
4681
|
let t = null;
|
|
4382
|
-
|
|
4682
|
+
s.texturePath ? t = w.Texture.from(s.texturePath) : t = w.Texture.from("/examples/filters-main/examples/images/colormap.png");
|
|
4383
4683
|
const i = new e({
|
|
4384
4684
|
colorMap: t,
|
|
4385
|
-
nearest:
|
|
4386
|
-
mix:
|
|
4685
|
+
nearest: s.nearest,
|
|
4686
|
+
mix: s.mix
|
|
4387
4687
|
});
|
|
4388
|
-
return i._customParams = { ...
|
|
4688
|
+
return i._customParams = { ...s }, i.updateUIParam = function(r, a) {
|
|
4389
4689
|
const o = this._customParams || {};
|
|
4390
|
-
switch (this._customParams = o, o[
|
|
4690
|
+
switch (this._customParams = o, o[r] = a, r) {
|
|
4391
4691
|
case "texturePath":
|
|
4392
|
-
a && (this.colorMap =
|
|
4692
|
+
a && (this.colorMap = w.Texture.from(a));
|
|
4393
4693
|
break;
|
|
4394
4694
|
case "mix":
|
|
4395
4695
|
this.mix = a;
|
|
@@ -4398,7 +4698,7 @@ f({
|
|
|
4398
4698
|
this.nearest = a;
|
|
4399
4699
|
break;
|
|
4400
4700
|
default:
|
|
4401
|
-
|
|
4701
|
+
r in this && (this[r] = a);
|
|
4402
4702
|
break;
|
|
4403
4703
|
}
|
|
4404
4704
|
return !0;
|
|
@@ -4450,7 +4750,7 @@ f({
|
|
|
4450
4750
|
}
|
|
4451
4751
|
]
|
|
4452
4752
|
});
|
|
4453
|
-
const
|
|
4753
|
+
const Ct = g.ColorReplaceFilter;
|
|
4454
4754
|
f({
|
|
4455
4755
|
id: "color-replace",
|
|
4456
4756
|
name: "Color Replace",
|
|
@@ -4461,20 +4761,20 @@ f({
|
|
|
4461
4761
|
* This implementation follows the pattern from ColorGradientFilter, adding
|
|
4462
4762
|
* proper parameter handling with an updateUIParam method
|
|
4463
4763
|
*/
|
|
4464
|
-
createFilter: (
|
|
4764
|
+
createFilter: (s) => {
|
|
4465
4765
|
try {
|
|
4466
4766
|
let e = 16711680;
|
|
4467
|
-
|
|
4767
|
+
s.originalColor && (typeof s.originalColor == "string" ? e = parseInt(s.originalColor.replace("#", "0x"), 16) : typeof s.originalColor == "number" && (e = s.originalColor));
|
|
4468
4768
|
let t = 255;
|
|
4469
|
-
|
|
4470
|
-
const i = new
|
|
4769
|
+
s.targetColor && (typeof s.targetColor == "string" ? t = parseInt(s.targetColor.replace("#", "0x"), 16) : typeof s.targetColor == "number" && (t = s.targetColor));
|
|
4770
|
+
const i = new Ct({
|
|
4471
4771
|
originalColor: e,
|
|
4472
4772
|
targetColor: t,
|
|
4473
|
-
tolerance:
|
|
4773
|
+
tolerance: s.tolerance || 0.4
|
|
4474
4774
|
});
|
|
4475
|
-
return i._customParams = { ...
|
|
4775
|
+
return i._customParams = { ...s }, i.updateUIParam = function(r, a) {
|
|
4476
4776
|
const o = this._customParams || {};
|
|
4477
|
-
switch (this._customParams = o, o[
|
|
4777
|
+
switch (this._customParams = o, o[r] = a, r) {
|
|
4478
4778
|
case "originalColor":
|
|
4479
4779
|
typeof a == "string" ? this.originalColor = parseInt(a.replace("#", "0x"), 16) : typeof a == "number" && (this.originalColor = a);
|
|
4480
4780
|
break;
|
|
@@ -4485,7 +4785,7 @@ f({
|
|
|
4485
4785
|
this.tolerance = a;
|
|
4486
4786
|
break;
|
|
4487
4787
|
default:
|
|
4488
|
-
|
|
4788
|
+
r in this && (this[r] = a);
|
|
4489
4789
|
break;
|
|
4490
4790
|
}
|
|
4491
4791
|
return !0;
|
|
@@ -4531,7 +4831,7 @@ f({
|
|
|
4531
4831
|
}
|
|
4532
4832
|
]
|
|
4533
4833
|
});
|
|
4534
|
-
const
|
|
4834
|
+
const wt = g.MultiColorReplaceFilter;
|
|
4535
4835
|
f({
|
|
4536
4836
|
id: "multi-color-replace",
|
|
4537
4837
|
name: "Multi-Color Replace",
|
|
@@ -4542,30 +4842,30 @@ f({
|
|
|
4542
4842
|
* This implementation follows the pattern from ColorGradientFilter, adding
|
|
4543
4843
|
* proper parameter handling with an updateUIParam method
|
|
4544
4844
|
*/
|
|
4545
|
-
createFilter: (
|
|
4845
|
+
createFilter: (s) => {
|
|
4546
4846
|
try {
|
|
4547
4847
|
const e = [];
|
|
4548
|
-
if (
|
|
4549
|
-
const i = typeof
|
|
4550
|
-
e.push([i,
|
|
4848
|
+
if (s.originalColor1 && s.targetColor1) {
|
|
4849
|
+
const i = typeof s.originalColor1 == "string" ? parseInt(s.originalColor1.replace("#", "0x"), 16) : s.originalColor1, r = typeof s.targetColor1 == "string" ? parseInt(s.targetColor1.replace("#", "0x"), 16) : s.targetColor1;
|
|
4850
|
+
e.push([i, r]);
|
|
4551
4851
|
}
|
|
4552
|
-
if (
|
|
4553
|
-
const i = typeof
|
|
4554
|
-
e.push([i,
|
|
4852
|
+
if (s.originalColor2 && s.targetColor2) {
|
|
4853
|
+
const i = typeof s.originalColor2 == "string" ? parseInt(s.originalColor2.replace("#", "0x"), 16) : s.originalColor2, r = typeof s.targetColor2 == "string" ? parseInt(s.targetColor2.replace("#", "0x"), 16) : s.targetColor2;
|
|
4854
|
+
e.push([i, r]);
|
|
4555
4855
|
}
|
|
4556
|
-
if (
|
|
4557
|
-
const i = typeof
|
|
4558
|
-
e.push([i,
|
|
4856
|
+
if (s.enableThirdPair && s.originalColor3 && s.targetColor3) {
|
|
4857
|
+
const i = typeof s.originalColor3 == "string" ? parseInt(s.originalColor3.replace("#", "0x"), 16) : s.originalColor3, r = typeof s.targetColor3 == "string" ? parseInt(s.targetColor3.replace("#", "0x"), 16) : s.targetColor3;
|
|
4858
|
+
e.push([i, r]);
|
|
4559
4859
|
}
|
|
4560
|
-
const t = new
|
|
4860
|
+
const t = new wt(
|
|
4561
4861
|
e,
|
|
4562
|
-
|
|
4862
|
+
s.tolerance || 0.05,
|
|
4563
4863
|
3
|
|
4564
4864
|
// Allow up to 3 color pairs
|
|
4565
4865
|
);
|
|
4566
|
-
return t._customParams = { ...
|
|
4866
|
+
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
4567
4867
|
const a = this._customParams || {};
|
|
4568
|
-
if (this._customParams = a, a[i] =
|
|
4868
|
+
if (this._customParams = a, a[i] = r, i === "originalColor1" || i === "targetColor1" || i === "originalColor2" || i === "targetColor2" || i === "originalColor3" || i === "targetColor3" || i === "enableThirdPair") {
|
|
4569
4869
|
const o = [];
|
|
4570
4870
|
if (a.originalColor1 && a.targetColor1) {
|
|
4571
4871
|
const n = typeof a.originalColor1 == "string" ? parseInt(a.originalColor1.replace("#", "0x"), 16) : a.originalColor1, l = typeof a.targetColor1 == "string" ? parseInt(a.targetColor1.replace("#", "0x"), 16) : a.targetColor1;
|
|
@@ -4580,7 +4880,7 @@ f({
|
|
|
4580
4880
|
o.push([n, l]);
|
|
4581
4881
|
}
|
|
4582
4882
|
this.replacements = o, this.refresh();
|
|
4583
|
-
} else i === "tolerance" ? this.tolerance =
|
|
4883
|
+
} else i === "tolerance" ? this.tolerance = r : i in this && (this[i] = r);
|
|
4584
4884
|
return !0;
|
|
4585
4885
|
}, t;
|
|
4586
4886
|
} catch {
|
|
@@ -4668,7 +4968,7 @@ f({
|
|
|
4668
4968
|
}
|
|
4669
4969
|
]
|
|
4670
4970
|
});
|
|
4671
|
-
const { RGBSplitFilter:
|
|
4971
|
+
const { RGBSplitFilter: St } = g;
|
|
4672
4972
|
f({
|
|
4673
4973
|
id: "rgb-split",
|
|
4674
4974
|
name: "RGB Split",
|
|
@@ -4678,23 +4978,23 @@ f({
|
|
|
4678
4978
|
* Create an instance of the RGBSplitFilter with the provided parameters
|
|
4679
4979
|
* Using the official pixi-filters implementation
|
|
4680
4980
|
*/
|
|
4681
|
-
createFilter: (
|
|
4981
|
+
createFilter: (s) => {
|
|
4682
4982
|
try {
|
|
4683
4983
|
const e = {
|
|
4684
|
-
x:
|
|
4685
|
-
y:
|
|
4984
|
+
x: s.redX !== void 0 ? s.redX : -10,
|
|
4985
|
+
y: s.redY !== void 0 ? s.redY : 0
|
|
4686
4986
|
}, t = {
|
|
4687
|
-
x:
|
|
4688
|
-
y:
|
|
4987
|
+
x: s.greenX !== void 0 ? s.greenX : 0,
|
|
4988
|
+
y: s.greenY !== void 0 ? s.greenY : 10
|
|
4689
4989
|
}, i = {
|
|
4690
|
-
x:
|
|
4691
|
-
y:
|
|
4692
|
-
},
|
|
4990
|
+
x: s.blueX !== void 0 ? s.blueX : 0,
|
|
4991
|
+
y: s.blueY !== void 0 ? s.blueY : 0
|
|
4992
|
+
}, r = new St({
|
|
4693
4993
|
red: e,
|
|
4694
4994
|
green: t,
|
|
4695
4995
|
blue: i
|
|
4696
4996
|
});
|
|
4697
|
-
return
|
|
4997
|
+
return r._customParams = { ...s }, r.updateUIParam = function(a, o) {
|
|
4698
4998
|
try {
|
|
4699
4999
|
const n = this._customParams || {};
|
|
4700
5000
|
switch (this._customParams = n, n[a] = o, a) {
|
|
@@ -4724,7 +5024,7 @@ f({
|
|
|
4724
5024
|
} catch {
|
|
4725
5025
|
return this._customParams && (this._customParams[a] = o), !1;
|
|
4726
5026
|
}
|
|
4727
|
-
},
|
|
5027
|
+
}, r;
|
|
4728
5028
|
} catch {
|
|
4729
5029
|
return null;
|
|
4730
5030
|
}
|
|
@@ -4802,33 +5102,33 @@ f({
|
|
|
4802
5102
|
}
|
|
4803
5103
|
]
|
|
4804
5104
|
});
|
|
4805
|
-
const { AdvancedBloomFilter:
|
|
5105
|
+
const { AdvancedBloomFilter: vt } = g;
|
|
4806
5106
|
f({
|
|
4807
5107
|
id: "advanced-bloom",
|
|
4808
5108
|
name: "Advanced Bloom",
|
|
4809
5109
|
category: "light",
|
|
4810
5110
|
description: "Adds a sophisticated bloom/glow effect with fine-grained control",
|
|
4811
5111
|
// Create an instance of the AdvancedBloomFilter with the provided parameters
|
|
4812
|
-
createFilter: (
|
|
5112
|
+
createFilter: (s) => {
|
|
4813
5113
|
try {
|
|
4814
|
-
const e = new
|
|
4815
|
-
threshold:
|
|
4816
|
-
bloomScale:
|
|
4817
|
-
brightness:
|
|
4818
|
-
blur:
|
|
4819
|
-
quality:
|
|
5114
|
+
const e = new vt({
|
|
5115
|
+
threshold: s.threshold || 0.5,
|
|
5116
|
+
bloomScale: s.bloomScale || 1,
|
|
5117
|
+
brightness: s.brightness || 1,
|
|
5118
|
+
blur: s.blur || 8,
|
|
5119
|
+
quality: s.quality || 4,
|
|
4820
5120
|
pixelSize: {
|
|
4821
|
-
x:
|
|
4822
|
-
y:
|
|
5121
|
+
x: s.pixelSizeX || 1,
|
|
5122
|
+
y: s.pixelSizeY || 1
|
|
4823
5123
|
}
|
|
4824
5124
|
});
|
|
4825
5125
|
return e._customParams = {
|
|
4826
|
-
pixelSizeX:
|
|
4827
|
-
pixelSizeY:
|
|
5126
|
+
pixelSizeX: s.pixelSizeX || 1,
|
|
5127
|
+
pixelSizeY: s.pixelSizeY || 1
|
|
4828
5128
|
}, e.updateUIParam = function(t, i) {
|
|
4829
5129
|
try {
|
|
4830
|
-
const
|
|
4831
|
-
switch (this._customParams =
|
|
5130
|
+
const r = this._customParams || {};
|
|
5131
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
4832
5132
|
case "threshold":
|
|
4833
5133
|
this.threshold = Number(i);
|
|
4834
5134
|
break;
|
|
@@ -4845,14 +5145,14 @@ f({
|
|
|
4845
5145
|
this.quality = Number(i);
|
|
4846
5146
|
break;
|
|
4847
5147
|
case "pixelSizeX":
|
|
4848
|
-
|
|
5148
|
+
r.pixelSizeX = Number(i), this.pixelSize = {
|
|
4849
5149
|
x: Number(i),
|
|
4850
|
-
y:
|
|
5150
|
+
y: r.pixelSizeY
|
|
4851
5151
|
};
|
|
4852
5152
|
break;
|
|
4853
5153
|
case "pixelSizeY":
|
|
4854
|
-
|
|
4855
|
-
x:
|
|
5154
|
+
r.pixelSizeY = Number(i), this.pixelSize = {
|
|
5155
|
+
x: r.pixelSizeX,
|
|
4856
5156
|
y: Number(i)
|
|
4857
5157
|
};
|
|
4858
5158
|
break;
|
|
@@ -4958,28 +5258,28 @@ f({
|
|
|
4958
5258
|
}
|
|
4959
5259
|
]
|
|
4960
5260
|
});
|
|
4961
|
-
const
|
|
5261
|
+
const kt = g.AsciiFilter;
|
|
4962
5262
|
f({
|
|
4963
5263
|
id: "ascii",
|
|
4964
5264
|
name: "ASCII",
|
|
4965
5265
|
category: "stylize",
|
|
4966
5266
|
description: "Convert image to ASCII text characters",
|
|
4967
5267
|
// Create an instance of the AsciiFilter with the provided parameters
|
|
4968
|
-
createFilter: (
|
|
5268
|
+
createFilter: (s) => {
|
|
4969
5269
|
try {
|
|
4970
|
-
const e = typeof
|
|
4971
|
-
let t =
|
|
5270
|
+
const e = typeof s.size == "number" ? s.size : 8;
|
|
5271
|
+
let t = s.color;
|
|
4972
5272
|
typeof t == "string" && t.startsWith("#") && (t = parseInt(t.replace("#", "0x"), 16));
|
|
4973
|
-
const i =
|
|
5273
|
+
const i = s.replaceColor === !0, r = new kt({
|
|
4974
5274
|
size: e,
|
|
4975
5275
|
color: t,
|
|
4976
5276
|
replaceColor: i
|
|
4977
5277
|
});
|
|
4978
|
-
return
|
|
5278
|
+
return r._customParams = {
|
|
4979
5279
|
size: e,
|
|
4980
5280
|
color: t,
|
|
4981
5281
|
replaceColor: i
|
|
4982
|
-
},
|
|
5282
|
+
}, r.updateUIParam = function(a, o) {
|
|
4983
5283
|
try {
|
|
4984
5284
|
const n = this._customParams || {};
|
|
4985
5285
|
switch (this._customParams = n, n[a] = o, a) {
|
|
@@ -4998,7 +5298,7 @@ f({
|
|
|
4998
5298
|
}
|
|
4999
5299
|
} catch {
|
|
5000
5300
|
}
|
|
5001
|
-
},
|
|
5301
|
+
}, r;
|
|
5002
5302
|
} catch {
|
|
5003
5303
|
return null;
|
|
5004
5304
|
}
|
|
@@ -5037,27 +5337,27 @@ f({
|
|
|
5037
5337
|
}
|
|
5038
5338
|
]
|
|
5039
5339
|
});
|
|
5040
|
-
const
|
|
5340
|
+
const Pt = g.BackdropBlurFilter;
|
|
5041
5341
|
f({
|
|
5042
5342
|
id: "backdrop-blur",
|
|
5043
5343
|
name: "Backdrop Blur",
|
|
5044
5344
|
category: "blur",
|
|
5045
5345
|
description: "Blurs what is behind the object, creating a glass-like effect",
|
|
5046
5346
|
// Create an instance of the BackdropBlurFilter with the provided parameters
|
|
5047
|
-
createFilter: (
|
|
5347
|
+
createFilter: (s) => {
|
|
5048
5348
|
try {
|
|
5049
|
-
const e = new
|
|
5349
|
+
const e = new Pt({
|
|
5050
5350
|
// Higher strength values (20-50) make the effect more noticeable
|
|
5051
|
-
strength:
|
|
5052
|
-
quality:
|
|
5351
|
+
strength: s.strength || 20,
|
|
5352
|
+
quality: s.quality || 4,
|
|
5053
5353
|
// Lower resolution values (0.2-0.5) can make the effect more visible but less sharp
|
|
5054
|
-
resolution:
|
|
5055
|
-
kernelSize:
|
|
5354
|
+
resolution: s.resolution || 0.5,
|
|
5355
|
+
kernelSize: s.kernelSize || 9
|
|
5056
5356
|
});
|
|
5057
|
-
return e._customParams = { ...
|
|
5357
|
+
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
5058
5358
|
try {
|
|
5059
|
-
const
|
|
5060
|
-
switch (this._customParams =
|
|
5359
|
+
const r = this._customParams || {};
|
|
5360
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
5061
5361
|
case "strength":
|
|
5062
5362
|
this.strength = Number(i), this.blur = Number(i) / 4;
|
|
5063
5363
|
break;
|
|
@@ -5144,7 +5444,7 @@ f({
|
|
|
5144
5444
|
}
|
|
5145
5445
|
]
|
|
5146
5446
|
});
|
|
5147
|
-
const { BevelFilter:
|
|
5447
|
+
const { BevelFilter: Mt } = g;
|
|
5148
5448
|
f({
|
|
5149
5449
|
id: "bevel",
|
|
5150
5450
|
name: "Bevel",
|
|
@@ -5154,20 +5454,20 @@ f({
|
|
|
5154
5454
|
* Create an instance of the BevelFilter with the provided parameters
|
|
5155
5455
|
* Using the official pixi-filters implementation
|
|
5156
5456
|
*/
|
|
5157
|
-
createFilter: (
|
|
5457
|
+
createFilter: (s) => {
|
|
5158
5458
|
try {
|
|
5159
|
-
const e =
|
|
5160
|
-
rotation:
|
|
5161
|
-
thickness:
|
|
5459
|
+
const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new Mt({
|
|
5460
|
+
rotation: s.rotation !== void 0 ? s.rotation : 45,
|
|
5461
|
+
thickness: s.thickness !== void 0 ? s.thickness : 2,
|
|
5162
5462
|
lightColor: parseInt(e, 16),
|
|
5163
|
-
lightAlpha:
|
|
5463
|
+
lightAlpha: s.lightAlpha !== void 0 ? s.lightAlpha : 0.7,
|
|
5164
5464
|
shadowColor: parseInt(t, 16),
|
|
5165
|
-
shadowAlpha:
|
|
5465
|
+
shadowAlpha: s.shadowAlpha !== void 0 ? s.shadowAlpha : 0.7
|
|
5166
5466
|
});
|
|
5167
|
-
return i._customParams = { ...
|
|
5467
|
+
return i._customParams = { ...s }, i.updateUIParam = function(r, a) {
|
|
5168
5468
|
try {
|
|
5169
5469
|
const o = this._customParams || {};
|
|
5170
|
-
switch (this._customParams = o, o[
|
|
5470
|
+
switch (this._customParams = o, o[r] = a, r) {
|
|
5171
5471
|
case "rotation":
|
|
5172
5472
|
this.rotation = Number(a);
|
|
5173
5473
|
break;
|
|
@@ -5193,12 +5493,12 @@ f({
|
|
|
5193
5493
|
this.shadowAlpha = Number(a);
|
|
5194
5494
|
break;
|
|
5195
5495
|
default:
|
|
5196
|
-
|
|
5496
|
+
r in this && (this[r] = a);
|
|
5197
5497
|
break;
|
|
5198
5498
|
}
|
|
5199
5499
|
return !0;
|
|
5200
5500
|
} catch {
|
|
5201
|
-
return this._customParams && (this._customParams[
|
|
5501
|
+
return this._customParams && (this._customParams[r] = a), !1;
|
|
5202
5502
|
}
|
|
5203
5503
|
}, i;
|
|
5204
5504
|
} catch {
|
|
@@ -5272,29 +5572,29 @@ f({
|
|
|
5272
5572
|
}
|
|
5273
5573
|
]
|
|
5274
5574
|
});
|
|
5275
|
-
const { BloomFilter:
|
|
5575
|
+
const { BloomFilter: Ft } = g;
|
|
5276
5576
|
f({
|
|
5277
5577
|
id: "bloom",
|
|
5278
5578
|
name: "Bloom/Glow",
|
|
5279
5579
|
category: "light",
|
|
5280
5580
|
description: "Add a subtle glow effect to bright areas of the image",
|
|
5281
5581
|
// Create an instance of the BloomFilter with the provided parameters
|
|
5282
|
-
createFilter: (
|
|
5582
|
+
createFilter: (s) => {
|
|
5283
5583
|
try {
|
|
5284
|
-
const e = typeof
|
|
5584
|
+
const e = typeof s.strengthX == "number" ? s.strengthX : 2, t = typeof s.strengthY == "number" ? s.strengthY : 2, i = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, o = new Ft({
|
|
5285
5585
|
strength: {
|
|
5286
5586
|
x: Number(e),
|
|
5287
5587
|
y: Number(t)
|
|
5288
5588
|
},
|
|
5289
5589
|
quality: Number(i),
|
|
5290
|
-
resolution: Number(
|
|
5590
|
+
resolution: Number(r),
|
|
5291
5591
|
kernelSize: Number(a)
|
|
5292
5592
|
});
|
|
5293
5593
|
return o._customParams = {
|
|
5294
5594
|
strengthX: e,
|
|
5295
5595
|
strengthY: t,
|
|
5296
5596
|
quality: i,
|
|
5297
|
-
resolution:
|
|
5597
|
+
resolution: r,
|
|
5298
5598
|
kernelSize: a
|
|
5299
5599
|
}, o.updateUIParam = function(n, l) {
|
|
5300
5600
|
var c, d;
|
|
@@ -5384,7 +5684,7 @@ f({
|
|
|
5384
5684
|
}
|
|
5385
5685
|
]
|
|
5386
5686
|
});
|
|
5387
|
-
const { BulgePinchFilter:
|
|
5687
|
+
const { BulgePinchFilter: At } = g;
|
|
5388
5688
|
f({
|
|
5389
5689
|
id: "bulge-pinch",
|
|
5390
5690
|
// ID must match what the application expects
|
|
@@ -5392,17 +5692,17 @@ f({
|
|
|
5392
5692
|
category: "distortion",
|
|
5393
5693
|
description: "Creates a bulge or pinch effect in a circular area",
|
|
5394
5694
|
// Create an instance of the BulgePinchFilter with the provided parameters
|
|
5395
|
-
createFilter: (
|
|
5695
|
+
createFilter: (s) => {
|
|
5396
5696
|
try {
|
|
5397
|
-
const e =
|
|
5697
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new At({
|
|
5398
5698
|
center: {
|
|
5399
5699
|
x: e,
|
|
5400
5700
|
y: t
|
|
5401
5701
|
},
|
|
5402
5702
|
radius: i,
|
|
5403
|
-
strength:
|
|
5703
|
+
strength: r
|
|
5404
5704
|
});
|
|
5405
|
-
return a._customParams = { ...
|
|
5705
|
+
return a._customParams = { ...s }, a.updateUIParam = function(o, n) {
|
|
5406
5706
|
const l = this._customParams || {};
|
|
5407
5707
|
switch (this._customParams = l, l[o] = n, o) {
|
|
5408
5708
|
case "centerX":
|
|
@@ -5476,7 +5776,7 @@ f({
|
|
|
5476
5776
|
}
|
|
5477
5777
|
]
|
|
5478
5778
|
});
|
|
5479
|
-
const { ConvolutionFilter:
|
|
5779
|
+
const { ConvolutionFilter: zt } = g, E = {
|
|
5480
5780
|
normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
|
|
5481
5781
|
gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
|
|
5482
5782
|
boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
|
|
@@ -5492,42 +5792,42 @@ f({
|
|
|
5492
5792
|
name: "Convolution Matrix",
|
|
5493
5793
|
category: "effects",
|
|
5494
5794
|
description: "Apply custom image effects using matrix convolution",
|
|
5495
|
-
createFilter: (
|
|
5795
|
+
createFilter: (s) => {
|
|
5496
5796
|
try {
|
|
5497
5797
|
let e;
|
|
5498
|
-
if (
|
|
5798
|
+
if (s.customMatrix)
|
|
5499
5799
|
e = [
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5800
|
+
s.m00,
|
|
5801
|
+
s.m01,
|
|
5802
|
+
s.m02,
|
|
5803
|
+
s.m10,
|
|
5804
|
+
s.m11,
|
|
5805
|
+
s.m12,
|
|
5806
|
+
s.m20,
|
|
5807
|
+
s.m21,
|
|
5808
|
+
s.m22
|
|
5509
5809
|
];
|
|
5510
5810
|
else {
|
|
5511
|
-
const i =
|
|
5512
|
-
e =
|
|
5811
|
+
const i = s.preset;
|
|
5812
|
+
e = E[i] || E.normal;
|
|
5513
5813
|
}
|
|
5514
|
-
const t = new
|
|
5515
|
-
return t._customParams = { ...
|
|
5814
|
+
const t = new zt(e, s.width || 200, s.height || 200);
|
|
5815
|
+
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
5516
5816
|
const a = this._customParams || {};
|
|
5517
|
-
switch (this._customParams = a, a[i] =
|
|
5817
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
5518
5818
|
case "preset":
|
|
5519
5819
|
if (!a.customMatrix) {
|
|
5520
|
-
const o =
|
|
5521
|
-
|
|
5820
|
+
const o = r;
|
|
5821
|
+
E[o] && (this.matrix = E[o]);
|
|
5522
5822
|
}
|
|
5523
5823
|
break;
|
|
5524
5824
|
case "customMatrix":
|
|
5525
|
-
if (
|
|
5825
|
+
if (r) {
|
|
5526
5826
|
const o = this.matrix;
|
|
5527
5827
|
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];
|
|
5528
5828
|
} else {
|
|
5529
5829
|
const o = a.preset;
|
|
5530
|
-
this.matrix =
|
|
5830
|
+
this.matrix = E[o] || E.normal;
|
|
5531
5831
|
}
|
|
5532
5832
|
break;
|
|
5533
5833
|
case "m00":
|
|
@@ -5551,17 +5851,17 @@ f({
|
|
|
5551
5851
|
m21: 7,
|
|
5552
5852
|
m22: 8
|
|
5553
5853
|
}[i];
|
|
5554
|
-
l !== void 0 && (o[l] =
|
|
5854
|
+
l !== void 0 && (o[l] = r, this.matrix = o);
|
|
5555
5855
|
}
|
|
5556
5856
|
break;
|
|
5557
5857
|
case "width":
|
|
5558
|
-
this.width =
|
|
5858
|
+
this.width = r;
|
|
5559
5859
|
break;
|
|
5560
5860
|
case "height":
|
|
5561
|
-
this.height =
|
|
5861
|
+
this.height = r;
|
|
5562
5862
|
break;
|
|
5563
5863
|
default:
|
|
5564
|
-
i in this && (this[i] =
|
|
5864
|
+
i in this && (this[i] = r);
|
|
5565
5865
|
break;
|
|
5566
5866
|
}
|
|
5567
5867
|
}, t;
|
|
@@ -5722,7 +6022,7 @@ f({
|
|
|
5722
6022
|
}
|
|
5723
6023
|
]
|
|
5724
6024
|
});
|
|
5725
|
-
const { CrossHatchFilter:
|
|
6025
|
+
const { CrossHatchFilter: Nt } = g;
|
|
5726
6026
|
f({
|
|
5727
6027
|
id: "cross-hatch",
|
|
5728
6028
|
name: "Cross Hatch",
|
|
@@ -5730,9 +6030,9 @@ f({
|
|
|
5730
6030
|
description: "Creates a crosshatching effect like in a pencil drawing",
|
|
5731
6031
|
// Create an instance of the CrossHatchFilter
|
|
5732
6032
|
// Note: CrossHatchFilter has NO parameters according to PixiJS examples
|
|
5733
|
-
createFilter: (
|
|
6033
|
+
createFilter: (s) => {
|
|
5734
6034
|
try {
|
|
5735
|
-
const e = new
|
|
6035
|
+
const e = new Nt();
|
|
5736
6036
|
return e.updateUIParam = function(t, i) {
|
|
5737
6037
|
return !0;
|
|
5738
6038
|
}, e;
|
|
@@ -5751,60 +6051,60 @@ f({
|
|
|
5751
6051
|
category: "stylize",
|
|
5752
6052
|
description: "Simulates an old CRT screen with scan lines and noise",
|
|
5753
6053
|
// Create an instance of the CRTFilter with the provided parameters
|
|
5754
|
-
createFilter: (
|
|
6054
|
+
createFilter: (s) => {
|
|
5755
6055
|
try {
|
|
5756
6056
|
const e = {
|
|
5757
|
-
lineWidth: typeof
|
|
5758
|
-
noise: typeof
|
|
5759
|
-
curvature: typeof
|
|
5760
|
-
lineContrast: typeof
|
|
5761
|
-
verticalLine:
|
|
5762
|
-
noiseSize: typeof
|
|
5763
|
-
vignetting: typeof
|
|
5764
|
-
vignettingAlpha: typeof
|
|
5765
|
-
vignettingBlur: typeof
|
|
5766
|
-
time: typeof
|
|
5767
|
-
seed: typeof
|
|
6057
|
+
lineWidth: typeof s.lineWidth == "number" ? s.lineWidth : 1,
|
|
6058
|
+
noise: typeof s.noise == "number" ? s.noise : 0.3,
|
|
6059
|
+
curvature: typeof s.curvature == "number" ? s.curvature : 1,
|
|
6060
|
+
lineContrast: typeof s.lineContrast == "number" ? s.lineContrast : 0.25,
|
|
6061
|
+
verticalLine: s.verticalLine === !0,
|
|
6062
|
+
noiseSize: typeof s.noiseSize == "number" ? s.noiseSize : 1,
|
|
6063
|
+
vignetting: typeof s.vignetting == "number" ? s.vignetting : 0.3,
|
|
6064
|
+
vignettingAlpha: typeof s.vignettingAlpha == "number" ? s.vignettingAlpha : 1,
|
|
6065
|
+
vignettingBlur: typeof s.vignettingBlur == "number" ? s.vignettingBlur : 0.3,
|
|
6066
|
+
time: typeof s.time == "number" ? s.time : 0,
|
|
6067
|
+
seed: typeof s.seed == "number" ? s.seed : Math.random()
|
|
5768
6068
|
}, t = new g.CRTFilter(e);
|
|
5769
|
-
return t._customParams = { ...e }, t.updateUIParam = function(i,
|
|
6069
|
+
return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
|
|
5770
6070
|
try {
|
|
5771
6071
|
const a = this._customParams || {};
|
|
5772
|
-
switch (this._customParams = a, a[i] =
|
|
6072
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
5773
6073
|
case "lineWidth":
|
|
5774
|
-
this.lineWidth = Number(
|
|
6074
|
+
this.lineWidth = Number(r);
|
|
5775
6075
|
break;
|
|
5776
6076
|
case "noise":
|
|
5777
|
-
this.noise = Number(
|
|
6077
|
+
this.noise = Number(r);
|
|
5778
6078
|
break;
|
|
5779
6079
|
case "curvature":
|
|
5780
|
-
this.curvature = Number(
|
|
6080
|
+
this.curvature = Number(r);
|
|
5781
6081
|
break;
|
|
5782
6082
|
case "lineContrast":
|
|
5783
|
-
this.lineContrast = Number(
|
|
6083
|
+
this.lineContrast = Number(r);
|
|
5784
6084
|
break;
|
|
5785
6085
|
case "verticalLine":
|
|
5786
|
-
this.verticalLine = !!
|
|
6086
|
+
this.verticalLine = !!r;
|
|
5787
6087
|
break;
|
|
5788
6088
|
case "noiseSize":
|
|
5789
|
-
this.noiseSize = Number(
|
|
6089
|
+
this.noiseSize = Number(r);
|
|
5790
6090
|
break;
|
|
5791
6091
|
case "vignetting":
|
|
5792
|
-
this.vignetting = Number(
|
|
6092
|
+
this.vignetting = Number(r);
|
|
5793
6093
|
break;
|
|
5794
6094
|
case "vignettingAlpha":
|
|
5795
|
-
this.vignettingAlpha = Number(
|
|
6095
|
+
this.vignettingAlpha = Number(r);
|
|
5796
6096
|
break;
|
|
5797
6097
|
case "vignettingBlur":
|
|
5798
|
-
this.vignettingBlur = Number(
|
|
6098
|
+
this.vignettingBlur = Number(r);
|
|
5799
6099
|
break;
|
|
5800
6100
|
case "time":
|
|
5801
|
-
this.time = Number(
|
|
6101
|
+
this.time = Number(r);
|
|
5802
6102
|
break;
|
|
5803
6103
|
case "seed":
|
|
5804
|
-
this.seed = Number(
|
|
6104
|
+
this.seed = Number(r);
|
|
5805
6105
|
break;
|
|
5806
6106
|
default:
|
|
5807
|
-
i in this && (this[i] =
|
|
6107
|
+
i in this && (this[i] = r);
|
|
5808
6108
|
break;
|
|
5809
6109
|
}
|
|
5810
6110
|
} catch {
|
|
@@ -5929,7 +6229,7 @@ f({
|
|
|
5929
6229
|
}
|
|
5930
6230
|
]
|
|
5931
6231
|
});
|
|
5932
|
-
const
|
|
6232
|
+
const Rt = w.DisplacementFilter, Tt = w.Sprite, H = w.Texture;
|
|
5933
6233
|
f({
|
|
5934
6234
|
id: "displacement",
|
|
5935
6235
|
// ID must match what the application expects
|
|
@@ -5937,12 +6237,12 @@ f({
|
|
|
5937
6237
|
category: "distortion",
|
|
5938
6238
|
description: "Distorts the image using a displacement map texture",
|
|
5939
6239
|
// Create an instance of the DisplacementFilter with the provided parameters
|
|
5940
|
-
createFilter: (
|
|
6240
|
+
createFilter: (s) => {
|
|
5941
6241
|
try {
|
|
5942
|
-
const e =
|
|
6242
|
+
const e = s.mapTexture || "/assets/images/displacement_map.png";
|
|
5943
6243
|
let t;
|
|
5944
6244
|
try {
|
|
5945
|
-
t =
|
|
6245
|
+
t = H.from(e), t.source.addressMode = "repeat";
|
|
5946
6246
|
} catch {
|
|
5947
6247
|
const o = document.createElement("canvas");
|
|
5948
6248
|
o.width = 256, o.height = 256;
|
|
@@ -5953,10 +6253,10 @@ f({
|
|
|
5953
6253
|
for (let c = 0; c < 10; c++)
|
|
5954
6254
|
(l + c) % 2 === 0 && n.fillRect(l * 25, c * 25, 25, 25);
|
|
5955
6255
|
}
|
|
5956
|
-
t =
|
|
6256
|
+
t = H.from(o);
|
|
5957
6257
|
}
|
|
5958
|
-
const i = new
|
|
5959
|
-
return
|
|
6258
|
+
const i = new Tt(t), r = new Rt(i, s.scale || 50);
|
|
6259
|
+
return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = i, r.updateUIParam = function(a, o) {
|
|
5960
6260
|
const n = this._customParams || {};
|
|
5961
6261
|
switch (this._customParams = n, n[a] = o, a) {
|
|
5962
6262
|
case "scaleX":
|
|
@@ -5969,7 +6269,7 @@ f({
|
|
|
5969
6269
|
try {
|
|
5970
6270
|
const l = this._displacementSprite;
|
|
5971
6271
|
if (l) {
|
|
5972
|
-
const c =
|
|
6272
|
+
const c = H.from(o);
|
|
5973
6273
|
c.source.addressMode = "repeat", l.texture = c;
|
|
5974
6274
|
}
|
|
5975
6275
|
} catch {
|
|
@@ -5980,7 +6280,7 @@ f({
|
|
|
5980
6280
|
break;
|
|
5981
6281
|
}
|
|
5982
6282
|
return !0;
|
|
5983
|
-
},
|
|
6283
|
+
}, r;
|
|
5984
6284
|
} catch {
|
|
5985
6285
|
return null;
|
|
5986
6286
|
}
|
|
@@ -6034,28 +6334,28 @@ f({
|
|
|
6034
6334
|
category: "stylize",
|
|
6035
6335
|
description: "Simulates a halftone printing pattern with dots",
|
|
6036
6336
|
// Create an instance of the DotFilter with the provided parameters
|
|
6037
|
-
createFilter: (
|
|
6337
|
+
createFilter: (s) => {
|
|
6038
6338
|
try {
|
|
6039
6339
|
const e = {
|
|
6040
|
-
scale: typeof
|
|
6041
|
-
angle: typeof
|
|
6042
|
-
grayscale:
|
|
6340
|
+
scale: typeof s.scale == "number" ? s.scale : 1,
|
|
6341
|
+
angle: typeof s.angle == "number" ? s.angle : 5,
|
|
6342
|
+
grayscale: s.grayscale === !0
|
|
6043
6343
|
}, t = new g.DotFilter(e);
|
|
6044
|
-
return t._customParams = { ...e }, t.updateUIParam = function(i,
|
|
6344
|
+
return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
|
|
6045
6345
|
try {
|
|
6046
6346
|
const a = this._customParams || {};
|
|
6047
|
-
switch (this._customParams = a, a[i] =
|
|
6347
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
6048
6348
|
case "scale":
|
|
6049
|
-
this.scale = Number(
|
|
6349
|
+
this.scale = Number(r);
|
|
6050
6350
|
break;
|
|
6051
6351
|
case "angle":
|
|
6052
|
-
this.angle = Number(
|
|
6352
|
+
this.angle = Number(r);
|
|
6053
6353
|
break;
|
|
6054
6354
|
case "grayscale":
|
|
6055
|
-
this.grayscale = !!
|
|
6355
|
+
this.grayscale = !!r;
|
|
6056
6356
|
break;
|
|
6057
6357
|
default:
|
|
6058
|
-
i in this && (this[i] =
|
|
6358
|
+
i in this && (this[i] = r);
|
|
6059
6359
|
break;
|
|
6060
6360
|
}
|
|
6061
6361
|
} catch {
|
|
@@ -6102,28 +6402,28 @@ f({
|
|
|
6102
6402
|
}
|
|
6103
6403
|
]
|
|
6104
6404
|
});
|
|
6105
|
-
const { EmbossFilter:
|
|
6405
|
+
const { EmbossFilter: It } = g;
|
|
6106
6406
|
f({
|
|
6107
6407
|
id: "emboss",
|
|
6108
6408
|
name: "Emboss",
|
|
6109
6409
|
category: "stylize",
|
|
6110
6410
|
description: "Creates an embossed relief effect",
|
|
6111
6411
|
// Create an instance of the Emboss filter with the provided parameters
|
|
6112
|
-
createFilter: (
|
|
6412
|
+
createFilter: (s) => {
|
|
6113
6413
|
try {
|
|
6114
|
-
const e = typeof
|
|
6414
|
+
const e = typeof s.strength == "number" ? s.strength : 5, t = new It(e);
|
|
6115
6415
|
return t._customParams = {
|
|
6116
6416
|
strength: e
|
|
6117
|
-
}, t.updateUIParam = function(i,
|
|
6417
|
+
}, t.updateUIParam = function(i, r) {
|
|
6118
6418
|
try {
|
|
6119
6419
|
const a = this._customParams || {};
|
|
6120
|
-
switch (this._customParams = a, a[i] =
|
|
6420
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
6121
6421
|
case "strength":
|
|
6122
|
-
const o = Number(
|
|
6422
|
+
const o = Number(r);
|
|
6123
6423
|
a.strength = o, this.strength = o;
|
|
6124
6424
|
break;
|
|
6125
6425
|
default:
|
|
6126
|
-
i in this && (this[i] =
|
|
6426
|
+
i in this && (this[i] = r);
|
|
6127
6427
|
break;
|
|
6128
6428
|
}
|
|
6129
6429
|
} catch {
|
|
@@ -6151,7 +6451,7 @@ f({
|
|
|
6151
6451
|
}
|
|
6152
6452
|
]
|
|
6153
6453
|
});
|
|
6154
|
-
const { GlitchFilter:
|
|
6454
|
+
const { GlitchFilter: Et } = g, N = {
|
|
6155
6455
|
TRANSPARENT: 0,
|
|
6156
6456
|
ORIGINAL: 1,
|
|
6157
6457
|
LOOP: 2,
|
|
@@ -6163,29 +6463,29 @@ f({
|
|
|
6163
6463
|
name: "Glitch",
|
|
6164
6464
|
category: "effects",
|
|
6165
6465
|
description: "Apply digital distortion and glitch effects",
|
|
6166
|
-
createFilter: (
|
|
6466
|
+
createFilter: (s) => {
|
|
6167
6467
|
try {
|
|
6168
|
-
const e = { x:
|
|
6169
|
-
slices:
|
|
6170
|
-
offset:
|
|
6171
|
-
direction:
|
|
6172
|
-
fillMode:
|
|
6173
|
-
seed:
|
|
6174
|
-
average:
|
|
6175
|
-
minSize:
|
|
6176
|
-
sampleSize:
|
|
6468
|
+
const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new Et({
|
|
6469
|
+
slices: s.slices,
|
|
6470
|
+
offset: s.offset,
|
|
6471
|
+
direction: s.direction,
|
|
6472
|
+
fillMode: s.fillMode,
|
|
6473
|
+
seed: s.seed,
|
|
6474
|
+
average: s.average,
|
|
6475
|
+
minSize: s.minSize,
|
|
6476
|
+
sampleSize: s.sampleSize,
|
|
6177
6477
|
red: e,
|
|
6178
6478
|
green: t,
|
|
6179
6479
|
blue: i
|
|
6180
6480
|
});
|
|
6181
|
-
|
|
6481
|
+
r.animating = s.animating || !1, r._customParams = { ...s }, typeof r.refresh == "function" && r.refresh();
|
|
6182
6482
|
let a = null;
|
|
6183
6483
|
const o = () => {
|
|
6184
|
-
|
|
6484
|
+
r.animating && (r.seed = Math.random()), a = requestAnimationFrame(o);
|
|
6185
6485
|
};
|
|
6186
|
-
return
|
|
6486
|
+
return r.animating && (a = requestAnimationFrame(o)), r._stopAnimation = () => {
|
|
6187
6487
|
a !== null && (cancelAnimationFrame(a), a = null);
|
|
6188
|
-
},
|
|
6488
|
+
}, r.updateUIParam = function(n, l) {
|
|
6189
6489
|
const c = this._customParams || {};
|
|
6190
6490
|
switch (this._customParams = c, c[n] = l, n) {
|
|
6191
6491
|
case "animating":
|
|
@@ -6234,7 +6534,7 @@ f({
|
|
|
6234
6534
|
n in this && (this[n] = l);
|
|
6235
6535
|
break;
|
|
6236
6536
|
}
|
|
6237
|
-
},
|
|
6537
|
+
}, r;
|
|
6238
6538
|
} catch {
|
|
6239
6539
|
return null;
|
|
6240
6540
|
}
|
|
@@ -6243,7 +6543,7 @@ f({
|
|
|
6243
6543
|
slices: 10,
|
|
6244
6544
|
offset: 100,
|
|
6245
6545
|
direction: 0,
|
|
6246
|
-
fillMode:
|
|
6546
|
+
fillMode: N.LOOP,
|
|
6247
6547
|
// LOOP mode looks better for the demo
|
|
6248
6548
|
seed: 0.5,
|
|
6249
6549
|
average: !1,
|
|
@@ -6306,13 +6606,13 @@ f({
|
|
|
6306
6606
|
label: "Fill Mode",
|
|
6307
6607
|
property: "fillMode",
|
|
6308
6608
|
options: [
|
|
6309
|
-
{ value:
|
|
6310
|
-
{ value:
|
|
6311
|
-
{ value:
|
|
6312
|
-
{ value:
|
|
6313
|
-
{ value:
|
|
6609
|
+
{ value: N.TRANSPARENT, label: "Transparent" },
|
|
6610
|
+
{ value: N.ORIGINAL, label: "Original" },
|
|
6611
|
+
{ value: N.LOOP, label: "Loop" },
|
|
6612
|
+
{ value: N.CLAMP, label: "Clamp" },
|
|
6613
|
+
{ value: N.MIRROR, label: "Mirror" }
|
|
6314
6614
|
],
|
|
6315
|
-
default:
|
|
6615
|
+
default: N.LOOP
|
|
6316
6616
|
},
|
|
6317
6617
|
{
|
|
6318
6618
|
id: "seed",
|
|
@@ -6406,54 +6706,54 @@ f({
|
|
|
6406
6706
|
}
|
|
6407
6707
|
]
|
|
6408
6708
|
});
|
|
6409
|
-
const { GlowFilter:
|
|
6709
|
+
const { GlowFilter: Xt } = g;
|
|
6410
6710
|
f({
|
|
6411
6711
|
id: "glow",
|
|
6412
6712
|
name: "Glow",
|
|
6413
6713
|
category: "light",
|
|
6414
6714
|
description: "Adds a customizable glow effect around the image",
|
|
6415
6715
|
// Create an instance of the GlowFilter with the provided parameters
|
|
6416
|
-
createFilter: (
|
|
6716
|
+
createFilter: (s) => {
|
|
6417
6717
|
try {
|
|
6418
|
-
const e = parseInt(
|
|
6419
|
-
distance:
|
|
6420
|
-
outerStrength:
|
|
6421
|
-
innerStrength:
|
|
6718
|
+
const e = parseInt(s.color.replace("#", "0x"), 16), t = new Xt({
|
|
6719
|
+
distance: s.distance || 10,
|
|
6720
|
+
outerStrength: s.outerStrength || 4,
|
|
6721
|
+
innerStrength: s.innerStrength || 0,
|
|
6422
6722
|
color: e,
|
|
6423
|
-
alpha:
|
|
6424
|
-
quality:
|
|
6425
|
-
knockout:
|
|
6723
|
+
alpha: s.alpha ?? 1,
|
|
6724
|
+
quality: s.quality || 0.1,
|
|
6725
|
+
knockout: s.knockout || !1
|
|
6426
6726
|
});
|
|
6427
6727
|
return t._customParams = {
|
|
6428
|
-
color:
|
|
6429
|
-
...
|
|
6430
|
-
}, t.updateUIParam = function(i,
|
|
6728
|
+
color: s.color || "#ffffff",
|
|
6729
|
+
...s
|
|
6730
|
+
}, t.updateUIParam = function(i, r) {
|
|
6431
6731
|
try {
|
|
6432
6732
|
const a = this._customParams || {};
|
|
6433
|
-
switch (this._customParams = a, a[i] =
|
|
6733
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
6434
6734
|
case "distance":
|
|
6435
|
-
this.distance = Number(
|
|
6735
|
+
this.distance = Number(r);
|
|
6436
6736
|
break;
|
|
6437
6737
|
case "outerStrength":
|
|
6438
|
-
this.outerStrength = Number(
|
|
6738
|
+
this.outerStrength = Number(r);
|
|
6439
6739
|
break;
|
|
6440
6740
|
case "innerStrength":
|
|
6441
|
-
this.innerStrength = Number(
|
|
6741
|
+
this.innerStrength = Number(r);
|
|
6442
6742
|
break;
|
|
6443
6743
|
case "color":
|
|
6444
|
-
a.color =
|
|
6744
|
+
a.color = r, this.color = parseInt(r.replace("#", "0x"), 16);
|
|
6445
6745
|
break;
|
|
6446
6746
|
case "alpha":
|
|
6447
|
-
this.alpha = Number(
|
|
6747
|
+
this.alpha = Number(r);
|
|
6448
6748
|
break;
|
|
6449
6749
|
case "quality":
|
|
6450
|
-
this.quality = Number(
|
|
6750
|
+
this.quality = Number(r);
|
|
6451
6751
|
break;
|
|
6452
6752
|
case "knockout":
|
|
6453
|
-
this.knockout = !!
|
|
6753
|
+
this.knockout = !!r;
|
|
6454
6754
|
break;
|
|
6455
6755
|
default:
|
|
6456
|
-
i in this && (this[i] =
|
|
6756
|
+
i in this && (this[i] = r);
|
|
6457
6757
|
break;
|
|
6458
6758
|
}
|
|
6459
6759
|
} catch {
|
|
@@ -6541,35 +6841,35 @@ f({
|
|
|
6541
6841
|
}
|
|
6542
6842
|
]
|
|
6543
6843
|
});
|
|
6544
|
-
const { GodrayFilter:
|
|
6844
|
+
const { GodrayFilter: Yt } = g;
|
|
6545
6845
|
f({
|
|
6546
6846
|
id: "godray",
|
|
6547
6847
|
name: "Godray",
|
|
6548
6848
|
category: "light",
|
|
6549
6849
|
description: "Creates volumetric light-ray effects (crepuscular rays)",
|
|
6550
6850
|
// Create an instance of the GodrayFilter with the provided parameters
|
|
6551
|
-
createFilter: (
|
|
6851
|
+
createFilter: (s) => {
|
|
6552
6852
|
try {
|
|
6553
|
-
const e = new
|
|
6554
|
-
angle:
|
|
6555
|
-
parallel:
|
|
6853
|
+
const e = new Yt({
|
|
6854
|
+
angle: s.angle || 30,
|
|
6855
|
+
parallel: s.parallel ?? !0,
|
|
6556
6856
|
center: {
|
|
6557
|
-
x:
|
|
6558
|
-
y:
|
|
6857
|
+
x: s.centerX || 0,
|
|
6858
|
+
y: s.centerY || 0
|
|
6559
6859
|
},
|
|
6560
|
-
gain:
|
|
6561
|
-
lacunarity:
|
|
6562
|
-
time:
|
|
6563
|
-
alpha:
|
|
6860
|
+
gain: s.gain || 0.5,
|
|
6861
|
+
lacunarity: s.lacunarity || 2.5,
|
|
6862
|
+
time: s.time || 0,
|
|
6863
|
+
alpha: s.alpha || 1
|
|
6564
6864
|
});
|
|
6565
6865
|
return e._customParams = {
|
|
6566
|
-
centerX:
|
|
6567
|
-
centerY:
|
|
6568
|
-
...
|
|
6866
|
+
centerX: s.centerX || 0,
|
|
6867
|
+
centerY: s.centerY || 0,
|
|
6868
|
+
...s
|
|
6569
6869
|
}, e.updateUIParam = function(t, i) {
|
|
6570
6870
|
try {
|
|
6571
|
-
const
|
|
6572
|
-
switch (this._customParams =
|
|
6871
|
+
const r = this._customParams || {};
|
|
6872
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
6573
6873
|
case "angle":
|
|
6574
6874
|
this.angle = Number(i);
|
|
6575
6875
|
break;
|
|
@@ -6577,14 +6877,14 @@ f({
|
|
|
6577
6877
|
this.parallel = !!i;
|
|
6578
6878
|
break;
|
|
6579
6879
|
case "centerX":
|
|
6580
|
-
|
|
6880
|
+
r.centerX = Number(i), this.center = {
|
|
6581
6881
|
x: Number(i),
|
|
6582
|
-
y:
|
|
6882
|
+
y: r.centerY
|
|
6583
6883
|
};
|
|
6584
6884
|
break;
|
|
6585
6885
|
case "centerY":
|
|
6586
|
-
|
|
6587
|
-
x:
|
|
6886
|
+
r.centerY = Number(i), this.center = {
|
|
6887
|
+
x: r.centerX,
|
|
6588
6888
|
y: Number(i)
|
|
6589
6889
|
};
|
|
6590
6890
|
break;
|
|
@@ -6703,18 +7003,18 @@ f({
|
|
|
6703
7003
|
}
|
|
6704
7004
|
]
|
|
6705
7005
|
});
|
|
6706
|
-
const
|
|
7006
|
+
const Bt = g.SimpleLightmapFilter, oe = w.Texture;
|
|
6707
7007
|
f({
|
|
6708
7008
|
id: "lightmap",
|
|
6709
7009
|
name: "Lightmap",
|
|
6710
7010
|
category: "light",
|
|
6711
7011
|
description: "Applies lighting effects using a reference texture as a light map",
|
|
6712
7012
|
// Create an instance of the SimpleLightmapFilter with the provided parameters
|
|
6713
|
-
createFilter: (
|
|
7013
|
+
createFilter: (s) => {
|
|
6714
7014
|
try {
|
|
6715
|
-
const e =
|
|
6716
|
-
|
|
6717
|
-
const a =
|
|
7015
|
+
const e = s.textureType || "default", t = s.color || "#000000", i = typeof s.alpha == "number" ? s.alpha : 1, r = document.createElement("canvas");
|
|
7016
|
+
r.width = 256, r.height = 256;
|
|
7017
|
+
const a = r.getContext("2d");
|
|
6718
7018
|
if (!a)
|
|
6719
7019
|
throw new Error("Canvas 2D context not available");
|
|
6720
7020
|
if (e === "spotlight") {
|
|
@@ -6728,14 +7028,14 @@ f({
|
|
|
6728
7028
|
const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
6729
7029
|
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);
|
|
6730
7030
|
}
|
|
6731
|
-
const o =
|
|
7031
|
+
const o = oe.from(r);
|
|
6732
7032
|
let n;
|
|
6733
7033
|
try {
|
|
6734
7034
|
typeof t == "string" && t.startsWith("#") ? n = parseInt(t.replace("#", "0x"), 16) : n = 0;
|
|
6735
7035
|
} catch {
|
|
6736
7036
|
n = 0;
|
|
6737
7037
|
}
|
|
6738
|
-
const l = new
|
|
7038
|
+
const l = new Bt(o, n, i);
|
|
6739
7039
|
return l._customParams = {
|
|
6740
7040
|
textureType: e,
|
|
6741
7041
|
color: t,
|
|
@@ -6761,8 +7061,8 @@ f({
|
|
|
6761
7061
|
const b = m.createRadialGradient(128, 128, 10, 128, 128, 160);
|
|
6762
7062
|
b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.6, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "black"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
|
|
6763
7063
|
}
|
|
6764
|
-
const
|
|
6765
|
-
if (this.lightMap =
|
|
7064
|
+
const C = oe.from(p);
|
|
7065
|
+
if (this.lightMap = C, this.enabled !== void 0) {
|
|
6766
7066
|
const b = this.enabled;
|
|
6767
7067
|
this.enabled = !1, setTimeout(() => {
|
|
6768
7068
|
this.enabled = b;
|
|
@@ -6834,28 +7134,28 @@ f({
|
|
|
6834
7134
|
}
|
|
6835
7135
|
]
|
|
6836
7136
|
});
|
|
6837
|
-
const { NoiseFilter:
|
|
7137
|
+
const { NoiseFilter: Ot } = w;
|
|
6838
7138
|
f({
|
|
6839
7139
|
id: "noise",
|
|
6840
7140
|
name: "Noise",
|
|
6841
7141
|
category: "effects",
|
|
6842
7142
|
description: "Add random noise to the image",
|
|
6843
|
-
createFilter: (
|
|
7143
|
+
createFilter: (s) => {
|
|
6844
7144
|
try {
|
|
6845
|
-
const e = new
|
|
6846
|
-
noise:
|
|
6847
|
-
seed:
|
|
7145
|
+
const e = new Ot({
|
|
7146
|
+
noise: s.noise || 0.5,
|
|
7147
|
+
seed: s.seed || Math.random()
|
|
6848
7148
|
});
|
|
6849
|
-
e.animating =
|
|
7149
|
+
e.animating = s.animating || !1, e._customParams = { ...s };
|
|
6850
7150
|
let t = null;
|
|
6851
7151
|
const i = () => {
|
|
6852
7152
|
e.animating && (e.seed = Math.random()), t = requestAnimationFrame(i);
|
|
6853
7153
|
};
|
|
6854
7154
|
return e.animating && (t = requestAnimationFrame(i)), e._stopAnimation = () => {
|
|
6855
7155
|
t !== null && (cancelAnimationFrame(t), t = null);
|
|
6856
|
-
}, e.updateUIParam = function(
|
|
7156
|
+
}, e.updateUIParam = function(r, a) {
|
|
6857
7157
|
const o = this._customParams || {};
|
|
6858
|
-
switch (this._customParams = o, o[
|
|
7158
|
+
switch (this._customParams = o, o[r] = a, r) {
|
|
6859
7159
|
case "animating":
|
|
6860
7160
|
this.animating = a, a && !t && (t = requestAnimationFrame(i));
|
|
6861
7161
|
break;
|
|
@@ -6869,7 +7169,7 @@ f({
|
|
|
6869
7169
|
a && (this.seed = Math.random());
|
|
6870
7170
|
break;
|
|
6871
7171
|
default:
|
|
6872
|
-
|
|
7172
|
+
r in this && (this[r] = a);
|
|
6873
7173
|
break;
|
|
6874
7174
|
}
|
|
6875
7175
|
}, e;
|
|
@@ -6919,36 +7219,36 @@ f({
|
|
|
6919
7219
|
}
|
|
6920
7220
|
]
|
|
6921
7221
|
});
|
|
6922
|
-
const { OldFilmFilter:
|
|
7222
|
+
const { OldFilmFilter: Lt } = g;
|
|
6923
7223
|
f({
|
|
6924
7224
|
id: "old-film",
|
|
6925
7225
|
name: "Old Film",
|
|
6926
7226
|
category: "effects",
|
|
6927
7227
|
description: "Apply a vintage film effect with scratches and grain",
|
|
6928
|
-
createFilter: (
|
|
7228
|
+
createFilter: (s) => {
|
|
6929
7229
|
try {
|
|
6930
|
-
const e = new
|
|
6931
|
-
sepia:
|
|
6932
|
-
noise:
|
|
6933
|
-
noiseSize:
|
|
6934
|
-
scratch:
|
|
6935
|
-
scratchDensity:
|
|
6936
|
-
scratchWidth:
|
|
6937
|
-
vignetting:
|
|
6938
|
-
vignettingAlpha:
|
|
6939
|
-
vignettingBlur:
|
|
6940
|
-
seed:
|
|
7230
|
+
const e = new Lt({
|
|
7231
|
+
sepia: s.sepia,
|
|
7232
|
+
noise: s.noise,
|
|
7233
|
+
noiseSize: s.noiseSize,
|
|
7234
|
+
scratch: s.scratch,
|
|
7235
|
+
scratchDensity: s.scratchDensity,
|
|
7236
|
+
scratchWidth: s.scratchWidth,
|
|
7237
|
+
vignetting: s.vignetting,
|
|
7238
|
+
vignettingAlpha: s.vignettingAlpha,
|
|
7239
|
+
vignettingBlur: s.vignettingBlur,
|
|
7240
|
+
seed: s.seed || Math.random()
|
|
6941
7241
|
});
|
|
6942
|
-
e.animating =
|
|
7242
|
+
e.animating = s.animating || !1, e._customParams = { ...s };
|
|
6943
7243
|
let t = null;
|
|
6944
7244
|
const i = () => {
|
|
6945
7245
|
e.animating && (e.seed = Math.random()), t = requestAnimationFrame(i);
|
|
6946
7246
|
};
|
|
6947
7247
|
return e.animating && (t = requestAnimationFrame(i)), e._stopAnimation = () => {
|
|
6948
7248
|
t !== null && (cancelAnimationFrame(t), t = null);
|
|
6949
|
-
}, e.updateUIParam = function(
|
|
7249
|
+
}, e.updateUIParam = function(r, a) {
|
|
6950
7250
|
const o = this._customParams || {};
|
|
6951
|
-
switch (this._customParams = o, o[
|
|
7251
|
+
switch (this._customParams = o, o[r] = a, r) {
|
|
6952
7252
|
case "animating":
|
|
6953
7253
|
this.animating = a, a && !t && (t = requestAnimationFrame(i));
|
|
6954
7254
|
break;
|
|
@@ -6967,10 +7267,10 @@ f({
|
|
|
6967
7267
|
case "vignetting":
|
|
6968
7268
|
case "vignettingAlpha":
|
|
6969
7269
|
case "vignettingBlur":
|
|
6970
|
-
|
|
7270
|
+
r in this && (this[r] = a);
|
|
6971
7271
|
break;
|
|
6972
7272
|
default:
|
|
6973
|
-
|
|
7273
|
+
r in this && (this[r] = a);
|
|
6974
7274
|
break;
|
|
6975
7275
|
}
|
|
6976
7276
|
}, e;
|
|
@@ -7108,43 +7408,43 @@ f({
|
|
|
7108
7408
|
}
|
|
7109
7409
|
]
|
|
7110
7410
|
});
|
|
7111
|
-
const { OutlineFilter:
|
|
7411
|
+
const { OutlineFilter: Dt } = g;
|
|
7112
7412
|
f({
|
|
7113
7413
|
id: "outline",
|
|
7114
7414
|
name: "Outline",
|
|
7115
7415
|
category: "effects",
|
|
7116
7416
|
description: "Add an outline or stroke around the image",
|
|
7117
|
-
createFilter: (
|
|
7417
|
+
createFilter: (s) => {
|
|
7118
7418
|
try {
|
|
7119
|
-
let e =
|
|
7419
|
+
let e = s.color;
|
|
7120
7420
|
typeof e == "string" && (e = parseInt(e.replace("#", "0x"), 16));
|
|
7121
|
-
const t = new
|
|
7122
|
-
thickness:
|
|
7421
|
+
const t = new Dt({
|
|
7422
|
+
thickness: s.thickness || 4,
|
|
7123
7423
|
color: e,
|
|
7124
|
-
alpha:
|
|
7125
|
-
quality:
|
|
7126
|
-
knockout:
|
|
7424
|
+
alpha: s.alpha || 1,
|
|
7425
|
+
quality: s.quality || 0.1,
|
|
7426
|
+
knockout: s.knockout || !1
|
|
7127
7427
|
});
|
|
7128
|
-
return t._customParams = { ...
|
|
7428
|
+
return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
|
|
7129
7429
|
const a = this._customParams || {};
|
|
7130
|
-
switch (this._customParams = a, a[i] =
|
|
7430
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
7131
7431
|
case "thickness":
|
|
7132
|
-
this.thickness = Math.max(0,
|
|
7432
|
+
this.thickness = Math.max(0, r);
|
|
7133
7433
|
break;
|
|
7134
7434
|
case "color":
|
|
7135
|
-
typeof
|
|
7435
|
+
typeof r == "string" ? (this.color = parseInt(r.replace("#", "0x"), 16), a.color = r) : this.color = r;
|
|
7136
7436
|
break;
|
|
7137
7437
|
case "alpha":
|
|
7138
|
-
this.alpha = Math.max(0, Math.min(1,
|
|
7438
|
+
this.alpha = Math.max(0, Math.min(1, r));
|
|
7139
7439
|
break;
|
|
7140
7440
|
case "quality":
|
|
7141
|
-
this.quality = Math.max(0.01, Math.min(1,
|
|
7441
|
+
this.quality = Math.max(0.01, Math.min(1, r));
|
|
7142
7442
|
break;
|
|
7143
7443
|
case "knockout":
|
|
7144
|
-
this.knockout = !!
|
|
7444
|
+
this.knockout = !!r;
|
|
7145
7445
|
break;
|
|
7146
7446
|
default:
|
|
7147
|
-
i in this && (this[i] =
|
|
7447
|
+
i in this && (this[i] = r);
|
|
7148
7448
|
break;
|
|
7149
7449
|
}
|
|
7150
7450
|
}, t;
|
|
@@ -7208,37 +7508,37 @@ f({
|
|
|
7208
7508
|
}
|
|
7209
7509
|
]
|
|
7210
7510
|
});
|
|
7211
|
-
const { PixelateFilter:
|
|
7511
|
+
const { PixelateFilter: Ut } = g;
|
|
7212
7512
|
f({
|
|
7213
7513
|
id: "pixelate",
|
|
7214
7514
|
name: "Pixelate",
|
|
7215
7515
|
category: "effects",
|
|
7216
7516
|
description: "Create a pixelated or mosaic effect",
|
|
7217
|
-
createFilter: (
|
|
7517
|
+
createFilter: (s) => {
|
|
7218
7518
|
try {
|
|
7219
|
-
const e = new
|
|
7220
|
-
|
|
7519
|
+
const e = new Ut(
|
|
7520
|
+
s.useUniform ? Math.max(4, s.size || 10) : [Math.max(4, s.sizeX || 10), Math.max(4, s.sizeY || 10)]
|
|
7221
7521
|
);
|
|
7222
|
-
return e._customParams = { ...
|
|
7223
|
-
const
|
|
7224
|
-
switch (this._customParams =
|
|
7522
|
+
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
7523
|
+
const r = this._customParams || {};
|
|
7524
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
7225
7525
|
case "useUniform":
|
|
7226
|
-
if (
|
|
7526
|
+
if (r.useUniform = i, i) {
|
|
7227
7527
|
const a = Math.round((this.sizeX + this.sizeY) / 2);
|
|
7228
|
-
this.size = Math.max(4, a),
|
|
7528
|
+
this.size = Math.max(4, a), r.size = a;
|
|
7229
7529
|
} else {
|
|
7230
7530
|
const a = Array.isArray(this.size) ? this.size[0] : this.size;
|
|
7231
|
-
this.sizeX = Math.max(4, a), this.sizeY = Math.max(4, a),
|
|
7531
|
+
this.sizeX = Math.max(4, a), this.sizeY = Math.max(4, a), r.sizeX = this.sizeX, r.sizeY = this.sizeY;
|
|
7232
7532
|
}
|
|
7233
7533
|
break;
|
|
7234
7534
|
case "size":
|
|
7235
|
-
|
|
7535
|
+
r.useUniform && (this.size = Math.max(4, i));
|
|
7236
7536
|
break;
|
|
7237
7537
|
case "sizeX":
|
|
7238
|
-
|
|
7538
|
+
r.useUniform || (this.sizeX = Math.max(4, i));
|
|
7239
7539
|
break;
|
|
7240
7540
|
case "sizeY":
|
|
7241
|
-
|
|
7541
|
+
r.useUniform || (this.sizeY = Math.max(4, i));
|
|
7242
7542
|
break;
|
|
7243
7543
|
default:
|
|
7244
7544
|
t in this && (this[t] = i);
|
|
@@ -7299,7 +7599,7 @@ f({
|
|
|
7299
7599
|
}
|
|
7300
7600
|
]
|
|
7301
7601
|
});
|
|
7302
|
-
const { ReflectionFilter:
|
|
7602
|
+
const { ReflectionFilter: Vt } = g;
|
|
7303
7603
|
f({
|
|
7304
7604
|
id: "reflection",
|
|
7305
7605
|
// ID must match what the application expects
|
|
@@ -7307,47 +7607,47 @@ f({
|
|
|
7307
7607
|
category: "distortion",
|
|
7308
7608
|
description: "Creates a water reflection effect with configurable waves",
|
|
7309
7609
|
// Create an instance of the ReflectionFilter with the provided parameters
|
|
7310
|
-
createFilter: (
|
|
7610
|
+
createFilter: (s) => {
|
|
7311
7611
|
try {
|
|
7312
7612
|
const e = {
|
|
7313
|
-
mirror:
|
|
7314
|
-
boundary:
|
|
7315
|
-
amplitude: new Float32Array([
|
|
7316
|
-
waveLength: new Float32Array([
|
|
7317
|
-
alpha: new Float32Array([
|
|
7318
|
-
time:
|
|
7319
|
-
}, t = new
|
|
7320
|
-
return t._customParams = { ...
|
|
7613
|
+
mirror: s.mirror ?? !0,
|
|
7614
|
+
boundary: s.boundary ?? 0.5,
|
|
7615
|
+
amplitude: new Float32Array([s.amplitudeStart ?? 0, s.amplitudeEnd ?? 20]),
|
|
7616
|
+
waveLength: new Float32Array([s.wavelengthStart ?? 30, s.wavelengthEnd ?? 100]),
|
|
7617
|
+
alpha: new Float32Array([s.alphaStart ?? 1, s.alphaEnd ?? 1]),
|
|
7618
|
+
time: s.time ?? 0
|
|
7619
|
+
}, t = new Vt(e);
|
|
7620
|
+
return t._customParams = { ...s }, t.animating = s.animating ?? !1, t.updateUIParam = function(i, r) {
|
|
7321
7621
|
const a = this._customParams || {};
|
|
7322
|
-
switch (this._customParams = a, a[i] =
|
|
7622
|
+
switch (this._customParams = a, a[i] = r, i) {
|
|
7323
7623
|
case "mirror":
|
|
7324
7624
|
case "boundary":
|
|
7325
7625
|
case "time":
|
|
7326
|
-
this[i] =
|
|
7626
|
+
this[i] = r;
|
|
7327
7627
|
break;
|
|
7328
7628
|
case "amplitudeStart":
|
|
7329
|
-
Array.isArray(this.amplitude) || (this.amplitude = [0, this._customParams.amplitudeEnd || 20]), this.amplitude[0] =
|
|
7629
|
+
Array.isArray(this.amplitude) || (this.amplitude = [0, this._customParams.amplitudeEnd || 20]), this.amplitude[0] = r;
|
|
7330
7630
|
break;
|
|
7331
7631
|
case "amplitudeEnd":
|
|
7332
|
-
Array.isArray(this.amplitude) || (this.amplitude = [this._customParams.amplitudeStart || 0, 20]), this.amplitude[1] =
|
|
7632
|
+
Array.isArray(this.amplitude) || (this.amplitude = [this._customParams.amplitudeStart || 0, 20]), this.amplitude[1] = r;
|
|
7333
7633
|
break;
|
|
7334
7634
|
case "wavelengthStart":
|
|
7335
|
-
Array.isArray(this.waveLength) || (this.waveLength = [30, this._customParams.wavelengthEnd || 100]), this.waveLength[0] =
|
|
7635
|
+
Array.isArray(this.waveLength) || (this.waveLength = [30, this._customParams.wavelengthEnd || 100]), this.waveLength[0] = r;
|
|
7336
7636
|
break;
|
|
7337
7637
|
case "wavelengthEnd":
|
|
7338
|
-
Array.isArray(this.waveLength) || (this.waveLength = [this._customParams.wavelengthStart || 30, 100]), this.waveLength[1] =
|
|
7638
|
+
Array.isArray(this.waveLength) || (this.waveLength = [this._customParams.wavelengthStart || 30, 100]), this.waveLength[1] = r;
|
|
7339
7639
|
break;
|
|
7340
7640
|
case "alphaStart":
|
|
7341
|
-
Array.isArray(this.alpha) || (this.alpha = [1, this._customParams.alphaEnd || 1]), this.alpha[0] =
|
|
7641
|
+
Array.isArray(this.alpha) || (this.alpha = [1, this._customParams.alphaEnd || 1]), this.alpha[0] = r;
|
|
7342
7642
|
break;
|
|
7343
7643
|
case "alphaEnd":
|
|
7344
|
-
Array.isArray(this.alpha) || (this.alpha = [this._customParams.alphaStart || 1, 1]), this.alpha[1] =
|
|
7644
|
+
Array.isArray(this.alpha) || (this.alpha = [this._customParams.alphaStart || 1, 1]), this.alpha[1] = r;
|
|
7345
7645
|
break;
|
|
7346
7646
|
case "animating":
|
|
7347
|
-
this.animating =
|
|
7647
|
+
this.animating = r;
|
|
7348
7648
|
break;
|
|
7349
7649
|
default:
|
|
7350
|
-
i in this && (this[i] =
|
|
7650
|
+
i in this && (this[i] = r);
|
|
7351
7651
|
break;
|
|
7352
7652
|
}
|
|
7353
7653
|
return !0;
|
|
@@ -7467,7 +7767,7 @@ f({
|
|
|
7467
7767
|
}
|
|
7468
7768
|
]
|
|
7469
7769
|
});
|
|
7470
|
-
const { ShockwaveFilter:
|
|
7770
|
+
const { ShockwaveFilter: jt } = g;
|
|
7471
7771
|
f({
|
|
7472
7772
|
id: "shockwave",
|
|
7473
7773
|
// ID must match what the application expects
|
|
@@ -7475,18 +7775,18 @@ f({
|
|
|
7475
7775
|
category: "distortion",
|
|
7476
7776
|
description: "Creates a rippling shockwave or blast wave effect",
|
|
7477
7777
|
// Create an instance of the ShockwaveFilter with the provided parameters
|
|
7478
|
-
createFilter: (
|
|
7778
|
+
createFilter: (s) => {
|
|
7479
7779
|
try {
|
|
7480
|
-
const e =
|
|
7780
|
+
const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0, d = new jt({
|
|
7481
7781
|
center: i,
|
|
7482
|
-
amplitude:
|
|
7782
|
+
amplitude: r,
|
|
7483
7783
|
wavelength: a,
|
|
7484
7784
|
speed: o,
|
|
7485
7785
|
brightness: n,
|
|
7486
7786
|
radius: l,
|
|
7487
7787
|
time: c
|
|
7488
7788
|
});
|
|
7489
|
-
return d._customParams = { ...
|
|
7789
|
+
return d._customParams = { ...s }, d.animating = s.animating ?? !1, d.updateUIParam = function(h, p) {
|
|
7490
7790
|
const m = this._customParams || {};
|
|
7491
7791
|
switch (this._customParams = m, m[h] = p, h) {
|
|
7492
7792
|
case "centerX":
|
|
@@ -7619,26 +7919,26 @@ f({
|
|
|
7619
7919
|
}
|
|
7620
7920
|
]
|
|
7621
7921
|
});
|
|
7622
|
-
const { SimplexNoiseFilter:
|
|
7922
|
+
const { SimplexNoiseFilter: qt } = g;
|
|
7623
7923
|
f({
|
|
7624
7924
|
id: "simplex-noise",
|
|
7625
7925
|
name: "Simplex Noise",
|
|
7626
7926
|
category: "effects",
|
|
7627
7927
|
description: "Apply procedural noise to create texture effects",
|
|
7628
|
-
createFilter: (
|
|
7928
|
+
createFilter: (s) => {
|
|
7629
7929
|
try {
|
|
7630
|
-
const e =
|
|
7631
|
-
strength:
|
|
7632
|
-
noiseScale:
|
|
7633
|
-
offsetX:
|
|
7634
|
-
offsetY:
|
|
7930
|
+
const e = s.animating ? 0 : s.offsetZ || 0, t = new qt({
|
|
7931
|
+
strength: s.strength,
|
|
7932
|
+
noiseScale: s.noiseScale,
|
|
7933
|
+
offsetX: s.offsetX,
|
|
7934
|
+
offsetY: s.offsetY,
|
|
7635
7935
|
offsetZ: e,
|
|
7636
|
-
step:
|
|
7936
|
+
step: s.step
|
|
7637
7937
|
});
|
|
7638
|
-
t.animating =
|
|
7639
|
-
let i = null,
|
|
7938
|
+
t.animating = s.animating || !1, t.animationSpeed = s.animationSpeed || 0.01, t._customParams = { ...s };
|
|
7939
|
+
let i = null, r = 0;
|
|
7640
7940
|
const a = () => {
|
|
7641
|
-
t.animating && (
|
|
7941
|
+
t.animating && (r += t.animationSpeed, t.offsetZ = r), i = requestAnimationFrame(a);
|
|
7642
7942
|
};
|
|
7643
7943
|
return t.animating && (i = requestAnimationFrame(a)), t._stopAnimation = () => {
|
|
7644
7944
|
i !== null && (cancelAnimationFrame(i), i = null);
|
|
@@ -7774,9 +8074,9 @@ f({
|
|
|
7774
8074
|
}
|
|
7775
8075
|
]
|
|
7776
8076
|
});
|
|
7777
|
-
class
|
|
8077
|
+
class Ht extends w.Filter {
|
|
7778
8078
|
constructor(e) {
|
|
7779
|
-
const t =
|
|
8079
|
+
const t = ye.from({
|
|
7780
8080
|
vertex: `
|
|
7781
8081
|
attribute vec2 aPosition;
|
|
7782
8082
|
varying vec2 vTextureCoord;
|
|
@@ -7883,15 +8183,15 @@ f({
|
|
|
7883
8183
|
name: "Twist",
|
|
7884
8184
|
category: "distortion",
|
|
7885
8185
|
description: "Creates a twisting distortion effect around a central point",
|
|
7886
|
-
createFilter: (
|
|
8186
|
+
createFilter: (s) => {
|
|
7887
8187
|
try {
|
|
7888
|
-
const e = new
|
|
7889
|
-
centerX:
|
|
7890
|
-
centerY:
|
|
7891
|
-
radius:
|
|
7892
|
-
angle:
|
|
8188
|
+
const e = new Ht({
|
|
8189
|
+
centerX: s.centerX ?? 0.5,
|
|
8190
|
+
centerY: s.centerY ?? 0.5,
|
|
8191
|
+
radius: s.radius ?? 0.25,
|
|
8192
|
+
angle: s.angle ?? 4
|
|
7893
8193
|
});
|
|
7894
|
-
return e._customParams = { ...
|
|
8194
|
+
return e._customParams = { ...s }, e;
|
|
7895
8195
|
} catch {
|
|
7896
8196
|
return null;
|
|
7897
8197
|
}
|
|
@@ -7955,23 +8255,23 @@ f({
|
|
|
7955
8255
|
}
|
|
7956
8256
|
]
|
|
7957
8257
|
});
|
|
7958
|
-
const { AdjustmentFilter:
|
|
7959
|
-
function
|
|
7960
|
-
const e = typeof
|
|
8258
|
+
const { AdjustmentFilter: $t } = g;
|
|
8259
|
+
function D(s) {
|
|
8260
|
+
const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
|
|
7961
8261
|
return [
|
|
7962
8262
|
(e >> 16 & 255) / 255,
|
|
7963
8263
|
(e >> 8 & 255) / 255,
|
|
7964
8264
|
(e & 255) / 255
|
|
7965
8265
|
];
|
|
7966
8266
|
}
|
|
7967
|
-
class
|
|
8267
|
+
class Wt extends $t {
|
|
7968
8268
|
constructor(e = {}) {
|
|
7969
8269
|
super({
|
|
7970
8270
|
brightness: 1,
|
|
7971
8271
|
contrast: 1,
|
|
7972
8272
|
saturation: 1,
|
|
7973
8273
|
alpha: 1
|
|
7974
|
-
}), 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 =
|
|
8274
|
+
}), 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 = D(e.color)) : (this._colorValue = "#" + e.color.toString(16).padStart(6, "0"), this._colorRgb = D(e.color))), this.updateVignette();
|
|
7975
8275
|
}
|
|
7976
8276
|
/**
|
|
7977
8277
|
* Updates the filter parameters to simulate a vignette effect
|
|
@@ -7997,7 +8297,7 @@ class qt extends jt {
|
|
|
7997
8297
|
return this._colorValue;
|
|
7998
8298
|
}
|
|
7999
8299
|
set color(e) {
|
|
8000
|
-
typeof e == "string" ? (this._colorValue = e, this._colorRgb =
|
|
8300
|
+
typeof e == "string" ? (this._colorValue = e, this._colorRgb = D(e)) : (this._colorValue = "#" + e.toString(16).padStart(6, "0"), this._colorRgb = D(e)), this.updateVignette();
|
|
8001
8301
|
}
|
|
8002
8302
|
}
|
|
8003
8303
|
f({
|
|
@@ -8005,16 +8305,16 @@ f({
|
|
|
8005
8305
|
name: "Vignette",
|
|
8006
8306
|
category: "effects",
|
|
8007
8307
|
description: "Add a classic darkened border effect to the image",
|
|
8008
|
-
createFilter: (
|
|
8308
|
+
createFilter: (s) => {
|
|
8009
8309
|
try {
|
|
8010
|
-
const e = new
|
|
8011
|
-
radius:
|
|
8012
|
-
strength:
|
|
8013
|
-
color:
|
|
8310
|
+
const e = new Wt({
|
|
8311
|
+
radius: s.radius || 0.8,
|
|
8312
|
+
strength: s.strength || 1,
|
|
8313
|
+
color: s.color || "#000000"
|
|
8014
8314
|
});
|
|
8015
|
-
return e._customParams = { ...
|
|
8016
|
-
const
|
|
8017
|
-
switch (this._customParams =
|
|
8315
|
+
return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
|
|
8316
|
+
const r = this._customParams || {};
|
|
8317
|
+
switch (this._customParams = r, r[t] = i, t) {
|
|
8018
8318
|
case "radius":
|
|
8019
8319
|
this.radius = Math.max(0.1, Math.min(1.5, i));
|
|
8020
8320
|
break;
|
|
@@ -8022,7 +8322,7 @@ f({
|
|
|
8022
8322
|
this.strength = Math.max(0, i);
|
|
8023
8323
|
break;
|
|
8024
8324
|
case "color":
|
|
8025
|
-
this.color = i, typeof i == "string" && (
|
|
8325
|
+
this.color = i, typeof i == "string" && (r.color = i);
|
|
8026
8326
|
break;
|
|
8027
8327
|
default:
|
|
8028
8328
|
t in this && (this[t] = i);
|
|
@@ -8071,22 +8371,22 @@ f({
|
|
|
8071
8371
|
}
|
|
8072
8372
|
]
|
|
8073
8373
|
});
|
|
8074
|
-
function
|
|
8374
|
+
function ei(s) {
|
|
8075
8375
|
try {
|
|
8076
8376
|
let e = [], t = [];
|
|
8077
8377
|
try {
|
|
8078
|
-
e = U(), e.length === 0 &&
|
|
8378
|
+
e = U(), e.length === 0 && et();
|
|
8079
8379
|
} catch {
|
|
8080
8380
|
}
|
|
8081
|
-
const i =
|
|
8381
|
+
const i = s == null ? void 0 : s.disabled;
|
|
8082
8382
|
if (Array.isArray(i) && i.length > 0) {
|
|
8083
|
-
let
|
|
8383
|
+
let r = 0;
|
|
8084
8384
|
for (const a of i)
|
|
8085
|
-
|
|
8086
|
-
|
|
8385
|
+
rt(a) && r++;
|
|
8386
|
+
r > 0;
|
|
8087
8387
|
}
|
|
8088
8388
|
try {
|
|
8089
|
-
e = U(), t =
|
|
8389
|
+
e = U(), t = it();
|
|
8090
8390
|
} catch {
|
|
8091
8391
|
e || (e = []), t || (t = []);
|
|
8092
8392
|
}
|
|
@@ -8096,16 +8396,16 @@ function Kt(r) {
|
|
|
8096
8396
|
}
|
|
8097
8397
|
}
|
|
8098
8398
|
export {
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8399
|
+
Kt as V,
|
|
8400
|
+
Je as a,
|
|
8401
|
+
tt as b,
|
|
8402
|
+
it as c,
|
|
8403
|
+
et as d,
|
|
8404
|
+
Jt as e,
|
|
8405
|
+
st as f,
|
|
8106
8406
|
U as g,
|
|
8107
|
-
|
|
8108
|
-
|
|
8407
|
+
Qt as h,
|
|
8408
|
+
ei as i,
|
|
8109
8409
|
f as r
|
|
8110
8410
|
};
|
|
8111
|
-
//# sourceMappingURL=editor-
|
|
8411
|
+
//# sourceMappingURL=editor-DrTmgu3R.js.map
|