@frybynite/image-cloud 0.8.2 → 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary: #1a1a2e;--fbn-ic-bg-glass: rgba(255, 255, 255, .05);--fbn-ic-border-glass: rgba(255, 255, 255, .1);--fbn-ic-text-primary: #ffffff;--fbn-ic-text-secondary: #b8b8d1;--fbn-ic-text-muted: #6b6b8f;--fbn-ic-accent-primary: #6366f1;--fbn-ic-accent-secondary: #8b5cf6;--fbn-ic-accent-glow: rgba(99, 102, 241, .4);--fbn-ic-transition-smooth: cubic-bezier(.4, 0, .2, 1);--fbn-ic-transition-bounce: cubic-bezier(.68, -.55, .265, 1.55);--fbn-ic-shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);--fbn-ic-shadow-md: 0 4px 16px rgba(0, 0, 0, .4);--fbn-ic-shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);--fbn-ic-shadow-glow: 0 0 20px var(--fbn-ic-accent-glow)}.fbn-ic-gallery{position:relative;width:100%;height:100%;overflow:hidden;perspective:1000px}.fbn-ic-image{position:absolute;border-radius:8px;box-shadow:var(--fbn-ic-shadow-md);cursor:pointer;transition:transform .6s var(--fbn-ic-transition-smooth),box-shadow .6s var(--fbn-ic-transition-smooth),filter .3s var(--fbn-ic-transition-smooth),opacity .3s var(--fbn-ic-transition-smooth),border .3s var(--fbn-ic-transition-smooth),outline .3s var(--fbn-ic-transition-smooth),z-index 0s .6s;will-change:transform;-webkit-user-select:none;user-select:none;backface-visibility:hidden;-webkit-backface-visibility:hidden}.fbn-ic-image:hover{box-shadow:var(--fbn-ic-shadow-lg)}.fbn-ic-image.fbn-ic-focused{z-index:1000;box-shadow:0 20px 60px #000000b3,var(--fbn-ic-shadow-glow);transition:transform .6s var(--fbn-ic-transition-smooth),box-shadow .6s var(--fbn-ic-transition-smooth),filter .3s var(--fbn-ic-transition-smooth),opacity .3s var(--fbn-ic-transition-smooth),border .3s var(--fbn-ic-transition-smooth),outline .3s var(--fbn-ic-transition-smooth),z-index 0s 0s;will-change:auto}.fbn-ic-loading{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;color:var(--fbn-ic-text-secondary);z-index:100;pointer-events:none}.fbn-ic-spinner{width:50px;height:50px;margin:0 auto 1rem;border:4px solid var(--fbn-ic-border-glass);border-top:4px solid var(--fbn-ic-accent-primary);border-radius:50%;animation:fbn-ic-spin 1s linear infinite}@keyframes fbn-ic-spin{to{transform:rotate(360deg)}}.fbn-ic-error{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:600px;padding:1.5rem;background:#ef44441a;border:1px solid rgba(239,68,68,.3);border-radius:12px;color:#fca5a5;text-align:center;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);z-index:100}.fbn-ic-counter{background:#0009;color:#fff;padding:6px 16px;border-radius:16px;font-family:system-ui,sans-serif;font-size:14px}.fbn-ic-hidden{display:none!important}", mt = Object.freeze({
|
|
2
2
|
none: "none",
|
|
3
3
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
4
4
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
@@ -13,7 +13,7 @@ const _t = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
13
13
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
14
14
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
15
15
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
16
|
-
}),
|
|
16
|
+
}), Tt = Object.freeze({
|
|
17
17
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
18
18
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
19
19
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
@@ -50,9 +50,9 @@ const _t = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
50
50
|
focused: Object.freeze({
|
|
51
51
|
shadow: "none"
|
|
52
52
|
})
|
|
53
|
-
}), Ut = Object.freeze({
|
|
54
|
-
tightness: 1
|
|
55
53
|
}), Ht = Object.freeze({
|
|
54
|
+
tightness: 1
|
|
55
|
+
}), kt = Object.freeze({
|
|
56
56
|
rows: 1,
|
|
57
57
|
amplitude: 100,
|
|
58
58
|
frequency: 2,
|
|
@@ -64,7 +64,7 @@ const _t = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
64
64
|
}), jt = Object.freeze({
|
|
65
65
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
66
66
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
67
|
-
}),
|
|
67
|
+
}), Wt = Object.freeze({
|
|
68
68
|
mode: "adaptive",
|
|
69
69
|
// Default to adaptive sizing
|
|
70
70
|
minSize: 50,
|
|
@@ -76,16 +76,16 @@ const _t = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
76
76
|
// No variance by default
|
|
77
77
|
max: 1
|
|
78
78
|
})
|
|
79
|
-
}),
|
|
79
|
+
}), Gt = Object.freeze({
|
|
80
80
|
mode: "none",
|
|
81
81
|
range: Object.freeze({
|
|
82
82
|
min: -15,
|
|
83
83
|
max: 15
|
|
84
84
|
})
|
|
85
|
-
}), zt = Object.freeze({
|
|
86
|
-
sizing: kt,
|
|
87
|
-
rotation: Wt
|
|
88
85
|
}), Ft = Object.freeze({
|
|
86
|
+
sizing: Wt,
|
|
87
|
+
rotation: Gt
|
|
88
|
+
}), zt = Object.freeze({
|
|
89
89
|
validateUrls: !0,
|
|
90
90
|
validationTimeout: 5e3,
|
|
91
91
|
validationMethod: "head",
|
|
@@ -94,16 +94,16 @@ const _t = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
94
94
|
enabled: !1,
|
|
95
95
|
centers: !1,
|
|
96
96
|
loaders: !1
|
|
97
|
-
}), E = Object.freeze({
|
|
97
|
+
}), qt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Bt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Xt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Yt = Object.freeze({ speed: 4e3, direction: "clockwise" }), Dt = Object.freeze({ type: "none" }), 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
|
|
101
101
|
config: Object.freeze({
|
|
102
|
-
loaders:
|
|
102
|
+
loaders: zt,
|
|
103
103
|
debug: Ot
|
|
104
104
|
}),
|
|
105
105
|
// Image sizing and rotation configuration
|
|
106
|
-
image:
|
|
106
|
+
image: Ft,
|
|
107
107
|
// Pattern-based layout configuration
|
|
108
108
|
layout: Object.freeze({
|
|
109
109
|
algorithm: "radial",
|
|
@@ -168,7 +168,8 @@ const _t = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
168
168
|
path: yt,
|
|
169
169
|
rotation: vt,
|
|
170
170
|
scale: wt
|
|
171
|
-
})
|
|
171
|
+
}),
|
|
172
|
+
idle: Dt
|
|
172
173
|
}),
|
|
173
174
|
// Pattern-based interaction configuration
|
|
174
175
|
interaction: Object.freeze({
|
|
@@ -220,7 +221,7 @@ function Z(n, t) {
|
|
|
220
221
|
const i = { ...n };
|
|
221
222
|
return t.border !== void 0 && (i.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...n.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
223
|
}
|
|
223
|
-
function
|
|
224
|
+
function Jt(n, t) {
|
|
224
225
|
if (!t) return { ...n };
|
|
225
226
|
const i = Z(n.default, t.default), e = Z(
|
|
226
227
|
Z(i, n.hover),
|
|
@@ -235,7 +236,7 @@ function Gt(n, t) {
|
|
|
235
236
|
focused: o
|
|
236
237
|
};
|
|
237
238
|
}
|
|
238
|
-
function
|
|
239
|
+
function Vt(n, t) {
|
|
239
240
|
if (!t) return { ...n };
|
|
240
241
|
const i = { ...n };
|
|
241
242
|
if (t.sizing !== void 0 && (i.sizing = {
|
|
@@ -254,7 +255,7 @@ function qt(n, t) {
|
|
|
254
255
|
}
|
|
255
256
|
return i;
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
+
function Kt(n) {
|
|
258
259
|
const t = n.layout?.rotation;
|
|
259
260
|
if (t && "enabled" in t)
|
|
260
261
|
return {
|
|
@@ -264,7 +265,7 @@ function Xt(n) {
|
|
|
264
265
|
}
|
|
265
266
|
};
|
|
266
267
|
}
|
|
267
|
-
function
|
|
268
|
+
function Zt(n) {
|
|
268
269
|
const t = n.layout?.sizing?.variance;
|
|
269
270
|
if (t)
|
|
270
271
|
return {
|
|
@@ -275,8 +276,8 @@ function Yt(n) {
|
|
|
275
276
|
}
|
|
276
277
|
};
|
|
277
278
|
}
|
|
278
|
-
function
|
|
279
|
-
const t =
|
|
279
|
+
function Qt(n = {}) {
|
|
280
|
+
const t = Kt(n), i = Zt(n);
|
|
280
281
|
let e = n.image;
|
|
281
282
|
(t || i) && (e = {
|
|
282
283
|
...i || {},
|
|
@@ -294,18 +295,18 @@ function Bt(n = {}) {
|
|
|
294
295
|
});
|
|
295
296
|
const r = {
|
|
296
297
|
loaders: {
|
|
297
|
-
...
|
|
298
|
+
...zt,
|
|
298
299
|
...n.config?.loaders ?? {}
|
|
299
300
|
}
|
|
300
301
|
}, s = {
|
|
301
302
|
loaders: o,
|
|
302
303
|
config: r,
|
|
303
|
-
image:
|
|
304
|
+
image: Vt(Ft, e),
|
|
304
305
|
layout: { ...E.layout },
|
|
305
306
|
animation: { ...E.animation },
|
|
306
307
|
interaction: { ...E.interaction },
|
|
307
308
|
rendering: { ...E.rendering },
|
|
308
|
-
styling:
|
|
309
|
+
styling: Jt(Mt, n.styling)
|
|
309
310
|
};
|
|
310
311
|
if (n.layout && (s.layout = {
|
|
311
312
|
...E.layout,
|
|
@@ -341,6 +342,9 @@ function Bt(n = {}) {
|
|
|
341
342
|
path: n.animation.entry.path ? { ...yt, ...n.animation.entry.path } : E.animation.entry.path,
|
|
342
343
|
rotation: n.animation.entry.rotation ? { ...vt, ...n.animation.entry.rotation } : E.animation.entry.rotation,
|
|
343
344
|
scale: n.animation.entry.scale ? { ...wt, ...n.animation.entry.scale } : E.animation.entry.scale
|
|
345
|
+
}), n.animation.idle && (s.animation.idle = {
|
|
346
|
+
...Dt,
|
|
347
|
+
...n.animation.idle
|
|
344
348
|
})), n.interaction && (s.interaction = {
|
|
345
349
|
...E.interaction,
|
|
346
350
|
...n.interaction
|
|
@@ -378,16 +382,16 @@ function Bt(n = {}) {
|
|
|
378
382
|
}
|
|
379
383
|
return s;
|
|
380
384
|
}
|
|
381
|
-
function
|
|
385
|
+
function te(n, t) {
|
|
382
386
|
return { ...n ? It[n] : It.playful, ...t };
|
|
383
387
|
}
|
|
384
|
-
function
|
|
388
|
+
function ee(n, t) {
|
|
385
389
|
return { ...n ? Rt[n] : Rt.gentle, ...t };
|
|
386
390
|
}
|
|
387
|
-
function
|
|
388
|
-
return { ...n ?
|
|
391
|
+
function ie(n, t) {
|
|
392
|
+
return { ...n ? Tt[n] : Tt.gentle, ...t };
|
|
389
393
|
}
|
|
390
|
-
class
|
|
394
|
+
class ne {
|
|
391
395
|
constructor(t) {
|
|
392
396
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
393
397
|
}
|
|
@@ -546,23 +550,23 @@ class Zt {
|
|
|
546
550
|
function V(n, t, i) {
|
|
547
551
|
return n + (t - n) * i;
|
|
548
552
|
}
|
|
549
|
-
function
|
|
550
|
-
const { overshoot: o, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l =
|
|
551
|
-
let u = 0, h = 0, d = 1,
|
|
552
|
-
for (let
|
|
553
|
-
if (n <= l[
|
|
554
|
-
h =
|
|
553
|
+
function oe(n, t, i, e) {
|
|
554
|
+
const { overshoot: o, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l = se(a, r);
|
|
555
|
+
let u = 0, h = 0, d = 1, g = o, b = !1;
|
|
556
|
+
for (let f = 0; f < l.length; f++)
|
|
557
|
+
if (n <= l[f].time) {
|
|
558
|
+
h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, b = l[f].isOvershoot;
|
|
555
559
|
break;
|
|
556
560
|
}
|
|
557
561
|
const p = (n - h) / (d - h);
|
|
558
562
|
if (b)
|
|
559
|
-
u = 1 +
|
|
563
|
+
u = 1 + g * ot(p);
|
|
560
564
|
else if (h === 0)
|
|
561
565
|
u = ot(p);
|
|
562
566
|
else {
|
|
563
567
|
const m = 1 + (l.find(
|
|
564
568
|
(y, w) => y.time > h && w > 0 && l[w - 1].isOvershoot
|
|
565
|
-
)?.overshoot ||
|
|
569
|
+
)?.overshoot || g);
|
|
566
570
|
u = V(m, 1, ot(p));
|
|
567
571
|
}
|
|
568
572
|
return {
|
|
@@ -570,7 +574,7 @@ function Qt(n, t, i, e) {
|
|
|
570
574
|
y: t.y + c * u
|
|
571
575
|
};
|
|
572
576
|
}
|
|
573
|
-
function
|
|
577
|
+
function se(n, t) {
|
|
574
578
|
const i = [];
|
|
575
579
|
let e = 0.6;
|
|
576
580
|
i.push({ time: e, overshoot: 0, isOvershoot: !1 });
|
|
@@ -580,11 +584,11 @@ function te(n, t) {
|
|
|
580
584
|
e += r, i.push({ time: e, overshoot: o, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: o * t, isOvershoot: !1 }), o *= t;
|
|
581
585
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
582
586
|
}
|
|
583
|
-
function
|
|
587
|
+
function ae(n, t, i, e) {
|
|
584
588
|
const { stiffness: o, damping: a, mass: r, oscillations: s } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(o / r), h = a / (2 * Math.sqrt(o * r));
|
|
585
589
|
let d;
|
|
586
590
|
if (h < 1) {
|
|
587
|
-
const
|
|
591
|
+
const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * n * 3), p = Math.cos(g * n * s * Math.PI);
|
|
588
592
|
d = 1 - b * p;
|
|
589
593
|
} else
|
|
590
594
|
d = 1 - Math.exp(-u * n * 3);
|
|
@@ -593,44 +597,44 @@ function ee(n, t, i, e) {
|
|
|
593
597
|
y: t.y + l * d
|
|
594
598
|
};
|
|
595
599
|
}
|
|
596
|
-
function
|
|
597
|
-
const { amplitude: o, 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,
|
|
600
|
+
function re(n, t, i, e) {
|
|
601
|
+
const { amplitude: o, 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, g = h > 0 ? l / h : 1, b = a * Math.PI * 2 * n + c, p = r ? Math.pow(1 - n, s) : 1, f = o * Math.sin(b) * p, m = ce(n);
|
|
598
602
|
return {
|
|
599
|
-
x: V(t.x, i.x, m) +
|
|
600
|
-
y: V(t.y, i.y, m) +
|
|
603
|
+
x: V(t.x, i.x, m) + f * d,
|
|
604
|
+
y: V(t.y, i.y, m) + f * g
|
|
601
605
|
};
|
|
602
606
|
}
|
|
603
607
|
function ot(n) {
|
|
604
608
|
return 1 - (1 - n) * (1 - n);
|
|
605
609
|
}
|
|
606
|
-
function
|
|
610
|
+
function ce(n) {
|
|
607
611
|
return 1 - Math.pow(1 - n, 3);
|
|
608
612
|
}
|
|
609
|
-
function
|
|
613
|
+
function le(n, t, i) {
|
|
610
614
|
const { amplitude: e, frequency: o, decay: a } = i, r = Math.sin(n * o * Math.PI * 2), s = a ? Math.pow(1 - n, 2) : 1, c = e * r * s;
|
|
611
615
|
return t + c;
|
|
612
616
|
}
|
|
613
|
-
function
|
|
617
|
+
function he(n, t, i) {
|
|
614
618
|
const { overshoot: e, bounces: o } = i, a = [];
|
|
615
619
|
a.push({ time: 0.5, scale: e });
|
|
616
620
|
let r = e;
|
|
617
621
|
const s = 0.5, l = 0.5 / (o * 2);
|
|
618
622
|
let u = 0.5;
|
|
619
623
|
for (let d = 0; d < o; d++) {
|
|
620
|
-
const
|
|
621
|
-
u += l, a.push({ time: u, scale:
|
|
624
|
+
const g = 1 - (r - 1) * s;
|
|
625
|
+
u += l, a.push({ time: u, scale: g }), r = 1 + (r - 1) * s * s, u += l, d < o - 1 && a.push({ time: u, scale: r });
|
|
622
626
|
}
|
|
623
627
|
a.push({ time: 1, scale: 1 });
|
|
624
628
|
let h = 1;
|
|
625
629
|
for (let d = 0; d < a.length; d++)
|
|
626
630
|
if (n <= a[d].time) {
|
|
627
|
-
const
|
|
628
|
-
h = b + (a[d].scale - b) *
|
|
631
|
+
const g = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (n - g) / (a[d].time - g), f = ot(p);
|
|
632
|
+
h = b + (a[d].scale - b) * f;
|
|
629
633
|
break;
|
|
630
634
|
}
|
|
631
635
|
return h * t;
|
|
632
636
|
}
|
|
633
|
-
function
|
|
637
|
+
function de(n) {
|
|
634
638
|
const {
|
|
635
639
|
element: t,
|
|
636
640
|
startPosition: i,
|
|
@@ -644,60 +648,60 @@ function ae(n) {
|
|
|
644
648
|
onComplete: u,
|
|
645
649
|
rotationConfig: h,
|
|
646
650
|
startRotation: d,
|
|
647
|
-
scaleConfig:
|
|
651
|
+
scaleConfig: g,
|
|
648
652
|
startScale: b
|
|
649
|
-
} = n, p = o.type,
|
|
653
|
+
} = n, p = o.type, f = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = f || m, v = b !== void 0 && b !== l, I = g?.mode === "pop", x = g?.pop || { overshoot: 1.2, bounces: 1 };
|
|
650
654
|
if ((p === "linear" || p === "arc") && !w && !(v || I)) {
|
|
651
655
|
u && u();
|
|
652
656
|
return;
|
|
653
657
|
}
|
|
654
|
-
const
|
|
658
|
+
const z = performance.now(), L = -r / 2, _ = -s / 2;
|
|
655
659
|
function O(H) {
|
|
656
|
-
const
|
|
660
|
+
const k = H - z, T = Math.min(k / a, 1);
|
|
657
661
|
let D;
|
|
658
662
|
switch (p) {
|
|
659
663
|
case "bounce": {
|
|
660
|
-
const
|
|
664
|
+
const N = te(
|
|
661
665
|
o.bouncePreset,
|
|
662
666
|
o.bounce
|
|
663
667
|
);
|
|
664
|
-
D =
|
|
668
|
+
D = oe(T, i, e, N);
|
|
665
669
|
break;
|
|
666
670
|
}
|
|
667
671
|
case "elastic": {
|
|
668
|
-
const
|
|
672
|
+
const N = ee(
|
|
669
673
|
o.elasticPreset,
|
|
670
674
|
o.elastic
|
|
671
675
|
);
|
|
672
|
-
D =
|
|
676
|
+
D = ae(T, i, e, N);
|
|
673
677
|
break;
|
|
674
678
|
}
|
|
675
679
|
case "wave": {
|
|
676
|
-
const
|
|
680
|
+
const N = ie(
|
|
677
681
|
o.wavePreset,
|
|
678
682
|
o.wave
|
|
679
683
|
);
|
|
680
|
-
D =
|
|
684
|
+
D = re(T, i, e, N);
|
|
681
685
|
break;
|
|
682
686
|
}
|
|
683
687
|
default:
|
|
684
688
|
D = {
|
|
685
|
-
x: V(i.x, e.x,
|
|
686
|
-
y: V(i.y, e.y,
|
|
689
|
+
x: V(i.x, e.x, T),
|
|
690
|
+
y: V(i.y, e.y, T)
|
|
687
691
|
};
|
|
688
692
|
}
|
|
689
693
|
const G = D.x - e.x, U = D.y - e.y;
|
|
690
694
|
let M;
|
|
691
|
-
m ? M =
|
|
692
|
-
let
|
|
693
|
-
I ?
|
|
695
|
+
m ? M = le(T, c, y) : f ? M = V(d, c, T) : M = c;
|
|
696
|
+
let A;
|
|
697
|
+
I ? A = he(T, l, x) : v ? A = V(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
698
|
}
|
|
695
699
|
requestAnimationFrame(O);
|
|
696
700
|
}
|
|
697
|
-
function
|
|
701
|
+
function ue(n) {
|
|
698
702
|
return n === "bounce" || n === "elastic" || n === "wave";
|
|
699
703
|
}
|
|
700
|
-
const
|
|
704
|
+
const fe = {
|
|
701
705
|
radial: "center",
|
|
702
706
|
spiral: "center",
|
|
703
707
|
grid: "top",
|
|
@@ -706,7 +710,7 @@ const ce = {
|
|
|
706
710
|
wave: "left",
|
|
707
711
|
honeycomb: "center"
|
|
708
712
|
};
|
|
709
|
-
class
|
|
713
|
+
class ge {
|
|
710
714
|
constructor(t, i) {
|
|
711
715
|
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
716
|
}
|
|
@@ -714,7 +718,7 @@ class le {
|
|
|
714
718
|
* Get the effective start position, considering layout-aware defaults
|
|
715
719
|
*/
|
|
716
720
|
resolveStartPosition() {
|
|
717
|
-
return this.config.start.position ? this.config.start.position :
|
|
721
|
+
return this.config.start.position ? this.config.start.position : fe[this.layoutAlgorithm] || "nearest-edge";
|
|
718
722
|
}
|
|
719
723
|
/**
|
|
720
724
|
* Calculate the starting position for an image's entry animation
|
|
@@ -753,8 +757,8 @@ class le {
|
|
|
753
757
|
*/
|
|
754
758
|
calculateNearestEdge(t, i, e, o) {
|
|
755
759
|
const a = t.x, r = t.y, s = a, c = e.width - a, l = r, u = e.height - r, h = Math.min(s, c, l, u);
|
|
756
|
-
let d = t.x,
|
|
757
|
-
return h === s ? d = -(i.width + o) : h === c ? d = e.width + o : h === l ?
|
|
760
|
+
let d = t.x, g = t.y;
|
|
761
|
+
return h === s ? d = -(i.width + o) : h === c ? d = e.width + o : h === l ? g = -(i.height + o) : g = e.height + o, { x: d, y: g };
|
|
758
762
|
}
|
|
759
763
|
/**
|
|
760
764
|
* Calculate start position from a specific edge
|
|
@@ -812,8 +816,8 @@ class le {
|
|
|
812
816
|
c = typeof l == "number" ? l : 500;
|
|
813
817
|
let u;
|
|
814
818
|
s === "even" ? u = o / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
815
|
-
const h = e.width / 2, d = e.height / 2,
|
|
816
|
-
return { x:
|
|
819
|
+
const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
|
|
820
|
+
return { x: g, y: b };
|
|
817
821
|
}
|
|
818
822
|
/**
|
|
819
823
|
* Get animation parameters for an image
|
|
@@ -833,7 +837,7 @@ class le {
|
|
|
833
837
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
834
838
|
*/
|
|
835
839
|
buildStartTransform(t, i, e, o, a, r, s, c) {
|
|
836
|
-
const l = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = c !== void 0 ? c : o,
|
|
840
|
+
const l = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = c !== void 0 ? c : o, g = a !== void 0 ? -a / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = a !== void 0 ? `translate(${g}px, ${b}px)` : "translate(-50%, -50%)";
|
|
837
841
|
return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(${d})`;
|
|
838
842
|
}
|
|
839
843
|
/**
|
|
@@ -859,7 +863,7 @@ class le {
|
|
|
859
863
|
* Check if the current path type requires JavaScript animation
|
|
860
864
|
*/
|
|
861
865
|
requiresJSAnimation() {
|
|
862
|
-
return
|
|
866
|
+
return ue(this.pathConfig.type);
|
|
863
867
|
}
|
|
864
868
|
/**
|
|
865
869
|
* Get the path configuration
|
|
@@ -1050,7 +1054,193 @@ class le {
|
|
|
1050
1054
|
return 1 - (1 - t) * (1 - t);
|
|
1051
1055
|
}
|
|
1052
1056
|
}
|
|
1053
|
-
class
|
|
1057
|
+
class me {
|
|
1058
|
+
constructor(t, i = 600) {
|
|
1059
|
+
this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Register an image element for idle animation.
|
|
1063
|
+
* Starts animation after entry duration completes.
|
|
1064
|
+
*/
|
|
1065
|
+
register(t, i, e, o) {
|
|
1066
|
+
if (this.entries.has(t)) return;
|
|
1067
|
+
const a = o ?? this.entryDurationMs, r = this.config.startDelay ?? a, s = {
|
|
1068
|
+
element: t,
|
|
1069
|
+
index: i,
|
|
1070
|
+
totalImages: e,
|
|
1071
|
+
animation: null,
|
|
1072
|
+
blinkAnimation: null,
|
|
1073
|
+
customTeardown: null,
|
|
1074
|
+
paused: !1,
|
|
1075
|
+
stopped: !1,
|
|
1076
|
+
startTimer: null
|
|
1077
|
+
};
|
|
1078
|
+
this.entries.set(t, s), s.startTimer = setTimeout(() => {
|
|
1079
|
+
s.startTimer = null, !s.stopped && !s.paused && this._startAnimation(s);
|
|
1080
|
+
}, r);
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Pause idle animation for a specific image (set to neutral then pause).
|
|
1084
|
+
*/
|
|
1085
|
+
pauseForImage(t) {
|
|
1086
|
+
const i = this.entries.get(t);
|
|
1087
|
+
i && (i.paused = !0, i.startTimer !== null && (clearTimeout(i.startTimer), i.startTimer = null), this._pauseEntry(i));
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Resume idle animation for a specific image by starting a fresh animation.
|
|
1091
|
+
* Always restarts rather than resuming, to avoid Web Animations API
|
|
1092
|
+
* quirks with negative-delay animations after pause/cancel.
|
|
1093
|
+
*/
|
|
1094
|
+
resumeForImage(t) {
|
|
1095
|
+
const i = this.entries.get(t);
|
|
1096
|
+
!i || i.stopped || (i.paused = !1, this._startAnimation(i));
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Stop and remove idle animation for a specific image.
|
|
1100
|
+
*/
|
|
1101
|
+
stopForImage(t) {
|
|
1102
|
+
const i = this.entries.get(t);
|
|
1103
|
+
i && (i.stopped = !0, i.startTimer !== null && (clearTimeout(i.startTimer), i.startTimer = null), this._cancelEntry(i), this.entries.delete(t));
|
|
1104
|
+
}
|
|
1105
|
+
pauseAll() {
|
|
1106
|
+
for (const t of this.entries.values())
|
|
1107
|
+
t.paused = !0, t.startTimer !== null && (clearTimeout(t.startTimer), t.startTimer = null), this._pauseEntry(t);
|
|
1108
|
+
}
|
|
1109
|
+
resumeAll() {
|
|
1110
|
+
for (const t of this.entries.values())
|
|
1111
|
+
t.stopped || (t.paused = !1, this._startAnimation(t));
|
|
1112
|
+
}
|
|
1113
|
+
stopAll() {
|
|
1114
|
+
for (const t of this.entries.values())
|
|
1115
|
+
t.stopped = !0, t.startTimer !== null && (clearTimeout(t.startTimer), t.startTimer = null), this._cancelEntry(t);
|
|
1116
|
+
this.entries.clear(), this._stopTogetherLoop();
|
|
1117
|
+
}
|
|
1118
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
1119
|
+
// Private helpers
|
|
1120
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
1121
|
+
_startAnimation(t) {
|
|
1122
|
+
const { type: i } = this.config;
|
|
1123
|
+
switch (i) {
|
|
1124
|
+
case "wiggle":
|
|
1125
|
+
this._startWiggle(t);
|
|
1126
|
+
break;
|
|
1127
|
+
case "pulse":
|
|
1128
|
+
this._startPulse(t);
|
|
1129
|
+
break;
|
|
1130
|
+
case "blink":
|
|
1131
|
+
this._startBlink(t);
|
|
1132
|
+
break;
|
|
1133
|
+
case "spin":
|
|
1134
|
+
this._startSpin(t);
|
|
1135
|
+
break;
|
|
1136
|
+
case "custom":
|
|
1137
|
+
this._startCustom(t);
|
|
1138
|
+
break;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
_startWiggle(t) {
|
|
1142
|
+
const i = { ...qt, ...this.config.wiggle }, e = [
|
|
1143
|
+
{ transform: "rotate(0deg)", offset: 0 },
|
|
1144
|
+
{ transform: `rotate(${i.maxAngle}deg)`, offset: 0.25 },
|
|
1145
|
+
{ transform: "rotate(0deg)", offset: 0.5 },
|
|
1146
|
+
{ transform: `rotate(${-i.maxAngle}deg)`, offset: 0.75 },
|
|
1147
|
+
{ transform: "rotate(0deg)", offset: 1 }
|
|
1148
|
+
];
|
|
1149
|
+
i.sync === "together" ? (t.animation = t.element.animate(e, {
|
|
1150
|
+
duration: i.speed,
|
|
1151
|
+
iterations: 1 / 0,
|
|
1152
|
+
composite: "add",
|
|
1153
|
+
fill: "both"
|
|
1154
|
+
}), t.animation.pause(), this._startTogetherLoop(i.speed)) : t.animation = t.element.animate(e, {
|
|
1155
|
+
duration: i.speed,
|
|
1156
|
+
delay: -(Math.random() * i.speed),
|
|
1157
|
+
iterations: 1 / 0,
|
|
1158
|
+
composite: "add"
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
_startPulse(t) {
|
|
1162
|
+
const i = { ...Bt, ...this.config.pulse }, e = [
|
|
1163
|
+
{ transform: "scale(1)", offset: 0 },
|
|
1164
|
+
{ transform: `scale(${i.maxScale})`, offset: 0.25 },
|
|
1165
|
+
{ transform: "scale(1)", offset: 0.5 },
|
|
1166
|
+
{ transform: `scale(${i.minScale})`, offset: 0.75 },
|
|
1167
|
+
{ transform: "scale(1)", offset: 1 }
|
|
1168
|
+
];
|
|
1169
|
+
i.sync === "together" ? (t.animation = t.element.animate(e, {
|
|
1170
|
+
duration: i.speed,
|
|
1171
|
+
iterations: 1 / 0,
|
|
1172
|
+
composite: "add",
|
|
1173
|
+
fill: "both"
|
|
1174
|
+
}), t.animation.pause(), this._startTogetherLoop(i.speed)) : t.animation = t.element.animate(e, {
|
|
1175
|
+
duration: i.speed,
|
|
1176
|
+
delay: -(Math.random() * i.speed),
|
|
1177
|
+
iterations: 1 / 0,
|
|
1178
|
+
composite: "add"
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
_startBlink(t) {
|
|
1182
|
+
const i = { ...Xt, ...this.config.blink }, e = -(Math.random() * i.speed), o = parseFloat(getComputedStyle(t.element).opacity) || 1;
|
|
1183
|
+
let a, r;
|
|
1184
|
+
i.style === "fade" ? (a = [
|
|
1185
|
+
{ opacity: o, offset: 0 },
|
|
1186
|
+
{ opacity: 0, offset: 0.5 },
|
|
1187
|
+
{ opacity: o, offset: 1 }
|
|
1188
|
+
], r = {
|
|
1189
|
+
duration: i.speed,
|
|
1190
|
+
delay: e,
|
|
1191
|
+
iterations: 1 / 0,
|
|
1192
|
+
easing: "ease-in-out"
|
|
1193
|
+
}) : (a = [
|
|
1194
|
+
{ opacity: o, offset: 0 },
|
|
1195
|
+
{ opacity: o, offset: i.onRatio },
|
|
1196
|
+
{ opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
|
|
1197
|
+
{ opacity: 0, offset: 0.99 },
|
|
1198
|
+
{ opacity: o, offset: 1 }
|
|
1199
|
+
], r = {
|
|
1200
|
+
duration: i.speed,
|
|
1201
|
+
delay: e,
|
|
1202
|
+
iterations: 1 / 0
|
|
1203
|
+
}), t.blinkAnimation = t.element.animate(a, r);
|
|
1204
|
+
}
|
|
1205
|
+
_startSpin(t) {
|
|
1206
|
+
const i = { ...Yt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
|
|
1207
|
+
t.animation = t.element.animate(
|
|
1208
|
+
[{ transform: "rotate(0deg)" }, { transform: `rotate(${e}deg)` }],
|
|
1209
|
+
{
|
|
1210
|
+
duration: i.speed,
|
|
1211
|
+
iterations: 1 / 0,
|
|
1212
|
+
easing: "linear",
|
|
1213
|
+
composite: "add"
|
|
1214
|
+
}
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1217
|
+
_startCustom(t) {
|
|
1218
|
+
const i = this.config.custom;
|
|
1219
|
+
if (!i) return;
|
|
1220
|
+
const e = i({ element: t.element, index: t.index, totalImages: t.totalImages });
|
|
1221
|
+
typeof e == "function" ? t.customTeardown = e : e && typeof e.play == "function" && (t.animation = e);
|
|
1222
|
+
}
|
|
1223
|
+
_startTogetherLoop(t) {
|
|
1224
|
+
if (this.togetherSpeed = t, this.togetherRafId !== null) return;
|
|
1225
|
+
const i = () => {
|
|
1226
|
+
const e = performance.now() % this.togetherSpeed;
|
|
1227
|
+
for (const o of this.entries.values())
|
|
1228
|
+
!o.stopped && !o.paused && o.animation && (o.animation.currentTime = e);
|
|
1229
|
+
this.togetherRafId = requestAnimationFrame(i);
|
|
1230
|
+
};
|
|
1231
|
+
this.togetherRafId = requestAnimationFrame(i);
|
|
1232
|
+
}
|
|
1233
|
+
_stopTogetherLoop() {
|
|
1234
|
+
this.togetherRafId !== null && (cancelAnimationFrame(this.togetherRafId), this.togetherRafId = null);
|
|
1235
|
+
}
|
|
1236
|
+
_pauseEntry(t) {
|
|
1237
|
+
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null);
|
|
1238
|
+
}
|
|
1239
|
+
_cancelEntry(t) {
|
|
1240
|
+
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
class pe {
|
|
1054
1244
|
constructor(t, i = {}) {
|
|
1055
1245
|
this.config = t, this.imageConfig = i;
|
|
1056
1246
|
}
|
|
@@ -1062,12 +1252,12 @@ class he {
|
|
|
1062
1252
|
* @returns Array of layout objects with position, rotation, scale
|
|
1063
1253
|
*/
|
|
1064
1254
|
generate(t, i, e = {}) {
|
|
1065
|
-
const o = [], { 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,
|
|
1255
|
+
const o = [], { 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, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, f = c * 1.5 / 2, m = c / 2, y = a - s - f, w = r - s - m, v = s + f, I = s + m;
|
|
1066
1256
|
for (let x = 0; x < t; x++) {
|
|
1067
|
-
const R = this.random(v, y),
|
|
1257
|
+
const R = this.random(v, y), z = this.random(I, w), L = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, g) : 1, O = c * _, H = {
|
|
1068
1258
|
id: x,
|
|
1069
1259
|
x: R,
|
|
1070
|
-
y:
|
|
1260
|
+
y: z,
|
|
1071
1261
|
rotation: L,
|
|
1072
1262
|
scale: _,
|
|
1073
1263
|
baseSize: O
|
|
@@ -1086,7 +1276,7 @@ class he {
|
|
|
1086
1276
|
return Math.random() * (i - t) + t;
|
|
1087
1277
|
}
|
|
1088
1278
|
}
|
|
1089
|
-
class
|
|
1279
|
+
class be {
|
|
1090
1280
|
constructor(t, i = {}) {
|
|
1091
1281
|
this.config = t, this.imageConfig = i;
|
|
1092
1282
|
}
|
|
@@ -1098,22 +1288,22 @@ class de {
|
|
|
1098
1288
|
* @returns Array of layout objects with position, rotation, scale
|
|
1099
1289
|
*/
|
|
1100
1290
|
generate(t, i, e = {}) {
|
|
1101
|
-
const o = [], { 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,
|
|
1102
|
-
...
|
|
1291
|
+
const o = [], { 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, g = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
|
|
1292
|
+
...Ht,
|
|
1103
1293
|
...this.config.radial
|
|
1104
|
-
},
|
|
1105
|
-
m - v -
|
|
1106
|
-
y - v -
|
|
1294
|
+
}, f = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, I = Math.max(f * 0.8, Math.min(
|
|
1295
|
+
m - v - f / 2,
|
|
1296
|
+
y - v - f / 2
|
|
1107
1297
|
));
|
|
1108
1298
|
if (t > 0) {
|
|
1109
|
-
const
|
|
1299
|
+
const z = g ? this.random(h, d) : 1, L = f * z;
|
|
1110
1300
|
o.push({
|
|
1111
1301
|
id: 0,
|
|
1112
1302
|
x: m,
|
|
1113
1303
|
y,
|
|
1114
1304
|
rotation: c === "random" ? this.random(l * 0.33, u * 0.33) : 0,
|
|
1115
1305
|
// Less rotation for center
|
|
1116
|
-
scale:
|
|
1306
|
+
scale: z,
|
|
1117
1307
|
baseSize: L,
|
|
1118
1308
|
zIndex: 100
|
|
1119
1309
|
// Center image is highest
|
|
@@ -1121,25 +1311,25 @@ class de {
|
|
|
1121
1311
|
}
|
|
1122
1312
|
let x = 1, R = 1;
|
|
1123
1313
|
for (; x < t; ) {
|
|
1124
|
-
const
|
|
1314
|
+
const z = R / w, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(f * 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(f), D = Math.floor(k / (T * 0.7));
|
|
1125
1315
|
if (D === 0) {
|
|
1126
1316
|
R++;
|
|
1127
1317
|
continue;
|
|
1128
1318
|
}
|
|
1129
1319
|
const G = 2 * Math.PI / D, U = R * (20 * Math.PI / 180);
|
|
1130
1320
|
for (let M = 0; M < D && x < t; M++) {
|
|
1131
|
-
const
|
|
1132
|
-
let $ = m + Math.cos(
|
|
1133
|
-
const P =
|
|
1134
|
-
$ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P),
|
|
1135
|
-
const
|
|
1321
|
+
const A = M * G + U, N = g ? this.random(h, d) : 1, B = L * N, C = f * B;
|
|
1322
|
+
let $ = m + Math.cos(A) * H, F = y + Math.sin(A) * O;
|
|
1323
|
+
const P = C * 1.5 / 2, j = C / 2;
|
|
1324
|
+
$ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P), F - j < v ? F = v + j : F + j > r - v && (F = r - v - j);
|
|
1325
|
+
const Y = c === "random" ? this.random(l, u) : 0;
|
|
1136
1326
|
o.push({
|
|
1137
1327
|
id: x,
|
|
1138
1328
|
x: $,
|
|
1139
|
-
y:
|
|
1140
|
-
rotation:
|
|
1141
|
-
scale:
|
|
1142
|
-
baseSize:
|
|
1329
|
+
y: F,
|
|
1330
|
+
rotation: Y,
|
|
1331
|
+
scale: B,
|
|
1332
|
+
baseSize: C,
|
|
1143
1333
|
zIndex: Math.max(1, 100 - R)
|
|
1144
1334
|
// Outer rings have lower z-index
|
|
1145
1335
|
}), x++;
|
|
@@ -1167,7 +1357,7 @@ class de {
|
|
|
1167
1357
|
return Math.random() * (i - t) + t;
|
|
1168
1358
|
}
|
|
1169
1359
|
}
|
|
1170
|
-
const
|
|
1360
|
+
const ye = {
|
|
1171
1361
|
columns: "auto",
|
|
1172
1362
|
rows: "auto",
|
|
1173
1363
|
stagger: "none",
|
|
@@ -1177,7 +1367,7 @@ const ue = {
|
|
|
1177
1367
|
alignment: "center",
|
|
1178
1368
|
gap: 10,
|
|
1179
1369
|
overflowOffset: 0.25
|
|
1180
|
-
},
|
|
1370
|
+
}, At = [
|
|
1181
1371
|
{ x: 1, y: 1 },
|
|
1182
1372
|
// bottom-right
|
|
1183
1373
|
{ x: -1, y: -1 },
|
|
@@ -1195,7 +1385,7 @@ const ue = {
|
|
|
1195
1385
|
{ x: 0, y: 1 }
|
|
1196
1386
|
// down
|
|
1197
1387
|
];
|
|
1198
|
-
class
|
|
1388
|
+
class ve {
|
|
1199
1389
|
constructor(t, i = {}) {
|
|
1200
1390
|
this.config = t, this.imageConfig = i;
|
|
1201
1391
|
}
|
|
@@ -1207,60 +1397,60 @@ class ge {
|
|
|
1207
1397
|
* @returns Array of layout objects with position, rotation, scale
|
|
1208
1398
|
*/
|
|
1209
1399
|
generate(t, i, e = {}) {
|
|
1210
|
-
const o = [], { width: a, height: r } = i, s = { ...
|
|
1400
|
+
const o = [], { width: a, height: r } = i, s = { ...ye, ...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, g = h !== 1 || d !== 1, b = a - 2 * c, p = r - 2 * c, { columns: f, rows: m } = this.calculateGridDimensions(
|
|
1211
1401
|
t,
|
|
1212
1402
|
b,
|
|
1213
1403
|
p,
|
|
1214
1404
|
l,
|
|
1215
1405
|
s
|
|
1216
|
-
), y = s.stagger === "row", w = s.stagger === "column", v = y ?
|
|
1406
|
+
), y = s.stagger === "row", w = s.stagger === "column", v = y ? f + 0.5 : f, I = w ? m + 0.5 : m, x = (b - s.gap * (f - 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 = f * x + (f - 1) * s.gap + z, T = m * R + (m - 1) * s.gap + L, D = c + (b - k) / 2, G = c + (p - T) / 2, U = f * m, M = s.columns !== "auto" && s.rows !== "auto", A = M && t > U;
|
|
1217
1407
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1218
1408
|
gridConfigColumns: s.columns,
|
|
1219
1409
|
gridConfigRows: s.rows,
|
|
1220
|
-
columns:
|
|
1410
|
+
columns: f,
|
|
1221
1411
|
rows: m,
|
|
1222
1412
|
cellCount: U,
|
|
1223
1413
|
hasFixedGrid: M,
|
|
1224
1414
|
imageCount: t,
|
|
1225
|
-
isOverflowMode:
|
|
1415
|
+
isOverflowMode: A
|
|
1226
1416
|
});
|
|
1227
|
-
const
|
|
1228
|
-
for (let
|
|
1229
|
-
let $,
|
|
1230
|
-
if (
|
|
1231
|
-
const q =
|
|
1232
|
-
|
|
1417
|
+
const N = A ? new Array(U).fill(0) : [], B = Math.min(x, R) * s.overflowOffset;
|
|
1418
|
+
for (let C = 0; C < t; C++) {
|
|
1419
|
+
let $, F, X = 0;
|
|
1420
|
+
if (A && C >= U) {
|
|
1421
|
+
const q = C - U, W = q % U;
|
|
1422
|
+
X = Math.floor(q / U) + 1, N[W]++, s.fillDirection === "row" ? ($ = W % f, F = Math.floor(W / f)) : (F = W % m, $ = Math.floor(W / m));
|
|
1233
1423
|
} else
|
|
1234
|
-
s.fillDirection === "row" ? ($ =
|
|
1235
|
-
let P = D + $ * (x + s.gap) + x / 2,
|
|
1236
|
-
if (s.stagger === "row" &&
|
|
1237
|
-
const q = (
|
|
1238
|
-
P += W.x *
|
|
1424
|
+
s.fillDirection === "row" ? ($ = C % f, F = Math.floor(C / f)) : (F = C % m, $ = Math.floor(C / m));
|
|
1425
|
+
let P = D + $ * (x + s.gap) + x / 2, j = G + F * (R + s.gap) + R / 2;
|
|
1426
|
+
if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (j += R / 2), X > 0) {
|
|
1427
|
+
const q = (X - 1) % At.length, W = At[q];
|
|
1428
|
+
P += W.x * B, j += W.y * B;
|
|
1239
1429
|
}
|
|
1240
1430
|
if (s.jitter > 0) {
|
|
1241
1431
|
const q = x / 2 * s.jitter, W = R / 2 * s.jitter;
|
|
1242
|
-
P += this.random(-q, q),
|
|
1432
|
+
P += this.random(-q, q), j += this.random(-W, W);
|
|
1243
1433
|
}
|
|
1244
|
-
let
|
|
1245
|
-
if (!
|
|
1246
|
-
const q = t %
|
|
1247
|
-
if (
|
|
1434
|
+
let Y = P, J = j;
|
|
1435
|
+
if (!A && s.fillDirection === "row") {
|
|
1436
|
+
const q = t % f || f;
|
|
1437
|
+
if (F === Math.floor((t - 1) / f) && q < f) {
|
|
1248
1438
|
const St = q * x + (q - 1) * s.gap;
|
|
1249
|
-
let
|
|
1250
|
-
s.alignment === "center" ?
|
|
1439
|
+
let ft = 0;
|
|
1440
|
+
s.alignment === "center" ? ft = (k - St) / 2 : s.alignment === "end" && (ft = k - St), Y += ft;
|
|
1251
1441
|
}
|
|
1252
1442
|
}
|
|
1253
|
-
const rt =
|
|
1254
|
-
|
|
1443
|
+
const rt = g ? 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;
|
|
1444
|
+
Y = Math.max(lt, Math.min(Y, ht)), J = Math.max(Pt, Math.min(J, _t));
|
|
1255
1445
|
let dt = 0;
|
|
1256
1446
|
if (u === "random") {
|
|
1257
1447
|
const q = this.imageConfig.rotation?.range?.min ?? -15, W = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1258
1448
|
s.jitter > 0 ? dt = this.random(q * s.jitter, W * s.jitter) : dt = this.random(q, W);
|
|
1259
1449
|
}
|
|
1260
1450
|
let ut;
|
|
1261
|
-
|
|
1262
|
-
id:
|
|
1263
|
-
x:
|
|
1451
|
+
A && X > 0 ? ut = 50 - X : ut = A ? 100 + C : C + 1, o.push({
|
|
1452
|
+
id: C,
|
|
1453
|
+
x: Y,
|
|
1264
1454
|
y: J,
|
|
1265
1455
|
rotation: dt,
|
|
1266
1456
|
scale: rt,
|
|
@@ -1295,14 +1485,14 @@ class ge {
|
|
|
1295
1485
|
return Math.random() * (i - t) + t;
|
|
1296
1486
|
}
|
|
1297
1487
|
}
|
|
1298
|
-
const
|
|
1488
|
+
const we = Math.PI * (3 - Math.sqrt(5)), xe = {
|
|
1299
1489
|
spiralType: "golden",
|
|
1300
1490
|
direction: "counterclockwise",
|
|
1301
1491
|
tightness: 1,
|
|
1302
1492
|
scaleDecay: 0,
|
|
1303
1493
|
startAngle: 0
|
|
1304
1494
|
};
|
|
1305
|
-
class
|
|
1495
|
+
class Ee {
|
|
1306
1496
|
constructor(t, i = {}) {
|
|
1307
1497
|
this.config = t, this.imageConfig = i;
|
|
1308
1498
|
}
|
|
@@ -1314,14 +1504,14 @@ class pe {
|
|
|
1314
1504
|
* @returns Array of layout objects with position, rotation, scale
|
|
1315
1505
|
*/
|
|
1316
1506
|
generate(t, i, e = {}) {
|
|
1317
|
-
const o = [], { width: a, height: r } = i, s = { ...
|
|
1507
|
+
const o = [], { width: a, height: r } = i, s = { ...xe, ...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, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, y = r / 2, w = Math.min(
|
|
1318
1508
|
m - c - l / 2,
|
|
1319
1509
|
y - c - l / 2
|
|
1320
1510
|
), v = s.direction === "clockwise" ? -1 : 1;
|
|
1321
1511
|
for (let I = 0; I < t; I++) {
|
|
1322
1512
|
let x, R;
|
|
1323
1513
|
if (s.spiralType === "golden")
|
|
1324
|
-
x = I *
|
|
1514
|
+
x = I * we * v + s.startAngle, R = this.calculateGoldenRadius(I, t, w, s.tightness);
|
|
1325
1515
|
else if (s.spiralType === "archimedean") {
|
|
1326
1516
|
const P = I * 0.5 * s.tightness;
|
|
1327
1517
|
x = P * v + s.startAngle, R = this.calculateArchimedeanRadius(P, t, w, s.tightness);
|
|
@@ -1329,21 +1519,21 @@ class pe {
|
|
|
1329
1519
|
const P = I * 0.3 * s.tightness;
|
|
1330
1520
|
x = P * v + s.startAngle, R = this.calculateLogarithmicRadius(P, t, w, s.tightness);
|
|
1331
1521
|
}
|
|
1332
|
-
const
|
|
1333
|
-
let
|
|
1522
|
+
const z = m + Math.cos(x) * R, L = y + Math.sin(x) * R, _ = R / w, O = f > 0 ? 1 - _ * f * 0.5 : 1, H = p ? this.random(g, 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));
|
|
1523
|
+
let F = 0;
|
|
1334
1524
|
if (u === "random") {
|
|
1335
|
-
const P = x * 180 / Math.PI % 360,
|
|
1336
|
-
|
|
1337
|
-
} else u === "tangent" && (
|
|
1338
|
-
const
|
|
1525
|
+
const P = x * 180 / Math.PI % 360, j = this.random(h, d);
|
|
1526
|
+
F = s.spiralType === "golden" ? j : P * 0.1 + j * 0.9;
|
|
1527
|
+
} else u === "tangent" && (F = this.calculateSpiralTangent(x, R, s));
|
|
1528
|
+
const X = t - I;
|
|
1339
1529
|
o.push({
|
|
1340
1530
|
id: I,
|
|
1341
|
-
x:
|
|
1531
|
+
x: C,
|
|
1342
1532
|
y: $,
|
|
1343
|
-
rotation:
|
|
1344
|
-
scale:
|
|
1345
|
-
baseSize:
|
|
1346
|
-
zIndex:
|
|
1533
|
+
rotation: F,
|
|
1534
|
+
scale: k,
|
|
1535
|
+
baseSize: T,
|
|
1536
|
+
zIndex: X
|
|
1347
1537
|
});
|
|
1348
1538
|
}
|
|
1349
1539
|
return o;
|
|
@@ -1396,7 +1586,7 @@ class pe {
|
|
|
1396
1586
|
return Math.random() * (i - t) + t;
|
|
1397
1587
|
}
|
|
1398
1588
|
}
|
|
1399
|
-
const
|
|
1589
|
+
const Se = {
|
|
1400
1590
|
clusterCount: "auto",
|
|
1401
1591
|
clusterSpread: 150,
|
|
1402
1592
|
clusterSpacing: 200,
|
|
@@ -1404,7 +1594,7 @@ const be = {
|
|
|
1404
1594
|
overlap: 0.3,
|
|
1405
1595
|
distribution: "gaussian"
|
|
1406
1596
|
};
|
|
1407
|
-
class
|
|
1597
|
+
class Ie {
|
|
1408
1598
|
constructor(t, i = {}) {
|
|
1409
1599
|
this.config = t, this.imageConfig = i;
|
|
1410
1600
|
}
|
|
@@ -1416,46 +1606,46 @@ class ye {
|
|
|
1416
1606
|
* @returns Array of layout objects with position, rotation, scale
|
|
1417
1607
|
*/
|
|
1418
1608
|
generate(t, i, e = {}) {
|
|
1419
|
-
const o = [], { width: a, height: r } = i, s = { ...
|
|
1609
|
+
const o = [], { width: a, height: r } = i, s = { ...Se, ...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, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.calculateClusterCount(
|
|
1420
1610
|
t,
|
|
1421
1611
|
s.clusterCount,
|
|
1422
1612
|
a,
|
|
1423
1613
|
r,
|
|
1424
1614
|
s.clusterSpacing
|
|
1425
1615
|
), m = this.generateClusterCenters(
|
|
1426
|
-
|
|
1616
|
+
f,
|
|
1427
1617
|
a,
|
|
1428
1618
|
r,
|
|
1429
1619
|
c,
|
|
1430
1620
|
s
|
|
1431
|
-
), y = new Array(
|
|
1621
|
+
), y = new Array(f).fill(0);
|
|
1432
1622
|
for (let v = 0; v < t; v++)
|
|
1433
|
-
y[v %
|
|
1623
|
+
y[v % f]++;
|
|
1434
1624
|
let w = 0;
|
|
1435
|
-
for (let v = 0; v <
|
|
1625
|
+
for (let v = 0; v < f; v++) {
|
|
1436
1626
|
const I = m[v], x = y[v];
|
|
1437
1627
|
for (let R = 0; R < x; R++) {
|
|
1438
|
-
let
|
|
1628
|
+
let z, L;
|
|
1439
1629
|
if (s.distribution === "gaussian")
|
|
1440
|
-
|
|
1630
|
+
z = this.gaussianRandom() * I.spread, L = this.gaussianRandom() * I.spread;
|
|
1441
1631
|
else {
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1632
|
+
const F = this.random(0, Math.PI * 2), X = this.random(0, I.spread);
|
|
1633
|
+
z = Math.cos(F) * X, L = Math.sin(F) * X;
|
|
1444
1634
|
}
|
|
1445
1635
|
const _ = 1 + s.overlap * 0.5, O = 1 + s.overlap * 0.3;
|
|
1446
|
-
|
|
1447
|
-
const H = p ? this.random(
|
|
1448
|
-
let D = I.x +
|
|
1449
|
-
const M =
|
|
1450
|
-
D = Math.max(c + M, Math.min(D, a - c - M)), G = Math.max(c +
|
|
1451
|
-
const
|
|
1636
|
+
z /= _, L /= _;
|
|
1637
|
+
const H = p ? this.random(g, b) : 1, k = O * H, T = l * k;
|
|
1638
|
+
let D = I.x + z, G = I.y + L;
|
|
1639
|
+
const M = T * 1.5 / 2, A = T / 2;
|
|
1640
|
+
D = Math.max(c + M, Math.min(D, a - c - M)), G = Math.max(c + A, Math.min(G, r - c - A));
|
|
1641
|
+
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
1642
|
o.push({
|
|
1453
1643
|
id: w,
|
|
1454
1644
|
x: D,
|
|
1455
1645
|
y: G,
|
|
1456
|
-
rotation:
|
|
1457
|
-
scale:
|
|
1458
|
-
baseSize:
|
|
1646
|
+
rotation: N,
|
|
1647
|
+
scale: k,
|
|
1648
|
+
baseSize: T,
|
|
1459
1649
|
zIndex: $
|
|
1460
1650
|
}), w++;
|
|
1461
1651
|
}
|
|
@@ -1479,22 +1669,22 @@ class ye {
|
|
|
1479
1669
|
generateClusterCenters(t, i, e, o, a) {
|
|
1480
1670
|
const r = [], c = o + a.clusterSpread, l = i - o - a.clusterSpread, u = o + a.clusterSpread, h = e - o - a.clusterSpread;
|
|
1481
1671
|
for (let d = 0; d < t; d++) {
|
|
1482
|
-
let
|
|
1672
|
+
let g = null, b = -1;
|
|
1483
1673
|
for (let p = 0; p < 100; p++) {
|
|
1484
|
-
const
|
|
1674
|
+
const f = {
|
|
1485
1675
|
x: this.random(c, l),
|
|
1486
1676
|
y: this.random(u, h),
|
|
1487
1677
|
spread: this.calculateClusterSpread(a)
|
|
1488
1678
|
};
|
|
1489
1679
|
let m = 1 / 0;
|
|
1490
1680
|
for (const y of r) {
|
|
1491
|
-
const w =
|
|
1681
|
+
const w = f.x - y.x, v = f.y - y.y, I = Math.sqrt(w * w + v * v);
|
|
1492
1682
|
m = Math.min(m, I);
|
|
1493
1683
|
}
|
|
1494
|
-
if ((r.length === 0 || m > b) && (
|
|
1684
|
+
if ((r.length === 0 || m > b) && (g = f, b = m), m >= a.clusterSpacing)
|
|
1495
1685
|
break;
|
|
1496
1686
|
}
|
|
1497
|
-
|
|
1687
|
+
g && r.push(g);
|
|
1498
1688
|
}
|
|
1499
1689
|
return r;
|
|
1500
1690
|
}
|
|
@@ -1522,7 +1712,7 @@ class ye {
|
|
|
1522
1712
|
return Math.random() * (i - t) + t;
|
|
1523
1713
|
}
|
|
1524
1714
|
}
|
|
1525
|
-
class
|
|
1715
|
+
class Re {
|
|
1526
1716
|
constructor(t, i = {}) {
|
|
1527
1717
|
this.config = t, this.imageConfig = i;
|
|
1528
1718
|
}
|
|
@@ -1534,27 +1724,27 @@ class ve {
|
|
|
1534
1724
|
* @returns Array of layout objects with position, rotation, scale
|
|
1535
1725
|
*/
|
|
1536
1726
|
generate(t, i, e = {}) {
|
|
1537
|
-
const o = [], { 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,
|
|
1538
|
-
...
|
|
1727
|
+
const o = [], { 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, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, p = e.fixedHeight ?? s, f = {
|
|
1728
|
+
...kt,
|
|
1539
1729
|
...this.config.wave
|
|
1540
|
-
}, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization: I } =
|
|
1730
|
+
}, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization: I } = f, 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
1731
|
let M = 0;
|
|
1542
|
-
for (let
|
|
1543
|
-
const
|
|
1544
|
-
let
|
|
1545
|
-
I === "offset" ?
|
|
1546
|
-
for (let
|
|
1547
|
-
const $ = x === 1 ? (_ + O) / 2 : _ +
|
|
1732
|
+
for (let A = 0; A < m && M < t; A++) {
|
|
1733
|
+
const N = m === 1 ? (T + D) / 2 : T + A * U;
|
|
1734
|
+
let B = 0;
|
|
1735
|
+
I === "offset" ? B = A * v : I === "alternating" && (B = A * Math.PI);
|
|
1736
|
+
for (let C = 0; C < x && M < t; C++) {
|
|
1737
|
+
const $ = x === 1 ? (_ + O) / 2 : _ + C * k, F = this.calculateWaveY($, a, y, w, B), X = $, P = N + F, j = b ? this.random(d, g) : 1, Y = p * j;
|
|
1548
1738
|
let J = 0;
|
|
1549
|
-
l === "tangent" ? J = this.calculateRotation($, a, y, w,
|
|
1550
|
-
const K =
|
|
1739
|
+
l === "tangent" ? J = this.calculateRotation($, a, y, w, B) : l === "random" && (J = this.random(u, h));
|
|
1740
|
+
const K = Y * 1.5 / 2, ct = Y / 2, it = c + K, nt = a - c - K, lt = c + ct, ht = r - c - ct;
|
|
1551
1741
|
o.push({
|
|
1552
1742
|
id: M,
|
|
1553
|
-
x: Math.max(it, Math.min(
|
|
1743
|
+
x: Math.max(it, Math.min(X, nt)),
|
|
1554
1744
|
y: Math.max(lt, Math.min(P, ht)),
|
|
1555
1745
|
rotation: J,
|
|
1556
|
-
scale:
|
|
1557
|
-
baseSize:
|
|
1746
|
+
scale: j,
|
|
1747
|
+
baseSize: Y,
|
|
1558
1748
|
zIndex: M + 1
|
|
1559
1749
|
}), M++;
|
|
1560
1750
|
}
|
|
@@ -1612,21 +1802,21 @@ const xt = 100, Q = 100 / Math.sqrt(3), Et = [
|
|
|
1612
1802
|
// lower-left
|
|
1613
1803
|
[0, 50]
|
|
1614
1804
|
// left
|
|
1615
|
-
],
|
|
1616
|
-
function
|
|
1805
|
+
], Te = Et[1][0] / xt, Ae = Et[2][1] / xt;
|
|
1806
|
+
function Ce(n) {
|
|
1617
1807
|
return {
|
|
1618
|
-
colStep:
|
|
1619
|
-
rowOffset:
|
|
1808
|
+
colStep: Te * n,
|
|
1809
|
+
rowOffset: Ae * n
|
|
1620
1810
|
};
|
|
1621
1811
|
}
|
|
1622
|
-
function
|
|
1623
|
-
const { colStep: r } =
|
|
1812
|
+
function Le(n, t, i, e, o, a) {
|
|
1813
|
+
const { colStep: r } = Ce(a);
|
|
1624
1814
|
return {
|
|
1625
1815
|
px: e + r * n,
|
|
1626
1816
|
py: o + a * (t + n / 2)
|
|
1627
1817
|
};
|
|
1628
1818
|
}
|
|
1629
|
-
const
|
|
1819
|
+
const Me = [
|
|
1630
1820
|
[1, 0, -1],
|
|
1631
1821
|
[0, 1, -1],
|
|
1632
1822
|
[-1, 1, 0],
|
|
@@ -1634,16 +1824,16 @@ const Ie = [
|
|
|
1634
1824
|
[0, -1, 1],
|
|
1635
1825
|
[1, -1, 0]
|
|
1636
1826
|
];
|
|
1637
|
-
function
|
|
1827
|
+
function Fe(n) {
|
|
1638
1828
|
if (n === 0) return [[0, 0, 0]];
|
|
1639
1829
|
const t = [];
|
|
1640
1830
|
let [i, e, o] = [0, -n, n];
|
|
1641
|
-
for (const [a, r, s] of
|
|
1831
|
+
for (const [a, r, s] of Me)
|
|
1642
1832
|
for (let c = 0; c < n; c++)
|
|
1643
1833
|
t.push([i, e, o]), i += a, e += r, o += s;
|
|
1644
1834
|
return t;
|
|
1645
1835
|
}
|
|
1646
|
-
class
|
|
1836
|
+
class ze {
|
|
1647
1837
|
// imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
|
|
1648
1838
|
// would break hex tiling). Kept as parameter for interface compatibility.
|
|
1649
1839
|
constructor(t, i = {}) {
|
|
@@ -1654,14 +1844,14 @@ class Ce {
|
|
|
1654
1844
|
...Nt,
|
|
1655
1845
|
...this.config.honeycomb
|
|
1656
1846
|
}.spacing ?? 0, d = l + h;
|
|
1657
|
-
let
|
|
1658
|
-
for (;
|
|
1659
|
-
const p =
|
|
1660
|
-
for (const [
|
|
1661
|
-
if (
|
|
1662
|
-
const { px: w, py: v } =
|
|
1847
|
+
let g = 0, b = 0;
|
|
1848
|
+
for (; g < t; ) {
|
|
1849
|
+
const p = Fe(b);
|
|
1850
|
+
for (const [f, m, y] of p) {
|
|
1851
|
+
if (g >= t) break;
|
|
1852
|
+
const { px: w, py: v } = Le(f, m, y, s, c, d);
|
|
1663
1853
|
o.push({
|
|
1664
|
-
id:
|
|
1854
|
+
id: g,
|
|
1665
1855
|
x: w,
|
|
1666
1856
|
y: v,
|
|
1667
1857
|
rotation: 0,
|
|
@@ -1669,14 +1859,14 @@ class Ce {
|
|
|
1669
1859
|
baseSize: l,
|
|
1670
1860
|
// Inner rings render above outer rings
|
|
1671
1861
|
zIndex: Math.max(1, 100 - b)
|
|
1672
|
-
}),
|
|
1862
|
+
}), g++;
|
|
1673
1863
|
}
|
|
1674
1864
|
b++;
|
|
1675
1865
|
}
|
|
1676
1866
|
return o;
|
|
1677
1867
|
}
|
|
1678
1868
|
}
|
|
1679
|
-
class
|
|
1869
|
+
class Oe {
|
|
1680
1870
|
constructor(t) {
|
|
1681
1871
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1682
1872
|
}
|
|
@@ -1687,19 +1877,19 @@ class Te {
|
|
|
1687
1877
|
initLayout() {
|
|
1688
1878
|
switch (this.config.algorithm) {
|
|
1689
1879
|
case "radial":
|
|
1690
|
-
return new
|
|
1880
|
+
return new be(this.config, this.imageConfig);
|
|
1691
1881
|
case "grid":
|
|
1692
|
-
return new
|
|
1882
|
+
return new ve(this.config, this.imageConfig);
|
|
1693
1883
|
case "spiral":
|
|
1694
|
-
return new
|
|
1884
|
+
return new Ee(this.config, this.imageConfig);
|
|
1695
1885
|
case "cluster":
|
|
1696
|
-
return new
|
|
1886
|
+
return new Ie(this.config, this.imageConfig);
|
|
1697
1887
|
case "wave":
|
|
1698
|
-
return new
|
|
1888
|
+
return new Re(this.config, this.imageConfig);
|
|
1699
1889
|
case "honeycomb":
|
|
1700
|
-
return new
|
|
1890
|
+
return new ze(this.config, this.imageConfig);
|
|
1701
1891
|
default:
|
|
1702
|
-
return new
|
|
1892
|
+
return new pe(this.config, this.imageConfig);
|
|
1703
1893
|
}
|
|
1704
1894
|
}
|
|
1705
1895
|
/**
|
|
@@ -1812,7 +2002,7 @@ class Te {
|
|
|
1812
2002
|
}
|
|
1813
2003
|
}
|
|
1814
2004
|
var S = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(S || {});
|
|
1815
|
-
const
|
|
2005
|
+
const Ct = {
|
|
1816
2006
|
// Geometric shapes - uses percentages for responsive sizing
|
|
1817
2007
|
circle: "circle(50%)",
|
|
1818
2008
|
square: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)",
|
|
@@ -1821,7 +2011,7 @@ const At = {
|
|
|
1821
2011
|
hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
|
1822
2012
|
octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
|
|
1823
2013
|
diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
|
|
1824
|
-
},
|
|
2014
|
+
}, De = {
|
|
1825
2015
|
// Circle - uses radius in pixels (refHeight of 100px = 50px radius)
|
|
1826
2016
|
circle: {
|
|
1827
2017
|
refHeight: 100,
|
|
@@ -1859,29 +2049,29 @@ const At = {
|
|
|
1859
2049
|
points: [[50, 0], [100, 50], [50, 100], [0, 50]]
|
|
1860
2050
|
}
|
|
1861
2051
|
};
|
|
1862
|
-
function
|
|
2052
|
+
function $e(n) {
|
|
1863
2053
|
if (n)
|
|
1864
|
-
return n in
|
|
2054
|
+
return n in Ct ? Ct[n] : n;
|
|
1865
2055
|
}
|
|
1866
|
-
function
|
|
1867
|
-
const e =
|
|
2056
|
+
function Pe(n, t, i) {
|
|
2057
|
+
const e = De[n];
|
|
1868
2058
|
if (!e) return "";
|
|
1869
2059
|
const o = t / e.refHeight;
|
|
1870
2060
|
if (n === "circle")
|
|
1871
2061
|
return `circle(${Math.round(50 * o * 100) / 100}px)`;
|
|
1872
|
-
const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * o, c = (Math.min(...r) + Math.max(...r)) / 2 * o, l = (Math.max(...a) - Math.min(...a)) * o, u = (i ?? l) / 2, h = t / 2, d = u - s,
|
|
1873
|
-
return `polygon(${e.points.map(([p,
|
|
1874
|
-
const m = Math.round((p * o + d) * 100) / 100, y = Math.round((
|
|
2062
|
+
const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * o, c = (Math.min(...r) + Math.max(...r)) / 2 * o, l = (Math.max(...a) - Math.min(...a)) * o, u = (i ?? l) / 2, h = t / 2, d = u - s, g = h - c;
|
|
2063
|
+
return `polygon(${e.points.map(([p, f]) => {
|
|
2064
|
+
const m = Math.round((p * o + d) * 100) / 100, y = Math.round((f * o + g) * 100) / 100;
|
|
1875
2065
|
return `${m}px ${y}px`;
|
|
1876
2066
|
}).join(", ")})`;
|
|
1877
2067
|
}
|
|
1878
|
-
function
|
|
2068
|
+
function _e(n) {
|
|
1879
2069
|
return n in mt;
|
|
1880
2070
|
}
|
|
1881
|
-
function
|
|
1882
|
-
return n ?
|
|
2071
|
+
function Ue(n) {
|
|
2072
|
+
return n ? _e(n) ? mt[n] : n : mt.md;
|
|
1883
2073
|
}
|
|
1884
|
-
function
|
|
2074
|
+
function He(n) {
|
|
1885
2075
|
if (!n) return "";
|
|
1886
2076
|
const t = [];
|
|
1887
2077
|
if (n.grayscale !== void 0 && t.push(`grayscale(${n.grayscale})`), n.blur !== void 0 && t.push(`blur(${n.blur}px)`), n.brightness !== void 0 && t.push(`brightness(${n.brightness})`), n.contrast !== void 0 && t.push(`contrast(${n.contrast})`), n.saturate !== void 0 && t.push(`saturate(${n.saturate})`), n.opacity !== void 0 && t.push(`opacity(${n.opacity})`), n.sepia !== void 0 && t.push(`sepia(${n.sepia})`), n.hueRotate !== void 0 && t.push(`hue-rotate(${n.hueRotate}deg)`), n.invert !== void 0 && t.push(`invert(${n.invert})`), n.dropShadow !== void 0)
|
|
@@ -1910,8 +2100,8 @@ function et(n, t, i) {
|
|
|
1910
2100
|
const s = n.border || {}, c = { ...s, ...n.borderTop }, l = { ...s, ...n.borderRight }, u = { ...s, ...n.borderBottom }, h = { ...s, ...n.borderLeft };
|
|
1911
2101
|
e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
|
|
1912
2102
|
} else n.border && (e.border = tt(n.border));
|
|
1913
|
-
n.shadow !== void 0 && (e.boxShadow =
|
|
1914
|
-
const r =
|
|
2103
|
+
n.shadow !== void 0 && (e.boxShadow = Ue(n.shadow));
|
|
2104
|
+
const r = He(n.filter);
|
|
1915
2105
|
if (e.filter = r || "none", n.opacity !== void 0 && (e.opacity = String(n.opacity)), n.cursor !== void 0 && (e.cursor = n.cursor), n.outline && n.outline.style !== "none" && (n.outline.width ?? 0) > 0) {
|
|
1916
2106
|
const s = n.outline.width ?? 0, c = n.outline.style ?? "solid", l = n.outline.color ?? "#000000";
|
|
1917
2107
|
e.outline = `${s}px ${c} ${l}`, n.outline.offset !== void 0 && (e.outlineOffset = `${n.outline.offset}px`);
|
|
@@ -1920,33 +2110,33 @@ function et(n, t, i) {
|
|
|
1920
2110
|
let s;
|
|
1921
2111
|
const c = typeof n.clipPath == "object" && n.clipPath !== null && "shape" in n.clipPath, l = c ? n.clipPath : void 0;
|
|
1922
2112
|
if (l?.mode === "height-relative" && t)
|
|
1923
|
-
s =
|
|
2113
|
+
s = Pe(l.shape, t, i);
|
|
1924
2114
|
else {
|
|
1925
2115
|
const u = c && l ? l.shape : n.clipPath;
|
|
1926
|
-
s =
|
|
2116
|
+
s = $e(u);
|
|
1927
2117
|
}
|
|
1928
2118
|
s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
|
|
1929
2119
|
}
|
|
1930
2120
|
return e;
|
|
1931
2121
|
}
|
|
1932
|
-
function
|
|
2122
|
+
function ke(n, t) {
|
|
1933
2123
|
t.borderRadius !== void 0 && (n.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (n.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (n.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (n.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (n.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (n.style.border = t.border), t.borderTop !== void 0 && (n.style.borderTop = t.borderTop), t.borderRight !== void 0 && (n.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (n.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (n.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (n.style.boxShadow = t.boxShadow), t.filter !== void 0 && (n.style.filter = t.filter), t.opacity !== void 0 && (n.style.opacity = t.opacity), t.cursor !== void 0 && (n.style.cursor = t.cursor), t.outline !== void 0 && (n.style.outline = t.outline), t.outlineOffset !== void 0 && (n.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (n.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (n.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (n.style.clipPath = t.clipPath), t.overflow !== void 0 && (n.style.overflow = t.overflow);
|
|
1934
2124
|
}
|
|
1935
|
-
function
|
|
2125
|
+
function gt(n, t, i, e) {
|
|
1936
2126
|
const o = et(t, i, e);
|
|
1937
|
-
|
|
2127
|
+
ke(n, o);
|
|
1938
2128
|
}
|
|
1939
|
-
function
|
|
2129
|
+
function $t(n) {
|
|
1940
2130
|
return n ? Array.isArray(n) ? n.join(" ") : n : "";
|
|
1941
2131
|
}
|
|
1942
2132
|
function st(n, t) {
|
|
1943
|
-
const i =
|
|
2133
|
+
const i = $t(t);
|
|
1944
2134
|
i && i.split(" ").forEach((e) => {
|
|
1945
2135
|
e.trim() && n.classList.add(e.trim());
|
|
1946
2136
|
});
|
|
1947
2137
|
}
|
|
1948
2138
|
function pt(n, t) {
|
|
1949
|
-
const i =
|
|
2139
|
+
const i = $t(t);
|
|
1950
2140
|
i && i.split(" ").forEach((e) => {
|
|
1951
2141
|
e.trim() && n.classList.remove(e.trim());
|
|
1952
2142
|
});
|
|
@@ -1955,9 +2145,15 @@ const Lt = {
|
|
|
1955
2145
|
UNFOCUSING: 999,
|
|
1956
2146
|
FOCUSING: 1e3
|
|
1957
2147
|
};
|
|
1958
|
-
class
|
|
2148
|
+
class Ne {
|
|
1959
2149
|
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;
|
|
2150
|
+
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;
|
|
2151
|
+
}
|
|
2152
|
+
/**
|
|
2153
|
+
* Set callback to be fired when an unfocus animation fully completes.
|
|
2154
|
+
*/
|
|
2155
|
+
setOnUnfocusCompleteCallback(t) {
|
|
2156
|
+
this.onUnfocusComplete = t;
|
|
1961
2157
|
}
|
|
1962
2158
|
/**
|
|
1963
2159
|
* Get current state machine state
|
|
@@ -2088,16 +2284,16 @@ class $e {
|
|
|
2088
2284
|
rotation: e.rotation,
|
|
2089
2285
|
scale: 1
|
|
2090
2286
|
// No scale - using dimensions
|
|
2091
|
-
},
|
|
2287
|
+
}, g = a?.width ?? s, b = a?.height ?? c, p = this.animateWithDimensions(
|
|
2092
2288
|
t,
|
|
2093
2289
|
d,
|
|
2094
2290
|
u,
|
|
2095
|
-
|
|
2291
|
+
g,
|
|
2096
2292
|
b,
|
|
2097
2293
|
l.width,
|
|
2098
2294
|
l.height,
|
|
2099
2295
|
h
|
|
2100
|
-
),
|
|
2296
|
+
), f = {
|
|
2101
2297
|
id: `focus-${Date.now()}`,
|
|
2102
2298
|
element: t,
|
|
2103
2299
|
animation: p,
|
|
@@ -2115,10 +2311,10 @@ class $e {
|
|
|
2115
2311
|
originalHeight: c,
|
|
2116
2312
|
focusWidth: l.width,
|
|
2117
2313
|
focusHeight: l.height
|
|
2118
|
-
}, this.startClipPathAnimation(t,
|
|
2314
|
+
}, this.startClipPathAnimation(t, f, !0), {
|
|
2119
2315
|
element: t,
|
|
2120
2316
|
originalState: e,
|
|
2121
|
-
animationHandle:
|
|
2317
|
+
animationHandle: f,
|
|
2122
2318
|
direction: "in",
|
|
2123
2319
|
originalWidth: s,
|
|
2124
2320
|
originalHeight: c
|
|
@@ -2148,7 +2344,7 @@ class $e {
|
|
|
2148
2344
|
u,
|
|
2149
2345
|
h,
|
|
2150
2346
|
a
|
|
2151
|
-
),
|
|
2347
|
+
), g = {
|
|
2152
2348
|
id: `unfocus-${Date.now()}`,
|
|
2153
2349
|
element: t,
|
|
2154
2350
|
animation: d,
|
|
@@ -2157,10 +2353,10 @@ class $e {
|
|
|
2157
2353
|
startTime: performance.now(),
|
|
2158
2354
|
duration: a
|
|
2159
2355
|
};
|
|
2160
|
-
return this.startClipPathAnimation(t,
|
|
2356
|
+
return this.startClipPathAnimation(t, g, !1), {
|
|
2161
2357
|
element: t,
|
|
2162
2358
|
originalState: i,
|
|
2163
|
-
animationHandle:
|
|
2359
|
+
animationHandle: g,
|
|
2164
2360
|
direction: "out",
|
|
2165
2361
|
originalWidth: u,
|
|
2166
2362
|
originalHeight: h
|
|
@@ -2236,7 +2432,11 @@ class $e {
|
|
|
2236
2432
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2237
2433
|
]), this.focusGeneration !== o)
|
|
2238
2434
|
return;
|
|
2239
|
-
|
|
2435
|
+
if (this.outgoing) {
|
|
2436
|
+
const a = this.outgoing.element;
|
|
2437
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2438
|
+
}
|
|
2439
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2240
2440
|
break;
|
|
2241
2441
|
case S.FOCUSING:
|
|
2242
2442
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2253,7 +2453,11 @@ class $e {
|
|
|
2253
2453
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2254
2454
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2255
2455
|
]), this.focusGeneration !== o) return;
|
|
2256
|
-
|
|
2456
|
+
if (this.outgoing) {
|
|
2457
|
+
const a = this.outgoing.element;
|
|
2458
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2459
|
+
}
|
|
2460
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2257
2461
|
break;
|
|
2258
2462
|
case S.CROSS_ANIMATING:
|
|
2259
2463
|
if (this.incoming?.element === t)
|
|
@@ -2274,7 +2478,11 @@ class $e {
|
|
|
2274
2478
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2275
2479
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2276
2480
|
]), this.focusGeneration !== o) return;
|
|
2277
|
-
|
|
2481
|
+
if (this.outgoing) {
|
|
2482
|
+
const s = this.outgoing.element;
|
|
2483
|
+
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2484
|
+
}
|
|
2485
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2278
2486
|
return;
|
|
2279
2487
|
}
|
|
2280
2488
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2296,7 +2504,11 @@ class $e {
|
|
|
2296
2504
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2297
2505
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2298
2506
|
]), this.focusGeneration !== o) return;
|
|
2299
|
-
|
|
2507
|
+
if (this.outgoing) {
|
|
2508
|
+
const a = this.outgoing.element;
|
|
2509
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2510
|
+
}
|
|
2511
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2300
2512
|
break;
|
|
2301
2513
|
}
|
|
2302
2514
|
}
|
|
@@ -2316,7 +2528,8 @@ class $e {
|
|
|
2316
2528
|
a,
|
|
2317
2529
|
r
|
|
2318
2530
|
), this.incoming = null, this.state = S.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2319
|
-
|
|
2531
|
+
const s = this.outgoing.element;
|
|
2532
|
+
this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(s);
|
|
2320
2533
|
}
|
|
2321
2534
|
return;
|
|
2322
2535
|
}
|
|
@@ -2333,12 +2546,15 @@ class $e {
|
|
|
2333
2546
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2334
2547
|
this.waitForAnimation(s.animationHandle)
|
|
2335
2548
|
]), this.focusGeneration !== t) return;
|
|
2336
|
-
|
|
2549
|
+
let c = null;
|
|
2550
|
+
this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2551
|
+
const l = s.element;
|
|
2552
|
+
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
2553
|
return;
|
|
2338
2554
|
}
|
|
2339
2555
|
this.state = S.UNFOCUSING;
|
|
2340
2556
|
const i = this.currentFocus, e = this.focusData.originalState, o = this.focusData.originalZIndex;
|
|
2341
|
-
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, o), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE);
|
|
2557
|
+
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, o), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(i));
|
|
2342
2558
|
}
|
|
2343
2559
|
/**
|
|
2344
2560
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2420,7 +2636,7 @@ class $e {
|
|
|
2420
2636
|
), this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2421
2637
|
}
|
|
2422
2638
|
}
|
|
2423
|
-
const
|
|
2639
|
+
const je = 50, We = 0.5, Ge = 20, qe = 0.3, Be = 150, Xe = 30, at = class at {
|
|
2424
2640
|
constructor(t, i) {
|
|
2425
2641
|
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
2642
|
}
|
|
@@ -2467,11 +2683,11 @@ const Pe = 50, _e = 0.5, Ue = 20, He = 0.3, Ne = 150, je = 30, at = class at {
|
|
|
2467
2683
|
const i = t.touches[0], e = i.clientX - this.touchState.startX, o = i.clientY - this.touchState.startY;
|
|
2468
2684
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + o * o) > 10) {
|
|
2469
2685
|
const s = Math.atan2(Math.abs(o), Math.abs(e)) * (180 / Math.PI);
|
|
2470
|
-
this.touchState.isHorizontalSwipe = s <=
|
|
2686
|
+
this.touchState.isHorizontalSwipe = s <= Xe;
|
|
2471
2687
|
}
|
|
2472
2688
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2473
2689
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
|
|
2474
|
-
const a = e *
|
|
2690
|
+
const a = e * qe;
|
|
2475
2691
|
this.callbacks.onDragOffset(a);
|
|
2476
2692
|
}
|
|
2477
2693
|
}
|
|
@@ -2480,7 +2696,7 @@ const Pe = 50, _e = 0.5, Ue = 20, He = 0.3, Ne = 150, je = 30, at = class at {
|
|
|
2480
2696
|
this.recentTouchTimestamp = Date.now();
|
|
2481
2697
|
const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, o = Math.abs(i) / e, a = Math.abs(i);
|
|
2482
2698
|
let r = !1;
|
|
2483
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >=
|
|
2699
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= je || o >= We && a >= Ge) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2484
2700
|
}
|
|
2485
2701
|
handleTouchCancel(t) {
|
|
2486
2702
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
@@ -2488,7 +2704,7 @@ const Pe = 50, _e = 0.5, Ue = 20, He = 0.3, Ne = 150, je = 30, at = class at {
|
|
|
2488
2704
|
};
|
|
2489
2705
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2490
2706
|
let bt = at;
|
|
2491
|
-
class
|
|
2707
|
+
class Ye {
|
|
2492
2708
|
constructor(t) {
|
|
2493
2709
|
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
2710
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2709,7 +2925,7 @@ class ke {
|
|
|
2709
2925
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2710
2926
|
}
|
|
2711
2927
|
}
|
|
2712
|
-
class
|
|
2928
|
+
class Je {
|
|
2713
2929
|
constructor(t) {
|
|
2714
2930
|
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
2931
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2889,7 +3105,7 @@ class We {
|
|
|
2889
3105
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2890
3106
|
}
|
|
2891
3107
|
}
|
|
2892
|
-
class
|
|
3108
|
+
class Ve {
|
|
2893
3109
|
constructor(t) {
|
|
2894
3110
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
2895
3111
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -2946,7 +3162,7 @@ class Ge {
|
|
|
2946
3162
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2947
3163
|
}
|
|
2948
3164
|
}
|
|
2949
|
-
class
|
|
3165
|
+
class Ke {
|
|
2950
3166
|
/**
|
|
2951
3167
|
* Create a new ImageFilter
|
|
2952
3168
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2983,7 +3199,7 @@ class qe {
|
|
|
2983
3199
|
// isAllowedDate(date: Date): boolean
|
|
2984
3200
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2985
3201
|
}
|
|
2986
|
-
const
|
|
3202
|
+
const Ze = `
|
|
2987
3203
|
.fbn-ic-gallery {
|
|
2988
3204
|
position: relative;
|
|
2989
3205
|
width: 100%;
|
|
@@ -3033,31 +3249,38 @@ const Xe = `
|
|
|
3033
3249
|
display: none !important;
|
|
3034
3250
|
}
|
|
3035
3251
|
`;
|
|
3036
|
-
function
|
|
3252
|
+
function Qe() {
|
|
3037
3253
|
if (typeof document > "u") return;
|
|
3038
3254
|
const n = "fbn-ic-functional-styles";
|
|
3039
3255
|
if (document.getElementById(n)) return;
|
|
3040
3256
|
const t = document.createElement("style");
|
|
3041
|
-
t.id = n, t.textContent =
|
|
3257
|
+
t.id = n, t.textContent = Ze, document.head.appendChild(t);
|
|
3042
3258
|
}
|
|
3043
|
-
class
|
|
3259
|
+
class ti {
|
|
3044
3260
|
constructor(t = {}) {
|
|
3045
|
-
this.fullConfig =
|
|
3261
|
+
this.fullConfig = Qt(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 ne(this.fullConfig.animation), this.layoutEngine = new Oe({
|
|
3046
3262
|
layout: this.fullConfig.layout,
|
|
3047
3263
|
image: this.fullConfig.image
|
|
3048
|
-
}), this.zoomEngine = new
|
|
3264
|
+
}), this.zoomEngine = new Ne(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = et(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3049
3265
|
const i = this.fullConfig.animation.entry || E.animation.entry;
|
|
3050
|
-
this.entryAnimationEngine = new
|
|
3266
|
+
this.entryAnimationEngine = new ge(
|
|
3051
3267
|
i,
|
|
3052
3268
|
this.fullConfig.layout.algorithm
|
|
3053
|
-
)
|
|
3269
|
+
);
|
|
3270
|
+
const e = this.fullConfig.animation.idle;
|
|
3271
|
+
e && e.type !== "none" ? this.idleAnimationEngine = new me(
|
|
3272
|
+
e,
|
|
3273
|
+
i.timing?.duration ?? 600
|
|
3274
|
+
) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((o) => {
|
|
3275
|
+
this.idleAnimationEngine?.resumeForImage(o);
|
|
3276
|
+
}), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
3054
3277
|
}
|
|
3055
3278
|
/**
|
|
3056
3279
|
* Create image filter based on shared loader config
|
|
3057
3280
|
*/
|
|
3058
3281
|
createImageFilter() {
|
|
3059
3282
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
3060
|
-
return new
|
|
3283
|
+
return new Ke(t);
|
|
3061
3284
|
}
|
|
3062
3285
|
/**
|
|
3063
3286
|
* Create appropriate image loader based on config
|
|
@@ -3068,7 +3291,7 @@ class Be {
|
|
|
3068
3291
|
if (!t || t.length === 0)
|
|
3069
3292
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
3070
3293
|
const e = t.map((o) => this.createLoaderFromEntry(o, i));
|
|
3071
|
-
return e.length === 1 ? e[0] : new
|
|
3294
|
+
return e.length === 1 ? e[0] : new Ve({
|
|
3072
3295
|
loaders: e,
|
|
3073
3296
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
3074
3297
|
});
|
|
@@ -3086,14 +3309,14 @@ class Be {
|
|
|
3086
3309
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3087
3310
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3088
3311
|
};
|
|
3089
|
-
return new
|
|
3312
|
+
return new Je(o);
|
|
3090
3313
|
} else if ("googleDrive" in t) {
|
|
3091
3314
|
const e = t.googleDrive, o = {
|
|
3092
3315
|
...e,
|
|
3093
3316
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3094
3317
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3095
3318
|
};
|
|
3096
|
-
return new
|
|
3319
|
+
return new Ye(o);
|
|
3097
3320
|
} else
|
|
3098
3321
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
3099
3322
|
}
|
|
@@ -3102,7 +3325,7 @@ class Be {
|
|
|
3102
3325
|
*/
|
|
3103
3326
|
async init() {
|
|
3104
3327
|
try {
|
|
3105
|
-
if (
|
|
3328
|
+
if (Qe(), this.containerRef)
|
|
3106
3329
|
this.containerEl = this.containerRef;
|
|
3107
3330
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
3108
3331
|
throw new Error(`Container #${this.containerId} not found`);
|
|
@@ -3111,7 +3334,7 @@ class Be {
|
|
|
3111
3334
|
onPrev: () => this.navigateToPreviousImage(),
|
|
3112
3335
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
3113
3336
|
onDragEnd: (t) => {
|
|
3114
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
3337
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Be);
|
|
3115
3338
|
}
|
|
3116
3339
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3117
3340
|
} catch (t) {
|
|
@@ -3238,19 +3461,19 @@ class Be {
|
|
|
3238
3461
|
const d = {
|
|
3239
3462
|
x: parseFloat(l.dataset.startX),
|
|
3240
3463
|
y: parseFloat(l.dataset.startY)
|
|
3241
|
-
},
|
|
3464
|
+
}, g = {
|
|
3242
3465
|
x: parseFloat(l.dataset.endX),
|
|
3243
3466
|
y: parseFloat(l.dataset.endY)
|
|
3244
|
-
}, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight),
|
|
3245
|
-
|
|
3467
|
+
}, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), f = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : f, w = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
|
|
3468
|
+
de({
|
|
3246
3469
|
element: l,
|
|
3247
3470
|
startPosition: d,
|
|
3248
|
-
endPosition:
|
|
3471
|
+
endPosition: g,
|
|
3249
3472
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3250
3473
|
duration: v.duration,
|
|
3251
3474
|
imageWidth: b,
|
|
3252
3475
|
imageHeight: p,
|
|
3253
|
-
rotation:
|
|
3476
|
+
rotation: f,
|
|
3254
3477
|
scale: m,
|
|
3255
3478
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3256
3479
|
startRotation: y,
|
|
@@ -3275,6 +3498,10 @@ class Be {
|
|
|
3275
3498
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3276
3499
|
});
|
|
3277
3500
|
}
|
|
3501
|
+
if (this.idleAnimationEngine) {
|
|
3502
|
+
const d = this.entryAnimationEngine.getTiming().duration;
|
|
3503
|
+
this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
|
|
3504
|
+
}
|
|
3278
3505
|
}), r++);
|
|
3279
3506
|
}, c = () => {
|
|
3280
3507
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
@@ -3308,32 +3535,32 @@ class Be {
|
|
|
3308
3535
|
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), a.forEach((l, u) => {
|
|
3309
3536
|
const h = document.createElement("div");
|
|
3310
3537
|
h.className = "fbn-ic-debug-center", h.style.position = "absolute", h.style.width = "12px", h.style.height = "12px", h.style.borderRadius = "50%", h.style.backgroundColor = "red", h.style.border = "2px solid yellow", h.style.zIndex = "9999", h.style.pointerEvents = "none";
|
|
3311
|
-
const d = l.x,
|
|
3312
|
-
h.style.left = `${d - 6}px`, h.style.top = `${
|
|
3538
|
+
const d = l.x, g = l.y;
|
|
3539
|
+
h.style.left = `${d - 6}px`, h.style.top = `${g - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(g)})`, this.containerEl.appendChild(h);
|
|
3313
3540
|
})), t.forEach((l, u) => {
|
|
3314
3541
|
const h = document.createElement("img");
|
|
3315
3542
|
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
|
|
3316
3543
|
const d = a[u];
|
|
3317
3544
|
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
3545
|
if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
|
|
3319
|
-
const
|
|
3320
|
-
|
|
3546
|
+
const g = h.cachedRenderedWidth;
|
|
3547
|
+
gt(h, this.fullConfig.styling?.hover, i, g), st(h, this.hoverClassName);
|
|
3321
3548
|
}
|
|
3322
3549
|
}), h.addEventListener("mouseleave", () => {
|
|
3323
3550
|
if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
|
|
3324
|
-
const
|
|
3325
|
-
|
|
3551
|
+
const g = h.cachedRenderedWidth;
|
|
3552
|
+
gt(h, this.fullConfig.styling?.default, i, g), pt(h, this.hoverClassName), st(h, this.defaultClassName);
|
|
3326
3553
|
}
|
|
3327
|
-
}), h.addEventListener("click", (
|
|
3328
|
-
|
|
3554
|
+
}), h.addEventListener("click", (g) => {
|
|
3555
|
+
g.stopPropagation(), this.handleImageClick(h, d);
|
|
3329
3556
|
}), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
|
|
3330
3557
|
if (o !== this.loadGeneration)
|
|
3331
3558
|
return;
|
|
3332
|
-
const
|
|
3333
|
-
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${b}`), h.style.width = `${b}px`, h.cachedRenderedWidth = b, h.aspectRatio =
|
|
3334
|
-
const p = { x: d.x, y: d.y },
|
|
3559
|
+
const g = h.naturalWidth / h.naturalHeight, b = i * g;
|
|
3560
|
+
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${b}`), h.style.width = `${b}px`, h.cachedRenderedWidth = b, h.aspectRatio = g, gt(h, this.fullConfig.styling?.default, i, b);
|
|
3561
|
+
const p = { x: d.x, y: d.y }, f = { width: b, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
|
|
3335
3562
|
p,
|
|
3336
|
-
|
|
3563
|
+
f,
|
|
3337
3564
|
e,
|
|
3338
3565
|
u,
|
|
3339
3566
|
t.length
|
|
@@ -3354,7 +3581,7 @@ class Be {
|
|
|
3354
3581
|
);
|
|
3355
3582
|
this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
|
|
3356
3583
|
finalPosition: p,
|
|
3357
|
-
imageSize:
|
|
3584
|
+
imageSize: f,
|
|
3358
3585
|
left: d.x,
|
|
3359
3586
|
top: d.y,
|
|
3360
3587
|
finalTransform: v,
|
|
@@ -3373,6 +3600,7 @@ class Be {
|
|
|
3373
3600
|
if (e)
|
|
3374
3601
|
await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter();
|
|
3375
3602
|
else {
|
|
3603
|
+
this.idleAnimationEngine?.pauseForImage(t);
|
|
3376
3604
|
const a = t.dataset.imageId;
|
|
3377
3605
|
this.currentFocusIndex = a !== void 0 ? parseInt(a, 10) : null, this.swipeEngine?.enable(), await this.zoomEngine.focusImage(t, o, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex);
|
|
3378
3606
|
}
|
|
@@ -3381,7 +3609,7 @@ class Be {
|
|
|
3381
3609
|
* Clear the image cloud and reset state
|
|
3382
3610
|
*/
|
|
3383
3611
|
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;
|
|
3612
|
+
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
3613
|
}
|
|
3386
3614
|
showLoading(t) {
|
|
3387
3615
|
!this.fullConfig.rendering.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
|
|
@@ -3402,18 +3630,18 @@ class Be {
|
|
|
3402
3630
|
* Destroy the gallery and clean up resources
|
|
3403
3631
|
*/
|
|
3404
3632
|
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();
|
|
3633
|
+
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
3634
|
}
|
|
3407
3635
|
}
|
|
3408
|
-
function
|
|
3636
|
+
function ei() {
|
|
3409
3637
|
if (typeof document > "u") return;
|
|
3410
3638
|
const n = "fbn-ic-styles";
|
|
3411
3639
|
if (document.getElementById(n)) return;
|
|
3412
3640
|
const t = document.createElement("style");
|
|
3413
|
-
t.id = n, t.textContent =
|
|
3641
|
+
t.id = n, t.textContent = Ut, document.head.appendChild(t);
|
|
3414
3642
|
}
|
|
3415
|
-
|
|
3416
|
-
function
|
|
3643
|
+
ei();
|
|
3644
|
+
function ii() {
|
|
3417
3645
|
if (typeof document > "u") {
|
|
3418
3646
|
console.warn("ImageCloud: Document not available (not in browser environment)");
|
|
3419
3647
|
return;
|
|
@@ -3443,17 +3671,17 @@ function Ve() {
|
|
|
3443
3671
|
console.error(`ImageCloud: Missing configuration for #${e.id}. Add data-config='{...}' attribute.`);
|
|
3444
3672
|
return;
|
|
3445
3673
|
}
|
|
3446
|
-
new
|
|
3674
|
+
new ti(a).init().catch((s) => {
|
|
3447
3675
|
console.error("ImageCloud initialization failed:", s);
|
|
3448
3676
|
});
|
|
3449
3677
|
});
|
|
3450
3678
|
};
|
|
3451
3679
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", n) : n();
|
|
3452
3680
|
}
|
|
3453
|
-
|
|
3681
|
+
ii();
|
|
3454
3682
|
export {
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3683
|
+
ti as ImageCloud,
|
|
3684
|
+
ti as ImageGallery,
|
|
3685
|
+
ii as autoInitialize
|
|
3458
3686
|
};
|
|
3459
3687
|
//# sourceMappingURL=image-cloud-auto-init.js.map
|