@wyxos/vibe 1.6.9 → 1.6.10

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/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { nextTick as J, defineComponent as Le, ref as k, computed as te, onMounted as Se, onUnmounted as Ne, watch as He, createElementBlock as B, openBlock as D, renderSlot as $e, createElementVNode as E, createCommentVNode as X, normalizeClass as Y, toDisplayString as ie, withModifiers as ze, normalizeStyle as Re, createVNode as Te, TransitionGroup as _e, withCtx as Ce, Fragment as qe, renderList as Ve, mergeProps as Ge, unref as Ue } from "vue";
1
+ import { nextTick as J, defineComponent as Le, ref as k, computed as te, onMounted as Se, onUnmounted as Ne, watch as He, createElementBlock as B, openBlock as D, renderSlot as $e, createElementVNode as S, createCommentVNode as X, normalizeClass as Y, toDisplayString as ue, withModifiers as ze, normalizeStyle as Re, createVNode as Te, TransitionGroup as _e, withCtx as Ce, Fragment as qe, renderList as Ve, mergeProps as Ge, unref as Ue } from "vue";
2
2
  let fe = null;
3
3
  function Xe() {
4
4
  if (fe != null) return fe;
@@ -35,28 +35,28 @@ function Ye(e, r, l, s = {}) {
35
35
  }
36
36
  } catch {
37
37
  }
