vlist-vue 3.0.1 → 3.1.0-next.3

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 CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  Vue composable for [vlist](https://github.com/floor/vlist) — lightweight, zero-dependency virtual scrolling.
4
4
 
5
+ > **Deprecated.** Use [`vlist/vue`](https://github.com/floor/vlist#frameworks) from the `vlist` package instead. Change the import path, and pass features as plugins:
6
+ >
7
+ > ```ts
8
+ > // before
9
+ > import { useVList } from "vlist-vue";
10
+ > useVList({ items, item, selection: { mode: "single" } });
11
+ >
12
+ > // after
13
+ > import { useVList } from "vlist/vue";
14
+ > import { selection } from "vlist";
15
+ > useVList({ items, item }, [selection({ mode: "single" })]);
16
+ > ```
17
+ >
18
+ > From 3.1 this package is built on `vlist/vue` and keeps its config-based API, so existing code keeps working while you migrate. It needs `vlist ^3.1.0-next.3`; on vlist 3.0.x, stay on `vlist-vue` 3.0.x.
19
+
5
20
  ## Install
6
21
 
7
22
  ```bash
@@ -32,7 +47,7 @@ const { containerRef, instance } = useVList({
32
47
  ## API
33
48
 
34
49
  - **`useVList(config)`** — Creates a virtual list. Returns `{ containerRef, instance }`. Config can be a plain object or a reactive `Ref` for automatic updates.
35
- - **`useVListEvent(instance, event, handler)`** — Subscribe to vlist events; the subscription ends when the component unmounts (fixed in 3.0.1).
50
+ - **`useVListEvent(instance, event, handler)`** — Subscribe to vlist events with automatic cleanup.
36
51
 
37
52
  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
53
 
@@ -42,18 +57,17 @@ Full usage guide, feature config examples, and TypeScript types: **[Framework Ad
42
57
 
43
58
  ## Synthetic input
44
59
 
45
- Requires `vlist ^3.0.0`. 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.
60
+ Every list scrolls natively by default, and hands itself to synthetic input past the browser's element size limit: `scroll.mode` is `"auto"`. Pass `scroll: { mode: "synthetic" }` for synthetic input from the start, or `"native"` to stay native; the adapter forwards `scroll` unchanged through `vlist/config`. A synthetic list draws its own scrollbar. Requires `vlist ^3.1.0-next.3`. A carousel honours `"synthetic"` too. `VListFactory` is re-exported for typed custom factories.
46
61
 
47
62
  ```vue
48
63
  <script setup lang="ts">
49
64
  import { useVList } from "vlist-vue";
50
- import { createVList } from "vlist/synthetic";
51
65
 
52
66
  const items = Array.from({ length: 1000 }, (_, id) => ({ id }));
53
67
  const { containerRef } = useVList({
54
- factory: createVList,
55
68
  items,
56
69
  item: { height: 48, template: item => String(item.id) },
70
+ scroll: { mode: "synthetic" },
57
71
  });
58
72
  </script>
59
73
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,17 @@
1
1
  /**
2
2
  * Vue composable for vlist - lightweight virtual scrolling
3
+ *
4
+ * Deprecated: use `vlist/vue` from the vlist package, which takes features as
5
+ * plugins (`useVList({ items, item }, [selection()])`). This package keeps the
6
+ * config-based API on top of it: the composables are `vlist/vue`'s, building
7
+ * the list with `createVListFromConfig` so feature fields still resolve to
8
+ * plugins.
3
9
  */
4
- import { type Ref, type ShallowRef } from "vue";
5
- import type { VListItem, VListEvents, EventHandler } from "vlist";
6
- import type { VList } from "vlist";
10
+ import type { Ref, ShallowRef } from "vue";
11
+ import type { VListItem, VList } from "vlist";
7
12
  import { type VListConfig } from "vlist/config";
13
+ import { useVListEvent } from "vlist/vue";
14
+ export { useVListEvent };
8
15
  export type { VListItem, VListEvents, VList, CreateVListConfig, ItemConfig, ItemTemplate, EventHandler, Unsubscribe, } from "vlist";
9
16
  export type { VListConfig, VListFactory } from "vlist/config";
10
17
  /**
@@ -18,4 +25,3 @@ export interface UseVListReturn<T extends VListItem = VListItem> {
18
25
  instance: ShallowRef<VList<T> | null>;
19
26
  }
20
27
  export declare function useVList<T extends VListItem = VListItem>(configInput: UseVListConfig<T> | Ref<UseVListConfig<T>>): UseVListReturn<T>;
21
- export declare function useVListEvent<T extends VListItem, K extends keyof VListEvents<T>>(instanceRef: Ref<VList<T> | null> | ShallowRef<VList<T> | null>, event: K, handler: EventHandler<VListEvents<T>[K]>): void;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{ref as D,shallowRef as K,onMounted as N,onBeforeUnmount as E,watch as G,isRef as O,unref as P}from"vue";import{createVListFromConfig as Q}from"vlist/config";function W(z){let A=D(null),j=K(null);if(N(()=>{let q=A.value;if(!q)return;let x=P(z);j.value=Q({...x,container:q})}),E(()=>{j.value?.destroy(),j.value=null}),O(z))G(()=>z.value.items,(q)=>{if(j.value&&q)j.value.setItems(q)});return{containerRef:A,instance:j}}function X(z,A,j){let q=D(j),x;G(()=>z.value,(H)=>{x?.(),x=H?.on(A,(J)=>q.value(J))},{immediate:!0}),E(()=>{x?.(),x=void 0})}export{X as useVListEvent,W as useVList};
1
+ import{createVListFromConfig as k}from"vlist/config";import{useVList as q,useVListEvent as B}from"vlist/vue";var x=k;function D(j){return q(j,[],x)}export{B as useVListEvent,D as useVList};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vlist-vue",
3
- "version": "3.0.1",
3
+ "version": "3.1.0-next.3",
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": "^3.0.0",
35
+ "vlist": "^3.1.0-next.3",
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": "^3.0.0",
55
+ "vlist": "3.1.0-next.3",
56
56
  "vue": "^3.5.28"
57
57
  }
58
58
  }