@fluentui/react-virtualizer 9.0.0-alpha.84 → 9.0.0-alpha.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/dist/index.d.ts +78 -5
  3. package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
  4. package/lib/components/Virtualizer/useVirtualizer.js +208 -143
  5. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
  6. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +3 -3
  7. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
  8. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
  9. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +11 -9
  10. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
  11. package/lib/hooks/hooks.types.js.map +1 -1
  12. package/lib/hooks/index.js +1 -0
  13. package/lib/hooks/index.js.map +1 -1
  14. package/lib/hooks/useDynamicVirtualizerMeasure.js +63 -45
  15. package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
  16. package/lib/hooks/useMeasureList.js +14 -2
  17. package/lib/hooks/useMeasureList.js.map +1 -1
  18. package/lib/hooks/useResizeObserverRef.js +11 -1
  19. package/lib/hooks/useResizeObserverRef.js.map +1 -1
  20. package/lib/hooks/useVirtualizerMeasure.js +31 -15
  21. package/lib/hooks/useVirtualizerMeasure.js.map +1 -1
  22. package/lib/index.js +1 -1
  23. package/lib/index.js.map +1 -1
  24. package/lib/utilities/VirtualizerContext/VirtualizerContext.js +12 -14
  25. package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -1
  26. package/lib/utilities/VirtualizerContext/types.js +1 -3
  27. package/lib/utilities/VirtualizerContext/types.js.map +1 -1
  28. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
  29. package/lib-commonjs/components/Virtualizer/useVirtualizer.js +206 -141
  30. package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
  31. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +3 -3
  32. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
  33. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
  34. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +11 -9
  35. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
  36. package/lib-commonjs/hooks/hooks.types.js.map +1 -1
  37. package/lib-commonjs/hooks/index.js +1 -0
  38. package/lib-commonjs/hooks/index.js.map +1 -1
  39. package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js +62 -44
  40. package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
  41. package/lib-commonjs/hooks/useMeasureList.js +14 -2
  42. package/lib-commonjs/hooks/useMeasureList.js.map +1 -1
  43. package/lib-commonjs/hooks/useResizeObserverRef.js +11 -1
  44. package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -1
  45. package/lib-commonjs/hooks/useVirtualizerMeasure.js +31 -15
  46. package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -1
  47. package/lib-commonjs/index.js +3 -0
  48. package/lib-commonjs/index.js.map +1 -1
  49. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +11 -13
  50. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -1
  51. package/lib-commonjs/utilities/VirtualizerContext/types.js +3 -3
  52. package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -1
  53. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,12 +1,32 @@
1
1
  # Change Log - @fluentui/react-virtualizer
2
2
 
3
- This log was last generated on Mon, 23 Sep 2024 12:36:04 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 15 Oct 2024 17:13:32 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-alpha.86](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.86)
8
+
9
+ Tue, 15 Oct 2024 17:13:32 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.85..@fluentui/react-virtualizer_v9.0.0-alpha.86)
11
+
12
+ ### Changes
13
+
14
+ - Bump @fluentui/react-jsx-runtime to v9.0.45 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
15
+ - Bump @fluentui/react-utilities to v9.18.16 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
16
+ - Bump @fluentui/react-shared-contexts to v9.20.2 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
17
+
18
+ ## [9.0.0-alpha.85](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.85)
19
+
20
+ Thu, 26 Sep 2024 14:15:28 GMT
21
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.84..@fluentui/react-virtualizer_v9.0.0-alpha.85)
22
+
23
+ ### Changes
24
+
25
+ - BREAKING CHANGE (useVirtualizerDynamicMeasure): optimized with scrollPos state and children height reference, updated algorithm to be more accurate, and exported measurement hook ([PR #32375](https://github.com/microsoft/fluentui/pull/32375) by mifraser@microsoft.com)
26
+
7
27
  ## [9.0.0-alpha.84](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.84)
8
28
 
9
- Mon, 23 Sep 2024 12:36:04 GMT
29
+ Mon, 23 Sep 2024 12:40:17 GMT
10
30
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.83..@fluentui/react-virtualizer_v9.0.0-alpha.84)
11
31
 
12
32
  ### Changes
package/dist/index.d.ts CHANGED
@@ -9,6 +9,15 @@ import type { SetStateAction } from 'react';
9
9
  import type { Slot } from '@fluentui/react-utilities';
10
10
  import type { SlotClassNames } from '@fluentui/react-utilities';
11
11
 
12
+ /**
13
+ * Some props are optional on static virtualizer, but required for dynamic.
14
+ */
15
+ export declare type DynamicVirtualizerContextProps = Required<VirtualizerContextProps>;
16
+
17
+ export declare interface IndexedResizeCallbackElement {
18
+ handleResize: () => void;
19
+ }
20
+
12
21
  export declare const renderVirtualizer_unstable: (state: VirtualizerState) => JSX.Element;
13
22
 
14
23
  export declare const renderVirtualizerScrollView_unstable: (state: VirtualizerScrollViewState) => JSX.Element;
@@ -61,6 +70,7 @@ export declare const useDynamicVirtualizerMeasure: <TElement extends HTMLElement
61
70
  bufferItems: number;
62
71
  bufferSize: number;
63
72
  scrollRef: (instance: TElement | null) => void;
73
+ containerSizeRef: React_2.RefObject<number>;
64
74
  };
