@wyxos/vibe 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { nextTick as ee, defineComponent as Ne, computed as ae, ref as j, onMounted as $e, onUnmounted as Ae, createElementBlock as re, openBlock as oe, normalizeClass as he, createElementVNode as V, normalizeStyle as We, createVNode as Be, createCommentVNode as ze, TransitionGroup as Fe, withCtx as Oe, Fragment as De, renderList as je, mergeProps as me, unref as Re, renderSlot as _e, toDisplayString as ve } from "vue";
1
+ import { nextTick as J, defineComponent as $e, computed as re, ref as B, onMounted as We, onUnmounted as Oe, createElementBlock as oe, openBlock as le, normalizeClass as ve, createElementVNode as V, normalizeStyle as Be, createVNode as ze, createCommentVNode as Fe, TransitionGroup as De, withCtx as je, Fragment as Re, renderList as Ce, mergeProps as me, unref as _e, renderSlot as qe, toDisplayString as be } from "vue";
2
2
  let se = null;
3
- function Ce() {
3
+ function Ve() {
4
4
  if (se != null) return se;
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);
@@ -9,15 +9,15 @@ function Ce() {
9
9
  const i = e.offsetWidth - o.offsetWidth;
10
10
  return document.body.removeChild(e), se = i, i;
11
11
  }
12
- function qe(e, o, i, s = {}) {
12
+ function Ge(e, o, i, s = {}) {
13
13
  const {
14
- gutterX: m = 0,
15
- gutterY: v = 0,
14
+ gutterX: b = 0,
15
+ gutterY: x = 0,
16
16
  header: n = 0,
17
17
  footer: r = 0,
18
18
  paddingLeft: y = 0,
19
- paddingRight: c = 0,
20
- sizes: f = {
19
+ paddingRight: u = 0,
20
+ sizes: c = {
21
21
  base: 1,
22
22
  sm: 2,
23
23
  md: 3,
@@ -25,191 +25,191 @@ function qe(e, o, i, s = {}) {
25
25
  xl: 5,
26
26
  "2xl": 6
27
27
  },
28
- placement: d = "masonry"
28
+ placement: v = "masonry"
29
29
  } = s;
30
- let x = 0, w = 0;
30
+ let g = 0, m = 0;
31
31
  try {
32
32
  if (o && o.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
33
- const b = window.getComputedStyle(o);
34
- x = parseFloat(b.paddingLeft) || 0, w = parseFloat(b.paddingRight) || 0;
33
+ const w = window.getComputedStyle(o);
34
+ g = parseFloat(w.paddingLeft) || 0, m = parseFloat(w.paddingRight) || 0;
35
35
  }
36
36
  } catch {
37
37
  }
38
- const W = (y || 0) + x, R = (c || 0) + w, T = o.offsetWidth - o.clientWidth, M = T > 0 ? T + 2 : Ce() + 2, N = o.offsetWidth - M - W - R, F = m * (i - 1), H = Math.floor((N - F) / i), k = e.map((b) => {
39
- const L = b.width, S = b.height;
40
- return Math.round(H * S / L) + r + n;
38
+ const O = (y || 0) + g, R = (u || 0) + m, E = o.offsetWidth - o.clientWidth, T = E > 0 ? E + 2 : Ve() + 2, I = o.offsetWidth - T - O - R, q = b * (i - 1), S = Math.floor((I - q) / i), M = e.map((w) => {
39
+ const L = w.width, P = w.height;
40
+ return Math.round(S * P / L) + r + n;
41
41
  });
42
- if (d === "sequential-balanced") {
43
- const b = k.length;
44
- if (b === 0) return [];
45
- const L = (p, I, A) => p + (I > 0 ? v : 0) + A;
46
- let S = Math.max(...k), O = k.reduce((p, I) => p + I, 0) + v * Math.max(0, b - 1);
47
- const Y = (p) => {
48
- let I = 1, A = 0, _ = 0;
49
- for (let z = 0; z < b; z++) {
50
- const q = k[z], D = L(A, _, q);
51
- if (D <= p)
52
- A = D, _++;
53
- else if (I++, A = q, _ = 1, q > p || I > i) return !1;
42
+ if (v === "sequential-balanced") {
43
+ const w = M.length;
44
+ if (w === 0) return [];
45
+ const L = (h, H, W) => h + (H > 0 ? x : 0) + W;
46
+ let P = Math.max(...M), z = M.reduce((h, H) => h + H, 0) + x * Math.max(0, w - 1);
47
+ const K = (h) => {
48
+ let H = 1, W = 0, F = 0;
49
+ for (let N = 0; N < w; N++) {
50
+ const _ = M[N], D = L(W, F, _);
51
+ if (D <= h)
52
+ W = D, F++;
53
+ else if (H++, W = _, F = 1, _ > h || H > i) return !1;
54
54
  }
55
- return I <= i;
55
+ return H <= i;
56
56
  };
57
- for (; S < O; ) {
58
- const p = Math.floor((S + O) / 2);
59
- Y(p) ? O = p : S = p + 1;
57
+ for (; P < z; ) {
58
+ const h = Math.floor((P + z) / 2);
59
+ K(h) ? z = h : P = h + 1;
60
60
  }
61
- const J = O, G = new Array(i).fill(0);
62
- let K = i - 1, U = 0, B = 0;
63
- for (let p = b - 1; p >= 0; p--) {
64
- const I = k[p], A = p < K;
65
- !(L(U, B, I) <= J) || A ? (G[K] = p + 1, K--, U = I, B = 1) : (U = L(U, B, I), B++);
61
+ const Q = z, G = new Array(i).fill(0);
62
+ let Z = i - 1, U = 0, X = 0;
63
+ for (let h = w - 1; h >= 0; h--) {
64
+ const H = M[h], W = h < Z;
65
+ !(L(U, X, H) <= Q) || W ? (G[Z] = h + 1, Z--, U = H, X = 1) : (U = L(U, X, H), X++);
66
66
  }
67
67
  G[0] = 0;
68
- const Q = [], X = new Array(i).fill(0);
69
- for (let p = 0; p < i; p++) {
70
- const I = G[p], A = p + 1 < i ? G[p + 1] : b, _ = p * (H + m);
71
- for (let z = I; z < A; z++) {
68
+ const C = [], ee = new Array(i).fill(0);
69
+ for (let h = 0; h < i; h++) {
70
+ const H = G[h], W = h + 1 < i ? G[h + 1] : w, F = h * (S + b);
71
+ for (let N = H; N < W; N++) {
72
72
  const D = {
73
- ...e[z],
74
- columnWidth: H,
73
+ ...e[N],
74
+ columnWidth: S,
75
75
  imageHeight: 0,
76
76
  columnHeight: 0,
77
77
  left: 0,
78
78
  top: 0
79
79
  };
80
- D.imageHeight = k[z] - (r + n), D.columnHeight = k[z], D.left = _, D.top = X[p], X[p] += D.columnHeight + (z + 1 < A ? v : 0), Q.push(D);
80
+ D.imageHeight = M[N] - (r + n), D.columnHeight = M[N], D.left = F, D.top = ee[h], ee[h] += D.columnHeight + (N + 1 < W ? x : 0), C.push(D);
81
81
  }
82
82
  }
83
- return Q;
83
+ return C;
84
84
  }
85
- const h = new Array(i).fill(0), $ = [];
86
- for (let b = 0; b < e.length; b++) {
87
- const L = e[b], S = {
85
+ const p = new Array(i).fill(0), $ = [];
86
+ for (let w = 0; w < e.length; w++) {
87
+ const L = e[w], P = {
88
88
  ...L,
89
89
  columnWidth: 0,
90
90
  imageHeight: 0,
91
91
  columnHeight: 0,
92
92
  left: 0,
93
93
  top: 0
94
- }, O = h.indexOf(Math.min(...h)), Y = L.width, J = L.height;
95
- S.columnWidth = H, S.left = O * (H + m), S.imageHeight = Math.round(H * J / Y), S.columnHeight = S.imageHeight + r + n, S.top = h[O], h[O] += S.columnHeight + v, $.push(S);
94
+ }, z = p.indexOf(Math.min(...p)), K = L.width, Q = L.height;
95
+ P.columnWidth = S, P.left = z * (S + b), P.imageHeight = Math.round(S * Q / K), P.columnHeight = P.imageHeight + r + n, P.top = p[z], p[z] += P.columnHeight + x, $.push(P);
96
96
  }
97
97
  return $;
98
98
  }
99
- var Ve = typeof global == "object" && global && global.Object === Object && global, Ge = typeof self == "object" && self && self.Object === Object && self, Ie = Ve || Ge || Function("return this")(), ie = Ie.Symbol, Pe = Object.prototype, Ue = Pe.hasOwnProperty, Xe = Pe.toString, Z = ie ? ie.toStringTag : void 0;
100
- function Ye(e) {
101
- var o = Ue.call(e, Z), i = e[Z];
99
+ var Ue = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, Se = Ue || Xe || Function("return this")(), ie = Se.Symbol, He = Object.prototype, Ye = He.hasOwnProperty, Je = He.toString, ne = ie ? ie.toStringTag : void 0;
100
+ function Ke(e) {
101
+ var o = Ye.call(e, ne), i = e[ne];
102
102
  try {
103
- e[Z] = void 0;
103
+ e[ne] = void 0;
104
104
  var s = !0;
105
105
  } catch {
106
106
  }
107
- var m = Xe.call(e);
108
- return s && (o ? e[Z] = i : delete e[Z]), m;
107
+ var b = Je.call(e);
108
+ return s && (o ? e[ne] = i : delete e[ne]), b;
109
109
  }
110
- var Je = Object.prototype, Ke = Je.toString;
111
- function Qe(e) {
112
- return Ke.call(e);
110
+ var Qe = Object.prototype, Ze = Qe.toString;
111
+ function et(e) {
112
+ return Ze.call(e);
113
113
  }
114
- var Ze = "[object Null]", et = "[object Undefined]", be = ie ? ie.toStringTag : void 0;
115
- function tt(e) {
116
- return e == null ? e === void 0 ? et : Ze : be && be in Object(e) ? Ye(e) : Qe(e);
114
+ var tt = "[object Null]", nt = "[object Undefined]", xe = ie ? ie.toStringTag : void 0;
115
+ function at(e) {
116
+ return e == null ? e === void 0 ? nt : tt : xe && xe in Object(e) ? Ke(e) : et(e);
117
117
  }
118
- function nt(e) {
118
+ function rt(e) {
119
119
  return e != null && typeof e == "object";
120
120
  }
121
- var at = "[object Symbol]";
122
- function rt(e) {
123
- return typeof e == "symbol" || nt(e) && tt(e) == at;
121
+ var ot = "[object Symbol]";
122
+ function lt(e) {
123
+ return typeof e == "symbol" || rt(e) && at(e) == ot;
124
124
  }
125
- var ot = /\s/;
126
- function it(e) {
127
- for (var o = e.length; o-- && ot.test(e.charAt(o)); )
125
+ var it = /\s/;
126
+ function st(e) {
127
+ for (var o = e.length; o-- && it.test(e.charAt(o)); )
128
128
  ;
129
129
  return o;
130
130
  }
131
- var st = /^\s+/;
132
- function lt(e) {
133
- return e && e.slice(0, it(e) + 1).replace(st, "");
131
+ var ut = /^\s+/;
132
+ function ct(e) {
133
+ return e && e.slice(0, st(e) + 1).replace(ut, "");
134
134
  }
135
135
  function ce(e) {
136
136
  var o = typeof e;
137
137
  return e != null && (o == "object" || o == "function");
138
138
  }
139
- var xe = NaN, ct = /^[-+]0x[0-9a-f]+$/i, ut = /^0b[01]+$/i, ft = /^0o[0-7]+$/i, dt = parseInt;
140
- function we(e) {
139
+ var we = NaN, ft = /^[-+]0x[0-9a-f]+$/i, dt = /^0b[01]+$/i, gt = /^0o[0-7]+$/i, ht = parseInt;
140
+ function Te(e) {
141
141
  if (typeof e == "number")
142
142
  return e;
143
- if (rt(e))
144
- return xe;
143
+ if (lt(e))
144
+ return we;
145
145
  if (ce(e)) {
146
146
  var o = typeof e.valueOf == "function" ? e.valueOf() : e;
147
147
  e = ce(o) ? o + "" : o;
148
148
  }
149
149
  if (typeof e != "string")
150
150
  return e === 0 ? e : +e;
151
- e = lt(e);
152
- var i = ut.test(e);
153
- return i || ft.test(e) ? dt(e.slice(2), i ? 2 : 8) : ct.test(e) ? xe : +e;
151
+ e = ct(e);
152
+ var i = dt.test(e);
153
+ return i || gt.test(e) ? ht(e.slice(2), i ? 2 : 8) : ft.test(e) ? we : +e;
154
154
  }
155
- var le = function() {
156
- return Ie.Date.now();
157
- }, gt = "Expected a function", pt = Math.max, yt = Math.min;
158
- function Te(e, o, i) {
159
- var s, m, v, n, r, y, c = 0, f = !1, d = !1, x = !0;
155
+ var ue = function() {
156
+ return Se.Date.now();
157
+ }, pt = "Expected a function", yt = Math.max, vt = Math.min;
158
+ function Me(e, o, i) {
159
+ var s, b, x, n, r, y, u = 0, c = !1, v = !1, g = !0;
160
160
  if (typeof e != "function")
161
- throw new TypeError(gt);
162
- o = we(o) || 0, ce(i) && (f = !!i.leading, d = "maxWait" in i, v = d ? pt(we(i.maxWait) || 0, o) : v, x = "trailing" in i ? !!i.trailing : x);
163
- function w(h) {
164
- var $ = s, b = m;
165
- return s = m = void 0, c = h, n = e.apply(b, $), n;
161
+ throw new TypeError(pt);
162
+ o = Te(o) || 0, ce(i) && (c = !!i.leading, v = "maxWait" in i, x = v ? yt(Te(i.maxWait) || 0, o) : x, g = "trailing" in i ? !!i.trailing : g);
163
+ function m(p) {
164
+ var $ = s, w = b;
165
+ return s = b = void 0, u = p, n = e.apply(w, $), n;
166
166
  }
167
- function W(h) {
168
- return c = h, r = setTimeout(M, o), f ? w(h) : n;
167
+ function O(p) {
168
+ return u = p, r = setTimeout(T, o), c ? m(p) : n;
169
169
  }
170
- function R(h) {
171
- var $ = h - y, b = h - c, L = o - $;
172
- return d ? yt(L, v - b) : L;
170
+ function R(p) {
171
+ var $ = p - y, w = p - u, L = o - $;
172
+ return v ? vt(L, x - w) : L;
173
173
  }
174
- function T(h) {
175
- var $ = h - y, b = h - c;
176
- return y === void 0 || $ >= o || $ < 0 || d && b >= v;
174
+ function E(p) {
175
+ var $ = p - y, w = p - u;
176
+ return y === void 0 || $ >= o || $ < 0 || v && w >= x;
177
177
  }
178
- function M() {
179
- var h = le();
180
- if (T(h))
181
- return N(h);
182
- r = setTimeout(M, R(h));
178
+ function T() {
179
+ var p = ue();
180
+ if (E(p))
181
+ return I(p);
182
+ r = setTimeout(T, R(p));
183
183
  }
184
- function N(h) {
185
- return r = void 0, x && s ? w(h) : (s = m = void 0, n);
184
+ function I(p) {
185
+ return r = void 0, g && s ? m(p) : (s = b = void 0, n);
186
186
  }
187
- function F() {
188
- r !== void 0 && clearTimeout(r), c = 0, s = y = m = r = void 0;
187
+ function q() {
188
+ r !== void 0 && clearTimeout(r), u = 0, s = y = b = r = void 0;
189
189
  }
190
- function H() {
191
- return r === void 0 ? n : N(le());
190
+ function S() {
191
+ return r === void 0 ? n : I(ue());
192
192
  }
193
- function k() {
194
- var h = le(), $ = T(h);
195
- if (s = arguments, m = this, y = h, $) {
193
+ function M() {
194
+ var p = ue(), $ = E(p);
195
+ if (s = arguments, b = this, y = p, $) {
196
196
  if (r === void 0)
197
- return W(y);
198
- if (d)
199
- return clearTimeout(r), r = setTimeout(M, o), w(y);
197
+ return O(y);
198
+ if (v)
199
+ return clearTimeout(r), r = setTimeout(T, o), m(y);
200
200
  }
201
- return r === void 0 && (r = setTimeout(M, o)), n;
201
+ return r === void 0 && (r = setTimeout(T, o)), n;
202
202
  }
203
- return k.cancel = F, k.flush = H, k;
203
+ return M.cancel = q, M.flush = S, M;
204
204
  }
205
- function Me(e) {
205
+ function Pe(e) {
206
206
  const o = window.innerWidth, i = e.sizes;
207
207
  return o >= 1536 && i["2xl"] ? i["2xl"] : o >= 1280 && i.xl ? i.xl : o >= 1024 && i.lg ? i.lg : o >= 768 && i.md ? i.md : o >= 640 && i.sm ? i.sm : i.base;
208
208
  }
209
- function ht(e) {
209
+ function mt(e) {
210
210
  return e.reduce((i, s) => Math.max(i, s.top + s.columnHeight), 0) + 500;
211
211
  }
212
- function mt(e) {
212
+ function bt(e) {
213
213
  return {
214
214
  transform: `translate3d(${e.left}px, ${e.top}px, 0)`,
215
215
  top: "0px",
@@ -218,102 +218,102 @@ function mt(e) {
218
218
  height: `${e.columnHeight}px`
219
219
  };
220
220
  }
221
- function vt(e, o = 0) {
221
+ function xt(e, o = 0) {
222
222
  return {
223
- style: mt(e),
223
+ style: bt(e),
224
224
  "data-top": e.top,
225
225
  "data-left": e.left,
226
226
  "data-id": `${e.page}-${e.id}`,
227
227
  "data-index": o
228
228
  };
229
229
  }
230
- function ue(e, o) {
230
+ function fe(e, o) {
231
231
  if (!e.length || o <= 0)
232
232
  return new Array(Math.max(1, o)).fill(0);
233
- const s = Array.from(new Set(e.map((n) => n.left))).sort((n, r) => n - r).slice(0, o), m = /* @__PURE__ */ new Map();
234
- for (let n = 0; n < s.length; n++) m.set(s[n], n);
235
- const v = new Array(s.length).fill(0);
233
+ const s = Array.from(new Set(e.map((n) => n.left))).sort((n, r) => n - r).slice(0, o), b = /* @__PURE__ */ new Map();
234
+ for (let n = 0; n < s.length; n++) b.set(s[n], n);
235
+ const x = new Array(s.length).fill(0);
236
236
  for (const n of e) {
237
- const r = m.get(n.left);
238
- r != null && (v[r] = Math.max(v[r], n.top + n.columnHeight));
237
+ const r = b.get(n.left);
238
+ r != null && (x[r] = Math.max(x[r], n.top + n.columnHeight));
239
239
  }
240
- for (; v.length < o; ) v.push(0);
241
- return v;
240
+ for (; x.length < o; ) x.push(0);
241
+ return x;
242
242
  }
243
- function bt(e, o) {
243
+ function wt(e, o) {
244
244
  function i(n, r) {
245
- const y = parseInt(n.dataset.left || "0", 10), c = parseInt(n.dataset.top || "0", 10), f = parseInt(n.dataset.index || "0", 10), d = Math.min(f * 20, 160), x = n.style.getPropertyValue("--masonry-opacity-delay");
246
- n.style.setProperty("--masonry-opacity-delay", `${d}ms`), requestAnimationFrame(() => {
247
- n.style.opacity = "1", n.style.transform = `translate3d(${y}px, ${c}px, 0) scale(1)`;
248
- const w = () => {
249
- x ? n.style.setProperty("--masonry-opacity-delay", x) : n.style.removeProperty("--masonry-opacity-delay"), n.removeEventListener("transitionend", w), r();
245
+ const y = parseInt(n.dataset.left || "0", 10), u = parseInt(n.dataset.top || "0", 10), c = parseInt(n.dataset.index || "0", 10), v = Math.min(c * 20, 160), g = n.style.getPropertyValue("--masonry-opacity-delay");
246
+ n.style.setProperty("--masonry-opacity-delay", `${v}ms`), requestAnimationFrame(() => {
247
+ n.style.opacity = "1", n.style.transform = `translate3d(${y}px, ${u}px, 0) scale(1)`;
248
+ const m = () => {
249
+ g ? n.style.setProperty("--masonry-opacity-delay", g) : n.style.removeProperty("--masonry-opacity-delay"), n.removeEventListener("transitionend", m), r();
250
250
  };
251
- n.addEventListener("transitionend", w);
251
+ n.addEventListener("transitionend", m);
252
252
  });
253
253
  }
254
254
  function s(n) {
255
255
  const r = parseInt(n.dataset.left || "0", 10), y = parseInt(n.dataset.top || "0", 10);
256
256
  n.style.opacity = "0", n.style.transform = `translate3d(${r}px, ${y + 10}px, 0) scale(0.985)`;
257
257
  }
258
- function m(n) {
258
+ function b(n) {
259
259
  const r = parseInt(n.dataset.left || "0", 10), y = parseInt(n.dataset.top || "0", 10);
260
260
  n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${r}px, ${y}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
261
261
  n.style.transition = "";
262
262
  });
263
263
  }
264
- function v(n, r) {
265
- const y = parseInt(n.dataset.left || "0", 10), c = parseInt(n.dataset.top || "0", 10), f = typeof (o == null ? void 0 : o.leaveDurationMs) == "number" ? o.leaveDurationMs : NaN;
266
- let d = Number.isFinite(f) && f > 0 ? f : NaN;
267
- if (!Number.isFinite(d)) {
268
- const M = getComputedStyle(n).getPropertyValue("--masonry-leave-duration") || "", N = parseFloat(M);
269
- d = Number.isFinite(N) && N > 0 ? N : 200;
264
+ function x(n, r) {
265
+ const y = parseInt(n.dataset.left || "0", 10), u = parseInt(n.dataset.top || "0", 10), c = typeof (o == null ? void 0 : o.leaveDurationMs) == "number" ? o.leaveDurationMs : NaN;
266
+ let v = Number.isFinite(c) && c > 0 ? c : NaN;
267
+ if (!Number.isFinite(v)) {
268
+ const T = getComputedStyle(n).getPropertyValue("--masonry-leave-duration") || "", I = parseFloat(T);
269
+ v = Number.isFinite(I) && I > 0 ? I : 200;
270
270
  }
271
- const x = n.style.transitionDuration, w = () => {
272
- n.removeEventListener("transitionend", W), clearTimeout(R), n.style.transitionDuration = x || "";
273
- }, W = (T) => {
274
- (!T || T.target === n) && (w(), r());
271
+ const g = n.style.transitionDuration, m = () => {
272
+ n.removeEventListener("transitionend", O), clearTimeout(R), n.style.transitionDuration = g || "";
273
+ }, O = (E) => {
274
+ (!E || E.target === n) && (m(), r());
275
275
  }, R = setTimeout(() => {
276
- w(), r();
277
- }, d + 100);
276
+ m(), r();
277
+ }, v + 100);
278
278
  requestAnimationFrame(() => {
279
- n.style.transitionDuration = `${d}ms`, n.style.opacity = "0", n.style.transform = `translate3d(${y}px, ${c + 10}px, 0) scale(0.985)`, n.addEventListener("transitionend", W);
279
+ n.style.transitionDuration = `${v}ms`, n.style.opacity = "0", n.style.transform = `translate3d(${y}px, ${u + 10}px, 0) scale(0.985)`, n.addEventListener("transitionend", O);
280
280
  });
281
281
  }
282
282
  return {
283
283
  onEnter: i,
284
284
  onBeforeEnter: s,
285
- onBeforeLeave: m,
286
- onLeave: v
285
+ onBeforeLeave: b,
286
+ onLeave: x
287
287
  };
288
288
  }
289
- function xt({
289
+ function Tt({
290
290
  container: e,
291
291
  masonry: o,
292
292
  columns: i,
293
293
  containerHeight: s,
294
- isLoading: m,
295
- pageSize: v,
294
+ isLoading: b,
295
+ pageSize: x,
296
296
  refreshLayout: n,
297
297
  setItemsRaw: r,
298
298
  loadNext: y,
299
- loadThresholdPx: c
299
+ loadThresholdPx: u
300
300
  }) {
301
- let f = 0;
302
- async function d(x) {
301
+ let c = 0;
302
+ async function v(g) {
303
303
  if (!e.value) return;
304
- const w = x ?? ue(o.value, i.value), W = w.length ? Math.max(...w) : 0, R = e.value.scrollTop + e.value.clientHeight, T = e.value.scrollTop > f + 1;
305
- f = e.value.scrollTop;
306
- const M = typeof c == "number" ? c : 200, N = M >= 0 ? Math.max(0, W - M) : Math.max(0, W + M);
307
- if (R >= N && T && !m.value) {
308
- await y(), await ee();
304
+ const m = g ?? fe(o.value, i.value), O = m.length ? Math.max(...m) : 0, R = e.value.scrollTop + e.value.clientHeight, E = e.value.scrollTop > c + 1;
305
+ c = e.value.scrollTop;
306
+ const T = typeof u == "number" ? u : 200, I = T >= 0 ? Math.max(0, O - T) : Math.max(0, O + T);
307
+ if (R >= I && E && !b.value) {
308
+ await y(), await J();
309
309
  return;
310
310
  }
311
311
  }
312
312
  return {
313
- handleScroll: d
313
+ handleScroll: v
314
314
  };
315
315
  }
316
- const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
316
+ const Mt = ["src"], Pt = ["onClick"], It = /* @__PURE__ */ $e({
317
317
  __name: "Masonry",
318
318
  props: {
319
319
  getNextPage: {
@@ -397,6 +397,10 @@ const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
397
397
  loadThresholdPx: {
398
398
  type: Number,
399
399
  default: 200
400
+ },
401
+ autoRefreshOnEmpty: {
402
+ type: Boolean,
403
+ default: !1
400
404
  }
401
405
  },
402
406
  emits: [
@@ -410,7 +414,7 @@ const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
410
414
  "remove-all:complete"
411
415
  ],
412
416
  setup(e, { expose: o, emit: i }) {
413
- const s = e, m = {
417
+ const s = e, b = {
414
418
  sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
415
419
  gutterX: 10,
416
420
  gutterY: 10,
@@ -419,41 +423,41 @@ const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
419
423
  paddingLeft: 0,
420
424
  paddingRight: 0,
421
425
  placement: "masonry"
422
- }, v = ae(() => {
426
+ }, x = re(() => {
423
427
  var t;
424
428
  return {
425
- ...m,
429
+ ...b,
426
430
  ...s.layout,
427
431
  sizes: {
428
- ...m.sizes,
432
+ ...b.sizes,
429
433
  ...((t = s.layout) == null ? void 0 : t.sizes) || {}
430
434
  }
431
435
  };
432
- }), n = i, r = ae({
436
+ }), n = i, r = re({
433
437
  get: () => s.items,
434
438
  set: (t) => n("update:items", t)
435
- }), y = j(7), c = j(null), f = j([]), d = j(!1), x = j(0), w = j(/* @__PURE__ */ new Set());
436
- function W(t) {
439
+ }), y = B(7), u = B(null), c = B([]), v = B(null), g = B(!1), m = B(0), O = B(/* @__PURE__ */ new Set());
440
+ function R(t) {
437
441
  return typeof t == "number" && Number.isFinite(t) && t > 0;
438
442
  }
439
- function R(t, a) {
443
+ function E(t, a) {
440
444
  try {
441
445
  if (!Array.isArray(t) || t.length === 0) return;
442
- const l = t.filter((g) => !W(g == null ? void 0 : g.width) || !W(g == null ? void 0 : g.height));
446
+ const l = t.filter((d) => !R(d == null ? void 0 : d.width) || !R(d == null ? void 0 : d.height));
443
447
  if (l.length === 0) return;
444
- const u = [];
445
- for (const g of l) {
446
- const P = (g == null ? void 0 : g.id) ?? `idx:${t.indexOf(g)}`;
447
- w.value.has(P) || (w.value.add(P), u.push(P));
448
+ const f = [];
449
+ for (const d of l) {
450
+ const A = (d == null ? void 0 : d.id) ?? `idx:${t.indexOf(d)}`;
451
+ O.value.has(A) || (O.value.add(A), f.push(A));
448
452
  }
449
- if (u.length > 0) {
450
- const g = u.slice(0, 10);
453
+ if (f.length > 0) {
454
+ const d = f.slice(0, 10);
451
455
  console.warn(
452
456
  "[Masonry] Items missing width/height detected:",
453
457
  {
454
458
  context: a,
455
- count: u.length,
456
- sampleIds: g,
459
+ count: f.length,
460
+ sampleIds: d,
457
461
  hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
458
462
  }
459
463
  );
@@ -461,315 +465,363 @@ const wt = ["src"], Tt = ["onClick"], Mt = /* @__PURE__ */ Ne({
461
465
  } catch {
462
466
  }
463
467
  }
464
- const T = j(0), M = j(0), N = s.virtualBufferPx, F = j(!1), H = j({
468
+ const T = B(0), I = B(0), q = s.virtualBufferPx, S = B(!1), M = B({
465
469
  distanceToTrigger: 0,
466
470
  isNearTrigger: !1
467
- }), k = (t) => {
468
- if (!c.value) return;
469
- const { scrollTop: a, clientHeight: l } = c.value, u = a + l, g = t ?? ue(r.value, y.value), P = g.length ? Math.max(...g) : 0, C = typeof s.loadThresholdPx == "number" ? s.loadThresholdPx : 200, ne = C >= 0 ? Math.max(0, P - C) : Math.max(0, P + C), ye = Math.max(0, ne - u), Ee = ye <= 100;
470
- H.value = {
471
+ }), p = (t) => {
472
+ if (!u.value) return;
473
+ const { scrollTop: a, clientHeight: l } = u.value, f = a + l, d = t ?? fe(r.value, y.value), A = d.length ? Math.max(...d) : 0, j = typeof s.loadThresholdPx == "number" ? s.loadThresholdPx : 200, Y = j >= 0 ? Math.max(0, A - j) : Math.max(0, A + j), ye = Math.max(0, Y - f), Ae = ye <= 100;
474
+ M.value = {
471
475
  distanceToTrigger: Math.round(ye),
472
- isNearTrigger: Ee
476
+ isNearTrigger: Ae
473
477
  };
474
- }, { onEnter: h, onBeforeEnter: $, onBeforeLeave: b, onLeave: L } = bt(r, { leaveDurationMs: s.leaveDurationMs });
475
- function S(t, a) {
476
- if (F.value) {
477
- const l = parseInt(t.dataset.left || "0", 10), u = parseInt(t.dataset.top || "0", 10);
478
- t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${l}px, ${u}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
478
+ }, { onEnter: $, onBeforeEnter: w, onBeforeLeave: L, onLeave: P } = wt(r, { leaveDurationMs: s.leaveDurationMs });
479
+ function z(t, a) {
480
+ if (S.value) {
481
+ const l = parseInt(t.dataset.left || "0", 10), f = parseInt(t.dataset.top || "0", 10);
482
+ t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${l}px, ${f}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
479
483
  t.style.transition = "", a();
480
484
  });
481
485
  } else
482
- h(t, a);
486
+ $(t, a);
483
487
  }
484
- function O(t) {
485
- if (F.value) {
488
+ function K(t) {
489
+ if (S.value) {
486
490
  const a = parseInt(t.dataset.left || "0", 10), l = parseInt(t.dataset.top || "0", 10);
487
491
  t.style.transition = "none", t.style.opacity = "1", t.style.transform = `translate3d(${a}px, ${l}px, 0) scale(1)`, t.style.removeProperty("--masonry-opacity-delay");
488
492
  } else
489
- $(t);
493
+ w(t);
490
494
  }
491
- function Y(t) {
492
- F.value || b(t);
495
+ function Q(t) {
496
+ S.value || L(t);
493
497
  }
494
- function J(t, a) {
495
- F.value ? a() : L(t, a);
498
+ function G(t, a) {
499
+ S.value ? a() : P(t, a);
496
500
  }
497
- const G = ae(() => {
498
- const t = T.value - N, a = T.value + M.value + N, l = r.value;
499
- return !l || l.length === 0 ? [] : l.filter((u) => {
500
- const g = u.top;
501
- return u.top + u.columnHeight >= t && g <= a;
501
+ const Z = re(() => {
502
+ const t = T.value - q, a = T.value + I.value + q, l = r.value;
503
+ return !l || l.length === 0 ? [] : l.filter((f) => {
504
+ const d = f.top;
505
+ return f.top + f.columnHeight >= t && d <= a;
502
506
  });
503
- }), { handleScroll: K } = xt({
504
- container: c,
507
+ }), { handleScroll: U } = Tt({
508
+ container: u,
505
509
  masonry: r,
506
510
  columns: y,
507
- containerHeight: x,
508
- isLoading: d,
511
+ containerHeight: m,
512
+ isLoading: g,
509
513
  pageSize: s.pageSize,
510
- refreshLayout: B,
514
+ refreshLayout: C,
511
515
  setItemsRaw: (t) => {
512
516
  r.value = t;
513
517
  },
514
- loadNext: A,
518
+ loadNext: F,
515
519
  loadThresholdPx: s.loadThresholdPx
516
520
  });
517
521
  o({
518
- isLoading: d,
519
- refreshLayout: B,
520
- containerHeight: x,
522
+ isLoading: g,
523
+ refreshLayout: C,
524
+ containerHeight: m,
521
525
  remove: _,
522
- removeMany: z,
523
- removeAll: D,
524
- loadNext: A,
525
- loadPage: I,
526
- reset: He,
527
- init: Le,
528
- paginationHistory: f,
529
- cancelLoad: de,
530
- scrollToTop: q,
531
- totalItems: ae(() => r.value.length)
526
+ removeMany: D,
527
+ removeAll: ke,
528
+ loadNext: F,
529
+ loadPage: W,
530
+ refreshCurrentPage: N,
531
+ reset: Le,
532
+ init: Ne,
533
+ paginationHistory: c,
534
+ cancelLoad: ge,
535
+ scrollToTop: de,
536
+ totalItems: re(() => r.value.length)
532
537
  });
533
- function U(t) {
534
- const a = ht(t);
538
+ function X(t) {
539
+ const a = mt(t);
535
540
  let l = 0;
536
- if (c.value) {
537
- const { scrollTop: u, clientHeight: g } = c.value;
538
- l = u + g + 100;
541
+ if (u.value) {
542
+ const { scrollTop: f, clientHeight: d } = u.value;
543
+ l = f + d + 100;
539
544
  }
540
- x.value = Math.max(a, l);
545
+ m.value = Math.max(a, l);
541
546
  }
542
- function B(t) {
543
- if (!c.value) return;
544
- R(t, "refreshLayout");
545
- const a = qe(t, c.value, y.value, v.value);
546
- U(a), r.value = a;
547
+ function C(t) {
548
+ if (!u.value) return;
549
+ E(t, "refreshLayout");
550
+ const a = t.map((f, d) => ({
551
+ ...f,
552
+ originalIndex: f.originalIndex ?? d
553
+ })), l = Ge(a, u.value, y.value, x.value);
554
+ X(l), r.value = l;
547
555
  }
548
- function Q(t, a) {
556
+ function ee(t, a) {
549
557
  return new Promise((l) => {
550
- const u = Math.max(0, t | 0), g = Date.now();
551
- a(u, u);
552
- const P = setInterval(() => {
553
- if (E.value) {
554
- clearInterval(P), l();
558
+ const f = Math.max(0, t | 0), d = Date.now();
559
+ a(f, f);
560
+ const A = setInterval(() => {
561
+ if (k.value) {
562
+ clearInterval(A), l();
555
563
  return;
556
564
  }
557
- const C = Date.now() - g, ne = Math.max(0, u - C);
558
- a(ne, u), ne <= 0 && (clearInterval(P), l());
565
+ const j = Date.now() - d, Y = Math.max(0, f - j);
566
+ a(Y, f), Y <= 0 && (clearInterval(A), l());
559
567
  }, 100);
560
568
  });
561
569
  }
562
- async function X(t) {
570
+ async function h(t) {
563
571
  try {
564
- const a = await p(() => s.getNextPage(t));
565
- return B([...r.value, ...a.items]), a;
572
+ const a = await H(() => s.getNextPage(t));
573
+ return C([...r.value, ...a.items]), a;
566
574
  } catch (a) {
567
575
  throw console.error("Error in getContent:", a), a;
568
576
  }
569
577
  }
570
- async function p(t) {
578
+ async function H(t) {
571
579
  let a = 0;
572
580
  const l = s.retryMaxAttempts;
573
- let u = s.retryInitialDelayMs;
581
+ let f = s.retryInitialDelayMs;
574
582
  for (; ; )
575
583
  try {
576
- const g = await t();
577
- return a > 0 && n("retry:stop", { attempt: a, success: !0 }), g;
578
- } catch (g) {
584
+ const d = await t();
585
+ return a > 0 && n("retry:stop", { attempt: a, success: !0 }), d;
586
+ } catch (d) {
579
587
  if (a++, a > l)
580
- throw n("retry:stop", { attempt: a - 1, success: !1 }), g;
581
- n("retry:start", { attempt: a, max: l, totalMs: u }), await Q(u, (P, C) => {
582
- n("retry:tick", { attempt: a, remainingMs: P, totalMs: C });
583
- }), u += s.retryBackoffStepMs;
588
+ throw n("retry:stop", { attempt: a - 1, success: !1 }), d;
589
+ n("retry:start", { attempt: a, max: l, totalMs: f }), await ee(f, (A, j) => {
590
+ n("retry:tick", { attempt: a, remainingMs: A, totalMs: j });
591
+ }), f += s.retryBackoffStepMs;
584
592
  }
585
593
  }
586
- async function I(t) {
587
- if (!(d.value || E.value)) {
588
- d.value = !0, E.value = !1;
594
+ async function W(t) {
595
+ if (!g.value) {
596
+ k.value = !1, g.value = !0;
589
597
  try {
590
598
  const a = r.value.length;
591
- if (E.value) return;
592
- const l = await X(t);
593
- return E.value ? void 0 : (f.value.push(l.nextPage), await fe(a), l);
599
+ if (k.value) return;
600
+ const l = await h(t);
601
+ return k.value ? void 0 : (v.value = t, c.value.push(l.nextPage), await te(a), l);
594
602
  } catch (a) {
595
603
  throw console.error("Error loading page:", a), a;
596
604
  } finally {
597
- d.value = !1;
605
+ g.value = !1;
598
606
  }
599
607
  }
600
608
  }
601
- async function A() {
602
- if (!(d.value || E.value)) {
603
- d.value = !0, E.value = !1;
609
+ async function F() {
610
+ if (!g.value) {
611
+ k.value = !1, g.value = !0;
604
612
  try {
605
613
  const t = r.value.length;
606
- if (E.value) return;
607
- const a = f.value[f.value.length - 1], l = await X(a);
608
- return E.value ? void 0 : (f.value.push(l.nextPage), await fe(t), l);
614
+ if (k.value) return;
615
+ const a = c.value[c.value.length - 1], l = await h(a);
616
+ return k.value ? void 0 : (v.value = a, c.value.push(l.nextPage), await te(t), l);
609
617
  } catch (t) {
610
618
  throw console.error("Error loading next page:", t), t;
611
619
  } finally {
612
- d.value = !1;
620
+ g.value = !1;
621
+ }
622
+ }
623
+ }
624
+ async function N() {
625
+ if (console.log("[Masonry] refreshCurrentPage called, isLoading:", g.value, "currentPage:", v.value), !g.value) {
626
+ k.value = !1, g.value = !0;
627
+ try {
628
+ const t = v.value;
629
+ if (console.log("[Masonry] pageToRefresh:", t), t == null) {
630
+ console.warn("[Masonry] No current page to refresh - currentPage:", v.value, "paginationHistory:", c.value);
631
+ return;
632
+ }
633
+ r.value = [], m.value = 0, c.value = [t], await J();
634
+ const a = await h(t);
635
+ if (k.value) return;
636
+ v.value = t, c.value.push(a.nextPage);
637
+ const l = r.value.length;
638
+ return await te(l), a;
639
+ } catch (t) {
640
+ throw console.error("[Masonry] Error refreshing current page:", t), t;
641
+ } finally {
642
+ g.value = !1;
613
643
  }
614
644
  }
615
645
  }
616
646
  async function _(t) {
617
647
  const a = r.value.filter((l) => l.id !== t.id);
618
- r.value = a, await ee(), await new Promise((l) => requestAnimationFrame(() => l())), requestAnimationFrame(() => {
619
- B(a);
648
+ if (r.value = a, await J(), console.log("[Masonry] remove - next.length:", a.length, "paginationHistory.length:", c.value.length), a.length === 0 && c.value.length > 0) {
649
+ if (s.autoRefreshOnEmpty)
650
+ console.log("[Masonry] All items removed, calling refreshCurrentPage"), await N();
651
+ else {
652
+ console.log("[Masonry] All items removed, calling loadNext and forcing backfill");
653
+ try {
654
+ await F(), await te(0, !0);
655
+ } catch {
656
+ }
657
+ }
658
+ return;
659
+ }
660
+ await new Promise((l) => requestAnimationFrame(() => l())), requestAnimationFrame(() => {
661
+ C(a);
620
662
  });
621
663
  }
622
- async function z(t) {
664
+ async function D(t) {
623
665
  if (!t || t.length === 0) return;
624
- const a = new Set(t.map((u) => u.id)), l = r.value.filter((u) => !a.has(u.id));
625
- r.value = l, await ee(), await new Promise((u) => requestAnimationFrame(() => u())), requestAnimationFrame(() => {
626
- B(l);
666
+ const a = new Set(t.map((f) => f.id)), l = r.value.filter((f) => !a.has(f.id));
667
+ if (r.value = l, await J(), l.length === 0 && c.value.length > 0) {
668
+ if (s.autoRefreshOnEmpty)
669
+ await N();
670
+ else
671
+ try {
672
+ await F(), await te(0, !0);
673
+ } catch {
674
+ }
675
+ return;
676
+ }
677
+ await new Promise((f) => requestAnimationFrame(() => f())), requestAnimationFrame(() => {
678
+ C(l);
627
679
  });
628
680
  }
629
- function q(t) {
630
- c.value && c.value.scrollTo({
681
+ function de(t) {
682
+ u.value && u.value.scrollTo({
631
683
  top: 0,
632
684
  behavior: (t == null ? void 0 : t.behavior) ?? "smooth",
633
685
  ...t
634
686
  });
635
687
  }
636
- async function D() {
637
- q({ behavior: "smooth" }), r.value = [], x.value = 0, await ee(), n("remove-all:complete");
688
+ async function ke() {
689
+ de({ behavior: "smooth" }), r.value = [], m.value = 0, await J(), n("remove-all:complete");
638
690
  }
639
- function ke() {
640
- y.value = Me(v.value), B(r.value), c.value && (T.value = c.value.scrollTop, M.value = c.value.clientHeight);
691
+ function Ee() {
692
+ y.value = Pe(x.value), C(r.value), u.value && (T.value = u.value.scrollTop, I.value = u.value.clientHeight);
641
693
  }
642
- let te = !1;
643
- const E = j(!1);
644
- async function fe(t) {
645
- if (!s.backfillEnabled || te || E.value) return;
646
- const a = (t || 0) + (s.pageSize || 0);
647
- if (!(!s.pageSize || s.pageSize <= 0 || f.value[f.value.length - 1] == null) && !(r.value.length >= a)) {
648
- te = !0;
694
+ let ae = !1;
695
+ const k = B(!1);
696
+ async function te(t, a = !1) {
697
+ if (!a && !s.backfillEnabled || ae || k.value) return;
698
+ const l = (t || 0) + (s.pageSize || 0);
699
+ if (!(!s.pageSize || s.pageSize <= 0 || c.value[c.value.length - 1] == null) && !(r.value.length >= l)) {
700
+ ae = !0;
649
701
  try {
650
- let u = 0;
651
- for (n("backfill:start", { target: a, fetched: r.value.length, calls: u }); r.value.length < a && u < s.backfillMaxCalls && f.value[f.value.length - 1] != null && !E.value && (await Q(s.backfillDelayMs, (P, C) => {
702
+ let d = 0;
703
+ for (n("backfill:start", { target: l, fetched: r.value.length, calls: d }); r.value.length < l && d < s.backfillMaxCalls && c.value[c.value.length - 1] != null && !k.value && (await ee(s.backfillDelayMs, (j, Y) => {
652
704
  n("backfill:tick", {
653
705
  fetched: r.value.length,
654
- target: a,
655
- calls: u,
656
- remainingMs: P,
657
- totalMs: C
706
+ target: l,
707
+ calls: d,
708
+ remainingMs: j,
709
+ totalMs: Y
658
710
  });
659
- }), !E.value); ) {
660
- const g = f.value[f.value.length - 1];
711
+ }), !k.value); ) {
712
+ const A = c.value[c.value.length - 1];
661
713
  try {
662
- d.value = !0;
663
- const P = await X(g);
664
- if (E.value) break;
665
- f.value.push(P.nextPage);
714
+ g.value = !0;
715
+ const j = await h(A);
716
+ if (k.value) break;
717
+ c.value.push(j.nextPage);
666
718
  } finally {
667
- d.value = !1;
719
+ g.value = !1;
668
720
  }
669
- u++;
721
+ d++;
670
722
  }
671
- n("backfill:stop", { fetched: r.value.length, calls: u });
723
+ n("backfill:stop", { fetched: r.value.length, calls: d });
672
724
  } finally {
673
- te = !1;
725
+ ae = !1;
674
726
  }
675
727
  }
676
728
  }
677
- function de() {
678
- E.value = !0, d.value = !1, te = !1;
729
+ function ge() {
730
+ k.value = !0, g.value = !1, ae = !1;
679
731
  }
680
- function He() {
681
- de(), c.value && c.value.scrollTo({
732
+ function Le() {
733
+ ge(), k.value = !1, u.value && u.value.scrollTo({
682
734
  top: 0,
683
735
  behavior: "smooth"
684
- }), r.value = [], x.value = 0, f.value = [s.loadAtPage], H.value = {
736
+ }), r.value = [], m.value = 0, v.value = s.loadAtPage, c.value = [s.loadAtPage], M.value = {
685
737
  distanceToTrigger: 0,
686
738
  isNearTrigger: !1
687
739
  };
688
740
  }
689
- const ge = Te(async () => {
690
- c.value && (T.value = c.value.scrollTop, M.value = c.value.clientHeight), F.value = !0, await ee(), await new Promise((a) => requestAnimationFrame(() => a())), F.value = !1;
691
- const t = ue(r.value, y.value);
692
- K(t), k(t);
693
- }, 200), pe = Te(ke, 200);
694
- function Le(t, a, l) {
695
- f.value = [a], f.value.push(l), R(t, "init"), B([...r.value, ...t]), k();
741
+ const he = Me(async () => {
742
+ u.value && (T.value = u.value.scrollTop, I.value = u.value.clientHeight), S.value = !0, await J(), await new Promise((a) => requestAnimationFrame(() => a())), S.value = !1;
743
+ const t = fe(r.value, y.value);
744
+ U(t), p(t);
745
+ }, 200), pe = Me(Ee, 200);
746
+ function Ne(t, a, l) {
747
+ v.value = a, c.value = [a], c.value.push(l), E(t, "init"), C([...r.value, ...t]), p();
696
748
  }
697
- return $e(async () => {
749
+ return We(async () => {
698
750
  var t;
699
751
  try {
700
- y.value = Me(v.value), c.value && (T.value = c.value.scrollTop, M.value = c.value.clientHeight);
752
+ y.value = Pe(x.value), u.value && (T.value = u.value.scrollTop, I.value = u.value.clientHeight);
701
753
  const a = s.loadAtPage;
702
- f.value = [a], s.skipInitialLoad || await I(f.value[0]), k();
754
+ c.value = [a], s.skipInitialLoad || await W(c.value[0]), p();
703
755
  } catch (a) {
704
- console.error("Error during component initialization:", a), d.value = !1;
756
+ console.error("Error during component initialization:", a), g.value = !1;
705
757
  }
706
- (t = c.value) == null || t.addEventListener("scroll", ge, { passive: !0 }), window.addEventListener("resize", pe);
707
- }), Ae(() => {
758
+ (t = u.value) == null || t.addEventListener("scroll", he, { passive: !0 }), window.addEventListener("resize", pe);
759
+ }), Oe(() => {
708
760
  var t;
709
- (t = c.value) == null || t.removeEventListener("scroll", ge), window.removeEventListener("resize", pe);
710
- }), (t, a) => (oe(), re("div", {
711
- class: he(["overflow-auto w-full flex-1 masonry-container", { "force-motion": s.forceMotion }]),
761
+ (t = u.value) == null || t.removeEventListener("scroll", he), window.removeEventListener("resize", pe);
762
+ }), (t, a) => (le(), oe("div", {
763
+ class: ve(["overflow-auto w-full flex-1 masonry-container", { "force-motion": s.forceMotion }]),
712
764
  ref_key: "container",
713
- ref: c
765
+ ref: u
714
766
  }, [
715
767
  V("div", {
716
768
  class: "relative",
717
- style: We({ height: `${x.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
769
+ style: Be({ height: `${m.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
718
770
  }, [
719
- Be(Fe, {
771
+ ze(De, {
720
772
  name: "masonry",
721
773
  css: !1,
722
- onEnter: S,
723
- onBeforeEnter: O,
724
- onLeave: J,
725
- onBeforeLeave: Y
774
+ onEnter: z,
775
+ onBeforeEnter: K,
776
+ onLeave: G,
777
+ onBeforeLeave: Q
726
778
  }, {
727
- default: Oe(() => [
728
- (oe(!0), re(De, null, je(G.value, (l, u) => (oe(), re("div", me({
779
+ default: je(() => [
780
+ (le(!0), oe(Re, null, Ce(Z.value, (l, f) => (le(), oe("div", me({
729
781
  key: `${l.page}-${l.id}`,
730
782
  class: "absolute masonry-item",
731
783
  ref_for: !0
732
- }, Re(vt)(l, u)), [
733
- _e(t.$slots, "item", me({ ref_for: !0 }, { item: l, remove: _ }), () => [
784
+ }, _e(xt)(l, f)), [
785
+ qe(t.$slots, "item", me({ ref_for: !0 }, { item: l, remove: _ }), () => [
734
786
  V("img", {
735
787
  src: l.src,
736
788
  class: "w-full",
737
789
  loading: "lazy",
738
790
  decoding: "async"
739
- }, null, 8, wt),
791
+ }, null, 8, Mt),
740
792
  V("button", {
741
793
  class: "absolute bottom-0 right-0 bg-red-500 text-white p-2 rounded cursor-pointer",
742
- onClick: (g) => _(l)
794
+ onClick: (d) => _(l)
743
795
  }, a[0] || (a[0] = [
744
796
  V("i", { class: "fas fa-trash" }, null, -1)
745
- ]), 8, Tt)
797
+ ]), 8, Pt)
746
798
  ], !0)
747
799
  ], 16))), 128))
748
800
  ]),
749
801
  _: 3
750
802
  }),
751
- x.value > 0 ? (oe(), re("div", {
803
+ m.value > 0 ? (le(), oe("div", {
752
804
  key: 0,
753
- class: he(["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": !H.value.isNearTrigger, "opacity-100": H.value.isNearTrigger }])
805
+ class: ve(["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": !M.value.isNearTrigger, "opacity-100": M.value.isNearTrigger }])
754
806
  }, [
755
- V("span", null, ve(r.value.length) + " items", 1),
807
+ V("span", null, be(r.value.length) + " items", 1),
756
808
  a[1] || (a[1] = V("span", { class: "mx-2" }, "|", -1)),
757
- V("span", null, ve(H.value.distanceToTrigger) + "px to load", 1)
758
- ], 2)) : ze("", !0)
809
+ V("span", null, be(M.value.distanceToTrigger) + "px to load", 1)
810
+ ], 2)) : Fe("", !0)
759
811
  ], 4)
760
812
  ], 2));
761
813
  }
762
814
  }), St = (e, o) => {
763
815
  const i = e.__vccOpts || e;
764
- for (const [s, m] of o)
765
- i[s] = m;
816
+ for (const [s, b] of o)
817
+ i[s] = b;
766
818
  return i;
767
- }, Se = /* @__PURE__ */ St(Mt, [["__scopeId", "data-v-b855ca99"]]), Pt = {
819
+ }, Ie = /* @__PURE__ */ St(It, [["__scopeId", "data-v-fa62094f"]]), kt = {
768
820
  install(e) {
769
- e.component("WyxosMasonry", Se), e.component("WMasonry", Se);
821
+ e.component("WyxosMasonry", Ie), e.component("WMasonry", Ie);
770
822
  }
771
823
  };
772
824
  export {
773
- Se as Masonry,
774
- Pt as default
825
+ Ie as Masonry,
826
+ kt as default
775
827
  };