vlist 2.7.2 → 2.8.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.github.md +43 -5
- package/README.md +33 -4
- package/dist/config.d.ts +11 -2
- package/dist/config.js +1 -1
- package/dist/core/types.d.ts +4 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/plugins/autosize/plugin.d.ts +1 -1
- package/dist/plugins/scale/plugin.d.ts +2 -0
- package/dist/size.json +1 -1
- package/dist/types.d.ts +20 -7
- package/package.json +1 -1
package/README.github.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# vlist
|
|
2
2
|
|
|
3
|
-
The virtual list library for every framework. Ultra efficient, batteries-included, and accessible with composable plugins — in 9.
|
|
3
|
+
The virtual list library for every framework. Ultra efficient, batteries-included, and accessible with composable plugins — in 9.9 KB.
|
|
4
4
|
|
|
5
|
-
**v2.
|
|
5
|
+
**v2.8.1** — [Changelog](./CHANGELOG.md) · deprecation notices corrected for the revised 3.0 shape (native stays the default, synthetic input stays opt-in, the scrollbar strings are not deprecated); carousel slots follow container resizes; prerelease-aware publish workflow.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/vlist)
|
|
8
8
|
[](https://bundlephobia.com/package/vlist)
|
|
@@ -45,6 +45,22 @@ npm install vlist # vanilla JS
|
|
|
45
45
|
npm install vlist vlist-vue # or vlist-svelte / vlist-solidjs / vlist-react
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
With vlist 2.8 and an adapter that forwards the `factory` option, opt into synthetic input explicitly:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { useVList } from "vlist-react";
|
|
52
|
+
import { createVList } from "vlist/synthetic";
|
|
53
|
+
|
|
54
|
+
useVList({
|
|
55
|
+
factory: createVList,
|
|
56
|
+
scroll: { mode: "synthetic" },
|
|
57
|
+
items,
|
|
58
|
+
item: { height: 48, template: item => String(item.id) },
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The same factory option is available to the other adapters. `vlist/config` keeps the synthetic driver out of its default bundle; importing the factory opts in. The factory is structural configuration: changing it requires recreating the list.
|
|
63
|
+
|
|
48
64
|
## Quick Start
|
|
49
65
|
|
|
50
66
|
```typescript
|
|
@@ -121,6 +137,19 @@ Known limitations:
|
|
|
121
137
|
|
|
122
138
|
Measurement corrections from autosize preserve ongoing motion. Synthetic input adds **2.6 KB gzipped** over the base entry (**12.5 KB** total before plugins); ordinary `vlist` imports exclude this driver. See [RFC-014](https://github.com/floor/vlist/discussions/127).
|
|
123
139
|
|
|
140
|
+
## Deprecated in 2.8, removed in 3.0
|
|
141
|
+
|
|
142
|
+
These notices prepare the 3.0 migration; 2.x behavior and defaults stay unchanged. Native scrolling stays the default in 3.0, and synthetic input stays the opt-in `vlist/synthetic` entry. Bounded mode remains supported in 2.x, including carousel and sortable; it emits no deprecation warning.
|
|
143
|
+
|
|
144
|
+
| Option or API | In 3.0 | Since |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `scroll.mode` | Removed. `vlist` is native by default; for lists beyond the browser's element size limit, import `createVList` from `vlist/synthetic` instead of using bounded mode. | 2.8 |
|
|
147
|
+
| `scroll.runway` | Removed with bounded mode. | 2.8 |
|
|
148
|
+
| `PluginContext.setScrollFns`, `disableDefaultScroll` | Removed; use `setScrollSource`. | 2.8 |
|
|
149
|
+
| `scale()` | Removed; use `vlist/synthetic` for huge lists. | 2.4 |
|
|
150
|
+
|
|
151
|
+
`scroll.scrollbar: "native"` and `"none"` are not deprecated: they stay available on the native default in 3.0. Only explicit `scale()` calls warn, once per process, and 3.0's `vlist/config` no longer installs the scale compatibility stub. Release 2.8.0 described native scrolling and the scrollbar strings as moving to a `vlist/native` entry in 3.0; that plan was revised. See the [v2 to v3 migration guide](https://vlist.io/docs/migration-v3).
|
|
152
|
+
|
|
124
153
|
## Plugins
|
|
125
154
|
|
|
126
155
|
| Plugin | Size | Description |
|
|
@@ -135,12 +164,12 @@ Measurement corrections from autosize preserve ongoing motion. Synthetic input a
|
|
|
135
164
|
| `scrollbar()` | +2.0 KB | Custom scrollbar UI |
|
|
136
165
|
| `grid()` | +2.5 KB | 2D grid layout |
|
|
137
166
|
| `masonry()` | +4.1 KB | Pinterest-style masonry with lane-aware keyboard nav |
|
|
138
|
-
| `carousel()` | +3.
|
|
167
|
+
| `carousel()` | +3.6 KB | Paged horizontal carousel with snap and keyboard nav |
|
|
139
168
|
| `table()` | +5.8 KB | Data table with columns, resize, sort |
|
|
140
169
|
| `tree()` | +5.0 KB | Collapsible tree with async loading and indent guides |
|
|
141
170
|
| `page()` | +0.8 KB | Window-level scrolling |
|
|
142
171
|
| `sortable()` | +3.0 KB | Drag-and-drop reordering with auto-scroll |
|
|
143
|
-
| `snapshots()` | +1.
|
|
172
|
+
| `snapshots()` | +1.2 KB | Scroll position save/restore |
|
|
144
173
|
| `transition()` | +2.0 KB | FLIP-based enter/exit animations for insert & remove |
|
|
145
174
|
|
|
146
175
|
## Examples
|
|
@@ -355,7 +384,7 @@ groups({ getGroupForIndex, header: { height, template }, sticky?: true })
|
|
|
355
384
|
selection({ mode: 'single' | 'multiple', initial?: [...ids] })
|
|
356
385
|
data({ adapter: { read }, loading?: { cancelThreshold? } })
|
|
357
386
|
table({ columns, rowHeight, headerHeight?, resizable? })
|
|
358
|
-
autosize() // auto-measure items (requires estimatedHeight)
|
|
387
|
+
autosize() // auto-measure items (requires estimatedHeight); list.remeasure(index?) after late content
|
|
359
388
|
scrollbar({ autoHide?, autoHideDelay?, minThumbSize? })
|
|
360
389
|
transition({ duration?: 200, insert?: timing, remove?: timing })
|
|
361
390
|
sortable({ handle?: '.drag-handle' }) // drag-and-drop reordering
|
|
@@ -363,6 +392,15 @@ page() // no config — uses document scroll
|
|
|
363
392
|
snapshots({ autoSave: 'key' }) // automatic sessionStorage save/restore
|
|
364
393
|
```
|
|
365
394
|
|
|
395
|
+
### Autosize
|
|
396
|
+
|
|
397
|
+
With `autosize()` and `item.estimatedHeight` (or `estimatedWidth` for horizontal lists), call `remeasure(i)` after content changes size without a `load` or `error` event, such as expanding text or changing a font. Call `remeasure()` to discard every cached measurement: visible items are measured again, and offscreen items use estimates until they render. Unknown or unmeasured indices are a no-op.
|
|
398
|
+
|
|
399
|
+
```javascript
|
|
400
|
+
list.remeasure(12); // Re-measure one item after its content changes.
|
|
401
|
+
list.remeasure(); // Invalidate all sizes and measure items as they render.
|
|
402
|
+
```
|
|
403
|
+
|
|
366
404
|
Full configuration reference → **[vlist.io](https://vlist.io)**
|
|
367
405
|
|
|
368
406
|
## Base Configuration
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# vlist
|
|
2
2
|
|
|
3
|
-
The virtual list library for every framework. Ultra efficient, batteries-included, and accessible with composable plugins — in 9.
|
|
3
|
+
The virtual list library for every framework. Ultra efficient, batteries-included, and accessible with composable plugins — in 9.9 KB.
|
|
4
4
|
|
|
5
|
-
**v2.
|
|
5
|
+
**v2.8.1** — [Changelog](https://github.com/floor/vlist/blob/main/CHANGELOG.md) · deprecation notices corrected for the revised 3.0 shape (native stays the default, synthetic input stays opt-in, the scrollbar strings are not deprecated); carousel slots follow container resizes; prerelease-aware publish workflow.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/vlist)
|
|
8
8
|
[](https://bundlephobia.com/package/vlist)
|
|
@@ -83,6 +83,19 @@ Known limitations:
|
|
|
83
83
|
|
|
84
84
|
Measurement corrections from autosize preserve ongoing motion. Synthetic input adds **2.6 KB gzipped** over the base entry (**12.5 KB** total before plugins); ordinary `vlist` imports exclude this driver. See [RFC-014](https://github.com/floor/vlist/discussions/127).
|
|
85
85
|
|
|
86
|
+
## Deprecated in 2.8, removed in 3.0
|
|
87
|
+
|
|
88
|
+
These notices prepare the 3.0 migration; 2.x behavior and defaults stay unchanged. Native scrolling stays the default in 3.0, and synthetic input stays the opt-in `vlist/synthetic` entry. Bounded mode remains supported in 2.x, including carousel and sortable; it emits no deprecation warning.
|
|
89
|
+
|
|
90
|
+
| Option or API | In 3.0 | Since |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `scroll.mode` | Removed. `vlist` is native by default; for lists beyond the browser's element size limit, import `createVList` from `vlist/synthetic` instead of using bounded mode. | 2.8 |
|
|
93
|
+
| `scroll.runway` | Removed with bounded mode. | 2.8 |
|
|
94
|
+
| `PluginContext.setScrollFns`, `disableDefaultScroll` | Removed; use `setScrollSource`. | 2.8 |
|
|
95
|
+
| `scale()` | Removed; use `vlist/synthetic` for huge lists. | 2.4 |
|
|
96
|
+
|
|
97
|
+
`scroll.scrollbar: "native"` and `"none"` are not deprecated: they stay available on the native default in 3.0. Only explicit `scale()` calls warn, once per process, and 3.0's `vlist/config` no longer installs the scale compatibility stub. Release 2.8.0 described native scrolling and the scrollbar strings as moving to a `vlist/native` entry in 3.0; that plan was revised. See the [v2 to v3 migration guide](https://vlist.io/docs/migration-v3).
|
|
98
|
+
|
|
86
99
|
## Plugins
|
|
87
100
|
|
|
88
101
|
| Plugin | Size | Description |
|
|
@@ -97,12 +110,12 @@ Measurement corrections from autosize preserve ongoing motion. Synthetic input a
|
|
|
97
110
|
| `scrollbar()` | +2.0 KB | Custom scrollbar UI |
|
|
98
111
|
| `grid()` | +2.5 KB | 2D grid layout |
|
|
99
112
|
| `masonry()` | +4.1 KB | Pinterest-style masonry with lane-aware keyboard nav |
|
|
100
|
-
| `carousel()` | +3.
|
|
113
|
+
| `carousel()` | +3.6 KB | Paged horizontal carousel with snap and keyboard nav |
|
|
101
114
|
| `table()` | +5.8 KB | Data table with columns, resize, sort |
|
|
102
115
|
| `tree()` | +5.0 KB | Collapsible tree with async loading and indent guides |
|
|
103
116
|
| `page()` | +0.8 KB | Window-level scrolling |
|
|
104
117
|
| `sortable()` | +3.0 KB | Drag-and-drop reordering with auto-scroll |
|
|
105
|
-
| `snapshots()` | +1.
|
|
118
|
+
| `snapshots()` | +1.2 KB | Scroll position save/restore |
|
|
106
119
|
| `transition()` | +2.0 KB | FLIP-based enter/exit animations for insert & remove |
|
|
107
120
|
|
|
108
121
|
## Framework Adapters
|
|
@@ -114,6 +127,22 @@ Measurement corrections from autosize preserve ongoing motion. Synthetic input a
|
|
|
114
127
|
| SolidJS | [`vlist-solidjs`](https://github.com/floor/vlist-solidjs) | 0.5 KB |
|
|
115
128
|
| React | [`vlist-react`](https://github.com/floor/vlist-react) | 0.6 KB |
|
|
116
129
|
|
|
130
|
+
With vlist 2.8 and an adapter that forwards the `factory` option, opt into synthetic input explicitly:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { useVList } from "vlist-react";
|
|
134
|
+
import { createVList } from "vlist/synthetic";
|
|
135
|
+
|
|
136
|
+
useVList({
|
|
137
|
+
factory: createVList,
|
|
138
|
+
scroll: { mode: "synthetic" },
|
|
139
|
+
items,
|
|
140
|
+
item: { height: 48, template: item => String(item.id) },
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The same factory option is available to the other adapters. `vlist/config` keeps the synthetic driver out of its default bundle; importing the factory opts in. The factory is structural configuration: changing it requires recreating the list.
|
|
145
|
+
|
|
117
146
|
## Docs & Examples
|
|
118
147
|
|
|
119
148
|
**18 interactive examples, full API reference, tutorials, and live benchmarks → [vlist.io](https://vlist.io)**
|
package/dist/config.d.ts
CHANGED
|
@@ -15,20 +15,29 @@
|
|
|
15
15
|
* lean and tree-shakeable; only consumers that opt into the batteries-included
|
|
16
16
|
* config (the adapters) pull in this module and, with it, every plugin it wires.
|
|
17
17
|
*/
|
|
18
|
-
import type { VListItem, GroupsConfig, VListAdapter } from "./types";
|
|
18
|
+
import type { VListItem, GroupsConfig, VListAdapter, ScrollConfig } from "./types";
|
|
19
|
+
import { createVList } from "./core/create";
|
|
19
20
|
import type { CreateVListConfig, VList, VListPlugin } from "./core/types";
|
|
20
21
|
import type { DataPluginConfig } from "./plugins/data";
|
|
21
22
|
import type { GridPluginConfig } from "./plugins/grid";
|
|
22
23
|
import type { MasonryPluginConfig } from "./plugins/masonry";
|
|
23
24
|
import type { SelectionPluginConfig } from "./plugins/selection";
|
|
24
25
|
import type { ScrollbarPluginConfig } from "./plugins/scrollbar";
|
|
26
|
+
/** List creation function injected by an adapter consumer. */
|
|
27
|
+
export type VListFactory<T extends VListItem = VListItem> = typeof createVList<T>;
|
|
25
28
|
/**
|
|
26
29
|
* High-level, declarative vlist configuration accepted by the framework
|
|
27
30
|
* adapters. It is the core `CreateVListConfig` (minus `container`, which the
|
|
28
31
|
* adapter owns via a ref/node) plus the convenience "feature fields" that are
|
|
29
32
|
* translated into plugins by {@link resolvePlugins}.
|
|
30
33
|
*/
|
|
31
|
-
export interface VListConfig<T extends VListItem = VListItem> extends Omit<CreateVListConfig<T>, "container"> {
|
|
34
|
+
export interface VListConfig<T extends VListItem = VListItem> extends Omit<CreateVListConfig<T>, "container" | "scroll"> {
|
|
35
|
+
/** Synthetic mode requires a factory imported from vlist/synthetic. */
|
|
36
|
+
scroll?: Omit<ScrollConfig, "mode"> & {
|
|
37
|
+
mode?: ScrollConfig["mode"] | "synthetic";
|
|
38
|
+
};
|
|
39
|
+
/** List factory; defaults to core createVList. Fixed for this instance. */
|
|
40
|
+
factory?: VListFactory<T>;
|
|
32
41
|
/** Layout mode. Wires the grid or masonry plugin from `grid`/`masonry`. */
|
|
33
42
|
layout?: "grid" | "masonry";
|
|
34
43
|
/** Grid layout options — applied when `layout: "grid"`. */
|