65
75
 
66
76
  /**
@@ -78,6 +88,21 @@ export declare const useIntersectionObserver: (callback: IntersectionObserverCal
78
88
  observer: MutableRefObject<IntersectionObserver | undefined>;
79
89
  };
80
90
 
91
+ /**
92
+ * Provides a way of automating size in the virtualizer
93
+ * Returns
94
+ * `width` - element width ref (0 by default),
95
+ * `height` - element height ref (0 by default),
96
+ * `measureElementRef` - a ref function to be passed as `ref` to the element you want to measure
97
+ */
98
+ export declare function useMeasureList<TElement extends HTMLElement & IndexedResizeCallbackElement = HTMLElement & IndexedResizeCallbackElement>(currentIndex: number, refLength: number, totalLength: number, defaultItemSize: number): {
99
+ widthArray: React_2.MutableRefObject<any[]>;
100
+ heightArray: React_2.MutableRefObject<any[]>;
101
+ createIndexedRef: (index: number) => (el: TElement) => void;
102
+ refArray: React_2.MutableRefObject<(TElement | null | undefined)[]>;
103
+ sizeUpdateCount: number;
104
+ };
105
+
81
106
  /**
82
107
  * useResizeObserverRef_unstable simplifies resize observer connection and ensures debounce/cleanup
83
108
  */
@@ -91,6 +116,7 @@ export declare const useStaticVirtualizerMeasure: <TElement extends HTMLElement>
91
116
  bufferItems: number;
92
117
  bufferSize: number;
93
118
  scrollRef: (instance: TElement | null) => void;
119
+ containerSizeRef: React_2.MutableRefObject<number>;
94
120
  };
95
121
 
96
122
  export declare function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState;
@@ -123,6 +149,10 @@ export declare const useVirtualizerStyles_unstable: (state: VirtualizerState) =>
123
149
  */
124
150
  export declare const Virtualizer: FC<VirtualizerProps>;
125
151
 
152
+ /**
153
+ * The main child render method of Virtualization
154
+ * isScrolling will only be enabled when enableScrollLoad is set to true.
155
+ */
126
156
  export declare type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React_2.ReactNode;
127
157
 
128
158
  export declare const virtualizerClassNames: SlotClassNames<VirtualizerSlots>;
@@ -152,15 +182,18 @@ declare type VirtualizerConfigProps = {
152
182
  */
153
183
  virtualizerLength: number;
154
184
  /**
155
- * Defaults to 1/4th of virtualizerLength.
185
+ * Defaults to 1/4th (or 1/3rd for dynamic items) of virtualizerLength.
186
+ * RECOMMEND: Override this with a consistent value if using a dynamic virtualizer.
187
+ *
156
188
  * Controls the number of elements rendered before the current index entering the virtualized viewport.
157
189
  * Constraints:
158
190
  * - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).
159
- * - Small enough that the end buffer and end index (start index + virtualizerLength) is not within viewport at rest.
191
+ * - Small enough that the virtualizer only renders a few items outside of view.
160
192
  */
161
193
  bufferItems?: number;
162
194
  /**
163
- * Defaults to half of bufferItems size (in pixels).
195
+ * Defaults to half of bufferItems * itemSize size (in pixels).
196
+ * RECOMMEND: Override this with a consistent minimum item size value if using a dynamic virtualizer.
164
197
  * The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.
165
198
  * Increasing this reduces whitespace on ultra-fast scroll, as additional elements
166
199
  * are buffered to appear while virtualization recalculates.
@@ -171,6 +204,8 @@ declare type VirtualizerConfigProps = {
171
204
  bufferSize?: number;
172
205
  /**
173
206
  * Enables users to override the intersectionObserverRoot.
207
+ * RECOMMEND: DO NOT PASS THIS IN, as it can cause side effects
208
+ * when overlapping with other scroll views
174
209
  */
175
210
  scrollViewRef?: React_2.MutableRefObject<HTMLElement | null>;
176
211
  /**
@@ -183,6 +218,11 @@ declare type VirtualizerConfigProps = {
183
218
  * This value should be flipped in RTL implementation (TBD whether automate RTL).
184
219
  */
185
220
  reversed?: boolean;
221
+ /**
222
+ * Enables the isScrolling property in the child render function
223
+ * Default: false - to prevent nessecary render function calls
224
+ */
225
+ enableScrollLoad?: boolean;
186
226
  /**
187
227
  * Callback for acquiring size of individual items
188
228
  * @param index - the index of the requested size's child
@@ -201,6 +241,11 @@ declare type VirtualizerConfigProps = {
201
241
  * Imperative ref contains our scrollTo index functionality for user control.
202
242
  */
203
243
  imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;
244
+ /**
245
+ * A ref that provides the size of container (vertical - height, horizontal - width), set by a resize observer.
246
+ * Virtualizer Measure hooks provide a suitable reference.
247
+ */
248
+ containerSizeRef: RefObject<number>;
204
249
  };
