@frybynite/image-cloud 0.3.1 → 0.3.3
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 +97 -81
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +90 -74
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +2 -2
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const
|
|
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}", Et = 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)",
|
|
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
|
+
}), Mt = 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 })
|
|
@@ -13,7 +13,7 @@ const Nt = ".fbn-ic-gallery{--fbn-ic-bg-primary: #05060F;--fbn-ic-bg-secondary:
|
|
|
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
|
+
}), Lt = 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 }),
|
|
@@ -386,13 +386,13 @@ function Vt(n = {}) {
|
|
|
386
386
|
})), n.debug !== void 0 && (s.debug = n.debug), s;
|
|
387
387
|
}
|
|
388
388
|
function Kt(n, t) {
|
|
389
|
-
return { ...n ?
|
|
389
|
+
return { ...n ? Mt[n] : Mt.playful, ...t };
|
|
390
390
|
}
|
|
391
391
|
function Zt(n, t) {
|
|
392
392
|
return { ...n ? zt[n] : zt.gentle, ...t };
|
|
393
393
|
}
|
|
394
394
|
function Qt(n, t) {
|
|
395
|
-
return { ...n ?
|
|
395
|
+
return { ...n ? Lt[n] : Lt.gentle, ...t };
|
|
396
396
|
}
|
|
397
397
|
class te {
|
|
398
398
|
constructor(t) {
|
|
@@ -658,9 +658,9 @@ function ce(n) {
|
|
|
658
658
|
u && u();
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
661
|
-
const
|
|
662
|
-
function U(
|
|
663
|
-
const z =
|
|
661
|
+
const N = performance.now(), P = -r / 2, D = -s / 2;
|
|
662
|
+
function U(k) {
|
|
663
|
+
const z = k - N, x = Math.min(z / a, 1);
|
|
664
664
|
let A;
|
|
665
665
|
switch (p) {
|
|
666
666
|
case "bounce": {
|
|
@@ -693,11 +693,11 @@ function ce(n) {
|
|
|
693
693
|
y: st(e.y, i.y, x)
|
|
694
694
|
};
|
|
695
695
|
}
|
|
696
|
-
const O = A.x - i.x,
|
|
696
|
+
const O = A.x - i.x, M = A.y - i.y;
|
|
697
697
|
let T;
|
|
698
698
|
f ? T = ae(x, h, y) : g ? T = st(d, h, x) : T = h;
|
|
699
|
-
let
|
|
700
|
-
R ?
|
|
699
|
+
let C;
|
|
700
|
+
R ? C = re(x, l, w) : I ? C = st(b, l, x) : C = l, t.style.transform = `translate(${P}px, ${D}px) translate(${O}px, ${M}px) rotate(${T}deg) scale(${C})`, x < 1 ? requestAnimationFrame(U) : (t.style.transform = `translate(${P}px, ${D}px) rotate(${h}deg) scale(${l})`, u && u());
|
|
701
701
|
}
|
|
702
702
|
requestAnimationFrame(U);
|
|
703
703
|
}
|
|
@@ -1068,15 +1068,15 @@ class ue {
|
|
|
1068
1068
|
* @returns Array of layout objects with position, rotation, scale
|
|
1069
1069
|
*/
|
|
1070
1070
|
generate(t, e, i = {}) {
|
|
1071
|
-
var w,
|
|
1072
|
-
const o = [], { 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 = ((
|
|
1071
|
+
var w, F, N, P, D, U, k, z, x;
|
|
1072
|
+
const o = [], { 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, R = s + f;
|
|
1073
1073
|
for (let A = 0; A < t; A++) {
|
|
1074
|
-
const O = this.random(I, y),
|
|
1074
|
+
const O = this.random(I, y), M = this.random(R, v), T = l === "random" ? this.random(u, c) : 0, C = b ? this.random(d, m) : 1, H = h * C, K = {
|
|
1075
1075
|
id: A,
|
|
1076
1076
|
x: O,
|
|
1077
|
-
y:
|
|
1077
|
+
y: M,
|
|
1078
1078
|
rotation: T,
|
|
1079
|
-
scale:
|
|
1079
|
+
scale: C,
|
|
1080
1080
|
baseSize: H
|
|
1081
1081
|
};
|
|
1082
1082
|
o.push(K);
|
|
@@ -1105,10 +1105,10 @@ class ge {
|
|
|
1105
1105
|
* @returns Array of layout objects with position, rotation, scale
|
|
1106
1106
|
*/
|
|
1107
1107
|
generate(t, e, i = {}) {
|
|
1108
|
-
var
|
|
1109
|
-
const o = [], { width: a, height: r } = e, { debugRadials: s } = this.config, h = i.fixedHeight ?? 200, l = ((
|
|
1108
|
+
var F, N, P, D, U, k, z, x, A;
|
|
1109
|
+
const o = [], { 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
1110
|
if (t > 0) {
|
|
1111
|
-
const O = b ? this.random(d, m) : 1,
|
|
1111
|
+
const O = b ? this.random(d, m) : 1, M = f * O;
|
|
1112
1112
|
o.push({
|
|
1113
1113
|
id: 0,
|
|
1114
1114
|
x: y,
|
|
@@ -1116,7 +1116,7 @@ class ge {
|
|
|
1116
1116
|
rotation: l === "random" ? this.random(u * 0.33, c * 0.33) : 0,
|
|
1117
1117
|
// Less rotation for center
|
|
1118
1118
|
scale: O,
|
|
1119
|
-
baseSize:
|
|
1119
|
+
baseSize: M,
|
|
1120
1120
|
zIndex: 100,
|
|
1121
1121
|
// Center image is highest
|
|
1122
1122
|
borderColor: s ? "cyan" : void 0
|
|
@@ -1124,22 +1124,22 @@ class ge {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
let R = 1, w = 1;
|
|
1126
1126
|
for (; R < t; ) {
|
|
1127
|
-
const O = w / I,
|
|
1127
|
+
const O = w / I, M = p > 0 ? 1 - O * p * 0.5 : 1, T = w * (f * 0.8), C = T * 1.5, H = Math.PI * (3 * (C + T) - Math.sqrt((3 * C + T) * (C + 3 * T))), K = this.estimateWidth(f), X = Math.floor(H / (K * 0.7));
|
|
1128
1128
|
if (X === 0) {
|
|
1129
1129
|
w++;
|
|
1130
1130
|
continue;
|
|
1131
1131
|
}
|
|
1132
1132
|
const B = 2 * Math.PI / X, Z = w * (20 * Math.PI / 180);
|
|
1133
1133
|
for (let W = 0; W < X && R < t; W++) {
|
|
1134
|
-
const Q = W * B + Z, tt = b ? this.random(d, m) : 1, q =
|
|
1135
|
-
let Y = y + Math.cos(Q) *
|
|
1134
|
+
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) * C, L = v + Math.sin(Q) * T;
|
|
1136
1136
|
const $ = this.config.spacing.padding ?? 50, G = et * 1.5 / 2, _ = et / 2;
|
|
1137
|
-
Y - G < $ ? Y = $ + G : Y + G > a - $ && (Y = a - $ - G),
|
|
1137
|
+
Y - G < $ ? Y = $ + G : Y + G > a - $ && (Y = a - $ - G), L - _ < $ ? L = $ + _ : L + _ > r - $ && (L = r - $ - _);
|
|
1138
1138
|
const it = l === "random" ? this.random(u, c) : 0;
|
|
1139
1139
|
o.push({
|
|
1140
1140
|
id: R,
|
|
1141
1141
|
x: Y,
|
|
1142
|
-
y:
|
|
1142
|
+
y: L,
|
|
1143
1143
|
rotation: it,
|
|
1144
1144
|
scale: q,
|
|
1145
1145
|
baseSize: et,
|
|
@@ -1181,7 +1181,7 @@ const fe = {
|
|
|
1181
1181
|
alignment: "center",
|
|
1182
1182
|
gap: 10,
|
|
1183
1183
|
overflowOffset: 0.25
|
|
1184
|
-
},
|
|
1184
|
+
}, Ft = [
|
|
1185
1185
|
{ x: 1, y: 1 },
|
|
1186
1186
|
// bottom-right
|
|
1187
1187
|
{ x: -1, y: -1 },
|
|
@@ -1218,53 +1218,53 @@ class me {
|
|
|
1218
1218
|
p,
|
|
1219
1219
|
l,
|
|
1220
1220
|
s
|
|
1221
|
-
), y = s.stagger === "row", v = s.stagger === "column", I = y ? g + 0.5 : g, R = v ? f + 0.5 : f, w = (b - s.gap * (g - 1)) / I,
|
|
1221
|
+
), y = s.stagger === "row", v = s.stagger === "column", I = y ? g + 0.5 : g, R = v ? f + 0.5 : f, w = (b - s.gap * (g - 1)) / I, F = (p - s.gap * (f - 1)) / R, 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", C = T && t > M;
|
|
1222
1222
|
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1223
1223
|
gridConfigColumns: s.columns,
|
|
1224
1224
|
gridConfigRows: s.rows,
|
|
1225
1225
|
columns: g,
|
|
1226
1226
|
rows: f,
|
|
1227
|
-
cellCount:
|
|
1227
|
+
cellCount: M,
|
|
1228
1228
|
hasFixedGrid: T,
|
|
1229
1229
|
imageCount: t,
|
|
1230
|
-
isOverflowMode:
|
|
1230
|
+
isOverflowMode: C
|
|
1231
1231
|
});
|
|
1232
|
-
const H =
|
|
1233
|
-
for (let
|
|
1232
|
+
const H = C ? new Array(M).fill(0) : [], K = Math.min(w, F) * s.overflowOffset;
|
|
1233
|
+
for (let L = 0; L < t; L++) {
|
|
1234
1234
|
let $, j, G = 0;
|
|
1235
|
-
if (
|
|
1236
|
-
const V =
|
|
1237
|
-
G = Math.floor(V /
|
|
1235
|
+
if (C && L >= M) {
|
|
1236
|
+
const V = L - M, J = V % M;
|
|
1237
|
+
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
1238
|
} else
|
|
1239
|
-
s.fillDirection === "row" ? ($ =
|
|
1240
|
-
let _ = A + $ * (w + s.gap) + w / 2, it = O + j * (
|
|
1241
|
-
if (s.stagger === "row" && j % 2 === 1 ? _ += w / 2 : s.stagger === "column" && $ % 2 === 1 && (it +=
|
|
1242
|
-
const V = (G - 1) %
|
|
1239
|
+
s.fillDirection === "row" ? ($ = L % g, j = Math.floor(L / g)) : (j = L % f, $ = Math.floor(L / f));
|
|
1240
|
+
let _ = A + $ * (w + s.gap) + w / 2, it = O + j * (F + s.gap) + F / 2;
|
|
1241
|
+
if (s.stagger === "row" && j % 2 === 1 ? _ += w / 2 : s.stagger === "column" && $ % 2 === 1 && (it += F / 2), G > 0) {
|
|
1242
|
+
const V = (G - 1) % Ft.length, J = Ft[V];
|
|
1243
1243
|
_ += J.x * K, it += J.y * K;
|
|
1244
1244
|
}
|
|
1245
1245
|
if (s.jitter > 0) {
|
|
1246
|
-
const V = w / 2 * s.jitter, J =
|
|
1246
|
+
const V = w / 2 * s.jitter, J = F / 2 * s.jitter;
|
|
1247
1247
|
_ += this.random(-V, V), it += this.random(-J, J);
|
|
1248
1248
|
}
|
|
1249
1249
|
let nt = _, ot = it;
|
|
1250
|
-
if (!
|
|
1250
|
+
if (!C && s.fillDirection === "row") {
|
|
1251
1251
|
const V = t % g || g;
|
|
1252
1252
|
if (j === Math.floor((t - 1) / g) && V < g) {
|
|
1253
|
-
const
|
|
1253
|
+
const Ct = V * w + (V - 1) * s.gap;
|
|
1254
1254
|
let St = 0;
|
|
1255
|
-
s.alignment === "center" ? St = (z -
|
|
1255
|
+
s.alignment === "center" ? St = (z - Ct) / 2 : s.alignment === "end" && (St = z - Ct), nt += St;
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
|
-
const pt = m ? this.random(c, d) : 1, at =
|
|
1259
|
-
nt = Math.max(yt, Math.min(nt, vt)), ot = Math.max(Ht, Math.min(ot,
|
|
1258
|
+
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;
|
|
1259
|
+
nt = Math.max(yt, Math.min(nt, vt)), ot = Math.max(Ht, Math.min(ot, Nt));
|
|
1260
1260
|
let wt = 0;
|
|
1261
1261
|
if (u === "random") {
|
|
1262
1262
|
const V = ((q = (tt = this.imageConfig.rotation) == null ? void 0 : tt.range) == null ? void 0 : q.min) ?? -15, J = ((Y = (et = this.imageConfig.rotation) == null ? void 0 : et.range) == null ? void 0 : Y.max) ?? 15;
|
|
1263
1263
|
s.jitter > 0 ? wt = this.random(V * s.jitter, J * s.jitter) : wt = this.random(V, J);
|
|
1264
1264
|
}
|
|
1265
1265
|
let xt;
|
|
1266
|
-
|
|
1267
|
-
id:
|
|
1266
|
+
C && G > 0 ? xt = 50 - G : xt = C ? 100 + L : L + 1, o.push({
|
|
1267
|
+
id: L,
|
|
1268
1268
|
x: nt,
|
|
1269
1269
|
y: ot,
|
|
1270
1270
|
rotation: wt,
|
|
@@ -1319,8 +1319,8 @@ class ye {
|
|
|
1319
1319
|
* @returns Array of layout objects with position, rotation, scale
|
|
1320
1320
|
*/
|
|
1321
1321
|
generate(t, e, i = {}) {
|
|
1322
|
-
var R, w,
|
|
1323
|
-
const o = [], { width: a, height: r } = e, s = { ...be, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((R = this.imageConfig.rotation) == null ? void 0 : R.mode) ?? "none", c = ((
|
|
1322
|
+
var R, w, F, N, P, D, U, k, z;
|
|
1323
|
+
const o = [], { width: a, height: r } = e, s = { ...be, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((R = this.imageConfig.rotation) == null ? void 0 : R.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
1324
|
f - h - l / 2,
|
|
1325
1325
|
y - h - l / 2
|
|
1326
1326
|
), I = s.direction === "clockwise" ? -1 : 1;
|
|
@@ -1335,7 +1335,7 @@ class ye {
|
|
|
1335
1335
|
const _ = x * 0.3 * s.tightness;
|
|
1336
1336
|
A = _ * I + s.startAngle, O = this.calculateLogarithmicRadius(_, t, v, s.tightness);
|
|
1337
1337
|
}
|
|
1338
|
-
const
|
|
1338
|
+
const M = f + Math.cos(A) * O, T = y + Math.sin(A) * O, C = O / v, H = g > 0 ? 1 - C * 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
1339
|
let j = 0;
|
|
1340
1340
|
if (u === "random") {
|
|
1341
1341
|
const _ = A * 180 / Math.PI % 360, it = this.random(c, d);
|
|
@@ -1344,7 +1344,7 @@ class ye {
|
|
|
1344
1344
|
const G = t - x;
|
|
1345
1345
|
o.push({
|
|
1346
1346
|
id: x,
|
|
1347
|
-
x:
|
|
1347
|
+
x: L,
|
|
1348
1348
|
y: $,
|
|
1349
1349
|
rotation: j,
|
|
1350
1350
|
scale: X,
|
|
@@ -1422,8 +1422,8 @@ class we {
|
|
|
1422
1422
|
* @returns Array of layout objects with position, rotation, scale
|
|
1423
1423
|
*/
|
|
1424
1424
|
generate(t, e, i = {}) {
|
|
1425
|
-
var I, R, w,
|
|
1426
|
-
const o = [], { 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 = (R = this.imageConfig.rotation) == null ? void 0 : R.range) == null ? void 0 : w.min) ?? -15, d = ((
|
|
1425
|
+
var I, R, w, F, N, P, D, U, k;
|
|
1426
|
+
const o = [], { 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 = (R = this.imageConfig.rotation) == null ? void 0 : R.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
1427
|
t,
|
|
1428
1428
|
s.clusterCount,
|
|
1429
1429
|
a,
|
|
@@ -1442,20 +1442,20 @@ class we {
|
|
|
1442
1442
|
for (let z = 0; z < g; z++) {
|
|
1443
1443
|
const x = f[z], A = y[z];
|
|
1444
1444
|
for (let O = 0; O < A; O++) {
|
|
1445
|
-
let
|
|
1445
|
+
let M, T;
|
|
1446
1446
|
if (s.distribution === "gaussian")
|
|
1447
|
-
|
|
1447
|
+
M = this.gaussianRandom() * x.spread, T = this.gaussianRandom() * x.spread;
|
|
1448
1448
|
else {
|
|
1449
1449
|
const j = this.random(0, Math.PI * 2), G = this.random(0, x.spread);
|
|
1450
|
-
|
|
1450
|
+
M = Math.cos(j) * G, T = Math.sin(j) * G;
|
|
1451
1451
|
}
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1452
|
+
const C = 1 + s.overlap * 0.5, H = 1 + s.overlap * 0.3;
|
|
1453
|
+
M /= C, T /= C;
|
|
1454
1454
|
const K = p ? this.random(m, b) : 1, X = H * K, B = l * X;
|
|
1455
|
-
let Z = x.x +
|
|
1455
|
+
let Z = x.x + M, W = x.y + T;
|
|
1456
1456
|
const tt = B * 1.5 / 2, q = B / 2;
|
|
1457
1457
|
Z = Math.max(h + tt, Math.min(Z, a - h - tt)), W = Math.max(h + q, Math.min(W, r - h - q));
|
|
1458
|
-
const et = u === "random" ? this.random(c, d) : 0,
|
|
1458
|
+
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
1459
|
o.push({
|
|
1460
1460
|
id: v,
|
|
1461
1461
|
x: Z,
|
|
@@ -1541,18 +1541,18 @@ class xe {
|
|
|
1541
1541
|
* @returns Array of layout objects with position, rotation, scale
|
|
1542
1542
|
*/
|
|
1543
1543
|
generate(t, e, i = {}) {
|
|
1544
|
-
var
|
|
1545
|
-
const o = [], { width: a, height: r } = e, s = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, l = ((
|
|
1544
|
+
var C, H, K, X, B, Z, W, Q, tt;
|
|
1545
|
+
const o = [], { width: a, height: r } = e, s = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, l = ((C = this.imageConfig.rotation) == null ? void 0 : C.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
1546
|
...jt,
|
|
1547
1547
|
...this.config.wave
|
|
1548
|
-
}, { rows: f, amplitude: y, frequency: v, phaseShift: I, synchronization: R } = g, w = Math.ceil(t / f), P = p * 1.5 / 2, D = h + P, U = a - h - P,
|
|
1548
|
+
}, { rows: f, amplitude: y, frequency: v, phaseShift: I, synchronization: R } = 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
1549
|
let T = 0;
|
|
1550
1550
|
for (let q = 0; q < f && T < t; q++) {
|
|
1551
|
-
const et = f === 1 ? (x + A) / 2 : x + q *
|
|
1551
|
+
const et = f === 1 ? (x + A) / 2 : x + q * M;
|
|
1552
1552
|
let Y = 0;
|
|
1553
1553
|
R === "offset" ? Y = q * I : R === "alternating" && (Y = q * Math.PI);
|
|
1554
|
-
for (let
|
|
1555
|
-
const $ = w === 1 ? (D + U) / 2 : D +
|
|
1554
|
+
for (let L = 0; L < w && T < t; L++) {
|
|
1555
|
+
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
1556
|
let ot = 0;
|
|
1557
1557
|
l === "tangent" ? ot = this.calculateRotation($, a, y, v, Y) : l === "random" && (ot = this.random(u, c));
|
|
1558
1558
|
const at = nt * 1.5 / 2, bt = nt / 2, dt = h + at, ut = a - h - at, yt = h + bt, vt = r - h - bt;
|
|
@@ -2271,7 +2271,7 @@ class Re {
|
|
|
2271
2271
|
), this.state = E.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
|
|
2272
2272
|
}
|
|
2273
2273
|
}
|
|
2274
|
-
const Ae = 50,
|
|
2274
|
+
const Ae = 50, Ce = 0.5, Me = 20, ze = 0.3, Le = 150, Fe = 30, mt = class mt {
|
|
2275
2275
|
constructor(t, e) {
|
|
2276
2276
|
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
2277
|
}
|
|
@@ -2319,7 +2319,7 @@ const Ae = 50, Me = 0.5, Ce = 20, ze = 0.3, Fe = 150, Le = 30, mt = class mt {
|
|
|
2319
2319
|
const e = t.touches[0], i = e.clientX - this.touchState.startX, o = e.clientY - this.touchState.startY;
|
|
2320
2320
|
if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + o * o) > 10) {
|
|
2321
2321
|
const s = Math.atan2(Math.abs(o), Math.abs(i)) * (180 / Math.PI);
|
|
2322
|
-
this.touchState.isHorizontalSwipe = s <=
|
|
2322
|
+
this.touchState.isHorizontalSwipe = s <= Fe;
|
|
2323
2323
|
}
|
|
2324
2324
|
if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
|
|
2325
2325
|
t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
|
|
@@ -2332,7 +2332,7 @@ const Ae = 50, Me = 0.5, Ce = 20, ze = 0.3, Fe = 150, Le = 30, mt = class mt {
|
|
|
2332
2332
|
this.recentTouchTimestamp = Date.now();
|
|
2333
2333
|
const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, o = Math.abs(e) / i, a = Math.abs(e);
|
|
2334
2334
|
let r = !1;
|
|
2335
|
-
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= Ae || o >=
|
|
2335
|
+
this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= Ae || o >= Ce && a >= Me) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
|
|
2336
2336
|
}
|
|
2337
2337
|
handleTouchCancel(t) {
|
|
2338
2338
|
var e;
|
|
@@ -2888,7 +2888,7 @@ function _e() {
|
|
|
2888
2888
|
class He {
|
|
2889
2889
|
constructor(t = {}) {
|
|
2890
2890
|
var i, o, a, r, s, h;
|
|
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.animationEngine = new te(this.fullConfig.animation), this.layoutEngine = new Se({
|
|
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 Se({
|
|
2892
2892
|
layout: this.fullConfig.layout,
|
|
2893
2893
|
image: this.fullConfig.image
|
|
2894
2894
|
}), this.zoomEngine = new Re(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = ft((i = this.fullConfig.styling) == null ? void 0 : i.default), this.hoverStyles = ft((o = this.fullConfig.styling) == null ? void 0 : o.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;
|
|
@@ -2959,7 +2959,7 @@ class He {
|
|
|
2959
2959
|
onPrev: () => this.navigateToPreviousImage(),
|
|
2960
2960
|
onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
|
|
2961
2961
|
onDragEnd: (t) => {
|
|
2962
|
-
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0,
|
|
2962
|
+
t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Le);
|
|
2963
2963
|
}
|
|
2964
2964
|
}), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
|
|
2965
2965
|
} catch (t) {
|
|
@@ -2967,7 +2967,23 @@ class He {
|
|
|
2967
2967
|
}
|
|
2968
2968
|
}
|
|
2969
2969
|
setupUI() {
|
|
2970
|
-
|
|
2970
|
+
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);
|
|
2972
|
+
}
|
|
2973
|
+
resolveElement(t) {
|
|
2974
|
+
return t instanceof HTMLElement ? t : document.getElementById(t);
|
|
2975
|
+
}
|
|
2976
|
+
createDefaultLoadingElement() {
|
|
2977
|
+
const t = document.createElement("div");
|
|
2978
|
+
t.className = "fbn-ic-loading fbn-ic-hidden";
|
|
2979
|
+
const e = document.createElement("div");
|
|
2980
|
+
e.className = "fbn-ic-spinner", t.appendChild(e);
|
|
2981
|
+
const i = document.createElement("p");
|
|
2982
|
+
return i.textContent = "Loading images...", t.appendChild(i), this.containerEl.appendChild(t), t;
|
|
2983
|
+
}
|
|
2984
|
+
createDefaultErrorElement() {
|
|
2985
|
+
const t = document.createElement("div");
|
|
2986
|
+
return t.className = "fbn-ic-error fbn-ic-hidden", this.containerEl.appendChild(t), t;
|
|
2971
2987
|
}
|
|
2972
2988
|
setupEventListeners() {
|
|
2973
2989
|
document.addEventListener("keydown", (t) => {
|
|
@@ -3164,7 +3180,7 @@ class He {
|
|
|
3164
3180
|
d.scale,
|
|
3165
3181
|
g,
|
|
3166
3182
|
e
|
|
3167
|
-
),
|
|
3183
|
+
), F = this.entryAnimationEngine.buildStartTransform(
|
|
3168
3184
|
v,
|
|
3169
3185
|
f,
|
|
3170
3186
|
d.rotation,
|
|
@@ -3182,7 +3198,7 @@ class He {
|
|
|
3182
3198
|
finalTransform: w,
|
|
3183
3199
|
renderedWidth: g,
|
|
3184
3200
|
renderedHeight: e
|
|
3185
|
-
}), c.style.transform =
|
|
3201
|
+
}), c.style.transform = F, c.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || I !== d.rotation || R !== 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(R)), this.displayQueue.push(c);
|
|
3186
3202
|
}, c.onerror = () => r++, c.src = l;
|
|
3187
3203
|
});
|
|
3188
3204
|
}
|
|
@@ -3204,7 +3220,7 @@ class He {
|
|
|
3204
3220
|
* Clear the image cloud and reset state
|
|
3205
3221
|
*/
|
|
3206
3222
|
clearImageCloud() {
|
|
3207
|
-
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl &&
|
|
3223
|
+
this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.imagesLoaded = !1;
|
|
3208
3224
|
}
|
|
3209
3225
|
showLoading(t) {
|
|
3210
3226
|
!this.fullConfig.rendering.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
|
|
@@ -3220,18 +3236,18 @@ class He {
|
|
|
3220
3236
|
*/
|
|
3221
3237
|
destroy() {
|
|
3222
3238
|
var t;
|
|
3223
|
-
this.clearImageCloud(), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), (t = this.swipeEngine) == null || t.destroy();
|
|
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();
|
|
3224
3240
|
}
|
|
3225
3241
|
}
|
|
3226
|
-
function
|
|
3242
|
+
function Ne() {
|
|
3227
3243
|
if (typeof document > "u") return;
|
|
3228
3244
|
const n = "fbn-ic-styles";
|
|
3229
3245
|
if (document.getElementById(n)) return;
|
|
3230
3246
|
const t = document.createElement("style");
|
|
3231
|
-
t.id = n, t.textContent =
|
|
3247
|
+
t.id = n, t.textContent = kt, document.head.appendChild(t);
|
|
3232
3248
|
}
|
|
3233
|
-
|
|
3234
|
-
function
|
|
3249
|
+
Ne();
|
|
3250
|
+
function ke() {
|
|
3235
3251
|
if (typeof document > "u") {
|
|
3236
3252
|
console.warn("ImageCloud: Document not available (not in browser environment)");
|
|
3237
3253
|
return;
|
|
@@ -3268,10 +3284,10 @@ function Ne() {
|
|
|
3268
3284
|
};
|
|
3269
3285
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", n) : n();
|
|
3270
3286
|
}
|
|
3271
|
-
|
|
3287
|
+
ke();
|
|
3272
3288
|
export {
|
|
3273
3289
|
He as ImageCloud,
|
|
3274
3290
|
He as ImageGallery,
|
|
3275
|
-
|
|
3291
|
+
ke as autoInitialize
|
|
3276
3292
|
};
|
|
3277
3293
|
//# sourceMappingURL=image-cloud-auto-init.js.map
|