vlist 1.7.6 → 1.7.8

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,17 +1,17 @@
1
1
  # vlist
2
2
 
3
- The virtual list library for every framework. Accessible by default, batteries-included, with composable features — in 11.2 KB.
3
+ The virtual list library for every framework. Accessible by default, batteries-included, with composable features — in 10.7 KB.
4
4
 
5
- **v1.7.6** — [Changelog](./CHANGELOG.md)
5
+ **v1.7.8** — [Changelog](./CHANGELOG.md)
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/vlist.svg)](https://www.npmjs.com/package/vlist)
8
8
  [![CI](https://github.com/floor/vlist/actions/workflows/ci.yml/badge.svg)](https://github.com/floor/vlist/actions/workflows/ci.yml)
9
9
  [![license](https://img.shields.io/npm/l/vlist.svg)](https://github.com/floor/vlist/blob/main/LICENSE)
10
10
 
11
- - **New: `withSortable()`**drag-and-drop reordering with auto-scroll, keyboard support, and ARIA announcements
11
+ - **New: 10.7 KB base** optimized from 11.2 KB, every feature bundle reduced
12
12
  - **Accessible** — WAI-ARIA, 2D keyboard navigation, focus recovery, screen-reader DOM ordering, ARIA live region
13
13
  - **Zero dependencies** — framework-agnostic core with tiny adapters for Vue, Svelte, Solid, React
14
- - **11.2 KB gzipped** — composable features with perfect tree-shaking
14
+ - **10.7 KB gzipped** — composable features 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, async, selection, sortable, scale** — all opt-in
17
17
  - **Vertical & horizontal** — single axis-neutral code path, every feature works in both orientations
@@ -94,19 +94,19 @@ const list = vlist({
94
94
 
95
95
  | Feature | Size | Description |
96
96
  |---------|------|-------------|
97
- | **Base** | 11.2 KB | Virtualization, ARIA, keyboard nav, gap, padding |
98
- | `withAsync()` | +4.5 KB | Lazy loading with velocity-aware fetching |
99
- | `withSelection()` | +3.2 KB | Single/multiple selection with 2D keyboard nav |
100
- | `withScale()` | +3.7 KB | 1M+ items via scroll compression |
101
- | `withGroups()` | +4.6 KB | Sticky/inline headers with async group discovery |
97
+ | **Base** | 10.7 KB | Virtualization, ARIA, keyboard nav, gap, padding |
98
+ | `withAsync()` | +4.4 KB | Lazy loading with velocity-aware fetching |
99
+ | `withSelection()` | +3.0 KB | Single/multiple selection with 2D keyboard nav |
100
+ | `withScale()` | +3.6 KB | 1M+ items via scroll compression |
101
+ | `withGroups()` | +4.4 KB | Sticky/inline headers with async group discovery |
102
102
  | `withAutoSize()` | +0.9 KB | Auto-measure items via ResizeObserver |
103
103
  | `withScrollbar()` | +1.8 KB | Custom scrollbar UI |
104
104
  | `withGrid()` | +4.0 KB | 2D grid layout |
105
- | `withMasonry()` | +3.5 KB | Pinterest-style masonry with lane-aware keyboard nav |
105
+ | `withMasonry()` | +3.4 KB | Pinterest-style masonry with lane-aware keyboard nav |
106
106
  | `withTable()` | +5.5 KB | Data table with columns, resize, sort |
107
107
  | `withPage()` | +0.7 KB | Window-level scrolling |
108
- | `withSortable()` | +3.0 KB | Drag-and-drop reordering with auto-scroll |
109
- | `withSnapshots()` | +1.3 KB | Scroll position save/restore |
108
+ | `withSortable()` | +2.9 KB | Drag-and-drop reordering with auto-scroll |
109
+ | `withSnapshots()` | +1.2 KB | Scroll position save/restore |
110
110
 
111
111
  ## Examples
112
112
 
package/README.md CHANGED
@@ -1,15 +1,17 @@
1
1
  # vlist
2
2
 
3
- The virtual list library for every framework. Accessible by default, batteries-included, with composable features — in 11.2 KB.
3
+ The virtual list library for every framework. Accessible by default, batteries-included, with composable features — in 10.7 KB.
4
+
5
+ **v1.7.8** — [Changelog](https://github.com/floor/vlist/blob/main/CHANGELOG.md)
4
6
 
5
7
  [![npm version](https://img.shields.io/npm/v/vlist.svg)](https://www.npmjs.com/package/vlist)
6
8
  [![CI](https://github.com/floor/vlist/actions/workflows/ci.yml/badge.svg)](https://github.com/floor/vlist/actions/workflows/ci.yml)
7
9
  [![license](https://img.shields.io/npm/l/vlist.svg)](https://github.com/floor/vlist/blob/main/LICENSE)
8
10
 
9
- - **New: `withSortable()`**drag-and-drop reordering with auto-scroll, keyboard support, and ARIA announcements
11
+ - **New: 10.7 KB base** optimized from 11.2 KB, every feature bundle reduced
10
12
  - **Zero dependencies** — framework-agnostic core, tiny adapters for Vue, Svelte, Solid, React
11
13
  - **Accessible** — WAI-ARIA, 2D keyboard navigation, focus recovery, screen-reader DOM ordering
12
- - **11.2 KB gzipped** — composable features with perfect tree-shaking
14
+ - **10.7 KB gzipped** — composable features with perfect tree-shaking
13
15
  - **Constant memory** — ~0.1 MB overhead at any scale, from 10K to 1M+ items
14
16
  - **Vertical & horizontal** — single axis-neutral code path, every feature works in both orientations
15
17
 
@@ -54,19 +56,19 @@ const list = vlist({ container: '#app', items, item: { height: 200, template: re
54
56
 
55
57
  | Feature | Size | Description |
56
58
  |---------|------|-------------|
57
- | **Base** | 11.2 KB | Virtualization, ARIA, keyboard nav, gap, padding |
58
- | `withAsync()` | +4.5 KB | Lazy loading with velocity-aware fetching |
59
- | `withSelection()` | +3.2 KB | Single/multiple selection with 2D keyboard nav |
60
- | `withScale()` | +3.7 KB | 1M+ items via scroll compression |
61
- | `withGroups()` | +4.6 KB | Sticky/inline headers with async group discovery |
59
+ | **Base** | 10.7 KB | Virtualization, ARIA, keyboard nav, gap, padding |
60
+ | `withAsync()` | +4.4 KB | Lazy loading with velocity-aware fetching |
61
+ | `withSelection()` | +3.0 KB | Single/multiple selection with 2D keyboard nav |
62
+ | `withScale()` | +3.6 KB | 1M+ items via scroll compression |
63
+ | `withGroups()` | +4.4 KB | Sticky/inline headers with async group discovery |
62
64
  | `withAutoSize()` | +0.9 KB | Auto-measure items via ResizeObserver |
63
65
  | `withScrollbar()` | +1.8 KB | Custom scrollbar UI |
64
66
  | `withGrid()` | +4.0 KB | 2D grid layout |
65
- | `withMasonry()` | +3.5 KB | Pinterest-style masonry with lane-aware keyboard nav |
67
+ | `withMasonry()` | +3.4 KB | Pinterest-style masonry with lane-aware keyboard nav |
66
68
  | `withTable()` | +5.5 KB | Data table with columns, resize, sort |
67
69
  | `withPage()` | +0.7 KB | Window-level scrolling |
68
- | `withSortable()` | +3.0 KB | Drag-and-drop reordering with auto-scroll |
69
- | `withSnapshots()` | +1.3 KB | Scroll position save/restore |
70
+ | `withSortable()` | +2.9 KB | Drag-and-drop reordering with auto-scroll |
71
+ | `withSnapshots()` | +1.2 KB | Scroll position save/restore |
70
72
 
71
73
  ## Framework Adapters
72
74
 
@@ -64,5 +64,5 @@ export interface AsyncGroupBridge {
64
64
  * @param getItem - Item accessor from the async data manager
65
65
  * @param isItemLoaded - Check if an item at index is loaded (not placeholder)
66
66
  */
67
- export declare const createAsyncGroupBridge: (config: AsyncBridgeConfig, _getItem: (index: number) => VListItem | undefined, _isItemLoaded: (index: number) => boolean) => AsyncGroupBridge;
67
+ export declare const createAsyncGroupBridge: (config: AsyncBridgeConfig, _getItem?: (index: number) => VListItem | undefined, _isItemLoaded?: (index: number) => boolean) => AsyncGroupBridge;
68
68
  //# sourceMappingURL=async-bridge.d.ts.map
@@ -15,6 +15,16 @@
15
15
  */
16
16
  import type { GroupsConfig, GroupBoundary, GroupLayout, GroupHeaderItem } from "./types";
17
17
  import type { VListItem } from "../../types";
18
+ /**
19
+ * Find the last group whose headerLayoutIndex <= layoutIndex.
20
+ * Returns the group's index in the groups array.
21
+ */
22
+ export declare const findGroupByLayoutIndex: (groups: readonly GroupBoundary[], layoutIndex: number) => number;
23
+ /**
24
+ * Find the last group whose firstDataIndex <= dataIndex.
25
+ * Returns the group's index in the groups array.
26
+ */
27
+ export declare const findGroupByDataIndex: (groups: readonly GroupBoundary[], dataIndex: number) => number;
18
28
  /**
19
29
  * Build the transformed layout items array with header pseudo-items inserted
20
30
  * at group boundaries.
@@ -17,5 +17,10 @@
17
17
  */
18
18
  import type { GroupLayout, StickyHeader } from "./types";
19
19
  import type { SizeCache } from "../../rendering/sizes";
20
- export declare const createStickyHeader: (root: HTMLElement, layout: GroupLayout, sizeCache: SizeCache, renderInto: (slot: HTMLElement, groupIndex: number) => void, classPrefix: string, horizontal?: boolean, stickyOffset?: number, getCompressionRatio?: () => number) => StickyHeader;
20
+ /**
21
+ * Create the sticky header container element upfront (before data arrives)
22
+ * so the DOM structure is stable and doesn't cause a visual shift.
23
+ */
24
+ export declare const createStickyContainer: (root: HTMLElement, classPrefix: string, horizontal: boolean, headerHeight: number, stickyOffset?: number) => HTMLElement;
25
+ export declare const createStickyHeader: (root: HTMLElement, layout: GroupLayout, sizeCache: SizeCache, renderInto: (slot: HTMLElement, groupIndex: number) => void, classPrefix: string, horizontal?: boolean, stickyOffset?: number, getCompressionRatio?: () => number, existingContainer?: HTMLElement) => StickyHeader;
21
26
  //# sourceMappingURL=sticky.d.ts.map
@@ -89,11 +89,12 @@ export type ScrollCallback = (position: number) => void;
89
89
  /**
90
90
  * Create a scrollbar instance
91
91
  *
92
- * @param viewport - The viewport element to attach scrollbar to
92
+ * @param viewport - The viewport element (used for events and CSS variables)
93
93
  * @param onScroll - Callback when scrollbar interaction causes scroll
94
94
  * @param config - Scrollbar configuration
95
95
  * @param classPrefix - CSS class prefix (default: 'vlist')
96
96
  * @param horizontal - Whether the scrollbar is horizontal (default: false)
97
+ * @param parent - Element to append scrollbar DOM to (default: viewport)
97
98
  */
98
- export declare const createScrollbar: (viewport: HTMLElement, onScroll: ScrollCallback, config?: ScrollbarConfig, classPrefix?: string, horizontal?: boolean) => Scrollbar;
99
+ export declare const createScrollbar: (viewport: HTMLElement, onScroll: ScrollCallback, config?: ScrollbarConfig, classPrefix?: string, horizontal?: boolean, parent?: HTMLElement) => Scrollbar;
99
100
  //# sourceMappingURL=scrollbar.d.ts.map