@react-stately/virtualizer 3.6.9-nightly.4555 → 3.6.9-nightly.4560

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 (66) hide show
  1. package/dist/Layout.main.js +75 -0
  2. package/dist/Layout.main.js.map +1 -0
  3. package/dist/Layout.mjs +70 -0
  4. package/dist/Layout.module.js +70 -0
  5. package/dist/Layout.module.js.map +1 -0
  6. package/dist/LayoutInfo.main.js +51 -0
  7. package/dist/LayoutInfo.main.js.map +1 -0
  8. package/dist/LayoutInfo.mjs +46 -0
  9. package/dist/LayoutInfo.module.js +46 -0
  10. package/dist/LayoutInfo.module.js.map +1 -0
  11. package/dist/OverscanManager.main.js +87 -0
  12. package/dist/OverscanManager.main.js.map +1 -0
  13. package/dist/OverscanManager.mjs +82 -0
  14. package/dist/OverscanManager.module.js +82 -0
  15. package/dist/OverscanManager.module.js.map +1 -0
  16. package/dist/Point.main.js +40 -0
  17. package/dist/Point.main.js.map +1 -0
  18. package/dist/Point.mjs +35 -0
  19. package/dist/Point.module.js +35 -0
  20. package/dist/Point.module.js.map +1 -0
  21. package/dist/Rect.main.js +130 -0
  22. package/dist/Rect.main.js.map +1 -0
  23. package/dist/Rect.mjs +125 -0
  24. package/dist/Rect.module.js +125 -0
  25. package/dist/Rect.module.js.map +1 -0
  26. package/dist/ReusableView.main.js +33 -0
  27. package/dist/ReusableView.main.js.map +1 -0
  28. package/dist/ReusableView.mjs +28 -0
  29. package/dist/ReusableView.module.js +28 -0
  30. package/dist/ReusableView.module.js.map +1 -0
  31. package/dist/Size.main.js +40 -0
  32. package/dist/Size.main.js.map +1 -0
  33. package/dist/Size.mjs +35 -0
  34. package/dist/Size.module.js +35 -0
  35. package/dist/Size.module.js.map +1 -0
  36. package/dist/Transaction.main.js +32 -0
  37. package/dist/Transaction.main.js.map +1 -0
  38. package/dist/Transaction.mjs +27 -0
  39. package/dist/Transaction.module.js +27 -0
  40. package/dist/Transaction.module.js.map +1 -0
  41. package/dist/Virtualizer.main.js +813 -0
  42. package/dist/Virtualizer.main.js.map +1 -0
  43. package/dist/Virtualizer.mjs +808 -0
  44. package/dist/Virtualizer.module.js +808 -0
  45. package/dist/Virtualizer.module.js.map +1 -0
  46. package/dist/import.mjs +7 -1399
  47. package/dist/main.js +14 -1406
  48. package/dist/main.js.map +1 -1
  49. package/dist/module.js +7 -1399
  50. package/dist/module.js.map +1 -1
  51. package/dist/tween.main.js +67 -0
  52. package/dist/tween.main.js.map +1 -0
  53. package/dist/tween.mjs +61 -0
  54. package/dist/tween.module.js +61 -0
  55. package/dist/tween.module.js.map +1 -0
  56. package/dist/useVirtualizerState.main.js +96 -0
  57. package/dist/useVirtualizerState.main.js.map +1 -0
  58. package/dist/useVirtualizerState.mjs +91 -0
  59. package/dist/useVirtualizerState.module.js +91 -0
  60. package/dist/useVirtualizerState.module.js.map +1 -0
  61. package/dist/utils.main.js +53 -0
  62. package/dist/utils.main.js.map +1 -0
  63. package/dist/utils.mjs +46 -0
  64. package/dist/utils.module.js +46 -0
  65. package/dist/utils.module.js.map +1 -0
  66. package/package.json +4 -4
