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