@frybynite/image-cloud 0.11.3 → 1.0.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/dist/index.d.ts CHANGED
@@ -864,6 +864,7 @@ export declare class ImageCloud {
864
864
  private counterElAutoCreated;
865
865
  private prevButtonEl;
866
866
  private nextButtonEl;
867
+ private ariaLiveEl;
867
868
  private prevButtonElAutoCreated;
868
869
  private nextButtonElAutoCreated;
869
870
  constructor(options?: ImageCloudOptions);
@@ -891,6 +892,7 @@ export declare class ImageCloud {
891
892
  private createDefaultCounterElement;
892
893
  private createDefaultPrevButtonElement;
893
894
  private createDefaultNextButtonElement;
895
+ private getImageAlt;
894
896
  private setupEventListeners;
895
897
  /**
896
898
  * Navigate to the next image (Right arrow)
package/dist/react.d.ts CHANGED
@@ -864,6 +864,7 @@ export declare class ImageCloud {
864
864
  private counterElAutoCreated;
865
865
  private prevButtonEl;
866
866
  private nextButtonEl;
867
+ private ariaLiveEl;
867
868
  private prevButtonElAutoCreated;
868
869
  private nextButtonElAutoCreated;
869
870
  constructor(options?: ImageCloudOptions);
@@ -891,6 +892,7 @@ export declare class ImageCloud {
891
892
  private createDefaultCounterElement;
892
893
  private createDefaultPrevButtonElement;
893
894
  private createDefaultNextButtonElement;
895
+ private getImageAlt;
894
896
  private setupEventListeners;
895
897
  /**
896
898
  * Navigate to the next image (Right arrow)
package/dist/react.js CHANGED
@@ -24,7 +24,7 @@ const mt = Object.freeze({
24
24
  type: "linear"
25
25
  }), vt = Object.freeze({
26
26
  mode: "none"
27
- }), xt = Object.freeze({
27
+ }), Et = Object.freeze({
28
28
  mode: "none"
29
29
  }), Mt = Object.freeze({
30
30
  default: Object.freeze({
@@ -159,7 +159,7 @@ const mt = Object.freeze({
159
159
  // smooth deceleration
160
160
  path: yt,
161
161
  rotation: vt,
162
- scale: xt
162
+ scale: Et
163
163
  }),
164
164
  idle: $t
165
165
  }),
@@ -280,7 +280,7 @@ function ee(o = {}) {
280
280
  timing: o.animation.entry.timing ? { ...L.animation.entry.timing, ...o.animation.entry.timing } : L.animation.entry.timing,
281
281
  path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : L.animation.entry.path,
282
282
  rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : L.animation.entry.rotation,
283
- scale: o.animation.entry.scale ? { ...xt, ...o.animation.entry.scale } : L.animation.entry.scale
283
+ scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : L.animation.entry.scale
284
284
  }), o.animation.idle && (s.animation.idle = {
285
285
  ...$t,
286
286
  ...o.animation.idle
@@ -579,14 +579,14 @@ function fe(o) {
579
579
  startRotation: p,
580
580
  scaleConfig: w,
581
581
  startScale: v
582
- } = o, l = n.type, g = p !== void 0 && p !== c, h = m?.mode === "wobble", b = m?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, I = g || h, y = v !== void 0 && v !== d, x = w?.mode === "pop", E = w?.pop || { overshoot: 1.2, bounces: 1 };
583
- if (l === "linear" && !I && !(y || x)) {
582
+ } = o, l = n.type, g = p !== void 0 && p !== c, h = m?.mode === "wobble", b = m?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, I = g || h, y = v !== void 0 && v !== d, E = w?.mode === "pop", x = w?.pop || { overshoot: 1.2, bounces: 1 };
583
+ if (l === "linear" && !I && !(y || E)) {
584
584
  u && u();
585
585
  return;
586
586
  }
587
587
  const R = performance.now(), M = -r / 2, T = -a / 2;
588
- function z(k) {
589
- const D = k - R, O = Math.min(D / s, 1);
588
+ function z(_) {
589
+ const D = _ - R, O = Math.min(D / s, 1);
590
590
  let S;
591
591
  switch (l) {
592
592
  case "bounce": {
@@ -619,11 +619,11 @@ function fe(o) {
619
619
  y: J(i.y, e.y, O)
620
620
  };
621
621
  }
622
- const _ = S.x - e.x, $ = S.y - e.y;
622
+ const U = S.x - e.x, k = S.y - e.y;
623
623
  let A;
624
624
  h ? A = de(O, c, b) : g ? A = J(p, c, O) : A = c;
625
625
  let j;
626
- x ? j = ue(O, d, E) : y ? j = J(v, d, O) : j = d, t.style.transform = `translate(${M}px, ${T}px) translate(${_}px, ${$}px) rotate(${A}deg) scale(${j})`, f && O < 1 && f(O, D, {
626
+ E ? j = ue(O, d, x) : y ? j = J(v, d, O) : j = d, t.style.transform = `translate(${M}px, ${T}px) translate(${U}px, ${k}px) rotate(${A}deg) scale(${j})`, f && O < 1 && f(O, D, {
627
627
  x: S.x,
628
628
  y: S.y,
629
629
  rotation: A,
@@ -646,7 +646,7 @@ const me = {
646
646
  };
647
647
  class pe {
648
648
  constructor(t, i) {
649
- this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || xt;
649
+ this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || Et;
650
650
  }
651
651
  /**
652
652
  * Get the effective start position, considering layout-aware defaults
@@ -1187,10 +1187,10 @@ class ye {
1187
1187
  */
1188
1188
  generate(t, i, e = {}) {
1189
1189
  const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, l = c * 1.5 / 2, g = c / 2, h = s - a - l, b = r - a - g, I = a + l, y = a + g;
1190
- for (let x = 0; x < t; x++) {
1191
- const E = this.random(I, h), F = this.random(y, b), R = d === "random" ? this.random(u, f) : 0, M = w ? this.random(m, p) : 1, T = c * M, z = {
1192
- id: x,
1193
- x: E,
1190
+ for (let E = 0; E < t; E++) {
1191
+ const x = this.random(I, h), F = this.random(y, b), R = d === "random" ? this.random(u, f) : 0, M = w ? this.random(m, p) : 1, T = c * M, z = {
1192
+ id: E,
1193
+ x,
1194
1194
  y: F,
1195
1195
  rotation: R,
1196
1196
  scale: M,
@@ -1243,32 +1243,32 @@ class ve {
1243
1243
  // Center image is highest
1244
1244
  });
1245
1245
  }
1246
- let x = 1, E = 1;
1247
- for (; x < t; ) {
1248
- const F = E / b, R = w > 0 ? 1 - F * w * 0.5 : 1, M = Math.max(l * 0.8, y / b * 1.5 / v.tightness), T = E * M, z = T * 1.5, k = Math.PI * (3 * (z + T) - Math.sqrt((3 * z + T) * (z + 3 * T))), D = this.estimateWidth(l), O = Math.floor(k / (D * 0.7));
1246
+ let E = 1, x = 1;
1247
+ for (; E < t; ) {
1248
+ const F = x / b, R = w > 0 ? 1 - F * w * 0.5 : 1, M = Math.max(l * 0.8, y / b * 1.5 / v.tightness), T = x * M, z = T * 1.5, _ = Math.PI * (3 * (z + T) - Math.sqrt((3 * z + T) * (z + 3 * T))), D = this.estimateWidth(l), O = Math.floor(_ / (D * 0.7));
1249
1249
  if (O === 0) {
1250
- E++;
1250
+ x++;
1251
1251
  continue;
1252
1252
  }
1253
- const S = 2 * Math.PI / O, _ = E * (20 * Math.PI / 180);
1254
- for (let $ = 0; $ < O && x < t; $++) {
1255
- const A = $ * S + _, j = p ? this.random(f, m) : 1, N = R * j, P = l * N;
1256
- let H = g + Math.cos(A) * z, U = h + Math.sin(A) * T;
1257
- const B = P * 1.5 / 2, W = P / 2;
1258
- H - B < I ? H = I + B : H + B > s - I && (H = s - I - B), U - W < I ? U = I + W : U + W > r - I && (U = r - I - W);
1253
+ const S = 2 * Math.PI / O, U = x * (20 * Math.PI / 180);
1254
+ for (let k = 0; k < O && E < t; k++) {
1255
+ const A = k * S + U, j = p ? this.random(f, m) : 1, N = R * j, $ = l * N;
1256
+ let H = g + Math.cos(A) * z, P = h + Math.sin(A) * T;
1257
+ const B = $ * 1.5 / 2, W = $ / 2;
1258
+ H - B < I ? H = I + B : H + B > s - I && (H = s - I - B), P - W < I ? P = I + W : P + W > r - I && (P = r - I - W);
1259
1259
  const X = c === "random" ? this.random(d, u) : 0;
1260
1260
  n.push({
1261
- id: x,
1261
+ id: E,
1262
1262
  x: H,
1263
- y: U,
1263
+ y: P,
1264
1264
  rotation: X,
1265
1265
  scale: N,
1266
- baseSize: P,
1267
- zIndex: Math.max(1, 100 - E)
1266
+ baseSize: $,
1267
+ zIndex: Math.max(1, 100 - x)
1268
1268
  // Outer rings have lower z-index
1269
- }), x++;
1269
+ }), E++;
1270
1270
  }
1271
- E++;
1271
+ x++;
1272
1272
  }
1273
1273
  return n;
1274
1274
  }
@@ -1291,7 +1291,7 @@ class ve {
1291
1291
  return Math.random() * (i - t) + t;
1292
1292
  }
1293
1293
  }
1294
- const xe = {
1294
+ const Ee = {
1295
1295
  columns: "auto",
1296
1296
  rows: "auto",
1297
1297
  stagger: "none",
@@ -1319,7 +1319,7 @@ const xe = {
1319
1319
  { x: 0, y: 1 }
1320
1320
  // down
1321
1321
  ];
1322
- class Ee {
1322
+ class xe {
1323
1323
  constructor(t, i = {}) {
1324
1324
  this.config = t, this.imageConfig = i;
1325
1325
  }
@@ -1331,47 +1331,36 @@ class Ee {
1331
1331
  * @returns Array of layout objects with position, rotation, scale
1332
1332
  */
1333
1333
  generate(t, i, e = {}) {
1334
- const n = [], { width: s, height: r } = i, a = { ...xe, ...this.config.grid }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = s - 2 * c, v = r - 2 * c, { columns: l, rows: g } = this.calculateGridDimensions(
1334
+ const n = [], { width: s, height: r } = i, a = { ...Ee, ...this.config.grid }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = s - 2 * c, v = r - 2 * c, { columns: l, rows: g } = this.calculateGridDimensions(
1335
1335
  t,
1336
1336
  w,
1337
1337
  v,
1338
1338
  d,
1339
1339
  a
1340
- ), h = a.stagger === "row", b = a.stagger === "column", I = h ? l + 0.5 : l, y = b ? g + 0.5 : g, x = (w - a.gap * (l - 1)) / I, E = (v - a.gap * (g - 1)) / y, F = h ? x / 2 : 0, R = b ? E / 2 : 0, M = 1 + a.overlap, T = Math.min(x, E) * M, z = e.fixedHeight ? Math.min(e.fixedHeight, T) : T, k = l * x + (l - 1) * a.gap + F, D = g * E + (g - 1) * a.gap + R, O = c + (w - k) / 2, S = c + (v - D) / 2, _ = l * g, $ = a.columns !== "auto" && a.rows !== "auto", A = $ && t > _;
1341
- typeof window < "u" && (window.__gridOverflowDebug = {
1342
- gridConfigColumns: a.columns,
1343
- gridConfigRows: a.rows,
1344
- columns: l,
1345
- rows: g,
1346
- cellCount: _,
1347
- hasFixedGrid: $,
1348
- imageCount: t,
1349
- isOverflowMode: A
1350
- });
1351
- const j = A ? new Array(_).fill(0) : [], N = Math.min(x, E) * a.overflowOffset;
1352
- for (let P = 0; P < t; P++) {
1353
- let H, U, Y = 0;
1354
- if (A && P >= _) {
1355
- const q = P - _, G = q % _;
1356
- Y = Math.floor(q / _) + 1, j[G]++, a.fillDirection === "row" ? (H = G % l, U = Math.floor(G / l)) : (U = G % g, H = Math.floor(G / g));
1340
+ ), h = a.stagger === "row", b = a.stagger === "column", I = h ? l + 0.5 : l, y = b ? g + 0.5 : g, E = (w - a.gap * (l - 1)) / I, x = (v - a.gap * (g - 1)) / y, F = h ? E / 2 : 0, R = b ? x / 2 : 0, M = 1 + a.overlap, T = Math.min(E, x) * M, z = e.fixedHeight ? Math.min(e.fixedHeight, T) : T, _ = l * E + (l - 1) * a.gap + F, D = g * x + (g - 1) * a.gap + R, O = c + (w - _) / 2, S = c + (v - D) / 2, U = l * g, A = a.columns !== "auto" && a.rows !== "auto" && t > U, j = A ? new Array(U).fill(0) : [], N = Math.min(E, x) * a.overflowOffset;
1341
+ for (let $ = 0; $ < t; $++) {
1342
+ let H, P, Y = 0;
1343
+ if (A && $ >= U) {
1344
+ const q = $ - U, G = q % U;
1345
+ Y = Math.floor(q / U) + 1, j[G]++, a.fillDirection === "row" ? (H = G % l, P = Math.floor(G / l)) : (P = G % g, H = Math.floor(G / g));
1357
1346
  } else
1358
- a.fillDirection === "row" ? (H = P % l, U = Math.floor(P / l)) : (U = P % g, H = Math.floor(P / g));
1359
- let B = O + H * (x + a.gap) + x / 2, W = S + U * (E + a.gap) + E / 2;
1360
- if (a.stagger === "row" && U % 2 === 1 ? B += x / 2 : a.stagger === "column" && H % 2 === 1 && (W += E / 2), Y > 0) {
1347
+ a.fillDirection === "row" ? (H = $ % l, P = Math.floor($ / l)) : (P = $ % g, H = Math.floor($ / g));
1348
+ let B = O + H * (E + a.gap) + E / 2, W = S + P * (x + a.gap) + x / 2;
1349
+ if (a.stagger === "row" && P % 2 === 1 ? B += E / 2 : a.stagger === "column" && H % 2 === 1 && (W += x / 2), Y > 0) {
1361
1350
  const q = (Y - 1) % At.length, G = At[q];
1362
1351
  B += G.x * N, W += G.y * N;
1363
1352
  }
1364
1353
  if (a.jitter > 0) {
1365
- const q = x / 2 * a.jitter, G = E / 2 * a.jitter;
1354
+ const q = E / 2 * a.jitter, G = x / 2 * a.jitter;
1366
1355
  B += this.random(-q, q), W += this.random(-G, G);
1367
1356
  }
1368
1357
  let X = B, V = W;
1369
1358
  if (!A && a.fillDirection === "row") {
1370
1359
  const q = t % l || l;
1371
- if (U === Math.floor((t - 1) / l) && q < l) {
1372
- const It = q * x + (q - 1) * a.gap;
1360
+ if (P === Math.floor((t - 1) / l) && q < l) {
1361
+ const It = q * E + (q - 1) * a.gap;
1373
1362
  let gt = 0;
1374
- a.alignment === "center" ? gt = (k - It) / 2 : a.alignment === "end" && (gt = k - It), X += gt;
1363
+ a.alignment === "center" ? gt = (_ - It) / 2 : a.alignment === "end" && (gt = _ - It), X += gt;
1375
1364
  }
1376
1365
  }
1377
1366
  const ct = p ? this.random(f, m) : 1, K = z * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, _t = c + ot, Ut = r - c - ot;
@@ -1382,8 +1371,8 @@ class Ee {
1382
1371
  a.jitter > 0 ? ut = this.random(q * a.jitter, G * a.jitter) : ut = this.random(q, G);
1383
1372
  }
1384
1373
  let ft;
1385
- A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + P : P + 1, n.push({
1386
- id: P,
1374
+ A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + $ : $ + 1, n.push({
1375
+ id: $,
1387
1376
  x: X,
1388
1377
  y: V,
1389
1378
  rotation: ut,
@@ -1443,29 +1432,29 @@ class Se {
1443
1432
  h - c - d / 2
1444
1433
  ), I = a.direction === "clockwise" ? -1 : 1;
1445
1434
  for (let y = 0; y < t; y++) {
1446
- let x, E;
1435
+ let E, x;
1447
1436
  if (a.spiralType === "golden")
1448
- x = y * we * I + a.startAngle, E = this.calculateGoldenRadius(y, t, b, a.tightness);
1437
+ E = y * we * I + a.startAngle, x = this.calculateGoldenRadius(y, t, b, a.tightness);
1449
1438
  else if (a.spiralType === "archimedean") {
1450
1439
  const B = y * 0.5 * a.tightness;
1451
- x = B * I + a.startAngle, E = this.calculateArchimedeanRadius(B, t, b, a.tightness);
1440
+ E = B * I + a.startAngle, x = this.calculateArchimedeanRadius(B, t, b, a.tightness);
1452
1441
  } else {
1453
1442
  const B = y * 0.3 * a.tightness;
1454
- x = B * I + a.startAngle, E = this.calculateLogarithmicRadius(B, t, b, a.tightness);
1443
+ E = B * I + a.startAngle, x = this.calculateLogarithmicRadius(B, t, b, a.tightness);
1455
1444
  }
1456
- const F = g + Math.cos(x) * E, R = h + Math.sin(x) * E, M = E / b, T = l > 0 ? 1 - M * l * 0.5 : 1, z = v ? this.random(p, w) : 1, k = T * z, D = d * k, S = D * 1.5 / 2, _ = D / 2, $ = c + S, A = s - c - S, j = c + _, N = r - c - _, P = Math.max($, Math.min(F, A)), H = Math.max(j, Math.min(R, N));
1457
- let U = 0;
1445
+ const F = g + Math.cos(E) * x, R = h + Math.sin(E) * x, M = x / b, T = l > 0 ? 1 - M * l * 0.5 : 1, z = v ? this.random(p, w) : 1, _ = T * z, D = d * _, S = D * 1.5 / 2, U = D / 2, k = c + S, A = s - c - S, j = c + U, N = r - c - U, $ = Math.max(k, Math.min(F, A)), H = Math.max(j, Math.min(R, N));
1446
+ let P = 0;
1458
1447
  if (u === "random") {
1459
- const B = x * 180 / Math.PI % 360, W = this.random(f, m);
1460
- U = a.spiralType === "golden" ? W : B * 0.1 + W * 0.9;
1461
- } else u === "tangent" && (U = this.calculateSpiralTangent(x, E, a));
1448
+ const B = E * 180 / Math.PI % 360, W = this.random(f, m);
1449
+ P = a.spiralType === "golden" ? W : B * 0.1 + W * 0.9;
1450
+ } else u === "tangent" && (P = this.calculateSpiralTangent(E, x, a));
1462
1451
  const Y = t - y;
1463
1452
  n.push({
1464
1453
  id: y,
1465
- x: P,
1454
+ x: $,
1466
1455
  y: H,
1467
- rotation: U,
1468
- scale: k,
1456
+ rotation: P,
1457
+ scale: _,
1469
1458
  baseSize: D,
1470
1459
  zIndex: Y
1471
1460
  });
@@ -1557,28 +1546,28 @@ class Re {
1557
1546
  h[I % l]++;
1558
1547
  let b = 0;
1559
1548
  for (let I = 0; I < l; I++) {
1560
- const y = g[I], x = h[I];
1561
- for (let E = 0; E < x; E++) {
1549
+ const y = g[I], E = h[I];
1550
+ for (let x = 0; x < E; x++) {
1562
1551
  let F, R;
1563
1552
  if (a.distribution === "gaussian")
1564
1553
  F = this.gaussianRandom() * y.spread, R = this.gaussianRandom() * y.spread;
1565
1554
  else {
1566
- const U = this.random(0, Math.PI * 2), Y = this.random(0, y.spread);
1567
- F = Math.cos(U) * Y, R = Math.sin(U) * Y;
1555
+ const P = this.random(0, Math.PI * 2), Y = this.random(0, y.spread);
1556
+ F = Math.cos(P) * Y, R = Math.sin(P) * Y;
1568
1557
  }
1569
1558
  const M = 1 + a.overlap * 0.5, T = 1 + a.overlap * 0.3;
1570
1559
  F /= M, R /= M;
1571
- const z = v ? this.random(p, w) : 1, k = T * z, D = d * k;
1560
+ const z = v ? this.random(p, w) : 1, _ = T * z, D = d * _;
1572
1561
  let O = y.x + F, S = y.y + R;
1573
- const $ = D * 1.5 / 2, A = D / 2;
1574
- O = Math.max(c + $, Math.min(O, s - c - $)), S = Math.max(c + A, Math.min(S, r - c - A));
1575
- const j = u === "random" ? this.random(f, m) : 0, P = Math.sqrt(F * F + R * R) / y.spread, H = Math.round((1 - P) * 50) + 1;
1562
+ const k = D * 1.5 / 2, A = D / 2;
1563
+ O = Math.max(c + k, Math.min(O, s - c - k)), S = Math.max(c + A, Math.min(S, r - c - A));
1564
+ const j = u === "random" ? this.random(f, m) : 0, $ = Math.sqrt(F * F + R * R) / y.spread, H = Math.round((1 - $) * 50) + 1;
1576
1565
  n.push({
1577
1566
  id: b,
1578
1567
  x: O,
1579
1568
  y: S,
1580
1569
  rotation: j,
1581
- scale: k,
1570
+ scale: _,
1582
1571
  baseSize: D,
1583
1572
  zIndex: H
1584
1573
  }), b++;
@@ -1661,26 +1650,26 @@ class Te {
1661
1650
  const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, v = e.fixedHeight ?? a, l = {
1662
1651
  ...Wt,
1663
1652
  ...this.config.wave
1664
- }, { rows: g, amplitude: h, frequency: b, phaseShift: I, synchronization: y } = l, x = Math.ceil(t / g), R = v * 1.5 / 2, M = c + R, T = s - c - R, z = T - M, k = x > 1 ? z / (x - 1) : 0, D = c + h + v / 2, O = r - c - h - v / 2, S = O - D, _ = g > 1 ? S / (g - 1) : 0;
1665
- let $ = 0;
1666
- for (let A = 0; A < g && $ < t; A++) {
1667
- const j = g === 1 ? (D + O) / 2 : D + A * _;
1653
+ }, { rows: g, amplitude: h, frequency: b, phaseShift: I, synchronization: y } = l, E = Math.ceil(t / g), R = v * 1.5 / 2, M = c + R, T = s - c - R, z = T - M, _ = E > 1 ? z / (E - 1) : 0, D = c + h + v / 2, O = r - c - h - v / 2, S = O - D, U = g > 1 ? S / (g - 1) : 0;
1654
+ let k = 0;
1655
+ for (let A = 0; A < g && k < t; A++) {
1656
+ const j = g === 1 ? (D + O) / 2 : D + A * U;
1668
1657
  let N = 0;
1669
1658
  y === "offset" ? N = A * I : y === "alternating" && (N = A * Math.PI);
1670
- for (let P = 0; P < x && $ < t; P++) {
1671
- const H = x === 1 ? (M + T) / 2 : M + P * k, U = this.calculateWaveY(H, s, h, b, N), Y = H, B = j + U, W = w ? this.random(m, p) : 1, X = v * W;
1659
+ for (let $ = 0; $ < E && k < t; $++) {
1660
+ const H = E === 1 ? (M + T) / 2 : M + $ * _, P = this.calculateWaveY(H, s, h, b, N), Y = H, B = j + P, W = w ? this.random(m, p) : 1, X = v * W;
1672
1661
  let V = 0;
1673
1662
  d === "tangent" ? V = this.calculateRotation(H, s, h, b, N) : d === "random" && (V = this.random(u, f));
1674
1663
  const K = X * 1.5 / 2, lt = X / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1675
1664
  n.push({
1676
- id: $,
1665
+ id: k,
1677
1666
  x: Math.max(nt, Math.min(Y, ot)),
1678
1667
  y: Math.max(ht, Math.min(B, dt)),
1679
1668
  rotation: V,
1680
1669
  scale: W,
1681
1670
  baseSize: X,
1682
- zIndex: $ + 1
1683
- }), $++;
1671
+ zIndex: k + 1
1672
+ }), k++;
1684
1673
  }
1685
1674
  }
1686
1675
  return n;
@@ -1723,7 +1712,7 @@ class Te {
1723
1712
  return Math.random() * (i - t) + t;
1724
1713
  }
1725
1714
  }
1726
- const Et = 100, Q = 100 / Math.sqrt(3), wt = [
1715
+ const xt = 100, Q = 100 / Math.sqrt(3), wt = [
1727
1716
  [Q / 2, 0],
1728
1717
  // upper-left
1729
1718
  [3 * Q / 2, 0],
@@ -1736,7 +1725,7 @@ const Et = 100, Q = 100 / Math.sqrt(3), wt = [
1736
1725
  // lower-left
1737
1726
  [0, 50]
1738
1727
  // left
1739
- ], Ae = wt[1][0] / Et, Le = wt[2][1] / Et;
1728
+ ], Ae = wt[1][0] / xt, Le = wt[2][1] / xt;
1740
1729
  function Fe(o) {
1741
1730
  return {
1742
1731
  colStep: Ae * o,
@@ -1813,7 +1802,7 @@ class $e {
1813
1802
  case "radial":
1814
1803
  return new ve(this.config, this.imageConfig);
1815
1804
  case "grid":
1816
- return new Ee(this.config, this.imageConfig);
1805
+ return new xe(this.config, this.imageConfig);
1817
1806
  case "spiral":
1818
1807
  return new Se(this.config, this.imageConfig);
1819
1808
  case "cluster":
@@ -1969,7 +1958,7 @@ const Lt = {
1969
1958
  },
1970
1959
  // Hexagon - regular hexagon (reference points imported from hexagonGeometry)
1971
1960
  hexagon: {
1972
- refHeight: Et,
1961
+ refHeight: xt,
1973
1962
  points: wt
1974
1963
  },
1975
1964
  // Octagon - regular octagon
@@ -3223,7 +3212,7 @@ function ei() {
3223
3212
  }
3224
3213
  let ii = class {
3225
3214
  constructor(t = {}) {
3226
- this.fullConfig = ee(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.callbacks = t.on ?? {}, this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new se(this.fullConfig.animation), this.layoutEngine = new $e({
3215
+ this.ariaLiveEl = null, this.fullConfig = ee(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.callbacks = t.on ?? {}, this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new se(this.fullConfig.animation), this.layoutEngine = new $e({
3227
3216
  layout: this.fullConfig.layout,
3228
3217
  image: this.fullConfig.image
3229
3218
  }), this.zoomEngine = new je(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;
@@ -3313,7 +3302,7 @@ let ii = class {
3313
3302
  this.containerEl = this.containerRef;
3314
3303
  else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
3315
3304
  throw new Error(`Container "#${this.containerId}" not found. Ensure an element with id="${this.containerId}" exists in the DOM before calling imageCloud().`);
3316
- this.containerEl.classList.add("fbn-ic-gallery"), this.containerEl.setAttribute("tabindex", "0"), this.fullConfig.interaction.navigation?.swipe !== !1 && (this.swipeEngine = new bt(this.containerEl, {
3305
+ this.containerEl.classList.add("fbn-ic-gallery"), this.containerEl.setAttribute("tabindex", "0"), this.containerEl.setAttribute("role", "region"), this.containerEl.setAttribute("aria-label", "Image gallery"), this.fullConfig.interaction.navigation?.swipe !== !1 && (this.swipeEngine = new bt(this.containerEl, {
3317
3306
  onNext: () => this.navigateToNextImage(),
3318
3307
  onPrev: () => this.navigateToPreviousImage(),
3319
3308
  onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
@@ -3331,7 +3320,7 @@ let ii = class {
3331
3320
  i.stopPropagation(), this.navigateToPreviousImage();
3332
3321
  }), this.nextButtonEl?.addEventListener("click", (i) => {
3333
3322
  i.stopPropagation(), this.navigateToNextImage();
3334
- }));
3323
+ })), this.ariaLiveEl = document.createElement("div"), this.ariaLiveEl.setAttribute("aria-live", "polite"), this.ariaLiveEl.setAttribute("aria-atomic", "true"), this.ariaLiveEl.className = "fbn-ic-sr-only", this.containerEl.appendChild(this.ariaLiveEl);
3335
3324
  }
3336
3325
  resolveElement(t) {
3337
3326
  return t instanceof HTMLElement ? t : document.getElementById(t);
@@ -3354,11 +3343,19 @@ let ii = class {
3354
3343
  }
3355
3344
  createDefaultPrevButtonElement() {
3356
3345
  const t = document.createElement("button");
3357
- return t.className = "fbn-ic-nav-btn fbn-ic-nav-btn-prev fbn-ic-hidden", t.textContent = "‹", t.setAttribute("aria-label", "Previous image"), t.setAttribute("tabindex", "-1"), this.containerEl.appendChild(t), t;
3346
+ return t.className = "fbn-ic-nav-btn fbn-ic-nav-btn-prev fbn-ic-hidden", t.textContent = "‹", t.setAttribute("aria-label", "Previous image"), this.containerEl.appendChild(t), t;
3358
3347
  }
3359
3348
  createDefaultNextButtonElement() {
3360
3349
  const t = document.createElement("button");
3361
- return t.className = "fbn-ic-nav-btn fbn-ic-nav-btn-next fbn-ic-hidden", t.textContent = "›", t.setAttribute("aria-label", "Next image"), t.setAttribute("tabindex", "-1"), this.containerEl.appendChild(t), t;
3350
+ return t.className = "fbn-ic-nav-btn fbn-ic-nav-btn-next fbn-ic-hidden", t.textContent = "›", t.setAttribute("aria-label", "Next image"), this.containerEl.appendChild(t), t;
3351
+ }
3352
+ getImageAlt(t, i) {
3353
+ try {
3354
+ const s = (new URL(t).pathname.split("/").pop() ?? "").replace(/\.[^.]+$/, "").replace(/[-_]/g, " ").trim();
3355
+ return s.length > 0 ? s : `Image ${i + 1}`;
3356
+ } catch {
3357
+ return `Image ${i + 1}`;
3358
+ }
3362
3359
  }
3363
3360
  setupEventListeners() {
3364
3361
  this.fullConfig.interaction.navigation?.keyboard !== !1 && this.containerEl.addEventListener("keydown", (t) => {
@@ -3475,15 +3472,15 @@ let ii = class {
3475
3472
  }, w = (l) => {
3476
3473
  this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(async () => {
3477
3474
  l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1";
3478
- const g = parseInt(l.dataset.imageId || "0"), h = this.imageLayouts[g], b = this.entryAnimationEngine.getTiming(), I = performance.now(), y = parseFloat(l.dataset.startX || "0"), x = parseFloat(l.dataset.startY || "0"), E = parseFloat(l.dataset.endX || "0"), F = parseFloat(l.dataset.endY || "0"), R = parseFloat(l.dataset.rotation || "0"), M = parseFloat(l.dataset.scale || "1"), T = parseFloat(l.dataset.startRotation || l.dataset.rotation || "0"), z = parseFloat(l.dataset.startScale || l.dataset.scale || "1"), k = parseFloat(l.dataset.imageWidth || "0"), D = parseFloat(l.dataset.imageHeight || "0");
3475
+ const g = parseInt(l.dataset.imageId || "0"), h = this.imageLayouts[g], b = this.entryAnimationEngine.getTiming(), I = performance.now(), y = parseFloat(l.dataset.startX || "0"), E = parseFloat(l.dataset.startY || "0"), x = parseFloat(l.dataset.endX || "0"), F = parseFloat(l.dataset.endY || "0"), R = parseFloat(l.dataset.rotation || "0"), M = parseFloat(l.dataset.scale || "1"), T = parseFloat(l.dataset.startRotation || l.dataset.rotation || "0"), z = parseFloat(l.dataset.startScale || l.dataset.scale || "1"), _ = parseFloat(l.dataset.imageWidth || "0"), D = parseFloat(l.dataset.imageHeight || "0");
3479
3476
  if (this.callbacks.onEntryStart && h) {
3480
3477
  const S = {
3481
3478
  element: l,
3482
3479
  index: g,
3483
3480
  totalImages: this.imageLayouts.length,
3484
3481
  layout: h,
3485
- from: { x: y, y: x, rotation: T, scale: z },
3486
- to: { x: E, y: F, rotation: R, scale: M },
3482
+ from: { x: y, y: E, rotation: T, scale: z },
3483
+ to: { x, y: F, rotation: R, scale: M },
3487
3484
  startTime: I,
3488
3485
  duration: b.duration
3489
3486
  };
@@ -3492,11 +3489,11 @@ let ii = class {
3492
3489
  if (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)
3493
3490
  fe({
3494
3491
  element: l,
3495
- startPosition: { x: y, y: x },
3496
- endPosition: { x: E, y: F },
3492
+ startPosition: { x: y, y: E },
3493
+ endPosition: { x, y: F },
3497
3494
  pathConfig: this.entryAnimationEngine.getPathConfig(),
3498
3495
  duration: b.duration,
3499
- imageWidth: k,
3496
+ imageWidth: _,
3500
3497
  imageHeight: D,
3501
3498
  rotation: R,
3502
3499
  scale: M,
@@ -3504,20 +3501,20 @@ let ii = class {
3504
3501
  startRotation: T,
3505
3502
  scaleConfig: this.entryAnimationEngine.getScaleConfig(),
3506
3503
  startScale: z,
3507
- onProgress: this.callbacks.onEntryProgress && h ? (S, _, $) => {
3504
+ onProgress: this.callbacks.onEntryProgress && h ? (S, U, k) => {
3508
3505
  const A = {
3509
3506
  element: l,
3510
3507
  index: g,
3511
3508
  totalImages: this.imageLayouts.length,
3512
3509
  layout: h,
3513
- from: { x: y, y: x, rotation: T, scale: z },
3514
- to: { x: E, y: F, rotation: R, scale: M },
3510
+ from: { x: y, y: E, rotation: T, scale: z },
3511
+ to: { x, y: F, rotation: R, scale: M },
3515
3512
  startTime: I,
3516
3513
  duration: b.duration,
3517
3514
  progress: S,
3518
3515
  rawProgress: S,
3519
- elapsed: _,
3520
- current: $
3516
+ elapsed: U,
3517
+ current: k
3521
3518
  };
3522
3519
  this.callbacks.onEntryProgress(A);
3523
3520
  } : void 0,
@@ -3538,9 +3535,9 @@ let ii = class {
3538
3535
  else {
3539
3536
  const S = l.dataset.finalTransform || "";
3540
3537
  if (l.style.transform = S, this.callbacks.onEntryComplete && h) {
3541
- const _ = ($) => {
3542
- if ($.propertyName !== "transform") return;
3543
- l.removeEventListener("transitionend", _);
3538
+ const U = (k) => {
3539
+ if (k.propertyName !== "transform") return;
3540
+ l.removeEventListener("transitionend", U);
3544
3541
  const A = {
3545
3542
  element: l,
3546
3543
  index: g,
@@ -3551,7 +3548,7 @@ let ii = class {
3551
3548
  };
3552
3549
  this.callbacks.onEntryComplete(A);
3553
3550
  };
3554
- l.addEventListener("transitionend", _);
3551
+ l.addEventListener("transitionend", U);
3555
3552
  }
3556
3553
  }
3557
3554
  if (this.fullConfig.config.debug?.enabled && g < 3) {
@@ -3608,7 +3605,7 @@ let ii = class {
3608
3605
  h.style.left = `${b - 6}px`, h.style.top = `${I - 6}px`, h.title = `Image ${g}: center (${Math.round(b)}, ${Math.round(I)})`, this.containerEl.appendChild(h);
3609
3606
  })), t.forEach((l, g) => {
3610
3607
  const h = document.createElement("img");
3611
- h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(g), h.dataset.createdFlag = "true";
3608
+ h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), h.alt = this.getImageAlt(l, g), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(g);
3612
3609
  const b = s[g];
3613
3610
  h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${b.x}px`, h.style.top = `${b.y}px`, b.zIndex && (h.style.zIndex = String(b.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3614
3611
  if (this.hoveredImage = { element: h, layout: b }, !this.zoomEngine.isInvolved(h)) {
@@ -3633,10 +3630,10 @@ let ii = class {
3633
3630
  }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
3634
3631
  if (n !== this.loadGeneration)
3635
3632
  return;
3636
- const y = h.naturalWidth / h.naturalHeight, x = i * y;
3637
- h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${g}] Called with imageHeight=${i}, renderedWidth=${x}`), h.style.width = `${x}px`, h.cachedRenderedWidth = x, h.aspectRatio = y, st(h, this.fullConfig.styling?.default, i, x);
3638
- const E = { x: b.x, y: b.y }, F = { width: x, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
3639
- E,
3633
+ const y = h.naturalWidth / h.naturalHeight, E = i * y;
3634
+ h.style.width = `${E}px`, h.cachedRenderedWidth = E, h.aspectRatio = y, st(h, this.fullConfig.styling?.default, i, E);
3635
+ const x = { x: b.x, y: b.y }, F = { width: E, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
3636
+ x,
3640
3637
  F,
3641
3638
  e,
3642
3639
  g,
@@ -3644,27 +3641,27 @@ let ii = class {
3644
3641
  ), M = this.entryAnimationEngine.calculateStartRotation(b.rotation), T = this.entryAnimationEngine.calculateStartScale(b.scale), z = this.entryAnimationEngine.buildFinalTransform(
3645
3642
  b.rotation,
3646
3643
  b.scale,
3647
- x,
3644
+ E,
3648
3645
  i
3649
- ), k = this.entryAnimationEngine.buildStartTransform(
3646
+ ), _ = this.entryAnimationEngine.buildStartTransform(
3650
3647
  R,
3651
- E,
3648
+ x,
3652
3649
  b.rotation,
3653
3650
  b.scale,
3654
- x,
3651
+ E,
3655
3652
  i,
3656
3653
  M,
3657
3654
  T
3658
3655
  );
3659
3656
  if (this.fullConfig.config.debug?.enabled && g < 3 && console.log(`Image ${g}:`, {
3660
- finalPosition: E,
3657
+ finalPosition: x,
3661
3658
  imageSize: F,
3662
3659
  left: b.x,
3663
3660
  top: b.y,
3664
3661
  finalTransform: z,
3665
- renderedWidth: x,
3662
+ renderedWidth: E,
3666
3663
  renderedHeight: i
3667
- }), h.style.transform = k, h.dataset.finalTransform = z, h.dataset.startX = String(R.x), h.dataset.startY = String(R.y), h.dataset.endX = String(E.x), h.dataset.endY = String(E.y), h.dataset.imageWidth = String(x), h.dataset.imageHeight = String(i), h.dataset.rotation = String(b.rotation), h.dataset.scale = String(b.scale), h.dataset.startRotation = String(M), h.dataset.startScale = String(T), a++, this.callbacks.onImageLoaded) {
3664
+ }), h.style.transform = _, h.dataset.finalTransform = z, h.dataset.startX = String(R.x), h.dataset.startY = String(R.y), h.dataset.endX = String(x.x), h.dataset.endY = String(x.y), h.dataset.imageWidth = String(E), h.dataset.imageHeight = String(i), h.dataset.rotation = String(b.rotation), h.dataset.scale = String(b.scale), h.dataset.startRotation = String(M), h.dataset.startScale = String(T), a++, this.callbacks.onImageLoaded) {
3668
3665
  const D = {
3669
3666
  element: h,
3670
3667
  url: l,
@@ -3706,22 +3703,22 @@ let ii = class {
3706
3703
  h.onerror = () => I(), (async () => {
3707
3704
  let y = l;
3708
3705
  if (this.callbacks.onBeforeImageLoad) {
3709
- const x = { url: l, index: g, totalImages: t.length }, E = await this.callbacks.onBeforeImageLoad(x);
3710
- if (E)
3711
- if (E.fetch !== void 0) {
3712
- const F = E.url ?? l;
3706
+ const E = { url: l, index: g, totalImages: t.length }, x = await this.callbacks.onBeforeImageLoad(E);
3707
+ if (x)
3708
+ if (x.fetch !== void 0) {
3709
+ const F = x.url ?? l;
3713
3710
  try {
3714
- const M = await (await fetch(F, E.fetch)).blob(), T = URL.createObjectURL(M);
3711
+ const M = await (await fetch(F, x.fetch)).blob(), T = URL.createObjectURL(M);
3715
3712
  y = T;
3716
3713
  const z = h.onload;
3717
- h.onload = (k) => {
3718
- URL.revokeObjectURL(T), z?.call(h, k);
3714
+ h.onload = (_) => {
3715
+ URL.revokeObjectURL(T), z?.call(h, _);
3719
3716
  };
3720
3717
  } catch {
3721
3718
  I();
3722
3719
  return;
3723
3720
  }
3724
- } else E.url && (y = E.url);
3721
+ } else x.url && (y = x.url);
3725
3722
  }
3726
3723
  d === 0 && (d = performance.now()), f.set(g, performance.now()), h.src = y;
3727
3724
  })();
@@ -3734,11 +3731,15 @@ let ii = class {
3734
3731
  height: this.containerEl.offsetHeight
3735
3732
  };
3736
3733
  if (e)
3737
- await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.hideFocusIndicator();
3734
+ await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.ariaLiveEl && (this.ariaLiveEl.textContent = ""), this.hideFocusIndicator();
3738
3735
  else {
3739
3736
  this.idleAnimationEngine?.pauseForImage(t);
3740
3737
  const s = t.dataset.imageId;
3741
- if (this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator(), this.callbacks.onImageFocus && this.currentFocusIndex !== null) {
3738
+ if (this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.ariaLiveEl && this.currentFocusIndex !== null) {
3739
+ const r = t.alt, a = this.imageLayouts.length;
3740
+ this.ariaLiveEl.textContent = `Image ${this.currentFocusIndex + 1} of ${a}: ${r}`;
3741
+ }
3742
+ if (this.showFocusIndicator(), this.callbacks.onImageFocus && this.currentFocusIndex !== null) {
3742
3743
  const r = this.imageLoader.imageURLs(), a = {
3743
3744
  element: t,
3744
3745
  index: this.currentFocusIndex,