vlist 2.0.1 → 2.0.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.github.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The virtual list library for every framework. Ultra efficient, batteries-included, and accessible with composable plugins — in 7.7 KB.
4
4
 
5
- **v2.0.0** — [Changelog](./CHANGELOG.md) · **v2 is a ground-up rewrite** with a new plugin API. Coming from v1? See [Migration Guide](https://vlist.io/docs/migration).
5
+ **v2.0.3** — [Changelog](./CHANGELOG.md) · **v2 is a ground-up rewrite** with a new plugin API. Coming from v1? See [Migration Guide](https://vlist.io/docs/migration).
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)
@@ -14,7 +14,7 @@ The virtual list library for every framework. Ultra efficient, batteries-include
14
14
  - **7.7 KB gzipped** — composable plugins with perfect tree-shaking
15
15
  - **Constant memory** — ~0.1 MB overhead at any scale, from 10K to 1M+ items
16
16
  - **Grid, masonry, table, groups, data, selection, sortable, transition, scale** — all opt-in
17
- - **Vertical & horizontal** single axis-neutral code path, every plugin works in both orientations
17
+ - **Axis-neutral** vertical and horizontal scrolling through a single code path, all plugins work in both orientations
18
18
 
19
19
  **18 interactive examples, docs & benchmarks → [vlist.io](https://vlist.io)**
20
20
 
@@ -99,12 +99,12 @@ const list = createVList({
99
99
  | `selection()` | +2.4 KB | Single/multiple selection with 2D keyboard nav |
100
100
  | `scale()` | +3.9 KB | 1M+ items via scroll compression |
101
101
  | `groups()` | +3.7 KB | Sticky/inline headers with async group discovery |
102
- | `autosize()` | +0.7 KB | Auto-measure items via ResizeObserver |
102
+ | `autosize()` | +0.9 KB | Auto-measure items via ResizeObserver |
103
103
  | `scrollbar()` | +2.0 KB | Custom scrollbar UI |
104
104
  | `grid()` | +2.1 KB | 2D grid layout |
105
105
  | `masonry()` | +3.5 KB | Pinterest-style masonry with lane-aware keyboard nav |
106
106
  | `table()` | +5.8 KB | Data table with columns, resize, sort |
107
- | `page()` | +0.7 KB | Window-level scrolling |
107
+ | `page()` | +0.8 KB | Window-level scrolling |
108
108
  | `sortable()` | +2.9 KB | Drag-and-drop reordering with auto-scroll |
109
109
  | `snapshots()` | +1.3 KB | Scroll position save/restore |
110
110
  | `transition()` | +1.8 KB | FLIP-based enter/exit animations for insert & remove |
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The virtual list library for every framework. Ultra efficient, batteries-included, and accessible with composable plugins — in 7.7 KB.
4
4
 
5
- **v2.0.0** — [Changelog](https://github.com/floor/vlist/blob/main/CHANGELOG.md) · **v2 is a ground-up rewrite** with a new plugin API. Coming from v1? See [Migration Guide](https://vlist.io/docs/migration).
5
+ **v2.0.3** — [Changelog](https://github.com/floor/vlist/blob/main/CHANGELOG.md) · **v2 is a ground-up rewrite** with a new plugin API. Coming from v1? See [Migration Guide](https://vlist.io/docs/migration).
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)
@@ -13,7 +13,7 @@ The virtual list library for every framework. Ultra efficient, batteries-include
13
13
  - **Zero dependencies** — framework-agnostic core, tiny adapters for Vue, Svelte, Solid, React
14
14
  - **7.7 KB gzipped** — composable plugins with perfect tree-shaking
15
15
  - **Constant memory** — ~0.1 MB overhead at any scale, from 10K to 1M+ items
16
- - **Vertical & horizontal** single axis-neutral code path, every plugin works in both orientations
16
+ - **Axis-neutral** vertical and horizontal scrolling through a single code path, all plugins work in both orientations
17
17
 
18
18
  ## Install
19
19
 
@@ -4,5 +4,5 @@
4
4
  */
5
5
  import type { DOMStructure } from "./types";
6
6
  export declare function resolveContainer(container: HTMLElement | string): HTMLElement;
7
- export declare function createDOMStructure(container: HTMLElement, classPrefix: string, horizontal: boolean, interactive: boolean, ariaLabel?: string): DOMStructure;
7
+ export declare function createDOMStructure(container: HTMLElement, classPrefix: string, isX: boolean, interactive: boolean, ariaLabel?: string): DOMStructure;
8
8
  //# sourceMappingURL=dom.d.ts.map
@@ -13,5 +13,5 @@ export { createDOMStructure, resolveContainer } from "./dom";
13
13
  export { createScrollHandler } from "./scroll";
14
14
  export type { SizeCache } from "./sizes";
15
15
  export type { ScrollHandler, ScrollHandlerConfig } from "./scroll";
16
- export type { CalculateHook, CommitHook, AfterScrollHook, IdleHook, ResizeHook, CompiledHooks, ResolvedConfig, DOMStructure, ElementPool, VisibleRangeFn, PluginContext, VListPlugin, VList, CreateVListConfig, } from "./types";
16
+ export type { Axis, AxisConfig, CalculateHook, CommitHook, AfterScrollHook, IdleHook, ResizeHook, CompiledHooks, ResolvedConfig, DOMStructure, ElementPool, PluginContext, VListPlugin, VList, CreateVListConfig, } from "./types";
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -21,9 +21,9 @@ export interface RenderConfig {
21
21
  readonly placeholderClass: string;
22
22
  readonly replacedClass: string;
23
23
  readonly translateProp: "translateX(" | "translateY(";
24
+ readonly sizeProp: "width" | "height";
24
25
  readonly itemRole: "option" | "listitem";
25
26
  readonly interactive: boolean;
26
- readonly horizontal: boolean;
27
27
  readonly startPadding: number;
28
28
  readonly gap: number;
29
29
  readonly hasCrossPad: boolean;
@@ -34,7 +34,7 @@ export interface RenderConfig {
34
34
  readonly oddClass: string;
35
35
  readonly emitter: Emitter<VListEvents> | null;
36
36
  }
37
- export declare function createRenderConfig(classPrefix: string, horizontal: boolean, interactive: boolean, startPadding: number, crossPadStart: number, crossPadEnd: number, oddClass: string, gap: number, emitter?: Emitter<VListEvents> | null): RenderConfig;
37
+ export declare function createRenderConfig(classPrefix: string, isX: boolean, interactive: boolean, startPadding: number, crossPadStart: number, crossPadEnd: number, oddClass: string, gap: number, emitter?: Emitter<VListEvents> | null): RenderConfig;
38
38
  /**
39
39
  * Calculate visible range and fill EngineState buffers.
40
40
  * Zero allocation — all writes go into pre-allocated TypedArrays.
@@ -12,13 +12,13 @@ export interface ScrollHandler {
12
12
  detach(): void;
13
13
  /** Cancel smooth scroll animation */
14
14
  cancelScroll(): void;
15
- /** Animate to a target scroll position */
16
- smoothScrollTo(target: number, duration: number, setFn?: (pos: number) => void, easing?: (t: number) => number): void;
15
+ /** Animate to a target scroll position (target may be a function for dynamic tracking) */
16
+ smoothScrollTo(target: number | (() => number), duration: number, setFn?: (pos: number) => void, easing?: (t: number) => number, onComplete?: () => void): void;
17
17
  }
18
18
  export interface ScrollHandlerConfig {
19
19
  readonly state: EngineState;
20
20
  readonly viewport: HTMLElement;
21
- readonly horizontal: boolean;
21
+ readonly isX: boolean;
22
22
  readonly wheelEnabled: boolean;
23
23
  readonly idleTimeout: number;
24
24
  /** Override the event target for scroll/wheel listeners (default: viewport) */
@@ -25,9 +25,15 @@ export interface CompiledHooks {
25
25
  readonly idle: readonly IdleHook[];
26
26
  readonly resize: readonly ResizeHook[];
27
27
  }
28
+ export type Axis = "x" | "y";
29
+ export interface AxisConfig {
30
+ readonly primary: Axis;
31
+ readonly cross?: Axis;
32
+ }
28
33
  export interface ResolvedConfig {
34
+ readonly axis: AxisConfig;
35
+ readonly hasCrossAxis: boolean;
29
36
  readonly overscan: number;
30
- readonly horizontal: boolean;
31
37
  readonly reverse: boolean;
32
38
  readonly classPrefix: string;
33
39
  readonly interactive: boolean;
@@ -52,11 +58,6 @@ export interface ElementPool {
52
58
  readonly size: number;
53
59
  clear(): void;
54
60
  }
55
- export type VisibleRangeFn = (scrollPosition: number, containerSize: number, sizeCache: SizeCache, totalItems: number, outStart: {
56
- value: number;
57
- }, outEnd: {
58
- value: number;
59
- }) => void;
60
61
  export interface PluginContext<T extends VListItem = VListItem> {
61
62
  readonly dom: DOMStructure;
62
63
  readonly sizeCache: SizeCache;
@@ -70,7 +71,6 @@ export interface PluginContext<T extends VListItem = VListItem> {
70
71
  registerKeydownHandler(handler: (event: KeyboardEvent) => void): void;
71
72
  registerDestroyHandler(handler: () => void): void;
72
73
  setSizeConfig(config: number | ((index: number) => number)): void;
73
- setVisibleRangeFn(fn: VisibleRangeFn): void;
74
74
  setScrollFns(get: () => number, set: (pos: number) => void): void;
75
75
  setVirtualTotalFn(fn: () => number): void;
76
76
  getItems(): readonly T[];
@@ -86,7 +86,7 @@ export interface PluginContext<T extends VListItem = VListItem> {
86
86
  getItemStateFn(): ((index: number, state: ItemState) => void) | null;
87
87
  readonly rawSizeSpec: number | ((index: number, ...args: unknown[]) => number);
88
88
  scrollTo(position: number): void;
89
- smoothScrollTo(position: number, duration: number, easing?: (t: number) => number): void;
89
+ smoothScrollTo(target: number | (() => number), duration: number, easing?: (t: number) => number, onComplete?: () => void): void;
90
90
  disableDefaultScroll(): void;
91
91
  disableDefaultResize(): void;
92
92
  setScrollTarget(target: EventTarget): void;
package/dist/index.d.ts CHANGED
@@ -38,5 +38,5 @@ export type { SortablePluginConfig } from "./plugins/sortable";
38
38
  export { createStats } from "./utils/stats";
39
39
  export type { Stats, StatsConfig, StatsState } from "./utils/stats";
40
40
  export type { VListItem, VListEvents, ItemConfig, ItemTemplate, ItemState, SelectionMode, SelectionConfig, SelectionState, ScrollbarConfig, ScrollbarPadding, ScrollbarOptions, ScrollConfig, ScrollToOptions, ScrollSnapshot, VListAdapter, AdapterParams, AdapterResponse, Range, ViewportState, EventHandler, Unsubscribe, GridConfig, MasonryConfig, GroupsConfig, GroupHeaderConfig, GridSizeContext, GridHeightContext, } from "./types";
41
- export type { VList, VListPlugin, PluginContext, CreateVListConfig, CompiledHooks, ResolvedConfig, DOMStructure, ElementPool, } from "./core/types";
41
+ export type { Axis, AxisConfig, VList, VListPlugin, PluginContext, CreateVListConfig, CompiledHooks, ResolvedConfig, DOMStructure, ElementPool, } from "./core/types";
42
42
  //# sourceMappingURL=index.d.ts.map