38
- const N = (h || 0) + m, z = (c || 0) + d, $ = r.offsetWidth - r.clientWidth, L = $ > 0 ? $ + 2 : Xe() + 2, i = r.offsetWidth - L - N - z, p = w * (l - 1), M = Math.floor((i - p) / l), I = e.map((P) => {
39
- const H = P.width, S = P.height;
40
- return Math.round(M * S / H) + n + a;
38
+ const N = (h || 0) + m, z = (c || 0) + d, $ = r.offsetWidth - r.clientWidth, E = $ > 0 ? $ + 2 : Xe() + 2, i = r.offsetWidth - E - N - z, g = w * (l - 1), M = Math.floor((i - g) / l), I = e.map((P) => {
39
+ const H = P.width, L = P.height;
40
+ return Math.round(M * L / H) + n + a;
41
41
  });
42
42
  if (T === "sequential-balanced") {
43
43
  const P = I.length;
44
44
  if (P === 0) return [];
45
45
  const H = (x, F, R) => x + (F > 0 ? v : 0) + R;
46
- let S = Math.max(...I), _ = I.reduce((x, F) => x + F, 0) + v * Math.max(0, P - 1);
46
+ let L = Math.max(...I), _ = I.reduce((x, F) => x + F, 0) + v * Math.max(0, P - 1);
47
47
  const ae = (x) => {
48
48
  let F = 1, R = 0, q = 0;
49
- for (let j = 0; j < P; j++) {
50
- const U = I[j], V = H(R, q, U);
49
+ for (let O = 0; O < P; O++) {
50
+ const U = I[O], V = H(R, q, U);
51
51
  if (V <= x)
52
52
  R = V, q++;
53
53
  else if (F++, R = U, q = 1, U > x || F > l) return !1;
54
54
  }
55
55
  return F <= l;
56
56
  };
57
- for (; S < _; ) {
58
- const x = Math.floor((S + _) / 2);
59
- ae(x) ? _ = x : S = x + 1;
57
+ for (; L < _; ) {
58
+ const x = Math.floor((L + _) / 2);
59
+ ae(x) ? _ = x : L = x + 1;
60
60
  }
61
61
  const ne = _, K = new Array(l).fill(0);
62
62
  let oe = l - 1, Q = 0, Z = 0;
@@ -68,23 +68,23 @@ function Ye(e, r, l, s = {}) {
68
68
  const C = [], re = new Array(l).fill(0);
69
69
  for (let x = 0; x < l; x++) {
70
70
  const F = K[x], R = x + 1 < l ? K[x + 1] : P, q = x * (M + w);
71
- for (let j = F; j < R; j++) {
71
+ for (let O = F; O < R; O++) {
72
72
  const V = {
73
- ...e[j],
73
+ ...e[O],
74
74
  columnWidth: M,
75
75
  imageHeight: 0,
76
76
  columnHeight: 0,
77
77
  left: 0,
78
78
  top: 0
79
79
  };
80
- V.imageHeight = I[j] - (n + a), V.columnHeight = I[j], V.left = q, V.top = re[x], re[x] += V.columnHeight + (j + 1 < R ? v : 0), C.push(V);
80
+ V.imageHeight = I[O] - (n + a), V.columnHeight = I[O], V.left = q, V.top = re[x], re[x] += V.columnHeight + (O + 1 < R ? v : 0), C.push(V);
81
81
  }
82
82
  }
83
83
  return C;
84
84
  }
85
85
  const b = new Array(l).fill(0), A = [];
86
86
  for (let P = 0; P < e.length; P++) {
87
- const H = e[P], S = {
87
+ const H = e[P], L = {
88
88
  ...H,
89
89
  columnWidth: 0,
90
90
  imageHeight: 0,
@@ -92,7 +92,7 @@ function Ye(e, r, l, s = {}) {
92
92
  left: 0,
93
93
  top: 0
94
94
  }, _ = b.indexOf(Math.min(...b)), ae = H.width, ne = H.height;
95
- S.columnWidth = M, S.left = _ * (M + w), S.imageHeight = Math.round(M * ne / ae), S.columnHeight = S.imageHeight + n + a, S.top = b[_], b[_] += S.columnHeight + v, A.push(S);
95
+ L.columnWidth = M, L.left = _ * (M + w), L.imageHeight = Math.round(M * ne / ae), L.columnHeight = L.imageHeight + n + a, L.top = b[_], b[_] += L.columnHeight + v, A.push(L);
96
96
  }
97
97
  return A;
98
98
  }
@@ -136,7 +136,7 @@ function me(e) {
136
136
  var r = typeof e;
137
137
  return e != null && (r == "object" || r == "function");
138
138
  }
139
- var Ie = NaN, mt = /^[-+]0x[0-9a-f]+$/i, pt = /^0b[01]+$/i, gt = /^0o[0-7]+$/i, yt = parseInt;
139
+ var Ie = NaN, mt = /^[-+]0x[0-9a-f]+$/i, gt = /^0b[01]+$/i, pt = /^0o[0-7]+$/i, yt = parseInt;
140
140
  function Pe(e) {
141
141
  if (typeof e == "number")
142
142
  return e;
@@ -149,8 +149,8 @@ function Pe(e) {
149
149
  if (typeof e != "string")
150
150
  return e === 0 ? e : +e;
151
151
  e = vt(e);
152
- var l = pt.test(e);
153
- return l || gt.test(e) ? yt(e.slice(2), l ? 2 : 8) : mt.test(e) ? Ie : +e;
152
+ var l = gt.test(e);
153
+ return l || pt.test(e) ? yt(e.slice(2), l ? 2 : 8) : mt.test(e) ? Ie : +e;
154
154
  }
155
155
  var de = function() {
156
156
  return Ae.Date.now();
@@ -165,7 +165,7 @@ function ke(e, r, l) {
165
165
  return s = w = void 0, c = b, a = e.apply(P, A), a;
166
166
  }
167
167
  function N(b) {
168
- return c = b, n = setTimeout(L, r), f ? d(b) : a;
168
+ return c = b, n = setTimeout(E, r), f ? d(b) : a;
169
169
  }
170
170
  function z(b) {
171
171
  var A = b - h, P = b - c, H = r - A;
@@ -175,16 +175,16 @@ function ke(e, r, l) {
175
175
  var A = b - h, P = b - c;
176
176
  return h === void 0 || A >= r || A < 0 || T && P >= v;
177
177
  }
178
- function L() {
178
+ function E() {
179
179
  var b = de();
180
180
  if ($(b))
181
181
  return i(b);
182
- n = setTimeout(L, z(b));
182
+ n = setTimeout(E, z(b));
183
183
  }
184
184
  function i(b) {
185
185
  return n = void 0, m && s ? d(b) : (s = w = void 0, a);
186
186
  }
187
- function p() {
187
+ function g() {
188
188
  n !== void 0 && clearTimeout(n), c = 0, s = h = w = n = void 0;
189
189
  }
190
190
  function M() {
@@ -196,11 +196,11 @@ function ke(e, r, l) {
196
196
  if (n === void 0)
197
197
  return N(h);
198
198
  if (T)
199
- return clearTimeout(n), n = setTimeout(L, r), d(h);
199
+ return clearTimeout(n), n = setTimeout(E, r), d(h);
200
200
  }
201
- return n === void 0 && (n = setTimeout(L, r)), a;
201
+ return n === void 0 && (n = setTimeout(E, r)), a;
202
202
  }
203
- return I.cancel = p, I.flush = M, I;
203
+ return I.cancel = g, I.flush = M, I;
204
204
  }
205
205
  function ve(e) {
206
206
  const r = window.innerWidth, l = e.sizes;
@@ -227,7 +227,7 @@ function Mt(e, r = 0) {
227
227
  "data-index": r
228
228
  };
229
229
  }
230
- function pe(e, r) {
230
+ function ge(e, r) {
231
231
  if (!e.length || r <= 0)
232
232
  return new Array(Math.max(1, r)).fill(0);
233
233
  const s = Array.from(new Set(e.map((a) => a.left))).sort((a, n) => a - n).slice(0, r), w = /* @__PURE__ */ new Map();
@@ -265,7 +265,7 @@ function It(e, r) {
265
265
  const h = parseInt(a.dataset.left || "0", 10), c = parseInt(a.dataset.top || "0", 10), f = typeof (r == null ? void 0 : r.leaveDurationMs) == "number" ? r.leaveDurationMs : NaN;
266
266
  let T = Number.isFinite(f) && f > 0 ? f : NaN;
267
267
  if (!Number.isFinite(T)) {
268
- const L = getComputedStyle(a).getPropertyValue("--masonry-leave-duration") || "", i = parseFloat(L);
268
+ const E = getComputedStyle(a).getPropertyValue("--masonry-leave-duration") || "", i = parseFloat(E);
269
269
  T = Number.isFinite(i) && i > 0 ? i : 200;
270
270
  }
271
271
  const m = a.style.transitionDuration, d = () => {
@@ -301,9 +301,9 @@ function Pt({
301
301
  let f = 0;
302
302
  async function T(m) {
303
303
  if (!e.value) return;
304
- const d = m ?? pe(r.value, l.value), N = d.length ? Math.max(...d) : 0, z = e.value.scrollTop + e.value.clientHeight, $ = e.value.scrollTop > f + 1;
304
+ const d = m ?? ge(r.value, l.value), N = d.length ? Math.max(...d) : 0, z = e.value.scrollTop + e.value.clientHeight, $ = e.value.scrollTop > f + 1;
305
305
  f = e.value.scrollTop;
306
- const L = typeof c == "number" ? c : 200, i = L >= 0 ? Math.max(0, N - L) : Math.max(0, N + L);
306
+ const E = typeof c == "number" ? c : 200, i = E >= 0 ? Math.max(0, N - E) : Math.max(0, N + E);
307
307
  if (z >= i && $ && !w.value) {
308
308
  await h(), await J();
309
309
  return;
@@ -319,13 +319,13 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
319
319
  }, Lt = {
320
320
  key: 1,
321
321
  class: "relative w-full h-full"
322
- }, St = ["src"], Nt = ["src"], Ht = { class: "flex flex-col items-center justify-center gap-2 text-slate-400" }, $t = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, At = { class: "text-xs font-medium uppercase" }, Ft = {
322
+ }, St = ["src"], Nt = ["src"], Ht = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, $t = {
323
323
  key: 3,
324
324
  class: "absolute bottom-2 left-1/2 transform -translate-x-1/2 flex items-center justify-center"
325
- }, Wt = {
325
+ }, At = {
326
326
  key: 4,
327
327
  class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
328
- }, jt = ["title"], Ot = { class: "absolute bottom-0 left-0 right-0 p-3 opacity-0 group-hover:opacity-100 transform translate-y-2 group-hover:translate-y-0 transition-all duration-300 delay-75 pointer-events-none" }, Bt = { class: "text-white text-xs font-medium truncate drop-shadow-md" }, ge = /* @__PURE__ */ Le({
328
+ }, Ft = ["title"], Wt = { class: "absolute bottom-0 left-0 right-0 p-3 opacity-0 group-hover:opacity-100 transform translate-y-2 group-hover:translate-y-0 transition-all duration-300 delay-75 pointer-events-none" }, Ot = { class: "text-white text-xs font-medium truncate drop-shadow-md" }, pe = /* @__PURE__ */ Le({
329
329
  __name: "MasonryItem",
330
330
  props: {
331
331
  item: {},
@@ -344,7 +344,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
344
344
  return r.notFound ?? ((i = r.item) == null ? void 0 : i.notFound) ?? !1;
345
345
  });
346
346
  function z(i) {
347
- return new Promise((p, M) => {
347
+ return new Promise((g, M) => {
348
348
  if (!i) {
349
349
  M(new Error("No image source provided"));
350
350
  return;
@@ -353,7 +353,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
353
353
  I.onload = () => {
354
354
  const P = Date.now() - b, H = Math.max(0, A - P);
355
355
  setTimeout(async () => {
356
- l.value = !0, s.value = !1, c.value = !1, await J(), await new Promise((S) => setTimeout(S, 100)), f.value = !0, p();
356
+ l.value = !0, s.value = !1, c.value = !1, await J(), await new Promise((L) => setTimeout(L, 100)), f.value = !0, g();
357
357
  }, H);
358
358
  }, I.onerror = () => {
359
359
  s.value = !0, l.value = !1, c.value = !1, M(new Error("Failed to load image"));
@@ -361,7 +361,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
361
361
  });
362
362
  }
363
363
  function $(i) {
364
- return new Promise((p, M) => {
364
+ return new Promise((g, M) => {
365
365
  if (!i) {
366
366
  M(new Error("No video source provided"));
367
367
  return;
@@ -370,18 +370,18 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
370
370
  I.preload = "metadata", I.muted = !0, I.onloadedmetadata = () => {
371
371
  const P = Date.now() - b, H = Math.max(0, A - P);
372
372
  setTimeout(async () => {
373
- v.value = !0, a.value = !1, c.value = !1, await J(), await new Promise((S) => setTimeout(S, 100)), f.value = !0, p();
373
+ v.value = !0, a.value = !1, c.value = !1, await J(), await new Promise((L) => setTimeout(L, 100)), f.value = !0, g();
374
374
  }, H);
375
375
  }, I.onerror = () => {
376
376
  a.value = !0, v.value = !1, c.value = !1, M(new Error("Failed to load video"));
377
377
  }, I.src = i;
378
378
  });
379
379
  }
380
- async function L() {
381
- var p;
380
+ async function E() {
381
+ var g;
382
382
  if (!h.value || c.value || N.value || d.value === "video" && v.value || d.value === "image" && l.value)
383
383
  return;
384
- const i = (p = r.item) == null ? void 0 : p.src;
384
+ const i = (g = r.item) == null ? void 0 : g.src;
385
385
  if (i)
386
386
  if (c.value = !0, f.value = !1, d.value === "video") {
387
387
  n.value = i, v.value = !1, a.value = !1;
@@ -400,8 +400,8 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
400
400
  return Se(() => {
401
401
  T.value && (m = new IntersectionObserver(
402
402
  (i) => {
403
- i.forEach((p) => {
404
- p.isIntersecting && p.intersectionRatio >= 1 ? h.value || (h.value = !0, L()) : p.isIntersecting;
403
+ i.forEach((g) => {
404
+ g.isIntersecting && g.intersectionRatio >= 1 ? h.value || (h.value = !0, E()) : g.isIntersecting;
405
405
  });
406
406
  },
407
407
  {
@@ -435,7 +435,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
435
435
  }
436
436
  }
437
437
  }
438
- ), (i, p) => (D(), B("div", {
438
+ ), (i, g) => (D(), B("div", {
439
439
  ref_key: "containerRef",
440
440
  ref: T,
441
441
  class: "relative w-full h-full group"
@@ -451,11 +451,11 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
451
451
  isLoading: c.value,
452
452
  mediaType: d.value
453
453
  }, () => [
454
- E("div", kt, [
455
- N.value ? (D(), B("div", Et, p[4] || (p[4] = [
456
- E("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
457
- E("span", { class: "font-medium" }, "Not Found", -1),
458
- E("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
454
+ S("div", kt, [
455
+ N.value ? (D(), B("div", Et, g[4] || (g[4] = [
456
+ S("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
457
+ S("span", { class: "font-medium" }, "Not Found", -1),
458
+ S("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
459
459
  ]))) : (D(), B("div", Lt, [
460
460
  d.value === "image" && w.value ? (D(), B("img", {
461
461
  key: 0,
@@ -480,9 +480,9 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
480
480
  muted: "",
481
481
  loop: "",
482
482
  playsinline: "",
483
- onMouseenter: p[0] || (p[0] = (M) => M.target.play()),
484
- onMouseleave: p[1] || (p[1] = (M) => M.target.pause()),
485
- onError: p[2] || (p[2] = (M) => a.value = !0)
483
+ onMouseenter: g[0] || (g[0] = (M) => M.target.play()),
484
+ onMouseleave: g[1] || (g[1] = (M) => M.target.pause()),
485
+ onError: g[2] || (g[2] = (M) => a.value = !0)
486
486
  }, null, 42, Nt)) : X("", !0),
487
487
  !l.value && !v.value && !s.value && !a.value ? (D(), B("div", {
488
488
  key: 2,
@@ -491,25 +491,22 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
491
491
  f.value ? "opacity-0 pointer-events-none" : "opacity-100"
492
492
  ])
493
493
  }, [
494
- E("div", Ht, [
495
- E("div", $t, [
496
- E("i", {
497
- class: Y(d.value === "video" ? "fas fa-video text-xl" : "fas fa-image text-xl")
498
- }, null, 2)
499
- ]),
500
- E("span", At, ie(d.value), 1)
494
+ S("div", Ht, [
495
+ S("i", {
496
+ class: Y(d.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
497
+ }, null, 2)
501
498
  ])
502
499
  ], 2)) : X("", !0),
503
- c.value ? (D(), B("div", Ft, p[5] || (p[5] = [
504
- E("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
505
- E("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
500
+ c.value ? (D(), B("div", $t, g[5] || (g[5] = [
501
+ S("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
502
+ S("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
506
503
  ], -1)
507
504
  ]))) : X("", !0),
508
- d.value === "image" && s.value || d.value === "video" && a.value ? (D(), B("div", Wt, [
509
- E("i", {
505
+ d.value === "image" && s.value || d.value === "video" && a.value ? (D(), B("div", At, [
506
+ S("i", {
510
507
  class: Y(d.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
511
508
  }, null, 2),
512
- E("span", null, "Failed to load " + ie(d.value), 1)
509
+ S("span", null, "Failed to load " + ue(d.value), 1)
513
510
  ])) : X("", !0)
514
511
  ])),
515
512
  !N.value && (l.value || v.value || c.value) ? (D(), B("div", {
@@ -517,27 +514,27 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
517
514
  class: "absolute top-2 left-2 w-7 h-7 flex items-center justify-center bg-black/60 backdrop-blur-sm text-white rounded-full shadow-sm opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none",
518
515
  title: d.value === "video" ? "Video" : "Image"
519
516
  }, [
520
- E("i", {
517
+ S("i", {
521
518
  class: Y(d.value === "video" ? "fas fa-video text-xs" : "fas fa-image text-xs")
522
519
  }, null, 2)
523
- ], 8, jt)) : X("", !0),
524
- p[7] || (p[7] = E("div", { class: "absolute inset-0 bg-gradient-to-t from-black/50 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none" }, null, -1)),
520
+ ], 8, Ft)) : X("", !0),
521
+ g[7] || (g[7] = S("div", { class: "absolute inset-0 bg-gradient-to-t from-black/50 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none" }, null, -1)),
525
522
  i.remove ? (D(), B("button", {
526
523
  key: 3,
527
524
  class: "absolute top-2 right-2 w-8 h-8 flex items-center justify-center bg-white/90 backdrop-blur-sm text-slate-700 rounded-full shadow-sm opacity-0 group-hover:opacity-100 transform translate-y-2 group-hover:translate-y-0 transition-all duration-300 hover:bg-red-500 hover:text-white cursor-pointer z-10",
528
- onClick: p[3] || (p[3] = ze((M) => i.remove(i.item), ["stop"])),
525
+ onClick: g[3] || (g[3] = ze((M) => i.remove(i.item), ["stop"])),
529
526
  "aria-label": "Remove item"
530
- }, p[6] || (p[6] = [
531
- E("i", { class: "fas fa-times text-sm" }, null, -1)
527
+ }, g[6] || (g[6] = [
528
+ S("i", { class: "fas fa-times text-sm" }, null, -1)
532
529
  ]))) : X("", !0),
533
- E("div", Ot, [
534
- E("p", Bt, "Item #" + ie(String(i.item.id).split("-")[0]), 1)
530
+ S("div", Wt, [
531
+ S("p", Ot, "Item #" + ue(String(i.item.id).split("-")[0]), 1)
535
532
  ])
536
533
  ])
537
534
  ])
538
535
  ], 512));
539
536
  }
540
- }), Dt = /* @__PURE__ */ Le({
537
+ }), jt = /* @__PURE__ */ Le({
541
538
  __name: "Masonry",
542
539
  props: {
543
540
  getNextPage: {
@@ -669,18 +666,18 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
669
666
  if (!Array.isArray(t) || t.length === 0) return;
670
667
  const u = t.filter((y) => !z(y == null ? void 0 : y.width) || !z(y == null ? void 0 : y.height));
671
668
  if (u.length === 0) return;
672
- const g = [];
669
+ const p = [];
673
670
  for (const y of u) {
674
- const O = (y == null ? void 0 : y.id) ?? `idx:${t.indexOf(y)}`;
675
- N.value.has(O) || (N.value.add(O), g.push(O));
671
+ const j = (y == null ? void 0 : y.id) ?? `idx:${t.indexOf(y)}`;
672
+ N.value.has(j) || (N.value.add(j), p.push(j));
676
673
  }
677
- if (g.length > 0) {
678
- const y = g.slice(0, 10);
674
+ if (p.length > 0) {
675
+ const y = p.slice(0, 10);
679
676
  console.warn(
680
677
  "[Masonry] Items missing width/height detected:",
681
678
  {
682
679
  context: o,
683
- count: g.length,
680
+ count: p.length,
684
681
  sampleIds: y,
685
682
  hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
686
683
  }
@@ -689,21 +686,21 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
689
686
  } catch {
690
687
  }
691
688
  }
692
- const L = k(0), i = k(0), p = s.virtualBufferPx, M = k(!1), I = k({
689
+ const E = k(0), i = k(0), g = s.virtualBufferPx, M = k(!1), I = k({
693
690
  distanceToTrigger: 0,
694
691
  isNearTrigger: !1
695
692
  }), b = (t) => {
696
693
  if (!c.value) return;
697
- const { scrollTop: o, clientHeight: u } = c.value, g = o + u, y = t ?? pe(n.value, h.value), O = y.length ? Math.max(...y) : 0, G = typeof s.loadThresholdPx == "number" ? s.loadThresholdPx : 200, ee = G >= 0 ? Math.max(0, O - G) : Math.max(0, O + G), we = Math.max(0, ee - g), De = we <= 100;
694
+ const { scrollTop: o, clientHeight: u } = c.value, p = o + u, y = t ?? ge(n.value, h.value), j = y.length ? Math.max(...y) : 0, G = typeof s.loadThresholdPx == "number" ? s.loadThresholdPx : 200, ee = G >= 0 ? Math.max(0, j - G) : Math.max(0, j + G), we = Math.max(0, ee - p), De = we <= 100;
698
695
  I.value = {
699
696
  distanceToTrigger: Math.round(we),
700
697
  isNearTrigger: De
701
698
  };
702
- }, { onEnter: A, onBeforeEnter: P, onBeforeLeave: H, onLeave: S } = It(n, { leaveDurationMs: s.leaveDurationMs });
699
+ }, { onEnter: A, onBeforeEnter: P, onBeforeLeave: H, onLeave: L } = It(n, { leaveDurationMs: s.leaveDurationMs });
703
700
  function _(t, o) {
704
701
  if (M.value) {
705
- const u = parseInt(t.dataset.left || "0", 10), g = parseInt(t.dataset.top || "0", 10);
706
- t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${u}px, ${g}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
702
+ const u = parseInt(t.dataset.left || "0", 10), p = parseInt(t.dataset.top || "0", 10);
703
+ t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${u}px, ${p}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
707
704
  t.style.transition = "", o();
708
705
  });
709
706
  } else
@@ -720,13 +717,13 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
720
717
  M.value || H(t);
721
718
  }
722
719
  function K(t, o) {
723
- M.value ? o() : S(t, o);
720
+ M.value ? o() : L(t, o);
724
721
  }
725
722
  const oe = te(() => {
726
- const t = L.value - p, o = L.value + i.value + p, u = n.value;
727
- return !u || u.length === 0 ? [] : u.filter((g) => {
728
- const y = g.top;
729
- return g.top + g.columnHeight >= t && y <= o;
723
+ const t = E.value - g, o = E.value + i.value + g, u = n.value;
724
+ return !u || u.length === 0 ? [] : u.filter((p) => {
725
+ const y = p.top;
726
+ return p.top + p.columnHeight >= t && y <= o;
730
727
  });
731
728
  }), { handleScroll: Q } = Pt({
732
729
  container: c,
@@ -751,8 +748,8 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
751
748
  removeAll: We,
752
749
  loadNext: q,
753
750
  loadPage: R,
754
- refreshCurrentPage: j,
755
- reset: Oe,
751
+ refreshCurrentPage: O,
752
+ reset: je,
756
753
  init: Be,
757
754
  paginationHistory: f,
758
755
  cancelLoad: he,
@@ -763,31 +760,31 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
763
760
  const o = wt(t);
764
761
  let u = 0;
765
762
  if (c.value) {
766
- const { scrollTop: g, clientHeight: y } = c.value;
767
- u = g + y + 100;
763
+ const { scrollTop: p, clientHeight: y } = c.value;
764
+ u = p + y + 100;
768
765
  }
769
766
  d.value = Math.max(o, u);
770
767
  }
771
768
  function C(t) {
772
769
  if (!c.value) return;
773
770
  $(t, "refreshLayout");
774
- const o = t.map((g, y) => ({
775
- ...g,
776
- originalIndex: g.originalIndex ?? y
771
+ const o = t.map((p, y) => ({
772
+ ...p,
773
+ originalIndex: p.originalIndex ?? y
777
774
  })), u = Ye(o, c.value, h.value, v.value);
778
775
  Z(u), n.value = u;
779
776
  }
780
777
  function re(t, o) {
781
778
  return new Promise((u) => {
782
- const g = Math.max(0, t | 0), y = Date.now();
783
- o(g, g);
784
- const O = setInterval(() => {
779
+ const p = Math.max(0, t | 0), y = Date.now();
780
+ o(p, p);
781
+ const j = setInterval(() => {
785
782
  if (W.value) {
786
- clearInterval(O), u();
783
+ clearInterval(j), u();
787
784
  return;
788
785
  }
789
- const G = Date.now() - y, ee = Math.max(0, g - G);
790
- o(ee, g), ee <= 0 && (clearInterval(O), u());
786
+ const G = Date.now() - y, ee = Math.max(0, p - G);
787
+ o(ee, p), ee <= 0 && (clearInterval(j), u());
791
788
  }, 100);
792
789
  });
793
790
  }
@@ -802,7 +799,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
802
799
  async function F(t) {
803
800
  let o = 0;
804
801
  const u = s.retryMaxAttempts;
805
- let g = s.retryInitialDelayMs;
802
+ let p = s.retryInitialDelayMs;
806
803
  for (; ; )
807
804
  try {
808
805
  const y = await t();
@@ -810,9 +807,9 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
810
807
  } catch (y) {
811
808
  if (o++, o > u)
812
809
  throw a("retry:stop", { attempt: o - 1, success: !1 }), y;
813
- a("retry:start", { attempt: o, max: u, totalMs: g }), await re(g, (O, G) => {
814
- a("retry:tick", { attempt: o, remainingMs: O, totalMs: G });
815
- }), g += s.retryBackoffStepMs;
810
+ a("retry:start", { attempt: o, max: u, totalMs: p }), await re(p, (j, G) => {
811
+ a("retry:tick", { attempt: o, remainingMs: j, totalMs: G });
812
+ }), p += s.retryBackoffStepMs;
816
813
  }
817
814
  }
818
815
  async function R(t) {
@@ -845,7 +842,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
845
842
  }
846
843
  }
847
844
  }
848
- async function j() {
845
+ async function O() {
849
846
  if (console.log("[Masonry] refreshCurrentPage called, isLoading:", m.value, "currentPage:", T.value), !m.value) {
850
847
  W.value = !1, m.value = !0;
851
848
  try {
@@ -871,7 +868,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
871
868
  const o = n.value.filter((u) => u.id !== t.id);
872
869
  if (n.value = o, await J(), console.log("[Masonry] remove - next.length:", o.length, "paginationHistory.length:", f.value.length), o.length === 0 && f.value.length > 0) {
873
870
  if (s.autoRefreshOnEmpty)
874
- console.log("[Masonry] All items removed, calling refreshCurrentPage"), await j();
871
+ console.log("[Masonry] All items removed, calling refreshCurrentPage"), await O();
875
872
  else {
876
873
  console.log("[Masonry] All items removed, calling loadNext and forcing backfill");
877
874
  try {
@@ -887,10 +884,10 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
887
884
  }
888
885
  async function V(t) {
889
886
  if (!t || t.length === 0) return;
890
- const o = new Set(t.map((g) => g.id)), u = n.value.filter((g) => !o.has(g.id));
887
+ const o = new Set(t.map((p) => p.id)), u = n.value.filter((p) => !o.has(p.id));
891
888
  if (n.value = u, await J(), u.length === 0 && f.value.length > 0) {
892
889
  if (s.autoRefreshOnEmpty)
893
- await j();
890
+ await O();
894
891
  else
895
892
  try {
896
893
  await q(), await le(0, !0);
@@ -898,7 +895,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
898
895
  }
899
896
  return;
900
897
  }
901
- await new Promise((g) => requestAnimationFrame(() => g())), requestAnimationFrame(() => {
898
+ await new Promise((p) => requestAnimationFrame(() => p())), requestAnimationFrame(() => {
902
899
  C(u);
903
900
  });
904
901
  }
@@ -912,16 +909,16 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
912
909
  async function We() {
913
910
  ye({ behavior: "smooth" }), n.value = [], d.value = 0, await J(), a("remove-all:complete");
914
911
  }
915
- function je() {
916
- h.value = ve(v.value), C(n.value), c.value && (L.value = c.value.scrollTop, i.value = c.value.clientHeight);
912
+ function Oe() {
913
+ h.value = ve(v.value), C(n.value), c.value && (E.value = c.value.scrollTop, i.value = c.value.clientHeight);
917
914
  }
918
- let ue = !1;
915
+ let ie = !1;
919
916
  const W = k(!1);
920
917
  async function le(t, o = !1) {
921
- if (!o && !s.backfillEnabled || ue || W.value) return;
918
+ if (!o && !s.backfillEnabled || ie || W.value) return;
922
919
  const u = (t || 0) + (s.pageSize || 0);
923
920
  if (!(!s.pageSize || s.pageSize <= 0 || f.value[f.value.length - 1] == null) && !(n.value.length >= u)) {
924
- ue = !0;
921
+ ie = !0;
925
922
  try {
926
923
  let y = 0;
927
924
  for (a("backfill:start", { target: u, fetched: n.value.length, calls: y }); n.value.length < u && y < s.backfillMaxCalls && f.value[f.value.length - 1] != null && !W.value && (await re(s.backfillDelayMs, (G, ee) => {
@@ -933,10 +930,10 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
933
930
  totalMs: ee
934
931
  });
935
932
  }), !W.value); ) {
936
- const O = f.value[f.value.length - 1];
933
+ const j = f.value[f.value.length - 1];
937
934
  try {
938
935
  m.value = !0;
939
- const G = await x(O);
936
+ const G = await x(j);
940
937
  if (W.value) break;
941
938
  f.value.push(G.nextPage);
942
939
  } finally {
@@ -946,14 +943,14 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
946
943
  }
947
944
  a("backfill:stop", { fetched: n.value.length, calls: y });
948
945
  } finally {
949
- ue = !1;
946
+ ie = !1;
950
947
  }
951
948
  }
952
949
  }
953
950
  function he() {
954
- W.value = !0, m.value = !1, ue = !1;
951
+ W.value = !0, m.value = !1, ie = !1;
955
952
  }
956
- function Oe() {
953
+ function je() {
957
954
  he(), W.value = !1, c.value && c.value.scrollTo({
958
955
  top: 0,
959
956
  behavior: "smooth"
@@ -963,10 +960,10 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
963
960
  };
964
961
  }
965
962
  const be = ke(async () => {
966
- c.value && (L.value = c.value.scrollTop, i.value = c.value.clientHeight), M.value = !0, await J(), await new Promise((o) => requestAnimationFrame(() => o())), M.value = !1;
967
- const t = pe(n.value, h.value);
963
+ c.value && (E.value = c.value.scrollTop, i.value = c.value.clientHeight), M.value = !0, await J(), await new Promise((o) => requestAnimationFrame(() => o())), M.value = !1;
964
+ const t = ge(n.value, h.value);
968
965
  Q(t), b(t);
969
- }, 200), xe = ke(je, 200);
966
+ }, 200), xe = ke(Oe, 200);
970
967
  function Be(t, o, u) {
971
968
  T.value = o, f.value = [o], f.value.push(u), $(t, "init"), C([...n.value, ...t]), b();
972
969
  }
@@ -979,7 +976,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
979
976
  ), Se(async () => {
980
977
  var t;
981
978
  try {
982
- h.value = ve(v.value), c.value && (L.value = c.value.scrollTop, i.value = c.value.clientHeight);
979
+ h.value = ve(v.value), c.value && (E.value = c.value.scrollTop, i.value = c.value.clientHeight);
983
980
  const o = s.loadAtPage;
984
981
  f.value = [o], s.skipInitialLoad || await R(f.value[0]), b();
985
982
  } catch (o) {
@@ -994,7 +991,7 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
994
991
  ref_key: "container",
995
992
  ref: c
996
993
  }, [
997
- E("div", {
994
+ S("div", {
998
995
  class: "relative",
999
996
  style: Re({ height: `${d.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
1000
997
  }, [
@@ -1007,18 +1004,18 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
1007
1004
  onBeforeLeave: ne
1008
1005
  }, {
1009
1006
  default: Ce(() => [
1010
- (D(!0), B(qe, null, Ve(oe.value, (u, g) => (D(), B("div", Ge({
1007
+ (D(!0), B(qe, null, Ve(oe.value, (u, p) => (D(), B("div", Ge({
1011
1008
  key: `${u.page}-${u.id}`,
1012
1009
  class: "absolute masonry-item",
1013
1010
  ref_for: !0
1014
- }, Ue(Mt)(u, g), {
1011
+ }, Ue(Mt)(u, p), {
1015
1012
  style: { paddingTop: `${v.value.header}px`, paddingBottom: `${v.value.footer}px` }
1016
1013
  }), [
1017
1014
  $e(t.$slots, "default", {
1018
1015
  item: u,
1019
1016
  remove: U
1020
1017
  }, () => [
1021
- Te(ge, {
1018
+ Te(pe, {
1022
1019
  item: u,
1023
1020
  remove: U
1024
1021
  }, null, 8, ["item"])
@@ -1031,25 +1028,25 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
1031
1028
  key: 0,
1032
1029
  class: Y(["fixed bottom-4 right-4 bg-gray-800 text-white text-xs rounded-full px-3 py-1.5 shadow-lg z-10 transition-opacity duration-300", { "opacity-50 hover:opacity-100": !I.value.isNearTrigger, "opacity-100": I.value.isNearTrigger }])
1033
1030
  }, [
1034
- E("span", null, ie(n.value.length) + " items", 1),
1035
- o[0] || (o[0] = E("span", { class: "mx-2" }, "|", -1)),
1036
- E("span", null, ie(I.value.distanceToTrigger) + "px to load", 1)
1031
+ S("span", null, ue(n.value.length) + " items", 1),
1032
+ o[0] || (o[0] = S("span", { class: "mx-2" }, "|", -1)),
1033
+ S("span", null, ue(I.value.distanceToTrigger) + "px to load", 1)
1037
1034
  ], 2)) : X("", !0)
1038
1035
  ], 4)
1039
1036
  ], 2));
1040
1037
  }
1041
- }), zt = (e, r) => {
1038
+ }), Bt = (e, r) => {
1042
1039
  const l = e.__vccOpts || e;
1043
1040
  for (const [s, w] of r)
1044
1041
  l[s] = w;
1045
1042
  return l;
1046
- }, Ee = /* @__PURE__ */ zt(Dt, [["__scopeId", "data-v-110c3294"]]), _t = {
1043
+ }, Ee = /* @__PURE__ */ Bt(jt, [["__scopeId", "data-v-110c3294"]]), zt = {
1047
1044
  install(e) {
1048
- e.component("WyxosMasonry", Ee), e.component("WMasonry", Ee), e.component("WyxosMasonryItem", ge), e.component("WMasonryItem", ge);
1045
+ e.component("WyxosMasonry", Ee), e.component("WMasonry", Ee), e.component("WyxosMasonryItem", pe), e.component("WMasonryItem", pe);
1049
1046
  }
1050
1047
  };
1051
1048
  export {
1052
1049
  Ee as Masonry,
1053
- ge as MasonryItem,
1054
- _t as default
1050
+ pe as MasonryItem,
1051
+ zt as default
1055
1052
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wyxos/vibe",
3
- "version": "1.6.9",
3
+ "version": "1.6.10",
4
4
  "main": "lib/index.js",
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -289,13 +289,8 @@ watch(
289
289
  ]"
290
290
  >
291
291
  <!-- Media type indicator - shown BEFORE preloading starts -->
292
- <div
293
- class="flex flex-col items-center justify-center gap-2 text-slate-400"
294
- >
295
- <div class="w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm">
296
- <i :class="mediaType === 'video' ? 'fas fa-video text-xl' : 'fas fa-image text-xl'"></i>
297
- </div>
298
- <span class="text-xs font-medium uppercase">{{ mediaType }}</span>
292
+ <div class="w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm">
293
+ <i :class="mediaType === 'video' ? 'fas fa-video text-xl text-slate-400' : 'fas fa-image text-xl text-slate-400'"></i>
299
294
  </div>
300
295
  </div>
301
296