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