@frybynite/image-cloud 0.8.3 → 0.9.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/dist/image-cloud-auto-init.js +531 -304
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +466 -239
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +3 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +54 -1
- package/dist/react.d.ts +54 -1
- package/dist/react.js +466 -239
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +54 -1
- package/dist/vue.js +467 -240
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +54 -1
- package/dist/web-component.js +824 -597
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
package/dist/image-cloud.js
CHANGED
|
@@ -4,11 +4,11 @@ const mt = Object.freeze({
|
|
|
4
4
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
5
5
|
lg: "0 8px 32px rgba(0,0,0,0.5)",
|
|
6
6
|
glow: "0 0 30px rgba(255,255,255,0.6)"
|
|
7
|
-
}),
|
|
7
|
+
}), It = Object.freeze({
|
|
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
|
+
}), Rt = 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 }),
|
|
@@ -50,16 +50,16 @@ const mt = Object.freeze({
|
|
|
50
50
|
focused: Object.freeze({
|
|
51
51
|
shadow: "none"
|
|
52
52
|
})
|
|
53
|
-
}), _t = Object.freeze({
|
|
54
|
-
tightness: 1
|
|
55
53
|
}), Ut = Object.freeze({
|
|
54
|
+
tightness: 1
|
|
55
|
+
}), Ht = Object.freeze({
|
|
56
56
|
rows: 1,
|
|
57
57
|
amplitude: 100,
|
|
58
58
|
frequency: 2,
|
|
59
59
|
phaseShift: 0,
|
|
60
60
|
synchronization: "offset"
|
|
61
61
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
62
|
-
}),
|
|
62
|
+
}), kt = Object.freeze({
|
|
63
63
|
spacing: 0
|
|
64
64
|
}), Nt = Object.freeze({
|
|
65
65
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
@@ -94,7 +94,7 @@ const mt = Object.freeze({
|
|
|
94
94
|
enabled: !1,
|
|
95
95
|
centers: !1,
|
|
96
96
|
loaders: !1
|
|
97
|
-
}), E = Object.freeze({
|
|
97
|
+
}), Gt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), qt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Bt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Xt = Object.freeze({ speed: 4e3, direction: "clockwise" }), Dt = Object.freeze({ type: "none" }), E = Object.freeze({
|
|
98
98
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
99
99
|
loaders: [],
|
|
100
100
|
// Shared loader settings and debug config
|
|
@@ -136,10 +136,8 @@ const mt = Object.freeze({
|
|
|
136
136
|
queue: Object.freeze({
|
|
137
137
|
enabled: !0,
|
|
138
138
|
// When false, all images display simultaneously
|
|
139
|
-
interval: 150
|
|
139
|
+
interval: 150
|
|
140
140
|
// ms between processing queue items (when enabled)
|
|
141
|
-
maxConcurrent: void 0
|
|
142
|
-
// STUB: Not implemented yet
|
|
143
141
|
}),
|
|
144
142
|
performance: Object.freeze({
|
|
145
143
|
useGPU: void 0,
|
|
@@ -168,7 +166,8 @@ const mt = Object.freeze({
|
|
|
168
166
|
path: yt,
|
|
169
167
|
rotation: vt,
|
|
170
168
|
scale: wt
|
|
171
|
-
})
|
|
169
|
+
}),
|
|
170
|
+
idle: Dt
|
|
172
171
|
}),
|
|
173
172
|
// Pattern-based interaction configuration
|
|
174
173
|
interaction: Object.freeze({
|
|
@@ -192,7 +191,8 @@ const mt = Object.freeze({
|
|
|
192
191
|
// STUB: Not implemented yet
|
|
193
192
|
doubleTapToFocus: void 0
|
|
194
193
|
// STUB: Not implemented yet
|
|
195
|
-
})
|
|
194
|
+
}),
|
|
195
|
+
disableDragging: !1
|
|
196
196
|
}),
|
|
197
197
|
// Pattern-based rendering configuration
|
|
198
198
|
rendering: Object.freeze({
|
|
@@ -220,7 +220,7 @@ function Z(o, t) {
|
|
|
220
220
|
const i = { ...o };
|
|
221
221
|
return t.border !== void 0 && (i.border = { ...o.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...o.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...o.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...o.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...o.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...o.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...o.outline, ...t.outline }), t.shadow !== void 0 && (i.shadow = t.shadow), t.clipPath !== void 0 && (i.clipPath = t.clipPath), t.opacity !== void 0 && (i.opacity = t.opacity), t.cursor !== void 0 && (i.cursor = t.cursor), t.className !== void 0 && (i.className = t.className), t.objectFit !== void 0 && (i.objectFit = t.objectFit), t.aspectRatio !== void 0 && (i.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (i.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (i.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (i.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (i.borderRadiusBottomLeft = t.borderRadiusBottomLeft), i;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function Yt(o, t) {
|
|
224
224
|
if (!t) return { ...o };
|
|
225
225
|
const i = Z(o.default, t.default), e = Z(
|
|
226
226
|
Z(i, o.hover),
|
|
@@ -235,7 +235,7 @@ function kt(o, t) {
|
|
|
235
235
|
focused: n
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function Vt(o, t) {
|
|
239
239
|
if (!t) return { ...o };
|
|
240
240
|
const i = { ...o };
|
|
241
241
|
if (t.sizing !== void 0 && (i.sizing = {
|
|
@@ -254,7 +254,7 @@ function Gt(o, t) {
|
|
|
254
254
|
}
|
|
255
255
|
return i;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Jt(o) {
|
|
258
258
|
const t = o.layout?.rotation;
|
|
259
259
|
if (t && "enabled" in t)
|
|
260
260
|
return {
|
|
@@ -264,7 +264,7 @@ function qt(o) {
|
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function Kt(o) {
|
|
268
268
|
const t = o.layout?.sizing?.variance;
|
|
269
269
|
if (t)
|
|
270
270
|
return {
|
|
@@ -275,8 +275,8 @@ function Xt(o) {
|
|
|
275
275
|
}
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
const t =
|
|
278
|
+
function Zt(o = {}) {
|
|
279
|
+
const t = Jt(o), i = Kt(o);
|
|
280
280
|
let e = o.image;
|
|
281
281
|
(t || i) && (e = {
|
|
282
282
|
...i || {},
|
|
@@ -300,12 +300,12 @@ function Yt(o = {}) {
|
|
|
300
300
|
}, s = {
|
|
301
301
|
loaders: n,
|
|
302
302
|
config: r,
|
|
303
|
-
image:
|
|
303
|
+
image: Vt(Ft, e),
|
|
304
304
|
layout: { ...E.layout },
|
|
305
305
|
animation: { ...E.animation },
|
|
306
306
|
interaction: { ...E.interaction },
|
|
307
307
|
rendering: { ...E.rendering },
|
|
308
|
-
styling:
|
|
308
|
+
styling: Yt(Mt, o.styling)
|
|
309
309
|
};
|
|
310
310
|
if (o.layout && (s.layout = {
|
|
311
311
|
...E.layout,
|
|
@@ -341,6 +341,9 @@ function Yt(o = {}) {
|
|
|
341
341
|
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : E.animation.entry.path,
|
|
342
342
|
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : E.animation.entry.rotation,
|
|
343
343
|
scale: o.animation.entry.scale ? { ...wt, ...o.animation.entry.scale } : E.animation.entry.scale
|
|
344
|
+
}), o.animation.idle && (s.animation.idle = {
|
|
345
|
+
...Dt,
|
|
346
|
+
...o.animation.idle
|
|
344
347
|
})), o.interaction && (s.interaction = {
|
|
345
348
|
...E.interaction,
|
|
346
349
|
...o.interaction
|
|
@@ -378,16 +381,16 @@ function Yt(o = {}) {
|
|
|
378
381
|
}
|
|
379
382
|
return s;
|
|
380
383
|
}
|
|
381
|
-
function
|
|
382
|
-
return { ...o ?
|
|
384
|
+
function Qt(o, t) {
|
|
385
|
+
return { ...o ? It[o] : It.playful, ...t };
|
|
383
386
|
}
|
|
384
|
-
function
|
|
385
|
-
return { ...o ?
|
|
387
|
+
function te(o, t) {
|
|
388
|
+
return { ...o ? Rt[o] : Rt.gentle, ...t };
|
|
386
389
|
}
|
|
387
|
-
function
|
|
390
|
+
function ee(o, t) {
|
|
388
391
|
return { ...o ? Tt[o] : Tt.gentle, ...t };
|
|
389
392
|
}
|
|
390
|
-
class
|
|
393
|
+
class ie {
|
|
391
394
|
constructor(t) {
|
|
392
395
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
393
396
|
}
|
|
@@ -546,8 +549,8 @@ class Kt {
|
|
|
546
549
|
function J(o, t, i) {
|
|
547
550
|
return o + (t - o) * i;
|
|
548
551
|
}
|
|
549
|
-
function
|
|
550
|
-
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l =
|
|
552
|
+
function ne(o, t, i, e) {
|
|
553
|
+
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l = oe(a, r);
|
|
551
554
|
let u = 0, h = 0, d = 1, f = n, b = !1;
|
|
552
555
|
for (let g = 0; g < l.length; g++)
|
|
553
556
|
if (o <= l[g].time) {
|
|
@@ -556,21 +559,21 @@ function Zt(o, t, i, e) {
|
|
|
556
559
|
}
|
|
557
560
|
const p = (o - h) / (d - h);
|
|
558
561
|
if (b)
|
|
559
|
-
u = 1 + f *
|
|
562
|
+
u = 1 + f * ot(p);
|
|
560
563
|
else if (h === 0)
|
|
561
|
-
u =
|
|
564
|
+
u = ot(p);
|
|
562
565
|
else {
|
|
563
566
|
const m = 1 + (l.find(
|
|
564
567
|
(y, w) => y.time > h && w > 0 && l[w - 1].isOvershoot
|
|
565
568
|
)?.overshoot || f);
|
|
566
|
-
u = J(m, 1,
|
|
569
|
+
u = J(m, 1, ot(p));
|
|
567
570
|
}
|
|
568
571
|
return {
|
|
569
572
|
x: t.x + s * u,
|
|
570
573
|
y: t.y + c * u
|
|
571
574
|
};
|
|
572
575
|
}
|
|
573
|
-
function
|
|
576
|
+
function oe(o, t) {
|
|
574
577
|
const i = [];
|
|
575
578
|
let e = 0.6;
|
|
576
579
|
i.push({ time: e, overshoot: 0, isOvershoot: !1 });
|
|
@@ -580,7 +583,7 @@ function Qt(o, t) {
|
|
|
580
583
|
e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
|
|
581
584
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
582
585
|
}
|
|
583
|
-
function
|
|
586
|
+
function se(o, t, i, e) {
|
|
584
587
|
const { stiffness: n, damping: a, mass: r, oscillations: s } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = a / (2 * Math.sqrt(n * r));
|
|
585
588
|
let d;
|
|
586
589
|
if (h < 1) {
|
|
@@ -593,24 +596,24 @@ function te(o, t, i, e) {
|
|
|
593
596
|
y: t.y + l * d
|
|
594
597
|
};
|
|
595
598
|
}
|
|
596
|
-
function
|
|
597
|
-
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? l / h : 1, b = a * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(b) * p, m =
|
|
599
|
+
function ae(o, t, i, e) {
|
|
600
|
+
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? l / h : 1, b = a * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(b) * p, m = re(o);
|
|
598
601
|
return {
|
|
599
602
|
x: J(t.x, i.x, m) + g * d,
|
|
600
603
|
y: J(t.y, i.y, m) + g * f
|
|
601
604
|
};
|
|
602
605
|
}
|
|
603
|
-
function
|
|
606
|
+
function ot(o) {
|
|
604
607
|
return 1 - (1 - o) * (1 - o);
|
|
605
608
|
}
|
|
606
|
-
function
|
|
609
|
+
function re(o) {
|
|
607
610
|
return 1 - Math.pow(1 - o, 3);
|
|
608
611
|
}
|
|
609
|
-
function
|
|
612
|
+
function ce(o, t, i) {
|
|
610
613
|
const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, c = e * r * s;
|
|
611
614
|
return t + c;
|
|
612
615
|
}
|
|
613
|
-
function
|
|
616
|
+
function le(o, t, i) {
|
|
614
617
|
const { overshoot: e, bounces: n } = i, a = [];
|
|
615
618
|
a.push({ time: 0.5, scale: e });
|
|
616
619
|
let r = e;
|
|
@@ -624,13 +627,13 @@ function ne(o, t, i) {
|
|
|
624
627
|
let h = 1;
|
|
625
628
|
for (let d = 0; d < a.length; d++)
|
|
626
629
|
if (o <= a[d].time) {
|
|
627
|
-
const f = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (o - f) / (a[d].time - f), g =
|
|
630
|
+
const f = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (o - f) / (a[d].time - f), g = ot(p);
|
|
628
631
|
h = b + (a[d].scale - b) * g;
|
|
629
632
|
break;
|
|
630
633
|
}
|
|
631
634
|
return h * t;
|
|
632
635
|
}
|
|
633
|
-
function
|
|
636
|
+
function he(o) {
|
|
634
637
|
const {
|
|
635
638
|
element: t,
|
|
636
639
|
startPosition: i,
|
|
@@ -646,38 +649,38 @@ function se(o) {
|
|
|
646
649
|
startRotation: d,
|
|
647
650
|
scaleConfig: f,
|
|
648
651
|
startScale: b
|
|
649
|
-
} = o, p = n.type, g = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = b !== void 0 && b !== l,
|
|
650
|
-
if ((p === "linear" || p === "arc") && !w && !(v ||
|
|
652
|
+
} = o, p = n.type, g = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = b !== void 0 && b !== l, I = f?.mode === "pop", x = f?.pop || { overshoot: 1.2, bounces: 1 };
|
|
653
|
+
if ((p === "linear" || p === "arc") && !w && !(v || I)) {
|
|
651
654
|
u && u();
|
|
652
655
|
return;
|
|
653
656
|
}
|
|
654
657
|
const z = performance.now(), L = -r / 2, _ = -s / 2;
|
|
655
658
|
function O(H) {
|
|
656
|
-
const
|
|
659
|
+
const k = H - z, T = Math.min(k / a, 1);
|
|
657
660
|
let D;
|
|
658
661
|
switch (p) {
|
|
659
662
|
case "bounce": {
|
|
660
|
-
const
|
|
663
|
+
const N = Qt(
|
|
661
664
|
n.bouncePreset,
|
|
662
665
|
n.bounce
|
|
663
666
|
);
|
|
664
|
-
D =
|
|
667
|
+
D = ne(T, i, e, N);
|
|
665
668
|
break;
|
|
666
669
|
}
|
|
667
670
|
case "elastic": {
|
|
668
|
-
const
|
|
671
|
+
const N = te(
|
|
669
672
|
n.elasticPreset,
|
|
670
673
|
n.elastic
|
|
671
674
|
);
|
|
672
|
-
D =
|
|
675
|
+
D = se(T, i, e, N);
|
|
673
676
|
break;
|
|
674
677
|
}
|
|
675
678
|
case "wave": {
|
|
676
|
-
const
|
|
679
|
+
const N = ee(
|
|
677
680
|
n.wavePreset,
|
|
678
681
|
n.wave
|
|
679
682
|
);
|
|
680
|
-
D =
|
|
683
|
+
D = ae(T, i, e, N);
|
|
681
684
|
break;
|
|
682
685
|
}
|
|
683
686
|
default:
|
|
@@ -688,16 +691,16 @@ function se(o) {
|
|
|
688
691
|
}
|
|
689
692
|
const G = D.x - e.x, U = D.y - e.y;
|
|
690
693
|
let M;
|
|
691
|
-
m ? M =
|
|
694
|
+
m ? M = ce(T, c, y) : g ? M = J(d, c, T) : M = c;
|
|
692
695
|
let A;
|
|
693
|
-
|
|
696
|
+
I ? A = le(T, l, x) : v ? A = J(b, l, T) : A = l, t.style.transform = `translate(${L}px, ${_}px) translate(${G}px, ${U}px) rotate(${M}deg) scale(${A})`, T < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
|
|
694
697
|
}
|
|
695
698
|
requestAnimationFrame(O);
|
|
696
699
|
}
|
|
697
|
-
function
|
|
700
|
+
function de(o) {
|
|
698
701
|
return o === "bounce" || o === "elastic" || o === "wave";
|
|
699
702
|
}
|
|
700
|
-
const
|
|
703
|
+
const ue = {
|
|
701
704
|
radial: "center",
|
|
702
705
|
spiral: "center",
|
|
703
706
|
grid: "top",
|
|
@@ -706,7 +709,7 @@ const re = {
|
|
|
706
709
|
wave: "left",
|
|
707
710
|
honeycomb: "center"
|
|
708
711
|
};
|
|
709
|
-
class
|
|
712
|
+
class ge {
|
|
710
713
|
constructor(t, i) {
|
|
711
714
|
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || wt;
|
|
712
715
|
}
|
|
@@ -714,7 +717,7 @@ class ce {
|
|
|
714
717
|
* Get the effective start position, considering layout-aware defaults
|
|
715
718
|
*/
|
|
716
719
|
resolveStartPosition() {
|
|
717
|
-
return this.config.start.position ? this.config.start.position :
|
|
720
|
+
return this.config.start.position ? this.config.start.position : ue[this.layoutAlgorithm] || "nearest-edge";
|
|
718
721
|
}
|
|
719
722
|
/**
|
|
720
723
|
* Calculate the starting position for an image's entry animation
|
|
@@ -859,7 +862,7 @@ class ce {
|
|
|
859
862
|
* Check if the current path type requires JavaScript animation
|
|
860
863
|
*/
|
|
861
864
|
requiresJSAnimation() {
|
|
862
|
-
return
|
|
865
|
+
return de(this.pathConfig.type);
|
|
863
866
|
}
|
|
864
867
|
/**
|
|
865
868
|
* Get the path configuration
|
|
@@ -1050,7 +1053,193 @@ class ce {
|
|
|
1050
1053
|
return 1 - (1 - t) * (1 - t);
|
|
1051
1054
|
}
|
|
1052
1055
|
}
|
|
1053
|
-
class
|
|
1056
|
+
class fe {
|
|
1057
|
+
constructor(t, i = 600) {
|
|
1058
|
+
this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Register an image element for idle animation.
|
|
1062
|
+
* Starts animation after entry duration completes.
|
|
1063
|
+
*/
|
|
1064
|
+
register(t, i, e, n) {
|
|
1065
|
+
if (this.entries.has(t)) return;
|
|
1066
|
+
const a = n ?? this.entryDurationMs, r = this.config.startDelay ?? a, s = {
|
|
1067
|
+
element: t,
|
|
1068
|
+
index: i,
|
|
1069
|
+
totalImages: e,
|
|
1070
|
+
animation: null,
|
|
1071
|
+
blinkAnimation: null,
|
|
1072
|
+
customTeardown: null,
|
|
1073
|
+
paused: !1,
|
|
1074
|
+
stopped: !1,
|
|
1075
|
+
startTimer: null
|
|
1076
|
+
};
|
|
1077
|
+
this.entries.set(t, s), s.startTimer = setTimeout(() => {
|
|
1078
|
+
s.startTimer = null, !s.stopped && !s.paused && this._startAnimation(s);
|
|
1079
|
+
}, r);
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Pause idle animation for a specific image (set to neutral then pause).
|
|
1083
|
+
*/
|
|
1084
|
+
pauseForImage(t) {
|
|
1085
|
+
const i = this.entries.get(t);
|
|
1086
|
+
i && (i.paused = !0, i.startTimer !== null && (clearTimeout(i.startTimer), i.startTimer = null), this._pauseEntry(i));
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Resume idle animation for a specific image by starting a fresh animation.
|
|
1090
|
+
* Always restarts rather than resuming, to avoid Web Animations API
|
|
1091
|
+
* quirks with negative-delay animations after pause/cancel.
|
|
1092
|
+
*/
|
|
1093
|
+
resumeForImage(t) {
|
|
1094
|
+
const i = this.entries.get(t);
|
|
1095
|
+
!i || i.stopped || (i.paused = !1, this._startAnimation(i));
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Stop and remove idle animation for a specific image.
|
|
1099
|
+
*/
|
|
1100
|
+
stopForImage(t) {
|
|
1101
|
+
const i = this.entries.get(t);
|
|
1102
|
+
i && (i.stopped = !0, i.startTimer !== null && (clearTimeout(i.startTimer), i.startTimer = null), this._cancelEntry(i), this.entries.delete(t));
|
|
1103
|
+
}
|
|
1104
|
+
pauseAll() {
|
|
1105
|
+
for (const t of this.entries.values())
|
|
1106
|
+
t.paused = !0, t.startTimer !== null && (clearTimeout(t.startTimer), t.startTimer = null), this._pauseEntry(t);
|
|
1107
|
+
}
|
|
1108
|
+
resumeAll() {
|
|
1109
|
+
for (const t of this.entries.values())
|
|
1110
|
+
t.stopped || (t.paused = !1, this._startAnimation(t));
|
|
1111
|
+
}
|
|
1112
|
+
stopAll() {
|
|
1113
|
+
for (const t of this.entries.values())
|
|
1114
|
+
t.stopped = !0, t.startTimer !== null && (clearTimeout(t.startTimer), t.startTimer = null), this._cancelEntry(t);
|
|
1115
|
+
this.entries.clear(), this._stopTogetherLoop();
|
|
1116
|
+
}
|
|
1117
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
1118
|
+
// Private helpers
|
|
1119
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
1120
|
+
_startAnimation(t) {
|
|
1121
|
+
const { type: i } = this.config;
|
|
1122
|
+
switch (i) {
|
|
1123
|
+
case "wiggle":
|
|
1124
|
+
this._startWiggle(t);
|
|
1125
|
+
break;
|
|
1126
|
+
case "pulse":
|
|
1127
|
+
this._startPulse(t);
|
|
1128
|
+
break;
|
|
1129
|
+
case "blink":
|
|
1130
|
+
this._startBlink(t);
|
|
1131
|
+
break;
|
|
1132
|
+
case "spin":
|
|
1133
|
+
this._startSpin(t);
|
|
1134
|
+
break;
|
|
1135
|
+
case "custom":
|
|
1136
|
+
this._startCustom(t);
|
|
1137
|
+
break;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
_startWiggle(t) {
|
|
1141
|
+
const i = { ...Gt, ...this.config.wiggle }, e = [
|
|
1142
|
+
{ transform: "rotate(0deg)", offset: 0 },
|
|
1143
|
+
{ transform: `rotate(${i.maxAngle}deg)`, offset: 0.25 },
|
|
1144
|
+
{ transform: "rotate(0deg)", offset: 0.5 },
|
|
1145
|
+
{ transform: `rotate(${-i.maxAngle}deg)`, offset: 0.75 },
|
|
1146
|
+
{ transform: "rotate(0deg)", offset: 1 }
|
|
1147
|
+
];
|
|
1148
|
+
i.sync === "together" ? (t.animation = t.element.animate(e, {
|
|
1149
|
+
duration: i.speed,
|
|
1150
|
+
iterations: 1 / 0,
|
|
1151
|
+
composite: "add",
|
|
1152
|
+
fill: "both"
|
|
1153
|
+
}), t.animation.pause(), this._startTogetherLoop(i.speed)) : t.animation = t.element.animate(e, {
|
|
1154
|
+
duration: i.speed,
|
|
1155
|
+
delay: -(Math.random() * i.speed),
|
|
1156
|
+
iterations: 1 / 0,
|
|
1157
|
+
composite: "add"
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
_startPulse(t) {
|
|
1161
|
+
const i = { ...qt, ...this.config.pulse }, e = [
|
|
1162
|
+
{ transform: "scale(1)", offset: 0 },
|
|
1163
|
+
{ transform: `scale(${i.maxScale})`, offset: 0.25 },
|
|
1164
|
+
{ transform: "scale(1)", offset: 0.5 },
|
|
1165
|
+
{ transform: `scale(${i.minScale})`, offset: 0.75 },
|
|
1166
|
+
{ transform: "scale(1)", offset: 1 }
|
|
1167
|
+
];
|
|
1168
|
+
i.sync === "together" ? (t.animation = t.element.animate(e, {
|
|
1169
|
+
duration: i.speed,
|
|
1170
|
+
iterations: 1 / 0,
|
|
1171
|
+
composite: "add",
|
|
1172
|
+
fill: "both"
|
|
1173
|
+
}), t.animation.pause(), this._startTogetherLoop(i.speed)) : t.animation = t.element.animate(e, {
|
|
1174
|
+
duration: i.speed,
|
|
1175
|
+
delay: -(Math.random() * i.speed),
|
|
1176
|
+
iterations: 1 / 0,
|
|
1177
|
+
composite: "add"
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
_startBlink(t) {
|
|
1181
|
+
const i = { ...Bt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
|
|
1182
|
+
let a, r;
|
|
1183
|
+
i.style === "fade" ? (a = [
|
|
1184
|
+
{ opacity: n, offset: 0 },
|
|
1185
|
+
{ opacity: 0, offset: 0.5 },
|
|
1186
|
+
{ opacity: n, offset: 1 }
|
|
1187
|
+
], r = {
|
|
1188
|
+
duration: i.speed,
|
|
1189
|
+
delay: e,
|
|
1190
|
+
iterations: 1 / 0,
|
|
1191
|
+
easing: "ease-in-out"
|
|
1192
|
+
}) : (a = [
|
|
1193
|
+
{ opacity: n, offset: 0 },
|
|
1194
|
+
{ opacity: n, offset: i.onRatio },
|
|
1195
|
+
{ opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
|
|
1196
|
+
{ opacity: 0, offset: 0.99 },
|
|
1197
|
+
{ opacity: n, offset: 1 }
|
|
1198
|
+
], r = {
|
|
1199
|
+
duration: i.speed,
|
|
1200
|
+
delay: e,
|
|
1201
|
+
iterations: 1 / 0
|
|
1202
|
+
}), t.blinkAnimation = t.element.animate(a, r);
|
|
1203
|
+
}
|
|
1204
|
+
_startSpin(t) {
|
|
1205
|
+
const i = { ...Xt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
|
|
1206
|
+
t.animation = t.element.animate(
|
|
1207
|
+
[{ transform: "rotate(0deg)" }, { transform: `rotate(${e}deg)` }],
|
|
1208
|
+
{
|
|
1209
|
+
duration: i.speed,
|
|
1210
|
+
iterations: 1 / 0,
|
|
1211
|
+
easing: "linear",
|
|
1212
|
+
composite: "add"
|
|
1213
|
+
}
|
|
1214
|
+
);
|
|
1215
|
+
}
|
|
1216
|
+
_startCustom(t) {
|
|
1217
|
+
const i = this.config.custom;
|
|
1218
|
+
if (!i) return;
|
|
1219
|
+
const e = i({ element: t.element, index: t.index, totalImages: t.totalImages });
|
|
1220
|
+
typeof e == "function" ? t.customTeardown = e : e && typeof e.play == "function" && (t.animation = e);
|
|
1221
|
+
}
|
|
1222
|
+
_startTogetherLoop(t) {
|
|
1223
|
+
if (this.togetherSpeed = t, this.togetherRafId !== null) return;
|
|
1224
|
+
const i = () => {
|
|
1225
|
+
const e = performance.now() % this.togetherSpeed;
|
|
1226
|
+
for (const n of this.entries.values())
|
|
1227
|
+
!n.stopped && !n.paused && n.animation && (n.animation.currentTime = e);
|
|
1228
|
+
this.togetherRafId = requestAnimationFrame(i);
|
|
1229
|
+
};
|
|
1230
|
+
this.togetherRafId = requestAnimationFrame(i);
|
|
1231
|
+
}
|
|
1232
|
+
_stopTogetherLoop() {
|
|
1233
|
+
this.togetherRafId !== null && (cancelAnimationFrame(this.togetherRafId), this.togetherRafId = null);
|
|
1234
|
+
}
|
|
1235
|
+
_pauseEntry(t) {
|
|
1236
|
+
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null);
|
|
1237
|
+
}
|
|
1238
|
+
_cancelEntry(t) {
|
|
1239
|
+
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
class me {
|
|
1054
1243
|
constructor(t, i = {}) {
|
|
1055
1244
|
this.config = t, this.imageConfig = i;
|
|
1056
1245
|
}
|
|
@@ -1062,11 +1251,11 @@ class le {
|
|
|
1062
1251
|
* @returns Array of layout objects with position, rotation, scale
|
|
1063
1252
|
*/
|
|
1064
1253
|
generate(t, i, e = {}) {
|
|
1065
|
-
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = 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, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = c * 1.5 / 2, m = c / 2, y = a - s - g, w = r - s - m, v = s + g,
|
|
1254
|
+
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = 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, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = c * 1.5 / 2, m = c / 2, y = a - s - g, w = r - s - m, v = s + g, I = s + m;
|
|
1066
1255
|
for (let x = 0; x < t; x++) {
|
|
1067
|
-
const
|
|
1256
|
+
const R = this.random(v, y), z = this.random(I, w), L = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, f) : 1, O = c * _, H = {
|
|
1068
1257
|
id: x,
|
|
1069
|
-
x:
|
|
1258
|
+
x: R,
|
|
1070
1259
|
y: z,
|
|
1071
1260
|
rotation: L,
|
|
1072
1261
|
scale: _,
|
|
@@ -1086,7 +1275,7 @@ class le {
|
|
|
1086
1275
|
return Math.random() * (i - t) + t;
|
|
1087
1276
|
}
|
|
1088
1277
|
}
|
|
1089
|
-
class
|
|
1278
|
+
class pe {
|
|
1090
1279
|
constructor(t, i = {}) {
|
|
1091
1280
|
this.config = t, this.imageConfig = i;
|
|
1092
1281
|
}
|
|
@@ -1099,9 +1288,9 @@ class he {
|
|
|
1099
1288
|
*/
|
|
1100
1289
|
generate(t, i, e = {}) {
|
|
1101
1290
|
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = 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, f = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
|
|
1102
|
-
...
|
|
1291
|
+
...Ut,
|
|
1103
1292
|
...this.config.radial
|
|
1104
|
-
}, g = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50,
|
|
1293
|
+
}, g = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, I = Math.max(g * 0.8, Math.min(
|
|
1105
1294
|
m - v - g / 2,
|
|
1106
1295
|
y - v - g / 2
|
|
1107
1296
|
));
|
|
@@ -1119,32 +1308,32 @@ class he {
|
|
|
1119
1308
|
// Center image is highest
|
|
1120
1309
|
});
|
|
1121
1310
|
}
|
|
1122
|
-
let x = 1,
|
|
1311
|
+
let x = 1, R = 1;
|
|
1123
1312
|
for (; x < t; ) {
|
|
1124
|
-
const z =
|
|
1313
|
+
const z = R / w, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(g * 0.8, I / w * 1.5 / p.tightness), O = R * _, H = O * 1.5, k = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), T = this.estimateWidth(g), D = Math.floor(k / (T * 0.7));
|
|
1125
1314
|
if (D === 0) {
|
|
1126
|
-
|
|
1315
|
+
R++;
|
|
1127
1316
|
continue;
|
|
1128
1317
|
}
|
|
1129
|
-
const G = 2 * Math.PI / D, U =
|
|
1318
|
+
const G = 2 * Math.PI / D, U = R * (20 * Math.PI / 180);
|
|
1130
1319
|
for (let M = 0; M < D && x < t; M++) {
|
|
1131
|
-
const A = M * G + U,
|
|
1320
|
+
const A = M * G + U, N = f ? this.random(h, d) : 1, B = L * N, C = g * B;
|
|
1132
1321
|
let $ = m + Math.cos(A) * H, F = y + Math.sin(A) * O;
|
|
1133
|
-
const P = C * 1.5 / 2,
|
|
1134
|
-
$ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P), F -
|
|
1135
|
-
const
|
|
1322
|
+
const P = C * 1.5 / 2, j = C / 2;
|
|
1323
|
+
$ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P), F - j < v ? F = v + j : F + j > r - v && (F = r - v - j);
|
|
1324
|
+
const Y = c === "random" ? this.random(l, u) : 0;
|
|
1136
1325
|
n.push({
|
|
1137
1326
|
id: x,
|
|
1138
1327
|
x: $,
|
|
1139
1328
|
y: F,
|
|
1140
|
-
rotation:
|
|
1141
|
-
scale:
|
|
1329
|
+
rotation: Y,
|
|
1330
|
+
scale: B,
|
|
1142
1331
|
baseSize: C,
|
|
1143
|
-
zIndex: Math.max(1, 100 -
|
|
1332
|
+
zIndex: Math.max(1, 100 - R)
|
|
1144
1333
|
// Outer rings have lower z-index
|
|
1145
1334
|
}), x++;
|
|
1146
1335
|
}
|
|
1147
|
-
|
|
1336
|
+
R++;
|
|
1148
1337
|
}
|
|
1149
1338
|
return n;
|
|
1150
1339
|
}
|
|
@@ -1167,7 +1356,7 @@ class he {
|
|
|
1167
1356
|
return Math.random() * (i - t) + t;
|
|
1168
1357
|
}
|
|
1169
1358
|
}
|
|
1170
|
-
const
|
|
1359
|
+
const be = {
|
|
1171
1360
|
columns: "auto",
|
|
1172
1361
|
rows: "auto",
|
|
1173
1362
|
stagger: "none",
|
|
@@ -1195,7 +1384,7 @@ const de = {
|
|
|
1195
1384
|
{ x: 0, y: 1 }
|
|
1196
1385
|
// down
|
|
1197
1386
|
];
|
|
1198
|
-
class
|
|
1387
|
+
class ye {
|
|
1199
1388
|
constructor(t, i = {}) {
|
|
1200
1389
|
this.config = t, this.imageConfig = i;
|
|
1201
1390
|
}
|
|
@@ -1207,13 +1396,13 @@ class ue {
|
|
|
1207
1396
|
* @returns Array of layout objects with position, rotation, scale
|
|
1208
1397
|
*/
|
|
1209
1398
|
generate(t, i, e = {}) {
|
|
1210
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1399
|
+
const n = [], { width: a, height: r } = i, s = { ...be, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = a - 2 * c, p = r - 2 * c, { columns: g, rows: m } = this.calculateGridDimensions(
|
|
1211
1400
|
t,
|
|
1212
1401
|
b,
|
|
1213
1402
|
p,
|
|
1214
1403
|
l,
|
|
1215
1404
|
s
|
|
1216
|
-
), y = s.stagger === "row", w = s.stagger === "column", v = y ? g + 0.5 : g,
|
|
1405
|
+
), y = s.stagger === "row", w = s.stagger === "column", v = y ? g + 0.5 : g, I = w ? m + 0.5 : m, x = (b - s.gap * (g - 1)) / v, R = (p - s.gap * (m - 1)) / I, z = y ? x / 2 : 0, L = w ? R / 2 : 0, _ = 1 + s.overlap, O = Math.min(x, R) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, k = g * x + (g - 1) * s.gap + z, T = m * R + (m - 1) * s.gap + L, D = c + (b - k) / 2, G = c + (p - T) / 2, U = g * m, M = s.columns !== "auto" && s.rows !== "auto", A = M && t > U;
|
|
1217
1406
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1218
1407
|
gridConfigColumns: s.columns,
|
|
1219
1408
|
gridConfigRows: s.rows,
|
|
@@ -1224,43 +1413,43 @@ class ue {
|
|
|
1224
1413
|
imageCount: t,
|
|
1225
1414
|
isOverflowMode: A
|
|
1226
1415
|
});
|
|
1227
|
-
const
|
|
1416
|
+
const N = A ? new Array(U).fill(0) : [], B = Math.min(x, R) * s.overflowOffset;
|
|
1228
1417
|
for (let C = 0; C < t; C++) {
|
|
1229
|
-
let $, F,
|
|
1418
|
+
let $, F, X = 0;
|
|
1230
1419
|
if (A && C >= U) {
|
|
1231
|
-
const q = C - U,
|
|
1232
|
-
|
|
1420
|
+
const q = C - U, W = q % U;
|
|
1421
|
+
X = Math.floor(q / U) + 1, N[W]++, s.fillDirection === "row" ? ($ = W % g, F = Math.floor(W / g)) : (F = W % m, $ = Math.floor(W / m));
|
|
1233
1422
|
} else
|
|
1234
1423
|
s.fillDirection === "row" ? ($ = C % g, F = Math.floor(C / g)) : (F = C % m, $ = Math.floor(C / m));
|
|
1235
|
-
let P = D + $ * (x + s.gap) + x / 2,
|
|
1236
|
-
if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (
|
|
1237
|
-
const q = (
|
|
1238
|
-
P +=
|
|
1424
|
+
let P = D + $ * (x + s.gap) + x / 2, j = G + F * (R + s.gap) + R / 2;
|
|
1425
|
+
if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (j += R / 2), X > 0) {
|
|
1426
|
+
const q = (X - 1) % At.length, W = At[q];
|
|
1427
|
+
P += W.x * B, j += W.y * B;
|
|
1239
1428
|
}
|
|
1240
1429
|
if (s.jitter > 0) {
|
|
1241
|
-
const q = x / 2 * s.jitter,
|
|
1242
|
-
P += this.random(-q, q),
|
|
1430
|
+
const q = x / 2 * s.jitter, W = R / 2 * s.jitter;
|
|
1431
|
+
P += this.random(-q, q), j += this.random(-W, W);
|
|
1243
1432
|
}
|
|
1244
|
-
let
|
|
1433
|
+
let Y = P, V = j;
|
|
1245
1434
|
if (!A && s.fillDirection === "row") {
|
|
1246
1435
|
const q = t % g || g;
|
|
1247
1436
|
if (F === Math.floor((t - 1) / g) && q < g) {
|
|
1248
1437
|
const St = q * x + (q - 1) * s.gap;
|
|
1249
1438
|
let gt = 0;
|
|
1250
|
-
s.alignment === "center" ? gt = (
|
|
1439
|
+
s.alignment === "center" ? gt = (k - St) / 2 : s.alignment === "end" && (gt = k - St), Y += gt;
|
|
1251
1440
|
}
|
|
1252
1441
|
}
|
|
1253
|
-
const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2,
|
|
1254
|
-
|
|
1442
|
+
const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt = c + it, ht = a - c - it, Pt = c + nt, _t = r - c - nt;
|
|
1443
|
+
Y = Math.max(lt, Math.min(Y, ht)), V = Math.max(Pt, Math.min(V, _t));
|
|
1255
1444
|
let dt = 0;
|
|
1256
1445
|
if (u === "random") {
|
|
1257
|
-
const q = this.imageConfig.rotation?.range?.min ?? -15,
|
|
1258
|
-
s.jitter > 0 ? dt = this.random(q * s.jitter,
|
|
1446
|
+
const q = this.imageConfig.rotation?.range?.min ?? -15, W = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1447
|
+
s.jitter > 0 ? dt = this.random(q * s.jitter, W * s.jitter) : dt = this.random(q, W);
|
|
1259
1448
|
}
|
|
1260
1449
|
let ut;
|
|
1261
|
-
A &&
|
|
1450
|
+
A && X > 0 ? ut = 50 - X : ut = A ? 100 + C : C + 1, n.push({
|
|
1262
1451
|
id: C,
|
|
1263
|
-
x:
|
|
1452
|
+
x: Y,
|
|
1264
1453
|
y: V,
|
|
1265
1454
|
rotation: dt,
|
|
1266
1455
|
scale: rt,
|
|
@@ -1295,14 +1484,14 @@ class ue {
|
|
|
1295
1484
|
return Math.random() * (i - t) + t;
|
|
1296
1485
|
}
|
|
1297
1486
|
}
|
|
1298
|
-
const
|
|
1487
|
+
const ve = Math.PI * (3 - Math.sqrt(5)), we = {
|
|
1299
1488
|
spiralType: "golden",
|
|
1300
1489
|
direction: "counterclockwise",
|
|
1301
1490
|
tightness: 1,
|
|
1302
1491
|
scaleDecay: 0,
|
|
1303
1492
|
startAngle: 0
|
|
1304
1493
|
};
|
|
1305
|
-
class
|
|
1494
|
+
class xe {
|
|
1306
1495
|
constructor(t, i = {}) {
|
|
1307
1496
|
this.config = t, this.imageConfig = i;
|
|
1308
1497
|
}
|
|
@@ -1314,36 +1503,36 @@ class me {
|
|
|
1314
1503
|
* @returns Array of layout objects with position, rotation, scale
|
|
1315
1504
|
*/
|
|
1316
1505
|
generate(t, i, e = {}) {
|
|
1317
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1506
|
+
const n = [], { width: a, height: r } = i, s = { ...we, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, y = r / 2, w = Math.min(
|
|
1318
1507
|
m - c - l / 2,
|
|
1319
1508
|
y - c - l / 2
|
|
1320
1509
|
), v = s.direction === "clockwise" ? -1 : 1;
|
|
1321
|
-
for (let
|
|
1322
|
-
let x,
|
|
1510
|
+
for (let I = 0; I < t; I++) {
|
|
1511
|
+
let x, R;
|
|
1323
1512
|
if (s.spiralType === "golden")
|
|
1324
|
-
x =
|
|
1513
|
+
x = I * ve * v + s.startAngle, R = this.calculateGoldenRadius(I, t, w, s.tightness);
|
|
1325
1514
|
else if (s.spiralType === "archimedean") {
|
|
1326
|
-
const P =
|
|
1327
|
-
x = P * v + s.startAngle,
|
|
1515
|
+
const P = I * 0.5 * s.tightness;
|
|
1516
|
+
x = P * v + s.startAngle, R = this.calculateArchimedeanRadius(P, t, w, s.tightness);
|
|
1328
1517
|
} else {
|
|
1329
|
-
const P =
|
|
1330
|
-
x = P * v + s.startAngle,
|
|
1518
|
+
const P = I * 0.3 * s.tightness;
|
|
1519
|
+
x = P * v + s.startAngle, R = this.calculateLogarithmicRadius(P, t, w, s.tightness);
|
|
1331
1520
|
}
|
|
1332
|
-
const z = m + Math.cos(x) *
|
|
1521
|
+
const z = m + Math.cos(x) * R, L = y + Math.sin(x) * R, _ = R / w, O = g > 0 ? 1 - _ * g * 0.5 : 1, H = p ? this.random(f, b) : 1, k = O * H, T = l * k, G = T * 1.5 / 2, U = T / 2, M = c + G, A = a - c - G, N = c + U, B = r - c - U, C = Math.max(M, Math.min(z, A)), $ = Math.max(N, Math.min(L, B));
|
|
1333
1522
|
let F = 0;
|
|
1334
1523
|
if (u === "random") {
|
|
1335
|
-
const P = x * 180 / Math.PI % 360,
|
|
1336
|
-
F = s.spiralType === "golden" ?
|
|
1337
|
-
} else u === "tangent" && (F = this.calculateSpiralTangent(x,
|
|
1338
|
-
const
|
|
1524
|
+
const P = x * 180 / Math.PI % 360, j = this.random(h, d);
|
|
1525
|
+
F = s.spiralType === "golden" ? j : P * 0.1 + j * 0.9;
|
|
1526
|
+
} else u === "tangent" && (F = this.calculateSpiralTangent(x, R, s));
|
|
1527
|
+
const X = t - I;
|
|
1339
1528
|
n.push({
|
|
1340
|
-
id:
|
|
1529
|
+
id: I,
|
|
1341
1530
|
x: C,
|
|
1342
1531
|
y: $,
|
|
1343
1532
|
rotation: F,
|
|
1344
|
-
scale:
|
|
1533
|
+
scale: k,
|
|
1345
1534
|
baseSize: T,
|
|
1346
|
-
zIndex:
|
|
1535
|
+
zIndex: X
|
|
1347
1536
|
});
|
|
1348
1537
|
}
|
|
1349
1538
|
return n;
|
|
@@ -1396,7 +1585,7 @@ class me {
|
|
|
1396
1585
|
return Math.random() * (i - t) + t;
|
|
1397
1586
|
}
|
|
1398
1587
|
}
|
|
1399
|
-
const
|
|
1588
|
+
const Ee = {
|
|
1400
1589
|
clusterCount: "auto",
|
|
1401
1590
|
clusterSpread: 150,
|
|
1402
1591
|
clusterSpacing: 200,
|
|
@@ -1404,7 +1593,7 @@ const pe = {
|
|
|
1404
1593
|
overlap: 0.3,
|
|
1405
1594
|
distribution: "gaussian"
|
|
1406
1595
|
};
|
|
1407
|
-
class
|
|
1596
|
+
class Se {
|
|
1408
1597
|
constructor(t, i = {}) {
|
|
1409
1598
|
this.config = t, this.imageConfig = i;
|
|
1410
1599
|
}
|
|
@@ -1416,7 +1605,7 @@ class be {
|
|
|
1416
1605
|
* @returns Array of layout objects with position, rotation, scale
|
|
1417
1606
|
*/
|
|
1418
1607
|
generate(t, i, e = {}) {
|
|
1419
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1608
|
+
const n = [], { width: a, height: r } = i, s = { ...Ee, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.calculateClusterCount(
|
|
1420
1609
|
t,
|
|
1421
1610
|
s.clusterCount,
|
|
1422
1611
|
a,
|
|
@@ -1433,28 +1622,28 @@ class be {
|
|
|
1433
1622
|
y[v % g]++;
|
|
1434
1623
|
let w = 0;
|
|
1435
1624
|
for (let v = 0; v < g; v++) {
|
|
1436
|
-
const
|
|
1437
|
-
for (let
|
|
1625
|
+
const I = m[v], x = y[v];
|
|
1626
|
+
for (let R = 0; R < x; R++) {
|
|
1438
1627
|
let z, L;
|
|
1439
1628
|
if (s.distribution === "gaussian")
|
|
1440
|
-
z = this.gaussianRandom() *
|
|
1629
|
+
z = this.gaussianRandom() * I.spread, L = this.gaussianRandom() * I.spread;
|
|
1441
1630
|
else {
|
|
1442
|
-
const F = this.random(0, Math.PI * 2),
|
|
1443
|
-
z = Math.cos(F) *
|
|
1631
|
+
const F = this.random(0, Math.PI * 2), X = this.random(0, I.spread);
|
|
1632
|
+
z = Math.cos(F) * X, L = Math.sin(F) * X;
|
|
1444
1633
|
}
|
|
1445
1634
|
const _ = 1 + s.overlap * 0.5, O = 1 + s.overlap * 0.3;
|
|
1446
1635
|
z /= _, L /= _;
|
|
1447
|
-
const H = p ? this.random(f, b) : 1,
|
|
1448
|
-
let D =
|
|
1636
|
+
const H = p ? this.random(f, b) : 1, k = O * H, T = l * k;
|
|
1637
|
+
let D = I.x + z, G = I.y + L;
|
|
1449
1638
|
const M = T * 1.5 / 2, A = T / 2;
|
|
1450
1639
|
D = Math.max(c + M, Math.min(D, a - c - M)), G = Math.max(c + A, Math.min(G, r - c - A));
|
|
1451
|
-
const
|
|
1640
|
+
const N = u === "random" ? this.random(h, d) : 0, C = Math.sqrt(z * z + L * L) / I.spread, $ = Math.round((1 - C) * 50) + 1;
|
|
1452
1641
|
n.push({
|
|
1453
1642
|
id: w,
|
|
1454
1643
|
x: D,
|
|
1455
1644
|
y: G,
|
|
1456
|
-
rotation:
|
|
1457
|
-
scale:
|
|
1645
|
+
rotation: N,
|
|
1646
|
+
scale: k,
|
|
1458
1647
|
baseSize: T,
|
|
1459
1648
|
zIndex: $
|
|
1460
1649
|
}), w++;
|
|
@@ -1488,8 +1677,8 @@ class be {
|
|
|
1488
1677
|
};
|
|
1489
1678
|
let m = 1 / 0;
|
|
1490
1679
|
for (const y of r) {
|
|
1491
|
-
const w = g.x - y.x, v = g.y - y.y,
|
|
1492
|
-
m = Math.min(m,
|
|
1680
|
+
const w = g.x - y.x, v = g.y - y.y, I = Math.sqrt(w * w + v * v);
|
|
1681
|
+
m = Math.min(m, I);
|
|
1493
1682
|
}
|
|
1494
1683
|
if ((r.length === 0 || m > b) && (f = g, b = m), m >= a.clusterSpacing)
|
|
1495
1684
|
break;
|
|
@@ -1522,7 +1711,7 @@ class be {
|
|
|
1522
1711
|
return Math.random() * (i - t) + t;
|
|
1523
1712
|
}
|
|
1524
1713
|
}
|
|
1525
|
-
class
|
|
1714
|
+
class Ie {
|
|
1526
1715
|
constructor(t, i = {}) {
|
|
1527
1716
|
this.config = t, this.imageConfig = i;
|
|
1528
1717
|
}
|
|
@@ -1535,26 +1724,26 @@ class ye {
|
|
|
1535
1724
|
*/
|
|
1536
1725
|
generate(t, i, e = {}) {
|
|
1537
1726
|
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = 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, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, p = e.fixedHeight ?? s, g = {
|
|
1538
|
-
...
|
|
1727
|
+
...Ht,
|
|
1539
1728
|
...this.config.wave
|
|
1540
|
-
}, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization:
|
|
1729
|
+
}, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization: I } = g, x = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = a - c - L, H = O - _, k = x > 1 ? H / (x - 1) : 0, T = c + y + p / 2, D = r - c - y - p / 2, G = D - T, U = m > 1 ? G / (m - 1) : 0;
|
|
1541
1730
|
let M = 0;
|
|
1542
1731
|
for (let A = 0; A < m && M < t; A++) {
|
|
1543
|
-
const
|
|
1544
|
-
let
|
|
1545
|
-
|
|
1732
|
+
const N = m === 1 ? (T + D) / 2 : T + A * U;
|
|
1733
|
+
let B = 0;
|
|
1734
|
+
I === "offset" ? B = A * v : I === "alternating" && (B = A * Math.PI);
|
|
1546
1735
|
for (let C = 0; C < x && M < t; C++) {
|
|
1547
|
-
const $ = x === 1 ? (_ + O) / 2 : _ + C *
|
|
1736
|
+
const $ = x === 1 ? (_ + O) / 2 : _ + C * k, F = this.calculateWaveY($, a, y, w, B), X = $, P = N + F, j = b ? this.random(d, f) : 1, Y = p * j;
|
|
1548
1737
|
let V = 0;
|
|
1549
|
-
l === "tangent" ? V = this.calculateRotation($, a, y, w,
|
|
1550
|
-
const K =
|
|
1738
|
+
l === "tangent" ? V = this.calculateRotation($, a, y, w, B) : l === "random" && (V = this.random(u, h));
|
|
1739
|
+
const K = Y * 1.5 / 2, ct = Y / 2, it = c + K, nt = a - c - K, lt = c + ct, ht = r - c - ct;
|
|
1551
1740
|
n.push({
|
|
1552
1741
|
id: M,
|
|
1553
|
-
x: Math.max(it, Math.min(
|
|
1742
|
+
x: Math.max(it, Math.min(X, nt)),
|
|
1554
1743
|
y: Math.max(lt, Math.min(P, ht)),
|
|
1555
1744
|
rotation: V,
|
|
1556
|
-
scale:
|
|
1557
|
-
baseSize:
|
|
1745
|
+
scale: j,
|
|
1746
|
+
baseSize: Y,
|
|
1558
1747
|
zIndex: M + 1
|
|
1559
1748
|
}), M++;
|
|
1560
1749
|
}
|
|
@@ -1612,21 +1801,21 @@ const xt = 100, Q = 100 / Math.sqrt(3), Et = [
|
|
|
1612
1801
|
// lower-left
|
|
1613
1802
|
[0, 50]
|
|
1614
1803
|
// left
|
|
1615
|
-
],
|
|
1616
|
-
function
|
|
1804
|
+
], Re = Et[1][0] / xt, Te = Et[2][1] / xt;
|
|
1805
|
+
function Ae(o) {
|
|
1617
1806
|
return {
|
|
1618
|
-
colStep:
|
|
1619
|
-
rowOffset:
|
|
1807
|
+
colStep: Re * o,
|
|
1808
|
+
rowOffset: Te * o
|
|
1620
1809
|
};
|
|
1621
1810
|
}
|
|
1622
|
-
function
|
|
1623
|
-
const { colStep: r } =
|
|
1811
|
+
function Ce(o, t, i, e, n, a) {
|
|
1812
|
+
const { colStep: r } = Ae(a);
|
|
1624
1813
|
return {
|
|
1625
1814
|
px: e + r * o,
|
|
1626
1815
|
py: n + a * (t + o / 2)
|
|
1627
1816
|
};
|
|
1628
1817
|
}
|
|
1629
|
-
const
|
|
1818
|
+
const Le = [
|
|
1630
1819
|
[1, 0, -1],
|
|
1631
1820
|
[0, 1, -1],
|
|
1632
1821
|
[-1, 1, 0],
|
|
@@ -1634,16 +1823,16 @@ const Se = [
|
|
|
1634
1823
|
[0, -1, 1],
|
|
1635
1824
|
[1, -1, 0]
|
|
1636
1825
|
];
|
|
1637
|
-
function
|
|
1826
|
+
function Me(o) {
|
|
1638
1827
|
if (o === 0) return [[0, 0, 0]];
|
|
1639
1828
|
const t = [];
|
|
1640
1829
|
let [i, e, n] = [0, -o, o];
|
|
1641
|
-
for (const [a, r, s] of
|
|
1830
|
+
for (const [a, r, s] of Le)
|
|
1642
1831
|
for (let c = 0; c < o; c++)
|
|
1643
1832
|
t.push([i, e, n]), i += a, e += r, n += s;
|
|
1644
1833
|
return t;
|
|
1645
1834
|
}
|
|
1646
|
-
class
|
|
1835
|
+
class Fe {
|
|
1647
1836
|
// imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
|
|
1648
1837
|
// would break hex tiling). Kept as parameter for interface compatibility.
|
|
1649
1838
|
constructor(t, i = {}) {
|
|
@@ -1651,15 +1840,15 @@ class Ie {
|
|
|
1651
1840
|
}
|
|
1652
1841
|
generate(t, i, e = {}) {
|
|
1653
1842
|
const n = [], { width: a, height: r } = i, s = a / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
|
|
1654
|
-
...
|
|
1843
|
+
...kt,
|
|
1655
1844
|
...this.config.honeycomb
|
|
1656
1845
|
}.spacing ?? 0, d = l + h;
|
|
1657
1846
|
let f = 0, b = 0;
|
|
1658
1847
|
for (; f < t; ) {
|
|
1659
|
-
const p =
|
|
1848
|
+
const p = Me(b);
|
|
1660
1849
|
for (const [g, m, y] of p) {
|
|
1661
1850
|
if (f >= t) break;
|
|
1662
|
-
const { px: w, py: v } =
|
|
1851
|
+
const { px: w, py: v } = Ce(g, m, y, s, c, d);
|
|
1663
1852
|
n.push({
|
|
1664
1853
|
id: f,
|
|
1665
1854
|
x: w,
|
|
@@ -1676,7 +1865,7 @@ class Ie {
|
|
|
1676
1865
|
return n;
|
|
1677
1866
|
}
|
|
1678
1867
|
}
|
|
1679
|
-
class
|
|
1868
|
+
class ze {
|
|
1680
1869
|
constructor(t) {
|
|
1681
1870
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1682
1871
|
}
|
|
@@ -1687,19 +1876,19 @@ class Te {
|
|
|
1687
1876
|
initLayout() {
|
|
1688
1877
|
switch (this.config.algorithm) {
|
|
1689
1878
|
case "radial":
|
|
1690
|
-
return new
|
|
1879
|
+
return new pe(this.config, this.imageConfig);
|
|
1691
1880
|
case "grid":
|
|
1692
|
-
return new
|
|
1881
|
+
return new ye(this.config, this.imageConfig);
|
|
1693
1882
|
case "spiral":
|
|
1694
|
-
return new
|
|
1883
|
+
return new xe(this.config, this.imageConfig);
|
|
1695
1884
|
case "cluster":
|
|
1696
|
-
return new
|
|
1885
|
+
return new Se(this.config, this.imageConfig);
|
|
1697
1886
|
case "wave":
|
|
1698
|
-
return new ye(this.config, this.imageConfig);
|
|
1699
|
-
case "honeycomb":
|
|
1700
1887
|
return new Ie(this.config, this.imageConfig);
|
|
1888
|
+
case "honeycomb":
|
|
1889
|
+
return new Fe(this.config, this.imageConfig);
|
|
1701
1890
|
default:
|
|
1702
|
-
return new
|
|
1891
|
+
return new me(this.config, this.imageConfig);
|
|
1703
1892
|
}
|
|
1704
1893
|
}
|
|
1705
1894
|
/**
|
|
@@ -1821,7 +2010,7 @@ const Ct = {
|
|
|
1821
2010
|
hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
|
1822
2011
|
octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
|
|
1823
2012
|
diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
|
|
1824
|
-
},
|
|
2013
|
+
}, Oe = {
|
|
1825
2014
|
// Circle - uses radius in pixels (refHeight of 100px = 50px radius)
|
|
1826
2015
|
circle: {
|
|
1827
2016
|
refHeight: 100,
|
|
@@ -1859,12 +2048,12 @@ const Ct = {
|
|
|
1859
2048
|
points: [[50, 0], [100, 50], [50, 100], [0, 50]]
|
|
1860
2049
|
}
|
|
1861
2050
|
};
|
|
1862
|
-
function
|
|
2051
|
+
function De(o) {
|
|
1863
2052
|
if (o)
|
|
1864
2053
|
return o in Ct ? Ct[o] : o;
|
|
1865
2054
|
}
|
|
1866
|
-
function
|
|
1867
|
-
const e =
|
|
2055
|
+
function $e(o, t, i) {
|
|
2056
|
+
const e = Oe[o];
|
|
1868
2057
|
if (!e) return "";
|
|
1869
2058
|
const n = t / e.refHeight;
|
|
1870
2059
|
if (o === "circle")
|
|
@@ -1875,13 +2064,13 @@ function Le(o, t, i) {
|
|
|
1875
2064
|
return `${m}px ${y}px`;
|
|
1876
2065
|
}).join(", ")})`;
|
|
1877
2066
|
}
|
|
1878
|
-
function
|
|
2067
|
+
function Pe(o) {
|
|
1879
2068
|
return o in mt;
|
|
1880
2069
|
}
|
|
1881
|
-
function
|
|
1882
|
-
return o ?
|
|
2070
|
+
function _e(o) {
|
|
2071
|
+
return o ? Pe(o) ? mt[o] : o : mt.md;
|
|
1883
2072
|
}
|
|
1884
|
-
function
|
|
2073
|
+
function Ue(o) {
|
|
1885
2074
|
if (!o) return "";
|
|
1886
2075
|
const t = [];
|
|
1887
2076
|
if (o.grayscale !== void 0 && t.push(`grayscale(${o.grayscale})`), o.blur !== void 0 && t.push(`blur(${o.blur}px)`), o.brightness !== void 0 && t.push(`brightness(${o.brightness})`), o.contrast !== void 0 && t.push(`contrast(${o.contrast})`), o.saturate !== void 0 && t.push(`saturate(${o.saturate})`), o.opacity !== void 0 && t.push(`opacity(${o.opacity})`), o.sepia !== void 0 && t.push(`sepia(${o.sepia})`), o.hueRotate !== void 0 && t.push(`hue-rotate(${o.hueRotate}deg)`), o.invert !== void 0 && t.push(`invert(${o.invert})`), o.dropShadow !== void 0)
|
|
@@ -1910,8 +2099,8 @@ function et(o, t, i) {
|
|
|
1910
2099
|
const s = o.border || {}, c = { ...s, ...o.borderTop }, l = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, h = { ...s, ...o.borderLeft };
|
|
1911
2100
|
e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
|
|
1912
2101
|
} else o.border && (e.border = tt(o.border));
|
|
1913
|
-
o.shadow !== void 0 && (e.boxShadow =
|
|
1914
|
-
const r =
|
|
2102
|
+
o.shadow !== void 0 && (e.boxShadow = _e(o.shadow));
|
|
2103
|
+
const r = Ue(o.filter);
|
|
1915
2104
|
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) {
|
|
1916
2105
|
const s = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
|
|
1917
2106
|
e.outline = `${s}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
@@ -1920,33 +2109,33 @@ function et(o, t, i) {
|
|
|
1920
2109
|
let s;
|
|
1921
2110
|
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
|
|
1922
2111
|
if (l?.mode === "height-relative" && t)
|
|
1923
|
-
s =
|
|
2112
|
+
s = $e(l.shape, t, i);
|
|
1924
2113
|
else {
|
|
1925
2114
|
const u = c && l ? l.shape : o.clipPath;
|
|
1926
|
-
s =
|
|
2115
|
+
s = De(u);
|
|
1927
2116
|
}
|
|
1928
2117
|
s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
|
|
1929
2118
|
}
|
|
1930
2119
|
return e;
|
|
1931
2120
|
}
|
|
1932
|
-
function
|
|
2121
|
+
function He(o, t) {
|
|
1933
2122
|
t.borderRadius !== void 0 && (o.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (o.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (o.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (o.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (o.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (o.style.border = t.border), t.borderTop !== void 0 && (o.style.borderTop = t.borderTop), t.borderRight !== void 0 && (o.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (o.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (o.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (o.style.boxShadow = t.boxShadow), t.filter !== void 0 && (o.style.filter = t.filter), t.opacity !== void 0 && (o.style.opacity = t.opacity), t.cursor !== void 0 && (o.style.cursor = t.cursor), t.outline !== void 0 && (o.style.outline = t.outline), t.outlineOffset !== void 0 && (o.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (o.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (o.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (o.style.clipPath = t.clipPath), t.overflow !== void 0 && (o.style.overflow = t.overflow);
|
|
1934
2123
|
}
|
|
1935
2124
|
function ft(o, t, i, e) {
|
|
1936
2125
|
const n = et(t, i, e);
|
|
1937
|
-
|
|
2126
|
+
He(o, n);
|
|
1938
2127
|
}
|
|
1939
|
-
function
|
|
2128
|
+
function $t(o) {
|
|
1940
2129
|
return o ? Array.isArray(o) ? o.join(" ") : o : "";
|
|
1941
2130
|
}
|
|
1942
2131
|
function st(o, t) {
|
|
1943
|
-
const i =
|
|
2132
|
+
const i = $t(t);
|
|
1944
2133
|
i && i.split(" ").forEach((e) => {
|
|
1945
2134
|
e.trim() && o.classList.add(e.trim());
|
|
1946
2135
|
});
|
|
1947
2136
|
}
|
|
1948
2137
|
function pt(o, t) {
|
|
1949
|
-
const i =
|
|
2138
|
+
const i = $t(t);
|
|
1950
2139
|
i && i.split(" ").forEach((e) => {
|
|
1951
2140
|
e.trim() && o.classList.remove(e.trim());
|
|
1952
2141
|
});
|
|
@@ -1955,9 +2144,15 @@ const Lt = {
|
|
|
1955
2144
|
UNFOCUSING: 999,
|
|
1956
2145
|
FOCUSING: 1e3
|
|
1957
2146
|
};
|
|
1958
|
-
class
|
|
2147
|
+
class ke {
|
|
1959
2148
|
constructor(t, i, e) {
|
|
1960
|
-
this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
|
|
2149
|
+
this.state = S.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;
|
|
2150
|
+
}
|
|
2151
|
+
/**
|
|
2152
|
+
* Set callback to be fired when an unfocus animation fully completes.
|
|
2153
|
+
*/
|
|
2154
|
+
setOnUnfocusCompleteCallback(t) {
|
|
2155
|
+
this.onUnfocusComplete = t;
|
|
1961
2156
|
}
|
|
1962
2157
|
/**
|
|
1963
2158
|
* Get current state machine state
|
|
@@ -2236,7 +2431,11 @@ class De {
|
|
|
2236
2431
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2237
2432
|
]), this.focusGeneration !== n)
|
|
2238
2433
|
return;
|
|
2239
|
-
|
|
2434
|
+
if (this.outgoing) {
|
|
2435
|
+
const a = this.outgoing.element;
|
|
2436
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2437
|
+
}
|
|
2438
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2240
2439
|
break;
|
|
2241
2440
|
case S.FOCUSING:
|
|
2242
2441
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2253,7 +2452,11 @@ class De {
|
|
|
2253
2452
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2254
2453
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2255
2454
|
]), this.focusGeneration !== n) return;
|
|
2256
|
-
|
|
2455
|
+
if (this.outgoing) {
|
|
2456
|
+
const a = this.outgoing.element;
|
|
2457
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2458
|
+
}
|
|
2459
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2257
2460
|
break;
|
|
2258
2461
|
case S.CROSS_ANIMATING:
|
|
2259
2462
|
if (this.incoming?.element === t)
|
|
@@ -2274,7 +2477,11 @@ class De {
|
|
|
2274
2477
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2275
2478
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2276
2479
|
]), this.focusGeneration !== n) return;
|
|
2277
|
-
|
|
2480
|
+
if (this.outgoing) {
|
|
2481
|
+
const s = this.outgoing.element;
|
|
2482
|
+
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2483
|
+
}
|
|
2484
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2278
2485
|
return;
|
|
2279
2486
|
}
|
|
2280
2487
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2296,7 +2503,11 @@ class De {
|
|
|
2296
2503
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2297
2504
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2298
2505
|
]), this.focusGeneration !== n) return;
|
|
2299
|
-
|
|
2506
|
+
if (this.outgoing) {
|
|
2507
|
+
const a = this.outgoing.element;
|
|
2508
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2509
|
+
}
|
|
2510
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2300
2511
|
break;
|
|
2301
2512
|
}
|
|
2302
2513
|
}
|
|
@@ -2316,7 +2527,8 @@ class De {
|
|
|
2316
2527
|
a,
|
|
2317
2528
|
r
|
|
2318
2529
|
), this.incoming = null, this.state = S.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2319
|
-
|
|
2530
|
+
const s = this.outgoing.element;
|
|
2531
|
+
this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(s);
|
|
2320
2532
|
}
|
|
2321
2533
|
return;
|
|
2322
2534
|
}
|
|
@@ -2333,12 +2545,15 @@ class De {
|
|
|
2333
2545
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2334
2546
|
this.waitForAnimation(s.animationHandle)
|
|
2335
2547
|
]), this.focusGeneration !== t) return;
|
|
2336
|
-
|
|
2548
|
+
let c = null;
|
|
2549
|
+
this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2550
|
+
const l = s.element;
|
|
2551
|
+
this.removeFocusedStyling(l, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(l);
|
|
2337
2552
|
return;
|
|
2338
2553
|
}
|
|
2339
2554
|
this.state = S.UNFOCUSING;
|
|
2340
2555
|
const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2341
|
-
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 = S.IDLE);
|
|
2556
|
+
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 = S.IDLE, this.onUnfocusComplete?.(i));
|
|
2342
2557
|
}
|
|
2343
2558
|
/**
|
|
2344
2559
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2420,7 +2635,7 @@ class De {
|
|
|
2420
2635
|
), this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2421
2636
|
}
|
|
2422
2637
|
}
|
|
2423
|
-
const
|
|
2638
|
+
const Ne = 50, je = 0.5, We = 20, Ge = 0.3, qe = 150, Be = 30, at = class at {
|
|
2424
2639
|
constructor(t, i) {
|
|
2425
2640
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = i, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2426
2641
|
}
|
|
@@ -2467,11 +2682,11 @@ const $e = 50, Pe = 0.5, _e = 20, Ue = 0.3, He = 150, Ne = 30, at = class at {
|
|
|
2467
2682
|
const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
|
|
2468
2683
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
|
|
2469
2684
|
const s = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
|
|
2470
|
-
this.touchState.isHorizontalSwipe = s <=
|
|
2685
|
+
this.touchState.isHorizontalSwipe = s <= Be;
|
|
2471
2686
|
}
|
|
2472
2687
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2473
2688
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
|
|
2474
|
-
const a = e *
|
|
2689
|
+
const a = e * Ge;
|
|
2475
2690
|
this.callbacks.onDragOffset(a);
|
|
2476
2691
|
}
|
|
2477
2692
|
}
|
|
@@ -2480,7 +2695,7 @@ const $e = 50, Pe = 0.5, _e = 20, Ue = 0.3, He = 150, Ne = 30, at = class at {
|
|
|
2480
2695
|
this.recentTouchTimestamp = Date.now();
|
|
2481
2696
|
const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, a = Math.abs(i);
|
|
2482
2697
|
let r = !1;
|
|
2483
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >=
|
|
2698
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= Ne || n >= je && a >= We) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2484
2699
|
}
|
|
2485
2700
|
handleTouchCancel(t) {
|
|
2486
2701
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
@@ -2488,7 +2703,7 @@ const $e = 50, Pe = 0.5, _e = 20, Ue = 0.3, He = 150, Ne = 30, at = class at {
|
|
|
2488
2703
|
};
|
|
2489
2704
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2490
2705
|
let bt = at;
|
|
2491
|
-
class
|
|
2706
|
+
class Xe {
|
|
2492
2707
|
constructor(t) {
|
|
2493
2708
|
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)
|
|
2494
2709
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2709,7 +2924,7 @@ class je {
|
|
|
2709
2924
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2710
2925
|
}
|
|
2711
2926
|
}
|
|
2712
|
-
class
|
|
2927
|
+
class Ye {
|
|
2713
2928
|
constructor(t) {
|
|
2714
2929
|
if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
2715
2930
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2889,7 +3104,7 @@ class We {
|
|
|
2889
3104
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2890
3105
|
}
|
|
2891
3106
|
}
|
|
2892
|
-
class
|
|
3107
|
+
class Ve {
|
|
2893
3108
|
constructor(t) {
|
|
2894
3109
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
2895
3110
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -2946,7 +3161,7 @@ class ke {
|
|
|
2946
3161
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2947
3162
|
}
|
|
2948
3163
|
}
|
|
2949
|
-
class
|
|
3164
|
+
class Je {
|
|
2950
3165
|
/**
|
|
2951
3166
|
* Create a new ImageFilter
|
|
2952
3167
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2983,7 +3198,7 @@ class Ge {
|
|
|
2983
3198
|
// isAllowedDate(date: Date): boolean
|
|
2984
3199
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2985
3200
|
}
|
|
2986
|
-
const
|
|
3201
|
+
const Ke = `
|
|
2987
3202
|
.fbn-ic-gallery {
|
|
2988
3203
|
position: relative;
|
|
2989
3204
|
width: 100%;
|
|
@@ -3033,31 +3248,38 @@ const qe = `
|
|
|
3033
3248
|
display: none !important;
|
|
3034
3249
|
}
|
|
3035
3250
|
`;
|
|
3036
|
-
function
|
|
3251
|
+
function Ze() {
|
|
3037
3252
|
if (typeof document > "u") return;
|
|
3038
3253
|
const o = "fbn-ic-functional-styles";
|
|
3039
3254
|
if (document.getElementById(o)) return;
|
|
3040
3255
|
const t = document.createElement("style");
|
|
3041
|
-
t.id = o, t.textContent =
|
|
3256
|
+
t.id = o, t.textContent = Ke, document.head.appendChild(t);
|
|
3042
3257
|
}
|
|
3043
|
-
class
|
|
3258
|
+
class Qe {
|
|
3044
3259
|
constructor(t = {}) {
|
|
3045
|
-
this.fullConfig =
|
|
3260
|
+
this.fullConfig = Zt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new ie(this.fullConfig.animation), this.layoutEngine = new ze({
|
|
3046
3261
|
layout: this.fullConfig.layout,
|
|
3047
3262
|
image: this.fullConfig.image
|
|
3048
|
-
}), this.zoomEngine = new
|
|
3263
|
+
}), this.zoomEngine = new ke(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;
|
|
3049
3264
|
const i = this.fullConfig.animation.entry || E.animation.entry;
|
|
3050
|
-
this.entryAnimationEngine = new
|
|
3265
|
+
this.entryAnimationEngine = new ge(
|
|
3051
3266
|
i,
|
|
3052
3267
|
this.fullConfig.layout.algorithm
|
|
3053
|
-
)
|
|
3268
|
+
);
|
|
3269
|
+
const e = this.fullConfig.animation.idle;
|
|
3270
|
+
e && e.type !== "none" ? this.idleAnimationEngine = new fe(
|
|
3271
|
+
e,
|
|
3272
|
+
i.timing?.duration ?? 600
|
|
3273
|
+
) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
|
|
3274
|
+
this.idleAnimationEngine?.resumeForImage(n);
|
|
3275
|
+
}), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
3054
3276
|
}
|
|
3055
3277
|
/**
|
|
3056
3278
|
* Create image filter based on shared loader config
|
|
3057
3279
|
*/
|
|
3058
3280
|
createImageFilter() {
|
|
3059
3281
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
3060
|
-
return new
|
|
3282
|
+
return new Je(t);
|
|
3061
3283
|
}
|
|
3062
3284
|
/**
|
|
3063
3285
|
* Create appropriate image loader based on config
|
|
@@ -3068,7 +3290,7 @@ class Ye {
|
|
|
3068
3290
|
if (!t || t.length === 0)
|
|
3069
3291
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
3070
3292
|
const e = t.map((n) => this.createLoaderFromEntry(n, i));
|
|
3071
|
-
return e.length === 1 ? e[0] : new
|
|
3293
|
+
return e.length === 1 ? e[0] : new Ve({
|
|
3072
3294
|
loaders: e,
|
|
3073
3295
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
3074
3296
|
});
|
|
@@ -3086,14 +3308,14 @@ class Ye {
|
|
|
3086
3308
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3087
3309
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3088
3310
|
};
|
|
3089
|
-
return new
|
|
3311
|
+
return new Ye(n);
|
|
3090
3312
|
} else if ("googleDrive" in t) {
|
|
3091
3313
|
const e = t.googleDrive, n = {
|
|
3092
3314
|
...e,
|
|
3093
3315
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3094
3316
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3095
3317
|
};
|
|
3096
|
-
return new
|
|
3318
|
+
return new Xe(n);
|
|
3097
3319
|
} else
|
|
3098
3320
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
3099
3321
|
}
|
|
@@ -3102,7 +3324,7 @@ class Ye {
|
|
|
3102
3324
|
*/
|
|
3103
3325
|
async init() {
|
|
3104
3326
|
try {
|
|
3105
|
-
if (
|
|
3327
|
+
if (Ze(), this.containerRef)
|
|
3106
3328
|
this.containerEl = this.containerRef;
|
|
3107
3329
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
3108
3330
|
throw new Error(`Container #${this.containerId} not found`);
|
|
@@ -3111,7 +3333,7 @@ class Ye {
|
|
|
3111
3333
|
onPrev: () => this.navigateToPreviousImage(),
|
|
3112
3334
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
3113
3335
|
onDragEnd: (t) => {
|
|
3114
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
3336
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, qe);
|
|
3115
3337
|
}
|
|
3116
3338
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3117
3339
|
} catch (t) {
|
|
@@ -3242,7 +3464,7 @@ class Ye {
|
|
|
3242
3464
|
x: parseFloat(l.dataset.endX),
|
|
3243
3465
|
y: parseFloat(l.dataset.endY)
|
|
3244
3466
|
}, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), g = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : g, w = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
|
|
3245
|
-
|
|
3467
|
+
he({
|
|
3246
3468
|
element: l,
|
|
3247
3469
|
startPosition: d,
|
|
3248
3470
|
endPosition: f,
|
|
@@ -3275,6 +3497,10 @@ class Ye {
|
|
|
3275
3497
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3276
3498
|
});
|
|
3277
3499
|
}
|
|
3500
|
+
if (this.idleAnimationEngine) {
|
|
3501
|
+
const d = this.entryAnimationEngine.getTiming().duration;
|
|
3502
|
+
this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
|
|
3503
|
+
}
|
|
3278
3504
|
}), r++);
|
|
3279
3505
|
}, c = () => {
|
|
3280
3506
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
@@ -3312,7 +3538,7 @@ class Ye {
|
|
|
3312
3538
|
h.style.left = `${d - 6}px`, h.style.top = `${f - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(f)})`, this.containerEl.appendChild(h);
|
|
3313
3539
|
})), t.forEach((l, u) => {
|
|
3314
3540
|
const h = document.createElement("img");
|
|
3315
|
-
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
|
|
3541
|
+
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.disableDragging && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
|
|
3316
3542
|
const d = a[u];
|
|
3317
3543
|
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), st(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
|
|
3318
3544
|
if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
|
|
@@ -3342,7 +3568,7 @@ class Ye {
|
|
|
3342
3568
|
d.scale,
|
|
3343
3569
|
b,
|
|
3344
3570
|
i
|
|
3345
|
-
),
|
|
3571
|
+
), I = this.entryAnimationEngine.buildStartTransform(
|
|
3346
3572
|
m,
|
|
3347
3573
|
p,
|
|
3348
3574
|
d.rotation,
|
|
@@ -3360,7 +3586,7 @@ class Ye {
|
|
|
3360
3586
|
finalTransform: v,
|
|
3361
3587
|
renderedWidth: b,
|
|
3362
3588
|
renderedHeight: i
|
|
3363
|
-
}), h.style.transform =
|
|
3589
|
+
}), h.style.transform = I, 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);
|
|
3364
3590
|
}, h.onerror = () => r++, h.src = l;
|
|
3365
3591
|
});
|
|
3366
3592
|
}
|
|
@@ -3373,6 +3599,7 @@ class Ye {
|
|
|
3373
3599
|
if (e)
|
|
3374
3600
|
await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter();
|
|
3375
3601
|
else {
|
|
3602
|
+
this.idleAnimationEngine?.pauseForImage(t);
|
|
3376
3603
|
const a = t.dataset.imageId;
|
|
3377
3604
|
this.currentFocusIndex = a !== void 0 ? parseInt(a, 10) : null, this.swipeEngine?.enable(), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex);
|
|
3378
3605
|
}
|
|
@@ -3381,7 +3608,7 @@ class Ye {
|
|
|
3381
3608
|
* Clear the image cloud and reset state
|
|
3382
3609
|
*/
|
|
3383
3610
|
clearImageCloud() {
|
|
3384
|
-
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.imagesLoaded = !1;
|
|
3611
|
+
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;
|
|
3385
3612
|
}
|
|
3386
3613
|
showLoading(t) {
|
|
3387
3614
|
!this.fullConfig.rendering.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
|
|
@@ -3402,34 +3629,34 @@ class Ye {
|
|
|
3402
3629
|
* Destroy the gallery and clean up resources
|
|
3403
3630
|
*/
|
|
3404
3631
|
destroy() {
|
|
3405
|
-
this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy();
|
|
3632
|
+
this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
|
|
3406
3633
|
}
|
|
3407
3634
|
}
|
|
3408
3635
|
export {
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3636
|
+
ie as AnimationEngine,
|
|
3637
|
+
It as BOUNCE_PRESETS,
|
|
3638
|
+
Se as ClusterPlacementLayout,
|
|
3639
|
+
Ve as CompositeLoader,
|
|
3413
3640
|
E as DEFAULT_CONFIG,
|
|
3414
3641
|
zt as DEFAULT_SHARED_LOADER_CONFIG,
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3642
|
+
Rt as ELASTIC_PRESETS,
|
|
3643
|
+
ge as EntryAnimationEngine,
|
|
3644
|
+
Ke as FUNCTIONAL_CSS,
|
|
3645
|
+
Xe as GoogleDriveLoader,
|
|
3646
|
+
ye as GridPlacementLayout,
|
|
3647
|
+
Qe as ImageCloud,
|
|
3648
|
+
Je as ImageFilter,
|
|
3649
|
+
Qe as ImageGallery,
|
|
3650
|
+
ze as LayoutEngine,
|
|
3651
|
+
pe as RadialPlacementLayout,
|
|
3652
|
+
me as RandomPlacementLayout,
|
|
3653
|
+
xe as SpiralPlacementLayout,
|
|
3654
|
+
Ye as StaticImageLoader,
|
|
3428
3655
|
Tt as WAVE_PATH_PRESETS,
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3656
|
+
Ie as WavePlacementLayout,
|
|
3657
|
+
ke as ZoomEngine,
|
|
3658
|
+
he as animatePath,
|
|
3659
|
+
Ze as injectFunctionalStyles,
|
|
3660
|
+
de as requiresJSAnimation
|
|
3434
3661
|
};
|
|
3435
3662
|
//# sourceMappingURL=image-cloud.js.map
|