@floor/vlist 0.5.7 → 0.6.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.
Files changed (108) hide show
  1. package/README.md +793 -592
  2. package/dist/async/index.js +1 -0
  3. package/dist/builder/context.d.ts +3 -3
  4. package/dist/builder/context.d.ts.map +1 -1
  5. package/dist/builder/core.d.ts +1 -1
  6. package/dist/builder/core.d.ts.map +1 -1
  7. package/dist/builder/index.js +1 -250
  8. package/dist/builder/types.d.ts +3 -3
  9. package/dist/builder/types.d.ts.map +1 -1
  10. package/dist/compression/index.js +1 -104
  11. package/dist/core/core.js +1 -0
  12. package/dist/core/full.d.ts +22 -0
  13. package/dist/core/full.d.ts.map +1 -0
  14. package/dist/core/index.js +1 -133
  15. package/dist/core/lite.d.ts +129 -0
  16. package/dist/core/lite.d.ts.map +1 -0
  17. package/dist/core/minimal.d.ts +104 -0
  18. package/dist/core/minimal.d.ts.map +1 -0
  19. package/dist/core-light.js +1 -68
  20. package/dist/data/index.js +1 -233
  21. package/dist/features/async/index.d.ts +9 -0
  22. package/dist/features/async/index.d.ts.map +1 -0
  23. package/dist/features/async/manager.d.ts +103 -0
  24. package/dist/features/async/manager.d.ts.map +1 -0
  25. package/dist/features/async/placeholder.d.ts +62 -0
  26. package/dist/features/async/placeholder.d.ts.map +1 -0
  27. package/dist/features/async/plugin.d.ts +60 -0
  28. package/dist/features/async/plugin.d.ts.map +1 -0
  29. package/dist/features/async/sparse.d.ts +91 -0
  30. package/dist/features/async/sparse.d.ts.map +1 -0
  31. package/dist/features/grid/index.d.ts +9 -0
  32. package/dist/features/grid/index.d.ts.map +1 -0
  33. package/dist/features/grid/layout.d.ts +29 -0
  34. package/dist/features/grid/layout.d.ts.map +1 -0
  35. package/dist/features/grid/plugin.d.ts +48 -0
  36. package/dist/features/grid/plugin.d.ts.map +1 -0
  37. package/dist/features/grid/renderer.d.ts +55 -0
  38. package/dist/features/grid/renderer.d.ts.map +1 -0
  39. package/dist/features/grid/types.d.ts +71 -0
  40. package/dist/features/grid/types.d.ts.map +1 -0
  41. package/dist/features/page/index.d.ts +8 -0
  42. package/dist/features/page/index.d.ts.map +1 -0
  43. package/dist/features/page/plugin.d.ts +53 -0
  44. package/dist/features/page/plugin.d.ts.map +1 -0
  45. package/dist/features/scale/index.d.ts +10 -0
  46. package/dist/features/scale/index.d.ts.map +1 -0
  47. package/dist/features/scale/plugin.d.ts +42 -0
  48. package/dist/features/scale/plugin.d.ts.map +1 -0
  49. package/dist/features/scrollbar/controller.d.ts +121 -0
  50. package/dist/features/scrollbar/controller.d.ts.map +1 -0
  51. package/dist/features/scrollbar/index.d.ts +8 -0
  52. package/dist/features/scrollbar/index.d.ts.map +1 -0
  53. package/dist/features/scrollbar/plugin.d.ts +60 -0
  54. package/dist/features/scrollbar/plugin.d.ts.map +1 -0
  55. package/dist/features/scrollbar/scrollbar.d.ts +73 -0
  56. package/dist/features/scrollbar/scrollbar.d.ts.map +1 -0
  57. package/dist/features/sections/index.d.ts +10 -0
  58. package/dist/features/sections/index.d.ts.map +1 -0
  59. package/dist/features/sections/layout.d.ts +46 -0
  60. package/dist/features/sections/layout.d.ts.map +1 -0
  61. package/dist/features/sections/plugin.d.ts +64 -0
  62. package/dist/features/sections/plugin.d.ts.map +1 -0
  63. package/dist/features/sections/sticky.d.ts +33 -0
  64. package/dist/features/sections/sticky.d.ts.map +1 -0
  65. package/dist/features/sections/types.d.ts +86 -0
  66. package/dist/features/sections/types.d.ts.map +1 -0
  67. package/dist/features/selection/index.d.ts +7 -0
  68. package/dist/features/selection/index.d.ts.map +1 -0
  69. package/dist/features/selection/plugin.d.ts +44 -0
  70. package/dist/features/selection/plugin.d.ts.map +1 -0
  71. package/dist/features/selection/state.d.ts +102 -0
  72. package/dist/features/selection/state.d.ts.map +1 -0
  73. package/dist/features/snapshots/index.d.ts +8 -0
  74. package/dist/features/snapshots/index.d.ts.map +1 -0
  75. package/dist/features/snapshots/plugin.d.ts +44 -0
  76. package/dist/features/snapshots/plugin.d.ts.map +1 -0
  77. package/dist/grid/index.js +1 -198
  78. package/dist/groups/index.js +1 -204
  79. package/dist/index.d.ts +17 -8
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +1 -1129
  82. package/dist/page/index.js +1 -0
  83. package/dist/plugins/groups/plugin.d.ts +3 -2
  84. package/dist/plugins/groups/plugin.d.ts.map +1 -1
  85. package/dist/react/index.js +1 -1024
  86. package/dist/react/react.js +1 -0
  87. package/dist/rendering/heights.d.ts +63 -0
  88. package/dist/rendering/heights.d.ts.map +1 -0
  89. package/dist/rendering/index.d.ts +9 -0
  90. package/dist/rendering/index.d.ts.map +1 -0
  91. package/dist/rendering/renderer.d.ts +103 -0
  92. package/dist/rendering/renderer.d.ts.map +1 -0
  93. package/dist/rendering/scale.d.ts +116 -0
  94. package/dist/rendering/scale.d.ts.map +1 -0
  95. package/dist/rendering/viewport.d.ts +139 -0
  96. package/dist/rendering/viewport.d.ts.map +1 -0
  97. package/dist/scale/index.js +1 -0
  98. package/dist/scroll/index.js +1 -116
  99. package/dist/scrollbar/index.js +1 -0
  100. package/dist/sections/index.js +1 -0
  101. package/dist/selection/index.js +1 -96
  102. package/dist/snapshots/index.js +1 -21
  103. package/dist/svelte/index.js +1 -1012
  104. package/dist/svelte/svelte.js +1 -0
  105. package/dist/vue/index.js +1 -1018
  106. package/dist/vue/vue.js +1 -0
  107. package/dist/window/index.js +1 -18
  108. package/package.json +1 -1
