vlist 2.7.2 → 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.2** — [Changelog](./CHANGELOG.md) · Tree keeps the bounded runway for large trees; the scale() deprecation link works; bounded-mode touch limitation documented.
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
@@ -121,6 +137,21 @@ 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. `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
+
124
155
  ## Plugins
125
156
 
126
157
  | Plugin | Size | Description |
@@ -355,7 +386,7 @@ groups({ getGroupForIndex, header: { height, template }, sticky?: true })
355
386
  selection({ mode: 'single' | 'multiple', initial?: [...ids] })
356
387
  data({ adapter: { read }, loading?: { cancelThreshold? } })
357
388
  table({ columns, rowHeight, headerHeight?, resizable? })
358
- autosize() // auto-measure items (requires estimatedHeight)
389
+ autosize() // auto-measure items (requires estimatedHeight); list.remeasure(index?) after late content
359
390
  scrollbar({ autoHide?, autoHideDelay?, minThumbSize? })
360
391
  transition({ duration?: 200, insert?: timing, remove?: timing })
361
392
  sortable({ handle?: '.drag-handle' }) // drag-and-drop reordering
@@ -363,6 +394,15 @@ page() // no config — uses document scroll
363
394
  snapshots({ autoSave: 'key' }) // automatic sessionStorage save/restore
364
395
  ```
365
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
+
366
406
  Full configuration reference → **[vlist.io](https://vlist.io)**
367
407
 
368
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.2** — [Changelog](https://github.com/floor/vlist/blob/main/CHANGELOG.md) · Tree keeps the bounded runway for large trees; the scale() deprecation link works; bounded-mode touch limitation documented.
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)
@@ -83,6 +83,21 @@ 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. `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
+
86
101
  ## Plugins
87
102
 
88
103
  | Plugin | Size | Description |
@@ -114,6 +129,22 @@ Measurement corrections from autosize preserve ongoing motion. Synthetic input a
114
129
  | SolidJS | [`vlist-solidjs`](https://github.com/floor/vlist-solidjs) | 0.5 KB |
115
130
  | React | [`vlist-react`](https://github.com/floor/vlist-react) | 0.6 KB |
116
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
+
117
148
  ## Docs & Examples
118
149
 
119
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"`. */