@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/vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as Ot, ref as wt, onMounted as $t, onUnmounted as Ut, watch as Pt, h as _t } from "vue";
|
|
2
|
-
const
|
|
2
|
+
const mt = Object.freeze({
|
|
3
3
|
none: "none",
|
|
4
4
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
5
5
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
@@ -9,12 +9,12 @@ const ft = Object.freeze({
|
|
|
9
9
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
10
10
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
11
11
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
12
|
-
}),
|
|
12
|
+
}), St = Object.freeze({
|
|
13
13
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
14
14
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
15
15
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
16
16
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
17
|
-
}),
|
|
17
|
+
}), Et = Object.freeze({
|
|
18
18
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
19
19
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
20
20
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
@@ -25,7 +25,7 @@ const ft = Object.freeze({
|
|
|
25
25
|
mode: "none"
|
|
26
26
|
}), yt = Object.freeze({
|
|
27
27
|
mode: "none"
|
|
28
|
-
}),
|
|
28
|
+
}), Tt = Object.freeze({
|
|
29
29
|
default: Object.freeze({
|
|
30
30
|
border: Object.freeze({
|
|
31
31
|
width: 0,
|
|
@@ -78,15 +78,15 @@ const ft = Object.freeze({
|
|
|
78
78
|
min: -15,
|
|
79
79
|
max: 15
|
|
80
80
|
})
|
|
81
|
-
}),
|
|
81
|
+
}), Ct = Object.freeze({
|
|
82
82
|
sizing: jt,
|
|
83
83
|
rotation: kt
|
|
84
|
-
}),
|
|
84
|
+
}), Rt = Object.freeze({
|
|
85
85
|
validateUrls: !0,
|
|
86
86
|
validationTimeout: 5e3,
|
|
87
87
|
validationMethod: "head",
|
|
88
88
|
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
|
|
89
|
-
}),
|
|
89
|
+
}), Mt = Object.freeze({
|
|
90
90
|
enabled: !1,
|
|
91
91
|
centers: !1,
|
|
92
92
|
loaders: !1
|
|
@@ -95,11 +95,11 @@ const ft = Object.freeze({
|
|
|
95
95
|
loaders: [],
|
|
96
96
|
// Shared loader settings and debug config
|
|
97
97
|
config: Object.freeze({
|
|
98
|
-
loaders:
|
|
99
|
-
debug:
|
|
98
|
+
loaders: Rt,
|
|
99
|
+
debug: Mt
|
|
100
100
|
}),
|
|
101
101
|
// Image sizing and rotation configuration
|
|
102
|
-
image:
|
|
102
|
+
image: Ct,
|
|
103
103
|
// Pattern-based layout configuration
|
|
104
104
|
layout: Object.freeze({
|
|
105
105
|
algorithm: "radial",
|
|
@@ -220,7 +220,7 @@ const ft = Object.freeze({
|
|
|
220
220
|
})
|
|
221
221
|
}),
|
|
222
222
|
// Image styling
|
|
223
|
-
styling:
|
|
223
|
+
styling: Tt
|
|
224
224
|
});
|
|
225
225
|
function Z(n, t) {
|
|
226
226
|
if (!n) return t || {};
|
|
@@ -302,18 +302,18 @@ function Xt(n = {}) {
|
|
|
302
302
|
});
|
|
303
303
|
const r = {
|
|
304
304
|
loaders: {
|
|
305
|
-
...
|
|
305
|
+
...Rt,
|
|
306
306
|
...n.config?.loaders ?? {}
|
|
307
307
|
}
|
|
308
308
|
}, a = {
|
|
309
309
|
loaders: o,
|
|
310
310
|
config: r,
|
|
311
|
-
image: Gt(
|
|
311
|
+
image: Gt(Ct, i),
|
|
312
312
|
layout: { ...y.layout },
|
|
313
313
|
animation: { ...y.animation },
|
|
314
314
|
interaction: { ...y.interaction },
|
|
315
315
|
rendering: { ...y.rendering },
|
|
316
|
-
styling: Wt(
|
|
316
|
+
styling: Wt(Tt, n.styling)
|
|
317
317
|
};
|
|
318
318
|
return n.layout && (a.layout = {
|
|
319
319
|
...y.layout,
|
|
@@ -376,7 +376,7 @@ function Xt(n = {}) {
|
|
|
376
376
|
...y.rendering.performance,
|
|
377
377
|
...n.rendering.performance
|
|
378
378
|
})), a.config.debug = {
|
|
379
|
-
...
|
|
379
|
+
...Mt,
|
|
380
380
|
...n.config?.debug ?? {}
|
|
381
381
|
}, a;
|
|
382
382
|
}
|
|
@@ -384,10 +384,10 @@ function Bt(n, t) {
|
|
|
384
384
|
return { ...n ? xt[n] : xt.playful, ...t };
|
|
385
385
|
}
|
|
386
386
|
function Jt(n, t) {
|
|
387
|
-
return { ...n ?
|
|
387
|
+
return { ...n ? St[n] : St.gentle, ...t };
|
|
388
388
|
}
|
|
389
389
|
function Vt(n, t) {
|
|
390
|
-
return { ...n ?
|
|
390
|
+
return { ...n ? Et[n] : Et.gentle, ...t };
|
|
391
391
|
}
|
|
392
392
|
class Kt {
|
|
393
393
|
constructor(t) {
|
|
@@ -550,22 +550,22 @@ function V(n, t, e) {
|
|
|
550
550
|
}
|
|
551
551
|
function Zt(n, t, e, i) {
|
|
552
552
|
const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x, h = e.y - t.y, c = Qt(s, r);
|
|
553
|
-
let u = 0, l = 0, d = 1,
|
|
553
|
+
let u = 0, l = 0, d = 1, m = o, b = !1;
|
|
554
554
|
for (let g = 0; g < c.length; g++)
|
|
555
555
|
if (n <= c[g].time) {
|
|
556
|
-
l = g === 0 ? 0 : c[g - 1].time, d = c[g].time,
|
|
556
|
+
l = g === 0 ? 0 : c[g - 1].time, d = c[g].time, m = c[g].overshoot, b = c[g].isOvershoot;
|
|
557
557
|
break;
|
|
558
558
|
}
|
|
559
559
|
const p = (n - l) / (d - l);
|
|
560
560
|
if (b)
|
|
561
|
-
u = 1 +
|
|
561
|
+
u = 1 + m * ot(p);
|
|
562
562
|
else if (l === 0)
|
|
563
563
|
u = ot(p);
|
|
564
564
|
else {
|
|
565
|
-
const
|
|
566
|
-
(
|
|
567
|
-
)?.overshoot ||
|
|
568
|
-
u = V(
|
|
565
|
+
const f = 1 + (c.find(
|
|
566
|
+
(S, v) => S.time > l && v > 0 && c[v - 1].isOvershoot
|
|
567
|
+
)?.overshoot || m);
|
|
568
|
+
u = V(f, 1, ot(p));
|
|
569
569
|
}
|
|
570
570
|
return {
|
|
571
571
|
x: t.x + a * u,
|
|
@@ -586,7 +586,7 @@ function te(n, t, e, i) {
|
|
|
586
586
|
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));
|
|
587
587
|
let d;
|
|
588
588
|
if (l < 1) {
|
|
589
|
-
const
|
|
589
|
+
const m = u * Math.sqrt(1 - l * l), b = Math.exp(-l * u * n * 3), p = Math.cos(m * n * a * Math.PI);
|
|
590
590
|
d = 1 - b * p;
|
|
591
591
|
} else
|
|
592
592
|
d = 1 - Math.exp(-u * n * 3);
|
|
@@ -596,10 +596,10 @@ function te(n, t, e, i) {
|
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
598
|
function ee(n, t, e, i) {
|
|
599
|
-
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,
|
|
599
|
+
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 = ie(n);
|
|
600
600
|
return {
|
|
601
|
-
x: V(t.x, e.x,
|
|
602
|
-
y: V(t.y, e.y,
|
|
601
|
+
x: V(t.x, e.x, f) + g * d,
|
|
602
|
+
y: V(t.y, e.y, f) + g * m
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
605
|
function ot(n) {
|
|
@@ -619,14 +619,14 @@ function oe(n, t, e) {
|
|
|
619
619
|
const a = 0.5, c = 0.5 / (o * 2);
|
|
620
620
|
let u = 0.5;
|
|
621
621
|
for (let d = 0; d < o; d++) {
|
|
622
|
-
const
|
|
623
|
-
u += c, s.push({ time: u, scale:
|
|
622
|
+
const m = 1 - (r - 1) * a;
|
|
623
|
+
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 });
|
|
624
624
|
}
|
|
625
625
|
s.push({ time: 1, scale: 1 });
|
|
626
626
|
let l = 1;
|
|
627
627
|
for (let d = 0; d < s.length; d++)
|
|
628
628
|
if (n <= s[d].time) {
|
|
629
|
-
const
|
|
629
|
+
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);
|
|
630
630
|
l = b + (s[d].scale - b) * g;
|
|
631
631
|
break;
|
|
632
632
|
}
|
|
@@ -646,16 +646,16 @@ function se(n) {
|
|
|
646
646
|
onComplete: u,
|
|
647
647
|
rotationConfig: l,
|
|
648
648
|
startRotation: d,
|
|
649
|
-
scaleConfig:
|
|
649
|
+
scaleConfig: m,
|
|
650
650
|
startScale: b
|
|
651
|
-
} = n, p = o.type, g = d !== void 0 && d !== h,
|
|
652
|
-
if ((p === "linear" || p === "arc") && !v && !(w ||
|
|
651
|
+
} = 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 };
|
|
652
|
+
if ((p === "linear" || p === "arc") && !v && !(w || E)) {
|
|
653
653
|
u && u();
|
|
654
654
|
return;
|
|
655
655
|
}
|
|
656
|
-
const
|
|
656
|
+
const L = performance.now(), z = -r / 2, P = -a / 2;
|
|
657
657
|
function _(Y) {
|
|
658
|
-
const N = Y -
|
|
658
|
+
const N = Y - L, T = Math.min(N / s, 1);
|
|
659
659
|
let D;
|
|
660
660
|
switch (p) {
|
|
661
661
|
case "bounce": {
|
|
@@ -663,7 +663,7 @@ function se(n) {
|
|
|
663
663
|
o.bouncePreset,
|
|
664
664
|
o.bounce
|
|
665
665
|
);
|
|
666
|
-
D = Zt(
|
|
666
|
+
D = Zt(T, e, i, O);
|
|
667
667
|
break;
|
|
668
668
|
}
|
|
669
669
|
case "elastic": {
|
|
@@ -671,7 +671,7 @@ function se(n) {
|
|
|
671
671
|
o.elasticPreset,
|
|
672
672
|
o.elastic
|
|
673
673
|
);
|
|
674
|
-
D = te(
|
|
674
|
+
D = te(T, e, i, O);
|
|
675
675
|
break;
|
|
676
676
|
}
|
|
677
677
|
case "wave": {
|
|
@@ -679,20 +679,20 @@ function se(n) {
|
|
|
679
679
|
o.wavePreset,
|
|
680
680
|
o.wave
|
|
681
681
|
);
|
|
682
|
-
D = ee(
|
|
682
|
+
D = ee(T, e, i, O);
|
|
683
683
|
break;
|
|
684
684
|
}
|
|
685
685
|
default:
|
|
686
686
|
D = {
|
|
687
|
-
x: V(e.x, i.x,
|
|
688
|
-
y: V(e.y, i.y,
|
|
687
|
+
x: V(e.x, i.x, T),
|
|
688
|
+
y: V(e.y, i.y, T)
|
|
689
689
|
};
|
|
690
690
|
}
|
|
691
691
|
const k = D.x - i.x, H = D.y - i.y;
|
|
692
|
-
let A;
|
|
693
|
-
m ? A = ne(C, h, E) : g ? A = V(d, h, C) : A = h;
|
|
694
692
|
let R;
|
|
695
|
-
|
|
693
|
+
f ? R = ne(T, h, S) : g ? R = V(d, h, T) : R = h;
|
|
694
|
+
let C;
|
|
695
|
+
E ? C = oe(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());
|
|
696
696
|
}
|
|
697
697
|
requestAnimationFrame(_);
|
|
698
698
|
}
|
|
@@ -754,8 +754,8 @@ class ce {
|
|
|
754
754
|
*/
|
|
755
755
|
calculateNearestEdge(t, e, i, o) {
|
|
756
756
|
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);
|
|
757
|
-
let d = t.x,
|
|
758
|
-
return l === a ? d = -(e.width + o) : l === h ? d = i.width + o : l === c ?
|
|
757
|
+
let d = t.x, m = t.y;
|
|
758
|
+
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 };
|
|
759
759
|
}
|
|
760
760
|
/**
|
|
761
761
|
* Calculate start position from a specific edge
|
|
@@ -813,8 +813,8 @@ class ce {
|
|
|
813
813
|
h = typeof c == "number" ? c : 500;
|
|
814
814
|
let u;
|
|
815
815
|
a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
816
|
-
const l = i.width / 2, d = i.height / 2,
|
|
817
|
-
return { x:
|
|
816
|
+
const l = i.width / 2, d = i.height / 2, m = l + Math.cos(u) * h, b = d + Math.sin(u) * h;
|
|
817
|
+
return { x: m, y: b };
|
|
818
818
|
}
|
|
819
819
|
/**
|
|
820
820
|
* Get animation parameters for an image
|
|
@@ -834,7 +834,7 @@ class ce {
|
|
|
834
834
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
835
835
|
*/
|
|
836
836
|
buildStartTransform(t, e, i, o, s, r, a, h) {
|
|
837
|
-
const c = t.x - e.x, u = t.y - e.y, l = a !== void 0 ? a : i, d = h !== void 0 ? h : o,
|
|
837
|
+
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%)";
|
|
838
838
|
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})`;
|
|
839
839
|
}
|
|
840
840
|
/**
|
|
@@ -1063,12 +1063,12 @@ class le {
|
|
|
1063
1063
|
* @returns Array of layout objects with position, rotation, scale
|
|
1064
1064
|
*/
|
|
1065
1065
|
generate(t, e, i = {}) {
|
|
1066
|
-
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,
|
|
1066
|
+
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;
|
|
1067
1067
|
for (let x = 0; x < t; x++) {
|
|
1068
|
-
const
|
|
1068
|
+
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 = {
|
|
1069
1069
|
id: x,
|
|
1070
|
-
x:
|
|
1071
|
-
y:
|
|
1070
|
+
x: A,
|
|
1071
|
+
y: L,
|
|
1072
1072
|
rotation: z,
|
|
1073
1073
|
scale: P,
|
|
1074
1074
|
baseSize: _
|
|
@@ -1099,16 +1099,16 @@ class he {
|
|
|
1099
1099
|
* @returns Array of layout objects with position, rotation, scale
|
|
1100
1100
|
*/
|
|
1101
1101
|
generate(t, e, i = {}) {
|
|
1102
|
-
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,
|
|
1102
|
+
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));
|
|
1103
1103
|
if (t > 0) {
|
|
1104
|
-
const
|
|
1104
|
+
const E = m ? this.random(l, d) : 1, x = p * E;
|
|
1105
1105
|
o.push({
|
|
1106
1106
|
id: 0,
|
|
1107
1107
|
x: g,
|
|
1108
|
-
y:
|
|
1108
|
+
y: f,
|
|
1109
1109
|
rotation: h === "random" ? this.random(c * 0.33, u * 0.33) : 0,
|
|
1110
1110
|
// Less rotation for center
|
|
1111
|
-
scale:
|
|
1111
|
+
scale: E,
|
|
1112
1112
|
baseSize: x,
|
|
1113
1113
|
zIndex: 100
|
|
1114
1114
|
// Center image is highest
|
|
@@ -1116,25 +1116,25 @@ class he {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
let v = 1, w = 1;
|
|
1118
1118
|
for (; v < t; ) {
|
|
1119
|
-
const
|
|
1119
|
+
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));
|
|
1120
1120
|
if (_ === 0) {
|
|
1121
1121
|
w++;
|
|
1122
1122
|
continue;
|
|
1123
1123
|
}
|
|
1124
1124
|
const Y = 2 * Math.PI / _, N = w * (20 * Math.PI / 180);
|
|
1125
|
-
for (let
|
|
1126
|
-
const D =
|
|
1127
|
-
let
|
|
1128
|
-
const $ = this.config.spacing.padding ?? 50, U =
|
|
1129
|
-
|
|
1125
|
+
for (let T = 0; T < _ && v < t; T++) {
|
|
1126
|
+
const D = T * Y + N, k = m ? this.random(l, d) : 1, H = x * k, R = p * H;
|
|
1127
|
+
let C = g + Math.cos(D) * L, O = f + Math.sin(D) * A;
|
|
1128
|
+
const $ = this.config.spacing.padding ?? 50, U = R * 1.5 / 2, M = R / 2;
|
|
1129
|
+
C - U < $ ? C = $ + U : C + U > s - $ && (C = s - $ - U), O - M < $ ? O = $ + M : O + M > r - $ && (O = r - $ - M);
|
|
1130
1130
|
const W = h === "random" ? this.random(c, u) : 0;
|
|
1131
1131
|
o.push({
|
|
1132
1132
|
id: v,
|
|
1133
|
-
x:
|
|
1133
|
+
x: C,
|
|
1134
1134
|
y: O,
|
|
1135
1135
|
rotation: W,
|
|
1136
1136
|
scale: H,
|
|
1137
|
-
baseSize:
|
|
1137
|
+
baseSize: R,
|
|
1138
1138
|
zIndex: Math.max(1, 100 - w)
|
|
1139
1139
|
// Outer rings have lower z-index
|
|
1140
1140
|
}), v++;
|
|
@@ -1202,50 +1202,50 @@ class ue {
|
|
|
1202
1202
|
* @returns Array of layout objects with position, rotation, scale
|
|
1203
1203
|
*/
|
|
1204
1204
|
generate(t, e, i = {}) {
|
|
1205
|
-
const o = [], { width: s, height: r } = e, a = { ...de, ...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,
|
|
1205
|
+
const o = [], { width: s, height: r } = e, a = { ...de, ...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(
|
|
1206
1206
|
t,
|
|
1207
1207
|
b,
|
|
1208
1208
|
p,
|
|
1209
1209
|
c,
|
|
1210
1210
|
a
|
|
1211
|
-
),
|
|
1211
|
+
), 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;
|
|
1212
1212
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1213
1213
|
gridConfigColumns: a.columns,
|
|
1214
1214
|
gridConfigRows: a.rows,
|
|
1215
1215
|
columns: g,
|
|
1216
|
-
rows:
|
|
1216
|
+
rows: f,
|
|
1217
1217
|
cellCount: H,
|
|
1218
|
-
hasFixedGrid:
|
|
1218
|
+
hasFixedGrid: R,
|
|
1219
1219
|
imageCount: t,
|
|
1220
|
-
isOverflowMode:
|
|
1220
|
+
isOverflowMode: C
|
|
1221
1221
|
});
|
|
1222
|
-
const O =
|
|
1222
|
+
const O = C ? new Array(H).fill(0) : [], $ = Math.min(x, A) * a.overflowOffset;
|
|
1223
1223
|
for (let F = 0; F < t; F++) {
|
|
1224
|
-
let U,
|
|
1225
|
-
if (
|
|
1224
|
+
let U, M, W = 0;
|
|
1225
|
+
if (C && F >= H) {
|
|
1226
1226
|
const q = F - H, j = q % H;
|
|
1227
|
-
W = Math.floor(q / H) + 1, O[j]++, a.fillDirection === "row" ? (U = j % g,
|
|
1227
|
+
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));
|
|
1228
1228
|
} else
|
|
1229
|
-
a.fillDirection === "row" ? (U = F % g,
|
|
1230
|
-
let G = D + U * (x + a.gap) + x / 2, X = k +
|
|
1231
|
-
if (a.stagger === "row" &&
|
|
1229
|
+
a.fillDirection === "row" ? (U = F % g, M = Math.floor(F / g)) : (M = F % f, U = Math.floor(F / f));
|
|
1230
|
+
let G = D + U * (x + a.gap) + x / 2, X = k + M * (A + a.gap) + A / 2;
|
|
1231
|
+
if (a.stagger === "row" && M % 2 === 1 ? G += x / 2 : a.stagger === "column" && U % 2 === 1 && (X += A / 2), W > 0) {
|
|
1232
1232
|
const q = (W - 1) % It.length, j = It[q];
|
|
1233
1233
|
G += j.x * $, X += j.y * $;
|
|
1234
1234
|
}
|
|
1235
1235
|
if (a.jitter > 0) {
|
|
1236
|
-
const q = x / 2 * a.jitter, j =
|
|
1236
|
+
const q = x / 2 * a.jitter, j = A / 2 * a.jitter;
|
|
1237
1237
|
G += this.random(-q, q), X += this.random(-j, j);
|
|
1238
1238
|
}
|
|
1239
1239
|
let B = G, J = X;
|
|
1240
|
-
if (!
|
|
1240
|
+
if (!C && a.fillDirection === "row") {
|
|
1241
1241
|
const q = t % g || g;
|
|
1242
|
-
if (
|
|
1242
|
+
if (M === Math.floor((t - 1) / g) && q < g) {
|
|
1243
1243
|
const vt = q * x + (q - 1) * a.gap;
|
|
1244
1244
|
let gt = 0;
|
|
1245
1245
|
a.alignment === "center" ? gt = (N - vt) / 2 : a.alignment === "end" && (gt = N - vt), B += gt;
|
|
1246
1246
|
}
|
|
1247
1247
|
}
|
|
1248
|
-
const rt =
|
|
1248
|
+
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;
|
|
1249
1249
|
B = Math.max(lt, Math.min(B, ht)), J = Math.max(Ft, Math.min(J, Dt));
|
|
1250
1250
|
let dt = 0;
|
|
1251
1251
|
if (u === "random") {
|
|
@@ -1253,7 +1253,7 @@ class ue {
|
|
|
1253
1253
|
a.jitter > 0 ? dt = this.random(q * a.jitter, j * a.jitter) : dt = this.random(q, j);
|
|
1254
1254
|
}
|
|
1255
1255
|
let ut;
|
|
1256
|
-
|
|
1256
|
+
C && W > 0 ? ut = 50 - W : ut = C ? 100 + F : F + 1, o.push({
|
|
1257
1257
|
id: F,
|
|
1258
1258
|
x: B,
|
|
1259
1259
|
y: J,
|
|
@@ -1290,14 +1290,14 @@ class ue {
|
|
|
1290
1290
|
return Math.random() * (e - t) + t;
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
1293
|
-
const ge = Math.PI * (3 - Math.sqrt(5)),
|
|
1293
|
+
const ge = Math.PI * (3 - Math.sqrt(5)), me = {
|
|
1294
1294
|
spiralType: "golden",
|
|
1295
1295
|
direction: "counterclockwise",
|
|
1296
1296
|
tightness: 1,
|
|
1297
1297
|
scaleDecay: 0,
|
|
1298
1298
|
startAngle: 0
|
|
1299
1299
|
};
|
|
1300
|
-
class
|
|
1300
|
+
class fe {
|
|
1301
1301
|
constructor(t, e = {}) {
|
|
1302
1302
|
this.config = t, this.imageConfig = e;
|
|
1303
1303
|
}
|
|
@@ -1309,35 +1309,35 @@ class me {
|
|
|
1309
1309
|
* @returns Array of layout objects with position, rotation, scale
|
|
1310
1310
|
*/
|
|
1311
1311
|
generate(t, e, i = {}) {
|
|
1312
|
-
const o = [], { width: s, height: r } = e, a = { ...
|
|
1313
|
-
|
|
1314
|
-
|
|
1312
|
+
const o = [], { width: s, height: r } = e, a = { ...me, ...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(
|
|
1313
|
+
f - h - c / 2,
|
|
1314
|
+
S - h - c / 2
|
|
1315
1315
|
), w = a.direction === "clockwise" ? -1 : 1;
|
|
1316
|
-
for (let
|
|
1317
|
-
let x,
|
|
1316
|
+
for (let E = 0; E < t; E++) {
|
|
1317
|
+
let x, A;
|
|
1318
1318
|
if (a.spiralType === "golden")
|
|
1319
|
-
x =
|
|
1319
|
+
x = E * ge * w + a.startAngle, A = this.calculateGoldenRadius(E, t, v, a.tightness);
|
|
1320
1320
|
else if (a.spiralType === "archimedean") {
|
|
1321
|
-
const G =
|
|
1322
|
-
x = G * w + a.startAngle,
|
|
1321
|
+
const G = E * 0.5 * a.tightness;
|
|
1322
|
+
x = G * w + a.startAngle, A = this.calculateArchimedeanRadius(G, t, v, a.tightness);
|
|
1323
1323
|
} else {
|
|
1324
|
-
const G =
|
|
1325
|
-
x = G * w + a.startAngle,
|
|
1324
|
+
const G = E * 0.3 * a.tightness;
|
|
1325
|
+
x = G * w + a.startAngle, A = this.calculateLogarithmicRadius(G, t, v, a.tightness);
|
|
1326
1326
|
}
|
|
1327
|
-
const
|
|
1328
|
-
let
|
|
1327
|
+
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, $));
|
|
1328
|
+
let M = 0;
|
|
1329
1329
|
if (u === "random") {
|
|
1330
1330
|
const G = x * 180 / Math.PI % 360, X = this.random(l, d);
|
|
1331
|
-
|
|
1332
|
-
} else u === "tangent" && (
|
|
1333
|
-
const W = t -
|
|
1331
|
+
M = a.spiralType === "golden" ? X : G * 0.1 + X * 0.9;
|
|
1332
|
+
} else u === "tangent" && (M = this.calculateSpiralTangent(x, A, a));
|
|
1333
|
+
const W = t - E;
|
|
1334
1334
|
o.push({
|
|
1335
|
-
id:
|
|
1335
|
+
id: E,
|
|
1336
1336
|
x: F,
|
|
1337
1337
|
y: U,
|
|
1338
|
-
rotation:
|
|
1338
|
+
rotation: M,
|
|
1339
1339
|
scale: N,
|
|
1340
|
-
baseSize:
|
|
1340
|
+
baseSize: T,
|
|
1341
1341
|
zIndex: W
|
|
1342
1342
|
});
|
|
1343
1343
|
}
|
|
@@ -1411,46 +1411,46 @@ class be {
|
|
|
1411
1411
|
* @returns Array of layout objects with position, rotation, scale
|
|
1412
1412
|
*/
|
|
1413
1413
|
generate(t, e, i = {}) {
|
|
1414
|
-
const o = [], { width: s, height: r } = e, a = { ...pe, ...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,
|
|
1414
|
+
const o = [], { width: s, height: r } = e, a = { ...pe, ...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(
|
|
1415
1415
|
t,
|
|
1416
1416
|
a.clusterCount,
|
|
1417
1417
|
s,
|
|
1418
1418
|
r,
|
|
1419
1419
|
a.clusterSpacing
|
|
1420
|
-
),
|
|
1420
|
+
), f = this.generateClusterCenters(
|
|
1421
1421
|
g,
|
|
1422
1422
|
s,
|
|
1423
1423
|
r,
|
|
1424
1424
|
h,
|
|
1425
1425
|
a
|
|
1426
|
-
),
|
|
1426
|
+
), S = new Array(g).fill(0);
|
|
1427
1427
|
for (let w = 0; w < t; w++)
|
|
1428
|
-
|
|
1428
|
+
S[w % g]++;
|
|
1429
1429
|
let v = 0;
|
|
1430
1430
|
for (let w = 0; w < g; w++) {
|
|
1431
|
-
const
|
|
1432
|
-
for (let
|
|
1433
|
-
let
|
|
1431
|
+
const E = f[w], x = S[w];
|
|
1432
|
+
for (let A = 0; A < x; A++) {
|
|
1433
|
+
let L, z;
|
|
1434
1434
|
if (a.distribution === "gaussian")
|
|
1435
|
-
|
|
1435
|
+
L = this.gaussianRandom() * E.spread, z = this.gaussianRandom() * E.spread;
|
|
1436
1436
|
else {
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1437
|
+
const M = this.random(0, Math.PI * 2), W = this.random(0, E.spread);
|
|
1438
|
+
L = Math.cos(M) * W, z = Math.sin(M) * W;
|
|
1439
1439
|
}
|
|
1440
1440
|
const P = 1 + a.overlap * 0.5, _ = 1 + a.overlap * 0.3;
|
|
1441
|
-
|
|
1442
|
-
const Y = p ? this.random(
|
|
1443
|
-
let D =
|
|
1444
|
-
const
|
|
1445
|
-
D = Math.max(h +
|
|
1446
|
-
const O = u === "random" ? this.random(l, d) : 0, F = Math.sqrt(
|
|
1441
|
+
L /= P, z /= P;
|
|
1442
|
+
const Y = p ? this.random(m, b) : 1, N = _ * Y, T = c * N;
|
|
1443
|
+
let D = E.x + L, k = E.y + z;
|
|
1444
|
+
const R = T * 1.5 / 2, C = T / 2;
|
|
1445
|
+
D = Math.max(h + R, Math.min(D, s - h - R)), k = Math.max(h + C, Math.min(k, r - h - C));
|
|
1446
|
+
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;
|
|
1447
1447
|
o.push({
|
|
1448
1448
|
id: v,
|
|
1449
1449
|
x: D,
|
|
1450
1450
|
y: k,
|
|
1451
1451
|
rotation: O,
|
|
1452
1452
|
scale: N,
|
|
1453
|
-
baseSize:
|
|
1453
|
+
baseSize: T,
|
|
1454
1454
|
zIndex: U
|
|
1455
1455
|
}), v++;
|
|
1456
1456
|
}
|
|
@@ -1474,22 +1474,22 @@ class be {
|
|
|
1474
1474
|
generateClusterCenters(t, e, i, o, s) {
|
|
1475
1475
|
const r = [], h = o + s.clusterSpread, c = e - o - s.clusterSpread, u = o + s.clusterSpread, l = i - o - s.clusterSpread;
|
|
1476
1476
|
for (let d = 0; d < t; d++) {
|
|
1477
|
-
let
|
|
1477
|
+
let m = null, b = -1;
|
|
1478
1478
|
for (let p = 0; p < 100; p++) {
|
|
1479
1479
|
const g = {
|
|
1480
1480
|
x: this.random(h, c),
|
|
1481
1481
|
y: this.random(u, l),
|
|
1482
1482
|
spread: this.calculateClusterSpread(s)
|
|
1483
1483
|
};
|
|
1484
|
-
let
|
|
1485
|
-
for (const
|
|
1486
|
-
const v = g.x -
|
|
1487
|
-
|
|
1484
|
+
let f = 1 / 0;
|
|
1485
|
+
for (const S of r) {
|
|
1486
|
+
const v = g.x - S.x, w = g.y - S.y, E = Math.sqrt(v * v + w * w);
|
|
1487
|
+
f = Math.min(f, E);
|
|
1488
1488
|
}
|
|
1489
|
-
if ((r.length === 0 ||
|
|
1489
|
+
if ((r.length === 0 || f > b) && (m = g, b = f), f >= s.clusterSpacing)
|
|
1490
1490
|
break;
|
|
1491
1491
|
}
|
|
1492
|
-
|
|
1492
|
+
m && r.push(m);
|
|
1493
1493
|
}
|
|
1494
1494
|
return r;
|
|
1495
1495
|
}
|
|
@@ -1529,29 +1529,29 @@ class ye {
|
|
|
1529
1529
|
* @returns Array of layout objects with position, rotation, scale
|
|
1530
1530
|
*/
|
|
1531
1531
|
generate(t, e, i = {}) {
|
|
1532
|
-
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,
|
|
1532
|
+
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 = {
|
|
1533
1533
|
...Ht,
|
|
1534
1534
|
...this.config.wave
|
|
1535
|
-
}, { rows:
|
|
1536
|
-
let
|
|
1537
|
-
for (let
|
|
1538
|
-
const O =
|
|
1535
|
+
}, { 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;
|
|
1536
|
+
let R = 0;
|
|
1537
|
+
for (let C = 0; C < f && R < t; C++) {
|
|
1538
|
+
const O = f === 1 ? (T + D) / 2 : T + C * H;
|
|
1539
1539
|
let $ = 0;
|
|
1540
|
-
|
|
1541
|
-
for (let F = 0; F < x &&
|
|
1542
|
-
const U = x === 1 ? (P + _) / 2 : P + F * N,
|
|
1540
|
+
E === "offset" ? $ = C * w : E === "alternating" && ($ = C * Math.PI);
|
|
1541
|
+
for (let F = 0; F < x && R < t; F++) {
|
|
1542
|
+
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;
|
|
1543
1543
|
let J = 0;
|
|
1544
|
-
c === "tangent" ? J = this.calculateRotation(U, s,
|
|
1544
|
+
c === "tangent" ? J = this.calculateRotation(U, s, S, v, $) : c === "random" && (J = this.random(u, l));
|
|
1545
1545
|
const K = B * 1.5 / 2, ct = B / 2, it = h + K, nt = s - h - K, lt = h + ct, ht = r - h - ct;
|
|
1546
1546
|
o.push({
|
|
1547
|
-
id:
|
|
1547
|
+
id: R,
|
|
1548
1548
|
x: Math.max(it, Math.min(W, nt)),
|
|
1549
1549
|
y: Math.max(lt, Math.min(G, ht)),
|
|
1550
1550
|
rotation: J,
|
|
1551
1551
|
scale: X,
|
|
1552
1552
|
baseSize: B,
|
|
1553
|
-
zIndex:
|
|
1554
|
-
}),
|
|
1553
|
+
zIndex: R + 1
|
|
1554
|
+
}), R++;
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
1557
|
return o;
|
|
@@ -1609,7 +1609,7 @@ class ve {
|
|
|
1609
1609
|
case "grid":
|
|
1610
1610
|
return new ue(this.config, this.imageConfig);
|
|
1611
1611
|
case "spiral":
|
|
1612
|
-
return new
|
|
1612
|
+
return new fe(this.config, this.imageConfig);
|
|
1613
1613
|
case "cluster":
|
|
1614
1614
|
return new be(this.config, this.imageConfig);
|
|
1615
1615
|
case "wave":
|
|
@@ -1698,14 +1698,14 @@ class ve {
|
|
|
1698
1698
|
if (r !== void 0)
|
|
1699
1699
|
return { height: r };
|
|
1700
1700
|
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;
|
|
1701
|
-
let
|
|
1702
|
-
|
|
1703
|
-
let
|
|
1704
|
-
if (
|
|
1701
|
+
let f = Math.sqrt(p / 1.4);
|
|
1702
|
+
f *= u, f = Math.min(f, i);
|
|
1703
|
+
let S = this.clamp(f, a, h);
|
|
1704
|
+
if (S === a && f < a) {
|
|
1705
1705
|
const v = Math.max(a * 0.05, 20);
|
|
1706
|
-
|
|
1706
|
+
S = Math.max(v, f);
|
|
1707
1707
|
}
|
|
1708
|
-
return { height:
|
|
1708
|
+
return { height: S };
|
|
1709
1709
|
}
|
|
1710
1710
|
/**
|
|
1711
1711
|
* Utility: Clamp a value between min and max
|
|
@@ -1716,12 +1716,12 @@ class ve {
|
|
|
1716
1716
|
}
|
|
1717
1717
|
var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
|
|
1718
1718
|
function we(n) {
|
|
1719
|
-
return n in
|
|
1719
|
+
return n in mt;
|
|
1720
1720
|
}
|
|
1721
1721
|
function xe(n) {
|
|
1722
|
-
return n ? we(n) ?
|
|
1722
|
+
return n ? we(n) ? mt[n] : n : mt.md;
|
|
1723
1723
|
}
|
|
1724
|
-
function
|
|
1724
|
+
function Se(n) {
|
|
1725
1725
|
if (!n) return "";
|
|
1726
1726
|
const t = [];
|
|
1727
1727
|
if (n.grayscale !== void 0 && t.push(`grayscale(${n.grayscale})`), n.blur !== void 0 && t.push(`blur(${n.blur}px)`), n.brightness !== void 0 && t.push(`brightness(${n.brightness})`), n.contrast !== void 0 && t.push(`contrast(${n.contrast})`), n.saturate !== void 0 && t.push(`saturate(${n.saturate})`), n.opacity !== void 0 && t.push(`opacity(${n.opacity})`), n.sepia !== void 0 && t.push(`sepia(${n.sepia})`), n.hueRotate !== void 0 && t.push(`hue-rotate(${n.hueRotate}deg)`), n.invert !== void 0 && t.push(`invert(${n.invert})`), n.dropShadow !== void 0)
|
|
@@ -1751,7 +1751,7 @@ function st(n) {
|
|
|
1751
1751
|
t.borderTop = Q(r), t.borderRight = Q(a), t.borderBottom = Q(h), t.borderLeft = Q(c);
|
|
1752
1752
|
} else n.border && (t.border = Q(n.border));
|
|
1753
1753
|
n.shadow !== void 0 && (t.boxShadow = xe(n.shadow));
|
|
1754
|
-
const o =
|
|
1754
|
+
const o = Se(n.filter);
|
|
1755
1755
|
if (t.filter = o || "none", n.opacity !== void 0 && (t.opacity = String(n.opacity)), n.cursor !== void 0 && (t.cursor = n.cursor), n.outline && n.outline.style !== "none" && (n.outline.width ?? 0) > 0) {
|
|
1756
1756
|
const s = n.outline.width ?? 0, r = n.outline.style ?? "solid", a = n.outline.color ?? "#000000";
|
|
1757
1757
|
t.outline = `${s}px ${r} ${a}`, n.outline.offset !== void 0 && (t.outlineOffset = `${n.outline.offset}px`);
|
|
@@ -1761,26 +1761,26 @@ function st(n) {
|
|
|
1761
1761
|
function tt(n, t) {
|
|
1762
1762
|
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);
|
|
1763
1763
|
}
|
|
1764
|
-
function
|
|
1764
|
+
function Lt(n) {
|
|
1765
1765
|
return n ? Array.isArray(n) ? n.join(" ") : n : "";
|
|
1766
1766
|
}
|
|
1767
1767
|
function et(n, t) {
|
|
1768
|
-
const e =
|
|
1768
|
+
const e = Lt(t);
|
|
1769
1769
|
e && e.split(" ").forEach((i) => {
|
|
1770
1770
|
i.trim() && n.classList.add(i.trim());
|
|
1771
1771
|
});
|
|
1772
1772
|
}
|
|
1773
1773
|
function zt(n, t) {
|
|
1774
|
-
const e =
|
|
1774
|
+
const e = Lt(t);
|
|
1775
1775
|
e && e.split(" ").forEach((i) => {
|
|
1776
1776
|
i.trim() && n.classList.remove(i.trim());
|
|
1777
1777
|
});
|
|
1778
1778
|
}
|
|
1779
|
-
const
|
|
1779
|
+
const At = {
|
|
1780
1780
|
UNFOCUSING: 999,
|
|
1781
1781
|
FOCUSING: 1e3
|
|
1782
1782
|
};
|
|
1783
|
-
class
|
|
1783
|
+
class Ee {
|
|
1784
1784
|
constructor(t, e, i) {
|
|
1785
1785
|
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;
|
|
1786
1786
|
}
|
|
@@ -1883,19 +1883,19 @@ class Se {
|
|
|
1883
1883
|
*/
|
|
1884
1884
|
startFocusAnimation(t, e, i, o, s) {
|
|
1885
1885
|
const r = t.style.zIndex || "", a = t.offsetWidth, h = t.offsetHeight, c = this.calculateFocusDimensions(a, h, e), u = this.calculateFocusTransform(e, i);
|
|
1886
|
-
this.applyFocusedStyling(t,
|
|
1886
|
+
this.applyFocusedStyling(t, At.FOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1887
1887
|
const l = o ?? {
|
|
1888
1888
|
x: 0,
|
|
1889
1889
|
y: 0,
|
|
1890
1890
|
rotation: i.rotation,
|
|
1891
1891
|
scale: 1
|
|
1892
1892
|
// No scale - using dimensions
|
|
1893
|
-
}, d = s?.width ?? a,
|
|
1893
|
+
}, d = s?.width ?? a, m = s?.height ?? h, b = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
|
|
1894
1894
|
t,
|
|
1895
1895
|
l,
|
|
1896
1896
|
u,
|
|
1897
1897
|
d,
|
|
1898
|
-
|
|
1898
|
+
m,
|
|
1899
1899
|
c.width,
|
|
1900
1900
|
c.height,
|
|
1901
1901
|
b
|
|
@@ -1932,7 +1932,7 @@ class Se {
|
|
|
1932
1932
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1933
1933
|
*/
|
|
1934
1934
|
startUnfocusAnimation(t, e, i, o) {
|
|
1935
|
-
t.style.zIndex = String(
|
|
1935
|
+
t.style.zIndex = String(At.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1936
1936
|
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 = {
|
|
1937
1937
|
x: 0,
|
|
1938
1938
|
y: 0,
|
|
@@ -1948,7 +1948,7 @@ class Se {
|
|
|
1948
1948
|
c,
|
|
1949
1949
|
u,
|
|
1950
1950
|
l
|
|
1951
|
-
),
|
|
1951
|
+
), m = {
|
|
1952
1952
|
id: `unfocus-${Date.now()}`,
|
|
1953
1953
|
element: t,
|
|
1954
1954
|
animation: d,
|
|
@@ -1960,12 +1960,33 @@ class Se {
|
|
|
1960
1960
|
return {
|
|
1961
1961
|
element: t,
|
|
1962
1962
|
originalState: e,
|
|
1963
|
-
animationHandle:
|
|
1963
|
+
animationHandle: m,
|
|
1964
1964
|
direction: "out",
|
|
1965
1965
|
originalWidth: c,
|
|
1966
1966
|
originalHeight: u
|
|
1967
1967
|
};
|
|
1968
1968
|
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Capture the current visual state of an element mid-animation, BEFORE cancelling.
|
|
1971
|
+
*
|
|
1972
|
+
* The computed matrix.e/f include the -50%/-50% centering offset resolved to pixels.
|
|
1973
|
+
* buildDimensionZoomTransform prepends its own translate(-50%,-50%), so passing raw
|
|
1974
|
+
* matrix.e/f doubles the centering and produces the wrong starting position.
|
|
1975
|
+
*
|
|
1976
|
+
* This method extracts the PURE positional offset (pureX = matrix.e + 0.5*midWidth)
|
|
1977
|
+
* and commits width/height/transform to inline styles before the animation is cancelled,
|
|
1978
|
+
* preventing any visual snap.
|
|
1979
|
+
*
|
|
1980
|
+
* Must be called while the animation is still running (offsetWidth reflects animated size).
|
|
1981
|
+
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
1982
|
+
*/
|
|
1983
|
+
captureMidAnimationState(t) {
|
|
1984
|
+
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);
|
|
1985
|
+
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", {
|
|
1986
|
+
transform: { x: r, y: a, rotation: h, scale: 1 },
|
|
1987
|
+
dimensions: { width: o, height: s }
|
|
1988
|
+
};
|
|
1989
|
+
}
|
|
1969
1990
|
/**
|
|
1970
1991
|
* Handle animation completion
|
|
1971
1992
|
*/
|
|
@@ -1991,21 +2012,12 @@ class Se {
|
|
|
1991
2012
|
if (this.currentFocus === t && this.state === I.FOCUSED)
|
|
1992
2013
|
return this.unfocusImage();
|
|
1993
2014
|
if (this.incoming?.element === t && this.state === I.FOCUSING) {
|
|
1994
|
-
const
|
|
1995
|
-
|
|
1996
|
-
y: s.y,
|
|
1997
|
-
rotation: s.rotation,
|
|
1998
|
-
scale: 1
|
|
1999
|
-
// No scale transform - using dimensions
|
|
2000
|
-
}, a = {
|
|
2001
|
-
width: t.offsetWidth,
|
|
2002
|
-
height: t.offsetHeight
|
|
2003
|
-
};
|
|
2004
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2015
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2016
|
+
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2005
2017
|
t,
|
|
2006
2018
|
this.incoming.originalState,
|
|
2007
|
-
|
|
2008
|
-
|
|
2019
|
+
s,
|
|
2020
|
+
r
|
|
2009
2021
|
), 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;
|
|
2010
2022
|
return;
|
|
2011
2023
|
}
|
|
@@ -2047,36 +2059,18 @@ class Se {
|
|
|
2047
2059
|
if (this.incoming?.element === t)
|
|
2048
2060
|
return;
|
|
2049
2061
|
if (this.outgoing?.element === t) {
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
scale: 1
|
|
2055
|
-
// No scale - using dimensions
|
|
2056
|
-
}, a = {
|
|
2057
|
-
width: t.offsetWidth,
|
|
2058
|
-
height: t.offsetHeight
|
|
2059
|
-
};
|
|
2060
|
-
if (this.incoming) {
|
|
2061
|
-
const h = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), c = {
|
|
2062
|
-
x: h.x,
|
|
2063
|
-
y: h.y,
|
|
2064
|
-
rotation: h.rotation,
|
|
2065
|
-
scale: 1
|
|
2066
|
-
// No scale - using dimensions
|
|
2067
|
-
}, u = {
|
|
2068
|
-
width: this.incoming.element.offsetWidth,
|
|
2069
|
-
height: this.incoming.element.offsetHeight
|
|
2070
|
-
};
|
|
2071
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2062
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2063
|
+
if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
|
|
2064
|
+
const { transform: a, dimensions: h } = this.captureMidAnimationState(this.incoming.element);
|
|
2065
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2072
2066
|
this.incoming.element,
|
|
2073
2067
|
this.incoming.originalState,
|
|
2074
|
-
|
|
2075
|
-
|
|
2068
|
+
a,
|
|
2069
|
+
h
|
|
2076
2070
|
);
|
|
2077
2071
|
} else
|
|
2078
2072
|
this.outgoing = null;
|
|
2079
|
-
if (this.incoming = this.startFocusAnimation(t, e, i,
|
|
2073
|
+
if (this.incoming = this.startFocusAnimation(t, e, i, s, r), await Promise.all([
|
|
2080
2074
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2081
2075
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2082
2076
|
]), this.focusGeneration !== o) return;
|
|
@@ -2090,21 +2084,12 @@ class Se {
|
|
|
2090
2084
|
this.outgoing.originalWidth,
|
|
2091
2085
|
this.outgoing.originalHeight
|
|
2092
2086
|
), this.outgoing = null), this.incoming) {
|
|
2093
|
-
const s = this.
|
|
2094
|
-
|
|
2095
|
-
y: s.y,
|
|
2096
|
-
rotation: s.rotation,
|
|
2097
|
-
scale: 1
|
|
2098
|
-
// No scale - using dimensions
|
|
2099
|
-
}, a = {
|
|
2100
|
-
width: this.incoming.element.offsetWidth,
|
|
2101
|
-
height: this.incoming.element.offsetHeight
|
|
2102
|
-
};
|
|
2103
|
-
this.outgoing = this.startUnfocusAnimation(
|
|
2087
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2088
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2104
2089
|
this.incoming.element,
|
|
2105
2090
|
this.incoming.originalState,
|
|
2106
|
-
|
|
2107
|
-
|
|
2091
|
+
s,
|
|
2092
|
+
r
|
|
2108
2093
|
);
|
|
2109
2094
|
}
|
|
2110
2095
|
if (this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
@@ -2119,50 +2104,36 @@ class Se {
|
|
|
2119
2104
|
* Unfocus current image, returning it to original position
|
|
2120
2105
|
*/
|
|
2121
2106
|
async unfocusImage() {
|
|
2107
|
+
if (this.state === I.UNFOCUSING)
|
|
2108
|
+
return;
|
|
2122
2109
|
const t = ++this.focusGeneration;
|
|
2123
2110
|
if (!this.currentFocus || !this.focusData) {
|
|
2124
2111
|
if (this.incoming && this.state === I.FOCUSING) {
|
|
2125
|
-
const s = this.
|
|
2126
|
-
|
|
2127
|
-
y: s.y,
|
|
2128
|
-
rotation: s.rotation,
|
|
2129
|
-
scale: 1
|
|
2130
|
-
// No scale - using dimensions
|
|
2131
|
-
}, a = {
|
|
2132
|
-
width: this.incoming.element.offsetWidth,
|
|
2133
|
-
height: this.incoming.element.offsetHeight
|
|
2134
|
-
};
|
|
2135
|
-
if (this.outgoing = this.startUnfocusAnimation(
|
|
2112
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2113
|
+
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2136
2114
|
this.incoming.element,
|
|
2137
2115
|
this.incoming.originalState,
|
|
2138
|
-
|
|
2139
|
-
|
|
2116
|
+
s,
|
|
2117
|
+
r
|
|
2140
2118
|
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2141
2119
|
this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = I.IDLE;
|
|
2142
2120
|
}
|
|
2143
2121
|
return;
|
|
2144
2122
|
}
|
|
2145
2123
|
if (this.state === I.CROSS_ANIMATING && this.incoming) {
|
|
2146
|
-
const s = this.
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
rotation: s.rotation,
|
|
2150
|
-
scale: 1
|
|
2151
|
-
// No scale - using dimensions
|
|
2152
|
-
}, a = {
|
|
2153
|
-
width: this.incoming.element.offsetWidth,
|
|
2154
|
-
height: this.incoming.element.offsetHeight
|
|
2155
|
-
}, h = this.startUnfocusAnimation(
|
|
2124
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2125
|
+
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2126
|
+
const a = this.startUnfocusAnimation(
|
|
2156
2127
|
this.incoming.element,
|
|
2157
2128
|
this.incoming.originalState,
|
|
2158
|
-
|
|
2159
|
-
|
|
2129
|
+
s,
|
|
2130
|
+
r
|
|
2160
2131
|
);
|
|
2161
2132
|
if (await Promise.all([
|
|
2162
2133
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2163
|
-
this.waitForAnimation(
|
|
2134
|
+
this.waitForAnimation(a.animationHandle)
|
|
2164
2135
|
]), this.focusGeneration !== t) return;
|
|
2165
|
-
this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(
|
|
2136
|
+
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;
|
|
2166
2137
|
return;
|
|
2167
2138
|
}
|
|
2168
2139
|
this.state = I.UNFOCUSING;
|
|
@@ -2249,7 +2220,7 @@ class Se {
|
|
|
2249
2220
|
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2250
2221
|
}
|
|
2251
2222
|
}
|
|
2252
|
-
const Ie = 50,
|
|
2223
|
+
const Ie = 50, Ae = 0.5, Te = 20, Ce = 0.3, Re = 150, Me = 30, at = class at {
|
|
2253
2224
|
constructor(t, e) {
|
|
2254
2225
|
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);
|
|
2255
2226
|
}
|
|
@@ -2296,11 +2267,11 @@ const Ie = 50, Te = 0.5, Ce = 20, Re = 0.3, Ae = 150, Le = 30, at = class at {
|
|
|
2296
2267
|
const e = t.touches[0], i = e.clientX - this.touchState.startX, o = e.clientY - this.touchState.startY;
|
|
2297
2268
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + o * o) > 10) {
|
|
2298
2269
|
const a = Math.atan2(Math.abs(o), Math.abs(i)) * (180 / Math.PI);
|
|
2299
|
-
this.touchState.isHorizontalSwipe = a <=
|
|
2270
|
+
this.touchState.isHorizontalSwipe = a <= Me;
|
|
2300
2271
|
}
|
|
2301
2272
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2302
2273
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
|
|
2303
|
-
const s = i *
|
|
2274
|
+
const s = i * Ce;
|
|
2304
2275
|
this.callbacks.onDragOffset(s);
|
|
2305
2276
|
}
|
|
2306
2277
|
}
|
|
@@ -2309,15 +2280,15 @@ const Ie = 50, Te = 0.5, Ce = 20, Re = 0.3, Ae = 150, Le = 30, at = class at {
|
|
|
2309
2280
|
this.recentTouchTimestamp = Date.now();
|
|
2310
2281
|
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, o = Math.abs(e) / i, s = Math.abs(e);
|
|
2311
2282
|
let r = !1;
|
|
2312
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Ie || o >=
|
|
2283
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Ie || o >= Ae && s >= Te) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2313
2284
|
}
|
|
2314
2285
|
handleTouchCancel(t) {
|
|
2315
2286
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
2316
2287
|
}
|
|
2317
2288
|
};
|
|
2318
2289
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2319
|
-
let
|
|
2320
|
-
class
|
|
2290
|
+
let ft = at;
|
|
2291
|
+
class Le {
|
|
2321
2292
|
constructor(t) {
|
|
2322
2293
|
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)
|
|
2323
2294
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2874,7 +2845,7 @@ let Ue = class {
|
|
|
2874
2845
|
this.fullConfig = Xt(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 Kt(this.fullConfig.animation), this.layoutEngine = new ve({
|
|
2875
2846
|
layout: this.fullConfig.layout,
|
|
2876
2847
|
image: this.fullConfig.image
|
|
2877
|
-
}), this.zoomEngine = new
|
|
2848
|
+
}), this.zoomEngine = new Ee(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;
|
|
2878
2849
|
const e = this.fullConfig.animation.entry || y.animation.entry;
|
|
2879
2850
|
this.entryAnimationEngine = new ce(
|
|
2880
2851
|
e,
|
|
@@ -2922,7 +2893,7 @@ let Ue = class {
|
|
|
2922
2893
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2923
2894
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2924
2895
|
};
|
|
2925
|
-
return new
|
|
2896
|
+
return new Le(o);
|
|
2926
2897
|
} else
|
|
2927
2898
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
2928
2899
|
}
|
|
@@ -2935,12 +2906,12 @@ let Ue = class {
|
|
|
2935
2906
|
this.containerEl = this.containerRef;
|
|
2936
2907
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
2937
2908
|
throw new Error(`Container #${this.containerId} not found`);
|
|
2938
|
-
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new
|
|
2909
|
+
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new ft(this.containerEl, {
|
|
2939
2910
|
onNext: () => this.navigateToNextImage(),
|
|
2940
2911
|
onPrev: () => this.navigateToPreviousImage(),
|
|
2941
2912
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
2942
2913
|
onDragEnd: (t) => {
|
|
2943
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
2914
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Re);
|
|
2944
2915
|
}
|
|
2945
2916
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
2946
2917
|
} catch (t) {
|
|
@@ -3067,22 +3038,22 @@ let Ue = class {
|
|
|
3067
3038
|
const d = {
|
|
3068
3039
|
x: parseFloat(c.dataset.startX),
|
|
3069
3040
|
y: parseFloat(c.dataset.startY)
|
|
3070
|
-
},
|
|
3041
|
+
}, m = {
|
|
3071
3042
|
x: parseFloat(c.dataset.endX),
|
|
3072
3043
|
y: parseFloat(c.dataset.endY)
|
|
3073
|
-
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation),
|
|
3044
|
+
}, 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();
|
|
3074
3045
|
se({
|
|
3075
3046
|
element: c,
|
|
3076
3047
|
startPosition: d,
|
|
3077
|
-
endPosition:
|
|
3048
|
+
endPosition: m,
|
|
3078
3049
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3079
3050
|
duration: w.duration,
|
|
3080
3051
|
imageWidth: b,
|
|
3081
3052
|
imageHeight: p,
|
|
3082
3053
|
rotation: g,
|
|
3083
|
-
scale:
|
|
3054
|
+
scale: f,
|
|
3084
3055
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3085
|
-
startRotation:
|
|
3056
|
+
startRotation: S,
|
|
3086
3057
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3087
3058
|
startScale: v
|
|
3088
3059
|
});
|
|
@@ -3137,8 +3108,8 @@ let Ue = class {
|
|
|
3137
3108
|
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), s.forEach((c, u) => {
|
|
3138
3109
|
const l = document.createElement("div");
|
|
3139
3110
|
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";
|
|
3140
|
-
const d = c.x,
|
|
3141
|
-
l.style.left = `${d - 6}px`, l.style.top = `${
|
|
3111
|
+
const d = c.x, m = c.y;
|
|
3112
|
+
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);
|
|
3142
3113
|
})), t.forEach((c, u) => {
|
|
3143
3114
|
const l = document.createElement("img");
|
|
3144
3115
|
l.referrerPolicy = "no-referrer", l.classList.add("fbn-ic-image"), l.dataset.imageId = String(u);
|
|
@@ -3147,32 +3118,32 @@ let Ue = class {
|
|
|
3147
3118
|
this.hoveredImage = { element: l, layout: d }, this.zoomEngine.isInvolved(l) || (tt(l, this.hoverStyles), et(l, this.hoverClassName));
|
|
3148
3119
|
}), l.addEventListener("mouseleave", () => {
|
|
3149
3120
|
this.hoveredImage = null, this.zoomEngine.isInvolved(l) || (tt(l, this.defaultStyles), zt(l, this.hoverClassName), et(l, this.defaultClassName));
|
|
3150
|
-
}), l.addEventListener("click", (
|
|
3151
|
-
|
|
3121
|
+
}), l.addEventListener("click", (m) => {
|
|
3122
|
+
m.stopPropagation(), this.handleImageClick(l, d);
|
|
3152
3123
|
}), l.style.opacity = "0", l.style.transition = this.entryAnimationEngine.getTransitionCSS(), l.onload = () => {
|
|
3153
3124
|
if (o !== this.loadGeneration)
|
|
3154
3125
|
return;
|
|
3155
|
-
const
|
|
3126
|
+
const m = l.naturalWidth / l.naturalHeight, b = e * m;
|
|
3156
3127
|
l.style.width = `${b}px`;
|
|
3157
|
-
const p = { x: d.x, y: d.y }, g = { width: b, height: e },
|
|
3128
|
+
const p = { x: d.x, y: d.y }, g = { width: b, height: e }, f = this.entryAnimationEngine.calculateStartPosition(
|
|
3158
3129
|
p,
|
|
3159
3130
|
g,
|
|
3160
3131
|
i,
|
|
3161
3132
|
u,
|
|
3162
3133
|
t.length
|
|
3163
|
-
),
|
|
3134
|
+
), S = this.entryAnimationEngine.calculateStartRotation(d.rotation), v = this.entryAnimationEngine.calculateStartScale(d.scale), w = this.entryAnimationEngine.buildFinalTransform(
|
|
3164
3135
|
d.rotation,
|
|
3165
3136
|
d.scale,
|
|
3166
3137
|
b,
|
|
3167
3138
|
e
|
|
3168
|
-
),
|
|
3169
|
-
|
|
3139
|
+
), E = this.entryAnimationEngine.buildStartTransform(
|
|
3140
|
+
f,
|
|
3170
3141
|
p,
|
|
3171
3142
|
d.rotation,
|
|
3172
3143
|
d.scale,
|
|
3173
3144
|
b,
|
|
3174
3145
|
e,
|
|
3175
|
-
|
|
3146
|
+
S,
|
|
3176
3147
|
v
|
|
3177
3148
|
);
|
|
3178
3149
|
this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
|
|
@@ -3183,7 +3154,7 @@ let Ue = class {
|
|
|
3183
3154
|
finalTransform: w,
|
|
3184
3155
|
renderedWidth: b,
|
|
3185
3156
|
renderedHeight: e
|
|
3186
|
-
}), l.style.transform =
|
|
3157
|
+
}), 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);
|
|
3187
3158
|
}, l.onerror = () => r++, l.src = c;
|
|
3188
3159
|
});
|
|
3189
3160
|
}
|