@frybynite/image-cloud 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-cloud-auto-init.js +979 -853
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +1081 -955
- 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 +137 -36
- package/dist/react.d.ts +137 -36
- package/dist/react.js +776 -649
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +137 -36
- package/dist/vue.js +1057 -930
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +137 -36
- package/dist/web-component.js +774 -647
- package/dist/web-component.js.map +1 -1
- package/package.json +9 -6
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as kt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ht, useRef as St, useImperativeHandle as Nt, useEffect as Bt } from "react";
|
|
3
3
|
const mt = Object.freeze({
|
|
4
4
|
none: "none",
|
|
5
5
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
@@ -15,7 +15,7 @@ const mt = Object.freeze({
|
|
|
15
15
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
16
16
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
17
17
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
18
|
-
}),
|
|
18
|
+
}), Tt = Object.freeze({
|
|
19
19
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
20
20
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
21
21
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
@@ -24,9 +24,9 @@ const mt = Object.freeze({
|
|
|
24
24
|
type: "linear"
|
|
25
25
|
}), vt = Object.freeze({
|
|
26
26
|
mode: "none"
|
|
27
|
-
}),
|
|
27
|
+
}), xt = Object.freeze({
|
|
28
28
|
mode: "none"
|
|
29
|
-
}),
|
|
29
|
+
}), Mt = Object.freeze({
|
|
30
30
|
default: Object.freeze({
|
|
31
31
|
border: Object.freeze({
|
|
32
32
|
width: 0,
|
|
@@ -66,7 +66,7 @@ const mt = Object.freeze({
|
|
|
66
66
|
}), qt = Object.freeze({
|
|
67
67
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
68
68
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
69
|
-
}),
|
|
69
|
+
}), Yt = Object.freeze({
|
|
70
70
|
mode: "adaptive",
|
|
71
71
|
// Default to adaptive sizing
|
|
72
72
|
minSize: 50,
|
|
@@ -78,16 +78,16 @@ const mt = Object.freeze({
|
|
|
78
78
|
// No variance by default
|
|
79
79
|
max: 1
|
|
80
80
|
})
|
|
81
|
-
}),
|
|
81
|
+
}), Xt = Object.freeze({
|
|
82
82
|
mode: "none",
|
|
83
83
|
range: Object.freeze({
|
|
84
84
|
min: -15,
|
|
85
85
|
max: 15
|
|
86
86
|
})
|
|
87
|
-
}), zt = Object.freeze({
|
|
88
|
-
sizing: Xt,
|
|
89
|
-
rotation: Yt
|
|
90
87
|
}), Ot = Object.freeze({
|
|
88
|
+
sizing: Yt,
|
|
89
|
+
rotation: Xt
|
|
90
|
+
}), zt = Object.freeze({
|
|
91
91
|
validateUrls: !0,
|
|
92
92
|
validationTimeout: 5e3,
|
|
93
93
|
validationMethod: "head",
|
|
@@ -96,16 +96,16 @@ const mt = Object.freeze({
|
|
|
96
96
|
enabled: !1,
|
|
97
97
|
centers: !1,
|
|
98
98
|
loaders: !1
|
|
99
|
-
}), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }),
|
|
99
|
+
}), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), L = Object.freeze({
|
|
100
100
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
101
101
|
loaders: [],
|
|
102
102
|
// Shared loader settings and debug config
|
|
103
103
|
config: Object.freeze({
|
|
104
|
-
loaders:
|
|
104
|
+
loaders: zt,
|
|
105
105
|
debug: Dt
|
|
106
106
|
}),
|
|
107
107
|
// Image sizing and rotation configuration
|
|
108
|
-
image:
|
|
108
|
+
image: Ot,
|
|
109
109
|
// Pattern-based layout configuration
|
|
110
110
|
layout: Object.freeze({
|
|
111
111
|
algorithm: "radial",
|
|
@@ -159,7 +159,7 @@ const mt = Object.freeze({
|
|
|
159
159
|
// smooth deceleration
|
|
160
160
|
path: yt,
|
|
161
161
|
rotation: vt,
|
|
162
|
-
scale:
|
|
162
|
+
scale: xt
|
|
163
163
|
}),
|
|
164
164
|
idle: $t
|
|
165
165
|
}),
|
|
@@ -174,9 +174,7 @@ const mt = Object.freeze({
|
|
|
174
174
|
}),
|
|
175
175
|
navigation: Object.freeze({
|
|
176
176
|
keyboard: !0,
|
|
177
|
-
swipe: !0
|
|
178
|
-
mouseWheel: void 0
|
|
179
|
-
// STUB: Not implemented yet
|
|
177
|
+
swipe: !0
|
|
180
178
|
}),
|
|
181
179
|
dragging: !0
|
|
182
180
|
}),
|
|
@@ -188,7 +186,7 @@ const mt = Object.freeze({
|
|
|
188
186
|
showFocusOutline: !1
|
|
189
187
|
}),
|
|
190
188
|
// Image styling
|
|
191
|
-
styling:
|
|
189
|
+
styling: Mt
|
|
192
190
|
});
|
|
193
191
|
function Z(o, t) {
|
|
194
192
|
if (!o) return t || {};
|
|
@@ -230,132 +228,98 @@ function te(o, t) {
|
|
|
230
228
|
}
|
|
231
229
|
return i;
|
|
232
230
|
}
|
|
233
|
-
function ee(o) {
|
|
234
|
-
const t = o.
|
|
235
|
-
|
|
236
|
-
return {
|
|
237
|
-
rotation: {
|
|
238
|
-
mode: t.enabled ? "random" : "none",
|
|
239
|
-
range: t.range
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
function ie(o) {
|
|
244
|
-
const t = o.layout?.sizing?.variance;
|
|
245
|
-
if (t)
|
|
246
|
-
return {
|
|
247
|
-
sizing: {
|
|
248
|
-
mode: "adaptive",
|
|
249
|
-
// Legacy variance config implies adaptive mode
|
|
250
|
-
variance: t
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function ne(o = {}) {
|
|
255
|
-
const t = ee(o), i = ie(o);
|
|
256
|
-
let e = o.image;
|
|
257
|
-
(t || i) && (e = {
|
|
258
|
-
...i || {},
|
|
259
|
-
...t || {},
|
|
260
|
-
...e
|
|
261
|
-
}, e.rotation && t?.rotation && o.image?.rotation && (e.rotation = {
|
|
262
|
-
...t.rotation,
|
|
263
|
-
...o.image.rotation
|
|
264
|
-
}));
|
|
265
|
-
const n = [...o.loaders ?? []];
|
|
266
|
-
o.images && o.images.length > 0 && n.unshift({
|
|
231
|
+
function ee(o = {}) {
|
|
232
|
+
const t = o.image, i = [...o.loaders ?? []];
|
|
233
|
+
o.images && o.images.length > 0 && i.unshift({
|
|
267
234
|
static: {
|
|
268
235
|
sources: [{ urls: o.images }]
|
|
269
236
|
}
|
|
270
237
|
});
|
|
271
|
-
const
|
|
238
|
+
const n = {
|
|
272
239
|
loaders: {
|
|
273
|
-
...
|
|
240
|
+
...zt,
|
|
274
241
|
...o.config?.loaders ?? {}
|
|
275
242
|
}
|
|
276
|
-
},
|
|
277
|
-
loaders:
|
|
278
|
-
config:
|
|
279
|
-
image: te(
|
|
280
|
-
layout: { ...
|
|
281
|
-
animation: { ...
|
|
282
|
-
interaction: { ...
|
|
283
|
-
ui: { ...
|
|
284
|
-
styling: Qt(
|
|
243
|
+
}, s = {
|
|
244
|
+
loaders: i,
|
|
245
|
+
config: n,
|
|
246
|
+
image: te(Ot, t),
|
|
247
|
+
layout: { ...L.layout },
|
|
248
|
+
animation: { ...L.animation },
|
|
249
|
+
interaction: { ...L.interaction },
|
|
250
|
+
ui: { ...L.ui },
|
|
251
|
+
styling: Qt(Mt, o.styling)
|
|
285
252
|
};
|
|
286
|
-
o.layout && (
|
|
287
|
-
...
|
|
253
|
+
if (o.layout && (s.layout = {
|
|
254
|
+
...L.layout,
|
|
288
255
|
...o.layout
|
|
289
|
-
}, o.layout.responsive && (
|
|
290
|
-
...
|
|
291
|
-
mobile: o.layout.responsive.mobile ? { ...
|
|
292
|
-
tablet: o.layout.responsive.tablet ? { ...
|
|
293
|
-
}), o.layout.spacing && (
|
|
294
|
-
...
|
|
256
|
+
}, o.layout.responsive && (s.layout.responsive = {
|
|
257
|
+
...L.layout.responsive,
|
|
258
|
+
mobile: o.layout.responsive.mobile ? { ...L.layout.responsive.mobile, ...o.layout.responsive.mobile } : L.layout.responsive.mobile,
|
|
259
|
+
tablet: o.layout.responsive.tablet ? { ...L.layout.responsive.tablet, ...o.layout.responsive.tablet } : L.layout.responsive.tablet
|
|
260
|
+
}), o.layout.spacing && (s.layout.spacing = {
|
|
261
|
+
...L.layout.spacing,
|
|
295
262
|
...o.layout.spacing
|
|
296
|
-
})), o.animation && (
|
|
297
|
-
...
|
|
263
|
+
})), o.animation && (s.animation = {
|
|
264
|
+
...L.animation,
|
|
298
265
|
...o.animation
|
|
299
|
-
}, o.animation.easing && (
|
|
300
|
-
...
|
|
266
|
+
}, o.animation.easing && (s.animation.easing = {
|
|
267
|
+
...L.animation.easing,
|
|
301
268
|
...o.animation.easing
|
|
302
|
-
}), o.animation.queue && (
|
|
303
|
-
...
|
|
269
|
+
}), o.animation.queue && (s.animation.queue = {
|
|
270
|
+
...L.animation.queue,
|
|
304
271
|
...o.animation.queue
|
|
305
|
-
}), o.animation.entry && (
|
|
306
|
-
...
|
|
272
|
+
}), o.animation.entry && (s.animation.entry = {
|
|
273
|
+
...L.animation.entry,
|
|
307
274
|
...o.animation.entry,
|
|
308
275
|
start: o.animation.entry.start ? {
|
|
309
|
-
...
|
|
276
|
+
...L.animation.entry.start,
|
|
310
277
|
...o.animation.entry.start,
|
|
311
|
-
circular: o.animation.entry.start.circular ? { ...
|
|
312
|
-
} :
|
|
313
|
-
timing: o.animation.entry.timing ? { ...
|
|
314
|
-
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } :
|
|
315
|
-
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } :
|
|
316
|
-
scale: o.animation.entry.scale ? { ...
|
|
317
|
-
}), o.animation.idle && (
|
|
278
|
+
circular: o.animation.entry.start.circular ? { ...L.animation.entry.start.circular, ...o.animation.entry.start.circular } : L.animation.entry.start.circular
|
|
279
|
+
} : L.animation.entry.start,
|
|
280
|
+
timing: o.animation.entry.timing ? { ...L.animation.entry.timing, ...o.animation.entry.timing } : L.animation.entry.timing,
|
|
281
|
+
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : L.animation.entry.path,
|
|
282
|
+
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : L.animation.entry.rotation,
|
|
283
|
+
scale: o.animation.entry.scale ? { ...xt, ...o.animation.entry.scale } : L.animation.entry.scale
|
|
284
|
+
}), o.animation.idle && (s.animation.idle = {
|
|
318
285
|
...$t,
|
|
319
286
|
...o.animation.idle
|
|
320
|
-
})), o.interaction && (
|
|
321
|
-
...
|
|
287
|
+
})), o.interaction && (s.interaction = {
|
|
288
|
+
...L.interaction,
|
|
322
289
|
...o.interaction
|
|
323
|
-
}, o.interaction.focus && (
|
|
324
|
-
...
|
|
290
|
+
}, o.interaction.focus && (s.interaction.focus = {
|
|
291
|
+
...L.interaction.focus,
|
|
325
292
|
...o.interaction.focus
|
|
326
|
-
}), o.interaction.navigation && (
|
|
327
|
-
...
|
|
293
|
+
}), o.interaction.navigation && (s.interaction.navigation = {
|
|
294
|
+
...L.interaction.navigation,
|
|
328
295
|
...o.interaction.navigation
|
|
329
|
-
}))
|
|
330
|
-
|
|
331
|
-
if (c && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), a.ui = {
|
|
332
|
-
...C.ui,
|
|
333
|
-
...c,
|
|
296
|
+
})), s.ui = {
|
|
297
|
+
...L.ui,
|
|
334
298
|
...o.ui
|
|
335
|
-
},
|
|
299
|
+
}, s.config.debug = {
|
|
336
300
|
...Dt,
|
|
337
301
|
...o.config?.debug ?? {}
|
|
338
|
-
},
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
...
|
|
342
|
-
default: { ...
|
|
343
|
-
hover: { ...
|
|
302
|
+
}, s.layout.algorithm === "honeycomb" && s.styling) {
|
|
303
|
+
const r = { shape: "hexagon", mode: "height-relative" };
|
|
304
|
+
s.styling = {
|
|
305
|
+
...s.styling,
|
|
306
|
+
default: { ...s.styling.default, clipPath: r },
|
|
307
|
+
hover: { ...s.styling.hover, clipPath: r }
|
|
344
308
|
// focused: untouched — user config respected
|
|
345
309
|
};
|
|
346
310
|
}
|
|
347
|
-
return
|
|
311
|
+
return s;
|
|
348
312
|
}
|
|
349
|
-
function
|
|
313
|
+
function ie(o, t) {
|
|
350
314
|
return { ...o ? Ct[o] : Ct.playful, ...t };
|
|
351
315
|
}
|
|
352
|
-
function
|
|
316
|
+
function ne(o, t) {
|
|
353
317
|
return { ...o ? Rt[o] : Rt.gentle, ...t };
|
|
354
318
|
}
|
|
355
|
-
function
|
|
356
|
-
return { ...o ?
|
|
319
|
+
function oe(o, t) {
|
|
320
|
+
return { ...o ? Tt[o] : Tt.gentle, ...t };
|
|
357
321
|
}
|
|
358
|
-
class
|
|
322
|
+
class se {
|
|
359
323
|
constructor(t) {
|
|
360
324
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
361
325
|
}
|
|
@@ -382,12 +346,12 @@ class re {
|
|
|
382
346
|
*/
|
|
383
347
|
animateTransformCancellable(t, i, e, n = null, s = null) {
|
|
384
348
|
this.cancelAllAnimations(t);
|
|
385
|
-
const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i),
|
|
349
|
+
const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), d = this.buildTransformString(e);
|
|
386
350
|
t.style.transition = "none";
|
|
387
351
|
const u = t.animate(
|
|
388
352
|
[
|
|
389
353
|
{ transform: c },
|
|
390
|
-
{ transform:
|
|
354
|
+
{ transform: d }
|
|
391
355
|
],
|
|
392
356
|
{
|
|
393
357
|
duration: r,
|
|
@@ -395,7 +359,7 @@ class re {
|
|
|
395
359
|
fill: "forwards"
|
|
396
360
|
// Keep final state after animation
|
|
397
361
|
}
|
|
398
|
-
),
|
|
362
|
+
), f = {
|
|
399
363
|
id: `anim-${++this.animationIdCounter}`,
|
|
400
364
|
element: t,
|
|
401
365
|
animation: u,
|
|
@@ -404,11 +368,11 @@ class re {
|
|
|
404
368
|
startTime: performance.now(),
|
|
405
369
|
duration: r
|
|
406
370
|
};
|
|
407
|
-
return this.activeAnimations.set(t,
|
|
408
|
-
t.style.transform =
|
|
371
|
+
return this.activeAnimations.set(t, f), u.finished.then(() => {
|
|
372
|
+
t.style.transform = d, this.activeAnimations.delete(t);
|
|
409
373
|
}).catch(() => {
|
|
410
374
|
this.activeAnimations.delete(t);
|
|
411
|
-
}),
|
|
375
|
+
}), f;
|
|
412
376
|
}
|
|
413
377
|
/**
|
|
414
378
|
* Cancel an active animation
|
|
@@ -514,31 +478,31 @@ class re {
|
|
|
514
478
|
function J(o, t, i) {
|
|
515
479
|
return o + (t - o) * i;
|
|
516
480
|
}
|
|
517
|
-
function
|
|
518
|
-
const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y,
|
|
519
|
-
let u = 0,
|
|
520
|
-
for (let
|
|
521
|
-
if (o <= l
|
|
522
|
-
|
|
481
|
+
function ae(o, t, i, e) {
|
|
482
|
+
const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, d = re(s, r);
|
|
483
|
+
let u = 0, f = 0, m = 1, p = n, w = !1;
|
|
484
|
+
for (let l = 0; l < d.length; l++)
|
|
485
|
+
if (o <= d[l].time) {
|
|
486
|
+
f = l === 0 ? 0 : d[l - 1].time, m = d[l].time, p = d[l].overshoot, w = d[l].isOvershoot;
|
|
523
487
|
break;
|
|
524
488
|
}
|
|
525
|
-
const
|
|
526
|
-
if (
|
|
527
|
-
u = 1 +
|
|
528
|
-
else if (
|
|
529
|
-
u = at(
|
|
489
|
+
const v = (o - f) / (m - f);
|
|
490
|
+
if (w)
|
|
491
|
+
u = 1 + p * at(v);
|
|
492
|
+
else if (f === 0)
|
|
493
|
+
u = at(v);
|
|
530
494
|
else {
|
|
531
|
-
const
|
|
532
|
-
(
|
|
533
|
-
)?.overshoot ||
|
|
534
|
-
u = J(
|
|
495
|
+
const g = 1 + (d.find(
|
|
496
|
+
(h, b) => h.time > f && b > 0 && d[b - 1].isOvershoot
|
|
497
|
+
)?.overshoot || p);
|
|
498
|
+
u = J(g, 1, at(v));
|
|
535
499
|
}
|
|
536
500
|
return {
|
|
537
501
|
x: t.x + a * u,
|
|
538
502
|
y: t.y + c * u
|
|
539
503
|
};
|
|
540
504
|
}
|
|
541
|
-
function
|
|
505
|
+
function re(o, t) {
|
|
542
506
|
const i = [];
|
|
543
507
|
let e = 0.6;
|
|
544
508
|
i.push({ time: e, overshoot: 0, isOvershoot: !1 });
|
|
@@ -548,57 +512,57 @@ function le(o, t) {
|
|
|
548
512
|
e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
|
|
549
513
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
550
514
|
}
|
|
551
|
-
function
|
|
552
|
-
const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x,
|
|
553
|
-
let
|
|
554
|
-
if (
|
|
555
|
-
const
|
|
556
|
-
|
|
515
|
+
function ce(o, t, i, e) {
|
|
516
|
+
const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, d = i.y - t.y, u = Math.sqrt(n / r), f = s / (2 * Math.sqrt(n * r));
|
|
517
|
+
let m;
|
|
518
|
+
if (f < 1) {
|
|
519
|
+
const p = u * Math.sqrt(1 - f * f), w = Math.exp(-f * u * o * 3), v = Math.cos(p * o * a * Math.PI);
|
|
520
|
+
m = 1 - w * v;
|
|
557
521
|
} else
|
|
558
|
-
|
|
559
|
-
return
|
|
560
|
-
x: t.x + c *
|
|
561
|
-
y: t.y +
|
|
522
|
+
m = 1 - Math.exp(-u * o * 3);
|
|
523
|
+
return m = Math.max(0, Math.min(m, 1.3)), {
|
|
524
|
+
x: t.x + c * m,
|
|
525
|
+
y: t.y + d * m
|
|
562
526
|
};
|
|
563
527
|
}
|
|
564
|
-
function
|
|
565
|
-
const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e,
|
|
528
|
+
function le(o, t, i, e) {
|
|
529
|
+
const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, d = i.x - t.x, u = i.y - t.y, f = Math.sqrt(d * d + u * u), m = f > 0 ? -u / f : 0, p = f > 0 ? d / f : 1, w = s * Math.PI * 2 * o + c, v = r ? Math.pow(1 - o, a) : 1, l = n * Math.sin(w) * v, g = he(o);
|
|
566
530
|
return {
|
|
567
|
-
x: J(t.x, i.x,
|
|
568
|
-
y: J(t.y, i.y,
|
|
531
|
+
x: J(t.x, i.x, g) + l * m,
|
|
532
|
+
y: J(t.y, i.y, g) + l * p
|
|
569
533
|
};
|
|
570
534
|
}
|
|
571
535
|
function at(o) {
|
|
572
536
|
return 1 - (1 - o) * (1 - o);
|
|
573
537
|
}
|
|
574
|
-
function
|
|
538
|
+
function he(o) {
|
|
575
539
|
return 1 - Math.pow(1 - o, 3);
|
|
576
540
|
}
|
|
577
|
-
function
|
|
541
|
+
function de(o, t, i) {
|
|
578
542
|
const { amplitude: e, frequency: n, decay: s } = i, r = Math.sin(o * n * Math.PI * 2), a = s ? Math.pow(1 - o, 2) : 1, c = e * r * a;
|
|
579
543
|
return t + c;
|
|
580
544
|
}
|
|
581
|
-
function
|
|
545
|
+
function ue(o, t, i) {
|
|
582
546
|
const { overshoot: e, bounces: n } = i, s = [];
|
|
583
547
|
s.push({ time: 0.5, scale: e });
|
|
584
548
|
let r = e;
|
|
585
|
-
const a = 0.5,
|
|
549
|
+
const a = 0.5, d = 0.5 / (n * 2);
|
|
586
550
|
let u = 0.5;
|
|
587
|
-
for (let
|
|
588
|
-
const
|
|
589
|
-
u +=
|
|
551
|
+
for (let m = 0; m < n; m++) {
|
|
552
|
+
const p = 1 - (r - 1) * a;
|
|
553
|
+
u += d, s.push({ time: u, scale: p }), r = 1 + (r - 1) * a * a, u += d, m < n - 1 && s.push({ time: u, scale: r });
|
|
590
554
|
}
|
|
591
555
|
s.push({ time: 1, scale: 1 });
|
|
592
|
-
let
|
|
593
|
-
for (let
|
|
594
|
-
if (o <= s[
|
|
595
|
-
const
|
|
596
|
-
|
|
556
|
+
let f = 1;
|
|
557
|
+
for (let m = 0; m < s.length; m++)
|
|
558
|
+
if (o <= s[m].time) {
|
|
559
|
+
const p = m === 0 ? 0 : s[m - 1].time, w = m === 0 ? 1 : s[m - 1].scale, v = (o - p) / (s[m].time - p), l = at(v);
|
|
560
|
+
f = w + (s[m].scale - w) * l;
|
|
597
561
|
break;
|
|
598
562
|
}
|
|
599
|
-
return
|
|
563
|
+
return f * t;
|
|
600
564
|
}
|
|
601
|
-
function
|
|
565
|
+
function fe(o) {
|
|
602
566
|
const {
|
|
603
567
|
element: t,
|
|
604
568
|
startPosition: i,
|
|
@@ -608,64 +572,70 @@ function me(o) {
|
|
|
608
572
|
imageWidth: r,
|
|
609
573
|
imageHeight: a,
|
|
610
574
|
rotation: c,
|
|
611
|
-
scale:
|
|
575
|
+
scale: d,
|
|
612
576
|
onComplete: u,
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
577
|
+
onProgress: f,
|
|
578
|
+
rotationConfig: m,
|
|
579
|
+
startRotation: p,
|
|
580
|
+
scaleConfig: w,
|
|
581
|
+
startScale: v
|
|
582
|
+
} = o, l = n.type, g = p !== void 0 && p !== c, h = m?.mode === "wobble", b = m?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, I = g || h, y = v !== void 0 && v !== d, x = w?.mode === "pop", E = w?.pop || { overshoot: 1.2, bounces: 1 };
|
|
583
|
+
if (l === "linear" && !I && !(y || x)) {
|
|
619
584
|
u && u();
|
|
620
585
|
return;
|
|
621
586
|
}
|
|
622
|
-
const
|
|
623
|
-
function
|
|
624
|
-
const
|
|
625
|
-
let
|
|
626
|
-
switch (
|
|
587
|
+
const R = performance.now(), M = -r / 2, T = -a / 2;
|
|
588
|
+
function z(k) {
|
|
589
|
+
const D = k - R, O = Math.min(D / s, 1);
|
|
590
|
+
let S;
|
|
591
|
+
switch (l) {
|
|
627
592
|
case "bounce": {
|
|
628
|
-
const
|
|
593
|
+
const N = ie(
|
|
629
594
|
n.bouncePreset,
|
|
630
595
|
n.bounce
|
|
631
596
|
);
|
|
632
|
-
|
|
597
|
+
S = ae(O, i, e, N);
|
|
633
598
|
break;
|
|
634
599
|
}
|
|
635
600
|
case "elastic": {
|
|
636
|
-
const
|
|
601
|
+
const N = ne(
|
|
637
602
|
n.elasticPreset,
|
|
638
603
|
n.elastic
|
|
639
604
|
);
|
|
640
|
-
|
|
605
|
+
S = ce(O, i, e, N);
|
|
641
606
|
break;
|
|
642
607
|
}
|
|
643
608
|
case "wave": {
|
|
644
|
-
const
|
|
609
|
+
const N = oe(
|
|
645
610
|
n.wavePreset,
|
|
646
611
|
n.wave
|
|
647
612
|
);
|
|
648
|
-
|
|
613
|
+
S = le(O, i, e, N);
|
|
649
614
|
break;
|
|
650
615
|
}
|
|
651
616
|
default:
|
|
652
|
-
|
|
653
|
-
x: J(i.x, e.x,
|
|
654
|
-
y: J(i.y, e.y,
|
|
617
|
+
S = {
|
|
618
|
+
x: J(i.x, e.x, O),
|
|
619
|
+
y: J(i.y, e.y, O)
|
|
655
620
|
};
|
|
656
621
|
}
|
|
657
|
-
const
|
|
658
|
-
let M;
|
|
659
|
-
m ? M = fe(R, c, y) : f ? M = J(d, c, R) : M = c;
|
|
622
|
+
const _ = S.x - e.x, $ = S.y - e.y;
|
|
660
623
|
let A;
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
624
|
+
h ? A = de(O, c, b) : g ? A = J(p, c, O) : A = c;
|
|
625
|
+
let j;
|
|
626
|
+
x ? j = ue(O, d, E) : y ? j = J(v, d, O) : j = d, t.style.transform = `translate(${M}px, ${T}px) translate(${_}px, ${$}px) rotate(${A}deg) scale(${j})`, f && O < 1 && f(O, D, {
|
|
627
|
+
x: S.x,
|
|
628
|
+
y: S.y,
|
|
629
|
+
rotation: A,
|
|
630
|
+
scale: j
|
|
631
|
+
}), O < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${M}px, ${T}px) rotate(${c}deg) scale(${d})`, u && u());
|
|
632
|
+
}
|
|
633
|
+
requestAnimationFrame(z);
|
|
664
634
|
}
|
|
665
|
-
function
|
|
635
|
+
function ge(o) {
|
|
666
636
|
return o === "bounce" || o === "elastic" || o === "wave";
|
|
667
637
|
}
|
|
668
|
-
const
|
|
638
|
+
const me = {
|
|
669
639
|
radial: "center",
|
|
670
640
|
spiral: "center",
|
|
671
641
|
grid: "top",
|
|
@@ -674,15 +644,15 @@ const be = {
|
|
|
674
644
|
wave: "left",
|
|
675
645
|
honeycomb: "center"
|
|
676
646
|
};
|
|
677
|
-
class
|
|
647
|
+
class pe {
|
|
678
648
|
constructor(t, i) {
|
|
679
|
-
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale ||
|
|
649
|
+
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || xt;
|
|
680
650
|
}
|
|
681
651
|
/**
|
|
682
652
|
* Get the effective start position, considering layout-aware defaults
|
|
683
653
|
*/
|
|
684
654
|
resolveStartPosition() {
|
|
685
|
-
return this.config.start.position ? this.config.start.position :
|
|
655
|
+
return this.config.start.position ? this.config.start.position : me[this.layoutAlgorithm] || "nearest-edge";
|
|
686
656
|
}
|
|
687
657
|
/**
|
|
688
658
|
* Calculate the starting position for an image's entry animation
|
|
@@ -720,9 +690,9 @@ class ye {
|
|
|
720
690
|
* Calculate start position from the nearest edge (current default behavior)
|
|
721
691
|
*/
|
|
722
692
|
calculateNearestEdge(t, i, e, n) {
|
|
723
|
-
const s = t.x, r = t.y, a = s, c = e.width - s,
|
|
724
|
-
let
|
|
725
|
-
return
|
|
693
|
+
const s = t.x, r = t.y, a = s, c = e.width - s, d = r, u = e.height - r, f = Math.min(a, c, d, u);
|
|
694
|
+
let m = t.x, p = t.y;
|
|
695
|
+
return f === a ? m = -(i.width + n) : f === c ? m = e.width + n : f === d ? p = -(i.height + n) : p = e.height + n, { x: m, y: p };
|
|
726
696
|
}
|
|
727
697
|
/**
|
|
728
698
|
* Calculate start position from a specific edge
|
|
@@ -770,18 +740,18 @@ class ye {
|
|
|
770
740
|
calculateCircularPosition(t, i, e, n, s) {
|
|
771
741
|
const r = this.config.start.circular || {}, a = r.distribution || "even";
|
|
772
742
|
let c;
|
|
773
|
-
const
|
|
774
|
-
if (typeof
|
|
775
|
-
const
|
|
743
|
+
const d = r.radius || "120%";
|
|
744
|
+
if (typeof d == "string" && d.endsWith("%")) {
|
|
745
|
+
const v = parseFloat(d) / 100;
|
|
776
746
|
c = Math.sqrt(
|
|
777
747
|
e.width ** 2 + e.height ** 2
|
|
778
|
-
) *
|
|
748
|
+
) * v / 2;
|
|
779
749
|
} else
|
|
780
|
-
c = typeof
|
|
750
|
+
c = typeof d == "number" ? d : 500;
|
|
781
751
|
let u;
|
|
782
752
|
a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
783
|
-
const
|
|
784
|
-
return { x:
|
|
753
|
+
const f = e.width / 2, m = e.height / 2, p = f + Math.cos(u) * c, w = m + Math.sin(u) * c;
|
|
754
|
+
return { x: p, y: w };
|
|
785
755
|
}
|
|
786
756
|
/**
|
|
787
757
|
* Get animation parameters for an image
|
|
@@ -801,8 +771,8 @@ class ye {
|
|
|
801
771
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
802
772
|
*/
|
|
803
773
|
buildStartTransform(t, i, e, n, s, r, a, c) {
|
|
804
|
-
const
|
|
805
|
-
return t.useScale ? `${
|
|
774
|
+
const d = t.x - i.x, u = t.y - i.y, f = a !== void 0 ? a : e, m = c !== void 0 ? c : n, p = s !== void 0 ? -s / 2 : 0, w = r !== void 0 ? -r / 2 : 0, v = s !== void 0 ? `translate(${p}px, ${w}px)` : "translate(-50%, -50%)";
|
|
775
|
+
return t.useScale ? `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(0)` : `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(${m})`;
|
|
806
776
|
}
|
|
807
777
|
/**
|
|
808
778
|
* Build the final CSS transform string
|
|
@@ -827,7 +797,7 @@ class ye {
|
|
|
827
797
|
* Check if the current path type requires JavaScript animation
|
|
828
798
|
*/
|
|
829
799
|
requiresJSAnimation() {
|
|
830
|
-
return
|
|
800
|
+
return ge(this.pathConfig.type);
|
|
831
801
|
}
|
|
832
802
|
/**
|
|
833
803
|
* Get the path configuration
|
|
@@ -929,8 +899,8 @@ class ye {
|
|
|
929
899
|
amplitude: 15,
|
|
930
900
|
frequency: 3,
|
|
931
901
|
decay: !0
|
|
932
|
-
}, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1,
|
|
933
|
-
return i +
|
|
902
|
+
}, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, d = n * a * c;
|
|
903
|
+
return i + d;
|
|
934
904
|
}
|
|
935
905
|
/**
|
|
936
906
|
* Get the scale configuration
|
|
@@ -990,8 +960,8 @@ class ye {
|
|
|
990
960
|
let a = i;
|
|
991
961
|
for (let c = 0; c < r.length; c++)
|
|
992
962
|
if (t <= r[c].time) {
|
|
993
|
-
const
|
|
994
|
-
a = u + (r[c].scale - u) *
|
|
963
|
+
const d = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, f = (t - d) / (r[c].time - d), m = this.easeOutQuad(f);
|
|
964
|
+
a = u + (r[c].scale - u) * m;
|
|
995
965
|
break;
|
|
996
966
|
}
|
|
997
967
|
return a * i;
|
|
@@ -1005,9 +975,9 @@ class ye {
|
|
|
1005
975
|
let n = i;
|
|
1006
976
|
const s = 0.5, a = 0.5 / (t * 2);
|
|
1007
977
|
let c = 0.5;
|
|
1008
|
-
for (let
|
|
978
|
+
for (let d = 0; d < t; d++) {
|
|
1009
979
|
const u = 1 - (n - 1) * s;
|
|
1010
|
-
c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a,
|
|
980
|
+
c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, d < t - 1 && e.push({ time: c, scale: n });
|
|
1011
981
|
}
|
|
1012
982
|
return e.push({ time: 1, scale: 1 }), e;
|
|
1013
983
|
}
|
|
@@ -1018,7 +988,7 @@ class ye {
|
|
|
1018
988
|
return 1 - (1 - t) * (1 - t);
|
|
1019
989
|
}
|
|
1020
990
|
}
|
|
1021
|
-
class
|
|
991
|
+
class be {
|
|
1022
992
|
constructor(t, i = 600) {
|
|
1023
993
|
this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
|
|
1024
994
|
}
|
|
@@ -1204,7 +1174,7 @@ class ve {
|
|
|
1204
1174
|
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
|
|
1205
1175
|
}
|
|
1206
1176
|
}
|
|
1207
|
-
class
|
|
1177
|
+
class ye {
|
|
1208
1178
|
constructor(t, i = {}) {
|
|
1209
1179
|
this.config = t, this.imageConfig = i;
|
|
1210
1180
|
}
|
|
@@ -1216,17 +1186,17 @@ class Ee {
|
|
|
1216
1186
|
* @returns Array of layout objects with position, rotation, scale
|
|
1217
1187
|
*/
|
|
1218
1188
|
generate(t, i, e = {}) {
|
|
1219
|
-
const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200,
|
|
1220
|
-
for (let
|
|
1221
|
-
const
|
|
1222
|
-
id:
|
|
1223
|
-
x:
|
|
1224
|
-
y:
|
|
1225
|
-
rotation:
|
|
1226
|
-
scale:
|
|
1227
|
-
baseSize:
|
|
1189
|
+
const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, l = c * 1.5 / 2, g = c / 2, h = s - a - l, b = r - a - g, I = a + l, y = a + g;
|
|
1190
|
+
for (let x = 0; x < t; x++) {
|
|
1191
|
+
const E = this.random(I, h), F = this.random(y, b), R = d === "random" ? this.random(u, f) : 0, M = w ? this.random(m, p) : 1, T = c * M, z = {
|
|
1192
|
+
id: x,
|
|
1193
|
+
x: E,
|
|
1194
|
+
y: F,
|
|
1195
|
+
rotation: R,
|
|
1196
|
+
scale: M,
|
|
1197
|
+
baseSize: T
|
|
1228
1198
|
};
|
|
1229
|
-
n.push(
|
|
1199
|
+
n.push(z);
|
|
1230
1200
|
}
|
|
1231
1201
|
return n;
|
|
1232
1202
|
}
|
|
@@ -1240,7 +1210,7 @@ class Ee {
|
|
|
1240
1210
|
return Math.random() * (i - t) + t;
|
|
1241
1211
|
}
|
|
1242
1212
|
}
|
|
1243
|
-
class
|
|
1213
|
+
class ve {
|
|
1244
1214
|
constructor(t, i = {}) {
|
|
1245
1215
|
this.config = t, this.imageConfig = i;
|
|
1246
1216
|
}
|
|
@@ -1252,53 +1222,53 @@ class we {
|
|
|
1252
1222
|
* @returns Array of layout objects with position, rotation, scale
|
|
1253
1223
|
*/
|
|
1254
1224
|
generate(t, i, e = {}) {
|
|
1255
|
-
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none",
|
|
1225
|
+
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = this.config.scaleDecay ?? 0, v = {
|
|
1256
1226
|
...jt,
|
|
1257
1227
|
...this.config.radial
|
|
1258
|
-
},
|
|
1259
|
-
|
|
1260
|
-
|
|
1228
|
+
}, l = e.fixedHeight ?? a, g = s / 2, h = r / 2, b = Math.ceil(Math.sqrt(t)), I = this.config.spacing.padding ?? 50, y = Math.max(l * 0.8, Math.min(
|
|
1229
|
+
g - I - l / 2,
|
|
1230
|
+
h - I - l / 2
|
|
1261
1231
|
));
|
|
1262
1232
|
if (t > 0) {
|
|
1263
|
-
const
|
|
1233
|
+
const F = p ? this.random(f, m) : 1, R = l * F;
|
|
1264
1234
|
n.push({
|
|
1265
1235
|
id: 0,
|
|
1266
|
-
x:
|
|
1267
|
-
y,
|
|
1268
|
-
rotation: c === "random" ? this.random(
|
|
1236
|
+
x: g,
|
|
1237
|
+
y: h,
|
|
1238
|
+
rotation: c === "random" ? this.random(d * 0.33, u * 0.33) : 0,
|
|
1269
1239
|
// Less rotation for center
|
|
1270
|
-
scale:
|
|
1271
|
-
baseSize:
|
|
1240
|
+
scale: F,
|
|
1241
|
+
baseSize: R,
|
|
1272
1242
|
zIndex: 100
|
|
1273
1243
|
// Center image is highest
|
|
1274
1244
|
});
|
|
1275
1245
|
}
|
|
1276
|
-
let
|
|
1277
|
-
for (;
|
|
1278
|
-
const
|
|
1279
|
-
if (
|
|
1280
|
-
|
|
1246
|
+
let x = 1, E = 1;
|
|
1247
|
+
for (; x < t; ) {
|
|
1248
|
+
const F = E / b, R = w > 0 ? 1 - F * w * 0.5 : 1, M = Math.max(l * 0.8, y / b * 1.5 / v.tightness), T = E * M, z = T * 1.5, k = Math.PI * (3 * (z + T) - Math.sqrt((3 * z + T) * (z + 3 * T))), D = this.estimateWidth(l), O = Math.floor(k / (D * 0.7));
|
|
1249
|
+
if (O === 0) {
|
|
1250
|
+
E++;
|
|
1281
1251
|
continue;
|
|
1282
1252
|
}
|
|
1283
|
-
const
|
|
1284
|
-
for (let
|
|
1285
|
-
const A =
|
|
1286
|
-
let
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1289
|
-
const
|
|
1253
|
+
const S = 2 * Math.PI / O, _ = E * (20 * Math.PI / 180);
|
|
1254
|
+
for (let $ = 0; $ < O && x < t; $++) {
|
|
1255
|
+
const A = $ * S + _, j = p ? this.random(f, m) : 1, N = R * j, P = l * N;
|
|
1256
|
+
let H = g + Math.cos(A) * z, U = h + Math.sin(A) * T;
|
|
1257
|
+
const B = P * 1.5 / 2, W = P / 2;
|
|
1258
|
+
H - B < I ? H = I + B : H + B > s - I && (H = s - I - B), U - W < I ? U = I + W : U + W > r - I && (U = r - I - W);
|
|
1259
|
+
const X = c === "random" ? this.random(d, u) : 0;
|
|
1290
1260
|
n.push({
|
|
1291
|
-
id:
|
|
1292
|
-
x:
|
|
1293
|
-
y:
|
|
1294
|
-
rotation:
|
|
1295
|
-
scale:
|
|
1296
|
-
baseSize:
|
|
1297
|
-
zIndex: Math.max(1, 100 -
|
|
1261
|
+
id: x,
|
|
1262
|
+
x: H,
|
|
1263
|
+
y: U,
|
|
1264
|
+
rotation: X,
|
|
1265
|
+
scale: N,
|
|
1266
|
+
baseSize: P,
|
|
1267
|
+
zIndex: Math.max(1, 100 - E)
|
|
1298
1268
|
// Outer rings have lower z-index
|
|
1299
|
-
}),
|
|
1269
|
+
}), x++;
|
|
1300
1270
|
}
|
|
1301
|
-
|
|
1271
|
+
E++;
|
|
1302
1272
|
}
|
|
1303
1273
|
return n;
|
|
1304
1274
|
}
|
|
@@ -1331,7 +1301,7 @@ const xe = {
|
|
|
1331
1301
|
alignment: "center",
|
|
1332
1302
|
gap: 10,
|
|
1333
1303
|
overflowOffset: 0.25
|
|
1334
|
-
},
|
|
1304
|
+
}, At = [
|
|
1335
1305
|
{ x: 1, y: 1 },
|
|
1336
1306
|
// bottom-right
|
|
1337
1307
|
{ x: -1, y: -1 },
|
|
@@ -1349,7 +1319,7 @@ const xe = {
|
|
|
1349
1319
|
{ x: 0, y: 1 }
|
|
1350
1320
|
// down
|
|
1351
1321
|
];
|
|
1352
|
-
class
|
|
1322
|
+
class Ee {
|
|
1353
1323
|
constructor(t, i = {}) {
|
|
1354
1324
|
this.config = t, this.imageConfig = i;
|
|
1355
1325
|
}
|
|
@@ -1361,60 +1331,60 @@ class Se {
|
|
|
1361
1331
|
* @returns Array of layout objects with position, rotation, scale
|
|
1362
1332
|
*/
|
|
1363
1333
|
generate(t, i, e = {}) {
|
|
1364
|
-
const n = [], { width: s, height: r } = i, a = { ...xe, ...this.config.grid }, c = this.config.spacing.padding,
|
|
1334
|
+
const n = [], { width: s, height: r } = i, a = { ...xe, ...this.config.grid }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = s - 2 * c, v = r - 2 * c, { columns: l, rows: g } = this.calculateGridDimensions(
|
|
1365
1335
|
t,
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1336
|
+
w,
|
|
1337
|
+
v,
|
|
1338
|
+
d,
|
|
1369
1339
|
a
|
|
1370
|
-
),
|
|
1340
|
+
), h = a.stagger === "row", b = a.stagger === "column", I = h ? l + 0.5 : l, y = b ? g + 0.5 : g, x = (w - a.gap * (l - 1)) / I, E = (v - a.gap * (g - 1)) / y, F = h ? x / 2 : 0, R = b ? E / 2 : 0, M = 1 + a.overlap, T = Math.min(x, E) * M, z = e.fixedHeight ? Math.min(e.fixedHeight, T) : T, k = l * x + (l - 1) * a.gap + F, D = g * E + (g - 1) * a.gap + R, O = c + (w - k) / 2, S = c + (v - D) / 2, _ = l * g, $ = a.columns !== "auto" && a.rows !== "auto", A = $ && t > _;
|
|
1371
1341
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1372
1342
|
gridConfigColumns: a.columns,
|
|
1373
1343
|
gridConfigRows: a.rows,
|
|
1374
|
-
columns:
|
|
1375
|
-
rows:
|
|
1376
|
-
cellCount:
|
|
1377
|
-
hasFixedGrid:
|
|
1344
|
+
columns: l,
|
|
1345
|
+
rows: g,
|
|
1346
|
+
cellCount: _,
|
|
1347
|
+
hasFixedGrid: $,
|
|
1378
1348
|
imageCount: t,
|
|
1379
1349
|
isOverflowMode: A
|
|
1380
1350
|
});
|
|
1381
|
-
const
|
|
1382
|
-
for (let
|
|
1383
|
-
let
|
|
1384
|
-
if (A &&
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1351
|
+
const j = A ? new Array(_).fill(0) : [], N = Math.min(x, E) * a.overflowOffset;
|
|
1352
|
+
for (let P = 0; P < t; P++) {
|
|
1353
|
+
let H, U, Y = 0;
|
|
1354
|
+
if (A && P >= _) {
|
|
1355
|
+
const q = P - _, G = q % _;
|
|
1356
|
+
Y = Math.floor(q / _) + 1, j[G]++, a.fillDirection === "row" ? (H = G % l, U = Math.floor(G / l)) : (U = G % g, H = Math.floor(G / g));
|
|
1387
1357
|
} else
|
|
1388
|
-
a.fillDirection === "row" ? (
|
|
1389
|
-
let
|
|
1390
|
-
if (a.stagger === "row" &&
|
|
1391
|
-
const
|
|
1392
|
-
|
|
1358
|
+
a.fillDirection === "row" ? (H = P % l, U = Math.floor(P / l)) : (U = P % g, H = Math.floor(P / g));
|
|
1359
|
+
let B = O + H * (x + a.gap) + x / 2, W = S + U * (E + a.gap) + E / 2;
|
|
1360
|
+
if (a.stagger === "row" && U % 2 === 1 ? B += x / 2 : a.stagger === "column" && H % 2 === 1 && (W += E / 2), Y > 0) {
|
|
1361
|
+
const q = (Y - 1) % At.length, G = At[q];
|
|
1362
|
+
B += G.x * N, W += G.y * N;
|
|
1393
1363
|
}
|
|
1394
1364
|
if (a.jitter > 0) {
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1365
|
+
const q = x / 2 * a.jitter, G = E / 2 * a.jitter;
|
|
1366
|
+
B += this.random(-q, q), W += this.random(-G, G);
|
|
1397
1367
|
}
|
|
1398
|
-
let
|
|
1368
|
+
let X = B, V = W;
|
|
1399
1369
|
if (!A && a.fillDirection === "row") {
|
|
1400
|
-
const
|
|
1401
|
-
if (
|
|
1402
|
-
const
|
|
1370
|
+
const q = t % l || l;
|
|
1371
|
+
if (U === Math.floor((t - 1) / l) && q < l) {
|
|
1372
|
+
const It = q * x + (q - 1) * a.gap;
|
|
1403
1373
|
let gt = 0;
|
|
1404
|
-
a.alignment === "center" ? gt = (
|
|
1374
|
+
a.alignment === "center" ? gt = (k - It) / 2 : a.alignment === "end" && (gt = k - It), X += gt;
|
|
1405
1375
|
}
|
|
1406
1376
|
}
|
|
1407
|
-
const ct =
|
|
1408
|
-
|
|
1377
|
+
const ct = p ? this.random(f, m) : 1, K = z * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, _t = c + ot, Ut = r - c - ot;
|
|
1378
|
+
X = Math.max(ht, Math.min(X, dt)), V = Math.max(_t, Math.min(V, Ut));
|
|
1409
1379
|
let ut = 0;
|
|
1410
1380
|
if (u === "random") {
|
|
1411
|
-
const
|
|
1412
|
-
a.jitter > 0 ? ut = this.random(
|
|
1381
|
+
const q = this.imageConfig.rotation?.range?.min ?? -15, G = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1382
|
+
a.jitter > 0 ? ut = this.random(q * a.jitter, G * a.jitter) : ut = this.random(q, G);
|
|
1413
1383
|
}
|
|
1414
1384
|
let ft;
|
|
1415
|
-
A &&
|
|
1416
|
-
id:
|
|
1417
|
-
x:
|
|
1385
|
+
A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + P : P + 1, n.push({
|
|
1386
|
+
id: P,
|
|
1387
|
+
x: X,
|
|
1418
1388
|
y: V,
|
|
1419
1389
|
rotation: ut,
|
|
1420
1390
|
scale: ct,
|
|
@@ -1449,14 +1419,14 @@ class Se {
|
|
|
1449
1419
|
return Math.random() * (i - t) + t;
|
|
1450
1420
|
}
|
|
1451
1421
|
}
|
|
1452
|
-
const
|
|
1422
|
+
const we = Math.PI * (3 - Math.sqrt(5)), Ie = {
|
|
1453
1423
|
spiralType: "golden",
|
|
1454
1424
|
direction: "counterclockwise",
|
|
1455
1425
|
tightness: 1,
|
|
1456
1426
|
scaleDecay: 0,
|
|
1457
1427
|
startAngle: 0
|
|
1458
1428
|
};
|
|
1459
|
-
class
|
|
1429
|
+
class Se {
|
|
1460
1430
|
constructor(t, i = {}) {
|
|
1461
1431
|
this.config = t, this.imageConfig = i;
|
|
1462
1432
|
}
|
|
@@ -1468,36 +1438,36 @@ class Re {
|
|
|
1468
1438
|
* @returns Array of layout objects with position, rotation, scale
|
|
1469
1439
|
*/
|
|
1470
1440
|
generate(t, i, e = {}) {
|
|
1471
|
-
const n = [], { width: s, height: r } = i, a = { ...
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
),
|
|
1475
|
-
for (let
|
|
1476
|
-
let
|
|
1441
|
+
const n = [], { width: s, height: r } = i, a = { ...Ie, ...this.config.spiral }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, w = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || w !== 1, l = this.config.scaleDecay ?? a.scaleDecay, g = s / 2, h = r / 2, b = Math.min(
|
|
1442
|
+
g - c - d / 2,
|
|
1443
|
+
h - c - d / 2
|
|
1444
|
+
), I = a.direction === "clockwise" ? -1 : 1;
|
|
1445
|
+
for (let y = 0; y < t; y++) {
|
|
1446
|
+
let x, E;
|
|
1477
1447
|
if (a.spiralType === "golden")
|
|
1478
|
-
|
|
1448
|
+
x = y * we * I + a.startAngle, E = this.calculateGoldenRadius(y, t, b, a.tightness);
|
|
1479
1449
|
else if (a.spiralType === "archimedean") {
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1450
|
+
const B = y * 0.5 * a.tightness;
|
|
1451
|
+
x = B * I + a.startAngle, E = this.calculateArchimedeanRadius(B, t, b, a.tightness);
|
|
1482
1452
|
} else {
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1453
|
+
const B = y * 0.3 * a.tightness;
|
|
1454
|
+
x = B * I + a.startAngle, E = this.calculateLogarithmicRadius(B, t, b, a.tightness);
|
|
1485
1455
|
}
|
|
1486
|
-
const
|
|
1487
|
-
let
|
|
1456
|
+
const F = g + Math.cos(x) * E, R = h + Math.sin(x) * E, M = E / b, T = l > 0 ? 1 - M * l * 0.5 : 1, z = v ? this.random(p, w) : 1, k = T * z, D = d * k, S = D * 1.5 / 2, _ = D / 2, $ = c + S, A = s - c - S, j = c + _, N = r - c - _, P = Math.max($, Math.min(F, A)), H = Math.max(j, Math.min(R, N));
|
|
1457
|
+
let U = 0;
|
|
1488
1458
|
if (u === "random") {
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1491
|
-
} else u === "tangent" && (
|
|
1492
|
-
const
|
|
1459
|
+
const B = x * 180 / Math.PI % 360, W = this.random(f, m);
|
|
1460
|
+
U = a.spiralType === "golden" ? W : B * 0.1 + W * 0.9;
|
|
1461
|
+
} else u === "tangent" && (U = this.calculateSpiralTangent(x, E, a));
|
|
1462
|
+
const Y = t - y;
|
|
1493
1463
|
n.push({
|
|
1494
|
-
id:
|
|
1495
|
-
x:
|
|
1496
|
-
y:
|
|
1497
|
-
rotation:
|
|
1498
|
-
scale:
|
|
1499
|
-
baseSize:
|
|
1500
|
-
zIndex:
|
|
1464
|
+
id: y,
|
|
1465
|
+
x: P,
|
|
1466
|
+
y: H,
|
|
1467
|
+
rotation: U,
|
|
1468
|
+
scale: k,
|
|
1469
|
+
baseSize: D,
|
|
1470
|
+
zIndex: Y
|
|
1501
1471
|
});
|
|
1502
1472
|
}
|
|
1503
1473
|
return n;
|
|
@@ -1540,8 +1510,8 @@ class Re {
|
|
|
1540
1510
|
* r = a * e^(b*θ)
|
|
1541
1511
|
*/
|
|
1542
1512
|
calculateLogarithmicRadius(t, i, e, n) {
|
|
1543
|
-
const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n,
|
|
1544
|
-
return a /
|
|
1513
|
+
const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, d = s * Math.exp(r * c);
|
|
1514
|
+
return a / d * e;
|
|
1545
1515
|
}
|
|
1546
1516
|
/**
|
|
1547
1517
|
* Utility: Generate random number between min and max
|
|
@@ -1550,7 +1520,7 @@ class Re {
|
|
|
1550
1520
|
return Math.random() * (i - t) + t;
|
|
1551
1521
|
}
|
|
1552
1522
|
}
|
|
1553
|
-
const
|
|
1523
|
+
const Ce = {
|
|
1554
1524
|
clusterCount: "auto",
|
|
1555
1525
|
clusterSpread: 150,
|
|
1556
1526
|
clusterSpacing: 200,
|
|
@@ -1558,7 +1528,7 @@ const Ae = {
|
|
|
1558
1528
|
overlap: 0.3,
|
|
1559
1529
|
distribution: "gaussian"
|
|
1560
1530
|
};
|
|
1561
|
-
class
|
|
1531
|
+
class Re {
|
|
1562
1532
|
constructor(t, i = {}) {
|
|
1563
1533
|
this.config = t, this.imageConfig = i;
|
|
1564
1534
|
}
|
|
@@ -1570,48 +1540,48 @@ class Te {
|
|
|
1570
1540
|
* @returns Array of layout objects with position, rotation, scale
|
|
1571
1541
|
*/
|
|
1572
1542
|
generate(t, i, e = {}) {
|
|
1573
|
-
const n = [], { width: s, height: r } = i, a = { ...
|
|
1543
|
+
const n = [], { width: s, height: r } = i, a = { ...Ce, ...this.config.cluster }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, w = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || w !== 1, l = this.calculateClusterCount(
|
|
1574
1544
|
t,
|
|
1575
1545
|
a.clusterCount,
|
|
1576
1546
|
s,
|
|
1577
1547
|
r,
|
|
1578
1548
|
a.clusterSpacing
|
|
1579
|
-
),
|
|
1580
|
-
|
|
1549
|
+
), g = this.generateClusterCenters(
|
|
1550
|
+
l,
|
|
1581
1551
|
s,
|
|
1582
1552
|
r,
|
|
1583
1553
|
c,
|
|
1584
1554
|
a
|
|
1585
|
-
),
|
|
1586
|
-
for (let
|
|
1587
|
-
|
|
1588
|
-
let
|
|
1589
|
-
for (let
|
|
1590
|
-
const
|
|
1591
|
-
for (let
|
|
1592
|
-
let
|
|
1555
|
+
), h = new Array(l).fill(0);
|
|
1556
|
+
for (let I = 0; I < t; I++)
|
|
1557
|
+
h[I % l]++;
|
|
1558
|
+
let b = 0;
|
|
1559
|
+
for (let I = 0; I < l; I++) {
|
|
1560
|
+
const y = g[I], x = h[I];
|
|
1561
|
+
for (let E = 0; E < x; E++) {
|
|
1562
|
+
let F, R;
|
|
1593
1563
|
if (a.distribution === "gaussian")
|
|
1594
|
-
|
|
1564
|
+
F = this.gaussianRandom() * y.spread, R = this.gaussianRandom() * y.spread;
|
|
1595
1565
|
else {
|
|
1596
|
-
const
|
|
1597
|
-
|
|
1566
|
+
const U = this.random(0, Math.PI * 2), Y = this.random(0, y.spread);
|
|
1567
|
+
F = Math.cos(U) * Y, R = Math.sin(U) * Y;
|
|
1598
1568
|
}
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1601
|
-
const
|
|
1602
|
-
let
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1605
|
-
const
|
|
1569
|
+
const M = 1 + a.overlap * 0.5, T = 1 + a.overlap * 0.3;
|
|
1570
|
+
F /= M, R /= M;
|
|
1571
|
+
const z = v ? this.random(p, w) : 1, k = T * z, D = d * k;
|
|
1572
|
+
let O = y.x + F, S = y.y + R;
|
|
1573
|
+
const $ = D * 1.5 / 2, A = D / 2;
|
|
1574
|
+
O = Math.max(c + $, Math.min(O, s - c - $)), S = Math.max(c + A, Math.min(S, r - c - A));
|
|
1575
|
+
const j = u === "random" ? this.random(f, m) : 0, P = Math.sqrt(F * F + R * R) / y.spread, H = Math.round((1 - P) * 50) + 1;
|
|
1606
1576
|
n.push({
|
|
1607
|
-
id:
|
|
1608
|
-
x:
|
|
1609
|
-
y:
|
|
1610
|
-
rotation:
|
|
1611
|
-
scale:
|
|
1612
|
-
baseSize:
|
|
1613
|
-
zIndex:
|
|
1614
|
-
}),
|
|
1577
|
+
id: b,
|
|
1578
|
+
x: O,
|
|
1579
|
+
y: S,
|
|
1580
|
+
rotation: j,
|
|
1581
|
+
scale: k,
|
|
1582
|
+
baseSize: D,
|
|
1583
|
+
zIndex: H
|
|
1584
|
+
}), b++;
|
|
1615
1585
|
}
|
|
1616
1586
|
}
|
|
1617
1587
|
return n;
|
|
@@ -1631,24 +1601,24 @@ class Te {
|
|
|
1631
1601
|
* Generate cluster center positions with spacing constraints
|
|
1632
1602
|
*/
|
|
1633
1603
|
generateClusterCenters(t, i, e, n, s) {
|
|
1634
|
-
const r = [], c = n + s.clusterSpread,
|
|
1635
|
-
for (let
|
|
1636
|
-
let
|
|
1637
|
-
for (let
|
|
1638
|
-
const
|
|
1639
|
-
x: this.random(c,
|
|
1640
|
-
y: this.random(u,
|
|
1604
|
+
const r = [], c = n + s.clusterSpread, d = i - n - s.clusterSpread, u = n + s.clusterSpread, f = e - n - s.clusterSpread;
|
|
1605
|
+
for (let m = 0; m < t; m++) {
|
|
1606
|
+
let p = null, w = -1;
|
|
1607
|
+
for (let v = 0; v < 100; v++) {
|
|
1608
|
+
const l = {
|
|
1609
|
+
x: this.random(c, d),
|
|
1610
|
+
y: this.random(u, f),
|
|
1641
1611
|
spread: this.calculateClusterSpread(s)
|
|
1642
1612
|
};
|
|
1643
|
-
let
|
|
1644
|
-
for (const
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1613
|
+
let g = 1 / 0;
|
|
1614
|
+
for (const h of r) {
|
|
1615
|
+
const b = l.x - h.x, I = l.y - h.y, y = Math.sqrt(b * b + I * I);
|
|
1616
|
+
g = Math.min(g, y);
|
|
1647
1617
|
}
|
|
1648
|
-
if ((r.length === 0 ||
|
|
1618
|
+
if ((r.length === 0 || g > w) && (p = l, w = g), g >= s.clusterSpacing)
|
|
1649
1619
|
break;
|
|
1650
1620
|
}
|
|
1651
|
-
|
|
1621
|
+
p && r.push(p);
|
|
1652
1622
|
}
|
|
1653
1623
|
return r;
|
|
1654
1624
|
}
|
|
@@ -1676,7 +1646,7 @@ class Te {
|
|
|
1676
1646
|
return Math.random() * (i - t) + t;
|
|
1677
1647
|
}
|
|
1678
1648
|
}
|
|
1679
|
-
class
|
|
1649
|
+
class Te {
|
|
1680
1650
|
constructor(t, i = {}) {
|
|
1681
1651
|
this.config = t, this.imageConfig = i;
|
|
1682
1652
|
}
|
|
@@ -1688,29 +1658,29 @@ class Le {
|
|
|
1688
1658
|
* @returns Array of layout objects with position, rotation, scale
|
|
1689
1659
|
*/
|
|
1690
1660
|
generate(t, i, e = {}) {
|
|
1691
|
-
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50,
|
|
1661
|
+
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, v = e.fixedHeight ?? a, l = {
|
|
1692
1662
|
...Wt,
|
|
1693
1663
|
...this.config.wave
|
|
1694
|
-
}, { rows:
|
|
1695
|
-
let
|
|
1696
|
-
for (let A = 0; A <
|
|
1697
|
-
const
|
|
1698
|
-
let
|
|
1699
|
-
|
|
1700
|
-
for (let
|
|
1701
|
-
const
|
|
1664
|
+
}, { rows: g, amplitude: h, frequency: b, phaseShift: I, synchronization: y } = l, x = Math.ceil(t / g), R = v * 1.5 / 2, M = c + R, T = s - c - R, z = T - M, k = x > 1 ? z / (x - 1) : 0, D = c + h + v / 2, O = r - c - h - v / 2, S = O - D, _ = g > 1 ? S / (g - 1) : 0;
|
|
1665
|
+
let $ = 0;
|
|
1666
|
+
for (let A = 0; A < g && $ < t; A++) {
|
|
1667
|
+
const j = g === 1 ? (D + O) / 2 : D + A * _;
|
|
1668
|
+
let N = 0;
|
|
1669
|
+
y === "offset" ? N = A * I : y === "alternating" && (N = A * Math.PI);
|
|
1670
|
+
for (let P = 0; P < x && $ < t; P++) {
|
|
1671
|
+
const H = x === 1 ? (M + T) / 2 : M + P * k, U = this.calculateWaveY(H, s, h, b, N), Y = H, B = j + U, W = w ? this.random(m, p) : 1, X = v * W;
|
|
1702
1672
|
let V = 0;
|
|
1703
|
-
|
|
1704
|
-
const K =
|
|
1673
|
+
d === "tangent" ? V = this.calculateRotation(H, s, h, b, N) : d === "random" && (V = this.random(u, f));
|
|
1674
|
+
const K = X * 1.5 / 2, lt = X / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
|
|
1705
1675
|
n.push({
|
|
1706
|
-
id:
|
|
1707
|
-
x: Math.max(nt, Math.min(
|
|
1708
|
-
y: Math.max(ht, Math.min(
|
|
1676
|
+
id: $,
|
|
1677
|
+
x: Math.max(nt, Math.min(Y, ot)),
|
|
1678
|
+
y: Math.max(ht, Math.min(B, dt)),
|
|
1709
1679
|
rotation: V,
|
|
1710
|
-
scale:
|
|
1711
|
-
baseSize:
|
|
1712
|
-
zIndex:
|
|
1713
|
-
}),
|
|
1680
|
+
scale: W,
|
|
1681
|
+
baseSize: X,
|
|
1682
|
+
zIndex: $ + 1
|
|
1683
|
+
}), $++;
|
|
1714
1684
|
}
|
|
1715
1685
|
}
|
|
1716
1686
|
return n;
|
|
@@ -1753,7 +1723,7 @@ class Le {
|
|
|
1753
1723
|
return Math.random() * (i - t) + t;
|
|
1754
1724
|
}
|
|
1755
1725
|
}
|
|
1756
|
-
const
|
|
1726
|
+
const Et = 100, Q = 100 / Math.sqrt(3), wt = [
|
|
1757
1727
|
[Q / 2, 0],
|
|
1758
1728
|
// upper-left
|
|
1759
1729
|
[3 * Q / 2, 0],
|
|
@@ -1766,21 +1736,21 @@ const wt = 100, Q = 100 / Math.sqrt(3), xt = [
|
|
|
1766
1736
|
// lower-left
|
|
1767
1737
|
[0, 50]
|
|
1768
1738
|
// left
|
|
1769
|
-
],
|
|
1770
|
-
function
|
|
1739
|
+
], Ae = wt[1][0] / Et, Le = wt[2][1] / Et;
|
|
1740
|
+
function Fe(o) {
|
|
1771
1741
|
return {
|
|
1772
|
-
colStep:
|
|
1773
|
-
rowOffset:
|
|
1742
|
+
colStep: Ae * o,
|
|
1743
|
+
rowOffset: Le * o
|
|
1774
1744
|
};
|
|
1775
1745
|
}
|
|
1776
|
-
function
|
|
1777
|
-
const { colStep: r } =
|
|
1746
|
+
function Me(o, t, i, e, n, s) {
|
|
1747
|
+
const { colStep: r } = Fe(s);
|
|
1778
1748
|
return {
|
|
1779
1749
|
px: e + r * o,
|
|
1780
1750
|
py: n + s * (t + o / 2)
|
|
1781
1751
|
};
|
|
1782
1752
|
}
|
|
1783
|
-
const
|
|
1753
|
+
const Oe = [
|
|
1784
1754
|
[1, 0, -1],
|
|
1785
1755
|
[0, 1, -1],
|
|
1786
1756
|
[-1, 1, 0],
|
|
@@ -1788,49 +1758,49 @@ const De = [
|
|
|
1788
1758
|
[0, -1, 1],
|
|
1789
1759
|
[1, -1, 0]
|
|
1790
1760
|
];
|
|
1791
|
-
function
|
|
1761
|
+
function ze(o) {
|
|
1792
1762
|
if (o === 0) return [[0, 0, 0]];
|
|
1793
1763
|
const t = [];
|
|
1794
1764
|
let [i, e, n] = [0, -o, o];
|
|
1795
|
-
for (const [s, r, a] of
|
|
1765
|
+
for (const [s, r, a] of Oe)
|
|
1796
1766
|
for (let c = 0; c < o; c++)
|
|
1797
1767
|
t.push([i, e, n]), i += s, e += r, n += a;
|
|
1798
1768
|
return t;
|
|
1799
1769
|
}
|
|
1800
|
-
class
|
|
1770
|
+
class De {
|
|
1801
1771
|
// imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
|
|
1802
1772
|
// would break hex tiling). Kept as parameter for interface compatibility.
|
|
1803
1773
|
constructor(t, i = {}) {
|
|
1804
1774
|
this.config = t;
|
|
1805
1775
|
}
|
|
1806
1776
|
generate(t, i, e = {}) {
|
|
1807
|
-
const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2,
|
|
1777
|
+
const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, d = e.fixedHeight ?? 200, f = {
|
|
1808
1778
|
...Gt,
|
|
1809
1779
|
...this.config.honeycomb
|
|
1810
|
-
}.spacing ?? 0,
|
|
1811
|
-
let
|
|
1812
|
-
for (;
|
|
1813
|
-
const
|
|
1814
|
-
for (const [
|
|
1815
|
-
if (
|
|
1816
|
-
const { px:
|
|
1780
|
+
}.spacing ?? 0, m = d + f;
|
|
1781
|
+
let p = 0, w = 0;
|
|
1782
|
+
for (; p < t; ) {
|
|
1783
|
+
const v = ze(w);
|
|
1784
|
+
for (const [l, g, h] of v) {
|
|
1785
|
+
if (p >= t) break;
|
|
1786
|
+
const { px: b, py: I } = Me(l, g, h, a, c, m);
|
|
1817
1787
|
n.push({
|
|
1818
|
-
id:
|
|
1819
|
-
x:
|
|
1820
|
-
y:
|
|
1788
|
+
id: p,
|
|
1789
|
+
x: b,
|
|
1790
|
+
y: I,
|
|
1821
1791
|
rotation: 0,
|
|
1822
1792
|
scale: 1,
|
|
1823
|
-
baseSize:
|
|
1793
|
+
baseSize: d,
|
|
1824
1794
|
// Inner rings render above outer rings
|
|
1825
|
-
zIndex: Math.max(1, 100 -
|
|
1826
|
-
}),
|
|
1795
|
+
zIndex: Math.max(1, 100 - w)
|
|
1796
|
+
}), p++;
|
|
1827
1797
|
}
|
|
1828
|
-
|
|
1798
|
+
w++;
|
|
1829
1799
|
}
|
|
1830
1800
|
return n;
|
|
1831
1801
|
}
|
|
1832
1802
|
}
|
|
1833
|
-
class
|
|
1803
|
+
class $e {
|
|
1834
1804
|
constructor(t) {
|
|
1835
1805
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1836
1806
|
}
|
|
@@ -1841,19 +1811,19 @@ class _e {
|
|
|
1841
1811
|
initLayout() {
|
|
1842
1812
|
switch (this.config.algorithm) {
|
|
1843
1813
|
case "radial":
|
|
1844
|
-
return new
|
|
1814
|
+
return new ve(this.config, this.imageConfig);
|
|
1845
1815
|
case "grid":
|
|
1846
|
-
return new
|
|
1816
|
+
return new Ee(this.config, this.imageConfig);
|
|
1847
1817
|
case "spiral":
|
|
1848
|
-
return new
|
|
1818
|
+
return new Se(this.config, this.imageConfig);
|
|
1849
1819
|
case "cluster":
|
|
1850
|
-
return new
|
|
1820
|
+
return new Re(this.config, this.imageConfig);
|
|
1851
1821
|
case "wave":
|
|
1852
|
-
return new
|
|
1822
|
+
return new Te(this.config, this.imageConfig);
|
|
1853
1823
|
case "honeycomb":
|
|
1854
|
-
return new
|
|
1824
|
+
return new De(this.config, this.imageConfig);
|
|
1855
1825
|
default:
|
|
1856
|
-
return new
|
|
1826
|
+
return new ye(this.config, this.imageConfig);
|
|
1857
1827
|
}
|
|
1858
1828
|
}
|
|
1859
1829
|
/**
|
|
@@ -1935,15 +1905,15 @@ class _e {
|
|
|
1935
1905
|
const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
|
|
1936
1906
|
if (r !== void 0)
|
|
1937
1907
|
return { height: r };
|
|
1938
|
-
const a = s?.minSize ?? 50, c = s?.maxSize ?? 400,
|
|
1939
|
-
let
|
|
1940
|
-
|
|
1941
|
-
let
|
|
1942
|
-
if (
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1908
|
+
const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, d = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: f, height: m } = t, v = f * m * d / i;
|
|
1909
|
+
let g = Math.sqrt(v / 1.4);
|
|
1910
|
+
g *= u, g = Math.min(g, e);
|
|
1911
|
+
let h = this.clamp(g, a, c);
|
|
1912
|
+
if (h === a && g < a) {
|
|
1913
|
+
const b = Math.max(a * 0.05, 20);
|
|
1914
|
+
h = Math.max(b, g);
|
|
1945
1915
|
}
|
|
1946
|
-
return this.config.algorithm === "honeycomb" && (
|
|
1916
|
+
return this.config.algorithm === "honeycomb" && (h = Math.min(h, this.honeycombMaxImageHeight(i, t))), { height: h };
|
|
1947
1917
|
}
|
|
1948
1918
|
/**
|
|
1949
1919
|
* Returns the largest image height at which all honeycomb rings fit within the container.
|
|
@@ -1955,8 +1925,8 @@ class _e {
|
|
|
1955
1925
|
let e = 0, n = 1;
|
|
1956
1926
|
for (; n < t; )
|
|
1957
1927
|
e++, n += 6 * e;
|
|
1958
|
-
const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2,
|
|
1959
|
-
return Math.max(10, Math.min(
|
|
1928
|
+
const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, d = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), f = (c - s - r * e) / (e + 0.5), m = (a - s - d * r * e) / (d * e + u);
|
|
1929
|
+
return Math.max(10, Math.min(f, m));
|
|
1960
1930
|
}
|
|
1961
1931
|
/**
|
|
1962
1932
|
* Utility: Clamp a value between min and max
|
|
@@ -1965,7 +1935,7 @@ class _e {
|
|
|
1965
1935
|
return Math.max(i, Math.min(e, t));
|
|
1966
1936
|
}
|
|
1967
1937
|
}
|
|
1968
|
-
var
|
|
1938
|
+
var C = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(C || {});
|
|
1969
1939
|
const Lt = {
|
|
1970
1940
|
// Geometric shapes - uses percentages for responsive sizing
|
|
1971
1941
|
circle: "circle(50%)",
|
|
@@ -1975,7 +1945,7 @@ const Lt = {
|
|
|
1975
1945
|
hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
|
1976
1946
|
octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
|
|
1977
1947
|
diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
|
|
1978
|
-
},
|
|
1948
|
+
}, Pe = {
|
|
1979
1949
|
// Circle - uses radius in pixels (refHeight of 100px = 50px radius)
|
|
1980
1950
|
circle: {
|
|
1981
1951
|
refHeight: 100,
|
|
@@ -1999,8 +1969,8 @@ const Lt = {
|
|
|
1999
1969
|
},
|
|
2000
1970
|
// Hexagon - regular hexagon (reference points imported from hexagonGeometry)
|
|
2001
1971
|
hexagon: {
|
|
2002
|
-
refHeight:
|
|
2003
|
-
points:
|
|
1972
|
+
refHeight: Et,
|
|
1973
|
+
points: wt
|
|
2004
1974
|
},
|
|
2005
1975
|
// Octagon - regular octagon
|
|
2006
1976
|
octagon: {
|
|
@@ -2013,29 +1983,29 @@ const Lt = {
|
|
|
2013
1983
|
points: [[50, 0], [100, 50], [50, 100], [0, 50]]
|
|
2014
1984
|
}
|
|
2015
1985
|
};
|
|
2016
|
-
function
|
|
1986
|
+
function _e(o) {
|
|
2017
1987
|
if (o)
|
|
2018
1988
|
return o in Lt ? Lt[o] : o;
|
|
2019
1989
|
}
|
|
2020
|
-
function
|
|
2021
|
-
const e =
|
|
1990
|
+
function Ue(o, t, i) {
|
|
1991
|
+
const e = Pe[o];
|
|
2022
1992
|
if (!e) return "";
|
|
2023
1993
|
const n = t / e.refHeight;
|
|
2024
1994
|
if (o === "circle")
|
|
2025
1995
|
return `circle(${Math.round(50 * n * 100) / 100}px)`;
|
|
2026
|
-
const s = e.points.map(([
|
|
2027
|
-
return `polygon(${e.points.map(([
|
|
2028
|
-
const
|
|
2029
|
-
return `${
|
|
1996
|
+
const s = e.points.map(([v]) => v), r = e.points.map(([, v]) => v), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, d = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? d) / 2, f = t / 2, m = u - a, p = f - c;
|
|
1997
|
+
return `polygon(${e.points.map(([v, l]) => {
|
|
1998
|
+
const g = Math.round((v * n + m) * 100) / 100, h = Math.round((l * n + p) * 100) / 100;
|
|
1999
|
+
return `${g}px ${h}px`;
|
|
2030
2000
|
}).join(", ")})`;
|
|
2031
2001
|
}
|
|
2032
2002
|
function ke(o) {
|
|
2033
2003
|
return o in mt;
|
|
2034
2004
|
}
|
|
2035
|
-
function
|
|
2005
|
+
function He(o) {
|
|
2036
2006
|
return o ? ke(o) ? mt[o] : o : mt.md;
|
|
2037
2007
|
}
|
|
2038
|
-
function
|
|
2008
|
+
function Ne(o) {
|
|
2039
2009
|
if (!o) return "";
|
|
2040
2010
|
const t = [];
|
|
2041
2011
|
if (o.grayscale !== void 0 && t.push(`grayscale(${o.grayscale})`), o.blur !== void 0 && t.push(`blur(${o.blur}px)`), o.brightness !== void 0 && t.push(`brightness(${o.brightness})`), o.contrast !== void 0 && t.push(`contrast(${o.contrast})`), o.saturate !== void 0 && t.push(`saturate(${o.saturate})`), o.opacity !== void 0 && t.push(`opacity(${o.opacity})`), o.sepia !== void 0 && t.push(`sepia(${o.sepia})`), o.hueRotate !== void 0 && t.push(`hue-rotate(${o.hueRotate}deg)`), o.invert !== void 0 && t.push(`invert(${o.invert})`), o.dropShadow !== void 0)
|
|
@@ -2061,34 +2031,34 @@ function it(o, t, i) {
|
|
|
2061
2031
|
o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : a && (e.borderTopLeftRadius = `${a}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : a && (e.borderTopRightRadius = `${a}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : a && (e.borderBottomRightRadius = `${a}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : a && (e.borderBottomLeftRadius = `${a}px`);
|
|
2062
2032
|
} else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
|
|
2063
2033
|
if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
|
|
2064
|
-
const a = o.border || {}, c = { ...a, ...o.borderTop },
|
|
2065
|
-
e.borderTop = tt(c), e.borderRight = tt(
|
|
2034
|
+
const a = o.border || {}, c = { ...a, ...o.borderTop }, d = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, f = { ...a, ...o.borderLeft };
|
|
2035
|
+
e.borderTop = tt(c), e.borderRight = tt(d), e.borderBottom = tt(u), e.borderLeft = tt(f);
|
|
2066
2036
|
} else o.border && (e.border = tt(o.border));
|
|
2067
|
-
o.shadow !== void 0 && (e.boxShadow =
|
|
2068
|
-
const r =
|
|
2037
|
+
o.shadow !== void 0 && (e.boxShadow = He(o.shadow));
|
|
2038
|
+
const r = Ne(o.filter);
|
|
2069
2039
|
if (e.filter = r || "none", o.opacity !== void 0 && (e.opacity = String(o.opacity)), o.cursor !== void 0 && (e.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
|
|
2070
|
-
const a = o.outline.width ?? 0, c = o.outline.style ?? "solid",
|
|
2071
|
-
e.outline = `${a}px ${c} ${
|
|
2040
|
+
const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", d = o.outline.color ?? "#000000";
|
|
2041
|
+
e.outline = `${a}px ${c} ${d}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
2072
2042
|
}
|
|
2073
2043
|
if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
|
|
2074
2044
|
let a;
|
|
2075
|
-
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath,
|
|
2076
|
-
if (
|
|
2077
|
-
a =
|
|
2045
|
+
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, d = c ? o.clipPath : void 0;
|
|
2046
|
+
if (d?.mode === "height-relative" && t)
|
|
2047
|
+
a = Ue(d.shape, t, i);
|
|
2078
2048
|
else {
|
|
2079
|
-
const u = c &&
|
|
2080
|
-
a =
|
|
2049
|
+
const u = c && d ? d.shape : o.clipPath;
|
|
2050
|
+
a = _e(u);
|
|
2081
2051
|
}
|
|
2082
2052
|
a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
|
|
2083
2053
|
}
|
|
2084
2054
|
return e;
|
|
2085
2055
|
}
|
|
2086
|
-
function
|
|
2056
|
+
function Be(o, t) {
|
|
2087
2057
|
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);
|
|
2088
2058
|
}
|
|
2089
2059
|
function st(o, t, i, e) {
|
|
2090
2060
|
const n = it(t, i, e);
|
|
2091
|
-
|
|
2061
|
+
Be(o, n);
|
|
2092
2062
|
}
|
|
2093
2063
|
function Pt(o) {
|
|
2094
2064
|
return o ? Array.isArray(o) ? o.join(" ") : o : "";
|
|
@@ -2105,13 +2075,13 @@ function pt(o, t) {
|
|
|
2105
2075
|
e.trim() && o.classList.remove(e.trim());
|
|
2106
2076
|
});
|
|
2107
2077
|
}
|
|
2108
|
-
const
|
|
2078
|
+
const Ft = {
|
|
2109
2079
|
UNFOCUSING: 999,
|
|
2110
2080
|
FOCUSING: 1e3
|
|
2111
2081
|
};
|
|
2112
|
-
class
|
|
2082
|
+
class je {
|
|
2113
2083
|
constructor(t, i, e) {
|
|
2114
|
-
this.state =
|
|
2084
|
+
this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
|
|
2115
2085
|
}
|
|
2116
2086
|
/**
|
|
2117
2087
|
* Set callback to be fired when an unfocus animation fully completes.
|
|
@@ -2129,7 +2099,7 @@ class Ge {
|
|
|
2129
2099
|
* Check if any animation is in progress
|
|
2130
2100
|
*/
|
|
2131
2101
|
isAnimating() {
|
|
2132
|
-
return this.state !==
|
|
2102
|
+
return this.state !== C.IDLE && this.state !== C.FOCUSED;
|
|
2133
2103
|
}
|
|
2134
2104
|
/**
|
|
2135
2105
|
* Normalize scalePercent value
|
|
@@ -2144,8 +2114,8 @@ class Ge {
|
|
|
2144
2114
|
calculateFocusDimensions(t, i, e) {
|
|
2145
2115
|
const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
|
|
2146
2116
|
let a = s, c = a * r;
|
|
2147
|
-
const
|
|
2148
|
-
return c >
|
|
2117
|
+
const d = e.width * n;
|
|
2118
|
+
return c > d && (c = d, a = c / r), { width: c, height: a };
|
|
2149
2119
|
}
|
|
2150
2120
|
/**
|
|
2151
2121
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
@@ -2177,11 +2147,11 @@ class Ge {
|
|
|
2177
2147
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
2178
2148
|
*/
|
|
2179
2149
|
animateWithDimensions(t, i, e, n, s, r, a, c) {
|
|
2180
|
-
const
|
|
2150
|
+
const d = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
|
|
2181
2151
|
return t.style.transition = "none", t.animate(
|
|
2182
2152
|
[
|
|
2183
2153
|
{
|
|
2184
|
-
transform:
|
|
2154
|
+
transform: d,
|
|
2185
2155
|
width: `${n}px`,
|
|
2186
2156
|
height: `${s}px`
|
|
2187
2157
|
},
|
|
@@ -2238,33 +2208,33 @@ class Ge {
|
|
|
2238
2208
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2239
2209
|
*/
|
|
2240
2210
|
startFocusAnimation(t, i, e, n, s) {
|
|
2241
|
-
const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight,
|
|
2211
|
+
const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, d = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
|
|
2242
2212
|
this.animationEngine.cancelAllAnimations(t);
|
|
2243
|
-
const
|
|
2244
|
-
this.applyFocusedStyling(t,
|
|
2245
|
-
const
|
|
2213
|
+
const f = this.config.animationDuration ?? 600;
|
|
2214
|
+
this.applyFocusedStyling(t, Ft.FOCUSING);
|
|
2215
|
+
const m = n ?? {
|
|
2246
2216
|
x: 0,
|
|
2247
2217
|
y: 0,
|
|
2248
2218
|
rotation: e.rotation,
|
|
2249
2219
|
scale: 1
|
|
2250
2220
|
// No scale - using dimensions
|
|
2251
|
-
},
|
|
2221
|
+
}, p = s?.width ?? a, w = s?.height ?? c, v = this.animateWithDimensions(
|
|
2252
2222
|
t,
|
|
2253
|
-
|
|
2223
|
+
m,
|
|
2254
2224
|
u,
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
),
|
|
2225
|
+
p,
|
|
2226
|
+
w,
|
|
2227
|
+
d.width,
|
|
2228
|
+
d.height,
|
|
2229
|
+
f
|
|
2230
|
+
), l = {
|
|
2261
2231
|
id: `focus-${Date.now()}`,
|
|
2262
2232
|
element: t,
|
|
2263
|
-
animation:
|
|
2264
|
-
fromState:
|
|
2233
|
+
animation: v,
|
|
2234
|
+
fromState: m,
|
|
2265
2235
|
toState: u,
|
|
2266
2236
|
startTime: performance.now(),
|
|
2267
|
-
duration:
|
|
2237
|
+
duration: f
|
|
2268
2238
|
};
|
|
2269
2239
|
return this.focusData = {
|
|
2270
2240
|
element: t,
|
|
@@ -2273,12 +2243,12 @@ class Ge {
|
|
|
2273
2243
|
originalZIndex: r,
|
|
2274
2244
|
originalWidth: a,
|
|
2275
2245
|
originalHeight: c,
|
|
2276
|
-
focusWidth:
|
|
2277
|
-
focusHeight:
|
|
2278
|
-
}, this.startClipPathAnimation(t,
|
|
2246
|
+
focusWidth: d.width,
|
|
2247
|
+
focusHeight: d.height
|
|
2248
|
+
}, this.startClipPathAnimation(t, l, !0), {
|
|
2279
2249
|
element: t,
|
|
2280
2250
|
originalState: e,
|
|
2281
|
-
animationHandle:
|
|
2251
|
+
animationHandle: l,
|
|
2282
2252
|
direction: "in",
|
|
2283
2253
|
originalWidth: a,
|
|
2284
2254
|
originalHeight: c
|
|
@@ -2290,40 +2260,40 @@ class Ge {
|
|
|
2290
2260
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2291
2261
|
*/
|
|
2292
2262
|
startUnfocusAnimation(t, i, e, n) {
|
|
2293
|
-
t.style.zIndex = String(
|
|
2263
|
+
t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2294
2264
|
const s = this.config.animationDuration ?? 600;
|
|
2295
2265
|
t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
|
|
2296
|
-
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight,
|
|
2266
|
+
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, d = {
|
|
2297
2267
|
x: 0,
|
|
2298
2268
|
y: 0,
|
|
2299
2269
|
rotation: i.rotation,
|
|
2300
2270
|
scale: 1
|
|
2301
2271
|
// No scale - using dimensions
|
|
2302
|
-
}, u = this.focusData?.originalWidth ?? t.offsetWidth,
|
|
2272
|
+
}, u = this.focusData?.originalWidth ?? t.offsetWidth, f = this.focusData?.originalHeight ?? t.offsetHeight, m = this.animateWithDimensions(
|
|
2303
2273
|
t,
|
|
2304
2274
|
r,
|
|
2305
|
-
|
|
2275
|
+
d,
|
|
2306
2276
|
a,
|
|
2307
2277
|
c,
|
|
2308
2278
|
u,
|
|
2309
|
-
|
|
2279
|
+
f,
|
|
2310
2280
|
s
|
|
2311
|
-
),
|
|
2281
|
+
), p = {
|
|
2312
2282
|
id: `unfocus-${Date.now()}`,
|
|
2313
2283
|
element: t,
|
|
2314
|
-
animation:
|
|
2284
|
+
animation: m,
|
|
2315
2285
|
fromState: r,
|
|
2316
|
-
toState:
|
|
2286
|
+
toState: d,
|
|
2317
2287
|
startTime: performance.now(),
|
|
2318
2288
|
duration: s
|
|
2319
2289
|
};
|
|
2320
|
-
return this.startClipPathAnimation(t,
|
|
2290
|
+
return this.startClipPathAnimation(t, p, !1), {
|
|
2321
2291
|
element: t,
|
|
2322
2292
|
originalState: i,
|
|
2323
|
-
animationHandle:
|
|
2293
|
+
animationHandle: p,
|
|
2324
2294
|
direction: "out",
|
|
2325
2295
|
originalWidth: u,
|
|
2326
|
-
originalHeight:
|
|
2296
|
+
originalHeight: f
|
|
2327
2297
|
};
|
|
2328
2298
|
}
|
|
2329
2299
|
/**
|
|
@@ -2369,26 +2339,26 @@ class Ge {
|
|
|
2369
2339
|
* Implements cross-animation when swapping focus
|
|
2370
2340
|
*/
|
|
2371
2341
|
async focusImage(t, i, e) {
|
|
2372
|
-
if (this.currentFocus === t && this.state ===
|
|
2342
|
+
if (this.currentFocus === t && this.state === C.FOCUSED)
|
|
2373
2343
|
return this.unfocusImage();
|
|
2374
|
-
if (this.incoming?.element === t && this.state ===
|
|
2344
|
+
if (this.incoming?.element === t && this.state === C.FOCUSING) {
|
|
2375
2345
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2376
2346
|
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2377
2347
|
t,
|
|
2378
2348
|
this.incoming.originalState,
|
|
2379
2349
|
s,
|
|
2380
2350
|
r
|
|
2381
|
-
), this.incoming = null, this.state =
|
|
2351
|
+
), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE;
|
|
2382
2352
|
return;
|
|
2383
2353
|
}
|
|
2384
2354
|
const n = ++this.focusGeneration;
|
|
2385
2355
|
switch (this.state) {
|
|
2386
|
-
case
|
|
2387
|
-
if (this.state =
|
|
2388
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2356
|
+
case C.IDLE:
|
|
2357
|
+
if (this.state = C.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2358
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2389
2359
|
break;
|
|
2390
|
-
case
|
|
2391
|
-
if (this.state =
|
|
2360
|
+
case C.FOCUSED:
|
|
2361
|
+
if (this.state = C.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2392
2362
|
this.currentFocus,
|
|
2393
2363
|
this.focusData.originalState
|
|
2394
2364
|
)), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
@@ -2400,9 +2370,9 @@ class Ge {
|
|
|
2400
2370
|
const s = this.outgoing.element;
|
|
2401
2371
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2402
2372
|
}
|
|
2403
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2373
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2404
2374
|
break;
|
|
2405
|
-
case
|
|
2375
|
+
case C.FOCUSING:
|
|
2406
2376
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2407
2377
|
this.incoming.element,
|
|
2408
2378
|
this.incoming.originalState,
|
|
@@ -2410,10 +2380,10 @@ class Ge {
|
|
|
2410
2380
|
this.focusData?.originalWidth,
|
|
2411
2381
|
this.focusData?.originalHeight
|
|
2412
2382
|
), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2413
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2383
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2414
2384
|
break;
|
|
2415
|
-
case
|
|
2416
|
-
if (this.state =
|
|
2385
|
+
case C.UNFOCUSING:
|
|
2386
|
+
if (this.state = C.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
2417
2387
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2418
2388
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2419
2389
|
]), this.focusGeneration !== n) return;
|
|
@@ -2421,9 +2391,9 @@ class Ge {
|
|
|
2421
2391
|
const s = this.outgoing.element;
|
|
2422
2392
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2423
2393
|
}
|
|
2424
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2394
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2425
2395
|
break;
|
|
2426
|
-
case
|
|
2396
|
+
case C.CROSS_ANIMATING:
|
|
2427
2397
|
if (this.incoming?.element === t)
|
|
2428
2398
|
return;
|
|
2429
2399
|
if (this.outgoing?.element === t) {
|
|
@@ -2446,7 +2416,7 @@ class Ge {
|
|
|
2446
2416
|
const a = this.outgoing.element;
|
|
2447
2417
|
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2448
2418
|
}
|
|
2449
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2419
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2450
2420
|
return;
|
|
2451
2421
|
}
|
|
2452
2422
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2472,7 +2442,7 @@ class Ge {
|
|
|
2472
2442
|
const s = this.outgoing.element;
|
|
2473
2443
|
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2474
2444
|
}
|
|
2475
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2445
|
+
this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
|
|
2476
2446
|
break;
|
|
2477
2447
|
}
|
|
2478
2448
|
}
|
|
@@ -2480,24 +2450,24 @@ class Ge {
|
|
|
2480
2450
|
* Unfocus current image, returning it to original position
|
|
2481
2451
|
*/
|
|
2482
2452
|
async unfocusImage() {
|
|
2483
|
-
if (this.state ===
|
|
2453
|
+
if (this.state === C.UNFOCUSING)
|
|
2484
2454
|
return;
|
|
2485
2455
|
const t = ++this.focusGeneration;
|
|
2486
2456
|
if (!this.currentFocus || !this.focusData) {
|
|
2487
|
-
if (this.incoming && this.state ===
|
|
2457
|
+
if (this.incoming && this.state === C.FOCUSING) {
|
|
2488
2458
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2489
2459
|
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2490
2460
|
this.incoming.element,
|
|
2491
2461
|
this.incoming.originalState,
|
|
2492
2462
|
s,
|
|
2493
2463
|
r
|
|
2494
|
-
), this.incoming = null, this.state =
|
|
2464
|
+
), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2495
2465
|
const a = this.outgoing.element;
|
|
2496
|
-
this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state =
|
|
2466
|
+
this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(a);
|
|
2497
2467
|
}
|
|
2498
2468
|
return;
|
|
2499
2469
|
}
|
|
2500
|
-
if (this.state ===
|
|
2470
|
+
if (this.state === C.CROSS_ANIMATING && this.incoming) {
|
|
2501
2471
|
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2502
2472
|
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2503
2473
|
const a = this.startUnfocusAnimation(
|
|
@@ -2512,13 +2482,13 @@ class Ge {
|
|
|
2512
2482
|
]), this.focusGeneration !== t) return;
|
|
2513
2483
|
let c = null;
|
|
2514
2484
|
this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2515
|
-
const
|
|
2516
|
-
this.removeFocusedStyling(
|
|
2485
|
+
const d = a.element;
|
|
2486
|
+
this.removeFocusedStyling(d, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(d);
|
|
2517
2487
|
return;
|
|
2518
2488
|
}
|
|
2519
|
-
this.state =
|
|
2489
|
+
this.state = C.UNFOCUSING;
|
|
2520
2490
|
const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2521
|
-
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state =
|
|
2491
|
+
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(i));
|
|
2522
2492
|
}
|
|
2523
2493
|
/**
|
|
2524
2494
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2536,7 +2506,7 @@ class Ge {
|
|
|
2536
2506
|
* Check if an image is currently focused (stable state)
|
|
2537
2507
|
*/
|
|
2538
2508
|
isFocused(t) {
|
|
2539
|
-
return this.currentFocus === t && this.state ===
|
|
2509
|
+
return this.currentFocus === t && this.state === C.FOCUSED;
|
|
2540
2510
|
}
|
|
2541
2511
|
/**
|
|
2542
2512
|
* Check if an image is the target of current focus animation
|
|
@@ -2557,7 +2527,7 @@ class Ge {
|
|
|
2557
2527
|
* Used during swipe gestures for visual feedback
|
|
2558
2528
|
*/
|
|
2559
2529
|
setDragOffset(t) {
|
|
2560
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2530
|
+
if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
|
|
2561
2531
|
const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
|
|
2562
2532
|
n.push(`translate(${s}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
|
|
2563
2533
|
}
|
|
@@ -2567,7 +2537,7 @@ class Ge {
|
|
|
2567
2537
|
* @param duration - Animation duration in ms (default 150)
|
|
2568
2538
|
*/
|
|
2569
2539
|
clearDragOffset(t, i = 150) {
|
|
2570
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2540
|
+
if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
|
|
2571
2541
|
const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
|
|
2572
2542
|
s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
|
|
2573
2543
|
const c = s.join(" ");
|
|
@@ -2597,10 +2567,10 @@ class Ge {
|
|
|
2597
2567
|
this.focusData.originalZIndex,
|
|
2598
2568
|
this.focusData.originalWidth,
|
|
2599
2569
|
this.focusData.originalHeight
|
|
2600
|
-
), this.state =
|
|
2570
|
+
), this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2601
2571
|
}
|
|
2602
2572
|
}
|
|
2603
|
-
const
|
|
2573
|
+
const We = 50, Ge = 0.5, qe = 20, Ye = 0.3, Xe = 150, Ve = 30, rt = class rt {
|
|
2604
2574
|
constructor(t, i) {
|
|
2605
2575
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = i, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2606
2576
|
}
|
|
@@ -2647,11 +2617,11 @@ const qe = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, rt = class rt {
|
|
|
2647
2617
|
const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
|
|
2648
2618
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
|
|
2649
2619
|
const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
|
|
2650
|
-
this.touchState.isHorizontalSwipe = a <=
|
|
2620
|
+
this.touchState.isHorizontalSwipe = a <= Ve;
|
|
2651
2621
|
}
|
|
2652
2622
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2653
2623
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
|
|
2654
|
-
const s = e *
|
|
2624
|
+
const s = e * Ye;
|
|
2655
2625
|
this.callbacks.onDragOffset(s);
|
|
2656
2626
|
}
|
|
2657
2627
|
}
|
|
@@ -2660,7 +2630,7 @@ const qe = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, rt = class rt {
|
|
|
2660
2630
|
this.recentTouchTimestamp = Date.now();
|
|
2661
2631
|
const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
|
|
2662
2632
|
let r = !1;
|
|
2663
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >=
|
|
2633
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= We || n >= Ge && s >= qe) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2664
2634
|
}
|
|
2665
2635
|
handleTouchCancel(t) {
|
|
2666
2636
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
@@ -2668,7 +2638,7 @@ const qe = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, rt = class rt {
|
|
|
2668
2638
|
};
|
|
2669
2639
|
rt.TOUCH_CLICK_DELAY = 300;
|
|
2670
2640
|
let bt = rt;
|
|
2671
|
-
class
|
|
2641
|
+
class Je {
|
|
2672
2642
|
constructor(t) {
|
|
2673
2643
|
if (this._prepared = !1, this._discoveredUrls = [], this.apiKey = t.apiKey ?? "", this.apiEndpoint = t.apiEndpoint ?? "https://www.googleapis.com/drive/v3/files", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
2674
2644
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2763,10 +2733,10 @@ class Ze {
|
|
|
2763
2733
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2764
2734
|
if (!a.ok)
|
|
2765
2735
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2766
|
-
const
|
|
2736
|
+
const d = (await a.json()).files.filter(
|
|
2767
2737
|
(u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
|
|
2768
2738
|
);
|
|
2769
|
-
return this.log(`Found ${
|
|
2739
|
+
return this.log(`Found ${d.length} images in folder ${t} (non-recursive)`), d.forEach((u) => {
|
|
2770
2740
|
e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2771
2741
|
}), e;
|
|
2772
2742
|
}
|
|
@@ -2833,18 +2803,18 @@ class Ze {
|
|
|
2833
2803
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2834
2804
|
if (!a.ok)
|
|
2835
2805
|
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2836
|
-
const c = await a.json(),
|
|
2837
|
-
(
|
|
2806
|
+
const c = await a.json(), d = c.files.filter(
|
|
2807
|
+
(f) => f.mimeType.startsWith("image/") && i.isAllowed(f.name)
|
|
2838
2808
|
), u = c.files.filter(
|
|
2839
|
-
(
|
|
2809
|
+
(f) => f.mimeType === "application/vnd.google-apps.folder"
|
|
2840
2810
|
);
|
|
2841
|
-
this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((
|
|
2842
|
-
e.push(`https://lh3.googleusercontent.com/d/${
|
|
2811
|
+
this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((f) => this.log(` - File: ${f.name} (${f.mimeType})`)), this.log(`- ${d.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), d.forEach((f) => {
|
|
2812
|
+
e.push(`https://lh3.googleusercontent.com/d/${f.id}=s1600`), this.log(`Added file: ${f.name}`);
|
|
2843
2813
|
});
|
|
2844
|
-
for (const
|
|
2845
|
-
this.log(`Loading images from subfolder: ${
|
|
2846
|
-
const
|
|
2847
|
-
e.push(...
|
|
2814
|
+
for (const f of u) {
|
|
2815
|
+
this.log(`Loading images from subfolder: ${f.name}`);
|
|
2816
|
+
const m = await this.loadImagesRecursively(f.id, i);
|
|
2817
|
+
e.push(...m);
|
|
2848
2818
|
}
|
|
2849
2819
|
return e;
|
|
2850
2820
|
}
|
|
@@ -2889,7 +2859,7 @@ class Ze {
|
|
|
2889
2859
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2890
2860
|
}
|
|
2891
2861
|
}
|
|
2892
|
-
class
|
|
2862
|
+
class Ke {
|
|
2893
2863
|
constructor(t) {
|
|
2894
2864
|
if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
2895
2865
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -3069,7 +3039,7 @@ class Qe {
|
|
|
3069
3039
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
3070
3040
|
}
|
|
3071
3041
|
}
|
|
3072
|
-
class
|
|
3042
|
+
class Ze {
|
|
3073
3043
|
constructor(t) {
|
|
3074
3044
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
3075
3045
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -3126,7 +3096,7 @@ class ti {
|
|
|
3126
3096
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
3127
3097
|
}
|
|
3128
3098
|
}
|
|
3129
|
-
class
|
|
3099
|
+
class Qe {
|
|
3130
3100
|
/**
|
|
3131
3101
|
* Create a new ImageFilter
|
|
3132
3102
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -3163,7 +3133,7 @@ class ei {
|
|
|
3163
3133
|
// isAllowedDate(date: Date): boolean
|
|
3164
3134
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
3165
3135
|
}
|
|
3166
|
-
const
|
|
3136
|
+
const ti = `
|
|
3167
3137
|
.fbn-ic-gallery {
|
|
3168
3138
|
position: relative;
|
|
3169
3139
|
width: 100%;
|
|
@@ -3244,37 +3214,46 @@ const ii = `
|
|
|
3244
3214
|
display: none !important;
|
|
3245
3215
|
}
|
|
3246
3216
|
`;
|
|
3247
|
-
function
|
|
3217
|
+
function ei() {
|
|
3248
3218
|
if (typeof document > "u") return;
|
|
3249
3219
|
const o = "fbn-ic-functional-styles";
|
|
3250
3220
|
if (document.getElementById(o)) return;
|
|
3251
3221
|
const t = document.createElement("style");
|
|
3252
|
-
t.id = o, t.textContent =
|
|
3222
|
+
t.id = o, t.textContent = ti, document.head.appendChild(t);
|
|
3253
3223
|
}
|
|
3254
|
-
let
|
|
3224
|
+
let ii = class {
|
|
3255
3225
|
constructor(t = {}) {
|
|
3256
|
-
this.fullConfig =
|
|
3226
|
+
this.fullConfig = ee(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.callbacks = t.on ?? {}, this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new se(this.fullConfig.animation), this.layoutEngine = new $e({
|
|
3257
3227
|
layout: this.fullConfig.layout,
|
|
3258
3228
|
image: this.fullConfig.image
|
|
3259
|
-
}), this.zoomEngine = new
|
|
3260
|
-
const i = this.fullConfig.animation.entry ||
|
|
3261
|
-
this.entryAnimationEngine = new
|
|
3229
|
+
}), this.zoomEngine = new je(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3230
|
+
const i = this.fullConfig.animation.entry || L.animation.entry;
|
|
3231
|
+
this.entryAnimationEngine = new pe(
|
|
3262
3232
|
i,
|
|
3263
3233
|
this.fullConfig.layout.algorithm
|
|
3264
3234
|
);
|
|
3265
3235
|
const e = this.fullConfig.animation.idle;
|
|
3266
|
-
e && e.type !== "none" ? this.idleAnimationEngine = new
|
|
3236
|
+
e && e.type !== "none" ? this.idleAnimationEngine = new be(
|
|
3267
3237
|
e,
|
|
3268
3238
|
i.timing?.duration ?? 600
|
|
3269
3239
|
) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
|
|
3270
3240
|
this.idleAnimationEngine?.resumeForImage(n);
|
|
3271
|
-
const s = n;
|
|
3241
|
+
const s = n, r = this.imageElements.indexOf(s);
|
|
3242
|
+
if (this.callbacks.onImageUnfocus && r !== -1) {
|
|
3243
|
+
const a = this.imageLoader.imageURLs(), c = {
|
|
3244
|
+
element: s,
|
|
3245
|
+
index: r,
|
|
3246
|
+
url: a[r] ?? "",
|
|
3247
|
+
layout: this.imageLayouts[r]
|
|
3248
|
+
};
|
|
3249
|
+
this.callbacks.onImageUnfocus(c);
|
|
3250
|
+
}
|
|
3272
3251
|
requestAnimationFrame(() => {
|
|
3273
3252
|
if (s.matches(":hover") && this.fullConfig.styling?.hover) {
|
|
3274
|
-
const
|
|
3275
|
-
if (
|
|
3276
|
-
const
|
|
3277
|
-
st(s, this.fullConfig.styling.hover,
|
|
3253
|
+
const a = this.imageElements.indexOf(s);
|
|
3254
|
+
if (a !== -1) {
|
|
3255
|
+
const c = s.offsetHeight, d = s.cachedRenderedWidth;
|
|
3256
|
+
st(s, this.fullConfig.styling.hover, c, d), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[a] };
|
|
3278
3257
|
}
|
|
3279
3258
|
}
|
|
3280
3259
|
});
|
|
@@ -3285,7 +3264,7 @@ let oi = class {
|
|
|
3285
3264
|
*/
|
|
3286
3265
|
createImageFilter() {
|
|
3287
3266
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
3288
|
-
return new
|
|
3267
|
+
return new Qe(t);
|
|
3289
3268
|
}
|
|
3290
3269
|
/**
|
|
3291
3270
|
* Create appropriate image loader based on config
|
|
@@ -3296,7 +3275,7 @@ let oi = class {
|
|
|
3296
3275
|
if (!t || t.length === 0)
|
|
3297
3276
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.\n Example: imageCloud({ container: 'id', images: ['https://...'] })");
|
|
3298
3277
|
const e = t.map((n) => this.createLoaderFromEntry(n, i));
|
|
3299
|
-
return e.length === 1 ? e[0] : new
|
|
3278
|
+
return e.length === 1 ? e[0] : new Ze({
|
|
3300
3279
|
loaders: e,
|
|
3301
3280
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
3302
3281
|
});
|
|
@@ -3314,14 +3293,14 @@ let oi = class {
|
|
|
3314
3293
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3315
3294
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3316
3295
|
};
|
|
3317
|
-
return new
|
|
3296
|
+
return new Ke(n);
|
|
3318
3297
|
} else if ("googleDrive" in t) {
|
|
3319
3298
|
const e = t.googleDrive, n = {
|
|
3320
3299
|
...e,
|
|
3321
3300
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3322
3301
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3323
3302
|
};
|
|
3324
|
-
return new
|
|
3303
|
+
return new Je(n);
|
|
3325
3304
|
} else
|
|
3326
3305
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
3327
3306
|
}
|
|
@@ -3330,7 +3309,7 @@ let oi = class {
|
|
|
3330
3309
|
*/
|
|
3331
3310
|
async init() {
|
|
3332
3311
|
try {
|
|
3333
|
-
if (
|
|
3312
|
+
if (ei(), this.containerRef)
|
|
3334
3313
|
this.containerEl = this.containerRef;
|
|
3335
3314
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
3336
3315
|
throw new Error(`Container "#${this.containerId}" not found. Ensure an element with id="${this.containerId}" exists in the DOM before calling imageCloud().`);
|
|
@@ -3339,7 +3318,7 @@ let oi = class {
|
|
|
3339
3318
|
onPrev: () => this.navigateToPreviousImage(),
|
|
3340
3319
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
3341
3320
|
onDragEnd: (t) => {
|
|
3342
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
3321
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Xe);
|
|
3343
3322
|
}
|
|
3344
3323
|
})), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3345
3324
|
} catch (t) {
|
|
@@ -3470,61 +3449,134 @@ let oi = class {
|
|
|
3470
3449
|
const e = this.getContainerBounds();
|
|
3471
3450
|
this.currentImageHeight = i;
|
|
3472
3451
|
const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
|
|
3473
|
-
this.imageLayouts = s, this.
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3452
|
+
if (this.imageLayouts = s, this.callbacks.onLayoutComplete) {
|
|
3453
|
+
const l = {
|
|
3454
|
+
layouts: [...s],
|
|
3455
|
+
// shallow copy — caller should not mutate
|
|
3456
|
+
containerBounds: { ...e },
|
|
3457
|
+
algorithm: this.fullConfig.layout.algorithm,
|
|
3458
|
+
imageCount: t.length
|
|
3459
|
+
};
|
|
3460
|
+
this.callbacks.onLayoutComplete(l);
|
|
3461
|
+
}
|
|
3462
|
+
this.displayQueue = [];
|
|
3463
|
+
let r = 0, a = 0, c = 0, d = 0, u = !1;
|
|
3464
|
+
const f = /* @__PURE__ */ new Map(), m = () => {
|
|
3465
|
+
if (u || n !== this.loadGeneration || !this.callbacks.onGalleryReady) return;
|
|
3466
|
+
u = !0;
|
|
3467
|
+
const l = {
|
|
3468
|
+
totalImages: t.length,
|
|
3469
|
+
failedImages: c,
|
|
3470
|
+
loadDuration: d > 0 ? performance.now() - d : 0
|
|
3471
|
+
};
|
|
3472
|
+
this.callbacks.onGalleryReady(l);
|
|
3473
|
+
}, p = () => {
|
|
3474
|
+
r >= t.length && this.displayQueue.length === 0 && m();
|
|
3475
|
+
}, w = (l) => {
|
|
3476
|
+
this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(async () => {
|
|
3477
|
+
l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1";
|
|
3478
|
+
const g = parseInt(l.dataset.imageId || "0"), h = this.imageLayouts[g], b = this.entryAnimationEngine.getTiming(), I = performance.now(), y = parseFloat(l.dataset.startX || "0"), x = parseFloat(l.dataset.startY || "0"), E = parseFloat(l.dataset.endX || "0"), F = parseFloat(l.dataset.endY || "0"), R = parseFloat(l.dataset.rotation || "0"), M = parseFloat(l.dataset.scale || "1"), T = parseFloat(l.dataset.startRotation || l.dataset.rotation || "0"), z = parseFloat(l.dataset.startScale || l.dataset.scale || "1"), k = parseFloat(l.dataset.imageWidth || "0"), D = parseFloat(l.dataset.imageHeight || "0");
|
|
3479
|
+
if (this.callbacks.onEntryStart && h) {
|
|
3480
|
+
const S = {
|
|
3486
3481
|
element: l,
|
|
3487
|
-
|
|
3488
|
-
|
|
3482
|
+
index: g,
|
|
3483
|
+
totalImages: this.imageLayouts.length,
|
|
3484
|
+
layout: h,
|
|
3485
|
+
from: { x: y, y: x, rotation: T, scale: z },
|
|
3486
|
+
to: { x: E, y: F, rotation: R, scale: M },
|
|
3487
|
+
startTime: I,
|
|
3488
|
+
duration: b.duration
|
|
3489
|
+
};
|
|
3490
|
+
this.callbacks.onEntryStart(S);
|
|
3491
|
+
}
|
|
3492
|
+
if (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)
|
|
3493
|
+
fe({
|
|
3494
|
+
element: l,
|
|
3495
|
+
startPosition: { x: y, y: x },
|
|
3496
|
+
endPosition: { x: E, y: F },
|
|
3489
3497
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3490
|
-
duration:
|
|
3491
|
-
imageWidth:
|
|
3492
|
-
imageHeight:
|
|
3493
|
-
rotation:
|
|
3494
|
-
scale:
|
|
3498
|
+
duration: b.duration,
|
|
3499
|
+
imageWidth: k,
|
|
3500
|
+
imageHeight: D,
|
|
3501
|
+
rotation: R,
|
|
3502
|
+
scale: M,
|
|
3495
3503
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3496
|
-
startRotation:
|
|
3504
|
+
startRotation: T,
|
|
3497
3505
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3498
|
-
startScale:
|
|
3506
|
+
startScale: z,
|
|
3507
|
+
onProgress: this.callbacks.onEntryProgress && h ? (S, _, $) => {
|
|
3508
|
+
const A = {
|
|
3509
|
+
element: l,
|
|
3510
|
+
index: g,
|
|
3511
|
+
totalImages: this.imageLayouts.length,
|
|
3512
|
+
layout: h,
|
|
3513
|
+
from: { x: y, y: x, rotation: T, scale: z },
|
|
3514
|
+
to: { x: E, y: F, rotation: R, scale: M },
|
|
3515
|
+
startTime: I,
|
|
3516
|
+
duration: b.duration,
|
|
3517
|
+
progress: S,
|
|
3518
|
+
rawProgress: S,
|
|
3519
|
+
elapsed: _,
|
|
3520
|
+
current: $
|
|
3521
|
+
};
|
|
3522
|
+
this.callbacks.onEntryProgress(A);
|
|
3523
|
+
} : void 0,
|
|
3524
|
+
onComplete: h ? () => {
|
|
3525
|
+
if (this.callbacks.onEntryComplete) {
|
|
3526
|
+
const S = {
|
|
3527
|
+
element: l,
|
|
3528
|
+
index: g,
|
|
3529
|
+
layout: h,
|
|
3530
|
+
startTime: I,
|
|
3531
|
+
endTime: performance.now(),
|
|
3532
|
+
duration: b.duration
|
|
3533
|
+
};
|
|
3534
|
+
this.callbacks.onEntryComplete(S);
|
|
3535
|
+
}
|
|
3536
|
+
} : void 0
|
|
3499
3537
|
});
|
|
3500
|
-
|
|
3501
|
-
const
|
|
3502
|
-
l.style.transform =
|
|
3538
|
+
else {
|
|
3539
|
+
const S = l.dataset.finalTransform || "";
|
|
3540
|
+
if (l.style.transform = S, this.callbacks.onEntryComplete && h) {
|
|
3541
|
+
const _ = ($) => {
|
|
3542
|
+
if ($.propertyName !== "transform") return;
|
|
3543
|
+
l.removeEventListener("transitionend", _);
|
|
3544
|
+
const A = {
|
|
3545
|
+
element: l,
|
|
3546
|
+
index: g,
|
|
3547
|
+
layout: h,
|
|
3548
|
+
startTime: I,
|
|
3549
|
+
endTime: performance.now(),
|
|
3550
|
+
duration: b.duration
|
|
3551
|
+
};
|
|
3552
|
+
this.callbacks.onEntryComplete(A);
|
|
3553
|
+
};
|
|
3554
|
+
l.addEventListener("transitionend", _);
|
|
3555
|
+
}
|
|
3503
3556
|
}
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
console.log(`Image ${h} final state:`, {
|
|
3557
|
+
if (this.fullConfig.config.debug?.enabled && g < 3) {
|
|
3558
|
+
const S = l.dataset.finalTransform || "";
|
|
3559
|
+
console.log(`Image ${g} final state:`, {
|
|
3508
3560
|
left: l.style.left,
|
|
3509
3561
|
top: l.style.top,
|
|
3510
3562
|
width: l.style.width,
|
|
3511
3563
|
height: l.style.height,
|
|
3512
3564
|
computedWidth: l.offsetWidth,
|
|
3513
3565
|
computedHeight: l.offsetHeight,
|
|
3514
|
-
transform:
|
|
3566
|
+
transform: S,
|
|
3515
3567
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3516
3568
|
});
|
|
3517
3569
|
}
|
|
3518
3570
|
if (this.idleAnimationEngine) {
|
|
3519
|
-
const
|
|
3520
|
-
this.idleAnimationEngine.register(l,
|
|
3571
|
+
const S = this.entryAnimationEngine.getTiming().duration;
|
|
3572
|
+
this.idleAnimationEngine.register(l, g, this.imageElements.length, S);
|
|
3521
3573
|
}
|
|
3522
|
-
}), r
|
|
3523
|
-
},
|
|
3574
|
+
}), r++, p());
|
|
3575
|
+
}, v = () => {
|
|
3524
3576
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3525
3577
|
for (; this.displayQueue.length > 0; ) {
|
|
3526
3578
|
const l = this.displayQueue.shift();
|
|
3527
|
-
l &&
|
|
3579
|
+
l && w(l);
|
|
3528
3580
|
}
|
|
3529
3581
|
return;
|
|
3530
3582
|
}
|
|
@@ -3535,77 +3587,144 @@ let oi = class {
|
|
|
3535
3587
|
}
|
|
3536
3588
|
if (this.displayQueue.length > 0) {
|
|
3537
3589
|
const l = this.displayQueue.shift();
|
|
3538
|
-
l &&
|
|
3590
|
+
l && w(l);
|
|
3539
3591
|
}
|
|
3540
|
-
r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3592
|
+
r >= t.length && this.displayQueue.length === 0 && (this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), m());
|
|
3541
3593
|
}, this.fullConfig.animation.queue.interval);
|
|
3542
3594
|
};
|
|
3543
3595
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3544
|
-
const l = new IntersectionObserver((
|
|
3545
|
-
|
|
3546
|
-
h.isIntersecting && (
|
|
3596
|
+
const l = new IntersectionObserver((g) => {
|
|
3597
|
+
g.forEach((h) => {
|
|
3598
|
+
h.isIntersecting && (v(), l.disconnect());
|
|
3547
3599
|
});
|
|
3548
3600
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3549
3601
|
l.observe(this.containerEl);
|
|
3550
3602
|
} else
|
|
3551
|
-
|
|
3552
|
-
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l,
|
|
3603
|
+
v();
|
|
3604
|
+
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, g) => {
|
|
3553
3605
|
const h = document.createElement("div");
|
|
3554
3606
|
h.className = "fbn-ic-debug-center", h.style.position = "absolute", h.style.width = "12px", h.style.height = "12px", h.style.borderRadius = "50%", h.style.backgroundColor = "red", h.style.border = "2px solid yellow", h.style.zIndex = "9999", h.style.pointerEvents = "none";
|
|
3555
|
-
const
|
|
3556
|
-
h.style.left = `${
|
|
3557
|
-
})), t.forEach((l,
|
|
3607
|
+
const b = l.x, I = l.y;
|
|
3608
|
+
h.style.left = `${b - 6}px`, h.style.top = `${I - 6}px`, h.title = `Image ${g}: center (${Math.round(b)}, ${Math.round(I)})`, this.containerEl.appendChild(h);
|
|
3609
|
+
})), t.forEach((l, g) => {
|
|
3558
3610
|
const h = document.createElement("img");
|
|
3559
|
-
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(
|
|
3560
|
-
const
|
|
3561
|
-
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${
|
|
3562
|
-
if (this.hoveredImage = { element: h, layout:
|
|
3563
|
-
const
|
|
3564
|
-
st(h, this.fullConfig.styling?.hover, i,
|
|
3611
|
+
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(g), h.dataset.createdFlag = "true";
|
|
3612
|
+
const b = s[g];
|
|
3613
|
+
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${b.x}px`, h.style.top = `${b.y}px`, b.zIndex && (h.style.zIndex = String(b.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
|
|
3614
|
+
if (this.hoveredImage = { element: h, layout: b }, !this.zoomEngine.isInvolved(h)) {
|
|
3615
|
+
const y = h.cachedRenderedWidth;
|
|
3616
|
+
st(h, this.fullConfig.styling?.hover, i, y), et(h, this.hoverClassName);
|
|
3617
|
+
}
|
|
3618
|
+
if (this.callbacks.onImageHover) {
|
|
3619
|
+
const y = { element: h, index: g, url: l, layout: b };
|
|
3620
|
+
this.callbacks.onImageHover(y);
|
|
3565
3621
|
}
|
|
3566
3622
|
}), h.addEventListener("mouseleave", () => {
|
|
3567
3623
|
if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
|
|
3568
|
-
const
|
|
3569
|
-
st(h, this.fullConfig.styling?.default, i,
|
|
3624
|
+
const y = h.cachedRenderedWidth;
|
|
3625
|
+
st(h, this.fullConfig.styling?.default, i, y), pt(h, this.hoverClassName), et(h, this.defaultClassName);
|
|
3626
|
+
}
|
|
3627
|
+
if (this.callbacks.onImageUnhover) {
|
|
3628
|
+
const y = { element: h, index: g, url: l, layout: b };
|
|
3629
|
+
this.callbacks.onImageUnhover(y);
|
|
3570
3630
|
}
|
|
3571
|
-
}), h.addEventListener("click", (
|
|
3572
|
-
|
|
3631
|
+
}), h.addEventListener("click", (y) => {
|
|
3632
|
+
y.stopPropagation(), this.handleImageClick(h, b);
|
|
3573
3633
|
}), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
|
|
3574
3634
|
if (n !== this.loadGeneration)
|
|
3575
3635
|
return;
|
|
3576
|
-
const
|
|
3577
|
-
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${
|
|
3578
|
-
const
|
|
3579
|
-
|
|
3580
|
-
|
|
3636
|
+
const y = h.naturalWidth / h.naturalHeight, x = i * y;
|
|
3637
|
+
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${g}] Called with imageHeight=${i}, renderedWidth=${x}`), h.style.width = `${x}px`, h.cachedRenderedWidth = x, h.aspectRatio = y, st(h, this.fullConfig.styling?.default, i, x);
|
|
3638
|
+
const E = { x: b.x, y: b.y }, F = { width: x, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
|
|
3639
|
+
E,
|
|
3640
|
+
F,
|
|
3581
3641
|
e,
|
|
3582
|
-
|
|
3642
|
+
g,
|
|
3583
3643
|
t.length
|
|
3584
|
-
),
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3644
|
+
), M = this.entryAnimationEngine.calculateStartRotation(b.rotation), T = this.entryAnimationEngine.calculateStartScale(b.scale), z = this.entryAnimationEngine.buildFinalTransform(
|
|
3645
|
+
b.rotation,
|
|
3646
|
+
b.scale,
|
|
3647
|
+
x,
|
|
3588
3648
|
i
|
|
3589
|
-
),
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3649
|
+
), k = this.entryAnimationEngine.buildStartTransform(
|
|
3650
|
+
R,
|
|
3651
|
+
E,
|
|
3652
|
+
b.rotation,
|
|
3653
|
+
b.scale,
|
|
3654
|
+
x,
|
|
3595
3655
|
i,
|
|
3596
|
-
|
|
3597
|
-
|
|
3656
|
+
M,
|
|
3657
|
+
T
|
|
3598
3658
|
);
|
|
3599
|
-
this.fullConfig.config.debug?.enabled &&
|
|
3600
|
-
finalPosition:
|
|
3601
|
-
imageSize:
|
|
3602
|
-
left:
|
|
3603
|
-
top:
|
|
3604
|
-
finalTransform:
|
|
3605
|
-
renderedWidth:
|
|
3659
|
+
if (this.fullConfig.config.debug?.enabled && g < 3 && console.log(`Image ${g}:`, {
|
|
3660
|
+
finalPosition: E,
|
|
3661
|
+
imageSize: F,
|
|
3662
|
+
left: b.x,
|
|
3663
|
+
top: b.y,
|
|
3664
|
+
finalTransform: z,
|
|
3665
|
+
renderedWidth: x,
|
|
3606
3666
|
renderedHeight: i
|
|
3607
|
-
}), h.style.transform =
|
|
3608
|
-
|
|
3667
|
+
}), h.style.transform = k, h.dataset.finalTransform = z, h.dataset.startX = String(R.x), h.dataset.startY = String(R.y), h.dataset.endX = String(E.x), h.dataset.endY = String(E.y), h.dataset.imageWidth = String(x), h.dataset.imageHeight = String(i), h.dataset.rotation = String(b.rotation), h.dataset.scale = String(b.scale), h.dataset.startRotation = String(M), h.dataset.startScale = String(T), a++, this.callbacks.onImageLoaded) {
|
|
3668
|
+
const D = {
|
|
3669
|
+
element: h,
|
|
3670
|
+
url: l,
|
|
3671
|
+
index: g,
|
|
3672
|
+
totalImages: t.length,
|
|
3673
|
+
loadTime: performance.now() - (f.get(g) ?? performance.now())
|
|
3674
|
+
};
|
|
3675
|
+
this.callbacks.onImageLoaded(D);
|
|
3676
|
+
}
|
|
3677
|
+
if (this.callbacks.onLoadProgress) {
|
|
3678
|
+
const D = {
|
|
3679
|
+
loaded: a,
|
|
3680
|
+
failed: c,
|
|
3681
|
+
total: t.length,
|
|
3682
|
+
percent: (a + c) / t.length * 100
|
|
3683
|
+
};
|
|
3684
|
+
this.callbacks.onLoadProgress(D);
|
|
3685
|
+
}
|
|
3686
|
+
this.displayQueue.push(h);
|
|
3687
|
+
};
|
|
3688
|
+
const I = () => {
|
|
3689
|
+
if (n === this.loadGeneration) {
|
|
3690
|
+
if (c++, this.callbacks.onImageError) {
|
|
3691
|
+
const y = { url: l, index: g, totalImages: t.length };
|
|
3692
|
+
this.callbacks.onImageError(y);
|
|
3693
|
+
}
|
|
3694
|
+
if (this.callbacks.onLoadProgress) {
|
|
3695
|
+
const y = {
|
|
3696
|
+
loaded: a,
|
|
3697
|
+
failed: c,
|
|
3698
|
+
total: t.length,
|
|
3699
|
+
percent: (a + c) / t.length * 100
|
|
3700
|
+
};
|
|
3701
|
+
this.callbacks.onLoadProgress(y);
|
|
3702
|
+
}
|
|
3703
|
+
r++, p();
|
|
3704
|
+
}
|
|
3705
|
+
};
|
|
3706
|
+
h.onerror = () => I(), (async () => {
|
|
3707
|
+
let y = l;
|
|
3708
|
+
if (this.callbacks.onBeforeImageLoad) {
|
|
3709
|
+
const x = { url: l, index: g, totalImages: t.length }, E = await this.callbacks.onBeforeImageLoad(x);
|
|
3710
|
+
if (E)
|
|
3711
|
+
if (E.fetch !== void 0) {
|
|
3712
|
+
const F = E.url ?? l;
|
|
3713
|
+
try {
|
|
3714
|
+
const M = await (await fetch(F, E.fetch)).blob(), T = URL.createObjectURL(M);
|
|
3715
|
+
y = T;
|
|
3716
|
+
const z = h.onload;
|
|
3717
|
+
h.onload = (k) => {
|
|
3718
|
+
URL.revokeObjectURL(T), z?.call(h, k);
|
|
3719
|
+
};
|
|
3720
|
+
} catch {
|
|
3721
|
+
I();
|
|
3722
|
+
return;
|
|
3723
|
+
}
|
|
3724
|
+
} else E.url && (y = E.url);
|
|
3725
|
+
}
|
|
3726
|
+
d === 0 && (d = performance.now()), f.set(g, performance.now()), h.src = y;
|
|
3727
|
+
})();
|
|
3609
3728
|
});
|
|
3610
3729
|
}
|
|
3611
3730
|
async handleImageClick(t, i) {
|
|
@@ -3619,7 +3738,15 @@ let oi = class {
|
|
|
3619
3738
|
else {
|
|
3620
3739
|
this.idleAnimationEngine?.pauseForImage(t);
|
|
3621
3740
|
const s = t.dataset.imageId;
|
|
3622
|
-
this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator()
|
|
3741
|
+
if (this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator(), this.callbacks.onImageFocus && this.currentFocusIndex !== null) {
|
|
3742
|
+
const r = this.imageLoader.imageURLs(), a = {
|
|
3743
|
+
element: t,
|
|
3744
|
+
index: this.currentFocusIndex,
|
|
3745
|
+
url: r[this.currentFocusIndex] ?? "",
|
|
3746
|
+
layout: i
|
|
3747
|
+
};
|
|
3748
|
+
this.callbacks.onImageFocus(a);
|
|
3749
|
+
}
|
|
3623
3750
|
}
|
|
3624
3751
|
}
|
|
3625
3752
|
/**
|
|
@@ -3662,16 +3789,16 @@ let oi = class {
|
|
|
3662
3789
|
this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.prevButtonElAutoCreated && this.prevButtonEl && (this.prevButtonEl.remove(), this.prevButtonEl = null), this.nextButtonElAutoCreated && this.nextButtonEl && (this.nextButtonEl.remove(), this.nextButtonEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
|
|
3663
3790
|
}
|
|
3664
3791
|
};
|
|
3665
|
-
const
|
|
3792
|
+
const ai = Ht(
|
|
3666
3793
|
function({ className: t, style: i, ...e }, n) {
|
|
3667
|
-
const s =
|
|
3668
|
-
return
|
|
3794
|
+
const s = St(null), r = St(null);
|
|
3795
|
+
return Nt(n, () => ({
|
|
3669
3796
|
get instance() {
|
|
3670
3797
|
return r.current;
|
|
3671
3798
|
}
|
|
3672
3799
|
})), Bt(() => {
|
|
3673
3800
|
if (!s.current) return;
|
|
3674
|
-
const a = new
|
|
3801
|
+
const a = new ii({
|
|
3675
3802
|
container: s.current,
|
|
3676
3803
|
...e
|
|
3677
3804
|
});
|
|
@@ -3680,10 +3807,10 @@ const ci = Nt(
|
|
|
3680
3807
|
}), () => {
|
|
3681
3808
|
a.destroy(), r.current = null;
|
|
3682
3809
|
};
|
|
3683
|
-
}, [JSON.stringify(e)]), /* @__PURE__ */
|
|
3810
|
+
}, [JSON.stringify(e)]), /* @__PURE__ */ kt("div", { ref: s, className: t, style: i });
|
|
3684
3811
|
}
|
|
3685
3812
|
);
|
|
3686
3813
|
export {
|
|
3687
|
-
|
|
3814
|
+
ai as ImageCloud
|
|
3688
3815
|
};
|
|
3689
3816
|
//# sourceMappingURL=react.js.map
|