virtua 0.48.7 → 0.49.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/lib/core/index.cjs +8 -2
- package/lib/core/index.cjs.map +1 -1
- package/lib/core/index.js +110 -104
- package/lib/core/index.js.map +1 -1
- package/lib/index.cjs +8 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +8 -2
- package/lib/index.js.map +1 -1
- package/lib/solid/index.cjs +10 -6
- package/lib/solid/index.cjs.map +1 -1
- package/lib/solid/index.js +14 -9
- package/lib/solid/index.js.map +1 -1
- package/lib/solid/index.jsx +26 -13
- package/lib/solid/index.jsx.map +1 -1
- package/lib/vue/VList.d.ts +22 -122
- package/lib/vue/Virtualizer.d.ts +65 -148
- package/lib/vue/WindowVirtualizer.d.ts +52 -106
- package/lib/vue/index.cjs +70 -64
- package/lib/vue/index.cjs.map +1 -1
- package/lib/vue/index.d.ts +3 -0
- package/lib/vue/index.js +8 -2
- package/lib/vue/index.js.map +1 -1
- package/lib/vue/utils.d.ts +2 -2
- package/package.json +30 -30
package/lib/solid/index.jsx
CHANGED
|
@@ -473,21 +473,34 @@ const createVirtualStore = (elementsCount, itemSize = 40, ssrCount = 0, cacheSna
|
|
|
473
473
|
}
|
|
474
474
|
// Calculate jump by resize to minimize junks in appearance
|
|
475
475
|
applyJump(updated.reduce((acc, [index, size]) => {
|
|
476
|
+
let shouldKeep;
|
|
476
477
|
if (
|
|
477
478
|
// Keep distance from end during shifting
|
|
478
|
-
_scrollMode === SCROLL_BY_SHIFT
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
479
|
+
_scrollMode === SCROLL_BY_SHIFT) {
|
|
480
|
+
shouldKeep = true;
|
|
481
|
+
}
|
|
482
|
+
else if (_frozenRange &&
|
|
483
|
+
_scrollMode === SCROLL_BY_MANUAL_SCROLL) {
|
|
484
|
+
// https://github.com/inokawa/virtua/issues/380
|
|
485
|
+
// https://github.com/inokawa/virtua/issues/758
|
|
486
|
+
shouldKeep = index < _frozenRange[0];
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
// Otherwise we should maintain visible position
|
|
490
|
+
const start = getRelativeScrollOffset();
|
|
491
|
+
const itemOffset = getItemOffset$1(index);
|
|
492
|
+
const itemSize = getItemSize$1(index);
|
|
493
|
+
shouldKeep =
|
|
494
|
+
_scrollDirection !== SCROLL_DOWN &&
|
|
495
|
+
_scrollMode === SCROLL_BY_NATIVE
|
|
496
|
+
? // https://github.com/inokawa/virtua/issues/385
|
|
497
|
+
// https://github.com/inokawa/virtua/discussions/865
|
|
498
|
+
itemOffset + itemSize < start
|
|
499
|
+
: // https://github.com/inokawa/virtua/pull/868
|
|
500
|
+
itemOffset < start &&
|
|
501
|
+
itemOffset + itemSize < start + viewportSize;
|
|
502
|
+
}
|
|
503
|
+
if (shouldKeep) {
|
|
491
504
|
acc += size - getItemSize$1(index);
|
|
492
505
|
}
|
|
493
506
|
return acc;
|