@floor/vlist 0.9.1 → 0.9.2
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/dist/builder/context.d.ts +3 -3
- package/dist/builder/core.d.ts +1 -1
- package/dist/builder/data.d.ts +2 -2
- package/dist/builder/index.d.ts +1 -1
- package/dist/builder/{materializectx.d.ts → materialize.d.ts} +1 -1
- package/dist/builder/types.d.ts +29 -29
- package/dist/features/async/{plugin.d.ts → feature.d.ts} +8 -8
- package/dist/features/async/index.d.ts +1 -1
- package/dist/features/grid/{plugin.d.ts → feature.d.ts} +7 -7
- package/dist/features/grid/index.d.ts +1 -1
- package/dist/features/page/{plugin.d.ts → feature.d.ts} +6 -6
- package/dist/features/page/index.d.ts +4 -4
- package/dist/features/scale/{plugin.d.ts → feature.d.ts} +5 -5
- package/dist/features/scale/index.d.ts +1 -1
- package/dist/features/scrollbar/{plugin.d.ts → feature.d.ts} +8 -8
- package/dist/features/scrollbar/index.d.ts +1 -1
- package/dist/features/sections/{plugin.d.ts → feature.d.ts} +7 -7
- package/dist/features/sections/index.d.ts +1 -1
- package/dist/features/selection/{plugin.d.ts → feature.d.ts} +8 -8
- package/dist/features/selection/index.d.ts +1 -1
- package/dist/features/snapshots/{plugin.d.ts → feature.d.ts} +6 -6
- package/dist/features/snapshots/index.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/rendering/renderer.d.ts +2 -2
- package/dist/rendering/viewport.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vlist/builder - BuilderContext Factory
|
|
3
|
-
* Central state container that
|
|
3
|
+
* Central state container that features receive during setup.
|
|
4
4
|
*
|
|
5
5
|
* The BuilderContext provides access to all core components plus
|
|
6
6
|
* registration points for handlers, methods, and cleanup callbacks.
|
|
@@ -28,9 +28,9 @@ export interface CreateBuilderContextOptions<T extends VListItem = VListItem> {
|
|
|
28
28
|
/**
|
|
29
29
|
* Create a BuilderContext from individual components.
|
|
30
30
|
*
|
|
31
|
-
* The context acts as the central hub that
|
|
31
|
+
* The context acts as the central hub that features wire into.
|
|
32
32
|
* Unlike VListContext (used by the monolithic factory), BuilderContext
|
|
33
|
-
* exposes registration arrays and replacement methods for
|
|
33
|
+
* exposes registration arrays and replacement methods for features.
|
|
34
34
|
*/
|
|
35
35
|
export declare const createBuilderContext: <T extends VListItem = VListItem>(options: CreateBuilderContextOptions<T>) => BuilderContext<T>;
|
|
36
36
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/builder/core.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Size cache and emitter are reused from rendering/ and events/ modules.
|
|
6
6
|
* Bun.build inlines everything into a single bundle automatically.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Features compose functionality *around* the hot path via extension points:
|
|
9
9
|
* afterScroll, clickHandlers, keydownHandlers, resizeHandlers, destroyHandlers,
|
|
10
10
|
* and the methods Map for public API extension.
|
|
11
11
|
*/
|
package/dist/builder/data.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* No sparse storage, no placeholders, no async adapter support.
|
|
6
6
|
*
|
|
7
7
|
* This keeps the builder core small (~12 KB). When the user installs
|
|
8
|
-
* withData(), that
|
|
8
|
+
* withData(), that feature replaces this manager with the full
|
|
9
9
|
* adapter-backed data manager from src/data/manager.ts.
|
|
10
10
|
*/
|
|
11
11
|
import type { VListItem, Range } from "../types";
|
|
@@ -23,7 +23,7 @@ export interface SimpleDataState<_T extends VListItem = VListItem> {
|
|
|
23
23
|
* SimpleDataManager — the same interface as the full DataManager,
|
|
24
24
|
* but backed by a plain array instead of sparse storage + placeholders.
|
|
25
25
|
*
|
|
26
|
-
* Only the methods used by the builder core and
|
|
26
|
+
* Only the methods used by the builder core and features are implemented.
|
|
27
27
|
* Adapter-related methods (loadRange, ensureRange, loadInitial, loadMore,
|
|
28
28
|
* reload, evictDistant) are no-ops or stubs.
|
|
29
29
|
*/
|
package/dist/builder/index.d.ts
CHANGED
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
* @packageDocumentation
|
|
22
22
|
*/
|
|
23
23
|
export { vlist } from "./core";
|
|
24
|
-
export type { VListBuilder, BuiltVList, BuilderConfig,
|
|
24
|
+
export type { VListBuilder, BuiltVList, BuilderConfig, VListFeature, FeatureFactory, BuilderContext, BuilderState, ResolvedBuilderConfig, } from "./types";
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -143,4 +143,4 @@ export interface MDeps<T extends VListItem = VListItem> {
|
|
|
143
143
|
export declare const createMaterializeCtx: <T extends VListItem = VListItem>($: MRefs<T>, deps: MDeps<T>) => BuilderContext<T>;
|
|
144
144
|
export declare const createDefaultDataProxy: <T extends VListItem = VListItem>($: MRefs<T>, deps: Pick<MDeps<T>, "rendered" | "itemState" | "contentSizeHandlers" | "applyTemplate" | "updateContentSize">, ctx: BuilderContext<T>) => any;
|
|
145
145
|
export declare const createDefaultScrollProxy: <T extends VListItem = VListItem>($: MRefs<T>, deps: Pick<MDeps<T>, "dom" | "classPrefix">) => any;
|
|
146
|
-
//# sourceMappingURL=
|
|
146
|
+
//# sourceMappingURL=materialize.d.ts.map
|
package/dist/builder/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vlist/builder - Types
|
|
3
|
-
*
|
|
3
|
+
* Feature interface, builder config, builder context, and return types
|
|
4
4
|
*/
|
|
5
5
|
import type { VListItem, VListEvents, ItemConfig, ItemTemplate, Range, ViewportState, EventHandler, Unsubscribe, ScrollToOptions, ScrollSnapshot } from "../types";
|
|
6
6
|
import type { DOMStructure, Renderer, SizeCache, CompressionContext } from "../rendering";
|
|
@@ -14,7 +14,7 @@ export interface BuilderConfig<T extends VListItem = VListItem> {
|
|
|
14
14
|
container: HTMLElement | string;
|
|
15
15
|
/** Item configuration (height/width and template) */
|
|
16
16
|
item: ItemConfig<T>;
|
|
17
|
-
/** Static items array (optional if using adapter via
|
|
17
|
+
/** Static items array (optional if using adapter via feature) */
|
|
18
18
|
items?: T[];
|
|
19
19
|
/** Number of extra items to render outside viewport (default: 3) */
|
|
20
20
|
overscan?: number;
|
|
@@ -65,7 +65,7 @@ export interface BuilderState {
|
|
|
65
65
|
cachedCompression: CachedCompression | null;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* BuilderContext — the internal interface that
|
|
68
|
+
* BuilderContext — the internal interface that features receive during setup.
|
|
69
69
|
*
|
|
70
70
|
* Provides access to all core components plus registration points for
|
|
71
71
|
* handlers, methods, and cleanup callbacks.
|
|
@@ -75,20 +75,20 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
75
75
|
readonly sizeCache: SizeCache;
|
|
76
76
|
readonly emitter: Emitter<VListEvents<T>>;
|
|
77
77
|
readonly config: ResolvedBuilderConfig;
|
|
78
|
-
/** The raw user-provided builder config (for
|
|
78
|
+
/** The raw user-provided builder config (for features that need original values) */
|
|
79
79
|
readonly rawConfig: BuilderConfig<T>;
|
|
80
80
|
renderer: Renderer<T>;
|
|
81
81
|
dataManager: SimpleDataManager<T>;
|
|
82
82
|
scrollController: ScrollController;
|
|
83
83
|
state: BuilderState;
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* Features register lightweight callbacks that run after each
|
|
86
86
|
* scroll-triggered render. These are NOT on the hot path —
|
|
87
87
|
* they run after DOM updates are complete.
|
|
88
88
|
*/
|
|
89
89
|
afterScroll: Array<(scrollPosition: number, direction: string) => void>;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* Features register handlers for user interaction events.
|
|
92
92
|
* These are attached as DOM event listeners during .build().
|
|
93
93
|
*/
|
|
94
94
|
clickHandlers: Array<(event: MouseEvent) => void>;
|
|
@@ -96,7 +96,7 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
96
96
|
resizeHandlers: Array<(width: number, height: number) => void>;
|
|
97
97
|
contentSizeHandlers: Array<() => void>;
|
|
98
98
|
destroyHandlers: Array<() => void>;
|
|
99
|
-
/**
|
|
99
|
+
/** Features register public methods by name. Exposed on the returned API. */
|
|
100
100
|
methods: Map<string, Function>;
|
|
101
101
|
replaceTemplate(template: ItemTemplate<T>): void;
|
|
102
102
|
replaceRenderer(renderer: Renderer<T>): void;
|
|
@@ -116,7 +116,7 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
116
116
|
*/
|
|
117
117
|
invalidateRendered(): void;
|
|
118
118
|
/**
|
|
119
|
-
* Get current render functions (for wrapping by selection/other
|
|
119
|
+
* Get current render functions (for wrapping by selection/other features).
|
|
120
120
|
* Call this BEFORE setRenderFns to capture the current functions.
|
|
121
121
|
*/
|
|
122
122
|
getRenderFns(): {
|
|
@@ -124,24 +124,24 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
124
124
|
forceRender: () => void;
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
|
-
* Get current container width (for grid
|
|
127
|
+
* Get current container width (for grid feature).
|
|
128
128
|
* This returns the width detected by ResizeObserver, which is more reliable
|
|
129
129
|
* than viewport.clientWidth in test environments.
|
|
130
130
|
*/
|
|
131
131
|
getContainerWidth(): number;
|
|
132
132
|
/**
|
|
133
133
|
* Replace the virtual-total function.
|
|
134
|
-
* Used by grid/groups
|
|
134
|
+
* Used by grid/groups features that change what "total" means
|
|
135
135
|
* (e.g. row count instead of item count).
|
|
136
136
|
*/
|
|
137
137
|
setVirtualTotalFn(fn: () => number): void;
|
|
138
138
|
/**
|
|
139
|
-
* Used by groups
|
|
139
|
+
* Used by groups feature to inject grouped size function and by grid to add gap.
|
|
140
140
|
*/
|
|
141
141
|
rebuildSizeCache(total?: number): void;
|
|
142
142
|
/**
|
|
143
143
|
* Set a new effective size config function/value.
|
|
144
|
-
*
|
|
144
|
+
* Features that change sizes (groups, grid) call this before rebuildSizeCache.
|
|
145
145
|
*/
|
|
146
146
|
setSizeConfig(config: number | ((index: number) => number)): void;
|
|
147
147
|
/**
|
|
@@ -150,7 +150,7 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
150
150
|
updateContentSize(totalSize: number): void;
|
|
151
151
|
/**
|
|
152
152
|
* Update compression mode when total items changes.
|
|
153
|
-
* Called by the core after data changes and by
|
|
153
|
+
* Called by the core after data changes and by features that alter totals.
|
|
154
154
|
*/
|
|
155
155
|
updateCompressionMode(): void;
|
|
156
156
|
/**
|
|
@@ -170,7 +170,7 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
170
170
|
setPositionElementFn(fn: (element: HTMLElement, index: number) => void): void;
|
|
171
171
|
/**
|
|
172
172
|
* Replace the render functions.
|
|
173
|
-
* Used by grid/groups
|
|
173
|
+
* Used by grid/groups features that need to completely replace the render logic
|
|
174
174
|
* (e.g., to convert row ranges to item ranges for grid rendering).
|
|
175
175
|
*/
|
|
176
176
|
setRenderFns(renderIfNeeded: () => void, forceRender: () => void): void;
|
|
@@ -182,7 +182,7 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
182
182
|
setScrollFns(getTop: () => number, setTop: (pos: number) => void): void;
|
|
183
183
|
/**
|
|
184
184
|
* Set the scroll target element (default: viewport).
|
|
185
|
-
* Used by window mode
|
|
185
|
+
* Used by window mode feature to use window instead of viewport for scroll events.
|
|
186
186
|
*/
|
|
187
187
|
setScrollTarget(target: HTMLElement | Window): void;
|
|
188
188
|
/**
|
|
@@ -192,7 +192,7 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
192
192
|
getScrollTarget(): HTMLElement | Window;
|
|
193
193
|
/**
|
|
194
194
|
* Override container dimension getters.
|
|
195
|
-
* Used by window mode
|
|
195
|
+
* Used by window mode feature to use window.innerWidth/innerHeight instead
|
|
196
196
|
* of viewport.clientWidth/clientHeight.
|
|
197
197
|
*/
|
|
198
198
|
setContainerDimensions(getter: {
|
|
@@ -201,23 +201,23 @@ export interface BuilderContext<T extends VListItem = VListItem> {
|
|
|
201
201
|
}): void;
|
|
202
202
|
/**
|
|
203
203
|
* Disable the ResizeObserver on the viewport element.
|
|
204
|
-
* Used by window mode
|
|
204
|
+
* Used by window mode feature where the viewport doesn't need observation
|
|
205
205
|
* (window resize is used instead).
|
|
206
206
|
*/
|
|
207
207
|
disableViewportResize(): void;
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
|
-
*
|
|
210
|
+
* VListFeature — the interface for builder features.
|
|
211
211
|
*
|
|
212
|
-
* Each
|
|
212
|
+
* Each feature:
|
|
213
213
|
* - Has a unique name (used for deduplication and error messages)
|
|
214
214
|
* - Optionally declares a priority (lower runs first, default: 50)
|
|
215
215
|
* - Implements setup() which receives BuilderContext and wires in handlers/methods
|
|
216
216
|
* - Optionally implements destroy() for cleanup
|
|
217
|
-
* - Optionally declares methods it adds and
|
|
217
|
+
* - Optionally declares methods it adds and features it conflicts with
|
|
218
218
|
*/
|
|
219
|
-
export interface
|
|
220
|
-
/** Unique
|
|
219
|
+
export interface VListFeature<T extends VListItem = VListItem> {
|
|
220
|
+
/** Unique feature name (used for deduplication and error messages) */
|
|
221
221
|
readonly name: string;
|
|
222
222
|
/** Execution priority — lower runs first (default: 50) */
|
|
223
223
|
readonly priority?: number;
|
|
@@ -225,18 +225,18 @@ export interface VListPlugin<T extends VListItem = VListItem> {
|
|
|
225
225
|
setup(ctx: BuilderContext<T>): void;
|
|
226
226
|
/** Cleanup function — called on destroy */
|
|
227
227
|
destroy?(): void;
|
|
228
|
-
/** Methods this
|
|
228
|
+
/** Methods this feature adds to the public API */
|
|
229
229
|
readonly methods?: readonly string[];
|
|
230
|
-
/**
|
|
230
|
+
/** Features this feature conflicts with (cannot be combined) */
|
|
231
231
|
readonly conflicts?: readonly string[];
|
|
232
232
|
}
|
|
233
|
-
/** Factory function that returns a
|
|
234
|
-
export type
|
|
233
|
+
/** Factory function that returns a feature */
|
|
234
|
+
export type FeatureFactory<T extends VListItem = VListItem> = VListFeature<T>;
|
|
235
235
|
/** Chainable builder interface */
|
|
236
236
|
export interface VListBuilder<T extends VListItem = VListItem> {
|
|
237
|
-
/** Register a feature
|
|
238
|
-
use(
|
|
239
|
-
/** Materialize the virtual list. Creates DOM, initializes
|
|
237
|
+
/** Register a feature. Chainable. */
|
|
238
|
+
use(feature: VListFeature<T>): VListBuilder<T>;
|
|
239
|
+
/** Materialize the virtual list. Creates DOM, initializes features, returns API. */
|
|
240
240
|
build(): BuiltVList<T>;
|
|
241
241
|
}
|
|
242
242
|
/** Base API always available from builder (data methods, scroll methods, events, lifecycle) */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/data - Builder
|
|
3
|
-
* Wraps async data loading with sparse storage into a
|
|
2
|
+
* vlist/data - Builder Feature
|
|
3
|
+
* Wraps async data loading with sparse storage into a VListFeature for the composable builder.
|
|
4
4
|
*
|
|
5
5
|
* Priority: 20 (runs before scrollbar and selection, after grid/groups)
|
|
6
6
|
*
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* Added events: load:start, load:end, error
|
|
17
17
|
*/
|
|
18
18
|
import type { VListItem, VListAdapter } from "../../types";
|
|
19
|
-
import type {
|
|
20
|
-
/** Data
|
|
21
|
-
export interface
|
|
19
|
+
import type { VListFeature } from "../../builder/types";
|
|
20
|
+
/** Data feature configuration */
|
|
21
|
+
export interface DataFeatureConfig<T extends VListItem = VListItem> {
|
|
22
22
|
/** Async data source (required) */
|
|
23
23
|
adapter: VListAdapter<T>;
|
|
24
24
|
/** Loading behavior configuration */
|
|
@@ -32,7 +32,7 @@ export interface DataPluginConfig<T extends VListItem = VListItem> {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Create a data
|
|
35
|
+
* Create a data feature for the builder.
|
|
36
36
|
*
|
|
37
37
|
* Adds async data loading with sparse storage, placeholders, and infinite scroll.
|
|
38
38
|
*
|
|
@@ -56,5 +56,5 @@ export interface DataPluginConfig<T extends VListItem = VListItem> {
|
|
|
56
56
|
* .build()
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
export declare const withAsync: <T extends VListItem = VListItem>(config:
|
|
60
|
-
//# sourceMappingURL=
|
|
59
|
+
export declare const withAsync: <T extends VListItem = VListItem>(config: DataFeatureConfig<T>) => VListFeature<T>;
|
|
60
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* vlist - Data Domain
|
|
3
3
|
* Data management, sparse storage, and placeholder generation
|
|
4
4
|
*/
|
|
5
|
-
export { withAsync, type
|
|
5
|
+
export { withAsync, type DataFeatureConfig } from "./feature";
|
|
6
6
|
export { createDataManager, mergeRanges, calculateMissingRanges, isPlaceholderItem, filterPlaceholders, countRealItems, type DataManager, type DataManagerConfig, type DataState, } from "./manager";
|
|
7
7
|
export { createSparseStorage, type SparseStorage, type SparseStorageConfig, type SparseStorageStats, } from "./sparse";
|
|
8
8
|
export { createPlaceholderManager, replacePlaceholders, type PlaceholderManager, type PlaceholderConfig, } from "./placeholder";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/grid - Builder
|
|
2
|
+
* vlist/grid - Builder Feature
|
|
3
3
|
* Switches from list layout to a 2D grid with configurable columns and gap.
|
|
4
4
|
*
|
|
5
5
|
* Priority: 10 (runs first — replaces the renderer before anything else renders)
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
* Can be combined with withGroups for grouped 2D layouts.
|
|
19
19
|
*/
|
|
20
20
|
import type { VListItem } from "../../types";
|
|
21
|
-
import type {
|
|
22
|
-
/** Grid
|
|
23
|
-
export interface
|
|
21
|
+
import type { VListFeature } from "../../builder/types";
|
|
22
|
+
/** Grid feature configuration */
|
|
23
|
+
export interface GridFeatureConfig {
|
|
24
24
|
/** Number of columns (required, >= 1) */
|
|
25
25
|
columns: number;
|
|
26
26
|
/** Gap between items in pixels (default: 0) */
|
|
27
27
|
gap?: number;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Create a grid
|
|
30
|
+
* Create a grid feature for the builder.
|
|
31
31
|
*
|
|
32
32
|
* Switches from list layout to a 2D grid with configurable columns and gap.
|
|
33
33
|
*
|
|
@@ -44,5 +44,5 @@ export interface GridPluginConfig {
|
|
|
44
44
|
* .build()
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
|
-
export declare const withGrid: <T extends VListItem = VListItem>(config:
|
|
48
|
-
//# sourceMappingURL=
|
|
47
|
+
export declare const withGrid: <T extends VListItem = VListItem>(config: GridFeatureConfig) => VListFeature<T>;
|
|
48
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* vlist - Grid Domain
|
|
3
3
|
* 2D grid/card layout with virtualized rows
|
|
4
4
|
*/
|
|
5
|
-
export { withGrid, type
|
|
5
|
+
export { withGrid, type GridFeatureConfig } from "./feature";
|
|
6
6
|
export { createGridLayout } from "./layout";
|
|
7
7
|
export { createGridRenderer, type GridRenderer } from "./renderer";
|
|
8
8
|
export type { GridConfig, GridLayout, GridPosition, ItemRange } from "./types";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/window - Window Scroll Mode
|
|
2
|
+
* vlist/window - Window Scroll Mode Feature
|
|
3
3
|
*
|
|
4
4
|
* Enables the list to scroll with the page instead of in its own container.
|
|
5
5
|
* Useful for infinite feeds, full-page lists, and chat UIs that integrate
|
|
6
6
|
* with page scroll.
|
|
7
7
|
*
|
|
8
|
-
* Priority: 5 (runs early, before other
|
|
8
|
+
* Priority: 5 (runs early, before other features that depend on scroll)
|
|
9
9
|
*
|
|
10
10
|
* What it does:
|
|
11
11
|
* - Uses window as scroll target instead of viewport element
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
* Bundle impact: ~0.3 KB gzipped when used
|
|
18
18
|
*/
|
|
19
19
|
import type { VListItem } from "../../types";
|
|
20
|
-
import type {
|
|
20
|
+
import type { VListFeature } from "../../builder/types";
|
|
21
21
|
/**
|
|
22
|
-
* Create a window scroll mode
|
|
22
|
+
* Create a window scroll mode feature.
|
|
23
23
|
*
|
|
24
24
|
* Use this when you want your list to scroll with the page instead of
|
|
25
25
|
* in a fixed-height container.
|
|
@@ -49,5 +49,5 @@ import type { VListPlugin } from "../../builder/types";
|
|
|
49
49
|
* .build()
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
export declare const withPage: <T extends VListItem = VListItem>() =>
|
|
53
|
-
//# sourceMappingURL=
|
|
52
|
+
export declare const withPage: <T extends VListItem = VListItem>() => VListFeature<T>;
|
|
53
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/window - Window Scroll Mode
|
|
2
|
+
* vlist/window - Window Scroll Mode Feature
|
|
3
3
|
*
|
|
4
|
-
* Entry point for the window scroll
|
|
4
|
+
* Entry point for the window scroll feature.
|
|
5
5
|
*/
|
|
6
|
-
export { withPage } from "./
|
|
7
|
-
export type {
|
|
6
|
+
export { withPage } from "./feature";
|
|
7
|
+
export type { VListFeature } from "../../builder/types";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/compression - Builder
|
|
2
|
+
* vlist/compression - Builder Feature
|
|
3
3
|
* Enables support for lists with 1M+ items by compressing the scroll space
|
|
4
4
|
* when the total height exceeds the browser's ~16.7M pixel limit.
|
|
5
5
|
*
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
* height exceeds the browser limit, and deactivates when items are removed.
|
|
20
20
|
*/
|
|
21
21
|
import type { VListItem } from "../../types";
|
|
22
|
-
import type {
|
|
22
|
+
import type { VListFeature } from "../../builder/types";
|
|
23
23
|
/**
|
|
24
|
-
* Create a compression
|
|
24
|
+
* Create a compression feature for the builder.
|
|
25
25
|
*
|
|
26
26
|
* Enables support for lists with 1M+ items. No configuration needed —
|
|
27
27
|
* compression activates automatically when the total height exceeds
|
|
@@ -40,5 +40,5 @@ import type { VListPlugin } from "../../builder/types";
|
|
|
40
40
|
* .build()
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
export declare const withScale: <T extends VListItem = VListItem>() =>
|
|
44
|
-
//# sourceMappingURL=
|
|
43
|
+
export declare const withScale: <T extends VListItem = VListItem>() => VListFeature<T>;
|
|
44
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* Usage: import { withScale } from 'vlist/compression'
|
|
7
7
|
*/
|
|
8
8
|
export { MAX_VIRTUAL_HEIGHT, getCompressionState, needsCompression, getMaxItemsWithoutCompression, getCompressionInfo, calculateCompressedVisibleRange, calculateCompressedRenderRange, calculateCompressedItemPosition, calculateCompressedScrollToIndex, calculateIndexFromScrollPosition, type CompressionState, } from "../../rendering/scale";
|
|
9
|
-
export { withScale } from "./
|
|
9
|
+
export { withScale } from "./feature";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/scroll - Builder
|
|
3
|
-
* Wraps the custom scrollbar into a
|
|
2
|
+
* vlist/scroll - Builder Feature
|
|
3
|
+
* Wraps the custom scrollbar into a VListFeature for the composable builder.
|
|
4
4
|
*
|
|
5
5
|
* Priority: 30 (runs after renderer/data setup but before selection)
|
|
6
6
|
*
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* No public methods are added — the scrollbar is entirely automatic.
|
|
17
17
|
*/
|
|
18
18
|
import type { VListItem } from "../../types";
|
|
19
|
-
import type {
|
|
20
|
-
/** Scrollbar
|
|
21
|
-
export interface
|
|
19
|
+
import type { VListFeature } from "../../builder/types";
|
|
20
|
+
/** Scrollbar feature configuration */
|
|
21
|
+
export interface ScrollbarFeatureConfig {
|
|
22
22
|
/** Auto-hide scrollbar after idle (default: true) */
|
|
23
23
|
autoHide?: boolean;
|
|
24
24
|
/** Auto-hide delay in milliseconds (default: 1000) */
|
|
@@ -42,7 +42,7 @@ export interface ScrollbarPluginConfig {
|
|
|
42
42
|
showOnViewportEnter?: boolean;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Create a scrollbar
|
|
45
|
+
* Create a scrollbar feature for the builder.
|
|
46
46
|
*
|
|
47
47
|
* Replaces the native browser scrollbar with a custom, cross-browser
|
|
48
48
|
* consistent scrollbar.
|
|
@@ -56,5 +56,5 @@ export interface ScrollbarPluginConfig {
|
|
|
56
56
|
* .build()
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
export declare const withScrollbar: <T extends VListItem = VListItem>(config?:
|
|
60
|
-
//# sourceMappingURL=
|
|
59
|
+
export declare const withScrollbar: <T extends VListItem = VListItem>(config?: ScrollbarFeatureConfig) => VListFeature<T>;
|
|
60
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* vlist - Scroll Domain
|
|
3
3
|
* Scroll controller and custom scrollbar
|
|
4
4
|
*/
|
|
5
|
-
export { withScrollbar, type
|
|
5
|
+
export { withScrollbar, type ScrollbarFeatureConfig } from "./feature";
|
|
6
6
|
export { createScrollController, rafThrottle, isAtBottom, isAtTop, getScrollPercentage, isRangeVisible, type ScrollController, type ScrollControllerConfig, type ScrollEventData, type ScrollDirection, } from "./controller";
|
|
7
7
|
export { createScrollbar, type Scrollbar, type ScrollbarConfig, type ScrollCallback, } from "./scrollbar";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/groups - Builder
|
|
2
|
+
* vlist/groups - Builder Feature
|
|
3
3
|
* Adds grouped lists with sticky section headers.
|
|
4
4
|
*
|
|
5
5
|
* Priority: 10 (runs first — transforms item list and height function before rendering)
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
* - orientation: 'horizontal' (sticky headers stick to left edge, push left when next header approaches)
|
|
22
22
|
*/
|
|
23
23
|
import type { VListItem } from "../../types";
|
|
24
|
-
import type {
|
|
25
|
-
/** Groups
|
|
26
|
-
export interface
|
|
24
|
+
import type { VListFeature } from "../../builder/types";
|
|
25
|
+
/** Groups feature configuration */
|
|
26
|
+
export interface GroupsFeatureConfig {
|
|
27
27
|
/** Returns group key for item at index (required) */
|
|
28
28
|
getGroupForIndex: (index: number) => string;
|
|
29
29
|
/** Height of group headers in pixels (required) */
|
|
@@ -34,7 +34,7 @@ export interface GroupsPluginConfig {
|
|
|
34
34
|
sticky?: boolean;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* Create a groups
|
|
37
|
+
* Create a groups feature for the builder.
|
|
38
38
|
*
|
|
39
39
|
* Adds grouped lists with sticky section headers.
|
|
40
40
|
*
|
|
@@ -60,5 +60,5 @@ export interface GroupsPluginConfig {
|
|
|
60
60
|
* .build()
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export declare const withSections: <T extends VListItem = VListItem>(config:
|
|
64
|
-
//# sourceMappingURL=
|
|
63
|
+
export declare const withSections: <T extends VListItem = VListItem>(config: GroupsFeatureConfig) => VListFeature<T>;
|
|
64
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* vlist - Groups Domain
|
|
3
3
|
* Sticky headers and grouped lists
|
|
4
4
|
*/
|
|
5
|
-
export { withSections, type
|
|
5
|
+
export { withSections, type GroupsFeatureConfig } from "./feature";
|
|
6
6
|
export type { GroupsConfig, GroupBoundary, LayoutEntry, GroupHeaderItem, GroupLayout, StickyHeader, } from "./types";
|
|
7
7
|
export { isGroupHeader, isGroupHeader as isSectionHeader } from "./types";
|
|
8
8
|
export { createGroupLayout, buildLayoutItems, createGroupedSizeFn, } from "./layout";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/selection - Builder
|
|
3
|
-
* Wraps the selection domain into a
|
|
2
|
+
* vlist/selection - Builder Feature
|
|
3
|
+
* Wraps the selection domain into a VListFeature for the composable builder.
|
|
4
4
|
*
|
|
5
5
|
* Priority: 50 (runs after renderer and data are ready)
|
|
6
6
|
*
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
* Added events: item:click, selection:change
|
|
18
18
|
*/
|
|
19
19
|
import type { VListItem, SelectionMode } from "../../types";
|
|
20
|
-
import type {
|
|
21
|
-
/** Selection
|
|
22
|
-
export interface
|
|
20
|
+
import type { VListFeature } from "../../builder/types";
|
|
21
|
+
/** Selection feature configuration */
|
|
22
|
+
export interface SelectionFeatureConfig {
|
|
23
23
|
/** Selection mode (default: 'single') */
|
|
24
24
|
mode?: SelectionMode;
|
|
25
25
|
/** Initially selected item IDs */
|
|
26
26
|
initial?: Array<string | number>;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Create a selection
|
|
29
|
+
* Create a selection feature for the builder.
|
|
30
30
|
*
|
|
31
31
|
* ```ts
|
|
32
32
|
* import { vlist } from 'vlist/builder'
|
|
@@ -40,5 +40,5 @@ export interface SelectionPluginConfig {
|
|
|
40
40
|
* list.getSelected() // ['id-1', 'id-2']
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
export declare const withSelection: <T extends VListItem = VListItem>(config?:
|
|
44
|
-
//# sourceMappingURL=
|
|
43
|
+
export declare const withSelection: <T extends VListItem = VListItem>(config?: SelectionFeatureConfig) => VListFeature<T>;
|
|
44
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* vlist - Selection Domain
|
|
3
3
|
* Selection state management
|
|
4
4
|
*/
|
|
5
|
-
export { withSelection, type
|
|
5
|
+
export { withSelection, type SelectionFeatureConfig } from "./feature";
|
|
6
6
|
export { createSelectionState, selectItems, deselectItems, toggleSelection, selectAll, clearSelection, setFocusedIndex, moveFocusUp, moveFocusDown, moveFocusToFirst, moveFocusToLast, moveFocusByPage, selectFocused, selectRange, getSelectedIds, getSelectedItems, getSelectionCount, isSelected, isSelectionEmpty, type SelectionState, } from "./state";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist/snapshots - Builder
|
|
2
|
+
* vlist/snapshots - Builder Feature
|
|
3
3
|
* Adds scroll save/restore for SPA navigation and tab switching.
|
|
4
4
|
*
|
|
5
|
-
* Priority: 50 (runs last — needs all other
|
|
5
|
+
* Priority: 50 (runs last — needs all other features initialized)
|
|
6
6
|
*
|
|
7
7
|
* What it wires:
|
|
8
8
|
* - getScrollSnapshot() — captures current scroll position (item index + sub-pixel offset)
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
* Added methods: getScrollSnapshot, restoreScroll
|
|
18
18
|
*/
|
|
19
19
|
import type { VListItem } from "../../types";
|
|
20
|
-
import type {
|
|
20
|
+
import type { VListFeature } from "../../builder/types";
|
|
21
21
|
/**
|
|
22
|
-
* Create a snapshots
|
|
22
|
+
* Create a snapshots feature for the builder.
|
|
23
23
|
*
|
|
24
24
|
* Adds scroll save/restore for SPA navigation and tab switching.
|
|
25
25
|
*
|
|
@@ -40,5 +40,5 @@ import type { VListPlugin } from "../../builder/types";
|
|
|
40
40
|
* if (saved) list.restoreScroll(saved)
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
export declare const withSnapshots: <T extends VListItem = VListItem>() =>
|
|
44
|
-
//# sourceMappingURL=
|
|
43
|
+
export declare const withSnapshots: <T extends VListItem = VListItem>() => VListFeature<T>;
|
|
44
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vlist/snapshots - Scroll Save/Restore
|
|
3
|
-
*
|
|
3
|
+
* Feature for SPA navigation and tab switching
|
|
4
4
|
*
|
|
5
5
|
* Usage: import { withSnapshots } from 'vlist/snapshots'
|
|
6
6
|
*/
|
|
7
|
-
export { withSnapshots } from "./
|
|
7
|
+
export { withSnapshots } from "./feature";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { withGrid } from "./features/grid";
|
|
|
15
15
|
export { withSelection } from "./features/selection";
|
|
16
16
|
export { withSnapshots } from "./features/snapshots";
|
|
17
17
|
export type { VList, VListConfig, VListItem, VListEvents, ItemTemplate, ItemState, SelectionMode, SelectionConfig, SelectionState, ScrollbarConfig, ScrollbarOptions, ScrollConfig, ScrollToOptions, ScrollSnapshot, VListAdapter, AdapterParams, AdapterResponse, Range, ViewportState, EventHandler, Unsubscribe, } from "./types";
|
|
18
|
-
export type { VListBuilder, BuiltVList, BuilderConfig,
|
|
18
|
+
export type { VListBuilder, BuiltVList, BuilderConfig, VListFeature, BuilderContext, } from "./builder";
|
|
19
19
|
export { createGroupLayout as createSectionLayout, buildLayoutItems, createGroupedSizeFn as createSectionedSizeFn, createStickyHeader, isGroupHeader as isSectionHeader, type GroupsConfig as SectionsConfig, type GroupBoundary as SectionBoundary, type LayoutEntry, type GroupHeaderItem as SectionHeaderItem, type GroupLayout as SectionLayout, type StickyHeader, } from "./features/sections";
|
|
20
20
|
export { createGridLayout, createGridRenderer, type GridConfig, type GridLayout, type GridPosition, type GridRenderer, type ItemRange, } from "./features/grid";
|
|
21
21
|
export { createSizeCache, type SizeCache, simpleVisibleRange, calculateRenderRange, calculateTotalSize, calculateActualSize, calculateItemOffset, calculateScrollToIndex, clampScrollPosition, rangesEqual, isInRange, getRangeCount, diffRanges, MAX_VIRTUAL_HEIGHT, getCompressionState as getScaleState, getCompression as getScale, needsCompression as needsScaling, getMaxItemsWithoutCompression as getMaxItemsWithoutScaling, getCompressionInfo as getScaleInfo, calculateCompressedVisibleRange as calculateScaledVisibleRange, calculateCompressedRenderRange as calculateScaledRenderRange, calculateCompressedItemPosition as calculateScaledItemPosition, calculateCompressedScrollToIndex as calculateScaledScrollToIndex, calculateIndexFromScrollPosition, type CompressionState as ScaleState, } from "./rendering";
|
|
@@ -8,13 +8,13 @@ import type { CompressionState } from "./viewport";
|
|
|
8
8
|
import type { SizeCache } from "./sizes";
|
|
9
9
|
/**
|
|
10
10
|
* Optional compression position calculator.
|
|
11
|
-
* Injected by the monolithic factory or the withCompression
|
|
11
|
+
* Injected by the monolithic factory or the withCompression feature.
|
|
12
12
|
* When not provided, the renderer uses simple sizeCache offsets.
|
|
13
13
|
*/
|
|
14
14
|
export type CompressedPositionFn = (index: number, scrollTop: number, sizeCache: SizeCache, totalItems: number, containerHeight: number, compression: CompressionState, rangeStart?: number) => number;
|
|
15
15
|
/**
|
|
16
16
|
* Optional compression state getter.
|
|
17
|
-
* Injected by the monolithic factory or the withCompression
|
|
17
|
+
* Injected by the monolithic factory or the withCompression feature.
|
|
18
18
|
* When not provided, the renderer assumes no compression.
|
|
19
19
|
*/
|
|
20
20
|
export type CompressionStateFn = (totalItems: number, sizeCache: SizeCache) => CompressionState;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* (the common case), all calculations use simple size-cache math
|
|
8
8
|
* with zero dependency on the compression module.
|
|
9
9
|
*
|
|
10
|
-
* This keeps the builder core lightweight. The withCompression
|
|
10
|
+
* This keeps the builder core lightweight. The withCompression feature
|
|
11
11
|
* and the monolithic createVList entry point import compression
|
|
12
12
|
* separately and pass the state in.
|
|
13
13
|
*/
|