@tanstack/virtual-core 3.0.0-beta.10 → 3.0.0-beta.12
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-html.html → stats.html} +1 -1
- package/build/stats.json +101 -0
- package/build/types/index.d.ts +107 -0
- package/package.json +2 -2
|
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
|
|
|
2669
2669
|
</script>
|
|
2670
2670
|
<script>
|
|
2671
2671
|
/*<!--*/
|
|
2672
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"node_modules/@reach/observe-rect/dist/observe-rect.esm.js","uid":"
|
|
2672
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"node_modules/@reach/observe-rect/dist/observe-rect.esm.js","uid":"b160-1"},{"name":"packages/virtual-core/src","children":[{"uid":"b160-3","name":"utils.ts"},{"uid":"b160-5","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"b160-1":{"renderedLength":1732,"gzipLength":652,"brotliLength":0,"mainUid":"b160-0"},"b160-3":{"renderedLength":1432,"gzipLength":544,"brotliLength":0,"mainUid":"b160-2"},"b160-5":{"renderedLength":13712,"gzipLength":3162,"brotliLength":0,"mainUid":"b160-4"}},"nodeMetas":{"b160-0":{"id":"/node_modules/@reach/observe-rect/dist/observe-rect.esm.js","moduleParts":{"index.production.js":"b160-1"},"imported":[],"importedBy":[{"uid":"b160-4"}]},"b160-2":{"id":"/packages/virtual-core/src/utils.ts","moduleParts":{"index.production.js":"b160-3"},"imported":[],"importedBy":[{"uid":"b160-4"}]},"b160-4":{"id":"/packages/virtual-core/src/index.ts","moduleParts":{"index.production.js":"b160-5"},"imported":[{"uid":"b160-0"},{"uid":"b160-2"}],"importedBy":[],"isEntry":true}},"env":{"rollup":"2.75.4"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
2673
2673
|
|
|
2674
2674
|
const run = () => {
|
|
2675
2675
|
const width = window.innerWidth;
|
package/build/stats.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"tree": {
|
|
4
|
+
"name": "root",
|
|
5
|
+
"children": [
|
|
6
|
+
{
|
|
7
|
+
"name": "index.production.js",
|
|
8
|
+
"children": [
|
|
9
|
+
{
|
|
10
|
+
"name": "node_modules/@reach/observe-rect/dist/observe-rect.esm.js",
|
|
11
|
+
"uid": "b160-7"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "packages/virtual-core/src",
|
|
15
|
+
"children": [
|
|
16
|
+
{
|
|
17
|
+
"uid": "b160-9",
|
|
18
|
+
"name": "utils.ts"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"uid": "b160-11",
|
|
22
|
+
"name": "index.ts"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"isRoot": true
|
|
30
|
+
},
|
|
31
|
+
"nodeParts": {
|
|
32
|
+
"b160-7": {
|
|
33
|
+
"renderedLength": 1732,
|
|
34
|
+
"gzipLength": 652,
|
|
35
|
+
"brotliLength": 0,
|
|
36
|
+
"mainUid": "b160-6"
|
|
37
|
+
},
|
|
38
|
+
"b160-9": {
|
|
39
|
+
"renderedLength": 1432,
|
|
40
|
+
"gzipLength": 544,
|
|
41
|
+
"brotliLength": 0,
|
|
42
|
+
"mainUid": "b160-8"
|
|
43
|
+
},
|
|
44
|
+
"b160-11": {
|
|
45
|
+
"renderedLength": 13712,
|
|
46
|
+
"gzipLength": 3162,
|
|
47
|
+
"brotliLength": 0,
|
|
48
|
+
"mainUid": "b160-10"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"nodeMetas": {
|
|
52
|
+
"b160-6": {
|
|
53
|
+
"id": "/node_modules/@reach/observe-rect/dist/observe-rect.esm.js",
|
|
54
|
+
"moduleParts": {
|
|
55
|
+
"index.production.js": "b160-7"
|
|
56
|
+
},
|
|
57
|
+
"imported": [],
|
|
58
|
+
"importedBy": [
|
|
59
|
+
{
|
|
60
|
+
"uid": "b160-10"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"b160-8": {
|
|
65
|
+
"id": "/packages/virtual-core/src/utils.ts",
|
|
66
|
+
"moduleParts": {
|
|
67
|
+
"index.production.js": "b160-9"
|
|
68
|
+
},
|
|
69
|
+
"imported": [],
|
|
70
|
+
"importedBy": [
|
|
71
|
+
{
|
|
72
|
+
"uid": "b160-10"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"b160-10": {
|
|
77
|
+
"id": "/packages/virtual-core/src/index.ts",
|
|
78
|
+
"moduleParts": {
|
|
79
|
+
"index.production.js": "b160-11"
|
|
80
|
+
},
|
|
81
|
+
"imported": [
|
|
82
|
+
{
|
|
83
|
+
"uid": "b160-6"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"uid": "b160-8"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"importedBy": [],
|
|
90
|
+
"isEntry": true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"env": {
|
|
94
|
+
"rollup": "2.75.4"
|
|
95
|
+
},
|
|
96
|
+
"options": {
|
|
97
|
+
"gzip": true,
|
|
98
|
+
"brotli": false,
|
|
99
|
+
"sourcemap": false
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
}
|
|
23
|
+
declare type ScrollToOffsetOptions = ScrollToOptions;
|
|
24
|
+
declare type ScrollToIndexOptions = ScrollToOptions;
|
|
25
|
+
interface Range {
|
|
26
|
+
startIndex: number;
|
|
27
|
+
endIndex: number;
|
|
28
|
+
overscan: number;
|
|
29
|
+
count: number;
|
|
30
|
+
}
|
|
31
|
+
declare type Key = number | string;
|
|
32
|
+
interface Item {
|
|
33
|
+
key: Key;
|
|
34
|
+
index: number;
|
|
35
|
+
start: number;
|
|
36
|
+
end: number;
|
|
37
|
+
size: number;
|
|
38
|
+
}
|
|
39
|
+
interface Rect {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}
|
|
43
|
+
interface VirtualItem<TItemElement> extends Item {
|
|
44
|
+
measureElement: (el: TItemElement | null) => void;
|
|
45
|
+
}
|
|
46
|
+
declare const defaultKeyExtractor: (index: number) => number;
|
|
47
|
+
declare const defaultRangeExtractor: (range: Range) => number[];
|
|
48
|
+
declare const observeElementRect: (instance: Virtualizer<any, any>, cb: (rect: Rect) => void) => (() => void) | undefined;
|
|
49
|
+
declare const observeWindowRect: (instance: Virtualizer<any, any>, cb: (rect: Rect) => void) => (() => void) | undefined;
|
|
50
|
+
declare const observeElementOffset: (instance: Virtualizer<any, any>, cb: (offset: number) => void) => (() => void) | undefined;
|
|
51
|
+
declare const observeWindowOffset: (instance: Virtualizer<any, any>, cb: (offset: number) => void) => (() => void) | undefined;
|
|
52
|
+
declare const measureElement: (element: unknown, instance: Virtualizer<any, any>) => number;
|
|
53
|
+
declare const windowScroll: (offset: number, canSmooth: boolean, instance: Virtualizer<any, any>) => void;
|
|
54
|
+
declare const elementScroll: (offset: number, canSmooth: boolean, instance: Virtualizer<any, any>) => void;
|
|
55
|
+
interface VirtualizerOptions<TScrollElement = unknown, TItemElement = unknown> {
|
|
56
|
+
count: number;
|
|
57
|
+
getScrollElement: () => TScrollElement;
|
|
58
|
+
estimateSize: (index: number) => number;
|
|
59
|
+
scrollToFn: (offset: number, canSmooth: boolean, instance: Virtualizer<TScrollElement, TItemElement>) => void;
|
|
60
|
+
observeElementRect: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (rect: Rect) => void) => void | (() => void);
|
|
61
|
+
observeElementOffset: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (offset: number) => void) => void | (() => void);
|
|
62
|
+
debug?: any;
|
|
63
|
+
initialRect?: Rect;
|
|
64
|
+
onChange?: (instance: Virtualizer<TScrollElement, TItemElement>) => void;
|
|
65
|
+
measureElement?: (el: TItemElement, instance: Virtualizer<TScrollElement, TItemElement>) => number;
|
|
66
|
+
overscan?: number;
|
|
67
|
+
horizontal?: boolean;
|
|
68
|
+
paddingStart?: number;
|
|
69
|
+
paddingEnd?: number;
|
|
70
|
+
scrollPaddingStart?: number;
|
|
71
|
+
scrollPaddingEnd?: number;
|
|
72
|
+
initialOffset?: number;
|
|
73
|
+
getItemKey?: (index: number) => Key;
|
|
74
|
+
rangeExtractor?: (range: Range) => number[];
|
|
75
|
+
enableSmoothScroll?: boolean;
|
|
76
|
+
}
|
|
77
|
+
declare class Virtualizer<TScrollElement = unknown, TItemElement = unknown> {
|
|
78
|
+
private unsubs;
|
|
79
|
+
options: Required<VirtualizerOptions<TScrollElement, TItemElement>>;
|
|
80
|
+
scrollElement: TScrollElement | null;
|
|
81
|
+
private measurementsCache;
|
|
82
|
+
private itemMeasurementsCache;
|
|
83
|
+
private pendingMeasuredCacheIndexes;
|
|
84
|
+
private scrollRect;
|
|
85
|
+
private scrollOffset;
|
|
86
|
+
private destinationOffset;
|
|
87
|
+
private scrollCheckFrame;
|
|
88
|
+
private measureElementCache;
|
|
89
|
+
constructor(opts: VirtualizerOptions<TScrollElement, TItemElement>);
|
|
90
|
+
setOptions: (opts: VirtualizerOptions<TScrollElement, TItemElement>) => void;
|
|
91
|
+
private notify;
|
|
92
|
+
private cleanup;
|
|
93
|
+
_didMount: () => () => void;
|
|
94
|
+
_willUpdate: () => void;
|
|
95
|
+
private getSize;
|
|
96
|
+
private getMeasurements;
|
|
97
|
+
private calculateRange;
|
|
98
|
+
private getIndexes;
|
|
99
|
+
getVirtualItems: () => VirtualItem<TItemElement>[];
|
|
100
|
+
scrollToOffset: (toOffset: number, { align }?: ScrollToOffsetOptions) => void;
|
|
101
|
+
scrollToIndex: (index: number, { align, ...rest }?: ScrollToIndexOptions) => void;
|
|
102
|
+
getTotalSize: () => number;
|
|
103
|
+
private _scrollToOffset;
|
|
104
|
+
measure: () => void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { NoInfer, PartialKeys, Range, ScrollToOptions, VirtualItem, Virtualizer, VirtualizerOptions, defaultKeyExtractor, defaultRangeExtractor, elementScroll, measureElement, memo, observeElementOffset, observeElementRect, observeWindowOffset, observeWindowRect, windowScroll };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/virtual-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.12",
|
|
5
5
|
"description": "Headless UI for virtualizing scrollable elements in TS/JS + Frameworks",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/tanstack/virtual#readme",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"node": ">=12"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
|
-
"build",
|
|
36
|
+
"build/*",
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|