@wyxos/vibe 1.6.8 → 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,23 +1,23 @@
1
- import { nextTick as Z, defineComponent as Le, ref as E, computed as ee, onMounted as Se, onUnmounted as Ne, watch as He, createElementBlock as B, openBlock as D, renderSlot as $e, createElementVNode as k, createCommentVNode as X, normalizeClass as se, 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;
5
5
  const e = document.createElement("div");
6
6
  e.style.visibility = "hidden", e.style.overflow = "scroll", e.style.msOverflowStyle = "scrollbar", e.style.width = "100px", e.style.height = "100px", document.body.appendChild(e);
7
- const o = document.createElement("div");
8
- o.style.width = "100%", e.appendChild(o);
9
- const l = e.offsetWidth - o.offsetWidth;
7
+ const r = document.createElement("div");
8
+ r.style.width = "100%", e.appendChild(r);
9
+ const l = e.offsetWidth - r.offsetWidth;
10
10
  return document.body.removeChild(e), fe = l, l;
11
11
  }
12
- function Ye(e, o, l, s = {}) {
12
+ function Ye(e, r, l, s = {}) {
13
13
  const {
14
- gutterX: T = 0,
15
- gutterY: m = 0,
14
+ gutterX: w = 0,
15
+ gutterY: v = 0,
16
16
  header: a = 0,
17
17
  footer: n = 0,
18
- paddingLeft: y = 0,
18
+ paddingLeft: h = 0,
19
19
  paddingRight: c = 0,
20
- sizes: v = {
20
+ sizes: f = {
21
21
  base: 1,
22
22
  sm: 2,
23
23
  md: 3,
@@ -25,95 +25,95 @@ function Ye(e, o, l, s = {}) {
25
25
  xl: 5,
26
26
  "2xl": 6
27
27
  },
28
- placement: b = "masonry"
28
+ placement: T = "masonry"
29
29
  } = s;
30
- let f = 0, x = 0;
30
+ let m = 0, d = 0;
31
31
  try {
32
- if (o && o.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
33
- const M = window.getComputedStyle(o);
34
- f = parseFloat(M.paddingLeft) || 0, x = parseFloat(M.paddingRight) || 0;
32
+ if (r && r.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
33
+ const P = window.getComputedStyle(r);
34
+ m = parseFloat(P.paddingLeft) || 0, d = parseFloat(P.paddingRight) || 0;
35
35
  }
36
36
  } catch {
37
37
  }
38
- const $ = (y || 0) + f, z = (c || 0) + x, N = o.offsetWidth - o.clientWidth, i = N > 0 ? N + 2 : Xe() + 2, d = o.offsetWidth - i - $ - z, L = T * (l - 1), I = Math.floor((d - L) / l), P = e.map((M) => {
39
- const W = M.width, H = M.height;
40
- return Math.round(I * H / W) + 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
- if (b === "sequential-balanced") {
43
- const M = P.length;
44
- if (M === 0) return [];
45
- const W = (w, A, R) => w + (A > 0 ? m : 0) + R;
46
- let H = Math.max(...P), _ = P.reduce((w, A) => w + A, 0) + m * Math.max(0, M - 1);
47
- const te = (w) => {
48
- let A = 1, R = 0, q = 0;
49
- for (let j = 0; j < M; j++) {
50
- const U = P[j], V = W(R, q, U);
51
- if (V <= w)
42
+ if (T === "sequential-balanced") {
43
+ const P = I.length;
44
+ if (P === 0) return [];
45
+ const H = (x, F, R) => x + (F > 0 ? v : 0) + R;
46
+ let L = Math.max(...I), _ = I.reduce((x, F) => x + F, 0) + v * Math.max(0, P - 1);
47
+ const ae = (x) => {
48
+ let F = 1, R = 0, q = 0;
49
+ for (let O = 0; O < P; O++) {
50
+ const U = I[O], V = H(R, q, U);
51
+ if (V <= x)
52
52
  R = V, q++;
53
- else if (A++, R = U, q = 1, U > w || A > l) return !1;
53
+ else if (F++, R = U, q = 1, U > x || F > l) return !1;
54
54
  }
55
- return A <= l;
55
+ return F <= l;
56
56
  };
57
- for (; H < _; ) {
58
- const w = Math.floor((H + _) / 2);
59
- te(w) ? _ = w : H = w + 1;
57
+ for (; L < _; ) {
58
+ const x = Math.floor((L + _) / 2);
59
+ ae(x) ? _ = x : L = x + 1;
60
60
  }
61
- const ae = _, Y = new Array(l).fill(0);
62
- let ne = l - 1, J = 0, K = 0;
63
- for (let w = M - 1; w >= 0; w--) {
64
- const A = P[w], R = w < ne;
65
- !(W(J, K, A) <= ae) || R ? (Y[ne] = w + 1, ne--, J = A, K = 1) : (J = W(J, K, A), K++);
61
+ const ne = _, K = new Array(l).fill(0);
62
+ let oe = l - 1, Q = 0, Z = 0;
63
+ for (let x = P - 1; x >= 0; x--) {
64
+ const F = I[x], R = x < oe;
65
+ !(H(Q, Z, F) <= ne) || R ? (K[oe] = x + 1, oe--, Q = F, Z = 1) : (Q = H(Q, Z, F), Z++);
66
66
  }
67
- Y[0] = 0;
67
+ K[0] = 0;
68
68
  const C = [], re = new Array(l).fill(0);
69
- for (let w = 0; w < l; w++) {
70
- const A = Y[w], R = w + 1 < l ? Y[w + 1] : M, q = w * (I + T);
71
- for (let j = A; j < R; j++) {
69
+ for (let x = 0; x < l; x++) {
70
+ const F = K[x], R = x + 1 < l ? K[x + 1] : P, q = x * (M + w);
71
+ for (let O = F; O < R; O++) {
72
72
  const V = {
73
- ...e[j],
74
- columnWidth: I,
73
+ ...e[O],
74
+ columnWidth: M,
75
75
  imageHeight: 0,
76
76
  columnHeight: 0,
77
77
  left: 0,
78
78
  top: 0
79
79
  };
80
- V.imageHeight = P[j] - (n + a), V.columnHeight = P[j], V.left = q, V.top = re[w], re[w] += V.columnHeight + (j + 1 < R ? m : 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
- const h = new Array(l).fill(0), S = [];
86
- for (let M = 0; M < e.length; M++) {
87
- const W = e[M], H = {
88
- ...W,
85
+ const b = new Array(l).fill(0), A = [];
86
+ for (let P = 0; P < e.length; P++) {
87
+ const H = e[P], L = {
88
+ ...H,
89
89
  columnWidth: 0,
90
90
  imageHeight: 0,
91
91
  columnHeight: 0,
92
92
  left: 0,
93
93
  top: 0
94
- }, _ = h.indexOf(Math.min(...h)), te = W.width, ae = W.height;
95
- H.columnWidth = I, H.left = _ * (I + T), H.imageHeight = Math.round(I * ae / te), H.columnHeight = H.imageHeight + n + a, H.top = h[_], h[_] += H.columnHeight + m, S.push(H);
94
+ }, _ = b.indexOf(Math.min(...b)), ae = H.width, ne = H.height;
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
- return S;
97
+ return A;
98
98
  }
99
- var Je = typeof global == "object" && global && global.Object === Object && global, Ke = typeof self == "object" && self && self.Object === Object && self, Ae = Je || Ke || Function("return this")(), ce = Ae.Symbol, Fe = Object.prototype, Qe = Fe.hasOwnProperty, Ze = Fe.toString, le = ce ? ce.toStringTag : void 0;
99
+ var Je = typeof global == "object" && global && global.Object === Object && global, Ke = typeof self == "object" && self && self.Object === Object && self, Ae = Je || Ke || Function("return this")(), ce = Ae.Symbol, Fe = Object.prototype, Qe = Fe.hasOwnProperty, Ze = Fe.toString, se = ce ? ce.toStringTag : void 0;
100
100
  function et(e) {
101
- var o = Qe.call(e, le), l = e[le];
101
+ var r = Qe.call(e, se), l = e[se];
102
102
  try {
103
- e[le] = void 0;
103
+ e[se] = void 0;
104
104
  var s = !0;
105
105
  } catch {
106
106
  }
107
- var T = Ze.call(e);
108
- return s && (o ? e[le] = l : delete e[le]), T;
107
+ var w = Ze.call(e);
108
+ return s && (r ? e[se] = l : delete e[se]), w;
109
109
  }
110
110
  var tt = Object.prototype, at = tt.toString;
111
111
  function nt(e) {
112
112
  return at.call(e);
113
113
  }
114
- var rt = "[object Null]", ot = "[object Undefined]", Me = ce ? ce.toStringTag : void 0;
114
+ var ot = "[object Null]", rt = "[object Undefined]", Me = ce ? ce.toStringTag : void 0;
115
115
  function lt(e) {
116
- return e == null ? e === void 0 ? ot : rt : Me && Me in Object(e) ? et(e) : nt(e);
116
+ return e == null ? e === void 0 ? rt : ot : Me && Me in Object(e) ? et(e) : nt(e);
117
117
  }
118
118
  function st(e) {
119
119
  return e != null && typeof e == "object";
@@ -124,17 +124,17 @@ function ut(e) {
124
124
  }
125
125
  var ct = /\s/;
126
126
  function ft(e) {
127
- for (var o = e.length; o-- && ct.test(e.charAt(o)); )
127
+ for (var r = e.length; r-- && ct.test(e.charAt(r)); )
128
128
  ;
129
- return o;
129
+ return r;
130
130
  }
131
131
  var dt = /^\s+/;
132
132
  function vt(e) {
133
133
  return e && e.slice(0, ft(e) + 1).replace(dt, "");
134
134
  }
135
135
  function me(e) {
136
- var o = typeof e;
137
- return e != null && (o == "object" || o == "function");
136
+ var r = typeof e;
137
+ return e != null && (r == "object" || r == "function");
138
138
  }
139
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) {
@@ -143,8 +143,8 @@ function Pe(e) {
143
143
  if (ut(e))
144
144
  return Ie;
145
145
  if (me(e)) {
146
- var o = typeof e.valueOf == "function" ? e.valueOf() : e;
147
- e = me(o) ? o + "" : o;
146
+ var r = typeof e.valueOf == "function" ? e.valueOf() : e;
147
+ e = me(r) ? r + "" : r;
148
148
  }
149
149
  if (typeof e != "string")
150
150
  return e === 0 ? e : +e;
@@ -155,56 +155,56 @@ function Pe(e) {
155
155
  var de = function() {
156
156
  return Ae.Date.now();
157
157
  }, ht = "Expected a function", bt = Math.max, xt = Math.min;
158
- function ke(e, o, l) {
159
- var s, T, m, a, n, y, c = 0, v = !1, b = !1, f = !0;
158
+ function ke(e, r, l) {
159
+ var s, w, v, a, n, h, c = 0, f = !1, T = !1, m = !0;
160
160
  if (typeof e != "function")
161
161
  throw new TypeError(ht);
162
- o = Pe(o) || 0, me(l) && (v = !!l.leading, b = "maxWait" in l, m = b ? bt(Pe(l.maxWait) || 0, o) : m, f = "trailing" in l ? !!l.trailing : f);
163
- function x(h) {
164
- var S = s, M = T;
165
- return s = T = void 0, c = h, a = e.apply(M, S), a;
162
+ r = Pe(r) || 0, me(l) && (f = !!l.leading, T = "maxWait" in l, v = T ? bt(Pe(l.maxWait) || 0, r) : v, m = "trailing" in l ? !!l.trailing : m);
163
+ function d(b) {
164
+ var A = s, P = w;
165
+ return s = w = void 0, c = b, a = e.apply(P, A), a;
166
166
  }
167
- function $(h) {
168
- return c = h, n = setTimeout(i, o), v ? x(h) : a;
167
+ function N(b) {
168
+ return c = b, n = setTimeout(E, r), f ? d(b) : a;
169
169
  }
170
- function z(h) {
171
- var S = h - y, M = h - c, W = o - S;
172
- return b ? xt(W, m - M) : W;
170
+ function z(b) {
171
+ var A = b - h, P = b - c, H = r - A;
172
+ return T ? xt(H, v - P) : H;
173
173
  }
174
- function N(h) {
175
- var S = h - y, M = h - c;
176
- return y === void 0 || S >= o || S < 0 || b && M >= m;
174
+ function $(b) {
175
+ var A = b - h, P = b - c;
176
+ return h === void 0 || A >= r || A < 0 || T && P >= v;
177
177
  }
178
- function i() {
179
- var h = de();
180
- if (N(h))
181
- return d(h);
182
- n = setTimeout(i, z(h));
178
+ function E() {
179
+ var b = de();
180
+ if ($(b))
181
+ return i(b);
182
+ n = setTimeout(E, z(b));
183
183
  }
184
- function d(h) {
185
- return n = void 0, f && s ? x(h) : (s = T = void 0, a);
184
+ function i(b) {
185
+ return n = void 0, m && s ? d(b) : (s = w = void 0, a);
186
186
  }
187
- function L() {
188
- n !== void 0 && clearTimeout(n), c = 0, s = y = T = n = void 0;
187
+ function g() {
188
+ n !== void 0 && clearTimeout(n), c = 0, s = h = w = n = void 0;
189
189
  }
190
- function I() {
191
- return n === void 0 ? a : d(de());
190
+ function M() {
191
+ return n === void 0 ? a : i(de());
192
192
  }
193
- function P() {
194
- var h = de(), S = N(h);
195
- if (s = arguments, T = this, y = h, S) {
193
+ function I() {
194
+ var b = de(), A = $(b);
195
+ if (s = arguments, w = this, h = b, A) {
196
196
  if (n === void 0)
197
- return $(y);
198
- if (b)
199
- return clearTimeout(n), n = setTimeout(i, o), x(y);
197
+ return N(h);
198
+ if (T)
199
+ return clearTimeout(n), n = setTimeout(E, r), d(h);
200
200
  }
201
- return n === void 0 && (n = setTimeout(i, o)), a;
201
+ return n === void 0 && (n = setTimeout(E, r)), a;
202
202
  }
203
- return P.cancel = L, P.flush = I, P;
203
+ return I.cancel = g, I.flush = M, I;
204
204
  }
205
205
  function ve(e) {
206
- const o = window.innerWidth, l = e.sizes;
207
- return o >= 1536 && l["2xl"] ? l["2xl"] : o >= 1280 && l.xl ? l.xl : o >= 1024 && l.lg ? l.lg : o >= 768 && l.md ? l.md : o >= 640 && l.sm ? l.sm : l.base;
206
+ const r = window.innerWidth, l = e.sizes;
207
+ return r >= 1536 && l["2xl"] ? l["2xl"] : r >= 1280 && l.xl ? l.xl : r >= 1024 && l.lg ? l.lg : r >= 768 && l.md ? l.md : r >= 640 && l.sm ? l.sm : l.base;
208
208
  }
209
209
  function wt(e) {
210
210
  return e.reduce((l, s) => Math.max(l, s.top + s.columnHeight), 0) + 500;
@@ -218,99 +218,99 @@ function Tt(e) {
218
218
  height: `${e.columnHeight}px`
219
219
  };
220
220
  }
221
- function Mt(e, o = 0) {
221
+ function Mt(e, r = 0) {
222
222
  return {
223
223
  style: Tt(e),
224
224
  "data-top": e.top,
225
225
  "data-left": e.left,
226
226
  "data-id": `${e.page}-${e.id}`,
227
- "data-index": o
227
+ "data-index": r
228
228
  };
229
229
  }
230
- function ge(e, o) {
231
- if (!e.length || o <= 0)
232
- return new Array(Math.max(1, o)).fill(0);
233
- const s = Array.from(new Set(e.map((a) => a.left))).sort((a, n) => a - n).slice(0, o), T = /* @__PURE__ */ new Map();
234
- for (let a = 0; a < s.length; a++) T.set(s[a], a);
235
- const m = new Array(s.length).fill(0);
230
+ function ge(e, r) {
231
+ if (!e.length || r <= 0)
232
+ return new Array(Math.max(1, r)).fill(0);
233
+ const s = Array.from(new Set(e.map((a) => a.left))).sort((a, n) => a - n).slice(0, r), w = /* @__PURE__ */ new Map();
234
+ for (let a = 0; a < s.length; a++) w.set(s[a], a);
235
+ const v = new Array(s.length).fill(0);
236
236
  for (const a of e) {
237
- const n = T.get(a.left);
238
- n != null && (m[n] = Math.max(m[n], a.top + a.columnHeight));
237
+ const n = w.get(a.left);
238
+ n != null && (v[n] = Math.max(v[n], a.top + a.columnHeight));
239
239
  }
240
- for (; m.length < o; ) m.push(0);
241
- return m;
240
+ for (; v.length < r; ) v.push(0);
241
+ return v;
242
242
  }
243
- function It(e, o) {
243
+ function It(e, r) {
244
244
  function l(a, n) {
245
- const y = parseInt(a.dataset.left || "0", 10), c = parseInt(a.dataset.top || "0", 10), v = parseInt(a.dataset.index || "0", 10), b = Math.min(v * 20, 160), f = a.style.getPropertyValue("--masonry-opacity-delay");
246
- a.style.setProperty("--masonry-opacity-delay", `${b}ms`), requestAnimationFrame(() => {
247
- a.style.opacity = "1", a.style.transform = `translate3d(${y}px, ${c}px, 0) scale(1)`;
248
- const x = () => {
249
- f ? a.style.setProperty("--masonry-opacity-delay", f) : a.style.removeProperty("--masonry-opacity-delay"), a.removeEventListener("transitionend", x), n();
245
+ const h = parseInt(a.dataset.left || "0", 10), c = parseInt(a.dataset.top || "0", 10), f = parseInt(a.dataset.index || "0", 10), T = Math.min(f * 20, 160), m = a.style.getPropertyValue("--masonry-opacity-delay");
246
+ a.style.setProperty("--masonry-opacity-delay", `${T}ms`), requestAnimationFrame(() => {
247
+ a.style.opacity = "1", a.style.transform = `translate3d(${h}px, ${c}px, 0) scale(1)`;
248
+ const d = () => {
249
+ m ? a.style.setProperty("--masonry-opacity-delay", m) : a.style.removeProperty("--masonry-opacity-delay"), a.removeEventListener("transitionend", d), n();
250
250
  };
251
- a.addEventListener("transitionend", x);
251
+ a.addEventListener("transitionend", d);
252
252
  });
253
253
  }
254
254
  function s(a) {
255
- const n = parseInt(a.dataset.left || "0", 10), y = parseInt(a.dataset.top || "0", 10);
256
- a.style.opacity = "0", a.style.transform = `translate3d(${n}px, ${y + 10}px, 0) scale(0.985)`;
255
+ const n = parseInt(a.dataset.left || "0", 10), h = parseInt(a.dataset.top || "0", 10);
256
+ a.style.opacity = "0", a.style.transform = `translate3d(${n}px, ${h + 10}px, 0) scale(0.985)`;
257
257
  }
258
- function T(a) {
259
- const n = parseInt(a.dataset.left || "0", 10), y = parseInt(a.dataset.top || "0", 10);
260
- a.style.transition = "none", a.style.opacity = "1", a.style.transform = `translate3d(${n}px, ${y}px, 0) scale(1)`, a.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
258
+ function w(a) {
259
+ const n = parseInt(a.dataset.left || "0", 10), h = parseInt(a.dataset.top || "0", 10);
260
+ a.style.transition = "none", a.style.opacity = "1", a.style.transform = `translate3d(${n}px, ${h}px, 0) scale(1)`, a.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
261
261
  a.style.transition = "";
262
262
  });
263
263
  }
264
- function m(a, n) {
265
- const y = parseInt(a.dataset.left || "0", 10), c = parseInt(a.dataset.top || "0", 10), v = typeof (o == null ? void 0 : o.leaveDurationMs) == "number" ? o.leaveDurationMs : NaN;
266
- let b = Number.isFinite(v) && v > 0 ? v : NaN;
267
- if (!Number.isFinite(b)) {
268
- const i = getComputedStyle(a).getPropertyValue("--masonry-leave-duration") || "", d = parseFloat(i);
269
- b = Number.isFinite(d) && d > 0 ? d : 200;
264
+ function v(a, n) {
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
+ let T = Number.isFinite(f) && f > 0 ? f : NaN;
267
+ if (!Number.isFinite(T)) {
268
+ const E = getComputedStyle(a).getPropertyValue("--masonry-leave-duration") || "", i = parseFloat(E);
269
+ T = Number.isFinite(i) && i > 0 ? i : 200;
270
270
  }
271
- const f = a.style.transitionDuration, x = () => {
272
- a.removeEventListener("transitionend", $), clearTimeout(z), a.style.transitionDuration = f || "";
273
- }, $ = (N) => {
274
- (!N || N.target === a) && (x(), n());
271
+ const m = a.style.transitionDuration, d = () => {
272
+ a.removeEventListener("transitionend", N), clearTimeout(z), a.style.transitionDuration = m || "";
273
+ }, N = ($) => {
274
+ (!$ || $.target === a) && (d(), n());
275
275
  }, z = setTimeout(() => {
276
- x(), n();
277
- }, b + 100);
276
+ d(), n();
277
+ }, T + 100);
278
278
  requestAnimationFrame(() => {
279
- a.style.transitionDuration = `${b}ms`, a.style.opacity = "0", a.style.transform = `translate3d(${y}px, ${c + 10}px, 0) scale(0.985)`, a.addEventListener("transitionend", $);
279
+ a.style.transitionDuration = `${T}ms`, a.style.opacity = "0", a.style.transform = `translate3d(${h}px, ${c + 10}px, 0) scale(0.985)`, a.addEventListener("transitionend", N);
280
280
  });
281
281
  }
282
282
  return {
283
283
  onEnter: l,
284
284
  onBeforeEnter: s,
285
- onBeforeLeave: T,
286
- onLeave: m
285
+ onBeforeLeave: w,
286
+ onLeave: v
287
287
  };
288
288
  }
289
289
  function Pt({
290
290
  container: e,
291
- masonry: o,
291
+ masonry: r,
292
292
  columns: l,
293
293
  containerHeight: s,
294
- isLoading: T,
295
- pageSize: m,
294
+ isLoading: w,
295
+ pageSize: v,
296
296
  refreshLayout: a,
297
297
  setItemsRaw: n,
298
- loadNext: y,
298
+ loadNext: h,
299
299
  loadThresholdPx: c
300
300
  }) {
301
- let v = 0;
302
- async function b(f) {
301
+ let f = 0;
302
+ async function T(m) {
303
303
  if (!e.value) return;
304
- const x = f ?? ge(o.value, l.value), $ = x.length ? Math.max(...x) : 0, z = e.value.scrollTop + e.value.clientHeight, N = e.value.scrollTop > v + 1;
305
- v = e.value.scrollTop;
306
- const i = typeof c == "number" ? c : 200, d = i >= 0 ? Math.max(0, $ - i) : Math.max(0, $ + i);
307
- if (z >= d && N && !T.value) {
308
- await y(), await Z();
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
+ f = e.value.scrollTop;
306
+ const E = typeof c == "number" ? c : 200, i = E >= 0 ? Math.max(0, N - E) : Math.max(0, N + E);
307
+ if (z >= i && $ && !w.value) {
308
+ await h(), await J();
309
309
  return;
310
310
  }
311
311
  }
312
312
  return {
313
- handleScroll: b
313
+ handleScroll: T
314
314
  };
315
315
  }
316
316
  const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-all duration-300 bg-white relative" }, Et = {
@@ -319,16 +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 = {
323
- key: 2,
324
- class: "absolute inset-0 bg-slate-100 flex items-center justify-center"
325
- }, $t = { class: "flex flex-col items-center justify-center gap-2 text-slate-400" }, At = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, Ft = { class: "text-xs font-medium uppercase" }, Wt = {
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 = {
326
323
  key: 3,
327
324
  class: "absolute bottom-2 left-1/2 transform -translate-x-1/2 flex items-center justify-center"
328
- }, jt = {
325
+ }, At = {
329
326
  key: 4,
330
327
  class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
331
- }, Ot = ["title"], Bt = { 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" }, Dt = { class: "text-white text-xs font-medium truncate drop-shadow-md" }, pe = /* @__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({
332
329
  __name: "MasonryItem",
333
330
  props: {
334
331
  item: {},
@@ -337,110 +334,110 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
337
334
  notFound: { type: Boolean, default: void 0 }
338
335
  },
339
336
  setup(e) {
340
- const o = e, l = E(!1), s = E(!1), T = E(null), m = E(!1), a = E(!1), n = E(null), y = E(!1), c = E(!1), v = E(null);
341
- let b = null;
342
- const f = ee(() => {
337
+ const r = e, l = k(!1), s = k(!1), w = k(null), v = k(!1), a = k(!1), n = k(null), h = k(!1), c = k(!1), f = k(!1), T = k(null);
338
+ let m = null;
339
+ const d = te(() => {
343
340
  var i;
344
- return o.type ?? ((i = o.item) == null ? void 0 : i.type) ?? "image";
345
- }), x = ee(() => {
341
+ return r.type ?? ((i = r.item) == null ? void 0 : i.type) ?? "image";
342
+ }), N = te(() => {
346
343
  var i;
347
- return o.notFound ?? ((i = o.item) == null ? void 0 : i.notFound) ?? !1;
344
+ return r.notFound ?? ((i = r.item) == null ? void 0 : i.notFound) ?? !1;
348
345
  });
349
- function $(i) {
350
- return new Promise((d, L) => {
346
+ function z(i) {
347
+ return new Promise((g, M) => {
351
348
  if (!i) {
352
- L(new Error("No image source provided"));
349
+ M(new Error("No image source provided"));
353
350
  return;
354
351
  }
355
- const I = new Image(), P = Date.now(), h = 300;
352
+ const I = new Image(), b = Date.now(), A = 300;
356
353
  I.onload = () => {
357
- const S = Date.now() - P, M = Math.max(0, h - S);
358
- setTimeout(() => {
359
- l.value = !0, s.value = !1, c.value = !1, d();
360
- }, M);
354
+ const P = Date.now() - b, H = Math.max(0, A - P);
355
+ setTimeout(async () => {
356
+ l.value = !0, s.value = !1, c.value = !1, await J(), await new Promise((L) => setTimeout(L, 100)), f.value = !0, g();
357
+ }, H);
361
358
  }, I.onerror = () => {
362
- s.value = !0, l.value = !1, c.value = !1, L(new Error("Failed to load image"));
359
+ s.value = !0, l.value = !1, c.value = !1, M(new Error("Failed to load image"));
363
360
  }, I.src = i;
364
361
  });
365
362
  }
366
- function z(i) {
367
- return new Promise((d, L) => {
363
+ function $(i) {
364
+ return new Promise((g, M) => {
368
365
  if (!i) {
369
- L(new Error("No video source provided"));
366
+ M(new Error("No video source provided"));
370
367
  return;
371
368
  }
372
- const I = document.createElement("video"), P = Date.now(), h = 300;
369
+ const I = document.createElement("video"), b = Date.now(), A = 300;
373
370
  I.preload = "metadata", I.muted = !0, I.onloadedmetadata = () => {
374
- const S = Date.now() - P, M = Math.max(0, h - S);
375
- setTimeout(() => {
376
- m.value = !0, a.value = !1, c.value = !1, d();
377
- }, M);
371
+ const P = Date.now() - b, H = Math.max(0, A - P);
372
+ setTimeout(async () => {
373
+ v.value = !0, a.value = !1, c.value = !1, await J(), await new Promise((L) => setTimeout(L, 100)), f.value = !0, g();
374
+ }, H);
378
375
  }, I.onerror = () => {
379
- a.value = !0, m.value = !1, c.value = !1, L(new Error("Failed to load video"));
376
+ a.value = !0, v.value = !1, c.value = !1, M(new Error("Failed to load video"));
380
377
  }, I.src = i;
381
378
  });
382
379
  }
383
- async function N() {
384
- var d;
385
- if (!y.value || c.value || x.value || f.value === "video" && m.value || f.value === "image" && l.value)
380
+ async function E() {
381
+ var g;
382
+ if (!h.value || c.value || N.value || d.value === "video" && v.value || d.value === "image" && l.value)
386
383
  return;
387
- const i = (d = o.item) == null ? void 0 : d.src;
384
+ const i = (g = r.item) == null ? void 0 : g.src;
388
385
  if (i)
389
- if (c.value = !0, f.value === "video") {
390
- n.value = i, m.value = !1, a.value = !1;
386
+ if (c.value = !0, f.value = !1, d.value === "video") {
387
+ n.value = i, v.value = !1, a.value = !1;
391
388
  try {
392
- await z(i);
389
+ await $(i);
393
390
  } catch {
394
391
  }
395
392
  } else {
396
- T.value = i, l.value = !1, s.value = !1;
393
+ w.value = i, l.value = !1, s.value = !1;
397
394
  try {
398
- await $(i);
395
+ await z(i);
399
396
  } catch {
400
397
  }
401
398
  }
402
399
  }
403
400
  return Se(() => {
404
- v.value && (b = new IntersectionObserver(
401
+ T.value && (m = new IntersectionObserver(
405
402
  (i) => {
406
- i.forEach((d) => {
407
- d.isIntersecting && d.intersectionRatio >= 1 ? y.value || (y.value = !0, N()) : d.isIntersecting;
403
+ i.forEach((g) => {
404
+ g.isIntersecting && g.intersectionRatio >= 1 ? h.value || (h.value = !0, E()) : g.isIntersecting;
408
405
  });
409
406
  },
410
407
  {
411
408
  // Only trigger when item is 100% visible (full height in view)
412
409
  threshold: [1]
413
410
  }
414
- ), b.observe(v.value));
411
+ ), m.observe(T.value));
415
412
  }), Ne(() => {
416
- b && (b.disconnect(), b = null);
413
+ m && (m.disconnect(), m = null);
417
414
  }), He(
418
415
  () => {
419
416
  var i;
420
- return (i = o.item) == null ? void 0 : i.src;
417
+ return (i = r.item) == null ? void 0 : i.src;
421
418
  },
422
419
  async (i) => {
423
- if (!(!i || x.value)) {
424
- if (f.value === "video") {
425
- if (i !== n.value && (m.value = !1, a.value = !1, n.value = i, y.value)) {
420
+ if (!(!i || N.value)) {
421
+ if (d.value === "video") {
422
+ if (i !== n.value && (v.value = !1, a.value = !1, n.value = i, h.value)) {
426
423
  c.value = !0;
427
424
  try {
428
- await z(i);
425
+ await $(i);
429
426
  } catch {
430
427
  }
431
428
  }
432
- } else if (i !== T.value && (l.value = !1, s.value = !1, T.value = i, y.value)) {
429
+ } else if (i !== w.value && (l.value = !1, s.value = !1, w.value = i, h.value)) {
433
430
  c.value = !0;
434
431
  try {
435
- await $(i);
432
+ await z(i);
436
433
  } catch {
437
434
  }
438
435
  }
439
436
  }
440
437
  }
441
- ), (i, d) => (D(), B("div", {
438
+ ), (i, g) => (D(), B("div", {
442
439
  ref_key: "containerRef",
443
- ref: v,
440
+ ref: T,
444
441
  class: "relative w-full h-full group"
445
442
  }, [
446
443
  $e(i.$slots, "default", {
@@ -448,85 +445,96 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
448
445
  remove: i.remove,
449
446
  imageLoaded: l.value,
450
447
  imageError: s.value,
451
- videoLoaded: m.value,
448
+ videoLoaded: v.value,
452
449
  videoError: a.value,
453
- showNotFound: x.value,
450
+ showNotFound: N.value,
454
451
  isLoading: c.value,
455
- mediaType: f.value
452
+ mediaType: d.value
456
453
  }, () => [
457
- k("div", kt, [
458
- x.value ? (D(), B("div", Et, d[4] || (d[4] = [
459
- k("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
460
- k("span", { class: "font-medium" }, "Not Found", -1),
461
- k("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)
462
459
  ]))) : (D(), B("div", Lt, [
463
- f.value === "image" && l.value && T.value ? (D(), B("img", {
460
+ d.value === "image" && w.value ? (D(), B("img", {
464
461
  key: 0,
465
- src: T.value,
466
- class: "w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",
462
+ src: w.value,
463
+ class: Y([
464
+ "w-full h-full object-cover transition-opacity duration-700 ease-in-out group-hover:scale-105",
465
+ l.value && f.value ? "opacity-100" : "opacity-0"
466
+ ]),
467
+ style: { position: "absolute", top: "0", left: "0" },
467
468
  loading: "lazy",
468
469
  decoding: "async",
469
470
  alt: ""
470
- }, null, 8, St)) : X("", !0),
471
- f.value === "video" && m.value && n.value ? (D(), B("video", {
471
+ }, null, 10, St)) : X("", !0),
472
+ d.value === "video" && n.value ? (D(), B("video", {
472
473
  key: 1,
473
474
  src: n.value,
474
- class: "w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",
475
+ class: Y([
476
+ "w-full h-full object-cover transition-opacity duration-700 ease-in-out group-hover:scale-105",
477
+ v.value && f.value ? "opacity-100" : "opacity-0"
478
+ ]),
479
+ style: { position: "absolute", top: "0", left: "0" },
475
480
  muted: "",
476
481
  loop: "",
477
482
  playsinline: "",
478
- onMouseenter: d[0] || (d[0] = (L) => L.target.play()),
479
- onMouseleave: d[1] || (d[1] = (L) => L.target.pause()),
480
- onError: d[2] || (d[2] = (L) => a.value = !0)
481
- }, null, 40, Nt)) : X("", !0),
482
- !l.value && !m.value && !s.value && !a.value ? (D(), B("div", Ht, [
483
- k("div", $t, [
484
- k("div", At, [
485
- k("i", {
486
- class: se(f.value === "video" ? "fas fa-video text-xl" : "fas fa-image text-xl")
487
- }, null, 2)
488
- ]),
489
- k("span", Ft, ie(f.value), 1)
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
+ }, null, 42, Nt)) : X("", !0),
487
+ !l.value && !v.value && !s.value && !a.value ? (D(), B("div", {
488
+ key: 2,
489
+ class: Y([
490
+ "absolute inset-0 bg-slate-100 flex items-center justify-center transition-opacity duration-500",
491
+ f.value ? "opacity-0 pointer-events-none" : "opacity-100"
492
+ ])
493
+ }, [
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)
490
498
  ])
491
- ])) : X("", !0),
492
- c.value ? (D(), B("div", Wt, d[5] || (d[5] = [
493
- k("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
494
- k("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
499
+ ], 2)) : X("", !0),
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" })
495
503
  ], -1)
496
504
  ]))) : X("", !0),
497
- f.value === "image" && s.value || f.value === "video" && a.value ? (D(), B("div", jt, [
498
- k("i", {
499
- class: se(f.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
505
+ d.value === "image" && s.value || d.value === "video" && a.value ? (D(), B("div", At, [
506
+ S("i", {
507
+ class: Y(d.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
500
508
  }, null, 2),
501
- k("span", null, "Failed to load " + ie(f.value), 1)
509
+ S("span", null, "Failed to load " + ue(d.value), 1)
502
510
  ])) : X("", !0)
503
511
  ])),
504
- !x.value && (l.value || m.value || c.value) ? (D(), B("div", {
512
+ !N.value && (l.value || v.value || c.value) ? (D(), B("div", {
505
513
  key: 2,
506
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",
507
- title: f.value === "video" ? "Video" : "Image"
515
+ title: d.value === "video" ? "Video" : "Image"
508
516
  }, [
509
- k("i", {
510
- class: se(f.value === "video" ? "fas fa-video text-xs" : "fas fa-image text-xs")
517
+ S("i", {
518
+ class: Y(d.value === "video" ? "fas fa-video text-xs" : "fas fa-image text-xs")
511
519
  }, null, 2)
512
- ], 8, Ot)) : X("", !0),
513
- d[7] || (d[7] = k("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)),
514
522
  i.remove ? (D(), B("button", {
515
523
  key: 3,
516
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",
517
- onClick: d[3] || (d[3] = ze((L) => i.remove(i.item), ["stop"])),
525
+ onClick: g[3] || (g[3] = ze((M) => i.remove(i.item), ["stop"])),
518
526
  "aria-label": "Remove item"
519
- }, d[6] || (d[6] = [
520
- k("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)
521
529
  ]))) : X("", !0),
522
- k("div", Bt, [
523
- k("p", Dt, "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)
524
532
  ])
525
533
  ])
526
534
  ])
527
535
  ], 512));
528
536
  }
529
- }), zt = /* @__PURE__ */ Le({
537
+ }), jt = /* @__PURE__ */ Le({
530
538
  __name: "Masonry",
531
539
  props: {
532
540
  getNextPage: {
@@ -626,8 +634,8 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
626
634
  "retry:stop",
627
635
  "remove-all:complete"
628
636
  ],
629
- setup(e, { expose: o, emit: l }) {
630
- const s = e, T = {
637
+ setup(e, { expose: r, emit: l }) {
638
+ const s = e, w = {
631
639
  sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
632
640
  gutterX: 10,
633
641
  gutterY: 10,
@@ -636,41 +644,41 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
636
644
  paddingLeft: 0,
637
645
  paddingRight: 0,
638
646
  placement: "masonry"
639
- }, m = ee(() => {
647
+ }, v = te(() => {
640
648
  var t;
641
649
  return {
642
- ...T,
650
+ ...w,
643
651
  ...s.layout,
644
652
  sizes: {
645
- ...T.sizes,
653
+ ...w.sizes,
646
654
  ...((t = s.layout) == null ? void 0 : t.sizes) || {}
647
655
  }
648
656
  };
649
- }), a = l, n = ee({
657
+ }), a = l, n = te({
650
658
  get: () => s.items,
651
659
  set: (t) => a("update:items", t)
652
- }), y = E(7), c = E(null), v = E([]), b = E(null), f = E(!1), x = E(0), $ = E(/* @__PURE__ */ new Set());
660
+ }), h = k(7), c = k(null), f = k([]), T = k(null), m = k(!1), d = k(0), N = k(/* @__PURE__ */ new Set());
653
661
  function z(t) {
654
662
  return typeof t == "number" && Number.isFinite(t) && t > 0;
655
663
  }
656
- function N(t, r) {
664
+ function $(t, o) {
657
665
  try {
658
666
  if (!Array.isArray(t) || t.length === 0) return;
659
- const u = t.filter((p) => !z(p == null ? void 0 : p.width) || !z(p == null ? void 0 : p.height));
667
+ const u = t.filter((y) => !z(y == null ? void 0 : y.width) || !z(y == null ? void 0 : y.height));
660
668
  if (u.length === 0) return;
661
- const g = [];
662
- for (const p of u) {
663
- const O = (p == null ? void 0 : p.id) ?? `idx:${t.indexOf(p)}`;
664
- $.value.has(O) || ($.value.add(O), g.push(O));
669
+ const p = [];
670
+ for (const y of u) {
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));
665
673
  }
666
- if (g.length > 0) {
667
- const p = g.slice(0, 10);
674
+ if (p.length > 0) {
675
+ const y = p.slice(0, 10);
668
676
  console.warn(
669
677
  "[Masonry] Items missing width/height detected:",
670
678
  {
671
- context: r,
672
- count: g.length,
673
- sampleIds: p,
679
+ context: o,
680
+ count: p.length,
681
+ sampleIds: y,
674
682
  hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
675
683
  }
676
684
  );
@@ -678,51 +686,51 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
678
686
  } catch {
679
687
  }
680
688
  }
681
- const i = E(0), d = E(0), L = s.virtualBufferPx, I = E(!1), P = E({
689
+ const E = k(0), i = k(0), g = s.virtualBufferPx, M = k(!1), I = k({
682
690
  distanceToTrigger: 0,
683
691
  isNearTrigger: !1
684
- }), h = (t) => {
692
+ }), b = (t) => {
685
693
  if (!c.value) return;
686
- const { scrollTop: r, clientHeight: u } = c.value, g = r + u, p = t ?? ge(n.value, y.value), O = p.length ? Math.max(...p) : 0, G = typeof s.loadThresholdPx == "number" ? s.loadThresholdPx : 200, Q = G >= 0 ? Math.max(0, O - G) : Math.max(0, O + G), we = Math.max(0, Q - g), De = we <= 100;
687
- P.value = {
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;
695
+ I.value = {
688
696
  distanceToTrigger: Math.round(we),
689
697
  isNearTrigger: De
690
698
  };
691
- }, { onEnter: S, onBeforeEnter: M, onBeforeLeave: W, onLeave: H } = It(n, { leaveDurationMs: s.leaveDurationMs });
692
- function _(t, r) {
693
- if (I.value) {
694
- const u = parseInt(t.dataset.left || "0", 10), g = parseInt(t.dataset.top || "0", 10);
695
- 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(() => {
696
- t.style.transition = "", r();
699
+ }, { onEnter: A, onBeforeEnter: P, onBeforeLeave: H, onLeave: L } = It(n, { leaveDurationMs: s.leaveDurationMs });
700
+ function _(t, o) {
701
+ if (M.value) {
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(() => {
704
+ t.style.transition = "", o();
697
705
  });
698
706
  } else
699
- S(t, r);
707
+ A(t, o);
700
708
  }
701
- function te(t) {
702
- if (I.value) {
703
- const r = parseInt(t.dataset.left || "0", 10), u = parseInt(t.dataset.top || "0", 10);
704
- t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${r}px, ${u}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay");
709
+ function ae(t) {
710
+ if (M.value) {
711
+ const o = parseInt(t.dataset.left || "0", 10), u = parseInt(t.dataset.top || "0", 10);
712
+ t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${o}px, ${u}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay");
705
713
  } else
706
- M(t);
714
+ P(t);
707
715
  }
708
- function ae(t) {
709
- I.value || W(t);
716
+ function ne(t) {
717
+ M.value || H(t);
710
718
  }
711
- function Y(t, r) {
712
- I.value ? r() : H(t, r);
719
+ function K(t, o) {
720
+ M.value ? o() : L(t, o);
713
721
  }
714
- const ne = ee(() => {
715
- const t = i.value - L, r = i.value + d.value + L, u = n.value;
716
- return !u || u.length === 0 ? [] : u.filter((g) => {
717
- const p = g.top;
718
- return g.top + g.columnHeight >= t && p <= r;
722
+ const oe = te(() => {
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;
719
727
  });
720
- }), { handleScroll: J } = Pt({
728
+ }), { handleScroll: Q } = Pt({
721
729
  container: c,
722
730
  masonry: n,
723
- columns: y,
724
- containerHeight: x,
725
- isLoading: f,
731
+ columns: h,
732
+ containerHeight: d,
733
+ isLoading: m,
726
734
  pageSize: s.pageSize,
727
735
  refreshLayout: C,
728
736
  setItemsRaw: (t) => {
@@ -731,163 +739,163 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
731
739
  loadNext: q,
732
740
  loadThresholdPx: s.loadThresholdPx
733
741
  });
734
- o({
735
- isLoading: f,
742
+ r({
743
+ isLoading: m,
736
744
  refreshLayout: C,
737
- containerHeight: x,
745
+ containerHeight: d,
738
746
  remove: U,
739
747
  removeMany: V,
740
748
  removeAll: We,
741
749
  loadNext: q,
742
750
  loadPage: R,
743
- refreshCurrentPage: j,
744
- reset: Oe,
751
+ refreshCurrentPage: O,
752
+ reset: je,
745
753
  init: Be,
746
- paginationHistory: v,
754
+ paginationHistory: f,
747
755
  cancelLoad: he,
748
756
  scrollToTop: ye,
749
- totalItems: ee(() => n.value.length)
757
+ totalItems: te(() => n.value.length)
750
758
  });
751
- function K(t) {
752
- const r = wt(t);
759
+ function Z(t) {
760
+ const o = wt(t);
753
761
  let u = 0;
754
762
  if (c.value) {
755
- const { scrollTop: g, clientHeight: p } = c.value;
756
- u = g + p + 100;
763
+ const { scrollTop: p, clientHeight: y } = c.value;
764
+ u = p + y + 100;
757
765
  }
758
- x.value = Math.max(r, u);
766
+ d.value = Math.max(o, u);
759
767
  }
760
768
  function C(t) {
761
769
  if (!c.value) return;
762
- N(t, "refreshLayout");
763
- const r = t.map((g, p) => ({
764
- ...g,
765
- originalIndex: g.originalIndex ?? p
766
- })), u = Ye(r, c.value, y.value, m.value);
767
- K(u), n.value = u;
770
+ $(t, "refreshLayout");
771
+ const o = t.map((p, y) => ({
772
+ ...p,
773
+ originalIndex: p.originalIndex ?? y
774
+ })), u = Ye(o, c.value, h.value, v.value);
775
+ Z(u), n.value = u;
768
776
  }
769
- function re(t, r) {
777
+ function re(t, o) {
770
778
  return new Promise((u) => {
771
- const g = Math.max(0, t | 0), p = Date.now();
772
- r(g, g);
773
- const O = setInterval(() => {
774
- if (F.value) {
775
- clearInterval(O), u();
779
+ const p = Math.max(0, t | 0), y = Date.now();
780
+ o(p, p);
781
+ const j = setInterval(() => {
782
+ if (W.value) {
783
+ clearInterval(j), u();
776
784
  return;
777
785
  }
778
- const G = Date.now() - p, Q = Math.max(0, g - G);
779
- r(Q, g), Q <= 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());
780
788
  }, 100);
781
789
  });
782
790
  }
783
- async function w(t) {
791
+ async function x(t) {
784
792
  try {
785
- const r = await A(() => s.getNextPage(t));
786
- return C([...n.value, ...r.items]), r;
787
- } catch (r) {
788
- throw console.error("Error in getContent:", r), r;
793
+ const o = await F(() => s.getNextPage(t));
794
+ return C([...n.value, ...o.items]), o;
795
+ } catch (o) {
796
+ throw console.error("Error in getContent:", o), o;
789
797
  }
790
798
  }
791
- async function A(t) {
792
- let r = 0;
799
+ async function F(t) {
800
+ let o = 0;
793
801
  const u = s.retryMaxAttempts;
794
- let g = s.retryInitialDelayMs;
802
+ let p = s.retryInitialDelayMs;
795
803
  for (; ; )
796
804
  try {
797
- const p = await t();
798
- return r > 0 && a("retry:stop", { attempt: r, success: !0 }), p;
799
- } catch (p) {
800
- if (r++, r > u)
801
- throw a("retry:stop", { attempt: r - 1, success: !1 }), p;
802
- a("retry:start", { attempt: r, max: u, totalMs: g }), await re(g, (O, G) => {
803
- a("retry:tick", { attempt: r, remainingMs: O, totalMs: G });
804
- }), g += s.retryBackoffStepMs;
805
+ const y = await t();
806
+ return o > 0 && a("retry:stop", { attempt: o, success: !0 }), y;
807
+ } catch (y) {
808
+ if (o++, o > u)
809
+ throw a("retry:stop", { attempt: o - 1, success: !1 }), y;
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;
805
813
  }
806
814
  }
807
815
  async function R(t) {
808
- if (!f.value) {
809
- F.value = !1, f.value = !0;
816
+ if (!m.value) {
817
+ W.value = !1, m.value = !0;
810
818
  try {
811
- const r = n.value.length;
812
- if (F.value) return;
813
- const u = await w(t);
814
- return F.value ? void 0 : (b.value = t, v.value.push(u.nextPage), await oe(r), u);
815
- } catch (r) {
816
- throw console.error("Error loading page:", r), r;
819
+ const o = n.value.length;
820
+ if (W.value) return;
821
+ const u = await x(t);
822
+ return W.value ? void 0 : (T.value = t, f.value.push(u.nextPage), await le(o), u);
823
+ } catch (o) {
824
+ throw console.error("Error loading page:", o), o;
817
825
  } finally {
818
- f.value = !1;
826
+ m.value = !1;
819
827
  }
820
828
  }
821
829
  }
822
830
  async function q() {
823
- if (!f.value) {
824
- F.value = !1, f.value = !0;
831
+ if (!m.value) {
832
+ W.value = !1, m.value = !0;
825
833
  try {
826
834
  const t = n.value.length;
827
- if (F.value) return;
828
- const r = v.value[v.value.length - 1], u = await w(r);
829
- return F.value ? void 0 : (b.value = r, v.value.push(u.nextPage), await oe(t), u);
835
+ if (W.value) return;
836
+ const o = f.value[f.value.length - 1], u = await x(o);
837
+ return W.value ? void 0 : (T.value = o, f.value.push(u.nextPage), await le(t), u);
830
838
  } catch (t) {
831
839
  throw console.error("Error loading next page:", t), t;
832
840
  } finally {
833
- f.value = !1;
841
+ m.value = !1;
834
842
  }
835
843
  }
836
844
  }
837
- async function j() {
838
- if (console.log("[Masonry] refreshCurrentPage called, isLoading:", f.value, "currentPage:", b.value), !f.value) {
839
- F.value = !1, f.value = !0;
845
+ async function O() {
846
+ if (console.log("[Masonry] refreshCurrentPage called, isLoading:", m.value, "currentPage:", T.value), !m.value) {
847
+ W.value = !1, m.value = !0;
840
848
  try {
841
- const t = b.value;
849
+ const t = T.value;
842
850
  if (console.log("[Masonry] pageToRefresh:", t), t == null) {
843
- console.warn("[Masonry] No current page to refresh - currentPage:", b.value, "paginationHistory:", v.value);
851
+ console.warn("[Masonry] No current page to refresh - currentPage:", T.value, "paginationHistory:", f.value);
844
852
  return;
845
853
  }
846
- n.value = [], x.value = 0, v.value = [t], await Z();
847
- const r = await w(t);
848
- if (F.value) return;
849
- b.value = t, v.value.push(r.nextPage);
854
+ n.value = [], d.value = 0, f.value = [t], await J();
855
+ const o = await x(t);
856
+ if (W.value) return;
857
+ T.value = t, f.value.push(o.nextPage);
850
858
  const u = n.value.length;
851
- return await oe(u), r;
859
+ return await le(u), o;
852
860
  } catch (t) {
853
861
  throw console.error("[Masonry] Error refreshing current page:", t), t;
854
862
  } finally {
855
- f.value = !1;
863
+ m.value = !1;
856
864
  }
857
865
  }
858
866
  }
859
867
  async function U(t) {
860
- const r = n.value.filter((u) => u.id !== t.id);
861
- if (n.value = r, await Z(), console.log("[Masonry] remove - next.length:", r.length, "paginationHistory.length:", v.value.length), r.length === 0 && v.value.length > 0) {
868
+ const o = n.value.filter((u) => u.id !== t.id);
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) {
862
870
  if (s.autoRefreshOnEmpty)
863
- console.log("[Masonry] All items removed, calling refreshCurrentPage"), await j();
871
+ console.log("[Masonry] All items removed, calling refreshCurrentPage"), await O();
864
872
  else {
865
873
  console.log("[Masonry] All items removed, calling loadNext and forcing backfill");
866
874
  try {
867
- await q(), await oe(0, !0);
875
+ await q(), await le(0, !0);
868
876
  } catch {
869
877
  }
870
878
  }
871
879
  return;
872
880
  }
873
881
  await new Promise((u) => requestAnimationFrame(() => u())), requestAnimationFrame(() => {
874
- C(r);
882
+ C(o);
875
883
  });
876
884
  }
877
885
  async function V(t) {
878
886
  if (!t || t.length === 0) return;
879
- const r = new Set(t.map((g) => g.id)), u = n.value.filter((g) => !r.has(g.id));
880
- if (n.value = u, await Z(), u.length === 0 && v.value.length > 0) {
887
+ const o = new Set(t.map((p) => p.id)), u = n.value.filter((p) => !o.has(p.id));
888
+ if (n.value = u, await J(), u.length === 0 && f.value.length > 0) {
881
889
  if (s.autoRefreshOnEmpty)
882
- await j();
890
+ await O();
883
891
  else
884
892
  try {
885
- await q(), await oe(0, !0);
893
+ await q(), await le(0, !0);
886
894
  } catch {
887
895
  }
888
896
  return;
889
897
  }
890
- await new Promise((g) => requestAnimationFrame(() => g())), requestAnimationFrame(() => {
898
+ await new Promise((p) => requestAnimationFrame(() => p())), requestAnimationFrame(() => {
891
899
  C(u);
892
900
  });
893
901
  }
@@ -899,109 +907,109 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
899
907
  });
900
908
  }
901
909
  async function We() {
902
- ye({ behavior: "smooth" }), n.value = [], x.value = 0, await Z(), a("remove-all:complete");
910
+ ye({ behavior: "smooth" }), n.value = [], d.value = 0, await J(), a("remove-all:complete");
903
911
  }
904
- function je() {
905
- y.value = ve(m.value), C(n.value), c.value && (i.value = c.value.scrollTop, d.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);
906
914
  }
907
- let ue = !1;
908
- const F = E(!1);
909
- async function oe(t, r = !1) {
910
- if (!r && !s.backfillEnabled || ue || F.value) return;
915
+ let ie = !1;
916
+ const W = k(!1);
917
+ async function le(t, o = !1) {
918
+ if (!o && !s.backfillEnabled || ie || W.value) return;
911
919
  const u = (t || 0) + (s.pageSize || 0);
912
- if (!(!s.pageSize || s.pageSize <= 0 || v.value[v.value.length - 1] == null) && !(n.value.length >= u)) {
913
- ue = !0;
920
+ if (!(!s.pageSize || s.pageSize <= 0 || f.value[f.value.length - 1] == null) && !(n.value.length >= u)) {
921
+ ie = !0;
914
922
  try {
915
- let p = 0;
916
- for (a("backfill:start", { target: u, fetched: n.value.length, calls: p }); n.value.length < u && p < s.backfillMaxCalls && v.value[v.value.length - 1] != null && !F.value && (await re(s.backfillDelayMs, (G, Q) => {
923
+ let y = 0;
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) => {
917
925
  a("backfill:tick", {
918
926
  fetched: n.value.length,
919
927
  target: u,
920
- calls: p,
928
+ calls: y,
921
929
  remainingMs: G,
922
- totalMs: Q
930
+ totalMs: ee
923
931
  });
924
- }), !F.value); ) {
925
- const O = v.value[v.value.length - 1];
932
+ }), !W.value); ) {
933
+ const j = f.value[f.value.length - 1];
926
934
  try {
927
- f.value = !0;
928
- const G = await w(O);
929
- if (F.value) break;
930
- v.value.push(G.nextPage);
935
+ m.value = !0;
936
+ const G = await x(j);
937
+ if (W.value) break;
938
+ f.value.push(G.nextPage);
931
939
  } finally {
932
- f.value = !1;
940
+ m.value = !1;
933
941
  }
934
- p++;
942
+ y++;
935
943
  }
936
- a("backfill:stop", { fetched: n.value.length, calls: p });
944
+ a("backfill:stop", { fetched: n.value.length, calls: y });
937
945
  } finally {
938
- ue = !1;
946
+ ie = !1;
939
947
  }
940
948
  }
941
949
  }
942
950
  function he() {
943
- F.value = !0, f.value = !1, ue = !1;
951
+ W.value = !0, m.value = !1, ie = !1;
944
952
  }
945
- function Oe() {
946
- he(), F.value = !1, c.value && c.value.scrollTo({
953
+ function je() {
954
+ he(), W.value = !1, c.value && c.value.scrollTo({
947
955
  top: 0,
948
956
  behavior: "smooth"
949
- }), n.value = [], x.value = 0, b.value = s.loadAtPage, v.value = [s.loadAtPage], P.value = {
957
+ }), n.value = [], d.value = 0, T.value = s.loadAtPage, f.value = [s.loadAtPage], I.value = {
950
958
  distanceToTrigger: 0,
951
959
  isNearTrigger: !1
952
960
  };
953
961
  }
954
962
  const be = ke(async () => {
955
- c.value && (i.value = c.value.scrollTop, d.value = c.value.clientHeight), I.value = !0, await Z(), await new Promise((r) => requestAnimationFrame(() => r())), I.value = !1;
956
- const t = ge(n.value, y.value);
957
- J(t), h(t);
958
- }, 200), xe = ke(je, 200);
959
- function Be(t, r, u) {
960
- b.value = r, v.value = [r], v.value.push(u), N(t, "init"), C([...n.value, ...t]), h();
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);
965
+ Q(t), b(t);
966
+ }, 200), xe = ke(Oe, 200);
967
+ function Be(t, o, u) {
968
+ T.value = o, f.value = [o], f.value.push(u), $(t, "init"), C([...n.value, ...t]), b();
961
969
  }
962
970
  return He(
963
- m,
971
+ v,
964
972
  () => {
965
- c.value && (y.value = ve(m.value), C(n.value));
973
+ c.value && (h.value = ve(v.value), C(n.value));
966
974
  },
967
975
  { deep: !0 }
968
976
  ), Se(async () => {
969
977
  var t;
970
978
  try {
971
- y.value = ve(m.value), c.value && (i.value = c.value.scrollTop, d.value = c.value.clientHeight);
972
- const r = s.loadAtPage;
973
- v.value = [r], s.skipInitialLoad || await R(v.value[0]), h();
974
- } catch (r) {
975
- console.error("Error during component initialization:", r), f.value = !1;
979
+ h.value = ve(v.value), c.value && (E.value = c.value.scrollTop, i.value = c.value.clientHeight);
980
+ const o = s.loadAtPage;
981
+ f.value = [o], s.skipInitialLoad || await R(f.value[0]), b();
982
+ } catch (o) {
983
+ console.error("Error during component initialization:", o), m.value = !1;
976
984
  }
977
985
  (t = c.value) == null || t.addEventListener("scroll", be, { passive: !0 }), window.addEventListener("resize", xe);
978
986
  }), Ne(() => {
979
987
  var t;
980
988
  (t = c.value) == null || t.removeEventListener("scroll", be), window.removeEventListener("resize", xe);
981
- }), (t, r) => (D(), B("div", {
982
- class: se(["overflow-auto w-full flex-1 masonry-container", { "force-motion": s.forceMotion }]),
989
+ }), (t, o) => (D(), B("div", {
990
+ class: Y(["overflow-auto w-full flex-1 masonry-container", { "force-motion": s.forceMotion }]),
983
991
  ref_key: "container",
984
992
  ref: c
985
993
  }, [
986
- k("div", {
994
+ S("div", {
987
995
  class: "relative",
988
- style: Re({ height: `${x.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
996
+ style: Re({ height: `${d.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
989
997
  }, [
990
998
  Te(_e, {
991
999
  name: "masonry",
992
1000
  css: !1,
993
1001
  onEnter: _,
994
- onBeforeEnter: te,
995
- onLeave: Y,
996
- onBeforeLeave: ae
1002
+ onBeforeEnter: ae,
1003
+ onLeave: K,
1004
+ onBeforeLeave: ne
997
1005
  }, {
998
1006
  default: Ce(() => [
999
- (D(!0), B(qe, null, Ve(ne.value, (u, g) => (D(), B("div", Ge({
1007
+ (D(!0), B(qe, null, Ve(oe.value, (u, p) => (D(), B("div", Ge({
1000
1008
  key: `${u.page}-${u.id}`,
1001
1009
  class: "absolute masonry-item",
1002
1010
  ref_for: !0
1003
- }, Ue(Mt)(u, g), {
1004
- style: { paddingTop: `${m.value.header}px`, paddingBottom: `${m.value.footer}px` }
1011
+ }, Ue(Mt)(u, p), {
1012
+ style: { paddingTop: `${v.value.header}px`, paddingBottom: `${v.value.footer}px` }
1005
1013
  }), [
1006
1014
  $e(t.$slots, "default", {
1007
1015
  item: u,
@@ -1016,23 +1024,23 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
1016
1024
  ]),
1017
1025
  _: 3
1018
1026
  }),
1019
- x.value > 0 ? (D(), B("div", {
1027
+ d.value > 0 ? (D(), B("div", {
1020
1028
  key: 0,
1021
- class: se(["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": !P.value.isNearTrigger, "opacity-100": P.value.isNearTrigger }])
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 }])
1022
1030
  }, [
1023
- k("span", null, ie(n.value.length) + " items", 1),
1024
- r[0] || (r[0] = k("span", { class: "mx-2" }, "|", -1)),
1025
- k("span", null, ie(P.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)
1026
1034
  ], 2)) : X("", !0)
1027
1035
  ], 4)
1028
1036
  ], 2));
1029
1037
  }
1030
- }), Rt = (e, o) => {
1038
+ }), Bt = (e, r) => {
1031
1039
  const l = e.__vccOpts || e;
1032
- for (const [s, T] of o)
1033
- l[s] = T;
1040
+ for (const [s, w] of r)
1041
+ l[s] = w;
1034
1042
  return l;
1035
- }, Ee = /* @__PURE__ */ Rt(zt, [["__scopeId", "data-v-110c3294"]]), Ct = {
1043
+ }, Ee = /* @__PURE__ */ Bt(jt, [["__scopeId", "data-v-110c3294"]]), zt = {
1036
1044
  install(e) {
1037
1045
  e.component("WyxosMasonry", Ee), e.component("WMasonry", Ee), e.component("WyxosMasonryItem", pe), e.component("WMasonryItem", pe);
1038
1046
  }
@@ -1040,5 +1048,5 @@ const kt = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm hover:sh
1040
1048
  export {
1041
1049
  Ee as Masonry,
1042
1050
  pe as MasonryItem,
1043
- Ct as default
1051
+ zt as default
1044
1052
  };