@frybynite/image-cloud 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-cloud-auto-init.js +665 -572
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +693 -600
- 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 +12 -8
- package/dist/react.d.ts +12 -8
- package/dist/react.js +673 -580
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +12 -8
- package/dist/vue.js +665 -572
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +12 -8
- package/dist/web-component.js +639 -546
- package/dist/web-component.js.map +1 -1
- package/package.json +2 -2
package/dist/react.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as Ut } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ht, useRef as Rt, useImperativeHandle as Nt, useEffect as jt } from "react";
|
|
3
|
+
const mt = Object.freeze({
|
|
4
4
|
none: "none",
|
|
5
5
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
6
6
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
7
7
|
lg: "0 8px 32px rgba(0,0,0,0.5)",
|
|
8
8
|
glow: "0 0 30px rgba(255,255,255,0.6)"
|
|
9
|
-
}),
|
|
9
|
+
}), It = Object.freeze({
|
|
10
10
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
11
11
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
12
12
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
13
|
-
}),
|
|
13
|
+
}), Tt = Object.freeze({
|
|
14
14
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
15
15
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
16
16
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
17
17
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
18
|
-
}),
|
|
18
|
+
}), Ct = Object.freeze({
|
|
19
19
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
20
20
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
21
21
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
22
22
|
flutter: Object.freeze({ amplitude: 20, frequency: 4, decay: !0, decayRate: 0.5, phase: 0 })
|
|
23
|
-
}), bt = Object.freeze({
|
|
24
|
-
type: "linear"
|
|
25
23
|
}), yt = Object.freeze({
|
|
26
|
-
|
|
24
|
+
type: "linear"
|
|
27
25
|
}), vt = Object.freeze({
|
|
28
26
|
mode: "none"
|
|
29
|
-
}),
|
|
27
|
+
}), wt = Object.freeze({
|
|
28
|
+
mode: "none"
|
|
29
|
+
}), Ft = Object.freeze({
|
|
30
30
|
default: Object.freeze({
|
|
31
31
|
border: Object.freeze({
|
|
32
32
|
width: 0,
|
|
@@ -52,17 +52,19 @@ const ft = Object.freeze({
|
|
|
52
52
|
focused: Object.freeze({
|
|
53
53
|
shadow: "none"
|
|
54
54
|
})
|
|
55
|
-
}),
|
|
55
|
+
}), Wt = Object.freeze({
|
|
56
56
|
rows: 1,
|
|
57
57
|
amplitude: 100,
|
|
58
58
|
frequency: 2,
|
|
59
59
|
phaseShift: 0,
|
|
60
60
|
synchronization: "offset"
|
|
61
61
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
62
|
-
}),
|
|
62
|
+
}), kt = Object.freeze({
|
|
63
|
+
spacing: 0
|
|
64
|
+
}), Gt = Object.freeze({
|
|
63
65
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
64
66
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
65
|
-
}),
|
|
67
|
+
}), qt = Object.freeze({
|
|
66
68
|
mode: "adaptive",
|
|
67
69
|
// Default to adaptive sizing
|
|
68
70
|
minSize: 50,
|
|
@@ -74,40 +76,40 @@ const ft = Object.freeze({
|
|
|
74
76
|
// No variance by default
|
|
75
77
|
max: 1
|
|
76
78
|
})
|
|
77
|
-
}),
|
|
79
|
+
}), Xt = Object.freeze({
|
|
78
80
|
mode: "none",
|
|
79
81
|
range: Object.freeze({
|
|
80
82
|
min: -15,
|
|
81
83
|
max: 15
|
|
82
84
|
})
|
|
83
|
-
}),
|
|
84
|
-
sizing:
|
|
85
|
-
rotation:
|
|
86
|
-
}),
|
|
85
|
+
}), zt = Object.freeze({
|
|
86
|
+
sizing: qt,
|
|
87
|
+
rotation: Xt
|
|
88
|
+
}), Ot = Object.freeze({
|
|
87
89
|
validateUrls: !0,
|
|
88
90
|
validationTimeout: 5e3,
|
|
89
91
|
validationMethod: "head",
|
|
90
92
|
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
|
|
91
|
-
}),
|
|
93
|
+
}), Dt = Object.freeze({
|
|
92
94
|
enabled: !1,
|
|
93
95
|
centers: !1,
|
|
94
96
|
loaders: !1
|
|
95
|
-
}),
|
|
97
|
+
}), x = Object.freeze({
|
|
96
98
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
97
99
|
loaders: [],
|
|
98
100
|
// Shared loader settings and debug config
|
|
99
101
|
config: Object.freeze({
|
|
100
|
-
loaders:
|
|
101
|
-
debug:
|
|
102
|
+
loaders: Ot,
|
|
103
|
+
debug: Dt
|
|
102
104
|
}),
|
|
103
105
|
// Image sizing and rotation configuration
|
|
104
|
-
image:
|
|
106
|
+
image: zt,
|
|
105
107
|
// Pattern-based layout configuration
|
|
106
108
|
layout: Object.freeze({
|
|
107
109
|
algorithm: "radial",
|
|
108
110
|
scaleDecay: 0,
|
|
109
111
|
// No decay by default (0-1 for radial/spiral)
|
|
110
|
-
responsive:
|
|
112
|
+
responsive: Gt,
|
|
111
113
|
targetCoverage: 0.6,
|
|
112
114
|
// Target 60% of container area
|
|
113
115
|
densityFactor: 1,
|
|
@@ -163,9 +165,9 @@ const ft = Object.freeze({
|
|
|
163
165
|
}),
|
|
164
166
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
|
|
165
167
|
// smooth deceleration
|
|
166
|
-
path:
|
|
167
|
-
rotation:
|
|
168
|
-
scale:
|
|
168
|
+
path: yt,
|
|
169
|
+
rotation: vt,
|
|
170
|
+
scale: wt
|
|
169
171
|
})
|
|
170
172
|
}),
|
|
171
173
|
// Pattern-based interaction configuration
|
|
@@ -207,18 +209,10 @@ const ft = Object.freeze({
|
|
|
207
209
|
ui: Object.freeze({
|
|
208
210
|
showLoadingSpinner: !1,
|
|
209
211
|
showImageCounter: !1
|
|
210
|
-
}),
|
|
211
|
-
performance: Object.freeze({
|
|
212
|
-
lazyLoad: void 0,
|
|
213
|
-
// STUB: Not implemented yet
|
|
214
|
-
preloadCount: void 0,
|
|
215
|
-
// STUB: Not implemented yet
|
|
216
|
-
imageQuality: void 0
|
|
217
|
-
// STUB: Not implemented yet
|
|
218
212
|
})
|
|
219
213
|
}),
|
|
220
214
|
// Image styling
|
|
221
|
-
styling:
|
|
215
|
+
styling: Ft
|
|
222
216
|
});
|
|
223
217
|
function Z(o, t) {
|
|
224
218
|
if (!o) return t || {};
|
|
@@ -226,7 +220,7 @@ function Z(o, t) {
|
|
|
226
220
|
const i = { ...o };
|
|
227
221
|
return t.border !== void 0 && (i.border = { ...o.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...o.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...o.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...o.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...o.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...o.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...o.outline, ...t.outline }), t.shadow !== void 0 && (i.shadow = t.shadow), t.clipPath !== void 0 && (i.clipPath = t.clipPath), t.opacity !== void 0 && (i.opacity = t.opacity), t.cursor !== void 0 && (i.cursor = t.cursor), t.className !== void 0 && (i.className = t.className), t.objectFit !== void 0 && (i.objectFit = t.objectFit), t.aspectRatio !== void 0 && (i.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (i.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (i.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (i.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (i.borderRadiusBottomLeft = t.borderRadiusBottomLeft), i;
|
|
228
222
|
}
|
|
229
|
-
function
|
|
223
|
+
function Yt(o, t) {
|
|
230
224
|
if (!t) return { ...o };
|
|
231
225
|
const i = Z(o.default, t.default), e = Z(
|
|
232
226
|
Z(i, o.hover),
|
|
@@ -241,7 +235,7 @@ function kt(o, t) {
|
|
|
241
235
|
focused: n
|
|
242
236
|
};
|
|
243
237
|
}
|
|
244
|
-
function
|
|
238
|
+
function Bt(o, t) {
|
|
245
239
|
if (!t) return { ...o };
|
|
246
240
|
const i = { ...o };
|
|
247
241
|
if (t.sizing !== void 0 && (i.sizing = {
|
|
@@ -260,7 +254,7 @@ function Gt(o, t) {
|
|
|
260
254
|
}
|
|
261
255
|
return i;
|
|
262
256
|
}
|
|
263
|
-
function
|
|
257
|
+
function Vt(o) {
|
|
264
258
|
const t = o.layout?.rotation;
|
|
265
259
|
if (t && "enabled" in t)
|
|
266
260
|
return {
|
|
@@ -270,7 +264,7 @@ function qt(o) {
|
|
|
270
264
|
}
|
|
271
265
|
};
|
|
272
266
|
}
|
|
273
|
-
function
|
|
267
|
+
function Jt(o) {
|
|
274
268
|
const t = o.layout?.sizing?.variance;
|
|
275
269
|
if (t)
|
|
276
270
|
return {
|
|
@@ -281,8 +275,8 @@ function Bt(o) {
|
|
|
281
275
|
}
|
|
282
276
|
};
|
|
283
277
|
}
|
|
284
|
-
function
|
|
285
|
-
const t =
|
|
278
|
+
function Kt(o = {}) {
|
|
279
|
+
const t = Vt(o), i = Jt(o);
|
|
286
280
|
let e = o.image;
|
|
287
281
|
(t || i) && (e = {
|
|
288
282
|
...i || {},
|
|
@@ -300,94 +294,100 @@ function Yt(o = {}) {
|
|
|
300
294
|
});
|
|
301
295
|
const r = {
|
|
302
296
|
loaders: {
|
|
303
|
-
...
|
|
297
|
+
...Ot,
|
|
304
298
|
...o.config?.loaders ?? {}
|
|
305
299
|
}
|
|
306
300
|
}, s = {
|
|
307
301
|
loaders: n,
|
|
308
302
|
config: r,
|
|
309
|
-
image:
|
|
310
|
-
layout: { ...
|
|
311
|
-
animation: { ...
|
|
312
|
-
interaction: { ...
|
|
313
|
-
rendering: { ...
|
|
314
|
-
styling:
|
|
303
|
+
image: Bt(zt, e),
|
|
304
|
+
layout: { ...x.layout },
|
|
305
|
+
animation: { ...x.animation },
|
|
306
|
+
interaction: { ...x.interaction },
|
|
307
|
+
rendering: { ...x.rendering },
|
|
308
|
+
styling: Yt(Ft, o.styling)
|
|
315
309
|
};
|
|
316
|
-
|
|
317
|
-
...
|
|
310
|
+
if (o.layout && (s.layout = {
|
|
311
|
+
...x.layout,
|
|
318
312
|
...o.layout
|
|
319
313
|
}, o.layout.responsive && (s.layout.responsive = {
|
|
320
|
-
...
|
|
321
|
-
mobile: o.layout.responsive.mobile ? { ...
|
|
322
|
-
tablet: o.layout.responsive.tablet ? { ...
|
|
314
|
+
...x.layout.responsive,
|
|
315
|
+
mobile: o.layout.responsive.mobile ? { ...x.layout.responsive.mobile, ...o.layout.responsive.mobile } : x.layout.responsive.mobile,
|
|
316
|
+
tablet: o.layout.responsive.tablet ? { ...x.layout.responsive.tablet, ...o.layout.responsive.tablet } : x.layout.responsive.tablet
|
|
323
317
|
}), o.layout.spacing && (s.layout.spacing = {
|
|
324
|
-
...
|
|
318
|
+
...x.layout.spacing,
|
|
325
319
|
...o.layout.spacing
|
|
326
320
|
})), o.animation && (s.animation = {
|
|
327
|
-
...
|
|
321
|
+
...x.animation,
|
|
328
322
|
...o.animation
|
|
329
323
|
}, o.animation.easing && (s.animation.easing = {
|
|
330
|
-
...
|
|
324
|
+
...x.animation.easing,
|
|
331
325
|
...o.animation.easing
|
|
332
326
|
}), o.animation.queue && (s.animation.queue = {
|
|
333
|
-
...
|
|
327
|
+
...x.animation.queue,
|
|
334
328
|
...o.animation.queue
|
|
335
329
|
}), o.animation.performance && (s.animation.performance = {
|
|
336
|
-
...
|
|
330
|
+
...x.animation.performance,
|
|
337
331
|
...o.animation.performance
|
|
338
332
|
}), o.animation.entry && (s.animation.entry = {
|
|
339
|
-
...
|
|
333
|
+
...x.animation.entry,
|
|
340
334
|
...o.animation.entry,
|
|
341
335
|
start: o.animation.entry.start ? {
|
|
342
|
-
...
|
|
336
|
+
...x.animation.entry.start,
|
|
343
337
|
...o.animation.entry.start,
|
|
344
|
-
circular: o.animation.entry.start.circular ? { ...
|
|
345
|
-
} :
|
|
346
|
-
timing: o.animation.entry.timing ? { ...
|
|
347
|
-
path: o.animation.entry.path ? { ...
|
|
348
|
-
rotation: o.animation.entry.rotation ? { ...
|
|
349
|
-
scale: o.animation.entry.scale ? { ...
|
|
338
|
+
circular: o.animation.entry.start.circular ? { ...x.animation.entry.start.circular, ...o.animation.entry.start.circular } : x.animation.entry.start.circular
|
|
339
|
+
} : x.animation.entry.start,
|
|
340
|
+
timing: o.animation.entry.timing ? { ...x.animation.entry.timing, ...o.animation.entry.timing } : x.animation.entry.timing,
|
|
341
|
+
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : x.animation.entry.path,
|
|
342
|
+
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : x.animation.entry.rotation,
|
|
343
|
+
scale: o.animation.entry.scale ? { ...wt, ...o.animation.entry.scale } : x.animation.entry.scale
|
|
350
344
|
})), o.interaction && (s.interaction = {
|
|
351
|
-
...
|
|
345
|
+
...x.interaction,
|
|
352
346
|
...o.interaction
|
|
353
347
|
}, o.interaction.focus && (s.interaction.focus = {
|
|
354
|
-
...
|
|
348
|
+
...x.interaction.focus,
|
|
355
349
|
...o.interaction.focus
|
|
356
350
|
}), o.interaction.navigation && (s.interaction.navigation = {
|
|
357
|
-
...
|
|
351
|
+
...x.interaction.navigation,
|
|
358
352
|
...o.interaction.navigation
|
|
359
353
|
}), o.interaction.gestures && (s.interaction.gestures = {
|
|
360
|
-
...
|
|
354
|
+
...x.interaction.gestures,
|
|
361
355
|
...o.interaction.gestures
|
|
362
356
|
})), o.rendering && (s.rendering = {
|
|
363
|
-
...
|
|
357
|
+
...x.rendering,
|
|
364
358
|
...o.rendering
|
|
365
359
|
}, o.rendering.responsive && (s.rendering.responsive = {
|
|
366
|
-
...
|
|
360
|
+
...x.rendering.responsive,
|
|
367
361
|
...o.rendering.responsive,
|
|
368
|
-
breakpoints: o.rendering.responsive.breakpoints ? { ...
|
|
369
|
-
mobileDetection: o.rendering.responsive.mobileDetection ? o.rendering.responsive.mobileDetection :
|
|
362
|
+
breakpoints: o.rendering.responsive.breakpoints ? { ...x.rendering.responsive.breakpoints, ...o.rendering.responsive.breakpoints } : x.rendering.responsive.breakpoints,
|
|
363
|
+
mobileDetection: o.rendering.responsive.mobileDetection ? o.rendering.responsive.mobileDetection : x.rendering.responsive.mobileDetection
|
|
370
364
|
}), o.rendering.ui && (s.rendering.ui = {
|
|
371
|
-
...
|
|
365
|
+
...x.rendering.ui,
|
|
372
366
|
...o.rendering.ui
|
|
373
|
-
}), o.rendering.performance && (s.rendering.performance = {
|
|
374
|
-
...y.rendering.performance,
|
|
375
|
-
...o.rendering.performance
|
|
376
367
|
})), s.config.debug = {
|
|
377
|
-
...
|
|
368
|
+
...Dt,
|
|
378
369
|
...o.config?.debug ?? {}
|
|
379
|
-
}, s
|
|
370
|
+
}, s.layout.algorithm === "honeycomb" && s.styling) {
|
|
371
|
+
const c = { shape: "hexagon", mode: "height-relative" };
|
|
372
|
+
s.styling = {
|
|
373
|
+
...s.styling,
|
|
374
|
+
default: { ...s.styling.default, clipPath: c },
|
|
375
|
+
hover: { ...s.styling.hover, clipPath: c }
|
|
376
|
+
// focused: untouched — user config respected
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
return s;
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
return { ...o ?
|
|
381
|
+
function Zt(o, t) {
|
|
382
|
+
return { ...o ? It[o] : It.playful, ...t };
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
return { ...o ?
|
|
384
|
+
function Qt(o, t) {
|
|
385
|
+
return { ...o ? Tt[o] : Tt.gentle, ...t };
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
return { ...o ?
|
|
387
|
+
function te(o, t) {
|
|
388
|
+
return { ...o ? Ct[o] : Ct.gentle, ...t };
|
|
389
389
|
}
|
|
390
|
-
class
|
|
390
|
+
class ee {
|
|
391
391
|
constructor(t) {
|
|
392
392
|
this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
|
|
393
393
|
}
|
|
@@ -414,12 +414,12 @@ class Kt {
|
|
|
414
414
|
*/
|
|
415
415
|
animateTransformCancellable(t, i, e, n = null, a = null) {
|
|
416
416
|
this.cancelAllAnimations(t);
|
|
417
|
-
const r = n ?? this.config.duration, s = a ?? this.config.easing.default,
|
|
417
|
+
const r = n ?? this.config.duration, s = a ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
|
|
418
418
|
t.style.transition = "none";
|
|
419
|
-
const
|
|
419
|
+
const u = t.animate(
|
|
420
420
|
[
|
|
421
|
-
{ transform:
|
|
422
|
-
{ transform:
|
|
421
|
+
{ transform: c },
|
|
422
|
+
{ transform: l }
|
|
423
423
|
],
|
|
424
424
|
{
|
|
425
425
|
duration: r,
|
|
@@ -427,20 +427,20 @@ class Kt {
|
|
|
427
427
|
fill: "forwards"
|
|
428
428
|
// Keep final state after animation
|
|
429
429
|
}
|
|
430
|
-
),
|
|
430
|
+
), h = {
|
|
431
431
|
id: `anim-${++this.animationIdCounter}`,
|
|
432
432
|
element: t,
|
|
433
|
-
animation:
|
|
433
|
+
animation: u,
|
|
434
434
|
fromState: i,
|
|
435
435
|
toState: e,
|
|
436
436
|
startTime: performance.now(),
|
|
437
437
|
duration: r
|
|
438
438
|
};
|
|
439
|
-
return this.activeAnimations.set(t,
|
|
440
|
-
t.style.transform =
|
|
439
|
+
return this.activeAnimations.set(t, h), u.finished.then(() => {
|
|
440
|
+
t.style.transform = l, this.activeAnimations.delete(t);
|
|
441
441
|
}).catch(() => {
|
|
442
442
|
this.activeAnimations.delete(t);
|
|
443
|
-
}),
|
|
443
|
+
}), h;
|
|
444
444
|
}
|
|
445
445
|
/**
|
|
446
446
|
* Cancel an active animation
|
|
@@ -483,8 +483,8 @@ class Kt {
|
|
|
483
483
|
const e = getComputedStyle(t).transform;
|
|
484
484
|
if (e === "none" || !e)
|
|
485
485
|
return { x: 0, y: 0, rotation: 0, scale: 1 };
|
|
486
|
-
const n = new DOMMatrix(e), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e,
|
|
487
|
-
return { x: s, y:
|
|
486
|
+
const n = new DOMMatrix(e), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e, c = n.f;
|
|
487
|
+
return { x: s, y: c, rotation: r, scale: a };
|
|
488
488
|
}
|
|
489
489
|
/**
|
|
490
490
|
* Check if an element has an active animation
|
|
@@ -543,34 +543,34 @@ class Kt {
|
|
|
543
543
|
return new Promise((i) => setTimeout(i, t));
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function J(o, t, i) {
|
|
547
547
|
return o + (t - o) * i;
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x,
|
|
551
|
-
let
|
|
552
|
-
for (let f = 0; f <
|
|
553
|
-
if (o <=
|
|
554
|
-
|
|
549
|
+
function ie(o, t, i, e) {
|
|
550
|
+
const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l = oe(a, r);
|
|
551
|
+
let u = 0, h = 0, d = 1, g = n, b = !1;
|
|
552
|
+
for (let f = 0; f < l.length; f++)
|
|
553
|
+
if (o <= l[f].time) {
|
|
554
|
+
h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, b = l[f].isOvershoot;
|
|
555
555
|
break;
|
|
556
556
|
}
|
|
557
|
-
const
|
|
558
|
-
if (
|
|
559
|
-
|
|
560
|
-
else if (
|
|
561
|
-
|
|
557
|
+
const m = (o - h) / (d - h);
|
|
558
|
+
if (b)
|
|
559
|
+
u = 1 + g * nt(m);
|
|
560
|
+
else if (h === 0)
|
|
561
|
+
u = nt(m);
|
|
562
562
|
else {
|
|
563
|
-
const
|
|
564
|
-
(
|
|
563
|
+
const p = 1 + (l.find(
|
|
564
|
+
(y, v) => y.time > h && v > 0 && l[v - 1].isOvershoot
|
|
565
565
|
)?.overshoot || g);
|
|
566
|
-
|
|
566
|
+
u = J(p, 1, nt(m));
|
|
567
567
|
}
|
|
568
568
|
return {
|
|
569
|
-
x: t.x + s *
|
|
570
|
-
y: t.y +
|
|
569
|
+
x: t.x + s * u,
|
|
570
|
+
y: t.y + c * u
|
|
571
571
|
};
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function oe(o, t) {
|
|
574
574
|
const i = [];
|
|
575
575
|
let e = 0.6;
|
|
576
576
|
i.push({ time: e, overshoot: 0, isOvershoot: !1 });
|
|
@@ -580,57 +580,57 @@ function Qt(o, t) {
|
|
|
580
580
|
e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
|
|
581
581
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
const { stiffness: n, damping: a, mass: r, oscillations: s } = e,
|
|
585
|
-
let
|
|
586
|
-
if (
|
|
587
|
-
const g =
|
|
588
|
-
|
|
583
|
+
function ne(o, t, i, e) {
|
|
584
|
+
const { stiffness: n, damping: a, mass: r, oscillations: s } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = a / (2 * Math.sqrt(n * r));
|
|
585
|
+
let d;
|
|
586
|
+
if (h < 1) {
|
|
587
|
+
const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), m = Math.cos(g * o * s * Math.PI);
|
|
588
|
+
d = 1 - b * m;
|
|
589
589
|
} else
|
|
590
|
-
|
|
591
|
-
return
|
|
592
|
-
x: t.x +
|
|
593
|
-
y: t.y +
|
|
590
|
+
d = 1 - Math.exp(-u * o * 3);
|
|
591
|
+
return d = Math.max(0, Math.min(d, 1.3)), {
|
|
592
|
+
x: t.x + c * d,
|
|
593
|
+
y: t.y + l * d
|
|
594
594
|
};
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase:
|
|
596
|
+
function se(o, t, i, e) {
|
|
597
|
+
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, g = h > 0 ? l / h : 1, b = a * Math.PI * 2 * o + c, m = r ? Math.pow(1 - o, s) : 1, f = n * Math.sin(b) * m, p = ae(o);
|
|
598
598
|
return {
|
|
599
|
-
x:
|
|
600
|
-
y:
|
|
599
|
+
x: J(t.x, i.x, p) + f * d,
|
|
600
|
+
y: J(t.y, i.y, p) + f * g
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function nt(o) {
|
|
604
604
|
return 1 - (1 - o) * (1 - o);
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function ae(o) {
|
|
607
607
|
return 1 - Math.pow(1 - o, 3);
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1,
|
|
611
|
-
return t +
|
|
609
|
+
function re(o, t, i) {
|
|
610
|
+
const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, c = e * r * s;
|
|
611
|
+
return t + c;
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function ce(o, t, i) {
|
|
614
614
|
const { overshoot: e, bounces: n } = i, a = [];
|
|
615
615
|
a.push({ time: 0.5, scale: e });
|
|
616
616
|
let r = e;
|
|
617
|
-
const s = 0.5,
|
|
618
|
-
let
|
|
619
|
-
for (let
|
|
617
|
+
const s = 0.5, l = 0.5 / (n * 2);
|
|
618
|
+
let u = 0.5;
|
|
619
|
+
for (let d = 0; d < n; d++) {
|
|
620
620
|
const g = 1 - (r - 1) * s;
|
|
621
|
-
|
|
621
|
+
u += l, a.push({ time: u, scale: g }), r = 1 + (r - 1) * s * s, u += l, d < n - 1 && a.push({ time: u, scale: r });
|
|
622
622
|
}
|
|
623
623
|
a.push({ time: 1, scale: 1 });
|
|
624
|
-
let
|
|
625
|
-
for (let
|
|
626
|
-
if (o <= a[
|
|
627
|
-
const g =
|
|
628
|
-
|
|
624
|
+
let h = 1;
|
|
625
|
+
for (let d = 0; d < a.length; d++)
|
|
626
|
+
if (o <= a[d].time) {
|
|
627
|
+
const g = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, m = (o - g) / (a[d].time - g), f = nt(m);
|
|
628
|
+
h = b + (a[d].scale - b) * f;
|
|
629
629
|
break;
|
|
630
630
|
}
|
|
631
|
-
return
|
|
631
|
+
return h * t;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function le(o) {
|
|
634
634
|
const {
|
|
635
635
|
element: t,
|
|
636
636
|
startPosition: i,
|
|
@@ -639,81 +639,82 @@ function se(o) {
|
|
|
639
639
|
duration: a,
|
|
640
640
|
imageWidth: r,
|
|
641
641
|
imageHeight: s,
|
|
642
|
-
rotation:
|
|
643
|
-
scale:
|
|
644
|
-
onComplete:
|
|
645
|
-
rotationConfig:
|
|
646
|
-
startRotation:
|
|
642
|
+
rotation: c,
|
|
643
|
+
scale: l,
|
|
644
|
+
onComplete: u,
|
|
645
|
+
rotationConfig: h,
|
|
646
|
+
startRotation: d,
|
|
647
647
|
scaleConfig: g,
|
|
648
|
-
startScale:
|
|
649
|
-
} = o,
|
|
650
|
-
if ((
|
|
651
|
-
|
|
648
|
+
startScale: b
|
|
649
|
+
} = o, m = n.type, f = d !== void 0 && d !== c, p = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, v = f || p, w = b !== void 0 && b !== l, S = g?.mode === "pop", E = g?.pop || { overshoot: 1.2, bounces: 1 };
|
|
650
|
+
if ((m === "linear" || m === "arc") && !v && !(w || S)) {
|
|
651
|
+
u && u();
|
|
652
652
|
return;
|
|
653
653
|
}
|
|
654
|
-
const M = performance.now(), F = -r / 2,
|
|
655
|
-
function
|
|
656
|
-
const
|
|
654
|
+
const M = performance.now(), F = -r / 2, _ = -s / 2;
|
|
655
|
+
function U(X) {
|
|
656
|
+
const N = X - M, T = Math.min(N / a, 1);
|
|
657
657
|
let O;
|
|
658
|
-
switch (
|
|
658
|
+
switch (m) {
|
|
659
659
|
case "bounce": {
|
|
660
|
-
const
|
|
660
|
+
const D = Zt(
|
|
661
661
|
n.bouncePreset,
|
|
662
662
|
n.bounce
|
|
663
663
|
);
|
|
664
|
-
O =
|
|
664
|
+
O = ie(T, i, e, D);
|
|
665
665
|
break;
|
|
666
666
|
}
|
|
667
667
|
case "elastic": {
|
|
668
|
-
const
|
|
668
|
+
const D = Qt(
|
|
669
669
|
n.elasticPreset,
|
|
670
670
|
n.elastic
|
|
671
671
|
);
|
|
672
|
-
O =
|
|
672
|
+
O = ne(T, i, e, D);
|
|
673
673
|
break;
|
|
674
674
|
}
|
|
675
675
|
case "wave": {
|
|
676
|
-
const
|
|
676
|
+
const D = te(
|
|
677
677
|
n.wavePreset,
|
|
678
678
|
n.wave
|
|
679
679
|
);
|
|
680
|
-
O =
|
|
680
|
+
O = se(T, i, e, D);
|
|
681
681
|
break;
|
|
682
682
|
}
|
|
683
683
|
default:
|
|
684
684
|
O = {
|
|
685
|
-
x:
|
|
686
|
-
y:
|
|
685
|
+
x: J(i.x, e.x, T),
|
|
686
|
+
y: J(i.y, e.y, T)
|
|
687
687
|
};
|
|
688
688
|
}
|
|
689
689
|
const W = O.x - e.x, H = O.y - e.y;
|
|
690
690
|
let A;
|
|
691
|
-
|
|
691
|
+
p ? A = re(T, c, y) : f ? A = J(d, c, T) : A = c;
|
|
692
692
|
let C;
|
|
693
|
-
|
|
693
|
+
S ? C = ce(T, l, E) : w ? C = J(b, l, T) : C = l, t.style.transform = `translate(${F}px, ${_}px) translate(${W}px, ${H}px) rotate(${A}deg) scale(${C})`, T < 1 ? requestAnimationFrame(U) : (t.style.transform = `translate(${F}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
|
|
694
694
|
}
|
|
695
|
-
requestAnimationFrame(
|
|
695
|
+
requestAnimationFrame(U);
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function he(o) {
|
|
698
698
|
return o === "bounce" || o === "elastic" || o === "wave";
|
|
699
699
|
}
|
|
700
|
-
const
|
|
700
|
+
const de = {
|
|
701
701
|
radial: "center",
|
|
702
702
|
spiral: "center",
|
|
703
703
|
grid: "top",
|
|
704
704
|
cluster: "nearest-edge",
|
|
705
705
|
random: "nearest-edge",
|
|
706
|
-
wave: "left"
|
|
706
|
+
wave: "left",
|
|
707
|
+
honeycomb: "center"
|
|
707
708
|
};
|
|
708
|
-
class
|
|
709
|
+
class ue {
|
|
709
710
|
constructor(t, i) {
|
|
710
|
-
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path ||
|
|
711
|
+
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || wt;
|
|
711
712
|
}
|
|
712
713
|
/**
|
|
713
714
|
* Get the effective start position, considering layout-aware defaults
|
|
714
715
|
*/
|
|
715
716
|
resolveStartPosition() {
|
|
716
|
-
return this.config.start.position ? this.config.start.position :
|
|
717
|
+
return this.config.start.position ? this.config.start.position : de[this.layoutAlgorithm] || "nearest-edge";
|
|
717
718
|
}
|
|
718
719
|
/**
|
|
719
720
|
* Calculate the starting position for an image's entry animation
|
|
@@ -751,9 +752,9 @@ class ce {
|
|
|
751
752
|
* Calculate start position from the nearest edge (current default behavior)
|
|
752
753
|
*/
|
|
753
754
|
calculateNearestEdge(t, i, e, n) {
|
|
754
|
-
const a = t.x, r = t.y, s = a,
|
|
755
|
-
let
|
|
756
|
-
return
|
|
755
|
+
const a = t.x, r = t.y, s = a, c = e.width - a, l = r, u = e.height - r, h = Math.min(s, c, l, u);
|
|
756
|
+
let d = t.x, g = t.y;
|
|
757
|
+
return h === s ? d = -(i.width + n) : h === c ? d = e.width + n : h === l ? g = -(i.height + n) : g = e.height + n, { x: d, y: g };
|
|
757
758
|
}
|
|
758
759
|
/**
|
|
759
760
|
* Calculate start position from a specific edge
|
|
@@ -800,19 +801,19 @@ class ce {
|
|
|
800
801
|
*/
|
|
801
802
|
calculateCircularPosition(t, i, e, n, a) {
|
|
802
803
|
const r = this.config.start.circular || {}, s = r.distribution || "even";
|
|
803
|
-
let
|
|
804
|
-
const
|
|
805
|
-
if (typeof
|
|
806
|
-
const
|
|
807
|
-
|
|
804
|
+
let c;
|
|
805
|
+
const l = r.radius || "120%";
|
|
806
|
+
if (typeof l == "string" && l.endsWith("%")) {
|
|
807
|
+
const m = parseFloat(l) / 100;
|
|
808
|
+
c = Math.sqrt(
|
|
808
809
|
e.width ** 2 + e.height ** 2
|
|
809
|
-
) *
|
|
810
|
+
) * m / 2;
|
|
810
811
|
} else
|
|
811
|
-
|
|
812
|
-
let
|
|
813
|
-
s === "even" ?
|
|
814
|
-
const
|
|
815
|
-
return { x: g, y:
|
|
812
|
+
c = typeof l == "number" ? l : 500;
|
|
813
|
+
let u;
|
|
814
|
+
s === "even" ? u = n / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
815
|
+
const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
|
|
816
|
+
return { x: g, y: b };
|
|
816
817
|
}
|
|
817
818
|
/**
|
|
818
819
|
* Get animation parameters for an image
|
|
@@ -831,9 +832,9 @@ class ce {
|
|
|
831
832
|
* Build a CSS transform string for the start position
|
|
832
833
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
833
834
|
*/
|
|
834
|
-
buildStartTransform(t, i, e, n, a, r, s,
|
|
835
|
-
const
|
|
836
|
-
return t.useScale ? `${
|
|
835
|
+
buildStartTransform(t, i, e, n, a, r, s, c) {
|
|
836
|
+
const l = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = c !== void 0 ? c : n, g = a !== void 0 ? -a / 2 : 0, b = r !== void 0 ? -r / 2 : 0, m = a !== void 0 ? `translate(${g}px, ${b}px)` : "translate(-50%, -50%)";
|
|
837
|
+
return t.useScale ? `${m} translate(${l}px, ${u}px) rotate(${h}deg) scale(0)` : `${m} translate(${l}px, ${u}px) rotate(${h}deg) scale(${d})`;
|
|
837
838
|
}
|
|
838
839
|
/**
|
|
839
840
|
* Build the final CSS transform string
|
|
@@ -858,7 +859,7 @@ class ce {
|
|
|
858
859
|
* Check if the current path type requires JavaScript animation
|
|
859
860
|
*/
|
|
860
861
|
requiresJSAnimation() {
|
|
861
|
-
return
|
|
862
|
+
return he(this.pathConfig.type);
|
|
862
863
|
}
|
|
863
864
|
/**
|
|
864
865
|
* Get the path configuration
|
|
@@ -960,8 +961,8 @@ class ce {
|
|
|
960
961
|
amplitude: 15,
|
|
961
962
|
frequency: 3,
|
|
962
963
|
decay: !0
|
|
963
|
-
}, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2),
|
|
964
|
-
return i +
|
|
964
|
+
}, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, l = n * s * c;
|
|
965
|
+
return i + l;
|
|
965
966
|
}
|
|
966
967
|
/**
|
|
967
968
|
* Get the scale configuration
|
|
@@ -1019,10 +1020,10 @@ class ce {
|
|
|
1019
1020
|
bounces: 1
|
|
1020
1021
|
}, { overshoot: n, bounces: a } = e, r = this.generateScaleBounceKeyframes(a, n);
|
|
1021
1022
|
let s = i;
|
|
1022
|
-
for (let
|
|
1023
|
-
if (t <= r[
|
|
1024
|
-
const
|
|
1025
|
-
s =
|
|
1023
|
+
for (let c = 0; c < r.length; c++)
|
|
1024
|
+
if (t <= r[c].time) {
|
|
1025
|
+
const l = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, h = (t - l) / (r[c].time - l), d = this.easeOutQuad(h);
|
|
1026
|
+
s = u + (r[c].scale - u) * d;
|
|
1026
1027
|
break;
|
|
1027
1028
|
}
|
|
1028
1029
|
return s * i;
|
|
@@ -1035,10 +1036,10 @@ class ce {
|
|
|
1035
1036
|
e.push({ time: 0.5, scale: i });
|
|
1036
1037
|
let n = i;
|
|
1037
1038
|
const a = 0.5, s = 0.5 / (t * 2);
|
|
1038
|
-
let
|
|
1039
|
-
for (let
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1039
|
+
let c = 0.5;
|
|
1040
|
+
for (let l = 0; l < t; l++) {
|
|
1041
|
+
const u = 1 - (n - 1) * a;
|
|
1042
|
+
c += s, e.push({ time: c, scale: u }), n = 1 + (n - 1) * a * a, c += s, l < t - 1 && e.push({ time: c, scale: n });
|
|
1042
1043
|
}
|
|
1043
1044
|
return e.push({ time: 1, scale: 1 }), e;
|
|
1044
1045
|
}
|
|
@@ -1049,7 +1050,7 @@ class ce {
|
|
|
1049
1050
|
return 1 - (1 - t) * (1 - t);
|
|
1050
1051
|
}
|
|
1051
1052
|
}
|
|
1052
|
-
class
|
|
1053
|
+
class ge {
|
|
1053
1054
|
constructor(t, i = {}) {
|
|
1054
1055
|
this.config = t, this.imageConfig = i;
|
|
1055
1056
|
}
|
|
@@ -1061,17 +1062,17 @@ class le {
|
|
|
1061
1062
|
* @returns Array of layout objects with position, rotation, scale
|
|
1062
1063
|
*/
|
|
1063
1064
|
generate(t, i, e = {}) {
|
|
1064
|
-
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding,
|
|
1065
|
-
for (let
|
|
1066
|
-
const I = this.random(w,
|
|
1067
|
-
id:
|
|
1065
|
+
const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, f = c * 1.5 / 2, p = c / 2, y = a - s - f, v = r - s - p, w = s + f, S = s + p;
|
|
1066
|
+
for (let E = 0; E < t; E++) {
|
|
1067
|
+
const I = this.random(w, y), M = this.random(S, v), F = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, g) : 1, U = c * _, X = {
|
|
1068
|
+
id: E,
|
|
1068
1069
|
x: I,
|
|
1069
1070
|
y: M,
|
|
1070
1071
|
rotation: F,
|
|
1071
|
-
scale:
|
|
1072
|
-
baseSize:
|
|
1072
|
+
scale: _,
|
|
1073
|
+
baseSize: U
|
|
1073
1074
|
};
|
|
1074
|
-
n.push(
|
|
1075
|
+
n.push(X);
|
|
1075
1076
|
}
|
|
1076
1077
|
return n;
|
|
1077
1078
|
}
|
|
@@ -1085,7 +1086,7 @@ class le {
|
|
|
1085
1086
|
return Math.random() * (i - t) + t;
|
|
1086
1087
|
}
|
|
1087
1088
|
}
|
|
1088
|
-
class
|
|
1089
|
+
class fe {
|
|
1089
1090
|
constructor(t, i = {}) {
|
|
1090
1091
|
this.config = t, this.imageConfig = i;
|
|
1091
1092
|
}
|
|
@@ -1097,39 +1098,39 @@ class he {
|
|
|
1097
1098
|
* @returns Array of layout objects with position, rotation, scale
|
|
1098
1099
|
*/
|
|
1099
1100
|
generate(t, i, e = {}) {
|
|
1100
|
-
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200,
|
|
1101
|
+
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, m = e.fixedHeight ?? s, f = a / 2, p = r / 2, y = Math.ceil(Math.sqrt(t));
|
|
1101
1102
|
if (t > 0) {
|
|
1102
|
-
const
|
|
1103
|
+
const S = g ? this.random(h, d) : 1, E = m * S;
|
|
1103
1104
|
n.push({
|
|
1104
1105
|
id: 0,
|
|
1105
1106
|
x: f,
|
|
1106
|
-
y:
|
|
1107
|
-
rotation:
|
|
1107
|
+
y: p,
|
|
1108
|
+
rotation: c === "random" ? this.random(l * 0.33, u * 0.33) : 0,
|
|
1108
1109
|
// Less rotation for center
|
|
1109
|
-
scale:
|
|
1110
|
-
baseSize:
|
|
1110
|
+
scale: S,
|
|
1111
|
+
baseSize: E,
|
|
1111
1112
|
zIndex: 100
|
|
1112
1113
|
// Center image is highest
|
|
1113
1114
|
});
|
|
1114
1115
|
}
|
|
1115
1116
|
let v = 1, w = 1;
|
|
1116
1117
|
for (; v < t; ) {
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1118
|
+
const S = w / y, E = b > 0 ? 1 - S * b * 0.5 : 1, I = w * (m * 0.8), M = I * 1.5, F = Math.PI * (3 * (M + I) - Math.sqrt((3 * M + I) * (M + 3 * I))), _ = this.estimateWidth(m), U = Math.floor(F / (_ * 0.7));
|
|
1119
|
+
if (U === 0) {
|
|
1119
1120
|
w++;
|
|
1120
1121
|
continue;
|
|
1121
1122
|
}
|
|
1122
|
-
const
|
|
1123
|
-
for (let T = 0; T <
|
|
1124
|
-
const O = T *
|
|
1125
|
-
let C = f + Math.cos(O) * M,
|
|
1126
|
-
const
|
|
1127
|
-
C - P <
|
|
1128
|
-
const k =
|
|
1123
|
+
const X = 2 * Math.PI / U, N = w * (20 * Math.PI / 180);
|
|
1124
|
+
for (let T = 0; T < U && v < t; T++) {
|
|
1125
|
+
const O = T * X + N, W = g ? this.random(h, d) : 1, H = E * W, A = m * H;
|
|
1126
|
+
let C = f + Math.cos(O) * M, D = p + Math.sin(O) * I;
|
|
1127
|
+
const $ = this.config.spacing.padding ?? 50, P = A * 1.5 / 2, L = A / 2;
|
|
1128
|
+
C - P < $ ? C = $ + P : C + P > a - $ && (C = a - $ - P), D - L < $ ? D = $ + L : D + L > r - $ && (D = r - $ - L);
|
|
1129
|
+
const k = c === "random" ? this.random(l, u) : 0;
|
|
1129
1130
|
n.push({
|
|
1130
1131
|
id: v,
|
|
1131
1132
|
x: C,
|
|
1132
|
-
y:
|
|
1133
|
+
y: D,
|
|
1133
1134
|
rotation: k,
|
|
1134
1135
|
scale: H,
|
|
1135
1136
|
baseSize: A,
|
|
@@ -1160,7 +1161,7 @@ class he {
|
|
|
1160
1161
|
return Math.random() * (i - t) + t;
|
|
1161
1162
|
}
|
|
1162
1163
|
}
|
|
1163
|
-
const
|
|
1164
|
+
const me = {
|
|
1164
1165
|
columns: "auto",
|
|
1165
1166
|
rows: "auto",
|
|
1166
1167
|
stagger: "none",
|
|
@@ -1170,7 +1171,7 @@ const de = {
|
|
|
1170
1171
|
alignment: "center",
|
|
1171
1172
|
gap: 10,
|
|
1172
1173
|
overflowOffset: 0.25
|
|
1173
|
-
},
|
|
1174
|
+
}, At = [
|
|
1174
1175
|
{ x: 1, y: 1 },
|
|
1175
1176
|
// bottom-right
|
|
1176
1177
|
{ x: -1, y: -1 },
|
|
@@ -1188,7 +1189,7 @@ const de = {
|
|
|
1188
1189
|
{ x: 0, y: 1 }
|
|
1189
1190
|
// down
|
|
1190
1191
|
];
|
|
1191
|
-
class
|
|
1192
|
+
class pe {
|
|
1192
1193
|
constructor(t, i = {}) {
|
|
1193
1194
|
this.config = t, this.imageConfig = i;
|
|
1194
1195
|
}
|
|
@@ -1200,65 +1201,65 @@ class ue {
|
|
|
1200
1201
|
* @returns Array of layout objects with position, rotation, scale
|
|
1201
1202
|
*/
|
|
1202
1203
|
generate(t, i, e = {}) {
|
|
1203
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1204
|
+
const n = [], { width: a, height: r } = i, s = { ...me, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = a - 2 * c, m = r - 2 * c, { columns: f, rows: p } = this.calculateGridDimensions(
|
|
1204
1205
|
t,
|
|
1205
|
-
p,
|
|
1206
1206
|
b,
|
|
1207
|
-
|
|
1207
|
+
m,
|
|
1208
|
+
l,
|
|
1208
1209
|
s
|
|
1209
|
-
),
|
|
1210
|
+
), y = s.stagger === "row", v = s.stagger === "column", w = y ? f + 0.5 : f, S = v ? p + 0.5 : p, E = (b - s.gap * (f - 1)) / w, I = (m - s.gap * (p - 1)) / S, M = y ? E / 2 : 0, F = v ? I / 2 : 0, _ = 1 + s.overlap, U = Math.min(E, I) * _, X = e.fixedHeight ? Math.min(e.fixedHeight, U) : U, N = f * E + (f - 1) * s.gap + M, T = p * I + (p - 1) * s.gap + F, O = c + (b - N) / 2, W = c + (m - T) / 2, H = f * p, A = s.columns !== "auto" && s.rows !== "auto", C = A && t > H;
|
|
1210
1211
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1211
1212
|
gridConfigColumns: s.columns,
|
|
1212
1213
|
gridConfigRows: s.rows,
|
|
1213
1214
|
columns: f,
|
|
1214
|
-
rows:
|
|
1215
|
+
rows: p,
|
|
1215
1216
|
cellCount: H,
|
|
1216
1217
|
hasFixedGrid: A,
|
|
1217
1218
|
imageCount: t,
|
|
1218
1219
|
isOverflowMode: C
|
|
1219
1220
|
});
|
|
1220
|
-
const
|
|
1221
|
+
const D = C ? new Array(H).fill(0) : [], $ = Math.min(E, I) * s.overflowOffset;
|
|
1221
1222
|
for (let z = 0; z < t; z++) {
|
|
1222
1223
|
let P, L, k = 0;
|
|
1223
1224
|
if (C && z >= H) {
|
|
1224
|
-
const q = z - H,
|
|
1225
|
-
k = Math.floor(q / H) + 1,
|
|
1225
|
+
const q = z - H, j = q % H;
|
|
1226
|
+
k = Math.floor(q / H) + 1, D[j]++, s.fillDirection === "row" ? (P = j % f, L = Math.floor(j / f)) : (L = j % p, P = Math.floor(j / p));
|
|
1226
1227
|
} else
|
|
1227
|
-
s.fillDirection === "row" ? (P = z % f, L = Math.floor(z / f)) : (L = z %
|
|
1228
|
-
let G = O + P * (
|
|
1229
|
-
if (s.stagger === "row" && L % 2 === 1 ? G +=
|
|
1230
|
-
const q = (k - 1) %
|
|
1231
|
-
G +=
|
|
1228
|
+
s.fillDirection === "row" ? (P = z % f, L = Math.floor(z / f)) : (L = z % p, P = Math.floor(z / p));
|
|
1229
|
+
let G = O + P * (E + s.gap) + E / 2, Y = W + L * (I + s.gap) + I / 2;
|
|
1230
|
+
if (s.stagger === "row" && L % 2 === 1 ? G += E / 2 : s.stagger === "column" && P % 2 === 1 && (Y += I / 2), k > 0) {
|
|
1231
|
+
const q = (k - 1) % At.length, j = At[q];
|
|
1232
|
+
G += j.x * $, Y += j.y * $;
|
|
1232
1233
|
}
|
|
1233
1234
|
if (s.jitter > 0) {
|
|
1234
|
-
const q =
|
|
1235
|
-
G += this.random(-q, q), Y += this.random(-
|
|
1235
|
+
const q = E / 2 * s.jitter, j = I / 2 * s.jitter;
|
|
1236
|
+
G += this.random(-q, q), Y += this.random(-j, j);
|
|
1236
1237
|
}
|
|
1237
|
-
let
|
|
1238
|
+
let B = G, V = Y;
|
|
1238
1239
|
if (!C && s.fillDirection === "row") {
|
|
1239
1240
|
const q = t % f || f;
|
|
1240
1241
|
if (L === Math.floor((t - 1) / f) && q < f) {
|
|
1241
|
-
const
|
|
1242
|
-
let
|
|
1243
|
-
s.alignment === "center" ?
|
|
1242
|
+
const St = q * E + (q - 1) * s.gap;
|
|
1243
|
+
let gt = 0;
|
|
1244
|
+
s.alignment === "center" ? gt = (N - St) / 2 : s.alignment === "end" && (gt = N - St), B += gt;
|
|
1244
1245
|
}
|
|
1245
1246
|
}
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1248
|
-
let
|
|
1249
|
-
if (
|
|
1250
|
-
const q = this.imageConfig.rotation?.range?.min ?? -15,
|
|
1251
|
-
s.jitter > 0 ?
|
|
1247
|
+
const rt = g ? this.random(h, d) : 1, K = X * rt, it = K * 1.5 / 2, ot = K / 2, lt = c + it, ht = a - c - it, Pt = c + ot, _t = r - c - ot;
|
|
1248
|
+
B = Math.max(lt, Math.min(B, ht)), V = Math.max(Pt, Math.min(V, _t));
|
|
1249
|
+
let dt = 0;
|
|
1250
|
+
if (u === "random") {
|
|
1251
|
+
const q = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1252
|
+
s.jitter > 0 ? dt = this.random(q * s.jitter, j * s.jitter) : dt = this.random(q, j);
|
|
1252
1253
|
}
|
|
1253
|
-
let
|
|
1254
|
-
C && k > 0 ?
|
|
1254
|
+
let ut;
|
|
1255
|
+
C && k > 0 ? ut = 50 - k : ut = C ? 100 + z : z + 1, n.push({
|
|
1255
1256
|
id: z,
|
|
1256
|
-
x:
|
|
1257
|
-
y:
|
|
1258
|
-
rotation:
|
|
1259
|
-
scale:
|
|
1257
|
+
x: B,
|
|
1258
|
+
y: V,
|
|
1259
|
+
rotation: dt,
|
|
1260
|
+
scale: rt,
|
|
1260
1261
|
baseSize: K,
|
|
1261
|
-
zIndex:
|
|
1262
|
+
zIndex: ut
|
|
1262
1263
|
});
|
|
1263
1264
|
}
|
|
1264
1265
|
return n;
|
|
@@ -1275,8 +1276,8 @@ class ue {
|
|
|
1275
1276
|
else if (a.rows !== "auto")
|
|
1276
1277
|
s = a.rows, r = Math.ceil(t / s);
|
|
1277
1278
|
else {
|
|
1278
|
-
const
|
|
1279
|
-
for (r = Math.max(1, Math.round(Math.sqrt(t *
|
|
1279
|
+
const c = i / e;
|
|
1280
|
+
for (r = Math.max(1, Math.round(Math.sqrt(t * c / 1.4))), s = Math.ceil(t / r); r > 1 && (r - 1) * s >= t; )
|
|
1280
1281
|
r--;
|
|
1281
1282
|
}
|
|
1282
1283
|
return { columns: Math.max(1, r), rows: Math.max(1, s) };
|
|
@@ -1288,14 +1289,14 @@ class ue {
|
|
|
1288
1289
|
return Math.random() * (i - t) + t;
|
|
1289
1290
|
}
|
|
1290
1291
|
}
|
|
1291
|
-
const
|
|
1292
|
+
const be = Math.PI * (3 - Math.sqrt(5)), ye = {
|
|
1292
1293
|
spiralType: "golden",
|
|
1293
1294
|
direction: "counterclockwise",
|
|
1294
1295
|
tightness: 1,
|
|
1295
1296
|
scaleDecay: 0,
|
|
1296
1297
|
startAngle: 0
|
|
1297
1298
|
};
|
|
1298
|
-
class
|
|
1299
|
+
class ve {
|
|
1299
1300
|
constructor(t, i = {}) {
|
|
1300
1301
|
this.config = t, this.imageConfig = i;
|
|
1301
1302
|
}
|
|
@@ -1307,34 +1308,34 @@ class me {
|
|
|
1307
1308
|
* @returns Array of layout objects with position, rotation, scale
|
|
1308
1309
|
*/
|
|
1309
1310
|
generate(t, i, e = {}) {
|
|
1310
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1311
|
-
|
|
1312
|
-
|
|
1311
|
+
const n = [], { width: a, height: r } = i, s = { ...ye, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, m = g !== 1 || b !== 1, f = this.config.scaleDecay ?? s.scaleDecay, p = a / 2, y = r / 2, v = Math.min(
|
|
1312
|
+
p - c - l / 2,
|
|
1313
|
+
y - c - l / 2
|
|
1313
1314
|
), w = s.direction === "clockwise" ? -1 : 1;
|
|
1314
|
-
for (let
|
|
1315
|
-
let
|
|
1315
|
+
for (let S = 0; S < t; S++) {
|
|
1316
|
+
let E, I;
|
|
1316
1317
|
if (s.spiralType === "golden")
|
|
1317
|
-
|
|
1318
|
+
E = S * be * w + s.startAngle, I = this.calculateGoldenRadius(S, t, v, s.tightness);
|
|
1318
1319
|
else if (s.spiralType === "archimedean") {
|
|
1319
|
-
const G =
|
|
1320
|
-
|
|
1320
|
+
const G = S * 0.5 * s.tightness;
|
|
1321
|
+
E = G * w + s.startAngle, I = this.calculateArchimedeanRadius(G, t, v, s.tightness);
|
|
1321
1322
|
} else {
|
|
1322
|
-
const G =
|
|
1323
|
-
|
|
1323
|
+
const G = S * 0.3 * s.tightness;
|
|
1324
|
+
E = G * w + s.startAngle, I = this.calculateLogarithmicRadius(G, t, v, s.tightness);
|
|
1324
1325
|
}
|
|
1325
|
-
const M =
|
|
1326
|
+
const M = p + Math.cos(E) * I, F = y + Math.sin(E) * I, _ = I / v, U = f > 0 ? 1 - _ * f * 0.5 : 1, X = m ? this.random(g, b) : 1, N = U * X, T = l * N, W = T * 1.5 / 2, H = T / 2, A = c + W, C = a - c - W, D = c + H, $ = r - c - H, z = Math.max(A, Math.min(M, C)), P = Math.max(D, Math.min(F, $));
|
|
1326
1327
|
let L = 0;
|
|
1327
|
-
if (
|
|
1328
|
-
const G =
|
|
1328
|
+
if (u === "random") {
|
|
1329
|
+
const G = E * 180 / Math.PI % 360, Y = this.random(h, d);
|
|
1329
1330
|
L = s.spiralType === "golden" ? Y : G * 0.1 + Y * 0.9;
|
|
1330
|
-
} else
|
|
1331
|
-
const k = t -
|
|
1331
|
+
} else u === "tangent" && (L = this.calculateSpiralTangent(E, I, s));
|
|
1332
|
+
const k = t - S;
|
|
1332
1333
|
n.push({
|
|
1333
|
-
id:
|
|
1334
|
+
id: S,
|
|
1334
1335
|
x: z,
|
|
1335
1336
|
y: P,
|
|
1336
1337
|
rotation: L,
|
|
1337
|
-
scale:
|
|
1338
|
+
scale: N,
|
|
1338
1339
|
baseSize: T,
|
|
1339
1340
|
zIndex: k
|
|
1340
1341
|
});
|
|
@@ -1379,8 +1380,8 @@ class me {
|
|
|
1379
1380
|
* r = a * e^(b*θ)
|
|
1380
1381
|
*/
|
|
1381
1382
|
calculateLogarithmicRadius(t, i, e, n) {
|
|
1382
|
-
const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t),
|
|
1383
|
-
return s /
|
|
1383
|
+
const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t), c = i * 0.3 * n, l = a * Math.exp(r * c);
|
|
1384
|
+
return s / l * e;
|
|
1384
1385
|
}
|
|
1385
1386
|
/**
|
|
1386
1387
|
* Utility: Generate random number between min and max
|
|
@@ -1389,7 +1390,7 @@ class me {
|
|
|
1389
1390
|
return Math.random() * (i - t) + t;
|
|
1390
1391
|
}
|
|
1391
1392
|
}
|
|
1392
|
-
const
|
|
1393
|
+
const we = {
|
|
1393
1394
|
clusterCount: "auto",
|
|
1394
1395
|
clusterSpread: 150,
|
|
1395
1396
|
clusterSpacing: 200,
|
|
@@ -1397,7 +1398,7 @@ const pe = {
|
|
|
1397
1398
|
overlap: 0.3,
|
|
1398
1399
|
distribution: "gaussian"
|
|
1399
1400
|
};
|
|
1400
|
-
class
|
|
1401
|
+
class xe {
|
|
1401
1402
|
constructor(t, i = {}) {
|
|
1402
1403
|
this.config = t, this.imageConfig = i;
|
|
1403
1404
|
}
|
|
@@ -1409,45 +1410,45 @@ class be {
|
|
|
1409
1410
|
* @returns Array of layout objects with position, rotation, scale
|
|
1410
1411
|
*/
|
|
1411
1412
|
generate(t, i, e = {}) {
|
|
1412
|
-
const n = [], { width: a, height: r } = i, s = { ...
|
|
1413
|
+
const n = [], { width: a, height: r } = i, s = { ...we, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, m = g !== 1 || b !== 1, f = this.calculateClusterCount(
|
|
1413
1414
|
t,
|
|
1414
1415
|
s.clusterCount,
|
|
1415
1416
|
a,
|
|
1416
1417
|
r,
|
|
1417
1418
|
s.clusterSpacing
|
|
1418
|
-
),
|
|
1419
|
+
), p = this.generateClusterCenters(
|
|
1419
1420
|
f,
|
|
1420
1421
|
a,
|
|
1421
1422
|
r,
|
|
1422
|
-
|
|
1423
|
+
c,
|
|
1423
1424
|
s
|
|
1424
|
-
),
|
|
1425
|
+
), y = new Array(f).fill(0);
|
|
1425
1426
|
for (let w = 0; w < t; w++)
|
|
1426
|
-
|
|
1427
|
+
y[w % f]++;
|
|
1427
1428
|
let v = 0;
|
|
1428
1429
|
for (let w = 0; w < f; w++) {
|
|
1429
|
-
const
|
|
1430
|
-
for (let I = 0; I <
|
|
1430
|
+
const S = p[w], E = y[w];
|
|
1431
|
+
for (let I = 0; I < E; I++) {
|
|
1431
1432
|
let M, F;
|
|
1432
1433
|
if (s.distribution === "gaussian")
|
|
1433
|
-
M = this.gaussianRandom() *
|
|
1434
|
+
M = this.gaussianRandom() * S.spread, F = this.gaussianRandom() * S.spread;
|
|
1434
1435
|
else {
|
|
1435
|
-
const L = this.random(0, Math.PI * 2), k = this.random(0,
|
|
1436
|
+
const L = this.random(0, Math.PI * 2), k = this.random(0, S.spread);
|
|
1436
1437
|
M = Math.cos(L) * k, F = Math.sin(L) * k;
|
|
1437
1438
|
}
|
|
1438
|
-
const
|
|
1439
|
-
M /=
|
|
1440
|
-
const
|
|
1441
|
-
let O =
|
|
1439
|
+
const _ = 1 + s.overlap * 0.5, U = 1 + s.overlap * 0.3;
|
|
1440
|
+
M /= _, F /= _;
|
|
1441
|
+
const X = m ? this.random(g, b) : 1, N = U * X, T = l * N;
|
|
1442
|
+
let O = S.x + M, W = S.y + F;
|
|
1442
1443
|
const A = T * 1.5 / 2, C = T / 2;
|
|
1443
|
-
O = Math.max(
|
|
1444
|
-
const
|
|
1444
|
+
O = Math.max(c + A, Math.min(O, a - c - A)), W = Math.max(c + C, Math.min(W, r - c - C));
|
|
1445
|
+
const D = u === "random" ? this.random(h, d) : 0, z = Math.sqrt(M * M + F * F) / S.spread, P = Math.round((1 - z) * 50) + 1;
|
|
1445
1446
|
n.push({
|
|
1446
1447
|
id: v,
|
|
1447
1448
|
x: O,
|
|
1448
1449
|
y: W,
|
|
1449
|
-
rotation:
|
|
1450
|
-
scale:
|
|
1450
|
+
rotation: D,
|
|
1451
|
+
scale: N,
|
|
1451
1452
|
baseSize: T,
|
|
1452
1453
|
zIndex: P
|
|
1453
1454
|
}), v++;
|
|
@@ -1461,30 +1462,30 @@ class be {
|
|
|
1461
1462
|
calculateClusterCount(t, i, e, n, a) {
|
|
1462
1463
|
if (i !== "auto")
|
|
1463
1464
|
return Math.max(1, Math.min(i, t));
|
|
1464
|
-
const s = Math.max(1, Math.ceil(t / 8)),
|
|
1465
|
+
const s = Math.max(1, Math.ceil(t / 8)), c = Math.floor(
|
|
1465
1466
|
e / a * (n / a) * 0.6
|
|
1466
1467
|
);
|
|
1467
|
-
return Math.max(1, Math.min(s,
|
|
1468
|
+
return Math.max(1, Math.min(s, c, 10));
|
|
1468
1469
|
}
|
|
1469
1470
|
/**
|
|
1470
1471
|
* Generate cluster center positions with spacing constraints
|
|
1471
1472
|
*/
|
|
1472
1473
|
generateClusterCenters(t, i, e, n, a) {
|
|
1473
|
-
const r = [],
|
|
1474
|
-
for (let
|
|
1475
|
-
let g = null,
|
|
1476
|
-
for (let
|
|
1474
|
+
const r = [], c = n + a.clusterSpread, l = i - n - a.clusterSpread, u = n + a.clusterSpread, h = e - n - a.clusterSpread;
|
|
1475
|
+
for (let d = 0; d < t; d++) {
|
|
1476
|
+
let g = null, b = -1;
|
|
1477
|
+
for (let m = 0; m < 100; m++) {
|
|
1477
1478
|
const f = {
|
|
1478
|
-
x: this.random(
|
|
1479
|
-
y: this.random(
|
|
1479
|
+
x: this.random(c, l),
|
|
1480
|
+
y: this.random(u, h),
|
|
1480
1481
|
spread: this.calculateClusterSpread(a)
|
|
1481
1482
|
};
|
|
1482
|
-
let
|
|
1483
|
-
for (const
|
|
1484
|
-
const v = f.x -
|
|
1485
|
-
|
|
1483
|
+
let p = 1 / 0;
|
|
1484
|
+
for (const y of r) {
|
|
1485
|
+
const v = f.x - y.x, w = f.y - y.y, S = Math.sqrt(v * v + w * w);
|
|
1486
|
+
p = Math.min(p, S);
|
|
1486
1487
|
}
|
|
1487
|
-
if ((r.length === 0 ||
|
|
1488
|
+
if ((r.length === 0 || p > b) && (g = f, b = p), p >= a.clusterSpacing)
|
|
1488
1489
|
break;
|
|
1489
1490
|
}
|
|
1490
1491
|
g && r.push(g);
|
|
@@ -1515,7 +1516,7 @@ class be {
|
|
|
1515
1516
|
return Math.random() * (i - t) + t;
|
|
1516
1517
|
}
|
|
1517
1518
|
}
|
|
1518
|
-
class
|
|
1519
|
+
class Ee {
|
|
1519
1520
|
constructor(t, i = {}) {
|
|
1520
1521
|
this.config = t, this.imageConfig = i;
|
|
1521
1522
|
}
|
|
@@ -1527,27 +1528,27 @@ class ye {
|
|
|
1527
1528
|
* @returns Array of layout objects with position, rotation, scale
|
|
1528
1529
|
*/
|
|
1529
1530
|
generate(t, i, e = {}) {
|
|
1530
|
-
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200,
|
|
1531
|
-
...
|
|
1531
|
+
const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, m = e.fixedHeight ?? s, f = {
|
|
1532
|
+
...Wt,
|
|
1532
1533
|
...this.config.wave
|
|
1533
|
-
}, { rows:
|
|
1534
|
+
}, { rows: p, amplitude: y, frequency: v, phaseShift: w, synchronization: S } = f, E = Math.ceil(t / p), F = m * 1.5 / 2, _ = c + F, U = a - c - F, X = U - _, N = E > 1 ? X / (E - 1) : 0, T = c + y + m / 2, O = r - c - y - m / 2, W = O - T, H = p > 1 ? W / (p - 1) : 0;
|
|
1534
1535
|
let A = 0;
|
|
1535
|
-
for (let C = 0; C <
|
|
1536
|
-
const
|
|
1537
|
-
let
|
|
1538
|
-
|
|
1539
|
-
for (let z = 0; z <
|
|
1540
|
-
const P =
|
|
1541
|
-
let
|
|
1542
|
-
|
|
1543
|
-
const K =
|
|
1536
|
+
for (let C = 0; C < p && A < t; C++) {
|
|
1537
|
+
const D = p === 1 ? (T + O) / 2 : T + C * H;
|
|
1538
|
+
let $ = 0;
|
|
1539
|
+
S === "offset" ? $ = C * w : S === "alternating" && ($ = C * Math.PI);
|
|
1540
|
+
for (let z = 0; z < E && A < t; z++) {
|
|
1541
|
+
const P = E === 1 ? (_ + U) / 2 : _ + z * N, L = this.calculateWaveY(P, a, y, v, $), k = P, G = D + L, Y = b ? this.random(d, g) : 1, B = m * Y;
|
|
1542
|
+
let V = 0;
|
|
1543
|
+
l === "tangent" ? V = this.calculateRotation(P, a, y, v, $) : l === "random" && (V = this.random(u, h));
|
|
1544
|
+
const K = B * 1.5 / 2, ct = B / 2, it = c + K, ot = a - c - K, lt = c + ct, ht = r - c - ct;
|
|
1544
1545
|
n.push({
|
|
1545
1546
|
id: A,
|
|
1546
|
-
x: Math.max(
|
|
1547
|
-
y: Math.max(
|
|
1548
|
-
rotation:
|
|
1547
|
+
x: Math.max(it, Math.min(k, ot)),
|
|
1548
|
+
y: Math.max(lt, Math.min(G, ht)),
|
|
1549
|
+
rotation: V,
|
|
1549
1550
|
scale: Y,
|
|
1550
|
-
baseSize:
|
|
1551
|
+
baseSize: B,
|
|
1551
1552
|
zIndex: A + 1
|
|
1552
1553
|
}), A++;
|
|
1553
1554
|
}
|
|
@@ -1592,7 +1593,84 @@ class ye {
|
|
|
1592
1593
|
return Math.random() * (i - t) + t;
|
|
1593
1594
|
}
|
|
1594
1595
|
}
|
|
1595
|
-
|
|
1596
|
+
const xt = 100, Q = 100 / Math.sqrt(3), Et = [
|
|
1597
|
+
[Q / 2, 0],
|
|
1598
|
+
// upper-left
|
|
1599
|
+
[3 * Q / 2, 0],
|
|
1600
|
+
// upper-right
|
|
1601
|
+
[2 * Q, 50],
|
|
1602
|
+
// right ← tiling key vertex
|
|
1603
|
+
[3 * Q / 2, 100],
|
|
1604
|
+
// lower-right
|
|
1605
|
+
[Q / 2, 100],
|
|
1606
|
+
// lower-left
|
|
1607
|
+
[0, 50]
|
|
1608
|
+
// left
|
|
1609
|
+
], Se = Et[1][0] / xt, Re = Et[2][1] / xt;
|
|
1610
|
+
function Ie(o) {
|
|
1611
|
+
return {
|
|
1612
|
+
colStep: Se * o,
|
|
1613
|
+
rowOffset: Re * o
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
function Te(o, t, i, e, n, a) {
|
|
1617
|
+
const { colStep: r } = Ie(a);
|
|
1618
|
+
return {
|
|
1619
|
+
px: e + r * o,
|
|
1620
|
+
py: n + a * (t + o / 2)
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
const Ce = [
|
|
1624
|
+
[1, 0, -1],
|
|
1625
|
+
[0, 1, -1],
|
|
1626
|
+
[-1, 1, 0],
|
|
1627
|
+
[-1, 0, 1],
|
|
1628
|
+
[0, -1, 1],
|
|
1629
|
+
[1, -1, 0]
|
|
1630
|
+
];
|
|
1631
|
+
function Ae(o) {
|
|
1632
|
+
if (o === 0) return [[0, 0, 0]];
|
|
1633
|
+
const t = [];
|
|
1634
|
+
let [i, e, n] = [0, -o, o];
|
|
1635
|
+
for (const [a, r, s] of Ce)
|
|
1636
|
+
for (let c = 0; c < o; c++)
|
|
1637
|
+
t.push([i, e, n]), i += a, e += r, n += s;
|
|
1638
|
+
return t;
|
|
1639
|
+
}
|
|
1640
|
+
class Le {
|
|
1641
|
+
// imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
|
|
1642
|
+
// would break hex tiling). Kept as parameter for interface compatibility.
|
|
1643
|
+
constructor(t, i = {}) {
|
|
1644
|
+
this.config = t;
|
|
1645
|
+
}
|
|
1646
|
+
generate(t, i, e = {}) {
|
|
1647
|
+
const n = [], { width: a, height: r } = i, s = a / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
|
|
1648
|
+
...kt,
|
|
1649
|
+
...this.config.honeycomb
|
|
1650
|
+
}.spacing ?? 0, d = l + h;
|
|
1651
|
+
let g = 0, b = 0;
|
|
1652
|
+
for (; g < t; ) {
|
|
1653
|
+
const m = Ae(b);
|
|
1654
|
+
for (const [f, p, y] of m) {
|
|
1655
|
+
if (g >= t) break;
|
|
1656
|
+
const { px: v, py: w } = Te(f, p, y, s, c, d);
|
|
1657
|
+
n.push({
|
|
1658
|
+
id: g,
|
|
1659
|
+
x: v,
|
|
1660
|
+
y: w,
|
|
1661
|
+
rotation: 0,
|
|
1662
|
+
scale: 1,
|
|
1663
|
+
baseSize: l,
|
|
1664
|
+
// Inner rings render above outer rings
|
|
1665
|
+
zIndex: Math.max(1, 100 - b)
|
|
1666
|
+
}), g++;
|
|
1667
|
+
}
|
|
1668
|
+
b++;
|
|
1669
|
+
}
|
|
1670
|
+
return n;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
class Me {
|
|
1596
1674
|
constructor(t) {
|
|
1597
1675
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1598
1676
|
}
|
|
@@ -1603,17 +1681,19 @@ class ve {
|
|
|
1603
1681
|
initLayout() {
|
|
1604
1682
|
switch (this.config.algorithm) {
|
|
1605
1683
|
case "radial":
|
|
1606
|
-
return new
|
|
1684
|
+
return new fe(this.config, this.imageConfig);
|
|
1607
1685
|
case "grid":
|
|
1608
|
-
return new
|
|
1686
|
+
return new pe(this.config, this.imageConfig);
|
|
1609
1687
|
case "spiral":
|
|
1610
|
-
return new
|
|
1688
|
+
return new ve(this.config, this.imageConfig);
|
|
1611
1689
|
case "cluster":
|
|
1612
|
-
return new
|
|
1690
|
+
return new xe(this.config, this.imageConfig);
|
|
1613
1691
|
case "wave":
|
|
1614
|
-
return new
|
|
1692
|
+
return new Ee(this.config, this.imageConfig);
|
|
1693
|
+
case "honeycomb":
|
|
1694
|
+
return new Le(this.config, this.imageConfig);
|
|
1615
1695
|
default:
|
|
1616
|
-
return new
|
|
1696
|
+
return new ge(this.config, this.imageConfig);
|
|
1617
1697
|
}
|
|
1618
1698
|
}
|
|
1619
1699
|
/**
|
|
@@ -1695,15 +1775,28 @@ class ve {
|
|
|
1695
1775
|
const a = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
|
|
1696
1776
|
if (r !== void 0)
|
|
1697
1777
|
return { height: r };
|
|
1698
|
-
const s = a?.minSize ?? 50,
|
|
1699
|
-
let
|
|
1700
|
-
|
|
1701
|
-
let
|
|
1702
|
-
if (
|
|
1778
|
+
const s = a?.minSize ?? 50, c = a?.maxSize ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, m = h * d * l / i;
|
|
1779
|
+
let p = Math.sqrt(m / 1.4);
|
|
1780
|
+
p *= u, p = Math.min(p, e);
|
|
1781
|
+
let y = this.clamp(p, s, c);
|
|
1782
|
+
if (y === s && p < s) {
|
|
1703
1783
|
const v = Math.max(s * 0.05, 20);
|
|
1704
|
-
|
|
1784
|
+
y = Math.max(v, p);
|
|
1705
1785
|
}
|
|
1706
|
-
return { height:
|
|
1786
|
+
return this.config.algorithm === "honeycomb" && (y = Math.min(y, this.honeycombMaxImageHeight(i, t))), { height: y };
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Returns the largest image height at which all honeycomb rings fit within the container.
|
|
1790
|
+
* Spacing is 0 for this calculation (user spacing is additive on top of the image height;
|
|
1791
|
+
* any non-zero spacing only makes the constraint tighter).
|
|
1792
|
+
*/
|
|
1793
|
+
honeycombMaxImageHeight(t, i) {
|
|
1794
|
+
if (t <= 1) return 1 / 0;
|
|
1795
|
+
let e = 0, n = 1;
|
|
1796
|
+
for (; n < t; )
|
|
1797
|
+
e++, n += 6 * e;
|
|
1798
|
+
const a = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, s = i.width / 2, c = i.height / 2, l = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (c - a - r * e) / (e + 0.5), d = (s - a - l * r * e) / (l * e + u);
|
|
1799
|
+
return Math.max(10, Math.min(h, d));
|
|
1707
1800
|
}
|
|
1708
1801
|
/**
|
|
1709
1802
|
* Utility: Clamp a value between min and max
|
|
@@ -1713,7 +1806,7 @@ class ve {
|
|
|
1713
1806
|
}
|
|
1714
1807
|
}
|
|
1715
1808
|
var R = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(R || {});
|
|
1716
|
-
const
|
|
1809
|
+
const Lt = {
|
|
1717
1810
|
// Geometric shapes - uses percentages for responsive sizing
|
|
1718
1811
|
circle: "circle(50%)",
|
|
1719
1812
|
square: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)",
|
|
@@ -1722,7 +1815,7 @@ const Tt = {
|
|
|
1722
1815
|
hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
|
1723
1816
|
octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
|
|
1724
1817
|
diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
|
|
1725
|
-
},
|
|
1818
|
+
}, Fe = {
|
|
1726
1819
|
// Circle - uses radius in pixels (refHeight of 100px = 50px radius)
|
|
1727
1820
|
circle: {
|
|
1728
1821
|
refHeight: 100,
|
|
@@ -1744,10 +1837,10 @@ const Tt = {
|
|
|
1744
1837
|
refHeight: 100,
|
|
1745
1838
|
points: [[50, 0], [100, 38], [82, 100], [18, 100], [0, 38]]
|
|
1746
1839
|
},
|
|
1747
|
-
// Hexagon - regular hexagon
|
|
1840
|
+
// Hexagon - regular hexagon (reference points imported from hexagonGeometry)
|
|
1748
1841
|
hexagon: {
|
|
1749
|
-
refHeight:
|
|
1750
|
-
points:
|
|
1842
|
+
refHeight: xt,
|
|
1843
|
+
points: Et
|
|
1751
1844
|
},
|
|
1752
1845
|
// Octagon - regular octagon
|
|
1753
1846
|
octagon: {
|
|
@@ -1760,29 +1853,29 @@ const Tt = {
|
|
|
1760
1853
|
points: [[50, 0], [100, 50], [50, 100], [0, 50]]
|
|
1761
1854
|
}
|
|
1762
1855
|
};
|
|
1763
|
-
function
|
|
1856
|
+
function ze(o) {
|
|
1764
1857
|
if (o)
|
|
1765
|
-
return o in
|
|
1858
|
+
return o in Lt ? Lt[o] : o;
|
|
1766
1859
|
}
|
|
1767
|
-
function
|
|
1768
|
-
const e =
|
|
1860
|
+
function Oe(o, t, i) {
|
|
1861
|
+
const e = Fe[o];
|
|
1769
1862
|
if (!e) return "";
|
|
1770
1863
|
const n = t / e.refHeight;
|
|
1771
1864
|
if (o === "circle")
|
|
1772
1865
|
return `circle(${Math.round(50 * n * 100) / 100}px)`;
|
|
1773
|
-
const a = e.
|
|
1774
|
-
return `polygon(${e.points.map(([
|
|
1775
|
-
const
|
|
1776
|
-
return `${
|
|
1866
|
+
const a = e.points.map(([m]) => m), r = e.points.map(([, m]) => m), s = (Math.min(...a) + Math.max(...a)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, l = (Math.max(...a) - Math.min(...a)) * n, u = (i ?? l) / 2, h = t / 2, d = u - s, g = h - c;
|
|
1867
|
+
return `polygon(${e.points.map(([m, f]) => {
|
|
1868
|
+
const p = Math.round((m * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
|
|
1869
|
+
return `${p}px ${y}px`;
|
|
1777
1870
|
}).join(", ")})`;
|
|
1778
1871
|
}
|
|
1779
|
-
function
|
|
1780
|
-
return o in
|
|
1872
|
+
function De(o) {
|
|
1873
|
+
return o in mt;
|
|
1781
1874
|
}
|
|
1782
|
-
function
|
|
1783
|
-
return o ?
|
|
1875
|
+
function $e(o) {
|
|
1876
|
+
return o ? De(o) ? mt[o] : o : mt.md;
|
|
1784
1877
|
}
|
|
1785
|
-
function
|
|
1878
|
+
function Pe(o) {
|
|
1786
1879
|
if (!o) return "";
|
|
1787
1880
|
const t = [];
|
|
1788
1881
|
if (o.grayscale !== void 0 && t.push(`grayscale(${o.grayscale})`), o.blur !== void 0 && t.push(`blur(${o.blur}px)`), o.brightness !== void 0 && t.push(`brightness(${o.brightness})`), o.contrast !== void 0 && t.push(`contrast(${o.contrast})`), o.saturate !== void 0 && t.push(`saturate(${o.saturate})`), o.opacity !== void 0 && t.push(`opacity(${o.opacity})`), o.sepia !== void 0 && t.push(`sepia(${o.sepia})`), o.hueRotate !== void 0 && t.push(`hue-rotate(${o.hueRotate}deg)`), o.invert !== void 0 && t.push(`invert(${o.invert})`), o.dropShadow !== void 0)
|
|
@@ -1794,13 +1887,13 @@ function Ie(o) {
|
|
|
1794
1887
|
}
|
|
1795
1888
|
return t.join(" ");
|
|
1796
1889
|
}
|
|
1797
|
-
function
|
|
1890
|
+
function tt(o) {
|
|
1798
1891
|
if (!o || o.style === "none" || o.width === 0)
|
|
1799
1892
|
return "none";
|
|
1800
1893
|
const t = o.width ?? 0, i = o.style ?? "solid", e = o.color ?? "#000000";
|
|
1801
1894
|
return `${t}px ${i} ${e}`;
|
|
1802
1895
|
}
|
|
1803
|
-
function
|
|
1896
|
+
function et(o, t, i) {
|
|
1804
1897
|
if (!o) return {};
|
|
1805
1898
|
const e = {};
|
|
1806
1899
|
if (o.borderRadiusTopLeft !== void 0 || o.borderRadiusTopRight !== void 0 || o.borderRadiusBottomRight !== void 0 || o.borderRadiusBottomLeft !== void 0) {
|
|
@@ -1808,55 +1901,55 @@ function tt(o, t, i) {
|
|
|
1808
1901
|
o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : s && (e.borderTopLeftRadius = `${s}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : s && (e.borderTopRightRadius = `${s}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : s && (e.borderBottomRightRadius = `${s}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : s && (e.borderBottomLeftRadius = `${s}px`);
|
|
1809
1902
|
} else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
|
|
1810
1903
|
if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
|
|
1811
|
-
const s = o.border || {},
|
|
1812
|
-
e.borderTop =
|
|
1813
|
-
} else o.border && (e.border =
|
|
1814
|
-
o.shadow !== void 0 && (e.boxShadow =
|
|
1815
|
-
const r =
|
|
1904
|
+
const s = o.border || {}, c = { ...s, ...o.borderTop }, l = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, h = { ...s, ...o.borderLeft };
|
|
1905
|
+
e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
|
|
1906
|
+
} else o.border && (e.border = tt(o.border));
|
|
1907
|
+
o.shadow !== void 0 && (e.boxShadow = $e(o.shadow));
|
|
1908
|
+
const r = Pe(o.filter);
|
|
1816
1909
|
if (e.filter = r || "none", o.opacity !== void 0 && (e.opacity = String(o.opacity)), o.cursor !== void 0 && (e.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
|
|
1817
|
-
const s = o.outline.width ?? 0,
|
|
1818
|
-
e.outline = `${s}px ${
|
|
1910
|
+
const s = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
|
|
1911
|
+
e.outline = `${s}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
1819
1912
|
}
|
|
1820
1913
|
if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
|
|
1821
1914
|
let s;
|
|
1822
|
-
const
|
|
1823
|
-
if (
|
|
1824
|
-
s =
|
|
1915
|
+
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
|
|
1916
|
+
if (l?.mode === "height-relative" && t)
|
|
1917
|
+
s = Oe(l.shape, t, i);
|
|
1825
1918
|
else {
|
|
1826
|
-
const
|
|
1827
|
-
s =
|
|
1919
|
+
const u = c && l ? l.shape : o.clipPath;
|
|
1920
|
+
s = ze(u);
|
|
1828
1921
|
}
|
|
1829
1922
|
s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
|
|
1830
1923
|
}
|
|
1831
1924
|
return e;
|
|
1832
1925
|
}
|
|
1833
|
-
function
|
|
1926
|
+
function _e(o, t) {
|
|
1834
1927
|
t.borderRadius !== void 0 && (o.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (o.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (o.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (o.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (o.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (o.style.border = t.border), t.borderTop !== void 0 && (o.style.borderTop = t.borderTop), t.borderRight !== void 0 && (o.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (o.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (o.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (o.style.boxShadow = t.boxShadow), t.filter !== void 0 && (o.style.filter = t.filter), t.opacity !== void 0 && (o.style.opacity = t.opacity), t.cursor !== void 0 && (o.style.cursor = t.cursor), t.outline !== void 0 && (o.style.outline = t.outline), t.outlineOffset !== void 0 && (o.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (o.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (o.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (o.style.clipPath = t.clipPath), t.overflow !== void 0 && (o.style.overflow = t.overflow);
|
|
1835
1928
|
}
|
|
1836
|
-
function
|
|
1837
|
-
const n =
|
|
1838
|
-
|
|
1929
|
+
function ft(o, t, i, e) {
|
|
1930
|
+
const n = et(t, i, e);
|
|
1931
|
+
_e(o, n);
|
|
1839
1932
|
}
|
|
1840
|
-
function
|
|
1933
|
+
function $t(o) {
|
|
1841
1934
|
return o ? Array.isArray(o) ? o.join(" ") : o : "";
|
|
1842
1935
|
}
|
|
1843
|
-
function
|
|
1844
|
-
const i =
|
|
1936
|
+
function st(o, t) {
|
|
1937
|
+
const i = $t(t);
|
|
1845
1938
|
i && i.split(" ").forEach((e) => {
|
|
1846
1939
|
e.trim() && o.classList.add(e.trim());
|
|
1847
1940
|
});
|
|
1848
1941
|
}
|
|
1849
|
-
function
|
|
1850
|
-
const i =
|
|
1942
|
+
function pt(o, t) {
|
|
1943
|
+
const i = $t(t);
|
|
1851
1944
|
i && i.split(" ").forEach((e) => {
|
|
1852
1945
|
e.trim() && o.classList.remove(e.trim());
|
|
1853
1946
|
});
|
|
1854
1947
|
}
|
|
1855
|
-
const
|
|
1948
|
+
const Mt = {
|
|
1856
1949
|
UNFOCUSING: 999,
|
|
1857
1950
|
FOCUSING: 1e3
|
|
1858
1951
|
};
|
|
1859
|
-
class
|
|
1952
|
+
class Ue {
|
|
1860
1953
|
constructor(t, i, e) {
|
|
1861
1954
|
this.state = R.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
|
|
1862
1955
|
}
|
|
@@ -1884,9 +1977,9 @@ class Ce {
|
|
|
1884
1977
|
*/
|
|
1885
1978
|
calculateFocusDimensions(t, i, e) {
|
|
1886
1979
|
const n = this.normalizeScalePercent(this.config.scalePercent), a = e.height * n, r = t / i;
|
|
1887
|
-
let s = a,
|
|
1888
|
-
const
|
|
1889
|
-
return
|
|
1980
|
+
let s = a, c = s * r;
|
|
1981
|
+
const l = e.width * n;
|
|
1982
|
+
return c > l && (c = l, s = c / r), { width: c, height: s };
|
|
1890
1983
|
}
|
|
1891
1984
|
/**
|
|
1892
1985
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
@@ -1917,23 +2010,23 @@ class Ce {
|
|
|
1917
2010
|
* Create a Web Animation that animates both transform (position) and dimensions
|
|
1918
2011
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
1919
2012
|
*/
|
|
1920
|
-
animateWithDimensions(t, i, e, n, a, r, s,
|
|
1921
|
-
const
|
|
2013
|
+
animateWithDimensions(t, i, e, n, a, r, s, c) {
|
|
2014
|
+
const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
|
|
1922
2015
|
return t.style.transition = "none", t.animate(
|
|
1923
2016
|
[
|
|
1924
2017
|
{
|
|
1925
|
-
transform:
|
|
2018
|
+
transform: l,
|
|
1926
2019
|
width: `${n}px`,
|
|
1927
2020
|
height: `${a}px`
|
|
1928
2021
|
},
|
|
1929
2022
|
{
|
|
1930
|
-
transform:
|
|
2023
|
+
transform: u,
|
|
1931
2024
|
width: `${r}px`,
|
|
1932
2025
|
height: `${s}px`
|
|
1933
2026
|
}
|
|
1934
2027
|
],
|
|
1935
2028
|
{
|
|
1936
|
-
duration:
|
|
2029
|
+
duration: c,
|
|
1937
2030
|
easing: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1938
2031
|
fill: "forwards"
|
|
1939
2032
|
}
|
|
@@ -1944,8 +2037,8 @@ class Ce {
|
|
|
1944
2037
|
* Applies all focused styling properties, classes, and z-index
|
|
1945
2038
|
*/
|
|
1946
2039
|
applyFocusedStyling(t, i) {
|
|
1947
|
-
if (t.style.zIndex = String(i), t.classList.add("fbn-ic-focused"),
|
|
1948
|
-
const e =
|
|
2040
|
+
if (t.style.zIndex = String(i), t.classList.add("fbn-ic-focused"), st(t, this.focusedClassName), this.styling?.focused) {
|
|
2041
|
+
const e = et(this.styling.focused, t.offsetHeight, t.offsetWidth);
|
|
1949
2042
|
e.borderRadius !== void 0 && (t.style.borderRadius = e.borderRadius), e.borderTopLeftRadius !== void 0 && (t.style.borderTopLeftRadius = e.borderTopLeftRadius), e.borderTopRightRadius !== void 0 && (t.style.borderTopRightRadius = e.borderTopRightRadius), e.borderBottomRightRadius !== void 0 && (t.style.borderBottomRightRadius = e.borderBottomRightRadius), e.borderBottomLeftRadius !== void 0 && (t.style.borderBottomLeftRadius = e.borderBottomLeftRadius), e.border !== void 0 && (t.style.border = e.border), e.borderTop !== void 0 && (t.style.borderTop = e.borderTop), e.borderRight !== void 0 && (t.style.borderRight = e.borderRight), e.borderBottom !== void 0 && (t.style.borderBottom = e.borderBottom), e.borderLeft !== void 0 && (t.style.borderLeft = e.borderLeft), e.boxShadow !== void 0 && (t.style.boxShadow = e.boxShadow), e.filter !== void 0 && (t.style.filter = e.filter), e.opacity !== void 0 && (t.style.opacity = e.opacity), e.cursor !== void 0 && (t.style.cursor = e.cursor), e.outline !== void 0 && (t.style.outline = e.outline), e.outlineOffset !== void 0 && (t.style.outlineOffset = e.outlineOffset), e.objectFit !== void 0 && (t.style.objectFit = e.objectFit), e.aspectRatio !== void 0 && (t.style.aspectRatio = e.aspectRatio);
|
|
1950
2043
|
}
|
|
1951
2044
|
}
|
|
@@ -1954,8 +2047,8 @@ class Ce {
|
|
|
1954
2047
|
* Restores default styling properties, removes classes, and resets z-index
|
|
1955
2048
|
*/
|
|
1956
2049
|
removeFocusedStyling(t, i) {
|
|
1957
|
-
if (t.style.zIndex = i, t.classList.remove("fbn-ic-focused"),
|
|
1958
|
-
const e =
|
|
2050
|
+
if (t.style.zIndex = i, t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName), this.styling?.default) {
|
|
2051
|
+
const e = et(this.styling.default, t.offsetHeight, t.offsetWidth);
|
|
1959
2052
|
e.borderRadius !== void 0 && (t.style.borderRadius = e.borderRadius), e.borderTopLeftRadius !== void 0 && (t.style.borderTopLeftRadius = e.borderTopLeftRadius), e.borderTopRightRadius !== void 0 && (t.style.borderTopRightRadius = e.borderTopRightRadius), e.borderBottomRightRadius !== void 0 && (t.style.borderBottomRightRadius = e.borderBottomRightRadius), e.borderBottomLeftRadius !== void 0 && (t.style.borderBottomLeftRadius = e.borderBottomLeftRadius), e.border !== void 0 && (t.style.border = e.border), e.borderTop !== void 0 && (t.style.borderTop = e.borderTop), e.borderRight !== void 0 && (t.style.borderRight = e.borderRight), e.borderBottom !== void 0 && (t.style.borderBottom = e.borderBottom), e.borderLeft !== void 0 && (t.style.borderLeft = e.borderLeft), e.boxShadow !== void 0 && (t.style.boxShadow = e.boxShadow), e.filter !== void 0 && (t.style.filter = e.filter), e.opacity !== void 0 && (t.style.opacity = e.opacity), e.cursor !== void 0 && (t.style.cursor = e.cursor), e.outline !== void 0 && (t.style.outline = e.outline), e.outlineOffset !== void 0 && (t.style.outlineOffset = e.outlineOffset), e.objectFit !== void 0 && (t.style.objectFit = e.objectFit), e.aspectRatio !== void 0 && (t.style.aspectRatio = e.aspectRatio);
|
|
1960
2053
|
}
|
|
1961
2054
|
}
|
|
@@ -1967,8 +2060,8 @@ class Ce {
|
|
|
1967
2060
|
let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
|
|
1968
2061
|
e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
|
|
1969
2062
|
const a = () => {
|
|
1970
|
-
const r = t.offsetHeight, s = t.offsetWidth,
|
|
1971
|
-
|
|
2063
|
+
const r = t.offsetHeight, s = t.offsetWidth, c = et(n, r, s);
|
|
2064
|
+
c.clipPath !== void 0 ? t.style.clipPath = c.clipPath : t.style.clipPath = "unset", c.overflow !== void 0 && (t.style.overflow = c.overflow), i.animation.playState === "running" && requestAnimationFrame(a);
|
|
1972
2065
|
};
|
|
1973
2066
|
requestAnimationFrame(a);
|
|
1974
2067
|
}
|
|
@@ -1979,50 +2072,50 @@ class Ce {
|
|
|
1979
2072
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1980
2073
|
*/
|
|
1981
2074
|
startFocusAnimation(t, i, e, n, a) {
|
|
1982
|
-
const r = t.style.zIndex || "", s = t.offsetWidth,
|
|
2075
|
+
const r = t.style.zIndex || "", s = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(s, c, i), u = this.calculateFocusTransform(i, e);
|
|
1983
2076
|
this.animationEngine.cancelAllAnimations(t);
|
|
1984
|
-
const
|
|
1985
|
-
this.applyFocusedStyling(t,
|
|
1986
|
-
const
|
|
2077
|
+
const h = this.config.animationDuration ?? 600;
|
|
2078
|
+
this.applyFocusedStyling(t, Mt.FOCUSING);
|
|
2079
|
+
const d = n ?? {
|
|
1987
2080
|
x: 0,
|
|
1988
2081
|
y: 0,
|
|
1989
2082
|
rotation: e.rotation,
|
|
1990
2083
|
scale: 1
|
|
1991
2084
|
// No scale - using dimensions
|
|
1992
|
-
}, g = a?.width ?? s,
|
|
2085
|
+
}, g = a?.width ?? s, b = a?.height ?? c, m = this.animateWithDimensions(
|
|
1993
2086
|
t,
|
|
1994
|
-
u,
|
|
1995
2087
|
d,
|
|
2088
|
+
u,
|
|
1996
2089
|
g,
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2090
|
+
b,
|
|
2091
|
+
l.width,
|
|
2092
|
+
l.height,
|
|
2093
|
+
h
|
|
2001
2094
|
), f = {
|
|
2002
2095
|
id: `focus-${Date.now()}`,
|
|
2003
2096
|
element: t,
|
|
2004
|
-
animation:
|
|
2005
|
-
fromState:
|
|
2006
|
-
toState:
|
|
2097
|
+
animation: m,
|
|
2098
|
+
fromState: d,
|
|
2099
|
+
toState: u,
|
|
2007
2100
|
startTime: performance.now(),
|
|
2008
|
-
duration:
|
|
2101
|
+
duration: h
|
|
2009
2102
|
};
|
|
2010
2103
|
return this.focusData = {
|
|
2011
2104
|
element: t,
|
|
2012
2105
|
originalState: e,
|
|
2013
|
-
focusTransform:
|
|
2106
|
+
focusTransform: u,
|
|
2014
2107
|
originalZIndex: r,
|
|
2015
2108
|
originalWidth: s,
|
|
2016
|
-
originalHeight:
|
|
2017
|
-
focusWidth:
|
|
2018
|
-
focusHeight:
|
|
2109
|
+
originalHeight: c,
|
|
2110
|
+
focusWidth: l.width,
|
|
2111
|
+
focusHeight: l.height
|
|
2019
2112
|
}, this.startClipPathAnimation(t, f, !0), {
|
|
2020
2113
|
element: t,
|
|
2021
2114
|
originalState: e,
|
|
2022
2115
|
animationHandle: f,
|
|
2023
2116
|
direction: "in",
|
|
2024
2117
|
originalWidth: s,
|
|
2025
|
-
originalHeight:
|
|
2118
|
+
originalHeight: c
|
|
2026
2119
|
};
|
|
2027
2120
|
}
|
|
2028
2121
|
/**
|
|
@@ -2031,30 +2124,30 @@ class Ce {
|
|
|
2031
2124
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2032
2125
|
*/
|
|
2033
2126
|
startUnfocusAnimation(t, i, e, n) {
|
|
2034
|
-
t.style.zIndex = String(
|
|
2127
|
+
t.style.zIndex = String(Mt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2035
2128
|
const a = this.config.animationDuration ?? 600;
|
|
2036
|
-
t.classList.remove("fbn-ic-focused"),
|
|
2037
|
-
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth,
|
|
2129
|
+
t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
|
|
2130
|
+
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
|
|
2038
2131
|
x: 0,
|
|
2039
2132
|
y: 0,
|
|
2040
2133
|
rotation: i.rotation,
|
|
2041
2134
|
scale: 1
|
|
2042
2135
|
// No scale - using dimensions
|
|
2043
|
-
},
|
|
2136
|
+
}, u = this.focusData?.originalWidth ?? t.offsetWidth, h = this.focusData?.originalHeight ?? t.offsetHeight, d = this.animateWithDimensions(
|
|
2044
2137
|
t,
|
|
2045
2138
|
r,
|
|
2046
|
-
|
|
2139
|
+
l,
|
|
2047
2140
|
s,
|
|
2141
|
+
c,
|
|
2142
|
+
u,
|
|
2048
2143
|
h,
|
|
2049
|
-
d,
|
|
2050
|
-
l,
|
|
2051
2144
|
a
|
|
2052
2145
|
), g = {
|
|
2053
2146
|
id: `unfocus-${Date.now()}`,
|
|
2054
2147
|
element: t,
|
|
2055
|
-
animation:
|
|
2148
|
+
animation: d,
|
|
2056
2149
|
fromState: r,
|
|
2057
|
-
toState:
|
|
2150
|
+
toState: l,
|
|
2058
2151
|
startTime: performance.now(),
|
|
2059
2152
|
duration: a
|
|
2060
2153
|
};
|
|
@@ -2063,8 +2156,8 @@ class Ce {
|
|
|
2063
2156
|
originalState: i,
|
|
2064
2157
|
animationHandle: g,
|
|
2065
2158
|
direction: "out",
|
|
2066
|
-
originalWidth:
|
|
2067
|
-
originalHeight:
|
|
2159
|
+
originalWidth: u,
|
|
2160
|
+
originalHeight: h
|
|
2068
2161
|
};
|
|
2069
2162
|
}
|
|
2070
2163
|
/**
|
|
@@ -2082,9 +2175,9 @@ class Ce {
|
|
|
2082
2175
|
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
2083
2176
|
*/
|
|
2084
2177
|
captureMidAnimationState(t) {
|
|
2085
|
-
const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, a = t.offsetHeight, r = e.e + n * 0.5, s = e.f + a * 0.5,
|
|
2086
|
-
return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${
|
|
2087
|
-
transform: { x: r, y: s, rotation:
|
|
2178
|
+
const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, a = t.offsetHeight, r = e.e + n * 0.5, s = e.f + a * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
|
|
2179
|
+
return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${c}deg)`, t.style.transition = "none", {
|
|
2180
|
+
transform: { x: r, y: s, rotation: c, scale: 1 },
|
|
2088
2181
|
dimensions: { width: n, height: a }
|
|
2089
2182
|
};
|
|
2090
2183
|
}
|
|
@@ -2162,12 +2255,12 @@ class Ce {
|
|
|
2162
2255
|
if (this.outgoing?.element === t) {
|
|
2163
2256
|
const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
|
|
2164
2257
|
if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
|
|
2165
|
-
const { transform: s, dimensions:
|
|
2258
|
+
const { transform: s, dimensions: c } = this.captureMidAnimationState(this.incoming.element);
|
|
2166
2259
|
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2167
2260
|
this.incoming.element,
|
|
2168
2261
|
this.incoming.originalState,
|
|
2169
2262
|
s,
|
|
2170
|
-
|
|
2263
|
+
c
|
|
2171
2264
|
);
|
|
2172
2265
|
} else
|
|
2173
2266
|
this.outgoing = null;
|
|
@@ -2291,10 +2384,10 @@ class Ce {
|
|
|
2291
2384
|
if (!this.currentFocus || !this.focusData || this.state !== R.FOCUSED) return;
|
|
2292
2385
|
const e = this.currentFocus, n = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = n.x ?? 0, s = n.y ?? 0;
|
|
2293
2386
|
a.push(`translate(${r}px, ${s}px)`), n.rotation !== void 0 && a.push(`rotate(${n.rotation}deg)`);
|
|
2294
|
-
const
|
|
2295
|
-
t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform =
|
|
2387
|
+
const c = a.join(" ");
|
|
2388
|
+
t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = c, setTimeout(() => {
|
|
2296
2389
|
this.currentFocus === e && (e.style.transition = "none");
|
|
2297
|
-
}, i)) : (e.style.transition = "none", e.style.transform =
|
|
2390
|
+
}, i)) : (e.style.transition = "none", e.style.transform = c);
|
|
2298
2391
|
}
|
|
2299
2392
|
/**
|
|
2300
2393
|
* Reset zoom state (cancels all animations)
|
|
@@ -2321,7 +2414,7 @@ class Ce {
|
|
|
2321
2414
|
), this.state = R.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2322
2415
|
}
|
|
2323
2416
|
}
|
|
2324
|
-
const
|
|
2417
|
+
const He = 50, Ne = 0.5, je = 20, We = 0.3, ke = 150, Ge = 30, at = class at {
|
|
2325
2418
|
constructor(t, i) {
|
|
2326
2419
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = i, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2327
2420
|
}
|
|
@@ -2348,7 +2441,7 @@ const Ae = 50, Le = 0.5, Me = 20, Fe = 0.3, ze = 150, Oe = 30, st = class st {
|
|
|
2348
2441
|
* Used to prevent click-outside from unfocusing immediately after touch
|
|
2349
2442
|
*/
|
|
2350
2443
|
hadRecentTouch() {
|
|
2351
|
-
return Date.now() - this.recentTouchTimestamp <
|
|
2444
|
+
return Date.now() - this.recentTouchTimestamp < at.TOUCH_CLICK_DELAY;
|
|
2352
2445
|
}
|
|
2353
2446
|
handleTouchStart(t) {
|
|
2354
2447
|
if (t.touches.length !== 1) return;
|
|
@@ -2368,11 +2461,11 @@ const Ae = 50, Le = 0.5, Me = 20, Fe = 0.3, ze = 150, Oe = 30, st = class st {
|
|
|
2368
2461
|
const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
|
|
2369
2462
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
|
|
2370
2463
|
const s = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
|
|
2371
|
-
this.touchState.isHorizontalSwipe = s <=
|
|
2464
|
+
this.touchState.isHorizontalSwipe = s <= Ge;
|
|
2372
2465
|
}
|
|
2373
2466
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2374
2467
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
|
|
2375
|
-
const a = e *
|
|
2468
|
+
const a = e * We;
|
|
2376
2469
|
this.callbacks.onDragOffset(a);
|
|
2377
2470
|
}
|
|
2378
2471
|
}
|
|
@@ -2381,15 +2474,15 @@ const Ae = 50, Le = 0.5, Me = 20, Fe = 0.3, ze = 150, Oe = 30, st = class st {
|
|
|
2381
2474
|
this.recentTouchTimestamp = Date.now();
|
|
2382
2475
|
const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, a = Math.abs(i);
|
|
2383
2476
|
let r = !1;
|
|
2384
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >=
|
|
2477
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= He || n >= Ne && a >= je) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2385
2478
|
}
|
|
2386
2479
|
handleTouchCancel(t) {
|
|
2387
2480
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
2388
2481
|
}
|
|
2389
2482
|
};
|
|
2390
|
-
|
|
2391
|
-
let
|
|
2392
|
-
class
|
|
2483
|
+
at.TOUCH_CLICK_DELAY = 300;
|
|
2484
|
+
let bt = at;
|
|
2485
|
+
class qe {
|
|
2393
2486
|
constructor(t) {
|
|
2394
2487
|
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)
|
|
2395
2488
|
throw new Error("GoogleDriveLoader requires at least one source to be configured");
|
|
@@ -2484,11 +2577,11 @@ class $e {
|
|
|
2484
2577
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2485
2578
|
if (!s.ok)
|
|
2486
2579
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2487
|
-
const
|
|
2488
|
-
(
|
|
2580
|
+
const l = (await s.json()).files.filter(
|
|
2581
|
+
(u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
|
|
2489
2582
|
);
|
|
2490
|
-
return this.log(`Found ${
|
|
2491
|
-
e.push(`https://lh3.googleusercontent.com/d/${
|
|
2583
|
+
return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
|
|
2584
|
+
e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2492
2585
|
}), e;
|
|
2493
2586
|
}
|
|
2494
2587
|
/**
|
|
@@ -2509,8 +2602,8 @@ class $e {
|
|
|
2509
2602
|
try {
|
|
2510
2603
|
const r = `${this.apiEndpoint}/${a}?fields=name,mimeType&key=${this.apiKey}`, s = await fetch(r);
|
|
2511
2604
|
if (s.ok) {
|
|
2512
|
-
const
|
|
2513
|
-
|
|
2605
|
+
const c = await s.json();
|
|
2606
|
+
c.mimeType.startsWith("image/") && i.isAllowed(c.name) ? (e.push(`https://lh3.googleusercontent.com/d/${a}=s1600`), this.log(`Added file: ${c.name}`)) : this.log(`Skipping non-image file: ${c.name} (${c.mimeType})`);
|
|
2514
2607
|
} else
|
|
2515
2608
|
this.log(`Failed to fetch metadata for file ${a}: ${s.status}`);
|
|
2516
2609
|
} catch (r) {
|
|
@@ -2554,18 +2647,18 @@ class $e {
|
|
|
2554
2647
|
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2555
2648
|
if (!s.ok)
|
|
2556
2649
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2557
|
-
const
|
|
2558
|
-
(
|
|
2559
|
-
),
|
|
2560
|
-
(
|
|
2650
|
+
const c = await s.json(), l = c.files.filter(
|
|
2651
|
+
(h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
|
|
2652
|
+
), u = c.files.filter(
|
|
2653
|
+
(h) => h.mimeType === "application/vnd.google-apps.folder"
|
|
2561
2654
|
);
|
|
2562
|
-
this.log(`Found ${
|
|
2563
|
-
e.push(`https://lh3.googleusercontent.com/d/${
|
|
2655
|
+
this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), l.forEach((h) => {
|
|
2656
|
+
e.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
|
|
2564
2657
|
});
|
|
2565
|
-
for (const
|
|
2566
|
-
this.log(`Loading images from subfolder: ${
|
|
2567
|
-
const
|
|
2568
|
-
e.push(...
|
|
2658
|
+
for (const h of u) {
|
|
2659
|
+
this.log(`Loading images from subfolder: ${h.name}`);
|
|
2660
|
+
const d = await this.loadImagesRecursively(h.id, i);
|
|
2661
|
+
e.push(...d);
|
|
2569
2662
|
}
|
|
2570
2663
|
return e;
|
|
2571
2664
|
}
|
|
@@ -2582,8 +2675,8 @@ class $e {
|
|
|
2582
2675
|
if (!n.ok)
|
|
2583
2676
|
throw new Error("Cannot access folder directly (CORS or permissions issue)");
|
|
2584
2677
|
const a = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, s = [...a.matchAll(r)];
|
|
2585
|
-
return [...new Set(s.map((
|
|
2586
|
-
(
|
|
2678
|
+
return [...new Set(s.map((u) => u[1]))].map(
|
|
2679
|
+
(u) => `https://drive.google.com/uc?export=view&id=${u}`
|
|
2587
2680
|
);
|
|
2588
2681
|
} catch (e) {
|
|
2589
2682
|
throw console.error("Direct loading failed:", e), new Error(
|
|
@@ -2610,7 +2703,7 @@ class $e {
|
|
|
2610
2703
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2611
2704
|
}
|
|
2612
2705
|
}
|
|
2613
|
-
class
|
|
2706
|
+
class Xe {
|
|
2614
2707
|
constructor(t) {
|
|
2615
2708
|
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)
|
|
2616
2709
|
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
@@ -2790,7 +2883,7 @@ class De {
|
|
|
2790
2883
|
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
2791
2884
|
}
|
|
2792
2885
|
}
|
|
2793
|
-
class
|
|
2886
|
+
class Ye {
|
|
2794
2887
|
constructor(t) {
|
|
2795
2888
|
if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
|
|
2796
2889
|
throw new Error("CompositeLoader requires at least one loader to be configured");
|
|
@@ -2847,7 +2940,7 @@ class Pe {
|
|
|
2847
2940
|
this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
|
|
2848
2941
|
}
|
|
2849
2942
|
}
|
|
2850
|
-
class
|
|
2943
|
+
class Be {
|
|
2851
2944
|
/**
|
|
2852
2945
|
* Create a new ImageFilter
|
|
2853
2946
|
* @param extensions - Array of allowed file extensions (without dots)
|
|
@@ -2884,7 +2977,7 @@ class Ue {
|
|
|
2884
2977
|
// isAllowedDate(date: Date): boolean
|
|
2885
2978
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
2886
2979
|
}
|
|
2887
|
-
const
|
|
2980
|
+
const Ve = `
|
|
2888
2981
|
.fbn-ic-gallery {
|
|
2889
2982
|
position: relative;
|
|
2890
2983
|
width: 100%;
|
|
@@ -2934,21 +3027,21 @@ const _e = `
|
|
|
2934
3027
|
display: none !important;
|
|
2935
3028
|
}
|
|
2936
3029
|
`;
|
|
2937
|
-
function
|
|
3030
|
+
function Je() {
|
|
2938
3031
|
if (typeof document > "u") return;
|
|
2939
3032
|
const o = "fbn-ic-functional-styles";
|
|
2940
3033
|
if (document.getElementById(o)) return;
|
|
2941
3034
|
const t = document.createElement("style");
|
|
2942
|
-
t.id = o, t.textContent =
|
|
3035
|
+
t.id = o, t.textContent = Ve, document.head.appendChild(t);
|
|
2943
3036
|
}
|
|
2944
|
-
let
|
|
3037
|
+
let Ke = class {
|
|
2945
3038
|
constructor(t = {}) {
|
|
2946
|
-
this.fullConfig =
|
|
3039
|
+
this.fullConfig = Kt(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 ee(this.fullConfig.animation), this.layoutEngine = new Me({
|
|
2947
3040
|
layout: this.fullConfig.layout,
|
|
2948
3041
|
image: this.fullConfig.image
|
|
2949
|
-
}), this.zoomEngine = new
|
|
2950
|
-
const i = this.fullConfig.animation.entry ||
|
|
2951
|
-
this.entryAnimationEngine = new
|
|
3042
|
+
}), this.zoomEngine = new Ue(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = et(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3043
|
+
const i = this.fullConfig.animation.entry || x.animation.entry;
|
|
3044
|
+
this.entryAnimationEngine = new ue(
|
|
2952
3045
|
i,
|
|
2953
3046
|
this.fullConfig.layout.algorithm
|
|
2954
3047
|
), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
@@ -2958,7 +3051,7 @@ let je = class {
|
|
|
2958
3051
|
*/
|
|
2959
3052
|
createImageFilter() {
|
|
2960
3053
|
const t = this.fullConfig.config.loaders?.allowedExtensions;
|
|
2961
|
-
return new
|
|
3054
|
+
return new Be(t);
|
|
2962
3055
|
}
|
|
2963
3056
|
/**
|
|
2964
3057
|
* Create appropriate image loader based on config
|
|
@@ -2969,7 +3062,7 @@ let je = class {
|
|
|
2969
3062
|
if (!t || t.length === 0)
|
|
2970
3063
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
2971
3064
|
const e = t.map((n) => this.createLoaderFromEntry(n, i));
|
|
2972
|
-
return e.length === 1 ? e[0] : new
|
|
3065
|
+
return e.length === 1 ? e[0] : new Ye({
|
|
2973
3066
|
loaders: e,
|
|
2974
3067
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
2975
3068
|
});
|
|
@@ -2987,14 +3080,14 @@ let je = class {
|
|
|
2987
3080
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
2988
3081
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2989
3082
|
};
|
|
2990
|
-
return new
|
|
3083
|
+
return new Xe(n);
|
|
2991
3084
|
} else if ("googleDrive" in t) {
|
|
2992
3085
|
const e = t.googleDrive, n = {
|
|
2993
3086
|
...e,
|
|
2994
3087
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
2995
3088
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
2996
3089
|
};
|
|
2997
|
-
return new
|
|
3090
|
+
return new qe(n);
|
|
2998
3091
|
} else
|
|
2999
3092
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
3000
3093
|
}
|
|
@@ -3003,16 +3096,16 @@ let je = class {
|
|
|
3003
3096
|
*/
|
|
3004
3097
|
async init() {
|
|
3005
3098
|
try {
|
|
3006
|
-
if (
|
|
3099
|
+
if (Je(), this.containerRef)
|
|
3007
3100
|
this.containerEl = this.containerRef;
|
|
3008
3101
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
3009
3102
|
throw new Error(`Container #${this.containerId} not found`);
|
|
3010
|
-
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new
|
|
3103
|
+
this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new bt(this.containerEl, {
|
|
3011
3104
|
onNext: () => this.navigateToNextImage(),
|
|
3012
3105
|
onPrev: () => this.navigateToPreviousImage(),
|
|
3013
3106
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
3014
3107
|
onDragEnd: (t) => {
|
|
3015
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
3108
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, ke);
|
|
3016
3109
|
}
|
|
3017
3110
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3018
3111
|
} catch (t) {
|
|
@@ -3133,55 +3226,55 @@ let je = class {
|
|
|
3133
3226
|
const n = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
|
|
3134
3227
|
this.imageLayouts = a, this.displayQueue = [];
|
|
3135
3228
|
let r = 0;
|
|
3136
|
-
const s = (
|
|
3137
|
-
this.containerEl && (this.containerEl.appendChild(
|
|
3138
|
-
if (
|
|
3139
|
-
const
|
|
3140
|
-
x: parseFloat(
|
|
3141
|
-
y: parseFloat(
|
|
3229
|
+
const s = (l) => {
|
|
3230
|
+
this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(() => {
|
|
3231
|
+
if (l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1", l.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)) {
|
|
3232
|
+
const d = {
|
|
3233
|
+
x: parseFloat(l.dataset.startX),
|
|
3234
|
+
y: parseFloat(l.dataset.startY)
|
|
3142
3235
|
}, g = {
|
|
3143
|
-
x: parseFloat(
|
|
3144
|
-
y: parseFloat(
|
|
3145
|
-
},
|
|
3146
|
-
|
|
3147
|
-
element:
|
|
3148
|
-
startPosition:
|
|
3236
|
+
x: parseFloat(l.dataset.endX),
|
|
3237
|
+
y: parseFloat(l.dataset.endY)
|
|
3238
|
+
}, b = parseFloat(l.dataset.imageWidth), m = parseFloat(l.dataset.imageHeight), f = parseFloat(l.dataset.rotation), p = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : f, v = l.dataset.startScale ? parseFloat(l.dataset.startScale) : p, w = this.entryAnimationEngine.getTiming();
|
|
3239
|
+
le({
|
|
3240
|
+
element: l,
|
|
3241
|
+
startPosition: d,
|
|
3149
3242
|
endPosition: g,
|
|
3150
3243
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3151
3244
|
duration: w.duration,
|
|
3152
|
-
imageWidth:
|
|
3153
|
-
imageHeight:
|
|
3245
|
+
imageWidth: b,
|
|
3246
|
+
imageHeight: m,
|
|
3154
3247
|
rotation: f,
|
|
3155
|
-
scale:
|
|
3248
|
+
scale: p,
|
|
3156
3249
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3157
|
-
startRotation:
|
|
3250
|
+
startRotation: y,
|
|
3158
3251
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3159
3252
|
startScale: v
|
|
3160
3253
|
});
|
|
3161
3254
|
} else {
|
|
3162
|
-
const
|
|
3163
|
-
|
|
3255
|
+
const d = l.dataset.finalTransform || "";
|
|
3256
|
+
l.style.transform = d;
|
|
3164
3257
|
}
|
|
3165
|
-
const
|
|
3166
|
-
if (this.fullConfig.config.debug?.enabled &&
|
|
3167
|
-
const
|
|
3168
|
-
console.log(`Image ${
|
|
3169
|
-
left:
|
|
3170
|
-
top:
|
|
3171
|
-
width:
|
|
3172
|
-
height:
|
|
3173
|
-
computedWidth:
|
|
3174
|
-
computedHeight:
|
|
3175
|
-
transform:
|
|
3258
|
+
const h = parseInt(l.dataset.imageId || "0");
|
|
3259
|
+
if (this.fullConfig.config.debug?.enabled && h < 3) {
|
|
3260
|
+
const d = l.dataset.finalTransform || "";
|
|
3261
|
+
console.log(`Image ${h} final state:`, {
|
|
3262
|
+
left: l.style.left,
|
|
3263
|
+
top: l.style.top,
|
|
3264
|
+
width: l.style.width,
|
|
3265
|
+
height: l.style.height,
|
|
3266
|
+
computedWidth: l.offsetWidth,
|
|
3267
|
+
computedHeight: l.offsetHeight,
|
|
3268
|
+
transform: d,
|
|
3176
3269
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3177
3270
|
});
|
|
3178
3271
|
}
|
|
3179
3272
|
}), r++);
|
|
3180
|
-
},
|
|
3273
|
+
}, c = () => {
|
|
3181
3274
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3182
3275
|
for (; this.displayQueue.length > 0; ) {
|
|
3183
|
-
const
|
|
3184
|
-
|
|
3276
|
+
const l = this.displayQueue.shift();
|
|
3277
|
+
l && s(l);
|
|
3185
3278
|
}
|
|
3186
3279
|
return;
|
|
3187
3280
|
}
|
|
@@ -3191,78 +3284,78 @@ let je = class {
|
|
|
3191
3284
|
return;
|
|
3192
3285
|
}
|
|
3193
3286
|
if (this.displayQueue.length > 0) {
|
|
3194
|
-
const
|
|
3195
|
-
|
|
3287
|
+
const l = this.displayQueue.shift();
|
|
3288
|
+
l && s(l);
|
|
3196
3289
|
}
|
|
3197
3290
|
r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3198
3291
|
}, this.fullConfig.animation.queue.interval);
|
|
3199
3292
|
};
|
|
3200
3293
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3201
|
-
const
|
|
3202
|
-
|
|
3203
|
-
|
|
3294
|
+
const l = new IntersectionObserver((u) => {
|
|
3295
|
+
u.forEach((h) => {
|
|
3296
|
+
h.isIntersecting && (c(), l.disconnect());
|
|
3204
3297
|
});
|
|
3205
3298
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3206
|
-
|
|
3299
|
+
l.observe(this.containerEl);
|
|
3207
3300
|
} else
|
|
3208
|
-
|
|
3209
|
-
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((
|
|
3210
|
-
const
|
|
3211
|
-
|
|
3212
|
-
const
|
|
3213
|
-
|
|
3214
|
-
})), t.forEach((
|
|
3215
|
-
const
|
|
3216
|
-
|
|
3217
|
-
const
|
|
3218
|
-
|
|
3219
|
-
if (this.hoveredImage = { element:
|
|
3220
|
-
const g =
|
|
3221
|
-
|
|
3301
|
+
c();
|
|
3302
|
+
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), a.forEach((l, u) => {
|
|
3303
|
+
const h = document.createElement("div");
|
|
3304
|
+
h.className = "fbn-ic-debug-center", h.style.position = "absolute", h.style.width = "12px", h.style.height = "12px", h.style.borderRadius = "50%", h.style.backgroundColor = "red", h.style.border = "2px solid yellow", h.style.zIndex = "9999", h.style.pointerEvents = "none";
|
|
3305
|
+
const d = l.x, g = l.y;
|
|
3306
|
+
h.style.left = `${d - 6}px`, h.style.top = `${g - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(g)})`, this.containerEl.appendChild(h);
|
|
3307
|
+
})), t.forEach((l, u) => {
|
|
3308
|
+
const h = document.createElement("img");
|
|
3309
|
+
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
|
|
3310
|
+
const d = a[u];
|
|
3311
|
+
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), st(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
|
|
3312
|
+
if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
|
|
3313
|
+
const g = h.cachedRenderedWidth;
|
|
3314
|
+
ft(h, this.fullConfig.styling?.hover, i, g), st(h, this.hoverClassName);
|
|
3222
3315
|
}
|
|
3223
|
-
}),
|
|
3224
|
-
if (this.hoveredImage = null, !this.zoomEngine.isInvolved(
|
|
3225
|
-
const g =
|
|
3226
|
-
|
|
3316
|
+
}), h.addEventListener("mouseleave", () => {
|
|
3317
|
+
if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
|
|
3318
|
+
const g = h.cachedRenderedWidth;
|
|
3319
|
+
ft(h, this.fullConfig.styling?.default, i, g), pt(h, this.hoverClassName), st(h, this.defaultClassName);
|
|
3227
3320
|
}
|
|
3228
|
-
}),
|
|
3229
|
-
g.stopPropagation(), this.handleImageClick(
|
|
3230
|
-
}),
|
|
3321
|
+
}), h.addEventListener("click", (g) => {
|
|
3322
|
+
g.stopPropagation(), this.handleImageClick(h, d);
|
|
3323
|
+
}), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
|
|
3231
3324
|
if (n !== this.loadGeneration)
|
|
3232
3325
|
return;
|
|
3233
|
-
const g =
|
|
3234
|
-
|
|
3235
|
-
const
|
|
3236
|
-
|
|
3326
|
+
const g = h.naturalWidth / h.naturalHeight, b = i * g;
|
|
3327
|
+
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${b}`), h.style.width = `${b}px`, h.cachedRenderedWidth = b, h.aspectRatio = g, ft(h, this.fullConfig.styling?.default, i, b);
|
|
3328
|
+
const m = { x: d.x, y: d.y }, f = { width: b, height: i }, p = this.entryAnimationEngine.calculateStartPosition(
|
|
3329
|
+
m,
|
|
3237
3330
|
f,
|
|
3238
3331
|
e,
|
|
3239
|
-
|
|
3332
|
+
u,
|
|
3240
3333
|
t.length
|
|
3241
|
-
),
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3334
|
+
), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), v = this.entryAnimationEngine.calculateStartScale(d.scale), w = this.entryAnimationEngine.buildFinalTransform(
|
|
3335
|
+
d.rotation,
|
|
3336
|
+
d.scale,
|
|
3337
|
+
b,
|
|
3245
3338
|
i
|
|
3246
|
-
),
|
|
3339
|
+
), S = this.entryAnimationEngine.buildStartTransform(
|
|
3340
|
+
p,
|
|
3247
3341
|
m,
|
|
3342
|
+
d.rotation,
|
|
3343
|
+
d.scale,
|
|
3248
3344
|
b,
|
|
3249
|
-
u.rotation,
|
|
3250
|
-
u.scale,
|
|
3251
|
-
p,
|
|
3252
3345
|
i,
|
|
3253
|
-
|
|
3346
|
+
y,
|
|
3254
3347
|
v
|
|
3255
3348
|
);
|
|
3256
|
-
this.fullConfig.config.debug?.enabled &&
|
|
3257
|
-
finalPosition:
|
|
3349
|
+
this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
|
|
3350
|
+
finalPosition: m,
|
|
3258
3351
|
imageSize: f,
|
|
3259
|
-
left:
|
|
3260
|
-
top:
|
|
3352
|
+
left: d.x,
|
|
3353
|
+
top: d.y,
|
|
3261
3354
|
finalTransform: w,
|
|
3262
|
-
renderedWidth:
|
|
3355
|
+
renderedWidth: b,
|
|
3263
3356
|
renderedHeight: i
|
|
3264
|
-
}),
|
|
3265
|
-
},
|
|
3357
|
+
}), h.style.transform = S, h.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || v !== d.scale) && (h.dataset.startX = String(p.x), h.dataset.startY = String(p.y), h.dataset.endX = String(m.x), h.dataset.endY = String(m.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(v)), this.displayQueue.push(h);
|
|
3358
|
+
}, h.onerror = () => r++, h.src = l;
|
|
3266
3359
|
});
|
|
3267
3360
|
}
|
|
3268
3361
|
async handleImageClick(t, i) {
|
|
@@ -3306,28 +3399,28 @@ let je = class {
|
|
|
3306
3399
|
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();
|
|
3307
3400
|
}
|
|
3308
3401
|
};
|
|
3309
|
-
const
|
|
3402
|
+
const ei = Ht(
|
|
3310
3403
|
function({ className: t, style: i, ...e }, n) {
|
|
3311
|
-
const a =
|
|
3312
|
-
return
|
|
3404
|
+
const a = Rt(null), r = Rt(null);
|
|
3405
|
+
return Nt(n, () => ({
|
|
3313
3406
|
get instance() {
|
|
3314
3407
|
return r.current;
|
|
3315
3408
|
}
|
|
3316
|
-
})),
|
|
3409
|
+
})), jt(() => {
|
|
3317
3410
|
if (!a.current) return;
|
|
3318
|
-
const s = new
|
|
3411
|
+
const s = new Ke({
|
|
3319
3412
|
container: a.current,
|
|
3320
3413
|
...e
|
|
3321
3414
|
});
|
|
3322
|
-
return r.current = s, s.init().catch((
|
|
3323
|
-
console.error("ImageCloud init failed:",
|
|
3415
|
+
return r.current = s, s.init().catch((c) => {
|
|
3416
|
+
console.error("ImageCloud init failed:", c);
|
|
3324
3417
|
}), () => {
|
|
3325
3418
|
s.destroy(), r.current = null;
|
|
3326
3419
|
};
|
|
3327
|
-
}, [JSON.stringify(e)]), /* @__PURE__ */
|
|
3420
|
+
}, [JSON.stringify(e)]), /* @__PURE__ */ Ut("div", { ref: a, className: t, style: i });
|
|
3328
3421
|
}
|
|
3329
3422
|
);
|
|
3330
3423
|
export {
|
|
3331
|
-
|
|
3424
|
+
ei as ImageCloud
|
|
3332
3425
|
};
|
|
3333
3426
|
//# sourceMappingURL=react.js.map
|