Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# svelte-virtual-scroll-list changelog

## 1.3.0
## 1.1.2

- Expose `index` from VirtualScroll component
- fixed bug - list was not scrolling to desired start/offset position on mount

## 1.2.0
## 1.1.1

- Move example to SvelteKit
- Package distribution by SvelteKit too
- Add classes on VS wrappers
- Add example for horizontal scroll
- Fix pageMode with SSR
- Support Svelte 4
- fixed bug - incorrect function parameters on item resize

## 1.1.0

- upgraded to Svelte 5

## 1.0.1

- Fixed issue where data changes wouldn't refresh the item contents

## 1.0.0

- Forked and heavily modified from original package svelte-virtual-scroll-list
36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
# svelte-virtual-scroll-list

[![npm](https://img.shields.io/npm/v/svelte-virtual-scroll-list?style=for-the-badge)](https://npmjs.com/package/svelte-virtual-scroll-list/)
[![npm](https://img.shields.io/npm/v/@josesan9/svelte-virtual-scroll-list?style=for-the-badge)](https://npmjs.com/package/@josesan9/svelte-virtual-scroll-list/)

Svelte implementation of vue library [vue-virtual-scroll-list](https://github.com/tangbc/vue-virtual-scroll-list)
fork of same library by v1ack [svelte-virtual-scroll-list](https://github.com/v1ack/svelte-virtual-scroll-list)

Virtualized scrolling for big lists
This library has been upgraded to use Svelte 5. For Svelte 3.5 & 4 install v1.0.1

---
**Support dynamic both-directional lists** (see example)

---

Online demo: [https://v1ack.github.io/svelte-virtual-scroll-list/](https://v1ack.github.io/svelte-virtual-scroll-list/)

[Simple example in Svelte REPL](https://ru.svelte.dev/repl/eae82aab17b04420885851d58de50a2e?version=3.38.2)
Virtualized scrolling for big lists. For now this does not support bi-directionality (unlike v1ach's implementation)

# Getting started

## Installing from npm
`npm i josesan9/svelte-virtual-scroll-list -D`

`npm i svelte-virtual-scroll-list -D`

or

`yarn add svelte-virtual-scroll-list -D`

## Using
## Usage

```html

Expand Down Expand Up @@ -61,7 +49,7 @@ More examples available in `example` folder
|---------------------------|----------------------------|---------------------|----------------------------------|
| handle dynamic size data | + | + | - |
| scroll methods (to index) | + | - | + |
| infinity scrolling | two-directional | - | one-directional with another lib |
| infinity scrolling | + | - | one-directional with another lib |
| initial scroll position | + | - | + |
| sticky items | - | - | + |
| top/bottom slots | + | - | + |
Expand All @@ -82,6 +70,7 @@ More examples available in `example` folder
| pageMode | boolean | `false` | Let virtual list using global document to scroll through the list |
| start | number | `0` | scroll position start index |
| offset | number | `0` | scroll position offset |
| overflow | number | `5` | the number of items to render outside of view |
| topThreshold | number | `0` | The threshold to emit `top` event, attention to multiple calls. |
| bottomThreshold | number | `0` | The threshold to emit `bottom` event, attention to multiple calls. |

Expand Down Expand Up @@ -125,7 +114,13 @@ Access to methods by component binding

## Additional

### Get index of current rendering items
### Params passed down to each virtual list item

| param | description |
|------------|------------------------------------------------------|
| data | data item |
| index | index of item (in relation to full list) |
| localIndex | index of item (in relation to rendered items only) |

```html

Expand All @@ -134,6 +129,7 @@ Access to methods by component binding
key="id"
let:data
let:index
let:localIndex
>
<div>
{data.text} {index}
Expand Down
Loading