@react-stately/virtualizer 3.0.0-nightly-641446f65-240905

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 (71) hide show
  1. package/README.md +3 -0
  2. package/dist/Layout.main.js +43 -0
  3. package/dist/Layout.main.js.map +1 -0
  4. package/dist/Layout.mjs +38 -0
  5. package/dist/Layout.module.js +38 -0
  6. package/dist/Layout.module.js.map +1 -0
  7. package/dist/LayoutInfo.main.js +51 -0
  8. package/dist/LayoutInfo.main.js.map +1 -0
  9. package/dist/LayoutInfo.mjs +46 -0
  10. package/dist/LayoutInfo.module.js +46 -0
  11. package/dist/LayoutInfo.module.js.map +1 -0
  12. package/dist/OverscanManager.main.js +52 -0
  13. package/dist/OverscanManager.main.js.map +1 -0
  14. package/dist/OverscanManager.mjs +47 -0
  15. package/dist/OverscanManager.module.js +47 -0
  16. package/dist/OverscanManager.module.js.map +1 -0
  17. package/dist/Point.main.js +40 -0
  18. package/dist/Point.main.js.map +1 -0
  19. package/dist/Point.mjs +35 -0
  20. package/dist/Point.module.js +35 -0
  21. package/dist/Point.module.js.map +1 -0
  22. package/dist/Rect.main.js +130 -0
  23. package/dist/Rect.main.js.map +1 -0
  24. package/dist/Rect.mjs +125 -0
  25. package/dist/Rect.module.js +125 -0
  26. package/dist/Rect.module.js.map +1 -0
  27. package/dist/ReusableView.main.js +56 -0
  28. package/dist/ReusableView.main.js.map +1 -0
  29. package/dist/ReusableView.mjs +51 -0
  30. package/dist/ReusableView.module.js +51 -0
  31. package/dist/ReusableView.module.js.map +1 -0
  32. package/dist/Size.main.js +40 -0
  33. package/dist/Size.main.js.map +1 -0
  34. package/dist/Size.mjs +35 -0
  35. package/dist/Size.module.js +35 -0
  36. package/dist/Size.module.js.map +1 -0
  37. package/dist/Virtualizer.main.js +233 -0
  38. package/dist/Virtualizer.main.js.map +1 -0
  39. package/dist/Virtualizer.mjs +228 -0
  40. package/dist/Virtualizer.module.js +228 -0
  41. package/dist/Virtualizer.module.js.map +1 -0
  42. package/dist/import.mjs +29 -0
  43. package/dist/main.js +40 -0
  44. package/dist/main.js.map +1 -0
  45. package/dist/module.js +29 -0
  46. package/dist/module.js.map +1 -0
  47. package/dist/types.d.ts +347 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/dist/useVirtualizerState.main.js +94 -0
  50. package/dist/useVirtualizerState.main.js.map +1 -0
  51. package/dist/useVirtualizerState.mjs +89 -0
  52. package/dist/useVirtualizerState.module.js +89 -0
  53. package/dist/useVirtualizerState.module.js.map +1 -0
  54. package/dist/utils.main.js +27 -0
  55. package/dist/utils.main.js.map +1 -0
  56. package/dist/utils.mjs +22 -0
  57. package/dist/utils.module.js +22 -0
  58. package/dist/utils.module.js.map +1 -0
  59. package/package.json +36 -0
  60. package/src/Layout.ts +93 -0
  61. package/src/LayoutInfo.ts +108 -0
  62. package/src/OverscanManager.ts +56 -0
  63. package/src/Point.ts +45 -0
  64. package/src/Rect.ts +191 -0
  65. package/src/ReusableView.ts +83 -0
  66. package/src/Size.ts +43 -0
  67. package/src/Virtualizer.ts +347 -0
  68. package/src/index.ts +23 -0
  69. package/src/types.ts +43 -0
  70. package/src/useVirtualizerState.ts +110 -0
  71. package/src/utils.ts +30 -0