@@ -0,0 +1,75 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "Layout", () => $ac14d65a0ec196dd$export$c84671f46d6a1ca);
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ class $ac14d65a0ec196dd$export$c84671f46d6a1ca {
18
+ /**
19
+ * Returns whether the layout should invalidate in response to
20
+ * visible rectangle changes. By default, it only invalidates
21
+ * when the collection view's size changes. Return true always
22
+ * to make the layout invalidate while scrolling (e.g. sticky headers).
23
+ */ shouldInvalidate(newRect, oldRect) {
24
+ // By default, invalidate when the size changes
25
+ return newRect.width !== oldRect.width || newRect.height !== oldRect.height;
26
+ }
27
+ /**
28
+ * This method allows the layout to perform any pre-computation
29
+ * it needs to in order to prepare {@link LayoutInfo}s for retrieval.
30
+ * Called by the collection view before {@link getVisibleLayoutInfos}
31
+ * or {@link getLayoutInfo} are called.
32
+ */ validate(invalidationContext) {}
33
+ /**
34
+ * Returns a {@link DragTarget} describing a view at the given point to be dragged.
35
+ * Return `null` to cancel the drag. The default implementation returns the view at the given point.
36
+ * @param point The point at which the drag occurred.
37
+ */ // getDragTarget(point: Point): DragTarget | null {
38
+ // let target = this.virtualizer.keyAtPoint(point);
39
+ // if (!target) {
40
+ // return null;
41
+ // }
42
+ // return {
43
+ // type: 'item',
44
+ // key: target
45
+ // };
46
+ // }
47
+ /**
48
+ * Returns a {@link DragTarget} object describing where a drop should occur. Return `null`
49
+ * to reject the drop. The dropped items will be inserted before the resulting target.
50
+ * @param point The point at which the drop occurred.
51
+ */ // getDropTarget(point: Point): DropTarget | null {
52
+ // return null;
53
+ // }
54
+ /**
55
+ * Returns the starting attributes for an animated insertion.
56
+ * The view is animated from this {@link LayoutInfo} to the one returned by {@link getLayoutInfo}.
57
+ * The default implementation just returns its input.
58
+ *
59
+ * @param layoutInfo The proposed LayoutInfo for this view.
60
+ */ getInitialLayoutInfo(layoutInfo) {
61
+ return layoutInfo;
62
+ }
63
+ /**
64
+ * Returns the ending attributes for an animated removal.
65
+ * The view is animated from the {@link LayoutInfo} returned by {@link getLayoutInfo}
66
+ * to the one returned by this method. The default implementation returns its input.
67
+ *
68
+ * @param layoutInfo The original LayoutInfo for this view.
69
+ */ getFinalLayoutInfo(layoutInfo) {
70
+ return layoutInfo;
71
+ }
72
+ }
73
+
74
+
75
+ //# sourceMappingURL=Layout.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAwBM,MAAe;IAIpB;;;;;GAKC,GACD,iBAAiB,OAAa,EAAE,OAAa,EAAW;QACtD,+CAA+C;QAC/C,OAAO,QAAQ,KAAK,KAAK,QAAQ,KAAK,IAC/B,QAAQ,MAAM,KAAK,QAAQ,MAAM;IAC1C;IAEA;;;;;GAKC,GACD,SAAS,mBAAgD,EAAE,CAAC;IAqB5D;;;;GAIC,GACD,mDAAmD;IACnD,qDAAqD;IACrD,mBAAmB;IACnB,mBAAmB;IACnB,MAAM;IAEN,aAAa;IACb,oBAAoB;IACpB,kBAAkB;IAClB,OAAO;IACP,IAAI;IAEJ;;;;GAIC,GACD,mDAAmD;IACnD,iBAAiB;IACjB,IAAI;IAEJ;;;;;;GAMC,GACD,qBAAqB,UAAsB,EAAc;QACvD,OAAO;IACT;IAEA;;;;;;GAMC,GACD,mBAAmB,UAAsB,EAAc;QACrD,OAAO;IACT;AACF","sources":["packages/@react-stately/virtualizer/src/Layout.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {InvalidationContext} from './types';\nimport {Key} from '@react-types/shared';\nimport {LayoutInfo} from './LayoutInfo';\n// import {Point} from './Point';\nimport {Rect} from './Rect';\nimport {Size} from './Size';\nimport {Virtualizer} from './Virtualizer';\n// import { DragTarget, DropTarget } from '@react-types/shared';\n\n/**\n * [CollectionView]{@link CollectionView} supports arbitrary layout objects, which compute what views are visible, and how\n * to position and style them. However, layouts do not create the views themselves directly. Instead,\n * layouts produce lightweight {@link LayoutInfo} objects which describe various properties of a view,\n * such as its position and size. The {@link CollectionView} is then responsible for creating the actual\n * views as needed, based on this layout information.\n *\n * Every layout extends from the {@link Layout} abstract base class. Layouts must implement a minimum of the\n * two methods listed below. All other methods can be optionally overridden to implement custom behavior.\n *\n * @see {@link getVisibleLayoutInfos}\n * @see {@link getLayoutInfo}\n */\nexport abstract class Layout<T extends object> {\n /** The CollectionView the layout is currently attached to. */\n virtualizer: Virtualizer<T, any, any>;\n\n /**\n * Returns whether the layout should invalidate in response to\n * visible rectangle changes. By default, it only invalidates\n * when the collection view's size changes. Return true always\n * to make the layout invalidate while scrolling (e.g. sticky headers).\n */\n shouldInvalidate(newRect: Rect, oldRect: Rect): boolean {\n // By default, invalidate when the size changes\n return newRect.width !== oldRect.width\n || newRect.height !== oldRect.height;\n }\n\n /**\n * This method allows the layout to perform any pre-computation\n * it needs to in order to prepare {@link LayoutInfo}s for retrieval.\n * Called by the collection view before {@link getVisibleLayoutInfos}\n * or {@link getLayoutInfo} are called.\n */\n validate(invalidationContext: InvalidationContext<T, any>) {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\n /**\n * Returns an array of {@link LayoutInfo} objects which are inside the given rectangle.\n * Should be implemented by subclasses.\n * @param rect The rectangle that should contain the returned LayoutInfo objects.\n */\n abstract getVisibleLayoutInfos(rect: Rect): LayoutInfo[];\n\n /**\n * Returns a {@link LayoutInfo} for the given key.\n * Should be implemented by subclasses.\n * @param key The key of the LayoutInfo to retrieve.\n */\n abstract getLayoutInfo(key: Key): LayoutInfo;\n\n /**\n * Returns size of the content. By default, it returns collectionView's size.\n */\n abstract getContentSize(): Size;\n\n /**\n * Returns a {@link DragTarget} describing a view at the given point to be dragged.\n * Return `null` to cancel the drag. The default implementation returns the view at the given point.\n * @param point The point at which the drag occurred.\n */\n // getDragTarget(point: Point): DragTarget | null {\n // let target = this.virtualizer.keyAtPoint(point);\n // if (!target) {\n // return null;\n // }\n\n // return {\n // type: 'item',\n // key: target\n // };\n // }\n\n /**\n * Returns a {@link DragTarget} object describing where a drop should occur. Return `null`\n * to reject the drop. The dropped items will be inserted before the resulting target.\n * @param point The point at which the drop occurred.\n */\n // getDropTarget(point: Point): DropTarget | null {\n // return null;\n // }\n\n /**\n * Returns the starting attributes for an animated insertion.\n * The view is animated from this {@link LayoutInfo} to the one returned by {@link getLayoutInfo}.\n * The default implementation just returns its input.\n *\n * @param layoutInfo The proposed LayoutInfo for this view.\n */\n getInitialLayoutInfo(layoutInfo: LayoutInfo): LayoutInfo {\n return layoutInfo;\n }\n\n /**\n * Returns the ending attributes for an animated removal.\n * The view is animated from the {@link LayoutInfo} returned by {@link getLayoutInfo}\n * to the one returned by this method. The default implementation returns its input.\n *\n * @param layoutInfo The original LayoutInfo for this view.\n */\n getFinalLayoutInfo(layoutInfo: LayoutInfo): LayoutInfo {\n return layoutInfo;\n }\n}\n"],"names":[],"version":3,"file":"Layout.main.js.map"}
@@ -0,0 +1,70 @@
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
+ */ class $c74cda7d31af1253$export$c84671f46d6a1ca {
12
+ /**
13
+ * Returns whether the layout should invalidate in response to
14
+ * visible rectangle changes. By default, it only invalidates
15
+ * when the collection view's size changes. Return true always
16
+ * to make the layout invalidate while scrolling (e.g. sticky headers).
17
+ */ shouldInvalidate(newRect, oldRect) {
18
+ // By default, invalidate when the size changes
19
+ return newRect.width !== oldRect.width || newRect.height !== oldRect.height;
20
+ }
21
+ /**
22
+ * This method allows the layout to perform any pre-computation
23
+ * it needs to in order to prepare {@link LayoutInfo}s for retrieval.
24
+ * Called by the collection view before {@link getVisibleLayoutInfos}
25
+ * or {@link getLayoutInfo} are called.
26
+ */ validate(invalidationContext) {}
27
+ /**
28
+ * Returns a {@link DragTarget} describing a view at the given point to be dragged.
29
+ * Return `null` to cancel the drag. The default implementation returns the view at the given point.
30
+ * @param point The point at which the drag occurred.
31
+ */ // getDragTarget(point: Point): DragTarget | null {
32
+ // let target = this.virtualizer.keyAtPoint(point);
33
+ // if (!target) {
34
+ // return null;
35
+ // }
36
+ // return {
37
+ // type: 'item',
38
+ // key: target
39
+ // };
40
+ // }
41
+ /**
42
+ * Returns a {@link DragTarget} object describing where a drop should occur. Return `null`
43
+ * to reject the drop. The dropped items will be inserted before the resulting target.
44
+ * @param point The point at which the drop occurred.
45
+ */ // getDropTarget(point: Point): DropTarget | null {
46
+ // return null;
47
+ // }
48
+ /**
49
+ * Returns the starting attributes for an animated insertion.
50
+ * The view is animated from this {@link LayoutInfo} to the one returned by {@link getLayoutInfo}.
51
+ * The default implementation just returns its input.
52
+ *
53
+ * @param layoutInfo The proposed LayoutInfo for this view.
54
+ */ getInitialLayoutInfo(layoutInfo) {
55
+ return layoutInfo;
56
+ }
57
+ /**
58
+ * Returns the ending attributes for an animated removal.
59
+ * The view is animated from the {@link LayoutInfo} returned by {@link getLayoutInfo}
60
+ * to the one returned by this method. The default implementation returns its input.
61
+ *
62
+ * @param layoutInfo The original LayoutInfo for this view.
63
+ */ getFinalLayoutInfo(layoutInfo) {
64
+ return layoutInfo;
65
+ }
66
+ }
67
+
68
+
69
+ export {$c74cda7d31af1253$export$c84671f46d6a1ca as Layout};
70
+ //# sourceMappingURL=Layout.mjs.map
@@ -0,0 +1,70 @@
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
+ */ class $c74cda7d31af1253$export$c84671f46d6a1ca {
12
+ /**
13
+ * Returns whether the layout should invalidate in response to
14
+ * visible rectangle changes. By default, it only invalidates
15
+ * when the collection view's size changes. Return true always
16
+ * to make the layout invalidate while scrolling (e.g. sticky headers).
17
+ */ shouldInvalidate(newRect, oldRect) {
18
+ // By default, invalidate when the size changes
19
+ return newRect.width !== oldRect.width || newRect.height !== oldRect.height;
20
+ }
21
+ /**
22
+ * This method allows the layout to perform any pre-computation
23
+ * it needs to in order to prepare {@link LayoutInfo}s for retrieval.
24
+ * Called by the collection view before {@link getVisibleLayoutInfos}
25
+ * or {@link getLayoutInfo} are called.
26
+ */ validate(invalidationContext) {}
27
+ /**
28
+ * Returns a {@link DragTarget} describing a view at the given point to be dragged.
29
+ * Return `null` to cancel the drag. The default implementation returns the view at the given point.
30
+ * @param point The point at which the drag occurred.
31
+ */ // getDragTarget(point: Point): DragTarget | null {
32
+ // let target = this.virtualizer.keyAtPoint(point);
33
+ // if (!target) {
34
+ // return null;
35
+ // }
36
+ // return {
37
+ // type: 'item',
38
+ // key: target
39
+ // };
40
+ // }
41
+ /**
42
+ * Returns a {@link DragTarget} object describing where a drop should occur. Return `null`
43
+ * to reject the drop. The dropped items will be inserted before the resulting target.
44
+ * @param point The point at which the drop occurred.
45
+ */ // getDropTarget(point: Point): DropTarget | null {
46
+ // return null;
47
+ // }
48
+ /**
49
+ * Returns the starting attributes for an animated insertion.
50
+ * The view is animated from this {@link LayoutInfo} to the one returned by {@link getLayoutInfo}.
51
+ * The default implementation just returns its input.
52
+ *
53
+ * @param layoutInfo The proposed LayoutInfo for this view.
54
+ */ getInitialLayoutInfo(layoutInfo) {
55
+ return layoutInfo;
56
+ }
57
+ /**
58
+ * Returns the ending attributes for an animated removal.
59
+ * The view is animated from the {@link LayoutInfo} returned by {@link getLayoutInfo}
60
+ * to the one returned by this method. The default implementation returns its input.
61
+ *
62
+ * @param layoutInfo The original LayoutInfo for this view.
63
+ */ getFinalLayoutInfo(layoutInfo) {
64
+ return layoutInfo;
65
+ }
66
+ }
67
+
68
+
69
+ export {$c74cda7d31af1253$export$c84671f46d6a1ca as Layout};
70
+ //# sourceMappingURL=Layout.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAwBM,MAAe;IAIpB;;;;;GAKC,GACD,iBAAiB,OAAa,EAAE,OAAa,EAAW;QACtD,+CAA+C;QAC/C,OAAO,QAAQ,KAAK,KAAK,QAAQ,KAAK,IAC/B,QAAQ,MAAM,KAAK,QAAQ,MAAM;IAC1C;IAEA;;;;;GAKC,GACD,SAAS,mBAAgD,EAAE,CAAC;IAqB5D;;;;GAIC,GACD,mDAAmD;IACnD,qDAAqD;IACrD,mBAAmB;IACnB,mBAAmB;IACnB,MAAM;IAEN,aAAa;IACb,oBAAoB;IACpB,kBAAkB;IAClB,OAAO;IACP,IAAI;IAEJ;;;;GAIC,GACD,mDAAmD;IACnD,iBAAiB;IACjB,IAAI;IAEJ;;;;;;GAMC,GACD,qBAAqB,UAAsB,EAAc;QACvD,OAAO;IACT;IAEA;;;;;;GAMC,GACD,mBAAmB,UAAsB,EAAc;QACrD,OAAO;IACT;AACF","sources":["packages/@react-stately/virtualizer/src/Layout.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {InvalidationContext} from './types';\nimport {Key} from '@react-types/shared';\nimport {LayoutInfo} from './LayoutInfo';\n// import {Point} from './Point';\nimport {Rect} from './Rect';\nimport {Size} from './Size';\nimport {Virtualizer} from './Virtualizer';\n// import { DragTarget, DropTarget } from '@react-types/shared';\n\n/**\n * [CollectionView]{@link CollectionView} supports arbitrary layout objects, which compute what views are visible, and how\n * to position and style them. However, layouts do not create the views themselves directly. Instead,\n * layouts produce lightweight {@link LayoutInfo} objects which describe various properties of a view,\n * such as its position and size. The {@link CollectionView} is then responsible for creating the actual\n * views as needed, based on this layout information.\n *\n * Every layout extends from the {@link Layout} abstract base class. Layouts must implement a minimum of the\n * two methods listed below. All other methods can be optionally overridden to implement custom behavior.\n *\n * @see {@link getVisibleLayoutInfos}\n * @see {@link getLayoutInfo}\n */\nexport abstract class Layout<T extends object> {\n /** The CollectionView the layout is currently attached to. */\n virtualizer: Virtualizer<T, any, any>;\n\n /**\n * Returns whether the layout should invalidate in response to\n * visible rectangle changes. By default, it only invalidates\n * when the collection view's size changes. Return true always\n * to make the layout invalidate while scrolling (e.g. sticky headers).\n */\n shouldInvalidate(newRect: Rect, oldRect: Rect): boolean {\n // By default, invalidate when the size changes\n return newRect.width !== oldRect.width\n || newRect.height !== oldRect.height;\n }\n\n /**\n * This method allows the layout to perform any pre-computation\n * it needs to in order to prepare {@link LayoutInfo}s for retrieval.\n * Called by the collection view before {@link getVisibleLayoutInfos}\n * or {@link getLayoutInfo} are called.\n */\n validate(invalidationContext: InvalidationContext<T, any>) {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\n /**\n * Returns an array of {@link LayoutInfo} objects which are inside the given rectangle.\n * Should be implemented by subclasses.\n * @param rect The rectangle that should contain the returned LayoutInfo objects.\n */\n abstract getVisibleLayoutInfos(rect: Rect): LayoutInfo[];\n\n /**\n * Returns a {@link LayoutInfo} for the given key.\n * Should be implemented by subclasses.\n * @param key The key of the LayoutInfo to retrieve.\n */\n abstract getLayoutInfo(key: Key): LayoutInfo;\n\n /**\n * Returns size of the content. By default, it returns collectionView's size.\n */\n abstract getContentSize(): Size;\n\n /**\n * Returns a {@link DragTarget} describing a view at the given point to be dragged.\n * Return `null` to cancel the drag. The default implementation returns the view at the given point.\n * @param point The point at which the drag occurred.\n */\n // getDragTarget(point: Point): DragTarget | null {\n // let target = this.virtualizer.keyAtPoint(point);\n // if (!target) {\n // return null;\n // }\n\n // return {\n // type: 'item',\n // key: target\n // };\n // }\n\n /**\n * Returns a {@link DragTarget} object describing where a drop should occur. Return `null`\n * to reject the drop. The dropped items will be inserted before the resulting target.\n * @param point The point at which the drop occurred.\n */\n // getDropTarget(point: Point): DropTarget | null {\n // return null;\n // }\n\n /**\n * Returns the starting attributes for an animated insertion.\n * The view is animated from this {@link LayoutInfo} to the one returned by {@link getLayoutInfo}.\n * The default implementation just returns its input.\n *\n * @param layoutInfo The proposed LayoutInfo for this view.\n */\n getInitialLayoutInfo(layoutInfo: LayoutInfo): LayoutInfo {\n return layoutInfo;\n }\n\n /**\n * Returns the ending attributes for an animated removal.\n * The view is animated from the {@link LayoutInfo} returned by {@link getLayoutInfo}\n * to the one returned by this method. The default implementation returns its input.\n *\n * @param layoutInfo The original LayoutInfo for this view.\n */\n getFinalLayoutInfo(layoutInfo: LayoutInfo): LayoutInfo {\n return layoutInfo;\n }\n}\n"],"names":[],"version":3,"file":"Layout.module.js.map"}
@@ -0,0 +1,51 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "LayoutInfo", () => $8a899922c0a55745$export$7e0eeb9da702a085);
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ class $8a899922c0a55745$export$7e0eeb9da702a085 {
18
+ /**
19
+ * Returns a copy of the LayoutInfo.
20
+ */ copy() {
21
+ let res = new $8a899922c0a55745$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
22
+ res.estimatedSize = this.estimatedSize;
23
+ res.opacity = this.opacity;
24
+ res.transform = this.transform;
25
+ res.parentKey = this.parentKey;
26
+ res.isSticky = this.isSticky;
27
+ res.zIndex = this.zIndex;
28
+ res.allowOverflow = this.allowOverflow;
29
+ return res;
30
+ }
31
+ /**
32
+ * @param type A string representing the view type. Should be `'item'` for item views.
33
+ Other types are used by supplementary views.
34
+ * @param key The unique key for this view.
35
+ * @param rect The rectangle describing the size and position of this view.
36
+ */ constructor(type, key, rect){
37
+ this.type = type;
38
+ this.key = key;
39
+ this.parentKey = null;
40
+ this.rect = rect;
41
+ this.estimatedSize = false;
42
+ this.isSticky = false;
43
+ this.opacity = 1;
44
+ this.transform = null;
45
+ this.zIndex = 0;
46
+ this.allowOverflow = false;
47
+ }
48
+ }
49
+
50
+
51
+ //# sourceMappingURL=LayoutInfo.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAWM,MAAM;IAwEX;;GAEC,GACD,OAAmB;QACjB,IAAI,MAAM,IAAI,0CAAW,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;QAC5D,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa;QACtC,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO;QAC1B,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS;QAC9B,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS;QAC9B,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ;QAC5B,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM;QACxB,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa;QACtC,OAAO;IACT;IAhCA;;;;;GAKC,GACD,YAAY,IAAY,EAAE,GAAQ,EAAE,IAAU,CAAE;QAC9C,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,SAAS,GAAG;QACjB,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,aAAa,GAAG;QACrB,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,SAAS,GAAG;QACjB,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,aAAa,GAAG;IACvB;AAgBF","sources":["packages/@react-stately/virtualizer/src/LayoutInfo.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key} from '@react-types/shared';\nimport {Rect} from './Rect';\n\n/**\n * Instances of this lightweight class are created by {@link Layout} subclasses\n * to represent each view in the {@link CollectionView}. LayoutInfo objects describe\n * various properties of a view, such as its position and size, and style information.\n * The collection view uses this information when creating actual views to display.\n */\nexport class LayoutInfo {\n /**\n * A string representing the view type. Should be `'item'` for item views.\n * Other types are used by supplementary views.\n */\n type: string;\n\n /**\n * A unique key for this view. For item views, it should match the content key.\n */\n key: Key;\n\n /**\n * The key for a parent layout info, if any.\n */\n parentKey: Key | null;\n\n /**\n * The rectangle describing the size and position of this view.\n */\n rect: Rect;\n\n /**\n * Whether the size is estimated. `false` by default.\n */\n estimatedSize: boolean;\n\n /**\n * Whether the layout info sticks to the viewport when scrolling.\n */\n isSticky: boolean;\n\n /**\n * The view's opacity. 1 by default.\n */\n opacity: number;\n\n /**\n * A CSS transform string to apply to the view. `null` by default.\n */\n transform: string | null;\n\n /**\n * The z-index of the view. 0 by default.\n */\n zIndex: number;\n\n /**\n * Whether the layout info allows its contents to overflow its container.\n * @default false\n */\n allowOverflow: boolean;\n\n /**\n * @param type A string representing the view type. Should be `'item'` for item views.\n Other types are used by supplementary views.\n * @param key The unique key for this view.\n * @param rect The rectangle describing the size and position of this view.\n */\n constructor(type: string, key: Key, rect: Rect) {\n this.type = type;\n this.key = key;\n this.parentKey = null;\n this.rect = rect;\n this.estimatedSize = false;\n this.isSticky = false;\n this.opacity = 1;\n this.transform = null;\n this.zIndex = 0;\n this.allowOverflow = false;\n }\n\n /**\n * Returns a copy of the LayoutInfo.\n */\n copy(): LayoutInfo {\n let res = new LayoutInfo(this.type, this.key, this.rect.copy());\n res.estimatedSize = this.estimatedSize;\n res.opacity = this.opacity;\n res.transform = this.transform;\n res.parentKey = this.parentKey;\n res.isSticky = this.isSticky;\n res.zIndex = this.zIndex;\n res.allowOverflow = this.allowOverflow;\n return res;\n }\n}\n"],"names":[],"version":3,"file":"LayoutInfo.main.js.map"}
@@ -0,0 +1,46 @@
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
+ */ class $d7fd61009c21d0bb$export$7e0eeb9da702a085 {
12
+ /**
13
+ * Returns a copy of the LayoutInfo.
14
+ */ copy() {
15
+ let res = new $d7fd61009c21d0bb$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
16
+ res.estimatedSize = this.estimatedSize;
17
+ res.opacity = this.opacity;
18
+ res.transform = this.transform;
19
+ res.parentKey = this.parentKey;
20
+ res.isSticky = this.isSticky;
21
+ res.zIndex = this.zIndex;
22
+ res.allowOverflow = this.allowOverflow;
23
+ return res;
24
+ }
25
+ /**
26
+ * @param type A string representing the view type. Should be `'item'` for item views.
27
+ Other types are used by supplementary views.
28
+ * @param key The unique key for this view.
29
+ * @param rect The rectangle describing the size and position of this view.
30
+ */ constructor(type, key, rect){
31
+ this.type = type;
32
+ this.key = key;
33
+ this.parentKey = null;
34
+ this.rect = rect;
35
+ this.estimatedSize = false;
36
+ this.isSticky = false;
37
+ this.opacity = 1;
38
+ this.transform = null;
39
+ this.zIndex = 0;
40
+ this.allowOverflow = false;
41
+ }
42
+ }
43
+
44
+
45
+ export {$d7fd61009c21d0bb$export$7e0eeb9da702a085 as LayoutInfo};
46
+ //# sourceMappingURL=LayoutInfo.mjs.map
@@ -0,0 +1,46 @@
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
+ */ class $d7fd61009c21d0bb$export$7e0eeb9da702a085 {
12
+ /**
13
+ * Returns a copy of the LayoutInfo.
14
+ */ copy() {
15
+ let res = new $d7fd61009c21d0bb$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
16
+ res.estimatedSize = this.estimatedSize;
17
+ res.opacity = this.opacity;
18
+ res.transform = this.transform;
19
+ res.parentKey = this.parentKey;
20
+ res.isSticky = this.isSticky;
21
+ res.zIndex = this.zIndex;
22
+ res.allowOverflow = this.allowOverflow;
23
+ return res;
24
+ }
25
+ /**
26
+ * @param type A string representing the view type. Should be `'item'` for item views.
27
+ Other types are used by supplementary views.
28
+ * @param key The unique key for this view.
29
+ * @param rect The rectangle describing the size and position of this view.
30
+ */ constructor(type, key, rect){
31
+ this.type = type;
32
+ this.key = key;
33
+ this.parentKey = null;
34
+ this.rect = rect;
35
+ this.estimatedSize = false;
36
+ this.isSticky = false;
37
+ this.opacity = 1;
38
+ this.transform = null;
39
+ this.zIndex = 0;
40
+ this.allowOverflow = false;
41
+ }
42
+ }
43
+
44
+
45
+ export {$d7fd61009c21d0bb$export$7e0eeb9da702a085 as LayoutInfo};
46
+ //# sourceMappingURL=LayoutInfo.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAWM,MAAM;IAwEX;;GAEC,GACD,OAAmB;QACjB,IAAI,MAAM,IAAI,0CAAW,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;QAC5D,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa;QACtC,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO;QAC1B,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS;QAC9B,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS;QAC9B,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ;QAC5B,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM;QACxB,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa;QACtC,OAAO;IACT;IAhCA;;;;;GAKC,GACD,YAAY,IAAY,EAAE,GAAQ,EAAE,IAAU,CAAE;QAC9C,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,SAAS,GAAG;QACjB,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,aAAa,GAAG;QACrB,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,SAAS,GAAG;QACjB,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,aAAa,GAAG;IACvB;AAgBF","sources":["packages/@react-stately/virtualizer/src/LayoutInfo.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key} from '@react-types/shared';\nimport {Rect} from './Rect';\n\n/**\n * Instances of this lightweight class are created by {@link Layout} subclasses\n * to represent each view in the {@link CollectionView}. LayoutInfo objects describe\n * various properties of a view, such as its position and size, and style information.\n * The collection view uses this information when creating actual views to display.\n */\nexport class LayoutInfo {\n /**\n * A string representing the view type. Should be `'item'` for item views.\n * Other types are used by supplementary views.\n */\n type: string;\n\n /**\n * A unique key for this view. For item views, it should match the content key.\n */\n key: Key;\n\n /**\n * The key for a parent layout info, if any.\n */\n parentKey: Key | null;\n\n /**\n * The rectangle describing the size and position of this view.\n */\n rect: Rect;\n\n /**\n * Whether the size is estimated. `false` by default.\n */\n estimatedSize: boolean;\n\n /**\n * Whether the layout info sticks to the viewport when scrolling.\n */\n isSticky: boolean;\n\n /**\n * The view's opacity. 1 by default.\n */\n opacity: number;\n\n /**\n * A CSS transform string to apply to the view. `null` by default.\n */\n transform: string | null;\n\n /**\n * The z-index of the view. 0 by default.\n */\n zIndex: number;\n\n /**\n * Whether the layout info allows its contents to overflow its container.\n * @default false\n */\n allowOverflow: boolean;\n\n /**\n * @param type A string representing the view type. Should be `'item'` for item views.\n Other types are used by supplementary views.\n * @param key The unique key for this view.\n * @param rect The rectangle describing the size and position of this view.\n */\n constructor(type: string, key: Key, rect: Rect) {\n this.type = type;\n this.key = key;\n this.parentKey = null;\n this.rect = rect;\n this.estimatedSize = false;\n this.isSticky = false;\n this.opacity = 1;\n this.transform = null;\n this.zIndex = 0;\n this.allowOverflow = false;\n }\n\n /**\n * Returns a copy of the LayoutInfo.\n */\n copy(): LayoutInfo {\n let res = new LayoutInfo(this.type, this.key, this.rect.copy());\n res.estimatedSize = this.estimatedSize;\n res.opacity = this.opacity;\n res.transform = this.transform;\n res.parentKey = this.parentKey;\n res.isSticky = this.isSticky;\n res.zIndex = this.zIndex;\n res.allowOverflow = this.allowOverflow;\n return res;\n }\n}\n"],"names":[],"version":3,"file":"LayoutInfo.module.js.map"}
@@ -0,0 +1,87 @@
1
+ var $f89f15d7f52bce29$exports = require("./Point.main.js");
2
+ var $41b7691783731623$exports = require("./Rect.main.js");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "OverscanManager", () => $191a033606d4fda1$export$4455ee6afb38dcbb);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ class $191a033606d4fda1$var$RollingAverage {
23
+ addSample(sample) {
24
+ this.count++;
25
+ this.value += (sample - this.value) / this.count;
26
+ }
27
+ constructor(){
28
+ this.count = 0;
29
+ this.value = 0;
30
+ }
31
+ }
32
+ class $191a033606d4fda1$export$4455ee6afb38dcbb {
33
+ setVisibleRect(rect) {
34
+ let time = performance.now() - this.startTime;
35
+ if (time < 500) {
36
+ this.averageTime.addSample(time);
37
+ if (rect.x !== this.visibleRect.x && time > 0) this.velocity.x = (rect.x - this.visibleRect.x) / time;
38
+ if (rect.y !== this.visibleRect.y && time > 0) this.velocity.y = (rect.y - this.visibleRect.y) / time;
39
+ }
40
+ this.startTime = performance.now();
41
+ this.visibleRect = rect;
42
+ }
43
+ collectMetrics() {
44
+ let time = performance.now() - this.startTime;
45
+ if (time < 500) this.averagePerf.addSample(time);
46
+ if (this.visibleRect.height > 0) {
47
+ let o = Math.abs(this.velocity.y * (this.averageTime.value + this.averagePerf.value));
48
+ this.overscanY.addSample(o);
49
+ }
50
+ if (this.visibleRect.width > 0) {
51
+ let o = Math.abs(this.velocity.x * (this.averageTime.value + this.averagePerf.value));
52
+ this.overscanX.addSample(o);
53
+ }
54
+ }
55
+ getOverscannedRect() {
56
+ let overscanned = this.visibleRect.copy();
57
+ let overscanY = Math.round(Math.min(this.visibleRect.height * 2, this.overscanY.value) / 100) * 100;
58
+ if (this.velocity.y > 0) {
59
+ overscanned.y -= overscanY * 0.2;
60
+ overscanned.height += overscanY + overscanY * 0.2;
61
+ } else {
62
+ overscanned.y -= overscanY;
63
+ overscanned.height += overscanY + overscanY * 0.2;
64
+ }
65
+ let overscanX = Math.round(Math.min(this.visibleRect.width * 2, this.overscanX.value) / 100) * 100;
66
+ if (this.velocity.x > 0) {
67
+ overscanned.x -= overscanX * 0.2;
68
+ overscanned.width += overscanX + overscanX * 0.2;
69
+ } else {
70
+ overscanned.x -= overscanX;
71
+ overscanned.width += overscanX + overscanX * 0.2;
72
+ }
73
+ return overscanned;
74
+ }
75
+ constructor(){
76
+ this.startTime = 0;
77
+ this.averagePerf = new $191a033606d4fda1$var$RollingAverage();
78
+ this.averageTime = new $191a033606d4fda1$var$RollingAverage();
79
+ this.velocity = new (0, $f89f15d7f52bce29$exports.Point)(5, 5);
80
+ this.overscanX = new $191a033606d4fda1$var$RollingAverage();
81
+ this.overscanY = new $191a033606d4fda1$var$RollingAverage();
82
+ this.visibleRect = new (0, $41b7691783731623$exports.Rect)();
83
+ }
84
+ }
85
+
86
+
87
+ //# sourceMappingURL=OverscanManager.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"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","sources":["packages/@react-stately/virtualizer/src/OverscanManager.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Point} from './Point';\nimport {Rect} from './Rect';\n\nclass RollingAverage {\n private count: number = 0;\n value: number = 0;\n \n addSample(sample: number) {\n this.count++;\n this.value += (sample - this.value) / this.count;\n }\n}\n\nexport class OverscanManager {\n private startTime = 0;\n private averagePerf = new RollingAverage();\n private averageTime = new RollingAverage();\n private velocity = new Point(5, 5);\n private overscanX = new RollingAverage();\n private overscanY = new RollingAverage();\n private visibleRect = new Rect();\n \n setVisibleRect(rect: Rect) {\n let time = performance.now() - this.startTime;\n if (time < 500) {\n this.averageTime.addSample(time);\n\n if (rect.x !== this.visibleRect.x && time > 0) {\n this.velocity.x = (rect.x - this.visibleRect.x) / time;\n }\n\n if (rect.y !== this.visibleRect.y && time > 0) {\n this.velocity.y = (rect.y - this.visibleRect.y) / time;\n }\n }\n\n this.startTime = performance.now();\n this.visibleRect = rect;\n }\n\n collectMetrics() {\n let time = performance.now() - this.startTime;\n if (time < 500) {\n this.averagePerf.addSample(time);\n }\n\n if (this.visibleRect.height > 0) {\n let o = Math.abs(this.velocity.y * (this.averageTime.value + this.averagePerf.value)); \n this.overscanY.addSample(o);\n }\n\n if (this.visibleRect.width > 0) {\n let o = Math.abs(this.velocity.x * (this.averageTime.value + this.averagePerf.value)); \n this.overscanX.addSample(o);\n }\n }\n\n getOverscannedRect() {\n let overscanned = this.visibleRect.copy();\n\n let overscanY = Math.round(Math.min(this.visibleRect.height * 2, this.overscanY.value) / 100) * 100;\n if (this.velocity.y > 0) {\n overscanned.y -= overscanY * 0.2;\n overscanned.height += overscanY + overscanY * 0.2;\n } else {\n overscanned.y -= overscanY;\n overscanned.height += overscanY + overscanY * 0.2;\n }\n\n let overscanX = Math.round(Math.min(this.visibleRect.width * 2, this.overscanX.value) / 100) * 100;\n if (this.velocity.x > 0) {\n overscanned.x -= overscanX * 0.2;\n overscanned.width += overscanX + overscanX * 0.2;\n } else {\n overscanned.x -= overscanX;\n overscanned.width += overscanX + overscanX * 0.2;\n }\n\n return overscanned;\n }\n}\n"],"names":[],"version":3,"file":"OverscanManager.main.js.map"}
@@ -0,0 +1,82 @@
1
+ import {Point as $3041db3296945e6e$export$baf26146a414f24a} from "./Point.mjs";
2
+ import {Rect as $60423f92c7f9ad87$export$c79fc6492f3af13d} from "./Rect.mjs";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ class $364191b3decf3697$var$RollingAverage {
17
+ addSample(sample) {
18
+ this.count++;
19
+ this.value += (sample - this.value) / this.count;
20
+ }
21
+ constructor(){
22
+ this.count = 0;
23
+ this.value = 0;
24
+ }
25
+ }
26
+ class $364191b3decf3697$export$4455ee6afb38dcbb {
27
+ setVisibleRect(rect) {
28
+ let time = performance.now() - this.startTime;
29
+ if (time < 500) {
30
+ this.averageTime.addSample(time);
31
+ if (rect.x !== this.visibleRect.x && time > 0) this.velocity.x = (rect.x - this.visibleRect.x) / time;
32
+ if (rect.y !== this.visibleRect.y && time > 0) this.velocity.y = (rect.y - this.visibleRect.y) / time;
33
+ }
34
+ this.startTime = performance.now();
35
+ this.visibleRect = rect;
36
+ }
37
+ collectMetrics() {
38
+ let time = performance.now() - this.startTime;
39
+ if (time < 500) this.averagePerf.addSample(time);
40
+ if (this.visibleRect.height > 0) {
41
+ let o = Math.abs(this.velocity.y * (this.averageTime.value + this.averagePerf.value));
42
+ this.overscanY.addSample(o);
43
+ }
44
+ if (this.visibleRect.width > 0) {
45
+ let o = Math.abs(this.velocity.x * (this.averageTime.value + this.averagePerf.value));
46
+ this.overscanX.addSample(o);
47
+ }
48
+ }
49
+ getOverscannedRect() {
50
+ let overscanned = this.visibleRect.copy();
51
+ let overscanY = Math.round(Math.min(this.visibleRect.height * 2, this.overscanY.value) / 100) * 100;
52
+ if (this.velocity.y > 0) {
53
+ overscanned.y -= overscanY * 0.2;
54
+ overscanned.height += overscanY + overscanY * 0.2;
55
+ } else {
56
+ overscanned.y -= overscanY;
57
+ overscanned.height += overscanY + overscanY * 0.2;
58
+ }
59
+ let overscanX = Math.round(Math.min(this.visibleRect.width * 2, this.overscanX.value) / 100) * 100;
60
+ if (this.velocity.x > 0) {
61
+ overscanned.x -= overscanX * 0.2;
62
+ overscanned.width += overscanX + overscanX * 0.2;
63
+ } else {
64
+ overscanned.x -= overscanX;
65
+ overscanned.width += overscanX + overscanX * 0.2;
66
+ }
67
+ return overscanned;
68
+ }
69
+ constructor(){
70
+ this.startTime = 0;
71
+ this.averagePerf = new $364191b3decf3697$var$RollingAverage();
72
+ this.averageTime = new $364191b3decf3697$var$RollingAverage();
73
+ this.velocity = new (0, $3041db3296945e6e$export$baf26146a414f24a)(5, 5);
74
+ this.overscanX = new $364191b3decf3697$var$RollingAverage();
75
+ this.overscanY = new $364191b3decf3697$var$RollingAverage();
76
+ this.visibleRect = new (0, $60423f92c7f9ad87$export$c79fc6492f3af13d)();
77
+ }
78
+ }
79
+
80
+
81
+ export {$364191b3decf3697$export$4455ee6afb38dcbb as OverscanManager};
82
+ //# sourceMappingURL=OverscanManager.mjs.map