@frybynite/image-cloud 0.3.4 → 0.3.6
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 +486 -465
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +216 -195
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +11 -2
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const kt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary: #1a1a2e;--fbn-ic-bg-glass: rgba(255, 255, 255, .05);--fbn-ic-border-glass: rgba(255, 255, 255, .1);--fbn-ic-text-primary: #ffffff;--fbn-ic-text-secondary: #b8b8d1;--fbn-ic-text-muted: #6b6b8f;--fbn-ic-accent-primary: #6366f1;--fbn-ic-accent-secondary: #8b5cf6;--fbn-ic-accent-glow: rgba(99, 102, 241, .4);--fbn-ic-transition-smooth: cubic-bezier(.4, 0, .2, 1);--fbn-ic-transition-bounce: cubic-bezier(.68, -.55, .265, 1.55);--fbn-ic-shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);--fbn-ic-shadow-md: 0 4px 16px rgba(0, 0, 0, .4);--fbn-ic-shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);--fbn-ic-shadow-glow: 0 0 20px var(--fbn-ic-accent-glow)}.fbn-ic-gallery{position:relative;width:100%;height:100%;overflow:hidden;perspective:1000px}.fbn-ic-image{position:absolute;border-radius:8px;box-shadow:var(--fbn-ic-shadow-md);cursor:pointer;transition:transform .6s var(--fbn-ic-transition-smooth),box-shadow .6s var(--fbn-ic-transition-smooth),filter .3s var(--fbn-ic-transition-smooth),opacity .3s var(--fbn-ic-transition-smooth),border .3s var(--fbn-ic-transition-smooth),outline .3s var(--fbn-ic-transition-smooth),z-index 0s .6s;will-change:transform;-webkit-user-select:none;user-select:none;backface-visibility:hidden;-webkit-backface-visibility:hidden}.fbn-ic-image:hover{box-shadow:var(--fbn-ic-shadow-lg)}.fbn-ic-image.fbn-ic-focused{z-index:1000;box-shadow:0 20px 60px #000000b3,var(--fbn-ic-shadow-glow);transition:transform .6s var(--fbn-ic-transition-smooth),box-shadow .6s var(--fbn-ic-transition-smooth),filter .3s var(--fbn-ic-transition-smooth),opacity .3s var(--fbn-ic-transition-smooth),border .3s var(--fbn-ic-transition-smooth),outline .3s var(--fbn-ic-transition-smooth),z-index 0s 0s;will-change:auto}.fbn-ic-loading{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;color:var(--fbn-ic-text-secondary);z-index:100;pointer-events:none}.fbn-ic-spinner{width:50px;height:50px;margin:0 auto 1rem;border:4px solid var(--fbn-ic-border-glass);border-top:4px solid var(--fbn-ic-accent-primary);border-radius:50%;animation:fbn-ic-spin 1s linear infinite}@keyframes fbn-ic-spin{to{transform:rotate(360deg)}}.fbn-ic-error{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:600px;padding:1.5rem;background:#ef44441a;border:1px solid rgba(239,68,68,.3);border-radius:12px;color:#fca5a5;text-align:center;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);z-index:100}.fbn-ic-hidden{display:none!important}",
|
|
1
|
+
const kt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary: #1a1a2e;--fbn-ic-bg-glass: rgba(255, 255, 255, .05);--fbn-ic-border-glass: rgba(255, 255, 255, .1);--fbn-ic-text-primary: #ffffff;--fbn-ic-text-secondary: #b8b8d1;--fbn-ic-text-muted: #6b6b8f;--fbn-ic-accent-primary: #6366f1;--fbn-ic-accent-secondary: #8b5cf6;--fbn-ic-accent-glow: rgba(99, 102, 241, .4);--fbn-ic-transition-smooth: cubic-bezier(.4, 0, .2, 1);--fbn-ic-transition-bounce: cubic-bezier(.68, -.55, .265, 1.55);--fbn-ic-shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);--fbn-ic-shadow-md: 0 4px 16px rgba(0, 0, 0, .4);--fbn-ic-shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);--fbn-ic-shadow-glow: 0 0 20px var(--fbn-ic-accent-glow)}.fbn-ic-gallery{position:relative;width:100%;height:100%;overflow:hidden;perspective:1000px}.fbn-ic-image{position:absolute;border-radius:8px;box-shadow:var(--fbn-ic-shadow-md);cursor:pointer;transition:transform .6s var(--fbn-ic-transition-smooth),box-shadow .6s var(--fbn-ic-transition-smooth),filter .3s var(--fbn-ic-transition-smooth),opacity .3s var(--fbn-ic-transition-smooth),border .3s var(--fbn-ic-transition-smooth),outline .3s var(--fbn-ic-transition-smooth),z-index 0s .6s;will-change:transform;-webkit-user-select:none;user-select:none;backface-visibility:hidden;-webkit-backface-visibility:hidden}.fbn-ic-image:hover{box-shadow:var(--fbn-ic-shadow-lg)}.fbn-ic-image.fbn-ic-focused{z-index:1000;box-shadow:0 20px 60px #000000b3,var(--fbn-ic-shadow-glow);transition:transform .6s var(--fbn-ic-transition-smooth),box-shadow .6s var(--fbn-ic-transition-smooth),filter .3s var(--fbn-ic-transition-smooth),opacity .3s var(--fbn-ic-transition-smooth),border .3s var(--fbn-ic-transition-smooth),outline .3s var(--fbn-ic-transition-smooth),z-index 0s 0s;will-change:auto}.fbn-ic-loading{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;color:var(--fbn-ic-text-secondary);z-index:100;pointer-events:none}.fbn-ic-spinner{width:50px;height:50px;margin:0 auto 1rem;border:4px solid var(--fbn-ic-border-glass);border-top:4px solid var(--fbn-ic-accent-primary);border-radius:50%;animation:fbn-ic-spin 1s linear infinite}@keyframes fbn-ic-spin{to{transform:rotate(360deg)}}.fbn-ic-error{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:600px;padding:1.5rem;background:#ef44441a;border:1px solid rgba(239,68,68,.3);border-radius:12px;color:#fca5a5;text-align:center;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);z-index:100}.fbn-ic-counter{background:#0009;color:#fff;padding:6px 16px;border-radius:16px;font-family:system-ui,sans-serif;font-size:14px}.fbn-ic-hidden{display:none!important}", St = Object.freeze({
|
|
2
2
|
none: "none",
|
|
3
3
|
sm: "0 2px 4px rgba(0,0,0,0.1)",
|
|
4
4
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
@@ -20,7 +20,7 @@ const kt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
20
20
|
flutter: Object.freeze({ amplitude: 20, frequency: 4, decay: !0, decayRate: 0.5, phase: 0 })
|
|
21
21
|
}), Tt = Object.freeze({
|
|
22
22
|
type: "linear"
|
|
23
|
-
}),
|
|
23
|
+
}), Ct = Object.freeze({
|
|
24
24
|
mode: "none"
|
|
25
25
|
}), At = Object.freeze({
|
|
26
26
|
mode: "none"
|
|
@@ -87,7 +87,7 @@ const kt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
87
87
|
failOnAllMissing: !0,
|
|
88
88
|
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"],
|
|
89
89
|
debugLogging: !1
|
|
90
|
-
}),
|
|
90
|
+
}), E = Object.freeze({
|
|
91
91
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
92
92
|
loaders: [],
|
|
93
93
|
// Shared loader settings
|
|
@@ -162,7 +162,7 @@ const kt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
162
162
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
|
|
163
163
|
// smooth deceleration
|
|
164
164
|
path: Tt,
|
|
165
|
-
rotation:
|
|
165
|
+
rotation: Ct,
|
|
166
166
|
scale: At
|
|
167
167
|
})
|
|
168
168
|
}),
|
|
@@ -204,8 +204,7 @@ const kt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
204
204
|
}),
|
|
205
205
|
ui: Object.freeze({
|
|
206
206
|
showLoadingSpinner: !1,
|
|
207
|
-
showImageCounter:
|
|
208
|
-
// STUB: Not implemented yet
|
|
207
|
+
showImageCounter: !1,
|
|
209
208
|
showThumbnails: void 0,
|
|
210
209
|
// STUB: Not implemented yet
|
|
211
210
|
theme: void 0
|
|
@@ -225,50 +224,50 @@ const kt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
225
224
|
// Debug mode
|
|
226
225
|
debug: !1
|
|
227
226
|
});
|
|
228
|
-
function rt(
|
|
229
|
-
if (!
|
|
230
|
-
if (!t) return { ...
|
|
231
|
-
const e = { ...
|
|
232
|
-
return t.border !== void 0 && (e.border = { ...
|
|
227
|
+
function rt(o, t) {
|
|
228
|
+
if (!o) return t || {};
|
|
229
|
+
if (!t) return { ...o };
|
|
230
|
+
const e = { ...o };
|
|
231
|
+
return t.border !== void 0 && (e.border = { ...o.border, ...t.border }), t.borderTop !== void 0 && (e.borderTop = { ...o.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (e.borderRight = { ...o.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (e.borderBottom = { ...o.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (e.borderLeft = { ...o.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (e.filter = { ...o.filter, ...t.filter }), t.outline !== void 0 && (e.outline = { ...o.outline, ...t.outline }), t.shadow !== void 0 && (e.shadow = t.shadow), t.opacity !== void 0 && (e.opacity = t.opacity), t.cursor !== void 0 && (e.cursor = t.cursor), t.className !== void 0 && (e.className = t.className), t.objectFit !== void 0 && (e.objectFit = t.objectFit), t.aspectRatio !== void 0 && (e.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (e.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (e.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (e.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (e.borderRadiusBottomLeft = t.borderRadiusBottomLeft), e;
|
|
233
232
|
}
|
|
234
|
-
function Yt(
|
|
235
|
-
if (!t) return { ...
|
|
236
|
-
const e = rt(
|
|
237
|
-
rt(e,
|
|
233
|
+
function Yt(o, t) {
|
|
234
|
+
if (!t) return { ...o };
|
|
235
|
+
const e = rt(o.default, t.default), i = rt(
|
|
236
|
+
rt(e, o.hover),
|
|
238
237
|
t.hover
|
|
239
|
-
),
|
|
240
|
-
rt(e,
|
|
238
|
+
), n = rt(
|
|
239
|
+
rt(e, o.focused),
|
|
241
240
|
t.focused
|
|
242
241
|
);
|
|
243
242
|
return {
|
|
244
243
|
default: e,
|
|
245
244
|
hover: i,
|
|
246
|
-
focused:
|
|
245
|
+
focused: n
|
|
247
246
|
};
|
|
248
247
|
}
|
|
249
|
-
function Xt(
|
|
250
|
-
var i,
|
|
251
|
-
if (!t) return { ...
|
|
252
|
-
const e = { ...
|
|
248
|
+
function Xt(o, t) {
|
|
249
|
+
var i, n, a, r, s, h, l, u;
|
|
250
|
+
if (!t) return { ...o };
|
|
251
|
+
const e = { ...o };
|
|
253
252
|
if (t.sizing !== void 0 && (e.sizing = {
|
|
254
|
-
...
|
|
253
|
+
...o.sizing,
|
|
255
254
|
...t.sizing
|
|
256
255
|
}, t.sizing.variance)) {
|
|
257
|
-
const c = t.sizing.variance, d = c.min !== void 0 && c.min >= 0.25 && c.min <= 1 ? c.min : ((
|
|
256
|
+
const c = t.sizing.variance, d = c.min !== void 0 && c.min >= 0.25 && c.min <= 1 ? c.min : ((n = (i = o.sizing) == null ? void 0 : i.variance) == null ? void 0 : n.min) ?? 1, m = c.max !== void 0 && c.max >= 1 && c.max <= 1.75 ? c.max : ((r = (a = o.sizing) == null ? void 0 : a.variance) == null ? void 0 : r.max) ?? 1;
|
|
258
257
|
e.sizing.variance = { min: d, max: m };
|
|
259
258
|
}
|
|
260
259
|
if (t.rotation !== void 0 && (e.rotation = {
|
|
261
|
-
...
|
|
260
|
+
...o.rotation,
|
|
262
261
|
...t.rotation
|
|
263
262
|
}, t.rotation.range)) {
|
|
264
|
-
const c = t.rotation.range, d = c.min !== void 0 && c.min >= -180 && c.min <= 0 ? c.min : ((h = (s =
|
|
263
|
+
const c = t.rotation.range, d = c.min !== void 0 && c.min >= -180 && c.min <= 0 ? c.min : ((h = (s = o.rotation) == null ? void 0 : s.range) == null ? void 0 : h.min) ?? -15, m = c.max !== void 0 && c.max >= 0 && c.max <= 180 ? c.max : ((u = (l = o.rotation) == null ? void 0 : l.range) == null ? void 0 : u.max) ?? 15;
|
|
265
264
|
e.rotation.range = { min: d, max: m };
|
|
266
265
|
}
|
|
267
266
|
return e;
|
|
268
267
|
}
|
|
269
|
-
function Bt(
|
|
268
|
+
function Bt(o) {
|
|
270
269
|
var e;
|
|
271
|
-
const t = (e =
|
|
270
|
+
const t = (e = o.layout) == null ? void 0 : e.rotation;
|
|
272
271
|
if (t && "enabled" in t)
|
|
273
272
|
return {
|
|
274
273
|
rotation: {
|
|
@@ -277,9 +276,9 @@ function Bt(n) {
|
|
|
277
276
|
}
|
|
278
277
|
};
|
|
279
278
|
}
|
|
280
|
-
function Jt(
|
|
279
|
+
function Jt(o) {
|
|
281
280
|
var e, i;
|
|
282
|
-
const t = (i = (e =
|
|
281
|
+
const t = (i = (e = o.layout) == null ? void 0 : e.sizing) == null ? void 0 : i.variance;
|
|
283
282
|
if (t)
|
|
284
283
|
return {
|
|
285
284
|
sizing: {
|
|
@@ -289,110 +288,110 @@ function Jt(n) {
|
|
|
289
288
|
}
|
|
290
289
|
};
|
|
291
290
|
}
|
|
292
|
-
function Vt(
|
|
291
|
+
function Vt(o = {}) {
|
|
293
292
|
var h, l;
|
|
294
|
-
const t = Bt(
|
|
295
|
-
let i =
|
|
293
|
+
const t = Bt(o), e = Jt(o);
|
|
294
|
+
let i = o.image;
|
|
296
295
|
(t || e) && (i = {
|
|
297
296
|
...e || {},
|
|
298
297
|
...t || {},
|
|
299
298
|
...i
|
|
300
|
-
}, i.rotation && (t != null && t.rotation) && ((h =
|
|
299
|
+
}, i.rotation && (t != null && t.rotation) && ((h = o.image) != null && h.rotation) && (i.rotation = {
|
|
301
300
|
...t.rotation,
|
|
302
|
-
...
|
|
301
|
+
...o.image.rotation
|
|
303
302
|
}));
|
|
304
|
-
const
|
|
305
|
-
|
|
303
|
+
const n = [...o.loaders ?? []];
|
|
304
|
+
o.images && o.images.length > 0 && n.unshift({
|
|
306
305
|
static: {
|
|
307
|
-
sources: [{ urls:
|
|
306
|
+
sources: [{ urls: o.images }]
|
|
308
307
|
}
|
|
309
308
|
});
|
|
310
309
|
const r = {
|
|
311
310
|
loaders: {
|
|
312
311
|
...Ut,
|
|
313
|
-
...((l =
|
|
312
|
+
...((l = o.config) == null ? void 0 : l.loaders) ?? {}
|
|
314
313
|
}
|
|
315
314
|
}, s = {
|
|
316
|
-
loaders:
|
|
315
|
+
loaders: n,
|
|
317
316
|
config: r,
|
|
318
317
|
image: Xt(Dt, i),
|
|
319
|
-
layout: { ...
|
|
320
|
-
animation: { ...
|
|
321
|
-
interaction: { ...
|
|
322
|
-
rendering: { ...
|
|
323
|
-
styling: Yt($t,
|
|
324
|
-
debug:
|
|
318
|
+
layout: { ...E.layout },
|
|
319
|
+
animation: { ...E.animation },
|
|
320
|
+
interaction: { ...E.interaction },
|
|
321
|
+
rendering: { ...E.rendering },
|
|
322
|
+
styling: Yt($t, o.styling),
|
|
323
|
+
debug: E.debug
|
|
325
324
|
};
|
|
326
|
-
return
|
|
327
|
-
...
|
|
328
|
-
...
|
|
329
|
-
},
|
|
330
|
-
...
|
|
331
|
-
mobile:
|
|
332
|
-
tablet:
|
|
333
|
-
}),
|
|
334
|
-
...
|
|
335
|
-
...
|
|
336
|
-
})),
|
|
337
|
-
...
|
|
338
|
-
...
|
|
339
|
-
},
|
|
340
|
-
...
|
|
341
|
-
...
|
|
342
|
-
}),
|
|
343
|
-
...
|
|
344
|
-
...
|
|
345
|
-
}),
|
|
346
|
-
...
|
|
347
|
-
...
|
|
348
|
-
}),
|
|
349
|
-
...
|
|
350
|
-
...
|
|
351
|
-
start:
|
|
352
|
-
...
|
|
353
|
-
...
|
|
354
|
-
circular:
|
|
355
|
-
} :
|
|
356
|
-
timing:
|
|
357
|
-
path:
|
|
358
|
-
rotation:
|
|
359
|
-
scale:
|
|
360
|
-
})),
|
|
361
|
-
...
|
|
362
|
-
...
|
|
363
|
-
},
|
|
364
|
-
...
|
|
365
|
-
...
|
|
366
|
-
}),
|
|
367
|
-
...
|
|
368
|
-
...
|
|
369
|
-
}),
|
|
370
|
-
...
|
|
371
|
-
...
|
|
372
|
-
})),
|
|
373
|
-
...
|
|
374
|
-
...
|
|
375
|
-
},
|
|
376
|
-
...
|
|
377
|
-
...
|
|
378
|
-
breakpoints:
|
|
379
|
-
mobileDetection:
|
|
380
|
-
}),
|
|
381
|
-
...
|
|
382
|
-
...
|
|
383
|
-
}),
|
|
384
|
-
...
|
|
385
|
-
...
|
|
386
|
-
})),
|
|
325
|
+
return o.layout && (s.layout = {
|
|
326
|
+
...E.layout,
|
|
327
|
+
...o.layout
|
|
328
|
+
}, o.layout.responsive && (s.layout.responsive = {
|
|
329
|
+
...E.layout.responsive,
|
|
330
|
+
mobile: o.layout.responsive.mobile ? { ...E.layout.responsive.mobile, ...o.layout.responsive.mobile } : E.layout.responsive.mobile,
|
|
331
|
+
tablet: o.layout.responsive.tablet ? { ...E.layout.responsive.tablet, ...o.layout.responsive.tablet } : E.layout.responsive.tablet
|
|
332
|
+
}), o.layout.spacing && (s.layout.spacing = {
|
|
333
|
+
...E.layout.spacing,
|
|
334
|
+
...o.layout.spacing
|
|
335
|
+
})), o.animation && (s.animation = {
|
|
336
|
+
...E.animation,
|
|
337
|
+
...o.animation
|
|
338
|
+
}, o.animation.easing && (s.animation.easing = {
|
|
339
|
+
...E.animation.easing,
|
|
340
|
+
...o.animation.easing
|
|
341
|
+
}), o.animation.queue && (s.animation.queue = {
|
|
342
|
+
...E.animation.queue,
|
|
343
|
+
...o.animation.queue
|
|
344
|
+
}), o.animation.performance && (s.animation.performance = {
|
|
345
|
+
...E.animation.performance,
|
|
346
|
+
...o.animation.performance
|
|
347
|
+
}), o.animation.entry && (s.animation.entry = {
|
|
348
|
+
...E.animation.entry,
|
|
349
|
+
...o.animation.entry,
|
|
350
|
+
start: o.animation.entry.start ? {
|
|
351
|
+
...E.animation.entry.start,
|
|
352
|
+
...o.animation.entry.start,
|
|
353
|
+
circular: o.animation.entry.start.circular ? { ...E.animation.entry.start.circular, ...o.animation.entry.start.circular } : E.animation.entry.start.circular
|
|
354
|
+
} : E.animation.entry.start,
|
|
355
|
+
timing: o.animation.entry.timing ? { ...E.animation.entry.timing, ...o.animation.entry.timing } : E.animation.entry.timing,
|
|
356
|
+
path: o.animation.entry.path ? { ...Tt, ...o.animation.entry.path } : E.animation.entry.path,
|
|
357
|
+
rotation: o.animation.entry.rotation ? { ...Ct, ...o.animation.entry.rotation } : E.animation.entry.rotation,
|
|
358
|
+
scale: o.animation.entry.scale ? { ...At, ...o.animation.entry.scale } : E.animation.entry.scale
|
|
359
|
+
})), o.interaction && (s.interaction = {
|
|
360
|
+
...E.interaction,
|
|
361
|
+
...o.interaction
|
|
362
|
+
}, o.interaction.focus && (s.interaction.focus = {
|
|
363
|
+
...E.interaction.focus,
|
|
364
|
+
...o.interaction.focus
|
|
365
|
+
}), o.interaction.navigation && (s.interaction.navigation = {
|
|
366
|
+
...E.interaction.navigation,
|
|
367
|
+
...o.interaction.navigation
|
|
368
|
+
}), o.interaction.gestures && (s.interaction.gestures = {
|
|
369
|
+
...E.interaction.gestures,
|
|
370
|
+
...o.interaction.gestures
|
|
371
|
+
})), o.rendering && (s.rendering = {
|
|
372
|
+
...E.rendering,
|
|
373
|
+
...o.rendering
|
|
374
|
+
}, o.rendering.responsive && (s.rendering.responsive = {
|
|
375
|
+
...E.rendering.responsive,
|
|
376
|
+
...o.rendering.responsive,
|
|
377
|
+
breakpoints: o.rendering.responsive.breakpoints ? { ...E.rendering.responsive.breakpoints, ...o.rendering.responsive.breakpoints } : E.rendering.responsive.breakpoints,
|
|
378
|
+
mobileDetection: o.rendering.responsive.mobileDetection ? o.rendering.responsive.mobileDetection : E.rendering.responsive.mobileDetection
|
|
379
|
+
}), o.rendering.ui && (s.rendering.ui = {
|
|
380
|
+
...E.rendering.ui,
|
|
381
|
+
...o.rendering.ui
|
|
382
|
+
}), o.rendering.performance && (s.rendering.performance = {
|
|
383
|
+
...E.rendering.performance,
|
|
384
|
+
...o.rendering.performance
|
|
385
|
+
})), o.debug !== void 0 && (s.debug = o.debug), s;
|
|
387
386
|
}
|
|
388
|
-
function Kt(
|
|
389
|
-
return { ...
|
|
387
|
+
function Kt(o, t) {
|
|
388
|
+
return { ...o ? Mt[o] : Mt.playful, ...t };
|
|
390
389
|
}
|
|
391
|
-
function Zt(
|
|
392
|
-
return { ...
|
|
390
|
+
function Zt(o, t) {
|
|
391
|
+
return { ...o ? zt[o] : zt.gentle, ...t };
|
|
393
392
|
}
|
|
394
|
-
function Qt(
|
|
395
|
-
return { ...
|
|
393
|
+
function Qt(o, t) {
|
|
394
|
+
return { ...o ? Lt[o] : Lt.gentle, ...t };
|
|
396
395
|
}
|
|
397
396
|
class te {
|
|
398
397
|
constructor(t) {
|
|
@@ -405,8 +404,8 @@ class te {
|
|
|
405
404
|
buildTransformString(t) {
|
|
406
405
|
const e = ["translate(-50%, -50%)"];
|
|
407
406
|
if (t.x !== void 0 || t.y !== void 0) {
|
|
408
|
-
const i = t.x ?? 0,
|
|
409
|
-
e.push(`translate(${i}px, ${
|
|
407
|
+
const i = t.x ?? 0, n = t.y ?? 0;
|
|
408
|
+
e.push(`translate(${i}px, ${n}px)`);
|
|
410
409
|
}
|
|
411
410
|
return t.rotation !== void 0 && e.push(`rotate(${t.rotation}deg)`), t.scale !== void 0 && e.push(`scale(${t.scale})`), e.join(" ");
|
|
412
411
|
}
|
|
@@ -419,9 +418,9 @@ class te {
|
|
|
419
418
|
* @param easing - CSS easing function (optional)
|
|
420
419
|
* @returns AnimationHandle that can be used to cancel or query the animation
|
|
421
420
|
*/
|
|
422
|
-
animateTransformCancellable(t, e, i,
|
|
421
|
+
animateTransformCancellable(t, e, i, n = null, a = null) {
|
|
423
422
|
this.cancelAllAnimations(t);
|
|
424
|
-
const r =
|
|
423
|
+
const r = n ?? this.config.duration, s = a ?? this.config.easing.default, h = this.buildTransformString(e), l = this.buildTransformString(i);
|
|
425
424
|
t.style.transition = "none";
|
|
426
425
|
const u = t.animate(
|
|
427
426
|
[
|
|
@@ -458,13 +457,13 @@ class te {
|
|
|
458
457
|
cancelAnimation(t, e = !0) {
|
|
459
458
|
const i = this.getCurrentTransform(t.element);
|
|
460
459
|
if (t.animation.cancel(), e) {
|
|
461
|
-
const
|
|
460
|
+
const n = this.buildTransformString({
|
|
462
461
|
x: i.x,
|
|
463
462
|
y: i.y,
|
|
464
463
|
rotation: i.rotation,
|
|
465
464
|
scale: i.scale
|
|
466
465
|
});
|
|
467
|
-
t.element.style.transform =
|
|
466
|
+
t.element.style.transform = n;
|
|
468
467
|
}
|
|
469
468
|
return this.activeAnimations.delete(t.element), i;
|
|
470
469
|
}
|
|
@@ -477,8 +476,8 @@ class te {
|
|
|
477
476
|
const e = this.activeAnimations.get(t);
|
|
478
477
|
e && this.cancelAnimation(e, !1);
|
|
479
478
|
const i = t.getAnimations();
|
|
480
|
-
for (const
|
|
481
|
-
|
|
479
|
+
for (const n of i)
|
|
480
|
+
n.cancel();
|
|
482
481
|
}
|
|
483
482
|
/**
|
|
484
483
|
* Get current transform state of an element (works mid-animation)
|
|
@@ -490,7 +489,7 @@ class te {
|
|
|
490
489
|
const i = getComputedStyle(t).transform;
|
|
491
490
|
if (i === "none" || !i)
|
|
492
491
|
return { x: 0, y: 0, rotation: 0, scale: 1 };
|
|
493
|
-
const
|
|
492
|
+
const n = new DOMMatrix(i), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e, h = n.f;
|
|
494
493
|
return { x: s, y: h, rotation: r, scale: a };
|
|
495
494
|
}
|
|
496
495
|
/**
|
|
@@ -517,9 +516,9 @@ class te {
|
|
|
517
516
|
* @param easing - CSS easing function (optional)
|
|
518
517
|
* @returns Promise that resolves when animation completes
|
|
519
518
|
*/
|
|
520
|
-
animateTransform(t, e, i = null,
|
|
519
|
+
animateTransform(t, e, i = null, n = null) {
|
|
521
520
|
return new Promise((a) => {
|
|
522
|
-
const r = i ?? this.config.duration, s =
|
|
521
|
+
const r = i ?? this.config.duration, s = n ?? this.config.easing.default;
|
|
523
522
|
t.style.transition = `transform ${r}ms ${s}, box-shadow ${r}ms ${s}`, t.style.transform = this.buildTransformString(e), setTimeout(() => {
|
|
524
523
|
a();
|
|
525
524
|
}, r);
|
|
@@ -550,18 +549,18 @@ class te {
|
|
|
550
549
|
return new Promise((e) => setTimeout(e, t));
|
|
551
550
|
}
|
|
552
551
|
}
|
|
553
|
-
function st(
|
|
554
|
-
return
|
|
552
|
+
function st(o, t, e) {
|
|
553
|
+
return o + (t - o) * e;
|
|
555
554
|
}
|
|
556
|
-
function ee(
|
|
557
|
-
const { overshoot:
|
|
558
|
-
let u = 0, c = 0, d = 1, m =
|
|
555
|
+
function ee(o, t, e, i) {
|
|
556
|
+
const { overshoot: n, bounces: a, decayRatio: r } = i, s = e.x - t.x, h = e.y - t.y, l = ie(a, r);
|
|
557
|
+
let u = 0, c = 0, d = 1, m = n, b = !1;
|
|
559
558
|
for (let g = 0; g < l.length; g++)
|
|
560
|
-
if (
|
|
559
|
+
if (o <= l[g].time) {
|
|
561
560
|
c = g === 0 ? 0 : l[g - 1].time, d = l[g].time, m = l[g].overshoot, b = l[g].isOvershoot;
|
|
562
561
|
break;
|
|
563
562
|
}
|
|
564
|
-
const p = (
|
|
563
|
+
const p = (o - c) / (d - c);
|
|
565
564
|
if (b)
|
|
566
565
|
u = 1 + m * gt(p);
|
|
567
566
|
else if (c === 0)
|
|
@@ -577,72 +576,72 @@ function ee(n, t, e, i) {
|
|
|
577
576
|
y: t.y + h * u
|
|
578
577
|
};
|
|
579
578
|
}
|
|
580
|
-
function ie(
|
|
579
|
+
function ie(o, t) {
|
|
581
580
|
const e = [];
|
|
582
581
|
let i = 0.6;
|
|
583
582
|
e.push({ time: i, overshoot: 0, isOvershoot: !1 });
|
|
584
|
-
let
|
|
585
|
-
const r = 0.4 / (
|
|
586
|
-
for (let s = 0; s <
|
|
587
|
-
i += r, e.push({ time: i, overshoot:
|
|
583
|
+
let n = 0.15;
|
|
584
|
+
const r = 0.4 / (o * 2);
|
|
585
|
+
for (let s = 0; s < o; s++)
|
|
586
|
+
i += r, e.push({ time: i, overshoot: n, isOvershoot: !0 }), i += r, e.push({ time: i, overshoot: n * t, isOvershoot: !1 }), n *= t;
|
|
588
587
|
return e.push({ time: 1, overshoot: 0, isOvershoot: !1 }), e;
|
|
589
588
|
}
|
|
590
|
-
function ne(
|
|
591
|
-
const { stiffness:
|
|
589
|
+
function ne(o, t, e, i) {
|
|
590
|
+
const { stiffness: n, damping: a, mass: r, oscillations: s } = i, h = e.x - t.x, l = e.y - t.y, u = Math.sqrt(n / r), c = a / (2 * Math.sqrt(n * r));
|
|
592
591
|
let d;
|
|
593
592
|
if (c < 1) {
|
|
594
|
-
const m = u * Math.sqrt(1 - c * c), b = Math.exp(-c * u *
|
|
593
|
+
const m = u * Math.sqrt(1 - c * c), b = Math.exp(-c * u * o * 3), p = Math.cos(m * o * s * Math.PI);
|
|
595
594
|
d = 1 - b * p;
|
|
596
595
|
} else
|
|
597
|
-
d = 1 - Math.exp(-u *
|
|
596
|
+
d = 1 - Math.exp(-u * o * 3);
|
|
598
597
|
return d = Math.max(0, Math.min(d, 1.3)), {
|
|
599
598
|
x: t.x + h * d,
|
|
600
599
|
y: t.y + l * d
|
|
601
600
|
};
|
|
602
601
|
}
|
|
603
|
-
function oe(
|
|
604
|
-
const { amplitude:
|
|
602
|
+
function oe(o, t, e, i) {
|
|
603
|
+
const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: h } = i, l = e.x - t.x, u = e.y - t.y, c = Math.sqrt(l * l + u * u), d = c > 0 ? -u / c : 0, m = c > 0 ? l / c : 1, b = a * Math.PI * 2 * o + h, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(b) * p, f = se(o);
|
|
605
604
|
return {
|
|
606
605
|
x: st(t.x, e.x, f) + g * d,
|
|
607
606
|
y: st(t.y, e.y, f) + g * m
|
|
608
607
|
};
|
|
609
608
|
}
|
|
610
|
-
function gt(
|
|
611
|
-
return 1 - (1 -
|
|
609
|
+
function gt(o) {
|
|
610
|
+
return 1 - (1 - o) * (1 - o);
|
|
612
611
|
}
|
|
613
|
-
function se(
|
|
614
|
-
return 1 - Math.pow(1 -
|
|
612
|
+
function se(o) {
|
|
613
|
+
return 1 - Math.pow(1 - o, 3);
|
|
615
614
|
}
|
|
616
|
-
function ae(
|
|
617
|
-
const { amplitude: i, frequency:
|
|
615
|
+
function ae(o, t, e) {
|
|
616
|
+
const { amplitude: i, frequency: n, decay: a } = e, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, h = i * r * s;
|
|
618
617
|
return t + h;
|
|
619
618
|
}
|
|
620
|
-
function re(
|
|
621
|
-
const { overshoot: i, bounces:
|
|
619
|
+
function re(o, t, e) {
|
|
620
|
+
const { overshoot: i, bounces: n } = e, a = [];
|
|
622
621
|
a.push({ time: 0.5, scale: i });
|
|
623
622
|
let r = i;
|
|
624
|
-
const s = 0.5, l = 0.5 / (
|
|
623
|
+
const s = 0.5, l = 0.5 / (n * 2);
|
|
625
624
|
let u = 0.5;
|
|
626
|
-
for (let d = 0; d <
|
|
625
|
+
for (let d = 0; d < n; d++) {
|
|
627
626
|
const m = 1 - (r - 1) * s;
|
|
628
|
-
u += l, a.push({ time: u, scale: m }), r = 1 + (r - 1) * s * s, u += l, d <
|
|
627
|
+
u += l, a.push({ time: u, scale: m }), r = 1 + (r - 1) * s * s, u += l, d < n - 1 && a.push({ time: u, scale: r });
|
|
629
628
|
}
|
|
630
629
|
a.push({ time: 1, scale: 1 });
|
|
631
630
|
let c = 1;
|
|
632
631
|
for (let d = 0; d < a.length; d++)
|
|
633
|
-
if (
|
|
634
|
-
const m = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (
|
|
632
|
+
if (o <= a[d].time) {
|
|
633
|
+
const m = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (o - m) / (a[d].time - m), g = gt(p);
|
|
635
634
|
c = b + (a[d].scale - b) * g;
|
|
636
635
|
break;
|
|
637
636
|
}
|
|
638
637
|
return c * t;
|
|
639
638
|
}
|
|
640
|
-
function ce(
|
|
639
|
+
function ce(o) {
|
|
641
640
|
const {
|
|
642
641
|
element: t,
|
|
643
642
|
startPosition: e,
|
|
644
643
|
endPosition: i,
|
|
645
|
-
pathConfig:
|
|
644
|
+
pathConfig: n,
|
|
646
645
|
duration: a,
|
|
647
646
|
imageWidth: r,
|
|
648
647
|
imageHeight: s,
|
|
@@ -653,8 +652,8 @@ function ce(n) {
|
|
|
653
652
|
startRotation: d,
|
|
654
653
|
scaleConfig: m,
|
|
655
654
|
startScale: b
|
|
656
|
-
} =
|
|
657
|
-
if ((p === "linear" || p === "arc") && !v && !(I ||
|
|
655
|
+
} = o, p = n.type, g = d !== void 0 && d !== h, f = (c == null ? void 0 : c.mode) === "wobble", y = (c == null ? void 0 : c.wobble) || { amplitude: 15, frequency: 3, decay: !0 }, v = g || f, I = b !== void 0 && b !== l, C = (m == null ? void 0 : m.mode) === "pop", w = (m == null ? void 0 : m.pop) || { overshoot: 1.2, bounces: 1 };
|
|
656
|
+
if ((p === "linear" || p === "arc") && !v && !(I || C)) {
|
|
658
657
|
u && u();
|
|
659
658
|
return;
|
|
660
659
|
}
|
|
@@ -665,24 +664,24 @@ function ce(n) {
|
|
|
665
664
|
switch (p) {
|
|
666
665
|
case "bounce": {
|
|
667
666
|
const H = Kt(
|
|
668
|
-
|
|
669
|
-
|
|
667
|
+
n.bouncePreset,
|
|
668
|
+
n.bounce
|
|
670
669
|
);
|
|
671
670
|
A = ee(x, e, i, H);
|
|
672
671
|
break;
|
|
673
672
|
}
|
|
674
673
|
case "elastic": {
|
|
675
674
|
const H = Zt(
|
|
676
|
-
|
|
677
|
-
|
|
675
|
+
n.elasticPreset,
|
|
676
|
+
n.elastic
|
|
678
677
|
);
|
|
679
678
|
A = ne(x, e, i, H);
|
|
680
679
|
break;
|
|
681
680
|
}
|
|
682
681
|
case "wave": {
|
|
683
682
|
const H = Qt(
|
|
684
|
-
|
|
685
|
-
|
|
683
|
+
n.wavePreset,
|
|
684
|
+
n.wave
|
|
686
685
|
);
|
|
687
686
|
A = oe(x, e, i, H);
|
|
688
687
|
break;
|
|
@@ -696,13 +695,13 @@ function ce(n) {
|
|
|
696
695
|
const O = A.x - i.x, M = A.y - i.y;
|
|
697
696
|
let T;
|
|
698
697
|
f ? T = ae(x, h, y) : g ? T = st(d, h, x) : T = h;
|
|
699
|
-
let
|
|
700
|
-
|
|
698
|
+
let R;
|
|
699
|
+
C ? R = re(x, l, w) : I ? R = st(b, l, x) : R = l, t.style.transform = `translate(${P}px, ${D}px) translate(${O}px, ${M}px) rotate(${T}deg) scale(${R})`, x < 1 ? requestAnimationFrame(U) : (t.style.transform = `translate(${P}px, ${D}px) rotate(${h}deg) scale(${l})`, u && u());
|
|
701
700
|
}
|
|
702
701
|
requestAnimationFrame(U);
|
|
703
702
|
}
|
|
704
|
-
function le(
|
|
705
|
-
return
|
|
703
|
+
function le(o) {
|
|
704
|
+
return o === "bounce" || o === "elastic" || o === "wave";
|
|
706
705
|
}
|
|
707
706
|
const he = {
|
|
708
707
|
radial: "center",
|
|
@@ -714,7 +713,7 @@ const he = {
|
|
|
714
713
|
};
|
|
715
714
|
class de {
|
|
716
715
|
constructor(t, e) {
|
|
717
|
-
this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || Tt, this.rotationConfig = t.rotation ||
|
|
716
|
+
this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || Tt, this.rotationConfig = t.rotation || Ct, this.scaleConfig = t.scale || At;
|
|
718
717
|
}
|
|
719
718
|
/**
|
|
720
719
|
* Get the effective start position, considering layout-aware defaults
|
|
@@ -725,7 +724,7 @@ class de {
|
|
|
725
724
|
/**
|
|
726
725
|
* Calculate the starting position for an image's entry animation
|
|
727
726
|
*/
|
|
728
|
-
calculateStartPosition(t, e, i,
|
|
727
|
+
calculateStartPosition(t, e, i, n, a) {
|
|
729
728
|
const r = this.resolvedStartPosition, s = this.config.start.offset ?? 100;
|
|
730
729
|
switch (r) {
|
|
731
730
|
case "nearest-edge":
|
|
@@ -747,7 +746,7 @@ class de {
|
|
|
747
746
|
t,
|
|
748
747
|
e,
|
|
749
748
|
i,
|
|
750
|
-
|
|
749
|
+
n,
|
|
751
750
|
a
|
|
752
751
|
);
|
|
753
752
|
default:
|
|
@@ -757,28 +756,28 @@ class de {
|
|
|
757
756
|
/**
|
|
758
757
|
* Calculate start position from the nearest edge (current default behavior)
|
|
759
758
|
*/
|
|
760
|
-
calculateNearestEdge(t, e, i,
|
|
759
|
+
calculateNearestEdge(t, e, i, n) {
|
|
761
760
|
const a = t.x, r = t.y, s = a, h = i.width - a, l = r, u = i.height - r, c = Math.min(s, h, l, u);
|
|
762
761
|
let d = t.x, m = t.y;
|
|
763
|
-
return c === s ? d = -(e.width +
|
|
762
|
+
return c === s ? d = -(e.width + n) : c === h ? d = i.width + n : c === l ? m = -(e.height + n) : m = i.height + n, { x: d, y: m };
|
|
764
763
|
}
|
|
765
764
|
/**
|
|
766
765
|
* Calculate start position from a specific edge
|
|
767
766
|
*/
|
|
768
|
-
calculateEdgePosition(t, e, i,
|
|
767
|
+
calculateEdgePosition(t, e, i, n, a) {
|
|
769
768
|
let r = e.x, s = e.y;
|
|
770
769
|
switch (t) {
|
|
771
770
|
case "top":
|
|
772
771
|
s = -(i.height + a);
|
|
773
772
|
break;
|
|
774
773
|
case "bottom":
|
|
775
|
-
s =
|
|
774
|
+
s = n.height + a;
|
|
776
775
|
break;
|
|
777
776
|
case "left":
|
|
778
777
|
r = -(i.width + a);
|
|
779
778
|
break;
|
|
780
779
|
case "right":
|
|
781
|
-
r =
|
|
780
|
+
r = n.width + a;
|
|
782
781
|
break;
|
|
783
782
|
}
|
|
784
783
|
return { x: r, y: s };
|
|
@@ -787,9 +786,9 @@ class de {
|
|
|
787
786
|
* Calculate start position from center with scale animation
|
|
788
787
|
*/
|
|
789
788
|
calculateCenterPosition(t, e, i) {
|
|
790
|
-
const
|
|
789
|
+
const n = t.width / 2, a = t.height / 2;
|
|
791
790
|
return {
|
|
792
|
-
x:
|
|
791
|
+
x: n,
|
|
793
792
|
y: a,
|
|
794
793
|
useScale: !0
|
|
795
794
|
// Signal to use scale animation from 0
|
|
@@ -798,14 +797,14 @@ class de {
|
|
|
798
797
|
/**
|
|
799
798
|
* Calculate start position from a random edge
|
|
800
799
|
*/
|
|
801
|
-
calculateRandomEdge(t, e, i,
|
|
800
|
+
calculateRandomEdge(t, e, i, n) {
|
|
802
801
|
const a = ["top", "bottom", "left", "right"], r = a[Math.floor(Math.random() * a.length)];
|
|
803
|
-
return this.calculateEdgePosition(r, t, e, i,
|
|
802
|
+
return this.calculateEdgePosition(r, t, e, i, n);
|
|
804
803
|
}
|
|
805
804
|
/**
|
|
806
805
|
* Calculate start position on a circle around the container
|
|
807
806
|
*/
|
|
808
|
-
calculateCircularPosition(t, e, i,
|
|
807
|
+
calculateCircularPosition(t, e, i, n, a) {
|
|
809
808
|
const r = this.config.start.circular || {}, s = r.distribution || "even";
|
|
810
809
|
let h;
|
|
811
810
|
const l = r.radius || "120%";
|
|
@@ -817,7 +816,7 @@ class de {
|
|
|
817
816
|
} else
|
|
818
817
|
h = typeof l == "number" ? l : 500;
|
|
819
818
|
let u;
|
|
820
|
-
s === "even" ? u =
|
|
819
|
+
s === "even" ? u = n / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
|
|
821
820
|
const c = i.width / 2, d = i.height / 2, m = c + Math.cos(u) * h, b = d + Math.sin(u) * h;
|
|
822
821
|
return { x: m, y: b };
|
|
823
822
|
}
|
|
@@ -825,30 +824,30 @@ class de {
|
|
|
825
824
|
* Get animation parameters for an image
|
|
826
825
|
*/
|
|
827
826
|
getAnimationParams(t) {
|
|
828
|
-
const e = this.config.timing.duration, i = this.config.timing.stagger,
|
|
827
|
+
const e = this.config.timing.duration, i = this.config.timing.stagger, n = this.config.easing;
|
|
829
828
|
return {
|
|
830
829
|
startTransform: "",
|
|
831
830
|
// Will be computed by caller based on start position
|
|
832
831
|
duration: e,
|
|
833
832
|
delay: t * i,
|
|
834
|
-
easing:
|
|
833
|
+
easing: n
|
|
835
834
|
};
|
|
836
835
|
}
|
|
837
836
|
/**
|
|
838
837
|
* Build a CSS transform string for the start position
|
|
839
838
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
840
839
|
*/
|
|
841
|
-
buildStartTransform(t, e, i,
|
|
842
|
-
const l = t.x - e.x, u = t.y - e.y, c = s !== void 0 ? s : i, d = h !== void 0 ? h :
|
|
840
|
+
buildStartTransform(t, e, i, n, a, r, s, h) {
|
|
841
|
+
const l = t.x - e.x, u = t.y - e.y, c = s !== void 0 ? s : i, d = h !== void 0 ? h : n, m = a !== void 0 ? -a / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = a !== void 0 ? `translate(${m}px, ${b}px)` : "translate(-50%, -50%)";
|
|
843
842
|
return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${c}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${c}deg) scale(${d})`;
|
|
844
843
|
}
|
|
845
844
|
/**
|
|
846
845
|
* Build the final CSS transform string
|
|
847
846
|
* Uses pixel-based centering offset for reliable cross-browser behavior
|
|
848
847
|
*/
|
|
849
|
-
buildFinalTransform(t, e, i,
|
|
850
|
-
if (i !== void 0 &&
|
|
851
|
-
const a = -i / 2, r = -
|
|
848
|
+
buildFinalTransform(t, e, i, n) {
|
|
849
|
+
if (i !== void 0 && n !== void 0) {
|
|
850
|
+
const a = -i / 2, r = -n / 2;
|
|
852
851
|
return `translate(${a}px, ${r}px) rotate(${t}deg) scale(${e})`;
|
|
853
852
|
}
|
|
854
853
|
return `translate(-50%, -50%) rotate(${t}deg) scale(${e})`;
|
|
@@ -915,12 +914,12 @@ class de {
|
|
|
915
914
|
return t + (Math.random() - 0.5) * 60;
|
|
916
915
|
if (typeof i == "number")
|
|
917
916
|
return i;
|
|
918
|
-
const
|
|
919
|
-
return i.min + Math.random() *
|
|
917
|
+
const n = i.max - i.min;
|
|
918
|
+
return i.min + Math.random() * n;
|
|
920
919
|
}
|
|
921
920
|
case "spin": {
|
|
922
|
-
const i = this.rotationConfig.spinCount ?? 1,
|
|
923
|
-
return t + i * 360 *
|
|
921
|
+
const i = this.rotationConfig.spinCount ?? 1, n = this.resolveSpinDirection(t);
|
|
922
|
+
return t + i * 360 * n;
|
|
924
923
|
}
|
|
925
924
|
case "random":
|
|
926
925
|
return t + (Math.random() - 0.5) * 60;
|
|
@@ -967,7 +966,7 @@ class de {
|
|
|
967
966
|
amplitude: 15,
|
|
968
967
|
frequency: 3,
|
|
969
968
|
decay: !0
|
|
970
|
-
}, { amplitude:
|
|
969
|
+
}, { amplitude: n, frequency: a, decay: r } = i, s = Math.sin(t * a * Math.PI * 2), h = r ? Math.pow(1 - t, 2) : 1, l = n * s * h;
|
|
971
970
|
return e + l;
|
|
972
971
|
}
|
|
973
972
|
/**
|
|
@@ -1024,7 +1023,7 @@ class de {
|
|
|
1024
1023
|
const i = this.scaleConfig.pop || {
|
|
1025
1024
|
overshoot: 1.2,
|
|
1026
1025
|
bounces: 1
|
|
1027
|
-
}, { overshoot:
|
|
1026
|
+
}, { overshoot: n, bounces: a } = i, r = this.generateScaleBounceKeyframes(a, n);
|
|
1028
1027
|
let s = e;
|
|
1029
1028
|
for (let h = 0; h < r.length; h++)
|
|
1030
1029
|
if (t <= r[h].time) {
|
|
@@ -1040,12 +1039,12 @@ class de {
|
|
|
1040
1039
|
generateScaleBounceKeyframes(t, e) {
|
|
1041
1040
|
const i = [];
|
|
1042
1041
|
i.push({ time: 0.5, scale: e });
|
|
1043
|
-
let
|
|
1042
|
+
let n = e;
|
|
1044
1043
|
const a = 0.5, s = 0.5 / (t * 2);
|
|
1045
1044
|
let h = 0.5;
|
|
1046
1045
|
for (let l = 0; l < t; l++) {
|
|
1047
|
-
const u = 1 - (
|
|
1048
|
-
h += s, i.push({ time: h, scale: u }),
|
|
1046
|
+
const u = 1 - (n - 1) * a;
|
|
1047
|
+
h += s, i.push({ time: h, scale: u }), n = 1 + (n - 1) * a * a, h += s, l < t - 1 && i.push({ time: h, scale: n });
|
|
1049
1048
|
}
|
|
1050
1049
|
return i.push({ time: 1, scale: 1 }), i;
|
|
1051
1050
|
}
|
|
@@ -1069,19 +1068,19 @@ class ue {
|
|
|
1069
1068
|
*/
|
|
1070
1069
|
generate(t, e, i = {}) {
|
|
1071
1070
|
var w, F, N, P, D, U, k, z, x;
|
|
1072
|
-
const
|
|
1071
|
+
const n = [], { width: a, height: r } = e, s = this.config.spacing.padding, h = i.fixedHeight ?? 200, l = ((w = this.imageConfig.rotation) == null ? void 0 : w.mode) ?? "none", u = ((N = (F = this.imageConfig.rotation) == null ? void 0 : F.range) == null ? void 0 : N.min) ?? -15, c = ((D = (P = this.imageConfig.rotation) == null ? void 0 : P.range) == null ? void 0 : D.max) ?? 15, d = ((k = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : k.min) ?? 1, m = ((x = (z = this.imageConfig.sizing) == null ? void 0 : z.variance) == null ? void 0 : x.max) ?? 1, b = d !== 1 || m !== 1, g = h * 1.5 / 2, f = h / 2, y = a - s - g, v = r - s - f, I = s + g, C = s + f;
|
|
1073
1072
|
for (let A = 0; A < t; A++) {
|
|
1074
|
-
const O = this.random(I, y), M = this.random(
|
|
1073
|
+
const O = this.random(I, y), M = this.random(C, v), T = l === "random" ? this.random(u, c) : 0, R = b ? this.random(d, m) : 1, H = h * R, K = {
|
|
1075
1074
|
id: A,
|
|
1076
1075
|
x: O,
|
|
1077
1076
|
y: M,
|
|
1078
1077
|
rotation: T,
|
|
1079
|
-
scale:
|
|
1078
|
+
scale: R,
|
|
1080
1079
|
baseSize: H
|
|
1081
1080
|
};
|
|
1082
|
-
|
|
1081
|
+
n.push(K);
|
|
1083
1082
|
}
|
|
1084
|
-
return
|
|
1083
|
+
return n;
|
|
1085
1084
|
}
|
|
1086
1085
|
/**
|
|
1087
1086
|
* Utility: Generate random number between min and max
|
|
@@ -1106,10 +1105,10 @@ class ge {
|
|
|
1106
1105
|
*/
|
|
1107
1106
|
generate(t, e, i = {}) {
|
|
1108
1107
|
var F, N, P, D, U, k, z, x, A;
|
|
1109
|
-
const
|
|
1108
|
+
const n = [], { width: a, height: r } = e, { debugRadials: s } = this.config, h = i.fixedHeight ?? 200, l = ((F = this.imageConfig.rotation) == null ? void 0 : F.mode) ?? "none", u = ((P = (N = this.imageConfig.rotation) == null ? void 0 : N.range) == null ? void 0 : P.min) ?? -15, c = ((U = (D = this.imageConfig.rotation) == null ? void 0 : D.range) == null ? void 0 : U.max) ?? 15, d = ((z = (k = this.imageConfig.sizing) == null ? void 0 : k.variance) == null ? void 0 : z.min) ?? 1, m = ((A = (x = this.imageConfig.sizing) == null ? void 0 : x.variance) == null ? void 0 : A.max) ?? 1, b = d !== 1 || m !== 1, p = this.config.scaleDecay ?? 0, g = ["green", "blue", "red", "yellow", "orange", "purple"], f = i.fixedHeight ?? h, y = a / 2, v = r / 2, I = Math.ceil(Math.sqrt(t));
|
|
1110
1109
|
if (t > 0) {
|
|
1111
1110
|
const O = b ? this.random(d, m) : 1, M = f * O;
|
|
1112
|
-
|
|
1111
|
+
n.push({
|
|
1113
1112
|
id: 0,
|
|
1114
1113
|
x: y,
|
|
1115
1114
|
y: v,
|
|
@@ -1122,22 +1121,22 @@ class ge {
|
|
|
1122
1121
|
borderColor: s ? "cyan" : void 0
|
|
1123
1122
|
});
|
|
1124
1123
|
}
|
|
1125
|
-
let
|
|
1126
|
-
for (;
|
|
1127
|
-
const O = w / I, M = p > 0 ? 1 - O * p * 0.5 : 1, T = w * (f * 0.8),
|
|
1124
|
+
let C = 1, w = 1;
|
|
1125
|
+
for (; C < t; ) {
|
|
1126
|
+
const O = w / I, M = p > 0 ? 1 - O * p * 0.5 : 1, T = w * (f * 0.8), R = T * 1.5, H = Math.PI * (3 * (R + T) - Math.sqrt((3 * R + T) * (R + 3 * T))), K = this.estimateWidth(f), X = Math.floor(H / (K * 0.7));
|
|
1128
1127
|
if (X === 0) {
|
|
1129
1128
|
w++;
|
|
1130
1129
|
continue;
|
|
1131
1130
|
}
|
|
1132
1131
|
const B = 2 * Math.PI / X, Z = w * (20 * Math.PI / 180);
|
|
1133
|
-
for (let W = 0; W < X &&
|
|
1132
|
+
for (let W = 0; W < X && C < t; W++) {
|
|
1134
1133
|
const Q = W * B + Z, tt = b ? this.random(d, m) : 1, q = M * tt, et = f * q;
|
|
1135
|
-
let Y = y + Math.cos(Q) *
|
|
1134
|
+
let Y = y + Math.cos(Q) * R, L = v + Math.sin(Q) * T;
|
|
1136
1135
|
const $ = this.config.spacing.padding ?? 50, G = et * 1.5 / 2, _ = et / 2;
|
|
1137
1136
|
Y - G < $ ? Y = $ + G : Y + G > a - $ && (Y = a - $ - G), L - _ < $ ? L = $ + _ : L + _ > r - $ && (L = r - $ - _);
|
|
1138
1137
|
const it = l === "random" ? this.random(u, c) : 0;
|
|
1139
|
-
|
|
1140
|
-
id:
|
|
1138
|
+
n.push({
|
|
1139
|
+
id: C,
|
|
1141
1140
|
x: Y,
|
|
1142
1141
|
y: L,
|
|
1143
1142
|
rotation: it,
|
|
@@ -1146,11 +1145,11 @@ class ge {
|
|
|
1146
1145
|
zIndex: Math.max(1, 100 - w),
|
|
1147
1146
|
// Outer rings have lower z-index
|
|
1148
1147
|
borderColor: s ? g[(w - 1) % g.length] : void 0
|
|
1149
|
-
}),
|
|
1148
|
+
}), C++;
|
|
1150
1149
|
}
|
|
1151
1150
|
w++;
|
|
1152
1151
|
}
|
|
1153
|
-
return
|
|
1152
|
+
return n;
|
|
1154
1153
|
}
|
|
1155
1154
|
/**
|
|
1156
1155
|
* Estimate image width based on height
|
|
@@ -1212,13 +1211,13 @@ class me {
|
|
|
1212
1211
|
*/
|
|
1213
1212
|
generate(t, e, i = {}) {
|
|
1214
1213
|
var X, B, Z, W, Q, tt, q, et, Y;
|
|
1215
|
-
const
|
|
1214
|
+
const n = [], { width: a, height: r } = e, s = { ...fe, ...this.config.grid }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((X = this.imageConfig.rotation) == null ? void 0 : X.mode) ?? "none", c = ((Z = (B = this.imageConfig.sizing) == null ? void 0 : B.variance) == null ? void 0 : Z.min) ?? 1, d = ((Q = (W = this.imageConfig.sizing) == null ? void 0 : W.variance) == null ? void 0 : Q.max) ?? 1, m = c !== 1 || d !== 1, b = a - 2 * h, p = r - 2 * h, { columns: g, rows: f } = this.calculateGridDimensions(
|
|
1216
1215
|
t,
|
|
1217
1216
|
b,
|
|
1218
1217
|
p,
|
|
1219
1218
|
l,
|
|
1220
1219
|
s
|
|
1221
|
-
), y = s.stagger === "row", v = s.stagger === "column", I = y ? g + 0.5 : g,
|
|
1220
|
+
), y = s.stagger === "row", v = s.stagger === "column", I = y ? g + 0.5 : g, C = v ? f + 0.5 : f, w = (b - s.gap * (g - 1)) / I, F = (p - s.gap * (f - 1)) / C, N = y ? w / 2 : 0, P = v ? F / 2 : 0, D = 1 + s.overlap, U = Math.min(w, F) * D, k = i.fixedHeight ? Math.min(i.fixedHeight, U) : U, z = g * w + (g - 1) * s.gap + N, x = f * F + (f - 1) * s.gap + P, A = h + (b - z) / 2, O = h + (p - x) / 2, M = g * f, T = s.columns !== "auto" && s.rows !== "auto", R = T && t > M;
|
|
1222
1221
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1223
1222
|
gridConfigColumns: s.columns,
|
|
1224
1223
|
gridConfigRows: s.rows,
|
|
@@ -1227,12 +1226,12 @@ class me {
|
|
|
1227
1226
|
cellCount: M,
|
|
1228
1227
|
hasFixedGrid: T,
|
|
1229
1228
|
imageCount: t,
|
|
1230
|
-
isOverflowMode:
|
|
1229
|
+
isOverflowMode: R
|
|
1231
1230
|
});
|
|
1232
|
-
const H =
|
|
1231
|
+
const H = R ? new Array(M).fill(0) : [], K = Math.min(w, F) * s.overflowOffset;
|
|
1233
1232
|
for (let L = 0; L < t; L++) {
|
|
1234
1233
|
let $, j, G = 0;
|
|
1235
|
-
if (
|
|
1234
|
+
if (R && L >= M) {
|
|
1236
1235
|
const V = L - M, J = V % M;
|
|
1237
1236
|
G = Math.floor(V / M) + 1, H[J]++, s.fillDirection === "row" ? ($ = J % g, j = Math.floor(J / g)) : (j = J % f, $ = Math.floor(J / f));
|
|
1238
1237
|
} else
|
|
@@ -1247,12 +1246,12 @@ class me {
|
|
|
1247
1246
|
_ += this.random(-V, V), it += this.random(-J, J);
|
|
1248
1247
|
}
|
|
1249
1248
|
let nt = _, ot = it;
|
|
1250
|
-
if (!
|
|
1249
|
+
if (!R && s.fillDirection === "row") {
|
|
1251
1250
|
const V = t % g || g;
|
|
1252
1251
|
if (j === Math.floor((t - 1) / g) && V < g) {
|
|
1253
|
-
const
|
|
1254
|
-
let
|
|
1255
|
-
s.alignment === "center" ?
|
|
1252
|
+
const Rt = V * w + (V - 1) * s.gap;
|
|
1253
|
+
let Et = 0;
|
|
1254
|
+
s.alignment === "center" ? Et = (z - Rt) / 2 : s.alignment === "end" && (Et = z - Rt), nt += Et;
|
|
1256
1255
|
}
|
|
1257
1256
|
}
|
|
1258
1257
|
const pt = m ? this.random(c, d) : 1, at = k * pt, dt = at * 1.5 / 2, ut = at / 2, yt = h + dt, vt = a - h - dt, Ht = h + ut, Nt = r - h - ut;
|
|
@@ -1263,7 +1262,7 @@ class me {
|
|
|
1263
1262
|
s.jitter > 0 ? wt = this.random(V * s.jitter, J * s.jitter) : wt = this.random(V, J);
|
|
1264
1263
|
}
|
|
1265
1264
|
let xt;
|
|
1266
|
-
|
|
1265
|
+
R && G > 0 ? xt = 50 - G : xt = R ? 100 + L : L + 1, n.push({
|
|
1267
1266
|
id: L,
|
|
1268
1267
|
x: nt,
|
|
1269
1268
|
y: ot,
|
|
@@ -1273,12 +1272,12 @@ class me {
|
|
|
1273
1272
|
zIndex: xt
|
|
1274
1273
|
});
|
|
1275
1274
|
}
|
|
1276
|
-
return
|
|
1275
|
+
return n;
|
|
1277
1276
|
}
|
|
1278
1277
|
/**
|
|
1279
1278
|
* Calculate optimal grid dimensions based on image count and container
|
|
1280
1279
|
*/
|
|
1281
|
-
calculateGridDimensions(t, e, i,
|
|
1280
|
+
calculateGridDimensions(t, e, i, n, a) {
|
|
1282
1281
|
let r, s;
|
|
1283
1282
|
if (a.columns !== "auto" && a.rows !== "auto")
|
|
1284
1283
|
r = a.columns, s = a.rows;
|
|
@@ -1319,8 +1318,8 @@ class ye {
|
|
|
1319
1318
|
* @returns Array of layout objects with position, rotation, scale
|
|
1320
1319
|
*/
|
|
1321
1320
|
generate(t, e, i = {}) {
|
|
1322
|
-
var
|
|
1323
|
-
const
|
|
1321
|
+
var C, w, F, N, P, D, U, k, z;
|
|
1322
|
+
const n = [], { width: a, height: r } = e, s = { ...be, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((C = this.imageConfig.rotation) == null ? void 0 : C.mode) ?? "none", c = ((F = (w = this.imageConfig.rotation) == null ? void 0 : w.range) == null ? void 0 : F.min) ?? -15, d = ((P = (N = this.imageConfig.rotation) == null ? void 0 : N.range) == null ? void 0 : P.max) ?? 15, m = ((U = (D = this.imageConfig.sizing) == null ? void 0 : D.variance) == null ? void 0 : U.min) ?? 1, b = ((z = (k = this.imageConfig.sizing) == null ? void 0 : k.variance) == null ? void 0 : z.max) ?? 1, p = m !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, f = a / 2, y = r / 2, v = Math.min(
|
|
1324
1323
|
f - h - l / 2,
|
|
1325
1324
|
y - h - l / 2
|
|
1326
1325
|
), I = s.direction === "clockwise" ? -1 : 1;
|
|
@@ -1335,14 +1334,14 @@ class ye {
|
|
|
1335
1334
|
const _ = x * 0.3 * s.tightness;
|
|
1336
1335
|
A = _ * I + s.startAngle, O = this.calculateLogarithmicRadius(_, t, v, s.tightness);
|
|
1337
1336
|
}
|
|
1338
|
-
const M = f + Math.cos(A) * O, T = y + Math.sin(A) * O,
|
|
1337
|
+
const M = f + Math.cos(A) * O, T = y + Math.sin(A) * O, R = O / v, H = g > 0 ? 1 - R * g * 0.5 : 1, K = p ? this.random(m, b) : 1, X = H * K, B = l * X, W = B * 1.5 / 2, Q = B / 2, tt = h + W, q = a - h - W, et = h + Q, Y = r - h - Q, L = Math.max(tt, Math.min(M, q)), $ = Math.max(et, Math.min(T, Y));
|
|
1339
1338
|
let j = 0;
|
|
1340
1339
|
if (u === "random") {
|
|
1341
1340
|
const _ = A * 180 / Math.PI % 360, it = this.random(c, d);
|
|
1342
1341
|
j = s.spiralType === "golden" ? it : _ * 0.1 + it * 0.9;
|
|
1343
1342
|
} else u === "tangent" && (j = this.calculateSpiralTangent(A, O, s));
|
|
1344
1343
|
const G = t - x;
|
|
1345
|
-
|
|
1344
|
+
n.push({
|
|
1346
1345
|
id: x,
|
|
1347
1346
|
x: L,
|
|
1348
1347
|
y: $,
|
|
@@ -1352,47 +1351,47 @@ class ye {
|
|
|
1352
1351
|
zIndex: G
|
|
1353
1352
|
});
|
|
1354
1353
|
}
|
|
1355
|
-
return
|
|
1354
|
+
return n;
|
|
1356
1355
|
}
|
|
1357
1356
|
/**
|
|
1358
1357
|
* Calculate tangent angle for spiral curve at given position
|
|
1359
1358
|
* This aligns the image along the spiral's direction of travel
|
|
1360
1359
|
*/
|
|
1361
1360
|
calculateSpiralTangent(t, e, i) {
|
|
1362
|
-
let
|
|
1361
|
+
let n;
|
|
1363
1362
|
if (i.spiralType === "golden")
|
|
1364
|
-
|
|
1363
|
+
n = t + Math.PI / 2;
|
|
1365
1364
|
else if (i.spiralType === "archimedean") {
|
|
1366
1365
|
const r = 1 / i.tightness, s = Math.atan(e / r);
|
|
1367
|
-
|
|
1366
|
+
n = t + s;
|
|
1368
1367
|
} else {
|
|
1369
1368
|
const r = 0.15 / i.tightness, s = Math.atan(1 / r);
|
|
1370
|
-
|
|
1369
|
+
n = t + s;
|
|
1371
1370
|
}
|
|
1372
|
-
return
|
|
1371
|
+
return n * 180 / Math.PI % 360 - 90;
|
|
1373
1372
|
}
|
|
1374
1373
|
/**
|
|
1375
1374
|
* Calculate radius for golden spiral (Vogel's model)
|
|
1376
1375
|
* Creates even distribution like sunflower seeds
|
|
1377
1376
|
*/
|
|
1378
|
-
calculateGoldenRadius(t, e, i,
|
|
1379
|
-
const r = i / Math.sqrt(e) * Math.sqrt(t) /
|
|
1377
|
+
calculateGoldenRadius(t, e, i, n) {
|
|
1378
|
+
const r = i / Math.sqrt(e) * Math.sqrt(t) / n;
|
|
1380
1379
|
return Math.min(r, i);
|
|
1381
1380
|
}
|
|
1382
1381
|
/**
|
|
1383
1382
|
* Calculate radius for Archimedean spiral
|
|
1384
1383
|
* r = a + b*θ (constant spacing between arms)
|
|
1385
1384
|
*/
|
|
1386
|
-
calculateArchimedeanRadius(t, e, i,
|
|
1387
|
-
const a = e * 0.5 *
|
|
1385
|
+
calculateArchimedeanRadius(t, e, i, n) {
|
|
1386
|
+
const a = e * 0.5 * n;
|
|
1388
1387
|
return t / a * i;
|
|
1389
1388
|
}
|
|
1390
1389
|
/**
|
|
1391
1390
|
* Calculate radius for logarithmic (equiangular) spiral
|
|
1392
1391
|
* r = a * e^(b*θ)
|
|
1393
1392
|
*/
|
|
1394
|
-
calculateLogarithmicRadius(t, e, i,
|
|
1395
|
-
const a = i * 0.05, r = 0.15 /
|
|
1393
|
+
calculateLogarithmicRadius(t, e, i, n) {
|
|
1394
|
+
const a = i * 0.05, r = 0.15 / n, s = a * Math.exp(r * t), h = e * 0.3 * n, l = a * Math.exp(r * h);
|
|
1396
1395
|
return s / l * i;
|
|
1397
1396
|
}
|
|
1398
1397
|
/**
|
|
@@ -1422,8 +1421,8 @@ class we {
|
|
|
1422
1421
|
* @returns Array of layout objects with position, rotation, scale
|
|
1423
1422
|
*/
|
|
1424
1423
|
generate(t, e, i = {}) {
|
|
1425
|
-
var I,
|
|
1426
|
-
const
|
|
1424
|
+
var I, C, w, F, N, P, D, U, k;
|
|
1425
|
+
const n = [], { width: a, height: r } = e, s = { ...ve, ...this.config.cluster }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((I = this.imageConfig.rotation) == null ? void 0 : I.mode) ?? "none", c = ((w = (C = this.imageConfig.rotation) == null ? void 0 : C.range) == null ? void 0 : w.min) ?? -15, d = ((N = (F = this.imageConfig.rotation) == null ? void 0 : F.range) == null ? void 0 : N.max) ?? 15, m = ((D = (P = this.imageConfig.sizing) == null ? void 0 : P.variance) == null ? void 0 : D.min) ?? 1, b = ((k = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : k.max) ?? 1, p = m !== 1 || b !== 1, g = this.calculateClusterCount(
|
|
1427
1426
|
t,
|
|
1428
1427
|
s.clusterCount,
|
|
1429
1428
|
a,
|
|
@@ -1449,14 +1448,14 @@ class we {
|
|
|
1449
1448
|
const j = this.random(0, Math.PI * 2), G = this.random(0, x.spread);
|
|
1450
1449
|
M = Math.cos(j) * G, T = Math.sin(j) * G;
|
|
1451
1450
|
}
|
|
1452
|
-
const
|
|
1453
|
-
M /=
|
|
1451
|
+
const R = 1 + s.overlap * 0.5, H = 1 + s.overlap * 0.3;
|
|
1452
|
+
M /= R, T /= R;
|
|
1454
1453
|
const K = p ? this.random(m, b) : 1, X = H * K, B = l * X;
|
|
1455
1454
|
let Z = x.x + M, W = x.y + T;
|
|
1456
1455
|
const tt = B * 1.5 / 2, q = B / 2;
|
|
1457
1456
|
Z = Math.max(h + tt, Math.min(Z, a - h - tt)), W = Math.max(h + q, Math.min(W, r - h - q));
|
|
1458
1457
|
const et = u === "random" ? this.random(c, d) : 0, L = Math.sqrt(M * M + T * T) / x.spread, $ = Math.round((1 - L) * 50) + 1;
|
|
1459
|
-
|
|
1458
|
+
n.push({
|
|
1460
1459
|
id: v,
|
|
1461
1460
|
x: Z,
|
|
1462
1461
|
y: W,
|
|
@@ -1467,24 +1466,24 @@ class we {
|
|
|
1467
1466
|
}), v++;
|
|
1468
1467
|
}
|
|
1469
1468
|
}
|
|
1470
|
-
return
|
|
1469
|
+
return n;
|
|
1471
1470
|
}
|
|
1472
1471
|
/**
|
|
1473
1472
|
* Calculate optimal number of clusters based on image count and container
|
|
1474
1473
|
*/
|
|
1475
|
-
calculateClusterCount(t, e, i,
|
|
1474
|
+
calculateClusterCount(t, e, i, n, a) {
|
|
1476
1475
|
if (e !== "auto")
|
|
1477
1476
|
return Math.max(1, Math.min(e, t));
|
|
1478
1477
|
const s = Math.max(1, Math.ceil(t / 8)), h = Math.floor(
|
|
1479
|
-
i / a * (
|
|
1478
|
+
i / a * (n / a) * 0.6
|
|
1480
1479
|
);
|
|
1481
1480
|
return Math.max(1, Math.min(s, h, 10));
|
|
1482
1481
|
}
|
|
1483
1482
|
/**
|
|
1484
1483
|
* Generate cluster center positions with spacing constraints
|
|
1485
1484
|
*/
|
|
1486
|
-
generateClusterCenters(t, e, i,
|
|
1487
|
-
const r = [], h =
|
|
1485
|
+
generateClusterCenters(t, e, i, n, a) {
|
|
1486
|
+
const r = [], h = n + a.clusterSpread, l = e - n - a.clusterSpread, u = n + a.clusterSpread, c = i - n - a.clusterSpread;
|
|
1488
1487
|
for (let d = 0; d < t; d++) {
|
|
1489
1488
|
let m = null, b = -1;
|
|
1490
1489
|
for (let p = 0; p < 100; p++) {
|
|
@@ -1495,8 +1494,8 @@ class we {
|
|
|
1495
1494
|
};
|
|
1496
1495
|
let f = 1 / 0;
|
|
1497
1496
|
for (const y of r) {
|
|
1498
|
-
const v = g.x - y.x, I = g.y - y.y,
|
|
1499
|
-
f = Math.min(f,
|
|
1497
|
+
const v = g.x - y.x, I = g.y - y.y, C = Math.sqrt(v * v + I * I);
|
|
1498
|
+
f = Math.min(f, C);
|
|
1500
1499
|
}
|
|
1501
1500
|
if ((r.length === 0 || f > b) && (m = g, b = f), f >= a.clusterSpacing)
|
|
1502
1501
|
break;
|
|
@@ -1541,22 +1540,22 @@ class xe {
|
|
|
1541
1540
|
* @returns Array of layout objects with position, rotation, scale
|
|
1542
1541
|
*/
|
|
1543
1542
|
generate(t, e, i = {}) {
|
|
1544
|
-
var
|
|
1545
|
-
const
|
|
1543
|
+
var R, H, K, X, B, Z, W, Q, tt;
|
|
1544
|
+
const n = [], { width: a, height: r } = e, s = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, l = ((R = this.imageConfig.rotation) == null ? void 0 : R.mode) ?? "none", u = ((K = (H = this.imageConfig.rotation) == null ? void 0 : H.range) == null ? void 0 : K.min) ?? -15, c = ((B = (X = this.imageConfig.rotation) == null ? void 0 : X.range) == null ? void 0 : B.max) ?? 15, d = ((W = (Z = this.imageConfig.sizing) == null ? void 0 : Z.variance) == null ? void 0 : W.min) ?? 1, m = ((tt = (Q = this.imageConfig.sizing) == null ? void 0 : Q.variance) == null ? void 0 : tt.max) ?? 1, b = d !== 1 || m !== 1, p = i.fixedHeight ?? s, g = {
|
|
1546
1545
|
...jt,
|
|
1547
1546
|
...this.config.wave
|
|
1548
|
-
}, { rows: f, amplitude: y, frequency: v, phaseShift: I, synchronization:
|
|
1547
|
+
}, { rows: f, amplitude: y, frequency: v, phaseShift: I, synchronization: C } = g, w = Math.ceil(t / f), P = p * 1.5 / 2, D = h + P, U = a - h - P, k = U - D, z = w > 1 ? k / (w - 1) : 0, x = h + y + p / 2, A = r - h - y - p / 2, O = A - x, M = f > 1 ? O / (f - 1) : 0;
|
|
1549
1548
|
let T = 0;
|
|
1550
1549
|
for (let q = 0; q < f && T < t; q++) {
|
|
1551
1550
|
const et = f === 1 ? (x + A) / 2 : x + q * M;
|
|
1552
1551
|
let Y = 0;
|
|
1553
|
-
|
|
1552
|
+
C === "offset" ? Y = q * I : C === "alternating" && (Y = q * Math.PI);
|
|
1554
1553
|
for (let L = 0; L < w && T < t; L++) {
|
|
1555
1554
|
const $ = w === 1 ? (D + U) / 2 : D + L * z, j = this.calculateWaveY($, a, y, v, Y), G = $, _ = et + j, it = b ? this.random(d, m) : 1, nt = p * it;
|
|
1556
1555
|
let ot = 0;
|
|
1557
1556
|
l === "tangent" ? ot = this.calculateRotation($, a, y, v, Y) : l === "random" && (ot = this.random(u, c));
|
|
1558
1557
|
const at = nt * 1.5 / 2, bt = nt / 2, dt = h + at, ut = a - h - at, yt = h + bt, vt = r - h - bt;
|
|
1559
|
-
|
|
1558
|
+
n.push({
|
|
1560
1559
|
id: T,
|
|
1561
1560
|
x: Math.max(dt, Math.min(G, ut)),
|
|
1562
1561
|
y: Math.max(yt, Math.min(_, vt)),
|
|
@@ -1567,7 +1566,7 @@ class xe {
|
|
|
1567
1566
|
}), T++;
|
|
1568
1567
|
}
|
|
1569
1568
|
}
|
|
1570
|
-
return
|
|
1569
|
+
return n;
|
|
1571
1570
|
}
|
|
1572
1571
|
/**
|
|
1573
1572
|
* Calculate Y position displacement on wave curve
|
|
@@ -1578,9 +1577,9 @@ class xe {
|
|
|
1578
1577
|
* @param phase - Phase offset
|
|
1579
1578
|
* @returns Y displacement from baseline
|
|
1580
1579
|
*/
|
|
1581
|
-
calculateWaveY(t, e, i,
|
|
1580
|
+
calculateWaveY(t, e, i, n, a) {
|
|
1582
1581
|
const r = t / e;
|
|
1583
|
-
return i * Math.sin(
|
|
1582
|
+
return i * Math.sin(n * r * 2 * Math.PI + a);
|
|
1584
1583
|
}
|
|
1585
1584
|
/**
|
|
1586
1585
|
* Calculate rotation based on wave tangent
|
|
@@ -1591,8 +1590,8 @@ class xe {
|
|
|
1591
1590
|
* @param phase - Phase offset
|
|
1592
1591
|
* @returns Rotation angle in degrees
|
|
1593
1592
|
*/
|
|
1594
|
-
calculateRotation(t, e, i,
|
|
1595
|
-
const r = t / e, s = i *
|
|
1593
|
+
calculateRotation(t, e, i, n, a) {
|
|
1594
|
+
const r = t / e, s = i * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + a) / e;
|
|
1596
1595
|
return Math.atan(s) * (180 / Math.PI);
|
|
1597
1596
|
}
|
|
1598
1597
|
/**
|
|
@@ -1607,7 +1606,7 @@ class xe {
|
|
|
1607
1606
|
return Math.random() * (e - t) + t;
|
|
1608
1607
|
}
|
|
1609
1608
|
}
|
|
1610
|
-
class
|
|
1609
|
+
class Ee {
|
|
1611
1610
|
constructor(t) {
|
|
1612
1611
|
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.generator = this.initGenerator();
|
|
1613
1612
|
}
|
|
@@ -1640,10 +1639,10 @@ class Se {
|
|
|
1640
1639
|
* @returns Array of layout objects with position, rotation, scale
|
|
1641
1640
|
*/
|
|
1642
1641
|
generateLayout(t, e, i = {}) {
|
|
1643
|
-
const
|
|
1644
|
-
return
|
|
1642
|
+
const n = this.generator.generate(t, e, i);
|
|
1643
|
+
return n.forEach((a) => {
|
|
1645
1644
|
this.layouts.set(a.id, a);
|
|
1646
|
-
}),
|
|
1645
|
+
}), n;
|
|
1647
1646
|
}
|
|
1648
1647
|
/**
|
|
1649
1648
|
* Get the original layout state for an image
|
|
@@ -1696,8 +1695,8 @@ class Se {
|
|
|
1696
1695
|
return;
|
|
1697
1696
|
if (typeof i == "number")
|
|
1698
1697
|
return i;
|
|
1699
|
-
const
|
|
1700
|
-
return a === "mobile" ?
|
|
1698
|
+
const n = i, a = this.resolveBreakpoint(t);
|
|
1699
|
+
return a === "mobile" ? n.mobile ?? n.tablet ?? n.screen : a === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
|
|
1701
1700
|
}
|
|
1702
1701
|
/**
|
|
1703
1702
|
* Calculate adaptive image size based on container dimensions and image count
|
|
@@ -1707,8 +1706,8 @@ class Se {
|
|
|
1707
1706
|
* @param viewportWidth - Current viewport width for baseHeight resolution
|
|
1708
1707
|
* @returns Calculated sizing result with height
|
|
1709
1708
|
*/
|
|
1710
|
-
calculateAdaptiveSize(t, e, i,
|
|
1711
|
-
const a = this.imageConfig.sizing, r = this.resolveBaseHeight(
|
|
1709
|
+
calculateAdaptiveSize(t, e, i, n) {
|
|
1710
|
+
const a = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
|
|
1712
1711
|
if (r !== void 0)
|
|
1713
1712
|
return { height: r };
|
|
1714
1713
|
const s = (a == null ? void 0 : a.minSize) ?? 50, h = (a == null ? void 0 : a.maxSize) ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: c, height: d } = t, p = c * d * l / e;
|
|
@@ -1728,77 +1727,77 @@ class Se {
|
|
|
1728
1727
|
return Math.max(e, Math.min(i, t));
|
|
1729
1728
|
}
|
|
1730
1729
|
}
|
|
1731
|
-
var
|
|
1732
|
-
function
|
|
1733
|
-
return
|
|
1730
|
+
var S = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(S || {});
|
|
1731
|
+
function Se(o) {
|
|
1732
|
+
return o in St;
|
|
1734
1733
|
}
|
|
1735
|
-
function Ie(
|
|
1736
|
-
return
|
|
1734
|
+
function Ie(o) {
|
|
1735
|
+
return o ? Se(o) ? St[o] : o : St.md;
|
|
1737
1736
|
}
|
|
1738
|
-
function Te(
|
|
1739
|
-
if (!
|
|
1737
|
+
function Te(o) {
|
|
1738
|
+
if (!o) return "";
|
|
1740
1739
|
const t = [];
|
|
1741
|
-
if (
|
|
1742
|
-
if (typeof
|
|
1743
|
-
t.push(`drop-shadow(${
|
|
1740
|
+
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)
|
|
1741
|
+
if (typeof o.dropShadow == "string")
|
|
1742
|
+
t.push(`drop-shadow(${o.dropShadow})`);
|
|
1744
1743
|
else {
|
|
1745
|
-
const e =
|
|
1744
|
+
const e = o.dropShadow;
|
|
1746
1745
|
t.push(`drop-shadow(${e.x}px ${e.y}px ${e.blur}px ${e.color})`);
|
|
1747
1746
|
}
|
|
1748
1747
|
return t.join(" ");
|
|
1749
1748
|
}
|
|
1750
|
-
function ct(
|
|
1751
|
-
if (!
|
|
1749
|
+
function ct(o) {
|
|
1750
|
+
if (!o || o.style === "none" || o.width === 0)
|
|
1752
1751
|
return "none";
|
|
1753
|
-
const t =
|
|
1752
|
+
const t = o.width ?? 0, e = o.style ?? "solid", i = o.color ?? "#000000";
|
|
1754
1753
|
return `${t}px ${e} ${i}`;
|
|
1755
1754
|
}
|
|
1756
|
-
function ft(
|
|
1755
|
+
function ft(o) {
|
|
1757
1756
|
var a, r;
|
|
1758
|
-
if (!
|
|
1757
|
+
if (!o) return {};
|
|
1759
1758
|
const t = {};
|
|
1760
|
-
if (
|
|
1761
|
-
const s = ((a =
|
|
1762
|
-
|
|
1763
|
-
} else ((r =
|
|
1764
|
-
if (
|
|
1765
|
-
const s =
|
|
1759
|
+
if (o.borderRadiusTopLeft !== void 0 || o.borderRadiusTopRight !== void 0 || o.borderRadiusBottomRight !== void 0 || o.borderRadiusBottomLeft !== void 0) {
|
|
1760
|
+
const s = ((a = o.border) == null ? void 0 : a.radius) ?? 0;
|
|
1761
|
+
o.borderRadiusTopLeft !== void 0 ? t.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : s && (t.borderTopLeftRadius = `${s}px`), o.borderRadiusTopRight !== void 0 ? t.borderTopRightRadius = `${o.borderRadiusTopRight}px` : s && (t.borderTopRightRadius = `${s}px`), o.borderRadiusBottomRight !== void 0 ? t.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : s && (t.borderBottomRightRadius = `${s}px`), o.borderRadiusBottomLeft !== void 0 ? t.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : s && (t.borderBottomLeftRadius = `${s}px`);
|
|
1762
|
+
} else ((r = o.border) == null ? void 0 : r.radius) !== void 0 && (t.borderRadius = `${o.border.radius}px`);
|
|
1763
|
+
if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
|
|
1764
|
+
const s = o.border || {}, h = { ...s, ...o.borderTop }, l = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, c = { ...s, ...o.borderLeft };
|
|
1766
1765
|
t.borderTop = ct(h), t.borderRight = ct(l), t.borderBottom = ct(u), t.borderLeft = ct(c);
|
|
1767
|
-
} else
|
|
1768
|
-
|
|
1769
|
-
const
|
|
1770
|
-
if (t.filter =
|
|
1771
|
-
const s =
|
|
1772
|
-
t.outline = `${s}px ${h} ${l}`,
|
|
1773
|
-
}
|
|
1774
|
-
return
|
|
1766
|
+
} else o.border && (t.border = ct(o.border));
|
|
1767
|
+
o.shadow !== void 0 && (t.boxShadow = Ie(o.shadow));
|
|
1768
|
+
const n = Te(o.filter);
|
|
1769
|
+
if (t.filter = n || "none", o.opacity !== void 0 && (t.opacity = String(o.opacity)), o.cursor !== void 0 && (t.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
|
|
1770
|
+
const s = o.outline.width ?? 0, h = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
|
|
1771
|
+
t.outline = `${s}px ${h} ${l}`, o.outline.offset !== void 0 && (t.outlineOffset = `${o.outline.offset}px`);
|
|
1772
|
+
}
|
|
1773
|
+
return o.objectFit !== void 0 && (t.objectFit = o.objectFit), o.aspectRatio !== void 0 && (t.aspectRatio = o.aspectRatio), t;
|
|
1775
1774
|
}
|
|
1776
|
-
function lt(
|
|
1777
|
-
t.borderRadius !== void 0 && (
|
|
1775
|
+
function lt(o, t) {
|
|
1776
|
+
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);
|
|
1778
1777
|
}
|
|
1779
|
-
function Pt(
|
|
1780
|
-
return
|
|
1778
|
+
function Pt(o) {
|
|
1779
|
+
return o ? Array.isArray(o) ? o.join(" ") : o : "";
|
|
1781
1780
|
}
|
|
1782
|
-
function ht(
|
|
1781
|
+
function ht(o, t) {
|
|
1783
1782
|
const e = Pt(t);
|
|
1784
1783
|
e && e.split(" ").forEach((i) => {
|
|
1785
|
-
i.trim() &&
|
|
1784
|
+
i.trim() && o.classList.add(i.trim());
|
|
1786
1785
|
});
|
|
1787
1786
|
}
|
|
1788
|
-
function _t(
|
|
1787
|
+
function _t(o, t) {
|
|
1789
1788
|
const e = Pt(t);
|
|
1790
1789
|
e && e.split(" ").forEach((i) => {
|
|
1791
|
-
i.trim() &&
|
|
1790
|
+
i.trim() && o.classList.remove(i.trim());
|
|
1792
1791
|
});
|
|
1793
1792
|
}
|
|
1794
1793
|
const Ot = {
|
|
1795
1794
|
UNFOCUSING: 999,
|
|
1796
1795
|
FOCUSING: 1e3
|
|
1797
1796
|
};
|
|
1798
|
-
class
|
|
1797
|
+
class Ce {
|
|
1799
1798
|
constructor(t, e, i) {
|
|
1800
|
-
var
|
|
1801
|
-
this.state =
|
|
1799
|
+
var n, a;
|
|
1800
|
+
this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = e, this.defaultStyles = ft(i == null ? void 0 : i.default), this.focusedStyles = ft(i == null ? void 0 : i.focused), this.defaultClassName = (n = i == null ? void 0 : i.default) == null ? void 0 : n.className, this.focusedClassName = (a = i == null ? void 0 : i.focused) == null ? void 0 : a.className;
|
|
1802
1801
|
}
|
|
1803
1802
|
/**
|
|
1804
1803
|
* Get current state machine state
|
|
@@ -1810,7 +1809,7 @@ class Re {
|
|
|
1810
1809
|
* Check if any animation is in progress
|
|
1811
1810
|
*/
|
|
1812
1811
|
isAnimating() {
|
|
1813
|
-
return this.state !==
|
|
1812
|
+
return this.state !== S.IDLE && this.state !== S.FOCUSED;
|
|
1814
1813
|
}
|
|
1815
1814
|
/**
|
|
1816
1815
|
* Normalize scalePercent value
|
|
@@ -1823,9 +1822,9 @@ class Re {
|
|
|
1823
1822
|
* Returns actual pixel dimensions instead of scale factor for sharper rendering
|
|
1824
1823
|
*/
|
|
1825
1824
|
calculateFocusDimensions(t, e, i) {
|
|
1826
|
-
const
|
|
1825
|
+
const n = this.normalizeScalePercent(this.config.scalePercent), a = i.height * n, r = t / e;
|
|
1827
1826
|
let s = a, h = s * r;
|
|
1828
|
-
const l = i.width *
|
|
1827
|
+
const l = i.width * n;
|
|
1829
1828
|
return h > l && (h = l, s = h / r), { width: h, height: s };
|
|
1830
1829
|
}
|
|
1831
1830
|
/**
|
|
@@ -1833,7 +1832,7 @@ class Re {
|
|
|
1833
1832
|
* Scale is handled by animating actual dimensions for sharper rendering
|
|
1834
1833
|
*/
|
|
1835
1834
|
calculateFocusTransform(t, e) {
|
|
1836
|
-
const i = t.width / 2,
|
|
1835
|
+
const i = t.width / 2, n = t.height / 2, a = i - e.x, r = n - e.y;
|
|
1837
1836
|
return {
|
|
1838
1837
|
x: a,
|
|
1839
1838
|
y: r,
|
|
@@ -1848,8 +1847,8 @@ class Re {
|
|
|
1848
1847
|
buildDimensionZoomTransform(t) {
|
|
1849
1848
|
const e = ["translate(-50%, -50%)"];
|
|
1850
1849
|
if (t.x !== void 0 || t.y !== void 0) {
|
|
1851
|
-
const i = t.x ?? 0,
|
|
1852
|
-
e.push(`translate(${i}px, ${
|
|
1850
|
+
const i = t.x ?? 0, n = t.y ?? 0;
|
|
1851
|
+
e.push(`translate(${i}px, ${n}px)`);
|
|
1853
1852
|
}
|
|
1854
1853
|
return t.rotation !== void 0 && e.push(`rotate(${t.rotation}deg)`), e.join(" ");
|
|
1855
1854
|
}
|
|
@@ -1857,13 +1856,13 @@ class Re {
|
|
|
1857
1856
|
* Create a Web Animation that animates both transform (position) and dimensions
|
|
1858
1857
|
* This provides sharper zoom by re-rendering at target size instead of scaling pixels
|
|
1859
1858
|
*/
|
|
1860
|
-
animateWithDimensions(t, e, i,
|
|
1859
|
+
animateWithDimensions(t, e, i, n, a, r, s, h) {
|
|
1861
1860
|
const l = this.buildDimensionZoomTransform(e), u = this.buildDimensionZoomTransform(i);
|
|
1862
1861
|
return t.style.transition = "none", t.animate(
|
|
1863
1862
|
[
|
|
1864
1863
|
{
|
|
1865
1864
|
transform: l,
|
|
1866
|
-
width: `${
|
|
1865
|
+
width: `${n}px`,
|
|
1867
1866
|
height: `${a}px`
|
|
1868
1867
|
},
|
|
1869
1868
|
{
|
|
@@ -1897,10 +1896,10 @@ class Re {
|
|
|
1897
1896
|
* @param fromTransform - Optional starting transform (for mid-animation reversals)
|
|
1898
1897
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1899
1898
|
*/
|
|
1900
|
-
startFocusAnimation(t, e, i,
|
|
1899
|
+
startFocusAnimation(t, e, i, n, a) {
|
|
1901
1900
|
const r = t.style.zIndex || "", s = t.offsetWidth, h = t.offsetHeight, l = this.calculateFocusDimensions(s, h, e), u = this.calculateFocusTransform(e, i);
|
|
1902
1901
|
this.applyFocusedStyling(t, Ot.FOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1903
|
-
const c =
|
|
1902
|
+
const c = n ?? {
|
|
1904
1903
|
x: 0,
|
|
1905
1904
|
y: 0,
|
|
1906
1905
|
rotation: i.rotation,
|
|
@@ -1947,10 +1946,10 @@ class Re {
|
|
|
1947
1946
|
* Animates back to original dimensions for consistent behavior
|
|
1948
1947
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1949
1948
|
*/
|
|
1950
|
-
startUnfocusAnimation(t, e, i,
|
|
1949
|
+
startUnfocusAnimation(t, e, i, n) {
|
|
1951
1950
|
var b, p, g, f, y;
|
|
1952
1951
|
t.style.zIndex = String(Ot.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
1953
|
-
const a = i ?? ((b = this.focusData) == null ? void 0 : b.focusTransform) ?? { x: 0, y: 0, rotation: 0, scale: 1 }, r = (
|
|
1952
|
+
const a = i ?? ((b = this.focusData) == null ? void 0 : b.focusTransform) ?? { x: 0, y: 0, rotation: 0, scale: 1 }, r = (n == null ? void 0 : n.width) ?? ((p = this.focusData) == null ? void 0 : p.focusWidth) ?? t.offsetWidth, s = (n == null ? void 0 : n.height) ?? ((g = this.focusData) == null ? void 0 : g.focusHeight) ?? t.offsetHeight, h = {
|
|
1954
1953
|
x: 0,
|
|
1955
1954
|
y: 0,
|
|
1956
1955
|
rotation: e.rotation,
|
|
@@ -1995,10 +1994,10 @@ class Re {
|
|
|
1995
1994
|
/**
|
|
1996
1995
|
* Reset an element instantly to its original position and dimensions (no animation)
|
|
1997
1996
|
*/
|
|
1998
|
-
resetElementInstantly(t, e, i,
|
|
1997
|
+
resetElementInstantly(t, e, i, n, a) {
|
|
1999
1998
|
this.animationEngine.cancelAllAnimations(t);
|
|
2000
1999
|
const r = ["translate(-50%, -50%)"];
|
|
2001
|
-
r.push("translate(0px, 0px)"), r.push(`rotate(${e.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "),
|
|
2000
|
+
r.push("translate(0px, 0px)"), r.push(`rotate(${e.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), n !== void 0 && a !== void 0 && (t.style.width = `${n}px`, t.style.height = `${a}px`), this.removeFocusedStyling(t, i);
|
|
2002
2001
|
}
|
|
2003
2002
|
/**
|
|
2004
2003
|
* Focus (zoom) an image to center of container
|
|
@@ -2006,9 +2005,9 @@ class Re {
|
|
|
2006
2005
|
*/
|
|
2007
2006
|
async focusImage(t, e, i) {
|
|
2008
2007
|
var a, r, s, h, l, u, c, d, m, b, p, g;
|
|
2009
|
-
if (this.currentFocus === t && this.state ===
|
|
2008
|
+
if (this.currentFocus === t && this.state === S.FOCUSED)
|
|
2010
2009
|
return this.unfocusImage();
|
|
2011
|
-
if (((a = this.incoming) == null ? void 0 : a.element) === t && this.state ===
|
|
2010
|
+
if (((a = this.incoming) == null ? void 0 : a.element) === t && this.state === S.FOCUSING) {
|
|
2012
2011
|
const f = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), y = {
|
|
2013
2012
|
x: f.x,
|
|
2014
2013
|
y: f.y,
|
|
@@ -2024,44 +2023,44 @@ class Re {
|
|
|
2024
2023
|
this.incoming.originalState,
|
|
2025
2024
|
y,
|
|
2026
2025
|
v
|
|
2027
|
-
), this.incoming = null, this.state =
|
|
2026
|
+
), this.incoming = null, this.state = S.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, ((r = this.focusData) == null ? void 0 : r.originalZIndex) || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE;
|
|
2028
2027
|
return;
|
|
2029
2028
|
}
|
|
2030
|
-
const
|
|
2029
|
+
const n = ++this.focusGeneration;
|
|
2031
2030
|
switch (this.state) {
|
|
2032
|
-
case
|
|
2033
|
-
if (this.state =
|
|
2034
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2031
|
+
case S.IDLE:
|
|
2032
|
+
if (this.state = S.FOCUSING, this.incoming = this.startFocusAnimation(t, e, i), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2033
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2035
2034
|
break;
|
|
2036
|
-
case
|
|
2037
|
-
if (this.state =
|
|
2035
|
+
case S.FOCUSED:
|
|
2036
|
+
if (this.state = S.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
|
|
2038
2037
|
this.currentFocus,
|
|
2039
2038
|
this.focusData.originalState
|
|
2040
2039
|
)), this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
2041
2040
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2042
2041
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2043
|
-
]), this.focusGeneration !==
|
|
2042
|
+
]), this.focusGeneration !== n)
|
|
2044
2043
|
return;
|
|
2045
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((s = this.outgoing.originalState.zIndex) == null ? void 0 : s.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2044
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((s = this.outgoing.originalState.zIndex) == null ? void 0 : s.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2046
2045
|
break;
|
|
2047
|
-
case
|
|
2046
|
+
case S.FOCUSING:
|
|
2048
2047
|
if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
|
|
2049
2048
|
this.incoming.element,
|
|
2050
2049
|
this.incoming.originalState,
|
|
2051
2050
|
((h = this.focusData) == null ? void 0 : h.originalZIndex) || "",
|
|
2052
2051
|
(l = this.focusData) == null ? void 0 : l.originalWidth,
|
|
2053
2052
|
(u = this.focusData) == null ? void 0 : u.originalHeight
|
|
2054
|
-
), this.incoming = null), this.incoming = this.startFocusAnimation(t, e, i), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !==
|
|
2055
|
-
this.currentFocus = t, this.incoming = null, this.state =
|
|
2053
|
+
), this.incoming = null), this.incoming = this.startFocusAnimation(t, e, i), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
|
|
2054
|
+
this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2056
2055
|
break;
|
|
2057
|
-
case
|
|
2058
|
-
if (this.state =
|
|
2056
|
+
case S.UNFOCUSING:
|
|
2057
|
+
if (this.state = S.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
2059
2058
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2060
2059
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2061
|
-
]), this.focusGeneration !==
|
|
2062
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((c = this.outgoing.originalState.zIndex) == null ? void 0 : c.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2060
|
+
]), this.focusGeneration !== n) return;
|
|
2061
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((c = this.outgoing.originalState.zIndex) == null ? void 0 : c.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2063
2062
|
break;
|
|
2064
|
-
case
|
|
2063
|
+
case S.CROSS_ANIMATING:
|
|
2065
2064
|
if (((d = this.incoming) == null ? void 0 : d.element) === t)
|
|
2066
2065
|
return;
|
|
2067
2066
|
if (((m = this.outgoing) == null ? void 0 : m.element) === t) {
|
|
@@ -2076,7 +2075,7 @@ class Re {
|
|
|
2076
2075
|
height: t.offsetHeight
|
|
2077
2076
|
};
|
|
2078
2077
|
if (this.incoming) {
|
|
2079
|
-
const I = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0),
|
|
2078
|
+
const I = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), C = {
|
|
2080
2079
|
x: I.x,
|
|
2081
2080
|
y: I.y,
|
|
2082
2081
|
rotation: I.rotation,
|
|
@@ -2089,7 +2088,7 @@ class Re {
|
|
|
2089
2088
|
this.outgoing = this.startUnfocusAnimation(
|
|
2090
2089
|
this.incoming.element,
|
|
2091
2090
|
this.incoming.originalState,
|
|
2092
|
-
|
|
2091
|
+
C,
|
|
2093
2092
|
w
|
|
2094
2093
|
);
|
|
2095
2094
|
} else
|
|
@@ -2097,8 +2096,8 @@ class Re {
|
|
|
2097
2096
|
if (this.incoming = this.startFocusAnimation(t, e, i, y, v), await Promise.all([
|
|
2098
2097
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2099
2098
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2100
|
-
]), this.focusGeneration !==
|
|
2101
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((b = this.outgoing.originalState.zIndex) == null ? void 0 : b.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2099
|
+
]), this.focusGeneration !== n) return;
|
|
2100
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((b = this.outgoing.originalState.zIndex) == null ? void 0 : b.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2102
2101
|
return;
|
|
2103
2102
|
}
|
|
2104
2103
|
if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
@@ -2128,8 +2127,8 @@ class Re {
|
|
|
2128
2127
|
if (this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
|
|
2129
2128
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2130
2129
|
this.waitForAnimation(this.incoming.animationHandle)
|
|
2131
|
-
]), this.focusGeneration !==
|
|
2132
|
-
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((g = this.outgoing.originalState.zIndex) == null ? void 0 : g.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state =
|
|
2130
|
+
]), this.focusGeneration !== n) return;
|
|
2131
|
+
this.outgoing && (this.removeFocusedStyling(this.outgoing.element, ((g = this.outgoing.originalState.zIndex) == null ? void 0 : g.toString()) || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
|
|
2133
2132
|
break;
|
|
2134
2133
|
}
|
|
2135
2134
|
}
|
|
@@ -2140,7 +2139,7 @@ class Re {
|
|
|
2140
2139
|
var a, r, s;
|
|
2141
2140
|
const t = ++this.focusGeneration;
|
|
2142
2141
|
if (!this.currentFocus || !this.focusData) {
|
|
2143
|
-
if (this.incoming && this.state ===
|
|
2142
|
+
if (this.incoming && this.state === S.FOCUSING) {
|
|
2144
2143
|
const h = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), l = {
|
|
2145
2144
|
x: h.x,
|
|
2146
2145
|
y: h.y,
|
|
@@ -2156,12 +2155,12 @@ class Re {
|
|
|
2156
2155
|
this.incoming.originalState,
|
|
2157
2156
|
l,
|
|
2158
2157
|
u
|
|
2159
|
-
), this.incoming = null, this.state =
|
|
2160
|
-
this.removeFocusedStyling(this.outgoing.element, ((a = this.focusData) == null ? void 0 : a.originalZIndex) || ""), this.outgoing = null, this.focusData = null, this.state =
|
|
2158
|
+
), this.incoming = null, this.state = S.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
|
|
2159
|
+
this.removeFocusedStyling(this.outgoing.element, ((a = this.focusData) == null ? void 0 : a.originalZIndex) || ""), this.outgoing = null, this.focusData = null, this.state = S.IDLE;
|
|
2161
2160
|
}
|
|
2162
2161
|
return;
|
|
2163
2162
|
}
|
|
2164
|
-
if (this.state ===
|
|
2163
|
+
if (this.state === S.CROSS_ANIMATING && this.incoming) {
|
|
2165
2164
|
const h = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), l = {
|
|
2166
2165
|
x: h.x,
|
|
2167
2166
|
y: h.y,
|
|
@@ -2181,12 +2180,12 @@ class Re {
|
|
|
2181
2180
|
this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
|
|
2182
2181
|
this.waitForAnimation(c.animationHandle)
|
|
2183
2182
|
]), this.focusGeneration !== t) return;
|
|
2184
|
-
this.outgoing && this.removeFocusedStyling(this.outgoing.element, ((r = this.outgoing.originalState.zIndex) == null ? void 0 : r.toString()) || ""), this.removeFocusedStyling(c.element, ((s = this.incoming.originalState.zIndex) == null ? void 0 : s.toString()) || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state =
|
|
2183
|
+
this.outgoing && this.removeFocusedStyling(this.outgoing.element, ((r = this.outgoing.originalState.zIndex) == null ? void 0 : r.toString()) || ""), this.removeFocusedStyling(c.element, ((s = this.incoming.originalState.zIndex) == null ? void 0 : s.toString()) || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE;
|
|
2185
2184
|
return;
|
|
2186
2185
|
}
|
|
2187
|
-
this.state =
|
|
2188
|
-
const e = this.currentFocus, i = this.focusData.originalState,
|
|
2189
|
-
this.outgoing = this.startUnfocusAnimation(e, i), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(e,
|
|
2186
|
+
this.state = S.UNFOCUSING;
|
|
2187
|
+
const e = this.currentFocus, i = this.focusData.originalState, n = this.focusData.originalZIndex;
|
|
2188
|
+
this.outgoing = this.startUnfocusAnimation(e, i), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(e, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE);
|
|
2190
2189
|
}
|
|
2191
2190
|
/**
|
|
2192
2191
|
* Swap focus from current image to a new one (alias for focusImage with cross-animation)
|
|
@@ -2204,7 +2203,7 @@ class Re {
|
|
|
2204
2203
|
* Check if an image is currently focused (stable state)
|
|
2205
2204
|
*/
|
|
2206
2205
|
isFocused(t) {
|
|
2207
|
-
return this.currentFocus === t && this.state ===
|
|
2206
|
+
return this.currentFocus === t && this.state === S.FOCUSED;
|
|
2208
2207
|
}
|
|
2209
2208
|
/**
|
|
2210
2209
|
* Check if an image is the target of current focus animation
|
|
@@ -2227,9 +2226,9 @@ class Re {
|
|
|
2227
2226
|
* Used during swipe gestures for visual feedback
|
|
2228
2227
|
*/
|
|
2229
2228
|
setDragOffset(t) {
|
|
2230
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2231
|
-
const e = this.currentFocus, i = this.focusData.focusTransform,
|
|
2232
|
-
|
|
2229
|
+
if (!this.currentFocus || !this.focusData || this.state !== S.FOCUSED) return;
|
|
2230
|
+
const e = this.currentFocus, i = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], a = (i.x ?? 0) + t, r = i.y ?? 0;
|
|
2231
|
+
n.push(`translate(${a}px, ${r}px)`), i.rotation !== void 0 && n.push(`rotate(${i.rotation}deg)`), e.style.transition = "none", e.style.transform = n.join(" ");
|
|
2233
2232
|
}
|
|
2234
2233
|
/**
|
|
2235
2234
|
* Clear the drag offset, optionally animating back to center
|
|
@@ -2237,9 +2236,9 @@ class Re {
|
|
|
2237
2236
|
* @param duration - Animation duration in ms (default 150)
|
|
2238
2237
|
*/
|
|
2239
2238
|
clearDragOffset(t, e = 150) {
|
|
2240
|
-
if (!this.currentFocus || !this.focusData || this.state !==
|
|
2241
|
-
const i = this.currentFocus,
|
|
2242
|
-
a.push(`translate(${r}px, ${s}px)`),
|
|
2239
|
+
if (!this.currentFocus || !this.focusData || this.state !== S.FOCUSED) return;
|
|
2240
|
+
const i = this.currentFocus, n = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = n.x ?? 0, s = n.y ?? 0;
|
|
2241
|
+
a.push(`translate(${r}px, ${s}px)`), n.rotation !== void 0 && a.push(`rotate(${n.rotation}deg)`);
|
|
2243
2242
|
const h = a.join(" ");
|
|
2244
2243
|
t ? (i.style.transition = `transform ${e}ms ease-out`, i.style.transform = h, setTimeout(() => {
|
|
2245
2244
|
this.currentFocus === i && (i.style.transition = "none");
|
|
@@ -2249,7 +2248,7 @@ class Re {
|
|
|
2249
2248
|
* Reset zoom state (cancels all animations)
|
|
2250
2249
|
*/
|
|
2251
2250
|
reset() {
|
|
2252
|
-
var t, e, i,
|
|
2251
|
+
var t, e, i, n;
|
|
2253
2252
|
this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
|
|
2254
2253
|
this.outgoing.element,
|
|
2255
2254
|
this.outgoing.originalState,
|
|
@@ -2261,17 +2260,17 @@ class Re {
|
|
|
2261
2260
|
this.incoming.originalState,
|
|
2262
2261
|
((e = this.focusData) == null ? void 0 : e.originalZIndex) || "",
|
|
2263
2262
|
(i = this.focusData) == null ? void 0 : i.originalWidth,
|
|
2264
|
-
(
|
|
2263
|
+
(n = this.focusData) == null ? void 0 : n.originalHeight
|
|
2265
2264
|
)), this.currentFocus && this.focusData && this.resetElementInstantly(
|
|
2266
2265
|
this.currentFocus,
|
|
2267
2266
|
this.focusData.originalState,
|
|
2268
2267
|
this.focusData.originalZIndex,
|
|
2269
2268
|
this.focusData.originalWidth,
|
|
2270
2269
|
this.focusData.originalHeight
|
|
2271
|
-
), this.state =
|
|
2270
|
+
), this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2272
2271
|
}
|
|
2273
2272
|
}
|
|
2274
|
-
const Ae = 50,
|
|
2273
|
+
const Ae = 50, Re = 0.5, Me = 20, ze = 0.3, Le = 150, Fe = 30, mt = class mt {
|
|
2275
2274
|
constructor(t, e) {
|
|
2276
2275
|
this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = e, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
|
|
2277
2276
|
}
|
|
@@ -2316,9 +2315,9 @@ const Ae = 50, Ce = 0.5, Me = 20, ze = 0.3, Le = 150, Fe = 30, mt = class mt {
|
|
|
2316
2315
|
}
|
|
2317
2316
|
handleTouchMove(t) {
|
|
2318
2317
|
if (!this.touchState || t.touches.length !== 1) return;
|
|
2319
|
-
const e = t.touches[0], i = e.clientX - this.touchState.startX,
|
|
2320
|
-
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i +
|
|
2321
|
-
const s = Math.atan2(Math.abs(
|
|
2318
|
+
const e = t.touches[0], i = e.clientX - this.touchState.startX, n = e.clientY - this.touchState.startY;
|
|
2319
|
+
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + n * n) > 10) {
|
|
2320
|
+
const s = Math.atan2(Math.abs(n), Math.abs(i)) * (180 / Math.PI);
|
|
2322
2321
|
this.touchState.isHorizontalSwipe = s <= Fe;
|
|
2323
2322
|
}
|
|
2324
2323
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
@@ -2330,9 +2329,9 @@ const Ae = 50, Ce = 0.5, Me = 20, ze = 0.3, Le = 150, Fe = 30, mt = class mt {
|
|
|
2330
2329
|
handleTouchEnd(t) {
|
|
2331
2330
|
if (!this.touchState) return;
|
|
2332
2331
|
this.recentTouchTimestamp = Date.now();
|
|
2333
|
-
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime,
|
|
2332
|
+
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, n = Math.abs(e) / i, a = Math.abs(e);
|
|
2334
2333
|
let r = !1;
|
|
2335
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= Ae ||
|
|
2334
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= Ae || n >= Re && a >= Me) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2336
2335
|
}
|
|
2337
2336
|
handleTouchCancel(t) {
|
|
2338
2337
|
var e;
|
|
@@ -2355,7 +2354,7 @@ class Oe {
|
|
|
2355
2354
|
for (const e of this.sources)
|
|
2356
2355
|
if ("folders" in e)
|
|
2357
2356
|
for (const i of e.folders) {
|
|
2358
|
-
const
|
|
2357
|
+
const n = e.recursive !== void 0 ? e.recursive : !0, a = await this.loadFromFolder(i, t, n);
|
|
2359
2358
|
this._discoveredUrls.push(...a);
|
|
2360
2359
|
}
|
|
2361
2360
|
else if ("files" in e) {
|
|
@@ -2401,9 +2400,9 @@ class Oe {
|
|
|
2401
2400
|
// Alternative format
|
|
2402
2401
|
];
|
|
2403
2402
|
for (const i of e) {
|
|
2404
|
-
const
|
|
2405
|
-
if (
|
|
2406
|
-
return
|
|
2403
|
+
const n = t.match(i);
|
|
2404
|
+
if (n && n[1])
|
|
2405
|
+
return n[1];
|
|
2407
2406
|
}
|
|
2408
2407
|
return null;
|
|
2409
2408
|
}
|
|
@@ -2415,15 +2414,15 @@ class Oe {
|
|
|
2415
2414
|
* @returns Promise resolving to array of image URLs
|
|
2416
2415
|
*/
|
|
2417
2416
|
async loadFromFolder(t, e, i = !0) {
|
|
2418
|
-
const
|
|
2419
|
-
if (!
|
|
2417
|
+
const n = this.extractFolderId(t);
|
|
2418
|
+
if (!n)
|
|
2420
2419
|
throw new Error("Invalid Google Drive folder URL. Please check the URL format.");
|
|
2421
2420
|
if (!this.apiKey || this.apiKey === "YOUR_API_KEY_HERE")
|
|
2422
|
-
return this.loadImagesDirectly(
|
|
2421
|
+
return this.loadImagesDirectly(n, e);
|
|
2423
2422
|
try {
|
|
2424
|
-
return i ? await this.loadImagesRecursively(
|
|
2423
|
+
return i ? await this.loadImagesRecursively(n, e) : await this.loadImagesFromSingleFolder(n, e);
|
|
2425
2424
|
} catch (a) {
|
|
2426
|
-
return console.error("Error loading from Google Drive API:", a), this.loadImagesDirectly(
|
|
2425
|
+
return console.error("Error loading from Google Drive API:", a), this.loadImagesDirectly(n, e);
|
|
2427
2426
|
}
|
|
2428
2427
|
}
|
|
2429
2428
|
/**
|
|
@@ -2433,7 +2432,7 @@ class Oe {
|
|
|
2433
2432
|
* @returns Promise resolving to array of image URLs
|
|
2434
2433
|
*/
|
|
2435
2434
|
async loadImagesFromSingleFolder(t, e) {
|
|
2436
|
-
const i = [],
|
|
2435
|
+
const i = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2437
2436
|
if (!s.ok)
|
|
2438
2437
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2439
2438
|
const l = (await s.json()).files.filter(
|
|
@@ -2451,10 +2450,10 @@ class Oe {
|
|
|
2451
2450
|
*/
|
|
2452
2451
|
async loadFiles(t, e) {
|
|
2453
2452
|
const i = [];
|
|
2454
|
-
for (const
|
|
2455
|
-
const a = this.extractFileId(
|
|
2453
|
+
for (const n of t) {
|
|
2454
|
+
const a = this.extractFileId(n);
|
|
2456
2455
|
if (!a) {
|
|
2457
|
-
this.log(`Skipping invalid file URL: ${
|
|
2456
|
+
this.log(`Skipping invalid file URL: ${n}`);
|
|
2458
2457
|
continue;
|
|
2459
2458
|
}
|
|
2460
2459
|
if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
|
|
@@ -2490,9 +2489,9 @@ class Oe {
|
|
|
2490
2489
|
// Generic id parameter
|
|
2491
2490
|
];
|
|
2492
2491
|
for (const i of e) {
|
|
2493
|
-
const
|
|
2494
|
-
if (
|
|
2495
|
-
return
|
|
2492
|
+
const n = t.match(i);
|
|
2493
|
+
if (n && n[1])
|
|
2494
|
+
return n[1];
|
|
2496
2495
|
}
|
|
2497
2496
|
return null;
|
|
2498
2497
|
}
|
|
@@ -2503,7 +2502,7 @@ class Oe {
|
|
|
2503
2502
|
* @returns Promise resolving to array of image URLs
|
|
2504
2503
|
*/
|
|
2505
2504
|
async loadImagesRecursively(t, e) {
|
|
2506
|
-
const i = [],
|
|
2505
|
+
const i = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
|
|
2507
2506
|
if (!s.ok)
|
|
2508
2507
|
throw new Error(`API request failed: ${s.status} ${s.statusText}`);
|
|
2509
2508
|
const h = await s.json(), l = h.files.filter(
|
|
@@ -2530,10 +2529,10 @@ class Oe {
|
|
|
2530
2529
|
*/
|
|
2531
2530
|
async loadImagesDirectly(t, e) {
|
|
2532
2531
|
try {
|
|
2533
|
-
const i = `https://drive.google.com/embeddedfolderview?id=${t}`,
|
|
2534
|
-
if (!
|
|
2532
|
+
const i = `https://drive.google.com/embeddedfolderview?id=${t}`, n = await fetch(i, { mode: "cors" });
|
|
2533
|
+
if (!n.ok)
|
|
2535
2534
|
throw new Error("Cannot access folder directly (CORS or permissions issue)");
|
|
2536
|
-
const a = await
|
|
2535
|
+
const a = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, s = [...a.matchAll(r)];
|
|
2537
2536
|
return [...new Set(s.map((u) => u[1]))].map(
|
|
2538
2537
|
(u) => `https://drive.google.com/uc?export=view&id=${u}`
|
|
2539
2538
|
);
|
|
@@ -2626,13 +2625,13 @@ class $e {
|
|
|
2626
2625
|
if (!Array.isArray(t))
|
|
2627
2626
|
return console.warn("URLs must be an array:", t), [];
|
|
2628
2627
|
const i = [];
|
|
2629
|
-
for (const
|
|
2630
|
-
const a =
|
|
2628
|
+
for (const n of t) {
|
|
2629
|
+
const a = n.split("/").pop() || n;
|
|
2631
2630
|
if (!e.isAllowed(a)) {
|
|
2632
|
-
this.log(`Skipping filtered URL: ${
|
|
2631
|
+
this.log(`Skipping filtered URL: ${n}`);
|
|
2633
2632
|
continue;
|
|
2634
2633
|
}
|
|
2635
|
-
this.validateUrls ? await this.validateUrl(
|
|
2634
|
+
this.validateUrls ? await this.validateUrl(n) ? i.push(n) : console.warn(`Skipping invalid/missing URL: ${n}`) : i.push(n);
|
|
2636
2635
|
}
|
|
2637
2636
|
return i;
|
|
2638
2637
|
}
|
|
@@ -2646,16 +2645,16 @@ class $e {
|
|
|
2646
2645
|
async processPath(t, e, i) {
|
|
2647
2646
|
if (!Array.isArray(e))
|
|
2648
2647
|
return console.warn("files must be an array:", e), [];
|
|
2649
|
-
const
|
|
2648
|
+
const n = [];
|
|
2650
2649
|
for (const a of e) {
|
|
2651
2650
|
if (!i.isAllowed(a)) {
|
|
2652
2651
|
this.log(`Skipping filtered file: ${a}`);
|
|
2653
2652
|
continue;
|
|
2654
2653
|
}
|
|
2655
2654
|
const r = this.constructUrl(t, a);
|
|
2656
|
-
this.validateUrls ? await this.validateUrl(r) ?
|
|
2655
|
+
this.validateUrls ? await this.validateUrl(r) ? n.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : n.push(r);
|
|
2657
2656
|
}
|
|
2658
|
-
return
|
|
2657
|
+
return n;
|
|
2659
2658
|
}
|
|
2660
2659
|
/**
|
|
2661
2660
|
* Process a JSON endpoint source
|
|
@@ -2666,17 +2665,17 @@ class $e {
|
|
|
2666
2665
|
*/
|
|
2667
2666
|
async processJson(t, e) {
|
|
2668
2667
|
this.log(`Fetching JSON endpoint: ${t}`);
|
|
2669
|
-
const i = new AbortController(),
|
|
2668
|
+
const i = new AbortController(), n = setTimeout(() => i.abort(), 1e4);
|
|
2670
2669
|
try {
|
|
2671
2670
|
const a = await fetch(t, { signal: i.signal });
|
|
2672
|
-
if (clearTimeout(
|
|
2671
|
+
if (clearTimeout(n), !a.ok)
|
|
2673
2672
|
throw new Error(`HTTP ${a.status} fetching ${t}`);
|
|
2674
2673
|
const r = await a.json();
|
|
2675
2674
|
if (!r || !Array.isArray(r.images))
|
|
2676
2675
|
throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
|
|
2677
2676
|
return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, e);
|
|
2678
2677
|
} catch (a) {
|
|
2679
|
-
throw clearTimeout(
|
|
2678
|
+
throw clearTimeout(n), a instanceof Error && a.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : a;
|
|
2680
2679
|
}
|
|
2681
2680
|
}
|
|
2682
2681
|
/**
|
|
@@ -2698,11 +2697,11 @@ class $e {
|
|
|
2698
2697
|
if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
|
|
2699
2698
|
return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
|
|
2700
2699
|
try {
|
|
2701
|
-
const i = new AbortController(),
|
|
2700
|
+
const i = new AbortController(), n = setTimeout(() => i.abort(), this.validationTimeout), a = await fetch(t, {
|
|
2702
2701
|
method: "HEAD",
|
|
2703
2702
|
signal: i.signal
|
|
2704
2703
|
});
|
|
2705
|
-
return clearTimeout(
|
|
2704
|
+
return clearTimeout(n), a.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${a.status}`), !1);
|
|
2706
2705
|
} catch (i) {
|
|
2707
2706
|
return i instanceof Error && (i.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, i.message)), !1;
|
|
2708
2707
|
}
|
|
@@ -2719,8 +2718,8 @@ class $e {
|
|
|
2719
2718
|
return `${i}/${e}`;
|
|
2720
2719
|
if (typeof window > "u")
|
|
2721
2720
|
return `${i}/${e}`;
|
|
2722
|
-
const
|
|
2723
|
-
return `${
|
|
2721
|
+
const n = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
|
|
2722
|
+
return `${n}${r}/${e}`;
|
|
2724
2723
|
}
|
|
2725
2724
|
/**
|
|
2726
2725
|
* Check if URL is absolute (contains protocol)
|
|
@@ -2754,16 +2753,16 @@ class De {
|
|
|
2754
2753
|
*/
|
|
2755
2754
|
async prepare(t) {
|
|
2756
2755
|
this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
|
|
2757
|
-
const e = this.loaders.map((i,
|
|
2758
|
-
this.log(`Loader ${
|
|
2756
|
+
const e = this.loaders.map((i, n) => i.prepare(t).then(() => {
|
|
2757
|
+
this.log(`Loader ${n} prepared with ${i.imagesLength()} images`);
|
|
2759
2758
|
}).catch((a) => {
|
|
2760
|
-
console.warn(`Loader ${
|
|
2759
|
+
console.warn(`Loader ${n} failed to prepare:`, a);
|
|
2761
2760
|
}));
|
|
2762
2761
|
await Promise.all(e);
|
|
2763
2762
|
for (const i of this.loaders)
|
|
2764
2763
|
if (i.isPrepared()) {
|
|
2765
|
-
const
|
|
2766
|
-
this._discoveredUrls.push(...
|
|
2764
|
+
const n = i.imageURLs();
|
|
2765
|
+
this._discoveredUrls.push(...n);
|
|
2767
2766
|
}
|
|
2768
2767
|
this._prepared = !0, this.log(`CompositeLoader prepared with ${this._discoveredUrls.length} total images`);
|
|
2769
2768
|
}
|
|
@@ -2821,8 +2820,8 @@ class Ue {
|
|
|
2821
2820
|
* @returns True if the file extension is allowed
|
|
2822
2821
|
*/
|
|
2823
2822
|
isAllowed(t) {
|
|
2824
|
-
var
|
|
2825
|
-
const i = (
|
|
2823
|
+
var n;
|
|
2824
|
+
const i = (n = t.split("?")[0].split(".").pop()) == null ? void 0 : n.toLowerCase();
|
|
2826
2825
|
return i ? this.allowedExtensions.includes(i) : !1;
|
|
2827
2826
|
}
|
|
2828
2827
|
/**
|
|
@@ -2874,25 +2873,34 @@ const Pe = `
|
|
|
2874
2873
|
will-change: auto;
|
|
2875
2874
|
}
|
|
2876
2875
|
|
|
2876
|
+
.fbn-ic-counter {
|
|
2877
|
+
position: fixed;
|
|
2878
|
+
bottom: 24px;
|
|
2879
|
+
left: 50%;
|
|
2880
|
+
transform: translateX(-50%);
|
|
2881
|
+
z-index: 10001;
|
|
2882
|
+
pointer-events: none;
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2877
2885
|
.fbn-ic-hidden {
|
|
2878
2886
|
display: none !important;
|
|
2879
2887
|
}
|
|
2880
2888
|
`;
|
|
2881
2889
|
function _e() {
|
|
2882
2890
|
if (typeof document > "u") return;
|
|
2883
|
-
const
|
|
2884
|
-
if (document.getElementById(
|
|
2891
|
+
const o = "fbn-ic-functional-styles";
|
|
2892
|
+
if (document.getElementById(o)) return;
|
|
2885
2893
|
const t = document.createElement("style");
|
|
2886
|
-
t.id =
|
|
2894
|
+
t.id = o, t.textContent = Pe, document.head.appendChild(t);
|
|
2887
2895
|
}
|
|
2888
2896
|
class He {
|
|
2889
2897
|
constructor(t = {}) {
|
|
2890
|
-
var i,
|
|
2891
|
-
this.fullConfig = Vt(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.animationEngine = new te(this.fullConfig.animation), this.layoutEngine = new
|
|
2898
|
+
var i, n, a, r, s, h;
|
|
2899
|
+
this.fullConfig = Vt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new te(this.fullConfig.animation), this.layoutEngine = new Ee({
|
|
2892
2900
|
layout: this.fullConfig.layout,
|
|
2893
2901
|
image: this.fullConfig.image
|
|
2894
|
-
}), this.zoomEngine = new
|
|
2895
|
-
const e = this.fullConfig.animation.entry ||
|
|
2902
|
+
}), this.zoomEngine = new Ce(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = ft((i = this.fullConfig.styling) == null ? void 0 : i.default), this.hoverStyles = ft((n = this.fullConfig.styling) == null ? void 0 : n.hover), this.defaultClassName = (r = (a = this.fullConfig.styling) == null ? void 0 : a.default) == null ? void 0 : r.className, this.hoverClassName = (h = (s = this.fullConfig.styling) == null ? void 0 : s.hover) == null ? void 0 : h.className;
|
|
2903
|
+
const e = this.fullConfig.animation.entry || E.animation.entry;
|
|
2896
2904
|
this.entryAnimationEngine = new de(
|
|
2897
2905
|
e,
|
|
2898
2906
|
this.fullConfig.layout.algorithm
|
|
@@ -2914,7 +2922,7 @@ class He {
|
|
|
2914
2922
|
const t = this.fullConfig.loaders, e = this.fullConfig.config.loaders ?? {};
|
|
2915
2923
|
if (!t || t.length === 0)
|
|
2916
2924
|
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
|
|
2917
|
-
const i = t.map((
|
|
2925
|
+
const i = t.map((n) => this.createLoaderFromEntry(n, e));
|
|
2918
2926
|
return i.length === 1 ? i[0] : new De({
|
|
2919
2927
|
loaders: i,
|
|
2920
2928
|
debugLogging: e.debugLogging
|
|
@@ -2925,7 +2933,7 @@ class He {
|
|
|
2925
2933
|
*/
|
|
2926
2934
|
createLoaderFromEntry(t, e) {
|
|
2927
2935
|
if ("static" in t) {
|
|
2928
|
-
const i = t.static,
|
|
2936
|
+
const i = t.static, n = {
|
|
2929
2937
|
...i,
|
|
2930
2938
|
validateUrls: i.validateUrls ?? e.validateUrls,
|
|
2931
2939
|
validationTimeout: i.validationTimeout ?? e.validationTimeout,
|
|
@@ -2934,14 +2942,14 @@ class He {
|
|
|
2934
2942
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2935
2943
|
debugLogging: i.debugLogging ?? e.debugLogging
|
|
2936
2944
|
};
|
|
2937
|
-
return new $e(
|
|
2945
|
+
return new $e(n);
|
|
2938
2946
|
} else if ("googleDrive" in t) {
|
|
2939
|
-
const i = t.googleDrive,
|
|
2947
|
+
const i = t.googleDrive, n = {
|
|
2940
2948
|
...i,
|
|
2941
2949
|
allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
|
|
2942
2950
|
debugLogging: i.debugLogging ?? e.debugLogging
|
|
2943
2951
|
};
|
|
2944
|
-
return new Oe(
|
|
2952
|
+
return new Oe(n);
|
|
2945
2953
|
} else
|
|
2946
2954
|
throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
|
|
2947
2955
|
}
|
|
@@ -2968,7 +2976,7 @@ class He {
|
|
|
2968
2976
|
}
|
|
2969
2977
|
setupUI() {
|
|
2970
2978
|
const t = this.fullConfig.rendering.ui;
|
|
2971
|
-
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);
|
|
2979
|
+
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));
|
|
2972
2980
|
}
|
|
2973
2981
|
resolveElement(t) {
|
|
2974
2982
|
return t instanceof HTMLElement ? t : document.getElementById(t);
|
|
@@ -2985,13 +2993,17 @@ class He {
|
|
|
2985
2993
|
const t = document.createElement("div");
|
|
2986
2994
|
return t.className = "fbn-ic-error fbn-ic-hidden", this.containerEl.appendChild(t), t;
|
|
2987
2995
|
}
|
|
2996
|
+
createDefaultCounterElement() {
|
|
2997
|
+
const t = document.createElement("div");
|
|
2998
|
+
return t.className = "fbn-ic-counter fbn-ic-hidden", this.containerEl.appendChild(t), t;
|
|
2999
|
+
}
|
|
2988
3000
|
setupEventListeners() {
|
|
2989
3001
|
document.addEventListener("keydown", (t) => {
|
|
2990
3002
|
var e;
|
|
2991
|
-
t.key === "Escape" ? (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, (e = this.swipeEngine) == null || e.disable()) : 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());
|
|
3003
|
+
t.key === "Escape" ? (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, (e = this.swipeEngine) == null || e.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());
|
|
2992
3004
|
}), document.addEventListener("click", (t) => {
|
|
2993
3005
|
var e, i;
|
|
2994
|
-
(e = this.swipeEngine) != null && e.hadRecentTouch() || t.target.closest(".fbn-ic-image") || (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, (i = this.swipeEngine) == null || i.disable());
|
|
3006
|
+
(e = this.swipeEngine) != null && e.hadRecentTouch() || t.target.closest(".fbn-ic-image") || (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, (i = this.swipeEngine) == null || i.disable(), this.hideCounter());
|
|
2995
3007
|
}), window.addEventListener("resize", () => this.handleResize());
|
|
2996
3008
|
}
|
|
2997
3009
|
/**
|
|
@@ -2999,25 +3011,28 @@ class He {
|
|
|
2999
3011
|
*/
|
|
3000
3012
|
navigateToNextImage() {
|
|
3001
3013
|
if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
|
|
3002
|
-
const t = (this.currentFocusIndex + 1) % this.imageElements.
|
|
3003
|
-
|
|
3014
|
+
const t = (this.currentFocusIndex + 1) % this.imageLayouts.length, e = this.imageElements.find(
|
|
3015
|
+
(n) => n.dataset.imageId === String(t)
|
|
3016
|
+
);
|
|
3017
|
+
if (!e) return;
|
|
3018
|
+
const i = this.imageLayouts[t];
|
|
3019
|
+
i && (this.currentFocusIndex = t, this.handleImageClick(e, i), this.updateCounter(t));
|
|
3004
3020
|
}
|
|
3005
3021
|
/**
|
|
3006
3022
|
* Navigate to the previous image (Left arrow)
|
|
3007
3023
|
*/
|
|
3008
3024
|
navigateToPreviousImage() {
|
|
3009
3025
|
if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
|
|
3010
|
-
const t = (this.currentFocusIndex - 1 + this.
|
|
3011
|
-
|
|
3026
|
+
const t = (this.currentFocusIndex - 1 + this.imageLayouts.length) % this.imageLayouts.length, e = this.imageElements.find(
|
|
3027
|
+
(n) => n.dataset.imageId === String(t)
|
|
3028
|
+
);
|
|
3029
|
+
if (!e) return;
|
|
3030
|
+
const i = this.imageLayouts[t];
|
|
3031
|
+
i && (this.currentFocusIndex = t, this.handleImageClick(e, i), this.updateCounter(t));
|
|
3012
3032
|
}
|
|
3013
3033
|
/**
|
|
3014
3034
|
* Navigate to a specific image by index
|
|
3015
3035
|
*/
|
|
3016
|
-
async navigateToImage(t) {
|
|
3017
|
-
if (t < 0 || t >= this.imageElements.length) return;
|
|
3018
|
-
const e = this.imageElements[t], i = this.imageLayouts[t];
|
|
3019
|
-
!e || !i || await this.handleImageClick(e, i);
|
|
3020
|
-
}
|
|
3021
3036
|
handleResize() {
|
|
3022
3037
|
this.imagesLoaded && (this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.resizeTimeout = window.setTimeout(() => {
|
|
3023
3038
|
const t = this.getImageHeight();
|
|
@@ -3025,8 +3040,8 @@ class He {
|
|
|
3025
3040
|
}, 500));
|
|
3026
3041
|
}
|
|
3027
3042
|
getImageHeight() {
|
|
3028
|
-
const t = window.innerWidth, e = this.fullConfig.layout.responsive, i = this.fullConfig.image.sizing,
|
|
3029
|
-
return e ? t <= e.mobile.maxWidth ? Math.min(100,
|
|
3043
|
+
const t = window.innerWidth, e = this.fullConfig.layout.responsive, i = this.fullConfig.image.sizing, n = (i == null ? void 0 : i.maxSize) ?? 400;
|
|
3044
|
+
return e ? t <= e.mobile.maxWidth ? Math.min(100, n) : t <= e.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);
|
|
3030
3045
|
}
|
|
3031
3046
|
/**
|
|
3032
3047
|
* Get container bounds for layout calculations
|
|
@@ -3049,12 +3064,12 @@ class He {
|
|
|
3049
3064
|
this.showError("No images found."), this.showLoading(!1);
|
|
3050
3065
|
return;
|
|
3051
3066
|
}
|
|
3052
|
-
const i = this.getContainerBounds(),
|
|
3053
|
-
this.logDebug(`Adaptive sizing input: container=${i.width}x${i.height}px, images=${t}, responsiveMax=${
|
|
3067
|
+
const i = this.getContainerBounds(), n = this.getImageHeight(), a = window.innerWidth;
|
|
3068
|
+
this.logDebug(`Adaptive sizing input: container=${i.width}x${i.height}px, images=${t}, responsiveMax=${n}px`);
|
|
3054
3069
|
const r = this.layoutEngine.calculateAdaptiveSize(
|
|
3055
3070
|
i,
|
|
3056
3071
|
t,
|
|
3057
|
-
|
|
3072
|
+
n,
|
|
3058
3073
|
a
|
|
3059
3074
|
);
|
|
3060
3075
|
this.logDebug(`Adaptive sizing result: height=${r.height}px`), await this.createImageCloud(e, r.height), this.showLoading(!1), this.imagesLoaded = !0;
|
|
@@ -3072,7 +3087,7 @@ class He {
|
|
|
3072
3087
|
if (!this.containerEl) return;
|
|
3073
3088
|
const i = this.getContainerBounds();
|
|
3074
3089
|
this.currentImageHeight = e;
|
|
3075
|
-
const
|
|
3090
|
+
const n = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, i, { fixedHeight: e });
|
|
3076
3091
|
this.imageLayouts = a, this.displayQueue = [];
|
|
3077
3092
|
let r = 0;
|
|
3078
3093
|
const s = (l) => {
|
|
@@ -3128,7 +3143,7 @@ class He {
|
|
|
3128
3143
|
return;
|
|
3129
3144
|
}
|
|
3130
3145
|
this.queueInterval !== null && clearInterval(this.queueInterval), this.queueInterval = window.setInterval(() => {
|
|
3131
|
-
if (
|
|
3146
|
+
if (n !== this.loadGeneration) {
|
|
3132
3147
|
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
|
|
3133
3148
|
return;
|
|
3134
3149
|
}
|
|
@@ -3165,7 +3180,7 @@ class He {
|
|
|
3165
3180
|
}), c.addEventListener("click", (p) => {
|
|
3166
3181
|
p.stopPropagation(), this.handleImageClick(c, d);
|
|
3167
3182
|
}), c.style.opacity = "0", c.style.transition = this.entryAnimationEngine.getTransitionCSS(), c.onload = () => {
|
|
3168
|
-
if (
|
|
3183
|
+
if (n !== this.loadGeneration)
|
|
3169
3184
|
return;
|
|
3170
3185
|
const p = c.naturalWidth / c.naturalHeight, g = e * p;
|
|
3171
3186
|
c.style.width = `${g}px`;
|
|
@@ -3175,7 +3190,7 @@ class He {
|
|
|
3175
3190
|
i,
|
|
3176
3191
|
u,
|
|
3177
3192
|
t.length
|
|
3178
|
-
), I = this.entryAnimationEngine.calculateStartRotation(d.rotation),
|
|
3193
|
+
), I = this.entryAnimationEngine.calculateStartRotation(d.rotation), C = this.entryAnimationEngine.calculateStartScale(d.scale), w = this.entryAnimationEngine.buildFinalTransform(
|
|
3179
3194
|
d.rotation,
|
|
3180
3195
|
d.scale,
|
|
3181
3196
|
g,
|
|
@@ -3188,7 +3203,7 @@ class He {
|
|
|
3188
3203
|
g,
|
|
3189
3204
|
e,
|
|
3190
3205
|
I,
|
|
3191
|
-
|
|
3206
|
+
C
|
|
3192
3207
|
);
|
|
3193
3208
|
this.fullConfig.debug && u < 3 && console.log(`Image ${u}:`, {
|
|
3194
3209
|
finalPosition: f,
|
|
@@ -3198,22 +3213,22 @@ class He {
|
|
|
3198
3213
|
finalTransform: w,
|
|
3199
3214
|
renderedWidth: g,
|
|
3200
3215
|
renderedHeight: e
|
|
3201
|
-
}), c.style.transform = F, c.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || I !== d.rotation ||
|
|
3216
|
+
}), c.style.transform = F, c.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || I !== d.rotation || C !== d.scale) && (c.dataset.startX = String(v.x), c.dataset.startY = String(v.y), c.dataset.endX = String(f.x), c.dataset.endY = String(f.y), c.dataset.imageWidth = String(g), c.dataset.imageHeight = String(e), c.dataset.rotation = String(d.rotation), c.dataset.scale = String(d.scale), c.dataset.startRotation = String(I), c.dataset.startScale = String(C)), this.displayQueue.push(c);
|
|
3202
3217
|
}, c.onerror = () => r++, c.src = l;
|
|
3203
3218
|
});
|
|
3204
3219
|
}
|
|
3205
3220
|
async handleImageClick(t, e) {
|
|
3206
3221
|
var a, r;
|
|
3207
3222
|
if (!this.containerEl) return;
|
|
3208
|
-
const i = this.zoomEngine.isFocused(t),
|
|
3223
|
+
const i = this.zoomEngine.isFocused(t), n = {
|
|
3209
3224
|
width: this.containerEl.offsetWidth,
|
|
3210
3225
|
height: this.containerEl.offsetHeight
|
|
3211
3226
|
};
|
|
3212
3227
|
if (i)
|
|
3213
|
-
await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, (a = this.swipeEngine) == null || a.disable();
|
|
3228
|
+
await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, (a = this.swipeEngine) == null || a.disable(), this.hideCounter();
|
|
3214
3229
|
else {
|
|
3215
3230
|
const s = t.dataset.imageId;
|
|
3216
|
-
this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, (r = this.swipeEngine) == null || r.enable(), await this.zoomEngine.focusImage(t,
|
|
3231
|
+
this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, (r = this.swipeEngine) == null || r.enable(), await this.zoomEngine.focusImage(t, n, e), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex);
|
|
3217
3232
|
}
|
|
3218
3233
|
}
|
|
3219
3234
|
/**
|
|
@@ -3231,20 +3246,26 @@ class He {
|
|
|
3231
3246
|
hideError() {
|
|
3232
3247
|
this.errorEl && this.errorEl.classList.add("fbn-ic-hidden");
|
|
3233
3248
|
}
|
|
3249
|
+
updateCounter(t) {
|
|
3250
|
+
!this.fullConfig.rendering.ui.showImageCounter || !this.counterEl || (this.counterEl.textContent = `${t + 1} of ${this.imageElements.length}`, this.counterEl.classList.remove("fbn-ic-hidden"));
|
|
3251
|
+
}
|
|
3252
|
+
hideCounter() {
|
|
3253
|
+
this.counterEl && this.counterEl.classList.add("fbn-ic-hidden");
|
|
3254
|
+
}
|
|
3234
3255
|
/**
|
|
3235
3256
|
* Destroy the gallery and clean up resources
|
|
3236
3257
|
*/
|
|
3237
3258
|
destroy() {
|
|
3238
3259
|
var t;
|
|
3239
|
-
this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), (t = this.swipeEngine) == null || t.destroy();
|
|
3260
|
+
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), (t = this.swipeEngine) == null || t.destroy();
|
|
3240
3261
|
}
|
|
3241
3262
|
}
|
|
3242
3263
|
function Ne() {
|
|
3243
3264
|
if (typeof document > "u") return;
|
|
3244
|
-
const
|
|
3245
|
-
if (document.getElementById(
|
|
3265
|
+
const o = "fbn-ic-styles";
|
|
3266
|
+
if (document.getElementById(o)) return;
|
|
3246
3267
|
const t = document.createElement("style");
|
|
3247
|
-
t.id =
|
|
3268
|
+
t.id = o, t.textContent = kt, document.head.appendChild(t);
|
|
3248
3269
|
}
|
|
3249
3270
|
Ne();
|
|
3250
3271
|
function ke() {
|
|
@@ -3252,7 +3273,7 @@ function ke() {
|
|
|
3252
3273
|
console.warn("ImageCloud: Document not available (not in browser environment)");
|
|
3253
3274
|
return;
|
|
3254
3275
|
}
|
|
3255
|
-
const
|
|
3276
|
+
const o = () => {
|
|
3256
3277
|
const t = document.querySelectorAll("[data-image-cloud], [data-image-gallery]");
|
|
3257
3278
|
t.length !== 0 && t.forEach((e) => {
|
|
3258
3279
|
const i = e;
|
|
@@ -3260,11 +3281,11 @@ function ke() {
|
|
|
3260
3281
|
console.error("ImageCloud: Container with data-image-cloud must have an id attribute");
|
|
3261
3282
|
return;
|
|
3262
3283
|
}
|
|
3263
|
-
const
|
|
3284
|
+
const n = i.dataset.config || i.dataset.galleryConfig;
|
|
3264
3285
|
let a;
|
|
3265
|
-
if (
|
|
3286
|
+
if (n)
|
|
3266
3287
|
try {
|
|
3267
|
-
const s = JSON.parse(
|
|
3288
|
+
const s = JSON.parse(n);
|
|
3268
3289
|
a = {
|
|
3269
3290
|
container: i.id,
|
|
3270
3291
|
...s
|
|
@@ -3282,7 +3303,7 @@ function ke() {
|
|
|
3282
3303
|
});
|
|
3283
3304
|
});
|
|
3284
3305
|
};
|
|
3285
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
3306
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", o) : o();
|
|
3286
3307
|
}
|
|
3287
3308
|
ke();
|
|
3288
3309
|
export {
|