@tanstack/virtual-core 3.0.0-beta.22 → 3.0.0-beta.26

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/build/stats.json DELETED
@@ -1,76 +0,0 @@
1
- {
2
- "version": 2,
3
- "tree": {
4
- "name": "root",
5
- "children": [
6
- {
7
- "name": "index.production.js",
8
- "children": [
9
- {
10
- "name": "packages/virtual-core/src",
11
- "children": [
12
- {
13
- "uid": "07ec-5",
14
- "name": "utils.ts"
15
- },
16
- {
17
- "uid": "07ec-7",
18
- "name": "index.ts"
19
- }
20
- ]
21
- }
22
- ]
23
- }
24
- ],
25
- "isRoot": true
26
- },
27
- "nodeParts": {
28
- "07ec-5": {
29
- "renderedLength": 1432,
30
- "gzipLength": 544,
31
- "brotliLength": 0,
32
- "mainUid": "07ec-4"
33
- },
34
- "07ec-7": {
35
- "renderedLength": 17482,
36
- "gzipLength": 3850,
37
- "brotliLength": 0,
38
- "mainUid": "07ec-6"
39
- }
40
- },
41
- "nodeMetas": {
42
- "07ec-4": {
43
- "id": "/packages/virtual-core/src/utils.ts",
44
- "moduleParts": {
45
- "index.production.js": "07ec-5"
46
- },
47
- "imported": [],
48
- "importedBy": [
49
- {
50
- "uid": "07ec-6"
51
- }
52
- ]
53
- },
54
- "07ec-6": {
55
- "id": "/packages/virtual-core/src/index.ts",
56
- "moduleParts": {
57
- "index.production.js": "07ec-7"
58
- },
59
- "imported": [
60
- {
61
- "uid": "07ec-4"
62
- }
63
- ],
64
- "importedBy": [],
65
- "isEntry": true
66
- }
67
- },
68
- "env": {
69
- "rollup": "2.75.4"
70
- },
71
- "options": {
72
- "gzip": true,
73
- "brotli": false,
74
- "sourcemap": false
75
- }
76
- }
@@ -1,131 +0,0 @@
1
- /**
2
- * virtual-core
3
- *
4
- * Copyright (c) TanStack
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- declare type NoInfer<A extends any> = [A][A extends any ? 0 : never];
12
- declare type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
13
- declare function memo<TDeps extends readonly any[], TResult>(getDeps: () => [...TDeps], fn: (...args: NoInfer<[...TDeps]>) => TResult, opts: {
14
- key: any;
15
- debug?: () => any;
16
- onChange?: (result: TResult) => void;
17
- }): () => TResult;
18
-
19
- declare type ScrollAlignment = 'start' | 'center' | 'end' | 'auto';
20
- interface ScrollToOptions {
21
- align?: ScrollAlignment;
22
- smoothScroll?: boolean;
23
- }
24
- declare type ScrollToOffsetOptions = ScrollToOptions;
25
- declare type ScrollToIndexOptions = ScrollToOptions;
26
- interface Range {
27
- startIndex: number;
28
- endIndex: number;
29
- overscan: number;
30
- count: number;
31
- }
32
- declare type Key = number | string;
33
- interface VirtualItem {
34
- key: Key;
35
- index: number;
36
- start: number;
37
- end: number;
38
- size: number;
39
- }
40
- interface Rect {
41
- width: number;
42
- height: number;
43
- }
44
- declare const defaultKeyExtractor: (index: number) => number;
45
- declare const defaultRangeExtractor: (range: Range) => number[];
46
- declare const observeElementRect: (instance: Virtualizer<any, any>, cb: (rect: Rect) => void) => (() => void) | undefined;
47
- declare const observeWindowRect: (instance: Virtualizer<any, any>, cb: (rect: Rect) => void) => (() => void) | undefined;
48
- declare const observeElementOffset: (instance: Virtualizer<any, any>, cb: (offset: number) => void) => (() => void) | undefined;
49
- declare const observeWindowOffset: (instance: Virtualizer<any, any>, cb: (offset: number) => void) => (() => void) | undefined;
50
- declare const measureElement: <TItemElement extends Element>(element: TItemElement, instance: Virtualizer<any, TItemElement>) => number;
51
- declare const windowScroll: (offset: number, { canSmooth, sync }: {
52
- canSmooth: boolean;
53
- sync: boolean;
54
- }, instance: Virtualizer<any, any>) => void;
55
- declare const elementScroll: (offset: number, { canSmooth, sync }: {
56
- canSmooth: boolean;
57
- sync: boolean;
58
- }, instance: Virtualizer<any, any>) => void;
59
- interface VirtualizerOptions<TScrollElement extends unknown, TItemElement extends Element> {
60
- count: number;
61
- getScrollElement: () => TScrollElement | null;
62
- estimateSize: (index: number) => number;
63
- scrollToFn: (offset: number, options: {
64
- canSmooth: boolean;
65
- sync: boolean;
66
- }, instance: Virtualizer<TScrollElement, TItemElement>) => void;
67
- observeElementRect: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (rect: Rect) => void) => void | (() => void);
68
- observeElementOffset: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (offset: number) => void) => void | (() => void);
69
- debug?: any;
70
- initialRect?: Rect;
71
- onChange?: (instance: Virtualizer<TScrollElement, TItemElement>) => void;
72
- measureElement?: (el: TItemElement, instance: Virtualizer<TScrollElement, TItemElement>) => number;
73
- overscan?: number;
74
- horizontal?: boolean;
75
- paddingStart?: number;
76
- paddingEnd?: number;
77
- scrollPaddingStart?: number;
78
- scrollPaddingEnd?: number;
79
- initialOffset?: number;
80
- getItemKey?: (index: number) => Key;
81
- rangeExtractor?: (range: Range) => number[];
82
- enableSmoothScroll?: boolean;
83
- scrollMargin?: number;
84
- scrollingDelay?: number;
85
- indexAttribute?: string;
86
- }
87
- declare class Virtualizer<TScrollElement extends unknown, TItemElement extends Element> {
88
- private unsubs;
89
- options: Required<VirtualizerOptions<TScrollElement, TItemElement>>;
90
- scrollElement: TScrollElement | null;
91
- isScrolling: boolean;
92
- private isScrollingTimeoutId;
93
- measurementsCache: VirtualItem[];
94
- private itemMeasurementsCache;
95
- private pendingMeasuredCacheIndexes;
96
- private scrollRect;
97
- private scrollOffset;
98
- private scrollDelta;
99
- private destinationOffset;
100
- private scrollCheckFrame;
101
- private measureElementCache;
102
- private getResizeObserver;
103
- range: {
104
- startIndex: number;
105
- endIndex: number;
106
- };
107
- constructor(opts: VirtualizerOptions<TScrollElement, TItemElement>);
108
- setOptions: (opts: VirtualizerOptions<TScrollElement, TItemElement>) => void;
109
- private notify;
110
- private cleanup;
111
- _didMount: () => () => void;
112
- _willUpdate: () => void;
113
- private getSize;
114
- private getMeasurements;
115
- calculateRange: () => {
116
- startIndex: number;
117
- endIndex: number;
118
- };
119
- private getIndexes;
120
- indexFromElement: (node: TItemElement) => number;
121
- private _measureElement;
122
- measureElement: (node: TItemElement | null) => void;
123
- getVirtualItems: () => VirtualItem[];
124
- scrollToOffset: (toOffset: number, { align, smoothScroll, }?: ScrollToOffsetOptions) => void;
125
- scrollToIndex: (index: number, { align, smoothScroll, ...rest }?: ScrollToIndexOptions) => void;
126
- getTotalSize: () => number;
127
- private _scrollToOffset;
128
- measure: () => void;
129
- }
130
-
131
- export { NoInfer, PartialKeys, Range, ScrollToOptions, VirtualItem, Virtualizer, VirtualizerOptions, defaultKeyExtractor, defaultRangeExtractor, elementScroll, measureElement, memo, observeElementOffset, observeElementRect, observeWindowOffset, observeWindowRect, windowScroll };