@tanstack/virtual-core 3.0.0-beta.8 → 3.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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +27 -0
  3. package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +1 -0
  4. package/build/lib/_virtual/_rollupPluginBabelHelpers.js +31 -0
  5. package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  6. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +27 -0
  7. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -0
  8. package/build/lib/index.d.ts +126 -0
  9. package/build/lib/index.esm.js +639 -0
  10. package/build/lib/index.esm.js.map +1 -0
  11. package/build/lib/index.js +654 -0
  12. package/build/lib/index.js.map +1 -0
  13. package/build/lib/index.mjs +639 -0
  14. package/build/lib/index.mjs.map +1 -0
  15. package/build/lib/utils.d.ts +10 -0
  16. package/build/lib/utils.esm.js +58 -0
  17. package/build/lib/utils.esm.js.map +1 -0
  18. package/build/{cjs/packages/virtual-core/src → lib}/utils.js +28 -21
  19. package/build/lib/utils.js.map +1 -0
  20. package/build/lib/utils.mjs +58 -0
  21. package/build/lib/utils.mjs.map +1 -0
  22. package/build/umd/index.development.js +592 -454
  23. package/build/umd/index.development.js.map +1 -1
  24. package/build/umd/index.production.js +1 -1
  25. package/build/umd/index.production.js.map +1 -1
  26. package/package.json +16 -14
  27. package/src/index.ts +551 -244
  28. package/src/utils.ts +17 -5
  29. package/build/cjs/packages/virtual-core/src/index.js +0 -466
  30. package/build/cjs/packages/virtual-core/src/index.js.map +0 -1
  31. package/build/cjs/packages/virtual-core/src/utils.js.map +0 -1
  32. package/build/esm/index.js +0 -560
  33. package/build/esm/index.js.map +0 -1
  34. package/build/stats-html.html +0 -2689
  35. package/build/stats.json +0 -101
  36. package/build/types/index.d.ts +0 -88
  37. package/build/types/utils.d.ts +0 -7
