vlist 1.9.1 → 2.0.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 (182) hide show
  1. package/README.github.md +104 -97
  2. package/README.md +46 -33
  3. package/dist/constants.d.ts +11 -6
  4. package/dist/constants.js +83 -0
  5. package/dist/core/create.d.ts +10 -0
  6. package/dist/core/create.js +740 -0
  7. package/dist/core/dom.d.ts +8 -0
  8. package/dist/core/dom.js +47 -0
  9. package/dist/core/hooks.d.ts +16 -0
  10. package/dist/core/hooks.js +67 -0
  11. package/dist/core/index.d.ts +17 -0
  12. package/dist/core/index.js +13 -0
  13. package/dist/core/pipeline.d.ts +51 -0
  14. package/dist/core/pipeline.js +307 -0
  15. package/dist/core/pool.d.ts +9 -0
  16. package/dist/core/pool.js +42 -0
  17. package/dist/core/scroll.d.ts +32 -0
  18. package/dist/core/scroll.js +137 -0
  19. package/dist/core/sizes.d.ts +8 -0
  20. package/dist/core/sizes.js +6 -0
  21. package/dist/core/state.d.ts +47 -0
  22. package/dist/core/state.js +56 -0
  23. package/dist/core/types.d.ts +187 -0
  24. package/dist/core/types.js +7 -0
  25. package/dist/{builder → core}/velocity.d.ts +1 -1
  26. package/dist/core/velocity.js +33 -0
  27. package/dist/events/emitter.js +60 -0
  28. package/dist/events/index.js +6 -0
  29. package/dist/index.d.ts +28 -19
  30. package/dist/index.js +28 -1
  31. package/dist/internals.d.ts +11 -7
  32. package/dist/internals.js +60 -1
  33. package/dist/plugins/a11y/index.d.ts +2 -0
  34. package/dist/plugins/a11y/index.js +1 -0
  35. package/dist/plugins/a11y/plugin.d.ts +13 -0
  36. package/dist/plugins/a11y/plugin.js +259 -0
  37. package/dist/{features → plugins}/async/index.d.ts +1 -1
  38. package/dist/plugins/async/index.js +12 -0
  39. package/dist/{features → plugins}/async/manager.d.ts +5 -1
  40. package/dist/plugins/async/manager.js +568 -0
  41. package/dist/plugins/async/placeholder.js +154 -0
  42. package/dist/plugins/async/plugin.d.ts +48 -0
  43. package/dist/plugins/async/plugin.js +311 -0
  44. package/dist/plugins/async/sparse.js +540 -0
  45. package/dist/plugins/autosize/index.d.ts +5 -0
  46. package/dist/plugins/autosize/index.js +4 -0
  47. package/dist/plugins/autosize/plugin.d.ts +19 -0
  48. package/dist/plugins/autosize/plugin.js +185 -0
  49. package/dist/plugins/grid/index.d.ts +7 -0
  50. package/dist/plugins/grid/index.js +5 -0
  51. package/dist/plugins/grid/layout.js +275 -0
  52. package/dist/plugins/grid/plugin.d.ts +23 -0
  53. package/dist/plugins/grid/plugin.js +347 -0
  54. package/dist/plugins/grid/renderer.js +525 -0
  55. package/dist/plugins/grid/types.js +11 -0
  56. package/dist/plugins/groups/async-bridge.js +246 -0
  57. package/dist/{features → plugins}/groups/index.d.ts +1 -1
  58. package/dist/plugins/groups/index.js +13 -0
  59. package/dist/plugins/groups/layout.js +294 -0
  60. package/dist/plugins/groups/plugin.d.ts +22 -0
  61. package/dist/plugins/groups/plugin.js +571 -0
  62. package/dist/plugins/groups/sticky.js +255 -0
  63. package/dist/plugins/groups/types.js +12 -0
  64. package/dist/plugins/masonry/index.d.ts +8 -0
  65. package/dist/plugins/masonry/index.js +6 -0
  66. package/dist/plugins/masonry/layout.js +261 -0
  67. package/dist/plugins/masonry/plugin.d.ts +32 -0
  68. package/dist/plugins/masonry/plugin.js +381 -0
  69. package/dist/plugins/masonry/renderer.js +354 -0
  70. package/dist/plugins/masonry/types.js +9 -0
  71. package/dist/plugins/page/index.d.ts +5 -0
  72. package/dist/plugins/page/index.js +5 -0
  73. package/dist/plugins/page/plugin.d.ts +21 -0
  74. package/dist/plugins/page/plugin.js +166 -0
  75. package/dist/plugins/scale/index.d.ts +5 -0
  76. package/dist/plugins/scale/index.js +4 -0
  77. package/dist/plugins/scale/plugin.d.ts +24 -0
  78. package/dist/plugins/scale/plugin.js +507 -0
  79. package/dist/plugins/scrollbar/controller.js +574 -0
  80. package/dist/plugins/scrollbar/index.d.ts +7 -0
  81. package/dist/plugins/scrollbar/index.js +6 -0
  82. package/dist/plugins/scrollbar/plugin.d.ts +20 -0
  83. package/dist/plugins/scrollbar/plugin.js +93 -0
  84. package/dist/plugins/scrollbar/scrollbar.js +556 -0
  85. package/dist/plugins/selection/index.d.ts +6 -0
  86. package/dist/plugins/selection/index.js +7 -0
  87. package/dist/plugins/selection/plugin.d.ts +16 -0
  88. package/dist/plugins/selection/plugin.js +601 -0
  89. package/dist/{features → plugins}/selection/state.d.ts +8 -0
  90. package/dist/plugins/selection/state.js +332 -0
  91. package/dist/plugins/snapshots/index.d.ts +5 -0
  92. package/dist/plugins/snapshots/index.js +5 -0
  93. package/dist/plugins/snapshots/plugin.d.ts +17 -0
  94. package/dist/plugins/snapshots/plugin.js +301 -0
  95. package/dist/plugins/sortable/index.d.ts +6 -0
  96. package/dist/plugins/sortable/index.js +6 -0
  97. package/dist/plugins/sortable/plugin.d.ts +34 -0
  98. package/dist/plugins/sortable/plugin.js +753 -0
  99. package/dist/plugins/table/header.js +501 -0
  100. package/dist/{features → plugins}/table/index.d.ts +1 -1
  101. package/dist/plugins/table/index.js +12 -0
  102. package/dist/plugins/table/layout.js +211 -0
  103. package/dist/plugins/table/plugin.d.ts +20 -0
  104. package/dist/plugins/table/plugin.js +391 -0
  105. package/dist/plugins/table/renderer.js +625 -0
  106. package/dist/plugins/table/types.js +12 -0
  107. package/dist/plugins/transition/index.d.ts +5 -0
  108. package/dist/plugins/transition/index.js +5 -0
  109. package/dist/plugins/transition/plugin.d.ts +22 -0
  110. package/dist/plugins/transition/plugin.js +405 -0
  111. package/dist/rendering/aria.js +23 -0
  112. package/dist/rendering/index.js +18 -0
  113. package/dist/rendering/measured.js +98 -0
  114. package/dist/rendering/renderer.js +586 -0
  115. package/dist/rendering/scale.js +267 -0
  116. package/dist/rendering/scroll.js +71 -0
  117. package/dist/rendering/sizes.js +193 -0
  118. package/dist/rendering/sort.js +65 -0
  119. package/dist/rendering/viewport.js +268 -0
  120. package/dist/size.json +1 -1
  121. package/dist/types.js +5 -0
  122. package/dist/utils/padding.d.ts +2 -4
  123. package/dist/utils/padding.js +49 -0
  124. package/dist/utils/stats.js +124 -0
  125. package/dist/vlist-grid.css +1 -1
  126. package/dist/vlist-masonry.css +1 -1
  127. package/dist/vlist-table.css +1 -1
  128. package/dist/vlist.css +1 -1
  129. package/package.json +9 -4
  130. package/dist/builder/a11y.d.ts +0 -16
  131. package/dist/builder/api.d.ts +0 -21
  132. package/dist/builder/context.d.ts +0 -36
  133. package/dist/builder/core.d.ts +0 -16
  134. package/dist/builder/data.d.ts +0 -71
  135. package/dist/builder/dom.d.ts +0 -15
  136. package/dist/builder/index.d.ts +0 -25
  137. package/dist/builder/materialize.d.ts +0 -166
  138. package/dist/builder/pool.d.ts +0 -10
  139. package/dist/builder/range.d.ts +0 -10
  140. package/dist/builder/scroll.d.ts +0 -24
  141. package/dist/builder/types.d.ts +0 -512
  142. package/dist/features/async/feature.d.ts +0 -72
  143. package/dist/features/autosize/feature.d.ts +0 -34
  144. package/dist/features/autosize/index.d.ts +0 -2
  145. package/dist/features/grid/feature.d.ts +0 -48
  146. package/dist/features/grid/index.d.ts +0 -9
  147. package/dist/features/groups/feature.d.ts +0 -75
  148. package/dist/features/masonry/feature.d.ts +0 -45
  149. package/dist/features/masonry/index.d.ts +0 -9
  150. package/dist/features/page/feature.d.ts +0 -109
  151. package/dist/features/page/index.d.ts +0 -9
  152. package/dist/features/scale/feature.d.ts +0 -42
  153. package/dist/features/scale/index.d.ts +0 -10
  154. package/dist/features/scrollbar/feature.d.ts +0 -81
  155. package/dist/features/scrollbar/index.d.ts +0 -8
  156. package/dist/features/selection/feature.d.ts +0 -91
  157. package/dist/features/selection/index.d.ts +0 -7
  158. package/dist/features/snapshots/feature.d.ts +0 -79
  159. package/dist/features/snapshots/index.d.ts +0 -9
  160. package/dist/features/sortable/feature.d.ts +0 -101
  161. package/dist/features/sortable/index.d.ts +0 -6
  162. package/dist/features/table/feature.d.ts +0 -67
  163. package/dist/features/transition/feature.d.ts +0 -30
  164. package/dist/features/transition/index.d.ts +0 -9
  165. /package/dist/{features → plugins}/async/placeholder.d.ts +0 -0
  166. /package/dist/{features → plugins}/async/sparse.d.ts +0 -0
  167. /package/dist/{features → plugins}/grid/layout.d.ts +0 -0
  168. /package/dist/{features → plugins}/grid/renderer.d.ts +0 -0
  169. /package/dist/{features → plugins}/grid/types.d.ts +0 -0
  170. /package/dist/{features → plugins}/groups/async-bridge.d.ts +0 -0
  171. /package/dist/{features → plugins}/groups/layout.d.ts +0 -0
  172. /package/dist/{features → plugins}/groups/sticky.d.ts +0 -0
  173. /package/dist/{features → plugins}/groups/types.d.ts +0 -0
  174. /package/dist/{features → plugins}/masonry/layout.d.ts +0 -0
  175. /package/dist/{features → plugins}/masonry/renderer.d.ts +0 -0
  176. /package/dist/{features → plugins}/masonry/types.d.ts +0 -0
  177. /package/dist/{features → plugins}/scrollbar/controller.d.ts +0 -0
  178. /package/dist/{features → plugins}/scrollbar/scrollbar.d.ts +0 -0
  179. /package/dist/{features → plugins}/table/header.d.ts +0 -0
  180. /package/dist/{features → plugins}/table/layout.d.ts +0 -0
  181. /package/dist/{features → plugins}/table/renderer.d.ts +0 -0
  182. /package/dist/{features → plugins}/table/types.d.ts +0 -0