@@ -0,0 +1,130 @@
1
+ var $f89f15d7f52bce29$exports = require("./Point.main.js");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "Rect", () => $41b7691783731623$export$c79fc6492f3af13d);
9
+ /*
10
+ * Copyright 2020 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */
20
+ class $41b7691783731623$export$c79fc6492f3af13d {
21
+ /**
22
+ * The maximum x-coordinate in the rectangle.
23
+ */ get maxX() {
24
+ return this.x + this.width;
25
+ }
26
+ /**
27
+ * The maximum y-coordinate in the rectangle.
28
+ */ get maxY() {
29
+ return this.y + this.height;
30
+ }
31
+ /**
32
+ * The area of the rectangle.
33
+ */ get area() {
34
+ return this.width * this.height;
35
+ }
36
+ /**
37
+ * The top left corner of the rectangle.
38
+ */ get topLeft() {
39
+ return new (0, $f89f15d7f52bce29$exports.Point)(this.x, this.y);
40
+ }
41
+ /**
42
+ * The top right corner of the rectangle.
43
+ */ get topRight() {
44
+ return new (0, $f89f15d7f52bce29$exports.Point)(this.maxX, this.y);
45
+ }
46
+ /**
47
+ * The bottom left corner of the rectangle.
48
+ */ get bottomLeft() {
49
+ return new (0, $f89f15d7f52bce29$exports.Point)(this.x, this.maxY);
50
+ }
51
+ /**
52
+ * The bottom right corner of the rectangle.
53
+ */ get bottomRight() {
54
+ return new (0, $f89f15d7f52bce29$exports.Point)(this.maxX, this.maxY);
55
+ }
56
+ /**
57
+ * Returns whether this rectangle intersects another rectangle.
58
+ * @param rect - The rectangle to check.
59
+ */ intersects(rect) {
60
+ return this.x <= rect.x + rect.width && rect.x <= this.x + this.width && this.y <= rect.y + rect.height && rect.y <= this.y + this.height;
61
+ }
62
+ /**
63
+ * Returns whether this rectangle fully contains another rectangle.
64
+ * @param rect - The rectangle to check.
65
+ */ containsRect(rect) {
66
+ return this.x <= rect.x && this.y <= rect.y && this.maxX >= rect.maxX && this.maxY >= rect.maxY;
67
+ }
68
+ /**
69
+ * Returns whether the rectangle contains the given point.
70
+ * @param point - The point to check.
71
+ */ containsPoint(point) {
72
+ return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;
73
+ }
74
+ /**
75
+ * Returns the first corner of this rectangle (from top to bottom, left to right)
76
+ * that is contained in the given rectangle, or null of the rectangles do not intersect.
77
+ * @param rect - The rectangle to check.
78
+ */ getCornerInRect(rect) {
79
+ for (let key of [
80
+ 'topLeft',
81
+ 'topRight',
82
+ 'bottomLeft',
83
+ 'bottomRight'
84
+ ]){
85
+ if (rect.containsPoint(this[key])) return key;
86
+ }
87
+ return null;
88
+ }
89
+ equals(rect) {
90
+ return rect.x === this.x && rect.y === this.y && rect.width === this.width && rect.height === this.height;
91
+ }
92
+ pointEquals(point) {
93
+ return this.x === point.x && this.y === point.y;
94
+ }
95
+ sizeEquals(size) {
96
+ return this.width === size.width && this.height === size.height;
97
+ }
98
+ /**
99
+ * Returns the union of this Rect and another.
100
+ */ union(other) {
101
+ let x = Math.min(this.x, other.x);
102
+ let y = Math.min(this.y, other.y);
103
+ let width = Math.max(this.maxX, other.maxX) - x;
104
+ let height = Math.max(this.maxY, other.maxY) - y;
105
+ return new $41b7691783731623$export$c79fc6492f3af13d(x, y, width, height);
106
+ }
107
+ /**
108
+ * Returns the intersection of this Rect with another.
109
+ * If the rectangles do not intersect, an all zero Rect is returned.
110
+ */ intersection(other) {
111
+ if (!this.intersects(other)) return new $41b7691783731623$export$c79fc6492f3af13d(0, 0, 0, 0);
112
+ let x = Math.max(this.x, other.x);
113
+ let y = Math.max(this.y, other.y);
114
+ return new $41b7691783731623$export$c79fc6492f3af13d(x, y, Math.min(this.maxX, other.maxX) - x, Math.min(this.maxY, other.maxY) - y);
115
+ }
116
+ /**
117
+ * Returns a copy of this rectangle.
118
+ */ copy() {
119
+ return new $41b7691783731623$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
120
+ }
121
+ constructor(x = 0, y = 0, width = 0, height = 0){
122
+ this.x = x;
123
+ this.y = y;
124
+ this.width = width;
125
+ this.height = height;
126
+ }
127
+ }
128
+
129
+
130
+ //# sourceMappingURL=Rect.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAUM,M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AAI,EAAE,MAAM,IAAI,IAAI;QAC/C,OAAO,IAAI,0CAAK,GAAG,GAAG,OAAO;IAC/B;IAEA;;;GAGC,GACD,aAAa,KAAW,EAAQ;QAC9B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QACnB,OAAO,IAAI,0CAAK,GAAG,GAAG,GAAG;QAG3B,IAAI,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC;QAChC,IAAI,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC;QAChC,OAAO,IAAI,0CACT,GACA,GACA,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,IAAI,IAAI,GAClC,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,IAAI,IAAI;IAEtC;IAEA;;GAEC,GACD,OAAa;QACX,OAAO,IAAI,0CAAK,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM;IACzD;IA5JA,YAAY,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAE;QAC/C,IAAI,CAAC,CAAC,GAAG;QACT,IAAI,CAAC,CAAC,GAAG;QACT,IAAI,CAAC,KAAK,GAAG;QACb,IAAI,CAAC,MAAM,GAAG;IAChB;AAwJF","sources":["packages/@react-stately/virtualizer/src/Rect.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 {Size} from './Size';\n\nexport type RectCorner = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';\n\n/**\n * Represents a rectangle.\n */\nexport class Rect {\n /** The x-coordinate of the rectangle. */\n x: number;\n\n /** The y-coordinate of the rectangle. */\n y: number;\n\n /** The width of the rectangle. */\n width: number;\n\n /** The height of the rectangle. */\n height: number;\n\n constructor(x = 0, y = 0, width = 0, height = 0) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n\n /**\n * The maximum x-coordinate in the rectangle.\n */\n get maxX(): number {\n return this.x + this.width;\n }\n\n /**\n * The maximum y-coordinate in the rectangle.\n */\n get maxY(): number {\n return this.y + this.height;\n }\n\n /**\n * The area of the rectangle.\n */\n get area(): number {\n return this.width * this.height;\n }\n\n /**\n * The top left corner of the rectangle.\n */\n get topLeft(): Point {\n return new Point(this.x, this.y);\n }\n\n /**\n * The top right corner of the rectangle.\n */\n get topRight(): Point {\n return new Point(this.maxX, this.y);\n }\n\n /**\n * The bottom left corner of the rectangle.\n */\n get bottomLeft(): Point {\n return new Point(this.x, this.maxY);\n }\n\n /**\n * The bottom right corner of the rectangle.\n */\n get bottomRight(): Point {\n return new Point(this.maxX, this.maxY);\n }\n\n /**\n * Returns whether this rectangle intersects another rectangle.\n * @param rect - The rectangle to check.\n */\n intersects(rect: Rect): boolean {\n return this.x <= rect.x + rect.width\n && rect.x <= this.x + this.width\n && this.y <= rect.y + rect.height\n && rect.y <= this.y + this.height;\n }\n\n /**\n * Returns whether this rectangle fully contains another rectangle.\n * @param rect - The rectangle to check.\n */\n containsRect(rect: Rect): boolean {\n return this.x <= rect.x\n && this.y <= rect.y\n && this.maxX >= rect.maxX\n && this.maxY >= rect.maxY;\n }\n\n /**\n * Returns whether the rectangle contains the given point.\n * @param point - The point to check.\n */\n containsPoint(point: Point): boolean {\n return this.x <= point.x\n && this.y <= point.y\n && this.maxX >= point.x\n && this.maxY >= point.y;\n }\n\n /**\n * Returns the first corner of this rectangle (from top to bottom, left to right)\n * that is contained in the given rectangle, or null of the rectangles do not intersect.\n * @param rect - The rectangle to check.\n */\n getCornerInRect(rect: Rect): RectCorner | null {\n for (let key of ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']) {\n if (rect.containsPoint(this[key])) {\n return key as RectCorner;\n }\n }\n\n return null;\n }\n\n equals(rect: Rect) {\n return rect.x === this.x\n && rect.y === this.y\n && rect.width === this.width\n && rect.height === this.height;\n }\n\n pointEquals(point: Point | Rect) {\n return this.x === point.x\n && this.y === point.y;\n }\n\n sizeEquals(size: Size | Rect) {\n return this.width === size.width\n && this.height === size.height;\n }\n\n /**\n * Returns the union of this Rect and another.\n */\n union(other: Rect) {\n let x = Math.min(this.x, other.x);\n let y = Math.min(this.y, other.y);\n let width = Math.max(this.maxX, other.maxX) - x;\n let height = Math.max(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n /**\n * Returns the intersection of this Rect with another.\n * If the rectangles do not intersect, an all zero Rect is returned.\n */\n intersection(other: Rect): Rect {\n if (!this.intersects(other)) {\n return new Rect(0, 0, 0, 0);\n }\n\n let x = Math.max(this.x, other.x);\n let y = Math.max(this.y, other.y);\n return new Rect(\n x,\n y,\n Math.min(this.maxX, other.maxX) - x,\n Math.min(this.maxY, other.maxY) - y\n );\n }\n\n /**\n * Returns a copy of this rectangle.\n */\n copy(): Rect {\n return new Rect(this.x, this.y, this.width, this.height);\n }\n}\n"],"names":[],"version":3,"file":"Rect.main.js.map"}
package/dist/Rect.mjs ADDED
@@ -0,0 +1,125 @@
1
+ import {Point as $3041db3296945e6e$export$baf26146a414f24a} from "./Point.mjs";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ class $60423f92c7f9ad87$export$c79fc6492f3af13d {
15
+ /**
16
+ * The maximum x-coordinate in the rectangle.
17
+ */ get maxX() {
18
+ return this.x + this.width;
19
+ }
20
+ /**
21
+ * The maximum y-coordinate in the rectangle.
22
+ */ get maxY() {
23
+ return this.y + this.height;
24
+ }
25
+ /**
26
+ * The area of the rectangle.
27
+ */ get area() {
28
+ return this.width * this.height;
29
+ }
30
+ /**
31
+ * The top left corner of the rectangle.
32
+ */ get topLeft() {
33
+ return new (0, $3041db3296945e6e$export$baf26146a414f24a)(this.x, this.y);
34
+ }
35
+ /**
36
+ * The top right corner of the rectangle.
37
+ */ get topRight() {
38
+ return new (0, $3041db3296945e6e$export$baf26146a414f24a)(this.maxX, this.y);
39
+ }
40
+ /**
41
+ * The bottom left corner of the rectangle.
42
+ */ get bottomLeft() {
43
+ return new (0, $3041db3296945e6e$export$baf26146a414f24a)(this.x, this.maxY);
44
+ }
45
+ /**
46
+ * The bottom right corner of the rectangle.
47
+ */ get bottomRight() {
48
+ return new (0, $3041db3296945e6e$export$baf26146a414f24a)(this.maxX, this.maxY);
49
+ }
50
+ /**
51
+ * Returns whether this rectangle intersects another rectangle.
52
+ * @param rect - The rectangle to check.
53
+ */ intersects(rect) {
54
+ return this.x <= rect.x + rect.width && rect.x <= this.x + this.width && this.y <= rect.y + rect.height && rect.y <= this.y + this.height;
55
+ }
56
+ /**
57
+ * Returns whether this rectangle fully contains another rectangle.
58
+ * @param rect - The rectangle to check.
59
+ */ containsRect(rect) {
60
+ return this.x <= rect.x && this.y <= rect.y && this.maxX >= rect.maxX && this.maxY >= rect.maxY;
61
+ }
62
+ /**
63
+ * Returns whether the rectangle contains the given point.
64
+ * @param point - The point to check.
65
+ */ containsPoint(point) {
66
+ return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;
67
+ }
68
+ /**
69
+ * Returns the first corner of this rectangle (from top to bottom, left to right)
70
+ * that is contained in the given rectangle, or null of the rectangles do not intersect.
71
+ * @param rect - The rectangle to check.
72
+ */ getCornerInRect(rect) {
73
+ for (let key of [
74
+ 'topLeft',
75
+ 'topRight',
76
+ 'bottomLeft',
77
+ 'bottomRight'
78
+ ]){
79
+ if (rect.containsPoint(this[key])) return key;
80
+ }
81
+ return null;
82
+ }
83
+ equals(rect) {
84
+ return rect.x === this.x && rect.y === this.y && rect.width === this.width && rect.height === this.height;
85
+ }
86
+ pointEquals(point) {
87
+ return this.x === point.x && this.y === point.y;
88
+ }
89
+ sizeEquals(size) {
90
+ return this.width === size.width && this.height === size.height;
91
+ }
92
+ /**
93
+ * Returns the union of this Rect and another.
94
+ */ union(other) {
95
+ let x = Math.min(this.x, other.x);
96
+ let y = Math.min(this.y, other.y);
97
+ let width = Math.max(this.maxX, other.maxX) - x;
98
+ let height = Math.max(this.maxY, other.maxY) - y;
99
+ return new $60423f92c7f9ad87$export$c79fc6492f3af13d(x, y, width, height);
100
+ }
101
+ /**
102
+ * Returns the intersection of this Rect with another.
103
+ * If the rectangles do not intersect, an all zero Rect is returned.
104
+ */ intersection(other) {
105
+ if (!this.intersects(other)) return new $60423f92c7f9ad87$export$c79fc6492f3af13d(0, 0, 0, 0);
106
+ let x = Math.max(this.x, other.x);
107
+ let y = Math.max(this.y, other.y);
108
+ return new $60423f92c7f9ad87$export$c79fc6492f3af13d(x, y, Math.min(this.maxX, other.maxX) - x, Math.min(this.maxY, other.maxY) - y);
109
+ }
110
+ /**
111
+ * Returns a copy of this rectangle.
112
+ */ copy() {
113
+ return new $60423f92c7f9ad87$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
114
+ }
115
+ constructor(x = 0, y = 0, width = 0, height = 0){
116
+ this.x = x;
117
+ this.y = y;
118
+ this.width = width;
119
+ this.height = height;
120
+ }
121
+ }
122
+
123
+
124
+ export {$60423f92c7f9ad87$export$c79fc6492f3af13d as Rect};
125
+ //# sourceMappingURL=Rect.module.js.map
@@ -0,0 +1,125 @@
1
+ import {Point as $3041db3296945e6e$export$baf26146a414f24a} from "./Point.module.js";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ class $60423f92c7f9ad87$export$c79fc6492f3af13d {
15
+ /**
16
+ * The maximum x-coordinate in the rectangle.
17
+ */ get maxX() {
18
+ return this.x + this.width;
19
+ }
20
+ /**
21
+ * The maximum y-coordinate in the rectangle.
22
+ */ get maxY() {
23
+ return this.y + this.height;
24
+ }
25
+ /**
26
+ * The area of the rectangle.
27
+ */ get area() {
28
+ return this.width * this.height;
29
+ }
30
+ /**
31
+ * The top left corner of the rectangle.
32
+ */ get topLeft() {
33
+ return new (0, $3041db3296945e6e$export$baf26146a414f24a)(this.x, this.y);
34
+ }
35
+ /**
36
+ * The top right corner of the rectangle.
37
+ */ get topRight() {
38
+ return new (0, $3041db3296945e6e$export$baf26146a414f24a)(this.maxX, this.y);
39
+ }
40
+ /**
41
+ * The bottom left corner of the rectangle.
42
+ */ get bottomLeft() {
43
+ return new (0, $3041db3296945e6e$export$baf26146a414f24a)(this.x, this.maxY);
44
+ }
45
+ /**
46
+ * The bottom right corner of the rectangle.
47
+ */ get bottomRight() {
48
+ return new (0, $3041db3296945e6e$export$baf26146a414f24a)(this.maxX, this.maxY);
49
+ }
50
+ /**
51
+ * Returns whether this rectangle intersects another rectangle.
52
+ * @param rect - The rectangle to check.
53
+ */ intersects(rect) {
54
+ return this.x <= rect.x + rect.width && rect.x <= this.x + this.width && this.y <= rect.y + rect.height && rect.y <= this.y + this.height;
55
+ }
56
+ /**
57
+ * Returns whether this rectangle fully contains another rectangle.
58
+ * @param rect - The rectangle to check.
59
+ */ containsRect(rect) {
60
+ return this.x <= rect.x && this.y <= rect.y && this.maxX >= rect.maxX && this.maxY >= rect.maxY;
61
+ }
62
+ /**
63
+ * Returns whether the rectangle contains the given point.
64
+ * @param point - The point to check.
65
+ */ containsPoint(point) {
66
+ return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;
67
+ }
68
+ /**
69
+ * Returns the first corner of this rectangle (from top to bottom, left to right)
70
+ * that is contained in the given rectangle, or null of the rectangles do not intersect.
71
+ * @param rect - The rectangle to check.
72
+ */ getCornerInRect(rect) {
73
+ for (let key of [
74
+ 'topLeft',
75
+ 'topRight',
76
+ 'bottomLeft',
77
+ 'bottomRight'
78
+ ]){
79
+ if (rect.containsPoint(this[key])) return key;
80
+ }
81
+ return null;
82
+ }
83
+ equals(rect) {
84
+ return rect.x === this.x && rect.y === this.y && rect.width === this.width && rect.height === this.height;
85
+ }
86
+ pointEquals(point) {
87
+ return this.x === point.x && this.y === point.y;
88
+ }
89
+ sizeEquals(size) {
90
+ return this.width === size.width && this.height === size.height;
91
+ }
92
+ /**
93
+ * Returns the union of this Rect and another.
94
+ */ union(other) {
95
+ let x = Math.min(this.x, other.x);
96
+ let y = Math.min(this.y, other.y);
97
+ let width = Math.max(this.maxX, other.maxX) - x;
98
+ let height = Math.max(this.maxY, other.maxY) - y;
99
+ return new $60423f92c7f9ad87$export$c79fc6492f3af13d(x, y, width, height);
100
+ }
101
+ /**
102
+ * Returns the intersection of this Rect with another.
103
+ * If the rectangles do not intersect, an all zero Rect is returned.
104
+ */ intersection(other) {
105
+ if (!this.intersects(other)) return new $60423f92c7f9ad87$export$c79fc6492f3af13d(0, 0, 0, 0);
106
+ let x = Math.max(this.x, other.x);
107
+ let y = Math.max(this.y, other.y);
108
+ return new $60423f92c7f9ad87$export$c79fc6492f3af13d(x, y, Math.min(this.maxX, other.maxX) - x, Math.min(this.maxY, other.maxY) - y);
109
+ }
110
+ /**
111
+ * Returns a copy of this rectangle.
112
+ */ copy() {
113
+ return new $60423f92c7f9ad87$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
114
+ }
115
+ constructor(x = 0, y = 0, width = 0, height = 0){
116
+ this.x = x;
117
+ this.y = y;
118
+ this.width = width;
119
+ this.height = height;
120
+ }
121
+ }
122
+
123
+
124
+ export {$60423f92c7f9ad87$export$c79fc6492f3af13d as Rect};
125
+ //# sourceMappingURL=Rect.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAUM,MAAM;IAoBX;;GAEC,GACD,IAAI,OAAe;QACjB,OAAO,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK;IAC5B;IAEA;;GAEC,GACD,IAAI,OAAe;QACjB,OAAO,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM;IAC7B;IAEA;;GAEC,GACD,IAAI,OAAe;QACjB,OAAO,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM;IACjC;IAEA;;GAEC,GACD,IAAI,UAAiB;QACnB,OAAO,IAAI,CAAA,GAAA,yCAAI,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACjC;IAEA;;GAEC,GACD,IAAI,WAAkB;QACpB,OAAO,IAAI,CAAA,GAAA,yCAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC;IAEA;;GAEC,GACD,IAAI,aAAoB;QACtB,OAAO,IAAI,CAAA,GAAA,yCAAI,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI;IACpC;IAEA;;GAEC,GACD,IAAI,cAAqB;QACvB,OAAO,IAAI,CAAA,GAAA,yCAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI;IACvC;IAEA;;;GAGC,GAC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AAI,CAAC,CAAC,GAAG;QACT,IAAI,CAAC,KAAK,GAAG;QACb,IAAI,CAAC,MAAM,GAAG;IAChB;AAwJF","sources":["packages/@react-stately/virtualizer/src/Rect.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 {Size} from './Size';\n\nexport type RectCorner = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';\n\n/**\n * Represents a rectangle.\n */\nexport class Rect {\n /** The x-coordinate of the rectangle. */\n x: number;\n\n /** The y-coordinate of the rectangle. */\n y: number;\n\n /** The width of the rectangle. */\n width: number;\n\n /** The height of the rectangle. */\n height: number;\n\n constructor(x = 0, y = 0, width = 0, height = 0) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n\n /**\n * The maximum x-coordinate in the rectangle.\n */\n get maxX(): number {\n return this.x + this.width;\n }\n\n /**\n * The maximum y-coordinate in the rectangle.\n */\n get maxY(): number {\n return this.y + this.height;\n }\n\n /**\n * The area of the rectangle.\n */\n get area(): number {\n return this.width * this.height;\n }\n\n /**\n * The top left corner of the rectangle.\n */\n get topLeft(): Point {\n return new Point(this.x, this.y);\n }\n\n /**\n * The top right corner of the rectangle.\n */\n get topRight(): Point {\n return new Point(this.maxX, this.y);\n }\n\n /**\n * The bottom left corner of the rectangle.\n */\n get bottomLeft(): Point {\n return new Point(this.x, this.maxY);\n }\n\n /**\n * The bottom right corner of the rectangle.\n */\n get bottomRight(): Point {\n return new Point(this.maxX, this.maxY);\n }\n\n /**\n * Returns whether this rectangle intersects another rectangle.\n * @param rect - The rectangle to check.\n */\n intersects(rect: Rect): boolean {\n return this.x <= rect.x + rect.width\n && rect.x <= this.x + this.width\n && this.y <= rect.y + rect.height\n && rect.y <= this.y + this.height;\n }\n\n /**\n * Returns whether this rectangle fully contains another rectangle.\n * @param rect - The rectangle to check.\n */\n containsRect(rect: Rect): boolean {\n return this.x <= rect.x\n && this.y <= rect.y\n && this.maxX >= rect.maxX\n && this.maxY >= rect.maxY;\n }\n\n /**\n * Returns whether the rectangle contains the given point.\n * @param point - The point to check.\n */\n containsPoint(point: Point): boolean {\n return this.x <= point.x\n && this.y <= point.y\n && this.maxX >= point.x\n && this.maxY >= point.y;\n }\n\n /**\n * Returns the first corner of this rectangle (from top to bottom, left to right)\n * that is contained in the given rectangle, or null of the rectangles do not intersect.\n * @param rect - The rectangle to check.\n */\n getCornerInRect(rect: Rect): RectCorner | null {\n for (let key of ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']) {\n if (rect.containsPoint(this[key])) {\n return key as RectCorner;\n }\n }\n\n return null;\n }\n\n equals(rect: Rect) {\n return rect.x === this.x\n && rect.y === this.y\n && rect.width === this.width\n && rect.height === this.height;\n }\n\n pointEquals(point: Point | Rect) {\n return this.x === point.x\n && this.y === point.y;\n }\n\n sizeEquals(size: Size | Rect) {\n return this.width === size.width\n && this.height === size.height;\n }\n\n /**\n * Returns the union of this Rect and another.\n */\n union(other: Rect) {\n let x = Math.min(this.x, other.x);\n let y = Math.min(this.y, other.y);\n let width = Math.max(this.maxX, other.maxX) - x;\n let height = Math.max(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n /**\n * Returns the intersection of this Rect with another.\n * If the rectangles do not intersect, an all zero Rect is returned.\n */\n intersection(other: Rect): Rect {\n if (!this.intersects(other)) {\n return new Rect(0, 0, 0, 0);\n }\n\n let x = Math.max(this.x, other.x);\n let y = Math.max(this.y, other.y);\n return new Rect(\n x,\n y,\n Math.min(this.maxX, other.maxX) - x,\n Math.min(this.maxY, other.maxY) - y\n );\n }\n\n /**\n * Returns a copy of this rectangle.\n */\n copy(): Rect {\n return new Rect(this.x, this.y, this.width, this.height);\n }\n}\n"],"names":[],"version":3,"file":"Rect.module.js.map"}
@@ -0,0 +1,56 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "ReusableView", () => $197a1781bd47f5b9$export$1a5223887c560441);
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ let $197a1781bd47f5b9$var$KEY = 0;
18
+ class $197a1781bd47f5b9$export$1a5223887c560441 {
19
+ /**
20
+ * Prepares the view for reuse. Called just before the view is removed from the DOM.
21
+ */ prepareForReuse() {
22
+ this.content = null;
23
+ this.rendered = null;
24
+ this.layoutInfo = null;
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
+ }
46
+ constructor(virtualizer){
47
+ this.virtualizer = virtualizer;
48
+ this.key = ++$197a1781bd47f5b9$var$KEY;
49
+ this.parent = null;
50
+ this.children = new Set();
51
+ this.reusableViews = new Map();
52
+ }
53
+ }
54
+
55
+
56
+ //# sourceMappingURL=ReusableView.main.js.map
@@ -0,0 +1 @@
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,WAA8B,CAAE;QAC1C,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>;\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>) {\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"}
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ let $ad1d98aa8f0c31b4$var$KEY = 0;
12
+ class $ad1d98aa8f0c31b4$export$1a5223887c560441 {
13
+ /**
14
+ * Prepares the view for reuse. Called just before the view is removed from the DOM.
15
+ */ prepareForReuse() {
16
+ this.content = null;
17
+ this.rendered = null;
18
+ this.layoutInfo = null;
19
+ }
20
+ getReusableView(reuseType) {
21
+ // Reusable view queue should be FIFO so that DOM order remains consistent during scrolling.
22
+ // For example, cells within a row should remain in the same order even if the row changes contents.
23
+ // The cells within a row are removed from their parent in order. If the row is reused, the cells
24
+ // should be reused in the new row in the same order they were before.
25
+ let reusable = this.reusableViews.get(reuseType);
26
+ let view = (reusable === null || reusable === void 0 ? void 0 : reusable.length) > 0 ? reusable.shift() : new $ad1d98aa8f0c31b4$export$1a5223887c560441(this.virtualizer);
27
+ view.viewType = reuseType;
28
+ view.parent = this;
29
+ return view;
30
+ }
31
+ reuseChild(child) {
32
+ child.prepareForReuse();
33
+ let reusable = this.reusableViews.get(child.viewType);
34
+ if (!reusable) {
35
+ reusable = [];
36
+ this.reusableViews.set(child.viewType, reusable);
37
+ }
38
+ reusable.push(child);
39
+ }
40
+ constructor(virtualizer){
41
+ this.virtualizer = virtualizer;
42
+ this.key = ++$ad1d98aa8f0c31b4$var$KEY;
43
+ this.parent = null;
44
+ this.children = new Set();
45
+ this.reusableViews = new Map();
46
+ }
47
+ }
48
+
49
+
50
+ export {$ad1d98aa8f0c31b4$export$1a5223887c560441 as ReusableView};
51
+ //# sourceMappingURL=ReusableView.module.js.map
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ let $ad1d98aa8f0c31b4$var$KEY = 0;
12
+ class $ad1d98aa8f0c31b4$export$1a5223887c560441 {
13
+ /**
14
+ * Prepares the view for reuse. Called just before the view is removed from the DOM.
15
+ */ prepareForReuse() {
16
+ this.content = null;
17
+ this.rendered = null;
18
+ this.layoutInfo = null;
19
+ }
20
+ getReusableView(reuseType) {
21
+ // Reusable view queue should be FIFO so that DOM order remains consistent during scrolling.
22
+ // For example, cells within a row should remain in the same order even if the row changes contents.
23
+ // The cells within a row are removed from their parent in order. If the row is reused, the cells
24
+ // should be reused in the new row in the same order they were before.
25
+ let reusable = this.reusableViews.get(reuseType);
26
+ let view = (reusable === null || reusable === void 0 ? void 0 : reusable.length) > 0 ? reusable.shift() : new $ad1d98aa8f0c31b4$export$1a5223887c560441(this.virtualizer);
27
+ view.viewType = reuseType;
28
+ view.parent = this;
29
+ return view;
30
+ }
31
+ reuseChild(child) {
32
+ child.prepareForReuse();
33
+ let reusable = this.reusableViews.get(child.viewType);
34
+ if (!reusable) {
35
+ reusable = [];
36
+ this.reusableViews.set(child.viewType, reusable);
37
+ }
38
+ reusable.push(child);
39
+ }
40
+ constructor(virtualizer){
41
+ this.virtualizer = virtualizer;
42
+ this.key = ++$ad1d98aa8f0c31b4$var$KEY;
43
+ this.parent = null;
44
+ this.children = new Set();
45
+ this.reusableViews = new Map();
46
+ }
47
+ }
48
+
49
+
50
+ export {$ad1d98aa8f0c31b4$export$1a5223887c560441 as ReusableView};
51
+ //# sourceMappingURL=ReusableView.module.js.map
@@ -0,0 +1 @@
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,WAA8B,CAAE;QAC1C,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>;\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>) {\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.module.js.map"}
@@ -0,0 +1,40 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "Size", () => $064492b79924894c$export$cb6da89c6af1a8ec);
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ class $064492b79924894c$export$cb6da89c6af1a8ec {
18
+ /**
19
+ * Returns a copy of this size.
20
+ */ copy() {
21
+ return new $064492b79924894c$export$cb6da89c6af1a8ec(this.width, this.height);
22
+ }
23
+ /**
24
+ * Returns whether this size is equal to another one.
25
+ */ equals(other) {
26
+ return this.width === other.width && this.height === other.height;
27
+ }
28
+ /**
29
+ * The total area of the Size.
30
+ */ get area() {
31
+ return this.width * this.height;
32
+ }
33
+ constructor(width = 0, height = 0){
34
+ this.width = width;
35
+ this.height = height;
36
+ }
37
+ }
38
+
39
+
40
+ //# sourceMappingURL=Size.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAEM,MAAM;IASX;;GAEC,GACD,OAAa;QACX,OAAO,IAAI,0CAAK,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM;IACzC;IAEA;;GAEC,GACD,OAAO,KAAW,EAAW;QAC3B,OAAO,IAAI,CAAC,KAAK,KAAK,MAAM,KAAK,IAC1B,IAAI,CAAC,MAAM,KAAK,MAAM,MAAM;IACrC;IAEA;;GAEC,GACD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM;IACjC;IAzBA,YAAY,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAE;QACjC,IAAI,CAAC,KAAK,GAAG;QACb,IAAI,CAAC,MAAM,GAAG;IAChB;AAuBF","sources":["packages/@react-stately/virtualizer/src/Size.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\nexport class Size {\n width: number;\n height: number;\n\n constructor(width = 0, height = 0) {\n this.width = width;\n this.height = height;\n }\n\n /**\n * Returns a copy of this size.\n */\n copy(): Size {\n return new Size(this.width, this.height);\n }\n\n /**\n * Returns whether this size is equal to another one.\n */\n equals(other: Size): boolean {\n return this.width === other.width\n && this.height === other.height;\n }\n\n /**\n * The total area of the Size.\n */\n get area() {\n return this.width * this.height;\n }\n}\n"],"names":[],"version":3,"file":"Size.main.js.map"}