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