vue-virtual-flow 0.0.7 → 0.0.9
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/README.md +20 -4
- package/README.vi.md +19 -2
- package/dist/utils/sizeIndex.d.cts +15 -0
- package/dist/utils/sizeIndex.d.ts +15 -0
- package/dist/vue-virtual-flow.cjs +1 -1
- package/dist/vue-virtual-flow.css +1 -1
- package/dist/vue-virtual-flow.js +1404 -1311
- package/package.json +1 -1
package/dist/vue-virtual-flow.js
CHANGED
|
@@ -1,51 +1,96 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
function
|
|
3
|
-
return typeof
|
|
1
|
+
import { watch as ie, defineComponent as Oe, ref as j, computed as n, nextTick as C, onMounted as Ae, onUpdated as Xe, onBeforeUnmount as Ce, openBlock as I, createElementBlock as $, normalizeStyle as N, createElementVNode as Ge, renderSlot as ce, createTextVNode as Ve, createCommentVNode as ze, Fragment as Re, renderList as De, unref as c, normalizeClass as Ye, toDisplayString as je } from "vue";
|
|
2
|
+
function tt(l) {
|
|
3
|
+
return typeof l == "string" || typeof l == "number" || typeof l == "symbol";
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return
|
|
5
|
+
function Ze(l, P) {
|
|
6
|
+
const x = l[P];
|
|
7
|
+
return tt(x) ? x : void 0;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function lt(l) {
|
|
10
|
+
return Ze(l, "id") ?? Ze(l, "key");
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
const f =
|
|
12
|
+
function Pe(l) {
|
|
13
|
+
function P(e, p) {
|
|
14
|
+
const f = l.itemKey();
|
|
15
15
|
if (typeof f == "function")
|
|
16
|
-
return f(e,
|
|
16
|
+
return f(e, p);
|
|
17
17
|
if (e !== null && typeof e == "object") {
|
|
18
18
|
if (f !== void 0) {
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
19
|
+
const o = Ze(e, f);
|
|
20
|
+
if (o !== void 0) return o;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
22
|
+
const r = lt(e);
|
|
23
|
+
if (r !== void 0) return r;
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return p;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function x() {
|
|
28
28
|
}
|
|
29
|
-
return
|
|
30
|
-
() => [
|
|
31
|
-
|
|
29
|
+
return ie(
|
|
30
|
+
() => [l.itemKey(), l.items()],
|
|
31
|
+
x,
|
|
32
32
|
{ immediate: !0 }
|
|
33
|
-
), { getItemKey:
|
|
33
|
+
), { getItemKey: P };
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
35
|
+
function Fe(l) {
|
|
36
|
+
return l === "fill" ? "100%" : typeof l == "number" ? `${l}px` : l;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return (
|
|
40
|
-
typeof
|
|
38
|
+
function Ue(l) {
|
|
39
|
+
return (P, x) => {
|
|
40
|
+
typeof x == "string" && (x === "fill" || x.trim().endsWith("%"));
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
function at(l) {
|
|
44
|
+
const P = Float64Array.from(l), x = P.length, e = new Float64Array(x + 1);
|
|
45
|
+
let p = 0;
|
|
46
|
+
for (let r = 1; r <= x; r += 1) {
|
|
47
|
+
const o = P[r - 1];
|
|
48
|
+
p += o, e[r] += o;
|
|
49
|
+
const m = r + (r & -r);
|
|
50
|
+
m <= x && (e[m] += e[r]);
|
|
51
|
+
}
|
|
52
|
+
let f = 1;
|
|
53
|
+
for (; f * 2 <= x; ) f *= 2;
|
|
54
|
+
return {
|
|
55
|
+
length: x,
|
|
56
|
+
get total() {
|
|
57
|
+
return p;
|
|
58
|
+
},
|
|
59
|
+
getSize(r) {
|
|
60
|
+
return P[r];
|
|
61
|
+
},
|
|
62
|
+
getOffset(r) {
|
|
63
|
+
let o = 0;
|
|
64
|
+
for (let m = r; m > 0; m -= m & -m)
|
|
65
|
+
o += e[m];
|
|
66
|
+
return o;
|
|
67
|
+
},
|
|
68
|
+
setSize(r, o) {
|
|
69
|
+
const m = o - P[r];
|
|
70
|
+
if (m !== 0) {
|
|
71
|
+
P[r] = o, p += m;
|
|
72
|
+
for (let A = r + 1; A <= x; A += A & -A)
|
|
73
|
+
e[A] += m;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
findIndex(r) {
|
|
77
|
+
if (x === 0 || r <= 0) return 0;
|
|
78
|
+
if (r >= p) return x - 1;
|
|
79
|
+
let o = 0, m = 0;
|
|
80
|
+
for (let A = f; A > 0; A = Math.floor(A / 2)) {
|
|
81
|
+
const O = o + A;
|
|
82
|
+
O <= x && m + e[O] <= r && (o = O, m += e[O]);
|
|
83
|
+
}
|
|
84
|
+
return Math.min(o, x - 1);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const ot = ["aria-label"], nt = {
|
|
44
89
|
key: 0,
|
|
45
90
|
class: "vue-chat-virtual-scroll__loading-older",
|
|
46
91
|
role: "status",
|
|
47
92
|
"aria-live": "polite"
|
|
48
|
-
},
|
|
93
|
+
}, it = ["aria-posinset", "aria-setsize"], st = /* @__PURE__ */ Oe({
|
|
49
94
|
name: "ChatVirtualScroll",
|
|
50
95
|
__name: "ChatVirtualScroll",
|
|
51
96
|
props: {
|
|
@@ -64,343 +109,376 @@ const Ge = ["aria-label"], je = {
|
|
|
64
109
|
loadOlderThreshold: { default: 120 }
|
|
65
110
|
},
|
|
66
111
|
emits: ["scroll", "loadOlder", "bottomChange"],
|
|
67
|
-
setup(
|
|
68
|
-
const e =
|
|
69
|
-
let
|
|
70
|
-
const
|
|
112
|
+
setup(l, { expose: P, emit: x }) {
|
|
113
|
+
const e = l, p = x, f = j(), r = j(0), o = j(0), m = j(0), A = j(0), O = j(!0), U = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set();
|
|
114
|
+
let D, w, k = -1, E = !1, F = !1, W = !1, ne, Z = 0, H = !1, ae = 0, R, J, Y, le = 0;
|
|
115
|
+
const se = Ue(), { getItemKey: me } = Pe({
|
|
71
116
|
componentName: "ChatVirtualScroll",
|
|
72
117
|
items: () => e.items,
|
|
73
118
|
itemKey: () => e.itemKey
|
|
74
|
-
}),
|
|
75
|
-
() => Math.max(1, e.estimatedItemSize)
|
|
76
|
-
),
|
|
119
|
+
}), de = n(
|
|
120
|
+
() => Number.isFinite(e.estimatedItemSize) ? Math.max(1, e.estimatedItemSize) : 48
|
|
121
|
+
), ue = n(() => Math.max(0, Math.floor(e.overscan))), we = n(
|
|
77
122
|
() => e.size !== void 0 && Number.isFinite(e.size) && e.size > 0 ? Math.max(1, Math.floor(e.size)) : void 0
|
|
78
|
-
),
|
|
79
|
-
|
|
80
|
-
const t = new Array(e.items.length + 1), n = new Array(e.items.length);
|
|
81
|
-
t[0] = 0;
|
|
82
|
-
for (let u = 0; u < e.items.length; u += 1) {
|
|
83
|
-
const g = B(e.items[u], u), R = W.get(g) ?? q.value;
|
|
84
|
-
n[u] = R, t[u + 1] = t[u] + R;
|
|
85
|
-
}
|
|
123
|
+
), G = n(() => m.value > 0 ? m.value : typeof e.height == "number" ? Math.max(0, e.height) : de.value), u = n(() => {
|
|
124
|
+
const i = e.items.map((h, M) => me(h, M));
|
|
86
125
|
return {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
126
|
+
keys: i,
|
|
127
|
+
indexes: new Map(i.map((h, M) => [h, M])),
|
|
128
|
+
sizes: at(i.map((h) => U.get(h) ?? de.value))
|
|
90
129
|
};
|
|
91
|
-
}),
|
|
92
|
-
|
|
93
|
-
return
|
|
94
|
-
t.set(B(n, u), u);
|
|
95
|
-
}), t;
|
|
96
|
-
});
|
|
97
|
-
function D(t) {
|
|
98
|
-
if (e.items.length === 0) return 0;
|
|
99
|
-
const n = v.value.offsets;
|
|
100
|
-
let u = 0, g = e.items.length;
|
|
101
|
-
for (; u < g; ) {
|
|
102
|
-
const R = Math.floor((u + g) / 2);
|
|
103
|
-
n[R + 1] <= t ? u = R + 1 : g = R;
|
|
104
|
-
}
|
|
105
|
-
return Math.min(u, e.items.length - 1);
|
|
130
|
+
}), d = n(() => (A.value, { sizes: u.value.sizes, total: u.value.sizes.total }));
|
|
131
|
+
function z(i = d.value.total) {
|
|
132
|
+
return Math.max(0, i - G.value);
|
|
106
133
|
}
|
|
107
|
-
|
|
134
|
+
function Q(i) {
|
|
135
|
+
return d.value.sizes.findIndex(i);
|
|
136
|
+
}
|
|
137
|
+
r.value = e.initialScroll === "bottom" ? z() : 0;
|
|
138
|
+
const he = n(() => {
|
|
108
139
|
if (e.items.length === 0) return { start: 0, end: 0 };
|
|
109
|
-
const
|
|
140
|
+
const i = Q(r.value), h = Q(r.value + G.value) + 1, M = Math.max(0, i - ue.value), K = Math.min(
|
|
110
141
|
e.items.length,
|
|
111
|
-
|
|
112
|
-
),
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
115
|
-
let
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
}),
|
|
119
|
-
() => e.items.slice(
|
|
120
|
-
const
|
|
142
|
+
h + ue.value
|
|
143
|
+
), pe = we.value;
|
|
144
|
+
if (pe === void 0 || K - M <= pe) return { start: M, end: K };
|
|
145
|
+
const xe = Math.max(0, pe - (h - i)), Te = i - M, Se = K - h;
|
|
146
|
+
let Ee = Math.min(Te, Math.ceil(xe / 2));
|
|
147
|
+
const $e = Math.min(Se, xe - Ee);
|
|
148
|
+
return Ee = Math.min(Te, xe - $e), { start: i - Ee, end: h + $e };
|
|
149
|
+
}), y = n(() => he.value.start), L = n(() => he.value.end), B = n(
|
|
150
|
+
() => e.items.slice(y.value, L.value).map((i, h) => {
|
|
151
|
+
const M = y.value + h;
|
|
121
152
|
return {
|
|
122
|
-
item:
|
|
123
|
-
index:
|
|
124
|
-
key:
|
|
125
|
-
|
|
153
|
+
item: i,
|
|
154
|
+
index: M,
|
|
155
|
+
key: me(i, M),
|
|
156
|
+
bottom: Math.max(d.value.total, G.value) - d.value.sizes.getOffset(M + 1) + o.value
|
|
126
157
|
};
|
|
127
158
|
})
|
|
128
|
-
),
|
|
129
|
-
height:
|
|
159
|
+
), te = n(() => ({
|
|
160
|
+
height: Fe(e.height)
|
|
130
161
|
}));
|
|
131
|
-
function
|
|
132
|
-
var
|
|
133
|
-
|
|
162
|
+
function oe(i = d.value.total) {
|
|
163
|
+
var K;
|
|
164
|
+
const h = z(i), M = Math.min(0, ((K = f.value) == null ? void 0 : K.scrollTop) ?? 0);
|
|
165
|
+
return Math.max(0, Math.min(h, h + M + Z));
|
|
166
|
+
}
|
|
167
|
+
function re(i = !1) {
|
|
168
|
+
if (H || (W || Y) && !i || Z === 0) return;
|
|
169
|
+
H = !0;
|
|
170
|
+
const h = le, M = ++ae;
|
|
171
|
+
o.value = 0, C(() => {
|
|
172
|
+
if (M !== ae) return;
|
|
173
|
+
H = !1;
|
|
174
|
+
const K = f.value;
|
|
175
|
+
!K || h !== le || Z === 0 || (Z = 0, K.scrollTop = Math.min(0, r.value - z()), J = K.scrollTop, r.value = oe(), b(), ve());
|
|
176
|
+
});
|
|
134
177
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
178
|
+
function ye(i) {
|
|
179
|
+
const h = f.value;
|
|
180
|
+
if (h) {
|
|
181
|
+
if (Z += i, r.value = oe(), Z === 0 || z() === 0) {
|
|
182
|
+
Z = 0, o.value = 0;
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
(W || Y) && !H ? (o.value = Z, h.scrollTop >= -1 && re(!0)) : re();
|
|
186
|
+
}
|
|
141
187
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
188
|
+
function _() {
|
|
189
|
+
clearTimeout(ne), ne = void 0;
|
|
144
190
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
191
|
+
function ee() {
|
|
192
|
+
if (F) return;
|
|
193
|
+
_(), W = !1;
|
|
194
|
+
const i = Y;
|
|
195
|
+
if (Y = void 0, i) {
|
|
196
|
+
i();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
r.value = oe(), re();
|
|
147
200
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
201
|
+
function s() {
|
|
202
|
+
_(), (W || Y) && !F && (ne = setTimeout(ee, 150));
|
|
150
203
|
}
|
|
151
|
-
function
|
|
152
|
-
|
|
204
|
+
function t() {
|
|
205
|
+
R = void 0, Y = void 0;
|
|
153
206
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
207
|
+
function a() {
|
|
208
|
+
t(), _(), F = !0, W = !0, o.value = Z;
|
|
156
209
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
210
|
+
function g(i) {
|
|
211
|
+
F = i.touches.length > 0, s();
|
|
159
212
|
}
|
|
160
|
-
function
|
|
161
|
-
const
|
|
162
|
-
if (!
|
|
163
|
-
const
|
|
213
|
+
function b() {
|
|
214
|
+
const i = f.value;
|
|
215
|
+
if (!i) return;
|
|
216
|
+
const M = Math.max(
|
|
164
217
|
0,
|
|
165
|
-
|
|
218
|
+
d.value.total - oe() - i.clientHeight
|
|
166
219
|
) <= Math.max(0, e.bottomThreshold);
|
|
167
|
-
|
|
220
|
+
M !== O.value && (O.value = M, E && p("bottomChange", M));
|
|
168
221
|
}
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
|
|
222
|
+
function Me() {
|
|
223
|
+
var i;
|
|
224
|
+
m.value = ((i = f.value) == null ? void 0 : i.clientHeight) ?? 0, E && (r.value = oe()), se(f.value, e.height), C(() => {
|
|
225
|
+
b(), ve();
|
|
173
226
|
});
|
|
174
227
|
}
|
|
175
|
-
function
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
scrollTop:
|
|
179
|
-
startIndex:
|
|
180
|
-
endIndex:
|
|
181
|
-
}),
|
|
182
|
-
}
|
|
183
|
-
function
|
|
184
|
-
const
|
|
185
|
-
!
|
|
186
|
-
}
|
|
187
|
-
function
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
228
|
+
function ge() {
|
|
229
|
+
var i, h;
|
|
230
|
+
R && J !== void 0 && Math.abs((((i = f.value) == null ? void 0 : i.scrollTop) ?? 0) - J) > 1 && t(), r.value = oe(), Z !== 0 && (((h = f.value) == null ? void 0 : h.scrollTop) ?? 0) >= -1 && re(!0), s(), b(), p("scroll", {
|
|
231
|
+
scrollTop: r.value,
|
|
232
|
+
startIndex: y.value,
|
|
233
|
+
endIndex: L.value
|
|
234
|
+
}), ve();
|
|
235
|
+
}
|
|
236
|
+
function ve() {
|
|
237
|
+
const i = f.value;
|
|
238
|
+
!E || !i || !e.hasOlder || e.loadingOlder || k === e.items.length || oe() <= Math.max(0, e.loadOlderThreshold) && (k = e.items.length, p("loadOlder"));
|
|
239
|
+
}
|
|
240
|
+
function Le(i) {
|
|
241
|
+
const h = i.borderBoxSize;
|
|
242
|
+
if (h) {
|
|
243
|
+
const M = Array.isArray(h) ? h[0] : h;
|
|
244
|
+
if (M != null && M.blockSize) return M.blockSize;
|
|
192
245
|
}
|
|
193
|
-
return
|
|
194
|
-
}
|
|
195
|
-
function
|
|
196
|
-
const
|
|
197
|
-
let
|
|
198
|
-
for (const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
We !== void 0 && n.offsets[We + 1] <= u && (R += Re - Fe), W.set(Se, Re), Q = !0;
|
|
246
|
+
return i.contentRect.height;
|
|
247
|
+
}
|
|
248
|
+
function ke(i) {
|
|
249
|
+
const h = d.value.total, M = oe(), K = !W && !Y && O.value && e.stickToBottom && (E || e.initialScroll === "bottom"), pe = Q(M + G.value - 1), xe = !K && M <= 0;
|
|
250
|
+
let Te = 0, Se = !1;
|
|
251
|
+
for (const { key: Je, height: We } of i) {
|
|
252
|
+
if (!Number.isFinite(We) || We <= 0) continue;
|
|
253
|
+
const _e = u.value.indexes.get(Je);
|
|
254
|
+
if (_e === void 0) continue;
|
|
255
|
+
const Qe = d.value.sizes.getSize(_e);
|
|
256
|
+
U.set(Je, We), !(Math.abs(Qe - We) < 0.5) && (_e <= pe && (Te += We - Qe), d.value.sizes.setSize(_e, We), Se = !0);
|
|
205
257
|
}
|
|
206
|
-
if (!
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
function
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
258
|
+
if (!Se) return;
|
|
259
|
+
A.value += 1;
|
|
260
|
+
const Ee = z() - z(h), $e = R && u.value.indexes.get(R.key), Ne = $e !== void 0 && R ? Ie($e, R.align) : K ? z() : xe ? 0 : M + Te;
|
|
261
|
+
ye(Ne - M - Ee), C(b);
|
|
262
|
+
}
|
|
263
|
+
function v(i) {
|
|
264
|
+
const h = [];
|
|
265
|
+
for (const M of i) {
|
|
266
|
+
const K = q.get(M.target);
|
|
267
|
+
K !== void 0 && h.push({ key: K, height: Le(M) });
|
|
268
|
+
}
|
|
269
|
+
ke(h);
|
|
217
270
|
}
|
|
218
|
-
function
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
271
|
+
function S() {
|
|
272
|
+
const i = [];
|
|
273
|
+
for (const h of V) {
|
|
274
|
+
const M = q.get(h);
|
|
275
|
+
M !== void 0 && h.isConnected && i.push({ key: M, height: h.getBoundingClientRect().height });
|
|
276
|
+
}
|
|
277
|
+
V.clear(), ke(i);
|
|
278
|
+
}
|
|
279
|
+
function T(i, h) {
|
|
280
|
+
i instanceof HTMLElement && q.get(i) !== h && (q.set(i, h), U.has(h) || V.add(i), w == null || w.observe(i));
|
|
281
|
+
}
|
|
282
|
+
function fe() {
|
|
283
|
+
for (const [i] of q)
|
|
284
|
+
i.isConnected || (w == null || w.unobserve(i), q.delete(i), V.delete(i));
|
|
285
|
+
}
|
|
286
|
+
function X(i, h, M = !1) {
|
|
287
|
+
const K = f.value;
|
|
288
|
+
if (!K) return;
|
|
289
|
+
const pe = oe(), xe = o.value !== 0, Te = ++le;
|
|
290
|
+
ae += 1, H = !1, R = void 0;
|
|
291
|
+
const Se = h.behavior ?? "auto";
|
|
292
|
+
Y = Se === "smooth" ? () => be(i) : void 0, Z = 0, o.value = 0, W = !1, _(), Se === "auto" && (r.value = i);
|
|
293
|
+
const Ee = () => {
|
|
294
|
+
f.value !== K || Te !== le || (xe && Se !== "auto" && (K.scrollTop = pe - z()), M && Se === "auto" ? K.scrollTop = i - z() : K.scrollTo({ ...h, top: i - z(), behavior: Se }), J = K.scrollTop, Se === "auto" ? r.value = oe() : s(), C(b));
|
|
225
295
|
};
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
function
|
|
229
|
-
const
|
|
230
|
-
if (!
|
|
231
|
-
const
|
|
232
|
-
Math.max(0, Number.isFinite(
|
|
233
|
-
|
|
296
|
+
xe ? C(Ee) : Ee();
|
|
297
|
+
}
|
|
298
|
+
function be(i, h = {}) {
|
|
299
|
+
const M = f.value;
|
|
300
|
+
if (!M) return;
|
|
301
|
+
const K = Math.max(0, d.value.total - M.clientHeight), pe = Math.min(
|
|
302
|
+
Math.max(0, Number.isFinite(i) ? i : 0),
|
|
303
|
+
K
|
|
234
304
|
);
|
|
235
|
-
|
|
305
|
+
X(pe, h);
|
|
236
306
|
}
|
|
237
|
-
function
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
e.items.length - 1,
|
|
242
|
-
Math.max(0, Math.floor(t))
|
|
243
|
-
), { align: R = "start", ...Q } = n, re = v.value.sizes[g];
|
|
244
|
-
let ce = v.value.offsets[g];
|
|
245
|
-
R === "center" ? ce -= (u.clientHeight - re) / 2 : R === "end" && (ce -= u.clientHeight - re);
|
|
246
|
-
const de = Math.max(
|
|
247
|
-
0,
|
|
248
|
-
Math.min(ce, v.value.total - u.clientHeight)
|
|
249
|
-
);
|
|
250
|
-
ge(de, Q);
|
|
251
|
-
}
|
|
252
|
-
function be(t = "auto") {
|
|
253
|
-
ge(0, { behavior: t });
|
|
307
|
+
function Ie(i, h) {
|
|
308
|
+
const M = d.value.sizes.getSize(i);
|
|
309
|
+
let K = d.value.sizes.getOffset(i);
|
|
310
|
+
return h === "center" ? K -= (G.value - M) / 2 : h === "end" && (K -= G.value - M), Math.max(0, Math.min(K, z()));
|
|
254
311
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
312
|
+
function Be(i, h = {}) {
|
|
313
|
+
if (!f.value || e.items.length === 0) return;
|
|
314
|
+
const M = Math.min(
|
|
315
|
+
e.items.length - 1,
|
|
316
|
+
Math.max(0, Math.floor(Number.isFinite(i) ? i : 0))
|
|
317
|
+
), { align: K = "start", ...pe } = h;
|
|
318
|
+
X(Ie(M, K), pe);
|
|
319
|
+
const xe = u.value.keys[M];
|
|
320
|
+
h.behavior === "smooth" ? Y = () => {
|
|
321
|
+
const Te = u.value.indexes.get(xe);
|
|
322
|
+
Te !== void 0 && Be(Te, { align: K });
|
|
323
|
+
} : R = { key: xe, align: K };
|
|
324
|
+
}
|
|
325
|
+
function Ke(i = "auto") {
|
|
326
|
+
X(0, { behavior: i });
|
|
327
|
+
}
|
|
328
|
+
function He(i = "auto") {
|
|
329
|
+
const h = f.value;
|
|
330
|
+
if (!h) return;
|
|
331
|
+
const M = Math.max(0, d.value.total - h.clientHeight);
|
|
332
|
+
X(M, { behavior: i }, !0), i === "smooth" && (Y = () => He());
|
|
333
|
+
}
|
|
334
|
+
return ie(
|
|
335
|
+
u,
|
|
336
|
+
async (i, h) => {
|
|
337
|
+
const M = h.sizes.total, K = oe(M), pe = !W && !Y && O.value && e.stickToBottom, xe = h.sizes.findIndex(K + G.value - 1), Te = h.keys[xe], Se = Te === void 0 ? void 0 : i.indexes.get(Te), Ee = z() - z(M);
|
|
338
|
+
for (const $e of U.keys())
|
|
339
|
+
i.indexes.has($e) || U.delete($e);
|
|
340
|
+
if (i.keys.length === 0 || Se === void 0) {
|
|
341
|
+
Z = 0, o.value = 0, r.value = pe ? z() : Math.min(K, z());
|
|
342
|
+
const $e = r.value, Ne = le;
|
|
343
|
+
await C(), Ne === le && u.value === i && X($e, {}, !0);
|
|
344
|
+
} else {
|
|
345
|
+
const $e = i.sizes.getOffset(Se + 1) - h.sizes.getOffset(xe + 1), Ne = pe ? z() : K + $e;
|
|
346
|
+
ye(Ne - K - Ee), await C();
|
|
347
|
+
}
|
|
348
|
+
f.value && (r.value = oe(), b(), ve());
|
|
276
349
|
}
|
|
277
|
-
),
|
|
350
|
+
), ie(
|
|
278
351
|
() => [e.hasOlder, e.loadingOlder],
|
|
279
|
-
async ([
|
|
280
|
-
|
|
352
|
+
async ([i]) => {
|
|
353
|
+
i || (k = -1), await C(), ve();
|
|
281
354
|
}
|
|
282
|
-
),
|
|
283
|
-
if (
|
|
284
|
-
|
|
285
|
-
for (const [
|
|
286
|
-
|
|
355
|
+
), Ae(() => {
|
|
356
|
+
if (Me(), f.value && (f.value.scrollTop = e.initialScroll === "bottom" ? 0 : -z(), r.value = oe()), S(), typeof ResizeObserver < "u") {
|
|
357
|
+
D = new ResizeObserver(Me), w = new ResizeObserver(v), f.value && D.observe(f.value);
|
|
358
|
+
for (const [i] of q)
|
|
359
|
+
w.observe(i);
|
|
287
360
|
}
|
|
288
|
-
|
|
289
|
-
|
|
361
|
+
C(() => {
|
|
362
|
+
E = !0, b(), ve();
|
|
290
363
|
});
|
|
291
|
-
}),
|
|
292
|
-
|
|
293
|
-
}),
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
364
|
+
}), Xe(() => {
|
|
365
|
+
fe(), S();
|
|
366
|
+
}), Ce(() => {
|
|
367
|
+
E = !1, _(), t(), Z = 0, le += 1, ae += 1, D && (D.disconnect(), D = void 0), w && (w.disconnect(), w = void 0), q.clear(), V.clear();
|
|
368
|
+
}), P({
|
|
369
|
+
isAtBottom: O,
|
|
370
|
+
scrollTo: be,
|
|
371
|
+
scrollToIndex: Be,
|
|
372
|
+
scrollToTop: Ke,
|
|
373
|
+
scrollToBottom: He
|
|
374
|
+
}), (i, h) => (I(), $("div", {
|
|
300
375
|
ref_key: "viewport",
|
|
301
376
|
ref: f,
|
|
302
377
|
class: "vue-chat-virtual-scroll",
|
|
303
|
-
style:
|
|
378
|
+
style: N(te.value),
|
|
304
379
|
role: "log",
|
|
305
|
-
"aria-label":
|
|
380
|
+
"aria-label": l.ariaLabel,
|
|
306
381
|
"aria-live": "polite",
|
|
307
382
|
tabindex: "0",
|
|
308
|
-
onScrollPassive:
|
|
309
|
-
onScrollendPassive:
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
383
|
+
onScrollPassive: ge,
|
|
384
|
+
onScrollendPassive: ee,
|
|
385
|
+
onPointerdownPassive: t,
|
|
386
|
+
onWheelPassive: t,
|
|
387
|
+
onKeydown: t,
|
|
388
|
+
onTouchstartPassive: a,
|
|
389
|
+
onTouchendPassive: g,
|
|
390
|
+
onTouchcancelPassive: g
|
|
313
391
|
}, [
|
|
314
|
-
|
|
315
|
-
De("div", null, [
|
|
316
|
-
ie(t.$slots, "loadingOlder", {}, () => [
|
|
317
|
-
n[0] || (n[0] = Ie("Loading older messages…", -1))
|
|
318
|
-
])
|
|
319
|
-
])
|
|
320
|
-
])) : xe("", !0),
|
|
321
|
-
a.items.length ? (x(), T("div", {
|
|
322
|
-
key: 1,
|
|
392
|
+
Ge("div", {
|
|
323
393
|
class: "vue-chat-virtual-scroll__spacer",
|
|
324
|
-
style:
|
|
394
|
+
style: N({ height: `${Math.max(G.value, d.value.total + o.value)}px` })
|
|
325
395
|
}, [
|
|
326
|
-
|
|
327
|
-
|
|
396
|
+
l.loadingOlder ? (I(), $("div", nt, [
|
|
397
|
+
Ge("div", null, [
|
|
398
|
+
ce(i.$slots, "loadingOlder", {}, () => [
|
|
399
|
+
h[0] || (h[0] = Ve("Loading older messages…", -1))
|
|
400
|
+
])
|
|
401
|
+
])
|
|
402
|
+
])) : ze("", !0),
|
|
403
|
+
(I(!0), $(Re, null, De(B.value, ({ item: M, index: K, key: pe, bottom: xe }) => (I(), $("div", {
|
|
404
|
+
key: pe,
|
|
328
405
|
ref_for: !0,
|
|
329
|
-
ref: (
|
|
406
|
+
ref: (Te) => T(Te, pe),
|
|
330
407
|
class: "vue-chat-virtual-scroll__item",
|
|
331
|
-
style:
|
|
408
|
+
style: N({ transform: `translateY(${-xe}px)` }),
|
|
332
409
|
role: "article",
|
|
333
|
-
"aria-posinset":
|
|
334
|
-
"aria-setsize":
|
|
410
|
+
"aria-posinset": K + 1,
|
|
411
|
+
"aria-setsize": l.items.length
|
|
335
412
|
}, [
|
|
336
|
-
|
|
337
|
-
item:
|
|
338
|
-
index:
|
|
413
|
+
ce(i.$slots, "default", {
|
|
414
|
+
item: M,
|
|
415
|
+
index: K
|
|
339
416
|
})
|
|
340
|
-
], 12,
|
|
341
|
-
|
|
342
|
-
|
|
417
|
+
], 12, it))), 128)),
|
|
418
|
+
l.items.length ? ze("", !0) : ce(i.$slots, "empty", {}, void 0, void 0, 1)
|
|
419
|
+
], 4)
|
|
420
|
+
], 44, ot));
|
|
343
421
|
}
|
|
344
422
|
});
|
|
345
|
-
function
|
|
346
|
-
const
|
|
347
|
-
() =>
|
|
348
|
-
),
|
|
349
|
-
() => Math.min(1,
|
|
350
|
-
),
|
|
351
|
-
function
|
|
352
|
-
|
|
423
|
+
function qe(l) {
|
|
424
|
+
const P = j(), x = j(0), e = j(!1), p = j(!1), f = n(() => Math.max(1, l.threshold())), r = n(
|
|
425
|
+
() => l.refreshing() || p.value ? f.value : x.value
|
|
426
|
+
), o = n(
|
|
427
|
+
() => Math.min(1, x.value / f.value)
|
|
428
|
+
), m = n(() => l.refreshing() || p.value ? "Refreshing…" : o.value >= 1 ? "Release to refresh" : "Pull to refresh");
|
|
429
|
+
function A() {
|
|
430
|
+
P.value = void 0, e.value = !1, x.value = 0;
|
|
353
431
|
}
|
|
354
|
-
function
|
|
355
|
-
var
|
|
356
|
-
const
|
|
357
|
-
!
|
|
432
|
+
function O(V) {
|
|
433
|
+
var k;
|
|
434
|
+
const D = V.currentTarget, w = ((k = l.scrollTop) == null ? void 0 : k.call(l)) ?? D.scrollTop;
|
|
435
|
+
!l.enabled() || l.refreshing() || w > 0 || V.touches.length !== 1 || (P.value = V.touches[0].clientY, e.value = !0);
|
|
358
436
|
}
|
|
359
|
-
function
|
|
360
|
-
var
|
|
361
|
-
if (
|
|
362
|
-
const
|
|
363
|
-
if ((((
|
|
364
|
-
|
|
437
|
+
function U(V) {
|
|
438
|
+
var E;
|
|
439
|
+
if (P.value === void 0 || !e.value) return;
|
|
440
|
+
const D = V.currentTarget;
|
|
441
|
+
if ((((E = l.scrollTop) == null ? void 0 : E.call(l)) ?? D.scrollTop) > 0 || V.touches.length !== 1) {
|
|
442
|
+
A();
|
|
365
443
|
return;
|
|
366
444
|
}
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
369
|
-
|
|
445
|
+
const k = V.touches[0].clientY - P.value;
|
|
446
|
+
if (k <= 0) {
|
|
447
|
+
x.value = 0;
|
|
370
448
|
return;
|
|
371
449
|
}
|
|
372
|
-
|
|
450
|
+
V.preventDefault(), x.value = Math.min(k * 0.5, f.value * 2);
|
|
373
451
|
}
|
|
374
|
-
function
|
|
375
|
-
if (
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
|
|
452
|
+
function q() {
|
|
453
|
+
if (P.value === void 0) return;
|
|
454
|
+
const V = x.value >= f.value && l.enabled() && !l.refreshing();
|
|
455
|
+
if (P.value = void 0, e.value = !1, !V) {
|
|
456
|
+
x.value = 0;
|
|
379
457
|
return;
|
|
380
458
|
}
|
|
381
|
-
|
|
382
|
-
|
|
459
|
+
x.value = f.value, p.value = !0, l.onRefresh(), C(() => {
|
|
460
|
+
l.refreshing() || (p.value = !1, x.value = 0);
|
|
383
461
|
});
|
|
384
462
|
}
|
|
385
|
-
return
|
|
386
|
-
() =>
|
|
387
|
-
(
|
|
388
|
-
|
|
463
|
+
return ie(
|
|
464
|
+
() => l.refreshing(),
|
|
465
|
+
(V, D) => {
|
|
466
|
+
V ? (p.value = !1, x.value = f.value) : D && (p.value = !1, x.value = 0);
|
|
389
467
|
}
|
|
390
468
|
), {
|
|
391
469
|
pulling: e,
|
|
392
|
-
pullDistance:
|
|
393
|
-
pullOffset:
|
|
394
|
-
pullProgress:
|
|
395
|
-
refreshMessage:
|
|
470
|
+
pullDistance: x,
|
|
471
|
+
pullOffset: r,
|
|
472
|
+
pullProgress: o,
|
|
473
|
+
refreshMessage: m,
|
|
396
474
|
refreshThreshold: f,
|
|
397
|
-
handleTouchStart:
|
|
398
|
-
handleTouchMove:
|
|
399
|
-
handleTouchEnd:
|
|
400
|
-
handleTouchCancel:
|
|
475
|
+
handleTouchStart: O,
|
|
476
|
+
handleTouchMove: U,
|
|
477
|
+
handleTouchEnd: q,
|
|
478
|
+
handleTouchCancel: A
|
|
401
479
|
};
|
|
402
480
|
}
|
|
403
|
-
const
|
|
481
|
+
const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PURE__ */ Oe({
|
|
404
482
|
name: "DynamicVirtualScroll",
|
|
405
483
|
__name: "DynamicVirtualScroll",
|
|
406
484
|
props: {
|
|
@@ -419,294 +497,294 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
|
|
|
419
497
|
pullRefreshThreshold: { default: 64 }
|
|
420
498
|
},
|
|
421
499
|
emits: ["scroll", "loadMore", "refresh"],
|
|
422
|
-
setup(
|
|
423
|
-
const e =
|
|
500
|
+
setup(l, { expose: P, emit: x }) {
|
|
501
|
+
const e = l, p = x, {
|
|
424
502
|
pulling: f,
|
|
425
|
-
pullDistance:
|
|
426
|
-
pullOffset:
|
|
427
|
-
pullProgress:
|
|
428
|
-
refreshMessage:
|
|
429
|
-
refreshThreshold:
|
|
430
|
-
handleTouchStart:
|
|
431
|
-
handleTouchMove:
|
|
432
|
-
handleTouchEnd:
|
|
433
|
-
handleTouchCancel:
|
|
434
|
-
} =
|
|
503
|
+
pullDistance: r,
|
|
504
|
+
pullOffset: o,
|
|
505
|
+
pullProgress: m,
|
|
506
|
+
refreshMessage: A,
|
|
507
|
+
refreshThreshold: O,
|
|
508
|
+
handleTouchStart: U,
|
|
509
|
+
handleTouchMove: q,
|
|
510
|
+
handleTouchEnd: V,
|
|
511
|
+
handleTouchCancel: D
|
|
512
|
+
} = qe({
|
|
435
513
|
enabled: () => e.pullToRefresh,
|
|
436
514
|
refreshing: () => e.refreshing,
|
|
437
515
|
threshold: () => e.pullRefreshThreshold,
|
|
438
|
-
onRefresh: () =>
|
|
439
|
-
}),
|
|
440
|
-
let
|
|
441
|
-
const
|
|
516
|
+
onRefresh: () => p("refresh")
|
|
517
|
+
}), w = j(), k = j(0), E = j(0), F = j(0), W = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Map();
|
|
518
|
+
let Z, H, ae = -1;
|
|
519
|
+
const R = Ue(), { getItemKey: J } = Pe({
|
|
442
520
|
componentName: "DynamicVirtualScroll",
|
|
443
521
|
items: () => e.items,
|
|
444
522
|
itemKey: () => e.itemKey
|
|
445
|
-
}),
|
|
523
|
+
}), Y = n(
|
|
446
524
|
() => Math.max(1, e.estimatedItemSize)
|
|
447
|
-
),
|
|
448
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
449
|
-
),
|
|
450
|
-
|
|
451
|
-
const s = new Array(e.items.length + 1),
|
|
525
|
+
), le = n(
|
|
526
|
+
() => Math.max(1, e.loadingItemSize ?? Y.value)
|
|
527
|
+
), se = n(() => Math.max(0, Math.floor(e.overscan))), me = n(() => E.value > 0 ? E.value : typeof e.height == "number" ? Math.max(0, e.height) : Y.value), de = n(() => {
|
|
528
|
+
F.value;
|
|
529
|
+
const s = new Array(e.items.length + 1), t = new Array(e.items.length);
|
|
452
530
|
s[0] = 0;
|
|
453
|
-
for (let
|
|
454
|
-
const
|
|
455
|
-
|
|
531
|
+
for (let a = 0; a < e.items.length; a += 1) {
|
|
532
|
+
const g = J(e.items[a], a), b = W.get(g) ?? Y.value;
|
|
533
|
+
t[a] = b, s[a + 1] = s[a] + b;
|
|
456
534
|
}
|
|
457
535
|
return {
|
|
458
536
|
offsets: s,
|
|
459
|
-
sizes:
|
|
537
|
+
sizes: t,
|
|
460
538
|
total: s[e.items.length] ?? 0
|
|
461
539
|
};
|
|
462
|
-
}),
|
|
463
|
-
() =>
|
|
464
|
-
),
|
|
540
|
+
}), ue = n(
|
|
541
|
+
() => de.value.total + (e.loading ? le.value : 0)
|
|
542
|
+
), we = n(() => {
|
|
465
543
|
const s = /* @__PURE__ */ new Map();
|
|
466
|
-
return e.items.forEach((
|
|
467
|
-
s.set(
|
|
544
|
+
return e.items.forEach((t, a) => {
|
|
545
|
+
s.set(J(t, a), a);
|
|
468
546
|
}), s;
|
|
469
547
|
});
|
|
470
|
-
function
|
|
548
|
+
function G(s) {
|
|
471
549
|
if (e.items.length === 0) return 0;
|
|
472
|
-
const
|
|
473
|
-
let
|
|
474
|
-
for (;
|
|
475
|
-
const
|
|
476
|
-
|
|
550
|
+
const t = de.value.offsets;
|
|
551
|
+
let a = 0, g = e.items.length;
|
|
552
|
+
for (; a < g; ) {
|
|
553
|
+
const b = Math.floor((a + g) / 2);
|
|
554
|
+
t[b + 1] <= s ? a = b + 1 : g = b;
|
|
477
555
|
}
|
|
478
|
-
return Math.min(
|
|
556
|
+
return Math.min(a, e.items.length - 1);
|
|
479
557
|
}
|
|
480
|
-
const
|
|
558
|
+
const u = n(
|
|
481
559
|
() => Math.max(
|
|
482
560
|
0,
|
|
483
|
-
|
|
561
|
+
G(k.value) - se.value
|
|
484
562
|
)
|
|
485
|
-
),
|
|
563
|
+
), d = n(() => {
|
|
486
564
|
if (e.items.length === 0) return 0;
|
|
487
|
-
const s =
|
|
565
|
+
const s = G(k.value + me.value) + 1;
|
|
488
566
|
return Math.min(
|
|
489
567
|
e.items.length,
|
|
490
|
-
s +
|
|
568
|
+
s + se.value
|
|
491
569
|
);
|
|
492
|
-
}),
|
|
493
|
-
() => e.items.slice(
|
|
494
|
-
const
|
|
570
|
+
}), z = n(
|
|
571
|
+
() => e.items.slice(u.value, d.value).map((s, t) => {
|
|
572
|
+
const a = u.value + t;
|
|
495
573
|
return {
|
|
496
574
|
item: s,
|
|
497
|
-
index:
|
|
498
|
-
key:
|
|
499
|
-
top:
|
|
575
|
+
index: a,
|
|
576
|
+
key: J(s, a),
|
|
577
|
+
top: de.value.offsets[a]
|
|
500
578
|
};
|
|
501
579
|
})
|
|
502
|
-
),
|
|
503
|
-
height:
|
|
580
|
+
), Q = n(() => ({
|
|
581
|
+
height: Fe(e.height)
|
|
504
582
|
}));
|
|
505
|
-
function
|
|
583
|
+
function he() {
|
|
506
584
|
var s;
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
function
|
|
510
|
-
|
|
511
|
-
scrollTop:
|
|
512
|
-
startIndex:
|
|
513
|
-
endIndex:
|
|
514
|
-
}),
|
|
515
|
-
}
|
|
516
|
-
function
|
|
517
|
-
const s =
|
|
518
|
-
if (!s || !e.hasMore || e.loading ||
|
|
585
|
+
E.value = ((s = w.value) == null ? void 0 : s.clientHeight) ?? 0, R(w.value, e.height), C(L);
|
|
586
|
+
}
|
|
587
|
+
function y(s) {
|
|
588
|
+
k.value = s.currentTarget.scrollTop, p("scroll", {
|
|
589
|
+
scrollTop: k.value,
|
|
590
|
+
startIndex: u.value,
|
|
591
|
+
endIndex: d.value
|
|
592
|
+
}), L();
|
|
593
|
+
}
|
|
594
|
+
function L() {
|
|
595
|
+
const s = w.value;
|
|
596
|
+
if (!s || !e.hasMore || e.loading || ae === e.items.length)
|
|
519
597
|
return;
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
}
|
|
523
|
-
function
|
|
524
|
-
const
|
|
525
|
-
if (
|
|
526
|
-
const
|
|
527
|
-
if (
|
|
598
|
+
const t = Math.max(0, e.loadMoreThreshold);
|
|
599
|
+
ue.value - s.scrollTop - s.clientHeight <= t && (ae = e.items.length, p("loadMore"));
|
|
600
|
+
}
|
|
601
|
+
function B(s) {
|
|
602
|
+
const t = s.borderBoxSize;
|
|
603
|
+
if (t) {
|
|
604
|
+
const a = Array.isArray(t) ? t[0] : t;
|
|
605
|
+
if (a != null && a.blockSize) return a.blockSize;
|
|
528
606
|
}
|
|
529
607
|
return s.contentRect.height;
|
|
530
608
|
}
|
|
531
|
-
function
|
|
532
|
-
const
|
|
533
|
-
let
|
|
534
|
-
for (const
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
const
|
|
538
|
-
if (Math.abs(
|
|
539
|
-
const
|
|
540
|
-
|
|
609
|
+
function te(s) {
|
|
610
|
+
const t = de.value;
|
|
611
|
+
let a = 0, g = !1;
|
|
612
|
+
for (const b of s) {
|
|
613
|
+
const Me = b.target, ge = ne.get(Me), ve = B(b);
|
|
614
|
+
if (ge === void 0 || ve <= 0) continue;
|
|
615
|
+
const Le = W.get(ge) ?? Y.value;
|
|
616
|
+
if (Math.abs(Le - ve) < 0.5) continue;
|
|
617
|
+
const ke = we.value.get(ge);
|
|
618
|
+
ke !== void 0 && t.offsets[ke + 1] <= k.value && (a += ve - Le), W.set(ge, ve), g = !0;
|
|
541
619
|
}
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
|
|
620
|
+
g && (F.value += 1, C(L), a !== 0 && C(() => {
|
|
621
|
+
const b = w.value;
|
|
622
|
+
b && (b.scrollTop += a, k.value = b.scrollTop);
|
|
545
623
|
}));
|
|
546
624
|
}
|
|
547
|
-
function
|
|
548
|
-
s instanceof HTMLElement && (
|
|
625
|
+
function oe(s, t) {
|
|
626
|
+
s instanceof HTMLElement && (ne.set(s, t), H == null || H.observe(s));
|
|
549
627
|
}
|
|
550
|
-
function
|
|
551
|
-
for (const [s] of
|
|
552
|
-
s.isConnected || (
|
|
628
|
+
function re() {
|
|
629
|
+
for (const [s] of ne)
|
|
630
|
+
s.isConnected || (H == null || H.unobserve(s), ne.delete(s));
|
|
553
631
|
}
|
|
554
|
-
function
|
|
555
|
-
const
|
|
556
|
-
if (!
|
|
557
|
-
const
|
|
632
|
+
function ye(s, t = {}) {
|
|
633
|
+
const a = w.value;
|
|
634
|
+
if (!a) return;
|
|
635
|
+
const g = Math.max(0, ue.value - a.clientHeight), b = Math.min(
|
|
558
636
|
Math.max(0, Number.isFinite(s) ? s : 0),
|
|
559
|
-
|
|
560
|
-
),
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
function
|
|
564
|
-
const
|
|
565
|
-
if (!
|
|
566
|
-
const
|
|
637
|
+
g
|
|
638
|
+
), Me = t.behavior ?? "auto";
|
|
639
|
+
Me === "auto" && (k.value = b), a.scrollTo({ ...t, top: b, behavior: Me });
|
|
640
|
+
}
|
|
641
|
+
function _(s, t = {}) {
|
|
642
|
+
const a = w.value;
|
|
643
|
+
if (!a || e.items.length === 0) return;
|
|
644
|
+
const g = Math.min(
|
|
567
645
|
e.items.length - 1,
|
|
568
646
|
Math.max(0, Math.floor(s))
|
|
569
|
-
), { align:
|
|
570
|
-
let
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
const
|
|
647
|
+
), { align: b = "start", ...Me } = t;
|
|
648
|
+
let ge = de.value.offsets[g];
|
|
649
|
+
const ve = de.value.sizes[g];
|
|
650
|
+
b === "center" ? ge -= (a.clientHeight - ve) / 2 : b === "end" && (ge -= a.clientHeight - ve);
|
|
651
|
+
const Le = Math.max(
|
|
574
652
|
0,
|
|
575
|
-
Math.min(
|
|
576
|
-
),
|
|
577
|
-
|
|
578
|
-
...
|
|
579
|
-
top:
|
|
580
|
-
behavior:
|
|
653
|
+
Math.min(ge, ue.value - a.clientHeight)
|
|
654
|
+
), ke = Me.behavior ?? "auto";
|
|
655
|
+
ke === "auto" && (k.value = Le), a.scrollTo({
|
|
656
|
+
...Me,
|
|
657
|
+
top: Le,
|
|
658
|
+
behavior: ke
|
|
581
659
|
});
|
|
582
660
|
}
|
|
583
|
-
function
|
|
584
|
-
var
|
|
585
|
-
(
|
|
661
|
+
function ee(s = "auto") {
|
|
662
|
+
var t;
|
|
663
|
+
(t = w.value) == null || t.scrollTo({ top: 0, behavior: s });
|
|
586
664
|
}
|
|
587
|
-
return
|
|
665
|
+
return ie(
|
|
588
666
|
() => e.itemKey,
|
|
589
667
|
() => {
|
|
590
|
-
|
|
668
|
+
W.clear(), F.value += 1;
|
|
591
669
|
}
|
|
592
|
-
),
|
|
670
|
+
), ie(
|
|
593
671
|
() => e.items.length,
|
|
594
672
|
async () => {
|
|
595
673
|
const s = new Set(
|
|
596
|
-
e.items.map((
|
|
674
|
+
e.items.map((g, b) => J(g, b))
|
|
597
675
|
);
|
|
598
|
-
for (const
|
|
599
|
-
s.has(
|
|
600
|
-
|
|
601
|
-
const
|
|
602
|
-
if (!
|
|
603
|
-
const
|
|
604
|
-
|
|
676
|
+
for (const g of W.keys())
|
|
677
|
+
s.has(g) || W.delete(g);
|
|
678
|
+
F.value += 1, await C();
|
|
679
|
+
const t = w.value;
|
|
680
|
+
if (!t) return;
|
|
681
|
+
const a = Math.max(0, ue.value - t.clientHeight);
|
|
682
|
+
t.scrollTop > a && (t.scrollTop = a, k.value = a), L();
|
|
605
683
|
}
|
|
606
|
-
),
|
|
684
|
+
), ie(
|
|
607
685
|
() => [e.hasMore, e.loading],
|
|
608
686
|
async ([s]) => {
|
|
609
|
-
s || (
|
|
687
|
+
s || (ae = -1), await C(), L();
|
|
610
688
|
}
|
|
611
|
-
),
|
|
612
|
-
if (
|
|
613
|
-
|
|
614
|
-
for (const [s] of
|
|
615
|
-
|
|
689
|
+
), Ae(() => {
|
|
690
|
+
if (he(), typeof ResizeObserver < "u") {
|
|
691
|
+
Z = new ResizeObserver(he), H = new ResizeObserver(te), w.value && Z.observe(w.value);
|
|
692
|
+
for (const [s] of ne)
|
|
693
|
+
H.observe(s);
|
|
616
694
|
}
|
|
617
|
-
|
|
618
|
-
}),
|
|
619
|
-
|
|
620
|
-
}),
|
|
621
|
-
scrollTo:
|
|
622
|
-
scrollToIndex:
|
|
623
|
-
scrollToTop:
|
|
624
|
-
}), (s,
|
|
695
|
+
C(L);
|
|
696
|
+
}), Xe(re), Ce(() => {
|
|
697
|
+
Z && (Z.disconnect(), Z = void 0), H && (H.disconnect(), H = void 0), ne.clear();
|
|
698
|
+
}), P({
|
|
699
|
+
scrollTo: ye,
|
|
700
|
+
scrollToIndex: _,
|
|
701
|
+
scrollToTop: ee
|
|
702
|
+
}), (s, t) => (I(), $("div", {
|
|
625
703
|
ref_key: "viewport",
|
|
626
|
-
ref:
|
|
627
|
-
class:
|
|
628
|
-
style:
|
|
704
|
+
ref: w,
|
|
705
|
+
class: Ye(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": c(f) }]),
|
|
706
|
+
style: N(Q.value),
|
|
629
707
|
role: "list",
|
|
630
|
-
"aria-label":
|
|
708
|
+
"aria-label": l.ariaLabel,
|
|
631
709
|
tabindex: "0",
|
|
632
|
-
onScrollPassive:
|
|
633
|
-
onTouchstartPassive:
|
|
634
|
-
(...
|
|
635
|
-
onTouchmove:
|
|
636
|
-
(...
|
|
637
|
-
onTouchend:
|
|
638
|
-
(...
|
|
639
|
-
onTouchcancel:
|
|
640
|
-
(...
|
|
710
|
+
onScrollPassive: y,
|
|
711
|
+
onTouchstartPassive: t[0] || (t[0] = //@ts-ignore
|
|
712
|
+
(...a) => c(U) && c(U)(...a)),
|
|
713
|
+
onTouchmove: t[1] || (t[1] = //@ts-ignore
|
|
714
|
+
(...a) => c(q) && c(q)(...a)),
|
|
715
|
+
onTouchend: t[2] || (t[2] = //@ts-ignore
|
|
716
|
+
(...a) => c(V) && c(V)(...a)),
|
|
717
|
+
onTouchcancel: t[3] || (t[3] = //@ts-ignore
|
|
718
|
+
(...a) => c(D) && c(D)(...a))
|
|
641
719
|
}, [
|
|
642
|
-
|
|
720
|
+
l.pullToRefresh || l.refreshing ? (I(), $("div", {
|
|
643
721
|
key: 0,
|
|
644
722
|
class: "vue-dynamic-virtual-scroll__refresh",
|
|
645
|
-
style:
|
|
646
|
-
height: `${c(
|
|
647
|
-
transform: `translateY(${c(
|
|
723
|
+
style: N({
|
|
724
|
+
height: `${c(O)}px`,
|
|
725
|
+
transform: `translateY(${c(o) - c(O)}px)`
|
|
648
726
|
}),
|
|
649
727
|
role: "status",
|
|
650
728
|
"aria-live": "polite"
|
|
651
729
|
}, [
|
|
652
|
-
|
|
653
|
-
pullDistance: c(
|
|
654
|
-
progress: c(
|
|
655
|
-
refreshing:
|
|
730
|
+
ce(s.$slots, "refresh", {
|
|
731
|
+
pullDistance: c(r),
|
|
732
|
+
progress: c(m),
|
|
733
|
+
refreshing: l.refreshing
|
|
656
734
|
}, () => [
|
|
657
|
-
|
|
735
|
+
Ve(je(c(A)), 1)
|
|
658
736
|
])
|
|
659
|
-
], 4)) :
|
|
660
|
-
|
|
737
|
+
], 4)) : ze("", !0),
|
|
738
|
+
l.items.length || l.loading ? (I(), $("div", {
|
|
661
739
|
key: 1,
|
|
662
740
|
class: "vue-dynamic-virtual-scroll__spacer",
|
|
663
|
-
style:
|
|
664
|
-
height: `${
|
|
665
|
-
transform: `translateY(${c(
|
|
741
|
+
style: N({
|
|
742
|
+
height: `${ue.value}px`,
|
|
743
|
+
transform: `translateY(${c(o)}px)`
|
|
666
744
|
})
|
|
667
745
|
}, [
|
|
668
|
-
(
|
|
669
|
-
key:
|
|
746
|
+
(I(!0), $(Re, null, De(z.value, ({ item: a, index: g, key: b, top: Me }) => (I(), $("div", {
|
|
747
|
+
key: b,
|
|
670
748
|
ref_for: !0,
|
|
671
|
-
ref: (
|
|
749
|
+
ref: (ge) => oe(ge, b),
|
|
672
750
|
class: "vue-dynamic-virtual-scroll__item",
|
|
673
|
-
style:
|
|
751
|
+
style: N({ transform: `translateY(${Me}px)` }),
|
|
674
752
|
role: "listitem",
|
|
675
|
-
"aria-posinset":
|
|
676
|
-
"aria-setsize":
|
|
753
|
+
"aria-posinset": g + 1,
|
|
754
|
+
"aria-setsize": l.items.length
|
|
677
755
|
}, [
|
|
678
|
-
|
|
679
|
-
item:
|
|
680
|
-
index:
|
|
756
|
+
ce(s.$slots, "default", {
|
|
757
|
+
item: a,
|
|
758
|
+
index: g
|
|
681
759
|
})
|
|
682
|
-
], 12,
|
|
683
|
-
|
|
760
|
+
], 12, ut))), 128)),
|
|
761
|
+
l.loading ? (I(), $("div", {
|
|
684
762
|
key: 0,
|
|
685
763
|
class: "vue-dynamic-virtual-scroll__loading",
|
|
686
|
-
style:
|
|
687
|
-
height: `${
|
|
688
|
-
transform: `translateY(${
|
|
764
|
+
style: N({
|
|
765
|
+
height: `${le.value}px`,
|
|
766
|
+
transform: `translateY(${de.value.total}px)`
|
|
689
767
|
}),
|
|
690
768
|
role: "status",
|
|
691
769
|
"aria-live": "polite"
|
|
692
770
|
}, [
|
|
693
|
-
|
|
694
|
-
|
|
771
|
+
ce(s.$slots, "loading", {}, () => [
|
|
772
|
+
t[4] || (t[4] = Ve("Loading more…", -1))
|
|
695
773
|
])
|
|
696
|
-
], 4)) :
|
|
697
|
-
], 4)) : (
|
|
774
|
+
], 4)) : ze("", !0)
|
|
775
|
+
], 4)) : (I(), $("div", {
|
|
698
776
|
key: 2,
|
|
699
777
|
class: "vue-dynamic-virtual-scroll__empty",
|
|
700
|
-
style:
|
|
778
|
+
style: N({ transform: `translateY(${c(o)}px)` })
|
|
701
779
|
}, [
|
|
702
|
-
|
|
780
|
+
ce(s.$slots, "empty")
|
|
703
781
|
], 4))
|
|
704
|
-
], 46,
|
|
782
|
+
], 46, rt));
|
|
705
783
|
}
|
|
706
|
-
}),
|
|
784
|
+
}), ct = ["aria-label"], dt = ["aria-current", "aria-posinset", "aria-setsize"], ft = {
|
|
707
785
|
key: 1,
|
|
708
786
|
class: "vue-short-media-feed__empty"
|
|
709
|
-
},
|
|
787
|
+
}, vt = 36, ht = 700, mt = /* @__PURE__ */ Oe({
|
|
710
788
|
name: "ShortMediaFeed",
|
|
711
789
|
__name: "ShortMediaFeed",
|
|
712
790
|
props: {
|
|
@@ -721,155 +799,170 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
|
|
|
721
799
|
loadMoreThreshold: { default: 2 }
|
|
722
800
|
},
|
|
723
801
|
emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
|
|
724
|
-
setup(
|
|
725
|
-
const e =
|
|
726
|
-
let
|
|
727
|
-
const
|
|
802
|
+
setup(l, { expose: P, emit: x }) {
|
|
803
|
+
const e = l, p = x, f = j(), r = j(0), o = j(R(e.activeIndex));
|
|
804
|
+
let m, A = -1, O = 0, U = !1, q;
|
|
805
|
+
const V = Ue(), { getItemKey: D } = Pe({
|
|
728
806
|
componentName: "ShortMediaFeed",
|
|
729
807
|
items: () => e.items,
|
|
730
808
|
itemKey: () => e.itemKey
|
|
731
|
-
}),
|
|
809
|
+
}), w = n(
|
|
732
810
|
() => Math.max(0, Math.floor(e.buffer))
|
|
733
|
-
),
|
|
811
|
+
), k = n(
|
|
734
812
|
() => Math.max(
|
|
735
813
|
0,
|
|
736
814
|
Math.floor(
|
|
737
815
|
Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
|
|
738
816
|
)
|
|
739
817
|
)
|
|
740
|
-
),
|
|
741
|
-
() => Math.max(0,
|
|
742
|
-
),
|
|
818
|
+
), E = n(() => r.value > 0 ? r.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), F = n(
|
|
819
|
+
() => Math.max(0, o.value - w.value)
|
|
820
|
+
), W = n(
|
|
743
821
|
() => Math.min(
|
|
744
822
|
e.items.length,
|
|
745
|
-
|
|
823
|
+
o.value + w.value + 1
|
|
746
824
|
)
|
|
747
|
-
),
|
|
748
|
-
() => e.items.slice(
|
|
749
|
-
item:
|
|
750
|
-
index:
|
|
825
|
+
), ne = n(
|
|
826
|
+
() => e.items.slice(F.value, W.value).map((u, d) => ({
|
|
827
|
+
item: u,
|
|
828
|
+
index: F.value + d
|
|
751
829
|
}))
|
|
752
|
-
),
|
|
753
|
-
() => (e.items.length -
|
|
754
|
-
),
|
|
755
|
-
height:
|
|
830
|
+
), Z = n(() => F.value * E.value), H = n(
|
|
831
|
+
() => (e.items.length - W.value) * E.value
|
|
832
|
+
), ae = n(() => ({
|
|
833
|
+
height: Fe(e.height)
|
|
756
834
|
}));
|
|
757
|
-
function
|
|
835
|
+
function R(u) {
|
|
758
836
|
return e.items.length === 0 ? 0 : Math.min(
|
|
759
837
|
e.items.length - 1,
|
|
760
|
-
Math.max(0, Math.floor(Number.isFinite(
|
|
838
|
+
Math.max(0, Math.floor(Number.isFinite(u) ? u : 0))
|
|
761
839
|
);
|
|
762
840
|
}
|
|
763
|
-
function
|
|
764
|
-
if (!e.hasMore || e.loading ||
|
|
841
|
+
function J() {
|
|
842
|
+
if (!e.hasMore || e.loading || A === e.items.length)
|
|
765
843
|
return;
|
|
766
|
-
(e.items.length === 0 ? 0 : e.items.length - 1 -
|
|
844
|
+
(e.items.length === 0 ? 0 : e.items.length - 1 - o.value) <= k.value && (A = e.items.length, p("loadMore"));
|
|
767
845
|
}
|
|
768
|
-
function
|
|
769
|
-
const
|
|
770
|
-
|
|
771
|
-
index:
|
|
772
|
-
item: e.items[
|
|
773
|
-
}),
|
|
846
|
+
function Y(u) {
|
|
847
|
+
const d = R(u);
|
|
848
|
+
d === o.value || e.items.length === 0 || (o.value = d, p("update:activeIndex", d), p("change", {
|
|
849
|
+
index: d,
|
|
850
|
+
item: e.items[d]
|
|
851
|
+
}), d === 0 && p("reachStart"), d === e.items.length - 1 && p("reachEnd"), J());
|
|
774
852
|
}
|
|
775
|
-
function
|
|
776
|
-
const
|
|
777
|
-
|
|
853
|
+
function le(u, d = {}) {
|
|
854
|
+
const z = f.value;
|
|
855
|
+
z && (typeof z.scrollTo == "function" ? z.scrollTo({ ...d, top: u }) : z.scrollTop = u);
|
|
778
856
|
}
|
|
779
|
-
function
|
|
857
|
+
function se(u, d = {}) {
|
|
780
858
|
if (e.items.length === 0) return;
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
function
|
|
785
|
-
if (
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
}
|
|
789
|
-
function
|
|
790
|
-
let
|
|
791
|
-
|
|
859
|
+
const z = R(u);
|
|
860
|
+
Y(z), le(z * E.value, d);
|
|
861
|
+
}
|
|
862
|
+
function me(u) {
|
|
863
|
+
if (E.value <= 0) return;
|
|
864
|
+
const d = u.currentTarget.scrollTop;
|
|
865
|
+
Y(Math.round(d / E.value));
|
|
866
|
+
}
|
|
867
|
+
function de(u) {
|
|
868
|
+
let d;
|
|
869
|
+
u.key === "ArrowDown" || u.key === "PageDown" ? d = o.value + 1 : u.key === "ArrowUp" || u.key === "PageUp" ? d = o.value - 1 : u.key === "Home" ? d = 0 : u.key === "End" && (d = e.items.length - 1), d !== void 0 && (u.preventDefault(), se(d, { behavior: "smooth" }));
|
|
870
|
+
}
|
|
871
|
+
function ue(u) {
|
|
872
|
+
return u.deltaMode === WheelEvent.DOM_DELTA_LINE ? u.deltaY * 16 : u.deltaMode === WheelEvent.DOM_DELTA_PAGE ? u.deltaY * (E.value || 1) : u.deltaY;
|
|
873
|
+
}
|
|
874
|
+
function we(u) {
|
|
875
|
+
if (u.ctrlKey || Math.abs(u.deltaX) > Math.abs(u.deltaY) || e.items.length === 0 || E.value <= 0 || (u.preventDefault(), U)) return;
|
|
876
|
+
const d = ue(u);
|
|
877
|
+
if (d * O < 0 && (O = 0), O += d, Math.abs(O) < vt) return;
|
|
878
|
+
const z = O > 0 ? 1 : -1;
|
|
879
|
+
O = 0;
|
|
880
|
+
const Q = o.value + z;
|
|
881
|
+
Q < 0 || Q >= e.items.length || (U = !0, se(Q, { behavior: "smooth" }), q = setTimeout(() => {
|
|
882
|
+
U = !1;
|
|
883
|
+
}, ht));
|
|
792
884
|
}
|
|
793
|
-
function
|
|
794
|
-
var
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
|
|
885
|
+
function G() {
|
|
886
|
+
var d;
|
|
887
|
+
const u = ((d = f.value) == null ? void 0 : d.clientHeight) ?? 0;
|
|
888
|
+
V(f.value, e.height), !(u <= 0 || u === r.value) && (r.value = u, C(() => {
|
|
889
|
+
le(o.value * u);
|
|
798
890
|
}));
|
|
799
891
|
}
|
|
800
|
-
return
|
|
892
|
+
return ie(
|
|
801
893
|
() => e.activeIndex,
|
|
802
|
-
async (
|
|
803
|
-
const
|
|
804
|
-
|
|
894
|
+
async (u) => {
|
|
895
|
+
const d = R(u);
|
|
896
|
+
d !== o.value && (o.value = d, await C(), le(d * E.value), J());
|
|
805
897
|
}
|
|
806
|
-
),
|
|
898
|
+
), ie(
|
|
807
899
|
() => [
|
|
808
900
|
e.hasMore,
|
|
809
901
|
e.loading,
|
|
810
902
|
e.loadMoreThreshold
|
|
811
903
|
],
|
|
812
|
-
async ([
|
|
813
|
-
|
|
904
|
+
async ([u]) => {
|
|
905
|
+
u || (A = -1), await C(), J();
|
|
814
906
|
}
|
|
815
|
-
),
|
|
907
|
+
), ie(
|
|
816
908
|
() => e.items.length,
|
|
817
909
|
async () => {
|
|
818
|
-
const
|
|
819
|
-
e.items.length === 0 ?
|
|
910
|
+
const u = R(o.value);
|
|
911
|
+
e.items.length === 0 ? o.value !== 0 && (o.value = 0, p("update:activeIndex", 0)) : Y(u), await C(), le(u * E.value), J();
|
|
820
912
|
}
|
|
821
|
-
),
|
|
822
|
-
|
|
823
|
-
}),
|
|
824
|
-
|
|
825
|
-
}),
|
|
826
|
-
scrollToIndex:
|
|
827
|
-
}), (
|
|
913
|
+
), Ae(async () => {
|
|
914
|
+
G(), typeof ResizeObserver < "u" && f.value && (m = new ResizeObserver(G), m.observe(f.value)), await C(), le(o.value * E.value), J();
|
|
915
|
+
}), Ce(() => {
|
|
916
|
+
m && (m.disconnect(), m = void 0), q && (clearTimeout(q), q = void 0);
|
|
917
|
+
}), P({
|
|
918
|
+
scrollToIndex: se
|
|
919
|
+
}), (u, d) => (I(), $("div", {
|
|
828
920
|
ref_key: "viewport",
|
|
829
921
|
ref: f,
|
|
830
922
|
class: "vue-short-media-feed",
|
|
831
|
-
style:
|
|
923
|
+
style: N(ae.value),
|
|
832
924
|
role: "list",
|
|
833
925
|
"aria-orientation": "vertical",
|
|
834
|
-
"aria-label":
|
|
926
|
+
"aria-label": l.ariaLabel,
|
|
835
927
|
tabindex: "0",
|
|
836
|
-
onScrollPassive:
|
|
837
|
-
|
|
928
|
+
onScrollPassive: me,
|
|
929
|
+
onWheel: we,
|
|
930
|
+
onKeydown: de
|
|
838
931
|
}, [
|
|
839
|
-
|
|
840
|
-
|
|
932
|
+
l.items.length ? (I(), $(Re, { key: 0 }, [
|
|
933
|
+
Z.value > 0 ? (I(), $("div", {
|
|
841
934
|
key: 0,
|
|
842
935
|
class: "vue-short-media-feed__spacer",
|
|
843
|
-
style:
|
|
936
|
+
style: N({ height: `${Z.value}px` }),
|
|
844
937
|
"aria-hidden": "true"
|
|
845
|
-
}, null, 4)) :
|
|
846
|
-
(
|
|
847
|
-
key: c(
|
|
938
|
+
}, null, 4)) : ze("", !0),
|
|
939
|
+
(I(!0), $(Re, null, De(ne.value, ({ item: z, index: Q }) => (I(), $("div", {
|
|
940
|
+
key: c(D)(z, Q),
|
|
848
941
|
class: "vue-short-media-feed__item",
|
|
849
|
-
style:
|
|
942
|
+
style: N({ height: `${E.value}px` }),
|
|
850
943
|
role: "listitem",
|
|
851
|
-
"aria-current":
|
|
852
|
-
"aria-posinset":
|
|
853
|
-
"aria-setsize":
|
|
944
|
+
"aria-current": Q === o.value ? "true" : void 0,
|
|
945
|
+
"aria-posinset": Q + 1,
|
|
946
|
+
"aria-setsize": l.items.length
|
|
854
947
|
}, [
|
|
855
|
-
|
|
856
|
-
item:
|
|
857
|
-
index:
|
|
858
|
-
active:
|
|
948
|
+
ce(u.$slots, "default", {
|
|
949
|
+
item: z,
|
|
950
|
+
index: Q,
|
|
951
|
+
active: Q === o.value
|
|
859
952
|
})
|
|
860
|
-
], 12,
|
|
861
|
-
|
|
953
|
+
], 12, dt))), 128)),
|
|
954
|
+
H.value > 0 ? (I(), $("div", {
|
|
862
955
|
key: 1,
|
|
863
956
|
class: "vue-short-media-feed__spacer",
|
|
864
|
-
style:
|
|
957
|
+
style: N({ height: `${H.value}px` }),
|
|
865
958
|
"aria-hidden": "true"
|
|
866
|
-
}, null, 4)) :
|
|
867
|
-
], 64)) : (
|
|
868
|
-
|
|
959
|
+
}, null, 4)) : ze("", !0)
|
|
960
|
+
], 64)) : (I(), $("div", ft, [
|
|
961
|
+
ce(u.$slots, "empty")
|
|
869
962
|
]))
|
|
870
|
-
], 44,
|
|
963
|
+
], 44, ct));
|
|
871
964
|
}
|
|
872
|
-
}),
|
|
965
|
+
}), gt = ["aria-label"], pt = /* @__PURE__ */ Oe({
|
|
873
966
|
__name: "SkeletonLoader",
|
|
874
967
|
props: {
|
|
875
968
|
width: { default: "100%" },
|
|
@@ -878,38 +971,38 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
|
|
|
878
971
|
animated: { type: Boolean, default: !0 },
|
|
879
972
|
ariaLabel: { default: "Loading…" }
|
|
880
973
|
},
|
|
881
|
-
setup(
|
|
882
|
-
const
|
|
883
|
-
function
|
|
884
|
-
return typeof
|
|
885
|
-
}
|
|
886
|
-
const e =
|
|
887
|
-
width:
|
|
888
|
-
height:
|
|
974
|
+
setup(l) {
|
|
975
|
+
const P = l;
|
|
976
|
+
function x(p) {
|
|
977
|
+
return typeof p == "number" ? `${Math.max(0, p)}px` : p;
|
|
978
|
+
}
|
|
979
|
+
const e = n(() => ({
|
|
980
|
+
width: x(P.width),
|
|
981
|
+
height: x(P.height)
|
|
889
982
|
}));
|
|
890
|
-
return (
|
|
891
|
-
class:
|
|
892
|
-
`vue-skeleton-loader--${
|
|
893
|
-
{ "vue-skeleton-loader--animated":
|
|
983
|
+
return (p, f) => (I(), $("div", {
|
|
984
|
+
class: Ye(["vue-skeleton-loader", [
|
|
985
|
+
`vue-skeleton-loader--${l.variant}`,
|
|
986
|
+
{ "vue-skeleton-loader--animated": l.animated }
|
|
894
987
|
]]),
|
|
895
|
-
style:
|
|
988
|
+
style: N(e.value),
|
|
896
989
|
role: "status",
|
|
897
|
-
"aria-label":
|
|
898
|
-
}, null, 14,
|
|
990
|
+
"aria-label": l.ariaLabel
|
|
991
|
+
}, null, 14, gt));
|
|
899
992
|
}
|
|
900
|
-
}),
|
|
901
|
-
const
|
|
902
|
-
for (const [e,
|
|
903
|
-
|
|
904
|
-
return
|
|
905
|
-
},
|
|
993
|
+
}), yt = (l, P) => {
|
|
994
|
+
const x = l.__vccOpts || l;
|
|
995
|
+
for (const [e, p] of P)
|
|
996
|
+
x[e] = p;
|
|
997
|
+
return x;
|
|
998
|
+
}, Mt = /* @__PURE__ */ yt(pt, [["__scopeId", "data-v-fc92f61f"]]), xt = ["aria-label"], wt = {
|
|
906
999
|
key: 0,
|
|
907
1000
|
class: "vue-virtual-carousel__track",
|
|
908
1001
|
role: "list"
|
|
909
|
-
},
|
|
1002
|
+
}, Tt = ["aria-label", "aria-current"], bt = {
|
|
910
1003
|
key: 1,
|
|
911
1004
|
class: "vue-virtual-carousel__empty"
|
|
912
|
-
},
|
|
1005
|
+
}, St = /* @__PURE__ */ Oe({
|
|
913
1006
|
name: "VirtualCarousel",
|
|
914
1007
|
__name: "VirtualCarousel",
|
|
915
1008
|
props: {
|
|
@@ -932,307 +1025,307 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
|
|
|
932
1025
|
responsive: { default: void 0 }
|
|
933
1026
|
},
|
|
934
1027
|
emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
|
|
935
|
-
setup(
|
|
936
|
-
const e =
|
|
937
|
-
let
|
|
938
|
-
const
|
|
1028
|
+
setup(l, { expose: P, emit: x }) {
|
|
1029
|
+
const e = l, p = x, f = j(), r = j(0), o = j(0);
|
|
1030
|
+
let m, A = -1, O, U, q = !1;
|
|
1031
|
+
const V = j(!1), { getItemKey: D } = Pe({
|
|
939
1032
|
componentName: "VirtualCarousel",
|
|
940
1033
|
items: () => e.items,
|
|
941
1034
|
itemKey: () => e.itemKey
|
|
942
|
-
}),
|
|
1035
|
+
}), w = n(() => Math.max(0, r.value)), k = n(() => {
|
|
943
1036
|
if (!e.responsive || e.responsive.length === 0)
|
|
944
1037
|
return {
|
|
945
1038
|
slidesPerView: e.slidesPerView,
|
|
946
1039
|
slidesToScroll: e.slidesToScroll,
|
|
947
1040
|
gap: e.gap
|
|
948
1041
|
};
|
|
949
|
-
const
|
|
950
|
-
(
|
|
1042
|
+
const t = w.value, a = [...e.responsive].sort(
|
|
1043
|
+
(g, b) => b.breakpoint - g.breakpoint
|
|
951
1044
|
);
|
|
952
|
-
for (const
|
|
953
|
-
if (
|
|
1045
|
+
for (const g of a)
|
|
1046
|
+
if (t >= g.breakpoint)
|
|
954
1047
|
return {
|
|
955
|
-
slidesPerView:
|
|
956
|
-
slidesToScroll:
|
|
957
|
-
gap:
|
|
1048
|
+
slidesPerView: g.slidesPerView ?? e.slidesPerView,
|
|
1049
|
+
slidesToScroll: g.slidesToScroll ?? e.slidesToScroll,
|
|
1050
|
+
gap: g.gap ?? e.gap
|
|
958
1051
|
};
|
|
959
1052
|
return {
|
|
960
1053
|
slidesPerView: e.slidesPerView,
|
|
961
1054
|
slidesToScroll: e.slidesToScroll,
|
|
962
1055
|
gap: e.gap
|
|
963
1056
|
};
|
|
964
|
-
}),
|
|
1057
|
+
}), E = n(
|
|
965
1058
|
() => Math.max(
|
|
966
1059
|
1,
|
|
967
1060
|
Math.floor(
|
|
968
|
-
Number.isFinite(
|
|
1061
|
+
Number.isFinite(k.value.slidesPerView) ? k.value.slidesPerView : 1
|
|
969
1062
|
)
|
|
970
1063
|
)
|
|
971
|
-
),
|
|
1064
|
+
), F = n(
|
|
972
1065
|
() => Math.max(
|
|
973
1066
|
1,
|
|
974
1067
|
Math.floor(
|
|
975
|
-
Number.isFinite(
|
|
1068
|
+
Number.isFinite(k.value.slidesToScroll) ? k.value.slidesToScroll : 1
|
|
976
1069
|
)
|
|
977
1070
|
)
|
|
978
|
-
),
|
|
979
|
-
() => Math.max(0, Number.isFinite(
|
|
980
|
-
),
|
|
1071
|
+
), W = n(
|
|
1072
|
+
() => Math.max(0, Number.isFinite(k.value.gap) ? k.value.gap : 0)
|
|
1073
|
+
), ne = n(
|
|
981
1074
|
() => Math.max(
|
|
982
1075
|
0,
|
|
983
1076
|
Math.floor(Number.isFinite(e.buffer) ? e.buffer : 0)
|
|
984
1077
|
)
|
|
985
|
-
),
|
|
1078
|
+
), Z = n(
|
|
986
1079
|
() => Math.max(
|
|
987
1080
|
0,
|
|
988
1081
|
Math.floor(
|
|
989
1082
|
Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
|
|
990
1083
|
)
|
|
991
1084
|
)
|
|
992
|
-
),
|
|
993
|
-
if (
|
|
994
|
-
const
|
|
1085
|
+
), H = n(() => Number.isFinite(e.autoplayDelay) ? Math.max(1, e.autoplayDelay) : 3e3), ae = n(() => {
|
|
1086
|
+
if (w.value <= 0) return 0;
|
|
1087
|
+
const t = (E.value - 1) * W.value;
|
|
995
1088
|
return Math.max(
|
|
996
1089
|
1,
|
|
997
|
-
(
|
|
1090
|
+
(w.value - t) / E.value
|
|
998
1091
|
);
|
|
999
|
-
}),
|
|
1092
|
+
}), R = n(() => ae.value + W.value), J = n(
|
|
1000
1093
|
() => Math.max(
|
|
1001
1094
|
0,
|
|
1002
|
-
e.items.length -
|
|
1095
|
+
e.items.length - E.value
|
|
1003
1096
|
)
|
|
1004
|
-
),
|
|
1005
|
-
() => Math.max(0,
|
|
1006
|
-
),
|
|
1097
|
+
), Y = n(
|
|
1098
|
+
() => Math.max(0, o.value - ne.value)
|
|
1099
|
+
), le = n(
|
|
1007
1100
|
() => Math.min(
|
|
1008
1101
|
e.items.length,
|
|
1009
|
-
|
|
1102
|
+
o.value + E.value + ne.value
|
|
1010
1103
|
)
|
|
1011
|
-
),
|
|
1012
|
-
() => e.items.slice(
|
|
1013
|
-
item:
|
|
1014
|
-
index:
|
|
1104
|
+
), se = n(
|
|
1105
|
+
() => e.items.slice(Y.value, le.value).map((t, a) => ({
|
|
1106
|
+
item: t,
|
|
1107
|
+
index: Y.value + a
|
|
1015
1108
|
}))
|
|
1016
|
-
),
|
|
1017
|
-
() =>
|
|
1018
|
-
),
|
|
1109
|
+
), me = n(() => e.items.length === 0 ? 0 : e.items.length * ae.value + (e.items.length - 1) * W.value), de = n(
|
|
1110
|
+
() => Y.value * R.value
|
|
1111
|
+
), ue = n(
|
|
1019
1112
|
() => Math.max(
|
|
1020
1113
|
0,
|
|
1021
|
-
|
|
1114
|
+
me.value - le.value * R.value
|
|
1022
1115
|
)
|
|
1023
|
-
),
|
|
1024
|
-
height:
|
|
1116
|
+
), we = n(() => ({
|
|
1117
|
+
height: Fe(e.height)
|
|
1025
1118
|
}));
|
|
1026
|
-
function
|
|
1119
|
+
function G(t) {
|
|
1027
1120
|
return Math.min(
|
|
1028
|
-
|
|
1029
|
-
Math.max(0, Math.floor(Number.isFinite(
|
|
1121
|
+
J.value,
|
|
1122
|
+
Math.max(0, Math.floor(Number.isFinite(t) ? t : 0))
|
|
1030
1123
|
);
|
|
1031
1124
|
}
|
|
1032
|
-
|
|
1033
|
-
function
|
|
1034
|
-
return
|
|
1125
|
+
o.value = G(e.activeIndex);
|
|
1126
|
+
function u(t) {
|
|
1127
|
+
return t >= o.value && t < Math.min(
|
|
1035
1128
|
e.items.length,
|
|
1036
|
-
|
|
1129
|
+
o.value + E.value
|
|
1037
1130
|
);
|
|
1038
1131
|
}
|
|
1039
|
-
function
|
|
1040
|
-
if (!e.hasMore || e.loading ||
|
|
1132
|
+
function d() {
|
|
1133
|
+
if (!e.hasMore || e.loading || A === e.items.length)
|
|
1041
1134
|
return;
|
|
1042
|
-
const
|
|
1135
|
+
const t = e.items.length === 0 ? -1 : Math.min(
|
|
1043
1136
|
e.items.length - 1,
|
|
1044
|
-
|
|
1137
|
+
o.value + E.value - 1
|
|
1045
1138
|
);
|
|
1046
|
-
e.items.length - 1 -
|
|
1139
|
+
e.items.length - 1 - t <= Z.value && (A = e.items.length, p("loadMore"));
|
|
1047
1140
|
}
|
|
1048
|
-
function
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
index:
|
|
1052
|
-
item: e.items[
|
|
1053
|
-
}),
|
|
1141
|
+
function z(t) {
|
|
1142
|
+
const a = G(t);
|
|
1143
|
+
a === o.value || e.items.length === 0 || (o.value = a, p("update:activeIndex", a), p("change", {
|
|
1144
|
+
index: a,
|
|
1145
|
+
item: e.items[a]
|
|
1146
|
+
}), a === 0 && p("reachStart"), a === J.value && p("reachEnd"), d(), e.autoplay && !V.value && B());
|
|
1054
1147
|
}
|
|
1055
|
-
function
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1058
|
-
}
|
|
1059
|
-
function
|
|
1060
|
-
if (e.items.length === 0 ||
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
...
|
|
1064
|
-
behavior:
|
|
1148
|
+
function Q(t, a = {}) {
|
|
1149
|
+
const g = f.value;
|
|
1150
|
+
g && (typeof g.scrollTo == "function" ? g.scrollTo({ ...a, left: t }) : g.scrollLeft = t);
|
|
1151
|
+
}
|
|
1152
|
+
function he(t, a = {}) {
|
|
1153
|
+
if (e.items.length === 0 || R.value <= 0) return;
|
|
1154
|
+
const g = G(t);
|
|
1155
|
+
U = a.behavior === "smooth" ? g : void 0, z(g), Q(g * R.value, {
|
|
1156
|
+
...a,
|
|
1157
|
+
behavior: a.behavior
|
|
1065
1158
|
});
|
|
1066
1159
|
}
|
|
1067
|
-
function
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
{ behavior:
|
|
1160
|
+
function y(t = "smooth") {
|
|
1161
|
+
he(
|
|
1162
|
+
o.value + F.value,
|
|
1163
|
+
{ behavior: t }
|
|
1071
1164
|
);
|
|
1072
1165
|
}
|
|
1073
|
-
function
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
{ behavior:
|
|
1166
|
+
function L(t = "smooth") {
|
|
1167
|
+
he(
|
|
1168
|
+
o.value - F.value,
|
|
1169
|
+
{ behavior: t }
|
|
1077
1170
|
);
|
|
1078
1171
|
}
|
|
1079
|
-
function
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
},
|
|
1172
|
+
function B() {
|
|
1173
|
+
te(), !(!e.autoplay || e.items.length === 0) && (O = setTimeout(() => {
|
|
1174
|
+
o.value >= J.value ? e.autoplayLoop ? he(0, { behavior: "smooth" }) : te() : y("smooth");
|
|
1175
|
+
}, H.value));
|
|
1083
1176
|
}
|
|
1084
|
-
function
|
|
1085
|
-
|
|
1177
|
+
function te() {
|
|
1178
|
+
O !== void 0 && (clearTimeout(O), O = void 0);
|
|
1086
1179
|
}
|
|
1087
|
-
function
|
|
1088
|
-
|
|
1180
|
+
function oe() {
|
|
1181
|
+
V.value = !0, e.pauseOnHover && te();
|
|
1089
1182
|
}
|
|
1090
|
-
function
|
|
1091
|
-
|
|
1183
|
+
function re() {
|
|
1184
|
+
V.value = !1, e.autoplay && B();
|
|
1092
1185
|
}
|
|
1093
|
-
function
|
|
1094
|
-
|
|
1186
|
+
function ye() {
|
|
1187
|
+
U = void 0;
|
|
1095
1188
|
}
|
|
1096
|
-
function
|
|
1097
|
-
if (
|
|
1098
|
-
const
|
|
1099
|
-
if (
|
|
1100
|
-
const
|
|
1101
|
-
if (Math.abs(
|
|
1102
|
-
|
|
1189
|
+
function _(t) {
|
|
1190
|
+
if (R.value <= 0 || q) return;
|
|
1191
|
+
const a = t.currentTarget.scrollLeft;
|
|
1192
|
+
if (U !== void 0) {
|
|
1193
|
+
const g = U * R.value;
|
|
1194
|
+
if (Math.abs(a - g) > 1) return;
|
|
1195
|
+
U = void 0;
|
|
1103
1196
|
}
|
|
1104
|
-
|
|
1197
|
+
z(Math.round(a / R.value));
|
|
1105
1198
|
}
|
|
1106
|
-
function
|
|
1107
|
-
|
|
1199
|
+
function ee(t) {
|
|
1200
|
+
t.key === "ArrowRight" || t.key === "PageDown" ? (t.preventDefault(), y()) : t.key === "ArrowLeft" || t.key === "PageUp" ? (t.preventDefault(), L()) : t.key === "Home" ? (t.preventDefault(), he(0, { behavior: "smooth" })) : t.key === "End" && (t.preventDefault(), he(J.value, { behavior: "auto" }));
|
|
1108
1201
|
}
|
|
1109
1202
|
function s() {
|
|
1110
|
-
var
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1203
|
+
var a;
|
|
1204
|
+
const t = ((a = f.value) == null ? void 0 : a.clientWidth) ?? 0;
|
|
1205
|
+
t <= 0 || t === r.value || (q = !0, r.value = t, C(() => {
|
|
1206
|
+
const g = G(o.value);
|
|
1207
|
+
Q(g * R.value), q = !1;
|
|
1115
1208
|
}));
|
|
1116
1209
|
}
|
|
1117
|
-
return
|
|
1210
|
+
return ie(
|
|
1118
1211
|
() => e.activeIndex,
|
|
1119
|
-
async (
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1212
|
+
async (t) => {
|
|
1213
|
+
const a = G(t);
|
|
1214
|
+
a !== o.value && (ye(), o.value = a, await C(), Q(a * R.value), d());
|
|
1122
1215
|
}
|
|
1123
|
-
),
|
|
1216
|
+
), ie(
|
|
1124
1217
|
() => [
|
|
1125
1218
|
e.items.length,
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1219
|
+
k.value.slidesPerView,
|
|
1220
|
+
k.value.gap,
|
|
1221
|
+
k.value.slidesToScroll
|
|
1129
1222
|
],
|
|
1130
1223
|
async () => {
|
|
1131
|
-
const
|
|
1132
|
-
e.items.length === 0 ?
|
|
1224
|
+
const t = G(o.value);
|
|
1225
|
+
e.items.length === 0 ? o.value !== 0 && (o.value = 0, p("update:activeIndex", 0)) : z(t), await C(), Q(t * R.value), d(), e.autoplay && e.items.length > 0 && !V.value && B();
|
|
1133
1226
|
}
|
|
1134
|
-
),
|
|
1227
|
+
), ie(
|
|
1135
1228
|
() => e.responsive,
|
|
1136
1229
|
() => {
|
|
1137
|
-
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1230
|
+
C(() => {
|
|
1231
|
+
const t = G(o.value);
|
|
1232
|
+
Q(t * R.value);
|
|
1140
1233
|
});
|
|
1141
1234
|
},
|
|
1142
1235
|
{ deep: !0 }
|
|
1143
|
-
),
|
|
1236
|
+
), ie(
|
|
1144
1237
|
() => [
|
|
1145
1238
|
e.hasMore,
|
|
1146
1239
|
e.loading,
|
|
1147
1240
|
e.loadMoreThreshold
|
|
1148
1241
|
],
|
|
1149
|
-
async ([
|
|
1150
|
-
|
|
1242
|
+
async ([t]) => {
|
|
1243
|
+
t || (A = -1), await C(), d();
|
|
1151
1244
|
}
|
|
1152
|
-
),
|
|
1245
|
+
), ie(
|
|
1153
1246
|
() => e.autoplay,
|
|
1154
|
-
(
|
|
1155
|
-
|
|
1247
|
+
(t) => {
|
|
1248
|
+
t && !V.value ? B() : te();
|
|
1156
1249
|
}
|
|
1157
|
-
),
|
|
1250
|
+
), ie(
|
|
1158
1251
|
() => e.autoplayDelay,
|
|
1159
1252
|
() => {
|
|
1160
|
-
e.autoplay && !
|
|
1253
|
+
e.autoplay && !V.value && B();
|
|
1161
1254
|
}
|
|
1162
|
-
),
|
|
1255
|
+
), ie(
|
|
1163
1256
|
() => e.autoplayLoop,
|
|
1164
|
-
(
|
|
1165
|
-
!e.autoplay ||
|
|
1257
|
+
(t) => {
|
|
1258
|
+
!e.autoplay || V.value || (!t && o.value >= J.value ? te() : B());
|
|
1166
1259
|
}
|
|
1167
|
-
),
|
|
1260
|
+
), ie(
|
|
1168
1261
|
() => e.pauseOnHover,
|
|
1169
|
-
(
|
|
1170
|
-
|
|
1262
|
+
(t) => {
|
|
1263
|
+
t && V.value ? te() : !t && e.autoplay && B();
|
|
1171
1264
|
}
|
|
1172
|
-
),
|
|
1173
|
-
s(), typeof ResizeObserver < "u" && f.value && (
|
|
1174
|
-
}),
|
|
1175
|
-
|
|
1176
|
-
}),
|
|
1177
|
-
next:
|
|
1178
|
-
previous:
|
|
1179
|
-
scrollToIndex:
|
|
1180
|
-
startAutoplay:
|
|
1181
|
-
stopAutoplay:
|
|
1182
|
-
}), (
|
|
1265
|
+
), Ae(async () => {
|
|
1266
|
+
s(), typeof ResizeObserver < "u" && f.value && (m = new ResizeObserver(s), m.observe(f.value)), await C(), Q(o.value * R.value), d(), e.autoplay && B();
|
|
1267
|
+
}), Ce(() => {
|
|
1268
|
+
m && (m.disconnect(), m = void 0), te();
|
|
1269
|
+
}), P({
|
|
1270
|
+
next: y,
|
|
1271
|
+
previous: L,
|
|
1272
|
+
scrollToIndex: he,
|
|
1273
|
+
startAutoplay: B,
|
|
1274
|
+
stopAutoplay: te
|
|
1275
|
+
}), (t, a) => (I(), $("div", {
|
|
1183
1276
|
ref_key: "viewport",
|
|
1184
1277
|
ref: f,
|
|
1185
1278
|
class: "vue-virtual-carousel",
|
|
1186
|
-
style:
|
|
1279
|
+
style: N(we.value),
|
|
1187
1280
|
role: "region",
|
|
1188
1281
|
"aria-roledescription": "carousel",
|
|
1189
|
-
"aria-label":
|
|
1282
|
+
"aria-label": l.ariaLabel,
|
|
1190
1283
|
tabindex: "0",
|
|
1191
|
-
onScrollPassive:
|
|
1192
|
-
onPointerdown:
|
|
1193
|
-
onWheelPassive:
|
|
1194
|
-
onKeydown:
|
|
1195
|
-
onMouseenter:
|
|
1196
|
-
onMouseleave:
|
|
1284
|
+
onScrollPassive: _,
|
|
1285
|
+
onPointerdown: ye,
|
|
1286
|
+
onWheelPassive: ye,
|
|
1287
|
+
onKeydown: ee,
|
|
1288
|
+
onMouseenter: oe,
|
|
1289
|
+
onMouseleave: re
|
|
1197
1290
|
}, [
|
|
1198
|
-
|
|
1199
|
-
|
|
1291
|
+
l.items.length ? (I(), $("div", wt, [
|
|
1292
|
+
de.value > 0 ? (I(), $("div", {
|
|
1200
1293
|
key: 0,
|
|
1201
1294
|
class: "vue-virtual-carousel__spacer",
|
|
1202
|
-
style:
|
|
1295
|
+
style: N({ flexBasis: `${de.value}px` }),
|
|
1203
1296
|
"aria-hidden": "true"
|
|
1204
|
-
}, null, 4)) :
|
|
1205
|
-
(
|
|
1206
|
-
key: c(
|
|
1297
|
+
}, null, 4)) : ze("", !0),
|
|
1298
|
+
(I(!0), $(Re, null, De(se.value, ({ item: g, index: b }) => (I(), $("div", {
|
|
1299
|
+
key: c(D)(g, b),
|
|
1207
1300
|
class: "vue-virtual-carousel__item",
|
|
1208
|
-
style:
|
|
1209
|
-
flexBasis: `${
|
|
1210
|
-
marginRight:
|
|
1301
|
+
style: N({
|
|
1302
|
+
flexBasis: `${ae.value}px`,
|
|
1303
|
+
marginRight: b < l.items.length - 1 ? `${W.value}px` : "0px"
|
|
1211
1304
|
}),
|
|
1212
1305
|
role: "listitem",
|
|
1213
1306
|
"aria-roledescription": "slide",
|
|
1214
|
-
"aria-label": `${
|
|
1215
|
-
"aria-current":
|
|
1307
|
+
"aria-label": `${b + 1} of ${l.items.length}`,
|
|
1308
|
+
"aria-current": b === o.value ? "true" : void 0
|
|
1216
1309
|
}, [
|
|
1217
|
-
|
|
1218
|
-
item:
|
|
1219
|
-
index:
|
|
1220
|
-
active:
|
|
1221
|
-
visible:
|
|
1310
|
+
ce(t.$slots, "default", {
|
|
1311
|
+
item: g,
|
|
1312
|
+
index: b,
|
|
1313
|
+
active: b === o.value,
|
|
1314
|
+
visible: u(b)
|
|
1222
1315
|
})
|
|
1223
|
-
], 12,
|
|
1224
|
-
|
|
1316
|
+
], 12, Tt))), 128)),
|
|
1317
|
+
ue.value > 0 ? (I(), $("div", {
|
|
1225
1318
|
key: 1,
|
|
1226
1319
|
class: "vue-virtual-carousel__spacer",
|
|
1227
|
-
style:
|
|
1320
|
+
style: N({ flexBasis: `${ue.value}px` }),
|
|
1228
1321
|
"aria-hidden": "true"
|
|
1229
|
-
}, null, 4)) :
|
|
1230
|
-
])) : (
|
|
1231
|
-
|
|
1322
|
+
}, null, 4)) : ze("", !0)
|
|
1323
|
+
])) : (I(), $("div", bt, [
|
|
1324
|
+
ce(t.$slots, "empty")
|
|
1232
1325
|
]))
|
|
1233
|
-
], 44,
|
|
1326
|
+
], 44, xt));
|
|
1234
1327
|
}
|
|
1235
|
-
}),
|
|
1328
|
+
}), zt = ["aria-label"], It = ["aria-posinset", "aria-setsize"], $t = /* @__PURE__ */ Oe({
|
|
1236
1329
|
name: "VirtualScroll",
|
|
1237
1330
|
__name: "VirtualScroll",
|
|
1238
1331
|
props: {
|
|
@@ -1251,210 +1344,210 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
|
|
|
1251
1344
|
pullRefreshThreshold: { default: 64 }
|
|
1252
1345
|
},
|
|
1253
1346
|
emits: ["scroll", "loadMore", "refresh"],
|
|
1254
|
-
setup(
|
|
1255
|
-
const e =
|
|
1347
|
+
setup(l, { expose: P, emit: x }) {
|
|
1348
|
+
const e = l, p = x, {
|
|
1256
1349
|
pulling: f,
|
|
1257
|
-
pullDistance:
|
|
1258
|
-
pullOffset:
|
|
1259
|
-
pullProgress:
|
|
1260
|
-
refreshMessage:
|
|
1261
|
-
refreshThreshold:
|
|
1262
|
-
handleTouchStart:
|
|
1263
|
-
handleTouchMove:
|
|
1264
|
-
handleTouchEnd:
|
|
1265
|
-
handleTouchCancel:
|
|
1266
|
-
} =
|
|
1350
|
+
pullDistance: r,
|
|
1351
|
+
pullOffset: o,
|
|
1352
|
+
pullProgress: m,
|
|
1353
|
+
refreshMessage: A,
|
|
1354
|
+
refreshThreshold: O,
|
|
1355
|
+
handleTouchStart: U,
|
|
1356
|
+
handleTouchMove: q,
|
|
1357
|
+
handleTouchEnd: V,
|
|
1358
|
+
handleTouchCancel: D
|
|
1359
|
+
} = qe({
|
|
1267
1360
|
enabled: () => e.pullToRefresh,
|
|
1268
1361
|
refreshing: () => e.refreshing,
|
|
1269
1362
|
threshold: () => e.pullRefreshThreshold,
|
|
1270
|
-
onRefresh: () =>
|
|
1271
|
-
}),
|
|
1272
|
-
let
|
|
1273
|
-
const
|
|
1363
|
+
onRefresh: () => p("refresh")
|
|
1364
|
+
}), w = j(), k = j(0), E = j(0);
|
|
1365
|
+
let F, W = -1;
|
|
1366
|
+
const ne = Ue(), { getItemKey: Z } = Pe({
|
|
1274
1367
|
componentName: "VirtualScroll",
|
|
1275
1368
|
items: () => e.items,
|
|
1276
1369
|
itemKey: () => e.itemKey
|
|
1277
|
-
}),
|
|
1278
|
-
() => e.items.length *
|
|
1279
|
-
),
|
|
1280
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
1281
|
-
),
|
|
1282
|
-
() =>
|
|
1283
|
-
),
|
|
1370
|
+
}), H = n(() => Math.max(1, e.itemSize)), ae = n(() => Math.max(0, Math.floor(e.overscan))), R = n(
|
|
1371
|
+
() => e.items.length * H.value
|
|
1372
|
+
), J = n(
|
|
1373
|
+
() => Math.max(1, e.loadingItemSize ?? H.value)
|
|
1374
|
+
), Y = n(
|
|
1375
|
+
() => R.value + (e.loading ? J.value : 0)
|
|
1376
|
+
), le = n(() => E.value > 0 ? E.value : typeof e.height == "number" ? e.height : 0), se = n(
|
|
1284
1377
|
() => Math.max(
|
|
1285
1378
|
0,
|
|
1286
|
-
Math.floor(
|
|
1379
|
+
Math.floor(k.value / H.value) - ae.value
|
|
1287
1380
|
)
|
|
1288
|
-
),
|
|
1289
|
-
const
|
|
1290
|
-
(
|
|
1381
|
+
), me = n(() => {
|
|
1382
|
+
const y = Math.ceil(
|
|
1383
|
+
(k.value + le.value) / H.value
|
|
1291
1384
|
);
|
|
1292
1385
|
return Math.min(
|
|
1293
1386
|
e.items.length,
|
|
1294
|
-
|
|
1387
|
+
y + ae.value
|
|
1295
1388
|
);
|
|
1296
|
-
}),
|
|
1297
|
-
() => e.items.slice(
|
|
1298
|
-
item:
|
|
1299
|
-
index:
|
|
1389
|
+
}), de = n(
|
|
1390
|
+
() => e.items.slice(se.value, me.value).map((y, L) => ({
|
|
1391
|
+
item: y,
|
|
1392
|
+
index: se.value + L
|
|
1300
1393
|
}))
|
|
1301
|
-
),
|
|
1302
|
-
height:
|
|
1303
|
-
})),
|
|
1304
|
-
transform: `translateY(${
|
|
1394
|
+
), ue = n(() => ({
|
|
1395
|
+
height: Fe(e.height)
|
|
1396
|
+
})), we = n(() => ({
|
|
1397
|
+
transform: `translateY(${se.value * H.value}px)`
|
|
1305
1398
|
}));
|
|
1306
|
-
function
|
|
1307
|
-
var
|
|
1308
|
-
|
|
1309
|
-
}
|
|
1310
|
-
function
|
|
1311
|
-
|
|
1312
|
-
scrollTop:
|
|
1313
|
-
startIndex:
|
|
1314
|
-
endIndex:
|
|
1315
|
-
}),
|
|
1316
|
-
}
|
|
1317
|
-
function
|
|
1318
|
-
const
|
|
1319
|
-
if (!
|
|
1399
|
+
function G() {
|
|
1400
|
+
var y;
|
|
1401
|
+
E.value = ((y = w.value) == null ? void 0 : y.clientHeight) ?? 0, ne(w.value, e.height), C(d);
|
|
1402
|
+
}
|
|
1403
|
+
function u(y) {
|
|
1404
|
+
k.value = y.currentTarget.scrollTop, p("scroll", {
|
|
1405
|
+
scrollTop: k.value,
|
|
1406
|
+
startIndex: se.value,
|
|
1407
|
+
endIndex: me.value
|
|
1408
|
+
}), d();
|
|
1409
|
+
}
|
|
1410
|
+
function d() {
|
|
1411
|
+
const y = w.value;
|
|
1412
|
+
if (!y || !e.hasMore || e.loading || W === e.items.length)
|
|
1320
1413
|
return;
|
|
1321
|
-
const
|
|
1322
|
-
|
|
1323
|
-
}
|
|
1324
|
-
function
|
|
1325
|
-
const
|
|
1326
|
-
if (!
|
|
1327
|
-
const
|
|
1328
|
-
Math.max(0, Number.isFinite(
|
|
1329
|
-
|
|
1330
|
-
),
|
|
1331
|
-
|
|
1332
|
-
}
|
|
1333
|
-
function
|
|
1334
|
-
const
|
|
1335
|
-
if (!
|
|
1336
|
-
const
|
|
1414
|
+
const L = Math.max(0, e.loadMoreThreshold);
|
|
1415
|
+
Y.value - y.scrollTop - y.clientHeight <= L && (W = e.items.length, p("loadMore"));
|
|
1416
|
+
}
|
|
1417
|
+
function z(y, L = {}) {
|
|
1418
|
+
const B = w.value;
|
|
1419
|
+
if (!B) return;
|
|
1420
|
+
const te = Math.max(0, Y.value - B.clientHeight), oe = Math.min(
|
|
1421
|
+
Math.max(0, Number.isFinite(y) ? y : 0),
|
|
1422
|
+
te
|
|
1423
|
+
), re = L.behavior ?? "auto";
|
|
1424
|
+
re === "auto" && (k.value = oe), B.scrollTo({ ...L, top: oe, behavior: re });
|
|
1425
|
+
}
|
|
1426
|
+
function Q(y, L = {}) {
|
|
1427
|
+
const B = w.value;
|
|
1428
|
+
if (!B || e.items.length === 0) return;
|
|
1429
|
+
const te = Math.min(
|
|
1337
1430
|
e.items.length - 1,
|
|
1338
|
-
Math.max(0, Math.floor(
|
|
1339
|
-
), { align:
|
|
1340
|
-
let
|
|
1341
|
-
|
|
1342
|
-
...
|
|
1343
|
-
top: Math.max(0, Math.min(
|
|
1431
|
+
Math.max(0, Math.floor(y))
|
|
1432
|
+
), { align: oe = "start", ...re } = L;
|
|
1433
|
+
let ye = te * H.value;
|
|
1434
|
+
oe === "center" ? ye -= (B.clientHeight - H.value) / 2 : oe === "end" && (ye -= B.clientHeight - H.value), B.scrollTo({
|
|
1435
|
+
...re,
|
|
1436
|
+
top: Math.max(0, Math.min(ye, Y.value - B.clientHeight))
|
|
1344
1437
|
});
|
|
1345
1438
|
}
|
|
1346
|
-
function
|
|
1347
|
-
var
|
|
1348
|
-
(
|
|
1439
|
+
function he(y = "auto") {
|
|
1440
|
+
var L;
|
|
1441
|
+
(L = w.value) == null || L.scrollTo({ top: 0, behavior: y });
|
|
1349
1442
|
}
|
|
1350
|
-
return
|
|
1443
|
+
return ie(
|
|
1351
1444
|
() => [e.items.length, e.itemSize],
|
|
1352
1445
|
async () => {
|
|
1353
|
-
await
|
|
1354
|
-
const
|
|
1355
|
-
if (!
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1446
|
+
await C();
|
|
1447
|
+
const y = w.value;
|
|
1448
|
+
if (!y) return;
|
|
1449
|
+
const L = Math.max(0, Y.value - y.clientHeight);
|
|
1450
|
+
y.scrollTop > L && (y.scrollTop = L, k.value = L), d();
|
|
1358
1451
|
}
|
|
1359
|
-
),
|
|
1452
|
+
), ie(
|
|
1360
1453
|
() => [e.hasMore, e.loading],
|
|
1361
|
-
async ([
|
|
1362
|
-
|
|
1454
|
+
async ([y]) => {
|
|
1455
|
+
y || (W = -1), await C(), d();
|
|
1363
1456
|
}
|
|
1364
|
-
),
|
|
1365
|
-
|
|
1366
|
-
}),
|
|
1367
|
-
|
|
1368
|
-
}),
|
|
1369
|
-
scrollTo:
|
|
1370
|
-
scrollToIndex:
|
|
1371
|
-
scrollToTop:
|
|
1372
|
-
}), (
|
|
1457
|
+
), Ae(() => {
|
|
1458
|
+
G(), typeof ResizeObserver < "u" && w.value && (F = new ResizeObserver(G), F.observe(w.value)), C(d);
|
|
1459
|
+
}), Ce(() => {
|
|
1460
|
+
F && (F.disconnect(), F = void 0);
|
|
1461
|
+
}), P({
|
|
1462
|
+
scrollTo: z,
|
|
1463
|
+
scrollToIndex: Q,
|
|
1464
|
+
scrollToTop: he
|
|
1465
|
+
}), (y, L) => (I(), $("div", {
|
|
1373
1466
|
ref_key: "viewport",
|
|
1374
|
-
ref:
|
|
1375
|
-
class:
|
|
1376
|
-
style:
|
|
1467
|
+
ref: w,
|
|
1468
|
+
class: Ye(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": c(f) }]),
|
|
1469
|
+
style: N(ue.value),
|
|
1377
1470
|
role: "list",
|
|
1378
|
-
"aria-label":
|
|
1471
|
+
"aria-label": l.ariaLabel,
|
|
1379
1472
|
tabindex: "0",
|
|
1380
|
-
onScrollPassive:
|
|
1381
|
-
onTouchstartPassive:
|
|
1382
|
-
(...
|
|
1383
|
-
onTouchmove:
|
|
1384
|
-
(...
|
|
1385
|
-
onTouchend:
|
|
1386
|
-
(...
|
|
1387
|
-
onTouchcancel:
|
|
1388
|
-
(...
|
|
1473
|
+
onScrollPassive: u,
|
|
1474
|
+
onTouchstartPassive: L[0] || (L[0] = //@ts-ignore
|
|
1475
|
+
(...B) => c(U) && c(U)(...B)),
|
|
1476
|
+
onTouchmove: L[1] || (L[1] = //@ts-ignore
|
|
1477
|
+
(...B) => c(q) && c(q)(...B)),
|
|
1478
|
+
onTouchend: L[2] || (L[2] = //@ts-ignore
|
|
1479
|
+
(...B) => c(V) && c(V)(...B)),
|
|
1480
|
+
onTouchcancel: L[3] || (L[3] = //@ts-ignore
|
|
1481
|
+
(...B) => c(D) && c(D)(...B))
|
|
1389
1482
|
}, [
|
|
1390
|
-
|
|
1483
|
+
l.pullToRefresh || l.refreshing ? (I(), $("div", {
|
|
1391
1484
|
key: 0,
|
|
1392
1485
|
class: "vue-virtual-scroll__refresh",
|
|
1393
|
-
style:
|
|
1394
|
-
height: `${c(
|
|
1395
|
-
transform: `translateY(${c(
|
|
1486
|
+
style: N({
|
|
1487
|
+
height: `${c(O)}px`,
|
|
1488
|
+
transform: `translateY(${c(o) - c(O)}px)`
|
|
1396
1489
|
}),
|
|
1397
1490
|
role: "status",
|
|
1398
1491
|
"aria-live": "polite"
|
|
1399
1492
|
}, [
|
|
1400
|
-
|
|
1401
|
-
pullDistance: c(
|
|
1402
|
-
progress: c(
|
|
1403
|
-
refreshing:
|
|
1493
|
+
ce(y.$slots, "refresh", {
|
|
1494
|
+
pullDistance: c(r),
|
|
1495
|
+
progress: c(m),
|
|
1496
|
+
refreshing: l.refreshing
|
|
1404
1497
|
}, () => [
|
|
1405
|
-
|
|
1498
|
+
Ve(je(c(A)), 1)
|
|
1406
1499
|
])
|
|
1407
|
-
], 4)) :
|
|
1408
|
-
|
|
1500
|
+
], 4)) : ze("", !0),
|
|
1501
|
+
l.items.length || l.loading ? (I(), $("div", {
|
|
1409
1502
|
key: 1,
|
|
1410
1503
|
class: "vue-virtual-scroll__spacer",
|
|
1411
|
-
style:
|
|
1412
|
-
height: `${
|
|
1413
|
-
transform: `translateY(${c(
|
|
1504
|
+
style: N({
|
|
1505
|
+
height: `${Y.value}px`,
|
|
1506
|
+
transform: `translateY(${c(o)}px)`
|
|
1414
1507
|
})
|
|
1415
1508
|
}, [
|
|
1416
|
-
|
|
1509
|
+
Ge("div", {
|
|
1417
1510
|
class: "vue-virtual-scroll__content",
|
|
1418
|
-
style:
|
|
1511
|
+
style: N(we.value)
|
|
1419
1512
|
}, [
|
|
1420
|
-
(
|
|
1421
|
-
key: c(
|
|
1513
|
+
(I(!0), $(Re, null, De(de.value, ({ item: B, index: te }) => (I(), $("div", {
|
|
1514
|
+
key: c(Z)(B, te),
|
|
1422
1515
|
class: "vue-virtual-scroll__item",
|
|
1423
|
-
style:
|
|
1516
|
+
style: N({ height: `${H.value}px` }),
|
|
1424
1517
|
role: "listitem",
|
|
1425
|
-
"aria-posinset":
|
|
1426
|
-
"aria-setsize":
|
|
1518
|
+
"aria-posinset": te + 1,
|
|
1519
|
+
"aria-setsize": l.items.length
|
|
1427
1520
|
}, [
|
|
1428
|
-
|
|
1429
|
-
item:
|
|
1430
|
-
index:
|
|
1521
|
+
ce(y.$slots, "default", {
|
|
1522
|
+
item: B,
|
|
1523
|
+
index: te
|
|
1431
1524
|
})
|
|
1432
|
-
], 12,
|
|
1525
|
+
], 12, It))), 128))
|
|
1433
1526
|
], 4),
|
|
1434
|
-
|
|
1527
|
+
l.loading ? (I(), $("div", {
|
|
1435
1528
|
key: 0,
|
|
1436
1529
|
class: "vue-virtual-scroll__loading",
|
|
1437
|
-
style:
|
|
1438
|
-
height: `${
|
|
1439
|
-
transform: `translateY(${
|
|
1530
|
+
style: N({
|
|
1531
|
+
height: `${J.value}px`,
|
|
1532
|
+
transform: `translateY(${R.value}px)`
|
|
1440
1533
|
}),
|
|
1441
1534
|
role: "status",
|
|
1442
1535
|
"aria-live": "polite"
|
|
1443
1536
|
}, [
|
|
1444
|
-
|
|
1445
|
-
|
|
1537
|
+
ce(y.$slots, "loading", {}, () => [
|
|
1538
|
+
L[4] || (L[4] = Ve("Loading more…", -1))
|
|
1446
1539
|
])
|
|
1447
|
-
], 4)) :
|
|
1448
|
-
], 4)) : (
|
|
1540
|
+
], 4)) : ze("", !0)
|
|
1541
|
+
], 4)) : (I(), $("div", {
|
|
1449
1542
|
key: 2,
|
|
1450
1543
|
class: "vue-virtual-scroll__empty",
|
|
1451
|
-
style:
|
|
1544
|
+
style: N({ transform: `translateY(${c(o)}px)` })
|
|
1452
1545
|
}, [
|
|
1453
|
-
|
|
1546
|
+
ce(y.$slots, "empty")
|
|
1454
1547
|
], 4))
|
|
1455
|
-
], 46,
|
|
1548
|
+
], 46, zt));
|
|
1456
1549
|
}
|
|
1457
|
-
}),
|
|
1550
|
+
}), kt = ["aria-label"], Et = ["aria-posinset", "aria-setsize"], Lt = /* @__PURE__ */ Oe({
|
|
1458
1551
|
name: "WindowDynamicVirtualScroll",
|
|
1459
1552
|
__name: "WindowDynamicVirtualScroll",
|
|
1460
1553
|
props: {
|
|
@@ -1472,329 +1565,329 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
|
|
|
1472
1565
|
pullRefreshThreshold: { default: 64 }
|
|
1473
1566
|
},
|
|
1474
1567
|
emits: ["scroll", "loadMore", "refresh"],
|
|
1475
|
-
setup(
|
|
1476
|
-
const e =
|
|
1477
|
-
let
|
|
1478
|
-
const { getItemKey:
|
|
1568
|
+
setup(l, { expose: P, emit: x }) {
|
|
1569
|
+
const e = l, p = x, f = j(), r = j(0), o = j(0), m = j(0), A = j(0), O = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
|
|
1570
|
+
let V, D, w, k, E = !1, F = !1, W = -1;
|
|
1571
|
+
const { getItemKey: ne } = Pe({
|
|
1479
1572
|
componentName: "WindowDynamicVirtualScroll",
|
|
1480
1573
|
items: () => e.items,
|
|
1481
1574
|
itemKey: () => e.itemKey
|
|
1482
1575
|
});
|
|
1483
|
-
function
|
|
1576
|
+
function Z(v) {
|
|
1484
1577
|
return typeof window.requestAnimationFrame == "function" ? {
|
|
1485
|
-
id: window.requestAnimationFrame(
|
|
1578
|
+
id: window.requestAnimationFrame(v),
|
|
1486
1579
|
type: "animation"
|
|
1487
1580
|
} : {
|
|
1488
|
-
id: window.setTimeout(
|
|
1581
|
+
id: window.setTimeout(v, 0),
|
|
1489
1582
|
type: "timeout"
|
|
1490
1583
|
};
|
|
1491
1584
|
}
|
|
1492
|
-
function
|
|
1493
|
-
|
|
1585
|
+
function H(v) {
|
|
1586
|
+
v && (v.type === "animation" ? window.cancelAnimationFrame(v.id) : window.clearTimeout(v.id));
|
|
1494
1587
|
}
|
|
1495
1588
|
const {
|
|
1496
|
-
pulling:
|
|
1497
|
-
pullDistance:
|
|
1498
|
-
pullOffset:
|
|
1499
|
-
pullProgress:
|
|
1500
|
-
refreshMessage:
|
|
1501
|
-
refreshThreshold:
|
|
1502
|
-
handleTouchStart:
|
|
1503
|
-
handleTouchMove:
|
|
1504
|
-
handleTouchEnd:
|
|
1505
|
-
handleTouchCancel:
|
|
1506
|
-
} =
|
|
1589
|
+
pulling: ae,
|
|
1590
|
+
pullDistance: R,
|
|
1591
|
+
pullOffset: J,
|
|
1592
|
+
pullProgress: Y,
|
|
1593
|
+
refreshMessage: le,
|
|
1594
|
+
refreshThreshold: se,
|
|
1595
|
+
handleTouchStart: me,
|
|
1596
|
+
handleTouchMove: de,
|
|
1597
|
+
handleTouchEnd: ue,
|
|
1598
|
+
handleTouchCancel: we
|
|
1599
|
+
} = qe({
|
|
1507
1600
|
enabled: () => e.pullToRefresh,
|
|
1508
1601
|
refreshing: () => e.refreshing,
|
|
1509
1602
|
threshold: () => e.pullRefreshThreshold,
|
|
1510
|
-
onRefresh: () =>
|
|
1603
|
+
onRefresh: () => p("refresh"),
|
|
1511
1604
|
scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
|
|
1512
|
-
}),
|
|
1605
|
+
}), G = n(
|
|
1513
1606
|
() => Math.max(1, e.estimatedItemSize)
|
|
1514
|
-
),
|
|
1515
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
1516
|
-
),
|
|
1517
|
-
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
for (let
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1607
|
+
), u = n(
|
|
1608
|
+
() => Math.max(1, e.loadingItemSize ?? G.value)
|
|
1609
|
+
), d = n(() => Math.max(0, Math.floor(e.overscan))), z = n(() => {
|
|
1610
|
+
A.value;
|
|
1611
|
+
const v = new Array(e.items.length + 1), S = new Array(e.items.length);
|
|
1612
|
+
v[0] = 0;
|
|
1613
|
+
for (let T = 0; T < e.items.length; T += 1) {
|
|
1614
|
+
const fe = ne(e.items[T], T), X = O.get(fe) ?? G.value;
|
|
1615
|
+
S[T] = X, v[T + 1] = v[T] + X;
|
|
1523
1616
|
}
|
|
1524
1617
|
return {
|
|
1525
|
-
offsets:
|
|
1526
|
-
sizes:
|
|
1527
|
-
total:
|
|
1618
|
+
offsets: v,
|
|
1619
|
+
sizes: S,
|
|
1620
|
+
total: v[e.items.length] ?? 0
|
|
1528
1621
|
};
|
|
1529
|
-
}),
|
|
1530
|
-
() =>
|
|
1531
|
-
),
|
|
1532
|
-
const
|
|
1533
|
-
return e.items.forEach((
|
|
1534
|
-
|
|
1535
|
-
}),
|
|
1536
|
-
}),
|
|
1537
|
-
() => Math.max(0,
|
|
1622
|
+
}), Q = n(
|
|
1623
|
+
() => z.value.total + (e.loading ? u.value : 0)
|
|
1624
|
+
), he = n(() => {
|
|
1625
|
+
const v = /* @__PURE__ */ new Map();
|
|
1626
|
+
return e.items.forEach((S, T) => {
|
|
1627
|
+
v.set(ne(S, T), T);
|
|
1628
|
+
}), v;
|
|
1629
|
+
}), y = n(
|
|
1630
|
+
() => Math.max(0, r.value - m.value)
|
|
1538
1631
|
);
|
|
1539
|
-
function
|
|
1632
|
+
function L(v) {
|
|
1540
1633
|
if (e.items.length === 0) return 0;
|
|
1541
|
-
const
|
|
1542
|
-
let
|
|
1543
|
-
for (;
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1634
|
+
const S = z.value.offsets;
|
|
1635
|
+
let T = 0, fe = e.items.length;
|
|
1636
|
+
for (; T < fe; ) {
|
|
1637
|
+
const X = Math.floor((T + fe) / 2);
|
|
1638
|
+
S[X + 1] <= v ? T = X + 1 : fe = X;
|
|
1546
1639
|
}
|
|
1547
|
-
return Math.min(
|
|
1640
|
+
return Math.min(T, e.items.length - 1);
|
|
1548
1641
|
}
|
|
1549
|
-
const
|
|
1642
|
+
const B = n(
|
|
1550
1643
|
() => Math.max(
|
|
1551
1644
|
0,
|
|
1552
|
-
|
|
1645
|
+
L(y.value) - d.value
|
|
1553
1646
|
)
|
|
1554
|
-
),
|
|
1647
|
+
), te = n(() => {
|
|
1555
1648
|
if (e.items.length === 0) return 0;
|
|
1556
|
-
const
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
),
|
|
1649
|
+
const v = r.value + o.value - m.value, S = Math.max(
|
|
1650
|
+
G.value,
|
|
1651
|
+
v
|
|
1652
|
+
), T = L(S) + 1;
|
|
1560
1653
|
return Math.min(
|
|
1561
1654
|
e.items.length,
|
|
1562
|
-
|
|
1655
|
+
T + d.value
|
|
1563
1656
|
);
|
|
1564
|
-
}),
|
|
1565
|
-
() => e.items.slice(
|
|
1566
|
-
const
|
|
1657
|
+
}), oe = n(
|
|
1658
|
+
() => e.items.slice(B.value, te.value).map((v, S) => {
|
|
1659
|
+
const T = B.value + S;
|
|
1567
1660
|
return {
|
|
1568
|
-
item:
|
|
1569
|
-
index:
|
|
1570
|
-
key:
|
|
1571
|
-
top:
|
|
1661
|
+
item: v,
|
|
1662
|
+
index: T,
|
|
1663
|
+
key: ne(v, T),
|
|
1664
|
+
top: z.value.offsets[T]
|
|
1572
1665
|
};
|
|
1573
1666
|
})
|
|
1574
1667
|
);
|
|
1575
|
-
function
|
|
1576
|
-
typeof window > "u" || (
|
|
1577
|
-
}
|
|
1578
|
-
function
|
|
1579
|
-
|
|
1580
|
-
scrollTop:
|
|
1581
|
-
startIndex:
|
|
1582
|
-
endIndex:
|
|
1668
|
+
function re() {
|
|
1669
|
+
typeof window > "u" || (r.value = Math.max(0, window.scrollY), o.value = window.innerHeight, f.value && (m.value = f.value.getBoundingClientRect().top + r.value));
|
|
1670
|
+
}
|
|
1671
|
+
function ye() {
|
|
1672
|
+
p("scroll", {
|
|
1673
|
+
scrollTop: y.value,
|
|
1674
|
+
startIndex: B.value,
|
|
1675
|
+
endIndex: te.value
|
|
1583
1676
|
});
|
|
1584
1677
|
}
|
|
1585
|
-
function
|
|
1586
|
-
|
|
1587
|
-
|
|
1678
|
+
function _(v = !1) {
|
|
1679
|
+
F && (E || (E = v), !w && (w = Z(() => {
|
|
1680
|
+
w = void 0, re(), E && (E = !1, ye()), t();
|
|
1588
1681
|
})));
|
|
1589
1682
|
}
|
|
1590
|
-
function
|
|
1591
|
-
|
|
1683
|
+
function ee() {
|
|
1684
|
+
_(!0);
|
|
1592
1685
|
}
|
|
1593
1686
|
function s() {
|
|
1594
|
-
|
|
1687
|
+
_();
|
|
1595
1688
|
}
|
|
1596
|
-
function
|
|
1597
|
-
if (typeof window > "u" || !e.hasMore || e.loading ||
|
|
1689
|
+
function t() {
|
|
1690
|
+
if (typeof window > "u" || !e.hasMore || e.loading || W === e.items.length)
|
|
1598
1691
|
return;
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1601
|
-
}
|
|
1602
|
-
function
|
|
1603
|
-
const
|
|
1604
|
-
if (
|
|
1605
|
-
const
|
|
1606
|
-
if (
|
|
1692
|
+
const v = Math.max(0, e.loadMoreThreshold), S = m.value + Q.value, T = r.value + o.value;
|
|
1693
|
+
S - T <= v && (W = e.items.length, p("loadMore"));
|
|
1694
|
+
}
|
|
1695
|
+
function a(v) {
|
|
1696
|
+
const S = v.borderBoxSize;
|
|
1697
|
+
if (S) {
|
|
1698
|
+
const T = Array.isArray(S) ? S[0] : S;
|
|
1699
|
+
if (T != null && T.blockSize) return T.blockSize;
|
|
1607
1700
|
}
|
|
1608
|
-
return
|
|
1609
|
-
}
|
|
1610
|
-
function
|
|
1611
|
-
const
|
|
1612
|
-
let
|
|
1613
|
-
for (const
|
|
1614
|
-
const
|
|
1615
|
-
if (
|
|
1616
|
-
const
|
|
1617
|
-
if (Math.abs(
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1701
|
+
return v.contentRect.height;
|
|
1702
|
+
}
|
|
1703
|
+
function g(v) {
|
|
1704
|
+
const S = z.value;
|
|
1705
|
+
let T = 0, fe = !1;
|
|
1706
|
+
for (const X of v) {
|
|
1707
|
+
const be = X.target, Ie = U.get(be), Be = a(X);
|
|
1708
|
+
if (Ie === void 0 || Be <= 0) continue;
|
|
1709
|
+
const Ke = O.get(Ie) ?? G.value;
|
|
1710
|
+
if (Math.abs(Ke - Be) < 0.5) continue;
|
|
1711
|
+
const He = he.value.get(Ie);
|
|
1712
|
+
He !== void 0 && S.offsets[He + 1] <= y.value && (T += Be - Ke), O.set(Ie, Be), fe = !0;
|
|
1620
1713
|
}
|
|
1621
|
-
|
|
1622
|
-
if (
|
|
1623
|
-
if (
|
|
1624
|
-
const
|
|
1714
|
+
fe && (A.value += 1, C(() => {
|
|
1715
|
+
if (F) {
|
|
1716
|
+
if (T !== 0 && typeof window < "u") {
|
|
1717
|
+
const X = Math.max(
|
|
1625
1718
|
0,
|
|
1626
|
-
|
|
1719
|
+
r.value + T
|
|
1627
1720
|
);
|
|
1628
|
-
|
|
1721
|
+
r.value = X, window.scrollTo({ top: X, behavior: "auto" });
|
|
1629
1722
|
}
|
|
1630
|
-
|
|
1723
|
+
re(), t();
|
|
1631
1724
|
}
|
|
1632
1725
|
}));
|
|
1633
1726
|
}
|
|
1634
|
-
function
|
|
1635
|
-
if (
|
|
1636
|
-
for (const
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
const
|
|
1641
|
-
|
|
1727
|
+
function b(v) {
|
|
1728
|
+
if (F) {
|
|
1729
|
+
for (const S of v)
|
|
1730
|
+
q.set(S.target, S);
|
|
1731
|
+
k || (k = Z(() => {
|
|
1732
|
+
k = void 0;
|
|
1733
|
+
const S = Array.from(q.values());
|
|
1734
|
+
q.clear(), g(S);
|
|
1642
1735
|
}));
|
|
1643
1736
|
}
|
|
1644
1737
|
}
|
|
1645
|
-
function
|
|
1646
|
-
|
|
1738
|
+
function Me(v, S) {
|
|
1739
|
+
v instanceof HTMLElement && (U.set(v, S), D == null || D.observe(v));
|
|
1647
1740
|
}
|
|
1648
|
-
function
|
|
1649
|
-
for (const [
|
|
1650
|
-
|
|
1741
|
+
function ge() {
|
|
1742
|
+
for (const [v] of U)
|
|
1743
|
+
v.isConnected || (D == null || D.unobserve(v), U.delete(v));
|
|
1651
1744
|
}
|
|
1652
|
-
function
|
|
1745
|
+
function ve(v, S = {}) {
|
|
1653
1746
|
if (typeof window > "u") return;
|
|
1654
|
-
|
|
1655
|
-
const
|
|
1656
|
-
Math.max(0, Number.isFinite(
|
|
1657
|
-
|
|
1658
|
-
),
|
|
1659
|
-
|
|
1660
|
-
}
|
|
1661
|
-
function
|
|
1747
|
+
re();
|
|
1748
|
+
const T = Math.max(0, Q.value - o.value), fe = Math.min(
|
|
1749
|
+
Math.max(0, Number.isFinite(v) ? v : 0),
|
|
1750
|
+
T
|
|
1751
|
+
), X = Math.max(0, m.value + fe), be = S.behavior ?? "auto";
|
|
1752
|
+
be === "auto" && (r.value = X), window.scrollTo({ ...S, top: X, behavior: be });
|
|
1753
|
+
}
|
|
1754
|
+
function Le(v, S = {}) {
|
|
1662
1755
|
if (typeof window > "u" || e.items.length === 0) return;
|
|
1663
|
-
|
|
1664
|
-
const
|
|
1756
|
+
re();
|
|
1757
|
+
const T = Math.min(
|
|
1665
1758
|
e.items.length - 1,
|
|
1666
|
-
Math.max(0, Math.floor(
|
|
1667
|
-
), { align:
|
|
1668
|
-
let
|
|
1669
|
-
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
),
|
|
1674
|
-
|
|
1675
|
-
...
|
|
1676
|
-
top:
|
|
1677
|
-
behavior:
|
|
1759
|
+
Math.max(0, Math.floor(v))
|
|
1760
|
+
), { align: fe = "start", ...X } = S, be = z.value.sizes[T];
|
|
1761
|
+
let Ie = m.value + z.value.offsets[T];
|
|
1762
|
+
fe === "center" ? Ie -= (o.value - be) / 2 : fe === "end" && (Ie -= o.value - be);
|
|
1763
|
+
const Be = Math.max(
|
|
1764
|
+
m.value,
|
|
1765
|
+
m.value + Q.value - o.value
|
|
1766
|
+
), Ke = Math.max(0, Math.min(Ie, Be)), He = X.behavior ?? "auto";
|
|
1767
|
+
He === "auto" && (r.value = Ke), window.scrollTo({
|
|
1768
|
+
...X,
|
|
1769
|
+
top: Ke,
|
|
1770
|
+
behavior: He
|
|
1678
1771
|
});
|
|
1679
1772
|
}
|
|
1680
|
-
function
|
|
1681
|
-
typeof window > "u" || (
|
|
1773
|
+
function ke(v = "auto") {
|
|
1774
|
+
typeof window > "u" || (re(), window.scrollTo({ top: Math.max(0, m.value), behavior: v }));
|
|
1682
1775
|
}
|
|
1683
|
-
return
|
|
1776
|
+
return ie(
|
|
1684
1777
|
() => e.itemKey,
|
|
1685
1778
|
() => {
|
|
1686
|
-
|
|
1779
|
+
O.clear(), A.value += 1, W = -1;
|
|
1687
1780
|
}
|
|
1688
|
-
),
|
|
1689
|
-
() => e.items.map((
|
|
1690
|
-
async (
|
|
1691
|
-
const
|
|
1692
|
-
for (const
|
|
1693
|
-
|
|
1694
|
-
|
|
1781
|
+
), ie(
|
|
1782
|
+
() => e.items.map((v, S) => ne(v, S)),
|
|
1783
|
+
async (v, S) => {
|
|
1784
|
+
const T = v.length !== S.length || v.some((X, be) => X !== S[be]), fe = new Set(v);
|
|
1785
|
+
for (const X of O.keys())
|
|
1786
|
+
fe.has(X) || O.delete(X);
|
|
1787
|
+
T && (W = -1), A.value += 1, await C(), F && (re(), t());
|
|
1695
1788
|
}
|
|
1696
|
-
),
|
|
1789
|
+
), ie(
|
|
1697
1790
|
() => [e.hasMore, e.loading],
|
|
1698
|
-
async ([
|
|
1699
|
-
|
|
1791
|
+
async ([v]) => {
|
|
1792
|
+
v || (W = -1), await C(), F && (re(), t());
|
|
1700
1793
|
}
|
|
1701
|
-
),
|
|
1702
|
-
if (
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
}),
|
|
1706
|
-
for (const [
|
|
1707
|
-
|
|
1794
|
+
), Ae(() => {
|
|
1795
|
+
if (F = !0, re(), window.addEventListener("scroll", ee, { passive: !0 }), window.addEventListener("resize", s, { passive: !0 }), typeof ResizeObserver < "u") {
|
|
1796
|
+
V = new ResizeObserver(() => {
|
|
1797
|
+
_();
|
|
1798
|
+
}), D = new ResizeObserver(b), f.value && V.observe(f.value);
|
|
1799
|
+
for (const [v] of U)
|
|
1800
|
+
D.observe(v);
|
|
1708
1801
|
}
|
|
1709
|
-
|
|
1710
|
-
|
|
1802
|
+
C(() => {
|
|
1803
|
+
F && t();
|
|
1711
1804
|
});
|
|
1712
|
-
}),
|
|
1713
|
-
|
|
1714
|
-
}),
|
|
1715
|
-
scrollTo:
|
|
1716
|
-
scrollToIndex:
|
|
1717
|
-
scrollToTop:
|
|
1718
|
-
}), (
|
|
1805
|
+
}), Xe(ge), Ce(() => {
|
|
1806
|
+
F = !1, window.removeEventListener("scroll", ee), window.removeEventListener("resize", s), H(w), H(k), w = void 0, k = void 0, E = !1, q.clear(), V && (V.disconnect(), V = void 0), D && (D.disconnect(), D = void 0), U.clear();
|
|
1807
|
+
}), P({
|
|
1808
|
+
scrollTo: ve,
|
|
1809
|
+
scrollToIndex: Le,
|
|
1810
|
+
scrollToTop: ke
|
|
1811
|
+
}), (v, S) => (I(), $("div", {
|
|
1719
1812
|
ref_key: "root",
|
|
1720
1813
|
ref: f,
|
|
1721
|
-
class:
|
|
1814
|
+
class: Ye(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": c(ae) }]),
|
|
1722
1815
|
role: "list",
|
|
1723
|
-
"aria-label":
|
|
1724
|
-
onTouchstartPassive:
|
|
1725
|
-
(...
|
|
1726
|
-
onTouchmove:
|
|
1727
|
-
(...
|
|
1728
|
-
onTouchend:
|
|
1729
|
-
(...
|
|
1730
|
-
onTouchcancel:
|
|
1731
|
-
(...
|
|
1816
|
+
"aria-label": l.ariaLabel,
|
|
1817
|
+
onTouchstartPassive: S[0] || (S[0] = //@ts-ignore
|
|
1818
|
+
(...T) => c(me) && c(me)(...T)),
|
|
1819
|
+
onTouchmove: S[1] || (S[1] = //@ts-ignore
|
|
1820
|
+
(...T) => c(de) && c(de)(...T)),
|
|
1821
|
+
onTouchend: S[2] || (S[2] = //@ts-ignore
|
|
1822
|
+
(...T) => c(ue) && c(ue)(...T)),
|
|
1823
|
+
onTouchcancel: S[3] || (S[3] = //@ts-ignore
|
|
1824
|
+
(...T) => c(we) && c(we)(...T))
|
|
1732
1825
|
}, [
|
|
1733
|
-
|
|
1826
|
+
l.pullToRefresh || l.refreshing ? (I(), $("div", {
|
|
1734
1827
|
key: 0,
|
|
1735
1828
|
class: "vue-window-dynamic-virtual-scroll__refresh",
|
|
1736
|
-
style:
|
|
1737
|
-
height: `${c(
|
|
1738
|
-
transform: `translateY(${c(
|
|
1829
|
+
style: N({
|
|
1830
|
+
height: `${c(se)}px`,
|
|
1831
|
+
transform: `translateY(${c(J) - c(se)}px)`
|
|
1739
1832
|
}),
|
|
1740
1833
|
role: "status",
|
|
1741
1834
|
"aria-live": "polite"
|
|
1742
1835
|
}, [
|
|
1743
|
-
|
|
1744
|
-
pullDistance: c(
|
|
1745
|
-
progress: c(
|
|
1746
|
-
refreshing:
|
|
1836
|
+
ce(v.$slots, "refresh", {
|
|
1837
|
+
pullDistance: c(R),
|
|
1838
|
+
progress: c(Y),
|
|
1839
|
+
refreshing: l.refreshing
|
|
1747
1840
|
}, () => [
|
|
1748
|
-
|
|
1841
|
+
Ve(je(c(le)), 1)
|
|
1749
1842
|
])
|
|
1750
|
-
], 4)) :
|
|
1751
|
-
|
|
1843
|
+
], 4)) : ze("", !0),
|
|
1844
|
+
l.items.length || l.loading ? (I(), $("div", {
|
|
1752
1845
|
key: 1,
|
|
1753
1846
|
class: "vue-window-dynamic-virtual-scroll__spacer",
|
|
1754
|
-
style:
|
|
1755
|
-
height: `${
|
|
1756
|
-
transform: `translateY(${c(
|
|
1847
|
+
style: N({
|
|
1848
|
+
height: `${Q.value}px`,
|
|
1849
|
+
transform: `translateY(${c(J)}px)`
|
|
1757
1850
|
})
|
|
1758
1851
|
}, [
|
|
1759
|
-
(
|
|
1760
|
-
key:
|
|
1852
|
+
(I(!0), $(Re, null, De(oe.value, ({ item: T, index: fe, key: X, top: be }) => (I(), $("div", {
|
|
1853
|
+
key: X,
|
|
1761
1854
|
ref_for: !0,
|
|
1762
|
-
ref: (
|
|
1855
|
+
ref: (Ie) => Me(Ie, X),
|
|
1763
1856
|
class: "vue-window-dynamic-virtual-scroll__item",
|
|
1764
|
-
style:
|
|
1857
|
+
style: N({ transform: `translateY(${be}px)` }),
|
|
1765
1858
|
role: "listitem",
|
|
1766
|
-
"aria-posinset":
|
|
1767
|
-
"aria-setsize":
|
|
1859
|
+
"aria-posinset": fe + 1,
|
|
1860
|
+
"aria-setsize": l.items.length
|
|
1768
1861
|
}, [
|
|
1769
|
-
|
|
1770
|
-
item:
|
|
1771
|
-
index:
|
|
1862
|
+
ce(v.$slots, "default", {
|
|
1863
|
+
item: T,
|
|
1864
|
+
index: fe
|
|
1772
1865
|
})
|
|
1773
|
-
], 12,
|
|
1774
|
-
|
|
1866
|
+
], 12, Et))), 128)),
|
|
1867
|
+
l.loading ? (I(), $("div", {
|
|
1775
1868
|
key: 0,
|
|
1776
1869
|
class: "vue-window-dynamic-virtual-scroll__loading",
|
|
1777
|
-
style:
|
|
1778
|
-
height: `${
|
|
1779
|
-
transform: `translateY(${
|
|
1870
|
+
style: N({
|
|
1871
|
+
height: `${u.value}px`,
|
|
1872
|
+
transform: `translateY(${z.value.total}px)`
|
|
1780
1873
|
}),
|
|
1781
1874
|
role: "status",
|
|
1782
1875
|
"aria-live": "polite"
|
|
1783
1876
|
}, [
|
|
1784
|
-
|
|
1785
|
-
|
|
1877
|
+
ce(v.$slots, "loading", {}, () => [
|
|
1878
|
+
S[4] || (S[4] = Ve("Loading more…", -1))
|
|
1786
1879
|
])
|
|
1787
|
-
], 4)) :
|
|
1788
|
-
], 4)) : (
|
|
1880
|
+
], 4)) : ze("", !0)
|
|
1881
|
+
], 4)) : (I(), $("div", {
|
|
1789
1882
|
key: 2,
|
|
1790
1883
|
class: "vue-window-dynamic-virtual-scroll__empty",
|
|
1791
|
-
style:
|
|
1884
|
+
style: N({ transform: `translateY(${c(J)}px)` })
|
|
1792
1885
|
}, [
|
|
1793
|
-
|
|
1886
|
+
ce(v.$slots, "empty")
|
|
1794
1887
|
], 4))
|
|
1795
|
-
], 42,
|
|
1888
|
+
], 42, kt));
|
|
1796
1889
|
}
|
|
1797
|
-
}),
|
|
1890
|
+
}), Bt = ["aria-label"], Vt = ["aria-posinset", "aria-setsize"], Ht = /* @__PURE__ */ Oe({
|
|
1798
1891
|
name: "WindowGirdVirtualScroll",
|
|
1799
1892
|
__name: "WindowGirdVirtualScroll",
|
|
1800
1893
|
props: {
|
|
@@ -1814,133 +1907,133 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
|
|
|
1814
1907
|
pullRefreshThreshold: { default: 64 }
|
|
1815
1908
|
},
|
|
1816
1909
|
emits: ["scroll", "loadMore", "refresh"],
|
|
1817
|
-
setup(
|
|
1818
|
-
const e =
|
|
1819
|
-
let
|
|
1820
|
-
const { getItemKey:
|
|
1910
|
+
setup(l, { expose: P, emit: x }) {
|
|
1911
|
+
const e = l, p = x, f = j(), r = j(0), o = j(0), m = j(0);
|
|
1912
|
+
let A, O = -1;
|
|
1913
|
+
const { getItemKey: U } = Pe({
|
|
1821
1914
|
componentName: "WindowGirdVirtualScroll",
|
|
1822
1915
|
items: () => e.items,
|
|
1823
1916
|
itemKey: () => e.itemKey
|
|
1824
1917
|
}), {
|
|
1825
|
-
pulling:
|
|
1826
|
-
pullDistance:
|
|
1827
|
-
pullOffset:
|
|
1828
|
-
pullProgress:
|
|
1829
|
-
refreshMessage:
|
|
1830
|
-
refreshThreshold:
|
|
1831
|
-
handleTouchStart:
|
|
1832
|
-
handleTouchMove:
|
|
1833
|
-
handleTouchEnd:
|
|
1834
|
-
handleTouchCancel:
|
|
1835
|
-
} =
|
|
1918
|
+
pulling: q,
|
|
1919
|
+
pullDistance: V,
|
|
1920
|
+
pullOffset: D,
|
|
1921
|
+
pullProgress: w,
|
|
1922
|
+
refreshMessage: k,
|
|
1923
|
+
refreshThreshold: E,
|
|
1924
|
+
handleTouchStart: F,
|
|
1925
|
+
handleTouchMove: W,
|
|
1926
|
+
handleTouchEnd: ne,
|
|
1927
|
+
handleTouchCancel: Z
|
|
1928
|
+
} = qe({
|
|
1836
1929
|
enabled: () => e.pullToRefresh,
|
|
1837
1930
|
refreshing: () => e.refreshing,
|
|
1838
1931
|
threshold: () => e.pullRefreshThreshold,
|
|
1839
|
-
onRefresh: () =>
|
|
1932
|
+
onRefresh: () => p("refresh"),
|
|
1840
1933
|
scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
|
|
1841
|
-
}),
|
|
1934
|
+
}), H = n(() => Math.max(1, e.itemSize)), ae = n(
|
|
1842
1935
|
() => Math.max(1, Math.floor(e.columns))
|
|
1843
|
-
),
|
|
1844
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
1845
|
-
),
|
|
1846
|
-
() =>
|
|
1847
|
-
),
|
|
1848
|
-
() => Math.ceil(e.items.length /
|
|
1849
|
-
),
|
|
1850
|
-
() =>
|
|
1851
|
-
),
|
|
1852
|
-
() =>
|
|
1853
|
-
),
|
|
1854
|
-
() => Math.max(0,
|
|
1855
|
-
),
|
|
1936
|
+
), R = n(() => Math.max(0, e.gap)), J = n(() => Math.max(0, Math.floor(e.overscan))), Y = n(
|
|
1937
|
+
() => Math.max(1, e.loadingItemSize ?? H.value)
|
|
1938
|
+
), le = n(
|
|
1939
|
+
() => H.value + R.value
|
|
1940
|
+
), se = n(
|
|
1941
|
+
() => Math.ceil(e.items.length / ae.value)
|
|
1942
|
+
), me = n(() => se.value === 0 ? 0 : se.value * H.value + (se.value - 1) * R.value), de = n(
|
|
1943
|
+
() => me.value + (e.items.length ? R.value : 0)
|
|
1944
|
+
), ue = n(
|
|
1945
|
+
() => me.value + (e.loading ? Y.value + (e.items.length ? R.value : 0) : 0)
|
|
1946
|
+
), we = n(
|
|
1947
|
+
() => Math.max(0, r.value - m.value)
|
|
1948
|
+
), G = n(
|
|
1856
1949
|
() => Math.max(
|
|
1857
1950
|
0,
|
|
1858
|
-
Math.floor(
|
|
1951
|
+
Math.floor(we.value / le.value) - J.value
|
|
1859
1952
|
)
|
|
1860
|
-
),
|
|
1861
|
-
if (
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
),
|
|
1866
|
-
(
|
|
1953
|
+
), u = n(() => {
|
|
1954
|
+
if (se.value === 0) return 0;
|
|
1955
|
+
const _ = Math.max(
|
|
1956
|
+
H.value,
|
|
1957
|
+
r.value + o.value - m.value
|
|
1958
|
+
), ee = Math.ceil(
|
|
1959
|
+
(_ + R.value) / le.value
|
|
1867
1960
|
);
|
|
1868
1961
|
return Math.min(
|
|
1869
|
-
|
|
1870
|
-
|
|
1962
|
+
se.value,
|
|
1963
|
+
ee + J.value
|
|
1871
1964
|
);
|
|
1872
|
-
}),
|
|
1873
|
-
() => Math.min(e.items.length,
|
|
1874
|
-
),
|
|
1875
|
-
() => Math.min(e.items.length,
|
|
1876
|
-
),
|
|
1877
|
-
() => e.items.slice(
|
|
1878
|
-
const s =
|
|
1965
|
+
}), d = n(
|
|
1966
|
+
() => Math.min(e.items.length, G.value * ae.value)
|
|
1967
|
+
), z = n(
|
|
1968
|
+
() => Math.min(e.items.length, u.value * ae.value)
|
|
1969
|
+
), Q = n(
|
|
1970
|
+
() => e.items.slice(d.value, z.value).map((_, ee) => {
|
|
1971
|
+
const s = d.value + ee;
|
|
1879
1972
|
return {
|
|
1880
|
-
item:
|
|
1973
|
+
item: _,
|
|
1881
1974
|
index: s,
|
|
1882
|
-
key:
|
|
1883
|
-
rowIndex: Math.floor(s /
|
|
1884
|
-
columnIndex: s %
|
|
1975
|
+
key: U(_, s),
|
|
1976
|
+
rowIndex: Math.floor(s / ae.value),
|
|
1977
|
+
columnIndex: s % ae.value
|
|
1885
1978
|
};
|
|
1886
1979
|
})
|
|
1887
|
-
),
|
|
1888
|
-
gridTemplateColumns: `repeat(${
|
|
1889
|
-
columnGap: `${
|
|
1890
|
-
rowGap: `${
|
|
1891
|
-
transform: `translateY(${
|
|
1980
|
+
), he = n(() => ({
|
|
1981
|
+
gridTemplateColumns: `repeat(${ae.value}, minmax(0, 1fr))`,
|
|
1982
|
+
columnGap: `${R.value}px`,
|
|
1983
|
+
rowGap: `${R.value}px`,
|
|
1984
|
+
transform: `translateY(${G.value * le.value}px)`
|
|
1892
1985
|
}));
|
|
1893
|
-
function
|
|
1894
|
-
typeof window > "u" || (
|
|
1895
|
-
}
|
|
1896
|
-
function
|
|
1897
|
-
|
|
1898
|
-
scrollTop:
|
|
1899
|
-
startIndex:
|
|
1900
|
-
endIndex:
|
|
1986
|
+
function y() {
|
|
1987
|
+
typeof window > "u" || (r.value = Math.max(0, window.scrollY), o.value = window.innerHeight, f.value && (m.value = f.value.getBoundingClientRect().top + r.value));
|
|
1988
|
+
}
|
|
1989
|
+
function L() {
|
|
1990
|
+
p("scroll", {
|
|
1991
|
+
scrollTop: we.value,
|
|
1992
|
+
startIndex: d.value,
|
|
1993
|
+
endIndex: z.value
|
|
1901
1994
|
});
|
|
1902
1995
|
}
|
|
1903
|
-
function
|
|
1904
|
-
|
|
1996
|
+
function B() {
|
|
1997
|
+
y(), L(), te();
|
|
1905
1998
|
}
|
|
1906
|
-
function
|
|
1907
|
-
if (typeof window > "u" || !e.hasMore || e.loading ||
|
|
1999
|
+
function te() {
|
|
2000
|
+
if (typeof window > "u" || !e.hasMore || e.loading || O === e.items.length)
|
|
1908
2001
|
return;
|
|
1909
|
-
const
|
|
1910
|
-
|
|
2002
|
+
const _ = Math.max(0, e.loadMoreThreshold), ee = m.value + ue.value, s = r.value + o.value;
|
|
2003
|
+
ee - s <= _ && (O = e.items.length, p("loadMore"));
|
|
1911
2004
|
}
|
|
1912
|
-
function
|
|
2005
|
+
function oe(_, ee = {}) {
|
|
1913
2006
|
if (typeof window > "u") return;
|
|
1914
|
-
|
|
1915
|
-
const s = Math.max(0,
|
|
1916
|
-
Math.max(0, Number.isFinite(
|
|
2007
|
+
y();
|
|
2008
|
+
const s = Math.max(0, ue.value - o.value), t = Math.min(
|
|
2009
|
+
Math.max(0, Number.isFinite(_) ? _ : 0),
|
|
1917
2010
|
s
|
|
1918
|
-
),
|
|
1919
|
-
|
|
2011
|
+
), a = Math.max(0, m.value + t), g = ee.behavior ?? "auto";
|
|
2012
|
+
g === "auto" && (r.value = a), window.scrollTo({ ...ee, top: a, behavior: g });
|
|
1920
2013
|
}
|
|
1921
|
-
function
|
|
2014
|
+
function re(_, ee = {}) {
|
|
1922
2015
|
if (typeof window > "u" || e.items.length === 0) return;
|
|
1923
|
-
|
|
2016
|
+
y();
|
|
1924
2017
|
const s = Math.min(
|
|
1925
2018
|
e.items.length - 1,
|
|
1926
|
-
Math.max(0, Math.floor(
|
|
1927
|
-
),
|
|
1928
|
-
let
|
|
1929
|
-
|
|
1930
|
-
const
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
),
|
|
1934
|
-
|
|
1935
|
-
...
|
|
1936
|
-
top:
|
|
1937
|
-
behavior:
|
|
2019
|
+
Math.max(0, Math.floor(_))
|
|
2020
|
+
), t = Math.floor(s / ae.value), { align: a = "start", ...g } = ee;
|
|
2021
|
+
let b = m.value + t * le.value;
|
|
2022
|
+
a === "center" ? b -= (o.value - H.value) / 2 : a === "end" && (b -= o.value - H.value);
|
|
2023
|
+
const Me = Math.max(
|
|
2024
|
+
m.value,
|
|
2025
|
+
m.value + ue.value - o.value
|
|
2026
|
+
), ge = Math.max(0, Math.min(b, Me)), ve = g.behavior ?? "auto";
|
|
2027
|
+
ve === "auto" && (r.value = ge), window.scrollTo({
|
|
2028
|
+
...g,
|
|
2029
|
+
top: ge,
|
|
2030
|
+
behavior: ve
|
|
1938
2031
|
});
|
|
1939
2032
|
}
|
|
1940
|
-
function
|
|
1941
|
-
typeof window > "u" || (
|
|
2033
|
+
function ye(_ = "auto") {
|
|
2034
|
+
typeof window > "u" || (y(), window.scrollTo({ top: Math.max(0, m.value), behavior: _ }));
|
|
1942
2035
|
}
|
|
1943
|
-
return
|
|
2036
|
+
return ie(
|
|
1944
2037
|
() => [
|
|
1945
2038
|
e.items.length,
|
|
1946
2039
|
e.itemSize,
|
|
@@ -1948,128 +2041,128 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
|
|
|
1948
2041
|
e.gap
|
|
1949
2042
|
],
|
|
1950
2043
|
async () => {
|
|
1951
|
-
await
|
|
2044
|
+
await C(), y(), te();
|
|
1952
2045
|
}
|
|
1953
|
-
),
|
|
2046
|
+
), ie(
|
|
1954
2047
|
() => [e.hasMore, e.loading],
|
|
1955
|
-
async ([
|
|
1956
|
-
|
|
2048
|
+
async ([_]) => {
|
|
2049
|
+
_ || (O = -1), await C(), y(), te();
|
|
1957
2050
|
}
|
|
1958
|
-
),
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
}), f.value &&
|
|
1962
|
-
}),
|
|
1963
|
-
window.removeEventListener("scroll",
|
|
1964
|
-
}),
|
|
1965
|
-
scrollTo:
|
|
1966
|
-
scrollToIndex:
|
|
1967
|
-
scrollToTop:
|
|
1968
|
-
}), (
|
|
2051
|
+
), Ae(() => {
|
|
2052
|
+
y(), window.addEventListener("scroll", B, { passive: !0 }), window.addEventListener("resize", B, { passive: !0 }), typeof ResizeObserver < "u" && (A = new ResizeObserver(() => {
|
|
2053
|
+
y(), te();
|
|
2054
|
+
}), f.value && A.observe(f.value)), C(te);
|
|
2055
|
+
}), Ce(() => {
|
|
2056
|
+
window.removeEventListener("scroll", B), window.removeEventListener("resize", B), A && (A.disconnect(), A = void 0);
|
|
2057
|
+
}), P({
|
|
2058
|
+
scrollTo: oe,
|
|
2059
|
+
scrollToIndex: re,
|
|
2060
|
+
scrollToTop: ye
|
|
2061
|
+
}), (_, ee) => (I(), $("div", {
|
|
1969
2062
|
ref_key: "root",
|
|
1970
2063
|
ref: f,
|
|
1971
|
-
class:
|
|
2064
|
+
class: Ye(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": c(q) }]),
|
|
1972
2065
|
role: "list",
|
|
1973
|
-
"aria-label":
|
|
1974
|
-
onTouchstartPassive:
|
|
1975
|
-
(...s) => c(
|
|
1976
|
-
onTouchmove:
|
|
1977
|
-
(...s) => c(
|
|
1978
|
-
onTouchend:
|
|
1979
|
-
(...s) => c(
|
|
1980
|
-
onTouchcancel:
|
|
1981
|
-
(...s) => c(
|
|
2066
|
+
"aria-label": l.ariaLabel,
|
|
2067
|
+
onTouchstartPassive: ee[0] || (ee[0] = //@ts-ignore
|
|
2068
|
+
(...s) => c(F) && c(F)(...s)),
|
|
2069
|
+
onTouchmove: ee[1] || (ee[1] = //@ts-ignore
|
|
2070
|
+
(...s) => c(W) && c(W)(...s)),
|
|
2071
|
+
onTouchend: ee[2] || (ee[2] = //@ts-ignore
|
|
2072
|
+
(...s) => c(ne) && c(ne)(...s)),
|
|
2073
|
+
onTouchcancel: ee[3] || (ee[3] = //@ts-ignore
|
|
2074
|
+
(...s) => c(Z) && c(Z)(...s))
|
|
1982
2075
|
}, [
|
|
1983
|
-
|
|
2076
|
+
l.pullToRefresh || l.refreshing ? (I(), $("div", {
|
|
1984
2077
|
key: 0,
|
|
1985
2078
|
class: "vue-window-gird-virtual-scroll__refresh",
|
|
1986
|
-
style:
|
|
1987
|
-
height: `${c(
|
|
1988
|
-
transform: `translateY(${c(
|
|
2079
|
+
style: N({
|
|
2080
|
+
height: `${c(E)}px`,
|
|
2081
|
+
transform: `translateY(${c(D) - c(E)}px)`
|
|
1989
2082
|
}),
|
|
1990
2083
|
role: "status",
|
|
1991
2084
|
"aria-live": "polite"
|
|
1992
2085
|
}, [
|
|
1993
|
-
|
|
1994
|
-
pullDistance: c(
|
|
1995
|
-
progress: c(
|
|
1996
|
-
refreshing:
|
|
2086
|
+
ce(_.$slots, "refresh", {
|
|
2087
|
+
pullDistance: c(V),
|
|
2088
|
+
progress: c(w),
|
|
2089
|
+
refreshing: l.refreshing
|
|
1997
2090
|
}, () => [
|
|
1998
|
-
|
|
2091
|
+
Ve(je(c(k)), 1)
|
|
1999
2092
|
])
|
|
2000
|
-
], 4)) :
|
|
2001
|
-
|
|
2093
|
+
], 4)) : ze("", !0),
|
|
2094
|
+
l.items.length || l.loading ? (I(), $("div", {
|
|
2002
2095
|
key: 1,
|
|
2003
2096
|
class: "vue-window-gird-virtual-scroll__spacer",
|
|
2004
|
-
style:
|
|
2005
|
-
height: `${
|
|
2006
|
-
transform: `translateY(${c(
|
|
2097
|
+
style: N({
|
|
2098
|
+
height: `${ue.value}px`,
|
|
2099
|
+
transform: `translateY(${c(D)}px)`
|
|
2007
2100
|
})
|
|
2008
2101
|
}, [
|
|
2009
|
-
|
|
2102
|
+
Ge("div", {
|
|
2010
2103
|
class: "vue-window-gird-virtual-scroll__content",
|
|
2011
|
-
style:
|
|
2104
|
+
style: N(he.value)
|
|
2012
2105
|
}, [
|
|
2013
|
-
(
|
|
2014
|
-
key:
|
|
2106
|
+
(I(!0), $(Re, null, De(Q.value, ({ item: s, index: t, key: a, rowIndex: g, columnIndex: b }) => (I(), $("div", {
|
|
2107
|
+
key: a,
|
|
2015
2108
|
class: "vue-window-gird-virtual-scroll__item",
|
|
2016
|
-
style:
|
|
2109
|
+
style: N({ height: `${H.value}px` }),
|
|
2017
2110
|
role: "listitem",
|
|
2018
|
-
"aria-posinset":
|
|
2019
|
-
"aria-setsize":
|
|
2111
|
+
"aria-posinset": t + 1,
|
|
2112
|
+
"aria-setsize": l.items.length
|
|
2020
2113
|
}, [
|
|
2021
|
-
|
|
2114
|
+
ce(_.$slots, "default", {
|
|
2022
2115
|
item: s,
|
|
2023
|
-
index:
|
|
2024
|
-
rowIndex:
|
|
2025
|
-
columnIndex:
|
|
2116
|
+
index: t,
|
|
2117
|
+
rowIndex: g,
|
|
2118
|
+
columnIndex: b
|
|
2026
2119
|
})
|
|
2027
|
-
], 12,
|
|
2120
|
+
], 12, Vt))), 128))
|
|
2028
2121
|
], 4),
|
|
2029
|
-
|
|
2122
|
+
l.loading ? (I(), $("div", {
|
|
2030
2123
|
key: 0,
|
|
2031
2124
|
class: "vue-window-gird-virtual-scroll__loading",
|
|
2032
|
-
style:
|
|
2033
|
-
height: `${
|
|
2034
|
-
transform: `translateY(${
|
|
2125
|
+
style: N({
|
|
2126
|
+
height: `${Y.value}px`,
|
|
2127
|
+
transform: `translateY(${de.value}px)`
|
|
2035
2128
|
}),
|
|
2036
2129
|
role: "status",
|
|
2037
2130
|
"aria-live": "polite"
|
|
2038
2131
|
}, [
|
|
2039
|
-
|
|
2040
|
-
|
|
2132
|
+
ce(_.$slots, "loading", {}, () => [
|
|
2133
|
+
ee[4] || (ee[4] = Ve("Loading more…", -1))
|
|
2041
2134
|
])
|
|
2042
|
-
], 4)) :
|
|
2043
|
-
], 4)) : (
|
|
2135
|
+
], 4)) : ze("", !0)
|
|
2136
|
+
], 4)) : (I(), $("div", {
|
|
2044
2137
|
key: 2,
|
|
2045
2138
|
class: "vue-window-gird-virtual-scroll__empty",
|
|
2046
|
-
style:
|
|
2139
|
+
style: N({ transform: `translateY(${c(D)}px)` })
|
|
2047
2140
|
}, [
|
|
2048
|
-
|
|
2141
|
+
ce(_.$slots, "empty")
|
|
2049
2142
|
], 4))
|
|
2050
|
-
], 42,
|
|
2143
|
+
], 42, Bt));
|
|
2051
2144
|
}
|
|
2052
|
-
}),
|
|
2053
|
-
install(
|
|
2054
|
-
|
|
2145
|
+
}), Rt = et, Kt = {
|
|
2146
|
+
install(l) {
|
|
2147
|
+
l.component("ChatVirtualScroll", st), l.component("DynamicVirtualScroll", et), l.component("ShortMediaFeed", mt), l.component("SkeletonLoader", Mt), l.component("VirtualCarousel", St), l.component("VirtualList", Rt), l.component("VirtualScroll", $t), l.component(
|
|
2055
2148
|
"WindowDynamicVirtualScroll",
|
|
2056
|
-
|
|
2057
|
-
),
|
|
2149
|
+
Lt
|
|
2150
|
+
), l.component(
|
|
2058
2151
|
"WindowGirdVirtualScroll",
|
|
2059
|
-
|
|
2152
|
+
Ht
|
|
2060
2153
|
);
|
|
2061
2154
|
}
|
|
2062
2155
|
};
|
|
2063
2156
|
export {
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2157
|
+
st as ChatVirtualScroll,
|
|
2158
|
+
et as DynamicVirtualScroll,
|
|
2159
|
+
mt as ShortMediaFeed,
|
|
2160
|
+
Mt as SkeletonLoader,
|
|
2161
|
+
St as VirtualCarousel,
|
|
2162
|
+
Rt as VirtualList,
|
|
2163
|
+
$t as VirtualScroll,
|
|
2164
|
+
Kt as VueVirtualScroll,
|
|
2165
|
+
Lt as WindowDynamicVirtualScroll,
|
|
2166
|
+
Ht as WindowGirdVirtualScroll,
|
|
2167
|
+
Kt as default
|
|
2075
2168
|
};
|