@frybynite/image-cloud 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-cloud-auto-init.js +298 -315
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +671 -688
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +2 -2
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +7 -17
- package/dist/react.d.ts +7 -17
- package/dist/react.js +565 -582
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +7 -17
- package/dist/vue.js +675 -692
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +7 -17
- package/dist/web-component.js +363 -380
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
|
@@ -94,7 +94,7 @@ const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
94
94
|
enabled: !1,
|
|
95
95
|
centers: !1,
|
|
96
96
|
loaders: !1
|
|
97
|
-
}), qt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Bt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Xt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Yt = Object.freeze({ speed: 4e3, direction: "clockwise" }), Dt = Object.freeze({ type: "none" }),
|
|
97
|
+
}), qt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Bt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Xt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Yt = Object.freeze({ speed: 4e3, direction: "clockwise" }), Dt = Object.freeze({ type: "none" }), R = Object.freeze({
|
|
98
98
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
99
99
|
loaders: [],
|
|
100
100
|
// Shared loader settings and debug config
|
|
@@ -178,22 +178,10 @@ const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
178
178
|
}),
|
|
179
179
|
dragging: !0
|
|
180
180
|
}),
|
|
181
|
-
//
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
mobile: 768,
|
|
186
|
-
tablet: void 0,
|
|
187
|
-
// STUB: Not implemented yet
|
|
188
|
-
desktop: void 0
|
|
189
|
-
// STUB: Not implemented yet
|
|
190
|
-
}),
|
|
191
|
-
mobileDetection: () => typeof window > "u" ? !1 : window.innerWidth <= 768
|
|
192
|
-
}),
|
|
193
|
-
ui: Object.freeze({
|
|
194
|
-
showLoadingSpinner: !1,
|
|
195
|
-
showImageCounter: !1
|
|
196
|
-
})
|
|
181
|
+
// UI configuration
|
|
182
|
+
ui: Object.freeze({
|
|
183
|
+
showLoadingSpinner: !1,
|
|
184
|
+
showImageCounter: !1
|
|
197
185
|
}),
|
|
198
186
|
// Image styling
|
|
199
187
|
styling: Mt
|
|
@@ -285,67 +273,62 @@ function Qt(o = {}) {
|
|
|
285
273
|
loaders: n,
|
|
286
274
|
config: r,
|
|
287
275
|
image: Vt(Ft, e),
|
|
288
|
-
layout: { ...
|
|
289
|
-
animation: { ...
|
|
290
|
-
interaction: { ...
|
|
291
|
-
|
|
276
|
+
layout: { ...R.layout },
|
|
277
|
+
animation: { ...R.animation },
|
|
278
|
+
interaction: { ...R.interaction },
|
|
279
|
+
ui: { ...R.ui },
|
|
292
280
|
styling: Jt(Mt, o.styling)
|
|
293
281
|
};
|
|
294
|
-
|
|
295
|
-
...
|
|
282
|
+
o.layout && (s.layout = {
|
|
283
|
+
...R.layout,
|
|
296
284
|
...o.layout
|
|
297
285
|
}, o.layout.responsive && (s.layout.responsive = {
|
|
298
|
-
...
|
|
299
|
-
mobile: o.layout.responsive.mobile ? { ...
|
|
300
|
-
tablet: o.layout.responsive.tablet ? { ...
|
|
286
|
+
...R.layout.responsive,
|
|
287
|
+
mobile: o.layout.responsive.mobile ? { ...R.layout.responsive.mobile, ...o.layout.responsive.mobile } : R.layout.responsive.mobile,
|
|
288
|
+
tablet: o.layout.responsive.tablet ? { ...R.layout.responsive.tablet, ...o.layout.responsive.tablet } : R.layout.responsive.tablet
|
|
301
289
|
}), o.layout.spacing && (s.layout.spacing = {
|
|
302
|
-
...
|
|
290
|
+
...R.layout.spacing,
|
|
303
291
|
...o.layout.spacing
|
|
304
292
|
})), o.animation && (s.animation = {
|
|
305
|
-
...
|
|
293
|
+
...R.animation,
|
|
306
294
|
...o.animation
|
|
307
295
|
}, o.animation.easing && (s.animation.easing = {
|
|
308
|
-
...
|
|
296
|
+
...R.animation.easing,
|
|
309
297
|
...o.animation.easing
|
|
310
298
|
}), o.animation.queue && (s.animation.queue = {
|
|
311
|
-
...
|
|
299
|
+
...R.animation.queue,
|
|
312
300
|
...o.animation.queue
|
|
313
301
|
}), o.animation.entry && (s.animation.entry = {
|
|
314
|
-
...
|
|
302
|
+
...R.animation.entry,
|
|
315
303
|
...o.animation.entry,
|
|
316
304
|
start: o.animation.entry.start ? {
|
|
317
|
-
...
|
|
305
|
+
...R.animation.entry.start,
|
|
318
306
|
...o.animation.entry.start,
|
|
319
|
-
circular: o.animation.entry.start.circular ? { ...
|
|
320
|
-
} :
|
|
321
|
-
timing: o.animation.entry.timing ? { ...
|
|
322
|
-
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } :
|
|
323
|
-
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } :
|
|
324
|
-
scale: o.animation.entry.scale ? { ...wt, ...o.animation.entry.scale } :
|
|
307
|
+
circular: o.animation.entry.start.circular ? { ...R.animation.entry.start.circular, ...o.animation.entry.start.circular } : R.animation.entry.start.circular
|
|
308
|
+
} : R.animation.entry.start,
|
|
309
|
+
timing: o.animation.entry.timing ? { ...R.animation.entry.timing, ...o.animation.entry.timing } : R.animation.entry.timing,
|
|
310
|
+
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : R.animation.entry.path,
|
|
311
|
+
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : R.animation.entry.rotation,
|
|
312
|
+
scale: o.animation.entry.scale ? { ...wt, ...o.animation.entry.scale } : R.animation.entry.scale
|
|
325
313
|
}), o.animation.idle && (s.animation.idle = {
|
|
326
314
|
...Dt,
|
|
327
315
|
...o.animation.idle
|
|
328
316
|
})), o.interaction && (s.interaction = {
|
|
329
|
-
...
|
|
317
|
+
...R.interaction,
|
|
330
318
|
...o.interaction
|
|
331
319
|
}, o.interaction.focus && (s.interaction.focus = {
|
|
332
|
-
...
|
|
320
|
+
...R.interaction.focus,
|
|
333
321
|
...o.interaction.focus
|
|
334
322
|
}), o.interaction.navigation && (s.interaction.navigation = {
|
|
335
|
-
...
|
|
323
|
+
...R.interaction.navigation,
|
|
336
324
|
...o.interaction.navigation
|
|
337
|
-
}))
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
...
|
|
342
|
-
...o.
|
|
343
|
-
|
|
344
|
-
mobileDetection: o.rendering.responsive.mobileDetection ? o.rendering.responsive.mobileDetection : E.rendering.responsive.mobileDetection
|
|
345
|
-
}), o.rendering.ui && (s.rendering.ui = {
|
|
346
|
-
...E.rendering.ui,
|
|
347
|
-
...o.rendering.ui
|
|
348
|
-
})), s.config.debug = {
|
|
325
|
+
}));
|
|
326
|
+
const l = o.rendering?.ui;
|
|
327
|
+
if (l && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), s.ui = {
|
|
328
|
+
...R.ui,
|
|
329
|
+
...l,
|
|
330
|
+
...o.ui
|
|
331
|
+
}, s.config.debug = {
|
|
349
332
|
...Ot,
|
|
350
333
|
...o.config?.debug ?? {}
|
|
351
334
|
}, s.layout.algorithm === "honeycomb" && s.styling) {
|
|
@@ -395,12 +378,12 @@ class ne {
|
|
|
395
378
|
*/
|
|
396
379
|
animateTransformCancellable(t, i, e, n = null, a = null) {
|
|
397
380
|
this.cancelAllAnimations(t);
|
|
398
|
-
const r = n ?? this.config.duration, s = a ?? this.config.easing.default,
|
|
381
|
+
const r = n ?? this.config.duration, s = a ?? this.config.easing.default, l = this.buildTransformString(i), c = this.buildTransformString(e);
|
|
399
382
|
t.style.transition = "none";
|
|
400
383
|
const u = t.animate(
|
|
401
384
|
[
|
|
402
|
-
{ transform:
|
|
403
|
-
{ transform:
|
|
385
|
+
{ transform: l },
|
|
386
|
+
{ transform: c }
|
|
404
387
|
],
|
|
405
388
|
{
|
|
406
389
|
duration: r,
|
|
@@ -418,7 +401,7 @@ class ne {
|
|
|
418
401
|
duration: r
|
|
419
402
|
};
|
|
420
403
|
return this.activeAnimations.set(t, h), u.finished.then(() => {
|
|
421
|
-
t.style.transform =
|
|
404
|
+
t.style.transform = c, this.activeAnimations.delete(t);
|
|
422
405
|
}).catch(() => {
|
|
423
406
|
this.activeAnimations.delete(t);
|
|
424
407
|
}), h;
|
|
@@ -464,8 +447,8 @@ class ne {
|
|
|
464
447
|
const e = getComputedStyle(t).transform;
|
|
465
448
|
if (e === "none" || !e)
|
|
466
449
|
return { x: 0, y: 0, rotation: 0, scale: 1 };
|
|
467
|
-
const n = new DOMMatrix(e), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e,
|
|
468
|
-
return { x: s, y:
|
|
450
|
+
const n = new DOMMatrix(e), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e, l = n.f;
|
|
451
|
+
return { x: s, y: l, rotation: r, scale: a };
|
|
469
452
|
}
|
|
470
453
|
/**
|
|
471
454
|
* Check if an element has an active animation
|
|
@@ -528,11 +511,11 @@ function V(o, t, i) {
|
|
|
528
511
|
return o + (t - o) * i;
|
|
529
512
|
}
|
|
530
513
|
function oe(o, t, i, e) {
|
|
531
|
-
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x,
|
|
514
|
+
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, l = i.y - t.y, c = se(a, r);
|
|
532
515
|
let u = 0, h = 0, d = 1, g = n, b = !1;
|
|
533
|
-
for (let f = 0; f <
|
|
534
|
-
if (o <=
|
|
535
|
-
h = f === 0 ? 0 :
|
|
516
|
+
for (let f = 0; f < c.length; f++)
|
|
517
|
+
if (o <= c[f].time) {
|
|
518
|
+
h = f === 0 ? 0 : c[f - 1].time, d = c[f].time, g = c[f].overshoot, b = c[f].isOvershoot;
|
|
536
519
|
break;
|
|
537
520
|
}
|
|
538
521
|
const p = (o - h) / (d - h);
|
|
@@ -541,14 +524,14 @@ function oe(o, t, i, e) {
|
|
|
541
524
|
else if (h === 0)
|
|
542
525
|
u = ot(p);
|
|
543
526
|
else {
|
|
544
|
-
const m = 1 + (
|
|
545
|
-
(y, w) => y.time > h && w > 0 &&
|
|
527
|
+
const m = 1 + (c.find(
|
|
528
|
+
(y, w) => y.time > h && w > 0 && c[w - 1].isOvershoot
|
|
546
529
|
)?.overshoot || g);
|
|
547
530
|
u = V(m, 1, ot(p));
|
|
548
531
|
}
|
|
549
532
|
return {
|
|
550
533
|
x: t.x + s * u,
|
|
551
|
-
y: t.y +
|
|
534
|
+
y: t.y + l * u
|
|
552
535
|
};
|
|
553
536
|
}
|
|
554
537
|
function se(o, t) {
|
|
@@ -562,7 +545,7 @@ function se(o, t) {
|
|
|
562
545
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
563
546
|
}
|
|
564
547
|
function ae(o, t, i, e) {
|
|
565
|
-
const { stiffness: n, damping: a, mass: r, oscillations: s } = e,
|
|
548
|
+
const { stiffness: n, damping: a, mass: r, oscillations: s } = e, l = i.x - t.x, c = i.y - t.y, u = Math.sqrt(n / r), h = a / (2 * Math.sqrt(n * r));
|
|
566
549
|
let d;
|
|
567
550
|
if (h < 1) {
|
|
568
551
|
const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(g * o * s * Math.PI);
|
|
@@ -570,12 +553,12 @@ function ae(o, t, i, e) {
|
|
|
570
553
|
} else
|
|
571
554
|
d = 1 - Math.exp(-u * o * 3);
|
|
572
555
|
return d = Math.max(0, Math.min(d, 1.3)), {
|
|
573
|
-
x: t.x +
|
|
574
|
-
y: t.y +
|
|
556
|
+
x: t.x + l * d,
|
|
557
|
+
y: t.y + c * d
|
|
575
558
|
};
|
|
576
559
|
}
|
|
577
560
|
function re(o, t, i, e) {
|
|
578
|
-
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase:
|
|
561
|
+
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: l } = e, c = i.x - t.x, u = i.y - t.y, h = Math.sqrt(c * c + u * u), d = h > 0 ? -u / h : 0, g = h > 0 ? c / h : 1, b = a * Math.PI * 2 * o + l, p = r ? Math.pow(1 - o, s) : 1, f = n * Math.sin(b) * p, m = ce(o);
|
|
579
562
|
return {
|
|
580
563
|
x: V(t.x, i.x, m) + f * d,
|
|
581
564
|
y: V(t.y, i.y, m) + f * g
|
|
@@ -588,18 +571,18 @@ function ce(o) {
|
|
|
588
571
|
return 1 - Math.pow(1 - o, 3);
|
|
589
572
|
}
|
|
590
573
|
function le(o, t, i) {
|
|
591
|
-
const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1,
|
|
592
|
-
return t +
|
|
574
|
+
const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, l = e * r * s;
|
|
575
|
+
return t + l;
|
|
593
576
|
}
|
|
594
577
|
function he(o, t, i) {
|
|
595
578
|
const { overshoot: e, bounces: n } = i, a = [];
|
|
596
579
|
a.push({ time: 0.5, scale: e });
|
|
597
580
|
let r = e;
|
|
598
|
-
const s = 0.5,
|
|
581
|
+
const s = 0.5, c = 0.5 / (n * 2);
|
|
599
582
|
let u = 0.5;
|
|
600
583
|
for (let d = 0; d < n; d++) {
|
|
601
584
|
const g = 1 - (r - 1) * s;
|
|
602
|
-
u +=
|
|
585
|
+
u += c, a.push({ time: u, scale: g }), r = 1 + (r - 1) * s * s, u += c, d < n - 1 && a.push({ time: u, scale: r });
|
|
603
586
|
}
|
|
604
587
|
a.push({ time: 1, scale: 1 });
|
|
605
588
|
let h = 1;
|
|
@@ -620,15 +603,15 @@ function de(o) {
|
|
|
620
603
|
duration: a,
|
|
621
604
|
imageWidth: r,
|
|
622
605
|
imageHeight: s,
|
|
623
|
-
rotation:
|
|
624
|
-
scale:
|
|
606
|
+
rotation: l,
|
|
607
|
+
scale: c,
|
|
625
608
|
onComplete: u,
|
|
626
609
|
rotationConfig: h,
|
|
627
610
|
startRotation: d,
|
|
628
611
|
scaleConfig: g,
|
|
629
612
|
startScale: b
|
|
630
|
-
} = o, p = n.type, f = d !== void 0 && d !==
|
|
631
|
-
if ((p === "linear" || p === "arc") && !w && !(v ||
|
|
613
|
+
} = o, p = n.type, f = d !== void 0 && d !== l, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = f || m, v = b !== void 0 && b !== c, S = g?.mode === "pop", x = g?.pop || { overshoot: 1.2, bounces: 1 };
|
|
614
|
+
if ((p === "linear" || p === "arc") && !w && !(v || S)) {
|
|
632
615
|
u && u();
|
|
633
616
|
return;
|
|
634
617
|
}
|
|
@@ -669,9 +652,9 @@ function de(o) {
|
|
|
669
652
|
}
|
|
670
653
|
const G = D.x - e.x, U = D.y - e.y;
|
|
671
654
|
let M;
|
|
672
|
-
m ? M = le(T,
|
|
673
|
-
let
|
|
674
|
-
|
|
655
|
+
m ? M = le(T, l, y) : f ? M = V(d, l, T) : M = l;
|
|
656
|
+
let C;
|
|
657
|
+
S ? C = he(T, c, x) : v ? C = V(b, c, T) : C = c, t.style.transform = `translate(${L}px, ${_}px) translate(${G}px, ${U}px) rotate(${M}deg) scale(${C})`, T < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${l}deg) scale(${c})`, u && u());
|
|
675
658
|
}
|
|
676
659
|
requestAnimationFrame(O);
|
|
677
660
|
}
|
|
@@ -733,9 +716,9 @@ class ge {
|
|
|
733
716
|
* Calculate start position from the nearest edge (current default behavior)
|
|
734
717
|
*/
|
|
735
718
|
calculateNearestEdge(t, i, e, n) {
|
|
736
|
-
const a = t.x, r = t.y, s = a,
|
|
719
|
+
const a = t.x, r = t.y, s = a, l = e.width - a, c = r, u = e.height - r, h = Math.min(s, l, c, u);
|
|
737
720
|
let d = t.x, g = t.y;
|
|
738
|
-
return h === s ? d = -(i.width + n) : h ===
|
|
721
|
+
return h === s ? d = -(i.width + n) : h === l ? d = e.width + n : h === c ? g = -(i.height + n) : g = e.height + n, { x: d, y: g };
|
|
739
722
|
}
|
|
740
723
|
/**
|
|
741
724
|
* Calculate start position from a specific edge
|
|
@@ -782,18 +765,18 @@ class ge {
|
|
|
782
765
|
*/
|
|
783
766
|
calculateCircularPosition(t, i, e, n, a) {
|
|
784
767
|
const r = this.config.start.circular || {}, s = r.distribution || "even";
|
|
785
|
-
let
|
|
786
|
-
const
|
|
787
|
-
if (typeof
|
|
788
|
-
const p = parseFloat(
|
|
789
|
-
|
|
768
|
+
let l;
|
|
769
|
+
const c = r.radius || "120%";
|
|
770
|
+
if (typeof c == "string" && c.endsWith("%")) {
|
|
771
|
+
const p = parseFloat(c) / 100;
|
|
772
|
+
l = Math.sqrt(
|
|
790
773
|
e.width ** 2 + e.height ** 2
|
|
791
774
|
) * p / 2;
|
|
792
775
|
} else
|
|
793
|
-
|
|
776
|
+
l = typeof c == "number" ? c : 500;
|
|
794
777
|
let u;
|
|
795
778
|
s === "even" ? u = n / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
796
|
-
const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) *
|
|
779
|
+
const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * l, b = d + Math.sin(u) * l;
|
|
797
780
|
return { x: g, y: b };
|
|
798
781
|
}
|
|
799
782
|
/**
|
|
@@ -813,9 +796,9 @@ class ge {
|
|
|
813
796
|
* Build a CSS transform string for the start position
|
|
814
797
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
815
798
|
*/
|
|
816
|
-
buildStartTransform(t, i, e, n, a, r, s,
|
|
817
|
-
const
|
|
818
|
-
return t.useScale ? `${p} translate(${
|
|
799
|
+
buildStartTransform(t, i, e, n, a, r, s, l) {
|
|
800
|
+
const c = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = l !== void 0 ? l : n, g = a !== void 0 ? -a / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = a !== void 0 ? `translate(${g}px, ${b}px)` : "translate(-50%, -50%)";
|
|
801
|
+
return t.useScale ? `${p} translate(${c}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${c}px, ${u}px) rotate(${h}deg) scale(${d})`;
|
|
819
802
|
}
|
|
820
803
|
/**
|
|
821
804
|
* Build the final CSS transform string
|
|
@@ -942,8 +925,8 @@ class ge {
|
|
|
942
925
|
amplitude: 15,
|
|
943
926
|
frequency: 3,
|
|
944
927
|
decay: !0
|
|
945
|
-
}, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2),
|
|
946
|
-
return i +
|
|
928
|
+
}, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2), l = r ? Math.pow(1 - t, 2) : 1, c = n * s * l;
|
|
929
|
+
return i + c;
|
|
947
930
|
}
|
|
948
931
|
/**
|
|
949
932
|
* Get the scale configuration
|
|
@@ -1001,10 +984,10 @@ class ge {
|
|
|
1001
984
|
bounces: 1
|
|
1002
985
|
}, { overshoot: n, bounces: a } = e, r = this.generateScaleBounceKeyframes(a, n);
|
|
1003
986
|
let s = i;
|
|
1004
|
-
for (let
|
|
1005
|
-
if (t <= r[
|
|
1006
|
-
const
|
|
1007
|
-
s = u + (r[
|
|
987
|
+
for (let l = 0; l < r.length; l++)
|
|
988
|
+
if (t <= r[l].time) {
|
|
989
|
+
const c = l === 0 ? 0 : r[l - 1].time, u = l === 0 ? i : r[l - 1].scale, h = (t - c) / (r[l].time - c), d = this.easeOutQuad(h);
|
|
990
|
+
s = u + (r[l].scale - u) * d;
|
|
1008
991
|
break;
|
|
1009
992
|
}
|
|
1010
993
|
return s * i;
|
|
@@ -1017,10 +1000,10 @@ class ge {
|
|
|
1017
1000
|
e.push({ time: 0.5, scale: i });
|
|
1018
1001
|
let n = i;
|
|
1019
1002
|
const a = 0.5, s = 0.5 / (t * 2);
|
|
1020
|
-
let
|
|
1021
|
-
for (let
|
|
1003
|
+
let l = 0.5;
|
|
1004
|
+
for (let c = 0; c < t; c++) {
|
|
1022
1005
|
const u = 1 - (n - 1) * a;
|
|
1023
|
-
|
|
1006
|
+
l += s, e.push({ time: l, scale: u }), n = 1 + (n - 1) * a * a, l += s, c < t - 1 && e.push({ time: l, scale: n });
|
|
1024
1007
|
}
|
|
1025
1008
|
return e.push({ time: 1, scale: 1 }), e;
|
|
1026
1009
|
}
|
|
@@ -1229,11 +1212,11 @@ class pe {
|
|
|
1229
1212
|
* @returns Array of layout objects with position, rotation, scale
|
|
1230
1213
|
*/
|
|
1231
1214
|
generate(t, i, e = {}) {
|
|
1232
|
-
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding,
|
|
1215
|
+
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, l = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, f = l * 1.5 / 2, m = l / 2, y = a - s - f, w = r - s - m, v = s + f, S = s + m;
|
|
1233
1216
|
for (let x = 0; x < t; x++) {
|
|
1234
|
-
const
|
|
1217
|
+
const I = this.random(v, y), z = this.random(S, w), L = c === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, g) : 1, O = l * _, H = {
|
|
1235
1218
|
id: x,
|
|
1236
|
-
x:
|
|
1219
|
+
x: I,
|
|
1237
1220
|
y: z,
|
|
1238
1221
|
rotation: L,
|
|
1239
1222
|
scale: _,
|
|
@@ -1265,10 +1248,10 @@ class be {
|
|
|
1265
1248
|
* @returns Array of layout objects with position, rotation, scale
|
|
1266
1249
|
*/
|
|
1267
1250
|
generate(t, i, e = {}) {
|
|
1268
|
-
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200,
|
|
1251
|
+
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
|
|
1269
1252
|
...Ht,
|
|
1270
1253
|
...this.config.radial
|
|
1271
|
-
}, f = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50,
|
|
1254
|
+
}, f = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, S = Math.max(f * 0.8, Math.min(
|
|
1272
1255
|
m - v - f / 2,
|
|
1273
1256
|
y - v - f / 2
|
|
1274
1257
|
));
|
|
@@ -1278,7 +1261,7 @@ class be {
|
|
|
1278
1261
|
id: 0,
|
|
1279
1262
|
x: m,
|
|
1280
1263
|
y,
|
|
1281
|
-
rotation:
|
|
1264
|
+
rotation: l === "random" ? this.random(c * 0.33, u * 0.33) : 0,
|
|
1282
1265
|
// Less rotation for center
|
|
1283
1266
|
scale: z,
|
|
1284
1267
|
baseSize: L,
|
|
@@ -1286,32 +1269,32 @@ class be {
|
|
|
1286
1269
|
// Center image is highest
|
|
1287
1270
|
});
|
|
1288
1271
|
}
|
|
1289
|
-
let x = 1,
|
|
1272
|
+
let x = 1, I = 1;
|
|
1290
1273
|
for (; x < t; ) {
|
|
1291
|
-
const z =
|
|
1274
|
+
const z = I / w, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(f * 0.8, S / w * 1.5 / p.tightness), O = I * _, H = O * 1.5, k = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), T = this.estimateWidth(f), D = Math.floor(k / (T * 0.7));
|
|
1292
1275
|
if (D === 0) {
|
|
1293
|
-
|
|
1276
|
+
I++;
|
|
1294
1277
|
continue;
|
|
1295
1278
|
}
|
|
1296
|
-
const G = 2 * Math.PI / D, U =
|
|
1279
|
+
const G = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
|
|
1297
1280
|
for (let M = 0; M < D && x < t; M++) {
|
|
1298
|
-
const
|
|
1299
|
-
let $ = m + Math.cos(
|
|
1300
|
-
const P =
|
|
1281
|
+
const C = M * G + U, N = g ? this.random(h, d) : 1, B = L * N, A = f * B;
|
|
1282
|
+
let $ = m + Math.cos(C) * H, F = y + Math.sin(C) * O;
|
|
1283
|
+
const P = A * 1.5 / 2, j = A / 2;
|
|
1301
1284
|
$ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P), F - j < v ? F = v + j : F + j > r - v && (F = r - v - j);
|
|
1302
|
-
const Y =
|
|
1285
|
+
const Y = l === "random" ? this.random(c, u) : 0;
|
|
1303
1286
|
n.push({
|
|
1304
1287
|
id: x,
|
|
1305
1288
|
x: $,
|
|
1306
1289
|
y: F,
|
|
1307
1290
|
rotation: Y,
|
|
1308
1291
|
scale: B,
|
|
1309
|
-
baseSize:
|
|
1310
|
-
zIndex: Math.max(1, 100 -
|
|
1292
|
+
baseSize: A,
|
|
1293
|
+
zIndex: Math.max(1, 100 - I)
|
|
1311
1294
|
// Outer rings have lower z-index
|
|
1312
1295
|
}), x++;
|
|
1313
1296
|
}
|
|
1314
|
-
|
|
1297
|
+
I++;
|
|
1315
1298
|
}
|
|
1316
1299
|
return n;
|
|
1317
1300
|
}
|
|
@@ -1344,7 +1327,7 @@ const ye = {
|
|
|
1344
1327
|
alignment: "center",
|
|
1345
1328
|
gap: 10,
|
|
1346
1329
|
overflowOffset: 0.25
|
|
1347
|
-
},
|
|
1330
|
+
}, Ct = [
|
|
1348
1331
|
{ x: 1, y: 1 },
|
|
1349
1332
|
// bottom-right
|
|
1350
1333
|
{ x: -1, y: -1 },
|
|
@@ -1374,13 +1357,13 @@ class ve {
|
|
|
1374
1357
|
* @returns Array of layout objects with position, rotation, scale
|
|
1375
1358
|
*/
|
|
1376
1359
|
generate(t, i, e = {}) {
|
|
1377
|
-
const n = [], { width: a, height: r } = i, s = { ...ye, ...this.config.grid },
|
|
1360
|
+
const n = [], { width: a, height: r } = i, s = { ...ye, ...this.config.grid }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = a - 2 * l, p = r - 2 * l, { columns: f, rows: m } = this.calculateGridDimensions(
|
|
1378
1361
|
t,
|
|
1379
1362
|
b,
|
|
1380
1363
|
p,
|
|
1381
|
-
|
|
1364
|
+
c,
|
|
1382
1365
|
s
|
|
1383
|
-
), y = s.stagger === "row", w = s.stagger === "column", v = y ? f + 0.5 : f,
|
|
1366
|
+
), y = s.stagger === "row", w = s.stagger === "column", v = y ? f + 0.5 : f, S = w ? m + 0.5 : m, x = (b - s.gap * (f - 1)) / v, I = (p - s.gap * (m - 1)) / S, z = y ? x / 2 : 0, L = w ? I / 2 : 0, _ = 1 + s.overlap, O = Math.min(x, I) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, k = f * x + (f - 1) * s.gap + z, T = m * I + (m - 1) * s.gap + L, D = l + (b - k) / 2, G = l + (p - T) / 2, U = f * m, M = s.columns !== "auto" && s.rows !== "auto", C = M && t > U;
|
|
1384
1367
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1385
1368
|
gridConfigColumns: s.columns,
|
|
1386
1369
|
gridConfigRows: s.rows,
|
|
@@ -1389,27 +1372,27 @@ class ve {
|
|
|
1389
1372
|
cellCount: U,
|
|
1390
1373
|
hasFixedGrid: M,
|
|
1391
1374
|
imageCount: t,
|
|
1392
|
-
isOverflowMode:
|
|
1375
|
+
isOverflowMode: C
|
|
1393
1376
|
});
|
|
1394
|
-
const N =
|
|
1395
|
-
for (let
|
|
1377
|
+
const N = C ? new Array(U).fill(0) : [], B = Math.min(x, I) * s.overflowOffset;
|
|
1378
|
+
for (let A = 0; A < t; A++) {
|
|
1396
1379
|
let $, F, X = 0;
|
|
1397
|
-
if (
|
|
1398
|
-
const q =
|
|
1380
|
+
if (C && A >= U) {
|
|
1381
|
+
const q = A - U, W = q % U;
|
|
1399
1382
|
X = Math.floor(q / U) + 1, N[W]++, s.fillDirection === "row" ? ($ = W % f, F = Math.floor(W / f)) : (F = W % m, $ = Math.floor(W / m));
|
|
1400
1383
|
} else
|
|
1401
|
-
s.fillDirection === "row" ? ($ =
|
|
1402
|
-
let P = D + $ * (x + s.gap) + x / 2, j = G + F * (
|
|
1403
|
-
if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (j +=
|
|
1404
|
-
const q = (X - 1) %
|
|
1384
|
+
s.fillDirection === "row" ? ($ = A % f, F = Math.floor(A / f)) : (F = A % m, $ = Math.floor(A / m));
|
|
1385
|
+
let P = D + $ * (x + s.gap) + x / 2, j = G + F * (I + s.gap) + I / 2;
|
|
1386
|
+
if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (j += I / 2), X > 0) {
|
|
1387
|
+
const q = (X - 1) % Ct.length, W = Ct[q];
|
|
1405
1388
|
P += W.x * B, j += W.y * B;
|
|
1406
1389
|
}
|
|
1407
1390
|
if (s.jitter > 0) {
|
|
1408
|
-
const q = x / 2 * s.jitter, W =
|
|
1391
|
+
const q = x / 2 * s.jitter, W = I / 2 * s.jitter;
|
|
1409
1392
|
P += this.random(-q, q), j += this.random(-W, W);
|
|
1410
1393
|
}
|
|
1411
1394
|
let Y = P, J = j;
|
|
1412
|
-
if (!
|
|
1395
|
+
if (!C && s.fillDirection === "row") {
|
|
1413
1396
|
const q = t % f || f;
|
|
1414
1397
|
if (F === Math.floor((t - 1) / f) && q < f) {
|
|
1415
1398
|
const St = q * x + (q - 1) * s.gap;
|
|
@@ -1417,7 +1400,7 @@ class ve {
|
|
|
1417
1400
|
s.alignment === "center" ? ft = (k - St) / 2 : s.alignment === "end" && (ft = k - St), Y += ft;
|
|
1418
1401
|
}
|
|
1419
1402
|
}
|
|
1420
|
-
const rt = g ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt =
|
|
1403
|
+
const rt = g ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt = l + it, ht = a - l - it, Pt = l + nt, _t = r - l - nt;
|
|
1421
1404
|
Y = Math.max(lt, Math.min(Y, ht)), J = Math.max(Pt, Math.min(J, _t));
|
|
1422
1405
|
let dt = 0;
|
|
1423
1406
|
if (u === "random") {
|
|
@@ -1425,8 +1408,8 @@ class ve {
|
|
|
1425
1408
|
s.jitter > 0 ? dt = this.random(q * s.jitter, W * s.jitter) : dt = this.random(q, W);
|
|
1426
1409
|
}
|
|
1427
1410
|
let ut;
|
|
1428
|
-
|
|
1429
|
-
id:
|
|
1411
|
+
C && X > 0 ? ut = 50 - X : ut = C ? 100 + A : A + 1, n.push({
|
|
1412
|
+
id: A,
|
|
1430
1413
|
x: Y,
|
|
1431
1414
|
y: J,
|
|
1432
1415
|
rotation: dt,
|
|
@@ -1449,8 +1432,8 @@ class ve {
|
|
|
1449
1432
|
else if (a.rows !== "auto")
|
|
1450
1433
|
s = a.rows, r = Math.ceil(t / s);
|
|
1451
1434
|
else {
|
|
1452
|
-
const
|
|
1453
|
-
for (r = Math.max(1, Math.round(Math.sqrt(t *
|
|
1435
|
+
const l = i / e;
|
|
1436
|
+
for (r = Math.max(1, Math.round(Math.sqrt(t * l / 1.4))), s = Math.ceil(t / r); r > 1 && (r - 1) * s >= t; )
|
|
1454
1437
|
r--;
|
|
1455
1438
|
}
|
|
1456
1439
|
return { columns: Math.max(1, r), rows: Math.max(1, s) };
|
|
@@ -1481,31 +1464,31 @@ class Ee {
|
|
|
1481
1464
|
* @returns Array of layout objects with position, rotation, scale
|
|
1482
1465
|
*/
|
|
1483
1466
|
generate(t, i, e = {}) {
|
|
1484
|
-
const n = [], { width: a, height: r } = i, s = { ...xe, ...this.config.spiral },
|
|
1485
|
-
m -
|
|
1486
|
-
y -
|
|
1467
|
+
const n = [], { width: a, height: r } = i, s = { ...xe, ...this.config.spiral }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, y = r / 2, w = Math.min(
|
|
1468
|
+
m - l - c / 2,
|
|
1469
|
+
y - l - c / 2
|
|
1487
1470
|
), v = s.direction === "clockwise" ? -1 : 1;
|
|
1488
|
-
for (let
|
|
1489
|
-
let x,
|
|
1471
|
+
for (let S = 0; S < t; S++) {
|
|
1472
|
+
let x, I;
|
|
1490
1473
|
if (s.spiralType === "golden")
|
|
1491
|
-
x =
|
|
1474
|
+
x = S * we * v + s.startAngle, I = this.calculateGoldenRadius(S, t, w, s.tightness);
|
|
1492
1475
|
else if (s.spiralType === "archimedean") {
|
|
1493
|
-
const P =
|
|
1494
|
-
x = P * v + s.startAngle,
|
|
1476
|
+
const P = S * 0.5 * s.tightness;
|
|
1477
|
+
x = P * v + s.startAngle, I = this.calculateArchimedeanRadius(P, t, w, s.tightness);
|
|
1495
1478
|
} else {
|
|
1496
|
-
const P =
|
|
1497
|
-
x = P * v + s.startAngle,
|
|
1479
|
+
const P = S * 0.3 * s.tightness;
|
|
1480
|
+
x = P * v + s.startAngle, I = this.calculateLogarithmicRadius(P, t, w, s.tightness);
|
|
1498
1481
|
}
|
|
1499
|
-
const z = m + Math.cos(x) *
|
|
1482
|
+
const z = m + Math.cos(x) * I, L = y + Math.sin(x) * I, _ = I / w, O = f > 0 ? 1 - _ * f * 0.5 : 1, H = p ? this.random(g, b) : 1, k = O * H, T = c * k, G = T * 1.5 / 2, U = T / 2, M = l + G, C = a - l - G, N = l + U, B = r - l - U, A = Math.max(M, Math.min(z, C)), $ = Math.max(N, Math.min(L, B));
|
|
1500
1483
|
let F = 0;
|
|
1501
1484
|
if (u === "random") {
|
|
1502
1485
|
const P = x * 180 / Math.PI % 360, j = this.random(h, d);
|
|
1503
1486
|
F = s.spiralType === "golden" ? j : P * 0.1 + j * 0.9;
|
|
1504
|
-
} else u === "tangent" && (F = this.calculateSpiralTangent(x,
|
|
1505
|
-
const X = t -
|
|
1487
|
+
} else u === "tangent" && (F = this.calculateSpiralTangent(x, I, s));
|
|
1488
|
+
const X = t - S;
|
|
1506
1489
|
n.push({
|
|
1507
|
-
id:
|
|
1508
|
-
x:
|
|
1490
|
+
id: S,
|
|
1491
|
+
x: A,
|
|
1509
1492
|
y: $,
|
|
1510
1493
|
rotation: F,
|
|
1511
1494
|
scale: k,
|
|
@@ -1553,8 +1536,8 @@ class Ee {
|
|
|
1553
1536
|
* r = a * e^(b*θ)
|
|
1554
1537
|
*/
|
|
1555
1538
|
calculateLogarithmicRadius(t, i, e, n) {
|
|
1556
|
-
const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t),
|
|
1557
|
-
return s /
|
|
1539
|
+
const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t), l = i * 0.3 * n, c = a * Math.exp(r * l);
|
|
1540
|
+
return s / c * e;
|
|
1558
1541
|
}
|
|
1559
1542
|
/**
|
|
1560
1543
|
* Utility: Generate random number between min and max
|
|
@@ -1583,7 +1566,7 @@ class Ie {
|
|
|
1583
1566
|
* @returns Array of layout objects with position, rotation, scale
|
|
1584
1567
|
*/
|
|
1585
1568
|
generate(t, i, e = {}) {
|
|
1586
|
-
const n = [], { width: a, height: r } = i, s = { ...Se, ...this.config.cluster },
|
|
1569
|
+
const n = [], { width: a, height: r } = i, s = { ...Se, ...this.config.cluster }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.calculateClusterCount(
|
|
1587
1570
|
t,
|
|
1588
1571
|
s.clusterCount,
|
|
1589
1572
|
a,
|
|
@@ -1593,29 +1576,29 @@ class Ie {
|
|
|
1593
1576
|
f,
|
|
1594
1577
|
a,
|
|
1595
1578
|
r,
|
|
1596
|
-
|
|
1579
|
+
l,
|
|
1597
1580
|
s
|
|
1598
1581
|
), y = new Array(f).fill(0);
|
|
1599
1582
|
for (let v = 0; v < t; v++)
|
|
1600
1583
|
y[v % f]++;
|
|
1601
1584
|
let w = 0;
|
|
1602
1585
|
for (let v = 0; v < f; v++) {
|
|
1603
|
-
const
|
|
1604
|
-
for (let
|
|
1586
|
+
const S = m[v], x = y[v];
|
|
1587
|
+
for (let I = 0; I < x; I++) {
|
|
1605
1588
|
let z, L;
|
|
1606
1589
|
if (s.distribution === "gaussian")
|
|
1607
|
-
z = this.gaussianRandom() *
|
|
1590
|
+
z = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
|
|
1608
1591
|
else {
|
|
1609
|
-
const F = this.random(0, Math.PI * 2), X = this.random(0,
|
|
1592
|
+
const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
|
|
1610
1593
|
z = Math.cos(F) * X, L = Math.sin(F) * X;
|
|
1611
1594
|
}
|
|
1612
1595
|
const _ = 1 + s.overlap * 0.5, O = 1 + s.overlap * 0.3;
|
|
1613
1596
|
z /= _, L /= _;
|
|
1614
|
-
const H = p ? this.random(g, b) : 1, k = O * H, T =
|
|
1615
|
-
let D =
|
|
1616
|
-
const M = T * 1.5 / 2,
|
|
1617
|
-
D = Math.max(
|
|
1618
|
-
const N = u === "random" ? this.random(h, d) : 0,
|
|
1597
|
+
const H = p ? this.random(g, b) : 1, k = O * H, T = c * k;
|
|
1598
|
+
let D = S.x + z, G = S.y + L;
|
|
1599
|
+
const M = T * 1.5 / 2, C = T / 2;
|
|
1600
|
+
D = Math.max(l + M, Math.min(D, a - l - M)), G = Math.max(l + C, Math.min(G, r - l - C));
|
|
1601
|
+
const N = u === "random" ? this.random(h, d) : 0, A = Math.sqrt(z * z + L * L) / S.spread, $ = Math.round((1 - A) * 50) + 1;
|
|
1619
1602
|
n.push({
|
|
1620
1603
|
id: w,
|
|
1621
1604
|
x: D,
|
|
@@ -1635,28 +1618,28 @@ class Ie {
|
|
|
1635
1618
|
calculateClusterCount(t, i, e, n, a) {
|
|
1636
1619
|
if (i !== "auto")
|
|
1637
1620
|
return Math.max(1, Math.min(i, t));
|
|
1638
|
-
const s = Math.max(1, Math.ceil(t / 8)),
|
|
1621
|
+
const s = Math.max(1, Math.ceil(t / 8)), l = Math.floor(
|
|
1639
1622
|
e / a * (n / a) * 0.6
|
|
1640
1623
|
);
|
|
1641
|
-
return Math.max(1, Math.min(s,
|
|
1624
|
+
return Math.max(1, Math.min(s, l, 10));
|
|
1642
1625
|
}
|
|
1643
1626
|
/**
|
|
1644
1627
|
* Generate cluster center positions with spacing constraints
|
|
1645
1628
|
*/
|
|
1646
1629
|
generateClusterCenters(t, i, e, n, a) {
|
|
1647
|
-
const r = [],
|
|
1630
|
+
const r = [], l = n + a.clusterSpread, c = i - n - a.clusterSpread, u = n + a.clusterSpread, h = e - n - a.clusterSpread;
|
|
1648
1631
|
for (let d = 0; d < t; d++) {
|
|
1649
1632
|
let g = null, b = -1;
|
|
1650
1633
|
for (let p = 0; p < 100; p++) {
|
|
1651
1634
|
const f = {
|
|
1652
|
-
x: this.random(
|
|
1635
|
+
x: this.random(l, c),
|
|
1653
1636
|
y: this.random(u, h),
|
|
1654
1637
|
spread: this.calculateClusterSpread(a)
|
|
1655
1638
|
};
|
|
1656
1639
|
let m = 1 / 0;
|
|
1657
1640
|
for (const y of r) {
|
|
1658
|
-
const w = f.x - y.x, v = f.y - y.y,
|
|
1659
|
-
m = Math.min(m,
|
|
1641
|
+
const w = f.x - y.x, v = f.y - y.y, S = Math.sqrt(w * w + v * v);
|
|
1642
|
+
m = Math.min(m, S);
|
|
1660
1643
|
}
|
|
1661
1644
|
if ((r.length === 0 || m > b) && (g = f, b = m), m >= a.clusterSpacing)
|
|
1662
1645
|
break;
|
|
@@ -1701,20 +1684,20 @@ class Re {
|
|
|
1701
1684
|
* @returns Array of layout objects with position, rotation, scale
|
|
1702
1685
|
*/
|
|
1703
1686
|
generate(t, i, e = {}) {
|
|
1704
|
-
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200,
|
|
1687
|
+
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, l = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, p = e.fixedHeight ?? s, f = {
|
|
1705
1688
|
...kt,
|
|
1706
1689
|
...this.config.wave
|
|
1707
|
-
}, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization:
|
|
1690
|
+
}, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization: S } = f, x = Math.ceil(t / m), L = p * 1.5 / 2, _ = l + L, O = a - l - L, H = O - _, k = x > 1 ? H / (x - 1) : 0, T = l + y + p / 2, D = r - l - y - p / 2, G = D - T, U = m > 1 ? G / (m - 1) : 0;
|
|
1708
1691
|
let M = 0;
|
|
1709
|
-
for (let
|
|
1710
|
-
const N = m === 1 ? (T + D) / 2 : T +
|
|
1692
|
+
for (let C = 0; C < m && M < t; C++) {
|
|
1693
|
+
const N = m === 1 ? (T + D) / 2 : T + C * U;
|
|
1711
1694
|
let B = 0;
|
|
1712
|
-
|
|
1713
|
-
for (let
|
|
1714
|
-
const $ = x === 1 ? (_ + O) / 2 : _ +
|
|
1695
|
+
S === "offset" ? B = C * v : S === "alternating" && (B = C * Math.PI);
|
|
1696
|
+
for (let A = 0; A < x && M < t; A++) {
|
|
1697
|
+
const $ = x === 1 ? (_ + O) / 2 : _ + A * k, F = this.calculateWaveY($, a, y, w, B), X = $, P = N + F, j = b ? this.random(d, g) : 1, Y = p * j;
|
|
1715
1698
|
let J = 0;
|
|
1716
|
-
|
|
1717
|
-
const K = Y * 1.5 / 2, ct = Y / 2, it =
|
|
1699
|
+
c === "tangent" ? J = this.calculateRotation($, a, y, w, B) : c === "random" && (J = this.random(u, h));
|
|
1700
|
+
const K = Y * 1.5 / 2, ct = Y / 2, it = l + K, nt = a - l - K, lt = l + ct, ht = r - l - ct;
|
|
1718
1701
|
n.push({
|
|
1719
1702
|
id: M,
|
|
1720
1703
|
x: Math.max(it, Math.min(X, nt)),
|
|
@@ -1779,15 +1762,15 @@ const xt = 100, Q = 100 / Math.sqrt(3), Et = [
|
|
|
1779
1762
|
// lower-left
|
|
1780
1763
|
[0, 50]
|
|
1781
1764
|
// left
|
|
1782
|
-
], Te = Et[1][0] / xt,
|
|
1783
|
-
function
|
|
1765
|
+
], Te = Et[1][0] / xt, Ce = Et[2][1] / xt;
|
|
1766
|
+
function Ae(o) {
|
|
1784
1767
|
return {
|
|
1785
1768
|
colStep: Te * o,
|
|
1786
|
-
rowOffset:
|
|
1769
|
+
rowOffset: Ce * o
|
|
1787
1770
|
};
|
|
1788
1771
|
}
|
|
1789
1772
|
function Le(o, t, i, e, n, a) {
|
|
1790
|
-
const { colStep: r } =
|
|
1773
|
+
const { colStep: r } = Ae(a);
|
|
1791
1774
|
return {
|
|
1792
1775
|
px: e + r * o,
|
|
1793
1776
|
py: n + a * (t + o / 2)
|
|
@@ -1806,7 +1789,7 @@ function Fe(o) {
|
|
|
1806
1789
|
const t = [];
|
|
1807
1790
|
let [i, e, n] = [0, -o, o];
|
|
1808
1791
|
for (const [a, r, s] of Me)
|
|
1809
|
-
for (let
|
|
1792
|
+
for (let l = 0; l < o; l++)
|
|
1810
1793
|
t.push([i, e, n]), i += a, e += r, n += s;
|
|
1811
1794
|
return t;
|
|
1812
1795
|
}
|
|
@@ -1817,23 +1800,23 @@ class ze {
|
|
|
1817
1800
|
this.config = t;
|
|
1818
1801
|
}
|
|
1819
1802
|
generate(t, i, e = {}) {
|
|
1820
|
-
const n = [], { width: a, height: r } = i, s = a / 2,
|
|
1803
|
+
const n = [], { width: a, height: r } = i, s = a / 2, l = r / 2, c = e.fixedHeight ?? 200, h = {
|
|
1821
1804
|
...Nt,
|
|
1822
1805
|
...this.config.honeycomb
|
|
1823
|
-
}.spacing ?? 0, d =
|
|
1806
|
+
}.spacing ?? 0, d = c + h;
|
|
1824
1807
|
let g = 0, b = 0;
|
|
1825
1808
|
for (; g < t; ) {
|
|
1826
1809
|
const p = Fe(b);
|
|
1827
1810
|
for (const [f, m, y] of p) {
|
|
1828
1811
|
if (g >= t) break;
|
|
1829
|
-
const { px: w, py: v } = Le(f, m, y, s,
|
|
1812
|
+
const { px: w, py: v } = Le(f, m, y, s, l, d);
|
|
1830
1813
|
n.push({
|
|
1831
1814
|
id: g,
|
|
1832
1815
|
x: w,
|
|
1833
1816
|
y: v,
|
|
1834
1817
|
rotation: 0,
|
|
1835
1818
|
scale: 1,
|
|
1836
|
-
baseSize:
|
|
1819
|
+
baseSize: c,
|
|
1837
1820
|
// Inner rings render above outer rings
|
|
1838
1821
|
zIndex: Math.max(1, 100 - b)
|
|
1839
1822
|
}), g++;
|
|
@@ -1948,10 +1931,10 @@ class Oe {
|
|
|
1948
1931
|
const a = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
|
|
1949
1932
|
if (r !== void 0)
|
|
1950
1933
|
return { height: r };
|
|
1951
|
-
const s = a?.minSize ?? 50,
|
|
1934
|
+
const s = a?.minSize ?? 50, l = a?.maxSize ?? 400, c = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * c / i;
|
|
1952
1935
|
let m = Math.sqrt(p / 1.4);
|
|
1953
1936
|
m *= u, m = Math.min(m, e);
|
|
1954
|
-
let y = this.clamp(m, s,
|
|
1937
|
+
let y = this.clamp(m, s, l);
|
|
1955
1938
|
if (y === s && m < s) {
|
|
1956
1939
|
const w = Math.max(s * 0.05, 20);
|
|
1957
1940
|
y = Math.max(w, m);
|
|
@@ -1968,7 +1951,7 @@ class Oe {
|
|
|
1968
1951
|
let e = 0, n = 1;
|
|
1969
1952
|
for (; n < t; )
|
|
1970
1953
|
e++, n += 6 * e;
|
|
1971
|
-
const a = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, s = i.width / 2,
|
|
1954
|
+
const a = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, s = i.width / 2, l = i.height / 2, c = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (l - a - r * e) / (e + 0.5), d = (s - a - c * r * e) / (c * e + u);
|
|
1972
1955
|
return Math.max(10, Math.min(h, d));
|
|
1973
1956
|
}
|
|
1974
1957
|
/**
|
|
@@ -1978,8 +1961,8 @@ class Oe {
|
|
|
1978
1961
|
return Math.max(i, Math.min(e, t));
|
|
1979
1962
|
}
|
|
1980
1963
|
}
|
|
1981
|
-
var
|
|
1982
|
-
const
|
|
1964
|
+
var E = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(E || {});
|
|
1965
|
+
const At = {
|
|
1983
1966
|
// Geometric shapes - uses percentages for responsive sizing
|
|
1984
1967
|
circle: "circle(50%)",
|
|
1985
1968
|
square: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)",
|
|
@@ -2028,7 +2011,7 @@ const Ct = {
|
|
|
2028
2011
|
};
|
|
2029
2012
|
function $e(o) {
|
|
2030
2013
|
if (o)
|
|
2031
|
-
return o in
|
|
2014
|
+
return o in At ? At[o] : o;
|
|
2032
2015
|
}
|
|
2033
2016
|
function Pe(o, t, i) {
|
|
2034
2017
|
const e = De[o];
|
|
@@ -2036,7 +2019,7 @@ function Pe(o, t, i) {
|
|
|
2036
2019
|
const n = t / e.refHeight;
|
|
2037
2020
|
if (o === "circle")
|
|
2038
2021
|
return `circle(${Math.round(50 * n * 100) / 100}px)`;
|
|
2039
|
-
const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * n,
|
|
2022
|
+
const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * n, l = (Math.min(...r) + Math.max(...r)) / 2 * n, c = (Math.max(...a) - Math.min(...a)) * n, u = (i ?? c) / 2, h = t / 2, d = u - s, g = h - l;
|
|
2040
2023
|
return `polygon(${e.points.map(([p, f]) => {
|
|
2041
2024
|
const m = Math.round((p * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
|
|
2042
2025
|
return `${m}px ${y}px`;
|
|
@@ -2074,22 +2057,22 @@ function et(o, t, i) {
|
|
|
2074
2057
|
o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : s && (e.borderTopLeftRadius = `${s}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : s && (e.borderTopRightRadius = `${s}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : s && (e.borderBottomRightRadius = `${s}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : s && (e.borderBottomLeftRadius = `${s}px`);
|
|
2075
2058
|
} else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
|
|
2076
2059
|
if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
|
|
2077
|
-
const s = o.border || {},
|
|
2078
|
-
e.borderTop = tt(
|
|
2060
|
+
const s = o.border || {}, l = { ...s, ...o.borderTop }, c = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, h = { ...s, ...o.borderLeft };
|
|
2061
|
+
e.borderTop = tt(l), e.borderRight = tt(c), e.borderBottom = tt(u), e.borderLeft = tt(h);
|
|
2079
2062
|
} else o.border && (e.border = tt(o.border));
|
|
2080
2063
|
o.shadow !== void 0 && (e.boxShadow = Ue(o.shadow));
|
|
2081
2064
|
const r = He(o.filter);
|
|
2082
2065
|
if (e.filter = r || "none", o.opacity !== void 0 && (e.opacity = String(o.opacity)), o.cursor !== void 0 && (e.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
|
|
2083
|
-
const s = o.outline.width ?? 0,
|
|
2084
|
-
e.outline = `${s}px ${
|
|
2066
|
+
const s = o.outline.width ?? 0, l = o.outline.style ?? "solid", c = o.outline.color ?? "#000000";
|
|
2067
|
+
e.outline = `${s}px ${l} ${c}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
2085
2068
|
}
|
|
2086
2069
|
if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
|
|
2087
2070
|
let s;
|
|
2088
|
-
const
|
|
2089
|
-
if (
|
|
2090
|
-
s = Pe(
|
|
2071
|
+
const l = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, c = l ? o.clipPath : void 0;
|
|
2072
|
+
if (c?.mode === "height-relative" && t)
|
|
2073
|
+
s = Pe(c.shape, t, i);
|
|
2091
2074
|
else {
|
|
2092
|
-
const u =
|
|
2075
|
+
const u = l && c ? c.shape : o.clipPath;
|
|
2093
2076
|
s = $e(u);
|
|
2094
2077
|
}
|
|
2095
2078
|
s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
|
|
@@ -2124,7 +2107,7 @@ const Lt = {
|
|
|
2124
2107
|
};
|
|
2125
2108
|
class Ne {
|
|
2126
2109
|
constructor(t, i, e) {
|
|
2127
|
-
this.state =
|
|
2110
|
+
this.state = E.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
|
|
2128
2111
|
}
|
|
2129
2112
|
/**
|
|
2130
2113
|
* Set callback to be fired when an unfocus animation fully completes.
|
|
@@ -2142,7 +2125,7 @@ class Ne {
|
|
|
2142
2125
|
* Check if any animation is in progress
|
|
2143
2126
|
*/
|
|
2144
2127
|
isAnimating() {
|
|
2145
|
-
return this.state !==
|
|
2128
|
+
return this.state !== E.IDLE && this.state !== E.FOCUSED;
|
|
2146
2129
|
}
|
|
2147
2130
|
/**
|
|
2148
2131
|
* Normalize scalePercent value
|
|
@@ -2156,9 +2139,9 @@ class Ne {
|
|
|
2156
2139
|
*/
|
|
2157
2140
|
calculateFocusDimensions(t, i, e) {
|
|
2158
2141
|
const n = this.normalizeScalePercent(this.config.scalePercent), a = e.height * n, r = t / i;
|
|
2159
|
-
let s = a,
|
|
2160
|
-
const
|
|
2161
|
-
return
|
|
2142
|
+
let s = a, l = s * r;
|
|
2143
|
+
const c = e.width * n;
|
|
2144
|
+
return l > c && (l = c, s = l / r), { width: l, height: s };
|
|
2162
2145
|
}
|
|
2163
2146
|
/**
|
|
2164
2147
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
@@ -2189,12 +2172,12 @@ class Ne {
|
|
|
2189
2172
|
* Create a Web Animation that animates both transform (position) and dimensions
|
|
2190
2173
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
2191
2174
|
*/
|
|
2192
|
-
animateWithDimensions(t, i, e, n, a, r, s,
|
|
2193
|
-
const
|
|
2175
|
+
animateWithDimensions(t, i, e, n, a, r, s, l) {
|
|
2176
|
+
const c = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
|
|
2194
2177
|
return t.style.transition = "none", t.animate(
|
|
2195
2178
|
[
|
|
2196
2179
|
{
|
|
2197
|
-
transform:
|
|
2180
|
+
transform: c,
|
|
2198
2181
|
width: `${n}px`,
|
|
2199
2182
|
height: `${a}px`
|
|
2200
2183
|
},
|
|
@@ -2205,7 +2188,7 @@ class Ne {
|
|
|
2205
2188
|
}
|
|
2206
2189
|
],
|
|
2207
2190
|
{
|
|
2208
|
-
duration:
|
|
2191
|
+
duration: l,
|
|
2209
2192
|
easing: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
2210
2193
|
fill: "forwards"
|
|
2211
2194
|
}
|
|
@@ -2239,8 +2222,8 @@ class Ne {
|
|
|
2239
2222
|
let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
|
|
2240
2223
|
e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
|
|
2241
2224
|
const a = () => {
|
|
2242
|
-
const r = t.offsetHeight, s = t.offsetWidth,
|
|
2243
|
-
|
|
2225
|
+
const r = t.offsetHeight, s = t.offsetWidth, l = et(n, r, s);
|
|
2226
|
+
l.clipPath !== void 0 ? t.style.clipPath = l.clipPath : t.style.clipPath = "unset", l.overflow !== void 0 && (t.style.overflow = l.overflow), i.animation.playState === "running" && requestAnimationFrame(a);
|
|
2244
2227
|
};
|
|
2245
2228
|
requestAnimationFrame(a);
|
|
2246
2229
|
}
|
|
@@ -2251,7 +2234,7 @@ class Ne {
|
|
|
2251
2234
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2252
2235
|
*/
|
|
2253
2236
|
startFocusAnimation(t, i, e, n, a) {
|
|
2254
|
-
const r = t.style.zIndex || "", s = t.offsetWidth,
|
|
2237
|
+
const r = t.style.zIndex || "", s = t.offsetWidth, l = t.offsetHeight, c = this.calculateFocusDimensions(s, l, i), u = this.calculateFocusTransform(i, e);
|
|
2255
2238
|
this.animationEngine.cancelAllAnimations(t);
|
|
2256
2239
|
const h = this.config.animationDuration ?? 600;
|
|
2257
2240
|
this.applyFocusedStyling(t, Lt.FOCUSING);
|
|
@@ -2261,14 +2244,14 @@ class Ne {
|
|
|
2261
2244
|
rotation: e.rotation,
|
|
2262
2245
|
scale: 1
|
|
2263
2246
|
// No scale - using dimensions
|
|
2264
|
-
}, g = a?.width ?? s, b = a?.height ??
|
|
2247
|
+
}, g = a?.width ?? s, b = a?.height ?? l, p = this.animateWithDimensions(
|
|
2265
2248
|
t,
|
|
2266
2249
|
d,
|
|
2267
2250
|
u,
|
|
2268
2251
|
g,
|
|
2269
2252
|
b,
|
|
2270
|
-
|
|
2271
|
-
|
|
2253
|
+
c.width,
|
|
2254
|
+
c.height,
|
|
2272
2255
|
h
|
|
2273
2256
|
), f = {
|
|
2274
2257
|
id: `focus-${Date.now()}`,
|
|
@@ -2285,16 +2268,16 @@ class Ne {
|
|
|
2285
2268
|
focusTransform: u,
|
|
2286
2269
|
originalZIndex: r,
|
|
2287
2270
|
originalWidth: s,
|
|
2288
|
-
originalHeight:
|
|
2289
|
-
focusWidth:
|
|
2290
|
-
focusHeight:
|
|
2271
|
+
originalHeight: l,
|
|
2272
|
+
focusWidth: c.width,
|
|
2273
|
+
focusHeight: c.height
|
|
2291
2274
|
}, this.startClipPathAnimation(t, f, !0), {
|
|
2292
2275
|
element: t,
|
|
2293
2276
|
originalState: e,
|
|
2294
2277
|
animationHandle: f,
|
|
2295
2278
|
direction: "in",
|
|
2296
2279
|
originalWidth: s,
|
|
2297
|
-
originalHeight:
|
|
2280
|
+
originalHeight: l
|
|
2298
2281
|
};
|
|
2299
2282
|
}
|
|
2300
2283
|
/**
|
|
@@ -2306,7 +2289,7 @@ class Ne {
|
|
|
2306
2289
|
t.style.zIndex = String(Lt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2307
2290
|
const a = this.config.animationDuration ?? 600;
|
|
2308
2291
|
t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
|
|
2309
|
-
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth,
|
|
2292
|
+
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, l = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, c = {
|
|
2310
2293
|
x: 0,
|
|
2311
2294
|
y: 0,
|
|
2312
2295
|
rotation: i.rotation,
|
|
@@ -2315,9 +2298,9 @@ class Ne {
|
|
|
2315
2298
|
}, u = this.focusData?.originalWidth ?? t.offsetWidth, h = this.focusData?.originalHeight ?? t.offsetHeight, d = this.animateWithDimensions(
|
|
2316
2299
|
t,
|
|
2317
2300
|
r,
|
|
2318
|
-
l,
|
|
2319
|
-
s,
|
|
2320
2301
|
c,
|
|
2302
|
+
s,
|
|
2303
|
+
l,
|
|
2321
2304
|
u,
|
|
2322
2305
|
h,
|
|
2323
2306
|
a
|
|
@@ -2326,7 +2309,7 @@ class Ne {
|
|
|
2326
2309
|
element: t,
|
|
2327
2310
|
animation: d,
|
|
2328
2311
|
fromState: r,
|
|
2329
|
-
toState:
|
|
2312
|
+
toState: c,
|
|
2330
2313
|
startTime: performance.now(),
|
|
2331
2314
|
duration: a
|
|
2332
2315
|
};
|
|
@@ -2354,9 +2337,9 @@ class Ne {
|
|
|
2354
2337
|
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
2355
2338
|
*/
|
|
2356
2339
|
captureMidAnimationState(t) {
|
|
2357
|
-
const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, a = t.offsetHeight, r = e.e + n * 0.5, s = e.f + a * 0.5,
|
|
2358
|
-
return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${
|
|
2359
|
-
transform: { x: r, y: s, rotation:
|
|
2340
|
+
const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, a = t.offsetHeight, r = e.e + n * 0.5, s = e.f + a * 0.5, l = Math.atan2(e.b, e.a) * (180 / Math.PI);
|
|
2341
|
+
return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${l}deg)`, t.style.transition = "none", {
|
|
2342
|
+
transform: { x: r, y: s, rotation: l, scale: 1 },
|
|
2360
2343
|
dimensions: { width: n, height: a }
|
|
2361
2344
|
};
|
|
2362
2345
|
}
|
|
@@ -2382,26 +2365,26 @@ class Ne {
|
|
|
2382
2365
|
* Implements cross-animation when swapping focus
|
|
2383
2366
|
*/
|
|
2384
2367
|
async focusImage(t, i, e) {
|
|
2385
|
-
if (this.currentFocus === t && this.state ===
|
|
2368
|
+
if (this.currentFocus === t && this.state === E.FOCUSED)
|
|
2386
2369
|
return this.unfocusImage();
|
|
2387
|
-
if (this.incoming?.element === t && this.state ===
|
|
2370
|
+
if (this.incoming?.element === t && this.state === E.FOCUSING) {
|
|
2388
2371
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
|
|
2389
2372
|
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2390
2373
|
t,
|
|
2391
2374
|
this.incoming.originalState,
|
|
2392
2375
|
a,
|
|
2393
2376
|
r
|
|
2394
|
-
), this.incoming = null, this.state =
|
|
2377
|
+
), this.incoming = null, this.state = E.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = E.IDLE;
|
|
2395
2378
|
return;
|
|
2396
2379
|
}
|
|
2397
2380
|
const n = ++this.focusGeneration;
|
|
2398
2381
|
switch (this.state) {
|
|
2399
|
-
case
|
|
2400
|
-
if (this.state =
|
|
2401
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2382
|
+
case E.IDLE:
|
|
2383
|
+
if (this.state = E.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2384
|
+
this.currentFocus = t, this.incoming = null, this.state = E.FOCUSED;
|
|
2402
2385
|
break;
|
|
2403
|
-
case
|
|
2404
|
-
if (this.state =
|
|
2386
|
+
case E.FOCUSED:
|
|
2387
|
+
if (this.state = E.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2405
2388
|
this.currentFocus,
|
|
2406
2389
|
this.focusData.originalState
|
|
2407
2390
|
)), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
@@ -2413,9 +2396,9 @@ class Ne {
|
|
|
2413
2396
|
const a = this.outgoing.element;
|
|
2414
2397
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2415
2398
|
}
|
|
2416
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2399
|
+
this.currentFocus = t, this.incoming = null, this.state = E.FOCUSED;
|
|
2417
2400
|
break;
|
|
2418
|
-
case
|
|
2401
|
+
case E.FOCUSING:
|
|
2419
2402
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2420
2403
|
this.incoming.element,
|
|
2421
2404
|
this.incoming.originalState,
|
|
@@ -2423,10 +2406,10 @@ class Ne {
|
|
|
2423
2406
|
this.focusData?.originalWidth,
|
|
2424
2407
|
this.focusData?.originalHeight
|
|
2425
2408
|
), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2426
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2409
|
+
this.currentFocus = t, this.incoming = null, this.state = E.FOCUSED;
|
|
2427
2410
|
break;
|
|
2428
|
-
case
|
|
2429
|
-
if (this.state =
|
|
2411
|
+
case E.UNFOCUSING:
|
|
2412
|
+
if (this.state = E.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
2430
2413
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2431
2414
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2432
2415
|
]), this.focusGeneration !== n) return;
|
|
@@ -2434,20 +2417,20 @@ class Ne {
|
|
|
2434
2417
|
const a = this.outgoing.element;
|
|
2435
2418
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2436
2419
|
}
|
|
2437
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2420
|
+
this.currentFocus = t, this.incoming = null, this.state = E.FOCUSED;
|
|
2438
2421
|
break;
|
|
2439
|
-
case
|
|
2422
|
+
case E.CROSS_ANIMATING:
|
|
2440
2423
|
if (this.incoming?.element === t)
|
|
2441
2424
|
return;
|
|
2442
2425
|
if (this.outgoing?.element === t) {
|
|
2443
2426
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
|
|
2444
2427
|
if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
|
|
2445
|
-
const { transform: s, dimensions:
|
|
2428
|
+
const { transform: s, dimensions: l } = this.captureMidAnimationState(this.incoming.element);
|
|
2446
2429
|
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2447
2430
|
this.incoming.element,
|
|
2448
2431
|
this.incoming.originalState,
|
|
2449
2432
|
s,
|
|
2450
|
-
|
|
2433
|
+
l
|
|
2451
2434
|
);
|
|
2452
2435
|
} else
|
|
2453
2436
|
this.outgoing = null;
|
|
@@ -2459,7 +2442,7 @@ class Ne {
|
|
|
2459
2442
|
const s = this.outgoing.element;
|
|
2460
2443
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2461
2444
|
}
|
|
2462
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2445
|
+
this.currentFocus = t, this.incoming = null, this.state = E.FOCUSED;
|
|
2463
2446
|
return;
|
|
2464
2447
|
}
|
|
2465
2448
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2485,7 +2468,7 @@ class Ne {
|
|
|
2485
2468
|
const a = this.outgoing.element;
|
|
2486
2469
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2487
2470
|
}
|
|
2488
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2471
|
+
this.currentFocus = t, this.incoming = null, this.state = E.FOCUSED;
|
|
2489
2472
|
break;
|
|
2490
2473
|
}
|
|
2491
2474
|
}
|
|
@@ -2493,24 +2476,24 @@ class Ne {
|
|
|
2493
2476
|
* Unfocus current image, returning it to original position
|
|
2494
2477
|
*/
|
|
2495
2478
|
async unfocusImage() {
|
|
2496
|
-
if (this.state ===
|
|
2479
|
+
if (this.state === E.UNFOCUSING)
|
|
2497
2480
|
return;
|
|
2498
2481
|
const t = ++this.focusGeneration;
|
|
2499
2482
|
if (!this.currentFocus || !this.focusData) {
|
|
2500
|
-
if (this.incoming && this.state ===
|
|
2483
|
+
if (this.incoming && this.state === E.FOCUSING) {
|
|
2501
2484
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2502
2485
|
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2503
2486
|
this.incoming.element,
|
|
2504
2487
|
this.incoming.originalState,
|
|
2505
2488
|
a,
|
|
2506
2489
|
r
|
|
2507
|
-
), this.incoming = null, this.state =
|
|
2490
|
+
), this.incoming = null, this.state = E.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2508
2491
|
const s = this.outgoing.element;
|
|
2509
|
-
this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state =
|
|
2492
|
+
this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = E.IDLE, this.onUnfocusComplete?.(s);
|
|
2510
2493
|
}
|
|
2511
2494
|
return;
|
|
2512
2495
|
}
|
|
2513
|
-
if (this.state ===
|
|
2496
|
+
if (this.state === E.CROSS_ANIMATING && this.incoming) {
|
|
2514
2497
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2515
2498
|
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2516
2499
|
const s = this.startUnfocusAnimation(
|
|
@@ -2523,15 +2506,15 @@ class Ne {
|
|
|
2523
2506
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2524
2507
|
this.waitForAnimation(s.animationHandle)
|
|
2525
2508
|
]), this.focusGeneration !== t) return;
|
|
2526
|
-
let
|
|
2527
|
-
this.outgoing && (
|
|
2528
|
-
const
|
|
2529
|
-
this.removeFocusedStyling(
|
|
2509
|
+
let l = null;
|
|
2510
|
+
this.outgoing && (l = this.outgoing.element, this.removeFocusedStyling(l, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2511
|
+
const c = s.element;
|
|
2512
|
+
this.removeFocusedStyling(c, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = E.IDLE, l && this.onUnfocusComplete?.(l), this.onUnfocusComplete?.(c);
|
|
2530
2513
|
return;
|
|
2531
2514
|
}
|
|
2532
|
-
this.state =
|
|
2515
|
+
this.state = E.UNFOCUSING;
|
|
2533
2516
|
const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2534
|
-
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state =
|
|
2517
|
+
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = E.IDLE, this.onUnfocusComplete?.(i));
|
|
2535
2518
|
}
|
|
2536
2519
|
/**
|
|
2537
2520
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2549,7 +2532,7 @@ class Ne {
|
|
|
2549
2532
|
* Check if an image is currently focused (stable state)
|
|
2550
2533
|
*/
|
|
2551
2534
|
isFocused(t) {
|
|
2552
|
-
return this.currentFocus === t && this.state ===
|
|
2535
|
+
return this.currentFocus === t && this.state === E.FOCUSED;
|
|
2553
2536
|
}
|
|
2554
2537
|
/**
|
|
2555
2538
|
* Check if an image is the target of current focus animation
|
|
@@ -2570,7 +2553,7 @@ class Ne {
|
|
|
2570
2553
|
* Used during swipe gestures for visual feedback
|
|
2571
2554
|
*/
|
|
2572
2555
|
setDragOffset(t) {
|
|
2573
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2556
|
+
if (!this.currentFocus || !this.focusData || this.state !== E.FOCUSED) return;
|
|
2574
2557
|
const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], a = (e.x ?? 0) + t, r = e.y ?? 0;
|
|
2575
2558
|
n.push(`translate(${a}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
|
|
2576
2559
|
}
|
|
@@ -2580,13 +2563,13 @@ class Ne {
|
|
|
2580
2563
|
* @param duration - Animation duration in ms (default 150)
|
|
2581
2564
|
*/
|
|
2582
2565
|
clearDragOffset(t, i = 150) {
|
|
2583
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2566
|
+
if (!this.currentFocus || !this.focusData || this.state !== E.FOCUSED) return;
|
|
2584
2567
|
const e = this.currentFocus, n = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = n.x ?? 0, s = n.y ?? 0;
|
|
2585
2568
|
a.push(`translate(${r}px, ${s}px)`), n.rotation !== void 0 && a.push(`rotate(${n.rotation}deg)`);
|
|
2586
|
-
const
|
|
2587
|
-
t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform =
|
|
2569
|
+
const l = a.join(" ");
|
|
2570
|
+
t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = l, setTimeout(() => {
|
|
2588
2571
|
this.currentFocus === e && (e.style.transition = "none");
|
|
2589
|
-
}, i)) : (e.style.transition = "none", e.style.transform =
|
|
2572
|
+
}, i)) : (e.style.transition = "none", e.style.transform = l);
|
|
2590
2573
|
}
|
|
2591
2574
|
/**
|
|
2592
2575
|
* Reset zoom state (cancels all animations)
|
|
@@ -2610,7 +2593,7 @@ class Ne {
|
|
|
2610
2593
|
this.focusData.originalZIndex,
|
|
2611
2594
|
this.focusData.originalWidth,
|
|
2612
2595
|
this.focusData.originalHeight
|
|
2613
|
-
), this.state =
|
|
2596
|
+
), this.state = E.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2614
2597
|
}
|
|
2615
2598
|
}
|
|
2616
2599
|
const je = 50, We = 0.5, Ge = 20, qe = 0.3, Be = 150, Xe = 30, at = class at {
|
|
@@ -2776,10 +2759,10 @@ class Ye {
|
|
|
2776
2759
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2777
2760
|
if (!s.ok)
|
|
2778
2761
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2779
|
-
const
|
|
2762
|
+
const c = (await s.json()).files.filter(
|
|
2780
2763
|
(u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
|
|
2781
2764
|
);
|
|
2782
|
-
return this.log(`Found ${
|
|
2765
|
+
return this.log(`Found ${c.length} images in folder ${t} (non-recursive)`), c.forEach((u) => {
|
|
2783
2766
|
e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2784
2767
|
}), e;
|
|
2785
2768
|
}
|
|
@@ -2801,8 +2784,8 @@ class Ye {
|
|
|
2801
2784
|
try {
|
|
2802
2785
|
const r = `${this.apiEndpoint}/${a}?fields=name,mimeType&key=${this.apiKey}`, s = await fetch(r);
|
|
2803
2786
|
if (s.ok) {
|
|
2804
|
-
const
|
|
2805
|
-
|
|
2787
|
+
const l = await s.json();
|
|
2788
|
+
l.mimeType.startsWith("image/") && i.isAllowed(l.name) ? (e.push(`https://lh3.googleusercontent.com/d/${a}=s1600`), this.log(`Added file: ${l.name}`)) : this.log(`Skipping non-image file: ${l.name} (${l.mimeType})`);
|
|
2806
2789
|
} else
|
|
2807
2790
|
this.log(`Failed to fetch metadata for file ${a}: ${s.status}`);
|
|
2808
2791
|
} catch (r) {
|
|
@@ -2846,12 +2829,12 @@ class Ye {
|
|
|
2846
2829
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2847
2830
|
if (!s.ok)
|
|
2848
2831
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2849
|
-
const
|
|
2832
|
+
const l = await s.json(), c = l.files.filter(
|
|
2850
2833
|
(h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
|
|
2851
|
-
), u =
|
|
2834
|
+
), u = l.files.filter(
|
|
2852
2835
|
(h) => h.mimeType === "application/vnd.google-apps.folder"
|
|
2853
2836
|
);
|
|
2854
|
-
this.log(`Found ${
|
|
2837
|
+
this.log(`Found ${l.files.length} total items in folder ${t}`), l.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${c.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), c.forEach((h) => {
|
|
2855
2838
|
e.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
|
|
2856
2839
|
});
|
|
2857
2840
|
for (const h of u) {
|
|
@@ -3239,7 +3222,7 @@ class ti {
|
|
|
3239
3222
|
layout: this.fullConfig.layout,
|
|
3240
3223
|
image: this.fullConfig.image
|
|
3241
3224
|
}), this.zoomEngine = new Ne(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = et(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3242
|
-
const i = this.fullConfig.animation.entry ||
|
|
3225
|
+
const i = this.fullConfig.animation.entry || R.animation.entry;
|
|
3243
3226
|
this.entryAnimationEngine = new ge(
|
|
3244
3227
|
i,
|
|
3245
3228
|
this.fullConfig.layout.algorithm
|
|
@@ -3319,7 +3302,7 @@ class ti {
|
|
|
3319
3302
|
}
|
|
3320
3303
|
}
|
|
3321
3304
|
setupUI() {
|
|
3322
|
-
const t = this.fullConfig.
|
|
3305
|
+
const t = this.fullConfig.ui;
|
|
3323
3306
|
t.showLoadingSpinner && (t.loadingElement ? (this.loadingEl = this.resolveElement(t.loadingElement), this.loadingElAutoCreated = !1) : (this.loadingEl = this.createDefaultLoadingElement(), this.loadingElAutoCreated = !0)), t.errorElement ? (this.errorEl = this.resolveElement(t.errorElement), this.errorElAutoCreated = !1) : (this.errorEl = this.createDefaultErrorElement(), this.errorElAutoCreated = !0), t.showImageCounter && (t.counterElement ? (this.counterEl = this.resolveElement(t.counterElement), this.counterElAutoCreated = !1) : (this.counterEl = this.createDefaultCounterElement(), this.counterElAutoCreated = !0));
|
|
3324
3307
|
}
|
|
3325
3308
|
resolveElement(t) {
|
|
@@ -3432,18 +3415,18 @@ class ti {
|
|
|
3432
3415
|
const n = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
|
|
3433
3416
|
this.imageLayouts = a, this.displayQueue = [];
|
|
3434
3417
|
let r = 0;
|
|
3435
|
-
const s = (
|
|
3436
|
-
this.containerEl && (this.containerEl.appendChild(
|
|
3437
|
-
if (
|
|
3418
|
+
const s = (c) => {
|
|
3419
|
+
this.containerEl && (this.containerEl.appendChild(c), this.imageElements.push(c), requestAnimationFrame(() => {
|
|
3420
|
+
if (c.offsetWidth, c.style.opacity = this.defaultStyles.opacity ?? "1", c.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || c.dataset.startRotation !== c.dataset.rotation || c.dataset.startScale !== c.dataset.scale)) {
|
|
3438
3421
|
const d = {
|
|
3439
|
-
x: parseFloat(
|
|
3440
|
-
y: parseFloat(
|
|
3422
|
+
x: parseFloat(c.dataset.startX),
|
|
3423
|
+
y: parseFloat(c.dataset.startY)
|
|
3441
3424
|
}, g = {
|
|
3442
|
-
x: parseFloat(
|
|
3443
|
-
y: parseFloat(
|
|
3444
|
-
}, b = parseFloat(
|
|
3425
|
+
x: parseFloat(c.dataset.endX),
|
|
3426
|
+
y: parseFloat(c.dataset.endY)
|
|
3427
|
+
}, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), f = parseFloat(c.dataset.rotation), m = parseFloat(c.dataset.scale), y = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : f, w = c.dataset.startScale ? parseFloat(c.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
|
|
3445
3428
|
de({
|
|
3446
|
-
element:
|
|
3429
|
+
element: c,
|
|
3447
3430
|
startPosition: d,
|
|
3448
3431
|
endPosition: g,
|
|
3449
3432
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
@@ -3458,33 +3441,33 @@ class ti {
|
|
|
3458
3441
|
startScale: w
|
|
3459
3442
|
});
|
|
3460
3443
|
} else {
|
|
3461
|
-
const d =
|
|
3462
|
-
|
|
3444
|
+
const d = c.dataset.finalTransform || "";
|
|
3445
|
+
c.style.transform = d;
|
|
3463
3446
|
}
|
|
3464
|
-
const h = parseInt(
|
|
3447
|
+
const h = parseInt(c.dataset.imageId || "0");
|
|
3465
3448
|
if (this.fullConfig.config.debug?.enabled && h < 3) {
|
|
3466
|
-
const d =
|
|
3449
|
+
const d = c.dataset.finalTransform || "";
|
|
3467
3450
|
console.log(`Image ${h} final state:`, {
|
|
3468
|
-
left:
|
|
3469
|
-
top:
|
|
3470
|
-
width:
|
|
3471
|
-
height:
|
|
3472
|
-
computedWidth:
|
|
3473
|
-
computedHeight:
|
|
3451
|
+
left: c.style.left,
|
|
3452
|
+
top: c.style.top,
|
|
3453
|
+
width: c.style.width,
|
|
3454
|
+
height: c.style.height,
|
|
3455
|
+
computedWidth: c.offsetWidth,
|
|
3456
|
+
computedHeight: c.offsetHeight,
|
|
3474
3457
|
transform: d,
|
|
3475
3458
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3476
3459
|
});
|
|
3477
3460
|
}
|
|
3478
3461
|
if (this.idleAnimationEngine) {
|
|
3479
3462
|
const d = this.entryAnimationEngine.getTiming().duration;
|
|
3480
|
-
this.idleAnimationEngine.register(
|
|
3463
|
+
this.idleAnimationEngine.register(c, h, this.imageElements.length, d);
|
|
3481
3464
|
}
|
|
3482
3465
|
}), r++);
|
|
3483
|
-
},
|
|
3466
|
+
}, l = () => {
|
|
3484
3467
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3485
3468
|
for (; this.displayQueue.length > 0; ) {
|
|
3486
|
-
const
|
|
3487
|
-
|
|
3469
|
+
const c = this.displayQueue.shift();
|
|
3470
|
+
c && s(c);
|
|
3488
3471
|
}
|
|
3489
3472
|
return;
|
|
3490
3473
|
}
|
|
@@ -3494,27 +3477,27 @@ class ti {
|
|
|
3494
3477
|
return;
|
|
3495
3478
|
}
|
|
3496
3479
|
if (this.displayQueue.length > 0) {
|
|
3497
|
-
const
|
|
3498
|
-
|
|
3480
|
+
const c = this.displayQueue.shift();
|
|
3481
|
+
c && s(c);
|
|
3499
3482
|
}
|
|
3500
3483
|
r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3501
3484
|
}, this.fullConfig.animation.queue.interval);
|
|
3502
3485
|
};
|
|
3503
3486
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3504
|
-
const
|
|
3487
|
+
const c = new IntersectionObserver((u) => {
|
|
3505
3488
|
u.forEach((h) => {
|
|
3506
|
-
h.isIntersecting && (
|
|
3489
|
+
h.isIntersecting && (l(), c.disconnect());
|
|
3507
3490
|
});
|
|
3508
3491
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3509
|
-
|
|
3492
|
+
c.observe(this.containerEl);
|
|
3510
3493
|
} else
|
|
3511
|
-
|
|
3512
|
-
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((
|
|
3494
|
+
l();
|
|
3495
|
+
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), a.forEach((c, u) => {
|
|
3513
3496
|
const h = document.createElement("div");
|
|
3514
3497
|
h.className = "fbn-ic-debug-center", h.style.position = "absolute", h.style.width = "12px", h.style.height = "12px", h.style.borderRadius = "50%", h.style.backgroundColor = "red", h.style.border = "2px solid yellow", h.style.zIndex = "9999", h.style.pointerEvents = "none";
|
|
3515
|
-
const d =
|
|
3498
|
+
const d = c.x, g = c.y;
|
|
3516
3499
|
h.style.left = `${d - 6}px`, h.style.top = `${g - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(g)})`, this.containerEl.appendChild(h);
|
|
3517
|
-
})), t.forEach((
|
|
3500
|
+
})), t.forEach((c, u) => {
|
|
3518
3501
|
const h = document.createElement("img");
|
|
3519
3502
|
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
|
|
3520
3503
|
const d = a[u];
|
|
@@ -3546,7 +3529,7 @@ class ti {
|
|
|
3546
3529
|
d.scale,
|
|
3547
3530
|
b,
|
|
3548
3531
|
i
|
|
3549
|
-
),
|
|
3532
|
+
), S = this.entryAnimationEngine.buildStartTransform(
|
|
3550
3533
|
m,
|
|
3551
3534
|
p,
|
|
3552
3535
|
d.rotation,
|
|
@@ -3564,8 +3547,8 @@ class ti {
|
|
|
3564
3547
|
finalTransform: v,
|
|
3565
3548
|
renderedWidth: b,
|
|
3566
3549
|
renderedHeight: i
|
|
3567
|
-
}), h.style.transform =
|
|
3568
|
-
}, h.onerror = () => r++, h.src =
|
|
3550
|
+
}), h.style.transform = S, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || w !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(w)), this.displayQueue.push(h);
|
|
3551
|
+
}, h.onerror = () => r++, h.src = c;
|
|
3569
3552
|
});
|
|
3570
3553
|
}
|
|
3571
3554
|
async handleImageClick(t, i) {
|
|
@@ -3589,7 +3572,7 @@ class ti {
|
|
|
3589
3572
|
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.idleAnimationEngine?.stopAll(), this.imagesLoaded = !1;
|
|
3590
3573
|
}
|
|
3591
3574
|
showLoading(t) {
|
|
3592
|
-
!this.fullConfig.
|
|
3575
|
+
!this.fullConfig.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
|
|
3593
3576
|
}
|
|
3594
3577
|
showError(t) {
|
|
3595
3578
|
this.errorEl && (this.errorEl.textContent = t, this.errorEl.classList.remove("fbn-ic-hidden"));
|
|
@@ -3598,7 +3581,7 @@ class ti {
|
|
|
3598
3581
|
this.errorEl && this.errorEl.classList.add("fbn-ic-hidden");
|
|
3599
3582
|
}
|
|
3600
3583
|
updateCounter(t) {
|
|
3601
|
-
!this.fullConfig.
|
|
3584
|
+
!this.fullConfig.ui.showImageCounter || !this.counterEl || (this.counterEl.textContent = `${t + 1} of ${this.imageElements.length}`, this.counterEl.classList.remove("fbn-ic-hidden"));
|
|
3602
3585
|
}
|
|
3603
3586
|
hideCounter() {
|
|
3604
3587
|
this.counterEl && this.counterEl.classList.add("fbn-ic-hidden");
|