vue-virtual-flow 0.1.0 → 0.1.1
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/CHANGELOG.md +5 -0
- package/README.md +6 -0
- package/README.vi.md +5 -0
- package/dist/components/VirtualCarousel.d.cts +1 -0
- package/dist/components/VirtualCarousel.d.ts +1 -0
- package/dist/composables/useCarouselInteraction.d.cts +2 -0
- package/dist/composables/useCarouselInteraction.d.ts +2 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.ts +2 -0
- package/dist/vue-virtual-flow.cjs +1 -1
- package/dist/vue-virtual-flow.js +1549 -1532
- package/package.json +1 -1
package/dist/vue-virtual-flow.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { watch as
|
|
1
|
+
import { watch as ye, ref as X, defineComponent as tt, computed as h, shallowRef as ft, nextTick as Z, onMounted as at, onUpdated as $t, onBeforeUnmount as Xe, openBlock as j, createElementBlock as U, normalizeStyle as re, createElementVNode as rt, mergeProps as Ot, unref as f, renderSlot as Se, createTextVNode as Ge, createCommentVNode as Re, Fragment as et, renderList as nt, toDisplayString as ht, normalizeClass as st } from "vue";
|
|
2
2
|
function At(t) {
|
|
3
3
|
return typeof t == "string" || typeof t == "number" || typeof t == "symbol";
|
|
4
4
|
}
|
|
@@ -9,38 +9,38 @@ function zt(t, s) {
|
|
|
9
9
|
function Ft(t) {
|
|
10
10
|
return zt(t, "id") ?? zt(t, "key");
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function lt(t) {
|
|
13
13
|
const s = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new Map();
|
|
14
|
-
function e(
|
|
15
|
-
if (At(
|
|
16
|
-
if (
|
|
17
|
-
let
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
let
|
|
21
|
-
return
|
|
14
|
+
function e(y) {
|
|
15
|
+
if (At(y)) return y;
|
|
16
|
+
if (y !== null && typeof y == "object") {
|
|
17
|
+
let u = s.get(y);
|
|
18
|
+
return u || (u = Symbol(`${t.componentName} item`), s.set(y, u)), u;
|
|
19
|
+
}
|
|
20
|
+
let r = I.get(y);
|
|
21
|
+
return r || (r = Symbol(`${t.componentName} primitive`), I.set(y, r)), r;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
if (typeof
|
|
26
|
-
return
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
23
|
+
function z(y, r) {
|
|
24
|
+
const u = t.itemKey();
|
|
25
|
+
if (typeof u == "function")
|
|
26
|
+
return u(y, r);
|
|
27
|
+
if (y !== null && typeof y == "object") {
|
|
28
|
+
if (u !== void 0) {
|
|
29
|
+
const M = zt(y, u);
|
|
30
|
+
if (M !== void 0) return M;
|
|
31
31
|
}
|
|
32
|
-
const n = Ft(
|
|
32
|
+
const n = Ft(y);
|
|
33
33
|
if (n !== void 0) return n;
|
|
34
34
|
}
|
|
35
|
-
return e(
|
|
35
|
+
return e(y);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function x() {
|
|
38
38
|
}
|
|
39
|
-
return
|
|
39
|
+
return ye(
|
|
40
40
|
() => [t.itemKey(), t.items(), t.items().length],
|
|
41
|
-
|
|
41
|
+
x,
|
|
42
42
|
{ immediate: !0 }
|
|
43
|
-
), { getItemKey:
|
|
43
|
+
), { getItemKey: z };
|
|
44
44
|
}
|
|
45
45
|
const Nt = /* @__PURE__ */ new Set([
|
|
46
46
|
"ArrowDown",
|
|
@@ -52,59 +52,59 @@ const Nt = /* @__PURE__ */ new Set([
|
|
|
52
52
|
" "
|
|
53
53
|
]);
|
|
54
54
|
function Yt(t) {
|
|
55
|
-
const s =
|
|
56
|
-
let I = !1, e = !1,
|
|
57
|
-
function
|
|
58
|
-
clearTimeout(
|
|
55
|
+
const s = X(!1);
|
|
56
|
+
let I = !1, e = !1, z;
|
|
57
|
+
function x() {
|
|
58
|
+
clearTimeout(z), z = void 0;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
60
|
+
function y($) {
|
|
61
|
+
$ !== s.value && (s.value = $, t.onChange($));
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
I || e || (
|
|
63
|
+
function r() {
|
|
64
|
+
I || e || (x(), y(!1), t.onSettled());
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
66
|
+
function u() {
|
|
67
|
+
x(), (s.value || t.hasProgrammaticScroll()) && !I && !e && (z = setTimeout(r, t.delay()));
|
|
68
68
|
}
|
|
69
69
|
function n() {
|
|
70
|
-
t.onInterrupt(),
|
|
70
|
+
t.onInterrupt(), x(), y(!0), t.onStart();
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function M() {
|
|
73
73
|
I = !0, n();
|
|
74
74
|
}
|
|
75
|
-
function $
|
|
76
|
-
I =
|
|
75
|
+
function R($) {
|
|
76
|
+
I = $.touches.length > 0, u();
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
n(),
|
|
78
|
+
function D() {
|
|
79
|
+
n(), u();
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
t.onInterrupt(), Nt.has(
|
|
81
|
+
function b($) {
|
|
82
|
+
t.onInterrupt(), Nt.has($.key) && (n(), u());
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
t.onInterrupt(),
|
|
84
|
+
function A($) {
|
|
85
|
+
t.onInterrupt(), $.pointerType === "mouse" && $.target === t.viewport() && (e = !0, n());
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
e && (e = !1,
|
|
87
|
+
function C() {
|
|
88
|
+
e && (e = !1, u());
|
|
89
89
|
}
|
|
90
90
|
return {
|
|
91
91
|
isScrolling: s,
|
|
92
|
-
setScrolling:
|
|
93
|
-
scheduleScrollEnd:
|
|
94
|
-
handleScrollEnd:
|
|
95
|
-
handleTouchStart:
|
|
96
|
-
handleTouchEnd:
|
|
97
|
-
handleWheel:
|
|
98
|
-
handleKeyDown:
|
|
99
|
-
handlePointerDown:
|
|
100
|
-
handlePointerUp:
|
|
101
|
-
dispose:
|
|
92
|
+
setScrolling: y,
|
|
93
|
+
scheduleScrollEnd: u,
|
|
94
|
+
handleScrollEnd: r,
|
|
95
|
+
handleTouchStart: M,
|
|
96
|
+
handleTouchEnd: R,
|
|
97
|
+
handleWheel: D,
|
|
98
|
+
handleKeyDown: b,
|
|
99
|
+
handlePointerDown: A,
|
|
100
|
+
handlePointerUp: C,
|
|
101
|
+
dispose: x
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function gt(t) {
|
|
105
105
|
return t === "fill" ? "100%" : typeof t == "number" ? `${t}px` : t;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function Mt(t) {
|
|
108
108
|
return (s, I) => {
|
|
109
109
|
typeof I == "string" && (I === "fill" || I.trim().endsWith("%"));
|
|
110
110
|
};
|
|
@@ -112,122 +112,122 @@ function wt(t) {
|
|
|
112
112
|
function Ne(t) {
|
|
113
113
|
return (t == null ? void 0 : t.count) ?? 0;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function vt(t) {
|
|
116
116
|
return (t == null ? void 0 : t.total) ?? 0;
|
|
117
117
|
}
|
|
118
118
|
function kt(t) {
|
|
119
|
-
t.count = 1 + Ne(t.left) + Ne(t.right), t.total = t.size +
|
|
119
|
+
t.count = 1 + Ne(t.left) + Ne(t.right), t.total = t.size + vt(t.left) + vt(t.right), t.left && (t.left.parent = t), t.right && (t.right.parent = t);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
return t ? s ? t.priority < s.priority ? (t.right =
|
|
121
|
+
function mt(t, s) {
|
|
122
|
+
return t ? s ? t.priority < s.priority ? (t.right = mt(t.right, s), kt(t), t) : (s.left = mt(t, s.left), kt(s), s) : t : s;
|
|
123
123
|
}
|
|
124
124
|
function jt(t) {
|
|
125
125
|
let s, I = 0;
|
|
126
126
|
const e = /* @__PURE__ */ new Map();
|
|
127
|
-
function
|
|
127
|
+
function z(u) {
|
|
128
128
|
const n = /* @__PURE__ */ new Set();
|
|
129
|
-
for (const
|
|
130
|
-
if (e.has(
|
|
129
|
+
for (const M of u) {
|
|
130
|
+
if (e.has(M.key) || n.has(M.key))
|
|
131
131
|
throw new Error(
|
|
132
|
-
`[vue-virtual-flow] Duplicate item key \`${String(
|
|
132
|
+
`[vue-virtual-flow] Duplicate item key \`${String(M.key)}\`. ChatVirtualScroll requires a unique stable key for every message.`
|
|
133
133
|
);
|
|
134
|
-
n.add(
|
|
134
|
+
n.add(M.key);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function x(u) {
|
|
138
138
|
I += 1;
|
|
139
139
|
let n = Math.imul(I ^ 2654435769, 2246822507);
|
|
140
140
|
n ^= n >>> 13, n = Math.imul(n, 3266489909) ^ n >>> 16;
|
|
141
|
-
const
|
|
142
|
-
key:
|
|
143
|
-
size:
|
|
141
|
+
const M = {
|
|
142
|
+
key: u.key,
|
|
143
|
+
size: u.size,
|
|
144
144
|
priority: n >>> 0,
|
|
145
145
|
count: 1,
|
|
146
|
-
total:
|
|
146
|
+
total: u.size
|
|
147
147
|
};
|
|
148
|
-
return e.set(
|
|
148
|
+
return e.set(u.key, M), M;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function y(u) {
|
|
151
151
|
let n;
|
|
152
|
-
for (const
|
|
152
|
+
for (const M of u) n = mt(n, x(M));
|
|
153
153
|
return n && (n.parent = void 0), n;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
let n = s,
|
|
155
|
+
function r(u) {
|
|
156
|
+
let n = s, M = u;
|
|
157
157
|
for (; n; ) {
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
158
|
+
const R = Ne(n.left);
|
|
159
|
+
if (M < R) n = n.left;
|
|
160
160
|
else {
|
|
161
|
-
if (
|
|
162
|
-
|
|
161
|
+
if (M === R) return n;
|
|
162
|
+
M -= R + 1, n = n.right;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
return
|
|
166
|
+
return z(t), s = y(t), {
|
|
167
167
|
get length() {
|
|
168
168
|
return Ne(s);
|
|
169
169
|
},
|
|
170
170
|
get total() {
|
|
171
|
-
return
|
|
171
|
+
return vt(s);
|
|
172
172
|
},
|
|
173
|
-
getSize(
|
|
173
|
+
getSize(u) {
|
|
174
174
|
var n;
|
|
175
|
-
return ((n =
|
|
175
|
+
return ((n = r(u)) == null ? void 0 : n.size) ?? 0;
|
|
176
176
|
},
|
|
177
|
-
getOffset(
|
|
178
|
-
let n = s,
|
|
179
|
-
for (; n &&
|
|
180
|
-
const
|
|
181
|
-
|
|
177
|
+
getOffset(u) {
|
|
178
|
+
let n = s, M = Math.max(0, Math.min(u, Ne(s))), R = 0;
|
|
179
|
+
for (; n && M > 0; ) {
|
|
180
|
+
const D = Ne(n.left);
|
|
181
|
+
M <= D ? n = n.left : (R += vt(n.left) + n.size, M -= D + 1, n = n.right);
|
|
182
182
|
}
|
|
183
|
-
return
|
|
183
|
+
return R;
|
|
184
184
|
},
|
|
185
|
-
setSize(
|
|
186
|
-
let
|
|
187
|
-
if (!(!
|
|
188
|
-
for (
|
|
189
|
-
kt(
|
|
185
|
+
setSize(u, n) {
|
|
186
|
+
let M = r(u);
|
|
187
|
+
if (!(!M || M.size === n))
|
|
188
|
+
for (M.size = n; M; )
|
|
189
|
+
kt(M), M = M.parent;
|
|
190
190
|
},
|
|
191
|
-
findIndex(
|
|
192
|
-
if (!s ||
|
|
193
|
-
if (
|
|
194
|
-
let n = s,
|
|
191
|
+
findIndex(u) {
|
|
192
|
+
if (!s || u <= 0) return 0;
|
|
193
|
+
if (u >= s.total) return s.count - 1;
|
|
194
|
+
let n = s, M = 0, R = u;
|
|
195
195
|
for (; n; ) {
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
196
|
+
const D = vt(n.left), b = Ne(n.left);
|
|
197
|
+
if (R < D)
|
|
198
198
|
n = n.left;
|
|
199
199
|
else {
|
|
200
|
-
if (
|
|
201
|
-
return
|
|
202
|
-
|
|
200
|
+
if (R < D + n.size)
|
|
201
|
+
return M + b;
|
|
202
|
+
R -= D + n.size, M += b + 1, n = n.right;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
return Math.max(0, Ne(s) - 1);
|
|
206
206
|
},
|
|
207
|
-
getKey(
|
|
207
|
+
getKey(u) {
|
|
208
208
|
var n;
|
|
209
|
-
return (n =
|
|
209
|
+
return (n = r(u)) == null ? void 0 : n.key;
|
|
210
210
|
},
|
|
211
|
-
getIndex(
|
|
212
|
-
let n = e.get(
|
|
211
|
+
getIndex(u) {
|
|
212
|
+
let n = e.get(u);
|
|
213
213
|
if (!n) return;
|
|
214
|
-
let
|
|
214
|
+
let M = Ne(n.left);
|
|
215
215
|
for (; n.parent; )
|
|
216
|
-
n === n.parent.right && (
|
|
217
|
-
return n === s ?
|
|
216
|
+
n === n.parent.right && (M += Ne(n.parent.left) + 1), n = n.parent;
|
|
217
|
+
return n === s ? M : void 0;
|
|
218
218
|
},
|
|
219
|
-
getSizeByKey(
|
|
219
|
+
getSizeByKey(u) {
|
|
220
220
|
var n;
|
|
221
|
-
return (n = e.get(
|
|
221
|
+
return (n = e.get(u)) == null ? void 0 : n.size;
|
|
222
222
|
},
|
|
223
|
-
hasKey(
|
|
224
|
-
return e.has(
|
|
223
|
+
hasKey(u) {
|
|
224
|
+
return e.has(u);
|
|
225
225
|
},
|
|
226
|
-
append(
|
|
227
|
-
|
|
226
|
+
append(u) {
|
|
227
|
+
u.length !== 0 && (z(u), s = mt(s, y(u)), s && (s.parent = void 0));
|
|
228
228
|
},
|
|
229
|
-
prepend(
|
|
230
|
-
|
|
229
|
+
prepend(u) {
|
|
230
|
+
u.length !== 0 && (z(u), s = mt(y(u), s), s && (s.parent = void 0));
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
}
|
|
@@ -240,7 +240,7 @@ const Ut = ["aria-label", "aria-live"], qt = {
|
|
|
240
240
|
key: 0,
|
|
241
241
|
class: "vue-chat-virtual-scroll__new-items",
|
|
242
242
|
role: "status"
|
|
243
|
-
}, Zt = /* @__PURE__ */
|
|
243
|
+
}, Zt = /* @__PURE__ */ tt({
|
|
244
244
|
name: "ChatVirtualScroll",
|
|
245
245
|
inheritAttrs: !1,
|
|
246
246
|
__name: "ChatVirtualScroll",
|
|
@@ -272,320 +272,320 @@ const Ut = ["aria-label", "aria-live"], qt = {
|
|
|
272
272
|
},
|
|
273
273
|
emits: ["scroll", "loadOlder", "bottomChange", "scrollingChange", "newItemsChange", "visibleChange"],
|
|
274
274
|
setup(t, { expose: s, emit: I }) {
|
|
275
|
-
const e = t,
|
|
276
|
-
let
|
|
277
|
-
const
|
|
275
|
+
const e = t, z = I, x = X(), y = X(0), r = X(0), u = X(0), n = X(0), M = X(!0), R = X(0), D = X(), b = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Set();
|
|
276
|
+
let $, B, V = -1, G = !1, Y = 0, se = !1, H = 0, ae, ne, le, ie = 0;
|
|
277
|
+
const te = Mt(), { getItemKey: ue } = lt({
|
|
278
278
|
componentName: "ChatVirtualScroll",
|
|
279
279
|
items: () => e.items,
|
|
280
280
|
itemKey: () => e.itemKey
|
|
281
|
-
}),
|
|
281
|
+
}), fe = h(
|
|
282
282
|
() => Number.isFinite(e.estimatedItemSize) ? Math.max(1, e.estimatedItemSize) : 48
|
|
283
|
-
),
|
|
283
|
+
), he = h(() => Math.max(0, Math.floor(e.overscan))), ve = h(
|
|
284
284
|
() => Number.isFinite(e.scrollEndDelay) ? Math.max(0, e.scrollEndDelay) : 150
|
|
285
285
|
), {
|
|
286
|
-
isScrolling:
|
|
287
|
-
setScrolling:
|
|
288
|
-
scheduleScrollEnd:
|
|
289
|
-
handleScrollEnd:
|
|
290
|
-
handleTouchStart:
|
|
291
|
-
handleTouchEnd:
|
|
292
|
-
handleWheel:
|
|
293
|
-
handleKeyDown:
|
|
294
|
-
handlePointerDown:
|
|
295
|
-
handlePointerUp:
|
|
296
|
-
dispose:
|
|
286
|
+
isScrolling: J,
|
|
287
|
+
setScrolling: O,
|
|
288
|
+
scheduleScrollEnd: S,
|
|
289
|
+
handleScrollEnd: P,
|
|
290
|
+
handleTouchStart: oe,
|
|
291
|
+
handleTouchEnd: me,
|
|
292
|
+
handleWheel: Ae,
|
|
293
|
+
handleKeyDown: E,
|
|
294
|
+
handlePointerDown: F,
|
|
295
|
+
handlePointerUp: _,
|
|
296
|
+
dispose: pe
|
|
297
297
|
} = Yt({
|
|
298
|
-
delay: () =>
|
|
299
|
-
viewport: () =>
|
|
300
|
-
hasProgrammaticScroll: () =>
|
|
301
|
-
onInterrupt:
|
|
298
|
+
delay: () => ve.value,
|
|
299
|
+
viewport: () => x.value,
|
|
300
|
+
hasProgrammaticScroll: () => le !== void 0,
|
|
301
|
+
onInterrupt: $e,
|
|
302
302
|
onStart: () => {
|
|
303
|
-
|
|
303
|
+
r.value = Y;
|
|
304
304
|
},
|
|
305
305
|
onSettled: () => {
|
|
306
|
-
const o =
|
|
307
|
-
if (
|
|
306
|
+
const o = le;
|
|
307
|
+
if (le = void 0, o) {
|
|
308
308
|
o();
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
|
|
311
|
+
y.value = L(), xe();
|
|
312
312
|
},
|
|
313
313
|
onChange: (o) => {
|
|
314
|
-
G &&
|
|
314
|
+
G && z("scrollingChange", o);
|
|
315
315
|
}
|
|
316
|
-
}),
|
|
316
|
+
}), ze = h(
|
|
317
317
|
() => Number.isFinite(e.maxPinnedItems) ? Math.max(0, Math.floor(e.maxPinnedItems)) : 20
|
|
318
|
-
), be =
|
|
318
|
+
), be = h(
|
|
319
319
|
() => e.size !== void 0 && Number.isFinite(e.size) && e.size > 0 ? Math.max(1, Math.floor(e.size)) : void 0
|
|
320
|
-
),
|
|
321
|
-
function
|
|
322
|
-
var
|
|
323
|
-
const
|
|
324
|
-
return Number.isFinite(
|
|
320
|
+
), Me = h(() => u.value > 0 ? u.value : typeof e.height == "number" ? Math.max(0, e.height) : fe.value);
|
|
321
|
+
function ce(o, c) {
|
|
322
|
+
var N;
|
|
323
|
+
const p = (N = e.estimateItemSize) == null ? void 0 : N.call(e, o, c);
|
|
324
|
+
return Number.isFinite(p) && (p ?? 0) > 0 ? p : fe.value;
|
|
325
325
|
}
|
|
326
326
|
function de(o) {
|
|
327
|
-
return jt(e.items.map((
|
|
328
|
-
const
|
|
327
|
+
return jt(e.items.map((c, p) => {
|
|
328
|
+
const N = ue(c, p);
|
|
329
329
|
return {
|
|
330
|
-
key:
|
|
331
|
-
size:
|
|
330
|
+
key: N,
|
|
331
|
+
size: b.has(N) ? (o == null ? void 0 : o.getSizeByKey(N)) ?? ce(c, p) : ce(c, p)
|
|
332
332
|
};
|
|
333
333
|
}));
|
|
334
334
|
}
|
|
335
|
-
const v =
|
|
336
|
-
function
|
|
337
|
-
return Math.max(0, o -
|
|
335
|
+
const v = ft({ sizes: de() }), T = h(() => (n.value, { sizes: v.value.sizes, total: v.value.sizes.total }));
|
|
336
|
+
function i(o = T.value.total) {
|
|
337
|
+
return Math.max(0, o - Me.value);
|
|
338
338
|
}
|
|
339
339
|
function q(o) {
|
|
340
340
|
return T.value.sizes.findIndex(o);
|
|
341
341
|
}
|
|
342
|
-
|
|
343
|
-
const Q =
|
|
342
|
+
y.value = e.initialScroll === "bottom" ? i() : 0;
|
|
343
|
+
const Q = h(() => {
|
|
344
344
|
if (e.items.length === 0) return { start: 0, end: 0 };
|
|
345
|
-
const o = q(
|
|
345
|
+
const o = q(y.value), c = q(y.value + Me.value) + 1;
|
|
346
346
|
return {
|
|
347
347
|
start: o,
|
|
348
|
-
end: Math.min(e.items.length,
|
|
348
|
+
end: Math.min(e.items.length, c)
|
|
349
349
|
};
|
|
350
|
-
}),
|
|
350
|
+
}), ke = h(() => {
|
|
351
351
|
if (e.items.length === 0) return { start: 0, end: 0 };
|
|
352
|
-
const o = Q.value.start,
|
|
352
|
+
const o = Q.value.start, c = Q.value.end, p = Math.max(0, o - he.value), N = Math.min(
|
|
353
353
|
e.items.length,
|
|
354
|
-
|
|
354
|
+
c + he.value
|
|
355
355
|
), Pe = be.value;
|
|
356
|
-
if (Pe === void 0 ||
|
|
357
|
-
const
|
|
358
|
-
let Fe = Math.min(
|
|
359
|
-
const
|
|
360
|
-
return Fe = Math.min(
|
|
361
|
-
}),
|
|
356
|
+
if (Pe === void 0 || N - p <= Pe) return { start: p, end: N };
|
|
357
|
+
const Ce = Math.max(0, Pe - (c - o)), Ve = o - p, Oe = N - c;
|
|
358
|
+
let Fe = Math.min(Ve, Math.ceil(Ce / 2));
|
|
359
|
+
const Je = Math.min(Oe, Ce - Fe);
|
|
360
|
+
return Fe = Math.min(Ve, Ce - Je), { start: o - Fe, end: c + Je };
|
|
361
|
+
}), ge = h(() => ke.value.start), Ee = h(() => ke.value.end), d = h(() => {
|
|
362
362
|
const o = /* @__PURE__ */ new Set();
|
|
363
|
-
for (let
|
|
364
|
-
o.add(
|
|
365
|
-
for (const
|
|
366
|
-
const
|
|
367
|
-
|
|
363
|
+
for (let c = ge.value; c < Ee.value; c += 1)
|
|
364
|
+
o.add(c);
|
|
365
|
+
for (const c of e.pinnedKeys.slice(0, ze.value)) {
|
|
366
|
+
const p = v.value.sizes.getIndex(c);
|
|
367
|
+
p !== void 0 && o.add(p);
|
|
368
368
|
}
|
|
369
|
-
if (e.keepFocusedItem &&
|
|
370
|
-
const
|
|
371
|
-
|
|
369
|
+
if (e.keepFocusedItem && D.value !== void 0) {
|
|
370
|
+
const c = v.value.sizes.getIndex(D.value);
|
|
371
|
+
c !== void 0 && o.add(c);
|
|
372
372
|
}
|
|
373
|
-
return [...o].sort((
|
|
374
|
-
}),
|
|
375
|
-
const
|
|
373
|
+
return [...o].sort((c, p) => c - p);
|
|
374
|
+
}), K = h(() => d.value.map((o) => {
|
|
375
|
+
const c = e.items[o];
|
|
376
376
|
return {
|
|
377
|
-
item:
|
|
377
|
+
item: c,
|
|
378
378
|
index: o,
|
|
379
|
-
key:
|
|
380
|
-
bottom: Math.max(T.value.total,
|
|
379
|
+
key: ue(c, o),
|
|
380
|
+
bottom: Math.max(T.value.total, Me.value) - T.value.sizes.getOffset(o + 1) + r.value
|
|
381
381
|
};
|
|
382
|
-
})),
|
|
383
|
-
height:
|
|
384
|
-
})),
|
|
382
|
+
})), m = h(() => ({
|
|
383
|
+
height: gt(e.height)
|
|
384
|
+
})), w = h(() => ({
|
|
385
385
|
"vue-chat-virtual-scroll--contained": e.contain
|
|
386
|
-
})), k =
|
|
387
|
-
function
|
|
388
|
-
var
|
|
389
|
-
return ((
|
|
390
|
-
}
|
|
391
|
-
function
|
|
392
|
-
var
|
|
393
|
-
const
|
|
394
|
-
return Math.max(0, Math.min(
|
|
395
|
-
}
|
|
396
|
-
function
|
|
397
|
-
if (
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
if (
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
!
|
|
386
|
+
})), k = h(() => M.value && !J.value ? "polite" : "off");
|
|
387
|
+
function ee(o) {
|
|
388
|
+
var c;
|
|
389
|
+
return ((c = e.newItemsLabel) == null ? void 0 : c.call(e, o)) ?? `${o} new ${o === 1 ? "message" : "messages"}`;
|
|
390
|
+
}
|
|
391
|
+
function L(o = T.value.total) {
|
|
392
|
+
var N;
|
|
393
|
+
const c = i(o), p = Math.min(0, ((N = x.value) == null ? void 0 : N.scrollTop) ?? 0);
|
|
394
|
+
return Math.max(0, Math.min(c, c + p + Y));
|
|
395
|
+
}
|
|
396
|
+
function xe(o = !1) {
|
|
397
|
+
if (se || (J.value || le) && !o || Y === 0) return;
|
|
398
|
+
se = !0;
|
|
399
|
+
const c = ie, p = ++H;
|
|
400
|
+
r.value = 0, Z(() => {
|
|
401
|
+
if (p !== H) return;
|
|
402
|
+
se = !1;
|
|
403
|
+
const N = x.value;
|
|
404
|
+
!N || c !== ie || Y === 0 || (Y = 0, N.scrollTop = Math.min(0, y.value - i()), ne = N.scrollTop, y.value = L(), a(), W());
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
|
-
function
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
410
|
-
if (
|
|
411
|
-
|
|
407
|
+
function we(o) {
|
|
408
|
+
const c = x.value;
|
|
409
|
+
if (c) {
|
|
410
|
+
if (Y += o, y.value = L(), Y === 0 || i() === 0) {
|
|
411
|
+
Y = 0, r.value = 0;
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
414
|
-
(
|
|
414
|
+
(J.value || le) && !se ? (r.value = Y, c.scrollTop >= -1 && xe(!0)) : xe();
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
function
|
|
418
|
-
|
|
417
|
+
function $e() {
|
|
418
|
+
ae = void 0, le = void 0;
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function De() {
|
|
421
421
|
if (!e.keepFocusedItem) {
|
|
422
|
-
|
|
422
|
+
D.value = void 0;
|
|
423
423
|
return;
|
|
424
424
|
}
|
|
425
|
-
const o = document.activeElement,
|
|
426
|
-
|
|
425
|
+
const o = document.activeElement, c = o instanceof Element ? o.closest(".vue-chat-virtual-scroll__item") : null;
|
|
426
|
+
D.value = c ? A.get(c) : void 0;
|
|
427
427
|
}
|
|
428
|
-
function
|
|
429
|
-
|
|
428
|
+
function Ie() {
|
|
429
|
+
De();
|
|
430
430
|
}
|
|
431
|
-
function
|
|
432
|
-
Z(
|
|
431
|
+
function Ye() {
|
|
432
|
+
Z(De);
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
const
|
|
436
|
-
|
|
434
|
+
function je(o) {
|
|
435
|
+
const c = Math.max(0, Math.floor(o));
|
|
436
|
+
c !== R.value && (R.value = c, G && z("newItemsChange", c));
|
|
437
437
|
}
|
|
438
|
-
function
|
|
439
|
-
|
|
438
|
+
function Ze() {
|
|
439
|
+
je(0);
|
|
440
440
|
}
|
|
441
|
-
function
|
|
442
|
-
|
|
443
|
-
scrollTop:
|
|
441
|
+
function ut() {
|
|
442
|
+
z("visibleChange", {
|
|
443
|
+
scrollTop: L(),
|
|
444
444
|
startIndex: Q.value.start,
|
|
445
445
|
endIndex: Q.value.end
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
448
|
function a() {
|
|
449
|
-
const o =
|
|
449
|
+
const o = x.value;
|
|
450
450
|
if (!o) return;
|
|
451
|
-
const
|
|
451
|
+
const p = Math.max(
|
|
452
452
|
0,
|
|
453
|
-
T.value.total -
|
|
453
|
+
T.value.total - L() - o.clientHeight
|
|
454
454
|
) <= Math.max(0, e.bottomThreshold);
|
|
455
|
-
|
|
455
|
+
p !== M.value && (M.value = p, G && z("bottomChange", p)), p && Ze();
|
|
456
456
|
}
|
|
457
457
|
function l() {
|
|
458
458
|
var o;
|
|
459
|
-
|
|
460
|
-
a(),
|
|
459
|
+
u.value = ((o = x.value) == null ? void 0 : o.clientHeight) ?? 0, G && (y.value = L()), te(x.value, e.height), Z(() => {
|
|
460
|
+
a(), W();
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
function g() {
|
|
464
|
-
var o,
|
|
465
|
-
|
|
466
|
-
scrollTop:
|
|
467
|
-
startIndex:
|
|
468
|
-
endIndex:
|
|
469
|
-
}),
|
|
464
|
+
var o, c;
|
|
465
|
+
ae && ne !== void 0 && Math.abs((((o = x.value) == null ? void 0 : o.scrollTop) ?? 0) - ne) > 1 && $e(), y.value = L(), Y !== 0 && (((c = x.value) == null ? void 0 : c.scrollTop) ?? 0) >= -1 && xe(!0), S(), a(), z("scroll", {
|
|
466
|
+
scrollTop: y.value,
|
|
467
|
+
startIndex: ge.value,
|
|
468
|
+
endIndex: Ee.value
|
|
469
|
+
}), W();
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
const o =
|
|
473
|
-
!G || !o || !e.hasOlder || e.loadingOlder ||
|
|
471
|
+
function W() {
|
|
472
|
+
const o = x.value;
|
|
473
|
+
!G || !o || !e.hasOlder || e.loadingOlder || V === e.items.length || L() <= Math.max(0, e.loadOlderThreshold) && (V = e.items.length, z("loadOlder"));
|
|
474
474
|
}
|
|
475
475
|
function Te(o) {
|
|
476
|
-
const
|
|
477
|
-
if (
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
476
|
+
const c = o.borderBoxSize;
|
|
477
|
+
if (c) {
|
|
478
|
+
const p = Array.isArray(c) ? c[0] : c;
|
|
479
|
+
if (p != null && p.blockSize) return p.blockSize;
|
|
480
480
|
}
|
|
481
481
|
return o.contentRect.height;
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
const
|
|
485
|
-
let
|
|
486
|
-
for (const { key:
|
|
487
|
-
if (!Number.isFinite(
|
|
488
|
-
const
|
|
489
|
-
if (
|
|
490
|
-
const
|
|
491
|
-
|
|
483
|
+
function Ke(o) {
|
|
484
|
+
const c = T.value.total, p = L(), N = !J.value && !le && M.value && e.stickToBottom && (G || e.initialScroll === "bottom"), Pe = q(p + Me.value - 1), Ce = !N && p <= 0;
|
|
485
|
+
let Ve = 0, Oe = !1;
|
|
486
|
+
for (const { key: yt, height: Qe } of o) {
|
|
487
|
+
if (!Number.isFinite(Qe) || Qe <= 0) continue;
|
|
488
|
+
const Ue = v.value.sizes.getIndex(yt);
|
|
489
|
+
if (Ue === void 0) continue;
|
|
490
|
+
const _e = T.value.sizes.getSize(Ue);
|
|
491
|
+
b.add(yt), !(Math.abs(_e - Qe) < 0.5) && (Ue <= Pe && (Ve += Qe - _e), T.value.sizes.setSize(Ue, Qe), Oe = !0);
|
|
492
492
|
}
|
|
493
|
-
if (!
|
|
493
|
+
if (!Oe) return;
|
|
494
494
|
n.value += 1;
|
|
495
|
-
const Fe =
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
function
|
|
499
|
-
const
|
|
500
|
-
for (const
|
|
501
|
-
const
|
|
502
|
-
|
|
495
|
+
const Fe = i() - i(c), Je = ae && v.value.sizes.getIndex(ae.key), bt = Je !== void 0 && ae ? Ct(Je, ae.align) : N ? i() : Ce ? 0 : p + Ve;
|
|
496
|
+
we(bt - p - Fe), Z(a);
|
|
497
|
+
}
|
|
498
|
+
function Be(o) {
|
|
499
|
+
const c = [];
|
|
500
|
+
for (const p of o) {
|
|
501
|
+
const N = A.get(p.target);
|
|
502
|
+
N !== void 0 && c.push({ key: N, height: Te(p) });
|
|
503
503
|
}
|
|
504
|
-
|
|
504
|
+
Ke(c);
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function He() {
|
|
507
507
|
const o = [];
|
|
508
|
-
for (const
|
|
509
|
-
const
|
|
510
|
-
|
|
508
|
+
for (const c of C) {
|
|
509
|
+
const p = A.get(c);
|
|
510
|
+
p !== void 0 && c.isConnected && o.push({ key: p, height: c.getBoundingClientRect().height });
|
|
511
511
|
}
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
function
|
|
515
|
-
o instanceof HTMLElement &&
|
|
516
|
-
}
|
|
517
|
-
function
|
|
518
|
-
for (const [o] of
|
|
519
|
-
o.isConnected || (B == null || B.unobserve(o),
|
|
520
|
-
}
|
|
521
|
-
function
|
|
522
|
-
const
|
|
523
|
-
if (!
|
|
524
|
-
const Pe =
|
|
525
|
-
|
|
526
|
-
const
|
|
527
|
-
|
|
512
|
+
C.clear(), Ke(o);
|
|
513
|
+
}
|
|
514
|
+
function ot(o, c) {
|
|
515
|
+
o instanceof HTMLElement && A.get(o) !== c && (A.set(o, c), e.syncMeasurement && !b.has(c) && C.add(o), B == null || B.observe(o));
|
|
516
|
+
}
|
|
517
|
+
function Bt() {
|
|
518
|
+
for (const [o] of A)
|
|
519
|
+
o.isConnected || (B == null || B.unobserve(o), A.delete(o), C.delete(o));
|
|
520
|
+
}
|
|
521
|
+
function ct(o, c, p = !1) {
|
|
522
|
+
const N = x.value;
|
|
523
|
+
if (!N) return;
|
|
524
|
+
const Pe = L(), Ce = r.value !== 0, Ve = ++ie;
|
|
525
|
+
H += 1, se = !1, ae = void 0;
|
|
526
|
+
const Oe = c.behavior ?? "auto";
|
|
527
|
+
le = Oe === "smooth" ? () => Et(o) : void 0, Y = 0, r.value = 0, O(!1), pe(), Oe === "auto" && (y.value = o);
|
|
528
528
|
const Fe = () => {
|
|
529
|
-
|
|
529
|
+
x.value !== N || Ve !== ie || (Ce && Oe !== "auto" && (N.scrollTop = Pe - i()), p && Oe === "auto" ? N.scrollTop = o - i() : N.scrollTo({ ...c, top: o - i(), behavior: Oe }), ne = N.scrollTop, Oe === "auto" ? y.value = L() : S(), Z(a));
|
|
530
530
|
};
|
|
531
|
-
|
|
531
|
+
Ce ? Z(Fe) : Fe();
|
|
532
532
|
}
|
|
533
|
-
function Et(o,
|
|
534
|
-
const
|
|
535
|
-
if (!
|
|
536
|
-
const
|
|
533
|
+
function Et(o, c = {}) {
|
|
534
|
+
const p = x.value;
|
|
535
|
+
if (!p) return;
|
|
536
|
+
const N = Math.max(0, T.value.total - p.clientHeight), Pe = Math.min(
|
|
537
537
|
Math.max(0, Number.isFinite(o) ? o : 0),
|
|
538
|
-
|
|
538
|
+
N
|
|
539
539
|
);
|
|
540
|
-
|
|
540
|
+
ct(Pe, c);
|
|
541
541
|
}
|
|
542
|
-
function Ct(o,
|
|
543
|
-
const
|
|
544
|
-
let
|
|
545
|
-
return
|
|
542
|
+
function Ct(o, c) {
|
|
543
|
+
const p = T.value.sizes.getSize(o);
|
|
544
|
+
let N = T.value.sizes.getOffset(o);
|
|
545
|
+
return c === "center" ? N -= (Me.value - p) / 2 : c === "end" && (N -= Me.value - p), Math.max(0, Math.min(N, i()));
|
|
546
546
|
}
|
|
547
|
-
function Tt(o,
|
|
548
|
-
if (!
|
|
549
|
-
const
|
|
547
|
+
function Tt(o, c = {}) {
|
|
548
|
+
if (!x.value || e.items.length === 0) return;
|
|
549
|
+
const p = Math.min(
|
|
550
550
|
e.items.length - 1,
|
|
551
551
|
Math.max(0, Math.floor(Number.isFinite(o) ? o : 0))
|
|
552
|
-
), { align:
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
} :
|
|
559
|
-
}
|
|
560
|
-
function Kt(o,
|
|
561
|
-
const
|
|
562
|
-
|
|
552
|
+
), { align: N = "start", ...Pe } = c;
|
|
553
|
+
ct(Ct(p, N), Pe);
|
|
554
|
+
const Ce = v.value.sizes.getKey(p);
|
|
555
|
+
c.behavior === "smooth" ? le = () => {
|
|
556
|
+
const Ve = v.value.sizes.getIndex(Ce);
|
|
557
|
+
Ve !== void 0 && Tt(Ve, { align: N });
|
|
558
|
+
} : ae = { key: Ce, align: N };
|
|
559
|
+
}
|
|
560
|
+
function Kt(o, c = {}) {
|
|
561
|
+
const p = v.value.sizes.getIndex(o);
|
|
562
|
+
p !== void 0 && Tt(p, c);
|
|
563
563
|
}
|
|
564
564
|
function Vt() {
|
|
565
|
-
return
|
|
565
|
+
return L();
|
|
566
566
|
}
|
|
567
567
|
function Wt(o = "auto") {
|
|
568
|
-
|
|
568
|
+
ct(0, { behavior: o });
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
const
|
|
572
|
-
if (!
|
|
573
|
-
const
|
|
574
|
-
|
|
570
|
+
function pt(o = "auto") {
|
|
571
|
+
const c = x.value;
|
|
572
|
+
if (!c) return;
|
|
573
|
+
const p = Math.max(0, T.value.total - c.clientHeight);
|
|
574
|
+
ct(p, { behavior: o }, !0), o === "smooth" && (le = () => pt());
|
|
575
575
|
}
|
|
576
|
-
const Lt =
|
|
576
|
+
const Lt = X(0);
|
|
577
577
|
function Rt() {
|
|
578
578
|
Lt.value += 1;
|
|
579
579
|
}
|
|
580
|
-
return
|
|
580
|
+
return ye(
|
|
581
581
|
() => {
|
|
582
582
|
const o = e.items.length;
|
|
583
583
|
return [
|
|
584
584
|
e.items,
|
|
585
585
|
o,
|
|
586
|
-
o > 0 ?
|
|
587
|
-
o > 0 ?
|
|
588
|
-
o > 0 ?
|
|
586
|
+
o > 0 ? ue(e.items[0], 0) : void 0,
|
|
587
|
+
o > 0 ? ue(e.items[Math.floor(o / 2)], Math.floor(o / 2)) : void 0,
|
|
588
|
+
o > 0 ? ue(e.items[o - 1], o - 1) : void 0,
|
|
589
589
|
e.itemKey,
|
|
590
590
|
e.estimatedItemSize,
|
|
591
591
|
e.estimateItemSize,
|
|
@@ -593,99 +593,99 @@ const Ut = ["aria-label", "aria-live"], qt = {
|
|
|
593
593
|
Lt.value
|
|
594
594
|
];
|
|
595
595
|
},
|
|
596
|
-
async (o,
|
|
597
|
-
const
|
|
598
|
-
function
|
|
599
|
-
if (
|
|
600
|
-
const
|
|
601
|
-
for (const
|
|
602
|
-
const
|
|
603
|
-
if (
|
|
596
|
+
async (o, c) => {
|
|
597
|
+
const p = v.value.sizes, N = p.length, Pe = p.total, Ce = L(Pe), Ve = p.findIndex(Ce + Me.value - 1), Oe = p.getKey(Ve), Fe = p.getOffset(Ve + 1), Je = e.items.length, bt = o[5] !== c[5] || o[6] !== c[6] || o[7] !== c[7], yt = o[8] !== c[8] || o[9] !== c[9];
|
|
598
|
+
function Qe(Le) {
|
|
599
|
+
if (N === 0) return !0;
|
|
600
|
+
const We = /* @__PURE__ */ new Set([0, Math.floor(N / 2), N - 1]);
|
|
601
|
+
for (const it of We) {
|
|
602
|
+
const wt = Le + it;
|
|
603
|
+
if (wt >= Je || p.getKey(it) !== ue(e.items[wt], wt))
|
|
604
604
|
return !1;
|
|
605
605
|
}
|
|
606
606
|
return !0;
|
|
607
607
|
}
|
|
608
|
-
const
|
|
609
|
-
let
|
|
610
|
-
!bt && !
|
|
611
|
-
let
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
return { key:
|
|
615
|
-
})) :
|
|
616
|
-
const St =
|
|
617
|
-
(
|
|
618
|
-
var
|
|
619
|
-
return ((
|
|
608
|
+
const Ue = Je - N;
|
|
609
|
+
let _e = "rebuild";
|
|
610
|
+
!bt && !yt && Ue > 0 && (Qe(0) ? _e = "append" : Qe(Ue) && (_e = "prepend"));
|
|
611
|
+
let qe = p;
|
|
612
|
+
_e === "append" ? qe.append(e.items.slice(N).map((Le, We) => {
|
|
613
|
+
const it = N + We;
|
|
614
|
+
return { key: ue(Le, it), size: ce(Le, it) };
|
|
615
|
+
})) : _e === "prepend" ? qe.prepend(e.items.slice(0, Ue).map((Le, We) => ({ key: ue(Le, We), size: ce(Le, We) }))) : qe = de(p), v.value = { sizes: qe };
|
|
616
|
+
const St = _e === "append" ? Array.from({ length: Ue }, (Le, We) => N + We) : [], It = St.some(
|
|
617
|
+
(Le) => {
|
|
618
|
+
var We;
|
|
619
|
+
return ((We = e.forceStickToBottom) == null ? void 0 : We.call(e, e.items[Le], Le)) === !0;
|
|
620
620
|
}
|
|
621
|
-
) || !
|
|
622
|
-
St.length > 0 && !It &&
|
|
623
|
-
const Pt =
|
|
624
|
-
for (const
|
|
625
|
-
|
|
626
|
-
if (
|
|
627
|
-
|
|
628
|
-
const
|
|
629
|
-
await Z(),
|
|
621
|
+
) || !J.value && !le && M.value && e.stickToBottom;
|
|
622
|
+
St.length > 0 && !It && je(R.value + St.length);
|
|
623
|
+
const Pt = Oe === void 0 ? void 0 : qe.getIndex(Oe), Ht = i() - i(Pe);
|
|
624
|
+
for (const Le of b)
|
|
625
|
+
qe.hasKey(Le) || b.delete(Le);
|
|
626
|
+
if (qe.length === 0 || Pt === void 0) {
|
|
627
|
+
Y = 0, r.value = 0, y.value = It ? i() : Math.min(Ce, i());
|
|
628
|
+
const Le = y.value, We = ie;
|
|
629
|
+
await Z(), We === ie && v.value.sizes === qe && ct(Le, {}, !0);
|
|
630
630
|
} else {
|
|
631
|
-
const
|
|
632
|
-
|
|
631
|
+
const Le = qe.getOffset(Pt + 1) - Fe, We = It ? i() : Ce + Le;
|
|
632
|
+
we(We - Ce - Ht), await Z();
|
|
633
633
|
}
|
|
634
|
-
|
|
634
|
+
x.value && (y.value = L(), a(), W());
|
|
635
635
|
}
|
|
636
|
-
),
|
|
636
|
+
), ye(
|
|
637
637
|
() => [e.hasOlder, e.loadingOlder],
|
|
638
638
|
async ([o]) => {
|
|
639
|
-
o || (
|
|
639
|
+
o || (V = -1), await Z(), W();
|
|
640
640
|
}
|
|
641
|
-
),
|
|
641
|
+
), ye(
|
|
642
642
|
() => e.syncMeasurement,
|
|
643
643
|
(o) => {
|
|
644
|
-
if (
|
|
645
|
-
for (const [
|
|
646
|
-
|
|
647
|
-
Z(
|
|
644
|
+
if (C.clear(), !!o) {
|
|
645
|
+
for (const [c, p] of A)
|
|
646
|
+
b.has(p) || C.add(c);
|
|
647
|
+
Z(He);
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
),
|
|
650
|
+
), ye(
|
|
651
651
|
Q,
|
|
652
652
|
() => {
|
|
653
|
-
G &&
|
|
653
|
+
G && ut();
|
|
654
654
|
},
|
|
655
655
|
{ flush: "post" }
|
|
656
|
-
),
|
|
657
|
-
if (window.addEventListener("pointerup",
|
|
658
|
-
|
|
659
|
-
for (const [o] of
|
|
656
|
+
), at(() => {
|
|
657
|
+
if (window.addEventListener("pointerup", _, { passive: !0 }), window.addEventListener("pointercancel", _, { passive: !0 }), l(), x.value && (x.value.scrollTop = e.initialScroll === "bottom" ? 0 : -i(), y.value = L()), He(), typeof ResizeObserver < "u") {
|
|
658
|
+
$ = new ResizeObserver(l), B = new ResizeObserver(Be), x.value && $.observe(x.value);
|
|
659
|
+
for (const [o] of A)
|
|
660
660
|
B.observe(o);
|
|
661
661
|
}
|
|
662
662
|
Z(() => {
|
|
663
|
-
G = !0, a(),
|
|
663
|
+
G = !0, a(), W(), ut();
|
|
664
664
|
});
|
|
665
665
|
}), $t(() => {
|
|
666
|
-
|
|
667
|
-
}),
|
|
668
|
-
G = !1, window.removeEventListener("pointerup",
|
|
666
|
+
Bt(), He();
|
|
667
|
+
}), Xe(() => {
|
|
668
|
+
G = !1, window.removeEventListener("pointerup", _), window.removeEventListener("pointercancel", _), pe(), $e(), Y = 0, ie += 1, H += 1, $ && ($.disconnect(), $ = void 0), B && (B.disconnect(), B = void 0), A.clear(), C.clear();
|
|
669
669
|
}), s({
|
|
670
|
-
isAtBottom:
|
|
671
|
-
isScrolling:
|
|
672
|
-
newItemsCount:
|
|
673
|
-
clearNewItems:
|
|
670
|
+
isAtBottom: M,
|
|
671
|
+
isScrolling: J,
|
|
672
|
+
newItemsCount: R,
|
|
673
|
+
clearNewItems: Ze,
|
|
674
674
|
refresh: Rt,
|
|
675
675
|
getScrollPosition: Vt,
|
|
676
676
|
scrollTo: Et,
|
|
677
677
|
scrollToIndex: Tt,
|
|
678
678
|
scrollToKey: Kt,
|
|
679
679
|
scrollToTop: Wt,
|
|
680
|
-
scrollToBottom:
|
|
681
|
-
}), (o,
|
|
680
|
+
scrollToBottom: pt
|
|
681
|
+
}), (o, c) => (j(), U("div", {
|
|
682
682
|
class: "vue-chat-virtual-scroll__root",
|
|
683
|
-
style:
|
|
683
|
+
style: re(m.value)
|
|
684
684
|
}, [
|
|
685
|
-
|
|
685
|
+
rt("div", Ot(o.$attrs, {
|
|
686
686
|
ref_key: "viewport",
|
|
687
|
-
ref:
|
|
688
|
-
class: ["vue-chat-virtual-scroll",
|
|
687
|
+
ref: x,
|
|
688
|
+
class: ["vue-chat-virtual-scroll", w.value],
|
|
689
689
|
role: "log",
|
|
690
690
|
"aria-label": t.ariaLabel,
|
|
691
691
|
"aria-live": k.value,
|
|
@@ -693,125 +693,125 @@ const Ut = ["aria-label", "aria-live"], qt = {
|
|
|
693
693
|
"aria-atomic": "false",
|
|
694
694
|
tabindex: "0",
|
|
695
695
|
onScrollPassive: g,
|
|
696
|
-
onScrollendPassive:
|
|
697
|
-
(...
|
|
698
|
-
onPointerdownPassive:
|
|
699
|
-
(...
|
|
700
|
-
onWheelPassive:
|
|
701
|
-
(...
|
|
702
|
-
onKeydown:
|
|
703
|
-
(...
|
|
704
|
-
onFocusin:
|
|
705
|
-
onFocusout:
|
|
706
|
-
onTouchstartPassive:
|
|
707
|
-
(...
|
|
708
|
-
onTouchendPassive:
|
|
709
|
-
(...
|
|
710
|
-
onTouchcancelPassive:
|
|
711
|
-
(...
|
|
696
|
+
onScrollendPassive: c[0] || (c[0] = //@ts-ignore
|
|
697
|
+
(...p) => f(P) && f(P)(...p)),
|
|
698
|
+
onPointerdownPassive: c[1] || (c[1] = //@ts-ignore
|
|
699
|
+
(...p) => f(F) && f(F)(...p)),
|
|
700
|
+
onWheelPassive: c[2] || (c[2] = //@ts-ignore
|
|
701
|
+
(...p) => f(Ae) && f(Ae)(...p)),
|
|
702
|
+
onKeydown: c[3] || (c[3] = //@ts-ignore
|
|
703
|
+
(...p) => f(E) && f(E)(...p)),
|
|
704
|
+
onFocusin: Ie,
|
|
705
|
+
onFocusout: Ye,
|
|
706
|
+
onTouchstartPassive: c[4] || (c[4] = //@ts-ignore
|
|
707
|
+
(...p) => f(oe) && f(oe)(...p)),
|
|
708
|
+
onTouchendPassive: c[5] || (c[5] = //@ts-ignore
|
|
709
|
+
(...p) => f(me) && f(me)(...p)),
|
|
710
|
+
onTouchcancelPassive: c[6] || (c[6] = //@ts-ignore
|
|
711
|
+
(...p) => f(me) && f(me)(...p))
|
|
712
712
|
}), [
|
|
713
|
-
|
|
713
|
+
rt("div", {
|
|
714
714
|
class: "vue-chat-virtual-scroll__spacer",
|
|
715
|
-
style:
|
|
715
|
+
style: re({ height: `${Math.max(Me.value, T.value.total + r.value)}px` })
|
|
716
716
|
}, [
|
|
717
717
|
t.loadingOlder ? (j(), U("div", qt, [
|
|
718
|
-
|
|
718
|
+
rt("div", null, [
|
|
719
719
|
Se(o.$slots, "loadingOlder", {}, () => [
|
|
720
|
-
|
|
720
|
+
c[8] || (c[8] = Ge("Loading older messages…", -1))
|
|
721
721
|
])
|
|
722
722
|
])
|
|
723
|
-
])) :
|
|
724
|
-
(j(!0), U(
|
|
723
|
+
])) : Re("", !0),
|
|
724
|
+
(j(!0), U(et, null, nt(K.value, ({ item: p, index: N, key: Pe, bottom: Ce }) => (j(), U("div", {
|
|
725
725
|
key: Pe,
|
|
726
726
|
ref_for: !0,
|
|
727
|
-
ref: (
|
|
727
|
+
ref: (Ve) => ot(Ve, Pe),
|
|
728
728
|
class: "vue-chat-virtual-scroll__item",
|
|
729
|
-
style:
|
|
729
|
+
style: re({ transform: `translateY(${-Ce}px)` }),
|
|
730
730
|
role: "article",
|
|
731
|
-
"aria-posinset":
|
|
731
|
+
"aria-posinset": N + 1,
|
|
732
732
|
"aria-setsize": t.items.length
|
|
733
733
|
}, [
|
|
734
734
|
Se(o.$slots, "default", {
|
|
735
|
-
item:
|
|
736
|
-
index:
|
|
735
|
+
item: p,
|
|
736
|
+
index: N
|
|
737
737
|
})
|
|
738
738
|
], 12, Gt))), 128)),
|
|
739
|
-
t.items.length ?
|
|
739
|
+
t.items.length ? Re("", !0) : Se(o.$slots, "empty", {}, void 0, void 0, 1)
|
|
740
740
|
], 4)
|
|
741
741
|
], 16, Ut),
|
|
742
|
-
t.showNewItemsIndicator &&
|
|
742
|
+
t.showNewItemsIndicator && R.value > 0 ? (j(), U("div", Xt, [
|
|
743
743
|
Se(o.$slots, "newItems", {
|
|
744
|
-
count:
|
|
745
|
-
scrollToBottom:
|
|
744
|
+
count: R.value,
|
|
745
|
+
scrollToBottom: pt
|
|
746
746
|
}, () => [
|
|
747
|
-
|
|
747
|
+
rt("button", {
|
|
748
748
|
type: "button",
|
|
749
|
-
onClick:
|
|
750
|
-
},
|
|
749
|
+
onClick: c[7] || (c[7] = (p) => pt("smooth"))
|
|
750
|
+
}, ht(ee(R.value)), 1)
|
|
751
751
|
])
|
|
752
|
-
])) :
|
|
752
|
+
])) : Re("", !0)
|
|
753
753
|
], 4));
|
|
754
754
|
}
|
|
755
755
|
});
|
|
756
756
|
function xt(t) {
|
|
757
|
-
const s =
|
|
758
|
-
() => t.refreshing() ||
|
|
759
|
-
),
|
|
760
|
-
() => Math.min(1, I.value /
|
|
761
|
-
),
|
|
757
|
+
const s = X(), I = X(0), e = X(!1), z = X(!1), x = h(() => Math.max(1, t.threshold())), y = h(
|
|
758
|
+
() => t.refreshing() || z.value ? x.value : I.value
|
|
759
|
+
), r = h(
|
|
760
|
+
() => Math.min(1, I.value / x.value)
|
|
761
|
+
), u = h(() => t.refreshing() || z.value ? "Refreshing…" : r.value >= 1 ? "Release to refresh" : "Pull to refresh");
|
|
762
762
|
function n() {
|
|
763
763
|
s.value = void 0, e.value = !1, I.value = 0;
|
|
764
764
|
}
|
|
765
|
-
function
|
|
766
|
-
var
|
|
767
|
-
const
|
|
768
|
-
!t.enabled() || t.refreshing() ||
|
|
765
|
+
function M(b) {
|
|
766
|
+
var $;
|
|
767
|
+
const A = b.currentTarget, C = (($ = t.scrollTop) == null ? void 0 : $.call(t)) ?? A.scrollTop;
|
|
768
|
+
!t.enabled() || t.refreshing() || C > 0 || b.touches.length !== 1 || (s.value = b.touches[0].clientY, e.value = !0);
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function R(b) {
|
|
771
771
|
var B;
|
|
772
772
|
if (s.value === void 0 || !e.value) return;
|
|
773
|
-
const
|
|
774
|
-
if ((((B = t.scrollTop) == null ? void 0 : B.call(t)) ??
|
|
773
|
+
const A = b.currentTarget;
|
|
774
|
+
if ((((B = t.scrollTop) == null ? void 0 : B.call(t)) ?? A.scrollTop) > 0 || b.touches.length !== 1) {
|
|
775
775
|
n();
|
|
776
776
|
return;
|
|
777
777
|
}
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
778
|
+
const $ = b.touches[0].clientY - s.value;
|
|
779
|
+
if ($ <= 0) {
|
|
780
780
|
I.value = 0;
|
|
781
781
|
return;
|
|
782
782
|
}
|
|
783
|
-
|
|
783
|
+
b.preventDefault(), I.value = Math.min($ * 0.5, x.value * 2);
|
|
784
784
|
}
|
|
785
|
-
function
|
|
785
|
+
function D() {
|
|
786
786
|
if (s.value === void 0) return;
|
|
787
|
-
const
|
|
788
|
-
if (s.value = void 0, e.value = !1, !
|
|
787
|
+
const b = I.value >= x.value && t.enabled() && !t.refreshing();
|
|
788
|
+
if (s.value = void 0, e.value = !1, !b) {
|
|
789
789
|
I.value = 0;
|
|
790
790
|
return;
|
|
791
791
|
}
|
|
792
|
-
I.value =
|
|
793
|
-
t.refreshing() || (
|
|
792
|
+
I.value = x.value, z.value = !0, t.onRefresh(), Z(() => {
|
|
793
|
+
t.refreshing() || (z.value = !1, I.value = 0);
|
|
794
794
|
});
|
|
795
795
|
}
|
|
796
|
-
return
|
|
796
|
+
return ye(
|
|
797
797
|
() => t.refreshing(),
|
|
798
|
-
(
|
|
799
|
-
|
|
798
|
+
(b, A) => {
|
|
799
|
+
b ? (z.value = !1, I.value = x.value) : A && (z.value = !1, I.value = 0);
|
|
800
800
|
}
|
|
801
801
|
), {
|
|
802
802
|
pulling: e,
|
|
803
803
|
pullDistance: I,
|
|
804
|
-
pullOffset:
|
|
805
|
-
pullProgress:
|
|
806
|
-
refreshMessage:
|
|
807
|
-
refreshThreshold:
|
|
808
|
-
handleTouchStart:
|
|
809
|
-
handleTouchMove:
|
|
810
|
-
handleTouchEnd:
|
|
804
|
+
pullOffset: y,
|
|
805
|
+
pullProgress: r,
|
|
806
|
+
refreshMessage: u,
|
|
807
|
+
refreshThreshold: x,
|
|
808
|
+
handleTouchStart: M,
|
|
809
|
+
handleTouchMove: R,
|
|
810
|
+
handleTouchEnd: D,
|
|
811
811
|
handleTouchCancel: n
|
|
812
812
|
};
|
|
813
813
|
}
|
|
814
|
-
const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"],
|
|
814
|
+
const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Dt = /* @__PURE__ */ tt({
|
|
815
815
|
name: "DynamicVirtualScroll",
|
|
816
816
|
__name: "DynamicVirtualScroll",
|
|
817
817
|
props: {
|
|
@@ -831,284 +831,284 @@ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PU
|
|
|
831
831
|
},
|
|
832
832
|
emits: ["scroll", "loadMore", "refresh"],
|
|
833
833
|
setup(t, { expose: s, emit: I }) {
|
|
834
|
-
const e = t,
|
|
835
|
-
pulling:
|
|
836
|
-
pullDistance:
|
|
837
|
-
pullOffset:
|
|
838
|
-
pullProgress:
|
|
834
|
+
const e = t, z = I, {
|
|
835
|
+
pulling: x,
|
|
836
|
+
pullDistance: y,
|
|
837
|
+
pullOffset: r,
|
|
838
|
+
pullProgress: u,
|
|
839
839
|
refreshMessage: n,
|
|
840
|
-
refreshThreshold:
|
|
841
|
-
handleTouchStart:
|
|
842
|
-
handleTouchMove:
|
|
843
|
-
handleTouchEnd:
|
|
844
|
-
handleTouchCancel:
|
|
840
|
+
refreshThreshold: M,
|
|
841
|
+
handleTouchStart: R,
|
|
842
|
+
handleTouchMove: D,
|
|
843
|
+
handleTouchEnd: b,
|
|
844
|
+
handleTouchCancel: A
|
|
845
845
|
} = xt({
|
|
846
846
|
enabled: () => e.pullToRefresh,
|
|
847
847
|
refreshing: () => e.refreshing,
|
|
848
848
|
threshold: () => e.pullRefreshThreshold,
|
|
849
|
-
onRefresh: () =>
|
|
850
|
-
}),
|
|
851
|
-
let
|
|
852
|
-
const ne =
|
|
849
|
+
onRefresh: () => z("refresh")
|
|
850
|
+
}), C = X(), $ = X(0), B = X(0), V = X(0), G = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
|
|
851
|
+
let se, H, ae = -1;
|
|
852
|
+
const ne = Mt(), { getItemKey: le } = lt({
|
|
853
853
|
componentName: "DynamicVirtualScroll",
|
|
854
854
|
items: () => e.items,
|
|
855
855
|
itemKey: () => e.itemKey
|
|
856
|
-
}), ie =
|
|
856
|
+
}), ie = h(
|
|
857
857
|
() => Math.max(1, e.estimatedItemSize)
|
|
858
|
-
),
|
|
858
|
+
), te = h(
|
|
859
859
|
() => Math.max(1, e.loadingItemSize ?? ie.value)
|
|
860
|
-
),
|
|
861
|
-
|
|
860
|
+
), ue = h(() => Math.max(0, Math.floor(e.overscan))), fe = h(() => B.value > 0 ? B.value : typeof e.height == "number" ? Math.max(0, e.height) : ie.value), he = h(() => {
|
|
861
|
+
V.value;
|
|
862
862
|
const v = new Array(e.items.length + 1), T = new Array(e.items.length);
|
|
863
863
|
v[0] = 0;
|
|
864
|
-
for (let
|
|
865
|
-
const q =
|
|
866
|
-
T[
|
|
864
|
+
for (let i = 0; i < e.items.length; i += 1) {
|
|
865
|
+
const q = le(e.items[i], i), Q = G.get(q) ?? ie.value;
|
|
866
|
+
T[i] = Q, v[i + 1] = v[i] + Q;
|
|
867
867
|
}
|
|
868
868
|
return {
|
|
869
869
|
offsets: v,
|
|
870
870
|
sizes: T,
|
|
871
871
|
total: v[e.items.length] ?? 0
|
|
872
872
|
};
|
|
873
|
-
}),
|
|
874
|
-
() =>
|
|
875
|
-
),
|
|
873
|
+
}), ve = h(
|
|
874
|
+
() => he.value.total + (e.loading ? te.value : 0)
|
|
875
|
+
), J = h(() => {
|
|
876
876
|
const v = /* @__PURE__ */ new Map();
|
|
877
|
-
return e.items.forEach((T,
|
|
878
|
-
v.set(
|
|
877
|
+
return e.items.forEach((T, i) => {
|
|
878
|
+
v.set(le(T, i), i);
|
|
879
879
|
}), v;
|
|
880
880
|
});
|
|
881
|
-
function
|
|
881
|
+
function O(v) {
|
|
882
882
|
if (e.items.length === 0) return 0;
|
|
883
|
-
const T =
|
|
884
|
-
let
|
|
885
|
-
for (;
|
|
886
|
-
const Q = Math.floor((
|
|
887
|
-
T[Q + 1] <= v ?
|
|
883
|
+
const T = he.value.offsets;
|
|
884
|
+
let i = 0, q = e.items.length;
|
|
885
|
+
for (; i < q; ) {
|
|
886
|
+
const Q = Math.floor((i + q) / 2);
|
|
887
|
+
T[Q + 1] <= v ? i = Q + 1 : q = Q;
|
|
888
888
|
}
|
|
889
|
-
return Math.min(
|
|
889
|
+
return Math.min(i, e.items.length - 1);
|
|
890
890
|
}
|
|
891
|
-
const
|
|
891
|
+
const S = h(
|
|
892
892
|
() => Math.max(
|
|
893
893
|
0,
|
|
894
|
-
|
|
894
|
+
O($.value) - ue.value
|
|
895
895
|
)
|
|
896
|
-
),
|
|
896
|
+
), P = h(() => {
|
|
897
897
|
if (e.items.length === 0) return 0;
|
|
898
|
-
const v =
|
|
898
|
+
const v = O($.value + fe.value) + 1;
|
|
899
899
|
return Math.min(
|
|
900
900
|
e.items.length,
|
|
901
|
-
v +
|
|
901
|
+
v + ue.value
|
|
902
902
|
);
|
|
903
|
-
}),
|
|
904
|
-
() => e.items.slice(
|
|
905
|
-
const
|
|
903
|
+
}), oe = h(
|
|
904
|
+
() => e.items.slice(S.value, P.value).map((v, T) => {
|
|
905
|
+
const i = S.value + T;
|
|
906
906
|
return {
|
|
907
907
|
item: v,
|
|
908
|
-
index:
|
|
909
|
-
key:
|
|
910
|
-
top:
|
|
908
|
+
index: i,
|
|
909
|
+
key: le(v, i),
|
|
910
|
+
top: he.value.offsets[i]
|
|
911
911
|
};
|
|
912
912
|
})
|
|
913
|
-
),
|
|
914
|
-
height:
|
|
913
|
+
), me = h(() => ({
|
|
914
|
+
height: gt(e.height)
|
|
915
915
|
}));
|
|
916
|
-
function
|
|
916
|
+
function Ae() {
|
|
917
917
|
var v;
|
|
918
|
-
B.value = ((v =
|
|
919
|
-
}
|
|
920
|
-
function
|
|
921
|
-
|
|
922
|
-
scrollTop:
|
|
923
|
-
startIndex:
|
|
924
|
-
endIndex:
|
|
925
|
-
}),
|
|
926
|
-
}
|
|
927
|
-
function
|
|
928
|
-
const v =
|
|
929
|
-
if (!v || !e.hasMore || e.loading ||
|
|
918
|
+
B.value = ((v = C.value) == null ? void 0 : v.clientHeight) ?? 0, ne(C.value, e.height), Z(F);
|
|
919
|
+
}
|
|
920
|
+
function E(v) {
|
|
921
|
+
$.value = v.currentTarget.scrollTop, z("scroll", {
|
|
922
|
+
scrollTop: $.value,
|
|
923
|
+
startIndex: S.value,
|
|
924
|
+
endIndex: P.value
|
|
925
|
+
}), F();
|
|
926
|
+
}
|
|
927
|
+
function F() {
|
|
928
|
+
const v = C.value;
|
|
929
|
+
if (!v || !e.hasMore || e.loading || ae === e.items.length)
|
|
930
930
|
return;
|
|
931
931
|
const T = Math.max(0, e.loadMoreThreshold);
|
|
932
|
-
|
|
932
|
+
ve.value - v.scrollTop - v.clientHeight <= T && (ae = e.items.length, z("loadMore"));
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function _(v) {
|
|
935
935
|
const T = v.borderBoxSize;
|
|
936
936
|
if (T) {
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
937
|
+
const i = Array.isArray(T) ? T[0] : T;
|
|
938
|
+
if (i != null && i.blockSize) return i.blockSize;
|
|
939
939
|
}
|
|
940
940
|
return v.contentRect.height;
|
|
941
941
|
}
|
|
942
|
-
function
|
|
943
|
-
const T =
|
|
944
|
-
let
|
|
942
|
+
function pe(v) {
|
|
943
|
+
const T = he.value;
|
|
944
|
+
let i = 0, q = !1;
|
|
945
945
|
for (const Q of v) {
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
948
|
-
const
|
|
949
|
-
if (Math.abs(
|
|
950
|
-
const
|
|
951
|
-
|
|
946
|
+
const ke = Q.target, ge = Y.get(ke), Ee = _(Q);
|
|
947
|
+
if (ge === void 0 || Ee <= 0) continue;
|
|
948
|
+
const d = G.get(ge) ?? ie.value;
|
|
949
|
+
if (Math.abs(d - Ee) < 0.5) continue;
|
|
950
|
+
const K = J.value.get(ge);
|
|
951
|
+
K !== void 0 && T.offsets[K + 1] <= $.value && (i += Ee - d), G.set(ge, Ee), q = !0;
|
|
952
952
|
}
|
|
953
|
-
q && (
|
|
954
|
-
const Q =
|
|
955
|
-
Q && (Q.scrollTop +=
|
|
953
|
+
q && (V.value += 1, Z(F), i !== 0 && Z(() => {
|
|
954
|
+
const Q = C.value;
|
|
955
|
+
Q && (Q.scrollTop += i, $.value = Q.scrollTop);
|
|
956
956
|
}));
|
|
957
957
|
}
|
|
958
|
-
function
|
|
959
|
-
v instanceof HTMLElement && (
|
|
958
|
+
function ze(v, T) {
|
|
959
|
+
v instanceof HTMLElement && (Y.set(v, T), H == null || H.observe(v));
|
|
960
960
|
}
|
|
961
961
|
function be() {
|
|
962
|
-
for (const [v] of
|
|
963
|
-
v.isConnected || (
|
|
962
|
+
for (const [v] of Y)
|
|
963
|
+
v.isConnected || (H == null || H.unobserve(v), Y.delete(v));
|
|
964
964
|
}
|
|
965
|
-
function
|
|
966
|
-
const
|
|
967
|
-
if (!
|
|
968
|
-
const q = Math.max(0,
|
|
965
|
+
function Me(v, T = {}) {
|
|
966
|
+
const i = C.value;
|
|
967
|
+
if (!i) return;
|
|
968
|
+
const q = Math.max(0, ve.value - i.clientHeight), Q = Math.min(
|
|
969
969
|
Math.max(0, Number.isFinite(v) ? v : 0),
|
|
970
970
|
q
|
|
971
|
-
),
|
|
972
|
-
|
|
971
|
+
), ke = T.behavior ?? "auto";
|
|
972
|
+
ke === "auto" && ($.value = Q), i.scrollTo({ ...T, top: Q, behavior: ke });
|
|
973
973
|
}
|
|
974
|
-
function
|
|
975
|
-
const
|
|
976
|
-
if (!
|
|
974
|
+
function ce(v, T = {}) {
|
|
975
|
+
const i = C.value;
|
|
976
|
+
if (!i || e.items.length === 0) return;
|
|
977
977
|
const q = Math.min(
|
|
978
978
|
e.items.length - 1,
|
|
979
979
|
Math.max(0, Math.floor(v))
|
|
980
|
-
), { align: Q = "start", ...
|
|
981
|
-
let
|
|
982
|
-
const
|
|
983
|
-
Q === "center" ?
|
|
984
|
-
const
|
|
980
|
+
), { align: Q = "start", ...ke } = T;
|
|
981
|
+
let ge = he.value.offsets[q];
|
|
982
|
+
const Ee = he.value.sizes[q];
|
|
983
|
+
Q === "center" ? ge -= (i.clientHeight - Ee) / 2 : Q === "end" && (ge -= i.clientHeight - Ee);
|
|
984
|
+
const d = Math.max(
|
|
985
985
|
0,
|
|
986
|
-
Math.min(
|
|
987
|
-
),
|
|
988
|
-
|
|
989
|
-
...
|
|
990
|
-
top:
|
|
991
|
-
behavior:
|
|
986
|
+
Math.min(ge, ve.value - i.clientHeight)
|
|
987
|
+
), K = ke.behavior ?? "auto";
|
|
988
|
+
K === "auto" && ($.value = d), i.scrollTo({
|
|
989
|
+
...ke,
|
|
990
|
+
top: d,
|
|
991
|
+
behavior: K
|
|
992
992
|
});
|
|
993
993
|
}
|
|
994
994
|
function de(v = "auto") {
|
|
995
995
|
var T;
|
|
996
|
-
(T =
|
|
996
|
+
(T = C.value) == null || T.scrollTo({ top: 0, behavior: v });
|
|
997
997
|
}
|
|
998
|
-
return
|
|
998
|
+
return ye(
|
|
999
999
|
() => e.itemKey,
|
|
1000
1000
|
() => {
|
|
1001
|
-
G.clear(),
|
|
1001
|
+
G.clear(), V.value += 1;
|
|
1002
1002
|
}
|
|
1003
|
-
),
|
|
1003
|
+
), ye(
|
|
1004
1004
|
() => e.items.length,
|
|
1005
1005
|
async () => {
|
|
1006
1006
|
const v = new Set(
|
|
1007
|
-
e.items.map((q, Q) =>
|
|
1007
|
+
e.items.map((q, Q) => le(q, Q))
|
|
1008
1008
|
);
|
|
1009
1009
|
for (const q of G.keys())
|
|
1010
1010
|
v.has(q) || G.delete(q);
|
|
1011
|
-
|
|
1012
|
-
const T =
|
|
1011
|
+
V.value += 1, await Z();
|
|
1012
|
+
const T = C.value;
|
|
1013
1013
|
if (!T) return;
|
|
1014
|
-
const
|
|
1015
|
-
T.scrollTop >
|
|
1014
|
+
const i = Math.max(0, ve.value - T.clientHeight);
|
|
1015
|
+
T.scrollTop > i && (T.scrollTop = i, $.value = i), F();
|
|
1016
1016
|
}
|
|
1017
|
-
),
|
|
1017
|
+
), ye(
|
|
1018
1018
|
() => [e.hasMore, e.loading],
|
|
1019
1019
|
async ([v]) => {
|
|
1020
|
-
v || (
|
|
1020
|
+
v || (ae = -1), await Z(), F();
|
|
1021
1021
|
}
|
|
1022
|
-
),
|
|
1023
|
-
if (
|
|
1024
|
-
|
|
1025
|
-
for (const [v] of
|
|
1026
|
-
|
|
1022
|
+
), at(() => {
|
|
1023
|
+
if (Ae(), typeof ResizeObserver < "u") {
|
|
1024
|
+
se = new ResizeObserver(Ae), H = new ResizeObserver(pe), C.value && se.observe(C.value);
|
|
1025
|
+
for (const [v] of Y)
|
|
1026
|
+
H.observe(v);
|
|
1027
1027
|
}
|
|
1028
|
-
Z(
|
|
1029
|
-
}), $t(be),
|
|
1030
|
-
|
|
1028
|
+
Z(F);
|
|
1029
|
+
}), $t(be), Xe(() => {
|
|
1030
|
+
se && (se.disconnect(), se = void 0), H && (H.disconnect(), H = void 0), Y.clear();
|
|
1031
1031
|
}), s({
|
|
1032
|
-
scrollTo:
|
|
1033
|
-
scrollToIndex:
|
|
1032
|
+
scrollTo: Me,
|
|
1033
|
+
scrollToIndex: ce,
|
|
1034
1034
|
scrollToTop: de
|
|
1035
1035
|
}), (v, T) => (j(), U("div", {
|
|
1036
1036
|
ref_key: "viewport",
|
|
1037
|
-
ref:
|
|
1038
|
-
class:
|
|
1039
|
-
style:
|
|
1037
|
+
ref: C,
|
|
1038
|
+
class: st(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": f(x) }]),
|
|
1039
|
+
style: re(me.value),
|
|
1040
1040
|
role: "list",
|
|
1041
1041
|
"aria-label": t.ariaLabel,
|
|
1042
1042
|
tabindex: "0",
|
|
1043
|
-
onScrollPassive:
|
|
1043
|
+
onScrollPassive: E,
|
|
1044
1044
|
onTouchstartPassive: T[0] || (T[0] = //@ts-ignore
|
|
1045
|
-
(...
|
|
1045
|
+
(...i) => f(R) && f(R)(...i)),
|
|
1046
1046
|
onTouchmove: T[1] || (T[1] = //@ts-ignore
|
|
1047
|
-
(...
|
|
1047
|
+
(...i) => f(D) && f(D)(...i)),
|
|
1048
1048
|
onTouchend: T[2] || (T[2] = //@ts-ignore
|
|
1049
|
-
(...
|
|
1049
|
+
(...i) => f(b) && f(b)(...i)),
|
|
1050
1050
|
onTouchcancel: T[3] || (T[3] = //@ts-ignore
|
|
1051
|
-
(...
|
|
1051
|
+
(...i) => f(A) && f(A)(...i))
|
|
1052
1052
|
}, [
|
|
1053
1053
|
t.pullToRefresh || t.refreshing ? (j(), U("div", {
|
|
1054
1054
|
key: 0,
|
|
1055
1055
|
class: "vue-dynamic-virtual-scroll__refresh",
|
|
1056
|
-
style:
|
|
1057
|
-
height: `${f(
|
|
1058
|
-
transform: `translateY(${f(
|
|
1056
|
+
style: re({
|
|
1057
|
+
height: `${f(M)}px`,
|
|
1058
|
+
transform: `translateY(${f(r) - f(M)}px)`
|
|
1059
1059
|
}),
|
|
1060
1060
|
role: "status",
|
|
1061
1061
|
"aria-live": "polite"
|
|
1062
1062
|
}, [
|
|
1063
1063
|
Se(v.$slots, "refresh", {
|
|
1064
|
-
pullDistance: f(
|
|
1065
|
-
progress: f(
|
|
1064
|
+
pullDistance: f(y),
|
|
1065
|
+
progress: f(u),
|
|
1066
1066
|
refreshing: t.refreshing
|
|
1067
1067
|
}, () => [
|
|
1068
|
-
|
|
1068
|
+
Ge(ht(f(n)), 1)
|
|
1069
1069
|
])
|
|
1070
|
-
], 4)) :
|
|
1070
|
+
], 4)) : Re("", !0),
|
|
1071
1071
|
t.items.length || t.loading ? (j(), U("div", {
|
|
1072
1072
|
key: 1,
|
|
1073
1073
|
class: "vue-dynamic-virtual-scroll__spacer",
|
|
1074
|
-
style:
|
|
1075
|
-
height: `${
|
|
1076
|
-
transform: `translateY(${f(
|
|
1074
|
+
style: re({
|
|
1075
|
+
height: `${ve.value}px`,
|
|
1076
|
+
transform: `translateY(${f(r)}px)`
|
|
1077
1077
|
})
|
|
1078
1078
|
}, [
|
|
1079
|
-
(j(!0), U(
|
|
1079
|
+
(j(!0), U(et, null, nt(oe.value, ({ item: i, index: q, key: Q, top: ke }) => (j(), U("div", {
|
|
1080
1080
|
key: Q,
|
|
1081
1081
|
ref_for: !0,
|
|
1082
|
-
ref: (
|
|
1082
|
+
ref: (ge) => ze(ge, Q),
|
|
1083
1083
|
class: "vue-dynamic-virtual-scroll__item",
|
|
1084
|
-
style:
|
|
1084
|
+
style: re({ transform: `translateY(${ke}px)` }),
|
|
1085
1085
|
role: "listitem",
|
|
1086
1086
|
"aria-posinset": q + 1,
|
|
1087
1087
|
"aria-setsize": t.items.length
|
|
1088
1088
|
}, [
|
|
1089
1089
|
Se(v.$slots, "default", {
|
|
1090
|
-
item:
|
|
1090
|
+
item: i,
|
|
1091
1091
|
index: q
|
|
1092
1092
|
})
|
|
1093
1093
|
], 12, Qt))), 128)),
|
|
1094
1094
|
t.loading ? (j(), U("div", {
|
|
1095
1095
|
key: 0,
|
|
1096
1096
|
class: "vue-dynamic-virtual-scroll__loading",
|
|
1097
|
-
style:
|
|
1098
|
-
height: `${
|
|
1099
|
-
transform: `translateY(${
|
|
1097
|
+
style: re({
|
|
1098
|
+
height: `${te.value}px`,
|
|
1099
|
+
transform: `translateY(${he.value.total}px)`
|
|
1100
1100
|
}),
|
|
1101
1101
|
role: "status",
|
|
1102
1102
|
"aria-live": "polite"
|
|
1103
1103
|
}, [
|
|
1104
1104
|
Se(v.$slots, "loading", {}, () => [
|
|
1105
|
-
T[4] || (T[4] =
|
|
1105
|
+
T[4] || (T[4] = Ge("Loading more…", -1))
|
|
1106
1106
|
])
|
|
1107
|
-
], 4)) :
|
|
1107
|
+
], 4)) : Re("", !0)
|
|
1108
1108
|
], 4)) : (j(), U("div", {
|
|
1109
1109
|
key: 2,
|
|
1110
1110
|
class: "vue-dynamic-virtual-scroll__empty",
|
|
1111
|
-
style:
|
|
1111
|
+
style: re({ transform: `translateY(${f(r)}px)` })
|
|
1112
1112
|
}, [
|
|
1113
1113
|
Se(v.$slots, "empty")
|
|
1114
1114
|
], 4))
|
|
@@ -1117,7 +1117,7 @@ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PU
|
|
|
1117
1117
|
}), _t = ["aria-label"], ea = ["aria-current", "aria-posinset", "aria-setsize"], ta = {
|
|
1118
1118
|
key: 1,
|
|
1119
1119
|
class: "vue-short-media-feed__empty"
|
|
1120
|
-
}, aa = 36, na = 700, la = /* @__PURE__ */
|
|
1120
|
+
}, aa = 36, na = 700, la = /* @__PURE__ */ tt({
|
|
1121
1121
|
name: "ShortMediaFeed",
|
|
1122
1122
|
__name: "ShortMediaFeed",
|
|
1123
1123
|
props: {
|
|
@@ -1133,173 +1133,173 @@ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PU
|
|
|
1133
1133
|
},
|
|
1134
1134
|
emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
|
|
1135
1135
|
setup(t, { expose: s, emit: I }) {
|
|
1136
|
-
const e = t,
|
|
1137
|
-
let
|
|
1138
|
-
const
|
|
1136
|
+
const e = t, z = I, x = X(), y = X(0), r = X(ne(e.activeIndex));
|
|
1137
|
+
let u, n = -1, M = 0, R = !1, D;
|
|
1138
|
+
const b = Mt(), { getItemKey: A } = lt({
|
|
1139
1139
|
componentName: "ShortMediaFeed",
|
|
1140
1140
|
items: () => e.items,
|
|
1141
1141
|
itemKey: () => e.itemKey
|
|
1142
|
-
}),
|
|
1142
|
+
}), C = h(
|
|
1143
1143
|
() => Math.max(0, Math.floor(e.buffer))
|
|
1144
|
-
),
|
|
1144
|
+
), $ = h(
|
|
1145
1145
|
() => Math.max(
|
|
1146
1146
|
0,
|
|
1147
1147
|
Math.floor(
|
|
1148
1148
|
Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
|
|
1149
1149
|
)
|
|
1150
1150
|
)
|
|
1151
|
-
), B =
|
|
1152
|
-
() => Math.max(0,
|
|
1153
|
-
), G =
|
|
1151
|
+
), B = h(() => y.value > 0 ? y.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), V = h(
|
|
1152
|
+
() => Math.max(0, r.value - C.value)
|
|
1153
|
+
), G = h(
|
|
1154
1154
|
() => Math.min(
|
|
1155
1155
|
e.items.length,
|
|
1156
|
-
|
|
1156
|
+
r.value + C.value + 1
|
|
1157
1157
|
)
|
|
1158
|
-
),
|
|
1158
|
+
), Y = h(
|
|
1159
1159
|
() => (
|
|
1160
1160
|
// Do not register zero-sized snap targets before a CSS height is measured.
|
|
1161
1161
|
// WebKit can retain the second target at scrollTop=0 and jump to it on resize.
|
|
1162
|
-
(B.value > 0 ? e.items : []).slice(
|
|
1163
|
-
item:
|
|
1164
|
-
index:
|
|
1162
|
+
(B.value > 0 ? e.items : []).slice(V.value, G.value).map((S, P) => ({
|
|
1163
|
+
item: S,
|
|
1164
|
+
index: V.value + P
|
|
1165
1165
|
}))
|
|
1166
1166
|
)
|
|
1167
|
-
),
|
|
1167
|
+
), se = h(() => V.value * B.value), H = h(
|
|
1168
1168
|
() => (e.items.length - G.value) * B.value
|
|
1169
|
-
),
|
|
1170
|
-
height:
|
|
1169
|
+
), ae = h(() => ({
|
|
1170
|
+
height: gt(e.height)
|
|
1171
1171
|
}));
|
|
1172
|
-
function ne(
|
|
1172
|
+
function ne(S) {
|
|
1173
1173
|
return e.items.length === 0 ? 0 : Math.min(
|
|
1174
1174
|
e.items.length - 1,
|
|
1175
|
-
Math.max(0, Math.floor(Number.isFinite(
|
|
1175
|
+
Math.max(0, Math.floor(Number.isFinite(S) ? S : 0))
|
|
1176
1176
|
);
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1178
|
+
function le() {
|
|
1179
1179
|
if (!e.hasMore || e.loading || n === e.items.length)
|
|
1180
1180
|
return;
|
|
1181
|
-
(e.items.length === 0 ? 0 : e.items.length - 1 -
|
|
1181
|
+
(e.items.length === 0 ? 0 : e.items.length - 1 - r.value) <= $.value && (n = e.items.length, z("loadMore"));
|
|
1182
1182
|
}
|
|
1183
|
-
function ie(
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1186
|
-
index:
|
|
1187
|
-
item: e.items[
|
|
1188
|
-
}),
|
|
1183
|
+
function ie(S) {
|
|
1184
|
+
const P = ne(S);
|
|
1185
|
+
P === r.value || e.items.length === 0 || (r.value = P, z("update:activeIndex", P), z("change", {
|
|
1186
|
+
index: P,
|
|
1187
|
+
item: e.items[P]
|
|
1188
|
+
}), P === 0 && z("reachStart"), P === e.items.length - 1 && z("reachEnd"), le());
|
|
1189
1189
|
}
|
|
1190
|
-
function
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1190
|
+
function te(S, P = {}) {
|
|
1191
|
+
const oe = x.value;
|
|
1192
|
+
oe && (typeof oe.scrollTo == "function" ? oe.scrollTo({ ...P, top: S }) : oe.scrollTop = S);
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1194
|
+
function ue(S, P = {}) {
|
|
1195
1195
|
if (e.items.length === 0) return;
|
|
1196
|
-
const
|
|
1197
|
-
ie(
|
|
1196
|
+
const oe = ne(S);
|
|
1197
|
+
ie(oe), te(oe * B.value, P);
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1199
|
+
function fe(S) {
|
|
1200
1200
|
if (B.value <= 0) return;
|
|
1201
|
-
const
|
|
1202
|
-
ie(Math.round(
|
|
1203
|
-
}
|
|
1204
|
-
function
|
|
1205
|
-
let
|
|
1206
|
-
|
|
1207
|
-
}
|
|
1208
|
-
function
|
|
1209
|
-
return
|
|
1210
|
-
}
|
|
1211
|
-
function
|
|
1212
|
-
if (
|
|
1213
|
-
const
|
|
1214
|
-
if (
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1219
|
-
|
|
1201
|
+
const P = S.currentTarget.scrollTop;
|
|
1202
|
+
ie(Math.round(P / B.value));
|
|
1203
|
+
}
|
|
1204
|
+
function he(S) {
|
|
1205
|
+
let P;
|
|
1206
|
+
S.key === "ArrowDown" || S.key === "PageDown" ? P = r.value + 1 : S.key === "ArrowUp" || S.key === "PageUp" ? P = r.value - 1 : S.key === "Home" ? P = 0 : S.key === "End" && (P = e.items.length - 1), P !== void 0 && (S.preventDefault(), ue(P, { behavior: "smooth" }));
|
|
1207
|
+
}
|
|
1208
|
+
function ve(S) {
|
|
1209
|
+
return S.deltaMode === WheelEvent.DOM_DELTA_LINE ? S.deltaY * 16 : S.deltaMode === WheelEvent.DOM_DELTA_PAGE ? S.deltaY * (B.value || 1) : S.deltaY;
|
|
1210
|
+
}
|
|
1211
|
+
function J(S) {
|
|
1212
|
+
if (S.ctrlKey || Math.abs(S.deltaX) > Math.abs(S.deltaY) || e.items.length === 0 || B.value <= 0 || (S.preventDefault(), R)) return;
|
|
1213
|
+
const P = ve(S);
|
|
1214
|
+
if (P * M < 0 && (M = 0), M += P, Math.abs(M) < aa) return;
|
|
1215
|
+
const oe = M > 0 ? 1 : -1;
|
|
1216
|
+
M = 0;
|
|
1217
|
+
const me = r.value + oe;
|
|
1218
|
+
me < 0 || me >= e.items.length || (R = !0, ue(me, { behavior: "smooth" }), D = setTimeout(() => {
|
|
1219
|
+
R = !1;
|
|
1220
1220
|
}, na));
|
|
1221
1221
|
}
|
|
1222
|
-
function
|
|
1223
|
-
var
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1226
|
-
|
|
1222
|
+
function O() {
|
|
1223
|
+
var P;
|
|
1224
|
+
const S = ((P = x.value) == null ? void 0 : P.clientHeight) ?? 0;
|
|
1225
|
+
b(x.value, e.height), !(S <= 0 || S === y.value) && (y.value = S, Z(() => {
|
|
1226
|
+
te(r.value * S);
|
|
1227
1227
|
}));
|
|
1228
1228
|
}
|
|
1229
|
-
return
|
|
1229
|
+
return ye(
|
|
1230
1230
|
() => e.activeIndex,
|
|
1231
|
-
async (
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1231
|
+
async (S) => {
|
|
1232
|
+
const P = ne(S);
|
|
1233
|
+
P !== r.value && (r.value = P, await Z(), te(P * B.value), le());
|
|
1234
1234
|
}
|
|
1235
|
-
),
|
|
1235
|
+
), ye(
|
|
1236
1236
|
() => [
|
|
1237
1237
|
e.hasMore,
|
|
1238
1238
|
e.loading,
|
|
1239
1239
|
e.loadMoreThreshold
|
|
1240
1240
|
],
|
|
1241
|
-
async ([
|
|
1242
|
-
|
|
1241
|
+
async ([S]) => {
|
|
1242
|
+
S || (n = -1), await Z(), le();
|
|
1243
1243
|
}
|
|
1244
|
-
),
|
|
1244
|
+
), ye(
|
|
1245
1245
|
() => e.items.length,
|
|
1246
1246
|
async () => {
|
|
1247
|
-
const
|
|
1248
|
-
e.items.length === 0 ?
|
|
1247
|
+
const S = ne(r.value);
|
|
1248
|
+
e.items.length === 0 ? r.value !== 0 && (r.value = 0, z("update:activeIndex", 0)) : ie(S), await Z(), te(S * B.value), le();
|
|
1249
1249
|
}
|
|
1250
|
-
),
|
|
1251
|
-
|
|
1252
|
-
}),
|
|
1253
|
-
|
|
1250
|
+
), at(async () => {
|
|
1251
|
+
O(), typeof ResizeObserver < "u" && x.value && (u = new ResizeObserver(O), u.observe(x.value)), await Z(), te(r.value * B.value), le();
|
|
1252
|
+
}), Xe(() => {
|
|
1253
|
+
u && (u.disconnect(), u = void 0), D && (clearTimeout(D), D = void 0);
|
|
1254
1254
|
}), s({
|
|
1255
|
-
scrollToIndex:
|
|
1256
|
-
}), (
|
|
1255
|
+
scrollToIndex: ue
|
|
1256
|
+
}), (S, P) => (j(), U("div", {
|
|
1257
1257
|
ref_key: "viewport",
|
|
1258
|
-
ref:
|
|
1258
|
+
ref: x,
|
|
1259
1259
|
class: "vue-short-media-feed",
|
|
1260
|
-
style:
|
|
1260
|
+
style: re(ae.value),
|
|
1261
1261
|
role: "list",
|
|
1262
1262
|
"aria-orientation": "vertical",
|
|
1263
1263
|
"aria-label": t.ariaLabel,
|
|
1264
1264
|
tabindex: "0",
|
|
1265
|
-
onScrollPassive:
|
|
1266
|
-
onWheel:
|
|
1267
|
-
onKeydown:
|
|
1265
|
+
onScrollPassive: fe,
|
|
1266
|
+
onWheel: J,
|
|
1267
|
+
onKeydown: he
|
|
1268
1268
|
}, [
|
|
1269
|
-
t.items.length ? (j(), U(
|
|
1270
|
-
|
|
1269
|
+
t.items.length ? (j(), U(et, { key: 0 }, [
|
|
1270
|
+
se.value > 0 ? (j(), U("div", {
|
|
1271
1271
|
key: 0,
|
|
1272
1272
|
class: "vue-short-media-feed__spacer",
|
|
1273
|
-
style:
|
|
1273
|
+
style: re({ height: `${se.value}px` }),
|
|
1274
1274
|
"aria-hidden": "true"
|
|
1275
|
-
}, null, 4)) :
|
|
1276
|
-
(j(!0), U(
|
|
1277
|
-
key: f(
|
|
1275
|
+
}, null, 4)) : Re("", !0),
|
|
1276
|
+
(j(!0), U(et, null, nt(Y.value, ({ item: oe, index: me }) => (j(), U("div", {
|
|
1277
|
+
key: f(A)(oe, me),
|
|
1278
1278
|
class: "vue-short-media-feed__item",
|
|
1279
|
-
style:
|
|
1279
|
+
style: re({ height: `${B.value}px` }),
|
|
1280
1280
|
role: "listitem",
|
|
1281
|
-
"aria-current":
|
|
1282
|
-
"aria-posinset":
|
|
1281
|
+
"aria-current": me === r.value ? "true" : void 0,
|
|
1282
|
+
"aria-posinset": me + 1,
|
|
1283
1283
|
"aria-setsize": t.items.length
|
|
1284
1284
|
}, [
|
|
1285
|
-
Se(
|
|
1286
|
-
item:
|
|
1287
|
-
index:
|
|
1288
|
-
active:
|
|
1285
|
+
Se(S.$slots, "default", {
|
|
1286
|
+
item: oe,
|
|
1287
|
+
index: me,
|
|
1288
|
+
active: me === r.value
|
|
1289
1289
|
})
|
|
1290
1290
|
], 12, ea))), 128)),
|
|
1291
|
-
|
|
1291
|
+
H.value > 0 ? (j(), U("div", {
|
|
1292
1292
|
key: 1,
|
|
1293
1293
|
class: "vue-short-media-feed__spacer",
|
|
1294
|
-
style:
|
|
1294
|
+
style: re({ height: `${H.value}px` }),
|
|
1295
1295
|
"aria-hidden": "true"
|
|
1296
|
-
}, null, 4)) :
|
|
1296
|
+
}, null, 4)) : Re("", !0)
|
|
1297
1297
|
], 64)) : (j(), U("div", ta, [
|
|
1298
|
-
Se(
|
|
1298
|
+
Se(S.$slots, "empty")
|
|
1299
1299
|
]))
|
|
1300
1300
|
], 44, _t));
|
|
1301
1301
|
}
|
|
1302
|
-
}), oa = ["aria-label"], ia = /* @__PURE__ */
|
|
1302
|
+
}), oa = ["aria-label"], ia = /* @__PURE__ */ tt({
|
|
1303
1303
|
__name: "SkeletonLoader",
|
|
1304
1304
|
props: {
|
|
1305
1305
|
width: { default: "100%" },
|
|
@@ -1310,27 +1310,27 @@ const Jt = ["aria-label"], Qt = ["aria-posinset", "aria-setsize"], Bt = /* @__PU
|
|
|
1310
1310
|
},
|
|
1311
1311
|
setup(t) {
|
|
1312
1312
|
const s = t;
|
|
1313
|
-
function I(
|
|
1314
|
-
return typeof
|
|
1313
|
+
function I(z) {
|
|
1314
|
+
return typeof z == "number" ? `${Math.max(0, z)}px` : z;
|
|
1315
1315
|
}
|
|
1316
|
-
const e =
|
|
1316
|
+
const e = h(() => ({
|
|
1317
1317
|
width: I(s.width),
|
|
1318
1318
|
height: I(s.height)
|
|
1319
1319
|
}));
|
|
1320
|
-
return (
|
|
1321
|
-
class:
|
|
1320
|
+
return (z, x) => (j(), U("div", {
|
|
1321
|
+
class: st(["vue-skeleton-loader", [
|
|
1322
1322
|
`vue-skeleton-loader--${t.variant}`,
|
|
1323
1323
|
{ "vue-skeleton-loader--animated": t.animated }
|
|
1324
1324
|
]]),
|
|
1325
|
-
style:
|
|
1325
|
+
style: re(e.value),
|
|
1326
1326
|
role: "status",
|
|
1327
1327
|
"aria-label": t.ariaLabel
|
|
1328
1328
|
}, null, 14, oa));
|
|
1329
1329
|
}
|
|
1330
1330
|
}), ra = (t, s) => {
|
|
1331
1331
|
const I = t.__vccOpts || t;
|
|
1332
|
-
for (const [e,
|
|
1333
|
-
I[e] =
|
|
1332
|
+
for (const [e, z] of s)
|
|
1333
|
+
I[e] = z;
|
|
1334
1334
|
return I;
|
|
1335
1335
|
}, sa = /* @__PURE__ */ ra(ia, [["__scopeId", "data-v-fc92f61f"]]), ua = 6e-3;
|
|
1336
1336
|
function ca(t, s) {
|
|
@@ -1338,8 +1338,8 @@ function ca(t, s) {
|
|
|
1338
1338
|
return Math.max(-e, Math.min(e, I));
|
|
1339
1339
|
}
|
|
1340
1340
|
function da(t, s, I, e = 250) {
|
|
1341
|
-
const
|
|
1342
|
-
if (!(
|
|
1341
|
+
const z = s - t, x = Math.abs(I);
|
|
1342
|
+
if (!(x >= 0.1 && z * I > 0))
|
|
1343
1343
|
return {
|
|
1344
1344
|
keyframes: [
|
|
1345
1345
|
{ transform: `translate3d(${t}px, 0, 0)` },
|
|
@@ -1347,221 +1347,236 @@ function da(t, s, I, e = 250) {
|
|
|
1347
1347
|
],
|
|
1348
1348
|
options: {
|
|
1349
1349
|
duration: Math.round(
|
|
1350
|
-
Math.max(120, Math.min(650, (190 + Math.abs(
|
|
1350
|
+
Math.max(120, Math.min(650, (190 + Math.abs(z) * 0.35) * e / 250))
|
|
1351
1351
|
),
|
|
1352
1352
|
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
1353
1353
|
fill: "forwards"
|
|
1354
1354
|
}
|
|
1355
1355
|
};
|
|
1356
|
-
const
|
|
1357
|
-
Math.max(180, Math.min(650, 2 * Math.abs(
|
|
1358
|
-
),
|
|
1356
|
+
const r = Math.round(
|
|
1357
|
+
Math.max(180, Math.min(650, 2 * Math.abs(z) / x * e / 250))
|
|
1358
|
+
), u = Math.min(3, x * r / Math.abs(z)), n = Math.ceil(r / 8);
|
|
1359
1359
|
return {
|
|
1360
|
-
keyframes: Array.from({ length: n + 1 }, (
|
|
1361
|
-
const
|
|
1360
|
+
keyframes: Array.from({ length: n + 1 }, (R, D) => {
|
|
1361
|
+
const b = D / n, A = b * b, C = A * b, $ = u * (C - 2 * A + b) + (-2 * C + 3 * A), B = t + z * $;
|
|
1362
1362
|
return {
|
|
1363
|
-
offset:
|
|
1363
|
+
offset: b,
|
|
1364
1364
|
transform: `translate3d(${B}px, 0, 0)`
|
|
1365
1365
|
};
|
|
1366
1366
|
}),
|
|
1367
|
-
options: { duration:
|
|
1367
|
+
options: { duration: r, easing: "linear", fill: "forwards" }
|
|
1368
1368
|
};
|
|
1369
1369
|
}
|
|
1370
1370
|
function fa(t) {
|
|
1371
|
-
const s =
|
|
1372
|
-
let
|
|
1373
|
-
const
|
|
1374
|
-
var
|
|
1375
|
-
return (((
|
|
1371
|
+
const s = X("idle"), I = X(!1), e = X(!1), z = h(() => s.value !== "idle" || I.value), x = h(() => s.value === "dragging" || e.value), y = X(!1);
|
|
1372
|
+
let r, u = "", n = 0, M = 0, R = 0, D = 0, b = 0, A = 0, C = 0, $ = 0, B = 0, V, G, Y, se = 0, H = !1, ae, ne, le = "", ie = !1, te, ue = !1;
|
|
1373
|
+
const fe = () => t.rtl() ? -1 : 1, he = () => {
|
|
1374
|
+
var d;
|
|
1375
|
+
return (((d = t.viewport()) == null ? void 0 : d.scrollLeft) ?? 0) * fe();
|
|
1376
1376
|
};
|
|
1377
|
-
function
|
|
1378
|
-
const
|
|
1379
|
-
if (!
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1377
|
+
function ve(d, K) {
|
|
1378
|
+
const m = t.viewport();
|
|
1379
|
+
if (!m) return;
|
|
1380
|
+
const w = d * fe();
|
|
1381
|
+
m.scrollTo ? m.scrollTo(K === void 0 ? { left: w } : { left: w, behavior: K }) : m.scrollLeft = w;
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1383
|
+
function J() {
|
|
1384
|
+
const d = t.viewport();
|
|
1385
|
+
d && (ie || (le = d.style.scrollSnapType), ie = !0, d.style.scrollSnapType = "none");
|
|
1386
1386
|
}
|
|
1387
|
-
function
|
|
1388
|
-
const
|
|
1387
|
+
function O() {
|
|
1388
|
+
const d = se;
|
|
1389
1389
|
Z(() => {
|
|
1390
|
-
|
|
1390
|
+
ue || d !== se || s.value !== "idle" || (t.viewport() && (t.viewport().style.scrollSnapType = le), ie = !1);
|
|
1391
1391
|
});
|
|
1392
1392
|
}
|
|
1393
|
-
function
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1393
|
+
function S() {
|
|
1394
|
+
const d = t.track();
|
|
1395
|
+
d && (d.style.transform = "", d.style.willChange = "");
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1398
|
-
const
|
|
1399
|
-
if (!
|
|
1400
|
-
const
|
|
1401
|
-
return Number.isFinite(
|
|
1397
|
+
function P() {
|
|
1398
|
+
const d = t.track();
|
|
1399
|
+
if (!d || !V) return b;
|
|
1400
|
+
const K = getComputedStyle(d).transform, m = K.slice(K.indexOf("(") + 1, -1).split(",").map(Number), w = K.startsWith("matrix3d") ? m[12] : m[4];
|
|
1401
|
+
return Number.isFinite(w) ? w : b;
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1404
|
-
return
|
|
1403
|
+
function oe() {
|
|
1404
|
+
return V ? D - P() * fe() : y.value ? D - b * fe() : he();
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1407
|
-
const
|
|
1408
|
-
|
|
1406
|
+
function me() {
|
|
1407
|
+
const d = V;
|
|
1408
|
+
V = void 0, d && (d.onfinish = null, d.oncancel = null, d.cancel()), Y !== void 0 && cancelAnimationFrame(Y), Y = void 0;
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1411
|
-
var
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1410
|
+
function Ae() {
|
|
1411
|
+
var m;
|
|
1412
|
+
const d = r;
|
|
1413
|
+
r = void 0, I.value = !1, e.value = !1;
|
|
1414
|
+
const K = t.viewport();
|
|
1415
|
+
d !== void 0 && ((m = K == null ? void 0 : K.hasPointerCapture) != null && m.call(K, d)) && K.releasePointerCapture(d), window.removeEventListener("pointermove", de), window.removeEventListener("pointerup", T), window.removeEventListener("pointercancel", i), window.removeEventListener("blur", q);
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1422
|
-
|
|
1417
|
+
function E(d, K) {
|
|
1418
|
+
const m = ++se;
|
|
1419
|
+
J(), s.value = "committing", me(), S(), y.value = !1, b = 0;
|
|
1420
|
+
const w = t.canonical(d);
|
|
1421
|
+
ve(w, K), t.onPosition(w), t.onCommit(d), Z(() => {
|
|
1422
|
+
ue || m !== se || (ve(w), s.value = "idle", O());
|
|
1423
1423
|
});
|
|
1424
1424
|
}
|
|
1425
|
-
function
|
|
1426
|
-
|
|
1427
|
-
const
|
|
1428
|
-
return ++
|
|
1425
|
+
function F(d = !0) {
|
|
1426
|
+
ne !== void 0 && clearTimeout(ne), ne = void 0;
|
|
1427
|
+
const K = V !== void 0 || b !== 0, m = d ? oe() : he();
|
|
1428
|
+
return ++se, J(), Ae(), me(), S(), y.value = !1, G = void 0, b = 0, s.value = "idle", d && (K && ve(m), t.onPosition(m)), O(), m;
|
|
1429
1429
|
}
|
|
1430
|
-
function
|
|
1431
|
-
|
|
1430
|
+
function _() {
|
|
1431
|
+
V && (t.onPosition(oe()), Y = requestAnimationFrame(_));
|
|
1432
1432
|
}
|
|
1433
|
-
function
|
|
1433
|
+
function pe() {
|
|
1434
1434
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1437
|
-
const
|
|
1438
|
-
if (!(
|
|
1439
|
-
|
|
1436
|
+
function ze(d, K, m) {
|
|
1437
|
+
const w = t.track(), k = (D - K) * fe();
|
|
1438
|
+
if (!(w != null && w.animate) || pe() || t.settleDuration() === 0 || Math.abs(k - b) < 1) {
|
|
1439
|
+
S(), y.value = !1, b = 0, s.value = "idle", !(w != null && w.animate) && !pe() && t.settleDuration() !== 0 ? (t.onCommit(d), G = K, ve(K, "smooth"), O()) : E(d);
|
|
1440
1440
|
return;
|
|
1441
1441
|
}
|
|
1442
|
-
++
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
},
|
|
1447
|
-
|
|
1448
|
-
},
|
|
1442
|
+
++se, J(), s.value = "settling", y.value = !0;
|
|
1443
|
+
const ee = da(b, k, m, t.settleDuration()), L = w.animate(ee.keyframes, ee.options);
|
|
1444
|
+
V = L, L.onfinish = () => {
|
|
1445
|
+
V === L && E(d);
|
|
1446
|
+
}, L.oncancel = () => {
|
|
1447
|
+
V === L && F();
|
|
1448
|
+
}, Y = requestAnimationFrame(_);
|
|
1449
1449
|
}
|
|
1450
|
-
function
|
|
1451
|
-
const
|
|
1452
|
-
t.onCommit(
|
|
1450
|
+
function be(d, K = "smooth", m = 0, w = !1) {
|
|
1451
|
+
const k = F(), ee = t.target(d, k, m);
|
|
1452
|
+
t.onCommit(d), Math.abs(ee - k) < 0.5 || K !== "smooth" || pe() ? E(d, K) : w ? (D = he(), b = (D - k) * fe(), ze(d, ee, 0)) : (s.value = "settling", G = ee, ve(ee, K), t.viewport() && (t.viewport().style.scrollSnapType = le), ie = !1);
|
|
1453
1453
|
}
|
|
1454
|
-
function
|
|
1455
|
-
const
|
|
1456
|
-
if (!(
|
|
1457
|
-
if (t.onPosition(
|
|
1458
|
-
if (Math.abs(
|
|
1459
|
-
|
|
1454
|
+
function Me(d) {
|
|
1455
|
+
const K = d.currentTarget.scrollLeft * fe();
|
|
1456
|
+
if (!(V || s.value === "dragging" || s.value === "committing")) {
|
|
1457
|
+
if (t.onPosition(K), G !== void 0) {
|
|
1458
|
+
if (Math.abs(K - G) > 1) return;
|
|
1459
|
+
G = void 0, s.value = "idle";
|
|
1460
1460
|
}
|
|
1461
|
-
t.onCommit(t.indexAt(
|
|
1461
|
+
t.onCommit(t.indexAt(K));
|
|
1462
1462
|
}
|
|
1463
1463
|
}
|
|
1464
|
-
function
|
|
1465
|
-
var
|
|
1466
|
-
if (
|
|
1467
|
-
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1464
|
+
function ce(d) {
|
|
1465
|
+
var w, k;
|
|
1466
|
+
if (r !== void 0 || d.isPrimary === !1 || d.pointerType === "mouse" && (!t.mouseDrag() || d.button !== 0) || !["mouse", "touch", "pen"].includes(d.pointerType) || (k = (w = d.target) == null ? void 0 : w.closest) != null && k.call(w, 'input, textarea, select, [contenteditable="true"], [data-carousel-no-drag]')) return;
|
|
1467
|
+
G !== void 0 && ve(he(), "auto");
|
|
1468
|
+
const K = oe();
|
|
1469
|
+
V !== void 0 ? (b = P(), me(), t.track().style.transform = `translate3d(${b}px, 0, 0)`, y.value = !0) : (b = 0, D = he()), ++se, G = void 0, s.value = "pending", r = d.pointerId, I.value = !0, u = d.pointerType, n = A = d.clientX, M = d.clientY, R = K, C = d.timeStamp, $ = 0, B = 0, H = !1, ae !== void 0 && clearTimeout(ae), window.addEventListener("pointermove", de), window.addEventListener("pointerup", T), window.addEventListener("pointercancel", i), window.addEventListener("blur", q);
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1472
|
-
var
|
|
1473
|
-
if (
|
|
1474
|
-
|
|
1475
|
-
|
|
1471
|
+
function de(d) {
|
|
1472
|
+
var $e, De;
|
|
1473
|
+
if (r !== d.pointerId || d === te) return;
|
|
1474
|
+
if (te = d, e.value) {
|
|
1475
|
+
d.cancelable && d.preventDefault();
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
const K = d.clientX - n, m = d.clientY - M, w = Number.isFinite(t.dragThreshold()) ? Math.max(1, t.dragThreshold()) : 8, k = u === "mouse" && t.mouseDragMode() === "snap";
|
|
1476
1479
|
if (s.value === "pending") {
|
|
1477
|
-
if (Math.max(Math.abs(
|
|
1478
|
-
if (
|
|
1479
|
-
|
|
1480
|
+
if (Math.max(Math.abs(K), Math.abs(m)) < w || k && Math.abs(K) < w) return;
|
|
1481
|
+
if (u !== "mouse" && Math.abs(m) >= Math.abs(K)) {
|
|
1482
|
+
F();
|
|
1480
1483
|
return;
|
|
1481
1484
|
}
|
|
1482
|
-
|
|
1485
|
+
J(), s.value = "dragging", (De = ($e = t.viewport()) == null ? void 0 : $e.setPointerCapture) == null || De.call($e, d.pointerId);
|
|
1483
1486
|
}
|
|
1484
1487
|
if (s.value !== "dragging") return;
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1488
|
+
if (d.cancelable && d.preventDefault(), H = !0, k) {
|
|
1489
|
+
e.value = !0;
|
|
1490
|
+
const Ie = -Math.sign(K) * fe(), Ye = t.target(t.indexAt(R) + Ie, R, Ie), je = t.indexAt(Ye);
|
|
1491
|
+
t.onCommit(je), ze(je, Ye, 0);
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
const ee = d.timeStamp - C;
|
|
1495
|
+
if (ee > 0 && ee <= 80) {
|
|
1496
|
+
const Ie = Math.max(-2.5, Math.min(2.5, (d.clientX - A) / ee));
|
|
1497
|
+
$ = B === 0 ? Ie : $ * 0.25 + Ie * 0.75, B += 1;
|
|
1498
|
+
} else ee > 80 && ($ = 0, B = 0);
|
|
1499
|
+
A = d.clientX, C = d.timeStamp;
|
|
1500
|
+
let L = R - K * fe();
|
|
1501
|
+
const [xe, we] = t.limits();
|
|
1502
|
+
L < xe && (L = xe + (L - xe) * 0.35), L > we && (L = we + (L - we) * 0.35), b = (D - L) * fe(), Y === void 0 && (Y = requestAnimationFrame(() => {
|
|
1503
|
+
Y = void 0;
|
|
1504
|
+
const Ie = t.track();
|
|
1505
|
+
!Ie || s.value !== "dragging" || (Ie.style.willChange = "transform", Ie.style.transform = `translate3d(${b}px, 0, 0)`, t.onPosition(D - b * fe()));
|
|
1498
1506
|
}));
|
|
1499
1507
|
}
|
|
1500
|
-
function
|
|
1501
|
-
if (
|
|
1502
|
-
const
|
|
1503
|
-
if (
|
|
1504
|
-
|
|
1508
|
+
function v(d, K = !1) {
|
|
1509
|
+
if (r === void 0 || d && r !== d.pointerId) return;
|
|
1510
|
+
const m = s.value === "dragging", w = e.value, k = b !== 0;
|
|
1511
|
+
if (Ae(), w) {
|
|
1512
|
+
ae !== void 0 && clearTimeout(ae), ae = setTimeout(() => {
|
|
1513
|
+
H = !1;
|
|
1514
|
+
}, 0);
|
|
1505
1515
|
return;
|
|
1506
1516
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
const
|
|
1512
|
-
|
|
1513
|
-
|
|
1517
|
+
if (Y !== void 0 && cancelAnimationFrame(Y), Y = void 0, !m && !k) {
|
|
1518
|
+
s.value = "idle", O();
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
const ee = D - b * fe(), L = d ? Math.max(0, d.timeStamp - C) : 101, xe = !K && t.momentum() && L <= 100 ? $ * Math.exp(-L / 80) : 0, we = ee - R, $e = Math.min(80, Math.max(40, t.step() * 0.12)), De = B >= 2 && Math.abs(we) >= $e ? ca(-xe * fe(), t.step()) : 0;
|
|
1522
|
+
let Ie = t.indexAt(ee + De);
|
|
1523
|
+
const Ye = t.indexAt(R), je = Math.max(1, t.dragThreshold());
|
|
1524
|
+
!K && m && Ie === Ye && Math.abs(we) >= je && (Ie = Ye + Math.sign(we));
|
|
1525
|
+
const Ze = t.target(Ie, ee);
|
|
1526
|
+
t.onPosition(ee), ze(t.indexAt(Ze), Ze, xe), ae !== void 0 && clearTimeout(ae), ae = setTimeout(() => {
|
|
1527
|
+
H = !1;
|
|
1514
1528
|
}, 0);
|
|
1515
1529
|
}
|
|
1516
|
-
function
|
|
1517
|
-
|
|
1530
|
+
function T(d) {
|
|
1531
|
+
v(d);
|
|
1518
1532
|
}
|
|
1519
|
-
function
|
|
1520
|
-
|
|
1533
|
+
function i(d) {
|
|
1534
|
+
v(d, !0);
|
|
1521
1535
|
}
|
|
1522
|
-
function
|
|
1523
|
-
|
|
1536
|
+
function q() {
|
|
1537
|
+
v(void 0, !0);
|
|
1524
1538
|
}
|
|
1525
|
-
function
|
|
1526
|
-
|
|
1539
|
+
function Q(d) {
|
|
1540
|
+
d.target === t.viewport() && r === d.pointerId && s.value === "dragging" && v(d, !0);
|
|
1527
1541
|
}
|
|
1528
|
-
function
|
|
1529
|
-
!
|
|
1542
|
+
function ke(d) {
|
|
1543
|
+
!H || d.detail === 0 || (d.preventDefault(), d.stopPropagation(), H = !1);
|
|
1530
1544
|
}
|
|
1531
|
-
function
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1534
|
-
if (
|
|
1535
|
-
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1545
|
+
function ge() {
|
|
1546
|
+
const d = V !== void 0 || s.value === "dragging", K = F();
|
|
1547
|
+
d && t.onCommit(t.indexAt(K)), t.nativeSnap() || (ne = setTimeout(() => {
|
|
1548
|
+
if (ne = void 0, ue || s.value !== "idle") return;
|
|
1549
|
+
D = he(), b = 0;
|
|
1550
|
+
const m = t.indexAt(D);
|
|
1551
|
+
ze(m, t.target(m, D), 0);
|
|
1538
1552
|
}, 120));
|
|
1539
1553
|
}
|
|
1540
|
-
function
|
|
1541
|
-
|
|
1554
|
+
function Ee(d) {
|
|
1555
|
+
r !== void 0 && d.preventDefault();
|
|
1542
1556
|
}
|
|
1543
|
-
return
|
|
1544
|
-
|
|
1557
|
+
return Xe(() => {
|
|
1558
|
+
F(!1), ue = !0, ae !== void 0 && clearTimeout(ae), t.viewport() && (t.viewport().style.scrollSnapType = le);
|
|
1545
1559
|
}), {
|
|
1546
1560
|
phase: s,
|
|
1547
|
-
busy:
|
|
1548
|
-
dragging:
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1561
|
+
busy: z,
|
|
1562
|
+
dragging: x,
|
|
1563
|
+
pointerActive: I,
|
|
1564
|
+
transformed: y,
|
|
1565
|
+
read: he,
|
|
1566
|
+
write: ve,
|
|
1567
|
+
cancel: F,
|
|
1568
|
+
commit: E,
|
|
1569
|
+
navigate: be,
|
|
1570
|
+
displayedPosition: oe,
|
|
1571
|
+
handleScroll: Me,
|
|
1572
|
+
handlePointerDown: ce,
|
|
1573
|
+
handlePointerMove: de,
|
|
1574
|
+
handlePointerUp: T,
|
|
1575
|
+
handlePointerCancel: i,
|
|
1576
|
+
handleLostPointerCapture: Q,
|
|
1577
|
+
handleClick: ke,
|
|
1578
|
+
handleWheel: ge,
|
|
1579
|
+
handleDragStart: Ee
|
|
1565
1580
|
};
|
|
1566
1581
|
}
|
|
1567
1582
|
function va(t) {
|
|
@@ -1571,45 +1586,45 @@ function va(t) {
|
|
|
1571
1586
|
}
|
|
1572
1587
|
function e() {
|
|
1573
1588
|
if (I(), !t.enabled() || t.paused() || t.count() < 2 || t.atEnd() && !t.loop()) return;
|
|
1574
|
-
const
|
|
1589
|
+
const z = Number.isFinite(t.delay()) ? Math.max(1, t.delay()) : 3e3;
|
|
1575
1590
|
s = setTimeout(() => {
|
|
1576
1591
|
s = void 0, !t.paused() && (t.atEnd() ? t.rewind() : t.advance(), e());
|
|
1577
|
-
},
|
|
1592
|
+
}, z);
|
|
1578
1593
|
}
|
|
1579
|
-
return
|
|
1594
|
+
return ye(
|
|
1580
1595
|
() => [t.enabled(), t.paused(), t.delay(), t.count(), t.loop(), t.atEnd()],
|
|
1581
1596
|
e,
|
|
1582
1597
|
{ immediate: !0 }
|
|
1583
|
-
),
|
|
1598
|
+
), Xe(I), { start: e, stop: I };
|
|
1584
1599
|
}
|
|
1585
|
-
function
|
|
1600
|
+
function dt(t, s) {
|
|
1586
1601
|
return s > 0 ? (t % s + s) % s : 0;
|
|
1587
1602
|
}
|
|
1588
1603
|
function ma(t, s) {
|
|
1589
1604
|
const I = new Array(t.length + 1);
|
|
1590
1605
|
I[0] = 0;
|
|
1591
|
-
for (let
|
|
1592
|
-
I[
|
|
1593
|
-
const e = I[t.length],
|
|
1594
|
-
function
|
|
1606
|
+
for (let r = 0; r < t.length; r += 1)
|
|
1607
|
+
I[r + 1] = I[r] + t[r] + s;
|
|
1608
|
+
const e = I[t.length], z = Math.max(0, e - (t.length ? s : 0));
|
|
1609
|
+
function x(r) {
|
|
1595
1610
|
if (!t.length) return 0;
|
|
1596
|
-
let
|
|
1597
|
-
for (;
|
|
1598
|
-
const
|
|
1599
|
-
I[
|
|
1611
|
+
let u = 0, n = t.length - 1;
|
|
1612
|
+
for (; u < n; ) {
|
|
1613
|
+
const M = Math.ceil((u + n) / 2);
|
|
1614
|
+
I[M] <= r ? u = M : n = M - 1;
|
|
1600
1615
|
}
|
|
1601
|
-
return
|
|
1616
|
+
return u;
|
|
1602
1617
|
}
|
|
1603
|
-
function
|
|
1604
|
-
const
|
|
1605
|
-
return
|
|
1618
|
+
function y(r) {
|
|
1619
|
+
const u = x(r), n = Math.min(t.length - 1, u + 1);
|
|
1620
|
+
return r - I[u] <= I[n] - r ? u : n;
|
|
1606
1621
|
}
|
|
1607
|
-
return { offsets: I, cycleWidth: e, totalWidth:
|
|
1622
|
+
return { offsets: I, cycleWidth: e, totalWidth: z, indexAt: x, nearestIndex: y };
|
|
1608
1623
|
}
|
|
1609
1624
|
const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "aria-current", "aria-hidden", "inert"], pa = {
|
|
1610
1625
|
key: 1,
|
|
1611
1626
|
class: "vue-virtual-carousel__empty"
|
|
1612
|
-
}, ya = /* @__PURE__ */
|
|
1627
|
+
}, ya = /* @__PURE__ */ tt({
|
|
1613
1628
|
name: "VirtualCarousel",
|
|
1614
1629
|
__name: "VirtualCarousel",
|
|
1615
1630
|
props: {
|
|
@@ -1630,6 +1645,7 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
1630
1645
|
autoplayLoop: { type: Boolean, default: !0 },
|
|
1631
1646
|
pauseOnHover: { type: Boolean, default: !0 },
|
|
1632
1647
|
mouseDrag: { type: Boolean, default: !0 },
|
|
1648
|
+
mouseDragMode: { default: "drag" },
|
|
1633
1649
|
dragThreshold: { default: 8 },
|
|
1634
1650
|
momentum: { type: Boolean, default: !0 },
|
|
1635
1651
|
settleDuration: { default: 250 },
|
|
@@ -1645,328 +1661,329 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
1645
1661
|
},
|
|
1646
1662
|
emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
|
|
1647
1663
|
setup(t, { expose: s, emit: I }) {
|
|
1648
|
-
const e = t,
|
|
1649
|
-
let B,
|
|
1650
|
-
const
|
|
1664
|
+
const e = t, z = I, x = X(), y = X(), r = X(0), u = X(0), n = X(0), M = X(!1), R = X(!1), D = X(), b = ft([]), A = ft([0, 1]), C = ft(/* @__PURE__ */ new Map()), $ = ft([]);
|
|
1665
|
+
let B, V, G = -1, Y = !1;
|
|
1666
|
+
const se = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), { getItemKey: ae } = lt({
|
|
1651
1667
|
componentName: "VirtualCarousel",
|
|
1652
1668
|
items: () => e.items,
|
|
1653
1669
|
itemKey: () => e.itemKey
|
|
1654
|
-
}), ne =
|
|
1655
|
-
const a = [...e.responsive ?? []].sort((l, g) => g.breakpoint - l.breakpoint).find((l) =>
|
|
1670
|
+
}), ne = h(() => e.items.map((a, l) => ae(a, l))), le = h(() => new Map(ne.value.map((a, l) => [a, l]))), ie = (a, l, g) => Math.max(l, Math.floor(Number.isFinite(a) ? a : g)), te = h(() => {
|
|
1671
|
+
const a = [...e.responsive ?? []].sort((l, g) => g.breakpoint - l.breakpoint).find((l) => r.value >= l.breakpoint);
|
|
1656
1672
|
return {
|
|
1657
1673
|
slidesPerView: ie((a == null ? void 0 : a.slidesPerView) ?? e.slidesPerView, 1, 1),
|
|
1658
1674
|
slidesToScroll: ie((a == null ? void 0 : a.slidesToScroll) ?? e.slidesToScroll, 1, 1),
|
|
1659
1675
|
gap: Math.max(0, Number.isFinite((a == null ? void 0 : a.gap) ?? e.gap) ? (a == null ? void 0 : a.gap) ?? e.gap : 0)
|
|
1660
1676
|
};
|
|
1661
|
-
}),
|
|
1677
|
+
}), ue = h(() => ie(e.buffer, 0, 1)), fe = h(() => ie(e.maxCachedItems, 0, 20)), he = h(() => r.value > 0 ? Math.max(
|
|
1662
1678
|
1,
|
|
1663
|
-
(
|
|
1664
|
-
) : 0),
|
|
1665
|
-
if (
|
|
1666
|
-
if (!e.autoWidth) return Math.max(0, e.items.length -
|
|
1667
|
-
if (
|
|
1668
|
-
const a =
|
|
1679
|
+
(r.value - (te.value.slidesPerView - 1) * te.value.gap) / te.value.slidesPerView
|
|
1680
|
+
) : 0), ve = h(() => e.items.map((a, l) => e.autoWidth ? C.value.get(ne.value[l]) ?? Math.max(1, Number.isFinite(e.estimatedItemWidth) ? e.estimatedItemWidth : 240) : he.value)), J = h(() => ma(ve.value, te.value.gap)), O = h(() => e.loop && e.items.length > 1 && J.value.totalWidth > r.value), S = h(() => Math.max(0, J.value.totalWidth - r.value)), P = h(() => {
|
|
1681
|
+
if (O.value) return e.items.length - 1;
|
|
1682
|
+
if (!e.autoWidth) return Math.max(0, e.items.length - te.value.slidesPerView);
|
|
1683
|
+
if (S.value <= 0) return 0;
|
|
1684
|
+
const a = J.value.indexAt(S.value), l = J.value.offsets[a] < S.value - 0.01 ? a + 1 : a;
|
|
1669
1685
|
return Math.min(e.items.length - 1, l);
|
|
1670
|
-
}),
|
|
1671
|
-
width: `${
|
|
1672
|
-
height: e.height === "auto" ? `${Math.max(1,
|
|
1686
|
+
}), oe = h(() => O.value ? J.value.cycleWidth * 3 : J.value.totalWidth), me = h(() => ({ height: gt(e.height) })), Ae = h(() => ({
|
|
1687
|
+
width: `${oe.value}px`,
|
|
1688
|
+
height: e.height === "auto" ? `${Math.max(1, u.value)}px` : "100%"
|
|
1673
1689
|
}));
|
|
1674
|
-
function
|
|
1690
|
+
function E(a) {
|
|
1675
1691
|
const l = Math.floor(Number.isFinite(a) ? a : 0);
|
|
1676
|
-
return
|
|
1692
|
+
return O.value ? dt(l, e.items.length) : Math.max(0, Math.min(P.value, l));
|
|
1677
1693
|
}
|
|
1678
|
-
n.value =
|
|
1679
|
-
function
|
|
1680
|
-
const l =
|
|
1681
|
-
return
|
|
1694
|
+
n.value = E(e.activeIndex);
|
|
1695
|
+
function F(a) {
|
|
1696
|
+
const l = J.value.offsets[E(a)] ?? 0;
|
|
1697
|
+
return O.value ? J.value.cycleWidth + l : Math.min(S.value, l);
|
|
1682
1698
|
}
|
|
1683
|
-
function
|
|
1684
|
-
const l =
|
|
1685
|
-
return
|
|
1699
|
+
function _(a) {
|
|
1700
|
+
const l = J.value.cycleWidth;
|
|
1701
|
+
return O.value && l > 0 ? (a % l + l) % l : Math.max(0, a);
|
|
1686
1702
|
}
|
|
1687
|
-
function
|
|
1688
|
-
if (!
|
|
1689
|
-
const l =
|
|
1690
|
-
return
|
|
1703
|
+
function pe(a) {
|
|
1704
|
+
if (!O.value && a >= S.value - 1 && S.value > 0) return P.value;
|
|
1705
|
+
const l = _(a);
|
|
1706
|
+
return O.value && l > (J.value.offsets[e.items.length - 1] + J.value.cycleWidth) / 2 ? 0 : E(J.value.nearestIndex(l));
|
|
1691
1707
|
}
|
|
1692
|
-
function
|
|
1693
|
-
const
|
|
1694
|
-
if (!
|
|
1695
|
-
const Te =
|
|
1696
|
-
return (
|
|
1708
|
+
function ze(a, l, g = 0) {
|
|
1709
|
+
const W = F(a);
|
|
1710
|
+
if (!O.value) return W;
|
|
1711
|
+
const Te = J.value.cycleWidth, Ke = [W - Te, W, W + Te], Be = Ke.filter((He) => g > 0 ? He > l + 0.5 : g < 0 ? He < l - 0.5 : !0);
|
|
1712
|
+
return (Be.length ? Be : Ke).sort((He, ot) => Math.abs(He - l) - Math.abs(ot - l))[0];
|
|
1697
1713
|
}
|
|
1698
1714
|
function be(a) {
|
|
1699
|
-
if (!
|
|
1700
|
-
const l =
|
|
1701
|
-
return g * e.items.length +
|
|
1715
|
+
if (!O.value) return J.value.indexAt(Math.max(0, a));
|
|
1716
|
+
const l = J.value.cycleWidth, g = Math.floor(a / l);
|
|
1717
|
+
return g * e.items.length + J.value.indexAt(a - g * l);
|
|
1702
1718
|
}
|
|
1703
|
-
function
|
|
1704
|
-
return
|
|
1719
|
+
function Me(a) {
|
|
1720
|
+
return O.value ? Math.floor(a / e.items.length) * J.value.cycleWidth + J.value.offsets[dt(a, e.items.length)] : J.value.offsets[a] ?? 0;
|
|
1705
1721
|
}
|
|
1706
|
-
function
|
|
1722
|
+
function ce(a) {
|
|
1707
1723
|
if (e.items.length === 0) {
|
|
1708
|
-
|
|
1724
|
+
b.value = [], A.value = [0, 0];
|
|
1709
1725
|
return;
|
|
1710
1726
|
}
|
|
1711
|
-
if (
|
|
1712
|
-
const l = be(a), g = be(a +
|
|
1713
|
-
(
|
|
1714
|
-
const
|
|
1727
|
+
if (r.value <= 0) return;
|
|
1728
|
+
const l = be(a), g = be(a + r.value - 0.01);
|
|
1729
|
+
(A.value[0] !== l || A.value[1] !== g + 1) && (A.value = [l, g + 1]);
|
|
1730
|
+
const W = [];
|
|
1715
1731
|
for (let Te = l; Te <= g; Te += 1) {
|
|
1716
|
-
const
|
|
1717
|
-
if (
|
|
1718
|
-
const
|
|
1719
|
-
|
|
1732
|
+
const Ke = O.value ? dt(Te, e.items.length) : Te;
|
|
1733
|
+
if (Ke < 0 || Ke >= e.items.length) continue;
|
|
1734
|
+
const Be = Me(Te);
|
|
1735
|
+
Be + ve.value[Ke] > a + 0.01 && Be < a + r.value - 0.01 && !W.includes(Ke) && W.push(Ke);
|
|
1720
1736
|
}
|
|
1721
|
-
|
|
1737
|
+
W.join(",") !== b.value.join(",") && (b.value = W);
|
|
1722
1738
|
}
|
|
1723
1739
|
function de(a) {
|
|
1724
1740
|
if (e.autoWidth) {
|
|
1725
|
-
const l =
|
|
1726
|
-
return g +
|
|
1741
|
+
const l = F(n.value), g = ze(a, l);
|
|
1742
|
+
return g + ve.value[a] > l && g < l + r.value;
|
|
1727
1743
|
}
|
|
1728
|
-
return
|
|
1744
|
+
return O.value ? dt(a - n.value, e.items.length) < te.value.slidesPerView : a >= n.value && a < n.value + te.value.slidesPerView;
|
|
1729
1745
|
}
|
|
1730
1746
|
function v() {
|
|
1731
1747
|
if (!e.hasMore || e.loading || G === e.items.length) return;
|
|
1732
|
-
const a = e.autoWidth ?
|
|
1733
|
-
e.items.length - n.value - Math.max(1, a) <= ie(e.loadMoreThreshold, 0, 2) && (G = e.items.length,
|
|
1748
|
+
const a = e.autoWidth ? b.value.length : te.value.slidesPerView;
|
|
1749
|
+
e.items.length - n.value - Math.max(1, a) <= ie(e.loadMoreThreshold, 0, 2) && (G = e.items.length, z("loadMore"));
|
|
1734
1750
|
}
|
|
1735
1751
|
function T(a) {
|
|
1736
|
-
const l =
|
|
1737
|
-
!e.items.length || l === n.value || (n.value = l,
|
|
1752
|
+
const l = E(a);
|
|
1753
|
+
!e.items.length || l === n.value || (n.value = l, z("update:activeIndex", l), z("change", { index: l, item: e.items[l] }), l === 0 && z("reachStart"), l === P.value && z("reachEnd"), v());
|
|
1738
1754
|
}
|
|
1739
|
-
const
|
|
1740
|
-
viewport: () =>
|
|
1741
|
-
track: () =>
|
|
1755
|
+
const i = fa({
|
|
1756
|
+
viewport: () => x.value,
|
|
1757
|
+
track: () => y.value,
|
|
1742
1758
|
rtl: () => e.rtl,
|
|
1743
1759
|
mouseDrag: () => e.mouseDrag,
|
|
1744
|
-
|
|
1760
|
+
mouseDragMode: () => e.mouseDragMode,
|
|
1761
|
+
nativeSnap: () => e.nativeSnap && !O.value,
|
|
1745
1762
|
dragThreshold: () => Math.max(1, Number.isFinite(e.dragThreshold) ? e.dragThreshold : 8),
|
|
1746
1763
|
momentum: () => e.momentum,
|
|
1747
1764
|
settleDuration: () => Math.max(0, Number.isFinite(e.settleDuration) ? e.settleDuration : 250),
|
|
1748
|
-
limits: () => [0,
|
|
1749
|
-
step: () =>
|
|
1750
|
-
indexAt:
|
|
1751
|
-
target:
|
|
1752
|
-
canonical:
|
|
1753
|
-
onPosition:
|
|
1765
|
+
limits: () => [0, O.value ? Math.max(0, oe.value - r.value) : S.value],
|
|
1766
|
+
step: () => ve.value[n.value] + te.value.gap || 1,
|
|
1767
|
+
indexAt: pe,
|
|
1768
|
+
target: ze,
|
|
1769
|
+
canonical: F,
|
|
1770
|
+
onPosition: ce,
|
|
1754
1771
|
onCommit: T
|
|
1755
|
-
}), { phase: q, dragging: Q } =
|
|
1756
|
-
enabled: () =>
|
|
1757
|
-
paused: () => q.value === "pending" || q.value === "dragging" || q.value === "committing" ||
|
|
1772
|
+
}), { phase: q, dragging: Q } = i, ke = va({
|
|
1773
|
+
enabled: () => R.value && e.autoplay,
|
|
1774
|
+
paused: () => i.pointerActive.value || q.value === "pending" || q.value === "dragging" || q.value === "committing" || O.value && q.value === "settling" || M.value && e.pauseOnHover,
|
|
1758
1775
|
delay: () => e.autoplayDelay,
|
|
1759
1776
|
count: () => e.items.length,
|
|
1760
|
-
atEnd: () => !
|
|
1761
|
-
loop: () =>
|
|
1762
|
-
advance: () =>
|
|
1763
|
-
rewind: () =>
|
|
1764
|
-
}),
|
|
1765
|
-
const a = Q.value ||
|
|
1766
|
-
let g,
|
|
1767
|
-
!e.autoWidth && !
|
|
1768
|
-
const Te = (
|
|
1769
|
-
for (let
|
|
1770
|
-
const
|
|
1771
|
-
(!
|
|
1777
|
+
atEnd: () => !O.value && n.value >= P.value,
|
|
1778
|
+
loop: () => O.value || e.autoplayLoop,
|
|
1779
|
+
advance: () => $e(),
|
|
1780
|
+
rewind: () => we(0, { behavior: "smooth" })
|
|
1781
|
+
}), ge = h(() => {
|
|
1782
|
+
const a = Q.value || i.transformed.value, l = ue.value + (a ? te.value.slidesPerView + 2 : 0);
|
|
1783
|
+
let g, W;
|
|
1784
|
+
!e.autoWidth && !O.value && !a ? (g = Math.max(0, n.value - l), W = Math.min(e.items.length, n.value + te.value.slidesPerView + l)) : (g = Math.max(0, A.value[0] - l), W = Math.min(O.value ? e.items.length * 3 : e.items.length, A.value[1] + l));
|
|
1785
|
+
const Te = (A.value[0] + A.value[1] - 1) / 2, Ke = /* @__PURE__ */ new Map();
|
|
1786
|
+
for (let Be = g; Be < W; Be += 1) {
|
|
1787
|
+
const He = O.value ? dt(Be, e.items.length) : Be, ot = Ke.get(He);
|
|
1788
|
+
(!ot || Math.abs(Be - Te) < Math.abs(ot.virtual - Te)) && Ke.set(He, { index: He, virtual: Be, cached: !1 });
|
|
1772
1789
|
}
|
|
1773
|
-
return [...
|
|
1790
|
+
return [...Ke.values()].sort((Be, He) => Be.virtual - He.virtual);
|
|
1774
1791
|
});
|
|
1775
|
-
|
|
1792
|
+
ye([b, q, ne], () => {
|
|
1776
1793
|
if (q.value !== "idle") return;
|
|
1777
|
-
const a =
|
|
1794
|
+
const a = b.value.filter((g) => g < e.items.length).map((g) => ne.value[g]);
|
|
1778
1795
|
if (!e.keepAlive) {
|
|
1779
|
-
|
|
1796
|
+
$.value = [];
|
|
1780
1797
|
return;
|
|
1781
1798
|
}
|
|
1782
|
-
const l =
|
|
1783
|
-
|
|
1799
|
+
const l = $.value.filter((g) => le.value.has(g) && !a.includes(g));
|
|
1800
|
+
$.value = [...l, ...a].slice(-(fe.value + a.length));
|
|
1784
1801
|
}, { immediate: !0 });
|
|
1785
|
-
const
|
|
1786
|
-
const a = [...
|
|
1787
|
-
for (const
|
|
1788
|
-
Number.isInteger(
|
|
1789
|
-
if (
|
|
1790
|
-
for (const
|
|
1791
|
-
const Te =
|
|
1792
|
-
Te !== void 0 && !l.has(Te) && g.size <
|
|
1802
|
+
const Ee = h(() => {
|
|
1803
|
+
const a = [...ge.value], l = new Set(a.map((W) => W.index)), g = /* @__PURE__ */ new Set();
|
|
1804
|
+
for (const W of e.pinnedIndexes.slice(0, fe.value))
|
|
1805
|
+
Number.isInteger(W) && W >= 0 && W < e.items.length && g.add(W);
|
|
1806
|
+
if (D.value !== void 0 && D.value < e.items.length && g.add(D.value), e.keepAlive)
|
|
1807
|
+
for (const W of [...$.value].reverse()) {
|
|
1808
|
+
const Te = le.value.get(W);
|
|
1809
|
+
Te !== void 0 && !l.has(Te) && g.size < fe.value && g.add(Te);
|
|
1793
1810
|
}
|
|
1794
|
-
for (const
|
|
1795
|
-
l.has(
|
|
1796
|
-
return a.sort((
|
|
1797
|
-
...
|
|
1798
|
-
item: e.items[
|
|
1799
|
-
key: ne.value[
|
|
1811
|
+
for (const W of g)
|
|
1812
|
+
l.has(W) || a.push({ index: W, virtual: O.value ? e.items.length + W : W, cached: W !== D.value });
|
|
1813
|
+
return a.sort((W, Te) => W.virtual - Te.virtual).map((W) => ({
|
|
1814
|
+
...W,
|
|
1815
|
+
item: e.items[W.index],
|
|
1816
|
+
key: ne.value[W.index]
|
|
1800
1817
|
}));
|
|
1801
|
-
}),
|
|
1802
|
-
const a =
|
|
1803
|
-
return a ? Math.max(0,
|
|
1818
|
+
}), d = h(() => ge.value.length ? Me(ge.value[0].virtual) : 0), K = h(() => !e.autoWidth && !O.value && !e.keepAlive && !e.pinnedIndexes.length && (D.value === void 0 || ge.value.some((a) => a.index === D.value))), m = h(() => {
|
|
1819
|
+
const a = ge.value[ge.value.length - 1];
|
|
1820
|
+
return a ? Math.max(0, oe.value - Me(a.virtual) - ve.value[a.index] - te.value.gap) : 0;
|
|
1804
1821
|
});
|
|
1805
|
-
function
|
|
1806
|
-
const l =
|
|
1822
|
+
function w(a) {
|
|
1823
|
+
const l = ve.value[a.index];
|
|
1807
1824
|
return {
|
|
1808
|
-
position:
|
|
1809
|
-
[e.rtl ? "right" : "left"]:
|
|
1825
|
+
position: K.value ? "relative" : "absolute",
|
|
1826
|
+
[e.rtl ? "right" : "left"]: K.value ? void 0 : `${Me(a.virtual)}px`,
|
|
1810
1827
|
width: e.autoWidth ? "max-content" : `${l}px`,
|
|
1811
1828
|
flexBasis: e.autoWidth ? "auto" : `${l}px`,
|
|
1812
|
-
marginRight: !e.rtl && a.index < e.items.length - 1 ? `${
|
|
1813
|
-
marginLeft: e.rtl && a.index < e.items.length - 1 ? `${
|
|
1829
|
+
marginRight: !e.rtl && a.index < e.items.length - 1 ? `${te.value.gap}px` : "0px",
|
|
1830
|
+
marginLeft: e.rtl && a.index < e.items.length - 1 ? `${te.value.gap}px` : "0px",
|
|
1814
1831
|
height: e.height === "auto" ? "auto" : "100%",
|
|
1815
1832
|
visibility: a.cached ? "hidden" : void 0,
|
|
1816
|
-
scrollSnapAlign: e.nativeSnap && !
|
|
1833
|
+
scrollSnapAlign: e.nativeSnap && !O.value && r.value > 0 ? "start" : "none"
|
|
1817
1834
|
};
|
|
1818
1835
|
}
|
|
1819
1836
|
function k() {
|
|
1820
|
-
if (!
|
|
1821
|
-
const a = new Map(
|
|
1822
|
-
for (const [l, g] of
|
|
1823
|
-
|
|
1837
|
+
if (!H.size || q.value !== "idle") return;
|
|
1838
|
+
const a = new Map(C.value);
|
|
1839
|
+
for (const [l, g] of H) a.set(l, g);
|
|
1840
|
+
H.clear(), C.value = a;
|
|
1824
1841
|
}
|
|
1825
|
-
function
|
|
1842
|
+
function ee(a, l) {
|
|
1826
1843
|
if (l < 0 || l >= e.items.length) return;
|
|
1827
|
-
const { width: g, height:
|
|
1828
|
-
|
|
1844
|
+
const { width: g, height: W } = a.getBoundingClientRect();
|
|
1845
|
+
W > u.value && (u.value = W);
|
|
1829
1846
|
const Te = ne.value[l];
|
|
1830
|
-
e.autoWidth && g > 0 && Math.abs((
|
|
1847
|
+
e.autoWidth && g > 0 && Math.abs((C.value.get(Te) ?? 0) - g) > 0.5 && H.set(Te, g);
|
|
1831
1848
|
}
|
|
1832
|
-
function
|
|
1849
|
+
function L() {
|
|
1833
1850
|
var l;
|
|
1834
|
-
if (
|
|
1851
|
+
if (Y || e.height !== "auto") return;
|
|
1835
1852
|
let a = 0;
|
|
1836
|
-
for (const g of
|
|
1837
|
-
a = Math.max(a, ((l =
|
|
1838
|
-
Math.abs(
|
|
1839
|
-
}
|
|
1840
|
-
function
|
|
1841
|
-
const g =
|
|
1842
|
-
if (g && (
|
|
1843
|
-
|
|
1853
|
+
for (const g of ge.value)
|
|
1854
|
+
a = Math.max(a, ((l = se.get(g.index)) == null ? void 0 : l.getBoundingClientRect().height) ?? 0);
|
|
1855
|
+
Math.abs(u.value - a) > 0.5 && (u.value = a);
|
|
1856
|
+
}
|
|
1857
|
+
function xe(a, l) {
|
|
1858
|
+
const g = se.get(l);
|
|
1859
|
+
if (g && (V == null || V.unobserve(g)), !(a instanceof HTMLElement)) {
|
|
1860
|
+
se.delete(l);
|
|
1844
1861
|
return;
|
|
1845
1862
|
}
|
|
1846
|
-
|
|
1863
|
+
se.set(l, a), (e.autoWidth || e.height === "auto") && (V == null || V.observe(a), ee(a, l), Z(k), Z(L));
|
|
1847
1864
|
}
|
|
1848
|
-
function
|
|
1849
|
-
!e.items.length ||
|
|
1865
|
+
function we(a, l = {}) {
|
|
1866
|
+
!e.items.length || r.value <= 0 || i.navigate(E(a), l.behavior ?? "auto", 0, O.value || !e.nativeSnap);
|
|
1850
1867
|
}
|
|
1851
|
-
function
|
|
1852
|
-
!e.items.length ||
|
|
1868
|
+
function $e(a = "smooth") {
|
|
1869
|
+
!e.items.length || r.value <= 0 || i.navigate(E(n.value + te.value.slidesToScroll), a, 1, O.value || !e.nativeSnap);
|
|
1853
1870
|
}
|
|
1854
|
-
function
|
|
1855
|
-
!e.items.length ||
|
|
1871
|
+
function De(a = "smooth") {
|
|
1872
|
+
!e.items.length || r.value <= 0 || i.navigate(E(n.value - te.value.slidesToScroll), a, -1, O.value || !e.nativeSnap);
|
|
1856
1873
|
}
|
|
1857
|
-
function
|
|
1858
|
-
var
|
|
1859
|
-
if ((Te = (
|
|
1874
|
+
function Ie(a) {
|
|
1875
|
+
var W, Te;
|
|
1876
|
+
if ((Te = (W = a.target) == null ? void 0 : W.closest) != null && Te.call(W, 'input, textarea, select, [contenteditable="true"]')) return;
|
|
1860
1877
|
const l = e.rtl ? "ArrowLeft" : "ArrowRight", g = e.rtl ? "ArrowRight" : "ArrowLeft";
|
|
1861
|
-
a.key === l || a.key === "PageDown" ? (a.preventDefault(),
|
|
1878
|
+
a.key === l || a.key === "PageDown" ? (a.preventDefault(), $e()) : a.key === g || a.key === "PageUp" ? (a.preventDefault(), De()) : a.key === "Home" ? (a.preventDefault(), we(0, { behavior: "smooth" })) : a.key === "End" && (a.preventDefault(), we(P.value));
|
|
1862
1879
|
}
|
|
1863
|
-
function
|
|
1864
|
-
var g,
|
|
1865
|
-
const l = (
|
|
1866
|
-
|
|
1880
|
+
function Ye(a) {
|
|
1881
|
+
var g, W;
|
|
1882
|
+
const l = (W = (g = a.target) == null ? void 0 : g.closest) == null ? void 0 : W.call(g, "[data-carousel-index]");
|
|
1883
|
+
D.value = l ? Number(l.getAttribute("data-carousel-index")) : void 0;
|
|
1867
1884
|
}
|
|
1868
|
-
function
|
|
1885
|
+
function je() {
|
|
1869
1886
|
Z(() => {
|
|
1870
1887
|
var a;
|
|
1871
|
-
(a =
|
|
1888
|
+
(a = x.value) != null && a.contains(document.activeElement) || (D.value = void 0);
|
|
1872
1889
|
});
|
|
1873
1890
|
}
|
|
1874
|
-
function
|
|
1875
|
-
|
|
1891
|
+
function Ze() {
|
|
1892
|
+
i.cancel(!1), e.items.length ? T(E(n.value)) : n.value !== 0 && (n.value = 0, z("update:activeIndex", 0)), Y || i.commit(n.value), Z(v);
|
|
1876
1893
|
}
|
|
1877
|
-
function
|
|
1894
|
+
function ut() {
|
|
1878
1895
|
var l;
|
|
1879
|
-
const a = ((l =
|
|
1880
|
-
a <= 0 || a ===
|
|
1896
|
+
const a = ((l = x.value) == null ? void 0 : l.clientWidth) ?? 0;
|
|
1897
|
+
a <= 0 || a === r.value || (r.value = a);
|
|
1881
1898
|
}
|
|
1882
|
-
return
|
|
1899
|
+
return ye(() => [
|
|
1883
1900
|
e.items.length,
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1901
|
+
r.value,
|
|
1902
|
+
te.value.slidesPerView,
|
|
1903
|
+
te.value.gap,
|
|
1887
1904
|
e.rtl,
|
|
1888
|
-
|
|
1905
|
+
O.value,
|
|
1889
1906
|
e.autoWidth,
|
|
1890
1907
|
e.nativeSnap,
|
|
1891
|
-
|
|
1892
|
-
],
|
|
1893
|
-
const l =
|
|
1894
|
-
l !== n.value && (
|
|
1895
|
-
}),
|
|
1908
|
+
C.value
|
|
1909
|
+
], Ze), ye(() => e.activeIndex, (a) => {
|
|
1910
|
+
const l = E(a);
|
|
1911
|
+
l !== n.value && (i.cancel(!1), n.value = l, i.commit(l), Z(v));
|
|
1912
|
+
}), ye(() => [e.hasMore, e.loading, e.loadMoreThreshold], () => {
|
|
1896
1913
|
e.hasMore || (G = -1), Z(v);
|
|
1897
|
-
}),
|
|
1914
|
+
}), ye(() => ne.value, (a) => {
|
|
1898
1915
|
const l = new Set(a);
|
|
1899
|
-
|
|
1900
|
-
}),
|
|
1916
|
+
C.value = new Map([...C.value].filter(([g]) => l.has(g))), $.value = $.value.filter((g) => l.has(g));
|
|
1917
|
+
}), ye(q, (a) => {
|
|
1901
1918
|
a === "idle" && Z(k);
|
|
1902
|
-
}),
|
|
1903
|
-
const a =
|
|
1904
|
-
|
|
1905
|
-
}),
|
|
1906
|
-
if (
|
|
1907
|
-
for (const l of a)
|
|
1908
|
-
k(),
|
|
1919
|
+
}), ye(() => [e.keepAlive, e.maxCachedItems], () => {
|
|
1920
|
+
const a = b.value.map((l) => ne.value[l]);
|
|
1921
|
+
$.value = e.keepAlive ? [...$.value.filter((l) => !a.includes(l)), ...a].slice(-(fe.value + a.length)) : [];
|
|
1922
|
+
}), at(async () => {
|
|
1923
|
+
if (ut(), typeof ResizeObserver < "u" && (B = new ResizeObserver(ut), x.value && B.observe(x.value), V = new ResizeObserver((a) => {
|
|
1924
|
+
for (const l of a) ee(l.target, Number(l.target.dataset.carouselIndex));
|
|
1925
|
+
k(), L();
|
|
1909
1926
|
}), e.autoWidth || e.height === "auto"))
|
|
1910
|
-
for (const [a, l] of
|
|
1911
|
-
|
|
1912
|
-
await Z(),
|
|
1913
|
-
}),
|
|
1914
|
-
|
|
1915
|
-
}), s({ next:
|
|
1927
|
+
for (const [a, l] of se)
|
|
1928
|
+
V.observe(l), ee(l, a);
|
|
1929
|
+
await Z(), Ze(), R.value = !0;
|
|
1930
|
+
}), Xe(() => {
|
|
1931
|
+
Y = !0, B == null || B.disconnect(), V == null || V.disconnect();
|
|
1932
|
+
}), s({ next: $e, previous: De, scrollToIndex: we, startAutoplay: ke.start, stopAutoplay: ke.stop }), (a, l) => (j(), U("div", {
|
|
1916
1933
|
ref_key: "viewport",
|
|
1917
|
-
ref:
|
|
1918
|
-
class:
|
|
1919
|
-
style:
|
|
1934
|
+
ref: x,
|
|
1935
|
+
class: st(["vue-virtual-carousel", { "vue-virtual-carousel--mouse-drag": t.mouseDrag, "vue-virtual-carousel--dragging": f(Q), "vue-virtual-carousel--controlled": O.value || !t.nativeSnap }]),
|
|
1936
|
+
style: re(me.value),
|
|
1920
1937
|
dir: t.rtl ? "rtl" : "ltr",
|
|
1921
1938
|
role: "region",
|
|
1922
1939
|
"aria-roledescription": "carousel",
|
|
1923
1940
|
"aria-label": t.ariaLabel,
|
|
1924
1941
|
tabindex: "0",
|
|
1925
1942
|
onScrollPassive: l[0] || (l[0] = //@ts-ignore
|
|
1926
|
-
(...g) => f(
|
|
1943
|
+
(...g) => f(i).handleScroll && f(i).handleScroll(...g)),
|
|
1927
1944
|
onPointerdown: l[1] || (l[1] = //@ts-ignore
|
|
1928
|
-
(...g) => f(
|
|
1945
|
+
(...g) => f(i).handlePointerDown && f(i).handlePointerDown(...g)),
|
|
1929
1946
|
onPointermove: l[2] || (l[2] = //@ts-ignore
|
|
1930
|
-
(...g) => f(
|
|
1947
|
+
(...g) => f(i).handlePointerMove && f(i).handlePointerMove(...g)),
|
|
1931
1948
|
onPointerup: l[3] || (l[3] = //@ts-ignore
|
|
1932
|
-
(...g) => f(
|
|
1949
|
+
(...g) => f(i).handlePointerUp && f(i).handlePointerUp(...g)),
|
|
1933
1950
|
onPointercancel: l[4] || (l[4] = //@ts-ignore
|
|
1934
|
-
(...g) => f(
|
|
1951
|
+
(...g) => f(i).handlePointerCancel && f(i).handlePointerCancel(...g)),
|
|
1935
1952
|
onLostpointercapture: l[5] || (l[5] = //@ts-ignore
|
|
1936
|
-
(...g) => f(
|
|
1953
|
+
(...g) => f(i).handleLostPointerCapture && f(i).handleLostPointerCapture(...g)),
|
|
1937
1954
|
onClickCapture: l[6] || (l[6] = //@ts-ignore
|
|
1938
|
-
(...g) => f(
|
|
1955
|
+
(...g) => f(i).handleClick && f(i).handleClick(...g)),
|
|
1939
1956
|
onDragstart: l[7] || (l[7] = //@ts-ignore
|
|
1940
|
-
(...g) => f(
|
|
1957
|
+
(...g) => f(i).handleDragStart && f(i).handleDragStart(...g)),
|
|
1941
1958
|
onWheelPassive: l[8] || (l[8] = //@ts-ignore
|
|
1942
|
-
(...g) => f(
|
|
1943
|
-
onKeydown:
|
|
1944
|
-
onMouseenter: l[9] || (l[9] = (g) =>
|
|
1945
|
-
onMouseleave: l[10] || (l[10] = (g) =>
|
|
1946
|
-
onFocusin:
|
|
1947
|
-
onFocusout:
|
|
1959
|
+
(...g) => f(i).handleWheel && f(i).handleWheel(...g)),
|
|
1960
|
+
onKeydown: Ie,
|
|
1961
|
+
onMouseenter: l[9] || (l[9] = (g) => M.value = !0),
|
|
1962
|
+
onMouseleave: l[10] || (l[10] = (g) => M.value = !1),
|
|
1963
|
+
onFocusin: Ye,
|
|
1964
|
+
onFocusout: je
|
|
1948
1965
|
}, [
|
|
1949
1966
|
t.items.length ? (j(), U("div", {
|
|
1950
1967
|
key: 0,
|
|
1951
1968
|
ref_key: "track",
|
|
1952
|
-
ref:
|
|
1969
|
+
ref: y,
|
|
1953
1970
|
class: "vue-virtual-carousel__track",
|
|
1954
|
-
style:
|
|
1971
|
+
style: re(Ae.value),
|
|
1955
1972
|
role: "list"
|
|
1956
1973
|
}, [
|
|
1957
|
-
|
|
1974
|
+
d.value > 0 ? (j(), U("div", {
|
|
1958
1975
|
key: 0,
|
|
1959
1976
|
class: "vue-virtual-carousel__spacer",
|
|
1960
|
-
style:
|
|
1977
|
+
style: re({ flexBasis: `${d.value}px`, position: K.value ? "relative" : "absolute" }),
|
|
1961
1978
|
"aria-hidden": "true"
|
|
1962
|
-
}, null, 4)) :
|
|
1963
|
-
(j(!0), U(
|
|
1979
|
+
}, null, 4)) : Re("", !0),
|
|
1980
|
+
(j(!0), U(et, null, nt(Ee.value, (g) => (j(), U("div", {
|
|
1964
1981
|
key: g.key,
|
|
1965
1982
|
ref_for: !0,
|
|
1966
|
-
ref: (
|
|
1983
|
+
ref: (W) => xe(W, g.index),
|
|
1967
1984
|
class: "vue-virtual-carousel__item",
|
|
1968
1985
|
"data-carousel-index": g.index,
|
|
1969
|
-
style:
|
|
1986
|
+
style: re(w(g)),
|
|
1970
1987
|
role: "listitem",
|
|
1971
1988
|
"aria-roledescription": "slide",
|
|
1972
1989
|
"aria-label": `${g.index + 1} of ${t.items.length}`,
|
|
@@ -1979,21 +1996,21 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
1979
1996
|
index: g.index,
|
|
1980
1997
|
active: g.index === n.value,
|
|
1981
1998
|
visible: de(g.index),
|
|
1982
|
-
inViewport:
|
|
1999
|
+
inViewport: b.value.includes(g.index)
|
|
1983
2000
|
})
|
|
1984
2001
|
], 12, ga))), 128)),
|
|
1985
|
-
|
|
2002
|
+
m.value > 0 ? (j(), U("div", {
|
|
1986
2003
|
key: 1,
|
|
1987
2004
|
class: "vue-virtual-carousel__spacer",
|
|
1988
|
-
style:
|
|
2005
|
+
style: re({ flexBasis: `${m.value}px`, position: K.value ? "relative" : "absolute" }),
|
|
1989
2006
|
"aria-hidden": "true"
|
|
1990
|
-
}, null, 4)) :
|
|
2007
|
+
}, null, 4)) : Re("", !0)
|
|
1991
2008
|
], 4)) : (j(), U("div", pa, [
|
|
1992
2009
|
Se(a.$slots, "empty")
|
|
1993
2010
|
]))
|
|
1994
2011
|
], 46, ha));
|
|
1995
2012
|
}
|
|
1996
|
-
}), wa = ["aria-label"],
|
|
2013
|
+
}), wa = ["aria-label"], Ma = ["aria-posinset", "aria-setsize"], xa = /* @__PURE__ */ tt({
|
|
1997
2014
|
name: "VirtualScroll",
|
|
1998
2015
|
__name: "VirtualScroll",
|
|
1999
2016
|
props: {
|
|
@@ -2013,209 +2030,209 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
2013
2030
|
},
|
|
2014
2031
|
emits: ["scroll", "loadMore", "refresh"],
|
|
2015
2032
|
setup(t, { expose: s, emit: I }) {
|
|
2016
|
-
const e = t,
|
|
2017
|
-
pulling:
|
|
2018
|
-
pullDistance:
|
|
2019
|
-
pullOffset:
|
|
2020
|
-
pullProgress:
|
|
2033
|
+
const e = t, z = I, {
|
|
2034
|
+
pulling: x,
|
|
2035
|
+
pullDistance: y,
|
|
2036
|
+
pullOffset: r,
|
|
2037
|
+
pullProgress: u,
|
|
2021
2038
|
refreshMessage: n,
|
|
2022
|
-
refreshThreshold:
|
|
2023
|
-
handleTouchStart:
|
|
2024
|
-
handleTouchMove:
|
|
2025
|
-
handleTouchEnd:
|
|
2026
|
-
handleTouchCancel:
|
|
2039
|
+
refreshThreshold: M,
|
|
2040
|
+
handleTouchStart: R,
|
|
2041
|
+
handleTouchMove: D,
|
|
2042
|
+
handleTouchEnd: b,
|
|
2043
|
+
handleTouchCancel: A
|
|
2027
2044
|
} = xt({
|
|
2028
2045
|
enabled: () => e.pullToRefresh,
|
|
2029
2046
|
refreshing: () => e.refreshing,
|
|
2030
2047
|
threshold: () => e.pullRefreshThreshold,
|
|
2031
|
-
onRefresh: () =>
|
|
2032
|
-
}),
|
|
2033
|
-
let
|
|
2034
|
-
const
|
|
2048
|
+
onRefresh: () => z("refresh")
|
|
2049
|
+
}), C = X(), $ = X(0), B = X(0);
|
|
2050
|
+
let V, G = -1;
|
|
2051
|
+
const Y = Mt(), { getItemKey: se } = lt({
|
|
2035
2052
|
componentName: "VirtualScroll",
|
|
2036
2053
|
items: () => e.items,
|
|
2037
2054
|
itemKey: () => e.itemKey
|
|
2038
|
-
}),
|
|
2039
|
-
() => e.items.length *
|
|
2040
|
-
),
|
|
2041
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
2042
|
-
), ie =
|
|
2043
|
-
() => ne.value + (e.loading ?
|
|
2044
|
-
),
|
|
2055
|
+
}), H = h(() => Math.max(1, e.itemSize)), ae = h(() => Math.max(0, Math.floor(e.overscan))), ne = h(
|
|
2056
|
+
() => e.items.length * H.value
|
|
2057
|
+
), le = h(
|
|
2058
|
+
() => Math.max(1, e.loadingItemSize ?? H.value)
|
|
2059
|
+
), ie = h(
|
|
2060
|
+
() => ne.value + (e.loading ? le.value : 0)
|
|
2061
|
+
), te = h(() => B.value > 0 ? B.value : typeof e.height == "number" ? e.height : 0), ue = h(
|
|
2045
2062
|
() => Math.max(
|
|
2046
2063
|
0,
|
|
2047
|
-
Math.floor(
|
|
2064
|
+
Math.floor($.value / H.value) - ae.value
|
|
2048
2065
|
)
|
|
2049
|
-
),
|
|
2050
|
-
const
|
|
2051
|
-
(
|
|
2066
|
+
), fe = h(() => {
|
|
2067
|
+
const E = Math.ceil(
|
|
2068
|
+
($.value + te.value) / H.value
|
|
2052
2069
|
);
|
|
2053
2070
|
return Math.min(
|
|
2054
2071
|
e.items.length,
|
|
2055
|
-
|
|
2072
|
+
E + ae.value
|
|
2056
2073
|
);
|
|
2057
|
-
}),
|
|
2058
|
-
() => e.items.slice(
|
|
2059
|
-
item:
|
|
2060
|
-
index:
|
|
2074
|
+
}), he = h(
|
|
2075
|
+
() => e.items.slice(ue.value, fe.value).map((E, F) => ({
|
|
2076
|
+
item: E,
|
|
2077
|
+
index: ue.value + F
|
|
2061
2078
|
}))
|
|
2062
|
-
),
|
|
2063
|
-
height:
|
|
2064
|
-
})),
|
|
2065
|
-
transform: `translateY(${
|
|
2079
|
+
), ve = h(() => ({
|
|
2080
|
+
height: gt(e.height)
|
|
2081
|
+
})), J = h(() => ({
|
|
2082
|
+
transform: `translateY(${ue.value * H.value}px)`
|
|
2066
2083
|
}));
|
|
2067
|
-
function
|
|
2068
|
-
var
|
|
2069
|
-
B.value = ((
|
|
2070
|
-
}
|
|
2071
|
-
function
|
|
2072
|
-
|
|
2073
|
-
scrollTop:
|
|
2074
|
-
startIndex:
|
|
2075
|
-
endIndex:
|
|
2076
|
-
}),
|
|
2077
|
-
}
|
|
2078
|
-
function
|
|
2079
|
-
const
|
|
2080
|
-
if (!
|
|
2084
|
+
function O() {
|
|
2085
|
+
var E;
|
|
2086
|
+
B.value = ((E = C.value) == null ? void 0 : E.clientHeight) ?? 0, Y(C.value, e.height), Z(P);
|
|
2087
|
+
}
|
|
2088
|
+
function S(E) {
|
|
2089
|
+
$.value = E.currentTarget.scrollTop, z("scroll", {
|
|
2090
|
+
scrollTop: $.value,
|
|
2091
|
+
startIndex: ue.value,
|
|
2092
|
+
endIndex: fe.value
|
|
2093
|
+
}), P();
|
|
2094
|
+
}
|
|
2095
|
+
function P() {
|
|
2096
|
+
const E = C.value;
|
|
2097
|
+
if (!E || !e.hasMore || e.loading || G === e.items.length)
|
|
2081
2098
|
return;
|
|
2082
|
-
const
|
|
2083
|
-
ie.value -
|
|
2084
|
-
}
|
|
2085
|
-
function
|
|
2086
|
-
const
|
|
2087
|
-
if (!
|
|
2088
|
-
const
|
|
2089
|
-
Math.max(0, Number.isFinite(
|
|
2090
|
-
|
|
2091
|
-
), be =
|
|
2092
|
-
be === "auto" && (
|
|
2093
|
-
}
|
|
2094
|
-
function
|
|
2095
|
-
const
|
|
2096
|
-
if (!
|
|
2097
|
-
const
|
|
2099
|
+
const F = Math.max(0, e.loadMoreThreshold);
|
|
2100
|
+
ie.value - E.scrollTop - E.clientHeight <= F && (G = e.items.length, z("loadMore"));
|
|
2101
|
+
}
|
|
2102
|
+
function oe(E, F = {}) {
|
|
2103
|
+
const _ = C.value;
|
|
2104
|
+
if (!_) return;
|
|
2105
|
+
const pe = Math.max(0, ie.value - _.clientHeight), ze = Math.min(
|
|
2106
|
+
Math.max(0, Number.isFinite(E) ? E : 0),
|
|
2107
|
+
pe
|
|
2108
|
+
), be = F.behavior ?? "auto";
|
|
2109
|
+
be === "auto" && ($.value = ze), _.scrollTo({ ...F, top: ze, behavior: be });
|
|
2110
|
+
}
|
|
2111
|
+
function me(E, F = {}) {
|
|
2112
|
+
const _ = C.value;
|
|
2113
|
+
if (!_ || e.items.length === 0) return;
|
|
2114
|
+
const pe = Math.min(
|
|
2098
2115
|
e.items.length - 1,
|
|
2099
|
-
Math.max(0, Math.floor(
|
|
2100
|
-
), { align:
|
|
2101
|
-
let
|
|
2102
|
-
|
|
2116
|
+
Math.max(0, Math.floor(E))
|
|
2117
|
+
), { align: ze = "start", ...be } = F;
|
|
2118
|
+
let Me = pe * H.value;
|
|
2119
|
+
ze === "center" ? Me -= (_.clientHeight - H.value) / 2 : ze === "end" && (Me -= _.clientHeight - H.value), _.scrollTo({
|
|
2103
2120
|
...be,
|
|
2104
|
-
top: Math.max(0, Math.min(
|
|
2121
|
+
top: Math.max(0, Math.min(Me, ie.value - _.clientHeight))
|
|
2105
2122
|
});
|
|
2106
2123
|
}
|
|
2107
|
-
function
|
|
2108
|
-
var
|
|
2109
|
-
(
|
|
2124
|
+
function Ae(E = "auto") {
|
|
2125
|
+
var F;
|
|
2126
|
+
(F = C.value) == null || F.scrollTo({ top: 0, behavior: E });
|
|
2110
2127
|
}
|
|
2111
|
-
return
|
|
2128
|
+
return ye(
|
|
2112
2129
|
() => [e.items.length, e.itemSize],
|
|
2113
2130
|
async () => {
|
|
2114
2131
|
await Z();
|
|
2115
|
-
const
|
|
2116
|
-
if (!
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2132
|
+
const E = C.value;
|
|
2133
|
+
if (!E) return;
|
|
2134
|
+
const F = Math.max(0, ie.value - E.clientHeight);
|
|
2135
|
+
E.scrollTop > F && (E.scrollTop = F, $.value = F), P();
|
|
2119
2136
|
}
|
|
2120
|
-
),
|
|
2137
|
+
), ye(
|
|
2121
2138
|
() => [e.hasMore, e.loading],
|
|
2122
|
-
async ([
|
|
2123
|
-
|
|
2139
|
+
async ([E]) => {
|
|
2140
|
+
E || (G = -1), await Z(), P();
|
|
2124
2141
|
}
|
|
2125
|
-
),
|
|
2126
|
-
|
|
2127
|
-
}),
|
|
2128
|
-
|
|
2142
|
+
), at(() => {
|
|
2143
|
+
O(), typeof ResizeObserver < "u" && C.value && (V = new ResizeObserver(O), V.observe(C.value)), Z(P);
|
|
2144
|
+
}), Xe(() => {
|
|
2145
|
+
V && (V.disconnect(), V = void 0);
|
|
2129
2146
|
}), s({
|
|
2130
|
-
scrollTo:
|
|
2131
|
-
scrollToIndex:
|
|
2132
|
-
scrollToTop:
|
|
2133
|
-
}), (
|
|
2147
|
+
scrollTo: oe,
|
|
2148
|
+
scrollToIndex: me,
|
|
2149
|
+
scrollToTop: Ae
|
|
2150
|
+
}), (E, F) => (j(), U("div", {
|
|
2134
2151
|
ref_key: "viewport",
|
|
2135
|
-
ref:
|
|
2136
|
-
class:
|
|
2137
|
-
style:
|
|
2152
|
+
ref: C,
|
|
2153
|
+
class: st(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": f(x) }]),
|
|
2154
|
+
style: re(ve.value),
|
|
2138
2155
|
role: "list",
|
|
2139
2156
|
"aria-label": t.ariaLabel,
|
|
2140
2157
|
tabindex: "0",
|
|
2141
|
-
onScrollPassive:
|
|
2142
|
-
onTouchstartPassive:
|
|
2143
|
-
(...
|
|
2144
|
-
onTouchmove:
|
|
2145
|
-
(...
|
|
2146
|
-
onTouchend:
|
|
2147
|
-
(...
|
|
2148
|
-
onTouchcancel:
|
|
2149
|
-
(...
|
|
2158
|
+
onScrollPassive: S,
|
|
2159
|
+
onTouchstartPassive: F[0] || (F[0] = //@ts-ignore
|
|
2160
|
+
(..._) => f(R) && f(R)(..._)),
|
|
2161
|
+
onTouchmove: F[1] || (F[1] = //@ts-ignore
|
|
2162
|
+
(..._) => f(D) && f(D)(..._)),
|
|
2163
|
+
onTouchend: F[2] || (F[2] = //@ts-ignore
|
|
2164
|
+
(..._) => f(b) && f(b)(..._)),
|
|
2165
|
+
onTouchcancel: F[3] || (F[3] = //@ts-ignore
|
|
2166
|
+
(..._) => f(A) && f(A)(..._))
|
|
2150
2167
|
}, [
|
|
2151
2168
|
t.pullToRefresh || t.refreshing ? (j(), U("div", {
|
|
2152
2169
|
key: 0,
|
|
2153
2170
|
class: "vue-virtual-scroll__refresh",
|
|
2154
|
-
style:
|
|
2155
|
-
height: `${f(
|
|
2156
|
-
transform: `translateY(${f(
|
|
2171
|
+
style: re({
|
|
2172
|
+
height: `${f(M)}px`,
|
|
2173
|
+
transform: `translateY(${f(r) - f(M)}px)`
|
|
2157
2174
|
}),
|
|
2158
2175
|
role: "status",
|
|
2159
2176
|
"aria-live": "polite"
|
|
2160
2177
|
}, [
|
|
2161
|
-
Se(
|
|
2162
|
-
pullDistance: f(
|
|
2163
|
-
progress: f(
|
|
2178
|
+
Se(E.$slots, "refresh", {
|
|
2179
|
+
pullDistance: f(y),
|
|
2180
|
+
progress: f(u),
|
|
2164
2181
|
refreshing: t.refreshing
|
|
2165
2182
|
}, () => [
|
|
2166
|
-
|
|
2183
|
+
Ge(ht(f(n)), 1)
|
|
2167
2184
|
])
|
|
2168
|
-
], 4)) :
|
|
2185
|
+
], 4)) : Re("", !0),
|
|
2169
2186
|
t.items.length || t.loading ? (j(), U("div", {
|
|
2170
2187
|
key: 1,
|
|
2171
2188
|
class: "vue-virtual-scroll__spacer",
|
|
2172
|
-
style:
|
|
2189
|
+
style: re({
|
|
2173
2190
|
height: `${ie.value}px`,
|
|
2174
|
-
transform: `translateY(${f(
|
|
2191
|
+
transform: `translateY(${f(r)}px)`
|
|
2175
2192
|
})
|
|
2176
2193
|
}, [
|
|
2177
|
-
|
|
2194
|
+
rt("div", {
|
|
2178
2195
|
class: "vue-virtual-scroll__content",
|
|
2179
|
-
style:
|
|
2196
|
+
style: re(J.value)
|
|
2180
2197
|
}, [
|
|
2181
|
-
(j(!0), U(
|
|
2182
|
-
key: f(
|
|
2198
|
+
(j(!0), U(et, null, nt(he.value, ({ item: _, index: pe }) => (j(), U("div", {
|
|
2199
|
+
key: f(se)(_, pe),
|
|
2183
2200
|
class: "vue-virtual-scroll__item",
|
|
2184
|
-
style:
|
|
2201
|
+
style: re({ height: `${H.value}px` }),
|
|
2185
2202
|
role: "listitem",
|
|
2186
|
-
"aria-posinset":
|
|
2203
|
+
"aria-posinset": pe + 1,
|
|
2187
2204
|
"aria-setsize": t.items.length
|
|
2188
2205
|
}, [
|
|
2189
|
-
Se(
|
|
2190
|
-
item:
|
|
2191
|
-
index:
|
|
2206
|
+
Se(E.$slots, "default", {
|
|
2207
|
+
item: _,
|
|
2208
|
+
index: pe
|
|
2192
2209
|
})
|
|
2193
|
-
], 12,
|
|
2210
|
+
], 12, Ma))), 128))
|
|
2194
2211
|
], 4),
|
|
2195
2212
|
t.loading ? (j(), U("div", {
|
|
2196
2213
|
key: 0,
|
|
2197
2214
|
class: "vue-virtual-scroll__loading",
|
|
2198
|
-
style:
|
|
2199
|
-
height: `${
|
|
2215
|
+
style: re({
|
|
2216
|
+
height: `${le.value}px`,
|
|
2200
2217
|
transform: `translateY(${ne.value}px)`
|
|
2201
2218
|
}),
|
|
2202
2219
|
role: "status",
|
|
2203
2220
|
"aria-live": "polite"
|
|
2204
2221
|
}, [
|
|
2205
|
-
Se(
|
|
2206
|
-
|
|
2222
|
+
Se(E.$slots, "loading", {}, () => [
|
|
2223
|
+
F[4] || (F[4] = Ge("Loading more…", -1))
|
|
2207
2224
|
])
|
|
2208
|
-
], 4)) :
|
|
2225
|
+
], 4)) : Re("", !0)
|
|
2209
2226
|
], 4)) : (j(), U("div", {
|
|
2210
2227
|
key: 2,
|
|
2211
2228
|
class: "vue-virtual-scroll__empty",
|
|
2212
|
-
style:
|
|
2229
|
+
style: re({ transform: `translateY(${f(r)}px)` })
|
|
2213
2230
|
}, [
|
|
2214
|
-
Se(
|
|
2231
|
+
Se(E.$slots, "empty")
|
|
2215
2232
|
], 4))
|
|
2216
2233
|
], 46, wa));
|
|
2217
2234
|
}
|
|
2218
|
-
}), Ta = ["aria-label"], ba = ["aria-posinset", "aria-setsize"], Sa = /* @__PURE__ */
|
|
2235
|
+
}), Ta = ["aria-label"], ba = ["aria-posinset", "aria-setsize"], Sa = /* @__PURE__ */ tt({
|
|
2219
2236
|
name: "WindowDynamicVirtualScroll",
|
|
2220
2237
|
__name: "WindowDynamicVirtualScroll",
|
|
2221
2238
|
props: {
|
|
@@ -2234,328 +2251,328 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
2234
2251
|
},
|
|
2235
2252
|
emits: ["scroll", "loadMore", "refresh"],
|
|
2236
2253
|
setup(t, { expose: s, emit: I }) {
|
|
2237
|
-
const e = t,
|
|
2238
|
-
let
|
|
2239
|
-
const { getItemKey:
|
|
2254
|
+
const e = t, z = I, x = X(), y = X(0), r = X(0), u = X(0), n = X(0), M = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map();
|
|
2255
|
+
let b, A, C, $, B = !1, V = !1, G = -1;
|
|
2256
|
+
const { getItemKey: Y } = lt({
|
|
2240
2257
|
componentName: "WindowDynamicVirtualScroll",
|
|
2241
2258
|
items: () => e.items,
|
|
2242
2259
|
itemKey: () => e.itemKey
|
|
2243
2260
|
});
|
|
2244
|
-
function
|
|
2261
|
+
function se(m) {
|
|
2245
2262
|
return typeof window.requestAnimationFrame == "function" ? {
|
|
2246
|
-
id: window.requestAnimationFrame(
|
|
2263
|
+
id: window.requestAnimationFrame(m),
|
|
2247
2264
|
type: "animation"
|
|
2248
2265
|
} : {
|
|
2249
|
-
id: window.setTimeout(
|
|
2266
|
+
id: window.setTimeout(m, 0),
|
|
2250
2267
|
type: "timeout"
|
|
2251
2268
|
};
|
|
2252
2269
|
}
|
|
2253
|
-
function
|
|
2254
|
-
|
|
2270
|
+
function H(m) {
|
|
2271
|
+
m && (m.type === "animation" ? window.cancelAnimationFrame(m.id) : window.clearTimeout(m.id));
|
|
2255
2272
|
}
|
|
2256
2273
|
const {
|
|
2257
|
-
pulling:
|
|
2274
|
+
pulling: ae,
|
|
2258
2275
|
pullDistance: ne,
|
|
2259
|
-
pullOffset:
|
|
2276
|
+
pullOffset: le,
|
|
2260
2277
|
pullProgress: ie,
|
|
2261
|
-
refreshMessage:
|
|
2262
|
-
refreshThreshold:
|
|
2263
|
-
handleTouchStart:
|
|
2264
|
-
handleTouchMove:
|
|
2265
|
-
handleTouchEnd:
|
|
2266
|
-
handleTouchCancel:
|
|
2278
|
+
refreshMessage: te,
|
|
2279
|
+
refreshThreshold: ue,
|
|
2280
|
+
handleTouchStart: fe,
|
|
2281
|
+
handleTouchMove: he,
|
|
2282
|
+
handleTouchEnd: ve,
|
|
2283
|
+
handleTouchCancel: J
|
|
2267
2284
|
} = xt({
|
|
2268
2285
|
enabled: () => e.pullToRefresh,
|
|
2269
2286
|
refreshing: () => e.refreshing,
|
|
2270
2287
|
threshold: () => e.pullRefreshThreshold,
|
|
2271
|
-
onRefresh: () =>
|
|
2288
|
+
onRefresh: () => z("refresh"),
|
|
2272
2289
|
scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
|
|
2273
|
-
}),
|
|
2290
|
+
}), O = h(
|
|
2274
2291
|
() => Math.max(1, e.estimatedItemSize)
|
|
2275
|
-
),
|
|
2276
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
2277
|
-
),
|
|
2292
|
+
), S = h(
|
|
2293
|
+
() => Math.max(1, e.loadingItemSize ?? O.value)
|
|
2294
|
+
), P = h(() => Math.max(0, Math.floor(e.overscan))), oe = h(() => {
|
|
2278
2295
|
n.value;
|
|
2279
|
-
const
|
|
2280
|
-
|
|
2296
|
+
const m = new Array(e.items.length + 1), w = new Array(e.items.length);
|
|
2297
|
+
m[0] = 0;
|
|
2281
2298
|
for (let k = 0; k < e.items.length; k += 1) {
|
|
2282
|
-
const
|
|
2283
|
-
|
|
2299
|
+
const ee = Y(e.items[k], k), L = M.get(ee) ?? O.value;
|
|
2300
|
+
w[k] = L, m[k + 1] = m[k] + L;
|
|
2284
2301
|
}
|
|
2285
2302
|
return {
|
|
2286
|
-
offsets:
|
|
2287
|
-
sizes:
|
|
2288
|
-
total:
|
|
2303
|
+
offsets: m,
|
|
2304
|
+
sizes: w,
|
|
2305
|
+
total: m[e.items.length] ?? 0
|
|
2289
2306
|
};
|
|
2290
|
-
}),
|
|
2291
|
-
() =>
|
|
2292
|
-
),
|
|
2293
|
-
const
|
|
2294
|
-
return e.items.forEach((
|
|
2295
|
-
|
|
2296
|
-
}),
|
|
2297
|
-
}),
|
|
2298
|
-
() => Math.max(0,
|
|
2307
|
+
}), me = h(
|
|
2308
|
+
() => oe.value.total + (e.loading ? S.value : 0)
|
|
2309
|
+
), Ae = h(() => {
|
|
2310
|
+
const m = /* @__PURE__ */ new Map();
|
|
2311
|
+
return e.items.forEach((w, k) => {
|
|
2312
|
+
m.set(Y(w, k), k);
|
|
2313
|
+
}), m;
|
|
2314
|
+
}), E = h(
|
|
2315
|
+
() => Math.max(0, y.value - u.value)
|
|
2299
2316
|
);
|
|
2300
|
-
function
|
|
2317
|
+
function F(m) {
|
|
2301
2318
|
if (e.items.length === 0) return 0;
|
|
2302
|
-
const
|
|
2303
|
-
let k = 0,
|
|
2304
|
-
for (; k <
|
|
2305
|
-
const
|
|
2306
|
-
|
|
2319
|
+
const w = oe.value.offsets;
|
|
2320
|
+
let k = 0, ee = e.items.length;
|
|
2321
|
+
for (; k < ee; ) {
|
|
2322
|
+
const L = Math.floor((k + ee) / 2);
|
|
2323
|
+
w[L + 1] <= m ? k = L + 1 : ee = L;
|
|
2307
2324
|
}
|
|
2308
2325
|
return Math.min(k, e.items.length - 1);
|
|
2309
2326
|
}
|
|
2310
|
-
const
|
|
2327
|
+
const _ = h(
|
|
2311
2328
|
() => Math.max(
|
|
2312
2329
|
0,
|
|
2313
|
-
|
|
2330
|
+
F(E.value) - P.value
|
|
2314
2331
|
)
|
|
2315
|
-
),
|
|
2332
|
+
), pe = h(() => {
|
|
2316
2333
|
if (e.items.length === 0) return 0;
|
|
2317
|
-
const
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
), k =
|
|
2334
|
+
const m = y.value + r.value - u.value, w = Math.max(
|
|
2335
|
+
O.value,
|
|
2336
|
+
m
|
|
2337
|
+
), k = F(w) + 1;
|
|
2321
2338
|
return Math.min(
|
|
2322
2339
|
e.items.length,
|
|
2323
|
-
k +
|
|
2340
|
+
k + P.value
|
|
2324
2341
|
);
|
|
2325
|
-
}),
|
|
2326
|
-
() => e.items.slice(
|
|
2327
|
-
const k =
|
|
2342
|
+
}), ze = h(
|
|
2343
|
+
() => e.items.slice(_.value, pe.value).map((m, w) => {
|
|
2344
|
+
const k = _.value + w;
|
|
2328
2345
|
return {
|
|
2329
|
-
item:
|
|
2346
|
+
item: m,
|
|
2330
2347
|
index: k,
|
|
2331
|
-
key:
|
|
2332
|
-
top:
|
|
2348
|
+
key: Y(m, k),
|
|
2349
|
+
top: oe.value.offsets[k]
|
|
2333
2350
|
};
|
|
2334
2351
|
})
|
|
2335
2352
|
);
|
|
2336
2353
|
function be() {
|
|
2337
|
-
typeof window > "u" || (
|
|
2354
|
+
typeof window > "u" || (y.value = Math.max(0, window.scrollY), r.value = window.innerHeight, x.value && (u.value = x.value.getBoundingClientRect().top + y.value));
|
|
2338
2355
|
}
|
|
2339
|
-
function
|
|
2340
|
-
|
|
2341
|
-
scrollTop:
|
|
2342
|
-
startIndex:
|
|
2343
|
-
endIndex:
|
|
2356
|
+
function Me() {
|
|
2357
|
+
z("scroll", {
|
|
2358
|
+
scrollTop: E.value,
|
|
2359
|
+
startIndex: _.value,
|
|
2360
|
+
endIndex: pe.value
|
|
2344
2361
|
});
|
|
2345
2362
|
}
|
|
2346
|
-
function
|
|
2347
|
-
|
|
2348
|
-
|
|
2363
|
+
function ce(m = !1) {
|
|
2364
|
+
V && (B || (B = m), !C && (C = se(() => {
|
|
2365
|
+
C = void 0, be(), B && (B = !1, Me()), T();
|
|
2349
2366
|
})));
|
|
2350
2367
|
}
|
|
2351
2368
|
function de() {
|
|
2352
|
-
|
|
2369
|
+
ce(!0);
|
|
2353
2370
|
}
|
|
2354
2371
|
function v() {
|
|
2355
|
-
|
|
2372
|
+
ce();
|
|
2356
2373
|
}
|
|
2357
2374
|
function T() {
|
|
2358
2375
|
if (typeof window > "u" || !e.hasMore || e.loading || G === e.items.length)
|
|
2359
2376
|
return;
|
|
2360
|
-
const
|
|
2361
|
-
|
|
2377
|
+
const m = Math.max(0, e.loadMoreThreshold), w = u.value + me.value, k = y.value + r.value;
|
|
2378
|
+
w - k <= m && (G = e.items.length, z("loadMore"));
|
|
2362
2379
|
}
|
|
2363
|
-
function
|
|
2364
|
-
const
|
|
2365
|
-
if (
|
|
2366
|
-
const k = Array.isArray(
|
|
2380
|
+
function i(m) {
|
|
2381
|
+
const w = m.borderBoxSize;
|
|
2382
|
+
if (w) {
|
|
2383
|
+
const k = Array.isArray(w) ? w[0] : w;
|
|
2367
2384
|
if (k != null && k.blockSize) return k.blockSize;
|
|
2368
2385
|
}
|
|
2369
|
-
return
|
|
2370
|
-
}
|
|
2371
|
-
function q(
|
|
2372
|
-
const
|
|
2373
|
-
let k = 0,
|
|
2374
|
-
for (const
|
|
2375
|
-
const
|
|
2376
|
-
if (
|
|
2377
|
-
const
|
|
2378
|
-
if (Math.abs(
|
|
2379
|
-
const
|
|
2380
|
-
|
|
2386
|
+
return m.contentRect.height;
|
|
2387
|
+
}
|
|
2388
|
+
function q(m) {
|
|
2389
|
+
const w = oe.value;
|
|
2390
|
+
let k = 0, ee = !1;
|
|
2391
|
+
for (const L of m) {
|
|
2392
|
+
const xe = L.target, we = R.get(xe), $e = i(L);
|
|
2393
|
+
if (we === void 0 || $e <= 0) continue;
|
|
2394
|
+
const De = M.get(we) ?? O.value;
|
|
2395
|
+
if (Math.abs(De - $e) < 0.5) continue;
|
|
2396
|
+
const Ie = Ae.value.get(we);
|
|
2397
|
+
Ie !== void 0 && w.offsets[Ie + 1] <= E.value && (k += $e - De), M.set(we, $e), ee = !0;
|
|
2381
2398
|
}
|
|
2382
|
-
|
|
2383
|
-
if (
|
|
2399
|
+
ee && (n.value += 1, Z(() => {
|
|
2400
|
+
if (V) {
|
|
2384
2401
|
if (k !== 0 && typeof window < "u") {
|
|
2385
|
-
const
|
|
2402
|
+
const L = Math.max(
|
|
2386
2403
|
0,
|
|
2387
|
-
|
|
2404
|
+
y.value + k
|
|
2388
2405
|
);
|
|
2389
|
-
|
|
2406
|
+
y.value = L, window.scrollTo({ top: L, behavior: "auto" });
|
|
2390
2407
|
}
|
|
2391
2408
|
be(), T();
|
|
2392
2409
|
}
|
|
2393
2410
|
}));
|
|
2394
2411
|
}
|
|
2395
|
-
function Q(
|
|
2396
|
-
if (
|
|
2397
|
-
for (const
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2412
|
+
function Q(m) {
|
|
2413
|
+
if (V) {
|
|
2414
|
+
for (const w of m)
|
|
2415
|
+
D.set(w.target, w);
|
|
2416
|
+
$ || ($ = se(() => {
|
|
2417
|
+
$ = void 0;
|
|
2418
|
+
const w = Array.from(D.values());
|
|
2419
|
+
D.clear(), q(w);
|
|
2403
2420
|
}));
|
|
2404
2421
|
}
|
|
2405
2422
|
}
|
|
2406
|
-
function
|
|
2407
|
-
|
|
2423
|
+
function ke(m, w) {
|
|
2424
|
+
m instanceof HTMLElement && (R.set(m, w), A == null || A.observe(m));
|
|
2408
2425
|
}
|
|
2409
|
-
function
|
|
2410
|
-
for (const [
|
|
2411
|
-
|
|
2426
|
+
function ge() {
|
|
2427
|
+
for (const [m] of R)
|
|
2428
|
+
m.isConnected || (A == null || A.unobserve(m), R.delete(m));
|
|
2412
2429
|
}
|
|
2413
|
-
function
|
|
2430
|
+
function Ee(m, w = {}) {
|
|
2414
2431
|
if (typeof window > "u") return;
|
|
2415
2432
|
be();
|
|
2416
|
-
const k = Math.max(0,
|
|
2417
|
-
Math.max(0, Number.isFinite(
|
|
2433
|
+
const k = Math.max(0, me.value - r.value), ee = Math.min(
|
|
2434
|
+
Math.max(0, Number.isFinite(m) ? m : 0),
|
|
2418
2435
|
k
|
|
2419
|
-
),
|
|
2420
|
-
|
|
2436
|
+
), L = Math.max(0, u.value + ee), xe = w.behavior ?? "auto";
|
|
2437
|
+
xe === "auto" && (y.value = L), window.scrollTo({ ...w, top: L, behavior: xe });
|
|
2421
2438
|
}
|
|
2422
|
-
function
|
|
2439
|
+
function d(m, w = {}) {
|
|
2423
2440
|
if (typeof window > "u" || e.items.length === 0) return;
|
|
2424
2441
|
be();
|
|
2425
2442
|
const k = Math.min(
|
|
2426
2443
|
e.items.length - 1,
|
|
2427
|
-
Math.max(0, Math.floor(
|
|
2428
|
-
), { align:
|
|
2429
|
-
let
|
|
2430
|
-
|
|
2431
|
-
const
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
),
|
|
2435
|
-
|
|
2436
|
-
...
|
|
2437
|
-
top:
|
|
2438
|
-
behavior:
|
|
2444
|
+
Math.max(0, Math.floor(m))
|
|
2445
|
+
), { align: ee = "start", ...L } = w, xe = oe.value.sizes[k];
|
|
2446
|
+
let we = u.value + oe.value.offsets[k];
|
|
2447
|
+
ee === "center" ? we -= (r.value - xe) / 2 : ee === "end" && (we -= r.value - xe);
|
|
2448
|
+
const $e = Math.max(
|
|
2449
|
+
u.value,
|
|
2450
|
+
u.value + me.value - r.value
|
|
2451
|
+
), De = Math.max(0, Math.min(we, $e)), Ie = L.behavior ?? "auto";
|
|
2452
|
+
Ie === "auto" && (y.value = De), window.scrollTo({
|
|
2453
|
+
...L,
|
|
2454
|
+
top: De,
|
|
2455
|
+
behavior: Ie
|
|
2439
2456
|
});
|
|
2440
2457
|
}
|
|
2441
|
-
function
|
|
2442
|
-
typeof window > "u" || (be(), window.scrollTo({ top: Math.max(0,
|
|
2458
|
+
function K(m = "auto") {
|
|
2459
|
+
typeof window > "u" || (be(), window.scrollTo({ top: Math.max(0, u.value), behavior: m }));
|
|
2443
2460
|
}
|
|
2444
|
-
return
|
|
2461
|
+
return ye(
|
|
2445
2462
|
() => e.itemKey,
|
|
2446
2463
|
() => {
|
|
2447
|
-
|
|
2464
|
+
M.clear(), n.value += 1, G = -1;
|
|
2448
2465
|
}
|
|
2449
|
-
),
|
|
2450
|
-
() => e.items.map((
|
|
2451
|
-
async (
|
|
2452
|
-
const k =
|
|
2453
|
-
for (const
|
|
2454
|
-
|
|
2455
|
-
k && (G = -1), n.value += 1, await Z(),
|
|
2466
|
+
), ye(
|
|
2467
|
+
() => e.items.map((m, w) => Y(m, w)),
|
|
2468
|
+
async (m, w) => {
|
|
2469
|
+
const k = m.length !== w.length || m.some((L, xe) => L !== w[xe]), ee = new Set(m);
|
|
2470
|
+
for (const L of M.keys())
|
|
2471
|
+
ee.has(L) || M.delete(L);
|
|
2472
|
+
k && (G = -1), n.value += 1, await Z(), V && (be(), T());
|
|
2456
2473
|
}
|
|
2457
|
-
),
|
|
2474
|
+
), ye(
|
|
2458
2475
|
() => [e.hasMore, e.loading],
|
|
2459
|
-
async ([
|
|
2460
|
-
|
|
2476
|
+
async ([m]) => {
|
|
2477
|
+
m || (G = -1), await Z(), V && (be(), T());
|
|
2461
2478
|
}
|
|
2462
|
-
),
|
|
2463
|
-
if (
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
}),
|
|
2467
|
-
for (const [
|
|
2468
|
-
|
|
2479
|
+
), at(() => {
|
|
2480
|
+
if (V = !0, be(), window.addEventListener("scroll", de, { passive: !0 }), window.addEventListener("resize", v, { passive: !0 }), typeof ResizeObserver < "u") {
|
|
2481
|
+
b = new ResizeObserver(() => {
|
|
2482
|
+
ce();
|
|
2483
|
+
}), A = new ResizeObserver(Q), x.value && b.observe(x.value);
|
|
2484
|
+
for (const [m] of R)
|
|
2485
|
+
A.observe(m);
|
|
2469
2486
|
}
|
|
2470
2487
|
Z(() => {
|
|
2471
|
-
|
|
2488
|
+
V && T();
|
|
2472
2489
|
});
|
|
2473
|
-
}), $t(
|
|
2474
|
-
|
|
2490
|
+
}), $t(ge), Xe(() => {
|
|
2491
|
+
V = !1, window.removeEventListener("scroll", de), window.removeEventListener("resize", v), H(C), H($), C = void 0, $ = void 0, B = !1, D.clear(), b && (b.disconnect(), b = void 0), A && (A.disconnect(), A = void 0), R.clear();
|
|
2475
2492
|
}), s({
|
|
2476
|
-
scrollTo:
|
|
2477
|
-
scrollToIndex:
|
|
2478
|
-
scrollToTop:
|
|
2479
|
-
}), (
|
|
2493
|
+
scrollTo: Ee,
|
|
2494
|
+
scrollToIndex: d,
|
|
2495
|
+
scrollToTop: K
|
|
2496
|
+
}), (m, w) => (j(), U("div", {
|
|
2480
2497
|
ref_key: "root",
|
|
2481
|
-
ref:
|
|
2482
|
-
class:
|
|
2498
|
+
ref: x,
|
|
2499
|
+
class: st(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": f(ae) }]),
|
|
2483
2500
|
role: "list",
|
|
2484
2501
|
"aria-label": t.ariaLabel,
|
|
2485
|
-
onTouchstartPassive:
|
|
2486
|
-
(...k) => f(
|
|
2487
|
-
onTouchmove:
|
|
2488
|
-
(...k) => f(xe) && f(xe)(...k)),
|
|
2489
|
-
onTouchend: z[2] || (z[2] = //@ts-ignore
|
|
2502
|
+
onTouchstartPassive: w[0] || (w[0] = //@ts-ignore
|
|
2503
|
+
(...k) => f(fe) && f(fe)(...k)),
|
|
2504
|
+
onTouchmove: w[1] || (w[1] = //@ts-ignore
|
|
2490
2505
|
(...k) => f(he) && f(he)(...k)),
|
|
2491
|
-
|
|
2492
|
-
(...k) => f(
|
|
2506
|
+
onTouchend: w[2] || (w[2] = //@ts-ignore
|
|
2507
|
+
(...k) => f(ve) && f(ve)(...k)),
|
|
2508
|
+
onTouchcancel: w[3] || (w[3] = //@ts-ignore
|
|
2509
|
+
(...k) => f(J) && f(J)(...k))
|
|
2493
2510
|
}, [
|
|
2494
2511
|
t.pullToRefresh || t.refreshing ? (j(), U("div", {
|
|
2495
2512
|
key: 0,
|
|
2496
2513
|
class: "vue-window-dynamic-virtual-scroll__refresh",
|
|
2497
|
-
style:
|
|
2498
|
-
height: `${f(
|
|
2499
|
-
transform: `translateY(${f(
|
|
2514
|
+
style: re({
|
|
2515
|
+
height: `${f(ue)}px`,
|
|
2516
|
+
transform: `translateY(${f(le) - f(ue)}px)`
|
|
2500
2517
|
}),
|
|
2501
2518
|
role: "status",
|
|
2502
2519
|
"aria-live": "polite"
|
|
2503
2520
|
}, [
|
|
2504
|
-
Se(
|
|
2521
|
+
Se(m.$slots, "refresh", {
|
|
2505
2522
|
pullDistance: f(ne),
|
|
2506
2523
|
progress: f(ie),
|
|
2507
2524
|
refreshing: t.refreshing
|
|
2508
2525
|
}, () => [
|
|
2509
|
-
|
|
2526
|
+
Ge(ht(f(te)), 1)
|
|
2510
2527
|
])
|
|
2511
|
-
], 4)) :
|
|
2528
|
+
], 4)) : Re("", !0),
|
|
2512
2529
|
t.items.length || t.loading ? (j(), U("div", {
|
|
2513
2530
|
key: 1,
|
|
2514
2531
|
class: "vue-window-dynamic-virtual-scroll__spacer",
|
|
2515
|
-
style:
|
|
2516
|
-
height: `${
|
|
2517
|
-
transform: `translateY(${f(
|
|
2532
|
+
style: re({
|
|
2533
|
+
height: `${me.value}px`,
|
|
2534
|
+
transform: `translateY(${f(le)}px)`
|
|
2518
2535
|
})
|
|
2519
2536
|
}, [
|
|
2520
|
-
(j(!0), U(
|
|
2521
|
-
key:
|
|
2537
|
+
(j(!0), U(et, null, nt(ze.value, ({ item: k, index: ee, key: L, top: xe }) => (j(), U("div", {
|
|
2538
|
+
key: L,
|
|
2522
2539
|
ref_for: !0,
|
|
2523
|
-
ref: (
|
|
2540
|
+
ref: (we) => ke(we, L),
|
|
2524
2541
|
class: "vue-window-dynamic-virtual-scroll__item",
|
|
2525
|
-
style:
|
|
2542
|
+
style: re({ transform: `translateY(${xe}px)` }),
|
|
2526
2543
|
role: "listitem",
|
|
2527
|
-
"aria-posinset":
|
|
2544
|
+
"aria-posinset": ee + 1,
|
|
2528
2545
|
"aria-setsize": t.items.length
|
|
2529
2546
|
}, [
|
|
2530
|
-
Se(
|
|
2547
|
+
Se(m.$slots, "default", {
|
|
2531
2548
|
item: k,
|
|
2532
|
-
index:
|
|
2549
|
+
index: ee
|
|
2533
2550
|
})
|
|
2534
2551
|
], 12, ba))), 128)),
|
|
2535
2552
|
t.loading ? (j(), U("div", {
|
|
2536
2553
|
key: 0,
|
|
2537
2554
|
class: "vue-window-dynamic-virtual-scroll__loading",
|
|
2538
|
-
style:
|
|
2539
|
-
height: `${
|
|
2540
|
-
transform: `translateY(${
|
|
2555
|
+
style: re({
|
|
2556
|
+
height: `${S.value}px`,
|
|
2557
|
+
transform: `translateY(${oe.value.total}px)`
|
|
2541
2558
|
}),
|
|
2542
2559
|
role: "status",
|
|
2543
2560
|
"aria-live": "polite"
|
|
2544
2561
|
}, [
|
|
2545
|
-
Se(
|
|
2546
|
-
|
|
2562
|
+
Se(m.$slots, "loading", {}, () => [
|
|
2563
|
+
w[4] || (w[4] = Ge("Loading more…", -1))
|
|
2547
2564
|
])
|
|
2548
|
-
], 4)) :
|
|
2565
|
+
], 4)) : Re("", !0)
|
|
2549
2566
|
], 4)) : (j(), U("div", {
|
|
2550
2567
|
key: 2,
|
|
2551
2568
|
class: "vue-window-dynamic-virtual-scroll__empty",
|
|
2552
|
-
style:
|
|
2569
|
+
style: re({ transform: `translateY(${f(le)}px)` })
|
|
2553
2570
|
}, [
|
|
2554
|
-
Se(
|
|
2571
|
+
Se(m.$slots, "empty")
|
|
2555
2572
|
], 4))
|
|
2556
2573
|
], 42, Ta));
|
|
2557
2574
|
}
|
|
2558
|
-
}), Ia = ["aria-label"], za = ["aria-posinset", "aria-setsize"], ka = /* @__PURE__ */
|
|
2575
|
+
}), Ia = ["aria-label"], za = ["aria-posinset", "aria-setsize"], ka = /* @__PURE__ */ tt({
|
|
2559
2576
|
name: "WindowGirdVirtualScroll",
|
|
2560
2577
|
__name: "WindowGirdVirtualScroll",
|
|
2561
2578
|
props: {
|
|
@@ -2576,132 +2593,132 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
2576
2593
|
},
|
|
2577
2594
|
emits: ["scroll", "loadMore", "refresh"],
|
|
2578
2595
|
setup(t, { expose: s, emit: I }) {
|
|
2579
|
-
const e = t,
|
|
2580
|
-
let n,
|
|
2581
|
-
const { getItemKey:
|
|
2596
|
+
const e = t, z = I, x = X(), y = X(0), r = X(0), u = X(0);
|
|
2597
|
+
let n, M = -1;
|
|
2598
|
+
const { getItemKey: R } = lt({
|
|
2582
2599
|
componentName: "WindowGirdVirtualScroll",
|
|
2583
2600
|
items: () => e.items,
|
|
2584
2601
|
itemKey: () => e.itemKey
|
|
2585
2602
|
}), {
|
|
2586
|
-
pulling:
|
|
2587
|
-
pullDistance:
|
|
2588
|
-
pullOffset:
|
|
2589
|
-
pullProgress:
|
|
2590
|
-
refreshMessage:
|
|
2603
|
+
pulling: D,
|
|
2604
|
+
pullDistance: b,
|
|
2605
|
+
pullOffset: A,
|
|
2606
|
+
pullProgress: C,
|
|
2607
|
+
refreshMessage: $,
|
|
2591
2608
|
refreshThreshold: B,
|
|
2592
|
-
handleTouchStart:
|
|
2609
|
+
handleTouchStart: V,
|
|
2593
2610
|
handleTouchMove: G,
|
|
2594
|
-
handleTouchEnd:
|
|
2595
|
-
handleTouchCancel:
|
|
2611
|
+
handleTouchEnd: Y,
|
|
2612
|
+
handleTouchCancel: se
|
|
2596
2613
|
} = xt({
|
|
2597
2614
|
enabled: () => e.pullToRefresh,
|
|
2598
2615
|
refreshing: () => e.refreshing,
|
|
2599
2616
|
threshold: () => e.pullRefreshThreshold,
|
|
2600
|
-
onRefresh: () =>
|
|
2617
|
+
onRefresh: () => z("refresh"),
|
|
2601
2618
|
scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
|
|
2602
|
-
}),
|
|
2619
|
+
}), H = h(() => Math.max(1, e.itemSize)), ae = h(
|
|
2603
2620
|
() => Math.max(1, Math.floor(e.columns))
|
|
2604
|
-
), ne =
|
|
2605
|
-
() => Math.max(1, e.loadingItemSize ??
|
|
2606
|
-
),
|
|
2607
|
-
() =>
|
|
2608
|
-
),
|
|
2609
|
-
() => Math.ceil(e.items.length /
|
|
2610
|
-
),
|
|
2611
|
-
() =>
|
|
2612
|
-
),
|
|
2613
|
-
() =>
|
|
2614
|
-
),
|
|
2615
|
-
() => Math.max(0,
|
|
2616
|
-
),
|
|
2621
|
+
), ne = h(() => Math.max(0, e.gap)), le = h(() => Math.max(0, Math.floor(e.overscan))), ie = h(
|
|
2622
|
+
() => Math.max(1, e.loadingItemSize ?? H.value)
|
|
2623
|
+
), te = h(
|
|
2624
|
+
() => H.value + ne.value
|
|
2625
|
+
), ue = h(
|
|
2626
|
+
() => Math.ceil(e.items.length / ae.value)
|
|
2627
|
+
), fe = h(() => ue.value === 0 ? 0 : ue.value * H.value + (ue.value - 1) * ne.value), he = h(
|
|
2628
|
+
() => fe.value + (e.items.length ? ne.value : 0)
|
|
2629
|
+
), ve = h(
|
|
2630
|
+
() => fe.value + (e.loading ? ie.value + (e.items.length ? ne.value : 0) : 0)
|
|
2631
|
+
), J = h(
|
|
2632
|
+
() => Math.max(0, y.value - u.value)
|
|
2633
|
+
), O = h(
|
|
2617
2634
|
() => Math.max(
|
|
2618
2635
|
0,
|
|
2619
|
-
Math.floor(
|
|
2636
|
+
Math.floor(J.value / te.value) - le.value
|
|
2620
2637
|
)
|
|
2621
|
-
),
|
|
2622
|
-
if (
|
|
2623
|
-
const
|
|
2624
|
-
|
|
2625
|
-
|
|
2638
|
+
), S = h(() => {
|
|
2639
|
+
if (ue.value === 0) return 0;
|
|
2640
|
+
const ce = Math.max(
|
|
2641
|
+
H.value,
|
|
2642
|
+
y.value + r.value - u.value
|
|
2626
2643
|
), de = Math.ceil(
|
|
2627
|
-
(
|
|
2644
|
+
(ce + ne.value) / te.value
|
|
2628
2645
|
);
|
|
2629
2646
|
return Math.min(
|
|
2630
|
-
|
|
2631
|
-
de +
|
|
2647
|
+
ue.value,
|
|
2648
|
+
de + le.value
|
|
2632
2649
|
);
|
|
2633
|
-
}),
|
|
2634
|
-
() => Math.min(e.items.length,
|
|
2635
|
-
),
|
|
2636
|
-
() => Math.min(e.items.length,
|
|
2637
|
-
),
|
|
2638
|
-
() => e.items.slice(
|
|
2639
|
-
const v =
|
|
2650
|
+
}), P = h(
|
|
2651
|
+
() => Math.min(e.items.length, O.value * ae.value)
|
|
2652
|
+
), oe = h(
|
|
2653
|
+
() => Math.min(e.items.length, S.value * ae.value)
|
|
2654
|
+
), me = h(
|
|
2655
|
+
() => e.items.slice(P.value, oe.value).map((ce, de) => {
|
|
2656
|
+
const v = P.value + de;
|
|
2640
2657
|
return {
|
|
2641
|
-
item:
|
|
2658
|
+
item: ce,
|
|
2642
2659
|
index: v,
|
|
2643
|
-
key:
|
|
2644
|
-
rowIndex: Math.floor(v /
|
|
2645
|
-
columnIndex: v %
|
|
2660
|
+
key: R(ce, v),
|
|
2661
|
+
rowIndex: Math.floor(v / ae.value),
|
|
2662
|
+
columnIndex: v % ae.value
|
|
2646
2663
|
};
|
|
2647
2664
|
})
|
|
2648
|
-
),
|
|
2649
|
-
gridTemplateColumns: `repeat(${
|
|
2665
|
+
), Ae = h(() => ({
|
|
2666
|
+
gridTemplateColumns: `repeat(${ae.value}, minmax(0, 1fr))`,
|
|
2650
2667
|
columnGap: `${ne.value}px`,
|
|
2651
2668
|
rowGap: `${ne.value}px`,
|
|
2652
|
-
transform: `translateY(${
|
|
2669
|
+
transform: `translateY(${O.value * te.value}px)`
|
|
2653
2670
|
}));
|
|
2654
|
-
function
|
|
2655
|
-
typeof window > "u" || (
|
|
2671
|
+
function E() {
|
|
2672
|
+
typeof window > "u" || (y.value = Math.max(0, window.scrollY), r.value = window.innerHeight, x.value && (u.value = x.value.getBoundingClientRect().top + y.value));
|
|
2656
2673
|
}
|
|
2657
|
-
function
|
|
2658
|
-
|
|
2659
|
-
scrollTop:
|
|
2660
|
-
startIndex:
|
|
2661
|
-
endIndex:
|
|
2674
|
+
function F() {
|
|
2675
|
+
z("scroll", {
|
|
2676
|
+
scrollTop: J.value,
|
|
2677
|
+
startIndex: P.value,
|
|
2678
|
+
endIndex: oe.value
|
|
2662
2679
|
});
|
|
2663
2680
|
}
|
|
2664
|
-
function
|
|
2665
|
-
|
|
2681
|
+
function _() {
|
|
2682
|
+
E(), F(), pe();
|
|
2666
2683
|
}
|
|
2667
|
-
function
|
|
2668
|
-
if (typeof window > "u" || !e.hasMore || e.loading ||
|
|
2684
|
+
function pe() {
|
|
2685
|
+
if (typeof window > "u" || !e.hasMore || e.loading || M === e.items.length)
|
|
2669
2686
|
return;
|
|
2670
|
-
const
|
|
2671
|
-
de - v <=
|
|
2687
|
+
const ce = Math.max(0, e.loadMoreThreshold), de = u.value + ve.value, v = y.value + r.value;
|
|
2688
|
+
de - v <= ce && (M = e.items.length, z("loadMore"));
|
|
2672
2689
|
}
|
|
2673
|
-
function
|
|
2690
|
+
function ze(ce, de = {}) {
|
|
2674
2691
|
if (typeof window > "u") return;
|
|
2675
|
-
|
|
2676
|
-
const v = Math.max(0,
|
|
2677
|
-
Math.max(0, Number.isFinite(
|
|
2692
|
+
E();
|
|
2693
|
+
const v = Math.max(0, ve.value - r.value), T = Math.min(
|
|
2694
|
+
Math.max(0, Number.isFinite(ce) ? ce : 0),
|
|
2678
2695
|
v
|
|
2679
|
-
),
|
|
2680
|
-
q === "auto" && (
|
|
2696
|
+
), i = Math.max(0, u.value + T), q = de.behavior ?? "auto";
|
|
2697
|
+
q === "auto" && (y.value = i), window.scrollTo({ ...de, top: i, behavior: q });
|
|
2681
2698
|
}
|
|
2682
|
-
function be(
|
|
2699
|
+
function be(ce, de = {}) {
|
|
2683
2700
|
if (typeof window > "u" || e.items.length === 0) return;
|
|
2684
|
-
|
|
2701
|
+
E();
|
|
2685
2702
|
const v = Math.min(
|
|
2686
2703
|
e.items.length - 1,
|
|
2687
|
-
Math.max(0, Math.floor(
|
|
2688
|
-
), T = Math.floor(v /
|
|
2689
|
-
let Q =
|
|
2690
|
-
|
|
2691
|
-
const
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
),
|
|
2695
|
-
|
|
2704
|
+
Math.max(0, Math.floor(ce))
|
|
2705
|
+
), T = Math.floor(v / ae.value), { align: i = "start", ...q } = de;
|
|
2706
|
+
let Q = u.value + T * te.value;
|
|
2707
|
+
i === "center" ? Q -= (r.value - H.value) / 2 : i === "end" && (Q -= r.value - H.value);
|
|
2708
|
+
const ke = Math.max(
|
|
2709
|
+
u.value,
|
|
2710
|
+
u.value + ve.value - r.value
|
|
2711
|
+
), ge = Math.max(0, Math.min(Q, ke)), Ee = q.behavior ?? "auto";
|
|
2712
|
+
Ee === "auto" && (y.value = ge), window.scrollTo({
|
|
2696
2713
|
...q,
|
|
2697
|
-
top:
|
|
2698
|
-
behavior:
|
|
2714
|
+
top: ge,
|
|
2715
|
+
behavior: Ee
|
|
2699
2716
|
});
|
|
2700
2717
|
}
|
|
2701
|
-
function
|
|
2702
|
-
typeof window > "u" || (
|
|
2718
|
+
function Me(ce = "auto") {
|
|
2719
|
+
typeof window > "u" || (E(), window.scrollTo({ top: Math.max(0, u.value), behavior: ce }));
|
|
2703
2720
|
}
|
|
2704
|
-
return
|
|
2721
|
+
return ye(
|
|
2705
2722
|
() => [
|
|
2706
2723
|
e.items.length,
|
|
2707
2724
|
e.itemSize,
|
|
@@ -2709,77 +2726,77 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
2709
2726
|
e.gap
|
|
2710
2727
|
],
|
|
2711
2728
|
async () => {
|
|
2712
|
-
await Z(),
|
|
2729
|
+
await Z(), E(), pe();
|
|
2713
2730
|
}
|
|
2714
|
-
),
|
|
2731
|
+
), ye(
|
|
2715
2732
|
() => [e.hasMore, e.loading],
|
|
2716
|
-
async ([
|
|
2717
|
-
|
|
2733
|
+
async ([ce]) => {
|
|
2734
|
+
ce || (M = -1), await Z(), E(), pe();
|
|
2718
2735
|
}
|
|
2719
|
-
),
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
}),
|
|
2723
|
-
}),
|
|
2724
|
-
window.removeEventListener("scroll",
|
|
2736
|
+
), at(() => {
|
|
2737
|
+
E(), window.addEventListener("scroll", _, { passive: !0 }), window.addEventListener("resize", _, { passive: !0 }), typeof ResizeObserver < "u" && (n = new ResizeObserver(() => {
|
|
2738
|
+
E(), pe();
|
|
2739
|
+
}), x.value && n.observe(x.value)), Z(pe);
|
|
2740
|
+
}), Xe(() => {
|
|
2741
|
+
window.removeEventListener("scroll", _), window.removeEventListener("resize", _), n && (n.disconnect(), n = void 0);
|
|
2725
2742
|
}), s({
|
|
2726
|
-
scrollTo:
|
|
2743
|
+
scrollTo: ze,
|
|
2727
2744
|
scrollToIndex: be,
|
|
2728
|
-
scrollToTop:
|
|
2729
|
-
}), (
|
|
2745
|
+
scrollToTop: Me
|
|
2746
|
+
}), (ce, de) => (j(), U("div", {
|
|
2730
2747
|
ref_key: "root",
|
|
2731
|
-
ref:
|
|
2732
|
-
class:
|
|
2748
|
+
ref: x,
|
|
2749
|
+
class: st(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": f(D) }]),
|
|
2733
2750
|
role: "list",
|
|
2734
2751
|
"aria-label": t.ariaLabel,
|
|
2735
2752
|
onTouchstartPassive: de[0] || (de[0] = //@ts-ignore
|
|
2736
|
-
(...v) => f(
|
|
2753
|
+
(...v) => f(V) && f(V)(...v)),
|
|
2737
2754
|
onTouchmove: de[1] || (de[1] = //@ts-ignore
|
|
2738
2755
|
(...v) => f(G) && f(G)(...v)),
|
|
2739
2756
|
onTouchend: de[2] || (de[2] = //@ts-ignore
|
|
2740
|
-
(...v) => f(
|
|
2757
|
+
(...v) => f(Y) && f(Y)(...v)),
|
|
2741
2758
|
onTouchcancel: de[3] || (de[3] = //@ts-ignore
|
|
2742
|
-
(...v) => f(
|
|
2759
|
+
(...v) => f(se) && f(se)(...v))
|
|
2743
2760
|
}, [
|
|
2744
2761
|
t.pullToRefresh || t.refreshing ? (j(), U("div", {
|
|
2745
2762
|
key: 0,
|
|
2746
2763
|
class: "vue-window-gird-virtual-scroll__refresh",
|
|
2747
|
-
style:
|
|
2764
|
+
style: re({
|
|
2748
2765
|
height: `${f(B)}px`,
|
|
2749
|
-
transform: `translateY(${f(
|
|
2766
|
+
transform: `translateY(${f(A) - f(B)}px)`
|
|
2750
2767
|
}),
|
|
2751
2768
|
role: "status",
|
|
2752
2769
|
"aria-live": "polite"
|
|
2753
2770
|
}, [
|
|
2754
|
-
Se(
|
|
2755
|
-
pullDistance: f(
|
|
2756
|
-
progress: f(
|
|
2771
|
+
Se(ce.$slots, "refresh", {
|
|
2772
|
+
pullDistance: f(b),
|
|
2773
|
+
progress: f(C),
|
|
2757
2774
|
refreshing: t.refreshing
|
|
2758
2775
|
}, () => [
|
|
2759
|
-
|
|
2776
|
+
Ge(ht(f($)), 1)
|
|
2760
2777
|
])
|
|
2761
|
-
], 4)) :
|
|
2778
|
+
], 4)) : Re("", !0),
|
|
2762
2779
|
t.items.length || t.loading ? (j(), U("div", {
|
|
2763
2780
|
key: 1,
|
|
2764
2781
|
class: "vue-window-gird-virtual-scroll__spacer",
|
|
2765
|
-
style:
|
|
2766
|
-
height: `${
|
|
2767
|
-
transform: `translateY(${f(
|
|
2782
|
+
style: re({
|
|
2783
|
+
height: `${ve.value}px`,
|
|
2784
|
+
transform: `translateY(${f(A)}px)`
|
|
2768
2785
|
})
|
|
2769
2786
|
}, [
|
|
2770
|
-
|
|
2787
|
+
rt("div", {
|
|
2771
2788
|
class: "vue-window-gird-virtual-scroll__content",
|
|
2772
|
-
style:
|
|
2789
|
+
style: re(Ae.value)
|
|
2773
2790
|
}, [
|
|
2774
|
-
(j(!0), U(
|
|
2775
|
-
key:
|
|
2791
|
+
(j(!0), U(et, null, nt(me.value, ({ item: v, index: T, key: i, rowIndex: q, columnIndex: Q }) => (j(), U("div", {
|
|
2792
|
+
key: i,
|
|
2776
2793
|
class: "vue-window-gird-virtual-scroll__item",
|
|
2777
|
-
style:
|
|
2794
|
+
style: re({ height: `${H.value}px` }),
|
|
2778
2795
|
role: "listitem",
|
|
2779
2796
|
"aria-posinset": T + 1,
|
|
2780
2797
|
"aria-setsize": t.items.length
|
|
2781
2798
|
}, [
|
|
2782
|
-
Se(
|
|
2799
|
+
Se(ce.$slots, "default", {
|
|
2783
2800
|
item: v,
|
|
2784
2801
|
index: T,
|
|
2785
2802
|
rowIndex: q,
|
|
@@ -2790,29 +2807,29 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
2790
2807
|
t.loading ? (j(), U("div", {
|
|
2791
2808
|
key: 0,
|
|
2792
2809
|
class: "vue-window-gird-virtual-scroll__loading",
|
|
2793
|
-
style:
|
|
2810
|
+
style: re({
|
|
2794
2811
|
height: `${ie.value}px`,
|
|
2795
|
-
transform: `translateY(${
|
|
2812
|
+
transform: `translateY(${he.value}px)`
|
|
2796
2813
|
}),
|
|
2797
2814
|
role: "status",
|
|
2798
2815
|
"aria-live": "polite"
|
|
2799
2816
|
}, [
|
|
2800
|
-
Se(
|
|
2801
|
-
de[4] || (de[4] =
|
|
2817
|
+
Se(ce.$slots, "loading", {}, () => [
|
|
2818
|
+
de[4] || (de[4] = Ge("Loading more…", -1))
|
|
2802
2819
|
])
|
|
2803
|
-
], 4)) :
|
|
2820
|
+
], 4)) : Re("", !0)
|
|
2804
2821
|
], 4)) : (j(), U("div", {
|
|
2805
2822
|
key: 2,
|
|
2806
2823
|
class: "vue-window-gird-virtual-scroll__empty",
|
|
2807
|
-
style:
|
|
2824
|
+
style: re({ transform: `translateY(${f(A)}px)` })
|
|
2808
2825
|
}, [
|
|
2809
|
-
Se(
|
|
2826
|
+
Se(ce.$slots, "empty")
|
|
2810
2827
|
], 4))
|
|
2811
2828
|
], 42, Ia));
|
|
2812
2829
|
}
|
|
2813
|
-
}), $a =
|
|
2830
|
+
}), $a = Dt, La = {
|
|
2814
2831
|
install(t) {
|
|
2815
|
-
t.component("ChatVirtualScroll", Zt), t.component("DynamicVirtualScroll",
|
|
2832
|
+
t.component("ChatVirtualScroll", Zt), t.component("DynamicVirtualScroll", Dt), t.component("ShortMediaFeed", la), t.component("SkeletonLoader", sa), t.component("VirtualCarousel", ya), t.component("VirtualList", $a), t.component("VirtualScroll", xa), t.component(
|
|
2816
2833
|
"WindowDynamicVirtualScroll",
|
|
2817
2834
|
Sa
|
|
2818
2835
|
), t.component(
|
|
@@ -2823,12 +2840,12 @@ const ha = ["dir", "aria-label"], ga = ["data-carousel-index", "aria-label", "ar
|
|
|
2823
2840
|
};
|
|
2824
2841
|
export {
|
|
2825
2842
|
Zt as ChatVirtualScroll,
|
|
2826
|
-
|
|
2843
|
+
Dt as DynamicVirtualScroll,
|
|
2827
2844
|
la as ShortMediaFeed,
|
|
2828
2845
|
sa as SkeletonLoader,
|
|
2829
2846
|
ya as VirtualCarousel,
|
|
2830
2847
|
$a as VirtualList,
|
|
2831
|
-
|
|
2848
|
+
xa as VirtualScroll,
|
|
2832
2849
|
La as VueVirtualScroll,
|
|
2833
2850
|
Sa as WindowDynamicVirtualScroll,
|
|
2834
2851
|
ka as WindowGirdVirtualScroll,
|