205
250
 
206
251
  declare type VirtualizerConfigState = {
@@ -233,6 +278,11 @@ declare type VirtualizerConfigState = {
233
278
  * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)
234
279
  */
235
280
  reversed?: boolean;
281
+ /**
282
+ * Enables the isScrolling property in the child render function
283
+ * Default: false - to prevent nessecary render function calls
284
+ */
285
+ enableScrollLoad?: boolean;
236
286
  /**
237
287
  * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.
238
288
  * Minimum 1px.
@@ -254,6 +304,9 @@ declare type VirtualizerConfigState = {
254
304
  export declare type VirtualizerContextProps = {
255
305
  contextIndex: number;
256
306
  setContextIndex: (index: number) => void;
307
+ contextPosition?: number;
308
+ setContextPosition?: (index: number) => void;
309
+ childProgressiveSizes?: React_2.MutableRefObject<number[]>;
257
310
  };
258
311
 
259
312
  export declare const VirtualizerContextProvider: React_2.Provider<VirtualizerContextProps>;
@@ -267,15 +320,31 @@ export declare type VirtualizerDataRef = {
267
320
 
268
321
  export declare type VirtualizerMeasureDynamicProps = {
269
322
  defaultItemSize: number;
270
- currentIndex: number;
323
+ virtualizerContext: DynamicVirtualizerContextProps;
271
324
  numItems: number;
272
325
  getItemSize: (index: number) => number;
273
326
  direction?: 'vertical' | 'horizontal';
327
+ /**
328
+ * Override recommended number of buffer items
329
+ */
330
+ bufferItems?: number;
331
+ /**
332
+ * Override recommended buffer size (px)
333
+ */
334
+ bufferSize?: number;
274
335
  };
275
336
 
276
337
  export declare type VirtualizerMeasureProps = {
277
338
  defaultItemSize: number;
278
339
  direction?: 'vertical' | 'horizontal';
340
+ /**
341
+ * Override recommended number of buffer items
342
+ */
343
+ bufferItems?: number;
344
+ /**
345
+ * Override recommended buffer size (px)
346
+ */
347
+ bufferSize?: number;
279
348
  };
280
349
 
281
350
  export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;
@@ -294,7 +363,7 @@ export declare const VirtualizerScrollViewDynamic: React_2.FC<VirtualizerScrollV
294
363
 
295
364
  export declare const virtualizerScrollViewDynamicClassNames: SlotClassNames<VirtualizerScrollViewDynamicSlots>;
296
365
 
297
- export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex'>> & {
366
+ export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'virtualizerContext'>> & {
298
367
  /**
299
368
  * Set as the minimum item size.
300
369
  * Axis: 'vertical' = Height
@@ -325,6 +394,10 @@ export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<V
325
394
  * Imperative ref contains our scrollTo index functionality for user control.
326
395
  */
327
396
  enablePagination?: boolean;
397
+ /**
398
+ * Enables override of dynamic virtualizer context if required.
399
+ */
400
+ virtualizerContext?: DynamicVirtualizerContextProps;
328
401
  };
329
402
 
330
403
  export declare type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;
