@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.
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
@@ -18,7 +18,7 @@ $parcel$export(module.exports, "Layout", () => $ac14d65a0ec196dd$export$c84671f4
18
18
  /**
19
19
  * Returns whether the layout should invalidate in response to
20
20
  * visible rectangle changes. By default, it only invalidates
21
- * when the collection view's size changes. Return true always
21
+ * when the virtualizer's size changes. Return true always
22
22
  * to make the layout invalidate while scrolling (e.g. sticky headers).
23
23
  */ shouldInvalidate(newRect, oldRect) {
24
24
  // By default, invalidate when the size changes
@@ -27,48 +27,9 @@ $parcel$export(module.exports, "Layout", () => $ac14d65a0ec196dd$export$c84671f4
27
27
  /**
28
28
  * This method allows the layout to perform any pre-computation
29
29
  * it needs to in order to prepare {@link LayoutInfo}s for retrieval.
30
- * Called by the collection view before {@link getVisibleLayoutInfos}
30
+ * Called by the virtualizer before {@link getVisibleLayoutInfos}
31
31
  * or {@link getLayoutInfo} are called.
32
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
33
  }
73
34
 
74
35
 
@@ -1 +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"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAsBM,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,mBAA2C,EAAE,CAAC;AAyBzD","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';\nimport {Rect} from './Rect';\nimport {Size} from './Size';\nimport {Virtualizer} from './Virtualizer';\n\n/**\n * [Virtualizer]{@link Virtualizer} 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 Virtualizer} 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, O = any> {\n /** The Virtualizer 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 virtualizer'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 virtualizer before {@link getVisibleLayoutInfos}\n * or {@link getLayoutInfo} are called.\n */\n validate(invalidationContext: InvalidationContext<O>) {} // 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 * Updates the size of the given item.\n */\n updateItemSize?(key: Key, size: Size): boolean;\n}\n"],"names":[],"version":3,"file":"Layout.main.js.map"}
package/dist/Layout.mjs CHANGED
@@ -12,7 +12,7 @@
12
12
  /**
13
13
  * Returns whether the layout should invalidate in response to
14
14
  * visible rectangle changes. By default, it only invalidates
15
- * when the collection view's size changes. Return true always
15
+ * when the virtualizer's size changes. Return true always
16
16
  * to make the layout invalidate while scrolling (e.g. sticky headers).
17
17
  */ shouldInvalidate(newRect, oldRect) {
18
18
  // By default, invalidate when the size changes
@@ -21,48 +21,9 @@
21
21
  /**
22
22
  * This method allows the layout to perform any pre-computation
23
23
  * it needs to in order to prepare {@link LayoutInfo}s for retrieval.
24
- * Called by the collection view before {@link getVisibleLayoutInfos}
24
+ * Called by the virtualizer before {@link getVisibleLayoutInfos}
25
25
  * or {@link getLayoutInfo} are called.
26
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
27
  }
67
28
 
68
29
 
@@ -12,7 +12,7 @@
12
12
  /**
13
13
  * Returns whether the layout should invalidate in response to
14
14
  * visible rectangle changes. By default, it only invalidates
15
- * when the collection view's size changes. Return true always
15
+ * when the virtualizer's size changes. Return true always
16
16
  * to make the layout invalidate while scrolling (e.g. sticky headers).
17
17
  */ shouldInvalidate(newRect, oldRect) {
18
18
  // By default, invalidate when the size changes
@@ -21,48 +21,9 @@
21
21
  /**
22
22
  * This method allows the layout to perform any pre-computation
23
23
  * it needs to in order to prepare {@link LayoutInfo}s for retrieval.
24
- * Called by the collection view before {@link getVisibleLayoutInfos}
24
+ * Called by the virtualizer before {@link getVisibleLayoutInfos}
25
25
  * or {@link getLayoutInfo} are called.
26
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
27
  }
67
28
 
68
29
 
@@ -1 +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"}
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAsBM,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,mBAA2C,EAAE,CAAC;AAyBzD","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';\nimport {Rect} from './Rect';\nimport {Size} from './Size';\nimport {Virtualizer} from './Virtualizer';\n\n/**\n * [Virtualizer]{@link Virtualizer} 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 Virtualizer} 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, O = any> {\n /** The Virtualizer 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 virtualizer'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 virtualizer before {@link getVisibleLayoutInfos}\n * or {@link getLayoutInfo} are called.\n */\n validate(invalidationContext: InvalidationContext<O>) {} // 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 * Updates the size of the given item.\n */\n updateItemSize?(key: Key, size: Size): boolean;\n}\n"],"names":[],"version":3,"file":"Layout.module.js.map"}
@@ -1 +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"}
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 Virtualizer}. LayoutInfo objects describe\n * various properties of a view, such as its position and size, and style information.\n * The virtualizer 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"}
@@ -1 +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"}
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 Virtualizer}. LayoutInfo objects describe\n * various properties of a view, such as its position and size, and style information.\n * The virtualizer 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"}
@@ -19,66 +19,31 @@ $parcel$export(module.exports, "OverscanManager", () => $191a033606d4fda1$export
19
19
  * governing permissions and limitations under the License.
20
20
  */
21
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
22
  class $191a033606d4fda1$export$4455ee6afb38dcbb {
33
23
  setVisibleRect(rect) {
34
24
  let time = performance.now() - this.startTime;
35
25
  if (time < 500) {
36
- this.averageTime.addSample(time);
37
26
  if (rect.x !== this.visibleRect.x && time > 0) this.velocity.x = (rect.x - this.visibleRect.x) / time;
38
27
  if (rect.y !== this.visibleRect.y && time > 0) this.velocity.y = (rect.y - this.visibleRect.y) / time;
39
28
  }
40
29
  this.startTime = performance.now();
41
30
  this.visibleRect = rect;
42
31
  }
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
32
  getOverscannedRect() {
56
33
  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;
34
+ let overscanY = this.visibleRect.height / 3;
35
+ overscanned.height += overscanY;
36
+ if (this.velocity.y < 0) overscanned.y -= overscanY;
37
+ if (this.velocity.x !== 0) {
38
+ let overscanX = this.visibleRect.width / 3;
39
+ overscanned.width += overscanX;
40
+ if (this.velocity.x < 0) overscanned.x -= overscanX;
72
41
  }
73
42
  return overscanned;
74
43
  }
75
44
  constructor(){
76
45
  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();
46
+ this.velocity = new (0, $f89f15d7f52bce29$exports.Point)(0, 0);
82
47
  this.visibleRect = new (0, $41b7691783731623$exports.Rect)();
83
48
  }
84
49
  }
@@ -1 +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"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKM,MAAM;IAKX,eAAe,IAAU,EAAE;QACzB,IAAI,OAAO,YAAY,GAAG,KAAK,IAAI,CAAC,SAAS;QAC7C,IAAI,OAAO,KAAK;YACd,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,OAAO,GAC1C,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,AAAC,CAAA,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,AAAD,IAAK;YAGpD,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,OAAO,GAC1C,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,AAAC,CAAA,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,AAAD,IAAK;QAEtD;QAEA,IAAI,CAAC,SAAS,GAAG,YAAY,GAAG;QAChC,IAAI,CAAC,WAAW,GAAG;IACrB;IAEA,qBAAqB;QACnB,IAAI,cAAc,IAAI,CAAC,WAAW,CAAC,IAAI;QAEvC,IAAI,YAAY,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG;QAC1C,YAAY,MAAM,IAAI;QACtB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GACpB,YAAY,CAAC,IAAI;QAGnB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG;YACzB,IAAI,YAAY,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG;YACzC,YAAY,KAAK,IAAI;YACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GACpB,YAAY,CAAC,IAAI;QAErB;QAEA,OAAO;IACT;;aAtCQ,YAAY;aACZ,WAAW,IAAI,CAAA,GAAA,+BAAI,EAAE,GAAG;aACxB,cAAc,IAAI,CAAA,GAAA,8BAAG;;AAqC/B","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\nexport class OverscanManager {\n private startTime = 0;\n private velocity = new Point(0, 0);\n private visibleRect = new Rect();\n \n setVisibleRect(rect: Rect) {\n let time = performance.now() - this.startTime;\n if (time < 500) {\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 getOverscannedRect() {\n let overscanned = this.visibleRect.copy();\n\n let overscanY = this.visibleRect.height / 3;\n overscanned.height += overscanY;\n if (this.velocity.y < 0) {\n overscanned.y -= overscanY;\n }\n\n if (this.velocity.x !== 0) {\n let overscanX = this.visibleRect.width / 3;\n overscanned.width += overscanX;\n if (this.velocity.x < 0) {\n overscanned.x -= overscanX;\n }\n }\n\n return overscanned;\n }\n}\n"],"names":[],"version":3,"file":"OverscanManager.main.js.map"}
@@ -13,66 +13,31 @@ import {Rect as $60423f92c7f9ad87$export$c79fc6492f3af13d} from "./Rect.mjs";
13
13
  * governing permissions and limitations under the License.
14
14
  */
15
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
16
  class $364191b3decf3697$export$4455ee6afb38dcbb {
27
17
  setVisibleRect(rect) {
28
18
  let time = performance.now() - this.startTime;
29
19
  if (time < 500) {
30
- this.averageTime.addSample(time);
31
20
  if (rect.x !== this.visibleRect.x && time > 0) this.velocity.x = (rect.x - this.visibleRect.x) / time;
32
21
  if (rect.y !== this.visibleRect.y && time > 0) this.velocity.y = (rect.y - this.visibleRect.y) / time;
33
22
  }
34
23
  this.startTime = performance.now();
35
24
  this.visibleRect = rect;
36
25
  }
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
26
  getOverscannedRect() {
50
27
  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;
28
+ let overscanY = this.visibleRect.height / 3;
29
+ overscanned.height += overscanY;
30
+ if (this.velocity.y < 0) overscanned.y -= overscanY;
31
+ if (this.velocity.x !== 0) {
32
+ let overscanX = this.visibleRect.width / 3;
33
+ overscanned.width += overscanX;
34
+ if (this.velocity.x < 0) overscanned.x -= overscanX;
66
35
  }
67
36
  return overscanned;
68
37
  }
69
38
  constructor(){
70
39
  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();
40
+ this.velocity = new (0, $3041db3296945e6e$export$baf26146a414f24a)(0, 0);
76
41
  this.visibleRect = new (0, $60423f92c7f9ad87$export$c79fc6492f3af13d)();
77
42
  }
78
43
  }
@@ -13,66 +13,31 @@ import {Rect as $60423f92c7f9ad87$export$c79fc6492f3af13d} from "./Rect.module.j
13
13
  * governing permissions and limitations under the License.
14
14
  */
15
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
16
  class $364191b3decf3697$export$4455ee6afb38dcbb {
27
17
  setVisibleRect(rect) {
28
18
  let time = performance.now() - this.startTime;
29
19
  if (time < 500) {
30
- this.averageTime.addSample(time);
31
20
  if (rect.x !== this.visibleRect.x && time > 0) this.velocity.x = (rect.x - this.visibleRect.x) / time;
32
21
  if (rect.y !== this.visibleRect.y && time > 0) this.velocity.y = (rect.y - this.visibleRect.y) / time;
33
22
  }
34
23
  this.startTime = performance.now();
35
24
  this.visibleRect = rect;
36
25
  }
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
26
  getOverscannedRect() {
50
27
  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;
28
+ let overscanY = this.visibleRect.height / 3;
29
+ overscanned.height += overscanY;
30
+ if (this.velocity.y < 0) overscanned.y -= overscanY;
31
+ if (this.velocity.x !== 0) {
32
+ let overscanX = this.visibleRect.width / 3;
33
+ overscanned.width += overscanX;
34
+ if (this.velocity.x < 0) overscanned.x -= overscanX;
66
35
  }
67
36
  return overscanned;
68
37
  }
69
38
  constructor(){
70
39
  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();
40
+ this.velocity = new (0, $3041db3296945e6e$export$baf26146a414f24a)(0, 0);
76
41
  this.visibleRect = new (0, $60423f92c7f9ad87$export$c79fc6492f3af13d)();
77
42
  }
78
43
  }
@@ -1 +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.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAKM,MAAM;IAKX,eAAe,IAAU,EAAE;QACzB,IAAI,OAAO,YAAY,GAAG,KAAK,IAAI,CAAC,SAAS;QAC7C,IAAI,OAAO,KAAK;YACd,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,OAAO,GAC1C,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,AAAC,CAAA,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,AAAD,IAAK;YAGpD,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,OAAO,GAC1C,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,AAAC,CAAA,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,AAAD,IAAK;QAEtD;QAEA,IAAI,CAAC,SAAS,GAAG,YAAY,GAAG;QAChC,IAAI,CAAC,WAAW,GAAG;IACrB;IAEA,qBAAqB;QACnB,IAAI,cAAc,IAAI,CAAC,WAAW,CAAC,IAAI;QAEvC,IAAI,YAAY,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG;QAC1C,YAAY,MAAM,IAAI;QACtB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GACpB,YAAY,CAAC,IAAI;QAGnB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG;YACzB,IAAI,YAAY,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG;YACzC,YAAY,KAAK,IAAI;YACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GACpB,YAAY,CAAC,IAAI;QAErB;QAEA,OAAO;IACT;;aAtCQ,YAAY;aACZ,WAAW,IAAI,CAAA,GAAA,yCAAI,EAAE,GAAG;aACxB,cAAc,IAAI,CAAA,GAAA,yCAAG;;AAqC/B","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\nexport class OverscanManager {\n private startTime = 0;\n private velocity = new Point(0, 0);\n private visibleRect = new Rect();\n \n setVisibleRect(rect: Rect) {\n let time = performance.now() - this.startTime;\n if (time < 500) {\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 getOverscannedRect() {\n let overscanned = this.visibleRect.copy();\n\n let overscanY = this.visibleRect.height / 3;\n overscanned.height += overscanY;\n if (this.velocity.y < 0) {\n overscanned.y -= overscanY;\n }\n\n if (this.velocity.x !== 0) {\n let overscanX = this.visibleRect.width / 3;\n overscanned.width += overscanX;\n if (this.velocity.x < 0) {\n overscanned.x -= overscanX;\n }\n }\n\n return overscanned;\n }\n}\n"],"names":[],"version":3,"file":"OverscanManager.module.js.map"}
@@ -23,9 +23,32 @@ class $197a1781bd47f5b9$export$1a5223887c560441 {
23
23
  this.rendered = null;
24
24
  this.layoutInfo = null;
25
25
  }
26
+ getReusableView(reuseType) {
27
+ // Reusable view queue should be FIFO so that DOM order remains consistent during scrolling.
28
+ // For example, cells within a row should remain in the same order even if the row changes contents.
29
+ // The cells within a row are removed from their parent in order. If the row is reused, the cells
30
+ // should be reused in the new row in the same order they were before.
31
+ let reusable = this.reusableViews.get(reuseType);
32
+ let view = (reusable === null || reusable === void 0 ? void 0 : reusable.length) > 0 ? reusable.shift() : new $197a1781bd47f5b9$export$1a5223887c560441(this.virtualizer);
33
+ view.viewType = reuseType;
34
+ view.parent = this;
35
+ return view;
36
+ }
37
+ reuseChild(child) {
38
+ child.prepareForReuse();
39
+ let reusable = this.reusableViews.get(child.viewType);
40
+ if (!reusable) {
41
+ reusable = [];
42
+ this.reusableViews.set(child.viewType, reusable);
43
+ }
44
+ reusable.push(child);
45
+ }
26
46
  constructor(virtualizer){
27
47
  this.virtualizer = virtualizer;
28
48
  this.key = ++$197a1781bd47f5b9$var$KEY;
49
+ this.parent = null;
50
+ this.children = new Set();
51
+ this.reusableViews = new Map();
29
52
  }
30
53
  }
31
54
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAMD,IAAI,4BAAM;AASH,MAAM;IAoBX;;GAEC,GACD,kBAAkB;QAChB,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,UAAU,GAAG;IACpB;IAZA,YAAY,WAAuC,CAAE;QACnD,IAAI,CAAC,WAAW,GAAG;QACnB,IAAI,CAAC,GAAG,GAAG,EAAE;IACf;AAUF","sources":["packages/@react-stately/virtualizer/src/ReusableView.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 {LayoutInfo} from './LayoutInfo';\nimport {Virtualizer} from './Virtualizer';\n\nlet KEY = 0;\n\n/**\n * [CollectionView]{@link CollectionView} creates instances of the [ReusableView]{@link ReusableView} class to\n * represent views currently being displayed. ReusableViews manage a DOM node, handle\n * applying {@link LayoutInfo} objects to the view, and render content\n * as needed. Subclasses must implement the {@link render} method at a\n * minimum. Other methods can be overridden to customize behavior.\n */\nexport class ReusableView<T extends object, V> {\n /** The CollectionVirtualizer this view is a part of. */\n virtualizer: Virtualizer<T, V, unknown>;\n\n /** The LayoutInfo this view is currently representing. */\n layoutInfo: LayoutInfo | null;\n\n /** The content currently being displayed by this view, set by the collection view. */\n content: T;\n\n rendered: V;\n\n viewType: string;\n key: Key;\n\n constructor(virtualizer: Virtualizer<T, V, unknown>) {\n this.virtualizer = virtualizer;\n this.key = ++KEY;\n }\n\n /**\n * Prepares the view for reuse. Called just before the view is removed from the DOM.\n */\n prepareForReuse() {\n this.content = null;\n this.rendered = null;\n this.layoutInfo = null;\n }\n}\n"],"names":[],"version":3,"file":"ReusableView.main.js.map"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAMD,IAAI,4BAAM;AAMH,MAAM;IA2BX;;GAEC,GACD,kBAAkB;QAChB,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,UAAU,GAAG;IACpB;IAEA,gBAAgB,SAAiB,EAAE;QACjC,4FAA4F;QAC5F,oGAAoG;QACpG,iGAAiG;QACjG,sEAAsE;QACtE,IAAI,WAAW,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;QACtC,IAAI,OAAO,CAAA,qBAAA,+BAAA,SAAU,MAAM,IAAG,IAC1B,SAAS,KAAK,KACd,IAAI,0CAAmB,IAAI,CAAC,WAAW;QAE3C,KAAK,QAAQ,GAAG;QAChB,KAAK,MAAM,GAAG,IAAI;QAClB,OAAO;IACT;IAEA,WAAW,KAAyB,EAAE;QACpC,MAAM,eAAe;QACrB,IAAI,WAAW,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,QAAQ;QACpD,IAAI,CAAC,UAAU;YACb,WAAW,EAAE;YACb,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,QAAQ,EAAE;QACzC;QACA,SAAS,IAAI,CAAC;IAChB;IAxCA,YAAY,WAAuC,CAAE;QACnD,IAAI,CAAC,WAAW,GAAG;QACnB,IAAI,CAAC,GAAG,GAAG,EAAE;QACb,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,QAAQ,GAAG,IAAI;QACpB,IAAI,CAAC,aAAa,GAAG,IAAI;IAC3B;AAmCF","sources":["packages/@react-stately/virtualizer/src/ReusableView.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 {LayoutInfo} from './LayoutInfo';\nimport {Virtualizer} from './Virtualizer';\n\nlet KEY = 0;\n\n/**\n * [Virtualizer]{@link Virtualizer} creates instances of the [ReusableView]{@link ReusableView} class to\n * represent views currently being displayed.\n */\nexport class ReusableView<T extends object, V> {\n /** The Virtualizer this view is a part of. */\n virtualizer: Virtualizer<T, V, unknown>;\n\n /** The LayoutInfo this view is currently representing. */\n layoutInfo: LayoutInfo | null;\n\n /** The content currently being displayed by this view, set by the virtualizer. */\n content: T;\n\n rendered: V;\n\n viewType: string;\n key: Key;\n\n parent: ReusableView<T, V> | null;\n children: Set<ReusableView<T, V>>;\n reusableViews: Map<string, ReusableView<T, V>[]>;\n\n constructor(virtualizer: Virtualizer<T, V, unknown>) {\n this.virtualizer = virtualizer;\n this.key = ++KEY;\n this.parent = null;\n this.children = new Set();\n this.reusableViews = new Map();\n }\n\n /**\n * Prepares the view for reuse. Called just before the view is removed from the DOM.\n */\n prepareForReuse() {\n this.content = null;\n this.rendered = null;\n this.layoutInfo = null;\n }\n\n getReusableView(reuseType: string) {\n // Reusable view queue should be FIFO so that DOM order remains consistent during scrolling.\n // For example, cells within a row should remain in the same order even if the row changes contents.\n // The cells within a row are removed from their parent in order. If the row is reused, the cells\n // should be reused in the new row in the same order they were before.\n let reusable = this.reusableViews.get(reuseType);\n let view = reusable?.length > 0\n ? reusable.shift()\n : new ReusableView<T, V>(this.virtualizer);\n\n view.viewType = reuseType;\n view.parent = this;\n return view;\n }\n\n reuseChild(child: ReusableView<T, V>) {\n child.prepareForReuse();\n let reusable = this.reusableViews.get(child.viewType);\n if (!reusable) {\n reusable = [];\n this.reusableViews.set(child.viewType, reusable);\n }\n reusable.push(child);\n }\n}\n"],"names":[],"version":3,"file":"ReusableView.main.js.map"}