@frybynite/image-cloud 0.10.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-cloud-auto-init.js +689 -526
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +1013 -850
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +3 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +114 -2
- package/dist/react.d.ts +114 -2
- package/dist/react.js +698 -535
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +114 -2
- package/dist/vue.js +1012 -849
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +114 -2
- package/dist/web-component.js +690 -527
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as kt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ht, useRef as St, useImperativeHandle as Nt, useEffect as Bt } from "react";
|
|
3
3
|
const mt = Object.freeze({
|
|
4
4
|
none: "none",
|
|
5
5
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
@@ -10,12 +10,12 @@ const mt = Object.freeze({
|
|
|
10
10
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
11
11
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
12
12
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
13
|
-
}),
|
|
13
|
+
}), Rt = Object.freeze({
|
|
14
14
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
15
15
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
16
16
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
17
17
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
18
|
-
}),
|
|
18
|
+
}), Tt = Object.freeze({
|
|
19
19
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
20
20
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
21
21
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
@@ -24,9 +24,9 @@ const mt = Object.freeze({
|
|
|
24
24
|
type: "linear"
|
|
25
25
|
}), vt = Object.freeze({
|
|
26
26
|
mode: "none"
|
|
27
|
-
}),
|
|
27
|
+
}), xt = Object.freeze({
|
|
28
28
|
mode: "none"
|
|
29
|
-
}),
|
|
29
|
+
}), Mt = Object.freeze({
|
|
30
30
|
default: Object.freeze({
|
|
31
31
|
border: Object.freeze({
|
|
32
32
|
width: 0,
|
|
@@ -66,7 +66,7 @@ const mt = Object.freeze({
|
|
|
66
66
|
}), qt = Object.freeze({
|
|
67
67
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
68
68
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
69
|
-
}),
|
|
69
|
+
}), Yt = Object.freeze({
|
|
70
70
|
mode: "adaptive",
|
|
71
71
|
// Default to adaptive sizing
|
|
72
72
|
minSize: 50,
|
|
@@ -78,15 +78,15 @@ const mt = Object.freeze({
|
|
|
78
78
|
// No variance by default
|
|
79
79
|
max: 1
|
|
80
80
|
})
|
|
81
|
-
}),
|
|
81
|
+
}), Xt = Object.freeze({
|
|
82
82
|
mode: "none",
|
|
83
83
|
range: Object.freeze({
|
|
84
84
|
min: -15,
|
|
85
85
|
max: 15
|
|
86
86
|
})
|
|
87
87
|
}), Ot = Object.freeze({
|
|
88
|
-
sizing:
|
|
89
|
-
rotation:
|
|
88
|
+
sizing: Yt,
|
|
89
|
+
rotation: Xt
|
|
90
90
|
}), zt = Object.freeze({
|
|
91
91
|
validateUrls: !0,
|
|
92
92
|
validationTimeout: 5e3,
|
|
@@ -96,7 +96,7 @@ const mt = Object.freeze({
|
|
|
96
96
|
enabled: !1,
|
|
97
97
|
centers: !1,
|
|
98
98
|
loaders: !1
|
|
99
|
-
}),
|
|
99
|
+
}), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), L = Object.freeze({
|
|
100
100
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
101
101
|
loaders: [],
|
|
102
102
|
// Shared loader settings and debug config
|
|
@@ -159,7 +159,7 @@ const mt = Object.freeze({
|
|
|
159
159
|
// smooth deceleration
|
|
160
160
|
path: yt,
|
|
161
161
|
rotation: vt,
|
|
162
|
-
scale:
|
|
162
|
+
scale: xt
|
|
163
163
|
}),
|
|
164
164
|
idle: $t
|
|
165
165
|
}),
|
|
@@ -186,7 +186,7 @@ const mt = Object.freeze({
|
|
|
186
186
|
showFocusOutline: !1
|
|
187
187
|
}),
|
|
188
188
|
// Image styling
|
|
189
|
-
styling:
|
|
189
|
+
styling: Mt
|
|
190
190
|
});
|
|
191
191
|
function Z(o, t) {
|
|
192
192
|
if (!o) return t || {};
|
|
@@ -244,57 +244,57 @@ function ee(o = {}) {
|
|
|
244
244
|
loaders: i,
|
|
245
245
|
config: n,
|
|
246
246
|
image: te(Ot, t),
|
|
247
|
-
layout: { ...
|
|
248
|
-
animation: { ...
|
|
249
|
-
interaction: { ...
|
|
250
|
-
ui: { ...
|
|
251
|
-
styling: Qt(
|
|
247
|
+
layout: { ...L.layout },
|
|
248
|
+
animation: { ...L.animation },
|
|
249
|
+
interaction: { ...L.interaction },
|
|
250
|
+
ui: { ...L.ui },
|
|
251
|
+
styling: Qt(Mt, o.styling)
|
|
252
252
|
};
|
|
253
253
|
if (o.layout && (s.layout = {
|
|
254
|
-
...
|
|
254
|
+
...L.layout,
|
|
255
255
|
...o.layout
|
|
256
256
|
}, o.layout.responsive && (s.layout.responsive = {
|
|
257
|
-
...
|
|
258
|
-
mobile: o.layout.responsive.mobile ? { ...
|
|
259
|
-
tablet: o.layout.responsive.tablet ? { ...
|
|
257
|
+
...L.layout.responsive,
|
|
258
|
+
mobile: o.layout.responsive.mobile ? { ...L.layout.responsive.mobile, ...o.layout.responsive.mobile } : L.layout.responsive.mobile,
|
|
259
|
+
tablet: o.layout.responsive.tablet ? { ...L.layout.responsive.tablet, ...o.layout.responsive.tablet } : L.layout.responsive.tablet
|
|
260
260
|
}), o.layout.spacing && (s.layout.spacing = {
|
|
261
|
-
...
|
|
261
|
+
...L.layout.spacing,
|
|
262
262
|
...o.layout.spacing
|
|
263
263
|
})), o.animation && (s.animation = {
|
|
264
|
-
...
|
|
264
|
+
...L.animation,
|
|
265
265
|
...o.animation
|
|
266
266
|
}, o.animation.easing && (s.animation.easing = {
|
|
267
|
-
...
|
|
267
|
+
...L.animation.easing,
|
|
268
268
|
...o.animation.easing
|
|
269
269
|
}), o.animation.queue && (s.animation.queue = {
|
|
270
|
-
...
|
|
270
|
+
...L.animation.queue,
|
|
271
271
|
...o.animation.queue
|
|
272
272
|
}), o.animation.entry && (s.animation.entry = {
|
|
273
|
-
...
|
|
273
|
+
...L.animation.entry,
|
|
274
274
|
...o.animation.entry,
|
|
275
275
|
start: o.animation.entry.start ? {
|
|
276
|
-
...
|
|
276
|
+
...L.animation.entry.start,
|
|
277
277
|
...o.animation.entry.start,
|
|
278
|
-
circular: o.animation.entry.start.circular ? { ...
|
|
279
|
-
} :
|
|
280
|
-
timing: o.animation.entry.timing ? { ...
|
|
281
|
-
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } :
|
|
282
|
-
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } :
|
|
283
|
-
scale: o.animation.entry.scale ? { ...
|
|
278
|
+
circular: o.animation.entry.start.circular ? { ...L.animation.entry.start.circular, ...o.animation.entry.start.circular } : L.animation.entry.start.circular
|
|
279
|
+
} : L.animation.entry.start,
|
|
280
|
+
timing: o.animation.entry.timing ? { ...L.animation.entry.timing, ...o.animation.entry.timing } : L.animation.entry.timing,
|
|
281
|
+
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : L.animation.entry.path,
|
|
282
|
+
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : L.animation.entry.rotation,
|
|
283
|
+
scale: o.animation.entry.scale ? { ...xt, ...o.animation.entry.scale } : L.animation.entry.scale
|
|
284
284
|
}), o.animation.idle && (s.animation.idle = {
|
|
285
285
|
...$t,
|
|
286
286
|
...o.animation.idle
|
|
287
287
|
})), o.interaction && (s.interaction = {
|
|
288
|
-
...
|
|
288
|
+
...L.interaction,
|
|
289
289
|
...o.interaction
|
|
290
290
|
}, o.interaction.focus && (s.interaction.focus = {
|
|
291
|
-
...
|
|
291
|
+
...L.interaction.focus,
|
|
292
292
|
...o.interaction.focus
|
|
293
293
|
}), o.interaction.navigation && (s.interaction.navigation = {
|
|
294
|
-
...
|
|
294
|
+
...L.interaction.navigation,
|
|
295
295
|
...o.interaction.navigation
|
|
296
296
|
})), s.ui = {
|
|
297
|
-
...
|
|
297
|
+
...L.ui,
|
|
298
298
|
...o.ui
|
|
299
299
|
}, s.config.debug = {
|
|
300
300
|
...Dt,
|
|
@@ -314,10 +314,10 @@ function ie(o, t) {
|
|
|
314
314
|
return { ...o ? Ct[o] : Ct.playful, ...t };
|
|
315
315
|
}
|
|
316
316
|
function ne(o, t) {
|
|
317
|
-
return { ...o ?
|
|
317
|
+
return { ...o ? Rt[o] : Rt.gentle, ...t };
|
|
318
318
|
}
|
|
319
319
|
function oe(o, t) {
|
|
320
|
-
return { ...o ?
|
|
320
|
+
return { ...o ? Tt[o] : Tt.gentle, ...t };
|
|
321
321
|
}
|
|
322
322
|
class se {
|
|
323
323
|
constructor(t) {
|
|
@@ -346,12 +346,12 @@ class se {
|
|
|
346
346
|
*/
|
|
347
347
|
animateTransformCancellable(t, i, e, n = null, s = null) {
|
|
348
348
|
this.cancelAllAnimations(t);
|
|
349
|
-
const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i),
|
|
349
|
+
const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), d = this.buildTransformString(e);
|
|
350
350
|
t.style.transition = "none";
|
|
351
351
|
const u = t.animate(
|
|
352
352
|
[
|
|
353
353
|
{ transform: c },
|
|
354
|
-
{ transform:
|
|
354
|
+
{ transform: d }
|
|
355
355
|
],
|
|
356
356
|
{
|
|
357
357
|
duration: r,
|
|
@@ -359,7 +359,7 @@ class se {
|
|
|
359
359
|
fill: "forwards"
|
|
360
360
|
// Keep final state after animation
|
|
361
361
|
}
|
|
362
|
-
),
|
|
362
|
+
), f = {
|
|
363
363
|
id: `anim-${++this.animationIdCounter}`,
|
|
364
364
|
element: t,
|
|
365
365
|
animation: u,
|
|
@@ -368,11 +368,11 @@ class se {
|
|
|
368
368
|
startTime: performance.now(),
|
|
369
369
|
duration: r
|
|
370
370
|
};
|
|
371
|
-
return this.activeAnimations.set(t,
|
|
372
|
-
t.style.transform =
|
|
371
|
+
return this.activeAnimations.set(t, f), u.finished.then(() => {
|
|
372
|
+
t.style.transform = d, this.activeAnimations.delete(t);
|
|
373
373
|
}).catch(() => {
|
|
374
374
|
this.activeAnimations.delete(t);
|
|
375
|
-
}),
|
|
375
|
+
}), f;
|
|
376
376
|
}
|
|
377
377
|
/**
|
|
378
378
|
* Cancel an active animation
|
|
@@ -475,27 +475,27 @@ class se {
|
|
|
475
475
|
return new Promise((i) => setTimeout(i, t));
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function J(o, t, i) {
|
|
479
479
|
return o + (t - o) * i;
|
|
480
480
|
}
|
|
481
481
|
function ae(o, t, i, e) {
|
|
482
|
-
const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y,
|
|
483
|
-
let u = 0,
|
|
484
|
-
for (let
|
|
485
|
-
if (o <= l
|
|
486
|
-
|
|
482
|
+
const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, d = re(s, r);
|
|
483
|
+
let u = 0, f = 0, m = 1, p = n, w = !1;
|
|
484
|
+
for (let l = 0; l < d.length; l++)
|
|
485
|
+
if (o <= d[l].time) {
|
|
486
|
+
f = l === 0 ? 0 : d[l - 1].time, m = d[l].time, p = d[l].overshoot, w = d[l].isOvershoot;
|
|
487
487
|
break;
|
|
488
488
|
}
|
|
489
|
-
const
|
|
490
|
-
if (
|
|
491
|
-
u = 1 +
|
|
492
|
-
else if (
|
|
493
|
-
u = at(
|
|
489
|
+
const v = (o - f) / (m - f);
|
|
490
|
+
if (w)
|
|
491
|
+
u = 1 + p * at(v);
|
|
492
|
+
else if (f === 0)
|
|
493
|
+
u = at(v);
|
|
494
494
|
else {
|
|
495
|
-
const
|
|
496
|
-
(
|
|
497
|
-
)?.overshoot ||
|
|
498
|
-
u =
|
|
495
|
+
const g = 1 + (d.find(
|
|
496
|
+
(h, b) => h.time > f && b > 0 && d[b - 1].isOvershoot
|
|
497
|
+
)?.overshoot || p);
|
|
498
|
+
u = J(g, 1, at(v));
|
|
499
499
|
}
|
|
500
500
|
return {
|
|
501
501
|
x: t.x + a * u,
|
|
@@ -513,23 +513,23 @@ function re(o, t) {
|
|
|
513
513
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
514
514
|
}
|
|
515
515
|
function ce(o, t, i, e) {
|
|
516
|
-
const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x,
|
|
517
|
-
let
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
|
|
516
|
+
const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, d = i.y - t.y, u = Math.sqrt(n / r), f = s / (2 * Math.sqrt(n * r));
|
|
517
|
+
let m;
|
|
518
|
+
if (f < 1) {
|
|
519
|
+
const p = u * Math.sqrt(1 - f * f), w = Math.exp(-f * u * o * 3), v = Math.cos(p * o * a * Math.PI);
|
|
520
|
+
m = 1 - w * v;
|
|
521
521
|
} else
|
|
522
|
-
|
|
523
|
-
return
|
|
524
|
-
x: t.x + c *
|
|
525
|
-
y: t.y +
|
|
522
|
+
m = 1 - Math.exp(-u * o * 3);
|
|
523
|
+
return m = Math.max(0, Math.min(m, 1.3)), {
|
|
524
|
+
x: t.x + c * m,
|
|
525
|
+
y: t.y + d * m
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
528
|
function le(o, t, i, e) {
|
|
529
|
-
const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e,
|
|
529
|
+
const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, d = i.x - t.x, u = i.y - t.y, f = Math.sqrt(d * d + u * u), m = f > 0 ? -u / f : 0, p = f > 0 ? d / f : 1, w = s * Math.PI * 2 * o + c, v = r ? Math.pow(1 - o, a) : 1, l = n * Math.sin(w) * v, g = he(o);
|
|
530
530
|
return {
|
|
531
|
-
x:
|
|
532
|
-
y:
|
|
531
|
+
x: J(t.x, i.x, g) + l * m,
|
|
532
|
+
y: J(t.y, i.y, g) + l * p
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
535
|
function at(o) {
|
|
@@ -546,21 +546,21 @@ function ue(o, t, i) {
|
|
|
546
546
|
const { overshoot: e, bounces: n } = i, s = [];
|
|
547
547
|
s.push({ time: 0.5, scale: e });
|
|
548
548
|
let r = e;
|
|
549
|
-
const a = 0.5,
|
|
549
|
+
const a = 0.5, d = 0.5 / (n * 2);
|
|
550
550
|
let u = 0.5;
|
|
551
|
-
for (let
|
|
552
|
-
const
|
|
553
|
-
u +=
|
|
551
|
+
for (let m = 0; m < n; m++) {
|
|
552
|
+
const p = 1 - (r - 1) * a;
|
|
553
|
+
u += d, s.push({ time: u, scale: p }), r = 1 + (r - 1) * a * a, u += d, m < n - 1 && s.push({ time: u, scale: r });
|
|
554
554
|
}
|
|
555
555
|
s.push({ time: 1, scale: 1 });
|
|
556
|
-
let
|
|
557
|
-
for (let
|
|
558
|
-
if (o <= s[
|
|
559
|
-
const
|
|
560
|
-
|
|
556
|
+
let f = 1;
|
|
557
|
+
for (let m = 0; m < s.length; m++)
|
|
558
|
+
if (o <= s[m].time) {
|
|
559
|
+
const p = m === 0 ? 0 : s[m - 1].time, w = m === 0 ? 1 : s[m - 1].scale, v = (o - p) / (s[m].time - p), l = at(v);
|
|
560
|
+
f = w + (s[m].scale - w) * l;
|
|
561
561
|
break;
|
|
562
562
|
}
|
|
563
|
-
return
|
|
563
|
+
return f * t;
|
|
564
564
|
}
|
|
565
565
|
function fe(o) {
|
|
566
566
|
const {
|
|
@@ -572,57 +572,63 @@ function fe(o) {
|
|
|
572
572
|
imageWidth: r,
|
|
573
573
|
imageHeight: a,
|
|
574
574
|
rotation: c,
|
|
575
|
-
scale:
|
|
575
|
+
scale: d,
|
|
576
576
|
onComplete: u,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
577
|
+
onProgress: f,
|
|
578
|
+
rotationConfig: m,
|
|
579
|
+
startRotation: p,
|
|
580
|
+
scaleConfig: w,
|
|
581
|
+
startScale: v
|
|
582
|
+
} = o, l = n.type, g = p !== void 0 && p !== c, h = m?.mode === "wobble", b = m?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, I = g || h, y = v !== void 0 && v !== d, x = w?.mode === "pop", E = w?.pop || { overshoot: 1.2, bounces: 1 };
|
|
583
|
+
if (l === "linear" && !I && !(y || x)) {
|
|
583
584
|
u && u();
|
|
584
585
|
return;
|
|
585
586
|
}
|
|
586
|
-
const
|
|
587
|
-
function z(
|
|
588
|
-
const
|
|
589
|
-
let
|
|
590
|
-
switch (
|
|
587
|
+
const R = performance.now(), M = -r / 2, T = -a / 2;
|
|
588
|
+
function z(k) {
|
|
589
|
+
const D = k - R, O = Math.min(D / s, 1);
|
|
590
|
+
let S;
|
|
591
|
+
switch (l) {
|
|
591
592
|
case "bounce": {
|
|
592
|
-
const
|
|
593
|
+
const N = ie(
|
|
593
594
|
n.bouncePreset,
|
|
594
595
|
n.bounce
|
|
595
596
|
);
|
|
596
|
-
|
|
597
|
+
S = ae(O, i, e, N);
|
|
597
598
|
break;
|
|
598
599
|
}
|
|
599
600
|
case "elastic": {
|
|
600
|
-
const
|
|
601
|
+
const N = ne(
|
|
601
602
|
n.elasticPreset,
|
|
602
603
|
n.elastic
|
|
603
604
|
);
|
|
604
|
-
|
|
605
|
+
S = ce(O, i, e, N);
|
|
605
606
|
break;
|
|
606
607
|
}
|
|
607
608
|
case "wave": {
|
|
608
|
-
const
|
|
609
|
+
const N = oe(
|
|
609
610
|
n.wavePreset,
|
|
610
611
|
n.wave
|
|
611
612
|
);
|
|
612
|
-
|
|
613
|
+
S = le(O, i, e, N);
|
|
613
614
|
break;
|
|
614
615
|
}
|
|
615
616
|
default:
|
|
616
|
-
|
|
617
|
-
x:
|
|
618
|
-
y:
|
|
617
|
+
S = {
|
|
618
|
+
x: J(i.x, e.x, O),
|
|
619
|
+
y: J(i.y, e.y, O)
|
|
619
620
|
};
|
|
620
621
|
}
|
|
621
|
-
const
|
|
622
|
-
let
|
|
623
|
-
|
|
624
|
-
let
|
|
625
|
-
|
|
622
|
+
const _ = S.x - e.x, $ = S.y - e.y;
|
|
623
|
+
let A;
|
|
624
|
+
h ? A = de(O, c, b) : g ? A = J(p, c, O) : A = c;
|
|
625
|
+
let j;
|
|
626
|
+
x ? j = ue(O, d, E) : y ? j = J(v, d, O) : j = d, t.style.transform = `translate(${M}px, ${T}px) translate(${_}px, ${$}px) rotate(${A}deg) scale(${j})`, f && O < 1 && f(O, D, {
|
|
627
|
+
x: S.x,
|
|
628
|
+
y: S.y,
|
|
629
|
+
rotation: A,
|
|
630
|
+
scale: j
|
|
631
|
+
}), O < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${M}px, ${T}px) rotate(${c}deg) scale(${d})`, u && u());
|
|
626
632
|
}
|
|
627
633
|
requestAnimationFrame(z);
|
|
628
634
|
}
|
|
@@ -640,7 +646,7 @@ const me = {
|
|
|
640
646
|
};
|
|
641
647
|
class pe {
|
|
642
648
|
constructor(t, i) {
|
|
643
|
-
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale ||
|
|
649
|
+
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || xt;
|
|
644
650
|
}
|
|
645
651
|
/**
|
|
646
652
|
* Get the effective start position, considering layout-aware defaults
|
|
@@ -684,9 +690,9 @@ class pe {
|
|
|
684
690
|
* Calculate start position from the nearest edge (current default behavior)
|
|
685
691
|
*/
|
|
686
692
|
calculateNearestEdge(t, i, e, n) {
|
|
687
|
-
const s = t.x, r = t.y, a = s, c = e.width - s,
|
|
688
|
-
let
|
|
689
|
-
return
|
|
693
|
+
const s = t.x, r = t.y, a = s, c = e.width - s, d = r, u = e.height - r, f = Math.min(a, c, d, u);
|
|
694
|
+
let m = t.x, p = t.y;
|
|
695
|
+
return f === a ? m = -(i.width + n) : f === c ? m = e.width + n : f === d ? p = -(i.height + n) : p = e.height + n, { x: m, y: p };
|
|
690
696
|
}
|
|
691
697
|
/**
|
|
692
698
|
* Calculate start position from a specific edge
|
|
@@ -734,18 +740,18 @@ class pe {
|
|
|
734
740
|
calculateCircularPosition(t, i, e, n, s) {
|
|
735
741
|
const r = this.config.start.circular || {}, a = r.distribution || "even";
|
|
736
742
|
let c;
|
|
737
|
-
const
|
|
738
|
-
if (typeof
|
|
739
|
-
const
|
|
743
|
+
const d = r.radius || "120%";
|
|
744
|
+
if (typeof d == "string" && d.endsWith("%")) {
|
|
745
|
+
const v = parseFloat(d) / 100;
|
|
740
746
|
c = Math.sqrt(
|
|
741
747
|
e.width ** 2 + e.height ** 2
|
|
742
|
-
) *
|
|
748
|
+
) * v / 2;
|
|
743
749
|
} else
|
|
744
|
-
c = typeof
|
|
750
|
+
c = typeof d == "number" ? d : 500;
|
|
745
751
|
let u;
|
|
746
752
|
a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
747
|
-
const
|
|
748
|
-
return { x:
|
|
753
|
+
const f = e.width / 2, m = e.height / 2, p = f + Math.cos(u) * c, w = m + Math.sin(u) * c;
|
|
754
|
+
return { x: p, y: w };
|
|
749
755
|
}
|
|
750
756
|
/**
|
|
751
757
|
* Get animation parameters for an image
|
|
@@ -765,8 +771,8 @@ class pe {
|
|
|
765
771
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
766
772
|
*/
|
|
767
773
|
buildStartTransform(t, i, e, n, s, r, a, c) {
|
|
768
|
-
const
|
|
769
|
-
return t.useScale ? `${
|
|
774
|
+
const d = t.x - i.x, u = t.y - i.y, f = a !== void 0 ? a : e, m = c !== void 0 ? c : n, p = s !== void 0 ? -s / 2 : 0, w = r !== void 0 ? -r / 2 : 0, v = s !== void 0 ? `translate(${p}px, ${w}px)` : "translate(-50%, -50%)";
|
|
775
|
+
return t.useScale ? `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(0)` : `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(${m})`;
|
|
770
776
|
}
|
|
771
777
|
/**
|
|
772
778
|
* Build the final CSS transform string
|
|
@@ -893,8 +899,8 @@ class pe {
|
|
|
893
899
|
amplitude: 15,
|
|
894
900
|
frequency: 3,
|
|
895
901
|
decay: !0
|
|
896
|
-
}, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1,
|
|
897
|
-
return i +
|
|
902
|
+
}, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, d = n * a * c;
|
|
903
|
+
return i + d;
|
|
898
904
|
}
|
|
899
905
|
/**
|
|
900
906
|
* Get the scale configuration
|
|
@@ -954,8 +960,8 @@ class pe {
|
|
|
954
960
|
let a = i;
|
|
955
961
|
for (let c = 0; c < r.length; c++)
|
|
956
962
|
if (t <= r[c].time) {
|
|
957
|
-
const
|
|
958
|
-
a = u + (r[c].scale - u) *
|
|
963
|
+
const d = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, f = (t - d) / (r[c].time - d), m = this.easeOutQuad(f);
|
|
964
|
+
a = u + (r[c].scale - u) * m;
|
|
959
965
|
break;
|
|
960
966
|
}
|
|
961
967
|
return a * i;
|
|
@@ -969,9 +975,9 @@ class pe {
|
|
|
969
975
|
let n = i;
|
|
970
976
|
const s = 0.5, a = 0.5 / (t * 2);
|
|
971
977
|
let c = 0.5;
|
|
972
|
-
for (let
|
|
978
|
+
for (let d = 0; d < t; d++) {
|
|
973
979
|
const u = 1 - (n - 1) * s;
|
|
974
|
-
c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a,
|
|
980
|
+
c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, d < t - 1 && e.push({ time: c, scale: n });
|
|
975
981
|
}
|
|
976
982
|
return e.push({ time: 1, scale: 1 }), e;
|
|
977
983
|
}
|
|
@@ -1067,7 +1073,7 @@ class be {
|
|
|
1067
1073
|
}
|
|
1068
1074
|
}
|
|
1069
1075
|
_startWiggle(t) {
|
|
1070
|
-
const i = { ...
|
|
1076
|
+
const i = { ...Vt, ...this.config.wiggle }, e = [
|
|
1071
1077
|
{ transform: "rotate(0deg)", offset: 0 },
|
|
1072
1078
|
{ transform: `rotate(${i.maxAngle}deg)`, offset: 0.25 },
|
|
1073
1079
|
{ transform: "rotate(0deg)", offset: 0.5 },
|
|
@@ -1087,7 +1093,7 @@ class be {
|
|
|
1087
1093
|
});
|
|
1088
1094
|
}
|
|
1089
1095
|
_startPulse(t) {
|
|
1090
|
-
const i = { ...
|
|
1096
|
+
const i = { ...Jt, ...this.config.pulse }, e = [
|
|
1091
1097
|
{ transform: "scale(1)", offset: 0 },
|
|
1092
1098
|
{ transform: `scale(${i.maxScale})`, offset: 0.25 },
|
|
1093
1099
|
{ transform: "scale(1)", offset: 0.5 },
|
|
@@ -1180,17 +1186,17 @@ class ye {
|
|
|
1180
1186
|
* @returns Array of layout objects with position, rotation, scale
|
|
1181
1187
|
*/
|
|
1182
1188
|
generate(t, i, e = {}) {
|
|
1183
|
-
const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200,
|
|
1184
|
-
for (let
|
|
1185
|
-
const
|
|
1186
|
-
id:
|
|
1187
|
-
x:
|
|
1188
|
-
y:
|
|
1189
|
-
rotation:
|
|
1190
|
-
scale:
|
|
1191
|
-
baseSize:
|
|
1189
|
+
const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, l = c * 1.5 / 2, g = c / 2, h = s - a - l, b = r - a - g, I = a + l, y = a + g;
|
|
1190
|
+
for (let x = 0; x < t; x++) {
|
|
1191
|
+
const E = this.random(I, h), F = this.random(y, b), R = d === "random" ? this.random(u, f) : 0, M = w ? this.random(m, p) : 1, T = c * M, z = {
|
|
1192
|
+
id: x,
|
|
1193
|
+
x: E,
|
|
1194
|
+
y: F,
|
|
1195
|
+
rotation: R,
|
|
1196
|
+
scale: M,
|
|
1197
|
+
baseSize: T
|
|
1192
1198
|
};
|
|
1193
|
-
n.push(
|
|
1199
|
+
n.push(z);
|
|
1194
1200
|
}
|
|
1195
1201
|
return n;
|
|
1196
1202
|
}
|
|
@@ -1216,53 +1222,53 @@ class ve {
|
|
|
1216
1222
|
* @returns Array of layout objects with position, rotation, scale
|
|
1217
1223
|
*/
|
|
1218
1224
|
generate(t, i, e = {}) {
|
|
1219
|
-
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none",
|
|
1225
|
+
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = this.config.scaleDecay ?? 0, v = {
|
|
1220
1226
|
...jt,
|
|
1221
1227
|
...this.config.radial
|
|
1222
|
-
},
|
|
1223
|
-
|
|
1224
|
-
|
|
1228
|
+
}, l = e.fixedHeight ?? a, g = s / 2, h = r / 2, b = Math.ceil(Math.sqrt(t)), I = this.config.spacing.padding ?? 50, y = Math.max(l * 0.8, Math.min(
|
|
1229
|
+
g - I - l / 2,
|
|
1230
|
+
h - I - l / 2
|
|
1225
1231
|
));
|
|
1226
1232
|
if (t > 0) {
|
|
1227
|
-
const
|
|
1233
|
+
const F = p ? this.random(f, m) : 1, R = l * F;
|
|
1228
1234
|
n.push({
|
|
1229
1235
|
id: 0,
|
|
1230
|
-
x:
|
|
1231
|
-
y,
|
|
1232
|
-
rotation: c === "random" ? this.random(
|
|
1236
|
+
x: g,
|
|
1237
|
+
y: h,
|
|
1238
|
+
rotation: c === "random" ? this.random(d * 0.33, u * 0.33) : 0,
|
|
1233
1239
|
// Less rotation for center
|
|
1234
|
-
scale:
|
|
1235
|
-
baseSize:
|
|
1240
|
+
scale: F,
|
|
1241
|
+
baseSize: R,
|
|
1236
1242
|
zIndex: 100
|
|
1237
1243
|
// Center image is highest
|
|
1238
1244
|
});
|
|
1239
1245
|
}
|
|
1240
|
-
let
|
|
1241
|
-
for (;
|
|
1242
|
-
const
|
|
1243
|
-
if (
|
|
1244
|
-
|
|
1246
|
+
let x = 1, E = 1;
|
|
1247
|
+
for (; x < t; ) {
|
|
1248
|
+
const F = E / b, R = w > 0 ? 1 - F * w * 0.5 : 1, M = Math.max(l * 0.8, y / b * 1.5 / v.tightness), T = E * M, z = T * 1.5, k = Math.PI * (3 * (z + T) - Math.sqrt((3 * z + T) * (z + 3 * T))), D = this.estimateWidth(l), O = Math.floor(k / (D * 0.7));
|
|
1249
|
+
if (O === 0) {
|
|
1250
|
+
E++;
|
|
1245
1251
|
continue;
|
|
1246
1252
|
}
|
|
1247
|
-
const
|
|
1248
|
-
for (let
|
|
1249
|
-
const
|
|
1250
|
-
let
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1253
|
-
const
|
|
1253
|
+
const S = 2 * Math.PI / O, _ = E * (20 * Math.PI / 180);
|
|
1254
|
+
for (let $ = 0; $ < O && x < t; $++) {
|
|
1255
|
+
const A = $ * S + _, j = p ? this.random(f, m) : 1, N = R * j, P = l * N;
|
|
1256
|
+
let H = g + Math.cos(A) * z, U = h + Math.sin(A) * T;
|
|
1257
|
+
const B = P * 1.5 / 2, W = P / 2;
|
|
1258
|
+
H - B < I ? H = I + B : H + B > s - I && (H = s - I - B), U - W < I ? U = I + W : U + W > r - I && (U = r - I - W);
|
|
1259
|
+
const X = c === "random" ? this.random(d, u) : 0;
|
|
1254
1260
|
n.push({
|
|
1255
|
-
id:
|
|
1256
|
-
x:
|
|
1257
|
-
y:
|
|
1258
|
-
rotation:
|
|
1259
|
-
scale:
|
|
1260
|
-
baseSize:
|
|
1261
|
-
zIndex: Math.max(1, 100 -
|
|
1261
|
+
id: x,
|
|
1262
|
+
x: H,
|
|
1263
|
+
y: U,
|
|
1264
|
+
rotation: X,
|
|
1265
|
+
scale: N,
|
|
1266
|
+
baseSize: P,
|
|
1267
|
+
zIndex: Math.max(1, 100 - E)
|
|
1262
1268
|
// Outer rings have lower z-index
|
|
1263
|
-
}),
|
|
1269
|
+
}), x++;
|
|
1264
1270
|
}
|
|
1265
|
-
|
|
1271
|
+
E++;
|
|
1266
1272
|
}
|
|
1267
1273
|
return n;
|
|
1268
1274
|
}
|
|
@@ -1285,7 +1291,7 @@ class ve {
|
|
|
1285
1291
|
return Math.random() * (i - t) + t;
|
|
1286
1292
|
}
|
|
1287
1293
|
}
|
|
1288
|
-
const
|
|
1294
|
+
const xe = {
|
|
1289
1295
|
columns: "auto",
|
|
1290
1296
|
rows: "auto",
|
|
1291
1297
|
stagger: "none",
|
|
@@ -1295,7 +1301,7 @@ const Ee = {
|
|
|
1295
1301
|
alignment: "center",
|
|
1296
1302
|
gap: 10,
|
|
1297
1303
|
overflowOffset: 0.25
|
|
1298
|
-
},
|
|
1304
|
+
}, At = [
|
|
1299
1305
|
{ x: 1, y: 1 },
|
|
1300
1306
|
// bottom-right
|
|
1301
1307
|
{ x: -1, y: -1 },
|
|
@@ -1313,7 +1319,7 @@ const Ee = {
|
|
|
1313
1319
|
{ x: 0, y: 1 }
|
|
1314
1320
|
// down
|
|
1315
1321
|
];
|
|
1316
|
-
class
|
|
1322
|
+
class Ee {
|
|
1317
1323
|
constructor(t, i = {}) {
|
|
1318
1324
|
this.config = t, this.imageConfig = i;
|
|
1319
1325
|
}
|
|
@@ -1325,61 +1331,61 @@ class we {
|
|
|
1325
1331
|
* @returns Array of layout objects with position, rotation, scale
|
|
1326
1332
|
*/
|
|
1327
1333
|
generate(t, i, e = {}) {
|
|
1328
|
-
const n = [], { width: s, height: r } = i, a = { ...
|
|
1334
|
+
const n = [], { width: s, height: r } = i, a = { ...xe, ...this.config.grid }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = s - 2 * c, v = r - 2 * c, { columns: l, rows: g } = this.calculateGridDimensions(
|
|
1329
1335
|
t,
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1336
|
+
w,
|
|
1337
|
+
v,
|
|
1338
|
+
d,
|
|
1333
1339
|
a
|
|
1334
|
-
),
|
|
1340
|
+
), h = a.stagger === "row", b = a.stagger === "column", I = h ? l + 0.5 : l, y = b ? g + 0.5 : g, x = (w - a.gap * (l - 1)) / I, E = (v - a.gap * (g - 1)) / y, F = h ? x / 2 : 0, R = b ? E / 2 : 0, M = 1 + a.overlap, T = Math.min(x, E) * M, z = e.fixedHeight ? Math.min(e.fixedHeight, T) : T, k = l * x + (l - 1) * a.gap + F, D = g * E + (g - 1) * a.gap + R, O = c + (w - k) / 2, S = c + (v - D) / 2, _ = l * g, $ = a.columns !== "auto" && a.rows !== "auto", A = $ && t > _;
|
|
1335
1341
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1336
1342
|
gridConfigColumns: a.columns,
|
|
1337
1343
|
gridConfigRows: a.rows,
|
|
1338
|
-
columns:
|
|
1339
|
-
rows:
|
|
1340
|
-
cellCount:
|
|
1341
|
-
hasFixedGrid:
|
|
1344
|
+
columns: l,
|
|
1345
|
+
rows: g,
|
|
1346
|
+
cellCount: _,
|
|
1347
|
+
hasFixedGrid: $,
|
|
1342
1348
|
imageCount: t,
|
|
1343
|
-
isOverflowMode:
|
|
1349
|
+
isOverflowMode: A
|
|
1344
1350
|
});
|
|
1345
|
-
const
|
|
1346
|
-
for (let
|
|
1347
|
-
let
|
|
1348
|
-
if (
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
+
const j = A ? new Array(_).fill(0) : [], N = Math.min(x, E) * a.overflowOffset;
|
|
1352
|
+
for (let P = 0; P < t; P++) {
|
|
1353
|
+
let H, U, Y = 0;
|
|
1354
|
+
if (A && P >= _) {
|
|
1355
|
+
const q = P - _, G = q % _;
|
|
1356
|
+
Y = Math.floor(q / _) + 1, j[G]++, a.fillDirection === "row" ? (H = G % l, U = Math.floor(G / l)) : (U = G % g, H = Math.floor(G / g));
|
|
1351
1357
|
} else
|
|
1352
|
-
a.fillDirection === "row" ? (
|
|
1353
|
-
let
|
|
1354
|
-
if (a.stagger === "row" &&
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1358
|
+
a.fillDirection === "row" ? (H = P % l, U = Math.floor(P / l)) : (U = P % g, H = Math.floor(P / g));
|
|
1359
|
+
let B = O + H * (x + a.gap) + x / 2, W = S + U * (E + a.gap) + E / 2;
|
|
1360
|
+
if (a.stagger === "row" && U % 2 === 1 ? B += x / 2 : a.stagger === "column" && H % 2 === 1 && (W += E / 2), Y > 0) {
|
|
1361
|
+
const q = (Y - 1) % At.length, G = At[q];
|
|
1362
|
+
B += G.x * N, W += G.y * N;
|
|
1357
1363
|
}
|
|
1358
1364
|
if (a.jitter > 0) {
|
|
1359
|
-
const
|
|
1360
|
-
|
|
1365
|
+
const q = x / 2 * a.jitter, G = E / 2 * a.jitter;
|
|
1366
|
+
B += this.random(-q, q), W += this.random(-G, G);
|
|
1361
1367
|
}
|
|
1362
|
-
let
|
|
1363
|
-
if (!
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1366
|
-
const
|
|
1368
|
+
let X = B, V = W;
|
|
1369
|
+
if (!A && a.fillDirection === "row") {
|
|
1370
|
+
const q = t % l || l;
|
|
1371
|
+
if (U === Math.floor((t - 1) / l) && q < l) {
|
|
1372
|
+
const It = q * x + (q - 1) * a.gap;
|
|
1367
1373
|
let gt = 0;
|
|
1368
|
-
a.alignment === "center" ? gt = (
|
|
1374
|
+
a.alignment === "center" ? gt = (k - It) / 2 : a.alignment === "end" && (gt = k - It), X += gt;
|
|
1369
1375
|
}
|
|
1370
1376
|
}
|
|
1371
|
-
const ct =
|
|
1372
|
-
|
|
1377
|
+
const ct = p ? this.random(f, m) : 1, K = z * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, _t = c + ot, Ut = r - c - ot;
|
|
1378
|
+
X = Math.max(ht, Math.min(X, dt)), V = Math.max(_t, Math.min(V, Ut));
|
|
1373
1379
|
let ut = 0;
|
|
1374
1380
|
if (u === "random") {
|
|
1375
|
-
const
|
|
1376
|
-
a.jitter > 0 ? ut = this.random(
|
|
1381
|
+
const q = this.imageConfig.rotation?.range?.min ?? -15, G = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1382
|
+
a.jitter > 0 ? ut = this.random(q * a.jitter, G * a.jitter) : ut = this.random(q, G);
|
|
1377
1383
|
}
|
|
1378
1384
|
let ft;
|
|
1379
|
-
|
|
1380
|
-
id:
|
|
1381
|
-
x:
|
|
1382
|
-
y:
|
|
1385
|
+
A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + P : P + 1, n.push({
|
|
1386
|
+
id: P,
|
|
1387
|
+
x: X,
|
|
1388
|
+
y: V,
|
|
1383
1389
|
rotation: ut,
|
|
1384
1390
|
scale: ct,
|
|
1385
1391
|
baseSize: K,
|
|
@@ -1413,14 +1419,14 @@ class we {
|
|
|
1413
1419
|
return Math.random() * (i - t) + t;
|
|
1414
1420
|
}
|
|
1415
1421
|
}
|
|
1416
|
-
const
|
|
1422
|
+
const we = Math.PI * (3 - Math.sqrt(5)), Ie = {
|
|
1417
1423
|
spiralType: "golden",
|
|
1418
1424
|
direction: "counterclockwise",
|
|
1419
1425
|
tightness: 1,
|
|
1420
1426
|
scaleDecay: 0,
|
|
1421
1427
|
startAngle: 0
|
|
1422
1428
|
};
|
|
1423
|
-
class
|
|
1429
|
+
class Se {
|
|
1424
1430
|
constructor(t, i = {}) {
|
|
1425
1431
|
this.config = t, this.imageConfig = i;
|
|
1426
1432
|
}
|
|
@@ -1432,36 +1438,36 @@ class Ie {
|
|
|
1432
1438
|
* @returns Array of layout objects with position, rotation, scale
|
|
1433
1439
|
*/
|
|
1434
1440
|
generate(t, i, e = {}) {
|
|
1435
|
-
const n = [], { width: s, height: r } = i, a = { ...
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
),
|
|
1439
|
-
for (let
|
|
1440
|
-
let
|
|
1441
|
+
const n = [], { width: s, height: r } = i, a = { ...Ie, ...this.config.spiral }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, w = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || w !== 1, l = this.config.scaleDecay ?? a.scaleDecay, g = s / 2, h = r / 2, b = Math.min(
|
|
1442
|
+
g - c - d / 2,
|
|
1443
|
+
h - c - d / 2
|
|
1444
|
+
), I = a.direction === "clockwise" ? -1 : 1;
|
|
1445
|
+
for (let y = 0; y < t; y++) {
|
|
1446
|
+
let x, E;
|
|
1441
1447
|
if (a.spiralType === "golden")
|
|
1442
|
-
|
|
1448
|
+
x = y * we * I + a.startAngle, E = this.calculateGoldenRadius(y, t, b, a.tightness);
|
|
1443
1449
|
else if (a.spiralType === "archimedean") {
|
|
1444
|
-
const
|
|
1445
|
-
|
|
1450
|
+
const B = y * 0.5 * a.tightness;
|
|
1451
|
+
x = B * I + a.startAngle, E = this.calculateArchimedeanRadius(B, t, b, a.tightness);
|
|
1446
1452
|
} else {
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1453
|
+
const B = y * 0.3 * a.tightness;
|
|
1454
|
+
x = B * I + a.startAngle, E = this.calculateLogarithmicRadius(B, t, b, a.tightness);
|
|
1449
1455
|
}
|
|
1450
|
-
const
|
|
1451
|
-
let
|
|
1456
|
+
const F = g + Math.cos(x) * E, R = h + Math.sin(x) * E, M = E / b, T = l > 0 ? 1 - M * l * 0.5 : 1, z = v ? this.random(p, w) : 1, k = T * z, D = d * k, S = D * 1.5 / 2, _ = D / 2, $ = c + S, A = s - c - S, j = c + _, N = r - c - _, P = Math.max($, Math.min(F, A)), H = Math.max(j, Math.min(R, N));
|
|
1457
|
+
let U = 0;
|
|
1452
1458
|
if (u === "random") {
|
|
1453
|
-
const
|
|
1454
|
-
|
|
1455
|
-
} else u === "tangent" && (
|
|
1456
|
-
const
|
|
1459
|
+
const B = x * 180 / Math.PI % 360, W = this.random(f, m);
|
|
1460
|
+
U = a.spiralType === "golden" ? W : B * 0.1 + W * 0.9;
|
|
1461
|
+
} else u === "tangent" && (U = this.calculateSpiralTangent(x, E, a));
|
|
1462
|
+
const Y = t - y;
|
|
1457
1463
|
n.push({
|
|
1458
|
-
id:
|
|
1459
|
-
x:
|
|
1460
|
-
y:
|
|
1461
|
-
rotation:
|
|
1462
|
-
scale:
|
|
1463
|
-
baseSize:
|
|
1464
|
-
zIndex:
|
|
1464
|
+
id: y,
|
|
1465
|
+
x: P,
|
|
1466
|
+
y: H,
|
|
1467
|
+
rotation: U,
|
|
1468
|
+
scale: k,
|
|
1469
|
+
baseSize: D,
|
|
1470
|
+
zIndex: Y
|
|
1465
1471
|
});
|
|
1466
1472
|
}
|
|
1467
1473
|
return n;
|
|
@@ -1504,8 +1510,8 @@ class Ie {
|
|
|
1504
1510
|
* r = a * e^(b*θ)
|
|
1505
1511
|
*/
|
|
1506
1512
|
calculateLogarithmicRadius(t, i, e, n) {
|
|
1507
|
-
const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n,
|
|
1508
|
-
return a /
|
|
1513
|
+
const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, d = s * Math.exp(r * c);
|
|
1514
|
+
return a / d * e;
|
|
1509
1515
|
}
|
|
1510
1516
|
/**
|
|
1511
1517
|
* Utility: Generate random number between min and max
|
|
@@ -1522,7 +1528,7 @@ const Ce = {
|
|
|
1522
1528
|
overlap: 0.3,
|
|
1523
1529
|
distribution: "gaussian"
|
|
1524
1530
|
};
|
|
1525
|
-
class
|
|
1531
|
+
class Re {
|
|
1526
1532
|
constructor(t, i = {}) {
|
|
1527
1533
|
this.config = t, this.imageConfig = i;
|
|
1528
1534
|
}
|
|
@@ -1534,48 +1540,48 @@ class Ae {
|
|
|
1534
1540
|
* @returns Array of layout objects with position, rotation, scale
|
|
1535
1541
|
*/
|
|
1536
1542
|
generate(t, i, e = {}) {
|
|
1537
|
-
const n = [], { width: s, height: r } = i, a = { ...Ce, ...this.config.cluster }, c = this.config.spacing.padding,
|
|
1543
|
+
const n = [], { width: s, height: r } = i, a = { ...Ce, ...this.config.cluster }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, w = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || w !== 1, l = this.calculateClusterCount(
|
|
1538
1544
|
t,
|
|
1539
1545
|
a.clusterCount,
|
|
1540
1546
|
s,
|
|
1541
1547
|
r,
|
|
1542
1548
|
a.clusterSpacing
|
|
1543
|
-
),
|
|
1544
|
-
|
|
1549
|
+
), g = this.generateClusterCenters(
|
|
1550
|
+
l,
|
|
1545
1551
|
s,
|
|
1546
1552
|
r,
|
|
1547
1553
|
c,
|
|
1548
1554
|
a
|
|
1549
|
-
),
|
|
1550
|
-
for (let
|
|
1551
|
-
|
|
1552
|
-
let
|
|
1553
|
-
for (let
|
|
1554
|
-
const
|
|
1555
|
-
for (let
|
|
1556
|
-
let
|
|
1555
|
+
), h = new Array(l).fill(0);
|
|
1556
|
+
for (let I = 0; I < t; I++)
|
|
1557
|
+
h[I % l]++;
|
|
1558
|
+
let b = 0;
|
|
1559
|
+
for (let I = 0; I < l; I++) {
|
|
1560
|
+
const y = g[I], x = h[I];
|
|
1561
|
+
for (let E = 0; E < x; E++) {
|
|
1562
|
+
let F, R;
|
|
1557
1563
|
if (a.distribution === "gaussian")
|
|
1558
|
-
|
|
1564
|
+
F = this.gaussianRandom() * y.spread, R = this.gaussianRandom() * y.spread;
|
|
1559
1565
|
else {
|
|
1560
|
-
const
|
|
1561
|
-
|
|
1566
|
+
const U = this.random(0, Math.PI * 2), Y = this.random(0, y.spread);
|
|
1567
|
+
F = Math.cos(U) * Y, R = Math.sin(U) * Y;
|
|
1562
1568
|
}
|
|
1563
|
-
const
|
|
1564
|
-
|
|
1565
|
-
const
|
|
1566
|
-
let
|
|
1567
|
-
const
|
|
1568
|
-
|
|
1569
|
-
const
|
|
1569
|
+
const M = 1 + a.overlap * 0.5, T = 1 + a.overlap * 0.3;
|
|
1570
|
+
F /= M, R /= M;
|
|
1571
|
+
const z = v ? this.random(p, w) : 1, k = T * z, D = d * k;
|
|
1572
|
+
let O = y.x + F, S = y.y + R;
|
|
1573
|
+
const $ = D * 1.5 / 2, A = D / 2;
|
|
1574
|
+
O = Math.max(c + $, Math.min(O, s - c - $)), S = Math.max(c + A, Math.min(S, r - c - A));
|
|
1575
|
+
const j = u === "random" ? this.random(f, m) : 0, P = Math.sqrt(F * F + R * R) / y.spread, H = Math.round((1 - P) * 50) + 1;
|
|
1570
1576
|
n.push({
|
|
1571
|
-
id:
|
|
1572
|
-
x:
|
|
1573
|
-
y:
|
|
1574
|
-
rotation:
|
|
1575
|
-
scale:
|
|
1576
|
-
baseSize:
|
|
1577
|
-
zIndex:
|
|
1578
|
-
}),
|
|
1577
|
+
id: b,
|
|
1578
|
+
x: O,
|
|
1579
|
+
y: S,
|
|
1580
|
+
rotation: j,
|
|
1581
|
+
scale: k,
|
|
1582
|
+
baseSize: D,
|
|
1583
|
+
zIndex: H
|
|
1584
|
+
}), b++;
|
|
1579
1585
|
}
|
|
1580
1586
|
}
|
|
1581
1587
|
return n;
|
|
@@ -1595,24 +1601,24 @@ class Ae {
|
|
|
1595
1601
|
* Generate cluster center positions with spacing constraints
|
|
1596
1602
|
*/
|
|
1597
1603
|
generateClusterCenters(t, i, e, n, s) {
|
|
1598
|
-
const r = [], c = n + s.clusterSpread,
|
|
1599
|
-
for (let
|
|
1600
|
-
let
|
|
1601
|
-
for (let
|
|
1602
|
-
const
|
|
1603
|
-
x: this.random(c,
|
|
1604
|
-
y: this.random(u,
|
|
1604
|
+
const r = [], c = n + s.clusterSpread, d = i - n - s.clusterSpread, u = n + s.clusterSpread, f = e - n - s.clusterSpread;
|
|
1605
|
+
for (let m = 0; m < t; m++) {
|
|
1606
|
+
let p = null, w = -1;
|
|
1607
|
+
for (let v = 0; v < 100; v++) {
|
|
1608
|
+
const l = {
|
|
1609
|
+
x: this.random(c, d),
|
|
1610
|
+
y: this.random(u, f),
|
|
1605
1611
|
spread: this.calculateClusterSpread(s)
|
|
1606
1612
|
};
|
|
1607
|
-
let
|
|
1608
|
-
for (const
|
|
1609
|
-
const
|
|
1610
|
-
|
|
1613
|
+
let g = 1 / 0;
|
|
1614
|
+
for (const h of r) {
|
|
1615
|
+
const b = l.x - h.x, I = l.y - h.y, y = Math.sqrt(b * b + I * I);
|
|
1616
|
+
g = Math.min(g, y);
|
|
1611
1617
|
}
|
|
1612
|
-
if ((r.length === 0 ||
|
|
1618
|
+
if ((r.length === 0 || g > w) && (p = l, w = g), g >= s.clusterSpacing)
|
|
1613
1619
|
break;
|
|
1614
1620
|
}
|
|
1615
|
-
|
|
1621
|
+
p && r.push(p);
|
|
1616
1622
|
}
|
|
1617
1623
|
return r;
|
|
1618
1624
|
}
|
|
@@ -1640,7 +1646,7 @@ class Ae {
|
|
|
1640
1646
|
return Math.random() * (i - t) + t;
|
|
1641
1647
|
}
|
|
1642
1648
|
}
|
|
1643
|
-
class
|
|
1649
|
+
class Te {
|
|
1644
1650
|
constructor(t, i = {}) {
|
|
1645
1651
|
this.config = t, this.imageConfig = i;
|
|
1646
1652
|
}
|
|
@@ -1652,29 +1658,29 @@ class Re {
|
|
|
1652
1658
|
* @returns Array of layout objects with position, rotation, scale
|
|
1653
1659
|
*/
|
|
1654
1660
|
generate(t, i, e = {}) {
|
|
1655
|
-
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50,
|
|
1661
|
+
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, v = e.fixedHeight ?? a, l = {
|
|
1656
1662
|
...Wt,
|
|
1657
1663
|
...this.config.wave
|
|
1658
|
-
}, { rows:
|
|
1659
|
-
let
|
|
1660
|
-
for (let
|
|
1661
|
-
const
|
|
1662
|
-
let
|
|
1663
|
-
|
|
1664
|
-
for (let
|
|
1665
|
-
const
|
|
1666
|
-
let
|
|
1667
|
-
|
|
1668
|
-
const K =
|
|
1664
|
+
}, { rows: g, amplitude: h, frequency: b, phaseShift: I, synchronization: y } = l, x = Math.ceil(t / g), R = v * 1.5 / 2, M = c + R, T = s - c - R, z = T - M, k = x > 1 ? z / (x - 1) : 0, D = c + h + v / 2, O = r - c - h - v / 2, S = O - D, _ = g > 1 ? S / (g - 1) : 0;
|
|
1665
|
+
let $ = 0;
|
|
1666
|
+
for (let A = 0; A < g && $ < t; A++) {
|
|
1667
|
+
const j = g === 1 ? (D + O) / 2 : D + A * _;
|
|
1668
|
+
let N = 0;
|
|
1669
|
+
y === "offset" ? N = A * I : y === "alternating" && (N = A * Math.PI);
|
|
1670
|
+
for (let P = 0; P < x && $ < t; P++) {
|
|
1671
|
+
const H = x === 1 ? (M + T) / 2 : M + P * k, U = this.calculateWaveY(H, s, h, b, N), Y = H, B = j + U, W = w ? this.random(m, p) : 1, X = v * W;
|
|
1672
|
+
let V = 0;
|
|
1673
|
+
d === "tangent" ? V = this.calculateRotation(H, s, h, b, N) : d === "random" && (V = this.random(u, f));
|
|
1674
|
+
const K = X * 1.5 / 2, lt = X / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
|
|
1669
1675
|
n.push({
|
|
1670
|
-
id:
|
|
1671
|
-
x: Math.max(nt, Math.min(
|
|
1672
|
-
y: Math.max(ht, Math.min(
|
|
1673
|
-
rotation:
|
|
1674
|
-
scale:
|
|
1675
|
-
baseSize:
|
|
1676
|
-
zIndex:
|
|
1677
|
-
}),
|
|
1676
|
+
id: $,
|
|
1677
|
+
x: Math.max(nt, Math.min(Y, ot)),
|
|
1678
|
+
y: Math.max(ht, Math.min(B, dt)),
|
|
1679
|
+
rotation: V,
|
|
1680
|
+
scale: W,
|
|
1681
|
+
baseSize: X,
|
|
1682
|
+
zIndex: $ + 1
|
|
1683
|
+
}), $++;
|
|
1678
1684
|
}
|
|
1679
1685
|
}
|
|
1680
1686
|
return n;
|
|
@@ -1717,7 +1723,7 @@ class Re {
|
|
|
1717
1723
|
return Math.random() * (i - t) + t;
|
|
1718
1724
|
}
|
|
1719
1725
|
}
|
|
1720
|
-
const
|
|
1726
|
+
const Et = 100, Q = 100 / Math.sqrt(3), wt = [
|
|
1721
1727
|
[Q / 2, 0],
|
|
1722
1728
|
// upper-left
|
|
1723
1729
|
[3 * Q / 2, 0],
|
|
@@ -1730,15 +1736,15 @@ const wt = 100, Q = 100 / Math.sqrt(3), xt = [
|
|
|
1730
1736
|
// lower-left
|
|
1731
1737
|
[0, 50]
|
|
1732
1738
|
// left
|
|
1733
|
-
],
|
|
1734
|
-
function
|
|
1739
|
+
], Ae = wt[1][0] / Et, Le = wt[2][1] / Et;
|
|
1740
|
+
function Fe(o) {
|
|
1735
1741
|
return {
|
|
1736
|
-
colStep:
|
|
1742
|
+
colStep: Ae * o,
|
|
1737
1743
|
rowOffset: Le * o
|
|
1738
1744
|
};
|
|
1739
1745
|
}
|
|
1740
|
-
function
|
|
1741
|
-
const { colStep: r } =
|
|
1746
|
+
function Me(o, t, i, e, n, s) {
|
|
1747
|
+
const { colStep: r } = Fe(s);
|
|
1742
1748
|
return {
|
|
1743
1749
|
px: e + r * o,
|
|
1744
1750
|
py: n + s * (t + o / 2)
|
|
@@ -1768,28 +1774,28 @@ class De {
|
|
|
1768
1774
|
this.config = t;
|
|
1769
1775
|
}
|
|
1770
1776
|
generate(t, i, e = {}) {
|
|
1771
|
-
const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2,
|
|
1777
|
+
const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, d = e.fixedHeight ?? 200, f = {
|
|
1772
1778
|
...Gt,
|
|
1773
1779
|
...this.config.honeycomb
|
|
1774
|
-
}.spacing ?? 0,
|
|
1775
|
-
let
|
|
1776
|
-
for (;
|
|
1777
|
-
const
|
|
1778
|
-
for (const [
|
|
1779
|
-
if (
|
|
1780
|
-
const { px:
|
|
1780
|
+
}.spacing ?? 0, m = d + f;
|
|
1781
|
+
let p = 0, w = 0;
|
|
1782
|
+
for (; p < t; ) {
|
|
1783
|
+
const v = ze(w);
|
|
1784
|
+
for (const [l, g, h] of v) {
|
|
1785
|
+
if (p >= t) break;
|
|
1786
|
+
const { px: b, py: I } = Me(l, g, h, a, c, m);
|
|
1781
1787
|
n.push({
|
|
1782
|
-
id:
|
|
1783
|
-
x:
|
|
1784
|
-
y:
|
|
1788
|
+
id: p,
|
|
1789
|
+
x: b,
|
|
1790
|
+
y: I,
|
|
1785
1791
|
rotation: 0,
|
|
1786
1792
|
scale: 1,
|
|
1787
|
-
baseSize:
|
|
1793
|
+
baseSize: d,
|
|
1788
1794
|
// Inner rings render above outer rings
|
|
1789
|
-
zIndex: Math.max(1, 100 -
|
|
1790
|
-
}),
|
|
1795
|
+
zIndex: Math.max(1, 100 - w)
|
|
1796
|
+
}), p++;
|
|
1791
1797
|
}
|
|
1792
|
-
|
|
1798
|
+
w++;
|
|
1793
1799
|
}
|
|
1794
1800
|
return n;
|
|
1795
1801
|
}
|
|
@@ -1807,13 +1813,13 @@ class $e {
|
|
|
1807
1813
|
case "radial":
|
|
1808
1814
|
return new ve(this.config, this.imageConfig);
|
|
1809
1815
|
case "grid":
|
|
1810
|
-
return new
|
|
1816
|
+
return new Ee(this.config, this.imageConfig);
|
|
1811
1817
|
case "spiral":
|
|
1812
|
-
return new
|
|
1818
|
+
return new Se(this.config, this.imageConfig);
|
|
1813
1819
|
case "cluster":
|
|
1814
|
-
return new Ae(this.config, this.imageConfig);
|
|
1815
|
-
case "wave":
|
|
1816
1820
|
return new Re(this.config, this.imageConfig);
|
|
1821
|
+
case "wave":
|
|
1822
|
+
return new Te(this.config, this.imageConfig);
|
|
1817
1823
|
case "honeycomb":
|
|
1818
1824
|
return new De(this.config, this.imageConfig);
|
|
1819
1825
|
default:
|
|
@@ -1899,15 +1905,15 @@ class $e {
|
|
|
1899
1905
|
const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
|
|
1900
1906
|
if (r !== void 0)
|
|
1901
1907
|
return { height: r };
|
|
1902
|
-
const a = s?.minSize ?? 50, c = s?.maxSize ?? 400,
|
|
1903
|
-
let
|
|
1904
|
-
|
|
1905
|
-
let
|
|
1906
|
-
if (
|
|
1907
|
-
const
|
|
1908
|
-
|
|
1908
|
+
const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, d = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: f, height: m } = t, v = f * m * d / i;
|
|
1909
|
+
let g = Math.sqrt(v / 1.4);
|
|
1910
|
+
g *= u, g = Math.min(g, e);
|
|
1911
|
+
let h = this.clamp(g, a, c);
|
|
1912
|
+
if (h === a && g < a) {
|
|
1913
|
+
const b = Math.max(a * 0.05, 20);
|
|
1914
|
+
h = Math.max(b, g);
|
|
1909
1915
|
}
|
|
1910
|
-
return this.config.algorithm === "honeycomb" && (
|
|
1916
|
+
return this.config.algorithm === "honeycomb" && (h = Math.min(h, this.honeycombMaxImageHeight(i, t))), { height: h };
|
|
1911
1917
|
}
|
|
1912
1918
|
/**
|
|
1913
1919
|
* Returns the largest image height at which all honeycomb rings fit within the container.
|
|
@@ -1919,8 +1925,8 @@ class $e {
|
|
|
1919
1925
|
let e = 0, n = 1;
|
|
1920
1926
|
for (; n < t; )
|
|
1921
1927
|
e++, n += 6 * e;
|
|
1922
|
-
const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2,
|
|
1923
|
-
return Math.max(10, Math.min(
|
|
1928
|
+
const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, d = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), f = (c - s - r * e) / (e + 0.5), m = (a - s - d * r * e) / (d * e + u);
|
|
1929
|
+
return Math.max(10, Math.min(f, m));
|
|
1924
1930
|
}
|
|
1925
1931
|
/**
|
|
1926
1932
|
* Utility: Clamp a value between min and max
|
|
@@ -1929,7 +1935,7 @@ class $e {
|
|
|
1929
1935
|
return Math.max(i, Math.min(e, t));
|
|
1930
1936
|
}
|
|
1931
1937
|
}
|
|
1932
|
-
var
|
|
1938
|
+
var C = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(C || {});
|
|
1933
1939
|
const Lt = {
|
|
1934
1940
|
// Geometric shapes - uses percentages for responsive sizing
|
|
1935
1941
|
circle: "circle(50%)",
|
|
@@ -1963,8 +1969,8 @@ const Lt = {
|
|
|
1963
1969
|
},
|
|
1964
1970
|
// Hexagon - regular hexagon (reference points imported from hexagonGeometry)
|
|
1965
1971
|
hexagon: {
|
|
1966
|
-
refHeight:
|
|
1967
|
-
points:
|
|
1972
|
+
refHeight: Et,
|
|
1973
|
+
points: wt
|
|
1968
1974
|
},
|
|
1969
1975
|
// Octagon - regular octagon
|
|
1970
1976
|
octagon: {
|
|
@@ -1987,19 +1993,19 @@ function Ue(o, t, i) {
|
|
|
1987
1993
|
const n = t / e.refHeight;
|
|
1988
1994
|
if (o === "circle")
|
|
1989
1995
|
return `circle(${Math.round(50 * n * 100) / 100}px)`;
|
|
1990
|
-
const s = e.points.map(([
|
|
1991
|
-
return `polygon(${e.points.map(([
|
|
1992
|
-
const
|
|
1993
|
-
return `${
|
|
1996
|
+
const s = e.points.map(([v]) => v), r = e.points.map(([, v]) => v), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, d = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? d) / 2, f = t / 2, m = u - a, p = f - c;
|
|
1997
|
+
return `polygon(${e.points.map(([v, l]) => {
|
|
1998
|
+
const g = Math.round((v * n + m) * 100) / 100, h = Math.round((l * n + p) * 100) / 100;
|
|
1999
|
+
return `${g}px ${h}px`;
|
|
1994
2000
|
}).join(", ")})`;
|
|
1995
2001
|
}
|
|
1996
|
-
function
|
|
2002
|
+
function ke(o) {
|
|
1997
2003
|
return o in mt;
|
|
1998
2004
|
}
|
|
1999
|
-
function
|
|
2000
|
-
return o ?
|
|
2005
|
+
function He(o) {
|
|
2006
|
+
return o ? ke(o) ? mt[o] : o : mt.md;
|
|
2001
2007
|
}
|
|
2002
|
-
function
|
|
2008
|
+
function Ne(o) {
|
|
2003
2009
|
if (!o) return "";
|
|
2004
2010
|
const t = [];
|
|
2005
2011
|
if (o.grayscale !== void 0 && t.push(`grayscale(${o.grayscale})`), o.blur !== void 0 && t.push(`blur(${o.blur}px)`), o.brightness !== void 0 && t.push(`brightness(${o.brightness})`), o.contrast !== void 0 && t.push(`contrast(${o.contrast})`), o.saturate !== void 0 && t.push(`saturate(${o.saturate})`), o.opacity !== void 0 && t.push(`opacity(${o.opacity})`), o.sepia !== void 0 && t.push(`sepia(${o.sepia})`), o.hueRotate !== void 0 && t.push(`hue-rotate(${o.hueRotate}deg)`), o.invert !== void 0 && t.push(`invert(${o.invert})`), o.dropShadow !== void 0)
|
|
@@ -2025,22 +2031,22 @@ function it(o, t, i) {
|
|
|
2025
2031
|
o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : a && (e.borderTopLeftRadius = `${a}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : a && (e.borderTopRightRadius = `${a}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : a && (e.borderBottomRightRadius = `${a}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : a && (e.borderBottomLeftRadius = `${a}px`);
|
|
2026
2032
|
} else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
|
|
2027
2033
|
if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
|
|
2028
|
-
const a = o.border || {}, c = { ...a, ...o.borderTop },
|
|
2029
|
-
e.borderTop = tt(c), e.borderRight = tt(
|
|
2034
|
+
const a = o.border || {}, c = { ...a, ...o.borderTop }, d = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, f = { ...a, ...o.borderLeft };
|
|
2035
|
+
e.borderTop = tt(c), e.borderRight = tt(d), e.borderBottom = tt(u), e.borderLeft = tt(f);
|
|
2030
2036
|
} else o.border && (e.border = tt(o.border));
|
|
2031
|
-
o.shadow !== void 0 && (e.boxShadow =
|
|
2032
|
-
const r =
|
|
2037
|
+
o.shadow !== void 0 && (e.boxShadow = He(o.shadow));
|
|
2038
|
+
const r = Ne(o.filter);
|
|
2033
2039
|
if (e.filter = r || "none", o.opacity !== void 0 && (e.opacity = String(o.opacity)), o.cursor !== void 0 && (e.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
|
|
2034
|
-
const a = o.outline.width ?? 0, c = o.outline.style ?? "solid",
|
|
2035
|
-
e.outline = `${a}px ${c} ${
|
|
2040
|
+
const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", d = o.outline.color ?? "#000000";
|
|
2041
|
+
e.outline = `${a}px ${c} ${d}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
2036
2042
|
}
|
|
2037
2043
|
if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
|
|
2038
2044
|
let a;
|
|
2039
|
-
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath,
|
|
2040
|
-
if (
|
|
2041
|
-
a = Ue(
|
|
2045
|
+
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, d = c ? o.clipPath : void 0;
|
|
2046
|
+
if (d?.mode === "height-relative" && t)
|
|
2047
|
+
a = Ue(d.shape, t, i);
|
|
2042
2048
|
else {
|
|
2043
|
-
const u = c &&
|
|
2049
|
+
const u = c && d ? d.shape : o.clipPath;
|
|
2044
2050
|
a = _e(u);
|
|
2045
2051
|
}
|
|
2046
2052
|
a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
|
|
@@ -2069,13 +2075,13 @@ function pt(o, t) {
|
|
|
2069
2075
|
e.trim() && o.classList.remove(e.trim());
|
|
2070
2076
|
});
|
|
2071
2077
|
}
|
|
2072
|
-
const
|
|
2078
|
+
const Ft = {
|
|
2073
2079
|
UNFOCUSING: 999,
|
|
2074
2080
|
FOCUSING: 1e3
|
|
2075
2081
|
};
|
|
2076
2082
|
class je {
|
|
2077
2083
|
constructor(t, i, e) {
|
|
2078
|
-
this.state =
|
|
2084
|
+
this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
|
|
2079
2085
|
}
|
|
2080
2086
|
/**
|
|
2081
2087
|
* Set callback to be fired when an unfocus animation fully completes.
|
|
@@ -2093,7 +2099,7 @@ class je {
|
|
|
2093
2099
|
* Check if any animation is in progress
|
|
2094
2100
|
*/
|
|
2095
2101
|
isAnimating() {
|
|
2096
|
-
return this.state !==
|
|
2102
|
+
return this.state !== C.IDLE && this.state !== C.FOCUSED;
|
|
2097
2103
|
}
|
|
2098
2104
|
/**
|
|
2099
2105
|
* Normalize scalePercent value
|
|
@@ -2108,8 +2114,8 @@ class je {
|
|
|
2108
2114
|
calculateFocusDimensions(t, i, e) {
|
|
2109
2115
|
const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
|
|
2110
2116
|
let a = s, c = a * r;
|
|
2111
|
-
const
|
|
2112
|
-
return c >
|
|
2117
|
+
const d = e.width * n;
|
|
2118
|
+
return c > d && (c = d, a = c / r), { width: c, height: a };
|
|
2113
2119
|
}
|
|
2114
2120
|
/**
|
|
2115
2121
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
@@ -2141,11 +2147,11 @@ class je {
|
|
|
2141
2147
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
2142
2148
|
*/
|
|
2143
2149
|
animateWithDimensions(t, i, e, n, s, r, a, c) {
|
|
2144
|
-
const
|
|
2150
|
+
const d = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
|
|
2145
2151
|
return t.style.transition = "none", t.animate(
|
|
2146
2152
|
[
|
|
2147
2153
|
{
|
|
2148
|
-
transform:
|
|
2154
|
+
transform: d,
|
|
2149
2155
|
width: `${n}px`,
|
|
2150
2156
|
height: `${s}px`
|
|
2151
2157
|
},
|
|
@@ -2202,33 +2208,33 @@ class je {
|
|
|
2202
2208
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2203
2209
|
*/
|
|
2204
2210
|
startFocusAnimation(t, i, e, n, s) {
|
|
2205
|
-
const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight,
|
|
2211
|
+
const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, d = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
|
|
2206
2212
|
this.animationEngine.cancelAllAnimations(t);
|
|
2207
|
-
const
|
|
2208
|
-
this.applyFocusedStyling(t,
|
|
2209
|
-
const
|
|
2213
|
+
const f = this.config.animationDuration ?? 600;
|
|
2214
|
+
this.applyFocusedStyling(t, Ft.FOCUSING);
|
|
2215
|
+
const m = n ?? {
|
|
2210
2216
|
x: 0,
|
|
2211
2217
|
y: 0,
|
|
2212
2218
|
rotation: e.rotation,
|
|
2213
2219
|
scale: 1
|
|
2214
2220
|
// No scale - using dimensions
|
|
2215
|
-
},
|
|
2221
|
+
}, p = s?.width ?? a, w = s?.height ?? c, v = this.animateWithDimensions(
|
|
2216
2222
|
t,
|
|
2217
|
-
|
|
2223
|
+
m,
|
|
2218
2224
|
u,
|
|
2219
|
-
g,
|
|
2220
2225
|
p,
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2226
|
+
w,
|
|
2227
|
+
d.width,
|
|
2228
|
+
d.height,
|
|
2229
|
+
f
|
|
2230
|
+
), l = {
|
|
2225
2231
|
id: `focus-${Date.now()}`,
|
|
2226
2232
|
element: t,
|
|
2227
|
-
animation:
|
|
2228
|
-
fromState:
|
|
2233
|
+
animation: v,
|
|
2234
|
+
fromState: m,
|
|
2229
2235
|
toState: u,
|
|
2230
2236
|
startTime: performance.now(),
|
|
2231
|
-
duration:
|
|
2237
|
+
duration: f
|
|
2232
2238
|
};
|
|
2233
2239
|
return this.focusData = {
|
|
2234
2240
|
element: t,
|
|
@@ -2237,12 +2243,12 @@ class je {
|
|
|
2237
2243
|
originalZIndex: r,
|
|
2238
2244
|
originalWidth: a,
|
|
2239
2245
|
originalHeight: c,
|
|
2240
|
-
focusWidth:
|
|
2241
|
-
focusHeight:
|
|
2242
|
-
}, this.startClipPathAnimation(t,
|
|
2246
|
+
focusWidth: d.width,
|
|
2247
|
+
focusHeight: d.height
|
|
2248
|
+
}, this.startClipPathAnimation(t, l, !0), {
|
|
2243
2249
|
element: t,
|
|
2244
2250
|
originalState: e,
|
|
2245
|
-
animationHandle:
|
|
2251
|
+
animationHandle: l,
|
|
2246
2252
|
direction: "in",
|
|
2247
2253
|
originalWidth: a,
|
|
2248
2254
|
originalHeight: c
|
|
@@ -2254,40 +2260,40 @@ class je {
|
|
|
2254
2260
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2255
2261
|
*/
|
|
2256
2262
|
startUnfocusAnimation(t, i, e, n) {
|
|
2257
|
-
t.style.zIndex = String(
|
|
2263
|
+
t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2258
2264
|
const s = this.config.animationDuration ?? 600;
|
|
2259
2265
|
t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
|
|
2260
|
-
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight,
|
|
2266
|
+
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, d = {
|
|
2261
2267
|
x: 0,
|
|
2262
2268
|
y: 0,
|
|
2263
2269
|
rotation: i.rotation,
|
|
2264
2270
|
scale: 1
|
|
2265
2271
|
// No scale - using dimensions
|
|
2266
|
-
}, u = this.focusData?.originalWidth ?? t.offsetWidth,
|
|
2272
|
+
}, u = this.focusData?.originalWidth ?? t.offsetWidth, f = this.focusData?.originalHeight ?? t.offsetHeight, m = this.animateWithDimensions(
|
|
2267
2273
|
t,
|
|
2268
2274
|
r,
|
|
2269
|
-
|
|
2275
|
+
d,
|
|
2270
2276
|
a,
|
|
2271
2277
|
c,
|
|
2272
2278
|
u,
|
|
2273
|
-
|
|
2279
|
+
f,
|
|
2274
2280
|
s
|
|
2275
|
-
),
|
|
2281
|
+
), p = {
|
|
2276
2282
|
id: `unfocus-${Date.now()}`,
|
|
2277
2283
|
element: t,
|
|
2278
|
-
animation:
|
|
2284
|
+
animation: m,
|
|
2279
2285
|
fromState: r,
|
|
2280
|
-
toState:
|
|
2286
|
+
toState: d,
|
|
2281
2287
|
startTime: performance.now(),
|
|
2282
2288
|
duration: s
|
|
2283
2289
|
};
|
|
2284
|
-
return this.startClipPathAnimation(t,
|
|
2290
|
+
return this.startClipPathAnimation(t, p, !1), {
|
|
2285
2291
|
element: t,
|
|
2286
2292
|
originalState: i,
|
|
2287
|
-
animationHandle:
|
|
2293
|
+
animationHandle: p,
|
|
2288
2294
|
direction: "out",
|
|
2289
2295
|
originalWidth: u,
|
|
2290
|
-
originalHeight:
|
|
2296
|
+
originalHeight: f
|
|
2291
2297
|
};
|
|
2292
2298
|
}
|
|
2293
2299
|
/**
|
|
@@ -2333,26 +2339,26 @@ class je {
|
|
|
2333
2339
|
* Implements cross-animation when swapping focus
|
|
2334
2340
|
*/
|
|
2335
2341
|
async focusImage(t, i, e) {
|
|
2336
|
-
if (this.currentFocus === t && this.state ===
|
|
2342
|
+
if (this.currentFocus === t && this.state === C.FOCUSED)
|
|
2337
2343
|
return this.unfocusImage();
|
|
2338
|
-
if (this.incoming?.element === t && this.state ===
|
|
2344
|
+
if (this.incoming?.element === t && this.state === C.FOCUSING) {
|
|
2339
2345
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2340
2346
|
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2341
2347
|
t,
|
|
2342
2348
|
this.incoming.originalState,
|
|
2343
2349
|
s,
|
|
2344
2350
|
r
|
|
2345
|
-
), this.incoming = null, this.state =
|
|
2351
|
+
), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE;
|
|
2346
2352
|
return;
|
|
2347
2353
|
}
|
|
2348
2354
|
const n = ++this.focusGeneration;
|
|
2349
2355
|
switch (this.state) {
|
|
2350
|
-
case
|
|
2351
|
-
if (this.state =
|
|
2352
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2356
|
+
case C.IDLE:
|
|
2357
|
+
if (this.state = C.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2358
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2353
2359
|
break;
|
|
2354
|
-
case
|
|
2355
|
-
if (this.state =
|
|
2360
|
+
case C.FOCUSED:
|
|
2361
|
+
if (this.state = C.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2356
2362
|
this.currentFocus,
|
|
2357
2363
|
this.focusData.originalState
|
|
2358
2364
|
)), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
@@ -2364,9 +2370,9 @@ class je {
|
|
|
2364
2370
|
const s = this.outgoing.element;
|
|
2365
2371
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2366
2372
|
}
|
|
2367
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2373
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2368
2374
|
break;
|
|
2369
|
-
case
|
|
2375
|
+
case C.FOCUSING:
|
|
2370
2376
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2371
2377
|
this.incoming.element,
|
|
2372
2378
|
this.incoming.originalState,
|
|
@@ -2374,10 +2380,10 @@ class je {
|
|
|
2374
2380
|
this.focusData?.originalWidth,
|
|
2375
2381
|
this.focusData?.originalHeight
|
|
2376
2382
|
), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2377
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2383
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2378
2384
|
break;
|
|
2379
|
-
case
|
|
2380
|
-
if (this.state =
|
|
2385
|
+
case C.UNFOCUSING:
|
|
2386
|
+
if (this.state = C.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
2381
2387
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2382
2388
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2383
2389
|
]), this.focusGeneration !== n) return;
|
|
@@ -2385,9 +2391,9 @@ class je {
|
|
|
2385
2391
|
const s = this.outgoing.element;
|
|
2386
2392
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2387
2393
|
}
|
|
2388
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2394
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2389
2395
|
break;
|
|
2390
|
-
case
|
|
2396
|
+
case C.CROSS_ANIMATING:
|
|
2391
2397
|
if (this.incoming?.element === t)
|
|
2392
2398
|
return;
|
|
2393
2399
|
if (this.outgoing?.element === t) {
|
|
@@ -2410,7 +2416,7 @@ class je {
|
|
|
2410
2416
|
const a = this.outgoing.element;
|
|
2411
2417
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2412
2418
|
}
|
|
2413
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2419
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2414
2420
|
return;
|
|
2415
2421
|
}
|
|
2416
2422
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2436,7 +2442,7 @@ class je {
|
|
|
2436
2442
|
const s = this.outgoing.element;
|
|
2437
2443
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2438
2444
|
}
|
|
2439
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2445
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2440
2446
|
break;
|
|
2441
2447
|
}
|
|
2442
2448
|
}
|
|
@@ -2444,24 +2450,24 @@ class je {
|
|
|
2444
2450
|
* Unfocus current image, returning it to original position
|
|
2445
2451
|
*/
|
|
2446
2452
|
async unfocusImage() {
|
|
2447
|
-
if (this.state ===
|
|
2453
|
+
if (this.state === C.UNFOCUSING)
|
|
2448
2454
|
return;
|
|
2449
2455
|
const t = ++this.focusGeneration;
|
|
2450
2456
|
if (!this.currentFocus || !this.focusData) {
|
|
2451
|
-
if (this.incoming && this.state ===
|
|
2457
|
+
if (this.incoming && this.state === C.FOCUSING) {
|
|
2452
2458
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2453
2459
|
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2454
2460
|
this.incoming.element,
|
|
2455
2461
|
this.incoming.originalState,
|
|
2456
2462
|
s,
|
|
2457
2463
|
r
|
|
2458
|
-
), this.incoming = null, this.state =
|
|
2464
|
+
), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2459
2465
|
const a = this.outgoing.element;
|
|
2460
|
-
this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state =
|
|
2466
|
+
this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(a);
|
|
2461
2467
|
}
|
|
2462
2468
|
return;
|
|
2463
2469
|
}
|
|
2464
|
-
if (this.state ===
|
|
2470
|
+
if (this.state === C.CROSS_ANIMATING && this.incoming) {
|
|
2465
2471
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2466
2472
|
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2467
2473
|
const a = this.startUnfocusAnimation(
|
|
@@ -2476,13 +2482,13 @@ class je {
|
|
|
2476
2482
|
]), this.focusGeneration !== t) return;
|
|
2477
2483
|
let c = null;
|
|
2478
2484
|
this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2479
|
-
const
|
|
2480
|
-
this.removeFocusedStyling(
|
|
2485
|
+
const d = a.element;
|
|
2486
|
+
this.removeFocusedStyling(d, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(d);
|
|
2481
2487
|
return;
|
|
2482
2488
|
}
|
|
2483
|
-
this.state =
|
|
2489
|
+
this.state = C.UNFOCUSING;
|
|
2484
2490
|
const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2485
|
-
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state =
|
|
2491
|
+
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(i));
|
|
2486
2492
|
}
|
|
2487
2493
|
/**
|
|
2488
2494
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2500,7 +2506,7 @@ class je {
|
|
|
2500
2506
|
* Check if an image is currently focused (stable state)
|
|
2501
2507
|
*/
|
|
2502
2508
|
isFocused(t) {
|
|
2503
|
-
return this.currentFocus === t && this.state ===
|
|
2509
|
+
return this.currentFocus === t && this.state === C.FOCUSED;
|
|
2504
2510
|
}
|
|
2505
2511
|
/**
|
|
2506
2512
|
* Check if an image is the target of current focus animation
|
|
@@ -2521,7 +2527,7 @@ class je {
|
|
|
2521
2527
|
* Used during swipe gestures for visual feedback
|
|
2522
2528
|
*/
|
|
2523
2529
|
setDragOffset(t) {
|
|
2524
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2530
|
+
if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
|
|
2525
2531
|
const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
|
|
2526
2532
|
n.push(`translate(${s}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
|
|
2527
2533
|
}
|
|
@@ -2531,7 +2537,7 @@ class je {
|
|
|
2531
2537
|
* @param duration - Animation duration in ms (default 150)
|
|
2532
2538
|
*/
|
|
2533
2539
|
clearDragOffset(t, i = 150) {
|
|
2534
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2540
|
+
if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
|
|
2535
2541
|
const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
|
|
2536
2542
|
s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
|
|
2537
2543
|
const c = s.join(" ");
|
|
@@ -2561,10 +2567,10 @@ class je {
|
|
|
2561
2567
|
this.focusData.originalZIndex,
|
|
2562
2568
|
this.focusData.originalWidth,
|
|
2563
2569
|
this.focusData.originalHeight
|
|
2564
|
-
), this.state =
|
|
2570
|
+
), this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2565
2571
|
}
|
|
2566
2572
|
}
|
|
2567
|
-
const We = 50, Ge = 0.5, qe = 20,
|
|
2573
|
+
const We = 50, Ge = 0.5, qe = 20, Ye = 0.3, Xe = 150, Ve = 30, rt = class rt {
|
|
2568
2574
|
constructor(t, i) {
|
|
2569
2575
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = i, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2570
2576
|
}
|
|
@@ -2611,11 +2617,11 @@ const We = 50, Ge = 0.5, qe = 20, Xe = 0.3, Ye = 150, Je = 30, rt = class rt {
|
|
|
2611
2617
|
const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
|
|
2612
2618
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
|
|
2613
2619
|
const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
|
|
2614
|
-
this.touchState.isHorizontalSwipe = a <=
|
|
2620
|
+
this.touchState.isHorizontalSwipe = a <= Ve;
|
|
2615
2621
|
}
|
|
2616
2622
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2617
2623
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
|
|
2618
|
-
const s = e *
|
|
2624
|
+
const s = e * Ye;
|
|
2619
2625
|
this.callbacks.onDragOffset(s);
|
|
2620
2626
|
}
|
|
2621
2627
|
}
|
|
@@ -2632,7 +2638,7 @@ const We = 50, Ge = 0.5, qe = 20, Xe = 0.3, Ye = 150, Je = 30, rt = class rt {
|
|
|
2632
2638
|
};
|
|
2633
2639
|
rt.TOUCH_CLICK_DELAY = 300;
|
|
2634
2640
|
let bt = rt;
|
|
2635
|
-
class
|
|
2641
|
+
class Je {
|
|
2636
2642
|
constructor(t) {
|
|
2637
2643
|
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)
|
|
2638
2644
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2727,10 +2733,10 @@ class Ve {
|
|
|
2727
2733
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2728
2734
|
if (!a.ok)
|
|
2729
2735
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2730
|
-
const
|
|
2736
|
+
const d = (await a.json()).files.filter(
|
|
2731
2737
|
(u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
|
|
2732
2738
|
);
|
|
2733
|
-
return this.log(`Found ${
|
|
2739
|
+
return this.log(`Found ${d.length} images in folder ${t} (non-recursive)`), d.forEach((u) => {
|
|
2734
2740
|
e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2735
2741
|
}), e;
|
|
2736
2742
|
}
|
|
@@ -2797,18 +2803,18 @@ class Ve {
|
|
|
2797
2803
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2798
2804
|
if (!a.ok)
|
|
2799
2805
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2800
|
-
const c = await a.json(),
|
|
2801
|
-
(
|
|
2806
|
+
const c = await a.json(), d = c.files.filter(
|
|
2807
|
+
(f) => f.mimeType.startsWith("image/") && i.isAllowed(f.name)
|
|
2802
2808
|
), u = c.files.filter(
|
|
2803
|
-
(
|
|
2809
|
+
(f) => f.mimeType === "application/vnd.google-apps.folder"
|
|
2804
2810
|
);
|
|
2805
|
-
this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((
|
|
2806
|
-
e.push(`https://lh3.googleusercontent.com/d/${
|
|
2811
|
+
this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((f) => this.log(` - File: ${f.name} (${f.mimeType})`)), this.log(`- ${d.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), d.forEach((f) => {
|
|
2812
|
+
e.push(`https://lh3.googleusercontent.com/d/${f.id}=s1600`), this.log(`Added file: ${f.name}`);
|
|
2807
2813
|
});
|
|
2808
|
-
for (const
|
|
2809
|
-
this.log(`Loading images from subfolder: ${
|
|
2810
|
-
const
|
|
2811
|
-
e.push(...
|
|
2814
|
+
for (const f of u) {
|
|
2815
|
+
this.log(`Loading images from subfolder: ${f.name}`);
|
|
2816
|
+
const m = await this.loadImagesRecursively(f.id, i);
|
|
2817
|
+
e.push(...m);
|
|
2812
2818
|
}
|
|
2813
2819
|
return e;
|
|
2814
2820
|
}
|
|
@@ -3217,11 +3223,11 @@ function ei() {
|
|
|
3217
3223
|
}
|
|
3218
3224
|
let ii = class {
|
|
3219
3225
|
constructor(t = {}) {
|
|
3220
|
-
this.fullConfig = ee(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new se(this.fullConfig.animation), this.layoutEngine = new $e({
|
|
3226
|
+
this.fullConfig = ee(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.callbacks = t.on ?? {}, this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new se(this.fullConfig.animation), this.layoutEngine = new $e({
|
|
3221
3227
|
layout: this.fullConfig.layout,
|
|
3222
3228
|
image: this.fullConfig.image
|
|
3223
3229
|
}), this.zoomEngine = new je(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3224
|
-
const i = this.fullConfig.animation.entry ||
|
|
3230
|
+
const i = this.fullConfig.animation.entry || L.animation.entry;
|
|
3225
3231
|
this.entryAnimationEngine = new pe(
|
|
3226
3232
|
i,
|
|
3227
3233
|
this.fullConfig.layout.algorithm
|
|
@@ -3232,13 +3238,22 @@ let ii = class {
|
|
|
3232
3238
|
i.timing?.duration ?? 600
|
|
3233
3239
|
) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
|
|
3234
3240
|
this.idleAnimationEngine?.resumeForImage(n);
|
|
3235
|
-
const s = n;
|
|
3241
|
+
const s = n, r = this.imageElements.indexOf(s);
|
|
3242
|
+
if (this.callbacks.onImageUnfocus && r !== -1) {
|
|
3243
|
+
const a = this.imageLoader.imageURLs(), c = {
|
|
3244
|
+
element: s,
|
|
3245
|
+
index: r,
|
|
3246
|
+
url: a[r] ?? "",
|
|
3247
|
+
layout: this.imageLayouts[r]
|
|
3248
|
+
};
|
|
3249
|
+
this.callbacks.onImageUnfocus(c);
|
|
3250
|
+
}
|
|
3236
3251
|
requestAnimationFrame(() => {
|
|
3237
3252
|
if (s.matches(":hover") && this.fullConfig.styling?.hover) {
|
|
3238
|
-
const
|
|
3239
|
-
if (
|
|
3240
|
-
const
|
|
3241
|
-
st(s, this.fullConfig.styling.hover,
|
|
3253
|
+
const a = this.imageElements.indexOf(s);
|
|
3254
|
+
if (a !== -1) {
|
|
3255
|
+
const c = s.offsetHeight, d = s.cachedRenderedWidth;
|
|
3256
|
+
st(s, this.fullConfig.styling.hover, c, d), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[a] };
|
|
3242
3257
|
}
|
|
3243
3258
|
}
|
|
3244
3259
|
});
|
|
@@ -3285,7 +3300,7 @@ let ii = class {
|
|
|
3285
3300
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3286
3301
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3287
3302
|
};
|
|
3288
|
-
return new
|
|
3303
|
+
return new Je(n);
|
|
3289
3304
|
} else
|
|
3290
3305
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
3291
3306
|
}
|
|
@@ -3303,7 +3318,7 @@ let ii = class {
|
|
|
3303
3318
|
onPrev: () => this.navigateToPreviousImage(),
|
|
3304
3319
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
3305
3320
|
onDragEnd: (t) => {
|
|
3306
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
3321
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Xe);
|
|
3307
3322
|
}
|
|
3308
3323
|
})), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3309
3324
|
} catch (t) {
|
|
@@ -3434,61 +3449,134 @@ let ii = class {
|
|
|
3434
3449
|
const e = this.getContainerBounds();
|
|
3435
3450
|
this.currentImageHeight = i;
|
|
3436
3451
|
const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
|
|
3437
|
-
this.imageLayouts = s, this.
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3452
|
+
if (this.imageLayouts = s, this.callbacks.onLayoutComplete) {
|
|
3453
|
+
const l = {
|
|
3454
|
+
layouts: [...s],
|
|
3455
|
+
// shallow copy — caller should not mutate
|
|
3456
|
+
containerBounds: { ...e },
|
|
3457
|
+
algorithm: this.fullConfig.layout.algorithm,
|
|
3458
|
+
imageCount: t.length
|
|
3459
|
+
};
|
|
3460
|
+
this.callbacks.onLayoutComplete(l);
|
|
3461
|
+
}
|
|
3462
|
+
this.displayQueue = [];
|
|
3463
|
+
let r = 0, a = 0, c = 0, d = 0, u = !1;
|
|
3464
|
+
const f = /* @__PURE__ */ new Map(), m = () => {
|
|
3465
|
+
if (u || n !== this.loadGeneration || !this.callbacks.onGalleryReady) return;
|
|
3466
|
+
u = !0;
|
|
3467
|
+
const l = {
|
|
3468
|
+
totalImages: t.length,
|
|
3469
|
+
failedImages: c,
|
|
3470
|
+
loadDuration: d > 0 ? performance.now() - d : 0
|
|
3471
|
+
};
|
|
3472
|
+
this.callbacks.onGalleryReady(l);
|
|
3473
|
+
}, p = () => {
|
|
3474
|
+
r >= t.length && this.displayQueue.length === 0 && m();
|
|
3475
|
+
}, w = (l) => {
|
|
3476
|
+
this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(async () => {
|
|
3477
|
+
l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1";
|
|
3478
|
+
const g = parseInt(l.dataset.imageId || "0"), h = this.imageLayouts[g], b = this.entryAnimationEngine.getTiming(), I = performance.now(), y = parseFloat(l.dataset.startX || "0"), x = parseFloat(l.dataset.startY || "0"), E = parseFloat(l.dataset.endX || "0"), F = parseFloat(l.dataset.endY || "0"), R = parseFloat(l.dataset.rotation || "0"), M = parseFloat(l.dataset.scale || "1"), T = parseFloat(l.dataset.startRotation || l.dataset.rotation || "0"), z = parseFloat(l.dataset.startScale || l.dataset.scale || "1"), k = parseFloat(l.dataset.imageWidth || "0"), D = parseFloat(l.dataset.imageHeight || "0");
|
|
3479
|
+
if (this.callbacks.onEntryStart && h) {
|
|
3480
|
+
const S = {
|
|
3481
|
+
element: l,
|
|
3482
|
+
index: g,
|
|
3483
|
+
totalImages: this.imageLayouts.length,
|
|
3484
|
+
layout: h,
|
|
3485
|
+
from: { x: y, y: x, rotation: T, scale: z },
|
|
3486
|
+
to: { x: E, y: F, rotation: R, scale: M },
|
|
3487
|
+
startTime: I,
|
|
3488
|
+
duration: b.duration
|
|
3489
|
+
};
|
|
3490
|
+
this.callbacks.onEntryStart(S);
|
|
3491
|
+
}
|
|
3492
|
+
if (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)
|
|
3449
3493
|
fe({
|
|
3450
3494
|
element: l,
|
|
3451
|
-
startPosition:
|
|
3452
|
-
endPosition:
|
|
3495
|
+
startPosition: { x: y, y: x },
|
|
3496
|
+
endPosition: { x: E, y: F },
|
|
3453
3497
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3454
|
-
duration:
|
|
3455
|
-
imageWidth:
|
|
3456
|
-
imageHeight:
|
|
3457
|
-
rotation:
|
|
3458
|
-
scale:
|
|
3498
|
+
duration: b.duration,
|
|
3499
|
+
imageWidth: k,
|
|
3500
|
+
imageHeight: D,
|
|
3501
|
+
rotation: R,
|
|
3502
|
+
scale: M,
|
|
3459
3503
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3460
|
-
startRotation:
|
|
3504
|
+
startRotation: T,
|
|
3461
3505
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3462
|
-
startScale:
|
|
3506
|
+
startScale: z,
|
|
3507
|
+
onProgress: this.callbacks.onEntryProgress && h ? (S, _, $) => {
|
|
3508
|
+
const A = {
|
|
3509
|
+
element: l,
|
|
3510
|
+
index: g,
|
|
3511
|
+
totalImages: this.imageLayouts.length,
|
|
3512
|
+
layout: h,
|
|
3513
|
+
from: { x: y, y: x, rotation: T, scale: z },
|
|
3514
|
+
to: { x: E, y: F, rotation: R, scale: M },
|
|
3515
|
+
startTime: I,
|
|
3516
|
+
duration: b.duration,
|
|
3517
|
+
progress: S,
|
|
3518
|
+
rawProgress: S,
|
|
3519
|
+
elapsed: _,
|
|
3520
|
+
current: $
|
|
3521
|
+
};
|
|
3522
|
+
this.callbacks.onEntryProgress(A);
|
|
3523
|
+
} : void 0,
|
|
3524
|
+
onComplete: h ? () => {
|
|
3525
|
+
if (this.callbacks.onEntryComplete) {
|
|
3526
|
+
const S = {
|
|
3527
|
+
element: l,
|
|
3528
|
+
index: g,
|
|
3529
|
+
layout: h,
|
|
3530
|
+
startTime: I,
|
|
3531
|
+
endTime: performance.now(),
|
|
3532
|
+
duration: b.duration
|
|
3533
|
+
};
|
|
3534
|
+
this.callbacks.onEntryComplete(S);
|
|
3535
|
+
}
|
|
3536
|
+
} : void 0
|
|
3463
3537
|
});
|
|
3464
|
-
|
|
3465
|
-
const
|
|
3466
|
-
l.style.transform =
|
|
3538
|
+
else {
|
|
3539
|
+
const S = l.dataset.finalTransform || "";
|
|
3540
|
+
if (l.style.transform = S, this.callbacks.onEntryComplete && h) {
|
|
3541
|
+
const _ = ($) => {
|
|
3542
|
+
if ($.propertyName !== "transform") return;
|
|
3543
|
+
l.removeEventListener("transitionend", _);
|
|
3544
|
+
const A = {
|
|
3545
|
+
element: l,
|
|
3546
|
+
index: g,
|
|
3547
|
+
layout: h,
|
|
3548
|
+
startTime: I,
|
|
3549
|
+
endTime: performance.now(),
|
|
3550
|
+
duration: b.duration
|
|
3551
|
+
};
|
|
3552
|
+
this.callbacks.onEntryComplete(A);
|
|
3553
|
+
};
|
|
3554
|
+
l.addEventListener("transitionend", _);
|
|
3555
|
+
}
|
|
3467
3556
|
}
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
console.log(`Image ${h} final state:`, {
|
|
3557
|
+
if (this.fullConfig.config.debug?.enabled && g < 3) {
|
|
3558
|
+
const S = l.dataset.finalTransform || "";
|
|
3559
|
+
console.log(`Image ${g} final state:`, {
|
|
3472
3560
|
left: l.style.left,
|
|
3473
3561
|
top: l.style.top,
|
|
3474
3562
|
width: l.style.width,
|
|
3475
3563
|
height: l.style.height,
|
|
3476
3564
|
computedWidth: l.offsetWidth,
|
|
3477
3565
|
computedHeight: l.offsetHeight,
|
|
3478
|
-
transform:
|
|
3566
|
+
transform: S,
|
|
3479
3567
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3480
3568
|
});
|
|
3481
3569
|
}
|
|
3482
3570
|
if (this.idleAnimationEngine) {
|
|
3483
|
-
const
|
|
3484
|
-
this.idleAnimationEngine.register(l,
|
|
3571
|
+
const S = this.entryAnimationEngine.getTiming().duration;
|
|
3572
|
+
this.idleAnimationEngine.register(l, g, this.imageElements.length, S);
|
|
3485
3573
|
}
|
|
3486
|
-
}), r
|
|
3487
|
-
},
|
|
3574
|
+
}), r++, p());
|
|
3575
|
+
}, v = () => {
|
|
3488
3576
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3489
3577
|
for (; this.displayQueue.length > 0; ) {
|
|
3490
3578
|
const l = this.displayQueue.shift();
|
|
3491
|
-
l &&
|
|
3579
|
+
l && w(l);
|
|
3492
3580
|
}
|
|
3493
3581
|
return;
|
|
3494
3582
|
}
|
|
@@ -3499,77 +3587,144 @@ let ii = class {
|
|
|
3499
3587
|
}
|
|
3500
3588
|
if (this.displayQueue.length > 0) {
|
|
3501
3589
|
const l = this.displayQueue.shift();
|
|
3502
|
-
l &&
|
|
3590
|
+
l && w(l);
|
|
3503
3591
|
}
|
|
3504
|
-
r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3592
|
+
r >= t.length && this.displayQueue.length === 0 && (this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), m());
|
|
3505
3593
|
}, this.fullConfig.animation.queue.interval);
|
|
3506
3594
|
};
|
|
3507
3595
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3508
|
-
const l = new IntersectionObserver((
|
|
3509
|
-
|
|
3510
|
-
h.isIntersecting && (
|
|
3596
|
+
const l = new IntersectionObserver((g) => {
|
|
3597
|
+
g.forEach((h) => {
|
|
3598
|
+
h.isIntersecting && (v(), l.disconnect());
|
|
3511
3599
|
});
|
|
3512
3600
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3513
3601
|
l.observe(this.containerEl);
|
|
3514
3602
|
} else
|
|
3515
|
-
|
|
3516
|
-
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l,
|
|
3603
|
+
v();
|
|
3604
|
+
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, g) => {
|
|
3517
3605
|
const h = document.createElement("div");
|
|
3518
3606
|
h.className = "fbn-ic-debug-center", h.style.position = "absolute", h.style.width = "12px", h.style.height = "12px", h.style.borderRadius = "50%", h.style.backgroundColor = "red", h.style.border = "2px solid yellow", h.style.zIndex = "9999", h.style.pointerEvents = "none";
|
|
3519
|
-
const
|
|
3520
|
-
h.style.left = `${
|
|
3521
|
-
})), t.forEach((l,
|
|
3607
|
+
const b = l.x, I = l.y;
|
|
3608
|
+
h.style.left = `${b - 6}px`, h.style.top = `${I - 6}px`, h.title = `Image ${g}: center (${Math.round(b)}, ${Math.round(I)})`, this.containerEl.appendChild(h);
|
|
3609
|
+
})), t.forEach((l, g) => {
|
|
3522
3610
|
const h = document.createElement("img");
|
|
3523
|
-
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(
|
|
3524
|
-
const
|
|
3525
|
-
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${
|
|
3526
|
-
if (this.hoveredImage = { element: h, layout:
|
|
3527
|
-
const
|
|
3528
|
-
st(h, this.fullConfig.styling?.hover, i,
|
|
3611
|
+
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(g), h.dataset.createdFlag = "true";
|
|
3612
|
+
const b = s[g];
|
|
3613
|
+
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${b.x}px`, h.style.top = `${b.y}px`, b.zIndex && (h.style.zIndex = String(b.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
|
|
3614
|
+
if (this.hoveredImage = { element: h, layout: b }, !this.zoomEngine.isInvolved(h)) {
|
|
3615
|
+
const y = h.cachedRenderedWidth;
|
|
3616
|
+
st(h, this.fullConfig.styling?.hover, i, y), et(h, this.hoverClassName);
|
|
3617
|
+
}
|
|
3618
|
+
if (this.callbacks.onImageHover) {
|
|
3619
|
+
const y = { element: h, index: g, url: l, layout: b };
|
|
3620
|
+
this.callbacks.onImageHover(y);
|
|
3529
3621
|
}
|
|
3530
3622
|
}), h.addEventListener("mouseleave", () => {
|
|
3531
3623
|
if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
|
|
3532
|
-
const
|
|
3533
|
-
st(h, this.fullConfig.styling?.default, i,
|
|
3624
|
+
const y = h.cachedRenderedWidth;
|
|
3625
|
+
st(h, this.fullConfig.styling?.default, i, y), pt(h, this.hoverClassName), et(h, this.defaultClassName);
|
|
3534
3626
|
}
|
|
3535
|
-
|
|
3536
|
-
|
|
3627
|
+
if (this.callbacks.onImageUnhover) {
|
|
3628
|
+
const y = { element: h, index: g, url: l, layout: b };
|
|
3629
|
+
this.callbacks.onImageUnhover(y);
|
|
3630
|
+
}
|
|
3631
|
+
}), h.addEventListener("click", (y) => {
|
|
3632
|
+
y.stopPropagation(), this.handleImageClick(h, b);
|
|
3537
3633
|
}), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
|
|
3538
3634
|
if (n !== this.loadGeneration)
|
|
3539
3635
|
return;
|
|
3540
|
-
const
|
|
3541
|
-
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${
|
|
3542
|
-
const
|
|
3543
|
-
|
|
3544
|
-
|
|
3636
|
+
const y = h.naturalWidth / h.naturalHeight, x = i * y;
|
|
3637
|
+
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${g}] Called with imageHeight=${i}, renderedWidth=${x}`), h.style.width = `${x}px`, h.cachedRenderedWidth = x, h.aspectRatio = y, st(h, this.fullConfig.styling?.default, i, x);
|
|
3638
|
+
const E = { x: b.x, y: b.y }, F = { width: x, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
|
|
3639
|
+
E,
|
|
3640
|
+
F,
|
|
3545
3641
|
e,
|
|
3546
|
-
|
|
3642
|
+
g,
|
|
3547
3643
|
t.length
|
|
3548
|
-
),
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3644
|
+
), M = this.entryAnimationEngine.calculateStartRotation(b.rotation), T = this.entryAnimationEngine.calculateStartScale(b.scale), z = this.entryAnimationEngine.buildFinalTransform(
|
|
3645
|
+
b.rotation,
|
|
3646
|
+
b.scale,
|
|
3647
|
+
x,
|
|
3552
3648
|
i
|
|
3553
|
-
),
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3649
|
+
), k = this.entryAnimationEngine.buildStartTransform(
|
|
3650
|
+
R,
|
|
3651
|
+
E,
|
|
3652
|
+
b.rotation,
|
|
3653
|
+
b.scale,
|
|
3654
|
+
x,
|
|
3559
3655
|
i,
|
|
3560
|
-
|
|
3561
|
-
|
|
3656
|
+
M,
|
|
3657
|
+
T
|
|
3562
3658
|
);
|
|
3563
|
-
this.fullConfig.config.debug?.enabled &&
|
|
3564
|
-
finalPosition:
|
|
3565
|
-
imageSize:
|
|
3566
|
-
left:
|
|
3567
|
-
top:
|
|
3568
|
-
finalTransform:
|
|
3569
|
-
renderedWidth:
|
|
3659
|
+
if (this.fullConfig.config.debug?.enabled && g < 3 && console.log(`Image ${g}:`, {
|
|
3660
|
+
finalPosition: E,
|
|
3661
|
+
imageSize: F,
|
|
3662
|
+
left: b.x,
|
|
3663
|
+
top: b.y,
|
|
3664
|
+
finalTransform: z,
|
|
3665
|
+
renderedWidth: x,
|
|
3570
3666
|
renderedHeight: i
|
|
3571
|
-
}), h.style.transform =
|
|
3572
|
-
|
|
3667
|
+
}), h.style.transform = k, h.dataset.finalTransform = z, h.dataset.startX = String(R.x), h.dataset.startY = String(R.y), h.dataset.endX = String(E.x), h.dataset.endY = String(E.y), h.dataset.imageWidth = String(x), h.dataset.imageHeight = String(i), h.dataset.rotation = String(b.rotation), h.dataset.scale = String(b.scale), h.dataset.startRotation = String(M), h.dataset.startScale = String(T), a++, this.callbacks.onImageLoaded) {
|
|
3668
|
+
const D = {
|
|
3669
|
+
element: h,
|
|
3670
|
+
url: l,
|
|
3671
|
+
index: g,
|
|
3672
|
+
totalImages: t.length,
|
|
3673
|
+
loadTime: performance.now() - (f.get(g) ?? performance.now())
|
|
3674
|
+
};
|
|
3675
|
+
this.callbacks.onImageLoaded(D);
|
|
3676
|
+
}
|
|
3677
|
+
if (this.callbacks.onLoadProgress) {
|
|
3678
|
+
const D = {
|
|
3679
|
+
loaded: a,
|
|
3680
|
+
failed: c,
|
|
3681
|
+
total: t.length,
|
|
3682
|
+
percent: (a + c) / t.length * 100
|
|
3683
|
+
};
|
|
3684
|
+
this.callbacks.onLoadProgress(D);
|
|
3685
|
+
}
|
|
3686
|
+
this.displayQueue.push(h);
|
|
3687
|
+
};
|
|
3688
|
+
const I = () => {
|
|
3689
|
+
if (n === this.loadGeneration) {
|
|
3690
|
+
if (c++, this.callbacks.onImageError) {
|
|
3691
|
+
const y = { url: l, index: g, totalImages: t.length };
|
|
3692
|
+
this.callbacks.onImageError(y);
|
|
3693
|
+
}
|
|
3694
|
+
if (this.callbacks.onLoadProgress) {
|
|
3695
|
+
const y = {
|
|
3696
|
+
loaded: a,
|
|
3697
|
+
failed: c,
|
|
3698
|
+
total: t.length,
|
|
3699
|
+
percent: (a + c) / t.length * 100
|
|
3700
|
+
};
|
|
3701
|
+
this.callbacks.onLoadProgress(y);
|
|
3702
|
+
}
|
|
3703
|
+
r++, p();
|
|
3704
|
+
}
|
|
3705
|
+
};
|
|
3706
|
+
h.onerror = () => I(), (async () => {
|
|
3707
|
+
let y = l;
|
|
3708
|
+
if (this.callbacks.onBeforeImageLoad) {
|
|
3709
|
+
const x = { url: l, index: g, totalImages: t.length }, E = await this.callbacks.onBeforeImageLoad(x);
|
|
3710
|
+
if (E)
|
|
3711
|
+
if (E.fetch !== void 0) {
|
|
3712
|
+
const F = E.url ?? l;
|
|
3713
|
+
try {
|
|
3714
|
+
const M = await (await fetch(F, E.fetch)).blob(), T = URL.createObjectURL(M);
|
|
3715
|
+
y = T;
|
|
3716
|
+
const z = h.onload;
|
|
3717
|
+
h.onload = (k) => {
|
|
3718
|
+
URL.revokeObjectURL(T), z?.call(h, k);
|
|
3719
|
+
};
|
|
3720
|
+
} catch {
|
|
3721
|
+
I();
|
|
3722
|
+
return;
|
|
3723
|
+
}
|
|
3724
|
+
} else E.url && (y = E.url);
|
|
3725
|
+
}
|
|
3726
|
+
d === 0 && (d = performance.now()), f.set(g, performance.now()), h.src = y;
|
|
3727
|
+
})();
|
|
3573
3728
|
});
|
|
3574
3729
|
}
|
|
3575
3730
|
async handleImageClick(t, i) {
|
|
@@ -3583,7 +3738,15 @@ let ii = class {
|
|
|
3583
3738
|
else {
|
|
3584
3739
|
this.idleAnimationEngine?.pauseForImage(t);
|
|
3585
3740
|
const s = t.dataset.imageId;
|
|
3586
|
-
this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator()
|
|
3741
|
+
if (this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator(), this.callbacks.onImageFocus && this.currentFocusIndex !== null) {
|
|
3742
|
+
const r = this.imageLoader.imageURLs(), a = {
|
|
3743
|
+
element: t,
|
|
3744
|
+
index: this.currentFocusIndex,
|
|
3745
|
+
url: r[this.currentFocusIndex] ?? "",
|
|
3746
|
+
layout: i
|
|
3747
|
+
};
|
|
3748
|
+
this.callbacks.onImageFocus(a);
|
|
3749
|
+
}
|
|
3587
3750
|
}
|
|
3588
3751
|
}
|
|
3589
3752
|
/**
|
|
@@ -3626,10 +3789,10 @@ let ii = class {
|
|
|
3626
3789
|
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.prevButtonElAutoCreated && this.prevButtonEl && (this.prevButtonEl.remove(), this.prevButtonEl = null), this.nextButtonElAutoCreated && this.nextButtonEl && (this.nextButtonEl.remove(), this.nextButtonEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
|
|
3627
3790
|
}
|
|
3628
3791
|
};
|
|
3629
|
-
const ai =
|
|
3792
|
+
const ai = Ht(
|
|
3630
3793
|
function({ className: t, style: i, ...e }, n) {
|
|
3631
|
-
const s =
|
|
3632
|
-
return
|
|
3794
|
+
const s = St(null), r = St(null);
|
|
3795
|
+
return Nt(n, () => ({
|
|
3633
3796
|
get instance() {
|
|
3634
3797
|
return r.current;
|
|
3635
3798
|
}
|
|
@@ -3644,7 +3807,7 @@ const ai = Nt(
|
|
|
3644
3807
|
}), () => {
|
|
3645
3808
|
a.destroy(), r.current = null;
|
|
3646
3809
|
};
|
|
3647
|
-
}, [JSON.stringify(e)]), /* @__PURE__ */
|
|
3810
|
+
}, [JSON.stringify(e)]), /* @__PURE__ */ kt("div", { ref: s, className: t, style: i });
|
|
3648
3811
|
}
|
|
3649
3812
|
);
|
|
3650
3813
|
export {
|