@fluentui/react-virtualizer 9.0.0-alpha.21 → 9.0.0-alpha.23

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 (166) hide show
  1. package/CHANGELOG.json +79 -1
  2. package/CHANGELOG.md +28 -2
  3. package/dist/index.d.ts +59 -7
  4. package/lib/Hooks.js +0 -1
  5. package/lib/Hooks.js.map +1 -1
  6. package/lib/Utilities.js +0 -1
  7. package/lib/Utilities.js.map +1 -1
  8. package/lib/Virtualizer.js +0 -1
  9. package/lib/Virtualizer.js.map +1 -1
  10. package/lib/VirtualizerScrollView.js +0 -1
  11. package/lib/VirtualizerScrollView.js.map +1 -1
  12. package/lib/VirtualizerScrollViewDynamic.js +0 -1
  13. package/lib/VirtualizerScrollViewDynamic.js.map +1 -1
  14. package/lib/components/Virtualizer/Virtualizer.js +5 -7
  15. package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
  16. package/lib/components/Virtualizer/Virtualizer.types.js +0 -1
  17. package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
  18. package/lib/components/Virtualizer/index.js +1 -2
  19. package/lib/components/Virtualizer/index.js.map +1 -1
  20. package/lib/components/Virtualizer/renderVirtualizer.js +9 -13
  21. package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
  22. package/lib/components/Virtualizer/useVirtualizer.js +419 -355
  23. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
  24. package/lib/components/Virtualizer/{useVirtualizerStyles.js → useVirtualizerStyles.styles.js} +1 -1
  25. package/lib/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
  26. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +5 -7
  27. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
  28. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +1 -2
  29. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
  30. package/lib/components/VirtualizerScrollView/index.js +1 -2
  31. package/lib/components/VirtualizerScrollView/index.js.map +1 -1
  32. package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js +4 -8
  33. package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -1
  34. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +62 -32
  35. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
  36. package/lib/components/VirtualizerScrollView/{useVirtualizerScrollViewStyles.js → useVirtualizerScrollViewStyles.styles.js} +2 -2
  37. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
  38. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +5 -7
  39. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
  40. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +1 -2
  41. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
  42. package/lib/components/VirtualizerScrollViewDynamic/index.js +1 -2
  43. package/lib/components/VirtualizerScrollViewDynamic/index.js.map +1 -1
  44. package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +4 -8
  45. package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -1
  46. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +70 -38
  47. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
  48. package/lib/components/VirtualizerScrollViewDynamic/{useVirtualizerScrollViewDynamicStyles.js → useVirtualizerScrollViewDynamicStyles.styles.js} +2 -2
  49. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
  50. package/lib/hooks/hooks.types.js +1 -2
  51. package/lib/hooks/hooks.types.js.map +1 -1
  52. package/lib/hooks/index.js +0 -1
  53. package/lib/hooks/index.js.map +1 -1
  54. package/lib/hooks/useDynamicVirtualizerMeasure.js +91 -91
  55. package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
  56. package/lib/hooks/useIntersectionObserver.js +31 -32
  57. package/lib/hooks/useIntersectionObserver.js.map +1 -1
  58. package/lib/hooks/useResizeObserverRef.js +36 -32
  59. package/lib/hooks/useResizeObserverRef.js.map +1 -1
  60. package/lib/hooks/useVirtualizerMeasure.js +38 -47
  61. package/lib/hooks/useVirtualizerMeasure.js.map +1 -1
  62. package/lib/index.js +1 -2
  63. package/lib/index.js.map +1 -1
  64. package/lib/utilities/ImperativeScrolling/imperativeScrolling.js +32 -0
  65. package/lib/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -0
  66. package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js +1 -0
  67. package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -0
  68. package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js +45 -0
  69. package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -0
  70. package/lib/utilities/ImperativeScrolling/index.js +3 -0
  71. package/lib/utilities/ImperativeScrolling/index.js.map +1 -0
  72. package/lib/utilities/VirtualizerContext/VirtualizerContext.js +26 -22
  73. package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -1
  74. package/lib/utilities/VirtualizerContext/index.js +0 -1
  75. package/lib/utilities/VirtualizerContext/index.js.map +1 -1
  76. package/lib/utilities/VirtualizerContext/types.js +1 -2
  77. package/lib/utilities/VirtualizerContext/types.js.map +1 -1
  78. package/lib/utilities/debounce.js +13 -14
  79. package/lib/utilities/debounce.js.map +1 -1
  80. package/lib/utilities/index.js +1 -1
  81. package/lib/utilities/index.js.map +1 -1
  82. package/lib-commonjs/Hooks.js +0 -3
  83. package/lib-commonjs/Hooks.js.map +1 -1
  84. package/lib-commonjs/Utilities.js +0 -3
  85. package/lib-commonjs/Utilities.js.map +1 -1
  86. package/lib-commonjs/Virtualizer.js +0 -3
  87. package/lib-commonjs/Virtualizer.js.map +1 -1
  88. package/lib-commonjs/VirtualizerScrollView.js +0 -3
  89. package/lib-commonjs/VirtualizerScrollView.js.map +1 -1
  90. package/lib-commonjs/VirtualizerScrollViewDynamic.js +0 -3
  91. package/lib-commonjs/VirtualizerScrollViewDynamic.js.map +1 -1
  92. package/lib-commonjs/components/Virtualizer/Virtualizer.js +3 -5
  93. package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -1
  94. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js +0 -3
  95. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
  96. package/lib-commonjs/components/Virtualizer/index.js +1 -4
  97. package/lib-commonjs/components/Virtualizer/index.js.map +1 -1
  98. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js +1 -3
  99. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -1
  100. package/lib-commonjs/components/Virtualizer/useVirtualizer.js +84 -16
  101. package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
  102. package/lib-commonjs/components/Virtualizer/{useVirtualizerStyles.js → useVirtualizerStyles.styles.js} +1 -3
  103. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
  104. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js +3 -5
  105. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
  106. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +0 -3
  107. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
  108. package/lib-commonjs/components/VirtualizerScrollView/index.js +1 -4
  109. package/lib-commonjs/components/VirtualizerScrollView/index.js.map +1 -1
  110. package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js +1 -3
  111. package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -1
  112. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +39 -6
  113. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
  114. package/lib-commonjs/components/VirtualizerScrollView/{useVirtualizerScrollViewStyles.js → useVirtualizerScrollViewStyles.styles.js} +4 -6
  115. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
  116. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +3 -5
  117. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
  118. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +0 -3
  119. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
  120. package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js +1 -4
  121. package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js.map +1 -1
  122. package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +1 -3
  123. package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -1
  124. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +42 -7
  125. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
  126. package/lib-commonjs/components/VirtualizerScrollViewDynamic/{useVirtualizerScrollViewDynamicStyles.js → useVirtualizerScrollViewDynamicStyles.styles.js} +4 -6
  127. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
  128. package/lib-commonjs/hooks/hooks.types.js +0 -3
  129. package/lib-commonjs/hooks/hooks.types.js.map +1 -1
  130. package/lib-commonjs/hooks/index.js +0 -3
  131. package/lib-commonjs/hooks/index.js.map +1 -1
  132. package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js +5 -7
  133. package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
  134. package/lib-commonjs/hooks/useIntersectionObserver.js +1 -3
  135. package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
  136. package/lib-commonjs/hooks/useResizeObserverRef.js +3 -3
  137. package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -1
  138. package/lib-commonjs/hooks/useVirtualizerMeasure.js +7 -9
  139. package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -1
  140. package/lib-commonjs/index.js +2 -3
  141. package/lib-commonjs/index.js.map +1 -1
  142. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js +40 -0
  143. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -0
  144. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js +4 -0
  145. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -0
  146. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js +53 -0
  147. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -0
  148. package/lib-commonjs/utilities/ImperativeScrolling/index.js +8 -0
  149. package/lib-commonjs/utilities/ImperativeScrolling/index.js.map +1 -0
  150. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +3 -5
  151. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -1
  152. package/lib-commonjs/utilities/VirtualizerContext/index.js +0 -3
  153. package/lib-commonjs/utilities/VirtualizerContext/index.js.map +1 -1
  154. package/lib-commonjs/utilities/VirtualizerContext/types.js +0 -3
  155. package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -1
  156. package/lib-commonjs/utilities/debounce.js +1 -3
  157. package/lib-commonjs/utilities/debounce.js.map +1 -1
  158. package/lib-commonjs/utilities/index.js +1 -3
  159. package/lib-commonjs/utilities/index.js.map +1 -1
  160. package/package.json +5 -5
  161. package/lib/components/Virtualizer/useVirtualizerStyles.js.map +0 -1
  162. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +0 -1
  163. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.js.map +0 -1
  164. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js.map +0 -1
  165. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +0 -1
  166. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.js.map +0 -1
