@frybynite/image-cloud 0.3.7 → 0.4.0
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 +2 -2
- package/dist/image-cloud-auto-init.js +76 -76
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +81 -80
- 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 +57 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,10 +104,10 @@ await cloud.init();
|
|
|
104
104
|
For detailed configuration, see the documentation in the `docs/` folder:
|
|
105
105
|
|
|
106
106
|
1. **[Loaders](docs/LOADERS.md)** — Configure image sources (static URLs, JSON endpoints, local paths, Google Drive folders)
|
|
107
|
-
2. **[
|
|
107
|
+
2. **[Layouts](docs/LAYOUTS.md)** — Choose and customize layout algorithms (radial, grid, spiral, cluster, random, wave)
|
|
108
108
|
3. **[Image Sizing](docs/IMAGE_SIZING.md)** — Control base sizes, variance, and responsive/adaptive behavior
|
|
109
109
|
4. **[Full Parameter Reference](docs/PARAMETERS.md)** — Complete configuration options for animation, interaction, styling, and more
|
|
110
|
-
5. **[API Reference](docs/api/README.md)** — TypeScript API documentation for the ImageCloud class, types, loaders, and
|
|
110
|
+
5. **[API Reference](docs/api/README.md)** — TypeScript API documentation for the ImageCloud class, types, loaders, and layouts
|
|
111
111
|
|
|
112
112
|
### Using the Configurator
|
|
113
113
|
|
|
@@ -4,16 +4,16 @@ const jt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
4
4
|
md: "0 4px 16px rgba(0,0,0,0.4)",
|
|
5
5
|
lg: "0 8px 32px rgba(0,0,0,0.5)",
|
|
6
6
|
glow: "0 0 30px rgba(255,255,255,0.6)"
|
|
7
|
-
}),
|
|
7
|
+
}), Lt = Object.freeze({
|
|
8
8
|
energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
|
|
9
9
|
playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
|
|
10
10
|
subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
|
|
11
|
-
}),
|
|
11
|
+
}), Mt = Object.freeze({
|
|
12
12
|
gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
|
|
13
13
|
bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
|
|
14
14
|
wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
|
|
15
15
|
snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
|
|
16
|
-
}),
|
|
16
|
+
}), zt = Object.freeze({
|
|
17
17
|
gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
|
|
18
18
|
playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
|
|
19
19
|
serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
|
|
@@ -49,14 +49,14 @@ const jt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
49
49
|
focused: Object.freeze({
|
|
50
50
|
shadow: "none"
|
|
51
51
|
})
|
|
52
|
-
}),
|
|
52
|
+
}), Wt = Object.freeze({
|
|
53
53
|
rows: 1,
|
|
54
54
|
amplitude: 100,
|
|
55
55
|
frequency: 2,
|
|
56
56
|
phaseShift: 0,
|
|
57
57
|
synchronization: "offset"
|
|
58
58
|
// Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
|
|
59
|
-
}),
|
|
59
|
+
}), Gt = Object.freeze({
|
|
60
60
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
61
61
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
62
62
|
}), qt = Object.freeze({
|
|
@@ -105,7 +105,7 @@ const jt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
105
105
|
algorithm: "radial",
|
|
106
106
|
scaleDecay: 0,
|
|
107
107
|
// No decay by default (0-1 for radial/spiral)
|
|
108
|
-
responsive:
|
|
108
|
+
responsive: Gt,
|
|
109
109
|
targetCoverage: 0.6,
|
|
110
110
|
// Target 60% of container area
|
|
111
111
|
densityFactor: 1,
|
|
@@ -387,13 +387,13 @@ function Kt(o = {}) {
|
|
|
387
387
|
}, a;
|
|
388
388
|
}
|
|
389
389
|
function Zt(o, t) {
|
|
390
|
-
return { ...o ?
|
|
390
|
+
return { ...o ? Lt[o] : Lt.playful, ...t };
|
|
391
391
|
}
|
|
392
392
|
function Qt(o, t) {
|
|
393
|
-
return { ...o ?
|
|
393
|
+
return { ...o ? Mt[o] : Mt.gentle, ...t };
|
|
394
394
|
}
|
|
395
395
|
function te(o, t) {
|
|
396
|
-
return { ...o ?
|
|
396
|
+
return { ...o ? zt[o] : zt.gentle, ...t };
|
|
397
397
|
}
|
|
398
398
|
class ee {
|
|
399
399
|
constructor(t) {
|
|
@@ -660,8 +660,8 @@ function le(o) {
|
|
|
660
660
|
return;
|
|
661
661
|
}
|
|
662
662
|
const _ = performance.now(), H = -r / 2, $ = -a / 2;
|
|
663
|
-
function D(
|
|
664
|
-
const
|
|
663
|
+
function D(W) {
|
|
664
|
+
const L = W - _, w = Math.min(L / s, 1);
|
|
665
665
|
let T;
|
|
666
666
|
switch (b) {
|
|
667
667
|
case "bounce": {
|
|
@@ -694,11 +694,11 @@ function le(o) {
|
|
|
694
694
|
y: st(e.y, i.y, w)
|
|
695
695
|
};
|
|
696
696
|
}
|
|
697
|
-
const
|
|
697
|
+
const M = T.x - i.x, C = T.y - i.y;
|
|
698
698
|
let R;
|
|
699
699
|
m ? R = re(w, c, y) : f ? R = st(h, c, w) : R = c;
|
|
700
|
-
let
|
|
701
|
-
A ?
|
|
700
|
+
let z;
|
|
701
|
+
A ? z = ce(w, u, S) : E ? z = st(p, u, w) : z = u, t.style.transform = `translate(${H}px, ${$}px) translate(${M}px, ${C}px) rotate(${R}deg) scale(${z})`, w < 1 ? requestAnimationFrame(D) : (t.style.transform = `translate(${H}px, ${$}px) rotate(${c}deg) scale(${u})`, l && l());
|
|
702
702
|
}
|
|
703
703
|
requestAnimationFrame(D);
|
|
704
704
|
}
|
|
@@ -1069,15 +1069,15 @@ class ge {
|
|
|
1069
1069
|
* @returns Array of layout objects with position, rotation, scale
|
|
1070
1070
|
*/
|
|
1071
1071
|
generate(t, e, i = {}) {
|
|
1072
|
-
var S,
|
|
1073
|
-
const n = [], { width: s, height: r } = e, a = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = ((S = this.imageConfig.rotation) == null ? void 0 : S.mode) ?? "none", l = ((_ = (
|
|
1072
|
+
var S, F, _, H, $, D, W, L, w;
|
|
1073
|
+
const n = [], { width: s, height: r } = e, a = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = ((S = this.imageConfig.rotation) == null ? void 0 : S.mode) ?? "none", l = ((_ = (F = this.imageConfig.rotation) == null ? void 0 : F.range) == null ? void 0 : _.min) ?? -15, d = (($ = (H = this.imageConfig.rotation) == null ? void 0 : H.range) == null ? void 0 : $.max) ?? 15, h = ((W = (D = this.imageConfig.sizing) == null ? void 0 : D.variance) == null ? void 0 : W.min) ?? 1, g = ((w = (L = this.imageConfig.sizing) == null ? void 0 : L.variance) == null ? void 0 : w.max) ?? 1, p = h !== 1 || g !== 1, f = c * 1.5 / 2, m = c / 2, y = s - a - f, v = r - a - m, E = a + f, A = a + m;
|
|
1074
1074
|
for (let T = 0; T < t; T++) {
|
|
1075
|
-
const
|
|
1075
|
+
const M = this.random(E, y), C = this.random(A, v), R = u === "random" ? this.random(l, d) : 0, z = p ? this.random(h, g) : 1, U = c * z, Z = {
|
|
1076
1076
|
id: T,
|
|
1077
|
-
x:
|
|
1077
|
+
x: M,
|
|
1078
1078
|
y: C,
|
|
1079
1079
|
rotation: R,
|
|
1080
|
-
scale:
|
|
1080
|
+
scale: z,
|
|
1081
1081
|
baseSize: U
|
|
1082
1082
|
};
|
|
1083
1083
|
n.push(Z);
|
|
@@ -1106,8 +1106,8 @@ class fe {
|
|
|
1106
1106
|
* @returns Array of layout objects with position, rotation, scale
|
|
1107
1107
|
*/
|
|
1108
1108
|
generate(t, e, i = {}) {
|
|
1109
|
-
var A, S,
|
|
1110
|
-
const n = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, c = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", u = ((
|
|
1109
|
+
var A, S, F, _, H, $, D, W, L;
|
|
1110
|
+
const n = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, c = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", u = ((F = (S = this.imageConfig.rotation) == null ? void 0 : S.range) == null ? void 0 : F.min) ?? -15, l = ((H = (_ = this.imageConfig.rotation) == null ? void 0 : _.range) == null ? void 0 : H.max) ?? 15, d = ((D = ($ = this.imageConfig.sizing) == null ? void 0 : $.variance) == null ? void 0 : D.min) ?? 1, h = ((L = (W = this.imageConfig.sizing) == null ? void 0 : W.variance) == null ? void 0 : L.max) ?? 1, g = d !== 1 || h !== 1, p = this.config.scaleDecay ?? 0, b = i.fixedHeight ?? a, f = s / 2, m = r / 2, y = Math.ceil(Math.sqrt(t));
|
|
1111
1111
|
if (t > 0) {
|
|
1112
1112
|
const w = g ? this.random(d, h) : 1, T = b * w;
|
|
1113
1113
|
n.push({
|
|
@@ -1124,15 +1124,15 @@ class fe {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
let v = 1, E = 1;
|
|
1126
1126
|
for (; v < t; ) {
|
|
1127
|
-
const w = E / y, T = p > 0 ? 1 - w * p * 0.5 : 1,
|
|
1127
|
+
const w = E / y, T = p > 0 ? 1 - w * p * 0.5 : 1, M = E * (b * 0.8), C = M * 1.5, R = Math.PI * (3 * (C + M) - Math.sqrt((3 * C + M) * (C + 3 * M))), z = this.estimateWidth(b), U = Math.floor(R / (z * 0.7));
|
|
1128
1128
|
if (U === 0) {
|
|
1129
1129
|
E++;
|
|
1130
1130
|
continue;
|
|
1131
1131
|
}
|
|
1132
1132
|
const Z = 2 * Math.PI / U, Q = E * (20 * Math.PI / 180);
|
|
1133
|
-
for (let
|
|
1134
|
-
const tt =
|
|
1135
|
-
let N = f + Math.cos(tt) * C, B = m + Math.sin(tt) *
|
|
1133
|
+
for (let G = 0; G < U && v < t; G++) {
|
|
1134
|
+
const tt = G * Z + Q, Y = g ? this.random(d, h) : 1, et = T * Y, X = b * et;
|
|
1135
|
+
let N = f + Math.cos(tt) * C, B = m + Math.sin(tt) * M;
|
|
1136
1136
|
const k = this.config.spacing.padding ?? 50, j = X * 1.5 / 2, O = X / 2;
|
|
1137
1137
|
N - j < k ? N = k + j : N + j > s - k && (N = s - k - j), B - O < k ? B = k + O : B + O > r - k && (B = r - k - O);
|
|
1138
1138
|
const J = c === "random" ? this.random(u, l) : 0;
|
|
@@ -1180,7 +1180,7 @@ const me = {
|
|
|
1180
1180
|
alignment: "center",
|
|
1181
1181
|
gap: 10,
|
|
1182
1182
|
overflowOffset: 0.25
|
|
1183
|
-
},
|
|
1183
|
+
}, Ft = [
|
|
1184
1184
|
{ x: 1, y: 1 },
|
|
1185
1185
|
// bottom-right
|
|
1186
1186
|
{ x: -1, y: -1 },
|
|
@@ -1210,14 +1210,14 @@ class pe {
|
|
|
1210
1210
|
* @returns Array of layout objects with position, rotation, scale
|
|
1211
1211
|
*/
|
|
1212
1212
|
generate(t, e, i = {}) {
|
|
1213
|
-
var Q,
|
|
1214
|
-
const n = [], { width: s, height: r } = e, a = { ...me, ...this.config.grid }, c = this.config.spacing.padding, u = i.fixedHeight ?? 200, l = ((Q = this.imageConfig.rotation) == null ? void 0 : Q.mode) ?? "none", d = ((tt = (
|
|
1213
|
+
var Q, G, tt, Y, et, X, N, B, k;
|
|
1214
|
+
const n = [], { width: s, height: r } = e, a = { ...me, ...this.config.grid }, c = this.config.spacing.padding, u = i.fixedHeight ?? 200, l = ((Q = this.imageConfig.rotation) == null ? void 0 : Q.mode) ?? "none", d = ((tt = (G = this.imageConfig.sizing) == null ? void 0 : G.variance) == null ? void 0 : tt.min) ?? 1, h = ((et = (Y = this.imageConfig.sizing) == null ? void 0 : Y.variance) == null ? void 0 : et.max) ?? 1, g = d !== 1 || h !== 1, p = s - 2 * c, b = r - 2 * c, { columns: f, rows: m } = this.calculateGridDimensions(
|
|
1215
1215
|
t,
|
|
1216
1216
|
p,
|
|
1217
1217
|
b,
|
|
1218
1218
|
u,
|
|
1219
1219
|
a
|
|
1220
|
-
), y = a.stagger === "row", v = a.stagger === "column", E = y ? f + 0.5 : f, A = v ? m + 0.5 : m, S = (p - a.gap * (f - 1)) / E,
|
|
1220
|
+
), y = a.stagger === "row", v = a.stagger === "column", E = y ? f + 0.5 : f, A = v ? m + 0.5 : m, S = (p - a.gap * (f - 1)) / E, F = (b - a.gap * (m - 1)) / A, _ = y ? S / 2 : 0, H = v ? F / 2 : 0, $ = 1 + a.overlap, D = Math.min(S, F) * $, W = i.fixedHeight ? Math.min(i.fixedHeight, D) : D, L = f * S + (f - 1) * a.gap + _, w = m * F + (m - 1) * a.gap + H, T = c + (p - L) / 2, M = c + (b - w) / 2, C = f * m, R = a.columns !== "auto" && a.rows !== "auto", z = R && t > C;
|
|
1221
1221
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1222
1222
|
gridConfigColumns: a.columns,
|
|
1223
1223
|
gridConfigRows: a.rows,
|
|
@@ -1226,35 +1226,35 @@ class pe {
|
|
|
1226
1226
|
cellCount: C,
|
|
1227
1227
|
hasFixedGrid: R,
|
|
1228
1228
|
imageCount: t,
|
|
1229
|
-
isOverflowMode:
|
|
1229
|
+
isOverflowMode: z
|
|
1230
1230
|
});
|
|
1231
|
-
const U =
|
|
1231
|
+
const U = z ? new Array(C).fill(0) : [], Z = Math.min(S, F) * a.overflowOffset;
|
|
1232
1232
|
for (let P = 0; P < t; P++) {
|
|
1233
1233
|
let j, O, J = 0;
|
|
1234
|
-
if (
|
|
1234
|
+
if (z && P >= C) {
|
|
1235
1235
|
const K = P - C, q = K % C;
|
|
1236
1236
|
J = Math.floor(K / C) + 1, U[q]++, a.fillDirection === "row" ? (j = q % f, O = Math.floor(q / f)) : (O = q % m, j = Math.floor(q / m));
|
|
1237
1237
|
} else
|
|
1238
1238
|
a.fillDirection === "row" ? (j = P % f, O = Math.floor(P / f)) : (O = P % m, j = Math.floor(P / m));
|
|
1239
|
-
let V = T + j * (S + a.gap) + S / 2, it =
|
|
1240
|
-
if (a.stagger === "row" && O % 2 === 1 ? V += S / 2 : a.stagger === "column" && j % 2 === 1 && (it +=
|
|
1241
|
-
const K = (J - 1) %
|
|
1239
|
+
let V = T + j * (S + a.gap) + S / 2, it = M + O * (F + a.gap) + F / 2;
|
|
1240
|
+
if (a.stagger === "row" && O % 2 === 1 ? V += S / 2 : a.stagger === "column" && j % 2 === 1 && (it += F / 2), J > 0) {
|
|
1241
|
+
const K = (J - 1) % Ft.length, q = Ft[K];
|
|
1242
1242
|
V += q.x * Z, it += q.y * Z;
|
|
1243
1243
|
}
|
|
1244
1244
|
if (a.jitter > 0) {
|
|
1245
|
-
const K = S / 2 * a.jitter, q =
|
|
1245
|
+
const K = S / 2 * a.jitter, q = F / 2 * a.jitter;
|
|
1246
1246
|
V += this.random(-K, K), it += this.random(-q, q);
|
|
1247
1247
|
}
|
|
1248
1248
|
let nt = V, ot = it;
|
|
1249
|
-
if (!
|
|
1249
|
+
if (!z && a.fillDirection === "row") {
|
|
1250
1250
|
const K = t % f || f;
|
|
1251
1251
|
if (O === Math.floor((t - 1) / f) && K < f) {
|
|
1252
1252
|
const Rt = K * S + (K - 1) * a.gap;
|
|
1253
1253
|
let Et = 0;
|
|
1254
|
-
a.alignment === "center" ? Et = (
|
|
1254
|
+
a.alignment === "center" ? Et = (L - Rt) / 2 : a.alignment === "end" && (Et = L - Rt), nt += Et;
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
const pt = g ? this.random(d, h) : 1, at =
|
|
1257
|
+
const pt = g ? this.random(d, h) : 1, at = W * pt, dt = at * 1.5 / 2, ut = at / 2, yt = c + dt, vt = s - c - dt, Nt = c + ut, kt = r - c - ut;
|
|
1258
1258
|
nt = Math.max(yt, Math.min(nt, vt)), ot = Math.max(Nt, Math.min(ot, kt));
|
|
1259
1259
|
let wt = 0;
|
|
1260
1260
|
if (l === "random") {
|
|
@@ -1262,7 +1262,7 @@ class pe {
|
|
|
1262
1262
|
a.jitter > 0 ? wt = this.random(K * a.jitter, q * a.jitter) : wt = this.random(K, q);
|
|
1263
1263
|
}
|
|
1264
1264
|
let xt;
|
|
1265
|
-
|
|
1265
|
+
z && J > 0 ? xt = 50 - J : xt = z ? 100 + P : P + 1, n.push({
|
|
1266
1266
|
id: P,
|
|
1267
1267
|
x: nt,
|
|
1268
1268
|
y: ot,
|
|
@@ -1318,28 +1318,28 @@ class ve {
|
|
|
1318
1318
|
* @returns Array of layout objects with position, rotation, scale
|
|
1319
1319
|
*/
|
|
1320
1320
|
generate(t, e, i = {}) {
|
|
1321
|
-
var A, S,
|
|
1322
|
-
const n = [], { width: s, height: r } = e, a = { ...ye, ...this.config.spiral }, c = this.config.spacing.padding, u = i.fixedHeight ?? 200, l = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", d = ((
|
|
1321
|
+
var A, S, F, _, H, $, D, W, L;
|
|
1322
|
+
const n = [], { width: s, height: r } = e, a = { ...ye, ...this.config.spiral }, c = this.config.spacing.padding, u = i.fixedHeight ?? 200, l = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", d = ((F = (S = this.imageConfig.rotation) == null ? void 0 : S.range) == null ? void 0 : F.min) ?? -15, h = ((H = (_ = this.imageConfig.rotation) == null ? void 0 : _.range) == null ? void 0 : H.max) ?? 15, g = ((D = ($ = this.imageConfig.sizing) == null ? void 0 : $.variance) == null ? void 0 : D.min) ?? 1, p = ((L = (W = this.imageConfig.sizing) == null ? void 0 : W.variance) == null ? void 0 : L.max) ?? 1, b = g !== 1 || p !== 1, f = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, y = r / 2, v = Math.min(
|
|
1323
1323
|
m - c - u / 2,
|
|
1324
1324
|
y - c - u / 2
|
|
1325
1325
|
), E = a.direction === "clockwise" ? -1 : 1;
|
|
1326
1326
|
for (let w = 0; w < t; w++) {
|
|
1327
|
-
let T,
|
|
1327
|
+
let T, M;
|
|
1328
1328
|
if (a.spiralType === "golden")
|
|
1329
|
-
T = w * be * E + a.startAngle,
|
|
1329
|
+
T = w * be * E + a.startAngle, M = this.calculateGoldenRadius(w, t, v, a.tightness);
|
|
1330
1330
|
else if (a.spiralType === "archimedean") {
|
|
1331
1331
|
const V = w * 0.5 * a.tightness;
|
|
1332
|
-
T = V * E + a.startAngle,
|
|
1332
|
+
T = V * E + a.startAngle, M = this.calculateArchimedeanRadius(V, t, v, a.tightness);
|
|
1333
1333
|
} else {
|
|
1334
1334
|
const V = w * 0.3 * a.tightness;
|
|
1335
|
-
T = V * E + a.startAngle,
|
|
1335
|
+
T = V * E + a.startAngle, M = this.calculateLogarithmicRadius(V, t, v, a.tightness);
|
|
1336
1336
|
}
|
|
1337
|
-
const C = m + Math.cos(T) *
|
|
1337
|
+
const C = m + Math.cos(T) * M, R = y + Math.sin(T) * M, z = M / v, U = f > 0 ? 1 - z * f * 0.5 : 1, Z = b ? this.random(g, p) : 1, Q = U * Z, G = u * Q, Y = G * 1.5 / 2, et = G / 2, X = c + Y, N = s - c - Y, B = c + et, k = r - c - et, P = Math.max(X, Math.min(C, N)), j = Math.max(B, Math.min(R, k));
|
|
1338
1338
|
let O = 0;
|
|
1339
1339
|
if (l === "random") {
|
|
1340
1340
|
const V = T * 180 / Math.PI % 360, it = this.random(d, h);
|
|
1341
1341
|
O = a.spiralType === "golden" ? it : V * 0.1 + it * 0.9;
|
|
1342
|
-
} else l === "tangent" && (O = this.calculateSpiralTangent(T,
|
|
1342
|
+
} else l === "tangent" && (O = this.calculateSpiralTangent(T, M, a));
|
|
1343
1343
|
const J = t - w;
|
|
1344
1344
|
n.push({
|
|
1345
1345
|
id: w,
|
|
@@ -1347,7 +1347,7 @@ class ve {
|
|
|
1347
1347
|
y: j,
|
|
1348
1348
|
rotation: O,
|
|
1349
1349
|
scale: Q,
|
|
1350
|
-
baseSize:
|
|
1350
|
+
baseSize: G,
|
|
1351
1351
|
zIndex: J
|
|
1352
1352
|
});
|
|
1353
1353
|
}
|
|
@@ -1421,8 +1421,8 @@ class xe {
|
|
|
1421
1421
|
* @returns Array of layout objects with position, rotation, scale
|
|
1422
1422
|
*/
|
|
1423
1423
|
generate(t, e, i = {}) {
|
|
1424
|
-
var E, A, S,
|
|
1425
|
-
const n = [], { width: s, height: r } = e, a = { ...we, ...this.config.cluster }, c = this.config.spacing.padding, u = i.fixedHeight ?? 200, l = ((E = this.imageConfig.rotation) == null ? void 0 : E.mode) ?? "none", d = ((S = (A = this.imageConfig.rotation) == null ? void 0 : A.range) == null ? void 0 : S.min) ?? -15, h = ((_ = (
|
|
1424
|
+
var E, A, S, F, _, H, $, D, W;
|
|
1425
|
+
const n = [], { width: s, height: r } = e, a = { ...we, ...this.config.cluster }, c = this.config.spacing.padding, u = i.fixedHeight ?? 200, l = ((E = this.imageConfig.rotation) == null ? void 0 : E.mode) ?? "none", d = ((S = (A = this.imageConfig.rotation) == null ? void 0 : A.range) == null ? void 0 : S.min) ?? -15, h = ((_ = (F = this.imageConfig.rotation) == null ? void 0 : F.range) == null ? void 0 : _.max) ?? 15, g = (($ = (H = this.imageConfig.sizing) == null ? void 0 : H.variance) == null ? void 0 : $.min) ?? 1, p = ((W = (D = this.imageConfig.sizing) == null ? void 0 : D.variance) == null ? void 0 : W.max) ?? 1, b = g !== 1 || p !== 1, f = this.calculateClusterCount(
|
|
1426
1426
|
t,
|
|
1427
1427
|
a.clusterCount,
|
|
1428
1428
|
s,
|
|
@@ -1435,12 +1435,12 @@ class xe {
|
|
|
1435
1435
|
c,
|
|
1436
1436
|
a
|
|
1437
1437
|
), y = new Array(f).fill(0);
|
|
1438
|
-
for (let
|
|
1439
|
-
y[
|
|
1438
|
+
for (let L = 0; L < t; L++)
|
|
1439
|
+
y[L % f]++;
|
|
1440
1440
|
let v = 0;
|
|
1441
|
-
for (let
|
|
1442
|
-
const w = m[
|
|
1443
|
-
for (let
|
|
1441
|
+
for (let L = 0; L < f; L++) {
|
|
1442
|
+
const w = m[L], T = y[L];
|
|
1443
|
+
for (let M = 0; M < T; M++) {
|
|
1444
1444
|
let C, R;
|
|
1445
1445
|
if (a.distribution === "gaussian")
|
|
1446
1446
|
C = this.gaussianRandom() * w.spread, R = this.gaussianRandom() * w.spread;
|
|
@@ -1448,11 +1448,11 @@ class xe {
|
|
|
1448
1448
|
const O = this.random(0, Math.PI * 2), J = this.random(0, w.spread);
|
|
1449
1449
|
C = Math.cos(O) * J, R = Math.sin(O) * J;
|
|
1450
1450
|
}
|
|
1451
|
-
const
|
|
1452
|
-
C /=
|
|
1453
|
-
const Z = b ? this.random(g, p) : 1, Q = U * Z,
|
|
1451
|
+
const z = 1 + a.overlap * 0.5, U = 1 + a.overlap * 0.3;
|
|
1452
|
+
C /= z, R /= z;
|
|
1453
|
+
const Z = b ? this.random(g, p) : 1, Q = U * Z, G = u * Q;
|
|
1454
1454
|
let tt = w.x + C, Y = w.y + R;
|
|
1455
|
-
const X =
|
|
1455
|
+
const X = G * 1.5 / 2, N = G / 2;
|
|
1456
1456
|
tt = Math.max(c + X, Math.min(tt, s - c - X)), Y = Math.max(c + N, Math.min(Y, r - c - N));
|
|
1457
1457
|
const B = l === "random" ? this.random(d, h) : 0, P = Math.sqrt(C * C + R * R) / w.spread, j = Math.round((1 - P) * 50) + 1;
|
|
1458
1458
|
n.push({
|
|
@@ -1461,7 +1461,7 @@ class xe {
|
|
|
1461
1461
|
y: Y,
|
|
1462
1462
|
rotation: B,
|
|
1463
1463
|
scale: Q,
|
|
1464
|
-
baseSize:
|
|
1464
|
+
baseSize: G,
|
|
1465
1465
|
zIndex: j
|
|
1466
1466
|
}), v++;
|
|
1467
1467
|
}
|
|
@@ -1540,18 +1540,18 @@ class Ee {
|
|
|
1540
1540
|
* @returns Array of layout objects with position, rotation, scale
|
|
1541
1541
|
*/
|
|
1542
1542
|
generate(t, e, i = {}) {
|
|
1543
|
-
var
|
|
1544
|
-
const n = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, u = ((
|
|
1545
|
-
...
|
|
1543
|
+
var z, U, Z, Q, G, tt, Y, et, X;
|
|
1544
|
+
const n = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, u = ((z = this.imageConfig.rotation) == null ? void 0 : z.mode) ?? "none", l = ((Z = (U = this.imageConfig.rotation) == null ? void 0 : U.range) == null ? void 0 : Z.min) ?? -15, d = ((G = (Q = this.imageConfig.rotation) == null ? void 0 : Q.range) == null ? void 0 : G.max) ?? 15, h = ((Y = (tt = this.imageConfig.sizing) == null ? void 0 : tt.variance) == null ? void 0 : Y.min) ?? 1, g = ((X = (et = this.imageConfig.sizing) == null ? void 0 : et.variance) == null ? void 0 : X.max) ?? 1, p = h !== 1 || g !== 1, b = i.fixedHeight ?? a, f = {
|
|
1545
|
+
...Wt,
|
|
1546
1546
|
...this.config.wave
|
|
1547
|
-
}, { rows: m, amplitude: y, frequency: v, phaseShift: E, synchronization: A } = f, S = Math.ceil(t / m), H = b * 1.5 / 2, $ = c + H, D = s - c - H,
|
|
1547
|
+
}, { rows: m, amplitude: y, frequency: v, phaseShift: E, synchronization: A } = f, S = Math.ceil(t / m), H = b * 1.5 / 2, $ = c + H, D = s - c - H, W = D - $, L = S > 1 ? W / (S - 1) : 0, w = c + y + b / 2, T = r - c - y - b / 2, M = T - w, C = m > 1 ? M / (m - 1) : 0;
|
|
1548
1548
|
let R = 0;
|
|
1549
1549
|
for (let N = 0; N < m && R < t; N++) {
|
|
1550
1550
|
const B = m === 1 ? (w + T) / 2 : w + N * C;
|
|
1551
1551
|
let k = 0;
|
|
1552
1552
|
A === "offset" ? k = N * E : A === "alternating" && (k = N * Math.PI);
|
|
1553
1553
|
for (let P = 0; P < S && R < t; P++) {
|
|
1554
|
-
const j = S === 1 ? ($ + D) / 2 : $ + P *
|
|
1554
|
+
const j = S === 1 ? ($ + D) / 2 : $ + P * L, O = this.calculateWaveY(j, s, y, v, k), J = j, V = B + O, it = p ? this.random(h, g) : 1, nt = b * it;
|
|
1555
1555
|
let ot = 0;
|
|
1556
1556
|
u === "tangent" ? ot = this.calculateRotation(j, s, y, v, k) : u === "random" && (ot = this.random(l, d));
|
|
1557
1557
|
const at = nt * 1.5 / 2, bt = nt / 2, dt = c + at, ut = s - c - at, yt = c + bt, vt = r - c - bt;
|
|
@@ -1608,13 +1608,13 @@ class Ee {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
class Se {
|
|
1610
1610
|
constructor(t) {
|
|
1611
|
-
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.
|
|
1611
|
+
this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
|
|
1612
1612
|
}
|
|
1613
1613
|
/**
|
|
1614
|
-
* Initialize the appropriate
|
|
1615
|
-
* @returns Initialized placement
|
|
1614
|
+
* Initialize the appropriate placement layout based on config type
|
|
1615
|
+
* @returns Initialized placement layout
|
|
1616
1616
|
*/
|
|
1617
|
-
|
|
1617
|
+
initLayout() {
|
|
1618
1618
|
switch (this.config.algorithm) {
|
|
1619
1619
|
case "radial":
|
|
1620
1620
|
return new fe(this.config, this.imageConfig);
|
|
@@ -1639,7 +1639,7 @@ class Se {
|
|
|
1639
1639
|
* @returns Array of layout objects with position, rotation, scale
|
|
1640
1640
|
*/
|
|
1641
1641
|
generateLayout(t, e, i = {}) {
|
|
1642
|
-
const n = this.
|
|
1642
|
+
const n = this.placementLayout.generate(t, e, i);
|
|
1643
1643
|
return n.forEach((s) => {
|
|
1644
1644
|
this.layouts.set(s.id, s);
|
|
1645
1645
|
}), n;
|
|
@@ -1663,7 +1663,7 @@ class Se {
|
|
|
1663
1663
|
* @param newConfig - Updated configuration
|
|
1664
1664
|
*/
|
|
1665
1665
|
updateConfig(t) {
|
|
1666
|
-
t.layout && (Object.assign(this.config, t.layout), t.layout.algorithm && t.layout.algorithm !== this.config.algorithm && (this.
|
|
1666
|
+
t.layout && (Object.assign(this.config, t.layout), t.layout.algorithm && t.layout.algorithm !== this.config.algorithm && (this.placementLayout = this.initLayout())), t.image && Object.assign(this.imageConfig, t.image);
|
|
1667
1667
|
}
|
|
1668
1668
|
/**
|
|
1669
1669
|
* Get responsive breakpoints from layout config
|
|
@@ -2270,7 +2270,7 @@ class Ce {
|
|
|
2270
2270
|
), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2271
2271
|
}
|
|
2272
2272
|
}
|
|
2273
|
-
const Re = 50,
|
|
2273
|
+
const Re = 50, Le = 0.5, Me = 20, ze = 0.3, Fe = 150, Oe = 30, mt = class mt {
|
|
2274
2274
|
constructor(t, e) {
|
|
2275
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);
|
|
2276
2276
|
}
|
|
@@ -2322,7 +2322,7 @@ const Re = 50, Me = 0.5, ze = 20, Fe = 0.3, Le = 150, Oe = 30, mt = class mt {
|
|
|
2322
2322
|
}
|
|
2323
2323
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2324
2324
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
|
|
2325
|
-
const s = i *
|
|
2325
|
+
const s = i * ze;
|
|
2326
2326
|
this.callbacks.onDragOffset(s);
|
|
2327
2327
|
}
|
|
2328
2328
|
}
|
|
@@ -2331,7 +2331,7 @@ const Re = 50, Me = 0.5, ze = 20, Fe = 0.3, Le = 150, Oe = 30, mt = class mt {
|
|
|
2331
2331
|
this.recentTouchTimestamp = Date.now();
|
|
2332
2332
|
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, n = Math.abs(e) / i, s = Math.abs(e);
|
|
2333
2333
|
let r = !1;
|
|
2334
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Re || n >=
|
|
2334
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Re || n >= Le && s >= Me) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2335
2335
|
}
|
|
2336
2336
|
handleTouchCancel(t) {
|
|
2337
2337
|
var e;
|
|
@@ -2969,7 +2969,7 @@ class Ne {
|
|
|
2969
2969
|
onPrev: () => this.navigateToPreviousImage(),
|
|
2970
2970
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
2971
2971
|
onDragEnd: (t) => {
|
|
2972
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
2972
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Fe);
|
|
2973
2973
|
}
|
|
2974
2974
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
2975
2975
|
} catch (t) {
|