@fluentui/react-virtualizer 9.0.0-alpha.8 → 9.0.0-alpha.81
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 +754 -8
- package/dist/index.d.ts +248 -30
- package/lib/Hooks.js +0 -1
- package/lib/Hooks.js.map +1 -1
- package/lib/Utilities.js +1 -0
- package/lib/Utilities.js.map +1 -0
- package/lib/Virtualizer.js +0 -1
- package/lib/Virtualizer.js.map +1 -1
- package/lib/VirtualizerScrollView.js +1 -0
- package/lib/VirtualizerScrollView.js.map +1 -0
- package/lib/VirtualizerScrollViewDynamic.js +1 -0
- package/lib/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/Virtualizer/Virtualizer.js +5 -7
- package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib/components/Virtualizer/Virtualizer.types.js +1 -2
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/index.js +1 -2
- package/lib/components/Virtualizer/index.js.map +1 -1
- package/lib/components/Virtualizer/renderVirtualizer.js +21 -16
- package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizer.js +439 -355
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/{useVirtualizerStyles.js → useVirtualizerStyles.styles.js} +5 -3
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +12 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +1 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib/components/VirtualizerScrollView/index.js +5 -0
- package/lib/components/VirtualizerScrollView/index.js.map +1 -0
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js +9 -0
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +81 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +47 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +12 -0
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/index.js +5 -0
- package/lib/components/VirtualizerScrollViewDynamic/index.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +9 -0
- package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +149 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +47 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
- package/lib/hooks/hooks.types.js +4 -0
- package/lib/hooks/hooks.types.js.map +1 -0
- package/lib/hooks/index.js +4 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useDynamicPagination.js +127 -0
- package/lib/hooks/useDynamicPagination.js.map +1 -0
- package/lib/hooks/useDynamicVirtualizerMeasure.js +101 -0
- package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -0
- package/lib/hooks/useIntersectionObserver.js +117 -40
- package/lib/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/hooks/useMeasureList.js +116 -0
- package/lib/hooks/useMeasureList.js.map +1 -0
- package/lib/hooks/useMutationObserver.js +38 -0
- package/lib/hooks/useMutationObserver.js.map +1 -0
- package/lib/hooks/useResizeObserverRef.js +50 -0
- package/lib/hooks/useResizeObserverRef.js.map +1 -0
- package/lib/hooks/useStaticPagination.js +103 -0
- package/lib/hooks/useStaticPagination.js.map +1 -0
- package/lib/hooks/useVirtualizerMeasure.js +46 -0
- package/lib/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.js +32 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js +1 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js +45 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -0
- package/lib/utilities/ImperativeScrolling/index.js +3 -0
- package/lib/utilities/ImperativeScrolling/index.js.map +1 -0
- package/lib/utilities/VirtualizerContext/VirtualizerContext.js +33 -0
- package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
- package/lib/utilities/VirtualizerContext/index.js +2 -0
- package/lib/utilities/VirtualizerContext/index.js.map +1 -0
- package/lib/utilities/VirtualizerContext/types.js +3 -0
- package/lib/utilities/VirtualizerContext/types.js.map +1 -0
- package/lib/utilities/createResizeObserverFromDocument.js +13 -0
- package/lib/utilities/createResizeObserverFromDocument.js.map +1 -0
- package/lib/utilities/debounce.js +19 -0
- package/lib/utilities/debounce.js.map +1 -0
- package/lib/utilities/index.js +2 -0
- package/lib/utilities/index.js.map +1 -0
- package/lib-commonjs/Hooks.js +3 -5
- package/lib-commonjs/Hooks.js.map +1 -1
- package/lib-commonjs/Utilities.js +6 -0
- package/lib-commonjs/Utilities.js.map +1 -0
- package/lib-commonjs/Virtualizer.js +3 -5
- package/lib-commonjs/Virtualizer.js.map +1 -1
- package/lib-commonjs/VirtualizerScrollView.js +6 -0
- package/lib-commonjs/VirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/VirtualizerScrollViewDynamic.js +6 -0
- package/lib-commonjs/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/Virtualizer/Virtualizer.js +15 -18
- package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/Virtualizer.types.js +3 -3
- package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/index.js +7 -9
- package/lib-commonjs/components/Virtualizer/index.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/renderVirtualizer.js +38 -21
- package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js +447 -361
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js +123 -0
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js +21 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +4 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js +10 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js +19 -0
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +91 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +70 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +21 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +4 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js +10 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +19 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +158 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +70 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
- package/lib-commonjs/hooks/hooks.types.js +7 -0
- package/lib-commonjs/hooks/hooks.types.js.map +1 -0
- package/lib-commonjs/hooks/index.js +7 -5
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicPagination.js +131 -0
- package/lib-commonjs/hooks/useDynamicPagination.js.map +1 -0
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js +108 -0
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -0
- package/lib-commonjs/hooks/useIntersectionObserver.js +129 -53
- package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
- package/lib-commonjs/hooks/useMeasureList.js +122 -0
- package/lib-commonjs/hooks/useMeasureList.js.map +1 -0
- package/lib-commonjs/hooks/useMutationObserver.js +48 -0
- package/lib-commonjs/hooks/useMutationObserver.js.map +1 -0
- package/lib-commonjs/hooks/useResizeObserverRef.js +59 -0
- package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -0
- package/lib-commonjs/hooks/useStaticPagination.js +107 -0
- package/lib-commonjs/hooks/useStaticPagination.js.map +1 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.js +54 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib-commonjs/index.js +82 -41
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js +42 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js +4 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js +55 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -0
- package/lib-commonjs/utilities/ImperativeScrolling/index.js +8 -0
- package/lib-commonjs/utilities/ImperativeScrolling/index.js.map +1 -0
- package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +54 -0
- package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
- package/lib-commonjs/utilities/VirtualizerContext/index.js +7 -0
- package/lib-commonjs/utilities/VirtualizerContext/index.js.map +1 -0
- package/lib-commonjs/utilities/VirtualizerContext/types.js +6 -0
- package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -0
- package/lib-commonjs/utilities/createResizeObserverFromDocument.js +23 -0
- package/lib-commonjs/utilities/createResizeObserverFromDocument.js.map +1 -0
- package/lib-commonjs/utilities/debounce.js +29 -0
- package/lib-commonjs/utilities/debounce.js.map +1 -0
- package/lib-commonjs/utilities/index.js +7 -0
- package/lib-commonjs/utilities/index.js.map +1 -0
- package/package.json +22 -13
- package/CHANGELOG.json +0 -125
- package/lib/components/Virtualizer/useVirtualizerStyles.js.map +0 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js +0 -115
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { Virtualizer, virtualizerClassNames, useVirtualizer_unstable, renderVirtualizer_unstable, useVirtualizerStyles_unstable } from './Virtualizer';
|
|
2
|
-
export { useIntersectionObserver } from './Hooks';
|
|
3
|
-
|
|
2
|
+
export { useIntersectionObserver, useStaticVirtualizerMeasure, useDynamicVirtualizerMeasure, useResizeObserverRef_unstable } from './Hooks';
|
|
3
|
+
export { VirtualizerContextProvider, useVirtualizerContext_unstable, scrollToItemStatic, scrollToItemDynamic } from './Utilities';
|
|
4
|
+
export { VirtualizerScrollView, virtualizerScrollViewClassNames, useVirtualizerScrollView_unstable, renderVirtualizerScrollView_unstable, useVirtualizerScrollViewStyles_unstable } from './VirtualizerScrollView';
|
|
5
|
+
export { VirtualizerScrollViewDynamic, virtualizerScrollViewDynamicClassNames, useVirtualizerScrollViewDynamic_unstable, renderVirtualizerScrollViewDynamic_unstable, useVirtualizerScrollViewDynamicStyles_unstable } from './VirtualizerScrollViewDynamic';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n Virtualizer,\n virtualizerClassNames,\n useVirtualizer_unstable,\n renderVirtualizer_unstable,\n useVirtualizerStyles_unstable,\n} from './Virtualizer';\n\nexport type {\n VirtualizerProps,\n VirtualizerState,\n VirtualizerSlots,\n VirtualizerChildRenderFunction,\n VirtualizerDataRef,\n} from './Virtualizer';\n\nexport {\n useIntersectionObserver,\n useStaticVirtualizerMeasure,\n useDynamicVirtualizerMeasure,\n useResizeObserverRef_unstable,\n} from './Hooks';\n\nexport type { ResizeCallbackWithRef, VirtualizerMeasureDynamicProps, VirtualizerMeasureProps } from './Hooks';\n\nexport type { ScrollToItemDynamicParams, ScrollToItemStaticParams, ScrollToInterface } from './Utilities';\n\nexport {\n VirtualizerContextProvider,\n useVirtualizerContext_unstable,\n scrollToItemStatic,\n scrollToItemDynamic,\n} from './Utilities';\n\nexport type { VirtualizerContextProps } from './Utilities';\n\nexport {\n VirtualizerScrollView,\n virtualizerScrollViewClassNames,\n useVirtualizerScrollView_unstable,\n renderVirtualizerScrollView_unstable,\n useVirtualizerScrollViewStyles_unstable,\n} from './VirtualizerScrollView';\n\nexport type {\n VirtualizerScrollViewProps,\n VirtualizerScrollViewState,\n VirtualizerScrollViewSlots,\n} from './VirtualizerScrollView';\n\nexport {\n VirtualizerScrollViewDynamic,\n virtualizerScrollViewDynamicClassNames,\n useVirtualizerScrollViewDynamic_unstable,\n renderVirtualizerScrollViewDynamic_unstable,\n useVirtualizerScrollViewDynamicStyles_unstable,\n} from './VirtualizerScrollViewDynamic';\n\nexport type {\n VirtualizerScrollViewDynamicProps,\n VirtualizerScrollViewDynamicState,\n VirtualizerScrollViewDynamicSlots,\n} from './VirtualizerScrollViewDynamic';\n"],"names":["Virtualizer","virtualizerClassNames","useVirtualizer_unstable","renderVirtualizer_unstable","useVirtualizerStyles_unstable","useIntersectionObserver","useStaticVirtualizerMeasure","useDynamicVirtualizerMeasure","useResizeObserverRef_unstable","VirtualizerContextProvider","useVirtualizerContext_unstable","scrollToItemStatic","scrollToItemDynamic","VirtualizerScrollView","virtualizerScrollViewClassNames","useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable","VirtualizerScrollViewDynamic","virtualizerScrollViewDynamicClassNames","useVirtualizerScrollViewDynamic_unstable","renderVirtualizerScrollViewDynamic_unstable","useVirtualizerScrollViewDynamicStyles_unstable"],"rangeMappings":";;;;","mappings":"AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,6BAA6B,QACxB,gBAAgB;AAUvB,SACEC,uBAAuB,EACvBC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,6BAA6B,QACxB,UAAU;AAMjB,SACEC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,kBAAkB,EAClBC,mBAAmB,QACd,cAAc;AAIrB,SACEC,qBAAqB,EACrBC,+BAA+B,EAC/BC,iCAAiC,EACjCC,oCAAoC,EACpCC,uCAAuC,QAClC,0BAA0B;AAQjC,SACEC,4BAA4B,EAC5BC,sCAAsC,EACtCC,wCAAwC,EACxCC,2CAA2C,EAC3CC,8CAA8C,QACzC,iCAAiC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const scrollToItemStatic = (params)=>{
|
|
2
|
+
const { index, itemSize, totalItems, scrollViewRef, axis = 'vertical', reversed = false, behavior = 'auto' } = params;
|
|
3
|
+
if (axis === 'horizontal') {
|
|
4
|
+
if (reversed) {
|
|
5
|
+
var _scrollViewRef_current;
|
|
6
|
+
(_scrollViewRef_current = scrollViewRef.current) === null || _scrollViewRef_current === void 0 ? void 0 : _scrollViewRef_current.scrollTo({
|
|
7
|
+
left: totalItems * itemSize - itemSize * index,
|
|
8
|
+
behavior
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
var _scrollViewRef_current1;
|
|
12
|
+
(_scrollViewRef_current1 = scrollViewRef.current) === null || _scrollViewRef_current1 === void 0 ? void 0 : _scrollViewRef_current1.scrollTo({
|
|
13
|
+
left: itemSize * index,
|
|
14
|
+
behavior
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
if (reversed) {
|
|
19
|
+
var _scrollViewRef_current2;
|
|
20
|
+
(_scrollViewRef_current2 = scrollViewRef.current) === null || _scrollViewRef_current2 === void 0 ? void 0 : _scrollViewRef_current2.scrollTo({
|
|
21
|
+
top: totalItems * itemSize - itemSize * index,
|
|
22
|
+
behavior
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
var _scrollViewRef_current3;
|
|
26
|
+
(_scrollViewRef_current3 = scrollViewRef.current) === null || _scrollViewRef_current3 === void 0 ? void 0 : _scrollViewRef_current3.scrollTo({
|
|
27
|
+
top: itemSize * index,
|
|
28
|
+
behavior
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["imperativeScrolling.ts"],"sourcesContent":["import { ScrollToItemStaticParams } from './imperativeScrolling.types';\n\nexport const scrollToItemStatic = (params: ScrollToItemStaticParams) => {\n const { index, itemSize, totalItems, scrollViewRef, axis = 'vertical', reversed = false, behavior = 'auto' } = params;\n\n if (axis === 'horizontal') {\n if (reversed) {\n scrollViewRef.current?.scrollTo({\n left: totalItems * itemSize - itemSize * index,\n behavior,\n });\n } else {\n scrollViewRef.current?.scrollTo({\n left: itemSize * index,\n behavior,\n });\n }\n } else {\n if (reversed) {\n scrollViewRef.current?.scrollTo({\n top: totalItems * itemSize - itemSize * index,\n behavior,\n });\n } else {\n scrollViewRef.current?.scrollTo({\n top: itemSize * index,\n behavior,\n });\n }\n }\n};\n"],"names":["scrollToItemStatic","params","index","itemSize","totalItems","scrollViewRef","axis","reversed","behavior","current","scrollTo","left","top"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,qBAAqB,CAACC;IACjC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,aAAa,EAAEC,OAAO,UAAU,EAAEC,WAAW,KAAK,EAAEC,WAAW,MAAM,EAAE,GAAGP;IAE/G,IAAIK,SAAS,cAAc;QACzB,IAAIC,UAAU;gBACZF;aAAAA,yBAAAA,cAAcI,OAAO,cAArBJ,6CAAAA,uBAAuBK,QAAQ,CAAC;gBAC9BC,MAAMP,aAAaD,WAAWA,WAAWD;gBACzCM;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAO,cAArBJ,8CAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BC,MAAMR,WAAWD;gBACjBM;YACF;QACF;IACF,OAAO;QACL,IAAID,UAAU;gBACZF;aAAAA,0BAAAA,cAAcI,OAAO,cAArBJ,8CAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BE,KAAKR,aAAaD,WAAWA,WAAWD;gBACxCM;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAO,cAArBJ,8CAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BE,KAAKT,WAAWD;gBAChBM;YACF;QACF;IACF;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["imperativeScrolling.types.ts"],"sourcesContent":["import type { RefObject } from 'react';\n\nexport type ScrollToItemStaticParams = {\n index: number;\n itemSize: number;\n totalItems: number;\n scrollViewRef: RefObject<HTMLDivElement>;\n axis?: 'horizontal' | 'vertical';\n reversed?: boolean;\n behavior?: ScrollBehavior;\n};\n\nexport type ScrollToItemDynamicParams = {\n index: number;\n itemSizes: RefObject<number[]>;\n totalSize: number;\n scrollViewRef: RefObject<HTMLDivElement>;\n axis?: 'horizontal' | 'vertical';\n reversed?: boolean;\n behavior?: ScrollBehavior;\n};\n\nexport type ScrollToInterface = {\n scrollTo: (index: number, behavior?: ScrollBehavior, callback?: (index: number) => void) => void;\n virtualizerLength: RefObject<number>;\n currentIndex: RefObject<number> | undefined;\n};\n"],"names":[],"rangeMappings":"","mappings":"AAsBA,WAIE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const scrollToItemDynamic = (params)=>{
|
|
2
|
+
const { index, itemSizes, totalSize, scrollViewRef, axis = 'vertical', reversed = false, behavior = 'auto' } = params;
|
|
3
|
+
if (!itemSizes.current) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
if (itemSizes.current === null || itemSizes.current.length < index) {
|
|
7
|
+
// null check - abort
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
let itemDepth = 0;
|
|
11
|
+
for(let i = 0; i < index; i++){
|
|
12
|
+
if (i < index) {
|
|
13
|
+
itemDepth += itemSizes.current[i];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (axis === 'horizontal') {
|
|
17
|
+
if (reversed) {
|
|
18
|
+
var _scrollViewRef_current;
|
|
19
|
+
(_scrollViewRef_current = scrollViewRef.current) === null || _scrollViewRef_current === void 0 ? void 0 : _scrollViewRef_current.scrollTo({
|
|
20
|
+
left: totalSize - itemDepth,
|
|
21
|
+
behavior
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
var _scrollViewRef_current1;
|
|
25
|
+
(_scrollViewRef_current1 = scrollViewRef.current) === null || _scrollViewRef_current1 === void 0 ? void 0 : _scrollViewRef_current1.scrollTo({
|
|
26
|
+
left: itemDepth,
|
|
27
|
+
behavior
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
if (reversed) {
|
|
32
|
+
var _scrollViewRef_current2;
|
|
33
|
+
(_scrollViewRef_current2 = scrollViewRef.current) === null || _scrollViewRef_current2 === void 0 ? void 0 : _scrollViewRef_current2.scrollTo({
|
|
34
|
+
top: totalSize - itemDepth,
|
|
35
|
+
behavior
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
var _scrollViewRef_current3;
|
|
39
|
+
(_scrollViewRef_current3 = scrollViewRef.current) === null || _scrollViewRef_current3 === void 0 ? void 0 : _scrollViewRef_current3.scrollTo({
|
|
40
|
+
top: itemDepth,
|
|
41
|
+
behavior
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["imperativeScrollingDynamic.ts"],"sourcesContent":["import { ScrollToItemDynamicParams } from './imperativeScrolling.types';\n\nexport const scrollToItemDynamic = (params: ScrollToItemDynamicParams) => {\n const { index, itemSizes, totalSize, scrollViewRef, axis = 'vertical', reversed = false, behavior = 'auto' } = params;\n if (!itemSizes.current) {\n return;\n }\n\n if (itemSizes.current === null || itemSizes.current.length < index) {\n // null check - abort\n return;\n }\n\n let itemDepth = 0;\n for (let i = 0; i < index; i++) {\n if (i < index) {\n itemDepth += itemSizes.current[i];\n }\n }\n\n if (axis === 'horizontal') {\n if (reversed) {\n scrollViewRef.current?.scrollTo({\n left: totalSize - itemDepth,\n behavior,\n });\n } else {\n scrollViewRef.current?.scrollTo({\n left: itemDepth,\n behavior,\n });\n }\n } else {\n if (reversed) {\n scrollViewRef.current?.scrollTo({\n top: totalSize - itemDepth,\n behavior,\n });\n } else {\n scrollViewRef.current?.scrollTo({\n top: itemDepth,\n behavior,\n });\n }\n }\n};\n"],"names":["scrollToItemDynamic","params","index","itemSizes","totalSize","scrollViewRef","axis","reversed","behavior","current","length","itemDepth","i","scrollTo","left","top"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,sBAAsB,CAACC;IAClC,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,SAAS,EAAEC,aAAa,EAAEC,OAAO,UAAU,EAAEC,WAAW,KAAK,EAAEC,WAAW,MAAM,EAAE,GAAGP;IAC/G,IAAI,CAACE,UAAUM,OAAO,EAAE;QACtB;IACF;IAEA,IAAIN,UAAUM,OAAO,KAAK,QAAQN,UAAUM,OAAO,CAACC,MAAM,GAAGR,OAAO;QAClE,qBAAqB;QACrB;IACF;IAEA,IAAIS,YAAY;IAChB,IAAK,IAAIC,IAAI,GAAGA,IAAIV,OAAOU,IAAK;QAC9B,IAAIA,IAAIV,OAAO;YACbS,aAAaR,UAAUM,OAAO,CAACG,EAAE;QACnC;IACF;IAEA,IAAIN,SAAS,cAAc;QACzB,IAAIC,UAAU;gBACZF;aAAAA,yBAAAA,cAAcI,OAAO,cAArBJ,6CAAAA,uBAAuBQ,QAAQ,CAAC;gBAC9BC,MAAMV,YAAYO;gBAClBH;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAO,cAArBJ,8CAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BC,MAAMH;gBACNH;YACF;QACF;IACF,OAAO;QACL,IAAID,UAAU;gBACZF;aAAAA,0BAAAA,cAAcI,OAAO,cAArBJ,8CAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BE,KAAKX,YAAYO;gBACjBH;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAO,cAArBJ,8CAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BE,KAAKJ;gBACLH;YACF;QACF;IACF;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './imperativeScrolling';\nexport * from './imperativeScrolling.types';\nexport * from './imperativeScrollingDynamic';\n"],"names":[],"rangeMappings":";;","mappings":"AAAA,cAAc,wBAAwB;AACtC,cAAc,8BAA8B;AAC5C,cAAc,+BAA+B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
const VirtualizerContext = React.createContext(undefined);
|
|
4
|
+
export const VirtualizerContextProvider = VirtualizerContext.Provider;
|
|
5
|
+
export const useVirtualizerContext_unstable = ()=>{
|
|
6
|
+
return React.useContext(VirtualizerContext);
|
|
7
|
+
};
|
|
8
|
+
export const useVirtualizerContextState_unstable = (passedContext)=>{
|
|
9
|
+
const virtualizerContext = useVirtualizerContext_unstable();
|
|
10
|
+
const [_contextIndex, _setContextIndex] = useState(-1);
|
|
11
|
+
/* We respect any wrapped providers while also ensuring defaults or passed through
|
|
12
|
+
* Order of usage -> Passed Prop -> Provider Context -> Internal State default
|
|
13
|
+
*/ const _context = useMemo(()=>{
|
|
14
|
+
var _ref;
|
|
15
|
+
return (_ref = passedContext !== null && passedContext !== void 0 ? passedContext : virtualizerContext) !== null && _ref !== void 0 ? _ref : {
|
|
16
|
+
contextIndex: _contextIndex,
|
|
17
|
+
setContextIndex: _setContextIndex
|
|
18
|
+
};
|
|
19
|
+
}, [
|
|
20
|
+
_contextIndex,
|
|
21
|
+
passedContext,
|
|
22
|
+
virtualizerContext
|
|
23
|
+
]);
|
|
24
|
+
const context = useMemo(()=>{
|
|
25
|
+
return {
|
|
26
|
+
contextIndex: _context.contextIndex,
|
|
27
|
+
setContextIndex: _context.setContextIndex
|
|
28
|
+
};
|
|
29
|
+
}, [
|
|
30
|
+
_context
|
|
31
|
+
]);
|
|
32
|
+
return context;
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VirtualizerContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { VirtualizerContextProps } from './types';\nimport { useMemo, useState } from 'react';\n\nconst VirtualizerContext = React.createContext<VirtualizerContextProps | undefined>(\n undefined,\n) as React.Context<VirtualizerContextProps>;\n\nexport const VirtualizerContextProvider = VirtualizerContext.Provider;\n\nexport const useVirtualizerContext_unstable = () => {\n return React.useContext(VirtualizerContext);\n};\n\nexport const useVirtualizerContextState_unstable = (\n passedContext?: VirtualizerContextProps,\n): VirtualizerContextProps => {\n const virtualizerContext = useVirtualizerContext_unstable();\n const [_contextIndex, _setContextIndex] = useState<number>(-1);\n\n /* We respect any wrapped providers while also ensuring defaults or passed through\n * Order of usage -> Passed Prop -> Provider Context -> Internal State default\n */\n const _context = useMemo(\n () => passedContext ?? virtualizerContext ?? { contextIndex: _contextIndex, setContextIndex: _setContextIndex },\n [_contextIndex, passedContext, virtualizerContext],\n );\n const context = useMemo(() => {\n return { contextIndex: _context.contextIndex, setContextIndex: _context.setContextIndex };\n }, [_context]);\n\n return context;\n};\n"],"names":["React","useMemo","useState","VirtualizerContext","createContext","undefined","VirtualizerContextProvider","Provider","useVirtualizerContext_unstable","useContext","useVirtualizerContextState_unstable","passedContext","virtualizerContext","_contextIndex","_setContextIndex","_context","contextIndex","setContextIndex","context"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAE1C,MAAMC,qBAAqBH,MAAMI,aAAa,CAC5CC;AAGF,OAAO,MAAMC,6BAA6BH,mBAAmBI,QAAQ,CAAC;AAEtE,OAAO,MAAMC,iCAAiC;IAC5C,OAAOR,MAAMS,UAAU,CAACN;AAC1B,EAAE;AAEF,OAAO,MAAMO,sCAAsC,CACjDC;IAEA,MAAMC,qBAAqBJ;IAC3B,MAAM,CAACK,eAAeC,iBAAiB,GAAGZ,SAAiB,CAAC;IAE5D;;GAEC,GACD,MAAMa,WAAWd,QACf;YAAMU;eAAAA,CAAAA,OAAAA,0BAAAA,2BAAAA,gBAAiBC,gCAAjBD,kBAAAA,OAAuC;YAAEK,cAAcH;YAAeI,iBAAiBH;QAAiB;IAAA,GAC9G;QAACD;QAAeF;QAAeC;KAAmB;IAEpD,MAAMM,UAAUjB,QAAQ;QACtB,OAAO;YAAEe,cAAcD,SAASC,YAAY;YAAEC,iBAAiBF,SAASE,eAAe;QAAC;IAC1F,GAAG;QAACF;KAAS;IAEb,OAAOG;AACT,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './VirtualizerContext';\nexport * from './types';\n"],"names":[],"rangeMappings":";","mappings":"AAAA,cAAc,uBAAuB;AACrC,cAAc,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["types.ts"],"sourcesContent":["/**\n * {@docCategory Virtualizer}\n */\nexport type VirtualizerContextProps = {\n contextIndex: number;\n setContextIndex: (index: number) => void;\n};\n"],"names":[],"rangeMappings":";;","mappings":"AAAA;;CAEC,GACD,WAGE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FIXME - TS 3.8/3.9 don't have ResizeObserver types by default, move this to a shared utility once we bump the minbar
|
|
3
|
+
* A utility method that creates a ResizeObserver from a target document
|
|
4
|
+
* @param targetDocument - document to use to create the ResizeObserver
|
|
5
|
+
* @param callback - https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver#callback
|
|
6
|
+
* @returns a ResizeObserver instance or null if the global does not exist on the document
|
|
7
|
+
*/ export function createResizeObserverFromDocument(targetDocument, callback) {
|
|
8
|
+
var _targetDocument_defaultView;
|
|
9
|
+
if (!(targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.ResizeObserver)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return new targetDocument.defaultView.ResizeObserver(callback);
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createResizeObserverFromDocument.ts"],"sourcesContent":["/**\n * FIXME - TS 3.8/3.9 don't have ResizeObserver types by default, move this to a shared utility once we bump the minbar\n * A utility method that creates a ResizeObserver from a target document\n * @param targetDocument - document to use to create the ResizeObserver\n * @param callback - https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver#callback\n * @returns a ResizeObserver instance or null if the global does not exist on the document\n */\nexport function createResizeObserverFromDocument(\n targetDocument: Document | null | undefined,\n callback: ResizeObserverCallback,\n) {\n if (!targetDocument?.defaultView?.ResizeObserver) {\n return null;\n }\n\n return new targetDocument.defaultView.ResizeObserver(callback);\n}\n"],"names":["createResizeObserverFromDocument","targetDocument","callback","defaultView","ResizeObserver"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA;;;;;;CAMC,GACD,OAAO,SAASA,iCACdC,cAA2C,EAC3CC,QAAgC;QAE3BD;IAAL,IAAI,EAACA,2BAAAA,sCAAAA,8BAAAA,eAAgBE,WAAW,cAA3BF,kDAAAA,4BAA6BG,cAAc,GAAE;QAChD,OAAO;IACT;IAEA,OAAO,IAAIH,eAAeE,WAAW,CAACC,cAAc,CAACF;AACvD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microtask debouncer
|
|
3
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide
|
|
4
|
+
* @param fn - Function to debounce
|
|
5
|
+
* @returns debounced function
|
|
6
|
+
*/ export function debounce(fn) {
|
|
7
|
+
let pending;
|
|
8
|
+
return ()=>{
|
|
9
|
+
if (!pending) {
|
|
10
|
+
pending = true;
|
|
11
|
+
queueMicrotask(()=>{
|
|
12
|
+
// Need to set pending to `false` before the debounced function is run.
|
|
13
|
+
// React can actually interrupt the function while it's running!
|
|
14
|
+
pending = false;
|
|
15
|
+
fn();
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["debounce.ts"],"sourcesContent":["/**\n * Microtask debouncer\n * https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide\n * @param fn - Function to debounce\n * @returns debounced function\n */\nexport function debounce(fn: Function) {\n let pending: boolean;\n return () => {\n if (!pending) {\n pending = true;\n queueMicrotask(() => {\n // Need to set pending to `false` before the debounced function is run.\n // React can actually interrupt the function while it's running!\n pending = false;\n fn();\n });\n }\n };\n}\n"],"names":["debounce","fn","pending","queueMicrotask"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,SAASC,EAAY;IACnC,IAAIC;IACJ,OAAO;QACL,IAAI,CAACA,SAAS;YACZA,UAAU;YACVC,eAAe;gBACb,uEAAuE;gBACvE,gEAAgE;gBAChED,UAAU;gBACVD;YACF;QACF;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './VirtualizerContext';\nexport * from './ImperativeScrolling';\n"],"names":[],"rangeMappings":";","mappings":"AAAA,cAAc,uBAAuB;AACrC,cAAc,wBAAwB"}
|
package/lib-commonjs/Hooks.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=Hooks.js.map
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./hooks/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["Hooks.ts"],"sourcesContent":["export * from './hooks/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Utilities.ts"],"sourcesContent":["export * from './utilities/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=Virtualizer.js.map
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/Virtualizer/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["Virtualizer.ts"],"sourcesContent":["export * from './components/Virtualizer/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VirtualizerScrollView.ts"],"sourcesContent":["export * from './components/VirtualizerScrollView/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VirtualizerScrollViewDynamic.ts"],"sourcesContent":["export * from './components/VirtualizerScrollViewDynamic/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const Virtualizer = props
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
Object.defineProperty(exports, "Virtualizer", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Virtualizer;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _useVirtualizerStylesstyles = require("./useVirtualizerStyles.styles");
|
|
12
|
+
const _useVirtualizer = require("./useVirtualizer");
|
|
13
|
+
const _renderVirtualizer = require("./renderVirtualizer");
|
|
14
|
+
const Virtualizer = (props)=>{
|
|
15
|
+
const state = (0, _useVirtualizer.useVirtualizer_unstable)(props);
|
|
16
|
+
(0, _useVirtualizerStylesstyles.useVirtualizerStyles_unstable)(state);
|
|
17
|
+
return (0, _renderVirtualizer.renderVirtualizer_unstable)(state);
|
|
19
18
|
};
|
|
20
|
-
|
|
21
|
-
exports.Virtualizer.displayName = 'Virtualizer';
|
|
22
|
-
//# sourceMappingURL=Virtualizer.js.map
|
|
19
|
+
Virtualizer.displayName = 'Virtualizer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["Virtualizer.ts"],"sourcesContent":["import type { VirtualizerProps } from './Virtualizer.types';\nimport { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';\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"],"names":["Virtualizer","props","state","useVirtualizer_unstable","useVirtualizerStyles_unstable","renderVirtualizer_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;4CAViC;gCACN;mCACG;AAQpC,MAAMA,cAAoC,CAACC;IAChD,MAAMC,QAAQC,IAAAA,uCAAAA,EAAwBF;IACtCG,IAAAA,yDAAAA,EAA8BF;IAE9B,OAAOG,IAAAA,6CAAAA,EAA2BH;AACpC;AAEAF,YAAYM,WAAW,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
|
|
5
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
6
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./Virtualizer"), exports);
|
|
7
|
+
_export_star._(require("./Virtualizer.types"), exports);
|
|
8
|
+
_export_star._(require("./useVirtualizer"), exports);
|
|
9
|
+
_export_star._(require("./renderVirtualizer"), exports);
|
|
10
|
+
_export_star._(require("./useVirtualizerStyles.styles"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles.styles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
renderVirtualizerChildPlaceholder: function() {
|
|
13
|
+
return renderVirtualizerChildPlaceholder;
|
|
14
|
+
},
|
|
15
|
+
renderVirtualizer_unstable: function() {
|
|
16
|
+
return renderVirtualizer_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
20
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
21
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
23
|
+
const renderVirtualizer_unstable = (state)=>{
|
|
24
|
+
(0, _reactutilities.assertSlots)(state);
|
|
25
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
26
|
+
children: [
|
|
27
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.beforeContainer, {
|
|
28
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.before, {})
|
|
29
|
+
}),
|
|
30
|
+
state.virtualizedChildren,
|
|
31
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.afterContainer, {
|
|
32
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.after, {})
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const renderVirtualizerChildPlaceholder = (child, index)=>{
|
|
38
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Suspense, {
|
|
39
|
+
fallback: null,
|
|
40
|
+
children: child
|
|
41
|
+
}, `fui-virtualizer-placeholder-${index}`);
|
|
23
42
|
};
|
|
24
|
-
exports.renderVirtualizer_unstable = renderVirtualizer_unstable;
|
|
25
|
-
//# sourceMappingURL=renderVirtualizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["renderVirtualizer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport type { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { ReactNode } from 'react';\n\nimport { assertSlots } from '@fluentui/react-utilities';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n assertSlots<VirtualizerSlots>(state);\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <state.beforeContainer>\n <state.before />\n </state.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 <state.afterContainer>\n <state.after />\n </state.afterContainer>\n </React.Fragment>\n );\n};\n\nexport const renderVirtualizerChildPlaceholder = (child: ReactNode, index: number) => {\n return (\n <React.Suspense key={`fui-virtualizer-placeholder-${index}`} fallback={null}>\n {child}\n </React.Suspense>\n );\n};\n"],"names":["renderVirtualizerChildPlaceholder","renderVirtualizer_unstable","state","assertSlots","_jsxs","React","Fragment","_jsx","beforeContainer","before","virtualizedChildren","afterContainer","after","child","index","Suspense","fallback"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA2BaA,iCAAAA;eAAAA;;IAlBAC,0BAAAA;eAAAA;;;;4BARb;iEAEuB;gCAIK;AAErB,MAAMA,6BAA6B,CAACC;IACzCC,IAAAA,2BAAAA,EAA8BD;IAC9B,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAACC,OAAMC,QAAQ,EAAA;;0BAEbC,IAAAA,eAAA,EAACL,MAAMM,eAAe,EAAA;0BACpB,WAAA,GAAAD,IAAAA,eAAA,EAACL,MAAMO,MAAM,EAAA,CAAA;;YAGdP,MAAMQ,mBAAmB;0BAE1BH,IAAAA,eAAA,EAACL,MAAMS,cAAc,EAAA;0BACnB,WAAA,GAAAJ,IAAAA,eAAA,EAACL,MAAMU,KAAK,EAAA,CAAA;;;;AAIpB;AAEO,MAAMZ,oCAAoC,CAACa,OAAkBC;IAClE,OAAA,WAAA,GACEP,IAAAA,eAAA,EAACF,OAAMU,QAAQ,EAAA;QAA8CC,UAAU;kBACpEH;OADkB,CAAC,4BAA4B,EAAEC,MAAM,CAAC;AAI/D"}
|