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