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