@frybynite/image-cloud 0.9.6 → 0.10.1
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/README.md +43 -38
- package/dist/image-cloud-auto-init.js +47 -46
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +79 -74
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +3 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +101 -101
- package/dist/react.js.map +1 -1
- package/dist/vue.d.ts +2 -0
- package/dist/vue.js +53 -53
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +2 -0
- package/dist/web-component.js +3 -3
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -883,6 +883,8 @@ declare class ImageCloud {
|
|
|
883
883
|
export { ImageCloud }
|
|
884
884
|
export { ImageCloud as ImageGallery }
|
|
885
885
|
|
|
886
|
+
export declare function imageCloud(options: ImageCloudOptions): Promise<ImageCloud>;
|
|
887
|
+
|
|
886
888
|
export declare interface ImageCloudConfig {
|
|
887
889
|
loaders: LoaderEntry[];
|
|
888
890
|
config: ConfigSection;
|
package/dist/react.d.ts
CHANGED
|
@@ -883,6 +883,8 @@ declare class ImageCloud {
|
|
|
883
883
|
export { ImageCloud }
|
|
884
884
|
export { ImageCloud as ImageGallery }
|
|
885
885
|
|
|
886
|
+
export declare function imageCloud(options: ImageCloudOptions): Promise<ImageCloud>;
|
|
887
|
+
|
|
886
888
|
export declare interface ImageCloudConfig {
|
|
887
889
|
loaders: LoaderEntry[];
|
|
888
890
|
config: ConfigSection;
|
package/dist/react.js
CHANGED
|
@@ -6,16 +6,16 @@ const mt = Object.freeze({
|
|
|
6
6
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
7
7
|
lg: "0 8px 32px rgba(0,0,0,0.5)",
|
|
8
8
|
glow: "0 0 30px rgba(255,255,255,0.6)"
|
|
9
|
-
}),
|
|
9
|
+
}), Ct = Object.freeze({
|
|
10
10
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
11
11
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
12
12
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
13
|
-
}),
|
|
13
|
+
}), Rt = Object.freeze({
|
|
14
14
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
15
15
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
16
16
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
17
17
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
18
|
-
}),
|
|
18
|
+
}), At = Object.freeze({
|
|
19
19
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
20
20
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
21
21
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
@@ -26,7 +26,7 @@ const mt = Object.freeze({
|
|
|
26
26
|
mode: "none"
|
|
27
27
|
}), Et = Object.freeze({
|
|
28
28
|
mode: "none"
|
|
29
|
-
}),
|
|
29
|
+
}), Ft = Object.freeze({
|
|
30
30
|
default: Object.freeze({
|
|
31
31
|
border: Object.freeze({
|
|
32
32
|
width: 0,
|
|
@@ -96,7 +96,7 @@ const mt = Object.freeze({
|
|
|
96
96
|
enabled: !1,
|
|
97
97
|
centers: !1,
|
|
98
98
|
loaders: !1
|
|
99
|
-
}), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }),
|
|
99
|
+
}), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), C = Object.freeze({
|
|
100
100
|
// Loader configuration (always an array, composite behavior is implicit)
|
|
101
101
|
loaders: [],
|
|
102
102
|
// Shared loader settings and debug config
|
|
@@ -188,7 +188,7 @@ const mt = Object.freeze({
|
|
|
188
188
|
showFocusOutline: !1
|
|
189
189
|
}),
|
|
190
190
|
// Image styling
|
|
191
|
-
styling:
|
|
191
|
+
styling: Ft
|
|
192
192
|
});
|
|
193
193
|
function Z(o, t) {
|
|
194
194
|
if (!o) return t || {};
|
|
@@ -277,59 +277,59 @@ function ne(o = {}) {
|
|
|
277
277
|
loaders: n,
|
|
278
278
|
config: r,
|
|
279
279
|
image: te(zt, e),
|
|
280
|
-
layout: { ...
|
|
281
|
-
animation: { ...
|
|
282
|
-
interaction: { ...
|
|
283
|
-
ui: { ...
|
|
284
|
-
styling: Qt(
|
|
280
|
+
layout: { ...C.layout },
|
|
281
|
+
animation: { ...C.animation },
|
|
282
|
+
interaction: { ...C.interaction },
|
|
283
|
+
ui: { ...C.ui },
|
|
284
|
+
styling: Qt(Ft, o.styling)
|
|
285
285
|
};
|
|
286
286
|
o.layout && (a.layout = {
|
|
287
|
-
...
|
|
287
|
+
...C.layout,
|
|
288
288
|
...o.layout
|
|
289
289
|
}, o.layout.responsive && (a.layout.responsive = {
|
|
290
|
-
...
|
|
291
|
-
mobile: o.layout.responsive.mobile ? { ...
|
|
292
|
-
tablet: o.layout.responsive.tablet ? { ...
|
|
290
|
+
...C.layout.responsive,
|
|
291
|
+
mobile: o.layout.responsive.mobile ? { ...C.layout.responsive.mobile, ...o.layout.responsive.mobile } : C.layout.responsive.mobile,
|
|
292
|
+
tablet: o.layout.responsive.tablet ? { ...C.layout.responsive.tablet, ...o.layout.responsive.tablet } : C.layout.responsive.tablet
|
|
293
293
|
}), o.layout.spacing && (a.layout.spacing = {
|
|
294
|
-
...
|
|
294
|
+
...C.layout.spacing,
|
|
295
295
|
...o.layout.spacing
|
|
296
296
|
})), o.animation && (a.animation = {
|
|
297
|
-
...
|
|
297
|
+
...C.animation,
|
|
298
298
|
...o.animation
|
|
299
299
|
}, o.animation.easing && (a.animation.easing = {
|
|
300
|
-
...
|
|
300
|
+
...C.animation.easing,
|
|
301
301
|
...o.animation.easing
|
|
302
302
|
}), o.animation.queue && (a.animation.queue = {
|
|
303
|
-
...
|
|
303
|
+
...C.animation.queue,
|
|
304
304
|
...o.animation.queue
|
|
305
305
|
}), o.animation.entry && (a.animation.entry = {
|
|
306
|
-
...
|
|
306
|
+
...C.animation.entry,
|
|
307
307
|
...o.animation.entry,
|
|
308
308
|
start: o.animation.entry.start ? {
|
|
309
|
-
...
|
|
309
|
+
...C.animation.entry.start,
|
|
310
310
|
...o.animation.entry.start,
|
|
311
|
-
circular: o.animation.entry.start.circular ? { ...
|
|
312
|
-
} :
|
|
313
|
-
timing: o.animation.entry.timing ? { ...
|
|
314
|
-
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } :
|
|
315
|
-
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } :
|
|
316
|
-
scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } :
|
|
311
|
+
circular: o.animation.entry.start.circular ? { ...C.animation.entry.start.circular, ...o.animation.entry.start.circular } : C.animation.entry.start.circular
|
|
312
|
+
} : C.animation.entry.start,
|
|
313
|
+
timing: o.animation.entry.timing ? { ...C.animation.entry.timing, ...o.animation.entry.timing } : C.animation.entry.timing,
|
|
314
|
+
path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : C.animation.entry.path,
|
|
315
|
+
rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : C.animation.entry.rotation,
|
|
316
|
+
scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : C.animation.entry.scale
|
|
317
317
|
}), o.animation.idle && (a.animation.idle = {
|
|
318
318
|
...$t,
|
|
319
319
|
...o.animation.idle
|
|
320
320
|
})), o.interaction && (a.interaction = {
|
|
321
|
-
...
|
|
321
|
+
...C.interaction,
|
|
322
322
|
...o.interaction
|
|
323
323
|
}, o.interaction.focus && (a.interaction.focus = {
|
|
324
|
-
...
|
|
324
|
+
...C.interaction.focus,
|
|
325
325
|
...o.interaction.focus
|
|
326
326
|
}), o.interaction.navigation && (a.interaction.navigation = {
|
|
327
|
-
...
|
|
327
|
+
...C.interaction.navigation,
|
|
328
328
|
...o.interaction.navigation
|
|
329
329
|
}));
|
|
330
330
|
const c = o.rendering?.ui;
|
|
331
331
|
if (c && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), a.ui = {
|
|
332
|
-
...
|
|
332
|
+
...C.ui,
|
|
333
333
|
...c,
|
|
334
334
|
...o.ui
|
|
335
335
|
}, a.config.debug = {
|
|
@@ -347,13 +347,13 @@ function ne(o = {}) {
|
|
|
347
347
|
return a;
|
|
348
348
|
}
|
|
349
349
|
function oe(o, t) {
|
|
350
|
-
return { ...o ?
|
|
350
|
+
return { ...o ? Ct[o] : Ct.playful, ...t };
|
|
351
351
|
}
|
|
352
352
|
function se(o, t) {
|
|
353
|
-
return { ...o ?
|
|
353
|
+
return { ...o ? Rt[o] : Rt.gentle, ...t };
|
|
354
354
|
}
|
|
355
355
|
function ae(o, t) {
|
|
356
|
-
return { ...o ?
|
|
356
|
+
return { ...o ? At[o] : At.gentle, ...t };
|
|
357
357
|
}
|
|
358
358
|
class re {
|
|
359
359
|
constructor(t) {
|
|
@@ -621,7 +621,7 @@ function me(o) {
|
|
|
621
621
|
}
|
|
622
622
|
const z = performance.now(), L = -r / 2, _ = -a / 2;
|
|
623
623
|
function O(H) {
|
|
624
|
-
const N = H - z,
|
|
624
|
+
const N = H - z, R = Math.min(N / s, 1);
|
|
625
625
|
let D;
|
|
626
626
|
switch (p) {
|
|
627
627
|
case "bounce": {
|
|
@@ -629,7 +629,7 @@ function me(o) {
|
|
|
629
629
|
n.bouncePreset,
|
|
630
630
|
n.bounce
|
|
631
631
|
);
|
|
632
|
-
D = ce(
|
|
632
|
+
D = ce(R, i, e, k);
|
|
633
633
|
break;
|
|
634
634
|
}
|
|
635
635
|
case "elastic": {
|
|
@@ -637,7 +637,7 @@ function me(o) {
|
|
|
637
637
|
n.elasticPreset,
|
|
638
638
|
n.elastic
|
|
639
639
|
);
|
|
640
|
-
D = he(
|
|
640
|
+
D = he(R, i, e, k);
|
|
641
641
|
break;
|
|
642
642
|
}
|
|
643
643
|
case "wave": {
|
|
@@ -645,20 +645,20 @@ function me(o) {
|
|
|
645
645
|
n.wavePreset,
|
|
646
646
|
n.wave
|
|
647
647
|
);
|
|
648
|
-
D = de(
|
|
648
|
+
D = de(R, i, e, k);
|
|
649
649
|
break;
|
|
650
650
|
}
|
|
651
651
|
default:
|
|
652
652
|
D = {
|
|
653
|
-
x: J(i.x, e.x,
|
|
654
|
-
y: J(i.y, e.y,
|
|
653
|
+
x: J(i.x, e.x, R),
|
|
654
|
+
y: J(i.y, e.y, R)
|
|
655
655
|
};
|
|
656
656
|
}
|
|
657
657
|
const W = D.x - e.x, U = D.y - e.y;
|
|
658
|
-
let
|
|
659
|
-
m ?
|
|
660
|
-
let
|
|
661
|
-
S ?
|
|
658
|
+
let M;
|
|
659
|
+
m ? M = fe(R, c, y) : f ? M = J(d, c, R) : M = c;
|
|
660
|
+
let A;
|
|
661
|
+
S ? A = ge(R, l, w) : v ? A = J(b, l, R) : A = l, t.style.transform = `translate(${L}px, ${_}px) translate(${W}px, ${U}px) rotate(${M}deg) scale(${A})`, R < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
|
|
662
662
|
}
|
|
663
663
|
requestAnimationFrame(O);
|
|
664
664
|
}
|
|
@@ -1275,22 +1275,22 @@ class we {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
let w = 1, I = 1;
|
|
1277
1277
|
for (; w < t; ) {
|
|
1278
|
-
const z = I / E, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(f * 0.8, S / E * 1.5 / p.tightness), O = I * _, H = O * 1.5, N = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))),
|
|
1278
|
+
const z = I / E, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(f * 0.8, S / E * 1.5 / p.tightness), O = I * _, H = O * 1.5, N = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), R = this.estimateWidth(f), D = Math.floor(N / (R * 0.7));
|
|
1279
1279
|
if (D === 0) {
|
|
1280
1280
|
I++;
|
|
1281
1281
|
continue;
|
|
1282
1282
|
}
|
|
1283
1283
|
const W = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
|
|
1284
|
-
for (let
|
|
1285
|
-
const
|
|
1286
|
-
let $ = m + Math.cos(
|
|
1284
|
+
for (let M = 0; M < D && w < t; M++) {
|
|
1285
|
+
const A = M * W + U, k = g ? this.random(h, d) : 1, q = L * k, T = f * q;
|
|
1286
|
+
let $ = m + Math.cos(A) * H, F = y + Math.sin(A) * O;
|
|
1287
1287
|
const P = T * 1.5 / 2, B = T / 2;
|
|
1288
|
-
$ - P < v ? $ = v + P : $ + P > s - v && ($ = s - v - P),
|
|
1288
|
+
$ - P < v ? $ = v + P : $ + P > s - v && ($ = s - v - P), F - B < v ? F = v + B : F + B > r - v && (F = r - v - B);
|
|
1289
1289
|
const Y = c === "random" ? this.random(l, u) : 0;
|
|
1290
1290
|
n.push({
|
|
1291
1291
|
id: w,
|
|
1292
1292
|
x: $,
|
|
1293
|
-
y:
|
|
1293
|
+
y: F,
|
|
1294
1294
|
rotation: Y,
|
|
1295
1295
|
scale: q,
|
|
1296
1296
|
baseSize: T,
|
|
@@ -1367,27 +1367,27 @@ class Se {
|
|
|
1367
1367
|
p,
|
|
1368
1368
|
l,
|
|
1369
1369
|
a
|
|
1370
|
-
), y = a.stagger === "row", E = a.stagger === "column", v = y ? f + 0.5 : f, S = E ? m + 0.5 : m, w = (b - a.gap * (f - 1)) / v, I = (p - a.gap * (m - 1)) / S, z = y ? w / 2 : 0, L = E ? I / 2 : 0, _ = 1 + a.overlap, O = Math.min(w, I) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, N = f * w + (f - 1) * a.gap + z,
|
|
1370
|
+
), y = a.stagger === "row", E = a.stagger === "column", v = y ? f + 0.5 : f, S = E ? m + 0.5 : m, w = (b - a.gap * (f - 1)) / v, I = (p - a.gap * (m - 1)) / S, z = y ? w / 2 : 0, L = E ? I / 2 : 0, _ = 1 + a.overlap, O = Math.min(w, I) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, N = f * w + (f - 1) * a.gap + z, R = m * I + (m - 1) * a.gap + L, D = c + (b - N) / 2, W = c + (p - R) / 2, U = f * m, M = a.columns !== "auto" && a.rows !== "auto", A = M && t > U;
|
|
1371
1371
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1372
1372
|
gridConfigColumns: a.columns,
|
|
1373
1373
|
gridConfigRows: a.rows,
|
|
1374
1374
|
columns: f,
|
|
1375
1375
|
rows: m,
|
|
1376
1376
|
cellCount: U,
|
|
1377
|
-
hasFixedGrid:
|
|
1377
|
+
hasFixedGrid: M,
|
|
1378
1378
|
imageCount: t,
|
|
1379
|
-
isOverflowMode:
|
|
1379
|
+
isOverflowMode: A
|
|
1380
1380
|
});
|
|
1381
|
-
const k =
|
|
1381
|
+
const k = A ? new Array(U).fill(0) : [], q = Math.min(w, I) * a.overflowOffset;
|
|
1382
1382
|
for (let T = 0; T < t; T++) {
|
|
1383
|
-
let $,
|
|
1384
|
-
if (
|
|
1383
|
+
let $, F, X = 0;
|
|
1384
|
+
if (A && T >= U) {
|
|
1385
1385
|
const G = T - U, j = G % U;
|
|
1386
|
-
X = Math.floor(G / U) + 1, k[j]++, a.fillDirection === "row" ? ($ = j % f,
|
|
1386
|
+
X = Math.floor(G / U) + 1, k[j]++, a.fillDirection === "row" ? ($ = j % f, F = Math.floor(j / f)) : (F = j % m, $ = Math.floor(j / m));
|
|
1387
1387
|
} else
|
|
1388
|
-
a.fillDirection === "row" ? ($ = T % f,
|
|
1389
|
-
let P = D + $ * (w + a.gap) + w / 2, B = W +
|
|
1390
|
-
if (a.stagger === "row" &&
|
|
1388
|
+
a.fillDirection === "row" ? ($ = T % f, F = Math.floor(T / f)) : (F = T % m, $ = Math.floor(T / m));
|
|
1389
|
+
let P = D + $ * (w + a.gap) + w / 2, B = W + F * (I + a.gap) + I / 2;
|
|
1390
|
+
if (a.stagger === "row" && F % 2 === 1 ? P += w / 2 : a.stagger === "column" && $ % 2 === 1 && (B += I / 2), X > 0) {
|
|
1391
1391
|
const G = (X - 1) % Tt.length, j = Tt[G];
|
|
1392
1392
|
P += j.x * q, B += j.y * q;
|
|
1393
1393
|
}
|
|
@@ -1396,9 +1396,9 @@ class Se {
|
|
|
1396
1396
|
P += this.random(-G, G), B += this.random(-j, j);
|
|
1397
1397
|
}
|
|
1398
1398
|
let Y = P, V = B;
|
|
1399
|
-
if (!
|
|
1399
|
+
if (!A && a.fillDirection === "row") {
|
|
1400
1400
|
const G = t % f || f;
|
|
1401
|
-
if (
|
|
1401
|
+
if (F === Math.floor((t - 1) / f) && G < f) {
|
|
1402
1402
|
const St = G * w + (G - 1) * a.gap;
|
|
1403
1403
|
let gt = 0;
|
|
1404
1404
|
a.alignment === "center" ? gt = (N - St) / 2 : a.alignment === "end" && (gt = N - St), Y += gt;
|
|
@@ -1412,7 +1412,7 @@ class Se {
|
|
|
1412
1412
|
a.jitter > 0 ? ut = this.random(G * a.jitter, j * a.jitter) : ut = this.random(G, j);
|
|
1413
1413
|
}
|
|
1414
1414
|
let ft;
|
|
1415
|
-
|
|
1415
|
+
A && X > 0 ? ft = 50 - X : ft = A ? 100 + T : T + 1, n.push({
|
|
1416
1416
|
id: T,
|
|
1417
1417
|
x: Y,
|
|
1418
1418
|
y: V,
|
|
@@ -1449,14 +1449,14 @@ class Se {
|
|
|
1449
1449
|
return Math.random() * (i - t) + t;
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
|
-
const Ie = Math.PI * (3 - Math.sqrt(5)),
|
|
1452
|
+
const Ie = Math.PI * (3 - Math.sqrt(5)), Ce = {
|
|
1453
1453
|
spiralType: "golden",
|
|
1454
1454
|
direction: "counterclockwise",
|
|
1455
1455
|
tightness: 1,
|
|
1456
1456
|
scaleDecay: 0,
|
|
1457
1457
|
startAngle: 0
|
|
1458
1458
|
};
|
|
1459
|
-
class
|
|
1459
|
+
class Re {
|
|
1460
1460
|
constructor(t, i = {}) {
|
|
1461
1461
|
this.config = t, this.imageConfig = i;
|
|
1462
1462
|
}
|
|
@@ -1468,7 +1468,7 @@ class Ae {
|
|
|
1468
1468
|
* @returns Array of layout objects with position, rotation, scale
|
|
1469
1469
|
*/
|
|
1470
1470
|
generate(t, i, e = {}) {
|
|
1471
|
-
const n = [], { width: s, height: r } = i, a = { ...
|
|
1471
|
+
const n = [], { width: s, height: r } = i, a = { ...Ce, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, y = r / 2, E = Math.min(
|
|
1472
1472
|
m - c - l / 2,
|
|
1473
1473
|
y - c - l / 2
|
|
1474
1474
|
), v = a.direction === "clockwise" ? -1 : 1;
|
|
@@ -1483,20 +1483,20 @@ class Ae {
|
|
|
1483
1483
|
const P = S * 0.3 * a.tightness;
|
|
1484
1484
|
w = P * v + a.startAngle, I = this.calculateLogarithmicRadius(P, t, E, a.tightness);
|
|
1485
1485
|
}
|
|
1486
|
-
const z = m + Math.cos(w) * I, L = y + Math.sin(w) * I, _ = I / E, O = f > 0 ? 1 - _ * f * 0.5 : 1, H = p ? this.random(g, b) : 1, N = O * H,
|
|
1487
|
-
let
|
|
1486
|
+
const z = m + Math.cos(w) * I, L = y + Math.sin(w) * I, _ = I / E, O = f > 0 ? 1 - _ * f * 0.5 : 1, H = p ? this.random(g, b) : 1, N = O * H, R = l * N, W = R * 1.5 / 2, U = R / 2, M = c + W, A = s - c - W, k = c + U, q = r - c - U, T = Math.max(M, Math.min(z, A)), $ = Math.max(k, Math.min(L, q));
|
|
1487
|
+
let F = 0;
|
|
1488
1488
|
if (u === "random") {
|
|
1489
1489
|
const P = w * 180 / Math.PI % 360, B = this.random(h, d);
|
|
1490
|
-
|
|
1491
|
-
} else u === "tangent" && (
|
|
1490
|
+
F = a.spiralType === "golden" ? B : P * 0.1 + B * 0.9;
|
|
1491
|
+
} else u === "tangent" && (F = this.calculateSpiralTangent(w, I, a));
|
|
1492
1492
|
const X = t - S;
|
|
1493
1493
|
n.push({
|
|
1494
1494
|
id: S,
|
|
1495
1495
|
x: T,
|
|
1496
1496
|
y: $,
|
|
1497
|
-
rotation:
|
|
1497
|
+
rotation: F,
|
|
1498
1498
|
scale: N,
|
|
1499
|
-
baseSize:
|
|
1499
|
+
baseSize: R,
|
|
1500
1500
|
zIndex: X
|
|
1501
1501
|
});
|
|
1502
1502
|
}
|
|
@@ -1550,7 +1550,7 @@ class Ae {
|
|
|
1550
1550
|
return Math.random() * (i - t) + t;
|
|
1551
1551
|
}
|
|
1552
1552
|
}
|
|
1553
|
-
const
|
|
1553
|
+
const Ae = {
|
|
1554
1554
|
clusterCount: "auto",
|
|
1555
1555
|
clusterSpread: 150,
|
|
1556
1556
|
clusterSpacing: 200,
|
|
@@ -1570,7 +1570,7 @@ class Te {
|
|
|
1570
1570
|
* @returns Array of layout objects with position, rotation, scale
|
|
1571
1571
|
*/
|
|
1572
1572
|
generate(t, i, e = {}) {
|
|
1573
|
-
const n = [], { width: s, height: r } = i, a = { ...
|
|
1573
|
+
const n = [], { width: s, height: r } = i, a = { ...Ae, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.calculateClusterCount(
|
|
1574
1574
|
t,
|
|
1575
1575
|
a.clusterCount,
|
|
1576
1576
|
s,
|
|
@@ -1593,15 +1593,15 @@ class Te {
|
|
|
1593
1593
|
if (a.distribution === "gaussian")
|
|
1594
1594
|
z = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
|
|
1595
1595
|
else {
|
|
1596
|
-
const
|
|
1597
|
-
z = Math.cos(
|
|
1596
|
+
const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
|
|
1597
|
+
z = Math.cos(F) * X, L = Math.sin(F) * X;
|
|
1598
1598
|
}
|
|
1599
1599
|
const _ = 1 + a.overlap * 0.5, O = 1 + a.overlap * 0.3;
|
|
1600
1600
|
z /= _, L /= _;
|
|
1601
|
-
const H = p ? this.random(g, b) : 1, N = O * H,
|
|
1601
|
+
const H = p ? this.random(g, b) : 1, N = O * H, R = l * N;
|
|
1602
1602
|
let D = S.x + z, W = S.y + L;
|
|
1603
|
-
const
|
|
1604
|
-
D = Math.max(c +
|
|
1603
|
+
const M = R * 1.5 / 2, A = R / 2;
|
|
1604
|
+
D = Math.max(c + M, Math.min(D, s - c - M)), W = Math.max(c + A, Math.min(W, r - c - A));
|
|
1605
1605
|
const k = u === "random" ? this.random(h, d) : 0, T = Math.sqrt(z * z + L * L) / S.spread, $ = Math.round((1 - T) * 50) + 1;
|
|
1606
1606
|
n.push({
|
|
1607
1607
|
id: E,
|
|
@@ -1609,7 +1609,7 @@ class Te {
|
|
|
1609
1609
|
y: W,
|
|
1610
1610
|
rotation: k,
|
|
1611
1611
|
scale: N,
|
|
1612
|
-
baseSize:
|
|
1612
|
+
baseSize: R,
|
|
1613
1613
|
zIndex: $
|
|
1614
1614
|
}), E++;
|
|
1615
1615
|
}
|
|
@@ -1691,26 +1691,26 @@ class Le {
|
|
|
1691
1691
|
const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, p = e.fixedHeight ?? a, f = {
|
|
1692
1692
|
...Wt,
|
|
1693
1693
|
...this.config.wave
|
|
1694
|
-
}, { rows: m, amplitude: y, frequency: E, phaseShift: v, synchronization: S } = f, w = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = s - c - L, H = O - _, N = w > 1 ? H / (w - 1) : 0,
|
|
1695
|
-
let
|
|
1696
|
-
for (let
|
|
1697
|
-
const k = m === 1 ? (
|
|
1694
|
+
}, { rows: m, amplitude: y, frequency: E, phaseShift: v, synchronization: S } = f, w = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = s - c - L, H = O - _, N = w > 1 ? H / (w - 1) : 0, R = c + y + p / 2, D = r - c - y - p / 2, W = D - R, U = m > 1 ? W / (m - 1) : 0;
|
|
1695
|
+
let M = 0;
|
|
1696
|
+
for (let A = 0; A < m && M < t; A++) {
|
|
1697
|
+
const k = m === 1 ? (R + D) / 2 : R + A * U;
|
|
1698
1698
|
let q = 0;
|
|
1699
|
-
S === "offset" ? q =
|
|
1700
|
-
for (let T = 0; T < w &&
|
|
1701
|
-
const $ = w === 1 ? (_ + O) / 2 : _ + T * N,
|
|
1699
|
+
S === "offset" ? q = A * v : S === "alternating" && (q = A * Math.PI);
|
|
1700
|
+
for (let T = 0; T < w && M < t; T++) {
|
|
1701
|
+
const $ = w === 1 ? (_ + O) / 2 : _ + T * N, F = this.calculateWaveY($, s, y, E, q), X = $, P = k + F, B = b ? this.random(d, g) : 1, Y = p * B;
|
|
1702
1702
|
let V = 0;
|
|
1703
1703
|
l === "tangent" ? V = this.calculateRotation($, s, y, E, q) : l === "random" && (V = this.random(u, h));
|
|
1704
1704
|
const K = Y * 1.5 / 2, lt = Y / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
|
|
1705
1705
|
n.push({
|
|
1706
|
-
id:
|
|
1706
|
+
id: M,
|
|
1707
1707
|
x: Math.max(nt, Math.min(X, ot)),
|
|
1708
1708
|
y: Math.max(ht, Math.min(P, dt)),
|
|
1709
1709
|
rotation: V,
|
|
1710
1710
|
scale: B,
|
|
1711
1711
|
baseSize: Y,
|
|
1712
|
-
zIndex:
|
|
1713
|
-
}),
|
|
1712
|
+
zIndex: M + 1
|
|
1713
|
+
}), M++;
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
1716
|
return n;
|
|
@@ -1766,11 +1766,11 @@ const wt = 100, Q = 100 / Math.sqrt(3), xt = [
|
|
|
1766
1766
|
// lower-left
|
|
1767
1767
|
[0, 50]
|
|
1768
1768
|
// left
|
|
1769
|
-
],
|
|
1769
|
+
], Me = xt[1][0] / wt, Fe = xt[2][1] / wt;
|
|
1770
1770
|
function ze(o) {
|
|
1771
1771
|
return {
|
|
1772
|
-
colStep:
|
|
1773
|
-
rowOffset:
|
|
1772
|
+
colStep: Me * o,
|
|
1773
|
+
rowOffset: Fe * o
|
|
1774
1774
|
};
|
|
1775
1775
|
}
|
|
1776
1776
|
function Oe(o, t, i, e, n, s) {
|
|
@@ -1845,7 +1845,7 @@ class _e {
|
|
|
1845
1845
|
case "grid":
|
|
1846
1846
|
return new Se(this.config, this.imageConfig);
|
|
1847
1847
|
case "spiral":
|
|
1848
|
-
return new
|
|
1848
|
+
return new Re(this.config, this.imageConfig);
|
|
1849
1849
|
case "cluster":
|
|
1850
1850
|
return new Te(this.config, this.imageConfig);
|
|
1851
1851
|
case "wave":
|
|
@@ -2105,7 +2105,7 @@ function pt(o, t) {
|
|
|
2105
2105
|
e.trim() && o.classList.remove(e.trim());
|
|
2106
2106
|
});
|
|
2107
2107
|
}
|
|
2108
|
-
const
|
|
2108
|
+
const Mt = {
|
|
2109
2109
|
UNFOCUSING: 999,
|
|
2110
2110
|
FOCUSING: 1e3
|
|
2111
2111
|
};
|
|
@@ -2241,7 +2241,7 @@ class Ge {
|
|
|
2241
2241
|
const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
|
|
2242
2242
|
this.animationEngine.cancelAllAnimations(t);
|
|
2243
2243
|
const h = this.config.animationDuration ?? 600;
|
|
2244
|
-
this.applyFocusedStyling(t,
|
|
2244
|
+
this.applyFocusedStyling(t, Mt.FOCUSING);
|
|
2245
2245
|
const d = n ?? {
|
|
2246
2246
|
x: 0,
|
|
2247
2247
|
y: 0,
|
|
@@ -2290,7 +2290,7 @@ class Ge {
|
|
|
2290
2290
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
2291
2291
|
*/
|
|
2292
2292
|
startUnfocusAnimation(t, i, e, n) {
|
|
2293
|
-
t.style.zIndex = String(
|
|
2293
|
+
t.style.zIndex = String(Mt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
|
|
2294
2294
|
const s = this.config.animationDuration ?? 600;
|
|
2295
2295
|
t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
|
|
2296
2296
|
const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
|
|
@@ -3257,7 +3257,7 @@ let oi = class {
|
|
|
3257
3257
|
layout: this.fullConfig.layout,
|
|
3258
3258
|
image: this.fullConfig.image
|
|
3259
3259
|
}), this.zoomEngine = new Ge(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
|
|
3260
|
-
const i = this.fullConfig.animation.entry ||
|
|
3260
|
+
const i = this.fullConfig.animation.entry || C.animation.entry;
|
|
3261
3261
|
this.entryAnimationEngine = new ye(
|
|
3262
3262
|
i,
|
|
3263
3263
|
this.fullConfig.layout.algorithm
|
|
@@ -3294,7 +3294,7 @@ let oi = class {
|
|
|
3294
3294
|
createLoader() {
|
|
3295
3295
|
const t = this.fullConfig.loaders, i = this.fullConfig.config.loaders ?? {};
|
|
3296
3296
|
if (!t || t.length === 0)
|
|
3297
|
-
throw new Error("No loaders configured. Provide `images`, `loaders`, or both
|
|
3297
|
+
throw new Error("No loaders configured. Provide `images`, `loaders`, or both.\n Example: imageCloud({ container: 'id', images: ['https://...'] })");
|
|
3298
3298
|
const e = t.map((n) => this.createLoaderFromEntry(n, i));
|
|
3299
3299
|
return e.length === 1 ? e[0] : new ti({
|
|
3300
3300
|
loaders: e,
|
|
@@ -3333,7 +3333,7 @@ let oi = class {
|
|
|
3333
3333
|
if (ni(), this.containerRef)
|
|
3334
3334
|
this.containerEl = this.containerRef;
|
|
3335
3335
|
else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
|
|
3336
|
-
throw new Error(`Container #${this.containerId} not found
|
|
3336
|
+
throw new Error(`Container "#${this.containerId}" not found. Ensure an element with id="${this.containerId}" exists in the DOM before calling imageCloud().`);
|
|
3337
3337
|
this.containerEl.classList.add("fbn-ic-gallery"), this.containerEl.setAttribute("tabindex", "0"), this.fullConfig.interaction.navigation?.swipe !== !1 && (this.swipeEngine = new bt(this.containerEl, {
|
|
3338
3338
|
onNext: () => this.navigateToNextImage(),
|
|
3339
3339
|
onPrev: () => this.navigateToPreviousImage(),
|
|
@@ -3343,7 +3343,7 @@ let oi = class {
|
|
|
3343
3343
|
}
|
|
3344
3344
|
})), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
3345
3345
|
} catch (t) {
|
|
3346
|
-
console.error(
|
|
3346
|
+
console.error(`ImageCloud initialization failed (container: "${this.containerId ?? "element"}"):`, t), this.errorEl && t instanceof Error && this.showError("Gallery failed to initialize: " + t.message);
|
|
3347
3347
|
}
|
|
3348
3348
|
}
|
|
3349
3349
|
setupUI() {
|