vlist 1.9.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.github.md +104 -97
- package/README.md +46 -33
- package/dist/constants.d.ts +11 -6
- package/dist/core/create.d.ts +10 -0
- package/dist/core/dom.d.ts +8 -0
- package/dist/core/hooks.d.ts +16 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/pipeline.d.ts +51 -0
- package/dist/core/pool.d.ts +9 -0
- package/dist/core/scroll.d.ts +32 -0
- package/dist/core/sizes.d.ts +8 -0
- package/dist/core/state.d.ts +47 -0
- package/dist/core/types.d.ts +187 -0
- package/dist/{builder → core}/velocity.d.ts +1 -1
- package/dist/index.d.ts +28 -19
- package/dist/index.js +1 -1
- package/dist/internals.d.ts +11 -7
- package/dist/internals.js +1 -1
- package/dist/plugins/a11y/index.d.ts +2 -0
- package/dist/plugins/a11y/plugin.d.ts +13 -0
- package/dist/{features → plugins}/async/index.d.ts +1 -1
- package/dist/{features → plugins}/async/manager.d.ts +5 -1
- package/dist/plugins/async/plugin.d.ts +48 -0
- package/dist/plugins/autosize/index.d.ts +5 -0
- package/dist/plugins/autosize/plugin.d.ts +19 -0
- package/dist/plugins/grid/index.d.ts +7 -0
- package/dist/plugins/grid/plugin.d.ts +23 -0
- package/dist/{features → plugins}/groups/index.d.ts +1 -1
- package/dist/plugins/groups/plugin.d.ts +22 -0
- package/dist/plugins/masonry/index.d.ts +8 -0
- package/dist/plugins/masonry/plugin.d.ts +32 -0
- package/dist/plugins/page/index.d.ts +5 -0
- package/dist/plugins/page/plugin.d.ts +21 -0
- package/dist/plugins/scale/index.d.ts +5 -0
- package/dist/plugins/scale/plugin.d.ts +24 -0
- package/dist/plugins/scrollbar/index.d.ts +7 -0
- package/dist/plugins/scrollbar/plugin.d.ts +20 -0
- package/dist/plugins/selection/index.d.ts +6 -0
- package/dist/plugins/selection/plugin.d.ts +16 -0
- package/dist/{features → plugins}/selection/state.d.ts +8 -0
- package/dist/plugins/snapshots/index.d.ts +5 -0
- package/dist/plugins/snapshots/plugin.d.ts +17 -0
- package/dist/plugins/sortable/index.d.ts +6 -0
- package/dist/plugins/sortable/plugin.d.ts +34 -0
- package/dist/{features → plugins}/table/index.d.ts +1 -1
- package/dist/plugins/table/plugin.d.ts +20 -0
- package/dist/plugins/transition/index.d.ts +5 -0
- package/dist/plugins/transition/plugin.d.ts +22 -0
- package/dist/size.json +1 -1
- package/dist/utils/padding.d.ts +2 -4
- package/dist/vlist-grid.css +1 -1
- package/dist/vlist-masonry.css +1 -1
- package/dist/vlist-table.css +1 -1
- package/dist/vlist.css +1 -1
- package/package.json +9 -4
- package/dist/builder/a11y.d.ts +0 -16
- package/dist/builder/api.d.ts +0 -21
- package/dist/builder/context.d.ts +0 -36
- package/dist/builder/core.d.ts +0 -16
- package/dist/builder/data.d.ts +0 -71
- package/dist/builder/dom.d.ts +0 -15
- package/dist/builder/index.d.ts +0 -25
- package/dist/builder/materialize.d.ts +0 -166
- package/dist/builder/pool.d.ts +0 -10
- package/dist/builder/range.d.ts +0 -10
- package/dist/builder/scroll.d.ts +0 -24
- package/dist/builder/types.d.ts +0 -512
- package/dist/features/async/feature.d.ts +0 -72
- package/dist/features/autosize/feature.d.ts +0 -34
- package/dist/features/autosize/index.d.ts +0 -2
- package/dist/features/grid/feature.d.ts +0 -48
- package/dist/features/grid/index.d.ts +0 -9
- package/dist/features/groups/feature.d.ts +0 -75
- package/dist/features/masonry/feature.d.ts +0 -45
- package/dist/features/masonry/index.d.ts +0 -9
- package/dist/features/page/feature.d.ts +0 -109
- package/dist/features/page/index.d.ts +0 -9
- package/dist/features/scale/feature.d.ts +0 -42
- package/dist/features/scale/index.d.ts +0 -10
- package/dist/features/scrollbar/feature.d.ts +0 -81
- package/dist/features/scrollbar/index.d.ts +0 -8
- package/dist/features/selection/feature.d.ts +0 -91
- package/dist/features/selection/index.d.ts +0 -7
- package/dist/features/snapshots/feature.d.ts +0 -79
- package/dist/features/snapshots/index.d.ts +0 -9
- package/dist/features/sortable/feature.d.ts +0 -101
- package/dist/features/sortable/index.d.ts +0 -6
- package/dist/features/table/feature.d.ts +0 -67
- package/dist/features/transition/feature.d.ts +0 -30
- package/dist/features/transition/index.d.ts +0 -9
- /package/dist/{features → plugins}/async/placeholder.d.ts +0 -0
- /package/dist/{features → plugins}/async/sparse.d.ts +0 -0
- /package/dist/{features → plugins}/grid/layout.d.ts +0 -0
- /package/dist/{features → plugins}/grid/renderer.d.ts +0 -0
- /package/dist/{features → plugins}/grid/types.d.ts +0 -0
- /package/dist/{features → plugins}/groups/async-bridge.d.ts +0 -0
- /package/dist/{features → plugins}/groups/layout.d.ts +0 -0
- /package/dist/{features → plugins}/groups/sticky.d.ts +0 -0
- /package/dist/{features → plugins}/groups/types.d.ts +0 -0
- /package/dist/{features → plugins}/masonry/layout.d.ts +0 -0
- /package/dist/{features → plugins}/masonry/renderer.d.ts +0 -0
- /package/dist/{features → plugins}/masonry/types.d.ts +0 -0
- /package/dist/{features → plugins}/scrollbar/controller.d.ts +0 -0
- /package/dist/{features → plugins}/scrollbar/scrollbar.d.ts +0 -0
- /package/dist/{features → plugins}/table/header.d.ts +0 -0
- /package/dist/{features → plugins}/table/layout.d.ts +0 -0
- /package/dist/{features → plugins}/table/renderer.d.ts +0 -0
- /package/dist/{features → plugins}/table/types.d.ts +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vlist v2 — 2-Phase Pipeline
|
|
3
|
+
*
|
|
4
|
+
* Phase 1: Calculate & Reconcile — zero allocation hot path.
|
|
5
|
+
* Reads scroll position + size cache, writes into EngineState TypedArrays.
|
|
6
|
+
*
|
|
7
|
+
* Phase 2: Commit — reads EngineState buffers, updates DOM via pool.
|
|
8
|
+
* Sub-phases: acquire → identity bind → position → release.
|
|
9
|
+
*
|
|
10
|
+
* Both phases are synchronous. No intermediate objects are allocated.
|
|
11
|
+
*/
|
|
12
|
+
import type { SizeCache } from "./sizes";
|
|
13
|
+
import type { VListItem, ItemTemplate, ItemState, VListEvents } from "../types";
|
|
14
|
+
import type { CompiledHooks, ElementPool } from "./types";
|
|
15
|
+
import type { EngineState } from "./state";
|
|
16
|
+
import type { Emitter } from "../events";
|
|
17
|
+
export interface RenderConfig {
|
|
18
|
+
readonly prefix: string;
|
|
19
|
+
readonly selectedClass: string;
|
|
20
|
+
readonly focusedClass: string;
|
|
21
|
+
readonly placeholderClass: string;
|
|
22
|
+
readonly replacedClass: string;
|
|
23
|
+
readonly translateProp: "translateX(" | "translateY(";
|
|
24
|
+
readonly itemRole: "option" | "listitem";
|
|
25
|
+
readonly interactive: boolean;
|
|
26
|
+
readonly horizontal: boolean;
|
|
27
|
+
readonly startPadding: number;
|
|
28
|
+
readonly gap: number;
|
|
29
|
+
readonly hasCrossPad: boolean;
|
|
30
|
+
readonly crossStartProp: string;
|
|
31
|
+
readonly crossEndProp: string;
|
|
32
|
+
readonly crossStartVal: string;
|
|
33
|
+
readonly crossEndVal: string;
|
|
34
|
+
readonly oddClass: string;
|
|
35
|
+
readonly emitter: Emitter<VListEvents> | null;
|
|
36
|
+
}
|
|
37
|
+
export declare function createRenderConfig(classPrefix: string, horizontal: boolean, interactive: boolean, startPadding: number, crossPadStart: number, crossPadEnd: number, oddClass: string, gap: number, emitter?: Emitter<VListEvents> | null): RenderConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate visible range and fill EngineState buffers.
|
|
40
|
+
* Zero allocation — all writes go into pre-allocated TypedArrays.
|
|
41
|
+
*
|
|
42
|
+
* Guards:
|
|
43
|
+
* - Zero container size early exit
|
|
44
|
+
* - Empty range sentinel: visibleCount = 0
|
|
45
|
+
* - Overscan application
|
|
46
|
+
* - Render count safety cap
|
|
47
|
+
*/
|
|
48
|
+
export declare function phase1Calculate(state: EngineState, sizeCache: SizeCache, overscan: number, hooks: CompiledHooks, startPadding?: number): boolean;
|
|
49
|
+
export declare function phase2Commit<T extends VListItem>(state: EngineState, pool: ElementPool, contentElement: HTMLElement, template: ItemTemplate<T>, getItems: () => readonly T[], rendered: Map<number, HTMLElement>, rc: RenderConfig, hooks: CompiledHooks, getItemFn?: ((index: number) => T | undefined) | null, itemStateFn?: ((index: number, state: ItemState) => void) | null): void;
|
|
50
|
+
export declare function render<T extends VListItem>(state: EngineState, sizeCache: SizeCache, overscan: number, pool: ElementPool, contentElement: HTMLElement, template: ItemTemplate<T>, getItems: () => readonly T[], rendered: Map<number, HTMLElement>, rc: RenderConfig, hooks: CompiledHooks, getItemFn?: ((index: number) => T | undefined) | null, itemStateFn?: ((index: number, state: ItemState) => void) | null): void;
|
|
51
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vlist v2 — Element Pool
|
|
3
|
+
*
|
|
4
|
+
* acquire() = pop or create, release() = reset + push.
|
|
5
|
+
* Max pool size: 100.
|
|
6
|
+
*/
|
|
7
|
+
import type { ElementPool } from "./types";
|
|
8
|
+
export declare function createPool(classPrefix: string): ElementPool;
|
|
9
|
+
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vlist v2 — Scroll Handling
|
|
3
|
+
*
|
|
4
|
+
* Wheel interception for synchronous rendering, scroll idle detection,
|
|
5
|
+
* and smooth scroll animation.
|
|
6
|
+
*/
|
|
7
|
+
import type { EngineState } from "./state";
|
|
8
|
+
export interface ScrollHandler {
|
|
9
|
+
/** Attach scroll and wheel listeners */
|
|
10
|
+
attach(): void;
|
|
11
|
+
/** Detach all listeners */
|
|
12
|
+
detach(): void;
|
|
13
|
+
/** Cancel smooth scroll animation */
|
|
14
|
+
cancelScroll(): void;
|
|
15
|
+
/** Animate to a target scroll position */
|
|
16
|
+
smoothScrollTo(target: number, duration: number, setFn?: (pos: number) => void, easing?: (t: number) => number): void;
|
|
17
|
+
}
|
|
18
|
+
export interface ScrollHandlerConfig {
|
|
19
|
+
readonly state: EngineState;
|
|
20
|
+
readonly viewport: HTMLElement;
|
|
21
|
+
readonly horizontal: boolean;
|
|
22
|
+
readonly wheelEnabled: boolean;
|
|
23
|
+
readonly idleTimeout: number;
|
|
24
|
+
/** Override the event target for scroll/wheel listeners (default: viewport) */
|
|
25
|
+
readonly scrollTarget?: EventTarget;
|
|
26
|
+
/** Called synchronously on scroll — triggers the 2-phase pipeline */
|
|
27
|
+
readonly onFrame: () => void;
|
|
28
|
+
/** Called when scrolling becomes idle */
|
|
29
|
+
readonly onIdle: () => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createScrollHandler(config: ScrollHandlerConfig): ScrollHandler;
|
|
32
|
+
//# sourceMappingURL=scroll.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vlist v2 — Size Cache
|
|
3
|
+
*
|
|
4
|
+
* Float64Array prefix sums with O(1) offset lookups and O(log n) binary search.
|
|
5
|
+
*/
|
|
6
|
+
export { createSizeCache, countVisibleItems, countItemsFittingFromBottom, getOffsetForVirtualIndex, } from "../rendering/sizes";
|
|
7
|
+
export type { SizeCache } from "../rendering/sizes";
|
|
8
|
+
//# sourceMappingURL=sizes.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vlist v2 — EngineState
|
|
3
|
+
*
|
|
4
|
+
* Persistent singleton instantiated once during createVList().
|
|
5
|
+
* All hot-path state lives in pre-allocated TypedArrays.
|
|
6
|
+
* Phase 1 mutates in place. Phase 2 reads directly. Zero allocation.
|
|
7
|
+
*/
|
|
8
|
+
export interface EngineState {
|
|
9
|
+
/** Data indices of visible items — Phase 1 writes, Phase 2 reads */
|
|
10
|
+
visibleIndices: Int32Array;
|
|
11
|
+
/** Pixel offsets along main axis for each visible item */
|
|
12
|
+
visibleOffsets: Float64Array;
|
|
13
|
+
/** Sizes along main axis for each visible item */
|
|
14
|
+
visibleSizes: Float64Array;
|
|
15
|
+
/** Number of valid entries in the buffers (0 = empty range sentinel) */
|
|
16
|
+
visibleCount: number;
|
|
17
|
+
/** First data index in the visible window (contiguous layouts) */
|
|
18
|
+
startIndex: number;
|
|
19
|
+
/** Total content size in pixels */
|
|
20
|
+
totalSize: number;
|
|
21
|
+
/** Current buffer capacity */
|
|
22
|
+
capacity: number;
|
|
23
|
+
scrollPosition: number;
|
|
24
|
+
prevScrollPosition: number;
|
|
25
|
+
/** 1 = forward, -1 = backward, 0 = idle */
|
|
26
|
+
scrollDirection: number;
|
|
27
|
+
containerSize: number;
|
|
28
|
+
crossSize: number;
|
|
29
|
+
totalItems: number;
|
|
30
|
+
prevRangeStart: number;
|
|
31
|
+
prevRangeEnd: number;
|
|
32
|
+
renderPending: boolean;
|
|
33
|
+
initialized: boolean;
|
|
34
|
+
destroyed: boolean;
|
|
35
|
+
isCompressed: boolean;
|
|
36
|
+
compressionRatio: number;
|
|
37
|
+
prevAriaTotal: number;
|
|
38
|
+
/**
|
|
39
|
+
* Resize buffers when container changes. Cold path only.
|
|
40
|
+
* Heuristic: capacity = ceil(containerSize / minItemSize) + overscan * 2
|
|
41
|
+
*/
|
|
42
|
+
resizeCapacity(containerSize: number, minItemSize: number, overscan?: number): void;
|
|
43
|
+
/** Reset to empty range sentinel. */
|
|
44
|
+
clear(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function createEngineState(initialCapacity: number): EngineState;
|
|
47
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vlist v2 — Core Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Zero-allocation pipeline types. All hot-path state lives in TypedArrays
|
|
5
|
+
* on the EngineState singleton — no intermediate object allocation.
|
|
6
|
+
*/
|
|
7
|
+
import type { VListItem, ItemTemplate, ItemState } from "../types";
|
|
8
|
+
import type { SizeCache } from "./sizes";
|
|
9
|
+
import type { EngineState } from "./state";
|
|
10
|
+
import type { Emitter } from "../events";
|
|
11
|
+
/** Phase 1 hook — mutates EngineState in place, zero allocation */
|
|
12
|
+
export type CalculateHook = (state: EngineState) => void;
|
|
13
|
+
/** Phase 2 hook — runs after DOM commit */
|
|
14
|
+
export type CommitHook = (state: EngineState) => void;
|
|
15
|
+
/** After-scroll hook — runs after both phases complete */
|
|
16
|
+
export type AfterScrollHook = (scrollPosition: number, direction: number) => void;
|
|
17
|
+
/** Idle hook — runs when scrolling stops */
|
|
18
|
+
export type IdleHook = () => void;
|
|
19
|
+
/** Resize hook — runs on container resize (cold path) */
|
|
20
|
+
export type ResizeHook = (width: number, height: number) => void;
|
|
21
|
+
export interface CompiledHooks {
|
|
22
|
+
readonly calculate: readonly CalculateHook[];
|
|
23
|
+
readonly commit: readonly CommitHook[];
|
|
24
|
+
readonly afterScroll: readonly AfterScrollHook[];
|
|
25
|
+
readonly idle: readonly IdleHook[];
|
|
26
|
+
readonly resize: readonly ResizeHook[];
|
|
27
|
+
}
|
|
28
|
+
export interface ResolvedConfig {
|
|
29
|
+
readonly overscan: number;
|
|
30
|
+
readonly horizontal: boolean;
|
|
31
|
+
readonly reverse: boolean;
|
|
32
|
+
readonly classPrefix: string;
|
|
33
|
+
readonly interactive: boolean;
|
|
34
|
+
readonly mainAxisPadding: number;
|
|
35
|
+
readonly crossAxisPadding: number;
|
|
36
|
+
readonly startPadding: number;
|
|
37
|
+
readonly endPadding: number;
|
|
38
|
+
readonly crossPadStart: number;
|
|
39
|
+
readonly crossPadEnd: number;
|
|
40
|
+
readonly striped: boolean | "data" | "even" | "odd";
|
|
41
|
+
readonly gap: number;
|
|
42
|
+
}
|
|
43
|
+
export interface DOMStructure {
|
|
44
|
+
readonly root: HTMLElement;
|
|
45
|
+
readonly viewport: HTMLElement;
|
|
46
|
+
readonly content: HTMLElement;
|
|
47
|
+
readonly liveRegion: HTMLElement;
|
|
48
|
+
}
|
|
49
|
+
export interface ElementPool {
|
|
50
|
+
acquire(): HTMLElement;
|
|
51
|
+
release(element: HTMLElement): void;
|
|
52
|
+
readonly size: number;
|
|
53
|
+
clear(): void;
|
|
54
|
+
}
|
|
55
|
+
export type VisibleRangeFn = (scrollPosition: number, containerSize: number, sizeCache: SizeCache, totalItems: number, outStart: {
|
|
56
|
+
value: number;
|
|
57
|
+
}, outEnd: {
|
|
58
|
+
value: number;
|
|
59
|
+
}) => void;
|
|
60
|
+
export interface PluginContext<T extends VListItem = VListItem> {
|
|
61
|
+
readonly dom: DOMStructure;
|
|
62
|
+
readonly sizeCache: SizeCache;
|
|
63
|
+
readonly pool: ElementPool;
|
|
64
|
+
readonly config: ResolvedConfig;
|
|
65
|
+
readonly emitter: Emitter<import("../types").VListEvents<T>>;
|
|
66
|
+
readonly template: ItemTemplate<T>;
|
|
67
|
+
registerMethod(name: string, fn: Function): void;
|
|
68
|
+
getMethod(name: string): Function | undefined;
|
|
69
|
+
registerClickHandler(handler: (event: MouseEvent) => void): void;
|
|
70
|
+
registerKeydownHandler(handler: (event: KeyboardEvent) => void): void;
|
|
71
|
+
registerDestroyHandler(handler: () => void): void;
|
|
72
|
+
setSizeConfig(config: number | ((index: number) => number)): void;
|
|
73
|
+
setVisibleRangeFn(fn: VisibleRangeFn): void;
|
|
74
|
+
setScrollFns(get: () => number, set: (pos: number) => void): void;
|
|
75
|
+
setVirtualTotalFn(fn: () => number): void;
|
|
76
|
+
getItems(): readonly T[];
|
|
77
|
+
getItem(index: number): T | undefined;
|
|
78
|
+
getState(): EngineState;
|
|
79
|
+
rebuildSizeCache(): void;
|
|
80
|
+
updateContentSize(size: number): void;
|
|
81
|
+
setRenderFn(renderIfNeeded: () => void, forceRender: () => void): void;
|
|
82
|
+
renderIfNeeded(): void;
|
|
83
|
+
forceRender(): void;
|
|
84
|
+
setGetItemFn(fn: (index: number) => T | undefined): void;
|
|
85
|
+
setItemStateFn(fn: (index: number, state: ItemState) => void): void;
|
|
86
|
+
getItemStateFn(): ((index: number, state: ItemState) => void) | null;
|
|
87
|
+
readonly rawSizeSpec: number | ((index: number, ...args: unknown[]) => number);
|
|
88
|
+
scrollTo(position: number): void;
|
|
89
|
+
smoothScrollTo(position: number, duration: number, easing?: (t: number) => number): void;
|
|
90
|
+
disableDefaultScroll(): void;
|
|
91
|
+
disableDefaultResize(): void;
|
|
92
|
+
setScrollTarget(target: EventTarget): void;
|
|
93
|
+
setScrollToPosFn(fn: (index: number, sizeCache: import("./sizes").SizeCache, containerSize: number, totalItems: number, align: string) => number): void;
|
|
94
|
+
setScrollToIndexFn(fn: (index: number, align: string, behavior?: string, duration?: number, easing?: (t: number) => number) => void | false): void;
|
|
95
|
+
onScrollFrame(): void;
|
|
96
|
+
onScrollIdle(): void;
|
|
97
|
+
removeItemById(id: string | number): number;
|
|
98
|
+
insertItemAt(item: T, index: number): void;
|
|
99
|
+
setRemoveItemFn(fn: (id: string | number) => number): void;
|
|
100
|
+
setInsertItemFn(fn: (item: T, index: number) => void): void;
|
|
101
|
+
setUpdateItemFn(fn: (id: string | number, updates: Partial<T>) => boolean): void;
|
|
102
|
+
getRenderedElement(index: number): HTMLElement | null;
|
|
103
|
+
setNavConfig(config: {
|
|
104
|
+
total?: () => number;
|
|
105
|
+
ud?: number;
|
|
106
|
+
lr?: number;
|
|
107
|
+
scrollIndex?: (itemIndex: number) => number;
|
|
108
|
+
navigate?: (currentIndex: number, key: string, total: number) => number;
|
|
109
|
+
}): void;
|
|
110
|
+
getNavConfig(): {
|
|
111
|
+
ud: number;
|
|
112
|
+
lr: number;
|
|
113
|
+
scrollIndex: ((itemIndex: number) => number) | null;
|
|
114
|
+
navigate: ((currentIndex: number, key: string, total: number) => number) | null;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface VListPlugin<T extends VListItem = VListItem> {
|
|
118
|
+
readonly name: string;
|
|
119
|
+
readonly priority?: number;
|
|
120
|
+
readonly conflicts?: readonly string[];
|
|
121
|
+
/** Cold path: one-time wiring during createVList(). */
|
|
122
|
+
setup?(ctx: PluginContext<T>): void;
|
|
123
|
+
/** Hot path: compiled into linear arrays, iterated per frame. */
|
|
124
|
+
hooks?: {
|
|
125
|
+
onCalculate?(state: EngineState): void;
|
|
126
|
+
onCommit?(state: EngineState): void;
|
|
127
|
+
onAfterScroll?(scrollPosition: number, direction: number): void;
|
|
128
|
+
onIdle?(): void;
|
|
129
|
+
onResize?(width: number, height: number): void;
|
|
130
|
+
};
|
|
131
|
+
/** Cleanup on destroy. */
|
|
132
|
+
destroy?(): void;
|
|
133
|
+
}
|
|
134
|
+
export interface VList<T extends VListItem = VListItem> {
|
|
135
|
+
readonly element: HTMLElement;
|
|
136
|
+
readonly items: readonly T[];
|
|
137
|
+
readonly total: number;
|
|
138
|
+
setItems(items: T[]): void;
|
|
139
|
+
appendItems(items: T[]): void;
|
|
140
|
+
prependItems(items: T[]): void;
|
|
141
|
+
updateItem(id: string | number, updates: Partial<T>): void;
|
|
142
|
+
insertItem(item: T, index?: number): void;
|
|
143
|
+
removeItem(id: string | number): void;
|
|
144
|
+
removeItems(ids: ReadonlyArray<string | number>): number;
|
|
145
|
+
getItemAt(index: number): T | undefined;
|
|
146
|
+
getIndexById(id: string | number): number;
|
|
147
|
+
scrollToIndex(index: number, align?: "start" | "center" | "end" | {
|
|
148
|
+
align?: "start" | "center" | "end";
|
|
149
|
+
behavior?: "auto" | "smooth";
|
|
150
|
+
duration?: number;
|
|
151
|
+
easing?: (t: number) => number;
|
|
152
|
+
}): void;
|
|
153
|
+
getScrollPosition(): number;
|
|
154
|
+
on<K extends keyof import("../types").VListEvents<T>>(event: K, handler: import("../types").EventHandler<import("../types").VListEvents<T>[K]>): import("../types").Unsubscribe;
|
|
155
|
+
off<K extends keyof import("../types").VListEvents<T>>(event: K, handler: import("../types").EventHandler<import("../types").VListEvents<T>[K]>): void;
|
|
156
|
+
destroy(): void;
|
|
157
|
+
[key: string]: unknown;
|
|
158
|
+
}
|
|
159
|
+
export interface CreateVListConfig<T extends VListItem = VListItem> {
|
|
160
|
+
container: HTMLElement | string;
|
|
161
|
+
item: {
|
|
162
|
+
height?: number | ((index: number) => number);
|
|
163
|
+
width?: number | ((index: number) => number);
|
|
164
|
+
estimatedHeight?: number;
|
|
165
|
+
estimatedWidth?: number;
|
|
166
|
+
template: ItemTemplate<T>;
|
|
167
|
+
gap?: number;
|
|
168
|
+
striped?: boolean | "data" | "even" | "odd";
|
|
169
|
+
};
|
|
170
|
+
items?: T[];
|
|
171
|
+
overscan?: number;
|
|
172
|
+
classPrefix?: string;
|
|
173
|
+
orientation?: "vertical" | "horizontal";
|
|
174
|
+
padding?: number | [number, number] | [number, number, number, number];
|
|
175
|
+
interactive?: boolean;
|
|
176
|
+
reverse?: boolean;
|
|
177
|
+
ariaLabel?: string;
|
|
178
|
+
scroll?: {
|
|
179
|
+
wheel?: boolean;
|
|
180
|
+
scrollbar?: "none";
|
|
181
|
+
gutter?: "auto" | "stable";
|
|
182
|
+
idleTimeout?: number;
|
|
183
|
+
};
|
|
184
|
+
/** Defer initial render to the next animation frame. */
|
|
185
|
+
defer?: boolean;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -8,26 +8,35 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export type {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export type {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export
|
|
11
|
+
export { createVList } from "./core/create";
|
|
12
|
+
export { scale } from "./plugins/scale";
|
|
13
|
+
export type { ScalePluginConfig } from "./plugins/scale";
|
|
14
|
+
export { scrollbar } from "./plugins/scrollbar";
|
|
15
|
+
export type { ScrollbarPluginConfig } from "./plugins/scrollbar";
|
|
16
|
+
export { grid } from "./plugins/grid";
|
|
17
|
+
export { a11y } from "./plugins/a11y";
|
|
18
|
+
export { selection } from "./plugins/selection";
|
|
19
|
+
export type { SelectionPluginConfig } from "./plugins/selection";
|
|
20
|
+
export { page } from "./plugins/page";
|
|
21
|
+
export type { PagePluginConfig } from "./plugins/page";
|
|
22
|
+
export { snapshots } from "./plugins/snapshots";
|
|
23
|
+
export type { SnapshotsPluginConfig } from "./plugins/snapshots";
|
|
24
|
+
export { transition } from "./plugins/transition";
|
|
25
|
+
export type { TransitionPluginConfig } from "./plugins/transition";
|
|
26
|
+
export { autosize } from "./plugins/autosize";
|
|
27
|
+
export type { AutosizePluginConfig } from "./plugins/autosize";
|
|
28
|
+
export { masonry } from "./plugins/masonry";
|
|
29
|
+
export type { MasonryPluginConfig } from "./plugins/masonry";
|
|
30
|
+
export { data } from "./plugins/async";
|
|
31
|
+
export type { DataPluginConfig } from "./plugins/async";
|
|
32
|
+
export { groups } from "./plugins/groups";
|
|
33
|
+
export type { GroupsPluginConfig } from "./plugins/groups";
|
|
34
|
+
export { table } from "./plugins/table";
|
|
35
|
+
export type { TablePluginConfig } from "./plugins/table";
|
|
36
|
+
export { sortable } from "./plugins/sortable";
|
|
37
|
+
export type { SortablePluginConfig } from "./plugins/sortable";
|
|
29
38
|
export { createStats } from "./utils/stats";
|
|
30
39
|
export type { Stats, StatsConfig, StatsState } from "./utils/stats";
|
|
31
40
|
export type { VListItem, VListEvents, ItemConfig, ItemTemplate, ItemState, SelectionMode, SelectionConfig, SelectionState, ScrollbarConfig, ScrollbarPadding, ScrollbarOptions, ScrollConfig, ScrollToOptions, ScrollSnapshot, VListAdapter, AdapterParams, AdapterResponse, Range, ViewportState, EventHandler, Unsubscribe, GridConfig, MasonryConfig, GroupsConfig, GroupHeaderConfig, GridSizeContext, GridHeightContext, } from "./types";
|
|
32
|
-
export type {
|
|
41
|
+
export type { VList, VListPlugin, PluginContext, CreateVListConfig, CompiledHooks, ResolvedConfig, DOMStructure, ElementPool, } from "./core/types";
|
|
33
42
|
//# sourceMappingURL=index.d.ts.map
|