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