vlist 2.7.1 → 2.8.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.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.7 KB.
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.7.1** — [Changelog](./CHANGELOG.md) · Grid, table, tree and masonry no longer judder in bounded and synthetic mode: their renderers now follow baseOffset on every step.
5
+ **v2.8.0** — [Changelog](./CHANGELOG.md) · autosize `remeasure(index?)`; framework adapters can select the `vlist/synthetic` entry via `VListConfig.factory`; `vlist/config` no longer warns about the scale stub; deprecation notices for 3.0 (`scroll.mode`, `scroll.runway`, native scrollbar values, old plugin hooks).
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/vlist.svg)](https://www.npmjs.com/package/vlist)
8
8
  [![bundle size](https://img.shields.io/bundlephobia/minzip/vlist)](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
@@ -93,6 +109,8 @@ const list = createVList({
93
109
  ## Synthetic scroll input
94
110
 
95
111
  The opt-in `vlist/synthetic` entry adds `scroll.mode: 'synthetic'` alongside native and bounded modes. Native remains the default. Import the factory from this entry and plugins from `vlist`:
112
+ Bounded mode note: on touch devices a long native fling can outrun the 2x runway and stall at its edge (measured at 145-226% of a 16x runway on an iPhone SE and a Pixel 8a). Prefer synthetic mode for touch-heavy lists; bounded remains the right choice for wheel and keyboard driven lists.
113
+
96
114
 
97
115
  ```typescript
98
116
  import { createVList } from 'vlist/synthetic'
@@ -119,6 +137,21 @@ Known limitations:
119
137
 
120
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).
121
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. `vlist/native` and `setScrollSource` are 3.0 replacements, not 2.8 APIs. Bounded mode remains supported in 2.x, including carousel and sortable; it emits no deprecation warning.
143
+
144
+ | Option or API | Replacement | Since |
145
+ |---|---|---|
146
+ | `scroll.mode` | In 3.0, synthetic input in core; import `vlist/native` for native scrolling. Bounded is removed. | 2.8 |
147
+ | `scroll.runway` | Remove it when moving to 3.0 synthetic core. | 2.8 |
148
+ | `scroll.scrollbar: "native"` | In 3.0 use `vlist/native` for a browser scrollbar, or `scrollbar()` in synthetic core. | 2.8 |
149
+ | `scroll.scrollbar: "none"` | In 3.0 synthetic core has no native main-axis scrollbar to hide; native hiding belongs to `vlist/native`. | 2.8 |
150
+ | `PluginContext.setScrollFns`, `disableDefaultScroll` | Use `setScrollSource` when upgrading to 3.0. | 2.8 |
151
+ | `scale()` | Use `scroll: { mode: "synthetic" }` from `vlist/synthetic`; bounded remains available in 2.x. | 2.4; guidance updated in 2.8 |
152
+
153
+ Only explicit `scale()` calls warn, once per process. The `vlist/config` compatibility stub is silent in 2.x and will no longer be installed in 3.0. Its scrollbar omission/options convenience remains supported and maps to `scrollbar()`; only the two string values above are deprecated. See the [RFC-014 migration contract](https://vlist.io/docs/rfcs/RFC-014-Scroll-Input-Model).
154
+
122
155
  ## Plugins
123
156
 
124
157
  | Plugin | Size | Description |
@@ -353,7 +386,7 @@ groups({ getGroupForIndex, header: { height, template }, sticky?: true })
353
386
  selection({ mode: 'single' | 'multiple', initial?: [...ids] })
354
387
  data({ adapter: { read }, loading?: { cancelThreshold? } })
355
388
  table({ columns, rowHeight, headerHeight?, resizable? })
356
- autosize() // auto-measure items (requires estimatedHeight)
389
+ autosize() // auto-measure items (requires estimatedHeight); list.remeasure(index?) after late content
357
390
  scrollbar({ autoHide?, autoHideDelay?, minThumbSize? })
358
391
  transition({ duration?: 200, insert?: timing, remove?: timing })
359
392
  sortable({ handle?: '.drag-handle' }) // drag-and-drop reordering
@@ -361,6 +394,15 @@ page() // no config — uses document scroll
361
394
  snapshots({ autoSave: 'key' }) // automatic sessionStorage save/restore
362
395
  ```
363
396
 
397
+ ### Autosize
398
+
399
+ 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.
400
+
401
+ ```javascript
402
+ list.remeasure(12); // Re-measure one item after its content changes.
403
+ list.remeasure(); // Invalidate all sizes and measure items as they render.
404
+ ```
405
+
364
406
  Full configuration reference → **[vlist.io](https://vlist.io)**
365
407
 
366
408
  ## 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.7 KB.
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.7.1** — [Changelog](https://github.com/floor/vlist/blob/main/CHANGELOG.md) · Grid, table, tree and masonry no longer judder in bounded and synthetic mode: their renderers now follow baseOffset on every step.
5
+ **v2.8.0** — [Changelog](https://github.com/floor/vlist/blob/main/CHANGELOG.md) · autosize `remeasure(index?)`; framework adapters can select the `vlist/synthetic` entry via `VListConfig.factory`; `vlist/config` no longer warns about the scale stub; deprecation notices for 3.0 (`scroll.mode`, `scroll.runway`, native scrollbar values, old plugin hooks).
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/vlist.svg)](https://www.npmjs.com/package/vlist)
8
8
  [![bundle size](https://img.shields.io/bundlephobia/minzip/vlist)](https://bundlephobia.com/package/vlist)
@@ -55,6 +55,8 @@ const list = createVList({ container: '#app', items, item: { height: 200, templa
55
55
  ## Synthetic scroll input
56
56
 
57
57
  The opt-in `vlist/synthetic` entry adds `scroll.mode: 'synthetic'` alongside native and bounded modes. Native remains the default. Import the factory from this entry and plugins from `vlist`:
58
+ Bounded mode note: on touch devices a long native fling can outrun the 2x runway and stall at its edge (measured at 145-226% of a 16x runway on an iPhone SE and a Pixel 8a). Prefer synthetic mode for touch-heavy lists; bounded remains the right choice for wheel and keyboard driven lists.
59
+
58
60
 
59
61
  ```typescript
60
62
  import { createVList } from 'vlist/synthetic'
@@ -81,6 +83,21 @@ Known limitations:
81
83
 
82
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).
83
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. `vlist/native` and `setScrollSource` are 3.0 replacements, not 2.8 APIs. Bounded mode remains supported in 2.x, including carousel and sortable; it emits no deprecation warning.
89
+
90
+ | Option or API | Replacement | Since |
91
+ |---|---|---|
92
+ | `scroll.mode` | In 3.0, synthetic input in core; import `vlist/native` for native scrolling. Bounded is removed. | 2.8 |
93
+ | `scroll.runway` | Remove it when moving to 3.0 synthetic core. | 2.8 |
94
+ | `scroll.scrollbar: "native"` | In 3.0 use `vlist/native` for a browser scrollbar, or `scrollbar()` in synthetic core. | 2.8 |
95
+ | `scroll.scrollbar: "none"` | In 3.0 synthetic core has no native main-axis scrollbar to hide; native hiding belongs to `vlist/native`. | 2.8 |
96
+ | `PluginContext.setScrollFns`, `disableDefaultScroll` | Use `setScrollSource` when upgrading to 3.0. | 2.8 |
97
+ | `scale()` | Use `scroll: { mode: "synthetic" }` from `vlist/synthetic`; bounded remains available in 2.x. | 2.4; guidance updated in 2.8 |
98
+
99
+ Only explicit `scale()` calls warn, once per process. The `vlist/config` compatibility stub is silent in 2.x and will no longer be installed in 3.0. Its scrollbar omission/options convenience remains supported and maps to `scrollbar()`; only the two string values above are deprecated. See the [RFC-014 migration contract](https://vlist.io/docs/rfcs/RFC-014-Scroll-Input-Model).
100
+
84
101
  ## Plugins
85
102
 
86
103
  | Plugin | Size | Description |
@@ -112,6 +129,22 @@ Measurement corrections from autosize preserve ongoing motion. Synthetic input a
112
129
  | SolidJS | [`vlist-solidjs`](https://github.com/floor/vlist-solidjs) | 0.5 KB |
113
130
  | React | [`vlist-react`](https://github.com/floor/vlist-react) | 0.6 KB |
114
131
 
132
+ With vlist 2.8 and an adapter that forwards the `factory` option, opt into synthetic input explicitly:
133
+
134
+ ```ts
135
+ import { useVList } from "vlist-react";
136
+ import { createVList } from "vlist/synthetic";
137
+
138
+ useVList({
139
+ factory: createVList,
140
+ scroll: { mode: "synthetic" },
141
+ items,
142
+ item: { height: 48, template: item => String(item.id) },
143
+ });
144
+ ```
145
+
146
+ 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.
147
+
115
148
  ## Docs & Examples
116
149
 
117
150
  **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"`. */