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