@frybynite/image-cloud 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-cloud-auto-init.js +177 -158
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +237 -218
- 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 +3 -0
- package/dist/react.d.ts +3 -0
- package/dist/react.js +222 -203
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +3 -0
- package/dist/vue.js +224 -205
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +3 -0
- package/dist/web-component.js +171 -152
- package/dist/web-component.js.map +1 -1
- package/package.json +17 -1
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as $t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Pt, useRef as wt, useImperativeHandle as Ut, useEffect as _t } from "react";
|
|
3
|
+
const ft = 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)",
|
|
@@ -26,7 +26,7 @@ const mt = Object.freeze({
|
|
|
26
26
|
mode: "none"
|
|
27
27
|
}), yt = Object.freeze({
|
|
28
28
|
mode: "none"
|
|
29
|
-
}),
|
|
29
|
+
}), Ct = Object.freeze({
|
|
30
30
|
default: Object.freeze({
|
|
31
31
|
border: Object.freeze({
|
|
32
32
|
width: 0,
|
|
@@ -35,6 +35,7 @@ const mt = Object.freeze({
|
|
|
35
35
|
style: "solid"
|
|
36
36
|
}),
|
|
37
37
|
shadow: "none",
|
|
38
|
+
clipPath: void 0,
|
|
38
39
|
filter: Object.freeze({}),
|
|
39
40
|
opacity: 1,
|
|
40
41
|
cursor: "pointer",
|
|
@@ -51,17 +52,17 @@ const mt = Object.freeze({
|
|
|
51
52
|
focused: Object.freeze({
|
|
52
53
|
shadow: "none"
|
|
53
54
|
})
|
|
54
|
-
}),
|
|
55
|
+
}), Ht = Object.freeze({
|
|
55
56
|
rows: 1,
|
|
56
57
|
amplitude: 100,
|
|
57
58
|
frequency: 2,
|
|
58
59
|
phaseShift: 0,
|
|
59
60
|
synchronization: "offset"
|
|
60
61
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
61
|
-
}),
|
|
62
|
+
}), Nt = Object.freeze({
|
|
62
63
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
63
64
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
64
|
-
}),
|
|
65
|
+
}), jt = Object.freeze({
|
|
65
66
|
mode: "adaptive",
|
|
66
67
|
// Default to adaptive sizing
|
|
67
68
|
minSize: 50,
|
|
@@ -73,21 +74,21 @@ const mt = Object.freeze({
|
|
|
73
74
|
// No variance by default
|
|
74
75
|
max: 1
|
|
75
76
|
})
|
|
76
|
-
}),
|
|
77
|
+
}), kt = Object.freeze({
|
|
77
78
|
mode: "none",
|
|
78
79
|
range: Object.freeze({
|
|
79
80
|
min: -15,
|
|
80
81
|
max: 15
|
|
81
82
|
})
|
|
82
|
-
}), Ct = Object.freeze({
|
|
83
|
-
sizing: Nt,
|
|
84
|
-
rotation: jt
|
|
85
83
|
}), Rt = Object.freeze({
|
|
84
|
+
sizing: jt,
|
|
85
|
+
rotation: kt
|
|
86
|
+
}), Mt = Object.freeze({
|
|
86
87
|
validateUrls: !0,
|
|
87
88
|
validationTimeout: 5e3,
|
|
88
89
|
validationMethod: "head",
|
|
89
90
|
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
|
|
90
|
-
}),
|
|
91
|
+
}), Lt = Object.freeze({
|
|
91
92
|
enabled: !1,
|
|
92
93
|
centers: !1,
|
|
93
94
|
loaders: !1
|
|
@@ -96,17 +97,17 @@ const mt = Object.freeze({
|
|
|
96
97
|
loaders: [],
|
|
97
98
|
// Shared loader settings and debug config
|
|
98
99
|
config: Object.freeze({
|
|
99
|
-
loaders:
|
|
100
|
-
debug:
|
|
100
|
+
loaders: Mt,
|
|
101
|
+
debug: Lt
|
|
101
102
|
}),
|
|
102
103
|
// Image sizing and rotation configuration
|
|
103
|
-
image:
|
|
104
|
+
image: Rt,
|
|
104
105
|
// Pattern-based layout configuration
|
|
105
106
|
layout: Object.freeze({
|
|
106
107
|
algorithm: "radial",
|
|
107
108
|
scaleDecay: 0,
|
|
108
109
|
// No decay by default (0-1 for radial/spiral)
|
|
109
|
-
responsive:
|
|
110
|
+
responsive: Nt,
|
|
110
111
|
targetCoverage: 0.6,
|
|
111
112
|
// Target 60% of container area
|
|
112
113
|
densityFactor: 1,
|
|
@@ -217,15 +218,15 @@ const mt = Object.freeze({
|
|
|
217
218
|
})
|
|
218
219
|
}),
|
|
219
220
|
// Image styling
|
|
220
|
-
styling:
|
|
221
|
+
styling: Ct
|
|
221
222
|
});
|
|
222
223
|
function Z(n, t) {
|
|
223
224
|
if (!n) return t || {};
|
|
224
225
|
if (!t) return { ...n };
|
|
225
226
|
const e = { ...n };
|
|
226
|
-
return t.border !== void 0 && (e.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (e.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (e.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (e.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (e.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (e.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (e.outline = { ...n.outline, ...t.outline }), t.shadow !== void 0 && (e.shadow = t.shadow), t.opacity !== void 0 && (e.opacity = t.opacity), t.cursor !== void 0 && (e.cursor = t.cursor), t.className !== void 0 && (e.className = t.className), t.objectFit !== void 0 && (e.objectFit = t.objectFit), t.aspectRatio !== void 0 && (e.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (e.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (e.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (e.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (e.borderRadiusBottomLeft = t.borderRadiusBottomLeft), e;
|
|
227
|
+
return t.border !== void 0 && (e.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (e.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (e.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (e.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (e.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (e.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (e.outline = { ...n.outline, ...t.outline }), t.shadow !== void 0 && (e.shadow = t.shadow), t.clipPath !== void 0 && (e.clipPath = t.clipPath), t.opacity !== void 0 && (e.opacity = t.opacity), t.cursor !== void 0 && (e.cursor = t.cursor), t.className !== void 0 && (e.className = t.className), t.objectFit !== void 0 && (e.objectFit = t.objectFit), t.aspectRatio !== void 0 && (e.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (e.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (e.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (e.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (e.borderRadiusBottomLeft = t.borderRadiusBottomLeft), e;
|
|
227
228
|
}
|
|
228
|
-
function
|
|
229
|
+
function Wt(n, t) {
|
|
229
230
|
if (!t) return { ...n };
|
|
230
231
|
const e = Z(n.default, t.default), i = Z(
|
|
231
232
|
Z(e, n.hover),
|
|
@@ -240,7 +241,7 @@ function kt(n, t) {
|
|
|
240
241
|
focused: o
|
|
241
242
|
};
|
|
242
243
|
}
|
|
243
|
-
function
|
|
244
|
+
function Gt(n, t) {
|
|
244
245
|
if (!t) return { ...n };
|
|
245
246
|
const e = { ...n };
|
|
246
247
|
if (t.sizing !== void 0 && (e.sizing = {
|
|
@@ -259,7 +260,7 @@ function Wt(n, t) {
|
|
|
259
260
|
}
|
|
260
261
|
return e;
|
|
261
262
|
}
|
|
262
|
-
function
|
|
263
|
+
function qt(n) {
|
|
263
264
|
const t = n.layout?.rotation;
|
|
264
265
|
if (t && "enabled" in t)
|
|
265
266
|
return {
|
|
@@ -269,7 +270,7 @@ function Gt(n) {
|
|
|
269
270
|
}
|
|
270
271
|
};
|
|
271
272
|
}
|
|
272
|
-
function
|
|
273
|
+
function Yt(n) {
|
|
273
274
|
const t = n.layout?.sizing?.variance;
|
|
274
275
|
if (t)
|
|
275
276
|
return {
|
|
@@ -280,8 +281,8 @@ function qt(n) {
|
|
|
280
281
|
}
|
|
281
282
|
};
|
|
282
283
|
}
|
|
283
|
-
function
|
|
284
|
-
const t =
|
|
284
|
+
function Xt(n = {}) {
|
|
285
|
+
const t = qt(n), e = Yt(n);
|
|
285
286
|
let i = n.image;
|
|
286
287
|
(t || e) && (i = {
|
|
287
288
|
...e || {},
|
|
@@ -299,18 +300,18 @@ function Yt(n = {}) {
|
|
|
299
300
|
});
|
|
300
301
|
const r = {
|
|
301
302
|
loaders: {
|
|
302
|
-
...
|
|
303
|
+
...Mt,
|
|
303
304
|
...n.config?.loaders ?? {}
|
|
304
305
|
}
|
|
305
306
|
}, a = {
|
|
306
307
|
loaders: o,
|
|
307
308
|
config: r,
|
|
308
|
-
image:
|
|
309
|
+
image: Gt(Rt, i),
|
|
309
310
|
layout: { ...y.layout },
|
|
310
311
|
animation: { ...y.animation },
|
|
311
312
|
interaction: { ...y.interaction },
|
|
312
313
|
rendering: { ...y.rendering },
|
|
313
|
-
styling:
|
|
314
|
+
styling: Wt(Ct, n.styling)
|
|
314
315
|
};
|
|
315
316
|
return n.layout && (a.layout = {
|
|
316
317
|
...y.layout,
|
|
@@ -373,20 +374,20 @@ function Yt(n = {}) {
|
|
|
373
374
|
...y.rendering.performance,
|
|
374
375
|
...n.rendering.performance
|
|
375
376
|
})), a.config.debug = {
|
|
376
|
-
...
|
|
377
|
+
...Lt,
|
|
377
378
|
...n.config?.debug ?? {}
|
|
378
379
|
}, a;
|
|
379
380
|
}
|
|
380
|
-
function
|
|
381
|
+
function Bt(n, t) {
|
|
381
382
|
return { ...n ? xt[n] : xt.playful, ...t };
|
|
382
383
|
}
|
|
383
|
-
function
|
|
384
|
+
function Jt(n, t) {
|
|
384
385
|
return { ...n ? St[n] : St.gentle, ...t };
|
|
385
386
|
}
|
|
386
|
-
function
|
|
387
|
+
function Vt(n, t) {
|
|
387
388
|
return { ...n ? Et[n] : Et.gentle, ...t };
|
|
388
389
|
}
|
|
389
|
-
class
|
|
390
|
+
class Kt {
|
|
390
391
|
constructor(t) {
|
|
391
392
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
392
393
|
}
|
|
@@ -545,31 +546,31 @@ class Vt {
|
|
|
545
546
|
function V(n, t, e) {
|
|
546
547
|
return n + (t - n) * e;
|
|
547
548
|
}
|
|
548
|
-
function
|
|
549
|
-
const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x, h = e.y - t.y, c =
|
|
550
|
-
let u = 0, l = 0, d = 1,
|
|
549
|
+
function Zt(n, t, e, i) {
|
|
550
|
+
const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x, h = e.y - t.y, c = Qt(s, r);
|
|
551
|
+
let u = 0, l = 0, d = 1, f = o, b = !1;
|
|
551
552
|
for (let g = 0; g < c.length; g++)
|
|
552
553
|
if (n <= c[g].time) {
|
|
553
|
-
l = g === 0 ? 0 : c[g - 1].time, d = c[g].time,
|
|
554
|
+
l = g === 0 ? 0 : c[g - 1].time, d = c[g].time, f = c[g].overshoot, b = c[g].isOvershoot;
|
|
554
555
|
break;
|
|
555
556
|
}
|
|
556
557
|
const p = (n - l) / (d - l);
|
|
557
558
|
if (b)
|
|
558
|
-
u = 1 +
|
|
559
|
+
u = 1 + f * ot(p);
|
|
559
560
|
else if (l === 0)
|
|
560
561
|
u = ot(p);
|
|
561
562
|
else {
|
|
562
|
-
const
|
|
563
|
+
const m = 1 + (c.find(
|
|
563
564
|
(S, v) => S.time > l && v > 0 && c[v - 1].isOvershoot
|
|
564
|
-
)?.overshoot ||
|
|
565
|
-
u = V(
|
|
565
|
+
)?.overshoot || f);
|
|
566
|
+
u = V(m, 1, ot(p));
|
|
566
567
|
}
|
|
567
568
|
return {
|
|
568
569
|
x: t.x + a * u,
|
|
569
570
|
y: t.y + h * u
|
|
570
571
|
};
|
|
571
572
|
}
|
|
572
|
-
function
|
|
573
|
+
function Qt(n, t) {
|
|
573
574
|
const e = [];
|
|
574
575
|
let i = 0.6;
|
|
575
576
|
e.push({ time: i, overshoot: 0, isOvershoot: !1 });
|
|
@@ -579,11 +580,11 @@ function Zt(n, t) {
|
|
|
579
580
|
i += r, e.push({ time: i, overshoot: o, isOvershoot: !0 }), i += r, e.push({ time: i, overshoot: o * t, isOvershoot: !1 }), o *= t;
|
|
580
581
|
return e.push({ time: 1, overshoot: 0, isOvershoot: !1 }), e;
|
|
581
582
|
}
|
|
582
|
-
function
|
|
583
|
+
function te(n, t, e, i) {
|
|
583
584
|
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));
|
|
584
585
|
let d;
|
|
585
586
|
if (l < 1) {
|
|
586
|
-
const
|
|
587
|
+
const f = u * Math.sqrt(1 - l * l), b = Math.exp(-l * u * n * 3), p = Math.cos(f * n * a * Math.PI);
|
|
587
588
|
d = 1 - b * p;
|
|
588
589
|
} else
|
|
589
590
|
d = 1 - Math.exp(-u * n * 3);
|
|
@@ -592,44 +593,44 @@ function Qt(n, t, e, i) {
|
|
|
592
593
|
y: t.y + c * d
|
|
593
594
|
};
|
|
594
595
|
}
|
|
595
|
-
function
|
|
596
|
-
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,
|
|
596
|
+
function ee(n, t, e, i) {
|
|
597
|
+
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, f = 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, m = ie(n);
|
|
597
598
|
return {
|
|
598
|
-
x: V(t.x, e.x,
|
|
599
|
-
y: V(t.y, e.y,
|
|
599
|
+
x: V(t.x, e.x, m) + g * d,
|
|
600
|
+
y: V(t.y, e.y, m) + g * f
|
|
600
601
|
};
|
|
601
602
|
}
|
|
602
603
|
function ot(n) {
|
|
603
604
|
return 1 - (1 - n) * (1 - n);
|
|
604
605
|
}
|
|
605
|
-
function
|
|
606
|
+
function ie(n) {
|
|
606
607
|
return 1 - Math.pow(1 - n, 3);
|
|
607
608
|
}
|
|
608
|
-
function
|
|
609
|
+
function ne(n, t, e) {
|
|
609
610
|
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;
|
|
610
611
|
return t + h;
|
|
611
612
|
}
|
|
612
|
-
function
|
|
613
|
+
function oe(n, t, e) {
|
|
613
614
|
const { overshoot: i, bounces: o } = e, s = [];
|
|
614
615
|
s.push({ time: 0.5, scale: i });
|
|
615
616
|
let r = i;
|
|
616
617
|
const a = 0.5, c = 0.5 / (o * 2);
|
|
617
618
|
let u = 0.5;
|
|
618
619
|
for (let d = 0; d < o; d++) {
|
|
619
|
-
const
|
|
620
|
-
u += c, s.push({ time: u, scale:
|
|
620
|
+
const f = 1 - (r - 1) * a;
|
|
621
|
+
u += c, s.push({ time: u, scale: f }), r = 1 + (r - 1) * a * a, u += c, d < o - 1 && s.push({ time: u, scale: r });
|
|
621
622
|
}
|
|
622
623
|
s.push({ time: 1, scale: 1 });
|
|
623
624
|
let l = 1;
|
|
624
625
|
for (let d = 0; d < s.length; d++)
|
|
625
626
|
if (n <= s[d].time) {
|
|
626
|
-
const
|
|
627
|
+
const f = d === 0 ? 0 : s[d - 1].time, b = d === 0 ? 1 : s[d - 1].scale, p = (n - f) / (s[d].time - f), g = ot(p);
|
|
627
628
|
l = b + (s[d].scale - b) * g;
|
|
628
629
|
break;
|
|
629
630
|
}
|
|
630
631
|
return l * t;
|
|
631
632
|
}
|
|
632
|
-
function
|
|
633
|
+
function se(n) {
|
|
633
634
|
const {
|
|
634
635
|
element: t,
|
|
635
636
|
startPosition: e,
|
|
@@ -643,40 +644,40 @@ function oe(n) {
|
|
|
643
644
|
onComplete: u,
|
|
644
645
|
rotationConfig: l,
|
|
645
646
|
startRotation: d,
|
|
646
|
-
scaleConfig:
|
|
647
|
+
scaleConfig: f,
|
|
647
648
|
startScale: b
|
|
648
|
-
} = n, p = o.type, g = d !== void 0 && d !== h,
|
|
649
|
+
} = n, p = o.type, g = d !== void 0 && d !== h, m = l?.mode === "wobble", S = l?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, v = g || m, w = b !== void 0 && b !== c, E = f?.mode === "pop", x = f?.pop || { overshoot: 1.2, bounces: 1 };
|
|
649
650
|
if ((p === "linear" || p === "arc") && !v && !(w || E)) {
|
|
650
651
|
u && u();
|
|
651
652
|
return;
|
|
652
653
|
}
|
|
653
|
-
const L = performance.now(), z = -r / 2,
|
|
654
|
+
const L = performance.now(), z = -r / 2, U = -a / 2;
|
|
654
655
|
function _(Y) {
|
|
655
656
|
const N = Y - L, T = Math.min(N / s, 1);
|
|
656
657
|
let D;
|
|
657
658
|
switch (p) {
|
|
658
659
|
case "bounce": {
|
|
659
|
-
const O =
|
|
660
|
+
const O = Bt(
|
|
660
661
|
o.bouncePreset,
|
|
661
662
|
o.bounce
|
|
662
663
|
);
|
|
663
|
-
D =
|
|
664
|
+
D = Zt(T, e, i, O);
|
|
664
665
|
break;
|
|
665
666
|
}
|
|
666
667
|
case "elastic": {
|
|
667
|
-
const O =
|
|
668
|
+
const O = Jt(
|
|
668
669
|
o.elasticPreset,
|
|
669
670
|
o.elastic
|
|
670
671
|
);
|
|
671
|
-
D =
|
|
672
|
+
D = te(T, e, i, O);
|
|
672
673
|
break;
|
|
673
674
|
}
|
|
674
675
|
case "wave": {
|
|
675
|
-
const O =
|
|
676
|
+
const O = Vt(
|
|
676
677
|
o.wavePreset,
|
|
677
678
|
o.wave
|
|
678
679
|
);
|
|
679
|
-
D =
|
|
680
|
+
D = ee(T, e, i, O);
|
|
680
681
|
break;
|
|
681
682
|
}
|
|
682
683
|
default:
|
|
@@ -687,16 +688,16 @@ function oe(n) {
|
|
|
687
688
|
}
|
|
688
689
|
const k = D.x - i.x, H = D.y - i.y;
|
|
689
690
|
let R;
|
|
690
|
-
|
|
691
|
+
m ? R = ne(T, h, S) : g ? R = V(d, h, T) : R = h;
|
|
691
692
|
let C;
|
|
692
|
-
E ? C =
|
|
693
|
+
E ? C = oe(T, c, x) : w ? C = V(b, c, T) : C = c, t.style.transform = `translate(${z}px, ${U}px) translate(${k}px, ${H}px) rotate(${R}deg) scale(${C})`, T < 1 ? requestAnimationFrame(_) : (t.style.transform = `translate(${z}px, ${U}px) rotate(${h}deg) scale(${c})`, u && u());
|
|
693
694
|
}
|
|
694
695
|
requestAnimationFrame(_);
|
|
695
696
|
}
|
|
696
|
-
function
|
|
697
|
+
function ae(n) {
|
|
697
698
|
return n === "bounce" || n === "elastic" || n === "wave";
|
|
698
699
|
}
|
|
699
|
-
const
|
|
700
|
+
const re = {
|
|
700
701
|
radial: "center",
|
|
701
702
|
spiral: "center",
|
|
702
703
|
grid: "top",
|
|
@@ -704,7 +705,7 @@ const ae = {
|
|
|
704
705
|
random: "nearest-edge",
|
|
705
706
|
wave: "left"
|
|
706
707
|
};
|
|
707
|
-
class
|
|
708
|
+
class ce {
|
|
708
709
|
constructor(t, e) {
|
|
709
710
|
this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || pt, this.rotationConfig = t.rotation || bt, this.scaleConfig = t.scale || yt;
|
|
710
711
|
}
|
|
@@ -712,7 +713,7 @@ class re {
|
|
|
712
713
|
* Get the effective start position, considering layout-aware defaults
|
|
713
714
|
*/
|
|
714
715
|
resolveStartPosition() {
|
|
715
|
-
return this.config.start.position ? this.config.start.position :
|
|
716
|
+
return this.config.start.position ? this.config.start.position : re[this.layoutAlgorithm] || "nearest-edge";
|
|
716
717
|
}
|
|
717
718
|
/**
|
|
718
719
|
* Calculate the starting position for an image's entry animation
|
|
@@ -751,8 +752,8 @@ class re {
|
|
|
751
752
|
*/
|
|
752
753
|
calculateNearestEdge(t, e, i, o) {
|
|
753
754
|
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);
|
|
754
|
-
let d = t.x,
|
|
755
|
-
return l === a ? d = -(e.width + o) : l === h ? d = i.width + o : l === c ?
|
|
755
|
+
let d = t.x, f = t.y;
|
|
756
|
+
return l === a ? d = -(e.width + o) : l === h ? d = i.width + o : l === c ? f = -(e.height + o) : f = i.height + o, { x: d, y: f };
|
|
756
757
|
}
|
|
757
758
|
/**
|
|
758
759
|
* Calculate start position from a specific edge
|
|
@@ -810,8 +811,8 @@ class re {
|
|
|
810
811
|
h = typeof c == "number" ? c : 500;
|
|
811
812
|
let u;
|
|
812
813
|
a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
813
|
-
const l = i.width / 2, d = i.height / 2,
|
|
814
|
-
return { x:
|
|
814
|
+
const l = i.width / 2, d = i.height / 2, f = l + Math.cos(u) * h, b = d + Math.sin(u) * h;
|
|
815
|
+
return { x: f, y: b };
|
|
815
816
|
}
|
|
816
817
|
/**
|
|
817
818
|
* Get animation parameters for an image
|
|
@@ -831,7 +832,7 @@ class re {
|
|
|
831
832
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
832
833
|
*/
|
|
833
834
|
buildStartTransform(t, e, i, o, s, r, a, h) {
|
|
834
|
-
const c = t.x - e.x, u = t.y - e.y, l = a !== void 0 ? a : i, d = h !== void 0 ? h : o,
|
|
835
|
+
const c = t.x - e.x, u = t.y - e.y, l = a !== void 0 ? a : i, d = h !== void 0 ? h : o, f = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${f}px, ${b}px)` : "translate(-50%, -50%)";
|
|
835
836
|
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})`;
|
|
836
837
|
}
|
|
837
838
|
/**
|
|
@@ -857,7 +858,7 @@ class re {
|
|
|
857
858
|
* Check if the current path type requires JavaScript animation
|
|
858
859
|
*/
|
|
859
860
|
requiresJSAnimation() {
|
|
860
|
-
return
|
|
861
|
+
return ae(this.pathConfig.type);
|
|
861
862
|
}
|
|
862
863
|
/**
|
|
863
864
|
* Get the path configuration
|
|
@@ -1048,7 +1049,7 @@ class re {
|
|
|
1048
1049
|
return 1 - (1 - t) * (1 - t);
|
|
1049
1050
|
}
|
|
1050
1051
|
}
|
|
1051
|
-
class
|
|
1052
|
+
class le {
|
|
1052
1053
|
constructor(t, e = {}) {
|
|
1053
1054
|
this.config = t, this.imageConfig = e;
|
|
1054
1055
|
}
|
|
@@ -1060,14 +1061,14 @@ class ce {
|
|
|
1060
1061
|
* @returns Array of layout objects with position, rotation, scale
|
|
1061
1062
|
*/
|
|
1062
1063
|
generate(t, e, i = {}) {
|
|
1063
|
-
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,
|
|
1064
|
+
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, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = h * 1.5 / 2, m = h / 2, S = s - a - g, v = r - a - m, w = a + g, E = a + m;
|
|
1064
1065
|
for (let x = 0; x < t; x++) {
|
|
1065
|
-
const A = this.random(w, S), L = this.random(E, v), z = c === "random" ? this.random(u, l) : 0,
|
|
1066
|
+
const A = this.random(w, S), L = this.random(E, v), z = c === "random" ? this.random(u, l) : 0, U = b ? this.random(d, f) : 1, _ = h * U, Y = {
|
|
1066
1067
|
id: x,
|
|
1067
1068
|
x: A,
|
|
1068
1069
|
y: L,
|
|
1069
1070
|
rotation: z,
|
|
1070
|
-
scale:
|
|
1071
|
+
scale: U,
|
|
1071
1072
|
baseSize: _
|
|
1072
1073
|
};
|
|
1073
1074
|
o.push(Y);
|
|
@@ -1084,7 +1085,7 @@ class ce {
|
|
|
1084
1085
|
return Math.random() * (e - t) + t;
|
|
1085
1086
|
}
|
|
1086
1087
|
}
|
|
1087
|
-
class
|
|
1088
|
+
class he {
|
|
1088
1089
|
constructor(t, e = {}) {
|
|
1089
1090
|
this.config = t, this.imageConfig = e;
|
|
1090
1091
|
}
|
|
@@ -1096,13 +1097,13 @@ class le {
|
|
|
1096
1097
|
* @returns Array of layout objects with position, rotation, scale
|
|
1097
1098
|
*/
|
|
1098
1099
|
generate(t, e, i = {}) {
|
|
1099
|
-
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,
|
|
1100
|
+
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, f = l !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = i.fixedHeight ?? a, g = s / 2, m = r / 2, S = Math.ceil(Math.sqrt(t));
|
|
1100
1101
|
if (t > 0) {
|
|
1101
|
-
const E =
|
|
1102
|
+
const E = f ? this.random(l, d) : 1, x = p * E;
|
|
1102
1103
|
o.push({
|
|
1103
1104
|
id: 0,
|
|
1104
1105
|
x: g,
|
|
1105
|
-
y:
|
|
1106
|
+
y: m,
|
|
1106
1107
|
rotation: h === "random" ? this.random(c * 0.33, u * 0.33) : 0,
|
|
1107
1108
|
// Less rotation for center
|
|
1108
1109
|
scale: E,
|
|
@@ -1113,17 +1114,17 @@ class le {
|
|
|
1113
1114
|
}
|
|
1114
1115
|
let v = 1, w = 1;
|
|
1115
1116
|
for (; v < t; ) {
|
|
1116
|
-
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))),
|
|
1117
|
+
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))), U = this.estimateWidth(p), _ = Math.floor(z / (U * 0.7));
|
|
1117
1118
|
if (_ === 0) {
|
|
1118
1119
|
w++;
|
|
1119
1120
|
continue;
|
|
1120
1121
|
}
|
|
1121
1122
|
const Y = 2 * Math.PI / _, N = w * (20 * Math.PI / 180);
|
|
1122
1123
|
for (let T = 0; T < _ && v < t; T++) {
|
|
1123
|
-
const D = T * Y + N, k =
|
|
1124
|
-
let C = g + Math.cos(D) * L, O =
|
|
1125
|
-
const $ = this.config.spacing.padding ?? 50,
|
|
1126
|
-
C -
|
|
1124
|
+
const D = T * Y + N, k = f ? this.random(l, d) : 1, H = x * k, R = p * H;
|
|
1125
|
+
let C = g + Math.cos(D) * L, O = m + Math.sin(D) * A;
|
|
1126
|
+
const $ = this.config.spacing.padding ?? 50, P = R * 1.5 / 2, M = R / 2;
|
|
1127
|
+
C - P < $ ? C = $ + P : C + P > s - $ && (C = s - $ - P), O - M < $ ? O = $ + M : O + M > r - $ && (O = r - $ - M);
|
|
1127
1128
|
const W = h === "random" ? this.random(c, u) : 0;
|
|
1128
1129
|
o.push({
|
|
1129
1130
|
id: v,
|
|
@@ -1159,7 +1160,7 @@ class le {
|
|
|
1159
1160
|
return Math.random() * (e - t) + t;
|
|
1160
1161
|
}
|
|
1161
1162
|
}
|
|
1162
|
-
const
|
|
1163
|
+
const de = {
|
|
1163
1164
|
columns: "auto",
|
|
1164
1165
|
rows: "auto",
|
|
1165
1166
|
stagger: "none",
|
|
@@ -1187,7 +1188,7 @@ const he = {
|
|
|
1187
1188
|
{ x: 0, y: 1 }
|
|
1188
1189
|
// down
|
|
1189
1190
|
];
|
|
1190
|
-
class
|
|
1191
|
+
class ue {
|
|
1191
1192
|
constructor(t, e = {}) {
|
|
1192
1193
|
this.config = t, this.imageConfig = e;
|
|
1193
1194
|
}
|
|
@@ -1199,18 +1200,18 @@ class de {
|
|
|
1199
1200
|
* @returns Array of layout objects with position, rotation, scale
|
|
1200
1201
|
*/
|
|
1201
1202
|
generate(t, e, i = {}) {
|
|
1202
|
-
const o = [], { width: s, height: r } = e, a = { ...
|
|
1203
|
+
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, f = l !== 1 || d !== 1, b = s - 2 * h, p = r - 2 * h, { columns: g, rows: m } = this.calculateGridDimensions(
|
|
1203
1204
|
t,
|
|
1204
1205
|
b,
|
|
1205
1206
|
p,
|
|
1206
1207
|
c,
|
|
1207
1208
|
a
|
|
1208
|
-
), S = a.stagger === "row", v = a.stagger === "column", w = S ? g + 0.5 : g, E = v ?
|
|
1209
|
+
), S = a.stagger === "row", v = a.stagger === "column", w = S ? g + 0.5 : g, E = v ? m + 0.5 : m, x = (b - a.gap * (g - 1)) / w, A = (p - a.gap * (m - 1)) / E, L = S ? x / 2 : 0, z = v ? A / 2 : 0, U = 1 + a.overlap, _ = Math.min(x, A) * U, Y = i.fixedHeight ? Math.min(i.fixedHeight, _) : _, N = g * x + (g - 1) * a.gap + L, T = m * A + (m - 1) * a.gap + z, D = h + (b - N) / 2, k = h + (p - T) / 2, H = g * m, R = a.columns !== "auto" && a.rows !== "auto", C = R && t > H;
|
|
1209
1210
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1210
1211
|
gridConfigColumns: a.columns,
|
|
1211
1212
|
gridConfigRows: a.rows,
|
|
1212
1213
|
columns: g,
|
|
1213
|
-
rows:
|
|
1214
|
+
rows: m,
|
|
1214
1215
|
cellCount: H,
|
|
1215
1216
|
hasFixedGrid: R,
|
|
1216
1217
|
imageCount: t,
|
|
@@ -1218,14 +1219,14 @@ class de {
|
|
|
1218
1219
|
});
|
|
1219
1220
|
const O = C ? new Array(H).fill(0) : [], $ = Math.min(x, A) * a.overflowOffset;
|
|
1220
1221
|
for (let F = 0; F < t; F++) {
|
|
1221
|
-
let
|
|
1222
|
+
let P, M, W = 0;
|
|
1222
1223
|
if (C && F >= H) {
|
|
1223
1224
|
const q = F - H, j = q % H;
|
|
1224
|
-
W = Math.floor(q / H) + 1, O[j]++, a.fillDirection === "row" ? (
|
|
1225
|
+
W = Math.floor(q / H) + 1, O[j]++, a.fillDirection === "row" ? (P = j % g, M = Math.floor(j / g)) : (M = j % m, P = Math.floor(j / m));
|
|
1225
1226
|
} else
|
|
1226
|
-
a.fillDirection === "row" ? (
|
|
1227
|
-
let G = D +
|
|
1228
|
-
if (a.stagger === "row" && M % 2 === 1 ? G += x / 2 : a.stagger === "column" &&
|
|
1227
|
+
a.fillDirection === "row" ? (P = F % g, M = Math.floor(F / g)) : (M = F % m, P = Math.floor(F / m));
|
|
1228
|
+
let G = D + P * (x + a.gap) + x / 2, X = k + M * (A + a.gap) + A / 2;
|
|
1229
|
+
if (a.stagger === "row" && M % 2 === 1 ? G += x / 2 : a.stagger === "column" && P % 2 === 1 && (X += A / 2), W > 0) {
|
|
1229
1230
|
const q = (W - 1) % It.length, j = It[q];
|
|
1230
1231
|
G += j.x * $, X += j.y * $;
|
|
1231
1232
|
}
|
|
@@ -1242,8 +1243,8 @@ class de {
|
|
|
1242
1243
|
a.alignment === "center" ? gt = (N - vt) / 2 : a.alignment === "end" && (gt = N - vt), B += gt;
|
|
1243
1244
|
}
|
|
1244
1245
|
}
|
|
1245
|
-
const rt =
|
|
1246
|
-
B = Math.max(lt, Math.min(B, ht)), J = Math.max(
|
|
1246
|
+
const rt = f ? this.random(l, d) : 1, K = Y * rt, it = K * 1.5 / 2, nt = K / 2, lt = h + it, ht = s - h - it, Dt = h + nt, Ot = r - h - nt;
|
|
1247
|
+
B = Math.max(lt, Math.min(B, ht)), J = Math.max(Dt, Math.min(J, Ot));
|
|
1247
1248
|
let dt = 0;
|
|
1248
1249
|
if (u === "random") {
|
|
1249
1250
|
const q = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
|
|
@@ -1287,7 +1288,7 @@ class de {
|
|
|
1287
1288
|
return Math.random() * (e - t) + t;
|
|
1288
1289
|
}
|
|
1289
1290
|
}
|
|
1290
|
-
const
|
|
1291
|
+
const ge = Math.PI * (3 - Math.sqrt(5)), fe = {
|
|
1291
1292
|
spiralType: "golden",
|
|
1292
1293
|
direction: "counterclockwise",
|
|
1293
1294
|
tightness: 1,
|
|
@@ -1306,14 +1307,14 @@ class me {
|
|
|
1306
1307
|
* @returns Array of layout objects with position, rotation, scale
|
|
1307
1308
|
*/
|
|
1308
1309
|
generate(t, e, i = {}) {
|
|
1309
|
-
const o = [], { width: s, height: r } = e, a = { ...
|
|
1310
|
-
|
|
1310
|
+
const o = [], { width: s, height: r } = e, a = { ...fe, ...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, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, S = r / 2, v = Math.min(
|
|
1311
|
+
m - h - c / 2,
|
|
1311
1312
|
S - h - c / 2
|
|
1312
1313
|
), w = a.direction === "clockwise" ? -1 : 1;
|
|
1313
1314
|
for (let E = 0; E < t; E++) {
|
|
1314
1315
|
let x, A;
|
|
1315
1316
|
if (a.spiralType === "golden")
|
|
1316
|
-
x = E *
|
|
1317
|
+
x = E * ge * w + a.startAngle, A = this.calculateGoldenRadius(E, t, v, a.tightness);
|
|
1317
1318
|
else if (a.spiralType === "archimedean") {
|
|
1318
1319
|
const G = E * 0.5 * a.tightness;
|
|
1319
1320
|
x = G * w + a.startAngle, A = this.calculateArchimedeanRadius(G, t, v, a.tightness);
|
|
@@ -1321,7 +1322,7 @@ class me {
|
|
|
1321
1322
|
const G = E * 0.3 * a.tightness;
|
|
1322
1323
|
x = G * w + a.startAngle, A = this.calculateLogarithmicRadius(G, t, v, a.tightness);
|
|
1323
1324
|
}
|
|
1324
|
-
const L =
|
|
1325
|
+
const L = m + Math.cos(x) * A, z = S + Math.sin(x) * A, U = A / v, _ = g > 0 ? 1 - U * g * 0.5 : 1, Y = p ? this.random(f, 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)), P = Math.max(O, Math.min(z, $));
|
|
1325
1326
|
let M = 0;
|
|
1326
1327
|
if (u === "random") {
|
|
1327
1328
|
const G = x * 180 / Math.PI % 360, X = this.random(l, d);
|
|
@@ -1331,7 +1332,7 @@ class me {
|
|
|
1331
1332
|
o.push({
|
|
1332
1333
|
id: E,
|
|
1333
1334
|
x: F,
|
|
1334
|
-
y:
|
|
1335
|
+
y: P,
|
|
1335
1336
|
rotation: M,
|
|
1336
1337
|
scale: N,
|
|
1337
1338
|
baseSize: T,
|
|
@@ -1388,7 +1389,7 @@ class me {
|
|
|
1388
1389
|
return Math.random() * (e - t) + t;
|
|
1389
1390
|
}
|
|
1390
1391
|
}
|
|
1391
|
-
const
|
|
1392
|
+
const pe = {
|
|
1392
1393
|
clusterCount: "auto",
|
|
1393
1394
|
clusterSpread: 150,
|
|
1394
1395
|
clusterSpacing: 200,
|
|
@@ -1396,7 +1397,7 @@ const fe = {
|
|
|
1396
1397
|
overlap: 0.3,
|
|
1397
1398
|
distribution: "gaussian"
|
|
1398
1399
|
};
|
|
1399
|
-
class
|
|
1400
|
+
class be {
|
|
1400
1401
|
constructor(t, e = {}) {
|
|
1401
1402
|
this.config = t, this.imageConfig = e;
|
|
1402
1403
|
}
|
|
@@ -1408,13 +1409,13 @@ class pe {
|
|
|
1408
1409
|
* @returns Array of layout objects with position, rotation, scale
|
|
1409
1410
|
*/
|
|
1410
1411
|
generate(t, e, i = {}) {
|
|
1411
|
-
const o = [], { width: s, height: r } = e, a = { ...
|
|
1412
|
+
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, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.calculateClusterCount(
|
|
1412
1413
|
t,
|
|
1413
1414
|
a.clusterCount,
|
|
1414
1415
|
s,
|
|
1415
1416
|
r,
|
|
1416
1417
|
a.clusterSpacing
|
|
1417
|
-
),
|
|
1418
|
+
), m = this.generateClusterCenters(
|
|
1418
1419
|
g,
|
|
1419
1420
|
s,
|
|
1420
1421
|
r,
|
|
@@ -1425,7 +1426,7 @@ class pe {
|
|
|
1425
1426
|
S[w % g]++;
|
|
1426
1427
|
let v = 0;
|
|
1427
1428
|
for (let w = 0; w < g; w++) {
|
|
1428
|
-
const E =
|
|
1429
|
+
const E = m[w], x = S[w];
|
|
1429
1430
|
for (let A = 0; A < x; A++) {
|
|
1430
1431
|
let L, z;
|
|
1431
1432
|
if (a.distribution === "gaussian")
|
|
@@ -1434,13 +1435,13 @@ class pe {
|
|
|
1434
1435
|
const M = this.random(0, Math.PI * 2), W = this.random(0, E.spread);
|
|
1435
1436
|
L = Math.cos(M) * W, z = Math.sin(M) * W;
|
|
1436
1437
|
}
|
|
1437
|
-
const
|
|
1438
|
-
L /=
|
|
1439
|
-
const Y = p ? this.random(
|
|
1438
|
+
const U = 1 + a.overlap * 0.5, _ = 1 + a.overlap * 0.3;
|
|
1439
|
+
L /= U, z /= U;
|
|
1440
|
+
const Y = p ? this.random(f, b) : 1, N = _ * Y, T = c * N;
|
|
1440
1441
|
let D = E.x + L, k = E.y + z;
|
|
1441
1442
|
const R = T * 1.5 / 2, C = T / 2;
|
|
1442
1443
|
D = Math.max(h + R, Math.min(D, s - h - R)), k = Math.max(h + C, Math.min(k, r - h - C));
|
|
1443
|
-
const O = u === "random" ? this.random(l, d) : 0, F = Math.sqrt(L * L + z * z) / E.spread,
|
|
1444
|
+
const O = u === "random" ? this.random(l, d) : 0, F = Math.sqrt(L * L + z * z) / E.spread, P = Math.round((1 - F) * 50) + 1;
|
|
1444
1445
|
o.push({
|
|
1445
1446
|
id: v,
|
|
1446
1447
|
x: D,
|
|
@@ -1448,7 +1449,7 @@ class pe {
|
|
|
1448
1449
|
rotation: O,
|
|
1449
1450
|
scale: N,
|
|
1450
1451
|
baseSize: T,
|
|
1451
|
-
zIndex:
|
|
1452
|
+
zIndex: P
|
|
1452
1453
|
}), v++;
|
|
1453
1454
|
}
|
|
1454
1455
|
}
|
|
@@ -1471,22 +1472,22 @@ class pe {
|
|
|
1471
1472
|
generateClusterCenters(t, e, i, o, s) {
|
|
1472
1473
|
const r = [], h = o + s.clusterSpread, c = e - o - s.clusterSpread, u = o + s.clusterSpread, l = i - o - s.clusterSpread;
|
|
1473
1474
|
for (let d = 0; d < t; d++) {
|
|
1474
|
-
let
|
|
1475
|
+
let f = null, b = -1;
|
|
1475
1476
|
for (let p = 0; p < 100; p++) {
|
|
1476
1477
|
const g = {
|
|
1477
1478
|
x: this.random(h, c),
|
|
1478
1479
|
y: this.random(u, l),
|
|
1479
1480
|
spread: this.calculateClusterSpread(s)
|
|
1480
1481
|
};
|
|
1481
|
-
let
|
|
1482
|
+
let m = 1 / 0;
|
|
1482
1483
|
for (const S of r) {
|
|
1483
1484
|
const v = g.x - S.x, w = g.y - S.y, E = Math.sqrt(v * v + w * w);
|
|
1484
|
-
|
|
1485
|
+
m = Math.min(m, E);
|
|
1485
1486
|
}
|
|
1486
|
-
if ((r.length === 0 ||
|
|
1487
|
+
if ((r.length === 0 || m > b) && (f = g, b = m), m >= s.clusterSpacing)
|
|
1487
1488
|
break;
|
|
1488
1489
|
}
|
|
1489
|
-
|
|
1490
|
+
f && r.push(f);
|
|
1490
1491
|
}
|
|
1491
1492
|
return r;
|
|
1492
1493
|
}
|
|
@@ -1514,7 +1515,7 @@ class pe {
|
|
|
1514
1515
|
return Math.random() * (e - t) + t;
|
|
1515
1516
|
}
|
|
1516
1517
|
}
|
|
1517
|
-
class
|
|
1518
|
+
class ye {
|
|
1518
1519
|
constructor(t, e = {}) {
|
|
1519
1520
|
this.config = t, this.imageConfig = e;
|
|
1520
1521
|
}
|
|
@@ -1526,19 +1527,19 @@ class be {
|
|
|
1526
1527
|
* @returns Array of layout objects with position, rotation, scale
|
|
1527
1528
|
*/
|
|
1528
1529
|
generate(t, e, i = {}) {
|
|
1529
|
-
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,
|
|
1530
|
-
...
|
|
1530
|
+
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, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, p = i.fixedHeight ?? a, g = {
|
|
1531
|
+
...Ht,
|
|
1531
1532
|
...this.config.wave
|
|
1532
|
-
}, { rows:
|
|
1533
|
+
}, { rows: m, amplitude: S, frequency: v, phaseShift: w, synchronization: E } = g, x = Math.ceil(t / m), z = p * 1.5 / 2, U = h + z, _ = s - h - z, Y = _ - U, N = x > 1 ? Y / (x - 1) : 0, T = h + S + p / 2, D = r - h - S - p / 2, k = D - T, H = m > 1 ? k / (m - 1) : 0;
|
|
1533
1534
|
let R = 0;
|
|
1534
|
-
for (let C = 0; C <
|
|
1535
|
-
const O =
|
|
1535
|
+
for (let C = 0; C < m && R < t; C++) {
|
|
1536
|
+
const O = m === 1 ? (T + D) / 2 : T + C * H;
|
|
1536
1537
|
let $ = 0;
|
|
1537
1538
|
E === "offset" ? $ = C * w : E === "alternating" && ($ = C * Math.PI);
|
|
1538
1539
|
for (let F = 0; F < x && R < t; F++) {
|
|
1539
|
-
const
|
|
1540
|
+
const P = x === 1 ? (U + _) / 2 : U + F * N, M = this.calculateWaveY(P, s, S, v, $), W = P, G = O + M, X = b ? this.random(d, f) : 1, B = p * X;
|
|
1540
1541
|
let J = 0;
|
|
1541
|
-
c === "tangent" ? J = this.calculateRotation(
|
|
1542
|
+
c === "tangent" ? J = this.calculateRotation(P, s, S, v, $) : c === "random" && (J = this.random(u, l));
|
|
1542
1543
|
const K = B * 1.5 / 2, ct = B / 2, it = h + K, nt = s - h - K, lt = h + ct, ht = r - h - ct;
|
|
1543
1544
|
o.push({
|
|
1544
1545
|
id: R,
|
|
@@ -1591,7 +1592,7 @@ class be {
|
|
|
1591
1592
|
return Math.random() * (e - t) + t;
|
|
1592
1593
|
}
|
|
1593
1594
|
}
|
|
1594
|
-
class
|
|
1595
|
+
class ve {
|
|
1595
1596
|
constructor(t) {
|
|
1596
1597
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1597
1598
|
}
|
|
@@ -1602,17 +1603,17 @@ class ye {
|
|
|
1602
1603
|
initLayout() {
|
|
1603
1604
|
switch (this.config.algorithm) {
|
|
1604
1605
|
case "radial":
|
|
1605
|
-
return new
|
|
1606
|
+
return new he(this.config, this.imageConfig);
|
|
1606
1607
|
case "grid":
|
|
1607
|
-
return new
|
|
1608
|
+
return new ue(this.config, this.imageConfig);
|
|
1608
1609
|
case "spiral":
|
|
1609
1610
|
return new me(this.config, this.imageConfig);
|
|
1610
1611
|
case "cluster":
|
|
1611
|
-
return new pe(this.config, this.imageConfig);
|
|
1612
|
-
case "wave":
|
|
1613
1612
|
return new be(this.config, this.imageConfig);
|
|
1613
|
+
case "wave":
|
|
1614
|
+
return new ye(this.config, this.imageConfig);
|
|
1614
1615
|
default:
|
|
1615
|
-
return new
|
|
1616
|
+
return new le(this.config, this.imageConfig);
|
|
1616
1617
|
}
|
|
1617
1618
|
}
|
|
1618
1619
|
/**
|
|
@@ -1695,12 +1696,12 @@ class ye {
|
|
|
1695
1696
|
if (r !== void 0)
|
|
1696
1697
|
return { height: r };
|
|
1697
1698
|
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;
|
|
1698
|
-
let
|
|
1699
|
-
|
|
1700
|
-
let S = this.clamp(
|
|
1701
|
-
if (S === a &&
|
|
1699
|
+
let m = Math.sqrt(p / 1.4);
|
|
1700
|
+
m *= u, m = Math.min(m, i);
|
|
1701
|
+
let S = this.clamp(m, a, h);
|
|
1702
|
+
if (S === a && m < a) {
|
|
1702
1703
|
const v = Math.max(a * 0.05, 20);
|
|
1703
|
-
S = Math.max(v,
|
|
1704
|
+
S = Math.max(v, m);
|
|
1704
1705
|
}
|
|
1705
1706
|
return { height: S };
|
|
1706
1707
|
}
|
|
@@ -1712,13 +1713,27 @@ class ye {
|
|
|
1712
1713
|
}
|
|
1713
1714
|
}
|
|
1714
1715
|
var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1716
|
+
const At = {
|
|
1717
|
+
// Geometric shapes - uses percentages for responsive sizing
|
|
1718
|
+
circle: "circle(50%)",
|
|
1719
|
+
square: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)",
|
|
1720
|
+
triangle: "polygon(50% 0%, 100% 100%, 0% 100%)",
|
|
1721
|
+
pentagon: "polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%)",
|
|
1722
|
+
hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
|
1723
|
+
octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
|
|
1724
|
+
diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
|
|
1725
|
+
};
|
|
1718
1726
|
function we(n) {
|
|
1719
|
-
|
|
1727
|
+
if (n)
|
|
1728
|
+
return n in At ? At[n] : n;
|
|
1720
1729
|
}
|
|
1721
1730
|
function xe(n) {
|
|
1731
|
+
return n in ft;
|
|
1732
|
+
}
|
|
1733
|
+
function Se(n) {
|
|
1734
|
+
return n ? xe(n) ? ft[n] : n : ft.md;
|
|
1735
|
+
}
|
|
1736
|
+
function Ee(n) {
|
|
1722
1737
|
if (!n) return "";
|
|
1723
1738
|
const t = [];
|
|
1724
1739
|
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)
|
|
@@ -1747,37 +1762,41 @@ function st(n) {
|
|
|
1747
1762
|
const s = n.border || {}, r = { ...s, ...n.borderTop }, a = { ...s, ...n.borderRight }, h = { ...s, ...n.borderBottom }, c = { ...s, ...n.borderLeft };
|
|
1748
1763
|
t.borderTop = Q(r), t.borderRight = Q(a), t.borderBottom = Q(h), t.borderLeft = Q(c);
|
|
1749
1764
|
} else n.border && (t.border = Q(n.border));
|
|
1750
|
-
n.shadow !== void 0 && (t.boxShadow =
|
|
1751
|
-
const o =
|
|
1765
|
+
n.shadow !== void 0 && (t.boxShadow = Se(n.shadow));
|
|
1766
|
+
const o = Ee(n.filter);
|
|
1752
1767
|
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) {
|
|
1753
1768
|
const s = n.outline.width ?? 0, r = n.outline.style ?? "solid", a = n.outline.color ?? "#000000";
|
|
1754
1769
|
t.outline = `${s}px ${r} ${a}`, n.outline.offset !== void 0 && (t.outlineOffset = `${n.outline.offset}px`);
|
|
1755
1770
|
}
|
|
1756
|
-
|
|
1771
|
+
if (n.objectFit !== void 0 && (t.objectFit = n.objectFit), n.aspectRatio !== void 0 && (t.aspectRatio = n.aspectRatio), n.clipPath !== void 0) {
|
|
1772
|
+
const s = we(n.clipPath);
|
|
1773
|
+
s && (s === "none" ? t.clipPath = "unset" : (t.clipPath = s, t.overflow = "hidden"));
|
|
1774
|
+
}
|
|
1775
|
+
return t;
|
|
1757
1776
|
}
|
|
1758
1777
|
function tt(n, t) {
|
|
1759
|
-
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);
|
|
1778
|
+
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), t.clipPath !== void 0 && (n.style.clipPath = t.clipPath), t.overflow !== void 0 && (n.style.overflow = t.overflow);
|
|
1760
1779
|
}
|
|
1761
|
-
function
|
|
1780
|
+
function zt(n) {
|
|
1762
1781
|
return n ? Array.isArray(n) ? n.join(" ") : n : "";
|
|
1763
1782
|
}
|
|
1764
1783
|
function et(n, t) {
|
|
1765
|
-
const e =
|
|
1784
|
+
const e = zt(t);
|
|
1766
1785
|
e && e.split(" ").forEach((i) => {
|
|
1767
1786
|
i.trim() && n.classList.add(i.trim());
|
|
1768
1787
|
});
|
|
1769
1788
|
}
|
|
1770
|
-
function
|
|
1771
|
-
const e =
|
|
1789
|
+
function Ft(n, t) {
|
|
1790
|
+
const e = zt(t);
|
|
1772
1791
|
e && e.split(" ").forEach((i) => {
|
|
1773
1792
|
i.trim() && n.classList.remove(i.trim());
|
|
1774
1793
|
});
|
|
1775
1794
|
}
|
|
1776
|
-
const
|
|
1795
|
+
const Tt = {
|
|
1777
1796
|
UNFOCUSING: 999,
|
|
1778
1797
|
FOCUSING: 1e3
|
|
1779
1798
|
};
|
|
1780
|
-
class
|
|
1799
|
+
class Ie {
|
|
1781
1800
|
constructor(t, e, i) {
|
|
1782
1801
|
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;
|
|
1783
1802
|
}
|
|
@@ -1870,7 +1889,7 @@ class Se {
|
|
|
1870
1889
|
* Remove focused styling from an element
|
|
1871
1890
|
*/
|
|
1872
1891
|
removeFocusedStyling(t, e) {
|
|
1873
|
-
t.style.zIndex = e, t.classList.remove("fbn-ic-focused"),
|
|
1892
|
+
t.style.zIndex = e, t.classList.remove("fbn-ic-focused"), Ft(t, this.focusedClassName), tt(t, this.defaultStyles), et(t, this.defaultClassName);
|
|
1874
1893
|
}
|
|
1875
1894
|
/**
|
|
1876
1895
|
* Start focus animation for an image using dimension-based zoom
|
|
@@ -1880,19 +1899,19 @@ class Se {
|
|
|
1880
1899
|
*/
|
|
1881
1900
|
startFocusAnimation(t, e, i, o, s) {
|
|
1882
1901
|
const r = t.style.zIndex || "", a = t.offsetWidth, h = t.offsetHeight, c = this.calculateFocusDimensions(a, h, e), u = this.calculateFocusTransform(e, i);
|
|
1883
|
-
this.applyFocusedStyling(t,
|
|
1902
|
+
this.applyFocusedStyling(t, Tt.FOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1884
1903
|
const l = o ?? {
|
|
1885
1904
|
x: 0,
|
|
1886
1905
|
y: 0,
|
|
1887
1906
|
rotation: i.rotation,
|
|
1888
1907
|
scale: 1
|
|
1889
1908
|
// No scale - using dimensions
|
|
1890
|
-
}, d = s?.width ?? a,
|
|
1909
|
+
}, d = s?.width ?? a, f = s?.height ?? h, b = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
|
|
1891
1910
|
t,
|
|
1892
1911
|
l,
|
|
1893
1912
|
u,
|
|
1894
1913
|
d,
|
|
1895
|
-
|
|
1914
|
+
f,
|
|
1896
1915
|
c.width,
|
|
1897
1916
|
c.height,
|
|
1898
1917
|
b
|
|
@@ -1929,7 +1948,7 @@ class Se {
|
|
|
1929
1948
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1930
1949
|
*/
|
|
1931
1950
|
startUnfocusAnimation(t, e, i, o) {
|
|
1932
|
-
t.style.zIndex = String(
|
|
1951
|
+
t.style.zIndex = String(Tt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1933
1952
|
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 = {
|
|
1934
1953
|
x: 0,
|
|
1935
1954
|
y: 0,
|
|
@@ -1945,7 +1964,7 @@ class Se {
|
|
|
1945
1964
|
c,
|
|
1946
1965
|
u,
|
|
1947
1966
|
l
|
|
1948
|
-
),
|
|
1967
|
+
), f = {
|
|
1949
1968
|
id: `unfocus-${Date.now()}`,
|
|
1950
1969
|
element: t,
|
|
1951
1970
|
animation: d,
|
|
@@ -1957,7 +1976,7 @@ class Se {
|
|
|
1957
1976
|
return {
|
|
1958
1977
|
element: t,
|
|
1959
1978
|
originalState: e,
|
|
1960
|
-
animationHandle:
|
|
1979
|
+
animationHandle: f,
|
|
1961
1980
|
direction: "out",
|
|
1962
1981
|
originalWidth: c,
|
|
1963
1982
|
originalHeight: u
|
|
@@ -2217,7 +2236,7 @@ class Se {
|
|
|
2217
2236
|
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2218
2237
|
}
|
|
2219
2238
|
}
|
|
2220
|
-
const
|
|
2239
|
+
const Ae = 50, Te = 0.5, Ce = 20, Re = 0.3, Me = 150, Le = 30, at = class at {
|
|
2221
2240
|
constructor(t, e) {
|
|
2222
2241
|
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);
|
|
2223
2242
|
}
|
|
@@ -2264,11 +2283,11 @@ const Ee = 50, Ie = 0.5, Ae = 20, Te = 0.3, Ce = 150, Re = 30, at = class at {
|
|
|
2264
2283
|
const e = t.touches[0], i = e.clientX - this.touchState.startX, o = e.clientY - this.touchState.startY;
|
|
2265
2284
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + o * o) > 10) {
|
|
2266
2285
|
const a = Math.atan2(Math.abs(o), Math.abs(i)) * (180 / Math.PI);
|
|
2267
|
-
this.touchState.isHorizontalSwipe = a <=
|
|
2286
|
+
this.touchState.isHorizontalSwipe = a <= Le;
|
|
2268
2287
|
}
|
|
2269
2288
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2270
2289
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
|
|
2271
|
-
const s = i *
|
|
2290
|
+
const s = i * Re;
|
|
2272
2291
|
this.callbacks.onDragOffset(s);
|
|
2273
2292
|
}
|
|
2274
2293
|
}
|
|
@@ -2277,15 +2296,15 @@ const Ee = 50, Ie = 0.5, Ae = 20, Te = 0.3, Ce = 150, Re = 30, at = class at {
|
|
|
2277
2296
|
this.recentTouchTimestamp = Date.now();
|
|
2278
2297
|
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, o = Math.abs(e) / i, s = Math.abs(e);
|
|
2279
2298
|
let r = !1;
|
|
2280
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >=
|
|
2299
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Ae || o >= Te && s >= Ce) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2281
2300
|
}
|
|
2282
2301
|
handleTouchCancel(t) {
|
|
2283
2302
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
2284
2303
|
}
|
|
2285
2304
|
};
|
|
2286
2305
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2287
|
-
let
|
|
2288
|
-
class
|
|
2306
|
+
let mt = at;
|
|
2307
|
+
class ze {
|
|
2289
2308
|
constructor(t) {
|
|
2290
2309
|
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)
|
|
2291
2310
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2506,7 +2525,7 @@ class Me {
|
|
|
2506
2525
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2507
2526
|
}
|
|
2508
2527
|
}
|
|
2509
|
-
class
|
|
2528
|
+
class Fe {
|
|
2510
2529
|
constructor(t) {
|
|
2511
2530
|
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)
|
|
2512
2531
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2686,7 +2705,7 @@ class Le {
|
|
|
2686
2705
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2687
2706
|
}
|
|
2688
2707
|
}
|
|
2689
|
-
class
|
|
2708
|
+
class De {
|
|
2690
2709
|
constructor(t) {
|
|
2691
2710
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
2692
2711
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -2743,7 +2762,7 @@ class ze {
|
|
|
2743
2762
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2744
2763
|
}
|
|
2745
2764
|
}
|
|
2746
|
-
class
|
|
2765
|
+
class Oe {
|
|
2747
2766
|
/**
|
|
2748
2767
|
* Create a new ImageFilter
|
|
2749
2768
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2780,7 +2799,7 @@ class Fe {
|
|
|
2780
2799
|
// isAllowedDate(date: Date): boolean
|
|
2781
2800
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2782
2801
|
}
|
|
2783
|
-
const
|
|
2802
|
+
const $e = `
|
|
2784
2803
|
.fbn-ic-gallery {
|
|
2785
2804
|
position: relative;
|
|
2786
2805
|
width: 100%;
|
|
@@ -2830,21 +2849,21 @@ const De = `
|
|
|
2830
2849
|
display: none !important;
|
|
2831
2850
|
}
|
|
2832
2851
|
`;
|
|
2833
|
-
function
|
|
2852
|
+
function Pe() {
|
|
2834
2853
|
if (typeof document > "u") return;
|
|
2835
2854
|
const n = "fbn-ic-functional-styles";
|
|
2836
2855
|
if (document.getElementById(n)) return;
|
|
2837
2856
|
const t = document.createElement("style");
|
|
2838
|
-
t.id = n, t.textContent =
|
|
2857
|
+
t.id = n, t.textContent = $e, document.head.appendChild(t);
|
|
2839
2858
|
}
|
|
2840
|
-
let
|
|
2859
|
+
let Ue = class {
|
|
2841
2860
|
constructor(t = {}) {
|
|
2842
|
-
this.fullConfig =
|
|
2861
|
+
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({
|
|
2843
2862
|
layout: this.fullConfig.layout,
|
|
2844
2863
|
image: this.fullConfig.image
|
|
2845
|
-
}), this.zoomEngine = new
|
|
2864
|
+
}), this.zoomEngine = new Ie(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;
|
|
2846
2865
|
const e = this.fullConfig.animation.entry || y.animation.entry;
|
|
2847
|
-
this.entryAnimationEngine = new
|
|
2866
|
+
this.entryAnimationEngine = new ce(
|
|
2848
2867
|
e,
|
|
2849
2868
|
this.fullConfig.layout.algorithm
|
|
2850
2869
|
), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
@@ -2854,7 +2873,7 @@ let $e = class {
|
|
|
2854
2873
|
*/
|
|
2855
2874
|
createImageFilter() {
|
|
2856
2875
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
2857
|
-
return new
|
|
2876
|
+
return new Oe(t);
|
|
2858
2877
|
}
|
|
2859
2878
|
/**
|
|
2860
2879
|
* Create appropriate image loader based on config
|
|
@@ -2865,7 +2884,7 @@ let $e = class {
|
|
|
2865
2884
|
if (!t || t.length === 0)
|
|
2866
2885
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
2867
2886
|
const i = t.map((o) => this.createLoaderFromEntry(o, e));
|
|
2868
|
-
return i.length === 1 ? i[0] : new
|
|
2887
|
+
return i.length === 1 ? i[0] : new De({
|
|
2869
2888
|
loaders: i,
|
|
2870
2889
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
2871
2890
|
});
|
|
@@ -2883,14 +2902,14 @@ let $e = class {
|
|
|
2883
2902
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2884
2903
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2885
2904
|
};
|
|
2886
|
-
return new
|
|
2905
|
+
return new Fe(o);
|
|
2887
2906
|
} else if ("googleDrive" in t) {
|
|
2888
2907
|
const i = t.googleDrive, o = {
|
|
2889
2908
|
...i,
|
|
2890
2909
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2891
2910
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2892
2911
|
};
|
|
2893
|
-
return new
|
|
2912
|
+
return new ze(o);
|
|
2894
2913
|
} else
|
|
2895
2914
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
2896
2915
|
}
|
|
@@ -2899,16 +2918,16 @@ let $e = class {
|
|
|
2899
2918
|
*/
|
|
2900
2919
|
async init() {
|
|
2901
2920
|
try {
|
|
2902
|
-
if (
|
|
2921
|
+
if (Pe(), this.containerRef)
|
|
2903
2922
|
this.containerEl = this.containerRef;
|
|
2904
2923
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
2905
2924
|
throw new Error(`Container #${this.containerId} not found`);
|
|
2906
|
-
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new
|
|
2925
|
+
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new mt(this.containerEl, {
|
|
2907
2926
|
onNext: () => this.navigateToNextImage(),
|
|
2908
2927
|
onPrev: () => this.navigateToPreviousImage(),
|
|
2909
2928
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
2910
2929
|
onDragEnd: (t) => {
|
|
2911
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
2930
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Me);
|
|
2912
2931
|
}
|
|
2913
2932
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
2914
2933
|
} catch (t) {
|
|
@@ -3035,20 +3054,20 @@ let $e = class {
|
|
|
3035
3054
|
const d = {
|
|
3036
3055
|
x: parseFloat(c.dataset.startX),
|
|
3037
3056
|
y: parseFloat(c.dataset.startY)
|
|
3038
|
-
},
|
|
3057
|
+
}, f = {
|
|
3039
3058
|
x: parseFloat(c.dataset.endX),
|
|
3040
3059
|
y: parseFloat(c.dataset.endY)
|
|
3041
|
-
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation),
|
|
3042
|
-
|
|
3060
|
+
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation), m = parseFloat(c.dataset.scale), S = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : g, v = c.dataset.startScale ? parseFloat(c.dataset.startScale) : m, w = this.entryAnimationEngine.getTiming();
|
|
3061
|
+
se({
|
|
3043
3062
|
element: c,
|
|
3044
3063
|
startPosition: d,
|
|
3045
|
-
endPosition:
|
|
3064
|
+
endPosition: f,
|
|
3046
3065
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3047
3066
|
duration: w.duration,
|
|
3048
3067
|
imageWidth: b,
|
|
3049
3068
|
imageHeight: p,
|
|
3050
3069
|
rotation: g,
|
|
3051
|
-
scale:
|
|
3070
|
+
scale: m,
|
|
3052
3071
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3053
3072
|
startRotation: S,
|
|
3054
3073
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
@@ -3105,8 +3124,8 @@ let $e = class {
|
|
|
3105
3124
|
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), s.forEach((c, u) => {
|
|
3106
3125
|
const l = document.createElement("div");
|
|
3107
3126
|
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";
|
|
3108
|
-
const d = c.x,
|
|
3109
|
-
l.style.left = `${d - 6}px`, l.style.top = `${
|
|
3127
|
+
const d = c.x, f = c.y;
|
|
3128
|
+
l.style.left = `${d - 6}px`, l.style.top = `${f - 6}px`, l.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(f)})`, this.containerEl.appendChild(l);
|
|
3110
3129
|
})), t.forEach((c, u) => {
|
|
3111
3130
|
const l = document.createElement("img");
|
|
3112
3131
|
l.referrerPolicy = "no-referrer", l.classList.add("fbn-ic-image"), l.dataset.imageId = String(u);
|
|
@@ -3114,15 +3133,15 @@ let $e = class {
|
|
|
3114
3133
|
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", () => {
|
|
3115
3134
|
this.hoveredImage = { element: l, layout: d }, this.zoomEngine.isInvolved(l) || (tt(l, this.hoverStyles), et(l, this.hoverClassName));
|
|
3116
3135
|
}), l.addEventListener("mouseleave", () => {
|
|
3117
|
-
this.hoveredImage = null, this.zoomEngine.isInvolved(l) || (tt(l, this.defaultStyles),
|
|
3118
|
-
}), l.addEventListener("click", (
|
|
3119
|
-
|
|
3136
|
+
this.hoveredImage = null, this.zoomEngine.isInvolved(l) || (tt(l, this.defaultStyles), Ft(l, this.hoverClassName), et(l, this.defaultClassName));
|
|
3137
|
+
}), l.addEventListener("click", (f) => {
|
|
3138
|
+
f.stopPropagation(), this.handleImageClick(l, d);
|
|
3120
3139
|
}), l.style.opacity = "0", l.style.transition = this.entryAnimationEngine.getTransitionCSS(), l.onload = () => {
|
|
3121
3140
|
if (o !== this.loadGeneration)
|
|
3122
3141
|
return;
|
|
3123
|
-
const
|
|
3142
|
+
const f = l.naturalWidth / l.naturalHeight, b = e * f;
|
|
3124
3143
|
l.style.width = `${b}px`;
|
|
3125
|
-
const p = { x: d.x, y: d.y }, g = { width: b, height: e },
|
|
3144
|
+
const p = { x: d.x, y: d.y }, g = { width: b, height: e }, m = this.entryAnimationEngine.calculateStartPosition(
|
|
3126
3145
|
p,
|
|
3127
3146
|
g,
|
|
3128
3147
|
i,
|
|
@@ -3134,7 +3153,7 @@ let $e = class {
|
|
|
3134
3153
|
b,
|
|
3135
3154
|
e
|
|
3136
3155
|
), E = this.entryAnimationEngine.buildStartTransform(
|
|
3137
|
-
|
|
3156
|
+
m,
|
|
3138
3157
|
p,
|
|
3139
3158
|
d.rotation,
|
|
3140
3159
|
d.scale,
|
|
@@ -3151,7 +3170,7 @@ let $e = class {
|
|
|
3151
3170
|
finalTransform: w,
|
|
3152
3171
|
renderedWidth: b,
|
|
3153
3172
|
renderedHeight: e
|
|
3154
|
-
}), 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(
|
|
3173
|
+
}), 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(m.x), l.dataset.startY = String(m.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);
|
|
3155
3174
|
}, l.onerror = () => r++, l.src = c;
|
|
3156
3175
|
});
|
|
3157
3176
|
}
|
|
@@ -3196,16 +3215,16 @@ let $e = class {
|
|
|
3196
3215
|
this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy();
|
|
3197
3216
|
}
|
|
3198
3217
|
};
|
|
3199
|
-
const
|
|
3218
|
+
const je = Pt(
|
|
3200
3219
|
function({ className: t, style: e, ...i }, o) {
|
|
3201
3220
|
const s = wt(null), r = wt(null);
|
|
3202
3221
|
return Ut(o, () => ({
|
|
3203
3222
|
get instance() {
|
|
3204
3223
|
return r.current;
|
|
3205
3224
|
}
|
|
3206
|
-
})),
|
|
3225
|
+
})), _t(() => {
|
|
3207
3226
|
if (!s.current) return;
|
|
3208
|
-
const a = new
|
|
3227
|
+
const a = new Ue({
|
|
3209
3228
|
container: s.current,
|
|
3210
3229
|
...i
|
|
3211
3230
|
});
|
|
@@ -3214,10 +3233,10 @@ const He = $t(
|
|
|
3214
3233
|
}), () => {
|
|
3215
3234
|
a.destroy(), r.current = null;
|
|
3216
3235
|
};
|
|
3217
|
-
}, [JSON.stringify(i)]), /* @__PURE__ */
|
|
3236
|
+
}, [JSON.stringify(i)]), /* @__PURE__ */ $t("div", { ref: s, className: t, style: e });
|
|
3218
3237
|
}
|
|
3219
3238
|
);
|
|
3220
3239
|
export {
|
|
3221
|
-
|
|
3240
|
+
je as ImageCloud
|
|
3222
3241
|
};
|
|
3223
3242
|
//# sourceMappingURL=react.js.map
|