virtua 0.30.5 → 0.31.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/README.md +30 -4
- package/lib/index.js.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/react/Virtualizer.d.ts +1 -1
- package/lib/react/WindowVirtualizer.d.ts +1 -1
- package/lib/solid/index.js.map +1 -1
- package/lib/solid/index.mjs.map +1 -1
- package/lib/svelte/ListItem.svelte +42 -0
- package/lib/svelte/ListItem.svelte.d.ts +23 -0
- package/lib/svelte/VList.svelte +238 -0
- package/lib/svelte/VList.svelte.d.ts +91 -0
- package/lib/svelte/core.d.ts +45 -0
- package/lib/svelte/core.js +1 -0
- package/lib/svelte/index.d.ts +4 -0
- package/lib/svelte/index.js +4 -0
- package/lib/svelte/utils.d.ts +10 -0
- package/lib/svelte/utils.js +17 -0
- package/lib/vue/index.js.map +1 -1
- package/lib/vue/index.mjs.map +1 -1
- package/package.json +22 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
   [](https://bestofjs.org/projects/virtua) [](https://github.com/inokawa/virtua/actions/workflows/check.yml) [](https://github.com/inokawa/virtua/actions/workflows/demo.yml)
|
|
4
4
|
|
|
5
|
-
> A zero-config, fast and small (~3kB) virtual list (and grid) component for [React](https://github.com/facebook/react), [Vue](https://vuejs.org/)
|
|
5
|
+
> A zero-config, fast and small (~3kB) virtual list (and grid) component for [React](https://github.com/facebook/react), [Vue](https://vuejs.org/), [Solid](https://www.solidjs.com/) and [Svelte](https://svelte.dev/).
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ This project is a challenge to rethink virtualization. The goals are...
|
|
|
16
16
|
- **Fast:** Natural virtual scrolling needs optimization in many aspects (eliminate frame drops by reducing CPU usage and GC and [layout recalculation](https://gist.github.com/paulirish/5d52fb081b3570c81e3a), reduce visual jumps on repaint, optimize with CSS, optimize for frameworks, etc). We are trying to combine the best of them.
|
|
17
17
|
- **Small:** Its bundle size should be small as much as possible to be friendly with modern web development. Currently each components are ~3kB gzipped and tree-shakeable. The total size for React is [~5kB gzipped](https://bundlephobia.com/package/virtua).
|
|
18
18
|
- **Flexible:** Aiming to support many usecases - fixed size, dynamic size, horizontal scrolling, reverse scrolling, RTL, mobile, infinite scrolling, scroll restoration, DnD, keyboard navigation, sticky, placeholder and more. See [live demo](#demo).
|
|
19
|
-
- **Framework agnostic:** [React](https://react.dev/), [Vue](https://vuejs.org/)
|
|
19
|
+
- **Framework agnostic:** [React](https://react.dev/), [Vue](https://vuejs.org/), [Solid](https://www.solidjs.com/) and [Svelte](https://svelte.dev/) are supported. We could support other frameworks in the future.
|
|
20
20
|
|
|
21
21
|
## Demo
|
|
22
22
|
|
|
@@ -253,6 +253,32 @@ export const App = () => {
|
|
|
253
253
|
};
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
+
### Svelte
|
|
257
|
+
|
|
258
|
+
`svelte >= 4.0` is required.
|
|
259
|
+
|
|
260
|
+
```svelte
|
|
261
|
+
<script lang="ts">
|
|
262
|
+
import { VList } from "virtua/svelte";
|
|
263
|
+
|
|
264
|
+
const sizes = [20, 40, 180, 77];
|
|
265
|
+
|
|
266
|
+
const data = Array.from({ length: 1000 }).map((_, i) => ({ id: i, size: sizes[i % 4] + "px" }));
|
|
267
|
+
</script>
|
|
268
|
+
|
|
269
|
+
<VList {data} let:item style={`height: 100vh;`} getKey={(d) => d.id}>
|
|
270
|
+
<div
|
|
271
|
+
style={`
|
|
272
|
+
height: ${item.size};
|
|
273
|
+
background: white;
|
|
274
|
+
border-bottom: solid 1px #ccc;
|
|
275
|
+
`}
|
|
276
|
+
>
|
|
277
|
+
{item.id}
|
|
278
|
+
</div>
|
|
279
|
+
</VList>
|
|
280
|
+
```
|
|
281
|
+
|
|
256
282
|
## Documentation
|
|
257
283
|
|
|
258
284
|
- [API reference](./docs/API.md)
|
|
@@ -308,9 +334,9 @@ Especially for `webpack-dev-server`, [you can filter out the specific error with
|
|
|
308
334
|
|
|
309
335
|
`viewportSize` will be calculated by ResizeObserver so it's 0 until the first measurement.
|
|
310
336
|
|
|
311
|
-
#### What is `Cannot find module 'virtua/vue(solid)' or its corresponding type declarations` error?
|
|
337
|
+
#### What is `Cannot find module 'virtua/vue(solid|svelte)' or its corresponding type declarations` error?
|
|
312
338
|
|
|
313
|
-
This package uses [exports of package.json](https://nodejs.org/api/packages.html#package-entry-points) for entry point of Vue/Solid adapter. This field can't be resolved in TypeScript with `moduleResolution: node`. Try `moduleResolution: bundler` or `moduleResolution: nodenext` instead.
|
|
339
|
+
This package uses [exports of package.json](https://nodejs.org/api/packages.html#package-entry-points) for entry point of Vue/Solid/Svelte adapter. This field can't be resolved in TypeScript with `moduleResolution: node`. Try `moduleResolution: bundler` or `moduleResolution: nodenext` instead.
|
|
314
340
|
|
|
315
341
|
## Comparison
|
|
316
342
|
|