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