@frybynite/image-cloud 0.9.1 → 0.9.3
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 +639 -678
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +679 -717
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +3 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +16 -31
- package/dist/react.d.ts +16 -31
- package/dist/react.js +572 -611
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +16 -31
- package/dist/vue.js +682 -721
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +16 -31
- package/dist/web-component.js +389 -428
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
package/dist/web-component.js
CHANGED
|
@@ -4,11 +4,11 @@ const mt = Object.freeze({
|
|
|
4
4
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
5
5
|
lg: "0 8px 32px rgba(0,0,0,0.5)",
|
|
6
6
|
glow: "0 0 30px rgba(255,255,255,0.6)"
|
|
7
|
-
}),
|
|
7
|
+
}), At = Object.freeze({
|
|
8
8
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
9
9
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
10
10
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
11
|
-
}),
|
|
11
|
+
}), Tt = Object.freeze({
|
|
12
12
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
13
13
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
14
14
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
@@ -50,9 +50,9 @@ const mt = Object.freeze({
|
|
|
50
50
|
focused: Object.freeze({
|
|
51
51
|
shadow: "none"
|
|
52
52
|
})
|
|
53
|
-
}), kt = Object.freeze({
|
|
54
|
-
tightness: 1
|
|
55
53
|
}), Nt = Object.freeze({
|
|
54
|
+
tightness: 1
|
|
55
|
+
}), kt = Object.freeze({
|
|
56
56
|
rows: 1,
|
|
57
57
|
amplitude: 100,
|
|
58
58
|
frequency: 2,
|
|
@@ -85,22 +85,22 @@ const mt = Object.freeze({
|
|
|
85
85
|
}), zt = Object.freeze({
|
|
86
86
|
sizing: Gt,
|
|
87
87
|
rotation: qt
|
|
88
|
-
}),
|
|
88
|
+
}), _t = Object.freeze({
|
|
89
89
|
validateUrls: !0,
|
|
90
90
|
validationTimeout: 5e3,
|
|
91
91
|
validationMethod: "head",
|
|
92
92
|
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
|
|
93
|
-
}),
|
|
93
|
+
}), Dt = Object.freeze({
|
|
94
94
|
enabled: !1,
|
|
95
95
|
centers: !1,
|
|
96
96
|
loaders: !1
|
|
97
|
-
}), Bt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Xt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Yt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Jt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }),
|
|
97
|
+
}), Bt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Xt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Yt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Jt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), R = Object.freeze({
|
|
98
98
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
99
99
|
loaders: [],
|
|
100
100
|
// Shared loader settings and debug config
|
|
101
101
|
config: Object.freeze({
|
|
102
|
-
loaders:
|
|
103
|
-
debug:
|
|
102
|
+
loaders: _t,
|
|
103
|
+
debug: Dt
|
|
104
104
|
}),
|
|
105
105
|
// Image sizing and rotation configuration
|
|
106
106
|
image: zt,
|
|
@@ -115,10 +115,8 @@ const mt = Object.freeze({
|
|
|
115
115
|
densityFactor: 1,
|
|
116
116
|
// Default density
|
|
117
117
|
spacing: Object.freeze({
|
|
118
|
-
padding: 50
|
|
118
|
+
padding: 50
|
|
119
119
|
// padding from viewport edges
|
|
120
|
-
minGap: 20
|
|
121
|
-
// minimum spacing between images
|
|
122
120
|
})
|
|
123
121
|
}),
|
|
124
122
|
// Pattern-based animation configuration
|
|
@@ -139,12 +137,6 @@ const mt = Object.freeze({
|
|
|
139
137
|
interval: 150
|
|
140
138
|
// ms between processing queue items (when enabled)
|
|
141
139
|
}),
|
|
142
|
-
performance: Object.freeze({
|
|
143
|
-
useGPU: void 0,
|
|
144
|
-
// STUB: Not implemented yet
|
|
145
|
-
reduceMotion: void 0
|
|
146
|
-
// STUB: Not implemented yet
|
|
147
|
-
}),
|
|
148
140
|
entry: Object.freeze({
|
|
149
141
|
start: Object.freeze({
|
|
150
142
|
position: "nearest-edge",
|
|
@@ -179,37 +171,17 @@ const mt = Object.freeze({
|
|
|
179
171
|
// Use default animation duration
|
|
180
172
|
}),
|
|
181
173
|
navigation: Object.freeze({
|
|
182
|
-
keyboard:
|
|
183
|
-
|
|
184
|
-
swipe: void 0,
|
|
185
|
-
// STUB: Not implemented yet
|
|
174
|
+
keyboard: !0,
|
|
175
|
+
swipe: !0,
|
|
186
176
|
mouseWheel: void 0
|
|
187
177
|
// STUB: Not implemented yet
|
|
188
178
|
}),
|
|
189
|
-
|
|
190
|
-
pinchToZoom: void 0,
|
|
191
|
-
// STUB: Not implemented yet
|
|
192
|
-
doubleTapToFocus: void 0
|
|
193
|
-
// STUB: Not implemented yet
|
|
194
|
-
}),
|
|
195
|
-
disableDragging: !1
|
|
179
|
+
dragging: !0
|
|
196
180
|
}),
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
mobile: 768,
|
|
202
|
-
tablet: void 0,
|
|
203
|
-
// STUB: Not implemented yet
|
|
204
|
-
desktop: void 0
|
|
205
|
-
// STUB: Not implemented yet
|
|
206
|
-
}),
|
|
207
|
-
mobileDetection: () => typeof window > "u" ? !1 : window.innerWidth <= 768
|
|
208
|
-
}),
|
|
209
|
-
ui: Object.freeze({
|
|
210
|
-
showLoadingSpinner: !1,
|
|
211
|
-
showImageCounter: !1
|
|
212
|
-
})
|
|
181
|
+
// UI configuration
|
|
182
|
+
ui: Object.freeze({
|
|
183
|
+
showLoadingSpinner: !1,
|
|
184
|
+
showImageCounter: !1
|
|
213
185
|
}),
|
|
214
186
|
// Image styling
|
|
215
187
|
styling: Ot
|
|
@@ -294,81 +266,70 @@ function te(o = {}) {
|
|
|
294
266
|
});
|
|
295
267
|
const r = {
|
|
296
268
|
loaders: {
|
|
297
|
-
...
|
|
269
|
+
..._t,
|
|
298
270
|
...o.config?.loaders ?? {}
|
|
299
271
|
}
|
|
300
272
|
}, s = {
|
|
301
273
|
loaders: n,
|
|
302
274
|
config: r,
|
|
303
275
|
image: Kt(zt, e),
|
|
304
|
-
layout: { ...
|
|
305
|
-
animation: { ...
|
|
306
|
-
interaction: { ...
|
|
307
|
-
|
|
276
|
+
layout: { ...R.layout },
|
|
277
|
+
animation: { ...R.animation },
|
|
278
|
+
interaction: { ...R.interaction },
|
|
279
|
+
ui: { ...R.ui },
|
|
308
280
|
styling: Vt(Ot, o.styling)
|
|
309
281
|
};
|
|
310
|
-
|
|
311
|
-
...
|
|
282
|
+
o.layout && (s.layout = {
|
|
283
|
+
...R.layout,
|
|
312
284
|
...o.layout
|
|
313
285
|
}, o.layout.responsive && (s.layout.responsive = {
|
|
314
|
-
...
|
|
315
|
-
mobile: o.layout.responsive.mobile ? { ...
|
|
316
|
-
tablet: o.layout.responsive.tablet ? { ...
|
|
286
|
+
...R.layout.responsive,
|
|
287
|
+
mobile: o.layout.responsive.mobile ? { ...R.layout.responsive.mobile, ...o.layout.responsive.mobile } : R.layout.responsive.mobile,
|
|
288
|
+
tablet: o.layout.responsive.tablet ? { ...R.layout.responsive.tablet, ...o.layout.responsive.tablet } : R.layout.responsive.tablet
|
|
317
289
|
}), o.layout.spacing && (s.layout.spacing = {
|
|
318
|
-
...
|
|
290
|
+
...R.layout.spacing,
|
|
319
291
|
...o.layout.spacing
|
|
320
292
|
})), o.animation && (s.animation = {
|
|
321
|
-
...
|
|
293
|
+
...R.animation,
|
|
322
294
|
...o.animation
|
|
323
295
|
}, o.animation.easing && (s.animation.easing = {
|
|
324
|
-
...
|
|
296
|
+
...R.animation.easing,
|
|
325
297
|
...o.animation.easing
|
|
326
298
|
}), o.animation.queue && (s.animation.queue = {
|
|
327
|
-
...
|
|
299
|
+
...R.animation.queue,
|
|
328
300
|
...o.animation.queue
|
|
329
|
-
}), o.animation.performance && (s.animation.performance = {
|
|
330
|
-
...x.animation.performance,
|
|
331
|
-
...o.animation.performance
|
|
332
301
|
}), o.animation.entry && (s.animation.entry = {
|
|
333
|
-
...
|
|
302
|
+
...R.animation.entry,
|
|
334
303
|
...o.animation.entry,
|
|
335
304
|
start: o.animation.entry.start ? {
|
|
336
|
-
...
|
|
305
|
+
...R.animation.entry.start,
|
|
337
306
|
...o.animation.entry.start,
|
|
338
|
-
circular: o.animation.entry.start.circular ? { ...
|
|
339
|
-
} :
|
|
340
|
-
timing: o.animation.entry.timing ? { ...
|
|
341
|
-
path: o.animation.entry.path ? { ...vt, ...o.animation.entry.path } :
|
|
342
|
-
rotation: o.animation.entry.rotation ? { ...wt, ...o.animation.entry.rotation } :
|
|
343
|
-
scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } :
|
|
307
|
+
circular: o.animation.entry.start.circular ? { ...R.animation.entry.start.circular, ...o.animation.entry.start.circular } : R.animation.entry.start.circular
|
|
308
|
+
} : R.animation.entry.start,
|
|
309
|
+
timing: o.animation.entry.timing ? { ...R.animation.entry.timing, ...o.animation.entry.timing } : R.animation.entry.timing,
|
|
310
|
+
path: o.animation.entry.path ? { ...vt, ...o.animation.entry.path } : R.animation.entry.path,
|
|
311
|
+
rotation: o.animation.entry.rotation ? { ...wt, ...o.animation.entry.rotation } : R.animation.entry.rotation,
|
|
312
|
+
scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : R.animation.entry.scale
|
|
344
313
|
}), o.animation.idle && (s.animation.idle = {
|
|
345
314
|
...$t,
|
|
346
315
|
...o.animation.idle
|
|
347
316
|
})), o.interaction && (s.interaction = {
|
|
348
|
-
...
|
|
317
|
+
...R.interaction,
|
|
349
318
|
...o.interaction
|
|
350
319
|
}, o.interaction.focus && (s.interaction.focus = {
|
|
351
|
-
...
|
|
320
|
+
...R.interaction.focus,
|
|
352
321
|
...o.interaction.focus
|
|
353
322
|
}), o.interaction.navigation && (s.interaction.navigation = {
|
|
354
|
-
...
|
|
323
|
+
...R.interaction.navigation,
|
|
355
324
|
...o.interaction.navigation
|
|
356
|
-
})
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
...
|
|
361
|
-
...o.
|
|
362
|
-
},
|
|
363
|
-
...
|
|
364
|
-
...o.rendering.responsive,
|
|
365
|
-
breakpoints: o.rendering.responsive.breakpoints ? { ...x.rendering.responsive.breakpoints, ...o.rendering.responsive.breakpoints } : x.rendering.responsive.breakpoints,
|
|
366
|
-
mobileDetection: o.rendering.responsive.mobileDetection ? o.rendering.responsive.mobileDetection : x.rendering.responsive.mobileDetection
|
|
367
|
-
}), o.rendering.ui && (s.rendering.ui = {
|
|
368
|
-
...x.rendering.ui,
|
|
369
|
-
...o.rendering.ui
|
|
370
|
-
})), s.config.debug = {
|
|
371
|
-
..._t,
|
|
325
|
+
}));
|
|
326
|
+
const l = o.rendering?.ui;
|
|
327
|
+
if (l && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), s.ui = {
|
|
328
|
+
...R.ui,
|
|
329
|
+
...l,
|
|
330
|
+
...o.ui
|
|
331
|
+
}, s.config.debug = {
|
|
332
|
+
...Dt,
|
|
372
333
|
...o.config?.debug ?? {}
|
|
373
334
|
}, s.layout.algorithm === "honeycomb" && s.styling) {
|
|
374
335
|
const c = { shape: "hexagon", mode: "height-relative" };
|
|
@@ -382,10 +343,10 @@ function te(o = {}) {
|
|
|
382
343
|
return s;
|
|
383
344
|
}
|
|
384
345
|
function ee(o, t) {
|
|
385
|
-
return { ...o ?
|
|
346
|
+
return { ...o ? At[o] : At.playful, ...t };
|
|
386
347
|
}
|
|
387
348
|
function ie(o, t) {
|
|
388
|
-
return { ...o ?
|
|
349
|
+
return { ...o ? Tt[o] : Tt.gentle, ...t };
|
|
389
350
|
}
|
|
390
351
|
function ne(o, t) {
|
|
391
352
|
return { ...o ? Ct[o] : Ct.gentle, ...t };
|
|
@@ -417,12 +378,12 @@ class oe {
|
|
|
417
378
|
*/
|
|
418
379
|
animateTransformCancellable(t, i, e, n = null, a = null) {
|
|
419
380
|
this.cancelAllAnimations(t);
|
|
420
|
-
const r = n ?? this.config.duration, s = a ?? this.config.easing.default,
|
|
381
|
+
const r = n ?? this.config.duration, s = a ?? this.config.easing.default, l = this.buildTransformString(i), c = this.buildTransformString(e);
|
|
421
382
|
t.style.transition = "none";
|
|
422
383
|
const u = t.animate(
|
|
423
384
|
[
|
|
424
|
-
{ transform:
|
|
425
|
-
{ transform:
|
|
385
|
+
{ transform: l },
|
|
386
|
+
{ transform: c }
|
|
426
387
|
],
|
|
427
388
|
{
|
|
428
389
|
duration: r,
|
|
@@ -440,7 +401,7 @@ class oe {
|
|
|
440
401
|
duration: r
|
|
441
402
|
};
|
|
442
403
|
return this.activeAnimations.set(t, h), u.finished.then(() => {
|
|
443
|
-
t.style.transform =
|
|
404
|
+
t.style.transform = c, this.activeAnimations.delete(t);
|
|
444
405
|
}).catch(() => {
|
|
445
406
|
this.activeAnimations.delete(t);
|
|
446
407
|
}), h;
|
|
@@ -486,8 +447,8 @@ class oe {
|
|
|
486
447
|
const e = getComputedStyle(t).transform;
|
|
487
448
|
if (e === "none" || !e)
|
|
488
449
|
return { x: 0, y: 0, rotation: 0, scale: 1 };
|
|
489
|
-
const n = new DOMMatrix(e), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e,
|
|
490
|
-
return { x: s, y:
|
|
450
|
+
const n = new DOMMatrix(e), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e, l = n.f;
|
|
451
|
+
return { x: s, y: l, rotation: r, scale: a };
|
|
491
452
|
}
|
|
492
453
|
/**
|
|
493
454
|
* Check if an element has an active animation
|
|
@@ -550,27 +511,27 @@ function V(o, t, i) {
|
|
|
550
511
|
return o + (t - o) * i;
|
|
551
512
|
}
|
|
552
513
|
function se(o, t, i, e) {
|
|
553
|
-
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x,
|
|
554
|
-
let u = 0, h = 0, d = 1, f = n,
|
|
555
|
-
for (let g = 0; g <
|
|
556
|
-
if (o <=
|
|
557
|
-
h = g === 0 ? 0 :
|
|
514
|
+
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, l = i.y - t.y, c = ae(a, r);
|
|
515
|
+
let u = 0, h = 0, d = 1, f = n, y = !1;
|
|
516
|
+
for (let g = 0; g < c.length; g++)
|
|
517
|
+
if (o <= c[g].time) {
|
|
518
|
+
h = g === 0 ? 0 : c[g - 1].time, d = c[g].time, f = c[g].overshoot, y = c[g].isOvershoot;
|
|
558
519
|
break;
|
|
559
520
|
}
|
|
560
521
|
const p = (o - h) / (d - h);
|
|
561
|
-
if (
|
|
522
|
+
if (y)
|
|
562
523
|
u = 1 + f * ot(p);
|
|
563
524
|
else if (h === 0)
|
|
564
525
|
u = ot(p);
|
|
565
526
|
else {
|
|
566
|
-
const m = 1 + (
|
|
567
|
-
(
|
|
527
|
+
const m = 1 + (c.find(
|
|
528
|
+
(b, w) => b.time > h && w > 0 && c[w - 1].isOvershoot
|
|
568
529
|
)?.overshoot || f);
|
|
569
530
|
u = V(m, 1, ot(p));
|
|
570
531
|
}
|
|
571
532
|
return {
|
|
572
533
|
x: t.x + s * u,
|
|
573
|
-
y: t.y +
|
|
534
|
+
y: t.y + l * u
|
|
574
535
|
};
|
|
575
536
|
}
|
|
576
537
|
function ae(o, t) {
|
|
@@ -584,20 +545,20 @@ function ae(o, t) {
|
|
|
584
545
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
585
546
|
}
|
|
586
547
|
function re(o, t, i, e) {
|
|
587
|
-
const { stiffness: n, damping: a, mass: r, oscillations: s } = e,
|
|
548
|
+
const { stiffness: n, damping: a, mass: r, oscillations: s } = e, l = i.x - t.x, c = i.y - t.y, u = Math.sqrt(n / r), h = a / (2 * Math.sqrt(n * r));
|
|
588
549
|
let d;
|
|
589
550
|
if (h < 1) {
|
|
590
|
-
const f = u * Math.sqrt(1 - h * h),
|
|
591
|
-
d = 1 -
|
|
551
|
+
const f = u * Math.sqrt(1 - h * h), y = Math.exp(-h * u * o * 3), p = Math.cos(f * o * s * Math.PI);
|
|
552
|
+
d = 1 - y * p;
|
|
592
553
|
} else
|
|
593
554
|
d = 1 - Math.exp(-u * o * 3);
|
|
594
555
|
return d = Math.max(0, Math.min(d, 1.3)), {
|
|
595
|
-
x: t.x +
|
|
596
|
-
y: t.y +
|
|
556
|
+
x: t.x + l * d,
|
|
557
|
+
y: t.y + c * d
|
|
597
558
|
};
|
|
598
559
|
}
|
|
599
560
|
function ce(o, t, i, e) {
|
|
600
|
-
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase:
|
|
561
|
+
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: l } = e, c = i.x - t.x, u = i.y - t.y, h = Math.sqrt(c * c + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? c / h : 1, y = a * Math.PI * 2 * o + l, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(y) * p, m = le(o);
|
|
601
562
|
return {
|
|
602
563
|
x: V(t.x, i.x, m) + g * d,
|
|
603
564
|
y: V(t.y, i.y, m) + g * f
|
|
@@ -610,25 +571,25 @@ function le(o) {
|
|
|
610
571
|
return 1 - Math.pow(1 - o, 3);
|
|
611
572
|
}
|
|
612
573
|
function he(o, t, i) {
|
|
613
|
-
const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1,
|
|
614
|
-
return t +
|
|
574
|
+
const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, l = e * r * s;
|
|
575
|
+
return t + l;
|
|
615
576
|
}
|
|
616
577
|
function de(o, t, i) {
|
|
617
578
|
const { overshoot: e, bounces: n } = i, a = [];
|
|
618
579
|
a.push({ time: 0.5, scale: e });
|
|
619
580
|
let r = e;
|
|
620
|
-
const s = 0.5,
|
|
581
|
+
const s = 0.5, c = 0.5 / (n * 2);
|
|
621
582
|
let u = 0.5;
|
|
622
583
|
for (let d = 0; d < n; d++) {
|
|
623
584
|
const f = 1 - (r - 1) * s;
|
|
624
|
-
u +=
|
|
585
|
+
u += c, a.push({ time: u, scale: f }), r = 1 + (r - 1) * s * s, u += c, d < n - 1 && a.push({ time: u, scale: r });
|
|
625
586
|
}
|
|
626
587
|
a.push({ time: 1, scale: 1 });
|
|
627
588
|
let h = 1;
|
|
628
589
|
for (let d = 0; d < a.length; d++)
|
|
629
590
|
if (o <= a[d].time) {
|
|
630
|
-
const f = d === 0 ? 0 : a[d - 1].time,
|
|
631
|
-
h =
|
|
591
|
+
const f = d === 0 ? 0 : a[d - 1].time, y = d === 0 ? 1 : a[d - 1].scale, p = (o - f) / (a[d].time - f), g = ot(p);
|
|
592
|
+
h = y + (a[d].scale - y) * g;
|
|
632
593
|
break;
|
|
633
594
|
}
|
|
634
595
|
return h * t;
|
|
@@ -642,58 +603,58 @@ function ue(o) {
|
|
|
642
603
|
duration: a,
|
|
643
604
|
imageWidth: r,
|
|
644
605
|
imageHeight: s,
|
|
645
|
-
rotation:
|
|
646
|
-
scale:
|
|
606
|
+
rotation: l,
|
|
607
|
+
scale: c,
|
|
647
608
|
onComplete: u,
|
|
648
609
|
rotationConfig: h,
|
|
649
610
|
startRotation: d,
|
|
650
611
|
scaleConfig: f,
|
|
651
|
-
startScale:
|
|
652
|
-
} = o, p = n.type, g = d !== void 0 && d !==
|
|
653
|
-
if ((p === "linear" || p === "arc") && !w && !(v ||
|
|
612
|
+
startScale: y
|
|
613
|
+
} = o, p = n.type, g = d !== void 0 && d !== l, m = h?.mode === "wobble", b = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = y !== void 0 && y !== c, S = f?.mode === "pop", E = f?.pop || { overshoot: 1.2, bounces: 1 };
|
|
614
|
+
if ((p === "linear" || p === "arc") && !w && !(v || S)) {
|
|
654
615
|
u && u();
|
|
655
616
|
return;
|
|
656
617
|
}
|
|
657
618
|
const O = performance.now(), L = -r / 2, P = -s / 2;
|
|
658
619
|
function z(H) {
|
|
659
|
-
const
|
|
660
|
-
let
|
|
620
|
+
const N = H - O, A = Math.min(N / a, 1);
|
|
621
|
+
let _;
|
|
661
622
|
switch (p) {
|
|
662
623
|
case "bounce": {
|
|
663
|
-
const
|
|
624
|
+
const k = ee(
|
|
664
625
|
n.bouncePreset,
|
|
665
626
|
n.bounce
|
|
666
627
|
);
|
|
667
|
-
|
|
628
|
+
_ = se(A, i, e, k);
|
|
668
629
|
break;
|
|
669
630
|
}
|
|
670
631
|
case "elastic": {
|
|
671
|
-
const
|
|
632
|
+
const k = ie(
|
|
672
633
|
n.elasticPreset,
|
|
673
634
|
n.elastic
|
|
674
635
|
);
|
|
675
|
-
|
|
636
|
+
_ = re(A, i, e, k);
|
|
676
637
|
break;
|
|
677
638
|
}
|
|
678
639
|
case "wave": {
|
|
679
|
-
const
|
|
640
|
+
const k = ne(
|
|
680
641
|
n.wavePreset,
|
|
681
642
|
n.wave
|
|
682
643
|
);
|
|
683
|
-
|
|
644
|
+
_ = ce(A, i, e, k);
|
|
684
645
|
break;
|
|
685
646
|
}
|
|
686
647
|
default:
|
|
687
|
-
|
|
688
|
-
x: V(i.x, e.x,
|
|
689
|
-
y: V(i.y, e.y,
|
|
648
|
+
_ = {
|
|
649
|
+
x: V(i.x, e.x, A),
|
|
650
|
+
y: V(i.y, e.y, A)
|
|
690
651
|
};
|
|
691
652
|
}
|
|
692
|
-
const G =
|
|
653
|
+
const G = _.x - e.x, U = _.y - e.y;
|
|
693
654
|
let M;
|
|
694
|
-
m ? M = he(
|
|
695
|
-
let
|
|
696
|
-
|
|
655
|
+
m ? M = he(A, l, b) : g ? M = V(d, l, A) : M = l;
|
|
656
|
+
let T;
|
|
657
|
+
S ? T = de(A, c, E) : v ? T = V(y, c, A) : T = c, t.style.transform = `translate(${L}px, ${P}px) translate(${G}px, ${U}px) rotate(${M}deg) scale(${T})`, A < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${L}px, ${P}px) rotate(${l}deg) scale(${c})`, u && u());
|
|
697
658
|
}
|
|
698
659
|
requestAnimationFrame(z);
|
|
699
660
|
}
|
|
@@ -755,9 +716,9 @@ class me {
|
|
|
755
716
|
* Calculate start position from the nearest edge (current default behavior)
|
|
756
717
|
*/
|
|
757
718
|
calculateNearestEdge(t, i, e, n) {
|
|
758
|
-
const a = t.x, r = t.y, s = a,
|
|
719
|
+
const a = t.x, r = t.y, s = a, l = e.width - a, c = r, u = e.height - r, h = Math.min(s, l, c, u);
|
|
759
720
|
let d = t.x, f = t.y;
|
|
760
|
-
return h === s ? d = -(i.width + n) : h ===
|
|
721
|
+
return h === s ? d = -(i.width + n) : h === l ? d = e.width + n : h === c ? f = -(i.height + n) : f = e.height + n, { x: d, y: f };
|
|
761
722
|
}
|
|
762
723
|
/**
|
|
763
724
|
* Calculate start position from a specific edge
|
|
@@ -804,19 +765,19 @@ class me {
|
|
|
804
765
|
*/
|
|
805
766
|
calculateCircularPosition(t, i, e, n, a) {
|
|
806
767
|
const r = this.config.start.circular || {}, s = r.distribution || "even";
|
|
807
|
-
let
|
|
808
|
-
const
|
|
809
|
-
if (typeof
|
|
810
|
-
const p = parseFloat(
|
|
811
|
-
|
|
768
|
+
let l;
|
|
769
|
+
const c = r.radius || "120%";
|
|
770
|
+
if (typeof c == "string" && c.endsWith("%")) {
|
|
771
|
+
const p = parseFloat(c) / 100;
|
|
772
|
+
l = Math.sqrt(
|
|
812
773
|
e.width ** 2 + e.height ** 2
|
|
813
774
|
) * p / 2;
|
|
814
775
|
} else
|
|
815
|
-
|
|
776
|
+
l = typeof c == "number" ? c : 500;
|
|
816
777
|
let u;
|
|
817
778
|
s === "even" ? u = n / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
818
|
-
const h = e.width / 2, d = e.height / 2, f = h + Math.cos(u) *
|
|
819
|
-
return { x: f, y
|
|
779
|
+
const h = e.width / 2, d = e.height / 2, f = h + Math.cos(u) * l, y = d + Math.sin(u) * l;
|
|
780
|
+
return { x: f, y };
|
|
820
781
|
}
|
|
821
782
|
/**
|
|
822
783
|
* Get animation parameters for an image
|
|
@@ -835,9 +796,9 @@ class me {
|
|
|
835
796
|
* Build a CSS transform string for the start position
|
|
836
797
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
837
798
|
*/
|
|
838
|
-
buildStartTransform(t, i, e, n, a, r, s,
|
|
839
|
-
const
|
|
840
|
-
return t.useScale ? `${p} translate(${
|
|
799
|
+
buildStartTransform(t, i, e, n, a, r, s, l) {
|
|
800
|
+
const c = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = l !== void 0 ? l : n, f = a !== void 0 ? -a / 2 : 0, y = r !== void 0 ? -r / 2 : 0, p = a !== void 0 ? `translate(${f}px, ${y}px)` : "translate(-50%, -50%)";
|
|
801
|
+
return t.useScale ? `${p} translate(${c}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${c}px, ${u}px) rotate(${h}deg) scale(${d})`;
|
|
841
802
|
}
|
|
842
803
|
/**
|
|
843
804
|
* Build the final CSS transform string
|
|
@@ -964,8 +925,8 @@ class me {
|
|
|
964
925
|
amplitude: 15,
|
|
965
926
|
frequency: 3,
|
|
966
927
|
decay: !0
|
|
967
|
-
}, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2),
|
|
968
|
-
return i +
|
|
928
|
+
}, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2), l = r ? Math.pow(1 - t, 2) : 1, c = n * s * l;
|
|
929
|
+
return i + c;
|
|
969
930
|
}
|
|
970
931
|
/**
|
|
971
932
|
* Get the scale configuration
|
|
@@ -1023,10 +984,10 @@ class me {
|
|
|
1023
984
|
bounces: 1
|
|
1024
985
|
}, { overshoot: n, bounces: a } = e, r = this.generateScaleBounceKeyframes(a, n);
|
|
1025
986
|
let s = i;
|
|
1026
|
-
for (let
|
|
1027
|
-
if (t <= r[
|
|
1028
|
-
const
|
|
1029
|
-
s = u + (r[
|
|
987
|
+
for (let l = 0; l < r.length; l++)
|
|
988
|
+
if (t <= r[l].time) {
|
|
989
|
+
const c = l === 0 ? 0 : r[l - 1].time, u = l === 0 ? i : r[l - 1].scale, h = (t - c) / (r[l].time - c), d = this.easeOutQuad(h);
|
|
990
|
+
s = u + (r[l].scale - u) * d;
|
|
1030
991
|
break;
|
|
1031
992
|
}
|
|
1032
993
|
return s * i;
|
|
@@ -1039,10 +1000,10 @@ class me {
|
|
|
1039
1000
|
e.push({ time: 0.5, scale: i });
|
|
1040
1001
|
let n = i;
|
|
1041
1002
|
const a = 0.5, s = 0.5 / (t * 2);
|
|
1042
|
-
let
|
|
1043
|
-
for (let
|
|
1003
|
+
let l = 0.5;
|
|
1004
|
+
for (let c = 0; c < t; c++) {
|
|
1044
1005
|
const u = 1 - (n - 1) * a;
|
|
1045
|
-
|
|
1006
|
+
l += s, e.push({ time: l, scale: u }), n = 1 + (n - 1) * a * a, l += s, c < t - 1 && e.push({ time: l, scale: n });
|
|
1046
1007
|
}
|
|
1047
1008
|
return e.push({ time: 1, scale: 1 }), e;
|
|
1048
1009
|
}
|
|
@@ -1239,7 +1200,7 @@ class pe {
|
|
|
1239
1200
|
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
|
|
1240
1201
|
}
|
|
1241
1202
|
}
|
|
1242
|
-
class
|
|
1203
|
+
class ye {
|
|
1243
1204
|
constructor(t, i = {}) {
|
|
1244
1205
|
this.config = t, this.imageConfig = i;
|
|
1245
1206
|
}
|
|
@@ -1251,11 +1212,11 @@ class be {
|
|
|
1251
1212
|
* @returns Array of layout objects with position, rotation, scale
|
|
1252
1213
|
*/
|
|
1253
1214
|
generate(t, i, e = {}) {
|
|
1254
|
-
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding,
|
|
1215
|
+
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, l = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, y = d !== 1 || f !== 1, g = l * 1.5 / 2, m = l / 2, b = a - s - g, w = r - s - m, v = s + g, S = s + m;
|
|
1255
1216
|
for (let E = 0; E < t; E++) {
|
|
1256
|
-
const
|
|
1217
|
+
const I = this.random(v, b), O = this.random(S, w), L = c === "random" ? this.random(u, h) : 0, P = y ? this.random(d, f) : 1, z = l * P, H = {
|
|
1257
1218
|
id: E,
|
|
1258
|
-
x:
|
|
1219
|
+
x: I,
|
|
1259
1220
|
y: O,
|
|
1260
1221
|
rotation: L,
|
|
1261
1222
|
scale: P,
|
|
@@ -1275,7 +1236,7 @@ class be {
|
|
|
1275
1236
|
return Math.random() * (i - t) + t;
|
|
1276
1237
|
}
|
|
1277
1238
|
}
|
|
1278
|
-
class
|
|
1239
|
+
class be {
|
|
1279
1240
|
constructor(t, i = {}) {
|
|
1280
1241
|
this.config = t, this.imageConfig = i;
|
|
1281
1242
|
}
|
|
@@ -1287,20 +1248,20 @@ class ye {
|
|
|
1287
1248
|
* @returns Array of layout objects with position, rotation, scale
|
|
1288
1249
|
*/
|
|
1289
1250
|
generate(t, i, e = {}) {
|
|
1290
|
-
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200,
|
|
1291
|
-
...
|
|
1251
|
+
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, y = this.config.scaleDecay ?? 0, p = {
|
|
1252
|
+
...Nt,
|
|
1292
1253
|
...this.config.radial
|
|
1293
|
-
}, g = e.fixedHeight ?? s, m = a / 2,
|
|
1254
|
+
}, g = e.fixedHeight ?? s, m = a / 2, b = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, S = Math.max(g * 0.8, Math.min(
|
|
1294
1255
|
m - v - g / 2,
|
|
1295
|
-
|
|
1256
|
+
b - v - g / 2
|
|
1296
1257
|
));
|
|
1297
1258
|
if (t > 0) {
|
|
1298
1259
|
const O = f ? this.random(h, d) : 1, L = g * O;
|
|
1299
1260
|
n.push({
|
|
1300
1261
|
id: 0,
|
|
1301
1262
|
x: m,
|
|
1302
|
-
y,
|
|
1303
|
-
rotation:
|
|
1263
|
+
y: b,
|
|
1264
|
+
rotation: l === "random" ? this.random(c * 0.33, u * 0.33) : 0,
|
|
1304
1265
|
// Less rotation for center
|
|
1305
1266
|
scale: O,
|
|
1306
1267
|
baseSize: L,
|
|
@@ -1308,32 +1269,32 @@ class ye {
|
|
|
1308
1269
|
// Center image is highest
|
|
1309
1270
|
});
|
|
1310
1271
|
}
|
|
1311
|
-
let E = 1,
|
|
1272
|
+
let E = 1, I = 1;
|
|
1312
1273
|
for (; E < t; ) {
|
|
1313
|
-
const O =
|
|
1314
|
-
if (
|
|
1315
|
-
|
|
1274
|
+
const O = I / w, L = y > 0 ? 1 - O * y * 0.5 : 1, P = Math.max(g * 0.8, S / w * 1.5 / p.tightness), z = I * P, H = z * 1.5, N = Math.PI * (3 * (H + z) - Math.sqrt((3 * H + z) * (H + 3 * z))), A = this.estimateWidth(g), _ = Math.floor(N / (A * 0.7));
|
|
1275
|
+
if (_ === 0) {
|
|
1276
|
+
I++;
|
|
1316
1277
|
continue;
|
|
1317
1278
|
}
|
|
1318
|
-
const G = 2 * Math.PI /
|
|
1319
|
-
for (let M = 0; M <
|
|
1320
|
-
const
|
|
1321
|
-
let
|
|
1279
|
+
const G = 2 * Math.PI / _, U = I * (20 * Math.PI / 180);
|
|
1280
|
+
for (let M = 0; M < _ && E < t; M++) {
|
|
1281
|
+
const T = M * G + U, k = f ? this.random(h, d) : 1, B = L * k, C = g * B;
|
|
1282
|
+
let D = m + Math.cos(T) * H, F = b + Math.sin(T) * z;
|
|
1322
1283
|
const $ = C * 1.5 / 2, j = C / 2;
|
|
1323
|
-
|
|
1324
|
-
const Y =
|
|
1284
|
+
D - $ < v ? D = v + $ : D + $ > a - v && (D = a - v - $), F - j < v ? F = v + j : F + j > r - v && (F = r - v - j);
|
|
1285
|
+
const Y = l === "random" ? this.random(c, u) : 0;
|
|
1325
1286
|
n.push({
|
|
1326
1287
|
id: E,
|
|
1327
|
-
x:
|
|
1288
|
+
x: D,
|
|
1328
1289
|
y: F,
|
|
1329
1290
|
rotation: Y,
|
|
1330
1291
|
scale: B,
|
|
1331
1292
|
baseSize: C,
|
|
1332
|
-
zIndex: Math.max(1, 100 -
|
|
1293
|
+
zIndex: Math.max(1, 100 - I)
|
|
1333
1294
|
// Outer rings have lower z-index
|
|
1334
1295
|
}), E++;
|
|
1335
1296
|
}
|
|
1336
|
-
|
|
1297
|
+
I++;
|
|
1337
1298
|
}
|
|
1338
1299
|
return n;
|
|
1339
1300
|
}
|
|
@@ -1396,13 +1357,13 @@ class we {
|
|
|
1396
1357
|
* @returns Array of layout objects with position, rotation, scale
|
|
1397
1358
|
*/
|
|
1398
1359
|
generate(t, i, e = {}) {
|
|
1399
|
-
const n = [], { width: a, height: r } = i, s = { ...ve, ...this.config.grid },
|
|
1360
|
+
const n = [], { width: a, height: r } = i, s = { ...ve, ...this.config.grid }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, y = a - 2 * l, p = r - 2 * l, { columns: g, rows: m } = this.calculateGridDimensions(
|
|
1400
1361
|
t,
|
|
1401
|
-
|
|
1362
|
+
y,
|
|
1402
1363
|
p,
|
|
1403
|
-
|
|
1364
|
+
c,
|
|
1404
1365
|
s
|
|
1405
|
-
),
|
|
1366
|
+
), b = s.stagger === "row", w = s.stagger === "column", v = b ? g + 0.5 : g, S = w ? m + 0.5 : m, E = (y - s.gap * (g - 1)) / v, I = (p - s.gap * (m - 1)) / S, O = b ? E / 2 : 0, L = w ? I / 2 : 0, P = 1 + s.overlap, z = Math.min(E, I) * P, H = e.fixedHeight ? Math.min(e.fixedHeight, z) : z, N = g * E + (g - 1) * s.gap + O, A = m * I + (m - 1) * s.gap + L, _ = l + (y - N) / 2, G = l + (p - A) / 2, U = g * m, M = s.columns !== "auto" && s.rows !== "auto", T = M && t > U;
|
|
1406
1367
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1407
1368
|
gridConfigColumns: s.columns,
|
|
1408
1369
|
gridConfigRows: s.rows,
|
|
@@ -1411,35 +1372,35 @@ class we {
|
|
|
1411
1372
|
cellCount: U,
|
|
1412
1373
|
hasFixedGrid: M,
|
|
1413
1374
|
imageCount: t,
|
|
1414
|
-
isOverflowMode:
|
|
1375
|
+
isOverflowMode: T
|
|
1415
1376
|
});
|
|
1416
|
-
const
|
|
1377
|
+
const k = T ? new Array(U).fill(0) : [], B = Math.min(E, I) * s.overflowOffset;
|
|
1417
1378
|
for (let C = 0; C < t; C++) {
|
|
1418
|
-
let
|
|
1419
|
-
if (
|
|
1379
|
+
let D, F, X = 0;
|
|
1380
|
+
if (T && C >= U) {
|
|
1420
1381
|
const q = C - U, W = q % U;
|
|
1421
|
-
X = Math.floor(q / U) + 1,
|
|
1382
|
+
X = Math.floor(q / U) + 1, k[W]++, s.fillDirection === "row" ? (D = W % g, F = Math.floor(W / g)) : (F = W % m, D = Math.floor(W / m));
|
|
1422
1383
|
} else
|
|
1423
|
-
s.fillDirection === "row" ? (
|
|
1424
|
-
let $ =
|
|
1425
|
-
if (s.stagger === "row" && F % 2 === 1 ? $ += E / 2 : s.stagger === "column" &&
|
|
1384
|
+
s.fillDirection === "row" ? (D = C % g, F = Math.floor(C / g)) : (F = C % m, D = Math.floor(C / m));
|
|
1385
|
+
let $ = _ + D * (E + s.gap) + E / 2, j = G + F * (I + s.gap) + I / 2;
|
|
1386
|
+
if (s.stagger === "row" && F % 2 === 1 ? $ += E / 2 : s.stagger === "column" && D % 2 === 1 && (j += I / 2), X > 0) {
|
|
1426
1387
|
const q = (X - 1) % Lt.length, W = Lt[q];
|
|
1427
1388
|
$ += W.x * B, j += W.y * B;
|
|
1428
1389
|
}
|
|
1429
1390
|
if (s.jitter > 0) {
|
|
1430
|
-
const q = E / 2 * s.jitter, W =
|
|
1391
|
+
const q = E / 2 * s.jitter, W = I / 2 * s.jitter;
|
|
1431
1392
|
$ += this.random(-q, q), j += this.random(-W, W);
|
|
1432
1393
|
}
|
|
1433
1394
|
let Y = $, J = j;
|
|
1434
|
-
if (!
|
|
1395
|
+
if (!T && s.fillDirection === "row") {
|
|
1435
1396
|
const q = t % g || g;
|
|
1436
1397
|
if (F === Math.floor((t - 1) / g) && q < g) {
|
|
1437
1398
|
const Rt = q * E + (q - 1) * s.gap;
|
|
1438
1399
|
let gt = 0;
|
|
1439
|
-
s.alignment === "center" ? gt = (
|
|
1400
|
+
s.alignment === "center" ? gt = (N - Rt) / 2 : s.alignment === "end" && (gt = N - Rt), Y += gt;
|
|
1440
1401
|
}
|
|
1441
1402
|
}
|
|
1442
|
-
const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt =
|
|
1403
|
+
const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt = l + it, ht = a - l - it, Ut = l + nt, Ht = r - l - nt;
|
|
1443
1404
|
Y = Math.max(lt, Math.min(Y, ht)), J = Math.max(Ut, Math.min(J, Ht));
|
|
1444
1405
|
let dt = 0;
|
|
1445
1406
|
if (u === "random") {
|
|
@@ -1447,7 +1408,7 @@ class we {
|
|
|
1447
1408
|
s.jitter > 0 ? dt = this.random(q * s.jitter, W * s.jitter) : dt = this.random(q, W);
|
|
1448
1409
|
}
|
|
1449
1410
|
let ut;
|
|
1450
|
-
|
|
1411
|
+
T && X > 0 ? ut = 50 - X : ut = T ? 100 + C : C + 1, n.push({
|
|
1451
1412
|
id: C,
|
|
1452
1413
|
x: Y,
|
|
1453
1414
|
y: J,
|
|
@@ -1471,8 +1432,8 @@ class we {
|
|
|
1471
1432
|
else if (a.rows !== "auto")
|
|
1472
1433
|
s = a.rows, r = Math.ceil(t / s);
|
|
1473
1434
|
else {
|
|
1474
|
-
const
|
|
1475
|
-
for (r = Math.max(1, Math.round(Math.sqrt(t *
|
|
1435
|
+
const l = i / e;
|
|
1436
|
+
for (r = Math.max(1, Math.round(Math.sqrt(t * l / 1.4))), s = Math.ceil(t / r); r > 1 && (r - 1) * s >= t; )
|
|
1476
1437
|
r--;
|
|
1477
1438
|
}
|
|
1478
1439
|
return { columns: Math.max(1, r), rows: Math.max(1, s) };
|
|
@@ -1503,35 +1464,35 @@ class Se {
|
|
|
1503
1464
|
* @returns Array of layout objects with position, rotation, scale
|
|
1504
1465
|
*/
|
|
1505
1466
|
generate(t, i, e = {}) {
|
|
1506
|
-
const n = [], { width: a, height: r } = i, s = { ...xe, ...this.config.spiral },
|
|
1507
|
-
m -
|
|
1508
|
-
|
|
1467
|
+
const n = [], { width: a, height: r } = i, s = { ...xe, ...this.config.spiral }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, y = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || y !== 1, g = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, b = r / 2, w = Math.min(
|
|
1468
|
+
m - l - c / 2,
|
|
1469
|
+
b - l - c / 2
|
|
1509
1470
|
), v = s.direction === "clockwise" ? -1 : 1;
|
|
1510
|
-
for (let
|
|
1511
|
-
let E,
|
|
1471
|
+
for (let S = 0; S < t; S++) {
|
|
1472
|
+
let E, I;
|
|
1512
1473
|
if (s.spiralType === "golden")
|
|
1513
|
-
E =
|
|
1474
|
+
E = S * Ee * v + s.startAngle, I = this.calculateGoldenRadius(S, t, w, s.tightness);
|
|
1514
1475
|
else if (s.spiralType === "archimedean") {
|
|
1515
|
-
const $ =
|
|
1516
|
-
E = $ * v + s.startAngle,
|
|
1476
|
+
const $ = S * 0.5 * s.tightness;
|
|
1477
|
+
E = $ * v + s.startAngle, I = this.calculateArchimedeanRadius($, t, w, s.tightness);
|
|
1517
1478
|
} else {
|
|
1518
|
-
const $ =
|
|
1519
|
-
E = $ * v + s.startAngle,
|
|
1479
|
+
const $ = S * 0.3 * s.tightness;
|
|
1480
|
+
E = $ * v + s.startAngle, I = this.calculateLogarithmicRadius($, t, w, s.tightness);
|
|
1520
1481
|
}
|
|
1521
|
-
const O = m + Math.cos(E) *
|
|
1482
|
+
const O = m + Math.cos(E) * I, L = b + Math.sin(E) * I, P = I / w, z = g > 0 ? 1 - P * g * 0.5 : 1, H = p ? this.random(f, y) : 1, N = z * H, A = c * N, G = A * 1.5 / 2, U = A / 2, M = l + G, T = a - l - G, k = l + U, B = r - l - U, C = Math.max(M, Math.min(O, T)), D = Math.max(k, Math.min(L, B));
|
|
1522
1483
|
let F = 0;
|
|
1523
1484
|
if (u === "random") {
|
|
1524
1485
|
const $ = E * 180 / Math.PI % 360, j = this.random(h, d);
|
|
1525
1486
|
F = s.spiralType === "golden" ? j : $ * 0.1 + j * 0.9;
|
|
1526
|
-
} else u === "tangent" && (F = this.calculateSpiralTangent(E,
|
|
1527
|
-
const X = t -
|
|
1487
|
+
} else u === "tangent" && (F = this.calculateSpiralTangent(E, I, s));
|
|
1488
|
+
const X = t - S;
|
|
1528
1489
|
n.push({
|
|
1529
|
-
id:
|
|
1490
|
+
id: S,
|
|
1530
1491
|
x: C,
|
|
1531
|
-
y:
|
|
1492
|
+
y: D,
|
|
1532
1493
|
rotation: F,
|
|
1533
|
-
scale:
|
|
1534
|
-
baseSize:
|
|
1494
|
+
scale: N,
|
|
1495
|
+
baseSize: A,
|
|
1535
1496
|
zIndex: X
|
|
1536
1497
|
});
|
|
1537
1498
|
}
|
|
@@ -1575,8 +1536,8 @@ class Se {
|
|
|
1575
1536
|
* r = a * e^(b*θ)
|
|
1576
1537
|
*/
|
|
1577
1538
|
calculateLogarithmicRadius(t, i, e, n) {
|
|
1578
|
-
const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t),
|
|
1579
|
-
return s /
|
|
1539
|
+
const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t), l = i * 0.3 * n, c = a * Math.exp(r * l);
|
|
1540
|
+
return s / c * e;
|
|
1580
1541
|
}
|
|
1581
1542
|
/**
|
|
1582
1543
|
* Utility: Generate random number between min and max
|
|
@@ -1605,7 +1566,7 @@ class Re {
|
|
|
1605
1566
|
* @returns Array of layout objects with position, rotation, scale
|
|
1606
1567
|
*/
|
|
1607
1568
|
generate(t, i, e = {}) {
|
|
1608
|
-
const n = [], { width: a, height: r } = i, s = { ...Ie, ...this.config.cluster },
|
|
1569
|
+
const n = [], { width: a, height: r } = i, s = { ...Ie, ...this.config.cluster }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, y = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || y !== 1, g = this.calculateClusterCount(
|
|
1609
1570
|
t,
|
|
1610
1571
|
s.clusterCount,
|
|
1611
1572
|
a,
|
|
@@ -1615,37 +1576,37 @@ class Re {
|
|
|
1615
1576
|
g,
|
|
1616
1577
|
a,
|
|
1617
1578
|
r,
|
|
1618
|
-
|
|
1579
|
+
l,
|
|
1619
1580
|
s
|
|
1620
|
-
),
|
|
1581
|
+
), b = new Array(g).fill(0);
|
|
1621
1582
|
for (let v = 0; v < t; v++)
|
|
1622
|
-
|
|
1583
|
+
b[v % g]++;
|
|
1623
1584
|
let w = 0;
|
|
1624
1585
|
for (let v = 0; v < g; v++) {
|
|
1625
|
-
const
|
|
1626
|
-
for (let
|
|
1586
|
+
const S = m[v], E = b[v];
|
|
1587
|
+
for (let I = 0; I < E; I++) {
|
|
1627
1588
|
let O, L;
|
|
1628
1589
|
if (s.distribution === "gaussian")
|
|
1629
|
-
O = this.gaussianRandom() *
|
|
1590
|
+
O = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
|
|
1630
1591
|
else {
|
|
1631
|
-
const F = this.random(0, Math.PI * 2), X = this.random(0,
|
|
1592
|
+
const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
|
|
1632
1593
|
O = Math.cos(F) * X, L = Math.sin(F) * X;
|
|
1633
1594
|
}
|
|
1634
1595
|
const P = 1 + s.overlap * 0.5, z = 1 + s.overlap * 0.3;
|
|
1635
1596
|
O /= P, L /= P;
|
|
1636
|
-
const H = p ? this.random(f,
|
|
1637
|
-
let
|
|
1638
|
-
const M =
|
|
1639
|
-
|
|
1640
|
-
const
|
|
1597
|
+
const H = p ? this.random(f, y) : 1, N = z * H, A = c * N;
|
|
1598
|
+
let _ = S.x + O, G = S.y + L;
|
|
1599
|
+
const M = A * 1.5 / 2, T = A / 2;
|
|
1600
|
+
_ = Math.max(l + M, Math.min(_, a - l - M)), G = Math.max(l + T, Math.min(G, r - l - T));
|
|
1601
|
+
const k = u === "random" ? this.random(h, d) : 0, C = Math.sqrt(O * O + L * L) / S.spread, D = Math.round((1 - C) * 50) + 1;
|
|
1641
1602
|
n.push({
|
|
1642
1603
|
id: w,
|
|
1643
|
-
x:
|
|
1604
|
+
x: _,
|
|
1644
1605
|
y: G,
|
|
1645
|
-
rotation:
|
|
1646
|
-
scale:
|
|
1647
|
-
baseSize:
|
|
1648
|
-
zIndex:
|
|
1606
|
+
rotation: k,
|
|
1607
|
+
scale: N,
|
|
1608
|
+
baseSize: A,
|
|
1609
|
+
zIndex: D
|
|
1649
1610
|
}), w++;
|
|
1650
1611
|
}
|
|
1651
1612
|
}
|
|
@@ -1657,30 +1618,30 @@ class Re {
|
|
|
1657
1618
|
calculateClusterCount(t, i, e, n, a) {
|
|
1658
1619
|
if (i !== "auto")
|
|
1659
1620
|
return Math.max(1, Math.min(i, t));
|
|
1660
|
-
const s = Math.max(1, Math.ceil(t / 8)),
|
|
1621
|
+
const s = Math.max(1, Math.ceil(t / 8)), l = Math.floor(
|
|
1661
1622
|
e / a * (n / a) * 0.6
|
|
1662
1623
|
);
|
|
1663
|
-
return Math.max(1, Math.min(s,
|
|
1624
|
+
return Math.max(1, Math.min(s, l, 10));
|
|
1664
1625
|
}
|
|
1665
1626
|
/**
|
|
1666
1627
|
* Generate cluster center positions with spacing constraints
|
|
1667
1628
|
*/
|
|
1668
1629
|
generateClusterCenters(t, i, e, n, a) {
|
|
1669
|
-
const r = [],
|
|
1630
|
+
const r = [], l = n + a.clusterSpread, c = i - n - a.clusterSpread, u = n + a.clusterSpread, h = e - n - a.clusterSpread;
|
|
1670
1631
|
for (let d = 0; d < t; d++) {
|
|
1671
|
-
let f = null,
|
|
1632
|
+
let f = null, y = -1;
|
|
1672
1633
|
for (let p = 0; p < 100; p++) {
|
|
1673
1634
|
const g = {
|
|
1674
|
-
x: this.random(
|
|
1635
|
+
x: this.random(l, c),
|
|
1675
1636
|
y: this.random(u, h),
|
|
1676
1637
|
spread: this.calculateClusterSpread(a)
|
|
1677
1638
|
};
|
|
1678
1639
|
let m = 1 / 0;
|
|
1679
|
-
for (const
|
|
1680
|
-
const w = g.x -
|
|
1681
|
-
m = Math.min(m,
|
|
1640
|
+
for (const b of r) {
|
|
1641
|
+
const w = g.x - b.x, v = g.y - b.y, S = Math.sqrt(w * w + v * v);
|
|
1642
|
+
m = Math.min(m, S);
|
|
1682
1643
|
}
|
|
1683
|
-
if ((r.length === 0 || m >
|
|
1644
|
+
if ((r.length === 0 || m > y) && (f = g, y = m), m >= a.clusterSpacing)
|
|
1684
1645
|
break;
|
|
1685
1646
|
}
|
|
1686
1647
|
f && r.push(f);
|
|
@@ -1711,7 +1672,7 @@ class Re {
|
|
|
1711
1672
|
return Math.random() * (i - t) + t;
|
|
1712
1673
|
}
|
|
1713
1674
|
}
|
|
1714
|
-
class
|
|
1675
|
+
class Ae {
|
|
1715
1676
|
constructor(t, i = {}) {
|
|
1716
1677
|
this.config = t, this.imageConfig = i;
|
|
1717
1678
|
}
|
|
@@ -1723,20 +1684,20 @@ class Te {
|
|
|
1723
1684
|
* @returns Array of layout objects with position, rotation, scale
|
|
1724
1685
|
*/
|
|
1725
1686
|
generate(t, i, e = {}) {
|
|
1726
|
-
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200,
|
|
1727
|
-
...
|
|
1687
|
+
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, l = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, y = d !== 1 || f !== 1, p = e.fixedHeight ?? s, g = {
|
|
1688
|
+
...kt,
|
|
1728
1689
|
...this.config.wave
|
|
1729
|
-
}, { rows: m, amplitude:
|
|
1690
|
+
}, { rows: m, amplitude: b, frequency: w, phaseShift: v, synchronization: S } = g, E = Math.ceil(t / m), L = p * 1.5 / 2, P = l + L, z = a - l - L, H = z - P, N = E > 1 ? H / (E - 1) : 0, A = l + b + p / 2, _ = r - l - b - p / 2, G = _ - A, U = m > 1 ? G / (m - 1) : 0;
|
|
1730
1691
|
let M = 0;
|
|
1731
|
-
for (let
|
|
1732
|
-
const
|
|
1692
|
+
for (let T = 0; T < m && M < t; T++) {
|
|
1693
|
+
const k = m === 1 ? (A + _) / 2 : A + T * U;
|
|
1733
1694
|
let B = 0;
|
|
1734
|
-
|
|
1695
|
+
S === "offset" ? B = T * v : S === "alternating" && (B = T * Math.PI);
|
|
1735
1696
|
for (let C = 0; C < E && M < t; C++) {
|
|
1736
|
-
const
|
|
1697
|
+
const D = E === 1 ? (P + z) / 2 : P + C * N, F = this.calculateWaveY(D, a, b, w, B), X = D, $ = k + F, j = y ? this.random(d, f) : 1, Y = p * j;
|
|
1737
1698
|
let J = 0;
|
|
1738
|
-
|
|
1739
|
-
const K = Y * 1.5 / 2, ct = Y / 2, it =
|
|
1699
|
+
c === "tangent" ? J = this.calculateRotation(D, a, b, w, B) : c === "random" && (J = this.random(u, h));
|
|
1700
|
+
const K = Y * 1.5 / 2, ct = Y / 2, it = l + K, nt = a - l - K, lt = l + ct, ht = r - l - ct;
|
|
1740
1701
|
n.push({
|
|
1741
1702
|
id: M,
|
|
1742
1703
|
x: Math.max(it, Math.min(X, nt)),
|
|
@@ -1801,10 +1762,10 @@ const xt = 100, Q = 100 / Math.sqrt(3), St = [
|
|
|
1801
1762
|
// lower-left
|
|
1802
1763
|
[0, 50]
|
|
1803
1764
|
// left
|
|
1804
|
-
],
|
|
1765
|
+
], Te = St[1][0] / xt, Ce = St[2][1] / xt;
|
|
1805
1766
|
function Le(o) {
|
|
1806
1767
|
return {
|
|
1807
|
-
colStep:
|
|
1768
|
+
colStep: Te * o,
|
|
1808
1769
|
rowOffset: Ce * o
|
|
1809
1770
|
};
|
|
1810
1771
|
}
|
|
@@ -1828,7 +1789,7 @@ function Oe(o) {
|
|
|
1828
1789
|
const t = [];
|
|
1829
1790
|
let [i, e, n] = [0, -o, o];
|
|
1830
1791
|
for (const [a, r, s] of Fe)
|
|
1831
|
-
for (let
|
|
1792
|
+
for (let l = 0; l < o; l++)
|
|
1832
1793
|
t.push([i, e, n]), i += a, e += r, n += s;
|
|
1833
1794
|
return t;
|
|
1834
1795
|
}
|
|
@@ -1839,33 +1800,33 @@ class ze {
|
|
|
1839
1800
|
this.config = t;
|
|
1840
1801
|
}
|
|
1841
1802
|
generate(t, i, e = {}) {
|
|
1842
|
-
const n = [], { width: a, height: r } = i, s = a / 2,
|
|
1803
|
+
const n = [], { width: a, height: r } = i, s = a / 2, l = r / 2, c = e.fixedHeight ?? 200, h = {
|
|
1843
1804
|
...jt,
|
|
1844
1805
|
...this.config.honeycomb
|
|
1845
|
-
}.spacing ?? 0, d =
|
|
1846
|
-
let f = 0,
|
|
1806
|
+
}.spacing ?? 0, d = c + h;
|
|
1807
|
+
let f = 0, y = 0;
|
|
1847
1808
|
for (; f < t; ) {
|
|
1848
|
-
const p = Oe(
|
|
1849
|
-
for (const [g, m,
|
|
1809
|
+
const p = Oe(y);
|
|
1810
|
+
for (const [g, m, b] of p) {
|
|
1850
1811
|
if (f >= t) break;
|
|
1851
|
-
const { px: w, py: v } = Me(g, m,
|
|
1812
|
+
const { px: w, py: v } = Me(g, m, b, s, l, d);
|
|
1852
1813
|
n.push({
|
|
1853
1814
|
id: f,
|
|
1854
1815
|
x: w,
|
|
1855
1816
|
y: v,
|
|
1856
1817
|
rotation: 0,
|
|
1857
1818
|
scale: 1,
|
|
1858
|
-
baseSize:
|
|
1819
|
+
baseSize: c,
|
|
1859
1820
|
// Inner rings render above outer rings
|
|
1860
|
-
zIndex: Math.max(1, 100 -
|
|
1821
|
+
zIndex: Math.max(1, 100 - y)
|
|
1861
1822
|
}), f++;
|
|
1862
1823
|
}
|
|
1863
|
-
|
|
1824
|
+
y++;
|
|
1864
1825
|
}
|
|
1865
1826
|
return n;
|
|
1866
1827
|
}
|
|
1867
1828
|
}
|
|
1868
|
-
class
|
|
1829
|
+
class _e {
|
|
1869
1830
|
constructor(t) {
|
|
1870
1831
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1871
1832
|
}
|
|
@@ -1876,7 +1837,7 @@ class De {
|
|
|
1876
1837
|
initLayout() {
|
|
1877
1838
|
switch (this.config.algorithm) {
|
|
1878
1839
|
case "radial":
|
|
1879
|
-
return new
|
|
1840
|
+
return new be(this.config, this.imageConfig);
|
|
1880
1841
|
case "grid":
|
|
1881
1842
|
return new we(this.config, this.imageConfig);
|
|
1882
1843
|
case "spiral":
|
|
@@ -1884,11 +1845,11 @@ class De {
|
|
|
1884
1845
|
case "cluster":
|
|
1885
1846
|
return new Re(this.config, this.imageConfig);
|
|
1886
1847
|
case "wave":
|
|
1887
|
-
return new
|
|
1848
|
+
return new Ae(this.config, this.imageConfig);
|
|
1888
1849
|
case "honeycomb":
|
|
1889
1850
|
return new ze(this.config, this.imageConfig);
|
|
1890
1851
|
default:
|
|
1891
|
-
return new
|
|
1852
|
+
return new ye(this.config, this.imageConfig);
|
|
1892
1853
|
}
|
|
1893
1854
|
}
|
|
1894
1855
|
/**
|
|
@@ -1970,15 +1931,15 @@ class De {
|
|
|
1970
1931
|
const a = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
|
|
1971
1932
|
if (r !== void 0)
|
|
1972
1933
|
return { height: r };
|
|
1973
|
-
const s = a?.minSize ?? 50,
|
|
1934
|
+
const s = a?.minSize ?? 50, l = a?.maxSize ?? 400, c = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * c / i;
|
|
1974
1935
|
let m = Math.sqrt(p / 1.4);
|
|
1975
1936
|
m *= u, m = Math.min(m, e);
|
|
1976
|
-
let
|
|
1977
|
-
if (
|
|
1937
|
+
let b = this.clamp(m, s, l);
|
|
1938
|
+
if (b === s && m < s) {
|
|
1978
1939
|
const w = Math.max(s * 0.05, 20);
|
|
1979
|
-
|
|
1940
|
+
b = Math.max(w, m);
|
|
1980
1941
|
}
|
|
1981
|
-
return this.config.algorithm === "honeycomb" && (
|
|
1942
|
+
return this.config.algorithm === "honeycomb" && (b = Math.min(b, this.honeycombMaxImageHeight(i, t))), { height: b };
|
|
1982
1943
|
}
|
|
1983
1944
|
/**
|
|
1984
1945
|
* Returns the largest image height at which all honeycomb rings fit within the container.
|
|
@@ -1990,7 +1951,7 @@ class De {
|
|
|
1990
1951
|
let e = 0, n = 1;
|
|
1991
1952
|
for (; n < t; )
|
|
1992
1953
|
e++, n += 6 * e;
|
|
1993
|
-
const a = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, s = i.width / 2,
|
|
1954
|
+
const a = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, s = i.width / 2, l = i.height / 2, c = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (l - a - r * e) / (e + 0.5), d = (s - a - c * r * e) / (c * e + u);
|
|
1994
1955
|
return Math.max(10, Math.min(h, d));
|
|
1995
1956
|
}
|
|
1996
1957
|
/**
|
|
@@ -2000,7 +1961,7 @@ class De {
|
|
|
2000
1961
|
return Math.max(i, Math.min(e, t));
|
|
2001
1962
|
}
|
|
2002
1963
|
}
|
|
2003
|
-
var
|
|
1964
|
+
var x = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(x || {});
|
|
2004
1965
|
const Mt = {
|
|
2005
1966
|
// Geometric shapes - uses percentages for responsive sizing
|
|
2006
1967
|
circle: "circle(50%)",
|
|
@@ -2010,7 +1971,7 @@ const Mt = {
|
|
|
2010
1971
|
hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
|
2011
1972
|
octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
|
|
2012
1973
|
diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
|
|
2013
|
-
},
|
|
1974
|
+
}, De = {
|
|
2014
1975
|
// Circle - uses radius in pixels (refHeight of 100px = 50px radius)
|
|
2015
1976
|
circle: {
|
|
2016
1977
|
refHeight: 100,
|
|
@@ -2053,15 +2014,15 @@ function $e(o) {
|
|
|
2053
2014
|
return o in Mt ? Mt[o] : o;
|
|
2054
2015
|
}
|
|
2055
2016
|
function Pe(o, t, i) {
|
|
2056
|
-
const e =
|
|
2017
|
+
const e = De[o];
|
|
2057
2018
|
if (!e) return "";
|
|
2058
2019
|
const n = t / e.refHeight;
|
|
2059
2020
|
if (o === "circle")
|
|
2060
2021
|
return `circle(${Math.round(50 * n * 100) / 100}px)`;
|
|
2061
|
-
const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * n,
|
|
2022
|
+
const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * n, l = (Math.min(...r) + Math.max(...r)) / 2 * n, c = (Math.max(...a) - Math.min(...a)) * n, u = (i ?? c) / 2, h = t / 2, d = u - s, f = h - l;
|
|
2062
2023
|
return `polygon(${e.points.map(([p, g]) => {
|
|
2063
|
-
const m = Math.round((p * n + d) * 100) / 100,
|
|
2064
|
-
return `${m}px ${
|
|
2024
|
+
const m = Math.round((p * n + d) * 100) / 100, b = Math.round((g * n + f) * 100) / 100;
|
|
2025
|
+
return `${m}px ${b}px`;
|
|
2065
2026
|
}).join(", ")})`;
|
|
2066
2027
|
}
|
|
2067
2028
|
function Ue(o) {
|
|
@@ -2070,7 +2031,7 @@ function Ue(o) {
|
|
|
2070
2031
|
function He(o) {
|
|
2071
2032
|
return o ? Ue(o) ? mt[o] : o : mt.md;
|
|
2072
2033
|
}
|
|
2073
|
-
function
|
|
2034
|
+
function Ne(o) {
|
|
2074
2035
|
if (!o) return "";
|
|
2075
2036
|
const t = [];
|
|
2076
2037
|
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)
|
|
@@ -2096,34 +2057,34 @@ function et(o, t, i) {
|
|
|
2096
2057
|
o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : s && (e.borderTopLeftRadius = `${s}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : s && (e.borderTopRightRadius = `${s}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : s && (e.borderBottomRightRadius = `${s}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : s && (e.borderBottomLeftRadius = `${s}px`);
|
|
2097
2058
|
} else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
|
|
2098
2059
|
if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
|
|
2099
|
-
const s = o.border || {},
|
|
2100
|
-
e.borderTop = tt(
|
|
2060
|
+
const s = o.border || {}, l = { ...s, ...o.borderTop }, c = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, h = { ...s, ...o.borderLeft };
|
|
2061
|
+
e.borderTop = tt(l), e.borderRight = tt(c), e.borderBottom = tt(u), e.borderLeft = tt(h);
|
|
2101
2062
|
} else o.border && (e.border = tt(o.border));
|
|
2102
2063
|
o.shadow !== void 0 && (e.boxShadow = He(o.shadow));
|
|
2103
|
-
const r =
|
|
2064
|
+
const r = Ne(o.filter);
|
|
2104
2065
|
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) {
|
|
2105
|
-
const s = o.outline.width ?? 0,
|
|
2106
|
-
e.outline = `${s}px ${
|
|
2066
|
+
const s = o.outline.width ?? 0, l = o.outline.style ?? "solid", c = o.outline.color ?? "#000000";
|
|
2067
|
+
e.outline = `${s}px ${l} ${c}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
2107
2068
|
}
|
|
2108
2069
|
if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
|
|
2109
2070
|
let s;
|
|
2110
|
-
const
|
|
2111
|
-
if (
|
|
2112
|
-
s = Pe(
|
|
2071
|
+
const l = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, c = l ? o.clipPath : void 0;
|
|
2072
|
+
if (c?.mode === "height-relative" && t)
|
|
2073
|
+
s = Pe(c.shape, t, i);
|
|
2113
2074
|
else {
|
|
2114
|
-
const u =
|
|
2075
|
+
const u = l && c ? c.shape : o.clipPath;
|
|
2115
2076
|
s = $e(u);
|
|
2116
2077
|
}
|
|
2117
2078
|
s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
|
|
2118
2079
|
}
|
|
2119
2080
|
return e;
|
|
2120
2081
|
}
|
|
2121
|
-
function
|
|
2082
|
+
function ke(o, t) {
|
|
2122
2083
|
t.borderRadius !== void 0 && (o.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (o.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (o.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (o.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (o.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (o.style.border = t.border), t.borderTop !== void 0 && (o.style.borderTop = t.borderTop), t.borderRight !== void 0 && (o.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (o.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (o.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (o.style.boxShadow = t.boxShadow), t.filter !== void 0 && (o.style.filter = t.filter), t.opacity !== void 0 && (o.style.opacity = t.opacity), t.cursor !== void 0 && (o.style.cursor = t.cursor), t.outline !== void 0 && (o.style.outline = t.outline), t.outlineOffset !== void 0 && (o.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (o.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (o.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (o.style.clipPath = t.clipPath), t.overflow !== void 0 && (o.style.overflow = t.overflow);
|
|
2123
2084
|
}
|
|
2124
2085
|
function ft(o, t, i, e) {
|
|
2125
2086
|
const n = et(t, i, e);
|
|
2126
|
-
|
|
2087
|
+
ke(o, n);
|
|
2127
2088
|
}
|
|
2128
2089
|
function Pt(o) {
|
|
2129
2090
|
return o ? Array.isArray(o) ? o.join(" ") : o : "";
|
|
@@ -2146,7 +2107,7 @@ const Ft = {
|
|
|
2146
2107
|
};
|
|
2147
2108
|
class je {
|
|
2148
2109
|
constructor(t, i, e) {
|
|
2149
|
-
this.state =
|
|
2110
|
+
this.state = x.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;
|
|
2150
2111
|
}
|
|
2151
2112
|
/**
|
|
2152
2113
|
* Set callback to be fired when an unfocus animation fully completes.
|
|
@@ -2164,7 +2125,7 @@ class je {
|
|
|
2164
2125
|
* Check if any animation is in progress
|
|
2165
2126
|
*/
|
|
2166
2127
|
isAnimating() {
|
|
2167
|
-
return this.state !==
|
|
2128
|
+
return this.state !== x.IDLE && this.state !== x.FOCUSED;
|
|
2168
2129
|
}
|
|
2169
2130
|
/**
|
|
2170
2131
|
* Normalize scalePercent value
|
|
@@ -2178,9 +2139,9 @@ class je {
|
|
|
2178
2139
|
*/
|
|
2179
2140
|
calculateFocusDimensions(t, i, e) {
|
|
2180
2141
|
const n = this.normalizeScalePercent(this.config.scalePercent), a = e.height * n, r = t / i;
|
|
2181
|
-
let s = a,
|
|
2182
|
-
const
|
|
2183
|
-
return
|
|
2142
|
+
let s = a, l = s * r;
|
|
2143
|
+
const c = e.width * n;
|
|
2144
|
+
return l > c && (l = c, s = l / r), { width: l, height: s };
|
|
2184
2145
|
}
|
|
2185
2146
|
/**
|
|
2186
2147
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
@@ -2211,12 +2172,12 @@ class je {
|
|
|
2211
2172
|
* Create a Web Animation that animates both transform (position) and dimensions
|
|
2212
2173
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
2213
2174
|
*/
|
|
2214
|
-
animateWithDimensions(t, i, e, n, a, r, s,
|
|
2215
|
-
const
|
|
2175
|
+
animateWithDimensions(t, i, e, n, a, r, s, l) {
|
|
2176
|
+
const c = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
|
|
2216
2177
|
return t.style.transition = "none", t.animate(
|
|
2217
2178
|
[
|
|
2218
2179
|
{
|
|
2219
|
-
transform:
|
|
2180
|
+
transform: c,
|
|
2220
2181
|
width: `${n}px`,
|
|
2221
2182
|
height: `${a}px`
|
|
2222
2183
|
},
|
|
@@ -2227,7 +2188,7 @@ class je {
|
|
|
2227
2188
|
}
|
|
2228
2189
|
],
|
|
2229
2190
|
{
|
|
2230
|
-
duration:
|
|
2191
|
+
duration: l,
|
|
2231
2192
|
easing: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
2232
2193
|
fill: "forwards"
|
|
2233
2194
|
}
|
|
@@ -2261,8 +2222,8 @@ class je {
|
|
|
2261
2222
|
let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
|
|
2262
2223
|
e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
|
|
2263
2224
|
const a = () => {
|
|
2264
|
-
const r = t.offsetHeight, s = t.offsetWidth,
|
|
2265
|
-
|
|
2225
|
+
const r = t.offsetHeight, s = t.offsetWidth, l = et(n, r, s);
|
|
2226
|
+
l.clipPath !== void 0 ? t.style.clipPath = l.clipPath : t.style.clipPath = "unset", l.overflow !== void 0 && (t.style.overflow = l.overflow), i.animation.playState === "running" && requestAnimationFrame(a);
|
|
2266
2227
|
};
|
|
2267
2228
|
requestAnimationFrame(a);
|
|
2268
2229
|
}
|
|
@@ -2273,7 +2234,7 @@ class je {
|
|
|
2273
2234
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2274
2235
|
*/
|
|
2275
2236
|
startFocusAnimation(t, i, e, n, a) {
|
|
2276
|
-
const r = t.style.zIndex || "", s = t.offsetWidth,
|
|
2237
|
+
const r = t.style.zIndex || "", s = t.offsetWidth, l = t.offsetHeight, c = this.calculateFocusDimensions(s, l, i), u = this.calculateFocusTransform(i, e);
|
|
2277
2238
|
this.animationEngine.cancelAllAnimations(t);
|
|
2278
2239
|
const h = this.config.animationDuration ?? 600;
|
|
2279
2240
|
this.applyFocusedStyling(t, Ft.FOCUSING);
|
|
@@ -2283,14 +2244,14 @@ class je {
|
|
|
2283
2244
|
rotation: e.rotation,
|
|
2284
2245
|
scale: 1
|
|
2285
2246
|
// No scale - using dimensions
|
|
2286
|
-
}, f = a?.width ?? s,
|
|
2247
|
+
}, f = a?.width ?? s, y = a?.height ?? l, p = this.animateWithDimensions(
|
|
2287
2248
|
t,
|
|
2288
2249
|
d,
|
|
2289
2250
|
u,
|
|
2290
2251
|
f,
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2252
|
+
y,
|
|
2253
|
+
c.width,
|
|
2254
|
+
c.height,
|
|
2294
2255
|
h
|
|
2295
2256
|
), g = {
|
|
2296
2257
|
id: `focus-${Date.now()}`,
|
|
@@ -2307,16 +2268,16 @@ class je {
|
|
|
2307
2268
|
focusTransform: u,
|
|
2308
2269
|
originalZIndex: r,
|
|
2309
2270
|
originalWidth: s,
|
|
2310
|
-
originalHeight:
|
|
2311
|
-
focusWidth:
|
|
2312
|
-
focusHeight:
|
|
2271
|
+
originalHeight: l,
|
|
2272
|
+
focusWidth: c.width,
|
|
2273
|
+
focusHeight: c.height
|
|
2313
2274
|
}, this.startClipPathAnimation(t, g, !0), {
|
|
2314
2275
|
element: t,
|
|
2315
2276
|
originalState: e,
|
|
2316
2277
|
animationHandle: g,
|
|
2317
2278
|
direction: "in",
|
|
2318
2279
|
originalWidth: s,
|
|
2319
|
-
originalHeight:
|
|
2280
|
+
originalHeight: l
|
|
2320
2281
|
};
|
|
2321
2282
|
}
|
|
2322
2283
|
/**
|
|
@@ -2328,7 +2289,7 @@ class je {
|
|
|
2328
2289
|
t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2329
2290
|
const a = this.config.animationDuration ?? 600;
|
|
2330
2291
|
t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
|
|
2331
|
-
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth,
|
|
2292
|
+
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, l = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, c = {
|
|
2332
2293
|
x: 0,
|
|
2333
2294
|
y: 0,
|
|
2334
2295
|
rotation: i.rotation,
|
|
@@ -2337,9 +2298,9 @@ class je {
|
|
|
2337
2298
|
}, u = this.focusData?.originalWidth ?? t.offsetWidth, h = this.focusData?.originalHeight ?? t.offsetHeight, d = this.animateWithDimensions(
|
|
2338
2299
|
t,
|
|
2339
2300
|
r,
|
|
2340
|
-
l,
|
|
2341
|
-
s,
|
|
2342
2301
|
c,
|
|
2302
|
+
s,
|
|
2303
|
+
l,
|
|
2343
2304
|
u,
|
|
2344
2305
|
h,
|
|
2345
2306
|
a
|
|
@@ -2348,7 +2309,7 @@ class je {
|
|
|
2348
2309
|
element: t,
|
|
2349
2310
|
animation: d,
|
|
2350
2311
|
fromState: r,
|
|
2351
|
-
toState:
|
|
2312
|
+
toState: c,
|
|
2352
2313
|
startTime: performance.now(),
|
|
2353
2314
|
duration: a
|
|
2354
2315
|
};
|
|
@@ -2376,9 +2337,9 @@ class je {
|
|
|
2376
2337
|
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
2377
2338
|
*/
|
|
2378
2339
|
captureMidAnimationState(t) {
|
|
2379
|
-
const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, a = t.offsetHeight, r = e.e + n * 0.5, s = e.f + a * 0.5,
|
|
2380
|
-
return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${
|
|
2381
|
-
transform: { x: r, y: s, rotation:
|
|
2340
|
+
const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, a = t.offsetHeight, r = e.e + n * 0.5, s = e.f + a * 0.5, l = Math.atan2(e.b, e.a) * (180 / Math.PI);
|
|
2341
|
+
return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${l}deg)`, t.style.transition = "none", {
|
|
2342
|
+
transform: { x: r, y: s, rotation: l, scale: 1 },
|
|
2382
2343
|
dimensions: { width: n, height: a }
|
|
2383
2344
|
};
|
|
2384
2345
|
}
|
|
@@ -2404,26 +2365,26 @@ class je {
|
|
|
2404
2365
|
* Implements cross-animation when swapping focus
|
|
2405
2366
|
*/
|
|
2406
2367
|
async focusImage(t, i, e) {
|
|
2407
|
-
if (this.currentFocus === t && this.state ===
|
|
2368
|
+
if (this.currentFocus === t && this.state === x.FOCUSED)
|
|
2408
2369
|
return this.unfocusImage();
|
|
2409
|
-
if (this.incoming?.element === t && this.state ===
|
|
2370
|
+
if (this.incoming?.element === t && this.state === x.FOCUSING) {
|
|
2410
2371
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
|
|
2411
2372
|
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2412
2373
|
t,
|
|
2413
2374
|
this.incoming.originalState,
|
|
2414
2375
|
a,
|
|
2415
2376
|
r
|
|
2416
|
-
), this.incoming = null, this.state =
|
|
2377
|
+
), this.incoming = null, this.state = x.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 = x.IDLE;
|
|
2417
2378
|
return;
|
|
2418
2379
|
}
|
|
2419
2380
|
const n = ++this.focusGeneration;
|
|
2420
2381
|
switch (this.state) {
|
|
2421
|
-
case
|
|
2422
|
-
if (this.state =
|
|
2423
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2382
|
+
case x.IDLE:
|
|
2383
|
+
if (this.state = x.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2384
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2424
2385
|
break;
|
|
2425
|
-
case
|
|
2426
|
-
if (this.state =
|
|
2386
|
+
case x.FOCUSED:
|
|
2387
|
+
if (this.state = x.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2427
2388
|
this.currentFocus,
|
|
2428
2389
|
this.focusData.originalState
|
|
2429
2390
|
)), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
@@ -2435,9 +2396,9 @@ class je {
|
|
|
2435
2396
|
const a = this.outgoing.element;
|
|
2436
2397
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2437
2398
|
}
|
|
2438
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2399
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2439
2400
|
break;
|
|
2440
|
-
case
|
|
2401
|
+
case x.FOCUSING:
|
|
2441
2402
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2442
2403
|
this.incoming.element,
|
|
2443
2404
|
this.incoming.originalState,
|
|
@@ -2445,10 +2406,10 @@ class je {
|
|
|
2445
2406
|
this.focusData?.originalWidth,
|
|
2446
2407
|
this.focusData?.originalHeight
|
|
2447
2408
|
), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2448
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2409
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2449
2410
|
break;
|
|
2450
|
-
case
|
|
2451
|
-
if (this.state =
|
|
2411
|
+
case x.UNFOCUSING:
|
|
2412
|
+
if (this.state = x.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
2452
2413
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2453
2414
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2454
2415
|
]), this.focusGeneration !== n) return;
|
|
@@ -2456,20 +2417,20 @@ class je {
|
|
|
2456
2417
|
const a = this.outgoing.element;
|
|
2457
2418
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2458
2419
|
}
|
|
2459
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2420
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2460
2421
|
break;
|
|
2461
|
-
case
|
|
2422
|
+
case x.CROSS_ANIMATING:
|
|
2462
2423
|
if (this.incoming?.element === t)
|
|
2463
2424
|
return;
|
|
2464
2425
|
if (this.outgoing?.element === t) {
|
|
2465
2426
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
|
|
2466
2427
|
if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
|
|
2467
|
-
const { transform: s, dimensions:
|
|
2428
|
+
const { transform: s, dimensions: l } = this.captureMidAnimationState(this.incoming.element);
|
|
2468
2429
|
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2469
2430
|
this.incoming.element,
|
|
2470
2431
|
this.incoming.originalState,
|
|
2471
2432
|
s,
|
|
2472
|
-
|
|
2433
|
+
l
|
|
2473
2434
|
);
|
|
2474
2435
|
} else
|
|
2475
2436
|
this.outgoing = null;
|
|
@@ -2481,7 +2442,7 @@ class je {
|
|
|
2481
2442
|
const s = this.outgoing.element;
|
|
2482
2443
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2483
2444
|
}
|
|
2484
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2445
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2485
2446
|
return;
|
|
2486
2447
|
}
|
|
2487
2448
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2507,7 +2468,7 @@ class je {
|
|
|
2507
2468
|
const a = this.outgoing.element;
|
|
2508
2469
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2509
2470
|
}
|
|
2510
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2471
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2511
2472
|
break;
|
|
2512
2473
|
}
|
|
2513
2474
|
}
|
|
@@ -2515,24 +2476,24 @@ class je {
|
|
|
2515
2476
|
* Unfocus current image, returning it to original position
|
|
2516
2477
|
*/
|
|
2517
2478
|
async unfocusImage() {
|
|
2518
|
-
if (this.state ===
|
|
2479
|
+
if (this.state === x.UNFOCUSING)
|
|
2519
2480
|
return;
|
|
2520
2481
|
const t = ++this.focusGeneration;
|
|
2521
2482
|
if (!this.currentFocus || !this.focusData) {
|
|
2522
|
-
if (this.incoming && this.state ===
|
|
2483
|
+
if (this.incoming && this.state === x.FOCUSING) {
|
|
2523
2484
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2524
2485
|
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2525
2486
|
this.incoming.element,
|
|
2526
2487
|
this.incoming.originalState,
|
|
2527
2488
|
a,
|
|
2528
2489
|
r
|
|
2529
|
-
), this.incoming = null, this.state =
|
|
2490
|
+
), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2530
2491
|
const s = this.outgoing.element;
|
|
2531
|
-
this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state =
|
|
2492
|
+
this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(s);
|
|
2532
2493
|
}
|
|
2533
2494
|
return;
|
|
2534
2495
|
}
|
|
2535
|
-
if (this.state ===
|
|
2496
|
+
if (this.state === x.CROSS_ANIMATING && this.incoming) {
|
|
2536
2497
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2537
2498
|
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2538
2499
|
const s = this.startUnfocusAnimation(
|
|
@@ -2545,15 +2506,15 @@ class je {
|
|
|
2545
2506
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2546
2507
|
this.waitForAnimation(s.animationHandle)
|
|
2547
2508
|
]), this.focusGeneration !== t) return;
|
|
2548
|
-
let
|
|
2549
|
-
this.outgoing && (
|
|
2550
|
-
const
|
|
2551
|
-
this.removeFocusedStyling(
|
|
2509
|
+
let l = null;
|
|
2510
|
+
this.outgoing && (l = this.outgoing.element, this.removeFocusedStyling(l, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2511
|
+
const c = s.element;
|
|
2512
|
+
this.removeFocusedStyling(c, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, l && this.onUnfocusComplete?.(l), this.onUnfocusComplete?.(c);
|
|
2552
2513
|
return;
|
|
2553
2514
|
}
|
|
2554
|
-
this.state =
|
|
2515
|
+
this.state = x.UNFOCUSING;
|
|
2555
2516
|
const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2556
|
-
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 =
|
|
2517
|
+
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 = x.IDLE, this.onUnfocusComplete?.(i));
|
|
2557
2518
|
}
|
|
2558
2519
|
/**
|
|
2559
2520
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2571,7 +2532,7 @@ class je {
|
|
|
2571
2532
|
* Check if an image is currently focused (stable state)
|
|
2572
2533
|
*/
|
|
2573
2534
|
isFocused(t) {
|
|
2574
|
-
return this.currentFocus === t && this.state ===
|
|
2535
|
+
return this.currentFocus === t && this.state === x.FOCUSED;
|
|
2575
2536
|
}
|
|
2576
2537
|
/**
|
|
2577
2538
|
* Check if an image is the target of current focus animation
|
|
@@ -2592,7 +2553,7 @@ class je {
|
|
|
2592
2553
|
* Used during swipe gestures for visual feedback
|
|
2593
2554
|
*/
|
|
2594
2555
|
setDragOffset(t) {
|
|
2595
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2556
|
+
if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
|
|
2596
2557
|
const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], a = (e.x ?? 0) + t, r = e.y ?? 0;
|
|
2597
2558
|
n.push(`translate(${a}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
|
|
2598
2559
|
}
|
|
@@ -2602,13 +2563,13 @@ class je {
|
|
|
2602
2563
|
* @param duration - Animation duration in ms (default 150)
|
|
2603
2564
|
*/
|
|
2604
2565
|
clearDragOffset(t, i = 150) {
|
|
2605
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2566
|
+
if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
|
|
2606
2567
|
const e = this.currentFocus, n = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = n.x ?? 0, s = n.y ?? 0;
|
|
2607
2568
|
a.push(`translate(${r}px, ${s}px)`), n.rotation !== void 0 && a.push(`rotate(${n.rotation}deg)`);
|
|
2608
|
-
const
|
|
2609
|
-
t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform =
|
|
2569
|
+
const l = a.join(" ");
|
|
2570
|
+
t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = l, setTimeout(() => {
|
|
2610
2571
|
this.currentFocus === e && (e.style.transition = "none");
|
|
2611
|
-
}, i)) : (e.style.transition = "none", e.style.transform =
|
|
2572
|
+
}, i)) : (e.style.transition = "none", e.style.transform = l);
|
|
2612
2573
|
}
|
|
2613
2574
|
/**
|
|
2614
2575
|
* Reset zoom state (cancels all animations)
|
|
@@ -2632,7 +2593,7 @@ class je {
|
|
|
2632
2593
|
this.focusData.originalZIndex,
|
|
2633
2594
|
this.focusData.originalWidth,
|
|
2634
2595
|
this.focusData.originalHeight
|
|
2635
|
-
), this.state =
|
|
2596
|
+
), this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2636
2597
|
}
|
|
2637
2598
|
}
|
|
2638
2599
|
const We = 50, Ge = 0.5, qe = 20, Be = 0.3, Xe = 150, Ye = 30, at = class at {
|
|
@@ -2702,7 +2663,7 @@ const We = 50, Ge = 0.5, qe = 20, Be = 0.3, Xe = 150, Ye = 30, at = class at {
|
|
|
2702
2663
|
}
|
|
2703
2664
|
};
|
|
2704
2665
|
at.TOUCH_CLICK_DELAY = 300;
|
|
2705
|
-
let
|
|
2666
|
+
let yt = at;
|
|
2706
2667
|
class Je {
|
|
2707
2668
|
constructor(t) {
|
|
2708
2669
|
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)
|
|
@@ -2798,10 +2759,10 @@ class Je {
|
|
|
2798
2759
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2799
2760
|
if (!s.ok)
|
|
2800
2761
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2801
|
-
const
|
|
2762
|
+
const c = (await s.json()).files.filter(
|
|
2802
2763
|
(u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
|
|
2803
2764
|
);
|
|
2804
|
-
return this.log(`Found ${
|
|
2765
|
+
return this.log(`Found ${c.length} images in folder ${t} (non-recursive)`), c.forEach((u) => {
|
|
2805
2766
|
e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2806
2767
|
}), e;
|
|
2807
2768
|
}
|
|
@@ -2823,8 +2784,8 @@ class Je {
|
|
|
2823
2784
|
try {
|
|
2824
2785
|
const r = `${this.apiEndpoint}/${a}?fields=name,mimeType&key=${this.apiKey}`, s = await fetch(r);
|
|
2825
2786
|
if (s.ok) {
|
|
2826
|
-
const
|
|
2827
|
-
|
|
2787
|
+
const l = await s.json();
|
|
2788
|
+
l.mimeType.startsWith("image/") && i.isAllowed(l.name) ? (e.push(`https://lh3.googleusercontent.com/d/${a}=s1600`), this.log(`Added file: ${l.name}`)) : this.log(`Skipping non-image file: ${l.name} (${l.mimeType})`);
|
|
2828
2789
|
} else
|
|
2829
2790
|
this.log(`Failed to fetch metadata for file ${a}: ${s.status}`);
|
|
2830
2791
|
} catch (r) {
|
|
@@ -2868,12 +2829,12 @@ class Je {
|
|
|
2868
2829
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2869
2830
|
if (!s.ok)
|
|
2870
2831
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2871
|
-
const
|
|
2832
|
+
const l = await s.json(), c = l.files.filter(
|
|
2872
2833
|
(h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
|
|
2873
|
-
), u =
|
|
2834
|
+
), u = l.files.filter(
|
|
2874
2835
|
(h) => h.mimeType === "application/vnd.google-apps.folder"
|
|
2875
2836
|
);
|
|
2876
|
-
this.log(`Found ${
|
|
2837
|
+
this.log(`Found ${l.files.length} total items in folder ${t}`), l.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${c.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), c.forEach((h) => {
|
|
2877
2838
|
e.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
|
|
2878
2839
|
});
|
|
2879
2840
|
for (const h of u) {
|
|
@@ -3257,11 +3218,11 @@ function ti() {
|
|
|
3257
3218
|
}
|
|
3258
3219
|
class ei {
|
|
3259
3220
|
constructor(t = {}) {
|
|
3260
|
-
this.fullConfig = te(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new oe(this.fullConfig.animation), this.layoutEngine = new
|
|
3221
|
+
this.fullConfig = te(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new oe(this.fullConfig.animation), this.layoutEngine = new _e({
|
|
3261
3222
|
layout: this.fullConfig.layout,
|
|
3262
3223
|
image: this.fullConfig.image
|
|
3263
3224
|
}), this.zoomEngine = new je(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = et(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3264
|
-
const i = this.fullConfig.animation.entry ||
|
|
3225
|
+
const i = this.fullConfig.animation.entry || R.animation.entry;
|
|
3265
3226
|
this.entryAnimationEngine = new me(
|
|
3266
3227
|
i,
|
|
3267
3228
|
this.fullConfig.layout.algorithm
|
|
@@ -3328,20 +3289,20 @@ class ei {
|
|
|
3328
3289
|
this.containerEl = this.containerRef;
|
|
3329
3290
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
3330
3291
|
throw new Error(`Container #${this.containerId} not found`);
|
|
3331
|
-
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new
|
|
3292
|
+
this.containerEl.classList.add("fbn-ic-gallery"), this.containerEl.setAttribute("tabindex", "0"), this.fullConfig.interaction.navigation?.swipe !== !1 && (this.swipeEngine = new yt(this.containerEl, {
|
|
3332
3293
|
onNext: () => this.navigateToNextImage(),
|
|
3333
3294
|
onPrev: () => this.navigateToPreviousImage(),
|
|
3334
3295
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
3335
3296
|
onDragEnd: (t) => {
|
|
3336
3297
|
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Xe);
|
|
3337
3298
|
}
|
|
3338
|
-
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3299
|
+
})), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3339
3300
|
} catch (t) {
|
|
3340
3301
|
console.error("Gallery initialization failed:", t), this.errorEl && t instanceof Error && this.showError("Gallery failed to initialize: " + t.message);
|
|
3341
3302
|
}
|
|
3342
3303
|
}
|
|
3343
3304
|
setupUI() {
|
|
3344
|
-
const t = this.fullConfig.
|
|
3305
|
+
const t = this.fullConfig.ui;
|
|
3345
3306
|
t.showLoadingSpinner && (t.loadingElement ? (this.loadingEl = this.resolveElement(t.loadingElement), this.loadingElAutoCreated = !1) : (this.loadingEl = this.createDefaultLoadingElement(), this.loadingElAutoCreated = !0)), t.errorElement ? (this.errorEl = this.resolveElement(t.errorElement), this.errorElAutoCreated = !1) : (this.errorEl = this.createDefaultErrorElement(), this.errorElAutoCreated = !0), t.showImageCounter && (t.counterElement ? (this.counterEl = this.resolveElement(t.counterElement), this.counterElAutoCreated = !1) : (this.counterEl = this.createDefaultCounterElement(), this.counterElAutoCreated = !0));
|
|
3346
3307
|
}
|
|
3347
3308
|
resolveElement(t) {
|
|
@@ -3364,7 +3325,7 @@ class ei {
|
|
|
3364
3325
|
return t.className = "fbn-ic-counter fbn-ic-hidden", this.containerEl.appendChild(t), t;
|
|
3365
3326
|
}
|
|
3366
3327
|
setupEventListeners() {
|
|
3367
|
-
|
|
3328
|
+
this.fullConfig.interaction.navigation?.keyboard !== !1 && this.containerEl.addEventListener("keydown", (t) => {
|
|
3368
3329
|
t.key === "Escape" ? (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter()) : t.key === "ArrowRight" ? this.navigateToNextImage() : t.key === "ArrowLeft" ? this.navigateToPreviousImage() : (t.key === "Enter" || t.key === " ") && this.hoveredImage && (this.handleImageClick(this.hoveredImage.element, this.hoveredImage.layout), t.preventDefault());
|
|
3369
3330
|
}), document.addEventListener("click", (t) => {
|
|
3370
3331
|
this.swipeEngine?.hadRecentTouch() || t.target.closest(".fbn-ic-image") || (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter());
|
|
@@ -3454,59 +3415,59 @@ class ei {
|
|
|
3454
3415
|
const n = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
|
|
3455
3416
|
this.imageLayouts = a, this.displayQueue = [];
|
|
3456
3417
|
let r = 0;
|
|
3457
|
-
const s = (
|
|
3458
|
-
this.containerEl && (this.containerEl.appendChild(
|
|
3459
|
-
if (
|
|
3418
|
+
const s = (c) => {
|
|
3419
|
+
this.containerEl && (this.containerEl.appendChild(c), this.imageElements.push(c), requestAnimationFrame(() => {
|
|
3420
|
+
if (c.offsetWidth, c.style.opacity = this.defaultStyles.opacity ?? "1", c.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || c.dataset.startRotation !== c.dataset.rotation || c.dataset.startScale !== c.dataset.scale)) {
|
|
3460
3421
|
const d = {
|
|
3461
|
-
x: parseFloat(
|
|
3462
|
-
y: parseFloat(
|
|
3422
|
+
x: parseFloat(c.dataset.startX),
|
|
3423
|
+
y: parseFloat(c.dataset.startY)
|
|
3463
3424
|
}, f = {
|
|
3464
|
-
x: parseFloat(
|
|
3465
|
-
y: parseFloat(
|
|
3466
|
-
},
|
|
3425
|
+
x: parseFloat(c.dataset.endX),
|
|
3426
|
+
y: parseFloat(c.dataset.endY)
|
|
3427
|
+
}, y = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation), m = parseFloat(c.dataset.scale), b = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : g, w = c.dataset.startScale ? parseFloat(c.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
|
|
3467
3428
|
ue({
|
|
3468
|
-
element:
|
|
3429
|
+
element: c,
|
|
3469
3430
|
startPosition: d,
|
|
3470
3431
|
endPosition: f,
|
|
3471
3432
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3472
3433
|
duration: v.duration,
|
|
3473
|
-
imageWidth:
|
|
3434
|
+
imageWidth: y,
|
|
3474
3435
|
imageHeight: p,
|
|
3475
3436
|
rotation: g,
|
|
3476
3437
|
scale: m,
|
|
3477
3438
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3478
|
-
startRotation:
|
|
3439
|
+
startRotation: b,
|
|
3479
3440
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3480
3441
|
startScale: w
|
|
3481
3442
|
});
|
|
3482
3443
|
} else {
|
|
3483
|
-
const d =
|
|
3484
|
-
|
|
3444
|
+
const d = c.dataset.finalTransform || "";
|
|
3445
|
+
c.style.transform = d;
|
|
3485
3446
|
}
|
|
3486
|
-
const h = parseInt(
|
|
3447
|
+
const h = parseInt(c.dataset.imageId || "0");
|
|
3487
3448
|
if (this.fullConfig.config.debug?.enabled && h < 3) {
|
|
3488
|
-
const d =
|
|
3449
|
+
const d = c.dataset.finalTransform || "";
|
|
3489
3450
|
console.log(`Image ${h} final state:`, {
|
|
3490
|
-
left:
|
|
3491
|
-
top:
|
|
3492
|
-
width:
|
|
3493
|
-
height:
|
|
3494
|
-
computedWidth:
|
|
3495
|
-
computedHeight:
|
|
3451
|
+
left: c.style.left,
|
|
3452
|
+
top: c.style.top,
|
|
3453
|
+
width: c.style.width,
|
|
3454
|
+
height: c.style.height,
|
|
3455
|
+
computedWidth: c.offsetWidth,
|
|
3456
|
+
computedHeight: c.offsetHeight,
|
|
3496
3457
|
transform: d,
|
|
3497
3458
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3498
3459
|
});
|
|
3499
3460
|
}
|
|
3500
3461
|
if (this.idleAnimationEngine) {
|
|
3501
3462
|
const d = this.entryAnimationEngine.getTiming().duration;
|
|
3502
|
-
this.idleAnimationEngine.register(
|
|
3463
|
+
this.idleAnimationEngine.register(c, h, this.imageElements.length, d);
|
|
3503
3464
|
}
|
|
3504
3465
|
}), r++);
|
|
3505
|
-
},
|
|
3466
|
+
}, l = () => {
|
|
3506
3467
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3507
3468
|
for (; this.displayQueue.length > 0; ) {
|
|
3508
|
-
const
|
|
3509
|
-
|
|
3469
|
+
const c = this.displayQueue.shift();
|
|
3470
|
+
c && s(c);
|
|
3510
3471
|
}
|
|
3511
3472
|
return;
|
|
3512
3473
|
}
|
|
@@ -3516,29 +3477,29 @@ class ei {
|
|
|
3516
3477
|
return;
|
|
3517
3478
|
}
|
|
3518
3479
|
if (this.displayQueue.length > 0) {
|
|
3519
|
-
const
|
|
3520
|
-
|
|
3480
|
+
const c = this.displayQueue.shift();
|
|
3481
|
+
c && s(c);
|
|
3521
3482
|
}
|
|
3522
3483
|
r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3523
3484
|
}, this.fullConfig.animation.queue.interval);
|
|
3524
3485
|
};
|
|
3525
3486
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3526
|
-
const
|
|
3487
|
+
const c = new IntersectionObserver((u) => {
|
|
3527
3488
|
u.forEach((h) => {
|
|
3528
|
-
h.isIntersecting && (
|
|
3489
|
+
h.isIntersecting && (l(), c.disconnect());
|
|
3529
3490
|
});
|
|
3530
3491
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3531
|
-
|
|
3492
|
+
c.observe(this.containerEl);
|
|
3532
3493
|
} else
|
|
3533
|
-
|
|
3534
|
-
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((
|
|
3494
|
+
l();
|
|
3495
|
+
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), a.forEach((c, u) => {
|
|
3535
3496
|
const h = document.createElement("div");
|
|
3536
3497
|
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";
|
|
3537
|
-
const d =
|
|
3498
|
+
const d = c.x, f = c.y;
|
|
3538
3499
|
h.style.left = `${d - 6}px`, h.style.top = `${f - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(f)})`, this.containerEl.appendChild(h);
|
|
3539
|
-
})), t.forEach((
|
|
3500
|
+
})), t.forEach((c, u) => {
|
|
3540
3501
|
const h = document.createElement("img");
|
|
3541
|
-
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.
|
|
3502
|
+
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
|
|
3542
3503
|
const d = a[u];
|
|
3543
3504
|
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), st(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
|
|
3544
3505
|
if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
|
|
@@ -3555,27 +3516,27 @@ class ei {
|
|
|
3555
3516
|
}), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
|
|
3556
3517
|
if (n !== this.loadGeneration)
|
|
3557
3518
|
return;
|
|
3558
|
-
const f = h.naturalWidth / h.naturalHeight,
|
|
3559
|
-
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${
|
|
3560
|
-
const p = { x: d.x, y: d.y }, g = { width:
|
|
3519
|
+
const f = h.naturalWidth / h.naturalHeight, y = i * f;
|
|
3520
|
+
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${y}`), h.style.width = `${y}px`, h.cachedRenderedWidth = y, h.aspectRatio = f, ft(h, this.fullConfig.styling?.default, i, y);
|
|
3521
|
+
const p = { x: d.x, y: d.y }, g = { width: y, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
|
|
3561
3522
|
p,
|
|
3562
3523
|
g,
|
|
3563
3524
|
e,
|
|
3564
3525
|
u,
|
|
3565
3526
|
t.length
|
|
3566
|
-
),
|
|
3527
|
+
), b = this.entryAnimationEngine.calculateStartRotation(d.rotation), w = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
|
|
3567
3528
|
d.rotation,
|
|
3568
3529
|
d.scale,
|
|
3569
|
-
|
|
3530
|
+
y,
|
|
3570
3531
|
i
|
|
3571
|
-
),
|
|
3532
|
+
), S = this.entryAnimationEngine.buildStartTransform(
|
|
3572
3533
|
m,
|
|
3573
3534
|
p,
|
|
3574
3535
|
d.rotation,
|
|
3575
3536
|
d.scale,
|
|
3576
|
-
b,
|
|
3577
|
-
i,
|
|
3578
3537
|
y,
|
|
3538
|
+
i,
|
|
3539
|
+
b,
|
|
3579
3540
|
w
|
|
3580
3541
|
);
|
|
3581
3542
|
this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
|
|
@@ -3584,10 +3545,10 @@ class ei {
|
|
|
3584
3545
|
left: d.x,
|
|
3585
3546
|
top: d.y,
|
|
3586
3547
|
finalTransform: v,
|
|
3587
|
-
renderedWidth:
|
|
3548
|
+
renderedWidth: y,
|
|
3588
3549
|
renderedHeight: i
|
|
3589
|
-
}), h.style.transform =
|
|
3590
|
-
}, h.onerror = () => r++, h.src =
|
|
3550
|
+
}), h.style.transform = S, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || b !== d.rotation || w !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(y), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(b), h.dataset.startScale = String(w)), this.displayQueue.push(h);
|
|
3551
|
+
}, h.onerror = () => r++, h.src = c;
|
|
3591
3552
|
});
|
|
3592
3553
|
}
|
|
3593
3554
|
async handleImageClick(t, i) {
|
|
@@ -3611,7 +3572,7 @@ class ei {
|
|
|
3611
3572
|
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.idleAnimationEngine?.stopAll(), this.imagesLoaded = !1;
|
|
3612
3573
|
}
|
|
3613
3574
|
showLoading(t) {
|
|
3614
|
-
!this.fullConfig.
|
|
3575
|
+
!this.fullConfig.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
|
|
3615
3576
|
}
|
|
3616
3577
|
showError(t) {
|
|
3617
3578
|
this.errorEl && (this.errorEl.textContent = t, this.errorEl.classList.remove("fbn-ic-hidden"));
|
|
@@ -3620,7 +3581,7 @@ class ei {
|
|
|
3620
3581
|
this.errorEl && this.errorEl.classList.add("fbn-ic-hidden");
|
|
3621
3582
|
}
|
|
3622
3583
|
updateCounter(t) {
|
|
3623
|
-
!this.fullConfig.
|
|
3584
|
+
!this.fullConfig.ui.showImageCounter || !this.counterEl || (this.counterEl.textContent = `${t + 1} of ${this.imageElements.length}`, this.counterEl.classList.remove("fbn-ic-hidden"));
|
|
3624
3585
|
}
|
|
3625
3586
|
hideCounter() {
|
|
3626
3587
|
this.counterEl && this.counterEl.classList.add("fbn-ic-hidden");
|
|
@@ -3691,9 +3652,9 @@ const It = class It extends HTMLElement {
|
|
|
3691
3652
|
}
|
|
3692
3653
|
};
|
|
3693
3654
|
It.observedAttributes = ["config", "images", "layout"];
|
|
3694
|
-
let
|
|
3695
|
-
typeof customElements < "u" && !customElements.get("image-cloud") && customElements.define("image-cloud",
|
|
3655
|
+
let bt = It;
|
|
3656
|
+
typeof customElements < "u" && !customElements.get("image-cloud") && customElements.define("image-cloud", bt);
|
|
3696
3657
|
export {
|
|
3697
|
-
|
|
3658
|
+
bt as ImageCloudElement
|
|
3698
3659
|
};
|
|
3699
3660
|
//# sourceMappingURL=web-component.js.map
|