@@ -1 +1 @@
1
- {"version":3,"sources":["Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { VirtualizerContextProps } from '../../Utilities';\nimport type { RefObject, MutableRefObject } from 'react';\n\nexport type VirtualizerSlots = {\n /**\n * The intersection observed 'before' element will detect when scrolling towards the beginning.\n */\n before: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace at the beginning of current DOM children.\n */\n beforeContainer: NonNullable<Slot<'div', 'tr'>>;\n /**\n * The intersection observed 'after' element will detect when scrolling towards the end.\n */\n after: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace after the end of current DOM children.\n */\n afterContainer: NonNullable<Slot<'div', 'tr'>>;\n};\n\nexport type VirtualizerConfigState = {\n /**\n * The current virtualized array of children to show in the DOM.\n */\n virtualizedChildren: React.ReactNode[];\n /**\n * The current start index for the virtualizer, all previous index's will be removed from DOM.\n */\n virtualizerStartIndex: number;\n /**\n * Current buffer height required at beginning of array.\n */\n afterBufferHeight: number;\n /**\n * Current buffer height required at end of array.\n */\n beforeBufferHeight: number;\n /**\n * The total current height of the scrollView/child content.\n */\n totalVirtualizerHeight: number;\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n */\n reversed?: boolean;\n /**\n * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.\n * Minimum 1px.\n */\n bufferSize: number;\n /**\n * Ref for access to internal size knowledge, can be used to measure updates\n */\n childSizes: React.MutableRefObject<number[]>;\n /**\n * Ref for access to internal progressive size knowledge, can be used to measure updates\n */\n childProgressiveSizes: React.MutableRefObject<number[]>;\n};\n\nexport type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;\n\n// Virtualizer render function to procedurally generate children elements as rows or columns via index.\n// Q: Use generic typing and passing through object data or a simple index system?\nexport type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React.ReactNode;\n\nexport type VirtualizerDataRef = {\n progressiveSizes: RefObject<number[]>;\n nodeSizes: RefObject<number[]>;\n setFlaggedIndex: (index: number | null) => void;\n currentIndex: RefObject<number>;\n};\n\nexport type VirtualizerConfigProps = {\n /**\n * Child render function.\n * Iteratively called to return current virtualizer DOM children.\n * Will act as a row or column indexer depending on Virtualizer settings.\n * Can be used dynamically.\n */\n children: VirtualizerChildRenderFunction;\n\n /**\n * Default cell size to use if no custom callback provided.\n * If implementing `getItemSize` this should be the initial and ideally minimum cell size.\n */\n itemSize: number;\n\n /**\n * The total number of items to be virtualized.\n */\n numItems: number;\n\n /**\n * Number of children to render in the DOM during virtualization.\n * Constraints:\n * - Large enough that the items rendered in DOM cover the viewport\n * and intersection observer buffers (buffersize) at both ends.\n */\n virtualizerLength: number;\n\n /**\n * Defaults to 1/4th of virtualizerLength.\n * Controls the number of elements rendered before the current index entering the virtualized viewport.\n * Constraints:\n * - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).\n * - Small enough that the end buffer and end index (start index + virtualizerLength) is not within viewport at rest.\n */\n bufferItems?: number;\n\n /**\n * Defaults to half of bufferItems size (in pixels).\n * The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.\n * Increasing this reduces whitespace on ultra-fast scroll, as additional elements\n * are buffered to appear while virtualization recalculates.\n * Constraints:\n * - At least 1px - although this will only trigger the recalculation after bookends (whitespace) enter viewport.\n * - BufferSize must be smaller than bufferItems pixel size, as it prevents bookends entering viewport at rest.\n */\n bufferSize?: number;\n\n /**\n * Enables users to override the intersectionObserverRoot.\n */\n scrollViewRef?: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n * This value should be flipped in RTL implementation (TBD whether automate RTL).\n */\n reversed?: boolean;\n\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n */\n getItemSize?: (index: number) => number;\n\n /**\n * Virtualizer context can be passed as a prop for extended class use\n */\n virtualizerContext?: VirtualizerContextProps;\n\n /**\n * Callback for notifying when a flagged index has been rendered\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onRenderedFlaggedIndex?: (index: number) => void;\n\n /*\n * Callback for notifying when a flagged index has been rendered\n */\n flaggedIndex?: MutableRefObject<number | null>;\n\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;\n};\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { VirtualizerContextProps } from '../../Utilities';\nimport type { RefObject, MutableRefObject } from 'react';\n\nexport type VirtualizerSlots = {\n /**\n * The intersection observed 'before' element will detect when scrolling towards the beginning.\n */\n before: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace at the beginning of current DOM children.\n */\n beforeContainer: NonNullable<Slot<'div', 'tr'>>;\n /**\n * The intersection observed 'after' element will detect when scrolling towards the end.\n */\n after: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace after the end of current DOM children.\n */\n afterContainer: NonNullable<Slot<'div', 'tr'>>;\n};\n\nexport type VirtualizerConfigState = {\n /**\n * The current virtualized array of children to show in the DOM.\n */\n virtualizedChildren: React.ReactNode[];\n /**\n * The current start index for the virtualizer, all previous index's will be removed from DOM.\n */\n virtualizerStartIndex: number;\n /**\n * Current buffer height required at beginning of array.\n */\n afterBufferHeight: number;\n /**\n * Current buffer height required at end of array.\n */\n beforeBufferHeight: number;\n /**\n * The total current height of the scrollView/child content.\n */\n totalVirtualizerHeight: number;\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n */\n reversed?: boolean;\n /**\n * Enables the isScrolling property in the child render function\n * Default: false - to prevent nessecary render function calls\n */\n enableScrollLoad?: boolean;\n /**\n * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.\n * Minimum 1px.\n */\n bufferSize: number;\n /**\n * Ref for access to internal size knowledge, can be used to measure updates\n */\n childSizes: React.MutableRefObject<number[]>;\n /**\n * Ref for access to internal progressive size knowledge, can be used to measure updates\n */\n childProgressiveSizes: React.MutableRefObject<number[]>;\n};\n\nexport type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;\n\n/**\n * The main child render method of Virtualization\n * isScrolling will only be enabled when enableScrollLoad is set to true.\n */\nexport type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React.ReactNode;\n\nexport type VirtualizerDataRef = {\n progressiveSizes: RefObject<number[]>;\n nodeSizes: RefObject<number[]>;\n setFlaggedIndex: (index: number | null) => void;\n currentIndex: RefObject<number>;\n};\n\nexport type VirtualizerConfigProps = {\n /**\n * Child render function.\n * Iteratively called to return current virtualizer DOM children.\n * Will act as a row or column indexer depending on Virtualizer settings.\n * Can be used dynamically.\n */\n children: VirtualizerChildRenderFunction;\n\n /**\n * Default cell size to use if no custom callback provided.\n * If implementing `getItemSize` this should be the initial and ideally minimum cell size.\n */\n itemSize: number;\n\n /**\n * The total number of items to be virtualized.\n */\n numItems: number;\n\n /**\n * Number of children to render in the DOM during virtualization.\n * Constraints:\n * - Large enough that the items rendered in DOM cover the viewport\n * and intersection observer buffers (buffersize) at both ends.\n */\n virtualizerLength: number;\n\n /**\n * Defaults to 1/4th (or 1/3rd for dynamic items) of virtualizerLength.\n * RECOMMEND: Override this with a consistent value if using a dynamic virtualizer.\n *\n * Controls the number of elements rendered before the current index entering the virtualized viewport.\n * Constraints:\n * - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).\n * - Small enough that the virtualizer only renders a few items outside of view.\n */\n bufferItems?: number;\n\n /**\n * Defaults to half of bufferItems * itemSize size (in pixels).\n * RECOMMEND: Override this with a consistent minimum item size value if using a dynamic virtualizer.\n * The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.\n * Increasing this reduces whitespace on ultra-fast scroll, as additional elements\n * are buffered to appear while virtualization recalculates.\n * Constraints:\n * - At least 1px - although this will only trigger the recalculation after bookends (whitespace) enter viewport.\n * - BufferSize must be smaller than bufferItems pixel size, as it prevents bookends entering viewport at rest.\n */\n bufferSize?: number;\n\n /**\n * Enables users to override the intersectionObserverRoot.\n * RECOMMEND: DO NOT PASS THIS IN, as it can cause side effects\n * when overlapping with other scroll views\n */\n scrollViewRef?: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n * This value should be flipped in RTL implementation (TBD whether automate RTL).\n */\n reversed?: boolean;\n\n /**\n * Enables the isScrolling property in the child render function\n * Default: false - to prevent nessecary render function calls\n */\n enableScrollLoad?: boolean;\n\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n */\n getItemSize?: (index: number) => number;\n\n /**\n * Virtualizer context can be passed as a prop for extended class use\n */\n virtualizerContext?: VirtualizerContextProps;\n\n /**\n * Callback for notifying when a flagged index has been rendered\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onRenderedFlaggedIndex?: (index: number) => void;\n\n /*\n * Callback for notifying when a flagged index has been rendered\n */\n flaggedIndex?: MutableRefObject<number | null>;\n\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;\n\n /**\n * A ref that provides the size of container (vertical - height, horizontal - width), set by a resize observer.\n * Virtualizer Measure hooks provide a suitable reference.\n */\n containerSizeRef: RefObject<number>;\n};\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}