@react-stately/virtualizer 3.7.2-nightly.4649 → 3.7.2-nightly.4654

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 (55) hide show
  1. package/dist/Layout.main.js +2 -41
  2. package/dist/Layout.main.js.map +1 -1
  3. package/dist/Layout.mjs +2 -41
  4. package/dist/Layout.module.js +2 -41
  5. package/dist/Layout.module.js.map +1 -1
  6. package/dist/LayoutInfo.main.js.map +1 -1
  7. package/dist/LayoutInfo.module.js.map +1 -1
  8. package/dist/OverscanManager.main.js +8 -43
  9. package/dist/OverscanManager.main.js.map +1 -1
  10. package/dist/OverscanManager.mjs +8 -43
  11. package/dist/OverscanManager.module.js +8 -43
  12. package/dist/OverscanManager.module.js.map +1 -1
  13. package/dist/ReusableView.main.js +23 -0
  14. package/dist/ReusableView.main.js.map +1 -1
  15. package/dist/ReusableView.mjs +23 -0
  16. package/dist/ReusableView.module.js +23 -0
  17. package/dist/ReusableView.module.js.map +1 -1
  18. package/dist/Virtualizer.main.js +123 -710
  19. package/dist/Virtualizer.main.js.map +1 -1
  20. package/dist/Virtualizer.mjs +124 -711
  21. package/dist/Virtualizer.module.js +124 -711
  22. package/dist/Virtualizer.module.js.map +1 -1
  23. package/dist/types.d.ts +64 -225
  24. package/dist/types.d.ts.map +1 -1
  25. package/dist/useVirtualizerState.main.js +39 -40
  26. package/dist/useVirtualizerState.main.js.map +1 -1
  27. package/dist/useVirtualizerState.mjs +40 -41
  28. package/dist/useVirtualizerState.module.js +40 -41
  29. package/dist/useVirtualizerState.module.js.map +1 -1
  30. package/dist/utils.main.js +1 -27
  31. package/dist/utils.main.js.map +1 -1
  32. package/dist/utils.mjs +2 -26
  33. package/dist/utils.module.js +2 -26
  34. package/dist/utils.module.js.map +1 -1
  35. package/package.json +4 -4
  36. package/src/Layout.ts +10 -55
  37. package/src/LayoutInfo.ts +2 -2
  38. package/src/OverscanManager.ts +10 -47
  39. package/src/ReusableView.ts +36 -7
  40. package/src/Virtualizer.ts +163 -1058
  41. package/src/types.ts +16 -38
  42. package/src/useVirtualizerState.ts +40 -39
  43. package/src/utils.ts +0 -52
  44. package/dist/Transaction.main.js +0 -32
  45. package/dist/Transaction.main.js.map +0 -1
  46. package/dist/Transaction.mjs +0 -27
  47. package/dist/Transaction.module.js +0 -27
  48. package/dist/Transaction.module.js.map +0 -1
  49. package/dist/tween.main.js +0 -67
  50. package/dist/tween.main.js.map +0 -1
  51. package/dist/tween.mjs +0 -61
  52. package/dist/tween.module.js +0 -61
  53. package/dist/tween.module.js.map +0 -1
  54. package/src/Transaction.ts +0 -28
  55. 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
- }