@frybynite/image-cloud 0.7.2 → 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 +178 -163
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +238 -223
- 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 -2
- package/dist/react.d.ts +3 -2
- package/dist/react.js +223 -208
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +3 -2
- package/dist/vue.js +225 -210
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +3 -2
- package/dist/web-component.js +172 -157
- 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,
|
|
@@ -205,11 +206,7 @@ const mt = Object.freeze({
|
|
|
205
206
|
}),
|
|
206
207
|
ui: Object.freeze({
|
|
207
208
|
showLoadingSpinner: !1,
|
|
208
|
-
showImageCounter: !1
|
|
209
|
-
showThumbnails: void 0,
|
|
210
|
-
// STUB: Not implemented yet
|
|
211
|
-
theme: void 0
|
|
212
|
-
// STUB: Not implemented yet
|
|
209
|
+
showImageCounter: !1
|
|
213
210
|
}),
|
|
214
211
|
performance: Object.freeze({
|
|
215
212
|
lazyLoad: void 0,
|
|
@@ -221,15 +218,15 @@ const mt = Object.freeze({
|
|
|
221
218
|
})
|
|
222
219
|
}),
|
|
223
220
|
// Image styling
|
|
224
|
-
styling:
|
|
221
|
+
styling: Ct
|
|
225
222
|
});
|
|
226
223
|
function Z(n, t) {
|
|
227
224
|
if (!n) return t || {};
|
|
228
225
|
if (!t) return { ...n };
|
|
229
226
|
const e = { ...n };
|
|
230
|
-
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;
|
|
231
228
|
}
|
|
232
|
-
function
|
|
229
|
+
function Wt(n, t) {
|
|
233
230
|
if (!t) return { ...n };
|
|
234
231
|
const e = Z(n.default, t.default), i = Z(
|
|
235
232
|
Z(e, n.hover),
|
|
@@ -244,7 +241,7 @@ function kt(n, t) {
|
|
|
244
241
|
focused: o
|
|
245
242
|
};
|
|
246
243
|
}
|
|
247
|
-
function
|
|
244
|
+
function Gt(n, t) {
|
|
248
245
|
if (!t) return { ...n };
|
|
249
246
|
const e = { ...n };
|
|
250
247
|
if (t.sizing !== void 0 && (e.sizing = {
|
|
@@ -263,7 +260,7 @@ function Wt(n, t) {
|
|
|
263
260
|
}
|
|
264
261
|
return e;
|
|
265
262
|
}
|
|
266
|
-
function
|
|
263
|
+
function qt(n) {
|
|
267
264
|
const t = n.layout?.rotation;
|
|
268
265
|
if (t && "enabled" in t)
|
|
269
266
|
return {
|
|
@@ -273,7 +270,7 @@ function Gt(n) {
|
|
|
273
270
|
}
|
|
274
271
|
};
|
|
275
272
|
}
|
|
276
|
-
function
|
|
273
|
+
function Yt(n) {
|
|
277
274
|
const t = n.layout?.sizing?.variance;
|
|
278
275
|
if (t)
|
|
279
276
|
return {
|
|
@@ -284,8 +281,8 @@ function qt(n) {
|
|
|
284
281
|
}
|
|
285
282
|
};
|
|
286
283
|
}
|
|
287
|
-
function
|
|
288
|
-
const t =
|
|
284
|
+
function Xt(n = {}) {
|
|
285
|
+
const t = qt(n), e = Yt(n);
|
|
289
286
|
let i = n.image;
|
|
290
287
|
(t || e) && (i = {
|
|
291
288
|
...e || {},
|
|
@@ -303,18 +300,18 @@ function Yt(n = {}) {
|
|
|
303
300
|
});
|
|
304
301
|
const r = {
|
|
305
302
|
loaders: {
|
|
306
|
-
...
|
|
303
|
+
...Mt,
|
|
307
304
|
...n.config?.loaders ?? {}
|
|
308
305
|
}
|
|
309
306
|
}, a = {
|
|
310
307
|
loaders: o,
|
|
311
308
|
config: r,
|
|
312
|
-
image:
|
|
309
|
+
image: Gt(Rt, i),
|
|
313
310
|
layout: { ...y.layout },
|
|
314
311
|
animation: { ...y.animation },
|
|
315
312
|
interaction: { ...y.interaction },
|
|
316
313
|
rendering: { ...y.rendering },
|
|
317
|
-
styling:
|
|
314
|
+
styling: Wt(Ct, n.styling)
|
|
318
315
|
};
|
|
319
316
|
return n.layout && (a.layout = {
|
|
320
317
|
...y.layout,
|
|
@@ -377,20 +374,20 @@ function Yt(n = {}) {
|
|
|
377
374
|
...y.rendering.performance,
|
|
378
375
|
...n.rendering.performance
|
|
379
376
|
})), a.config.debug = {
|
|
380
|
-
...
|
|
377
|
+
...Lt,
|
|
381
378
|
...n.config?.debug ?? {}
|
|
382
379
|
}, a;
|
|
383
380
|
}
|
|
384
|
-
function
|
|
381
|
+
function Bt(n, t) {
|
|
385
382
|
return { ...n ? xt[n] : xt.playful, ...t };
|
|
386
383
|
}
|
|
387
|
-
function
|
|
384
|
+
function Jt(n, t) {
|
|
388
385
|
return { ...n ? St[n] : St.gentle, ...t };
|
|
389
386
|
}
|
|
390
|
-
function
|
|
387
|
+
function Vt(n, t) {
|
|
391
388
|
return { ...n ? Et[n] : Et.gentle, ...t };
|
|
392
389
|
}
|
|
393
|
-
class
|
|
390
|
+
class Kt {
|
|
394
391
|
constructor(t) {
|
|
395
392
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
396
393
|
}
|
|
@@ -549,31 +546,31 @@ class Vt {
|
|
|
549
546
|
function V(n, t, e) {
|
|
550
547
|
return n + (t - n) * e;
|
|
551
548
|
}
|
|
552
|
-
function
|
|
553
|
-
const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x, h = e.y - t.y, c =
|
|
554
|
-
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;
|
|
555
552
|
for (let g = 0; g < c.length; g++)
|
|
556
553
|
if (n <= c[g].time) {
|
|
557
|
-
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;
|
|
558
555
|
break;
|
|
559
556
|
}
|
|
560
557
|
const p = (n - l) / (d - l);
|
|
561
558
|
if (b)
|
|
562
|
-
u = 1 +
|
|
559
|
+
u = 1 + f * ot(p);
|
|
563
560
|
else if (l === 0)
|
|
564
561
|
u = ot(p);
|
|
565
562
|
else {
|
|
566
|
-
const
|
|
563
|
+
const m = 1 + (c.find(
|
|
567
564
|
(S, v) => S.time > l && v > 0 && c[v - 1].isOvershoot
|
|
568
|
-
)?.overshoot ||
|
|
569
|
-
u = V(
|
|
565
|
+
)?.overshoot || f);
|
|
566
|
+
u = V(m, 1, ot(p));
|
|
570
567
|
}
|
|
571
568
|
return {
|
|
572
569
|
x: t.x + a * u,
|
|
573
570
|
y: t.y + h * u
|
|
574
571
|
};
|
|
575
572
|
}
|
|
576
|
-
function
|
|
573
|
+
function Qt(n, t) {
|
|
577
574
|
const e = [];
|
|
578
575
|
let i = 0.6;
|
|
579
576
|
e.push({ time: i, overshoot: 0, isOvershoot: !1 });
|
|
@@ -583,11 +580,11 @@ function Zt(n, t) {
|
|
|
583
580
|
i += r, e.push({ time: i, overshoot: o, isOvershoot: !0 }), i += r, e.push({ time: i, overshoot: o * t, isOvershoot: !1 }), o *= t;
|
|
584
581
|
return e.push({ time: 1, overshoot: 0, isOvershoot: !1 }), e;
|
|
585
582
|
}
|
|
586
|
-
function
|
|
583
|
+
function te(n, t, e, i) {
|
|
587
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));
|
|
588
585
|
let d;
|
|
589
586
|
if (l < 1) {
|
|
590
|
-
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);
|
|
591
588
|
d = 1 - b * p;
|
|
592
589
|
} else
|
|
593
590
|
d = 1 - Math.exp(-u * n * 3);
|
|
@@ -596,44 +593,44 @@ function Qt(n, t, e, i) {
|
|
|
596
593
|
y: t.y + c * d
|
|
597
594
|
};
|
|
598
595
|
}
|
|
599
|
-
function
|
|
600
|
-
const { amplitude: o, frequency: s, decay: r, decayRate: a, phase: h } = i, c = e.x - t.x, u = e.y - t.y, l = Math.sqrt(c * c + u * u), d = l > 0 ? -u / l : 0,
|
|
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);
|
|
601
598
|
return {
|
|
602
|
-
x: V(t.x, e.x,
|
|
603
|
-
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
|
|
604
601
|
};
|
|
605
602
|
}
|
|
606
603
|
function ot(n) {
|
|
607
604
|
return 1 - (1 - n) * (1 - n);
|
|
608
605
|
}
|
|
609
|
-
function
|
|
606
|
+
function ie(n) {
|
|
610
607
|
return 1 - Math.pow(1 - n, 3);
|
|
611
608
|
}
|
|
612
|
-
function
|
|
609
|
+
function ne(n, t, e) {
|
|
613
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;
|
|
614
611
|
return t + h;
|
|
615
612
|
}
|
|
616
|
-
function
|
|
613
|
+
function oe(n, t, e) {
|
|
617
614
|
const { overshoot: i, bounces: o } = e, s = [];
|
|
618
615
|
s.push({ time: 0.5, scale: i });
|
|
619
616
|
let r = i;
|
|
620
617
|
const a = 0.5, c = 0.5 / (o * 2);
|
|
621
618
|
let u = 0.5;
|
|
622
619
|
for (let d = 0; d < o; d++) {
|
|
623
|
-
const
|
|
624
|
-
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 });
|
|
625
622
|
}
|
|
626
623
|
s.push({ time: 1, scale: 1 });
|
|
627
624
|
let l = 1;
|
|
628
625
|
for (let d = 0; d < s.length; d++)
|
|
629
626
|
if (n <= s[d].time) {
|
|
630
|
-
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);
|
|
631
628
|
l = b + (s[d].scale - b) * g;
|
|
632
629
|
break;
|
|
633
630
|
}
|
|
634
631
|
return l * t;
|
|
635
632
|
}
|
|
636
|
-
function
|
|
633
|
+
function se(n) {
|
|
637
634
|
const {
|
|
638
635
|
element: t,
|
|
639
636
|
startPosition: e,
|
|
@@ -647,40 +644,40 @@ function oe(n) {
|
|
|
647
644
|
onComplete: u,
|
|
648
645
|
rotationConfig: l,
|
|
649
646
|
startRotation: d,
|
|
650
|
-
scaleConfig:
|
|
647
|
+
scaleConfig: f,
|
|
651
648
|
startScale: b
|
|
652
|
-
} = 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 };
|
|
653
650
|
if ((p === "linear" || p === "arc") && !v && !(w || E)) {
|
|
654
651
|
u && u();
|
|
655
652
|
return;
|
|
656
653
|
}
|
|
657
|
-
const L = performance.now(), z = -r / 2,
|
|
654
|
+
const L = performance.now(), z = -r / 2, U = -a / 2;
|
|
658
655
|
function _(Y) {
|
|
659
656
|
const N = Y - L, T = Math.min(N / s, 1);
|
|
660
657
|
let D;
|
|
661
658
|
switch (p) {
|
|
662
659
|
case "bounce": {
|
|
663
|
-
const O =
|
|
660
|
+
const O = Bt(
|
|
664
661
|
o.bouncePreset,
|
|
665
662
|
o.bounce
|
|
666
663
|
);
|
|
667
|
-
D =
|
|
664
|
+
D = Zt(T, e, i, O);
|
|
668
665
|
break;
|
|
669
666
|
}
|
|
670
667
|
case "elastic": {
|
|
671
|
-
const O =
|
|
668
|
+
const O = Jt(
|
|
672
669
|
o.elasticPreset,
|
|
673
670
|
o.elastic
|
|
674
671
|
);
|
|
675
|
-
D =
|
|
672
|
+
D = te(T, e, i, O);
|
|
676
673
|
break;
|
|
677
674
|
}
|
|
678
675
|
case "wave": {
|
|
679
|
-
const O =
|
|
676
|
+
const O = Vt(
|
|
680
677
|
o.wavePreset,
|
|
681
678
|
o.wave
|
|
682
679
|
);
|
|
683
|
-
D =
|
|
680
|
+
D = ee(T, e, i, O);
|
|
684
681
|
break;
|
|
685
682
|
}
|
|
686
683
|
default:
|
|
@@ -691,16 +688,16 @@ function oe(n) {
|
|
|
691
688
|
}
|
|
692
689
|
const k = D.x - i.x, H = D.y - i.y;
|
|
693
690
|
let R;
|
|
694
|
-
|
|
691
|
+
m ? R = ne(T, h, S) : g ? R = V(d, h, T) : R = h;
|
|
695
692
|
let C;
|
|
696
|
-
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());
|
|
697
694
|
}
|
|
698
695
|
requestAnimationFrame(_);
|
|
699
696
|
}
|
|
700
|
-
function
|
|
697
|
+
function ae(n) {
|
|
701
698
|
return n === "bounce" || n === "elastic" || n === "wave";
|
|
702
699
|
}
|
|
703
|
-
const
|
|
700
|
+
const re = {
|
|
704
701
|
radial: "center",
|
|
705
702
|
spiral: "center",
|
|
706
703
|
grid: "top",
|
|
@@ -708,7 +705,7 @@ const ae = {
|
|
|
708
705
|
random: "nearest-edge",
|
|
709
706
|
wave: "left"
|
|
710
707
|
};
|
|
711
|
-
class
|
|
708
|
+
class ce {
|
|
712
709
|
constructor(t, e) {
|
|
713
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;
|
|
714
711
|
}
|
|
@@ -716,7 +713,7 @@ class re {
|
|
|
716
713
|
* Get the effective start position, considering layout-aware defaults
|
|
717
714
|
*/
|
|
718
715
|
resolveStartPosition() {
|
|
719
|
-
return this.config.start.position ? this.config.start.position :
|
|
716
|
+
return this.config.start.position ? this.config.start.position : re[this.layoutAlgorithm] || "nearest-edge";
|
|
720
717
|
}
|
|
721
718
|
/**
|
|
722
719
|
* Calculate the starting position for an image's entry animation
|
|
@@ -755,8 +752,8 @@ class re {
|
|
|
755
752
|
*/
|
|
756
753
|
calculateNearestEdge(t, e, i, o) {
|
|
757
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);
|
|
758
|
-
let d = t.x,
|
|
759
|
-
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 };
|
|
760
757
|
}
|
|
761
758
|
/**
|
|
762
759
|
* Calculate start position from a specific edge
|
|
@@ -814,8 +811,8 @@ class re {
|
|
|
814
811
|
h = typeof c == "number" ? c : 500;
|
|
815
812
|
let u;
|
|
816
813
|
a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
817
|
-
const l = i.width / 2, d = i.height / 2,
|
|
818
|
-
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 };
|
|
819
816
|
}
|
|
820
817
|
/**
|
|
821
818
|
* Get animation parameters for an image
|
|
@@ -835,7 +832,7 @@ class re {
|
|
|
835
832
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
836
833
|
*/
|
|
837
834
|
buildStartTransform(t, e, i, o, s, r, a, h) {
|
|
838
|
-
const c = t.x - e.x, u = t.y - e.y, l = a !== void 0 ? a : i, d = h !== void 0 ? h : o,
|
|
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%)";
|
|
839
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})`;
|
|
840
837
|
}
|
|
841
838
|
/**
|
|
@@ -861,7 +858,7 @@ class re {
|
|
|
861
858
|
* Check if the current path type requires JavaScript animation
|
|
862
859
|
*/
|
|
863
860
|
requiresJSAnimation() {
|
|
864
|
-
return
|
|
861
|
+
return ae(this.pathConfig.type);
|
|
865
862
|
}
|
|
866
863
|
/**
|
|
867
864
|
* Get the path configuration
|
|
@@ -1052,7 +1049,7 @@ class re {
|
|
|
1052
1049
|
return 1 - (1 - t) * (1 - t);
|
|
1053
1050
|
}
|
|
1054
1051
|
}
|
|
1055
|
-
class
|
|
1052
|
+
class le {
|
|
1056
1053
|
constructor(t, e = {}) {
|
|
1057
1054
|
this.config = t, this.imageConfig = e;
|
|
1058
1055
|
}
|
|
@@ -1064,14 +1061,14 @@ class ce {
|
|
|
1064
1061
|
* @returns Array of layout objects with position, rotation, scale
|
|
1065
1062
|
*/
|
|
1066
1063
|
generate(t, e, i = {}) {
|
|
1067
|
-
const o = [], { width: s, height: r } = e, a = this.config.spacing.padding, h = i.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1,
|
|
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;
|
|
1068
1065
|
for (let x = 0; x < t; x++) {
|
|
1069
|
-
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 = {
|
|
1070
1067
|
id: x,
|
|
1071
1068
|
x: A,
|
|
1072
1069
|
y: L,
|
|
1073
1070
|
rotation: z,
|
|
1074
|
-
scale:
|
|
1071
|
+
scale: U,
|
|
1075
1072
|
baseSize: _
|
|
1076
1073
|
};
|
|
1077
1074
|
o.push(Y);
|
|
@@ -1088,7 +1085,7 @@ class ce {
|
|
|
1088
1085
|
return Math.random() * (e - t) + t;
|
|
1089
1086
|
}
|
|
1090
1087
|
}
|
|
1091
|
-
class
|
|
1088
|
+
class he {
|
|
1092
1089
|
constructor(t, e = {}) {
|
|
1093
1090
|
this.config = t, this.imageConfig = e;
|
|
1094
1091
|
}
|
|
@@ -1100,13 +1097,13 @@ class le {
|
|
|
1100
1097
|
* @returns Array of layout objects with position, rotation, scale
|
|
1101
1098
|
*/
|
|
1102
1099
|
generate(t, e, i = {}) {
|
|
1103
|
-
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, l = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1,
|
|
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));
|
|
1104
1101
|
if (t > 0) {
|
|
1105
|
-
const E =
|
|
1102
|
+
const E = f ? this.random(l, d) : 1, x = p * E;
|
|
1106
1103
|
o.push({
|
|
1107
1104
|
id: 0,
|
|
1108
1105
|
x: g,
|
|
1109
|
-
y:
|
|
1106
|
+
y: m,
|
|
1110
1107
|
rotation: h === "random" ? this.random(c * 0.33, u * 0.33) : 0,
|
|
1111
1108
|
// Less rotation for center
|
|
1112
1109
|
scale: E,
|
|
@@ -1117,17 +1114,17 @@ class le {
|
|
|
1117
1114
|
}
|
|
1118
1115
|
let v = 1, w = 1;
|
|
1119
1116
|
for (; v < t; ) {
|
|
1120
|
-
const E = w / S, x = b > 0 ? 1 - E * b * 0.5 : 1, A = w * (p * 0.8), L = A * 1.5, z = Math.PI * (3 * (L + A) - Math.sqrt((3 * L + A) * (L + 3 * A))),
|
|
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));
|
|
1121
1118
|
if (_ === 0) {
|
|
1122
1119
|
w++;
|
|
1123
1120
|
continue;
|
|
1124
1121
|
}
|
|
1125
1122
|
const Y = 2 * Math.PI / _, N = w * (20 * Math.PI / 180);
|
|
1126
1123
|
for (let T = 0; T < _ && v < t; T++) {
|
|
1127
|
-
const D = T * Y + N, k =
|
|
1128
|
-
let C = g + Math.cos(D) * L, O =
|
|
1129
|
-
const $ = this.config.spacing.padding ?? 50,
|
|
1130
|
-
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);
|
|
1131
1128
|
const W = h === "random" ? this.random(c, u) : 0;
|
|
1132
1129
|
o.push({
|
|
1133
1130
|
id: v,
|
|
@@ -1163,7 +1160,7 @@ class le {
|
|
|
1163
1160
|
return Math.random() * (e - t) + t;
|
|
1164
1161
|
}
|
|
1165
1162
|
}
|
|
1166
|
-
const
|
|
1163
|
+
const de = {
|
|
1167
1164
|
columns: "auto",
|
|
1168
1165
|
rows: "auto",
|
|
1169
1166
|
stagger: "none",
|
|
@@ -1191,7 +1188,7 @@ const he = {
|
|
|
1191
1188
|
{ x: 0, y: 1 }
|
|
1192
1189
|
// down
|
|
1193
1190
|
];
|
|
1194
|
-
class
|
|
1191
|
+
class ue {
|
|
1195
1192
|
constructor(t, e = {}) {
|
|
1196
1193
|
this.config = t, this.imageConfig = e;
|
|
1197
1194
|
}
|
|
@@ -1203,18 +1200,18 @@ class de {
|
|
|
1203
1200
|
* @returns Array of layout objects with position, rotation, scale
|
|
1204
1201
|
*/
|
|
1205
1202
|
generate(t, e, i = {}) {
|
|
1206
|
-
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(
|
|
1207
1204
|
t,
|
|
1208
1205
|
b,
|
|
1209
1206
|
p,
|
|
1210
1207
|
c,
|
|
1211
1208
|
a
|
|
1212
|
-
), 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;
|
|
1213
1210
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1214
1211
|
gridConfigColumns: a.columns,
|
|
1215
1212
|
gridConfigRows: a.rows,
|
|
1216
1213
|
columns: g,
|
|
1217
|
-
rows:
|
|
1214
|
+
rows: m,
|
|
1218
1215
|
cellCount: H,
|
|
1219
1216
|
hasFixedGrid: R,
|
|
1220
1217
|
imageCount: t,
|
|
@@ -1222,14 +1219,14 @@ class de {
|
|
|
1222
1219
|
});
|
|
1223
1220
|
const O = C ? new Array(H).fill(0) : [], $ = Math.min(x, A) * a.overflowOffset;
|
|
1224
1221
|
for (let F = 0; F < t; F++) {
|
|
1225
|
-
let
|
|
1222
|
+
let P, M, W = 0;
|
|
1226
1223
|
if (C && F >= H) {
|
|
1227
1224
|
const q = F - H, j = q % H;
|
|
1228
|
-
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));
|
|
1229
1226
|
} else
|
|
1230
|
-
a.fillDirection === "row" ? (
|
|
1231
|
-
let G = D +
|
|
1232
|
-
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) {
|
|
1233
1230
|
const q = (W - 1) % It.length, j = It[q];
|
|
1234
1231
|
G += j.x * $, X += j.y * $;
|
|
1235
1232
|
}
|
|
@@ -1246,8 +1243,8 @@ class de {
|
|
|
1246
1243
|
a.alignment === "center" ? gt = (N - vt) / 2 : a.alignment === "end" && (gt = N - vt), B += gt;
|
|
1247
1244
|
}
|
|
1248
1245
|
}
|
|
1249
|
-
const rt =
|
|
1250
|
-
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));
|
|
1251
1248
|
let dt = 0;
|
|
1252
1249
|
if (u === "random") {
|
|
1253
1250
|
const q = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
|
|
@@ -1291,7 +1288,7 @@ class de {
|
|
|
1291
1288
|
return Math.random() * (e - t) + t;
|
|
1292
1289
|
}
|
|
1293
1290
|
}
|
|
1294
|
-
const
|
|
1291
|
+
const ge = Math.PI * (3 - Math.sqrt(5)), fe = {
|
|
1295
1292
|
spiralType: "golden",
|
|
1296
1293
|
direction: "counterclockwise",
|
|
1297
1294
|
tightness: 1,
|
|
@@ -1310,14 +1307,14 @@ class me {
|
|
|
1310
1307
|
* @returns Array of layout objects with position, rotation, scale
|
|
1311
1308
|
*/
|
|
1312
1309
|
generate(t, e, i = {}) {
|
|
1313
|
-
const o = [], { width: s, height: r } = e, a = { ...
|
|
1314
|
-
|
|
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,
|
|
1315
1312
|
S - h - c / 2
|
|
1316
1313
|
), w = a.direction === "clockwise" ? -1 : 1;
|
|
1317
1314
|
for (let E = 0; E < t; E++) {
|
|
1318
1315
|
let x, A;
|
|
1319
1316
|
if (a.spiralType === "golden")
|
|
1320
|
-
x = E *
|
|
1317
|
+
x = E * ge * w + a.startAngle, A = this.calculateGoldenRadius(E, t, v, a.tightness);
|
|
1321
1318
|
else if (a.spiralType === "archimedean") {
|
|
1322
1319
|
const G = E * 0.5 * a.tightness;
|
|
1323
1320
|
x = G * w + a.startAngle, A = this.calculateArchimedeanRadius(G, t, v, a.tightness);
|
|
@@ -1325,7 +1322,7 @@ class me {
|
|
|
1325
1322
|
const G = E * 0.3 * a.tightness;
|
|
1326
1323
|
x = G * w + a.startAngle, A = this.calculateLogarithmicRadius(G, t, v, a.tightness);
|
|
1327
1324
|
}
|
|
1328
|
-
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, $));
|
|
1329
1326
|
let M = 0;
|
|
1330
1327
|
if (u === "random") {
|
|
1331
1328
|
const G = x * 180 / Math.PI % 360, X = this.random(l, d);
|
|
@@ -1335,7 +1332,7 @@ class me {
|
|
|
1335
1332
|
o.push({
|
|
1336
1333
|
id: E,
|
|
1337
1334
|
x: F,
|
|
1338
|
-
y:
|
|
1335
|
+
y: P,
|
|
1339
1336
|
rotation: M,
|
|
1340
1337
|
scale: N,
|
|
1341
1338
|
baseSize: T,
|
|
@@ -1392,7 +1389,7 @@ class me {
|
|
|
1392
1389
|
return Math.random() * (e - t) + t;
|
|
1393
1390
|
}
|
|
1394
1391
|
}
|
|
1395
|
-
const
|
|
1392
|
+
const pe = {
|
|
1396
1393
|
clusterCount: "auto",
|
|
1397
1394
|
clusterSpread: 150,
|
|
1398
1395
|
clusterSpacing: 200,
|
|
@@ -1400,7 +1397,7 @@ const fe = {
|
|
|
1400
1397
|
overlap: 0.3,
|
|
1401
1398
|
distribution: "gaussian"
|
|
1402
1399
|
};
|
|
1403
|
-
class
|
|
1400
|
+
class be {
|
|
1404
1401
|
constructor(t, e = {}) {
|
|
1405
1402
|
this.config = t, this.imageConfig = e;
|
|
1406
1403
|
}
|
|
@@ -1412,13 +1409,13 @@ class pe {
|
|
|
1412
1409
|
* @returns Array of layout objects with position, rotation, scale
|
|
1413
1410
|
*/
|
|
1414
1411
|
generate(t, e, i = {}) {
|
|
1415
|
-
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(
|
|
1416
1413
|
t,
|
|
1417
1414
|
a.clusterCount,
|
|
1418
1415
|
s,
|
|
1419
1416
|
r,
|
|
1420
1417
|
a.clusterSpacing
|
|
1421
|
-
),
|
|
1418
|
+
), m = this.generateClusterCenters(
|
|
1422
1419
|
g,
|
|
1423
1420
|
s,
|
|
1424
1421
|
r,
|
|
@@ -1429,7 +1426,7 @@ class pe {
|
|
|
1429
1426
|
S[w % g]++;
|
|
1430
1427
|
let v = 0;
|
|
1431
1428
|
for (let w = 0; w < g; w++) {
|
|
1432
|
-
const E =
|
|
1429
|
+
const E = m[w], x = S[w];
|
|
1433
1430
|
for (let A = 0; A < x; A++) {
|
|
1434
1431
|
let L, z;
|
|
1435
1432
|
if (a.distribution === "gaussian")
|
|
@@ -1438,13 +1435,13 @@ class pe {
|
|
|
1438
1435
|
const M = this.random(0, Math.PI * 2), W = this.random(0, E.spread);
|
|
1439
1436
|
L = Math.cos(M) * W, z = Math.sin(M) * W;
|
|
1440
1437
|
}
|
|
1441
|
-
const
|
|
1442
|
-
L /=
|
|
1443
|
-
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;
|
|
1444
1441
|
let D = E.x + L, k = E.y + z;
|
|
1445
1442
|
const R = T * 1.5 / 2, C = T / 2;
|
|
1446
1443
|
D = Math.max(h + R, Math.min(D, s - h - R)), k = Math.max(h + C, Math.min(k, r - h - C));
|
|
1447
|
-
const O = u === "random" ? this.random(l, d) : 0, F = Math.sqrt(L * L + z * z) / E.spread,
|
|
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;
|
|
1448
1445
|
o.push({
|
|
1449
1446
|
id: v,
|
|
1450
1447
|
x: D,
|
|
@@ -1452,7 +1449,7 @@ class pe {
|
|
|
1452
1449
|
rotation: O,
|
|
1453
1450
|
scale: N,
|
|
1454
1451
|
baseSize: T,
|
|
1455
|
-
zIndex:
|
|
1452
|
+
zIndex: P
|
|
1456
1453
|
}), v++;
|
|
1457
1454
|
}
|
|
1458
1455
|
}
|
|
@@ -1475,22 +1472,22 @@ class pe {
|
|
|
1475
1472
|
generateClusterCenters(t, e, i, o, s) {
|
|
1476
1473
|
const r = [], h = o + s.clusterSpread, c = e - o - s.clusterSpread, u = o + s.clusterSpread, l = i - o - s.clusterSpread;
|
|
1477
1474
|
for (let d = 0; d < t; d++) {
|
|
1478
|
-
let
|
|
1475
|
+
let f = null, b = -1;
|
|
1479
1476
|
for (let p = 0; p < 100; p++) {
|
|
1480
1477
|
const g = {
|
|
1481
1478
|
x: this.random(h, c),
|
|
1482
1479
|
y: this.random(u, l),
|
|
1483
1480
|
spread: this.calculateClusterSpread(s)
|
|
1484
1481
|
};
|
|
1485
|
-
let
|
|
1482
|
+
let m = 1 / 0;
|
|
1486
1483
|
for (const S of r) {
|
|
1487
1484
|
const v = g.x - S.x, w = g.y - S.y, E = Math.sqrt(v * v + w * w);
|
|
1488
|
-
|
|
1485
|
+
m = Math.min(m, E);
|
|
1489
1486
|
}
|
|
1490
|
-
if ((r.length === 0 ||
|
|
1487
|
+
if ((r.length === 0 || m > b) && (f = g, b = m), m >= s.clusterSpacing)
|
|
1491
1488
|
break;
|
|
1492
1489
|
}
|
|
1493
|
-
|
|
1490
|
+
f && r.push(f);
|
|
1494
1491
|
}
|
|
1495
1492
|
return r;
|
|
1496
1493
|
}
|
|
@@ -1518,7 +1515,7 @@ class pe {
|
|
|
1518
1515
|
return Math.random() * (e - t) + t;
|
|
1519
1516
|
}
|
|
1520
1517
|
}
|
|
1521
|
-
class
|
|
1518
|
+
class ye {
|
|
1522
1519
|
constructor(t, e = {}) {
|
|
1523
1520
|
this.config = t, this.imageConfig = e;
|
|
1524
1521
|
}
|
|
@@ -1530,19 +1527,19 @@ class be {
|
|
|
1530
1527
|
* @returns Array of layout objects with position, rotation, scale
|
|
1531
1528
|
*/
|
|
1532
1529
|
generate(t, e, i = {}) {
|
|
1533
|
-
const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1,
|
|
1534
|
-
...
|
|
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,
|
|
1535
1532
|
...this.config.wave
|
|
1536
|
-
}, { 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;
|
|
1537
1534
|
let R = 0;
|
|
1538
|
-
for (let C = 0; C <
|
|
1539
|
-
const O =
|
|
1535
|
+
for (let C = 0; C < m && R < t; C++) {
|
|
1536
|
+
const O = m === 1 ? (T + D) / 2 : T + C * H;
|
|
1540
1537
|
let $ = 0;
|
|
1541
1538
|
E === "offset" ? $ = C * w : E === "alternating" && ($ = C * Math.PI);
|
|
1542
1539
|
for (let F = 0; F < x && R < t; F++) {
|
|
1543
|
-
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;
|
|
1544
1541
|
let J = 0;
|
|
1545
|
-
c === "tangent" ? J = this.calculateRotation(
|
|
1542
|
+
c === "tangent" ? J = this.calculateRotation(P, s, S, v, $) : c === "random" && (J = this.random(u, l));
|
|
1546
1543
|
const K = B * 1.5 / 2, ct = B / 2, it = h + K, nt = s - h - K, lt = h + ct, ht = r - h - ct;
|
|
1547
1544
|
o.push({
|
|
1548
1545
|
id: R,
|
|
@@ -1595,7 +1592,7 @@ class be {
|
|
|
1595
1592
|
return Math.random() * (e - t) + t;
|
|
1596
1593
|
}
|
|
1597
1594
|
}
|
|
1598
|
-
class
|
|
1595
|
+
class ve {
|
|
1599
1596
|
constructor(t) {
|
|
1600
1597
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1601
1598
|
}
|
|
@@ -1606,17 +1603,17 @@ class ye {
|
|
|
1606
1603
|
initLayout() {
|
|
1607
1604
|
switch (this.config.algorithm) {
|
|
1608
1605
|
case "radial":
|
|
1609
|
-
return new
|
|
1606
|
+
return new he(this.config, this.imageConfig);
|
|
1610
1607
|
case "grid":
|
|
1611
|
-
return new
|
|
1608
|
+
return new ue(this.config, this.imageConfig);
|
|
1612
1609
|
case "spiral":
|
|
1613
1610
|
return new me(this.config, this.imageConfig);
|
|
1614
1611
|
case "cluster":
|
|
1615
|
-
return new pe(this.config, this.imageConfig);
|
|
1616
|
-
case "wave":
|
|
1617
1612
|
return new be(this.config, this.imageConfig);
|
|
1613
|
+
case "wave":
|
|
1614
|
+
return new ye(this.config, this.imageConfig);
|
|
1618
1615
|
default:
|
|
1619
|
-
return new
|
|
1616
|
+
return new le(this.config, this.imageConfig);
|
|
1620
1617
|
}
|
|
1621
1618
|
}
|
|
1622
1619
|
/**
|
|
@@ -1699,12 +1696,12 @@ class ye {
|
|
|
1699
1696
|
if (r !== void 0)
|
|
1700
1697
|
return { height: r };
|
|
1701
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;
|
|
1702
|
-
let
|
|
1703
|
-
|
|
1704
|
-
let S = this.clamp(
|
|
1705
|
-
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) {
|
|
1706
1703
|
const v = Math.max(a * 0.05, 20);
|
|
1707
|
-
S = Math.max(v,
|
|
1704
|
+
S = Math.max(v, m);
|
|
1708
1705
|
}
|
|
1709
1706
|
return { height: S };
|
|
1710
1707
|
}
|
|
@@ -1716,13 +1713,27 @@ class ye {
|
|
|
1716
1713
|
}
|
|
1717
1714
|
}
|
|
1718
1715
|
var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
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
|
+
};
|
|
1722
1726
|
function we(n) {
|
|
1723
|
-
|
|
1727
|
+
if (n)
|
|
1728
|
+
return n in At ? At[n] : n;
|
|
1724
1729
|
}
|
|
1725
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) {
|
|
1726
1737
|
if (!n) return "";
|
|
1727
1738
|
const t = [];
|
|
1728
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)
|
|
@@ -1751,37 +1762,41 @@ function st(n) {
|
|
|
1751
1762
|
const s = n.border || {}, r = { ...s, ...n.borderTop }, a = { ...s, ...n.borderRight }, h = { ...s, ...n.borderBottom }, c = { ...s, ...n.borderLeft };
|
|
1752
1763
|
t.borderTop = Q(r), t.borderRight = Q(a), t.borderBottom = Q(h), t.borderLeft = Q(c);
|
|
1753
1764
|
} else n.border && (t.border = Q(n.border));
|
|
1754
|
-
n.shadow !== void 0 && (t.boxShadow =
|
|
1755
|
-
const o =
|
|
1765
|
+
n.shadow !== void 0 && (t.boxShadow = Se(n.shadow));
|
|
1766
|
+
const o = Ee(n.filter);
|
|
1756
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) {
|
|
1757
1768
|
const s = n.outline.width ?? 0, r = n.outline.style ?? "solid", a = n.outline.color ?? "#000000";
|
|
1758
1769
|
t.outline = `${s}px ${r} ${a}`, n.outline.offset !== void 0 && (t.outlineOffset = `${n.outline.offset}px`);
|
|
1759
1770
|
}
|
|
1760
|
-
|
|
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;
|
|
1761
1776
|
}
|
|
1762
1777
|
function tt(n, t) {
|
|
1763
|
-
t.borderRadius !== void 0 && (n.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (n.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (n.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (n.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (n.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (n.style.border = t.border), t.borderTop !== void 0 && (n.style.borderTop = t.borderTop), t.borderRight !== void 0 && (n.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (n.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (n.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (n.style.boxShadow = t.boxShadow), t.filter !== void 0 && (n.style.filter = t.filter), t.opacity !== void 0 && (n.style.opacity = t.opacity), t.cursor !== void 0 && (n.style.cursor = t.cursor), t.outline !== void 0 && (n.style.outline = t.outline), t.outlineOffset !== void 0 && (n.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (n.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (n.style.aspectRatio = t.aspectRatio);
|
|
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);
|
|
1764
1779
|
}
|
|
1765
|
-
function
|
|
1780
|
+
function zt(n) {
|
|
1766
1781
|
return n ? Array.isArray(n) ? n.join(" ") : n : "";
|
|
1767
1782
|
}
|
|
1768
1783
|
function et(n, t) {
|
|
1769
|
-
const e =
|
|
1784
|
+
const e = zt(t);
|
|
1770
1785
|
e && e.split(" ").forEach((i) => {
|
|
1771
1786
|
i.trim() && n.classList.add(i.trim());
|
|
1772
1787
|
});
|
|
1773
1788
|
}
|
|
1774
|
-
function
|
|
1775
|
-
const e =
|
|
1789
|
+
function Ft(n, t) {
|
|
1790
|
+
const e = zt(t);
|
|
1776
1791
|
e && e.split(" ").forEach((i) => {
|
|
1777
1792
|
i.trim() && n.classList.remove(i.trim());
|
|
1778
1793
|
});
|
|
1779
1794
|
}
|
|
1780
|
-
const
|
|
1795
|
+
const Tt = {
|
|
1781
1796
|
UNFOCUSING: 999,
|
|
1782
1797
|
FOCUSING: 1e3
|
|
1783
1798
|
};
|
|
1784
|
-
class
|
|
1799
|
+
class Ie {
|
|
1785
1800
|
constructor(t, e, i) {
|
|
1786
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;
|
|
1787
1802
|
}
|
|
@@ -1874,7 +1889,7 @@ class Se {
|
|
|
1874
1889
|
* Remove focused styling from an element
|
|
1875
1890
|
*/
|
|
1876
1891
|
removeFocusedStyling(t, e) {
|
|
1877
|
-
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);
|
|
1878
1893
|
}
|
|
1879
1894
|
/**
|
|
1880
1895
|
* Start focus animation for an image using dimension-based zoom
|
|
@@ -1884,19 +1899,19 @@ class Se {
|
|
|
1884
1899
|
*/
|
|
1885
1900
|
startFocusAnimation(t, e, i, o, s) {
|
|
1886
1901
|
const r = t.style.zIndex || "", a = t.offsetWidth, h = t.offsetHeight, c = this.calculateFocusDimensions(a, h, e), u = this.calculateFocusTransform(e, i);
|
|
1887
|
-
this.applyFocusedStyling(t,
|
|
1902
|
+
this.applyFocusedStyling(t, Tt.FOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1888
1903
|
const l = o ?? {
|
|
1889
1904
|
x: 0,
|
|
1890
1905
|
y: 0,
|
|
1891
1906
|
rotation: i.rotation,
|
|
1892
1907
|
scale: 1
|
|
1893
1908
|
// No scale - using dimensions
|
|
1894
|
-
}, d = s?.width ?? a,
|
|
1909
|
+
}, d = s?.width ?? a, f = s?.height ?? h, b = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
|
|
1895
1910
|
t,
|
|
1896
1911
|
l,
|
|
1897
1912
|
u,
|
|
1898
1913
|
d,
|
|
1899
|
-
|
|
1914
|
+
f,
|
|
1900
1915
|
c.width,
|
|
1901
1916
|
c.height,
|
|
1902
1917
|
b
|
|
@@ -1933,7 +1948,7 @@ class Se {
|
|
|
1933
1948
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1934
1949
|
*/
|
|
1935
1950
|
startUnfocusAnimation(t, e, i, o) {
|
|
1936
|
-
t.style.zIndex = String(
|
|
1951
|
+
t.style.zIndex = String(Tt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1937
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 = {
|
|
1938
1953
|
x: 0,
|
|
1939
1954
|
y: 0,
|
|
@@ -1949,7 +1964,7 @@ class Se {
|
|
|
1949
1964
|
c,
|
|
1950
1965
|
u,
|
|
1951
1966
|
l
|
|
1952
|
-
),
|
|
1967
|
+
), f = {
|
|
1953
1968
|
id: `unfocus-${Date.now()}`,
|
|
1954
1969
|
element: t,
|
|
1955
1970
|
animation: d,
|
|
@@ -1961,7 +1976,7 @@ class Se {
|
|
|
1961
1976
|
return {
|
|
1962
1977
|
element: t,
|
|
1963
1978
|
originalState: e,
|
|
1964
|
-
animationHandle:
|
|
1979
|
+
animationHandle: f,
|
|
1965
1980
|
direction: "out",
|
|
1966
1981
|
originalWidth: c,
|
|
1967
1982
|
originalHeight: u
|
|
@@ -2221,7 +2236,7 @@ class Se {
|
|
|
2221
2236
|
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2222
2237
|
}
|
|
2223
2238
|
}
|
|
2224
|
-
const
|
|
2239
|
+
const Ae = 50, Te = 0.5, Ce = 20, Re = 0.3, Me = 150, Le = 30, at = class at {
|
|
2225
2240
|
constructor(t, e) {
|
|
2226
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);
|
|
2227
2242
|
}
|
|
@@ -2268,11 +2283,11 @@ const Ee = 50, Ie = 0.5, Ae = 20, Te = 0.3, Ce = 150, Re = 30, at = class at {
|
|
|
2268
2283
|
const e = t.touches[0], i = e.clientX - this.touchState.startX, o = e.clientY - this.touchState.startY;
|
|
2269
2284
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + o * o) > 10) {
|
|
2270
2285
|
const a = Math.atan2(Math.abs(o), Math.abs(i)) * (180 / Math.PI);
|
|
2271
|
-
this.touchState.isHorizontalSwipe = a <=
|
|
2286
|
+
this.touchState.isHorizontalSwipe = a <= Le;
|
|
2272
2287
|
}
|
|
2273
2288
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2274
2289
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
|
|
2275
|
-
const s = i *
|
|
2290
|
+
const s = i * Re;
|
|
2276
2291
|
this.callbacks.onDragOffset(s);
|
|
2277
2292
|
}
|
|
2278
2293
|
}
|
|
@@ -2281,15 +2296,15 @@ const Ee = 50, Ie = 0.5, Ae = 20, Te = 0.3, Ce = 150, Re = 30, at = class at {
|
|
|
2281
2296
|
this.recentTouchTimestamp = Date.now();
|
|
2282
2297
|
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, o = Math.abs(e) / i, s = Math.abs(e);
|
|
2283
2298
|
let r = !1;
|
|
2284
|
-
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;
|
|
2285
2300
|
}
|
|
2286
2301
|
handleTouchCancel(t) {
|
|
2287
2302
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
2288
2303
|
}
|
|
2289
2304
|
};
|
|
2290
2305
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2291
|
-
let
|
|
2292
|
-
class
|
|
2306
|
+
let mt = at;
|
|
2307
|
+
class ze {
|
|
2293
2308
|
constructor(t) {
|
|
2294
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)
|
|
2295
2310
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2510,7 +2525,7 @@ class Me {
|
|
|
2510
2525
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2511
2526
|
}
|
|
2512
2527
|
}
|
|
2513
|
-
class
|
|
2528
|
+
class Fe {
|
|
2514
2529
|
constructor(t) {
|
|
2515
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)
|
|
2516
2531
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2690,7 +2705,7 @@ class Le {
|
|
|
2690
2705
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2691
2706
|
}
|
|
2692
2707
|
}
|
|
2693
|
-
class
|
|
2708
|
+
class De {
|
|
2694
2709
|
constructor(t) {
|
|
2695
2710
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
2696
2711
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -2747,7 +2762,7 @@ class ze {
|
|
|
2747
2762
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2748
2763
|
}
|
|
2749
2764
|
}
|
|
2750
|
-
class
|
|
2765
|
+
class Oe {
|
|
2751
2766
|
/**
|
|
2752
2767
|
* Create a new ImageFilter
|
|
2753
2768
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2784,7 +2799,7 @@ class Fe {
|
|
|
2784
2799
|
// isAllowedDate(date: Date): boolean
|
|
2785
2800
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2786
2801
|
}
|
|
2787
|
-
const
|
|
2802
|
+
const $e = `
|
|
2788
2803
|
.fbn-ic-gallery {
|
|
2789
2804
|
position: relative;
|
|
2790
2805
|
width: 100%;
|
|
@@ -2834,21 +2849,21 @@ const De = `
|
|
|
2834
2849
|
display: none !important;
|
|
2835
2850
|
}
|
|
2836
2851
|
`;
|
|
2837
|
-
function
|
|
2852
|
+
function Pe() {
|
|
2838
2853
|
if (typeof document > "u") return;
|
|
2839
2854
|
const n = "fbn-ic-functional-styles";
|
|
2840
2855
|
if (document.getElementById(n)) return;
|
|
2841
2856
|
const t = document.createElement("style");
|
|
2842
|
-
t.id = n, t.textContent =
|
|
2857
|
+
t.id = n, t.textContent = $e, document.head.appendChild(t);
|
|
2843
2858
|
}
|
|
2844
|
-
let
|
|
2859
|
+
let Ue = class {
|
|
2845
2860
|
constructor(t = {}) {
|
|
2846
|
-
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({
|
|
2847
2862
|
layout: this.fullConfig.layout,
|
|
2848
2863
|
image: this.fullConfig.image
|
|
2849
|
-
}), 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;
|
|
2850
2865
|
const e = this.fullConfig.animation.entry || y.animation.entry;
|
|
2851
|
-
this.entryAnimationEngine = new
|
|
2866
|
+
this.entryAnimationEngine = new ce(
|
|
2852
2867
|
e,
|
|
2853
2868
|
this.fullConfig.layout.algorithm
|
|
2854
2869
|
), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
@@ -2858,7 +2873,7 @@ let $e = class {
|
|
|
2858
2873
|
*/
|
|
2859
2874
|
createImageFilter() {
|
|
2860
2875
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
2861
|
-
return new
|
|
2876
|
+
return new Oe(t);
|
|
2862
2877
|
}
|
|
2863
2878
|
/**
|
|
2864
2879
|
* Create appropriate image loader based on config
|
|
@@ -2869,7 +2884,7 @@ let $e = class {
|
|
|
2869
2884
|
if (!t || t.length === 0)
|
|
2870
2885
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
2871
2886
|
const i = t.map((o) => this.createLoaderFromEntry(o, e));
|
|
2872
|
-
return i.length === 1 ? i[0] : new
|
|
2887
|
+
return i.length === 1 ? i[0] : new De({
|
|
2873
2888
|
loaders: i,
|
|
2874
2889
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
2875
2890
|
});
|
|
@@ -2887,14 +2902,14 @@ let $e = class {
|
|
|
2887
2902
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2888
2903
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2889
2904
|
};
|
|
2890
|
-
return new
|
|
2905
|
+
return new Fe(o);
|
|
2891
2906
|
} else if ("googleDrive" in t) {
|
|
2892
2907
|
const i = t.googleDrive, o = {
|
|
2893
2908
|
...i,
|
|
2894
2909
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2895
2910
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2896
2911
|
};
|
|
2897
|
-
return new
|
|
2912
|
+
return new ze(o);
|
|
2898
2913
|
} else
|
|
2899
2914
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
2900
2915
|
}
|
|
@@ -2903,16 +2918,16 @@ let $e = class {
|
|
|
2903
2918
|
*/
|
|
2904
2919
|
async init() {
|
|
2905
2920
|
try {
|
|
2906
|
-
if (
|
|
2921
|
+
if (Pe(), this.containerRef)
|
|
2907
2922
|
this.containerEl = this.containerRef;
|
|
2908
2923
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
2909
2924
|
throw new Error(`Container #${this.containerId} not found`);
|
|
2910
|
-
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new
|
|
2925
|
+
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new mt(this.containerEl, {
|
|
2911
2926
|
onNext: () => this.navigateToNextImage(),
|
|
2912
2927
|
onPrev: () => this.navigateToPreviousImage(),
|
|
2913
2928
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
2914
2929
|
onDragEnd: (t) => {
|
|
2915
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
2930
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Me);
|
|
2916
2931
|
}
|
|
2917
2932
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
2918
2933
|
} catch (t) {
|
|
@@ -3039,20 +3054,20 @@ let $e = class {
|
|
|
3039
3054
|
const d = {
|
|
3040
3055
|
x: parseFloat(c.dataset.startX),
|
|
3041
3056
|
y: parseFloat(c.dataset.startY)
|
|
3042
|
-
},
|
|
3057
|
+
}, f = {
|
|
3043
3058
|
x: parseFloat(c.dataset.endX),
|
|
3044
3059
|
y: parseFloat(c.dataset.endY)
|
|
3045
|
-
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation),
|
|
3046
|
-
|
|
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({
|
|
3047
3062
|
element: c,
|
|
3048
3063
|
startPosition: d,
|
|
3049
|
-
endPosition:
|
|
3064
|
+
endPosition: f,
|
|
3050
3065
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3051
3066
|
duration: w.duration,
|
|
3052
3067
|
imageWidth: b,
|
|
3053
3068
|
imageHeight: p,
|
|
3054
3069
|
rotation: g,
|
|
3055
|
-
scale:
|
|
3070
|
+
scale: m,
|
|
3056
3071
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3057
3072
|
startRotation: S,
|
|
3058
3073
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
@@ -3109,8 +3124,8 @@ let $e = class {
|
|
|
3109
3124
|
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), s.forEach((c, u) => {
|
|
3110
3125
|
const l = document.createElement("div");
|
|
3111
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";
|
|
3112
|
-
const d = c.x,
|
|
3113
|
-
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);
|
|
3114
3129
|
})), t.forEach((c, u) => {
|
|
3115
3130
|
const l = document.createElement("img");
|
|
3116
3131
|
l.referrerPolicy = "no-referrer", l.classList.add("fbn-ic-image"), l.dataset.imageId = String(u);
|
|
@@ -3118,15 +3133,15 @@ let $e = class {
|
|
|
3118
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", () => {
|
|
3119
3134
|
this.hoveredImage = { element: l, layout: d }, this.zoomEngine.isInvolved(l) || (tt(l, this.hoverStyles), et(l, this.hoverClassName));
|
|
3120
3135
|
}), l.addEventListener("mouseleave", () => {
|
|
3121
|
-
this.hoveredImage = null, this.zoomEngine.isInvolved(l) || (tt(l, this.defaultStyles),
|
|
3122
|
-
}), l.addEventListener("click", (
|
|
3123
|
-
|
|
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);
|
|
3124
3139
|
}), l.style.opacity = "0", l.style.transition = this.entryAnimationEngine.getTransitionCSS(), l.onload = () => {
|
|
3125
3140
|
if (o !== this.loadGeneration)
|
|
3126
3141
|
return;
|
|
3127
|
-
const
|
|
3142
|
+
const f = l.naturalWidth / l.naturalHeight, b = e * f;
|
|
3128
3143
|
l.style.width = `${b}px`;
|
|
3129
|
-
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(
|
|
3130
3145
|
p,
|
|
3131
3146
|
g,
|
|
3132
3147
|
i,
|
|
@@ -3138,7 +3153,7 @@ let $e = class {
|
|
|
3138
3153
|
b,
|
|
3139
3154
|
e
|
|
3140
3155
|
), E = this.entryAnimationEngine.buildStartTransform(
|
|
3141
|
-
|
|
3156
|
+
m,
|
|
3142
3157
|
p,
|
|
3143
3158
|
d.rotation,
|
|
3144
3159
|
d.scale,
|
|
@@ -3155,7 +3170,7 @@ let $e = class {
|
|
|
3155
3170
|
finalTransform: w,
|
|
3156
3171
|
renderedWidth: b,
|
|
3157
3172
|
renderedHeight: e
|
|
3158
|
-
}), l.style.transform = E, l.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || S !== d.rotation || v !== d.scale) && (l.dataset.startX = String(
|
|
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);
|
|
3159
3174
|
}, l.onerror = () => r++, l.src = c;
|
|
3160
3175
|
});
|
|
3161
3176
|
}
|
|
@@ -3200,16 +3215,16 @@ let $e = class {
|
|
|
3200
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();
|
|
3201
3216
|
}
|
|
3202
3217
|
};
|
|
3203
|
-
const
|
|
3218
|
+
const je = Pt(
|
|
3204
3219
|
function({ className: t, style: e, ...i }, o) {
|
|
3205
3220
|
const s = wt(null), r = wt(null);
|
|
3206
3221
|
return Ut(o, () => ({
|
|
3207
3222
|
get instance() {
|
|
3208
3223
|
return r.current;
|
|
3209
3224
|
}
|
|
3210
|
-
})),
|
|
3225
|
+
})), _t(() => {
|
|
3211
3226
|
if (!s.current) return;
|
|
3212
|
-
const a = new
|
|
3227
|
+
const a = new Ue({
|
|
3213
3228
|
container: s.current,
|
|
3214
3229
|
...i
|
|
3215
3230
|
});
|
|
@@ -3218,10 +3233,10 @@ const He = $t(
|
|
|
3218
3233
|
}), () => {
|
|
3219
3234
|
a.destroy(), r.current = null;
|
|
3220
3235
|
};
|
|
3221
|
-
}, [JSON.stringify(i)]), /* @__PURE__ */
|
|
3236
|
+
}, [JSON.stringify(i)]), /* @__PURE__ */ $t("div", { ref: s, className: t, style: e });
|
|
3222
3237
|
}
|
|
3223
3238
|
);
|
|
3224
3239
|
export {
|
|
3225
|
-
|
|
3240
|
+
je as ImageCloud
|
|
3226
3241
|
};
|
|
3227
3242
|
//# sourceMappingURL=react.js.map
|