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