@react-stately/virtualizer 3.7.2-nightly.4649 → 3.7.2-nightly.4656
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/dist/Layout.main.js +2 -41
- package/dist/Layout.main.js.map +1 -1
- package/dist/Layout.mjs +2 -41
- package/dist/Layout.module.js +2 -41
- package/dist/Layout.module.js.map +1 -1
- package/dist/LayoutInfo.main.js.map +1 -1
- package/dist/LayoutInfo.module.js.map +1 -1
- package/dist/OverscanManager.main.js +8 -43
- package/dist/OverscanManager.main.js.map +1 -1
- package/dist/OverscanManager.mjs +8 -43
- package/dist/OverscanManager.module.js +8 -43
- package/dist/OverscanManager.module.js.map +1 -1
- package/dist/ReusableView.main.js +23 -0
- package/dist/ReusableView.main.js.map +1 -1
- package/dist/ReusableView.mjs +23 -0
- package/dist/ReusableView.module.js +23 -0
- package/dist/ReusableView.module.js.map +1 -1
- package/dist/Virtualizer.main.js +123 -710
- package/dist/Virtualizer.main.js.map +1 -1
- package/dist/Virtualizer.mjs +124 -711
- package/dist/Virtualizer.module.js +124 -711
- package/dist/Virtualizer.module.js.map +1 -1
- package/dist/types.d.ts +64 -225
- package/dist/types.d.ts.map +1 -1
- package/dist/useVirtualizerState.main.js +39 -40
- package/dist/useVirtualizerState.main.js.map +1 -1
- package/dist/useVirtualizerState.mjs +40 -41
- package/dist/useVirtualizerState.module.js +40 -41
- package/dist/useVirtualizerState.module.js.map +1 -1
- package/dist/utils.main.js +1 -27
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +2 -26
- package/dist/utils.module.js +2 -26
- package/dist/utils.module.js.map +1 -1
- package/package.json +4 -4
- package/src/Layout.ts +10 -55
- package/src/LayoutInfo.ts +2 -2
- package/src/OverscanManager.ts +10 -47
- package/src/ReusableView.ts +36 -7
- package/src/Virtualizer.ts +163 -1058
- package/src/types.ts +16 -38
- package/src/useVirtualizerState.ts +40 -39
- package/src/utils.ts +0 -52
- package/dist/Transaction.main.js +0 -32
- package/dist/Transaction.main.js.map +0 -1
- package/dist/Transaction.mjs +0 -27
- package/dist/Transaction.module.js +0 -27
- package/dist/Transaction.module.js.map +0 -1
- package/dist/tween.main.js +0 -67
- package/dist/tween.main.js.map +0 -1
- package/dist/tween.mjs +0 -61
- package/dist/tween.module.js +0 -61
- package/dist/tween.module.js.map +0 -1
- package/src/Transaction.ts +0 -28
- package/src/tween.ts +0 -83
package/src/tween.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {Point} from './Point';
|
|
14
|
-
|
|
15
|
-
// use high res timer if available
|
|
16
|
-
let perf = typeof window !== 'undefined' ? window.performance : null;
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
let perfNow = perf && (perf.now || perf.webkitNow || perf.msNow || perf.mozNow);
|
|
19
|
-
let getTime = perfNow ? perfNow.bind(perf) : function () {
|
|
20
|
-
return Date.now ? Date.now() : new Date().getTime();
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
let fixTs: boolean;
|
|
24
|
-
|
|
25
|
-
export interface CancelablePromise<T> extends Promise<T> {
|
|
26
|
-
cancel(): void
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function tween(begin, end, duration, ease, fn): CancelablePromise<void> {
|
|
30
|
-
let canceled = false;
|
|
31
|
-
let raf_id: number;
|
|
32
|
-
|
|
33
|
-
let promise = new Promise(resolve => {
|
|
34
|
-
let start = getTime();
|
|
35
|
-
let diffX = end.x - begin.x;
|
|
36
|
-
let diffY = end.y - begin.y;
|
|
37
|
-
|
|
38
|
-
raf_id = requestAnimationFrame(function run(t) {
|
|
39
|
-
// if we're using a high res timer, make sure timestamp is not the old epoch-based value.
|
|
40
|
-
// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision
|
|
41
|
-
if (fixTs == null) {
|
|
42
|
-
fixTs = t > 1e12 !== getTime() > 1e12;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (fixTs) {
|
|
46
|
-
t = getTime();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// check if we're done
|
|
50
|
-
let delta = t - start;
|
|
51
|
-
if (delta > duration) {
|
|
52
|
-
fn(end);
|
|
53
|
-
resolve();
|
|
54
|
-
} else {
|
|
55
|
-
// call frame callback after computing eased time and get the next frame
|
|
56
|
-
let proceed = fn(new Point(
|
|
57
|
-
begin.x + diffX * ease(delta / duration),
|
|
58
|
-
begin.y + diffY * ease(delta / duration)
|
|
59
|
-
));
|
|
60
|
-
|
|
61
|
-
if (proceed !== false && !canceled) {
|
|
62
|
-
raf_id = requestAnimationFrame(run);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}) as CancelablePromise<void>;
|
|
67
|
-
|
|
68
|
-
promise.cancel = function () {
|
|
69
|
-
canceled = true;
|
|
70
|
-
cancelAnimationFrame(raf_id);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
return promise;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// easing functions
|
|
77
|
-
export function linearEasing(t) {
|
|
78
|
-
return t;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function easeOut(t) {
|
|
82
|
-
return Math.sin(t * Math.PI / 2);
|
|
83
|
-
}
|