@fluentui/react-virtualizer 9.0.0-alpha.91 → 9.0.0-alpha.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @fluentui/react-virtualizer
2
2
 
3
- This log was last generated on Wed, 22 Jan 2025 13:55:24 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 07 Feb 2025 10:40:53 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-alpha.92](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.92)
8
+
9
+ Fri, 07 Feb 2025 10:40:53 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.91..@fluentui/react-virtualizer_v9.0.0-alpha.92)
11
+
12
+ ### Changes
13
+
14
+ - fix: Fix regression of child render function update ([PR #33788](https://github.com/microsoft/fluentui/pull/33788) by mifraser@microsoft.com)
15
+
7
16
  ## [9.0.0-alpha.91](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.91)
8
17
 
9
- Wed, 22 Jan 2025 13:55:24 GMT
18
+ Wed, 22 Jan 2025 14:00:13 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.90..@fluentui/react-virtualizer_v9.0.0-alpha.91)
11
20
 
12
21
  ### Changes
@@ -64,6 +64,8 @@ export function useVirtualizer_unstable(props) {
64
64
  const initializeScrollingTimer = React.useCallback(()=>{
65
65
  if (!enableScrollLoad) {
66
66
  // Disabled by default for reduction of render callbacks
67
+ setIsScrolling(false);
68
+ clearScrollTimer();
67
69
  return;
68
70
  }
69
71
  /*
@@ -431,16 +433,14 @@ export function useVirtualizer_unstable(props) {
431
433
  }, []);
432
434
  /*
433
435
  * forceUpdate:
434
- * We only want to trigger this when scrollLoading is enabled and set to false,
436
+ * We only want to trigger this when child render or scroll loading changes,
435
437
  * it will force re-render all children elements
436
438
  */ const forceUpdate = React.useReducer(()=>({}), {})[1];
437
439
  // If the user passes in an updated renderChild function - update current children
438
440
  React.useEffect(()=>{
439
441
  if (actualIndex >= 0) {
440
442
  updateChildRows(actualIndex);
441
- if (enableScrollLoad && !isScrolling) {
442
- forceUpdate();
443
- }
443
+ forceUpdate();
444
444
  }
445
445
  // eslint-disable-next-line react-hooks/exhaustive-deps
446
446
  }, [
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["import * as React from 'react';\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\n\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { slot, useTimeout } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n 'use no memo';\n\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n scrollViewRef,\n enableScrollLoad,\n updateScrollPosition,\n gap = 0,\n } = props;\n\n /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/\n const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);\n\n // We use this ref as a constant source to access the virtualizer's state imperatively\n const actualIndexRef = React.useRef<number>(_virtualizerContext.contextIndex);\n\n const flaggedIndex = React.useRef<number | null>(null);\n const actualIndex = _virtualizerContext.contextIndex;\n\n // Just in case our ref gets out of date vs the context during a re-render\n if (_virtualizerContext.contextIndex !== actualIndexRef.current) {\n actualIndexRef.current = _virtualizerContext.contextIndex;\n }\n const setActualIndex = React.useCallback(\n (index: number) => {\n actualIndexRef.current = index;\n _virtualizerContext.setContextIndex(index);\n },\n [_virtualizerContext],\n );\n\n // Store ref to before padding element\n const beforeElementRef = React.useRef<HTMLElement | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = React.useRef<HTMLElement | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n\n // The internal tracking REF for child array (updates often).\n const childArray = React.useRef<React.ReactNode[]>(new Array(virtualizerLength));\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n }\n\n for (let index = 0; index < numItems; index++) {\n const _gap = index < numItems - 1 ? gap : 0;\n childSizes.current[index] = getItemSize(index) + _gap;\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const [isScrolling, setIsScrolling] = React.useState<boolean>(false);\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const scrollCounter = React.useRef<number>(0);\n\n const initializeScrollingTimer = React.useCallback(() => {\n if (!enableScrollLoad) {\n // Disabled by default for reduction of render callbacks\n return;\n }\n /*\n * This can be considered the 'velocity' required to start 'isScrolling'\n * INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling\n * INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset\n * - Maybe we should let users customize these in the future.\n */\n const INIT_SCROLL_FLAG_REQ = 10;\n const INIT_SCROLL_FLAG_DELAY = 100;\n\n scrollCounter.current++;\n if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {\n setIsScrolling(true);\n }\n clearScrollTimer();\n setScrollTimer(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n }, [clearScrollTimer, setScrollTimer, enableScrollLoad]);\n\n React.useEffect(() => {\n initializeScrollingTimer();\n }, [actualIndex, initializeScrollingTimer]);\n\n const updateChildRows = React.useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n return;\n }\n\n /*\n We reset the array every time to ensure children are re-rendered\n This function should only be called when update is nessecary\n */\n childArray.current = new Array(virtualizerLength);\n const _actualIndex = Math.max(newIndex, 0);\n const end = Math.min(_actualIndex + virtualizerLength, numItems);\n for (let i = _actualIndex; i < end; i++) {\n childArray.current[i - _actualIndex] = renderChild(i, isScrolling);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const updateCurrentItemSizes = React.useCallback(\n (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const _gap = i < numItems - 1 ? gap : 0;\n const newSize = getItemSize(i) + _gap;\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n },\n [getItemSize, numItems, virtualizerLength, gap],\n );\n\n const batchUpdateNewIndex = React.useCallback(\n (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n },\n [setActualIndex, updateChildRows, updateCurrentItemSizes],\n );\n\n const findIndexRecursive = React.useCallback(\n (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return actualIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n },\n [actualIndex],\n );\n\n const getIndexFromSizeArray = React.useCallback(\n (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n },\n [findIndexRecursive],\n );\n const getIndexFromScrollPosition = React.useCallback(\n (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / (itemSize + gap));\n }\n\n return getIndexFromSizeArray(scrollPos);\n },\n [getIndexFromSizeArray, getItemSize, itemSize, gap],\n );\n\n const calculateTotalSize = React.useCallback(() => {\n if (!getItemSize) {\n return (itemSize + gap) * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n }, [getItemSize, itemSize, numItems, gap]);\n\n const calculateBefore = React.useCallback(() => {\n const currentIndex = Math.min(actualIndex, numItems - 1);\n\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * (itemSize + gap);\n }\n\n if (currentIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, gap]);\n\n const calculateAfter = React.useCallback(() => {\n if (numItems === 0 || actualIndex + virtualizerLength >= numItems) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex;\n return remainingItems * (itemSize + gap) - gap;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, virtualizerLength, gap]);\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n React.useCallback(\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n // eslint-disable-next-line no-restricted-globals\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n if (entries.length === 0) {\n // No entries found, return.\n return;\n }\n // Find the latest entry that is intersecting\n const sortedEntries = entries.sort((entry1, entry2) => entry2.time - entry1.time);\n const latestEntry = sortedEntries.find(entry => {\n return entry.isIntersecting;\n });\n\n if (!latestEntry) {\n return;\n }\n\n // We have to be sure our item sizes are up to date with current indexed ref before calculation\n // Check if we still need\n updateCurrentItemSizes(actualIndexRef.current);\n\n const calculateOverBuffer = (): number => {\n /**\n * We avoid using the scroll ref scrollTop, it may be incorrect\n * as virtualization may exist within a scroll view with other elements\n * The benefit of using IO is that we can detect relative scrolls,\n * so any items can be placed around the virtualizer in the scroll view\n */\n let measurementPos = 0;\n if (latestEntry.target === afterElementRef.current) {\n // Get after buffers position\n measurementPos = calculateTotalSize() - calculateAfter();\n\n // Get exact intersection position based on overflow size (how far into IO did we scroll?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Add to original after position\n measurementPos += overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos -= bufferSize;\n // we hit the after buffer and detected the end of view, we need to find the start index.\n measurementPos -= containerSizeRef.current ?? 0;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const hOverflowReversed = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const wOverflow = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const wOverflowReversed = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n // Get before buffers position\n measurementPos = calculateBefore();\n\n // Get exact intersection position based on overflow size (how far into window did we scroll IO?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n\n // Minus from original before position\n measurementPos -= overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos += bufferSize;\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const hOverflowReversed = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const wOverflow = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const wOverflowReversed = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n }\n\n return measurementPos;\n };\n\n // Get exact relative 'scrollTop' via IO values\n const measurementPos = calculateOverBuffer();\n\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n\n const startIndex = getIndexFromScrollPosition(measurementPos) - bufferItems;\n\n // Safety limits\n const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);\n flushSync(() => {\n // Callback to allow measure functions to check virtualizer length\n if (newStartIndex + virtualizerLength >= numItems && actualIndex + virtualizerLength >= numItems) {\n // We've already hit the end, no need to update state.\n return;\n }\n updateScrollPosition?.(measurementPos);\n if (actualIndex !== newStartIndex) {\n batchUpdateNewIndex(newStartIndex);\n }\n });\n },\n [\n actualIndex,\n virtualizerLength,\n axis,\n reversed,\n numItems,\n bufferSize,\n bufferItems,\n containerSizeRef,\n updateScrollPosition,\n batchUpdateNewIndex,\n calculateAfter,\n calculateBefore,\n calculateTotalSize,\n getIndexFromScrollPosition,\n updateCurrentItemSizes,\n ],\n ),\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const setBeforeRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n // Initialize the size array before first render.\n const hasInitialized = React.useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n React.useImperativeHandle(\n imperativeVirtualizerRef,\n () => {\n return {\n progressiveSizes: childProgressiveSizes,\n nodeSizes: childSizes,\n setFlaggedIndex: (index: number | null) => (flaggedIndex.current = index),\n currentIndex: actualIndexRef,\n };\n },\n [childProgressiveSizes, childSizes],\n );\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n React.useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /*\n * forceUpdate:\n * We only want to trigger this when scrollLoading is enabled and set to false,\n * it will force re-render all children elements\n */\n const forceUpdate = React.useReducer(() => ({}), {})[1];\n // If the user passes in an updated renderChild function - update current children\n React.useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n if (enableScrollLoad && !isScrolling) {\n forceUpdate();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, isScrolling]);\n\n React.useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize, gap]);\n\n // Effect to check flag index on updates\n React.useEffect(() => {\n if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {\n return;\n }\n if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {\n onRenderedFlaggedIndex(flaggedIndex.current);\n flaggedIndex.current = null;\n }\n }, [actualIndex, onRenderedFlaggedIndex, virtualizerLength]);\n\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {\n updateChildRows(actualIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && actualIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: slot.always(props.before, {\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n after: slot.always(props.after, {\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeContainer: slot.always(props.beforeContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n afterContainer: slot.always(props.afterContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex: actualIndex,\n axis,\n bufferSize,\n reversed,\n childSizes,\n childProgressiveSizes,\n };\n}\n"],"names":["React","useIntersectionObserver","useVirtualizerContextState_unstable","slot","useTimeout","flushSync","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","containerSizeRef","scrollViewRef","enableScrollLoad","updateScrollPosition","gap","_virtualizerContext","actualIndexRef","useRef","contextIndex","flaggedIndex","actualIndex","current","setActualIndex","useCallback","index","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","populateSizeArrays","length","_gap","isScrolling","setIsScrolling","useState","setScrollTimer","clearScrollTimer","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","useEffect","updateChildRows","newIndex","_actualIndex","max","end","min","i","updateCurrentItemSizes","endIndex","startIndex","didUpdate","newSize","prevSize","batchUpdateNewIndex","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","getIndexFromScrollPosition","calculateTotalSize","calculateBefore","currentIndex","calculateAfter","lastItemIndex","remainingItems","setObserverList","entries","observer","sortedEntries","sort","entry1","entry2","time","latestEntry","find","entry","isIntersecting","calculateOverBuffer","measurementPos","target","overflowAmount","intersectionRect","height","width","hOverflow","boundingClientRect","top","hOverflowReversed","bottom","wOverflow","left","wOverflowReversed","right","widthOverflow","heightOverflow","additionalOverflow","maxIndex","newStartIndex","root","rootMargin","threshold","setBeforeRef","element","newList","push","setAfterRef","hasInitialized","initializeSizeArray","useImperativeHandle","progressiveSizes","nodeSizes","setFlaggedIndex","forceUpdate","useReducer","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","always","defaultProps","ref","role","elementType","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
+ {"version":3,"sources":["../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["import * as React from 'react';\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\n\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { slot, useTimeout } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n 'use no memo';\n\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n scrollViewRef,\n enableScrollLoad,\n updateScrollPosition,\n gap = 0,\n } = props;\n\n /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/\n const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);\n\n // We use this ref as a constant source to access the virtualizer's state imperatively\n const actualIndexRef = React.useRef<number>(_virtualizerContext.contextIndex);\n\n const flaggedIndex = React.useRef<number | null>(null);\n const actualIndex = _virtualizerContext.contextIndex;\n\n // Just in case our ref gets out of date vs the context during a re-render\n if (_virtualizerContext.contextIndex !== actualIndexRef.current) {\n actualIndexRef.current = _virtualizerContext.contextIndex;\n }\n const setActualIndex = React.useCallback(\n (index: number) => {\n actualIndexRef.current = index;\n _virtualizerContext.setContextIndex(index);\n },\n [_virtualizerContext],\n );\n\n // Store ref to before padding element\n const beforeElementRef = React.useRef<HTMLElement | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = React.useRef<HTMLElement | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n\n // The internal tracking REF for child array (updates often).\n const childArray = React.useRef<React.ReactNode[]>(new Array(virtualizerLength));\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n }\n\n for (let index = 0; index < numItems; index++) {\n const _gap = index < numItems - 1 ? gap : 0;\n childSizes.current[index] = getItemSize(index) + _gap;\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const [isScrolling, setIsScrolling] = React.useState<boolean>(false);\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const scrollCounter = React.useRef<number>(0);\n\n const initializeScrollingTimer = React.useCallback(() => {\n if (!enableScrollLoad) {\n // Disabled by default for reduction of render callbacks\n setIsScrolling(false);\n clearScrollTimer();\n return;\n }\n /*\n * This can be considered the 'velocity' required to start 'isScrolling'\n * INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling\n * INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset\n * - Maybe we should let users customize these in the future.\n */\n const INIT_SCROLL_FLAG_REQ = 10;\n const INIT_SCROLL_FLAG_DELAY = 100;\n\n scrollCounter.current++;\n if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {\n setIsScrolling(true);\n }\n clearScrollTimer();\n setScrollTimer(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n }, [clearScrollTimer, setScrollTimer, enableScrollLoad]);\n\n React.useEffect(() => {\n initializeScrollingTimer();\n }, [actualIndex, initializeScrollingTimer]);\n\n const updateChildRows = React.useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n return;\n }\n\n /*\n We reset the array every time to ensure children are re-rendered\n This function should only be called when update is nessecary\n */\n childArray.current = new Array(virtualizerLength);\n const _actualIndex = Math.max(newIndex, 0);\n const end = Math.min(_actualIndex + virtualizerLength, numItems);\n for (let i = _actualIndex; i < end; i++) {\n childArray.current[i - _actualIndex] = renderChild(i, isScrolling);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const updateCurrentItemSizes = React.useCallback(\n (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const _gap = i < numItems - 1 ? gap : 0;\n const newSize = getItemSize(i) + _gap;\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n },\n [getItemSize, numItems, virtualizerLength, gap],\n );\n\n const batchUpdateNewIndex = React.useCallback(\n (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n },\n [setActualIndex, updateChildRows, updateCurrentItemSizes],\n );\n\n const findIndexRecursive = React.useCallback(\n (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return actualIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n },\n [actualIndex],\n );\n\n const getIndexFromSizeArray = React.useCallback(\n (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n },\n [findIndexRecursive],\n );\n const getIndexFromScrollPosition = React.useCallback(\n (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / (itemSize + gap));\n }\n\n return getIndexFromSizeArray(scrollPos);\n },\n [getIndexFromSizeArray, getItemSize, itemSize, gap],\n );\n\n const calculateTotalSize = React.useCallback(() => {\n if (!getItemSize) {\n return (itemSize + gap) * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n }, [getItemSize, itemSize, numItems, gap]);\n\n const calculateBefore = React.useCallback(() => {\n const currentIndex = Math.min(actualIndex, numItems - 1);\n\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * (itemSize + gap);\n }\n\n if (currentIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, gap]);\n\n const calculateAfter = React.useCallback(() => {\n if (numItems === 0 || actualIndex + virtualizerLength >= numItems) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex;\n return remainingItems * (itemSize + gap) - gap;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, virtualizerLength, gap]);\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n React.useCallback(\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n // eslint-disable-next-line no-restricted-globals\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n if (entries.length === 0) {\n // No entries found, return.\n return;\n }\n // Find the latest entry that is intersecting\n const sortedEntries = entries.sort((entry1, entry2) => entry2.time - entry1.time);\n const latestEntry = sortedEntries.find(entry => {\n return entry.isIntersecting;\n });\n\n if (!latestEntry) {\n return;\n }\n\n // We have to be sure our item sizes are up to date with current indexed ref before calculation\n // Check if we still need\n updateCurrentItemSizes(actualIndexRef.current);\n\n const calculateOverBuffer = (): number => {\n /**\n * We avoid using the scroll ref scrollTop, it may be incorrect\n * as virtualization may exist within a scroll view with other elements\n * The benefit of using IO is that we can detect relative scrolls,\n * so any items can be placed around the virtualizer in the scroll view\n */\n let measurementPos = 0;\n if (latestEntry.target === afterElementRef.current) {\n // Get after buffers position\n measurementPos = calculateTotalSize() - calculateAfter();\n\n // Get exact intersection position based on overflow size (how far into IO did we scroll?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Add to original after position\n measurementPos += overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos -= bufferSize;\n // we hit the after buffer and detected the end of view, we need to find the start index.\n measurementPos -= containerSizeRef.current ?? 0;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const hOverflowReversed = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const wOverflow = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const wOverflowReversed = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n // Get before buffers position\n measurementPos = calculateBefore();\n\n // Get exact intersection position based on overflow size (how far into window did we scroll IO?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n\n // Minus from original before position\n measurementPos -= overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos += bufferSize;\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const hOverflowReversed = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const wOverflow = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const wOverflowReversed = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n }\n\n return measurementPos;\n };\n\n // Get exact relative 'scrollTop' via IO values\n const measurementPos = calculateOverBuffer();\n\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n\n const startIndex = getIndexFromScrollPosition(measurementPos) - bufferItems;\n\n // Safety limits\n const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);\n flushSync(() => {\n // Callback to allow measure functions to check virtualizer length\n if (newStartIndex + virtualizerLength >= numItems && actualIndex + virtualizerLength >= numItems) {\n // We've already hit the end, no need to update state.\n return;\n }\n updateScrollPosition?.(measurementPos);\n if (actualIndex !== newStartIndex) {\n batchUpdateNewIndex(newStartIndex);\n }\n });\n },\n [\n actualIndex,\n virtualizerLength,\n axis,\n reversed,\n numItems,\n bufferSize,\n bufferItems,\n containerSizeRef,\n updateScrollPosition,\n batchUpdateNewIndex,\n calculateAfter,\n calculateBefore,\n calculateTotalSize,\n getIndexFromScrollPosition,\n updateCurrentItemSizes,\n ],\n ),\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const setBeforeRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n // Initialize the size array before first render.\n const hasInitialized = React.useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n React.useImperativeHandle(\n imperativeVirtualizerRef,\n () => {\n return {\n progressiveSizes: childProgressiveSizes,\n nodeSizes: childSizes,\n setFlaggedIndex: (index: number | null) => (flaggedIndex.current = index),\n currentIndex: actualIndexRef,\n };\n },\n [childProgressiveSizes, childSizes],\n );\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n React.useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /*\n * forceUpdate:\n * We only want to trigger this when child render or scroll loading changes,\n * it will force re-render all children elements\n */\n const forceUpdate = React.useReducer(() => ({}), {})[1];\n // If the user passes in an updated renderChild function - update current children\n React.useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, isScrolling]);\n\n React.useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize, gap]);\n\n // Effect to check flag index on updates\n React.useEffect(() => {\n if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {\n return;\n }\n if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {\n onRenderedFlaggedIndex(flaggedIndex.current);\n flaggedIndex.current = null;\n }\n }, [actualIndex, onRenderedFlaggedIndex, virtualizerLength]);\n\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {\n updateChildRows(actualIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && actualIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: slot.always(props.before, {\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n after: slot.always(props.after, {\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeContainer: slot.always(props.beforeContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n afterContainer: slot.always(props.afterContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex: actualIndex,\n axis,\n bufferSize,\n reversed,\n childSizes,\n childProgressiveSizes,\n };\n}\n"],"names":["React","useIntersectionObserver","useVirtualizerContextState_unstable","slot","useTimeout","flushSync","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","containerSizeRef","scrollViewRef","enableScrollLoad","updateScrollPosition","gap","_virtualizerContext","actualIndexRef","useRef","contextIndex","flaggedIndex","actualIndex","current","setActualIndex","useCallback","index","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","populateSizeArrays","length","_gap","isScrolling","setIsScrolling","useState","setScrollTimer","clearScrollTimer","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","useEffect","updateChildRows","newIndex","_actualIndex","max","end","min","i","updateCurrentItemSizes","endIndex","startIndex","didUpdate","newSize","prevSize","batchUpdateNewIndex","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","getIndexFromScrollPosition","calculateTotalSize","calculateBefore","currentIndex","calculateAfter","lastItemIndex","remainingItems","setObserverList","entries","observer","sortedEntries","sort","entry1","entry2","time","latestEntry","find","entry","isIntersecting","calculateOverBuffer","measurementPos","target","overflowAmount","intersectionRect","height","width","hOverflow","boundingClientRect","top","hOverflowReversed","bottom","wOverflow","left","wOverflowReversed","right","widthOverflow","heightOverflow","additionalOverflow","maxIndex","newStartIndex","root","rootMargin","threshold","setBeforeRef","element","newList","push","setAfterRef","hasInitialized","initializeSizeArray","useImperativeHandle","progressiveSizes","nodeSizes","setFlaggedIndex","forceUpdate","useReducer","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","always","defaultProps","ref","role","elementType","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,SAASC,uBAAuB,QAAQ,sCAAsC;AAC9E,SAASC,mCAA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AGtC,UAAU;QAClGkD,gBAAgBzB;IAClB;IAEA,MAAM2G,qBAAqBT,eAAejG,OAAO,IAAID,eAAe;IACpE,OAAO;QACL4G,YAAY;YACVC,QAAQ;YACRC,OAAO;YACPC,iBAAiB;YACjBC,gBAAgB;QAClB;QACAC,qBAAqBtG,WAAWV,OAAO;QACvC4G,QAAQ5I,KAAKiJ,MAAM,CAAC7I,MAAMwI,MAAM,EAAE;YAChCM,cAAc;gBACZC,KAAKvB;gBACLwB,MAAM;YACR;YACAC,aAAa;QACf;QACAR,OAAO7I,KAAKiJ,MAAM,CAAC7I,MAAMyI,KAAK,EAAE;YAC9BK,cAAc;gBACZC,KAAKnB;gBACLoB,MAAM;YACR;YACAC,aAAa;QACf;QACAP,iBAAiB9I,KAAKiJ,MAAM,CAAC7I,MAAM0I,eAAe,EAAE;YAClDI,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAN,gBAAgB/I,KAAKiJ,MAAM,CAAC7I,MAAM2I,cAAc,EAAE;YAChDG,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAC,oBAAoBZ,qBAAqBvD,oBAAoB;QAC7DoE,mBAAmBb,qBAAqBrD,mBAAmB;QAC3DmE,wBAAwBd,qBAAqBxD,uBAAuB3E,oBAAoBF;QACxFoJ,uBAAuB1H;QACvBf;QACAF;QACAG;QACAsB;QACAE;IACF;AACF"}
@@ -75,6 +75,8 @@ function useVirtualizer_unstable(props) {
75
75
  const initializeScrollingTimer = _react.useCallback(()=>{
76
76
  if (!enableScrollLoad) {
77
77
  // Disabled by default for reduction of render callbacks
78
+ setIsScrolling(false);
79
+ clearScrollTimer();
78
80
  return;
79
81
  }
80
82
  /*
@@ -441,16 +443,14 @@ function useVirtualizer_unstable(props) {
441
443
  }, []);
442
444
  /*
443
445
  * forceUpdate:
444
- * We only want to trigger this when scrollLoading is enabled and set to false,
446
+ * We only want to trigger this when child render or scroll loading changes,
445
447
  * it will force re-render all children elements
446
448
  */ const forceUpdate = _react.useReducer(()=>({}), {})[1];
447
449
  // If the user passes in an updated renderChild function - update current children
448
450
  _react.useEffect(()=>{
449
451
  if (actualIndex >= 0) {
450
452
  updateChildRows(actualIndex);
451
- if (enableScrollLoad && !isScrolling) {
452
- forceUpdate();
453
- }
453
+ forceUpdate();
454
454
  }
455
455
  // eslint-disable-next-line react-hooks/exhaustive-deps
456
456
  }, [
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["import * as React from 'react';\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\n\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { slot, useTimeout } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n 'use no memo';\n\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n scrollViewRef,\n enableScrollLoad,\n updateScrollPosition,\n gap = 0,\n } = props;\n\n /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/\n const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);\n\n // We use this ref as a constant source to access the virtualizer's state imperatively\n const actualIndexRef = React.useRef<number>(_virtualizerContext.contextIndex);\n\n const flaggedIndex = React.useRef<number | null>(null);\n const actualIndex = _virtualizerContext.contextIndex;\n\n // Just in case our ref gets out of date vs the context during a re-render\n if (_virtualizerContext.contextIndex !== actualIndexRef.current) {\n actualIndexRef.current = _virtualizerContext.contextIndex;\n }\n const setActualIndex = React.useCallback(\n (index: number) => {\n actualIndexRef.current = index;\n _virtualizerContext.setContextIndex(index);\n },\n [_virtualizerContext],\n );\n\n // Store ref to before padding element\n const beforeElementRef = React.useRef<HTMLElement | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = React.useRef<HTMLElement | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n\n // The internal tracking REF for child array (updates often).\n const childArray = React.useRef<React.ReactNode[]>(new Array(virtualizerLength));\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n }\n\n for (let index = 0; index < numItems; index++) {\n const _gap = index < numItems - 1 ? gap : 0;\n childSizes.current[index] = getItemSize(index) + _gap;\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const [isScrolling, setIsScrolling] = React.useState<boolean>(false);\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const scrollCounter = React.useRef<number>(0);\n\n const initializeScrollingTimer = React.useCallback(() => {\n if (!enableScrollLoad) {\n // Disabled by default for reduction of render callbacks\n return;\n }\n /*\n * This can be considered the 'velocity' required to start 'isScrolling'\n * INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling\n * INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset\n * - Maybe we should let users customize these in the future.\n */\n const INIT_SCROLL_FLAG_REQ = 10;\n const INIT_SCROLL_FLAG_DELAY = 100;\n\n scrollCounter.current++;\n if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {\n setIsScrolling(true);\n }\n clearScrollTimer();\n setScrollTimer(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n }, [clearScrollTimer, setScrollTimer, enableScrollLoad]);\n\n React.useEffect(() => {\n initializeScrollingTimer();\n }, [actualIndex, initializeScrollingTimer]);\n\n const updateChildRows = React.useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n return;\n }\n\n /*\n We reset the array every time to ensure children are re-rendered\n This function should only be called when update is nessecary\n */\n childArray.current = new Array(virtualizerLength);\n const _actualIndex = Math.max(newIndex, 0);\n const end = Math.min(_actualIndex + virtualizerLength, numItems);\n for (let i = _actualIndex; i < end; i++) {\n childArray.current[i - _actualIndex] = renderChild(i, isScrolling);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const updateCurrentItemSizes = React.useCallback(\n (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const _gap = i < numItems - 1 ? gap : 0;\n const newSize = getItemSize(i) + _gap;\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n },\n [getItemSize, numItems, virtualizerLength, gap],\n );\n\n const batchUpdateNewIndex = React.useCallback(\n (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n },\n [setActualIndex, updateChildRows, updateCurrentItemSizes],\n );\n\n const findIndexRecursive = React.useCallback(\n (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return actualIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n },\n [actualIndex],\n );\n\n const getIndexFromSizeArray = React.useCallback(\n (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n },\n [findIndexRecursive],\n );\n const getIndexFromScrollPosition = React.useCallback(\n (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / (itemSize + gap));\n }\n\n return getIndexFromSizeArray(scrollPos);\n },\n [getIndexFromSizeArray, getItemSize, itemSize, gap],\n );\n\n const calculateTotalSize = React.useCallback(() => {\n if (!getItemSize) {\n return (itemSize + gap) * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n }, [getItemSize, itemSize, numItems, gap]);\n\n const calculateBefore = React.useCallback(() => {\n const currentIndex = Math.min(actualIndex, numItems - 1);\n\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * (itemSize + gap);\n }\n\n if (currentIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, gap]);\n\n const calculateAfter = React.useCallback(() => {\n if (numItems === 0 || actualIndex + virtualizerLength >= numItems) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex;\n return remainingItems * (itemSize + gap) - gap;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, virtualizerLength, gap]);\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n React.useCallback(\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n // eslint-disable-next-line no-restricted-globals\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n if (entries.length === 0) {\n // No entries found, return.\n return;\n }\n // Find the latest entry that is intersecting\n const sortedEntries = entries.sort((entry1, entry2) => entry2.time - entry1.time);\n const latestEntry = sortedEntries.find(entry => {\n return entry.isIntersecting;\n });\n\n if (!latestEntry) {\n return;\n }\n\n // We have to be sure our item sizes are up to date with current indexed ref before calculation\n // Check if we still need\n updateCurrentItemSizes(actualIndexRef.current);\n\n const calculateOverBuffer = (): number => {\n /**\n * We avoid using the scroll ref scrollTop, it may be incorrect\n * as virtualization may exist within a scroll view with other elements\n * The benefit of using IO is that we can detect relative scrolls,\n * so any items can be placed around the virtualizer in the scroll view\n */\n let measurementPos = 0;\n if (latestEntry.target === afterElementRef.current) {\n // Get after buffers position\n measurementPos = calculateTotalSize() - calculateAfter();\n\n // Get exact intersection position based on overflow size (how far into IO did we scroll?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Add to original after position\n measurementPos += overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos -= bufferSize;\n // we hit the after buffer and detected the end of view, we need to find the start index.\n measurementPos -= containerSizeRef.current ?? 0;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const hOverflowReversed = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const wOverflow = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const wOverflowReversed = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n // Get before buffers position\n measurementPos = calculateBefore();\n\n // Get exact intersection position based on overflow size (how far into window did we scroll IO?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n\n // Minus from original before position\n measurementPos -= overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos += bufferSize;\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const hOverflowReversed = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const wOverflow = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const wOverflowReversed = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n }\n\n return measurementPos;\n };\n\n // Get exact relative 'scrollTop' via IO values\n const measurementPos = calculateOverBuffer();\n\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n\n const startIndex = getIndexFromScrollPosition(measurementPos) - bufferItems;\n\n // Safety limits\n const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);\n flushSync(() => {\n // Callback to allow measure functions to check virtualizer length\n if (newStartIndex + virtualizerLength >= numItems && actualIndex + virtualizerLength >= numItems) {\n // We've already hit the end, no need to update state.\n return;\n }\n updateScrollPosition?.(measurementPos);\n if (actualIndex !== newStartIndex) {\n batchUpdateNewIndex(newStartIndex);\n }\n });\n },\n [\n actualIndex,\n virtualizerLength,\n axis,\n reversed,\n numItems,\n bufferSize,\n bufferItems,\n containerSizeRef,\n updateScrollPosition,\n batchUpdateNewIndex,\n calculateAfter,\n calculateBefore,\n calculateTotalSize,\n getIndexFromScrollPosition,\n updateCurrentItemSizes,\n ],\n ),\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const setBeforeRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n // Initialize the size array before first render.\n const hasInitialized = React.useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n React.useImperativeHandle(\n imperativeVirtualizerRef,\n () => {\n return {\n progressiveSizes: childProgressiveSizes,\n nodeSizes: childSizes,\n setFlaggedIndex: (index: number | null) => (flaggedIndex.current = index),\n currentIndex: actualIndexRef,\n };\n },\n [childProgressiveSizes, childSizes],\n );\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n React.useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /*\n * forceUpdate:\n * We only want to trigger this when scrollLoading is enabled and set to false,\n * it will force re-render all children elements\n */\n const forceUpdate = React.useReducer(() => ({}), {})[1];\n // If the user passes in an updated renderChild function - update current children\n React.useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n if (enableScrollLoad && !isScrolling) {\n forceUpdate();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, isScrolling]);\n\n React.useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize, gap]);\n\n // Effect to check flag index on updates\n React.useEffect(() => {\n if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {\n return;\n }\n if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {\n onRenderedFlaggedIndex(flaggedIndex.current);\n flaggedIndex.current = null;\n }\n }, [actualIndex, onRenderedFlaggedIndex, virtualizerLength]);\n\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {\n updateChildRows(actualIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && actualIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: slot.always(props.before, {\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n after: slot.always(props.after, {\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeContainer: slot.always(props.beforeContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n afterContainer: slot.always(props.afterContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex: actualIndex,\n axis,\n bufferSize,\n reversed,\n childSizes,\n childProgressiveSizes,\n };\n}\n"],"names":["useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","containerSizeRef","scrollViewRef","enableScrollLoad","updateScrollPosition","gap","_virtualizerContext","useVirtualizerContextState_unstable","actualIndexRef","React","useRef","contextIndex","flaggedIndex","actualIndex","current","setActualIndex","useCallback","index","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","populateSizeArrays","length","_gap","isScrolling","setIsScrolling","useState","setScrollTimer","clearScrollTimer","useTimeout","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","useEffect","updateChildRows","newIndex","_actualIndex","max","end","min","i","updateCurrentItemSizes","endIndex","startIndex","didUpdate","newSize","prevSize","batchUpdateNewIndex","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","getIndexFromScrollPosition","calculateTotalSize","calculateBefore","currentIndex","calculateAfter","lastItemIndex","remainingItems","setObserverList","useIntersectionObserver","entries","observer","sortedEntries","sort","entry1","entry2","time","latestEntry","find","entry","isIntersecting","calculateOverBuffer","measurementPos","target","overflowAmount","intersectionRect","height","width","hOverflow","boundingClientRect","top","hOverflowReversed","bottom","wOverflow","left","wOverflowReversed","right","widthOverflow","heightOverflow","additionalOverflow","maxIndex","newStartIndex","flushSync","root","rootMargin","threshold","setBeforeRef","element","newList","push","setAfterRef","hasInitialized","initializeSizeArray","useImperativeHandle","progressiveSizes","nodeSizes","setFlaggedIndex","forceUpdate","useReducer","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","slot","always","defaultProps","ref","role","elementType","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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F"}
1
+ {"version":3,"sources":["../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["import * as React from 'react';\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\n\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { slot, useTimeout } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n 'use no memo';\n\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n scrollViewRef,\n enableScrollLoad,\n updateScrollPosition,\n gap = 0,\n } = props;\n\n /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/\n const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);\n\n // We use this ref as a constant source to access the virtualizer's state imperatively\n const actualIndexRef = React.useRef<number>(_virtualizerContext.contextIndex);\n\n const flaggedIndex = React.useRef<number | null>(null);\n const actualIndex = _virtualizerContext.contextIndex;\n\n // Just in case our ref gets out of date vs the context during a re-render\n if (_virtualizerContext.contextIndex !== actualIndexRef.current) {\n actualIndexRef.current = _virtualizerContext.contextIndex;\n }\n const setActualIndex = React.useCallback(\n (index: number) => {\n actualIndexRef.current = index;\n _virtualizerContext.setContextIndex(index);\n },\n [_virtualizerContext],\n );\n\n // Store ref to before padding element\n const beforeElementRef = React.useRef<HTMLElement | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = React.useRef<HTMLElement | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n\n // The internal tracking REF for child array (updates often).\n const childArray = React.useRef<React.ReactNode[]>(new Array(virtualizerLength));\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n }\n\n for (let index = 0; index < numItems; index++) {\n const _gap = index < numItems - 1 ? gap : 0;\n childSizes.current[index] = getItemSize(index) + _gap;\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const [isScrolling, setIsScrolling] = React.useState<boolean>(false);\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const scrollCounter = React.useRef<number>(0);\n\n const initializeScrollingTimer = React.useCallback(() => {\n if (!enableScrollLoad) {\n // Disabled by default for reduction of render callbacks\n setIsScrolling(false);\n clearScrollTimer();\n return;\n }\n /*\n * This can be considered the 'velocity' required to start 'isScrolling'\n * INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling\n * INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset\n * - Maybe we should let users customize these in the future.\n */\n const INIT_SCROLL_FLAG_REQ = 10;\n const INIT_SCROLL_FLAG_DELAY = 100;\n\n scrollCounter.current++;\n if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {\n setIsScrolling(true);\n }\n clearScrollTimer();\n setScrollTimer(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n }, [clearScrollTimer, setScrollTimer, enableScrollLoad]);\n\n React.useEffect(() => {\n initializeScrollingTimer();\n }, [actualIndex, initializeScrollingTimer]);\n\n const updateChildRows = React.useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n return;\n }\n\n /*\n We reset the array every time to ensure children are re-rendered\n This function should only be called when update is nessecary\n */\n childArray.current = new Array(virtualizerLength);\n const _actualIndex = Math.max(newIndex, 0);\n const end = Math.min(_actualIndex + virtualizerLength, numItems);\n for (let i = _actualIndex; i < end; i++) {\n childArray.current[i - _actualIndex] = renderChild(i, isScrolling);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const updateCurrentItemSizes = React.useCallback(\n (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const _gap = i < numItems - 1 ? gap : 0;\n const newSize = getItemSize(i) + _gap;\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n },\n [getItemSize, numItems, virtualizerLength, gap],\n );\n\n const batchUpdateNewIndex = React.useCallback(\n (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n },\n [setActualIndex, updateChildRows, updateCurrentItemSizes],\n );\n\n const findIndexRecursive = React.useCallback(\n (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return actualIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n },\n [actualIndex],\n );\n\n const getIndexFromSizeArray = React.useCallback(\n (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n },\n [findIndexRecursive],\n );\n const getIndexFromScrollPosition = React.useCallback(\n (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / (itemSize + gap));\n }\n\n return getIndexFromSizeArray(scrollPos);\n },\n [getIndexFromSizeArray, getItemSize, itemSize, gap],\n );\n\n const calculateTotalSize = React.useCallback(() => {\n if (!getItemSize) {\n return (itemSize + gap) * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n }, [getItemSize, itemSize, numItems, gap]);\n\n const calculateBefore = React.useCallback(() => {\n const currentIndex = Math.min(actualIndex, numItems - 1);\n\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * (itemSize + gap);\n }\n\n if (currentIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, gap]);\n\n const calculateAfter = React.useCallback(() => {\n if (numItems === 0 || actualIndex + virtualizerLength >= numItems) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex;\n return remainingItems * (itemSize + gap) - gap;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, virtualizerLength, gap]);\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n React.useCallback(\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n // eslint-disable-next-line no-restricted-globals\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n if (entries.length === 0) {\n // No entries found, return.\n return;\n }\n // Find the latest entry that is intersecting\n const sortedEntries = entries.sort((entry1, entry2) => entry2.time - entry1.time);\n const latestEntry = sortedEntries.find(entry => {\n return entry.isIntersecting;\n });\n\n if (!latestEntry) {\n return;\n }\n\n // We have to be sure our item sizes are up to date with current indexed ref before calculation\n // Check if we still need\n updateCurrentItemSizes(actualIndexRef.current);\n\n const calculateOverBuffer = (): number => {\n /**\n * We avoid using the scroll ref scrollTop, it may be incorrect\n * as virtualization may exist within a scroll view with other elements\n * The benefit of using IO is that we can detect relative scrolls,\n * so any items can be placed around the virtualizer in the scroll view\n */\n let measurementPos = 0;\n if (latestEntry.target === afterElementRef.current) {\n // Get after buffers position\n measurementPos = calculateTotalSize() - calculateAfter();\n\n // Get exact intersection position based on overflow size (how far into IO did we scroll?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Add to original after position\n measurementPos += overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos -= bufferSize;\n // we hit the after buffer and detected the end of view, we need to find the start index.\n measurementPos -= containerSizeRef.current ?? 0;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const hOverflowReversed = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const wOverflow = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const wOverflowReversed = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n // Get before buffers position\n measurementPos = calculateBefore();\n\n // Get exact intersection position based on overflow size (how far into window did we scroll IO?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n\n // Minus from original before position\n measurementPos -= overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos += bufferSize;\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const hOverflowReversed = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const wOverflow = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const wOverflowReversed = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n }\n\n return measurementPos;\n };\n\n // Get exact relative 'scrollTop' via IO values\n const measurementPos = calculateOverBuffer();\n\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n\n const startIndex = getIndexFromScrollPosition(measurementPos) - bufferItems;\n\n // Safety limits\n const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);\n flushSync(() => {\n // Callback to allow measure functions to check virtualizer length\n if (newStartIndex + virtualizerLength >= numItems && actualIndex + virtualizerLength >= numItems) {\n // We've already hit the end, no need to update state.\n return;\n }\n updateScrollPosition?.(measurementPos);\n if (actualIndex !== newStartIndex) {\n batchUpdateNewIndex(newStartIndex);\n }\n });\n },\n [\n actualIndex,\n virtualizerLength,\n axis,\n reversed,\n numItems,\n bufferSize,\n bufferItems,\n containerSizeRef,\n updateScrollPosition,\n batchUpdateNewIndex,\n calculateAfter,\n calculateBefore,\n calculateTotalSize,\n getIndexFromScrollPosition,\n updateCurrentItemSizes,\n ],\n ),\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const setBeforeRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n // Initialize the size array before first render.\n const hasInitialized = React.useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n React.useImperativeHandle(\n imperativeVirtualizerRef,\n () => {\n return {\n progressiveSizes: childProgressiveSizes,\n nodeSizes: childSizes,\n setFlaggedIndex: (index: number | null) => (flaggedIndex.current = index),\n currentIndex: actualIndexRef,\n };\n },\n [childProgressiveSizes, childSizes],\n );\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n React.useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /*\n * forceUpdate:\n * We only want to trigger this when child render or scroll loading changes,\n * it will force re-render all children elements\n */\n const forceUpdate = React.useReducer(() => ({}), {})[1];\n // If the user passes in an updated renderChild function - update current children\n React.useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, isScrolling]);\n\n React.useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize, gap]);\n\n // Effect to check flag index on updates\n React.useEffect(() => {\n if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {\n return;\n }\n if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {\n onRenderedFlaggedIndex(flaggedIndex.current);\n flaggedIndex.current = null;\n }\n }, [actualIndex, onRenderedFlaggedIndex, virtualizerLength]);\n\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {\n updateChildRows(actualIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && actualIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: slot.always(props.before, {\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n after: slot.always(props.after, {\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeContainer: slot.always(props.beforeContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n afterContainer: slot.always(props.afterContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex: actualIndex,\n axis,\n bufferSize,\n reversed,\n childSizes,\n childProgressiveSizes,\n };\n}\n"],"names":["useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","containerSizeRef","scrollViewRef","enableScrollLoad","updateScrollPosition","gap","_virtualizerContext","useVirtualizerContextState_unstable","actualIndexRef","React","useRef","contextIndex","flaggedIndex","actualIndex","current","setActualIndex","useCallback","index","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","populateSizeArrays","length","_gap","isScrolling","setIsScrolling","useState","setScrollTimer","clearScrollTimer","useTimeout","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","useEffect","updateChildRows","newIndex","_actualIndex","max","end","min","i","updateCurrentItemSizes","endIndex","startIndex","didUpdate","newSize","prevSize","batchUpdateNewIndex","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","getIndexFromScrollPosition","calculateTotalSize","calculateBefore","currentIndex","calculateAfter","lastItemIndex","remainingItems","setObserverList","useIntersectionObserver","entries","observer","sortedEntries","sort","entry1","entry2","time","latestEntry","find","entry","isIntersecting","calculateOverBuffer","measurementPos","target","overflowAmount","intersectionRect","height","width","hOverflow","boundingClientRect","top","hOverflowReversed","bottom","wOverflow","left","wOverflowReversed","right","widthOverflow","heightOverflow","additionalOverflow","maxIndex","newStartIndex","flushSync","root","rootMargin","threshold","setBeforeRef","element","newList","push","setAfterRef","hasInitialized","initializeSizeArray","useImperativeHandle","progressiveSizes","nodeSizes","setFlaggedIndex","forceUpdate","useReducer","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","slot","always","defaultProps","ref","role","elementType","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;;iEARO;yCAGiB;2BACY;gCACnB;0BACP;AAE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V,OAAO,CAACY,MAAM,KAAKgG,cAAc7G,cAAcW,WAAWV,OAAO,CAACY,MAAM,GAAGxC,UAAU;QAClGqD,gBAAgB1B;IAClB;IAEA,MAAM8G,qBAAqBT,eAAepG,OAAO,IAAID,eAAe;IACpE,OAAO;QACL+G,YAAY;YACVC,QAAQ;YACRC,OAAO;YACPC,iBAAiB;YACjBC,gBAAgB;QAClB;QACAC,qBAAqBzG,WAAWV,OAAO;QACvC+G,QAAQK,oBAAAA,CAAKC,MAAM,CAACnJ,MAAM6I,MAAM,EAAE;YAChCO,cAAc;gBACZC,KAAKxB;gBACLyB,MAAM;YACR;YACAC,aAAa;QACf;QACAT,OAAOI,oBAAAA,CAAKC,MAAM,CAACnJ,MAAM8I,KAAK,EAAE;YAC9BM,cAAc;gBACZC,KAAKpB;gBACLqB,MAAM;YACR;YACAC,aAAa;QACf;QACAR,iBAAiBG,oBAAAA,CAAKC,MAAM,CAACnJ,MAAM+I,eAAe,EAAE;YAClDK,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAP,gBAAgBE,oBAAAA,CAAKC,MAAM,CAACnJ,MAAMgJ,cAAc,EAAE;YAChDI,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAC,oBAAoBb,qBAAqBzD,oBAAoB;QAC7DuE,mBAAmBd,qBAAqBvD,mBAAmB;QAC3DsE,wBAAwBf,qBAAqB1D,uBAAuB9E,oBAAoBF;QACxF0J,uBAAuB9H;QACvBjB;QACAF;QACAG;QACAwB;QACAE;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-virtualizer",
3
- "version": "9.0.0-alpha.91",
3
+ "version": "9.0.0-alpha.92",
4
4
  "description": "Generic and composable virtualizer framework built on browser intersection observer",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",