@@ -0,0 +1,29 @@
1
+ /**
2
+ * vlist - Grid Layout
3
+ * Pure O(1) calculations for mapping between flat item indices and grid positions.
4
+ *
5
+ * The grid transforms a flat list into rows:
6
+ * Items: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
7
+ * Grid (columns=4):
8
+ * Row 0: [0, 1, 2, 3]
9
+ * Row 1: [4, 5, 6, 7]
10
+ * Row 2: [8, 9] ← partially filled last row
11
+ *
12
+ * All operations are O(1) — integer division and modulo only.
13
+ */
14
+ import type { GridConfig, GridLayout } from "./types";
15
+ /**
16
+ * Extended grid config with optional groups support
17
+ */
18
+ export interface GridConfigWithGroups extends GridConfig {
19
+ /** Optional: check if an item index is a group header (for groups-aware layout) */
20
+ isHeaderFn?: (index: number) => boolean;
21
+ }
22
+ /**
23
+ * Create a GridLayout instance.
24
+ *
25
+ * @param config - Grid configuration (columns, gap, optional isHeaderFn)
26
+ * @returns GridLayout with O(1) mapping functions (or groups-aware if isHeaderFn provided)
27
+ */
28
+ export declare const createGridLayout: (config: GridConfigWithGroups) => GridLayout;
29
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/features/grid/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAA2B,MAAM,SAAS,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD,mFAAmF;IACnF,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CACzC;AAMD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,oBAAoB,KAAG,UA4R/D,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * vlist/grid - Builder Plugin
3
+ * Switches from list layout to a 2D grid with configurable columns and gap.
4
+ *
5
+ * Priority: 10 (runs first — replaces the renderer before anything else renders)
6
+ *
7
+ * What it wires:
8
+ * - Replaces renderer — swaps the list renderer with a grid renderer
9
+ * - Redefines virtual total — the virtualizer sees rows, not items
10
+ * - Column width calculation — recalculated on resize
11
+ * - Item positioning — each item gets translateX (column) and translateY (row)
12
+ * - CSS class — adds .vlist--grid to the root element
13
+ *
14
+ * Restrictions:
15
+ * - Cannot be combined with direction: 'horizontal'
16
+ * - Cannot be combined with reverse: true
17
+ *
18
+ * Can be combined with withGroups for grouped 2D layouts.
19
+ */
20
+ import type { VListItem } from "../../types";
21
+ import type { VListPlugin } from "../../builder/types";
22
+ /** Grid plugin configuration */
23
+ export interface GridPluginConfig {
24
+ /** Number of columns (required, >= 1) */
25
+ columns: number;
26
+ /** Gap between items in pixels (default: 0) */
27
+ gap?: number;
28
+ }
29
+ /**
30
+ * Create a grid plugin for the builder.
31
+ *
32
+ * Switches from list layout to a 2D grid with configurable columns and gap.
33
+ *
34
+ * ```ts
35
+ * import { vlist } from 'vlist/builder'
36
+ * import { withGrid } from 'vlist/grid'
37
+ *
38
+ * const gallery = vlist({
39
+ * container: '#gallery',
40
+ * item: { height: 200, template: renderPhoto },
41
+ * items: photos,
42
+ * })
43
+ * .use(withGrid({ columns: 4, gap: 8 }))
44
+ * .build()
45
+ * ```
46
+ */
47
+ export declare const withGrid: <T extends VListItem = VListItem>(config: GridPluginConfig) => VListPlugin<T>;
48
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/features/grid/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAUvE,gCAAgC;AAChC,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAEhB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,SAAS,GAAG,SAAS,EACtD,QAAQ,gBAAgB,KACvB,WAAW,CAAC,CAAC,CA4Zf,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * vlist - Grid Renderer
3
+ * Renders items in a 2D grid layout within the virtual scroll container.
4
+ *
5
+ * Extends the base renderer pattern but positions items using both
6
+ * row offsets (translateY from the height cache) and column offsets
7
+ * (translateX calculated from column index and container width).
8
+ *
9
+ * Key differences from the list renderer:
10
+ * - Items are positioned with translate(x, y) instead of just translateY(y)
11
+ * - Item width is set to columnWidth (containerWidth / columns - gaps)
12
+ * - The "index" in the rendered map is the FLAT ITEM INDEX (not row index)
13
+ * - Row offsets come from the height cache (which operates on row indices)
14
+ * - Column offsets are calculated from itemIndex % columns
15
+ */
16
+ import type { VListItem, ItemTemplate, Range } from "../../types";
17
+ import type { HeightCache } from "../../rendering/heights";
18
+ import type { CompressionContext } from "../../rendering/renderer";
19
+ import type { GridLayout } from "./types";
20
+ /** Grid renderer instance */
21
+ export interface GridRenderer<T extends VListItem = VListItem> {
22
+ /** Render items for a flat item range, positioned in a 2D grid */
23
+ render: (items: T[], range: Range, selectedIds: Set<string | number>, focusedIndex: number, compressionCtx?: CompressionContext) => void;
24
+ /** Update item positions (for compressed scrolling) */
25
+ updatePositions: (compressionCtx: CompressionContext) => void;
26
+ /** Update a single item */
27
+ updateItem: (index: number, item: T, isSelected: boolean, isFocused: boolean) => void;
28
+ /** Update only CSS classes on a rendered item (no template re-evaluation) */
29
+ updateItemClasses: (index: number, isSelected: boolean, isFocused: boolean) => void;
30
+ /** Get rendered item element by flat item index */
31
+ getElement: (index: number) => HTMLElement | undefined;
32
+ /** Update container width (call on resize) */
33
+ updateContainerWidth: (width: number) => void;
34
+ /** Clear all rendered items */
35
+ clear: () => void;
36
+ /** Destroy renderer and cleanup */
37
+ destroy: () => void;
38
+ }
39
+ /**
40
+ * Create a grid renderer for managing DOM elements in a 2D layout.
41
+ *
42
+ * The grid renderer receives flat item ranges (not row ranges) and
43
+ * positions each item at the correct (row, col) coordinate.
44
+ *
45
+ * @param itemsContainer - The DOM element that holds rendered items
46
+ * @param template - Item template function
47
+ * @param heightCache - Height cache operating on ROW indices
48
+ * @param gridLayout - Grid layout for row/col calculations
49
+ * @param classPrefix - CSS class prefix
50
+ * @param initialContainerWidth - Initial container width for column sizing
51
+ * @param totalItemsGetter - Optional getter for total item count (for aria-setsize)
52
+ * @param ariaIdPrefix - Optional unique prefix for element IDs (for aria-activedescendant)
53
+ */
54
+ export declare const createGridRenderer: <T extends VListItem = VListItem>(itemsContainer: HTMLElement, template: ItemTemplate<T>, heightCache: HeightCache, gridLayout: GridLayout, classPrefix: string, initialContainerWidth: number, totalItemsGetter?: () => number, ariaIdPrefix?: string) => GridRenderer<T>;
55
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/features/grid/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EAEZ,KAAK,EAEN,MAAM,aAAa,CAAC;AAOrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAO1C,6BAA6B;AAC7B,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC3D,kEAAkE;IAClE,MAAM,EAAE,CACN,KAAK,EAAE,CAAC,EAAE,EACV,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EACjC,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,kBAAkB,KAChC,IAAI,CAAC;IAEV,uDAAuD;IACvD,eAAe,EAAE,CAAC,cAAc,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAE9D,2BAA2B;IAC3B,UAAU,EAAE,CACV,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,EACP,UAAU,EAAE,OAAO,EACnB,SAAS,EAAE,OAAO,KACf,IAAI,CAAC;IAEV,6EAA6E;IAC7E,iBAAiB,EAAE,CACjB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,OAAO,EACnB,SAAS,EAAE,OAAO,KACf,IAAI,CAAC;IAEV,mDAAmD;IACnD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;IAEvD,8CAA8C;IAC9C,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9C,+BAA+B;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAoDD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,SAAS,GAAG,SAAS,EAChE,gBAAgB,WAAW,EAC3B,UAAU,YAAY,CAAC,CAAC,CAAC,EACzB,aAAa,WAAW,EACxB,YAAY,UAAU,EACtB,aAAa,MAAM,EACnB,uBAAuB,MAAM,EAC7B,mBAAmB,MAAM,MAAM,EAC/B,eAAe,MAAM,KACpB,YAAY,CAAC,CAAC,CAmahB,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * vlist - Grid Types
3
+ * Types for grid/card layout mode
4
+ *
5
+ * Grid layout transforms a flat list of items into a 2D grid where:
6
+ * - Virtualization operates on ROWS (not individual items)
7
+ * - Each row contains `columns` items side by side
8
+ * - Items are positioned using row/column coordinates
9
+ * - Compression applies to row count, not item count
10
+ */
11
+ import type { GridConfig } from "../../types";
12
+ export type { GridConfig };
13
+ /** Row/column position of an item */
14
+ export interface GridPosition {
15
+ /** Row index (0-based) */
16
+ row: number;
17
+ /** Column index (0-based) */
18
+ col: number;
19
+ }
20
+ /** Flat item range corresponding to a row range */
21
+ export interface ItemRange {
22
+ /** First item index (inclusive) */
23
+ start: number;
24
+ /** Last item index (inclusive) */
25
+ end: number;
26
+ }
27
+ /**
28
+ * GridLayout — maps between flat item indices and row/column positions.
29
+ *
30
+ * The virtualizer sees "rows" as its unit of work. Each row contains
31
+ * up to `columns` items. The last row may be partially filled.
32
+ *
33
+ * All operations are O(1) — just integer division and modulo.
34
+ */
35
+ export interface GridLayout {
36
+ /** Number of columns */
37
+ readonly columns: number;
38
+ /** Gap between items in pixels */
39
+ readonly gap: number;
40
+ /** Update grid configuration without recreating the layout */
41
+ update: (config: Partial<GridConfig>) => void;
42
+ /** Get total number of rows for a given item count */
43
+ getTotalRows: (totalItems: number) => number;
44
+ /** Get the row/col position for a flat item index */
45
+ getPosition: (itemIndex: number) => GridPosition;
46
+ /** Get the row index for a flat item index */
47
+ getRow: (itemIndex: number) => number;
48
+ /** Get the column index for a flat item index */
49
+ getCol: (itemIndex: number) => number;
50
+ /**
51
+ * Get the flat item range for a range of rows.
52
+ * The last row may be partially filled (end is clamped to totalItems - 1).
53
+ */
54
+ getItemRange: (rowStart: number, rowEnd: number, totalItems: number) => ItemRange;
55
+ /**
56
+ * Get the flat item index from a row and column.
57
+ * Returns -1 if out of bounds.
58
+ */
59
+ getItemIndex: (row: number, col: number, totalItems: number) => number;
60
+ /**
61
+ * Calculate column width given container width.
62
+ * Accounts for gaps: width = (containerWidth - (columns - 1) * gap) / columns
63
+ */
64
+ getColumnWidth: (containerWidth: number) => number;
65
+ /**
66
+ * Calculate the X offset for a column index.
67
+ * offset = col * (columnWidth + gap)
68
+ */
69
+ getColumnOffset: (col: number, containerWidth: number) => number;
70
+ }
71
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/grid/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,YAAY,EAAE,UAAU,EAAE,CAAC;AAM3B,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IAEZ,6BAA6B;IAC7B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,mDAAmD;AACnD,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,kCAAkC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,8DAA8D;IAC9D,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAE9C,sDAAsD;IACtD,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAE7C,qDAAqD;IACrD,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,YAAY,CAAC;IAEjD,8CAA8C;IAC9C,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtC,iDAAiD;IACjD,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtC;;;OAGG;IACH,YAAY,EAAE,CACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,KACf,SAAS,CAAC;IAEf;;;OAGG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAEvE;;;OAGG;IACH,cAAc,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;IAEnD;;;OAGG;IACH,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;CAClE"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * vlist/window - Window Scroll Mode Plugin
3
+ *
4
+ * Entry point for the window scroll plugin.
5
+ */
6
+ export { withPage } from "./plugin";
7
+ export type { VListPlugin } from "../../builder/types";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/page/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * vlist/window - Window Scroll Mode Plugin
3
+ *
4
+ * Enables the list to scroll with the page instead of in its own container.
5
+ * Useful for infinite feeds, full-page lists, and chat UIs that integrate
6
+ * with page scroll.
7
+ *
8
+ * Priority: 5 (runs early, before other plugins that depend on scroll)
9
+ *
10
+ * What it does:
11
+ * - Uses window as scroll target instead of viewport element
12
+ * - Calculates scroll position relative to document
13
+ * - Uses window.innerWidth/innerHeight for container dimensions
14
+ * - Listens to window resize events instead of ResizeObserver
15
+ * - Adjusts DOM styles (overflow: visible, height: auto)
16
+ *
17
+ * Bundle impact: ~0.3 KB gzipped when used
18
+ */
19
+ import type { VListItem } from "../../types";
20
+ import type { VListPlugin } from "../../builder/types";
21
+ /**
22
+ * Create a window scroll mode plugin.
23
+ *
24
+ * Use this when you want your list to scroll with the page instead of
25
+ * in a fixed-height container.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { vlist } from 'vlist/builder'
30
+ * import { withWindow } from 'vlist/window'
31
+ *
32
+ * const feed = vlist({
33
+ * container: '#infinite-feed',
34
+ * item: { height: 200, template: renderPost },
35
+ * items: posts
36
+ * })
37
+ * .use(withWindow())
38
+ * .build()
39
+ * ```
40
+ *
41
+ * @example Horizontal window scrolling
42
+ * ```ts
43
+ * const timeline = vlist({
44
+ * container: '#timeline',
45
+ * item: { height: 100, template: renderEvent },
46
+ * direction: 'horizontal'
47
+ * })
48
+ * .use(withWindow())
49
+ * .build()
50
+ * ```
51
+ */
52
+ export declare const withPage: <T extends VListItem = VListItem>() => VListPlugin<T>;
53
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/features/page/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,QAAQ,GACnB,CAAC,SAAS,SAAS,GAAG,SAAS,OAC5B,WAAW,CAAC,CAAC,CA6HjB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * vlist - Compression Sub-module
3
+ * Re-exports compression utilities for tree-shakeable imports
4
+ *
5
+ * Usage: import { getCompressionInfo } from 'vlist/compression'
6
+ * Usage: import { withScale } from 'vlist/compression'
7
+ */
8
+ export { MAX_VIRTUAL_HEIGHT, getCompressionState, needsCompression, getMaxItemsWithoutCompression, getCompressionInfo, calculateCompressedVisibleRange, calculateCompressedRenderRange, calculateCompressedItemPosition, calculateCompressedScrollToIndex, calculateIndexFromScrollPosition, type CompressionState, } from "../../rendering/scale";
9
+ export { withScale } from "./plugin";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/scale/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,6BAA6B,EAC7B,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EAChC,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * vlist/compression - Builder Plugin
3
+ * Enables support for lists with 1M+ items by compressing the scroll space
4
+ * when the total height exceeds the browser's ~16.7M pixel limit.
5
+ *
6
+ * Priority: 20 (runs before scrollbar, after grid/groups)
7
+ *
8
+ * What it wires:
9
+ * - Scroll mode switch — transitions from native to compressed scrolling when needed
10
+ * - Scroll position mapping — maps compressed scroll positions to item indices
11
+ * - Item positioning — positions items relative to viewport in compressed mode
12
+ * - Custom scrollbar fallback — forces custom scrollbar in compressed mode
13
+ * - Near-bottom interpolation — smooth blending near the end of the list
14
+ * - Cached compression state — recalculates only when total item count changes
15
+ *
16
+ * No configuration needed — compression activates automatically when the total
17
+ * height exceeds the browser limit, and deactivates when items are removed.
18
+ */
19
+ import type { VListItem } from "../../types";
20
+ import type { VListPlugin } from "../../builder/types";
21
+ /**
22
+ * Create a compression plugin for the builder.
23
+ *
24
+ * Enables support for lists with 1M+ items. No configuration needed —
25
+ * compression activates automatically when the total height exceeds
26
+ * the browser's ~16.7M pixel limit.
27
+ *
28
+ * ```ts
29
+ * import { vlist } from 'vlist/builder'
30
+ * import { withCompression } from 'vlist/compression'
31
+ *
32
+ * const list = vlist({
33
+ * container: '#app',
34
+ * item: { height: 48, template: renderItem },
35
+ * items: millionItems,
36
+ * })
37
+ * .use(withCompression())
38
+ * .build()
39
+ * ```
40
+ */
41
+ export declare const withScale: <T extends VListItem = VListItem>() => VListPlugin<T>;
42
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/features/scale/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAevE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,SAAS,GACpB,CAAC,SAAS,SAAS,GAAG,SAAS,OAC5B,WAAW,CAAC,CAAC,CA2QjB,CAAC"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * vlist - Scroll Controller
3
+ * Handles both native scrolling and manual wheel-based scrolling for compressed lists
4
+ *
5
+ * When compression is active (large lists exceeding browser height limits),
6
+ * we switch from native scrolling to manual wheel event handling.
7
+ * This allows smooth scrolling through millions of items.
8
+ */
9
+ import type { CompressionState } from "../../rendering/scale";
10
+ /** Scroll direction */
11
+ export type ScrollDirection = "up" | "down";
12
+ /** Scroll event data */
13
+ export interface ScrollEventData {
14
+ scrollTop: number;
15
+ direction: ScrollDirection;
16
+ velocity: number;
17
+ }
18
+ /** Scroll controller configuration */
19
+ export interface ScrollControllerConfig {
20
+ /** Enable compressed scroll mode (manual wheel handling) */
21
+ compressed?: boolean;
22
+ /** Compression state for calculating bounds */
23
+ compression?: CompressionState;
24
+ /**
25
+ * External scroll element for window/document scrolling.
26
+ * When set, the controller listens to this element's scroll events
27
+ * and computes list-relative positions from the viewport's bounding rect.
28
+ */
29
+ scrollElement?: Window;
30
+ /** Allow mouse wheel to scroll (default: true) */
31
+ wheel?: boolean;
32
+ /** Wheel sensitivity multiplier (default: 1) */
33
+ sensitivity?: number;
34
+ /** Enable smooth scrolling interpolation */
35
+ smoothing?: boolean;
36
+ /** Scroll idle detection timeout in ms (default: 150) */
37
+ idleTimeout?: number;
38
+ /**
39
+ * Enable horizontal scrolling mode.
40
+ * When true, the controller reads scrollLeft instead of scrollTop,
41
+ * uses clientWidth instead of clientHeight, and maps wheel deltaX.
42
+ */
43
+ horizontal?: boolean;
44
+ /** Callback when scroll position changes */
45
+ onScroll?: (data: ScrollEventData) => void;
46
+ /** Callback when scrolling becomes idle */
47
+ onIdle?: () => void;
48
+ }
49
+ /** Scroll controller instance */
50
+ export interface ScrollController {
51
+ /** Get current scroll position */
52
+ getScrollTop: () => number;
53
+ /** Set scroll position */
54
+ scrollTo: (position: number, smooth?: boolean) => void;
55
+ /** Scroll by delta */
56
+ scrollBy: (delta: number) => void;
57
+ /** Check if at top */
58
+ isAtTop: () => boolean;
59
+ /** Check if at bottom */
60
+ isAtBottom: (threshold?: number) => boolean;
61
+ /** Get scroll percentage (0-1) */
62
+ getScrollPercentage: () => number;
63
+ /** Get current scroll velocity (px/ms, absolute value) */
64
+ getVelocity: () => number;
65
+ /**
66
+ * Check if the velocity tracker is actively tracking with enough samples.
67
+ * Returns false during ramp-up (first few frames of a new scroll gesture)
68
+ * when the tracker doesn't have enough samples yet.
69
+ */
70
+ isTracking: () => boolean;
71
+ /** Check if currently scrolling */
72
+ isScrolling: () => boolean;
73
+ /** Update configuration (e.g., when compression state changes) */
74
+ updateConfig: (config: Partial<ScrollControllerConfig>) => void;
75
+ /** Enable compressed mode */
76
+ enableCompression: (compression: CompressionState) => void;
77
+ /** Disable compressed mode (revert to native scroll) */
78
+ disableCompression: () => void;
79
+ /** Check if compressed mode is active */
80
+ isCompressed: () => boolean;
81
+ /** Check if in window scroll mode */
82
+ isWindowMode: () => boolean;
83
+ /**
84
+ * Update the container height used for scroll calculations.
85
+ * In window mode, call this when the window resizes.
86
+ */
87
+ updateContainerHeight: (height: number) => void;
88
+ /** Destroy and cleanup */
89
+ destroy: () => void;
90
+ }
91
+ /**
92
+ * Create a scroll controller for a viewport element
93
+ *
94
+ * Supports two modes:
95
+ * 1. Native scrolling (default) - uses browser's built-in scroll
96
+ * 2. Compressed scrolling - manual wheel handling for large lists
97
+ */
98
+ export declare const createScrollController: (viewport: HTMLElement, config?: ScrollControllerConfig) => ScrollController;
99
+ /**
100
+ * Throttle scroll handler using requestAnimationFrame
101
+ */
102
+ export declare const rafThrottle: <T extends (...args: any[]) => void>(fn: T) => ((...args: Parameters<T>) => void) & {
103
+ cancel: () => void;
104
+ };
105
+ /**
106
+ * Check if scroll position is at bottom
107
+ */
108
+ export declare const isAtBottom: (scrollTop: number, scrollHeight: number, clientHeight: number, threshold?: number) => boolean;
109
+ /**
110
+ * Check if scroll position is at top
111
+ */
112
+ export declare const isAtTop: (scrollTop: number, threshold?: number) => boolean;
113
+ /**
114
+ * Get scroll percentage (0-1)
115
+ */
116
+ export declare const getScrollPercentage: (scrollTop: number, scrollHeight: number, clientHeight: number) => number;
117
+ /**
118
+ * Check if a range is visible in the scroll viewport
119
+ */
120
+ export declare const isRangeVisible: (rangeStart: number, rangeEnd: number, visibleStart: number, visibleEnd: number) => boolean;
121
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/features/scrollbar/controller.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * vlist - Scroll Domain
3
+ * Scroll controller and custom scrollbar
4
+ */
5
+ export { withScrollbar, type ScrollbarPluginConfig } from "./plugin";
6
+ export { createScrollController, rafThrottle, isAtBottom, isAtTop, getScrollPercentage, isRangeVisible, type ScrollController, type ScrollControllerConfig, type ScrollEventData, type ScrollDirection, } from "./controller";
7
+ export { createScrollbar, type Scrollbar, type ScrollbarConfig, type ScrollCallback, } from "./scrollbar";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/scrollbar/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGrE,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,eAAe,EACf,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * vlist/scroll - Builder Plugin
3
+ * Wraps the custom scrollbar into a VListPlugin for the composable builder.
4
+ *
5
+ * Priority: 30 (runs after renderer/data setup but before selection)
6
+ *
7
+ * What it wires:
8
+ * - DOM elements — track, thumb, and optional hover zone appended to viewport
9
+ * - CSS class — .vlist-viewport--custom-scrollbar hides native scrollbar
10
+ * - Drag handlers — mousedown on thumb, mousemove/mouseup on document
11
+ * - Track click — click on track to jump to position
12
+ * - Hover handlers — mouseenter/leave on track, hover zone, and viewport
13
+ * - Scroll sync — updates thumb position on every scroll frame
14
+ * - Resize sync — updates thumb size when container or content height changes
15
+ *
16
+ * No public methods are added — the scrollbar is entirely automatic.
17
+ */
18
+ import type { VListItem } from "../../types";
19
+ import type { VListPlugin } from "../../builder/types";
20
+ /** Scrollbar plugin configuration */
21
+ export interface ScrollbarPluginConfig {
22
+ /** Auto-hide scrollbar after idle (default: true) */
23
+ autoHide?: boolean;
24
+ /** Auto-hide delay in milliseconds (default: 1000) */
25
+ autoHideDelay?: number;
26
+ /** Minimum thumb size in pixels (default: 30) */
27
+ minThumbSize?: number;
28
+ /**
29
+ * Show scrollbar when hovering near the scrollbar edge (default: true).
30
+ * When true, an invisible hover zone is placed along the scrollbar edge.
31
+ */
32
+ showOnHover?: boolean;
33
+ /**
34
+ * Width of the invisible hover zone in pixels (default: 16).
35
+ * Only used when `showOnHover` is true.
36
+ */
37
+ hoverZoneWidth?: number;
38
+ /**
39
+ * Show scrollbar when the mouse enters the list viewport (default: true).
40
+ * When false, the scrollbar only appears on scroll or hover near edge.
41
+ */
42
+ showOnViewportEnter?: boolean;
43
+ }
44
+ /**
45
+ * Create a scrollbar plugin for the builder.
46
+ *
47
+ * Replaces the native browser scrollbar with a custom, cross-browser
48
+ * consistent scrollbar.
49
+ *
50
+ * ```ts
51
+ * import { vlist } from 'vlist/builder'
52
+ * import { withScrollbar } from 'vlist/scroll'
53
+ *
54
+ * const list = vlist({ ... })
55
+ * .use(withScrollbar({ autoHide: true, autoHideDelay: 1000 }))
56
+ * .build()
57
+ * ```
58
+ */
59
+ export declare const withScrollbar: <T extends VListItem = VListItem>(config?: ScrollbarPluginConfig) => VListPlugin<T>;
60
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/features/scrollbar/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAQvE,qCAAqC;AACrC,MAAM,WAAW,qBAAqB;IACpC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAMD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,SAAS,GAAG,SAAS,EAC3D,SAAS,qBAAqB,KAC7B,WAAW,CAAC,CAAC,CAgFf,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * vlist - Custom Scrollbar
3
+ * Provides visual scroll indication for compressed mode where native scrollbar is hidden
4
+ *
5
+ * Features:
6
+ * - Visual track and thumb
7
+ * - Thumb size proportional to visible content
8
+ * - Click on track to jump to position
9
+ * - Drag thumb to scroll
10
+ * - Auto-hide after idle (optional)
11
+ * - Show on hover with configurable hover zone (optional)
12
+ * - CSS variables for customization
13
+ * - Horizontal mode support (direction-aware axis)
14
+ */
15
+ /** Scrollbar configuration */
16
+ export interface ScrollbarConfig {
17
+ /** Enable scrollbar (default: true when compressed) */
18
+ enabled?: boolean;
19
+ /** Auto-hide scrollbar after idle (default: true) */
20
+ autoHide?: boolean;
21
+ /** Auto-hide delay in milliseconds (default: 1000) */
22
+ autoHideDelay?: number;
23
+ /** Minimum thumb size in pixels (default: 30) */
24
+ minThumbSize?: number;
25
+ /**
26
+ * Show scrollbar when hovering near the scrollbar edge (default: true).
27
+ * When true, an invisible hover zone is placed along the scrollbar edge.
28
+ * Moving the mouse into this zone reveals the scrollbar; it stays visible
29
+ * as long as the cursor remains over the zone or the track.
30
+ */
31
+ showOnHover?: boolean;
32
+ /**
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.
37
+ */
38
+ hoverZoneWidth?: number;
39
+ /**
40
+ * Show scrollbar when the mouse enters the list viewport (default: true).
41
+ * When false, the scrollbar only appears on scroll or when hovering
42
+ * near the scrollbar edge (if `showOnHover` is true).
43
+ */
44
+ showOnViewportEnter?: boolean;
45
+ }
46
+ /** Scrollbar instance */
47
+ export interface Scrollbar {
48
+ /** Show the scrollbar */
49
+ show: () => void;
50
+ /** Hide the scrollbar */
51
+ hide: () => void;
52
+ /** Update scrollbar dimensions based on content/container size */
53
+ updateBounds: (totalHeight: number, containerHeight: number) => void;
54
+ /** Update thumb position based on scroll position */
55
+ updatePosition: (scrollTop: number) => void;
56
+ /** Check if scrollbar is visible */
57
+ isVisible: () => boolean;
58
+ /** Destroy and cleanup */
59
+ destroy: () => void;
60
+ }
61
+ /** Callback for scroll position changes */
62
+ export type ScrollCallback = (position: number) => void;
63
+ /**
64
+ * Create a scrollbar instance
65
+ *
66
+ * @param viewport - The viewport element to attach scrollbar to
67
+ * @param onScroll - Callback when scrollbar interaction causes scroll
68
+ * @param config - Scrollbar configuration
69
+ * @param classPrefix - CSS class prefix (default: 'vlist')
70
+ * @param horizontal - Whether the scrollbar is horizontal (default: false)
71
+ */
72
+ export declare const createScrollbar: (viewport: HTMLElement, onScroll: ScrollCallback, config?: ScrollbarConfig, classPrefix?: string, horizontal?: boolean) => Scrollbar;
73
+ //# sourceMappingURL=scrollbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scrollbar.d.ts","sourceRoot":"","sources":["../../../src/features/scrollbar/scrollbar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,8BAA8B;AAC9B,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,yBAAyB;AACzB,MAAM,WAAW,SAAS;IACxB,yBAAyB;IACzB,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB,yBAAyB;IACzB,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB,kEAAkE;IAClE,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;IAErE,qDAAqD;IACrD,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5C,oCAAoC;IACpC,SAAS,EAAE,MAAM,OAAO,CAAC;IAEzB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;AAiBxD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,WAAW,EACrB,UAAU,cAAc,EACxB,SAAQ,eAAoB,EAC5B,oBAAqB,EACrB,oBAAkB,KACjB,SA4XF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * vlist - Groups Domain
3
+ * Sticky headers and grouped lists
4
+ */
5
+ export { withSections, type GroupsPluginConfig } from "./plugin";
6
+ export type { GroupsConfig, GroupBoundary, LayoutEntry, GroupHeaderItem, GroupLayout, StickyHeader, } from "./types";
7
+ export { isGroupHeader, isGroupHeader as isSectionHeader } from "./types";
8
+ export { createGroupLayout, buildLayoutItems, createGroupedHeightFn, } from "./layout";
9
+ export { createStickyHeader } from "./sticky";
10
+ //# sourceMappingURL=index.d.ts.map