vlist-vue 2.6.0 → 3.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# vlist-vue
|
|
2
2
|
|
|
3
|
-
Vue composable for [
|
|
3
|
+
Vue composable for [vlist](https://github.com/floor/vlist) — lightweight, zero-dependency virtual scrolling.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install vlist vlist-vue
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
@@ -13,7 +13,7 @@ npm install @floor/vlist vlist-vue
|
|
|
13
13
|
```vue
|
|
14
14
|
<script setup>
|
|
15
15
|
import { useVList } from 'vlist-vue';
|
|
16
|
-
import '
|
|
16
|
+
import 'vlist/styles';
|
|
17
17
|
|
|
18
18
|
const { containerRef, instance } = useVList({
|
|
19
19
|
item: {
|
|
@@ -34,12 +34,34 @@ const { containerRef, instance } = useVList({
|
|
|
34
34
|
- **`useVList(config)`** — Creates a virtual list. Returns `{ containerRef, instance }`. Config can be a plain object or a reactive `Ref` for automatic updates.
|
|
35
35
|
- **`useVListEvent(instance, event, handler)`** — Subscribe to vlist events with automatic cleanup.
|
|
36
36
|
|
|
37
|
-
Config accepts all [
|
|
37
|
+
Config accepts all [vlist options](https://vlist.dev/docs/api/reference) minus `container` (handled by the ref). Feature fields like `adapter`, `grid`, `groups`, `selection`, `scrollbar`, and `estimatedHeight` are resolved into plugins automatically.
|
|
38
38
|
|
|
39
39
|
## Documentation
|
|
40
40
|
|
|
41
41
|
Full usage guide, feature config examples, and TypeScript types: **[Framework Adapters — Vue](https://vlist.dev/docs/frameworks#vue)**
|
|
42
42
|
|
|
43
|
+
## Synthetic input
|
|
44
|
+
|
|
45
|
+
Requires `vlist ^3.0.0-next.1`. Pass the synthetic entry as `factory` to opt in; the adapter forwards it unchanged through `vlist/config`. `VListFactory` is re-exported for typed custom factories. The factory is selected at mount; remount to change it.
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { useVList } from "vlist-vue";
|
|
50
|
+
import { createVList } from "vlist/synthetic";
|
|
51
|
+
|
|
52
|
+
const items = Array.from({ length: 1000 }, (_, id) => ({ id }));
|
|
53
|
+
const { containerRef } = useVList({
|
|
54
|
+
factory: createVList,
|
|
55
|
+
items,
|
|
56
|
+
item: { height: 48, template: item => String(item.id) },
|
|
57
|
+
});
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<div ref="containerRef" style="height: 400px" />
|
|
62
|
+
</template>
|
|
63
|
+
```
|
|
64
|
+
|
|
43
65
|
## License
|
|
44
66
|
|
|
45
|
-
MIT © [Floor IO](https://floor.io)
|
|
67
|
+
MIT © [Floor IO](https://floor.io)
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { VListItem, VListEvents, EventHandler } from "vlist";
|
|
|
6
6
|
import type { VList } from "vlist";
|
|
7
7
|
import { type VListConfig } from "vlist/config";
|
|
8
8
|
export type { VListItem, VListEvents, VList, CreateVListConfig, ItemConfig, ItemTemplate, EventHandler, Unsubscribe, } from "vlist";
|
|
9
|
-
export type { VListConfig } from "vlist/config";
|
|
9
|
+
export type { VListConfig, VListFactory } from "vlist/config";
|
|
10
10
|
/**
|
|
11
11
|
* Configuration for {@link useVList}. vlist's high-level `VListConfig` (feature
|
|
12
12
|
* fields like `layout`, `grid`, `selection`, `plugins` are translated into
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as
|
|
1
|
+
import{ref as A,shallowRef as N,onMounted as O,onBeforeUnmount as D,watch as E,isRef as P,unref as Q}from"vue";import{createVListFromConfig as S}from"vlist/config";function X(q){let x=A(null),j=N(null);if(O(()=>{let k=x.value;if(!k)return;let z=Q(q);j.value=S({...z,container:k})}),D(()=>{j.value?.destroy(),j.value=null}),P(q))E(()=>q.value.items,(k)=>{if(j.value&&k)j.value.setItems(k)});return{containerRef:x,instance:j}}function Y(q,x,j){let k=A(j);E(()=>q.value,(z)=>{if(!z)return;let G=(K)=>{k.value(K)},J=z.on(x,G);D(()=>{J()})},{immediate:!0})}export{Y as useVListEvent,X as useVList};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vlist-vue",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-next.1",
|
|
4
4
|
"description": "Vue composable for vlist - lightweight virtual scrolling",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Floor IO",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"vlist": "^
|
|
35
|
+
"vlist": "^3.0.0-next.1",
|
|
36
36
|
"vue": ">=3.0.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/bun": "^1.0.0",
|
|
53
53
|
"bun": "^1.0.0",
|
|
54
54
|
"typescript": "^5.0.0",
|
|
55
|
-
"vlist": "
|
|
55
|
+
"vlist": "^3.0.0-next.3",
|
|
56
56
|
"vue": "^3.5.28"
|
|
57
57
|
}
|
|
58
58
|
}
|