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