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