@frybynite/image-cloud 0.10.3 → 0.11.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 +689 -526
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +1013 -850
- 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 +114 -2
- package/dist/react.d.ts +114 -2
- package/dist/react.js +698 -535
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +114 -2
- package/dist/vue.js +1012 -849
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +114 -2
- package/dist/web-component.js +690 -527
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
4
4
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
5
5
|
lg: "0 8px 32px rgba(0,0,0,0.5)",
|
|
6
6
|
glow: "0 0 30px rgba(255,255,255,0.6)"
|
|
7
|
-
}),
|
|
7
|
+
}), St = Object.freeze({
|
|
8
8
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
9
9
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
10
10
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
@@ -13,7 +13,7 @@ const Ut = ".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
|
+
}), Rt = 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 }),
|
|
@@ -24,7 +24,7 @@ const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
24
24
|
mode: "none"
|
|
25
25
|
}), xt = Object.freeze({
|
|
26
26
|
mode: "none"
|
|
27
|
-
}),
|
|
27
|
+
}), Ft = Object.freeze({
|
|
28
28
|
default: Object.freeze({
|
|
29
29
|
border: Object.freeze({
|
|
30
30
|
width: 0,
|
|
@@ -50,16 +50,16 @@ const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
50
50
|
focused: Object.freeze({
|
|
51
51
|
shadow: "none"
|
|
52
52
|
})
|
|
53
|
-
}),
|
|
53
|
+
}), kt = Object.freeze({
|
|
54
54
|
tightness: 1
|
|
55
|
-
}),
|
|
55
|
+
}), Ht = Object.freeze({
|
|
56
56
|
rows: 1,
|
|
57
57
|
amplitude: 100,
|
|
58
58
|
frequency: 2,
|
|
59
59
|
phaseShift: 0,
|
|
60
60
|
synchronization: "offset"
|
|
61
61
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
62
|
-
}),
|
|
62
|
+
}), Nt = Object.freeze({
|
|
63
63
|
spacing: 0
|
|
64
64
|
}), Bt = Object.freeze({
|
|
65
65
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
@@ -82,7 +82,7 @@ const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
82
82
|
min: -15,
|
|
83
83
|
max: 15
|
|
84
84
|
})
|
|
85
|
-
}),
|
|
85
|
+
}), Mt = Object.freeze({
|
|
86
86
|
sizing: jt,
|
|
87
87
|
rotation: Wt
|
|
88
88
|
}), zt = Object.freeze({
|
|
@@ -94,7 +94,7 @@ const Ut = ".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
|
-
}), Gt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), qt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }),
|
|
97
|
+
}), Gt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), qt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Yt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Xt = Object.freeze({ speed: 4e3, direction: "clockwise" }), Dt = Object.freeze({ type: "none" }), L = Object.freeze({
|
|
98
98
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
99
99
|
loaders: [],
|
|
100
100
|
// Shared loader settings and debug config
|
|
@@ -103,7 +103,7 @@ const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
103
103
|
debug: Ot
|
|
104
104
|
}),
|
|
105
105
|
// Image sizing and rotation configuration
|
|
106
|
-
image:
|
|
106
|
+
image: Mt,
|
|
107
107
|
// Pattern-based layout configuration
|
|
108
108
|
layout: Object.freeze({
|
|
109
109
|
algorithm: "radial",
|
|
@@ -184,7 +184,7 @@ const Ut = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
184
184
|
showFocusOutline: !1
|
|
185
185
|
}),
|
|
186
186
|
// Image styling
|
|
187
|
-
styling:
|
|
187
|
+
styling: Ft
|
|
188
188
|
});
|
|
189
189
|
function Z(o, t) {
|
|
190
190
|
if (!o) return t || {};
|
|
@@ -192,7 +192,7 @@ function Z(o, t) {
|
|
|
192
192
|
const i = { ...o };
|
|
193
193
|
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;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Vt(o, t) {
|
|
196
196
|
if (!t) return { ...o };
|
|
197
197
|
const i = Z(o.default, t.default), e = Z(
|
|
198
198
|
Z(i, o.hover),
|
|
@@ -207,7 +207,7 @@ function Jt(o, t) {
|
|
|
207
207
|
focused: n
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function Jt(o, t) {
|
|
211
211
|
if (!t) return { ...o };
|
|
212
212
|
const i = { ...o };
|
|
213
213
|
if (t.sizing !== void 0 && (i.sizing = {
|
|
@@ -241,58 +241,58 @@ function Kt(o = {}) {
|
|
|
241
241
|
}, s = {
|
|
242
242
|
loaders: i,
|
|
243
243
|
config: n,
|
|
244
|
-
image:
|
|
245
|
-
layout: { ...
|
|
246
|
-
animation: { ...
|
|
247
|
-
interaction: { ...
|
|
248
|
-
ui: { ...
|
|
249
|
-
styling:
|
|
244
|
+
image: Jt(Mt, t),
|
|
245
|
+
layout: { ...L.layout },
|
|
246
|
+
animation: { ...L.animation },
|
|
247
|
+
interaction: { ...L.interaction },
|
|
248
|
+
ui: { ...L.ui },
|
|
249
|
+
styling: Vt(Ft, o.styling)
|
|
250
250
|
};
|
|
251
251
|
if (o.layout && (s.layout = {
|
|
252
|
-
...
|
|
252
|
+
...L.layout,
|
|
253
253
|
...o.layout
|
|
254
254
|
}, o.layout.responsive && (s.layout.responsive = {
|
|
255
|
-
...
|
|
256
|
-
mobile: o.layout.responsive.mobile ? { ...
|
|
257
|
-
tablet: o.layout.responsive.tablet ? { ...
|
|
255
|
+
...L.layout.responsive,
|
|
256
|
+
mobile: o.layout.responsive.mobile ? { ...L.layout.responsive.mobile, ...o.layout.responsive.mobile } : L.layout.responsive.mobile,
|
|
257
|
+
tablet: o.layout.responsive.tablet ? { ...L.layout.responsive.tablet, ...o.layout.responsive.tablet } : L.layout.responsive.tablet
|
|
258
258
|
}), o.layout.spacing && (s.layout.spacing = {
|
|
259
|
-
...
|
|
259
|
+
...L.layout.spacing,
|
|
260
260
|
...o.layout.spacing
|
|
261
261
|
})), o.animation && (s.animation = {
|
|
262
|
-
...
|
|
262
|
+
...L.animation,
|
|
263
263
|
...o.animation
|
|
264
264
|
}, o.animation.easing && (s.animation.easing = {
|
|
265
|
-
...
|
|
265
|
+
...L.animation.easing,
|
|
266
266
|
...o.animation.easing
|
|
267
267
|
}), o.animation.queue && (s.animation.queue = {
|
|
268
|
-
...
|
|
268
|
+
...L.animation.queue,
|
|
269
269
|
...o.animation.queue
|
|
270
270
|
}), o.animation.entry && (s.animation.entry = {
|
|
271
|
-
...
|
|
271
|
+
...L.animation.entry,
|
|
272
272
|
...o.animation.entry,
|
|
273
273
|
start: o.animation.entry.start ? {
|
|
274
|
-
...
|
|
274
|
+
...L.animation.entry.start,
|
|
275
275
|
...o.animation.entry.start,
|
|
276
|
-
circular: o.animation.entry.start.circular ? { ...
|
|
277
|
-
} :
|
|
278
|
-
timing: o.animation.entry.timing ? { ...
|
|
279
|
-
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } :
|
|
280
|
-
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } :
|
|
281
|
-
scale: o.animation.entry.scale ? { ...xt, ...o.animation.entry.scale } :
|
|
276
|
+
circular: o.animation.entry.start.circular ? { ...L.animation.entry.start.circular, ...o.animation.entry.start.circular } : L.animation.entry.start.circular
|
|
277
|
+
} : L.animation.entry.start,
|
|
278
|
+
timing: o.animation.entry.timing ? { ...L.animation.entry.timing, ...o.animation.entry.timing } : L.animation.entry.timing,
|
|
279
|
+
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : L.animation.entry.path,
|
|
280
|
+
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : L.animation.entry.rotation,
|
|
281
|
+
scale: o.animation.entry.scale ? { ...xt, ...o.animation.entry.scale } : L.animation.entry.scale
|
|
282
282
|
}), o.animation.idle && (s.animation.idle = {
|
|
283
283
|
...Dt,
|
|
284
284
|
...o.animation.idle
|
|
285
285
|
})), o.interaction && (s.interaction = {
|
|
286
|
-
...
|
|
286
|
+
...L.interaction,
|
|
287
287
|
...o.interaction
|
|
288
288
|
}, o.interaction.focus && (s.interaction.focus = {
|
|
289
|
-
...
|
|
289
|
+
...L.interaction.focus,
|
|
290
290
|
...o.interaction.focus
|
|
291
291
|
}), o.interaction.navigation && (s.interaction.navigation = {
|
|
292
|
-
...
|
|
292
|
+
...L.interaction.navigation,
|
|
293
293
|
...o.interaction.navigation
|
|
294
294
|
})), s.ui = {
|
|
295
|
-
...
|
|
295
|
+
...L.ui,
|
|
296
296
|
...o.ui
|
|
297
297
|
}, s.config.debug = {
|
|
298
298
|
...Ot,
|
|
@@ -309,13 +309,13 @@ function Kt(o = {}) {
|
|
|
309
309
|
return s;
|
|
310
310
|
}
|
|
311
311
|
function Zt(o, t) {
|
|
312
|
-
return { ...o ?
|
|
312
|
+
return { ...o ? St[o] : St.playful, ...t };
|
|
313
313
|
}
|
|
314
314
|
function Qt(o, t) {
|
|
315
315
|
return { ...o ? Ct[o] : Ct.gentle, ...t };
|
|
316
316
|
}
|
|
317
317
|
function te(o, t) {
|
|
318
|
-
return { ...o ?
|
|
318
|
+
return { ...o ? Rt[o] : Rt.gentle, ...t };
|
|
319
319
|
}
|
|
320
320
|
class ee {
|
|
321
321
|
constructor(t) {
|
|
@@ -344,12 +344,12 @@ class ee {
|
|
|
344
344
|
*/
|
|
345
345
|
animateTransformCancellable(t, i, e, n = null, s = null) {
|
|
346
346
|
this.cancelAllAnimations(t);
|
|
347
|
-
const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i),
|
|
347
|
+
const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), d = this.buildTransformString(e);
|
|
348
348
|
t.style.transition = "none";
|
|
349
349
|
const u = t.animate(
|
|
350
350
|
[
|
|
351
351
|
{ transform: c },
|
|
352
|
-
{ transform:
|
|
352
|
+
{ transform: d }
|
|
353
353
|
],
|
|
354
354
|
{
|
|
355
355
|
duration: r,
|
|
@@ -357,7 +357,7 @@ class ee {
|
|
|
357
357
|
fill: "forwards"
|
|
358
358
|
// Keep final state after animation
|
|
359
359
|
}
|
|
360
|
-
),
|
|
360
|
+
), f = {
|
|
361
361
|
id: `anim-${++this.animationIdCounter}`,
|
|
362
362
|
element: t,
|
|
363
363
|
animation: u,
|
|
@@ -366,11 +366,11 @@ class ee {
|
|
|
366
366
|
startTime: performance.now(),
|
|
367
367
|
duration: r
|
|
368
368
|
};
|
|
369
|
-
return this.activeAnimations.set(t,
|
|
370
|
-
t.style.transform =
|
|
369
|
+
return this.activeAnimations.set(t, f), u.finished.then(() => {
|
|
370
|
+
t.style.transform = d, this.activeAnimations.delete(t);
|
|
371
371
|
}).catch(() => {
|
|
372
372
|
this.activeAnimations.delete(t);
|
|
373
|
-
}),
|
|
373
|
+
}), f;
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Cancel an active animation
|
|
@@ -473,27 +473,27 @@ class ee {
|
|
|
473
473
|
return new Promise((i) => setTimeout(i, t));
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function J(o, t, i) {
|
|
477
477
|
return o + (t - o) * i;
|
|
478
478
|
}
|
|
479
479
|
function ie(o, t, i, e) {
|
|
480
|
-
const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y,
|
|
481
|
-
let u = 0,
|
|
482
|
-
for (let
|
|
483
|
-
if (o <= l
|
|
484
|
-
|
|
480
|
+
const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, d = ne(s, r);
|
|
481
|
+
let u = 0, f = 0, m = 1, p = n, E = !1;
|
|
482
|
+
for (let l = 0; l < d.length; l++)
|
|
483
|
+
if (o <= d[l].time) {
|
|
484
|
+
f = l === 0 ? 0 : d[l - 1].time, m = d[l].time, p = d[l].overshoot, E = d[l].isOvershoot;
|
|
485
485
|
break;
|
|
486
486
|
}
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
489
|
-
u = 1 +
|
|
490
|
-
else if (
|
|
491
|
-
u = at(
|
|
487
|
+
const v = (o - f) / (m - f);
|
|
488
|
+
if (E)
|
|
489
|
+
u = 1 + p * at(v);
|
|
490
|
+
else if (f === 0)
|
|
491
|
+
u = at(v);
|
|
492
492
|
else {
|
|
493
|
-
const
|
|
494
|
-
(
|
|
495
|
-
)?.overshoot ||
|
|
496
|
-
u =
|
|
493
|
+
const g = 1 + (d.find(
|
|
494
|
+
(h, b) => h.time > f && b > 0 && d[b - 1].isOvershoot
|
|
495
|
+
)?.overshoot || p);
|
|
496
|
+
u = J(g, 1, at(v));
|
|
497
497
|
}
|
|
498
498
|
return {
|
|
499
499
|
x: t.x + a * u,
|
|
@@ -511,23 +511,23 @@ function ne(o, t) {
|
|
|
511
511
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
512
512
|
}
|
|
513
513
|
function oe(o, t, i, e) {
|
|
514
|
-
const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x,
|
|
515
|
-
let
|
|
516
|
-
if (
|
|
517
|
-
const
|
|
518
|
-
|
|
514
|
+
const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, d = i.y - t.y, u = Math.sqrt(n / r), f = s / (2 * Math.sqrt(n * r));
|
|
515
|
+
let m;
|
|
516
|
+
if (f < 1) {
|
|
517
|
+
const p = u * Math.sqrt(1 - f * f), E = Math.exp(-f * u * o * 3), v = Math.cos(p * o * a * Math.PI);
|
|
518
|
+
m = 1 - E * v;
|
|
519
519
|
} else
|
|
520
|
-
|
|
521
|
-
return
|
|
522
|
-
x: t.x + c *
|
|
523
|
-
y: t.y +
|
|
520
|
+
m = 1 - Math.exp(-u * o * 3);
|
|
521
|
+
return m = Math.max(0, Math.min(m, 1.3)), {
|
|
522
|
+
x: t.x + c * m,
|
|
523
|
+
y: t.y + d * m
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
526
|
function se(o, t, i, e) {
|
|
527
|
-
const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e,
|
|
527
|
+
const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, d = i.x - t.x, u = i.y - t.y, f = Math.sqrt(d * d + u * u), m = f > 0 ? -u / f : 0, p = f > 0 ? d / f : 1, E = s * Math.PI * 2 * o + c, v = r ? Math.pow(1 - o, a) : 1, l = n * Math.sin(E) * v, g = ae(o);
|
|
528
528
|
return {
|
|
529
|
-
x:
|
|
530
|
-
y:
|
|
529
|
+
x: J(t.x, i.x, g) + l * m,
|
|
530
|
+
y: J(t.y, i.y, g) + l * p
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
533
|
function at(o) {
|
|
@@ -544,21 +544,21 @@ function ce(o, t, i) {
|
|
|
544
544
|
const { overshoot: e, bounces: n } = i, s = [];
|
|
545
545
|
s.push({ time: 0.5, scale: e });
|
|
546
546
|
let r = e;
|
|
547
|
-
const a = 0.5,
|
|
547
|
+
const a = 0.5, d = 0.5 / (n * 2);
|
|
548
548
|
let u = 0.5;
|
|
549
|
-
for (let
|
|
550
|
-
const
|
|
551
|
-
u +=
|
|
549
|
+
for (let m = 0; m < n; m++) {
|
|
550
|
+
const p = 1 - (r - 1) * a;
|
|
551
|
+
u += d, s.push({ time: u, scale: p }), r = 1 + (r - 1) * a * a, u += d, m < n - 1 && s.push({ time: u, scale: r });
|
|
552
552
|
}
|
|
553
553
|
s.push({ time: 1, scale: 1 });
|
|
554
|
-
let
|
|
555
|
-
for (let
|
|
556
|
-
if (o <= s[
|
|
557
|
-
const
|
|
558
|
-
|
|
554
|
+
let f = 1;
|
|
555
|
+
for (let m = 0; m < s.length; m++)
|
|
556
|
+
if (o <= s[m].time) {
|
|
557
|
+
const p = m === 0 ? 0 : s[m - 1].time, E = m === 0 ? 1 : s[m - 1].scale, v = (o - p) / (s[m].time - p), l = at(v);
|
|
558
|
+
f = E + (s[m].scale - E) * l;
|
|
559
559
|
break;
|
|
560
560
|
}
|
|
561
|
-
return
|
|
561
|
+
return f * t;
|
|
562
562
|
}
|
|
563
563
|
function le(o) {
|
|
564
564
|
const {
|
|
@@ -570,57 +570,63 @@ function le(o) {
|
|
|
570
570
|
imageWidth: r,
|
|
571
571
|
imageHeight: a,
|
|
572
572
|
rotation: c,
|
|
573
|
-
scale:
|
|
573
|
+
scale: d,
|
|
574
574
|
onComplete: u,
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
575
|
+
onProgress: f,
|
|
576
|
+
rotationConfig: m,
|
|
577
|
+
startRotation: p,
|
|
578
|
+
scaleConfig: E,
|
|
579
|
+
startScale: v
|
|
580
|
+
} = o, l = n.type, g = p !== void 0 && p !== c, h = m?.mode === "wobble", b = m?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, I = g || h, y = v !== void 0 && v !== d, x = E?.mode === "pop", w = E?.pop || { overshoot: 1.2, bounces: 1 };
|
|
581
|
+
if (l === "linear" && !I && !(y || x)) {
|
|
581
582
|
u && u();
|
|
582
583
|
return;
|
|
583
584
|
}
|
|
584
|
-
const
|
|
585
|
-
function O(
|
|
586
|
-
const
|
|
587
|
-
let
|
|
588
|
-
switch (
|
|
585
|
+
const R = performance.now(), M = -r / 2, T = -a / 2;
|
|
586
|
+
function O(k) {
|
|
587
|
+
const D = k - R, z = Math.min(D / s, 1);
|
|
588
|
+
let S;
|
|
589
|
+
switch (l) {
|
|
589
590
|
case "bounce": {
|
|
590
|
-
const
|
|
591
|
+
const N = Zt(
|
|
591
592
|
n.bouncePreset,
|
|
592
593
|
n.bounce
|
|
593
594
|
);
|
|
594
|
-
|
|
595
|
+
S = ie(z, i, e, N);
|
|
595
596
|
break;
|
|
596
597
|
}
|
|
597
598
|
case "elastic": {
|
|
598
|
-
const
|
|
599
|
+
const N = Qt(
|
|
599
600
|
n.elasticPreset,
|
|
600
601
|
n.elastic
|
|
601
602
|
);
|
|
602
|
-
|
|
603
|
+
S = oe(z, i, e, N);
|
|
603
604
|
break;
|
|
604
605
|
}
|
|
605
606
|
case "wave": {
|
|
606
|
-
const
|
|
607
|
+
const N = te(
|
|
607
608
|
n.wavePreset,
|
|
608
609
|
n.wave
|
|
609
610
|
);
|
|
610
|
-
|
|
611
|
+
S = se(z, i, e, N);
|
|
611
612
|
break;
|
|
612
613
|
}
|
|
613
614
|
default:
|
|
614
|
-
|
|
615
|
-
x:
|
|
616
|
-
y:
|
|
615
|
+
S = {
|
|
616
|
+
x: J(i.x, e.x, z),
|
|
617
|
+
y: J(i.y, e.y, z)
|
|
617
618
|
};
|
|
618
619
|
}
|
|
619
|
-
const
|
|
620
|
-
let
|
|
621
|
-
|
|
622
|
-
let
|
|
623
|
-
|
|
620
|
+
const _ = S.x - e.x, $ = S.y - e.y;
|
|
621
|
+
let A;
|
|
622
|
+
h ? A = re(z, c, b) : g ? A = J(p, c, z) : A = c;
|
|
623
|
+
let j;
|
|
624
|
+
x ? j = ce(z, d, w) : y ? j = J(v, d, z) : j = d, t.style.transform = `translate(${M}px, ${T}px) translate(${_}px, ${$}px) rotate(${A}deg) scale(${j})`, f && z < 1 && f(z, D, {
|
|
625
|
+
x: S.x,
|
|
626
|
+
y: S.y,
|
|
627
|
+
rotation: A,
|
|
628
|
+
scale: j
|
|
629
|
+
}), z < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${M}px, ${T}px) rotate(${c}deg) scale(${d})`, u && u());
|
|
624
630
|
}
|
|
625
631
|
requestAnimationFrame(O);
|
|
626
632
|
}
|
|
@@ -682,9 +688,9 @@ class ue {
|
|
|
682
688
|
* Calculate start position from the nearest edge (current default behavior)
|
|
683
689
|
*/
|
|
684
690
|
calculateNearestEdge(t, i, e, n) {
|
|
685
|
-
const s = t.x, r = t.y, a = s, c = e.width - s,
|
|
686
|
-
let
|
|
687
|
-
return
|
|
691
|
+
const s = t.x, r = t.y, a = s, c = e.width - s, d = r, u = e.height - r, f = Math.min(a, c, d, u);
|
|
692
|
+
let m = t.x, p = t.y;
|
|
693
|
+
return f === a ? m = -(i.width + n) : f === c ? m = e.width + n : f === d ? p = -(i.height + n) : p = e.height + n, { x: m, y: p };
|
|
688
694
|
}
|
|
689
695
|
/**
|
|
690
696
|
* Calculate start position from a specific edge
|
|
@@ -732,18 +738,18 @@ class ue {
|
|
|
732
738
|
calculateCircularPosition(t, i, e, n, s) {
|
|
733
739
|
const r = this.config.start.circular || {}, a = r.distribution || "even";
|
|
734
740
|
let c;
|
|
735
|
-
const
|
|
736
|
-
if (typeof
|
|
737
|
-
const
|
|
741
|
+
const d = r.radius || "120%";
|
|
742
|
+
if (typeof d == "string" && d.endsWith("%")) {
|
|
743
|
+
const v = parseFloat(d) / 100;
|
|
738
744
|
c = Math.sqrt(
|
|
739
745
|
e.width ** 2 + e.height ** 2
|
|
740
|
-
) *
|
|
746
|
+
) * v / 2;
|
|
741
747
|
} else
|
|
742
|
-
c = typeof
|
|
748
|
+
c = typeof d == "number" ? d : 500;
|
|
743
749
|
let u;
|
|
744
750
|
a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
745
|
-
const
|
|
746
|
-
return { x:
|
|
751
|
+
const f = e.width / 2, m = e.height / 2, p = f + Math.cos(u) * c, E = m + Math.sin(u) * c;
|
|
752
|
+
return { x: p, y: E };
|
|
747
753
|
}
|
|
748
754
|
/**
|
|
749
755
|
* Get animation parameters for an image
|
|
@@ -763,8 +769,8 @@ class ue {
|
|
|
763
769
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
764
770
|
*/
|
|
765
771
|
buildStartTransform(t, i, e, n, s, r, a, c) {
|
|
766
|
-
const
|
|
767
|
-
return t.useScale ? `${
|
|
772
|
+
const d = t.x - i.x, u = t.y - i.y, f = a !== void 0 ? a : e, m = c !== void 0 ? c : n, p = s !== void 0 ? -s / 2 : 0, E = r !== void 0 ? -r / 2 : 0, v = s !== void 0 ? `translate(${p}px, ${E}px)` : "translate(-50%, -50%)";
|
|
773
|
+
return t.useScale ? `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(0)` : `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(${m})`;
|
|
768
774
|
}
|
|
769
775
|
/**
|
|
770
776
|
* Build the final CSS transform string
|
|
@@ -891,8 +897,8 @@ class ue {
|
|
|
891
897
|
amplitude: 15,
|
|
892
898
|
frequency: 3,
|
|
893
899
|
decay: !0
|
|
894
|
-
}, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1,
|
|
895
|
-
return i +
|
|
900
|
+
}, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, d = n * a * c;
|
|
901
|
+
return i + d;
|
|
896
902
|
}
|
|
897
903
|
/**
|
|
898
904
|
* Get the scale configuration
|
|
@@ -952,8 +958,8 @@ class ue {
|
|
|
952
958
|
let a = i;
|
|
953
959
|
for (let c = 0; c < r.length; c++)
|
|
954
960
|
if (t <= r[c].time) {
|
|
955
|
-
const
|
|
956
|
-
a = u + (r[c].scale - u) *
|
|
961
|
+
const d = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, f = (t - d) / (r[c].time - d), m = this.easeOutQuad(f);
|
|
962
|
+
a = u + (r[c].scale - u) * m;
|
|
957
963
|
break;
|
|
958
964
|
}
|
|
959
965
|
return a * i;
|
|
@@ -967,9 +973,9 @@ class ue {
|
|
|
967
973
|
let n = i;
|
|
968
974
|
const s = 0.5, a = 0.5 / (t * 2);
|
|
969
975
|
let c = 0.5;
|
|
970
|
-
for (let
|
|
976
|
+
for (let d = 0; d < t; d++) {
|
|
971
977
|
const u = 1 - (n - 1) * s;
|
|
972
|
-
c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a,
|
|
978
|
+
c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, d < t - 1 && e.push({ time: c, scale: n });
|
|
973
979
|
}
|
|
974
980
|
return e.push({ time: 1, scale: 1 }), e;
|
|
975
981
|
}
|
|
@@ -1105,7 +1111,7 @@ class fe {
|
|
|
1105
1111
|
});
|
|
1106
1112
|
}
|
|
1107
1113
|
_startBlink(t) {
|
|
1108
|
-
const i = { ...
|
|
1114
|
+
const i = { ...Yt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
|
|
1109
1115
|
let s, r;
|
|
1110
1116
|
i.style === "fade" ? (s = [
|
|
1111
1117
|
{ opacity: n, offset: 0 },
|
|
@@ -1129,7 +1135,7 @@ class fe {
|
|
|
1129
1135
|
}), t.blinkAnimation = t.element.animate(s, r);
|
|
1130
1136
|
}
|
|
1131
1137
|
_startSpin(t) {
|
|
1132
|
-
const i = { ...
|
|
1138
|
+
const i = { ...Xt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
|
|
1133
1139
|
t.animation = t.element.animate(
|
|
1134
1140
|
[{ transform: "rotate(0deg)" }, { transform: `rotate(${e}deg)` }],
|
|
1135
1141
|
{
|
|
@@ -1178,17 +1184,17 @@ class ge {
|
|
|
1178
1184
|
* @returns Array of layout objects with position, rotation, scale
|
|
1179
1185
|
*/
|
|
1180
1186
|
generate(t, i, e = {}) {
|
|
1181
|
-
const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200,
|
|
1182
|
-
for (let
|
|
1183
|
-
const
|
|
1184
|
-
id:
|
|
1185
|
-
x:
|
|
1186
|
-
y:
|
|
1187
|
-
rotation:
|
|
1188
|
-
scale:
|
|
1189
|
-
baseSize:
|
|
1187
|
+
const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, E = m !== 1 || p !== 1, l = c * 1.5 / 2, g = c / 2, h = s - a - l, b = r - a - g, I = a + l, y = a + g;
|
|
1188
|
+
for (let x = 0; x < t; x++) {
|
|
1189
|
+
const w = this.random(I, h), F = this.random(y, b), R = d === "random" ? this.random(u, f) : 0, M = E ? this.random(m, p) : 1, T = c * M, O = {
|
|
1190
|
+
id: x,
|
|
1191
|
+
x: w,
|
|
1192
|
+
y: F,
|
|
1193
|
+
rotation: R,
|
|
1194
|
+
scale: M,
|
|
1195
|
+
baseSize: T
|
|
1190
1196
|
};
|
|
1191
|
-
n.push(
|
|
1197
|
+
n.push(O);
|
|
1192
1198
|
}
|
|
1193
1199
|
return n;
|
|
1194
1200
|
}
|
|
@@ -1214,53 +1220,53 @@ class me {
|
|
|
1214
1220
|
* @returns Array of layout objects with position, rotation, scale
|
|
1215
1221
|
*/
|
|
1216
1222
|
generate(t, i, e = {}) {
|
|
1217
|
-
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none",
|
|
1218
|
-
...
|
|
1223
|
+
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, E = this.config.scaleDecay ?? 0, v = {
|
|
1224
|
+
...kt,
|
|
1219
1225
|
...this.config.radial
|
|
1220
|
-
},
|
|
1221
|
-
|
|
1222
|
-
|
|
1226
|
+
}, l = e.fixedHeight ?? a, g = s / 2, h = r / 2, b = Math.ceil(Math.sqrt(t)), I = this.config.spacing.padding ?? 50, y = Math.max(l * 0.8, Math.min(
|
|
1227
|
+
g - I - l / 2,
|
|
1228
|
+
h - I - l / 2
|
|
1223
1229
|
));
|
|
1224
1230
|
if (t > 0) {
|
|
1225
|
-
const
|
|
1231
|
+
const F = p ? this.random(f, m) : 1, R = l * F;
|
|
1226
1232
|
n.push({
|
|
1227
1233
|
id: 0,
|
|
1228
|
-
x:
|
|
1229
|
-
y,
|
|
1230
|
-
rotation: c === "random" ? this.random(
|
|
1234
|
+
x: g,
|
|
1235
|
+
y: h,
|
|
1236
|
+
rotation: c === "random" ? this.random(d * 0.33, u * 0.33) : 0,
|
|
1231
1237
|
// Less rotation for center
|
|
1232
|
-
scale:
|
|
1233
|
-
baseSize:
|
|
1238
|
+
scale: F,
|
|
1239
|
+
baseSize: R,
|
|
1234
1240
|
zIndex: 100
|
|
1235
1241
|
// Center image is highest
|
|
1236
1242
|
});
|
|
1237
1243
|
}
|
|
1238
|
-
let
|
|
1239
|
-
for (;
|
|
1240
|
-
const
|
|
1241
|
-
if (
|
|
1242
|
-
|
|
1244
|
+
let x = 1, w = 1;
|
|
1245
|
+
for (; x < t; ) {
|
|
1246
|
+
const F = w / b, R = E > 0 ? 1 - F * E * 0.5 : 1, M = Math.max(l * 0.8, y / b * 1.5 / v.tightness), T = w * M, O = T * 1.5, k = Math.PI * (3 * (O + T) - Math.sqrt((3 * O + T) * (O + 3 * T))), D = this.estimateWidth(l), z = Math.floor(k / (D * 0.7));
|
|
1247
|
+
if (z === 0) {
|
|
1248
|
+
w++;
|
|
1243
1249
|
continue;
|
|
1244
1250
|
}
|
|
1245
|
-
const
|
|
1246
|
-
for (let
|
|
1247
|
-
const
|
|
1248
|
-
let
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1251
|
-
const
|
|
1251
|
+
const S = 2 * Math.PI / z, _ = w * (20 * Math.PI / 180);
|
|
1252
|
+
for (let $ = 0; $ < z && x < t; $++) {
|
|
1253
|
+
const A = $ * S + _, j = p ? this.random(f, m) : 1, N = R * j, P = l * N;
|
|
1254
|
+
let H = g + Math.cos(A) * O, U = h + Math.sin(A) * T;
|
|
1255
|
+
const B = P * 1.5 / 2, W = P / 2;
|
|
1256
|
+
H - B < I ? H = I + B : H + B > s - I && (H = s - I - B), U - W < I ? U = I + W : U + W > r - I && (U = r - I - W);
|
|
1257
|
+
const X = c === "random" ? this.random(d, u) : 0;
|
|
1252
1258
|
n.push({
|
|
1253
|
-
id:
|
|
1254
|
-
x:
|
|
1255
|
-
y:
|
|
1256
|
-
rotation:
|
|
1257
|
-
scale:
|
|
1258
|
-
baseSize:
|
|
1259
|
-
zIndex: Math.max(1, 100 -
|
|
1259
|
+
id: x,
|
|
1260
|
+
x: H,
|
|
1261
|
+
y: U,
|
|
1262
|
+
rotation: X,
|
|
1263
|
+
scale: N,
|
|
1264
|
+
baseSize: P,
|
|
1265
|
+
zIndex: Math.max(1, 100 - w)
|
|
1260
1266
|
// Outer rings have lower z-index
|
|
1261
|
-
}),
|
|
1267
|
+
}), x++;
|
|
1262
1268
|
}
|
|
1263
|
-
|
|
1269
|
+
w++;
|
|
1264
1270
|
}
|
|
1265
1271
|
return n;
|
|
1266
1272
|
}
|
|
@@ -1293,7 +1299,7 @@ const pe = {
|
|
|
1293
1299
|
alignment: "center",
|
|
1294
1300
|
gap: 10,
|
|
1295
1301
|
overflowOffset: 0.25
|
|
1296
|
-
},
|
|
1302
|
+
}, Tt = [
|
|
1297
1303
|
{ x: 1, y: 1 },
|
|
1298
1304
|
// bottom-right
|
|
1299
1305
|
{ x: -1, y: -1 },
|
|
@@ -1323,61 +1329,61 @@ class be {
|
|
|
1323
1329
|
* @returns Array of layout objects with position, rotation, scale
|
|
1324
1330
|
*/
|
|
1325
1331
|
generate(t, i, e = {}) {
|
|
1326
|
-
const n = [], { width: s, height: r } = i, a = { ...pe, ...this.config.grid }, c = this.config.spacing.padding,
|
|
1332
|
+
const n = [], { width: s, height: r } = i, a = { ...pe, ...this.config.grid }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, E = s - 2 * c, v = r - 2 * c, { columns: l, rows: g } = this.calculateGridDimensions(
|
|
1327
1333
|
t,
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1334
|
+
E,
|
|
1335
|
+
v,
|
|
1336
|
+
d,
|
|
1331
1337
|
a
|
|
1332
|
-
),
|
|
1338
|
+
), h = a.stagger === "row", b = a.stagger === "column", I = h ? l + 0.5 : l, y = b ? g + 0.5 : g, x = (E - a.gap * (l - 1)) / I, w = (v - a.gap * (g - 1)) / y, F = h ? x / 2 : 0, R = b ? w / 2 : 0, M = 1 + a.overlap, T = Math.min(x, w) * M, O = e.fixedHeight ? Math.min(e.fixedHeight, T) : T, k = l * x + (l - 1) * a.gap + F, D = g * w + (g - 1) * a.gap + R, z = c + (E - k) / 2, S = c + (v - D) / 2, _ = l * g, $ = a.columns !== "auto" && a.rows !== "auto", A = $ && t > _;
|
|
1333
1339
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1334
1340
|
gridConfigColumns: a.columns,
|
|
1335
1341
|
gridConfigRows: a.rows,
|
|
1336
|
-
columns:
|
|
1337
|
-
rows:
|
|
1338
|
-
cellCount:
|
|
1339
|
-
hasFixedGrid:
|
|
1342
|
+
columns: l,
|
|
1343
|
+
rows: g,
|
|
1344
|
+
cellCount: _,
|
|
1345
|
+
hasFixedGrid: $,
|
|
1340
1346
|
imageCount: t,
|
|
1341
|
-
isOverflowMode:
|
|
1347
|
+
isOverflowMode: A
|
|
1342
1348
|
});
|
|
1343
|
-
const
|
|
1344
|
-
for (let
|
|
1345
|
-
let
|
|
1346
|
-
if (
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1349
|
+
const j = A ? new Array(_).fill(0) : [], N = Math.min(x, w) * a.overflowOffset;
|
|
1350
|
+
for (let P = 0; P < t; P++) {
|
|
1351
|
+
let H, U, Y = 0;
|
|
1352
|
+
if (A && P >= _) {
|
|
1353
|
+
const q = P - _, G = q % _;
|
|
1354
|
+
Y = Math.floor(q / _) + 1, j[G]++, a.fillDirection === "row" ? (H = G % l, U = Math.floor(G / l)) : (U = G % g, H = Math.floor(G / g));
|
|
1349
1355
|
} else
|
|
1350
|
-
a.fillDirection === "row" ? (
|
|
1351
|
-
let
|
|
1352
|
-
if (a.stagger === "row" &&
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1356
|
+
a.fillDirection === "row" ? (H = P % l, U = Math.floor(P / l)) : (U = P % g, H = Math.floor(P / g));
|
|
1357
|
+
let B = z + H * (x + a.gap) + x / 2, W = S + U * (w + a.gap) + w / 2;
|
|
1358
|
+
if (a.stagger === "row" && U % 2 === 1 ? B += x / 2 : a.stagger === "column" && H % 2 === 1 && (W += w / 2), Y > 0) {
|
|
1359
|
+
const q = (Y - 1) % Tt.length, G = Tt[q];
|
|
1360
|
+
B += G.x * N, W += G.y * N;
|
|
1355
1361
|
}
|
|
1356
1362
|
if (a.jitter > 0) {
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1363
|
+
const q = x / 2 * a.jitter, G = w / 2 * a.jitter;
|
|
1364
|
+
B += this.random(-q, q), W += this.random(-G, G);
|
|
1359
1365
|
}
|
|
1360
|
-
let
|
|
1361
|
-
if (!
|
|
1362
|
-
const
|
|
1363
|
-
if (
|
|
1364
|
-
const
|
|
1366
|
+
let X = B, V = W;
|
|
1367
|
+
if (!A && a.fillDirection === "row") {
|
|
1368
|
+
const q = t % l || l;
|
|
1369
|
+
if (U === Math.floor((t - 1) / l) && q < l) {
|
|
1370
|
+
const It = q * x + (q - 1) * a.gap;
|
|
1365
1371
|
let gt = 0;
|
|
1366
|
-
a.alignment === "center" ? gt = (
|
|
1372
|
+
a.alignment === "center" ? gt = (k - It) / 2 : a.alignment === "end" && (gt = k - It), X += gt;
|
|
1367
1373
|
}
|
|
1368
1374
|
}
|
|
1369
|
-
const ct =
|
|
1370
|
-
|
|
1375
|
+
const ct = p ? this.random(f, m) : 1, K = O * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, Pt = c + ot, _t = r - c - ot;
|
|
1376
|
+
X = Math.max(ht, Math.min(X, dt)), V = Math.max(Pt, Math.min(V, _t));
|
|
1371
1377
|
let ut = 0;
|
|
1372
1378
|
if (u === "random") {
|
|
1373
|
-
const
|
|
1374
|
-
a.jitter > 0 ? ut = this.random(
|
|
1379
|
+
const q = this.imageConfig.rotation?.range?.min ?? -15, G = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1380
|
+
a.jitter > 0 ? ut = this.random(q * a.jitter, G * a.jitter) : ut = this.random(q, G);
|
|
1375
1381
|
}
|
|
1376
1382
|
let ft;
|
|
1377
|
-
|
|
1378
|
-
id:
|
|
1379
|
-
x:
|
|
1380
|
-
y:
|
|
1383
|
+
A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + P : P + 1, n.push({
|
|
1384
|
+
id: P,
|
|
1385
|
+
x: X,
|
|
1386
|
+
y: V,
|
|
1381
1387
|
rotation: ut,
|
|
1382
1388
|
scale: ct,
|
|
1383
1389
|
baseSize: K,
|
|
@@ -1430,36 +1436,36 @@ class xe {
|
|
|
1430
1436
|
* @returns Array of layout objects with position, rotation, scale
|
|
1431
1437
|
*/
|
|
1432
1438
|
generate(t, i, e = {}) {
|
|
1433
|
-
const n = [], { width: s, height: r } = i, a = { ...ve, ...this.config.spiral }, c = this.config.spacing.padding,
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
),
|
|
1437
|
-
for (let
|
|
1438
|
-
let
|
|
1439
|
+
const n = [], { width: s, height: r } = i, a = { ...ve, ...this.config.spiral }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, E = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || E !== 1, l = this.config.scaleDecay ?? a.scaleDecay, g = s / 2, h = r / 2, b = Math.min(
|
|
1440
|
+
g - c - d / 2,
|
|
1441
|
+
h - c - d / 2
|
|
1442
|
+
), I = a.direction === "clockwise" ? -1 : 1;
|
|
1443
|
+
for (let y = 0; y < t; y++) {
|
|
1444
|
+
let x, w;
|
|
1439
1445
|
if (a.spiralType === "golden")
|
|
1440
|
-
|
|
1446
|
+
x = y * ye * I + a.startAngle, w = this.calculateGoldenRadius(y, t, b, a.tightness);
|
|
1441
1447
|
else if (a.spiralType === "archimedean") {
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1448
|
+
const B = y * 0.5 * a.tightness;
|
|
1449
|
+
x = B * I + a.startAngle, w = this.calculateArchimedeanRadius(B, t, b, a.tightness);
|
|
1444
1450
|
} else {
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1451
|
+
const B = y * 0.3 * a.tightness;
|
|
1452
|
+
x = B * I + a.startAngle, w = this.calculateLogarithmicRadius(B, t, b, a.tightness);
|
|
1447
1453
|
}
|
|
1448
|
-
const
|
|
1449
|
-
let
|
|
1454
|
+
const F = g + Math.cos(x) * w, R = h + Math.sin(x) * w, M = w / b, T = l > 0 ? 1 - M * l * 0.5 : 1, O = v ? this.random(p, E) : 1, k = T * O, D = d * k, S = D * 1.5 / 2, _ = D / 2, $ = c + S, A = s - c - S, j = c + _, N = r - c - _, P = Math.max($, Math.min(F, A)), H = Math.max(j, Math.min(R, N));
|
|
1455
|
+
let U = 0;
|
|
1450
1456
|
if (u === "random") {
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
} else u === "tangent" && (
|
|
1454
|
-
const
|
|
1457
|
+
const B = x * 180 / Math.PI % 360, W = this.random(f, m);
|
|
1458
|
+
U = a.spiralType === "golden" ? W : B * 0.1 + W * 0.9;
|
|
1459
|
+
} else u === "tangent" && (U = this.calculateSpiralTangent(x, w, a));
|
|
1460
|
+
const Y = t - y;
|
|
1455
1461
|
n.push({
|
|
1456
|
-
id:
|
|
1457
|
-
x:
|
|
1458
|
-
y:
|
|
1459
|
-
rotation:
|
|
1460
|
-
scale:
|
|
1461
|
-
baseSize:
|
|
1462
|
-
zIndex:
|
|
1462
|
+
id: y,
|
|
1463
|
+
x: P,
|
|
1464
|
+
y: H,
|
|
1465
|
+
rotation: U,
|
|
1466
|
+
scale: k,
|
|
1467
|
+
baseSize: D,
|
|
1468
|
+
zIndex: Y
|
|
1463
1469
|
});
|
|
1464
1470
|
}
|
|
1465
1471
|
return n;
|
|
@@ -1502,8 +1508,8 @@ class xe {
|
|
|
1502
1508
|
* r = a * e^(b*θ)
|
|
1503
1509
|
*/
|
|
1504
1510
|
calculateLogarithmicRadius(t, i, e, n) {
|
|
1505
|
-
const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n,
|
|
1506
|
-
return a /
|
|
1511
|
+
const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, d = s * Math.exp(r * c);
|
|
1512
|
+
return a / d * e;
|
|
1507
1513
|
}
|
|
1508
1514
|
/**
|
|
1509
1515
|
* Utility: Generate random number between min and max
|
|
@@ -1532,48 +1538,48 @@ class Ee {
|
|
|
1532
1538
|
* @returns Array of layout objects with position, rotation, scale
|
|
1533
1539
|
*/
|
|
1534
1540
|
generate(t, i, e = {}) {
|
|
1535
|
-
const n = [], { width: s, height: r } = i, a = { ...we, ...this.config.cluster }, c = this.config.spacing.padding,
|
|
1541
|
+
const n = [], { width: s, height: r } = i, a = { ...we, ...this.config.cluster }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, E = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || E !== 1, l = this.calculateClusterCount(
|
|
1536
1542
|
t,
|
|
1537
1543
|
a.clusterCount,
|
|
1538
1544
|
s,
|
|
1539
1545
|
r,
|
|
1540
1546
|
a.clusterSpacing
|
|
1541
|
-
),
|
|
1542
|
-
|
|
1547
|
+
), g = this.generateClusterCenters(
|
|
1548
|
+
l,
|
|
1543
1549
|
s,
|
|
1544
1550
|
r,
|
|
1545
1551
|
c,
|
|
1546
1552
|
a
|
|
1547
|
-
),
|
|
1548
|
-
for (let
|
|
1549
|
-
|
|
1550
|
-
let
|
|
1551
|
-
for (let
|
|
1552
|
-
const
|
|
1553
|
-
for (let
|
|
1554
|
-
let
|
|
1553
|
+
), h = new Array(l).fill(0);
|
|
1554
|
+
for (let I = 0; I < t; I++)
|
|
1555
|
+
h[I % l]++;
|
|
1556
|
+
let b = 0;
|
|
1557
|
+
for (let I = 0; I < l; I++) {
|
|
1558
|
+
const y = g[I], x = h[I];
|
|
1559
|
+
for (let w = 0; w < x; w++) {
|
|
1560
|
+
let F, R;
|
|
1555
1561
|
if (a.distribution === "gaussian")
|
|
1556
|
-
|
|
1562
|
+
F = this.gaussianRandom() * y.spread, R = this.gaussianRandom() * y.spread;
|
|
1557
1563
|
else {
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1564
|
+
const U = this.random(0, Math.PI * 2), Y = this.random(0, y.spread);
|
|
1565
|
+
F = Math.cos(U) * Y, R = Math.sin(U) * Y;
|
|
1560
1566
|
}
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1563
|
-
const
|
|
1564
|
-
let
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
const
|
|
1567
|
+
const M = 1 + a.overlap * 0.5, T = 1 + a.overlap * 0.3;
|
|
1568
|
+
F /= M, R /= M;
|
|
1569
|
+
const O = v ? this.random(p, E) : 1, k = T * O, D = d * k;
|
|
1570
|
+
let z = y.x + F, S = y.y + R;
|
|
1571
|
+
const $ = D * 1.5 / 2, A = D / 2;
|
|
1572
|
+
z = Math.max(c + $, Math.min(z, s - c - $)), S = Math.max(c + A, Math.min(S, r - c - A));
|
|
1573
|
+
const j = u === "random" ? this.random(f, m) : 0, P = Math.sqrt(F * F + R * R) / y.spread, H = Math.round((1 - P) * 50) + 1;
|
|
1568
1574
|
n.push({
|
|
1569
|
-
id:
|
|
1570
|
-
x:
|
|
1571
|
-
y:
|
|
1572
|
-
rotation:
|
|
1573
|
-
scale:
|
|
1574
|
-
baseSize:
|
|
1575
|
-
zIndex:
|
|
1576
|
-
}),
|
|
1575
|
+
id: b,
|
|
1576
|
+
x: z,
|
|
1577
|
+
y: S,
|
|
1578
|
+
rotation: j,
|
|
1579
|
+
scale: k,
|
|
1580
|
+
baseSize: D,
|
|
1581
|
+
zIndex: H
|
|
1582
|
+
}), b++;
|
|
1577
1583
|
}
|
|
1578
1584
|
}
|
|
1579
1585
|
return n;
|
|
@@ -1593,24 +1599,24 @@ class Ee {
|
|
|
1593
1599
|
* Generate cluster center positions with spacing constraints
|
|
1594
1600
|
*/
|
|
1595
1601
|
generateClusterCenters(t, i, e, n, s) {
|
|
1596
|
-
const r = [], c = n + s.clusterSpread,
|
|
1597
|
-
for (let
|
|
1598
|
-
let
|
|
1599
|
-
for (let
|
|
1600
|
-
const
|
|
1601
|
-
x: this.random(c,
|
|
1602
|
-
y: this.random(u,
|
|
1602
|
+
const r = [], c = n + s.clusterSpread, d = i - n - s.clusterSpread, u = n + s.clusterSpread, f = e - n - s.clusterSpread;
|
|
1603
|
+
for (let m = 0; m < t; m++) {
|
|
1604
|
+
let p = null, E = -1;
|
|
1605
|
+
for (let v = 0; v < 100; v++) {
|
|
1606
|
+
const l = {
|
|
1607
|
+
x: this.random(c, d),
|
|
1608
|
+
y: this.random(u, f),
|
|
1603
1609
|
spread: this.calculateClusterSpread(s)
|
|
1604
1610
|
};
|
|
1605
|
-
let
|
|
1606
|
-
for (const
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1611
|
+
let g = 1 / 0;
|
|
1612
|
+
for (const h of r) {
|
|
1613
|
+
const b = l.x - h.x, I = l.y - h.y, y = Math.sqrt(b * b + I * I);
|
|
1614
|
+
g = Math.min(g, y);
|
|
1609
1615
|
}
|
|
1610
|
-
if ((r.length === 0 ||
|
|
1616
|
+
if ((r.length === 0 || g > E) && (p = l, E = g), g >= s.clusterSpacing)
|
|
1611
1617
|
break;
|
|
1612
1618
|
}
|
|
1613
|
-
|
|
1619
|
+
p && r.push(p);
|
|
1614
1620
|
}
|
|
1615
1621
|
return r;
|
|
1616
1622
|
}
|
|
@@ -1638,7 +1644,7 @@ class Ee {
|
|
|
1638
1644
|
return Math.random() * (i - t) + t;
|
|
1639
1645
|
}
|
|
1640
1646
|
}
|
|
1641
|
-
class
|
|
1647
|
+
class Ie {
|
|
1642
1648
|
constructor(t, i = {}) {
|
|
1643
1649
|
this.config = t, this.imageConfig = i;
|
|
1644
1650
|
}
|
|
@@ -1650,29 +1656,29 @@ class Se {
|
|
|
1650
1656
|
* @returns Array of layout objects with position, rotation, scale
|
|
1651
1657
|
*/
|
|
1652
1658
|
generate(t, i, e = {}) {
|
|
1653
|
-
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50,
|
|
1654
|
-
...
|
|
1659
|
+
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, E = m !== 1 || p !== 1, v = e.fixedHeight ?? a, l = {
|
|
1660
|
+
...Ht,
|
|
1655
1661
|
...this.config.wave
|
|
1656
|
-
}, { rows:
|
|
1657
|
-
let
|
|
1658
|
-
for (let
|
|
1659
|
-
const
|
|
1660
|
-
let
|
|
1661
|
-
|
|
1662
|
-
for (let
|
|
1663
|
-
const
|
|
1664
|
-
let
|
|
1665
|
-
|
|
1666
|
-
const K =
|
|
1662
|
+
}, { rows: g, amplitude: h, frequency: b, phaseShift: I, synchronization: y } = l, x = Math.ceil(t / g), R = v * 1.5 / 2, M = c + R, T = s - c - R, O = T - M, k = x > 1 ? O / (x - 1) : 0, D = c + h + v / 2, z = r - c - h - v / 2, S = z - D, _ = g > 1 ? S / (g - 1) : 0;
|
|
1663
|
+
let $ = 0;
|
|
1664
|
+
for (let A = 0; A < g && $ < t; A++) {
|
|
1665
|
+
const j = g === 1 ? (D + z) / 2 : D + A * _;
|
|
1666
|
+
let N = 0;
|
|
1667
|
+
y === "offset" ? N = A * I : y === "alternating" && (N = A * Math.PI);
|
|
1668
|
+
for (let P = 0; P < x && $ < t; P++) {
|
|
1669
|
+
const H = x === 1 ? (M + T) / 2 : M + P * k, U = this.calculateWaveY(H, s, h, b, N), Y = H, B = j + U, W = E ? this.random(m, p) : 1, X = v * W;
|
|
1670
|
+
let V = 0;
|
|
1671
|
+
d === "tangent" ? V = this.calculateRotation(H, s, h, b, N) : d === "random" && (V = this.random(u, f));
|
|
1672
|
+
const K = X * 1.5 / 2, lt = X / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
|
|
1667
1673
|
n.push({
|
|
1668
|
-
id:
|
|
1669
|
-
x: Math.max(nt, Math.min(
|
|
1670
|
-
y: Math.max(ht, Math.min(
|
|
1671
|
-
rotation:
|
|
1672
|
-
scale:
|
|
1673
|
-
baseSize:
|
|
1674
|
-
zIndex:
|
|
1675
|
-
}),
|
|
1674
|
+
id: $,
|
|
1675
|
+
x: Math.max(nt, Math.min(Y, ot)),
|
|
1676
|
+
y: Math.max(ht, Math.min(B, dt)),
|
|
1677
|
+
rotation: V,
|
|
1678
|
+
scale: W,
|
|
1679
|
+
baseSize: X,
|
|
1680
|
+
zIndex: $ + 1
|
|
1681
|
+
}), $++;
|
|
1676
1682
|
}
|
|
1677
1683
|
}
|
|
1678
1684
|
return n;
|
|
@@ -1728,21 +1734,21 @@ const wt = 100, Q = 100 / Math.sqrt(3), Et = [
|
|
|
1728
1734
|
// lower-left
|
|
1729
1735
|
[0, 50]
|
|
1730
1736
|
// left
|
|
1731
|
-
],
|
|
1732
|
-
function
|
|
1737
|
+
], Se = Et[1][0] / wt, Ce = Et[2][1] / wt;
|
|
1738
|
+
function Re(o) {
|
|
1733
1739
|
return {
|
|
1734
|
-
colStep:
|
|
1740
|
+
colStep: Se * o,
|
|
1735
1741
|
rowOffset: Ce * o
|
|
1736
1742
|
};
|
|
1737
1743
|
}
|
|
1738
|
-
function
|
|
1739
|
-
const { colStep: r } =
|
|
1744
|
+
function Te(o, t, i, e, n, s) {
|
|
1745
|
+
const { colStep: r } = Re(s);
|
|
1740
1746
|
return {
|
|
1741
1747
|
px: e + r * o,
|
|
1742
1748
|
py: n + s * (t + o / 2)
|
|
1743
1749
|
};
|
|
1744
1750
|
}
|
|
1745
|
-
const
|
|
1751
|
+
const Ae = [
|
|
1746
1752
|
[1, 0, -1],
|
|
1747
1753
|
[0, 1, -1],
|
|
1748
1754
|
[-1, 1, 0],
|
|
@@ -1754,45 +1760,45 @@ function Le(o) {
|
|
|
1754
1760
|
if (o === 0) return [[0, 0, 0]];
|
|
1755
1761
|
const t = [];
|
|
1756
1762
|
let [i, e, n] = [0, -o, o];
|
|
1757
|
-
for (const [s, r, a] of
|
|
1763
|
+
for (const [s, r, a] of Ae)
|
|
1758
1764
|
for (let c = 0; c < o; c++)
|
|
1759
1765
|
t.push([i, e, n]), i += s, e += r, n += a;
|
|
1760
1766
|
return t;
|
|
1761
1767
|
}
|
|
1762
|
-
class
|
|
1768
|
+
class Fe {
|
|
1763
1769
|
// imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
|
|
1764
1770
|
// would break hex tiling). Kept as parameter for interface compatibility.
|
|
1765
1771
|
constructor(t, i = {}) {
|
|
1766
1772
|
this.config = t;
|
|
1767
1773
|
}
|
|
1768
1774
|
generate(t, i, e = {}) {
|
|
1769
|
-
const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2,
|
|
1770
|
-
...
|
|
1775
|
+
const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, d = e.fixedHeight ?? 200, f = {
|
|
1776
|
+
...Nt,
|
|
1771
1777
|
...this.config.honeycomb
|
|
1772
|
-
}.spacing ?? 0,
|
|
1773
|
-
let
|
|
1774
|
-
for (;
|
|
1775
|
-
const
|
|
1776
|
-
for (const [
|
|
1777
|
-
if (
|
|
1778
|
-
const { px:
|
|
1778
|
+
}.spacing ?? 0, m = d + f;
|
|
1779
|
+
let p = 0, E = 0;
|
|
1780
|
+
for (; p < t; ) {
|
|
1781
|
+
const v = Le(E);
|
|
1782
|
+
for (const [l, g, h] of v) {
|
|
1783
|
+
if (p >= t) break;
|
|
1784
|
+
const { px: b, py: I } = Te(l, g, h, a, c, m);
|
|
1779
1785
|
n.push({
|
|
1780
|
-
id:
|
|
1781
|
-
x,
|
|
1782
|
-
y:
|
|
1786
|
+
id: p,
|
|
1787
|
+
x: b,
|
|
1788
|
+
y: I,
|
|
1783
1789
|
rotation: 0,
|
|
1784
1790
|
scale: 1,
|
|
1785
|
-
baseSize:
|
|
1791
|
+
baseSize: d,
|
|
1786
1792
|
// Inner rings render above outer rings
|
|
1787
|
-
zIndex: Math.max(1, 100 -
|
|
1788
|
-
}),
|
|
1793
|
+
zIndex: Math.max(1, 100 - E)
|
|
1794
|
+
}), p++;
|
|
1789
1795
|
}
|
|
1790
|
-
|
|
1796
|
+
E++;
|
|
1791
1797
|
}
|
|
1792
1798
|
return n;
|
|
1793
1799
|
}
|
|
1794
1800
|
}
|
|
1795
|
-
class
|
|
1801
|
+
class Me {
|
|
1796
1802
|
constructor(t) {
|
|
1797
1803
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1798
1804
|
}
|
|
@@ -1811,9 +1817,9 @@ class Fe {
|
|
|
1811
1817
|
case "cluster":
|
|
1812
1818
|
return new Ee(this.config, this.imageConfig);
|
|
1813
1819
|
case "wave":
|
|
1814
|
-
return new
|
|
1820
|
+
return new Ie(this.config, this.imageConfig);
|
|
1815
1821
|
case "honeycomb":
|
|
1816
|
-
return new
|
|
1822
|
+
return new Fe(this.config, this.imageConfig);
|
|
1817
1823
|
default:
|
|
1818
1824
|
return new ge(this.config, this.imageConfig);
|
|
1819
1825
|
}
|
|
@@ -1897,15 +1903,15 @@ class Fe {
|
|
|
1897
1903
|
const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
|
|
1898
1904
|
if (r !== void 0)
|
|
1899
1905
|
return { height: r };
|
|
1900
|
-
const a = s?.minSize ?? 50, c = s?.maxSize ?? 400,
|
|
1901
|
-
let
|
|
1902
|
-
|
|
1903
|
-
let
|
|
1904
|
-
if (
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1906
|
+
const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, d = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: f, height: m } = t, v = f * m * d / i;
|
|
1907
|
+
let g = Math.sqrt(v / 1.4);
|
|
1908
|
+
g *= u, g = Math.min(g, e);
|
|
1909
|
+
let h = this.clamp(g, a, c);
|
|
1910
|
+
if (h === a && g < a) {
|
|
1911
|
+
const b = Math.max(a * 0.05, 20);
|
|
1912
|
+
h = Math.max(b, g);
|
|
1907
1913
|
}
|
|
1908
|
-
return this.config.algorithm === "honeycomb" && (
|
|
1914
|
+
return this.config.algorithm === "honeycomb" && (h = Math.min(h, this.honeycombMaxImageHeight(i, t))), { height: h };
|
|
1909
1915
|
}
|
|
1910
1916
|
/**
|
|
1911
1917
|
* Returns the largest image height at which all honeycomb rings fit within the container.
|
|
@@ -1917,8 +1923,8 @@ class Fe {
|
|
|
1917
1923
|
let e = 0, n = 1;
|
|
1918
1924
|
for (; n < t; )
|
|
1919
1925
|
e++, n += 6 * e;
|
|
1920
|
-
const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2,
|
|
1921
|
-
return Math.max(10, Math.min(
|
|
1926
|
+
const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, d = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), f = (c - s - r * e) / (e + 0.5), m = (a - s - d * r * e) / (d * e + u);
|
|
1927
|
+
return Math.max(10, Math.min(f, m));
|
|
1922
1928
|
}
|
|
1923
1929
|
/**
|
|
1924
1930
|
* Utility: Clamp a value between min and max
|
|
@@ -1927,8 +1933,8 @@ class Fe {
|
|
|
1927
1933
|
return Math.max(i, Math.min(e, t));
|
|
1928
1934
|
}
|
|
1929
1935
|
}
|
|
1930
|
-
var
|
|
1931
|
-
const
|
|
1936
|
+
var C = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(C || {});
|
|
1937
|
+
const At = {
|
|
1932
1938
|
// Geometric shapes - uses percentages for responsive sizing
|
|
1933
1939
|
circle: "circle(50%)",
|
|
1934
1940
|
square: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)",
|
|
@@ -1977,7 +1983,7 @@ const Tt = {
|
|
|
1977
1983
|
};
|
|
1978
1984
|
function Oe(o) {
|
|
1979
1985
|
if (o)
|
|
1980
|
-
return o in
|
|
1986
|
+
return o in At ? At[o] : o;
|
|
1981
1987
|
}
|
|
1982
1988
|
function De(o, t, i) {
|
|
1983
1989
|
const e = ze[o];
|
|
@@ -1985,10 +1991,10 @@ function De(o, t, i) {
|
|
|
1985
1991
|
const n = t / e.refHeight;
|
|
1986
1992
|
if (o === "circle")
|
|
1987
1993
|
return `circle(${Math.round(50 * n * 100) / 100}px)`;
|
|
1988
|
-
const s = e.points.map(([
|
|
1989
|
-
return `polygon(${e.points.map(([
|
|
1990
|
-
const
|
|
1991
|
-
return `${
|
|
1994
|
+
const s = e.points.map(([v]) => v), r = e.points.map(([, v]) => v), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, d = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? d) / 2, f = t / 2, m = u - a, p = f - c;
|
|
1995
|
+
return `polygon(${e.points.map(([v, l]) => {
|
|
1996
|
+
const g = Math.round((v * n + m) * 100) / 100, h = Math.round((l * n + p) * 100) / 100;
|
|
1997
|
+
return `${g}px ${h}px`;
|
|
1992
1998
|
}).join(", ")})`;
|
|
1993
1999
|
}
|
|
1994
2000
|
function $e(o) {
|
|
@@ -2023,22 +2029,22 @@ function it(o, t, i) {
|
|
|
2023
2029
|
o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : a && (e.borderTopLeftRadius = `${a}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : a && (e.borderTopRightRadius = `${a}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : a && (e.borderBottomRightRadius = `${a}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : a && (e.borderBottomLeftRadius = `${a}px`);
|
|
2024
2030
|
} else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
|
|
2025
2031
|
if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
|
|
2026
|
-
const a = o.border || {}, c = { ...a, ...o.borderTop },
|
|
2027
|
-
e.borderTop = tt(c), e.borderRight = tt(
|
|
2032
|
+
const a = o.border || {}, c = { ...a, ...o.borderTop }, d = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, f = { ...a, ...o.borderLeft };
|
|
2033
|
+
e.borderTop = tt(c), e.borderRight = tt(d), e.borderBottom = tt(u), e.borderLeft = tt(f);
|
|
2028
2034
|
} else o.border && (e.border = tt(o.border));
|
|
2029
2035
|
o.shadow !== void 0 && (e.boxShadow = Pe(o.shadow));
|
|
2030
2036
|
const r = _e(o.filter);
|
|
2031
2037
|
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) {
|
|
2032
|
-
const a = o.outline.width ?? 0, c = o.outline.style ?? "solid",
|
|
2033
|
-
e.outline = `${a}px ${c} ${
|
|
2038
|
+
const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", d = o.outline.color ?? "#000000";
|
|
2039
|
+
e.outline = `${a}px ${c} ${d}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
2034
2040
|
}
|
|
2035
2041
|
if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
|
|
2036
2042
|
let a;
|
|
2037
|
-
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath,
|
|
2038
|
-
if (
|
|
2039
|
-
a = De(
|
|
2043
|
+
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, d = c ? o.clipPath : void 0;
|
|
2044
|
+
if (d?.mode === "height-relative" && t)
|
|
2045
|
+
a = De(d.shape, t, i);
|
|
2040
2046
|
else {
|
|
2041
|
-
const u = c &&
|
|
2047
|
+
const u = c && d ? d.shape : o.clipPath;
|
|
2042
2048
|
a = Oe(u);
|
|
2043
2049
|
}
|
|
2044
2050
|
a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
|
|
@@ -2071,9 +2077,9 @@ const Lt = {
|
|
|
2071
2077
|
UNFOCUSING: 999,
|
|
2072
2078
|
FOCUSING: 1e3
|
|
2073
2079
|
};
|
|
2074
|
-
class
|
|
2080
|
+
class ke {
|
|
2075
2081
|
constructor(t, i, e) {
|
|
2076
|
-
this.state =
|
|
2082
|
+
this.state = C.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;
|
|
2077
2083
|
}
|
|
2078
2084
|
/**
|
|
2079
2085
|
* Set callback to be fired when an unfocus animation fully completes.
|
|
@@ -2091,7 +2097,7 @@ class He {
|
|
|
2091
2097
|
* Check if any animation is in progress
|
|
2092
2098
|
*/
|
|
2093
2099
|
isAnimating() {
|
|
2094
|
-
return this.state !==
|
|
2100
|
+
return this.state !== C.IDLE && this.state !== C.FOCUSED;
|
|
2095
2101
|
}
|
|
2096
2102
|
/**
|
|
2097
2103
|
* Normalize scalePercent value
|
|
@@ -2106,8 +2112,8 @@ class He {
|
|
|
2106
2112
|
calculateFocusDimensions(t, i, e) {
|
|
2107
2113
|
const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
|
|
2108
2114
|
let a = s, c = a * r;
|
|
2109
|
-
const
|
|
2110
|
-
return c >
|
|
2115
|
+
const d = e.width * n;
|
|
2116
|
+
return c > d && (c = d, a = c / r), { width: c, height: a };
|
|
2111
2117
|
}
|
|
2112
2118
|
/**
|
|
2113
2119
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
@@ -2139,11 +2145,11 @@ class He {
|
|
|
2139
2145
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
2140
2146
|
*/
|
|
2141
2147
|
animateWithDimensions(t, i, e, n, s, r, a, c) {
|
|
2142
|
-
const
|
|
2148
|
+
const d = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
|
|
2143
2149
|
return t.style.transition = "none", t.animate(
|
|
2144
2150
|
[
|
|
2145
2151
|
{
|
|
2146
|
-
transform:
|
|
2152
|
+
transform: d,
|
|
2147
2153
|
width: `${n}px`,
|
|
2148
2154
|
height: `${s}px`
|
|
2149
2155
|
},
|
|
@@ -2200,33 +2206,33 @@ class He {
|
|
|
2200
2206
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2201
2207
|
*/
|
|
2202
2208
|
startFocusAnimation(t, i, e, n, s) {
|
|
2203
|
-
const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight,
|
|
2209
|
+
const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, d = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
|
|
2204
2210
|
this.animationEngine.cancelAllAnimations(t);
|
|
2205
|
-
const
|
|
2211
|
+
const f = this.config.animationDuration ?? 600;
|
|
2206
2212
|
this.applyFocusedStyling(t, Lt.FOCUSING);
|
|
2207
|
-
const
|
|
2213
|
+
const m = n ?? {
|
|
2208
2214
|
x: 0,
|
|
2209
2215
|
y: 0,
|
|
2210
2216
|
rotation: e.rotation,
|
|
2211
2217
|
scale: 1
|
|
2212
2218
|
// No scale - using dimensions
|
|
2213
|
-
},
|
|
2219
|
+
}, p = s?.width ?? a, E = s?.height ?? c, v = this.animateWithDimensions(
|
|
2214
2220
|
t,
|
|
2215
|
-
|
|
2221
|
+
m,
|
|
2216
2222
|
u,
|
|
2217
|
-
g,
|
|
2218
2223
|
p,
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2224
|
+
E,
|
|
2225
|
+
d.width,
|
|
2226
|
+
d.height,
|
|
2227
|
+
f
|
|
2228
|
+
), l = {
|
|
2223
2229
|
id: `focus-${Date.now()}`,
|
|
2224
2230
|
element: t,
|
|
2225
|
-
animation:
|
|
2226
|
-
fromState:
|
|
2231
|
+
animation: v,
|
|
2232
|
+
fromState: m,
|
|
2227
2233
|
toState: u,
|
|
2228
2234
|
startTime: performance.now(),
|
|
2229
|
-
duration:
|
|
2235
|
+
duration: f
|
|
2230
2236
|
};
|
|
2231
2237
|
return this.focusData = {
|
|
2232
2238
|
element: t,
|
|
@@ -2235,12 +2241,12 @@ class He {
|
|
|
2235
2241
|
originalZIndex: r,
|
|
2236
2242
|
originalWidth: a,
|
|
2237
2243
|
originalHeight: c,
|
|
2238
|
-
focusWidth:
|
|
2239
|
-
focusHeight:
|
|
2240
|
-
}, this.startClipPathAnimation(t,
|
|
2244
|
+
focusWidth: d.width,
|
|
2245
|
+
focusHeight: d.height
|
|
2246
|
+
}, this.startClipPathAnimation(t, l, !0), {
|
|
2241
2247
|
element: t,
|
|
2242
2248
|
originalState: e,
|
|
2243
|
-
animationHandle:
|
|
2249
|
+
animationHandle: l,
|
|
2244
2250
|
direction: "in",
|
|
2245
2251
|
originalWidth: a,
|
|
2246
2252
|
originalHeight: c
|
|
@@ -2255,37 +2261,37 @@ class He {
|
|
|
2255
2261
|
t.style.zIndex = String(Lt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2256
2262
|
const s = this.config.animationDuration ?? 600;
|
|
2257
2263
|
t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
|
|
2258
|
-
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight,
|
|
2264
|
+
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, d = {
|
|
2259
2265
|
x: 0,
|
|
2260
2266
|
y: 0,
|
|
2261
2267
|
rotation: i.rotation,
|
|
2262
2268
|
scale: 1
|
|
2263
2269
|
// No scale - using dimensions
|
|
2264
|
-
}, u = this.focusData?.originalWidth ?? t.offsetWidth,
|
|
2270
|
+
}, u = this.focusData?.originalWidth ?? t.offsetWidth, f = this.focusData?.originalHeight ?? t.offsetHeight, m = this.animateWithDimensions(
|
|
2265
2271
|
t,
|
|
2266
2272
|
r,
|
|
2267
|
-
|
|
2273
|
+
d,
|
|
2268
2274
|
a,
|
|
2269
2275
|
c,
|
|
2270
2276
|
u,
|
|
2271
|
-
|
|
2277
|
+
f,
|
|
2272
2278
|
s
|
|
2273
|
-
),
|
|
2279
|
+
), p = {
|
|
2274
2280
|
id: `unfocus-${Date.now()}`,
|
|
2275
2281
|
element: t,
|
|
2276
|
-
animation:
|
|
2282
|
+
animation: m,
|
|
2277
2283
|
fromState: r,
|
|
2278
|
-
toState:
|
|
2284
|
+
toState: d,
|
|
2279
2285
|
startTime: performance.now(),
|
|
2280
2286
|
duration: s
|
|
2281
2287
|
};
|
|
2282
|
-
return this.startClipPathAnimation(t,
|
|
2288
|
+
return this.startClipPathAnimation(t, p, !1), {
|
|
2283
2289
|
element: t,
|
|
2284
2290
|
originalState: i,
|
|
2285
|
-
animationHandle:
|
|
2291
|
+
animationHandle: p,
|
|
2286
2292
|
direction: "out",
|
|
2287
2293
|
originalWidth: u,
|
|
2288
|
-
originalHeight:
|
|
2294
|
+
originalHeight: f
|
|
2289
2295
|
};
|
|
2290
2296
|
}
|
|
2291
2297
|
/**
|
|
@@ -2331,26 +2337,26 @@ class He {
|
|
|
2331
2337
|
* Implements cross-animation when swapping focus
|
|
2332
2338
|
*/
|
|
2333
2339
|
async focusImage(t, i, e) {
|
|
2334
|
-
if (this.currentFocus === t && this.state ===
|
|
2340
|
+
if (this.currentFocus === t && this.state === C.FOCUSED)
|
|
2335
2341
|
return this.unfocusImage();
|
|
2336
|
-
if (this.incoming?.element === t && this.state ===
|
|
2342
|
+
if (this.incoming?.element === t && this.state === C.FOCUSING) {
|
|
2337
2343
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2338
2344
|
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2339
2345
|
t,
|
|
2340
2346
|
this.incoming.originalState,
|
|
2341
2347
|
s,
|
|
2342
2348
|
r
|
|
2343
|
-
), this.incoming = null, this.state =
|
|
2349
|
+
), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE;
|
|
2344
2350
|
return;
|
|
2345
2351
|
}
|
|
2346
2352
|
const n = ++this.focusGeneration;
|
|
2347
2353
|
switch (this.state) {
|
|
2348
|
-
case
|
|
2349
|
-
if (this.state =
|
|
2350
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2354
|
+
case C.IDLE:
|
|
2355
|
+
if (this.state = C.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2356
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2351
2357
|
break;
|
|
2352
|
-
case
|
|
2353
|
-
if (this.state =
|
|
2358
|
+
case C.FOCUSED:
|
|
2359
|
+
if (this.state = C.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2354
2360
|
this.currentFocus,
|
|
2355
2361
|
this.focusData.originalState
|
|
2356
2362
|
)), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
@@ -2362,9 +2368,9 @@ class He {
|
|
|
2362
2368
|
const s = this.outgoing.element;
|
|
2363
2369
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2364
2370
|
}
|
|
2365
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2371
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2366
2372
|
break;
|
|
2367
|
-
case
|
|
2373
|
+
case C.FOCUSING:
|
|
2368
2374
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2369
2375
|
this.incoming.element,
|
|
2370
2376
|
this.incoming.originalState,
|
|
@@ -2372,10 +2378,10 @@ class He {
|
|
|
2372
2378
|
this.focusData?.originalWidth,
|
|
2373
2379
|
this.focusData?.originalHeight
|
|
2374
2380
|
), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2375
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2381
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2376
2382
|
break;
|
|
2377
|
-
case
|
|
2378
|
-
if (this.state =
|
|
2383
|
+
case C.UNFOCUSING:
|
|
2384
|
+
if (this.state = C.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
2379
2385
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2380
2386
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2381
2387
|
]), this.focusGeneration !== n) return;
|
|
@@ -2383,9 +2389,9 @@ class He {
|
|
|
2383
2389
|
const s = this.outgoing.element;
|
|
2384
2390
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2385
2391
|
}
|
|
2386
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2392
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2387
2393
|
break;
|
|
2388
|
-
case
|
|
2394
|
+
case C.CROSS_ANIMATING:
|
|
2389
2395
|
if (this.incoming?.element === t)
|
|
2390
2396
|
return;
|
|
2391
2397
|
if (this.outgoing?.element === t) {
|
|
@@ -2408,7 +2414,7 @@ class He {
|
|
|
2408
2414
|
const a = this.outgoing.element;
|
|
2409
2415
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2410
2416
|
}
|
|
2411
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2417
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2412
2418
|
return;
|
|
2413
2419
|
}
|
|
2414
2420
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2434,7 +2440,7 @@ class He {
|
|
|
2434
2440
|
const s = this.outgoing.element;
|
|
2435
2441
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2436
2442
|
}
|
|
2437
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2443
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2438
2444
|
break;
|
|
2439
2445
|
}
|
|
2440
2446
|
}
|
|
@@ -2442,24 +2448,24 @@ class He {
|
|
|
2442
2448
|
* Unfocus current image, returning it to original position
|
|
2443
2449
|
*/
|
|
2444
2450
|
async unfocusImage() {
|
|
2445
|
-
if (this.state ===
|
|
2451
|
+
if (this.state === C.UNFOCUSING)
|
|
2446
2452
|
return;
|
|
2447
2453
|
const t = ++this.focusGeneration;
|
|
2448
2454
|
if (!this.currentFocus || !this.focusData) {
|
|
2449
|
-
if (this.incoming && this.state ===
|
|
2455
|
+
if (this.incoming && this.state === C.FOCUSING) {
|
|
2450
2456
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2451
2457
|
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2452
2458
|
this.incoming.element,
|
|
2453
2459
|
this.incoming.originalState,
|
|
2454
2460
|
s,
|
|
2455
2461
|
r
|
|
2456
|
-
), this.incoming = null, this.state =
|
|
2462
|
+
), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2457
2463
|
const a = this.outgoing.element;
|
|
2458
|
-
this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state =
|
|
2464
|
+
this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(a);
|
|
2459
2465
|
}
|
|
2460
2466
|
return;
|
|
2461
2467
|
}
|
|
2462
|
-
if (this.state ===
|
|
2468
|
+
if (this.state === C.CROSS_ANIMATING && this.incoming) {
|
|
2463
2469
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2464
2470
|
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2465
2471
|
const a = this.startUnfocusAnimation(
|
|
@@ -2474,13 +2480,13 @@ class He {
|
|
|
2474
2480
|
]), this.focusGeneration !== t) return;
|
|
2475
2481
|
let c = null;
|
|
2476
2482
|
this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2477
|
-
const
|
|
2478
|
-
this.removeFocusedStyling(
|
|
2483
|
+
const d = a.element;
|
|
2484
|
+
this.removeFocusedStyling(d, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(d);
|
|
2479
2485
|
return;
|
|
2480
2486
|
}
|
|
2481
|
-
this.state =
|
|
2487
|
+
this.state = C.UNFOCUSING;
|
|
2482
2488
|
const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2483
|
-
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 =
|
|
2489
|
+
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 = C.IDLE, this.onUnfocusComplete?.(i));
|
|
2484
2490
|
}
|
|
2485
2491
|
/**
|
|
2486
2492
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2498,7 +2504,7 @@ class He {
|
|
|
2498
2504
|
* Check if an image is currently focused (stable state)
|
|
2499
2505
|
*/
|
|
2500
2506
|
isFocused(t) {
|
|
2501
|
-
return this.currentFocus === t && this.state ===
|
|
2507
|
+
return this.currentFocus === t && this.state === C.FOCUSED;
|
|
2502
2508
|
}
|
|
2503
2509
|
/**
|
|
2504
2510
|
* Check if an image is the target of current focus animation
|
|
@@ -2519,7 +2525,7 @@ class He {
|
|
|
2519
2525
|
* Used during swipe gestures for visual feedback
|
|
2520
2526
|
*/
|
|
2521
2527
|
setDragOffset(t) {
|
|
2522
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2528
|
+
if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
|
|
2523
2529
|
const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
|
|
2524
2530
|
n.push(`translate(${s}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
|
|
2525
2531
|
}
|
|
@@ -2529,7 +2535,7 @@ class He {
|
|
|
2529
2535
|
* @param duration - Animation duration in ms (default 150)
|
|
2530
2536
|
*/
|
|
2531
2537
|
clearDragOffset(t, i = 150) {
|
|
2532
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2538
|
+
if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
|
|
2533
2539
|
const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
|
|
2534
2540
|
s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
|
|
2535
2541
|
const c = s.join(" ");
|
|
@@ -2559,10 +2565,10 @@ class He {
|
|
|
2559
2565
|
this.focusData.originalZIndex,
|
|
2560
2566
|
this.focusData.originalWidth,
|
|
2561
2567
|
this.focusData.originalHeight
|
|
2562
|
-
), this.state =
|
|
2568
|
+
), this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2563
2569
|
}
|
|
2564
2570
|
}
|
|
2565
|
-
const
|
|
2571
|
+
const He = 50, Ne = 0.5, Be = 20, je = 0.3, We = 150, Ge = 30, rt = class rt {
|
|
2566
2572
|
constructor(t, i) {
|
|
2567
2573
|
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);
|
|
2568
2574
|
}
|
|
@@ -2622,7 +2628,7 @@ const Ne = 50, ke = 0.5, Be = 20, je = 0.3, We = 150, Ge = 30, rt = class rt {
|
|
|
2622
2628
|
this.recentTouchTimestamp = Date.now();
|
|
2623
2629
|
const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
|
|
2624
2630
|
let r = !1;
|
|
2625
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >=
|
|
2631
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= He || n >= Ne && s >= Be) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2626
2632
|
}
|
|
2627
2633
|
handleTouchCancel(t) {
|
|
2628
2634
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
@@ -2725,10 +2731,10 @@ class qe {
|
|
|
2725
2731
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2726
2732
|
if (!a.ok)
|
|
2727
2733
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2728
|
-
const
|
|
2734
|
+
const d = (await a.json()).files.filter(
|
|
2729
2735
|
(u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
|
|
2730
2736
|
);
|
|
2731
|
-
return this.log(`Found ${
|
|
2737
|
+
return this.log(`Found ${d.length} images in folder ${t} (non-recursive)`), d.forEach((u) => {
|
|
2732
2738
|
e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2733
2739
|
}), e;
|
|
2734
2740
|
}
|
|
@@ -2795,18 +2801,18 @@ class qe {
|
|
|
2795
2801
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2796
2802
|
if (!a.ok)
|
|
2797
2803
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2798
|
-
const c = await a.json(),
|
|
2799
|
-
(
|
|
2804
|
+
const c = await a.json(), d = c.files.filter(
|
|
2805
|
+
(f) => f.mimeType.startsWith("image/") && i.isAllowed(f.name)
|
|
2800
2806
|
), u = c.files.filter(
|
|
2801
|
-
(
|
|
2807
|
+
(f) => f.mimeType === "application/vnd.google-apps.folder"
|
|
2802
2808
|
);
|
|
2803
|
-
this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((
|
|
2804
|
-
e.push(`https://lh3.googleusercontent.com/d/${
|
|
2809
|
+
this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((f) => this.log(` - File: ${f.name} (${f.mimeType})`)), this.log(`- ${d.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), d.forEach((f) => {
|
|
2810
|
+
e.push(`https://lh3.googleusercontent.com/d/${f.id}=s1600`), this.log(`Added file: ${f.name}`);
|
|
2805
2811
|
});
|
|
2806
|
-
for (const
|
|
2807
|
-
this.log(`Loading images from subfolder: ${
|
|
2808
|
-
const
|
|
2809
|
-
e.push(...
|
|
2812
|
+
for (const f of u) {
|
|
2813
|
+
this.log(`Loading images from subfolder: ${f.name}`);
|
|
2814
|
+
const m = await this.loadImagesRecursively(f.id, i);
|
|
2815
|
+
e.push(...m);
|
|
2810
2816
|
}
|
|
2811
2817
|
return e;
|
|
2812
2818
|
}
|
|
@@ -2851,7 +2857,7 @@ class qe {
|
|
|
2851
2857
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2852
2858
|
}
|
|
2853
2859
|
}
|
|
2854
|
-
class
|
|
2860
|
+
class Ye {
|
|
2855
2861
|
constructor(t) {
|
|
2856
2862
|
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)
|
|
2857
2863
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -3031,7 +3037,7 @@ class Xe {
|
|
|
3031
3037
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
3032
3038
|
}
|
|
3033
3039
|
}
|
|
3034
|
-
class
|
|
3040
|
+
class Xe {
|
|
3035
3041
|
constructor(t) {
|
|
3036
3042
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
3037
3043
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -3088,7 +3094,7 @@ class Ye {
|
|
|
3088
3094
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
3089
3095
|
}
|
|
3090
3096
|
}
|
|
3091
|
-
class
|
|
3097
|
+
class Ve {
|
|
3092
3098
|
/**
|
|
3093
3099
|
* Create a new ImageFilter
|
|
3094
3100
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -3125,7 +3131,7 @@ class Je {
|
|
|
3125
3131
|
// isAllowedDate(date: Date): boolean
|
|
3126
3132
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
3127
3133
|
}
|
|
3128
|
-
const
|
|
3134
|
+
const Je = `
|
|
3129
3135
|
.fbn-ic-gallery {
|
|
3130
3136
|
position: relative;
|
|
3131
3137
|
width: 100%;
|
|
@@ -3211,15 +3217,15 @@ function Ke() {
|
|
|
3211
3217
|
const o = "fbn-ic-functional-styles";
|
|
3212
3218
|
if (document.getElementById(o)) return;
|
|
3213
3219
|
const t = document.createElement("style");
|
|
3214
|
-
t.id = o, t.textContent =
|
|
3220
|
+
t.id = o, t.textContent = Je, document.head.appendChild(t);
|
|
3215
3221
|
}
|
|
3216
3222
|
class Ze {
|
|
3217
3223
|
constructor(t = {}) {
|
|
3218
|
-
this.fullConfig = Kt(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.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new ee(this.fullConfig.animation), this.layoutEngine = new
|
|
3224
|
+
this.fullConfig = Kt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.callbacks = t.on ?? {}, 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.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new ee(this.fullConfig.animation), this.layoutEngine = new Me({
|
|
3219
3225
|
layout: this.fullConfig.layout,
|
|
3220
3226
|
image: this.fullConfig.image
|
|
3221
|
-
}), this.zoomEngine = new
|
|
3222
|
-
const i = this.fullConfig.animation.entry ||
|
|
3227
|
+
}), this.zoomEngine = new ke(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3228
|
+
const i = this.fullConfig.animation.entry || L.animation.entry;
|
|
3223
3229
|
this.entryAnimationEngine = new ue(
|
|
3224
3230
|
i,
|
|
3225
3231
|
this.fullConfig.layout.algorithm
|
|
@@ -3230,13 +3236,22 @@ class Ze {
|
|
|
3230
3236
|
i.timing?.duration ?? 600
|
|
3231
3237
|
) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
|
|
3232
3238
|
this.idleAnimationEngine?.resumeForImage(n);
|
|
3233
|
-
const s = n;
|
|
3239
|
+
const s = n, r = this.imageElements.indexOf(s);
|
|
3240
|
+
if (this.callbacks.onImageUnfocus && r !== -1) {
|
|
3241
|
+
const a = this.imageLoader.imageURLs(), c = {
|
|
3242
|
+
element: s,
|
|
3243
|
+
index: r,
|
|
3244
|
+
url: a[r] ?? "",
|
|
3245
|
+
layout: this.imageLayouts[r]
|
|
3246
|
+
};
|
|
3247
|
+
this.callbacks.onImageUnfocus(c);
|
|
3248
|
+
}
|
|
3234
3249
|
requestAnimationFrame(() => {
|
|
3235
3250
|
if (s.matches(":hover") && this.fullConfig.styling?.hover) {
|
|
3236
|
-
const
|
|
3237
|
-
if (
|
|
3238
|
-
const
|
|
3239
|
-
st(s, this.fullConfig.styling.hover,
|
|
3251
|
+
const a = this.imageElements.indexOf(s);
|
|
3252
|
+
if (a !== -1) {
|
|
3253
|
+
const c = s.offsetHeight, d = s.cachedRenderedWidth;
|
|
3254
|
+
st(s, this.fullConfig.styling.hover, c, d), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[a] };
|
|
3240
3255
|
}
|
|
3241
3256
|
}
|
|
3242
3257
|
});
|
|
@@ -3247,7 +3262,7 @@ class Ze {
|
|
|
3247
3262
|
*/
|
|
3248
3263
|
createImageFilter() {
|
|
3249
3264
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
3250
|
-
return new
|
|
3265
|
+
return new Ve(t);
|
|
3251
3266
|
}
|
|
3252
3267
|
/**
|
|
3253
3268
|
* Create appropriate image loader based on config
|
|
@@ -3258,7 +3273,7 @@ class Ze {
|
|
|
3258
3273
|
if (!t || t.length === 0)
|
|
3259
3274
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.\n Example: imageCloud({ container: 'id', images: ['https://...'] })");
|
|
3260
3275
|
const e = t.map((n) => this.createLoaderFromEntry(n, i));
|
|
3261
|
-
return e.length === 1 ? e[0] : new
|
|
3276
|
+
return e.length === 1 ? e[0] : new Xe({
|
|
3262
3277
|
loaders: e,
|
|
3263
3278
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
3264
3279
|
});
|
|
@@ -3276,7 +3291,7 @@ class Ze {
|
|
|
3276
3291
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3277
3292
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3278
3293
|
};
|
|
3279
|
-
return new
|
|
3294
|
+
return new Ye(n);
|
|
3280
3295
|
} else if ("googleDrive" in t) {
|
|
3281
3296
|
const e = t.googleDrive, n = {
|
|
3282
3297
|
...e,
|
|
@@ -3432,61 +3447,134 @@ class Ze {
|
|
|
3432
3447
|
const e = this.getContainerBounds();
|
|
3433
3448
|
this.currentImageHeight = i;
|
|
3434
3449
|
const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
|
|
3435
|
-
this.imageLayouts = s, this.
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3450
|
+
if (this.imageLayouts = s, this.callbacks.onLayoutComplete) {
|
|
3451
|
+
const l = {
|
|
3452
|
+
layouts: [...s],
|
|
3453
|
+
// shallow copy — caller should not mutate
|
|
3454
|
+
containerBounds: { ...e },
|
|
3455
|
+
algorithm: this.fullConfig.layout.algorithm,
|
|
3456
|
+
imageCount: t.length
|
|
3457
|
+
};
|
|
3458
|
+
this.callbacks.onLayoutComplete(l);
|
|
3459
|
+
}
|
|
3460
|
+
this.displayQueue = [];
|
|
3461
|
+
let r = 0, a = 0, c = 0, d = 0, u = !1;
|
|
3462
|
+
const f = /* @__PURE__ */ new Map(), m = () => {
|
|
3463
|
+
if (u || n !== this.loadGeneration || !this.callbacks.onGalleryReady) return;
|
|
3464
|
+
u = !0;
|
|
3465
|
+
const l = {
|
|
3466
|
+
totalImages: t.length,
|
|
3467
|
+
failedImages: c,
|
|
3468
|
+
loadDuration: d > 0 ? performance.now() - d : 0
|
|
3469
|
+
};
|
|
3470
|
+
this.callbacks.onGalleryReady(l);
|
|
3471
|
+
}, p = () => {
|
|
3472
|
+
r >= t.length && this.displayQueue.length === 0 && m();
|
|
3473
|
+
}, E = (l) => {
|
|
3474
|
+
this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(async () => {
|
|
3475
|
+
l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1";
|
|
3476
|
+
const g = parseInt(l.dataset.imageId || "0"), h = this.imageLayouts[g], b = this.entryAnimationEngine.getTiming(), I = performance.now(), y = parseFloat(l.dataset.startX || "0"), x = parseFloat(l.dataset.startY || "0"), w = parseFloat(l.dataset.endX || "0"), F = parseFloat(l.dataset.endY || "0"), R = parseFloat(l.dataset.rotation || "0"), M = parseFloat(l.dataset.scale || "1"), T = parseFloat(l.dataset.startRotation || l.dataset.rotation || "0"), O = parseFloat(l.dataset.startScale || l.dataset.scale || "1"), k = parseFloat(l.dataset.imageWidth || "0"), D = parseFloat(l.dataset.imageHeight || "0");
|
|
3477
|
+
if (this.callbacks.onEntryStart && h) {
|
|
3478
|
+
const S = {
|
|
3479
|
+
element: l,
|
|
3480
|
+
index: g,
|
|
3481
|
+
totalImages: this.imageLayouts.length,
|
|
3482
|
+
layout: h,
|
|
3483
|
+
from: { x: y, y: x, rotation: T, scale: O },
|
|
3484
|
+
to: { x: w, y: F, rotation: R, scale: M },
|
|
3485
|
+
startTime: I,
|
|
3486
|
+
duration: b.duration
|
|
3487
|
+
};
|
|
3488
|
+
this.callbacks.onEntryStart(S);
|
|
3489
|
+
}
|
|
3490
|
+
if (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)
|
|
3447
3491
|
le({
|
|
3448
3492
|
element: l,
|
|
3449
|
-
startPosition:
|
|
3450
|
-
endPosition:
|
|
3493
|
+
startPosition: { x: y, y: x },
|
|
3494
|
+
endPosition: { x: w, y: F },
|
|
3451
3495
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3452
|
-
duration:
|
|
3453
|
-
imageWidth:
|
|
3454
|
-
imageHeight:
|
|
3455
|
-
rotation:
|
|
3456
|
-
scale:
|
|
3496
|
+
duration: b.duration,
|
|
3497
|
+
imageWidth: k,
|
|
3498
|
+
imageHeight: D,
|
|
3499
|
+
rotation: R,
|
|
3500
|
+
scale: M,
|
|
3457
3501
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3458
|
-
startRotation:
|
|
3502
|
+
startRotation: T,
|
|
3459
3503
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3460
|
-
startScale:
|
|
3504
|
+
startScale: O,
|
|
3505
|
+
onProgress: this.callbacks.onEntryProgress && h ? (S, _, $) => {
|
|
3506
|
+
const A = {
|
|
3507
|
+
element: l,
|
|
3508
|
+
index: g,
|
|
3509
|
+
totalImages: this.imageLayouts.length,
|
|
3510
|
+
layout: h,
|
|
3511
|
+
from: { x: y, y: x, rotation: T, scale: O },
|
|
3512
|
+
to: { x: w, y: F, rotation: R, scale: M },
|
|
3513
|
+
startTime: I,
|
|
3514
|
+
duration: b.duration,
|
|
3515
|
+
progress: S,
|
|
3516
|
+
rawProgress: S,
|
|
3517
|
+
elapsed: _,
|
|
3518
|
+
current: $
|
|
3519
|
+
};
|
|
3520
|
+
this.callbacks.onEntryProgress(A);
|
|
3521
|
+
} : void 0,
|
|
3522
|
+
onComplete: h ? () => {
|
|
3523
|
+
if (this.callbacks.onEntryComplete) {
|
|
3524
|
+
const S = {
|
|
3525
|
+
element: l,
|
|
3526
|
+
index: g,
|
|
3527
|
+
layout: h,
|
|
3528
|
+
startTime: I,
|
|
3529
|
+
endTime: performance.now(),
|
|
3530
|
+
duration: b.duration
|
|
3531
|
+
};
|
|
3532
|
+
this.callbacks.onEntryComplete(S);
|
|
3533
|
+
}
|
|
3534
|
+
} : void 0
|
|
3461
3535
|
});
|
|
3462
|
-
|
|
3463
|
-
const
|
|
3464
|
-
l.style.transform =
|
|
3536
|
+
else {
|
|
3537
|
+
const S = l.dataset.finalTransform || "";
|
|
3538
|
+
if (l.style.transform = S, this.callbacks.onEntryComplete && h) {
|
|
3539
|
+
const _ = ($) => {
|
|
3540
|
+
if ($.propertyName !== "transform") return;
|
|
3541
|
+
l.removeEventListener("transitionend", _);
|
|
3542
|
+
const A = {
|
|
3543
|
+
element: l,
|
|
3544
|
+
index: g,
|
|
3545
|
+
layout: h,
|
|
3546
|
+
startTime: I,
|
|
3547
|
+
endTime: performance.now(),
|
|
3548
|
+
duration: b.duration
|
|
3549
|
+
};
|
|
3550
|
+
this.callbacks.onEntryComplete(A);
|
|
3551
|
+
};
|
|
3552
|
+
l.addEventListener("transitionend", _);
|
|
3553
|
+
}
|
|
3465
3554
|
}
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
console.log(`Image ${h} final state:`, {
|
|
3555
|
+
if (this.fullConfig.config.debug?.enabled && g < 3) {
|
|
3556
|
+
const S = l.dataset.finalTransform || "";
|
|
3557
|
+
console.log(`Image ${g} final state:`, {
|
|
3470
3558
|
left: l.style.left,
|
|
3471
3559
|
top: l.style.top,
|
|
3472
3560
|
width: l.style.width,
|
|
3473
3561
|
height: l.style.height,
|
|
3474
3562
|
computedWidth: l.offsetWidth,
|
|
3475
3563
|
computedHeight: l.offsetHeight,
|
|
3476
|
-
transform:
|
|
3564
|
+
transform: S,
|
|
3477
3565
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3478
3566
|
});
|
|
3479
3567
|
}
|
|
3480
3568
|
if (this.idleAnimationEngine) {
|
|
3481
|
-
const
|
|
3482
|
-
this.idleAnimationEngine.register(l,
|
|
3569
|
+
const S = this.entryAnimationEngine.getTiming().duration;
|
|
3570
|
+
this.idleAnimationEngine.register(l, g, this.imageElements.length, S);
|
|
3483
3571
|
}
|
|
3484
|
-
}), r
|
|
3485
|
-
},
|
|
3572
|
+
}), r++, p());
|
|
3573
|
+
}, v = () => {
|
|
3486
3574
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3487
3575
|
for (; this.displayQueue.length > 0; ) {
|
|
3488
3576
|
const l = this.displayQueue.shift();
|
|
3489
|
-
l &&
|
|
3577
|
+
l && E(l);
|
|
3490
3578
|
}
|
|
3491
3579
|
return;
|
|
3492
3580
|
}
|
|
@@ -3497,77 +3585,144 @@ class Ze {
|
|
|
3497
3585
|
}
|
|
3498
3586
|
if (this.displayQueue.length > 0) {
|
|
3499
3587
|
const l = this.displayQueue.shift();
|
|
3500
|
-
l &&
|
|
3588
|
+
l && E(l);
|
|
3501
3589
|
}
|
|
3502
|
-
r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3590
|
+
r >= t.length && this.displayQueue.length === 0 && (this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), m());
|
|
3503
3591
|
}, this.fullConfig.animation.queue.interval);
|
|
3504
3592
|
};
|
|
3505
3593
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3506
|
-
const l = new IntersectionObserver((
|
|
3507
|
-
|
|
3508
|
-
h.isIntersecting && (
|
|
3594
|
+
const l = new IntersectionObserver((g) => {
|
|
3595
|
+
g.forEach((h) => {
|
|
3596
|
+
h.isIntersecting && (v(), l.disconnect());
|
|
3509
3597
|
});
|
|
3510
3598
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3511
3599
|
l.observe(this.containerEl);
|
|
3512
3600
|
} else
|
|
3513
|
-
|
|
3514
|
-
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l,
|
|
3601
|
+
v();
|
|
3602
|
+
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, g) => {
|
|
3515
3603
|
const h = document.createElement("div");
|
|
3516
3604
|
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";
|
|
3517
|
-
const
|
|
3518
|
-
h.style.left = `${
|
|
3519
|
-
})), t.forEach((l,
|
|
3605
|
+
const b = l.x, I = l.y;
|
|
3606
|
+
h.style.left = `${b - 6}px`, h.style.top = `${I - 6}px`, h.title = `Image ${g}: center (${Math.round(b)}, ${Math.round(I)})`, this.containerEl.appendChild(h);
|
|
3607
|
+
})), t.forEach((l, g) => {
|
|
3520
3608
|
const h = document.createElement("img");
|
|
3521
|
-
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(
|
|
3522
|
-
const
|
|
3523
|
-
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${
|
|
3524
|
-
if (this.hoveredImage = { element: h, layout:
|
|
3525
|
-
const
|
|
3526
|
-
st(h, this.fullConfig.styling?.hover, i,
|
|
3609
|
+
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(g), h.dataset.createdFlag = "true";
|
|
3610
|
+
const b = s[g];
|
|
3611
|
+
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${b.x}px`, h.style.top = `${b.y}px`, b.zIndex && (h.style.zIndex = String(b.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
|
|
3612
|
+
if (this.hoveredImage = { element: h, layout: b }, !this.zoomEngine.isInvolved(h)) {
|
|
3613
|
+
const y = h.cachedRenderedWidth;
|
|
3614
|
+
st(h, this.fullConfig.styling?.hover, i, y), et(h, this.hoverClassName);
|
|
3615
|
+
}
|
|
3616
|
+
if (this.callbacks.onImageHover) {
|
|
3617
|
+
const y = { element: h, index: g, url: l, layout: b };
|
|
3618
|
+
this.callbacks.onImageHover(y);
|
|
3527
3619
|
}
|
|
3528
3620
|
}), h.addEventListener("mouseleave", () => {
|
|
3529
3621
|
if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
|
|
3530
|
-
const
|
|
3531
|
-
st(h, this.fullConfig.styling?.default, i,
|
|
3622
|
+
const y = h.cachedRenderedWidth;
|
|
3623
|
+
st(h, this.fullConfig.styling?.default, i, y), pt(h, this.hoverClassName), et(h, this.defaultClassName);
|
|
3532
3624
|
}
|
|
3533
|
-
|
|
3534
|
-
|
|
3625
|
+
if (this.callbacks.onImageUnhover) {
|
|
3626
|
+
const y = { element: h, index: g, url: l, layout: b };
|
|
3627
|
+
this.callbacks.onImageUnhover(y);
|
|
3628
|
+
}
|
|
3629
|
+
}), h.addEventListener("click", (y) => {
|
|
3630
|
+
y.stopPropagation(), this.handleImageClick(h, b);
|
|
3535
3631
|
}), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
|
|
3536
3632
|
if (n !== this.loadGeneration)
|
|
3537
3633
|
return;
|
|
3538
|
-
const
|
|
3539
|
-
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${
|
|
3540
|
-
const
|
|
3541
|
-
|
|
3542
|
-
|
|
3634
|
+
const y = h.naturalWidth / h.naturalHeight, x = i * y;
|
|
3635
|
+
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${g}] Called with imageHeight=${i}, renderedWidth=${x}`), h.style.width = `${x}px`, h.cachedRenderedWidth = x, h.aspectRatio = y, st(h, this.fullConfig.styling?.default, i, x);
|
|
3636
|
+
const w = { x: b.x, y: b.y }, F = { width: x, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
|
|
3637
|
+
w,
|
|
3638
|
+
F,
|
|
3543
3639
|
e,
|
|
3544
|
-
|
|
3640
|
+
g,
|
|
3545
3641
|
t.length
|
|
3546
|
-
),
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3642
|
+
), M = this.entryAnimationEngine.calculateStartRotation(b.rotation), T = this.entryAnimationEngine.calculateStartScale(b.scale), O = this.entryAnimationEngine.buildFinalTransform(
|
|
3643
|
+
b.rotation,
|
|
3644
|
+
b.scale,
|
|
3645
|
+
x,
|
|
3550
3646
|
i
|
|
3551
|
-
),
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3647
|
+
), k = this.entryAnimationEngine.buildStartTransform(
|
|
3648
|
+
R,
|
|
3649
|
+
w,
|
|
3650
|
+
b.rotation,
|
|
3651
|
+
b.scale,
|
|
3652
|
+
x,
|
|
3557
3653
|
i,
|
|
3558
|
-
|
|
3559
|
-
|
|
3654
|
+
M,
|
|
3655
|
+
T
|
|
3560
3656
|
);
|
|
3561
|
-
this.fullConfig.config.debug?.enabled &&
|
|
3562
|
-
finalPosition:
|
|
3563
|
-
imageSize:
|
|
3564
|
-
left:
|
|
3565
|
-
top:
|
|
3566
|
-
finalTransform:
|
|
3567
|
-
renderedWidth:
|
|
3657
|
+
if (this.fullConfig.config.debug?.enabled && g < 3 && console.log(`Image ${g}:`, {
|
|
3658
|
+
finalPosition: w,
|
|
3659
|
+
imageSize: F,
|
|
3660
|
+
left: b.x,
|
|
3661
|
+
top: b.y,
|
|
3662
|
+
finalTransform: O,
|
|
3663
|
+
renderedWidth: x,
|
|
3568
3664
|
renderedHeight: i
|
|
3569
|
-
}), h.style.transform =
|
|
3570
|
-
|
|
3665
|
+
}), h.style.transform = k, h.dataset.finalTransform = O, h.dataset.startX = String(R.x), h.dataset.startY = String(R.y), h.dataset.endX = String(w.x), h.dataset.endY = String(w.y), h.dataset.imageWidth = String(x), h.dataset.imageHeight = String(i), h.dataset.rotation = String(b.rotation), h.dataset.scale = String(b.scale), h.dataset.startRotation = String(M), h.dataset.startScale = String(T), a++, this.callbacks.onImageLoaded) {
|
|
3666
|
+
const D = {
|
|
3667
|
+
element: h,
|
|
3668
|
+
url: l,
|
|
3669
|
+
index: g,
|
|
3670
|
+
totalImages: t.length,
|
|
3671
|
+
loadTime: performance.now() - (f.get(g) ?? performance.now())
|
|
3672
|
+
};
|
|
3673
|
+
this.callbacks.onImageLoaded(D);
|
|
3674
|
+
}
|
|
3675
|
+
if (this.callbacks.onLoadProgress) {
|
|
3676
|
+
const D = {
|
|
3677
|
+
loaded: a,
|
|
3678
|
+
failed: c,
|
|
3679
|
+
total: t.length,
|
|
3680
|
+
percent: (a + c) / t.length * 100
|
|
3681
|
+
};
|
|
3682
|
+
this.callbacks.onLoadProgress(D);
|
|
3683
|
+
}
|
|
3684
|
+
this.displayQueue.push(h);
|
|
3685
|
+
};
|
|
3686
|
+
const I = () => {
|
|
3687
|
+
if (n === this.loadGeneration) {
|
|
3688
|
+
if (c++, this.callbacks.onImageError) {
|
|
3689
|
+
const y = { url: l, index: g, totalImages: t.length };
|
|
3690
|
+
this.callbacks.onImageError(y);
|
|
3691
|
+
}
|
|
3692
|
+
if (this.callbacks.onLoadProgress) {
|
|
3693
|
+
const y = {
|
|
3694
|
+
loaded: a,
|
|
3695
|
+
failed: c,
|
|
3696
|
+
total: t.length,
|
|
3697
|
+
percent: (a + c) / t.length * 100
|
|
3698
|
+
};
|
|
3699
|
+
this.callbacks.onLoadProgress(y);
|
|
3700
|
+
}
|
|
3701
|
+
r++, p();
|
|
3702
|
+
}
|
|
3703
|
+
};
|
|
3704
|
+
h.onerror = () => I(), (async () => {
|
|
3705
|
+
let y = l;
|
|
3706
|
+
if (this.callbacks.onBeforeImageLoad) {
|
|
3707
|
+
const x = { url: l, index: g, totalImages: t.length }, w = await this.callbacks.onBeforeImageLoad(x);
|
|
3708
|
+
if (w)
|
|
3709
|
+
if (w.fetch !== void 0) {
|
|
3710
|
+
const F = w.url ?? l;
|
|
3711
|
+
try {
|
|
3712
|
+
const M = await (await fetch(F, w.fetch)).blob(), T = URL.createObjectURL(M);
|
|
3713
|
+
y = T;
|
|
3714
|
+
const O = h.onload;
|
|
3715
|
+
h.onload = (k) => {
|
|
3716
|
+
URL.revokeObjectURL(T), O?.call(h, k);
|
|
3717
|
+
};
|
|
3718
|
+
} catch {
|
|
3719
|
+
I();
|
|
3720
|
+
return;
|
|
3721
|
+
}
|
|
3722
|
+
} else w.url && (y = w.url);
|
|
3723
|
+
}
|
|
3724
|
+
d === 0 && (d = performance.now()), f.set(g, performance.now()), h.src = y;
|
|
3725
|
+
})();
|
|
3571
3726
|
});
|
|
3572
3727
|
}
|
|
3573
3728
|
async handleImageClick(t, i) {
|
|
@@ -3581,7 +3736,15 @@ class Ze {
|
|
|
3581
3736
|
else {
|
|
3582
3737
|
this.idleAnimationEngine?.pauseForImage(t);
|
|
3583
3738
|
const s = t.dataset.imageId;
|
|
3584
|
-
this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator()
|
|
3739
|
+
if (this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator(), this.callbacks.onImageFocus && this.currentFocusIndex !== null) {
|
|
3740
|
+
const r = this.imageLoader.imageURLs(), a = {
|
|
3741
|
+
element: t,
|
|
3742
|
+
index: this.currentFocusIndex,
|
|
3743
|
+
url: r[this.currentFocusIndex] ?? "",
|
|
3744
|
+
layout: i
|
|
3745
|
+
};
|
|
3746
|
+
this.callbacks.onImageFocus(a);
|
|
3747
|
+
}
|
|
3585
3748
|
}
|
|
3586
3749
|
}
|
|
3587
3750
|
/**
|