@wyxos/vibe 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/index.cjs +1 -1
  2. package/lib/index.js +474 -418
  3. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as ut, mergeDefaults as ct, useAttrs as ft, useSlots as dt, computed as B, ref as g, shallowRef as vt, watch as G, onMounted as ht, onUnmounted as gt, createElementBlock as x, openBlock as k, mergeProps as mt, createElementVNode as T, normalizeStyle as N, toDisplayString as Ve, Fragment as Ye, renderList as De, createCommentVNode as oe, renderSlot as ie, nextTick as Oe } from "vue";
2
- const pt = {
1
+ import { defineComponent as wt, mergeDefaults as yt, useAttrs as bt, useSlots as xt, computed as B, ref as g, shallowRef as kt, watch as Z, onMounted as Mt, onUnmounted as St, createElementBlock as x, openBlock as k, mergeProps as It, createElementVNode as _, normalizeStyle as z, toDisplayString as Ge, Fragment as Ue, renderList as Ke, createCommentVNode as fe, renderSlot as de, nextTick as Je } from "vue";
2
+ const Bt = {
3
3
  mode: "default",
4
4
  pageSize: 20,
5
5
  backfillRequestDelayMs: 2e3,
@@ -12,34 +12,34 @@ const pt = {
12
12
  footerHeight: 0,
13
13
  overscanPx: 600
14
14
  };
15
- function yt(n, y) {
16
- return !n || n <= 0 || !y || y <= 0 ? 1 : Math.max(1, Math.floor(n / y));
15
+ function Ft(n, w) {
16
+ return !n || n <= 0 || !w || w <= 0 ? 1 : Math.max(1, Math.floor(n / w));
17
17
  }
18
- function wt(n, y, S, l = 0) {
19
- if (!n || n <= 0 || !y || y <= 0) return S;
20
- const r = typeof l == "number" && l > 0 ? l : 0, M = Math.max(0, y - 1) * r, w = n - M;
21
- return !w || w <= 0 ? S : w / y;
18
+ function Pt(n, w, I, o = 0) {
19
+ if (!n || n <= 0 || !w || w <= 0) return I;
20
+ const r = typeof o == "number" && o > 0 ? o : 0, M = Math.max(0, w - 1) * r, y = n - M;
21
+ return !y || y <= 0 ? I : y / w;
22
22
  }
23
- function bt(n, y) {
24
- const S = n?.width, l = n?.height;
25
- return typeof S == "number" && typeof l == "number" && S > 0 && l > 0 ? l / S * y : y;
23
+ function Tt(n, w) {
24
+ const I = n?.width, o = n?.height;
25
+ return typeof I == "number" && typeof o == "number" && I > 0 && o > 0 ? o / I * w : w;
26
26
  }
27
- function Ue(n) {
27
+ function nt(n) {
28
28
  return Number.isFinite(n) && n > 0 ? Math.floor(n) : 1;
29
29
  }
30
- function we(n) {
30
+ function ke(n) {
31
31
  return Number.isFinite(n) && n > 0 ? Math.floor(n) : 0;
32
32
  }
33
- function xt(n) {
34
- async function y(l) {
35
- const r = we(l);
33
+ function _t(n) {
34
+ async function w(o) {
35
+ const r = ke(o);
36
36
  if (r <= 0) return;
37
37
  n.stats.value = {
38
38
  ...n.stats.value,
39
39
  cooldownMsTotal: r,
40
40
  cooldownMsRemaining: r
41
41
  };
42
- const M = Date.now(), w = 100;
42
+ const M = Date.now(), y = 100;
43
43
  await new Promise((m) => {
44
44
  const h = setInterval(() => {
45
45
  const p = Date.now() - M, b = Math.max(0, r - p);
@@ -48,11 +48,11 @@ function xt(n) {
48
48
  cooldownMsTotal: r,
49
49
  cooldownMsRemaining: b
50
50
  }, b <= 0 && (clearInterval(h), m());
51
- }, w);
51
+ }, y);
52
52
  });
53
53
  }
54
- async function S(l) {
55
- const r = Ue(n.getPageSize()), M = n.isEnabled(), w = we(n.getRequestDelayMs()), m = [];
54
+ async function I(o) {
55
+ const r = nt(n.getPageSize()), M = n.isEnabled(), y = ke(n.getRequestDelayMs()), m = [];
56
56
  let h = 0;
57
57
  n.buffer.value.length && (h = n.buffer.value.length, m.push(...n.buffer.value), n.buffer.value = []), n.stats.value = {
58
58
  ...n.stats.value,
@@ -60,7 +60,7 @@ function xt(n) {
60
60
  isBackfillActive: !1,
61
61
  isRequestInFlight: !1,
62
62
  requestPage: null,
63
- cooldownMsTotal: w,
63
+ cooldownMsTotal: y,
64
64
  cooldownMsRemaining: 0,
65
65
  progress: {
66
66
  collected: 0,
@@ -70,31 +70,31 @@ function xt(n) {
70
70
  bufferSize: 0
71
71
  };
72
72
  const p = [];
73
- let b = l, A = 0, _ = !1;
73
+ let b = o, H = 0, A = !1;
74
74
  for (; m.length < r && b != null; ) {
75
- const z = b;
76
- _ && (n.stats.value = {
75
+ const N = b;
76
+ A && (n.stats.value = {
77
77
  ...n.stats.value,
78
78
  enabled: M,
79
79
  isBackfillActive: !0,
80
80
  isRequestInFlight: !0,
81
- requestPage: z,
81
+ requestPage: N,
82
82
  progress: {
83
83
  collected: Math.min(m.length, r),
84
84
  target: r
85
85
  },
86
- cooldownMsTotal: w,
86
+ cooldownMsTotal: y,
87
87
  cooldownMsRemaining: 0,
88
88
  pageSize: r
89
89
  });
90
- const I = await n.getContent(z);
91
- p.push(z), _ && (n.stats.value = {
90
+ const S = await n.getContent(N);
91
+ p.push(N), A && (n.stats.value = {
92
92
  ...n.stats.value,
93
93
  enabled: M,
94
94
  isBackfillActive: !0,
95
95
  isRequestInFlight: !1,
96
96
  requestPage: null
97
- }), A += I.items.length, n.markEnterFromLeft(I.items), m.push(...I.items), b = I.nextPage, !_ && m.length < r && b != null ? (_ = !0, n.stats.value = {
97
+ }), H += S.items.length, n.markEnterFromLeft(S.items), m.push(...S.items), b = S.nextPage, !A && m.length < r && b != null ? (A = !0, n.stats.value = {
98
98
  ...n.stats.value,
99
99
  enabled: M,
100
100
  isBackfillActive: !0,
@@ -104,10 +104,10 @@ function xt(n) {
104
104
  collected: Math.min(m.length, r),
105
105
  target: r
106
106
  },
107
- cooldownMsTotal: w,
107
+ cooldownMsTotal: y,
108
108
  cooldownMsRemaining: 0,
109
109
  pageSize: r
110
- }) : _ && (n.stats.value = {
110
+ }) : A && (n.stats.value = {
111
111
  ...n.stats.value,
112
112
  enabled: M,
113
113
  isBackfillActive: !0,
@@ -115,9 +115,9 @@ function xt(n) {
115
115
  collected: Math.min(m.length, r),
116
116
  target: r
117
117
  }
118
- }), _ && m.length < r && b != null && await y(w);
118
+ }), A && m.length < r && b != null && await w(y);
119
119
  }
120
- const H = m.slice(0, r), F = m.slice(r);
120
+ const R = m.slice(0, r), F = m.slice(r);
121
121
  return n.buffer.value = F, n.stats.value = {
122
122
  ...n.stats.value,
123
123
  enabled: M,
@@ -128,72 +128,72 @@ function xt(n) {
128
128
  collected: 0,
129
129
  target: 0
130
130
  },
131
- cooldownMsTotal: w,
131
+ cooldownMsTotal: y,
132
132
  cooldownMsRemaining: 0,
133
133
  pageSize: r,
134
134
  bufferSize: F.length,
135
135
  lastBatch: {
136
- startPage: l,
136
+ startPage: o,
137
137
  pages: p,
138
138
  usedFromBuffer: h,
139
- fetchedFromNetwork: A,
139
+ fetchedFromNetwork: H,
140
140
  collectedTotal: m.length,
141
- emitted: H.length,
141
+ emitted: R.length,
142
142
  carried: F.length
143
143
  },
144
144
  totals: {
145
145
  pagesFetched: n.stats.value.totals.pagesFetched + p.length,
146
- itemsFetchedFromNetwork: n.stats.value.totals.itemsFetchedFromNetwork + A
146
+ itemsFetchedFromNetwork: n.stats.value.totals.itemsFetchedFromNetwork + H
147
147
  }
148
- }, { batchItems: H, pages: p, nextPage: b };
148
+ }, { batchItems: R, pages: p, nextPage: b };
149
149
  }
150
- return { loadBackfillBatch: S };
150
+ return { loadBackfillBatch: I };
151
151
  }
152
- function kt(n) {
153
- const y = n.columnCount, S = n.columnWidth, l = n.gapX, r = n.gapY, M = n.headerHeight, w = n.footerHeight, m = n.bucketPx, h = Array.from({ length: y }, () => 0), p = new Array(n.items.length), b = new Array(n.items.length), A = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
154
- let H = 0;
152
+ function At(n) {
153
+ const w = n.columnCount, I = n.columnWidth, o = n.gapX, r = n.gapY, M = n.headerHeight, y = n.footerHeight, m = n.bucketPx, h = Array.from({ length: w }, () => 0), p = new Array(n.items.length), b = new Array(n.items.length), H = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
154
+ let R = 0;
155
155
  for (let F = 0; F < n.items.length; F += 1) {
156
- const z = n.items[F];
157
- z?.id && _.set(z.id, F);
158
- let I = 0;
156
+ const N = n.items[F];
157
+ N?.id && A.set(N.id, F);
158
+ let S = 0;
159
159
  for (let P = 1; P < h.length; P += 1)
160
- h[P] < h[I] && (I = P);
161
- const q = I * (S + l), E = h[I], L = bt(z, S) + M + w;
162
- p[F] = { x: q, y: E }, b[F] = L, h[I] = E + L + r, H = Math.max(H, E + L);
163
- const te = Math.floor(E / m), ne = Math.floor((E + L) / m);
164
- for (let P = te; P <= ne; P += 1) {
165
- const $ = A.get(P);
166
- $ ? $.push(F) : A.set(P, [F]);
160
+ h[P] < h[S] && (S = P);
161
+ const q = S * (I + o), L = h[S], V = Tt(N, I) + M + y;
162
+ p[F] = { x: q, y: L }, b[F] = V, h[S] = L + V + r, R = Math.max(R, L + V);
163
+ const le = Math.floor(L / m), se = Math.floor((L + V) / m);
164
+ for (let P = le; P <= se; P += 1) {
165
+ const W = H.get(P);
166
+ W ? W.push(F) : H.set(P, [F]);
167
167
  }
168
168
  }
169
- return { positions: p, heights: b, buckets: A, contentHeight: H, indexById: _ };
169
+ return { positions: p, heights: b, buckets: H, contentHeight: R, indexById: A };
170
170
  }
171
- function Mt(n) {
172
- const y = n.itemCount;
173
- if (!y) return [];
174
- if (n.viewportHeight <= 0) return Array.from({ length: y }, (h, p) => p);
175
- const S = Math.max(0, n.scrollTop - n.overscanPx), l = n.scrollTop + n.viewportHeight + n.overscanPx, r = Math.floor(S / n.bucketPx), M = Math.floor(l / n.bucketPx), w = /* @__PURE__ */ new Set();
171
+ function Rt(n) {
172
+ const w = n.itemCount;
173
+ if (!w) return [];
174
+ if (n.viewportHeight <= 0) return Array.from({ length: w }, (h, p) => p);
175
+ const I = Math.max(0, n.scrollTop - n.overscanPx), o = n.scrollTop + n.viewportHeight + n.overscanPx, r = Math.floor(I / n.bucketPx), M = Math.floor(o / n.bucketPx), y = /* @__PURE__ */ new Set();
176
176
  for (let h = r; h <= M; h += 1) {
177
177
  const p = n.buckets.get(h);
178
178
  if (p)
179
- for (const b of p) w.add(b);
179
+ for (const b of p) y.add(b);
180
180
  }
181
- const m = Array.from(w);
181
+ const m = Array.from(y);
182
182
  return m.sort((h, p) => h - p), m;
183
183
  }
184
- const It = {
184
+ const Et = {
185
185
  key: 0,
186
186
  class: "flex h-full items-center justify-center"
187
- }, St = {
187
+ }, Ht = {
188
188
  key: 1,
189
189
  class: "text-sm font-medium text-red-700"
190
- }, Bt = ["src", "width", "height", "alt"], Ft = ["poster"], Pt = ["src"], Tt = ["src", "width", "height", "alt"], _t = ["poster"], Ht = ["src"], Rt = { class: "mt-4 pb-2 text-center text-xs text-slate-600" }, At = {
190
+ }, Ct = ["src", "width", "height", "alt"], Nt = ["poster"], zt = ["src"], qt = ["src", "width", "height", "alt"], Lt = ["poster"], Yt = ["src"], Dt = { class: "mt-4 pb-2 text-center text-xs text-slate-600" }, Vt = {
191
191
  key: 0,
192
192
  class: "inline-flex items-center justify-center gap-2"
193
- }, Ct = { key: 1 }, zt = { key: 2 }, Nt = 200, Xe = 600, $e = 300, je = 600, We = 600, qt = /* @__PURE__ */ ut({
193
+ }, Ot = { key: 1 }, $t = { key: 2 }, Xt = 200, Qe = 600, Ze = 300, et = 600, tt = 600, jt = 5, Wt = 1e3, Gt = /* @__PURE__ */ wt({
194
194
  inheritAttrs: !1,
195
195
  __name: "Masonry",
196
- props: /* @__PURE__ */ ct({
196
+ props: /* @__PURE__ */ yt({
197
197
  getContent: {},
198
198
  mode: {},
199
199
  pageSize: {},
@@ -207,187 +207,226 @@ const It = {
207
207
  headerHeight: {},
208
208
  footerHeight: {},
209
209
  overscanPx: {}
210
- }, pt),
210
+ }, Bt),
211
211
  emits: ["update:items"],
212
- setup(n, { expose: y, emit: S }) {
213
- const l = n, r = S, M = ft(), w = dt(), m = B(() => {
212
+ setup(n, { expose: w, emit: I }) {
213
+ const o = n, r = I, M = bt(), y = xt(), m = B(() => {
214
214
  const { class: e, ...a } = M;
215
215
  return a;
216
- }), h = g(null), p = g(0), b = g(0), A = g(0);
217
- let _;
218
- const H = B(() => l.gapX), F = B(() => l.gapY);
219
- function z(e) {
216
+ }), h = g(null), p = g(0), b = g(0), H = g(0);
217
+ let A;
218
+ const R = B(() => o.gapX), F = B(() => o.gapY);
219
+ function N(e) {
220
220
  if (!e) return 0;
221
- const a = Math.max(0, H.value);
221
+ const a = Math.max(0, R.value);
222
222
  return Math.max(0, e.clientWidth - a);
223
223
  }
224
- const I = B(() => l.headerHeight), q = B(() => l.footerHeight), E = B(() => !!w.itemHeader), L = B(() => !!w.itemFooter), te = B(() => {
225
- if (I.value > 0) return { height: `${I.value}px` };
226
- }), ne = B(() => {
224
+ const S = B(() => o.headerHeight), q = B(() => o.footerHeight), L = B(() => !!y.itemHeader), V = B(() => !!y.itemFooter), le = B(() => {
225
+ if (S.value > 0) return { height: `${S.value}px` };
226
+ }), se = B(() => {
227
227
  if (q.value > 0) return { height: `${q.value}px` };
228
- }), P = g([]), $ = g([]), be = g(/* @__PURE__ */ new Map()), xe = g(0), ae = g(/* @__PURE__ */ new Map());
229
- function ke(e) {
228
+ }), P = g([]), W = g([]), Me = g(/* @__PURE__ */ new Map()), Se = g(0), oe = g(/* @__PURE__ */ new Map());
229
+ function Ie(e) {
230
230
  const a = typeof e == "number" && Number.isFinite(e) ? e : 0;
231
231
  return -Math.max(0, a);
232
232
  }
233
- const j = g(/* @__PURE__ */ new Set()), K = g(/* @__PURE__ */ new Set()), re = /* @__PURE__ */ new Set(), ue = g(/* @__PURE__ */ new Map()), V = g(/* @__PURE__ */ new Set()), Y = g([]);
234
- function Ge(e) {
235
- const a = ue.value.get(e);
233
+ const O = g(/* @__PURE__ */ new Set()), G = g(/* @__PURE__ */ new Set()), ie = /* @__PURE__ */ new Set(), re = g(/* @__PURE__ */ new Map()), Y = g(/* @__PURE__ */ new Set()), D = g([]);
234
+ function at(e) {
235
+ const a = re.value.get(e);
236
236
  return a || { dx: 0, dy: 0 };
237
237
  }
238
- function Ke(e) {
239
- if (K.value.has(e)) return `transform ${je}ms ease-out`;
240
- if (V.value.has(e)) return `transform ${$e}ms ease-out`;
238
+ function lt(e) {
239
+ if (G.value.has(e)) return `transform ${et}ms ease-out`;
240
+ if (Y.value.has(e)) return `transform ${Ze}ms ease-out`;
241
241
  }
242
- function Je(e) {
243
- const t = o.value[e]?.id, s = P.value[e] ?? { x: 0, y: 0 }, i = $.value[e] ?? 0, v = i > 0 ? i : Z.value, d = s.x, c = t && j.value.has(t) ? ke(v) : s.y, f = t ? Ge(t) : { dx: 0, dy: 0 };
244
- return `translate3d(${d + f.dx}px,${c + f.dy}px,0)`;
242
+ function st(e) {
243
+ const t = i.value[e]?.id, l = P.value[e] ?? { x: 0, y: 0 }, s = W.value[e] ?? 0, f = s > 0 ? s : ne.value, u = l.x, d = t && O.value.has(t) ? Ie(f) : l.y, v = t ? at(t) : { dx: 0, dy: 0 };
244
+ return `translate3d(${u + v.dx}px,${d + v.dy}px,0)`;
245
245
  }
246
- function W(e) {
246
+ function U(e) {
247
247
  (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (t) => setTimeout(() => t(0), 0))(() => e());
248
248
  }
249
- function Qe(e) {
250
- W(() => W(e));
249
+ function ot(e) {
250
+ U(() => U(e));
251
251
  }
252
- function ce(e) {
252
+ const Be = /* @__PURE__ */ new Set();
253
+ function Fe(e) {
254
+ return typeof e == "number" && Number.isFinite(e) && e > 0;
255
+ }
256
+ function ve(e) {
253
257
  if (!Array.isArray(e) || e.length === 0) return;
254
- const a = new Set(j.value);
258
+ const a = new Set(O.value);
255
259
  let t = !1;
256
- for (const s of e) {
257
- const i = s?.id;
258
- i && (a.has(i) || (a.add(i), t = !0));
260
+ for (const l of e) {
261
+ const s = l?.id;
262
+ if (s) {
263
+ if (!Be.has(s)) {
264
+ const f = l?.width, u = l?.height;
265
+ (!Fe(f) || !Fe(u)) && (Be.add(s), console.warn(
266
+ `[Masonry] Item "${s}" has invalid dimensions (width=${String(f)}, height=${String(
267
+ u
268
+ )}); layout expects { id, width, height }.`
269
+ ));
270
+ }
271
+ a.has(s) || (a.add(s), t = !0);
272
+ }
259
273
  }
260
- t && (j.value = a);
274
+ t && (O.value = a);
261
275
  }
262
- function Me() {
276
+ function Pe() {
263
277
  const e = /* @__PURE__ */ new Map();
264
- for (const a of pe.value) {
265
- const s = o.value[a]?.id;
266
- if (!s) continue;
267
- const i = P.value[a];
268
- i && e.set(s, { x: i.x, y: i.y });
278
+ for (const a of be.value) {
279
+ const l = i.value[a]?.id;
280
+ if (!l) continue;
281
+ const s = P.value[a];
282
+ s && e.set(l, { x: s.x, y: s.y });
269
283
  }
270
284
  return e;
271
285
  }
272
- function Ie(e, a) {
286
+ function Te(e, a) {
273
287
  if (!e.size) return;
274
- const t = /* @__PURE__ */ new Map(), s = [];
275
- for (const [v, d] of e.entries()) {
276
- if (a?.has(v)) continue;
277
- const c = ae.value.get(v);
278
- if (c == null) continue;
279
- const f = P.value[c];
280
- if (!f) continue;
281
- const u = d.x - f.x, R = d.y - f.y;
282
- (u || R) && (t.set(v, { dx: u, dy: R }), s.push(v));
288
+ const t = /* @__PURE__ */ new Map(), l = [];
289
+ for (const [f, u] of e.entries()) {
290
+ if (a?.has(f)) continue;
291
+ const d = oe.value.get(f);
292
+ if (d == null) continue;
293
+ const v = P.value[d];
294
+ if (!v) continue;
295
+ const c = u.x - v.x, E = u.y - v.y;
296
+ (c || E) && (t.set(f, { dx: c, dy: E }), l.push(f));
283
297
  }
284
298
  if (!t.size) return;
285
- ue.value = t;
286
- const i = new Set(V.value);
287
- for (const v of s) i.delete(v);
288
- V.value = i, W(() => {
289
- V.value = /* @__PURE__ */ new Set([...V.value, ...s]), W(() => {
290
- ue.value = /* @__PURE__ */ new Map();
299
+ re.value = t;
300
+ const s = new Set(Y.value);
301
+ for (const f of l) s.delete(f);
302
+ Y.value = s, U(() => {
303
+ Y.value = /* @__PURE__ */ new Set([...Y.value, ...l]), U(() => {
304
+ re.value = /* @__PURE__ */ new Map();
291
305
  });
292
306
  }), setTimeout(() => {
293
- const v = new Set(V.value);
294
- for (const d of s) v.delete(d);
295
- V.value = v;
296
- }, $e);
297
- }
298
- const se = g(!0), J = g(!1), U = g(""), D = g([]), Se = g([]), fe = g([]), C = g(l.page), de = g([]);
299
- let ve = 0;
300
- function Q(e) {
307
+ const f = new Set(Y.value);
308
+ for (const u of l) f.delete(u);
309
+ Y.value = f;
310
+ }, Ze);
311
+ }
312
+ const ue = g(!0), ee = g(!1), K = g("");
313
+ let T = 0;
314
+ function _e(e) {
315
+ return e instanceof Error && e.name === "AbortError";
316
+ }
317
+ function Ae() {
318
+ const e = new Error("aborted");
319
+ return e.name = "AbortError", e;
320
+ }
321
+ function it(e) {
322
+ return new Promise((a) => setTimeout(a, e));
323
+ }
324
+ async function Re(e, a) {
325
+ let t = 0;
326
+ for (; ; ) {
327
+ if (a !== T) throw Ae();
328
+ try {
329
+ return await o.getContent(e);
330
+ } catch (l) {
331
+ if (a !== T) throw Ae();
332
+ if (t >= jt) throw l;
333
+ t += 1, await it(t * Wt);
334
+ }
335
+ }
336
+ }
337
+ const $ = g([]), Ee = g([]), he = g([]), C = g(o.page), ge = g([]);
338
+ let J = null, Q = null, me = 0;
339
+ function te(e) {
301
340
  for (const a of e)
302
- !a || typeof a != "object" || a.id && a.originalIndex == null && (a.originalIndex = ve, ve += 1);
341
+ !a || typeof a != "object" || a.id && a.originalIndex == null && (a.originalIndex = me, me += 1);
303
342
  }
304
- const O = /* @__PURE__ */ new Map(), X = [];
305
- function le(e) {
343
+ const X = /* @__PURE__ */ new Map(), j = [];
344
+ function ce(e) {
306
345
  return typeof e == "number" && Number.isFinite(e);
307
346
  }
308
- function Ze(e, a) {
347
+ function rt(e, a) {
309
348
  if (!a.length) return e;
310
349
  const t = /* @__PURE__ */ new Set();
311
- for (const d of e) {
312
- const c = d?.id;
313
- c && t.add(c);
350
+ for (const u of e) {
351
+ const d = u?.id;
352
+ d && t.add(d);
314
353
  }
315
- const s = [];
316
- for (const d of a) {
317
- const c = d?.id;
318
- c && (t.has(c) || (s.push(d), t.add(c)));
354
+ const l = [];
355
+ for (const u of a) {
356
+ const d = u?.id;
357
+ d && (t.has(d) || (l.push(u), t.add(d)));
319
358
  }
320
- if (!s.length) return e;
321
- const i = s.slice().sort((d, c) => {
322
- const f = le(d.originalIndex) ? d.originalIndex : Number.POSITIVE_INFINITY, u = le(c.originalIndex) ? c.originalIndex : Number.POSITIVE_INFINITY;
323
- return f - u;
324
- }), v = e.slice();
325
- for (const d of i) {
326
- const c = d.originalIndex;
327
- if (!le(c)) {
328
- v.push(d);
359
+ if (!l.length) return e;
360
+ const s = l.slice().sort((u, d) => {
361
+ const v = ce(u.originalIndex) ? u.originalIndex : Number.POSITIVE_INFINITY, c = ce(d.originalIndex) ? d.originalIndex : Number.POSITIVE_INFINITY;
362
+ return v - c;
363
+ }), f = e.slice();
364
+ for (const u of s) {
365
+ const d = u.originalIndex;
366
+ if (!ce(d)) {
367
+ f.push(u);
329
368
  continue;
330
369
  }
331
- let f = 0, u = v.length;
332
- for (; f < u; ) {
333
- const R = f + u >> 1, ee = v[R]?.originalIndex;
334
- (le(ee) ? ee : Number.POSITIVE_INFINITY) <= c ? f = R + 1 : u = R;
370
+ let v = 0, c = f.length;
371
+ for (; v < c; ) {
372
+ const E = v + c >> 1, ae = f[E]?.originalIndex;
373
+ (ce(ae) ? ae : Number.POSITIVE_INFINITY) <= d ? v = E + 1 : c = E;
335
374
  }
336
- v.splice(f, 0, d);
375
+ f.splice(v, 0, u);
337
376
  }
338
- return v;
377
+ return f;
339
378
  }
340
- async function Be(e) {
379
+ async function He(e) {
341
380
  if (!e.length) return;
342
- ce(e);
343
- const a = Me();
344
- o.value = Ze(o.value, e), await Oe(), Ie(a);
381
+ ve(e);
382
+ const a = Pe();
383
+ i.value = rt(i.value, e), await Je(), Te(a);
345
384
  }
346
- async function Fe(e) {
347
- const t = (Array.isArray(e) ? e : [e]).map(me).filter(Boolean);
385
+ async function Ce(e) {
386
+ const t = (Array.isArray(e) ? e : [e]).map(ye).filter(Boolean);
348
387
  if (!t.length) return;
349
- const s = [];
350
- for (const i of t) {
351
- const v = O.get(i);
352
- v && s.push(v);
388
+ const l = [];
389
+ for (const s of t) {
390
+ const f = X.get(s);
391
+ f && l.push(f);
353
392
  }
354
- if (s.length) {
355
- await Be(s);
356
- for (const i of s)
357
- i?.id && O.delete(i.id);
393
+ if (l.length) {
394
+ await He(l);
395
+ for (const s of l)
396
+ s?.id && X.delete(s.id);
358
397
  }
359
398
  }
360
- async function Pe() {
361
- const e = X.pop();
399
+ async function Ne() {
400
+ const e = j.pop();
362
401
  if (!e?.length) return;
363
402
  const a = [];
364
403
  for (const t of e) {
365
- const s = O.get(t);
366
- s && a.push(s);
404
+ const l = X.get(t);
405
+ l && a.push(l);
367
406
  }
368
407
  if (a.length) {
369
- await Be(a);
408
+ await He(a);
370
409
  for (const t of a)
371
- t?.id && O.delete(t.id);
410
+ t?.id && X.delete(t.id);
372
411
  }
373
412
  }
374
- async function et(e) {
375
- return Fe(e);
413
+ async function ut(e) {
414
+ return Ce(e);
376
415
  }
377
- async function tt() {
378
- return Pe();
416
+ async function ct() {
417
+ return Ne();
379
418
  }
380
- function Te(e) {
381
- const t = (Array.isArray(e) ? e : [e]).map(me).filter(Boolean);
419
+ function ze(e) {
420
+ const t = (Array.isArray(e) ? e : [e]).map(ye).filter(Boolean);
382
421
  if (!t.length) return;
383
- const s = new Set(t);
384
- for (const i of s) O.delete(i);
385
- for (let i = X.length - 1; i >= 0; i -= 1) {
386
- const d = X[i].filter((c) => !s.has(c));
387
- d.length ? X[i] = d : X.splice(i, 1);
422
+ const l = new Set(t);
423
+ for (const s of l) X.delete(s);
424
+ for (let s = j.length - 1; s >= 0; s -= 1) {
425
+ const u = j[s].filter((d) => !l.has(d));
426
+ u.length ? j[s] = u : j.splice(s, 1);
388
427
  }
389
428
  }
390
- const he = vt({
429
+ const pe = kt({
391
430
  enabled: !1,
392
431
  isBackfillActive: !1,
393
432
  isRequestInFlight: !1,
@@ -405,178 +444,187 @@ const It = {
405
444
  pagesFetched: 0,
406
445
  itemsFetchedFromNetwork: 0
407
446
  }
408
- }), _e = xt({
409
- getContent: (e) => l.getContent(e),
410
- markEnterFromLeft: ce,
411
- buffer: de,
412
- stats: he,
413
- isEnabled: () => l.mode === "backfill",
414
- getPageSize: () => l.pageSize,
415
- getRequestDelayMs: () => l.backfillRequestDelayMs
416
- }), ge = B(() => l.items !== void 0);
417
- G(
418
- () => l.items,
447
+ }), qe = _t({
448
+ getContent: (e) => Re(e, T),
449
+ markEnterFromLeft: ve,
450
+ buffer: ge,
451
+ stats: pe,
452
+ isEnabled: () => o.mode === "backfill",
453
+ getPageSize: () => o.pageSize,
454
+ getRequestDelayMs: () => o.backfillRequestDelayMs
455
+ }), we = B(() => o.items !== void 0);
456
+ Z(
457
+ () => o.items,
419
458
  (e) => {
420
- ge.value && (fe.value = Array.isArray(e) ? e : []);
459
+ we.value && (he.value = Array.isArray(e) ? e : []);
421
460
  },
422
461
  { immediate: !0 }
423
462
  );
424
- const o = B({
463
+ const i = B({
425
464
  get() {
426
- return ge.value ? fe.value : Se.value;
465
+ return we.value ? he.value : Ee.value;
427
466
  },
428
467
  set(e) {
429
- ge.value ? (fe.value = e, r("update:items", e)) : Se.value = e;
468
+ we.value ? (he.value = e, r("update:items", e)) : Ee.value = e;
430
469
  }
431
470
  });
432
- async function He(e) {
433
- const a = await l.getContent(e);
434
- return Q(a.items), ce(a.items), { items: a.items, nextPage: a.nextPage };
471
+ async function Le(e) {
472
+ const a = await Re(e, T);
473
+ return te(a.items), ve(a.items), { items: a.items, nextPage: a.nextPage };
435
474
  }
436
- function me(e) {
475
+ function ye(e) {
437
476
  return e ? typeof e == "string" ? e : e?.id : null;
438
477
  }
439
- async function Re(e) {
440
- const t = (Array.isArray(e) ? e : [e]).map(me).filter(Boolean);
478
+ async function Ye(e) {
479
+ const t = (Array.isArray(e) ? e : [e]).map(ye).filter(Boolean);
441
480
  if (!t.length) return;
442
- const s = new Set(t), i = [];
443
- for (const f of s) {
444
- const u = ae.value.get(f);
445
- if (u == null) continue;
446
- const R = o.value[u];
447
- R && (O.set(f, R), i.push(f));
481
+ const l = new Set(t), s = [];
482
+ for (const v of l) {
483
+ const c = oe.value.get(v);
484
+ if (c == null) continue;
485
+ const E = i.value[c];
486
+ E && (X.set(v, E), s.push(v));
448
487
  }
449
- i.length && X.push(i);
450
- const v = Me(), d = Z.value, c = [];
451
- for (const f of s) {
452
- const u = ae.value.get(f);
453
- if (u == null) continue;
454
- const R = o.value[u];
455
- if (!R) continue;
456
- const ee = P.value[u] ?? { x: 0, y: 0 }, Le = $.value[u] ?? d;
457
- c.push({
458
- id: f,
459
- item: R,
460
- fromX: ee.x,
461
- fromY: ee.y,
462
- width: d,
463
- height: Le,
488
+ s.length && j.push(s);
489
+ const f = Pe(), u = ne.value, d = [];
490
+ for (const v of l) {
491
+ const c = oe.value.get(v);
492
+ if (c == null) continue;
493
+ const E = i.value[c];
494
+ if (!E) continue;
495
+ const ae = P.value[c] ?? { x: 0, y: 0 }, We = W.value[c] ?? u;
496
+ d.push({
497
+ id: v,
498
+ item: E,
499
+ fromX: ae.x,
500
+ fromY: ae.y,
501
+ width: u,
502
+ height: We,
464
503
  leaving: !0
465
504
  });
466
505
  }
467
- if (c.length && (Y.value = [...Y.value, ...c]), o.value = o.value.filter((f) => {
468
- const u = f?.id;
469
- return !u || !s.has(u);
470
- }), await Oe(), Ie(v, s), c.length) {
471
- const f = new Set(c.map((u) => u.id));
472
- W(() => {
473
- Y.value = Y.value.map(
474
- (u) => f.has(u.id) ? { ...u, leaving: !1 } : u
506
+ if (d.length && (D.value = [...D.value, ...d]), i.value = i.value.filter((v) => {
507
+ const c = v?.id;
508
+ return !c || !l.has(c);
509
+ }), await Je(), Te(f, l), d.length) {
510
+ const v = new Set(d.map((c) => c.id));
511
+ U(() => {
512
+ D.value = D.value.map(
513
+ (c) => v.has(c.id) ? { ...c, leaving: !1 } : c
475
514
  ), setTimeout(() => {
476
- Y.value = Y.value.filter((u) => !f.has(u.id));
477
- }, We);
515
+ D.value = D.value.filter((c) => !v.has(c.id));
516
+ }, tt);
478
517
  });
479
518
  }
480
519
  }
481
- async function Ae(e) {
482
- return Re(e);
520
+ async function De(e) {
521
+ return Ye(e);
483
522
  }
484
- y({
485
- remove: Re,
486
- restore: et,
487
- undo: tt,
488
- forget: Te,
523
+ w({
524
+ remove: Ye,
525
+ restore: ut,
526
+ undo: ct,
527
+ forget: ze,
489
528
  // Aliases (kept for now; can be removed if you want strictly short API only).
490
- restoreRemoved: Fe,
491
- undoLastRemoval: Pe,
492
- forgetRemoved: Te,
493
- backfillStats: he
529
+ restoreRemoved: Ce,
530
+ undoLastRemoval: Ne,
531
+ forgetRemoved: ze,
532
+ backfillStats: pe
494
533
  });
495
- function Ce() {
496
- const e = kt({
497
- items: o.value,
498
- columnCount: ye.value,
499
- columnWidth: Z.value,
500
- gapX: H.value,
534
+ function Ve() {
535
+ const e = At({
536
+ items: i.value,
537
+ columnCount: xe.value,
538
+ columnWidth: ne.value,
539
+ gapX: R.value,
501
540
  gapY: F.value,
502
- headerHeight: I.value,
541
+ headerHeight: S.value,
503
542
  footerHeight: q.value,
504
- bucketPx: Xe
543
+ bucketPx: Qe
505
544
  });
506
- P.value = e.positions, $.value = e.heights, be.value = e.buckets, xe.value = e.contentHeight, ae.value = e.indexById;
545
+ P.value = e.positions, W.value = e.heights, Me.value = e.buckets, Se.value = e.contentHeight, oe.value = e.indexById;
507
546
  }
508
- const nt = B(() => Math.max(xe.value, b.value) + Nt), pe = B(() => Mt({
509
- itemCount: o.value.length,
547
+ const ft = B(() => Math.max(Se.value, b.value) + Xt), be = B(() => Rt({
548
+ itemCount: i.value.length,
510
549
  viewportHeight: b.value,
511
- scrollTop: A.value,
512
- overscanPx: l.overscanPx,
513
- bucketPx: Xe,
514
- buckets: be.value
550
+ scrollTop: H.value,
551
+ overscanPx: o.overscanPx,
552
+ bucketPx: Qe,
553
+ buckets: Me.value
515
554
  }));
516
- G(
517
- pe,
555
+ Z(
556
+ be,
518
557
  (e) => {
519
558
  if (!e?.length) return;
520
559
  const a = [];
521
560
  for (const t of e) {
522
- const s = o.value[t]?.id;
523
- s && j.value.has(s) && (re.has(s) || (re.add(s), a.push(s)));
561
+ const l = i.value[t]?.id;
562
+ l && O.value.has(l) && (ie.has(l) || (ie.add(l), a.push(l)));
524
563
  }
525
- a.length && (W(() => {
526
- const t = new Set(K.value);
527
- for (const s of a) t.add(s);
528
- K.value = t;
529
- }), Qe(() => {
530
- const t = new Set(j.value);
531
- for (const s of a) t.delete(s);
532
- j.value = t, setTimeout(() => {
533
- const s = new Set(K.value);
534
- for (const i of a)
535
- s.delete(i), re.delete(i);
536
- K.value = s;
537
- }, je);
564
+ a.length && (U(() => {
565
+ const t = new Set(G.value);
566
+ for (const l of a) t.add(l);
567
+ G.value = t;
568
+ }), ot(() => {
569
+ const t = new Set(O.value);
570
+ for (const l of a) t.delete(l);
571
+ O.value = t, setTimeout(() => {
572
+ const l = new Set(G.value);
573
+ for (const s of a)
574
+ l.delete(s), ie.delete(s);
575
+ G.value = l;
576
+ }, et);
538
577
  }));
539
578
  },
540
579
  { flush: "post" }
541
580
  );
542
- async function at() {
543
- if (!(se.value || J.value) && !(l.mode !== "backfill" && C.value == null) && !(l.mode === "backfill" && C.value == null && de.value.length === 0))
581
+ async function dt() {
582
+ if (J) return J;
583
+ if (ue.value || ee.value || o.mode !== "backfill" && C.value == null || o.mode === "backfill" && C.value == null && ge.value.length === 0)
584
+ return;
585
+ const e = T;
586
+ let a = null;
587
+ return a = (async () => {
544
588
  try {
545
- if (J.value = !0, U.value = "", l.mode === "backfill") {
546
- const t = await _e.loadBackfillBatch(C.value);
547
- t.pages.length && (D.value = [...D.value, ...t.pages]), Q(t.batchItems), o.value = [...o.value, ...t.batchItems], C.value = t.nextPage;
589
+ if (ee.value = !0, K.value = "", o.mode === "backfill") {
590
+ const s = await qe.loadBackfillBatch(C.value);
591
+ if (e !== T) return;
592
+ s.pages.length && ($.value = [...$.value, ...s.pages]), te(s.batchItems), i.value = [...i.value, ...s.batchItems], C.value = s.nextPage;
548
593
  return;
549
594
  }
550
- const e = C.value;
551
- if (e == null) return;
552
- const a = await He(e);
553
- D.value = [...D.value, e], Q(a.items), o.value = [...o.value, ...a.items], C.value = a.nextPage;
554
- } catch (e) {
555
- U.value = e instanceof Error ? e.message : String(e);
595
+ const t = C.value;
596
+ if (t == null) return;
597
+ const l = await Le(t);
598
+ if (e !== T) return;
599
+ $.value = [...$.value, t], te(l.items), i.value = [...i.value, ...l.items], C.value = l.nextPage;
600
+ } catch (t) {
601
+ if (e !== T || _e(t)) return;
602
+ K.value = t instanceof Error ? t.message : String(t);
556
603
  } finally {
557
- J.value = !1;
604
+ e === T && (ee.value = !1), J === a && (J = null);
558
605
  }
606
+ })(), J = a, a;
559
607
  }
560
- function st() {
608
+ function vt() {
561
609
  const e = h.value;
562
610
  if (!e) return;
563
- A.value = e.scrollTop, b.value = e.clientHeight, e.scrollHeight - (e.scrollTop + e.clientHeight) <= l.prefetchThresholdPx && at();
611
+ H.value = e.scrollTop, b.value = e.clientHeight, e.scrollHeight - (e.scrollTop + e.clientHeight) <= o.prefetchThresholdPx && dt();
564
612
  }
565
- function ze() {
613
+ function Oe() {
566
614
  return h.value;
567
615
  }
568
- function Ne(e) {
569
- p.value = z(e), b.value = e.clientHeight;
616
+ function $e(e) {
617
+ p.value = N(e), b.value = e.clientHeight;
570
618
  }
571
- function lt() {
572
- typeof ResizeObserver > "u" || (_ = new ResizeObserver(() => {
573
- const e = ze();
574
- e && Ne(e);
619
+ function ht() {
620
+ typeof ResizeObserver > "u" || (A = new ResizeObserver(() => {
621
+ const e = Oe();
622
+ e && $e(e);
575
623
  }));
576
624
  }
577
- function ot() {
625
+ function gt() {
578
626
  return {
579
- enabled: l.mode === "backfill",
627
+ enabled: o.mode === "backfill",
580
628
  isBackfillActive: !1,
581
629
  isRequestInFlight: !1,
582
630
  requestPage: null,
@@ -585,8 +633,8 @@ const It = {
585
633
  target: 0
586
634
  },
587
635
  cooldownMsRemaining: 0,
588
- cooldownMsTotal: we(l.backfillRequestDelayMs),
589
- pageSize: Ue(l.pageSize),
636
+ cooldownMsTotal: ke(o.backfillRequestDelayMs),
637
+ pageSize: nt(o.pageSize),
590
638
  bufferSize: 0,
591
639
  lastBatch: null,
592
640
  totals: {
@@ -595,84 +643,92 @@ const It = {
595
643
  }
596
644
  };
597
645
  }
598
- function qe(e) {
599
- ve = 0, O.clear(), X.length = 0, D.value = [], o.value = [], C.value = e, de.value = [], he.value = ot(), se.value = !0, J.value = !1, U.value = "";
600
- }
601
- async function Ee(e) {
602
- try {
603
- if (l.mode === "backfill") {
604
- const a = await _e.loadBackfillBatch(e);
605
- D.value = a.pages.length ? a.pages : [e], Q(a.batchItems), o.value = a.batchItems, C.value = a.nextPage;
606
- } else {
607
- const a = await He(e);
608
- D.value = [e], Q(a.items), o.value = a.items, C.value = a.nextPage;
609
- }
610
- } catch (a) {
611
- U.value = a instanceof Error ? a.message : String(a);
612
- } finally {
613
- se.value = !1;
614
- }
615
- }
616
- function it() {
617
- const e = ze();
618
- e && (Ne(e), A.value = e.scrollTop, _?.observe(e));
646
+ function Xe(e) {
647
+ T += 1, J = null, Q = null, me = 0, X.clear(), j.length = 0, O.value = /* @__PURE__ */ new Set(), G.value = /* @__PURE__ */ new Set(), ie.clear(), re.value = /* @__PURE__ */ new Map(), Y.value = /* @__PURE__ */ new Set(), D.value = [], $.value = [], i.value = [], C.value = e, ge.value = [], pe.value = gt(), ue.value = !0, ee.value = !1, K.value = "";
619
648
  }
620
- ht(async () => {
621
- lt(), it(), qe(l.page), await Ee(l.page);
622
- }), gt(() => {
623
- _?.disconnect();
624
- }), G(
625
- () => l.page,
649
+ async function je(e) {
650
+ if (Q) return Q;
651
+ const a = T;
652
+ let t = null;
653
+ return t = (async () => {
654
+ try {
655
+ if (o.mode === "backfill") {
656
+ const l = await qe.loadBackfillBatch(e);
657
+ if (a !== T) return;
658
+ $.value = l.pages.length ? l.pages : [e], te(l.batchItems), i.value = l.batchItems, C.value = l.nextPage;
659
+ } else {
660
+ const l = await Le(e);
661
+ if (a !== T) return;
662
+ $.value = [e], te(l.items), i.value = l.items, C.value = l.nextPage;
663
+ }
664
+ } catch (l) {
665
+ if (a !== T || _e(l)) return;
666
+ K.value = l instanceof Error ? l.message : String(l);
667
+ } finally {
668
+ a === T && (ue.value = !1), Q === t && (Q = null);
669
+ }
670
+ })(), Q = t, t;
671
+ }
672
+ function mt() {
673
+ const e = Oe();
674
+ e && ($e(e), H.value = e.scrollTop, A?.observe(e));
675
+ }
676
+ Mt(async () => {
677
+ ht(), mt(), Xe(o.page), await je(o.page);
678
+ }), St(() => {
679
+ A?.disconnect();
680
+ }), Z(
681
+ () => o.page,
626
682
  async (e) => {
627
- qe(e), await Ee(e);
683
+ Xe(e), await je(e);
628
684
  }
629
- ), G(
630
- H,
685
+ ), Z(
686
+ R,
631
687
  () => {
632
688
  const e = h.value;
633
- e && (p.value = z(e));
689
+ e && (p.value = N(e));
634
690
  },
635
691
  { immediate: !1 }
636
692
  );
637
- const ye = B(() => yt(p.value, l.itemWidth)), Z = B(
638
- () => wt(p.value, ye.value, l.itemWidth, H.value)
693
+ const xe = B(() => Ft(p.value, o.itemWidth)), ne = B(
694
+ () => Pt(p.value, xe.value, o.itemWidth, R.value)
639
695
  );
640
- G(
641
- [ye, Z, H, F, I, q],
696
+ Z(
697
+ [xe, ne, R, F, S, q],
642
698
  () => {
643
- Ce();
699
+ Ve();
644
700
  },
645
701
  { immediate: !0 }
646
- ), G(
702
+ ), Z(
647
703
  // Performance note: this component targets very large arrays (e.g. 10k items).
648
704
  // Avoid deep watchers over items; rebuild layout only when the list structure
649
705
  // changes (new array reference or length change). This keeps metadata-only
650
706
  // updates (e.g. reactions) cheap.
651
- () => [o.value, o.value.length],
652
- () => Ce(),
707
+ () => [i.value, i.value.length],
708
+ () => Ve(),
653
709
  { immediate: !0 }
654
710
  );
655
- const rt = B(() => [
711
+ const pt = B(() => [
656
712
  "mt-8 flex min-h-0 flex-1 flex-col rounded-2xl border border-slate-200/70 bg-white/70 p-5 shadow-sm backdrop-blur",
657
713
  M.class
658
714
  ]);
659
- return (e, a) => (k(), x("section", mt(m.value, { class: rt.value }), [
660
- T("div", {
715
+ return (e, a) => (k(), x("section", It(m.value, { class: pt.value }), [
716
+ _("div", {
661
717
  ref_key: "scrollViewportRef",
662
718
  ref: h,
663
719
  "data-testid": "items-scroll-container",
664
720
  class: "mt-4 min-h-0 flex-1 overflow-auto",
665
- style: N({ paddingRight: H.value + "px" }),
666
- onScroll: st
721
+ style: z({ paddingRight: R.value + "px" }),
722
+ onScroll: vt
667
723
  }, [
668
- se.value ? (k(), x("div", It, a[0] || (a[0] = [
669
- T("div", { class: "inline-flex items-center gap-3 text-sm text-slate-600" }, [
670
- T("svg", {
724
+ ue.value ? (k(), x("div", Et, a[0] || (a[0] = [
725
+ _("div", { class: "inline-flex items-center gap-3 text-sm text-slate-600" }, [
726
+ _("svg", {
671
727
  class: "h-5 w-5 animate-spin text-slate-500",
672
728
  viewBox: "0 0 24 24",
673
729
  "aria-hidden": "true"
674
730
  }, [
675
- T("circle", {
731
+ _("circle", {
676
732
  class: "opacity-25",
677
733
  cx: "12",
678
734
  cy: "12",
@@ -681,102 +737,102 @@ const It = {
681
737
  stroke: "currentColor",
682
738
  "stroke-width": "4"
683
739
  }),
684
- T("path", {
740
+ _("path", {
685
741
  class: "opacity-75",
686
742
  fill: "currentColor",
687
743
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
688
744
  })
689
745
  ]),
690
- T("span", null, "Loading…")
746
+ _("span", null, "Loading…")
691
747
  ], -1)
692
- ]))) : U.value ? (k(), x("p", St, "Error: " + Ve(U.value), 1)) : (k(), x("div", {
748
+ ]))) : K.value ? (k(), x("p", Ht, "Error: " + Ge(K.value), 1)) : (k(), x("div", {
693
749
  key: 2,
694
750
  class: "relative",
695
- style: N({ height: nt.value + "px" })
751
+ style: z({ height: ft.value + "px" })
696
752
  }, [
697
- (k(!0), x(Ye, null, De(pe.value, (t) => (k(), x("article", {
698
- key: o.value[t].id,
753
+ (k(!0), x(Ue, null, Ke(be.value, (t) => (k(), x("article", {
754
+ key: i.value[t].id,
699
755
  "data-testid": "item-card",
700
756
  class: "absolute overflow-hidden rounded-xl border border-slate-200/60 bg-white shadow-sm",
701
- style: N({
702
- width: Z.value + "px",
703
- transition: Ke(o.value[t].id),
704
- transform: Je(t)
757
+ style: z({
758
+ width: ne.value + "px",
759
+ transition: lt(i.value[t].id),
760
+ transform: st(t)
705
761
  })
706
762
  }, [
707
- E.value || I.value > 0 ? (k(), x("div", {
763
+ L.value || S.value > 0 ? (k(), x("div", {
708
764
  key: 0,
709
765
  "data-testid": "item-header-container",
710
766
  class: "w-full",
711
- style: N(te.value)
767
+ style: z(le.value)
712
768
  }, [
713
- ie(e.$slots, "itemHeader", {
714
- item: o.value[t],
715
- remove: () => Ae(o.value[t])
769
+ de(e.$slots, "itemHeader", {
770
+ item: i.value[t],
771
+ remove: () => De(i.value[t])
716
772
  })
717
- ], 4)) : oe("", !0),
718
- T("div", {
773
+ ], 4)) : fe("", !0),
774
+ _("div", {
719
775
  class: "bg-slate-100",
720
- style: N({ aspectRatio: o.value[t].width + " / " + o.value[t].height })
776
+ style: z({ aspectRatio: i.value[t].width + " / " + i.value[t].height })
721
777
  }, [
722
- o.value[t].type === "image" ? (k(), x("img", {
778
+ i.value[t].type === "image" ? (k(), x("img", {
723
779
  key: 0,
724
780
  class: "h-full w-full object-cover",
725
- src: o.value[t].preview,
726
- width: o.value[t].width,
727
- height: o.value[t].height,
781
+ src: i.value[t].preview,
782
+ width: i.value[t].width,
783
+ height: i.value[t].height,
728
784
  loading: "lazy",
729
- alt: o.value[t].id
730
- }, null, 8, Bt)) : (k(), x("video", {
785
+ alt: i.value[t].id
786
+ }, null, 8, Ct)) : (k(), x("video", {
731
787
  key: 1,
732
788
  class: "h-full w-full object-cover",
733
- poster: o.value[t].preview,
789
+ poster: i.value[t].preview,
734
790
  controls: "",
735
791
  preload: "metadata"
736
792
  }, [
737
- T("source", {
738
- src: o.value[t].original,
793
+ _("source", {
794
+ src: i.value[t].original,
739
795
  type: "video/mp4"
740
- }, null, 8, Pt)
741
- ], 8, Ft))
796
+ }, null, 8, zt)
797
+ ], 8, Nt))
742
798
  ], 4),
743
- L.value || q.value > 0 ? (k(), x("div", {
799
+ V.value || q.value > 0 ? (k(), x("div", {
744
800
  key: 1,
745
801
  "data-testid": "item-footer-container",
746
802
  class: "w-full",
747
- style: N(ne.value)
803
+ style: z(se.value)
748
804
  }, [
749
- ie(e.$slots, "itemFooter", {
750
- item: o.value[t],
751
- remove: () => Ae(o.value[t])
805
+ de(e.$slots, "itemFooter", {
806
+ item: i.value[t],
807
+ remove: () => De(i.value[t])
752
808
  })
753
- ], 4)) : oe("", !0)
809
+ ], 4)) : fe("", !0)
754
810
  ], 4))), 128)),
755
- (k(!0), x(Ye, null, De(Y.value, (t) => (k(), x("article", {
811
+ (k(!0), x(Ue, null, Ke(D.value, (t) => (k(), x("article", {
756
812
  key: t.id + ":leaving",
757
813
  "data-testid": "item-card-leaving",
758
814
  class: "pointer-events-none absolute overflow-hidden rounded-xl border border-slate-200/60 bg-white shadow-sm",
759
- style: N({
815
+ style: z({
760
816
  width: t.width + "px",
761
- transition: "transform " + We + "ms ease-out",
762
- transform: t.leaving ? "translate3d(" + t.fromX + "px," + t.fromY + "px,0)" : "translate3d(" + t.fromX + "px," + ke(t.height) + "px,0)"
817
+ transition: "transform " + tt + "ms ease-out",
818
+ transform: t.leaving ? "translate3d(" + t.fromX + "px," + t.fromY + "px,0)" : "translate3d(" + t.fromX + "px," + Ie(t.height) + "px,0)"
763
819
  })
764
820
  }, [
765
- E.value || I.value > 0 ? (k(), x("div", {
821
+ L.value || S.value > 0 ? (k(), x("div", {
766
822
  key: 0,
767
823
  "data-testid": "item-header-container",
768
824
  class: "w-full",
769
- style: N(te.value)
825
+ style: z(le.value)
770
826
  }, [
771
- ie(e.$slots, "itemHeader", {
827
+ de(e.$slots, "itemHeader", {
772
828
  item: t.item,
773
829
  remove: () => {
774
830
  }
775
831
  })
776
- ], 4)) : oe("", !0),
777
- T("div", {
832
+ ], 4)) : fe("", !0),
833
+ _("div", {
778
834
  class: "bg-slate-100",
779
- style: N({ aspectRatio: t.item.width + " / " + t.item.height })
835
+ style: z({ aspectRatio: t.item.width + " / " + t.item.height })
780
836
  }, [
781
837
  t.item.type === "image" ? (k(), x("img", {
782
838
  key: 0,
@@ -786,41 +842,41 @@ const It = {
786
842
  height: t.item.height,
787
843
  loading: "lazy",
788
844
  alt: t.item.id
789
- }, null, 8, Tt)) : (k(), x("video", {
845
+ }, null, 8, qt)) : (k(), x("video", {
790
846
  key: 1,
791
847
  class: "h-full w-full object-cover",
792
848
  poster: t.item.preview,
793
849
  controls: "",
794
850
  preload: "metadata"
795
851
  }, [
796
- T("source", {
852
+ _("source", {
797
853
  src: t.item.original,
798
854
  type: "video/mp4"
799
- }, null, 8, Ht)
800
- ], 8, _t))
855
+ }, null, 8, Yt)
856
+ ], 8, Lt))
801
857
  ], 4),
802
- L.value || q.value > 0 ? (k(), x("div", {
858
+ V.value || q.value > 0 ? (k(), x("div", {
803
859
  key: 1,
804
860
  "data-testid": "item-footer-container",
805
861
  class: "w-full",
806
- style: N(ne.value)
862
+ style: z(se.value)
807
863
  }, [
808
- ie(e.$slots, "itemFooter", {
864
+ de(e.$slots, "itemFooter", {
809
865
  item: t.item,
810
866
  remove: () => {
811
867
  }
812
868
  })
813
- ], 4)) : oe("", !0)
869
+ ], 4)) : fe("", !0)
814
870
  ], 4))), 128))
815
871
  ], 4)),
816
- T("div", Rt, [
817
- J.value ? (k(), x("span", At, a[1] || (a[1] = [
818
- T("svg", {
872
+ _("div", Dt, [
873
+ ee.value ? (k(), x("span", Vt, a[1] || (a[1] = [
874
+ _("svg", {
819
875
  class: "h-4 w-4 animate-spin text-slate-500",
820
876
  viewBox: "0 0 24 24",
821
877
  "aria-hidden": "true"
822
878
  }, [
823
- T("circle", {
879
+ _("circle", {
824
880
  class: "opacity-25",
825
881
  cx: "12",
826
882
  cy: "12",
@@ -829,25 +885,25 @@ const It = {
829
885
  stroke: "currentColor",
830
886
  "stroke-width": "4"
831
887
  }),
832
- T("path", {
888
+ _("path", {
833
889
  class: "opacity-75",
834
890
  fill: "currentColor",
835
891
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
836
892
  })
837
893
  ], -1),
838
- T("span", null, "Loading more…", -1)
839
- ]))) : C.value == null ? (k(), x("span", Ct, "End of list")) : (k(), x("span", zt, "Scroll to load page " + Ve(C.value), 1))
894
+ _("span", null, "Loading more…", -1)
895
+ ]))) : C.value == null ? (k(), x("span", Ot, "End of list")) : (k(), x("span", $t, "Scroll to load page " + Ge(C.value), 1))
840
896
  ])
841
897
  ], 36)
842
898
  ], 16));
843
899
  }
844
- }), Lt = {
900
+ }), Kt = {
845
901
  install(n) {
846
- n.component("Masonry", qt);
902
+ n.component("Masonry", Gt);
847
903
  }
848
904
  };
849
905
  export {
850
- qt as Masonry,
851
- Lt as VibePlugin,
852
- pt as masonryDefaults
906
+ Gt as Masonry,
907
+ Kt as VibePlugin,
908
+ Bt as masonryDefaults
853
909
  };