package/build/stats.json DELETED
@@ -1,101 +0,0 @@
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": "27cd-7"
12
- },
13
- {
14
- "name": "packages/virtual-core/src",
15
- "children": [
16
- {
17
- "uid": "27cd-9",
18
- "name": "utils.ts"
19
- },
20
- {
21
- "uid": "27cd-11",
22
- "name": "index.ts"
23
- }
24
- ]
25
- }
26
- ]
27
- }
28
- ],
29
- "isRoot": true
30
- },
31
- "nodeParts": {
32
- "27cd-7": {
33
- "renderedLength": 1732,
34
- "gzipLength": 652,
35
- "brotliLength": 0,
36
- "mainUid": "27cd-6"
37
- },
38
- "27cd-9": {
39
- "renderedLength": 1432,
40
- "gzipLength": 544,
41
- "brotliLength": 0,
42
- "mainUid": "27cd-8"
43
- },
44
- "27cd-11": {
45
- "renderedLength": 12964,
46
- "gzipLength": 2877,
47
- "brotliLength": 0,
48
- "mainUid": "27cd-10"
49
- }
50
- },
51
- "nodeMetas": {
52
- "27cd-6": {
53
- "id": "/node_modules/@reach/observe-rect/dist/observe-rect.esm.js",
54
- "moduleParts": {
55
- "index.production.js": "27cd-7"
56
- },
57
- "imported": [],
58
- "importedBy": [
59
- {
60
- "uid": "27cd-10"
61
- }
62
- ]
63
- },
64
- "27cd-8": {
65
- "id": "/packages/virtual-core/src/utils.ts",
66
- "moduleParts": {
67
- "index.production.js": "27cd-9"
68
- },
69
- "imported": [],
70
- "importedBy": [
71
- {
72
- "uid": "27cd-10"
73
- }
74
- ]
75
- },
76
- "27cd-10": {
77
- "id": "/packages/virtual-core/src/index.ts",
78
- "moduleParts": {
79
- "index.production.js": "27cd-11"
80
- },
81
- "imported": [
82
- {
83
- "uid": "27cd-6"
84
- },
85
- {
86
- "uid": "27cd-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
- }
@@ -1,88 +0,0 @@
1
- export * from './utils';
2
- declare type ScrollAlignment = 'start' | 'center' | 'end' | 'auto';
3
- export interface ScrollToOptions {
4
- align: ScrollAlignment;
5
- }
6
- declare type ScrollToOffsetOptions = ScrollToOptions;
7
- declare type ScrollToIndexOptions = ScrollToOptions;
8
- export interface Range {
9
- startIndex: number;
10
- endIndex: number;
11
- overscan: number;
12
- count: number;
13
- }
14
- declare type Key = number | string;
15
- interface Item {
16
- key: Key;
17
- index: number;
18
- start: number;
19
- end: number;
20
- size: number;
21
- }
22
- interface Rect {
23
- width: number;
24
- height: number;
25
- }
26
- export interface VirtualItem<TItemElement> extends Item {
27
- measureElement: (el: TItemElement | null) => void;
28
- }
29
- export declare const defaultKeyExtractor: (index: number) => number;
30
- export declare const defaultRangeExtractor: (range: Range) => number[];
31
- export declare const observeElementRect: (instance: Virtualizer<any, any>, cb: (rect: Rect) => void) => (() => void) | undefined;
32
- export declare const observeWindowRect: (instance: Virtualizer<any, any>, cb: (rect: Rect) => void) => (() => void) | undefined;
33
- export declare const observeElementOffset: (instance: Virtualizer<any, any>, cb: (offset: number) => void) => (() => void) | undefined;
34
- export declare const observeWindowOffset: (instance: Virtualizer<any, any>, cb: (offset: number) => void) => (() => void) | undefined;
35
- export declare const measureElement: (element: unknown, instance: Virtualizer<any, any>) => number;
36
- export declare const windowScroll: (offset: number, canSmooth: boolean, instance: Virtualizer<any, any>) => void;
37
- export declare const elementScroll: (offset: number, canSmooth: boolean, instance: Virtualizer<any, any>) => void;
38
- export interface VirtualizerOptions<TScrollElement = unknown, TItemElement = unknown> {
39
- count: number;
40
- getScrollElement: () => TScrollElement;
41
- estimateSize: (index: number) => number;
42
- scrollToFn: (offset: number, canSmooth: boolean, instance: Virtualizer<TScrollElement, TItemElement>) => void;
43
- observeElementRect: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (rect: Rect) => void) => void | (() => void);
44
- observeElementOffset: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (offset: number) => void) => void | (() => void);
45
- debug?: any;
46
- initialRect?: Rect;
47
- onChange?: (instance: Virtualizer<TScrollElement, TItemElement>) => void;
48
- measureElement?: (el: TItemElement, instance: Virtualizer<TScrollElement, TItemElement>) => number;
49
- overscan?: number;
50
- horizontal?: boolean;
51
- paddingStart?: number;
52
- paddingEnd?: number;
53
- scrollPaddingStart?: number;
54
- scrollPaddingEnd?: number;
55
- initialOffset?: number;
56
- getItemKey?: (index: number) => Key;
57
- rangeExtractor?: (range: Range) => number[];
58
- enableSmoothScroll?: boolean;
59
- }
60
- export declare class Virtualizer<TScrollElement = unknown, TItemElement = unknown> {
61
- private unsubs;
62
- options: Required<VirtualizerOptions<TScrollElement, TItemElement>>;
63
- scrollElement: TScrollElement | null;
64
- private measurementsCache;
65
- private itemMeasurementsCache;
66
- private pendingMeasuredCacheIndexes;
67
- private scrollRect;
68
- private scrollOffset;
69
- private destinationOffset;
70
- private scrollCheckFrame;
71
- private measureElementCache;
72
- constructor(opts: VirtualizerOptions<TScrollElement, TItemElement>);
73
- setOptions: (opts: VirtualizerOptions<TScrollElement, TItemElement>) => void;
74
- private notify;
75
- private cleanup;
76
- _didMount: () => () => void;
77
- _willUpdate: () => void;
78
- private getSize;
79
- private getMeasurements;
80
- private calculateRange;
81
- private getIndexes;
82
- getVirtualItems: () => VirtualItem<TItemElement>[];
83
- scrollToOffset: (toOffset: number, { align }?: ScrollToOffsetOptions) => void;
84
- scrollToIndex: (index: number, { align, ...rest }?: ScrollToIndexOptions) => void;
85
- getTotalSize: () => number;
86
- private _scrollToOffset;
87
- measure: () => void;
88
- }
@@ -1,7 +0,0 @@
1
- export declare type NoInfer<A extends any> = [A][A extends any ? 0 : never];
2
- export declare type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
3
- export declare function memo<TDeps extends readonly any[], TResult>(getDeps: () => [...TDeps], fn: (...args: NoInfer<[...TDeps]>) => TResult, opts: {
4
- key: any;
5
- debug?: () => any;
6
- onChange?: (result: TResult) => void;
7
- }): () => TResult;