vlist 1.6.2 → 1.6.4

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,6 +1,6 @@
1
1
  # vlist
2
2
 
3
- The virtual list library for every framework. Accessible by default, batteries-included, with composable features — in 10.5 KB.
3
+ The virtual list library for every framework. Accessible by default, batteries-included, with composable features — in 10.6 KB.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/vlist.svg)](https://www.npmjs.com/package/vlist)
6
6
  [![CI](https://github.com/floor/vlist/actions/workflows/ci.yml/badge.svg)](https://github.com/floor/vlist/actions/workflows/ci.yml)
@@ -8,7 +8,7 @@ The virtual list library for every framework. Accessible by default, batteries-i
8
8
 
9
9
  - **Zero dependencies** — framework-agnostic core, tiny adapters for Vue, Svelte, Solid, React
10
10
  - **Accessible** — WAI-ARIA, 2D keyboard navigation, focus recovery, screen-reader DOM ordering
11
- - **10.5 KB gzipped** — composable features with perfect tree-shaking
11
+ - **10.6 KB gzipped** — composable features with perfect tree-shaking
12
12
  - **Constant memory** — ~0.1 MB overhead at any scale, from 10K to 1M+ items
13
13
 
14
14
  ## Install
@@ -52,18 +52,18 @@ const list = vlist({ container: '#app', items, item: { height: 200, template: re
52
52
 
53
53
  | Feature | Size | Description |
54
54
  |---------|------|-------------|
55
- | **Base** | 10.5 KB | Virtualization, ARIA, keyboard nav, gap, padding |
56
- | `withGrid()` | +3.8 KB | 2D grid layout |
57
- | `withMasonry()` | +3.3 KB | Pinterest-style masonry with lane-aware keyboard nav |
58
- | `withTable()` | +5.5 KB | Data table with columns, resize, sort |
59
- | `withGroups()` | +2.7 KB | Sticky/inline headers |
60
- | `withAsync()` | +4.5 KB | Lazy loading with velocity-aware fetching |
55
+ | **Base** | 10.6 KB | Virtualization, ARIA, keyboard nav, gap, padding |
56
+ | `withAsync()` | +4.6 KB | Lazy loading with velocity-aware fetching |
61
57
  | `withSelection()` | +2.7 KB | Single/multiple selection with 2D keyboard nav |
62
58
  | `withScale()` | +3.1 KB | 1M+ items via scroll compression |
59
+ | `withGroups()` | +2.7 KB | Sticky/inline headers |
63
60
  | `withAutoSize()` | +0.9 KB | Auto-measure items via ResizeObserver |
64
- | `withScrollbar()` | +1.1 KB | Custom scrollbar UI |
65
- | `withPage()` | +0.9 KB | Window-level scrolling |
66
- | `withSnapshots()` | +0.7 KB | Scroll position save/restore |
61
+ | `withScrollbar()` | +1.7 KB | Custom scrollbar UI |
62
+ | `withGrid()` | +3.9 KB | 2D grid layout |
63
+ | `withMasonry()` | +3.4 KB | Pinterest-style masonry with lane-aware keyboard nav |
64
+ | `withTable()` | +5.5 KB | Data table with columns, resize, sort |
65
+ | `withPage()` | +0.8 KB | Window-level scrolling |
66
+ | `withSnapshots()` | +0.8 KB | Scroll position save/restore |
67
67
 
68
68
  ## Framework Adapters
69
69
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # vlist
2
2
 
3
- The virtual list library for every framework. Accessible by default, batteries-included, with composable features — in 10.5 KB.
3
+ The virtual list library for every framework. Accessible by default, batteries-included, with composable features — in 10.6 KB.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/vlist.svg)](https://www.npmjs.com/package/vlist)
6
6
  [![CI](https://github.com/floor/vlist/actions/workflows/ci.yml/badge.svg)](https://github.com/floor/vlist/actions/workflows/ci.yml)
@@ -8,7 +8,7 @@ The virtual list library for every framework. Accessible by default, batteries-i
8
8
 
9
9
  - **Zero dependencies** — framework-agnostic core, tiny adapters for Vue, Svelte, Solid, React
10
10
  - **Accessible** — WAI-ARIA, 2D keyboard navigation, focus recovery, screen-reader DOM ordering
11
- - **10.5 KB gzipped** — composable features with perfect tree-shaking
11
+ - **10.6 KB gzipped** — composable features with perfect tree-shaking
12
12
  - **Constant memory** — ~0.1 MB overhead at any scale, from 10K to 1M+ items
13
13
 
14
14
  ## Install
@@ -52,18 +52,18 @@ const list = vlist({ container: '#app', items, item: { height: 200, template: re
52
52
 
53
53
  | Feature | Size | Description |
54
54
  |---------|------|-------------|
55
- | **Base** | 10.5 KB | Virtualization, ARIA, keyboard nav, gap, padding |
56
- | `withGrid()` | +3.8 KB | 2D grid layout |
57
- | `withMasonry()` | +3.3 KB | Pinterest-style masonry with lane-aware keyboard nav |
58
- | `withTable()` | +5.5 KB | Data table with columns, resize, sort |
59
- | `withGroups()` | +2.7 KB | Sticky/inline headers |
60
- | `withAsync()` | +4.5 KB | Lazy loading with velocity-aware fetching |
55
+ | **Base** | 10.6 KB | Virtualization, ARIA, keyboard nav, gap, padding |
56
+ | `withAsync()` | +4.6 KB | Lazy loading with velocity-aware fetching |
61
57
  | `withSelection()` | +2.7 KB | Single/multiple selection with 2D keyboard nav |
62
58
  | `withScale()` | +3.1 KB | 1M+ items via scroll compression |
59
+ | `withGroups()` | +2.7 KB | Sticky/inline headers |
63
60
  | `withAutoSize()` | +0.9 KB | Auto-measure items via ResizeObserver |
64
- | `withScrollbar()` | +1.1 KB | Custom scrollbar UI |
65
- | `withPage()` | +0.9 KB | Window-level scrolling |
66
- | `withSnapshots()` | +0.7 KB | Scroll position save/restore |
61
+ | `withScrollbar()` | +1.7 KB | Custom scrollbar UI |
62
+ | `withGrid()` | +3.9 KB | 2D grid layout |
63
+ | `withMasonry()` | +3.4 KB | Pinterest-style masonry with lane-aware keyboard nav |
64
+ | `withTable()` | +5.5 KB | Data table with columns, resize, sort |
65
+ | `withPage()` | +0.8 KB | Window-level scrolling |
66
+ | `withSnapshots()` | +0.8 KB | Scroll position save/restore |
67
67
 
68
68
  ## Framework Adapters
69
69
 
@@ -12,5 +12,5 @@ import type { DOMStructure } from "./dom";
12
12
  * Wire up baseline single-select ARIA keyboard navigation.
13
13
  * Registers focus/blur listeners, keydown handler, click handler, and destroy cleanup.
14
14
  */
15
- export declare const setupBaselineA11y: <T extends VListItem>($: MRefs<T>, dom: DOMStructure, cp: string, ap: string, hz: boolean, ps: number, pe: number, wr: boolean, methods: Map<string, Function>, rendered: Map<number, HTMLElement>, keydownHandlers: Array<(event: KeyboardEvent) => void>, clickHandlers: Array<(event: MouseEvent) => void>, destroyHandlers: Array<() => void>) => void;
15
+ export declare const setupBaselineA11y: <T extends VListItem>($: MRefs<T>, dom: DOMStructure, cp: string, ap: string, hz: boolean, ps: number, pe: number, wr: boolean, methods: Map<string, Function>, rendered: Map<number, HTMLElement>, keydownHandlers: Array<(event: KeyboardEvent) => void>, clickHandlers: Array<(event: MouseEvent) => void>, destroyHandlers: Array<() => void>, foc: boolean) => void;
16
16
  //# sourceMappingURL=a11y.d.ts.map
@@ -94,6 +94,17 @@ export interface BuilderConfig<T extends VListItem = VListItem> {
94
94
  * Replaces the former `accessible` option.
95
95
  */
96
96
  interactive?: boolean;
97
+ /**
98
+ * Show focus ring on mouse click (default: false).
99
+ * By default, clicking an item updates the focused index but does not
100
+ * show the focus ring — matching the web platform's :focus-visible
101
+ * convention. Set to true for file-manager or spreadsheet-style UIs
102
+ * where the focus indicator doubles as a "current item" marker.
103
+ *
104
+ * Applies to the baseline single-select keyboard navigation. When
105
+ * using withSelection(), pass focusOnClick in its own config instead.
106
+ */
107
+ focusOnClick?: boolean;
97
108
  /** @deprecated Use `interactive` instead */
98
109
  accessible?: boolean;
99
110
  /** Reverse mode for chat UIs */
@@ -40,6 +40,27 @@ export interface ScrollbarFeatureConfig {
40
40
  * When false, the scrollbar only appears on scroll or hover near edge.
41
41
  */
42
42
  showOnViewportEnter?: boolean;
43
+ /**
44
+ * Reserve layout space for the scrollbar (default: false).
45
+ * When true, content shrinks to make room for the scrollbar track so it
46
+ * never overlaps items. Equivalent to CSS `scrollbar-gutter: stable`.
47
+ */
48
+ gutter?: boolean;
49
+ /**
50
+ * Padding between the scrollbar track and the viewport edges in pixels (default: 1).
51
+ * Insets the track from the right wall and from the top and bottom, so the scrollbar
52
+ * floats rather than sitting flush against the edges. Also adjusts the thumb travel
53
+ * range to keep position accurate.
54
+ * Can also be set globally via the `--vlist-custom-scrollbar-padding` CSS variable.
55
+ */
56
+ padding?: number;
57
+ /**
58
+ * Behavior when clicking on the scrollbar track (not the thumb) (default: 'jump').
59
+ * - `'jump'` — jumps directly to the clicked position (centers the thumb there).
60
+ * - `'page'` — scrolls by one page (containerSize) toward the clicked position,
61
+ * matching macOS native scrollbar behavior.
62
+ */
63
+ clickBehavior?: 'jump' | 'page';
43
64
  }
44
65
  /**
45
66
  * Create a scrollbar feature for the builder.
@@ -12,6 +12,8 @@
12
12
  * - CSS variables for customization
13
13
  * - Horizontal mode support (direction-aware axis)
14
14
  */
15
+ import type { ScrollbarPadding } from "../../types";
16
+ export type { ScrollbarPadding } from "../../types";
15
17
  /** Scrollbar configuration */
16
18
  export interface ScrollbarConfig {
17
19
  /** Enable scrollbar (default: true when compressed) */
@@ -20,7 +22,10 @@ export interface ScrollbarConfig {
20
22
  autoHide?: boolean;
21
23
  /** Auto-hide delay in milliseconds (default: 1000) */
22
24
  autoHideDelay?: number;
23
- /** Minimum thumb size in pixels (default: 30) */
25
+ /**
26
+ * Minimum thumb size in pixels (default: 15).
27
+ * Can also be set globally via the `--vlist-custom-scrollbar-min-thumb-size` CSS variable.
28
+ */
24
29
  minThumbSize?: number;
25
30
  /**
26
31
  * Show scrollbar when hovering near the scrollbar edge (default: true).
@@ -30,10 +35,13 @@ export interface ScrollbarConfig {
30
35
  */
31
36
  showOnHover?: boolean;
32
37
  /**
33
- * Width of the invisible hover zone in pixels (default: 16).
34
- * Only used when `showOnHover` is true.
35
- * A wider zone makes the scrollbar easier to discover;
36
- * a narrower zone avoids interference with content near the edge.
38
+ * Width of the edge zone in pixels (default: `wallPadding + 16`).
39
+ * The edge zone covers the scrollbar edge including the padding margin, making
40
+ * the full area clickable regardless of `showOnHover`. When `showOnHover` is
41
+ * true, it also acts as the hover-to-reveal target.
42
+ * Defaults to wall-side padding (`right` for vertical, `bottom` for horizontal)
43
+ * plus 16px reach, so the zone always covers the full inset track plus a
44
+ * comfortable buffer.
37
45
  */
38
46
  hoverZoneWidth?: number;
39
47
  /**
@@ -42,6 +50,24 @@ export interface ScrollbarConfig {
42
50
  * near the scrollbar edge (if `showOnHover` is true).
43
51
  */
44
52
  showOnViewportEnter?: boolean;
53
+ /**
54
+ * Padding between the scrollbar track and the viewport edges (default: 2).
55
+ * Insets the track from the edges so the scrollbar floats rather than sitting flush.
56
+ * Also adjusts the thumb travel range to keep position accurate.
57
+ *
58
+ * Accepts a single number (all sides) or an object for per-side control:
59
+ * `{ top?, right?, bottom?, left? }` — omitted sides default to 2px.
60
+ *
61
+ * Can also be set globally via the `--vlist-custom-scrollbar-padding-{side}` CSS variables.
62
+ */
63
+ padding?: ScrollbarPadding;
64
+ /**
65
+ * Behavior when clicking on the scrollbar track (not the thumb) (default: 'page').
66
+ * - `'page'` — scrolls by one page (containerSize) toward the clicked position,
67
+ * matching macOS native scrollbar behavior. Hold to scroll continuously.
68
+ * - `'jump'` — jumps directly to the clicked position (centers the thumb there).
69
+ */
70
+ clickBehavior?: 'jump' | 'page';
45
71
  }
46
72
  /** Scrollbar instance */
47
73
  export interface Scrollbar {
@@ -55,6 +55,14 @@ export interface SelectionFeatureConfig {
55
55
  * Shift+Click, or Ctrl+Shift+Home/End.
56
56
  */
57
57
  shiftArrowToggle?: "origin" | "destination";
58
+ /**
59
+ * Show focus ring on mouse click (default: false).
60
+ * By default, clicking an item selects it but does not show the focus
61
+ * ring — matching the web platform's :focus-visible convention.
62
+ * Set to true for file-manager or spreadsheet-style UIs where the
63
+ * focus indicator doubles as a "current item" marker.
64
+ */
65
+ focusOnClick?: boolean;
58
66
  }
59
67
  /**
60
68
  * Create a selection feature for the builder.
package/dist/index.d.ts CHANGED
@@ -24,6 +24,6 @@ export { withTable } from "./features/table";
24
24
  export { withAutoSize } from "./features/autosize";
25
25
  export { createStats } from "./utils/stats";
26
26
  export type { Stats, StatsConfig, StatsState } from "./utils/stats";
27
- export type { VListItem, VListEvents, ItemConfig, ItemTemplate, ItemState, SelectionMode, SelectionConfig, SelectionState, ScrollbarConfig, ScrollbarOptions, ScrollConfig, ScrollToOptions, ScrollSnapshot, VListAdapter, AdapterParams, AdapterResponse, Range, ViewportState, EventHandler, Unsubscribe, GridConfig, MasonryConfig, GroupsConfig, GroupHeaderConfig, GridSizeContext, GridHeightContext, } from "./types";
27
+ 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";
28
28
  export type { VListBuilder, VList, BuilderConfig, VListConfig, VListFeature, BuilderContext, ReloadOptions, } from "./builder";
29
29
  //# sourceMappingURL=index.d.ts.map