@tanstack/virtual-core 3.0.0-beta.30 → 3.0.0-beta.33
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/lib/_virtual/_rollupPluginBabelHelpers.esm.js +27 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +1 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js +31 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +27 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -0
- package/build/lib/index.d.ts +12 -8
- package/build/lib/index.esm.js +421 -399
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +421 -399
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +421 -399
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/utils.esm.js +15 -16
- package/build/lib/utils.esm.js.map +1 -1
- package/build/lib/utils.js +15 -16
- package/build/lib/utils.js.map +1 -1
- package/build/lib/utils.mjs +15 -16
- package/build/lib/utils.mjs.map +1 -1
- package/build/umd/index.development.js +450 -415
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +97 -66
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
function _extends() {
|
|
12
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
+
var source = arguments[i];
|
|
15
|
+
for (var key in source) {
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
17
|
+
target[key] = source[key];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
};
|
|
23
|
+
return _extends.apply(this, arguments);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { _extends as extends };
|
|
27
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
function _extends() {
|
|
16
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
17
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
18
|
+
var source = arguments[i];
|
|
19
|
+
for (var key in source) {
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
21
|
+
target[key] = source[key];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return target;
|
|
26
|
+
};
|
|
27
|
+
return _extends.apply(this, arguments);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports["extends"] = _extends;
|
|
31
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
function _extends() {
|
|
12
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
+
var source = arguments[i];
|
|
15
|
+
for (var key in source) {
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
17
|
+
target[key] = source[key];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
};
|
|
23
|
+
return _extends.apply(this, arguments);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { _extends as extends };
|
|
27
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './utils';
|
|
2
|
+
type ScrollDirection = 'forward' | 'backward';
|
|
2
3
|
type ScrollAlignment = 'start' | 'center' | 'end' | 'auto';
|
|
3
4
|
type ScrollBehavior = 'auto' | 'smooth';
|
|
4
5
|
export interface ScrollToOptions {
|
|
@@ -32,15 +33,13 @@ export declare const observeWindowRect: (instance: Virtualizer<any, any>, cb: (r
|
|
|
32
33
|
export declare const observeElementOffset: (instance: Virtualizer<any, any>, cb: (offset: number) => void) => (() => void) | undefined;
|
|
33
34
|
export declare const observeWindowOffset: (instance: Virtualizer<any, any>, cb: (offset: number) => void) => (() => void) | undefined;
|
|
34
35
|
export declare const measureElement: <TItemElement extends Element>(element: TItemElement, instance: Virtualizer<any, TItemElement>) => number;
|
|
35
|
-
export declare const windowScroll: <T extends Window>(offset: number, { adjustments, behavior,
|
|
36
|
+
export declare const windowScroll: <T extends Window>(offset: number, { adjustments, behavior, }: {
|
|
36
37
|
adjustments?: number | undefined;
|
|
37
38
|
behavior?: ScrollBehavior | undefined;
|
|
38
|
-
sync: boolean;
|
|
39
39
|
}, instance: Virtualizer<T, any>) => void;
|
|
40
|
-
export declare const elementScroll: <T extends Element>(offset: number, { adjustments, behavior,
|
|
40
|
+
export declare const elementScroll: <T extends Element>(offset: number, { adjustments, behavior, }: {
|
|
41
41
|
adjustments?: number | undefined;
|
|
42
42
|
behavior?: ScrollBehavior | undefined;
|
|
43
|
-
sync: boolean;
|
|
44
43
|
}, instance: Virtualizer<T, any>) => void;
|
|
45
44
|
export interface VirtualizerOptions<TScrollElement extends Element | Window, TItemElement extends Element> {
|
|
46
45
|
count: number;
|
|
@@ -49,7 +48,6 @@ export interface VirtualizerOptions<TScrollElement extends Element | Window, TIt
|
|
|
49
48
|
scrollToFn: (offset: number, options: {
|
|
50
49
|
adjustments?: number;
|
|
51
50
|
behavior?: ScrollBehavior;
|
|
52
|
-
sync: boolean;
|
|
53
51
|
}, instance: Virtualizer<TScrollElement, TItemElement>) => void;
|
|
54
52
|
observeElementRect: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (rect: Rect) => void) => void | (() => void);
|
|
55
53
|
observeElementOffset: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (offset: number) => void) => void | (() => void);
|
|
@@ -69,6 +67,7 @@ export interface VirtualizerOptions<TScrollElement extends Element | Window, TIt
|
|
|
69
67
|
scrollMargin?: number;
|
|
70
68
|
scrollingDelay?: number;
|
|
71
69
|
indexAttribute?: string;
|
|
70
|
+
initialMeasurementsCache?: VirtualItem[];
|
|
72
71
|
}
|
|
73
72
|
export declare class Virtualizer<TScrollElement extends Element | Window, TItemElement extends Element> {
|
|
74
73
|
private unsubs;
|
|
@@ -77,10 +76,11 @@ export declare class Virtualizer<TScrollElement extends Element | Window, TItemE
|
|
|
77
76
|
isScrolling: boolean;
|
|
78
77
|
private isScrollingTimeoutId;
|
|
79
78
|
measurementsCache: VirtualItem[];
|
|
80
|
-
private
|
|
79
|
+
private itemSizeCache;
|
|
81
80
|
private pendingMeasuredCacheIndexes;
|
|
82
81
|
private scrollRect;
|
|
83
|
-
|
|
82
|
+
scrollOffset: number;
|
|
83
|
+
scrollDirection: ScrollDirection | null;
|
|
84
84
|
private scrollAdjustments;
|
|
85
85
|
private measureElementCache;
|
|
86
86
|
private pendingScrollToIndexCallback;
|
|
@@ -106,8 +106,12 @@ export declare class Virtualizer<TScrollElement extends Element | Window, TItemE
|
|
|
106
106
|
private _measureElement;
|
|
107
107
|
measureElement: (node: TItemElement | null) => void;
|
|
108
108
|
getVirtualItems: () => VirtualItem[];
|
|
109
|
+
getOffsetForAlignment: (toOffset: number, align: ScrollAlignment) => number;
|
|
109
110
|
scrollToOffset: (toOffset: number, { align, behavior }?: ScrollToOffsetOptions) => void;
|
|
110
|
-
scrollToIndex: (index: number, { align,
|
|
111
|
+
scrollToIndex: (index: number, { align, behavior }?: ScrollToIndexOptions) => void;
|
|
112
|
+
scrollBy: (adjustments: number, options?: {
|
|
113
|
+
behavior: ScrollBehavior;
|
|
114
|
+
}) => void;
|
|
111
115
|
getTotalSize: () => number;
|
|
112
116
|
private _scrollToOffset;
|
|
113
117
|
measure: () => void;
|