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