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