@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/dist/image-cloud.js
CHANGED
|
@@ -4,16 +4,16 @@ const St = Object.freeze({
|
|
|
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
|
+
}), Ft = 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 }),
|
|
@@ -56,10 +56,10 @@ const St = Object.freeze({
|
|
|
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
|
+
}), Wt = Object.freeze({
|
|
60
60
|
mobile: Object.freeze({ maxWidth: 767 }),
|
|
61
61
|
tablet: Object.freeze({ maxWidth: 1199 })
|
|
62
|
-
}),
|
|
62
|
+
}), Gt = Object.freeze({
|
|
63
63
|
mode: "adaptive",
|
|
64
64
|
// Default to adaptive sizing
|
|
65
65
|
minSize: 50,
|
|
@@ -78,7 +78,7 @@ const St = Object.freeze({
|
|
|
78
78
|
max: 15
|
|
79
79
|
})
|
|
80
80
|
}), Dt = Object.freeze({
|
|
81
|
-
sizing:
|
|
81
|
+
sizing: Gt,
|
|
82
82
|
rotation: qt
|
|
83
83
|
}), Ut = Object.freeze({
|
|
84
84
|
validateUrls: !0,
|
|
@@ -105,7 +105,7 @@ const St = Object.freeze({
|
|
|
105
105
|
algorithm: "radial",
|
|
106
106
|
scaleDecay: 0,
|
|
107
107
|
// No decay by default (0-1 for radial/spiral)
|
|
108
|
-
responsive:
|
|
108
|
+
responsive: Wt,
|
|
109
109
|
targetCoverage: 0.6,
|
|
110
110
|
// Target 60% of container area
|
|
111
111
|
densityFactor: 1,
|
|
@@ -387,13 +387,13 @@ function Vt(o = {}) {
|
|
|
387
387
|
}, a;
|
|
388
388
|
}
|
|
389
389
|
function Kt(o, t) {
|
|
390
|
-
return { ...o ?
|
|
390
|
+
return { ...o ? Lt[o] : Lt.playful, ...t };
|
|
391
391
|
}
|
|
392
392
|
function Zt(o, t) {
|
|
393
|
-
return { ...o ?
|
|
393
|
+
return { ...o ? Mt[o] : Mt.gentle, ...t };
|
|
394
394
|
}
|
|
395
395
|
function Qt(o, t) {
|
|
396
|
-
return { ...o ?
|
|
396
|
+
return { ...o ? Ft[o] : Ft.gentle, ...t };
|
|
397
397
|
}
|
|
398
398
|
class te {
|
|
399
399
|
constructor(t) {
|
|
@@ -660,8 +660,8 @@ function ce(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 ce(o) {
|
|
|
694
694
|
y: st(e.y, i.y, w)
|
|
695
695
|
};
|
|
696
696
|
}
|
|
697
|
-
const
|
|
697
|
+
const M = T.x - i.x, R = T.y - i.y;
|
|
698
698
|
let C;
|
|
699
699
|
m ? C = ae(w, c, y) : f ? C = st(h, c, w) : C = c;
|
|
700
|
-
let
|
|
701
|
-
A ?
|
|
700
|
+
let F;
|
|
701
|
+
A ? F = re(w, u, S) : E ? F = st(p, u, w) : F = u, t.style.transform = `translate(${H}px, ${$}px) translate(${M}px, ${R}px) rotate(${C}deg) scale(${F})`, 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 ue {
|
|
|
1069
1069
|
* @returns Array of layout objects with position, rotation, scale
|
|
1070
1070
|
*/
|
|
1071
1071
|
generate(t, e, i = {}) {
|
|
1072
|
-
var S, z, _, H, $, D,
|
|
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 = ((_ = (z = this.imageConfig.rotation) == null ? void 0 : z.range) == null ? void 0 : _.min) ?? -15, d = (($ = (H = this.imageConfig.rotation) == null ? void 0 : H.range) == null ? void 0 : $.max) ?? 15, h = ((
|
|
1072
|
+
var S, z, _, 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 = ((_ = (z = this.imageConfig.rotation) == null ? void 0 : z.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), R = this.random(A, v), C = u === "random" ? this.random(l, d) : 0, F = p ? this.random(h, g) : 1, U = c * F, Z = {
|
|
1076
1076
|
id: T,
|
|
1077
|
-
x:
|
|
1077
|
+
x: M,
|
|
1078
1078
|
y: R,
|
|
1079
1079
|
rotation: C,
|
|
1080
|
-
scale:
|
|
1080
|
+
scale: F,
|
|
1081
1081
|
baseSize: U
|
|
1082
1082
|
};
|
|
1083
1083
|
n.push(Z);
|
|
@@ -1106,8 +1106,8 @@ class ge {
|
|
|
1106
1106
|
* @returns Array of layout objects with position, rotation, scale
|
|
1107
1107
|
*/
|
|
1108
1108
|
generate(t, e, i = {}) {
|
|
1109
|
-
var A, S, z, _, H, $, D,
|
|
1110
|
-
const n = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, c = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", u = ((z = (S = this.imageConfig.rotation) == null ? void 0 : S.range) == null ? void 0 : z.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 = ((
|
|
1109
|
+
var A, S, z, _, 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 = ((z = (S = this.imageConfig.rotation) == null ? void 0 : S.range) == null ? void 0 : z.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 ge {
|
|
|
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), R = M * 1.5, C = Math.PI * (3 * (R + M) - Math.sqrt((3 * R + M) * (R + 3 * M))), F = this.estimateWidth(b), U = Math.floor(C / (F * 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) * R, 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) * R, B = m + Math.sin(tt) * M;
|
|
1136
1136
|
const j = this.config.spacing.padding ?? 50, k = X * 1.5 / 2, O = X / 2;
|
|
1137
1137
|
N - k < j ? N = j + k : N + k > s - j && (N = s - j - k), B - O < j ? B = j + O : B + O > r - j && (B = r - j - O);
|
|
1138
1138
|
const J = c === "random" ? this.random(u, l) : 0;
|
|
@@ -1210,14 +1210,14 @@ class me {
|
|
|
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 = { ...fe, ...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, j;
|
|
1214
|
+
const n = [], { width: s, height: r } = e, a = { ...fe, ...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, z = (b - a.gap * (m - 1)) / A, _ = y ? S / 2 : 0, H = v ? z / 2 : 0, $ = 1 + a.overlap, D = Math.min(S, z) * $,
|
|
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, z = (b - a.gap * (m - 1)) / A, _ = y ? S / 2 : 0, H = v ? z / 2 : 0, $ = 1 + a.overlap, D = Math.min(S, z) * $, W = i.fixedHeight ? Math.min(i.fixedHeight, D) : D, L = f * S + (f - 1) * a.gap + _, w = m * z + (m - 1) * a.gap + H, T = c + (p - L) / 2, M = c + (b - w) / 2, R = f * m, C = a.columns !== "auto" && a.rows !== "auto", F = C && t > R;
|
|
1221
1221
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1222
1222
|
gridConfigColumns: a.columns,
|
|
1223
1223
|
gridConfigRows: a.rows,
|
|
@@ -1226,17 +1226,17 @@ class me {
|
|
|
1226
1226
|
cellCount: R,
|
|
1227
1227
|
hasFixedGrid: C,
|
|
1228
1228
|
imageCount: t,
|
|
1229
|
-
isOverflowMode:
|
|
1229
|
+
isOverflowMode: F
|
|
1230
1230
|
});
|
|
1231
|
-
const U =
|
|
1231
|
+
const U = F ? new Array(R).fill(0) : [], Z = Math.min(S, z) * a.overflowOffset;
|
|
1232
1232
|
for (let P = 0; P < t; P++) {
|
|
1233
1233
|
let k, O, J = 0;
|
|
1234
|
-
if (
|
|
1234
|
+
if (F && P >= R) {
|
|
1235
1235
|
const K = P - R, q = K % R;
|
|
1236
1236
|
J = Math.floor(K / R) + 1, U[q]++, a.fillDirection === "row" ? (k = q % f, O = Math.floor(q / f)) : (O = q % m, k = Math.floor(q / m));
|
|
1237
1237
|
} else
|
|
1238
1238
|
a.fillDirection === "row" ? (k = P % f, O = Math.floor(P / f)) : (O = P % m, k = Math.floor(P / m));
|
|
1239
|
-
let V = T + k * (S + a.gap) + S / 2, it =
|
|
1239
|
+
let V = T + k * (S + a.gap) + S / 2, it = M + O * (z + a.gap) + z / 2;
|
|
1240
1240
|
if (a.stagger === "row" && O % 2 === 1 ? V += S / 2 : a.stagger === "column" && k % 2 === 1 && (it += z / 2), J > 0) {
|
|
1241
1241
|
const K = (J - 1) % zt.length, q = zt[K];
|
|
1242
1242
|
V += q.x * Z, it += q.y * Z;
|
|
@@ -1246,15 +1246,15 @@ class me {
|
|
|
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 (!F && a.fillDirection === "row") {
|
|
1250
1250
|
const K = t % f || f;
|
|
1251
1251
|
if (O === Math.floor((t - 1) / f) && K < f) {
|
|
1252
1252
|
const Ct = K * S + (K - 1) * a.gap;
|
|
1253
1253
|
let Et = 0;
|
|
1254
|
-
a.alignment === "center" ? Et = (
|
|
1254
|
+
a.alignment === "center" ? Et = (L - Ct) / 2 : a.alignment === "end" && (Et = L - Ct), 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, jt = r - c - ut;
|
|
1258
1258
|
nt = Math.max(yt, Math.min(nt, vt)), ot = Math.max(Nt, Math.min(ot, jt));
|
|
1259
1259
|
let wt = 0;
|
|
1260
1260
|
if (l === "random") {
|
|
@@ -1262,7 +1262,7 @@ class me {
|
|
|
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
|
+
F && J > 0 ? xt = 50 - J : xt = F ? 100 + P : P + 1, n.push({
|
|
1266
1266
|
id: P,
|
|
1267
1267
|
x: nt,
|
|
1268
1268
|
y: ot,
|
|
@@ -1318,28 +1318,28 @@ class ye {
|
|
|
1318
1318
|
* @returns Array of layout objects with position, rotation, scale
|
|
1319
1319
|
*/
|
|
1320
1320
|
generate(t, e, i = {}) {
|
|
1321
|
-
var A, S, z, _, H, $, D,
|
|
1322
|
-
const n = [], { width: s, height: r } = e, a = { ...be, ...this.config.spiral }, c = this.config.spacing.padding, u = i.fixedHeight ?? 200, l = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", d = ((z = (S = this.imageConfig.rotation) == null ? void 0 : S.range) == null ? void 0 : z.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 = ((
|
|
1321
|
+
var A, S, z, _, H, $, D, W, L;
|
|
1322
|
+
const n = [], { width: s, height: r } = e, a = { ...be, ...this.config.spiral }, c = this.config.spacing.padding, u = i.fixedHeight ?? 200, l = ((A = this.imageConfig.rotation) == null ? void 0 : A.mode) ?? "none", d = ((z = (S = this.imageConfig.rotation) == null ? void 0 : S.range) == null ? void 0 : z.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 * pe * E + a.startAngle,
|
|
1329
|
+
T = w * pe * 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 R = m + Math.cos(T) *
|
|
1337
|
+
const R = m + Math.cos(T) * M, C = y + Math.sin(T) * M, F = M / v, U = f > 0 ? 1 - F * 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, j = r - c - et, P = Math.max(X, Math.min(R, N)), k = Math.max(B, Math.min(C, j));
|
|
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 ye {
|
|
|
1347
1347
|
y: k,
|
|
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 we {
|
|
|
1421
1421
|
* @returns Array of layout objects with position, rotation, scale
|
|
1422
1422
|
*/
|
|
1423
1423
|
generate(t, e, i = {}) {
|
|
1424
|
-
var E, A, S, z, _, H, $, D,
|
|
1425
|
-
const n = [], { width: s, height: r } = e, a = { ...ve, ...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 = ((_ = (z = this.imageConfig.rotation) == null ? void 0 : z.range) == null ? void 0 : _.max) ?? 15, g = (($ = (H = this.imageConfig.sizing) == null ? void 0 : H.variance) == null ? void 0 : $.min) ?? 1, p = ((
|
|
1424
|
+
var E, A, S, z, _, H, $, D, W;
|
|
1425
|
+
const n = [], { width: s, height: r } = e, a = { ...ve, ...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 = ((_ = (z = this.imageConfig.rotation) == null ? void 0 : z.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 we {
|
|
|
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 R, C;
|
|
1445
1445
|
if (a.distribution === "gaussian")
|
|
1446
1446
|
R = this.gaussianRandom() * w.spread, C = this.gaussianRandom() * w.spread;
|
|
@@ -1448,11 +1448,11 @@ class we {
|
|
|
1448
1448
|
const O = this.random(0, Math.PI * 2), J = this.random(0, w.spread);
|
|
1449
1449
|
R = Math.cos(O) * J, C = Math.sin(O) * J;
|
|
1450
1450
|
}
|
|
1451
|
-
const
|
|
1452
|
-
R /=
|
|
1453
|
-
const Z = b ? this.random(g, p) : 1, Q = U * Z,
|
|
1451
|
+
const F = 1 + a.overlap * 0.5, U = 1 + a.overlap * 0.3;
|
|
1452
|
+
R /= F, C /= F;
|
|
1453
|
+
const Z = b ? this.random(g, p) : 1, Q = U * Z, G = u * Q;
|
|
1454
1454
|
let tt = w.x + R, Y = w.y + C;
|
|
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(R * R + C * C) / w.spread, k = Math.round((1 - P) * 50) + 1;
|
|
1458
1458
|
n.push({
|
|
@@ -1461,7 +1461,7 @@ class we {
|
|
|
1461
1461
|
y: Y,
|
|
1462
1462
|
rotation: B,
|
|
1463
1463
|
scale: Q,
|
|
1464
|
-
baseSize:
|
|
1464
|
+
baseSize: G,
|
|
1465
1465
|
zIndex: k
|
|
1466
1466
|
}), v++;
|
|
1467
1467
|
}
|
|
@@ -1540,18 +1540,18 @@ class xe {
|
|
|
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 = ((
|
|
1543
|
+
var F, 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 = ((F = this.imageConfig.rotation) == null ? void 0 : F.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
1545
|
...kt,
|
|
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, R = m > 1 ? M / (m - 1) : 0;
|
|
1548
1548
|
let C = 0;
|
|
1549
1549
|
for (let N = 0; N < m && C < t; N++) {
|
|
1550
1550
|
const B = m === 1 ? (w + T) / 2 : w + N * R;
|
|
1551
1551
|
let j = 0;
|
|
1552
1552
|
A === "offset" ? j = N * E : A === "alternating" && (j = N * Math.PI);
|
|
1553
1553
|
for (let P = 0; P < S && C < t; P++) {
|
|
1554
|
-
const k = S === 1 ? ($ + D) / 2 : $ + P *
|
|
1554
|
+
const k = S === 1 ? ($ + D) / 2 : $ + P * L, O = this.calculateWaveY(k, s, y, v, j), J = k, 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(k, s, y, v, j) : 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 xe {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
class Ee {
|
|
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 ge(this.config, this.imageConfig);
|
|
@@ -1639,7 +1639,7 @@ class Ee {
|
|
|
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 Ee {
|
|
|
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 Ae {
|
|
|
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, Ce = 0.5,
|
|
2273
|
+
const Re = 50, Ce = 0.5, Le = 20, Me = 0.3, Fe = 150, ze = 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, Ce = 0.5, Me = 20, Fe = 0.3, Le = 150, ze = 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 * Me;
|
|
2326
2326
|
this.callbacks.onDragOffset(s);
|
|
2327
2327
|
}
|
|
2328
2328
|
}
|
|
@@ -2331,7 +2331,7 @@ const Re = 50, Ce = 0.5, Me = 20, Fe = 0.3, Le = 150, ze = 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 >= Ce && s >=
|
|
2334
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Re || n >= Ce && s >= Le) && (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 He {
|
|
|
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) {
|
|
@@ -3267,25 +3267,26 @@ class He {
|
|
|
3267
3267
|
}
|
|
3268
3268
|
export {
|
|
3269
3269
|
te as AnimationEngine,
|
|
3270
|
-
|
|
3271
|
-
we as
|
|
3270
|
+
Lt as BOUNCE_PRESETS,
|
|
3271
|
+
we as ClusterPlacementLayout,
|
|
3272
3272
|
De as CompositeLoader,
|
|
3273
3273
|
x as DEFAULT_CONFIG,
|
|
3274
3274
|
Ut as DEFAULT_SHARED_LOADER_CONFIG,
|
|
3275
|
-
|
|
3275
|
+
Mt as ELASTIC_PRESETS,
|
|
3276
3276
|
de as EntryAnimationEngine,
|
|
3277
3277
|
Pe as FUNCTIONAL_CSS,
|
|
3278
3278
|
Oe as GoogleDriveLoader,
|
|
3279
|
-
me as
|
|
3279
|
+
me as GridPlacementLayout,
|
|
3280
3280
|
He as ImageCloud,
|
|
3281
3281
|
Ue as ImageFilter,
|
|
3282
3282
|
He as ImageGallery,
|
|
3283
3283
|
Ee as LayoutEngine,
|
|
3284
|
-
ge as
|
|
3285
|
-
ue as
|
|
3286
|
-
ye as
|
|
3284
|
+
ge as RadialPlacementLayout,
|
|
3285
|
+
ue as RandomPlacementLayout,
|
|
3286
|
+
ye as SpiralPlacementLayout,
|
|
3287
3287
|
$e as StaticImageLoader,
|
|
3288
|
-
|
|
3288
|
+
Ft as WAVE_PATH_PRESETS,
|
|
3289
|
+
xe as WavePlacementLayout,
|
|
3289
3290
|
Ae as ZoomEngine,
|
|
3290
3291
|
ce as animatePath,
|
|
3291
3292
|
_e as injectFunctionalStyles,
|