@react-stately/virtualizer 3.7.2-nightly.4649 → 3.7.2-nightly.4656
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Layout.main.js +2 -41
- package/dist/Layout.main.js.map +1 -1
- package/dist/Layout.mjs +2 -41
- package/dist/Layout.module.js +2 -41
- package/dist/Layout.module.js.map +1 -1
- package/dist/LayoutInfo.main.js.map +1 -1
- package/dist/LayoutInfo.module.js.map +1 -1
- package/dist/OverscanManager.main.js +8 -43
- package/dist/OverscanManager.main.js.map +1 -1
- package/dist/OverscanManager.mjs +8 -43
- package/dist/OverscanManager.module.js +8 -43
- package/dist/OverscanManager.module.js.map +1 -1
- package/dist/ReusableView.main.js +23 -0
- package/dist/ReusableView.main.js.map +1 -1
- package/dist/ReusableView.mjs +23 -0
- package/dist/ReusableView.module.js +23 -0
- package/dist/ReusableView.module.js.map +1 -1
- package/dist/Virtualizer.main.js +123 -710
- package/dist/Virtualizer.main.js.map +1 -1
- package/dist/Virtualizer.mjs +124 -711
- package/dist/Virtualizer.module.js +124 -711
- package/dist/Virtualizer.module.js.map +1 -1
- package/dist/types.d.ts +64 -225
- package/dist/types.d.ts.map +1 -1
- package/dist/useVirtualizerState.main.js +39 -40
- package/dist/useVirtualizerState.main.js.map +1 -1
- package/dist/useVirtualizerState.mjs +40 -41
- package/dist/useVirtualizerState.module.js +40 -41
- package/dist/useVirtualizerState.module.js.map +1 -1
- package/dist/utils.main.js +1 -27
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +2 -26
- package/dist/utils.module.js +2 -26
- package/dist/utils.module.js.map +1 -1
- package/package.json +4 -4
- package/src/Layout.ts +10 -55
- package/src/LayoutInfo.ts +2 -2
- package/src/OverscanManager.ts +10 -47
- package/src/ReusableView.ts +36 -7
- package/src/Virtualizer.ts +163 -1058
- package/src/types.ts +16 -38
- package/src/useVirtualizerState.ts +40 -39
- package/src/utils.ts +0 -52
- package/dist/Transaction.main.js +0 -32
- package/dist/Transaction.main.js.map +0 -1
- package/dist/Transaction.mjs +0 -27
- package/dist/Transaction.module.js +0 -27
- package/dist/Transaction.module.js.map +0 -1
- package/dist/tween.main.js +0 -67
- package/dist/tween.main.js.map +0 -1
- package/dist/tween.mjs +0 -61
- package/dist/tween.module.js +0 -61
- package/dist/tween.module.js.map +0 -1
- package/src/Transaction.ts +0 -28
- package/src/tween.ts +0 -83
package/dist/Layout.main.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
package/dist/Layout.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,
|
|
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
|
|
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
|
|
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
|
|
package/dist/Layout.module.js
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
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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 =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
overscanned.
|
|
63
|
-
|
|
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.
|
|
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":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;
|
|
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"}
|
package/dist/OverscanManager.mjs
CHANGED
|
@@ -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 =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
overscanned.
|
|
57
|
-
|
|
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.
|
|
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 =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
overscanned.
|
|
57
|
-
|
|
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.
|
|
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":";;;AAAA;;;;;;;;;;CAUC;;
|
|
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;
|
|
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"}
|