@wyxos/vibe 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as pe, ref as h, computed as S, onMounted as Be, onUnmounted as gt, createElementBlock as F, openBlock as x, normalizeStyle as V, createCommentVNode as oe, createElementVNode as _, normalizeClass as st, mergeDefaults as Ht, useAttrs as Lt, shallowRef as lt, provide as zt, watch as U, mergeProps as qt, renderSlot as $t, toDisplayString as rt, Fragment as it, renderList as ut, createBlock as he, createVNode as ge, unref as ne, nextTick as ct, inject as Ot } from "vue";
2
- const Dt = {
1
+ import { defineComponent as be, ref as g, computed as S, onMounted as Ne, onUnmounted as Pt, createElementBlock as P, openBlock as b, normalizeStyle as D, createCommentVNode as re, createElementVNode as B, normalizeClass as ht, mergeDefaults as Wt, useAttrs as Ut, shallowRef as gt, provide as Gt, watch as G, mergeProps as Kt, renderSlot as Jt, toDisplayString as pt, Fragment as yt, renderList as wt, createBlock as we, createVNode as xe, unref as se, nextTick as xt, inject as Qt } from "vue";
2
+ const Zt = {
3
3
  mode: "default",
4
4
  pageSize: 20,
5
5
  backfillRequestDelayMs: 2e3,
@@ -11,80 +11,80 @@ const Dt = {
11
11
  headerHeight: 0,
12
12
  footerHeight: 0,
13
13
  overscanPx: 600
14
- }, Vt = {
14
+ }, en = {
15
15
  key: 0,
16
16
  "data-testid": "masonry-loader-spinner",
17
17
  class: "absolute inset-0 flex items-center justify-center"
18
- }, Yt = {
18
+ }, tn = {
19
19
  key: 1,
20
20
  "data-testid": "masonry-loader-error",
21
21
  class: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-3"
22
- }, Xt = ["src", "width", "height", "alt"], jt = ["poster"], Wt = ["src"], ft = /* @__PURE__ */ pe({
22
+ }, nn = ["src", "width", "height", "alt"], on = ["poster"], ln = ["src"], bt = /* @__PURE__ */ be({
23
23
  __name: "MasonryLoader",
24
24
  props: {
25
25
  item: {},
26
26
  timeoutMs: { default: 15e3 }
27
27
  },
28
28
  emits: ["success", "error"],
29
- setup(o, { emit: g }) {
30
- const i = o, l = g, u = h(null), p = h(!1), c = h(!1), r = h(!1), b = h(0), M = S(() => {
31
- const R = i.item?.width, B = i.item?.height;
32
- return { aspectRatio: `${R} / ${B}` };
33
- }), I = S(() => i.item?.type === "image");
34
- let P = null, T = null;
35
- function E() {
36
- T != null && (window.clearTimeout(T), T = null);
29
+ setup(o, { emit: p }) {
30
+ const c = o, a = p, i = g(null), f = g(!1), u = g(!1), r = g(!1), y = g(0), M = S(() => {
31
+ const T = c.item?.width, F = c.item?.height;
32
+ return { aspectRatio: `${T} / ${F}` };
33
+ }), I = S(() => c.item?.type === "image");
34
+ let k = null, R = null;
35
+ function N() {
36
+ R != null && (window.clearTimeout(R), R = null);
37
37
  }
38
- function k() {
39
- E();
40
- const R = typeof i.timeoutMs == "number" && Number.isFinite(i.timeoutMs) ? i.timeoutMs : 0;
41
- R <= 0 || (T = window.setTimeout(() => {
42
- p.value && (c.value || r.value || z(new Error("timeout")));
43
- }, R));
38
+ function A() {
39
+ N();
40
+ const T = typeof c.timeoutMs == "number" && Number.isFinite(c.timeoutMs) ? c.timeoutMs : 0;
41
+ T <= 0 || (R = window.setTimeout(() => {
42
+ f.value && (u.value || r.value || X(new Error("timeout")));
43
+ }, T));
44
44
  }
45
45
  function L() {
46
- p.value || (p.value = !0, c.value = !1, r.value = !1, k());
46
+ f.value || (f.value = !0, u.value = !1, r.value = !1, A());
47
47
  }
48
- Be(() => {
48
+ Ne(() => {
49
49
  if (typeof IntersectionObserver > "u") {
50
50
  L();
51
51
  return;
52
52
  }
53
- P = new IntersectionObserver(
54
- (R) => {
55
- for (const B of R)
56
- if (B.isIntersecting && !((B.intersectionRatio ?? 0) < 0.5)) {
57
- L(), P?.disconnect(), P = null;
53
+ k = new IntersectionObserver(
54
+ (T) => {
55
+ for (const F of T)
56
+ if (F.isIntersecting && !((F.intersectionRatio ?? 0) < 0.5)) {
57
+ L(), k?.disconnect(), k = null;
58
58
  return;
59
59
  }
60
60
  },
61
61
  { threshold: [0, 0.5, 1] }
62
- ), u.value && P.observe(u.value);
63
- }), gt(() => {
64
- P?.disconnect(), P = null, E();
62
+ ), i.value && k.observe(i.value);
63
+ }), Pt(() => {
64
+ k?.disconnect(), k = null, N();
65
65
  });
66
- function A() {
67
- c.value || (c.value = !0, r.value = !1, E(), l("success", i.item));
66
+ function _() {
67
+ u.value || (u.value = !0, r.value = !1, N(), a("success", c.item));
68
68
  }
69
- function z(R) {
70
- r.value || (c.value = !1, r.value = !0, E(), l("error", { item: i.item, error: R }));
69
+ function X(T) {
70
+ r.value || (u.value = !1, r.value = !0, N(), a("error", { item: c.item, error: T }));
71
71
  }
72
- function C() {
73
- p.value && (c.value = !1, r.value = !1, b.value += 1, k());
72
+ function O() {
73
+ f.value && (u.value = !1, r.value = !1, y.value += 1, A());
74
74
  }
75
- return (R, B) => (x(), F("div", {
75
+ return (T, F) => (b(), P("div", {
76
76
  ref_key: "rootEl",
77
- ref: u,
77
+ ref: i,
78
78
  class: "relative bg-slate-100",
79
- style: V(M.value)
79
+ style: D(M.value)
80
80
  }, [
81
- p.value && !c.value && !r.value ? (x(), F("div", Vt, B[2] || (B[2] = [
82
- _("svg", {
81
+ f.value && !u.value && !r.value ? (b(), P("div", en, F[2] || (F[2] = [
82
+ B("svg", {
83
83
  class: "h-5 w-5 animate-spin text-slate-500",
84
84
  viewBox: "0 0 24 24",
85
85
  "aria-hidden": "true"
86
86
  }, [
87
- _("circle", {
87
+ B("circle", {
88
88
  class: "opacity-25",
89
89
  cx: "12",
90
90
  cy: "12",
@@ -93,163 +93,163 @@ const Dt = {
93
93
  stroke: "currentColor",
94
94
  "stroke-width": "4"
95
95
  }),
96
- _("path", {
96
+ B("path", {
97
97
  class: "opacity-75",
98
98
  fill: "currentColor",
99
99
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
100
100
  })
101
101
  ], -1)
102
- ]))) : p.value && r.value ? (x(), F("div", Yt, [
103
- B[3] || (B[3] = _("p", { class: "text-center text-xs font-medium text-red-700" }, "Failed to load", -1)),
104
- _("button", {
102
+ ]))) : f.value && r.value ? (b(), P("div", tn, [
103
+ F[3] || (F[3] = B("p", { class: "text-center text-xs font-medium text-red-700" }, "Failed to load", -1)),
104
+ B("button", {
105
105
  type: "button",
106
106
  "data-testid": "masonry-loader-retry",
107
107
  class: "inline-flex items-center rounded-md border border-slate-200 bg-white px-2 py-1 text-xs font-medium text-slate-700",
108
- onClick: C
108
+ onClick: O
109
109
  }, " Retry ")
110
- ])) : oe("", !0),
111
- p.value && I.value && !r.value ? (x(), F("img", {
112
- key: i.item.id + ":img:" + b.value,
113
- class: st([
110
+ ])) : re("", !0),
111
+ f.value && I.value && !r.value ? (b(), P("img", {
112
+ key: c.item.id + ":img:" + y.value,
113
+ class: ht([
114
114
  "h-full w-full object-cover transition-opacity duration-300",
115
- c.value ? "opacity-100" : "opacity-0"
115
+ u.value ? "opacity-100" : "opacity-0"
116
116
  ]),
117
- src: i.item.preview,
118
- width: i.item.width,
119
- height: i.item.height,
117
+ src: c.item.preview,
118
+ width: c.item.width,
119
+ height: c.item.height,
120
120
  loading: "lazy",
121
- alt: i.item.id,
122
- onLoad: A,
123
- onError: B[0] || (B[0] = (O) => z(O))
124
- }, null, 42, Xt)) : p.value && !r.value ? (x(), F("video", {
125
- key: i.item.id + ":vid:" + b.value,
126
- class: st([
121
+ alt: c.item.id,
122
+ onLoad: _,
123
+ onError: F[0] || (F[0] = (q) => X(q))
124
+ }, null, 42, nn)) : f.value && !r.value ? (b(), P("video", {
125
+ key: c.item.id + ":vid:" + y.value,
126
+ class: ht([
127
127
  "h-full w-full object-cover transition-opacity duration-300",
128
- c.value ? "opacity-100" : "opacity-0"
128
+ u.value ? "opacity-100" : "opacity-0"
129
129
  ]),
130
- poster: i.item.preview,
130
+ poster: c.item.preview,
131
131
  controls: "",
132
132
  preload: "metadata",
133
- onLoadedmetadata: A,
134
- onError: B[1] || (B[1] = (O) => z(O))
133
+ onLoadedmetadata: _,
134
+ onError: F[1] || (F[1] = (q) => X(q))
135
135
  }, [
136
- _("source", {
137
- src: i.item.original,
136
+ B("source", {
137
+ src: c.item.original,
138
138
  type: "video/mp4"
139
- }, null, 8, Wt)
140
- ], 42, jt)) : oe("", !0)
139
+ }, null, 8, ln)
140
+ ], 42, on)) : re("", !0)
141
141
  ], 4));
142
142
  }
143
- }), pt = Symbol("masonryItemRegistry");
144
- function Gt(o, g) {
145
- return !o || o <= 0 || !g || g <= 0 ? 1 : Math.max(1, Math.floor(o / g));
143
+ }), Tt = Symbol("masonryItemRegistry");
144
+ function an(o, p) {
145
+ return !o || o <= 0 || !p || p <= 0 ? 1 : Math.max(1, Math.floor(o / p));
146
146
  }
147
- function Ut(o, g, i, l = 0) {
148
- if (!o || o <= 0 || !g || g <= 0) return i;
149
- const u = typeof l == "number" && l > 0 ? l : 0, p = Math.max(0, g - 1) * u, c = o - p;
150
- return !c || c <= 0 ? i : c / g;
147
+ function sn(o, p, c, a = 0) {
148
+ if (!o || o <= 0 || !p || p <= 0) return c;
149
+ const i = typeof a == "number" && a > 0 ? a : 0, f = Math.max(0, p - 1) * i, u = o - f;
150
+ return !u || u <= 0 ? c : u / p;
151
151
  }
152
- function Kt(o, g) {
153
- const i = o?.width, l = o?.height;
154
- return typeof i == "number" && typeof l == "number" && i > 0 && l > 0 ? l / i * g : g;
152
+ function rn(o, p) {
153
+ const c = o?.width, a = o?.height;
154
+ return typeof c == "number" && typeof a == "number" && c > 0 && a > 0 ? a / c * p : p;
155
155
  }
156
- function yt(o) {
156
+ function Bt(o) {
157
157
  return Number.isFinite(o) && o > 0 ? Math.floor(o) : 1;
158
158
  }
159
- function Te(o) {
159
+ function Ce(o) {
160
160
  return Number.isFinite(o) && o > 0 ? Math.floor(o) : 0;
161
161
  }
162
- function Jt(o) {
163
- async function g(l) {
164
- const u = Te(l);
165
- if (u <= 0) return;
162
+ function un(o) {
163
+ async function p(a) {
164
+ const i = Ce(a);
165
+ if (i <= 0) return;
166
166
  o.stats.value = {
167
167
  ...o.stats.value,
168
- cooldownMsTotal: u,
169
- cooldownMsRemaining: u
168
+ cooldownMsTotal: i,
169
+ cooldownMsRemaining: i
170
170
  };
171
- const p = Date.now(), c = 100;
171
+ const f = Date.now(), u = 100;
172
172
  await new Promise((r) => {
173
- const b = setInterval(() => {
174
- const M = Date.now() - p, I = Math.max(0, u - M);
173
+ const y = setInterval(() => {
174
+ const M = Date.now() - f, I = Math.max(0, i - M);
175
175
  o.stats.value = {
176
176
  ...o.stats.value,
177
- cooldownMsTotal: u,
177
+ cooldownMsTotal: i,
178
178
  cooldownMsRemaining: I
179
- }, I <= 0 && (clearInterval(b), r());
180
- }, c);
179
+ }, I <= 0 && (clearInterval(y), r());
180
+ }, u);
181
181
  });
182
182
  }
183
- async function i(l) {
184
- const u = yt(o.getPageSize()), p = o.isEnabled(), c = Te(o.getRequestDelayMs()), r = [];
185
- let b = 0;
186
- o.buffer.value.length && (b = o.buffer.value.length, r.push(...o.buffer.value), o.buffer.value = []), o.stats.value = {
183
+ async function c(a) {
184
+ const i = Bt(o.getPageSize()), f = o.isEnabled(), u = Ce(o.getRequestDelayMs()), r = [];
185
+ let y = 0;
186
+ o.buffer.value.length && (y = o.buffer.value.length, r.push(...o.buffer.value), o.buffer.value = []), o.stats.value = {
187
187
  ...o.stats.value,
188
- enabled: p,
188
+ enabled: f,
189
189
  isBackfillActive: !1,
190
190
  isRequestInFlight: !1,
191
191
  requestPage: null,
192
- cooldownMsTotal: c,
192
+ cooldownMsTotal: u,
193
193
  cooldownMsRemaining: 0,
194
194
  progress: {
195
195
  collected: 0,
196
196
  target: 0
197
197
  },
198
- pageSize: u,
198
+ pageSize: i,
199
199
  bufferSize: 0
200
200
  };
201
201
  const M = [];
202
- let I = l, P = 0, T = !1;
203
- for (; r.length < u && I != null; ) {
202
+ let I = a, k = 0, R = !1;
203
+ for (; r.length < i && I != null; ) {
204
204
  const L = I;
205
- T && (o.stats.value = {
205
+ R && (o.stats.value = {
206
206
  ...o.stats.value,
207
- enabled: p,
207
+ enabled: f,
208
208
  isBackfillActive: !0,
209
209
  isRequestInFlight: !0,
210
210
  requestPage: L,
211
211
  progress: {
212
- collected: Math.min(r.length, u),
213
- target: u
212
+ collected: Math.min(r.length, i),
213
+ target: i
214
214
  },
215
- cooldownMsTotal: c,
215
+ cooldownMsTotal: u,
216
216
  cooldownMsRemaining: 0,
217
- pageSize: u
217
+ pageSize: i
218
218
  });
219
- const A = await o.getContent(L);
220
- M.push(L), T && (o.stats.value = {
219
+ const _ = await o.getContent(L);
220
+ M.push(L), R && (o.stats.value = {
221
221
  ...o.stats.value,
222
- enabled: p,
222
+ enabled: f,
223
223
  isBackfillActive: !0,
224
224
  isRequestInFlight: !1,
225
225
  requestPage: null
226
- }), P += A.items.length, o.markEnterFromLeft(A.items), r.push(...A.items), I = A.nextPage, !T && r.length < u && I != null ? (T = !0, o.stats.value = {
226
+ }), k += _.items.length, o.markEnterFromLeft(_.items), r.push(..._.items), I = _.nextPage, !R && r.length < i && I != null ? (R = !0, o.stats.value = {
227
227
  ...o.stats.value,
228
- enabled: p,
228
+ enabled: f,
229
229
  isBackfillActive: !0,
230
230
  isRequestInFlight: !1,
231
231
  requestPage: null,
232
232
  progress: {
233
- collected: Math.min(r.length, u),
234
- target: u
233
+ collected: Math.min(r.length, i),
234
+ target: i
235
235
  },
236
- cooldownMsTotal: c,
236
+ cooldownMsTotal: u,
237
237
  cooldownMsRemaining: 0,
238
- pageSize: u
239
- }) : T && (o.stats.value = {
238
+ pageSize: i
239
+ }) : R && (o.stats.value = {
240
240
  ...o.stats.value,
241
- enabled: p,
241
+ enabled: f,
242
242
  isBackfillActive: !0,
243
243
  progress: {
244
- collected: Math.min(r.length, u),
245
- target: u
244
+ collected: Math.min(r.length, i),
245
+ target: i
246
246
  }
247
- }), T && r.length < u && I != null && await g(c);
247
+ }), R && r.length < i && I != null && await p(u);
248
248
  }
249
- const E = r.slice(0, u), k = r.slice(u);
250
- return o.buffer.value = k, o.stats.value = {
249
+ const N = r.slice(0, i), A = r.slice(i);
250
+ return o.buffer.value = A, o.stats.value = {
251
251
  ...o.stats.value,
252
- enabled: p,
252
+ enabled: f,
253
253
  isBackfillActive: !1,
254
254
  isRequestInFlight: !1,
255
255
  requestPage: null,
@@ -257,72 +257,72 @@ function Jt(o) {
257
257
  collected: 0,
258
258
  target: 0
259
259
  },
260
- cooldownMsTotal: c,
260
+ cooldownMsTotal: u,
261
261
  cooldownMsRemaining: 0,
262
- pageSize: u,
263
- bufferSize: k.length,
262
+ pageSize: i,
263
+ bufferSize: A.length,
264
264
  lastBatch: {
265
- startPage: l,
265
+ startPage: a,
266
266
  pages: M,
267
- usedFromBuffer: b,
268
- fetchedFromNetwork: P,
267
+ usedFromBuffer: y,
268
+ fetchedFromNetwork: k,
269
269
  collectedTotal: r.length,
270
- emitted: E.length,
271
- carried: k.length
270
+ emitted: N.length,
271
+ carried: A.length
272
272
  },
273
273
  totals: {
274
274
  pagesFetched: o.stats.value.totals.pagesFetched + M.length,
275
- itemsFetchedFromNetwork: o.stats.value.totals.itemsFetchedFromNetwork + P
275
+ itemsFetchedFromNetwork: o.stats.value.totals.itemsFetchedFromNetwork + k
276
276
  }
277
- }, { batchItems: E, pages: M, nextPage: I };
277
+ }, { batchItems: N, pages: M, nextPage: I };
278
278
  }
279
- return { loadBackfillBatch: i };
279
+ return { loadBackfillBatch: c };
280
280
  }
281
- function Qt(o) {
282
- const g = o.columnCount, i = o.columnWidth, l = o.gapX, u = o.gapY, p = o.headerHeight, c = o.footerHeight, r = o.bucketPx, b = Array.from({ length: g }, () => 0), M = new Array(o.items.length), I = new Array(o.items.length), P = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map();
283
- let E = 0;
284
- for (let k = 0; k < o.items.length; k += 1) {
285
- const L = o.items[k];
286
- L?.id && T.set(L.id, k);
287
- let A = 0;
288
- for (let q = 1; q < b.length; q += 1)
289
- b[q] < b[A] && (A = q);
290
- const z = A * (i + l), C = b[A], R = Kt(L, i) + p + c;
291
- M[k] = { x: z, y: C }, I[k] = R, b[A] = C + R + u, E = Math.max(E, C + R);
292
- const B = Math.floor(C / r), O = Math.floor((C + R) / r);
293
- for (let q = B; q <= O; q += 1) {
294
- const ae = P.get(q);
295
- ae ? ae.push(k) : P.set(q, [k]);
281
+ function cn(o) {
282
+ const p = o.columnCount, c = o.columnWidth, a = o.gapX, i = o.gapY, f = o.headerHeight, u = o.footerHeight, r = o.bucketPx, y = Array.from({ length: p }, () => 0), M = new Array(o.items.length), I = new Array(o.items.length), k = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
283
+ let N = 0;
284
+ for (let A = 0; A < o.items.length; A += 1) {
285
+ const L = o.items[A];
286
+ L?.id && R.set(L.id, A);
287
+ let _ = 0;
288
+ for (let H = 1; H < y.length; H += 1)
289
+ y[H] < y[_] && (_ = H);
290
+ const X = _ * (c + a), O = y[_], T = rn(L, c) + f + u;
291
+ M[A] = { x: X, y: O }, I[A] = T, y[_] = O + T + i, N = Math.max(N, O + T);
292
+ const F = Math.floor(O / r), q = Math.floor((O + T) / r);
293
+ for (let H = F; H <= q; H += 1) {
294
+ const K = k.get(H);
295
+ K ? K.push(A) : k.set(H, [A]);
296
296
  }
297
297
  }
298
- return { positions: M, heights: I, buckets: P, contentHeight: E, indexById: T };
298
+ return { positions: M, heights: I, buckets: k, contentHeight: N, indexById: R };
299
299
  }
300
- function Zt(o) {
301
- const g = o.itemCount;
302
- if (!g) return [];
303
- if (o.viewportHeight <= 0) return Array.from({ length: g }, (b, M) => M);
304
- const i = Math.max(0, o.scrollTop - o.overscanPx), l = o.scrollTop + o.viewportHeight + o.overscanPx, u = Math.floor(i / o.bucketPx), p = Math.floor(l / o.bucketPx), c = /* @__PURE__ */ new Set();
305
- for (let b = u; b <= p; b += 1) {
306
- const M = o.buckets.get(b);
300
+ function fn(o) {
301
+ const p = o.itemCount;
302
+ if (!p) return [];
303
+ if (o.viewportHeight <= 0) return Array.from({ length: p }, (y, M) => M);
304
+ const c = Math.max(0, o.scrollTop - o.overscanPx), a = o.scrollTop + o.viewportHeight + o.overscanPx, i = Math.floor(c / o.bucketPx), f = Math.floor(a / o.bucketPx), u = /* @__PURE__ */ new Set();
305
+ for (let y = i; y <= f; y += 1) {
306
+ const M = o.buckets.get(y);
307
307
  if (M)
308
- for (const I of M) c.add(I);
308
+ for (const I of M) u.add(I);
309
309
  }
310
- const r = Array.from(c);
311
- return r.sort((b, M) => b - M), r;
310
+ const r = Array.from(u);
311
+ return r.sort((y, M) => y - M), r;
312
312
  }
313
- const en = { class: "hidden" }, tn = {
313
+ const dn = { class: "hidden" }, vn = {
314
314
  key: 0,
315
315
  class: "flex h-full items-center justify-center"
316
- }, nn = {
316
+ }, mn = {
317
317
  key: 1,
318
318
  class: "text-sm font-medium text-red-700"
319
- }, on = { class: "mt-4 pb-2 text-center text-xs text-slate-600" }, an = {
319
+ }, hn = { class: "mt-4 pb-2 text-center text-xs text-slate-600" }, gn = {
320
320
  key: 0,
321
321
  class: "inline-flex items-center justify-center gap-2"
322
- }, sn = { key: 1 }, ln = { key: 2 }, rn = 200, dt = 600, vt = 300, mt = 600, ht = 600, un = 5, cn = 1e3, fn = /* @__PURE__ */ pe({
322
+ }, pn = { key: 1 }, yn = { key: 2 }, Mt = 100, wn = 200, It = 600, kt = 300, St = 600, Ft = 600, xn = 5, bn = 1e3, Mn = /* @__PURE__ */ be({
323
323
  inheritAttrs: !1,
324
324
  __name: "Masonry",
325
- props: /* @__PURE__ */ Ht({
325
+ props: /* @__PURE__ */ Wt({
326
326
  getContent: {},
327
327
  mode: {},
328
328
  pageSize: {},
@@ -337,10 +337,10 @@ const en = { class: "hidden" }, tn = {
337
337
  headerHeight: {},
338
338
  footerHeight: {},
339
339
  overscanPx: {}
340
- }, Dt),
341
- emits: ["update:items"],
342
- setup(o, { expose: g, emit: i }) {
343
- const l = o, u = i, p = Lt(), c = pe({
340
+ }, Zt),
341
+ emits: ["update:items", "preloaded", "failures"],
342
+ setup(o, { expose: p, emit: c }) {
343
+ const a = o, i = c, f = Ut(), u = be({
344
344
  name: "SlotRenderer",
345
345
  props: {
346
346
  slotFn: {
@@ -358,68 +358,97 @@ const en = { class: "hidden" }, tn = {
358
358
  return n ? n(e.slotProps) : null;
359
359
  };
360
360
  }
361
- }), r = lt(null);
362
- zt(pt, (e) => {
361
+ }), r = gt(null);
362
+ Gt(Tt, (e) => {
363
363
  r.value || (r.value = e);
364
- }), Be(() => {
364
+ });
365
+ const y = [], M = [];
366
+ let I = null, k = null;
367
+ function R() {
368
+ if (!y.length) return;
369
+ const e = y.splice(0, y.length);
370
+ i("preloaded", e);
371
+ }
372
+ function N() {
373
+ if (!M.length) return;
374
+ const e = M.splice(0, M.length);
375
+ i("failures", e);
376
+ }
377
+ function A() {
378
+ I || (I = setTimeout(() => {
379
+ I = null, R();
380
+ }, Mt));
381
+ }
382
+ function L() {
383
+ k || (k = setTimeout(() => {
384
+ k = null, N();
385
+ }, Mt));
386
+ }
387
+ function _(e) {
388
+ r.value?.onPreloaded?.(e), y.push(e), A();
389
+ }
390
+ function X(e) {
391
+ r.value?.onFailed?.(e), M.push(e), L();
392
+ }
393
+ Ne(() => {
365
394
  if (!r.value)
366
395
  throw new Error("[Masonry] Missing <MasonryItem> definition. Add <MasonryItem> as a child of <Masonry>.");
367
396
  });
368
- const b = S(() => {
369
- const { class: e, ...n } = p;
397
+ const O = S(() => {
398
+ const { class: e, ...n } = f;
370
399
  return n;
371
- }), M = h(null), I = h(0), P = h(0), T = h(0);
372
- let E;
373
- const k = S(() => l.gapX), L = S(() => l.gapY);
374
- function A(e) {
400
+ }), T = g(null), F = g(0), q = g(0), H = g(0);
401
+ let K;
402
+ const J = S(() => a.gapX), He = S(() => a.gapY);
403
+ function Le(e) {
375
404
  if (!e) return 0;
376
- const n = Math.max(0, k.value);
405
+ const n = Math.max(0, J.value);
377
406
  return Math.max(0, e.clientWidth - n);
378
407
  }
379
- const z = S(() => l.headerHeight), C = S(() => l.footerHeight), R = S(() => r.value?.header), B = S(() => r.value?.footer), O = S(() => r.value?.default), q = S(() => !!R.value), ae = S(() => !!B.value), Re = S(() => {
380
- if (z.value > 0) return { height: `${z.value}px` };
381
- }), _e = S(() => {
382
- if (C.value > 0) return { height: `${C.value}px` };
383
- }), se = h([]), ye = h([]), Ae = h(/* @__PURE__ */ new Map()), Ee = h(0), fe = h(/* @__PURE__ */ new Map());
384
- function Ne(e) {
408
+ const Q = S(() => a.headerHeight), Z = S(() => a.footerHeight), Me = S(() => r.value?.header), Ie = S(() => r.value?.footer), me = S(() => r.value?.default), ze = S(() => !!Me.value), qe = S(() => !!Ie.value), Oe = S(() => {
409
+ if (Q.value > 0) return { height: `${Q.value}px` };
410
+ }), $e = S(() => {
411
+ if (Z.value > 0) return { height: `${Z.value}px` };
412
+ }), ie = g([]), ke = g([]), De = g(/* @__PURE__ */ new Map()), Ve = g(0), he = g(/* @__PURE__ */ new Map());
413
+ function Ye(e) {
385
414
  const n = typeof e == "number" && Number.isFinite(e) ? e : 0;
386
- return Je.value + Math.max(0, n);
415
+ return rt.value + Math.max(0, n);
387
416
  }
388
- const j = h(/* @__PURE__ */ new Set()), K = h(/* @__PURE__ */ new Set()), de = /* @__PURE__ */ new Set(), ve = h(/* @__PURE__ */ new Map()), Y = h(/* @__PURE__ */ new Set()), X = h([]);
389
- function wt(e) {
390
- const n = ve.value.get(e);
417
+ const j = g(/* @__PURE__ */ new Set()), ee = g(/* @__PURE__ */ new Set()), ge = /* @__PURE__ */ new Set(), pe = g(/* @__PURE__ */ new Map()), V = g(/* @__PURE__ */ new Set()), Y = g([]);
418
+ function Rt(e) {
419
+ const n = pe.value.get(e);
391
420
  return n || { dx: 0, dy: 0 };
392
421
  }
393
- function xt(e) {
394
- if (K.value.has(e)) return `transform ${mt}ms ease-out`;
395
- if (Y.value.has(e)) return `transform ${vt}ms ease-out`;
422
+ function At(e) {
423
+ if (ee.value.has(e)) return `transform ${St}ms ease-out`;
424
+ if (V.value.has(e)) return `transform ${kt}ms ease-out`;
396
425
  }
397
- function bt(e) {
398
- const t = f.value[e]?.id, a = se.value[e] ?? { x: 0, y: 0 }, s = ye.value[e] ?? 0, d = s > 0 ? s : ue.value, v = a.x, y = t && j.value.has(t) ? Ne(d) : a.y, w = t ? wt(t) : { dx: 0, dy: 0 };
399
- return `translate3d(${v + w.dx}px,${y + w.dy}px,0)`;
426
+ function _t(e) {
427
+ const t = d.value[e]?.id, l = ie.value[e] ?? { x: 0, y: 0 }, s = ke.value[e] ?? 0, v = s > 0 ? s : de.value, m = l.x, w = t && j.value.has(t) ? Ye(v) : l.y, x = t ? Rt(t) : { dx: 0, dy: 0 };
428
+ return `translate3d(${m + x.dx}px,${w + x.dy}px,0)`;
400
429
  }
401
- function J(e) {
430
+ function te(e) {
402
431
  (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (t) => setTimeout(() => t(0), 0))(() => e());
403
432
  }
404
- function Mt(e) {
405
- J(() => J(e));
433
+ function Et(e) {
434
+ te(() => te(e));
406
435
  }
407
- const Ce = /* @__PURE__ */ new Set();
408
- function He(e) {
436
+ const Xe = /* @__PURE__ */ new Set();
437
+ function je(e) {
409
438
  return typeof e == "number" && Number.isFinite(e) && e > 0;
410
439
  }
411
- function we(e) {
440
+ function Se(e) {
412
441
  if (!Array.isArray(e) || e.length === 0) return;
413
442
  const n = new Set(j.value);
414
443
  let t = !1;
415
- for (const a of e) {
416
- const s = a?.id;
444
+ for (const l of e) {
445
+ const s = l?.id;
417
446
  if (s) {
418
- if (!Ce.has(s)) {
419
- const d = a?.width, v = a?.height;
420
- (!He(d) || !He(v)) && (Ce.add(s), console.warn(
421
- `[Masonry] Item "${s}" has invalid dimensions (width=${String(d)}, height=${String(
422
- v
447
+ if (!Xe.has(s)) {
448
+ const v = l?.width, m = l?.height;
449
+ (!je(v) || !je(m)) && (Xe.add(s), console.warn(
450
+ `[Masonry] Item "${s}" has invalid dimensions (width=${String(v)}, height=${String(
451
+ m
423
452
  )}); layout expects { id, width, height }.`
424
453
  ));
425
454
  }
@@ -428,168 +457,168 @@ const en = { class: "hidden" }, tn = {
428
457
  }
429
458
  t && (j.value = n);
430
459
  }
431
- function Le() {
460
+ function We() {
432
461
  const e = /* @__PURE__ */ new Map();
433
- for (const n of Fe.value) {
434
- const a = f.value[n]?.id;
435
- if (!a) continue;
436
- const s = se.value[n];
437
- s && e.set(a, { x: s.x, y: s.y });
462
+ for (const n of _e.value) {
463
+ const l = d.value[n]?.id;
464
+ if (!l) continue;
465
+ const s = ie.value[n];
466
+ s && e.set(l, { x: s.x, y: s.y });
438
467
  }
439
468
  return e;
440
469
  }
441
- function ze(e, n) {
470
+ function Ue(e, n) {
442
471
  if (!e.size) return;
443
- const t = /* @__PURE__ */ new Map(), a = [];
444
- for (const [d, v] of e.entries()) {
445
- if (n?.has(d)) continue;
446
- const y = fe.value.get(d);
447
- if (y == null) continue;
448
- const w = se.value[y];
449
- if (!w) continue;
450
- const m = v.x - w.x, $ = v.y - w.y;
451
- (m || $) && (t.set(d, { dx: m, dy: $ }), a.push(d));
472
+ const t = /* @__PURE__ */ new Map(), l = [];
473
+ for (const [v, m] of e.entries()) {
474
+ if (n?.has(v)) continue;
475
+ const w = he.value.get(v);
476
+ if (w == null) continue;
477
+ const x = ie.value[w];
478
+ if (!x) continue;
479
+ const h = m.x - x.x, z = m.y - x.y;
480
+ (h || z) && (t.set(v, { dx: h, dy: z }), l.push(v));
452
481
  }
453
482
  if (!t.size) return;
454
- ve.value = t;
455
- const s = new Set(Y.value);
456
- for (const d of a) s.delete(d);
457
- Y.value = s, J(() => {
458
- Y.value = /* @__PURE__ */ new Set([...Y.value, ...a]), J(() => {
459
- ve.value = /* @__PURE__ */ new Map();
483
+ pe.value = t;
484
+ const s = new Set(V.value);
485
+ for (const v of l) s.delete(v);
486
+ V.value = s, te(() => {
487
+ V.value = /* @__PURE__ */ new Set([...V.value, ...l]), te(() => {
488
+ pe.value = /* @__PURE__ */ new Map();
460
489
  });
461
490
  }), setTimeout(() => {
462
- const d = new Set(Y.value);
463
- for (const v of a) d.delete(v);
464
- Y.value = d;
465
- }, vt);
491
+ const v = new Set(V.value);
492
+ for (const m of l) v.delete(m);
493
+ V.value = v;
494
+ }, kt);
466
495
  }
467
- const le = h(!0), re = h(!1), Q = h("");
468
- let N = 0;
469
- function qe(e) {
496
+ const ue = g(!0), ce = g(!1), ne = g("");
497
+ let E = 0;
498
+ function Ge(e) {
470
499
  return e instanceof Error && e.name === "AbortError";
471
500
  }
472
- function $e() {
501
+ function Ke() {
473
502
  const e = new Error("aborted");
474
503
  return e.name = "AbortError", e;
475
504
  }
476
- function kt(e) {
505
+ function Nt(e) {
477
506
  return new Promise((n) => setTimeout(n, e));
478
507
  }
479
- async function Oe(e, n) {
508
+ async function Je(e, n) {
480
509
  let t = 0;
481
510
  for (; ; ) {
482
- if (n !== N) throw $e();
511
+ if (n !== E) throw Ke();
483
512
  try {
484
- return await l.getContent(e);
485
- } catch (a) {
486
- if (n !== N) throw $e();
487
- if (t >= un) throw a;
488
- t += 1, await kt(t * cn);
513
+ return await a.getContent(e);
514
+ } catch (l) {
515
+ if (n !== E) throw Ke();
516
+ if (t >= xn) throw l;
517
+ t += 1, await Nt(t * bn);
489
518
  }
490
519
  }
491
520
  }
492
- const D = h([]), De = h([]), xe = h([]), H = h(l.page), be = h([]);
493
- let Z = null, ee = null, me = 0;
494
- function It(e) {
521
+ const $ = g([]), Qe = g([]), Fe = g([]), C = g(a.page), Pe = g([]);
522
+ let oe = null, le = null, ye = 0;
523
+ function Ct(e) {
495
524
  let n = -1;
496
525
  for (const t of e) {
497
- const a = t?.originalIndex;
498
- ie(a) && a > n && (n = a);
526
+ const l = t?.originalIndex;
527
+ fe(l) && l > n && (n = l);
499
528
  }
500
- me = n + 1;
529
+ ye = n + 1;
501
530
  }
502
- function te(e) {
531
+ function ae(e) {
503
532
  for (const n of e)
504
- !n || typeof n != "object" || n.id && n.originalIndex == null && (n.originalIndex = me, me += 1);
533
+ !n || typeof n != "object" || n.id && n.originalIndex == null && (n.originalIndex = ye, ye += 1);
505
534
  }
506
- const W = /* @__PURE__ */ new Map(), G = [];
507
- function ie(e) {
535
+ const W = /* @__PURE__ */ new Map(), U = [];
536
+ function fe(e) {
508
537
  return typeof e == "number" && Number.isFinite(e);
509
538
  }
510
- function St(e, n) {
539
+ function Ht(e, n) {
511
540
  if (!n.length) return e;
512
541
  const t = /* @__PURE__ */ new Set();
513
- for (const v of e) {
514
- const y = v?.id;
515
- y && t.add(y);
542
+ for (const m of e) {
543
+ const w = m?.id;
544
+ w && t.add(w);
516
545
  }
517
- const a = [];
518
- for (const v of n) {
519
- const y = v?.id;
520
- y && (t.has(y) || (a.push(v), t.add(y)));
546
+ const l = [];
547
+ for (const m of n) {
548
+ const w = m?.id;
549
+ w && (t.has(w) || (l.push(m), t.add(w)));
521
550
  }
522
- if (!a.length) return e;
523
- const s = a.slice().sort((v, y) => {
524
- const w = ie(v.originalIndex) ? v.originalIndex : Number.POSITIVE_INFINITY, m = ie(y.originalIndex) ? y.originalIndex : Number.POSITIVE_INFINITY;
525
- return w - m;
526
- }), d = e.slice();
527
- for (const v of s) {
528
- const y = v.originalIndex;
529
- if (!ie(y)) {
530
- d.push(v);
551
+ if (!l.length) return e;
552
+ const s = l.slice().sort((m, w) => {
553
+ const x = fe(m.originalIndex) ? m.originalIndex : Number.POSITIVE_INFINITY, h = fe(w.originalIndex) ? w.originalIndex : Number.POSITIVE_INFINITY;
554
+ return x - h;
555
+ }), v = e.slice();
556
+ for (const m of s) {
557
+ const w = m.originalIndex;
558
+ if (!fe(w)) {
559
+ v.push(m);
531
560
  continue;
532
561
  }
533
- let w = 0, m = d.length;
534
- for (; w < m; ) {
535
- const $ = w + m >> 1, ce = d[$]?.originalIndex;
536
- (ie(ce) ? ce : Number.POSITIVE_INFINITY) <= y ? w = $ + 1 : m = $;
562
+ let x = 0, h = v.length;
563
+ for (; x < h; ) {
564
+ const z = x + h >> 1, ve = v[z]?.originalIndex;
565
+ (fe(ve) ? ve : Number.POSITIVE_INFINITY) <= w ? x = z + 1 : h = z;
537
566
  }
538
- d.splice(w, 0, v);
567
+ v.splice(x, 0, m);
539
568
  }
540
- return d;
569
+ return v;
541
570
  }
542
- async function Ve(e) {
571
+ async function Ze(e) {
543
572
  if (!e.length) return;
544
- we(e);
545
- const n = Le();
546
- f.value = St(f.value, e), await ct(), ze(n);
573
+ Se(e);
574
+ const n = We();
575
+ d.value = Ht(d.value, e), await xt(), Ue(n);
547
576
  }
548
- async function Ye(e) {
549
- const t = (Array.isArray(e) ? e : [e]).map(Ie).filter(Boolean);
577
+ async function et(e) {
578
+ const t = (Array.isArray(e) ? e : [e]).map(Re).filter(Boolean);
550
579
  if (!t.length) return;
551
- const a = [];
580
+ const l = [];
552
581
  for (const s of t) {
553
- const d = W.get(s);
554
- d && a.push(d);
582
+ const v = W.get(s);
583
+ v && l.push(v);
555
584
  }
556
- if (a.length) {
557
- await Ve(a);
558
- for (const s of a)
585
+ if (l.length) {
586
+ await Ze(l);
587
+ for (const s of l)
559
588
  s?.id && W.delete(s.id);
560
589
  }
561
590
  }
562
- async function Xe() {
563
- const e = G.pop();
591
+ async function tt() {
592
+ const e = U.pop();
564
593
  if (!e?.length) return;
565
594
  const n = [];
566
595
  for (const t of e) {
567
- const a = W.get(t);
568
- a && n.push(a);
596
+ const l = W.get(t);
597
+ l && n.push(l);
569
598
  }
570
599
  if (n.length) {
571
- await Ve(n);
600
+ await Ze(n);
572
601
  for (const t of n)
573
602
  t?.id && W.delete(t.id);
574
603
  }
575
604
  }
576
- async function Ft(e) {
577
- return Ye(e);
605
+ async function Lt(e) {
606
+ return et(e);
578
607
  }
579
- async function Pt() {
580
- return Xe();
608
+ async function zt() {
609
+ return tt();
581
610
  }
582
- function je(e) {
583
- const t = (Array.isArray(e) ? e : [e]).map(Ie).filter(Boolean);
611
+ function nt(e) {
612
+ const t = (Array.isArray(e) ? e : [e]).map(Re).filter(Boolean);
584
613
  if (!t.length) return;
585
- const a = new Set(t);
586
- for (const s of a) W.delete(s);
587
- for (let s = G.length - 1; s >= 0; s -= 1) {
588
- const v = G[s].filter((y) => !a.has(y));
589
- v.length ? G[s] = v : G.splice(s, 1);
614
+ const l = new Set(t);
615
+ for (const s of l) W.delete(s);
616
+ for (let s = U.length - 1; s >= 0; s -= 1) {
617
+ const m = U[s].filter((w) => !l.has(w));
618
+ m.length ? U[s] = m : U.splice(s, 1);
590
619
  }
591
620
  }
592
- const Me = lt({
621
+ const Te = gt({
593
622
  enabled: !1,
594
623
  isBackfillActive: !1,
595
624
  isRequestInFlight: !1,
@@ -607,189 +636,189 @@ const en = { class: "hidden" }, tn = {
607
636
  pagesFetched: 0,
608
637
  itemsFetchedFromNetwork: 0
609
638
  }
610
- }), We = Jt({
611
- getContent: (e) => Oe(e, N),
612
- markEnterFromLeft: we,
613
- buffer: be,
614
- stats: Me,
615
- isEnabled: () => l.mode === "backfill",
616
- getPageSize: () => l.pageSize,
617
- getRequestDelayMs: () => l.backfillRequestDelayMs
618
- }), ke = S(() => l.items !== void 0);
619
- U(
620
- () => l.items,
639
+ }), ot = un({
640
+ getContent: (e) => Je(e, E),
641
+ markEnterFromLeft: Se,
642
+ buffer: Pe,
643
+ stats: Te,
644
+ isEnabled: () => a.mode === "backfill",
645
+ getPageSize: () => a.pageSize,
646
+ getRequestDelayMs: () => a.backfillRequestDelayMs
647
+ }), Be = S(() => a.items !== void 0);
648
+ G(
649
+ () => a.items,
621
650
  (e) => {
622
- ke.value && (xe.value = Array.isArray(e) ? e : []);
651
+ Be.value && (Fe.value = Array.isArray(e) ? e : []);
623
652
  },
624
653
  { immediate: !0 }
625
654
  );
626
- const f = S({
655
+ const d = S({
627
656
  get() {
628
- return ke.value ? xe.value : De.value;
657
+ return Be.value ? Fe.value : Qe.value;
629
658
  },
630
659
  set(e) {
631
- ke.value ? (xe.value = e, u("update:items", e)) : De.value = e;
660
+ Be.value ? (Fe.value = e, i("update:items", e)) : Qe.value = e;
632
661
  }
633
662
  });
634
- async function Ge(e) {
635
- const n = await Oe(e, N);
636
- return te(n.items), we(n.items), { items: n.items, nextPage: n.nextPage };
663
+ async function lt(e) {
664
+ const n = await Je(e, E);
665
+ return ae(n.items), Se(n.items), { items: n.items, nextPage: n.nextPage };
637
666
  }
638
- function Ie(e) {
667
+ function Re(e) {
639
668
  return e ? typeof e == "string" ? e : e?.id : null;
640
669
  }
641
- async function Ue(e) {
642
- const t = (Array.isArray(e) ? e : [e]).map(Ie).filter(Boolean);
670
+ async function at(e) {
671
+ const t = (Array.isArray(e) ? e : [e]).map(Re).filter(Boolean);
643
672
  if (!t.length) return;
644
- const a = new Set(t), s = [];
645
- for (const w of a) {
646
- const m = fe.value.get(w);
647
- if (m == null) continue;
648
- const $ = f.value[m];
649
- $ && (W.set(w, $), s.push(w));
673
+ const l = new Set(t), s = [];
674
+ for (const x of l) {
675
+ const h = he.value.get(x);
676
+ if (h == null) continue;
677
+ const z = d.value[h];
678
+ z && (W.set(x, z), s.push(x));
650
679
  }
651
- s.length && G.push(s);
652
- const d = Le(), v = ue.value, y = [];
653
- for (const w of a) {
654
- const m = fe.value.get(w);
655
- if (m == null) continue;
656
- const $ = f.value[m];
657
- if (!$) continue;
658
- const ce = se.value[m] ?? { x: 0, y: 0 }, at = ye.value[m] ?? v;
659
- y.push({
660
- id: w,
661
- item: $,
662
- fromX: ce.x,
663
- fromY: ce.y,
664
- width: v,
665
- height: at,
680
+ s.length && U.push(s);
681
+ const v = We(), m = de.value, w = [];
682
+ for (const x of l) {
683
+ const h = he.value.get(x);
684
+ if (h == null) continue;
685
+ const z = d.value[h];
686
+ if (!z) continue;
687
+ const ve = ie.value[h] ?? { x: 0, y: 0 }, mt = ke.value[h] ?? m;
688
+ w.push({
689
+ id: x,
690
+ item: z,
691
+ fromX: ve.x,
692
+ fromY: ve.y,
693
+ width: m,
694
+ height: mt,
666
695
  leaving: !0
667
696
  });
668
697
  }
669
- if (y.length && (X.value = [...X.value, ...y]), f.value = f.value.filter((w) => {
670
- const m = w?.id;
671
- return !m || !a.has(m);
672
- }), await ct(), ze(d, a), y.length) {
673
- const w = new Set(y.map((m) => m.id));
674
- J(() => {
675
- X.value = X.value.map(
676
- (m) => w.has(m.id) ? { ...m, leaving: !1 } : m
698
+ if (w.length && (Y.value = [...Y.value, ...w]), d.value = d.value.filter((x) => {
699
+ const h = x?.id;
700
+ return !h || !l.has(h);
701
+ }), await xt(), Ue(v, l), w.length) {
702
+ const x = new Set(w.map((h) => h.id));
703
+ te(() => {
704
+ Y.value = Y.value.map(
705
+ (h) => x.has(h.id) ? { ...h, leaving: !1 } : h
677
706
  ), setTimeout(() => {
678
- X.value = X.value.filter((m) => !w.has(m.id));
679
- }, ht);
707
+ Y.value = Y.value.filter((h) => !x.has(h.id));
708
+ }, Ft);
680
709
  });
681
710
  }
682
711
  }
683
- async function Se(e) {
684
- return Ue(e);
712
+ async function Ae(e) {
713
+ return at(e);
685
714
  }
686
- g({
687
- remove: Ue,
688
- restore: Ft,
689
- undo: Pt,
690
- forget: je,
691
- pagesLoaded: D,
692
- nextPage: H,
715
+ p({
716
+ remove: at,
717
+ restore: Lt,
718
+ undo: zt,
719
+ forget: nt,
720
+ pagesLoaded: $,
721
+ nextPage: C,
693
722
  // Aliases (kept for now; can be removed if you want strictly short API only).
694
- restoreRemoved: Ye,
695
- undoLastRemoval: Xe,
696
- forgetRemoved: je,
697
- backfillStats: Me
723
+ restoreRemoved: et,
724
+ undoLastRemoval: tt,
725
+ forgetRemoved: nt,
726
+ backfillStats: Te
698
727
  });
699
- function Ke() {
700
- const e = Qt({
701
- items: f.value,
702
- columnCount: Pe.value,
703
- columnWidth: ue.value,
704
- gapX: k.value,
705
- gapY: L.value,
706
- headerHeight: z.value,
707
- footerHeight: C.value,
708
- bucketPx: dt
728
+ function st() {
729
+ const e = cn({
730
+ items: d.value,
731
+ columnCount: Ee.value,
732
+ columnWidth: de.value,
733
+ gapX: J.value,
734
+ gapY: He.value,
735
+ headerHeight: Q.value,
736
+ footerHeight: Z.value,
737
+ bucketPx: It
709
738
  });
710
- se.value = e.positions, ye.value = e.heights, Ae.value = e.buckets, Ee.value = e.contentHeight, fe.value = e.indexById;
739
+ ie.value = e.positions, ke.value = e.heights, De.value = e.buckets, Ve.value = e.contentHeight, he.value = e.indexById;
711
740
  }
712
- const Je = S(() => Math.max(Ee.value, P.value) + rn), Fe = S(() => Zt({
713
- itemCount: f.value.length,
714
- viewportHeight: P.value,
715
- scrollTop: T.value,
716
- overscanPx: l.overscanPx,
717
- bucketPx: dt,
718
- buckets: Ae.value
741
+ const rt = S(() => Math.max(Ve.value, q.value) + wn), _e = S(() => fn({
742
+ itemCount: d.value.length,
743
+ viewportHeight: q.value,
744
+ scrollTop: H.value,
745
+ overscanPx: a.overscanPx,
746
+ bucketPx: It,
747
+ buckets: De.value
719
748
  }));
720
- U(
721
- Fe,
749
+ G(
750
+ _e,
722
751
  (e) => {
723
752
  if (!e?.length) return;
724
753
  const n = [];
725
754
  for (const t of e) {
726
- const a = f.value[t]?.id;
727
- a && j.value.has(a) && (de.has(a) || (de.add(a), n.push(a)));
755
+ const l = d.value[t]?.id;
756
+ l && j.value.has(l) && (ge.has(l) || (ge.add(l), n.push(l)));
728
757
  }
729
- n.length && (J(() => {
730
- const t = new Set(K.value);
731
- for (const a of n) t.add(a);
732
- K.value = t;
733
- }), Mt(() => {
758
+ n.length && (te(() => {
759
+ const t = new Set(ee.value);
760
+ for (const l of n) t.add(l);
761
+ ee.value = t;
762
+ }), Et(() => {
734
763
  const t = new Set(j.value);
735
- for (const a of n) t.delete(a);
764
+ for (const l of n) t.delete(l);
736
765
  j.value = t, setTimeout(() => {
737
- const a = new Set(K.value);
766
+ const l = new Set(ee.value);
738
767
  for (const s of n)
739
- a.delete(s), de.delete(s);
740
- K.value = a;
741
- }, mt);
768
+ l.delete(s), ge.delete(s);
769
+ ee.value = l;
770
+ }, St);
742
771
  }));
743
772
  },
744
773
  { flush: "post" }
745
774
  );
746
- async function Bt() {
747
- if (Z) return Z;
748
- if (le.value || re.value || l.mode !== "backfill" && H.value == null || l.mode === "backfill" && H.value == null && be.value.length === 0)
775
+ async function qt() {
776
+ if (oe) return oe;
777
+ if (ue.value || ce.value || a.mode !== "backfill" && C.value == null || a.mode === "backfill" && C.value == null && Pe.value.length === 0)
749
778
  return;
750
- const e = N;
779
+ const e = E;
751
780
  let n = null;
752
781
  return n = (async () => {
753
782
  try {
754
- if (re.value = !0, Q.value = "", l.mode === "backfill") {
755
- const s = await We.loadBackfillBatch(H.value);
756
- if (e !== N) return;
757
- s.pages.length && (D.value = [...D.value, ...s.pages]), te(s.batchItems), f.value = [...f.value, ...s.batchItems], H.value = s.nextPage;
783
+ if (ce.value = !0, ne.value = "", a.mode === "backfill") {
784
+ const s = await ot.loadBackfillBatch(C.value);
785
+ if (e !== E) return;
786
+ s.pages.length && ($.value = [...$.value, ...s.pages]), ae(s.batchItems), d.value = [...d.value, ...s.batchItems], C.value = s.nextPage;
758
787
  return;
759
788
  }
760
- const t = H.value;
789
+ const t = C.value;
761
790
  if (t == null) return;
762
- const a = await Ge(t);
763
- if (e !== N) return;
764
- D.value = [...D.value, t], te(a.items), f.value = [...f.value, ...a.items], H.value = a.nextPage;
791
+ const l = await lt(t);
792
+ if (e !== E) return;
793
+ $.value = [...$.value, t], ae(l.items), d.value = [...d.value, ...l.items], C.value = l.nextPage;
765
794
  } catch (t) {
766
- if (e !== N || qe(t)) return;
767
- Q.value = t instanceof Error ? t.message : String(t);
795
+ if (e !== E || Ge(t)) return;
796
+ ne.value = t instanceof Error ? t.message : String(t);
768
797
  } finally {
769
- e === N && (re.value = !1), Z === n && (Z = null);
798
+ e === E && (ce.value = !1), oe === n && (oe = null);
770
799
  }
771
- })(), Z = n, n;
800
+ })(), oe = n, n;
772
801
  }
773
- function Tt() {
774
- const e = M.value;
802
+ function Ot() {
803
+ const e = T.value;
775
804
  if (!e) return;
776
- T.value = e.scrollTop, P.value = e.clientHeight, e.scrollHeight - (e.scrollTop + e.clientHeight) <= l.prefetchThresholdPx && Bt();
805
+ H.value = e.scrollTop, q.value = e.clientHeight, e.scrollHeight - (e.scrollTop + e.clientHeight) <= a.prefetchThresholdPx && qt();
777
806
  }
778
- function Qe() {
779
- return M.value;
807
+ function it() {
808
+ return T.value;
780
809
  }
781
- function Ze(e) {
782
- I.value = A(e), P.value = e.clientHeight;
810
+ function ut(e) {
811
+ F.value = Le(e), q.value = e.clientHeight;
783
812
  }
784
- function Rt() {
785
- typeof ResizeObserver > "u" || (E = new ResizeObserver(() => {
786
- const e = Qe();
787
- e && Ze(e);
813
+ function $t() {
814
+ typeof ResizeObserver > "u" || (K = new ResizeObserver(() => {
815
+ const e = it();
816
+ e && ut(e);
788
817
  }));
789
818
  }
790
- function _t() {
819
+ function Dt() {
791
820
  return {
792
- enabled: l.mode === "backfill",
821
+ enabled: a.mode === "backfill",
793
822
  isBackfillActive: !1,
794
823
  isRequestInFlight: !1,
795
824
  requestPage: null,
@@ -798,8 +827,8 @@ const en = { class: "hidden" }, tn = {
798
827
  target: 0
799
828
  },
800
829
  cooldownMsRemaining: 0,
801
- cooldownMsTotal: Te(l.backfillRequestDelayMs),
802
- pageSize: yt(l.pageSize),
830
+ cooldownMsTotal: Ce(a.backfillRequestDelayMs),
831
+ pageSize: Bt(a.pageSize),
803
832
  bufferSize: 0,
804
833
  lastBatch: null,
805
834
  totals: {
@@ -808,22 +837,22 @@ const en = { class: "hidden" }, tn = {
808
837
  }
809
838
  };
810
839
  }
811
- function et() {
812
- N += 1, Z = null, ee = null, me = 0, W.clear(), G.length = 0, j.value = /* @__PURE__ */ new Set(), K.value = /* @__PURE__ */ new Set(), de.clear(), ve.value = /* @__PURE__ */ new Map(), Y.value = /* @__PURE__ */ new Set(), X.value = [], D.value = [], H.value = null, be.value = [], Me.value = _t(), le.value = !0, re.value = !1, Q.value = "";
840
+ function ct() {
841
+ E += 1, oe = null, le = null, ye = 0, W.clear(), U.length = 0, j.value = /* @__PURE__ */ new Set(), ee.value = /* @__PURE__ */ new Set(), ge.clear(), pe.value = /* @__PURE__ */ new Map(), V.value = /* @__PURE__ */ new Set(), Y.value = [], $.value = [], C.value = null, Pe.value = [], Te.value = Dt(), ue.value = !0, ce.value = !1, ne.value = "";
813
842
  }
814
- function tt(e) {
815
- et(), f.value = [], H.value = e;
843
+ function ft(e) {
844
+ ct(), d.value = [], C.value = e;
816
845
  }
817
- function At(e) {
818
- const n = Array.isArray(e) ? e : [e], t = [], a = /* @__PURE__ */ new Set();
846
+ function Vt(e) {
847
+ const n = Array.isArray(e) ? e : [e], t = [], l = /* @__PURE__ */ new Set();
819
848
  for (const s of n) {
820
849
  if (s == null) continue;
821
- const d = typeof s == "string" ? `s:${s}` : `n:${String(s)}`;
822
- a.has(d) || (a.add(d), t.push(s));
850
+ const v = typeof s == "string" ? `s:${s}` : `n:${String(s)}`;
851
+ l.has(v) || (l.add(v), t.push(s));
823
852
  }
824
853
  return t;
825
854
  }
826
- function Et(e) {
855
+ function Yt(e) {
827
856
  const n = [];
828
857
  for (const t of e) {
829
858
  if (typeof t == "number" && Number.isFinite(t)) {
@@ -831,112 +860,112 @@ const en = { class: "hidden" }, tn = {
831
860
  continue;
832
861
  }
833
862
  if (typeof t == "string") {
834
- const a = Number.parseInt(t, 10);
835
- Number.isFinite(a) && n.push(a);
863
+ const l = Number.parseInt(t, 10);
864
+ Number.isFinite(l) && n.push(l);
836
865
  }
837
866
  }
838
867
  return n.length ? Math.max(...n) + 1 : null;
839
868
  }
840
- function nt(e) {
841
- et();
842
- const n = At(e);
843
- D.value = n, H.value = Et(n), le.value = !1, It(f.value), te(f.value);
869
+ function dt(e) {
870
+ ct();
871
+ const n = Vt(e);
872
+ $.value = n, C.value = Yt(n), ue.value = !1, Ct(d.value), ae(d.value);
844
873
  }
845
- async function ot(e) {
846
- if (ee) return ee;
847
- const n = N;
874
+ async function vt(e) {
875
+ if (le) return le;
876
+ const n = E;
848
877
  let t = null;
849
878
  return t = (async () => {
850
879
  try {
851
- if (l.mode === "backfill") {
852
- const a = await We.loadBackfillBatch(e);
853
- if (n !== N) return;
854
- D.value = a.pages.length ? a.pages : [e], te(a.batchItems), f.value = a.batchItems, H.value = a.nextPage;
880
+ if (a.mode === "backfill") {
881
+ const l = await ot.loadBackfillBatch(e);
882
+ if (n !== E) return;
883
+ $.value = l.pages.length ? l.pages : [e], ae(l.batchItems), d.value = l.batchItems, C.value = l.nextPage;
855
884
  } else {
856
- const a = await Ge(e);
857
- if (n !== N) return;
858
- D.value = [e], te(a.items), f.value = a.items, H.value = a.nextPage;
885
+ const l = await lt(e);
886
+ if (n !== E) return;
887
+ $.value = [e], ae(l.items), d.value = l.items, C.value = l.nextPage;
859
888
  }
860
- } catch (a) {
861
- if (n !== N || qe(a)) return;
862
- Q.value = a instanceof Error ? a.message : String(a);
889
+ } catch (l) {
890
+ if (n !== E || Ge(l)) return;
891
+ ne.value = l instanceof Error ? l.message : String(l);
863
892
  } finally {
864
- n === N && (le.value = !1), ee === t && (ee = null);
893
+ n === E && (ue.value = !1), le === t && (le = null);
865
894
  }
866
- })(), ee = t, t;
895
+ })(), le = t, t;
867
896
  }
868
- function Nt() {
869
- const e = Qe();
870
- e && (Ze(e), T.value = e.scrollTop, E?.observe(e));
897
+ function Xt() {
898
+ const e = it();
899
+ e && (ut(e), H.value = e.scrollTop, K?.observe(e));
871
900
  }
872
- Be(async () => {
873
- if (Rt(), Nt(), l.restoredPagesLoaded != null) {
874
- nt(l.restoredPagesLoaded);
901
+ Ne(async () => {
902
+ if ($t(), Xt(), a.restoredPagesLoaded != null) {
903
+ dt(a.restoredPagesLoaded);
875
904
  return;
876
905
  }
877
- tt(l.page), await ot(l.page);
878
- }), gt(() => {
879
- E?.disconnect();
880
- }), U(
881
- () => l.page,
906
+ ft(a.page), await vt(a.page);
907
+ }), Pt(() => {
908
+ K?.disconnect(), I && (clearTimeout(I), I = null), k && (clearTimeout(k), k = null), R(), N();
909
+ }), G(
910
+ () => a.page,
882
911
  async (e) => {
883
- l.restoredPagesLoaded == null && (tt(e), await ot(e));
912
+ a.restoredPagesLoaded == null && (ft(e), await vt(e));
884
913
  }
885
- ), U(
886
- () => l.restoredPagesLoaded,
914
+ ), G(
915
+ () => a.restoredPagesLoaded,
887
916
  (e) => {
888
- e && nt(e);
917
+ e && dt(e);
889
918
  }
890
- ), U(
891
- k,
919
+ ), G(
920
+ J,
892
921
  () => {
893
- const e = M.value;
894
- e && (I.value = A(e));
922
+ const e = T.value;
923
+ e && (F.value = Le(e));
895
924
  },
896
925
  { immediate: !1 }
897
926
  );
898
- const Pe = S(() => Gt(I.value, l.itemWidth)), ue = S(
899
- () => Ut(I.value, Pe.value, l.itemWidth, k.value)
927
+ const Ee = S(() => an(F.value, a.itemWidth)), de = S(
928
+ () => sn(F.value, Ee.value, a.itemWidth, J.value)
900
929
  );
901
- U(
902
- [Pe, ue, k, L, z, C],
930
+ G(
931
+ [Ee, de, J, He, Q, Z],
903
932
  () => {
904
- Ke();
933
+ st();
905
934
  },
906
935
  { immediate: !0 }
907
- ), U(
936
+ ), G(
908
937
  // Performance note: this component targets very large arrays (e.g. 10k items).
909
938
  // Avoid deep watchers over items; rebuild layout only when the list structure
910
939
  // changes (new array reference or length change). This keeps metadata-only
911
940
  // updates (e.g. reactions) cheap.
912
- () => [f.value, f.value.length],
913
- () => Ke(),
941
+ () => [d.value, d.value.length],
942
+ () => st(),
914
943
  { immediate: !0 }
915
944
  );
916
- const Ct = S(() => [
945
+ const jt = S(() => [
917
946
  "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",
918
- p.class
947
+ f.class
919
948
  ]);
920
- return (e, n) => (x(), F("section", qt(b.value, { class: Ct.value }), [
921
- _("div", en, [
922
- $t(e.$slots, "default")
949
+ return (e, n) => (b(), P("section", Kt(O.value, { class: jt.value }), [
950
+ B("div", dn, [
951
+ Jt(e.$slots, "default")
923
952
  ]),
924
- _("div", {
953
+ B("div", {
925
954
  ref_key: "scrollViewportRef",
926
- ref: M,
955
+ ref: T,
927
956
  "data-testid": "items-scroll-container",
928
957
  class: "mt-4 min-h-0 flex-1 overflow-auto",
929
- style: V({ paddingRight: k.value + "px" }),
930
- onScroll: Tt
958
+ style: D({ paddingRight: J.value + "px" }),
959
+ onScroll: Ot
931
960
  }, [
932
- le.value ? (x(), F("div", tn, n[0] || (n[0] = [
933
- _("div", { class: "inline-flex items-center gap-3 text-sm text-slate-600" }, [
934
- _("svg", {
961
+ ue.value ? (b(), P("div", vn, n[0] || (n[0] = [
962
+ B("div", { class: "inline-flex items-center gap-3 text-sm text-slate-600" }, [
963
+ B("svg", {
935
964
  class: "h-5 w-5 animate-spin text-slate-500",
936
965
  viewBox: "0 0 24 24",
937
966
  "aria-hidden": "true"
938
967
  }, [
939
- _("circle", {
968
+ B("circle", {
940
969
  class: "opacity-25",
941
970
  cx: "12",
942
971
  cy: "12",
@@ -945,113 +974,115 @@ const en = { class: "hidden" }, tn = {
945
974
  stroke: "currentColor",
946
975
  "stroke-width": "4"
947
976
  }),
948
- _("path", {
977
+ B("path", {
949
978
  class: "opacity-75",
950
979
  fill: "currentColor",
951
980
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
952
981
  })
953
982
  ]),
954
- _("span", null, "Loading…")
983
+ B("span", null, "Loading…")
955
984
  ], -1)
956
- ]))) : Q.value ? (x(), F("p", nn, "Error: " + rt(Q.value), 1)) : (x(), F("div", {
985
+ ]))) : ne.value ? (b(), P("p", mn, "Error: " + pt(ne.value), 1)) : (b(), P("div", {
957
986
  key: 2,
958
987
  class: "relative",
959
- style: V({ height: Je.value + "px" })
988
+ style: D({ height: rt.value + "px" })
960
989
  }, [
961
- (x(!0), F(it, null, ut(Fe.value, (t) => (x(), F("article", {
962
- key: f.value[t].id,
990
+ (b(!0), P(yt, null, wt(_e.value, (t) => (b(), P("article", {
991
+ key: d.value[t].id,
963
992
  "data-testid": "item-card",
964
993
  class: "absolute overflow-hidden rounded-xl border border-slate-200/60 bg-white shadow-sm",
965
- style: V({
966
- width: ue.value + "px",
967
- transition: xt(f.value[t].id),
968
- transform: bt(t)
994
+ style: D({
995
+ width: de.value + "px",
996
+ transition: At(d.value[t].id),
997
+ transform: _t(t)
969
998
  })
970
999
  }, [
971
- q.value || z.value > 0 ? (x(), F("div", {
1000
+ ze.value || Q.value > 0 ? (b(), P("div", {
972
1001
  key: 0,
973
1002
  "data-testid": "item-header-container",
974
1003
  class: "w-full",
975
- style: V(Re.value)
1004
+ style: D(Oe.value)
976
1005
  }, [
977
- ge(ne(c), {
978
- "slot-fn": R.value,
979
- "slot-props": { item: f.value[t], remove: () => Se(f.value[t]) }
1006
+ xe(se(u), {
1007
+ "slot-fn": Me.value,
1008
+ "slot-props": { item: d.value[t], remove: () => Ae(d.value[t]) }
980
1009
  }, null, 8, ["slot-fn", "slot-props"])
981
- ], 4)) : oe("", !0),
982
- O.value ? (x(), he(ne(c), {
1010
+ ], 4)) : re("", !0),
1011
+ me.value ? (b(), we(se(u), {
983
1012
  key: 1,
984
- "slot-fn": O.value,
985
- "slot-props": { item: f.value[t], remove: () => Se(f.value[t]) }
986
- }, null, 8, ["slot-fn", "slot-props"])) : (x(), he(ft, {
1013
+ "slot-fn": me.value,
1014
+ "slot-props": { item: d.value[t], remove: () => Ae(d.value[t]) }
1015
+ }, null, 8, ["slot-fn", "slot-props"])) : (b(), we(bt, {
987
1016
  key: 2,
988
- item: f.value[t]
1017
+ item: d.value[t],
1018
+ onSuccess: _,
1019
+ onError: X
989
1020
  }, null, 8, ["item"])),
990
- ae.value || C.value > 0 ? (x(), F("div", {
1021
+ qe.value || Z.value > 0 ? (b(), P("div", {
991
1022
  key: 3,
992
1023
  "data-testid": "item-footer-container",
993
1024
  class: "w-full",
994
- style: V(_e.value)
1025
+ style: D($e.value)
995
1026
  }, [
996
- ge(ne(c), {
997
- "slot-fn": B.value,
998
- "slot-props": { item: f.value[t], remove: () => Se(f.value[t]) }
1027
+ xe(se(u), {
1028
+ "slot-fn": Ie.value,
1029
+ "slot-props": { item: d.value[t], remove: () => Ae(d.value[t]) }
999
1030
  }, null, 8, ["slot-fn", "slot-props"])
1000
- ], 4)) : oe("", !0)
1031
+ ], 4)) : re("", !0)
1001
1032
  ], 4))), 128)),
1002
- (x(!0), F(it, null, ut(X.value, (t) => (x(), F("article", {
1033
+ (b(!0), P(yt, null, wt(Y.value, (t) => (b(), P("article", {
1003
1034
  key: t.id + ":leaving",
1004
1035
  "data-testid": "item-card-leaving",
1005
1036
  class: "pointer-events-none absolute overflow-hidden rounded-xl border border-slate-200/60 bg-white shadow-sm",
1006
- style: V({
1037
+ style: D({
1007
1038
  width: t.width + "px",
1008
- transition: "transform " + ht + "ms ease-out",
1009
- transform: t.leaving ? "translate3d(" + t.fromX + "px," + t.fromY + "px,0)" : "translate3d(" + t.fromX + "px," + Ne(t.height) + "px,0)"
1039
+ transition: "transform " + Ft + "ms ease-out",
1040
+ transform: t.leaving ? "translate3d(" + t.fromX + "px," + t.fromY + "px,0)" : "translate3d(" + t.fromX + "px," + Ye(t.height) + "px,0)"
1010
1041
  })
1011
1042
  }, [
1012
- q.value || z.value > 0 ? (x(), F("div", {
1043
+ ze.value || Q.value > 0 ? (b(), P("div", {
1013
1044
  key: 0,
1014
1045
  "data-testid": "item-header-container",
1015
1046
  class: "w-full",
1016
- style: V(Re.value)
1047
+ style: D(Oe.value)
1017
1048
  }, [
1018
- ge(ne(c), {
1019
- "slot-fn": R.value,
1049
+ xe(se(u), {
1050
+ "slot-fn": Me.value,
1020
1051
  "slot-props": { item: t.item, remove: () => {
1021
1052
  } }
1022
1053
  }, null, 8, ["slot-fn", "slot-props"])
1023
- ], 4)) : oe("", !0),
1024
- O.value ? (x(), he(ne(c), {
1054
+ ], 4)) : re("", !0),
1055
+ me.value ? (b(), we(se(u), {
1025
1056
  key: 1,
1026
- "slot-fn": O.value,
1057
+ "slot-fn": me.value,
1027
1058
  "slot-props": { item: t.item, remove: () => {
1028
1059
  } }
1029
- }, null, 8, ["slot-fn", "slot-props"])) : (x(), he(ft, {
1060
+ }, null, 8, ["slot-fn", "slot-props"])) : (b(), we(bt, {
1030
1061
  key: 2,
1031
1062
  item: t.item
1032
1063
  }, null, 8, ["item"])),
1033
- ae.value || C.value > 0 ? (x(), F("div", {
1064
+ qe.value || Z.value > 0 ? (b(), P("div", {
1034
1065
  key: 3,
1035
1066
  "data-testid": "item-footer-container",
1036
1067
  class: "w-full",
1037
- style: V(_e.value)
1068
+ style: D($e.value)
1038
1069
  }, [
1039
- ge(ne(c), {
1040
- "slot-fn": B.value,
1070
+ xe(se(u), {
1071
+ "slot-fn": Ie.value,
1041
1072
  "slot-props": { item: t.item, remove: () => {
1042
1073
  } }
1043
1074
  }, null, 8, ["slot-fn", "slot-props"])
1044
- ], 4)) : oe("", !0)
1075
+ ], 4)) : re("", !0)
1045
1076
  ], 4))), 128))
1046
1077
  ], 4)),
1047
- _("div", on, [
1048
- re.value ? (x(), F("span", an, n[1] || (n[1] = [
1049
- _("svg", {
1078
+ B("div", hn, [
1079
+ ce.value ? (b(), P("span", gn, n[1] || (n[1] = [
1080
+ B("svg", {
1050
1081
  class: "h-4 w-4 animate-spin text-slate-500",
1051
1082
  viewBox: "0 0 24 24",
1052
1083
  "aria-hidden": "true"
1053
1084
  }, [
1054
- _("circle", {
1085
+ B("circle", {
1055
1086
  class: "opacity-25",
1056
1087
  cx: "12",
1057
1088
  cy: "12",
@@ -1060,36 +1091,47 @@ const en = { class: "hidden" }, tn = {
1060
1091
  stroke: "currentColor",
1061
1092
  "stroke-width": "4"
1062
1093
  }),
1063
- _("path", {
1094
+ B("path", {
1064
1095
  class: "opacity-75",
1065
1096
  fill: "currentColor",
1066
1097
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
1067
1098
  })
1068
1099
  ], -1),
1069
- _("span", null, "Loading more…", -1)
1070
- ]))) : H.value == null ? (x(), F("span", sn, "End of list")) : (x(), F("span", ln, "Scroll to load page " + rt(H.value), 1))
1100
+ B("span", null, "Loading more…", -1)
1101
+ ]))) : C.value == null ? (b(), P("span", pn, "End of list")) : (b(), P("span", yn, "Scroll to load page " + pt(C.value), 1))
1071
1102
  ])
1072
1103
  ], 36)
1073
1104
  ], 16));
1074
1105
  }
1075
- }), dn = pe({
1106
+ }), In = be({
1076
1107
  name: "MasonryItem",
1077
- setup(o, { slots: g }) {
1078
- const i = Ot(pt, null);
1079
- return i ? (i({
1080
- header: g.header,
1081
- default: g.default,
1082
- footer: g.footer
1083
- }), () => null) : () => null;
1108
+ setup(o, { slots: p, attrs: c }) {
1109
+ const a = Qt(Tt, null);
1110
+ if (!a)
1111
+ return () => null;
1112
+ const i = c.onPreloaded, f = c.onFailed;
1113
+ return a({
1114
+ header: p.header,
1115
+ default: p.default,
1116
+ footer: p.footer,
1117
+ onPreloaded: typeof i == "function" ? i : Array.isArray(i) ? (u) => {
1118
+ for (const r of i)
1119
+ typeof r == "function" && r(u);
1120
+ } : void 0,
1121
+ onFailed: typeof f == "function" ? f : Array.isArray(f) ? (u) => {
1122
+ for (const r of f)
1123
+ typeof r == "function" && r(u);
1124
+ } : void 0
1125
+ }), () => null;
1084
1126
  }
1085
- }), mn = {
1127
+ }), Sn = {
1086
1128
  install(o) {
1087
- o.component("Masonry", fn), o.component("MasonryItem", dn);
1129
+ o.component("Masonry", Mn), o.component("MasonryItem", In);
1088
1130
  }
1089
1131
  };
1090
1132
  export {
1091
- fn as Masonry,
1092
- dn as MasonryItem,
1093
- mn as VibePlugin,
1094
- Dt as masonryDefaults
1133
+ Mn as Masonry,
1134
+ In as MasonryItem,
1135
+ Sn as VibePlugin,
1136
+ Zt as masonryDefaults
1095
1137
  };