@@ -1,368 +1,432 @@
1
+ import { useEffect, useRef, useCallback, useReducer, useImperativeHandle, useState } from 'react';
1
2
  import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
2
- import { useEffect, useRef, useCallback, useReducer } from 'react';
3
3
  import { resolveShorthand } from '@fluentui/react-utilities';
4
4
  import { flushSync } from 'react-dom';
5
5
  import { useVirtualizerContextState_unstable } from '../../Utilities';
6
6
  import { renderVirtualizerChildPlaceholder } from './renderVirtualizer';
7
7
  export function useVirtualizer_unstable(props) {
8
- const {
9
- itemSize,
10
- numItems,
11
- virtualizerLength,
12
- children: renderChild,
13
- getItemSize,
14
- bufferItems = Math.round(virtualizerLength / 4.0),
15
- bufferSize = Math.floor(bufferItems / 2.0) * itemSize,
16
- scrollViewRef,
17
- axis = 'vertical',
18
- reversed = false,
19
- virtualizerContext
20
- } = props;
21
- /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/
22
- const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);
23
- const actualIndex = _virtualizerContext.contextIndex;
24
- const setActualIndex = _virtualizerContext.setContextIndex;
25
- // Store ref to before padding element
26
- const beforeElementRef = useRef(null);
27
- // Store ref to before padding element
28
- const afterElementRef = useRef(null);
29
- // We need to store an array to track dynamic sizes, we can use this to incrementally update changes
30
- const childSizes = useRef(new Array(getItemSize ? numItems : 0));
31
- /* We keep track of the progressive sizing/placement down the list,
32
- this helps us skip re-calculations unless children/size changes */
33
- const childProgressiveSizes = useRef(new Array(getItemSize ? numItems : 0));
34
- // The internal tracking REF for child array (updates often).
35
- const childArray = useRef(new Array(virtualizerLength));
36
- // We want to be methodical about updating the render with child reference array
37
- const forceUpdate = useReducer(() => ({}), {})[1];
38
- const horizontal = axis === 'horizontal';
39
- const populateSizeArrays = () => {
40
- if (!getItemSize) {
41
- // Static sizes, never mind!
42
- return;
43
- }
44
- if (numItems !== childSizes.current.length) {
45
- childSizes.current = new Array(numItems);
46
- }
47
- if (numItems !== childProgressiveSizes.current.length) {
48
- childProgressiveSizes.current = new Array(numItems);
49
- }
50
- for (let index = 0; index < numItems; index++) {
51
- childSizes.current[index] = getItemSize(index);
52
- if (index === 0) {
53
- childProgressiveSizes.current[index] = childSizes.current[index];
54
- } else {
55
- childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];
56
- }
57
- }
58
- };
59
- const batchUpdateNewIndex = index => {
60
- // Local updates
61
- updateChildRows(index);
62
- updateCurrentItemSizes(index);
63
- // State setters
64
- setActualIndex(index);
65
- };
66
- // Observe intersections of virtualized components
67
- const {
68
- setObserverList
69
- } = useIntersectionObserver((entries, observer) => {
70
- /* Sanity check - do we even need virtualization? */if (virtualizerLength > numItems) {
71
- if (actualIndex !== 0) {
72
- batchUpdateNewIndex(0);
73
- }
74
- // No-op
75
- return;
76
- }
77
- /* IO initiates this function when needed (bookend entering view) */
78
- let measurementPos = 0;
79
- let bufferCount = bufferItems;
80
- // Grab latest entry that is intersecting
81
- const latestEntry = entries.length === 1 ? entries[0] : entries.sort((entry1, entry2) => entry2.time - entry1.time).find(entry => {
82
- return entry.intersectionRatio > 0;
83
- });
84
- if (!latestEntry) {
85
- // If we don't find an intersecting area, ignore for now.
86
- return;
87
- }
88
- if (latestEntry.target === afterElementRef.current) {
89
- // We need to inverse the buffer count
90
- bufferCount = virtualizerLength - bufferItems;
91
- measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();
92
- if (!horizontal) {
93
- if (reversed) {
94
- // Scrolling 'up' and hit the after element below
95
- measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);
96
- } else if (latestEntry.boundingClientRect.top < 0) {
97
- // Scrolling 'down' and hit the after element above top: 0
98
- measurementPos -= latestEntry.boundingClientRect.top;
8
+ const { itemSize , numItems , virtualizerLength , children: renderChild , getItemSize , bufferItems =Math.round(virtualizerLength / 4.0) , bufferSize =Math.floor(bufferItems / 2.0) * itemSize , scrollViewRef , axis ='vertical' , reversed =false , virtualizerContext , onRenderedFlaggedIndex , imperativeVirtualizerRef } = props;
9
+ /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/ const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);
10
+ const flaggedIndex = useRef(null);
11
+ const actualIndex = _virtualizerContext.contextIndex;
12
+ const setActualIndex = _virtualizerContext.setContextIndex;
13
+ // Store ref to before padding element
14
+ const beforeElementRef = useRef(null);
15
+ // Store ref to before padding element
16
+ const afterElementRef = useRef(null);
17
+ // We need to store an array to track dynamic sizes, we can use this to incrementally update changes
18
+ const childSizes = useRef(new Array(getItemSize ? numItems : 0));
19
+ /* We keep track of the progressive sizing/placement down the list,
20
+ this helps us skip re-calculations unless children/size changes */ const childProgressiveSizes = useRef(new Array(getItemSize ? numItems : 0));
21
+ // The internal tracking REF for child array (updates often).
22
+ const childArray = useRef(new Array(virtualizerLength));
23
+ // We want to be methodical about updating the render with child reference array
24
+ const forceUpdate = useReducer(()=>({}), {})[1];
25
+ const horizontal = axis === 'horizontal';
26
+ const populateSizeArrays = ()=>{
27
+ if (!getItemSize) {
28
+ // Static sizes, never mind!
29
+ return;
30
+ }
31
+ if (numItems !== childSizes.current.length) {
32
+ childSizes.current = new Array(numItems);
33
+ }
34
+ if (numItems !== childProgressiveSizes.current.length) {
35
+ childProgressiveSizes.current = new Array(numItems);
36
+ }
37
+ for(let index = 0; index < numItems; index++){
38
+ childSizes.current[index] = getItemSize(index);
39
+ if (index === 0) {
40
+ childProgressiveSizes.current[index] = childSizes.current[index];
41
+ } else {
42
+ childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];
43
+ }
44
+ }
45
+ };
46
+ const [isScrolling, setIsScrolling] = useState(false);
47
+ const scrollTimer = useRef();
48
+ const scrollCounter = useRef(0);
49
+ const initializeScrollingTimer = ()=>{
50
+ /*
51
+ * This can be considered the 'velocity' required to start 'isScrolling'
52
+ * INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling
53
+ * INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset
54
+ * - Maybe we should let users customize these in the future.
55
+ */ const INIT_SCROLL_FLAG_REQ = 10;
56
+ const INIT_SCROLL_FLAG_DELAY = 100;
57
+ scrollCounter.current++;
58
+ if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {
59
+ setIsScrolling(true);
60
+ }
61
+ if (scrollTimer.current) {
62
+ clearTimeout(scrollTimer.current);
63
+ }
64
+ scrollTimer.current = setTimeout(()=>{
65
+ setIsScrolling(false);
66
+ scrollCounter.current = 0;
67
+ }, INIT_SCROLL_FLAG_DELAY);
68
+ };
69
+ useEffect(()=>{
70
+ initializeScrollingTimer();
71
+ }, [
72
+ actualIndex
73
+ ]);
74
+ const batchUpdateNewIndex = (index)=>{
75
+ // Local updates
76
+ updateChildRows(index);
77
+ updateCurrentItemSizes(index);
78
+ // State setters
79
+ setActualIndex(index);
80
+ };
81
+ // Observe intersections of virtualized components
82
+ const { setObserverList } = useIntersectionObserver((entries, observer)=>{
83
+ /* Sanity check - do we even need virtualization? */ if (virtualizerLength > numItems) {
84
+ if (actualIndex !== 0) {
85
+ batchUpdateNewIndex(0);
86
+ }
87
+ // No-op
88
+ return;
89
+ }
90
+ /* IO initiates this function when needed (bookend entering view) */ let measurementPos = 0;
91
+ let bufferCount = bufferItems;
92
+ // Grab latest entry that is intersecting
93
+ const latestEntry = entries.length === 1 ? entries[0] : entries.sort((entry1, entry2)=>entry2.time - entry1.time).find((entry)=>{
94
+ return entry.intersectionRatio > 0;
95
+ });
96
+ if (!latestEntry) {
97
+ // If we don't find an intersecting area, ignore for now.
98
+ return;
99
+ }
100
+ if (latestEntry.target === afterElementRef.current) {
101
+ // We need to inverse the buffer count
102
+ bufferCount = virtualizerLength - bufferItems;
103
+ measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();
104
+ if (!horizontal) {
105
+ if (reversed) {
106
+ // Scrolling 'up' and hit the after element below
107
+ measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);
108
+ } else if (latestEntry.boundingClientRect.top < 0) {
109
+ // Scrolling 'down' and hit the after element above top: 0
110
+ measurementPos -= latestEntry.boundingClientRect.top;
111
+ }
112
+ } else {
113
+ if (reversed) {
114
+ // Scrolling 'left' and hit the after element
115
+ measurementPos -= Math.abs(latestEntry.boundingClientRect.right);
116
+ } else if (latestEntry.boundingClientRect.left < 0) {
117
+ // Scrolling 'right' and hit the after element
118
+ measurementPos -= latestEntry.boundingClientRect.left;
119
+ }
120
+ }
121
+ } else if (latestEntry.target === beforeElementRef.current) {
122
+ measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();
123
+ if (!horizontal) {
124
+ if (!reversed) {
125
+ measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);
126
+ } else if (latestEntry.boundingClientRect.top < 0) {
127
+ // Scrolling 'down' in reverse order and hit the before element above top: 0
128
+ measurementPos -= latestEntry.boundingClientRect.top;
129
+ }
130
+ } else {
131
+ if (!reversed) {
132
+ measurementPos -= Math.abs(latestEntry.boundingClientRect.right);
133
+ } else if (latestEntry.boundingClientRect.left < 0) {
134
+ // Scrolling 'left' and hit before element
135
+ measurementPos -= latestEntry.boundingClientRect.left;
136
+ }
137
+ }
99
138
  }
100
- } else {
101
139
  if (reversed) {
102
- // Scrolling 'left' and hit the after element
103
- measurementPos -= Math.abs(latestEntry.boundingClientRect.right);
104
- } else if (latestEntry.boundingClientRect.left < 0) {
105
- // Scrolling 'right' and hit the after element
106
- measurementPos -= latestEntry.boundingClientRect.left;
107
- }
108
- }
109
- } else if (latestEntry.target === beforeElementRef.current) {
110
- measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();
111
- if (!horizontal) {
112
- if (!reversed) {
113
- measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);
114
- } else if (latestEntry.boundingClientRect.top < 0) {
115
- // Scrolling 'down' in reverse order and hit the before element above top: 0
116
- measurementPos -= latestEntry.boundingClientRect.top;
117
- }
118
- } else {
119
- if (!reversed) {
120
- measurementPos -= Math.abs(latestEntry.boundingClientRect.right);
121
- } else if (latestEntry.boundingClientRect.left < 0) {
122
- // Scrolling 'left' and hit before element
123
- measurementPos -= latestEntry.boundingClientRect.left;
124
- }
125
- }
126
- }
127
- if (reversed) {
128
- // We're reversed, up is down, left is right, invert the scroll measure.
129
- measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);
130
- }
131
- // For now lets use hardcoded size to assess current element to paginate on
132
- const startIndex = getIndexFromScrollPosition(measurementPos);
133
- const bufferedIndex = Math.max(startIndex - bufferCount, 0);
134
- // Safety limits
135
- const maxIndex = Math.max(numItems - virtualizerLength, 0);
136
- const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);
137
- if (actualIndex !== newStartIndex) {
138
- // We flush sync this and perform an immediate state update
139
- flushSync(() => {
140
- batchUpdateNewIndex(newStartIndex);
141
- });
142
- }
143
- }, {
144
- root: scrollViewRef ? scrollViewRef === null || scrollViewRef === void 0 ? void 0 : scrollViewRef.current : null,
145
- rootMargin: '0px',
146
- threshold: 0
147
- });
148
- const findIndexRecursive = (scrollPos, lowIndex, highIndex) => {
149
- if (lowIndex > highIndex) {
150
- // We shouldn't get here - but no-op the index if we do.
151
- return actualIndex;
152
- }
153
- const midpoint = Math.floor((lowIndex + highIndex) / 2);
154
- const iBefore = Math.max(midpoint - 1, 0);
155
- const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);
156
- const indexValue = childProgressiveSizes.current[midpoint];
157
- const afterIndexValue = childProgressiveSizes.current[iAfter];
158
- const beforeIndexValue = childProgressiveSizes.current[iBefore];
159
- if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {
160
- /* We've found our index - if we are exactly matching before/after index that's ok,
161
- better to reduce checks if it's right on the boundary. */
162
- return midpoint;
163
- }
164
- if (indexValue > scrollPos) {
165
- return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);
166
- } else {
167
- return findIndexRecursive(scrollPos, midpoint + 1, highIndex);
168
- }
169
- };
170
- const getIndexFromSizeArray = scrollPos => {
171
- /* Quick searches our progressive height array */if (scrollPos === 0 || childProgressiveSizes.current.length === 0 || scrollPos <= childProgressiveSizes.current[0]) {
172
- // Check start
173
- return 0;
174
- }
175
- if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {
176
- // Check end
177
- return childProgressiveSizes.current.length - 1;
178
- }
179
- return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);
180
- };
181
- const getIndexFromScrollPosition = scrollPos => {
182
- if (!getItemSize) {
183
- return Math.round(scrollPos / itemSize);
184
- }
185
- return getIndexFromSizeArray(scrollPos);
186
- };
187
- const calculateTotalSize = () => {
188
- if (!getItemSize) {
189
- return itemSize * numItems;
190
- }
191
- // Time for custom size calcs
192
- return childProgressiveSizes.current[numItems - 1];
193
- };
194
- const calculateBefore = () => {
195
- const currentIndex = Math.min(actualIndex, numItems);
196
- if (!getItemSize) {
197
- // The missing items from before virtualization starts height
198
- return currentIndex * itemSize;
199
- }
200
- if (currentIndex <= 0) {
201
- return 0;
202
- }
203
- // Time for custom size calcs
204
- return childProgressiveSizes.current[currentIndex - 1];
205
- };
206
- const calculateAfter = () => {
207
- if (numItems === 0) {
208
- return 0;
209
- }
210
- const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems - 1);
211
- if (!getItemSize) {
212
- // The missing items from after virtualization ends height
213
- const remainingItems = numItems - lastItemIndex - 1;
214
- return remainingItems * itemSize;
215
- }
216
- // Time for custom size calcs
217
- return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];
218
- };
219
- const updateChildRows = useCallback(newIndex => {
220
- if (numItems === 0) {
221
- /* Nothing to virtualize */return [];
222
- }
223
- if (childArray.current.length !== numItems) {
224
- childArray.current = new Array(virtualizerLength);
225
- }
226
- const _actualIndex = Math.max(newIndex, 0);
227
- const end = Math.min(_actualIndex + virtualizerLength, numItems);
228
- for (let i = _actualIndex; i < end; i++) {
229
- childArray.current[i - _actualIndex] = renderVirtualizerChildPlaceholder(renderChild(i), i);
230
- }
231
- }, [numItems, renderChild, virtualizerLength]);
232
- const setBeforeRef = useCallback(element => {
233
- if (!element || beforeElementRef.current === element) {
234
- return;
235
- }
236
- beforeElementRef.current = element;
237
- const newList = [];
238
- newList.push(beforeElementRef.current);
239
- if (afterElementRef.current) {
240
- newList.push(afterElementRef.current);
241
- }
242
- // Ensure we update array if before element changed
243
- setObserverList(newList);
244
- }, [setObserverList]);
245
- const setAfterRef = useCallback(element => {
246
- if (!element || afterElementRef.current === element) {
247
- return;
248
- }
249
- afterElementRef.current = element;
250
- const newList = [];
251
- if (beforeElementRef.current) {
252
- newList.push(beforeElementRef.current);
253
- }
254
- newList.push(afterElementRef.current);
255
- // Ensure we update array if after element changed
256
- setObserverList(newList);
257
- }, [setObserverList]);
258
- const updateCurrentItemSizes = newIndex => {
259
- if (!getItemSize) {
260
- // Static sizes, not required.
261
- return;
262
- }
263
- // We should always call our size function on index change (only for the items that will be rendered)
264
- // This ensures we request the latest data for incoming items in case sizing has changed.
265
- const endIndex = Math.min(newIndex + virtualizerLength, numItems);
266
- const startIndex = Math.max(newIndex, 0);
267
- let didUpdate = false;
268
- for (let i = startIndex; i < endIndex; i++) {
269
- const newSize = getItemSize(i);
270
- if (newSize !== childSizes.current[i]) {
271
- childSizes.current[i] = newSize;
272
- didUpdate = true;
273
- }
274
- }
275
- if (didUpdate) {
276
- // Update our progressive size array
277
- for (let i = startIndex; i < numItems; i++) {
278
- const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;
279
- childProgressiveSizes.current[i] = prevSize + childSizes.current[i];
280
- }
281
- }
282
- };
283
- // Initialize the size array before first render.
284
- const hasInitialized = useRef(false);
285
- const initializeSizeArray = () => {
286
- if (hasInitialized.current === false) {
287
- hasInitialized.current = true;
288
- populateSizeArrays();
289
- }
290
- };
291
- // Initialization on mount - update array index to 0 (ready state).
292
- // Only fire on mount (no deps).
293
- useEffect(() => {
294
- if (actualIndex < 0) {
295
- batchUpdateNewIndex(0);
296
- }
140
+ // We're reversed, up is down, left is right, invert the scroll measure.
141
+ measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);
142
+ }
143
+ // For now lets use hardcoded size to assess current element to paginate on
144
+ const startIndex = getIndexFromScrollPosition(measurementPos);
145
+ const bufferedIndex = Math.max(startIndex - bufferCount, 0);
146
+ // Safety limits
147
+ const maxIndex = Math.max(numItems - virtualizerLength, 0);
148
+ const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);
149
+ if (actualIndex !== newStartIndex) {
150
+ // We flush sync this and perform an immediate state update
151
+ flushSync(()=>{
152
+ batchUpdateNewIndex(newStartIndex);
153
+ });
154
+ }
155
+ }, {
156
+ root: scrollViewRef ? scrollViewRef === null || scrollViewRef === void 0 ? void 0 : scrollViewRef.current : null,
157
+ rootMargin: '0px',
158
+ threshold: 0
159
+ });
160
+ const findIndexRecursive = (scrollPos, lowIndex, highIndex)=>{
161
+ if (lowIndex > highIndex) {
162
+ // We shouldn't get here - but no-op the index if we do.
163
+ return actualIndex;
164
+ }
165
+ const midpoint = Math.floor((lowIndex + highIndex) / 2);
166
+ const iBefore = Math.max(midpoint - 1, 0);
167
+ const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);
168
+ const indexValue = childProgressiveSizes.current[midpoint];
169
+ const afterIndexValue = childProgressiveSizes.current[iAfter];
170
+ const beforeIndexValue = childProgressiveSizes.current[iBefore];
171
+ if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {
172
+ /* We've found our index - if we are exactly matching before/after index that's ok,
173
+ better to reduce checks if it's right on the boundary. */ return midpoint;
174
+ }
175
+ if (indexValue > scrollPos) {
176
+ return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);
177
+ } else {
178
+ return findIndexRecursive(scrollPos, midpoint + 1, highIndex);
179
+ }
180
+ };
181
+ const getIndexFromSizeArray = (scrollPos)=>{
182
+ /* Quick searches our progressive height array */ if (scrollPos === 0 || childProgressiveSizes.current.length === 0 || scrollPos <= childProgressiveSizes.current[0]) {
183
+ // Check start
184
+ return 0;
185
+ }
186
+ if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {
187
+ // Check end
188
+ return childProgressiveSizes.current.length - 1;
189
+ }
190
+ return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);
191
+ };
192
+ const getIndexFromScrollPosition = (scrollPos)=>{
193
+ if (!getItemSize) {
194
+ return Math.round(scrollPos / itemSize);
195
+ }
196
+ return getIndexFromSizeArray(scrollPos);
197
+ };
198
+ const calculateTotalSize = useCallback(()=>{
199
+ if (!getItemSize) {
200
+ return itemSize * numItems;
201
+ }
202
+ // Time for custom size calcs
203
+ return childProgressiveSizes.current[numItems - 1];
204
+ }, [
205
+ getItemSize,
206
+ itemSize,
207
+ numItems
208
+ ]);
209
+ const calculateBefore = useCallback(()=>{
210
+ const currentIndex = Math.min(actualIndex, numItems);
211
+ if (!getItemSize) {
212
+ // The missing items from before virtualization starts height
213
+ return currentIndex * itemSize;
214
+ }
215
+ if (currentIndex <= 0) {
216
+ return 0;
217
+ }
218
+ // Time for custom size calcs
219
+ return childProgressiveSizes.current[currentIndex - 1];
220
+ }, [
221
+ actualIndex,
222
+ getItemSize,
223
+ itemSize,
224
+ numItems
225
+ ]);
226
+ const calculateAfter = useCallback(()=>{
227
+ if (numItems === 0) {
228
+ return 0;
229
+ }
230
+ const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems - 1);
231
+ if (!getItemSize) {
232
+ // The missing items from after virtualization ends height
233
+ const remainingItems = numItems - lastItemIndex - 1;
234
+ return remainingItems * itemSize;
235
+ }
236
+ // Time for custom size calcs
237
+ return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];
238
+ }, [
239
+ actualIndex,
240
+ getItemSize,
241
+ itemSize,
242
+ numItems,
243
+ virtualizerLength
244
+ ]);
245
+ const updateChildRows = useCallback((newIndex)=>{
246
+ if (numItems === 0) {
247
+ /* Nothing to virtualize */ return;
248
+ }
249
+ /*
250
+ We reset the array every time to ensure children are re-rendered
251
+ This function should only be called when update is nessecary
252
+ */ childArray.current = new Array(virtualizerLength);
253
+ const _actualIndex = Math.max(newIndex, 0);
254
+ const end = Math.min(_actualIndex + virtualizerLength, numItems);
255
+ for(let i = _actualIndex; i < end; i++){
256
+ childArray.current[i - _actualIndex] = renderVirtualizerChildPlaceholder(renderChild(i, isScrolling), i);
257
+ }
258
+ }, [
259
+ isScrolling,
260
+ numItems,
261
+ renderChild,
262
+ virtualizerLength
263
+ ]);
264
+ const setBeforeRef = useCallback((element)=>{
265
+ if (!element || beforeElementRef.current === element) {
266
+ return;
267
+ }
268
+ beforeElementRef.current = element;
269
+ const newList = [];
270
+ newList.push(beforeElementRef.current);
271
+ if (afterElementRef.current) {
272
+ newList.push(afterElementRef.current);
273
+ }
274
+ // Ensure we update array if before element changed
275
+ setObserverList(newList);
276
+ }, [
277
+ setObserverList
278
+ ]);
279
+ const setAfterRef = useCallback((element)=>{
280
+ if (!element || afterElementRef.current === element) {
281
+ return;
282
+ }
283
+ afterElementRef.current = element;
284
+ const newList = [];
285
+ if (beforeElementRef.current) {
286
+ newList.push(beforeElementRef.current);
287
+ }
288
+ newList.push(afterElementRef.current);
289
+ // Ensure we update array if after element changed
290
+ setObserverList(newList);
291
+ }, [
292
+ setObserverList
293
+ ]);
294
+ const updateCurrentItemSizes = (newIndex)=>{
295
+ if (!getItemSize) {
296
+ // Static sizes, not required.
297
+ return;
298
+ }
299
+ // We should always call our size function on index change (only for the items that will be rendered)
300
+ // This ensures we request the latest data for incoming items in case sizing has changed.
301
+ const endIndex = Math.min(newIndex + virtualizerLength, numItems);
302
+ const startIndex = Math.max(newIndex, 0);
303
+ let didUpdate = false;
304
+ for(let i = startIndex; i < endIndex; i++){
305
+ const newSize = getItemSize(i);
306
+ if (newSize !== childSizes.current[i]) {
307
+ childSizes.current[i] = newSize;
308
+ didUpdate = true;
309
+ }
310
+ }
311
+ if (didUpdate) {
312
+ // Update our progressive size array
313
+ for(let i = startIndex; i < numItems; i++){
314
+ const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;
315
+ childProgressiveSizes.current[i] = prevSize + childSizes.current[i];
316
+ }
317
+ }
318
+ };
319
+ // Initialize the size array before first render.
320
+ const hasInitialized = useRef(false);
321
+ const initializeSizeArray = ()=>{
322
+ if (hasInitialized.current === false) {
323
+ hasInitialized.current = true;
324
+ populateSizeArrays();
325
+ }
326
+ };
327
+ useImperativeHandle(imperativeVirtualizerRef, ()=>{
328
+ return {
329
+ progressiveSizes: childProgressiveSizes,
330
+ nodeSizes: childSizes,
331
+ setFlaggedIndex: (index)=>flaggedIndex.current = index
332
+ };
333
+ }, [
334
+ childProgressiveSizes,
335
+ childSizes
336
+ ]);
337
+ // Initialization on mount - update array index to 0 (ready state).
338
+ // Only fire on mount (no deps).
339
+ useEffect(()=>{
340
+ if (actualIndex < 0) {
341
+ batchUpdateNewIndex(0);
342
+ }
297
343
  // eslint-disable-next-line react-hooks/exhaustive-deps
298
- }, []);
299
- // If the user passes in an updated renderChild function - update current children
300
- useEffect(() => {
301
- if (actualIndex >= 0) {
302
- updateChildRows(actualIndex);
303
- forceUpdate();
304
- }
344
+ }, []);
345
+ // If the user passes in an updated renderChild function - update current children
346
+ useEffect(()=>{
347
+ if (actualIndex >= 0) {
348
+ updateChildRows(actualIndex);
349
+ forceUpdate();
350
+ }
305
351
  // eslint-disable-next-line react-hooks/exhaustive-deps
306
- }, [renderChild, updateChildRows]);
307
- useEffect(() => {
308
- // Ensure we repopulate if getItemSize callback changes
309
- populateSizeArrays();
352
+ }, [
353
+ renderChild,
354
+ updateChildRows
355
+ ]);
356
+ useEffect(()=>{
357
+ // Ensure we repopulate if getItemSize callback changes
358
+ populateSizeArrays();
310
359
  // We only run this effect on getItemSize change (recalc dynamic sizes)
311
360
  // eslint-disable-next-line react-hooks/exhaustive-deps
312
- }, [getItemSize]);
313
- // Ensure we have run through and updated the whole size list array at least once.
314
- initializeSizeArray();
315
- if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {
316
- // Child length mismatch, repopulate size arrays.
317
- populateSizeArrays();
318
- }
319
- // Ensure we recalc if virtualizer length changes
320
- const maxCompare = Math.min(virtualizerLength, numItems);
321
- if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {
322
- updateChildRows(actualIndex);
323
- }
324
- const isFullyInitialized = hasInitialized.current && actualIndex >= 0;
325
- return {
326
- components: {
327
- before: 'div',
328
- after: 'div',
329
- beforeContainer: 'div',
330
- afterContainer: 'div'
331
- },
332
- virtualizedChildren: childArray.current,
333
- before: resolveShorthand(props.before, {
334
- required: true,
335
- defaultProps: {
336
- ref: setBeforeRef,
337
- role: 'none'
338
- }
339
- }),
340
- after: resolveShorthand(props.after, {
341
- required: true,
342
- defaultProps: {
343
- ref: setAfterRef,
344
- role: 'none'
345
- }
346
- }),
347
- beforeContainer: resolveShorthand(props.beforeContainer, {
348
- required: true,
349
- defaultProps: {
350
- role: 'none'
351
- }
352
- }),
353
- afterContainer: resolveShorthand(props.afterContainer, {
354
- required: true,
355
- defaultProps: {
356
- role: 'none'
357
- }
358
- }),
359
- beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,
360
- afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,
361
- totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,
362
- virtualizerStartIndex: actualIndex,
363
- axis,
364
- bufferSize,
365
- reversed
366
- };
361
+ }, [
362
+ getItemSize
363
+ ]);
364
+ // Effect to check flag index on updates
365
+ useEffect(()=>{
366
+ if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {
367
+ return;
368
+ }
369
+ if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {
370
+ onRenderedFlaggedIndex(flaggedIndex.current);
371
+ flaggedIndex.current = null;
372
+ }
373
+ }, [
374
+ actualIndex,
375
+ onRenderedFlaggedIndex,
376
+ virtualizerLength
377
+ ]);
378
+ // Ensure we have run through and updated the whole size list array at least once.
379
+ initializeSizeArray();
380
+ if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {
381
+ // Child length mismatch, repopulate size arrays.
382
+ populateSizeArrays();
383
+ }
384
+ // Ensure we recalc if virtualizer length changes
385
+ const maxCompare = Math.min(virtualizerLength, numItems);
386
+ if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {
387
+ updateChildRows(actualIndex);
388
+ }
389
+ const isFullyInitialized = hasInitialized.current && actualIndex >= 0;
390
+ return {
391
+ components: {
392
+ before: 'div',
393
+ after: 'div',
394
+ beforeContainer: 'div',
395
+ afterContainer: 'div'
396
+ },
397
+ virtualizedChildren: childArray.current,
398
+ before: resolveShorthand(props.before, {
399
+ required: true,
400
+ defaultProps: {
401
+ ref: setBeforeRef,
402
+ role: 'none'
403
+ }
404
+ }),
405
+ after: resolveShorthand(props.after, {
406
+ required: true,
407
+ defaultProps: {
408
+ ref: setAfterRef,
409
+ role: 'none'
410
+ }
411
+ }),
412
+ beforeContainer: resolveShorthand(props.beforeContainer, {
413
+ required: true,
414
+ defaultProps: {
415
+ role: 'none'
416
+ }
417
+ }),
418
+ afterContainer: resolveShorthand(props.afterContainer, {
419
+ required: true,
420
+ defaultProps: {
421
+ role: 'none'
422
+ }
423
+ }),
424
+ beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,
425
+ afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,
426
+ totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,
427
+ virtualizerStartIndex: actualIndex,
428
+ axis,
429
+ bufferSize,
430
+ reversed
431
+ };
367
432
  }
368
- //# sourceMappingURL=useVirtualizer.js.map