@frybynite/image-cloud 0.1.3 → 0.2.1
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/README.md +1 -1
- package/dist/image-cloud-auto-init.js +490 -442
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +501 -451
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +42 -2
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +56 -29
- package/package.json +2 -2
|
@@ -8,12 +8,12 @@ const Ht = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
8
8
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
9
9
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
10
10
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
11
|
-
}),
|
|
11
|
+
}), Mt = Object.freeze({
|
|
12
12
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
13
13
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
14
14
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
15
15
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
16
|
-
}),
|
|
16
|
+
}), Tt = Object.freeze({
|
|
17
17
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
18
18
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
19
19
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
@@ -49,7 +49,7 @@ const Ht = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
49
49
|
focused: Object.freeze({
|
|
50
50
|
shadow: "none"
|
|
51
51
|
})
|
|
52
|
-
}),
|
|
52
|
+
}), _t = Object.freeze({
|
|
53
53
|
rows: 1,
|
|
54
54
|
amplitude: 100,
|
|
55
55
|
frequency: 2,
|
|
@@ -57,23 +57,29 @@ const Ht = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
57
57
|
synchronization: "offset"
|
|
58
58
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
59
59
|
}), jt = Object.freeze({
|
|
60
|
-
|
|
60
|
+
mobile: Object.freeze({ maxWidth: 767 }),
|
|
61
|
+
tablet: Object.freeze({ maxWidth: 1199 })
|
|
62
|
+
}), kt = Object.freeze({
|
|
63
|
+
mode: "adaptive",
|
|
64
|
+
// Default to adaptive sizing
|
|
65
|
+
minSize: 50,
|
|
66
|
+
// Adaptive mode minimum
|
|
67
|
+
maxSize: 400,
|
|
68
|
+
// Adaptive mode maximum
|
|
61
69
|
variance: Object.freeze({
|
|
62
70
|
min: 1,
|
|
63
71
|
// No variance by default
|
|
64
72
|
max: 1
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
// No decay by default
|
|
68
|
-
}), _t = Object.freeze({
|
|
73
|
+
})
|
|
74
|
+
}), Gt = Object.freeze({
|
|
69
75
|
mode: "none",
|
|
70
76
|
range: Object.freeze({
|
|
71
77
|
min: -15,
|
|
72
78
|
max: 15
|
|
73
79
|
})
|
|
74
80
|
}), $t = Object.freeze({
|
|
75
|
-
sizing:
|
|
76
|
-
rotation:
|
|
81
|
+
sizing: kt,
|
|
82
|
+
rotation: Gt
|
|
77
83
|
}), y = Object.freeze({
|
|
78
84
|
// Unified loader configuration
|
|
79
85
|
loader: Object.freeze({
|
|
@@ -103,26 +109,9 @@ const Ht = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
103
109
|
// Pattern-based layout configuration
|
|
104
110
|
layout: Object.freeze({
|
|
105
111
|
algorithm: "radial",
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
responsive: [
|
|
110
|
-
{ minWidth: 1200, height: 225 },
|
|
111
|
-
// Large screens
|
|
112
|
-
{ minWidth: 768, height: 180 },
|
|
113
|
-
// Tablet / Small desktop
|
|
114
|
-
{ minWidth: 0, height: 100 }
|
|
115
|
-
// Mobile / Default
|
|
116
|
-
],
|
|
117
|
-
adaptive: Object.freeze({
|
|
118
|
-
enabled: !0,
|
|
119
|
-
// Enable adaptive sizing by default
|
|
120
|
-
minSize: 50,
|
|
121
|
-
// Minimum 50px image height
|
|
122
|
-
maxSize: 400
|
|
123
|
-
// Maximum 400px image height
|
|
124
|
-
})
|
|
125
|
-
}),
|
|
112
|
+
scaleDecay: 0,
|
|
113
|
+
// No decay by default (0-1 for radial/spiral)
|
|
114
|
+
responsive: jt,
|
|
126
115
|
targetCoverage: 0.6,
|
|
127
116
|
// Target 60% of container area
|
|
128
117
|
densityFactor: 1,
|
|
@@ -252,7 +241,7 @@ function rt(n, t) {
|
|
|
252
241
|
const e = { ...n };
|
|
253
242
|
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;
|
|
254
243
|
}
|
|
255
|
-
function
|
|
244
|
+
function Wt(n, t) {
|
|
256
245
|
if (!t) return { ...n };
|
|
257
246
|
const e = rt(n.default, t.default), i = rt(
|
|
258
247
|
rt(e, n.hover),
|
|
@@ -267,27 +256,27 @@ function Gt(n, t) {
|
|
|
267
256
|
focused: o
|
|
268
257
|
};
|
|
269
258
|
}
|
|
270
|
-
function
|
|
271
|
-
var i, o, a, c, s, h, l,
|
|
259
|
+
function Nt(n, t) {
|
|
260
|
+
var i, o, a, c, s, h, l, u;
|
|
272
261
|
if (!t) return { ...n };
|
|
273
262
|
const e = { ...n };
|
|
274
263
|
if (t.sizing !== void 0 && (e.sizing = {
|
|
275
264
|
...n.sizing,
|
|
276
265
|
...t.sizing
|
|
277
266
|
}, t.sizing.variance)) {
|
|
278
|
-
const r = t.sizing.variance, d = r.min !== void 0 && r.min
|
|
267
|
+
const r = t.sizing.variance, d = r.min !== void 0 && r.min >= 0.25 && r.min <= 1 ? r.min : ((o = (i = n.sizing) == null ? void 0 : i.variance) == null ? void 0 : o.min) ?? 1, m = r.max !== void 0 && r.max >= 1 && r.max <= 1.75 ? r.max : ((c = (a = n.sizing) == null ? void 0 : a.variance) == null ? void 0 : c.max) ?? 1;
|
|
279
268
|
e.sizing.variance = { min: d, max: m };
|
|
280
269
|
}
|
|
281
270
|
if (t.rotation !== void 0 && (e.rotation = {
|
|
282
271
|
...n.rotation,
|
|
283
272
|
...t.rotation
|
|
284
273
|
}, t.rotation.range)) {
|
|
285
|
-
const r = t.rotation.range, d = r.min !== void 0 && r.min >= -180 && r.min <= 0 ? r.min : ((h = (s = n.rotation) == null ? void 0 : s.range) == null ? void 0 : h.min) ?? -15, m = r.max !== void 0 && r.max >= 0 && r.max <= 180 ? r.max : ((
|
|
274
|
+
const r = t.rotation.range, d = r.min !== void 0 && r.min >= -180 && r.min <= 0 ? r.min : ((h = (s = n.rotation) == null ? void 0 : s.range) == null ? void 0 : h.min) ?? -15, m = r.max !== void 0 && r.max >= 0 && r.max <= 180 ? r.max : ((u = (l = n.rotation) == null ? void 0 : l.range) == null ? void 0 : u.max) ?? 15;
|
|
286
275
|
e.rotation.range = { min: d, max: m };
|
|
287
276
|
}
|
|
288
277
|
return e;
|
|
289
278
|
}
|
|
290
|
-
function
|
|
279
|
+
function qt(n) {
|
|
291
280
|
var e;
|
|
292
281
|
const t = (e = n.layout) == null ? void 0 : e.rotation;
|
|
293
282
|
if (t && "enabled" in t)
|
|
@@ -298,19 +287,21 @@ function Nt(n) {
|
|
|
298
287
|
}
|
|
299
288
|
};
|
|
300
289
|
}
|
|
301
|
-
function
|
|
290
|
+
function Yt(n) {
|
|
302
291
|
var e, i;
|
|
303
292
|
const t = (i = (e = n.layout) == null ? void 0 : e.sizing) == null ? void 0 : i.variance;
|
|
304
293
|
if (t)
|
|
305
294
|
return {
|
|
306
295
|
sizing: {
|
|
296
|
+
mode: "adaptive",
|
|
297
|
+
// Legacy variance config implies adaptive mode
|
|
307
298
|
variance: t
|
|
308
299
|
}
|
|
309
300
|
};
|
|
310
301
|
}
|
|
311
|
-
function
|
|
302
|
+
function Bt(n = {}) {
|
|
312
303
|
var a;
|
|
313
|
-
const t =
|
|
304
|
+
const t = qt(n), e = Yt(n);
|
|
314
305
|
let i = n.image;
|
|
315
306
|
(t || e) && (i = {
|
|
316
307
|
...e || {},
|
|
@@ -322,12 +313,12 @@ function Yt(n = {}) {
|
|
|
322
313
|
}));
|
|
323
314
|
const o = {
|
|
324
315
|
loader: { ...y.loader },
|
|
325
|
-
image:
|
|
316
|
+
image: Nt($t, i),
|
|
326
317
|
layout: { ...y.layout },
|
|
327
318
|
animation: { ...y.animation },
|
|
328
319
|
interaction: { ...y.interaction },
|
|
329
320
|
rendering: { ...y.rendering },
|
|
330
|
-
styling:
|
|
321
|
+
styling: Wt(Lt, n.styling),
|
|
331
322
|
debug: y.debug
|
|
332
323
|
};
|
|
333
324
|
return n.loader && (o.loader = {
|
|
@@ -346,11 +337,10 @@ function Yt(n = {}) {
|
|
|
346
337
|
})), n.layout && (o.layout = {
|
|
347
338
|
...y.layout,
|
|
348
339
|
...n.layout
|
|
349
|
-
}, n.layout.
|
|
350
|
-
...y.layout.
|
|
351
|
-
...n.layout.
|
|
352
|
-
|
|
353
|
-
adaptive: n.layout.sizing.adaptive ? { ...y.layout.sizing.adaptive, ...n.layout.sizing.adaptive } : y.layout.sizing.adaptive
|
|
340
|
+
}, n.layout.responsive && (o.layout.responsive = {
|
|
341
|
+
...y.layout.responsive,
|
|
342
|
+
mobile: n.layout.responsive.mobile ? { ...y.layout.responsive.mobile, ...n.layout.responsive.mobile } : y.layout.responsive.mobile,
|
|
343
|
+
tablet: n.layout.responsive.tablet ? { ...y.layout.responsive.tablet, ...n.layout.responsive.tablet } : y.layout.responsive.tablet
|
|
354
344
|
}), n.layout.spacing && (o.layout.spacing = {
|
|
355
345
|
...y.layout.spacing,
|
|
356
346
|
...n.layout.spacing
|
|
@@ -409,13 +399,13 @@ function Yt(n = {}) {
|
|
|
409
399
|
function Xt(n, t) {
|
|
410
400
|
return { ...n ? zt[n] : zt.playful, ...t };
|
|
411
401
|
}
|
|
412
|
-
function Bt(n, t) {
|
|
413
|
-
return { ...n ? Tt[n] : Tt.gentle, ...t };
|
|
414
|
-
}
|
|
415
402
|
function Vt(n, t) {
|
|
416
403
|
return { ...n ? Mt[n] : Mt.gentle, ...t };
|
|
417
404
|
}
|
|
418
|
-
|
|
405
|
+
function Jt(n, t) {
|
|
406
|
+
return { ...n ? Tt[n] : Tt.gentle, ...t };
|
|
407
|
+
}
|
|
408
|
+
class Zt {
|
|
419
409
|
constructor(t) {
|
|
420
410
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
421
411
|
}
|
|
@@ -444,7 +434,7 @@ class Jt {
|
|
|
444
434
|
this.cancelAllAnimations(t);
|
|
445
435
|
const c = o ?? this.config.duration, s = a ?? this.config.easing.default, h = this.buildTransformString(e), l = this.buildTransformString(i);
|
|
446
436
|
t.style.transition = "none";
|
|
447
|
-
const
|
|
437
|
+
const u = t.animate(
|
|
448
438
|
[
|
|
449
439
|
{ transform: h },
|
|
450
440
|
{ transform: l }
|
|
@@ -458,13 +448,13 @@ class Jt {
|
|
|
458
448
|
), r = {
|
|
459
449
|
id: `anim-${++this.animationIdCounter}`,
|
|
460
450
|
element: t,
|
|
461
|
-
animation:
|
|
451
|
+
animation: u,
|
|
462
452
|
fromState: e,
|
|
463
453
|
toState: i,
|
|
464
454
|
startTime: performance.now(),
|
|
465
455
|
duration: c
|
|
466
456
|
};
|
|
467
|
-
return this.activeAnimations.set(t, r),
|
|
457
|
+
return this.activeAnimations.set(t, r), u.finished.then(() => {
|
|
468
458
|
t.style.transform = l, this.activeAnimations.delete(t);
|
|
469
459
|
}).catch(() => {
|
|
470
460
|
this.activeAnimations.delete(t);
|
|
@@ -574,28 +564,28 @@ class Jt {
|
|
|
574
564
|
function st(n, t, e) {
|
|
575
565
|
return n + (t - n) * e;
|
|
576
566
|
}
|
|
577
|
-
function
|
|
567
|
+
function Kt(n, t, e, i) {
|
|
578
568
|
const { overshoot: o, bounces: a, decayRatio: c } = i, s = e.x - t.x, h = e.y - t.y, l = Qt(a, c);
|
|
579
|
-
let
|
|
580
|
-
for (let
|
|
581
|
-
if (n <= l[
|
|
582
|
-
r =
|
|
569
|
+
let u = 0, r = 0, d = 1, m = o, b = !1;
|
|
570
|
+
for (let g = 0; g < l.length; g++)
|
|
571
|
+
if (n <= l[g].time) {
|
|
572
|
+
r = g === 0 ? 0 : l[g - 1].time, d = l[g].time, m = l[g].overshoot, b = l[g].isOvershoot;
|
|
583
573
|
break;
|
|
584
574
|
}
|
|
585
575
|
const p = (n - r) / (d - r);
|
|
586
576
|
if (b)
|
|
587
|
-
|
|
577
|
+
u = 1 + m * gt(p);
|
|
588
578
|
else if (r === 0)
|
|
589
|
-
|
|
579
|
+
u = gt(p);
|
|
590
580
|
else {
|
|
591
|
-
const
|
|
592
|
-
(
|
|
593
|
-
), f = 1 + ((
|
|
594
|
-
|
|
581
|
+
const g = l.find(
|
|
582
|
+
(v, w) => v.time > r && w > 0 && l[w - 1].isOvershoot
|
|
583
|
+
), f = 1 + ((g == null ? void 0 : g.overshoot) || m);
|
|
584
|
+
u = st(f, 1, gt(p));
|
|
595
585
|
}
|
|
596
586
|
return {
|
|
597
|
-
x: t.x + s *
|
|
598
|
-
y: t.y + h *
|
|
587
|
+
x: t.x + s * u,
|
|
588
|
+
y: t.y + h * u
|
|
599
589
|
};
|
|
600
590
|
}
|
|
601
591
|
function Qt(n, t) {
|
|
@@ -608,57 +598,57 @@ function Qt(n, t) {
|
|
|
608
598
|
i += c, e.push({ time: i, overshoot: o, isOvershoot: !0 }), i += c, e.push({ time: i, overshoot: o * t, isOvershoot: !1 }), o *= t;
|
|
609
599
|
return e.push({ time: 1, overshoot: 0, isOvershoot: !1 }), e;
|
|
610
600
|
}
|
|
611
|
-
function
|
|
612
|
-
const { stiffness: o, damping: a, mass: c, oscillations: s } = i, h = e.x - t.x, l = e.y - t.y,
|
|
601
|
+
function te(n, t, e, i) {
|
|
602
|
+
const { stiffness: o, damping: a, mass: c, oscillations: s } = i, h = e.x - t.x, l = e.y - t.y, u = Math.sqrt(o / c), r = a / (2 * Math.sqrt(o * c));
|
|
613
603
|
let d;
|
|
614
604
|
if (r < 1) {
|
|
615
|
-
const m =
|
|
605
|
+
const m = u * Math.sqrt(1 - r * r), b = Math.exp(-r * u * n * 3), p = Math.cos(m * n * s * Math.PI);
|
|
616
606
|
d = 1 - b * p;
|
|
617
607
|
} else
|
|
618
|
-
d = 1 - Math.exp(-
|
|
608
|
+
d = 1 - Math.exp(-u * n * 3);
|
|
619
609
|
return d = Math.max(0, Math.min(d, 1.3)), {
|
|
620
610
|
x: t.x + h * d,
|
|
621
611
|
y: t.y + l * d
|
|
622
612
|
};
|
|
623
613
|
}
|
|
624
|
-
function
|
|
625
|
-
const { amplitude: o, frequency: a, decay: c, decayRate: s, phase: h } = i, l = e.x - t.x,
|
|
614
|
+
function ee(n, t, e, i) {
|
|
615
|
+
const { amplitude: o, frequency: a, decay: c, decayRate: s, phase: h } = i, l = e.x - t.x, u = e.y - t.y, r = Math.sqrt(l * l + u * u), d = r > 0 ? -u / r : 0, m = r > 0 ? l / r : 1, b = a * Math.PI * 2 * n + h, p = c ? Math.pow(1 - n, s) : 1, g = o * Math.sin(b) * p, f = ie(n);
|
|
626
616
|
return {
|
|
627
|
-
x: st(t.x, e.x, f) +
|
|
628
|
-
y: st(t.y, e.y, f) +
|
|
617
|
+
x: st(t.x, e.x, f) + g * d,
|
|
618
|
+
y: st(t.y, e.y, f) + g * m
|
|
629
619
|
};
|
|
630
620
|
}
|
|
631
|
-
function
|
|
621
|
+
function gt(n) {
|
|
632
622
|
return 1 - (1 - n) * (1 - n);
|
|
633
623
|
}
|
|
634
|
-
function
|
|
624
|
+
function ie(n) {
|
|
635
625
|
return 1 - Math.pow(1 - n, 3);
|
|
636
626
|
}
|
|
637
|
-
function
|
|
627
|
+
function ne(n, t, e) {
|
|
638
628
|
const { amplitude: i, frequency: o, decay: a } = e, c = Math.sin(n * o * Math.PI * 2), s = a ? Math.pow(1 - n, 2) : 1, h = i * c * s;
|
|
639
629
|
return t + h;
|
|
640
630
|
}
|
|
641
|
-
function
|
|
631
|
+
function oe(n, t, e) {
|
|
642
632
|
const { overshoot: i, bounces: o } = e, a = [];
|
|
643
633
|
a.push({ time: 0.5, scale: i });
|
|
644
634
|
let c = i;
|
|
645
635
|
const s = 0.5, l = 0.5 / (o * 2);
|
|
646
|
-
let
|
|
636
|
+
let u = 0.5;
|
|
647
637
|
for (let d = 0; d < o; d++) {
|
|
648
638
|
const m = 1 - (c - 1) * s;
|
|
649
|
-
|
|
639
|
+
u += l, a.push({ time: u, scale: m }), c = 1 + (c - 1) * s * s, u += l, d < o - 1 && a.push({ time: u, scale: c });
|
|
650
640
|
}
|
|
651
641
|
a.push({ time: 1, scale: 1 });
|
|
652
642
|
let r = 1;
|
|
653
643
|
for (let d = 0; d < a.length; d++)
|
|
654
644
|
if (n <= a[d].time) {
|
|
655
|
-
const m = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (n - m) / (a[d].time - m),
|
|
656
|
-
r = b + (a[d].scale - b) *
|
|
645
|
+
const m = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (n - m) / (a[d].time - m), g = gt(p);
|
|
646
|
+
r = b + (a[d].scale - b) * g;
|
|
657
647
|
break;
|
|
658
648
|
}
|
|
659
649
|
return r * t;
|
|
660
650
|
}
|
|
661
|
-
function
|
|
651
|
+
function se(n) {
|
|
662
652
|
const {
|
|
663
653
|
element: t,
|
|
664
654
|
startPosition: e,
|
|
@@ -669,63 +659,63 @@ function oe(n) {
|
|
|
669
659
|
imageHeight: s,
|
|
670
660
|
rotation: h,
|
|
671
661
|
scale: l,
|
|
672
|
-
onComplete:
|
|
662
|
+
onComplete: u,
|
|
673
663
|
rotationConfig: r,
|
|
674
664
|
startRotation: d,
|
|
675
665
|
scaleConfig: m,
|
|
676
666
|
startScale: b
|
|
677
|
-
} = n, p = o.type,
|
|
678
|
-
if ((p === "linear" || p === "arc") && !
|
|
679
|
-
|
|
667
|
+
} = n, p = o.type, g = d !== void 0 && d !== h, f = (r == null ? void 0 : r.mode) === "wobble", v = (r == null ? void 0 : r.wobble) || { amplitude: 15, frequency: 3, decay: !0 }, w = g || f, E = b !== void 0 && b !== l, A = (m == null ? void 0 : m.mode) === "pop", x = (m == null ? void 0 : m.pop) || { overshoot: 1.2, bounces: 1 };
|
|
668
|
+
if ((p === "linear" || p === "arc") && !w && !(E || A)) {
|
|
669
|
+
u && u();
|
|
680
670
|
return;
|
|
681
671
|
}
|
|
682
|
-
const
|
|
683
|
-
function
|
|
684
|
-
const F =
|
|
685
|
-
let
|
|
672
|
+
const j = performance.now(), P = -c / 2, D = -s / 2;
|
|
673
|
+
function U(k) {
|
|
674
|
+
const F = k - j, S = Math.min(F / a, 1);
|
|
675
|
+
let z;
|
|
686
676
|
switch (p) {
|
|
687
677
|
case "bounce": {
|
|
688
|
-
const
|
|
678
|
+
const _ = Xt(
|
|
689
679
|
o.bouncePreset,
|
|
690
680
|
o.bounce
|
|
691
681
|
);
|
|
692
|
-
|
|
682
|
+
z = Kt(S, e, i, _);
|
|
693
683
|
break;
|
|
694
684
|
}
|
|
695
685
|
case "elastic": {
|
|
696
|
-
const
|
|
686
|
+
const _ = Vt(
|
|
697
687
|
o.elasticPreset,
|
|
698
688
|
o.elastic
|
|
699
689
|
);
|
|
700
|
-
|
|
690
|
+
z = te(S, e, i, _);
|
|
701
691
|
break;
|
|
702
692
|
}
|
|
703
693
|
case "wave": {
|
|
704
|
-
const
|
|
694
|
+
const _ = Jt(
|
|
705
695
|
o.wavePreset,
|
|
706
696
|
o.wave
|
|
707
697
|
);
|
|
708
|
-
|
|
698
|
+
z = ee(S, e, i, _);
|
|
709
699
|
break;
|
|
710
700
|
}
|
|
711
701
|
default:
|
|
712
|
-
|
|
713
|
-
x: st(e.x, i.x,
|
|
714
|
-
y: st(e.y, i.y,
|
|
702
|
+
z = {
|
|
703
|
+
x: st(e.x, i.x, S),
|
|
704
|
+
y: st(e.y, i.y, S)
|
|
715
705
|
};
|
|
716
706
|
}
|
|
717
|
-
const
|
|
718
|
-
let
|
|
719
|
-
f ?
|
|
707
|
+
const $ = z.x - i.x, T = z.y - i.y;
|
|
708
|
+
let R;
|
|
709
|
+
f ? R = ne(S, h, v) : g ? R = st(d, h, S) : R = h;
|
|
720
710
|
let M;
|
|
721
|
-
|
|
711
|
+
A ? M = oe(S, l, x) : E ? M = st(b, l, S) : M = l, t.style.transform = `translate(${P}px, ${D}px) translate(${$}px, ${T}px) rotate(${R}deg) scale(${M})`, S < 1 ? requestAnimationFrame(U) : (t.style.transform = `translate(${P}px, ${D}px) rotate(${h}deg) scale(${l})`, u && u());
|
|
722
712
|
}
|
|
723
|
-
requestAnimationFrame(
|
|
713
|
+
requestAnimationFrame(U);
|
|
724
714
|
}
|
|
725
|
-
function
|
|
715
|
+
function ae(n) {
|
|
726
716
|
return n === "bounce" || n === "elastic" || n === "wave";
|
|
727
717
|
}
|
|
728
|
-
const
|
|
718
|
+
const re = {
|
|
729
719
|
radial: "center",
|
|
730
720
|
spiral: "center",
|
|
731
721
|
grid: "top",
|
|
@@ -733,7 +723,7 @@ const ae = {
|
|
|
733
723
|
random: "nearest-edge",
|
|
734
724
|
wave: "left"
|
|
735
725
|
};
|
|
736
|
-
class
|
|
726
|
+
class ce {
|
|
737
727
|
constructor(t, e) {
|
|
738
728
|
this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || It, this.rotationConfig = t.rotation || Et, this.scaleConfig = t.scale || Rt;
|
|
739
729
|
}
|
|
@@ -741,7 +731,7 @@ class re {
|
|
|
741
731
|
* Get the effective start position, considering layout-aware defaults
|
|
742
732
|
*/
|
|
743
733
|
resolveStartPosition() {
|
|
744
|
-
return this.config.start.position ? this.config.start.position :
|
|
734
|
+
return this.config.start.position ? this.config.start.position : re[this.layoutAlgorithm] || "nearest-edge";
|
|
745
735
|
}
|
|
746
736
|
/**
|
|
747
737
|
* Calculate the starting position for an image's entry animation
|
|
@@ -779,7 +769,7 @@ class re {
|
|
|
779
769
|
* Calculate start position from the nearest edge (current default behavior)
|
|
780
770
|
*/
|
|
781
771
|
calculateNearestEdge(t, e, i, o) {
|
|
782
|
-
const a = t.x, c = t.y, s = a, h = i.width - a, l = c,
|
|
772
|
+
const a = t.x, c = t.y, s = a, h = i.width - a, l = c, u = i.height - c, r = Math.min(s, h, l, u);
|
|
783
773
|
let d = t.x, m = t.y;
|
|
784
774
|
return r === s ? d = -(e.width + o) : r === h ? d = i.width + o : r === l ? m = -(e.height + o) : m = i.height + o, { x: d, y: m };
|
|
785
775
|
}
|
|
@@ -837,9 +827,9 @@ class re {
|
|
|
837
827
|
) * p / 2;
|
|
838
828
|
} else
|
|
839
829
|
h = typeof l == "number" ? l : 500;
|
|
840
|
-
let
|
|
841
|
-
s === "even" ?
|
|
842
|
-
const r = i.width / 2, d = i.height / 2, m = r + Math.cos(
|
|
830
|
+
let u;
|
|
831
|
+
s === "even" ? u = o / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
832
|
+
const r = i.width / 2, d = i.height / 2, m = r + Math.cos(u) * h, b = d + Math.sin(u) * h;
|
|
843
833
|
return { x: m, y: b };
|
|
844
834
|
}
|
|
845
835
|
/**
|
|
@@ -860,8 +850,8 @@ class re {
|
|
|
860
850
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
861
851
|
*/
|
|
862
852
|
buildStartTransform(t, e, i, o, a, c, s, h) {
|
|
863
|
-
const l = t.x - e.x,
|
|
864
|
-
return t.useScale ? `${p} translate(${l}px, ${
|
|
853
|
+
const l = t.x - e.x, u = t.y - e.y, r = s !== void 0 ? s : i, d = h !== void 0 ? h : o, m = a !== void 0 ? -a / 2 : 0, b = c !== void 0 ? -c / 2 : 0, p = a !== void 0 ? `translate(${m}px, ${b}px)` : "translate(-50%, -50%)";
|
|
854
|
+
return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${r}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${r}deg) scale(${d})`;
|
|
865
855
|
}
|
|
866
856
|
/**
|
|
867
857
|
* Build the final CSS transform string
|
|
@@ -886,7 +876,7 @@ class re {
|
|
|
886
876
|
* Check if the current path type requires JavaScript animation
|
|
887
877
|
*/
|
|
888
878
|
requiresJSAnimation() {
|
|
889
|
-
return
|
|
879
|
+
return ae(this.pathConfig.type);
|
|
890
880
|
}
|
|
891
881
|
/**
|
|
892
882
|
* Get the path configuration
|
|
@@ -1049,8 +1039,8 @@ class re {
|
|
|
1049
1039
|
let s = e;
|
|
1050
1040
|
for (let h = 0; h < c.length; h++)
|
|
1051
1041
|
if (t <= c[h].time) {
|
|
1052
|
-
const l = h === 0 ? 0 : c[h - 1].time,
|
|
1053
|
-
s =
|
|
1042
|
+
const l = h === 0 ? 0 : c[h - 1].time, u = h === 0 ? e : c[h - 1].scale, r = (t - l) / (c[h].time - l), d = this.easeOutQuad(r);
|
|
1043
|
+
s = u + (c[h].scale - u) * d;
|
|
1054
1044
|
break;
|
|
1055
1045
|
}
|
|
1056
1046
|
return s * e;
|
|
@@ -1065,8 +1055,8 @@ class re {
|
|
|
1065
1055
|
const a = 0.5, s = 0.5 / (t * 2);
|
|
1066
1056
|
let h = 0.5;
|
|
1067
1057
|
for (let l = 0; l < t; l++) {
|
|
1068
|
-
const
|
|
1069
|
-
h += s, i.push({ time: h, scale:
|
|
1058
|
+
const u = 1 - (o - 1) * a;
|
|
1059
|
+
h += s, i.push({ time: h, scale: u }), o = 1 + (o - 1) * a * a, h += s, l < t - 1 && i.push({ time: h, scale: o });
|
|
1070
1060
|
}
|
|
1071
1061
|
return i.push({ time: 1, scale: 1 }), i;
|
|
1072
1062
|
}
|
|
@@ -1077,7 +1067,7 @@ class re {
|
|
|
1077
1067
|
return 1 - (1 - t) * (1 - t);
|
|
1078
1068
|
}
|
|
1079
1069
|
}
|
|
1080
|
-
class
|
|
1070
|
+
class le {
|
|
1081
1071
|
constructor(t, e = {}) {
|
|
1082
1072
|
this.config = t, this.imageConfig = e;
|
|
1083
1073
|
}
|
|
@@ -1089,16 +1079,16 @@ class ce {
|
|
|
1089
1079
|
* @returns Array of layout objects with position, rotation, scale
|
|
1090
1080
|
*/
|
|
1091
1081
|
generate(t, e, i = {}) {
|
|
1092
|
-
var x, L,
|
|
1093
|
-
const o = [], { width: a, height: c } = e, s = this.config.spacing.padding, h = i.fixedHeight ??
|
|
1094
|
-
for (let
|
|
1095
|
-
const
|
|
1096
|
-
id:
|
|
1097
|
-
x:
|
|
1098
|
-
y:
|
|
1099
|
-
rotation:
|
|
1082
|
+
var x, L, j, P, D, U, k, F, S;
|
|
1083
|
+
const o = [], { width: a, height: c } = e, s = this.config.spacing.padding, h = i.fixedHeight ?? 200, l = ((x = this.imageConfig.rotation) == null ? void 0 : x.mode) ?? "none", u = ((j = (L = this.imageConfig.rotation) == null ? void 0 : L.range) == null ? void 0 : j.min) ?? -15, r = ((D = (P = this.imageConfig.rotation) == null ? void 0 : P.range) == null ? void 0 : D.max) ?? 15, d = ((k = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : k.min) ?? 1, m = ((S = (F = this.imageConfig.sizing) == null ? void 0 : F.variance) == null ? void 0 : S.max) ?? 1, b = d !== 1 || m !== 1, g = h * 1.5 / 2, f = h / 2, v = a - s - g, w = c - s - f, E = s + g, A = s + f;
|
|
1084
|
+
for (let z = 0; z < t; z++) {
|
|
1085
|
+
const $ = this.random(E, v), T = this.random(A, w), R = l === "random" ? this.random(u, r) : 0, M = b ? this.random(d, m) : 1, _ = h * M, Z = {
|
|
1086
|
+
id: z,
|
|
1087
|
+
x: $,
|
|
1088
|
+
y: T,
|
|
1089
|
+
rotation: R,
|
|
1100
1090
|
scale: M,
|
|
1101
|
-
baseSize:
|
|
1091
|
+
baseSize: _
|
|
1102
1092
|
};
|
|
1103
1093
|
o.push(Z);
|
|
1104
1094
|
}
|
|
@@ -1114,7 +1104,7 @@ class ce {
|
|
|
1114
1104
|
return Math.random() * (e - t) + t;
|
|
1115
1105
|
}
|
|
1116
1106
|
}
|
|
1117
|
-
class
|
|
1107
|
+
class he {
|
|
1118
1108
|
constructor(t, e = {}) {
|
|
1119
1109
|
this.config = t, this.imageConfig = e;
|
|
1120
1110
|
}
|
|
@@ -1126,48 +1116,48 @@ class le {
|
|
|
1126
1116
|
* @returns Array of layout objects with position, rotation, scale
|
|
1127
1117
|
*/
|
|
1128
1118
|
generate(t, e, i = {}) {
|
|
1129
|
-
var L,
|
|
1130
|
-
const o = [], { width: a, height: c } = e, { debugRadials: s } = this.config, h =
|
|
1119
|
+
var L, j, P, D, U, k, F, S, z;
|
|
1120
|
+
const o = [], { width: a, height: c } = e, { debugRadials: s } = this.config, h = i.fixedHeight ?? 200, l = ((L = this.imageConfig.rotation) == null ? void 0 : L.mode) ?? "none", u = ((P = (j = this.imageConfig.rotation) == null ? void 0 : j.range) == null ? void 0 : P.min) ?? -15, r = ((U = (D = this.imageConfig.rotation) == null ? void 0 : D.range) == null ? void 0 : U.max) ?? 15, d = ((F = (k = this.imageConfig.sizing) == null ? void 0 : k.variance) == null ? void 0 : F.min) ?? 1, m = ((z = (S = this.imageConfig.sizing) == null ? void 0 : S.variance) == null ? void 0 : z.max) ?? 1, b = d !== 1 || m !== 1, p = this.config.scaleDecay ?? 0, g = ["green", "blue", "red", "yellow", "orange", "purple"], f = i.fixedHeight ?? h, v = a / 2, w = c / 2, E = Math.ceil(Math.sqrt(t));
|
|
1131
1121
|
if (t > 0) {
|
|
1132
|
-
const
|
|
1122
|
+
const $ = b ? this.random(d, m) : 1, T = f * $;
|
|
1133
1123
|
o.push({
|
|
1134
1124
|
id: 0,
|
|
1135
|
-
x:
|
|
1136
|
-
y:
|
|
1137
|
-
rotation: l === "random" ? this.random(
|
|
1125
|
+
x: v,
|
|
1126
|
+
y: w,
|
|
1127
|
+
rotation: l === "random" ? this.random(u * 0.33, r * 0.33) : 0,
|
|
1138
1128
|
// Less rotation for center
|
|
1139
|
-
scale:
|
|
1129
|
+
scale: $,
|
|
1140
1130
|
baseSize: T,
|
|
1141
1131
|
zIndex: 100,
|
|
1142
1132
|
// Center image is highest
|
|
1143
1133
|
borderColor: s ? "cyan" : void 0
|
|
1144
1134
|
});
|
|
1145
1135
|
}
|
|
1146
|
-
let
|
|
1147
|
-
for (;
|
|
1148
|
-
const
|
|
1149
|
-
if (
|
|
1136
|
+
let A = 1, x = 1;
|
|
1137
|
+
for (; A < t; ) {
|
|
1138
|
+
const $ = x / E, T = p > 0 ? 1 - $ * p * 0.5 : 1, R = x * (f * 0.8), M = R * 1.5, _ = Math.PI * (3 * (M + R) - Math.sqrt((3 * M + R) * (M + 3 * R))), Z = this.estimateWidth(f), B = Math.floor(_ / (Z * 0.7));
|
|
1139
|
+
if (B === 0) {
|
|
1150
1140
|
x++;
|
|
1151
1141
|
continue;
|
|
1152
1142
|
}
|
|
1153
|
-
const
|
|
1154
|
-
for (let
|
|
1155
|
-
const
|
|
1156
|
-
let
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1143
|
+
const X = 2 * Math.PI / B, K = x * (20 * Math.PI / 180);
|
|
1144
|
+
for (let N = 0; N < B && A < t; N++) {
|
|
1145
|
+
const Q = N * X + K, tt = b ? this.random(d, m) : 1, q = T * tt, et = f * q;
|
|
1146
|
+
let Y = v + Math.cos(Q) * M, C = w + Math.sin(Q) * R;
|
|
1147
|
+
const O = this.config.spacing.padding ?? 50, W = et * 1.5 / 2, H = et / 2;
|
|
1148
|
+
Y - W < O ? Y = O + W : Y + W > a - O && (Y = a - O - W), C - H < O ? C = O + H : C + H > c - O && (C = c - O - H);
|
|
1149
|
+
const it = l === "random" ? this.random(u, r) : 0;
|
|
1160
1150
|
o.push({
|
|
1161
|
-
id:
|
|
1162
|
-
x:
|
|
1163
|
-
y:
|
|
1164
|
-
rotation:
|
|
1165
|
-
scale:
|
|
1166
|
-
baseSize:
|
|
1151
|
+
id: A,
|
|
1152
|
+
x: Y,
|
|
1153
|
+
y: C,
|
|
1154
|
+
rotation: it,
|
|
1155
|
+
scale: q,
|
|
1156
|
+
baseSize: et,
|
|
1167
1157
|
zIndex: Math.max(1, 100 - x),
|
|
1168
1158
|
// Outer rings have lower z-index
|
|
1169
|
-
borderColor: s ?
|
|
1170
|
-
}),
|
|
1159
|
+
borderColor: s ? g[(x - 1) % g.length] : void 0
|
|
1160
|
+
}), A++;
|
|
1171
1161
|
}
|
|
1172
1162
|
x++;
|
|
1173
1163
|
}
|
|
@@ -1192,7 +1182,7 @@ class le {
|
|
|
1192
1182
|
return Math.random() * (e - t) + t;
|
|
1193
1183
|
}
|
|
1194
1184
|
}
|
|
1195
|
-
const
|
|
1185
|
+
const de = {
|
|
1196
1186
|
columns: "auto",
|
|
1197
1187
|
rows: "auto",
|
|
1198
1188
|
stagger: "none",
|
|
@@ -1220,7 +1210,7 @@ const he = {
|
|
|
1220
1210
|
{ x: 0, y: 1 }
|
|
1221
1211
|
// down
|
|
1222
1212
|
];
|
|
1223
|
-
class
|
|
1213
|
+
class ue {
|
|
1224
1214
|
constructor(t, e = {}) {
|
|
1225
1215
|
this.config = t, this.imageConfig = e;
|
|
1226
1216
|
}
|
|
@@ -1232,61 +1222,61 @@ class de {
|
|
|
1232
1222
|
* @returns Array of layout objects with position, rotation, scale
|
|
1233
1223
|
*/
|
|
1234
1224
|
generate(t, e, i = {}) {
|
|
1235
|
-
var
|
|
1236
|
-
const o = [], { width: a, height: c } = e, s = { ...
|
|
1225
|
+
var B, X, K, N, Q, tt, q, et, Y;
|
|
1226
|
+
const o = [], { width: a, height: c } = e, s = { ...de, ...this.config.grid }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((B = this.imageConfig.rotation) == null ? void 0 : B.mode) ?? "none", r = ((K = (X = this.imageConfig.sizing) == null ? void 0 : X.variance) == null ? void 0 : K.min) ?? 1, d = ((Q = (N = this.imageConfig.sizing) == null ? void 0 : N.variance) == null ? void 0 : Q.max) ?? 1, m = r !== 1 || d !== 1, b = a - 2 * h, p = c - 2 * h, { columns: g, rows: f } = this.calculateGridDimensions(
|
|
1237
1227
|
t,
|
|
1238
1228
|
b,
|
|
1239
1229
|
p,
|
|
1240
1230
|
l,
|
|
1241
1231
|
s
|
|
1242
|
-
),
|
|
1232
|
+
), v = s.stagger === "row", w = s.stagger === "column", E = v ? g + 0.5 : g, A = w ? f + 0.5 : f, x = (b - s.gap * (g - 1)) / E, L = (p - s.gap * (f - 1)) / A, j = v ? x / 2 : 0, P = w ? L / 2 : 0, D = 1 + s.overlap, U = Math.min(x, L) * D, k = i.fixedHeight ? Math.min(i.fixedHeight, U) : U, F = g * x + (g - 1) * s.gap + j, S = f * L + (f - 1) * s.gap + P, z = h + (b - F) / 2, $ = h + (p - S) / 2, T = g * f, R = s.columns !== "auto" && s.rows !== "auto", M = R && t > T;
|
|
1243
1233
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1244
1234
|
gridConfigColumns: s.columns,
|
|
1245
1235
|
gridConfigRows: s.rows,
|
|
1246
|
-
columns:
|
|
1236
|
+
columns: g,
|
|
1247
1237
|
rows: f,
|
|
1248
|
-
cellCount:
|
|
1249
|
-
hasFixedGrid:
|
|
1238
|
+
cellCount: T,
|
|
1239
|
+
hasFixedGrid: R,
|
|
1250
1240
|
imageCount: t,
|
|
1251
1241
|
isOverflowMode: M
|
|
1252
1242
|
});
|
|
1253
|
-
const
|
|
1243
|
+
const _ = M ? new Array(T).fill(0) : [], Z = Math.min(x, L) * s.overflowOffset;
|
|
1254
1244
|
for (let C = 0; C < t; C++) {
|
|
1255
|
-
let
|
|
1256
|
-
if (M && C >=
|
|
1257
|
-
const J = C -
|
|
1258
|
-
|
|
1245
|
+
let O, G, W = 0;
|
|
1246
|
+
if (M && C >= T) {
|
|
1247
|
+
const J = C - T, V = J % T;
|
|
1248
|
+
W = Math.floor(J / T) + 1, _[V]++, s.fillDirection === "row" ? (O = V % g, G = Math.floor(V / g)) : (G = V % f, O = Math.floor(V / f));
|
|
1259
1249
|
} else
|
|
1260
|
-
s.fillDirection === "row" ? (
|
|
1261
|
-
let
|
|
1262
|
-
if (s.stagger === "row" &&
|
|
1263
|
-
const J = (
|
|
1264
|
-
|
|
1250
|
+
s.fillDirection === "row" ? (O = C % g, G = Math.floor(C / g)) : (G = C % f, O = Math.floor(C / f));
|
|
1251
|
+
let H = z + O * (x + s.gap) + x / 2, it = $ + G * (L + s.gap) + L / 2;
|
|
1252
|
+
if (s.stagger === "row" && G % 2 === 1 ? H += x / 2 : s.stagger === "column" && O % 2 === 1 && (it += L / 2), W > 0) {
|
|
1253
|
+
const J = (W - 1) % Ft.length, V = Ft[J];
|
|
1254
|
+
H += V.x * Z, it += V.y * Z;
|
|
1265
1255
|
}
|
|
1266
1256
|
if (s.jitter > 0) {
|
|
1267
|
-
const J = x / 2 * s.jitter,
|
|
1268
|
-
|
|
1257
|
+
const J = x / 2 * s.jitter, V = L / 2 * s.jitter;
|
|
1258
|
+
H += this.random(-J, J), it += this.random(-V, V);
|
|
1269
1259
|
}
|
|
1270
|
-
let
|
|
1260
|
+
let nt = H, ot = it;
|
|
1271
1261
|
if (!M && s.fillDirection === "row") {
|
|
1272
|
-
const J = t %
|
|
1273
|
-
if (
|
|
1262
|
+
const J = t % g || g;
|
|
1263
|
+
if (G === Math.floor((t - 1) / g) && J < g) {
|
|
1274
1264
|
const At = J * x + (J - 1) * s.gap;
|
|
1275
1265
|
let xt = 0;
|
|
1276
|
-
s.alignment === "center" ? xt = (F - At) / 2 : s.alignment === "end" && (xt = F - At),
|
|
1266
|
+
s.alignment === "center" ? xt = (F - At) / 2 : s.alignment === "end" && (xt = F - At), nt += xt;
|
|
1277
1267
|
}
|
|
1278
1268
|
}
|
|
1279
|
-
const mt = m ? this.random(r, d) : 1, at =
|
|
1280
|
-
|
|
1269
|
+
const mt = m ? this.random(r, d) : 1, at = k * mt, dt = at * 1.5 / 2, ut = at / 2, bt = h + dt, yt = a - h - dt, Ut = h + ut, Pt = c - h - ut;
|
|
1270
|
+
nt = Math.max(bt, Math.min(nt, yt)), ot = Math.max(Ut, Math.min(ot, Pt));
|
|
1281
1271
|
let vt = 0;
|
|
1282
|
-
if (
|
|
1283
|
-
const J = ((q = (
|
|
1284
|
-
s.jitter > 0 ? vt = this.random(J * s.jitter,
|
|
1272
|
+
if (u === "random") {
|
|
1273
|
+
const J = ((q = (tt = this.imageConfig.rotation) == null ? void 0 : tt.range) == null ? void 0 : q.min) ?? -15, V = ((Y = (et = this.imageConfig.rotation) == null ? void 0 : et.range) == null ? void 0 : Y.max) ?? 15;
|
|
1274
|
+
s.jitter > 0 ? vt = this.random(J * s.jitter, V * s.jitter) : vt = this.random(J, V);
|
|
1285
1275
|
}
|
|
1286
1276
|
let wt;
|
|
1287
|
-
M &&
|
|
1277
|
+
M && W > 0 ? wt = 50 - W : wt = M ? 100 + C : C + 1, o.push({
|
|
1288
1278
|
id: C,
|
|
1289
|
-
x:
|
|
1279
|
+
x: nt,
|
|
1290
1280
|
y: ot,
|
|
1291
1281
|
rotation: vt,
|
|
1292
1282
|
scale: mt,
|
|
@@ -1321,14 +1311,14 @@ class de {
|
|
|
1321
1311
|
return Math.random() * (e - t) + t;
|
|
1322
1312
|
}
|
|
1323
1313
|
}
|
|
1324
|
-
const ge = Math.PI * (3 - Math.sqrt(5)),
|
|
1314
|
+
const ge = Math.PI * (3 - Math.sqrt(5)), fe = {
|
|
1325
1315
|
spiralType: "golden",
|
|
1326
1316
|
direction: "counterclockwise",
|
|
1327
1317
|
tightness: 1,
|
|
1328
1318
|
scaleDecay: 0,
|
|
1329
1319
|
startAngle: 0
|
|
1330
1320
|
};
|
|
1331
|
-
class
|
|
1321
|
+
class me {
|
|
1332
1322
|
constructor(t, e = {}) {
|
|
1333
1323
|
this.config = t, this.imageConfig = e;
|
|
1334
1324
|
}
|
|
@@ -1340,37 +1330,37 @@ class fe {
|
|
|
1340
1330
|
* @returns Array of layout objects with position, rotation, scale
|
|
1341
1331
|
*/
|
|
1342
1332
|
generate(t, e, i = {}) {
|
|
1343
|
-
var
|
|
1344
|
-
const o = [], { width: a, height: c } = e, s = { ...
|
|
1333
|
+
var A, x, L, j, P, D, U, k, F;
|
|
1334
|
+
const o = [], { width: a, height: c } = e, s = { ...fe, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", r = ((L = (x = this.imageConfig.rotation) == null ? void 0 : x.range) == null ? void 0 : L.min) ?? -15, d = ((P = (j = this.imageConfig.rotation) == null ? void 0 : j.range) == null ? void 0 : P.max) ?? 15, m = ((U = (D = this.imageConfig.sizing) == null ? void 0 : D.variance) == null ? void 0 : U.min) ?? 1, b = ((F = (k = this.imageConfig.sizing) == null ? void 0 : k.variance) == null ? void 0 : F.max) ?? 1, p = m !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, f = a / 2, v = c / 2, w = Math.min(
|
|
1345
1335
|
f - h - l / 2,
|
|
1346
|
-
|
|
1347
|
-
),
|
|
1348
|
-
for (let
|
|
1349
|
-
let
|
|
1336
|
+
v - h - l / 2
|
|
1337
|
+
), E = s.direction === "clockwise" ? -1 : 1;
|
|
1338
|
+
for (let S = 0; S < t; S++) {
|
|
1339
|
+
let z, $;
|
|
1350
1340
|
if (s.spiralType === "golden")
|
|
1351
|
-
|
|
1341
|
+
z = S * ge * E + s.startAngle, $ = this.calculateGoldenRadius(S, t, w, s.tightness);
|
|
1352
1342
|
else if (s.spiralType === "archimedean") {
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1343
|
+
const H = S * 0.5 * s.tightness;
|
|
1344
|
+
z = H * E + s.startAngle, $ = this.calculateArchimedeanRadius(H, t, w, s.tightness);
|
|
1355
1345
|
} else {
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1346
|
+
const H = S * 0.3 * s.tightness;
|
|
1347
|
+
z = H * E + s.startAngle, $ = this.calculateLogarithmicRadius(H, t, w, s.tightness);
|
|
1358
1348
|
}
|
|
1359
|
-
const T = f + Math.cos(
|
|
1360
|
-
let
|
|
1361
|
-
if (
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
} else
|
|
1365
|
-
const
|
|
1349
|
+
const T = f + Math.cos(z) * $, R = v + Math.sin(z) * $, M = $ / w, _ = g > 0 ? 1 - M * g * 0.5 : 1, Z = p ? this.random(m, b) : 1, B = _ * Z, X = l * B, N = X * 1.5 / 2, Q = X / 2, tt = h + N, q = a - h - N, et = h + Q, Y = c - h - Q, C = Math.max(tt, Math.min(T, q)), O = Math.max(et, Math.min(R, Y));
|
|
1350
|
+
let G = 0;
|
|
1351
|
+
if (u === "random") {
|
|
1352
|
+
const H = z * 180 / Math.PI % 360, it = this.random(r, d);
|
|
1353
|
+
G = s.spiralType === "golden" ? it : H * 0.1 + it * 0.9;
|
|
1354
|
+
} else u === "tangent" && (G = this.calculateSpiralTangent(z, $, s));
|
|
1355
|
+
const W = t - S;
|
|
1366
1356
|
o.push({
|
|
1367
|
-
id:
|
|
1368
|
-
x:
|
|
1369
|
-
y:
|
|
1370
|
-
rotation:
|
|
1371
|
-
scale:
|
|
1372
|
-
baseSize:
|
|
1373
|
-
zIndex:
|
|
1357
|
+
id: S,
|
|
1358
|
+
x: C,
|
|
1359
|
+
y: O,
|
|
1360
|
+
rotation: G,
|
|
1361
|
+
scale: B,
|
|
1362
|
+
baseSize: X,
|
|
1363
|
+
zIndex: W
|
|
1374
1364
|
});
|
|
1375
1365
|
}
|
|
1376
1366
|
return o;
|
|
@@ -1423,7 +1413,7 @@ class fe {
|
|
|
1423
1413
|
return Math.random() * (e - t) + t;
|
|
1424
1414
|
}
|
|
1425
1415
|
}
|
|
1426
|
-
const
|
|
1416
|
+
const pe = {
|
|
1427
1417
|
clusterCount: "auto",
|
|
1428
1418
|
clusterSpread: 150,
|
|
1429
1419
|
clusterSpacing: 200,
|
|
@@ -1431,7 +1421,7 @@ const me = {
|
|
|
1431
1421
|
overlap: 0.3,
|
|
1432
1422
|
distribution: "gaussian"
|
|
1433
1423
|
};
|
|
1434
|
-
class
|
|
1424
|
+
class be {
|
|
1435
1425
|
constructor(t, e = {}) {
|
|
1436
1426
|
this.config = t, this.imageConfig = e;
|
|
1437
1427
|
}
|
|
@@ -1443,49 +1433,49 @@ class pe {
|
|
|
1443
1433
|
* @returns Array of layout objects with position, rotation, scale
|
|
1444
1434
|
*/
|
|
1445
1435
|
generate(t, e, i = {}) {
|
|
1446
|
-
var
|
|
1447
|
-
const o = [], { width: a, height: c } = e, s = { ...
|
|
1436
|
+
var E, A, x, L, j, P, D, U, k;
|
|
1437
|
+
const o = [], { width: a, height: c } = e, s = { ...pe, ...this.config.cluster }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((E = this.imageConfig.rotation) == null ? void 0 : E.mode) ?? "none", r = ((x = (A = this.imageConfig.rotation) == null ? void 0 : A.range) == null ? void 0 : x.min) ?? -15, d = ((j = (L = this.imageConfig.rotation) == null ? void 0 : L.range) == null ? void 0 : j.max) ?? 15, m = ((D = (P = this.imageConfig.sizing) == null ? void 0 : P.variance) == null ? void 0 : D.min) ?? 1, b = ((k = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : k.max) ?? 1, p = m !== 1 || b !== 1, g = this.calculateClusterCount(
|
|
1448
1438
|
t,
|
|
1449
1439
|
s.clusterCount,
|
|
1450
1440
|
a,
|
|
1451
1441
|
c,
|
|
1452
1442
|
s.clusterSpacing
|
|
1453
1443
|
), f = this.generateClusterCenters(
|
|
1454
|
-
|
|
1444
|
+
g,
|
|
1455
1445
|
a,
|
|
1456
1446
|
c,
|
|
1457
1447
|
h,
|
|
1458
1448
|
s
|
|
1459
|
-
),
|
|
1449
|
+
), v = new Array(g).fill(0);
|
|
1460
1450
|
for (let F = 0; F < t; F++)
|
|
1461
|
-
|
|
1462
|
-
let
|
|
1463
|
-
for (let F = 0; F <
|
|
1464
|
-
const
|
|
1465
|
-
for (let
|
|
1466
|
-
let
|
|
1451
|
+
v[F % g]++;
|
|
1452
|
+
let w = 0;
|
|
1453
|
+
for (let F = 0; F < g; F++) {
|
|
1454
|
+
const S = f[F], z = v[F];
|
|
1455
|
+
for (let $ = 0; $ < z; $++) {
|
|
1456
|
+
let T, R;
|
|
1467
1457
|
if (s.distribution === "gaussian")
|
|
1468
|
-
|
|
1458
|
+
T = this.gaussianRandom() * S.spread, R = this.gaussianRandom() * S.spread;
|
|
1469
1459
|
else {
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1460
|
+
const G = this.random(0, Math.PI * 2), W = this.random(0, S.spread);
|
|
1461
|
+
T = Math.cos(G) * W, R = Math.sin(G) * W;
|
|
1472
1462
|
}
|
|
1473
|
-
const M = 1 + s.overlap * 0.5,
|
|
1474
|
-
|
|
1475
|
-
const Z = p ? this.random(m, b) : 1,
|
|
1476
|
-
let
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1479
|
-
const
|
|
1463
|
+
const M = 1 + s.overlap * 0.5, _ = 1 + s.overlap * 0.3;
|
|
1464
|
+
T /= M, R /= M;
|
|
1465
|
+
const Z = p ? this.random(m, b) : 1, B = _ * Z, X = l * B;
|
|
1466
|
+
let K = S.x + T, N = S.y + R;
|
|
1467
|
+
const tt = X * 1.5 / 2, q = X / 2;
|
|
1468
|
+
K = Math.max(h + tt, Math.min(K, a - h - tt)), N = Math.max(h + q, Math.min(N, c - h - q));
|
|
1469
|
+
const et = u === "random" ? this.random(r, d) : 0, C = Math.sqrt(T * T + R * R) / S.spread, O = Math.round((1 - C) * 50) + 1;
|
|
1480
1470
|
o.push({
|
|
1481
|
-
id:
|
|
1482
|
-
x:
|
|
1483
|
-
y:
|
|
1484
|
-
rotation:
|
|
1485
|
-
scale:
|
|
1486
|
-
baseSize:
|
|
1487
|
-
zIndex:
|
|
1488
|
-
}),
|
|
1471
|
+
id: w,
|
|
1472
|
+
x: K,
|
|
1473
|
+
y: N,
|
|
1474
|
+
rotation: et,
|
|
1475
|
+
scale: B,
|
|
1476
|
+
baseSize: X,
|
|
1477
|
+
zIndex: O
|
|
1478
|
+
}), w++;
|
|
1489
1479
|
}
|
|
1490
1480
|
}
|
|
1491
1481
|
return o;
|
|
@@ -1505,21 +1495,21 @@ class pe {
|
|
|
1505
1495
|
* Generate cluster center positions with spacing constraints
|
|
1506
1496
|
*/
|
|
1507
1497
|
generateClusterCenters(t, e, i, o, a) {
|
|
1508
|
-
const c = [], h = o + a.clusterSpread, l = e - o - a.clusterSpread,
|
|
1498
|
+
const c = [], h = o + a.clusterSpread, l = e - o - a.clusterSpread, u = o + a.clusterSpread, r = i - o - a.clusterSpread;
|
|
1509
1499
|
for (let d = 0; d < t; d++) {
|
|
1510
1500
|
let m = null, b = -1;
|
|
1511
1501
|
for (let p = 0; p < 100; p++) {
|
|
1512
|
-
const
|
|
1502
|
+
const g = {
|
|
1513
1503
|
x: this.random(h, l),
|
|
1514
|
-
y: this.random(
|
|
1504
|
+
y: this.random(u, r),
|
|
1515
1505
|
spread: this.calculateClusterSpread(a)
|
|
1516
1506
|
};
|
|
1517
1507
|
let f = 1 / 0;
|
|
1518
|
-
for (const
|
|
1519
|
-
const
|
|
1520
|
-
f = Math.min(f,
|
|
1508
|
+
for (const v of c) {
|
|
1509
|
+
const w = g.x - v.x, E = g.y - v.y, A = Math.sqrt(w * w + E * E);
|
|
1510
|
+
f = Math.min(f, A);
|
|
1521
1511
|
}
|
|
1522
|
-
if ((c.length === 0 || f > b) && (m =
|
|
1512
|
+
if ((c.length === 0 || f > b) && (m = g, b = f), f >= a.clusterSpacing)
|
|
1523
1513
|
break;
|
|
1524
1514
|
}
|
|
1525
1515
|
m && c.push(m);
|
|
@@ -1550,7 +1540,7 @@ class pe {
|
|
|
1550
1540
|
return Math.random() * (e - t) + t;
|
|
1551
1541
|
}
|
|
1552
1542
|
}
|
|
1553
|
-
class
|
|
1543
|
+
class ye {
|
|
1554
1544
|
constructor(t, e = {}) {
|
|
1555
1545
|
this.config = t, this.imageConfig = e;
|
|
1556
1546
|
}
|
|
@@ -1562,30 +1552,30 @@ class be {
|
|
|
1562
1552
|
* @returns Array of layout objects with position, rotation, scale
|
|
1563
1553
|
*/
|
|
1564
1554
|
generate(t, e, i = {}) {
|
|
1565
|
-
var M,
|
|
1566
|
-
const o = [], { width: a, height: c } = e, s =
|
|
1567
|
-
...
|
|
1555
|
+
var M, _, Z, B, X, K, N, Q, tt;
|
|
1556
|
+
const o = [], { width: a, height: c } = e, s = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, l = ((M = this.imageConfig.rotation) == null ? void 0 : M.mode) ?? "none", u = ((Z = (_ = this.imageConfig.rotation) == null ? void 0 : _.range) == null ? void 0 : Z.min) ?? -15, r = ((X = (B = this.imageConfig.rotation) == null ? void 0 : B.range) == null ? void 0 : X.max) ?? 15, d = ((N = (K = this.imageConfig.sizing) == null ? void 0 : K.variance) == null ? void 0 : N.min) ?? 1, m = ((tt = (Q = this.imageConfig.sizing) == null ? void 0 : Q.variance) == null ? void 0 : tt.max) ?? 1, b = d !== 1 || m !== 1, p = i.fixedHeight ?? s, g = {
|
|
1557
|
+
..._t,
|
|
1568
1558
|
...this.config.wave
|
|
1569
|
-
}, { rows: f, amplitude:
|
|
1570
|
-
let
|
|
1571
|
-
for (let q = 0; q < f &&
|
|
1572
|
-
const
|
|
1573
|
-
let
|
|
1574
|
-
|
|
1575
|
-
for (let C = 0; C < x &&
|
|
1576
|
-
const
|
|
1559
|
+
}, { rows: f, amplitude: v, frequency: w, phaseShift: E, synchronization: A } = g, x = Math.ceil(t / f), P = p * 1.5 / 2, D = h + P, U = a - h - P, k = U - D, F = x > 1 ? k / (x - 1) : 0, S = h + v + p / 2, z = c - h - v - p / 2, $ = z - S, T = f > 1 ? $ / (f - 1) : 0;
|
|
1560
|
+
let R = 0;
|
|
1561
|
+
for (let q = 0; q < f && R < t; q++) {
|
|
1562
|
+
const et = f === 1 ? (S + z) / 2 : S + q * T;
|
|
1563
|
+
let Y = 0;
|
|
1564
|
+
A === "offset" ? Y = q * E : A === "alternating" && (Y = q * Math.PI);
|
|
1565
|
+
for (let C = 0; C < x && R < t; C++) {
|
|
1566
|
+
const O = x === 1 ? (D + U) / 2 : D + C * F, G = this.calculateWaveY(O, a, v, w, Y), W = O, H = et + G, it = b ? this.random(d, m) : 1, nt = p * it;
|
|
1577
1567
|
let ot = 0;
|
|
1578
|
-
l === "tangent" ? ot = this.calculateRotation(
|
|
1579
|
-
const at =
|
|
1568
|
+
l === "tangent" ? ot = this.calculateRotation(O, a, v, w, Y) : l === "random" && (ot = this.random(u, r));
|
|
1569
|
+
const at = nt * 1.5 / 2, pt = nt / 2, dt = h + at, ut = a - h - at, bt = h + pt, yt = c - h - pt;
|
|
1580
1570
|
o.push({
|
|
1581
|
-
id:
|
|
1582
|
-
x: Math.max(dt, Math.min(
|
|
1583
|
-
y: Math.max(bt, Math.min(
|
|
1571
|
+
id: R,
|
|
1572
|
+
x: Math.max(dt, Math.min(W, ut)),
|
|
1573
|
+
y: Math.max(bt, Math.min(H, yt)),
|
|
1584
1574
|
rotation: ot,
|
|
1585
|
-
scale:
|
|
1586
|
-
baseSize:
|
|
1587
|
-
zIndex:
|
|
1588
|
-
}),
|
|
1575
|
+
scale: it,
|
|
1576
|
+
baseSize: nt,
|
|
1577
|
+
zIndex: R + 1
|
|
1578
|
+
}), R++;
|
|
1589
1579
|
}
|
|
1590
1580
|
}
|
|
1591
1581
|
return o;
|
|
@@ -1628,9 +1618,9 @@ class be {
|
|
|
1628
1618
|
return Math.random() * (e - t) + t;
|
|
1629
1619
|
}
|
|
1630
1620
|
}
|
|
1631
|
-
class
|
|
1621
|
+
class ve {
|
|
1632
1622
|
constructor(t) {
|
|
1633
|
-
this.config = t.layout, this.imageConfig = t.image, this.
|
|
1623
|
+
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.generator = this.initGenerator();
|
|
1634
1624
|
}
|
|
1635
1625
|
/**
|
|
1636
1626
|
* Initialize the appropriate generator based on config type
|
|
@@ -1639,18 +1629,18 @@ class ye {
|
|
|
1639
1629
|
initGenerator() {
|
|
1640
1630
|
switch (this.config.algorithm) {
|
|
1641
1631
|
case "radial":
|
|
1642
|
-
return new
|
|
1632
|
+
return new he(this.config, this.imageConfig);
|
|
1643
1633
|
case "grid":
|
|
1644
|
-
return new
|
|
1634
|
+
return new ue(this.config, this.imageConfig);
|
|
1645
1635
|
case "spiral":
|
|
1646
|
-
return new
|
|
1636
|
+
return new me(this.config, this.imageConfig);
|
|
1647
1637
|
case "cluster":
|
|
1648
|
-
return new pe(this.config, this.imageConfig);
|
|
1649
|
-
case "wave":
|
|
1650
1638
|
return new be(this.config, this.imageConfig);
|
|
1639
|
+
case "wave":
|
|
1640
|
+
return new ye(this.config, this.imageConfig);
|
|
1651
1641
|
case "random":
|
|
1652
1642
|
default:
|
|
1653
|
-
return new
|
|
1643
|
+
return new le(this.config, this.imageConfig);
|
|
1654
1644
|
}
|
|
1655
1645
|
}
|
|
1656
1646
|
/**
|
|
@@ -1685,48 +1675,62 @@ class ye {
|
|
|
1685
1675
|
* @param newConfig - Updated configuration
|
|
1686
1676
|
*/
|
|
1687
1677
|
updateConfig(t) {
|
|
1688
|
-
t.layout && (Object.assign(this.config, t.layout), t.layout.algorithm && t.layout.algorithm !== this.config.algorithm && (this.generator = this.initGenerator())), t.image && Object.assign(this.imageConfig, t.image)
|
|
1678
|
+
t.layout && (Object.assign(this.config, t.layout), t.layout.algorithm && t.layout.algorithm !== this.config.algorithm && (this.generator = this.initGenerator())), t.image && Object.assign(this.imageConfig, t.image);
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Get responsive breakpoints from layout config
|
|
1682
|
+
*/
|
|
1683
|
+
getBreakpoints() {
|
|
1684
|
+
return this.config.responsive ?? {
|
|
1685
|
+
mobile: { maxWidth: 767 },
|
|
1686
|
+
tablet: { maxWidth: 1199 }
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Resolve breakpoint name based on viewport width
|
|
1691
|
+
*/
|
|
1692
|
+
resolveBreakpoint(t) {
|
|
1693
|
+
const e = this.getBreakpoints();
|
|
1694
|
+
return t <= e.mobile.maxWidth ? "mobile" : t <= e.tablet.maxWidth ? "tablet" : "screen";
|
|
1689
1695
|
}
|
|
1690
1696
|
/**
|
|
1691
1697
|
* Resolve the effective base height based on image config and current viewport
|
|
1692
1698
|
* @param viewportWidth - Current viewport width
|
|
1693
|
-
* @returns Resolved base height or undefined if should auto-calculate
|
|
1699
|
+
* @returns Resolved base height or undefined if should auto-calculate (adaptive mode)
|
|
1694
1700
|
*/
|
|
1695
1701
|
resolveBaseHeight(t) {
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
if (e === void 0)
|
|
1702
|
+
const e = this.imageConfig.sizing;
|
|
1703
|
+
if (!e || e.mode === "adaptive")
|
|
1699
1704
|
return;
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1705
|
+
const i = e.height;
|
|
1706
|
+
if (i === void 0)
|
|
1707
|
+
return;
|
|
1708
|
+
if (typeof i == "number")
|
|
1709
|
+
return i;
|
|
1710
|
+
const o = i, a = this.resolveBreakpoint(t);
|
|
1711
|
+
return a === "mobile" ? o.mobile ?? o.tablet ?? o.screen : a === "tablet" ? o.tablet ?? o.screen ?? o.mobile : o.screen ?? o.tablet ?? o.mobile;
|
|
1704
1712
|
}
|
|
1705
1713
|
/**
|
|
1706
1714
|
* Calculate adaptive image size based on container dimensions and image count
|
|
1707
1715
|
* @param containerBounds - Container dimensions {width, height}
|
|
1708
1716
|
* @param imageCount - Number of images to display
|
|
1709
|
-
* @param
|
|
1717
|
+
* @param maxHeight - Maximum height constraint (upper bound)
|
|
1710
1718
|
* @param viewportWidth - Current viewport width for baseHeight resolution
|
|
1711
1719
|
* @returns Calculated sizing result with height
|
|
1712
1720
|
*/
|
|
1713
1721
|
calculateAdaptiveSize(t, e, i, o) {
|
|
1714
|
-
const a = this.
|
|
1715
|
-
if (c !== void 0)
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
}
|
|
1719
|
-
if (!a || !a.enabled)
|
|
1720
|
-
return { height: i };
|
|
1721
|
-
const { width: s, height: h } = t, { minSize: l, maxSize: g } = a, r = this.config.targetCoverage ?? 0.6, d = this.config.densityFactor ?? 1, p = s * h * r / e;
|
|
1722
|
+
const a = this.imageConfig.sizing, c = this.resolveBaseHeight(o);
|
|
1723
|
+
if (c !== void 0)
|
|
1724
|
+
return { height: c };
|
|
1725
|
+
const s = (a == null ? void 0 : a.minSize) ?? 50, h = (a == null ? void 0 : a.maxSize) ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: r, height: d } = t, p = r * d * l / e;
|
|
1722
1726
|
let f = Math.sqrt(p / 1.4);
|
|
1723
|
-
f *=
|
|
1724
|
-
let
|
|
1725
|
-
if (
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1727
|
+
f *= u, f = Math.min(f, i);
|
|
1728
|
+
let v = this.clamp(f, s, h);
|
|
1729
|
+
if (v === s && f < s) {
|
|
1730
|
+
const w = Math.max(s * 0.05, 20);
|
|
1731
|
+
v = Math.max(w, f);
|
|
1728
1732
|
}
|
|
1729
|
-
return { height:
|
|
1733
|
+
return { height: v };
|
|
1730
1734
|
}
|
|
1731
1735
|
/**
|
|
1732
1736
|
* Utility: Clamp a value between min and max
|
|
@@ -1735,14 +1739,14 @@ class ye {
|
|
|
1735
1739
|
return Math.max(e, Math.min(i, t));
|
|
1736
1740
|
}
|
|
1737
1741
|
}
|
|
1738
|
-
var
|
|
1739
|
-
function ve(n) {
|
|
1740
|
-
return n in St;
|
|
1741
|
-
}
|
|
1742
|
+
var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
|
|
1742
1743
|
function we(n) {
|
|
1743
|
-
return n
|
|
1744
|
+
return n in St;
|
|
1744
1745
|
}
|
|
1745
1746
|
function xe(n) {
|
|
1747
|
+
return n ? we(n) ? St[n] : n : St.md;
|
|
1748
|
+
}
|
|
1749
|
+
function Se(n) {
|
|
1746
1750
|
if (!n) return "";
|
|
1747
1751
|
const t = [];
|
|
1748
1752
|
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)
|
|
@@ -1769,11 +1773,11 @@ function ft(n) {
|
|
|
1769
1773
|
n.borderRadiusTopLeft !== void 0 ? t.borderTopLeftRadius = `${n.borderRadiusTopLeft}px` : s && (t.borderTopLeftRadius = `${s}px`), n.borderRadiusTopRight !== void 0 ? t.borderTopRightRadius = `${n.borderRadiusTopRight}px` : s && (t.borderTopRightRadius = `${s}px`), n.borderRadiusBottomRight !== void 0 ? t.borderBottomRightRadius = `${n.borderRadiusBottomRight}px` : s && (t.borderBottomRightRadius = `${s}px`), n.borderRadiusBottomLeft !== void 0 ? t.borderBottomLeftRadius = `${n.borderRadiusBottomLeft}px` : s && (t.borderBottomLeftRadius = `${s}px`);
|
|
1770
1774
|
} else ((c = n.border) == null ? void 0 : c.radius) !== void 0 && (t.borderRadius = `${n.border.radius}px`);
|
|
1771
1775
|
if (n.borderTop || n.borderRight || n.borderBottom || n.borderLeft) {
|
|
1772
|
-
const s = n.border || {}, h = { ...s, ...n.borderTop }, l = { ...s, ...n.borderRight },
|
|
1773
|
-
t.borderTop = ct(h), t.borderRight = ct(l), t.borderBottom = ct(
|
|
1776
|
+
const s = n.border || {}, h = { ...s, ...n.borderTop }, l = { ...s, ...n.borderRight }, u = { ...s, ...n.borderBottom }, r = { ...s, ...n.borderLeft };
|
|
1777
|
+
t.borderTop = ct(h), t.borderRight = ct(l), t.borderBottom = ct(u), t.borderLeft = ct(r);
|
|
1774
1778
|
} else n.border && (t.border = ct(n.border));
|
|
1775
|
-
n.shadow !== void 0 && (t.boxShadow =
|
|
1776
|
-
const o =
|
|
1779
|
+
n.shadow !== void 0 && (t.boxShadow = xe(n.shadow));
|
|
1780
|
+
const o = Se(n.filter);
|
|
1777
1781
|
if (o && (t.filter = o), 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) {
|
|
1778
1782
|
const s = n.outline.width ?? 0, h = n.outline.style ?? "solid", l = n.outline.color ?? "#000000";
|
|
1779
1783
|
t.outline = `${s}px ${h} ${l}`, n.outline.offset !== void 0 && (t.outlineOffset = `${n.outline.offset}px`);
|
|
@@ -1802,10 +1806,10 @@ const Ct = {
|
|
|
1802
1806
|
UNFOCUSING: 999,
|
|
1803
1807
|
FOCUSING: 1e3
|
|
1804
1808
|
};
|
|
1805
|
-
class
|
|
1809
|
+
class Ie {
|
|
1806
1810
|
constructor(t, e, i) {
|
|
1807
1811
|
var o, a;
|
|
1808
|
-
this.state =
|
|
1812
|
+
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 = ft(i == null ? void 0 : i.default), this.focusedStyles = ft(i == null ? void 0 : i.focused), this.defaultClassName = (o = i == null ? void 0 : i.default) == null ? void 0 : o.className, this.focusedClassName = (a = i == null ? void 0 : i.focused) == null ? void 0 : a.className;
|
|
1809
1813
|
}
|
|
1810
1814
|
/**
|
|
1811
1815
|
* Get current state machine state
|
|
@@ -1817,7 +1821,7 @@ class Se {
|
|
|
1817
1821
|
* Check if any animation is in progress
|
|
1818
1822
|
*/
|
|
1819
1823
|
isAnimating() {
|
|
1820
|
-
return this.state !==
|
|
1824
|
+
return this.state !== I.IDLE && this.state !== I.FOCUSED;
|
|
1821
1825
|
}
|
|
1822
1826
|
/**
|
|
1823
1827
|
* Normalize scalePercent value
|
|
@@ -1865,7 +1869,7 @@ class Se {
|
|
|
1865
1869
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
1866
1870
|
*/
|
|
1867
1871
|
animateWithDimensions(t, e, i, o, a, c, s, h) {
|
|
1868
|
-
const l = this.buildDimensionZoomTransform(e),
|
|
1872
|
+
const l = this.buildDimensionZoomTransform(e), u = this.buildDimensionZoomTransform(i);
|
|
1869
1873
|
return t.style.transition = "none", t.animate(
|
|
1870
1874
|
[
|
|
1871
1875
|
{
|
|
@@ -1874,7 +1878,7 @@ class Se {
|
|
|
1874
1878
|
height: `${a}px`
|
|
1875
1879
|
},
|
|
1876
1880
|
{
|
|
1877
|
-
transform:
|
|
1881
|
+
transform: u,
|
|
1878
1882
|
width: `${c}px`,
|
|
1879
1883
|
height: `${s}px`
|
|
1880
1884
|
}
|
|
@@ -1905,7 +1909,7 @@ class Se {
|
|
|
1905
1909
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1906
1910
|
*/
|
|
1907
1911
|
startFocusAnimation(t, e, i, o, a) {
|
|
1908
|
-
const c = t.style.zIndex || "", s = t.offsetWidth, h = t.offsetHeight, l = this.calculateFocusDimensions(s, h, e),
|
|
1912
|
+
const c = t.style.zIndex || "", s = t.offsetWidth, h = t.offsetHeight, l = this.calculateFocusDimensions(s, h, e), u = this.calculateFocusTransform(e, i);
|
|
1909
1913
|
this.applyFocusedStyling(t, Ct.FOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1910
1914
|
const r = o ?? {
|
|
1911
1915
|
x: 0,
|
|
@@ -1916,25 +1920,25 @@ class Se {
|
|
|
1916
1920
|
}, d = (a == null ? void 0 : a.width) ?? s, m = (a == null ? void 0 : a.height) ?? h, b = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
|
|
1917
1921
|
t,
|
|
1918
1922
|
r,
|
|
1919
|
-
|
|
1923
|
+
u,
|
|
1920
1924
|
d,
|
|
1921
1925
|
m,
|
|
1922
1926
|
l.width,
|
|
1923
1927
|
l.height,
|
|
1924
1928
|
b
|
|
1925
|
-
),
|
|
1929
|
+
), g = {
|
|
1926
1930
|
id: `focus-${Date.now()}`,
|
|
1927
1931
|
element: t,
|
|
1928
1932
|
animation: p,
|
|
1929
1933
|
fromState: r,
|
|
1930
|
-
toState:
|
|
1934
|
+
toState: u,
|
|
1931
1935
|
startTime: performance.now(),
|
|
1932
1936
|
duration: b
|
|
1933
1937
|
};
|
|
1934
1938
|
return this.focusData = {
|
|
1935
1939
|
element: t,
|
|
1936
1940
|
originalState: i,
|
|
1937
|
-
focusTransform:
|
|
1941
|
+
focusTransform: u,
|
|
1938
1942
|
originalZIndex: c,
|
|
1939
1943
|
originalWidth: s,
|
|
1940
1944
|
originalHeight: h,
|
|
@@ -1943,7 +1947,7 @@ class Se {
|
|
|
1943
1947
|
}, {
|
|
1944
1948
|
element: t,
|
|
1945
1949
|
originalState: i,
|
|
1946
|
-
animationHandle:
|
|
1950
|
+
animationHandle: g,
|
|
1947
1951
|
direction: "in",
|
|
1948
1952
|
originalWidth: s,
|
|
1949
1953
|
originalHeight: h
|
|
@@ -1955,22 +1959,22 @@ class Se {
|
|
|
1955
1959
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1956
1960
|
*/
|
|
1957
1961
|
startUnfocusAnimation(t, e, i, o) {
|
|
1958
|
-
var b, p,
|
|
1962
|
+
var b, p, g, f, v;
|
|
1959
1963
|
t.style.zIndex = String(Ct.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1960
|
-
const a = i ?? ((b = this.focusData) == null ? void 0 : b.focusTransform) ?? { x: 0, y: 0, rotation: 0, scale: 1 }, c = (o == null ? void 0 : o.width) ?? ((p = this.focusData) == null ? void 0 : p.focusWidth) ?? t.offsetWidth, s = (o == null ? void 0 : o.height) ?? ((
|
|
1964
|
+
const a = i ?? ((b = this.focusData) == null ? void 0 : b.focusTransform) ?? { x: 0, y: 0, rotation: 0, scale: 1 }, c = (o == null ? void 0 : o.width) ?? ((p = this.focusData) == null ? void 0 : p.focusWidth) ?? t.offsetWidth, s = (o == null ? void 0 : o.height) ?? ((g = this.focusData) == null ? void 0 : g.focusHeight) ?? t.offsetHeight, h = {
|
|
1961
1965
|
x: 0,
|
|
1962
1966
|
y: 0,
|
|
1963
1967
|
rotation: e.rotation,
|
|
1964
1968
|
scale: 1
|
|
1965
1969
|
// No scale - using dimensions
|
|
1966
|
-
}, l = ((f = this.focusData) == null ? void 0 : f.originalWidth) ?? t.offsetWidth,
|
|
1970
|
+
}, l = ((f = this.focusData) == null ? void 0 : f.originalWidth) ?? t.offsetWidth, u = ((v = this.focusData) == null ? void 0 : v.originalHeight) ?? t.offsetHeight, r = this.config.animationDuration ?? 600, d = this.animateWithDimensions(
|
|
1967
1971
|
t,
|
|
1968
1972
|
a,
|
|
1969
1973
|
h,
|
|
1970
1974
|
c,
|
|
1971
1975
|
s,
|
|
1972
1976
|
l,
|
|
1973
|
-
|
|
1977
|
+
u,
|
|
1974
1978
|
r
|
|
1975
1979
|
), m = {
|
|
1976
1980
|
id: `unfocus-${Date.now()}`,
|
|
@@ -1987,7 +1991,7 @@ class Se {
|
|
|
1987
1991
|
animationHandle: m,
|
|
1988
1992
|
direction: "out",
|
|
1989
1993
|
originalWidth: l,
|
|
1990
|
-
originalHeight:
|
|
1994
|
+
originalHeight: u
|
|
1991
1995
|
};
|
|
1992
1996
|
}
|
|
1993
1997
|
/**
|
|
@@ -2012,36 +2016,36 @@ class Se {
|
|
|
2012
2016
|
* Implements cross-animation when swapping focus
|
|
2013
2017
|
*/
|
|
2014
2018
|
async focusImage(t, e, i) {
|
|
2015
|
-
var a, c, s, h, l,
|
|
2016
|
-
if (this.currentFocus === t && this.state ===
|
|
2019
|
+
var a, c, s, h, l, u, r, d, m, b, p, g;
|
|
2020
|
+
if (this.currentFocus === t && this.state === I.FOCUSED)
|
|
2017
2021
|
return this.unfocusImage();
|
|
2018
|
-
if (((a = this.incoming) == null ? void 0 : a.element) === t && this.state ===
|
|
2019
|
-
const f = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0),
|
|
2022
|
+
if (((a = this.incoming) == null ? void 0 : a.element) === t && this.state === I.FOCUSING) {
|
|
2023
|
+
const f = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), v = {
|
|
2020
2024
|
x: f.x,
|
|
2021
2025
|
y: f.y,
|
|
2022
2026
|
rotation: f.rotation,
|
|
2023
2027
|
scale: 1
|
|
2024
2028
|
// No scale transform - using dimensions
|
|
2025
|
-
},
|
|
2029
|
+
}, w = {
|
|
2026
2030
|
width: t.offsetWidth,
|
|
2027
2031
|
height: t.offsetHeight
|
|
2028
2032
|
};
|
|
2029
2033
|
this.outgoing = this.startUnfocusAnimation(
|
|
2030
2034
|
t,
|
|
2031
2035
|
this.incoming.originalState,
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
), this.incoming = null, this.state =
|
|
2036
|
+
v,
|
|
2037
|
+
w
|
|
2038
|
+
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, ((c = this.focusData) == null ? void 0 : c.originalZIndex) || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2035
2039
|
return;
|
|
2036
2040
|
}
|
|
2037
2041
|
const o = ++this.focusGeneration;
|
|
2038
2042
|
switch (this.state) {
|
|
2039
|
-
case
|
|
2040
|
-
if (this.state =
|
|
2041
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2043
|
+
case I.IDLE:
|
|
2044
|
+
if (this.state = I.FOCUSING, this.incoming = this.startFocusAnimation(t, e, i), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
|
|
2045
|
+
this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2042
2046
|
break;
|
|
2043
|
-
case
|
|
2044
|
-
if (this.state =
|
|
2047
|
+
case I.FOCUSED:
|
|
2048
|
+
if (this.state = I.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2045
2049
|
this.currentFocus,
|
|
2046
2050
|
this.focusData.originalState
|
|
2047
2051
|
)), this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
@@ -2049,44 +2053,44 @@ class Se {
|
|
|
2049
2053
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2050
2054
|
]), this.focusGeneration !== o)
|
|
2051
2055
|
return;
|
|
2052
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((s = this.outgoing.originalState.zIndex) == null ? void 0 : s.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2056
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((s = this.outgoing.originalState.zIndex) == null ? void 0 : s.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2053
2057
|
break;
|
|
2054
|
-
case
|
|
2058
|
+
case I.FOCUSING:
|
|
2055
2059
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2056
2060
|
this.incoming.element,
|
|
2057
2061
|
this.incoming.originalState,
|
|
2058
2062
|
((h = this.focusData) == null ? void 0 : h.originalZIndex) || "",
|
|
2059
2063
|
(l = this.focusData) == null ? void 0 : l.originalWidth,
|
|
2060
|
-
(
|
|
2064
|
+
(u = this.focusData) == null ? void 0 : u.originalHeight
|
|
2061
2065
|
), this.incoming = null), this.incoming = this.startFocusAnimation(t, e, i), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
|
|
2062
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2066
|
+
this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2063
2067
|
break;
|
|
2064
|
-
case
|
|
2065
|
-
if (this.state =
|
|
2068
|
+
case I.UNFOCUSING:
|
|
2069
|
+
if (this.state = I.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
2066
2070
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2067
2071
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2068
2072
|
]), this.focusGeneration !== o) return;
|
|
2069
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((r = this.outgoing.originalState.zIndex) == null ? void 0 : r.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2073
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((r = this.outgoing.originalState.zIndex) == null ? void 0 : r.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2070
2074
|
break;
|
|
2071
|
-
case
|
|
2075
|
+
case I.CROSS_ANIMATING:
|
|
2072
2076
|
if (((d = this.incoming) == null ? void 0 : d.element) === t)
|
|
2073
2077
|
return;
|
|
2074
2078
|
if (((m = this.outgoing) == null ? void 0 : m.element) === t) {
|
|
2075
|
-
const f = this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !0),
|
|
2079
|
+
const f = this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !0), v = {
|
|
2076
2080
|
x: f.x,
|
|
2077
2081
|
y: f.y,
|
|
2078
2082
|
rotation: f.rotation,
|
|
2079
2083
|
scale: 1
|
|
2080
2084
|
// No scale - using dimensions
|
|
2081
|
-
},
|
|
2085
|
+
}, w = {
|
|
2082
2086
|
width: t.offsetWidth,
|
|
2083
2087
|
height: t.offsetHeight
|
|
2084
2088
|
};
|
|
2085
2089
|
if (this.incoming) {
|
|
2086
|
-
const
|
|
2087
|
-
x:
|
|
2088
|
-
y:
|
|
2089
|
-
rotation:
|
|
2090
|
+
const E = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), A = {
|
|
2091
|
+
x: E.x,
|
|
2092
|
+
y: E.y,
|
|
2093
|
+
rotation: E.rotation,
|
|
2090
2094
|
scale: 1
|
|
2091
2095
|
// No scale - using dimensions
|
|
2092
2096
|
}, x = {
|
|
@@ -2096,16 +2100,16 @@ class Se {
|
|
|
2096
2100
|
this.outgoing = this.startUnfocusAnimation(
|
|
2097
2101
|
this.incoming.element,
|
|
2098
2102
|
this.incoming.originalState,
|
|
2099
|
-
|
|
2103
|
+
A,
|
|
2100
2104
|
x
|
|
2101
2105
|
);
|
|
2102
2106
|
} else
|
|
2103
2107
|
this.outgoing = null;
|
|
2104
|
-
if (this.incoming = this.startFocusAnimation(t, e, i,
|
|
2108
|
+
if (this.incoming = this.startFocusAnimation(t, e, i, v, w), await Promise.all([
|
|
2105
2109
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2106
2110
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2107
2111
|
]), this.focusGeneration !== o) return;
|
|
2108
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((b = this.outgoing.originalState.zIndex) == null ? void 0 : b.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2112
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((b = this.outgoing.originalState.zIndex) == null ? void 0 : b.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2109
2113
|
return;
|
|
2110
2114
|
}
|
|
2111
2115
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2115,28 +2119,28 @@ class Se {
|
|
|
2115
2119
|
this.outgoing.originalWidth,
|
|
2116
2120
|
this.outgoing.originalHeight
|
|
2117
2121
|
), this.outgoing = null), this.incoming) {
|
|
2118
|
-
const f = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0),
|
|
2122
|
+
const f = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), v = {
|
|
2119
2123
|
x: f.x,
|
|
2120
2124
|
y: f.y,
|
|
2121
2125
|
rotation: f.rotation,
|
|
2122
2126
|
scale: 1
|
|
2123
2127
|
// No scale - using dimensions
|
|
2124
|
-
},
|
|
2128
|
+
}, w = {
|
|
2125
2129
|
width: this.incoming.element.offsetWidth,
|
|
2126
2130
|
height: this.incoming.element.offsetHeight
|
|
2127
2131
|
};
|
|
2128
2132
|
this.outgoing = this.startUnfocusAnimation(
|
|
2129
2133
|
this.incoming.element,
|
|
2130
2134
|
this.incoming.originalState,
|
|
2131
|
-
|
|
2132
|
-
|
|
2135
|
+
v,
|
|
2136
|
+
w
|
|
2133
2137
|
);
|
|
2134
2138
|
}
|
|
2135
2139
|
if (this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
2136
2140
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2137
2141
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2138
2142
|
]), this.focusGeneration !== o) return;
|
|
2139
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((
|
|
2143
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((g = this.outgoing.originalState.zIndex) == null ? void 0 : g.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2140
2144
|
break;
|
|
2141
2145
|
}
|
|
2142
2146
|
}
|
|
@@ -2147,14 +2151,14 @@ class Se {
|
|
|
2147
2151
|
var a, c, s;
|
|
2148
2152
|
const t = ++this.focusGeneration;
|
|
2149
2153
|
if (!this.currentFocus || !this.focusData) {
|
|
2150
|
-
if (this.incoming && this.state ===
|
|
2154
|
+
if (this.incoming && this.state === I.FOCUSING) {
|
|
2151
2155
|
const h = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), l = {
|
|
2152
2156
|
x: h.x,
|
|
2153
2157
|
y: h.y,
|
|
2154
2158
|
rotation: h.rotation,
|
|
2155
2159
|
scale: 1
|
|
2156
2160
|
// No scale - using dimensions
|
|
2157
|
-
},
|
|
2161
|
+
}, u = {
|
|
2158
2162
|
width: this.incoming.element.offsetWidth,
|
|
2159
2163
|
height: this.incoming.element.offsetHeight
|
|
2160
2164
|
};
|
|
@@ -2162,38 +2166,38 @@ class Se {
|
|
|
2162
2166
|
this.incoming.element,
|
|
2163
2167
|
this.incoming.originalState,
|
|
2164
2168
|
l,
|
|
2165
|
-
|
|
2166
|
-
), this.incoming = null, this.state =
|
|
2167
|
-
this.removeFocusedStyling(this.outgoing.element, ((a = this.focusData) == null ? void 0 : a.originalZIndex) || ""), this.outgoing = null, this.focusData = null, this.state =
|
|
2169
|
+
u
|
|
2170
|
+
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2171
|
+
this.removeFocusedStyling(this.outgoing.element, ((a = this.focusData) == null ? void 0 : a.originalZIndex) || ""), this.outgoing = null, this.focusData = null, this.state = I.IDLE;
|
|
2168
2172
|
}
|
|
2169
2173
|
return;
|
|
2170
2174
|
}
|
|
2171
|
-
if (this.state ===
|
|
2175
|
+
if (this.state === I.CROSS_ANIMATING && this.incoming) {
|
|
2172
2176
|
const h = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), l = {
|
|
2173
2177
|
x: h.x,
|
|
2174
2178
|
y: h.y,
|
|
2175
2179
|
rotation: h.rotation,
|
|
2176
2180
|
scale: 1
|
|
2177
2181
|
// No scale - using dimensions
|
|
2178
|
-
},
|
|
2182
|
+
}, u = {
|
|
2179
2183
|
width: this.incoming.element.offsetWidth,
|
|
2180
2184
|
height: this.incoming.element.offsetHeight
|
|
2181
2185
|
}, r = this.startUnfocusAnimation(
|
|
2182
2186
|
this.incoming.element,
|
|
2183
2187
|
this.incoming.originalState,
|
|
2184
2188
|
l,
|
|
2185
|
-
|
|
2189
|
+
u
|
|
2186
2190
|
);
|
|
2187
2191
|
if (await Promise.all([
|
|
2188
2192
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2189
2193
|
this.waitForAnimation(r.animationHandle)
|
|
2190
2194
|
]), this.focusGeneration !== t) return;
|
|
2191
|
-
this.outgoing && this.removeFocusedStyling(this.outgoing.element, ((c = this.outgoing.originalState.zIndex) == null ? void 0 : c.toString()) || ""), this.removeFocusedStyling(r.element, ((s = this.incoming.originalState.zIndex) == null ? void 0 : s.toString()) || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state =
|
|
2195
|
+
this.outgoing && this.removeFocusedStyling(this.outgoing.element, ((c = this.outgoing.originalState.zIndex) == null ? void 0 : c.toString()) || ""), this.removeFocusedStyling(r.element, ((s = this.incoming.originalState.zIndex) == null ? void 0 : s.toString()) || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2192
2196
|
return;
|
|
2193
2197
|
}
|
|
2194
|
-
this.state =
|
|
2198
|
+
this.state = I.UNFOCUSING;
|
|
2195
2199
|
const e = this.currentFocus, i = this.focusData.originalState, o = this.focusData.originalZIndex;
|
|
2196
|
-
this.outgoing = this.startUnfocusAnimation(e, i), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(e, o), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state =
|
|
2200
|
+
this.outgoing = this.startUnfocusAnimation(e, i), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(e, o), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE);
|
|
2197
2201
|
}
|
|
2198
2202
|
/**
|
|
2199
2203
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2211,7 +2215,7 @@ class Se {
|
|
|
2211
2215
|
* Check if an image is currently focused (stable state)
|
|
2212
2216
|
*/
|
|
2213
2217
|
isFocused(t) {
|
|
2214
|
-
return this.currentFocus === t && this.state ===
|
|
2218
|
+
return this.currentFocus === t && this.state === I.FOCUSED;
|
|
2215
2219
|
}
|
|
2216
2220
|
/**
|
|
2217
2221
|
* Check if an image is the target of current focus animation
|
|
@@ -2252,10 +2256,10 @@ class Se {
|
|
|
2252
2256
|
this.focusData.originalZIndex,
|
|
2253
2257
|
this.focusData.originalWidth,
|
|
2254
2258
|
this.focusData.originalHeight
|
|
2255
|
-
), this.state =
|
|
2259
|
+
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2256
2260
|
}
|
|
2257
2261
|
}
|
|
2258
|
-
class
|
|
2262
|
+
class Ee {
|
|
2259
2263
|
constructor(t = {}) {
|
|
2260
2264
|
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)
|
|
2261
2265
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2351,10 +2355,10 @@ class Ie {
|
|
|
2351
2355
|
if (!s.ok)
|
|
2352
2356
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2353
2357
|
const l = (await s.json()).files.filter(
|
|
2354
|
-
(
|
|
2358
|
+
(u) => u.mimeType.startsWith("image/") && e.isAllowed(u.name)
|
|
2355
2359
|
);
|
|
2356
|
-
return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((
|
|
2357
|
-
i.push(`https://lh3.googleusercontent.com/d/${
|
|
2360
|
+
return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
|
|
2361
|
+
i.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2358
2362
|
}), i;
|
|
2359
2363
|
}
|
|
2360
2364
|
/**
|
|
@@ -2422,13 +2426,13 @@ class Ie {
|
|
|
2422
2426
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2423
2427
|
const h = await s.json(), l = h.files.filter(
|
|
2424
2428
|
(r) => r.mimeType.startsWith("image/") && e.isAllowed(r.name)
|
|
2425
|
-
),
|
|
2429
|
+
), u = h.files.filter(
|
|
2426
2430
|
(r) => r.mimeType === "application/vnd.google-apps.folder"
|
|
2427
2431
|
);
|
|
2428
|
-
this.log(`Found ${h.files.length} total items in folder ${t}`), h.files.forEach((r) => this.log(` - File: ${r.name} (${r.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${
|
|
2432
|
+
this.log(`Found ${h.files.length} total items in folder ${t}`), h.files.forEach((r) => this.log(` - File: ${r.name} (${r.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), l.forEach((r) => {
|
|
2429
2433
|
i.push(`https://lh3.googleusercontent.com/d/${r.id}=s1600`), this.log(`Added file: ${r.name}`);
|
|
2430
2434
|
});
|
|
2431
|
-
for (const r of
|
|
2435
|
+
for (const r of u) {
|
|
2432
2436
|
this.log(`Loading images from subfolder: ${r.name}`);
|
|
2433
2437
|
const d = await this.loadImagesRecursively(r.id, e);
|
|
2434
2438
|
i.push(...d);
|
|
@@ -2448,8 +2452,8 @@ class Ie {
|
|
|
2448
2452
|
if (!o.ok)
|
|
2449
2453
|
throw new Error("Cannot access folder directly (CORS or permissions issue)");
|
|
2450
2454
|
const a = await o.text(), c = /\/file\/d\/([a-zA-Z0-9_-]+)/g, s = [...a.matchAll(c)];
|
|
2451
|
-
return [...new Set(s.map((
|
|
2452
|
-
(
|
|
2455
|
+
return [...new Set(s.map((u) => u[1]))].map(
|
|
2456
|
+
(u) => `https://drive.google.com/uc?export=view&id=${u}`
|
|
2453
2457
|
);
|
|
2454
2458
|
} catch (i) {
|
|
2455
2459
|
throw console.error("Direct loading failed:", i), new Error(
|
|
@@ -2476,7 +2480,7 @@ class Ie {
|
|
|
2476
2480
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2477
2481
|
}
|
|
2478
2482
|
}
|
|
2479
|
-
class
|
|
2483
|
+
class Re {
|
|
2480
2484
|
constructor(t = {}) {
|
|
2481
2485
|
if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.sources = t.sources ?? [], this.debugLogging = t.debugLogging ?? !1, !this.sources || this.sources.length === 0)
|
|
2482
2486
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2636,7 +2640,7 @@ class Ee {
|
|
|
2636
2640
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2637
2641
|
}
|
|
2638
2642
|
}
|
|
2639
|
-
class
|
|
2643
|
+
class Ae {
|
|
2640
2644
|
constructor(t) {
|
|
2641
2645
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
2642
2646
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -2693,7 +2697,7 @@ class Re {
|
|
|
2693
2697
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2694
2698
|
}
|
|
2695
2699
|
}
|
|
2696
|
-
class
|
|
2700
|
+
class ze {
|
|
2697
2701
|
/**
|
|
2698
2702
|
* Create a new ImageFilter
|
|
2699
2703
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2731,16 +2735,63 @@ class Ae {
|
|
|
2731
2735
|
// isAllowedDate(date: Date): boolean
|
|
2732
2736
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2733
2737
|
}
|
|
2734
|
-
|
|
2738
|
+
const Me = `
|
|
2739
|
+
.fbn-ic-gallery {
|
|
2740
|
+
position: relative;
|
|
2741
|
+
width: 100%;
|
|
2742
|
+
height: 100%;
|
|
2743
|
+
overflow: hidden;
|
|
2744
|
+
perspective: 1000px;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
.fbn-ic-image {
|
|
2748
|
+
position: absolute;
|
|
2749
|
+
cursor: pointer;
|
|
2750
|
+
transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2751
|
+
box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2752
|
+
filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2753
|
+
opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2754
|
+
border 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2755
|
+
outline 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2756
|
+
z-index 0s 0.6s;
|
|
2757
|
+
will-change: transform;
|
|
2758
|
+
user-select: none;
|
|
2759
|
+
backface-visibility: hidden;
|
|
2760
|
+
-webkit-backface-visibility: hidden;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
.fbn-ic-image.fbn-ic-focused {
|
|
2764
|
+
z-index: 1000;
|
|
2765
|
+
transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2766
|
+
box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2767
|
+
filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2768
|
+
opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2769
|
+
border 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2770
|
+
outline 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2771
|
+
z-index 0s 0s;
|
|
2772
|
+
will-change: auto;
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
.fbn-ic-hidden {
|
|
2776
|
+
display: none !important;
|
|
2777
|
+
}
|
|
2778
|
+
`;
|
|
2779
|
+
function Te() {
|
|
2780
|
+
if (typeof document > "u") return;
|
|
2781
|
+
const n = "fbn-ic-functional-styles";
|
|
2782
|
+
if (document.getElementById(n)) return;
|
|
2783
|
+
const t = document.createElement("style");
|
|
2784
|
+
t.id = n, t.textContent = Me, document.head.appendChild(t);
|
|
2785
|
+
}
|
|
2786
|
+
class Fe {
|
|
2735
2787
|
constructor(t = {}) {
|
|
2736
2788
|
var i, o, a, c, s, h;
|
|
2737
|
-
this.fullConfig =
|
|
2789
|
+
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.animationEngine = new Zt(this.fullConfig.animation), this.layoutEngine = new ve({
|
|
2738
2790
|
layout: this.fullConfig.layout,
|
|
2739
|
-
image: this.fullConfig.image
|
|
2740
|
-
|
|
2741
|
-
}), this.zoomEngine = new Se(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = ft((i = this.fullConfig.styling) == null ? void 0 : i.default), this.hoverStyles = ft((o = this.fullConfig.styling) == null ? void 0 : o.hover), this.defaultClassName = (c = (a = this.fullConfig.styling) == null ? void 0 : a.default) == null ? void 0 : c.className, this.hoverClassName = (h = (s = this.fullConfig.styling) == null ? void 0 : s.hover) == null ? void 0 : h.className;
|
|
2791
|
+
image: this.fullConfig.image
|
|
2792
|
+
}), this.zoomEngine = new Ie(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = ft((i = this.fullConfig.styling) == null ? void 0 : i.default), this.hoverStyles = ft((o = this.fullConfig.styling) == null ? void 0 : o.hover), this.defaultClassName = (c = (a = this.fullConfig.styling) == null ? void 0 : a.default) == null ? void 0 : c.className, this.hoverClassName = (h = (s = this.fullConfig.styling) == null ? void 0 : s.hover) == null ? void 0 : h.className;
|
|
2742
2793
|
const e = this.fullConfig.animation.entry || y.animation.entry;
|
|
2743
|
-
this.entryAnimationEngine = new
|
|
2794
|
+
this.entryAnimationEngine = new ce(
|
|
2744
2795
|
e,
|
|
2745
2796
|
this.fullConfig.layout.algorithm
|
|
2746
2797
|
), this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
@@ -2752,7 +2803,7 @@ class ze {
|
|
|
2752
2803
|
var i, o;
|
|
2753
2804
|
const t = this.fullConfig.loader.type;
|
|
2754
2805
|
let e;
|
|
2755
|
-
return t === "googleDrive" ? e = (i = this.fullConfig.loader.googleDrive) == null ? void 0 : i.allowedExtensions : e = (o = this.fullConfig.loader.static) == null ? void 0 : o.allowedExtensions, new
|
|
2806
|
+
return t === "googleDrive" ? e = (i = this.fullConfig.loader.googleDrive) == null ? void 0 : i.allowedExtensions : e = (o = this.fullConfig.loader.static) == null ? void 0 : o.allowedExtensions, new ze(e);
|
|
2756
2807
|
}
|
|
2757
2808
|
/**
|
|
2758
2809
|
* Create appropriate image loader based on config
|
|
@@ -2767,18 +2818,18 @@ class ze {
|
|
|
2767
2818
|
const e = t.type;
|
|
2768
2819
|
if (e === "static") {
|
|
2769
2820
|
const i = t.static;
|
|
2770
|
-
return new
|
|
2821
|
+
return new Re(i);
|
|
2771
2822
|
} else if (e === "composite") {
|
|
2772
2823
|
const i = t.composite, o = i.loaders.map(
|
|
2773
2824
|
(a) => this.createLoaderFromConfig(a)
|
|
2774
2825
|
);
|
|
2775
|
-
return new
|
|
2826
|
+
return new Ae({
|
|
2776
2827
|
loaders: o,
|
|
2777
2828
|
debugLogging: i.debugLogging
|
|
2778
2829
|
});
|
|
2779
2830
|
} else {
|
|
2780
2831
|
const i = t.googleDrive;
|
|
2781
|
-
return new
|
|
2832
|
+
return new Ee(i);
|
|
2782
2833
|
}
|
|
2783
2834
|
}
|
|
2784
2835
|
/**
|
|
@@ -2786,7 +2837,7 @@ class ze {
|
|
|
2786
2837
|
*/
|
|
2787
2838
|
async init() {
|
|
2788
2839
|
try {
|
|
2789
|
-
if (this.containerRef)
|
|
2840
|
+
if (Te(), this.containerRef)
|
|
2790
2841
|
this.containerEl = this.containerRef;
|
|
2791
2842
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
2792
2843
|
throw new Error(`Container #${this.containerId} not found`);
|
|
@@ -2836,11 +2887,8 @@ class ze {
|
|
|
2836
2887
|
}, 500));
|
|
2837
2888
|
}
|
|
2838
2889
|
getImageHeight() {
|
|
2839
|
-
const t = window.innerWidth, e = this.fullConfig.layout.sizing.
|
|
2840
|
-
|
|
2841
|
-
if (t >= i.minWidth)
|
|
2842
|
-
return i.height;
|
|
2843
|
-
return 120;
|
|
2890
|
+
const t = window.innerWidth, e = this.fullConfig.layout.responsive, i = this.fullConfig.image.sizing, o = (i == null ? void 0 : i.maxSize) ?? 400;
|
|
2891
|
+
return e ? t <= e.mobile.maxWidth ? Math.min(100, o) : t <= e.tablet.maxWidth ? Math.min(180, o) : Math.min(225, o) : t <= 767 ? Math.min(100, o) : t <= 1199 ? Math.min(180, o) : Math.min(225, o);
|
|
2844
2892
|
}
|
|
2845
2893
|
/**
|
|
2846
2894
|
* Get container bounds for layout calculations
|
|
@@ -2898,21 +2946,21 @@ class ze {
|
|
|
2898
2946
|
}, m = {
|
|
2899
2947
|
x: parseFloat(l.dataset.endX),
|
|
2900
2948
|
y: parseFloat(l.dataset.endY)
|
|
2901
|
-
}, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight),
|
|
2902
|
-
|
|
2949
|
+
}, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), g = parseFloat(l.dataset.rotation), f = parseFloat(l.dataset.scale), v = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : g, w = l.dataset.startScale ? parseFloat(l.dataset.startScale) : f, E = this.entryAnimationEngine.getTiming();
|
|
2950
|
+
se({
|
|
2903
2951
|
element: l,
|
|
2904
2952
|
startPosition: d,
|
|
2905
2953
|
endPosition: m,
|
|
2906
2954
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
2907
|
-
duration:
|
|
2955
|
+
duration: E.duration,
|
|
2908
2956
|
imageWidth: b,
|
|
2909
2957
|
imageHeight: p,
|
|
2910
|
-
rotation:
|
|
2958
|
+
rotation: g,
|
|
2911
2959
|
scale: f,
|
|
2912
2960
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
2913
|
-
startRotation:
|
|
2961
|
+
startRotation: v,
|
|
2914
2962
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
2915
|
-
startScale:
|
|
2963
|
+
startScale: w
|
|
2916
2964
|
});
|
|
2917
2965
|
} else {
|
|
2918
2966
|
const d = l.dataset.finalTransform || "";
|
|
@@ -2954,24 +3002,24 @@ class ze {
|
|
|
2954
3002
|
}, this.fullConfig.animation.queue.interval);
|
|
2955
3003
|
};
|
|
2956
3004
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
2957
|
-
const l = new IntersectionObserver((
|
|
2958
|
-
|
|
3005
|
+
const l = new IntersectionObserver((u) => {
|
|
3006
|
+
u.forEach((r) => {
|
|
2959
3007
|
r.isIntersecting && (h(), l.disconnect());
|
|
2960
3008
|
});
|
|
2961
3009
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
2962
3010
|
l.observe(this.containerEl);
|
|
2963
3011
|
} else
|
|
2964
3012
|
h();
|
|
2965
|
-
this.fullConfig.layout.debugCenters && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), a.forEach((l,
|
|
3013
|
+
this.fullConfig.layout.debugCenters && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), a.forEach((l, u) => {
|
|
2966
3014
|
const r = document.createElement("div");
|
|
2967
3015
|
r.className = "fbn-ic-debug-center", r.style.position = "absolute", r.style.width = "12px", r.style.height = "12px", r.style.borderRadius = "50%", r.style.backgroundColor = "red", r.style.border = "2px solid yellow", r.style.zIndex = "9999", r.style.pointerEvents = "none";
|
|
2968
3016
|
const d = l.x, m = l.y;
|
|
2969
|
-
r.style.left = `${d - 6}px`, r.style.top = `${m - 6}px`, r.title = `Image ${
|
|
2970
|
-
})), t.forEach((l,
|
|
3017
|
+
r.style.left = `${d - 6}px`, r.style.top = `${m - 6}px`, r.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(m)})`, this.containerEl.appendChild(r);
|
|
3018
|
+
})), t.forEach((l, u) => {
|
|
2971
3019
|
var m, b;
|
|
2972
3020
|
const r = document.createElement("img");
|
|
2973
|
-
r.referrerPolicy = "no-referrer", r.classList.add("fbn-ic-image"), r.dataset.imageId = String(
|
|
2974
|
-
const d = a[
|
|
3021
|
+
r.referrerPolicy = "no-referrer", r.classList.add("fbn-ic-image"), r.dataset.imageId = String(u);
|
|
3022
|
+
const d = a[u];
|
|
2975
3023
|
r.style.position = "absolute", r.style.width = "auto", r.style.height = `${e}px`, r.style.left = `${d.x}px`, r.style.top = `${d.y}px`, d.borderColor && !((b = (m = this.fullConfig.styling) == null ? void 0 : m.default) != null && b.border) && (r.style.border = `5px solid ${d.borderColor}`, r.style.boxSizing = "border-box"), d.zIndex && (r.style.zIndex = String(d.zIndex)), lt(r, this.defaultStyles), ht(r, this.defaultClassName), r.addEventListener("mouseenter", () => {
|
|
2976
3024
|
this.hoveredImage = { element: r, layout: d }, this.zoomEngine.isInvolved(r) || (lt(r, this.hoverStyles), ht(r, this.hoverClassName));
|
|
2977
3025
|
}), r.addEventListener("mouseleave", () => {
|
|
@@ -2981,38 +3029,38 @@ class ze {
|
|
|
2981
3029
|
}), r.style.opacity = "0", r.style.transition = this.entryAnimationEngine.getTransitionCSS(), r.onload = () => {
|
|
2982
3030
|
if (o !== this.loadGeneration)
|
|
2983
3031
|
return;
|
|
2984
|
-
const p = r.naturalWidth / r.naturalHeight,
|
|
2985
|
-
r.style.width = `${
|
|
2986
|
-
const f = { x: d.x, y: d.y },
|
|
3032
|
+
const p = r.naturalWidth / r.naturalHeight, g = e * p;
|
|
3033
|
+
r.style.width = `${g}px`;
|
|
3034
|
+
const f = { x: d.x, y: d.y }, v = { width: g, height: e }, w = this.entryAnimationEngine.calculateStartPosition(
|
|
2987
3035
|
f,
|
|
2988
|
-
|
|
3036
|
+
v,
|
|
2989
3037
|
i,
|
|
2990
|
-
|
|
3038
|
+
u,
|
|
2991
3039
|
t.length
|
|
2992
|
-
),
|
|
3040
|
+
), E = this.entryAnimationEngine.calculateStartRotation(d.rotation), A = this.entryAnimationEngine.calculateStartScale(d.scale), x = this.entryAnimationEngine.buildFinalTransform(
|
|
2993
3041
|
d.rotation,
|
|
2994
3042
|
d.scale,
|
|
2995
|
-
|
|
3043
|
+
g,
|
|
2996
3044
|
e
|
|
2997
3045
|
), L = this.entryAnimationEngine.buildStartTransform(
|
|
2998
|
-
|
|
3046
|
+
w,
|
|
2999
3047
|
f,
|
|
3000
3048
|
d.rotation,
|
|
3001
3049
|
d.scale,
|
|
3002
|
-
|
|
3050
|
+
g,
|
|
3003
3051
|
e,
|
|
3004
|
-
|
|
3005
|
-
|
|
3052
|
+
E,
|
|
3053
|
+
A
|
|
3006
3054
|
);
|
|
3007
|
-
this.fullConfig.debug &&
|
|
3055
|
+
this.fullConfig.debug && u < 3 && console.log(`Image ${u}:`, {
|
|
3008
3056
|
finalPosition: f,
|
|
3009
|
-
imageSize:
|
|
3057
|
+
imageSize: v,
|
|
3010
3058
|
left: d.x,
|
|
3011
3059
|
top: d.y,
|
|
3012
3060
|
finalTransform: x,
|
|
3013
|
-
renderedWidth:
|
|
3061
|
+
renderedWidth: g,
|
|
3014
3062
|
renderedHeight: e
|
|
3015
|
-
}), r.style.transform = L, r.dataset.finalTransform = x, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() ||
|
|
3063
|
+
}), r.style.transform = L, r.dataset.finalTransform = x, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== d.rotation || A !== d.scale) && (r.dataset.startX = String(w.x), r.dataset.startY = String(w.y), r.dataset.endX = String(f.x), r.dataset.endY = String(f.y), r.dataset.imageWidth = String(g), r.dataset.imageHeight = String(e), r.dataset.rotation = String(d.rotation), r.dataset.scale = String(d.scale), r.dataset.startRotation = String(E), r.dataset.startScale = String(A)), this.displayQueue.push(r);
|
|
3016
3064
|
}, r.onerror = () => c++, r.src = l;
|
|
3017
3065
|
});
|
|
3018
3066
|
}
|
|
@@ -3051,15 +3099,15 @@ class ze {
|
|
|
3051
3099
|
this.clearImageCloud(), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout);
|
|
3052
3100
|
}
|
|
3053
3101
|
}
|
|
3054
|
-
function
|
|
3102
|
+
function Ce() {
|
|
3055
3103
|
if (typeof document > "u") return;
|
|
3056
3104
|
const n = "fbn-ic-styles";
|
|
3057
3105
|
if (document.getElementById(n)) return;
|
|
3058
3106
|
const t = document.createElement("style");
|
|
3059
3107
|
t.id = n, t.textContent = Ht, document.head.appendChild(t);
|
|
3060
3108
|
}
|
|
3061
|
-
|
|
3062
|
-
function
|
|
3109
|
+
Ce();
|
|
3110
|
+
function Le() {
|
|
3063
3111
|
if (typeof document > "u") {
|
|
3064
3112
|
console.warn("ImageCloud: Document not available (not in browser environment)");
|
|
3065
3113
|
return;
|
|
@@ -3089,17 +3137,17 @@ function Me() {
|
|
|
3089
3137
|
console.error(`ImageCloud: Missing configuration for #${i.id}. Add data-config='{...}' attribute.`);
|
|
3090
3138
|
return;
|
|
3091
3139
|
}
|
|
3092
|
-
new
|
|
3140
|
+
new Fe(a).init().catch((s) => {
|
|
3093
3141
|
console.error("ImageCloud initialization failed:", s);
|
|
3094
3142
|
});
|
|
3095
3143
|
});
|
|
3096
3144
|
};
|
|
3097
3145
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", n) : n();
|
|
3098
3146
|
}
|
|
3099
|
-
|
|
3147
|
+
Le();
|
|
3100
3148
|
export {
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3149
|
+
Fe as ImageCloud,
|
|
3150
|
+
Fe as ImageGallery,
|
|
3151
|
+
Le as autoInitialize
|
|
3104
3152
|
};
|
|
3105
3153
|
//# sourceMappingURL=image-cloud-auto-init.js.map
|