@frybynite/image-cloud 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-cloud-auto-init.js +527 -299
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +462 -234
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +3 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +53 -0
- package/dist/react.d.ts +53 -0
- package/dist/react.js +462 -234
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +53 -0
- package/dist/vue.js +463 -235
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +53 -0
- package/dist/web-component.js +820 -592
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as Ht } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as kt, useRef as It, useImperativeHandle as Nt, useEffect as jt } from "react";
|
|
3
3
|
const mt = Object.freeze({
|
|
4
4
|
none: "none",
|
|
5
5
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
6
6
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
7
7
|
lg: "0 8px 32px rgba(0,0,0,0.5)",
|
|
8
8
|
glow: "0 0 30px rgba(255,255,255,0.6)"
|
|
9
|
-
}),
|
|
9
|
+
}), Rt = Object.freeze({
|
|
10
10
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
11
11
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
12
12
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
@@ -15,7 +15,7 @@ const mt = Object.freeze({
|
|
|
15
15
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
16
16
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
17
17
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
18
|
-
}),
|
|
18
|
+
}), At = Object.freeze({
|
|
19
19
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
20
20
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
21
21
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
@@ -54,16 +54,16 @@ const mt = Object.freeze({
|
|
|
54
54
|
})
|
|
55
55
|
}), Wt = Object.freeze({
|
|
56
56
|
tightness: 1
|
|
57
|
-
}),
|
|
57
|
+
}), Gt = Object.freeze({
|
|
58
58
|
rows: 1,
|
|
59
59
|
amplitude: 100,
|
|
60
60
|
frequency: 2,
|
|
61
61
|
phaseShift: 0,
|
|
62
62
|
synchronization: "offset"
|
|
63
63
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
64
|
-
}), Gt = Object.freeze({
|
|
65
|
-
spacing: 0
|
|
66
64
|
}), qt = Object.freeze({
|
|
65
|
+
spacing: 0
|
|
66
|
+
}), Bt = Object.freeze({
|
|
67
67
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
68
68
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
69
69
|
}), Xt = Object.freeze({
|
|
@@ -96,7 +96,7 @@ const mt = Object.freeze({
|
|
|
96
96
|
enabled: !1,
|
|
97
97
|
centers: !1,
|
|
98
98
|
loaders: !1
|
|
99
|
-
}), E = Object.freeze({
|
|
99
|
+
}), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), E = Object.freeze({
|
|
100
100
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
101
101
|
loaders: [],
|
|
102
102
|
// Shared loader settings and debug config
|
|
@@ -111,7 +111,7 @@ const mt = Object.freeze({
|
|
|
111
111
|
algorithm: "radial",
|
|
112
112
|
scaleDecay: 0,
|
|
113
113
|
// No decay by default (0-1 for radial/spiral)
|
|
114
|
-
responsive:
|
|
114
|
+
responsive: Bt,
|
|
115
115
|
targetCoverage: 0.6,
|
|
116
116
|
// Target 60% of container area
|
|
117
117
|
densityFactor: 1,
|
|
@@ -170,7 +170,8 @@ const mt = Object.freeze({
|
|
|
170
170
|
path: yt,
|
|
171
171
|
rotation: vt,
|
|
172
172
|
scale: wt
|
|
173
|
-
})
|
|
173
|
+
}),
|
|
174
|
+
idle: $t
|
|
174
175
|
}),
|
|
175
176
|
// Pattern-based interaction configuration
|
|
176
177
|
interaction: Object.freeze({
|
|
@@ -222,7 +223,7 @@ function Z(o, t) {
|
|
|
222
223
|
const i = { ...o };
|
|
223
224
|
return t.border !== void 0 && (i.border = { ...o.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...o.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...o.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...o.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...o.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...o.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...o.outline, ...t.outline }), t.shadow !== void 0 && (i.shadow = t.shadow), t.clipPath !== void 0 && (i.clipPath = t.clipPath), t.opacity !== void 0 && (i.opacity = t.opacity), t.cursor !== void 0 && (i.cursor = t.cursor), t.className !== void 0 && (i.className = t.className), t.objectFit !== void 0 && (i.objectFit = t.objectFit), t.aspectRatio !== void 0 && (i.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (i.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (i.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (i.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (i.borderRadiusBottomLeft = t.borderRadiusBottomLeft), i;
|
|
224
225
|
}
|
|
225
|
-
function
|
|
226
|
+
function Qt(o, t) {
|
|
226
227
|
if (!t) return { ...o };
|
|
227
228
|
const i = Z(o.default, t.default), e = Z(
|
|
228
229
|
Z(i, o.hover),
|
|
@@ -237,7 +238,7 @@ function Bt(o, t) {
|
|
|
237
238
|
focused: n
|
|
238
239
|
};
|
|
239
240
|
}
|
|
240
|
-
function
|
|
241
|
+
function te(o, t) {
|
|
241
242
|
if (!t) return { ...o };
|
|
242
243
|
const i = { ...o };
|
|
243
244
|
if (t.sizing !== void 0 && (i.sizing = {
|
|
@@ -256,7 +257,7 @@ function Vt(o, t) {
|
|
|
256
257
|
}
|
|
257
258
|
return i;
|
|
258
259
|
}
|
|
259
|
-
function
|
|
260
|
+
function ee(o) {
|
|
260
261
|
const t = o.layout?.rotation;
|
|
261
262
|
if (t && "enabled" in t)
|
|
262
263
|
return {
|
|
@@ -266,7 +267,7 @@ function Jt(o) {
|
|
|
266
267
|
}
|
|
267
268
|
};
|
|
268
269
|
}
|
|
269
|
-
function
|
|
270
|
+
function ie(o) {
|
|
270
271
|
const t = o.layout?.sizing?.variance;
|
|
271
272
|
if (t)
|
|
272
273
|
return {
|
|
@@ -277,8 +278,8 @@ function Kt(o) {
|
|
|
277
278
|
}
|
|
278
279
|
};
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
-
const t =
|
|
281
|
+
function ne(o = {}) {
|
|
282
|
+
const t = ee(o), i = ie(o);
|
|
282
283
|
let e = o.image;
|
|
283
284
|
(t || i) && (e = {
|
|
284
285
|
...i || {},
|
|
@@ -302,12 +303,12 @@ function Zt(o = {}) {
|
|
|
302
303
|
}, s = {
|
|
303
304
|
loaders: n,
|
|
304
305
|
config: r,
|
|
305
|
-
image:
|
|
306
|
+
image: te(zt, e),
|
|
306
307
|
layout: { ...E.layout },
|
|
307
308
|
animation: { ...E.animation },
|
|
308
309
|
interaction: { ...E.interaction },
|
|
309
310
|
rendering: { ...E.rendering },
|
|
310
|
-
styling:
|
|
311
|
+
styling: Qt(Ft, o.styling)
|
|
311
312
|
};
|
|
312
313
|
if (o.layout && (s.layout = {
|
|
313
314
|
...E.layout,
|
|
@@ -343,6 +344,9 @@ function Zt(o = {}) {
|
|
|
343
344
|
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : E.animation.entry.path,
|
|
344
345
|
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : E.animation.entry.rotation,
|
|
345
346
|
scale: o.animation.entry.scale ? { ...wt, ...o.animation.entry.scale } : E.animation.entry.scale
|
|
347
|
+
}), o.animation.idle && (s.animation.idle = {
|
|
348
|
+
...$t,
|
|
349
|
+
...o.animation.idle
|
|
346
350
|
})), o.interaction && (s.interaction = {
|
|
347
351
|
...E.interaction,
|
|
348
352
|
...o.interaction
|
|
@@ -380,16 +384,16 @@ function Zt(o = {}) {
|
|
|
380
384
|
}
|
|
381
385
|
return s;
|
|
382
386
|
}
|
|
383
|
-
function
|
|
384
|
-
return { ...o ?
|
|
387
|
+
function oe(o, t) {
|
|
388
|
+
return { ...o ? Rt[o] : Rt.playful, ...t };
|
|
385
389
|
}
|
|
386
|
-
function
|
|
390
|
+
function se(o, t) {
|
|
387
391
|
return { ...o ? Tt[o] : Tt.gentle, ...t };
|
|
388
392
|
}
|
|
389
|
-
function
|
|
390
|
-
return { ...o ?
|
|
393
|
+
function ae(o, t) {
|
|
394
|
+
return { ...o ? At[o] : At.gentle, ...t };
|
|
391
395
|
}
|
|
392
|
-
class
|
|
396
|
+
class re {
|
|
393
397
|
constructor(t) {
|
|
394
398
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
395
399
|
}
|
|
@@ -548,8 +552,8 @@ class ie {
|
|
|
548
552
|
function J(o, t, i) {
|
|
549
553
|
return o + (t - o) * i;
|
|
550
554
|
}
|
|
551
|
-
function
|
|
552
|
-
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l =
|
|
555
|
+
function ce(o, t, i, e) {
|
|
556
|
+
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l = le(a, r);
|
|
553
557
|
let u = 0, h = 0, d = 1, f = n, b = !1;
|
|
554
558
|
for (let g = 0; g < l.length; g++)
|
|
555
559
|
if (o <= l[g].time) {
|
|
@@ -558,21 +562,21 @@ function oe(o, t, i, e) {
|
|
|
558
562
|
}
|
|
559
563
|
const p = (o - h) / (d - h);
|
|
560
564
|
if (b)
|
|
561
|
-
u = 1 + f *
|
|
565
|
+
u = 1 + f * ot(p);
|
|
562
566
|
else if (h === 0)
|
|
563
|
-
u =
|
|
567
|
+
u = ot(p);
|
|
564
568
|
else {
|
|
565
569
|
const m = 1 + (l.find(
|
|
566
570
|
(y, w) => y.time > h && w > 0 && l[w - 1].isOvershoot
|
|
567
571
|
)?.overshoot || f);
|
|
568
|
-
u = J(m, 1,
|
|
572
|
+
u = J(m, 1, ot(p));
|
|
569
573
|
}
|
|
570
574
|
return {
|
|
571
575
|
x: t.x + s * u,
|
|
572
576
|
y: t.y + c * u
|
|
573
577
|
};
|
|
574
578
|
}
|
|
575
|
-
function
|
|
579
|
+
function le(o, t) {
|
|
576
580
|
const i = [];
|
|
577
581
|
let e = 0.6;
|
|
578
582
|
i.push({ time: e, overshoot: 0, isOvershoot: !1 });
|
|
@@ -582,7 +586,7 @@ function ne(o, t) {
|
|
|
582
586
|
e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
|
|
583
587
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
584
588
|
}
|
|
585
|
-
function
|
|
589
|
+
function he(o, t, i, e) {
|
|
586
590
|
const { stiffness: n, damping: a, mass: r, oscillations: s } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = a / (2 * Math.sqrt(n * r));
|
|
587
591
|
let d;
|
|
588
592
|
if (h < 1) {
|
|
@@ -595,24 +599,24 @@ function se(o, t, i, e) {
|
|
|
595
599
|
y: t.y + l * d
|
|
596
600
|
};
|
|
597
601
|
}
|
|
598
|
-
function
|
|
599
|
-
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? l / h : 1, b = a * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(b) * p, m =
|
|
602
|
+
function de(o, t, i, e) {
|
|
603
|
+
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? l / h : 1, b = a * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(b) * p, m = ue(o);
|
|
600
604
|
return {
|
|
601
605
|
x: J(t.x, i.x, m) + g * d,
|
|
602
606
|
y: J(t.y, i.y, m) + g * f
|
|
603
607
|
};
|
|
604
608
|
}
|
|
605
|
-
function
|
|
609
|
+
function ot(o) {
|
|
606
610
|
return 1 - (1 - o) * (1 - o);
|
|
607
611
|
}
|
|
608
|
-
function
|
|
612
|
+
function ue(o) {
|
|
609
613
|
return 1 - Math.pow(1 - o, 3);
|
|
610
614
|
}
|
|
611
|
-
function
|
|
615
|
+
function ge(o, t, i) {
|
|
612
616
|
const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, c = e * r * s;
|
|
613
617
|
return t + c;
|
|
614
618
|
}
|
|
615
|
-
function
|
|
619
|
+
function fe(o, t, i) {
|
|
616
620
|
const { overshoot: e, bounces: n } = i, a = [];
|
|
617
621
|
a.push({ time: 0.5, scale: e });
|
|
618
622
|
let r = e;
|
|
@@ -626,13 +630,13 @@ function le(o, t, i) {
|
|
|
626
630
|
let h = 1;
|
|
627
631
|
for (let d = 0; d < a.length; d++)
|
|
628
632
|
if (o <= a[d].time) {
|
|
629
|
-
const f = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (o - f) / (a[d].time - f), g =
|
|
633
|
+
const f = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (o - f) / (a[d].time - f), g = ot(p);
|
|
630
634
|
h = b + (a[d].scale - b) * g;
|
|
631
635
|
break;
|
|
632
636
|
}
|
|
633
637
|
return h * t;
|
|
634
638
|
}
|
|
635
|
-
function
|
|
639
|
+
function me(o) {
|
|
636
640
|
const {
|
|
637
641
|
element: t,
|
|
638
642
|
startPosition: i,
|
|
@@ -648,38 +652,38 @@ function he(o) {
|
|
|
648
652
|
startRotation: d,
|
|
649
653
|
scaleConfig: f,
|
|
650
654
|
startScale: b
|
|
651
|
-
} = o, p = n.type, g = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = b !== void 0 && b !== l,
|
|
652
|
-
if ((p === "linear" || p === "arc") && !w && !(v ||
|
|
655
|
+
} = o, p = n.type, g = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = b !== void 0 && b !== l, I = f?.mode === "pop", x = f?.pop || { overshoot: 1.2, bounces: 1 };
|
|
656
|
+
if ((p === "linear" || p === "arc") && !w && !(v || I)) {
|
|
653
657
|
u && u();
|
|
654
658
|
return;
|
|
655
659
|
}
|
|
656
660
|
const z = performance.now(), L = -r / 2, _ = -s / 2;
|
|
657
661
|
function O(H) {
|
|
658
|
-
const
|
|
662
|
+
const k = H - z, T = Math.min(k / a, 1);
|
|
659
663
|
let D;
|
|
660
664
|
switch (p) {
|
|
661
665
|
case "bounce": {
|
|
662
|
-
const
|
|
666
|
+
const N = oe(
|
|
663
667
|
n.bouncePreset,
|
|
664
668
|
n.bounce
|
|
665
669
|
);
|
|
666
|
-
D =
|
|
670
|
+
D = ce(T, i, e, N);
|
|
667
671
|
break;
|
|
668
672
|
}
|
|
669
673
|
case "elastic": {
|
|
670
|
-
const
|
|
674
|
+
const N = se(
|
|
671
675
|
n.elasticPreset,
|
|
672
676
|
n.elastic
|
|
673
677
|
);
|
|
674
|
-
D =
|
|
678
|
+
D = he(T, i, e, N);
|
|
675
679
|
break;
|
|
676
680
|
}
|
|
677
681
|
case "wave": {
|
|
678
|
-
const
|
|
682
|
+
const N = ae(
|
|
679
683
|
n.wavePreset,
|
|
680
684
|
n.wave
|
|
681
685
|
);
|
|
682
|
-
D =
|
|
686
|
+
D = de(T, i, e, N);
|
|
683
687
|
break;
|
|
684
688
|
}
|
|
685
689
|
default:
|
|
@@ -690,16 +694,16 @@ function he(o) {
|
|
|
690
694
|
}
|
|
691
695
|
const G = D.x - e.x, U = D.y - e.y;
|
|
692
696
|
let M;
|
|
693
|
-
m ? M =
|
|
694
|
-
let
|
|
695
|
-
|
|
697
|
+
m ? M = ge(T, c, y) : g ? M = J(d, c, T) : M = c;
|
|
698
|
+
let A;
|
|
699
|
+
I ? A = fe(T, l, x) : v ? A = J(b, l, T) : A = l, t.style.transform = `translate(${L}px, ${_}px) translate(${G}px, ${U}px) rotate(${M}deg) scale(${A})`, T < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
|
|
696
700
|
}
|
|
697
701
|
requestAnimationFrame(O);
|
|
698
702
|
}
|
|
699
|
-
function
|
|
703
|
+
function pe(o) {
|
|
700
704
|
return o === "bounce" || o === "elastic" || o === "wave";
|
|
701
705
|
}
|
|
702
|
-
const
|
|
706
|
+
const be = {
|
|
703
707
|
radial: "center",
|
|
704
708
|
spiral: "center",
|
|
705
709
|
grid: "top",
|
|
@@ -708,7 +712,7 @@ const ue = {
|
|
|
708
712
|
wave: "left",
|
|
709
713
|
honeycomb: "center"
|
|
710
714
|
};
|
|
711
|
-
class
|
|
715
|
+
class ye {
|
|
712
716
|
constructor(t, i) {
|
|
713
717
|
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || wt;
|
|
714
718
|
}
|
|
@@ -716,7 +720,7 @@ class ge {
|
|
|
716
720
|
* Get the effective start position, considering layout-aware defaults
|
|
717
721
|
*/
|
|
718
722
|
resolveStartPosition() {
|
|
719
|
-
return this.config.start.position ? this.config.start.position :
|
|
723
|
+
return this.config.start.position ? this.config.start.position : be[this.layoutAlgorithm] || "nearest-edge";
|
|
720
724
|
}
|
|
721
725
|
/**
|
|
722
726
|
* Calculate the starting position for an image's entry animation
|
|
@@ -861,7 +865,7 @@ class ge {
|
|
|
861
865
|
* Check if the current path type requires JavaScript animation
|
|
862
866
|
*/
|
|
863
867
|
requiresJSAnimation() {
|
|
864
|
-
return
|
|
868
|
+
return pe(this.pathConfig.type);
|
|
865
869
|
}
|
|
866
870
|
/**
|
|
867
871
|
* Get the path configuration
|
|
@@ -1052,7 +1056,193 @@ class ge {
|
|
|
1052
1056
|
return 1 - (1 - t) * (1 - t);
|
|
1053
1057
|
}
|
|
1054
1058
|
}
|
|
1055
|
-
class
|
|
1059
|
+
class ve {
|
|
1060
|
+
constructor(t, i = 600) {
|
|
1061
|
+
this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Register an image element for idle animation.
|
|
1065
|
+
* Starts animation after entry duration completes.
|
|
1066
|
+
*/
|
|
1067
|
+
register(t, i, e, n) {
|
|
1068
|
+
if (this.entries.has(t)) return;
|
|
1069
|
+
const a = n ?? this.entryDurationMs, r = this.config.startDelay ?? a, s = {
|
|
1070
|
+
element: t,
|
|
1071
|
+
index: i,
|
|
1072
|
+
totalImages: e,
|
|
1073
|
+
animation: null,
|
|
1074
|
+
blinkAnimation: null,
|
|
1075
|
+
customTeardown: null,
|
|
1076
|
+
paused: !1,
|
|
1077
|
+
stopped: !1,
|
|
1078
|
+
startTimer: null
|
|
1079
|
+
};
|
|
1080
|
+
this.entries.set(t, s), s.startTimer = setTimeout(() => {
|
|
1081
|
+
s.startTimer = null, !s.stopped && !s.paused && this._startAnimation(s);
|
|
1082
|
+
}, r);
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Pause idle animation for a specific image (set to neutral then pause).
|
|
1086
|
+
*/
|
|
1087
|
+
pauseForImage(t) {
|
|
1088
|
+
const i = this.entries.get(t);
|
|
1089
|
+
i && (i.paused = !0, i.startTimer !== null && (clearTimeout(i.startTimer), i.startTimer = null), this._pauseEntry(i));
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Resume idle animation for a specific image by starting a fresh animation.
|
|
1093
|
+
* Always restarts rather than resuming, to avoid Web Animations API
|
|
1094
|
+
* quirks with negative-delay animations after pause/cancel.
|
|
1095
|
+
*/
|
|
1096
|
+
resumeForImage(t) {
|
|
1097
|
+
const i = this.entries.get(t);
|
|
1098
|
+
!i || i.stopped || (i.paused = !1, this._startAnimation(i));
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Stop and remove idle animation for a specific image.
|
|
1102
|
+
*/
|
|
1103
|
+
stopForImage(t) {
|
|
1104
|
+
const i = this.entries.get(t);
|
|
1105
|
+
i && (i.stopped = !0, i.startTimer !== null && (clearTimeout(i.startTimer), i.startTimer = null), this._cancelEntry(i), this.entries.delete(t));
|
|
1106
|
+
}
|
|
1107
|
+
pauseAll() {
|
|
1108
|
+
for (const t of this.entries.values())
|
|
1109
|
+
t.paused = !0, t.startTimer !== null && (clearTimeout(t.startTimer), t.startTimer = null), this._pauseEntry(t);
|
|
1110
|
+
}
|
|
1111
|
+
resumeAll() {
|
|
1112
|
+
for (const t of this.entries.values())
|
|
1113
|
+
t.stopped || (t.paused = !1, this._startAnimation(t));
|
|
1114
|
+
}
|
|
1115
|
+
stopAll() {
|
|
1116
|
+
for (const t of this.entries.values())
|
|
1117
|
+
t.stopped = !0, t.startTimer !== null && (clearTimeout(t.startTimer), t.startTimer = null), this._cancelEntry(t);
|
|
1118
|
+
this.entries.clear(), this._stopTogetherLoop();
|
|
1119
|
+
}
|
|
1120
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
1121
|
+
// Private helpers
|
|
1122
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
1123
|
+
_startAnimation(t) {
|
|
1124
|
+
const { type: i } = this.config;
|
|
1125
|
+
switch (i) {
|
|
1126
|
+
case "wiggle":
|
|
1127
|
+
this._startWiggle(t);
|
|
1128
|
+
break;
|
|
1129
|
+
case "pulse":
|
|
1130
|
+
this._startPulse(t);
|
|
1131
|
+
break;
|
|
1132
|
+
case "blink":
|
|
1133
|
+
this._startBlink(t);
|
|
1134
|
+
break;
|
|
1135
|
+
case "spin":
|
|
1136
|
+
this._startSpin(t);
|
|
1137
|
+
break;
|
|
1138
|
+
case "custom":
|
|
1139
|
+
this._startCustom(t);
|
|
1140
|
+
break;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
_startWiggle(t) {
|
|
1144
|
+
const i = { ...Vt, ...this.config.wiggle }, e = [
|
|
1145
|
+
{ transform: "rotate(0deg)", offset: 0 },
|
|
1146
|
+
{ transform: `rotate(${i.maxAngle}deg)`, offset: 0.25 },
|
|
1147
|
+
{ transform: "rotate(0deg)", offset: 0.5 },
|
|
1148
|
+
{ transform: `rotate(${-i.maxAngle}deg)`, offset: 0.75 },
|
|
1149
|
+
{ transform: "rotate(0deg)", offset: 1 }
|
|
1150
|
+
];
|
|
1151
|
+
i.sync === "together" ? (t.animation = t.element.animate(e, {
|
|
1152
|
+
duration: i.speed,
|
|
1153
|
+
iterations: 1 / 0,
|
|
1154
|
+
composite: "add",
|
|
1155
|
+
fill: "both"
|
|
1156
|
+
}), t.animation.pause(), this._startTogetherLoop(i.speed)) : t.animation = t.element.animate(e, {
|
|
1157
|
+
duration: i.speed,
|
|
1158
|
+
delay: -(Math.random() * i.speed),
|
|
1159
|
+
iterations: 1 / 0,
|
|
1160
|
+
composite: "add"
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
_startPulse(t) {
|
|
1164
|
+
const i = { ...Jt, ...this.config.pulse }, e = [
|
|
1165
|
+
{ transform: "scale(1)", offset: 0 },
|
|
1166
|
+
{ transform: `scale(${i.maxScale})`, offset: 0.25 },
|
|
1167
|
+
{ transform: "scale(1)", offset: 0.5 },
|
|
1168
|
+
{ transform: `scale(${i.minScale})`, offset: 0.75 },
|
|
1169
|
+
{ transform: "scale(1)", offset: 1 }
|
|
1170
|
+
];
|
|
1171
|
+
i.sync === "together" ? (t.animation = t.element.animate(e, {
|
|
1172
|
+
duration: i.speed,
|
|
1173
|
+
iterations: 1 / 0,
|
|
1174
|
+
composite: "add",
|
|
1175
|
+
fill: "both"
|
|
1176
|
+
}), t.animation.pause(), this._startTogetherLoop(i.speed)) : t.animation = t.element.animate(e, {
|
|
1177
|
+
duration: i.speed,
|
|
1178
|
+
delay: -(Math.random() * i.speed),
|
|
1179
|
+
iterations: 1 / 0,
|
|
1180
|
+
composite: "add"
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
_startBlink(t) {
|
|
1184
|
+
const i = { ...Kt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
|
|
1185
|
+
let a, r;
|
|
1186
|
+
i.style === "fade" ? (a = [
|
|
1187
|
+
{ opacity: n, offset: 0 },
|
|
1188
|
+
{ opacity: 0, offset: 0.5 },
|
|
1189
|
+
{ opacity: n, offset: 1 }
|
|
1190
|
+
], r = {
|
|
1191
|
+
duration: i.speed,
|
|
1192
|
+
delay: e,
|
|
1193
|
+
iterations: 1 / 0,
|
|
1194
|
+
easing: "ease-in-out"
|
|
1195
|
+
}) : (a = [
|
|
1196
|
+
{ opacity: n, offset: 0 },
|
|
1197
|
+
{ opacity: n, offset: i.onRatio },
|
|
1198
|
+
{ opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
|
|
1199
|
+
{ opacity: 0, offset: 0.99 },
|
|
1200
|
+
{ opacity: n, offset: 1 }
|
|
1201
|
+
], r = {
|
|
1202
|
+
duration: i.speed,
|
|
1203
|
+
delay: e,
|
|
1204
|
+
iterations: 1 / 0
|
|
1205
|
+
}), t.blinkAnimation = t.element.animate(a, r);
|
|
1206
|
+
}
|
|
1207
|
+
_startSpin(t) {
|
|
1208
|
+
const i = { ...Zt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
|
|
1209
|
+
t.animation = t.element.animate(
|
|
1210
|
+
[{ transform: "rotate(0deg)" }, { transform: `rotate(${e}deg)` }],
|
|
1211
|
+
{
|
|
1212
|
+
duration: i.speed,
|
|
1213
|
+
iterations: 1 / 0,
|
|
1214
|
+
easing: "linear",
|
|
1215
|
+
composite: "add"
|
|
1216
|
+
}
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
_startCustom(t) {
|
|
1220
|
+
const i = this.config.custom;
|
|
1221
|
+
if (!i) return;
|
|
1222
|
+
const e = i({ element: t.element, index: t.index, totalImages: t.totalImages });
|
|
1223
|
+
typeof e == "function" ? t.customTeardown = e : e && typeof e.play == "function" && (t.animation = e);
|
|
1224
|
+
}
|
|
1225
|
+
_startTogetherLoop(t) {
|
|
1226
|
+
if (this.togetherSpeed = t, this.togetherRafId !== null) return;
|
|
1227
|
+
const i = () => {
|
|
1228
|
+
const e = performance.now() % this.togetherSpeed;
|
|
1229
|
+
for (const n of this.entries.values())
|
|
1230
|
+
!n.stopped && !n.paused && n.animation && (n.animation.currentTime = e);
|
|
1231
|
+
this.togetherRafId = requestAnimationFrame(i);
|
|
1232
|
+
};
|
|
1233
|
+
this.togetherRafId = requestAnimationFrame(i);
|
|
1234
|
+
}
|
|
1235
|
+
_stopTogetherLoop() {
|
|
1236
|
+
this.togetherRafId !== null && (cancelAnimationFrame(this.togetherRafId), this.togetherRafId = null);
|
|
1237
|
+
}
|
|
1238
|
+
_pauseEntry(t) {
|
|
1239
|
+
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null);
|
|
1240
|
+
}
|
|
1241
|
+
_cancelEntry(t) {
|
|
1242
|
+
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
class we {
|
|
1056
1246
|
constructor(t, i = {}) {
|
|
1057
1247
|
this.config = t, this.imageConfig = i;
|
|
1058
1248
|
}
|
|
@@ -1064,11 +1254,11 @@ class fe {
|
|
|
1064
1254
|
* @returns Array of layout objects with position, rotation, scale
|
|
1065
1255
|
*/
|
|
1066
1256
|
generate(t, i, e = {}) {
|
|
1067
|
-
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = c * 1.5 / 2, m = c / 2, y = a - s - g, w = r - s - m, v = s + g,
|
|
1257
|
+
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = c * 1.5 / 2, m = c / 2, y = a - s - g, w = r - s - m, v = s + g, I = s + m;
|
|
1068
1258
|
for (let x = 0; x < t; x++) {
|
|
1069
|
-
const
|
|
1259
|
+
const R = this.random(v, y), z = this.random(I, w), L = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, f) : 1, O = c * _, H = {
|
|
1070
1260
|
id: x,
|
|
1071
|
-
x:
|
|
1261
|
+
x: R,
|
|
1072
1262
|
y: z,
|
|
1073
1263
|
rotation: L,
|
|
1074
1264
|
scale: _,
|
|
@@ -1088,7 +1278,7 @@ class fe {
|
|
|
1088
1278
|
return Math.random() * (i - t) + t;
|
|
1089
1279
|
}
|
|
1090
1280
|
}
|
|
1091
|
-
class
|
|
1281
|
+
class xe {
|
|
1092
1282
|
constructor(t, i = {}) {
|
|
1093
1283
|
this.config = t, this.imageConfig = i;
|
|
1094
1284
|
}
|
|
@@ -1103,7 +1293,7 @@ class me {
|
|
|
1103
1293
|
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
|
|
1104
1294
|
...Wt,
|
|
1105
1295
|
...this.config.radial
|
|
1106
|
-
}, g = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50,
|
|
1296
|
+
}, g = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, I = Math.max(g * 0.8, Math.min(
|
|
1107
1297
|
m - v - g / 2,
|
|
1108
1298
|
y - v - g / 2
|
|
1109
1299
|
));
|
|
@@ -1121,32 +1311,32 @@ class me {
|
|
|
1121
1311
|
// Center image is highest
|
|
1122
1312
|
});
|
|
1123
1313
|
}
|
|
1124
|
-
let x = 1,
|
|
1314
|
+
let x = 1, R = 1;
|
|
1125
1315
|
for (; x < t; ) {
|
|
1126
|
-
const z =
|
|
1316
|
+
const z = R / w, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(g * 0.8, I / w * 1.5 / p.tightness), O = R * _, H = O * 1.5, k = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), T = this.estimateWidth(g), D = Math.floor(k / (T * 0.7));
|
|
1127
1317
|
if (D === 0) {
|
|
1128
|
-
|
|
1318
|
+
R++;
|
|
1129
1319
|
continue;
|
|
1130
1320
|
}
|
|
1131
|
-
const G = 2 * Math.PI / D, U =
|
|
1321
|
+
const G = 2 * Math.PI / D, U = R * (20 * Math.PI / 180);
|
|
1132
1322
|
for (let M = 0; M < D && x < t; M++) {
|
|
1133
|
-
const
|
|
1134
|
-
let $ = m + Math.cos(
|
|
1135
|
-
const P =
|
|
1136
|
-
$ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P), F -
|
|
1137
|
-
const
|
|
1323
|
+
const A = M * G + U, N = f ? this.random(h, d) : 1, B = L * N, C = g * B;
|
|
1324
|
+
let $ = m + Math.cos(A) * H, F = y + Math.sin(A) * O;
|
|
1325
|
+
const P = C * 1.5 / 2, j = C / 2;
|
|
1326
|
+
$ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P), F - j < v ? F = v + j : F + j > r - v && (F = r - v - j);
|
|
1327
|
+
const Y = c === "random" ? this.random(l, u) : 0;
|
|
1138
1328
|
n.push({
|
|
1139
1329
|
id: x,
|
|
1140
1330
|
x: $,
|
|
1141
1331
|
y: F,
|
|
1142
|
-
rotation:
|
|
1143
|
-
scale:
|
|
1144
|
-
baseSize:
|
|
1145
|
-
zIndex: Math.max(1, 100 -
|
|
1332
|
+
rotation: Y,
|
|
1333
|
+
scale: B,
|
|
1334
|
+
baseSize: C,
|
|
1335
|
+
zIndex: Math.max(1, 100 - R)
|
|
1146
1336
|
// Outer rings have lower z-index
|
|
1147
1337
|
}), x++;
|
|
1148
1338
|
}
|
|
1149
|
-
|
|
1339
|
+
R++;
|
|
1150
1340
|
}
|
|
1151
1341
|
return n;
|
|
1152
1342
|
}
|
|
@@ -1169,7 +1359,7 @@ class me {
|
|
|
1169
1359
|
return Math.random() * (i - t) + t;
|
|
1170
1360
|
}
|
|
1171
1361
|
}
|
|
1172
|
-
const
|
|
1362
|
+
const Ee = {
|
|
1173
1363
|
columns: "auto",
|
|
1174
1364
|
rows: "auto",
|
|
1175
1365
|
stagger: "none",
|
|
@@ -1179,7 +1369,7 @@ const pe = {
|
|
|
1179
1369
|
alignment: "center",
|
|
1180
1370
|
gap: 10,
|
|
1181
1371
|
overflowOffset: 0.25
|
|
1182
|
-
},
|
|
1372
|
+
}, Ct = [
|
|
1183
1373
|
{ x: 1, y: 1 },
|
|
1184
1374
|
// bottom-right
|
|
1185
1375
|
{ x: -1, y: -1 },
|
|
@@ -1197,7 +1387,7 @@ const pe = {
|
|
|
1197
1387
|
{ x: 0, y: 1 }
|
|
1198
1388
|
// down
|
|
1199
1389
|
];
|
|
1200
|
-
class
|
|
1390
|
+
class Se {
|
|
1201
1391
|
constructor(t, i = {}) {
|
|
1202
1392
|
this.config = t, this.imageConfig = i;
|
|
1203
1393
|
}
|
|
@@ -1209,13 +1399,13 @@ class be {
|
|
|
1209
1399
|
* @returns Array of layout objects with position, rotation, scale
|
|
1210
1400
|
*/
|
|
1211
1401
|
generate(t, i, e = {}) {
|
|
1212
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1402
|
+
const n = [], { width: a, height: r } = i, s = { ...Ee, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = a - 2 * c, p = r - 2 * c, { columns: g, rows: m } = this.calculateGridDimensions(
|
|
1213
1403
|
t,
|
|
1214
1404
|
b,
|
|
1215
1405
|
p,
|
|
1216
1406
|
l,
|
|
1217
1407
|
s
|
|
1218
|
-
), y = s.stagger === "row", w = s.stagger === "column", v = y ? g + 0.5 : g,
|
|
1408
|
+
), y = s.stagger === "row", w = s.stagger === "column", v = y ? g + 0.5 : g, I = w ? m + 0.5 : m, x = (b - s.gap * (g - 1)) / v, R = (p - s.gap * (m - 1)) / I, z = y ? x / 2 : 0, L = w ? R / 2 : 0, _ = 1 + s.overlap, O = Math.min(x, R) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, k = g * x + (g - 1) * s.gap + z, T = m * R + (m - 1) * s.gap + L, D = c + (b - k) / 2, G = c + (p - T) / 2, U = g * m, M = s.columns !== "auto" && s.rows !== "auto", A = M && t > U;
|
|
1219
1409
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1220
1410
|
gridConfigColumns: s.columns,
|
|
1221
1411
|
gridConfigRows: s.rows,
|
|
@@ -1224,45 +1414,45 @@ class be {
|
|
|
1224
1414
|
cellCount: U,
|
|
1225
1415
|
hasFixedGrid: M,
|
|
1226
1416
|
imageCount: t,
|
|
1227
|
-
isOverflowMode:
|
|
1417
|
+
isOverflowMode: A
|
|
1228
1418
|
});
|
|
1229
|
-
const
|
|
1230
|
-
for (let
|
|
1231
|
-
let $, F,
|
|
1232
|
-
if (
|
|
1233
|
-
const q =
|
|
1234
|
-
|
|
1419
|
+
const N = A ? new Array(U).fill(0) : [], B = Math.min(x, R) * s.overflowOffset;
|
|
1420
|
+
for (let C = 0; C < t; C++) {
|
|
1421
|
+
let $, F, X = 0;
|
|
1422
|
+
if (A && C >= U) {
|
|
1423
|
+
const q = C - U, W = q % U;
|
|
1424
|
+
X = Math.floor(q / U) + 1, N[W]++, s.fillDirection === "row" ? ($ = W % g, F = Math.floor(W / g)) : (F = W % m, $ = Math.floor(W / m));
|
|
1235
1425
|
} else
|
|
1236
|
-
s.fillDirection === "row" ? ($ =
|
|
1237
|
-
let P = D + $ * (x + s.gap) + x / 2,
|
|
1238
|
-
if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (
|
|
1239
|
-
const q = (
|
|
1240
|
-
P +=
|
|
1426
|
+
s.fillDirection === "row" ? ($ = C % g, F = Math.floor(C / g)) : (F = C % m, $ = Math.floor(C / m));
|
|
1427
|
+
let P = D + $ * (x + s.gap) + x / 2, j = G + F * (R + s.gap) + R / 2;
|
|
1428
|
+
if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (j += R / 2), X > 0) {
|
|
1429
|
+
const q = (X - 1) % Ct.length, W = Ct[q];
|
|
1430
|
+
P += W.x * B, j += W.y * B;
|
|
1241
1431
|
}
|
|
1242
1432
|
if (s.jitter > 0) {
|
|
1243
|
-
const q = x / 2 * s.jitter,
|
|
1244
|
-
P += this.random(-q, q),
|
|
1433
|
+
const q = x / 2 * s.jitter, W = R / 2 * s.jitter;
|
|
1434
|
+
P += this.random(-q, q), j += this.random(-W, W);
|
|
1245
1435
|
}
|
|
1246
|
-
let
|
|
1247
|
-
if (!
|
|
1436
|
+
let Y = P, V = j;
|
|
1437
|
+
if (!A && s.fillDirection === "row") {
|
|
1248
1438
|
const q = t % g || g;
|
|
1249
1439
|
if (F === Math.floor((t - 1) / g) && q < g) {
|
|
1250
1440
|
const St = q * x + (q - 1) * s.gap;
|
|
1251
1441
|
let gt = 0;
|
|
1252
|
-
s.alignment === "center" ? gt = (
|
|
1442
|
+
s.alignment === "center" ? gt = (k - St) / 2 : s.alignment === "end" && (gt = k - St), Y += gt;
|
|
1253
1443
|
}
|
|
1254
1444
|
}
|
|
1255
|
-
const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2,
|
|
1256
|
-
|
|
1445
|
+
const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt = c + it, ht = a - c - it, _t = c + nt, Ut = r - c - nt;
|
|
1446
|
+
Y = Math.max(lt, Math.min(Y, ht)), V = Math.max(_t, Math.min(V, Ut));
|
|
1257
1447
|
let dt = 0;
|
|
1258
1448
|
if (u === "random") {
|
|
1259
|
-
const q = this.imageConfig.rotation?.range?.min ?? -15,
|
|
1260
|
-
s.jitter > 0 ? dt = this.random(q * s.jitter,
|
|
1449
|
+
const q = this.imageConfig.rotation?.range?.min ?? -15, W = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1450
|
+
s.jitter > 0 ? dt = this.random(q * s.jitter, W * s.jitter) : dt = this.random(q, W);
|
|
1261
1451
|
}
|
|
1262
1452
|
let ut;
|
|
1263
|
-
|
|
1264
|
-
id:
|
|
1265
|
-
x:
|
|
1453
|
+
A && X > 0 ? ut = 50 - X : ut = A ? 100 + C : C + 1, n.push({
|
|
1454
|
+
id: C,
|
|
1455
|
+
x: Y,
|
|
1266
1456
|
y: V,
|
|
1267
1457
|
rotation: dt,
|
|
1268
1458
|
scale: rt,
|
|
@@ -1297,14 +1487,14 @@ class be {
|
|
|
1297
1487
|
return Math.random() * (i - t) + t;
|
|
1298
1488
|
}
|
|
1299
1489
|
}
|
|
1300
|
-
const
|
|
1490
|
+
const Ie = Math.PI * (3 - Math.sqrt(5)), Re = {
|
|
1301
1491
|
spiralType: "golden",
|
|
1302
1492
|
direction: "counterclockwise",
|
|
1303
1493
|
tightness: 1,
|
|
1304
1494
|
scaleDecay: 0,
|
|
1305
1495
|
startAngle: 0
|
|
1306
1496
|
};
|
|
1307
|
-
class
|
|
1497
|
+
class Te {
|
|
1308
1498
|
constructor(t, i = {}) {
|
|
1309
1499
|
this.config = t, this.imageConfig = i;
|
|
1310
1500
|
}
|
|
@@ -1316,36 +1506,36 @@ class we {
|
|
|
1316
1506
|
* @returns Array of layout objects with position, rotation, scale
|
|
1317
1507
|
*/
|
|
1318
1508
|
generate(t, i, e = {}) {
|
|
1319
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1509
|
+
const n = [], { width: a, height: r } = i, s = { ...Re, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, y = r / 2, w = Math.min(
|
|
1320
1510
|
m - c - l / 2,
|
|
1321
1511
|
y - c - l / 2
|
|
1322
1512
|
), v = s.direction === "clockwise" ? -1 : 1;
|
|
1323
|
-
for (let
|
|
1324
|
-
let x,
|
|
1513
|
+
for (let I = 0; I < t; I++) {
|
|
1514
|
+
let x, R;
|
|
1325
1515
|
if (s.spiralType === "golden")
|
|
1326
|
-
x =
|
|
1516
|
+
x = I * Ie * v + s.startAngle, R = this.calculateGoldenRadius(I, t, w, s.tightness);
|
|
1327
1517
|
else if (s.spiralType === "archimedean") {
|
|
1328
|
-
const P =
|
|
1329
|
-
x = P * v + s.startAngle,
|
|
1518
|
+
const P = I * 0.5 * s.tightness;
|
|
1519
|
+
x = P * v + s.startAngle, R = this.calculateArchimedeanRadius(P, t, w, s.tightness);
|
|
1330
1520
|
} else {
|
|
1331
|
-
const P =
|
|
1332
|
-
x = P * v + s.startAngle,
|
|
1521
|
+
const P = I * 0.3 * s.tightness;
|
|
1522
|
+
x = P * v + s.startAngle, R = this.calculateLogarithmicRadius(P, t, w, s.tightness);
|
|
1333
1523
|
}
|
|
1334
|
-
const z = m + Math.cos(x) *
|
|
1524
|
+
const z = m + Math.cos(x) * R, L = y + Math.sin(x) * R, _ = R / w, O = g > 0 ? 1 - _ * g * 0.5 : 1, H = p ? this.random(f, b) : 1, k = O * H, T = l * k, G = T * 1.5 / 2, U = T / 2, M = c + G, A = a - c - G, N = c + U, B = r - c - U, C = Math.max(M, Math.min(z, A)), $ = Math.max(N, Math.min(L, B));
|
|
1335
1525
|
let F = 0;
|
|
1336
1526
|
if (u === "random") {
|
|
1337
|
-
const P = x * 180 / Math.PI % 360,
|
|
1338
|
-
F = s.spiralType === "golden" ?
|
|
1339
|
-
} else u === "tangent" && (F = this.calculateSpiralTangent(x,
|
|
1340
|
-
const
|
|
1527
|
+
const P = x * 180 / Math.PI % 360, j = this.random(h, d);
|
|
1528
|
+
F = s.spiralType === "golden" ? j : P * 0.1 + j * 0.9;
|
|
1529
|
+
} else u === "tangent" && (F = this.calculateSpiralTangent(x, R, s));
|
|
1530
|
+
const X = t - I;
|
|
1341
1531
|
n.push({
|
|
1342
|
-
id:
|
|
1343
|
-
x:
|
|
1532
|
+
id: I,
|
|
1533
|
+
x: C,
|
|
1344
1534
|
y: $,
|
|
1345
1535
|
rotation: F,
|
|
1346
|
-
scale:
|
|
1536
|
+
scale: k,
|
|
1347
1537
|
baseSize: T,
|
|
1348
|
-
zIndex:
|
|
1538
|
+
zIndex: X
|
|
1349
1539
|
});
|
|
1350
1540
|
}
|
|
1351
1541
|
return n;
|
|
@@ -1398,7 +1588,7 @@ class we {
|
|
|
1398
1588
|
return Math.random() * (i - t) + t;
|
|
1399
1589
|
}
|
|
1400
1590
|
}
|
|
1401
|
-
const
|
|
1591
|
+
const Ae = {
|
|
1402
1592
|
clusterCount: "auto",
|
|
1403
1593
|
clusterSpread: 150,
|
|
1404
1594
|
clusterSpacing: 200,
|
|
@@ -1406,7 +1596,7 @@ const xe = {
|
|
|
1406
1596
|
overlap: 0.3,
|
|
1407
1597
|
distribution: "gaussian"
|
|
1408
1598
|
};
|
|
1409
|
-
class
|
|
1599
|
+
class Ce {
|
|
1410
1600
|
constructor(t, i = {}) {
|
|
1411
1601
|
this.config = t, this.imageConfig = i;
|
|
1412
1602
|
}
|
|
@@ -1418,7 +1608,7 @@ class Ee {
|
|
|
1418
1608
|
* @returns Array of layout objects with position, rotation, scale
|
|
1419
1609
|
*/
|
|
1420
1610
|
generate(t, i, e = {}) {
|
|
1421
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1611
|
+
const n = [], { width: a, height: r } = i, s = { ...Ae, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.calculateClusterCount(
|
|
1422
1612
|
t,
|
|
1423
1613
|
s.clusterCount,
|
|
1424
1614
|
a,
|
|
@@ -1435,28 +1625,28 @@ class Ee {
|
|
|
1435
1625
|
y[v % g]++;
|
|
1436
1626
|
let w = 0;
|
|
1437
1627
|
for (let v = 0; v < g; v++) {
|
|
1438
|
-
const
|
|
1439
|
-
for (let
|
|
1628
|
+
const I = m[v], x = y[v];
|
|
1629
|
+
for (let R = 0; R < x; R++) {
|
|
1440
1630
|
let z, L;
|
|
1441
1631
|
if (s.distribution === "gaussian")
|
|
1442
|
-
z = this.gaussianRandom() *
|
|
1632
|
+
z = this.gaussianRandom() * I.spread, L = this.gaussianRandom() * I.spread;
|
|
1443
1633
|
else {
|
|
1444
|
-
const F = this.random(0, Math.PI * 2),
|
|
1445
|
-
z = Math.cos(F) *
|
|
1634
|
+
const F = this.random(0, Math.PI * 2), X = this.random(0, I.spread);
|
|
1635
|
+
z = Math.cos(F) * X, L = Math.sin(F) * X;
|
|
1446
1636
|
}
|
|
1447
1637
|
const _ = 1 + s.overlap * 0.5, O = 1 + s.overlap * 0.3;
|
|
1448
1638
|
z /= _, L /= _;
|
|
1449
|
-
const H = p ? this.random(f, b) : 1,
|
|
1450
|
-
let D =
|
|
1451
|
-
const M = T * 1.5 / 2,
|
|
1452
|
-
D = Math.max(c + M, Math.min(D, a - c - M)), G = Math.max(c +
|
|
1453
|
-
const
|
|
1639
|
+
const H = p ? this.random(f, b) : 1, k = O * H, T = l * k;
|
|
1640
|
+
let D = I.x + z, G = I.y + L;
|
|
1641
|
+
const M = T * 1.5 / 2, A = T / 2;
|
|
1642
|
+
D = Math.max(c + M, Math.min(D, a - c - M)), G = Math.max(c + A, Math.min(G, r - c - A));
|
|
1643
|
+
const N = u === "random" ? this.random(h, d) : 0, C = Math.sqrt(z * z + L * L) / I.spread, $ = Math.round((1 - C) * 50) + 1;
|
|
1454
1644
|
n.push({
|
|
1455
1645
|
id: w,
|
|
1456
1646
|
x: D,
|
|
1457
1647
|
y: G,
|
|
1458
|
-
rotation:
|
|
1459
|
-
scale:
|
|
1648
|
+
rotation: N,
|
|
1649
|
+
scale: k,
|
|
1460
1650
|
baseSize: T,
|
|
1461
1651
|
zIndex: $
|
|
1462
1652
|
}), w++;
|
|
@@ -1490,8 +1680,8 @@ class Ee {
|
|
|
1490
1680
|
};
|
|
1491
1681
|
let m = 1 / 0;
|
|
1492
1682
|
for (const y of r) {
|
|
1493
|
-
const w = g.x - y.x, v = g.y - y.y,
|
|
1494
|
-
m = Math.min(m,
|
|
1683
|
+
const w = g.x - y.x, v = g.y - y.y, I = Math.sqrt(w * w + v * v);
|
|
1684
|
+
m = Math.min(m, I);
|
|
1495
1685
|
}
|
|
1496
1686
|
if ((r.length === 0 || m > b) && (f = g, b = m), m >= a.clusterSpacing)
|
|
1497
1687
|
break;
|
|
@@ -1524,7 +1714,7 @@ class Ee {
|
|
|
1524
1714
|
return Math.random() * (i - t) + t;
|
|
1525
1715
|
}
|
|
1526
1716
|
}
|
|
1527
|
-
class
|
|
1717
|
+
class Le {
|
|
1528
1718
|
constructor(t, i = {}) {
|
|
1529
1719
|
this.config = t, this.imageConfig = i;
|
|
1530
1720
|
}
|
|
@@ -1537,26 +1727,26 @@ class Se {
|
|
|
1537
1727
|
*/
|
|
1538
1728
|
generate(t, i, e = {}) {
|
|
1539
1729
|
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, p = e.fixedHeight ?? s, g = {
|
|
1540
|
-
...
|
|
1730
|
+
...Gt,
|
|
1541
1731
|
...this.config.wave
|
|
1542
|
-
}, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization:
|
|
1732
|
+
}, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization: I } = g, x = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = a - c - L, H = O - _, k = x > 1 ? H / (x - 1) : 0, T = c + y + p / 2, D = r - c - y - p / 2, G = D - T, U = m > 1 ? G / (m - 1) : 0;
|
|
1543
1733
|
let M = 0;
|
|
1544
|
-
for (let
|
|
1545
|
-
const
|
|
1546
|
-
let
|
|
1547
|
-
|
|
1548
|
-
for (let
|
|
1549
|
-
const $ = x === 1 ? (_ + O) / 2 : _ +
|
|
1734
|
+
for (let A = 0; A < m && M < t; A++) {
|
|
1735
|
+
const N = m === 1 ? (T + D) / 2 : T + A * U;
|
|
1736
|
+
let B = 0;
|
|
1737
|
+
I === "offset" ? B = A * v : I === "alternating" && (B = A * Math.PI);
|
|
1738
|
+
for (let C = 0; C < x && M < t; C++) {
|
|
1739
|
+
const $ = x === 1 ? (_ + O) / 2 : _ + C * k, F = this.calculateWaveY($, a, y, w, B), X = $, P = N + F, j = b ? this.random(d, f) : 1, Y = p * j;
|
|
1550
1740
|
let V = 0;
|
|
1551
|
-
l === "tangent" ? V = this.calculateRotation($, a, y, w,
|
|
1552
|
-
const K =
|
|
1741
|
+
l === "tangent" ? V = this.calculateRotation($, a, y, w, B) : l === "random" && (V = this.random(u, h));
|
|
1742
|
+
const K = Y * 1.5 / 2, ct = Y / 2, it = c + K, nt = a - c - K, lt = c + ct, ht = r - c - ct;
|
|
1553
1743
|
n.push({
|
|
1554
1744
|
id: M,
|
|
1555
|
-
x: Math.max(it, Math.min(
|
|
1745
|
+
x: Math.max(it, Math.min(X, nt)),
|
|
1556
1746
|
y: Math.max(lt, Math.min(P, ht)),
|
|
1557
1747
|
rotation: V,
|
|
1558
|
-
scale:
|
|
1559
|
-
baseSize:
|
|
1748
|
+
scale: j,
|
|
1749
|
+
baseSize: Y,
|
|
1560
1750
|
zIndex: M + 1
|
|
1561
1751
|
}), M++;
|
|
1562
1752
|
}
|
|
@@ -1614,21 +1804,21 @@ const xt = 100, Q = 100 / Math.sqrt(3), Et = [
|
|
|
1614
1804
|
// lower-left
|
|
1615
1805
|
[0, 50]
|
|
1616
1806
|
// left
|
|
1617
|
-
],
|
|
1618
|
-
function
|
|
1807
|
+
], Me = Et[1][0] / xt, Fe = Et[2][1] / xt;
|
|
1808
|
+
function ze(o) {
|
|
1619
1809
|
return {
|
|
1620
|
-
colStep:
|
|
1621
|
-
rowOffset:
|
|
1810
|
+
colStep: Me * o,
|
|
1811
|
+
rowOffset: Fe * o
|
|
1622
1812
|
};
|
|
1623
1813
|
}
|
|
1624
|
-
function
|
|
1625
|
-
const { colStep: r } =
|
|
1814
|
+
function Oe(o, t, i, e, n, a) {
|
|
1815
|
+
const { colStep: r } = ze(a);
|
|
1626
1816
|
return {
|
|
1627
1817
|
px: e + r * o,
|
|
1628
1818
|
py: n + a * (t + o / 2)
|
|
1629
1819
|
};
|
|
1630
1820
|
}
|
|
1631
|
-
const
|
|
1821
|
+
const De = [
|
|
1632
1822
|
[1, 0, -1],
|
|
1633
1823
|
[0, 1, -1],
|
|
1634
1824
|
[-1, 1, 0],
|
|
@@ -1636,16 +1826,16 @@ const Ae = [
|
|
|
1636
1826
|
[0, -1, 1],
|
|
1637
1827
|
[1, -1, 0]
|
|
1638
1828
|
];
|
|
1639
|
-
function
|
|
1829
|
+
function $e(o) {
|
|
1640
1830
|
if (o === 0) return [[0, 0, 0]];
|
|
1641
1831
|
const t = [];
|
|
1642
1832
|
let [i, e, n] = [0, -o, o];
|
|
1643
|
-
for (const [a, r, s] of
|
|
1833
|
+
for (const [a, r, s] of De)
|
|
1644
1834
|
for (let c = 0; c < o; c++)
|
|
1645
1835
|
t.push([i, e, n]), i += a, e += r, n += s;
|
|
1646
1836
|
return t;
|
|
1647
1837
|
}
|
|
1648
|
-
class
|
|
1838
|
+
class Pe {
|
|
1649
1839
|
// imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
|
|
1650
1840
|
// would break hex tiling). Kept as parameter for interface compatibility.
|
|
1651
1841
|
constructor(t, i = {}) {
|
|
@@ -1653,15 +1843,15 @@ class Me {
|
|
|
1653
1843
|
}
|
|
1654
1844
|
generate(t, i, e = {}) {
|
|
1655
1845
|
const n = [], { width: a, height: r } = i, s = a / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
|
|
1656
|
-
...
|
|
1846
|
+
...qt,
|
|
1657
1847
|
...this.config.honeycomb
|
|
1658
1848
|
}.spacing ?? 0, d = l + h;
|
|
1659
1849
|
let f = 0, b = 0;
|
|
1660
1850
|
for (; f < t; ) {
|
|
1661
|
-
const p =
|
|
1851
|
+
const p = $e(b);
|
|
1662
1852
|
for (const [g, m, y] of p) {
|
|
1663
1853
|
if (f >= t) break;
|
|
1664
|
-
const { px: w, py: v } =
|
|
1854
|
+
const { px: w, py: v } = Oe(g, m, y, s, c, d);
|
|
1665
1855
|
n.push({
|
|
1666
1856
|
id: f,
|
|
1667
1857
|
x: w,
|
|
@@ -1678,7 +1868,7 @@ class Me {
|
|
|
1678
1868
|
return n;
|
|
1679
1869
|
}
|
|
1680
1870
|
}
|
|
1681
|
-
class
|
|
1871
|
+
class _e {
|
|
1682
1872
|
constructor(t) {
|
|
1683
1873
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1684
1874
|
}
|
|
@@ -1689,19 +1879,19 @@ class Fe {
|
|
|
1689
1879
|
initLayout() {
|
|
1690
1880
|
switch (this.config.algorithm) {
|
|
1691
1881
|
case "radial":
|
|
1692
|
-
return new
|
|
1882
|
+
return new xe(this.config, this.imageConfig);
|
|
1693
1883
|
case "grid":
|
|
1694
|
-
return new
|
|
1884
|
+
return new Se(this.config, this.imageConfig);
|
|
1695
1885
|
case "spiral":
|
|
1696
|
-
return new
|
|
1886
|
+
return new Te(this.config, this.imageConfig);
|
|
1697
1887
|
case "cluster":
|
|
1698
|
-
return new
|
|
1888
|
+
return new Ce(this.config, this.imageConfig);
|
|
1699
1889
|
case "wave":
|
|
1700
|
-
return new
|
|
1890
|
+
return new Le(this.config, this.imageConfig);
|
|
1701
1891
|
case "honeycomb":
|
|
1702
|
-
return new
|
|
1892
|
+
return new Pe(this.config, this.imageConfig);
|
|
1703
1893
|
default:
|
|
1704
|
-
return new
|
|
1894
|
+
return new we(this.config, this.imageConfig);
|
|
1705
1895
|
}
|
|
1706
1896
|
}
|
|
1707
1897
|
/**
|
|
@@ -1823,7 +2013,7 @@ const Lt = {
|
|
|
1823
2013
|
hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
|
1824
2014
|
octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
|
|
1825
2015
|
diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
|
|
1826
|
-
},
|
|
2016
|
+
}, Ue = {
|
|
1827
2017
|
// Circle - uses radius in pixels (refHeight of 100px = 50px radius)
|
|
1828
2018
|
circle: {
|
|
1829
2019
|
refHeight: 100,
|
|
@@ -1861,12 +2051,12 @@ const Lt = {
|
|
|
1861
2051
|
points: [[50, 0], [100, 50], [50, 100], [0, 50]]
|
|
1862
2052
|
}
|
|
1863
2053
|
};
|
|
1864
|
-
function
|
|
2054
|
+
function He(o) {
|
|
1865
2055
|
if (o)
|
|
1866
2056
|
return o in Lt ? Lt[o] : o;
|
|
1867
2057
|
}
|
|
1868
|
-
function
|
|
1869
|
-
const e =
|
|
2058
|
+
function ke(o, t, i) {
|
|
2059
|
+
const e = Ue[o];
|
|
1870
2060
|
if (!e) return "";
|
|
1871
2061
|
const n = t / e.refHeight;
|
|
1872
2062
|
if (o === "circle")
|
|
@@ -1877,13 +2067,13 @@ function De(o, t, i) {
|
|
|
1877
2067
|
return `${m}px ${y}px`;
|
|
1878
2068
|
}).join(", ")})`;
|
|
1879
2069
|
}
|
|
1880
|
-
function
|
|
2070
|
+
function Ne(o) {
|
|
1881
2071
|
return o in mt;
|
|
1882
2072
|
}
|
|
1883
|
-
function
|
|
1884
|
-
return o ?
|
|
2073
|
+
function je(o) {
|
|
2074
|
+
return o ? Ne(o) ? mt[o] : o : mt.md;
|
|
1885
2075
|
}
|
|
1886
|
-
function
|
|
2076
|
+
function We(o) {
|
|
1887
2077
|
if (!o) return "";
|
|
1888
2078
|
const t = [];
|
|
1889
2079
|
if (o.grayscale !== void 0 && t.push(`grayscale(${o.grayscale})`), o.blur !== void 0 && t.push(`blur(${o.blur}px)`), o.brightness !== void 0 && t.push(`brightness(${o.brightness})`), o.contrast !== void 0 && t.push(`contrast(${o.contrast})`), o.saturate !== void 0 && t.push(`saturate(${o.saturate})`), o.opacity !== void 0 && t.push(`opacity(${o.opacity})`), o.sepia !== void 0 && t.push(`sepia(${o.sepia})`), o.hueRotate !== void 0 && t.push(`hue-rotate(${o.hueRotate}deg)`), o.invert !== void 0 && t.push(`invert(${o.invert})`), o.dropShadow !== void 0)
|
|
@@ -1912,8 +2102,8 @@ function et(o, t, i) {
|
|
|
1912
2102
|
const s = o.border || {}, c = { ...s, ...o.borderTop }, l = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, h = { ...s, ...o.borderLeft };
|
|
1913
2103
|
e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
|
|
1914
2104
|
} else o.border && (e.border = tt(o.border));
|
|
1915
|
-
o.shadow !== void 0 && (e.boxShadow =
|
|
1916
|
-
const r =
|
|
2105
|
+
o.shadow !== void 0 && (e.boxShadow = je(o.shadow));
|
|
2106
|
+
const r = We(o.filter);
|
|
1917
2107
|
if (e.filter = r || "none", o.opacity !== void 0 && (e.opacity = String(o.opacity)), o.cursor !== void 0 && (e.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
|
|
1918
2108
|
const s = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
|
|
1919
2109
|
e.outline = `${s}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
@@ -1922,33 +2112,33 @@ function et(o, t, i) {
|
|
|
1922
2112
|
let s;
|
|
1923
2113
|
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
|
|
1924
2114
|
if (l?.mode === "height-relative" && t)
|
|
1925
|
-
s =
|
|
2115
|
+
s = ke(l.shape, t, i);
|
|
1926
2116
|
else {
|
|
1927
2117
|
const u = c && l ? l.shape : o.clipPath;
|
|
1928
|
-
s =
|
|
2118
|
+
s = He(u);
|
|
1929
2119
|
}
|
|
1930
2120
|
s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
|
|
1931
2121
|
}
|
|
1932
2122
|
return e;
|
|
1933
2123
|
}
|
|
1934
|
-
function
|
|
2124
|
+
function Ge(o, t) {
|
|
1935
2125
|
t.borderRadius !== void 0 && (o.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (o.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (o.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (o.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (o.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (o.style.border = t.border), t.borderTop !== void 0 && (o.style.borderTop = t.borderTop), t.borderRight !== void 0 && (o.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (o.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (o.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (o.style.boxShadow = t.boxShadow), t.filter !== void 0 && (o.style.filter = t.filter), t.opacity !== void 0 && (o.style.opacity = t.opacity), t.cursor !== void 0 && (o.style.cursor = t.cursor), t.outline !== void 0 && (o.style.outline = t.outline), t.outlineOffset !== void 0 && (o.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (o.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (o.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (o.style.clipPath = t.clipPath), t.overflow !== void 0 && (o.style.overflow = t.overflow);
|
|
1936
2126
|
}
|
|
1937
2127
|
function ft(o, t, i, e) {
|
|
1938
2128
|
const n = et(t, i, e);
|
|
1939
|
-
|
|
2129
|
+
Ge(o, n);
|
|
1940
2130
|
}
|
|
1941
|
-
function
|
|
2131
|
+
function Pt(o) {
|
|
1942
2132
|
return o ? Array.isArray(o) ? o.join(" ") : o : "";
|
|
1943
2133
|
}
|
|
1944
2134
|
function st(o, t) {
|
|
1945
|
-
const i =
|
|
2135
|
+
const i = Pt(t);
|
|
1946
2136
|
i && i.split(" ").forEach((e) => {
|
|
1947
2137
|
e.trim() && o.classList.add(e.trim());
|
|
1948
2138
|
});
|
|
1949
2139
|
}
|
|
1950
2140
|
function pt(o, t) {
|
|
1951
|
-
const i =
|
|
2141
|
+
const i = Pt(t);
|
|
1952
2142
|
i && i.split(" ").forEach((e) => {
|
|
1953
2143
|
e.trim() && o.classList.remove(e.trim());
|
|
1954
2144
|
});
|
|
@@ -1957,9 +2147,15 @@ const Mt = {
|
|
|
1957
2147
|
UNFOCUSING: 999,
|
|
1958
2148
|
FOCUSING: 1e3
|
|
1959
2149
|
};
|
|
1960
|
-
class
|
|
2150
|
+
class qe {
|
|
1961
2151
|
constructor(t, i, e) {
|
|
1962
|
-
this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
|
|
2152
|
+
this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
|
|
2153
|
+
}
|
|
2154
|
+
/**
|
|
2155
|
+
* Set callback to be fired when an unfocus animation fully completes.
|
|
2156
|
+
*/
|
|
2157
|
+
setOnUnfocusCompleteCallback(t) {
|
|
2158
|
+
this.onUnfocusComplete = t;
|
|
1963
2159
|
}
|
|
1964
2160
|
/**
|
|
1965
2161
|
* Get current state machine state
|
|
@@ -2238,7 +2434,11 @@ class He {
|
|
|
2238
2434
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2239
2435
|
]), this.focusGeneration !== n)
|
|
2240
2436
|
return;
|
|
2241
|
-
|
|
2437
|
+
if (this.outgoing) {
|
|
2438
|
+
const a = this.outgoing.element;
|
|
2439
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2440
|
+
}
|
|
2441
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2242
2442
|
break;
|
|
2243
2443
|
case S.FOCUSING:
|
|
2244
2444
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2255,7 +2455,11 @@ class He {
|
|
|
2255
2455
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2256
2456
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2257
2457
|
]), this.focusGeneration !== n) return;
|
|
2258
|
-
|
|
2458
|
+
if (this.outgoing) {
|
|
2459
|
+
const a = this.outgoing.element;
|
|
2460
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2461
|
+
}
|
|
2462
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2259
2463
|
break;
|
|
2260
2464
|
case S.CROSS_ANIMATING:
|
|
2261
2465
|
if (this.incoming?.element === t)
|
|
@@ -2276,7 +2480,11 @@ class He {
|
|
|
2276
2480
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2277
2481
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2278
2482
|
]), this.focusGeneration !== n) return;
|
|
2279
|
-
|
|
2483
|
+
if (this.outgoing) {
|
|
2484
|
+
const s = this.outgoing.element;
|
|
2485
|
+
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2486
|
+
}
|
|
2487
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2280
2488
|
return;
|
|
2281
2489
|
}
|
|
2282
2490
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2298,7 +2506,11 @@ class He {
|
|
|
2298
2506
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2299
2507
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2300
2508
|
]), this.focusGeneration !== n) return;
|
|
2301
|
-
|
|
2509
|
+
if (this.outgoing) {
|
|
2510
|
+
const a = this.outgoing.element;
|
|
2511
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2512
|
+
}
|
|
2513
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2302
2514
|
break;
|
|
2303
2515
|
}
|
|
2304
2516
|
}
|
|
@@ -2318,7 +2530,8 @@ class He {
|
|
|
2318
2530
|
a,
|
|
2319
2531
|
r
|
|
2320
2532
|
), this.incoming = null, this.state = S.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2321
|
-
|
|
2533
|
+
const s = this.outgoing.element;
|
|
2534
|
+
this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(s);
|
|
2322
2535
|
}
|
|
2323
2536
|
return;
|
|
2324
2537
|
}
|
|
@@ -2335,12 +2548,15 @@ class He {
|
|
|
2335
2548
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2336
2549
|
this.waitForAnimation(s.animationHandle)
|
|
2337
2550
|
]), this.focusGeneration !== t) return;
|
|
2338
|
-
|
|
2551
|
+
let c = null;
|
|
2552
|
+
this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2553
|
+
const l = s.element;
|
|
2554
|
+
this.removeFocusedStyling(l, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(l);
|
|
2339
2555
|
return;
|
|
2340
2556
|
}
|
|
2341
2557
|
this.state = S.UNFOCUSING;
|
|
2342
2558
|
const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2343
|
-
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE);
|
|
2559
|
+
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(i));
|
|
2344
2560
|
}
|
|
2345
2561
|
/**
|
|
2346
2562
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2422,7 +2638,7 @@ class He {
|
|
|
2422
2638
|
), this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2423
2639
|
}
|
|
2424
2640
|
}
|
|
2425
|
-
const
|
|
2641
|
+
const Be = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, at = class at {
|
|
2426
2642
|
constructor(t, i) {
|
|
2427
2643
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = i, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2428
2644
|
}
|
|
@@ -2469,11 +2685,11 @@ const Ne = 50, je = 0.5, We = 20, ke = 0.3, Ge = 150, qe = 30, at = class at {
|
|
|
2469
2685
|
const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
|
|
2470
2686
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
|
|
2471
2687
|
const s = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
|
|
2472
|
-
this.touchState.isHorizontalSwipe = s <=
|
|
2688
|
+
this.touchState.isHorizontalSwipe = s <= Ke;
|
|
2473
2689
|
}
|
|
2474
2690
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2475
2691
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
|
|
2476
|
-
const a = e *
|
|
2692
|
+
const a = e * Ve;
|
|
2477
2693
|
this.callbacks.onDragOffset(a);
|
|
2478
2694
|
}
|
|
2479
2695
|
}
|
|
@@ -2482,7 +2698,7 @@ const Ne = 50, je = 0.5, We = 20, ke = 0.3, Ge = 150, qe = 30, at = class at {
|
|
|
2482
2698
|
this.recentTouchTimestamp = Date.now();
|
|
2483
2699
|
const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, a = Math.abs(i);
|
|
2484
2700
|
let r = !1;
|
|
2485
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >=
|
|
2701
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= Be || n >= Xe && a >= Ye) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2486
2702
|
}
|
|
2487
2703
|
handleTouchCancel(t) {
|
|
2488
2704
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
@@ -2490,7 +2706,7 @@ const Ne = 50, je = 0.5, We = 20, ke = 0.3, Ge = 150, qe = 30, at = class at {
|
|
|
2490
2706
|
};
|
|
2491
2707
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2492
2708
|
let bt = at;
|
|
2493
|
-
class
|
|
2709
|
+
class Ze {
|
|
2494
2710
|
constructor(t) {
|
|
2495
2711
|
if (this._prepared = !1, this._discoveredUrls = [], this.apiKey = t.apiKey ?? "", this.apiEndpoint = t.apiEndpoint ?? "https://www.googleapis.com/drive/v3/files", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
2496
2712
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2711,7 +2927,7 @@ class Xe {
|
|
|
2711
2927
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2712
2928
|
}
|
|
2713
2929
|
}
|
|
2714
|
-
class
|
|
2930
|
+
class Qe {
|
|
2715
2931
|
constructor(t) {
|
|
2716
2932
|
if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
2717
2933
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2891,7 +3107,7 @@ class Ye {
|
|
|
2891
3107
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2892
3108
|
}
|
|
2893
3109
|
}
|
|
2894
|
-
class
|
|
3110
|
+
class ti {
|
|
2895
3111
|
constructor(t) {
|
|
2896
3112
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
2897
3113
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -2948,7 +3164,7 @@ class Be {
|
|
|
2948
3164
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2949
3165
|
}
|
|
2950
3166
|
}
|
|
2951
|
-
class
|
|
3167
|
+
class ei {
|
|
2952
3168
|
/**
|
|
2953
3169
|
* Create a new ImageFilter
|
|
2954
3170
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2985,7 +3201,7 @@ class Ve {
|
|
|
2985
3201
|
// isAllowedDate(date: Date): boolean
|
|
2986
3202
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2987
3203
|
}
|
|
2988
|
-
const
|
|
3204
|
+
const ii = `
|
|
2989
3205
|
.fbn-ic-gallery {
|
|
2990
3206
|
position: relative;
|
|
2991
3207
|
width: 100%;
|
|
@@ -3035,31 +3251,38 @@ const Je = `
|
|
|
3035
3251
|
display: none !important;
|
|
3036
3252
|
}
|
|
3037
3253
|
`;
|
|
3038
|
-
function
|
|
3254
|
+
function ni() {
|
|
3039
3255
|
if (typeof document > "u") return;
|
|
3040
3256
|
const o = "fbn-ic-functional-styles";
|
|
3041
3257
|
if (document.getElementById(o)) return;
|
|
3042
3258
|
const t = document.createElement("style");
|
|
3043
|
-
t.id = o, t.textContent =
|
|
3259
|
+
t.id = o, t.textContent = ii, document.head.appendChild(t);
|
|
3044
3260
|
}
|
|
3045
|
-
let
|
|
3261
|
+
let oi = class {
|
|
3046
3262
|
constructor(t = {}) {
|
|
3047
|
-
this.fullConfig =
|
|
3263
|
+
this.fullConfig = ne(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new re(this.fullConfig.animation), this.layoutEngine = new _e({
|
|
3048
3264
|
layout: this.fullConfig.layout,
|
|
3049
3265
|
image: this.fullConfig.image
|
|
3050
|
-
}), this.zoomEngine = new
|
|
3266
|
+
}), this.zoomEngine = new qe(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = et(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3051
3267
|
const i = this.fullConfig.animation.entry || E.animation.entry;
|
|
3052
|
-
this.entryAnimationEngine = new
|
|
3268
|
+
this.entryAnimationEngine = new ye(
|
|
3053
3269
|
i,
|
|
3054
3270
|
this.fullConfig.layout.algorithm
|
|
3055
|
-
)
|
|
3271
|
+
);
|
|
3272
|
+
const e = this.fullConfig.animation.idle;
|
|
3273
|
+
e && e.type !== "none" ? this.idleAnimationEngine = new ve(
|
|
3274
|
+
e,
|
|
3275
|
+
i.timing?.duration ?? 600
|
|
3276
|
+
) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
|
|
3277
|
+
this.idleAnimationEngine?.resumeForImage(n);
|
|
3278
|
+
}), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
3056
3279
|
}
|
|
3057
3280
|
/**
|
|
3058
3281
|
* Create image filter based on shared loader config
|
|
3059
3282
|
*/
|
|
3060
3283
|
createImageFilter() {
|
|
3061
3284
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
3062
|
-
return new
|
|
3285
|
+
return new ei(t);
|
|
3063
3286
|
}
|
|
3064
3287
|
/**
|
|
3065
3288
|
* Create appropriate image loader based on config
|
|
@@ -3070,7 +3293,7 @@ let Ze = class {
|
|
|
3070
3293
|
if (!t || t.length === 0)
|
|
3071
3294
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
3072
3295
|
const e = t.map((n) => this.createLoaderFromEntry(n, i));
|
|
3073
|
-
return e.length === 1 ? e[0] : new
|
|
3296
|
+
return e.length === 1 ? e[0] : new ti({
|
|
3074
3297
|
loaders: e,
|
|
3075
3298
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
3076
3299
|
});
|
|
@@ -3088,14 +3311,14 @@ let Ze = class {
|
|
|
3088
3311
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3089
3312
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3090
3313
|
};
|
|
3091
|
-
return new
|
|
3314
|
+
return new Qe(n);
|
|
3092
3315
|
} else if ("googleDrive" in t) {
|
|
3093
3316
|
const e = t.googleDrive, n = {
|
|
3094
3317
|
...e,
|
|
3095
3318
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3096
3319
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3097
3320
|
};
|
|
3098
|
-
return new
|
|
3321
|
+
return new Ze(n);
|
|
3099
3322
|
} else
|
|
3100
3323
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
3101
3324
|
}
|
|
@@ -3104,7 +3327,7 @@ let Ze = class {
|
|
|
3104
3327
|
*/
|
|
3105
3328
|
async init() {
|
|
3106
3329
|
try {
|
|
3107
|
-
if (
|
|
3330
|
+
if (ni(), this.containerRef)
|
|
3108
3331
|
this.containerEl = this.containerRef;
|
|
3109
3332
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
3110
3333
|
throw new Error(`Container #${this.containerId} not found`);
|
|
@@ -3113,7 +3336,7 @@ let Ze = class {
|
|
|
3113
3336
|
onPrev: () => this.navigateToPreviousImage(),
|
|
3114
3337
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
3115
3338
|
onDragEnd: (t) => {
|
|
3116
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
3339
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Je);
|
|
3117
3340
|
}
|
|
3118
3341
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3119
3342
|
} catch (t) {
|
|
@@ -3244,7 +3467,7 @@ let Ze = class {
|
|
|
3244
3467
|
x: parseFloat(l.dataset.endX),
|
|
3245
3468
|
y: parseFloat(l.dataset.endY)
|
|
3246
3469
|
}, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), g = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : g, w = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
|
|
3247
|
-
|
|
3470
|
+
me({
|
|
3248
3471
|
element: l,
|
|
3249
3472
|
startPosition: d,
|
|
3250
3473
|
endPosition: f,
|
|
@@ -3277,6 +3500,10 @@ let Ze = class {
|
|
|
3277
3500
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3278
3501
|
});
|
|
3279
3502
|
}
|
|
3503
|
+
if (this.idleAnimationEngine) {
|
|
3504
|
+
const d = this.entryAnimationEngine.getTiming().duration;
|
|
3505
|
+
this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
|
|
3506
|
+
}
|
|
3280
3507
|
}), r++);
|
|
3281
3508
|
}, c = () => {
|
|
3282
3509
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
@@ -3344,7 +3571,7 @@ let Ze = class {
|
|
|
3344
3571
|
d.scale,
|
|
3345
3572
|
b,
|
|
3346
3573
|
i
|
|
3347
|
-
),
|
|
3574
|
+
), I = this.entryAnimationEngine.buildStartTransform(
|
|
3348
3575
|
m,
|
|
3349
3576
|
p,
|
|
3350
3577
|
d.rotation,
|
|
@@ -3362,7 +3589,7 @@ let Ze = class {
|
|
|
3362
3589
|
finalTransform: v,
|
|
3363
3590
|
renderedWidth: b,
|
|
3364
3591
|
renderedHeight: i
|
|
3365
|
-
}), h.style.transform =
|
|
3592
|
+
}), h.style.transform = I, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || w !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(w)), this.displayQueue.push(h);
|
|
3366
3593
|
}, h.onerror = () => r++, h.src = l;
|
|
3367
3594
|
});
|
|
3368
3595
|
}
|
|
@@ -3375,6 +3602,7 @@ let Ze = class {
|
|
|
3375
3602
|
if (e)
|
|
3376
3603
|
await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter();
|
|
3377
3604
|
else {
|
|
3605
|
+
this.idleAnimationEngine?.pauseForImage(t);
|
|
3378
3606
|
const a = t.dataset.imageId;
|
|
3379
3607
|
this.currentFocusIndex = a !== void 0 ? parseInt(a, 10) : null, this.swipeEngine?.enable(), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex);
|
|
3380
3608
|
}
|
|
@@ -3383,7 +3611,7 @@ let Ze = class {
|
|
|
3383
3611
|
* Clear the image cloud and reset state
|
|
3384
3612
|
*/
|
|
3385
3613
|
clearImageCloud() {
|
|
3386
|
-
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.imagesLoaded = !1;
|
|
3614
|
+
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.idleAnimationEngine?.stopAll(), this.imagesLoaded = !1;
|
|
3387
3615
|
}
|
|
3388
3616
|
showLoading(t) {
|
|
3389
3617
|
!this.fullConfig.rendering.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
|
|
@@ -3404,19 +3632,19 @@ let Ze = class {
|
|
|
3404
3632
|
* Destroy the gallery and clean up resources
|
|
3405
3633
|
*/
|
|
3406
3634
|
destroy() {
|
|
3407
|
-
this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy();
|
|
3635
|
+
this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
|
|
3408
3636
|
}
|
|
3409
3637
|
};
|
|
3410
|
-
const
|
|
3638
|
+
const ci = kt(
|
|
3411
3639
|
function({ className: t, style: i, ...e }, n) {
|
|
3412
|
-
const a =
|
|
3640
|
+
const a = It(null), r = It(null);
|
|
3413
3641
|
return Nt(n, () => ({
|
|
3414
3642
|
get instance() {
|
|
3415
3643
|
return r.current;
|
|
3416
3644
|
}
|
|
3417
3645
|
})), jt(() => {
|
|
3418
3646
|
if (!a.current) return;
|
|
3419
|
-
const s = new
|
|
3647
|
+
const s = new oi({
|
|
3420
3648
|
container: a.current,
|
|
3421
3649
|
...e
|
|
3422
3650
|
});
|
|
@@ -3425,10 +3653,10 @@ const ii = Ht(
|
|
|
3425
3653
|
}), () => {
|
|
3426
3654
|
s.destroy(), r.current = null;
|
|
3427
3655
|
};
|
|
3428
|
-
}, [JSON.stringify(e)]), /* @__PURE__ */
|
|
3656
|
+
}, [JSON.stringify(e)]), /* @__PURE__ */ Ht("div", { ref: a, className: t, style: i });
|
|
3429
3657
|
}
|
|
3430
3658
|
);
|
|
3431
3659
|
export {
|
|
3432
|
-
|
|
3660
|
+
ci as ImageCloud
|
|
3433
3661
|
};
|
|
3434
3662
|
//# sourceMappingURL=react.js.map
|