vlist-vue 0.1.1 → 1.2.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 CHANGED
@@ -1,24 +1,20 @@
1
1
  # vlist-vue
2
2
 
3
- Vue composable for [vlist](https://github.com/floor/vlist) - lightweight, zero-dependency virtual scrolling.
3
+ Vue composable for [@floor/vlist](https://github.com/floor/vlist) — lightweight, zero-dependency virtual scrolling.
4
4
 
5
- ## Installation
5
+ ## Install
6
6
 
7
7
  ```bash
8
8
  npm install @floor/vlist vlist-vue
9
9
  ```
10
10
 
11
- ## Usage
12
-
13
- ### Composition API
11
+ ## Quick Start
14
12
 
15
13
  ```vue
16
14
  <script setup>
17
15
  import { useVList } from 'vlist-vue';
18
16
  import '@floor/vlist/styles';
19
17
 
20
- const users = ref([...]);
21
-
22
18
  const { containerRef, instance } = useVList({
23
19
  item: {
24
20
  height: 48,
@@ -33,42 +29,17 @@ const { containerRef, instance } = useVList({
33
29
  </template>
34
30
  ```
35
31
 
36
- ### Options API
37
-
38
- ```vue
39
- <script>
40
- import { useVList } from 'vlist-vue';
41
-
42
- export default {
43
- setup() {
44
- return useVList({
45
- item: {
46
- height: 48,
47
- template: (user) => `<div>${user.name}</div>`,
48
- },
49
- items: [],
50
- });
51
- },
52
- };
53
- </script>
54
- ```
55
-
56
32
  ## API
57
33
 
58
- ### `useVList(config)`
59
-
60
- **Parameters:**
61
- - `config` - VList configuration (same as core vlist, minus `container`)
62
- - Can be a reactive `Ref` for automatic updates
34
+ - **`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 with automatic cleanup.
63
36
 
64
- **Returns:**
65
- - `containerRef` - Template ref for the container
66
- - `instance` - Reactive ref to the vlist instance
37
+ Config accepts all [@floor/vlist options](https://vlist.dev/docs/api/reference) minus `container` (handled by the ref). Feature fields like `adapter`, `grid`, `groups`, `selection`, and `scrollbar` are translated into `.use(withX())` calls automatically.
67
38
 
68
39
  ## Documentation
69
40
 
70
- For full documentation, see [vlist.dev](https://vlist.dev)
41
+ Full usage guide, feature config examples, and TypeScript types: **[Framework Adapters — Vue](https://vlist.dev/docs/frameworks#vue)**
71
42
 
72
43
  ## License
73
44
 
74
- MIT © [Floor IO](https://floor.io)
45
+ MIT © [Floor IO](https://floor.io)
package/dist/index.d.ts CHANGED
@@ -3,11 +3,11 @@
3
3
  */
4
4
  import { type Ref, type ShallowRef } from "vue";
5
5
  import type { VListConfig, VListItem, VListEvents, EventHandler } from "@floor/vlist";
6
- import { type BuiltVList } from "@floor/vlist";
6
+ import { type VList } from "@floor/vlist";
7
7
  export type UseVListConfig<T extends VListItem = VListItem> = Omit<VListConfig<T>, "container">;
8
8
  export interface UseVListReturn<T extends VListItem = VListItem> {
9
9
  containerRef: Ref<HTMLDivElement | null>;
10
- instance: ShallowRef<BuiltVList<T> | null>;
10
+ instance: ShallowRef<VList<T> | null>;
11
11
  }
12
12
  export declare function useVList<T extends VListItem = VListItem>(configInput: UseVListConfig<T> | Ref<UseVListConfig<T>>): UseVListReturn<T>;
13
- export declare function useVListEvent<T extends VListItem, K extends keyof VListEvents<T>>(instanceRef: Ref<BuiltVList<T> | null> | ShallowRef<BuiltVList<T> | null>, event: K, handler: EventHandler<VListEvents<T>[K]>): void;
13
+ 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 f,shallowRef as p,onMounted as L,onBeforeUnmount as c,watch as d,isRef as h,unref as V}from"vue";import{vlist as v}from"@floor/vlist";import{withAsync as g,withGrid as T,withSections as w,withSelection as a,withScrollbar as b,withScale as y,withSnapshots as R,withPage as x}from"@floor/vlist";function S(o){let r=f(null),n=p(null);if(L(()=>{let s=r.value;if(!s)return;let t=V(o),e=v({...t,container:s});if(t.scroll?.element===window)e=e.use(x());if(t.adapter)e=e.use(g({adapter:t.adapter,...t.loading&&{loading:t.loading}}));if(t.layout==="grid"&&t.grid)e=e.use(T(t.grid));if(t.groups){let i=t.groups,m=typeof i.headerHeight==="function"?i.headerHeight("",0):i.headerHeight;e=e.use(w({getGroupForIndex:i.getGroupForIndex,headerHeight:m,headerTemplate:i.headerTemplate,...i.sticky!==void 0&&{sticky:i.sticky}}))}if((t.selection?.mode||"none")!=="none")e=e.use(a(t.selection));else e=e.use(a({mode:"none"}));e=e.use(y());let l=t.scroll?.scrollbar||t.scrollbar;if(l!=="none"){let i=typeof l==="object"?l:{};e=e.use(b(i))}e=e.use(R()),n.value=e.build()}),c(()=>{n.value?.destroy(),n.value=null}),h(o))d(()=>o.value.items,(s)=>{if(n.value&&s)n.value.setItems(s)});return{containerRef:r,instance:n}}function U(o,r,n){let s=f(n);d(()=>o.value,(t)=>{if(!t)return;let e=(l)=>{s.value(l)},u=t.on(r,e);c(()=>{u()})},{immediate:!0})}export{U as useVListEvent,S as useVList};
1
+ import{ref as f,shallowRef as p,onMounted as h,onBeforeUnmount as c,watch as d,isRef as L,unref as V}from"vue";import{vlist as v}from"@floor/vlist";import{withAsync as g,withGrid as T,withMasonry as y,withGroups as w,withSelection as u,withScrollbar as b,withScale as R,withSnapshots as x,withPage as E}from"@floor/vlist";function C(o){let r=f(null),s=p(null);if(h(()=>{let n=r.value;if(!n)return;let t=V(o),e=v({...t,container:n});if(t.scroll?.element===window)e=e.use(E());if(t.adapter)e=e.use(g({adapter:t.adapter,...t.loading&&{loading:t.loading}}));if(t.layout==="grid"&&t.grid)e=e.use(T(t.grid));if(t.layout==="masonry"&&t.masonry)e=e.use(y(t.masonry));if(t.groups){let i=t.groups,m=typeof i.headerHeight==="function"?i.headerHeight("",0):i.headerHeight;e=e.use(w({getGroupForIndex:i.getGroupForIndex,headerHeight:m,headerTemplate:i.headerTemplate,...i.sticky!==void 0&&{sticky:i.sticky}}))}if((t.selection?.mode||"none")!=="none")e=e.use(u(t.selection));else e=e.use(u({mode:"none"}));e=e.use(R());let l=t.scroll?.scrollbar||t.scrollbar;if(l!=="none"){let i=typeof l==="object"?l:{};e=e.use(b(i))}e=e.use(x()),s.value=e.build()}),c(()=>{s.value?.destroy(),s.value=null}),L(o))d(()=>o.value.items,(n)=>{if(s.value&&n)s.value.setItems(n)});return{containerRef:r,instance:s}}function S(o,r,s){let n=f(s);d(()=>o.value,(t)=>{if(!t)return;let e=(l)=>{n.value(l)},a=t.on(r,e);c(()=>{a()})},{immediate:!0})}export{S as useVListEvent,C as useVList};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vlist-vue",
3
- "version": "0.1.1",
3
+ "version": "1.2.0",
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
- "@floor/vlist": "^0.6.0",
35
+ "@floor/vlist": "^1.2.0",
36
36
  "vue": ">=3.0.0"
37
37
  },
38
38
  "files": [