@frybynite/image-cloud 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ImageCloud.d.ts +99 -0
- package/dist/ImageCloud.d.ts.map +1 -0
- package/dist/config/adapter.d.ts +50 -0
- package/dist/config/adapter.d.ts.map +1 -0
- package/dist/config/defaults.d.ts +118 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/types.d.ts +599 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/engines/AnimationEngine.d.ts +82 -0
- package/dist/engines/AnimationEngine.d.ts.map +1 -0
- package/dist/engines/EntryAnimationEngine.d.ts +161 -0
- package/dist/engines/EntryAnimationEngine.d.ts.map +1 -0
- package/dist/engines/LayoutEngine.d.ts +68 -0
- package/dist/engines/LayoutEngine.d.ts.map +1 -0
- package/dist/engines/PathAnimator.d.ts +50 -0
- package/dist/engines/PathAnimator.d.ts.map +1 -0
- package/dist/engines/SwipeEngine.d.ts +53 -0
- package/dist/engines/SwipeEngine.d.ts.map +1 -0
- package/dist/engines/ZoomEngine.d.ts +139 -0
- package/dist/engines/ZoomEngine.d.ts.map +1 -0
- package/dist/image-cloud-auto-init.d.ts +14 -0
- package/dist/image-cloud-auto-init.d.ts.map +1 -0
- package/dist/image-cloud-auto-init.js +215 -244
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +235 -264
- 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 +23 -1637
- package/dist/index.d.ts.map +1 -0
- package/dist/layouts/ClusterPlacementLayout.d.ts +40 -0
- package/dist/layouts/ClusterPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/GridPlacementLayout.d.ts +27 -0
- package/dist/layouts/GridPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/RadialPlacementLayout.d.ts +33 -0
- package/dist/layouts/RadialPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/RandomPlacementLayout.d.ts +26 -0
- package/dist/layouts/RandomPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/SpiralPlacementLayout.d.ts +43 -0
- package/dist/layouts/SpiralPlacementLayout.d.ts.map +1 -0
- package/dist/layouts/WavePlacementLayout.d.ts +48 -0
- package/dist/layouts/WavePlacementLayout.d.ts.map +1 -0
- package/dist/loaders/CompositeLoader.d.ts +37 -0
- package/dist/loaders/CompositeLoader.d.ts.map +1 -0
- package/dist/loaders/GoogleDriveLoader.d.ts +90 -0
- package/dist/loaders/GoogleDriveLoader.d.ts.map +1 -0
- package/dist/loaders/ImageFilter.d.ts +26 -0
- package/dist/loaders/ImageFilter.d.ts.map +1 -0
- package/dist/loaders/StaticImageLoader.d.ts +85 -0
- package/dist/loaders/StaticImageLoader.d.ts.map +1 -0
- package/dist/react/index.d.ts +16 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react.d.ts +1 -1637
- package/dist/react.js +326 -355
- package/dist/react.js.map +1 -1
- package/dist/styles/functionalStyles.d.ts +11 -0
- package/dist/styles/functionalStyles.d.ts.map +1 -0
- package/dist/utils/styleUtils.d.ts +54 -0
- package/dist/utils/styleUtils.d.ts.map +1 -0
- package/dist/vue/index.d.ts +18 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue.d.ts +1 -1637
- package/dist/vue.js +235 -264
- package/dist/vue.js.map +1 -1
- package/dist/web-component/index.d.ts +15 -0
- package/dist/web-component/index.d.ts.map +1 -0
- package/dist/web-component.d.ts +1 -1637
- package/dist/web-component.js +201 -230
- package/dist/web-component.js.map +1 -1
- package/package.json +11 -5
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as Ot } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as $t, useRef as wt, useImperativeHandle as Ut, useEffect as Pt } from "react";
|
|
3
|
-
const
|
|
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)",
|
|
@@ -10,12 +10,12 @@ const ft = 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 })
|
|
13
|
-
}),
|
|
13
|
+
}), St = Object.freeze({
|
|
14
14
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
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
|
+
}), Et = 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 }),
|
|
@@ -26,7 +26,7 @@ const ft = Object.freeze({
|
|
|
26
26
|
mode: "none"
|
|
27
27
|
}), yt = Object.freeze({
|
|
28
28
|
mode: "none"
|
|
29
|
-
}),
|
|
29
|
+
}), Tt = Object.freeze({
|
|
30
30
|
default: Object.freeze({
|
|
31
31
|
border: Object.freeze({
|
|
32
32
|
width: 0,
|
|
@@ -82,12 +82,12 @@ const ft = Object.freeze({
|
|
|
82
82
|
}), Ct = Object.freeze({
|
|
83
83
|
sizing: Nt,
|
|
84
84
|
rotation: jt
|
|
85
|
-
}),
|
|
85
|
+
}), Rt = Object.freeze({
|
|
86
86
|
validateUrls: !0,
|
|
87
87
|
validationTimeout: 5e3,
|
|
88
88
|
validationMethod: "head",
|
|
89
89
|
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
|
|
90
|
-
}),
|
|
90
|
+
}), Mt = Object.freeze({
|
|
91
91
|
enabled: !1,
|
|
92
92
|
centers: !1,
|
|
93
93
|
loaders: !1
|
|
@@ -96,8 +96,8 @@ const ft = Object.freeze({
|
|
|
96
96
|
loaders: [],
|
|
97
97
|
// Shared loader settings and debug config
|
|
98
98
|
config: Object.freeze({
|
|
99
|
-
loaders:
|
|
100
|
-
debug:
|
|
99
|
+
loaders: Rt,
|
|
100
|
+
debug: Mt
|
|
101
101
|
}),
|
|
102
102
|
// Image sizing and rotation configuration
|
|
103
103
|
image: Ct,
|
|
@@ -221,7 +221,7 @@ const ft = Object.freeze({
|
|
|
221
221
|
})
|
|
222
222
|
}),
|
|
223
223
|
// Image styling
|
|
224
|
-
styling:
|
|
224
|
+
styling: Tt
|
|
225
225
|
});
|
|
226
226
|
function Z(n, t) {
|
|
227
227
|
if (!n) return t || {};
|
|
@@ -303,7 +303,7 @@ function Yt(n = {}) {
|
|
|
303
303
|
});
|
|
304
304
|
const r = {
|
|
305
305
|
loaders: {
|
|
306
|
-
...
|
|
306
|
+
...Rt,
|
|
307
307
|
...n.config?.loaders ?? {}
|
|
308
308
|
}
|
|
309
309
|
}, a = {
|
|
@@ -314,7 +314,7 @@ function Yt(n = {}) {
|
|
|
314
314
|
animation: { ...y.animation },
|
|
315
315
|
interaction: { ...y.interaction },
|
|
316
316
|
rendering: { ...y.rendering },
|
|
317
|
-
styling: kt(
|
|
317
|
+
styling: kt(Tt, n.styling)
|
|
318
318
|
};
|
|
319
319
|
return n.layout && (a.layout = {
|
|
320
320
|
...y.layout,
|
|
@@ -377,7 +377,7 @@ function Yt(n = {}) {
|
|
|
377
377
|
...y.rendering.performance,
|
|
378
378
|
...n.rendering.performance
|
|
379
379
|
})), a.config.debug = {
|
|
380
|
-
...
|
|
380
|
+
...Mt,
|
|
381
381
|
...n.config?.debug ?? {}
|
|
382
382
|
}, a;
|
|
383
383
|
}
|
|
@@ -385,10 +385,10 @@ function Xt(n, t) {
|
|
|
385
385
|
return { ...n ? xt[n] : xt.playful, ...t };
|
|
386
386
|
}
|
|
387
387
|
function Bt(n, t) {
|
|
388
|
-
return { ...n ?
|
|
388
|
+
return { ...n ? St[n] : St.gentle, ...t };
|
|
389
389
|
}
|
|
390
390
|
function Jt(n, t) {
|
|
391
|
-
return { ...n ?
|
|
391
|
+
return { ...n ? Et[n] : Et.gentle, ...t };
|
|
392
392
|
}
|
|
393
393
|
class Vt {
|
|
394
394
|
constructor(t) {
|
|
@@ -417,11 +417,11 @@ class Vt {
|
|
|
417
417
|
*/
|
|
418
418
|
animateTransformCancellable(t, e, i, o = null, s = null) {
|
|
419
419
|
this.cancelAllAnimations(t);
|
|
420
|
-
const r = o ?? this.config.duration, a = s ?? this.config.easing.default,
|
|
420
|
+
const r = o ?? this.config.duration, a = s ?? this.config.easing.default, h = this.buildTransformString(e), c = this.buildTransformString(i);
|
|
421
421
|
t.style.transition = "none";
|
|
422
422
|
const u = t.animate(
|
|
423
423
|
[
|
|
424
|
-
{ transform:
|
|
424
|
+
{ transform: h },
|
|
425
425
|
{ transform: c }
|
|
426
426
|
],
|
|
427
427
|
{
|
|
@@ -430,7 +430,7 @@ class Vt {
|
|
|
430
430
|
fill: "forwards"
|
|
431
431
|
// Keep final state after animation
|
|
432
432
|
}
|
|
433
|
-
),
|
|
433
|
+
), l = {
|
|
434
434
|
id: `anim-${++this.animationIdCounter}`,
|
|
435
435
|
element: t,
|
|
436
436
|
animation: u,
|
|
@@ -439,11 +439,11 @@ class Vt {
|
|
|
439
439
|
startTime: performance.now(),
|
|
440
440
|
duration: r
|
|
441
441
|
};
|
|
442
|
-
return this.activeAnimations.set(t,
|
|
442
|
+
return this.activeAnimations.set(t, l), u.finished.then(() => {
|
|
443
443
|
t.style.transform = c, this.activeAnimations.delete(t);
|
|
444
444
|
}).catch(() => {
|
|
445
445
|
this.activeAnimations.delete(t);
|
|
446
|
-
}),
|
|
446
|
+
}), l;
|
|
447
447
|
}
|
|
448
448
|
/**
|
|
449
449
|
* Cancel an active animation
|
|
@@ -486,8 +486,8 @@ class Vt {
|
|
|
486
486
|
const i = getComputedStyle(t).transform;
|
|
487
487
|
if (i === "none" || !i)
|
|
488
488
|
return { x: 0, y: 0, rotation: 0, scale: 1 };
|
|
489
|
-
const o = new DOMMatrix(i), s = Math.sqrt(o.a * o.a + o.b * o.b), r = Math.atan2(o.b, o.a) * (180 / Math.PI), a = o.e,
|
|
490
|
-
return { x: a, y:
|
|
489
|
+
const o = new DOMMatrix(i), s = Math.sqrt(o.a * o.a + o.b * o.b), r = Math.atan2(o.b, o.a) * (180 / Math.PI), a = o.e, h = o.f;
|
|
490
|
+
return { x: a, y: h, rotation: r, scale: s };
|
|
491
491
|
}
|
|
492
492
|
/**
|
|
493
493
|
* Check if an element has an active animation
|
|
@@ -550,27 +550,27 @@ function V(n, t, e) {
|
|
|
550
550
|
return n + (t - n) * e;
|
|
551
551
|
}
|
|
552
552
|
function Kt(n, t, e, i) {
|
|
553
|
-
const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x,
|
|
554
|
-
let u = 0,
|
|
553
|
+
const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x, h = e.y - t.y, c = Zt(s, r);
|
|
554
|
+
let u = 0, l = 0, d = 1, m = o, b = !1;
|
|
555
555
|
for (let g = 0; g < c.length; g++)
|
|
556
556
|
if (n <= c[g].time) {
|
|
557
|
-
|
|
557
|
+
l = g === 0 ? 0 : c[g - 1].time, d = c[g].time, m = c[g].overshoot, b = c[g].isOvershoot;
|
|
558
558
|
break;
|
|
559
559
|
}
|
|
560
|
-
const p = (n -
|
|
560
|
+
const p = (n - l) / (d - l);
|
|
561
561
|
if (b)
|
|
562
|
-
u = 1 +
|
|
563
|
-
else if (
|
|
562
|
+
u = 1 + m * ot(p);
|
|
563
|
+
else if (l === 0)
|
|
564
564
|
u = ot(p);
|
|
565
565
|
else {
|
|
566
|
-
const
|
|
567
|
-
(
|
|
568
|
-
)?.overshoot ||
|
|
569
|
-
u = V(
|
|
566
|
+
const f = 1 + (c.find(
|
|
567
|
+
(S, v) => S.time > l && v > 0 && c[v - 1].isOvershoot
|
|
568
|
+
)?.overshoot || m);
|
|
569
|
+
u = V(f, 1, ot(p));
|
|
570
570
|
}
|
|
571
571
|
return {
|
|
572
572
|
x: t.x + a * u,
|
|
573
|
-
y: t.y +
|
|
573
|
+
y: t.y + h * u
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
576
|
function Zt(n, t) {
|
|
@@ -584,23 +584,23 @@ function Zt(n, t) {
|
|
|
584
584
|
return e.push({ time: 1, overshoot: 0, isOvershoot: !1 }), e;
|
|
585
585
|
}
|
|
586
586
|
function Qt(n, t, e, i) {
|
|
587
|
-
const { stiffness: o, damping: s, mass: r, oscillations: a } = i,
|
|
587
|
+
const { stiffness: o, damping: s, mass: r, oscillations: a } = i, h = e.x - t.x, c = e.y - t.y, u = Math.sqrt(o / r), l = s / (2 * Math.sqrt(o * r));
|
|
588
588
|
let d;
|
|
589
|
-
if (
|
|
590
|
-
const
|
|
589
|
+
if (l < 1) {
|
|
590
|
+
const m = u * Math.sqrt(1 - l * l), b = Math.exp(-l * u * n * 3), p = Math.cos(m * n * a * Math.PI);
|
|
591
591
|
d = 1 - b * p;
|
|
592
592
|
} else
|
|
593
593
|
d = 1 - Math.exp(-u * n * 3);
|
|
594
594
|
return d = Math.max(0, Math.min(d, 1.3)), {
|
|
595
|
-
x: t.x +
|
|
595
|
+
x: t.x + h * d,
|
|
596
596
|
y: t.y + c * d
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
599
|
function te(n, t, e, i) {
|
|
600
|
-
const { amplitude: o, frequency: s, decay: r, decayRate: a, phase:
|
|
600
|
+
const { amplitude: o, frequency: s, decay: r, decayRate: a, phase: h } = i, c = e.x - t.x, u = e.y - t.y, l = Math.sqrt(c * c + u * u), d = l > 0 ? -u / l : 0, m = l > 0 ? c / l : 1, b = s * Math.PI * 2 * n + h, p = r ? Math.pow(1 - n, a) : 1, g = o * Math.sin(b) * p, f = ee(n);
|
|
601
601
|
return {
|
|
602
|
-
x: V(t.x, e.x,
|
|
603
|
-
y: V(t.y, e.y,
|
|
602
|
+
x: V(t.x, e.x, f) + g * d,
|
|
603
|
+
y: V(t.y, e.y, f) + g * m
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
function ot(n) {
|
|
@@ -610,8 +610,8 @@ function ee(n) {
|
|
|
610
610
|
return 1 - Math.pow(1 - n, 3);
|
|
611
611
|
}
|
|
612
612
|
function ie(n, t, e) {
|
|
613
|
-
const { amplitude: i, frequency: o, decay: s } = e, r = Math.sin(n * o * Math.PI * 2), a = s ? Math.pow(1 - n, 2) : 1,
|
|
614
|
-
return t +
|
|
613
|
+
const { amplitude: i, frequency: o, decay: s } = e, r = Math.sin(n * o * Math.PI * 2), a = s ? Math.pow(1 - n, 2) : 1, h = i * r * a;
|
|
614
|
+
return t + h;
|
|
615
615
|
}
|
|
616
616
|
function ne(n, t, e) {
|
|
617
617
|
const { overshoot: i, bounces: o } = e, s = [];
|
|
@@ -620,18 +620,18 @@ function ne(n, t, e) {
|
|
|
620
620
|
const a = 0.5, c = 0.5 / (o * 2);
|
|
621
621
|
let u = 0.5;
|
|
622
622
|
for (let d = 0; d < o; d++) {
|
|
623
|
-
const
|
|
624
|
-
u += c, s.push({ time: u, scale:
|
|
623
|
+
const m = 1 - (r - 1) * a;
|
|
624
|
+
u += c, s.push({ time: u, scale: m }), r = 1 + (r - 1) * a * a, u += c, d < o - 1 && s.push({ time: u, scale: r });
|
|
625
625
|
}
|
|
626
626
|
s.push({ time: 1, scale: 1 });
|
|
627
|
-
let
|
|
627
|
+
let l = 1;
|
|
628
628
|
for (let d = 0; d < s.length; d++)
|
|
629
629
|
if (n <= s[d].time) {
|
|
630
|
-
const
|
|
631
|
-
|
|
630
|
+
const m = d === 0 ? 0 : s[d - 1].time, b = d === 0 ? 1 : s[d - 1].scale, p = (n - m) / (s[d].time - m), g = ot(p);
|
|
631
|
+
l = b + (s[d].scale - b) * g;
|
|
632
632
|
break;
|
|
633
633
|
}
|
|
634
|
-
return
|
|
634
|
+
return l * t;
|
|
635
635
|
}
|
|
636
636
|
function oe(n) {
|
|
637
637
|
const {
|
|
@@ -642,21 +642,21 @@ function oe(n) {
|
|
|
642
642
|
duration: s,
|
|
643
643
|
imageWidth: r,
|
|
644
644
|
imageHeight: a,
|
|
645
|
-
rotation:
|
|
645
|
+
rotation: h,
|
|
646
646
|
scale: c,
|
|
647
647
|
onComplete: u,
|
|
648
|
-
rotationConfig:
|
|
648
|
+
rotationConfig: l,
|
|
649
649
|
startRotation: d,
|
|
650
|
-
scaleConfig:
|
|
650
|
+
scaleConfig: m,
|
|
651
651
|
startScale: b
|
|
652
|
-
} = n, p = o.type, g = d !== void 0 && d !==
|
|
653
|
-
if ((p === "linear" || p === "arc") && !v && !(w ||
|
|
652
|
+
} = n, p = o.type, g = d !== void 0 && d !== h, f = l?.mode === "wobble", S = l?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, v = g || f, w = b !== void 0 && b !== c, E = m?.mode === "pop", x = m?.pop || { overshoot: 1.2, bounces: 1 };
|
|
653
|
+
if ((p === "linear" || p === "arc") && !v && !(w || E)) {
|
|
654
654
|
u && u();
|
|
655
655
|
return;
|
|
656
656
|
}
|
|
657
|
-
const
|
|
657
|
+
const L = performance.now(), z = -r / 2, P = -a / 2;
|
|
658
658
|
function _(Y) {
|
|
659
|
-
const N = Y -
|
|
659
|
+
const N = Y - L, T = Math.min(N / s, 1);
|
|
660
660
|
let D;
|
|
661
661
|
switch (p) {
|
|
662
662
|
case "bounce": {
|
|
@@ -664,7 +664,7 @@ function oe(n) {
|
|
|
664
664
|
o.bouncePreset,
|
|
665
665
|
o.bounce
|
|
666
666
|
);
|
|
667
|
-
D = Kt(
|
|
667
|
+
D = Kt(T, e, i, O);
|
|
668
668
|
break;
|
|
669
669
|
}
|
|
670
670
|
case "elastic": {
|
|
@@ -672,7 +672,7 @@ function oe(n) {
|
|
|
672
672
|
o.elasticPreset,
|
|
673
673
|
o.elastic
|
|
674
674
|
);
|
|
675
|
-
D = Qt(
|
|
675
|
+
D = Qt(T, e, i, O);
|
|
676
676
|
break;
|
|
677
677
|
}
|
|
678
678
|
case "wave": {
|
|
@@ -680,20 +680,20 @@ function oe(n) {
|
|
|
680
680
|
o.wavePreset,
|
|
681
681
|
o.wave
|
|
682
682
|
);
|
|
683
|
-
D = te(
|
|
683
|
+
D = te(T, e, i, O);
|
|
684
684
|
break;
|
|
685
685
|
}
|
|
686
686
|
default:
|
|
687
687
|
D = {
|
|
688
|
-
x: V(e.x, i.x,
|
|
689
|
-
y: V(e.y, i.y,
|
|
688
|
+
x: V(e.x, i.x, T),
|
|
689
|
+
y: V(e.y, i.y, T)
|
|
690
690
|
};
|
|
691
691
|
}
|
|
692
692
|
const k = D.x - i.x, H = D.y - i.y;
|
|
693
|
-
let
|
|
694
|
-
|
|
693
|
+
let R;
|
|
694
|
+
f ? R = ie(T, h, S) : g ? R = V(d, h, T) : R = h;
|
|
695
695
|
let C;
|
|
696
|
-
|
|
696
|
+
E ? C = ne(T, c, x) : w ? C = V(b, c, T) : C = c, t.style.transform = `translate(${z}px, ${P}px) translate(${k}px, ${H}px) rotate(${R}deg) scale(${C})`, T < 1 ? requestAnimationFrame(_) : (t.style.transform = `translate(${z}px, ${P}px) rotate(${h}deg) scale(${c})`, u && u());
|
|
697
697
|
}
|
|
698
698
|
requestAnimationFrame(_);
|
|
699
699
|
}
|
|
@@ -754,9 +754,9 @@ class re {
|
|
|
754
754
|
* Calculate start position from the nearest edge (current default behavior)
|
|
755
755
|
*/
|
|
756
756
|
calculateNearestEdge(t, e, i, o) {
|
|
757
|
-
const s = t.x, r = t.y, a = s,
|
|
758
|
-
let d = t.x,
|
|
759
|
-
return
|
|
757
|
+
const s = t.x, r = t.y, a = s, h = i.width - s, c = r, u = i.height - r, l = Math.min(a, h, c, u);
|
|
758
|
+
let d = t.x, m = t.y;
|
|
759
|
+
return l === a ? d = -(e.width + o) : l === h ? d = i.width + o : l === c ? m = -(e.height + o) : m = i.height + o, { x: d, y: m };
|
|
760
760
|
}
|
|
761
761
|
/**
|
|
762
762
|
* Calculate start position from a specific edge
|
|
@@ -803,19 +803,19 @@ class re {
|
|
|
803
803
|
*/
|
|
804
804
|
calculateCircularPosition(t, e, i, o, s) {
|
|
805
805
|
const r = this.config.start.circular || {}, a = r.distribution || "even";
|
|
806
|
-
let
|
|
806
|
+
let h;
|
|
807
807
|
const c = r.radius || "120%";
|
|
808
808
|
if (typeof c == "string" && c.endsWith("%")) {
|
|
809
809
|
const p = parseFloat(c) / 100;
|
|
810
|
-
|
|
810
|
+
h = Math.sqrt(
|
|
811
811
|
i.width ** 2 + i.height ** 2
|
|
812
812
|
) * p / 2;
|
|
813
813
|
} else
|
|
814
|
-
|
|
814
|
+
h = typeof c == "number" ? c : 500;
|
|
815
815
|
let u;
|
|
816
816
|
a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
817
|
-
const
|
|
818
|
-
return { x:
|
|
817
|
+
const l = i.width / 2, d = i.height / 2, m = l + Math.cos(u) * h, b = d + Math.sin(u) * h;
|
|
818
|
+
return { x: m, y: b };
|
|
819
819
|
}
|
|
820
820
|
/**
|
|
821
821
|
* Get animation parameters for an image
|
|
@@ -834,9 +834,9 @@ class re {
|
|
|
834
834
|
* Build a CSS transform string for the start position
|
|
835
835
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
836
836
|
*/
|
|
837
|
-
buildStartTransform(t, e, i, o, s, r, a,
|
|
838
|
-
const c = t.x - e.x, u = t.y - e.y,
|
|
839
|
-
return t.useScale ? `${p} translate(${c}px, ${u}px) rotate(${
|
|
837
|
+
buildStartTransform(t, e, i, o, s, r, a, h) {
|
|
838
|
+
const c = t.x - e.x, u = t.y - e.y, l = a !== void 0 ? a : i, d = h !== void 0 ? h : o, m = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${m}px, ${b}px)` : "translate(-50%, -50%)";
|
|
839
|
+
return t.useScale ? `${p} translate(${c}px, ${u}px) rotate(${l}deg) scale(0)` : `${p} translate(${c}px, ${u}px) rotate(${l}deg) scale(${d})`;
|
|
840
840
|
}
|
|
841
841
|
/**
|
|
842
842
|
* Build the final CSS transform string
|
|
@@ -963,7 +963,7 @@ class re {
|
|
|
963
963
|
amplitude: 15,
|
|
964
964
|
frequency: 3,
|
|
965
965
|
decay: !0
|
|
966
|
-
}, { amplitude: o, frequency: s, decay: r } = i, a = Math.sin(t * s * Math.PI * 2),
|
|
966
|
+
}, { amplitude: o, frequency: s, decay: r } = i, a = Math.sin(t * s * Math.PI * 2), h = r ? Math.pow(1 - t, 2) : 1, c = o * a * h;
|
|
967
967
|
return e + c;
|
|
968
968
|
}
|
|
969
969
|
/**
|
|
@@ -1022,10 +1022,10 @@ class re {
|
|
|
1022
1022
|
bounces: 1
|
|
1023
1023
|
}, { overshoot: o, bounces: s } = i, r = this.generateScaleBounceKeyframes(s, o);
|
|
1024
1024
|
let a = e;
|
|
1025
|
-
for (let
|
|
1026
|
-
if (t <= r[
|
|
1027
|
-
const c =
|
|
1028
|
-
a = u + (r[
|
|
1025
|
+
for (let h = 0; h < r.length; h++)
|
|
1026
|
+
if (t <= r[h].time) {
|
|
1027
|
+
const c = h === 0 ? 0 : r[h - 1].time, u = h === 0 ? e : r[h - 1].scale, l = (t - c) / (r[h].time - c), d = this.easeOutQuad(l);
|
|
1028
|
+
a = u + (r[h].scale - u) * d;
|
|
1029
1029
|
break;
|
|
1030
1030
|
}
|
|
1031
1031
|
return a * e;
|
|
@@ -1038,10 +1038,10 @@ class re {
|
|
|
1038
1038
|
i.push({ time: 0.5, scale: e });
|
|
1039
1039
|
let o = e;
|
|
1040
1040
|
const s = 0.5, a = 0.5 / (t * 2);
|
|
1041
|
-
let
|
|
1041
|
+
let h = 0.5;
|
|
1042
1042
|
for (let c = 0; c < t; c++) {
|
|
1043
1043
|
const u = 1 - (o - 1) * s;
|
|
1044
|
-
|
|
1044
|
+
h += a, i.push({ time: h, scale: u }), o = 1 + (o - 1) * s * s, h += a, c < t - 1 && i.push({ time: h, scale: o });
|
|
1045
1045
|
}
|
|
1046
1046
|
return i.push({ time: 1, scale: 1 }), i;
|
|
1047
1047
|
}
|
|
@@ -1064,12 +1064,12 @@ class ce {
|
|
|
1064
1064
|
* @returns Array of layout objects with position, rotation, scale
|
|
1065
1065
|
*/
|
|
1066
1066
|
generate(t, e, i = {}) {
|
|
1067
|
-
const o = [], { width: s, height: r } = e, a = this.config.spacing.padding,
|
|
1067
|
+
const o = [], { width: s, height: r } = e, a = this.config.spacing.padding, h = i.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || m !== 1, g = h * 1.5 / 2, f = h / 2, S = s - a - g, v = r - a - f, w = a + g, E = a + f;
|
|
1068
1068
|
for (let x = 0; x < t; x++) {
|
|
1069
|
-
const
|
|
1069
|
+
const A = this.random(w, S), L = this.random(E, v), z = c === "random" ? this.random(u, l) : 0, P = b ? this.random(d, m) : 1, _ = h * P, Y = {
|
|
1070
1070
|
id: x,
|
|
1071
|
-
x:
|
|
1072
|
-
y:
|
|
1071
|
+
x: A,
|
|
1072
|
+
y: L,
|
|
1073
1073
|
rotation: z,
|
|
1074
1074
|
scale: P,
|
|
1075
1075
|
baseSize: _
|
|
@@ -1100,16 +1100,16 @@ class le {
|
|
|
1100
1100
|
* @returns Array of layout objects with position, rotation, scale
|
|
1101
1101
|
*/
|
|
1102
1102
|
generate(t, e, i = {}) {
|
|
1103
|
-
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200,
|
|
1103
|
+
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, l = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, m = l !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = i.fixedHeight ?? a, g = s / 2, f = r / 2, S = Math.ceil(Math.sqrt(t));
|
|
1104
1104
|
if (t > 0) {
|
|
1105
|
-
const
|
|
1105
|
+
const E = m ? this.random(l, d) : 1, x = p * E;
|
|
1106
1106
|
o.push({
|
|
1107
1107
|
id: 0,
|
|
1108
1108
|
x: g,
|
|
1109
|
-
y:
|
|
1110
|
-
rotation:
|
|
1109
|
+
y: f,
|
|
1110
|
+
rotation: h === "random" ? this.random(c * 0.33, u * 0.33) : 0,
|
|
1111
1111
|
// Less rotation for center
|
|
1112
|
-
scale:
|
|
1112
|
+
scale: E,
|
|
1113
1113
|
baseSize: x,
|
|
1114
1114
|
zIndex: 100
|
|
1115
1115
|
// Center image is highest
|
|
@@ -1117,25 +1117,25 @@ class le {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
let v = 1, w = 1;
|
|
1119
1119
|
for (; v < t; ) {
|
|
1120
|
-
const
|
|
1120
|
+
const E = w / S, x = b > 0 ? 1 - E * b * 0.5 : 1, A = w * (p * 0.8), L = A * 1.5, z = Math.PI * (3 * (L + A) - Math.sqrt((3 * L + A) * (L + 3 * A))), P = this.estimateWidth(p), _ = Math.floor(z / (P * 0.7));
|
|
1121
1121
|
if (_ === 0) {
|
|
1122
1122
|
w++;
|
|
1123
1123
|
continue;
|
|
1124
1124
|
}
|
|
1125
1125
|
const Y = 2 * Math.PI / _, N = w * (20 * Math.PI / 180);
|
|
1126
|
-
for (let
|
|
1127
|
-
const D =
|
|
1128
|
-
let C = g + Math.cos(D) *
|
|
1129
|
-
const $ = this.config.spacing.padding ?? 50, U =
|
|
1130
|
-
C - U < $ ? C = $ + U : C + U > s - $ && (C = s - $ - U), O -
|
|
1131
|
-
const W =
|
|
1126
|
+
for (let T = 0; T < _ && v < t; T++) {
|
|
1127
|
+
const D = T * Y + N, k = m ? this.random(l, d) : 1, H = x * k, R = p * H;
|
|
1128
|
+
let C = g + Math.cos(D) * L, O = f + Math.sin(D) * A;
|
|
1129
|
+
const $ = this.config.spacing.padding ?? 50, U = R * 1.5 / 2, M = R / 2;
|
|
1130
|
+
C - U < $ ? C = $ + U : C + U > s - $ && (C = s - $ - U), O - M < $ ? O = $ + M : O + M > r - $ && (O = r - $ - M);
|
|
1131
|
+
const W = h === "random" ? this.random(c, u) : 0;
|
|
1132
1132
|
o.push({
|
|
1133
1133
|
id: v,
|
|
1134
1134
|
x: C,
|
|
1135
1135
|
y: O,
|
|
1136
1136
|
rotation: W,
|
|
1137
1137
|
scale: H,
|
|
1138
|
-
baseSize:
|
|
1138
|
+
baseSize: R,
|
|
1139
1139
|
zIndex: Math.max(1, 100 - w)
|
|
1140
1140
|
// Outer rings have lower z-index
|
|
1141
1141
|
}), v++;
|
|
@@ -1203,50 +1203,50 @@ class de {
|
|
|
1203
1203
|
* @returns Array of layout objects with position, rotation, scale
|
|
1204
1204
|
*/
|
|
1205
1205
|
generate(t, e, i = {}) {
|
|
1206
|
-
const o = [], { width: s, height: r } = e, a = { ...he, ...this.config.grid },
|
|
1206
|
+
const o = [], { width: s, height: r } = e, a = { ...he, ...this.config.grid }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, m = l !== 1 || d !== 1, b = s - 2 * h, p = r - 2 * h, { columns: g, rows: f } = this.calculateGridDimensions(
|
|
1207
1207
|
t,
|
|
1208
1208
|
b,
|
|
1209
1209
|
p,
|
|
1210
1210
|
c,
|
|
1211
1211
|
a
|
|
1212
|
-
),
|
|
1212
|
+
), S = a.stagger === "row", v = a.stagger === "column", w = S ? g + 0.5 : g, E = v ? f + 0.5 : f, x = (b - a.gap * (g - 1)) / w, A = (p - a.gap * (f - 1)) / E, L = S ? x / 2 : 0, z = v ? A / 2 : 0, P = 1 + a.overlap, _ = Math.min(x, A) * P, Y = i.fixedHeight ? Math.min(i.fixedHeight, _) : _, N = g * x + (g - 1) * a.gap + L, T = f * A + (f - 1) * a.gap + z, D = h + (b - N) / 2, k = h + (p - T) / 2, H = g * f, R = a.columns !== "auto" && a.rows !== "auto", C = R && t > H;
|
|
1213
1213
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1214
1214
|
gridConfigColumns: a.columns,
|
|
1215
1215
|
gridConfigRows: a.rows,
|
|
1216
1216
|
columns: g,
|
|
1217
|
-
rows:
|
|
1217
|
+
rows: f,
|
|
1218
1218
|
cellCount: H,
|
|
1219
|
-
hasFixedGrid:
|
|
1219
|
+
hasFixedGrid: R,
|
|
1220
1220
|
imageCount: t,
|
|
1221
1221
|
isOverflowMode: C
|
|
1222
1222
|
});
|
|
1223
|
-
const O = C ? new Array(H).fill(0) : [], $ = Math.min(x,
|
|
1223
|
+
const O = C ? new Array(H).fill(0) : [], $ = Math.min(x, A) * a.overflowOffset;
|
|
1224
1224
|
for (let F = 0; F < t; F++) {
|
|
1225
|
-
let U,
|
|
1225
|
+
let U, M, W = 0;
|
|
1226
1226
|
if (C && F >= H) {
|
|
1227
1227
|
const q = F - H, j = q % H;
|
|
1228
|
-
W = Math.floor(q / H) + 1, O[j]++, a.fillDirection === "row" ? (U = j % g,
|
|
1228
|
+
W = Math.floor(q / H) + 1, O[j]++, a.fillDirection === "row" ? (U = j % g, M = Math.floor(j / g)) : (M = j % f, U = Math.floor(j / f));
|
|
1229
1229
|
} else
|
|
1230
|
-
a.fillDirection === "row" ? (U = F % g,
|
|
1231
|
-
let G = D + U * (x + a.gap) + x / 2, X = k +
|
|
1232
|
-
if (a.stagger === "row" &&
|
|
1230
|
+
a.fillDirection === "row" ? (U = F % g, M = Math.floor(F / g)) : (M = F % f, U = Math.floor(F / f));
|
|
1231
|
+
let G = D + U * (x + a.gap) + x / 2, X = k + M * (A + a.gap) + A / 2;
|
|
1232
|
+
if (a.stagger === "row" && M % 2 === 1 ? G += x / 2 : a.stagger === "column" && U % 2 === 1 && (X += A / 2), W > 0) {
|
|
1233
1233
|
const q = (W - 1) % It.length, j = It[q];
|
|
1234
1234
|
G += j.x * $, X += j.y * $;
|
|
1235
1235
|
}
|
|
1236
1236
|
if (a.jitter > 0) {
|
|
1237
|
-
const q = x / 2 * a.jitter, j =
|
|
1237
|
+
const q = x / 2 * a.jitter, j = A / 2 * a.jitter;
|
|
1238
1238
|
G += this.random(-q, q), X += this.random(-j, j);
|
|
1239
1239
|
}
|
|
1240
1240
|
let B = G, J = X;
|
|
1241
1241
|
if (!C && a.fillDirection === "row") {
|
|
1242
1242
|
const q = t % g || g;
|
|
1243
|
-
if (
|
|
1243
|
+
if (M === Math.floor((t - 1) / g) && q < g) {
|
|
1244
1244
|
const vt = q * x + (q - 1) * a.gap;
|
|
1245
1245
|
let gt = 0;
|
|
1246
1246
|
a.alignment === "center" ? gt = (N - vt) / 2 : a.alignment === "end" && (gt = N - vt), B += gt;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
const rt =
|
|
1249
|
+
const rt = m ? this.random(l, d) : 1, K = Y * rt, it = K * 1.5 / 2, nt = K / 2, lt = h + it, ht = s - h - it, Ft = h + nt, Dt = r - h - nt;
|
|
1250
1250
|
B = Math.max(lt, Math.min(B, ht)), J = Math.max(Ft, Math.min(J, Dt));
|
|
1251
1251
|
let dt = 0;
|
|
1252
1252
|
if (u === "random") {
|
|
@@ -1278,8 +1278,8 @@ class de {
|
|
|
1278
1278
|
else if (s.rows !== "auto")
|
|
1279
1279
|
a = s.rows, r = Math.ceil(t / a);
|
|
1280
1280
|
else {
|
|
1281
|
-
const
|
|
1282
|
-
for (r = Math.max(1, Math.round(Math.sqrt(t *
|
|
1281
|
+
const h = e / i;
|
|
1282
|
+
for (r = Math.max(1, Math.round(Math.sqrt(t * h / 1.4))), a = Math.ceil(t / r); r > 1 && (r - 1) * a >= t; )
|
|
1283
1283
|
r--;
|
|
1284
1284
|
}
|
|
1285
1285
|
return { columns: Math.max(1, r), rows: Math.max(1, a) };
|
|
@@ -1298,7 +1298,7 @@ const ue = Math.PI * (3 - Math.sqrt(5)), ge = {
|
|
|
1298
1298
|
scaleDecay: 0,
|
|
1299
1299
|
startAngle: 0
|
|
1300
1300
|
};
|
|
1301
|
-
class
|
|
1301
|
+
class me {
|
|
1302
1302
|
constructor(t, e = {}) {
|
|
1303
1303
|
this.config = t, this.imageConfig = e;
|
|
1304
1304
|
}
|
|
@@ -1310,35 +1310,35 @@ class fe {
|
|
|
1310
1310
|
* @returns Array of layout objects with position, rotation, scale
|
|
1311
1311
|
*/
|
|
1312
1312
|
generate(t, e, i = {}) {
|
|
1313
|
-
const o = [], { width: s, height: r } = e, a = { ...ge, ...this.config.spiral },
|
|
1314
|
-
|
|
1315
|
-
|
|
1313
|
+
const o = [], { width: s, height: r } = e, a = { ...ge, ...this.config.spiral }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = m !== 1 || b !== 1, g = this.config.scaleDecay ?? a.scaleDecay, f = s / 2, S = r / 2, v = Math.min(
|
|
1314
|
+
f - h - c / 2,
|
|
1315
|
+
S - h - c / 2
|
|
1316
1316
|
), w = a.direction === "clockwise" ? -1 : 1;
|
|
1317
|
-
for (let
|
|
1318
|
-
let x,
|
|
1317
|
+
for (let E = 0; E < t; E++) {
|
|
1318
|
+
let x, A;
|
|
1319
1319
|
if (a.spiralType === "golden")
|
|
1320
|
-
x =
|
|
1320
|
+
x = E * ue * w + a.startAngle, A = this.calculateGoldenRadius(E, t, v, a.tightness);
|
|
1321
1321
|
else if (a.spiralType === "archimedean") {
|
|
1322
|
-
const G =
|
|
1323
|
-
x = G * w + a.startAngle,
|
|
1322
|
+
const G = E * 0.5 * a.tightness;
|
|
1323
|
+
x = G * w + a.startAngle, A = this.calculateArchimedeanRadius(G, t, v, a.tightness);
|
|
1324
1324
|
} else {
|
|
1325
|
-
const G =
|
|
1326
|
-
x = G * w + a.startAngle,
|
|
1325
|
+
const G = E * 0.3 * a.tightness;
|
|
1326
|
+
x = G * w + a.startAngle, A = this.calculateLogarithmicRadius(G, t, v, a.tightness);
|
|
1327
1327
|
}
|
|
1328
|
-
const
|
|
1329
|
-
let
|
|
1328
|
+
const L = f + Math.cos(x) * A, z = S + Math.sin(x) * A, P = A / v, _ = g > 0 ? 1 - P * g * 0.5 : 1, Y = p ? this.random(m, b) : 1, N = _ * Y, T = c * N, k = T * 1.5 / 2, H = T / 2, R = h + k, C = s - h - k, O = h + H, $ = r - h - H, F = Math.max(R, Math.min(L, C)), U = Math.max(O, Math.min(z, $));
|
|
1329
|
+
let M = 0;
|
|
1330
1330
|
if (u === "random") {
|
|
1331
|
-
const G = x * 180 / Math.PI % 360, X = this.random(
|
|
1332
|
-
|
|
1333
|
-
} else u === "tangent" && (
|
|
1334
|
-
const W = t -
|
|
1331
|
+
const G = x * 180 / Math.PI % 360, X = this.random(l, d);
|
|
1332
|
+
M = a.spiralType === "golden" ? X : G * 0.1 + X * 0.9;
|
|
1333
|
+
} else u === "tangent" && (M = this.calculateSpiralTangent(x, A, a));
|
|
1334
|
+
const W = t - E;
|
|
1335
1335
|
o.push({
|
|
1336
|
-
id:
|
|
1336
|
+
id: E,
|
|
1337
1337
|
x: F,
|
|
1338
1338
|
y: U,
|
|
1339
|
-
rotation:
|
|
1339
|
+
rotation: M,
|
|
1340
1340
|
scale: N,
|
|
1341
|
-
baseSize:
|
|
1341
|
+
baseSize: T,
|
|
1342
1342
|
zIndex: W
|
|
1343
1343
|
});
|
|
1344
1344
|
}
|
|
@@ -1382,7 +1382,7 @@ class fe {
|
|
|
1382
1382
|
* r = a * e^(b*θ)
|
|
1383
1383
|
*/
|
|
1384
1384
|
calculateLogarithmicRadius(t, e, i, o) {
|
|
1385
|
-
const s = i * 0.05, r = 0.15 / o, a = s * Math.exp(r * t),
|
|
1385
|
+
const s = i * 0.05, r = 0.15 / o, a = s * Math.exp(r * t), h = e * 0.3 * o, c = s * Math.exp(r * h);
|
|
1386
1386
|
return a / c * i;
|
|
1387
1387
|
}
|
|
1388
1388
|
/**
|
|
@@ -1392,7 +1392,7 @@ class fe {
|
|
|
1392
1392
|
return Math.random() * (e - t) + t;
|
|
1393
1393
|
}
|
|
1394
1394
|
}
|
|
1395
|
-
const
|
|
1395
|
+
const fe = {
|
|
1396
1396
|
clusterCount: "auto",
|
|
1397
1397
|
clusterSpread: 150,
|
|
1398
1398
|
clusterSpacing: 200,
|
|
@@ -1412,46 +1412,46 @@ class pe {
|
|
|
1412
1412
|
* @returns Array of layout objects with position, rotation, scale
|
|
1413
1413
|
*/
|
|
1414
1414
|
generate(t, e, i = {}) {
|
|
1415
|
-
const o = [], { width: s, height: r } = e, a = { ...
|
|
1415
|
+
const o = [], { width: s, height: r } = e, a = { ...fe, ...this.config.cluster }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = m !== 1 || b !== 1, g = this.calculateClusterCount(
|
|
1416
1416
|
t,
|
|
1417
1417
|
a.clusterCount,
|
|
1418
1418
|
s,
|
|
1419
1419
|
r,
|
|
1420
1420
|
a.clusterSpacing
|
|
1421
|
-
),
|
|
1421
|
+
), f = this.generateClusterCenters(
|
|
1422
1422
|
g,
|
|
1423
1423
|
s,
|
|
1424
1424
|
r,
|
|
1425
|
-
|
|
1425
|
+
h,
|
|
1426
1426
|
a
|
|
1427
|
-
),
|
|
1427
|
+
), S = new Array(g).fill(0);
|
|
1428
1428
|
for (let w = 0; w < t; w++)
|
|
1429
|
-
|
|
1429
|
+
S[w % g]++;
|
|
1430
1430
|
let v = 0;
|
|
1431
1431
|
for (let w = 0; w < g; w++) {
|
|
1432
|
-
const
|
|
1433
|
-
for (let
|
|
1434
|
-
let
|
|
1432
|
+
const E = f[w], x = S[w];
|
|
1433
|
+
for (let A = 0; A < x; A++) {
|
|
1434
|
+
let L, z;
|
|
1435
1435
|
if (a.distribution === "gaussian")
|
|
1436
|
-
|
|
1436
|
+
L = this.gaussianRandom() * E.spread, z = this.gaussianRandom() * E.spread;
|
|
1437
1437
|
else {
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1438
|
+
const M = this.random(0, Math.PI * 2), W = this.random(0, E.spread);
|
|
1439
|
+
L = Math.cos(M) * W, z = Math.sin(M) * W;
|
|
1440
1440
|
}
|
|
1441
1441
|
const P = 1 + a.overlap * 0.5, _ = 1 + a.overlap * 0.3;
|
|
1442
|
-
|
|
1443
|
-
const Y = p ? this.random(
|
|
1444
|
-
let D =
|
|
1445
|
-
const
|
|
1446
|
-
D = Math.max(
|
|
1447
|
-
const O = u === "random" ? this.random(
|
|
1442
|
+
L /= P, z /= P;
|
|
1443
|
+
const Y = p ? this.random(m, b) : 1, N = _ * Y, T = c * N;
|
|
1444
|
+
let D = E.x + L, k = E.y + z;
|
|
1445
|
+
const R = T * 1.5 / 2, C = T / 2;
|
|
1446
|
+
D = Math.max(h + R, Math.min(D, s - h - R)), k = Math.max(h + C, Math.min(k, r - h - C));
|
|
1447
|
+
const O = u === "random" ? this.random(l, d) : 0, F = Math.sqrt(L * L + z * z) / E.spread, U = Math.round((1 - F) * 50) + 1;
|
|
1448
1448
|
o.push({
|
|
1449
1449
|
id: v,
|
|
1450
1450
|
x: D,
|
|
1451
1451
|
y: k,
|
|
1452
1452
|
rotation: O,
|
|
1453
1453
|
scale: N,
|
|
1454
|
-
baseSize:
|
|
1454
|
+
baseSize: T,
|
|
1455
1455
|
zIndex: U
|
|
1456
1456
|
}), v++;
|
|
1457
1457
|
}
|
|
@@ -1464,33 +1464,33 @@ class pe {
|
|
|
1464
1464
|
calculateClusterCount(t, e, i, o, s) {
|
|
1465
1465
|
if (e !== "auto")
|
|
1466
1466
|
return Math.max(1, Math.min(e, t));
|
|
1467
|
-
const a = Math.max(1, Math.ceil(t / 8)),
|
|
1467
|
+
const a = Math.max(1, Math.ceil(t / 8)), h = Math.floor(
|
|
1468
1468
|
i / s * (o / s) * 0.6
|
|
1469
1469
|
);
|
|
1470
|
-
return Math.max(1, Math.min(a,
|
|
1470
|
+
return Math.max(1, Math.min(a, h, 10));
|
|
1471
1471
|
}
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Generate cluster center positions with spacing constraints
|
|
1474
1474
|
*/
|
|
1475
1475
|
generateClusterCenters(t, e, i, o, s) {
|
|
1476
|
-
const r = [],
|
|
1476
|
+
const r = [], h = o + s.clusterSpread, c = e - o - s.clusterSpread, u = o + s.clusterSpread, l = i - o - s.clusterSpread;
|
|
1477
1477
|
for (let d = 0; d < t; d++) {
|
|
1478
|
-
let
|
|
1478
|
+
let m = null, b = -1;
|
|
1479
1479
|
for (let p = 0; p < 100; p++) {
|
|
1480
1480
|
const g = {
|
|
1481
|
-
x: this.random(
|
|
1482
|
-
y: this.random(u,
|
|
1481
|
+
x: this.random(h, c),
|
|
1482
|
+
y: this.random(u, l),
|
|
1483
1483
|
spread: this.calculateClusterSpread(s)
|
|
1484
1484
|
};
|
|
1485
|
-
let
|
|
1486
|
-
for (const
|
|
1487
|
-
const v = g.x -
|
|
1488
|
-
|
|
1485
|
+
let f = 1 / 0;
|
|
1486
|
+
for (const S of r) {
|
|
1487
|
+
const v = g.x - S.x, w = g.y - S.y, E = Math.sqrt(v * v + w * w);
|
|
1488
|
+
f = Math.min(f, E);
|
|
1489
1489
|
}
|
|
1490
|
-
if ((r.length === 0 ||
|
|
1490
|
+
if ((r.length === 0 || f > b) && (m = g, b = f), f >= s.clusterSpacing)
|
|
1491
1491
|
break;
|
|
1492
1492
|
}
|
|
1493
|
-
|
|
1493
|
+
m && r.push(m);
|
|
1494
1494
|
}
|
|
1495
1495
|
return r;
|
|
1496
1496
|
}
|
|
@@ -1530,29 +1530,29 @@ class be {
|
|
|
1530
1530
|
* @returns Array of layout objects with position, rotation, scale
|
|
1531
1531
|
*/
|
|
1532
1532
|
generate(t, e, i = {}) {
|
|
1533
|
-
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200,
|
|
1533
|
+
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || m !== 1, p = i.fixedHeight ?? a, g = {
|
|
1534
1534
|
..._t,
|
|
1535
1535
|
...this.config.wave
|
|
1536
|
-
}, { rows:
|
|
1537
|
-
let
|
|
1538
|
-
for (let C = 0; C <
|
|
1539
|
-
const O =
|
|
1536
|
+
}, { rows: f, amplitude: S, frequency: v, phaseShift: w, synchronization: E } = g, x = Math.ceil(t / f), z = p * 1.5 / 2, P = h + z, _ = s - h - z, Y = _ - P, N = x > 1 ? Y / (x - 1) : 0, T = h + S + p / 2, D = r - h - S - p / 2, k = D - T, H = f > 1 ? k / (f - 1) : 0;
|
|
1537
|
+
let R = 0;
|
|
1538
|
+
for (let C = 0; C < f && R < t; C++) {
|
|
1539
|
+
const O = f === 1 ? (T + D) / 2 : T + C * H;
|
|
1540
1540
|
let $ = 0;
|
|
1541
|
-
|
|
1542
|
-
for (let F = 0; F < x &&
|
|
1543
|
-
const U = x === 1 ? (P + _) / 2 : P + F * N,
|
|
1541
|
+
E === "offset" ? $ = C * w : E === "alternating" && ($ = C * Math.PI);
|
|
1542
|
+
for (let F = 0; F < x && R < t; F++) {
|
|
1543
|
+
const U = x === 1 ? (P + _) / 2 : P + F * N, M = this.calculateWaveY(U, s, S, v, $), W = U, G = O + M, X = b ? this.random(d, m) : 1, B = p * X;
|
|
1544
1544
|
let J = 0;
|
|
1545
|
-
c === "tangent" ? J = this.calculateRotation(U, s,
|
|
1546
|
-
const K = B * 1.5 / 2, ct = B / 2, it =
|
|
1545
|
+
c === "tangent" ? J = this.calculateRotation(U, s, S, v, $) : c === "random" && (J = this.random(u, l));
|
|
1546
|
+
const K = B * 1.5 / 2, ct = B / 2, it = h + K, nt = s - h - K, lt = h + ct, ht = r - h - ct;
|
|
1547
1547
|
o.push({
|
|
1548
|
-
id:
|
|
1548
|
+
id: R,
|
|
1549
1549
|
x: Math.max(it, Math.min(W, nt)),
|
|
1550
1550
|
y: Math.max(lt, Math.min(G, ht)),
|
|
1551
1551
|
rotation: J,
|
|
1552
1552
|
scale: X,
|
|
1553
1553
|
baseSize: B,
|
|
1554
|
-
zIndex:
|
|
1555
|
-
}),
|
|
1554
|
+
zIndex: R + 1
|
|
1555
|
+
}), R++;
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
1558
|
return o;
|
|
@@ -1610,7 +1610,7 @@ class ye {
|
|
|
1610
1610
|
case "grid":
|
|
1611
1611
|
return new de(this.config, this.imageConfig);
|
|
1612
1612
|
case "spiral":
|
|
1613
|
-
return new
|
|
1613
|
+
return new me(this.config, this.imageConfig);
|
|
1614
1614
|
case "cluster":
|
|
1615
1615
|
return new pe(this.config, this.imageConfig);
|
|
1616
1616
|
case "wave":
|
|
@@ -1698,15 +1698,15 @@ class ye {
|
|
|
1698
1698
|
const s = this.imageConfig.sizing, r = this.resolveBaseHeight(o);
|
|
1699
1699
|
if (r !== void 0)
|
|
1700
1700
|
return { height: r };
|
|
1701
|
-
const a = s?.minSize ?? 50,
|
|
1702
|
-
let
|
|
1703
|
-
|
|
1704
|
-
let
|
|
1705
|
-
if (
|
|
1701
|
+
const a = s?.minSize ?? 50, h = s?.maxSize ?? 400, c = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: l, height: d } = t, p = l * d * c / e;
|
|
1702
|
+
let f = Math.sqrt(p / 1.4);
|
|
1703
|
+
f *= u, f = Math.min(f, i);
|
|
1704
|
+
let S = this.clamp(f, a, h);
|
|
1705
|
+
if (S === a && f < a) {
|
|
1706
1706
|
const v = Math.max(a * 0.05, 20);
|
|
1707
|
-
|
|
1707
|
+
S = Math.max(v, f);
|
|
1708
1708
|
}
|
|
1709
|
-
return { height:
|
|
1709
|
+
return { height: S };
|
|
1710
1710
|
}
|
|
1711
1711
|
/**
|
|
1712
1712
|
* Utility: Clamp a value between min and max
|
|
@@ -1717,10 +1717,10 @@ class ye {
|
|
|
1717
1717
|
}
|
|
1718
1718
|
var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
|
|
1719
1719
|
function ve(n) {
|
|
1720
|
-
return n in
|
|
1720
|
+
return n in mt;
|
|
1721
1721
|
}
|
|
1722
1722
|
function we(n) {
|
|
1723
|
-
return n ? ve(n) ?
|
|
1723
|
+
return n ? ve(n) ? mt[n] : n : mt.md;
|
|
1724
1724
|
}
|
|
1725
1725
|
function xe(n) {
|
|
1726
1726
|
if (!n) return "";
|
|
@@ -1748,8 +1748,8 @@ function st(n) {
|
|
|
1748
1748
|
n.borderRadiusTopLeft !== void 0 ? t.borderTopLeftRadius = `${n.borderRadiusTopLeft}px` : s && (t.borderTopLeftRadius = `${s}px`), n.borderRadiusTopRight !== void 0 ? t.borderTopRightRadius = `${n.borderRadiusTopRight}px` : s && (t.borderTopRightRadius = `${s}px`), n.borderRadiusBottomRight !== void 0 ? t.borderBottomRightRadius = `${n.borderRadiusBottomRight}px` : s && (t.borderBottomRightRadius = `${s}px`), n.borderRadiusBottomLeft !== void 0 ? t.borderBottomLeftRadius = `${n.borderRadiusBottomLeft}px` : s && (t.borderBottomLeftRadius = `${s}px`);
|
|
1749
1749
|
} else n.border?.radius !== void 0 && (t.borderRadius = `${n.border.radius}px`);
|
|
1750
1750
|
if (n.borderTop || n.borderRight || n.borderBottom || n.borderLeft) {
|
|
1751
|
-
const s = n.border || {}, r = { ...s, ...n.borderTop }, a = { ...s, ...n.borderRight },
|
|
1752
|
-
t.borderTop = Q(r), t.borderRight = Q(a), t.borderBottom = Q(
|
|
1751
|
+
const s = n.border || {}, r = { ...s, ...n.borderTop }, a = { ...s, ...n.borderRight }, h = { ...s, ...n.borderBottom }, c = { ...s, ...n.borderLeft };
|
|
1752
|
+
t.borderTop = Q(r), t.borderRight = Q(a), t.borderBottom = Q(h), t.borderLeft = Q(c);
|
|
1753
1753
|
} else n.border && (t.border = Q(n.border));
|
|
1754
1754
|
n.shadow !== void 0 && (t.boxShadow = we(n.shadow));
|
|
1755
1755
|
const o = xe(n.filter);
|
|
@@ -1762,26 +1762,26 @@ function st(n) {
|
|
|
1762
1762
|
function tt(n, t) {
|
|
1763
1763
|
t.borderRadius !== void 0 && (n.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (n.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (n.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (n.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (n.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (n.style.border = t.border), t.borderTop !== void 0 && (n.style.borderTop = t.borderTop), t.borderRight !== void 0 && (n.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (n.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (n.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (n.style.boxShadow = t.boxShadow), t.filter !== void 0 && (n.style.filter = t.filter), t.opacity !== void 0 && (n.style.opacity = t.opacity), t.cursor !== void 0 && (n.style.cursor = t.cursor), t.outline !== void 0 && (n.style.outline = t.outline), t.outlineOffset !== void 0 && (n.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (n.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (n.style.aspectRatio = t.aspectRatio);
|
|
1764
1764
|
}
|
|
1765
|
-
function
|
|
1765
|
+
function Lt(n) {
|
|
1766
1766
|
return n ? Array.isArray(n) ? n.join(" ") : n : "";
|
|
1767
1767
|
}
|
|
1768
1768
|
function et(n, t) {
|
|
1769
|
-
const e =
|
|
1769
|
+
const e = Lt(t);
|
|
1770
1770
|
e && e.split(" ").forEach((i) => {
|
|
1771
1771
|
i.trim() && n.classList.add(i.trim());
|
|
1772
1772
|
});
|
|
1773
1773
|
}
|
|
1774
1774
|
function zt(n, t) {
|
|
1775
|
-
const e =
|
|
1775
|
+
const e = Lt(t);
|
|
1776
1776
|
e && e.split(" ").forEach((i) => {
|
|
1777
1777
|
i.trim() && n.classList.remove(i.trim());
|
|
1778
1778
|
});
|
|
1779
1779
|
}
|
|
1780
|
-
const
|
|
1780
|
+
const At = {
|
|
1781
1781
|
UNFOCUSING: 999,
|
|
1782
1782
|
FOCUSING: 1e3
|
|
1783
1783
|
};
|
|
1784
|
-
class
|
|
1784
|
+
class Se {
|
|
1785
1785
|
constructor(t, e, i) {
|
|
1786
1786
|
this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = e, this.defaultStyles = st(i?.default), this.focusedStyles = st(i?.focused), this.defaultClassName = i?.default?.className, this.focusedClassName = i?.focused?.className;
|
|
1787
1787
|
}
|
|
@@ -1809,9 +1809,9 @@ class Ee {
|
|
|
1809
1809
|
*/
|
|
1810
1810
|
calculateFocusDimensions(t, e, i) {
|
|
1811
1811
|
const o = this.normalizeScalePercent(this.config.scalePercent), s = i.height * o, r = t / e;
|
|
1812
|
-
let a = s,
|
|
1812
|
+
let a = s, h = a * r;
|
|
1813
1813
|
const c = i.width * o;
|
|
1814
|
-
return
|
|
1814
|
+
return h > c && (h = c, a = h / r), { width: h, height: a };
|
|
1815
1815
|
}
|
|
1816
1816
|
/**
|
|
1817
1817
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
@@ -1842,7 +1842,7 @@ class Ee {
|
|
|
1842
1842
|
* Create a Web Animation that animates both transform (position) and dimensions
|
|
1843
1843
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
1844
1844
|
*/
|
|
1845
|
-
animateWithDimensions(t, e, i, o, s, r, a,
|
|
1845
|
+
animateWithDimensions(t, e, i, o, s, r, a, h) {
|
|
1846
1846
|
const c = this.buildDimensionZoomTransform(e), u = this.buildDimensionZoomTransform(i);
|
|
1847
1847
|
return t.style.transition = "none", t.animate(
|
|
1848
1848
|
[
|
|
@@ -1858,7 +1858,7 @@ class Ee {
|
|
|
1858
1858
|
}
|
|
1859
1859
|
],
|
|
1860
1860
|
{
|
|
1861
|
-
duration:
|
|
1861
|
+
duration: h,
|
|
1862
1862
|
easing: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1863
1863
|
fill: "forwards"
|
|
1864
1864
|
}
|
|
@@ -1883,20 +1883,20 @@ class Ee {
|
|
|
1883
1883
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1884
1884
|
*/
|
|
1885
1885
|
startFocusAnimation(t, e, i, o, s) {
|
|
1886
|
-
const r = t.style.zIndex || "", a = t.offsetWidth,
|
|
1887
|
-
this.applyFocusedStyling(t,
|
|
1888
|
-
const
|
|
1886
|
+
const r = t.style.zIndex || "", a = t.offsetWidth, h = t.offsetHeight, c = this.calculateFocusDimensions(a, h, e), u = this.calculateFocusTransform(e, i);
|
|
1887
|
+
this.applyFocusedStyling(t, At.FOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1888
|
+
const l = o ?? {
|
|
1889
1889
|
x: 0,
|
|
1890
1890
|
y: 0,
|
|
1891
1891
|
rotation: i.rotation,
|
|
1892
1892
|
scale: 1
|
|
1893
1893
|
// No scale - using dimensions
|
|
1894
|
-
}, d = s?.width ?? a,
|
|
1894
|
+
}, d = s?.width ?? a, m = s?.height ?? h, b = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
|
|
1895
1895
|
t,
|
|
1896
|
-
|
|
1896
|
+
l,
|
|
1897
1897
|
u,
|
|
1898
1898
|
d,
|
|
1899
|
-
|
|
1899
|
+
m,
|
|
1900
1900
|
c.width,
|
|
1901
1901
|
c.height,
|
|
1902
1902
|
b
|
|
@@ -1904,7 +1904,7 @@ class Ee {
|
|
|
1904
1904
|
id: `focus-${Date.now()}`,
|
|
1905
1905
|
element: t,
|
|
1906
1906
|
animation: p,
|
|
1907
|
-
fromState:
|
|
1907
|
+
fromState: l,
|
|
1908
1908
|
toState: u,
|
|
1909
1909
|
startTime: performance.now(),
|
|
1910
1910
|
duration: b
|
|
@@ -1915,7 +1915,7 @@ class Ee {
|
|
|
1915
1915
|
focusTransform: u,
|
|
1916
1916
|
originalZIndex: r,
|
|
1917
1917
|
originalWidth: a,
|
|
1918
|
-
originalHeight:
|
|
1918
|
+
originalHeight: h,
|
|
1919
1919
|
focusWidth: c.width,
|
|
1920
1920
|
focusHeight: c.height
|
|
1921
1921
|
}, {
|
|
@@ -1924,7 +1924,7 @@ class Ee {
|
|
|
1924
1924
|
animationHandle: g,
|
|
1925
1925
|
direction: "in",
|
|
1926
1926
|
originalWidth: a,
|
|
1927
|
-
originalHeight:
|
|
1927
|
+
originalHeight: h
|
|
1928
1928
|
};
|
|
1929
1929
|
}
|
|
1930
1930
|
/**
|
|
@@ -1933,40 +1933,61 @@ class Ee {
|
|
|
1933
1933
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1934
1934
|
*/
|
|
1935
1935
|
startUnfocusAnimation(t, e, i, o) {
|
|
1936
|
-
t.style.zIndex = String(
|
|
1937
|
-
const s = i ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, r = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, a = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight,
|
|
1936
|
+
t.style.zIndex = String(At.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1937
|
+
const s = i ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, r = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, a = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, h = {
|
|
1938
1938
|
x: 0,
|
|
1939
1939
|
y: 0,
|
|
1940
1940
|
rotation: e.rotation,
|
|
1941
1941
|
scale: 1
|
|
1942
1942
|
// No scale - using dimensions
|
|
1943
|
-
}, c = this.focusData?.originalWidth ?? t.offsetWidth, u = this.focusData?.originalHeight ?? t.offsetHeight,
|
|
1943
|
+
}, c = this.focusData?.originalWidth ?? t.offsetWidth, u = this.focusData?.originalHeight ?? t.offsetHeight, l = this.config.animationDuration ?? 600, d = this.animateWithDimensions(
|
|
1944
1944
|
t,
|
|
1945
1945
|
s,
|
|
1946
|
-
|
|
1946
|
+
h,
|
|
1947
1947
|
r,
|
|
1948
1948
|
a,
|
|
1949
1949
|
c,
|
|
1950
1950
|
u,
|
|
1951
|
-
|
|
1952
|
-
),
|
|
1951
|
+
l
|
|
1952
|
+
), m = {
|
|
1953
1953
|
id: `unfocus-${Date.now()}`,
|
|
1954
1954
|
element: t,
|
|
1955
1955
|
animation: d,
|
|
1956
1956
|
fromState: s,
|
|
1957
|
-
toState:
|
|
1957
|
+
toState: h,
|
|
1958
1958
|
startTime: performance.now(),
|
|
1959
|
-
duration:
|
|
1959
|
+
duration: l
|
|
1960
1960
|
};
|
|
1961
1961
|
return {
|
|
1962
1962
|
element: t,
|
|
1963
1963
|
originalState: e,
|
|
1964
|
-
animationHandle:
|
|
1964
|
+
animationHandle: m,
|
|
1965
1965
|
direction: "out",
|
|
1966
1966
|
originalWidth: c,
|
|
1967
1967
|
originalHeight: u
|
|
1968
1968
|
};
|
|
1969
1969
|
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Capture the current visual state of an element mid-animation, BEFORE cancelling.
|
|
1972
|
+
*
|
|
1973
|
+
* The computed matrix.e/f include the -50%/-50% centering offset resolved to pixels.
|
|
1974
|
+
* buildDimensionZoomTransform prepends its own translate(-50%,-50%), so passing raw
|
|
1975
|
+
* matrix.e/f doubles the centering and produces the wrong starting position.
|
|
1976
|
+
*
|
|
1977
|
+
* This method extracts the PURE positional offset (pureX = matrix.e + 0.5*midWidth)
|
|
1978
|
+
* and commits width/height/transform to inline styles before the animation is cancelled,
|
|
1979
|
+
* preventing any visual snap.
|
|
1980
|
+
*
|
|
1981
|
+
* Must be called while the animation is still running (offsetWidth reflects animated size).
|
|
1982
|
+
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
1983
|
+
*/
|
|
1984
|
+
captureMidAnimationState(t) {
|
|
1985
|
+
const e = getComputedStyle(t), i = new DOMMatrix(e.transform), o = t.offsetWidth, s = t.offsetHeight, r = i.e + o * 0.5, a = i.f + s * 0.5, h = Math.atan2(i.b, i.a) * (180 / Math.PI);
|
|
1986
|
+
return t.style.width = `${o}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${h}deg)`, t.style.transition = "none", {
|
|
1987
|
+
transform: { x: r, y: a, rotation: h, scale: 1 },
|
|
1988
|
+
dimensions: { width: o, height: s }
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1970
1991
|
/**
|
|
1971
1992
|
* Handle animation completion
|
|
1972
1993
|
*/
|
|
@@ -1992,21 +2013,12 @@ class Ee {
|
|
|
1992
2013
|
if (this.currentFocus === t && this.state === I.FOCUSED)
|
|
1993
2014
|
return this.unfocusImage();
|
|
1994
2015
|
if (this.incoming?.element === t && this.state === I.FOCUSING) {
|
|
1995
|
-
const
|
|
1996
|
-
|
|
1997
|
-
y: s.y,
|
|
1998
|
-
rotation: s.rotation,
|
|
1999
|
-
scale: 1
|
|
2000
|
-
// No scale transform - using dimensions
|
|
2001
|
-
}, a = {
|
|
2002
|
-
width: t.offsetWidth,
|
|
2003
|
-
height: t.offsetHeight
|
|
2004
|
-
};
|
|
2005
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2016
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2017
|
+
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2006
2018
|
t,
|
|
2007
2019
|
this.incoming.originalState,
|
|
2008
|
-
|
|
2009
|
-
|
|
2020
|
+
s,
|
|
2021
|
+
r
|
|
2010
2022
|
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2011
2023
|
return;
|
|
2012
2024
|
}
|
|
@@ -2048,36 +2060,18 @@ class Ee {
|
|
|
2048
2060
|
if (this.incoming?.element === t)
|
|
2049
2061
|
return;
|
|
2050
2062
|
if (this.outgoing?.element === t) {
|
|
2051
|
-
const
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
scale: 1
|
|
2056
|
-
// No scale - using dimensions
|
|
2057
|
-
}, a = {
|
|
2058
|
-
width: t.offsetWidth,
|
|
2059
|
-
height: t.offsetHeight
|
|
2060
|
-
};
|
|
2061
|
-
if (this.incoming) {
|
|
2062
|
-
const l = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), c = {
|
|
2063
|
-
x: l.x,
|
|
2064
|
-
y: l.y,
|
|
2065
|
-
rotation: l.rotation,
|
|
2066
|
-
scale: 1
|
|
2067
|
-
// No scale - using dimensions
|
|
2068
|
-
}, u = {
|
|
2069
|
-
width: this.incoming.element.offsetWidth,
|
|
2070
|
-
height: this.incoming.element.offsetHeight
|
|
2071
|
-
};
|
|
2072
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2063
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2064
|
+
if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
|
|
2065
|
+
const { transform: a, dimensions: h } = this.captureMidAnimationState(this.incoming.element);
|
|
2066
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2073
2067
|
this.incoming.element,
|
|
2074
2068
|
this.incoming.originalState,
|
|
2075
|
-
|
|
2076
|
-
|
|
2069
|
+
a,
|
|
2070
|
+
h
|
|
2077
2071
|
);
|
|
2078
2072
|
} else
|
|
2079
2073
|
this.outgoing = null;
|
|
2080
|
-
if (this.incoming = this.startFocusAnimation(t, e, i,
|
|
2074
|
+
if (this.incoming = this.startFocusAnimation(t, e, i, s, r), await Promise.all([
|
|
2081
2075
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2082
2076
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2083
2077
|
]), this.focusGeneration !== o) return;
|
|
@@ -2091,21 +2085,12 @@ class Ee {
|
|
|
2091
2085
|
this.outgoing.originalWidth,
|
|
2092
2086
|
this.outgoing.originalHeight
|
|
2093
2087
|
), this.outgoing = null), this.incoming) {
|
|
2094
|
-
const s = this.
|
|
2095
|
-
|
|
2096
|
-
y: s.y,
|
|
2097
|
-
rotation: s.rotation,
|
|
2098
|
-
scale: 1
|
|
2099
|
-
// No scale - using dimensions
|
|
2100
|
-
}, a = {
|
|
2101
|
-
width: this.incoming.element.offsetWidth,
|
|
2102
|
-
height: this.incoming.element.offsetHeight
|
|
2103
|
-
};
|
|
2104
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2088
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2089
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2105
2090
|
this.incoming.element,
|
|
2106
2091
|
this.incoming.originalState,
|
|
2107
|
-
|
|
2108
|
-
|
|
2092
|
+
s,
|
|
2093
|
+
r
|
|
2109
2094
|
);
|
|
2110
2095
|
}
|
|
2111
2096
|
if (this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
@@ -2120,50 +2105,36 @@ class Ee {
|
|
|
2120
2105
|
* Unfocus current image, returning it to original position
|
|
2121
2106
|
*/
|
|
2122
2107
|
async unfocusImage() {
|
|
2108
|
+
if (this.state === I.UNFOCUSING)
|
|
2109
|
+
return;
|
|
2123
2110
|
const t = ++this.focusGeneration;
|
|
2124
2111
|
if (!this.currentFocus || !this.focusData) {
|
|
2125
2112
|
if (this.incoming && this.state === I.FOCUSING) {
|
|
2126
|
-
const s = this.
|
|
2127
|
-
|
|
2128
|
-
y: s.y,
|
|
2129
|
-
rotation: s.rotation,
|
|
2130
|
-
scale: 1
|
|
2131
|
-
// No scale - using dimensions
|
|
2132
|
-
}, a = {
|
|
2133
|
-
width: this.incoming.element.offsetWidth,
|
|
2134
|
-
height: this.incoming.element.offsetHeight
|
|
2135
|
-
};
|
|
2136
|
-
if (this.outgoing = this.startUnfocusAnimation(
|
|
2113
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2114
|
+
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2137
2115
|
this.incoming.element,
|
|
2138
2116
|
this.incoming.originalState,
|
|
2139
|
-
|
|
2140
|
-
|
|
2117
|
+
s,
|
|
2118
|
+
r
|
|
2141
2119
|
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2142
2120
|
this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = I.IDLE;
|
|
2143
2121
|
}
|
|
2144
2122
|
return;
|
|
2145
2123
|
}
|
|
2146
2124
|
if (this.state === I.CROSS_ANIMATING && this.incoming) {
|
|
2147
|
-
const s = this.
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
rotation: s.rotation,
|
|
2151
|
-
scale: 1
|
|
2152
|
-
// No scale - using dimensions
|
|
2153
|
-
}, a = {
|
|
2154
|
-
width: this.incoming.element.offsetWidth,
|
|
2155
|
-
height: this.incoming.element.offsetHeight
|
|
2156
|
-
}, l = this.startUnfocusAnimation(
|
|
2125
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2126
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2127
|
+
const a = this.startUnfocusAnimation(
|
|
2157
2128
|
this.incoming.element,
|
|
2158
2129
|
this.incoming.originalState,
|
|
2159
|
-
|
|
2160
|
-
|
|
2130
|
+
s,
|
|
2131
|
+
r
|
|
2161
2132
|
);
|
|
2162
2133
|
if (await Promise.all([
|
|
2163
2134
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2164
|
-
this.waitForAnimation(
|
|
2135
|
+
this.waitForAnimation(a.animationHandle)
|
|
2165
2136
|
]), this.focusGeneration !== t) return;
|
|
2166
|
-
this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(
|
|
2137
|
+
this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(a.element, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2167
2138
|
return;
|
|
2168
2139
|
}
|
|
2169
2140
|
this.state = I.UNFOCUSING;
|
|
@@ -2220,10 +2191,10 @@ class Ee {
|
|
|
2220
2191
|
if (!this.currentFocus || !this.focusData || this.state !== I.FOCUSED) return;
|
|
2221
2192
|
const i = this.currentFocus, o = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = o.x ?? 0, a = o.y ?? 0;
|
|
2222
2193
|
s.push(`translate(${r}px, ${a}px)`), o.rotation !== void 0 && s.push(`rotate(${o.rotation}deg)`);
|
|
2223
|
-
const
|
|
2224
|
-
t ? (i.style.transition = `transform ${e}ms ease-out`, i.style.transform =
|
|
2194
|
+
const h = s.join(" ");
|
|
2195
|
+
t ? (i.style.transition = `transform ${e}ms ease-out`, i.style.transform = h, setTimeout(() => {
|
|
2225
2196
|
this.currentFocus === i && (i.style.transition = "none");
|
|
2226
|
-
}, e)) : (i.style.transition = "none", i.style.transform =
|
|
2197
|
+
}, e)) : (i.style.transition = "none", i.style.transform = h);
|
|
2227
2198
|
}
|
|
2228
2199
|
/**
|
|
2229
2200
|
* Reset zoom state (cancels all animations)
|
|
@@ -2250,7 +2221,7 @@ class Ee {
|
|
|
2250
2221
|
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2251
2222
|
}
|
|
2252
2223
|
}
|
|
2253
|
-
const
|
|
2224
|
+
const Ee = 50, Ie = 0.5, Ae = 20, Te = 0.3, Ce = 150, Re = 30, at = class at {
|
|
2254
2225
|
constructor(t, e) {
|
|
2255
2226
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = e, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2256
2227
|
}
|
|
@@ -2297,11 +2268,11 @@ const Se = 50, Ie = 0.5, Te = 20, Re = 0.3, Ce = 150, Ae = 30, at = class at {
|
|
|
2297
2268
|
const e = t.touches[0], i = e.clientX - this.touchState.startX, o = e.clientY - this.touchState.startY;
|
|
2298
2269
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + o * o) > 10) {
|
|
2299
2270
|
const a = Math.atan2(Math.abs(o), Math.abs(i)) * (180 / Math.PI);
|
|
2300
|
-
this.touchState.isHorizontalSwipe = a <=
|
|
2271
|
+
this.touchState.isHorizontalSwipe = a <= Re;
|
|
2301
2272
|
}
|
|
2302
2273
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2303
2274
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
|
|
2304
|
-
const s = i *
|
|
2275
|
+
const s = i * Te;
|
|
2305
2276
|
this.callbacks.onDragOffset(s);
|
|
2306
2277
|
}
|
|
2307
2278
|
}
|
|
@@ -2310,15 +2281,15 @@ const Se = 50, Ie = 0.5, Te = 20, Re = 0.3, Ce = 150, Ae = 30, at = class at {
|
|
|
2310
2281
|
this.recentTouchTimestamp = Date.now();
|
|
2311
2282
|
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, o = Math.abs(e) / i, s = Math.abs(e);
|
|
2312
2283
|
let r = !1;
|
|
2313
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >=
|
|
2284
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Ee || o >= Ie && s >= Ae) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2314
2285
|
}
|
|
2315
2286
|
handleTouchCancel(t) {
|
|
2316
2287
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
2317
2288
|
}
|
|
2318
2289
|
};
|
|
2319
2290
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2320
|
-
let
|
|
2321
|
-
class
|
|
2291
|
+
let ft = at;
|
|
2292
|
+
class Me {
|
|
2322
2293
|
constructor(t) {
|
|
2323
2294
|
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)
|
|
2324
2295
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2438,8 +2409,8 @@ class Le {
|
|
|
2438
2409
|
try {
|
|
2439
2410
|
const r = `${this.apiEndpoint}/${s}?fields=name,mimeType&key=${this.apiKey}`, a = await fetch(r);
|
|
2440
2411
|
if (a.ok) {
|
|
2441
|
-
const
|
|
2442
|
-
|
|
2412
|
+
const h = await a.json();
|
|
2413
|
+
h.mimeType.startsWith("image/") && e.isAllowed(h.name) ? (i.push(`https://lh3.googleusercontent.com/d/${s}=s1600`), this.log(`Added file: ${h.name}`)) : this.log(`Skipping non-image file: ${h.name} (${h.mimeType})`);
|
|
2443
2414
|
} else
|
|
2444
2415
|
this.log(`Failed to fetch metadata for file ${s}: ${a.status}`);
|
|
2445
2416
|
} catch (r) {
|
|
@@ -2483,17 +2454,17 @@ class Le {
|
|
|
2483
2454
|
const i = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2484
2455
|
if (!a.ok)
|
|
2485
2456
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2486
|
-
const
|
|
2487
|
-
(
|
|
2488
|
-
), u =
|
|
2489
|
-
(
|
|
2457
|
+
const h = await a.json(), c = h.files.filter(
|
|
2458
|
+
(l) => l.mimeType.startsWith("image/") && e.isAllowed(l.name)
|
|
2459
|
+
), u = h.files.filter(
|
|
2460
|
+
(l) => l.mimeType === "application/vnd.google-apps.folder"
|
|
2490
2461
|
);
|
|
2491
|
-
this.log(`Found ${
|
|
2492
|
-
i.push(`https://lh3.googleusercontent.com/d/${
|
|
2462
|
+
this.log(`Found ${h.files.length} total items in folder ${t}`), h.files.forEach((l) => this.log(` - File: ${l.name} (${l.mimeType})`)), this.log(`- ${c.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), c.forEach((l) => {
|
|
2463
|
+
i.push(`https://lh3.googleusercontent.com/d/${l.id}=s1600`), this.log(`Added file: ${l.name}`);
|
|
2493
2464
|
});
|
|
2494
|
-
for (const
|
|
2495
|
-
this.log(`Loading images from subfolder: ${
|
|
2496
|
-
const d = await this.loadImagesRecursively(
|
|
2465
|
+
for (const l of u) {
|
|
2466
|
+
this.log(`Loading images from subfolder: ${l.name}`);
|
|
2467
|
+
const d = await this.loadImagesRecursively(l.id, e);
|
|
2497
2468
|
i.push(...d);
|
|
2498
2469
|
}
|
|
2499
2470
|
return i;
|
|
@@ -2539,7 +2510,7 @@ class Le {
|
|
|
2539
2510
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2540
2511
|
}
|
|
2541
2512
|
}
|
|
2542
|
-
class
|
|
2513
|
+
class Le {
|
|
2543
2514
|
constructor(t) {
|
|
2544
2515
|
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)
|
|
2545
2516
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2875,7 +2846,7 @@ let $e = class {
|
|
|
2875
2846
|
this.fullConfig = Yt(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 Vt(this.fullConfig.animation), this.layoutEngine = new ye({
|
|
2876
2847
|
layout: this.fullConfig.layout,
|
|
2877
2848
|
image: this.fullConfig.image
|
|
2878
|
-
}), this.zoomEngine = new
|
|
2849
|
+
}), this.zoomEngine = new Se(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = st(this.fullConfig.styling?.default), this.hoverStyles = st(this.fullConfig.styling?.hover), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
2879
2850
|
const e = this.fullConfig.animation.entry || y.animation.entry;
|
|
2880
2851
|
this.entryAnimationEngine = new re(
|
|
2881
2852
|
e,
|
|
@@ -2916,14 +2887,14 @@ let $e = class {
|
|
|
2916
2887
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2917
2888
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2918
2889
|
};
|
|
2919
|
-
return new
|
|
2890
|
+
return new Le(o);
|
|
2920
2891
|
} else if ("googleDrive" in t) {
|
|
2921
2892
|
const i = t.googleDrive, o = {
|
|
2922
2893
|
...i,
|
|
2923
2894
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2924
2895
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2925
2896
|
};
|
|
2926
|
-
return new
|
|
2897
|
+
return new Me(o);
|
|
2927
2898
|
} else
|
|
2928
2899
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
2929
2900
|
}
|
|
@@ -2936,7 +2907,7 @@ let $e = class {
|
|
|
2936
2907
|
this.containerEl = this.containerRef;
|
|
2937
2908
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
2938
2909
|
throw new Error(`Container #${this.containerId} not found`);
|
|
2939
|
-
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new
|
|
2910
|
+
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new ft(this.containerEl, {
|
|
2940
2911
|
onNext: () => this.navigateToNextImage(),
|
|
2941
2912
|
onPrev: () => this.navigateToPreviousImage(),
|
|
2942
2913
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
@@ -3068,22 +3039,22 @@ let $e = class {
|
|
|
3068
3039
|
const d = {
|
|
3069
3040
|
x: parseFloat(c.dataset.startX),
|
|
3070
3041
|
y: parseFloat(c.dataset.startY)
|
|
3071
|
-
},
|
|
3042
|
+
}, m = {
|
|
3072
3043
|
x: parseFloat(c.dataset.endX),
|
|
3073
3044
|
y: parseFloat(c.dataset.endY)
|
|
3074
|
-
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation),
|
|
3045
|
+
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation), f = parseFloat(c.dataset.scale), S = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : g, v = c.dataset.startScale ? parseFloat(c.dataset.startScale) : f, w = this.entryAnimationEngine.getTiming();
|
|
3075
3046
|
oe({
|
|
3076
3047
|
element: c,
|
|
3077
3048
|
startPosition: d,
|
|
3078
|
-
endPosition:
|
|
3049
|
+
endPosition: m,
|
|
3079
3050
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3080
3051
|
duration: w.duration,
|
|
3081
3052
|
imageWidth: b,
|
|
3082
3053
|
imageHeight: p,
|
|
3083
3054
|
rotation: g,
|
|
3084
|
-
scale:
|
|
3055
|
+
scale: f,
|
|
3085
3056
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3086
|
-
startRotation:
|
|
3057
|
+
startRotation: S,
|
|
3087
3058
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3088
3059
|
startScale: v
|
|
3089
3060
|
});
|
|
@@ -3091,10 +3062,10 @@ let $e = class {
|
|
|
3091
3062
|
const d = c.dataset.finalTransform || "";
|
|
3092
3063
|
c.style.transform = d;
|
|
3093
3064
|
}
|
|
3094
|
-
const
|
|
3095
|
-
if (this.fullConfig.config.debug?.enabled &&
|
|
3065
|
+
const l = parseInt(c.dataset.imageId || "0");
|
|
3066
|
+
if (this.fullConfig.config.debug?.enabled && l < 3) {
|
|
3096
3067
|
const d = c.dataset.finalTransform || "";
|
|
3097
|
-
console.log(`Image ${
|
|
3068
|
+
console.log(`Image ${l} final state:`, {
|
|
3098
3069
|
left: c.style.left,
|
|
3099
3070
|
top: c.style.top,
|
|
3100
3071
|
width: c.style.width,
|
|
@@ -3106,7 +3077,7 @@ let $e = class {
|
|
|
3106
3077
|
});
|
|
3107
3078
|
}
|
|
3108
3079
|
}), r++);
|
|
3109
|
-
},
|
|
3080
|
+
}, h = () => {
|
|
3110
3081
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3111
3082
|
for (; this.displayQueue.length > 0; ) {
|
|
3112
3083
|
const c = this.displayQueue.shift();
|
|
@@ -3128,52 +3099,52 @@ let $e = class {
|
|
|
3128
3099
|
};
|
|
3129
3100
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3130
3101
|
const c = new IntersectionObserver((u) => {
|
|
3131
|
-
u.forEach((
|
|
3132
|
-
|
|
3102
|
+
u.forEach((l) => {
|
|
3103
|
+
l.isIntersecting && (h(), c.disconnect());
|
|
3133
3104
|
});
|
|
3134
3105
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3135
3106
|
c.observe(this.containerEl);
|
|
3136
3107
|
} else
|
|
3137
|
-
|
|
3108
|
+
h();
|
|
3138
3109
|
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), s.forEach((c, u) => {
|
|
3139
|
-
const
|
|
3140
|
-
|
|
3141
|
-
const d = c.x,
|
|
3142
|
-
|
|
3110
|
+
const l = document.createElement("div");
|
|
3111
|
+
l.className = "fbn-ic-debug-center", l.style.position = "absolute", l.style.width = "12px", l.style.height = "12px", l.style.borderRadius = "50%", l.style.backgroundColor = "red", l.style.border = "2px solid yellow", l.style.zIndex = "9999", l.style.pointerEvents = "none";
|
|
3112
|
+
const d = c.x, m = c.y;
|
|
3113
|
+
l.style.left = `${d - 6}px`, l.style.top = `${m - 6}px`, l.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(m)})`, this.containerEl.appendChild(l);
|
|
3143
3114
|
})), t.forEach((c, u) => {
|
|
3144
|
-
const
|
|
3145
|
-
|
|
3115
|
+
const l = document.createElement("img");
|
|
3116
|
+
l.referrerPolicy = "no-referrer", l.classList.add("fbn-ic-image"), l.dataset.imageId = String(u);
|
|
3146
3117
|
const d = s[u];
|
|
3147
|
-
|
|
3148
|
-
this.hoveredImage = { element:
|
|
3149
|
-
}),
|
|
3150
|
-
this.hoveredImage = null, this.zoomEngine.isInvolved(
|
|
3151
|
-
}),
|
|
3152
|
-
|
|
3153
|
-
}),
|
|
3118
|
+
l.style.position = "absolute", l.style.width = "auto", l.style.height = `${e}px`, l.style.left = `${d.x}px`, l.style.top = `${d.y}px`, d.zIndex && (l.style.zIndex = String(d.zIndex)), tt(l, this.defaultStyles), et(l, this.defaultClassName), l.addEventListener("mouseenter", () => {
|
|
3119
|
+
this.hoveredImage = { element: l, layout: d }, this.zoomEngine.isInvolved(l) || (tt(l, this.hoverStyles), et(l, this.hoverClassName));
|
|
3120
|
+
}), l.addEventListener("mouseleave", () => {
|
|
3121
|
+
this.hoveredImage = null, this.zoomEngine.isInvolved(l) || (tt(l, this.defaultStyles), zt(l, this.hoverClassName), et(l, this.defaultClassName));
|
|
3122
|
+
}), l.addEventListener("click", (m) => {
|
|
3123
|
+
m.stopPropagation(), this.handleImageClick(l, d);
|
|
3124
|
+
}), l.style.opacity = "0", l.style.transition = this.entryAnimationEngine.getTransitionCSS(), l.onload = () => {
|
|
3154
3125
|
if (o !== this.loadGeneration)
|
|
3155
3126
|
return;
|
|
3156
|
-
const
|
|
3157
|
-
|
|
3158
|
-
const p = { x: d.x, y: d.y }, g = { width: b, height: e },
|
|
3127
|
+
const m = l.naturalWidth / l.naturalHeight, b = e * m;
|
|
3128
|
+
l.style.width = `${b}px`;
|
|
3129
|
+
const p = { x: d.x, y: d.y }, g = { width: b, height: e }, f = this.entryAnimationEngine.calculateStartPosition(
|
|
3159
3130
|
p,
|
|
3160
3131
|
g,
|
|
3161
3132
|
i,
|
|
3162
3133
|
u,
|
|
3163
3134
|
t.length
|
|
3164
|
-
),
|
|
3135
|
+
), S = this.entryAnimationEngine.calculateStartRotation(d.rotation), v = this.entryAnimationEngine.calculateStartScale(d.scale), w = this.entryAnimationEngine.buildFinalTransform(
|
|
3165
3136
|
d.rotation,
|
|
3166
3137
|
d.scale,
|
|
3167
3138
|
b,
|
|
3168
3139
|
e
|
|
3169
|
-
),
|
|
3170
|
-
|
|
3140
|
+
), E = this.entryAnimationEngine.buildStartTransform(
|
|
3141
|
+
f,
|
|
3171
3142
|
p,
|
|
3172
3143
|
d.rotation,
|
|
3173
3144
|
d.scale,
|
|
3174
3145
|
b,
|
|
3175
3146
|
e,
|
|
3176
|
-
|
|
3147
|
+
S,
|
|
3177
3148
|
v
|
|
3178
3149
|
);
|
|
3179
3150
|
this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
|
|
@@ -3184,8 +3155,8 @@ let $e = class {
|
|
|
3184
3155
|
finalTransform: w,
|
|
3185
3156
|
renderedWidth: b,
|
|
3186
3157
|
renderedHeight: e
|
|
3187
|
-
}),
|
|
3188
|
-
},
|
|
3158
|
+
}), l.style.transform = E, l.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || S !== d.rotation || v !== d.scale) && (l.dataset.startX = String(f.x), l.dataset.startY = String(f.y), l.dataset.endX = String(p.x), l.dataset.endY = String(p.y), l.dataset.imageWidth = String(b), l.dataset.imageHeight = String(e), l.dataset.rotation = String(d.rotation), l.dataset.scale = String(d.scale), l.dataset.startRotation = String(S), l.dataset.startScale = String(v)), this.displayQueue.push(l);
|
|
3159
|
+
}, l.onerror = () => r++, l.src = c;
|
|
3189
3160
|
});
|
|
3190
3161
|
}
|
|
3191
3162
|
async handleImageClick(t, e) {
|
|
@@ -3242,8 +3213,8 @@ const He = $t(
|
|
|
3242
3213
|
container: s.current,
|
|
3243
3214
|
...i
|
|
3244
3215
|
});
|
|
3245
|
-
return r.current = a, a.init().catch((
|
|
3246
|
-
console.error("ImageCloud init failed:",
|
|
3216
|
+
return r.current = a, a.init().catch((h) => {
|
|
3217
|
+
console.error("ImageCloud init failed:", h);
|
|
3247
3218
|
}), () => {
|
|
3248
3219
|
a.destroy(), r.current = null;
|
|
3249
3220
|
};
|