@@ -1,21 +0,0 @@
1
- /**
2
- * vlist/builder — Public API Assembly
3
- *
4
- * Constructs the public VList API object, base data method wrappers,
5
- * scroll methods (cancelScroll, animateScroll, scrollToIndex), event
6
- * subscription (on/off), and the destroy teardown.
7
- *
8
- * Extracted from core.ts materialize() — pure wiring with no hot-path
9
- * implications. All mutable state accessed via the `$` refs bag.
10
- *
11
- * Uses positional parameters (not a deps object) so the minifier can
12
- * rename every argument — no long property-name strings in the bundle.
13
- */
14
- import type { VListItem, VListEvents } from "../types";
15
- import type { Emitter } from "../events/emitter";
16
- import type { DOMStructure } from "./dom";
17
- import type { createElementPool } from "./pool";
18
- import type { BuilderContext, VListFeature, VList } from "./types";
19
- import type { MRefs } from "./materialize";
20
- export declare const createApi: <T extends VListItem = VListItem>($: MRefs<T>, dom: DOMStructure, emitter: Emitter<VListEvents<T>>, rendered: Map<number, HTMLElement>, pool: ReturnType<typeof createElementPool>, methods: Map<string, Function>, sortedFeatures: VListFeature<T>[], destroyHandlers: Array<() => void>, ctx: BuilderContext<T>, isReverse: boolean, wrapEnabled: boolean, handleClick: (event: MouseEvent) => void, handleDblClick: (event: MouseEvent) => void, handleContextMenu: (event: MouseEvent) => void, handleKeydown: (event: KeyboardEvent) => void, onScrollFrame: () => void, resizeObserver: ResizeObserver, disconnectItemObserver: () => void, clearIdleTimer: () => void) => VList<T>;
21
- //# sourceMappingURL=api.d.ts.map
@@ -1,36 +0,0 @@
1
- /**
2
- * vlist/builder - BuilderContext Factory
3
- * Central state container that features receive during setup.
4
- *
5
- * The BuilderContext provides access to all core components plus
6
- * registration points for handlers, methods, and cleanup callbacks.
7
- */
8
- import type { VListItem, VListEvents } from "../types";
9
- import type { SizeCache } from "../rendering/sizes";
10
- import type { Renderer, DOMStructure } from "../rendering/renderer";
11
- import type { SimpleDataManager } from "./data";
12
- import type { ScrollController } from "../features/scrollbar/controller";
13
- import type { Emitter } from "../events/emitter";
14
- import type { BuilderConfig, BuilderContext, BuilderState, ResolvedBuilderConfig } from "./types";
15
- /** Options for creating a BuilderContext */
16
- export interface CreateBuilderContextOptions<T extends VListItem = VListItem> {
17
- rawConfig: BuilderConfig<T>;
18
- resolvedConfig: ResolvedBuilderConfig;
19
- dom: DOMStructure;
20
- sizeCache: SizeCache;
21
- dataManager: SimpleDataManager<T>;
22
- scrollController: ScrollController;
23
- renderer: Renderer<T>;
24
- emitter: Emitter<VListEvents<T>>;
25
- initialState: BuilderState;
26
- initialSizeConfig: number | ((index: number) => number);
27
- }
28
- /**
29
- * Create a BuilderContext from individual components.
30
- *
31
- * The context acts as the central hub that features wire into.
32
- * Unlike VListContext (used by the monolithic factory), BuilderContext
33
- * exposes registration arrays and replacement methods for features.
34
- */
35
- export declare const createBuilderContext: <T extends VListItem = VListItem>(options: CreateBuilderContextOptions<T>) => BuilderContext<T>;
36
- //# sourceMappingURL=context.d.ts.map
@@ -1,16 +0,0 @@
1
- /**
2
- * vlist/builder — Composable virtual list builder
3
- *
4
- * Pure utilities (velocity, DOM, pool, range, scroll) live in sibling files.
5
- * Size cache and emitter are reused from rendering/ and events/ modules.
6
- * Bun.build inlines everything into a single bundle automatically.
7
- *
8
- * Features compose functionality *around* the hot path via extension points:
9
- * afterScroll, clickHandlers, keydownHandlers, resizeHandlers, destroyHandlers,
10
- * and the methods Map for public API extension.
11
- */
12
- import type { VListItem } from "../types";
13
- import type { BuilderConfig, VListBuilder } from "./types";
14
- export type { CompressionState } from "../rendering/viewport";
15
- export declare const vlist: <T extends VListItem = VListItem>(config: BuilderConfig<T>) => VListBuilder<T>;
16
- //# sourceMappingURL=core.d.ts.map
@@ -1,71 +0,0 @@
1
- /**
2
- * vlist/builder - Lightweight In-Memory Data Manager
3
- *
4
- * A minimal data manager that stores items in a plain array.
5
- * No sparse storage, no placeholders, no async adapter support.
6
- *
7
- * This keeps the builder core small (~12 KB). When the user installs
8
- * withData(), that feature replaces this manager with the full
9
- * adapter-backed data manager from src/data/manager.ts.
10
- */
11
- import type { VListItem, Range } from "../types";
12
- /** Minimal data state */
13
- export interface SimpleDataState<_T extends VListItem = VListItem> {
14
- total: number;
15
- cached: number;
16
- isLoading: boolean;
17
- pendingRanges: Range[];
18
- error: Error | undefined;
19
- hasMore: boolean;
20
- cursor: string | undefined;
21
- }
22
- /**
23
- * SimpleDataManager — the same interface as the full DataManager,
24
- * but backed by a plain array instead of sparse storage + placeholders.
25
- *
26
- * Only the methods used by the builder core and features are implemented.
27
- * Adapter-related methods (loadRange, ensureRange, loadInitial, loadMore,
28
- * reload, evictDistant) are no-ops or stubs.
29
- */
30
- export interface SimpleDataManager<T extends VListItem = VListItem> {
31
- getState: () => SimpleDataState<T>;
32
- getTotal: () => number;
33
- getCached: () => number;
34
- getIsLoading: () => boolean;
35
- getHasMore: () => boolean;
36
- getStorage: () => unknown;
37
- getPlaceholders: () => unknown;
38
- getItem: (index: number) => T | undefined;
39
- getIndexById: (id: string | number) => number;
40
- isItemLoaded: (index: number) => boolean;
41
- getItemsInRange: (start: number, end: number) => T[];
42
- setTotal: (total: number) => void;
43
- setItems: (items: T[], offset?: number, total?: number) => void;
44
- updateItem: (index: number, updates: Partial<T>) => boolean;
45
- insertItem: (item: T, index: number) => void;
46
- removeItem: (id: string | number) => boolean;
47
- loadRange: (start: number, end: number) => Promise<void>;
48
- ensureRange: (start: number, end: number) => Promise<void>;
49
- loadInitial: () => Promise<void>;
50
- loadMore: (direction?: "down" | "up") => Promise<boolean>;
51
- reload: () => Promise<void>;
52
- evictDistant: (visibleStart: number, visibleEnd: number) => void;
53
- clear: () => void;
54
- reset: () => void;
55
- }
56
- export interface SimpleDataManagerConfig<T extends VListItem = VListItem> {
57
- initialItems?: T[];
58
- initialTotal?: number;
59
- onStateChange?: (state: SimpleDataState<T>) => void;
60
- onItemsLoaded?: (items: T[], offset: number, total: number) => void;
61
- }
62
- /**
63
- * Create a lightweight in-memory data manager.
64
- *
65
- * Items are stored in a plain array. ID lookups use a Map.
66
- * No sparse storage, no placeholders, no chunking, no eviction.
67
- *
68
- * ~1 KB minified vs ~8 KB for the full data manager.
69
- */
70
- export declare const createSimpleDataManager: <T extends VListItem = VListItem>(config?: SimpleDataManagerConfig<T>) => SimpleDataManager<T>;
71
- //# sourceMappingURL=data.d.ts.map
@@ -1,15 +0,0 @@
1
- /**
2
- * vlist/builder — DOM Structure
3
- * Container resolution and DOM scaffold creation for the virtual list.
4
- */
5
- export interface DOMStructure {
6
- root: HTMLElement;
7
- viewport: HTMLElement;
8
- content: HTMLElement;
9
- items: HTMLElement;
10
- /** Visually-hidden live region for screen reader range announcements */
11
- liveRegion: HTMLElement;
12
- }
13
- export declare const resolveContainer: (container: HTMLElement | string) => HTMLElement;
14
- export declare const createDOMStructure: (container: HTMLElement, classPrefix: string, ariaLabel?: string, horizontal?: boolean, interactive?: boolean) => DOMStructure;
15
- //# sourceMappingURL=dom.d.ts.map
@@ -1,25 +0,0 @@
1
- /**
2
- * vlist/builder - Composable Virtual List Builder
3
- * Pick only the features you need, pay only for what you ship.
4
- *
5
- * @example
6
- * ```ts
7
- * import { vlist } from 'vlist/builder'
8
- * import { withSelection } from 'vlist/selection'
9
- * import { withScrollbar } from 'vlist/scroll'
10
- *
11
- * const list = vlist({
12
- * container: '#app',
13
- * item: { height: 48, template: renderItem },
14
- * items: data,
15
- * })
16
- * .use(withSelection({ mode: 'multiple' }))
17
- * .use(withScrollbar())
18
- * .build()
19
- * ```
20
- *
21
- * @packageDocumentation
22
- */
23
- export { vlist } from "./core";
24
- export type { VListBuilder, VList, BuilderConfig, VListConfig, VListFeature, FeatureFactory, BuilderContext, ReloadOptions, BuilderState, ResolvedBuilderConfig, } from "./types";
25
- //# sourceMappingURL=index.d.ts.map
@@ -1,166 +0,0 @@
1
- /**
2
- * vlist/builder — Materialize Context Factory
3
- *
4
- * Extracts the BuilderContext object, default data-manager proxy, and default
5
- * scroll-controller proxy out of materialize() in core.ts.
6
- *
7
- * All shared mutable state lives in a single `$` (MRefs) object that both
8
- * core.ts and this module read/write through. Property names are kept short
9
- * (2–3 chars) so they survive minification without bloating the bundle.
10
- * Each factory destructures to readable locals on entry.
11
- *
12
- * Immutable dependencies are passed via a `deps` (MDeps) object — these are
13
- * destructured once and never re-read, so their names don't matter at runtime.
14
- */
15
- import type { VListItem, VListEvents, ItemTemplate, ItemState, Range } from "../types";
16
- import type { SizeCache } from "../rendering/sizes";
17
- import type { Emitter } from "../events/emitter";
18
- import type { DOMStructure } from "./dom";
19
- import type { createElementPool } from "./pool";
20
- import type { BuilderConfig, BuilderContext, BuilderState, ResolvedBuilderConfig } from "./types";
21
- /**
22
- * Mutable refs object shared between core.ts materialize() and context factories.
23
- *
24
- * Key mapping (short → long):
25
- *
26
- * | Key | Meaning |
27
- * |------|------------------------|
28
- * | it | items |
29
- * | hc | sizeCache |
30
- * | ch | containerHeight |
31
- * | cw | containerWidth |
32
- * | id | isDestroyed |
33
- * | ii | isInitialized |
34
- * | ls | lastScrollTop |
35
- * | vt | velocityTracker |
36
- * | ss | selectionSet |
37
- * | fi | focusedIndex |
38
- * | la | lastAriaSetSize |
39
- * | dm | dataManagerProxy |
40
- * | sc | scrollControllerProxy |
41
- * | vtf | virtualTotalFn |
42
- * | sgt | scrollGetTop |
43
- * | sst | scrollSetTop |
44
- * | sab | scrollIsAtBottom |
45
- * | sic | scrollIsCompressed |
46
- * | rfn | renderIfNeededFn |
47
- * | ffn | forceRenderFn |
48
- * | gvr | getVisibleRange |
49
- * | gsp | getScrollToPos |
50
- * | pef | positionElementFn |
51
- * | at | activeTemplate |
52
- * | vre | viewportResizeEnabled |
53
- * | st | scrollTarget |
54
- * | gcw | getContainerWidth |
55
- * | gch | getContainerHeight |
56
- */
57
- export interface MRefs<T extends VListItem = VListItem> {
58
- /** items */
59
- it: T[];
60
- /** sizeCache */
61
- hc: SizeCache;
62
- /** containerHeight */
63
- ch: number;
64
- /** containerWidth */
65
- cw: number;
66
- /** isDestroyed */
67
- id: boolean;
68
- /** isInitialized */
69
- ii: boolean;
70
- /** lastScrollTop */
71
- ls: number;
72
- /** velocityTracker */
73
- vt: {
74
- velocity: number;
75
- sampleCount: number;
76
- };
77
- /** selectionSet */
78
- ss: Set<string | number>;
79
- /** focusedIndex */
80
- fi: number;
81
- /** lastAriaSetSize */
82
- la: string;
83
- /** dataManagerProxy */
84
- dm: any;
85
- /** scrollControllerProxy */
86
- sc: any;
87
- /** virtualTotalFn */
88
- vtf: () => number;
89
- /** scrollGetTop */
90
- sgt: () => number;
91
- /** scrollSetTop */
92
- sst: (pos: number) => void;
93
- /** scrollIsAtBottom */
94
- sab: (threshold?: number) => boolean;
95
- /** scrollIsCompressed */
96
- sic: boolean;
97
- /** renderIfNeededFn */
98
- rfn: () => void;
99
- /** forceRenderFn */
100
- ffn: () => void;
101
- /** getVisibleRange */
102
- gvr: (scrollTop: number, cHeight: number, hc: SizeCache, total: number, out: Range) => void;
103
- /** getScrollToPos */
104
- gsp: (index: number, hc: SizeCache, cHeight: number, total: number, align: "start" | "center" | "end") => number;
105
- /** positionElementFn */
106
- pef: (element: HTMLElement, index: number) => void;
107
- /** activeTemplate */
108
- at: ItemTemplate<T>;
109
- /** viewportResizeEnabled */
110
- vre: boolean;
111
- /** scrollTarget */
112
- st: HTMLElement | Window;
113
- /** wheelHandler - for features to disable wheel handling if needed */
114
- wh: ((e: WheelEvent) => void) | null;
115
- /** getContainerWidth */
116
- gcw: () => number;
117
- /** getContainerHeight */
118
- gch: () => number;
119
- /** gap — item spacing along main axis (0 = none) */
120
- gp: number;
121
- /** mainAxisPadding — sum of CSS padding along scroll axis (0 = none) */
122
- mp: number;
123
- /** stripeIndexFn — maps layout index to stripe index (-1 = skip) */
124
- sif: (index: number) => number;
125
- /** itemToScrollIndex — maps flat item index to size-cache index (identity for list, floor(index/cols) for grid) */
126
- i2s: (index: number) => number;
127
- /** updateItemClassesFn */
128
- uic: (index: number, isSelected: boolean, isFocused: boolean) => void;
129
- /** constrainSizeForIndex — null = always constrain (Mode A default) */
130
- csi: ((index: number) => boolean) | null;
131
- }
132
- /** Immutable dependencies the context factory needs from materialize(). */
133
- export interface MDeps<T extends VListItem = VListItem> {
134
- readonly dom: DOMStructure;
135
- readonly emitter: Emitter<VListEvents<T>>;
136
- readonly resolvedConfig: ResolvedBuilderConfig;
137
- readonly rawConfig: BuilderConfig<T>;
138
- readonly rendered: Map<number, HTMLElement>;
139
- readonly pool: ReturnType<typeof createElementPool>;
140
- readonly itemState: ItemState;
141
- readonly sharedState: BuilderState;
142
- readonly renderRange: Range;
143
- readonly isHorizontal: boolean;
144
- readonly classPrefix: string;
145
- readonly contentSizeHandlers: Array<() => void>;
146
- readonly idleHandlers: Array<() => void>;
147
- readonly afterScroll: Array<(scrollPosition: number, direction: string) => void>;
148
- readonly clickHandlers: Array<(event: MouseEvent) => void>;
149
- readonly contextMenuHandlers: Array<(event: MouseEvent) => void>;
150
- readonly keydownHandlers: Array<(event: KeyboardEvent) => void>;
151
- readonly resizeHandlers: Array<(width: number, height: number) => void>;
152
- readonly destroyHandlers: Array<() => void>;
153
- readonly methods: Map<string, Function>;
154
- readonly onScrollFrame: () => void;
155
- readonly resizeObserver: ResizeObserver;
156
- readonly afterRenderBatch: ReadonlyArray<(items: ReadonlyArray<{
157
- index: number;
158
- element: HTMLElement;
159
- }>) => void>;
160
- readonly applyTemplate: (element: HTMLElement, result: string | HTMLElement) => void;
161
- readonly updateContentSize: () => void;
162
- }
163
- export declare const createMaterializeCtx: <T extends VListItem = VListItem>($: MRefs<T>, deps: MDeps<T>) => BuilderContext<T>;
164
- export declare const createDefaultDataProxy: <T extends VListItem = VListItem>($: MRefs<T>, deps: Pick<MDeps<T>, "rendered" | "itemState" | "contentSizeHandlers" | "applyTemplate" | "updateContentSize">, ctx: BuilderContext<T>) => any;
165
- export declare const createDefaultScrollProxy: <T extends VListItem = VListItem>($: MRefs<T>, deps: Pick<MDeps<T>, "dom" | "classPrefix" | "onScrollFrame">) => any;
166
- //# sourceMappingURL=materialize.d.ts.map
@@ -1,10 +0,0 @@
1
- /**
2
- * vlist/builder — Element Pool
3
- * Recycling pool for DOM elements to reduce allocation during scrolling.
4
- */
5
- export declare const createElementPool: (maxSize?: number) => {
6
- acquire: () => HTMLElement;
7
- release: (el: HTMLElement) => void;
8
- clear: () => void;
9
- };
10
- //# sourceMappingURL=pool.d.ts.map
@@ -1,10 +0,0 @@
1
- /**
2
- * vlist/builder — Range Calculations
3
- * Visible range detection, overscan application, and scroll-to-index positioning.
4
- */
5
- import type { Range } from "../types";
6
- import type { SizeCache } from "../rendering/sizes";
7
- export declare const calcVisibleRange: (scrollPosition: number, containerHeight: number, hc: SizeCache, totalItems: number, out: Range) => void;
8
- export declare const applyOverscan: (visible: Range, overscan: number, totalItems: number, out: Range) => void;
9
- export declare const calcScrollToPosition: (index: number, hc: SizeCache, containerHeight: number, totalItems: number, align: "start" | "center" | "end", mainAxisPadding?: number) => number;
10
- //# sourceMappingURL=range.d.ts.map
@@ -1,24 +0,0 @@
1
- /**
2
- * vlist/builder — Scroll Utilities
3
- * Easing, scroll-argument resolution, and smooth scroll animation.
4
- */
5
- import type { ScrollToOptions } from "../types";
6
- export declare const easeInOutQuad: (t: number) => number;
7
- export declare const resolveScrollArgs: (o?: "start" | "center" | "end" | ScrollToOptions) => {
8
- align: "start" | "center" | "end";
9
- behavior: "auto" | "smooth";
10
- duration: number;
11
- };
12
- /** Scroll controller interface — minimal surface needed by the animation. */
13
- export interface ScrollController {
14
- scrollTo: (position: number) => void;
15
- getScrollTop: () => number;
16
- }
17
- /**
18
- * Create a smooth scroll animator with its own animation state.
19
- */
20
- export declare const createSmoothScroll: (scrollController: ScrollController, renderFn: () => void) => {
21
- animateScroll: (from: number, to: number, duration: number) => void;
22
- cancelScroll: () => void;
23
- };
24
- //# sourceMappingURL=scroll.d.ts.map