@frybynite/image-cloud 0.9.3 → 0.9.4
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 +455 -388
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +1005 -938
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +34 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/react.d.ts +16 -2
- package/dist/react.js +913 -846
- package/dist/react.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/vue.d.ts +16 -2
- package/dist/vue.js +994 -927
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +16 -2
- package/dist/web-component.js +740 -673
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
package/dist/vue.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { defineComponent as Ht, ref as It, onMounted as Nt, onUnmounted as kt, watch as
|
|
1
|
+
import { defineComponent as Ht, ref as It, onMounted as Nt, onUnmounted as kt, watch as Bt, h as jt } from "vue";
|
|
2
2
|
const mt = Object.freeze({
|
|
3
3
|
none: "none",
|
|
4
4
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
5
5
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
6
6
|
lg: "0 8px 32px rgba(0,0,0,0.5)",
|
|
7
7
|
glow: "0 0 30px rgba(255,255,255,0.6)"
|
|
8
|
-
}),
|
|
8
|
+
}), At = Object.freeze({
|
|
9
9
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
10
10
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
11
11
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
12
|
-
}),
|
|
12
|
+
}), Ct = Object.freeze({
|
|
13
13
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
14
14
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
15
15
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
16
16
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
17
|
-
}),
|
|
17
|
+
}), Rt = Object.freeze({
|
|
18
18
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
19
19
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
20
20
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
21
21
|
flutter: Object.freeze({ amplitude: 20, frequency: 4, decay: !0, decayRate: 0.5, phase: 0 })
|
|
22
|
-
}),
|
|
22
|
+
}), yt = Object.freeze({
|
|
23
23
|
type: "linear"
|
|
24
24
|
}), vt = Object.freeze({
|
|
25
25
|
mode: "none"
|
|
26
|
-
}),
|
|
26
|
+
}), Et = Object.freeze({
|
|
27
27
|
mode: "none"
|
|
28
28
|
}), Ft = Object.freeze({
|
|
29
29
|
default: Object.freeze({
|
|
@@ -51,16 +51,16 @@ const mt = Object.freeze({
|
|
|
51
51
|
focused: Object.freeze({
|
|
52
52
|
shadow: "none"
|
|
53
53
|
})
|
|
54
|
-
}),
|
|
54
|
+
}), Wt = Object.freeze({
|
|
55
55
|
tightness: 1
|
|
56
|
-
}),
|
|
56
|
+
}), Gt = Object.freeze({
|
|
57
57
|
rows: 1,
|
|
58
58
|
amplitude: 100,
|
|
59
59
|
frequency: 2,
|
|
60
60
|
phaseShift: 0,
|
|
61
61
|
synchronization: "offset"
|
|
62
62
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
63
|
-
}),
|
|
63
|
+
}), qt = Object.freeze({
|
|
64
64
|
spacing: 0
|
|
65
65
|
}), Xt = Object.freeze({
|
|
66
66
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
@@ -95,7 +95,7 @@ const mt = Object.freeze({
|
|
|
95
95
|
enabled: !1,
|
|
96
96
|
centers: !1,
|
|
97
97
|
loaders: !1
|
|
98
|
-
}), Jt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Kt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Zt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Qt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }),
|
|
98
|
+
}), Jt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Kt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Zt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Qt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), A = Object.freeze({
|
|
99
99
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
100
100
|
loaders: [],
|
|
101
101
|
// Shared loader settings and debug config
|
|
@@ -156,9 +156,9 @@ const mt = Object.freeze({
|
|
|
156
156
|
}),
|
|
157
157
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
|
|
158
158
|
// smooth deceleration
|
|
159
|
-
path:
|
|
159
|
+
path: yt,
|
|
160
160
|
rotation: vt,
|
|
161
|
-
scale:
|
|
161
|
+
scale: Et
|
|
162
162
|
}),
|
|
163
163
|
idle: $t
|
|
164
164
|
}),
|
|
@@ -182,53 +182,55 @@ const mt = Object.freeze({
|
|
|
182
182
|
// UI configuration
|
|
183
183
|
ui: Object.freeze({
|
|
184
184
|
showLoadingSpinner: !1,
|
|
185
|
-
showImageCounter: !1
|
|
185
|
+
showImageCounter: !1,
|
|
186
|
+
showNavButtons: !1,
|
|
187
|
+
showFocusOutline: !1
|
|
186
188
|
}),
|
|
187
189
|
// Image styling
|
|
188
190
|
styling: Ft
|
|
189
191
|
});
|
|
190
|
-
function Z(
|
|
191
|
-
if (!
|
|
192
|
-
if (!t) return { ...
|
|
193
|
-
const i = { ...
|
|
194
|
-
return t.border !== void 0 && (i.border = { ...
|
|
192
|
+
function Z(o, t) {
|
|
193
|
+
if (!o) return t || {};
|
|
194
|
+
if (!t) return { ...o };
|
|
195
|
+
const i = { ...o };
|
|
196
|
+
return t.border !== void 0 && (i.border = { ...o.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...o.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...o.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...o.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...o.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...o.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...o.outline, ...t.outline }), t.shadow !== void 0 && (i.shadow = t.shadow), t.clipPath !== void 0 && (i.clipPath = t.clipPath), t.opacity !== void 0 && (i.opacity = t.opacity), t.cursor !== void 0 && (i.cursor = t.cursor), t.className !== void 0 && (i.className = t.className), t.objectFit !== void 0 && (i.objectFit = t.objectFit), t.aspectRatio !== void 0 && (i.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (i.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (i.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (i.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (i.borderRadiusBottomLeft = t.borderRadiusBottomLeft), i;
|
|
195
197
|
}
|
|
196
|
-
function te(
|
|
197
|
-
if (!t) return { ...
|
|
198
|
-
const i = Z(
|
|
199
|
-
Z(i,
|
|
198
|
+
function te(o, t) {
|
|
199
|
+
if (!t) return { ...o };
|
|
200
|
+
const i = Z(o.default, t.default), e = Z(
|
|
201
|
+
Z(i, o.hover),
|
|
200
202
|
t.hover
|
|
201
|
-
),
|
|
202
|
-
Z(i,
|
|
203
|
+
), n = Z(
|
|
204
|
+
Z(i, o.focused),
|
|
203
205
|
t.focused
|
|
204
206
|
);
|
|
205
207
|
return {
|
|
206
208
|
default: i,
|
|
207
209
|
hover: e,
|
|
208
|
-
focused:
|
|
210
|
+
focused: n
|
|
209
211
|
};
|
|
210
212
|
}
|
|
211
|
-
function ee(
|
|
212
|
-
if (!t) return { ...
|
|
213
|
-
const i = { ...
|
|
213
|
+
function ee(o, t) {
|
|
214
|
+
if (!t) return { ...o };
|
|
215
|
+
const i = { ...o };
|
|
214
216
|
if (t.sizing !== void 0 && (i.sizing = {
|
|
215
|
-
...
|
|
217
|
+
...o.sizing,
|
|
216
218
|
...t.sizing
|
|
217
219
|
}, t.sizing.variance)) {
|
|
218
|
-
const e = t.sizing.variance,
|
|
219
|
-
i.sizing.variance = { min:
|
|
220
|
+
const e = t.sizing.variance, n = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : o.sizing?.variance?.min ?? 1, s = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : o.sizing?.variance?.max ?? 1;
|
|
221
|
+
i.sizing.variance = { min: n, max: s };
|
|
220
222
|
}
|
|
221
223
|
if (t.rotation !== void 0 && (i.rotation = {
|
|
222
|
-
...
|
|
224
|
+
...o.rotation,
|
|
223
225
|
...t.rotation
|
|
224
226
|
}, t.rotation.range)) {
|
|
225
|
-
const e = t.rotation.range,
|
|
226
|
-
i.rotation.range = { min:
|
|
227
|
+
const e = t.rotation.range, n = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : o.rotation?.range?.min ?? -15, s = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : o.rotation?.range?.max ?? 15;
|
|
228
|
+
i.rotation.range = { min: n, max: s };
|
|
227
229
|
}
|
|
228
230
|
return i;
|
|
229
231
|
}
|
|
230
|
-
function ie(
|
|
231
|
-
const t =
|
|
232
|
+
function ie(o) {
|
|
233
|
+
const t = o.layout?.rotation;
|
|
232
234
|
if (t && "enabled" in t)
|
|
233
235
|
return {
|
|
234
236
|
rotation: {
|
|
@@ -237,8 +239,8 @@ function ie(n) {
|
|
|
237
239
|
}
|
|
238
240
|
};
|
|
239
241
|
}
|
|
240
|
-
function
|
|
241
|
-
const t =
|
|
242
|
+
function ne(o) {
|
|
243
|
+
const t = o.layout?.sizing?.variance;
|
|
242
244
|
if (t)
|
|
243
245
|
return {
|
|
244
246
|
sizing: {
|
|
@@ -248,109 +250,109 @@ function oe(n) {
|
|
|
248
250
|
}
|
|
249
251
|
};
|
|
250
252
|
}
|
|
251
|
-
function
|
|
252
|
-
const t = ie(
|
|
253
|
-
let e =
|
|
253
|
+
function oe(o = {}) {
|
|
254
|
+
const t = ie(o), i = ne(o);
|
|
255
|
+
let e = o.image;
|
|
254
256
|
(t || i) && (e = {
|
|
255
257
|
...i || {},
|
|
256
258
|
...t || {},
|
|
257
259
|
...e
|
|
258
|
-
}, e.rotation && t?.rotation &&
|
|
260
|
+
}, e.rotation && t?.rotation && o.image?.rotation && (e.rotation = {
|
|
259
261
|
...t.rotation,
|
|
260
|
-
...
|
|
262
|
+
...o.image.rotation
|
|
261
263
|
}));
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
+
const n = [...o.loaders ?? []];
|
|
265
|
+
o.images && o.images.length > 0 && n.unshift({
|
|
264
266
|
static: {
|
|
265
|
-
sources: [{ urls:
|
|
267
|
+
sources: [{ urls: o.images }]
|
|
266
268
|
}
|
|
267
269
|
});
|
|
268
270
|
const r = {
|
|
269
271
|
loaders: {
|
|
270
272
|
...Ot,
|
|
271
|
-
...
|
|
273
|
+
...o.config?.loaders ?? {}
|
|
272
274
|
}
|
|
273
|
-
},
|
|
274
|
-
loaders:
|
|
275
|
+
}, a = {
|
|
276
|
+
loaders: n,
|
|
275
277
|
config: r,
|
|
276
278
|
image: ee(zt, e),
|
|
277
|
-
layout: { ...
|
|
278
|
-
animation: { ...
|
|
279
|
-
interaction: { ...
|
|
280
|
-
ui: { ...
|
|
281
|
-
styling: te(Ft,
|
|
279
|
+
layout: { ...A.layout },
|
|
280
|
+
animation: { ...A.animation },
|
|
281
|
+
interaction: { ...A.interaction },
|
|
282
|
+
ui: { ...A.ui },
|
|
283
|
+
styling: te(Ft, o.styling)
|
|
282
284
|
};
|
|
283
|
-
|
|
284
|
-
...
|
|
285
|
-
...
|
|
286
|
-
},
|
|
287
|
-
...
|
|
288
|
-
mobile:
|
|
289
|
-
tablet:
|
|
290
|
-
}),
|
|
291
|
-
...
|
|
292
|
-
...
|
|
293
|
-
})),
|
|
294
|
-
...
|
|
295
|
-
...
|
|
296
|
-
},
|
|
297
|
-
...
|
|
298
|
-
...
|
|
299
|
-
}),
|
|
300
|
-
...
|
|
301
|
-
...
|
|
302
|
-
}),
|
|
303
|
-
...
|
|
304
|
-
...
|
|
305
|
-
start:
|
|
306
|
-
...
|
|
307
|
-
...
|
|
308
|
-
circular:
|
|
309
|
-
} :
|
|
310
|
-
timing:
|
|
311
|
-
path:
|
|
312
|
-
rotation:
|
|
313
|
-
scale:
|
|
314
|
-
}),
|
|
285
|
+
o.layout && (a.layout = {
|
|
286
|
+
...A.layout,
|
|
287
|
+
...o.layout
|
|
288
|
+
}, o.layout.responsive && (a.layout.responsive = {
|
|
289
|
+
...A.layout.responsive,
|
|
290
|
+
mobile: o.layout.responsive.mobile ? { ...A.layout.responsive.mobile, ...o.layout.responsive.mobile } : A.layout.responsive.mobile,
|
|
291
|
+
tablet: o.layout.responsive.tablet ? { ...A.layout.responsive.tablet, ...o.layout.responsive.tablet } : A.layout.responsive.tablet
|
|
292
|
+
}), o.layout.spacing && (a.layout.spacing = {
|
|
293
|
+
...A.layout.spacing,
|
|
294
|
+
...o.layout.spacing
|
|
295
|
+
})), o.animation && (a.animation = {
|
|
296
|
+
...A.animation,
|
|
297
|
+
...o.animation
|
|
298
|
+
}, o.animation.easing && (a.animation.easing = {
|
|
299
|
+
...A.animation.easing,
|
|
300
|
+
...o.animation.easing
|
|
301
|
+
}), o.animation.queue && (a.animation.queue = {
|
|
302
|
+
...A.animation.queue,
|
|
303
|
+
...o.animation.queue
|
|
304
|
+
}), o.animation.entry && (a.animation.entry = {
|
|
305
|
+
...A.animation.entry,
|
|
306
|
+
...o.animation.entry,
|
|
307
|
+
start: o.animation.entry.start ? {
|
|
308
|
+
...A.animation.entry.start,
|
|
309
|
+
...o.animation.entry.start,
|
|
310
|
+
circular: o.animation.entry.start.circular ? { ...A.animation.entry.start.circular, ...o.animation.entry.start.circular } : A.animation.entry.start.circular
|
|
311
|
+
} : A.animation.entry.start,
|
|
312
|
+
timing: o.animation.entry.timing ? { ...A.animation.entry.timing, ...o.animation.entry.timing } : A.animation.entry.timing,
|
|
313
|
+
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : A.animation.entry.path,
|
|
314
|
+
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : A.animation.entry.rotation,
|
|
315
|
+
scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : A.animation.entry.scale
|
|
316
|
+
}), o.animation.idle && (a.animation.idle = {
|
|
315
317
|
...$t,
|
|
316
|
-
...
|
|
317
|
-
})),
|
|
318
|
-
...
|
|
319
|
-
...
|
|
320
|
-
},
|
|
321
|
-
...
|
|
322
|
-
...
|
|
323
|
-
}),
|
|
324
|
-
...
|
|
325
|
-
...
|
|
318
|
+
...o.animation.idle
|
|
319
|
+
})), o.interaction && (a.interaction = {
|
|
320
|
+
...A.interaction,
|
|
321
|
+
...o.interaction
|
|
322
|
+
}, o.interaction.focus && (a.interaction.focus = {
|
|
323
|
+
...A.interaction.focus,
|
|
324
|
+
...o.interaction.focus
|
|
325
|
+
}), o.interaction.navigation && (a.interaction.navigation = {
|
|
326
|
+
...A.interaction.navigation,
|
|
327
|
+
...o.interaction.navigation
|
|
326
328
|
}));
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
...
|
|
330
|
-
...
|
|
331
|
-
...
|
|
332
|
-
},
|
|
329
|
+
const c = o.rendering?.ui;
|
|
330
|
+
if (c && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), a.ui = {
|
|
331
|
+
...A.ui,
|
|
332
|
+
...c,
|
|
333
|
+
...o.ui
|
|
334
|
+
}, a.config.debug = {
|
|
333
335
|
...Dt,
|
|
334
|
-
...
|
|
335
|
-
},
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
...
|
|
339
|
-
default: { ...
|
|
340
|
-
hover: { ...
|
|
336
|
+
...o.config?.debug ?? {}
|
|
337
|
+
}, a.layout.algorithm === "honeycomb" && a.styling) {
|
|
338
|
+
const l = { shape: "hexagon", mode: "height-relative" };
|
|
339
|
+
a.styling = {
|
|
340
|
+
...a.styling,
|
|
341
|
+
default: { ...a.styling.default, clipPath: l },
|
|
342
|
+
hover: { ...a.styling.hover, clipPath: l }
|
|
341
343
|
// focused: untouched — user config respected
|
|
342
344
|
};
|
|
343
345
|
}
|
|
344
|
-
return
|
|
346
|
+
return a;
|
|
345
347
|
}
|
|
346
|
-
function se(
|
|
347
|
-
return { ...
|
|
348
|
+
function se(o, t) {
|
|
349
|
+
return { ...o ? At[o] : At.playful, ...t };
|
|
348
350
|
}
|
|
349
|
-
function ae(
|
|
350
|
-
return { ...
|
|
351
|
+
function ae(o, t) {
|
|
352
|
+
return { ...o ? Ct[o] : Ct.gentle, ...t };
|
|
351
353
|
}
|
|
352
|
-
function re(
|
|
353
|
-
return { ...
|
|
354
|
+
function re(o, t) {
|
|
355
|
+
return { ...o ? Rt[o] : Rt.gentle, ...t };
|
|
354
356
|
}
|
|
355
357
|
class ce {
|
|
356
358
|
constructor(t) {
|
|
@@ -363,8 +365,8 @@ class ce {
|
|
|
363
365
|
buildTransformString(t) {
|
|
364
366
|
const i = ["translate(-50%, -50%)"];
|
|
365
367
|
if (t.x !== void 0 || t.y !== void 0) {
|
|
366
|
-
const e = t.x ?? 0,
|
|
367
|
-
i.push(`translate(${e}px, ${
|
|
368
|
+
const e = t.x ?? 0, n = t.y ?? 0;
|
|
369
|
+
i.push(`translate(${e}px, ${n}px)`);
|
|
368
370
|
}
|
|
369
371
|
return t.rotation !== void 0 && i.push(`rotate(${t.rotation}deg)`), t.scale !== void 0 && i.push(`scale(${t.scale})`), i.join(" ");
|
|
370
372
|
}
|
|
@@ -377,18 +379,18 @@ class ce {
|
|
|
377
379
|
* @param easing - CSS easing function (optional)
|
|
378
380
|
* @returns AnimationHandle that can be used to cancel or query the animation
|
|
379
381
|
*/
|
|
380
|
-
animateTransformCancellable(t, i, e,
|
|
382
|
+
animateTransformCancellable(t, i, e, n = null, s = null) {
|
|
381
383
|
this.cancelAllAnimations(t);
|
|
382
|
-
const r =
|
|
384
|
+
const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
|
|
383
385
|
t.style.transition = "none";
|
|
384
386
|
const u = t.animate(
|
|
385
387
|
[
|
|
386
|
-
{ transform:
|
|
387
|
-
{ transform:
|
|
388
|
+
{ transform: c },
|
|
389
|
+
{ transform: l }
|
|
388
390
|
],
|
|
389
391
|
{
|
|
390
392
|
duration: r,
|
|
391
|
-
easing:
|
|
393
|
+
easing: a,
|
|
392
394
|
fill: "forwards"
|
|
393
395
|
// Keep final state after animation
|
|
394
396
|
}
|
|
@@ -402,7 +404,7 @@ class ce {
|
|
|
402
404
|
duration: r
|
|
403
405
|
};
|
|
404
406
|
return this.activeAnimations.set(t, h), u.finished.then(() => {
|
|
405
|
-
t.style.transform =
|
|
407
|
+
t.style.transform = l, this.activeAnimations.delete(t);
|
|
406
408
|
}).catch(() => {
|
|
407
409
|
this.activeAnimations.delete(t);
|
|
408
410
|
}), h;
|
|
@@ -416,13 +418,13 @@ class ce {
|
|
|
416
418
|
cancelAnimation(t, i = !0) {
|
|
417
419
|
const e = this.getCurrentTransform(t.element);
|
|
418
420
|
if (t.animation.cancel(), i) {
|
|
419
|
-
const
|
|
421
|
+
const n = this.buildTransformString({
|
|
420
422
|
x: e.x,
|
|
421
423
|
y: e.y,
|
|
422
424
|
rotation: e.rotation,
|
|
423
425
|
scale: e.scale
|
|
424
426
|
});
|
|
425
|
-
t.element.style.transform =
|
|
427
|
+
t.element.style.transform = n;
|
|
426
428
|
}
|
|
427
429
|
return this.activeAnimations.delete(t.element), e;
|
|
428
430
|
}
|
|
@@ -435,8 +437,8 @@ class ce {
|
|
|
435
437
|
const i = this.activeAnimations.get(t);
|
|
436
438
|
i && this.cancelAnimation(i, !1);
|
|
437
439
|
const e = t.getAnimations();
|
|
438
|
-
for (const
|
|
439
|
-
|
|
440
|
+
for (const n of e)
|
|
441
|
+
n.cancel();
|
|
440
442
|
}
|
|
441
443
|
/**
|
|
442
444
|
* Get current transform state of an element (works mid-animation)
|
|
@@ -448,8 +450,8 @@ class ce {
|
|
|
448
450
|
const e = getComputedStyle(t).transform;
|
|
449
451
|
if (e === "none" || !e)
|
|
450
452
|
return { x: 0, y: 0, rotation: 0, scale: 1 };
|
|
451
|
-
const
|
|
452
|
-
return { x:
|
|
453
|
+
const n = new DOMMatrix(e), s = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), a = n.e, c = n.f;
|
|
454
|
+
return { x: a, y: c, rotation: r, scale: s };
|
|
453
455
|
}
|
|
454
456
|
/**
|
|
455
457
|
* Check if an element has an active animation
|
|
@@ -475,11 +477,11 @@ class ce {
|
|
|
475
477
|
* @param easing - CSS easing function (optional)
|
|
476
478
|
* @returns Promise that resolves when animation completes
|
|
477
479
|
*/
|
|
478
|
-
animateTransform(t, i, e = null,
|
|
479
|
-
return new Promise((
|
|
480
|
-
const r = e ?? this.config.duration,
|
|
481
|
-
t.style.transition = `transform ${r}ms ${
|
|
482
|
-
|
|
480
|
+
animateTransform(t, i, e = null, n = null) {
|
|
481
|
+
return new Promise((s) => {
|
|
482
|
+
const r = e ?? this.config.duration, a = n ?? this.config.easing.default;
|
|
483
|
+
t.style.transition = `transform ${r}ms ${a}, box-shadow ${r}ms ${a}`, t.style.transform = this.buildTransformString(i), setTimeout(() => {
|
|
484
|
+
s();
|
|
483
485
|
}, r);
|
|
484
486
|
});
|
|
485
487
|
}
|
|
@@ -508,161 +510,161 @@ class ce {
|
|
|
508
510
|
return new Promise((i) => setTimeout(i, t));
|
|
509
511
|
}
|
|
510
512
|
}
|
|
511
|
-
function J(
|
|
512
|
-
return
|
|
513
|
+
function J(o, t, i) {
|
|
514
|
+
return o + (t - o) * i;
|
|
513
515
|
}
|
|
514
|
-
function le(
|
|
515
|
-
const { overshoot:
|
|
516
|
-
let u = 0, h = 0, d = 1,
|
|
517
|
-
for (let
|
|
518
|
-
if (
|
|
519
|
-
h =
|
|
516
|
+
function le(o, t, i, e) {
|
|
517
|
+
const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, l = he(s, r);
|
|
518
|
+
let u = 0, h = 0, d = 1, g = n, b = !1;
|
|
519
|
+
for (let f = 0; f < l.length; f++)
|
|
520
|
+
if (o <= l[f].time) {
|
|
521
|
+
h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, b = l[f].isOvershoot;
|
|
520
522
|
break;
|
|
521
523
|
}
|
|
522
|
-
const p = (
|
|
523
|
-
if (
|
|
524
|
-
u = 1 +
|
|
524
|
+
const p = (o - h) / (d - h);
|
|
525
|
+
if (b)
|
|
526
|
+
u = 1 + g * at(p);
|
|
525
527
|
else if (h === 0)
|
|
526
|
-
u =
|
|
528
|
+
u = at(p);
|
|
527
529
|
else {
|
|
528
|
-
const m = 1 + (
|
|
529
|
-
(
|
|
530
|
-
)?.overshoot ||
|
|
531
|
-
u = J(m, 1,
|
|
530
|
+
const m = 1 + (l.find(
|
|
531
|
+
(y, E) => y.time > h && E > 0 && l[E - 1].isOvershoot
|
|
532
|
+
)?.overshoot || g);
|
|
533
|
+
u = J(m, 1, at(p));
|
|
532
534
|
}
|
|
533
535
|
return {
|
|
534
|
-
x: t.x +
|
|
535
|
-
y: t.y +
|
|
536
|
+
x: t.x + a * u,
|
|
537
|
+
y: t.y + c * u
|
|
536
538
|
};
|
|
537
539
|
}
|
|
538
|
-
function he(
|
|
540
|
+
function he(o, t) {
|
|
539
541
|
const i = [];
|
|
540
542
|
let e = 0.6;
|
|
541
543
|
i.push({ time: e, overshoot: 0, isOvershoot: !1 });
|
|
542
|
-
let
|
|
543
|
-
const r = 0.4 / (
|
|
544
|
-
for (let
|
|
545
|
-
e += r, i.push({ time: e, overshoot:
|
|
544
|
+
let n = 0.15;
|
|
545
|
+
const r = 0.4 / (o * 2);
|
|
546
|
+
for (let a = 0; a < o; a++)
|
|
547
|
+
e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
|
|
546
548
|
return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
|
|
547
549
|
}
|
|
548
|
-
function de(
|
|
549
|
-
const { stiffness:
|
|
550
|
+
function de(o, t, i, e) {
|
|
551
|
+
const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = s / (2 * Math.sqrt(n * r));
|
|
550
552
|
let d;
|
|
551
553
|
if (h < 1) {
|
|
552
|
-
const
|
|
553
|
-
d = 1 -
|
|
554
|
+
const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(g * o * a * Math.PI);
|
|
555
|
+
d = 1 - b * p;
|
|
554
556
|
} else
|
|
555
|
-
d = 1 - Math.exp(-u *
|
|
557
|
+
d = 1 - Math.exp(-u * o * 3);
|
|
556
558
|
return d = Math.max(0, Math.min(d, 1.3)), {
|
|
557
|
-
x: t.x +
|
|
558
|
-
y: t.y +
|
|
559
|
+
x: t.x + c * d,
|
|
560
|
+
y: t.y + l * d
|
|
559
561
|
};
|
|
560
562
|
}
|
|
561
|
-
function ue(
|
|
562
|
-
const { amplitude:
|
|
563
|
+
function ue(o, t, i, e) {
|
|
564
|
+
const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, g = h > 0 ? l / h : 1, b = s * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, a) : 1, f = n * Math.sin(b) * p, m = fe(o);
|
|
563
565
|
return {
|
|
564
|
-
x: J(t.x, i.x, m) +
|
|
565
|
-
y: J(t.y, i.y, m) +
|
|
566
|
+
x: J(t.x, i.x, m) + f * d,
|
|
567
|
+
y: J(t.y, i.y, m) + f * g
|
|
566
568
|
};
|
|
567
569
|
}
|
|
568
|
-
function
|
|
569
|
-
return 1 - (1 -
|
|
570
|
+
function at(o) {
|
|
571
|
+
return 1 - (1 - o) * (1 - o);
|
|
570
572
|
}
|
|
571
|
-
function
|
|
572
|
-
return 1 - Math.pow(1 -
|
|
573
|
+
function fe(o) {
|
|
574
|
+
return 1 - Math.pow(1 - o, 3);
|
|
573
575
|
}
|
|
574
|
-
function
|
|
575
|
-
const { amplitude: e, frequency:
|
|
576
|
-
return t +
|
|
576
|
+
function ge(o, t, i) {
|
|
577
|
+
const { amplitude: e, frequency: n, decay: s } = i, r = Math.sin(o * n * Math.PI * 2), a = s ? Math.pow(1 - o, 2) : 1, c = e * r * a;
|
|
578
|
+
return t + c;
|
|
577
579
|
}
|
|
578
|
-
function me(
|
|
579
|
-
const { overshoot: e, bounces:
|
|
580
|
-
|
|
580
|
+
function me(o, t, i) {
|
|
581
|
+
const { overshoot: e, bounces: n } = i, s = [];
|
|
582
|
+
s.push({ time: 0.5, scale: e });
|
|
581
583
|
let r = e;
|
|
582
|
-
const
|
|
584
|
+
const a = 0.5, l = 0.5 / (n * 2);
|
|
583
585
|
let u = 0.5;
|
|
584
|
-
for (let d = 0; d <
|
|
585
|
-
const
|
|
586
|
-
u +=
|
|
586
|
+
for (let d = 0; d < n; d++) {
|
|
587
|
+
const g = 1 - (r - 1) * a;
|
|
588
|
+
u += l, s.push({ time: u, scale: g }), r = 1 + (r - 1) * a * a, u += l, d < n - 1 && s.push({ time: u, scale: r });
|
|
587
589
|
}
|
|
588
|
-
|
|
590
|
+
s.push({ time: 1, scale: 1 });
|
|
589
591
|
let h = 1;
|
|
590
|
-
for (let d = 0; d <
|
|
591
|
-
if (
|
|
592
|
-
const
|
|
593
|
-
h =
|
|
592
|
+
for (let d = 0; d < s.length; d++)
|
|
593
|
+
if (o <= s[d].time) {
|
|
594
|
+
const g = d === 0 ? 0 : s[d - 1].time, b = d === 0 ? 1 : s[d - 1].scale, p = (o - g) / (s[d].time - g), f = at(p);
|
|
595
|
+
h = b + (s[d].scale - b) * f;
|
|
594
596
|
break;
|
|
595
597
|
}
|
|
596
598
|
return h * t;
|
|
597
599
|
}
|
|
598
|
-
function pe(
|
|
600
|
+
function pe(o) {
|
|
599
601
|
const {
|
|
600
602
|
element: t,
|
|
601
603
|
startPosition: i,
|
|
602
604
|
endPosition: e,
|
|
603
|
-
pathConfig:
|
|
604
|
-
duration:
|
|
605
|
+
pathConfig: n,
|
|
606
|
+
duration: s,
|
|
605
607
|
imageWidth: r,
|
|
606
|
-
imageHeight:
|
|
607
|
-
rotation:
|
|
608
|
-
scale:
|
|
608
|
+
imageHeight: a,
|
|
609
|
+
rotation: c,
|
|
610
|
+
scale: l,
|
|
609
611
|
onComplete: u,
|
|
610
612
|
rotationConfig: h,
|
|
611
613
|
startRotation: d,
|
|
612
|
-
scaleConfig:
|
|
613
|
-
startScale:
|
|
614
|
-
} =
|
|
615
|
-
if ((p === "linear" || p === "arc") && !
|
|
614
|
+
scaleConfig: g,
|
|
615
|
+
startScale: b
|
|
616
|
+
} = o, p = n.type, f = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, E = f || m, v = b !== void 0 && b !== l, S = g?.mode === "pop", w = g?.pop || { overshoot: 1.2, bounces: 1 };
|
|
617
|
+
if ((p === "linear" || p === "arc") && !E && !(v || S)) {
|
|
616
618
|
u && u();
|
|
617
619
|
return;
|
|
618
620
|
}
|
|
619
|
-
const z = performance.now(), L = -r / 2, _ = -
|
|
621
|
+
const z = performance.now(), L = -r / 2, _ = -a / 2;
|
|
620
622
|
function O(H) {
|
|
621
|
-
const N = H - z,
|
|
623
|
+
const N = H - z, C = Math.min(N / s, 1);
|
|
622
624
|
let D;
|
|
623
625
|
switch (p) {
|
|
624
626
|
case "bounce": {
|
|
625
627
|
const k = se(
|
|
626
|
-
|
|
627
|
-
|
|
628
|
+
n.bouncePreset,
|
|
629
|
+
n.bounce
|
|
628
630
|
);
|
|
629
|
-
D = le(
|
|
631
|
+
D = le(C, i, e, k);
|
|
630
632
|
break;
|
|
631
633
|
}
|
|
632
634
|
case "elastic": {
|
|
633
635
|
const k = ae(
|
|
634
|
-
|
|
635
|
-
|
|
636
|
+
n.elasticPreset,
|
|
637
|
+
n.elastic
|
|
636
638
|
);
|
|
637
|
-
D = de(
|
|
639
|
+
D = de(C, i, e, k);
|
|
638
640
|
break;
|
|
639
641
|
}
|
|
640
642
|
case "wave": {
|
|
641
643
|
const k = re(
|
|
642
|
-
|
|
643
|
-
|
|
644
|
+
n.wavePreset,
|
|
645
|
+
n.wave
|
|
644
646
|
);
|
|
645
|
-
D = ue(
|
|
647
|
+
D = ue(C, i, e, k);
|
|
646
648
|
break;
|
|
647
649
|
}
|
|
648
650
|
default:
|
|
649
651
|
D = {
|
|
650
|
-
x: J(i.x, e.x,
|
|
651
|
-
y: J(i.y, e.y,
|
|
652
|
+
x: J(i.x, e.x, C),
|
|
653
|
+
y: J(i.y, e.y, C)
|
|
652
654
|
};
|
|
653
655
|
}
|
|
654
|
-
const
|
|
656
|
+
const W = D.x - e.x, U = D.y - e.y;
|
|
655
657
|
let M;
|
|
656
|
-
m ? M =
|
|
657
|
-
let
|
|
658
|
-
S ?
|
|
658
|
+
m ? M = ge(C, c, y) : f ? M = J(d, c, C) : M = c;
|
|
659
|
+
let R;
|
|
660
|
+
S ? R = me(C, l, w) : v ? R = J(b, l, C) : R = l, t.style.transform = `translate(${L}px, ${_}px) translate(${W}px, ${U}px) rotate(${M}deg) scale(${R})`, C < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
|
|
659
661
|
}
|
|
660
662
|
requestAnimationFrame(O);
|
|
661
663
|
}
|
|
662
|
-
function
|
|
663
|
-
return
|
|
664
|
+
function be(o) {
|
|
665
|
+
return o === "bounce" || o === "elastic" || o === "wave";
|
|
664
666
|
}
|
|
665
|
-
const
|
|
667
|
+
const ye = {
|
|
666
668
|
radial: "center",
|
|
667
669
|
spiral: "center",
|
|
668
670
|
grid: "top",
|
|
@@ -673,83 +675,83 @@ const be = {
|
|
|
673
675
|
};
|
|
674
676
|
class ve {
|
|
675
677
|
constructor(t, i) {
|
|
676
|
-
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path ||
|
|
678
|
+
this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || Et;
|
|
677
679
|
}
|
|
678
680
|
/**
|
|
679
681
|
* Get the effective start position, considering layout-aware defaults
|
|
680
682
|
*/
|
|
681
683
|
resolveStartPosition() {
|
|
682
|
-
return this.config.start.position ? this.config.start.position :
|
|
684
|
+
return this.config.start.position ? this.config.start.position : ye[this.layoutAlgorithm] || "nearest-edge";
|
|
683
685
|
}
|
|
684
686
|
/**
|
|
685
687
|
* Calculate the starting position for an image's entry animation
|
|
686
688
|
*/
|
|
687
|
-
calculateStartPosition(t, i, e,
|
|
688
|
-
const r = this.resolvedStartPosition,
|
|
689
|
+
calculateStartPosition(t, i, e, n, s) {
|
|
690
|
+
const r = this.resolvedStartPosition, a = this.config.start.offset ?? 100;
|
|
689
691
|
switch (r) {
|
|
690
692
|
case "nearest-edge":
|
|
691
|
-
return this.calculateNearestEdge(t, i, e,
|
|
693
|
+
return this.calculateNearestEdge(t, i, e, a);
|
|
692
694
|
case "top":
|
|
693
|
-
return this.calculateEdgePosition("top", t, i, e,
|
|
695
|
+
return this.calculateEdgePosition("top", t, i, e, a);
|
|
694
696
|
case "bottom":
|
|
695
|
-
return this.calculateEdgePosition("bottom", t, i, e,
|
|
697
|
+
return this.calculateEdgePosition("bottom", t, i, e, a);
|
|
696
698
|
case "left":
|
|
697
|
-
return this.calculateEdgePosition("left", t, i, e,
|
|
699
|
+
return this.calculateEdgePosition("left", t, i, e, a);
|
|
698
700
|
case "right":
|
|
699
|
-
return this.calculateEdgePosition("right", t, i, e,
|
|
701
|
+
return this.calculateEdgePosition("right", t, i, e, a);
|
|
700
702
|
case "center":
|
|
701
703
|
return this.calculateCenterPosition(e, t, i);
|
|
702
704
|
case "random-edge":
|
|
703
|
-
return this.calculateRandomEdge(t, i, e,
|
|
705
|
+
return this.calculateRandomEdge(t, i, e, a);
|
|
704
706
|
case "circular":
|
|
705
707
|
return this.calculateCircularPosition(
|
|
706
708
|
t,
|
|
707
709
|
i,
|
|
708
710
|
e,
|
|
709
|
-
|
|
710
|
-
|
|
711
|
+
n,
|
|
712
|
+
s
|
|
711
713
|
);
|
|
712
714
|
default:
|
|
713
|
-
return this.calculateNearestEdge(t, i, e,
|
|
715
|
+
return this.calculateNearestEdge(t, i, e, a);
|
|
714
716
|
}
|
|
715
717
|
}
|
|
716
718
|
/**
|
|
717
719
|
* Calculate start position from the nearest edge (current default behavior)
|
|
718
720
|
*/
|
|
719
|
-
calculateNearestEdge(t, i, e,
|
|
720
|
-
const
|
|
721
|
-
let d = t.x,
|
|
722
|
-
return h ===
|
|
721
|
+
calculateNearestEdge(t, i, e, n) {
|
|
722
|
+
const s = t.x, r = t.y, a = s, c = e.width - s, l = r, u = e.height - r, h = Math.min(a, c, l, u);
|
|
723
|
+
let d = t.x, g = t.y;
|
|
724
|
+
return h === a ? d = -(i.width + n) : h === c ? d = e.width + n : h === l ? g = -(i.height + n) : g = e.height + n, { x: d, y: g };
|
|
723
725
|
}
|
|
724
726
|
/**
|
|
725
727
|
* Calculate start position from a specific edge
|
|
726
728
|
*/
|
|
727
|
-
calculateEdgePosition(t, i, e,
|
|
728
|
-
let r = i.x,
|
|
729
|
+
calculateEdgePosition(t, i, e, n, s) {
|
|
730
|
+
let r = i.x, a = i.y;
|
|
729
731
|
switch (t) {
|
|
730
732
|
case "top":
|
|
731
|
-
|
|
733
|
+
a = -(e.height + s);
|
|
732
734
|
break;
|
|
733
735
|
case "bottom":
|
|
734
|
-
|
|
736
|
+
a = n.height + s;
|
|
735
737
|
break;
|
|
736
738
|
case "left":
|
|
737
|
-
r = -(e.width +
|
|
739
|
+
r = -(e.width + s);
|
|
738
740
|
break;
|
|
739
741
|
case "right":
|
|
740
|
-
r =
|
|
742
|
+
r = n.width + s;
|
|
741
743
|
break;
|
|
742
744
|
}
|
|
743
|
-
return { x: r, y:
|
|
745
|
+
return { x: r, y: a };
|
|
744
746
|
}
|
|
745
747
|
/**
|
|
746
748
|
* Calculate start position from center with scale animation
|
|
747
749
|
*/
|
|
748
750
|
calculateCenterPosition(t, i, e) {
|
|
749
|
-
const
|
|
751
|
+
const n = t.width / 2, s = t.height / 2;
|
|
750
752
|
return {
|
|
751
|
-
x:
|
|
752
|
-
y:
|
|
753
|
+
x: n,
|
|
754
|
+
y: s,
|
|
753
755
|
useScale: !0
|
|
754
756
|
// Signal to use scale animation from 0
|
|
755
757
|
};
|
|
@@ -757,28 +759,28 @@ class ve {
|
|
|
757
759
|
/**
|
|
758
760
|
* Calculate start position from a random edge
|
|
759
761
|
*/
|
|
760
|
-
calculateRandomEdge(t, i, e,
|
|
761
|
-
const
|
|
762
|
-
return this.calculateEdgePosition(r, t, i, e,
|
|
762
|
+
calculateRandomEdge(t, i, e, n) {
|
|
763
|
+
const s = ["top", "bottom", "left", "right"], r = s[Math.floor(Math.random() * s.length)];
|
|
764
|
+
return this.calculateEdgePosition(r, t, i, e, n);
|
|
763
765
|
}
|
|
764
766
|
/**
|
|
765
767
|
* Calculate start position on a circle around the container
|
|
766
768
|
*/
|
|
767
|
-
calculateCircularPosition(t, i, e,
|
|
768
|
-
const r = this.config.start.circular || {},
|
|
769
|
-
let
|
|
770
|
-
const
|
|
771
|
-
if (typeof
|
|
772
|
-
const p = parseFloat(
|
|
773
|
-
|
|
769
|
+
calculateCircularPosition(t, i, e, n, s) {
|
|
770
|
+
const r = this.config.start.circular || {}, a = r.distribution || "even";
|
|
771
|
+
let c;
|
|
772
|
+
const l = r.radius || "120%";
|
|
773
|
+
if (typeof l == "string" && l.endsWith("%")) {
|
|
774
|
+
const p = parseFloat(l) / 100;
|
|
775
|
+
c = Math.sqrt(
|
|
774
776
|
e.width ** 2 + e.height ** 2
|
|
775
777
|
) * p / 2;
|
|
776
778
|
} else
|
|
777
|
-
|
|
779
|
+
c = typeof l == "number" ? l : 500;
|
|
778
780
|
let u;
|
|
779
|
-
|
|
780
|
-
const h = e.width / 2, d = e.height / 2,
|
|
781
|
-
return { x:
|
|
781
|
+
a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
782
|
+
const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
|
|
783
|
+
return { x: g, y: b };
|
|
782
784
|
}
|
|
783
785
|
/**
|
|
784
786
|
* Get animation parameters for an image
|
|
@@ -797,18 +799,18 @@ class ve {
|
|
|
797
799
|
* Build a CSS transform string for the start position
|
|
798
800
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
799
801
|
*/
|
|
800
|
-
buildStartTransform(t, i, e,
|
|
801
|
-
const
|
|
802
|
-
return t.useScale ? `${p} translate(${
|
|
802
|
+
buildStartTransform(t, i, e, n, s, r, a, c) {
|
|
803
|
+
const l = t.x - i.x, u = t.y - i.y, h = a !== void 0 ? a : e, d = c !== void 0 ? c : n, g = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${g}px, ${b}px)` : "translate(-50%, -50%)";
|
|
804
|
+
return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(${d})`;
|
|
803
805
|
}
|
|
804
806
|
/**
|
|
805
807
|
* Build the final CSS transform string
|
|
806
808
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
807
809
|
*/
|
|
808
|
-
buildFinalTransform(t, i, e,
|
|
809
|
-
if (e !== void 0 &&
|
|
810
|
-
const
|
|
811
|
-
return `translate(${
|
|
810
|
+
buildFinalTransform(t, i, e, n) {
|
|
811
|
+
if (e !== void 0 && n !== void 0) {
|
|
812
|
+
const s = -e / 2, r = -n / 2;
|
|
813
|
+
return `translate(${s}px, ${r}px) rotate(${t}deg) scale(${i})`;
|
|
812
814
|
}
|
|
813
815
|
return `translate(-50%, -50%) rotate(${t}deg) scale(${i})`;
|
|
814
816
|
}
|
|
@@ -824,7 +826,7 @@ class ve {
|
|
|
824
826
|
* Check if the current path type requires JavaScript animation
|
|
825
827
|
*/
|
|
826
828
|
requiresJSAnimation() {
|
|
827
|
-
return
|
|
829
|
+
return be(this.pathConfig.type);
|
|
828
830
|
}
|
|
829
831
|
/**
|
|
830
832
|
* Get the path configuration
|
|
@@ -873,12 +875,12 @@ class ve {
|
|
|
873
875
|
return t + (Math.random() - 0.5) * 60;
|
|
874
876
|
if (typeof e == "number")
|
|
875
877
|
return e;
|
|
876
|
-
const
|
|
877
|
-
return e.min + Math.random() *
|
|
878
|
+
const n = e.max - e.min;
|
|
879
|
+
return e.min + Math.random() * n;
|
|
878
880
|
}
|
|
879
881
|
case "spin": {
|
|
880
|
-
const e = this.rotationConfig.spinCount ?? 1,
|
|
881
|
-
return t + e * 360 *
|
|
882
|
+
const e = this.rotationConfig.spinCount ?? 1, n = this.resolveSpinDirection(t);
|
|
883
|
+
return t + e * 360 * n;
|
|
882
884
|
}
|
|
883
885
|
case "random":
|
|
884
886
|
return t + (Math.random() - 0.5) * 60;
|
|
@@ -926,8 +928,8 @@ class ve {
|
|
|
926
928
|
amplitude: 15,
|
|
927
929
|
frequency: 3,
|
|
928
930
|
decay: !0
|
|
929
|
-
}, { amplitude:
|
|
930
|
-
return i +
|
|
931
|
+
}, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, l = n * a * c;
|
|
932
|
+
return i + l;
|
|
931
933
|
}
|
|
932
934
|
/**
|
|
933
935
|
* Get the scale configuration
|
|
@@ -983,15 +985,15 @@ class ve {
|
|
|
983
985
|
const e = this.scaleConfig.pop || {
|
|
984
986
|
overshoot: 1.2,
|
|
985
987
|
bounces: 1
|
|
986
|
-
}, { overshoot:
|
|
987
|
-
let
|
|
988
|
-
for (let
|
|
989
|
-
if (t <= r[
|
|
990
|
-
const
|
|
991
|
-
|
|
988
|
+
}, { overshoot: n, bounces: s } = e, r = this.generateScaleBounceKeyframes(s, n);
|
|
989
|
+
let a = i;
|
|
990
|
+
for (let c = 0; c < r.length; c++)
|
|
991
|
+
if (t <= r[c].time) {
|
|
992
|
+
const l = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, h = (t - l) / (r[c].time - l), d = this.easeOutQuad(h);
|
|
993
|
+
a = u + (r[c].scale - u) * d;
|
|
992
994
|
break;
|
|
993
995
|
}
|
|
994
|
-
return
|
|
996
|
+
return a * i;
|
|
995
997
|
}
|
|
996
998
|
/**
|
|
997
999
|
* Generate keyframes for scale bounce animation
|
|
@@ -999,12 +1001,12 @@ class ve {
|
|
|
999
1001
|
generateScaleBounceKeyframes(t, i) {
|
|
1000
1002
|
const e = [];
|
|
1001
1003
|
e.push({ time: 0.5, scale: i });
|
|
1002
|
-
let
|
|
1003
|
-
const
|
|
1004
|
-
let
|
|
1005
|
-
for (let
|
|
1006
|
-
const u = 1 - (
|
|
1007
|
-
|
|
1004
|
+
let n = i;
|
|
1005
|
+
const s = 0.5, a = 0.5 / (t * 2);
|
|
1006
|
+
let c = 0.5;
|
|
1007
|
+
for (let l = 0; l < t; l++) {
|
|
1008
|
+
const u = 1 - (n - 1) * s;
|
|
1009
|
+
c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, l < t - 1 && e.push({ time: c, scale: n });
|
|
1008
1010
|
}
|
|
1009
1011
|
return e.push({ time: 1, scale: 1 }), e;
|
|
1010
1012
|
}
|
|
@@ -1015,7 +1017,7 @@ class ve {
|
|
|
1015
1017
|
return 1 - (1 - t) * (1 - t);
|
|
1016
1018
|
}
|
|
1017
1019
|
}
|
|
1018
|
-
class
|
|
1020
|
+
class Ee {
|
|
1019
1021
|
constructor(t, i = 600) {
|
|
1020
1022
|
this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
|
|
1021
1023
|
}
|
|
@@ -1023,9 +1025,9 @@ class we {
|
|
|
1023
1025
|
* Register an image element for idle animation.
|
|
1024
1026
|
* Starts animation after entry duration completes.
|
|
1025
1027
|
*/
|
|
1026
|
-
register(t, i, e,
|
|
1028
|
+
register(t, i, e, n) {
|
|
1027
1029
|
if (this.entries.has(t)) return;
|
|
1028
|
-
const
|
|
1030
|
+
const s = n ?? this.entryDurationMs, r = this.config.startDelay ?? s, a = {
|
|
1029
1031
|
element: t,
|
|
1030
1032
|
index: i,
|
|
1031
1033
|
totalImages: e,
|
|
@@ -1036,8 +1038,8 @@ class we {
|
|
|
1036
1038
|
stopped: !1,
|
|
1037
1039
|
startTimer: null
|
|
1038
1040
|
};
|
|
1039
|
-
this.entries.set(t,
|
|
1040
|
-
|
|
1041
|
+
this.entries.set(t, a), a.startTimer = setTimeout(() => {
|
|
1042
|
+
a.startTimer = null, !a.stopped && !a.paused && this._startAnimation(a);
|
|
1041
1043
|
}, r);
|
|
1042
1044
|
}
|
|
1043
1045
|
/**
|
|
@@ -1140,28 +1142,28 @@ class we {
|
|
|
1140
1142
|
});
|
|
1141
1143
|
}
|
|
1142
1144
|
_startBlink(t) {
|
|
1143
|
-
const i = { ...Zt, ...this.config.blink }, e = -(Math.random() * i.speed),
|
|
1144
|
-
let
|
|
1145
|
-
i.style === "fade" ? (
|
|
1146
|
-
{ opacity:
|
|
1145
|
+
const i = { ...Zt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
|
|
1146
|
+
let s, r;
|
|
1147
|
+
i.style === "fade" ? (s = [
|
|
1148
|
+
{ opacity: n, offset: 0 },
|
|
1147
1149
|
{ opacity: 0, offset: 0.5 },
|
|
1148
|
-
{ opacity:
|
|
1150
|
+
{ opacity: n, offset: 1 }
|
|
1149
1151
|
], r = {
|
|
1150
1152
|
duration: i.speed,
|
|
1151
1153
|
delay: e,
|
|
1152
1154
|
iterations: 1 / 0,
|
|
1153
1155
|
easing: "ease-in-out"
|
|
1154
|
-
}) : (
|
|
1155
|
-
{ opacity:
|
|
1156
|
-
{ opacity:
|
|
1156
|
+
}) : (s = [
|
|
1157
|
+
{ opacity: n, offset: 0 },
|
|
1158
|
+
{ opacity: n, offset: i.onRatio },
|
|
1157
1159
|
{ opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
|
|
1158
1160
|
{ opacity: 0, offset: 0.99 },
|
|
1159
|
-
{ opacity:
|
|
1161
|
+
{ opacity: n, offset: 1 }
|
|
1160
1162
|
], r = {
|
|
1161
1163
|
duration: i.speed,
|
|
1162
1164
|
delay: e,
|
|
1163
1165
|
iterations: 1 / 0
|
|
1164
|
-
}), t.blinkAnimation = t.element.animate(
|
|
1166
|
+
}), t.blinkAnimation = t.element.animate(s, r);
|
|
1165
1167
|
}
|
|
1166
1168
|
_startSpin(t) {
|
|
1167
1169
|
const i = { ...Qt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
|
|
@@ -1185,8 +1187,8 @@ class we {
|
|
|
1185
1187
|
if (this.togetherSpeed = t, this.togetherRafId !== null) return;
|
|
1186
1188
|
const i = () => {
|
|
1187
1189
|
const e = performance.now() % this.togetherSpeed;
|
|
1188
|
-
for (const
|
|
1189
|
-
!
|
|
1190
|
+
for (const n of this.entries.values())
|
|
1191
|
+
!n.stopped && !n.paused && n.animation && (n.animation.currentTime = e);
|
|
1190
1192
|
this.togetherRafId = requestAnimationFrame(i);
|
|
1191
1193
|
};
|
|
1192
1194
|
this.togetherRafId = requestAnimationFrame(i);
|
|
@@ -1201,7 +1203,7 @@ class we {
|
|
|
1201
1203
|
t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
|
|
1202
1204
|
}
|
|
1203
1205
|
}
|
|
1204
|
-
class
|
|
1206
|
+
class we {
|
|
1205
1207
|
constructor(t, i = {}) {
|
|
1206
1208
|
this.config = t, this.imageConfig = i;
|
|
1207
1209
|
}
|
|
@@ -1213,19 +1215,19 @@ class xe {
|
|
|
1213
1215
|
* @returns Array of layout objects with position, rotation, scale
|
|
1214
1216
|
*/
|
|
1215
1217
|
generate(t, i, e = {}) {
|
|
1216
|
-
const
|
|
1217
|
-
for (let
|
|
1218
|
-
const I = this.random(v,
|
|
1219
|
-
id:
|
|
1218
|
+
const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, f = c * 1.5 / 2, m = c / 2, y = s - a - f, E = r - a - m, v = a + f, S = a + m;
|
|
1219
|
+
for (let w = 0; w < t; w++) {
|
|
1220
|
+
const I = this.random(v, y), z = this.random(S, E), L = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, g) : 1, O = c * _, H = {
|
|
1221
|
+
id: w,
|
|
1220
1222
|
x: I,
|
|
1221
1223
|
y: z,
|
|
1222
1224
|
rotation: L,
|
|
1223
1225
|
scale: _,
|
|
1224
1226
|
baseSize: O
|
|
1225
1227
|
};
|
|
1226
|
-
|
|
1228
|
+
n.push(H);
|
|
1227
1229
|
}
|
|
1228
|
-
return
|
|
1230
|
+
return n;
|
|
1229
1231
|
}
|
|
1230
1232
|
/**
|
|
1231
1233
|
* Utility: Generate random number between min and max
|
|
@@ -1237,7 +1239,7 @@ class xe {
|
|
|
1237
1239
|
return Math.random() * (i - t) + t;
|
|
1238
1240
|
}
|
|
1239
1241
|
}
|
|
1240
|
-
class
|
|
1242
|
+
class xe {
|
|
1241
1243
|
constructor(t, i = {}) {
|
|
1242
1244
|
this.config = t, this.imageConfig = i;
|
|
1243
1245
|
}
|
|
@@ -1249,20 +1251,20 @@ class Ee {
|
|
|
1249
1251
|
* @returns Array of layout objects with position, rotation, scale
|
|
1250
1252
|
*/
|
|
1251
1253
|
generate(t, i, e = {}) {
|
|
1252
|
-
const
|
|
1253
|
-
...
|
|
1254
|
+
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
|
|
1255
|
+
...Wt,
|
|
1254
1256
|
...this.config.radial
|
|
1255
|
-
},
|
|
1256
|
-
m - v -
|
|
1257
|
-
|
|
1257
|
+
}, f = e.fixedHeight ?? a, m = s / 2, y = r / 2, E = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, S = Math.max(f * 0.8, Math.min(
|
|
1258
|
+
m - v - f / 2,
|
|
1259
|
+
y - v - f / 2
|
|
1258
1260
|
));
|
|
1259
1261
|
if (t > 0) {
|
|
1260
|
-
const z =
|
|
1261
|
-
|
|
1262
|
+
const z = g ? this.random(h, d) : 1, L = f * z;
|
|
1263
|
+
n.push({
|
|
1262
1264
|
id: 0,
|
|
1263
1265
|
x: m,
|
|
1264
|
-
y
|
|
1265
|
-
rotation:
|
|
1266
|
+
y,
|
|
1267
|
+
rotation: c === "random" ? this.random(l * 0.33, u * 0.33) : 0,
|
|
1266
1268
|
// Less rotation for center
|
|
1267
1269
|
scale: z,
|
|
1268
1270
|
baseSize: L,
|
|
@@ -1270,34 +1272,34 @@ class Ee {
|
|
|
1270
1272
|
// Center image is highest
|
|
1271
1273
|
});
|
|
1272
1274
|
}
|
|
1273
|
-
let
|
|
1274
|
-
for (;
|
|
1275
|
-
const z = I /
|
|
1275
|
+
let w = 1, I = 1;
|
|
1276
|
+
for (; w < t; ) {
|
|
1277
|
+
const z = I / E, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(f * 0.8, S / E * 1.5 / p.tightness), O = I * _, H = O * 1.5, N = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), C = this.estimateWidth(f), D = Math.floor(N / (C * 0.7));
|
|
1276
1278
|
if (D === 0) {
|
|
1277
1279
|
I++;
|
|
1278
1280
|
continue;
|
|
1279
1281
|
}
|
|
1280
|
-
const
|
|
1281
|
-
for (let M = 0; M < D &&
|
|
1282
|
-
const
|
|
1283
|
-
let $ = m + Math.cos(
|
|
1284
|
-
const P =
|
|
1285
|
-
$ - P < v ? $ = v + P : $ + P >
|
|
1286
|
-
const Y =
|
|
1287
|
-
|
|
1288
|
-
id:
|
|
1282
|
+
const W = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
|
|
1283
|
+
for (let M = 0; M < D && w < t; M++) {
|
|
1284
|
+
const R = M * W + U, k = g ? this.random(h, d) : 1, q = L * k, T = f * q;
|
|
1285
|
+
let $ = m + Math.cos(R) * H, F = y + Math.sin(R) * O;
|
|
1286
|
+
const P = T * 1.5 / 2, B = T / 2;
|
|
1287
|
+
$ - P < v ? $ = v + P : $ + P > s - v && ($ = s - v - P), F - B < v ? F = v + B : F + B > r - v && (F = r - v - B);
|
|
1288
|
+
const Y = c === "random" ? this.random(l, u) : 0;
|
|
1289
|
+
n.push({
|
|
1290
|
+
id: w,
|
|
1289
1291
|
x: $,
|
|
1290
1292
|
y: F,
|
|
1291
1293
|
rotation: Y,
|
|
1292
|
-
scale:
|
|
1293
|
-
baseSize:
|
|
1294
|
+
scale: q,
|
|
1295
|
+
baseSize: T,
|
|
1294
1296
|
zIndex: Math.max(1, 100 - I)
|
|
1295
1297
|
// Outer rings have lower z-index
|
|
1296
|
-
}),
|
|
1298
|
+
}), w++;
|
|
1297
1299
|
}
|
|
1298
1300
|
I++;
|
|
1299
1301
|
}
|
|
1300
|
-
return
|
|
1302
|
+
return n;
|
|
1301
1303
|
}
|
|
1302
1304
|
/**
|
|
1303
1305
|
* Estimate image width based on height
|
|
@@ -1328,7 +1330,7 @@ const Se = {
|
|
|
1328
1330
|
alignment: "center",
|
|
1329
1331
|
gap: 10,
|
|
1330
1332
|
overflowOffset: 0.25
|
|
1331
|
-
},
|
|
1333
|
+
}, Tt = [
|
|
1332
1334
|
{ x: 1, y: 1 },
|
|
1333
1335
|
// bottom-right
|
|
1334
1336
|
{ x: -1, y: -1 },
|
|
@@ -1358,86 +1360,86 @@ class Ie {
|
|
|
1358
1360
|
* @returns Array of layout objects with position, rotation, scale
|
|
1359
1361
|
*/
|
|
1360
1362
|
generate(t, i, e = {}) {
|
|
1361
|
-
const
|
|
1363
|
+
const n = [], { width: s, height: r } = i, a = { ...Se, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = s - 2 * c, p = r - 2 * c, { columns: f, rows: m } = this.calculateGridDimensions(
|
|
1362
1364
|
t,
|
|
1363
|
-
|
|
1365
|
+
b,
|
|
1364
1366
|
p,
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
),
|
|
1367
|
+
l,
|
|
1368
|
+
a
|
|
1369
|
+
), y = a.stagger === "row", E = a.stagger === "column", v = y ? f + 0.5 : f, S = E ? m + 0.5 : m, w = (b - a.gap * (f - 1)) / v, I = (p - a.gap * (m - 1)) / S, z = y ? w / 2 : 0, L = E ? I / 2 : 0, _ = 1 + a.overlap, O = Math.min(w, I) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, N = f * w + (f - 1) * a.gap + z, C = m * I + (m - 1) * a.gap + L, D = c + (b - N) / 2, W = c + (p - C) / 2, U = f * m, M = a.columns !== "auto" && a.rows !== "auto", R = M && t > U;
|
|
1368
1370
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1369
|
-
gridConfigColumns:
|
|
1370
|
-
gridConfigRows:
|
|
1371
|
-
columns:
|
|
1371
|
+
gridConfigColumns: a.columns,
|
|
1372
|
+
gridConfigRows: a.rows,
|
|
1373
|
+
columns: f,
|
|
1372
1374
|
rows: m,
|
|
1373
1375
|
cellCount: U,
|
|
1374
1376
|
hasFixedGrid: M,
|
|
1375
1377
|
imageCount: t,
|
|
1376
|
-
isOverflowMode:
|
|
1378
|
+
isOverflowMode: R
|
|
1377
1379
|
});
|
|
1378
|
-
const k =
|
|
1379
|
-
for (let
|
|
1380
|
+
const k = R ? new Array(U).fill(0) : [], q = Math.min(w, I) * a.overflowOffset;
|
|
1381
|
+
for (let T = 0; T < t; T++) {
|
|
1380
1382
|
let $, F, X = 0;
|
|
1381
|
-
if (
|
|
1382
|
-
const
|
|
1383
|
-
X = Math.floor(
|
|
1383
|
+
if (R && T >= U) {
|
|
1384
|
+
const G = T - U, j = G % U;
|
|
1385
|
+
X = Math.floor(G / U) + 1, k[j]++, a.fillDirection === "row" ? ($ = j % f, F = Math.floor(j / f)) : (F = j % m, $ = Math.floor(j / m));
|
|
1384
1386
|
} else
|
|
1385
|
-
|
|
1386
|
-
let P = D + $ * (
|
|
1387
|
-
if (
|
|
1388
|
-
const
|
|
1389
|
-
P +=
|
|
1387
|
+
a.fillDirection === "row" ? ($ = T % f, F = Math.floor(T / f)) : (F = T % m, $ = Math.floor(T / m));
|
|
1388
|
+
let P = D + $ * (w + a.gap) + w / 2, B = W + F * (I + a.gap) + I / 2;
|
|
1389
|
+
if (a.stagger === "row" && F % 2 === 1 ? P += w / 2 : a.stagger === "column" && $ % 2 === 1 && (B += I / 2), X > 0) {
|
|
1390
|
+
const G = (X - 1) % Tt.length, j = Tt[G];
|
|
1391
|
+
P += j.x * q, B += j.y * q;
|
|
1390
1392
|
}
|
|
1391
|
-
if (
|
|
1392
|
-
const
|
|
1393
|
-
P += this.random(-
|
|
1393
|
+
if (a.jitter > 0) {
|
|
1394
|
+
const G = w / 2 * a.jitter, j = I / 2 * a.jitter;
|
|
1395
|
+
P += this.random(-G, G), B += this.random(-j, j);
|
|
1394
1396
|
}
|
|
1395
|
-
let Y = P, V =
|
|
1396
|
-
if (!
|
|
1397
|
-
const
|
|
1398
|
-
if (F === Math.floor((t - 1) /
|
|
1399
|
-
const St =
|
|
1397
|
+
let Y = P, V = B;
|
|
1398
|
+
if (!R && a.fillDirection === "row") {
|
|
1399
|
+
const G = t % f || f;
|
|
1400
|
+
if (F === Math.floor((t - 1) / f) && G < f) {
|
|
1401
|
+
const St = G * w + (G - 1) * a.gap;
|
|
1400
1402
|
let gt = 0;
|
|
1401
|
-
|
|
1403
|
+
a.alignment === "center" ? gt = (N - St) / 2 : a.alignment === "end" && (gt = N - St), Y += gt;
|
|
1402
1404
|
}
|
|
1403
1405
|
}
|
|
1404
|
-
const
|
|
1405
|
-
Y = Math.max(
|
|
1406
|
-
let
|
|
1406
|
+
const ct = g ? this.random(h, d) : 1, K = H * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, _t = c + ot, Ut = r - c - ot;
|
|
1407
|
+
Y = Math.max(ht, Math.min(Y, dt)), V = Math.max(_t, Math.min(V, Ut));
|
|
1408
|
+
let ut = 0;
|
|
1407
1409
|
if (u === "random") {
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
+
const G = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
|
|
1411
|
+
a.jitter > 0 ? ut = this.random(G * a.jitter, j * a.jitter) : ut = this.random(G, j);
|
|
1410
1412
|
}
|
|
1411
|
-
let
|
|
1412
|
-
|
|
1413
|
-
id:
|
|
1413
|
+
let ft;
|
|
1414
|
+
R && X > 0 ? ft = 50 - X : ft = R ? 100 + T : T + 1, n.push({
|
|
1415
|
+
id: T,
|
|
1414
1416
|
x: Y,
|
|
1415
1417
|
y: V,
|
|
1416
|
-
rotation:
|
|
1417
|
-
scale:
|
|
1418
|
+
rotation: ut,
|
|
1419
|
+
scale: ct,
|
|
1418
1420
|
baseSize: K,
|
|
1419
|
-
zIndex:
|
|
1421
|
+
zIndex: ft
|
|
1420
1422
|
});
|
|
1421
1423
|
}
|
|
1422
|
-
return
|
|
1424
|
+
return n;
|
|
1423
1425
|
}
|
|
1424
1426
|
/**
|
|
1425
1427
|
* Calculate optimal grid dimensions based on image count and container
|
|
1426
1428
|
*/
|
|
1427
|
-
calculateGridDimensions(t, i, e,
|
|
1428
|
-
let r,
|
|
1429
|
-
if (
|
|
1430
|
-
r =
|
|
1431
|
-
else if (
|
|
1432
|
-
r =
|
|
1433
|
-
else if (
|
|
1434
|
-
|
|
1429
|
+
calculateGridDimensions(t, i, e, n, s) {
|
|
1430
|
+
let r, a;
|
|
1431
|
+
if (s.columns !== "auto" && s.rows !== "auto")
|
|
1432
|
+
r = s.columns, a = s.rows;
|
|
1433
|
+
else if (s.columns !== "auto")
|
|
1434
|
+
r = s.columns, a = Math.ceil(t / r);
|
|
1435
|
+
else if (s.rows !== "auto")
|
|
1436
|
+
a = s.rows, r = Math.ceil(t / a);
|
|
1435
1437
|
else {
|
|
1436
|
-
const
|
|
1437
|
-
for (r = Math.max(1, Math.round(Math.sqrt(t *
|
|
1438
|
+
const c = i / e;
|
|
1439
|
+
for (r = Math.max(1, Math.round(Math.sqrt(t * c / 1.4))), a = Math.ceil(t / r); r > 1 && (r - 1) * a >= t; )
|
|
1438
1440
|
r--;
|
|
1439
1441
|
}
|
|
1440
|
-
return { columns: Math.max(1, r), rows: Math.max(1,
|
|
1442
|
+
return { columns: Math.max(1, r), rows: Math.max(1, a) };
|
|
1441
1443
|
}
|
|
1442
1444
|
/**
|
|
1443
1445
|
* Utility: Generate random number between min and max
|
|
@@ -1446,14 +1448,14 @@ class Ie {
|
|
|
1446
1448
|
return Math.random() * (i - t) + t;
|
|
1447
1449
|
}
|
|
1448
1450
|
}
|
|
1449
|
-
const
|
|
1451
|
+
const Ae = Math.PI * (3 - Math.sqrt(5)), Ce = {
|
|
1450
1452
|
spiralType: "golden",
|
|
1451
1453
|
direction: "counterclockwise",
|
|
1452
1454
|
tightness: 1,
|
|
1453
1455
|
scaleDecay: 0,
|
|
1454
1456
|
startAngle: 0
|
|
1455
1457
|
};
|
|
1456
|
-
class
|
|
1458
|
+
class Re {
|
|
1457
1459
|
constructor(t, i = {}) {
|
|
1458
1460
|
this.config = t, this.imageConfig = i;
|
|
1459
1461
|
}
|
|
@@ -1465,80 +1467,80 @@ class Ae {
|
|
|
1465
1467
|
* @returns Array of layout objects with position, rotation, scale
|
|
1466
1468
|
*/
|
|
1467
1469
|
generate(t, i, e = {}) {
|
|
1468
|
-
const
|
|
1469
|
-
m -
|
|
1470
|
-
|
|
1471
|
-
), v =
|
|
1470
|
+
const n = [], { width: s, height: r } = i, a = { ...Ce, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, y = r / 2, E = Math.min(
|
|
1471
|
+
m - c - l / 2,
|
|
1472
|
+
y - c - l / 2
|
|
1473
|
+
), v = a.direction === "clockwise" ? -1 : 1;
|
|
1472
1474
|
for (let S = 0; S < t; S++) {
|
|
1473
|
-
let
|
|
1474
|
-
if (
|
|
1475
|
-
|
|
1476
|
-
else if (
|
|
1477
|
-
const P = S * 0.5 *
|
|
1478
|
-
|
|
1475
|
+
let w, I;
|
|
1476
|
+
if (a.spiralType === "golden")
|
|
1477
|
+
w = S * Ae * v + a.startAngle, I = this.calculateGoldenRadius(S, t, E, a.tightness);
|
|
1478
|
+
else if (a.spiralType === "archimedean") {
|
|
1479
|
+
const P = S * 0.5 * a.tightness;
|
|
1480
|
+
w = P * v + a.startAngle, I = this.calculateArchimedeanRadius(P, t, E, a.tightness);
|
|
1479
1481
|
} else {
|
|
1480
|
-
const P = S * 0.3 *
|
|
1481
|
-
|
|
1482
|
+
const P = S * 0.3 * a.tightness;
|
|
1483
|
+
w = P * v + a.startAngle, I = this.calculateLogarithmicRadius(P, t, E, a.tightness);
|
|
1482
1484
|
}
|
|
1483
|
-
const z = m + Math.cos(
|
|
1485
|
+
const z = m + Math.cos(w) * I, L = y + Math.sin(w) * I, _ = I / E, O = f > 0 ? 1 - _ * f * 0.5 : 1, H = p ? this.random(g, b) : 1, N = O * H, C = l * N, W = C * 1.5 / 2, U = C / 2, M = c + W, R = s - c - W, k = c + U, q = r - c - U, T = Math.max(M, Math.min(z, R)), $ = Math.max(k, Math.min(L, q));
|
|
1484
1486
|
let F = 0;
|
|
1485
1487
|
if (u === "random") {
|
|
1486
|
-
const P =
|
|
1487
|
-
F =
|
|
1488
|
-
} else u === "tangent" && (F = this.calculateSpiralTangent(
|
|
1488
|
+
const P = w * 180 / Math.PI % 360, B = this.random(h, d);
|
|
1489
|
+
F = a.spiralType === "golden" ? B : P * 0.1 + B * 0.9;
|
|
1490
|
+
} else u === "tangent" && (F = this.calculateSpiralTangent(w, I, a));
|
|
1489
1491
|
const X = t - S;
|
|
1490
|
-
|
|
1492
|
+
n.push({
|
|
1491
1493
|
id: S,
|
|
1492
|
-
x:
|
|
1494
|
+
x: T,
|
|
1493
1495
|
y: $,
|
|
1494
1496
|
rotation: F,
|
|
1495
1497
|
scale: N,
|
|
1496
|
-
baseSize:
|
|
1498
|
+
baseSize: C,
|
|
1497
1499
|
zIndex: X
|
|
1498
1500
|
});
|
|
1499
1501
|
}
|
|
1500
|
-
return
|
|
1502
|
+
return n;
|
|
1501
1503
|
}
|
|
1502
1504
|
/**
|
|
1503
1505
|
* Calculate tangent angle for spiral curve at given position
|
|
1504
1506
|
* This aligns the image along the spiral's direction of travel
|
|
1505
1507
|
*/
|
|
1506
1508
|
calculateSpiralTangent(t, i, e) {
|
|
1507
|
-
let
|
|
1509
|
+
let n;
|
|
1508
1510
|
if (e.spiralType === "golden")
|
|
1509
|
-
|
|
1511
|
+
n = t + Math.PI / 2;
|
|
1510
1512
|
else if (e.spiralType === "archimedean") {
|
|
1511
|
-
const r = 1 / e.tightness,
|
|
1512
|
-
|
|
1513
|
+
const r = 1 / e.tightness, a = Math.atan(i / r);
|
|
1514
|
+
n = t + a;
|
|
1513
1515
|
} else {
|
|
1514
|
-
const r = 0.15 / e.tightness,
|
|
1515
|
-
|
|
1516
|
+
const r = 0.15 / e.tightness, a = Math.atan(1 / r);
|
|
1517
|
+
n = t + a;
|
|
1516
1518
|
}
|
|
1517
|
-
return
|
|
1519
|
+
return n * 180 / Math.PI % 360 - 90;
|
|
1518
1520
|
}
|
|
1519
1521
|
/**
|
|
1520
1522
|
* Calculate radius for golden spiral (Vogel's model)
|
|
1521
1523
|
* Creates even distribution like sunflower seeds
|
|
1522
1524
|
*/
|
|
1523
|
-
calculateGoldenRadius(t, i, e,
|
|
1524
|
-
const r = e / Math.sqrt(i) * Math.sqrt(t) /
|
|
1525
|
+
calculateGoldenRadius(t, i, e, n) {
|
|
1526
|
+
const r = e / Math.sqrt(i) * Math.sqrt(t) / n;
|
|
1525
1527
|
return Math.min(r, e);
|
|
1526
1528
|
}
|
|
1527
1529
|
/**
|
|
1528
1530
|
* Calculate radius for Archimedean spiral
|
|
1529
1531
|
* r = a + b*θ (constant spacing between arms)
|
|
1530
1532
|
*/
|
|
1531
|
-
calculateArchimedeanRadius(t, i, e,
|
|
1532
|
-
const
|
|
1533
|
-
return t /
|
|
1533
|
+
calculateArchimedeanRadius(t, i, e, n) {
|
|
1534
|
+
const s = i * 0.5 * n;
|
|
1535
|
+
return t / s * e;
|
|
1534
1536
|
}
|
|
1535
1537
|
/**
|
|
1536
1538
|
* Calculate radius for logarithmic (equiangular) spiral
|
|
1537
1539
|
* r = a * e^(b*θ)
|
|
1538
1540
|
*/
|
|
1539
|
-
calculateLogarithmicRadius(t, i, e,
|
|
1540
|
-
const
|
|
1541
|
-
return
|
|
1541
|
+
calculateLogarithmicRadius(t, i, e, n) {
|
|
1542
|
+
const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, l = s * Math.exp(r * c);
|
|
1543
|
+
return a / l * e;
|
|
1542
1544
|
}
|
|
1543
1545
|
/**
|
|
1544
1546
|
* Utility: Generate random number between min and max
|
|
@@ -1547,7 +1549,7 @@ class Ae {
|
|
|
1547
1549
|
return Math.random() * (i - t) + t;
|
|
1548
1550
|
}
|
|
1549
1551
|
}
|
|
1550
|
-
const
|
|
1552
|
+
const Te = {
|
|
1551
1553
|
clusterCount: "auto",
|
|
1552
1554
|
clusterSpread: 150,
|
|
1553
1555
|
clusterSpacing: 200,
|
|
@@ -1567,85 +1569,85 @@ class Le {
|
|
|
1567
1569
|
* @returns Array of layout objects with position, rotation, scale
|
|
1568
1570
|
*/
|
|
1569
1571
|
generate(t, i, e = {}) {
|
|
1570
|
-
const
|
|
1572
|
+
const n = [], { width: s, height: r } = i, a = { ...Te, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.calculateClusterCount(
|
|
1571
1573
|
t,
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
+
a.clusterCount,
|
|
1575
|
+
s,
|
|
1574
1576
|
r,
|
|
1575
|
-
|
|
1577
|
+
a.clusterSpacing
|
|
1576
1578
|
), m = this.generateClusterCenters(
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
+
f,
|
|
1580
|
+
s,
|
|
1579
1581
|
r,
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
),
|
|
1582
|
+
c,
|
|
1583
|
+
a
|
|
1584
|
+
), y = new Array(f).fill(0);
|
|
1583
1585
|
for (let v = 0; v < t; v++)
|
|
1584
|
-
|
|
1585
|
-
let
|
|
1586
|
-
for (let v = 0; v <
|
|
1587
|
-
const S = m[v],
|
|
1588
|
-
for (let I = 0; I <
|
|
1586
|
+
y[v % f]++;
|
|
1587
|
+
let E = 0;
|
|
1588
|
+
for (let v = 0; v < f; v++) {
|
|
1589
|
+
const S = m[v], w = y[v];
|
|
1590
|
+
for (let I = 0; I < w; I++) {
|
|
1589
1591
|
let z, L;
|
|
1590
|
-
if (
|
|
1592
|
+
if (a.distribution === "gaussian")
|
|
1591
1593
|
z = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
|
|
1592
1594
|
else {
|
|
1593
1595
|
const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
|
|
1594
1596
|
z = Math.cos(F) * X, L = Math.sin(F) * X;
|
|
1595
1597
|
}
|
|
1596
|
-
const _ = 1 +
|
|
1598
|
+
const _ = 1 + a.overlap * 0.5, O = 1 + a.overlap * 0.3;
|
|
1597
1599
|
z /= _, L /= _;
|
|
1598
|
-
const H = p ? this.random(
|
|
1599
|
-
let D = S.x + z,
|
|
1600
|
-
const M =
|
|
1601
|
-
D = Math.max(
|
|
1602
|
-
const k = u === "random" ? this.random(h, d) : 0,
|
|
1603
|
-
|
|
1604
|
-
id:
|
|
1600
|
+
const H = p ? this.random(g, b) : 1, N = O * H, C = l * N;
|
|
1601
|
+
let D = S.x + z, W = S.y + L;
|
|
1602
|
+
const M = C * 1.5 / 2, R = C / 2;
|
|
1603
|
+
D = Math.max(c + M, Math.min(D, s - c - M)), W = Math.max(c + R, Math.min(W, r - c - R));
|
|
1604
|
+
const k = u === "random" ? this.random(h, d) : 0, T = Math.sqrt(z * z + L * L) / S.spread, $ = Math.round((1 - T) * 50) + 1;
|
|
1605
|
+
n.push({
|
|
1606
|
+
id: E,
|
|
1605
1607
|
x: D,
|
|
1606
|
-
y:
|
|
1608
|
+
y: W,
|
|
1607
1609
|
rotation: k,
|
|
1608
1610
|
scale: N,
|
|
1609
|
-
baseSize:
|
|
1611
|
+
baseSize: C,
|
|
1610
1612
|
zIndex: $
|
|
1611
|
-
}),
|
|
1613
|
+
}), E++;
|
|
1612
1614
|
}
|
|
1613
1615
|
}
|
|
1614
|
-
return
|
|
1616
|
+
return n;
|
|
1615
1617
|
}
|
|
1616
1618
|
/**
|
|
1617
1619
|
* Calculate optimal number of clusters based on image count and container
|
|
1618
1620
|
*/
|
|
1619
|
-
calculateClusterCount(t, i, e,
|
|
1621
|
+
calculateClusterCount(t, i, e, n, s) {
|
|
1620
1622
|
if (i !== "auto")
|
|
1621
1623
|
return Math.max(1, Math.min(i, t));
|
|
1622
|
-
const
|
|
1623
|
-
e /
|
|
1624
|
+
const a = Math.max(1, Math.ceil(t / 8)), c = Math.floor(
|
|
1625
|
+
e / s * (n / s) * 0.6
|
|
1624
1626
|
);
|
|
1625
|
-
return Math.max(1, Math.min(
|
|
1627
|
+
return Math.max(1, Math.min(a, c, 10));
|
|
1626
1628
|
}
|
|
1627
1629
|
/**
|
|
1628
1630
|
* Generate cluster center positions with spacing constraints
|
|
1629
1631
|
*/
|
|
1630
|
-
generateClusterCenters(t, i, e,
|
|
1631
|
-
const r = [],
|
|
1632
|
+
generateClusterCenters(t, i, e, n, s) {
|
|
1633
|
+
const r = [], c = n + s.clusterSpread, l = i - n - s.clusterSpread, u = n + s.clusterSpread, h = e - n - s.clusterSpread;
|
|
1632
1634
|
for (let d = 0; d < t; d++) {
|
|
1633
|
-
let
|
|
1635
|
+
let g = null, b = -1;
|
|
1634
1636
|
for (let p = 0; p < 100; p++) {
|
|
1635
|
-
const
|
|
1636
|
-
x: this.random(
|
|
1637
|
+
const f = {
|
|
1638
|
+
x: this.random(c, l),
|
|
1637
1639
|
y: this.random(u, h),
|
|
1638
|
-
spread: this.calculateClusterSpread(
|
|
1640
|
+
spread: this.calculateClusterSpread(s)
|
|
1639
1641
|
};
|
|
1640
1642
|
let m = 1 / 0;
|
|
1641
|
-
for (const
|
|
1642
|
-
const
|
|
1643
|
+
for (const y of r) {
|
|
1644
|
+
const E = f.x - y.x, v = f.y - y.y, S = Math.sqrt(E * E + v * v);
|
|
1643
1645
|
m = Math.min(m, S);
|
|
1644
1646
|
}
|
|
1645
|
-
if ((r.length === 0 || m >
|
|
1647
|
+
if ((r.length === 0 || m > b) && (g = f, b = m), m >= s.clusterSpacing)
|
|
1646
1648
|
break;
|
|
1647
1649
|
}
|
|
1648
|
-
|
|
1650
|
+
g && r.push(g);
|
|
1649
1651
|
}
|
|
1650
1652
|
return r;
|
|
1651
1653
|
}
|
|
@@ -1685,32 +1687,32 @@ class Me {
|
|
|
1685
1687
|
* @returns Array of layout objects with position, rotation, scale
|
|
1686
1688
|
*/
|
|
1687
1689
|
generate(t, i, e = {}) {
|
|
1688
|
-
const
|
|
1689
|
-
...
|
|
1690
|
+
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, p = e.fixedHeight ?? a, f = {
|
|
1691
|
+
...Gt,
|
|
1690
1692
|
...this.config.wave
|
|
1691
|
-
}, { rows: m, amplitude:
|
|
1693
|
+
}, { rows: m, amplitude: y, frequency: E, phaseShift: v, synchronization: S } = f, w = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = s - c - L, H = O - _, N = w > 1 ? H / (w - 1) : 0, C = c + y + p / 2, D = r - c - y - p / 2, W = D - C, U = m > 1 ? W / (m - 1) : 0;
|
|
1692
1694
|
let M = 0;
|
|
1693
|
-
for (let
|
|
1694
|
-
const k = m === 1 ? (
|
|
1695
|
-
let
|
|
1696
|
-
S === "offset" ?
|
|
1697
|
-
for (let
|
|
1698
|
-
const $ =
|
|
1695
|
+
for (let R = 0; R < m && M < t; R++) {
|
|
1696
|
+
const k = m === 1 ? (C + D) / 2 : C + R * U;
|
|
1697
|
+
let q = 0;
|
|
1698
|
+
S === "offset" ? q = R * v : S === "alternating" && (q = R * Math.PI);
|
|
1699
|
+
for (let T = 0; T < w && M < t; T++) {
|
|
1700
|
+
const $ = w === 1 ? (_ + O) / 2 : _ + T * N, F = this.calculateWaveY($, s, y, E, q), X = $, P = k + F, B = b ? this.random(d, g) : 1, Y = p * B;
|
|
1699
1701
|
let V = 0;
|
|
1700
|
-
|
|
1701
|
-
const K = Y * 1.5 / 2,
|
|
1702
|
-
|
|
1702
|
+
l === "tangent" ? V = this.calculateRotation($, s, y, E, q) : l === "random" && (V = this.random(u, h));
|
|
1703
|
+
const K = Y * 1.5 / 2, lt = Y / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
|
|
1704
|
+
n.push({
|
|
1703
1705
|
id: M,
|
|
1704
|
-
x: Math.max(
|
|
1705
|
-
y: Math.max(
|
|
1706
|
+
x: Math.max(nt, Math.min(X, ot)),
|
|
1707
|
+
y: Math.max(ht, Math.min(P, dt)),
|
|
1706
1708
|
rotation: V,
|
|
1707
|
-
scale:
|
|
1709
|
+
scale: B,
|
|
1708
1710
|
baseSize: Y,
|
|
1709
1711
|
zIndex: M + 1
|
|
1710
1712
|
}), M++;
|
|
1711
1713
|
}
|
|
1712
1714
|
}
|
|
1713
|
-
return
|
|
1715
|
+
return n;
|
|
1714
1716
|
}
|
|
1715
1717
|
/**
|
|
1716
1718
|
* Calculate Y position displacement on wave curve
|
|
@@ -1721,9 +1723,9 @@ class Me {
|
|
|
1721
1723
|
* @param phase - Phase offset
|
|
1722
1724
|
* @returns Y displacement from baseline
|
|
1723
1725
|
*/
|
|
1724
|
-
calculateWaveY(t, i, e,
|
|
1726
|
+
calculateWaveY(t, i, e, n, s) {
|
|
1725
1727
|
const r = t / i;
|
|
1726
|
-
return e * Math.sin(
|
|
1728
|
+
return e * Math.sin(n * r * 2 * Math.PI + s);
|
|
1727
1729
|
}
|
|
1728
1730
|
/**
|
|
1729
1731
|
* Calculate rotation based on wave tangent
|
|
@@ -1734,9 +1736,9 @@ class Me {
|
|
|
1734
1736
|
* @param phase - Phase offset
|
|
1735
1737
|
* @returns Rotation angle in degrees
|
|
1736
1738
|
*/
|
|
1737
|
-
calculateRotation(t, i, e,
|
|
1738
|
-
const r = t / i,
|
|
1739
|
-
return Math.atan(
|
|
1739
|
+
calculateRotation(t, i, e, n, s) {
|
|
1740
|
+
const r = t / i, a = e * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + s) / i;
|
|
1741
|
+
return Math.atan(a) * (180 / Math.PI);
|
|
1740
1742
|
}
|
|
1741
1743
|
/**
|
|
1742
1744
|
* Estimate image width based on height
|
|
@@ -1750,7 +1752,7 @@ class Me {
|
|
|
1750
1752
|
return Math.random() * (i - t) + t;
|
|
1751
1753
|
}
|
|
1752
1754
|
}
|
|
1753
|
-
const
|
|
1755
|
+
const wt = 100, Q = 100 / Math.sqrt(3), xt = [
|
|
1754
1756
|
[Q / 2, 0],
|
|
1755
1757
|
// upper-left
|
|
1756
1758
|
[3 * Q / 2, 0],
|
|
@@ -1763,18 +1765,18 @@ const xt = 100, Q = 100 / Math.sqrt(3), Et = [
|
|
|
1763
1765
|
// lower-left
|
|
1764
1766
|
[0, 50]
|
|
1765
1767
|
// left
|
|
1766
|
-
], Fe =
|
|
1767
|
-
function Oe(
|
|
1768
|
+
], Fe = xt[1][0] / wt, ze = xt[2][1] / wt;
|
|
1769
|
+
function Oe(o) {
|
|
1768
1770
|
return {
|
|
1769
|
-
colStep: Fe *
|
|
1770
|
-
rowOffset: ze *
|
|
1771
|
+
colStep: Fe * o,
|
|
1772
|
+
rowOffset: ze * o
|
|
1771
1773
|
};
|
|
1772
1774
|
}
|
|
1773
|
-
function De(
|
|
1774
|
-
const { colStep: r } = Oe(
|
|
1775
|
+
function De(o, t, i, e, n, s) {
|
|
1776
|
+
const { colStep: r } = Oe(s);
|
|
1775
1777
|
return {
|
|
1776
|
-
px: e + r *
|
|
1777
|
-
py:
|
|
1778
|
+
px: e + r * o,
|
|
1779
|
+
py: n + s * (t + o / 2)
|
|
1778
1780
|
};
|
|
1779
1781
|
}
|
|
1780
1782
|
const $e = [
|
|
@@ -1785,13 +1787,13 @@ const $e = [
|
|
|
1785
1787
|
[0, -1, 1],
|
|
1786
1788
|
[1, -1, 0]
|
|
1787
1789
|
];
|
|
1788
|
-
function Pe(
|
|
1789
|
-
if (
|
|
1790
|
+
function Pe(o) {
|
|
1791
|
+
if (o === 0) return [[0, 0, 0]];
|
|
1790
1792
|
const t = [];
|
|
1791
|
-
let [i, e,
|
|
1792
|
-
for (const [
|
|
1793
|
-
for (let
|
|
1794
|
-
t.push([i, e,
|
|
1793
|
+
let [i, e, n] = [0, -o, o];
|
|
1794
|
+
for (const [s, r, a] of $e)
|
|
1795
|
+
for (let c = 0; c < o; c++)
|
|
1796
|
+
t.push([i, e, n]), i += s, e += r, n += a;
|
|
1795
1797
|
return t;
|
|
1796
1798
|
}
|
|
1797
1799
|
class _e {
|
|
@@ -1801,30 +1803,30 @@ class _e {
|
|
|
1801
1803
|
this.config = t;
|
|
1802
1804
|
}
|
|
1803
1805
|
generate(t, i, e = {}) {
|
|
1804
|
-
const
|
|
1805
|
-
...
|
|
1806
|
+
const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
|
|
1807
|
+
...qt,
|
|
1806
1808
|
...this.config.honeycomb
|
|
1807
|
-
}.spacing ?? 0, d =
|
|
1808
|
-
let
|
|
1809
|
-
for (;
|
|
1810
|
-
const p = Pe(
|
|
1811
|
-
for (const [
|
|
1812
|
-
if (
|
|
1813
|
-
const { px:
|
|
1814
|
-
|
|
1815
|
-
id:
|
|
1816
|
-
x:
|
|
1809
|
+
}.spacing ?? 0, d = l + h;
|
|
1810
|
+
let g = 0, b = 0;
|
|
1811
|
+
for (; g < t; ) {
|
|
1812
|
+
const p = Pe(b);
|
|
1813
|
+
for (const [f, m, y] of p) {
|
|
1814
|
+
if (g >= t) break;
|
|
1815
|
+
const { px: E, py: v } = De(f, m, y, a, c, d);
|
|
1816
|
+
n.push({
|
|
1817
|
+
id: g,
|
|
1818
|
+
x: E,
|
|
1817
1819
|
y: v,
|
|
1818
1820
|
rotation: 0,
|
|
1819
1821
|
scale: 1,
|
|
1820
|
-
baseSize:
|
|
1822
|
+
baseSize: l,
|
|
1821
1823
|
// Inner rings render above outer rings
|
|
1822
|
-
zIndex: Math.max(1, 100 -
|
|
1823
|
-
}),
|
|
1824
|
+
zIndex: Math.max(1, 100 - b)
|
|
1825
|
+
}), g++;
|
|
1824
1826
|
}
|
|
1825
|
-
|
|
1827
|
+
b++;
|
|
1826
1828
|
}
|
|
1827
|
-
return
|
|
1829
|
+
return n;
|
|
1828
1830
|
}
|
|
1829
1831
|
}
|
|
1830
1832
|
class Ue {
|
|
@@ -1838,11 +1840,11 @@ class Ue {
|
|
|
1838
1840
|
initLayout() {
|
|
1839
1841
|
switch (this.config.algorithm) {
|
|
1840
1842
|
case "radial":
|
|
1841
|
-
return new
|
|
1843
|
+
return new xe(this.config, this.imageConfig);
|
|
1842
1844
|
case "grid":
|
|
1843
1845
|
return new Ie(this.config, this.imageConfig);
|
|
1844
1846
|
case "spiral":
|
|
1845
|
-
return new
|
|
1847
|
+
return new Re(this.config, this.imageConfig);
|
|
1846
1848
|
case "cluster":
|
|
1847
1849
|
return new Le(this.config, this.imageConfig);
|
|
1848
1850
|
case "wave":
|
|
@@ -1850,7 +1852,7 @@ class Ue {
|
|
|
1850
1852
|
case "honeycomb":
|
|
1851
1853
|
return new _e(this.config, this.imageConfig);
|
|
1852
1854
|
default:
|
|
1853
|
-
return new
|
|
1855
|
+
return new we(this.config, this.imageConfig);
|
|
1854
1856
|
}
|
|
1855
1857
|
}
|
|
1856
1858
|
/**
|
|
@@ -1861,10 +1863,10 @@ class Ue {
|
|
|
1861
1863
|
* @returns Array of layout objects with position, rotation, scale
|
|
1862
1864
|
*/
|
|
1863
1865
|
generateLayout(t, i, e = {}) {
|
|
1864
|
-
const
|
|
1865
|
-
return
|
|
1866
|
-
this.layouts.set(
|
|
1867
|
-
}),
|
|
1866
|
+
const n = this.placementLayout.generate(t, i, e);
|
|
1867
|
+
return n.forEach((s) => {
|
|
1868
|
+
this.layouts.set(s.id, s);
|
|
1869
|
+
}), n;
|
|
1868
1870
|
}
|
|
1869
1871
|
/**
|
|
1870
1872
|
* Get the original layout state for an image
|
|
@@ -1917,8 +1919,8 @@ class Ue {
|
|
|
1917
1919
|
return;
|
|
1918
1920
|
if (typeof e == "number")
|
|
1919
1921
|
return e;
|
|
1920
|
-
const
|
|
1921
|
-
return
|
|
1922
|
+
const n = e, s = this.resolveBreakpoint(t);
|
|
1923
|
+
return s === "mobile" ? n.mobile ?? n.tablet ?? n.screen : s === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
|
|
1922
1924
|
}
|
|
1923
1925
|
/**
|
|
1924
1926
|
* Calculate adaptive image size based on container dimensions and image count
|
|
@@ -1928,19 +1930,19 @@ class Ue {
|
|
|
1928
1930
|
* @param viewportWidth - Current viewport width for baseHeight resolution
|
|
1929
1931
|
* @returns Calculated sizing result with height
|
|
1930
1932
|
*/
|
|
1931
|
-
calculateAdaptiveSize(t, i, e,
|
|
1932
|
-
const
|
|
1933
|
+
calculateAdaptiveSize(t, i, e, n) {
|
|
1934
|
+
const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
|
|
1933
1935
|
if (r !== void 0)
|
|
1934
1936
|
return { height: r };
|
|
1935
|
-
const
|
|
1937
|
+
const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * l / i;
|
|
1936
1938
|
let m = Math.sqrt(p / 1.4);
|
|
1937
1939
|
m *= u, m = Math.min(m, e);
|
|
1938
|
-
let
|
|
1939
|
-
if (
|
|
1940
|
-
const
|
|
1941
|
-
|
|
1940
|
+
let y = this.clamp(m, a, c);
|
|
1941
|
+
if (y === a && m < a) {
|
|
1942
|
+
const E = Math.max(a * 0.05, 20);
|
|
1943
|
+
y = Math.max(E, m);
|
|
1942
1944
|
}
|
|
1943
|
-
return this.config.algorithm === "honeycomb" && (
|
|
1945
|
+
return this.config.algorithm === "honeycomb" && (y = Math.min(y, this.honeycombMaxImageHeight(i, t))), { height: y };
|
|
1944
1946
|
}
|
|
1945
1947
|
/**
|
|
1946
1948
|
* Returns the largest image height at which all honeycomb rings fit within the container.
|
|
@@ -1949,10 +1951,10 @@ class Ue {
|
|
|
1949
1951
|
*/
|
|
1950
1952
|
honeycombMaxImageHeight(t, i) {
|
|
1951
1953
|
if (t <= 1) return 1 / 0;
|
|
1952
|
-
let e = 0,
|
|
1953
|
-
for (;
|
|
1954
|
-
e++,
|
|
1955
|
-
const
|
|
1954
|
+
let e = 0, n = 1;
|
|
1955
|
+
for (; n < t; )
|
|
1956
|
+
e++, n += 6 * e;
|
|
1957
|
+
const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, l = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (c - s - r * e) / (e + 0.5), d = (a - s - l * r * e) / (l * e + u);
|
|
1956
1958
|
return Math.max(10, Math.min(h, d));
|
|
1957
1959
|
}
|
|
1958
1960
|
/**
|
|
@@ -1962,7 +1964,7 @@ class Ue {
|
|
|
1962
1964
|
return Math.max(i, Math.min(e, t));
|
|
1963
1965
|
}
|
|
1964
1966
|
}
|
|
1965
|
-
var
|
|
1967
|
+
var x = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(x || {});
|
|
1966
1968
|
const Lt = {
|
|
1967
1969
|
// Geometric shapes - uses percentages for responsive sizing
|
|
1968
1970
|
circle: "circle(50%)",
|
|
@@ -1996,8 +1998,8 @@ const Lt = {
|
|
|
1996
1998
|
},
|
|
1997
1999
|
// Hexagon - regular hexagon (reference points imported from hexagonGeometry)
|
|
1998
2000
|
hexagon: {
|
|
1999
|
-
refHeight:
|
|
2000
|
-
points:
|
|
2001
|
+
refHeight: wt,
|
|
2002
|
+
points: xt
|
|
2001
2003
|
},
|
|
2002
2004
|
// Octagon - regular octagon
|
|
2003
2005
|
octagon: {
|
|
@@ -2010,105 +2012,105 @@ const Lt = {
|
|
|
2010
2012
|
points: [[50, 0], [100, 50], [50, 100], [0, 50]]
|
|
2011
2013
|
}
|
|
2012
2014
|
};
|
|
2013
|
-
function Ne(
|
|
2014
|
-
if (
|
|
2015
|
-
return
|
|
2015
|
+
function Ne(o) {
|
|
2016
|
+
if (o)
|
|
2017
|
+
return o in Lt ? Lt[o] : o;
|
|
2016
2018
|
}
|
|
2017
|
-
function ke(
|
|
2018
|
-
const e = He[
|
|
2019
|
+
function ke(o, t, i) {
|
|
2020
|
+
const e = He[o];
|
|
2019
2021
|
if (!e) return "";
|
|
2020
|
-
const
|
|
2021
|
-
if (
|
|
2022
|
-
return `circle(${Math.round(50 *
|
|
2023
|
-
const
|
|
2024
|
-
return `polygon(${e.points.map(([p,
|
|
2025
|
-
const m = Math.round((p *
|
|
2026
|
-
return `${m}px ${
|
|
2022
|
+
const n = t / e.refHeight;
|
|
2023
|
+
if (o === "circle")
|
|
2024
|
+
return `circle(${Math.round(50 * n * 100) / 100}px)`;
|
|
2025
|
+
const s = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, l = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? l) / 2, h = t / 2, d = u - a, g = h - c;
|
|
2026
|
+
return `polygon(${e.points.map(([p, f]) => {
|
|
2027
|
+
const m = Math.round((p * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
|
|
2028
|
+
return `${m}px ${y}px`;
|
|
2027
2029
|
}).join(", ")})`;
|
|
2028
2030
|
}
|
|
2029
|
-
function
|
|
2030
|
-
return
|
|
2031
|
+
function Be(o) {
|
|
2032
|
+
return o in mt;
|
|
2031
2033
|
}
|
|
2032
|
-
function
|
|
2033
|
-
return
|
|
2034
|
+
function je(o) {
|
|
2035
|
+
return o ? Be(o) ? mt[o] : o : mt.md;
|
|
2034
2036
|
}
|
|
2035
|
-
function
|
|
2036
|
-
if (!
|
|
2037
|
+
function We(o) {
|
|
2038
|
+
if (!o) return "";
|
|
2037
2039
|
const t = [];
|
|
2038
|
-
if (
|
|
2039
|
-
if (typeof
|
|
2040
|
-
t.push(`drop-shadow(${
|
|
2040
|
+
if (o.grayscale !== void 0 && t.push(`grayscale(${o.grayscale})`), o.blur !== void 0 && t.push(`blur(${o.blur}px)`), o.brightness !== void 0 && t.push(`brightness(${o.brightness})`), o.contrast !== void 0 && t.push(`contrast(${o.contrast})`), o.saturate !== void 0 && t.push(`saturate(${o.saturate})`), o.opacity !== void 0 && t.push(`opacity(${o.opacity})`), o.sepia !== void 0 && t.push(`sepia(${o.sepia})`), o.hueRotate !== void 0 && t.push(`hue-rotate(${o.hueRotate}deg)`), o.invert !== void 0 && t.push(`invert(${o.invert})`), o.dropShadow !== void 0)
|
|
2041
|
+
if (typeof o.dropShadow == "string")
|
|
2042
|
+
t.push(`drop-shadow(${o.dropShadow})`);
|
|
2041
2043
|
else {
|
|
2042
|
-
const i =
|
|
2044
|
+
const i = o.dropShadow;
|
|
2043
2045
|
t.push(`drop-shadow(${i.x}px ${i.y}px ${i.blur}px ${i.color})`);
|
|
2044
2046
|
}
|
|
2045
2047
|
return t.join(" ");
|
|
2046
2048
|
}
|
|
2047
|
-
function tt(
|
|
2048
|
-
if (!
|
|
2049
|
+
function tt(o) {
|
|
2050
|
+
if (!o || o.style === "none" || o.width === 0)
|
|
2049
2051
|
return "none";
|
|
2050
|
-
const t =
|
|
2052
|
+
const t = o.width ?? 0, i = o.style ?? "solid", e = o.color ?? "#000000";
|
|
2051
2053
|
return `${t}px ${i} ${e}`;
|
|
2052
2054
|
}
|
|
2053
|
-
function
|
|
2054
|
-
if (!
|
|
2055
|
+
function it(o, t, i) {
|
|
2056
|
+
if (!o) return {};
|
|
2055
2057
|
const e = {};
|
|
2056
|
-
if (
|
|
2057
|
-
const
|
|
2058
|
-
|
|
2059
|
-
} else
|
|
2060
|
-
if (
|
|
2061
|
-
const
|
|
2062
|
-
e.borderTop = tt(
|
|
2063
|
-
} else
|
|
2064
|
-
|
|
2065
|
-
const r =
|
|
2066
|
-
if (e.filter = r || "none",
|
|
2067
|
-
const
|
|
2068
|
-
e.outline = `${
|
|
2069
|
-
}
|
|
2070
|
-
if (
|
|
2071
|
-
let
|
|
2072
|
-
const
|
|
2073
|
-
if (
|
|
2074
|
-
|
|
2058
|
+
if (o.borderRadiusTopLeft !== void 0 || o.borderRadiusTopRight !== void 0 || o.borderRadiusBottomRight !== void 0 || o.borderRadiusBottomLeft !== void 0) {
|
|
2059
|
+
const a = o.border?.radius ?? 0;
|
|
2060
|
+
o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : a && (e.borderTopLeftRadius = `${a}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : a && (e.borderTopRightRadius = `${a}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : a && (e.borderBottomRightRadius = `${a}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : a && (e.borderBottomLeftRadius = `${a}px`);
|
|
2061
|
+
} else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
|
|
2062
|
+
if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
|
|
2063
|
+
const a = o.border || {}, c = { ...a, ...o.borderTop }, l = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, h = { ...a, ...o.borderLeft };
|
|
2064
|
+
e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
|
|
2065
|
+
} else o.border && (e.border = tt(o.border));
|
|
2066
|
+
o.shadow !== void 0 && (e.boxShadow = je(o.shadow));
|
|
2067
|
+
const r = We(o.filter);
|
|
2068
|
+
if (e.filter = r || "none", o.opacity !== void 0 && (e.opacity = String(o.opacity)), o.cursor !== void 0 && (e.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
|
|
2069
|
+
const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
|
|
2070
|
+
e.outline = `${a}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
|
|
2071
|
+
}
|
|
2072
|
+
if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
|
|
2073
|
+
let a;
|
|
2074
|
+
const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
|
|
2075
|
+
if (l?.mode === "height-relative" && t)
|
|
2076
|
+
a = ke(l.shape, t, i);
|
|
2075
2077
|
else {
|
|
2076
|
-
const u =
|
|
2077
|
-
|
|
2078
|
+
const u = c && l ? l.shape : o.clipPath;
|
|
2079
|
+
a = Ne(u);
|
|
2078
2080
|
}
|
|
2079
|
-
|
|
2081
|
+
a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
|
|
2080
2082
|
}
|
|
2081
2083
|
return e;
|
|
2082
2084
|
}
|
|
2083
|
-
function
|
|
2084
|
-
t.borderRadius !== void 0 && (
|
|
2085
|
+
function Ge(o, t) {
|
|
2086
|
+
t.borderRadius !== void 0 && (o.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (o.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (o.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (o.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (o.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (o.style.border = t.border), t.borderTop !== void 0 && (o.style.borderTop = t.borderTop), t.borderRight !== void 0 && (o.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (o.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (o.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (o.style.boxShadow = t.boxShadow), t.filter !== void 0 && (o.style.filter = t.filter), t.opacity !== void 0 && (o.style.opacity = t.opacity), t.cursor !== void 0 && (o.style.cursor = t.cursor), t.outline !== void 0 && (o.style.outline = t.outline), t.outlineOffset !== void 0 && (o.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (o.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (o.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (o.style.clipPath = t.clipPath), t.overflow !== void 0 && (o.style.overflow = t.overflow);
|
|
2085
2087
|
}
|
|
2086
|
-
function
|
|
2087
|
-
const
|
|
2088
|
-
|
|
2088
|
+
function st(o, t, i, e) {
|
|
2089
|
+
const n = it(t, i, e);
|
|
2090
|
+
Ge(o, n);
|
|
2089
2091
|
}
|
|
2090
|
-
function Pt(
|
|
2091
|
-
return
|
|
2092
|
+
function Pt(o) {
|
|
2093
|
+
return o ? Array.isArray(o) ? o.join(" ") : o : "";
|
|
2092
2094
|
}
|
|
2093
|
-
function
|
|
2095
|
+
function et(o, t) {
|
|
2094
2096
|
const i = Pt(t);
|
|
2095
2097
|
i && i.split(" ").forEach((e) => {
|
|
2096
|
-
e.trim() &&
|
|
2098
|
+
e.trim() && o.classList.add(e.trim());
|
|
2097
2099
|
});
|
|
2098
2100
|
}
|
|
2099
|
-
function pt(
|
|
2101
|
+
function pt(o, t) {
|
|
2100
2102
|
const i = Pt(t);
|
|
2101
2103
|
i && i.split(" ").forEach((e) => {
|
|
2102
|
-
e.trim() &&
|
|
2104
|
+
e.trim() && o.classList.remove(e.trim());
|
|
2103
2105
|
});
|
|
2104
2106
|
}
|
|
2105
2107
|
const Mt = {
|
|
2106
2108
|
UNFOCUSING: 999,
|
|
2107
2109
|
FOCUSING: 1e3
|
|
2108
2110
|
};
|
|
2109
|
-
class
|
|
2111
|
+
class qe {
|
|
2110
2112
|
constructor(t, i, e) {
|
|
2111
|
-
this.state =
|
|
2113
|
+
this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
|
|
2112
2114
|
}
|
|
2113
2115
|
/**
|
|
2114
2116
|
* Set callback to be fired when an unfocus animation fully completes.
|
|
@@ -2126,7 +2128,7 @@ class Be {
|
|
|
2126
2128
|
* Check if any animation is in progress
|
|
2127
2129
|
*/
|
|
2128
2130
|
isAnimating() {
|
|
2129
|
-
return this.state !==
|
|
2131
|
+
return this.state !== x.IDLE && this.state !== x.FOCUSED;
|
|
2130
2132
|
}
|
|
2131
2133
|
/**
|
|
2132
2134
|
* Normalize scalePercent value
|
|
@@ -2139,19 +2141,19 @@ class Be {
|
|
|
2139
2141
|
* Returns actual pixel dimensions instead of scale factor for sharper rendering
|
|
2140
2142
|
*/
|
|
2141
2143
|
calculateFocusDimensions(t, i, e) {
|
|
2142
|
-
const
|
|
2143
|
-
let
|
|
2144
|
-
const
|
|
2145
|
-
return
|
|
2144
|
+
const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
|
|
2145
|
+
let a = s, c = a * r;
|
|
2146
|
+
const l = e.width * n;
|
|
2147
|
+
return c > l && (c = l, a = c / r), { width: c, height: a };
|
|
2146
2148
|
}
|
|
2147
2149
|
/**
|
|
2148
2150
|
* Calculate the transform needed to center an image (position only, no scale)
|
|
2149
2151
|
* Scale is handled by animating actual dimensions for sharper rendering
|
|
2150
2152
|
*/
|
|
2151
2153
|
calculateFocusTransform(t, i) {
|
|
2152
|
-
const e = t.width / 2,
|
|
2154
|
+
const e = t.width / 2, n = t.height / 2, s = e - i.x, r = n - i.y;
|
|
2153
2155
|
return {
|
|
2154
|
-
x:
|
|
2156
|
+
x: s,
|
|
2155
2157
|
y: r,
|
|
2156
2158
|
rotation: 0,
|
|
2157
2159
|
scale: 1
|
|
@@ -2164,8 +2166,8 @@ class Be {
|
|
|
2164
2166
|
buildDimensionZoomTransform(t) {
|
|
2165
2167
|
const i = ["translate(-50%, -50%)"];
|
|
2166
2168
|
if (t.x !== void 0 || t.y !== void 0) {
|
|
2167
|
-
const e = t.x ?? 0,
|
|
2168
|
-
i.push(`translate(${e}px, ${
|
|
2169
|
+
const e = t.x ?? 0, n = t.y ?? 0;
|
|
2170
|
+
i.push(`translate(${e}px, ${n}px)`);
|
|
2169
2171
|
}
|
|
2170
2172
|
return t.rotation !== void 0 && i.push(`rotate(${t.rotation}deg)`), i.join(" ");
|
|
2171
2173
|
}
|
|
@@ -2173,23 +2175,23 @@ class Be {
|
|
|
2173
2175
|
* Create a Web Animation that animates both transform (position) and dimensions
|
|
2174
2176
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
2175
2177
|
*/
|
|
2176
|
-
animateWithDimensions(t, i, e,
|
|
2177
|
-
const
|
|
2178
|
+
animateWithDimensions(t, i, e, n, s, r, a, c) {
|
|
2179
|
+
const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
|
|
2178
2180
|
return t.style.transition = "none", t.animate(
|
|
2179
2181
|
[
|
|
2180
2182
|
{
|
|
2181
|
-
transform:
|
|
2182
|
-
width: `${
|
|
2183
|
-
height: `${
|
|
2183
|
+
transform: l,
|
|
2184
|
+
width: `${n}px`,
|
|
2185
|
+
height: `${s}px`
|
|
2184
2186
|
},
|
|
2185
2187
|
{
|
|
2186
2188
|
transform: u,
|
|
2187
2189
|
width: `${r}px`,
|
|
2188
|
-
height: `${
|
|
2190
|
+
height: `${a}px`
|
|
2189
2191
|
}
|
|
2190
2192
|
],
|
|
2191
2193
|
{
|
|
2192
|
-
duration:
|
|
2194
|
+
duration: c,
|
|
2193
2195
|
easing: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
2194
2196
|
fill: "forwards"
|
|
2195
2197
|
}
|
|
@@ -2200,8 +2202,8 @@ class Be {
|
|
|
2200
2202
|
* Applies all focused styling properties, classes, and z-index
|
|
2201
2203
|
*/
|
|
2202
2204
|
applyFocusedStyling(t, i) {
|
|
2203
|
-
if (t.style.zIndex = String(i), t.classList.add("fbn-ic-focused"),
|
|
2204
|
-
const e =
|
|
2205
|
+
if (t.style.zIndex = String(i), t.classList.add("fbn-ic-focused"), et(t, this.focusedClassName), this.styling?.focused) {
|
|
2206
|
+
const e = it(this.styling.focused, t.offsetHeight, t.offsetWidth);
|
|
2205
2207
|
e.borderRadius !== void 0 && (t.style.borderRadius = e.borderRadius), e.borderTopLeftRadius !== void 0 && (t.style.borderTopLeftRadius = e.borderTopLeftRadius), e.borderTopRightRadius !== void 0 && (t.style.borderTopRightRadius = e.borderTopRightRadius), e.borderBottomRightRadius !== void 0 && (t.style.borderBottomRightRadius = e.borderBottomRightRadius), e.borderBottomLeftRadius !== void 0 && (t.style.borderBottomLeftRadius = e.borderBottomLeftRadius), e.border !== void 0 && (t.style.border = e.border), e.borderTop !== void 0 && (t.style.borderTop = e.borderTop), e.borderRight !== void 0 && (t.style.borderRight = e.borderRight), e.borderBottom !== void 0 && (t.style.borderBottom = e.borderBottom), e.borderLeft !== void 0 && (t.style.borderLeft = e.borderLeft), e.boxShadow !== void 0 && (t.style.boxShadow = e.boxShadow), e.filter !== void 0 && (t.style.filter = e.filter), e.opacity !== void 0 && (t.style.opacity = e.opacity), e.cursor !== void 0 && (t.style.cursor = e.cursor), e.outline !== void 0 && (t.style.outline = e.outline), e.outlineOffset !== void 0 && (t.style.outlineOffset = e.outlineOffset), e.objectFit !== void 0 && (t.style.objectFit = e.objectFit), e.aspectRatio !== void 0 && (t.style.aspectRatio = e.aspectRatio);
|
|
2206
2208
|
}
|
|
2207
2209
|
}
|
|
@@ -2211,7 +2213,7 @@ class Be {
|
|
|
2211
2213
|
*/
|
|
2212
2214
|
removeFocusedStyling(t, i) {
|
|
2213
2215
|
if (t.style.zIndex = i, t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName), this.styling?.default) {
|
|
2214
|
-
const e =
|
|
2216
|
+
const e = it(this.styling.default, t.offsetHeight, t.offsetWidth);
|
|
2215
2217
|
e.borderRadius !== void 0 && (t.style.borderRadius = e.borderRadius), e.borderTopLeftRadius !== void 0 && (t.style.borderTopLeftRadius = e.borderTopLeftRadius), e.borderTopRightRadius !== void 0 && (t.style.borderTopRightRadius = e.borderTopRightRadius), e.borderBottomRightRadius !== void 0 && (t.style.borderBottomRightRadius = e.borderBottomRightRadius), e.borderBottomLeftRadius !== void 0 && (t.style.borderBottomLeftRadius = e.borderBottomLeftRadius), e.border !== void 0 && (t.style.border = e.border), e.borderTop !== void 0 && (t.style.borderTop = e.borderTop), e.borderRight !== void 0 && (t.style.borderRight = e.borderRight), e.borderBottom !== void 0 && (t.style.borderBottom = e.borderBottom), e.borderLeft !== void 0 && (t.style.borderLeft = e.borderLeft), e.boxShadow !== void 0 && (t.style.boxShadow = e.boxShadow), e.filter !== void 0 && (t.style.filter = e.filter), e.opacity !== void 0 && (t.style.opacity = e.opacity), e.cursor !== void 0 && (t.style.cursor = e.cursor), e.outline !== void 0 && (t.style.outline = e.outline), e.outlineOffset !== void 0 && (t.style.outlineOffset = e.outlineOffset), e.objectFit !== void 0 && (t.style.objectFit = e.objectFit), e.aspectRatio !== void 0 && (t.style.aspectRatio = e.aspectRatio);
|
|
2216
2218
|
}
|
|
2217
2219
|
}
|
|
@@ -2220,13 +2222,13 @@ class Be {
|
|
|
2220
2222
|
* This ensures clip-path changes smoothly as width/height animate
|
|
2221
2223
|
*/
|
|
2222
2224
|
startClipPathAnimation(t, i, e) {
|
|
2223
|
-
let
|
|
2224
|
-
e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (
|
|
2225
|
-
const
|
|
2226
|
-
const r = t.offsetHeight,
|
|
2227
|
-
|
|
2225
|
+
let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
|
|
2226
|
+
e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
|
|
2227
|
+
const s = () => {
|
|
2228
|
+
const r = t.offsetHeight, a = t.offsetWidth, c = it(n, r, a);
|
|
2229
|
+
c.clipPath !== void 0 ? t.style.clipPath = c.clipPath : t.style.clipPath = "unset", c.overflow !== void 0 && (t.style.overflow = c.overflow), i.animation.playState === "running" && requestAnimationFrame(s);
|
|
2228
2230
|
};
|
|
2229
|
-
requestAnimationFrame(
|
|
2231
|
+
requestAnimationFrame(s);
|
|
2230
2232
|
}
|
|
2231
2233
|
/**
|
|
2232
2234
|
* Start focus animation for an image using dimension-based zoom
|
|
@@ -2234,27 +2236,27 @@ class Be {
|
|
|
2234
2236
|
* @param fromTransform - Optional starting transform (for mid-animation reversals)
|
|
2235
2237
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2236
2238
|
*/
|
|
2237
|
-
startFocusAnimation(t, i, e,
|
|
2238
|
-
const r = t.style.zIndex || "",
|
|
2239
|
+
startFocusAnimation(t, i, e, n, s) {
|
|
2240
|
+
const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
|
|
2239
2241
|
this.animationEngine.cancelAllAnimations(t);
|
|
2240
2242
|
const h = this.config.animationDuration ?? 600;
|
|
2241
2243
|
this.applyFocusedStyling(t, Mt.FOCUSING);
|
|
2242
|
-
const d =
|
|
2244
|
+
const d = n ?? {
|
|
2243
2245
|
x: 0,
|
|
2244
2246
|
y: 0,
|
|
2245
2247
|
rotation: e.rotation,
|
|
2246
2248
|
scale: 1
|
|
2247
2249
|
// No scale - using dimensions
|
|
2248
|
-
},
|
|
2250
|
+
}, g = s?.width ?? a, b = s?.height ?? c, p = this.animateWithDimensions(
|
|
2249
2251
|
t,
|
|
2250
2252
|
d,
|
|
2251
2253
|
u,
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2254
|
+
g,
|
|
2255
|
+
b,
|
|
2256
|
+
l.width,
|
|
2257
|
+
l.height,
|
|
2256
2258
|
h
|
|
2257
|
-
),
|
|
2259
|
+
), f = {
|
|
2258
2260
|
id: `focus-${Date.now()}`,
|
|
2259
2261
|
element: t,
|
|
2260
2262
|
animation: p,
|
|
@@ -2268,17 +2270,17 @@ class Be {
|
|
|
2268
2270
|
originalState: e,
|
|
2269
2271
|
focusTransform: u,
|
|
2270
2272
|
originalZIndex: r,
|
|
2271
|
-
originalWidth:
|
|
2272
|
-
originalHeight:
|
|
2273
|
-
focusWidth:
|
|
2274
|
-
focusHeight:
|
|
2275
|
-
}, this.startClipPathAnimation(t,
|
|
2273
|
+
originalWidth: a,
|
|
2274
|
+
originalHeight: c,
|
|
2275
|
+
focusWidth: l.width,
|
|
2276
|
+
focusHeight: l.height
|
|
2277
|
+
}, this.startClipPathAnimation(t, f, !0), {
|
|
2276
2278
|
element: t,
|
|
2277
2279
|
originalState: e,
|
|
2278
|
-
animationHandle:
|
|
2280
|
+
animationHandle: f,
|
|
2279
2281
|
direction: "in",
|
|
2280
|
-
originalWidth:
|
|
2281
|
-
originalHeight:
|
|
2282
|
+
originalWidth: a,
|
|
2283
|
+
originalHeight: c
|
|
2282
2284
|
};
|
|
2283
2285
|
}
|
|
2284
2286
|
/**
|
|
@@ -2286,11 +2288,11 @@ class Be {
|
|
|
2286
2288
|
* Animates back to original dimensions for consistent behavior
|
|
2287
2289
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2288
2290
|
*/
|
|
2289
|
-
startUnfocusAnimation(t, i, e,
|
|
2291
|
+
startUnfocusAnimation(t, i, e, n) {
|
|
2290
2292
|
t.style.zIndex = String(Mt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2291
|
-
const
|
|
2293
|
+
const s = this.config.animationDuration ?? 600;
|
|
2292
2294
|
t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
|
|
2293
|
-
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 },
|
|
2295
|
+
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
|
|
2294
2296
|
x: 0,
|
|
2295
2297
|
y: 0,
|
|
2296
2298
|
rotation: i.rotation,
|
|
@@ -2299,25 +2301,25 @@ class Be {
|
|
|
2299
2301
|
}, u = this.focusData?.originalWidth ?? t.offsetWidth, h = this.focusData?.originalHeight ?? t.offsetHeight, d = this.animateWithDimensions(
|
|
2300
2302
|
t,
|
|
2301
2303
|
r,
|
|
2302
|
-
c,
|
|
2303
|
-
s,
|
|
2304
2304
|
l,
|
|
2305
|
+
a,
|
|
2306
|
+
c,
|
|
2305
2307
|
u,
|
|
2306
2308
|
h,
|
|
2307
|
-
|
|
2308
|
-
),
|
|
2309
|
+
s
|
|
2310
|
+
), g = {
|
|
2309
2311
|
id: `unfocus-${Date.now()}`,
|
|
2310
2312
|
element: t,
|
|
2311
2313
|
animation: d,
|
|
2312
2314
|
fromState: r,
|
|
2313
|
-
toState:
|
|
2315
|
+
toState: l,
|
|
2314
2316
|
startTime: performance.now(),
|
|
2315
|
-
duration:
|
|
2317
|
+
duration: s
|
|
2316
2318
|
};
|
|
2317
|
-
return this.startClipPathAnimation(t,
|
|
2319
|
+
return this.startClipPathAnimation(t, g, !1), {
|
|
2318
2320
|
element: t,
|
|
2319
2321
|
originalState: i,
|
|
2320
|
-
animationHandle:
|
|
2322
|
+
animationHandle: g,
|
|
2321
2323
|
direction: "out",
|
|
2322
2324
|
originalWidth: u,
|
|
2323
2325
|
originalHeight: h
|
|
@@ -2338,10 +2340,10 @@ class Be {
|
|
|
2338
2340
|
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
2339
2341
|
*/
|
|
2340
2342
|
captureMidAnimationState(t) {
|
|
2341
|
-
const i = getComputedStyle(t), e = new DOMMatrix(i.transform),
|
|
2342
|
-
return t.style.width = `${
|
|
2343
|
-
transform: { x: r, y:
|
|
2344
|
-
dimensions: { width:
|
|
2343
|
+
const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, s = t.offsetHeight, r = e.e + n * 0.5, a = e.f + s * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
|
|
2344
|
+
return t.style.width = `${n}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${c}deg)`, t.style.transition = "none", {
|
|
2345
|
+
transform: { x: r, y: a, rotation: c, scale: 1 },
|
|
2346
|
+
dimensions: { width: n, height: s }
|
|
2345
2347
|
};
|
|
2346
2348
|
}
|
|
2347
2349
|
/**
|
|
@@ -2356,94 +2358,94 @@ class Be {
|
|
|
2356
2358
|
/**
|
|
2357
2359
|
* Reset an element instantly to its original position and dimensions (no animation)
|
|
2358
2360
|
*/
|
|
2359
|
-
resetElementInstantly(t, i, e,
|
|
2361
|
+
resetElementInstantly(t, i, e, n, s) {
|
|
2360
2362
|
this.animationEngine.cancelAllAnimations(t);
|
|
2361
2363
|
const r = ["translate(-50%, -50%)"];
|
|
2362
|
-
r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "),
|
|
2364
|
+
r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), n !== void 0 && s !== void 0 && (t.style.width = `${n}px`, t.style.height = `${s}px`), this.removeFocusedStyling(t, e);
|
|
2363
2365
|
}
|
|
2364
2366
|
/**
|
|
2365
2367
|
* Focus (zoom) an image to center of container
|
|
2366
2368
|
* Implements cross-animation when swapping focus
|
|
2367
2369
|
*/
|
|
2368
2370
|
async focusImage(t, i, e) {
|
|
2369
|
-
if (this.currentFocus === t && this.state ===
|
|
2371
|
+
if (this.currentFocus === t && this.state === x.FOCUSED)
|
|
2370
2372
|
return this.unfocusImage();
|
|
2371
|
-
if (this.incoming?.element === t && this.state ===
|
|
2372
|
-
const { transform:
|
|
2373
|
+
if (this.incoming?.element === t && this.state === x.FOCUSING) {
|
|
2374
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2373
2375
|
this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
|
|
2374
2376
|
t,
|
|
2375
2377
|
this.incoming.originalState,
|
|
2376
|
-
|
|
2378
|
+
s,
|
|
2377
2379
|
r
|
|
2378
|
-
), this.incoming = null, this.state =
|
|
2380
|
+
), this.incoming = null, this.state = x.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 = x.IDLE;
|
|
2379
2381
|
return;
|
|
2380
2382
|
}
|
|
2381
|
-
const
|
|
2383
|
+
const n = ++this.focusGeneration;
|
|
2382
2384
|
switch (this.state) {
|
|
2383
|
-
case
|
|
2384
|
-
if (this.state =
|
|
2385
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2385
|
+
case x.IDLE:
|
|
2386
|
+
if (this.state = x.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2387
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2386
2388
|
break;
|
|
2387
|
-
case
|
|
2388
|
-
if (this.state =
|
|
2389
|
+
case x.FOCUSED:
|
|
2390
|
+
if (this.state = x.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2389
2391
|
this.currentFocus,
|
|
2390
2392
|
this.focusData.originalState
|
|
2391
2393
|
)), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
2392
2394
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2393
2395
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2394
|
-
]), this.focusGeneration !==
|
|
2396
|
+
]), this.focusGeneration !== n)
|
|
2395
2397
|
return;
|
|
2396
2398
|
if (this.outgoing) {
|
|
2397
|
-
const
|
|
2398
|
-
this.removeFocusedStyling(
|
|
2399
|
+
const s = this.outgoing.element;
|
|
2400
|
+
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2399
2401
|
}
|
|
2400
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2402
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2401
2403
|
break;
|
|
2402
|
-
case
|
|
2404
|
+
case x.FOCUSING:
|
|
2403
2405
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2404
2406
|
this.incoming.element,
|
|
2405
2407
|
this.incoming.originalState,
|
|
2406
2408
|
this.focusData?.originalZIndex || "",
|
|
2407
2409
|
this.focusData?.originalWidth,
|
|
2408
2410
|
this.focusData?.originalHeight
|
|
2409
|
-
), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !==
|
|
2410
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2411
|
+
), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2412
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2411
2413
|
break;
|
|
2412
|
-
case
|
|
2413
|
-
if (this.state =
|
|
2414
|
+
case x.UNFOCUSING:
|
|
2415
|
+
if (this.state = x.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
2414
2416
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2415
2417
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2416
|
-
]), this.focusGeneration !==
|
|
2418
|
+
]), this.focusGeneration !== n) return;
|
|
2417
2419
|
if (this.outgoing) {
|
|
2418
|
-
const
|
|
2419
|
-
this.removeFocusedStyling(
|
|
2420
|
+
const s = this.outgoing.element;
|
|
2421
|
+
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2420
2422
|
}
|
|
2421
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2423
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2422
2424
|
break;
|
|
2423
|
-
case
|
|
2425
|
+
case x.CROSS_ANIMATING:
|
|
2424
2426
|
if (this.incoming?.element === t)
|
|
2425
2427
|
return;
|
|
2426
2428
|
if (this.outgoing?.element === t) {
|
|
2427
|
-
const { transform:
|
|
2429
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
|
|
2428
2430
|
if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
|
|
2429
|
-
const { transform:
|
|
2431
|
+
const { transform: a, dimensions: c } = this.captureMidAnimationState(this.incoming.element);
|
|
2430
2432
|
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2431
2433
|
this.incoming.element,
|
|
2432
2434
|
this.incoming.originalState,
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
+
a,
|
|
2436
|
+
c
|
|
2435
2437
|
);
|
|
2436
2438
|
} else
|
|
2437
2439
|
this.outgoing = null;
|
|
2438
|
-
if (this.incoming = this.startFocusAnimation(t, i, e,
|
|
2440
|
+
if (this.incoming = this.startFocusAnimation(t, i, e, s, r), await Promise.all([
|
|
2439
2441
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2440
2442
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2441
|
-
]), this.focusGeneration !==
|
|
2443
|
+
]), this.focusGeneration !== n) return;
|
|
2442
2444
|
if (this.outgoing) {
|
|
2443
|
-
const
|
|
2444
|
-
this.removeFocusedStyling(
|
|
2445
|
+
const a = this.outgoing.element;
|
|
2446
|
+
this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
|
|
2445
2447
|
}
|
|
2446
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2448
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2447
2449
|
return;
|
|
2448
2450
|
}
|
|
2449
2451
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2453,23 +2455,23 @@ class Be {
|
|
|
2453
2455
|
this.outgoing.originalWidth,
|
|
2454
2456
|
this.outgoing.originalHeight
|
|
2455
2457
|
), this.outgoing = null), this.incoming) {
|
|
2456
|
-
const { transform:
|
|
2458
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2457
2459
|
this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2458
2460
|
this.incoming.element,
|
|
2459
2461
|
this.incoming.originalState,
|
|
2460
|
-
|
|
2462
|
+
s,
|
|
2461
2463
|
r
|
|
2462
2464
|
);
|
|
2463
2465
|
}
|
|
2464
2466
|
if (this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
|
|
2465
2467
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2466
2468
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2467
|
-
]), this.focusGeneration !==
|
|
2469
|
+
]), this.focusGeneration !== n) return;
|
|
2468
2470
|
if (this.outgoing) {
|
|
2469
|
-
const
|
|
2470
|
-
this.removeFocusedStyling(
|
|
2471
|
+
const s = this.outgoing.element;
|
|
2472
|
+
this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
|
|
2471
2473
|
}
|
|
2472
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2474
|
+
this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
|
|
2473
2475
|
break;
|
|
2474
2476
|
}
|
|
2475
2477
|
}
|
|
@@ -2477,45 +2479,45 @@ class Be {
|
|
|
2477
2479
|
* Unfocus current image, returning it to original position
|
|
2478
2480
|
*/
|
|
2479
2481
|
async unfocusImage() {
|
|
2480
|
-
if (this.state ===
|
|
2482
|
+
if (this.state === x.UNFOCUSING)
|
|
2481
2483
|
return;
|
|
2482
2484
|
const t = ++this.focusGeneration;
|
|
2483
2485
|
if (!this.currentFocus || !this.focusData) {
|
|
2484
|
-
if (this.incoming && this.state ===
|
|
2485
|
-
const { transform:
|
|
2486
|
+
if (this.incoming && this.state === x.FOCUSING) {
|
|
2487
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2486
2488
|
if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
|
|
2487
2489
|
this.incoming.element,
|
|
2488
2490
|
this.incoming.originalState,
|
|
2489
|
-
|
|
2491
|
+
s,
|
|
2490
2492
|
r
|
|
2491
|
-
), this.incoming = null, this.state =
|
|
2492
|
-
const
|
|
2493
|
-
this.removeFocusedStyling(
|
|
2493
|
+
), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2494
|
+
const a = this.outgoing.element;
|
|
2495
|
+
this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(a);
|
|
2494
2496
|
}
|
|
2495
2497
|
return;
|
|
2496
2498
|
}
|
|
2497
|
-
if (this.state ===
|
|
2498
|
-
const { transform:
|
|
2499
|
+
if (this.state === x.CROSS_ANIMATING && this.incoming) {
|
|
2500
|
+
const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
|
|
2499
2501
|
this.animationEngine.cancelAllAnimations(this.incoming.element);
|
|
2500
|
-
const
|
|
2502
|
+
const a = this.startUnfocusAnimation(
|
|
2501
2503
|
this.incoming.element,
|
|
2502
2504
|
this.incoming.originalState,
|
|
2503
|
-
|
|
2505
|
+
s,
|
|
2504
2506
|
r
|
|
2505
2507
|
);
|
|
2506
2508
|
if (await Promise.all([
|
|
2507
2509
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2508
|
-
this.waitForAnimation(
|
|
2510
|
+
this.waitForAnimation(a.animationHandle)
|
|
2509
2511
|
]), this.focusGeneration !== t) return;
|
|
2510
|
-
let
|
|
2511
|
-
this.outgoing && (
|
|
2512
|
-
const
|
|
2513
|
-
this.removeFocusedStyling(
|
|
2512
|
+
let c = null;
|
|
2513
|
+
this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
|
|
2514
|
+
const l = a.element;
|
|
2515
|
+
this.removeFocusedStyling(l, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(l);
|
|
2514
2516
|
return;
|
|
2515
2517
|
}
|
|
2516
|
-
this.state =
|
|
2517
|
-
const i = this.currentFocus, e = this.focusData.originalState,
|
|
2518
|
-
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i,
|
|
2518
|
+
this.state = x.UNFOCUSING;
|
|
2519
|
+
const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2520
|
+
this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(i));
|
|
2519
2521
|
}
|
|
2520
2522
|
/**
|
|
2521
2523
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2533,7 +2535,7 @@ class Be {
|
|
|
2533
2535
|
* Check if an image is currently focused (stable state)
|
|
2534
2536
|
*/
|
|
2535
2537
|
isFocused(t) {
|
|
2536
|
-
return this.currentFocus === t && this.state ===
|
|
2538
|
+
return this.currentFocus === t && this.state === x.FOCUSED;
|
|
2537
2539
|
}
|
|
2538
2540
|
/**
|
|
2539
2541
|
* Check if an image is the target of current focus animation
|
|
@@ -2554,9 +2556,9 @@ class Be {
|
|
|
2554
2556
|
* Used during swipe gestures for visual feedback
|
|
2555
2557
|
*/
|
|
2556
2558
|
setDragOffset(t) {
|
|
2557
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2558
|
-
const i = this.currentFocus, e = this.focusData.focusTransform,
|
|
2559
|
-
|
|
2559
|
+
if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
|
|
2560
|
+
const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
|
|
2561
|
+
n.push(`translate(${s}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
|
|
2560
2562
|
}
|
|
2561
2563
|
/**
|
|
2562
2564
|
* Clear the drag offset, optionally animating back to center
|
|
@@ -2564,13 +2566,13 @@ class Be {
|
|
|
2564
2566
|
* @param duration - Animation duration in ms (default 150)
|
|
2565
2567
|
*/
|
|
2566
2568
|
clearDragOffset(t, i = 150) {
|
|
2567
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2568
|
-
const e = this.currentFocus,
|
|
2569
|
-
|
|
2570
|
-
const
|
|
2571
|
-
t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform =
|
|
2569
|
+
if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
|
|
2570
|
+
const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
|
|
2571
|
+
s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
|
|
2572
|
+
const c = s.join(" ");
|
|
2573
|
+
t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = c, setTimeout(() => {
|
|
2572
2574
|
this.currentFocus === e && (e.style.transition = "none");
|
|
2573
|
-
}, i)) : (e.style.transition = "none", e.style.transform =
|
|
2575
|
+
}, i)) : (e.style.transition = "none", e.style.transform = c);
|
|
2574
2576
|
}
|
|
2575
2577
|
/**
|
|
2576
2578
|
* Reset zoom state (cancels all animations)
|
|
@@ -2594,10 +2596,10 @@ class Be {
|
|
|
2594
2596
|
this.focusData.originalZIndex,
|
|
2595
2597
|
this.focusData.originalWidth,
|
|
2596
2598
|
this.focusData.originalHeight
|
|
2597
|
-
), this.state =
|
|
2599
|
+
), this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2598
2600
|
}
|
|
2599
2601
|
}
|
|
2600
|
-
const Xe = 50, Ye = 0.5, Ve = 20, Je = 0.3, Ke = 150, Ze = 30,
|
|
2602
|
+
const Xe = 50, Ye = 0.5, Ve = 20, Je = 0.3, Ke = 150, Ze = 30, rt = class rt {
|
|
2601
2603
|
constructor(t, i) {
|
|
2602
2604
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = i, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2603
2605
|
}
|
|
@@ -2624,7 +2626,7 @@ const Xe = 50, Ye = 0.5, Ve = 20, Je = 0.3, Ke = 150, Ze = 30, at = class at {
|
|
|
2624
2626
|
* Used to prevent click-outside from unfocusing immediately after touch
|
|
2625
2627
|
*/
|
|
2626
2628
|
hadRecentTouch() {
|
|
2627
|
-
return Date.now() - this.recentTouchTimestamp <
|
|
2629
|
+
return Date.now() - this.recentTouchTimestamp < rt.TOUCH_CLICK_DELAY;
|
|
2628
2630
|
}
|
|
2629
2631
|
handleTouchStart(t) {
|
|
2630
2632
|
if (t.touches.length !== 1) return;
|
|
@@ -2641,30 +2643,30 @@ const Xe = 50, Ye = 0.5, Ve = 20, Je = 0.3, Ke = 150, Ze = 30, at = class at {
|
|
|
2641
2643
|
}
|
|
2642
2644
|
handleTouchMove(t) {
|
|
2643
2645
|
if (!this.touchState || t.touches.length !== 1) return;
|
|
2644
|
-
const i = t.touches[0], e = i.clientX - this.touchState.startX,
|
|
2645
|
-
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e +
|
|
2646
|
-
const
|
|
2647
|
-
this.touchState.isHorizontalSwipe =
|
|
2646
|
+
const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
|
|
2647
|
+
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
|
|
2648
|
+
const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
|
|
2649
|
+
this.touchState.isHorizontalSwipe = a <= Ze;
|
|
2648
2650
|
}
|
|
2649
2651
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2650
2652
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
|
|
2651
|
-
const
|
|
2652
|
-
this.callbacks.onDragOffset(
|
|
2653
|
+
const s = e * Je;
|
|
2654
|
+
this.callbacks.onDragOffset(s);
|
|
2653
2655
|
}
|
|
2654
2656
|
}
|
|
2655
2657
|
handleTouchEnd(t) {
|
|
2656
2658
|
if (!this.touchState) return;
|
|
2657
2659
|
this.recentTouchTimestamp = Date.now();
|
|
2658
|
-
const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime,
|
|
2660
|
+
const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
|
|
2659
2661
|
let r = !1;
|
|
2660
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (
|
|
2662
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Xe || n >= Ye && s >= Ve) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2661
2663
|
}
|
|
2662
2664
|
handleTouchCancel(t) {
|
|
2663
2665
|
this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
|
|
2664
2666
|
}
|
|
2665
2667
|
};
|
|
2666
|
-
|
|
2667
|
-
let
|
|
2668
|
+
rt.TOUCH_CLICK_DELAY = 300;
|
|
2669
|
+
let bt = rt;
|
|
2668
2670
|
class Qe {
|
|
2669
2671
|
constructor(t) {
|
|
2670
2672
|
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)
|
|
@@ -2679,8 +2681,8 @@ class Qe {
|
|
|
2679
2681
|
for (const i of this.sources)
|
|
2680
2682
|
if ("folders" in i)
|
|
2681
2683
|
for (const e of i.folders) {
|
|
2682
|
-
const
|
|
2683
|
-
this._discoveredUrls.push(...
|
|
2684
|
+
const n = i.recursive !== void 0 ? i.recursive : !0, s = await this.loadFromFolder(e, t, n);
|
|
2685
|
+
this._discoveredUrls.push(...s);
|
|
2684
2686
|
}
|
|
2685
2687
|
else if ("files" in i) {
|
|
2686
2688
|
const e = await this.loadFiles(i.files, t);
|
|
@@ -2725,9 +2727,9 @@ class Qe {
|
|
|
2725
2727
|
// Alternative format
|
|
2726
2728
|
];
|
|
2727
2729
|
for (const e of i) {
|
|
2728
|
-
const
|
|
2729
|
-
if (
|
|
2730
|
-
return
|
|
2730
|
+
const n = t.match(e);
|
|
2731
|
+
if (n && n[1])
|
|
2732
|
+
return n[1];
|
|
2731
2733
|
}
|
|
2732
2734
|
return null;
|
|
2733
2735
|
}
|
|
@@ -2739,15 +2741,15 @@ class Qe {
|
|
|
2739
2741
|
* @returns Promise resolving to array of image URLs
|
|
2740
2742
|
*/
|
|
2741
2743
|
async loadFromFolder(t, i, e = !0) {
|
|
2742
|
-
const
|
|
2743
|
-
if (!
|
|
2744
|
+
const n = this.extractFolderId(t);
|
|
2745
|
+
if (!n)
|
|
2744
2746
|
throw new Error("Invalid Google Drive folder URL. Please check the URL format.");
|
|
2745
2747
|
if (!this.apiKey || this.apiKey === "YOUR_API_KEY_HERE")
|
|
2746
|
-
return this.loadImagesDirectly(
|
|
2748
|
+
return this.loadImagesDirectly(n, i);
|
|
2747
2749
|
try {
|
|
2748
|
-
return e ? await this.loadImagesRecursively(
|
|
2749
|
-
} catch (
|
|
2750
|
-
return console.error("Error loading from Google Drive API:",
|
|
2750
|
+
return e ? await this.loadImagesRecursively(n, i) : await this.loadImagesFromSingleFolder(n, i);
|
|
2751
|
+
} catch (s) {
|
|
2752
|
+
return console.error("Error loading from Google Drive API:", s), this.loadImagesDirectly(n, i);
|
|
2751
2753
|
}
|
|
2752
2754
|
}
|
|
2753
2755
|
/**
|
|
@@ -2757,13 +2759,13 @@ class Qe {
|
|
|
2757
2759
|
* @returns Promise resolving to array of image URLs
|
|
2758
2760
|
*/
|
|
2759
2761
|
async loadImagesFromSingleFolder(t, i) {
|
|
2760
|
-
const e = [],
|
|
2761
|
-
if (!
|
|
2762
|
-
throw new Error(`API request failed: ${
|
|
2763
|
-
const
|
|
2762
|
+
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2763
|
+
if (!a.ok)
|
|
2764
|
+
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2765
|
+
const l = (await a.json()).files.filter(
|
|
2764
2766
|
(u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
|
|
2765
2767
|
);
|
|
2766
|
-
return this.log(`Found ${
|
|
2768
|
+
return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
|
|
2767
2769
|
e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
|
|
2768
2770
|
}), e;
|
|
2769
2771
|
}
|
|
@@ -2775,25 +2777,25 @@ class Qe {
|
|
|
2775
2777
|
*/
|
|
2776
2778
|
async loadFiles(t, i) {
|
|
2777
2779
|
const e = [];
|
|
2778
|
-
for (const
|
|
2779
|
-
const
|
|
2780
|
-
if (!
|
|
2781
|
-
this.log(`Skipping invalid file URL: ${
|
|
2780
|
+
for (const n of t) {
|
|
2781
|
+
const s = this.extractFileId(n);
|
|
2782
|
+
if (!s) {
|
|
2783
|
+
this.log(`Skipping invalid file URL: ${n}`);
|
|
2782
2784
|
continue;
|
|
2783
2785
|
}
|
|
2784
2786
|
if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
|
|
2785
2787
|
try {
|
|
2786
|
-
const r = `${this.apiEndpoint}/${
|
|
2787
|
-
if (
|
|
2788
|
-
const
|
|
2789
|
-
|
|
2788
|
+
const r = `${this.apiEndpoint}/${s}?fields=name,mimeType&key=${this.apiKey}`, a = await fetch(r);
|
|
2789
|
+
if (a.ok) {
|
|
2790
|
+
const c = await a.json();
|
|
2791
|
+
c.mimeType.startsWith("image/") && i.isAllowed(c.name) ? (e.push(`https://lh3.googleusercontent.com/d/${s}=s1600`), this.log(`Added file: ${c.name}`)) : this.log(`Skipping non-image file: ${c.name} (${c.mimeType})`);
|
|
2790
2792
|
} else
|
|
2791
|
-
this.log(`Failed to fetch metadata for file ${
|
|
2793
|
+
this.log(`Failed to fetch metadata for file ${s}: ${a.status}`);
|
|
2792
2794
|
} catch (r) {
|
|
2793
|
-
this.log(`Error fetching metadata for file ${
|
|
2795
|
+
this.log(`Error fetching metadata for file ${s}:`, r);
|
|
2794
2796
|
}
|
|
2795
2797
|
else
|
|
2796
|
-
e.push(`https://lh3.googleusercontent.com/d/${
|
|
2798
|
+
e.push(`https://lh3.googleusercontent.com/d/${s}=s1600`);
|
|
2797
2799
|
}
|
|
2798
2800
|
return e;
|
|
2799
2801
|
}
|
|
@@ -2814,9 +2816,9 @@ class Qe {
|
|
|
2814
2816
|
// Generic id parameter
|
|
2815
2817
|
];
|
|
2816
2818
|
for (const e of i) {
|
|
2817
|
-
const
|
|
2818
|
-
if (
|
|
2819
|
-
return
|
|
2819
|
+
const n = t.match(e);
|
|
2820
|
+
if (n && n[1])
|
|
2821
|
+
return n[1];
|
|
2820
2822
|
}
|
|
2821
2823
|
return null;
|
|
2822
2824
|
}
|
|
@@ -2827,15 +2829,15 @@ class Qe {
|
|
|
2827
2829
|
* @returns Promise resolving to array of image URLs
|
|
2828
2830
|
*/
|
|
2829
2831
|
async loadImagesRecursively(t, i) {
|
|
2830
|
-
const e = [],
|
|
2831
|
-
if (!
|
|
2832
|
-
throw new Error(`API request failed: ${
|
|
2833
|
-
const
|
|
2832
|
+
const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
|
|
2833
|
+
if (!a.ok)
|
|
2834
|
+
throw new Error(`API request failed: ${a.status} ${a.statusText}`);
|
|
2835
|
+
const c = await a.json(), l = c.files.filter(
|
|
2834
2836
|
(h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
|
|
2835
|
-
), u =
|
|
2837
|
+
), u = c.files.filter(
|
|
2836
2838
|
(h) => h.mimeType === "application/vnd.google-apps.folder"
|
|
2837
2839
|
);
|
|
2838
|
-
this.log(`Found ${
|
|
2840
|
+
this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), l.forEach((h) => {
|
|
2839
2841
|
e.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
|
|
2840
2842
|
});
|
|
2841
2843
|
for (const h of u) {
|
|
@@ -2854,11 +2856,11 @@ class Qe {
|
|
|
2854
2856
|
*/
|
|
2855
2857
|
async loadImagesDirectly(t, i) {
|
|
2856
2858
|
try {
|
|
2857
|
-
const e = `https://drive.google.com/embeddedfolderview?id=${t}`,
|
|
2858
|
-
if (!
|
|
2859
|
+
const e = `https://drive.google.com/embeddedfolderview?id=${t}`, n = await fetch(e, { mode: "cors" });
|
|
2860
|
+
if (!n.ok)
|
|
2859
2861
|
throw new Error("Cannot access folder directly (CORS or permissions issue)");
|
|
2860
|
-
const
|
|
2861
|
-
return [...new Set(
|
|
2862
|
+
const s = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(r)];
|
|
2863
|
+
return [...new Set(a.map((u) => u[1]))].map(
|
|
2862
2864
|
(u) => `https://drive.google.com/uc?export=view&id=${u}`
|
|
2863
2865
|
);
|
|
2864
2866
|
} catch (e) {
|
|
@@ -2950,13 +2952,13 @@ class ti {
|
|
|
2950
2952
|
if (!Array.isArray(t))
|
|
2951
2953
|
return console.warn("URLs must be an array:", t), [];
|
|
2952
2954
|
const e = [];
|
|
2953
|
-
for (const
|
|
2954
|
-
const
|
|
2955
|
-
if (!i.isAllowed(
|
|
2956
|
-
this.log(`Skipping filtered URL: ${
|
|
2955
|
+
for (const n of t) {
|
|
2956
|
+
const s = n.split("/").pop() || n;
|
|
2957
|
+
if (!i.isAllowed(s)) {
|
|
2958
|
+
this.log(`Skipping filtered URL: ${n}`);
|
|
2957
2959
|
continue;
|
|
2958
2960
|
}
|
|
2959
|
-
this.validateUrls ? await this.validateUrl(
|
|
2961
|
+
this.validateUrls ? await this.validateUrl(n) ? e.push(n) : console.warn(`Skipping invalid/missing URL: ${n}`) : e.push(n);
|
|
2960
2962
|
}
|
|
2961
2963
|
return e;
|
|
2962
2964
|
}
|
|
@@ -2970,16 +2972,16 @@ class ti {
|
|
|
2970
2972
|
async processPath(t, i, e) {
|
|
2971
2973
|
if (!Array.isArray(i))
|
|
2972
2974
|
return console.warn("files must be an array:", i), [];
|
|
2973
|
-
const
|
|
2974
|
-
for (const
|
|
2975
|
-
if (!e.isAllowed(
|
|
2976
|
-
this.log(`Skipping filtered file: ${
|
|
2975
|
+
const n = [];
|
|
2976
|
+
for (const s of i) {
|
|
2977
|
+
if (!e.isAllowed(s)) {
|
|
2978
|
+
this.log(`Skipping filtered file: ${s}`);
|
|
2977
2979
|
continue;
|
|
2978
2980
|
}
|
|
2979
|
-
const r = this.constructUrl(t,
|
|
2980
|
-
this.validateUrls ? await this.validateUrl(r) ?
|
|
2981
|
+
const r = this.constructUrl(t, s);
|
|
2982
|
+
this.validateUrls ? await this.validateUrl(r) ? n.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : n.push(r);
|
|
2981
2983
|
}
|
|
2982
|
-
return
|
|
2984
|
+
return n;
|
|
2983
2985
|
}
|
|
2984
2986
|
/**
|
|
2985
2987
|
* Process a JSON endpoint source
|
|
@@ -2990,17 +2992,17 @@ class ti {
|
|
|
2990
2992
|
*/
|
|
2991
2993
|
async processJson(t, i) {
|
|
2992
2994
|
this.log(`Fetching JSON endpoint: ${t}`);
|
|
2993
|
-
const e = new AbortController(),
|
|
2995
|
+
const e = new AbortController(), n = setTimeout(() => e.abort(), 1e4);
|
|
2994
2996
|
try {
|
|
2995
|
-
const
|
|
2996
|
-
if (clearTimeout(
|
|
2997
|
-
throw new Error(`HTTP ${
|
|
2998
|
-
const r = await
|
|
2997
|
+
const s = await fetch(t, { signal: e.signal });
|
|
2998
|
+
if (clearTimeout(n), !s.ok)
|
|
2999
|
+
throw new Error(`HTTP ${s.status} fetching ${t}`);
|
|
3000
|
+
const r = await s.json();
|
|
2999
3001
|
if (!r || !Array.isArray(r.images))
|
|
3000
3002
|
throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
|
|
3001
3003
|
return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, i);
|
|
3002
|
-
} catch (
|
|
3003
|
-
throw clearTimeout(
|
|
3004
|
+
} catch (s) {
|
|
3005
|
+
throw clearTimeout(n), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : s;
|
|
3004
3006
|
}
|
|
3005
3007
|
}
|
|
3006
3008
|
/**
|
|
@@ -3022,11 +3024,11 @@ class ti {
|
|
|
3022
3024
|
if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
|
|
3023
3025
|
return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
|
|
3024
3026
|
try {
|
|
3025
|
-
const e = new AbortController(),
|
|
3027
|
+
const e = new AbortController(), n = setTimeout(() => e.abort(), this.validationTimeout), s = await fetch(t, {
|
|
3026
3028
|
method: "HEAD",
|
|
3027
3029
|
signal: e.signal
|
|
3028
3030
|
});
|
|
3029
|
-
return clearTimeout(
|
|
3031
|
+
return clearTimeout(n), s.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${s.status}`), !1);
|
|
3030
3032
|
} catch (e) {
|
|
3031
3033
|
return e instanceof Error && (e.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, e.message)), !1;
|
|
3032
3034
|
}
|
|
@@ -3043,8 +3045,8 @@ class ti {
|
|
|
3043
3045
|
return `${e}/${i}`;
|
|
3044
3046
|
if (typeof window > "u")
|
|
3045
3047
|
return `${e}/${i}`;
|
|
3046
|
-
const
|
|
3047
|
-
return `${
|
|
3048
|
+
const n = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
|
|
3049
|
+
return `${n}${r}/${i}`;
|
|
3048
3050
|
}
|
|
3049
3051
|
/**
|
|
3050
3052
|
* Check if URL is absolute (contains protocol)
|
|
@@ -3078,16 +3080,16 @@ class ei {
|
|
|
3078
3080
|
*/
|
|
3079
3081
|
async prepare(t) {
|
|
3080
3082
|
this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
|
|
3081
|
-
const i = this.loaders.map((e,
|
|
3082
|
-
this.log(`Loader ${
|
|
3083
|
-
}).catch((
|
|
3084
|
-
console.warn(`Loader ${
|
|
3083
|
+
const i = this.loaders.map((e, n) => e.prepare(t).then(() => {
|
|
3084
|
+
this.log(`Loader ${n} prepared with ${e.imagesLength()} images`);
|
|
3085
|
+
}).catch((s) => {
|
|
3086
|
+
console.warn(`Loader ${n} failed to prepare:`, s);
|
|
3085
3087
|
}));
|
|
3086
3088
|
await Promise.all(i);
|
|
3087
3089
|
for (const e of this.loaders)
|
|
3088
3090
|
if (e.isPrepared()) {
|
|
3089
|
-
const
|
|
3090
|
-
this._discoveredUrls.push(...
|
|
3091
|
+
const n = e.imageURLs();
|
|
3092
|
+
this._discoveredUrls.push(...n);
|
|
3091
3093
|
}
|
|
3092
3094
|
this._prepared = !0, this.log(`CompositeLoader prepared with ${this._discoveredUrls.length} total images`);
|
|
3093
3095
|
}
|
|
@@ -3160,7 +3162,7 @@ class ii {
|
|
|
3160
3162
|
// isAllowedDate(date: Date): boolean
|
|
3161
3163
|
// isAllowedDimensions(width: number, height: number): boolean
|
|
3162
3164
|
}
|
|
3163
|
-
const
|
|
3165
|
+
const ni = `
|
|
3164
3166
|
.fbn-ic-gallery {
|
|
3165
3167
|
position: relative;
|
|
3166
3168
|
width: 100%;
|
|
@@ -3206,34 +3208,75 @@ const oi = `
|
|
|
3206
3208
|
pointer-events: none;
|
|
3207
3209
|
}
|
|
3208
3210
|
|
|
3211
|
+
.fbn-ic-gallery:focus,
|
|
3212
|
+
.fbn-ic-gallery.fbn-ic-has-focus {
|
|
3213
|
+
outline: 2px solid rgba(147, 197, 253, 0.8);
|
|
3214
|
+
outline-offset: -4px;
|
|
3215
|
+
}
|
|
3216
|
+
.fbn-ic-gallery.fbn-ic-suppress-outline:focus {
|
|
3217
|
+
outline: none;
|
|
3218
|
+
}
|
|
3219
|
+
.fbn-ic-gallery.fbn-ic-suppress-outline.fbn-ic-has-focus {
|
|
3220
|
+
outline: 2px solid rgba(99, 102, 241, 0.6);
|
|
3221
|
+
outline-offset: -4px;
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
.fbn-ic-nav-btn {
|
|
3225
|
+
position: absolute;
|
|
3226
|
+
top: 50%;
|
|
3227
|
+
transform: translateY(-50%);
|
|
3228
|
+
z-index: 10001;
|
|
3229
|
+
cursor: pointer;
|
|
3230
|
+
border: none;
|
|
3231
|
+
background: none;
|
|
3232
|
+
padding: 0;
|
|
3233
|
+
line-height: 1;
|
|
3234
|
+
}
|
|
3235
|
+
.fbn-ic-nav-btn-prev {
|
|
3236
|
+
left: 12px;
|
|
3237
|
+
}
|
|
3238
|
+
.fbn-ic-nav-btn-next {
|
|
3239
|
+
right: 12px;
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3209
3242
|
.fbn-ic-hidden {
|
|
3210
3243
|
display: none !important;
|
|
3211
3244
|
}
|
|
3212
3245
|
`;
|
|
3213
|
-
function
|
|
3246
|
+
function oi() {
|
|
3214
3247
|
if (typeof document > "u") return;
|
|
3215
|
-
const
|
|
3216
|
-
if (document.getElementById(
|
|
3248
|
+
const o = "fbn-ic-functional-styles";
|
|
3249
|
+
if (document.getElementById(o)) return;
|
|
3217
3250
|
const t = document.createElement("style");
|
|
3218
|
-
t.id =
|
|
3251
|
+
t.id = o, t.textContent = ni, document.head.appendChild(t);
|
|
3219
3252
|
}
|
|
3220
3253
|
let si = class {
|
|
3221
3254
|
constructor(t = {}) {
|
|
3222
|
-
this.fullConfig =
|
|
3255
|
+
this.fullConfig = oe(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.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new ce(this.fullConfig.animation), this.layoutEngine = new Ue({
|
|
3223
3256
|
layout: this.fullConfig.layout,
|
|
3224
3257
|
image: this.fullConfig.image
|
|
3225
|
-
}), this.zoomEngine = new
|
|
3226
|
-
const i = this.fullConfig.animation.entry ||
|
|
3258
|
+
}), this.zoomEngine = new qe(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3259
|
+
const i = this.fullConfig.animation.entry || A.animation.entry;
|
|
3227
3260
|
this.entryAnimationEngine = new ve(
|
|
3228
3261
|
i,
|
|
3229
3262
|
this.fullConfig.layout.algorithm
|
|
3230
3263
|
);
|
|
3231
3264
|
const e = this.fullConfig.animation.idle;
|
|
3232
|
-
e && e.type !== "none" ? this.idleAnimationEngine = new
|
|
3265
|
+
e && e.type !== "none" ? this.idleAnimationEngine = new Ee(
|
|
3233
3266
|
e,
|
|
3234
3267
|
i.timing?.duration ?? 600
|
|
3235
|
-
) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((
|
|
3236
|
-
this.idleAnimationEngine?.resumeForImage(
|
|
3268
|
+
) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
|
|
3269
|
+
this.idleAnimationEngine?.resumeForImage(n);
|
|
3270
|
+
const s = n;
|
|
3271
|
+
requestAnimationFrame(() => {
|
|
3272
|
+
if (s.matches(":hover") && this.fullConfig.styling?.hover) {
|
|
3273
|
+
const r = this.imageElements.indexOf(s);
|
|
3274
|
+
if (r !== -1) {
|
|
3275
|
+
const a = s.offsetHeight, c = s.cachedRenderedWidth;
|
|
3276
|
+
st(s, this.fullConfig.styling.hover, a, c), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[r] };
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
});
|
|
3237
3280
|
}), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
|
|
3238
3281
|
}
|
|
3239
3282
|
/**
|
|
@@ -3251,7 +3294,7 @@ let si = class {
|
|
|
3251
3294
|
const t = this.fullConfig.loaders, i = this.fullConfig.config.loaders ?? {};
|
|
3252
3295
|
if (!t || t.length === 0)
|
|
3253
3296
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
3254
|
-
const e = t.map((
|
|
3297
|
+
const e = t.map((n) => this.createLoaderFromEntry(n, i));
|
|
3255
3298
|
return e.length === 1 ? e[0] : new ei({
|
|
3256
3299
|
loaders: e,
|
|
3257
3300
|
debugLogging: this.fullConfig.config.debug?.loaders
|
|
@@ -3262,7 +3305,7 @@ let si = class {
|
|
|
3262
3305
|
*/
|
|
3263
3306
|
createLoaderFromEntry(t, i) {
|
|
3264
3307
|
if ("static" in t) {
|
|
3265
|
-
const e = t.static,
|
|
3308
|
+
const e = t.static, n = {
|
|
3266
3309
|
...e,
|
|
3267
3310
|
validateUrls: e.validateUrls ?? i.validateUrls,
|
|
3268
3311
|
validationTimeout: e.validationTimeout ?? i.validationTimeout,
|
|
@@ -3270,14 +3313,14 @@ let si = class {
|
|
|
3270
3313
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3271
3314
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3272
3315
|
};
|
|
3273
|
-
return new ti(
|
|
3316
|
+
return new ti(n);
|
|
3274
3317
|
} else if ("googleDrive" in t) {
|
|
3275
|
-
const e = t.googleDrive,
|
|
3318
|
+
const e = t.googleDrive, n = {
|
|
3276
3319
|
...e,
|
|
3277
3320
|
allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
|
|
3278
3321
|
debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
|
|
3279
3322
|
};
|
|
3280
|
-
return new Qe(
|
|
3323
|
+
return new Qe(n);
|
|
3281
3324
|
} else
|
|
3282
3325
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
3283
3326
|
}
|
|
@@ -3286,11 +3329,11 @@ let si = class {
|
|
|
3286
3329
|
*/
|
|
3287
3330
|
async init() {
|
|
3288
3331
|
try {
|
|
3289
|
-
if (
|
|
3332
|
+
if (oi(), this.containerRef)
|
|
3290
3333
|
this.containerEl = this.containerRef;
|
|
3291
3334
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
3292
3335
|
throw new Error(`Container #${this.containerId} not found`);
|
|
3293
|
-
this.containerEl.classList.add("fbn-ic-gallery"), this.containerEl.setAttribute("tabindex", "0"), this.fullConfig.interaction.navigation?.swipe !== !1 && (this.swipeEngine = new
|
|
3336
|
+
this.containerEl.classList.add("fbn-ic-gallery"), this.containerEl.setAttribute("tabindex", "0"), this.fullConfig.interaction.navigation?.swipe !== !1 && (this.swipeEngine = new bt(this.containerEl, {
|
|
3294
3337
|
onNext: () => this.navigateToNextImage(),
|
|
3295
3338
|
onPrev: () => this.navigateToPreviousImage(),
|
|
3296
3339
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
@@ -3304,7 +3347,11 @@ let si = class {
|
|
|
3304
3347
|
}
|
|
3305
3348
|
setupUI() {
|
|
3306
3349
|
const t = this.fullConfig.ui;
|
|
3307
|
-
t.showLoadingSpinner && (t.loadingElement ? (this.loadingEl = this.resolveElement(t.loadingElement), this.loadingElAutoCreated = !1) : (this.loadingEl = this.createDefaultLoadingElement(), this.loadingElAutoCreated = !0)), t.errorElement ? (this.errorEl = this.resolveElement(t.errorElement), this.errorElAutoCreated = !1) : (this.errorEl = this.createDefaultErrorElement(), this.errorElAutoCreated = !0), t.showImageCounter && (t.counterElement ? (this.counterEl = this.resolveElement(t.counterElement), this.counterElAutoCreated = !1) : (this.counterEl = this.createDefaultCounterElement(), this.counterElAutoCreated = !0))
|
|
3350
|
+
t.showFocusOutline ? this.containerEl?.classList.remove("fbn-ic-suppress-outline") : this.containerEl?.classList.add("fbn-ic-suppress-outline"), t.showLoadingSpinner && (t.loadingElement ? (this.loadingEl = this.resolveElement(t.loadingElement), this.loadingElAutoCreated = !1) : (this.loadingEl = this.createDefaultLoadingElement(), this.loadingElAutoCreated = !0)), t.errorElement ? (this.errorEl = this.resolveElement(t.errorElement), this.errorElAutoCreated = !1) : (this.errorEl = this.createDefaultErrorElement(), this.errorElAutoCreated = !0), t.showImageCounter && (t.counterElement ? (this.counterEl = this.resolveElement(t.counterElement), this.counterElAutoCreated = !1) : (this.counterEl = this.createDefaultCounterElement(), this.counterElAutoCreated = !0)), t.showNavButtons && (t.prevButtonElement ? (this.prevButtonEl = this.resolveElement(t.prevButtonElement), this.prevButtonElAutoCreated = !1) : (this.prevButtonEl = this.createDefaultPrevButtonElement(), this.prevButtonElAutoCreated = !0), t.nextButtonElement ? (this.nextButtonEl = this.resolveElement(t.nextButtonElement), this.nextButtonElAutoCreated = !1) : (this.nextButtonEl = this.createDefaultNextButtonElement(), this.nextButtonElAutoCreated = !0), this.prevButtonEl?.addEventListener("click", (i) => {
|
|
3351
|
+
i.stopPropagation(), this.navigateToPreviousImage();
|
|
3352
|
+
}), this.nextButtonEl?.addEventListener("click", (i) => {
|
|
3353
|
+
i.stopPropagation(), this.navigateToNextImage();
|
|
3354
|
+
}));
|
|
3308
3355
|
}
|
|
3309
3356
|
resolveElement(t) {
|
|
3310
3357
|
return t instanceof HTMLElement ? t : document.getElementById(t);
|
|
@@ -3325,11 +3372,19 @@ let si = class {
|
|
|
3325
3372
|
const t = document.createElement("div");
|
|
3326
3373
|
return t.className = "fbn-ic-counter fbn-ic-hidden", this.containerEl.appendChild(t), t;
|
|
3327
3374
|
}
|
|
3375
|
+
createDefaultPrevButtonElement() {
|
|
3376
|
+
const t = document.createElement("button");
|
|
3377
|
+
return t.className = "fbn-ic-nav-btn fbn-ic-nav-btn-prev fbn-ic-hidden", t.textContent = "‹", t.setAttribute("aria-label", "Previous image"), t.setAttribute("tabindex", "-1"), this.containerEl.appendChild(t), t;
|
|
3378
|
+
}
|
|
3379
|
+
createDefaultNextButtonElement() {
|
|
3380
|
+
const t = document.createElement("button");
|
|
3381
|
+
return t.className = "fbn-ic-nav-btn fbn-ic-nav-btn-next fbn-ic-hidden", t.textContent = "›", t.setAttribute("aria-label", "Next image"), t.setAttribute("tabindex", "-1"), this.containerEl.appendChild(t), t;
|
|
3382
|
+
}
|
|
3328
3383
|
setupEventListeners() {
|
|
3329
3384
|
this.fullConfig.interaction.navigation?.keyboard !== !1 && this.containerEl.addEventListener("keydown", (t) => {
|
|
3330
|
-
t.key === "Escape" ? (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter()) : t.key === "ArrowRight" ? this.navigateToNextImage() : t.key === "ArrowLeft" ? this.navigateToPreviousImage() : (t.key === "Enter" || t.key === " ") && this.hoveredImage && (this.handleImageClick(this.hoveredImage.element, this.hoveredImage.layout), t.preventDefault());
|
|
3385
|
+
t.key === "Escape" ? (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.hideFocusIndicator()) : t.key === "ArrowRight" ? this.navigateToNextImage() : t.key === "ArrowLeft" ? this.navigateToPreviousImage() : (t.key === "Enter" || t.key === " ") && this.hoveredImage && (this.handleImageClick(this.hoveredImage.element, this.hoveredImage.layout), t.preventDefault());
|
|
3331
3386
|
}), document.addEventListener("click", (t) => {
|
|
3332
|
-
this.swipeEngine?.hadRecentTouch() || t.target.closest(".fbn-ic-image")
|
|
3387
|
+
this.swipeEngine?.hadRecentTouch() || !t.target.closest(".fbn-ic-image") && !t.target.closest(".fbn-ic-nav-btn") && (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.hideFocusIndicator());
|
|
3333
3388
|
}), window.addEventListener("resize", () => this.handleResize());
|
|
3334
3389
|
}
|
|
3335
3390
|
/**
|
|
@@ -3338,11 +3393,11 @@ let si = class {
|
|
|
3338
3393
|
navigateToNextImage() {
|
|
3339
3394
|
if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
|
|
3340
3395
|
const t = (this.currentFocusIndex + 1) % this.imageLayouts.length, i = this.imageElements.find(
|
|
3341
|
-
(
|
|
3396
|
+
(n) => n.dataset.imageId === String(t)
|
|
3342
3397
|
);
|
|
3343
3398
|
if (!i) return;
|
|
3344
3399
|
const e = this.imageLayouts[t];
|
|
3345
|
-
e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t));
|
|
3400
|
+
e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t), this.showNavButtons(), this.showFocusIndicator());
|
|
3346
3401
|
}
|
|
3347
3402
|
/**
|
|
3348
3403
|
* Navigate to the previous image (Left arrow)
|
|
@@ -3350,11 +3405,11 @@ let si = class {
|
|
|
3350
3405
|
navigateToPreviousImage() {
|
|
3351
3406
|
if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
|
|
3352
3407
|
const t = (this.currentFocusIndex - 1 + this.imageLayouts.length) % this.imageLayouts.length, i = this.imageElements.find(
|
|
3353
|
-
(
|
|
3408
|
+
(n) => n.dataset.imageId === String(t)
|
|
3354
3409
|
);
|
|
3355
3410
|
if (!i) return;
|
|
3356
3411
|
const e = this.imageLayouts[t];
|
|
3357
|
-
e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t));
|
|
3412
|
+
e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t), this.showNavButtons(), this.showFocusIndicator());
|
|
3358
3413
|
}
|
|
3359
3414
|
/**
|
|
3360
3415
|
* Navigate to a specific image by index
|
|
@@ -3366,8 +3421,8 @@ let si = class {
|
|
|
3366
3421
|
}, 500));
|
|
3367
3422
|
}
|
|
3368
3423
|
getImageHeight() {
|
|
3369
|
-
const t = window.innerWidth, i = this.fullConfig.layout.responsive,
|
|
3370
|
-
return i ? t <= i.mobile.maxWidth ? Math.min(100,
|
|
3424
|
+
const t = window.innerWidth, i = this.fullConfig.layout.responsive, n = this.fullConfig.image.sizing?.maxSize ?? 400;
|
|
3425
|
+
return i ? t <= i.mobile.maxWidth ? Math.min(100, n) : t <= i.tablet.maxWidth ? Math.min(180, n) : Math.min(225, n) : t <= 767 ? Math.min(100, n) : t <= 1199 ? Math.min(180, n) : Math.min(225, n);
|
|
3371
3426
|
}
|
|
3372
3427
|
/**
|
|
3373
3428
|
* Get container bounds for layout calculations
|
|
@@ -3390,13 +3445,13 @@ let si = class {
|
|
|
3390
3445
|
this.showError("No images found."), this.showLoading(!1);
|
|
3391
3446
|
return;
|
|
3392
3447
|
}
|
|
3393
|
-
const e = this.getContainerBounds(),
|
|
3394
|
-
this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${
|
|
3448
|
+
const e = this.getContainerBounds(), n = this.getImageHeight(), s = window.innerWidth;
|
|
3449
|
+
this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${n}px`);
|
|
3395
3450
|
const r = this.layoutEngine.calculateAdaptiveSize(
|
|
3396
3451
|
e,
|
|
3397
3452
|
t,
|
|
3398
|
-
|
|
3399
|
-
|
|
3453
|
+
n,
|
|
3454
|
+
s
|
|
3400
3455
|
);
|
|
3401
3456
|
this.logDebug(`Adaptive sizing result: height=${r.height}px`), await this.createImageCloud(i, r.height), this.showLoading(!1), this.imagesLoaded = !0;
|
|
3402
3457
|
} catch (t) {
|
|
@@ -3413,164 +3468,164 @@ let si = class {
|
|
|
3413
3468
|
if (!this.containerEl) return;
|
|
3414
3469
|
const e = this.getContainerBounds();
|
|
3415
3470
|
this.currentImageHeight = i;
|
|
3416
|
-
const
|
|
3417
|
-
this.imageLayouts =
|
|
3471
|
+
const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
|
|
3472
|
+
this.imageLayouts = s, this.displayQueue = [];
|
|
3418
3473
|
let r = 0;
|
|
3419
|
-
const
|
|
3420
|
-
this.containerEl && (this.containerEl.appendChild(
|
|
3421
|
-
if (
|
|
3474
|
+
const a = (l) => {
|
|
3475
|
+
this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(() => {
|
|
3476
|
+
if (l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1", l.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)) {
|
|
3422
3477
|
const d = {
|
|
3423
|
-
x: parseFloat(
|
|
3424
|
-
y: parseFloat(
|
|
3425
|
-
},
|
|
3426
|
-
x: parseFloat(
|
|
3427
|
-
y: parseFloat(
|
|
3428
|
-
},
|
|
3478
|
+
x: parseFloat(l.dataset.startX),
|
|
3479
|
+
y: parseFloat(l.dataset.startY)
|
|
3480
|
+
}, g = {
|
|
3481
|
+
x: parseFloat(l.dataset.endX),
|
|
3482
|
+
y: parseFloat(l.dataset.endY)
|
|
3483
|
+
}, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), f = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : f, E = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
|
|
3429
3484
|
pe({
|
|
3430
|
-
element:
|
|
3485
|
+
element: l,
|
|
3431
3486
|
startPosition: d,
|
|
3432
|
-
endPosition:
|
|
3487
|
+
endPosition: g,
|
|
3433
3488
|
pathConfig: this.entryAnimationEngine.getPathConfig(),
|
|
3434
3489
|
duration: v.duration,
|
|
3435
|
-
imageWidth:
|
|
3490
|
+
imageWidth: b,
|
|
3436
3491
|
imageHeight: p,
|
|
3437
|
-
rotation:
|
|
3492
|
+
rotation: f,
|
|
3438
3493
|
scale: m,
|
|
3439
3494
|
rotationConfig: this.entryAnimationEngine.getRotationConfig(),
|
|
3440
|
-
startRotation:
|
|
3495
|
+
startRotation: y,
|
|
3441
3496
|
scaleConfig: this.entryAnimationEngine.getScaleConfig(),
|
|
3442
|
-
startScale:
|
|
3497
|
+
startScale: E
|
|
3443
3498
|
});
|
|
3444
3499
|
} else {
|
|
3445
|
-
const d =
|
|
3446
|
-
|
|
3500
|
+
const d = l.dataset.finalTransform || "";
|
|
3501
|
+
l.style.transform = d;
|
|
3447
3502
|
}
|
|
3448
|
-
const h = parseInt(
|
|
3503
|
+
const h = parseInt(l.dataset.imageId || "0");
|
|
3449
3504
|
if (this.fullConfig.config.debug?.enabled && h < 3) {
|
|
3450
|
-
const d =
|
|
3505
|
+
const d = l.dataset.finalTransform || "";
|
|
3451
3506
|
console.log(`Image ${h} final state:`, {
|
|
3452
|
-
left:
|
|
3453
|
-
top:
|
|
3454
|
-
width:
|
|
3455
|
-
height:
|
|
3456
|
-
computedWidth:
|
|
3457
|
-
computedHeight:
|
|
3507
|
+
left: l.style.left,
|
|
3508
|
+
top: l.style.top,
|
|
3509
|
+
width: l.style.width,
|
|
3510
|
+
height: l.style.height,
|
|
3511
|
+
computedWidth: l.offsetWidth,
|
|
3512
|
+
computedHeight: l.offsetHeight,
|
|
3458
3513
|
transform: d,
|
|
3459
3514
|
pathType: this.entryAnimationEngine.getPathType()
|
|
3460
3515
|
});
|
|
3461
3516
|
}
|
|
3462
3517
|
if (this.idleAnimationEngine) {
|
|
3463
3518
|
const d = this.entryAnimationEngine.getTiming().duration;
|
|
3464
|
-
this.idleAnimationEngine.register(
|
|
3519
|
+
this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
|
|
3465
3520
|
}
|
|
3466
3521
|
}), r++);
|
|
3467
|
-
},
|
|
3522
|
+
}, c = () => {
|
|
3468
3523
|
if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
|
|
3469
3524
|
for (; this.displayQueue.length > 0; ) {
|
|
3470
|
-
const
|
|
3471
|
-
|
|
3525
|
+
const l = this.displayQueue.shift();
|
|
3526
|
+
l && a(l);
|
|
3472
3527
|
}
|
|
3473
3528
|
return;
|
|
3474
3529
|
}
|
|
3475
3530
|
this.queueInterval !== null && clearInterval(this.queueInterval), this.queueInterval = window.setInterval(() => {
|
|
3476
|
-
if (
|
|
3531
|
+
if (n !== this.loadGeneration) {
|
|
3477
3532
|
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3478
3533
|
return;
|
|
3479
3534
|
}
|
|
3480
3535
|
if (this.displayQueue.length > 0) {
|
|
3481
|
-
const
|
|
3482
|
-
|
|
3536
|
+
const l = this.displayQueue.shift();
|
|
3537
|
+
l && a(l);
|
|
3483
3538
|
}
|
|
3484
3539
|
r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3485
3540
|
}, this.fullConfig.animation.queue.interval);
|
|
3486
3541
|
};
|
|
3487
3542
|
if ("IntersectionObserver" in window && this.containerEl) {
|
|
3488
|
-
const
|
|
3543
|
+
const l = new IntersectionObserver((u) => {
|
|
3489
3544
|
u.forEach((h) => {
|
|
3490
|
-
h.isIntersecting && (
|
|
3545
|
+
h.isIntersecting && (c(), l.disconnect());
|
|
3491
3546
|
});
|
|
3492
3547
|
}, { threshold: 0.1, rootMargin: "50px" });
|
|
3493
|
-
|
|
3548
|
+
l.observe(this.containerEl);
|
|
3494
3549
|
} else
|
|
3495
|
-
|
|
3496
|
-
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((
|
|
3550
|
+
c();
|
|
3551
|
+
this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, u) => {
|
|
3497
3552
|
const h = document.createElement("div");
|
|
3498
3553
|
h.className = "fbn-ic-debug-center", h.style.position = "absolute", h.style.width = "12px", h.style.height = "12px", h.style.borderRadius = "50%", h.style.backgroundColor = "red", h.style.border = "2px solid yellow", h.style.zIndex = "9999", h.style.pointerEvents = "none";
|
|
3499
|
-
const d =
|
|
3500
|
-
h.style.left = `${d - 6}px`, h.style.top = `${
|
|
3501
|
-
})), t.forEach((
|
|
3554
|
+
const d = l.x, g = l.y;
|
|
3555
|
+
h.style.left = `${d - 6}px`, h.style.top = `${g - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(g)})`, this.containerEl.appendChild(h);
|
|
3556
|
+
})), t.forEach((l, u) => {
|
|
3502
3557
|
const h = document.createElement("img");
|
|
3503
3558
|
h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
|
|
3504
|
-
const d =
|
|
3505
|
-
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)),
|
|
3559
|
+
const d = s[u];
|
|
3560
|
+
h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
|
|
3506
3561
|
if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
|
|
3507
|
-
const
|
|
3508
|
-
|
|
3562
|
+
const g = h.cachedRenderedWidth;
|
|
3563
|
+
st(h, this.fullConfig.styling?.hover, i, g), et(h, this.hoverClassName);
|
|
3509
3564
|
}
|
|
3510
3565
|
}), h.addEventListener("mouseleave", () => {
|
|
3511
3566
|
if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
|
|
3512
|
-
const
|
|
3513
|
-
|
|
3567
|
+
const g = h.cachedRenderedWidth;
|
|
3568
|
+
st(h, this.fullConfig.styling?.default, i, g), pt(h, this.hoverClassName), et(h, this.defaultClassName);
|
|
3514
3569
|
}
|
|
3515
|
-
}), h.addEventListener("click", (
|
|
3516
|
-
|
|
3570
|
+
}), h.addEventListener("click", (g) => {
|
|
3571
|
+
g.stopPropagation(), this.handleImageClick(h, d);
|
|
3517
3572
|
}), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
|
|
3518
|
-
if (
|
|
3573
|
+
if (n !== this.loadGeneration)
|
|
3519
3574
|
return;
|
|
3520
|
-
const
|
|
3521
|
-
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${
|
|
3522
|
-
const p = { x: d.x, y: d.y },
|
|
3575
|
+
const g = h.naturalWidth / h.naturalHeight, b = i * g;
|
|
3576
|
+
h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${b}`), h.style.width = `${b}px`, h.cachedRenderedWidth = b, h.aspectRatio = g, st(h, this.fullConfig.styling?.default, i, b);
|
|
3577
|
+
const p = { x: d.x, y: d.y }, f = { width: b, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
|
|
3523
3578
|
p,
|
|
3524
|
-
|
|
3579
|
+
f,
|
|
3525
3580
|
e,
|
|
3526
3581
|
u,
|
|
3527
3582
|
t.length
|
|
3528
|
-
),
|
|
3583
|
+
), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), E = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
|
|
3529
3584
|
d.rotation,
|
|
3530
3585
|
d.scale,
|
|
3531
|
-
|
|
3586
|
+
b,
|
|
3532
3587
|
i
|
|
3533
3588
|
), S = this.entryAnimationEngine.buildStartTransform(
|
|
3534
3589
|
m,
|
|
3535
3590
|
p,
|
|
3536
3591
|
d.rotation,
|
|
3537
3592
|
d.scale,
|
|
3538
|
-
y,
|
|
3539
|
-
i,
|
|
3540
3593
|
b,
|
|
3541
|
-
|
|
3594
|
+
i,
|
|
3595
|
+
y,
|
|
3596
|
+
E
|
|
3542
3597
|
);
|
|
3543
3598
|
this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
|
|
3544
3599
|
finalPosition: p,
|
|
3545
|
-
imageSize:
|
|
3600
|
+
imageSize: f,
|
|
3546
3601
|
left: d.x,
|
|
3547
3602
|
top: d.y,
|
|
3548
3603
|
finalTransform: v,
|
|
3549
|
-
renderedWidth:
|
|
3604
|
+
renderedWidth: b,
|
|
3550
3605
|
renderedHeight: i
|
|
3551
|
-
}), h.style.transform = S, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() ||
|
|
3552
|
-
}, h.onerror = () => r++, h.src =
|
|
3606
|
+
}), h.style.transform = S, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || E !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(E)), this.displayQueue.push(h);
|
|
3607
|
+
}, h.onerror = () => r++, h.src = l;
|
|
3553
3608
|
});
|
|
3554
3609
|
}
|
|
3555
3610
|
async handleImageClick(t, i) {
|
|
3556
3611
|
if (!this.containerEl) return;
|
|
3557
|
-
const e = this.zoomEngine.isFocused(t),
|
|
3612
|
+
const e = this.zoomEngine.isFocused(t), n = {
|
|
3558
3613
|
width: this.containerEl.offsetWidth,
|
|
3559
3614
|
height: this.containerEl.offsetHeight
|
|
3560
3615
|
};
|
|
3561
3616
|
if (e)
|
|
3562
|
-
await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter();
|
|
3617
|
+
await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.hideFocusIndicator();
|
|
3563
3618
|
else {
|
|
3564
3619
|
this.idleAnimationEngine?.pauseForImage(t);
|
|
3565
|
-
const
|
|
3566
|
-
this.currentFocusIndex =
|
|
3620
|
+
const s = t.dataset.imageId;
|
|
3621
|
+
this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator();
|
|
3567
3622
|
}
|
|
3568
3623
|
}
|
|
3569
3624
|
/**
|
|
3570
3625
|
* Clear the image cloud and reset state
|
|
3571
3626
|
*/
|
|
3572
3627
|
clearImageCloud() {
|
|
3573
|
-
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.idleAnimationEngine?.stopAll(), this.imagesLoaded = !1;
|
|
3628
|
+
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.hideFocusIndicator(), this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.idleAnimationEngine?.stopAll(), this.imagesLoaded = !1;
|
|
3574
3629
|
}
|
|
3575
3630
|
showLoading(t) {
|
|
3576
3631
|
!this.fullConfig.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
|
|
@@ -3587,11 +3642,23 @@ let si = class {
|
|
|
3587
3642
|
hideCounter() {
|
|
3588
3643
|
this.counterEl && this.counterEl.classList.add("fbn-ic-hidden");
|
|
3589
3644
|
}
|
|
3645
|
+
showFocusIndicator() {
|
|
3646
|
+
this.containerEl?.classList.add("fbn-ic-has-focus");
|
|
3647
|
+
}
|
|
3648
|
+
hideFocusIndicator() {
|
|
3649
|
+
this.containerEl?.classList.remove("fbn-ic-has-focus");
|
|
3650
|
+
}
|
|
3651
|
+
showNavButtons() {
|
|
3652
|
+
this.prevButtonEl?.classList.remove("fbn-ic-hidden"), this.nextButtonEl?.classList.remove("fbn-ic-hidden");
|
|
3653
|
+
}
|
|
3654
|
+
hideNavButtons() {
|
|
3655
|
+
this.prevButtonEl?.classList.add("fbn-ic-hidden"), this.nextButtonEl?.classList.add("fbn-ic-hidden");
|
|
3656
|
+
}
|
|
3590
3657
|
/**
|
|
3591
3658
|
* Destroy the gallery and clean up resources
|
|
3592
3659
|
*/
|
|
3593
3660
|
destroy() {
|
|
3594
|
-
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(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
|
|
3661
|
+
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.prevButtonElAutoCreated && this.prevButtonEl && (this.prevButtonEl.remove(), this.prevButtonEl = null), this.nextButtonElAutoCreated && this.nextButtonEl && (this.nextButtonEl.remove(), this.nextButtonEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
|
|
3595
3662
|
}
|
|
3596
3663
|
};
|
|
3597
3664
|
const ci = Ht({
|
|
@@ -3602,30 +3669,30 @@ const ci = Ht({
|
|
|
3602
3669
|
required: !0
|
|
3603
3670
|
}
|
|
3604
3671
|
},
|
|
3605
|
-
setup(
|
|
3672
|
+
setup(o, { expose: t }) {
|
|
3606
3673
|
const i = It(null), e = It(null);
|
|
3607
|
-
function
|
|
3674
|
+
function n() {
|
|
3608
3675
|
if (!i.value) return;
|
|
3609
3676
|
e.value?.destroy();
|
|
3610
|
-
const
|
|
3677
|
+
const s = new si({
|
|
3611
3678
|
container: i.value,
|
|
3612
|
-
...
|
|
3679
|
+
...o.options
|
|
3613
3680
|
});
|
|
3614
|
-
e.value =
|
|
3681
|
+
e.value = s, s.init().catch((r) => {
|
|
3615
3682
|
console.error("ImageCloud init failed:", r);
|
|
3616
3683
|
});
|
|
3617
3684
|
}
|
|
3618
3685
|
return Nt(() => {
|
|
3619
|
-
|
|
3686
|
+
n();
|
|
3620
3687
|
}), kt(() => {
|
|
3621
3688
|
e.value?.destroy(), e.value = null;
|
|
3622
|
-
}),
|
|
3623
|
-
() =>
|
|
3689
|
+
}), Bt(
|
|
3690
|
+
() => o.options,
|
|
3624
3691
|
() => {
|
|
3625
|
-
|
|
3692
|
+
n();
|
|
3626
3693
|
},
|
|
3627
3694
|
{ deep: !0 }
|
|
3628
|
-
), t({ instance: e }), () =>
|
|
3695
|
+
), t({ instance: e }), () => jt("div", {
|
|
3629
3696
|
ref: i
|
|
3630
3697
|
});
|
|
3631
3698
|
}
|