@frybynite/image-cloud 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-cloud-auto-init.js +981 -896
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +701 -616
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +3 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +16 -5
- package/dist/react.d.ts +16 -5
- package/dist/react.js +694 -609
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +16 -5
- package/dist/vue.js +696 -611
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +16 -5
- package/dist/web-component.js +648 -563
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
package/dist/image-cloud.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const gt = Object.freeze({
|
|
2
2
|
none: "none",
|
|
3
3
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
4
4
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
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
|
+
}), xt = 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
|
+
}), Et = 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 }),
|
|
@@ -20,10 +20,10 @@ const ft = Object.freeze({
|
|
|
20
20
|
flutter: Object.freeze({ amplitude: 20, frequency: 4, decay: !0, decayRate: 0.5, phase: 0 })
|
|
21
21
|
}), pt = Object.freeze({
|
|
22
22
|
type: "linear"
|
|
23
|
-
}), bt = Object.freeze({
|
|
24
|
-
mode: "none"
|
|
25
23
|
}), yt = Object.freeze({
|
|
26
24
|
mode: "none"
|
|
25
|
+
}), bt = Object.freeze({
|
|
26
|
+
mode: "none"
|
|
27
27
|
}), Tt = Object.freeze({
|
|
28
28
|
default: Object.freeze({
|
|
29
29
|
border: Object.freeze({
|
|
@@ -50,14 +50,14 @@ const ft = Object.freeze({
|
|
|
50
50
|
focused: Object.freeze({
|
|
51
51
|
shadow: "none"
|
|
52
52
|
})
|
|
53
|
-
}),
|
|
53
|
+
}), Dt = Object.freeze({
|
|
54
54
|
rows: 1,
|
|
55
55
|
amplitude: 100,
|
|
56
56
|
frequency: 2,
|
|
57
57
|
phaseShift: 0,
|
|
58
58
|
synchronization: "offset"
|
|
59
59
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
60
|
-
}),
|
|
60
|
+
}), Ot = Object.freeze({
|
|
61
61
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
62
62
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
63
63
|
}), Pt = Object.freeze({
|
|
@@ -78,34 +78,34 @@ const ft = Object.freeze({
|
|
|
78
78
|
min: -15,
|
|
79
79
|
max: 15
|
|
80
80
|
})
|
|
81
|
-
}),
|
|
81
|
+
}), Rt = Object.freeze({
|
|
82
82
|
sizing: Pt,
|
|
83
83
|
rotation: Ut
|
|
84
|
-
}),
|
|
84
|
+
}), Mt = Object.freeze({
|
|
85
85
|
validateUrls: !0,
|
|
86
86
|
validationTimeout: 5e3,
|
|
87
87
|
validationMethod: "head",
|
|
88
88
|
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
|
|
89
|
-
}),
|
|
89
|
+
}), Lt = Object.freeze({
|
|
90
90
|
enabled: !1,
|
|
91
91
|
centers: !1,
|
|
92
92
|
loaders: !1
|
|
93
|
-
}),
|
|
93
|
+
}), b = Object.freeze({
|
|
94
94
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
95
95
|
loaders: [],
|
|
96
96
|
// Shared loader settings and debug config
|
|
97
97
|
config: Object.freeze({
|
|
98
|
-
loaders:
|
|
99
|
-
debug:
|
|
98
|
+
loaders: Mt,
|
|
99
|
+
debug: Lt
|
|
100
100
|
}),
|
|
101
101
|
// Image sizing and rotation configuration
|
|
102
|
-
image:
|
|
102
|
+
image: Rt,
|
|
103
103
|
// Pattern-based layout configuration
|
|
104
104
|
layout: Object.freeze({
|
|
105
105
|
algorithm: "radial",
|
|
106
106
|
scaleDecay: 0,
|
|
107
107
|
// No decay by default (0-1 for radial/spiral)
|
|
108
|
-
responsive:
|
|
108
|
+
responsive: Ot,
|
|
109
109
|
targetCoverage: 0.6,
|
|
110
110
|
// Target 60% of container area
|
|
111
111
|
densityFactor: 1,
|
|
@@ -162,8 +162,8 @@ const ft = Object.freeze({
|
|
|
162
162
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
|
|
163
163
|
// smooth deceleration
|
|
164
164
|
path: pt,
|
|
165
|
-
rotation:
|
|
166
|
-
scale:
|
|
165
|
+
rotation: yt,
|
|
166
|
+
scale: bt
|
|
167
167
|
})
|
|
168
168
|
}),
|
|
169
169
|
// Pattern-based interaction configuration
|
|
@@ -246,15 +246,15 @@ function Ht(n, t) {
|
|
|
246
246
|
...n.sizing,
|
|
247
247
|
...t.sizing
|
|
248
248
|
}, t.sizing.variance)) {
|
|
249
|
-
const i = t.sizing.variance, o = i.min !== void 0 && i.min >= 0.25 && i.min <= 1 ? i.min : n.sizing?.variance?.min ?? 1,
|
|
250
|
-
e.sizing.variance = { min: o, max:
|
|
249
|
+
const i = t.sizing.variance, o = i.min !== void 0 && i.min >= 0.25 && i.min <= 1 ? i.min : n.sizing?.variance?.min ?? 1, a = i.max !== void 0 && i.max >= 1 && i.max <= 1.75 ? i.max : n.sizing?.variance?.max ?? 1;
|
|
250
|
+
e.sizing.variance = { min: o, max: a };
|
|
251
251
|
}
|
|
252
252
|
if (t.rotation !== void 0 && (e.rotation = {
|
|
253
253
|
...n.rotation,
|
|
254
254
|
...t.rotation
|
|
255
255
|
}, t.rotation.range)) {
|
|
256
|
-
const i = t.rotation.range, o = i.min !== void 0 && i.min >= -180 && i.min <= 0 ? i.min : n.rotation?.range?.min ?? -15,
|
|
257
|
-
e.rotation.range = { min: o, max:
|
|
256
|
+
const i = t.rotation.range, o = i.min !== void 0 && i.min >= -180 && i.min <= 0 ? i.min : n.rotation?.range?.min ?? -15, a = i.max !== void 0 && i.max >= 0 && i.max <= 180 ? i.max : n.rotation?.range?.max ?? 15;
|
|
257
|
+
e.rotation.range = { min: o, max: a };
|
|
258
258
|
}
|
|
259
259
|
return e;
|
|
260
260
|
}
|
|
@@ -298,89 +298,89 @@ function kt(n = {}) {
|
|
|
298
298
|
});
|
|
299
299
|
const r = {
|
|
300
300
|
loaders: {
|
|
301
|
-
...
|
|
301
|
+
...Mt,
|
|
302
302
|
...n.config?.loaders ?? {}
|
|
303
303
|
}
|
|
304
|
-
},
|
|
304
|
+
}, s = {
|
|
305
305
|
loaders: o,
|
|
306
306
|
config: r,
|
|
307
|
-
image: Ht(
|
|
308
|
-
layout: { ...
|
|
309
|
-
animation: { ...
|
|
310
|
-
interaction: { ...
|
|
311
|
-
rendering: { ...
|
|
307
|
+
image: Ht(Rt, i),
|
|
308
|
+
layout: { ...b.layout },
|
|
309
|
+
animation: { ...b.animation },
|
|
310
|
+
interaction: { ...b.interaction },
|
|
311
|
+
rendering: { ...b.rendering },
|
|
312
312
|
styling: _t(Tt, n.styling)
|
|
313
313
|
};
|
|
314
|
-
return n.layout && (
|
|
315
|
-
...
|
|
314
|
+
return n.layout && (s.layout = {
|
|
315
|
+
...b.layout,
|
|
316
316
|
...n.layout
|
|
317
|
-
}, n.layout.responsive && (
|
|
318
|
-
...
|
|
319
|
-
mobile: n.layout.responsive.mobile ? { ...
|
|
320
|
-
tablet: n.layout.responsive.tablet ? { ...
|
|
321
|
-
}), n.layout.spacing && (
|
|
322
|
-
...
|
|
317
|
+
}, n.layout.responsive && (s.layout.responsive = {
|
|
318
|
+
...b.layout.responsive,
|
|
319
|
+
mobile: n.layout.responsive.mobile ? { ...b.layout.responsive.mobile, ...n.layout.responsive.mobile } : b.layout.responsive.mobile,
|
|
320
|
+
tablet: n.layout.responsive.tablet ? { ...b.layout.responsive.tablet, ...n.layout.responsive.tablet } : b.layout.responsive.tablet
|
|
321
|
+
}), n.layout.spacing && (s.layout.spacing = {
|
|
322
|
+
...b.layout.spacing,
|
|
323
323
|
...n.layout.spacing
|
|
324
|
-
})), n.animation && (
|
|
325
|
-
...
|
|
324
|
+
})), n.animation && (s.animation = {
|
|
325
|
+
...b.animation,
|
|
326
326
|
...n.animation
|
|
327
|
-
}, n.animation.easing && (
|
|
328
|
-
...
|
|
327
|
+
}, n.animation.easing && (s.animation.easing = {
|
|
328
|
+
...b.animation.easing,
|
|
329
329
|
...n.animation.easing
|
|
330
|
-
}), n.animation.queue && (
|
|
331
|
-
...
|
|
330
|
+
}), n.animation.queue && (s.animation.queue = {
|
|
331
|
+
...b.animation.queue,
|
|
332
332
|
...n.animation.queue
|
|
333
|
-
}), n.animation.performance && (
|
|
334
|
-
...
|
|
333
|
+
}), n.animation.performance && (s.animation.performance = {
|
|
334
|
+
...b.animation.performance,
|
|
335
335
|
...n.animation.performance
|
|
336
|
-
}), n.animation.entry && (
|
|
337
|
-
...
|
|
336
|
+
}), n.animation.entry && (s.animation.entry = {
|
|
337
|
+
...b.animation.entry,
|
|
338
338
|
...n.animation.entry,
|
|
339
339
|
start: n.animation.entry.start ? {
|
|
340
|
-
...
|
|
340
|
+
...b.animation.entry.start,
|
|
341
341
|
...n.animation.entry.start,
|
|
342
|
-
circular: n.animation.entry.start.circular ? { ...
|
|
343
|
-
} :
|
|
344
|
-
timing: n.animation.entry.timing ? { ...
|
|
345
|
-
path: n.animation.entry.path ? { ...pt, ...n.animation.entry.path } :
|
|
346
|
-
rotation: n.animation.entry.rotation ? { ...
|
|
347
|
-
scale: n.animation.entry.scale ? { ...
|
|
348
|
-
})), n.interaction && (
|
|
349
|
-
...
|
|
342
|
+
circular: n.animation.entry.start.circular ? { ...b.animation.entry.start.circular, ...n.animation.entry.start.circular } : b.animation.entry.start.circular
|
|
343
|
+
} : b.animation.entry.start,
|
|
344
|
+
timing: n.animation.entry.timing ? { ...b.animation.entry.timing, ...n.animation.entry.timing } : b.animation.entry.timing,
|
|
345
|
+
path: n.animation.entry.path ? { ...pt, ...n.animation.entry.path } : b.animation.entry.path,
|
|
346
|
+
rotation: n.animation.entry.rotation ? { ...yt, ...n.animation.entry.rotation } : b.animation.entry.rotation,
|
|
347
|
+
scale: n.animation.entry.scale ? { ...bt, ...n.animation.entry.scale } : b.animation.entry.scale
|
|
348
|
+
})), n.interaction && (s.interaction = {
|
|
349
|
+
...b.interaction,
|
|
350
350
|
...n.interaction
|
|
351
|
-
}, n.interaction.focus && (
|
|
352
|
-
...
|
|
351
|
+
}, n.interaction.focus && (s.interaction.focus = {
|
|
352
|
+
...b.interaction.focus,
|
|
353
353
|
...n.interaction.focus
|
|
354
|
-
}), n.interaction.navigation && (
|
|
355
|
-
...
|
|
354
|
+
}), n.interaction.navigation && (s.interaction.navigation = {
|
|
355
|
+
...b.interaction.navigation,
|
|
356
356
|
...n.interaction.navigation
|
|
357
|
-
}), n.interaction.gestures && (
|
|
358
|
-
...
|
|
357
|
+
}), n.interaction.gestures && (s.interaction.gestures = {
|
|
358
|
+
...b.interaction.gestures,
|
|
359
359
|
...n.interaction.gestures
|
|
360
|
-
})), n.rendering && (
|
|
361
|
-
...
|
|
360
|
+
})), n.rendering && (s.rendering = {
|
|
361
|
+
...b.rendering,
|
|
362
362
|
...n.rendering
|
|
363
|
-
}, n.rendering.responsive && (
|
|
364
|
-
...
|
|
363
|
+
}, n.rendering.responsive && (s.rendering.responsive = {
|
|
364
|
+
...b.rendering.responsive,
|
|
365
365
|
...n.rendering.responsive,
|
|
366
|
-
breakpoints: n.rendering.responsive.breakpoints ? { ...
|
|
367
|
-
mobileDetection: n.rendering.responsive.mobileDetection ? n.rendering.responsive.mobileDetection :
|
|
368
|
-
}), n.rendering.ui && (
|
|
369
|
-
...
|
|
366
|
+
breakpoints: n.rendering.responsive.breakpoints ? { ...b.rendering.responsive.breakpoints, ...n.rendering.responsive.breakpoints } : b.rendering.responsive.breakpoints,
|
|
367
|
+
mobileDetection: n.rendering.responsive.mobileDetection ? n.rendering.responsive.mobileDetection : b.rendering.responsive.mobileDetection
|
|
368
|
+
}), n.rendering.ui && (s.rendering.ui = {
|
|
369
|
+
...b.rendering.ui,
|
|
370
370
|
...n.rendering.ui
|
|
371
|
-
}), n.rendering.performance && (
|
|
372
|
-
...
|
|
371
|
+
}), n.rendering.performance && (s.rendering.performance = {
|
|
372
|
+
...b.rendering.performance,
|
|
373
373
|
...n.rendering.performance
|
|
374
|
-
})),
|
|
375
|
-
...
|
|
374
|
+
})), s.config.debug = {
|
|
375
|
+
...Lt,
|
|
376
376
|
...n.config?.debug ?? {}
|
|
377
|
-
},
|
|
377
|
+
}, s;
|
|
378
378
|
}
|
|
379
379
|
function Wt(n, t) {
|
|
380
|
-
return { ...n ?
|
|
380
|
+
return { ...n ? xt[n] : xt.playful, ...t };
|
|
381
381
|
}
|
|
382
382
|
function Gt(n, t) {
|
|
383
|
-
return { ...n ?
|
|
383
|
+
return { ...n ? Et[n] : Et.gentle, ...t };
|
|
384
384
|
}
|
|
385
385
|
function qt(n, t) {
|
|
386
386
|
return { ...n ? St[n] : St.gentle, ...t };
|
|
@@ -410,31 +410,31 @@ class Yt {
|
|
|
410
410
|
* @param easing - CSS easing function (optional)
|
|
411
411
|
* @returns AnimationHandle that can be used to cancel or query the animation
|
|
412
412
|
*/
|
|
413
|
-
animateTransformCancellable(t, e, i, o = null,
|
|
413
|
+
animateTransformCancellable(t, e, i, o = null, a = null) {
|
|
414
414
|
this.cancelAllAnimations(t);
|
|
415
|
-
const r = o ?? this.config.duration,
|
|
415
|
+
const r = o ?? this.config.duration, s = a ?? this.config.easing.default, h = this.buildTransformString(e), c = this.buildTransformString(i);
|
|
416
416
|
t.style.transition = "none";
|
|
417
|
-
const
|
|
417
|
+
const d = t.animate(
|
|
418
418
|
[
|
|
419
419
|
{ transform: h },
|
|
420
420
|
{ transform: c }
|
|
421
421
|
],
|
|
422
422
|
{
|
|
423
423
|
duration: r,
|
|
424
|
-
easing:
|
|
424
|
+
easing: s,
|
|
425
425
|
fill: "forwards"
|
|
426
426
|
// Keep final state after animation
|
|
427
427
|
}
|
|
428
428
|
), l = {
|
|
429
429
|
id: `anim-${++this.animationIdCounter}`,
|
|
430
430
|
element: t,
|
|
431
|
-
animation:
|
|
431
|
+
animation: d,
|
|
432
432
|
fromState: e,
|
|
433
433
|
toState: i,
|
|
434
434
|
startTime: performance.now(),
|
|
435
435
|
duration: r
|
|
436
436
|
};
|
|
437
|
-
return this.activeAnimations.set(t, l),
|
|
437
|
+
return this.activeAnimations.set(t, l), d.finished.then(() => {
|
|
438
438
|
t.style.transform = c, this.activeAnimations.delete(t);
|
|
439
439
|
}).catch(() => {
|
|
440
440
|
this.activeAnimations.delete(t);
|
|
@@ -481,8 +481,8 @@ class Yt {
|
|
|
481
481
|
const i = getComputedStyle(t).transform;
|
|
482
482
|
if (i === "none" || !i)
|
|
483
483
|
return { x: 0, y: 0, rotation: 0, scale: 1 };
|
|
484
|
-
const o = new DOMMatrix(i),
|
|
485
|
-
return { x:
|
|
484
|
+
const o = new DOMMatrix(i), a = Math.sqrt(o.a * o.a + o.b * o.b), r = Math.atan2(o.b, o.a) * (180 / Math.PI), s = o.e, h = o.f;
|
|
485
|
+
return { x: s, y: h, rotation: r, scale: a };
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
* Check if an element has an active animation
|
|
@@ -509,10 +509,10 @@ class Yt {
|
|
|
509
509
|
* @returns Promise that resolves when animation completes
|
|
510
510
|
*/
|
|
511
511
|
animateTransform(t, e, i = null, o = null) {
|
|
512
|
-
return new Promise((
|
|
513
|
-
const r = i ?? this.config.duration,
|
|
514
|
-
t.style.transition = `transform ${r}ms ${
|
|
515
|
-
|
|
512
|
+
return new Promise((a) => {
|
|
513
|
+
const r = i ?? this.config.duration, s = o ?? this.config.easing.default;
|
|
514
|
+
t.style.transition = `transform ${r}ms ${s}, box-shadow ${r}ms ${s}`, t.style.transform = this.buildTransformString(e), setTimeout(() => {
|
|
515
|
+
a();
|
|
516
516
|
}, r);
|
|
517
517
|
});
|
|
518
518
|
}
|
|
@@ -541,31 +541,31 @@ class Yt {
|
|
|
541
541
|
return new Promise((e) => setTimeout(e, t));
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function J(n, t, e) {
|
|
545
545
|
return n + (t - n) * e;
|
|
546
546
|
}
|
|
547
547
|
function Xt(n, t, e, i) {
|
|
548
|
-
const { overshoot: o, bounces:
|
|
549
|
-
let
|
|
550
|
-
for (let
|
|
551
|
-
if (n <= c[
|
|
552
|
-
l =
|
|
548
|
+
const { overshoot: o, bounces: a, decayRatio: r } = i, s = e.x - t.x, h = e.y - t.y, c = Bt(a, r);
|
|
549
|
+
let d = 0, l = 0, u = 1, g = o, p = !1;
|
|
550
|
+
for (let f = 0; f < c.length; f++)
|
|
551
|
+
if (n <= c[f].time) {
|
|
552
|
+
l = f === 0 ? 0 : c[f - 1].time, u = c[f].time, g = c[f].overshoot, p = c[f].isOvershoot;
|
|
553
553
|
break;
|
|
554
554
|
}
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
|
|
555
|
+
const y = (n - l) / (u - l);
|
|
556
|
+
if (p)
|
|
557
|
+
d = 1 + g * it(y);
|
|
558
558
|
else if (l === 0)
|
|
559
|
-
|
|
559
|
+
d = it(y);
|
|
560
560
|
else {
|
|
561
561
|
const m = 1 + (c.find(
|
|
562
|
-
(
|
|
563
|
-
)?.overshoot ||
|
|
564
|
-
|
|
562
|
+
(E, v) => E.time > l && v > 0 && c[v - 1].isOvershoot
|
|
563
|
+
)?.overshoot || g);
|
|
564
|
+
d = J(m, 1, it(y));
|
|
565
565
|
}
|
|
566
566
|
return {
|
|
567
|
-
x: t.x +
|
|
568
|
-
y: t.y + h *
|
|
567
|
+
x: t.x + s * d,
|
|
568
|
+
y: t.y + h * d
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
571
|
function Bt(n, t) {
|
|
@@ -574,56 +574,56 @@ function Bt(n, t) {
|
|
|
574
574
|
e.push({ time: i, overshoot: 0, isOvershoot: !1 });
|
|
575
575
|
let o = 0.15;
|
|
576
576
|
const r = 0.4 / (n * 2);
|
|
577
|
-
for (let
|
|
577
|
+
for (let s = 0; s < n; s++)
|
|
578
578
|
i += r, e.push({ time: i, overshoot: o, isOvershoot: !0 }), i += r, e.push({ time: i, overshoot: o * t, isOvershoot: !1 }), o *= t;
|
|
579
579
|
return e.push({ time: 1, overshoot: 0, isOvershoot: !1 }), e;
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
const { stiffness: o, damping:
|
|
583
|
-
let
|
|
581
|
+
function Vt(n, t, e, i) {
|
|
582
|
+
const { stiffness: o, damping: a, mass: r, oscillations: s } = i, h = e.x - t.x, c = e.y - t.y, d = Math.sqrt(o / r), l = a / (2 * Math.sqrt(o * r));
|
|
583
|
+
let u;
|
|
584
584
|
if (l < 1) {
|
|
585
|
-
const
|
|
586
|
-
|
|
585
|
+
const g = d * Math.sqrt(1 - l * l), p = Math.exp(-l * d * n * 3), y = Math.cos(g * n * s * Math.PI);
|
|
586
|
+
u = 1 - p * y;
|
|
587
587
|
} else
|
|
588
|
-
|
|
589
|
-
return
|
|
590
|
-
x: t.x + h *
|
|
591
|
-
y: t.y + c *
|
|
588
|
+
u = 1 - Math.exp(-d * n * 3);
|
|
589
|
+
return u = Math.max(0, Math.min(u, 1.3)), {
|
|
590
|
+
x: t.x + h * u,
|
|
591
|
+
y: t.y + c * u
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
|
-
function
|
|
595
|
-
const { amplitude: o, frequency:
|
|
594
|
+
function Jt(n, t, e, i) {
|
|
595
|
+
const { amplitude: o, frequency: a, decay: r, decayRate: s, phase: h } = i, c = e.x - t.x, d = e.y - t.y, l = Math.sqrt(c * c + d * d), u = l > 0 ? -d / l : 0, g = l > 0 ? c / l : 1, p = a * Math.PI * 2 * n + h, y = r ? Math.pow(1 - n, s) : 1, f = o * Math.sin(p) * y, m = Kt(n);
|
|
596
596
|
return {
|
|
597
|
-
x:
|
|
598
|
-
y:
|
|
597
|
+
x: J(t.x, e.x, m) + f * u,
|
|
598
|
+
y: J(t.y, e.y, m) + f * g
|
|
599
599
|
};
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function it(n) {
|
|
602
602
|
return 1 - (1 - n) * (1 - n);
|
|
603
603
|
}
|
|
604
604
|
function Kt(n) {
|
|
605
605
|
return 1 - Math.pow(1 - n, 3);
|
|
606
606
|
}
|
|
607
607
|
function Zt(n, t, e) {
|
|
608
|
-
const { amplitude: i, frequency: o, decay:
|
|
608
|
+
const { amplitude: i, frequency: o, decay: a } = e, r = Math.sin(n * o * Math.PI * 2), s = a ? Math.pow(1 - n, 2) : 1, h = i * r * s;
|
|
609
609
|
return t + h;
|
|
610
610
|
}
|
|
611
611
|
function Qt(n, t, e) {
|
|
612
|
-
const { overshoot: i, bounces: o } = e,
|
|
613
|
-
|
|
612
|
+
const { overshoot: i, bounces: o } = e, a = [];
|
|
613
|
+
a.push({ time: 0.5, scale: i });
|
|
614
614
|
let r = i;
|
|
615
|
-
const
|
|
616
|
-
let
|
|
617
|
-
for (let
|
|
618
|
-
const
|
|
619
|
-
|
|
615
|
+
const s = 0.5, c = 0.5 / (o * 2);
|
|
616
|
+
let d = 0.5;
|
|
617
|
+
for (let u = 0; u < o; u++) {
|
|
618
|
+
const g = 1 - (r - 1) * s;
|
|
619
|
+
d += c, a.push({ time: d, scale: g }), r = 1 + (r - 1) * s * s, d += c, u < o - 1 && a.push({ time: d, scale: r });
|
|
620
620
|
}
|
|
621
|
-
|
|
621
|
+
a.push({ time: 1, scale: 1 });
|
|
622
622
|
let l = 1;
|
|
623
|
-
for (let
|
|
624
|
-
if (n <=
|
|
625
|
-
const
|
|
626
|
-
l =
|
|
623
|
+
for (let u = 0; u < a.length; u++)
|
|
624
|
+
if (n <= a[u].time) {
|
|
625
|
+
const g = u === 0 ? 0 : a[u - 1].time, p = u === 0 ? 1 : a[u - 1].scale, y = (n - g) / (a[u].time - g), f = it(y);
|
|
626
|
+
l = p + (a[u].scale - p) * f;
|
|
627
627
|
break;
|
|
628
628
|
}
|
|
629
629
|
return l * t;
|
|
@@ -634,61 +634,61 @@ function te(n) {
|
|
|
634
634
|
startPosition: e,
|
|
635
635
|
endPosition: i,
|
|
636
636
|
pathConfig: o,
|
|
637
|
-
duration:
|
|
637
|
+
duration: a,
|
|
638
638
|
imageWidth: r,
|
|
639
|
-
imageHeight:
|
|
639
|
+
imageHeight: s,
|
|
640
640
|
rotation: h,
|
|
641
641
|
scale: c,
|
|
642
|
-
onComplete:
|
|
642
|
+
onComplete: d,
|
|
643
643
|
rotationConfig: l,
|
|
644
|
-
startRotation:
|
|
645
|
-
scaleConfig:
|
|
646
|
-
startScale:
|
|
647
|
-
} = n,
|
|
648
|
-
if ((
|
|
649
|
-
|
|
644
|
+
startRotation: u,
|
|
645
|
+
scaleConfig: g,
|
|
646
|
+
startScale: p
|
|
647
|
+
} = n, y = o.type, f = u !== void 0 && u !== h, m = l?.mode === "wobble", E = l?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, v = f || m, w = p !== void 0 && p !== c, S = g?.mode === "pop", x = g?.pop || { overshoot: 1.2, bounces: 1 };
|
|
648
|
+
if ((y === "linear" || y === "arc") && !v && !(w || S)) {
|
|
649
|
+
d && d();
|
|
650
650
|
return;
|
|
651
651
|
}
|
|
652
|
-
const L = performance.now(), z = -r / 2, U = -
|
|
652
|
+
const L = performance.now(), z = -r / 2, U = -s / 2;
|
|
653
653
|
function _(Y) {
|
|
654
|
-
const N = Y - L,
|
|
655
|
-
let
|
|
656
|
-
switch (
|
|
654
|
+
const N = Y - L, C = Math.min(N / a, 1);
|
|
655
|
+
let $;
|
|
656
|
+
switch (y) {
|
|
657
657
|
case "bounce": {
|
|
658
|
-
const
|
|
658
|
+
const D = Wt(
|
|
659
659
|
o.bouncePreset,
|
|
660
660
|
o.bounce
|
|
661
661
|
);
|
|
662
|
-
|
|
662
|
+
$ = Xt(C, e, i, D);
|
|
663
663
|
break;
|
|
664
664
|
}
|
|
665
665
|
case "elastic": {
|
|
666
|
-
const
|
|
666
|
+
const D = Gt(
|
|
667
667
|
o.elasticPreset,
|
|
668
668
|
o.elastic
|
|
669
669
|
);
|
|
670
|
-
|
|
670
|
+
$ = Vt(C, e, i, D);
|
|
671
671
|
break;
|
|
672
672
|
}
|
|
673
673
|
case "wave": {
|
|
674
|
-
const
|
|
674
|
+
const D = qt(
|
|
675
675
|
o.wavePreset,
|
|
676
676
|
o.wave
|
|
677
677
|
);
|
|
678
|
-
|
|
678
|
+
$ = Jt(C, e, i, D);
|
|
679
679
|
break;
|
|
680
680
|
}
|
|
681
681
|
default:
|
|
682
|
-
|
|
683
|
-
x:
|
|
684
|
-
y:
|
|
682
|
+
$ = {
|
|
683
|
+
x: J(e.x, i.x, C),
|
|
684
|
+
y: J(e.y, i.y, C)
|
|
685
685
|
};
|
|
686
686
|
}
|
|
687
|
-
const k =
|
|
687
|
+
const k = $.x - i.x, H = $.y - i.y;
|
|
688
688
|
let R;
|
|
689
|
-
m ? R = Zt(
|
|
690
|
-
let
|
|
691
|
-
|
|
689
|
+
m ? R = Zt(C, h, E) : f ? R = J(u, h, C) : R = h;
|
|
690
|
+
let T;
|
|
691
|
+
S ? T = Qt(C, c, x) : w ? T = J(p, c, C) : T = c, t.style.transform = `translate(${z}px, ${U}px) translate(${k}px, ${H}px) rotate(${R}deg) scale(${T})`, C < 1 ? requestAnimationFrame(_) : (t.style.transform = `translate(${z}px, ${U}px) rotate(${h}deg) scale(${c})`, d && d());
|
|
692
692
|
}
|
|
693
693
|
requestAnimationFrame(_);
|
|
694
694
|
}
|
|
@@ -705,7 +705,7 @@ const ie = {
|
|
|
705
705
|
};
|
|
706
706
|
class ne {
|
|
707
707
|
constructor(t, e) {
|
|
708
|
-
this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || pt, this.rotationConfig = t.rotation ||
|
|
708
|
+
this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || pt, this.rotationConfig = t.rotation || yt, this.scaleConfig = t.scale || bt;
|
|
709
709
|
}
|
|
710
710
|
/**
|
|
711
711
|
* Get the effective start position, considering layout-aware defaults
|
|
@@ -716,72 +716,72 @@ class ne {
|
|
|
716
716
|
/**
|
|
717
717
|
* Calculate the starting position for an image's entry animation
|
|
718
718
|
*/
|
|
719
|
-
calculateStartPosition(t, e, i, o,
|
|
720
|
-
const r = this.resolvedStartPosition,
|
|
719
|
+
calculateStartPosition(t, e, i, o, a) {
|
|
720
|
+
const r = this.resolvedStartPosition, s = this.config.start.offset ?? 100;
|
|
721
721
|
switch (r) {
|
|
722
722
|
case "nearest-edge":
|
|
723
|
-
return this.calculateNearestEdge(t, e, i,
|
|
723
|
+
return this.calculateNearestEdge(t, e, i, s);
|
|
724
724
|
case "top":
|
|
725
|
-
return this.calculateEdgePosition("top", t, e, i,
|
|
725
|
+
return this.calculateEdgePosition("top", t, e, i, s);
|
|
726
726
|
case "bottom":
|
|
727
|
-
return this.calculateEdgePosition("bottom", t, e, i,
|
|
727
|
+
return this.calculateEdgePosition("bottom", t, e, i, s);
|
|
728
728
|
case "left":
|
|
729
|
-
return this.calculateEdgePosition("left", t, e, i,
|
|
729
|
+
return this.calculateEdgePosition("left", t, e, i, s);
|
|
730
730
|
case "right":
|
|
731
|
-
return this.calculateEdgePosition("right", t, e, i,
|
|
731
|
+
return this.calculateEdgePosition("right", t, e, i, s);
|
|
732
732
|
case "center":
|
|
733
733
|
return this.calculateCenterPosition(i, t, e);
|
|
734
734
|
case "random-edge":
|
|
735
|
-
return this.calculateRandomEdge(t, e, i,
|
|
735
|
+
return this.calculateRandomEdge(t, e, i, s);
|
|
736
736
|
case "circular":
|
|
737
737
|
return this.calculateCircularPosition(
|
|
738
738
|
t,
|
|
739
739
|
e,
|
|
740
740
|
i,
|
|
741
741
|
o,
|
|
742
|
-
|
|
742
|
+
a
|
|
743
743
|
);
|
|
744
744
|
default:
|
|
745
|
-
return this.calculateNearestEdge(t, e, i,
|
|
745
|
+
return this.calculateNearestEdge(t, e, i, s);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
/**
|
|
749
749
|
* Calculate start position from the nearest edge (current default behavior)
|
|
750
750
|
*/
|
|
751
751
|
calculateNearestEdge(t, e, i, o) {
|
|
752
|
-
const
|
|
753
|
-
let
|
|
754
|
-
return l ===
|
|
752
|
+
const a = t.x, r = t.y, s = a, h = i.width - a, c = r, d = i.height - r, l = Math.min(s, h, c, d);
|
|
753
|
+
let u = t.x, g = t.y;
|
|
754
|
+
return l === s ? u = -(e.width + o) : l === h ? u = i.width + o : l === c ? g = -(e.height + o) : g = i.height + o, { x: u, y: g };
|
|
755
755
|
}
|
|
756
756
|
/**
|
|
757
757
|
* Calculate start position from a specific edge
|
|
758
758
|
*/
|
|
759
|
-
calculateEdgePosition(t, e, i, o,
|
|
760
|
-
let r = e.x,
|
|
759
|
+
calculateEdgePosition(t, e, i, o, a) {
|
|
760
|
+
let r = e.x, s = e.y;
|
|
761
761
|
switch (t) {
|
|
762
762
|
case "top":
|
|
763
|
-
|
|
763
|
+
s = -(i.height + a);
|
|
764
764
|
break;
|
|
765
765
|
case "bottom":
|
|
766
|
-
|
|
766
|
+
s = o.height + a;
|
|
767
767
|
break;
|
|
768
768
|
case "left":
|
|
769
|
-
r = -(i.width +
|
|
769
|
+
r = -(i.width + a);
|
|
770
770
|
break;
|
|
771
771
|
case "right":
|
|
772
|
-
r = o.width +
|
|
772
|
+
r = o.width + a;
|
|
773
773
|
break;
|
|
774
774
|
}
|
|
775
|
-
return { x: r, y:
|
|
775
|
+
return { x: r, y: s };
|
|
776
776
|
}
|
|
777
777
|
/**
|
|
778
778
|
* Calculate start position from center with scale animation
|
|
779
779
|
*/
|
|
780
780
|
calculateCenterPosition(t, e, i) {
|
|
781
|
-
const o = t.width / 2,
|
|
781
|
+
const o = t.width / 2, a = t.height / 2;
|
|
782
782
|
return {
|
|
783
783
|
x: o,
|
|
784
|
-
y:
|
|
784
|
+
y: a,
|
|
785
785
|
useScale: !0
|
|
786
786
|
// Signal to use scale animation from 0
|
|
787
787
|
};
|
|
@@ -790,27 +790,27 @@ class ne {
|
|
|
790
790
|
* Calculate start position from a random edge
|
|
791
791
|
*/
|
|
792
792
|
calculateRandomEdge(t, e, i, o) {
|
|
793
|
-
const
|
|
793
|
+
const a = ["top", "bottom", "left", "right"], r = a[Math.floor(Math.random() * a.length)];
|
|
794
794
|
return this.calculateEdgePosition(r, t, e, i, o);
|
|
795
795
|
}
|
|
796
796
|
/**
|
|
797
797
|
* Calculate start position on a circle around the container
|
|
798
798
|
*/
|
|
799
|
-
calculateCircularPosition(t, e, i, o,
|
|
800
|
-
const r = this.config.start.circular || {},
|
|
799
|
+
calculateCircularPosition(t, e, i, o, a) {
|
|
800
|
+
const r = this.config.start.circular || {}, s = r.distribution || "even";
|
|
801
801
|
let h;
|
|
802
802
|
const c = r.radius || "120%";
|
|
803
803
|
if (typeof c == "string" && c.endsWith("%")) {
|
|
804
|
-
const
|
|
804
|
+
const y = parseFloat(c) / 100;
|
|
805
805
|
h = Math.sqrt(
|
|
806
806
|
i.width ** 2 + i.height ** 2
|
|
807
|
-
) *
|
|
807
|
+
) * y / 2;
|
|
808
808
|
} else
|
|
809
809
|
h = typeof c == "number" ? c : 500;
|
|
810
|
-
let
|
|
811
|
-
|
|
812
|
-
const l = i.width / 2,
|
|
813
|
-
return { x:
|
|
810
|
+
let d;
|
|
811
|
+
s === "even" ? d = o / a * 2 * Math.PI : d = Math.random() * 2 * Math.PI;
|
|
812
|
+
const l = i.width / 2, u = i.height / 2, g = l + Math.cos(d) * h, p = u + Math.sin(d) * h;
|
|
813
|
+
return { x: g, y: p };
|
|
814
814
|
}
|
|
815
815
|
/**
|
|
816
816
|
* Get animation parameters for an image
|
|
@@ -829,9 +829,9 @@ class ne {
|
|
|
829
829
|
* Build a CSS transform string for the start position
|
|
830
830
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
831
831
|
*/
|
|
832
|
-
buildStartTransform(t, e, i, o,
|
|
833
|
-
const c = t.x - e.x,
|
|
834
|
-
return t.useScale ? `${
|
|
832
|
+
buildStartTransform(t, e, i, o, a, r, s, h) {
|
|
833
|
+
const c = t.x - e.x, d = t.y - e.y, l = s !== void 0 ? s : i, u = h !== void 0 ? h : o, g = a !== void 0 ? -a / 2 : 0, p = r !== void 0 ? -r / 2 : 0, y = a !== void 0 ? `translate(${g}px, ${p}px)` : "translate(-50%, -50%)";
|
|
834
|
+
return t.useScale ? `${y} translate(${c}px, ${d}px) rotate(${l}deg) scale(0)` : `${y} translate(${c}px, ${d}px) rotate(${l}deg) scale(${u})`;
|
|
835
835
|
}
|
|
836
836
|
/**
|
|
837
837
|
* Build the final CSS transform string
|
|
@@ -839,8 +839,8 @@ class ne {
|
|
|
839
839
|
*/
|
|
840
840
|
buildFinalTransform(t, e, i, o) {
|
|
841
841
|
if (i !== void 0 && o !== void 0) {
|
|
842
|
-
const
|
|
843
|
-
return `translate(${
|
|
842
|
+
const a = -i / 2, r = -o / 2;
|
|
843
|
+
return `translate(${a}px, ${r}px) rotate(${t}deg) scale(${e})`;
|
|
844
844
|
}
|
|
845
845
|
return `translate(-50%, -50%) rotate(${t}deg) scale(${e})`;
|
|
846
846
|
}
|
|
@@ -958,7 +958,7 @@ class ne {
|
|
|
958
958
|
amplitude: 15,
|
|
959
959
|
frequency: 3,
|
|
960
960
|
decay: !0
|
|
961
|
-
}, { amplitude: o, frequency:
|
|
961
|
+
}, { amplitude: o, frequency: a, decay: r } = i, s = Math.sin(t * a * Math.PI * 2), h = r ? Math.pow(1 - t, 2) : 1, c = o * s * h;
|
|
962
962
|
return e + c;
|
|
963
963
|
}
|
|
964
964
|
/**
|
|
@@ -1015,15 +1015,15 @@ class ne {
|
|
|
1015
1015
|
const i = this.scaleConfig.pop || {
|
|
1016
1016
|
overshoot: 1.2,
|
|
1017
1017
|
bounces: 1
|
|
1018
|
-
}, { overshoot: o, bounces:
|
|
1019
|
-
let
|
|
1018
|
+
}, { overshoot: o, bounces: a } = i, r = this.generateScaleBounceKeyframes(a, o);
|
|
1019
|
+
let s = e;
|
|
1020
1020
|
for (let h = 0; h < r.length; h++)
|
|
1021
1021
|
if (t <= r[h].time) {
|
|
1022
|
-
const c = h === 0 ? 0 : r[h - 1].time,
|
|
1023
|
-
|
|
1022
|
+
const c = h === 0 ? 0 : r[h - 1].time, d = h === 0 ? e : r[h - 1].scale, l = (t - c) / (r[h].time - c), u = this.easeOutQuad(l);
|
|
1023
|
+
s = d + (r[h].scale - d) * u;
|
|
1024
1024
|
break;
|
|
1025
1025
|
}
|
|
1026
|
-
return
|
|
1026
|
+
return s * e;
|
|
1027
1027
|
}
|
|
1028
1028
|
/**
|
|
1029
1029
|
* Generate keyframes for scale bounce animation
|
|
@@ -1032,11 +1032,11 @@ class ne {
|
|
|
1032
1032
|
const i = [];
|
|
1033
1033
|
i.push({ time: 0.5, scale: e });
|
|
1034
1034
|
let o = e;
|
|
1035
|
-
const
|
|
1035
|
+
const a = 0.5, s = 0.5 / (t * 2);
|
|
1036
1036
|
let h = 0.5;
|
|
1037
1037
|
for (let c = 0; c < t; c++) {
|
|
1038
|
-
const
|
|
1039
|
-
h +=
|
|
1038
|
+
const d = 1 - (o - 1) * a;
|
|
1039
|
+
h += s, i.push({ time: h, scale: d }), o = 1 + (o - 1) * a * a, h += s, c < t - 1 && i.push({ time: h, scale: o });
|
|
1040
1040
|
}
|
|
1041
1041
|
return i.push({ time: 1, scale: 1 }), i;
|
|
1042
1042
|
}
|
|
@@ -1059,9 +1059,9 @@ class oe {
|
|
|
1059
1059
|
* @returns Array of layout objects with position, rotation, scale
|
|
1060
1060
|
*/
|
|
1061
1061
|
generate(t, e, i = {}) {
|
|
1062
|
-
const o = [], { width:
|
|
1062
|
+
const o = [], { width: a, height: r } = e, s = this.config.spacing.padding, h = i.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, u = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, p = u !== 1 || g !== 1, f = h * 1.5 / 2, m = h / 2, E = a - s - f, v = r - s - m, w = s + f, S = s + m;
|
|
1063
1063
|
for (let x = 0; x < t; x++) {
|
|
1064
|
-
const A = this.random(w,
|
|
1064
|
+
const A = this.random(w, E), L = this.random(S, v), z = c === "random" ? this.random(d, l) : 0, U = p ? this.random(u, g) : 1, _ = h * U, Y = {
|
|
1065
1065
|
id: x,
|
|
1066
1066
|
x: A,
|
|
1067
1067
|
y: L,
|
|
@@ -1095,16 +1095,16 @@ class se {
|
|
|
1095
1095
|
* @returns Array of layout objects with position, rotation, scale
|
|
1096
1096
|
*/
|
|
1097
1097
|
generate(t, e, i = {}) {
|
|
1098
|
-
const o = [], { width:
|
|
1098
|
+
const o = [], { width: a, height: r } = e, s = i.fixedHeight ?? 200, h = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, l = this.imageConfig.sizing?.variance?.min ?? 1, u = this.imageConfig.sizing?.variance?.max ?? 1, g = l !== 1 || u !== 1, p = this.config.scaleDecay ?? 0, y = i.fixedHeight ?? s, f = a / 2, m = r / 2, E = Math.ceil(Math.sqrt(t));
|
|
1099
1099
|
if (t > 0) {
|
|
1100
|
-
const
|
|
1100
|
+
const S = g ? this.random(l, u) : 1, x = y * S;
|
|
1101
1101
|
o.push({
|
|
1102
1102
|
id: 0,
|
|
1103
|
-
x:
|
|
1103
|
+
x: f,
|
|
1104
1104
|
y: m,
|
|
1105
|
-
rotation: h === "random" ? this.random(c * 0.33,
|
|
1105
|
+
rotation: h === "random" ? this.random(c * 0.33, d * 0.33) : 0,
|
|
1106
1106
|
// Less rotation for center
|
|
1107
|
-
scale:
|
|
1107
|
+
scale: S,
|
|
1108
1108
|
baseSize: x,
|
|
1109
1109
|
zIndex: 100
|
|
1110
1110
|
// Center image is highest
|
|
@@ -1112,22 +1112,22 @@ class se {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
let v = 1, w = 1;
|
|
1114
1114
|
for (; v < t; ) {
|
|
1115
|
-
const
|
|
1115
|
+
const S = w / E, x = p > 0 ? 1 - S * p * 0.5 : 1, A = w * (y * 0.8), L = A * 1.5, z = Math.PI * (3 * (L + A) - Math.sqrt((3 * L + A) * (L + 3 * A))), U = this.estimateWidth(y), _ = Math.floor(z / (U * 0.7));
|
|
1116
1116
|
if (_ === 0) {
|
|
1117
1117
|
w++;
|
|
1118
1118
|
continue;
|
|
1119
1119
|
}
|
|
1120
1120
|
const Y = 2 * Math.PI / _, N = w * (20 * Math.PI / 180);
|
|
1121
|
-
for (let
|
|
1122
|
-
const
|
|
1123
|
-
let
|
|
1124
|
-
const
|
|
1125
|
-
|
|
1126
|
-
const W = h === "random" ? this.random(c,
|
|
1121
|
+
for (let C = 0; C < _ && v < t; C++) {
|
|
1122
|
+
const $ = C * Y + N, k = g ? this.random(l, u) : 1, H = x * k, R = y * H;
|
|
1123
|
+
let T = f + Math.cos($) * L, D = m + Math.sin($) * A;
|
|
1124
|
+
const O = this.config.spacing.padding ?? 50, P = R * 1.5 / 2, M = R / 2;
|
|
1125
|
+
T - P < O ? T = O + P : T + P > a - O && (T = a - O - P), D - M < O ? D = O + M : D + M > r - O && (D = r - O - M);
|
|
1126
|
+
const W = h === "random" ? this.random(c, d) : 0;
|
|
1127
1127
|
o.push({
|
|
1128
1128
|
id: v,
|
|
1129
|
-
x:
|
|
1130
|
-
y:
|
|
1129
|
+
x: T,
|
|
1130
|
+
y: D,
|
|
1131
1131
|
rotation: W,
|
|
1132
1132
|
scale: H,
|
|
1133
1133
|
baseSize: R,
|
|
@@ -1168,7 +1168,7 @@ const ae = {
|
|
|
1168
1168
|
alignment: "center",
|
|
1169
1169
|
gap: 10,
|
|
1170
1170
|
overflowOffset: 0.25
|
|
1171
|
-
},
|
|
1171
|
+
}, It = [
|
|
1172
1172
|
{ x: 1, y: 1 },
|
|
1173
1173
|
// bottom-right
|
|
1174
1174
|
{ x: -1, y: -1 },
|
|
@@ -1198,65 +1198,65 @@ class re {
|
|
|
1198
1198
|
* @returns Array of layout objects with position, rotation, scale
|
|
1199
1199
|
*/
|
|
1200
1200
|
generate(t, e, i = {}) {
|
|
1201
|
-
const o = [], { width:
|
|
1201
|
+
const o = [], { width: a, height: r } = e, s = { ...ae, ...this.config.grid }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.sizing?.variance?.min ?? 1, u = this.imageConfig.sizing?.variance?.max ?? 1, g = l !== 1 || u !== 1, p = a - 2 * h, y = r - 2 * h, { columns: f, rows: m } = this.calculateGridDimensions(
|
|
1202
1202
|
t,
|
|
1203
|
-
b,
|
|
1204
1203
|
p,
|
|
1204
|
+
y,
|
|
1205
1205
|
c,
|
|
1206
|
-
|
|
1207
|
-
),
|
|
1206
|
+
s
|
|
1207
|
+
), E = s.stagger === "row", v = s.stagger === "column", w = E ? f + 0.5 : f, S = v ? m + 0.5 : m, x = (p - s.gap * (f - 1)) / w, A = (y - s.gap * (m - 1)) / S, L = E ? x / 2 : 0, z = v ? A / 2 : 0, U = 1 + s.overlap, _ = Math.min(x, A) * U, Y = i.fixedHeight ? Math.min(i.fixedHeight, _) : _, N = f * x + (f - 1) * s.gap + L, C = m * A + (m - 1) * s.gap + z, $ = h + (p - N) / 2, k = h + (y - C) / 2, H = f * m, R = s.columns !== "auto" && s.rows !== "auto", T = R && t > H;
|
|
1208
1208
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1209
|
-
gridConfigColumns:
|
|
1210
|
-
gridConfigRows:
|
|
1211
|
-
columns:
|
|
1209
|
+
gridConfigColumns: s.columns,
|
|
1210
|
+
gridConfigRows: s.rows,
|
|
1211
|
+
columns: f,
|
|
1212
1212
|
rows: m,
|
|
1213
1213
|
cellCount: H,
|
|
1214
1214
|
hasFixedGrid: R,
|
|
1215
1215
|
imageCount: t,
|
|
1216
|
-
isOverflowMode:
|
|
1216
|
+
isOverflowMode: T
|
|
1217
1217
|
});
|
|
1218
|
-
const
|
|
1218
|
+
const D = T ? new Array(H).fill(0) : [], O = Math.min(x, A) * s.overflowOffset;
|
|
1219
1219
|
for (let F = 0; F < t; F++) {
|
|
1220
1220
|
let P, M, W = 0;
|
|
1221
|
-
if (
|
|
1221
|
+
if (T && F >= H) {
|
|
1222
1222
|
const q = F - H, j = q % H;
|
|
1223
|
-
W = Math.floor(q / H) + 1,
|
|
1223
|
+
W = Math.floor(q / H) + 1, D[j]++, s.fillDirection === "row" ? (P = j % f, M = Math.floor(j / f)) : (M = j % m, P = Math.floor(j / m));
|
|
1224
1224
|
} else
|
|
1225
|
-
|
|
1226
|
-
let G =
|
|
1227
|
-
if (
|
|
1228
|
-
const q = (W - 1) %
|
|
1229
|
-
G += j.x *
|
|
1225
|
+
s.fillDirection === "row" ? (P = F % f, M = Math.floor(F / f)) : (M = F % m, P = Math.floor(F / m));
|
|
1226
|
+
let G = $ + P * (x + s.gap) + x / 2, X = k + M * (A + s.gap) + A / 2;
|
|
1227
|
+
if (s.stagger === "row" && M % 2 === 1 ? G += x / 2 : s.stagger === "column" && P % 2 === 1 && (X += A / 2), W > 0) {
|
|
1228
|
+
const q = (W - 1) % It.length, j = It[q];
|
|
1229
|
+
G += j.x * O, X += j.y * O;
|
|
1230
1230
|
}
|
|
1231
|
-
if (
|
|
1232
|
-
const q = x / 2 *
|
|
1231
|
+
if (s.jitter > 0) {
|
|
1232
|
+
const q = x / 2 * s.jitter, j = A / 2 * s.jitter;
|
|
1233
1233
|
G += this.random(-q, q), X += this.random(-j, j);
|
|
1234
1234
|
}
|
|
1235
|
-
let B = G,
|
|
1236
|
-
if (!
|
|
1237
|
-
const q = t %
|
|
1238
|
-
if (M === Math.floor((t - 1) /
|
|
1239
|
-
const
|
|
1240
|
-
let
|
|
1241
|
-
|
|
1235
|
+
let B = G, V = X;
|
|
1236
|
+
if (!T && s.fillDirection === "row") {
|
|
1237
|
+
const q = t % f || f;
|
|
1238
|
+
if (M === Math.floor((t - 1) / f) && q < f) {
|
|
1239
|
+
const wt = q * x + (q - 1) * s.gap;
|
|
1240
|
+
let dt = 0;
|
|
1241
|
+
s.alignment === "center" ? dt = (N - wt) / 2 : s.alignment === "end" && (dt = N - wt), B += dt;
|
|
1242
1242
|
}
|
|
1243
1243
|
}
|
|
1244
|
-
const
|
|
1245
|
-
B = Math.max(
|
|
1246
|
-
let
|
|
1247
|
-
if (
|
|
1244
|
+
const st = g ? this.random(l, u) : 1, K = Y * st, tt = K * 1.5 / 2, et = K / 2, rt = h + tt, ct = a - h - tt, Ft = h + et, $t = r - h - et;
|
|
1245
|
+
B = Math.max(rt, Math.min(B, ct)), V = Math.max(Ft, Math.min(V, $t));
|
|
1246
|
+
let lt = 0;
|
|
1247
|
+
if (d === "random") {
|
|
1248
1248
|
const q = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1249
|
-
|
|
1249
|
+
s.jitter > 0 ? lt = this.random(q * s.jitter, j * s.jitter) : lt = this.random(q, j);
|
|
1250
1250
|
}
|
|
1251
|
-
let
|
|
1252
|
-
|
|
1251
|
+
let ht;
|
|
1252
|
+
T && W > 0 ? ht = 50 - W : ht = T ? 100 + F : F + 1, o.push({
|
|
1253
1253
|
id: F,
|
|
1254
1254
|
x: B,
|
|
1255
|
-
y:
|
|
1256
|
-
rotation:
|
|
1257
|
-
scale:
|
|
1255
|
+
y: V,
|
|
1256
|
+
rotation: lt,
|
|
1257
|
+
scale: st,
|
|
1258
1258
|
baseSize: K,
|
|
1259
|
-
zIndex:
|
|
1259
|
+
zIndex: ht
|
|
1260
1260
|
});
|
|
1261
1261
|
}
|
|
1262
1262
|
return o;
|
|
@@ -1264,20 +1264,20 @@ class re {
|
|
|
1264
1264
|
/**
|
|
1265
1265
|
* Calculate optimal grid dimensions based on image count and container
|
|
1266
1266
|
*/
|
|
1267
|
-
calculateGridDimensions(t, e, i, o,
|
|
1268
|
-
let r,
|
|
1269
|
-
if (
|
|
1270
|
-
r =
|
|
1271
|
-
else if (
|
|
1272
|
-
r =
|
|
1273
|
-
else if (
|
|
1274
|
-
|
|
1267
|
+
calculateGridDimensions(t, e, i, o, a) {
|
|
1268
|
+
let r, s;
|
|
1269
|
+
if (a.columns !== "auto" && a.rows !== "auto")
|
|
1270
|
+
r = a.columns, s = a.rows;
|
|
1271
|
+
else if (a.columns !== "auto")
|
|
1272
|
+
r = a.columns, s = Math.ceil(t / r);
|
|
1273
|
+
else if (a.rows !== "auto")
|
|
1274
|
+
s = a.rows, r = Math.ceil(t / s);
|
|
1275
1275
|
else {
|
|
1276
1276
|
const h = e / i;
|
|
1277
|
-
for (r = Math.max(1, Math.round(Math.sqrt(t * h / 1.4))),
|
|
1277
|
+
for (r = Math.max(1, Math.round(Math.sqrt(t * h / 1.4))), s = Math.ceil(t / r); r > 1 && (r - 1) * s >= t; )
|
|
1278
1278
|
r--;
|
|
1279
1279
|
}
|
|
1280
|
-
return { columns: Math.max(1, r), rows: Math.max(1,
|
|
1280
|
+
return { columns: Math.max(1, r), rows: Math.max(1, s) };
|
|
1281
1281
|
}
|
|
1282
1282
|
/**
|
|
1283
1283
|
* Utility: Generate random number between min and max
|
|
@@ -1305,35 +1305,35 @@ class he {
|
|
|
1305
1305
|
* @returns Array of layout objects with position, rotation, scale
|
|
1306
1306
|
*/
|
|
1307
1307
|
generate(t, e, i = {}) {
|
|
1308
|
-
const o = [], { width:
|
|
1308
|
+
const o = [], { width: a, height: r } = e, s = { ...le, ...this.config.spiral }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, y = g !== 1 || p !== 1, f = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, E = r / 2, v = Math.min(
|
|
1309
1309
|
m - h - c / 2,
|
|
1310
|
-
|
|
1311
|
-
), w =
|
|
1312
|
-
for (let
|
|
1310
|
+
E - h - c / 2
|
|
1311
|
+
), w = s.direction === "clockwise" ? -1 : 1;
|
|
1312
|
+
for (let S = 0; S < t; S++) {
|
|
1313
1313
|
let x, A;
|
|
1314
|
-
if (
|
|
1315
|
-
x =
|
|
1316
|
-
else if (
|
|
1317
|
-
const G =
|
|
1318
|
-
x = G * w +
|
|
1314
|
+
if (s.spiralType === "golden")
|
|
1315
|
+
x = S * ce * w + s.startAngle, A = this.calculateGoldenRadius(S, t, v, s.tightness);
|
|
1316
|
+
else if (s.spiralType === "archimedean") {
|
|
1317
|
+
const G = S * 0.5 * s.tightness;
|
|
1318
|
+
x = G * w + s.startAngle, A = this.calculateArchimedeanRadius(G, t, v, s.tightness);
|
|
1319
1319
|
} else {
|
|
1320
|
-
const G =
|
|
1321
|
-
x = G * w +
|
|
1320
|
+
const G = S * 0.3 * s.tightness;
|
|
1321
|
+
x = G * w + s.startAngle, A = this.calculateLogarithmicRadius(G, t, v, s.tightness);
|
|
1322
1322
|
}
|
|
1323
|
-
const L = m + Math.cos(x) * A, z =
|
|
1323
|
+
const L = m + Math.cos(x) * A, z = E + Math.sin(x) * A, U = A / v, _ = f > 0 ? 1 - U * f * 0.5 : 1, Y = y ? this.random(g, p) : 1, N = _ * Y, C = c * N, k = C * 1.5 / 2, H = C / 2, R = h + k, T = a - h - k, D = h + H, O = r - h - H, F = Math.max(R, Math.min(L, T)), P = Math.max(D, Math.min(z, O));
|
|
1324
1324
|
let M = 0;
|
|
1325
|
-
if (
|
|
1326
|
-
const G = x * 180 / Math.PI % 360, X = this.random(l,
|
|
1327
|
-
M =
|
|
1328
|
-
} else
|
|
1329
|
-
const W = t -
|
|
1325
|
+
if (d === "random") {
|
|
1326
|
+
const G = x * 180 / Math.PI % 360, X = this.random(l, u);
|
|
1327
|
+
M = s.spiralType === "golden" ? X : G * 0.1 + X * 0.9;
|
|
1328
|
+
} else d === "tangent" && (M = this.calculateSpiralTangent(x, A, s));
|
|
1329
|
+
const W = t - S;
|
|
1330
1330
|
o.push({
|
|
1331
|
-
id:
|
|
1331
|
+
id: S,
|
|
1332
1332
|
x: F,
|
|
1333
1333
|
y: P,
|
|
1334
1334
|
rotation: M,
|
|
1335
1335
|
scale: N,
|
|
1336
|
-
baseSize:
|
|
1336
|
+
baseSize: C,
|
|
1337
1337
|
zIndex: W
|
|
1338
1338
|
});
|
|
1339
1339
|
}
|
|
@@ -1348,11 +1348,11 @@ class he {
|
|
|
1348
1348
|
if (i.spiralType === "golden")
|
|
1349
1349
|
o = t + Math.PI / 2;
|
|
1350
1350
|
else if (i.spiralType === "archimedean") {
|
|
1351
|
-
const r = 1 / i.tightness,
|
|
1352
|
-
o = t +
|
|
1351
|
+
const r = 1 / i.tightness, s = Math.atan(e / r);
|
|
1352
|
+
o = t + s;
|
|
1353
1353
|
} else {
|
|
1354
|
-
const r = 0.15 / i.tightness,
|
|
1355
|
-
o = t +
|
|
1354
|
+
const r = 0.15 / i.tightness, s = Math.atan(1 / r);
|
|
1355
|
+
o = t + s;
|
|
1356
1356
|
}
|
|
1357
1357
|
return o * 180 / Math.PI % 360 - 90;
|
|
1358
1358
|
}
|
|
@@ -1369,16 +1369,16 @@ class he {
|
|
|
1369
1369
|
* r = a + b*θ (constant spacing between arms)
|
|
1370
1370
|
*/
|
|
1371
1371
|
calculateArchimedeanRadius(t, e, i, o) {
|
|
1372
|
-
const
|
|
1373
|
-
return t /
|
|
1372
|
+
const a = e * 0.5 * o;
|
|
1373
|
+
return t / a * i;
|
|
1374
1374
|
}
|
|
1375
1375
|
/**
|
|
1376
1376
|
* Calculate radius for logarithmic (equiangular) spiral
|
|
1377
1377
|
* r = a * e^(b*θ)
|
|
1378
1378
|
*/
|
|
1379
1379
|
calculateLogarithmicRadius(t, e, i, o) {
|
|
1380
|
-
const
|
|
1381
|
-
return
|
|
1380
|
+
const a = i * 0.05, r = 0.15 / o, s = a * Math.exp(r * t), h = e * 0.3 * o, c = a * Math.exp(r * h);
|
|
1381
|
+
return s / c * i;
|
|
1382
1382
|
}
|
|
1383
1383
|
/**
|
|
1384
1384
|
* Utility: Generate random number between min and max
|
|
@@ -1407,46 +1407,46 @@ class ue {
|
|
|
1407
1407
|
* @returns Array of layout objects with position, rotation, scale
|
|
1408
1408
|
*/
|
|
1409
1409
|
generate(t, e, i = {}) {
|
|
1410
|
-
const o = [], { width:
|
|
1410
|
+
const o = [], { width: a, height: r } = e, s = { ...de, ...this.config.cluster }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, y = g !== 1 || p !== 1, f = this.calculateClusterCount(
|
|
1411
1411
|
t,
|
|
1412
|
-
|
|
1413
|
-
|
|
1412
|
+
s.clusterCount,
|
|
1413
|
+
a,
|
|
1414
1414
|
r,
|
|
1415
|
-
|
|
1415
|
+
s.clusterSpacing
|
|
1416
1416
|
), m = this.generateClusterCenters(
|
|
1417
|
-
|
|
1418
|
-
|
|
1417
|
+
f,
|
|
1418
|
+
a,
|
|
1419
1419
|
r,
|
|
1420
1420
|
h,
|
|
1421
|
-
|
|
1422
|
-
),
|
|
1421
|
+
s
|
|
1422
|
+
), E = new Array(f).fill(0);
|
|
1423
1423
|
for (let w = 0; w < t; w++)
|
|
1424
|
-
|
|
1424
|
+
E[w % f]++;
|
|
1425
1425
|
let v = 0;
|
|
1426
|
-
for (let w = 0; w <
|
|
1427
|
-
const
|
|
1426
|
+
for (let w = 0; w < f; w++) {
|
|
1427
|
+
const S = m[w], x = E[w];
|
|
1428
1428
|
for (let A = 0; A < x; A++) {
|
|
1429
1429
|
let L, z;
|
|
1430
|
-
if (
|
|
1431
|
-
L = this.gaussianRandom() *
|
|
1430
|
+
if (s.distribution === "gaussian")
|
|
1431
|
+
L = this.gaussianRandom() * S.spread, z = this.gaussianRandom() * S.spread;
|
|
1432
1432
|
else {
|
|
1433
|
-
const M = this.random(0, Math.PI * 2), W = this.random(0,
|
|
1433
|
+
const M = this.random(0, Math.PI * 2), W = this.random(0, S.spread);
|
|
1434
1434
|
L = Math.cos(M) * W, z = Math.sin(M) * W;
|
|
1435
1435
|
}
|
|
1436
|
-
const U = 1 +
|
|
1436
|
+
const U = 1 + s.overlap * 0.5, _ = 1 + s.overlap * 0.3;
|
|
1437
1437
|
L /= U, z /= U;
|
|
1438
|
-
const Y =
|
|
1439
|
-
let
|
|
1440
|
-
const R =
|
|
1441
|
-
|
|
1442
|
-
const
|
|
1438
|
+
const Y = y ? this.random(g, p) : 1, N = _ * Y, C = c * N;
|
|
1439
|
+
let $ = S.x + L, k = S.y + z;
|
|
1440
|
+
const R = C * 1.5 / 2, T = C / 2;
|
|
1441
|
+
$ = Math.max(h + R, Math.min($, a - h - R)), k = Math.max(h + T, Math.min(k, r - h - T));
|
|
1442
|
+
const D = d === "random" ? this.random(l, u) : 0, F = Math.sqrt(L * L + z * z) / S.spread, P = Math.round((1 - F) * 50) + 1;
|
|
1443
1443
|
o.push({
|
|
1444
1444
|
id: v,
|
|
1445
|
-
x:
|
|
1445
|
+
x: $,
|
|
1446
1446
|
y: k,
|
|
1447
|
-
rotation:
|
|
1447
|
+
rotation: D,
|
|
1448
1448
|
scale: N,
|
|
1449
|
-
baseSize:
|
|
1449
|
+
baseSize: C,
|
|
1450
1450
|
zIndex: P
|
|
1451
1451
|
}), v++;
|
|
1452
1452
|
}
|
|
@@ -1456,36 +1456,36 @@ class ue {
|
|
|
1456
1456
|
/**
|
|
1457
1457
|
* Calculate optimal number of clusters based on image count and container
|
|
1458
1458
|
*/
|
|
1459
|
-
calculateClusterCount(t, e, i, o,
|
|
1459
|
+
calculateClusterCount(t, e, i, o, a) {
|
|
1460
1460
|
if (e !== "auto")
|
|
1461
1461
|
return Math.max(1, Math.min(e, t));
|
|
1462
|
-
const
|
|
1463
|
-
i /
|
|
1462
|
+
const s = Math.max(1, Math.ceil(t / 8)), h = Math.floor(
|
|
1463
|
+
i / a * (o / a) * 0.6
|
|
1464
1464
|
);
|
|
1465
|
-
return Math.max(1, Math.min(
|
|
1465
|
+
return Math.max(1, Math.min(s, h, 10));
|
|
1466
1466
|
}
|
|
1467
1467
|
/**
|
|
1468
1468
|
* Generate cluster center positions with spacing constraints
|
|
1469
1469
|
*/
|
|
1470
|
-
generateClusterCenters(t, e, i, o,
|
|
1471
|
-
const r = [], h = o +
|
|
1472
|
-
for (let
|
|
1473
|
-
let
|
|
1474
|
-
for (let
|
|
1475
|
-
const
|
|
1470
|
+
generateClusterCenters(t, e, i, o, a) {
|
|
1471
|
+
const r = [], h = o + a.clusterSpread, c = e - o - a.clusterSpread, d = o + a.clusterSpread, l = i - o - a.clusterSpread;
|
|
1472
|
+
for (let u = 0; u < t; u++) {
|
|
1473
|
+
let g = null, p = -1;
|
|
1474
|
+
for (let y = 0; y < 100; y++) {
|
|
1475
|
+
const f = {
|
|
1476
1476
|
x: this.random(h, c),
|
|
1477
|
-
y: this.random(
|
|
1478
|
-
spread: this.calculateClusterSpread(
|
|
1477
|
+
y: this.random(d, l),
|
|
1478
|
+
spread: this.calculateClusterSpread(a)
|
|
1479
1479
|
};
|
|
1480
1480
|
let m = 1 / 0;
|
|
1481
|
-
for (const
|
|
1482
|
-
const v =
|
|
1483
|
-
m = Math.min(m,
|
|
1481
|
+
for (const E of r) {
|
|
1482
|
+
const v = f.x - E.x, w = f.y - E.y, S = Math.sqrt(v * v + w * w);
|
|
1483
|
+
m = Math.min(m, S);
|
|
1484
1484
|
}
|
|
1485
|
-
if ((r.length === 0 || m >
|
|
1485
|
+
if ((r.length === 0 || m > p) && (g = f, p = m), m >= a.clusterSpacing)
|
|
1486
1486
|
break;
|
|
1487
1487
|
}
|
|
1488
|
-
|
|
1488
|
+
g && r.push(g);
|
|
1489
1489
|
}
|
|
1490
1490
|
return r;
|
|
1491
1491
|
}
|
|
@@ -1525,25 +1525,25 @@ class ge {
|
|
|
1525
1525
|
* @returns Array of layout objects with position, rotation, scale
|
|
1526
1526
|
*/
|
|
1527
1527
|
generate(t, e, i = {}) {
|
|
1528
|
-
const o = [], { width:
|
|
1529
|
-
...
|
|
1528
|
+
const o = [], { width: a, height: r } = e, s = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, u = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, p = u !== 1 || g !== 1, y = i.fixedHeight ?? s, f = {
|
|
1529
|
+
...Dt,
|
|
1530
1530
|
...this.config.wave
|
|
1531
|
-
}, { rows: m, amplitude:
|
|
1531
|
+
}, { rows: m, amplitude: E, frequency: v, phaseShift: w, synchronization: S } = f, x = Math.ceil(t / m), z = y * 1.5 / 2, U = h + z, _ = a - h - z, Y = _ - U, N = x > 1 ? Y / (x - 1) : 0, C = h + E + y / 2, $ = r - h - E - y / 2, k = $ - C, H = m > 1 ? k / (m - 1) : 0;
|
|
1532
1532
|
let R = 0;
|
|
1533
|
-
for (let
|
|
1534
|
-
const
|
|
1535
|
-
let
|
|
1536
|
-
|
|
1533
|
+
for (let T = 0; T < m && R < t; T++) {
|
|
1534
|
+
const D = m === 1 ? (C + $) / 2 : C + T * H;
|
|
1535
|
+
let O = 0;
|
|
1536
|
+
S === "offset" ? O = T * w : S === "alternating" && (O = T * Math.PI);
|
|
1537
1537
|
for (let F = 0; F < x && R < t; F++) {
|
|
1538
|
-
const P = x === 1 ? (U + _) / 2 : U + F * N, M = this.calculateWaveY(P,
|
|
1539
|
-
let
|
|
1540
|
-
c === "tangent" ?
|
|
1541
|
-
const K = B * 1.5 / 2,
|
|
1538
|
+
const P = x === 1 ? (U + _) / 2 : U + F * N, M = this.calculateWaveY(P, a, E, v, O), W = P, G = D + M, X = p ? this.random(u, g) : 1, B = y * X;
|
|
1539
|
+
let V = 0;
|
|
1540
|
+
c === "tangent" ? V = this.calculateRotation(P, a, E, v, O) : c === "random" && (V = this.random(d, l));
|
|
1541
|
+
const K = B * 1.5 / 2, at = B / 2, tt = h + K, et = a - h - K, rt = h + at, ct = r - h - at;
|
|
1542
1542
|
o.push({
|
|
1543
1543
|
id: R,
|
|
1544
|
-
x: Math.max(
|
|
1545
|
-
y: Math.max(
|
|
1546
|
-
rotation:
|
|
1544
|
+
x: Math.max(tt, Math.min(W, et)),
|
|
1545
|
+
y: Math.max(rt, Math.min(G, ct)),
|
|
1546
|
+
rotation: V,
|
|
1547
1547
|
scale: X,
|
|
1548
1548
|
baseSize: B,
|
|
1549
1549
|
zIndex: R + 1
|
|
@@ -1561,9 +1561,9 @@ class ge {
|
|
|
1561
1561
|
* @param phase - Phase offset
|
|
1562
1562
|
* @returns Y displacement from baseline
|
|
1563
1563
|
*/
|
|
1564
|
-
calculateWaveY(t, e, i, o,
|
|
1564
|
+
calculateWaveY(t, e, i, o, a) {
|
|
1565
1565
|
const r = t / e;
|
|
1566
|
-
return i * Math.sin(o * r * 2 * Math.PI +
|
|
1566
|
+
return i * Math.sin(o * r * 2 * Math.PI + a);
|
|
1567
1567
|
}
|
|
1568
1568
|
/**
|
|
1569
1569
|
* Calculate rotation based on wave tangent
|
|
@@ -1574,9 +1574,9 @@ class ge {
|
|
|
1574
1574
|
* @param phase - Phase offset
|
|
1575
1575
|
* @returns Rotation angle in degrees
|
|
1576
1576
|
*/
|
|
1577
|
-
calculateRotation(t, e, i, o,
|
|
1578
|
-
const r = t / e,
|
|
1579
|
-
return Math.atan(
|
|
1577
|
+
calculateRotation(t, e, i, o, a) {
|
|
1578
|
+
const r = t / e, s = i * o * 2 * Math.PI * Math.cos(o * r * 2 * Math.PI + a) / e;
|
|
1579
|
+
return Math.atan(s) * (180 / Math.PI);
|
|
1580
1580
|
}
|
|
1581
1581
|
/**
|
|
1582
1582
|
* Estimate image width based on height
|
|
@@ -1623,8 +1623,8 @@ class fe {
|
|
|
1623
1623
|
*/
|
|
1624
1624
|
generateLayout(t, e, i = {}) {
|
|
1625
1625
|
const o = this.placementLayout.generate(t, e, i);
|
|
1626
|
-
return o.forEach((
|
|
1627
|
-
this.layouts.set(
|
|
1626
|
+
return o.forEach((a) => {
|
|
1627
|
+
this.layouts.set(a.id, a);
|
|
1628
1628
|
}), o;
|
|
1629
1629
|
}
|
|
1630
1630
|
/**
|
|
@@ -1678,8 +1678,8 @@ class fe {
|
|
|
1678
1678
|
return;
|
|
1679
1679
|
if (typeof i == "number")
|
|
1680
1680
|
return i;
|
|
1681
|
-
const o = i,
|
|
1682
|
-
return
|
|
1681
|
+
const o = i, a = this.resolveBreakpoint(t);
|
|
1682
|
+
return a === "mobile" ? o.mobile ?? o.tablet ?? o.screen : a === "tablet" ? o.tablet ?? o.screen ?? o.mobile : o.screen ?? o.tablet ?? o.mobile;
|
|
1683
1683
|
}
|
|
1684
1684
|
/**
|
|
1685
1685
|
* Calculate adaptive image size based on container dimensions and image count
|
|
@@ -1690,18 +1690,18 @@ class fe {
|
|
|
1690
1690
|
* @returns Calculated sizing result with height
|
|
1691
1691
|
*/
|
|
1692
1692
|
calculateAdaptiveSize(t, e, i, o) {
|
|
1693
|
-
const
|
|
1693
|
+
const a = this.imageConfig.sizing, r = this.resolveBaseHeight(o);
|
|
1694
1694
|
if (r !== void 0)
|
|
1695
1695
|
return { height: r };
|
|
1696
|
-
const
|
|
1697
|
-
let m = Math.sqrt(
|
|
1698
|
-
m *=
|
|
1699
|
-
let
|
|
1700
|
-
if (
|
|
1701
|
-
const v = Math.max(
|
|
1702
|
-
|
|
1696
|
+
const s = a?.minSize ?? 50, h = a?.maxSize ?? 400, c = this.config.targetCoverage ?? 0.6, d = this.config.densityFactor ?? 1, { width: l, height: u } = t, y = l * u * c / e;
|
|
1697
|
+
let m = Math.sqrt(y / 1.4);
|
|
1698
|
+
m *= d, m = Math.min(m, i);
|
|
1699
|
+
let E = this.clamp(m, s, h);
|
|
1700
|
+
if (E === s && m < s) {
|
|
1701
|
+
const v = Math.max(s * 0.05, 20);
|
|
1702
|
+
E = Math.max(v, m);
|
|
1703
1703
|
}
|
|
1704
|
-
return { height:
|
|
1704
|
+
return { height: E };
|
|
1705
1705
|
}
|
|
1706
1706
|
/**
|
|
1707
1707
|
* Utility: Clamp a value between min and max
|
|
@@ -1711,7 +1711,7 @@ class fe {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
}
|
|
1713
1713
|
var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
|
|
1714
|
-
const
|
|
1714
|
+
const At = {
|
|
1715
1715
|
// Geometric shapes - uses percentages for responsive sizing
|
|
1716
1716
|
circle: "circle(50%)",
|
|
1717
1717
|
square: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)",
|
|
@@ -1720,18 +1720,67 @@ const It = {
|
|
|
1720
1720
|
hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
|
1721
1721
|
octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
|
|
1722
1722
|
diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
|
|
1723
|
+
}, me = {
|
|
1724
|
+
// Circle - uses radius in pixels (refHeight of 100px = 50px radius)
|
|
1725
|
+
circle: {
|
|
1726
|
+
refHeight: 100,
|
|
1727
|
+
points: []
|
|
1728
|
+
// Special case: handled separately
|
|
1729
|
+
},
|
|
1730
|
+
// Square - maintains perfect aspect ratio (always 1:1)
|
|
1731
|
+
square: {
|
|
1732
|
+
refHeight: 100,
|
|
1733
|
+
points: [[0, 0], [100, 0], [100, 100], [0, 100]]
|
|
1734
|
+
},
|
|
1735
|
+
// Triangle - isosceles triangle
|
|
1736
|
+
triangle: {
|
|
1737
|
+
refHeight: 100,
|
|
1738
|
+
points: [[50, 0], [100, 100], [0, 100]]
|
|
1739
|
+
},
|
|
1740
|
+
// Pentagon - regular pentagon
|
|
1741
|
+
pentagon: {
|
|
1742
|
+
refHeight: 100,
|
|
1743
|
+
points: [[50, 0], [100, 38], [82, 100], [18, 100], [0, 38]]
|
|
1744
|
+
},
|
|
1745
|
+
// Hexagon - regular hexagon
|
|
1746
|
+
hexagon: {
|
|
1747
|
+
refHeight: 100,
|
|
1748
|
+
points: [[25, 0], [75, 0], [100, 50], [75, 100], [25, 100], [0, 50]]
|
|
1749
|
+
},
|
|
1750
|
+
// Octagon - regular octagon
|
|
1751
|
+
octagon: {
|
|
1752
|
+
refHeight: 100,
|
|
1753
|
+
points: [[30, 0], [70, 0], [100, 30], [100, 70], [70, 100], [30, 100], [0, 70], [0, 30]]
|
|
1754
|
+
},
|
|
1755
|
+
// Diamond - 45-degree rotated square
|
|
1756
|
+
diamond: {
|
|
1757
|
+
refHeight: 100,
|
|
1758
|
+
points: [[50, 0], [100, 50], [50, 100], [0, 50]]
|
|
1759
|
+
}
|
|
1723
1760
|
};
|
|
1724
|
-
function
|
|
1761
|
+
function pe(n) {
|
|
1725
1762
|
if (n)
|
|
1726
|
-
return n in
|
|
1763
|
+
return n in At ? At[n] : n;
|
|
1727
1764
|
}
|
|
1728
|
-
function
|
|
1729
|
-
|
|
1765
|
+
function ye(n, t, e) {
|
|
1766
|
+
const i = me[n];
|
|
1767
|
+
if (!i) return "";
|
|
1768
|
+
const o = t / i.refHeight;
|
|
1769
|
+
if (n === "circle")
|
|
1770
|
+
return `circle(${Math.round(50 * o * 100) / 100}px)`;
|
|
1771
|
+
const a = i.refHeight * o, r = a / 2, s = a / 2, h = (e ?? a) / 2, c = t / 2, d = h - r, l = c - s;
|
|
1772
|
+
return `polygon(${i.points.map(([g, p]) => {
|
|
1773
|
+
const y = Math.round((g * o + d) * 100) / 100, f = Math.round((p * o + l) * 100) / 100;
|
|
1774
|
+
return `${y}px ${f}px`;
|
|
1775
|
+
}).join(", ")})`;
|
|
1730
1776
|
}
|
|
1731
1777
|
function be(n) {
|
|
1732
|
-
return n
|
|
1778
|
+
return n in gt;
|
|
1779
|
+
}
|
|
1780
|
+
function ve(n) {
|
|
1781
|
+
return n ? be(n) ? gt[n] : n : gt.md;
|
|
1733
1782
|
}
|
|
1734
|
-
function
|
|
1783
|
+
function we(n) {
|
|
1735
1784
|
if (!n) return "";
|
|
1736
1785
|
const t = [];
|
|
1737
1786
|
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)
|
|
@@ -1749,54 +1798,65 @@ function Q(n) {
|
|
|
1749
1798
|
const t = n.width ?? 0, e = n.style ?? "solid", i = n.color ?? "#000000";
|
|
1750
1799
|
return `${t}px ${e} ${i}`;
|
|
1751
1800
|
}
|
|
1752
|
-
function
|
|
1801
|
+
function vt(n, t, e) {
|
|
1753
1802
|
if (!n) return {};
|
|
1754
|
-
const
|
|
1803
|
+
const i = {};
|
|
1755
1804
|
if (n.borderRadiusTopLeft !== void 0 || n.borderRadiusTopRight !== void 0 || n.borderRadiusBottomRight !== void 0 || n.borderRadiusBottomLeft !== void 0) {
|
|
1756
1805
|
const s = n.border?.radius ?? 0;
|
|
1757
|
-
n.borderRadiusTopLeft !== void 0 ?
|
|
1758
|
-
} else n.border?.radius !== void 0 && (
|
|
1806
|
+
n.borderRadiusTopLeft !== void 0 ? i.borderTopLeftRadius = `${n.borderRadiusTopLeft}px` : s && (i.borderTopLeftRadius = `${s}px`), n.borderRadiusTopRight !== void 0 ? i.borderTopRightRadius = `${n.borderRadiusTopRight}px` : s && (i.borderTopRightRadius = `${s}px`), n.borderRadiusBottomRight !== void 0 ? i.borderBottomRightRadius = `${n.borderRadiusBottomRight}px` : s && (i.borderBottomRightRadius = `${s}px`), n.borderRadiusBottomLeft !== void 0 ? i.borderBottomLeftRadius = `${n.borderRadiusBottomLeft}px` : s && (i.borderBottomLeftRadius = `${s}px`);
|
|
1807
|
+
} else n.border?.radius !== void 0 && (i.borderRadius = `${n.border.radius}px`);
|
|
1759
1808
|
if (n.borderTop || n.borderRight || n.borderBottom || n.borderLeft) {
|
|
1760
|
-
const s = n.border || {},
|
|
1761
|
-
|
|
1762
|
-
} else n.border && (
|
|
1763
|
-
n.shadow !== void 0 && (
|
|
1764
|
-
const
|
|
1765
|
-
if (
|
|
1766
|
-
const s = n.outline.width ?? 0,
|
|
1767
|
-
|
|
1768
|
-
}
|
|
1769
|
-
if (n.objectFit !== void 0 && (
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1809
|
+
const s = n.border || {}, h = { ...s, ...n.borderTop }, c = { ...s, ...n.borderRight }, d = { ...s, ...n.borderBottom }, l = { ...s, ...n.borderLeft };
|
|
1810
|
+
i.borderTop = Q(h), i.borderRight = Q(c), i.borderBottom = Q(d), i.borderLeft = Q(l);
|
|
1811
|
+
} else n.border && (i.border = Q(n.border));
|
|
1812
|
+
n.shadow !== void 0 && (i.boxShadow = ve(n.shadow));
|
|
1813
|
+
const r = we(n.filter);
|
|
1814
|
+
if (i.filter = r || "none", n.opacity !== void 0 && (i.opacity = String(n.opacity)), n.cursor !== void 0 && (i.cursor = n.cursor), n.outline && n.outline.style !== "none" && (n.outline.width ?? 0) > 0) {
|
|
1815
|
+
const s = n.outline.width ?? 0, h = n.outline.style ?? "solid", c = n.outline.color ?? "#000000";
|
|
1816
|
+
i.outline = `${s}px ${h} ${c}`, n.outline.offset !== void 0 && (i.outlineOffset = `${n.outline.offset}px`);
|
|
1817
|
+
}
|
|
1818
|
+
if (n.objectFit !== void 0 && (i.objectFit = n.objectFit), n.aspectRatio !== void 0 && (i.aspectRatio = n.aspectRatio), n.clipPath !== void 0) {
|
|
1819
|
+
let s;
|
|
1820
|
+
const h = typeof n.clipPath == "object" && n.clipPath !== null && "shape" in n.clipPath, c = h ? n.clipPath : void 0;
|
|
1821
|
+
if (c?.mode === "height-relative" && t)
|
|
1822
|
+
s = ye(c.shape, t, e);
|
|
1823
|
+
else {
|
|
1824
|
+
const d = h && c ? c.shape : n.clipPath;
|
|
1825
|
+
s = pe(d);
|
|
1826
|
+
}
|
|
1827
|
+
s && (s === "none" ? i.clipPath = "unset" : (i.clipPath = s, i.overflow = "hidden"));
|
|
1828
|
+
}
|
|
1829
|
+
return i;
|
|
1774
1830
|
}
|
|
1775
|
-
function
|
|
1831
|
+
function xe(n, t) {
|
|
1776
1832
|
t.borderRadius !== void 0 && (n.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (n.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (n.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (n.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (n.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (n.style.border = t.border), t.borderTop !== void 0 && (n.style.borderTop = t.borderTop), t.borderRight !== void 0 && (n.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (n.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (n.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (n.style.boxShadow = t.boxShadow), t.filter !== void 0 && (n.style.filter = t.filter), t.opacity !== void 0 && (n.style.opacity = t.opacity), t.cursor !== void 0 && (n.style.cursor = t.cursor), t.outline !== void 0 && (n.style.outline = t.outline), t.outlineOffset !== void 0 && (n.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (n.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (n.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (n.style.clipPath = t.clipPath), t.overflow !== void 0 && (n.style.overflow = t.overflow);
|
|
1777
1833
|
}
|
|
1778
|
-
function
|
|
1834
|
+
function ut(n, t, e, i) {
|
|
1835
|
+
const o = vt(t, e, i);
|
|
1836
|
+
xe(n, o);
|
|
1837
|
+
}
|
|
1838
|
+
function zt(n) {
|
|
1779
1839
|
return n ? Array.isArray(n) ? n.join(" ") : n : "";
|
|
1780
1840
|
}
|
|
1781
|
-
function
|
|
1782
|
-
const e =
|
|
1841
|
+
function nt(n, t) {
|
|
1842
|
+
const e = zt(t);
|
|
1783
1843
|
e && e.split(" ").forEach((i) => {
|
|
1784
1844
|
i.trim() && n.classList.add(i.trim());
|
|
1785
1845
|
});
|
|
1786
1846
|
}
|
|
1787
|
-
function
|
|
1788
|
-
const e =
|
|
1847
|
+
function ft(n, t) {
|
|
1848
|
+
const e = zt(t);
|
|
1789
1849
|
e && e.split(" ").forEach((i) => {
|
|
1790
1850
|
i.trim() && n.classList.remove(i.trim());
|
|
1791
1851
|
});
|
|
1792
1852
|
}
|
|
1793
|
-
const
|
|
1853
|
+
const Ct = {
|
|
1794
1854
|
UNFOCUSING: 999,
|
|
1795
1855
|
FOCUSING: 1e3
|
|
1796
1856
|
};
|
|
1797
|
-
class
|
|
1857
|
+
class Ee {
|
|
1798
1858
|
constructor(t, e, i) {
|
|
1799
|
-
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.
|
|
1859
|
+
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.styling = i, this.focusedClassName = i?.focused?.className;
|
|
1800
1860
|
}
|
|
1801
1861
|
/**
|
|
1802
1862
|
* Get current state machine state
|
|
@@ -1821,19 +1881,19 @@ class ve {
|
|
|
1821
1881
|
* Returns actual pixel dimensions instead of scale factor for sharper rendering
|
|
1822
1882
|
*/
|
|
1823
1883
|
calculateFocusDimensions(t, e, i) {
|
|
1824
|
-
const o = this.normalizeScalePercent(this.config.scalePercent),
|
|
1825
|
-
let
|
|
1884
|
+
const o = this.normalizeScalePercent(this.config.scalePercent), a = i.height * o, r = t / e;
|
|
1885
|
+
let s = a, h = s * r;
|
|
1826
1886
|
const c = i.width * o;
|
|
1827
|
-
return h > c && (h = c,
|
|
1887
|
+
return h > c && (h = c, s = h / r), { width: h, height: s };
|
|
1828
1888
|
}
|
|
1829
1889
|
/**
|
|
1830
1890
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
1831
1891
|
* Scale is handled by animating actual dimensions for sharper rendering
|
|
1832
1892
|
*/
|
|
1833
1893
|
calculateFocusTransform(t, e) {
|
|
1834
|
-
const i = t.width / 2, o = t.height / 2,
|
|
1894
|
+
const i = t.width / 2, o = t.height / 2, a = i - e.x, r = o - e.y;
|
|
1835
1895
|
return {
|
|
1836
|
-
x:
|
|
1896
|
+
x: a,
|
|
1837
1897
|
y: r,
|
|
1838
1898
|
rotation: 0,
|
|
1839
1899
|
scale: 1
|
|
@@ -1855,19 +1915,19 @@ class ve {
|
|
|
1855
1915
|
* Create a Web Animation that animates both transform (position) and dimensions
|
|
1856
1916
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
1857
1917
|
*/
|
|
1858
|
-
animateWithDimensions(t, e, i, o,
|
|
1859
|
-
const c = this.buildDimensionZoomTransform(e),
|
|
1918
|
+
animateWithDimensions(t, e, i, o, a, r, s, h) {
|
|
1919
|
+
const c = this.buildDimensionZoomTransform(e), d = this.buildDimensionZoomTransform(i);
|
|
1860
1920
|
return t.style.transition = "none", t.animate(
|
|
1861
1921
|
[
|
|
1862
1922
|
{
|
|
1863
1923
|
transform: c,
|
|
1864
1924
|
width: `${o}px`,
|
|
1865
|
-
height: `${
|
|
1925
|
+
height: `${a}px`
|
|
1866
1926
|
},
|
|
1867
1927
|
{
|
|
1868
|
-
transform:
|
|
1928
|
+
transform: d,
|
|
1869
1929
|
width: `${r}px`,
|
|
1870
|
-
height: `${
|
|
1930
|
+
height: `${s}px`
|
|
1871
1931
|
}
|
|
1872
1932
|
],
|
|
1873
1933
|
{
|
|
@@ -1879,15 +1939,30 @@ class ve {
|
|
|
1879
1939
|
}
|
|
1880
1940
|
/**
|
|
1881
1941
|
* Apply focused styling to an element
|
|
1942
|
+
* Applies non-clip-path styles immediately, clip-path will be updated during animation via startClipPathAnimation
|
|
1882
1943
|
*/
|
|
1883
1944
|
applyFocusedStyling(t, e) {
|
|
1884
|
-
t.style.zIndex = String(e), t.classList.add("fbn-ic-focused"),
|
|
1945
|
+
t.style.zIndex = String(e), t.classList.add("fbn-ic-focused"), nt(t, this.focusedClassName);
|
|
1885
1946
|
}
|
|
1886
1947
|
/**
|
|
1887
1948
|
* Remove focused styling from an element
|
|
1949
|
+
* Removes classes and z-index, clip-path will be updated during animation via startClipPathAnimation
|
|
1888
1950
|
*/
|
|
1889
1951
|
removeFocusedStyling(t, e) {
|
|
1890
|
-
t.style.zIndex = e, t.classList.remove("fbn-ic-focused"),
|
|
1952
|
+
t.style.zIndex = e, t.classList.remove("fbn-ic-focused"), ft(t, this.focusedClassName);
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Continuously update clip-path during animation based on current element dimensions
|
|
1956
|
+
* This ensures clip-path changes smoothly as width/height animate
|
|
1957
|
+
*/
|
|
1958
|
+
startClipPathAnimation(t, e, i) {
|
|
1959
|
+
let o = i ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
|
|
1960
|
+
i && this.styling?.focused && this.styling.focused.clipPath === void 0 && (o = { ...o, clipPath: void 0 });
|
|
1961
|
+
const a = () => {
|
|
1962
|
+
const r = t.offsetHeight, s = t.offsetWidth, h = vt(o, r, s);
|
|
1963
|
+
h.clipPath !== void 0 ? t.style.clipPath = h.clipPath : t.style.clipPath = "unset", h.overflow !== void 0 && (t.style.overflow = h.overflow), e.animation.playState === "running" && requestAnimationFrame(a);
|
|
1964
|
+
};
|
|
1965
|
+
requestAnimationFrame(a);
|
|
1891
1966
|
}
|
|
1892
1967
|
/**
|
|
1893
1968
|
* Start focus animation for an image using dimension-based zoom
|
|
@@ -1895,48 +1970,50 @@ class ve {
|
|
|
1895
1970
|
* @param fromTransform - Optional starting transform (for mid-animation reversals)
|
|
1896
1971
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1897
1972
|
*/
|
|
1898
|
-
startFocusAnimation(t, e, i, o,
|
|
1899
|
-
const r = t.style.zIndex || "",
|
|
1900
|
-
this.
|
|
1901
|
-
const l =
|
|
1973
|
+
startFocusAnimation(t, e, i, o, a) {
|
|
1974
|
+
const r = t.style.zIndex || "", s = t.offsetWidth, h = t.offsetHeight, c = this.calculateFocusDimensions(s, h, e), d = this.calculateFocusTransform(e, i);
|
|
1975
|
+
this.animationEngine.cancelAllAnimations(t);
|
|
1976
|
+
const l = this.config.animationDuration ?? 600;
|
|
1977
|
+
this.applyFocusedStyling(t, Ct.FOCUSING);
|
|
1978
|
+
const u = o ?? {
|
|
1902
1979
|
x: 0,
|
|
1903
1980
|
y: 0,
|
|
1904
1981
|
rotation: i.rotation,
|
|
1905
1982
|
scale: 1
|
|
1906
1983
|
// No scale - using dimensions
|
|
1907
|
-
},
|
|
1984
|
+
}, g = a?.width ?? s, p = a?.height ?? h, y = this.animateWithDimensions(
|
|
1908
1985
|
t,
|
|
1909
|
-
l,
|
|
1910
1986
|
u,
|
|
1911
1987
|
d,
|
|
1912
|
-
|
|
1988
|
+
g,
|
|
1989
|
+
p,
|
|
1913
1990
|
c.width,
|
|
1914
1991
|
c.height,
|
|
1915
|
-
|
|
1916
|
-
),
|
|
1992
|
+
l
|
|
1993
|
+
), f = {
|
|
1917
1994
|
id: `focus-${Date.now()}`,
|
|
1918
1995
|
element: t,
|
|
1919
|
-
animation:
|
|
1920
|
-
fromState:
|
|
1921
|
-
toState:
|
|
1996
|
+
animation: y,
|
|
1997
|
+
fromState: u,
|
|
1998
|
+
toState: d,
|
|
1922
1999
|
startTime: performance.now(),
|
|
1923
|
-
duration:
|
|
2000
|
+
duration: l
|
|
1924
2001
|
};
|
|
1925
2002
|
return this.focusData = {
|
|
1926
2003
|
element: t,
|
|
1927
2004
|
originalState: i,
|
|
1928
|
-
focusTransform:
|
|
2005
|
+
focusTransform: d,
|
|
1929
2006
|
originalZIndex: r,
|
|
1930
|
-
originalWidth:
|
|
2007
|
+
originalWidth: s,
|
|
1931
2008
|
originalHeight: h,
|
|
1932
2009
|
focusWidth: c.width,
|
|
1933
2010
|
focusHeight: c.height
|
|
1934
|
-
}, {
|
|
2011
|
+
}, this.startClipPathAnimation(t, f, !0), {
|
|
1935
2012
|
element: t,
|
|
1936
2013
|
originalState: i,
|
|
1937
|
-
animationHandle:
|
|
2014
|
+
animationHandle: f,
|
|
1938
2015
|
direction: "in",
|
|
1939
|
-
originalWidth:
|
|
2016
|
+
originalWidth: s,
|
|
1940
2017
|
originalHeight: h
|
|
1941
2018
|
};
|
|
1942
2019
|
}
|
|
@@ -1946,38 +2023,40 @@ class ve {
|
|
|
1946
2023
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1947
2024
|
*/
|
|
1948
2025
|
startUnfocusAnimation(t, e, i, o) {
|
|
1949
|
-
t.style.zIndex = String(
|
|
1950
|
-
const
|
|
2026
|
+
t.style.zIndex = String(Ct.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2027
|
+
const a = this.config.animationDuration ?? 600;
|
|
2028
|
+
t.classList.remove("fbn-ic-focused"), ft(t, this.focusedClassName);
|
|
2029
|
+
const r = i ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, h = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, c = {
|
|
1951
2030
|
x: 0,
|
|
1952
2031
|
y: 0,
|
|
1953
2032
|
rotation: e.rotation,
|
|
1954
2033
|
scale: 1
|
|
1955
2034
|
// No scale - using dimensions
|
|
1956
|
-
},
|
|
2035
|
+
}, d = this.focusData?.originalWidth ?? t.offsetWidth, l = this.focusData?.originalHeight ?? t.offsetHeight, u = this.animateWithDimensions(
|
|
1957
2036
|
t,
|
|
1958
|
-
s,
|
|
1959
|
-
h,
|
|
1960
2037
|
r,
|
|
1961
|
-
a,
|
|
1962
2038
|
c,
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2039
|
+
s,
|
|
2040
|
+
h,
|
|
2041
|
+
d,
|
|
2042
|
+
l,
|
|
2043
|
+
a
|
|
2044
|
+
), g = {
|
|
1966
2045
|
id: `unfocus-${Date.now()}`,
|
|
1967
2046
|
element: t,
|
|
1968
|
-
animation:
|
|
1969
|
-
fromState:
|
|
1970
|
-
toState:
|
|
2047
|
+
animation: u,
|
|
2048
|
+
fromState: r,
|
|
2049
|
+
toState: c,
|
|
1971
2050
|
startTime: performance.now(),
|
|
1972
|
-
duration:
|
|
2051
|
+
duration: a
|
|
1973
2052
|
};
|
|
1974
|
-
return {
|
|
2053
|
+
return this.startClipPathAnimation(t, g, !1), {
|
|
1975
2054
|
element: t,
|
|
1976
2055
|
originalState: e,
|
|
1977
|
-
animationHandle:
|
|
2056
|
+
animationHandle: g,
|
|
1978
2057
|
direction: "out",
|
|
1979
|
-
originalWidth:
|
|
1980
|
-
originalHeight:
|
|
2058
|
+
originalWidth: d,
|
|
2059
|
+
originalHeight: l
|
|
1981
2060
|
};
|
|
1982
2061
|
}
|
|
1983
2062
|
/**
|
|
@@ -1995,10 +2074,10 @@ class ve {
|
|
|
1995
2074
|
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
1996
2075
|
*/
|
|
1997
2076
|
captureMidAnimationState(t) {
|
|
1998
|
-
const e = getComputedStyle(t), i = new DOMMatrix(e.transform), o = t.offsetWidth,
|
|
1999
|
-
return t.style.width = `${o}px`, t.style.height = `${
|
|
2000
|
-
transform: { x: r, y:
|
|
2001
|
-
dimensions: { width: o, height:
|
|
2077
|
+
const e = getComputedStyle(t), i = new DOMMatrix(e.transform), o = t.offsetWidth, a = t.offsetHeight, r = i.e + o * 0.5, s = i.f + a * 0.5, h = Math.atan2(i.b, i.a) * (180 / Math.PI);
|
|
2078
|
+
return t.style.width = `${o}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${h}deg)`, t.style.transition = "none", {
|
|
2079
|
+
transform: { x: r, y: s, rotation: h, scale: 1 },
|
|
2080
|
+
dimensions: { width: o, height: a }
|
|
2002
2081
|
};
|
|
2003
2082
|
}
|
|
2004
2083
|
/**
|
|
@@ -2013,10 +2092,10 @@ class ve {
|
|
|
2013
2092
|
/**
|
|
2014
2093
|
* Reset an element instantly to its original position and dimensions (no animation)
|
|
2015
2094
|
*/
|
|
2016
|
-
resetElementInstantly(t, e, i, o,
|
|
2095
|
+
resetElementInstantly(t, e, i, o, a) {
|
|
2017
2096
|
this.animationEngine.cancelAllAnimations(t);
|
|
2018
2097
|
const r = ["translate(-50%, -50%)"];
|
|
2019
|
-
r.push("translate(0px, 0px)"), r.push(`rotate(${e.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), o !== void 0 &&
|
|
2098
|
+
r.push("translate(0px, 0px)"), r.push(`rotate(${e.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), o !== void 0 && a !== void 0 && (t.style.width = `${o}px`, t.style.height = `${a}px`), this.removeFocusedStyling(t, i);
|
|
2020
2099
|
}
|
|
2021
2100
|
/**
|
|
2022
2101
|
* Focus (zoom) an image to center of container
|
|
@@ -2026,11 +2105,11 @@ class ve {
|
|
|
2026
2105
|
if (this.currentFocus === t && this.state === I.FOCUSED)
|
|
2027
2106
|
return this.unfocusImage();
|
|
2028
2107
|
if (this.incoming?.element === t && this.state === I.FOCUSING) {
|
|
2029
|
-
const { transform:
|
|
2108
|
+
const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
|
|
2030
2109
|
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2031
2110
|
t,
|
|
2032
2111
|
this.incoming.originalState,
|
|
2033
|
-
|
|
2112
|
+
a,
|
|
2034
2113
|
r
|
|
2035
2114
|
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2036
2115
|
return;
|
|
@@ -2073,18 +2152,18 @@ class ve {
|
|
|
2073
2152
|
if (this.incoming?.element === t)
|
|
2074
2153
|
return;
|
|
2075
2154
|
if (this.outgoing?.element === t) {
|
|
2076
|
-
const { transform:
|
|
2155
|
+
const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
|
|
2077
2156
|
if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
|
|
2078
|
-
const { transform:
|
|
2157
|
+
const { transform: s, dimensions: h } = this.captureMidAnimationState(this.incoming.element);
|
|
2079
2158
|
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2080
2159
|
this.incoming.element,
|
|
2081
2160
|
this.incoming.originalState,
|
|
2082
|
-
|
|
2161
|
+
s,
|
|
2083
2162
|
h
|
|
2084
2163
|
);
|
|
2085
2164
|
} else
|
|
2086
2165
|
this.outgoing = null;
|
|
2087
|
-
if (this.incoming = this.startFocusAnimation(t, e, i,
|
|
2166
|
+
if (this.incoming = this.startFocusAnimation(t, e, i, a, r), await Promise.all([
|
|
2088
2167
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2089
2168
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2090
2169
|
]), this.focusGeneration !== o) return;
|
|
@@ -2098,11 +2177,11 @@ class ve {
|
|
|
2098
2177
|
this.outgoing.originalWidth,
|
|
2099
2178
|
this.outgoing.originalHeight
|
|
2100
2179
|
), this.outgoing = null), this.incoming) {
|
|
2101
|
-
const { transform:
|
|
2180
|
+
const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2102
2181
|
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2103
2182
|
this.incoming.element,
|
|
2104
2183
|
this.incoming.originalState,
|
|
2105
|
-
|
|
2184
|
+
a,
|
|
2106
2185
|
r
|
|
2107
2186
|
);
|
|
2108
2187
|
}
|
|
@@ -2123,11 +2202,11 @@ class ve {
|
|
|
2123
2202
|
const t = ++this.focusGeneration;
|
|
2124
2203
|
if (!this.currentFocus || !this.focusData) {
|
|
2125
2204
|
if (this.incoming && this.state === I.FOCUSING) {
|
|
2126
|
-
const { transform:
|
|
2205
|
+
const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2127
2206
|
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2128
2207
|
this.incoming.element,
|
|
2129
2208
|
this.incoming.originalState,
|
|
2130
|
-
|
|
2209
|
+
a,
|
|
2131
2210
|
r
|
|
2132
2211
|
), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2133
2212
|
this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = I.IDLE;
|
|
@@ -2135,19 +2214,19 @@ class ve {
|
|
|
2135
2214
|
return;
|
|
2136
2215
|
}
|
|
2137
2216
|
if (this.state === I.CROSS_ANIMATING && this.incoming) {
|
|
2138
|
-
const { transform:
|
|
2217
|
+
const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2139
2218
|
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2140
|
-
const
|
|
2219
|
+
const s = this.startUnfocusAnimation(
|
|
2141
2220
|
this.incoming.element,
|
|
2142
2221
|
this.incoming.originalState,
|
|
2143
|
-
|
|
2222
|
+
a,
|
|
2144
2223
|
r
|
|
2145
2224
|
);
|
|
2146
2225
|
if (await Promise.all([
|
|
2147
2226
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2148
|
-
this.waitForAnimation(
|
|
2227
|
+
this.waitForAnimation(s.animationHandle)
|
|
2149
2228
|
]), this.focusGeneration !== t) return;
|
|
2150
|
-
this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(
|
|
2229
|
+
this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(s.element, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
|
|
2151
2230
|
return;
|
|
2152
2231
|
}
|
|
2153
2232
|
this.state = I.UNFOCUSING;
|
|
@@ -2192,8 +2271,8 @@ class ve {
|
|
|
2192
2271
|
*/
|
|
2193
2272
|
setDragOffset(t) {
|
|
2194
2273
|
if (!this.currentFocus || !this.focusData || this.state !== I.FOCUSED) return;
|
|
2195
|
-
const e = this.currentFocus, i = this.focusData.focusTransform, o = ["translate(-50%, -50%)"],
|
|
2196
|
-
o.push(`translate(${
|
|
2274
|
+
const e = this.currentFocus, i = this.focusData.focusTransform, o = ["translate(-50%, -50%)"], a = (i.x ?? 0) + t, r = i.y ?? 0;
|
|
2275
|
+
o.push(`translate(${a}px, ${r}px)`), i.rotation !== void 0 && o.push(`rotate(${i.rotation}deg)`), e.style.transition = "none", e.style.transform = o.join(" ");
|
|
2197
2276
|
}
|
|
2198
2277
|
/**
|
|
2199
2278
|
* Clear the drag offset, optionally animating back to center
|
|
@@ -2202,9 +2281,9 @@ class ve {
|
|
|
2202
2281
|
*/
|
|
2203
2282
|
clearDragOffset(t, e = 150) {
|
|
2204
2283
|
if (!this.currentFocus || !this.focusData || this.state !== I.FOCUSED) return;
|
|
2205
|
-
const i = this.currentFocus, o = this.focusData.focusTransform,
|
|
2206
|
-
|
|
2207
|
-
const h =
|
|
2284
|
+
const i = this.currentFocus, o = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = o.x ?? 0, s = o.y ?? 0;
|
|
2285
|
+
a.push(`translate(${r}px, ${s}px)`), o.rotation !== void 0 && a.push(`rotate(${o.rotation}deg)`);
|
|
2286
|
+
const h = a.join(" ");
|
|
2208
2287
|
t ? (i.style.transition = `transform ${e}ms ease-out`, i.style.transform = h, setTimeout(() => {
|
|
2209
2288
|
this.currentFocus === i && (i.style.transition = "none");
|
|
2210
2289
|
}, e)) : (i.style.transition = "none", i.style.transform = h);
|
|
@@ -2234,7 +2313,7 @@ class ve {
|
|
|
2234
2313
|
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2235
2314
|
}
|
|
2236
2315
|
}
|
|
2237
|
-
const
|
|
2316
|
+
const Se = 50, Ie = 0.5, Ae = 20, Ce = 0.3, Te = 150, Re = 30, ot = class ot {
|
|
2238
2317
|
constructor(t, e) {
|
|
2239
2318
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = e, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2240
2319
|
}
|
|
@@ -2261,7 +2340,7 @@ const we = 50, xe = 0.5, Se = 20, Ee = 0.3, Ie = 150, Ae = 30, at = class at {
|
|
|
2261
2340
|
* Used to prevent click-outside from unfocusing immediately after touch
|
|
2262
2341
|
*/
|
|
2263
2342
|
hadRecentTouch() {
|
|
2264
|
-
return Date.now() - this.recentTouchTimestamp <
|
|
2343
|
+
return Date.now() - this.recentTouchTimestamp < ot.TOUCH_CLICK_DELAY;
|
|
2265
2344
|
}
|
|
2266
2345
|
handleTouchStart(t) {
|
|
2267
2346
|
if (t.touches.length !== 1) return;
|
|
@@ -2280,29 +2359,29 @@ const we = 50, xe = 0.5, Se = 20, Ee = 0.3, Ie = 150, Ae = 30, at = class at {
|
|
|
2280
2359
|
if (!this.touchState || t.touches.length !== 1) return;
|
|
2281
2360
|
const e = t.touches[0], i = e.clientX - this.touchState.startX, o = e.clientY - this.touchState.startY;
|
|
2282
2361
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + o * o) > 10) {
|
|
2283
|
-
const
|
|
2284
|
-
this.touchState.isHorizontalSwipe =
|
|
2362
|
+
const s = Math.atan2(Math.abs(o), Math.abs(i)) * (180 / Math.PI);
|
|
2363
|
+
this.touchState.isHorizontalSwipe = s <= Re;
|
|
2285
2364
|
}
|
|
2286
2365
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2287
2366
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
|
|
2288
|
-
const
|
|
2289
|
-
this.callbacks.onDragOffset(
|
|
2367
|
+
const a = i * Ce;
|
|
2368
|
+
this.callbacks.onDragOffset(a);
|
|
2290
2369
|
}
|
|
2291
2370
|
}
|
|
2292
2371
|
handleTouchEnd(t) {
|
|
2293
2372
|
if (!this.touchState) return;
|
|
2294
2373
|
this.recentTouchTimestamp = Date.now();
|
|
2295
|
-
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, o = Math.abs(e) / i,
|
|
2374
|
+
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, o = Math.abs(e) / i, a = Math.abs(e);
|
|
2296
2375
|
let r = !1;
|
|
2297
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (
|
|
2376
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= Se || o >= Ie && a >= Ae) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2298
2377
|
}
|
|
2299
2378
|
handleTouchCancel(t) {
|
|
2300
2379
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
2301
2380
|
}
|
|
2302
2381
|
};
|
|
2303
|
-
|
|
2304
|
-
let mt =
|
|
2305
|
-
class
|
|
2382
|
+
ot.TOUCH_CLICK_DELAY = 300;
|
|
2383
|
+
let mt = ot;
|
|
2384
|
+
class Me {
|
|
2306
2385
|
constructor(t) {
|
|
2307
2386
|
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)
|
|
2308
2387
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2316,8 +2395,8 @@ class Te {
|
|
|
2316
2395
|
for (const e of this.sources)
|
|
2317
2396
|
if ("folders" in e)
|
|
2318
2397
|
for (const i of e.folders) {
|
|
2319
|
-
const o = e.recursive !== void 0 ? e.recursive : !0,
|
|
2320
|
-
this._discoveredUrls.push(...
|
|
2398
|
+
const o = e.recursive !== void 0 ? e.recursive : !0, a = await this.loadFromFolder(i, t, o);
|
|
2399
|
+
this._discoveredUrls.push(...a);
|
|
2321
2400
|
}
|
|
2322
2401
|
else if ("files" in e) {
|
|
2323
2402
|
const i = await this.loadFiles(e.files, t);
|
|
@@ -2383,8 +2462,8 @@ class Te {
|
|
|
2383
2462
|
return this.loadImagesDirectly(o, e);
|
|
2384
2463
|
try {
|
|
2385
2464
|
return i ? await this.loadImagesRecursively(o, e) : await this.loadImagesFromSingleFolder(o, e);
|
|
2386
|
-
} catch (
|
|
2387
|
-
return console.error("Error loading from Google Drive API:",
|
|
2465
|
+
} catch (a) {
|
|
2466
|
+
return console.error("Error loading from Google Drive API:", a), this.loadImagesDirectly(o, e);
|
|
2388
2467
|
}
|
|
2389
2468
|
}
|
|
2390
2469
|
/**
|
|
@@ -2394,14 +2473,14 @@ class Te {
|
|
|
2394
2473
|
* @returns Promise resolving to array of image URLs
|
|
2395
2474
|
*/
|
|
2396
2475
|
async loadImagesFromSingleFolder(t, e) {
|
|
2397
|
-
const i = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`,
|
|
2398
|
-
if (!
|
|
2399
|
-
throw new Error(`API request failed: ${
|
|
2400
|
-
const c = (await
|
|
2401
|
-
(
|
|
2476
|
+
const i = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2477
|
+
if (!s.ok)
|
|
2478
|
+
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2479
|
+
const c = (await s.json()).files.filter(
|
|
2480
|
+
(d) => d.mimeType.startsWith("image/") && e.isAllowed(d.name)
|
|
2402
2481
|
);
|
|
2403
|
-
return this.log(`Found ${c.length} images in folder ${t} (non-recursive)`), c.forEach((
|
|
2404
|
-
i.push(`https://lh3.googleusercontent.com/d/${
|
|
2482
|
+
return this.log(`Found ${c.length} images in folder ${t} (non-recursive)`), c.forEach((d) => {
|
|
2483
|
+
i.push(`https://lh3.googleusercontent.com/d/${d.id}=s1600`), this.log(`Added file: ${d.name}`);
|
|
2405
2484
|
}), i;
|
|
2406
2485
|
}
|
|
2407
2486
|
/**
|
|
@@ -2413,24 +2492,24 @@ class Te {
|
|
|
2413
2492
|
async loadFiles(t, e) {
|
|
2414
2493
|
const i = [];
|
|
2415
2494
|
for (const o of t) {
|
|
2416
|
-
const
|
|
2417
|
-
if (!
|
|
2495
|
+
const a = this.extractFileId(o);
|
|
2496
|
+
if (!a) {
|
|
2418
2497
|
this.log(`Skipping invalid file URL: ${o}`);
|
|
2419
2498
|
continue;
|
|
2420
2499
|
}
|
|
2421
2500
|
if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
|
|
2422
2501
|
try {
|
|
2423
|
-
const r = `${this.apiEndpoint}/${
|
|
2424
|
-
if (
|
|
2425
|
-
const h = await
|
|
2426
|
-
h.mimeType.startsWith("image/") && e.isAllowed(h.name) ? (i.push(`https://lh3.googleusercontent.com/d/${
|
|
2502
|
+
const r = `${this.apiEndpoint}/${a}?fields=name,mimeType&key=${this.apiKey}`, s = await fetch(r);
|
|
2503
|
+
if (s.ok) {
|
|
2504
|
+
const h = await s.json();
|
|
2505
|
+
h.mimeType.startsWith("image/") && e.isAllowed(h.name) ? (i.push(`https://lh3.googleusercontent.com/d/${a}=s1600`), this.log(`Added file: ${h.name}`)) : this.log(`Skipping non-image file: ${h.name} (${h.mimeType})`);
|
|
2427
2506
|
} else
|
|
2428
|
-
this.log(`Failed to fetch metadata for file ${
|
|
2507
|
+
this.log(`Failed to fetch metadata for file ${a}: ${s.status}`);
|
|
2429
2508
|
} catch (r) {
|
|
2430
|
-
this.log(`Error fetching metadata for file ${
|
|
2509
|
+
this.log(`Error fetching metadata for file ${a}:`, r);
|
|
2431
2510
|
}
|
|
2432
2511
|
else
|
|
2433
|
-
i.push(`https://lh3.googleusercontent.com/d/${
|
|
2512
|
+
i.push(`https://lh3.googleusercontent.com/d/${a}=s1600`);
|
|
2434
2513
|
}
|
|
2435
2514
|
return i;
|
|
2436
2515
|
}
|
|
@@ -2464,21 +2543,21 @@ class Te {
|
|
|
2464
2543
|
* @returns Promise resolving to array of image URLs
|
|
2465
2544
|
*/
|
|
2466
2545
|
async loadImagesRecursively(t, e) {
|
|
2467
|
-
const i = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`,
|
|
2468
|
-
if (!
|
|
2469
|
-
throw new Error(`API request failed: ${
|
|
2470
|
-
const h = await
|
|
2546
|
+
const i = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2547
|
+
if (!s.ok)
|
|
2548
|
+
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2549
|
+
const h = await s.json(), c = h.files.filter(
|
|
2471
2550
|
(l) => l.mimeType.startsWith("image/") && e.isAllowed(l.name)
|
|
2472
|
-
),
|
|
2551
|
+
), d = h.files.filter(
|
|
2473
2552
|
(l) => l.mimeType === "application/vnd.google-apps.folder"
|
|
2474
2553
|
);
|
|
2475
|
-
this.log(`Found ${h.files.length} total items in folder ${t}`), h.files.forEach((l) => this.log(` - File: ${l.name} (${l.mimeType})`)), this.log(`- ${c.length} valid files (images only)`), this.log(`- ${
|
|
2554
|
+
this.log(`Found ${h.files.length} total items in folder ${t}`), h.files.forEach((l) => this.log(` - File: ${l.name} (${l.mimeType})`)), this.log(`- ${c.length} valid files (images only)`), this.log(`- ${d.length} subfolders`), c.forEach((l) => {
|
|
2476
2555
|
i.push(`https://lh3.googleusercontent.com/d/${l.id}=s1600`), this.log(`Added file: ${l.name}`);
|
|
2477
2556
|
});
|
|
2478
|
-
for (const l of
|
|
2557
|
+
for (const l of d) {
|
|
2479
2558
|
this.log(`Loading images from subfolder: ${l.name}`);
|
|
2480
|
-
const
|
|
2481
|
-
i.push(...
|
|
2559
|
+
const u = await this.loadImagesRecursively(l.id, e);
|
|
2560
|
+
i.push(...u);
|
|
2482
2561
|
}
|
|
2483
2562
|
return i;
|
|
2484
2563
|
}
|
|
@@ -2494,9 +2573,9 @@ class Te {
|
|
|
2494
2573
|
const i = `https://drive.google.com/embeddedfolderview?id=${t}`, o = await fetch(i, { mode: "cors" });
|
|
2495
2574
|
if (!o.ok)
|
|
2496
2575
|
throw new Error("Cannot access folder directly (CORS or permissions issue)");
|
|
2497
|
-
const
|
|
2498
|
-
return [...new Set(
|
|
2499
|
-
(
|
|
2576
|
+
const a = await o.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, s = [...a.matchAll(r)];
|
|
2577
|
+
return [...new Set(s.map((d) => d[1]))].map(
|
|
2578
|
+
(d) => `https://drive.google.com/uc?export=view&id=${d}`
|
|
2500
2579
|
);
|
|
2501
2580
|
} catch (i) {
|
|
2502
2581
|
throw console.error("Direct loading failed:", i), new Error(
|
|
@@ -2523,7 +2602,7 @@ class Te {
|
|
|
2523
2602
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2524
2603
|
}
|
|
2525
2604
|
}
|
|
2526
|
-
class
|
|
2605
|
+
class Le {
|
|
2527
2606
|
constructor(t) {
|
|
2528
2607
|
if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
2529
2608
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2588,8 +2667,8 @@ class Ce {
|
|
|
2588
2667
|
return console.warn("URLs must be an array:", t), [];
|
|
2589
2668
|
const i = [];
|
|
2590
2669
|
for (const o of t) {
|
|
2591
|
-
const
|
|
2592
|
-
if (!e.isAllowed(
|
|
2670
|
+
const a = o.split("/").pop() || o;
|
|
2671
|
+
if (!e.isAllowed(a)) {
|
|
2593
2672
|
this.log(`Skipping filtered URL: ${o}`);
|
|
2594
2673
|
continue;
|
|
2595
2674
|
}
|
|
@@ -2608,12 +2687,12 @@ class Ce {
|
|
|
2608
2687
|
if (!Array.isArray(e))
|
|
2609
2688
|
return console.warn("files must be an array:", e), [];
|
|
2610
2689
|
const o = [];
|
|
2611
|
-
for (const
|
|
2612
|
-
if (!i.isAllowed(
|
|
2613
|
-
this.log(`Skipping filtered file: ${
|
|
2690
|
+
for (const a of e) {
|
|
2691
|
+
if (!i.isAllowed(a)) {
|
|
2692
|
+
this.log(`Skipping filtered file: ${a}`);
|
|
2614
2693
|
continue;
|
|
2615
2694
|
}
|
|
2616
|
-
const r = this.constructUrl(t,
|
|
2695
|
+
const r = this.constructUrl(t, a);
|
|
2617
2696
|
this.validateUrls ? await this.validateUrl(r) ? o.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : o.push(r);
|
|
2618
2697
|
}
|
|
2619
2698
|
return o;
|
|
@@ -2629,15 +2708,15 @@ class Ce {
|
|
|
2629
2708
|
this.log(`Fetching JSON endpoint: ${t}`);
|
|
2630
2709
|
const i = new AbortController(), o = setTimeout(() => i.abort(), 1e4);
|
|
2631
2710
|
try {
|
|
2632
|
-
const
|
|
2633
|
-
if (clearTimeout(o), !
|
|
2634
|
-
throw new Error(`HTTP ${
|
|
2635
|
-
const r = await
|
|
2711
|
+
const a = await fetch(t, { signal: i.signal });
|
|
2712
|
+
if (clearTimeout(o), !a.ok)
|
|
2713
|
+
throw new Error(`HTTP ${a.status} fetching ${t}`);
|
|
2714
|
+
const r = await a.json();
|
|
2636
2715
|
if (!r || !Array.isArray(r.images))
|
|
2637
2716
|
throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
|
|
2638
2717
|
return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, e);
|
|
2639
|
-
} catch (
|
|
2640
|
-
throw clearTimeout(o),
|
|
2718
|
+
} catch (a) {
|
|
2719
|
+
throw clearTimeout(o), a instanceof Error && a.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : a;
|
|
2641
2720
|
}
|
|
2642
2721
|
}
|
|
2643
2722
|
/**
|
|
@@ -2659,11 +2738,11 @@ class Ce {
|
|
|
2659
2738
|
if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
|
|
2660
2739
|
return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
|
|
2661
2740
|
try {
|
|
2662
|
-
const i = new AbortController(), o = setTimeout(() => i.abort(), this.validationTimeout),
|
|
2741
|
+
const i = new AbortController(), o = setTimeout(() => i.abort(), this.validationTimeout), a = await fetch(t, {
|
|
2663
2742
|
method: "HEAD",
|
|
2664
2743
|
signal: i.signal
|
|
2665
2744
|
});
|
|
2666
|
-
return clearTimeout(o),
|
|
2745
|
+
return clearTimeout(o), a.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${a.status}`), !1);
|
|
2667
2746
|
} catch (i) {
|
|
2668
2747
|
return i instanceof Error && (i.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, i.message)), !1;
|
|
2669
2748
|
}
|
|
@@ -2703,7 +2782,7 @@ class Ce {
|
|
|
2703
2782
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2704
2783
|
}
|
|
2705
2784
|
}
|
|
2706
|
-
class
|
|
2785
|
+
class ze {
|
|
2707
2786
|
constructor(t) {
|
|
2708
2787
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
2709
2788
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -2717,8 +2796,8 @@ class Re {
|
|
|
2717
2796
|
this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
|
|
2718
2797
|
const e = this.loaders.map((i, o) => i.prepare(t).then(() => {
|
|
2719
2798
|
this.log(`Loader ${o} prepared with ${i.imagesLength()} images`);
|
|
2720
|
-
}).catch((
|
|
2721
|
-
console.warn(`Loader ${o} failed to prepare:`,
|
|
2799
|
+
}).catch((a) => {
|
|
2800
|
+
console.warn(`Loader ${o} failed to prepare:`, a);
|
|
2722
2801
|
}));
|
|
2723
2802
|
await Promise.all(e);
|
|
2724
2803
|
for (const i of this.loaders)
|
|
@@ -2760,7 +2839,7 @@ class Re {
|
|
|
2760
2839
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2761
2840
|
}
|
|
2762
2841
|
}
|
|
2763
|
-
class
|
|
2842
|
+
class Fe {
|
|
2764
2843
|
/**
|
|
2765
2844
|
* Create a new ImageFilter
|
|
2766
2845
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2797,7 +2876,7 @@ class Me {
|
|
|
2797
2876
|
// isAllowedDate(date: Date): boolean
|
|
2798
2877
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2799
2878
|
}
|
|
2800
|
-
const
|
|
2879
|
+
const $e = `
|
|
2801
2880
|
.fbn-ic-gallery {
|
|
2802
2881
|
position: relative;
|
|
2803
2882
|
width: 100%;
|
|
@@ -2847,20 +2926,20 @@ const Le = `
|
|
|
2847
2926
|
display: none !important;
|
|
2848
2927
|
}
|
|
2849
2928
|
`;
|
|
2850
|
-
function
|
|
2929
|
+
function De() {
|
|
2851
2930
|
if (typeof document > "u") return;
|
|
2852
2931
|
const n = "fbn-ic-functional-styles";
|
|
2853
2932
|
if (document.getElementById(n)) return;
|
|
2854
2933
|
const t = document.createElement("style");
|
|
2855
|
-
t.id = n, t.textContent =
|
|
2934
|
+
t.id = n, t.textContent = $e, document.head.appendChild(t);
|
|
2856
2935
|
}
|
|
2857
|
-
class
|
|
2936
|
+
class Oe {
|
|
2858
2937
|
constructor(t = {}) {
|
|
2859
2938
|
this.fullConfig = kt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new Yt(this.fullConfig.animation), this.layoutEngine = new fe({
|
|
2860
2939
|
layout: this.fullConfig.layout,
|
|
2861
2940
|
image: this.fullConfig.image
|
|
2862
|
-
}), this.zoomEngine = new
|
|
2863
|
-
const e = this.fullConfig.animation.entry ||
|
|
2941
|
+
}), this.zoomEngine = new Ee(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = vt(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
2942
|
+
const e = this.fullConfig.animation.entry || b.animation.entry;
|
|
2864
2943
|
this.entryAnimationEngine = new ne(
|
|
2865
2944
|
e,
|
|
2866
2945
|
this.fullConfig.layout.algorithm
|
|
@@ -2871,7 +2950,7 @@ class Fe {
|
|
|
2871
2950
|
*/
|
|
2872
2951
|
createImageFilter() {
|
|
2873
2952
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
2874
|
-
return new
|
|
2953
|
+
return new Fe(t);
|
|
2875
2954
|
}
|
|
2876
2955
|
/**
|
|
2877
2956
|
* Create appropriate image loader based on config
|
|
@@ -2882,7 +2961,7 @@ class Fe {
|
|
|
2882
2961
|
if (!t || t.length === 0)
|
|
2883
2962
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
2884
2963
|
const i = t.map((o) => this.createLoaderFromEntry(o, e));
|
|
2885
|
-
return i.length === 1 ? i[0] : new
|
|
2964
|
+
return i.length === 1 ? i[0] : new ze({
|
|
2886
2965
|
loaders: i,
|
|
2887
2966
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
2888
2967
|
});
|
|
@@ -2900,14 +2979,14 @@ class Fe {
|
|
|
2900
2979
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2901
2980
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2902
2981
|
};
|
|
2903
|
-
return new
|
|
2982
|
+
return new Le(o);
|
|
2904
2983
|
} else if ("googleDrive" in t) {
|
|
2905
2984
|
const i = t.googleDrive, o = {
|
|
2906
2985
|
...i,
|
|
2907
2986
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2908
2987
|
debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2909
2988
|
};
|
|
2910
|
-
return new
|
|
2989
|
+
return new Me(o);
|
|
2911
2990
|
} else
|
|
2912
2991
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
2913
2992
|
}
|
|
@@ -2916,7 +2995,7 @@ class Fe {
|
|
|
2916
2995
|
*/
|
|
2917
2996
|
async init() {
|
|
2918
2997
|
try {
|
|
2919
|
-
if (
|
|
2998
|
+
if (De(), this.containerRef)
|
|
2920
2999
|
this.containerEl = this.containerRef;
|
|
2921
3000
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
2922
3001
|
throw new Error(`Container #${this.containerId} not found`);
|
|
@@ -2925,7 +3004,7 @@ class Fe {
|
|
|
2925
3004
|
onPrev: () => this.navigateToPreviousImage(),
|
|
2926
3005
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
2927
3006
|
onDragEnd: (t) => {
|
|
2928
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
3007
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Te);
|
|
2929
3008
|
}
|
|
2930
3009
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
2931
3010
|
} catch (t) {
|
|
@@ -3020,13 +3099,13 @@ class Fe {
|
|
|
3020
3099
|
this.showError("No images found."), this.showLoading(!1);
|
|
3021
3100
|
return;
|
|
3022
3101
|
}
|
|
3023
|
-
const i = this.getContainerBounds(), o = this.getImageHeight(),
|
|
3102
|
+
const i = this.getContainerBounds(), o = this.getImageHeight(), a = window.innerWidth;
|
|
3024
3103
|
this.logDebug(`Adaptive sizing input: container=${i.width}x${i.height}px, images=${t}, responsiveMax=${o}px`);
|
|
3025
3104
|
const r = this.layoutEngine.calculateAdaptiveSize(
|
|
3026
3105
|
i,
|
|
3027
3106
|
t,
|
|
3028
3107
|
o,
|
|
3029
|
-
|
|
3108
|
+
a
|
|
3030
3109
|
);
|
|
3031
3110
|
this.logDebug(`Adaptive sizing result: height=${r.height}px`), await this.createImageCloud(e, r.height), this.showLoading(!1), this.imagesLoaded = !0;
|
|
3032
3111
|
} catch (t) {
|
|
@@ -3043,41 +3122,41 @@ class Fe {
|
|
|
3043
3122
|
if (!this.containerEl) return;
|
|
3044
3123
|
const i = this.getContainerBounds();
|
|
3045
3124
|
this.currentImageHeight = e;
|
|
3046
|
-
const o = this.loadGeneration,
|
|
3047
|
-
this.imageLayouts =
|
|
3125
|
+
const o = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, i, { fixedHeight: e });
|
|
3126
|
+
this.imageLayouts = a, this.displayQueue = [];
|
|
3048
3127
|
let r = 0;
|
|
3049
|
-
const
|
|
3128
|
+
const s = (c) => {
|
|
3050
3129
|
this.containerEl && (this.containerEl.appendChild(c), this.imageElements.push(c), requestAnimationFrame(() => {
|
|
3051
3130
|
if (c.offsetWidth, c.style.opacity = this.defaultStyles.opacity ?? "1", c.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || c.dataset.startRotation !== c.dataset.rotation || c.dataset.startScale !== c.dataset.scale)) {
|
|
3052
|
-
const
|
|
3131
|
+
const u = {
|
|
3053
3132
|
x: parseFloat(c.dataset.startX),
|
|
3054
3133
|
y: parseFloat(c.dataset.startY)
|
|
3055
|
-
},
|
|
3134
|
+
}, g = {
|
|
3056
3135
|
x: parseFloat(c.dataset.endX),
|
|
3057
3136
|
y: parseFloat(c.dataset.endY)
|
|
3058
|
-
},
|
|
3137
|
+
}, p = parseFloat(c.dataset.imageWidth), y = parseFloat(c.dataset.imageHeight), f = parseFloat(c.dataset.rotation), m = parseFloat(c.dataset.scale), E = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : f, v = c.dataset.startScale ? parseFloat(c.dataset.startScale) : m, w = this.entryAnimationEngine.getTiming();
|
|
3059
3138
|
te({
|
|
3060
3139
|
element: c,
|
|
3061
|
-
startPosition:
|
|
3062
|
-
endPosition:
|
|
3140
|
+
startPosition: u,
|
|
3141
|
+
endPosition: g,
|
|
3063
3142
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3064
3143
|
duration: w.duration,
|
|
3065
|
-
imageWidth:
|
|
3066
|
-
imageHeight:
|
|
3067
|
-
rotation:
|
|
3144
|
+
imageWidth: p,
|
|
3145
|
+
imageHeight: y,
|
|
3146
|
+
rotation: f,
|
|
3068
3147
|
scale: m,
|
|
3069
3148
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3070
|
-
startRotation:
|
|
3149
|
+
startRotation: E,
|
|
3071
3150
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3072
3151
|
startScale: v
|
|
3073
3152
|
});
|
|
3074
3153
|
} else {
|
|
3075
|
-
const
|
|
3076
|
-
c.style.transform =
|
|
3154
|
+
const u = c.dataset.finalTransform || "";
|
|
3155
|
+
c.style.transform = u;
|
|
3077
3156
|
}
|
|
3078
3157
|
const l = parseInt(c.dataset.imageId || "0");
|
|
3079
3158
|
if (this.fullConfig.config.debug?.enabled && l < 3) {
|
|
3080
|
-
const
|
|
3159
|
+
const u = c.dataset.finalTransform || "";
|
|
3081
3160
|
console.log(`Image ${l} final state:`, {
|
|
3082
3161
|
left: c.style.left,
|
|
3083
3162
|
top: c.style.top,
|
|
@@ -3085,7 +3164,7 @@ class Fe {
|
|
|
3085
3164
|
height: c.style.height,
|
|
3086
3165
|
computedWidth: c.offsetWidth,
|
|
3087
3166
|
computedHeight: c.offsetHeight,
|
|
3088
|
-
transform:
|
|
3167
|
+
transform: u,
|
|
3089
3168
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3090
3169
|
});
|
|
3091
3170
|
}
|
|
@@ -3094,7 +3173,7 @@ class Fe {
|
|
|
3094
3173
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3095
3174
|
for (; this.displayQueue.length > 0; ) {
|
|
3096
3175
|
const c = this.displayQueue.shift();
|
|
3097
|
-
c &&
|
|
3176
|
+
c && s(c);
|
|
3098
3177
|
}
|
|
3099
3178
|
return;
|
|
3100
3179
|
}
|
|
@@ -3105,70 +3184,76 @@ class Fe {
|
|
|
3105
3184
|
}
|
|
3106
3185
|
if (this.displayQueue.length > 0) {
|
|
3107
3186
|
const c = this.displayQueue.shift();
|
|
3108
|
-
c &&
|
|
3187
|
+
c && s(c);
|
|
3109
3188
|
}
|
|
3110
3189
|
r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3111
3190
|
}, this.fullConfig.animation.queue.interval);
|
|
3112
3191
|
};
|
|
3113
3192
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3114
|
-
const c = new IntersectionObserver((
|
|
3115
|
-
|
|
3193
|
+
const c = new IntersectionObserver((d) => {
|
|
3194
|
+
d.forEach((l) => {
|
|
3116
3195
|
l.isIntersecting && (h(), c.disconnect());
|
|
3117
3196
|
});
|
|
3118
3197
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3119
3198
|
c.observe(this.containerEl);
|
|
3120
3199
|
} else
|
|
3121
3200
|
h();
|
|
3122
|
-
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()),
|
|
3201
|
+
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), a.forEach((c, d) => {
|
|
3123
3202
|
const l = document.createElement("div");
|
|
3124
3203
|
l.className = "fbn-ic-debug-center", l.style.position = "absolute", l.style.width = "12px", l.style.height = "12px", l.style.borderRadius = "50%", l.style.backgroundColor = "red", l.style.border = "2px solid yellow", l.style.zIndex = "9999", l.style.pointerEvents = "none";
|
|
3125
|
-
const
|
|
3126
|
-
l.style.left = `${
|
|
3127
|
-
})), t.forEach((c,
|
|
3204
|
+
const u = c.x, g = c.y;
|
|
3205
|
+
l.style.left = `${u - 6}px`, l.style.top = `${g - 6}px`, l.title = `Image ${d}: center (${Math.round(u)}, ${Math.round(g)})`, this.containerEl.appendChild(l);
|
|
3206
|
+
})), t.forEach((c, d) => {
|
|
3128
3207
|
const l = document.createElement("img");
|
|
3129
|
-
l.referrerPolicy = "no-referrer", l.classList.add("fbn-ic-image"), l.dataset.imageId = String(
|
|
3130
|
-
const
|
|
3131
|
-
l.style.position = "absolute", l.style.width = "auto", l.style.height = `${e}px`, l.style.left = `${
|
|
3132
|
-
this.hoveredImage = { element: l, layout:
|
|
3208
|
+
l.referrerPolicy = "no-referrer", l.classList.add("fbn-ic-image"), l.dataset.imageId = String(d), l.dataset.createdFlag = "true";
|
|
3209
|
+
const u = a[d];
|
|
3210
|
+
l.style.position = "absolute", l.style.width = "auto", l.style.height = `${e}px`, l.style.left = `${u.x}px`, l.style.top = `${u.y}px`, u.zIndex && (l.style.zIndex = String(u.zIndex)), nt(l, this.defaultClassName), l.addEventListener("mouseenter", () => {
|
|
3211
|
+
if (this.hoveredImage = { element: l, layout: u }, !this.zoomEngine.isInvolved(l)) {
|
|
3212
|
+
const g = l.cachedRenderedWidth;
|
|
3213
|
+
ut(l, this.fullConfig.styling?.hover, e, g), nt(l, this.hoverClassName);
|
|
3214
|
+
}
|
|
3133
3215
|
}), l.addEventListener("mouseleave", () => {
|
|
3134
|
-
this.hoveredImage = null, this.zoomEngine.isInvolved(l)
|
|
3135
|
-
|
|
3136
|
-
|
|
3216
|
+
if (this.hoveredImage = null, !this.zoomEngine.isInvolved(l)) {
|
|
3217
|
+
const g = l.cachedRenderedWidth;
|
|
3218
|
+
ut(l, this.fullConfig.styling?.default, e, g), ft(l, this.hoverClassName), nt(l, this.defaultClassName);
|
|
3219
|
+
}
|
|
3220
|
+
}), l.addEventListener("click", (g) => {
|
|
3221
|
+
g.stopPropagation(), this.handleImageClick(l, u);
|
|
3137
3222
|
}), l.style.opacity = "0", l.style.transition = this.entryAnimationEngine.getTransitionCSS(), l.onload = () => {
|
|
3138
3223
|
if (o !== this.loadGeneration)
|
|
3139
3224
|
return;
|
|
3140
|
-
const
|
|
3141
|
-
l.style.width = `${
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3144
|
-
|
|
3225
|
+
const g = l.naturalWidth / l.naturalHeight, p = e * g;
|
|
3226
|
+
l.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${d}] Called with imageHeight=${e}, renderedWidth=${p}`), l.style.width = `${p}px`, l.cachedRenderedWidth = p, l.aspectRatio = g, ut(l, this.fullConfig.styling?.default, e, p);
|
|
3227
|
+
const y = { x: u.x, y: u.y }, f = { width: p, height: e }, m = this.entryAnimationEngine.calculateStartPosition(
|
|
3228
|
+
y,
|
|
3229
|
+
f,
|
|
3145
3230
|
i,
|
|
3146
|
-
|
|
3231
|
+
d,
|
|
3147
3232
|
t.length
|
|
3148
|
-
),
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3233
|
+
), E = this.entryAnimationEngine.calculateStartRotation(u.rotation), v = this.entryAnimationEngine.calculateStartScale(u.scale), w = this.entryAnimationEngine.buildFinalTransform(
|
|
3234
|
+
u.rotation,
|
|
3235
|
+
u.scale,
|
|
3236
|
+
p,
|
|
3152
3237
|
e
|
|
3153
|
-
),
|
|
3238
|
+
), S = this.entryAnimationEngine.buildStartTransform(
|
|
3154
3239
|
m,
|
|
3240
|
+
y,
|
|
3241
|
+
u.rotation,
|
|
3242
|
+
u.scale,
|
|
3155
3243
|
p,
|
|
3156
|
-
d.rotation,
|
|
3157
|
-
d.scale,
|
|
3158
|
-
b,
|
|
3159
3244
|
e,
|
|
3160
|
-
|
|
3245
|
+
E,
|
|
3161
3246
|
v
|
|
3162
3247
|
);
|
|
3163
|
-
this.fullConfig.config.debug?.enabled &&
|
|
3164
|
-
finalPosition:
|
|
3165
|
-
imageSize:
|
|
3166
|
-
left:
|
|
3167
|
-
top:
|
|
3248
|
+
this.fullConfig.config.debug?.enabled && d < 3 && console.log(`Image ${d}:`, {
|
|
3249
|
+
finalPosition: y,
|
|
3250
|
+
imageSize: f,
|
|
3251
|
+
left: u.x,
|
|
3252
|
+
top: u.y,
|
|
3168
3253
|
finalTransform: w,
|
|
3169
|
-
renderedWidth:
|
|
3254
|
+
renderedWidth: p,
|
|
3170
3255
|
renderedHeight: e
|
|
3171
|
-
}), l.style.transform =
|
|
3256
|
+
}), l.style.transform = S, l.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== u.rotation || v !== u.scale) && (l.dataset.startX = String(m.x), l.dataset.startY = String(m.y), l.dataset.endX = String(y.x), l.dataset.endY = String(y.y), l.dataset.imageWidth = String(p), l.dataset.imageHeight = String(e), l.dataset.rotation = String(u.rotation), l.dataset.scale = String(u.scale), l.dataset.startRotation = String(E), l.dataset.startScale = String(v)), this.displayQueue.push(l);
|
|
3172
3257
|
}, l.onerror = () => r++, l.src = c;
|
|
3173
3258
|
});
|
|
3174
3259
|
}
|
|
@@ -3181,8 +3266,8 @@ class Fe {
|
|
|
3181
3266
|
if (i)
|
|
3182
3267
|
await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter();
|
|
3183
3268
|
else {
|
|
3184
|
-
const
|
|
3185
|
-
this.currentFocusIndex =
|
|
3269
|
+
const a = t.dataset.imageId;
|
|
3270
|
+
this.currentFocusIndex = a !== void 0 ? parseInt(a, 10) : null, this.swipeEngine?.enable(), await this.zoomEngine.focusImage(t, o, e), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex);
|
|
3186
3271
|
}
|
|
3187
3272
|
}
|
|
3188
3273
|
/**
|
|
@@ -3215,29 +3300,29 @@ class Fe {
|
|
|
3215
3300
|
}
|
|
3216
3301
|
export {
|
|
3217
3302
|
Yt as AnimationEngine,
|
|
3218
|
-
|
|
3303
|
+
xt as BOUNCE_PRESETS,
|
|
3219
3304
|
ue as ClusterPlacementLayout,
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3305
|
+
ze as CompositeLoader,
|
|
3306
|
+
b as DEFAULT_CONFIG,
|
|
3307
|
+
Mt as DEFAULT_SHARED_LOADER_CONFIG,
|
|
3308
|
+
Et as ELASTIC_PRESETS,
|
|
3224
3309
|
ne as EntryAnimationEngine,
|
|
3225
|
-
|
|
3226
|
-
|
|
3310
|
+
$e as FUNCTIONAL_CSS,
|
|
3311
|
+
Me as GoogleDriveLoader,
|
|
3227
3312
|
re as GridPlacementLayout,
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3313
|
+
Oe as ImageCloud,
|
|
3314
|
+
Fe as ImageFilter,
|
|
3315
|
+
Oe as ImageGallery,
|
|
3231
3316
|
fe as LayoutEngine,
|
|
3232
3317
|
se as RadialPlacementLayout,
|
|
3233
3318
|
oe as RandomPlacementLayout,
|
|
3234
3319
|
he as SpiralPlacementLayout,
|
|
3235
|
-
|
|
3320
|
+
Le as StaticImageLoader,
|
|
3236
3321
|
St as WAVE_PATH_PRESETS,
|
|
3237
3322
|
ge as WavePlacementLayout,
|
|
3238
|
-
|
|
3323
|
+
Ee as ZoomEngine,
|
|
3239
3324
|
te as animatePath,
|
|
3240
|
-
|
|
3325
|
+
De as injectFunctionalStyles,
|
|
3241
3326
|
ee as requiresJSAnimation
|
|
3242
3327
|
};
|
|
3243
3328
|
//# sourceMappingURL=image-cloud.js.map
|