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