@fluentui/react-virtualizer 9.0.0-alpha.4 → 9.0.0-alpha.41

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