@fluentui/react-virtualizer 0.0.0-nightly-20230119-0422.1

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 (50) hide show
  1. package/CHANGELOG.json +32 -0
  2. package/CHANGELOG.md +15 -0
  3. package/LICENSE +15 -0
  4. package/README.md +5 -0
  5. package/dist/index.d.ts +173 -0
  6. package/lib/Hooks.js +2 -0
  7. package/lib/Hooks.js.map +1 -0
  8. package/lib/Virtualizer.js +2 -0
  9. package/lib/Virtualizer.js.map +1 -0
  10. package/lib/components/Virtualizer/Virtualizer.js +15 -0
  11. package/lib/components/Virtualizer/Virtualizer.js.map +1 -0
  12. package/lib/components/Virtualizer/Virtualizer.types.js +2 -0
  13. package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -0
  14. package/lib/components/Virtualizer/index.js +6 -0
  15. package/lib/components/Virtualizer/index.js.map +1 -0
  16. package/lib/components/Virtualizer/renderVirtualizer.js +18 -0
  17. package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -0
  18. package/lib/components/Virtualizer/useVirtualizer.js +363 -0
  19. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -0
  20. package/lib/components/Virtualizer/useVirtualizerStyles.js +108 -0
  21. package/lib/components/Virtualizer/useVirtualizerStyles.js.map +1 -0
  22. package/lib/hooks/index.js +2 -0
  23. package/lib/hooks/index.js.map +1 -0
  24. package/lib/hooks/useIntersectionObserver.js +52 -0
  25. package/lib/hooks/useIntersectionObserver.js.map +1 -0
  26. package/lib/index.js +3 -0
  27. package/lib/index.js.map +1 -0
  28. package/lib-commonjs/Hooks.js +8 -0
  29. package/lib-commonjs/Hooks.js.map +1 -0
  30. package/lib-commonjs/Virtualizer.js +8 -0
  31. package/lib-commonjs/Virtualizer.js.map +1 -0
  32. package/lib-commonjs/components/Virtualizer/Virtualizer.js +22 -0
  33. package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -0
  34. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js +6 -0
  35. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -0
  36. package/lib-commonjs/components/Virtualizer/index.js +12 -0
  37. package/lib-commonjs/components/Virtualizer/index.js.map +1 -0
  38. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js +25 -0
  39. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -0
  40. package/lib-commonjs/components/Virtualizer/useVirtualizer.js +370 -0
  41. package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -0
  42. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js +115 -0
  43. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js.map +1 -0
  44. package/lib-commonjs/hooks/index.js +8 -0
  45. package/lib-commonjs/hooks/index.js.map +1 -0
  46. package/lib-commonjs/hooks/useIntersectionObserver.js +59 -0
  47. package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -0
  48. package/lib-commonjs/index.js +45 -0
  49. package/lib-commonjs/index.js.map +1 -0
  50. package/package.json +53 -0
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const tslib_1 = /*#__PURE__*/require("tslib");
7
+ tslib_1.__exportStar(require("./components/Virtualizer/index"), exports);
8
+ //# sourceMappingURL=Virtualizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"","sources":["../../../../../../../packages/react-components/react-virtualizer/src/Virtualizer.ts"],"sourcesContent":["export * from './components/Virtualizer/index';\n"]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Virtualizer = void 0;
7
+ const useVirtualizerStyles_1 = /*#__PURE__*/require("./useVirtualizerStyles");
8
+ const useVirtualizer_1 = /*#__PURE__*/require("./useVirtualizer");
9
+ const renderVirtualizer_1 = /*#__PURE__*/require("./renderVirtualizer");
10
+ /**
11
+ * Virtualizer pseudo-component, this functional wrapper
12
+ * provides a simple interface for reducing the total number
13
+ * of elements rendered at one time in large lists.
14
+ */
15
+ const Virtualizer = props => {
16
+ const state = useVirtualizer_1.useVirtualizer_unstable(props);
17
+ useVirtualizerStyles_1.useVirtualizerStyles_unstable(state);
18
+ return renderVirtualizer_1.renderVirtualizer_unstable(state);
19
+ };
20
+ exports.Virtualizer = Virtualizer;
21
+ exports.Virtualizer.displayName = 'Virtualizer';
22
+ //# sourceMappingURL=Virtualizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";;;;;;AACA;AACA;AACA;AAGA;;;;;AAKO,MAAMA,WAAW,GAA0BC,KAAuB,IAAI;EAC3E,MAAMC,KAAK,GAAGC,wCAAuB,CAACF,KAAK,CAAC;EAC5CG,oDAA6B,CAACF,KAAK,CAAC;EAEpC,OAAOG,8CAA0B,CAACH,KAAK,CAAC;AAC1C,CAAC;AALYI,mBAAW;AAOxBA,mBAAW,CAACC,WAAW,GAAG,aAAa","names":["Virtualizer","props","state","useVirtualizer_1","useVirtualizerStyles_1","renderVirtualizer_1","exports","displayName"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-virtualizer/src/components/Virtualizer/Virtualizer.ts"],"sourcesContent":["import type { VirtualizerProps } from './Virtualizer.types';\nimport { useVirtualizerStyles_unstable } from './useVirtualizerStyles';\nimport { useVirtualizer_unstable } from './useVirtualizer';\nimport { renderVirtualizer_unstable } from './renderVirtualizer';\nimport type { FC } from 'react';\n\n/**\n * Virtualizer pseudo-component, this functional wrapper\n * provides a simple interface for reducing the total number\n * of elements rendered at one time in large lists.\n */\nexport const Virtualizer: FC<VirtualizerProps> = (props: VirtualizerProps) => {\n const state = useVirtualizer_unstable(props);\n useVirtualizerStyles_unstable(state);\n\n return renderVirtualizer_unstable(state);\n};\n\nVirtualizer.displayName = 'Virtualizer';\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=Virtualizer.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":"","names":[],"sourceRoot":"","sources":[],"sourcesContent":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const tslib_1 = /*#__PURE__*/require("tslib");
7
+ tslib_1.__exportStar(require("./Virtualizer"), exports);
8
+ tslib_1.__exportStar(require("./Virtualizer.types"), exports);
9
+ tslib_1.__exportStar(require("./useVirtualizer"), exports);
10
+ tslib_1.__exportStar(require("./renderVirtualizer"), exports);
11
+ tslib_1.__exportStar(require("./useVirtualizerStyles"), exports);
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-virtualizer/src/components/Virtualizer/index.ts"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles';\n"]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderVirtualizer_unstable = void 0;
7
+ const React = /*#__PURE__*/require("react");
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+ const renderVirtualizer_unstable = state => {
10
+ const {
11
+ slots,
12
+ slotProps
13
+ } = react_utilities_1.getSlots(state);
14
+ return React.createElement(React.Fragment, null, React.createElement(slots.beforeContainer, {
15
+ ...slotProps.beforeContainer
16
+ }, React.createElement(slots.before, {
17
+ ...slotProps.before
18
+ })), state.virtualizedChildren, React.createElement(slots.afterContainer, {
19
+ ...slotProps.afterContainer
20
+ }, React.createElement(slots.after, {
21
+ ...slotProps.after
22
+ })));
23
+ };
24
+ exports.renderVirtualizer_unstable = renderVirtualizer_unstable;
25
+ //# sourceMappingURL=renderVirtualizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AAGO,MAAMA,0BAA0B,GAAIC,KAAuB,IAAI;EACpE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAAmBH,KAAK,CAAC;EAE9D,OACEI,oBAACA,KAAK,CAACC,QAAQ,QAEbD,oBAACH,KAAK,CAACK,eAAe;IAAA,GAAKJ,SAAS,CAACI;EAAe,GAClDF,oBAACH,KAAK,CAACM,MAAM;IAAA,GAAKL,SAAS,CAACK;EAAM,EAAI,CAChB,EAEvBP,KAAK,CAACQ,mBAAmB,EAE1BJ,oBAACH,KAAK,CAACQ,cAAc;IAAA,GAAKP,SAAS,CAACO;EAAc,GAChDL,oBAACH,KAAK,CAACS,KAAK;IAAA,GAAKR,SAAS,CAACQ;EAAK,EAAI,CACf,CACR;AAErB,CAAC;AAjBYC,kCAA0B","names":["renderVirtualizer_unstable","state","slots","slotProps","react_utilities_1","React","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after","exports"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-virtualizer/src/components/Virtualizer/renderVirtualizer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n const { slots, slotProps } = getSlots<VirtualizerSlots>(state);\n\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <slots.beforeContainer {...slotProps.beforeContainer}>\n <slots.before {...slotProps.before} />\n </slots.beforeContainer>\n {/* The reduced list of non-virtualized children to be rendered */}\n {state.virtualizedChildren}\n {/* The 'after' bookend to hold items in place and detect scroll next */}\n <slots.afterContainer {...slotProps.afterContainer}>\n <slots.after {...slotProps.after} />\n </slots.afterContainer>\n </React.Fragment>\n );\n};\n"]}
@@ -0,0 +1,370 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useVirtualizer_unstable = void 0;
7
+ const useIntersectionObserver_1 = /*#__PURE__*/require("../../hooks/useIntersectionObserver");
8
+ const react_1 = /*#__PURE__*/require("react");
9
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
10
+ const react_dom_1 = /*#__PURE__*/require("react-dom");
11
+ function useVirtualizer_unstable(props) {
12
+ const {
13
+ itemSize,
14
+ numItems,
15
+ virtualizerLength,
16
+ children: renderChild,
17
+ getItemSize,
18
+ bufferItems = Math.round(virtualizerLength / 4.0),
19
+ bufferSize = Math.floor(bufferItems / 2.0) * itemSize,
20
+ intersectionObserverRoot,
21
+ axis = 'vertical',
22
+ reversed = false,
23
+ onUpdateIndex,
24
+ onCalculateIndex
25
+ } = props;
26
+ // Tracks the initial item to start virtualizer at, -1 implies first render cycle
27
+ const [virtualizerStartIndex, setVirtualizerStartIndex] = react_1.useState(-1);
28
+ // Store ref to before padding element
29
+ const beforeElementRef = react_1.useRef(null);
30
+ // Store ref to before padding element
31
+ const afterElementRef = react_1.useRef(null);
32
+ // We need to store an array to track dynamic sizes, we can use this to incrementally update changes
33
+ const childSizes = react_1.useRef(new Array(getItemSize ? numItems : 0));
34
+ /* We keep track of the progressive sizing/placement down the list,
35
+ this helps us skip re-calculations unless children/size changes */
36
+ const childProgressiveSizes = react_1.useRef(new Array(getItemSize ? numItems : 0));
37
+ // The internal tracking REF for child array (updates often).
38
+ const childArray = react_1.useRef(new Array(virtualizerLength));
39
+ // We want to be methodical about updating the render with child reference array
40
+ const forceUpdate = react_1.useReducer(() => ({}), {})[1];
41
+ const horizontal = axis === 'horizontal';
42
+ const populateSizeArrays = () => {
43
+ if (!getItemSize) {
44
+ // Static sizes, never mind!
45
+ return;
46
+ }
47
+ if (numItems !== childSizes.current.length) {
48
+ childSizes.current = new Array(numItems);
49
+ }
50
+ if (numItems !== childProgressiveSizes.current.length) {
51
+ childProgressiveSizes.current = new Array(numItems);
52
+ }
53
+ for (let index = 0; index < numItems; index++) {
54
+ childSizes.current[index] = getItemSize(index);
55
+ if (index === 0) {
56
+ childProgressiveSizes.current[index] = childSizes.current[index];
57
+ } else {
58
+ childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];
59
+ }
60
+ }
61
+ };
62
+ const batchUpdateNewIndex = index => {
63
+ // Local updates
64
+ onUpdateIndex === null || onUpdateIndex === void 0 ? void 0 : onUpdateIndex(index, virtualizerStartIndex);
65
+ updateChildRows(index);
66
+ updateCurrentItemSizes(index);
67
+ // State setters
68
+ setVirtualizerStartIndex(index);
69
+ };
70
+ // Observe intersections of virtualized components
71
+ const {
72
+ setObserverList
73
+ } = useIntersectionObserver_1.useIntersectionObserver((entries, observer) => {
74
+ /* Sanity check - do we even need virtualization? */
75
+ if (virtualizerLength > numItems) {
76
+ if (virtualizerStartIndex !== 0) {
77
+ batchUpdateNewIndex(0);
78
+ }
79
+ // No-op
80
+ return;
81
+ }
82
+ /* IO initiates this function when needed (bookend entering view) */
83
+ let measurementPos = 0;
84
+ let bufferCount = bufferItems;
85
+ // Grab latest entry that is intersecting
86
+ const latestEntry = entries.length === 1 ? entries[0] : entries.sort((entry1, entry2) => entry2.time - entry1.time).find(entry => {
87
+ return entry.intersectionRatio > 0;
88
+ });
89
+ if (!latestEntry) {
90
+ // If we don't find an intersecting area, ignore for now.
91
+ return;
92
+ }
93
+ if (latestEntry.target === afterElementRef.current) {
94
+ // We need to inverse the buffer count
95
+ bufferCount = virtualizerLength - bufferItems;
96
+ measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();
97
+ if (!horizontal) {
98
+ if (reversed) {
99
+ // Scrolling 'up' and hit the after element below
100
+ measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);
101
+ } else if (latestEntry.boundingClientRect.top < 0) {
102
+ // Scrolling 'down' and hit the after element above top: 0
103
+ measurementPos -= latestEntry.boundingClientRect.top;
104
+ }
105
+ } else {
106
+ if (reversed) {
107
+ // Scrolling 'left' and hit the after element
108
+ measurementPos -= Math.abs(latestEntry.boundingClientRect.right);
109
+ } else if (latestEntry.boundingClientRect.left < 0) {
110
+ // Scrolling 'right' and hit the after element
111
+ measurementPos -= latestEntry.boundingClientRect.left;
112
+ }
113
+ }
114
+ } else if (latestEntry.target === beforeElementRef.current) {
115
+ measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();
116
+ if (!horizontal) {
117
+ if (!reversed) {
118
+ measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);
119
+ } else if (latestEntry.boundingClientRect.top < 0) {
120
+ // Scrolling 'down' in reverse order and hit the before element above top: 0
121
+ measurementPos -= latestEntry.boundingClientRect.top;
122
+ }
123
+ } else {
124
+ if (!reversed) {
125
+ measurementPos -= Math.abs(latestEntry.boundingClientRect.right);
126
+ } else if (latestEntry.boundingClientRect.left < 0) {
127
+ // Scrolling 'left' and hit before element
128
+ measurementPos -= latestEntry.boundingClientRect.left;
129
+ }
130
+ }
131
+ }
132
+ if (reversed) {
133
+ // We're reversed, up is down, left is right, invert the scroll measure.
134
+ measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);
135
+ }
136
+ // For now lets use hardcoded size to assess current element to paginate on
137
+ const startIndex = getIndexFromScrollPosition(measurementPos);
138
+ let bufferedIndex = Math.max(startIndex - bufferCount, 0);
139
+ if (onCalculateIndex) {
140
+ // User has chance to intervene/customize prior to render
141
+ // They may want to normalize this value.
142
+ bufferedIndex = onCalculateIndex(bufferedIndex);
143
+ }
144
+ // Safety limits
145
+ const maxIndex = Math.max(numItems - virtualizerLength, 0);
146
+ const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);
147
+ if (virtualizerStartIndex !== newStartIndex) {
148
+ // We flush sync this and perform an immediate state update
149
+ // due to virtualizerStartIndex invalidation.
150
+ react_dom_1.flushSync(() => {
151
+ batchUpdateNewIndex(newStartIndex);
152
+ });
153
+ }
154
+ }, {
155
+ root: intersectionObserverRoot ? intersectionObserverRoot === null || intersectionObserverRoot === void 0 ? void 0 : intersectionObserverRoot.current : null,
156
+ rootMargin: '0px',
157
+ threshold: 0
158
+ });
159
+ const findIndexRecursive = (scrollPos, lowIndex, highIndex) => {
160
+ if (lowIndex > highIndex) {
161
+ // We shouldn't get here - but no-op the index if we do.
162
+ return virtualizerStartIndex;
163
+ }
164
+ const midpoint = Math.floor((lowIndex + highIndex) / 2);
165
+ const iBefore = Math.max(midpoint - 1, 0);
166
+ const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);
167
+ const indexValue = childProgressiveSizes.current[midpoint];
168
+ const afterIndexValue = childProgressiveSizes.current[iAfter];
169
+ const beforeIndexValue = childProgressiveSizes.current[iBefore];
170
+ if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {
171
+ /* We've found our index - if we are exactly matching before/after index that's ok,
172
+ better to reduce checks if it's right on the boundary. */
173
+ return midpoint;
174
+ }
175
+ if (indexValue > scrollPos) {
176
+ return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);
177
+ } else {
178
+ return findIndexRecursive(scrollPos, midpoint + 1, highIndex);
179
+ }
180
+ };
181
+ const getIndexFromSizeArray = scrollPos => {
182
+ /* Quick searches our progressive height array */
183
+ if (scrollPos === 0 || childProgressiveSizes.current.length === 0 || scrollPos <= childProgressiveSizes.current[0]) {
184
+ // Check start
185
+ return 0;
186
+ }
187
+ if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {
188
+ // Check end
189
+ return childProgressiveSizes.current.length - 1;
190
+ }
191
+ return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);
192
+ };
193
+ const getIndexFromScrollPosition = scrollPos => {
194
+ if (!getItemSize) {
195
+ return Math.round(scrollPos / itemSize);
196
+ }
197
+ return getIndexFromSizeArray(scrollPos);
198
+ };
199
+ const calculateTotalSize = () => {
200
+ if (!getItemSize) {
201
+ return itemSize * numItems;
202
+ }
203
+ // Time for custom size calcs
204
+ return childProgressiveSizes.current[numItems - 1];
205
+ };
206
+ const calculateBefore = () => {
207
+ if (!getItemSize) {
208
+ // The missing items from before virtualization starts height
209
+ return virtualizerStartIndex * itemSize;
210
+ }
211
+ if (virtualizerStartIndex <= 0) {
212
+ return 0;
213
+ }
214
+ // Time for custom size calcs
215
+ return childProgressiveSizes.current[virtualizerStartIndex - 1];
216
+ };
217
+ const calculateAfter = () => {
218
+ if (numItems === 0) {
219
+ return 0;
220
+ }
221
+ const lastItemIndex = Math.min(virtualizerStartIndex + virtualizerLength, numItems - 1);
222
+ if (!getItemSize) {
223
+ // The missing items from after virtualization ends height
224
+ const remainingItems = numItems - lastItemIndex - 1;
225
+ return remainingItems * itemSize;
226
+ }
227
+ // Time for custom size calcs
228
+ return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];
229
+ };
230
+ const updateChildRows = newIndex => {
231
+ if (numItems === 0) {
232
+ /* Nothing to virtualize */
233
+ return [];
234
+ }
235
+ if (childArray.current.length !== numItems) {
236
+ childArray.current = new Array(virtualizerLength);
237
+ }
238
+ const actualIndex = Math.max(newIndex, 0);
239
+ const end = Math.min(actualIndex + virtualizerLength, numItems);
240
+ for (let i = actualIndex; i < end; i++) {
241
+ childArray.current[i - actualIndex] = renderChild(i);
242
+ }
243
+ };
244
+ const setBeforeRef = react_1.useCallback(element => {
245
+ if (!element || beforeElementRef.current === element) {
246
+ return;
247
+ }
248
+ beforeElementRef.current = element;
249
+ const newList = [];
250
+ newList.push(beforeElementRef.current);
251
+ if (afterElementRef.current) {
252
+ newList.push(afterElementRef.current);
253
+ }
254
+ // Ensure we update array if before element changed
255
+ setObserverList(newList);
256
+ }, [setObserverList]);
257
+ const setAfterRef = react_1.useCallback(element => {
258
+ if (!element || afterElementRef.current === element) {
259
+ return;
260
+ }
261
+ afterElementRef.current = element;
262
+ const newList = [];
263
+ if (beforeElementRef.current) {
264
+ newList.push(beforeElementRef.current);
265
+ }
266
+ newList.push(afterElementRef.current);
267
+ // Ensure we update array if after element changed
268
+ setObserverList(newList);
269
+ }, [setObserverList]);
270
+ const updateCurrentItemSizes = newIndex => {
271
+ if (!getItemSize) {
272
+ // Static sizes, not required.
273
+ return;
274
+ }
275
+ // We should always call our size function on index change (only for the items that will be rendered)
276
+ // This ensures we request the latest data for incoming items in case sizing has changed.
277
+ const endIndex = Math.min(newIndex + virtualizerLength, numItems);
278
+ const startIndex = Math.max(newIndex, 0);
279
+ let didUpdate = false;
280
+ for (let i = startIndex; i < endIndex; i++) {
281
+ const newSize = getItemSize(i);
282
+ if (newSize !== childSizes.current[i]) {
283
+ childSizes.current[i] = newSize;
284
+ didUpdate = true;
285
+ }
286
+ }
287
+ if (didUpdate) {
288
+ // Update our progressive size array
289
+ for (let i = startIndex; i < numItems; i++) {
290
+ const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;
291
+ childProgressiveSizes.current[i] = prevSize + childSizes.current[i];
292
+ }
293
+ }
294
+ };
295
+ // Initialize the size array before first render.
296
+ const hasInitialized = react_1.useRef(false);
297
+ const initializeSizeArray = () => {
298
+ if (hasInitialized.current === false) {
299
+ hasInitialized.current = true;
300
+ populateSizeArrays();
301
+ }
302
+ };
303
+ // Initialization on mount - update array index to 0 (ready state).
304
+ // Only fire on mount (no deps).
305
+ react_1.useEffect(() => {
306
+ if (virtualizerStartIndex < 0) {
307
+ batchUpdateNewIndex(0);
308
+ }
309
+ // eslint-disable-next-line react-hooks/exhaustive-deps
310
+ }, []);
311
+ // If the user passes in an updated renderChild function - update current children
312
+ react_1.useEffect(() => {
313
+ if (virtualizerStartIndex >= 0) {
314
+ updateChildRows(virtualizerStartIndex);
315
+ forceUpdate();
316
+ }
317
+ // eslint-disable-next-line react-hooks/exhaustive-deps
318
+ }, [renderChild]);
319
+ // Ensure we have run through and updated the whole size list array at least once.
320
+ initializeSizeArray();
321
+ if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {
322
+ // Child length mismatch, repopulate size arrays.
323
+ populateSizeArrays();
324
+ }
325
+ const isFullyInitialized = hasInitialized.current && virtualizerStartIndex >= 0;
326
+ return {
327
+ components: {
328
+ before: 'div',
329
+ after: 'div',
330
+ beforeContainer: 'div',
331
+ afterContainer: 'div'
332
+ },
333
+ virtualizedChildren: childArray.current,
334
+ before: react_utilities_1.resolveShorthand(props.before, {
335
+ required: true,
336
+ defaultProps: {
337
+ ref: setBeforeRef,
338
+ role: 'none'
339
+ }
340
+ }),
341
+ after: react_utilities_1.resolveShorthand(props.after, {
342
+ required: true,
343
+ defaultProps: {
344
+ ref: setAfterRef,
345
+ role: 'none'
346
+ }
347
+ }),
348
+ beforeContainer: react_utilities_1.resolveShorthand(props.beforeContainer, {
349
+ required: true,
350
+ defaultProps: {
351
+ role: 'none'
352
+ }
353
+ }),
354
+ afterContainer: react_utilities_1.resolveShorthand(props.afterContainer, {
355
+ required: true,
356
+ defaultProps: {
357
+ role: 'none'
358
+ }
359
+ }),
360
+ beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,
361
+ afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,
362
+ totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,
363
+ virtualizerStartIndex,
364
+ axis,
365
+ bufferSize,
366
+ reversed
367
+ };
368
+ }
369
+ exports.useVirtualizer_unstable = useVirtualizer_unstable;
370
+ //# sourceMappingURL=useVirtualizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";;;;;;AAAA;AAEA;AAGA;AACA;AAEA,SAAgBA,uBAAuB,CAACC,KAAuB;EAC7D,MAAM;IACJC,QAAQ;IACRC,QAAQ;IACRC,iBAAiB;IACjBC,QAAQ,EAAEC,WAAW;IACrBC,WAAW;IACXC,WAAW,GAAGC,IAAI,CAACC,KAAK,CAACN,iBAAiB,GAAG,GAAG,CAAC;IACj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E,UAAU,CAACI,OAAO;IACvCuE,MAAM,EAAEK,kCAAgB,CAACzG,KAAK,CAACoG,MAAM,EAAE;MACrCM,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QACZC,GAAG,EAAErB,YAAY;QACjBsB,IAAI,EAAE;;KAET,CAAC;IACFR,KAAK,EAAEI,kCAAgB,CAACzG,KAAK,CAACqG,KAAK,EAAE;MACnCK,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QACZC,GAAG,EAAEjB,WAAW;QAChBkB,IAAI,EAAE;;KAET,CAAC;IACFP,eAAe,EAAEG,kCAAgB,CAACzG,KAAK,CAACsG,eAAe,EAAE;MACvDI,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QACZE,IAAI,EAAE;;KAET,CAAC;IACFN,cAAc,EAAEE,kCAAgB,CAACzG,KAAK,CAACuG,cAAc,EAAE;MACrDG,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QACZE,IAAI,EAAE;;KAET,CAAC;IACFC,kBAAkB,EAAEZ,kBAAkB,GAAGxC,eAAe,EAAE,GAAG,CAAC;IAC9DqD,iBAAiB,EAAEb,kBAAkB,GAAGhD,cAAc,EAAE,GAAG,CAAC;IAC5D8D,sBAAsB,EAAEd,kBAAkB,GAAG/C,kBAAkB,EAAE,GAAGhD,iBAAiB,GAAGF,QAAQ;IAChGgB,qBAAqB;IACrBJ,IAAI;IACJH,UAAU;IACVI;GACD;AACH;AAlbAmG","names":["useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","intersectionObserverRoot","axis","reversed","onUpdateIndex","onCalculateIndex","virtualizerStartIndex","setVirtualizerStartIndex","react_1","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","forceUpdate","horizontal","populateSizeArrays","current","length","index","batchUpdateNewIndex","updateChildRows","updateCurrentItemSizes","setObserverList","useIntersectionObserver_1","entries","observer","measurementPos","bufferCount","latestEntry","sort","entry1","entry2","time","find","entry","intersectionRatio","target","calculateAfter","calculateTotalSize","abs","boundingClientRect","bottom","top","right","left","calculateBefore","max","startIndex","getIndexFromScrollPosition","bufferedIndex","maxIndex","newStartIndex","min","react_dom_1","root","rootMargin","threshold","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","lastItemIndex","remainingItems","newIndex","actualIndex","end","i","setBeforeRef","element","newList","push","setAfterRef","endIndex","didUpdate","newSize","prevSize","hasInitialized","initializeSizeArray","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","react_utilities_1","required","defaultProps","ref","role","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","exports"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-virtualizer/src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport type { ReactNode } from 'react';\nimport { useEffect, useRef, useState, useCallback, useReducer } from 'react';\n\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\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 intersectionObserverRoot,\n axis = 'vertical',\n reversed = false,\n onUpdateIndex,\n onCalculateIndex,\n } = props;\n\n // Tracks the initial item to start virtualizer at, -1 implies first render cycle\n const [virtualizerStartIndex, setVirtualizerStartIndex] = useState<number>(-1);\n\n // Store ref to before padding element\n const beforeElementRef = useRef<Element | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = useRef<Element | 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 = 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 = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n // The internal tracking REF for child array (updates often).\n const childArray = useRef<ReactNode[]>(new Array(virtualizerLength));\n\n // We want to be methodical about updating the render with child reference array\n const forceUpdate = useReducer(() => ({}), {})[1];\n\n const horizontal = axis === 'horizontal';\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 }\n\n for (let index = 0; index < numItems; index++) {\n childSizes.current[index] = getItemSize(index);\n\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 batchUpdateNewIndex = (index: number) => {\n // Local updates\n onUpdateIndex?.(index, virtualizerStartIndex);\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setVirtualizerStartIndex(index);\n };\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (virtualizerStartIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n /* IO initiates this function when needed (bookend entering view) */\n let measurementPos = 0;\n let bufferCount = bufferItems;\n\n // Grab latest entry that is intersecting\n const latestEntry =\n entries.length === 1\n ? entries[0]\n : entries\n .sort((entry1, entry2) => entry2.time - entry1.time)\n .find(entry => {\n return entry.intersectionRatio > 0;\n });\n\n if (!latestEntry) {\n // If we don't find an intersecting area, ignore for now.\n return;\n }\n\n if (latestEntry.target === afterElementRef.current) {\n // We need to inverse the buffer count\n bufferCount = virtualizerLength - bufferItems;\n measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();\n if (!horizontal) {\n if (reversed) {\n // Scrolling 'up' and hit the after element below\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' and hit the after element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (reversed) {\n // Scrolling 'left' and hit the after element\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'right' and hit the after element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();\n if (!horizontal) {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' in reverse order and hit the before element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'left' and hit before element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n }\n\n if (reversed) {\n // We're reversed, up is down, left is right, invert the scroll measure.\n measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);\n }\n\n // For now lets use hardcoded size to assess current element to paginate on\n const startIndex = getIndexFromScrollPosition(measurementPos);\n let bufferedIndex = Math.max(startIndex - bufferCount, 0);\n\n if (onCalculateIndex) {\n // User has chance to intervene/customize prior to render\n // They may want to normalize this value.\n bufferedIndex = onCalculateIndex(bufferedIndex);\n }\n\n // Safety limits\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);\n\n if (virtualizerStartIndex !== newStartIndex) {\n // We flush sync this and perform an immediate state update\n // due to virtualizerStartIndex invalidation.\n flushSync(() => {\n batchUpdateNewIndex(newStartIndex);\n });\n }\n },\n {\n root: intersectionObserverRoot ? intersectionObserverRoot?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const findIndexRecursive = (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 virtualizerStartIndex;\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\n const getIndexFromSizeArray = (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\n const getIndexFromScrollPosition = (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n\n return getIndexFromSizeArray(scrollPos);\n };\n\n const calculateTotalSize = () => {\n if (!getItemSize) {\n return itemSize * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n };\n\n const calculateBefore = () => {\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return virtualizerStartIndex * itemSize;\n }\n\n if (virtualizerStartIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[virtualizerStartIndex - 1];\n };\n\n const calculateAfter = () => {\n if (numItems === 0) {\n return 0;\n }\n\n const lastItemIndex = Math.min(virtualizerStartIndex + virtualizerLength, numItems - 1);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex - 1;\n return remainingItems * itemSize;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];\n };\n\n const updateChildRows = (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n\n return [];\n }\n\n if (childArray.current.length !== numItems) {\n childArray.current = new Array(virtualizerLength);\n }\n const actualIndex = Math.max(newIndex, 0);\n const end = Math.min(actualIndex + virtualizerLength, numItems);\n\n for (let i = actualIndex; i < end; i++) {\n childArray.current[i - actualIndex] = renderChild(i);\n }\n };\n\n const setBeforeRef = 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 = 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 const updateCurrentItemSizes = (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 newSize = getItemSize(i);\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\n // Initialize the size array before first render.\n const hasInitialized = useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n useEffect(() => {\n if (virtualizerStartIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (virtualizerStartIndex >= 0) {\n updateChildRows(virtualizerStartIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild]);\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 const isFullyInitialized = hasInitialized.current && virtualizerStartIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: resolveShorthand(props.before, {\n required: true,\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n }),\n after: resolveShorthand(props.after, {\n required: true,\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n }),\n beforeContainer: resolveShorthand(props.beforeContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n afterContainer: resolveShorthand(props.afterContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex,\n axis,\n bufferSize,\n reversed,\n };\n}\n"]}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useVirtualizerStyles_unstable = exports.virtualizerClassNames = void 0;
7
+ const react_1 = /*#__PURE__*/require("@griffel/react");
8
+ const virtualizerClassName = 'fui-Virtualizer';
9
+ exports.virtualizerClassNames = {
10
+ before: `${virtualizerClassName}__before`,
11
+ beforeContainer: `${virtualizerClassName}__beforeContainer`,
12
+ after: `${virtualizerClassName}__after`,
13
+ afterContainer: `${virtualizerClassName}__afterContainer`
14
+ };
15
+ const useStyles = /*#__PURE__*/react_1.__styles({
16
+ base: {
17
+ mc9l5x: "ftgm304",
18
+ Bkecrkj: "f1aehjj5"
19
+ },
20
+ relative: {
21
+ qhf8xq: "f10pi13n"
22
+ },
23
+ horizontal: {
24
+ sshi5w: "fan4evk"
25
+ },
26
+ vertical: {
27
+ Bf4jedk: "f11qra4b"
28
+ }
29
+ }, {
30
+ d: [".ftgm304{display:block;}", ".f1aehjj5{pointer-events:none;}", ".f10pi13n{position:relative;}", ".fan4evk{min-height:100%;}", ".f11qra4b{min-width:100%;}"]
31
+ });
32
+ /**
33
+ * Apply styling to the Virtualizer states
34
+ */
35
+ const useVirtualizerStyles_unstable = state => {
36
+ const styles = useStyles();
37
+ const {
38
+ reversed,
39
+ axis,
40
+ beforeBufferHeight,
41
+ afterBufferHeight,
42
+ bufferSize
43
+ } = state;
44
+ const horizontal = axis === 'horizontal';
45
+ state.before.className = react_1.mergeClasses(exports.virtualizerClassNames.before, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.before.className);
46
+ state.after.className = react_1.mergeClasses(exports.virtualizerClassNames.after, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.after.className);
47
+ state.beforeContainer.className = react_1.mergeClasses(exports.virtualizerClassNames.beforeContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.beforeContainer.className);
48
+ state.afterContainer.className = react_1.mergeClasses(exports.virtualizerClassNames.afterContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.afterContainer.className);
49
+ const beforeHeightPx = beforeBufferHeight + 'px';
50
+ const afterHeightPx = afterBufferHeight + 'px';
51
+ const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';
52
+ const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';
53
+ const bufferPx = bufferSize + 'px';
54
+ const beforeBuffer = {
55
+ // Column
56
+ ...(!reversed && !horizontal && {
57
+ marginBottom: `-${bufferPx}`
58
+ }),
59
+ // Column-Reverse
60
+ ...(reversed && !horizontal && {
61
+ marginTop: `-${bufferPx}`
62
+ }),
63
+ // Row
64
+ ...(!reversed && horizontal && {
65
+ marginLeft: `-${bufferPx}`
66
+ }),
67
+ // Row-Reverse
68
+ ...(reversed && horizontal && {
69
+ marginRight: `-${bufferPx}`
70
+ })
71
+ };
72
+ const afterBuffer = {
73
+ // Column
74
+ ...(!reversed && !horizontal && {
75
+ marginTop: `-${bufferPx}`
76
+ }),
77
+ // Column-Reverse
78
+ ...(reversed && !horizontal && {
79
+ marginBottom: `-${bufferPx}`
80
+ }),
81
+ // Row
82
+ ...(!reversed && horizontal && {
83
+ marginLeft: `-${bufferPx}`
84
+ }),
85
+ // Row-Reverse
86
+ ...(reversed && horizontal && {
87
+ marginRight: `-${bufferPx}`
88
+ })
89
+ };
90
+ state.before.style = {
91
+ height: horizontal ? '100%' : beforeBufferHeightPx,
92
+ width: horizontal ? beforeBufferHeightPx : '100%',
93
+ ...beforeBuffer,
94
+ ...state.before.style
95
+ };
96
+ state.beforeContainer.style = {
97
+ height: horizontal ? 'auto' : beforeHeightPx,
98
+ width: horizontal ? beforeHeightPx : 'auto',
99
+ ...state.beforeContainer.style
100
+ };
101
+ state.after.style = {
102
+ height: horizontal ? '100%' : afterBufferHeightPx,
103
+ width: horizontal ? afterBufferHeightPx : '100%',
104
+ ...afterBuffer,
105
+ ...state.after.style
106
+ };
107
+ state.afterContainer.style = {
108
+ height: horizontal ? 'auto' : afterHeightPx,
109
+ width: horizontal ? afterHeightPx : 'auto',
110
+ ...state.afterContainer.style
111
+ };
112
+ return state;
113
+ };
114
+ exports.useVirtualizerStyles_unstable = useVirtualizerStyles_unstable;
115
+ //# sourceMappingURL=useVirtualizerStyles.js.map