@frybynite/image-cloud 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/image-cloud-auto-init.js +488 -441
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +508 -459
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +42 -2
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +56 -29
- package/package.json +1 -1
package/dist/image-cloud.js
CHANGED
|
@@ -4,26 +4,26 @@ const St = Object.freeze({
|
|
|
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
|
+
}), Tt = 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 })
|
|
11
|
-
}),
|
|
11
|
+
}), Mt = Object.freeze({
|
|
12
12
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
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
|
+
}), zt = 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 }),
|
|
20
20
|
flutter: Object.freeze({ amplitude: 20, frequency: 4, decay: !0, decayRate: 0.5, phase: 0 })
|
|
21
21
|
}), It = Object.freeze({
|
|
22
22
|
type: "linear"
|
|
23
|
-
}), Rt = Object.freeze({
|
|
24
|
-
mode: "none"
|
|
25
23
|
}), Et = Object.freeze({
|
|
26
24
|
mode: "none"
|
|
25
|
+
}), Rt = Object.freeze({
|
|
26
|
+
mode: "none"
|
|
27
27
|
}), Lt = Object.freeze({
|
|
28
28
|
default: Object.freeze({
|
|
29
29
|
border: Object.freeze({
|
|
@@ -57,23 +57,29 @@ const St = Object.freeze({
|
|
|
57
57
|
synchronization: "offset"
|
|
58
58
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
59
59
|
}), _t = Object.freeze({
|
|
60
|
-
|
|
60
|
+
mobile: Object.freeze({ maxWidth: 767 }),
|
|
61
|
+
tablet: Object.freeze({ maxWidth: 1199 })
|
|
62
|
+
}), jt = Object.freeze({
|
|
63
|
+
mode: "adaptive",
|
|
64
|
+
// Default to adaptive sizing
|
|
65
|
+
minSize: 50,
|
|
66
|
+
// Adaptive mode minimum
|
|
67
|
+
maxSize: 400,
|
|
68
|
+
// Adaptive mode maximum
|
|
61
69
|
variance: Object.freeze({
|
|
62
70
|
min: 1,
|
|
63
71
|
// No variance by default
|
|
64
72
|
max: 1
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
// No decay by default
|
|
68
|
-
}), jt = Object.freeze({
|
|
73
|
+
})
|
|
74
|
+
}), Wt = Object.freeze({
|
|
69
75
|
mode: "none",
|
|
70
76
|
range: Object.freeze({
|
|
71
77
|
min: -15,
|
|
72
78
|
max: 15
|
|
73
79
|
})
|
|
74
80
|
}), $t = Object.freeze({
|
|
75
|
-
sizing:
|
|
76
|
-
rotation:
|
|
81
|
+
sizing: jt,
|
|
82
|
+
rotation: Wt
|
|
77
83
|
}), b = Object.freeze({
|
|
78
84
|
// Unified loader configuration
|
|
79
85
|
loader: Object.freeze({
|
|
@@ -103,26 +109,9 @@ const St = Object.freeze({
|
|
|
103
109
|
// Pattern-based layout configuration
|
|
104
110
|
layout: Object.freeze({
|
|
105
111
|
algorithm: "radial",
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
responsive: [
|
|
110
|
-
{ minWidth: 1200, height: 225 },
|
|
111
|
-
// Large screens
|
|
112
|
-
{ minWidth: 768, height: 180 },
|
|
113
|
-
// Tablet / Small desktop
|
|
114
|
-
{ minWidth: 0, height: 100 }
|
|
115
|
-
// Mobile / Default
|
|
116
|
-
],
|
|
117
|
-
adaptive: Object.freeze({
|
|
118
|
-
enabled: !0,
|
|
119
|
-
// Enable adaptive sizing by default
|
|
120
|
-
minSize: 50,
|
|
121
|
-
// Minimum 50px image height
|
|
122
|
-
maxSize: 400
|
|
123
|
-
// Maximum 400px image height
|
|
124
|
-
})
|
|
125
|
-
}),
|
|
112
|
+
scaleDecay: 0,
|
|
113
|
+
// No decay by default (0-1 for radial/spiral)
|
|
114
|
+
responsive: _t,
|
|
126
115
|
targetCoverage: 0.6,
|
|
127
116
|
// Target 60% of container area
|
|
128
117
|
densityFactor: 1,
|
|
@@ -183,8 +172,8 @@ const St = Object.freeze({
|
|
|
183
172
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
|
|
184
173
|
// smooth deceleration
|
|
185
174
|
path: It,
|
|
186
|
-
rotation:
|
|
187
|
-
scale:
|
|
175
|
+
rotation: Et,
|
|
176
|
+
scale: Rt
|
|
188
177
|
})
|
|
189
178
|
}),
|
|
190
179
|
// Pattern-based interaction configuration
|
|
@@ -252,7 +241,7 @@ function rt(n, t) {
|
|
|
252
241
|
const e = { ...n };
|
|
253
242
|
return t.border !== void 0 && (e.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (e.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (e.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (e.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (e.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (e.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (e.outline = { ...n.outline, ...t.outline }), t.shadow !== void 0 && (e.shadow = t.shadow), t.opacity !== void 0 && (e.opacity = t.opacity), t.cursor !== void 0 && (e.cursor = t.cursor), t.className !== void 0 && (e.className = t.className), t.objectFit !== void 0 && (e.objectFit = t.objectFit), t.aspectRatio !== void 0 && (e.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (e.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (e.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (e.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (e.borderRadiusBottomLeft = t.borderRadiusBottomLeft), e;
|
|
254
243
|
}
|
|
255
|
-
function
|
|
244
|
+
function kt(n, t) {
|
|
256
245
|
if (!t) return { ...n };
|
|
257
246
|
const e = rt(n.default, t.default), i = rt(
|
|
258
247
|
rt(e, n.hover),
|
|
@@ -267,27 +256,27 @@ function Gt(n, t) {
|
|
|
267
256
|
focused: o
|
|
268
257
|
};
|
|
269
258
|
}
|
|
270
|
-
function
|
|
271
|
-
var i, o, s, c, a, h, l,
|
|
259
|
+
function Gt(n, t) {
|
|
260
|
+
var i, o, s, c, a, h, l, u;
|
|
272
261
|
if (!t) return { ...n };
|
|
273
262
|
const e = { ...n };
|
|
274
263
|
if (t.sizing !== void 0 && (e.sizing = {
|
|
275
264
|
...n.sizing,
|
|
276
265
|
...t.sizing
|
|
277
266
|
}, t.sizing.variance)) {
|
|
278
|
-
const r = t.sizing.variance, d = r.min !== void 0 && r.min
|
|
267
|
+
const r = t.sizing.variance, d = r.min !== void 0 && r.min >= 0.25 && r.min <= 1 ? r.min : ((o = (i = n.sizing) == null ? void 0 : i.variance) == null ? void 0 : o.min) ?? 1, f = r.max !== void 0 && r.max >= 1 && r.max <= 1.75 ? r.max : ((c = (s = n.sizing) == null ? void 0 : s.variance) == null ? void 0 : c.max) ?? 1;
|
|
279
268
|
e.sizing.variance = { min: d, max: f };
|
|
280
269
|
}
|
|
281
270
|
if (t.rotation !== void 0 && (e.rotation = {
|
|
282
271
|
...n.rotation,
|
|
283
272
|
...t.rotation
|
|
284
273
|
}, t.rotation.range)) {
|
|
285
|
-
const r = t.rotation.range, d = r.min !== void 0 && r.min >= -180 && r.min <= 0 ? r.min : ((h = (a = n.rotation) == null ? void 0 : a.range) == null ? void 0 : h.min) ?? -15, f = r.max !== void 0 && r.max >= 0 && r.max <= 180 ? r.max : ((
|
|
274
|
+
const r = t.rotation.range, d = r.min !== void 0 && r.min >= -180 && r.min <= 0 ? r.min : ((h = (a = n.rotation) == null ? void 0 : a.range) == null ? void 0 : h.min) ?? -15, f = r.max !== void 0 && r.max >= 0 && r.max <= 180 ? r.max : ((u = (l = n.rotation) == null ? void 0 : l.range) == null ? void 0 : u.max) ?? 15;
|
|
286
275
|
e.rotation.range = { min: d, max: f };
|
|
287
276
|
}
|
|
288
277
|
return e;
|
|
289
278
|
}
|
|
290
|
-
function
|
|
279
|
+
function Nt(n) {
|
|
291
280
|
var e;
|
|
292
281
|
const t = (e = n.layout) == null ? void 0 : e.rotation;
|
|
293
282
|
if (t && "enabled" in t)
|
|
@@ -298,19 +287,21 @@ function Wt(n) {
|
|
|
298
287
|
}
|
|
299
288
|
};
|
|
300
289
|
}
|
|
301
|
-
function
|
|
290
|
+
function qt(n) {
|
|
302
291
|
var e, i;
|
|
303
292
|
const t = (i = (e = n.layout) == null ? void 0 : e.sizing) == null ? void 0 : i.variance;
|
|
304
293
|
if (t)
|
|
305
294
|
return {
|
|
306
295
|
sizing: {
|
|
296
|
+
mode: "adaptive",
|
|
297
|
+
// Legacy variance config implies adaptive mode
|
|
307
298
|
variance: t
|
|
308
299
|
}
|
|
309
300
|
};
|
|
310
301
|
}
|
|
311
|
-
function
|
|
302
|
+
function Yt(n = {}) {
|
|
312
303
|
var s;
|
|
313
|
-
const t =
|
|
304
|
+
const t = Nt(n), e = qt(n);
|
|
314
305
|
let i = n.image;
|
|
315
306
|
(t || e) && (i = {
|
|
316
307
|
...e || {},
|
|
@@ -322,12 +313,12 @@ function qt(n = {}) {
|
|
|
322
313
|
}));
|
|
323
314
|
const o = {
|
|
324
315
|
loader: { ...b.loader },
|
|
325
|
-
image:
|
|
316
|
+
image: Gt($t, i),
|
|
326
317
|
layout: { ...b.layout },
|
|
327
318
|
animation: { ...b.animation },
|
|
328
319
|
interaction: { ...b.interaction },
|
|
329
320
|
rendering: { ...b.rendering },
|
|
330
|
-
styling:
|
|
321
|
+
styling: kt(Lt, n.styling),
|
|
331
322
|
debug: b.debug
|
|
332
323
|
};
|
|
333
324
|
return n.loader && (o.loader = {
|
|
@@ -346,11 +337,10 @@ function qt(n = {}) {
|
|
|
346
337
|
})), n.layout && (o.layout = {
|
|
347
338
|
...b.layout,
|
|
348
339
|
...n.layout
|
|
349
|
-
}, n.layout.
|
|
350
|
-
...b.layout.
|
|
351
|
-
...n.layout.
|
|
352
|
-
|
|
353
|
-
adaptive: n.layout.sizing.adaptive ? { ...b.layout.sizing.adaptive, ...n.layout.sizing.adaptive } : b.layout.sizing.adaptive
|
|
340
|
+
}, n.layout.responsive && (o.layout.responsive = {
|
|
341
|
+
...b.layout.responsive,
|
|
342
|
+
mobile: n.layout.responsive.mobile ? { ...b.layout.responsive.mobile, ...n.layout.responsive.mobile } : b.layout.responsive.mobile,
|
|
343
|
+
tablet: n.layout.responsive.tablet ? { ...b.layout.responsive.tablet, ...n.layout.responsive.tablet } : b.layout.responsive.tablet
|
|
354
344
|
}), n.layout.spacing && (o.layout.spacing = {
|
|
355
345
|
...b.layout.spacing,
|
|
356
346
|
...n.layout.spacing
|
|
@@ -376,8 +366,8 @@ function qt(n = {}) {
|
|
|
376
366
|
} : b.animation.entry.start,
|
|
377
367
|
timing: n.animation.entry.timing ? { ...b.animation.entry.timing, ...n.animation.entry.timing } : b.animation.entry.timing,
|
|
378
368
|
path: n.animation.entry.path ? { ...It, ...n.animation.entry.path } : b.animation.entry.path,
|
|
379
|
-
rotation: n.animation.entry.rotation ? { ...
|
|
380
|
-
scale: n.animation.entry.scale ? { ...
|
|
369
|
+
rotation: n.animation.entry.rotation ? { ...Et, ...n.animation.entry.rotation } : b.animation.entry.rotation,
|
|
370
|
+
scale: n.animation.entry.scale ? { ...Rt, ...n.animation.entry.scale } : b.animation.entry.scale
|
|
381
371
|
})), n.interaction && (o.interaction = {
|
|
382
372
|
...b.interaction,
|
|
383
373
|
...n.interaction
|
|
@@ -406,16 +396,16 @@ function qt(n = {}) {
|
|
|
406
396
|
...n.rendering.performance
|
|
407
397
|
})), n.debug !== void 0 && (o.debug = n.debug), o;
|
|
408
398
|
}
|
|
409
|
-
function
|
|
410
|
-
return { ...n ?
|
|
399
|
+
function Bt(n, t) {
|
|
400
|
+
return { ...n ? Tt[n] : Tt.playful, ...t };
|
|
411
401
|
}
|
|
412
402
|
function Xt(n, t) {
|
|
413
|
-
return { ...n ? Tt[n] : Tt.gentle, ...t };
|
|
414
|
-
}
|
|
415
|
-
function Bt(n, t) {
|
|
416
403
|
return { ...n ? Mt[n] : Mt.gentle, ...t };
|
|
417
404
|
}
|
|
418
|
-
|
|
405
|
+
function Vt(n, t) {
|
|
406
|
+
return { ...n ? zt[n] : zt.gentle, ...t };
|
|
407
|
+
}
|
|
408
|
+
class Jt {
|
|
419
409
|
constructor(t) {
|
|
420
410
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
421
411
|
}
|
|
@@ -444,7 +434,7 @@ class Vt {
|
|
|
444
434
|
this.cancelAllAnimations(t);
|
|
445
435
|
const c = o ?? this.config.duration, a = s ?? this.config.easing.default, h = this.buildTransformString(e), l = this.buildTransformString(i);
|
|
446
436
|
t.style.transition = "none";
|
|
447
|
-
const
|
|
437
|
+
const u = t.animate(
|
|
448
438
|
[
|
|
449
439
|
{ transform: h },
|
|
450
440
|
{ transform: l }
|
|
@@ -458,13 +448,13 @@ class Vt {
|
|
|
458
448
|
), r = {
|
|
459
449
|
id: `anim-${++this.animationIdCounter}`,
|
|
460
450
|
element: t,
|
|
461
|
-
animation:
|
|
451
|
+
animation: u,
|
|
462
452
|
fromState: e,
|
|
463
453
|
toState: i,
|
|
464
454
|
startTime: performance.now(),
|
|
465
455
|
duration: c
|
|
466
456
|
};
|
|
467
|
-
return this.activeAnimations.set(t, r),
|
|
457
|
+
return this.activeAnimations.set(t, r), u.finished.then(() => {
|
|
468
458
|
t.style.transform = l, this.activeAnimations.delete(t);
|
|
469
459
|
}).catch(() => {
|
|
470
460
|
this.activeAnimations.delete(t);
|
|
@@ -574,31 +564,31 @@ class Vt {
|
|
|
574
564
|
function st(n, t, e) {
|
|
575
565
|
return n + (t - n) * e;
|
|
576
566
|
}
|
|
577
|
-
function
|
|
578
|
-
const { overshoot: o, bounces: s, decayRatio: c } = i, a = e.x - t.x, h = e.y - t.y, l =
|
|
579
|
-
let
|
|
580
|
-
for (let
|
|
581
|
-
if (n <= l[
|
|
582
|
-
r =
|
|
567
|
+
function Zt(n, t, e, i) {
|
|
568
|
+
const { overshoot: o, bounces: s, decayRatio: c } = i, a = e.x - t.x, h = e.y - t.y, l = Kt(s, c);
|
|
569
|
+
let u = 0, r = 0, d = 1, f = o, y = !1;
|
|
570
|
+
for (let g = 0; g < l.length; g++)
|
|
571
|
+
if (n <= l[g].time) {
|
|
572
|
+
r = g === 0 ? 0 : l[g - 1].time, d = l[g].time, f = l[g].overshoot, y = l[g].isOvershoot;
|
|
583
573
|
break;
|
|
584
574
|
}
|
|
585
575
|
const p = (n - r) / (d - r);
|
|
586
576
|
if (y)
|
|
587
|
-
|
|
577
|
+
u = 1 + f * gt(p);
|
|
588
578
|
else if (r === 0)
|
|
589
|
-
|
|
579
|
+
u = gt(p);
|
|
590
580
|
else {
|
|
591
|
-
const
|
|
592
|
-
(
|
|
593
|
-
), m = 1 + ((
|
|
594
|
-
|
|
581
|
+
const g = l.find(
|
|
582
|
+
(v, w) => v.time > r && w > 0 && l[w - 1].isOvershoot
|
|
583
|
+
), m = 1 + ((g == null ? void 0 : g.overshoot) || f);
|
|
584
|
+
u = st(m, 1, gt(p));
|
|
595
585
|
}
|
|
596
586
|
return {
|
|
597
|
-
x: t.x + a *
|
|
598
|
-
y: t.y + h *
|
|
587
|
+
x: t.x + a * u,
|
|
588
|
+
y: t.y + h * u
|
|
599
589
|
};
|
|
600
590
|
}
|
|
601
|
-
function
|
|
591
|
+
function Kt(n, t) {
|
|
602
592
|
const e = [];
|
|
603
593
|
let i = 0.6;
|
|
604
594
|
e.push({ time: i, overshoot: 0, isOvershoot: !1 });
|
|
@@ -609,56 +599,56 @@ function Zt(n, t) {
|
|
|
609
599
|
return e.push({ time: 1, overshoot: 0, isOvershoot: !1 }), e;
|
|
610
600
|
}
|
|
611
601
|
function Qt(n, t, e, i) {
|
|
612
|
-
const { stiffness: o, damping: s, mass: c, oscillations: a } = i, h = e.x - t.x, l = e.y - t.y,
|
|
602
|
+
const { stiffness: o, damping: s, mass: c, oscillations: a } = i, h = e.x - t.x, l = e.y - t.y, u = Math.sqrt(o / c), r = s / (2 * Math.sqrt(o * c));
|
|
613
603
|
let d;
|
|
614
604
|
if (r < 1) {
|
|
615
|
-
const f =
|
|
605
|
+
const f = u * Math.sqrt(1 - r * r), y = Math.exp(-r * u * n * 3), p = Math.cos(f * n * a * Math.PI);
|
|
616
606
|
d = 1 - y * p;
|
|
617
607
|
} else
|
|
618
|
-
d = 1 - Math.exp(-
|
|
608
|
+
d = 1 - Math.exp(-u * n * 3);
|
|
619
609
|
return d = Math.max(0, Math.min(d, 1.3)), {
|
|
620
610
|
x: t.x + h * d,
|
|
621
611
|
y: t.y + l * d
|
|
622
612
|
};
|
|
623
613
|
}
|
|
624
|
-
function
|
|
625
|
-
const { amplitude: o, frequency: s, decay: c, decayRate: a, phase: h } = i, l = e.x - t.x,
|
|
614
|
+
function te(n, t, e, i) {
|
|
615
|
+
const { amplitude: o, frequency: s, decay: c, decayRate: a, phase: h } = i, l = e.x - t.x, u = e.y - t.y, r = Math.sqrt(l * l + u * u), d = r > 0 ? -u / r : 0, f = r > 0 ? l / r : 1, y = s * Math.PI * 2 * n + h, p = c ? Math.pow(1 - n, a) : 1, g = o * Math.sin(y) * p, m = ee(n);
|
|
626
616
|
return {
|
|
627
|
-
x: st(t.x, e.x, m) +
|
|
628
|
-
y: st(t.y, e.y, m) +
|
|
617
|
+
x: st(t.x, e.x, m) + g * d,
|
|
618
|
+
y: st(t.y, e.y, m) + g * f
|
|
629
619
|
};
|
|
630
620
|
}
|
|
631
|
-
function
|
|
621
|
+
function gt(n) {
|
|
632
622
|
return 1 - (1 - n) * (1 - n);
|
|
633
623
|
}
|
|
634
|
-
function
|
|
624
|
+
function ee(n) {
|
|
635
625
|
return 1 - Math.pow(1 - n, 3);
|
|
636
626
|
}
|
|
637
|
-
function
|
|
627
|
+
function ie(n, t, e) {
|
|
638
628
|
const { amplitude: i, frequency: o, decay: s } = e, c = Math.sin(n * o * Math.PI * 2), a = s ? Math.pow(1 - n, 2) : 1, h = i * c * a;
|
|
639
629
|
return t + h;
|
|
640
630
|
}
|
|
641
|
-
function
|
|
631
|
+
function ne(n, t, e) {
|
|
642
632
|
const { overshoot: i, bounces: o } = e, s = [];
|
|
643
633
|
s.push({ time: 0.5, scale: i });
|
|
644
634
|
let c = i;
|
|
645
635
|
const a = 0.5, l = 0.5 / (o * 2);
|
|
646
|
-
let
|
|
636
|
+
let u = 0.5;
|
|
647
637
|
for (let d = 0; d < o; d++) {
|
|
648
638
|
const f = 1 - (c - 1) * a;
|
|
649
|
-
|
|
639
|
+
u += l, s.push({ time: u, scale: f }), c = 1 + (c - 1) * a * a, u += l, d < o - 1 && s.push({ time: u, scale: c });
|
|
650
640
|
}
|
|
651
641
|
s.push({ time: 1, scale: 1 });
|
|
652
642
|
let r = 1;
|
|
653
643
|
for (let d = 0; d < s.length; d++)
|
|
654
644
|
if (n <= s[d].time) {
|
|
655
|
-
const f = d === 0 ? 0 : s[d - 1].time, y = d === 0 ? 1 : s[d - 1].scale, p = (n - f) / (s[d].time - f),
|
|
656
|
-
r = y + (s[d].scale - y) *
|
|
645
|
+
const f = d === 0 ? 0 : s[d - 1].time, y = d === 0 ? 1 : s[d - 1].scale, p = (n - f) / (s[d].time - f), g = gt(p);
|
|
646
|
+
r = y + (s[d].scale - y) * g;
|
|
657
647
|
break;
|
|
658
648
|
}
|
|
659
649
|
return r * t;
|
|
660
650
|
}
|
|
661
|
-
function
|
|
651
|
+
function oe(n) {
|
|
662
652
|
const {
|
|
663
653
|
element: t,
|
|
664
654
|
startPosition: e,
|
|
@@ -669,63 +659,63 @@ function ne(n) {
|
|
|
669
659
|
imageHeight: a,
|
|
670
660
|
rotation: h,
|
|
671
661
|
scale: l,
|
|
672
|
-
onComplete:
|
|
662
|
+
onComplete: u,
|
|
673
663
|
rotationConfig: r,
|
|
674
664
|
startRotation: d,
|
|
675
665
|
scaleConfig: f,
|
|
676
666
|
startScale: y
|
|
677
|
-
} = n, p = o.type,
|
|
678
|
-
if ((p === "linear" || p === "arc") && !
|
|
679
|
-
|
|
667
|
+
} = n, p = o.type, g = d !== void 0 && d !== h, m = (r == null ? void 0 : r.mode) === "wobble", v = (r == null ? void 0 : r.wobble) || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, E = y !== void 0 && y !== l, A = (f == null ? void 0 : f.mode) === "pop", x = (f == null ? void 0 : f.pop) || { overshoot: 1.2, bounces: 1 };
|
|
668
|
+
if ((p === "linear" || p === "arc") && !w && !(E || A)) {
|
|
669
|
+
u && u();
|
|
680
670
|
return;
|
|
681
671
|
}
|
|
682
|
-
const
|
|
683
|
-
function U(
|
|
684
|
-
const F =
|
|
685
|
-
let
|
|
672
|
+
const j = performance.now(), P = -c / 2, D = -a / 2;
|
|
673
|
+
function U(W) {
|
|
674
|
+
const F = W - j, S = Math.min(F / s, 1);
|
|
675
|
+
let T;
|
|
686
676
|
switch (p) {
|
|
687
677
|
case "bounce": {
|
|
688
|
-
const
|
|
678
|
+
const _ = Bt(
|
|
689
679
|
o.bouncePreset,
|
|
690
680
|
o.bounce
|
|
691
681
|
);
|
|
692
|
-
|
|
682
|
+
T = Zt(S, e, i, _);
|
|
693
683
|
break;
|
|
694
684
|
}
|
|
695
685
|
case "elastic": {
|
|
696
|
-
const
|
|
686
|
+
const _ = Xt(
|
|
697
687
|
o.elasticPreset,
|
|
698
688
|
o.elastic
|
|
699
689
|
);
|
|
700
|
-
|
|
690
|
+
T = Qt(S, e, i, _);
|
|
701
691
|
break;
|
|
702
692
|
}
|
|
703
693
|
case "wave": {
|
|
704
|
-
const
|
|
694
|
+
const _ = Vt(
|
|
705
695
|
o.wavePreset,
|
|
706
696
|
o.wave
|
|
707
697
|
);
|
|
708
|
-
|
|
698
|
+
T = te(S, e, i, _);
|
|
709
699
|
break;
|
|
710
700
|
}
|
|
711
701
|
default:
|
|
712
|
-
|
|
713
|
-
x: st(e.x, i.x,
|
|
714
|
-
y: st(e.y, i.y,
|
|
702
|
+
T = {
|
|
703
|
+
x: st(e.x, i.x, S),
|
|
704
|
+
y: st(e.y, i.y, S)
|
|
715
705
|
};
|
|
716
706
|
}
|
|
717
|
-
const
|
|
718
|
-
let
|
|
719
|
-
m ?
|
|
720
|
-
let
|
|
721
|
-
|
|
707
|
+
const $ = T.x - i.x, z = T.y - i.y;
|
|
708
|
+
let R;
|
|
709
|
+
m ? R = ie(S, h, v) : g ? R = st(d, h, S) : R = h;
|
|
710
|
+
let M;
|
|
711
|
+
A ? M = ne(S, l, x) : E ? M = st(y, l, S) : M = l, t.style.transform = `translate(${P}px, ${D}px) translate(${$}px, ${z}px) rotate(${R}deg) scale(${M})`, S < 1 ? requestAnimationFrame(U) : (t.style.transform = `translate(${P}px, ${D}px) rotate(${h}deg) scale(${l})`, u && u());
|
|
722
712
|
}
|
|
723
713
|
requestAnimationFrame(U);
|
|
724
714
|
}
|
|
725
|
-
function
|
|
715
|
+
function se(n) {
|
|
726
716
|
return n === "bounce" || n === "elastic" || n === "wave";
|
|
727
717
|
}
|
|
728
|
-
const
|
|
718
|
+
const ae = {
|
|
729
719
|
radial: "center",
|
|
730
720
|
spiral: "center",
|
|
731
721
|
grid: "top",
|
|
@@ -733,15 +723,15 @@ const se = {
|
|
|
733
723
|
random: "nearest-edge",
|
|
734
724
|
wave: "left"
|
|
735
725
|
};
|
|
736
|
-
class
|
|
726
|
+
class re {
|
|
737
727
|
constructor(t, e) {
|
|
738
|
-
this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || It, this.rotationConfig = t.rotation ||
|
|
728
|
+
this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || It, this.rotationConfig = t.rotation || Et, this.scaleConfig = t.scale || Rt;
|
|
739
729
|
}
|
|
740
730
|
/**
|
|
741
731
|
* Get the effective start position, considering layout-aware defaults
|
|
742
732
|
*/
|
|
743
733
|
resolveStartPosition() {
|
|
744
|
-
return this.config.start.position ? this.config.start.position :
|
|
734
|
+
return this.config.start.position ? this.config.start.position : ae[this.layoutAlgorithm] || "nearest-edge";
|
|
745
735
|
}
|
|
746
736
|
/**
|
|
747
737
|
* Calculate the starting position for an image's entry animation
|
|
@@ -779,7 +769,7 @@ class ae {
|
|
|
779
769
|
* Calculate start position from the nearest edge (current default behavior)
|
|
780
770
|
*/
|
|
781
771
|
calculateNearestEdge(t, e, i, o) {
|
|
782
|
-
const s = t.x, c = t.y, a = s, h = i.width - s, l = c,
|
|
772
|
+
const s = t.x, c = t.y, a = s, h = i.width - s, l = c, u = i.height - c, r = Math.min(a, h, l, u);
|
|
783
773
|
let d = t.x, f = t.y;
|
|
784
774
|
return r === a ? d = -(e.width + o) : r === h ? d = i.width + o : r === l ? f = -(e.height + o) : f = i.height + o, { x: d, y: f };
|
|
785
775
|
}
|
|
@@ -837,9 +827,9 @@ class ae {
|
|
|
837
827
|
) * p / 2;
|
|
838
828
|
} else
|
|
839
829
|
h = typeof l == "number" ? l : 500;
|
|
840
|
-
let
|
|
841
|
-
a === "even" ?
|
|
842
|
-
const r = i.width / 2, d = i.height / 2, f = r + Math.cos(
|
|
830
|
+
let u;
|
|
831
|
+
a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
832
|
+
const r = i.width / 2, d = i.height / 2, f = r + Math.cos(u) * h, y = d + Math.sin(u) * h;
|
|
843
833
|
return { x: f, y };
|
|
844
834
|
}
|
|
845
835
|
/**
|
|
@@ -860,8 +850,8 @@ class ae {
|
|
|
860
850
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
861
851
|
*/
|
|
862
852
|
buildStartTransform(t, e, i, o, s, c, a, h) {
|
|
863
|
-
const l = t.x - e.x,
|
|
864
|
-
return t.useScale ? `${p} translate(${l}px, ${
|
|
853
|
+
const l = t.x - e.x, u = t.y - e.y, r = a !== void 0 ? a : i, d = h !== void 0 ? h : o, f = s !== void 0 ? -s / 2 : 0, y = c !== void 0 ? -c / 2 : 0, p = s !== void 0 ? `translate(${f}px, ${y}px)` : "translate(-50%, -50%)";
|
|
854
|
+
return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${r}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${r}deg) scale(${d})`;
|
|
865
855
|
}
|
|
866
856
|
/**
|
|
867
857
|
* Build the final CSS transform string
|
|
@@ -886,7 +876,7 @@ class ae {
|
|
|
886
876
|
* Check if the current path type requires JavaScript animation
|
|
887
877
|
*/
|
|
888
878
|
requiresJSAnimation() {
|
|
889
|
-
return
|
|
879
|
+
return se(this.pathConfig.type);
|
|
890
880
|
}
|
|
891
881
|
/**
|
|
892
882
|
* Get the path configuration
|
|
@@ -1049,8 +1039,8 @@ class ae {
|
|
|
1049
1039
|
let a = e;
|
|
1050
1040
|
for (let h = 0; h < c.length; h++)
|
|
1051
1041
|
if (t <= c[h].time) {
|
|
1052
|
-
const l = h === 0 ? 0 : c[h - 1].time,
|
|
1053
|
-
a =
|
|
1042
|
+
const l = h === 0 ? 0 : c[h - 1].time, u = h === 0 ? e : c[h - 1].scale, r = (t - l) / (c[h].time - l), d = this.easeOutQuad(r);
|
|
1043
|
+
a = u + (c[h].scale - u) * d;
|
|
1054
1044
|
break;
|
|
1055
1045
|
}
|
|
1056
1046
|
return a * e;
|
|
@@ -1065,8 +1055,8 @@ class ae {
|
|
|
1065
1055
|
const s = 0.5, a = 0.5 / (t * 2);
|
|
1066
1056
|
let h = 0.5;
|
|
1067
1057
|
for (let l = 0; l < t; l++) {
|
|
1068
|
-
const
|
|
1069
|
-
h += a, i.push({ time: h, scale:
|
|
1058
|
+
const u = 1 - (o - 1) * s;
|
|
1059
|
+
h += a, i.push({ time: h, scale: u }), o = 1 + (o - 1) * s * s, h += a, l < t - 1 && i.push({ time: h, scale: o });
|
|
1070
1060
|
}
|
|
1071
1061
|
return i.push({ time: 1, scale: 1 }), i;
|
|
1072
1062
|
}
|
|
@@ -1077,7 +1067,7 @@ class ae {
|
|
|
1077
1067
|
return 1 - (1 - t) * (1 - t);
|
|
1078
1068
|
}
|
|
1079
1069
|
}
|
|
1080
|
-
class
|
|
1070
|
+
class ce {
|
|
1081
1071
|
constructor(t, e = {}) {
|
|
1082
1072
|
this.config = t, this.imageConfig = e;
|
|
1083
1073
|
}
|
|
@@ -1089,16 +1079,16 @@ class re {
|
|
|
1089
1079
|
* @returns Array of layout objects with position, rotation, scale
|
|
1090
1080
|
*/
|
|
1091
1081
|
generate(t, e, i = {}) {
|
|
1092
|
-
var x, L,
|
|
1093
|
-
const o = [], { width: s, height: c } = e, a = this.config.spacing.padding, h = i.fixedHeight ??
|
|
1094
|
-
for (let
|
|
1095
|
-
const
|
|
1096
|
-
id:
|
|
1097
|
-
x:
|
|
1098
|
-
y:
|
|
1099
|
-
rotation:
|
|
1100
|
-
scale:
|
|
1101
|
-
baseSize:
|
|
1082
|
+
var x, L, j, P, D, U, W, F, S;
|
|
1083
|
+
const o = [], { width: s, height: c } = e, a = this.config.spacing.padding, h = i.fixedHeight ?? 200, l = ((x = this.imageConfig.rotation) == null ? void 0 : x.mode) ?? "none", u = ((j = (L = this.imageConfig.rotation) == null ? void 0 : L.range) == null ? void 0 : j.min) ?? -15, r = ((D = (P = this.imageConfig.rotation) == null ? void 0 : P.range) == null ? void 0 : D.max) ?? 15, d = ((W = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : W.min) ?? 1, f = ((S = (F = this.imageConfig.sizing) == null ? void 0 : F.variance) == null ? void 0 : S.max) ?? 1, y = d !== 1 || f !== 1, g = h * 1.5 / 2, m = h / 2, v = s - a - g, w = c - a - m, E = a + g, A = a + m;
|
|
1084
|
+
for (let T = 0; T < t; T++) {
|
|
1085
|
+
const $ = this.random(E, v), z = this.random(A, w), R = l === "random" ? this.random(u, r) : 0, M = y ? this.random(d, f) : 1, _ = h * M, Z = {
|
|
1086
|
+
id: T,
|
|
1087
|
+
x: $,
|
|
1088
|
+
y: z,
|
|
1089
|
+
rotation: R,
|
|
1090
|
+
scale: M,
|
|
1091
|
+
baseSize: _
|
|
1102
1092
|
};
|
|
1103
1093
|
o.push(Z);
|
|
1104
1094
|
}
|
|
@@ -1114,7 +1104,7 @@ class re {
|
|
|
1114
1104
|
return Math.random() * (e - t) + t;
|
|
1115
1105
|
}
|
|
1116
1106
|
}
|
|
1117
|
-
class
|
|
1107
|
+
class le {
|
|
1118
1108
|
constructor(t, e = {}) {
|
|
1119
1109
|
this.config = t, this.imageConfig = e;
|
|
1120
1110
|
}
|
|
@@ -1126,48 +1116,48 @@ class ce {
|
|
|
1126
1116
|
* @returns Array of layout objects with position, rotation, scale
|
|
1127
1117
|
*/
|
|
1128
1118
|
generate(t, e, i = {}) {
|
|
1129
|
-
var L,
|
|
1130
|
-
const o = [], { width: s, height: c } = e, { debugRadials: a } = this.config, h =
|
|
1119
|
+
var L, j, P, D, U, W, F, S, T;
|
|
1120
|
+
const o = [], { width: s, height: c } = e, { debugRadials: a } = this.config, h = i.fixedHeight ?? 200, l = ((L = this.imageConfig.rotation) == null ? void 0 : L.mode) ?? "none", u = ((P = (j = this.imageConfig.rotation) == null ? void 0 : j.range) == null ? void 0 : P.min) ?? -15, r = ((U = (D = this.imageConfig.rotation) == null ? void 0 : D.range) == null ? void 0 : U.max) ?? 15, d = ((F = (W = this.imageConfig.sizing) == null ? void 0 : W.variance) == null ? void 0 : F.min) ?? 1, f = ((T = (S = this.imageConfig.sizing) == null ? void 0 : S.variance) == null ? void 0 : T.max) ?? 1, y = d !== 1 || f !== 1, p = this.config.scaleDecay ?? 0, g = ["green", "blue", "red", "yellow", "orange", "purple"], m = i.fixedHeight ?? h, v = s / 2, w = c / 2, E = Math.ceil(Math.sqrt(t));
|
|
1131
1121
|
if (t > 0) {
|
|
1132
|
-
const
|
|
1122
|
+
const $ = y ? this.random(d, f) : 1, z = m * $;
|
|
1133
1123
|
o.push({
|
|
1134
1124
|
id: 0,
|
|
1135
|
-
x:
|
|
1136
|
-
y:
|
|
1137
|
-
rotation: l === "random" ? this.random(
|
|
1125
|
+
x: v,
|
|
1126
|
+
y: w,
|
|
1127
|
+
rotation: l === "random" ? this.random(u * 0.33, r * 0.33) : 0,
|
|
1138
1128
|
// Less rotation for center
|
|
1139
|
-
scale:
|
|
1129
|
+
scale: $,
|
|
1140
1130
|
baseSize: z,
|
|
1141
1131
|
zIndex: 100,
|
|
1142
1132
|
// Center image is highest
|
|
1143
1133
|
borderColor: a ? "cyan" : void 0
|
|
1144
1134
|
});
|
|
1145
1135
|
}
|
|
1146
|
-
let
|
|
1147
|
-
for (;
|
|
1148
|
-
const
|
|
1149
|
-
if (
|
|
1136
|
+
let A = 1, x = 1;
|
|
1137
|
+
for (; A < t; ) {
|
|
1138
|
+
const $ = x / E, z = p > 0 ? 1 - $ * p * 0.5 : 1, R = x * (m * 0.8), M = R * 1.5, _ = Math.PI * (3 * (M + R) - Math.sqrt((3 * M + R) * (M + 3 * R))), Z = this.estimateWidth(m), B = Math.floor(_ / (Z * 0.7));
|
|
1139
|
+
if (B === 0) {
|
|
1150
1140
|
x++;
|
|
1151
1141
|
continue;
|
|
1152
1142
|
}
|
|
1153
|
-
const
|
|
1154
|
-
for (let
|
|
1155
|
-
const
|
|
1156
|
-
let
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1143
|
+
const X = 2 * Math.PI / B, K = x * (20 * Math.PI / 180);
|
|
1144
|
+
for (let N = 0; N < B && A < t; N++) {
|
|
1145
|
+
const Q = N * X + K, tt = y ? this.random(d, f) : 1, q = z * tt, et = m * q;
|
|
1146
|
+
let Y = v + Math.cos(Q) * M, C = w + Math.sin(Q) * R;
|
|
1147
|
+
const O = this.config.spacing.padding ?? 50, G = et * 1.5 / 2, H = et / 2;
|
|
1148
|
+
Y - G < O ? Y = O + G : Y + G > s - O && (Y = s - O - G), C - H < O ? C = O + H : C + H > c - O && (C = c - O - H);
|
|
1149
|
+
const it = l === "random" ? this.random(u, r) : 0;
|
|
1160
1150
|
o.push({
|
|
1161
|
-
id:
|
|
1162
|
-
x:
|
|
1163
|
-
y:
|
|
1164
|
-
rotation:
|
|
1165
|
-
scale:
|
|
1166
|
-
baseSize:
|
|
1151
|
+
id: A,
|
|
1152
|
+
x: Y,
|
|
1153
|
+
y: C,
|
|
1154
|
+
rotation: it,
|
|
1155
|
+
scale: q,
|
|
1156
|
+
baseSize: et,
|
|
1167
1157
|
zIndex: Math.max(1, 100 - x),
|
|
1168
1158
|
// Outer rings have lower z-index
|
|
1169
|
-
borderColor: a ?
|
|
1170
|
-
}),
|
|
1159
|
+
borderColor: a ? g[(x - 1) % g.length] : void 0
|
|
1160
|
+
}), A++;
|
|
1171
1161
|
}
|
|
1172
1162
|
x++;
|
|
1173
1163
|
}
|
|
@@ -1192,8 +1182,7 @@ class ce {
|
|
|
1192
1182
|
return Math.random() * (e - t) + t;
|
|
1193
1183
|
}
|
|
1194
1184
|
}
|
|
1195
|
-
|
|
1196
|
-
const le = {
|
|
1185
|
+
const he = {
|
|
1197
1186
|
columns: "auto",
|
|
1198
1187
|
rows: "auto",
|
|
1199
1188
|
stagger: "none",
|
|
@@ -1221,7 +1210,7 @@ const le = {
|
|
|
1221
1210
|
{ x: 0, y: 1 }
|
|
1222
1211
|
// down
|
|
1223
1212
|
];
|
|
1224
|
-
class
|
|
1213
|
+
class de {
|
|
1225
1214
|
constructor(t, e = {}) {
|
|
1226
1215
|
this.config = t, this.imageConfig = e;
|
|
1227
1216
|
}
|
|
@@ -1233,61 +1222,61 @@ class he {
|
|
|
1233
1222
|
* @returns Array of layout objects with position, rotation, scale
|
|
1234
1223
|
*/
|
|
1235
1224
|
generate(t, e, i = {}) {
|
|
1236
|
-
var
|
|
1237
|
-
const o = [], { width: s, height: c } = e, a = { ...
|
|
1225
|
+
var B, X, K, N, Q, tt, q, et, Y;
|
|
1226
|
+
const o = [], { width: s, height: c } = e, a = { ...he, ...this.config.grid }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((B = this.imageConfig.rotation) == null ? void 0 : B.mode) ?? "none", r = ((K = (X = this.imageConfig.sizing) == null ? void 0 : X.variance) == null ? void 0 : K.min) ?? 1, d = ((Q = (N = this.imageConfig.sizing) == null ? void 0 : N.variance) == null ? void 0 : Q.max) ?? 1, f = r !== 1 || d !== 1, y = s - 2 * h, p = c - 2 * h, { columns: g, rows: m } = this.calculateGridDimensions(
|
|
1238
1227
|
t,
|
|
1239
1228
|
y,
|
|
1240
1229
|
p,
|
|
1241
1230
|
l,
|
|
1242
1231
|
a
|
|
1243
|
-
),
|
|
1244
|
-
|
|
1232
|
+
), v = a.stagger === "row", w = a.stagger === "column", E = v ? g + 0.5 : g, A = w ? m + 0.5 : m, x = (y - a.gap * (g - 1)) / E, L = (p - a.gap * (m - 1)) / A, j = v ? x / 2 : 0, P = w ? L / 2 : 0, D = 1 + a.overlap, U = Math.min(x, L) * D, W = i.fixedHeight ? Math.min(i.fixedHeight, U) : U, F = g * x + (g - 1) * a.gap + j, S = m * L + (m - 1) * a.gap + P, T = h + (y - F) / 2, $ = h + (p - S) / 2, z = g * m, R = a.columns !== "auto" && a.rows !== "auto", M = R && t > z;
|
|
1233
|
+
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1245
1234
|
gridConfigColumns: a.columns,
|
|
1246
1235
|
gridConfigRows: a.rows,
|
|
1247
|
-
columns:
|
|
1236
|
+
columns: g,
|
|
1248
1237
|
rows: m,
|
|
1249
|
-
cellCount:
|
|
1250
|
-
hasFixedGrid:
|
|
1238
|
+
cellCount: z,
|
|
1239
|
+
hasFixedGrid: R,
|
|
1251
1240
|
imageCount: t,
|
|
1252
|
-
isOverflowMode:
|
|
1241
|
+
isOverflowMode: M
|
|
1253
1242
|
});
|
|
1254
|
-
const
|
|
1243
|
+
const _ = M ? new Array(z).fill(0) : [], Z = Math.min(x, L) * a.overflowOffset;
|
|
1255
1244
|
for (let C = 0; C < t; C++) {
|
|
1256
|
-
let
|
|
1257
|
-
if (
|
|
1258
|
-
const J = C -
|
|
1259
|
-
|
|
1245
|
+
let O, k, G = 0;
|
|
1246
|
+
if (M && C >= z) {
|
|
1247
|
+
const J = C - z, V = J % z;
|
|
1248
|
+
G = Math.floor(J / z) + 1, _[V]++, a.fillDirection === "row" ? (O = V % g, k = Math.floor(V / g)) : (k = V % m, O = Math.floor(V / m));
|
|
1260
1249
|
} else
|
|
1261
|
-
a.fillDirection === "row" ? (
|
|
1262
|
-
let
|
|
1263
|
-
if (a.stagger === "row" &&
|
|
1264
|
-
const J = (
|
|
1265
|
-
|
|
1250
|
+
a.fillDirection === "row" ? (O = C % g, k = Math.floor(C / g)) : (k = C % m, O = Math.floor(C / m));
|
|
1251
|
+
let H = T + O * (x + a.gap) + x / 2, it = $ + k * (L + a.gap) + L / 2;
|
|
1252
|
+
if (a.stagger === "row" && k % 2 === 1 ? H += x / 2 : a.stagger === "column" && O % 2 === 1 && (it += L / 2), G > 0) {
|
|
1253
|
+
const J = (G - 1) % Ft.length, V = Ft[J];
|
|
1254
|
+
H += V.x * Z, it += V.y * Z;
|
|
1266
1255
|
}
|
|
1267
1256
|
if (a.jitter > 0) {
|
|
1268
|
-
const J = x / 2 * a.jitter,
|
|
1269
|
-
|
|
1257
|
+
const J = x / 2 * a.jitter, V = L / 2 * a.jitter;
|
|
1258
|
+
H += this.random(-J, J), it += this.random(-V, V);
|
|
1270
1259
|
}
|
|
1271
|
-
let
|
|
1272
|
-
if (!
|
|
1273
|
-
const J = t %
|
|
1274
|
-
if (
|
|
1260
|
+
let nt = H, ot = it;
|
|
1261
|
+
if (!M && a.fillDirection === "row") {
|
|
1262
|
+
const J = t % g || g;
|
|
1263
|
+
if (k === Math.floor((t - 1) / g) && J < g) {
|
|
1275
1264
|
const At = J * x + (J - 1) * a.gap;
|
|
1276
1265
|
let xt = 0;
|
|
1277
|
-
a.alignment === "center" ? xt = (F - At) / 2 : a.alignment === "end" && (xt = F - At),
|
|
1266
|
+
a.alignment === "center" ? xt = (F - At) / 2 : a.alignment === "end" && (xt = F - At), nt += xt;
|
|
1278
1267
|
}
|
|
1279
1268
|
}
|
|
1280
|
-
const ft = f ? this.random(r, d) : 1, at =
|
|
1281
|
-
|
|
1269
|
+
const ft = f ? this.random(r, d) : 1, at = W * ft, dt = at * 1.5 / 2, ut = at / 2, yt = h + dt, bt = s - h - dt, Ut = h + ut, Pt = c - h - ut;
|
|
1270
|
+
nt = Math.max(yt, Math.min(nt, bt)), ot = Math.max(Ut, Math.min(ot, Pt));
|
|
1282
1271
|
let vt = 0;
|
|
1283
|
-
if (
|
|
1284
|
-
const J = ((q = (
|
|
1285
|
-
a.jitter > 0 ? vt = this.random(J * a.jitter,
|
|
1272
|
+
if (u === "random") {
|
|
1273
|
+
const J = ((q = (tt = this.imageConfig.rotation) == null ? void 0 : tt.range) == null ? void 0 : q.min) ?? -15, V = ((Y = (et = this.imageConfig.rotation) == null ? void 0 : et.range) == null ? void 0 : Y.max) ?? 15;
|
|
1274
|
+
a.jitter > 0 ? vt = this.random(J * a.jitter, V * a.jitter) : vt = this.random(J, V);
|
|
1286
1275
|
}
|
|
1287
1276
|
let wt;
|
|
1288
|
-
|
|
1277
|
+
M && G > 0 ? wt = 50 - G : wt = M ? 100 + C : C + 1, o.push({
|
|
1289
1278
|
id: C,
|
|
1290
|
-
x:
|
|
1279
|
+
x: nt,
|
|
1291
1280
|
y: ot,
|
|
1292
1281
|
rotation: vt,
|
|
1293
1282
|
scale: ft,
|
|
@@ -1322,14 +1311,14 @@ class he {
|
|
|
1322
1311
|
return Math.random() * (e - t) + t;
|
|
1323
1312
|
}
|
|
1324
1313
|
}
|
|
1325
|
-
const
|
|
1314
|
+
const ue = Math.PI * (3 - Math.sqrt(5)), ge = {
|
|
1326
1315
|
spiralType: "golden",
|
|
1327
1316
|
direction: "counterclockwise",
|
|
1328
1317
|
tightness: 1,
|
|
1329
1318
|
scaleDecay: 0,
|
|
1330
1319
|
startAngle: 0
|
|
1331
1320
|
};
|
|
1332
|
-
class
|
|
1321
|
+
class me {
|
|
1333
1322
|
constructor(t, e = {}) {
|
|
1334
1323
|
this.config = t, this.imageConfig = e;
|
|
1335
1324
|
}
|
|
@@ -1341,37 +1330,37 @@ class ue {
|
|
|
1341
1330
|
* @returns Array of layout objects with position, rotation, scale
|
|
1342
1331
|
*/
|
|
1343
1332
|
generate(t, e, i = {}) {
|
|
1344
|
-
var
|
|
1345
|
-
const o = [], { width: s, height: c } = e, a = { ...ge, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ??
|
|
1333
|
+
var A, x, L, j, P, D, U, W, F;
|
|
1334
|
+
const o = [], { width: s, height: c } = e, a = { ...ge, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", r = ((L = (x = this.imageConfig.rotation) == null ? void 0 : x.range) == null ? void 0 : L.min) ?? -15, d = ((P = (j = this.imageConfig.rotation) == null ? void 0 : j.range) == null ? void 0 : P.max) ?? 15, f = ((U = (D = this.imageConfig.sizing) == null ? void 0 : D.variance) == null ? void 0 : U.min) ?? 1, y = ((F = (W = this.imageConfig.sizing) == null ? void 0 : W.variance) == null ? void 0 : F.max) ?? 1, p = f !== 1 || y !== 1, g = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, v = c / 2, w = Math.min(
|
|
1346
1335
|
m - h - l / 2,
|
|
1347
|
-
|
|
1336
|
+
v - h - l / 2
|
|
1348
1337
|
), E = a.direction === "clockwise" ? -1 : 1;
|
|
1349
|
-
for (let
|
|
1350
|
-
let
|
|
1338
|
+
for (let S = 0; S < t; S++) {
|
|
1339
|
+
let T, $;
|
|
1351
1340
|
if (a.spiralType === "golden")
|
|
1352
|
-
|
|
1341
|
+
T = S * ue * E + a.startAngle, $ = this.calculateGoldenRadius(S, t, w, a.tightness);
|
|
1353
1342
|
else if (a.spiralType === "archimedean") {
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1343
|
+
const H = S * 0.5 * a.tightness;
|
|
1344
|
+
T = H * E + a.startAngle, $ = this.calculateArchimedeanRadius(H, t, w, a.tightness);
|
|
1356
1345
|
} else {
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1346
|
+
const H = S * 0.3 * a.tightness;
|
|
1347
|
+
T = H * E + a.startAngle, $ = this.calculateLogarithmicRadius(H, t, w, a.tightness);
|
|
1359
1348
|
}
|
|
1360
|
-
const z = m + Math.cos(
|
|
1361
|
-
let
|
|
1362
|
-
if (
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1365
|
-
} else
|
|
1366
|
-
const
|
|
1349
|
+
const z = m + Math.cos(T) * $, R = v + Math.sin(T) * $, M = $ / w, _ = g > 0 ? 1 - M * g * 0.5 : 1, Z = p ? this.random(f, y) : 1, B = _ * Z, X = l * B, N = X * 1.5 / 2, Q = X / 2, tt = h + N, q = s - h - N, et = h + Q, Y = c - h - Q, C = Math.max(tt, Math.min(z, q)), O = Math.max(et, Math.min(R, Y));
|
|
1350
|
+
let k = 0;
|
|
1351
|
+
if (u === "random") {
|
|
1352
|
+
const H = T * 180 / Math.PI % 360, it = this.random(r, d);
|
|
1353
|
+
k = a.spiralType === "golden" ? it : H * 0.1 + it * 0.9;
|
|
1354
|
+
} else u === "tangent" && (k = this.calculateSpiralTangent(T, $, a));
|
|
1355
|
+
const G = t - S;
|
|
1367
1356
|
o.push({
|
|
1368
|
-
id:
|
|
1369
|
-
x:
|
|
1370
|
-
y:
|
|
1371
|
-
rotation:
|
|
1372
|
-
scale:
|
|
1373
|
-
baseSize:
|
|
1374
|
-
zIndex:
|
|
1357
|
+
id: S,
|
|
1358
|
+
x: C,
|
|
1359
|
+
y: O,
|
|
1360
|
+
rotation: k,
|
|
1361
|
+
scale: B,
|
|
1362
|
+
baseSize: X,
|
|
1363
|
+
zIndex: G
|
|
1375
1364
|
});
|
|
1376
1365
|
}
|
|
1377
1366
|
return o;
|
|
@@ -1424,7 +1413,7 @@ class ue {
|
|
|
1424
1413
|
return Math.random() * (e - t) + t;
|
|
1425
1414
|
}
|
|
1426
1415
|
}
|
|
1427
|
-
const
|
|
1416
|
+
const fe = {
|
|
1428
1417
|
clusterCount: "auto",
|
|
1429
1418
|
clusterSpread: 150,
|
|
1430
1419
|
clusterSpacing: 200,
|
|
@@ -1432,7 +1421,7 @@ const me = {
|
|
|
1432
1421
|
overlap: 0.3,
|
|
1433
1422
|
distribution: "gaussian"
|
|
1434
1423
|
};
|
|
1435
|
-
class
|
|
1424
|
+
class pe {
|
|
1436
1425
|
constructor(t, e = {}) {
|
|
1437
1426
|
this.config = t, this.imageConfig = e;
|
|
1438
1427
|
}
|
|
@@ -1444,49 +1433,49 @@ class fe {
|
|
|
1444
1433
|
* @returns Array of layout objects with position, rotation, scale
|
|
1445
1434
|
*/
|
|
1446
1435
|
generate(t, e, i = {}) {
|
|
1447
|
-
var E,
|
|
1448
|
-
const o = [], { width: s, height: c } = e, a = { ...
|
|
1436
|
+
var E, A, x, L, j, P, D, U, W;
|
|
1437
|
+
const o = [], { width: s, height: c } = e, a = { ...fe, ...this.config.cluster }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((E = this.imageConfig.rotation) == null ? void 0 : E.mode) ?? "none", r = ((x = (A = this.imageConfig.rotation) == null ? void 0 : A.range) == null ? void 0 : x.min) ?? -15, d = ((j = (L = this.imageConfig.rotation) == null ? void 0 : L.range) == null ? void 0 : j.max) ?? 15, f = ((D = (P = this.imageConfig.sizing) == null ? void 0 : P.variance) == null ? void 0 : D.min) ?? 1, y = ((W = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : W.max) ?? 1, p = f !== 1 || y !== 1, g = this.calculateClusterCount(
|
|
1449
1438
|
t,
|
|
1450
1439
|
a.clusterCount,
|
|
1451
1440
|
s,
|
|
1452
1441
|
c,
|
|
1453
1442
|
a.clusterSpacing
|
|
1454
1443
|
), m = this.generateClusterCenters(
|
|
1455
|
-
|
|
1444
|
+
g,
|
|
1456
1445
|
s,
|
|
1457
1446
|
c,
|
|
1458
1447
|
h,
|
|
1459
1448
|
a
|
|
1460
|
-
),
|
|
1449
|
+
), v = new Array(g).fill(0);
|
|
1461
1450
|
for (let F = 0; F < t; F++)
|
|
1462
|
-
|
|
1463
|
-
let
|
|
1464
|
-
for (let F = 0; F <
|
|
1465
|
-
const
|
|
1466
|
-
for (let
|
|
1467
|
-
let
|
|
1451
|
+
v[F % g]++;
|
|
1452
|
+
let w = 0;
|
|
1453
|
+
for (let F = 0; F < g; F++) {
|
|
1454
|
+
const S = m[F], T = v[F];
|
|
1455
|
+
for (let $ = 0; $ < T; $++) {
|
|
1456
|
+
let z, R;
|
|
1468
1457
|
if (a.distribution === "gaussian")
|
|
1469
|
-
|
|
1458
|
+
z = this.gaussianRandom() * S.spread, R = this.gaussianRandom() * S.spread;
|
|
1470
1459
|
else {
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1460
|
+
const k = this.random(0, Math.PI * 2), G = this.random(0, S.spread);
|
|
1461
|
+
z = Math.cos(k) * G, R = Math.sin(k) * G;
|
|
1473
1462
|
}
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1476
|
-
const Z = p ? this.random(f, y) : 1,
|
|
1477
|
-
let
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1480
|
-
const
|
|
1463
|
+
const M = 1 + a.overlap * 0.5, _ = 1 + a.overlap * 0.3;
|
|
1464
|
+
z /= M, R /= M;
|
|
1465
|
+
const Z = p ? this.random(f, y) : 1, B = _ * Z, X = l * B;
|
|
1466
|
+
let K = S.x + z, N = S.y + R;
|
|
1467
|
+
const tt = X * 1.5 / 2, q = X / 2;
|
|
1468
|
+
K = Math.max(h + tt, Math.min(K, s - h - tt)), N = Math.max(h + q, Math.min(N, c - h - q));
|
|
1469
|
+
const et = u === "random" ? this.random(r, d) : 0, C = Math.sqrt(z * z + R * R) / S.spread, O = Math.round((1 - C) * 50) + 1;
|
|
1481
1470
|
o.push({
|
|
1482
|
-
id:
|
|
1483
|
-
x:
|
|
1484
|
-
y:
|
|
1485
|
-
rotation:
|
|
1486
|
-
scale:
|
|
1487
|
-
baseSize:
|
|
1488
|
-
zIndex:
|
|
1489
|
-
}),
|
|
1471
|
+
id: w,
|
|
1472
|
+
x: K,
|
|
1473
|
+
y: N,
|
|
1474
|
+
rotation: et,
|
|
1475
|
+
scale: B,
|
|
1476
|
+
baseSize: X,
|
|
1477
|
+
zIndex: O
|
|
1478
|
+
}), w++;
|
|
1490
1479
|
}
|
|
1491
1480
|
}
|
|
1492
1481
|
return o;
|
|
@@ -1506,21 +1495,21 @@ class fe {
|
|
|
1506
1495
|
* Generate cluster center positions with spacing constraints
|
|
1507
1496
|
*/
|
|
1508
1497
|
generateClusterCenters(t, e, i, o, s) {
|
|
1509
|
-
const c = [], h = o + s.clusterSpread, l = e - o - s.clusterSpread,
|
|
1498
|
+
const c = [], h = o + s.clusterSpread, l = e - o - s.clusterSpread, u = o + s.clusterSpread, r = i - o - s.clusterSpread;
|
|
1510
1499
|
for (let d = 0; d < t; d++) {
|
|
1511
1500
|
let f = null, y = -1;
|
|
1512
1501
|
for (let p = 0; p < 100; p++) {
|
|
1513
|
-
const
|
|
1502
|
+
const g = {
|
|
1514
1503
|
x: this.random(h, l),
|
|
1515
|
-
y: this.random(
|
|
1504
|
+
y: this.random(u, r),
|
|
1516
1505
|
spread: this.calculateClusterSpread(s)
|
|
1517
1506
|
};
|
|
1518
1507
|
let m = 1 / 0;
|
|
1519
|
-
for (const
|
|
1520
|
-
const
|
|
1521
|
-
m = Math.min(m,
|
|
1508
|
+
for (const v of c) {
|
|
1509
|
+
const w = g.x - v.x, E = g.y - v.y, A = Math.sqrt(w * w + E * E);
|
|
1510
|
+
m = Math.min(m, A);
|
|
1522
1511
|
}
|
|
1523
|
-
if ((c.length === 0 || m > y) && (f =
|
|
1512
|
+
if ((c.length === 0 || m > y) && (f = g, y = m), m >= s.clusterSpacing)
|
|
1524
1513
|
break;
|
|
1525
1514
|
}
|
|
1526
1515
|
f && c.push(f);
|
|
@@ -1551,7 +1540,7 @@ class fe {
|
|
|
1551
1540
|
return Math.random() * (e - t) + t;
|
|
1552
1541
|
}
|
|
1553
1542
|
}
|
|
1554
|
-
class
|
|
1543
|
+
class ye {
|
|
1555
1544
|
constructor(t, e = {}) {
|
|
1556
1545
|
this.config = t, this.imageConfig = e;
|
|
1557
1546
|
}
|
|
@@ -1563,30 +1552,30 @@ class pe {
|
|
|
1563
1552
|
* @returns Array of layout objects with position, rotation, scale
|
|
1564
1553
|
*/
|
|
1565
1554
|
generate(t, e, i = {}) {
|
|
1566
|
-
var
|
|
1567
|
-
const o = [], { width: s, height: c } = e, a =
|
|
1555
|
+
var M, _, Z, B, X, K, N, Q, tt;
|
|
1556
|
+
const o = [], { width: s, height: c } = e, a = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, l = ((M = this.imageConfig.rotation) == null ? void 0 : M.mode) ?? "none", u = ((Z = (_ = this.imageConfig.rotation) == null ? void 0 : _.range) == null ? void 0 : Z.min) ?? -15, r = ((X = (B = this.imageConfig.rotation) == null ? void 0 : B.range) == null ? void 0 : X.max) ?? 15, d = ((N = (K = this.imageConfig.sizing) == null ? void 0 : K.variance) == null ? void 0 : N.min) ?? 1, f = ((tt = (Q = this.imageConfig.sizing) == null ? void 0 : Q.variance) == null ? void 0 : tt.max) ?? 1, y = d !== 1 || f !== 1, p = i.fixedHeight ?? a, g = {
|
|
1568
1557
|
...Ht,
|
|
1569
1558
|
...this.config.wave
|
|
1570
|
-
}, { rows: m, amplitude:
|
|
1571
|
-
let
|
|
1572
|
-
for (let q = 0; q < m &&
|
|
1573
|
-
const
|
|
1574
|
-
let
|
|
1575
|
-
|
|
1576
|
-
for (let C = 0; C < x &&
|
|
1577
|
-
const
|
|
1559
|
+
}, { rows: m, amplitude: v, frequency: w, phaseShift: E, synchronization: A } = g, x = Math.ceil(t / m), P = p * 1.5 / 2, D = h + P, U = s - h - P, W = U - D, F = x > 1 ? W / (x - 1) : 0, S = h + v + p / 2, T = c - h - v - p / 2, $ = T - S, z = m > 1 ? $ / (m - 1) : 0;
|
|
1560
|
+
let R = 0;
|
|
1561
|
+
for (let q = 0; q < m && R < t; q++) {
|
|
1562
|
+
const et = m === 1 ? (S + T) / 2 : S + q * z;
|
|
1563
|
+
let Y = 0;
|
|
1564
|
+
A === "offset" ? Y = q * E : A === "alternating" && (Y = q * Math.PI);
|
|
1565
|
+
for (let C = 0; C < x && R < t; C++) {
|
|
1566
|
+
const O = x === 1 ? (D + U) / 2 : D + C * F, k = this.calculateWaveY(O, s, v, w, Y), G = O, H = et + k, it = y ? this.random(d, f) : 1, nt = p * it;
|
|
1578
1567
|
let ot = 0;
|
|
1579
|
-
l === "tangent" ? ot = this.calculateRotation(
|
|
1580
|
-
const at =
|
|
1568
|
+
l === "tangent" ? ot = this.calculateRotation(O, s, v, w, Y) : l === "random" && (ot = this.random(u, r));
|
|
1569
|
+
const at = nt * 1.5 / 2, pt = nt / 2, dt = h + at, ut = s - h - at, yt = h + pt, bt = c - h - pt;
|
|
1581
1570
|
o.push({
|
|
1582
|
-
id:
|
|
1583
|
-
x: Math.max(dt, Math.min(
|
|
1584
|
-
y: Math.max(yt, Math.min(
|
|
1571
|
+
id: R,
|
|
1572
|
+
x: Math.max(dt, Math.min(G, ut)),
|
|
1573
|
+
y: Math.max(yt, Math.min(H, bt)),
|
|
1585
1574
|
rotation: ot,
|
|
1586
|
-
scale:
|
|
1587
|
-
baseSize:
|
|
1588
|
-
zIndex:
|
|
1589
|
-
}),
|
|
1575
|
+
scale: it,
|
|
1576
|
+
baseSize: nt,
|
|
1577
|
+
zIndex: R + 1
|
|
1578
|
+
}), R++;
|
|
1590
1579
|
}
|
|
1591
1580
|
}
|
|
1592
1581
|
return o;
|
|
@@ -1629,9 +1618,9 @@ class pe {
|
|
|
1629
1618
|
return Math.random() * (e - t) + t;
|
|
1630
1619
|
}
|
|
1631
1620
|
}
|
|
1632
|
-
class
|
|
1621
|
+
class be {
|
|
1633
1622
|
constructor(t) {
|
|
1634
|
-
this.config = t.layout, this.imageConfig = t.image, this.
|
|
1623
|
+
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.generator = this.initGenerator();
|
|
1635
1624
|
}
|
|
1636
1625
|
/**
|
|
1637
1626
|
* Initialize the appropriate generator based on config type
|
|
@@ -1640,18 +1629,18 @@ class ye {
|
|
|
1640
1629
|
initGenerator() {
|
|
1641
1630
|
switch (this.config.algorithm) {
|
|
1642
1631
|
case "radial":
|
|
1643
|
-
return new
|
|
1632
|
+
return new le(this.config, this.imageConfig);
|
|
1644
1633
|
case "grid":
|
|
1645
|
-
return new
|
|
1634
|
+
return new de(this.config, this.imageConfig);
|
|
1646
1635
|
case "spiral":
|
|
1647
|
-
return new
|
|
1636
|
+
return new me(this.config, this.imageConfig);
|
|
1648
1637
|
case "cluster":
|
|
1649
|
-
return new fe(this.config, this.imageConfig);
|
|
1650
|
-
case "wave":
|
|
1651
1638
|
return new pe(this.config, this.imageConfig);
|
|
1639
|
+
case "wave":
|
|
1640
|
+
return new ye(this.config, this.imageConfig);
|
|
1652
1641
|
case "random":
|
|
1653
1642
|
default:
|
|
1654
|
-
return new
|
|
1643
|
+
return new ce(this.config, this.imageConfig);
|
|
1655
1644
|
}
|
|
1656
1645
|
}
|
|
1657
1646
|
/**
|
|
@@ -1686,48 +1675,62 @@ class ye {
|
|
|
1686
1675
|
* @param newConfig - Updated configuration
|
|
1687
1676
|
*/
|
|
1688
1677
|
updateConfig(t) {
|
|
1689
|
-
t.layout && (Object.assign(this.config, t.layout), t.layout.algorithm && t.layout.algorithm !== this.config.algorithm && (this.generator = this.initGenerator())), t.image && Object.assign(this.imageConfig, t.image)
|
|
1678
|
+
t.layout && (Object.assign(this.config, t.layout), t.layout.algorithm && t.layout.algorithm !== this.config.algorithm && (this.generator = this.initGenerator())), t.image && Object.assign(this.imageConfig, t.image);
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Get responsive breakpoints from layout config
|
|
1682
|
+
*/
|
|
1683
|
+
getBreakpoints() {
|
|
1684
|
+
return this.config.responsive ?? {
|
|
1685
|
+
mobile: { maxWidth: 767 },
|
|
1686
|
+
tablet: { maxWidth: 1199 }
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Resolve breakpoint name based on viewport width
|
|
1691
|
+
*/
|
|
1692
|
+
resolveBreakpoint(t) {
|
|
1693
|
+
const e = this.getBreakpoints();
|
|
1694
|
+
return t <= e.mobile.maxWidth ? "mobile" : t <= e.tablet.maxWidth ? "tablet" : "screen";
|
|
1690
1695
|
}
|
|
1691
1696
|
/**
|
|
1692
1697
|
* Resolve the effective base height based on image config and current viewport
|
|
1693
1698
|
* @param viewportWidth - Current viewport width
|
|
1694
|
-
* @returns Resolved base height or undefined if should auto-calculate
|
|
1699
|
+
* @returns Resolved base height or undefined if should auto-calculate (adaptive mode)
|
|
1695
1700
|
*/
|
|
1696
1701
|
resolveBaseHeight(t) {
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
if (e === void 0)
|
|
1702
|
+
const e = this.imageConfig.sizing;
|
|
1703
|
+
if (!e || e.mode === "adaptive")
|
|
1700
1704
|
return;
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
+
const i = e.height;
|
|
1706
|
+
if (i === void 0)
|
|
1707
|
+
return;
|
|
1708
|
+
if (typeof i == "number")
|
|
1709
|
+
return i;
|
|
1710
|
+
const o = i, s = this.resolveBreakpoint(t);
|
|
1711
|
+
return s === "mobile" ? o.mobile ?? o.tablet ?? o.screen : s === "tablet" ? o.tablet ?? o.screen ?? o.mobile : o.screen ?? o.tablet ?? o.mobile;
|
|
1705
1712
|
}
|
|
1706
1713
|
/**
|
|
1707
1714
|
* Calculate adaptive image size based on container dimensions and image count
|
|
1708
1715
|
* @param containerBounds - Container dimensions {width, height}
|
|
1709
1716
|
* @param imageCount - Number of images to display
|
|
1710
|
-
* @param
|
|
1717
|
+
* @param maxHeight - Maximum height constraint (upper bound)
|
|
1711
1718
|
* @param viewportWidth - Current viewport width for baseHeight resolution
|
|
1712
1719
|
* @returns Calculated sizing result with height
|
|
1713
1720
|
*/
|
|
1714
1721
|
calculateAdaptiveSize(t, e, i, o) {
|
|
1715
|
-
const s = this.
|
|
1716
|
-
if (c !== void 0)
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
}
|
|
1720
|
-
if (!s || !s.enabled)
|
|
1721
|
-
return { height: i };
|
|
1722
|
-
const { width: a, height: h } = t, { minSize: l, maxSize: g } = s, r = this.config.targetCoverage ?? 0.6, d = this.config.densityFactor ?? 1, p = a * h * r / e;
|
|
1722
|
+
const s = this.imageConfig.sizing, c = this.resolveBaseHeight(o);
|
|
1723
|
+
if (c !== void 0)
|
|
1724
|
+
return { height: c };
|
|
1725
|
+
const a = (s == null ? void 0 : s.minSize) ?? 50, h = (s == null ? void 0 : s.maxSize) ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: r, height: d } = t, p = r * d * l / e;
|
|
1723
1726
|
let m = Math.sqrt(p / 1.4);
|
|
1724
|
-
m *=
|
|
1725
|
-
let
|
|
1726
|
-
if (
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1727
|
+
m *= u, m = Math.min(m, i);
|
|
1728
|
+
let v = this.clamp(m, a, h);
|
|
1729
|
+
if (v === a && m < a) {
|
|
1730
|
+
const w = Math.max(a * 0.05, 20);
|
|
1731
|
+
v = Math.max(w, m);
|
|
1729
1732
|
}
|
|
1730
|
-
return { height:
|
|
1733
|
+
return { height: v };
|
|
1731
1734
|
}
|
|
1732
1735
|
/**
|
|
1733
1736
|
* Utility: Clamp a value between min and max
|
|
@@ -1736,14 +1739,14 @@ class ye {
|
|
|
1736
1739
|
return Math.max(e, Math.min(i, t));
|
|
1737
1740
|
}
|
|
1738
1741
|
}
|
|
1739
|
-
var
|
|
1740
|
-
function be(n) {
|
|
1741
|
-
return n in St;
|
|
1742
|
-
}
|
|
1742
|
+
var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
|
|
1743
1743
|
function ve(n) {
|
|
1744
|
-
return n
|
|
1744
|
+
return n in St;
|
|
1745
1745
|
}
|
|
1746
1746
|
function we(n) {
|
|
1747
|
+
return n ? ve(n) ? St[n] : n : St.md;
|
|
1748
|
+
}
|
|
1749
|
+
function xe(n) {
|
|
1747
1750
|
if (!n) return "";
|
|
1748
1751
|
const t = [];
|
|
1749
1752
|
if (n.grayscale !== void 0 && t.push(`grayscale(${n.grayscale})`), n.blur !== void 0 && t.push(`blur(${n.blur}px)`), n.brightness !== void 0 && t.push(`brightness(${n.brightness})`), n.contrast !== void 0 && t.push(`contrast(${n.contrast})`), n.saturate !== void 0 && t.push(`saturate(${n.saturate})`), n.opacity !== void 0 && t.push(`opacity(${n.opacity})`), n.sepia !== void 0 && t.push(`sepia(${n.sepia})`), n.hueRotate !== void 0 && t.push(`hue-rotate(${n.hueRotate}deg)`), n.invert !== void 0 && t.push(`invert(${n.invert})`), n.dropShadow !== void 0)
|
|
@@ -1770,11 +1773,11 @@ function mt(n) {
|
|
|
1770
1773
|
n.borderRadiusTopLeft !== void 0 ? t.borderTopLeftRadius = `${n.borderRadiusTopLeft}px` : a && (t.borderTopLeftRadius = `${a}px`), n.borderRadiusTopRight !== void 0 ? t.borderTopRightRadius = `${n.borderRadiusTopRight}px` : a && (t.borderTopRightRadius = `${a}px`), n.borderRadiusBottomRight !== void 0 ? t.borderBottomRightRadius = `${n.borderRadiusBottomRight}px` : a && (t.borderBottomRightRadius = `${a}px`), n.borderRadiusBottomLeft !== void 0 ? t.borderBottomLeftRadius = `${n.borderRadiusBottomLeft}px` : a && (t.borderBottomLeftRadius = `${a}px`);
|
|
1771
1774
|
} else ((c = n.border) == null ? void 0 : c.radius) !== void 0 && (t.borderRadius = `${n.border.radius}px`);
|
|
1772
1775
|
if (n.borderTop || n.borderRight || n.borderBottom || n.borderLeft) {
|
|
1773
|
-
const a = n.border || {}, h = { ...a, ...n.borderTop }, l = { ...a, ...n.borderRight },
|
|
1774
|
-
t.borderTop = ct(h), t.borderRight = ct(l), t.borderBottom = ct(
|
|
1776
|
+
const a = n.border || {}, h = { ...a, ...n.borderTop }, l = { ...a, ...n.borderRight }, u = { ...a, ...n.borderBottom }, r = { ...a, ...n.borderLeft };
|
|
1777
|
+
t.borderTop = ct(h), t.borderRight = ct(l), t.borderBottom = ct(u), t.borderLeft = ct(r);
|
|
1775
1778
|
} else n.border && (t.border = ct(n.border));
|
|
1776
|
-
n.shadow !== void 0 && (t.boxShadow =
|
|
1777
|
-
const o =
|
|
1779
|
+
n.shadow !== void 0 && (t.boxShadow = we(n.shadow));
|
|
1780
|
+
const o = xe(n.filter);
|
|
1778
1781
|
if (o && (t.filter = o), n.opacity !== void 0 && (t.opacity = String(n.opacity)), n.cursor !== void 0 && (t.cursor = n.cursor), n.outline && n.outline.style !== "none" && (n.outline.width ?? 0) > 0) {
|
|
1779
1782
|
const a = n.outline.width ?? 0, h = n.outline.style ?? "solid", l = n.outline.color ?? "#000000";
|
|
1780
1783
|
t.outline = `${a}px ${h} ${l}`, n.outline.offset !== void 0 && (t.outlineOffset = `${n.outline.offset}px`);
|
|
@@ -1803,10 +1806,10 @@ const Ct = {
|
|
|
1803
1806
|
UNFOCUSING: 999,
|
|
1804
1807
|
FOCUSING: 1e3
|
|
1805
1808
|
};
|
|
1806
|
-
class
|
|
1809
|
+
class Se {
|
|
1807
1810
|
constructor(t, e, i) {
|
|
1808
1811
|
var o, s;
|
|
1809
|
-
this.state =
|
|
1812
|
+
this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = e, this.defaultStyles = mt(i == null ? void 0 : i.default), this.focusedStyles = mt(i == null ? void 0 : i.focused), this.defaultClassName = (o = i == null ? void 0 : i.default) == null ? void 0 : o.className, this.focusedClassName = (s = i == null ? void 0 : i.focused) == null ? void 0 : s.className;
|
|
1810
1813
|
}
|
|
1811
1814
|
/**
|
|
1812
1815
|
* Get current state machine state
|
|
@@ -1818,7 +1821,7 @@ class xe {
|
|
|
1818
1821
|
* Check if any animation is in progress
|
|
1819
1822
|
*/
|
|
1820
1823
|
isAnimating() {
|
|
1821
|
-
return this.state !==
|
|
1824
|
+
return this.state !== I.IDLE && this.state !== I.FOCUSED;
|
|
1822
1825
|
}
|
|
1823
1826
|
/**
|
|
1824
1827
|
* Normalize scalePercent value
|
|
@@ -1866,7 +1869,7 @@ class xe {
|
|
|
1866
1869
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
1867
1870
|
*/
|
|
1868
1871
|
animateWithDimensions(t, e, i, o, s, c, a, h) {
|
|
1869
|
-
const l = this.buildDimensionZoomTransform(e),
|
|
1872
|
+
const l = this.buildDimensionZoomTransform(e), u = this.buildDimensionZoomTransform(i);
|
|
1870
1873
|
return t.style.transition = "none", t.animate(
|
|
1871
1874
|
[
|
|
1872
1875
|
{
|
|
@@ -1875,7 +1878,7 @@ class xe {
|
|
|
1875
1878
|
height: `${s}px`
|
|
1876
1879
|
},
|
|
1877
1880
|
{
|
|
1878
|
-
transform:
|
|
1881
|
+
transform: u,
|
|
1879
1882
|
width: `${c}px`,
|
|
1880
1883
|
height: `${a}px`
|
|
1881
1884
|
}
|
|
@@ -1906,7 +1909,7 @@ class xe {
|
|
|
1906
1909
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1907
1910
|
*/
|
|
1908
1911
|
startFocusAnimation(t, e, i, o, s) {
|
|
1909
|
-
const c = t.style.zIndex || "", a = t.offsetWidth, h = t.offsetHeight, l = this.calculateFocusDimensions(a, h, e),
|
|
1912
|
+
const c = t.style.zIndex || "", a = t.offsetWidth, h = t.offsetHeight, l = this.calculateFocusDimensions(a, h, e), u = this.calculateFocusTransform(e, i);
|
|
1910
1913
|
this.applyFocusedStyling(t, Ct.FOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1911
1914
|
const r = o ?? {
|
|
1912
1915
|
x: 0,
|
|
@@ -1917,25 +1920,25 @@ class xe {
|
|
|
1917
1920
|
}, d = (s == null ? void 0 : s.width) ?? a, f = (s == null ? void 0 : s.height) ?? h, y = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
|
|
1918
1921
|
t,
|
|
1919
1922
|
r,
|
|
1920
|
-
|
|
1923
|
+
u,
|
|
1921
1924
|
d,
|
|
1922
1925
|
f,
|
|
1923
1926
|
l.width,
|
|
1924
1927
|
l.height,
|
|
1925
1928
|
y
|
|
1926
|
-
),
|
|
1929
|
+
), g = {
|
|
1927
1930
|
id: `focus-${Date.now()}`,
|
|
1928
1931
|
element: t,
|
|
1929
1932
|
animation: p,
|
|
1930
1933
|
fromState: r,
|
|
1931
|
-
toState:
|
|
1934
|
+
toState: u,
|
|
1932
1935
|
startTime: performance.now(),
|
|
1933
1936
|
duration: y
|
|
1934
1937
|
};
|
|
1935
1938
|
return this.focusData = {
|
|
1936
1939
|
element: t,
|
|
1937
1940
|
originalState: i,
|
|
1938
|
-
focusTransform:
|
|
1941
|
+
focusTransform: u,
|
|
1939
1942
|
originalZIndex: c,
|
|
1940
1943
|
originalWidth: a,
|
|
1941
1944
|
originalHeight: h,
|
|
@@ -1944,7 +1947,7 @@ class xe {
|
|
|
1944
1947
|
}, {
|
|
1945
1948
|
element: t,
|
|
1946
1949
|
originalState: i,
|
|
1947
|
-
animationHandle:
|
|
1950
|
+
animationHandle: g,
|
|
1948
1951
|
direction: "in",
|
|
1949
1952
|
originalWidth: a,
|
|
1950
1953
|
originalHeight: h
|
|
@@ -1956,22 +1959,22 @@ class xe {
|
|
|
1956
1959
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1957
1960
|
*/
|
|
1958
1961
|
startUnfocusAnimation(t, e, i, o) {
|
|
1959
|
-
var y, p,
|
|
1962
|
+
var y, p, g, m, v;
|
|
1960
1963
|
t.style.zIndex = String(Ct.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1961
|
-
const s = i ?? ((y = this.focusData) == null ? void 0 : y.focusTransform) ?? { x: 0, y: 0, rotation: 0, scale: 1 }, c = (o == null ? void 0 : o.width) ?? ((p = this.focusData) == null ? void 0 : p.focusWidth) ?? t.offsetWidth, a = (o == null ? void 0 : o.height) ?? ((
|
|
1964
|
+
const s = i ?? ((y = this.focusData) == null ? void 0 : y.focusTransform) ?? { x: 0, y: 0, rotation: 0, scale: 1 }, c = (o == null ? void 0 : o.width) ?? ((p = this.focusData) == null ? void 0 : p.focusWidth) ?? t.offsetWidth, a = (o == null ? void 0 : o.height) ?? ((g = this.focusData) == null ? void 0 : g.focusHeight) ?? t.offsetHeight, h = {
|
|
1962
1965
|
x: 0,
|
|
1963
1966
|
y: 0,
|
|
1964
1967
|
rotation: e.rotation,
|
|
1965
1968
|
scale: 1
|
|
1966
1969
|
// No scale - using dimensions
|
|
1967
|
-
}, l = ((m = this.focusData) == null ? void 0 : m.originalWidth) ?? t.offsetWidth,
|
|
1970
|
+
}, l = ((m = this.focusData) == null ? void 0 : m.originalWidth) ?? t.offsetWidth, u = ((v = this.focusData) == null ? void 0 : v.originalHeight) ?? t.offsetHeight, r = this.config.animationDuration ?? 600, d = this.animateWithDimensions(
|
|
1968
1971
|
t,
|
|
1969
1972
|
s,
|
|
1970
1973
|
h,
|
|
1971
1974
|
c,
|
|
1972
1975
|
a,
|
|
1973
1976
|
l,
|
|
1974
|
-
|
|
1977
|
+
u,
|
|
1975
1978
|
r
|
|
1976
1979
|
), f = {
|
|
1977
1980
|
id: `unfocus-${Date.now()}`,
|
|
@@ -1988,7 +1991,7 @@ class xe {
|
|
|
1988
1991
|
animationHandle: f,
|
|
1989
1992
|
direction: "out",
|
|
1990
1993
|
originalWidth: l,
|
|
1991
|
-
originalHeight:
|
|
1994
|
+
originalHeight: u
|
|
1992
1995
|
};
|
|
1993
1996
|
}
|
|
1994
1997
|
/**
|
|
@@ -2013,36 +2016,36 @@ class xe {
|
|
|
2013
2016
|
* Implements cross-animation when swapping focus
|
|
2014
2017
|
*/
|
|
2015
2018
|
async focusImage(t, e, i) {
|
|
2016
|
-
var s, c, a, h, l,
|
|
2017
|
-
if (this.currentFocus === t && this.state ===
|
|
2019
|
+
var s, c, a, h, l, u, r, d, f, y, p, g;
|
|
2020
|
+
if (this.currentFocus === t && this.state === I.FOCUSED)
|
|
2018
2021
|
return this.unfocusImage();
|
|
2019
|
-
if (((s = this.incoming) == null ? void 0 : s.element) === t && this.state ===
|
|
2020
|
-
const m = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0),
|
|
2022
|
+
if (((s = this.incoming) == null ? void 0 : s.element) === t && this.state === I.FOCUSING) {
|
|
2023
|
+
const m = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), v = {
|
|
2021
2024
|
x: m.x,
|
|
2022
2025
|
y: m.y,
|
|
2023
2026
|
rotation: m.rotation,
|
|
2024
2027
|
scale: 1
|
|
2025
2028
|
// No scale transform - using dimensions
|
|
2026
|
-
},
|
|
2029
|
+
}, w = {
|
|
2027
2030
|
width: t.offsetWidth,
|
|
2028
2031
|
height: t.offsetHeight
|
|
2029
2032
|
};
|
|
2030
2033
|
this.outgoing = this.startUnfocusAnimation(
|
|
2031
2034
|
t,
|
|
2032
2035
|
this.incoming.originalState,
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
), this.incoming = null, this.state =
|
|
2036
|
+
v,
|
|
2037
|
+
w
|
|
2038
|
+
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, ((c = this.focusData) == null ? void 0 : c.originalZIndex) || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2036
2039
|
return;
|
|
2037
2040
|
}
|
|
2038
2041
|
const o = ++this.focusGeneration;
|
|
2039
2042
|
switch (this.state) {
|
|
2040
|
-
case
|
|
2041
|
-
if (this.state =
|
|
2042
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2043
|
+
case I.IDLE:
|
|
2044
|
+
if (this.state = I.FOCUSING, this.incoming = this.startFocusAnimation(t, e, i), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
|
|
2045
|
+
this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2043
2046
|
break;
|
|
2044
|
-
case
|
|
2045
|
-
if (this.state =
|
|
2047
|
+
case I.FOCUSED:
|
|
2048
|
+
if (this.state = I.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2046
2049
|
this.currentFocus,
|
|
2047
2050
|
this.focusData.originalState
|
|
2048
2051
|
)), this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
@@ -2050,41 +2053,41 @@ class xe {
|
|
|
2050
2053
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2051
2054
|
]), this.focusGeneration !== o)
|
|
2052
2055
|
return;
|
|
2053
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((a = this.outgoing.originalState.zIndex) == null ? void 0 : a.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2056
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((a = this.outgoing.originalState.zIndex) == null ? void 0 : a.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2054
2057
|
break;
|
|
2055
|
-
case
|
|
2058
|
+
case I.FOCUSING:
|
|
2056
2059
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2057
2060
|
this.incoming.element,
|
|
2058
2061
|
this.incoming.originalState,
|
|
2059
2062
|
((h = this.focusData) == null ? void 0 : h.originalZIndex) || "",
|
|
2060
2063
|
(l = this.focusData) == null ? void 0 : l.originalWidth,
|
|
2061
|
-
(
|
|
2064
|
+
(u = this.focusData) == null ? void 0 : u.originalHeight
|
|
2062
2065
|
), this.incoming = null), this.incoming = this.startFocusAnimation(t, e, i), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
|
|
2063
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2066
|
+
this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2064
2067
|
break;
|
|
2065
|
-
case
|
|
2066
|
-
if (this.state =
|
|
2068
|
+
case I.UNFOCUSING:
|
|
2069
|
+
if (this.state = I.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
2067
2070
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2068
2071
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2069
2072
|
]), this.focusGeneration !== o) return;
|
|
2070
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((r = this.outgoing.originalState.zIndex) == null ? void 0 : r.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2073
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((r = this.outgoing.originalState.zIndex) == null ? void 0 : r.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2071
2074
|
break;
|
|
2072
|
-
case
|
|
2075
|
+
case I.CROSS_ANIMATING:
|
|
2073
2076
|
if (((d = this.incoming) == null ? void 0 : d.element) === t)
|
|
2074
2077
|
return;
|
|
2075
2078
|
if (((f = this.outgoing) == null ? void 0 : f.element) === t) {
|
|
2076
|
-
const m = this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !0),
|
|
2079
|
+
const m = this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !0), v = {
|
|
2077
2080
|
x: m.x,
|
|
2078
2081
|
y: m.y,
|
|
2079
2082
|
rotation: m.rotation,
|
|
2080
2083
|
scale: 1
|
|
2081
2084
|
// No scale - using dimensions
|
|
2082
|
-
},
|
|
2085
|
+
}, w = {
|
|
2083
2086
|
width: t.offsetWidth,
|
|
2084
2087
|
height: t.offsetHeight
|
|
2085
2088
|
};
|
|
2086
2089
|
if (this.incoming) {
|
|
2087
|
-
const E = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0),
|
|
2090
|
+
const E = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), A = {
|
|
2088
2091
|
x: E.x,
|
|
2089
2092
|
y: E.y,
|
|
2090
2093
|
rotation: E.rotation,
|
|
@@ -2097,16 +2100,16 @@ class xe {
|
|
|
2097
2100
|
this.outgoing = this.startUnfocusAnimation(
|
|
2098
2101
|
this.incoming.element,
|
|
2099
2102
|
this.incoming.originalState,
|
|
2100
|
-
|
|
2103
|
+
A,
|
|
2101
2104
|
x
|
|
2102
2105
|
);
|
|
2103
2106
|
} else
|
|
2104
2107
|
this.outgoing = null;
|
|
2105
|
-
if (this.incoming = this.startFocusAnimation(t, e, i,
|
|
2108
|
+
if (this.incoming = this.startFocusAnimation(t, e, i, v, w), await Promise.all([
|
|
2106
2109
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2107
2110
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2108
2111
|
]), this.focusGeneration !== o) return;
|
|
2109
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((y = this.outgoing.originalState.zIndex) == null ? void 0 : y.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2112
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((y = this.outgoing.originalState.zIndex) == null ? void 0 : y.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2110
2113
|
return;
|
|
2111
2114
|
}
|
|
2112
2115
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2116,28 +2119,28 @@ class xe {
|
|
|
2116
2119
|
this.outgoing.originalWidth,
|
|
2117
2120
|
this.outgoing.originalHeight
|
|
2118
2121
|
), this.outgoing = null), this.incoming) {
|
|
2119
|
-
const m = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0),
|
|
2122
|
+
const m = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), v = {
|
|
2120
2123
|
x: m.x,
|
|
2121
2124
|
y: m.y,
|
|
2122
2125
|
rotation: m.rotation,
|
|
2123
2126
|
scale: 1
|
|
2124
2127
|
// No scale - using dimensions
|
|
2125
|
-
},
|
|
2128
|
+
}, w = {
|
|
2126
2129
|
width: this.incoming.element.offsetWidth,
|
|
2127
2130
|
height: this.incoming.element.offsetHeight
|
|
2128
2131
|
};
|
|
2129
2132
|
this.outgoing = this.startUnfocusAnimation(
|
|
2130
2133
|
this.incoming.element,
|
|
2131
2134
|
this.incoming.originalState,
|
|
2132
|
-
|
|
2133
|
-
|
|
2135
|
+
v,
|
|
2136
|
+
w
|
|
2134
2137
|
);
|
|
2135
2138
|
}
|
|
2136
2139
|
if (this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
2137
2140
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2138
2141
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2139
2142
|
]), this.focusGeneration !== o) return;
|
|
2140
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((
|
|
2143
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((g = this.outgoing.originalState.zIndex) == null ? void 0 : g.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = I.FOCUSED;
|
|
2141
2144
|
break;
|
|
2142
2145
|
}
|
|
2143
2146
|
}
|
|
@@ -2148,14 +2151,14 @@ class xe {
|
|
|
2148
2151
|
var s, c, a;
|
|
2149
2152
|
const t = ++this.focusGeneration;
|
|
2150
2153
|
if (!this.currentFocus || !this.focusData) {
|
|
2151
|
-
if (this.incoming && this.state ===
|
|
2154
|
+
if (this.incoming && this.state === I.FOCUSING) {
|
|
2152
2155
|
const h = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), l = {
|
|
2153
2156
|
x: h.x,
|
|
2154
2157
|
y: h.y,
|
|
2155
2158
|
rotation: h.rotation,
|
|
2156
2159
|
scale: 1
|
|
2157
2160
|
// No scale - using dimensions
|
|
2158
|
-
},
|
|
2161
|
+
}, u = {
|
|
2159
2162
|
width: this.incoming.element.offsetWidth,
|
|
2160
2163
|
height: this.incoming.element.offsetHeight
|
|
2161
2164
|
};
|
|
@@ -2163,38 +2166,38 @@ class xe {
|
|
|
2163
2166
|
this.incoming.element,
|
|
2164
2167
|
this.incoming.originalState,
|
|
2165
2168
|
l,
|
|
2166
|
-
|
|
2167
|
-
), this.incoming = null, this.state =
|
|
2168
|
-
this.removeFocusedStyling(this.outgoing.element, ((s = this.focusData) == null ? void 0 : s.originalZIndex) || ""), this.outgoing = null, this.focusData = null, this.state =
|
|
2169
|
+
u
|
|
2170
|
+
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2171
|
+
this.removeFocusedStyling(this.outgoing.element, ((s = this.focusData) == null ? void 0 : s.originalZIndex) || ""), this.outgoing = null, this.focusData = null, this.state = I.IDLE;
|
|
2169
2172
|
}
|
|
2170
2173
|
return;
|
|
2171
2174
|
}
|
|
2172
|
-
if (this.state ===
|
|
2175
|
+
if (this.state === I.CROSS_ANIMATING && this.incoming) {
|
|
2173
2176
|
const h = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), l = {
|
|
2174
2177
|
x: h.x,
|
|
2175
2178
|
y: h.y,
|
|
2176
2179
|
rotation: h.rotation,
|
|
2177
2180
|
scale: 1
|
|
2178
2181
|
// No scale - using dimensions
|
|
2179
|
-
},
|
|
2182
|
+
}, u = {
|
|
2180
2183
|
width: this.incoming.element.offsetWidth,
|
|
2181
2184
|
height: this.incoming.element.offsetHeight
|
|
2182
2185
|
}, r = this.startUnfocusAnimation(
|
|
2183
2186
|
this.incoming.element,
|
|
2184
2187
|
this.incoming.originalState,
|
|
2185
2188
|
l,
|
|
2186
|
-
|
|
2189
|
+
u
|
|
2187
2190
|
);
|
|
2188
2191
|
if (await Promise.all([
|
|
2189
2192
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2190
2193
|
this.waitForAnimation(r.animationHandle)
|
|
2191
2194
|
]), this.focusGeneration !== t) return;
|
|
2192
|
-
this.outgoing && this.removeFocusedStyling(this.outgoing.element, ((c = this.outgoing.originalState.zIndex) == null ? void 0 : c.toString()) || ""), this.removeFocusedStyling(r.element, ((a = this.incoming.originalState.zIndex) == null ? void 0 : a.toString()) || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state =
|
|
2195
|
+
this.outgoing && this.removeFocusedStyling(this.outgoing.element, ((c = this.outgoing.originalState.zIndex) == null ? void 0 : c.toString()) || ""), this.removeFocusedStyling(r.element, ((a = this.incoming.originalState.zIndex) == null ? void 0 : a.toString()) || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2193
2196
|
return;
|
|
2194
2197
|
}
|
|
2195
|
-
this.state =
|
|
2198
|
+
this.state = I.UNFOCUSING;
|
|
2196
2199
|
const e = this.currentFocus, i = this.focusData.originalState, o = this.focusData.originalZIndex;
|
|
2197
|
-
this.outgoing = this.startUnfocusAnimation(e, i), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(e, o), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state =
|
|
2200
|
+
this.outgoing = this.startUnfocusAnimation(e, i), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(e, o), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE);
|
|
2198
2201
|
}
|
|
2199
2202
|
/**
|
|
2200
2203
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2212,7 +2215,7 @@ class xe {
|
|
|
2212
2215
|
* Check if an image is currently focused (stable state)
|
|
2213
2216
|
*/
|
|
2214
2217
|
isFocused(t) {
|
|
2215
|
-
return this.currentFocus === t && this.state ===
|
|
2218
|
+
return this.currentFocus === t && this.state === I.FOCUSED;
|
|
2216
2219
|
}
|
|
2217
2220
|
/**
|
|
2218
2221
|
* Check if an image is the target of current focus animation
|
|
@@ -2253,10 +2256,10 @@ class xe {
|
|
|
2253
2256
|
this.focusData.originalZIndex,
|
|
2254
2257
|
this.focusData.originalWidth,
|
|
2255
2258
|
this.focusData.originalHeight
|
|
2256
|
-
), this.state =
|
|
2259
|
+
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2257
2260
|
}
|
|
2258
2261
|
}
|
|
2259
|
-
class
|
|
2262
|
+
class Ie {
|
|
2260
2263
|
constructor(t = {}) {
|
|
2261
2264
|
if (this._prepared = !1, this._discoveredUrls = [], this.apiKey = t.apiKey ?? "", this.apiEndpoint = t.apiEndpoint ?? "https://www.googleapis.com/drive/v3/files", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
2262
2265
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2352,10 +2355,10 @@ class Se {
|
|
|
2352
2355
|
if (!a.ok)
|
|
2353
2356
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2354
2357
|
const l = (await a.json()).files.filter(
|
|
2355
|
-
(
|
|
2358
|
+
(u) => u.mimeType.startsWith("image/") && e.isAllowed(u.name)
|
|
2356
2359
|
);
|
|
2357
|
-
return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((
|
|
2358
|
-
i.push(`https://lh3.googleusercontent.com/d/${
|
|
2360
|
+
return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
|
|
2361
|
+
i.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2359
2362
|
}), i;
|
|
2360
2363
|
}
|
|
2361
2364
|
/**
|
|
@@ -2423,13 +2426,13 @@ class Se {
|
|
|
2423
2426
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2424
2427
|
const h = await a.json(), l = h.files.filter(
|
|
2425
2428
|
(r) => r.mimeType.startsWith("image/") && e.isAllowed(r.name)
|
|
2426
|
-
),
|
|
2429
|
+
), u = h.files.filter(
|
|
2427
2430
|
(r) => r.mimeType === "application/vnd.google-apps.folder"
|
|
2428
2431
|
);
|
|
2429
|
-
this.log(`Found ${h.files.length} total items in folder ${t}`), h.files.forEach((r) => this.log(` - File: ${r.name} (${r.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${
|
|
2432
|
+
this.log(`Found ${h.files.length} total items in folder ${t}`), h.files.forEach((r) => this.log(` - File: ${r.name} (${r.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), l.forEach((r) => {
|
|
2430
2433
|
i.push(`https://lh3.googleusercontent.com/d/${r.id}=s1600`), this.log(`Added file: ${r.name}`);
|
|
2431
2434
|
});
|
|
2432
|
-
for (const r of
|
|
2435
|
+
for (const r of u) {
|
|
2433
2436
|
this.log(`Loading images from subfolder: ${r.name}`);
|
|
2434
2437
|
const d = await this.loadImagesRecursively(r.id, e);
|
|
2435
2438
|
i.push(...d);
|
|
@@ -2449,8 +2452,8 @@ class Se {
|
|
|
2449
2452
|
if (!o.ok)
|
|
2450
2453
|
throw new Error("Cannot access folder directly (CORS or permissions issue)");
|
|
2451
2454
|
const s = await o.text(), c = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(c)];
|
|
2452
|
-
return [...new Set(a.map((
|
|
2453
|
-
(
|
|
2455
|
+
return [...new Set(a.map((u) => u[1]))].map(
|
|
2456
|
+
(u) => `https://drive.google.com/uc?export=view&id=${u}`
|
|
2454
2457
|
);
|
|
2455
2458
|
} catch (i) {
|
|
2456
2459
|
throw console.error("Direct loading failed:", i), new Error(
|
|
@@ -2477,7 +2480,7 @@ class Se {
|
|
|
2477
2480
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2478
2481
|
}
|
|
2479
2482
|
}
|
|
2480
|
-
class
|
|
2483
|
+
class Ee {
|
|
2481
2484
|
constructor(t = {}) {
|
|
2482
2485
|
if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.sources = t.sources ?? [], this.debugLogging = t.debugLogging ?? !1, !this.sources || this.sources.length === 0)
|
|
2483
2486
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2694,7 +2697,7 @@ class Re {
|
|
|
2694
2697
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2695
2698
|
}
|
|
2696
2699
|
}
|
|
2697
|
-
class
|
|
2700
|
+
class Ae {
|
|
2698
2701
|
/**
|
|
2699
2702
|
* Create a new ImageFilter
|
|
2700
2703
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2732,16 +2735,63 @@ class Ee {
|
|
|
2732
2735
|
// isAllowedDate(date: Date): boolean
|
|
2733
2736
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2734
2737
|
}
|
|
2735
|
-
|
|
2738
|
+
const Te = `
|
|
2739
|
+
.fbn-ic-gallery {
|
|
2740
|
+
position: relative;
|
|
2741
|
+
width: 100%;
|
|
2742
|
+
height: 100%;
|
|
2743
|
+
overflow: hidden;
|
|
2744
|
+
perspective: 1000px;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
.fbn-ic-image {
|
|
2748
|
+
position: absolute;
|
|
2749
|
+
cursor: pointer;
|
|
2750
|
+
transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2751
|
+
box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2752
|
+
filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2753
|
+
opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2754
|
+
border 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2755
|
+
outline 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2756
|
+
z-index 0s 0.6s;
|
|
2757
|
+
will-change: transform;
|
|
2758
|
+
user-select: none;
|
|
2759
|
+
backface-visibility: hidden;
|
|
2760
|
+
-webkit-backface-visibility: hidden;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
.fbn-ic-image.fbn-ic-focused {
|
|
2764
|
+
z-index: 1000;
|
|
2765
|
+
transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2766
|
+
box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2767
|
+
filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2768
|
+
opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2769
|
+
border 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2770
|
+
outline 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
2771
|
+
z-index 0s 0s;
|
|
2772
|
+
will-change: auto;
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
.fbn-ic-hidden {
|
|
2776
|
+
display: none !important;
|
|
2777
|
+
}
|
|
2778
|
+
`;
|
|
2779
|
+
function Me() {
|
|
2780
|
+
if (typeof document > "u") return;
|
|
2781
|
+
const n = "fbn-ic-functional-styles";
|
|
2782
|
+
if (document.getElementById(n)) return;
|
|
2783
|
+
const t = document.createElement("style");
|
|
2784
|
+
t.id = n, t.textContent = Te, document.head.appendChild(t);
|
|
2785
|
+
}
|
|
2786
|
+
class ze {
|
|
2736
2787
|
constructor(t = {}) {
|
|
2737
2788
|
var i, o, s, c, a, h;
|
|
2738
|
-
this.fullConfig =
|
|
2789
|
+
this.fullConfig = Yt(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.animationEngine = new Jt(this.fullConfig.animation), this.layoutEngine = new be({
|
|
2739
2790
|
layout: this.fullConfig.layout,
|
|
2740
|
-
image: this.fullConfig.image
|
|
2741
|
-
|
|
2742
|
-
}), this.zoomEngine = new xe(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = mt((i = this.fullConfig.styling) == null ? void 0 : i.default), this.hoverStyles = mt((o = this.fullConfig.styling) == null ? void 0 : o.hover), this.defaultClassName = (c = (s = this.fullConfig.styling) == null ? void 0 : s.default) == null ? void 0 : c.className, this.hoverClassName = (h = (a = this.fullConfig.styling) == null ? void 0 : a.hover) == null ? void 0 : h.className;
|
|
2791
|
+
image: this.fullConfig.image
|
|
2792
|
+
}), this.zoomEngine = new Se(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = mt((i = this.fullConfig.styling) == null ? void 0 : i.default), this.hoverStyles = mt((o = this.fullConfig.styling) == null ? void 0 : o.hover), this.defaultClassName = (c = (s = this.fullConfig.styling) == null ? void 0 : s.default) == null ? void 0 : c.className, this.hoverClassName = (h = (a = this.fullConfig.styling) == null ? void 0 : a.hover) == null ? void 0 : h.className;
|
|
2743
2793
|
const e = this.fullConfig.animation.entry || b.animation.entry;
|
|
2744
|
-
this.entryAnimationEngine = new
|
|
2794
|
+
this.entryAnimationEngine = new re(
|
|
2745
2795
|
e,
|
|
2746
2796
|
this.fullConfig.layout.algorithm
|
|
2747
2797
|
), this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
@@ -2753,7 +2803,7 @@ class Ae {
|
|
|
2753
2803
|
var i, o;
|
|
2754
2804
|
const t = this.fullConfig.loader.type;
|
|
2755
2805
|
let e;
|
|
2756
|
-
return t === "googleDrive" ? e = (i = this.fullConfig.loader.googleDrive) == null ? void 0 : i.allowedExtensions : e = (o = this.fullConfig.loader.static) == null ? void 0 : o.allowedExtensions, new
|
|
2806
|
+
return t === "googleDrive" ? e = (i = this.fullConfig.loader.googleDrive) == null ? void 0 : i.allowedExtensions : e = (o = this.fullConfig.loader.static) == null ? void 0 : o.allowedExtensions, new Ae(e);
|
|
2757
2807
|
}
|
|
2758
2808
|
/**
|
|
2759
2809
|
* Create appropriate image loader based on config
|
|
@@ -2768,7 +2818,7 @@ class Ae {
|
|
|
2768
2818
|
const e = t.type;
|
|
2769
2819
|
if (e === "static") {
|
|
2770
2820
|
const i = t.static;
|
|
2771
|
-
return new
|
|
2821
|
+
return new Ee(i);
|
|
2772
2822
|
} else if (e === "composite") {
|
|
2773
2823
|
const i = t.composite, o = i.loaders.map(
|
|
2774
2824
|
(s) => this.createLoaderFromConfig(s)
|
|
@@ -2779,7 +2829,7 @@ class Ae {
|
|
|
2779
2829
|
});
|
|
2780
2830
|
} else {
|
|
2781
2831
|
const i = t.googleDrive;
|
|
2782
|
-
return new
|
|
2832
|
+
return new Ie(i);
|
|
2783
2833
|
}
|
|
2784
2834
|
}
|
|
2785
2835
|
/**
|
|
@@ -2787,7 +2837,7 @@ class Ae {
|
|
|
2787
2837
|
*/
|
|
2788
2838
|
async init() {
|
|
2789
2839
|
try {
|
|
2790
|
-
if (this.containerRef)
|
|
2840
|
+
if (Me(), this.containerRef)
|
|
2791
2841
|
this.containerEl = this.containerRef;
|
|
2792
2842
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
2793
2843
|
throw new Error(`Container #${this.containerId} not found`);
|
|
@@ -2837,11 +2887,8 @@ class Ae {
|
|
|
2837
2887
|
}, 500));
|
|
2838
2888
|
}
|
|
2839
2889
|
getImageHeight() {
|
|
2840
|
-
const t = window.innerWidth, e = this.fullConfig.layout.sizing.
|
|
2841
|
-
|
|
2842
|
-
if (t >= i.minWidth)
|
|
2843
|
-
return i.height;
|
|
2844
|
-
return 120;
|
|
2890
|
+
const t = window.innerWidth, e = this.fullConfig.layout.responsive, i = this.fullConfig.image.sizing, o = (i == null ? void 0 : i.maxSize) ?? 400;
|
|
2891
|
+
return e ? t <= e.mobile.maxWidth ? Math.min(100, o) : t <= e.tablet.maxWidth ? Math.min(180, o) : Math.min(225, o) : t <= 767 ? Math.min(100, o) : t <= 1199 ? Math.min(180, o) : Math.min(225, o);
|
|
2845
2892
|
}
|
|
2846
2893
|
/**
|
|
2847
2894
|
* Get container bounds for layout calculations
|
|
@@ -2899,8 +2946,8 @@ class Ae {
|
|
|
2899
2946
|
}, f = {
|
|
2900
2947
|
x: parseFloat(l.dataset.endX),
|
|
2901
2948
|
y: parseFloat(l.dataset.endY)
|
|
2902
|
-
}, y = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight),
|
|
2903
|
-
|
|
2949
|
+
}, y = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), g = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), v = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : g, w = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, E = this.entryAnimationEngine.getTiming();
|
|
2950
|
+
oe({
|
|
2904
2951
|
element: l,
|
|
2905
2952
|
startPosition: d,
|
|
2906
2953
|
endPosition: f,
|
|
@@ -2908,12 +2955,12 @@ class Ae {
|
|
|
2908
2955
|
duration: E.duration,
|
|
2909
2956
|
imageWidth: y,
|
|
2910
2957
|
imageHeight: p,
|
|
2911
|
-
rotation:
|
|
2958
|
+
rotation: g,
|
|
2912
2959
|
scale: m,
|
|
2913
2960
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
2914
|
-
startRotation:
|
|
2961
|
+
startRotation: v,
|
|
2915
2962
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
2916
|
-
startScale:
|
|
2963
|
+
startScale: w
|
|
2917
2964
|
});
|
|
2918
2965
|
} else {
|
|
2919
2966
|
const d = l.dataset.finalTransform || "";
|
|
@@ -2955,24 +3002,24 @@ class Ae {
|
|
|
2955
3002
|
}, this.fullConfig.animation.queue.interval);
|
|
2956
3003
|
};
|
|
2957
3004
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
2958
|
-
const l = new IntersectionObserver((
|
|
2959
|
-
|
|
3005
|
+
const l = new IntersectionObserver((u) => {
|
|
3006
|
+
u.forEach((r) => {
|
|
2960
3007
|
r.isIntersecting && (h(), l.disconnect());
|
|
2961
3008
|
});
|
|
2962
3009
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
2963
3010
|
l.observe(this.containerEl);
|
|
2964
3011
|
} else
|
|
2965
3012
|
h();
|
|
2966
|
-
this.fullConfig.layout.debugCenters && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l,
|
|
3013
|
+
this.fullConfig.layout.debugCenters && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, u) => {
|
|
2967
3014
|
const r = document.createElement("div");
|
|
2968
3015
|
r.className = "fbn-ic-debug-center", r.style.position = "absolute", r.style.width = "12px", r.style.height = "12px", r.style.borderRadius = "50%", r.style.backgroundColor = "red", r.style.border = "2px solid yellow", r.style.zIndex = "9999", r.style.pointerEvents = "none";
|
|
2969
3016
|
const d = l.x, f = l.y;
|
|
2970
|
-
r.style.left = `${d - 6}px`, r.style.top = `${f - 6}px`, r.title = `Image ${
|
|
2971
|
-
})), t.forEach((l,
|
|
3017
|
+
r.style.left = `${d - 6}px`, r.style.top = `${f - 6}px`, r.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(f)})`, this.containerEl.appendChild(r);
|
|
3018
|
+
})), t.forEach((l, u) => {
|
|
2972
3019
|
var f, y;
|
|
2973
3020
|
const r = document.createElement("img");
|
|
2974
|
-
r.referrerPolicy = "no-referrer", r.classList.add("fbn-ic-image"), r.dataset.imageId = String(
|
|
2975
|
-
const d = s[
|
|
3021
|
+
r.referrerPolicy = "no-referrer", r.classList.add("fbn-ic-image"), r.dataset.imageId = String(u);
|
|
3022
|
+
const d = s[u];
|
|
2976
3023
|
r.style.position = "absolute", r.style.width = "auto", r.style.height = `${e}px`, r.style.left = `${d.x}px`, r.style.top = `${d.y}px`, d.borderColor && !((y = (f = this.fullConfig.styling) == null ? void 0 : f.default) != null && y.border) && (r.style.border = `5px solid ${d.borderColor}`, r.style.boxSizing = "border-box"), d.zIndex && (r.style.zIndex = String(d.zIndex)), lt(r, this.defaultStyles), ht(r, this.defaultClassName), r.addEventListener("mouseenter", () => {
|
|
2977
3024
|
this.hoveredImage = { element: r, layout: d }, this.zoomEngine.isInvolved(r) || (lt(r, this.hoverStyles), ht(r, this.hoverClassName));
|
|
2978
3025
|
}), r.addEventListener("mouseleave", () => {
|
|
@@ -2982,38 +3029,38 @@ class Ae {
|
|
|
2982
3029
|
}), r.style.opacity = "0", r.style.transition = this.entryAnimationEngine.getTransitionCSS(), r.onload = () => {
|
|
2983
3030
|
if (o !== this.loadGeneration)
|
|
2984
3031
|
return;
|
|
2985
|
-
const p = r.naturalWidth / r.naturalHeight,
|
|
2986
|
-
r.style.width = `${
|
|
2987
|
-
const m = { x: d.x, y: d.y },
|
|
3032
|
+
const p = r.naturalWidth / r.naturalHeight, g = e * p;
|
|
3033
|
+
r.style.width = `${g}px`;
|
|
3034
|
+
const m = { x: d.x, y: d.y }, v = { width: g, height: e }, w = this.entryAnimationEngine.calculateStartPosition(
|
|
2988
3035
|
m,
|
|
2989
|
-
|
|
3036
|
+
v,
|
|
2990
3037
|
i,
|
|
2991
|
-
|
|
3038
|
+
u,
|
|
2992
3039
|
t.length
|
|
2993
|
-
), E = this.entryAnimationEngine.calculateStartRotation(d.rotation),
|
|
3040
|
+
), E = this.entryAnimationEngine.calculateStartRotation(d.rotation), A = this.entryAnimationEngine.calculateStartScale(d.scale), x = this.entryAnimationEngine.buildFinalTransform(
|
|
2994
3041
|
d.rotation,
|
|
2995
3042
|
d.scale,
|
|
2996
|
-
|
|
3043
|
+
g,
|
|
2997
3044
|
e
|
|
2998
3045
|
), L = this.entryAnimationEngine.buildStartTransform(
|
|
2999
|
-
|
|
3046
|
+
w,
|
|
3000
3047
|
m,
|
|
3001
3048
|
d.rotation,
|
|
3002
3049
|
d.scale,
|
|
3003
|
-
|
|
3050
|
+
g,
|
|
3004
3051
|
e,
|
|
3005
3052
|
E,
|
|
3006
|
-
|
|
3053
|
+
A
|
|
3007
3054
|
);
|
|
3008
|
-
this.fullConfig.debug &&
|
|
3055
|
+
this.fullConfig.debug && u < 3 && console.log(`Image ${u}:`, {
|
|
3009
3056
|
finalPosition: m,
|
|
3010
|
-
imageSize:
|
|
3057
|
+
imageSize: v,
|
|
3011
3058
|
left: d.x,
|
|
3012
3059
|
top: d.y,
|
|
3013
3060
|
finalTransform: x,
|
|
3014
|
-
renderedWidth:
|
|
3061
|
+
renderedWidth: g,
|
|
3015
3062
|
renderedHeight: e
|
|
3016
|
-
}), r.style.transform = L, r.dataset.finalTransform = x, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== d.rotation ||
|
|
3063
|
+
}), r.style.transform = L, r.dataset.finalTransform = x, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== d.rotation || A !== d.scale) && (r.dataset.startX = String(w.x), r.dataset.startY = String(w.y), r.dataset.endX = String(m.x), r.dataset.endY = String(m.y), r.dataset.imageWidth = String(g), r.dataset.imageHeight = String(e), r.dataset.rotation = String(d.rotation), r.dataset.scale = String(d.scale), r.dataset.startRotation = String(E), r.dataset.startScale = String(A)), this.displayQueue.push(r);
|
|
3017
3064
|
}, r.onerror = () => c++, r.src = l;
|
|
3018
3065
|
});
|
|
3019
3066
|
}
|
|
@@ -3053,26 +3100,28 @@ class Ae {
|
|
|
3053
3100
|
}
|
|
3054
3101
|
}
|
|
3055
3102
|
export {
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3103
|
+
Jt as AnimationEngine,
|
|
3104
|
+
Tt as BOUNCE_PRESETS,
|
|
3105
|
+
pe as ClusterPlacementGenerator,
|
|
3059
3106
|
Re as CompositeLoader,
|
|
3060
3107
|
b as DEFAULT_CONFIG,
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
Ae as
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
oe as
|
|
3108
|
+
Mt as ELASTIC_PRESETS,
|
|
3109
|
+
re as EntryAnimationEngine,
|
|
3110
|
+
Te as FUNCTIONAL_CSS,
|
|
3111
|
+
Ie as GoogleDriveLoader,
|
|
3112
|
+
de as GridPlacementGenerator,
|
|
3113
|
+
ze as ImageCloud,
|
|
3114
|
+
Ae as ImageFilter,
|
|
3115
|
+
ze as ImageGallery,
|
|
3116
|
+
be as LayoutEngine,
|
|
3117
|
+
le as RadialPlacementGenerator,
|
|
3118
|
+
ce as RandomPlacementGenerator,
|
|
3119
|
+
me as SpiralPlacementGenerator,
|
|
3120
|
+
Ee as StaticImageLoader,
|
|
3121
|
+
zt as WAVE_PATH_PRESETS,
|
|
3122
|
+
Se as ZoomEngine,
|
|
3123
|
+
oe as animatePath,
|
|
3124
|
+
Me as injectFunctionalStyles,
|
|
3125
|
+
se as requiresJSAnimation
|
|
3077
3126
|
};
|
|
3078
3127
|
//# sourceMappingURL=image-cloud.js.map
|